diff --git a/lithos_c/inc/Lth_token.h b/lithos_c/inc/Lth_token.h index 2884b3d..b622b17 100644 --- a/lithos_c/inc/Lth_token.h +++ b/lithos_c/inc/Lth_token.h @@ -22,6 +22,7 @@ Lth_X(Number) Lth_X(Space ) Lth_X(String) +Lth_X(Minus ) // - Lth_X(Dot ) // . Lth_X(Equals) // = Lth_X(Semico) // ; diff --git a/lithos_c/src/token.c b/lithos_c/src/token.c index 7676bab..94eac93 100644 --- a/lithos_c/src/token.c +++ b/lithos_c/src/token.c @@ -50,6 +50,11 @@ void Lth_TokenGet(FILE *fp, Lth_Token *out) case '\n': Lth_TokenSet(out, LnEnd ); return; + case '-': + if(isdigit(Lth_fpeekc(fp))) break; + Lth_TokenSet(out, Minus); + return; + case '.': if(isdigit(Lth_fpeekc(fp))) break; Lth_TokenSet(out, Dot); @@ -75,6 +80,7 @@ void Lth_TokenGet(FILE *fp, Lth_Token *out) char beg = ch; ACS_BeginPrint(); + while((ch = fgetc(fp)) != beg && ch != EOF) { if(ch != '\\') @@ -94,7 +100,7 @@ void Lth_TokenGet(FILE *fp, Lth_Token *out) return; } - if(isdigit(ch) || ch == '.') + if(isdigit(ch) || ch == '.' || ch == '-') { ACS_BeginPrint();