[PR #1022] [MERGED] Remove stacking of block comments #856

Closed
opened 2025-12-30 01:27:13 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/1022
Author: @stackoverflow
Created: 3/12/2025
Status: Merged
Merged: 3/12/2025
Merged by: @stackoverflow

Base: mainHead: fix-comment-stacking


📝 Commits (1)

  • 5a22d73 remove stacking of block comments

📊 Changes

2 files changed (+6 additions, -7 deletions)

View changed files

📝 pkl-core/src/main/java/org/pkl/core/parser/Lexer.java (+5 -5)
📝 pkl-core/src/test/files/LanguageSnippetTests/input/basic/comments.pkl (+1 -2)

📄 Description

Our old parser allowed block comment stacking, but it also allowed the user to not close the block comments properly:

/* /* */ foo = 1

This can lead to a massive backtracking in the lexer, so we decided to remove this feature. Block comments don't stack anymore, so this previously valid Pkl code is not valid anymore:

/* top /* nested */ top */ foo = 1

This is breaking change, but it's pretty easy to fix. Also our editor parsers (IntelliJ, tree-sitter, textMate) don't allow stacking.

Fixes #1014


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/apple/pkl/pull/1022 **Author:** [@stackoverflow](https://github.com/stackoverflow) **Created:** 3/12/2025 **Status:** ✅ Merged **Merged:** 3/12/2025 **Merged by:** [@stackoverflow](https://github.com/stackoverflow) **Base:** `main` ← **Head:** `fix-comment-stacking` --- ### 📝 Commits (1) - [`5a22d73`](https://github.com/apple/pkl/commit/5a22d7339e45047dac443eabb37b244fa40ea373) remove stacking of block comments ### 📊 Changes **2 files changed** (+6 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `pkl-core/src/main/java/org/pkl/core/parser/Lexer.java` (+5 -5) 📝 `pkl-core/src/test/files/LanguageSnippetTests/input/basic/comments.pkl` (+1 -2) </details> ### 📄 Description Our old parser allowed block comment stacking, but it also allowed the user to not close the block comments properly: ```pkl /* /* */ foo = 1 ``` This can lead to a massive backtracking in the lexer, so we decided to remove this feature. Block comments don't stack anymore, so this previously valid Pkl code is not valid anymore: ```pkl /* top /* nested */ top */ foo = 1 ``` This is breaking change, but it's pretty easy to fix. Also our editor parsers (IntelliJ, tree-sitter, textMate) don't allow stacking. Fixes #1014 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 01:27:13 +01:00
adam closed this issue 2025-12-30 01:27:13 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#856