summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/help.txt2
-rw-r--r--docs/stats.txt2
-rw-r--r--docs/version.txt2
-rwxr-xr-xfypebin287944 -> 287912 bytes
-rw-r--r--src/build.h2
-rw-r--r--src/core/interpret.c14
-rw-r--r--src/core/scanner.c2
-rw-r--r--src/core/token.c2
-rw-r--r--src/core/token.h1
9 files changed, 18 insertions, 9 deletions
diff --git a/docs/help.txt b/docs/help.txt
index 4c3ded3..204cbd3 100644
--- a/docs/help.txt
+++ b/docs/help.txt
@@ -1,4 +1,4 @@
-Fype Superalpha Build 9705
+Fype Superalpha Build 9720
(c) 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 e4a2d10..09e90e9 100644
--- a/docs/stats.txt
+++ b/docs/stats.txt
@@ -1,6 +1,6 @@
make[1]: Entering directory '/home/paul/git/fype'
===> Num of C source files : 46
-===> Num of C source lines : 8744
+===> Num of C source lines : 8753
===> Num of Fype source examples : 19
===> Num of Fype source lines : 883
make[1]: Leaving directory '/home/paul/git/fype'
diff --git a/docs/version.txt b/docs/version.txt
index baab03e..646d854 100644
--- a/docs/version.txt
+++ b/docs/version.txt
@@ -1 +1 @@
-Fype Superalpha Build 9705
+Fype Superalpha Build 9720
diff --git a/fype b/fype
index edcafc8..d6e0e8f 100755
--- a/fype
+++ b/fype
Binary files differ
diff --git a/src/build.h b/src/build.h
index cd6ed73..7e13941 100644
--- a/src/build.h
+++ b/src/build.h
@@ -36,7 +36,7 @@
#ifndef BUILD_H
#define BUILD_H
-#define BUILDNR 9709
+#define BUILDNR 9731
#define OS_LINUX
#endif
diff --git a/src/core/interpret.c b/src/core/interpret.c
index 7fc9334..38464f8 100644
--- a/src/core/interpret.c
+++ b/src/core/interpret.c
@@ -267,7 +267,19 @@ _var_assign(Interpret *p_interpret) {
p_interpret->p_stack = p_stack;
p_token = stack_top(p_interpret->p_stack);
- Symbol *p_symbol = symbol_new(SYM_VARIABLE, p_token);
+ /* For scalar types, own a fresh token so that in-place
+ * mutations (incr/decr) don't corrupt the function body's
+ * literal tokens across repeated calls. Arrays and strings
+ * keep reference semantics as-is. */
+ Token *p_own = p_token;
+ if (token_get_tt(p_token) == TT_INTEGER) {
+ p_own = token_new_integer(token_get_ival(p_token));
+ } else if (token_get_tt(p_token) == TT_DOUBLE) {
+ p_own = token_new_dummy();
+ token_set_tt(p_own, TT_DOUBLE);
+ token_set_dval(p_own, token_get_dval(p_token));
+ }
+ Symbol *p_symbol = symbol_new(SYM_VARIABLE, p_own);
scope_newset(p_interpret->p_scope, c_name, p_symbol);
} else {
return (0);
diff --git a/src/core/scanner.c b/src/core/scanner.c
index 87fc624..7eecb01 100644
--- a/src/core/scanner.c
+++ b/src/core/scanner.c
@@ -287,7 +287,7 @@ scanner_run(List *p_list_token, Tupel *p_tupel_argv,
_add_semicolon_to_list(p_scanner);
char d = c_token[i_token_len-1];
- if ((!isalpha(d) && !isdigit(d) /*&& d != '-'*/) &&
+ if ((!isalpha(d) && !isdigit(d) && d != '_' /*&& d != '-'*/) &&
(isalpha(c) || isdigit(c))) {
scanner_add_token(p_scanner, &c_token, &i_token_len,
diff --git a/src/core/token.c b/src/core/token.c
index f7cc745..b31bed9 100644
--- a/src/core/token.c
+++ b/src/core/token.c
@@ -61,7 +61,6 @@ get_tt(char *c_token) {
CHECK("proc") TT_PROC;
CHECK("fun") TT_FUNC;
CHECK("my") TT_MY;
- CHECK("arr") TT_ARR;
CHECK("!") TT_NOT;
CHECK("!=") TT_NEQ;
CHECK("=~") TT_RE;
@@ -127,7 +126,6 @@ tt_get_name(TokenType tt_cur) {
CASE(TT_PROC,"TT_PROC")
CASE(TT_FUNC,"TT_FUNC")
CASE(TT_MY,"TT_MY")
- CASE(TT_ARR,"TT_ARR")
CASE(TT_WHILE,"TT_WHILE")
CASE(TT_UNTIL,"TT_UNTIL")
CASE(TT_NEXT,"TT_NEXT")
diff --git a/src/core/token.h b/src/core/token.h
index 497dc78..b7e77a9 100644
--- a/src/core/token.h
+++ b/src/core/token.h
@@ -101,7 +101,6 @@ typedef enum {
TT_PROC,
TT_FUNC,
TT_MY,
- TT_ARR,
TT_WHILE,
TT_UNTIL,
TT_NEXT,