|
| 1 | +{ |
| 2 | + parserClass="fr.adrienbrault.idea.symfony2plugin.expressionLanguage.ExpressionLanguageParser" |
| 3 | + |
| 4 | + extends="com.intellij.extapi.psi.ASTWrapperPsiElement" |
| 5 | + |
| 6 | + psiClassPrefix="ExpressionLanguage" |
| 7 | + psiImplClassSuffix="Impl" |
| 8 | + psiPackage="fr.adrienbrault.idea.symfony2plugin.expressionLanguage.psi" |
| 9 | + psiImplPackage="fr.adrienbrault.idea.symfony2plugin.expressionLanguage.psi.impl" |
| 10 | + |
| 11 | + elementTypeHolderClass="fr.adrienbrault.idea.symfony2plugin.expressionLanguage.psi.ExpressionLanguageTypes" |
| 12 | + elementTypeClass="fr.adrienbrault.idea.symfony2plugin.expressionLanguage.psi.ExpressionLanguageElementType" |
| 13 | + tokenTypeClass="fr.adrienbrault.idea.symfony2plugin.expressionLanguage.psi.ExpressionLanguageTokenType" |
| 14 | + |
| 15 | + extends(".*expr")=expr |
| 16 | + tokens=[ |
| 17 | + space='regexp:\s+' |
| 18 | + number='regexp:\d+(\.\d*)?' |
| 19 | + null="regexp:NULL|null" |
| 20 | + true="regexp:TRUE|true" |
| 21 | + false="regexp:FALSE|false" |
| 22 | + id='regexp:\p{Alpha}\w*' |
| 23 | + string="regexp:('([^'\\]|\\.)*'|\"([^\"\\]|\\.)*\")" |
| 24 | + OP_OR="regexp:or|\|\|" |
| 25 | + OP_AND="regexp:and|&&" |
| 26 | + OP_BIT_OR="|" |
| 27 | + OP_BIT_XOR="^" |
| 28 | + OP_BIT_AND="&" |
| 29 | + OP_IDENTICAL="===" |
| 30 | + OP_EQ="==" |
| 31 | + OP_NOT_IDENTICAL="!==" |
| 32 | + OP_NEQ="!=" |
| 33 | + OP_LT="<" |
| 34 | + OP_GT=">" |
| 35 | + OP_GTE=">=" |
| 36 | + OP_LTE="<=" |
| 37 | + OP_NOT_IN="not in" |
| 38 | + OP_IN="in" |
| 39 | + OP_MATCHES="matches" |
| 40 | + OP_RANGE=".." |
| 41 | + OP_PLUS="+" |
| 42 | + OP_MINUS="-" |
| 43 | + OP_CONCAT="~" |
| 44 | + OP_MUL="*" |
| 45 | + OP_DIV="/" |
| 46 | + OP_MOD="%" |
| 47 | + OP_POW="**" |
| 48 | + OP_NOT='regexp:not|\!' |
| 49 | + |
| 50 | + L_ROUND_BRACKET="(" |
| 51 | + R_ROUND_BRACKET=")" |
| 52 | + L_CURLY_BRACKET="{" |
| 53 | + R_CURLY_BRACKET="}" |
| 54 | + L_SQUARE_BRACKET="[" |
| 55 | + R_SQUARE_BRACKET="]" |
| 56 | + |
| 57 | + syntax='regexp:[?:.,]' |
| 58 | + ] |
| 59 | +} |
| 60 | + |
| 61 | +root ::= expr |
| 62 | + |
| 63 | +expr ::= ternary_group |
| 64 | + | or_expr |
| 65 | + | and_expr |
| 66 | + | bit_or_expr |
| 67 | + | bit_xor_expr |
| 68 | + | bit_and_expr |
| 69 | + | rel_group |
| 70 | + | range_expr |
| 71 | + | add_group |
| 72 | + | concat_expr |
| 73 | + | mul_group |
| 74 | + | not_expr |
| 75 | + | exp_expr |
| 76 | + | sign_group |
| 77 | + | qualification_expr |
| 78 | + | array_access_expr |
| 79 | + | primary_group |
| 80 | + |
| 81 | +private sign_group ::= unary_plus_expr | unary_min_expr |
| 82 | +private mul_group ::= mul_expr | div_expr | mod_expr |
| 83 | +private add_group ::= plus_expr | minus_expr |
| 84 | +private ternary_group ::= ternary_expr | elvis_expr |
| 85 | + |
| 86 | +private rel_group ::= eq_strict_expr |
| 87 | + | eq_expr |
| 88 | + | neq_strict_expr |
| 89 | + | neq_expr |
| 90 | + | gte_expr |
| 91 | + | gt_expr |
| 92 | + | lt_expr |
| 93 | + | lte_expr |
| 94 | + | not_in_expr |
| 95 | + | in_expr |
| 96 | + | matches_expr |
| 97 | + |
| 98 | +private primary_group ::= simple_ref_expr | literal_expr | array_expr | hash_expr | call_expr | paren_expr |
| 99 | + |
| 100 | +not_expr ::= OP_NOT expr |
| 101 | +unary_min_expr ::= OP_MINUS expr |
| 102 | +unary_plus_expr ::= OP_PLUS expr |
| 103 | +div_expr ::= expr OP_DIV expr |
| 104 | +mul_expr ::= expr OP_MUL expr |
| 105 | +mod_expr ::= expr OP_MOD expr |
| 106 | +concat_expr ::= expr OP_CONCAT expr |
| 107 | +minus_expr ::= expr OP_MINUS expr |
| 108 | +plus_expr ::= expr OP_PLUS expr |
| 109 | +range_expr ::= expr OP_RANGE expr |
| 110 | +eq_strict_expr ::= expr OP_IDENTICAL expr |
| 111 | +neq_strict_expr ::= expr OP_NOT_IDENTICAL expr |
| 112 | +eq_expr ::= expr OP_EQ expr |
| 113 | +neq_expr ::= expr OP_NEQ expr |
| 114 | +gt_expr ::= expr OP_GT expr |
| 115 | +gte_expr ::= expr OP_GTE expr |
| 116 | +lt_expr ::= expr OP_LT expr |
| 117 | +lte_expr ::= expr OP_LTE expr |
| 118 | +not_in_expr ::= expr OP_NOT_IN expr |
| 119 | +in_expr ::= expr OP_IN expr |
| 120 | +matches_expr ::= expr OP_MATCHES expr |
| 121 | +or_expr ::= expr OP_OR expr |
| 122 | +and_expr ::= expr OP_AND expr |
| 123 | +bit_and_expr ::= expr OP_BIT_AND expr |
| 124 | +bit_or_expr ::= expr OP_BIT_OR expr |
| 125 | +bit_xor_expr ::= expr OP_BIT_XOR expr |
| 126 | +exp_expr ::= expr (OP_POW expr)+ |
| 127 | +paren_expr ::= L_ROUND_BRACKET expr R_ROUND_BRACKET |
| 128 | +ternary_expr ::= expr '?' expr (':' expr)? |
| 129 | +elvis_expr ::= expr '?:' expr |
| 130 | + |
| 131 | +fake ref_expr ::= expr? '.' identifier |
| 132 | +simple_ref_expr ::= identifier {extends=ref_expr elementType=ref_expr} |
| 133 | +qualification_expr ::= expr '.' identifier {extends=ref_expr elementType=ref_expr} |
| 134 | +array_access_expr ::= expr L_SQUARE_BRACKET expr R_SQUARE_BRACKET {extends=ref_expr elementType=ref_expr} |
| 135 | + |
| 136 | +literal_expr ::= number | string | true | false | null |
| 137 | +array_expr ::= L_SQUARE_BRACKET expr_list? R_SQUARE_BRACKET |
| 138 | +hash_expr ::= L_CURLY_BRACKET hash_entries? R_CURLY_BRACKET |
| 139 | + |
| 140 | +call_expr ::= expr L_ROUND_BRACKET expr_list? R_ROUND_BRACKET |
| 141 | + |
| 142 | +private hash_entries ::= hash_entry (',' hash_entry)* |
| 143 | +private hash_entry ::= identifier ':' expr |
| 144 | +private expr_list ::= expr (',' expr_list)* |
| 145 | + |
| 146 | +identifier ::= id |
0 commit comments