public static IAbstractSyntaxTree Lex(string source)
        {
            using (var root = new RootNode())
            {
                var sourceTokens  = Tokenizer.Tokenize(source, root);
                var syntaxMatcher = new SyntaxMatcher(sourceTokens, root);

                var nodes       = syntaxMatcher.Match();
                var exposedTree = new AbstractSyntaxTree(nodes);
                foreach (var postProcessor in PostProcessor.BuildAll())
                {
                    postProcessor.Apply(exposedTree);
                }

                return(exposedTree);
            }
        }
Пример #2
0
 internal void ReplaceWith(AbstractSyntaxTree other)
 {
     this.Children = other.Children;
     this.Node     = other.Node;
 }