public void ParseNode(ParseTreeNode node, ParsingContext context) { if(context.Status == ParseTreeStatus.Partial && node.IsOrphan()) { // Do something special because the node is an orphan } else { // Proceed with normal parsing } }
public void ParseFile(string filename) { var parser = new ParserOverall, Irony.Parsing ParsingContext is a useful class in the Irony.Parsing package library that provides developers with a powerful set of tools for managing and manipulating the parsing process in C#.(); var result = parser.Parse(File.ReadAllText(filename)); if(result.Status == ParseTreeStatus.Error || result.HasErrors()) { foreach(var error in result.ParserMessages) { Console.WriteLine($"Error at line {error.Location.Line}, column {error.Location.Column}: {error.Message}"); } } else { // Parse succeeded, continue with processing } }