Comments (8)
@bartlomieju FYI, I did a 0.14.0 release because I needed to keep the error message property not having the range for dprint-plugin-json. It should still display with the range when doing parse_to_value(...)?
though.
from jsonc-parser.
I was thinking this the other day and came across a similar issue using dprint-plugin-typescript about 5 mins ago 😂. It’s because I didn’t/still don’t really understand Error. This would be a good change... do you have the time to implement it properly to show me how it’s done?
It returns an Option because the file might be empty.
from jsonc-parser.
I was thinking this the other day and came across a similar issue using dprint-plugin-typescript about 5 mins ago 😂. It’s because I didn’t/still don’t really understand Error. This would be a good change... do you have the time to implement it properly to show me how it’s done?
It's just a blanket trait - it requires to implement Display
on the struct implementing Error
- I guess the only purpose of that trait is to have "idiomatic" handling of errors. Sure, I can open a PR.
It returns an Option because the file might be empty.
Thanks that makes sense
from jsonc-parser.
Oh! I am just remembering the get_message_with_range
thing. It would be nice if it did that by default always. Perhaps the current error can be renamed and returned in the lower level functions and then the top level functions can return a ParseError
that has the message with the range. I'm not sure what's best though (this is more complicated than I remember... I can do it when I get back from lunch if you're not up for it).
from jsonc-parser.
@dsherret I'm gonna change ParseError
not to have get_message_with_range()
- I will perform that logic when creating ParseError
from jsonc-parser.
@dsherret you were faster! Whichever for works for you better
from jsonc-parser.
@bartlomieju awesome! Yeah, if you have it figured out already then that would be super helpful!
from jsonc-parser.
@dsherret my approach would need to store whole text
on one of Scanner
/Context
. I'm not sure if that's a valid approach...
from jsonc-parser.
Related Issues (18)
- Add helper methods for taking values from JsonObject
- Reference the original string as much as possible HOT 1
- Change the repository name to json5-parser
- Investigate range on unexpected word errors
- cannot find function parse_to_serde_value HOT 1
- Do not store line numbers in ranges
- Make it easy to convert ast::Value to serde_json::Value
- Method on ast::Value to get the range HOT 4
- common::Ranged provides method to convert to line/col from byte index HOT 2
- JSONC parser fails to correctly parse non-BMP escape sequences HOT 1
- Deserialize with error line/column HOT 1
- Fails to parse number with `+` prefix HOT 1
- Add first class manipulation API
- Implement TryFrom<JsonValue> for serde::Value HOT 1
- Fails to parse multi unit unicode escape sequences HOT 1
- Investigate how serde handles invalid utf8 escape sequences HOT 1
- Add Benchmarks 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 jsonc-parser.