The syntax may contain (case-sensitive) these nonterminals:
Example:
token ::= `identifier` ; // using StandardLexerRules ignored ::= `spaces` ; ignored ::= `newline` ; ignored ::= comment ; comment ::= "//" char_minus_newline_list_opt ; char_minus_newline ::= chars - newline; char_minus_newline_list ::= char_minus_newline_list char_minus_newline; char_minus_newline_list ::= char_minus_newline ; char_minus_newline_list_opt ::= char_minus_newline_list; char_minus_newline_list_opt ::= ; // nothingMind that the builder input can not be a text file, it must be wrapped into Syntax. Use syntax builder to convert a text into a Syntax object.
Java code fragment:
SyntaxSeparation separation = new SyntaxSeparation(new Syntax(myRules)); LexerBuilder builder = new LexerBuilder(separation.getLexerSyntax(), separation.getIgnoredSymbols()); Lexer lexer = builder.getLexer(); // when using the lexer standalone (without Parser), you must put the token terminal symbols into it now: lexer.setTerminals(separation.getTokenSymbols());@see fri.patterns.interpreter.parsergenerator.syntax.builder.SyntaxSeparation @see fri.patterns.interpreter.parsergenerator.lexer.StandardLexerRules @author (c) 2002, Fritz Ritzberger
|
|
|
|