Token: Add TOK_Minus and fix negative numbers
parent
52d431acb9
commit
07bf122fdc
|
@ -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) // ;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue