当前位置: 首页>>代码示例>>C#>>正文


C# Parser.NotifyErrorListeners方法代码示例

本文整理汇总了C#中Parser.NotifyErrorListeners方法的典型用法代码示例。如果您正苦于以下问题:C# Parser.NotifyErrorListeners方法的具体用法?C# Parser.NotifyErrorListeners怎么用?C# Parser.NotifyErrorListeners使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parser的用法示例。


在下文中一共展示了Parser.NotifyErrorListeners方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReportContextSensitivity

 public override void ReportContextSensitivity(Parser recognizer, DFA dfa, int startIndex
     , int stopIndex, SimulatorState acceptState)
 {
     string format = "reportContextSensitivity d={0}, input='{1}'";
     recognizer.NotifyErrorListeners(string.Format(format, GetDecisionDescription(recognizer
         , dfa.decision), ((ITokenStream)recognizer.InputStream).GetText(Interval.Of(startIndex
         , stopIndex))));
 }
开发者ID:pabloescribano,项目名称:antlr4cs,代码行数:8,代码来源:DiagnosticErrorListener.cs

示例2: ReportAmbiguity

 public override void ReportAmbiguity(Parser recognizer, DFA dfa, int startIndex, 
     int stopIndex, BitSet ambigAlts, ATNConfigSet configs)
 {
     string format = "reportAmbiguity d={0}: ambigAlts={1}, input='{2}'";
     recognizer.NotifyErrorListeners(string.Format(format, GetDecisionDescription(recognizer
         , dfa.decision), ambigAlts, ((ITokenStream)recognizer.InputStream).GetText(Interval
         .Of(startIndex, stopIndex))));
 }
开发者ID:pabloescribano,项目名称:antlr4cs,代码行数:8,代码来源:DiagnosticErrorListener.cs

示例3: ReportAmbiguity

 public override void ReportAmbiguity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, bool exact, BitSet ambigAlts, ATNConfigSet configs)
 {
     if (exactOnly && !exact)
     {
         return;
     }
     string format = "reportAmbiguity d={0}: ambigAlts={1}, input='{2}'";
     string decision = GetDecisionDescription(recognizer, dfa);
     BitSet conflictingAlts = GetConflictingAlts(ambigAlts, configs);
     string text = ((ITokenStream)recognizer.InputStream).GetText(Interval.Of(startIndex, stopIndex));
     string message = string.Format(format, decision, conflictingAlts, text);
     recognizer.NotifyErrorListeners(message);
 }
开发者ID:sharwell,项目名称:antlr4cs,代码行数:13,代码来源:DiagnosticErrorListener.cs

示例4: ReportMissingToken

 /// <summary>
 /// This method is called to report a syntax error which requires the
 /// insertion of a missing token into the input stream.
 /// </summary>
 /// <remarks>
 /// This method is called to report a syntax error which requires the
 /// insertion of a missing token into the input stream. At the time this
 /// method is called, the missing token has not yet been inserted. When this
 /// method returns,
 /// <paramref name="recognizer"/>
 /// is in error recovery mode.
 /// <p>This method is called when
 /// <see cref="SingleTokenInsertion(Parser)"/>
 /// identifies
 /// single-token insertion as a viable recovery strategy for a mismatched
 /// input error.</p>
 /// <p>The default implementation simply returns if the handler is already in
 /// error recovery mode. Otherwise, it calls
 /// <see cref="BeginErrorCondition(Parser)"/>
 /// to
 /// enter error recovery mode, followed by calling
 /// <see cref="Parser.NotifyErrorListeners(string)"/>
 /// .</p>
 /// </remarks>
 /// <param name="recognizer">the parser instance</param>
 protected internal virtual void ReportMissingToken(Parser recognizer)
 {
     if (InErrorRecoveryMode(recognizer))
     {
         return;
     }
     BeginErrorCondition(recognizer);
     IToken t = recognizer.CurrentToken;
     IntervalSet expecting = GetExpectedTokens(recognizer);
     string msg = "missing " + expecting.ToString(recognizer.Vocabulary) + " at " + GetTokenErrorDisplay(t);
     recognizer.NotifyErrorListeners(t, msg, null);
 }
开发者ID:sharwell,项目名称:antlr4cs,代码行数:37,代码来源:DefaultErrorStrategy.cs

示例5: NotifyErrorListeners

 protected internal virtual void NotifyErrorListeners(Parser recognizer, string message, RecognitionException e)
 {
     recognizer.NotifyErrorListeners(e.OffendingToken, message, e);
 }
开发者ID:sharwell,项目名称:antlr4cs,代码行数:4,代码来源:DefaultErrorStrategy.cs

示例6: ReportUnwantedToken

 /// <summary>
 /// This method is called to report a syntax error which requires the removal
 /// of a token from the input stream.
 /// </summary>
 /// <remarks>
 /// This method is called to report a syntax error which requires the removal
 /// of a token from the input stream. At the time this method is called, the
 /// erroneous symbol is current
 /// <code>LT(1)</code>
 /// symbol and has not yet been
 /// removed from the input stream. When this method returns,
 /// <code>recognizer</code>
 /// is in error recovery mode.
 /// <p>This method is called when
 /// <see cref="SingleTokenDeletion(Parser)"/>
 /// identifies
 /// single-token deletion as a viable recovery strategy for a mismatched
 /// input error.</p>
 /// <p>The default implementation simply returns if the handler is already in
 /// error recovery mode. Otherwise, it calls
 /// <see cref="BeginErrorCondition(Parser)"/>
 /// to
 /// enter error recovery mode, followed by calling
 /// <see cref="Parser.NotifyErrorListeners(string)"/>
 /// .</p>
 /// </remarks>
 /// <param name="recognizer">the parser instance</param>
 protected internal virtual void ReportUnwantedToken(Parser recognizer)
 {
     if (InErrorRecoveryMode(recognizer))
     {
         return;
     }
     BeginErrorCondition(recognizer);
     IToken t = recognizer.CurrentToken;
     string tokenName = GetTokenErrorDisplay(t);
     IntervalSet expecting = GetExpectedTokens(recognizer);
     string msg = "extraneous input " + tokenName + " expecting " + expecting.ToString(recognizer.TokenNames);
     recognizer.NotifyErrorListeners(t, msg, null);
 }
开发者ID:rharrisxtheta,项目名称:antlr4cs,代码行数:40,代码来源:DefaultErrorStrategy.cs

示例7: ReportAttemptingFullContext

 public override void ReportAttemptingFullContext(Parser recognizer, DFA dfa, int 
     startIndex, int stopIndex, BitSet conflictingAlts, SimulatorState conflictState
     )
 {
     string format = "reportAttemptingFullContext d={0}, input='{1}'";
     string decision = GetDecisionDescription(recognizer, dfa);
     string text = ((ITokenStream)recognizer.InputStream).GetText(Interval.Of(startIndex
         , stopIndex));
     string message = string.Format(format, decision, text);
     recognizer.NotifyErrorListeners(message);
 }
开发者ID:hustsii,项目名称:antlr4cs,代码行数:11,代码来源:DiagnosticErrorListener.cs

示例8: ReportMissingToken

 public virtual void ReportMissingToken(Parser recognizer)
 {
     if (errorRecoveryMode)
     {
         return;
     }
     recognizer._syntaxErrors++;
     BeginErrorCondition(recognizer);
     IToken t = recognizer.CurrentToken;
     IntervalSet expecting = GetExpectedTokens(recognizer);
     string msg = "missing " + expecting.ToString(recognizer.TokenNames) + " at " + GetTokenErrorDisplay
         (t);
     recognizer.NotifyErrorListeners(t, msg, null);
 }
开发者ID:janv8000,项目名称:antlr4cs,代码行数:14,代码来源:DefaultErrorStrategy.cs


注:本文中的Parser.NotifyErrorListeners方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。