コード例 #1
0
ファイル: Parser.cs プロジェクト: NeatWolf/LogicScript
        private void Error(string msg, bool fatal = false, SourceLocation?on = null)
        {
            Errors.AddError(on ?? Current.Location, msg);

            if (fatal)
            {
                throw new LogicParserException();
            }
        }
コード例 #2
0
ファイル: Lexer.cs プロジェクト: NeatWolf/LogicScript
        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
ファイル: ErrorListener.cs プロジェクト: pipe01/LogicScript
 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);
 }