/usr/share/mozart/examples/gump/LambdaScanner.ozg is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | declare
scanner LambdaScanner from GumpScanner.'class'
attr LineNumber
meth init()
GumpScanner.'class', init()
LineNumber <- 1
end
meth getLineNumber($)
@LineNumber
end
lex digit = <[0-9]> end
lex letter = <[A-Za-z]> end
lex id = <{letter}({letter}|{digit})*> end
lex int = <{digit}+> end
lex <define>
GumpScanner.'class', putToken1('define')
end
lex <lambda>
GumpScanner.'class', putToken1('lambda')
end
lex <{id}> A in
GumpScanner.'class', getAtom(?A)
GumpScanner.'class', putToken('id' A)
end
lex <{int}> S in
GumpScanner.'class', getString(?S)
GumpScanner.'class', putToken('int' {String.toInt S})
end
lex <"."|"("|")"|"="|";"> A in
GumpScanner.'class', getAtom(?A)
GumpScanner.'class', putToken1(A)
end
lex <[ \t]> skip end
lex <"%".*> skip end
lex <\n>
LineNumber <- @LineNumber + 1
end
lex <.>
{System.showInfo 'line '#@LineNumber#': unrecognized character'}
GumpScanner.'class', putToken1('error')
end
lex <<EOF>>
GumpScanner.'class', putToken1('EOF')
end
end
|