Open
Conversation
Contributor
Author
|
Before: $ build/b tests/lexer_errors.b
INFO: Compiling files tests/lexer_errors.b ./libb/all.b ./libb/gas-x86_64-linux.b
tests/lexer_errors.b:5:5: LEXER ERROR: Empty character literalAfter, without peeking: $ build/b tests/lexer_errors.b
INFO: Compiling files tests/lexer_errors.b ./libb/all.b ./libb/gas-x86_64-linux.b
tests/lexer_errors.b:5:5: LEXER ERROR: Empty character literal
tests/lexer_errors.b:5:5: LEXER ERROR: Empty character literal
tests/lexer_errors.b:5:5: LEXER ERROR: Empty character literal
tests/lexer_errors.b:6:5: LEXER ERROR: Character literal contains more than two characters
tests/lexer_errors.b:6:5: LEXER ERROR: Character literal contains more than two characters
tests/lexer_errors.b:6:5: LEXER ERROR: Character literal contains more than two characters
tests/lexer_errors.b:9:5: LEXER ERROR: Integer literal overflow
tests/lexer_errors.b:9:5: LEXER ERROR: Integer literal overflow
tests/lexer_errors.b:9:5: LEXER ERROR: Integer literal overflow
tests/lexer_errors.b:10:5: LEXER ERROR: Integer literal overflow
tests/lexer_errors.b:10:5: LEXER ERROR: Integer literal overflow
tests/lexer_errors.b:10:5: LEXER ERROR: Integer literal overflow
tests/lexer_errors.b:13:7: LEXER ERROR: Unknown escape sequence starting with `f`
tests/lexer_errors.b:13:11: LEXER ERROR: Unknown escape sequence starting with `b`
tests/lexer_errors.b:13:15: LEXER ERROR: Unknown escape sequence starting with `b`
tests/lexer_errors.b:13:7: LEXER ERROR: Unknown escape sequence starting with `f`
tests/lexer_errors.b:13:11: LEXER ERROR: Unknown escape sequence starting with `b`
tests/lexer_errors.b:13:15: LEXER ERROR: Unknown escape sequence starting with `b`
tests/lexer_errors.b:13:7: LEXER ERROR: Unknown escape sequence starting with `f`
tests/lexer_errors.b:13:11: LEXER ERROR: Unknown escape sequence starting with `b`
tests/lexer_errors.b:13:15: LEXER ERROR: Unknown escape sequence starting with `b`After, with peeking: $ build/b tests/lexer_errors.b
INFO: Compiling files tests/lexer_errors.b ./libb/all.b ./libb/gas-x86_64-linux.b
tests/lexer_errors.b:5:5: LEXER ERROR: Empty character literal
tests/lexer_errors.b:6:5: LEXER ERROR: Character literal contains more than two characters
tests/lexer_errors.b:9:5: LEXER ERROR: Integer literal overflow
tests/lexer_errors.b:10:5: LEXER ERROR: Integer literal overflow
tests/lexer_errors.b:13:7: LEXER ERROR: Unknown escape sequence starting with `f`
tests/lexer_errors.b:13:11: LEXER ERROR: Unknown escape sequence starting with `b`
tests/lexer_errors.b:13:15: LEXER ERROR: Unknown escape sequence starting with `b` |
This comment was marked as outdated.
This comment was marked as outdated.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The idea is that when the lexer encounters an error it can tell the compiler whether compilation can continue or not based on the
Errvariant ofResultrather than a simpleOption:However there was a bad interaction with the backtracking we do in the compiler, which caused duplicate errors being reported when tokens were re-lexed. To avoid that, I implemented
peek_token()and used it instead where possible.Closes #205.