Skip to content

Commit 34170bf

Browse files
authored
Merge pull request #69 from anboralabs/ternary-operator
Added ternary operator.
2 parents 14faea3 + 074e0b6 commit 34170bf

File tree

5 files changed

+38
-3
lines changed

5 files changed

+38
-3
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010
apply plugin: 'org.jetbrains.grammarkit'
1111

1212
group 'co.anbora.labs'
13-
version '2.5.6-SNAPSHOT'
13+
version '2.5.8'
1414

1515
repositories {
1616
mavenCentral()

src/main/grammar/FirebaseRules.bnf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
COMMA = ','
3535
EQ = '='
3636
DOT = '.'
37+
Q_MARK = '?'
3738
DOT_COMMA = ';'
3839
MODULO = '%'
3940
char = 'regexp:[\n\r\u2028\u2029]'
@@ -189,6 +190,7 @@ Expression ::=
189190
| LogicalEqExprItem
190191
| AddExprItem
191192
| MulExprItem
193+
| TernaryExpr
192194
| NegateExpr
193195
| AtomExpr
194196
//{ name="expr" }
@@ -198,6 +200,8 @@ NegateExpr ::= NEGATE Expression
198200
IndexExpr ::= Expression '[' (RangeExpr|Expression) ']'
199201
private RangeExpr ::= Expression ':' Expression
200202

203+
TernaryExpr ::= Expression '?' Expression ':' Expression
204+
201205

202206
IdentifierExpr ::= IDENTIFIER
203207
DotExpr ::= Expression DOT Expression

src/main/grammar/FirebaseRules.flex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ PathBuiltIn=[$][(][a-zA-Z_\-0-9]+[a-zA-Z_\.\-0-9]*[)]
113113
">" { return GT; }
114114
">=" { return GE; }
115115
"!" { return NEGATE; }
116+
"?" { return Q_MARK; }
116117

117118
"+" { return PLUS_OP; }
118119
"-" { return MINUS_OP; }

src/main/html/change-notes.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
Versions:
22
<ul>
3-
<li>All Intellij products support: 2.5.6</li>
4-
<li>Android Studio support: 2.5.7</li>
3+
<li>All Intellij products support: 2.5.8</li>
4+
<li>Android Studio support: 2.5.9</li>
55
</ul>
66
<br>
77
Plugin updates:
88
<ul>
9+
<li><b>2.5.9</b> <em>(2021-05-27)</em> - Fixed minor issues - Android version</li>
10+
<ul>
11+
<li>Added ternary operator </li>
12+
</ul>
13+
<li><b>2.5.8</b> <em>(2021-05-27)</em> - Fixed minor issues</li>
14+
<ul>
15+
<li>Added ternary operator </li>
16+
</ul>
917
<li><b>2.5.7</b> <em>(2021-05-02)</em> - Fixed minor issues - Android version</li>
1018
<ul>
1119
<li>Fixed formatting code issues </li>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
interface Functions {
2+
3+
path(String value);
4+
5+
exists(Object path);
6+
7+
existsAfter(Object path);
8+
9+
get(Object path);
10+
11+
getAfter(Object path);
12+
13+
bool(String value);
14+
15+
float(String value);
16+
17+
float(Integer value);
18+
19+
int(String value);
20+
21+
int(Integer value);
22+
}

0 commit comments

Comments
 (0)