Skip to content

Add support for named parameters in method calls (param=value syntax) #298

@MrCoder

Description

@MrCoder

Feature Request

Description

Currently, the DSL does not support named parameters in method calls. We would like to add support for syntax like:

A.method(param=value)
A.method(param1=value1, param2=value2)

Current Behavior

The parser only supports positional parameters:

A.method(value1, value2)

Desired Behavior

Support both positional and named parameters:

// Named parameters
A.method(userId=123, name="John")

// Mixed (positional first, then named)
A.method(123, name="John")

// Still support existing positional syntax
A.method(123, "John")

Use Cases

  • Improved readability when method calls have many parameters
  • Self-documenting code where parameter names clarify intent
  • Better alignment with modern programming language conventions
  • Enhanced UML sequence diagram expressiveness

Implementation Notes

This would require updates to:

  • ANTLR grammar files in src/g4/
  • Parser logic in src/parser/
  • Message rendering components to display named parameters

Acceptance Criteria

  • Grammar supports param=value syntax in method calls
  • Parser correctly extracts named parameters
  • Rendered diagrams display named parameters appropriately
  • Tests cover both named and positional parameter scenarios
  • Backward compatibility with existing positional syntax

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions