diff options
author | KatolaZ <[email protected]> | 2018-04-23 14:34:59 +0100 |
---|---|---|
committer | KatolaZ <[email protected]> | 2018-04-23 14:34:59 +0100 |
commit | 2bf7cce2ac5df3a6793c3124da9d7d5639769e04 (patch) | |
tree | e1ae7a7375c099d16a3e4a3056aee421bc5625d6 | |
parent | 771b998ba5d1f451586aef0562d0012442d6bf23 (diff) |
Patched ';'
-rw-r--r-- | TODO.org | 11 | ||||
-rw-r--r-- | main.c | 23 |
2 files changed, 28 insertions, 6 deletions
@@ -3,6 +3,7 @@ * IN-PROGRESS FIXME ** DONE check file name input in 'f' and 'w' +** TODO Change read_lines to use __get_lines (let fin point to the file to read from...) * IN-PROGRESS Commands [3/20] @@ -27,6 +28,12 @@ ** TODO w ! ** DONE f -* TODO Addresses + +* IN-PROGRESS Addresses [4/7] +** TODO Test , extensively +** DONE numbers +** DONE , +** DONE $ +** TODO . +** DONE ; ** TODO Offsets (+-) -** TODO ; @@ -26,7 +26,7 @@ const char* skip_blank(const char **c){ int get_addr(const char **cmd){ int addr, n, got; - char sign = 0, comma = 0; + char sign = 0, comma = 0, semic = 0; const char *c; addr1 = addr2 = -1; @@ -63,19 +63,29 @@ int get_addr(const char **cmd){ if (addr1 ==-1) addr2 = 1, addr1=num; else if (addr1 < addr2){ - *cmd = c; + *cmd = c++; return -1; } break; + case ';': + semic = 1; + if (addr1 == -1) + addr2 = pos, addr1=num; + else if (addr1 < addr2){ + *cmd = c++; + return -1; + } + break; default: goto check; } c++; } } + check: *cmd = c; - + fprintf(stderr, " >>> get_addr: addr1: %d addr2: %d\n", addr1, addr2); if (addr1 == -1){ @@ -84,11 +94,16 @@ int get_addr(const char **cmd){ addr2 = 1; return 2; } + if (semic){ + addr1 = num; + addr2 = pos; + return 2; + } addr1 = addr2 = pos; return 0; } if (addr2 == -1){ - if (comma){ + if (comma || semic){ addr2 = addr1; return 2; } |