public PrefixExpression(Parser.LuaToken oper, Expression right) { mOperator = oper; mRight = right; StringBuilder sb = StringBuilderCache.Acquire(); print(sb); canonicalName = sb.ToStringAndRelease(); }
public DotOperatorExpression(Expression left, Parser.LuaToken oper, Expression right) { mLeft = left; mOperator = oper; mRight = right; StringBuilder sb = StringBuilderCache.Acquire(); print(sb); canonicalName = sb.ToStringAndRelease(); }
public OperatorExpression(Expression left, Parser.LuaToken oper, Expression right) { mLeft = left; mOperator = oper; mRight = right; switch (mOperator) { case Parser.LuaToken.PLUS: case Parser.LuaToken.MINUS: case Parser.LuaToken.MULTIPLY: case Parser.LuaToken.DIVIDE: returnType = typeof(double); break; case Parser.LuaToken.CONCAT: returnType = typeof(string); break; case Parser.LuaToken.LESS_THAN: case Parser.LuaToken.GREATER_THAN: case Parser.LuaToken.EQUALITY: case Parser.LuaToken.INEQUALITY: case Parser.LuaToken.LESS_EQUAL: case Parser.LuaToken.GREATER_EQUAL: case Parser.LuaToken.AND: case Parser.LuaToken.OR: returnType = typeof(bool); break; default: returnType = typeof(void); break; } StringBuilder sb = StringBuilderCache.Acquire(); print(sb); canonicalName = sb.ToStringAndRelease(); }
internal static string punctuator(this Parser.LuaToken token) { switch (token) { case Parser.LuaToken.LEFT_PAREN: return("("); case Parser.LuaToken.RIGHT_PAREN: return(")"); case Parser.LuaToken.COMMA: return(","); case Parser.LuaToken.ASSIGN: return("="); case Parser.LuaToken.PLUS: return("+"); case Parser.LuaToken.MINUS: return("-"); case Parser.LuaToken.MULTIPLY: return("*"); case Parser.LuaToken.DIVIDE: return("/"); case Parser.LuaToken.MODULO: return("%"); case Parser.LuaToken.EXPONENT: return("^"); case Parser.LuaToken.DOT: return("."); case Parser.LuaToken.CONCAT: return(".."); case Parser.LuaToken.GREATER_THAN: return(">"); case Parser.LuaToken.LESS_THAN: return("<"); case Parser.LuaToken.EQUALITY: return("=="); case Parser.LuaToken.INEQUALITY: return("~="); case Parser.LuaToken.LESS_EQUAL: return("<="); case Parser.LuaToken.GREATER_EQUAL: return(">="); case Parser.LuaToken.AND: return("and"); case Parser.LuaToken.OR: return("or"); case Parser.LuaToken.NOT: return("not"); } throw new Exception("Un-punctuable token " + token.ToString()); }