Skip to content

Commit

Permalink
Merge pull request forcedotcom#253 from colorant/long_literal
Browse files Browse the repository at this point in the history
Add long_literal for long type data
  • Loading branch information
jtaylor-sfdc committed Jun 5, 2013
2 parents 71e3f53 + 2876b3e commit e2151a4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/antlr3/PhoenixSQL.g
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ expression_literal_bind returns [ParseNode ret]
literal returns [LiteralParseNode ret]
: s=STRING_LITERAL { ret = factory.literal(s.getText()); }
| n=int_literal { ret = n; }
| l=long_literal { ret = l; }
| d=DECIMAL {
try {
ret = factory.literal(new BigDecimal(d.getText()));
Expand Down Expand Up @@ -707,6 +708,18 @@ int_literal returns [LiteralParseNode ret]
}
;

long_literal returns [LiteralParseNode ret]
: l=LONG {
try {
String lt = l.getText();
Long v = Long.valueOf(lt.substring(0, lt.length() - 1));
ret = factory.literal(v);
} catch (NumberFormatException e) { // Shouldn't happen since we just parsed a number
throwRecognitionException(l);
}
}
;
values returns [List<ParseNode> ret]
@init{ret = new ArrayList<ParseNode>(); }
: LPAREN v = expression_literal_bind {$ret.add(v);} (COMMA v = expression_literal_bind {$ret.add(v);} )* RPAREN
Expand Down

0 comments on commit e2151a4

Please sign in to comment.