Exemplo n.º 1
0
        private static CodeFile BuildStructure(AntlrInputStream inputStream)
        {
            if (inputStream == null)
            {
                throw new ArgumentNullException(nameof(inputStream));
            }

            CdeltaLexer       lexer       = new CdeltaLexer(inputStream);
            CommonTokenStream tokenStream = new CommonTokenStream(lexer);
            CdeltaParser      parser      = new CdeltaParser(tokenStream);

            CdeltaParser.CodeFileContext result = parser.codeFile();

            CodeFile             codeFile = new CodeFile();
            CdeltaGrammarVisitor visitor  = new CdeltaGrammarVisitor(inputStream.ToString(), ref codeFile);

            visitor.Visit(result);
            codeFile.Finish();
            codeFile.Verify();

            return(codeFile);
        }