Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

Expr

Expr is a handy expression parser.

Expr is released under the Apache License 2.0.

Expr is deployed to Maven Central with GAV io.mfj:expr.

The grammar:

* Expression :      Term ( Conjunction Term )*
* Term :            Statement | Not | Parens
* Parens :          '(' Expression ')'
* Not :             'not' Whitespace* '(' Expression ')'
* Statement :       Value Operator Value ( Operator Value )?
* Value :           VariableName | LiteralValue
* Conjunction :     Whitespace+ ( 'and' | 'or' ) Whitespace+
* Operator :        '!=' | '<>' | '>=' | '<=' | '>' | '<' | '=~' | '='
* Whitespace :      ' ' | '\t' | '\n'
* LiteralValue :    Integer | Decimal | String | Regex | Boolean | Date | Time | DateTime
* String :          '"' TextOrEmpty{" escaped by \} '"'
* Regex :           '/' TextOrEmpty{/ escaped by \} '/'
* Number :          '-'? Digit+ ( '.' Digit+ )?
* Boolean :         'true' | 'false'
* Date :            "d'" ISO_8601_Date "'"
* Time :            "t'" ISO_8601_Time "'"
* DateTime :        "dt'" ISO_8601_DateTime "'"
* VariableName :    /[a-zA-Z_][a-zA-Z0-9_]*/

What is up with the optional part of Statement?

1 < myVar <= 6 is valid. It means 1 < myVar and myVar <= 6.

It is awesome.

Variable types

  • STRING - kotlin.String
  • Regex - kotlin.text.Regex
  • Number - java.math.BigDecimal
  • Date - java.time.LocalDate
  • Time - java.time.LocalTime
  • DateTime - java.time.LocalDateTime
  • Boolean - kotlin.Boolean

Versioning

Expr's version is of the format major.minor.build.

The major number is incremented for breaking changes or major new features.

The minor number is incremented for minor new features.

The build number is generated by Measures for Justice's private CI tool. It is incremented for each build, regardless of the major and minor numbers (it does not reset to zero when minor or major numbers are increased).

About

Expr is a handy expression parser

Resources

License

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages