public bool parse(string wikiText, Grammar grammar) //where T : WikiText { TextParsed.Add(wikiText); if (wikiText.valid().isFalse()) { return(false); // (T)this; } //var grammar = new T1(); var Parser = new Parser(grammar); ParseTree = Parser.Parse(wikiText); Status = ParseTree.Status; ParserMessages = ParseTree.ParserMessages; if (ParserMessages.size() > 0) { "There were errors processing this WikiText".error(); foreach (var message in ParserMessages) { " - {0}: {1} at location {2}".error(message.Level.str(), message.str(), message.Location.str()); } return(false); } return(processParseTree()); //return (T)this; }
/// <summary> /// Convert the Irony parse status into a Workbench status. /// </summary> /// <param name="status">Irony parse status.</param> /// <returns>Workbench parse status.</returns> protected static ParseStatus ConvertStatusFrom(ParseTreeStatus status) { switch (status) { case ParseTreeStatus.Parsed: return(ParseStatus.Success); case ParseTreeStatus.Error: return(ParseStatus.Failed); default: throw new NotImplementedException(); } }
public ParseTree(string sourceText, string fileName) { SourceText = sourceText; FileName = fileName; Status = ParseTreeStatus.Parsing; }
public ParserException(string designFile, ParseTreeStatus status, LogMessageList messages) { this.designFile = designFile; this.status = status; this.messages = messages; }