Add option to allow unbalanced quotes in line comment (lisp)#157
Open
jimwhite wants to merge 1 commit intoeraserhd:masterfrom
Open
Add option to allow unbalanced quotes in line comment (lisp)#157jimwhite wants to merge 1 commit intoeraserhd:masterfrom
jimwhite wants to merge 1 commit intoeraserhd:masterfrom
Conversation
Owner
|
This approach defeats a mechanism that's there to prevent the Parinfer algorithm from corrupting the code, and the corruption can occur in Common Lisp as well as (AFAIK) every other lisp. I'm not sure an option to disable this feature is the right thing. It may be that to safely edit files like this, you'll have to disable parinfer. In any case, the option wouldn't be language specific or have language-specific defaults. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #156
Add
--line-comment-quotes/--no-line-comment-quotesoptionSummary
Adds a new
--line-comment-quotes/--no-line-comment-quotesCLI option to control whether parinfer checks for balanced quotes inside line comments. When disabled,quote_dangerstate is reset at newlines when leaving a;line comment, since line comments are self-contained and cannot carry string state across lines.Motivation
Valid Common Lisp source files (e.g., ACL2's 28,000-line
axioms.lisp) contain many comment blocks where quoted phrases wrap across multiple;comment lines. These trigger falsequote-dangererrors, making parinfer unusable on these files.In CL,
;comments end at the newline — a"inside one is just prose text. The existingquote_dangertracking was designed for languages where comment-embedded quotes might interact with the parser, but this doesn't apply to line comments in any language.Changes
src/types.rsline_comment_quotes: boolfield toOptions(serde default:truefor backward compatibility)src/parinfer.rsline_comment_quotes_enabled: booltoStateon_newline(): when leaving a line comment andline_comment_quotes_enabledisfalse, resetquote_dangertofalsesrc/cli_options.rs--line-comment-quotes/--no-line-comment-quotesas aYesNoDefaultOptiontruefor all languages exceptlisp(which defaults tofalse)LanguageFeatures,Options, and both text and kakoune input pathsLanguage defaults
line_comment_quotestrue(unchanged)truetruetruefalsetruetruetrueThe option can always be overridden explicitly:
--line-comment-quotesforces checking on (even for-l lisp)--no-line-comment-quotesforces checking off (even for-l clojure)Testing
axioms.lisp(28,000+ lines) — processes successfully with-l lisp