-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Replace Handlebars parser with Peggy grammar for @glimmer/syntax #21308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
NullVoxPopuli-ai-agent
wants to merge
52
commits into
emberjs:main
Choose a base branch
from
NullVoxPopuli-ai-agent:merge-handlebars-parser-into-glimmer-syntax
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
9ab8bbd
Merge @handlebars/parser into @glimmer/syntax
NullVoxPopuli 25a8caa
Fix CI: restore partial/decorator handling, fix lint issues
NullVoxPopuli 5964c83
Update .prettierignore for moved grammar files
NullVoxPopuli 95b185f
Simplify inlined handlebars parser for Glimmer
NullVoxPopuli 32bfd3c
Convert Exception to proper Error subclass
NullVoxPopuli baa4379
Replace Jison-generated parser with recursive-descent parser
NullVoxPopuli 023af14
Fix rd-parser: don't break at {{ in parseProgram
NullVoxPopuli 4e8ba9a
Update tests: accept parse-time errors for decorators/partial-blocks
NullVoxPopuli 4c4a1b6
Fix rd-parser: escaped mustaches, strip+unescaped open
NullVoxPopuli 13f5596
Fix rd-parser: hash pairs with spaces, numeric path segments
NullVoxPopuli 5416c74
Fix rd-parser: backslash escape handling before {{
NullVoxPopuli e7c5468
Fix rd-parser: only allow digit-starting path segments after separators
NullVoxPopuli e3a62d2
Fix rd-parser: preserve raw source text in ContentStatement.original
NullVoxPopuli e7815f6
Fix rd-parser: split ContentStatements at escaped mustache boundaries
NullVoxPopuli 94773f9
Fix rd-parser: stop escaped mustache content at any \+{{ boundary
NullVoxPopuli fc61c48
Fix rd-parser: match Jison error message format exactly
NullVoxPopuli 6f50ea2
Fix rd-parser: match Jison backslash and error display behavior
NullVoxPopuli 4e8957e
Fix rd-parser: match Jison token list and column for invalid chars
NullVoxPopuli 33ec397
Fix rd-parser: don't treat whitespace as invalid token
NullVoxPopuli d3cf7f0
Fix rd-parser: don't catch . and [ as invalid tokens
NullVoxPopuli 6a8cd44
Address review feedback
NullVoxPopuli 6cb80f2
Replace recursive-descent parser with Chevrotain-based parser
NullVoxPopuli 00f9627
Replace Chevrotain with Peggy-based parser
NullVoxPopuli 57f3c46
Fix hbs-scanner: match Jison error messages for @ and invalid chars
NullVoxPopuli f51d1ef
Move path validation and partial rejection into grammar/scanner
NullVoxPopuli b4c7efb
Grammar produces head/tail directly on PathExpression
NullVoxPopuli 5363114
SPIKE: Full HTML+Handlebars Peggy grammar producing ASTv1 directly
NullVoxPopuli 394ea58
Wire Peggy grammar as default parser, delete old pipeline
NullVoxPopuli 7e34f99
Fix CI: update lockfile, fix TypeScript errors
NullVoxPopuli 6908c4d
Use pnpm instead of npx in rollup peggy plugin, add --allowed-start-r…
NullVoxPopuli d1e3ca0
Fix grammar: add missing 'original' property on PathHead nodes
NullVoxPopuli 98d28df
Fix column off-by-one: Peggy uses 1-based columns, Glimmer uses 0-based
NullVoxPopuli 8baab9b
Fix module resolution: workspace override + conditional exports
NullVoxPopuli aa88bb9
Revert workspace override and conditional exports
NullVoxPopuli b7a1927
Fix locals: set blockParams AFTER AST plugins run
NullVoxPopuli 5e1c903
Fix Vite build crash in transform-each-track-array plugin
NullVoxPopuli 9b9a4ab
Fix convertLocations: handle openTag/closeTag as SourceSpans
NullVoxPopuli eb0ba7b
Fix grammar: this.foo paths were losing their tail
NullVoxPopuli 50901a8
Fix grammar: quoted attributes with single mustache must be ConcatSta…
NullVoxPopuli 3239293
Fix Peggy grammar AST differences to match @glimmer/syntax output
NullVoxPopuli e4695f0
Fix AST shape: 12+ grammar fixes, strip flags, block whitespace
NullVoxPopuli 7d2de88
Fix 49 test failures: error messages, locations, validation, whitespace
NullVoxPopuli 4255c77
Fix 49 more test failures: error messages, locations, edge cases
NullVoxPopuli 0917142
Fix last 5 test failures: error spans, inverse block locs, attr locs,…
NullVoxPopuli dec65e0
Fix 10 of 17 Prettier handlebars smoke test failures
NullVoxPopuli c8d2f34
Fix Prettier error test failures with explicit error rules in PEG gra…
NullVoxPopuli cce5cef
Fix type checking and Prettier error format
NullVoxPopuli 507e27c
Fix error column off-by-one and eslint-disable placement
NullVoxPopuli 03f855a
Add Chevrotain parser bakeoff backend
NullVoxPopuli 4b69af0
Clean up PR: drop chevrotain backend, fix entity regression, centrali…
NullVoxPopuli 83ccd8d
Address review: drop runtime simple-html-tokenizer, fix PathExpressio…
NullVoxPopuli 46bc77d
CI fixes: update lockfile, ship .d.ts for html5-named-char-refs
NullVoxPopuli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| function Exception(message, node) { | ||
| let loc = node && node.loc, | ||
| line, | ||
| column; | ||
|
|
||
| if (loc) { | ||
| line = loc.start.line; | ||
| column = loc.start.column; | ||
| message += ' - ' + line + ':' + column; | ||
| } | ||
|
|
||
| let error = new Error(message); | ||
| error.name = 'Exception'; | ||
|
|
||
| if (loc) { | ||
| error.lineNumber = line; | ||
| error.endLineNumber = loc.end.line; | ||
| error.column = column; | ||
| error.endColumn = loc.end.column; | ||
| } | ||
|
|
||
| return error; | ||
| } | ||
|
|
||
| export default Exception; | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { parse, parseWithoutProcessing } from './parse.js'; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import parser from './parser.js'; | ||
| import WhitespaceControl from './whitespace-control.js'; | ||
| import { | ||
| SourceLocation, | ||
| id, | ||
| stripFlags, | ||
| stripComment, | ||
| preparePath, | ||
| prepareMustache, | ||
| prepareRawBlock, | ||
| prepareBlock, | ||
| prepareProgram, | ||
| preparePartialBlock, | ||
| } from './helpers.js'; | ||
|
|
||
| let baseHelpers = { | ||
| SourceLocation, | ||
| id, | ||
| stripFlags, | ||
| stripComment, | ||
| preparePath, | ||
| prepareMustache, | ||
| prepareRawBlock, | ||
| prepareBlock, | ||
| prepareProgram, | ||
| preparePartialBlock, | ||
| }; | ||
|
|
||
| export function parseWithoutProcessing(input, options) { | ||
| // Just return if an already-compiled AST was passed in. | ||
| if (input.type === 'Program') { | ||
| return input; | ||
| } | ||
|
|
||
| parser.yy = baseHelpers; | ||
|
|
||
| parser.yy.locInfo = function (locInfo) { | ||
| return new SourceLocation(options && options.srcName, locInfo); | ||
| }; | ||
|
|
||
| // The lexer needs a syntax.square value to decide how to handle `[`. | ||
| // Glimmer uses the default 'string' mode (bracket-escaped identifiers). | ||
| parser.yy.syntax = { | ||
| square: 'string', | ||
| hash: hashLiteralNode, | ||
| }; | ||
|
|
||
| return parser.parse(input); | ||
| } | ||
|
|
||
| function hashLiteralNode(hash, loc) { | ||
| return { | ||
| type: 'HashLiteral', | ||
| pairs: hash.pairs, | ||
| loc, | ||
| }; | ||
| } | ||
|
|
||
| export function parse(input, options) { | ||
| let ast = parseWithoutProcessing(input, options); | ||
| let strip = new WhitespaceControl(options); | ||
|
|
||
| return strip.accept(ast); | ||
| } |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.