Exemplo n.º 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);
        }
Exemplo n.º 2
0
        internal TokenInfo(RegularExpression definition, Lexicon lexicon, LexerState state, Token tag)
        {
            Lexicon    = lexicon;
            Definition = definition;
            State      = state;

            Tag = tag;
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        internal TokenInfo(RegularExpression definition, Lexicon lexicon, LexerState state, Token tag)
        {
            Lexicon = lexicon;
            Definition = definition;
            State = state;

            Tag = tag;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 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;
        }