Unicode literal to C like character literal
This commit is contained in:
@@ -24,7 +24,7 @@ main :: (): int
|
||||
assert(s64val == 0 && s32val == 0 && s16val == 0 && s8val == 0 && intval == 0 && u64val == 0 && u32val == 0 && u16val == 0 && u8val == 0 && f64val == 0 && f32val == 0)
|
||||
// @todo: Fix error here !!
|
||||
// assert(string_val[0] == 'S) //'
|
||||
assert(cstring_val[0] == 'C) //'
|
||||
assert(cstring_val[0] == 'C')
|
||||
|
||||
// This is how we can assign variables
|
||||
// There is no need for prefixes, compiler figures
|
||||
|
||||
@@ -46,24 +46,24 @@ main :: (): int
|
||||
assert(value_to_be_wrapped == 20)
|
||||
|
||||
letter := get_first_letter_of_type(value_to_be_wrapped)
|
||||
assert(letter == 'I) // '
|
||||
assert(letter == 'I')
|
||||
|
||||
get_first_letter_of_type :: (a: Any): U8
|
||||
type_info := get_type_info(a.type)
|
||||
if !type_info
|
||||
return '- // '
|
||||
return '-'
|
||||
|
||||
result: U8
|
||||
switch type_info.kind
|
||||
Type_Info_Kind.S64, Type_Info_Kind.S32, Type_Info_Kind.S16, Type_Info_Kind.S8, Type_Info_Kind.INT
|
||||
result = 'I // '
|
||||
result = 'I'
|
||||
Type_Info_Kind.U64, Type_Info_Kind.U32, Type_Info_Kind.U16, Type_Info_Kind.U8
|
||||
result = 'U // '
|
||||
result = 'U'
|
||||
Type_Info_Kind.F64
|
||||
result = 'F // '
|
||||
result = 'F'
|
||||
Type_Info_Kind.POINTER
|
||||
result = '* // '
|
||||
default;; result = '- // '
|
||||
result = '*'
|
||||
default;; result = '-'
|
||||
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user