Skip to content

JavaScript: Rewrite regex parser and JSDoc parser in Java.#461

Merged
semmle-qlci merged 3 commits into
github:masterfrom
xiemaisi:js/bye-bye-rhino
Nov 14, 2018
Merged

JavaScript: Rewrite regex parser and JSDoc parser in Java.#461
semmle-qlci merged 3 commits into
github:masterfrom
xiemaisi:js/bye-bye-rhino

Conversation

@xiemaisi
Copy link
Copy Markdown

This eliminates the last bits of JavaScript in the extractor, so we will be able to get rid of our dependency on Rhino and doctrine (which I'd prefer to do in a separate PR).

The new parsers are faithful re-implementations of their JavaScript counterparts and produce the same TRAP on our default benchmarking suite, with the exception of a few bugs that I discovered in the old regex parser and some minor differences in the handling of non-ASCII whitespace in JSDoc comments that didn't seem worth bothering about.

I have verified that these differences do not affect results or performance, except for fixing a handful of false positives on the test262 test suite. Extractor performance improves a bit, but I don't have detailed measurements.

Max Schaefer added 3 commits November 12, 2018 08:18
This is not so much because extractor output has changed (it hasn't, except for corner cases) but to disable trap caching so as to help us to flush out bugs.
@xiemaisi xiemaisi added the JS label Nov 13, 2018
@xiemaisi xiemaisi requested a review from a team as a code owner November 13, 2018 16:39
@ghost
Copy link
Copy Markdown

ghost commented Nov 14, 2018

LGTM from a cursory read. Do you need a thorough review for some parts of this?

@xiemaisi
Copy link
Copy Markdown
Author

Do you need a thorough review for some parts of this?

No need to review the parsers themselves. The testing I've done gives me some confidence that they work well enough in practice, and any remaining corner cases should be caught by the next distribution upgrade in two weeks' time.


private Token scanString() throws ParseError {
StringBuilder str = new StringBuilder();
int quote, ch, code, restore; //TODO review removal octal = false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to leave this TODO here, or was it just ported from doctrine?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's from doctrine.

@semmle-qlci semmle-qlci merged commit 025054e into github:master Nov 14, 2018
cklin pushed a commit that referenced this pull request May 23, 2022
…cope

Move reused barrier guards into separate files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants