parinfer/implementation.lisp
Return true when text has no paren balance problem this pass can repair.
Return the indentation-driven repair candidate for text.
Open forms close when indentation decreases or at EOF. Unmatched closing parentheses are dropped. Parentheses in strings, line comments, and character literals and block comments are ignored. This is the speculative Parinfer candidate, not necessarily a safe edit.
Analyze text and return an indent-mode-report.
The report separates source balance from the indentation-driven candidate so callers can surface reader-balanced indentation conflicts without treating them as safe rewrites.
Repair text only when it has a validated paren-balance problem.
Balanced source is returned unchanged, even when indentation suggests a
different tree. Use analyze-indent-mode or indent-mode-candidate to inspect
those suspicious-but-balanced cases.
Logical disjunction of tests and raw truth values.
Logical negation of one test or raw truth value.
Logical conjunction of tests and raw truth values.
One named verb over a session.
(text)(text)Test whether two compatible scalars are equal.
(line)(characters)(state)(character)(state character)(parent child-index)Test whether one compatible scalar is at least another.
(role open-column)The maximum of compatible quantities.
(parent open-column line-number)(form indentation)(line)Test whether one compatible scalar is at most another.
Test whether one compatible scalar is less than another.
(state indentation)Test whether one compatible scalar is greater than another.
(processed-lines count)(events count)The minimum of compatible quantities.
(state processed-lines pending-events indentation previous-indentation)(line state &optional (line-number 0))(state processed-lines)(text)Return the indentation-driven repair candidate for TEXT. Open forms close when indentation decreases or at EOF. Unmatched closing parentheses are dropped. Parentheses in strings, line comments, and character literals and block comments are ignored. This is the speculative Parinfer candidate, not necessarily a safe…
(text)Analyze TEXT and return an INDENT-MODE-REPORT. The report separates source balance from the indentation-driven candidate so callers can surface reader-balanced indentation conflicts without treating them as safe rewrites.
(text)Repair TEXT only when it has a validated paren-balance problem. Balanced source is returned unchanged, even when indentation suggests a different tree. Use ANALYZE-INDENT-MODE or INDENT-MODE-CANDIDATE to inspect those suspicious-but-balanced cases.
A minimal Parinfer-like indentation repair pass.
Adapted from cl-mcp/src/parinfer.lisp: https://github.com/cl-ai-project/cl-mcp
Copyright 2025 cxxxr, Satoshi Imai
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
orIMPLIED, INCLUDING BUTnotLIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSEandNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORSorCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGESorOTHER LIABILITY, WHETHER IN ANactionOF CONTRACT, TORTorOTHERWISE, ARISING FROM, OUT OForIN CONNECTION WITH THE SOFTWAREorTHE USEorOTHER DEALINGS IN THE SOFTWARE.