/* this is an example formatted token file for a pascal
 * prettyprinter. 
 */


%%

"<>"       MATH     { "$\\neq$" }         // not equal sign
"<="       MATH     { "$\\leq$" }          // less or equal
">="       MATH     { "$\\geq$" }          // greater or equal
":="       MATH     { "\\hbox{${}\\mathrel{:=}{}$}" }   // assignment
'([^']|'')*'    SIMP  { "{\\tt " + ** + "}" }   // strings
"("        OPEN
")"        CLOSE

"["        OPEN
"]"        CLOSE
"*"        MATH     { "$\\ast$" }
","        MATH     { ** + opt9 }
".."       MATH
"."        SIMP
":"        COLON
";"        SEMI
"="        MATH
"+"        MATH
"-"        MATH
"<"        MATH     { "$<$" }
">"        MATH     { "$>$" }
"/"        MATH
                 // this to allow underscores in identifiers:
"_"[a-zA-Z0-9]*    ID_TYPE    {"\\" + ** }

[0-9]+             SIMP
[0-9]*"."[0-9]+    SIMP

and        MATH     {"{\\bf and}"}
array      ALPHA    {"{\\bf array}"}
begin      BEG      {force + "\n" + "{\\bf begin}" }
boolean    SIMP     {"{\\bf boolean}"}
case       CASE     {force + "{\\bf case}" + cancel }
const      INTRO    {force + backup + "{\bf const}"}
div        MATH     {" {\\bf div} "}
do         OMEGA    {"{\\bf do}"}
downto     MATH     {"{\\bf downto}"}
else       ELSE     {"{\\bf else}" }
end        END      {"{\\bf end}" }
for        ALPHA    {"{\\bf for}" }
function   PROC     {big_force + backup + "{\\bf function} " }
if         ALPHA    {"{\\bf if}" }
integer    SIMP     {"{\\bf integer}"}
mod        MATH     {"{\\bf mod}"}
not        MATH     {"{\\bf not}"}
of         OMEGA    {"{\\bf of} " + cancel }
or         MATH     {"{\\bf or} "}
procedure  PROC     {big_force + backup + "{\\bf procedure} " }
program    PROC     {big_force + backup + "{\\bf program} "}
readln     SIMP     {"{\\bf readln}"}
real       SIMP     {"{\\bf real}"}
record     RECORD   {"{\\bf record}"}
repeat     BEG      {force + "{\\bf repeat}" }
then       OMEGA    {"{\\bf then}" }
to         MATH     {" {\\bf to} "}
type       INTRO    {force + backup + "{\\bf type}" }
until      UNTIL    {force + "{\\bf until}" }
var        INTRO    {force + backup + "{\\bf var} "  }
while      ALPHA    {force + "{\\bf while}" }
with       ALPHA    {force + "{\\bf with}"}
write      SIMP     {"{\\bf write}"}
writeln    SIMP     {"{\\bf writeln}"}


"{"[^}]*"}"    COMMENT    { "\\hbox{$\\{${" + ** + "}$\\}$}" }   // comments

[a-zA-Z][a-zA-Z0-9]*    ID_TYPE    // identifiers

[\t\ \n]          // eat up whitespace

.                 // eat up other non matching characters
