Skip to content

Conversation

@zwoop
Copy link
Contributor

@zwoop zwoop commented Oct 20, 2025

This also cleans up the maps.py Maps definitions, including moving most of the parameter values into a type class. This makes for more readable code, even though it adds a bit additional code.

@zwoop zwoop added this to the 10.2.0 milestone Oct 20, 2025
@zwoop zwoop requested review from Copilot and mlibbey October 20, 2025 17:53
@zwoop zwoop self-assigned this Oct 20, 2025
@zwoop zwoop added the hrw4u label Oct 20, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the += operator (add-header functionality) in hrw4u and refactors the table definitions to use a type-safe MapParams class instead of tuples. The changes improve code readability and maintainability while extending the language's capabilities.

Key changes:

  • Introduces += operator for adding headers to existing header values
  • Replaces tuple-based table definitions with MapParams type class for better code clarity
  • Updates grammar to support PLUSEQUAL token

Reviewed Changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/hrw4u/grammar/hrw4u.g4 Adds PLUSEQUAL token and statement rule for += operator
tools/hrw4u/src/types.py Defines new MapParams class and ADD_HEADER magic string
tools/hrw4u/src/visitor.py Implements handling for += assignments
tools/hrw4u/src/tables.py Refactors all table definitions to use MapParams instead of tuples
tools/hrw4u/src/symbols.py Updates symbol resolution logic for new MapParams structure and adds += support
tools/hrw4u/src/symbols_base.py Updates type signatures to use MapParams
tools/hrw4u/src/hrw_symbols.py Adapts reverse symbol resolution for MapParams and add-header
tools/hrw4u/src/common.py Adds ADD_OPERATION constant
tools/hrw4u/src/suggestions.py Updates suggestion logic for MapParams
tools/hrw4u/src/lsp/*.py Updates LSP features (hover, completions) for MapParams
tools/hrw4u/src/kg_visitor.py Updates knowledge graph generation for MapParams
tools/hrw4u/src/generators.py Updates reverse mapping generators for MapParams
tools/hrw4u/tests/data/hooks/remap.* Test data for += operator usage
tools/hrw4u/tests/data/ops/* Test data updates for QSA and boolean handling
doc/admin-guide/configuration/hrw4u.en.rst Documentation for += operator usage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

This also cleans up the maps.py Maps definitions, including moving
most of the parameter values into a type class. This makes for
more readable code, even though it adds a bit additional code.
@zwoop
Copy link
Contributor Author

zwoop commented Oct 20, 2025

I resolved the nitpick comments from CoPilot.

@bryancall bryancall requested a review from bneradt October 20, 2025 21:35
Copy link
Contributor

@cmcfarlen cmcfarlen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems cool

@zwoop zwoop merged commit 2919403 into apache:master Oct 22, 2025
15 checks passed
@zwoop zwoop deleted the Hrw4uAddHeader branch October 22, 2025 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants