Skip to content

Conversation

@n1tehawk
Copy link

Lua strings accept numerical escapes as a "\ddd" sequence, where
ddd is 1-3 decimal digits (see Lua Manual, "Lexical Conventions").

This patch makes the parser tolerate escape sequences starting
with a digit, copying them to the output as-is.
Note that they're not validated in this case.

Lua strings accept numerical escapes as a "\ddd" sequence, where
ddd is 1-3 decimal digits (see Lua Manual, "Lexical Conventions").

This patch makes the parser tolerate escape sequences starting
with a digit, copying them to the output as-is.
Note that they're not validated in this case.
@n1tehawk
Copy link
Author

This (partly) fixes #4.

Lua 5.2+ also recognizes \xXX, where XX is a sequence of exactly two hexadecimal digits. This isn't addressed by this PR, and would have to be treated separately.

Regards, NiteHawk

"esc" isn't reused, so there is no need for a local variable.
The second test thus essentially is

	if not CharacterForEscape[c3] then ...

And we also don't need to string.match() for digits on c3
when we have the Digits[c3] table lookup readily available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant