private static Type GetLiteralType(IASTLiteral litNode) { switch (litNode) { case ASTNumberLiteralNode numNode: return(typeof(decimal)); case ASTStringLiteralNode strNode: return(typeof(string)); case ASTBoolLiteralNode boolNode: return(typeof(bool)); case ASTNullLiteralNode nullNode: return(typeof(void)); } return(null); }
/// <summary> /// Process concrete literal /// </summary> /// <param name="literalNode">Common literal node</param> private void BuildLiteral(IASTLiteral literalNode) { if (literalNode is ASTStringLiteralNode strNode) { BuildString(strNode); } if (literalNode is ASTNumberLiteralNode numNode) { BuildDecimal(numNode); } if (literalNode is ASTNullLiteralNode nullNode) { BuildNull(nullNode); } if (literalNode is ASTBoolLiteralNode boolNode) { BuildBoolean(boolNode); } }