-
Notifications
You must be signed in to change notification settings - Fork 64
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
Expression parser #464
Merged
Merged
Expression parser #464
Conversation
This file contains 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
src/Spec.ts
Outdated
} | ||
pointer = pointer.parentElement; | ||
const expressionVisitor = (expr: Expr, path: PathItem[]) => { | ||
// console.log(require('util').inspect(expr, { depth: Infinity })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
// console.log(require('util').inspect(expr, { depth: Infinity })); |
src/Spec.ts
Outdated
nodeRelativeColumn: column, | ||
}); | ||
} else { | ||
// console.log(require('util').inspect(item, { depth: Infinity})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
// console.log(require('util').inspect(item, { depth: Infinity})); |
michaelficarra
approved these changes
Jul 7, 2022
this is not breaking because it allows 'undefined'
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.
This adds a barebones parser for algorithm steps, recognizing calls, SDO invocations, records, and lists. It is invoked downstream of the biblio being built, which means it can differentiate
List of _bar_
(which is not an SDO invocation) fromSDO of _bar_
(which is).The parser is much less sophisticated than the ones in ecmaspeak-py or esmeta. On the other hand, it's also much less specialized to the current spec text, so hopefully will not require updates as often.
The new parser is used to
I've checked this on 262 and 402 (which pass without error) as well as proposal-temporal (which has a few genuine bugs this catches).
It also incidentally adds AO kinds ("syntax-directed operation", "host-defined abstract operation", etc) to the biblio. This is not a breaking change because the new type allows the kind to be
undefined
.Unfortunately I've had to hardcode the names of certain operations which are invoked without being defined as operations, namely
The
thisXValue
ones are a weird thing we do where we define an AO without giving it its own clause, represented by source text likeWe should get rid of these. (Also note that
aoid
ondfn
doesn't do anything.)toUppercase
andtoLowercase
are invoking Unicode algorithms (see e.g. step 5 of Canonicalize). Not sure what to do about those - maybe those names should be written as`code`
?ℝ
and friends just need to be defined withemu-eqn
and then they can be removed from the hardcoded list; I'll make that change once tc39/ecma262#2810 lands.Depends on tc39/ecmarkdown#92.