Skip to content

Commit

Permalink
Symbol not limited to 200 characters. Remove arbitrarily defined limi…
Browse files Browse the repository at this point in the history
…ts on `take_while`s.
  • Loading branch information
Grinkers committed Feb 23, 2024
1 parent 8dd45b6 commit 95abc3f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ fn complex_ok() -> Result<(), EdnError> {
- [x] String `"\"string\""`
- [x] Numbers `"324352"`, `"3442.234"`, `"3/4"`
- [x] Keywords `:a`
- [x] Symbol `sym-bol-s` with a maximum of 200 chars
- [x] Symbol `sym-bol-s`
- [x] Vector `"[1 :2 \"d\"]"`
- [x] List `"(1 :2 \"d\")"`
- [x] Set `"#{1 2 3}"`
Expand Down
4 changes: 2 additions & 2 deletions src/deserialize/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ fn read_symbol(a: char, chars: &mut iter::Enumerate<core::str::Chars<'_>>) -> Re
let c_len = chars
.clone()
.enumerate()
.take_while(|&(i, c)| i <= 200 && !c.1.is_whitespace() && !DELIMITERS.contains(&c.1))
.take_while(|&(_, c)| !c.1.is_whitespace() && !DELIMITERS.contains(&c.1))
.count();
let i = chars
.clone()
Expand Down Expand Up @@ -290,7 +290,7 @@ fn read_char(chars: &mut iter::Enumerate<core::str::Chars<'_>>) -> Result<Edn, E
let element = chars
.clone()
.enumerate()
.take_while(|&(i, c)| i <= 200 && !c.1.is_whitespace())
.take_while(|&(_, c)| !c.1.is_whitespace())
.map(|(_, c)| c.1)
.collect::<String>();

Expand Down
3 changes: 3 additions & 0 deletions tests/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,9 @@ mod test {
Edn::Symbol("your-hair!-is+_parsed?".to_string()),
]));
assert_eq!(edn, expected);

let lorem = "Lorem-ipsum-dolor-sit-amet-consectetur-adipiscing-elit-sed-do-eiusmod-tempor-incididunt-ut-labore-et-dolore-magna-aliqua.-Ut-enim-ad-minim-veniam-quis-nostrud-exercitation-ullamco-laboris-nisi-ut-aliquip-ex-ea-commodo-consequat.-Duis-aute-irure-dolor-in-reprehenderit-in-voluptate-velit-esse-cillum-dolore-eu-fugiat-nulla-pariatur.-Excepteur-sint-occaecat-cupidatat-non-proident-sunt-in-culpa-qui-officia-deserunt-mollit-anim-id-est-laborum".to_string();
assert_eq!(Edn::from_str(lorem.as_str()).unwrap(), Edn::Symbol(lorem));
}

#[test]
Expand Down

0 comments on commit 95abc3f

Please sign in to comment.