mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Fix crash with bad escape sequence in string array
Invalid escape sequences aren't a fatal parser error, so the AST can be built even when one is present, in which case the string token is None.
This commit is contained in:
parent
d0659a43c2
commit
3a712af4dd
1 changed files with 2 additions and 1 deletions
|
@ -424,7 +424,8 @@ class ArrayValue(AstNode):
|
||||||
):
|
):
|
||||||
quoted_literal = value.child.value
|
quoted_literal = value.child.value
|
||||||
literal_value = quoted_literal.value
|
literal_value = quoted_literal.value
|
||||||
if "\n" in literal_value:
|
# literal_value can be None if there's an invalid escape sequence
|
||||||
|
if literal_value is not None and "\n" in literal_value:
|
||||||
errors.append(
|
errors.append(
|
||||||
CompileError(
|
CompileError(
|
||||||
"String literals inside arrays can't contain newlines",
|
"String literals inside arrays can't contain newlines",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue