Skip to content

Syntax Parsing Exception when piping function call with Named Parameters #589

@AnthonyJPerez

Description

@AnthonyJPerez

When invoking a function and using the named parameters feature, there's a parsing issue when trying to pipe the results of the call. I was able to reproduce this in the sandbox:

With the following sandbox inputs:

{{func get_values; ret [{name:'A'},{name:'B'},{name:'C'}]; end;}}

1) Works: {{ get_values '1' '2' '3'  | array.map 'name' }}
2) Works: {{ (get_values '1' two:'2' three: '3') | array.map 'name' }}
3) Works: {{ values = get_values '1' two:'2' three: '3'; values | array.map 'name' }}

We get the following output as expected:

1) Works: ["A", "B", "C"]
2) Works: ["A", "B", "C"]
3) Works: ["A", "B", "C"]

But the following input causes a parsing exception to occur:

4) Breaks: {{ get_values '1' two:'2' three: '3' | array.map 'name' }}

The issue is that case 4) is the logical and intuitive way one would expect to be able to utilize named functions and pipe the outputs. While there are syntactic workarounds, I do believe this is an edge-case that should be handled and should not result in an error.

When running locally, I was able to observe the following exception:

System.InvalidOperationException: This template has errors. Check the <Template.HasError> and <Template.Messages> before evaluating a template. Messages:
error : Invalid token found `|`. Expecting <EOL>/end of line.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions