@@ -22,6 +22,7 @@ export class Parser {
2222
2323 static operatorPrecedence : TokenType [ ] [ ] = [
2424 [ TokenType . keywordOr ] , [ TokenType . keywordAnd ] ,
25+ [ TokenType . keywordBetween ] ,
2526 [ TokenType . lower , TokenType . lowerOrEqual , TokenType . greater , TokenType . greaterOrEqual , TokenType . equal , TokenType . notEqual , TokenType . keywordLike ] ,
2627 [ TokenType . concatenation , TokenType . plus , TokenType . minus ] , [ TokenType . multiplication , TokenType . division , TokenType . modulo ] ,
2728 [ TokenType . keywordIn , TokenType . keywordNotIn ]
@@ -2096,6 +2097,10 @@ export class Parser {
20962097
20972098 let first = true ;
20982099
2100+ if ( this . tt == TokenType . keywordBetween ) {
2101+ return this . parseBetween ( left ) ;
2102+ }
2103+
20992104 while ( first || operators . indexOf ( this . tt ) >= 0 ) {
21002105
21012106 let operator : TokenType = this . tt ;
@@ -2125,6 +2130,27 @@ export class Parser {
21252130 return left ;
21262131
21272132 }
2133+
2134+ parseBetween ( left : TermNode ) : TermNode {
2135+ let position = this . getCurrentPosition ( ) ;
2136+ this . nextToken ( ) ; // skip "between"
2137+ let secondOperand = this . parseTermBinary ( 2 ) ;
2138+ if ( this . expect ( TokenType . keywordAnd , true ) ) {
2139+
2140+ let thirdOperand = this . parseTermBinary ( 2 ) ;
2141+
2142+ return {
2143+ type : TokenType . keywordBetween ,
2144+ position : position ,
2145+ firstOperand : left ,
2146+ secondOperand : secondOperand ,
2147+ thirdOperand : thirdOperand
2148+ }
2149+
2150+ }
2151+
2152+ return null ;
2153+ }
21282154
21292155
21302156 // -, not, this, super, a.b.c[][].d, a.b(), b() (== this.b()), super.b(), super()
@@ -2148,7 +2174,7 @@ export class Parser {
21482174 }
21492175 case TokenType . minus :
21502176 // case TokenType.not:
2151- position = position ;
2177+ position = this . position ;
21522178 let tt1 = this . tt ;
21532179 this . nextToken ( ) ;
21542180 term = this . parseUnary ( ) ;
@@ -2159,7 +2185,7 @@ export class Parser {
21592185 operand : term ,
21602186 operator : tt1
21612187 } ;
2162-
2188+
21632189 case TokenType . integerConstant :
21642190 case TokenType . charConstant :
21652191 case TokenType . floatingPointConstant :
0 commit comments