Skip to content

Commit

Permalink
support for \r ; tag 0.1.24
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Aug 23, 2022
1 parent 8b77a81 commit 47841ed
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
28 changes: 17 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cirru_parser"
version = "0.1.23"
version = "0.1.24"
authors = ["jiyinyiyong <[email protected]>"]
edition = "2021"
license = "MIT"
Expand Down Expand Up @@ -28,11 +28,11 @@ use-serde = ["serde", "serde_json"]

# ['cfg(features = "use-serde")'.dependencies]
[dependencies]
serde = { version = "1.0.137", optional = true }
serde_json = { version = "1.0.81", optional = true }
serde = { version = "1.0.144", optional = true }
serde_json = { version = "1.0.85", optional = true }

[dev-dependencies]
criterion = "0.3.5"
criterion = "0.3.6"

[lib]
name = "cirru_parser"
Expand Down
4 changes: 4 additions & 0 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ pub fn lex(initial_code: &str) -> Result<CirruLexItemList, String> {
state = CirruLexState::Str;
buffer.push('\n');
}
'r' => {
state = CirruLexState::Str;
buffer.push('\r');
}
'u' => {
// not supporting, but don't panic
let end = idx + 10;
Expand Down
2 changes: 2 additions & 0 deletions tests/parser_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ mod json_test {
Ok(Cirru::List(vec!(vec!["a"].into(), vec!["b"].into())))
);

assert_eq!(parse("a\rb").map(Cirru::List), Ok(Cirru::List(vec!(vec!["a\rb"].into()))));

assert_eq!(
parse("a (b) c").map(Cirru::List),
Ok(Cirru::List(vec![vec![Cirru::leaf("a"), vec!["b"].into(), "c".into()].into()]))
Expand Down

0 comments on commit 47841ed

Please sign in to comment.