public void InputWithIrrecoverableSyntaxError() { var document = new ReadOnlyDocument("3 + 4"); var result = _parser.Parse(new CSharpLexer(document.CreateReader())); Assert.IsNull(result.Root); Assert.IsTrue(result.SyntaxErrors.Count > 0); }
public void InputWithSyntaxError2() { var document = new ReadOnlyDocument("a.b.c.;"); var result = _parser.Parse(new CSharpLexer(document.CreateReader())); Assert.IsNotNull(result.Root); Assert.IsTrue(result.SyntaxErrors.Count > 0); }
public void CorrectInput2() { var document = new ReadOnlyDocument("a.b.c;"); var result = _parser.Parse(new CSharpLexer(document.CreateReader())); Assert.IsNotNull(result.Root); Assert.AreEqual(0, result.SyntaxErrors.Count); }
public void ParseAndCheckPositions() { CSharpParser parser = new CSharpParser(); foreach (string fileName in fileNames) { this.currentDocument = new ReadOnlyDocument(File.ReadAllText(fileName)); CompilationUnit cu = parser.Parse(currentDocument.CreateReader()); if (parser.HasErrors) { continue; } this.currentFileName = fileName; CheckPositionConsistency(cu); CheckMissingTokens(cu); } }