Skip to content

Commit

Permalink
Добавлен тип токена "Регистр".
Browse files Browse the repository at this point in the history
Добавлена проверка строки на соответствие значению регистра.
  • Loading branch information
denismaster committed Sep 5, 2017
1 parent 708dd07 commit df8232c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/com/parser/lexer/TokenType.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public enum TokenType {
*/
Command,

/**
* Токен - регистр(AX,AL и так далее)
*/
Register,


/**
* Другой тип токена
Expand Down
4 changes: 4 additions & 0 deletions src/com/parser/lexer/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ public class Utils {
public static boolean isCommand(String lexeme){
return Arrays.stream(Commands).anyMatch(x->x.equalsIgnoreCase(lexeme));
}

public static boolean isRegister(String lexeme){
return Arrays.stream(Registers).anyMatch(x->x.equalsIgnoreCase(lexeme));
}
}

0 comments on commit df8232c

Please sign in to comment.