fix more bugs

master
Ondřej Hruška 3 years ago
parent 4efe5ffa86
commit 2632f748b1
  1. 2
      src/fh_builtins_mem.c
  2. 6
      src/fh_parse.c
  3. 3
      testfiles/combinedtest.f

@ -212,7 +212,7 @@ static enum fh_error w_c_fetch(struct fh_thread_s *fh, const struct fh_word_s *w
char value = 0; char value = 0;
TRY(fh_fetch_char(fh, addr, &value)); TRY(fh_fetch_char(fh, addr, &value));
TRY(ds_push(fh, (uint32_t) value)); TRY(ds_push(fh, (uint32_t) (value&0xFF)));
return FH_OK; return FH_OK;
} }

@ -156,9 +156,9 @@ enum fh_error fh_input_read_quotedstring(struct fh_thread_s *fh, bool escaped, c
if (isdigit(c)) { if (isdigit(c)) {
hex |= c - '0'; hex |= c - '0';
} else if (c >= 'a' && c <= 'f') { } else if (c >= 'a' && c <= 'f') {
hex |= c - 'a'; hex |= 10 + (c - 'a');
} else if (c >= 'A' && c <= 'F') { } else if (c >= 'A' && c <= 'F') {
hex |= c - 'A'; hex |= 10 + (c - 'A');
} else { } else {
LOGE("Bad hex escape"); LOGE("Bad hex escape");
return FH_ERR_SYNTAX; return FH_ERR_SYNTAX;
@ -167,6 +167,8 @@ enum fh_error fh_input_read_quotedstring(struct fh_thread_s *fh, bool escaped, c
if (hexdigits == 0) { if (hexdigits == 0) {
c = (char) hex; c = (char) hex;
goto append; goto append;
} else {
goto skip;
} }
} }

@ -1802,7 +1802,6 @@ TESTING S\" (Forth 2012 compilation mode)
\ interpretation semantics. S\" in interpretation mode is tested in the tests on \ interpretation semantics. S\" in interpretation mode is tested in the tests on
\ the File-Access word set \ the File-Access word set
1 debug
T{ : SSQ1 S\" abc" S" abc" S= ; -> }T \ No escapes T{ : SSQ1 S\" abc" S" abc" S= ; -> }T \ No escapes
T{ SSQ1 -> TRUE }T T{ SSQ1 -> TRUE }T
T{ : SSQ2 S\" " ; SSQ2 SWAP DROP -> 0 }T \ Empty string T{ : SSQ2 S\" " ; SSQ2 SWAP DROP -> 0 }T \ Empty string
@ -1835,7 +1834,7 @@ T{ SSQ3 DROP 19 CHARS + C@ -> 92 }T \ \\ \ Back Slash
CR .( The next test should display:) CR .( The next test should display:)
CR .( One line...) CR .( One line...)
CR .( another line) CR .( another line)
T{ : SSQ4 S\" \nOne line...\nanotherLine\n" TYPE ; SSQ4 -> }T T{ : SSQ4 S\" \nOne line...\nanother line\n" TYPE ; SSQ4 -> }T
\ Test bare escapable characters appear as themselves \ Test bare escapable characters appear as themselves
T{ : SSQ5 S\" abeflmnqrtvxz" S" abeflmnqrtvxz" S= ; SSQ5 -> TRUE }T T{ : SSQ5 S\" abeflmnqrtvxz" S" abeflmnqrtvxz" S= ; SSQ5 -> TRUE }T

Loading…
Cancel
Save