mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-27 09:31:18 +00:00
Added support for unsigned integer suffix U eg. 1234U. Closes #682
This commit is contained in:
parent
9d2e3f299e
commit
825a3b79a5
@ -36,6 +36,9 @@ public class NumberParser {
|
||||
} else if(literal.endsWith("l")) {
|
||||
type = SymbolType.SDWORD;
|
||||
literal = literal.substring(0, literal.length()-1);
|
||||
} else if(literal.endsWith("u")) {
|
||||
type = SymbolType.WORD;
|
||||
literal = literal.substring(0, literal.length()-1);
|
||||
}
|
||||
|
||||
Long value;
|
||||
|
@ -130,7 +130,7 @@ NUMFLOAT : BINFLOAT | DECFLOAT | HEXFLOAT;
|
||||
BINFLOAT : ('%' | '0b' | '0B' ) (BINDIGIT)* '.' BINDIGIT+;
|
||||
DECFLOAT : (DECDIGIT)* '.' DECDIGIT+;
|
||||
HEXFLOAT : ('$' | '0x' | '0X' ) (HEXDIGIT)* '.' HEXDIGIT+;
|
||||
NUMINT : (DECINTEGER | HEXINTEGER | BININTEGER ) ([us][bcwisdl] | 'l')? ;
|
||||
NUMINT : (DECINTEGER | HEXINTEGER | BININTEGER ) ([us][bcwisdl] | 'l' | 'u' )? ;
|
||||
BININTEGER : '0' [bB] BINDIGIT+ | '%' BINDIGIT+ ;
|
||||
DECINTEGER : DECDIGIT+ ;
|
||||
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
@ -1,4 +1,4 @@
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.9
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.9.1
|
||||
package dk.camelot64.kickc.parser;
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import java.util.ArrayList;
|
||||
|
||||
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
|
||||
public class KickCParser extends Parser {
|
||||
static { RuntimeMetaData.checkVersion("4.9", RuntimeMetaData.VERSION); }
|
||||
static { RuntimeMetaData.checkVersion("4.9.1", RuntimeMetaData.VERSION); }
|
||||
|
||||
protected static final DFA[] _decisionToDFA;
|
||||
protected static final PredictionContextCache _sharedContextCache =
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.9
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.9.1
|
||||
package dk.camelot64.kickc.parser;
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.9
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.9.1
|
||||
package dk.camelot64.kickc.parser;
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.9
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.9.1
|
||||
package dk.camelot64.kickc.parser;
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.9
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.9.1
|
||||
package dk.camelot64.kickc.parser;
|
||||
|
||||
|
||||
|
@ -30,6 +30,7 @@ void testSimpleTypes() {
|
||||
assertType(typeid(12sd), typeid(signed dword));
|
||||
assertType(typeid(12sl), typeid(signed dword));
|
||||
assertType(typeid(12l), typeid(signed dword));
|
||||
assertType(typeid(12u), typeid(unsigned word));
|
||||
}
|
||||
|
||||
// Check that the two passed type IDs are equal.
|
||||
|
Loading…
Reference in New Issue
Block a user