コード例 #1
0
        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;
        }
コード例 #2
0
        /// <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();
            }
        }
コード例 #3
0
 public ParseTree(string sourceText, string fileName) {
   SourceText = sourceText;
   FileName = fileName;
   Status = ParseTreeStatus.Parsing;
 }
コード例 #4
0
 public ParserException(string designFile, ParseTreeStatus status, LogMessageList messages)
 {
     this.designFile = designFile;
     this.status     = status;
     this.messages   = messages;
 }