Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for numeric escape sequences #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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