Skip to content

Commit 69f09d3

Browse files
authored
fix(lex): Don't loop over ')' for forever (#1003)
A ')' was accidentally added to the list of token start characters, so if we saw one, `lex_atom` wouldn't eat it and nothing else would, so we'd get stuck in an infinite loop. Fixes #1002
2 parents 8c8ef44 + cc68ae4 commit 69f09d3

File tree

5 files changed

+65
-1
lines changed
  • crates

5 files changed

+65
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Package: R6
2+
Version: 2.5.1
3+
Depends: R (>= 3.0)
4+
Suggests: testthat, pryr
5+
NeedsCompilation: no
6+
License: MIT + file LICENSE
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
TOML parse error at line 1, column 10
2+
|
3+
1 | Package: R6
4+
| ^
5+
key with no value, expected `=`
6+
7+
---
8+
TOML parse error at line 2, column 10
9+
|
10+
2 | Version: 2.5.1
11+
| ^
12+
key with no value, expected `=`
13+
14+
---
15+
TOML parse error at line 3, column 10
16+
|
17+
3 | Depends: R (>= 3.0)
18+
| ^
19+
key with no value, expected `=`
20+
21+
---
22+
TOML parse error at line 4, column 11
23+
|
24+
4 | Suggests: testthat, pryr
25+
| ^
26+
key with no value, expected `=`
27+
28+
---
29+
TOML parse error at line 5, column 19
30+
|
31+
5 | NeedsCompilation: no
32+
| ^
33+
key with no value, expected `=`
34+
35+
---
36+
TOML parse error at line 6, column 10
37+
|
38+
6 | License: MIT + file LICENSE
39+
| ^
40+
key with no value, expected `=`
41+
42+
---
43+
TOML parse error at line 1, column 8
44+
|
45+
1 | Package: R6
46+
| ^
47+
invalid unquoted key, expected letters, numbers, `-`, `_`
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Package: R6
2+
Version: 2.5.1
3+
Depends: R (>= 3.0)
4+
Suggests: testthat, pryr
5+
NeedsCompilation: no
6+
License: MIT + file LICENSE
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
TOML parse error at line 1, column 10
2+
|
3+
1 | Package: R6
4+
| ^
5+
key with no value, expected `=`

crates/toml_parser/src/lexer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ pub(crate) const ML_BASIC_STRING_DELIM: &str = "\"\"\"";
608608
fn lex_atom(stream: &mut Stream<'_>) -> Token {
609609
let start = stream.current_token_start();
610610

611-
const TOKEN_START: &[u8] = b".=,[]{} \t#\r\n)'\"";
611+
const TOKEN_START: &[u8] = b".=,[]{} \t#\r\n'\"";
612612
let offset = stream
613613
.as_bstr()
614614
.offset_for(|b| TOKEN_START.contains_token(b))

0 commit comments

Comments
 (0)