Skip to content

Error processing escape character in strings #6

Description

@foul11

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions