src: Compiler, interpreter and parser updates for UTF-8
[nit.git] / src / parser / nit.sablecc3xx
index 4a90050..592cc42 100644 (file)
@@ -203,7 +203,11 @@ number = digit+;
 hex_number = ('0x' | '0X') hexdigit+;
 bin_number = ('0b' | '0B') bindigit+;
 oct_number = ('0o' | '0O') octdigit+;
-float = digit* '.' digit+;
+bytenum = digit+ 'u8';
+hex_bytenum = ('0x' | '0X') hexdigit+ 'u8';
+bin_bytenum = ('0b' | '0B') bindigit+ 'u8';
+oct_bytenum = ('0o' | '0O') octdigit+ 'u8';
+float = digit* '.' digit+ | (digit+ | digit* '.' digit+) ('E'|'e') ('+'|'-'|) digit+;
 string = '"' str_body '"' | '"' '"' '"' long_str_body lsend1 | ''' ''' ''' long_sstr_body ''' ''' ''';
 start_string = '"' str_body '{' | '"' '"' '"' long_str_body lsend2;
 mid_string = '}' str_body '{' | '}' '}' '}' long_str_body lsend2;
@@ -640,6 +644,10 @@ expr_single~nopar~nobra {-> expr}
        | {hex_int} hex_number annotations_o {-> New expr.hex_int(hex_number, annotations_o.annotations)}
        | {bin_int} bin_number annotations_o {-> New expr.bin_int(bin_number, annotations_o.annotations)}
        | {oct_int} oct_number annotations_o {-> New expr.oct_int(oct_number, annotations_o.annotations)}
+       | {byte} bytenum annotations_o {-> New expr.dec_byte(bytenum, annotations_o.annotations)}
+       | {hex_byte} hex_bytenum annotations_o {-> New expr.hex_byte(hex_bytenum, annotations_o.annotations)}
+       | {bin_byte} bin_bytenum annotations_o {-> New expr.bin_byte(bin_bytenum, annotations_o.annotations)}
+       | {oct_byte} oct_bytenum annotations_o {-> New expr.oct_byte(oct_bytenum, annotations_o.annotations)}
        | {float} float annotations_o {-> New expr.float(float, annotations_o.annotations)}
        | {char} char annotations_o {-> New expr.char(char, annotations_o.annotations)}
        | {string} string annotations_o {-> New expr.string(string, annotations_o.annotations)}
@@ -1007,6 +1015,10 @@ expr     = {block} expr* kwend?
        | {hex_int} hex_number annotations?
        | {bin_int} bin_number annotations?
        | {oct_int} oct_number annotations?
+       | {dec_byte} bytenum annotations?
+       | {hex_byte} hex_bytenum annotations?
+       | {bin_byte} bin_bytenum annotations?
+       | {oct_byte} oct_bytenum annotations?
        | {float} float annotations?
        | {char} char annotations?
        | {string} string annotations?