diff options
-rw-r--r--[-rwxr-xr-x] | Makefile | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | README.md | 0 | ||||
-rw-r--r-- | src/include/token.h | 3 | ||||
-rw-r--r--[-rwxr-xr-x] | src/lexer.c | 11 | ||||
-rw-r--r--[-rwxr-xr-x] | src/main.c | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | src/token.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/tree.c | 0 |
7 files changed, 12 insertions, 4 deletions
diff --git a/README.md b/README.md index d5e0381..d5e0381 100755..100644 --- a/README.md +++ b/README.md diff --git a/src/include/token.h b/src/include/token.h index 9bfc4f3..709051a 100644 --- a/src/include/token.h +++ b/src/include/token.h @@ -12,8 +12,9 @@ typedef struct TOKEN_STRUC { TOKEN_LBRAK, // '[' TOKEN_RBRAK, // ']' TOKEN_POUND, // '#'' - TOKEN_tILDE, // '~' + TOKEN_TILDE, // '~' TOKEN_QUOTE, // ''' + TOKEN_COMM, // '[comment]' TOKEN_EOF // '\0' } type; diff --git a/src/lexer.c b/src/lexer.c index 3d9f538..db1d994 100755..100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -85,10 +85,17 @@ token_t* lexer_get_next_token(lexer_t* lexer) { case '~': return lexer_next_token( lexer, token_init( - TOKEN_tILDE, + TOKEN_TILDE, lexer_get_c_as_string(lexer) ) ); break; + case ';': return lexer_next_token( + lexer, + token_init( + TOKEN_SEMI, + lexer_get_c_as_string(lexer) + ) + ); break; } } @@ -122,7 +129,7 @@ token_t* lexer_get_comment(lexer_t* lexer) { } lexer_next(lexer); - return token_init(TOKEN_SEMI, NULL); + return token_init(TOKEN_COMM, lexer_get_c_as_string(lexer)); } token_t* lexer_get_id(lexer_t* lexer) { diff --git a/src/main.c b/src/main.c index e8c6a9d..6a45767 100755..100644 --- a/src/main.c +++ b/src/main.c @@ -3,7 +3,7 @@ int main(int argc, char* argv[]) { lexer_t* lexer = lexer_init( - "Let it = \"Hello, World!\";\nsay it;" + "[a simple test script]\nlet it = \"Hello, World!\";\nsay it;" ); printf("\n=== INPUT =======\n%s\n=== END INPUT ===\n", lexer->content); diff --git a/src/token.c b/src/token.c index 3021a64..3021a64 100755..100644 --- a/src/token.c +++ b/src/token.c diff --git a/src/tree.c b/src/tree.c index ab3a962..ab3a962 100755..100644 --- a/src/tree.c +++ b/src/tree.c |