Skip to content

SELECT ASCII('\\') #489

Open
Open

Description

@mathiasrw

When I call alasql with

console.log(alasql("VALUE OF SELECT ASCII('\\');"))

I expect to get 92 (char value of \) but instead I get

Uncaught SyntaxError: Unexpected token )(…)
yy.Select.compileSelect2 @ alasql.js:8970
yy.Select.compile @ alasql.js:7228
alasql.dexec @ alasql.js:4225
alasql.exec @ alasql.js:4190
alasql @ alasql.js:121

The problem is that a generated function does not keep the escaped syntax \\ and end up looking like this

(function(p,params,alasql
/**/) {
var y;var r={'ASCII(\'\\')':(y=alasql.stdfn.ASCII('\'),y===y?y:undefined)};return r
})

Where the problem is the ASCII('\') part where the string never ends as the last ' is escaped.

I have tried to make it work by changing how utils.escapeq escapes the string but kept introducing errors in our npm test.

I have a feeling it has to do with yy.StringValue.prototype.toJS but I dont have the detailed insights of the src yet to fix this one...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions