private IExpression ComparisionExpression()
{
IExpression temp;
for (var fst = BitOrExpression(null, null);;)
{
switch (lexer.Token())
{
case MySqlToken.KwNot:
{
lexer.NextToken();
switch (lexer.Token())
{
case MySqlToken.KwBetween:
{
lexer.NextToken();
var snd = ComparisionExpression();
Match(MySqlToken.KwAnd);
var trd = ComparisionExpression();
return new BetweenAndExpression(true, fst, snd, trd).SetCacheEvalRst(cacheEvalRst);
}
case MySqlToken.KwRlike:
case MySqlToken.KwRegexp:
{
lexer.NextToken();
temp = BitOrExpression(null, null);
fst = new RegexpExpression(true, fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.KwLike:
{
lexer.NextToken();
temp = BitOrExpression(null, null);
IExpression escape = null;
if (EqualsIdentifier("ESCAPE") >= 0)
{
lexer.NextToken();
escape = BitOrExpression(null, null);
}
fst = new LikeExpression(true, fst, temp, escape).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.KwIn:
{
if (lexer.NextToken() != MySqlToken.PuncLeftParen)
{
lexer.AddCacheToke(MySqlToken.KwIn);
return fst;
}
var @in = RightOprandOfIn();
fst = new InExpression(true, fst, @in).SetCacheEvalRst(cacheEvalRst);
continue;
}
default:
{
throw Err("unexpect token after NOT: " + lexer.Token());
}
}
//goto case MySqlToken.KwBetween;
}
case MySqlToken.KwBetween:
{
lexer.NextToken();
var snd_1 = ComparisionExpression();
Match(MySqlToken.KwAnd);
var trd_1 = ComparisionExpression();
return new BetweenAndExpression(false, fst, snd_1, trd_1).SetCacheEvalRst(cacheEvalRst);
}
case MySqlToken.KwRlike:
case MySqlToken.KwRegexp:
{
lexer.NextToken();
temp = BitOrExpression(null, null);
fst = new RegexpExpression(false, fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.KwLike:
{
lexer.NextToken();
temp = BitOrExpression(null, null);
IExpression escape_1 = null;
if (EqualsIdentifier("ESCAPE") >= 0)
{
lexer.NextToken();
escape_1 = BitOrExpression(null, null);
}
fst = new LikeExpression(false, fst, temp, escape_1).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.KwIn:
{
if (lexer.NextToken() != MySqlToken.PuncLeftParen)
{
lexer.AddCacheToke(MySqlToken.KwIn);
return fst;
}
temp = RightOprandOfIn();
fst = new InExpression(false, fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.KwIs:
{
switch (lexer.NextToken())
{
case MySqlToken.KwNot:
{
switch (lexer.NextToken())
{
case MySqlToken.LiteralNull:
{
lexer.NextToken();
fst =
new ComparisionIsExpression(fst, ComparisionIsExpression.IsNotNull)
.SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.LiteralBoolFalse:
{
lexer.NextToken();
fst =
new ComparisionIsExpression(fst, ComparisionIsExpression.IsNotFalse)
.SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.LiteralBoolTrue:
{
lexer.NextToken();
fst =
new ComparisionIsExpression(fst, ComparisionIsExpression.IsNotTrue)
.SetCacheEvalRst(cacheEvalRst);
continue;
}
default:
{
MatchIdentifier("UNKNOWN");
fst =
new ComparisionIsExpression(fst, ComparisionIsExpression.IsNotUnknown)
.SetCacheEvalRst(cacheEvalRst);
continue;
}
}
//goto case MySqlToken.LiteralNull;
}
case MySqlToken.LiteralNull:
{
lexer.NextToken();
fst =
new ComparisionIsExpression(fst, ComparisionIsExpression.IsNull).SetCacheEvalRst(
cacheEvalRst);
continue;
}
case MySqlToken.LiteralBoolFalse:
{
lexer.NextToken();
fst =
new ComparisionIsExpression(fst, ComparisionIsExpression.IsFalse).SetCacheEvalRst(
cacheEvalRst);
continue;
}
case MySqlToken.LiteralBoolTrue:
{
lexer.NextToken();
fst =
new ComparisionIsExpression(fst, ComparisionIsExpression.IsTrue).SetCacheEvalRst(
cacheEvalRst);
continue;
}
default:
{
MatchIdentifier("UNKNOWN");
fst =
new ComparisionIsExpression(fst, ComparisionIsExpression.IsUnknown).SetCacheEvalRst(
cacheEvalRst);
continue;
}
}
//goto case MySqlToken.OpEquals;
}
case MySqlToken.OpEquals:
{
lexer.NextToken();
temp = AnyAllExpression();
fst = new ComparisionEqualsExpression(fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.OpNullSafeEquals:
{
lexer.NextToken();
temp = BitOrExpression(null, null);
fst = new ComparisionNullSafeEqualsExpression(fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.OpGreaterOrEquals:
{
lexer.NextToken();
temp = AnyAllExpression();
fst = new ComparisionGreaterThanOrEqualsExpression(fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.OpGreaterThan:
{
lexer.NextToken();
temp = AnyAllExpression();
fst = new ComparisionGreaterThanExpression(fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.OpLessOrEquals:
{
lexer.NextToken();
temp = AnyAllExpression();
fst = new ComparisionLessThanOrEqualsExpression(fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.OpLessThan:
{
lexer.NextToken();
temp = AnyAllExpression();
fst = new ComparisionLessThanExpression(fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.OpLessOrGreater:
{
lexer.NextToken();
temp = AnyAllExpression();
fst = new ComparisionLessOrGreaterThanExpression(fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
case MySqlToken.OpNotEquals:
{
lexer.NextToken();
temp = AnyAllExpression();
fst = new ComparisionNotEqualsExpression(fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
default:
{
if (EqualsIdentifier("SOUNDS") >= 0)
{
lexer.NextToken();
Match(MySqlToken.KwLike);
temp = BitOrExpression(null, null);
fst = new SoundsLikeExpression(fst, temp).SetCacheEvalRst(cacheEvalRst);
continue;
}
return fst;
}
}
}
}