fri.patterns.interpreter.parsergenerator.syntax.builder
Class SyntaxSeparation

java.lang.Object
  |
  +--fri.patterns.interpreter.parsergenerator.syntax.builder.SyntaxSeparation

public class SyntaxSeparation
extends java.lang.Object

Separates lexer from parser rules. Provides token and ignored symbols after construction, which can be used for LexerBuilder construction.

Example:

                SyntaxSeparation separation = new SyntaxSeparation(new Syntax(myRules));
                LexerBuilder builder = new LexerBuilder(separation.getLexerSyntax(), separation.getIgnoredSymbols());
                Lexer lexer = builder.getLexer();
                // when using the lexer standalone, you must put the token terminal symbols into it now:
                lexer.setTerminals(separation.getTokenSymbols());
                // when using a Parser the Parser will do this:
        

Author:
(c) 2002, Fritz Ritzberger
See Also:
LexerBuilder

Nested Class Summary
static class SyntaxSeparation.IntArray
           
 
Field Summary
static boolean DEBUG
           
 
Constructor Summary
SyntaxSeparation(Syntax syntax)
          Splits a syntax into two syntaxes containing parser and lexer rules, tokens and ignored get collected.
 
Method Summary
 java.util.List getIgnoredSymbols()
          Returns the top level ignored token symbols for the lexer.
 Syntax getLexerSyntax()
          Returns the lexer syntax that remains after removing all parser rules and token/ignored directives.
 Syntax getParserSyntax()
          Returns the parser syntax that remains after removing all lexer rules.
 java.util.List getTokenSymbols()
          Returns the top level token symbols for the lexer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
Constructor Detail

SyntaxSeparation

public SyntaxSeparation(Syntax syntax)
                 throws SyntaxException
Splits a syntax into two syntaxes containing parser and lexer rules, tokens and ignored get collected.

Method Detail

getLexerSyntax

public Syntax getLexerSyntax()
Returns the lexer syntax that remains after removing all parser rules and token/ignored directives.


getParserSyntax

public Syntax getParserSyntax()
Returns the parser syntax that remains after removing all lexer rules. All lexer tokens are marked with `backquotes`.


getTokenSymbols

public java.util.List getTokenSymbols()
Returns the top level token symbols for the lexer. These symbols ARE enclosed within `backquotes`. This can be used at setTerminals call for a standalone Lexer.


getIgnoredSymbols

public java.util.List getIgnoredSymbols()
Returns the top level ignored token symbols for the lexer. These symbols are NOT enclosed within `backquotes`. This will be used by the LexerBuilder for feeding the LexerImpl with ignored symbols.