Convert tables to STRINGARRAY
This commit is contained in:
@@ -2,17 +2,18 @@
|
||||
#define TOKENIZER_TABLES_H
|
||||
#include "util.h"
|
||||
|
||||
const char* keywords[] = {
|
||||
|
||||
const char* keywordsraw[] = {
|
||||
"class", "constructor", "function", "method", "field", "static",
|
||||
"var", "int", "char", "boolean", "void", "true", "false", "null",
|
||||
"this", "let", "do", "if", "else", "while", "return"
|
||||
};
|
||||
const int keywordssize = strcount(keyword);
|
||||
mkstrlist(keywords, keywordsraw);
|
||||
|
||||
const char* symbols[] = {
|
||||
const char* symbolsraw[] = {
|
||||
"{", "}", "(", ")", "[", "]", ".", ",", ";", "+", "-", "*", "/",
|
||||
"&", "|", "<", ">", "=", "~"
|
||||
};
|
||||
const int symbolssize = strcount(symbols);
|
||||
mkstrlist(symbols, symbolsraw);
|
||||
|
||||
#endif
|
||||
|
@@ -91,19 +91,13 @@ CHARTYPE getchartype(unsigned char c) {
|
||||
}
|
||||
|
||||
bool iskeyword(STRING* tk) {
|
||||
for(int i = 0; i < keywordssize; i++)
|
||||
if(!strcmp(tk->str, keywords[i]))
|
||||
return true;
|
||||
return false;
|
||||
return existsinarray(&keywords, tk->str);
|
||||
}
|
||||
|
||||
bool issymbol(STRING* tk) {
|
||||
if(tk->count != 2)
|
||||
return false;
|
||||
for(int i = 0; i < symbolssize; i++)
|
||||
if(!strcmp(tk->str, symbols[i]))
|
||||
return true;
|
||||
return false;
|
||||
return existsinarray(&symbols, tk->str);
|
||||
}
|
||||
|
||||
bool isint(char* str) {
|
||||
|
Reference in New Issue
Block a user