1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-16 21:07:56 +00:00

Added support for upper case integer suffixes eg. 1234U. Closes #682

This commit is contained in:
jespergravgaard 2021-07-29 19:26:36 +02:00
parent 825a3b79a5
commit d6179a0b3c
5 changed files with 604 additions and 593 deletions

View File

@ -15265,3 +15265,13 @@ sta {c1},x
lda #{c2} lda #{c2}
ora {c1},y ora {c1},y
sta {c1},y sta {c1},y
//FRAGMENT vwuz1=vwuz2_ror_8
lda {z2}+1
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=vwuz1_ror_8
lda {z1}+1
sta {z1}
lda #0
sta {z1}+1

View File

@ -15,6 +15,7 @@ public class NumberParser {
} }
SymbolType type = SymbolType.NUMBER; SymbolType type = SymbolType.NUMBER;
literal = literal.toLowerCase();
if(literal.endsWith("ub") || literal.endsWith("uc")) { if(literal.endsWith("ub") || literal.endsWith("uc")) {
type = SymbolType.BYTE; type = SymbolType.BYTE;
literal = literal.substring(0, literal.length()-2); literal = literal.substring(0, literal.length()-2);

View File

@ -130,7 +130,7 @@ NUMFLOAT : BINFLOAT | DECFLOAT | HEXFLOAT;
BINFLOAT : ('%' | '0b' | '0B' ) (BINDIGIT)* '.' BINDIGIT+; BINFLOAT : ('%' | '0b' | '0B' ) (BINDIGIT)* '.' BINDIGIT+;
DECFLOAT : (DECDIGIT)* '.' DECDIGIT+; DECFLOAT : (DECDIGIT)* '.' DECDIGIT+;
HEXFLOAT : ('$' | '0x' | '0X' ) (HEXDIGIT)* '.' HEXDIGIT+; HEXFLOAT : ('$' | '0x' | '0X' ) (HEXDIGIT)* '.' HEXDIGIT+;
NUMINT : (DECINTEGER | HEXINTEGER | BININTEGER ) ([us][bcwisdl] | 'l' | 'u' )? ; NUMINT : (DECINTEGER | HEXINTEGER | BININTEGER ) ([usUS][bcwisdlBCWISDL] | [lL] | [uU] )? ;
BININTEGER : '0' [bB] BINDIGIT+ | '%' BINDIGIT+ ; BININTEGER : '0' [bB] BINDIGIT+ | '%' BINDIGIT+ ;
DECINTEGER : DECDIGIT+ ; DECINTEGER : DECDIGIT+ ;
HEXINTEGER : ( '$' | '0x' | '0X' ) HEXDIGIT+ ; HEXINTEGER : ( '$' | '0x' | '0X' ) HEXDIGIT+ ;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff