-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When parsing nested vectors all using look-ahead, we need to return control back to upper level when an inner look-ahead isn't found. This may change the error message for "normal" look-ahead parsing (see test baseline), but the new one seems fine and potentially even better. Closes #1844. (cherry picked from commit 2223f18)
- Loading branch information
Showing
4 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. | ||
[$a=[[$x=1, $y=2571], [$x=1, $y=3085]], $b=2, $c=3599] | ||
[$a=[], $b=2, $c=3599] | ||
[error] terminating with uncaught exception of type spicy::rt::ParseError: no expected look-ahead token found (<...>/parse-lahead-int.spicy:15:5-15:14) | ||
[error] terminating with uncaught exception of type spicy::rt::ParseError: expecting uint8(2) (<...>/parse-lahead-int.spicy:16:8-16:18) |
29 changes: 29 additions & 0 deletions
29
tests/Baseline/spicy.types.vector.parse-lahead-nested/output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. | ||
Test::X { | ||
y: [ | ||
Test::Y { | ||
z: [ | ||
Test::Z { | ||
zb: 1 | ||
} | ||
Test::Z { | ||
zb: 2 | ||
} | ||
Test::Z { | ||
zb: 3 | ||
} | ||
] | ||
} | ||
Test::Y { | ||
z: [] | ||
} | ||
Test::Y { | ||
z: [ | ||
Test::Z { | ||
zb: 1 | ||
} | ||
] | ||
} | ||
] | ||
x: x | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# @TEST-EXEC: printf 'yz1z2z3yyz1x' | spicy-dump %INPUT >output | ||
# @TEST-EXEC: btest-diff output | ||
# | ||
# @TEST-DOC: Parse two nested vectors each using look-ahead; regression test for #1844. | ||
|
||
module Test; | ||
|
||
type Z = unit { | ||
: /z/; | ||
zb: bytes &size=1; | ||
}; | ||
|
||
type Y = unit { | ||
: /y/; | ||
z: Z[]; | ||
}; | ||
|
||
public type X = unit { | ||
y: Y[]; | ||
x: /x/; | ||
}; |