# Style sheet for stratego
# Copyright (c) 2002 Nicolas Tisserand
#

#
# This file is part of a2ps.
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.  If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#

#
# This style sheet is based on the stratego grammar:
# http://strategoxt.org/
#

style "stratego" is

written by "Nicolas Tisserand <tisser_n@lrde.epita.fr>"

version is 1.0

requires a2ps 4.9.5

documentation is
	"Highlights stratego source code"
end documentation

first alphabet is
	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.-_"
second alphabet is
	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.-_'"
case sensitive

keywords in Keyword_strong are
	"all", "constructors", "fail", "id", "imports", "in", "let", "module",
	"not", "one", "overlays", "override", "prim", "rules", "script",
	"signature", "some", "sorts", "strategies", "stratego", "test",
	"thread", "where"
end keywords

# common keywords from the stratego library
keywords in Keyword are
	"try", "if", "ior", "eq", "repeat", "repeat-until",
	"while", "do-while", "for", "topdown", "bottomup", "downup",
	"minus", "plus", "add", "subt", "mul", "div", "mod",
	"geq", "gt", "lt", "leq", "max", "min", "int",
	"is-int", "int-to-string", "string-to-int",
	"new", "is-string", "lower-case", "upper-case",
	"init-name-space", "exit-name-space", "begin-scope", "end-scope",
	"scope", "assert", "rewrite",
	"list", "map", "is-list", "length", "fetch", "lookup",
	"last", "init", "copy",
	"take", "take-while", "take-until",
	"drop", "drop-while", "drop-until", 
	"substitute", "diff", "pattern-match", "unify", "equal",
	"print", "WriteToTextFile", "WriteToBinaryFile",
	"open-file", "append-file", "close-file",
	"say", "echo", "trace", "error", "fatal-error",
	"printchar", "print-string", "iowrap",
	"pipe", "exit", "call"
end keywords

operators in Keyword_strong are
	-> \rightarrow,
	-->,
	=,
	#,
	@,
	_,
	|,	
	],
	[,
	^,
	},
	{ ,
	"+" ,
	"<" ,
	"<+" ,
	"<++" ,
	">" ,
	"+>" ,
	"++>" ,
	(/^([\t ]*[a-zA-Z0-9'._\-]*)([\t ]*[:=])/ \1 Label_strong, \2 Plain)
end operators

sequences are
	"/*" Comment "*/",
	"//" Comment,
	"(*" Comment "*)",
	"\\literate" Comment "\\begin{code}",
	"\\end{code}" Comment "\\begin{code}",
	C-string
end sequences

end style
