- Added string strip methods lstrip and rstrip
- Fixed the tokenizer to chomp whitespace from left and right of tokens - Fixed the tokenizer so it returns reserved symbols not just constants and expressions - Added some tests for the basic tokenizer and parser - Started working on structures to allow the basic interpreter to store lines in memory
This commit is contained in:
18
src/basic.h
18
src/basic.h
@@ -30,7 +30,7 @@
|
||||
#define BASIC_ERR_INTERNAL_UNIMPLEMENTED 9
|
||||
#define BASIC_ERR_MATH_DBZ 10
|
||||
|
||||
#define BASIC_TOKENIZER_TOKENS " +-/%*="
|
||||
#define BASIC_TOKENIZER_TOKENS "+-/%*="
|
||||
#define BASIC_TOKENIZER_MAX_LENGTH 512
|
||||
#define BASIC_VARNAME_MAX_LENGTH 16
|
||||
|
||||
@@ -67,11 +67,25 @@ struct basic_variable {
|
||||
};
|
||||
typedef struct basic_variable basic_variable;
|
||||
|
||||
struct basic_line {
|
||||
int lineno;
|
||||
char content[256];
|
||||
struct basic_line *nextline;
|
||||
};
|
||||
typedef struct basic_line basic_line;
|
||||
|
||||
struct basic_program {
|
||||
char name[128];
|
||||
basic_line *first;
|
||||
};
|
||||
typedef struct basic_program basic_program;
|
||||
|
||||
#define BASIC_CONST_TRUE 1
|
||||
#define BASIC_CONST_FALSE 0
|
||||
|
||||
extern int basic_errno;
|
||||
|
||||
void basic_repl(void);
|
||||
void basic_repl(basic_program *program);
|
||||
basic_expr *basic_parse_expr(char *);
|
||||
|
||||
#endif /* _BASIC_H_ */
|
||||
|
||||
Reference in New Issue
Block a user