fix string id e tal

This commit is contained in:
Afonso Franco 2023-05-24 16:08:30 +01:00
parent 47654120e2
commit 3ccb736eb9
Signed by: afonso
SSH key fingerprint: SHA256:JiuxZNdA5bRWXPMUJChI0AQ75yC+cXY4xM0IaVwEVys
3 changed files with 16 additions and 14 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
__pycache__/
Session.vim

View file

@ -6,4 +6,4 @@ othername = """Tom \"The killer\" or \"yo\" or
'you' Preston-Werner"""
date = 2010-04-23
time = 21:30:00
lol."yo" = "test"
"lol".yo = "test"

View file

@ -15,17 +15,9 @@ tokens = [
"INF",
"NAN",
"COMMENT",
]
]
def t_MLSTR(t):
r"(\"\"\"(?:[^\"\\]|\\.)+\"\"\")|(\'\'\'(?:[^\'\\]|\\.)+\'\'\')"
return t
# STR needs to be the first one to catch
def t_STR(t):
r"(\"(?:[^\"\\]|\\.)+\")|(\'[^\']+\')"
return t
# needs to check if datetime is valid
@ -45,6 +37,19 @@ def t_TIME(t):
r"\d{2}:\d{2}:\d{2}(\.\d{1,6})?"
return t
# ID needs to be the last so it doesnt catch everything (literally)
def t_ID(t):
r"(([\w_]+)|(\"[\w_]+\"\.|\'[\w_]+\'\.)([\w_]+|\"[\w_]+\"|\'[\w_]+\'))(\.([\w_]+|\"[\w_]+\"|\'[\w_]+\'))*"
return t
def t_MLSTR(t):
r"(\"\"\"(?:[^\"\\]|\\.)+\"\"\")|(\'\'\'(?:[^\'\\]|\\.)+\'\'\')"
return t
# STR needs to be the first one to catch
def t_STR(t):
r"(?<!^)(\"(?:[^\"\\]|\\.)+\")|(\'[^\']+\')"
return t
# needs number grouping (example : flt8 = 224_617.445_991_228)
def t_FLOAT(t):
@ -89,10 +94,6 @@ def t_BOOL(t):
return t
# ID needs to be the last so it doesnt catch everything (literally)
def t_ID(t):
r"([\w_]+|\"[\w_]+\"|\'[\w_]+\')(.([\w_]+|\"[\w_]+\"|\'[\w_]+\'))*"
return t
def t_COMMENT(t):