Beispiel #1
0
        public RecognizerSharedState(RecognizerSharedState state)
        {
            if (state == null)
            {
                throw new ArgumentNullException("state");
            }

            following      = (BitSet[])state.following.Clone();
            _fsp           = state._fsp;
            errorRecovery  = state.errorRecovery;
            lastErrorIndex = state.lastErrorIndex;
            failed         = state.failed;
            syntaxErrors   = state.syntaxErrors;
            backtracking   = state.backtracking;

            if (state.ruleMemo != null)
            {
                ruleMemo = (IDictionary <int, int>[])state.ruleMemo.Clone();
            }

            token = state.token;
            tokenStartCharIndex          = state.tokenStartCharIndex;
            tokenStartCharPositionInLine = state.tokenStartCharPositionInLine;
            channel = state.channel;
            type    = state.type;
            text    = state.text;
        }
Beispiel #2
0
 public BaseRecognizer(RecognizerSharedState state)
 {
     if (state == null)
     {
         state = new RecognizerSharedState();
     }
     this.state = state;
     InitDFAs();
 }
Beispiel #3
0
 public Lexer(ICharStream input, RecognizerSharedState state)
     : base(state)
 {
     this.input = input;
 }
Beispiel #4
0
 public Parser(ITokenStream input, RecognizerSharedState state)
     : base(state) // share the state object with another parser
 {
     this.input = input;
 }