Merge pull request #3694 from count-infinity/3692-parser-errors
Fixing funcparser issues
This commit is contained in:
commit
6567f26615
2 changed files with 5 additions and 1 deletions
|
|
@ -339,6 +339,7 @@ class FuncParser:
|
||||||
# always store escaped characters verbatim
|
# always store escaped characters verbatim
|
||||||
if curr_func:
|
if curr_func:
|
||||||
infuncstr += char
|
infuncstr += char
|
||||||
|
curr_func.rawstr += char
|
||||||
else:
|
else:
|
||||||
fullstr += char
|
fullstr += char
|
||||||
escaped = False
|
escaped = False
|
||||||
|
|
@ -372,7 +373,8 @@ class FuncParser:
|
||||||
curr_func.open_lsquare = open_lsquare
|
curr_func.open_lsquare = open_lsquare
|
||||||
curr_func.open_lcurly = open_lcurly
|
curr_func.open_lcurly = open_lcurly
|
||||||
# we must strip the remaining funcstr so it's not counted twice
|
# we must strip the remaining funcstr so it's not counted twice
|
||||||
curr_func.rawstr = curr_func.rawstr[: -len(infuncstr)]
|
if len(infuncstr) > 0:
|
||||||
|
curr_func.rawstr = curr_func.rawstr[: -len(infuncstr)]
|
||||||
current_kwarg = ""
|
current_kwarg = ""
|
||||||
infuncstr = ""
|
infuncstr = ""
|
||||||
double_quoted = -1
|
double_quoted = -1
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,8 @@ class TestFuncParser(TestCase):
|
||||||
("Test literal3 $typ($lit(1)aaa)", "Test literal3 <class 'str'>"),
|
("Test literal3 $typ($lit(1)aaa)", "Test literal3 <class 'str'>"),
|
||||||
("Test literal4 $typ(aaa$lit(1))", "Test literal4 <class 'str'>"),
|
("Test literal4 $typ(aaa$lit(1))", "Test literal4 <class 'str'>"),
|
||||||
("Test spider's thread", "Test spider's thread"),
|
("Test spider's thread", "Test spider's thread"),
|
||||||
|
("Test invalid syntax $a=$b", "Test invalid syntax $a=$b"),
|
||||||
|
(r"Test invalid syntax $a\= b", "Test invalid syntax $a= b"),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
def test_parse(self, string, expected):
|
def test_parse(self, string, expected):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue