Skip to content

Commit

Permalink
fix EvilBeaver#1087: аннотации после препроцессора; проверка имени
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Rm committed Jun 9, 2021
1 parent e267e18 commit 8cc25b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/OneScript.Language/LexicalAnalysis/AnnotationLexerState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 0 additions & 2 deletions src/OneScript.Language/LexicalAnalysis/FullSourceLexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ private void SelectState()
}
else if (cs == SpecialChars.Annotation)
{
_iterator.GetContents();
_iterator.MoveNext();
_state = _annotationState;
}
else
Expand Down

0 comments on commit 8cc25b4

Please sign in to comment.