예제 #1
0
        private void Error(string msg, bool fatal = false, SourceLocation?on = null)
        {
            Errors.AddError(on ?? Current.Location, msg);

            if (fatal)
            {
                throw new LogicParserException();
            }
        }
예제 #2
0
        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));
        }
예제 #3
0
 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);
 }