This commit is contained in:
2024-10-31 22:38:59 +01:00
parent 2f4e606fbf
commit e71ba34371
12 changed files with 304 additions and 35 deletions

View File

@ -2,18 +2,22 @@
from string import ascii_letters, digits
from rply import LexerGenerator
VALID_CHARACTERS = ascii_letters[:3]+ascii_letters[4:]+"_"+digits
VALID_CHARACTERS = ascii_letters+"_"+digits
TOKENS = [
("ROLL_DIE", r"d"),
("ROLL_KEEP_HIGHEST", r"kh"),
("ROLL_KEEP_LOWEST", r"kl"),
("ROLL_KEEP_HIGHEST", r"kh?"),
("ROLL_REROLL_ONCE", r"ro"),
("ROLL_REROLL", r"r"),
("ROLL_MIN", r"min"),
("ROLL_MAX", r"max"),
("ROLL_EXPLODE", r"!"),
("SYMBOL_LE", r"\<\="),
# ("SYMBOL_GE", r"\>\="),
("SYMBOL_GE", r"\>\="),
("SYMBOL_LT", r"\<"),
("SYMBOL_GT", r"\>"),
("SYMBOL_EQUALS", r"\="),
("SYMBOL_ARROW", r"\-\>"),
("SYMBOL_BACKSLASH", r"\\"),