grammar BaseNumbers;

number
    : numberInt
    | numberReal
    | numberHex
    ;

numberInt  : NUMBER_INT;
numberPct  : NUMBER_PCT;
numberReal : NUMBER_REAL;
numberHex  : NUMBER_HEX;

codeHex
    : CODE_HEX3     #codeHex3
    | CODE_HEX4     #codeHex4
    | CODE_HEX6     #codeHex6
    | CODE_HEX8     #codeHex8
    ;

LP   : '(' CHAR_WS*;
LB   : '[' CHAR_WS*;
LT   : '<' CHAR_WS*;
RP   : CHAR_WS* ')';
RB   : CHAR_WS* ']';
GT   : CHAR_WS* '>';

CS    : CHAR_WS* ',' CHAR_WS*;
DOT   : CHAR_WS* '.' CHAR_WS*;
WS    : CHAR_WS+;

NUMBER_INT   : DIGIT+;
NUMBER_PCT   : DIGIT+ ('.' DIGIT+)? '%';
NUMBER_REAL  : DIGIT+ '.' DIGIT+ ('e' '-'? DIGIT+)?;
NUMBER_HEX   : '0x' DIGIT_HEX+ ;
CODE_HEX8 : CHAR_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX;
CODE_HEX6 : CHAR_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX;
CODE_HEX4 : CHAR_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX;
CODE_HEX3 : CHAR_HEX DIGIT_HEX DIGIT_HEX DIGIT_HEX;


fragment CHAR_HEX : '#';
fragment DIGIT : [0-9] ;
fragment DIGIT_NZ : [1-9] ;
fragment DIGIT_Z : '0' ;
fragment DIGIT_HEX: [0-9a-fA-F] ;

fragment CHAR_WS: [ \t\r\n,?!.;]+;