def insert_constant(self, cname, ctype):
index = self.lookup_symbol(cname, stype=ctype)<EOL>if index == None:<EOL><INDENT>num = int(cname)<EOL>if ctype == SharedData.TYPES.INT:<EOL><INDENT>if (num < SharedData.MIN_INT) or (num > SharedData.MAX_INT):<EOL><INDENT>raise SemanticException("<STR_LIT>" % cname)<EOL><DEDENT><DEDENT>elif ctype == SharedData.TYPES.UNSIGNED:<EOL><INDENT>if (num < <NUM_LIT:0>) or (num > SharedData.MAX_UNSIGNED):<EOL><INDENT>raise SemanticException("<STR_LIT>" % cname)<EOL><DEDENT><DEDENT>index = self.insert_symbol(cname, SharedData.KINDS.CONSTANT, ctype)<EOL><DEDENT>return index<EOL>
Inserts a constant (or returns index if the constant already exists)
           Additionally, checks for range.