Skip to content

Commit 29cd67c

Browse files
committed
add test for string unicode
1 parent bf038b7 commit 29cd67c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

luaparser/parser/LuaLexerBase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def HandleComment(self):
2222
self.read_long_string(cs, sep)
2323
return
2424

25-
while cs.LA(1) != 12 and cs.LA(1) != -1: # '\n'
25+
while cs.LA(1) != 10 and cs.LA(1) != -1: # '\n'
2626
cs.consume()
2727

2828
def read_long_string(self, cs:InputStream, sep:int):

luaparser/tests/test_types_values.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,10 @@ def test_string_dbl_square_equal(self):
137137
Block([Assign(targets=[Name("b")], values=[String("one [[two]] one")])])
138138
)
139139
self.assertEqual(exp, tree)
140+
141+
def test_string_literal(self):
142+
tree = ast.parse(r'a="\u{9}"')
143+
exp = Chunk(
144+
Block([Assign(targets=[Name("a")], values=[String(r"\u{9}", delimiter=StringDelimiter.DOUBLE_QUOTE)])])
145+
)
146+
self.assertEqual(exp, tree)

0 commit comments

Comments
 (0)