parse sign
This commit is contained in:
@@ -9,8 +9,9 @@ typedef enum
|
||||
ERROR_UNKNOWN_TOKEN = -1,
|
||||
ERROR_NUMBER_TOO_BIG = -2,
|
||||
ERROR_PARSING = -3,
|
||||
ERROR_TOKEN_POSITION = -4,
|
||||
} program_error;
|
||||
|
||||
int stop_errors(int err, const char *details);
|
||||
int stop_errors(program_error err, const char *details);
|
||||
|
||||
#endif
|
||||
@@ -7,13 +7,14 @@
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TOKEN_VARIABLE, // x, y, etc.
|
||||
TOKEN_NUMBER, // int or double -> all converted into double
|
||||
TOKEN_POWER, // ^ or **
|
||||
TOKEN_SIGN, // + or -
|
||||
TOKEN_FACTOR, // * or /
|
||||
TOKEN_EQUAL, // =
|
||||
TOKEN_END // null (end of input)
|
||||
TOKEN_VARIABLE, // x, y, etc.
|
||||
TOKEN_NUMBER_INT, // int
|
||||
TOKEN_NUMBER_DOUBLE, // double
|
||||
TOKEN_POWER, // ^ or **
|
||||
TOKEN_SIGN, // + or -
|
||||
TOKEN_FACTOR, // * or /
|
||||
TOKEN_EQUAL, // =
|
||||
TOKEN_END // null (end of input)
|
||||
} token_type;
|
||||
|
||||
typedef struct
|
||||
@@ -22,6 +23,7 @@ typedef struct
|
||||
union
|
||||
{
|
||||
char value_char;
|
||||
int value_int;
|
||||
double value_double;
|
||||
};
|
||||
} token;
|
||||
|
||||
Reference in New Issue
Block a user