Commit Graph
6 Commits
Author SHA1 Message Date
Jon Ross-Perkins dc23f6305d Use Consume() more where possible. (#2397)
Just trying to standardize the use in a few spots; no behavioral change.
2022-11-15 22:45:47 -08:00
Jon Ross-Perkins c165ab6c2b Change StructLiteral and StructTypeLiteral parsing to use an ambiguous start. (#2396)
This is necessary in order to use a bracketing approach; parsing doesn't know the contained format until it parses the first element, which we don't want to do look-ahead for. I think the bracketing is higher value than knowing the format before adding the node.
2022-11-15 22:44:57 -08:00
Jon Ross-Perkins b914f46ec5 Change keyword statements to bracket arguments. (#2394)
This changes `return`, `break`, and `continue` to treat the keyword as the "start" and semicolon as the "parent", essentially bracketing the keyword.

Pragmatically this is focusing on making `return` work with only one ParseNodeKind: because `return` and `;` now bracket the expression, we can tightly determine whether the `return` has arguments without looking at subtree size. However, it's possible that `break` and `continue` may in the future take some kind of label as an argument, so the consistency seems beneficial there too.

Note this eliminates the StatementEnd ParseNodeKind, as it's obsolete with this change.
2022-11-15 22:42:54 -08:00
Jon Ross-Perkins 310cf0d2f9 Refactor Pattern and FunctionParameter handling for Parser consistency (#2385)
While the Parser has similar divergent states, lists of Expressions tend to be handled more like this. I'm keeping the divergent start state in order to continue support of a distinct error, but I think this organization of FunctionParameter/FunctionParameterFinish will be less surprising.
2022-11-15 22:36:52 -08:00
Jon Ross-Perkins b163aaaf74 Add a ForIn node for a , move the error (#2387)
This is to keep the tree consistent with the error-free state. It also more precisely locates the error.
2022-11-14 13:17:58 -08:00
Jon Ross-Perkins 6433a1bab6 Rename Parser2 to Parser, and delete the original (#2383) 2022-11-11 13:35:45 -08:00