scriban / scriban

A fast, powerful, safe and lightweight scripting language and engine for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boolean operator between two function calls

barclayadam opened this issue · comments

A parsing issue (I think) happens if you use a boolean operator (i.e .||) between two function calls:

string.starts_with_ignore_case Var1 'def' || string.equals_ignore_case Var1 'abc'

During evaluation an error is thrown:

Argument index must be < 2 (Parameter 'index')

A debug session shows that the ScriptFunctionCall node believes it has 4 arguments:

image

Like my other issue, #516, I'm sure this would be a parsing issue but I'm not sure where to start tackling the parsing changes to create the PRs necessary to fix the issues

It's not a parsing bug but by design. When you have a call a b || c, it translates to a(b||c). If you need the other way around, you need to add parenthesis (a b) || c. Similarly a b + c is a(b+c).