Beispiel #1
0
 public override Statement ParseStatement(IDocument document)
 {
     var lexer = new CSharpLexer(document.CreateReader());
     var result = Parser.Parse(lexer, Grammar.StatementRule);
     var statement = (Statement)result.Root.Result;
     return statement;
 }
Beispiel #2
0
 public override CompilationUnit Parse(IDocument document)
 {
     var lexer = new CSharpLexer(document.CreateReader());
     var result = Parser.Parse(lexer);
     var compilationUnit = (CompilationUnit) result.Root?.Result ?? new CompilationUnit();
     foreach (var error in result.SyntaxErrors)
         compilationUnit.Errors.Add(error);
     return compilationUnit;
 }