From 8cc25b4b3f8fae10c5c09ecbc54034f130aec439 Mon Sep 17 00:00:00 2001 From: Michael Rybakin Date: Wed, 9 Jun 2021 17:24:39 +0400 Subject: [PATCH] =?UTF-8?q?fix=20#1087:=20=D0=B0=D0=BD=D0=BD=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B5=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D1=81=D1=81?= =?UTF-8?q?=D0=BE=D1=80=D0=B0;=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LexicalAnalysis/AnnotationLexerState.cs | 15 +++++++++++++-- .../LexicalAnalysis/FullSourceLexer.cs | 2 -- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/OneScript.Language/LexicalAnalysis/AnnotationLexerState.cs b/src/OneScript.Language/LexicalAnalysis/AnnotationLexerState.cs index 66daaa8a8..6a6086bd9 100644 --- a/src/OneScript.Language/LexicalAnalysis/AnnotationLexerState.cs +++ b/src/OneScript.Language/LexicalAnalysis/AnnotationLexerState.cs @@ -7,11 +7,22 @@ This Source Code Form is subject to the terms of the namespace OneScript.Language.LexicalAnalysis { - public class AnnotationLexerState : WordLexerState + public class AnnotationLexerState : LexerState { + WordLexerState _wordExtractor = new WordLexerState(); + const string MESSAGE_ANNOTATION_EXPECTED = "��������� ��� ���������"; + public override Lexem ReadNextLexem(SourceCodeIterator iterator) { - var lexem = base.ReadNextLexem(iterator); + iterator.MoveNext(); + + if (!iterator.MoveToContent()) + throw CreateExceptionOnCurrentLine(MESSAGE_ANNOTATION_EXPECTED, iterator); + + if (!char.IsLetter(iterator.CurrentSymbol)) + throw CreateExceptionOnCurrentLine(MESSAGE_ANNOTATION_EXPECTED, iterator); + + var lexem = _wordExtractor.ReadNextLexem(iterator); lexem.Type = LexemType.Annotation; return lexem; } diff --git a/src/OneScript.Language/LexicalAnalysis/FullSourceLexer.cs b/src/OneScript.Language/LexicalAnalysis/FullSourceLexer.cs index 89d519fe8..e6d32d6ef 100644 --- a/src/OneScript.Language/LexicalAnalysis/FullSourceLexer.cs +++ b/src/OneScript.Language/LexicalAnalysis/FullSourceLexer.cs @@ -145,8 +145,6 @@ private void SelectState() } else if (cs == SpecialChars.Annotation) { - _iterator.GetContents(); - _iterator.MoveNext(); _state = _annotationState; } else