-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more error recovery support and tests
Add error recovery to control statements and metadata. Ensure that invalid identifiers are turned into ERROR tokens instead of throwing. Error recovery will also consider "$" a recovery token.
- Loading branch information
Showing
8 changed files
with
211 additions
and
54 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
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
10 changes: 10 additions & 0 deletions
10
.../src/test/resources/software/amazon/smithy/model/loader/error-recovery/in-metadata.smithy
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,10 @@ | ||
$version: "2.0" | ||
|
||
metadata invalid1 == | ||
metadata valid1 = "ok" | ||
metadata invalid2 = {"bad"} | ||
metadata valid2 = "ok" | ||
metadata invalid3 = ] | ||
metadata valid3 = "ok" | ||
metadata invalid4 = | ||
metadata valid4 = "ok" |
11 changes: 11 additions & 0 deletions
11
...odel/src/test/resources/software/amazon/smithy/model/loader/error-recovery/to-docs.smithy
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,11 @@ | ||
$version: "2.0" | ||
|
||
namespace smithy.example | ||
|
||
// Parse error here. | ||
@externalDocumentation(foo:) | ||
|
||
// Then recover on the line below. | ||
/// Hello | ||
@unknown | ||
integer MyInteger |
6 changes: 6 additions & 0 deletions
6
...el/src/test/resources/software/amazon/smithy/model/loader/error-recovery/to-dollar.smithy
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,6 @@ | ||
$foo | ||
$version: "2.0" | ||
// ^ Recover here | ||
namespace smithy.example | ||
|
||
integer MyInteger |
8 changes: 8 additions & 0 deletions
8
...rc/test/resources/software/amazon/smithy/model/loader/error-recovery/to-identifier.smithy
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,8 @@ | ||
$version: "2.0" | ||
|
||
namespace smithy.example | ||
|
||
// Parse error here. | ||
@externalDocumentation(foo:) | ||
string MyString | ||
// ^ Recover here |
File renamed without changes.