PEGJS libraries for common use cases
Defines a grammar for arithmetical expressions and operations, identifiers, functions and literal types.
Expression
Identifier
Function
Literal
(NullLiteral
/ArrayLiteral
/ObjectLiteral
/NumberLiteral
/StringLiteral
/BooleanLiteral
)
Precedence | Operator | Associativity | Description |
---|---|---|---|
0 | (…) | ... | Grouping |
1 | ! … | left-to-right | Logical NOT |
2 | ~ … | left-to-right | Bitwise NOT |
3 | + … | left-to-right | Unary Plus |
4 | - … | left-to-right | Unary Negation |
5 | … ** … | right-to-left | Exponentiation |
6 | … * … … / … … % … |
right-to-left | Multiplication Division Remainder |
7 | … + … … - … |
right-to-left | Addition Subtraction |
8 | … << … … >> … … >>> … |
right-to-left | Bitwise Left Shift Bitwise Right Shift Bitwise Unsigned Right Shift |
9 | … < … … <= … … > … … >= … |
right-to-left | Less Than Less Than Or Equal Greater Than Greater Than Or Equal |
10 | … == … … != … … === … … !== … |
right-to-left | Equality Inequality Strict Equality Strict Inequality |
11 | … & … | right-to-left | Bitwise AND |
12 | … ^ … | right-to-left | Bitwise XOR |
13 | … | … | right-to-left | Bitwise OR |
14 | … && … | right-to-left | Logical AND |
15 | … || … | right-to-left | Logical OR |
16 | … ? … : … … ?: … |
left-to-right | Conditional Ternary Conditional Elvis |
Defines a grammar for parsing code types with the following format: String{multiline: false} | Map<String, List<Boolean>>
UnionType
SingleType
SingleTypeTemplate
Defines a grammar for parsing simple postgrest queries with an excel-like format: OR(lastname = "Doe", NOT(firstname = "John"))
Postgrest
Defines a grammar for several unicode handy ranges (Not made to be accurate.)
__
(UnicodeWhitespace*
)UnicodeWhitespace
UnicodeLatinLetter
UnicodeLineTerminator
UnicodeLineTerminatorSequence