ntalbs / json_parser Goto Github PK
View Code? Open in Web Editor NEWSimple JSON parser in Rust
License: MIT License
Simple JSON parser in Rust
License: MIT License
I changed peek()
and peek_next()
to return char
instead of Option<char>
:
c73ab9f
But it doesn't look correct. Change back, and handle the returned Option<char>
correctly, not just use unwrap()
.
Current implementation adds additional comma at the end of last element of array or object. For example,
[
1,
2,
3, // <--
], // <--
or
{
a: 1,
b: 2, // <--
}, // <--
Do not use scanner.tokens
directly in main
but use tokens
returned from Result
.
So, it can be used to calculate the position of ^
.
peak()
and peek_next()
calls source.chars().nth(x)
. Is this idiomatic way to get n-th char in a string?
Collect errors and return instead of panic! for a single error.
It is supposed to return error instead of panic:
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/scanner.rs:129:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
{
a: 10,
b: true,
c: "hello"
}
to
{
"a": 10,
"b": true,
"c": "hello"
}
Instead of making a side effect by adding token to tokens
vector, return the token created.
So it can be used to
^
Current implementation represents object with BTreeMap<String, Json>
. If I use Vect<String, Json)>
, the implementation of fmt_object
will be similar to fmt_array
.
How to implement fmt
for map or array?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.