From: Mike D. Lowis Date: Fri, 15 Mar 2013 17:45:48 +0000 (-0400) Subject: Added common folder with tokens.h header for use by lexer and parser X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=57318f0e3cee1a67bca5c23db9b7c10861dcf731;p=proto%2Fsclpl.git Added common folder with tokens.h header for use by lexer and parser --- diff --git a/premake4.lua b/premake4.lua index 7ab8603..5bd8aca 100644 --- a/premake4.lua +++ b/premake4.lua @@ -30,8 +30,15 @@ project "sclpl-lex" kind "ConsoleApp" language "C" location "build" - includedirs { "source/lexer/**", "source/runtime/**" } - files { "source/lexer/**.*", "source/runtime/collector/**.*"} + includedirs { + "source/lexer/**", + "source/common/", + "source/runtime/**" + } + files { + "source/lexer/**.*", + "source/runtime/collector/**.*" + } project "sclpl-lex-tests" kind "ConsoleApp" diff --git a/source/common/tokens.h b/source/common/tokens.h new file mode 100644 index 0000000..fb28466 --- /dev/null +++ b/source/common/tokens.h @@ -0,0 +1,25 @@ +/** + @file tokens.h + @brief TODO: Describe this file + $Revision$ + $HeadURL$ +*/ +#ifndef TOKENS_H +#define TOKENS_H + +typedef enum { + TOK_EOF = 0, + TOK_ID = 1, + TOK_NUM = 2, + TOK_LPAR = 3, + TOK_RPAR = 4, + TOK_LBRACK = 5, + TOK_RBRACK = 6, + TOK_LBRACE = 7, + TOK_RBRACE = 8, + TOK_TERM = 9, + TOK_BOOL = 10, + TOK_MAX = 11, +} tok_type_t; + +#endif /* TOKENS_H */ diff --git a/source/lexer/lex.h b/source/lexer/lex.h index 62d8977..8598165 100644 --- a/source/lexer/lex.h +++ b/source/lexer/lex.h @@ -9,21 +9,7 @@ #include "tok.h" #include "classes.h" - -typedef enum { - TOK_EOF = 0, - TOK_ID = 1, - TOK_NUM = 2, - TOK_LPAR = 3, - TOK_RPAR = 4, - TOK_LBRACK = 5, - TOK_RBRACK = 6, - TOK_LBRACE = 7, - TOK_RBRACE = 8, - TOK_TERM = 9, - TOK_BOOL = 10, - TOK_MAX = 11, -} lex_tok_t; +#include "tokens.h" typedef struct { const char* p_text; diff --git a/source/lexer/tok.h b/source/lexer/tok.h index 2860301..c6521f0 100644 --- a/source/lexer/tok.h +++ b/source/lexer/tok.h @@ -7,8 +7,6 @@ #ifndef TOK_H #define TOK_H -typedef int tok_type_t; - typedef struct { int line;