Anchor BNGL action-name detection to start-of-line#84
Open
wshlavacek wants to merge 1 commit intoRuleWorld:mainfrom
Open
Anchor BNGL action-name detection to start-of-line#84wshlavacek wants to merge 1 commit intoRuleWorld:mainfrom
wshlavacek wants to merge 1 commit intoRuleWorld:mainfrom
Conversation
`BNGFile._not_action` does an unanchored substring search of action names against each line, so any line that *contains* an action name as a substring gets pulled out of its block and pushed into the action list. The repeated repro is `conversion()=...` inside a `begin functions` block — the substring `version(` matches the `version` action prefix and the line gets misclassified. Same pitfall exists for `bifurcate` (any identifier ending in `...ifurcate`), `simulate_ssa` / `simulate_nf` / `simulate_pla` / `simulate_ode` (any expression that mentions one of these names), and `readFile` / `writeFile` (any path or function with the substring). Fix: anchor the match to the start of the left-stripped line so user identifiers that look like an action name in the middle of an expression are no longer misclassified. Indentation is allowed before the action name to match the existing behavior.
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.
Summary
`BNGFile._not_action` does an unanchored substring search of action names against each line, so any line that contains an action name as a substring gets pulled out of its block and pushed into the action list. The repeated repro is `conversion()=...` inside a `begin functions` block — the substring `version(` matches the `version` action prefix and the line gets misclassified.
Same pitfall exists for `bifurcate` (any identifier ending in `...ifurcate`), `simulate_ssa` / `simulate_nf` / `simulate_pla` / `simulate_ode` (any expression that mentions one of these names), and `readFile` / `writeFile` (any path or function with the substring).
Fix
Anchor the match to the start of the left-stripped line so user identifiers that look like an action name in the middle of an expression are no longer misclassified. Indentation is still allowed before the action name to match existing behavior.
Test plan