GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — repl: handle comments properly by thefourtheye · Pull Request #3515 · nodejs/node

Conversation

@thefourtheye

@thefourtheye thefourtheye commented Oct 25, 2015

Copy link
Copy Markdown
Contributor

As it is, the comments are not handled properly in REPL. So, if the
comments have ' or ", then they are treated as string literals and
the error is thrown in REPL.

This patch refactors the existing logic and groups everything in a
class.

Fixes: #3421

cc @mscdex @silverwind @ChuckLangford @Fishrock123

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@thefourtheye thefourtheye added the repl Issues and PRs related to the REPL subsystem. label Oct 25, 2015
@thefourtheye thefourtheye mentioned this pull request Oct 25, 2015
repl hates comments with quotes in indented code #3421
Closed
@thefourtheye
thefourtheye force-pushed the fix-comments-in-repl branch 2 times, most recently from 67fa425 to 8179911 Compare October 25, 2015 18:33
@mscdex

mscdex commented Oct 25, 2015

Copy link
Copy Markdown
Contributor

CI: https://ci.nodejs.org/view/iojs/job/node-test-pull-request/609/

LGTM

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ChuckLangford
ChuckLangford reviewed Oct 26, 2015
View reviewed changes
Comment thread test/parallel/test-repl.js Outdated

@ChuckLangford ChuckLangford Oct 26, 2015

Copy link
Copy Markdown
Contributor

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.

The code changes LGTM.

This being my first core review I have a question, how detailed do we get with tests? The test on line 260 is good but I don't see the same test for a single quote.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@thefourtheye thefourtheye Oct 26, 2015

Copy link
Copy Markdown
Contributor Author

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.

@ChuckLangford Thanks for the feedback. I thought I covered it in 254, but we have both tests at 257 and 260. More tests is good I guess :-) I included that now. PTAL.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@thefourtheye
repl: handle comments properly
5f656db
As it is, the comments are not handled properly in REPL. So, if the
comments have `'` or `"`, then they are treated as string literals and
the error is thrown in REPL.

This patch refactors the existing logic and groups everything in a
class.

Fixes: nodejs#3421
@thefourtheye
thefourtheye force-pushed the fix-comments-in-repl branch from 8179911 to 5f656db Compare October 26, 2015 02:23
targos
targos reviewed Oct 26, 2015
View reviewed changes
Comment thread lib/repl.js Outdated

@targos targos Oct 26, 2015

Copy link
Copy Markdown
Member

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.

suggestion: use a for...of loop

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@thefourtheye thefourtheye Oct 26, 2015

Copy link
Copy Markdown
Contributor Author

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.

Oh yeah, I'll change it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@thefourtheye
addressing targos's comments
60aeee5
@thefourtheye

thefourtheye commented Oct 26, 2015

Copy link
Copy Markdown
Contributor Author

@targos I modified the PR as per your suggestions. PTAL.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ChuckLangford

ChuckLangford commented Oct 26, 2015

Copy link
Copy Markdown
Contributor

LGTM

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fishrock123
Fishrock123 reviewed Oct 26, 2015
View reviewed changes
Comment thread lib/repl.js

@Fishrock123 Fishrock123 Oct 26, 2015

Copy link
Copy Markdown
Contributor

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.

This is for (... of ...) on a String? I was unaware that worked.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@thefourtheye thefourtheye Oct 26, 2015

Copy link
Copy Markdown
Contributor Author

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.

@Fishrock123 It actually works.

'use strict';

for (const chr of "abcd") {
  console.log(chr);
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@targos targos Oct 26, 2015

Copy link
Copy Markdown
Member

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.

It works and has the advantage to handle unicode correctly:
image

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Fishrock123

Fishrock123 commented Oct 26, 2015

Copy link
Copy Markdown
Contributor

Seems fine so far to me.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123

Fishrock123 commented Oct 26, 2015

Copy link
Copy Markdown
Contributor

LGTM if it works

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thefourtheye

thefourtheye commented Oct 27, 2015

Copy link
Copy Markdown
Contributor Author

Yet another CI run: https://ci.nodejs.org/job/node-test-pull-request/626/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Oct 27, 2015

Copy link
Copy Markdown
Member

semver-minor?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thefourtheye

thefourtheye commented Oct 27, 2015

Copy link
Copy Markdown
Contributor Author

@jasnell Hmmm, wouldn't this be just a bug fix? Also, can we backport this to 4.x LTS? People who use REPL will be impacted.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Oct 27, 2015

Copy link
Copy Markdown
Member

Yes and no. If it's, "Previously the REPL didn't support comments, now it does", then it's a new feature, semver-minor, and should not land in v4.x. However, if it's, "REPL was always supposed to support comments and we consider this a regression", then a case can be made for landing it in v4.x.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123

Fishrock123 commented Oct 27, 2015

Copy link
Copy Markdown
Contributor

If it helps I think this should be fixed in v4.x.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Oct 27, 2015

Copy link
Copy Markdown
Member

It does help. Getting some others from the @nodejs/tsc and @nodejs/lts teams to chime in would help also. I'm leaning towards a yes for v4.x also.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@silverwind

silverwind commented Oct 27, 2015

Copy link
Copy Markdown
Contributor

I don't see this as semver-worthy. The expectation is that you can paste any JS into the REPL, so this is a 'feature' that should've been there from the start. Also, I'd be surprised if this is not actually a regression.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell jasnell added the lts-watch-v4.x label Oct 27, 2015
thefourtheye added a commit that referenced this pull request Oct 28, 2015
@thefourtheye
repl: handle comments properly
6cf1910
As it is, the comments are not handled properly in REPL. So, if the
comments have `'` or `"`, then they are treated as incomplete string
literals and the error is thrown in REPL.

This patch refactors the existing logic and groups everything in a
class.

Fixes: #3421
PR-URL: #3515
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
@thefourtheye

thefourtheye commented Oct 28, 2015

Copy link
Copy Markdown
Contributor Author

Thanks for the review people. Landed at 6cf1910

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thefourtheye thefourtheye closed this Oct 28, 2015
@thefourtheye
thefourtheye deleted the fix-comments-in-repl branch October 28, 2015 02:03
thefourtheye added a commit that referenced this pull request Oct 28, 2015
@thefourtheye @jasnell
repl: handle comments properly
d918838
As it is, the comments are not handled properly in REPL. So, if the
comments have `'` or `"`, then they are treated as incomplete string
literals and the error is thrown in REPL.

This patch refactors the existing logic and groups everything in a
class.

Fixes: #3421
PR-URL: #3515
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
@jasnell

jasnell commented Oct 28, 2015

Copy link
Copy Markdown
Member

Landed in v4.x-staging in d918838

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell jasnell added land-on-v4.x and removed lts-watch-v4.x labels Oct 28, 2015
@jasnell jasnell mentioned this pull request Oct 28, 2015
Preparing v4.2.2 LTS Maintenance nodejs/Release#50
Closed
rvagg pushed a commit to rvagg/io.js that referenced this pull request Oct 29, 2015
@thefourtheye @rvagg
repl: handle comments properly
bd4311b
As it is, the comments are not handled properly in REPL. So, if the
comments have `'` or `"`, then they are treated as incomplete string
literals and the error is thrown in REPL.

This patch refactors the existing logic and groups everything in a
class.

Fixes: nodejs#3421
PR-URL: nodejs#3515
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
@rvagg rvagg mentioned this pull request Oct 29, 2015
Release proposal: v5.0.0 #3466
Merged
thefourtheye added a commit that referenced this pull request Oct 29, 2015
@thefourtheye @jasnell
repl: handle comments properly
8a2c4ae
As it is, the comments are not handled properly in REPL. So, if the
comments have `'` or `"`, then they are treated as incomplete string
literals and the error is thrown in REPL.

This patch refactors the existing logic and groups everything in a
class.

Fixes: #3421
PR-URL: #3515
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
@jasnell jasnell mentioned this pull request Oct 29, 2015
Release Proposal: v4.2.2 "Argon" (LTS) #3588
Closed
@jasnell jasnell removed the land-on-v4.x label Nov 3, 2015
This was referenced Apr 29, 2023
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 aliscco/alisco-node#375
Open
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 aliscco/alisco-node#379
Open
This was referenced Jun 22, 2023
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 aliscco/alisco-node#494
Open
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 aliscco/alisco-node#532
Open
[Snyk] Security upgrade karma from 4.4.1 to 5.0.8 aliscco/alisco-node#562
Open
[Snyk] Security upgrade karma from 4.4.1 to 5.0.8 aliscco/alisco-node#595
Open
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 aliscco/alisco-node#614
Open
@leonardoadame leonardoadame mentioned this pull request Jul 9, 2023
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 leonardoadame/node#143
Open
@aliscco aliscco mentioned this pull request Oct 27, 2023
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 aliscco/alisco-node#646
Open
@aliscco aliscco mentioned this pull request Nov 28, 2023
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 aliscco/alisco-node#695
Open
This was referenced Nov 29, 2023
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 leonardoadame/node#211
Open
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 leonardoadame/node#268
Open
@aliscco aliscco mentioned this pull request Dec 2, 2023
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 aliscco/alisco-node#1024
Open
@leonardoadame leonardoadame mentioned this pull request Dec 3, 2023
[Snyk] Security upgrade karma from 3.1.4 to 5.0.8 leonardoadame/node#479
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

repl Issues and PRs related to the REPL subsystem.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@thefourtheye @mscdex @ChuckLangford @Fishrock123 @jasnell @silverwind @targos
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.