Repository navigation
Raise rule coverage of popular grammar samples to 90% - #153
Merged
Merged
Conversation
One registry for every grammar exhausted vscode-oniguruma's WASM heap once the samples grew. Disposing each grammar's registry keeps memory bounded and produces byte-identical tokens for the existing samples. Amp-Thread-ID: https://ampcode.com/threads/T-01a1a3c3-f9f7-7045-8283-061347f1edec Co-authored-by: Ryan Chandler <ryan@ryangjchandler.co.uk>
Extend the samples for 25 widely used languages so each matches at least 90% of its grammar's rules, except C++ (67.1%) and Shell (87.2%), whose grammars contain rules that are never included. Regenerate COMPATIBILITY.md. Amp-Thread-ID: https://ampcode.com/threads/T-01a1a3c3-f9f7-7045-8283-061347f1edec Co-authored-by: Ryan Chandler <ryan@ryangjchandler.co.uk>
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.
Extends the compatibility samples for the most widely used languages so
meta/compatibility.phpexercises at least 90% of each grammar's rules, and regeneratesCOMPATIBILITY.md.The existing sample content is unchanged; new code is appended (plus a shebang at the top of a few files). It's mostly realistic, idiomatic code. A few samples end with a short, commented block of invalid code to cover the grammar's "illegal" rules.
Rust was already at 92.6%.
C++ and Shell can't reach 90% under this metric: 152 C++ rules and 21 Shell rules are never included anywhere in their grammars (ceilings of 83.8% and 89.2%). C++ also loses 39 constructor/destructor rules, and Shell a
name() ( … )body rule, to Phiki bugs.Script fix
With the larger samples,
meta/vscode-textmate-samples.jscrashed withfail to memory allocationfrom vscode-oniguruma, because one registry held compiled scanners for all 227 grammars. It now creates and disposes a registry per grammar. On the original samples its output is byte-identical to before.Phiki bugs the new samples expose
Totals moved from 92.6% → 93.1% (Oniguruma) and 95.5% → 96.2% (PCRE), but PCRE-identical grammars dropped from 167 to 163:
%w|…|/%^…^percent literals aren't recognised; the captured delimiter seems to be put into the end regex unescaped.<svg>/<math>are mis-scoped; those rules have a nestedrepositorythat Phiki doesn't appear to use when resolving includes.<p></p>) never matches; its regex has a backreference inside a lookahead.#of#/…/#regex literals falls outside the regex scope.using/await usingdeclarations never close, so the scope leaks to the end of the file. Those snippets sit last in each sample.