Skip to content

Commit 1879948

Browse files
committed
Patch luaparse to not fail on unicode chars
1 parent ec12a6f commit 1879948

File tree

3 files changed

+7
-29
lines changed

3 files changed

+7
-29
lines changed

dist/index.js

Lines changed: 5 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/luaspec.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,12 @@ export function jsonFromSpec(spec: string): string {
1414
stdout: data => core.debug(data)
1515
})
1616

17-
const escapedSpec = spec
18-
.split('')
19-
.map(c => {
20-
if (c.charCodeAt(0) < 127) return c
21-
const buf = Buffer.from(c)
22-
return Array.prototype.map
23-
.call(buf, ce => `\\x${ce.toString(16)}`)
24-
.join('')
25-
})
26-
.join('')
27-
28-
const luaSpecScript = luaEnv.parse(escapedSpec.toString())
17+
const luaSpecScript = luaEnv.parse(spec)
2918
const luaSpec = luaSpecScript.exec()
3019

3120
if (!(luaSpec instanceof luainjs.Table)) {
3221
throw new Error('Spec must be a table')
3322
}
3423

35-
console.log('XXXX:', JSON.stringify(luaSpec.toObject()))
36-
3724
return JSON.stringify(luaSpec.toObject())
3825
}

0 commit comments

Comments
 (0)