#define STATE_SUB 20
#define STATE_MUL 21
#define STATE_DOT 22
-#define STATE_ZERO 23
-#define STATE_NUM 24
-#define STATE_FLT 25
+#define STATE_DOTDOT 23
+#define STATE_ZERO 24
+#define STATE_NUM 25
+#define STATE_FLT 26
#define identifier_firstchr(_c) ((_c) == '_' || \
(_c) >= 'a' && (_c) <= 'z' || \
}
case STATE_DOT:
- _putnextchar(c);
-
if(c >= '0' && c <= '9') {
+ _putnextchar(c);
+
tok = token_new_from_str(TOKEN_FLOAT_LITERAL, _line, _col, "0.");
assert(tok);
state = STATE_FLT;
+ } else if(c == '.') {
+ state = STATE_DOTDOT;
} else {
+ _putnextchar(c);
+
return(token_new_from_str(TOKEN_MEMBER, _line, _col, "."));
}
break;
+ case STATE_DOTDOT:
+ if(c == '.') {
+ return(token_new_from_str(TOKEN_DOTS, _line, _col - 2, "..."));
+ }
+
+ fprintf(stderr, "Unexpected character `%c' at %d:%d\n", c, _line, _col);
+ return(NULL);
+
case STATE_ZERO:
if(c == 'x' || c == 'X') {
token_append_char(tok, 'x');