[LQP Meta] Hooks for overriding constant formatting in Julia sdk#210
Merged
[LQP Meta] Hooks for overriding constant formatting in Julia sdk#210
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Keep deconstructor infrastructure (grammar.y, yacc_parser, yacc_action_parser) from this branch. Take origin/main's ParseNonterminal/PrintNonterminal split (no VisitNonterminal aliases). Add GetElement Unknown type handling to target.py. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implements an extension mechanism allowing users to customize how constants (DecimalValue, Int128Value, UInt128Value) are formatted in the pretty printer without modifying generated code. Changes: - Added abstract ConstantFormatter type and DEFAULT_CONSTANT_FORMATTER singleton - Updated PrettyPrinter to include constant_formatter field - Modified format functions to dispatch on formatter type with fallback methods - Added backward-compatible convenience methods for existing code - Updated pprint/pretty APIs to accept optional constant_formatter parameter - Exported ConstantFormatter types and format functions for user extension - Added comprehensive test suite (10 test items, 23 assertions) All 115 existing tests pass, maintaining full backward compatibility. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
# Conflicts: # meta/src/meta/templates/pretty_printer.jl.template # sdks/julia/LogicalQueryProtocol/src/LogicalQueryProtocol.jl # sdks/julia/LogicalQueryProtocol/src/pretty.jl
Extends the ConstantFormatter mechanism to allow customization of all constant types: int (Int64/Int32), float (Float64), string, and boolean, in addition to the existing decimal, int128, and uint128 support. Changes: - Added format_int, format_float, format_string, format_bool functions with formatter dispatch and default implementations - Updated codegen templates to route all constant formatting through the formatter system - Added comprehensive tests covering individual and combined type overrides - Exported new format functions for user extension All constant formatting now goes through the ConstantFormatter abstraction, enabling complete control over constant representation in the pretty printer. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds comprehensive unit tests verifying the default formatting behavior for all constant types: int, float, string, bool, decimal, int128, and uint128. Tests cover: - Positive, negative, and zero values - Edge cases (special float values, escaped characters in strings) - Two's complement representation for int128 - Hexadecimal formatting for uint128 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Restructures LogicalQueryProtocol Julia SDK to organize parser and pretty printer as separate submodules (Parser and Pretty) under the main module. Changes: - Wrapped parser.jl in Parser module, renamed Parser struct to ParserState - Wrapped pretty.jl in Pretty module - Updated templates to generate modularized code - Moved _has_proto_field/_get_oneof_field to protobuf-helpers.jl for sharing - Updated LogicalQueryProtocol.jl to include and re-export from submodules - Updated show.jl to qualify Pretty module references - Updated codegen to use ParserState type annotation - Exported Proto, parser/pretty functions, and testing helpers Users can now access: - LogicalQueryProtocol.Parser.parse or just parse (re-exported) - LogicalQueryProtocol.Pretty.pprint or just pprint (re-exported) - Direct submodule access: LogicalQueryProtocol.Parser, LogicalQueryProtocol.Pretty Tests reduced from 936 errors to 3 (indent_level, indent!, try_flat exports). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Removes all re-exports of Parser and Pretty module methods from the main LogicalQueryProtocol module. Users should access these directly from the submodules: - LogicalQueryProtocol.Parser.parse() - LogicalQueryProtocol.Pretty.pprint() - etc. Only the submodules themselves (Parser, Pretty, Proto) are now exported. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Updates test assertions to expect 'parser::ParserState' instead of 'parser::Parser' after renaming the Parser struct to ParserState to avoid module/struct name collision. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
comnik
approved these changes
Feb 20, 2026
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.
Summary
ParserandPrettysubmodules ofLogicalQueryProtocol, keeping the main module namespace cleanConstantFormatterextension mechanism to the pretty printer, allowing users to customize how constants (decimals, int128, uint128, ints, floats, strings, bools) are formatted_has_proto_field,_get_oneof_field) intoprotobuf-helpers.jlParserstruct toParserStateto avoid collision with the new module name@testsetupmodules in dedicated*_testsetup.jlfiles (ParserSetup,PrettySetup)