Repository navigation
Conversation
Lex.lex scans the source in one self-tail-recursive function: identifiers (Upper.name is one), ints with their value, strings and chars (raw text), one- and two-character ops, and layout: a deeper line opens an indent, a shallower one closes every indent above it, a newline inside ( or [ is no token, a blank or comment line is nothing. Tokens are typed cases; a tab, a bad dedent, an unterminated literal or a bad character is Lex.Bad(line, why), never an exit. tests/s2/lex: a snippet with an indent, a blank line, two dedents at once, a comment, a dotted name, a newline inside ( ), a char literal and a two-character op; each error kind; and lib/prelude.srs, tests/rules.srs, tests/file_ok.srs and s2/coll.srs lex with balanced layout and one TEof. Mutants: no depth decrement, no dotted names, no dedent tokens, no newline suppression: each changes the output.
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.
FRONT rung 1: the lexer (
s2/lex.srs, moduleLex). Tokens and layout follow s1/lex.srs.Upper.nameis one), ints with their value, strings and chars, and one- and two-character ops.(or[is no token.Lex.Bad(line, why), never an exit.Tests: a snippet with every layout case, a comment, a dotted name, a newline inside parens, a char literal and a two-character op; each error kind; four real sources lex with balanced layout and one Eof. Four mutants (no depth decrement, no dotted names, no dedent tokens, no newline suppression) each change the output. Local tests/run.sh: 184 ok, 0 FAIL.