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

Error processing escape character in strings #6

Open
foul11 opened this issue Sep 28, 2023 · 0 comments
Open

Error processing escape character in strings #6

foul11 opened this issue Sep 28, 2023 · 0 comments

Comments

@foul11
Copy link

foul11 commented Sep 28, 2023

Very simple code for demo:

local parser = require('dumbParser')

local ast = parser.parse('print("\\x00")') -- passed string: print("\x00")
--local ast = parser.parseExpression('print("\\x00")') -- same thing
--local ast = parser.parseFile('test.lua') -- same thing

parser.printTree(ast) -- toLua gives the same effect
                      -- lua51:        ... ARG1 literal (string="x00") / Wrong.
                      -- lua53/luajit: ... ARG1 literal (string="{NUL}") / OK.


local ast = parser.parse('print("\\\\x00")') -- passed string: print("\\x00") / OK
--local ast = parser.parse('print("\\0000")') -- passed string: print("\0000") / OK
--local ast = parser.parse('print("\\1000")') -- passed string: print("\1000") / OK

parser.printTree(ast) -- toLua gives the same effect
                      -- lua51:        ... ARG1 literal (string="\x00") / OK.
                      -- lua53/luajit: ... ARG1 literal (string="\x00") / OK.

This affects the recording of escape characters.

  • In Lua5.1 they turn into plain text.
  • In Lua5.3 or Luajit there is no such problem.
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

No branches or pull requests

1 participant