This repository was archived by the owner on Dec 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 223
Implement error recovery for directive tokens #1173
Comments
This is blocked on #1412 being completed. |
NTaylorMullen
added a commit
that referenced
this issue
Jun 12, 2017
- Added error case that enforces whitespace in between directive tokens. - Upon encountering invalid directive tokens/states we bail out of parsing and log an appropriate error. - Raised directive parse errors to the IR layer. This is slightly hacky given the parsers limitations; we swap out the error sink temporarily to capture all directive parser errors and then shove the errors collected onto the directives chunk generator. - Added a `MalformedDiretiveIRNode` and corresponding pass to represent directives that are in an invalid state. Chose to not take the path of using the default `DirectiveIRNode.Diagnostics` member to enable users who are extending directives to only ever have to work with "valid" directives. If they want to work with malformed directives they can search the IR document for their malformed counterpart and handle it separately. #1173
NTaylorMullen
added a commit
that referenced
this issue
Jun 13, 2017
- Added error case that enforces whitespace in between directive tokens. - Upon encountering invalid directive tokens/states we bail out of parsing and log an appropriate error. - Raised directive parse errors to the IR layer. This is slightly hacky given the parsers limitations; we swap out the error sink temporarily to capture all directive parser errors and then shove the errors collected onto the directives chunk generator. - Added a `MalformedDiretiveIRNode` and corresponding pass to represent directives that are in an invalid state. Chose to not take the path of using the default `DirectiveIRNode.Diagnostics` member to enable users who are extending directives to only ever have to work with "valid" directives. If they want to work with malformed directives they can search the IR document for their malformed counterpart and handle it separately. #1173
NTaylorMullen
added a commit
that referenced
this issue
Jun 13, 2017
- Added error case that enforces whitespace in between directive tokens. - Upon encountering invalid directive tokens/states we bail out of parsing and log an appropriate error. - Raised directive parse errors to the IR layer. This is slightly hacky given the parsers limitations; we swap out the error sink temporarily to capture all directive parser errors and then shove the errors collected onto the directives chunk generator. - Added a `MalformedDiretiveIRNode` and corresponding pass to represent directives that are in an invalid state. Chose to not take the path of using the default `DirectiveIRNode.Diagnostics` member to enable users who are extending directives to only ever have to work with "valid" directives. If they want to work with malformed directives they can search the IR document for their malformed counterpart and handle it separately. #1173
NTaylorMullen
added a commit
that referenced
this issue
Jun 14, 2017
- Added error case that enforces whitespace in between directive tokens. - Upon encountering invalid directive tokens/states we bail out of parsing and log an appropriate error. - Raised directive parse errors to the IR layer. This is slightly hacky given the parsers limitations; we swap out the error sink temporarily to capture all directive parser errors and then shove the errors collected onto the directives chunk generator. - Added a `MalformedDiretiveIRNode` and corresponding pass to represent directives that are in an invalid state. Chose to not take the path of using the default `DirectiveIRNode.Diagnostics` member to enable users who are extending directives to only ever have to work with "valid" directives. If they want to work with malformed directives they can search the IR document for their malformed counterpart and handle it separately. #1173
NTaylorMullen
added a commit
that referenced
this issue
Jun 15, 2017
- Added error case that enforces whitespace in between directive tokens. - Upon encountering invalid directive tokens/states we bail out of parsing and log an appropriate error. - Raised directive parse errors to the IR layer. This is slightly hacky given the parsers limitations; we swap out the error sink temporarily to capture all directive parser errors and then shove the errors collected onto the directives chunk generator. - Added a `MalformedDiretiveIRNode` and corresponding pass to represent directives that are in an invalid state. Chose to not take the path of using the default `DirectiveIRNode.Diagnostics` member to enable users who are extending directives to only ever have to work with "valid" directives. If they want to work with malformed directives they can search the IR document for their malformed counterpart and handle it separately. - Updated existing test expectations - Removed some existing tests that were no longer valid (we don't call into user code if a directive is malformed). #1173
NTaylorMullen
added a commit
that referenced
this issue
Jun 20, 2017
- Added error case that enforces whitespace in between directive tokens. - Upon encountering invalid directive tokens/states we bail out of parsing and log an appropriate error. - Raised directive parse errors to the IR layer. This is slightly hacky given the parsers limitations; we swap out the error sink temporarily to capture all directive parser errors and then shove the errors collected onto the directives chunk generator. - Added a `MalformedDiretiveIRNode` and corresponding pass to represent directives that are in an invalid state. Chose to not take the path of using the default `DirectiveIRNode.Diagnostics` member to enable users who are extending directives to only ever have to work with "valid" directives. If they want to work with malformed directives they can search the IR document for their malformed counterpart and handle it separately. - Updated existing test expectations - Removed some existing tests that were no longer valid (we don't call into user code if a directive is malformed). #1173
NTaylorMullen
added a commit
that referenced
this issue
Jun 20, 2017
- Added error case that enforces whitespace in between directive tokens. - Upon encountering invalid directive tokens/states we bail out of parsing and log an appropriate error. - Raised directive parse errors to the IR layer. This is slightly hacky given the parsers limitations; we swap out the error sink temporarily to capture all directive parser errors and then shove the errors collected onto the directives chunk generator. - Added a `MalformedDiretiveIRNode` and corresponding pass to represent directives that are in an invalid state. Chose to not take the path of using the default `DirectiveIRNode.Diagnostics` member to enable users who are extending directives to only ever have to work with "valid" directives. If they want to work with malformed directives they can search the IR document for their malformed counterpart and handle it separately. - Updated existing test expectations - Removed some existing tests that were no longer valid (we don't call into user code if a directive is malformed). #1173
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We're not strict enough with error detection for directive tokens - for example
If the
custom
directive expects a namespace, it will parse theglobal
token, and then fail because the::
Some_Namespace` token remains. If instead, another token was part of the directive that could consume this text, it was parse correctly.So, that means that tokens are allowed to run together, and we don't prevent it today.
We also need to implement error recovery for tokens universally.
The text was updated successfully, but these errors were encountered: