Comments (3)
That's how it should work, setValue
makes sure it stores exactly the value you pass in, so it applies all the required escaping.
Right now the only way to add a unicode escaped sequence is to use the setRaw
method like this:
$str->setRaw("'\u0076\u0061\u0072\u0069\u0061\u0062\u006c\u0065\u0073'");
It takes the exact string representation so the value should be surrounded by quotes.
That's ugly, i know, but i'll try to think about a better handling for the next releases.
from peast.
Thanks for the quick reply. The setRaw
method works well. Since I do not have enough expertise here I was wondering why the input would have to be escaped in the first place. I realized this behavior after using the renderer where the result did show the characters with double slashes.
from peast.
I think that escaping the input is the right behaviour for the setValue
method because it guarantees that what you pass to the method is exactly what you will get in the string when you will render it. Handling of unicode escaped sequence is the only downside of this behaviuour, maybe adding a setRawValue
method with the benefits of setRaw
but without the need of surrounding quotes can be the right solution, i will evalutate it for a future release.
from peast.
Related Issues (20)
- Issues parsing comments in JSX HOT 1
- Issues parsing React Fragment short syntax HOT 1
- Formatter/Compact bug HOT 1
- Incorrect parsing of return statements with multi line template literals HOT 1
- Parse error with question mark followed by dot in ternary operator HOT 4
- Question: Known to PHP transpilers HOT 2
- Fails to parse some JS HOT 6
- Security Policy questions HOT 3
- Customize the grammar a bit? HOT 1
- Fatal error when xdebug enabled HOT 3
- wp i18n make-pot (WordPress) failing to parse specific JavaScript code HOT 3
- Failed to parse specific js code HOT 1
- Question: Is it possible to query by key name? HOT 4
- async function declaration gets stripped HOT 3
- Generating optimized autoload files error → Could not scan for classes inside HOT 2
- Parsing issue HOT 2
- Required block brackets are removed on case statements HOT 1
- Parser chokes on a method named async HOT 1
- Peast cannot parse comma expression in assignment expression prior to ES8 (ES2017) HOT 7
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 peast.