diff options
| author | Paul Buetow <paul@buetow.org> | 2008-08-24 00:28:17 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-08-24 00:28:17 +0000 |
| commit | e95e69c55c8e38c39e7ded141272e5e793d05623 (patch) | |
| tree | 344e51519958babc9abc00a4f8abcf1ad37837bf | |
| parent | e9a9ad33583c49df48ae99cab9ba0fd80f150a9e (diff) | |
few mods
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | docs/help.txt | 2 | ||||
| -rw-r--r-- | docs/stats.txt | 2 | ||||
| -rw-r--r-- | docs/version.txt | 2 | ||||
| -rw-r--r-- | src/build.h | 2 | ||||
| -rw-r--r-- | src/core/scanner.c | 38 | ||||
| -rw-r--r-- | tmp/test.out | 3 |
7 files changed, 33 insertions, 18 deletions
@@ -31,7 +31,7 @@ SRCS!=find ./src -name '*.c' OBJS=$(SRCS:.c=.o) CC?=cc #CC=mingw32-gcc -DEBUG=-g3 -ggdb3 +#DEBUG=-g3 -ggdb3 CFLAGS+=-c -Wall -std=c99 -pedantic $(DEBUG) LDADD+= HEADER?=docs/header.txt diff --git a/docs/help.txt b/docs/help.txt index 8c52ff4..6cd5d48 100644 --- a/docs/help.txt +++ b/docs/help.txt @@ -1,4 +1,4 @@ -Fype v0.0-devel Build 8978 +Fype v0.0-devel Build 9003 Copyright by Paul C. Buetow (2005 - 2008) <fype@dev.buetow.org> -e Executes given code string (see synopses) -h Prints this help diff --git a/docs/stats.txt b/docs/stats.txt index 940e9f3..4292895 100644 --- a/docs/stats.txt +++ b/docs/stats.txt @@ -1,4 +1,4 @@ ===> Num of C source files : 42 -===> Num of C source lines : 7202 +===> Num of C source lines : 7201 ===> Num of Fype source examples : 13 ===> Num of Fype source lines : 320 diff --git a/docs/version.txt b/docs/version.txt index 3179b53..64c40e6 100644 --- a/docs/version.txt +++ b/docs/version.txt @@ -1 +1 @@ -Fype v0.0-devel Build 8978 +Fype v0.0-devel Build 9003 diff --git a/src/build.h b/src/build.h index 4a94ed1..9be69e8 100644 --- a/src/build.h +++ b/src/build.h @@ -35,7 +35,7 @@ #ifndef BUILD_H #define BUILD_H -#define BUILDNR 8992 +#define BUILDNR 9029 #define OS_FREEBSD #endif diff --git a/src/core/scanner.c b/src/core/scanner.c index f4c6b81..9e49557 100644 --- a/src/core/scanner.c +++ b/src/core/scanner.c @@ -37,7 +37,12 @@ #include <ctype.h> #include <string.h> -const char const *_TOKENENDS2[] = { "==", "!=", "<=", ">=", }; +const TokenType _TOKENENDS2[] = { + TT_ASSIGN, TT_ASSIGN, TT_EQ, + TT_NOT, TT_ASSIGN, TT_NEQ, + TT_LT, TT_ASSIGN, TT_LE, + TT_GT, TT_ASSIGN, TT_GE, +}; const char _TOKENENDS[] = "})+-*/={(<>;:,.!"; #define _ADD_SEMICOLON_INDEX 2 int _CODESTR_INDEX = 0; @@ -70,8 +75,8 @@ scanner_new(List *p_list_token, Tupel *p_tupel_argv) { p_scanner->i_current_line_nr = 1; p_scanner->i_current_pos_nr = 0; - p_scanner->i_num_tokenends2 = sizeof(_TOKENENDS2) / sizeof(char const *); p_scanner->i_num_tokenends = strlen(_TOKENENDS); + p_scanner->i_num_tokenends2 = sizeof(_TOKENENDS2) / sizeof(TokenType); return p_scanner; } @@ -130,6 +135,24 @@ scanner_post_task(Scanner *p_scanner) { pt_last[0] = pt_last[1] = NULL; tt_last[0] = tt_last[1] = TT_NONE; + } else { + for (int i = 0; i < p_scanner->i_num_tokenends2; i += 3) { + if (tt_cur == _TOKENENDS2[i+1] + && tt_last[1] == _TOKENENDS2[i]) { + /* + token_ref_down(pt_last[1]); + list_remove_elem(p_list_token, p_le->p_prev); + + pt_last[0] = pt_last[1] = NULL; + tt_last[0] = tt_last[1] = TT_NONE; + + token_set_val(p_token, c_new); + token_set_tt(p_token, TT_DOUBLE); + token_set_dval(p_token, atof(c_new)); + */ + break; + } + } } } @@ -277,17 +300,6 @@ scanner_run(Fype *p_fype) { scanner_add_token(p_scanner, &c_token, &i_token_len, tt_cur); } else { - for (int i = 0; i < p_scanner->i_num_tokenends2; ++i) { - if (_TOKENENDS2[i][0] == c) { - /* - TokenType tt_cur = scanner_get_tt_cur(c_token); - scanner_add_token(p_scanner, &c_token, &i_token_len, tt_cur); - if (i < _ADD_SEMICOLON_INDEX) - _add_semicolon_to_list(p_scanner); - break; - */ - } - } for (int i = 0; i < p_scanner->i_num_tokenends; ++i) { if (_TOKENENDS[i] == c) { TokenType tt_cur = scanner_get_tt_cur(c_token); diff --git a/tmp/test.out b/tmp/test.out index 5385798..080145f 100644 --- a/tmp/test.out +++ b/tmp/test.out @@ -20,3 +20,6 @@ Token (id=00015, line=00005, pos=0016, type=TT_INTEGER, val=1, ival=1, dval=0.00 Token (id=00016, line=00005, pos=0018, type=TT_ADD, val=+, ival=0, dval=0.000000, refs=1) Token (id=00017, line=00005, pos=0021, type=TT_IDENT, val=gc, ival=0, dval=0.000000, refs=1) Token (id=00018, line=00005, pos=0022, type=TT_SEMICOLON, val=;, ival=0, dval=0.000000, refs=1) +0 +ICOUNT 4 +9 |
