Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full UTF-8 support in RON incl. unicode identifiers #488

Merged
merged 33 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ab15374
Support unicode idents (matching rust)
ModProg Mar 25, 2023
fbe2b46
cleanup
ModProg Mar 26, 2023
7a70f12
add test
ModProg Mar 27, 2023
3207528
removing many bytes
ModProg Mar 28, 2023
8a93584
wip
ModProg Mar 29, 2023
8b098c2
remove
ModProg Mar 29, 2023
e5afa80
remove dbg
ModProg Mar 29, 2023
b9b3d81
performance back where it was
ModProg Mar 30, 2023
3deff25
replace consume_str with consume_char where possible
ModProg Mar 30, 2023
03341a1
remove char boundry error
ModProg Mar 30, 2023
39b7a73
remove comments
ModProg Mar 30, 2023
1ac6e63
Small improvements to the PR
juntyr Apr 2, 2023
767bd36
fix fuzz
ModProg Apr 2, 2023
c04f19c
Small cleanup
juntyr Aug 25, 2023
1aee993
Ensure that only valid UTF-8 ron is produced
juntyr Aug 25, 2023
1ec8ded
Clean up char peeking without keeping char iterator around
juntyr Aug 26, 2023
39c0929
Exchange costly peeks with string prefixes where possible
juntyr Aug 26, 2023
1e8c29e
Fix fuzzer-found skip-ident bug
juntyr Aug 26, 2023
bf32db9
Fix rebase issues
juntyr Sep 1, 2023
833d840
Enforce code quality with clippy lints
juntyr Sep 1, 2023
d526573
Run clippy CI on MSRV to avooid suggesting not-yet-supported language…
juntyr Sep 2, 2023
550bb50
Add tests for code coverage
juntyr Sep 2, 2023
bf72f5f
Fix tests coverage issues
juntyr Sep 2, 2023
2afe120
Add some error message tests
juntyr Sep 2, 2023
0ff418b
Add further coverage tests
juntyr Sep 2, 2023
5da2cb0
Small cleanup fixes
juntyr Sep 3, 2023
0cd24d2
Small code coverage improvements
juntyr Sep 3, 2023
7843ff1
Fix tests with integer128 feature
juntyr Sep 3, 2023
0880841
Add more options tests
juntyr Sep 3, 2023
231ad9d
Some more small coverage improvements
juntyr Sep 3, 2023
344a268
Fix missing coverage of tag deserialising
juntyr Sep 3, 2023
d275051
final code coverage fixes for today
juntyr Sep 3, 2023
b14096a
Add CHANGELOG entry
juntyr Sep 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,24 @@ jobs:
- run: cargo test --all-features

clippy:
name: "Clippy: stable"
name: "Clippy: MSRV"
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
key: clippy-stable
key: clippy-msrv
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: 1.64.0
profile: minimal
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ github.token }}
- run: cargo clippy -- -D warnings
- run: cargo clippy --features integer128 -- -D warnings
- run: cargo clippy --features indexmap -- -D warnings
- run: cargo clippy --all-features -- -D warnings

rustfmt:
name: "Format: stable"
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ indexmap = { version = "2.0", features = ["serde"], optional = true }
# serde supports i128/u128 from 1.0.60 onwards
serde = "1.0.60"
serde_derive = "1.0"
unicode-ident = "1.0.8"
juntyr marked this conversation as resolved.
Show resolved Hide resolved

[dev-dependencies]
serde = { version = "1.0", features = ["derive"] }
Expand Down
8 changes: 5 additions & 3 deletions docs/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RON = [extensions], ws, value, ws;

```ebnf
ws = { ws_single | comment };
ws_single = "\n" | "\t" | "\r" | " ";
ws_single = "\n" | "\t" | "\r" | " " | U+000B | U+000C | U+0085 | U+200E | U+200F | U+2028 | U+2029;
comment = ["//", { no_newline }, "\n"] | ["/*", nested_block_comment, "*/"];
nested_block_comment = { ? any characters except "/*" or "*/" ? }, [ "/*", nested_block_comment, "*/", nested_block_comment ];
```
Expand Down Expand Up @@ -179,8 +179,10 @@ enum_variant_named = ident, ws, "(", [named_field, { comma, named_field }, [comm
```ebnf
ident = ident_std | ident_raw;
ident_std = ident_std_first, { ident_std_rest };
ident_std_first = "A" | ... | "Z" | "a" | ... | "z" | "_";
ident_std_rest = ident_std_first | digit;
ident_std_first = XID_Start | "_";
ident_std_rest = XID_Continue;
ident_raw = "r", "#", ident_raw_rest, { ident_raw_rest };
ident_raw_rest = ident_std_rest | "." | "+" | "-";
```

> Note: [XID_Start](http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Start%3A%5D&abb=on&g=&i=) and [XID_Continue](http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Continue%3A%5D&abb=on&g=&i=) refer to Unicode character sets.
4 changes: 2 additions & 2 deletions src/de/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ impl<'a, 'b: 'a, 'c> de::Deserializer<'b> for &'c mut IdDeserializer<'a, 'b> {
V: Visitor<'b>,
{
if self.map_as_struct {
self.d.bytes.expect_byte(b'"', Error::ExpectedString)?;
self.d.parser.expect_char('"', Error::ExpectedString)?;
}
let result = self.d.deserialize_identifier(visitor);
if self.map_as_struct {
self.d.bytes.expect_byte(b'"', Error::ExpectedStringEnd)?;
self.d.parser.expect_char('"', Error::ExpectedStringEnd)?;
}
result
}
Expand Down
Loading
Loading