public int char_to_int(constant_node cn) { #if (DEBUG) if (cn.semantic_node_type != semantic_node_type.char_const_node) { throw new CompilerInternalError("Error in static type conversion"); } #endif char_const_node icn = (char_const_node)cn; return((int)icn.const_value); }
private void VisitCharConstNode(char_const_node expr) { bw.Write(expr.constant_value); }
public override void visit(SyntaxTree.char_const _char_const) { expression_node en = new char_const_node(_char_const.cconst, get_location(_char_const)); return_value(en); }
public override void visit(SyntaxTree.string_const _string_const) { expression_node en = null; if (_string_const.Value.Length != 1) { en = new string_const_node(_string_const.Value, get_location(_string_const)); if (SemanticRules.GenerateNativeCode && SemanticRules.StringType != null) en.type = SemanticRules.StringType; } else en = new char_const_node(Convert.ToChar(_string_const.Value), get_location(_string_const)); return_value(en); }