Initial check in docu
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
// ============================================================================
|
||||
// Demo lexer for four operator calculator
|
||||
// ============================================================================
|
||||
unit calcLexer;
|
||||
|
||||
lexer TcalcLexer;
|
||||
options
|
||||
{
|
||||
exportVocab = calcLexer;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Simple tokens
|
||||
// ============================================================================
|
||||
LPAREN : '(';
|
||||
RPAREN : ')';
|
||||
|
||||
PLUS : '+';
|
||||
MINUS : '-';
|
||||
STAR : '*';
|
||||
SLASH : '/';
|
||||
|
||||
SEMI : ';';
|
||||
|
||||
// ============================================================================
|
||||
// INT
|
||||
// ============================================================================
|
||||
INT : ('0'..'9')+;
|
||||
|
||||
// ============================================================================
|
||||
// White space
|
||||
// ============================================================================
|
||||
WS
|
||||
:
|
||||
(
|
||||
options
|
||||
{
|
||||
generateAmbigWarnings = false;
|
||||
}
|
||||
: '\r' '\n' { newLine; }
|
||||
| '\r' { newLine; }
|
||||
| '\n' { newLine; }
|
||||
| '\t' { tab; }
|
||||
| ' '
|
||||
)
|
||||
{
|
||||
_ttype := TT_SKIP;
|
||||
}
|
||||
;
|
||||
Reference in New Issue
Block a user