Skip to content

lib: recognize <LS> and <PS> as line terminators - #67695

Open
LiviaMedeiros wants to merge 1 commit into
nodejs:mainfrom
LiviaMedeiros:lib-recognize-funny-line-terminators
Open

LiviaMedeiros wants to merge 1 commit into
nodejs:mainfrom
LiviaMedeiros:lib-recognize-funny-line-terminators

Conversation

@LiviaMedeiros

Copy link
Copy Markdown
Member

Currently, ECMAScript line terminators are \u000a, \u000d, \u2028, and \u2029. So for example

// this ensures that on prod nothing runs debug-only <LS>exposeUnprotectedRootShell();
const _DEBUG = false;

...would actually run the code after <LS> because it terminated the comment.

Let's recognize them in regexps that parse code.

Refs: https://tc39.es/ecma262/#sec-line-terminators

Signed-off-by: LiviaMedeiros <livia@cirno.name>
@LiviaMedeiros LiviaMedeiros added the lib / src Issues and PRs involving general changes in the lib/ or src/ directories. label Nov 22, 2026
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. source maps Issues and PRs related to source map support. util Issues and PRs related to the built-in util module. labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. source maps Issues and PRs related to source map support. util Issues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants