aboutsummaryrefslogtreecommitdiffstats
path: root/forth.c
diff options
context:
space:
mode:
Diffstat (limited to 'forth.c')
-rw-r--r--forth.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/forth.c b/forth.c
index f5f629a..4c5d910 100644
--- a/forth.c
+++ b/forth.c
@@ -47,24 +47,24 @@ void exec(stack *s, char *word, int len, char* line, int* i) {
}
void eval(stack* s, int len, char* line) {
- char word[WORD_LEN_LIMIT];
- int wordi = 0;
- for (int i = 0; i < len; i++) {
- if (notdelim(line[i]) && wordi < WORD_LEN_LIMIT - 1) {
- word[wordi++] = line[i];
- } else { // end of word
- if (wordi > 0) { // don't exec an empty string
- word[wordi] = '\0';
- exec(s, word, len, line, &i);
- }
- // start new word
- wordi = 0;
- }
- // end of input string
- if (line[i] == '\0') {
- return;
+ char word[WORD_LEN_LIMIT];
+ int wordi = 0;
+ for (int i = 0; i < len; i++) {
+ if (notdelim(line[i]) && wordi < WORD_LEN_LIMIT - 1) {
+ word[wordi++] = line[i];
+ } else { // end of word
+ if (wordi > 0) { // don't exec an empty string
+ word[wordi] = '\0';
+ exec(s, word, len, line, &i);
}
+ // start new word
+ wordi = 0;
+ }
+ // end of input string
+ if (line[i] == '\0') {
+ return;
}
+ }
}
int main(int argc, char** argv) {