parseh defines can reference other defines

This commit is contained in:
Andrew Kelley
2016-01-29 02:17:51 -07:00
parent c1691afdd9
commit a94ad9e89c
4 changed files with 95 additions and 18 deletions

View File

@@ -97,6 +97,22 @@
ALPHA: \
case '_'
const char * zig_keywords[] = {
"true", "false", "null", "fn", "return", "var", "const", "extern",
"pub", "export", "import", "c_import", "if", "else", "goto", "asm",
"volatile", "struct", "enum", "while", "for", "continue", "break",
"null", "noalias", "switch", "undefined", "error"
};
bool is_zig_keyword(Buf *buf) {
for (int i = 0; i < array_length(zig_keywords); i += 1) {
if (buf_eql_str(buf, zig_keywords[i])) {
return true;
}
}
return false;
}
enum TokenizeState {
TokenizeStateStart,
TokenizeStateSymbol,