Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions mdl/ast/ast_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ type QualifiedNameExpr struct {

func (e *QualifiedNameExpr) isExpression() {}

// ConstantRefExpr represents a constant reference: @Module.ConstantName
type ConstantRefExpr struct {
QualifiedName QualifiedName // The constant qualified name
}

func (e *ConstantRefExpr) isExpression() {}

// IfThenElseExpr represents an inline if-then-else expression:
// if condition then trueExpr else falseExpr
type IfThenElseExpr struct {
Expand Down
4 changes: 4 additions & 0 deletions mdl/executor/cmd_diff_mdl.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,10 @@ func (e *Executor) expressionToString(expr ast.Expression) string {
return fmt.Sprintf("[%%%s%%]", ex.Token)
case *ast.ParenExpr:
return fmt.Sprintf("(%s)", e.expressionToString(ex.Inner))
case *ast.QualifiedNameExpr:
return ex.QualifiedName.String()
case *ast.ConstantRefExpr:
return "@" + ex.QualifiedName.String()
default:
return fmt.Sprintf("%v", expr)
}
Expand Down
2 changes: 2 additions & 0 deletions mdl/executor/cmd_microflows_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ func expressionToString(expr ast.Expression) string {
case *ast.QualifiedNameExpr:
// Qualified name (association name, entity reference) - unquoted
return e.QualifiedName.String()
case *ast.ConstantRefExpr:
return "@" + e.QualifiedName.String()
case *ast.IfThenElseExpr:
cond := expressionToString(e.Condition)
thenStr := expressionToString(e.ThenExpr)
Expand Down
1 change: 1 addition & 0 deletions mdl/grammar/MDLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -3435,6 +3435,7 @@ argumentList
atomicExpression
: literal
| VARIABLE (DOT attributeName)* // $Var or $Widget.Attribute (data source ref)
| AT qualifiedName // @Module.ConstantName (constant reference)
| qualifiedName
| IDENTIFIER
| MENDIX_TOKEN
Expand Down
2 changes: 1 addition & 1 deletion mdl/grammar/parser/MDLParser.interp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mdl/grammar/parser/mdl_lexer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

749 changes: 385 additions & 364 deletions mdl/grammar/parser/mdl_parser.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mdl/grammar/parser/mdlparser_base_listener.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mdl/grammar/parser/mdlparser_listener.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions mdl/visitor/visitor_microflow_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,15 @@ func buildAtomicExpression(ctx parser.IAtomicExpressionContext) ast.Expression {
}
}

// Constant reference: @Module.ConstantName
if atomCtx.AT() != nil {
if qn := atomCtx.QualifiedName(); qn != nil {
return &ast.ConstantRefExpr{
QualifiedName: buildQualifiedName(qn),
}
}
}

// Mendix token [%TokenName%]
if token := atomCtx.MENDIX_TOKEN(); token != nil {
tokenText := token.GetText()
Expand Down
Loading