本文整理汇总了C#中Irony.Parsing.ParseTree.HasErrors方法的典型用法代码示例。如果您正苦于以下问题:C# ParseTree.HasErrors方法的具体用法?C# ParseTree.HasErrors怎么用?C# ParseTree.HasErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Irony.Parsing.ParseTree
的用法示例。
在下文中一共展示了ParseTree.HasErrors方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildAst
public override void BuildAst(LanguageData language, ParseTree parseTree) {
var opHandler = new OperatorHandler(language.Grammar.CaseSensitive);
Util.Check(!parseTree.HasErrors(), "ParseTree has errors, cannot build AST.");
var astContext = new InterpreterAstContext(language, opHandler);
var astBuilder = new AstBuilder(astContext);
astBuilder.BuildAst(parseTree);
}
示例2: Validate
public void Validate(ParseTree parseTree)
{
if (parseTree.HasErrors() && parseTree.ParserMessages.Count > 0)
{
var message = parseTree.ParserMessages[0];
var error = message.Message + " at " + message.Location.ToUiString();
throw new Exception(error);
}
}
示例3: TryParse
public void TryParse(string source)
{
//ClearParserOutput();
if (_parser == null || !_parser.Language.CanParse()) return;
_parseTree = null;
GC.Collect(); //to avoid disruption of perf times with occasional collections
//_parser.Context.TracingEnabled = chkParserTrace.Checked;
try
{
_parseTree = _parser.Parse(source);
if (_parseTree.HasErrors() == false)
{
UpdateOutlineWindow();
statusBarControl.State = new LPSolverState("Done.", EnumEditorStates.Normal);
}
//else
//{
// throw new Exception("Could not Parse the Model. Please Check Error List");
//}
}
catch (Exception exp)
{
statusBarControl.State = new LPSolverState("Parser Error - " + exp.Message, EnumEditorStates.Error);
}
finally
{
_parseTree = _parser.Context.CurrentParseTree;
ShowCompilerErrors();
}
}
示例4: CheckParseErrors
public static void CheckParseErrors(ParseTree parseTree)
{
if (parseTree.HasErrors())
throw new Exception("Unexpected parse error(s): " + string.Join("\n", parseTree.ParserMessages));
}
示例5: Parse
/// <summary>
/// スクリプトを解析し、処理ができるようにします。
/// 通常、この関数はスクリプトを読み込んだ時点で自動的に実行されます。
/// </summary>
public void Parse()
{
RawTree = Parser.Parse(RawString);
if (RawTree.HasErrors())
{
var exm = "Kastepsスクリプトにエラーがありました。" + Environment.NewLine;
foreach (var m in RawTree.ParserMessages)
{
exm += String.Format("{0} @[{1},{2}]: {3}", m.Level, m.Location.Line, m.Location.Column, m.Message);
}
throw new InvalidDataException(exm);
}
}