Comments (5)
I will probably add a switch to toggle between these modes:
- no interpretation for string literals at all; extended identifiers not mangled
- pseudo-ISO-8859-1/
x-user-defined
(option 0) - UTF-8 (either current behaviour or option 3/4)
from luaparse.
Got some WIP code that implements an encodingMode
option, allowing to switch between:
- current behaviour
- no mangling for identifiers,
.value
of string literal nodes isnull
- ISO-8859-1
x-user-defined
.
A 'true UTF-8' mode (option 3 or 4) would be considerably mode involved, and perhaps not worth it. Still considering it, though.
from luaparse.
I changed my mind; I won't keep current behaviour as the default, maybe I won't even keep it as an option; nobody seems to expect or desire it anyway. The default will be no mangling and no literal interpretation; this allows users to parse Unicode source code without hassle, while those interested in string literals can choose some other mode that ensures a coherent interpretation.
I implemented UTF-8 modes too, but they're a little hacky. I also still need to document the option.
from luaparse.
Finally committed as fstirlitz:2b04739...fstirlitz:10666c7.
Leaving out UTF-8 modes for the moment; I may add them later. Iβm leaving this issue open until I make a decision, but either way it goes, itβs not a release blocker.
from luaparse.
I'd still be interested in UTF-8. I've tried reading up on x-user-defined but did not come away with an understanding where it would break down -- I am interested in literal strings as I want to use luaparse to change lua source into JS.
from luaparse.
Related Issues (20)
- Semicolons after break statement unrecognized HOT 3
- StringLiteral.value is sometimes null HOT 1
- Add an event/notification when a function definition begins
- How to parse json back to lua? HOT 1
- Lua floor division operator not recognised HOT 1
- lua fails to parse with custom type definitions HOT 1
- How to pass the ast to escodegen.generate to make js code? HOT 1
- Incorrect parsing for return statements HOT 1
- do luaparse support bit opratation? HOT 1
- Incorrect parsing parens indiscriminately removed
- Incorrect parsing: semicolon indiscriminately removed
- Syntax error though code is valid HOT 2
- Fail to reject an invalid literal string
- The string literal's value is not passed properly. HOT 1
- Issue with unicode characters
- support for ?. operator data?.files
- onLocalDeclaration not being called HOT 1
- Any chance for bundled TypeScript definitions? HOT 3
- Support LuaJIT syntax extensions HOT 1
- Bitwize brackets disappears HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from luaparse.