Refine detection of procedure declarations - #144
Merged
Conversation
Member
Author
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.
Two interacting problems have been dogging us for some time. Detection of procedures has been fraught because
:can appear both in procedure declarations and in normal prose. The Technique parser is built around the capturing ranges at the current contextual scope, so depends on accurately scanning from one procedure to the next, so being able to find those correctly and avoiding false positives is crucial to both correctness and being able to offer good error messages.The solution is to make a slight change to the grammar as follows. A procedure declaration is an identifier, followed by space (at least one), followed by a colon
:(then optionally followed by a signature).The presence of the space between identifier and colon allows us to differentiate between a procedure definition
and prose in a procedure description
The second problem addressed by this branch is ensuring characters in literal (especially strings literals and multi-line string literals) are masked and preserved as part of the literal and not considered as being language syntax. This also has been a few rounds; in particular colon
:and quote'characters kept false matches for other predicates. This branch improves the scanner to track text vs quoted vs fenced runs as it works through the input.