Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What kind of expression is allowed in script expressions? #113

Open
frmichel opened this issue Aug 21, 2015 · 5 comments
Open

What kind of expression is allowed in script expressions? #113

frmichel opened this issue Aug 21, 2015 · 5 comments

Comments

@frmichel
Copy link

Hi guys,

First of all, thx for sharing this project that I found very useful.

I have a question regarding script expressions. I'm referring to Stefan Goessner's page:

  • ?() : applies a filter (script) expression => what kind of script is it, JavaScript where any occurrence of "this" would be replaced with "@"? Is any JavaScript expression allowed here or is there any restriction?
  • () : script expression, using the underlying script engine => what is the underlying script engine that you have included in your implementation? Same question: if this is JavaScript where any occurrence of "this" would be replaced with "@"? Is any JavaScript expression allowed here? Any restriction?

Thanks in advance!
Franck.

@kallestenflo
Copy link
Contributor

There is no underlying script engine. The filter is parsed and evaluated in java. The implementation is very limited.

@frmichel
Copy link
Author

Hi there,

Thx for your reply and sorry for my late reply in turn.

"The filter is parsed and evaluated in java"

The filter is parsed, meaning parsed as which language? What is the kind of expression that you expect here?

"this implementation very limited"

Ok I get that, however what is it more precisely: how would I know what kind of expression is allowed and what is not?
There may be a lack of documentation there.

Thanks again,
Franck.

@kallestenflo
Copy link
Contributor

In version 2.0 basic comparison operators are supported

==
!= 
>
>=
<
<=
=~ (regexp)

&& 
||

you can not use parenthesis to control evaluation like ((@.a == 1 && @.b == 2) || @.c == true)

@frmichel
Copy link
Author

Hi,

Thx Kallestenflo, good to have a clear idea of the capabilities.

It would probably be a good idea to document this in the README of the project.

Cheers,
Franck.

@frmichel
Copy link
Author

Another one: the operators you mention work for the filters [?(...)] where the expression evaluates to a boolean.

What about calculated index [(...)] : can you do any calculation with field names, @.length, etc. ?

Franck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants