Beispiel #1
0
        public Lexicon()
        {
            m_tokenList    = new List <TokenInfo>();
            m_lexerStates  = new List <LexerState>();
            m_defaultState = new LexerState(this, 0);

            m_lexerStates.Add(m_defaultState);
        }
Beispiel #2
0
        internal TokenInfo(RegularExpression definition, Lexicon lexicon, LexerState state, Token tag)
        {
            Lexicon    = lexicon;
            Definition = definition;
            State      = state;

            Tag = tag;
        }
Beispiel #3
0
        public Lexicon()
        {
            m_tokenList = new List<Token>();
            m_lexerStates = new List<LexerState>();
            m_defaultState = new LexerState(this, 0);

            m_lexerStates.Add(m_defaultState);
        }
Beispiel #4
0
        internal TokenInfo(RegularExpression definition, Lexicon lexicon, LexerState state, Token tag)
        {
            Lexicon = lexicon;
            Definition = definition;
            State = state;

            Tag = tag;
        }
Beispiel #5
0
        internal LexerState DefineLexerState(LexerState baseState)
        {
            int        index    = m_lexerStates.Count;
            LexerState newState = new LexerState(this, index, baseState);

            m_lexerStates.Add(newState);

            return(newState);
        }
Beispiel #6
0
        internal TokenInfo AddToken(RegularExpression definition, LexerState state, int indexInState, string description)
        {
            int       index = m_tokenList.Count;
            Token     tag   = new Token(index, description ?? definition.ToString());
            TokenInfo token = new TokenInfo(definition, this, state, tag);

            m_tokenList.Add(token);

            return(token);
        }
Beispiel #7
0
        internal LexerState(Lexicon lexicon, int index, LexerState baseState)
        {
            Children = new List<LexerState>();
            Lexicon = lexicon;
            BaseState = baseState;
            m_tokens = new List<Token>();
            Index = index;

            if (baseState == null)
            {
                Level = 0;
            }
            else
            {
                Level = baseState.Level + 1;
                baseState.Children.Add(this);
            }
        }
Beispiel #8
0
        internal LexerState(Lexicon lexicon, int index, LexerState baseState)
        {
            Children  = new List <LexerState>();
            Lexicon   = lexicon;
            BaseState = baseState;
            m_tokens  = new List <TokenInfo>();
            Index     = index;

            if (baseState == null)
            {
                Level = 0;
            }
            else
            {
                Level = baseState.Level + 1;
                baseState.Children.Add(this);
            }
        }
Beispiel #9
0
        internal LexerState DefineLexerState(LexerState baseState)
        {
            int index = m_lexerStates.Count;
            LexerState newState = new LexerState(this, index, baseState);
            m_lexerStates.Add(newState);

            return newState;
        }
Beispiel #10
0
        internal Token AddToken(RegularExpression definition, LexerState state, int indexInState, string description)
        {
            int index = m_tokenList.Count;
            Token token = new Token(definition, this, index, state, description);
            m_tokenList.Add(token);

            return token;
        }