private void Error(string msg, bool fatal = false, SourceLocation?on = null) { Errors.AddError(on ?? Current.Location, msg); if (fatal) { throw new LogicParserException(); } }
public IEnumerable <Lexeme> Lex() { while (TakeLexeme(out var lexeme)) { if (lexeme != null) { yield return(lexeme.Value); } } if (!IsEOF) { Errors.AddError(Location, $"invalid character found: {Current}"); } yield return(Lexeme(LexemeKind.EOF, null)); }
public void SyntaxError([NotNull] IRecognizer recognizer, [Nullable] IToken offendingSymbol, int line, int charPositionInLine, [NotNull] string msg, [Nullable] RecognitionException e) { Errors.AddError(msg, new SourceSpan(offendingSymbol), isANTLR: true); }