Ejemplo n.º 1
0
        public List <NLPToken> Tokenize(string code)
        {
            var tokens = new List <NLPToken>();

            Context = new NLPLexicalContext(code);

            do
            {
                foreach (var lexer in Lexers)
                {
                    var type = lexer.IdentifySymbol(Context);

                    if (type != NLPTokenTypes.Unknown)
                    {
                        tokens.Add(new NLPToken(type, Context.CurrentSymbol));
                        break;
                    }
                }
            }while(Context.Advance());

            return(tokens);
        }
Ejemplo n.º 2
0
 public abstract NLPTokenTypes IdentifySymbol(NLPLexicalContext state);