Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
repl: refactor LineParser implementation#6171
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
7da4fd4 to c7066fbComparelib/repl.js Outdated
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.
Could have a semicolon after the }?
blakeembreyJun 17, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
Absolutely. I didn't want to change too much code with this refactor though - I've only changed how it's run (E.g. to run after the user hits enter, instead of each line). Here's the original check: https://github.com/nodejs/node/pull/6171/files/680c88111413ad25bafbe9d7578079d6c0ca5ff0#diff-b13d72249263845d8e8341db0426f9d3L426. Could definitely change to check to include a semicolon.
Fishrock123 commented Jun 17, 2016
CI: https://ci.nodejs.org/job/node-test-pull-request/3018/ Seems to me this changes enough properties that it is probably semver-major.. |
Fishrock123 commented Jun 17, 2016
Looks like the CI is refusing to run with a rebase, CI without rebasing: https://ci.nodejs.org/job/node-test-pull-request/3019/ |
680c881 to 44ba60aComparebc6e18c to 34a3f83Compareblakeembrey commented Oct 14, 2016
@Fishrock123 I just rebased again on top of the changes that have occurred. Is there anything I can do to make this land? It'd be very convenient for myself and others that have built custom REPLs for transpiled programming languages. I intend to use this to support running TypeScript in a REPL with multiple lines. Although not a big deal for TypeScript, since it follows JavaScript semantics, it's might be more useful for transpile language targets that may fail the existing "should code fail" checks used in the line parser. It also helps to separate the existing concerns that are mixed as new features get added to the JavaScript implementation that aren't relevant for transpiled languages. |
Fishrock123 commented Oct 14, 2016
@nodejs/collaborators can someone review? |
c133999 to 83c7a88Comparejasnell commented Mar 1, 2017
@blakeembrey ... do you still want to pursue this? |
blakeembrey commented Mar 1, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@jasnell I will refactor again if someone will review it and thinks it's useful. Otherwise, not really. It is still required to improve interop with transpiler REPLs where recovery/new lines can be detected differently. |
jasnell commented Mar 1, 2017
Yep. Understood. I'll commit to reviewing. |
targos commented Mar 1, 2017
I'll review it too. |
34a3f83 to 632c58eCompareblakeembrey commented Mar 3, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@targos@jasnell I just updated the PR and it's passing locally. I'm not sure if the CI build is meant to be running? Edit: I see I'm meant to wait (https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#ci-testing) 😄 |
gibfahn commented Mar 3, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
CI 3: https://ci.nodejs.org/job/node-test-commit/8236/ EDIT: CI is green |
cjihrig commented Mar 13, 2017
This has conflicts. |
gibfahn commented Mar 13, 2017
@blakeembrey could you rebase? |
632c58e to c06f9c3CompareMove the core logic from `LineParser` should fail handling into the recoverable error check for the REPL default eval.
c06f9c3 to 6e05e03Compareblakeembrey commented Mar 13, 2017
targos commented Mar 14, 2017
Move the core logic from `LineParser` should fail handling into the recoverable error check for the REPL default eval. PR-URL: #6171 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
jasnell commented Mar 14, 2017
Landed in 39d9afe. Thank you @blakeembrey. Sorry again for this taking so long! |
blakeembrey commented Mar 14, 2017
Thanks @jasnell for landing this, and everyone else involved 😄 |
| return; | ||
| }elseif(!self.bufferedCommand){ | ||
| self.outputStream.write('Invalid REPL keyword\n'); | ||
| if(trimmedCmd){ |
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.
I think this broke the command line debugger. Previously an empty command would be sent to the eval function. Now <enter> is silently ignored.
The CLI debugger was using <enter> for "repeat last command".
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.
Ugh. Ok, we can back it out if necessary but let's see if we can find a fix first.
/cc @blakeembrey
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.
Let's also see if we can get a regression test added since this case obviously wasn't being tested in CI :-(
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.
Don't think this is super urgent, was just digging through why it passed against the last 8.x nightly but not against master.
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.
I think the fix is as simple as removing that else branch: #11871
This fixes a regression introduced in nodejs#6171
This fixes a regression introduced in #6171 PR-URL: #11871 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Move the core logic from `LineParser` should fail handling into the recoverable error check for the REPL default eval. PR-URL: nodejs#6171 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
This fixes a regression introduced in nodejs#6171 PR-URL: nodejs#11871 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Delete unused method call. PR-URL: #12685 Refs: #6171 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
lance commented Oct 4, 2017
Added |
Move the core logic from `LineParser` should fail handling into the recoverable error check for the REPL default eval. Fixes: #15704 Backport-PR-URL: #15773 PR-URL: #6171 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Checklist
Affected core subsystem(s)
replDescription of change
Move the core logic from
LineParsershould fail handling into the recoverable error check for the REPL default eval. This was originally from #3488, and I've split it out for separate review and hopefully speed it up. The idea is to make the current recoverable check part of the defaultevalinstead of limiting the usefulness of the REPL functionality to only JavaScript languages (E.g. enable TypeScript).