summaryrefslogtreecommitdiff
path: root/lexer.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-12-08 10:42:10 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2020-12-09 11:43:33 -0500
commita232e9f691187fdb05c35c14d4152d17f4babaf5 (patch)
tree9fdf364ce91506ed4490cd95ced6355459d7e8b5 /lexer.c
parent50875a80729eaf3be2b1473e385eca1102fce4e6 (diff)
- Implemented support for the Orthogonal extension into
both the assembler, and the emulator. I finally figured out how I could get support for the Ortho extension implemented into the old assembler. The only reason for doing this, is to buy me some while I start work on the new assembler, and to help me get an idea for how to do the same in the new assembler.
Diffstat (limited to 'lexer.c')
-rw-r--r--lexer.c67
1 files changed, 34 insertions, 33 deletions
diff --git a/lexer.c b/lexer.c
index 873fe6d..bb3701a 100644
--- a/lexer.c
+++ b/lexer.c
@@ -844,8 +844,7 @@ uint64_t lex(char *str, uint64_t address, uint16_t bline, uint8_t dbg) {
}
}
if (!isop) {
- uint8_t spaces = 0;
- if (l->tok && l->tok->type == TOK_ORTHO && l->tok->byte == SET) {
+ if (l->tok && l->tok->id == TOK_ORTHO && l->tok->byte == SET) {
for (k = 0; k < 8; k++) {
int upper = toupper(lexeme[0]);
if (upper == set_cc[k][0]) {
@@ -856,40 +855,42 @@ uint64_t lex(char *str, uint64_t address, uint16_t bline, uint8_t dbg) {
}
}
}
- }
- for (; isdelm(str[i+spaces], dbg) == 16; spaces++);
- uint8_t ret = get_ptok(str[i+spaces], dbg);
- if (ret == PTOK_COLON || ret == PTOK_EQU) {
- islocal = (lex_type == TOK_LOCAL);
- }
- lex_type = TOK_SYM;
- l->count++;
- t = make_token(lex_type, islocal, space, tab, 0, "", NULL);
- memcpy(sym, lexeme, j+1);
- if (dbg) {
- printf("lex(): spaces: %u\n", spaces);
- }
- if (is_struct) {
- create_struct(cur_sym, l, t, lt, sym, dbg);
- islocal = 0;
- } else if ((str[i+spaces] != ':' && str[i+spaces] != '=')) {
- uint8_t sym_struct = 0;
- symbol *s;
- /*tmp_sym = (s && s->isstruct) ? NULL : tmp_sym;*/
- if (tmp_sym) {
- t->sym = find_member(lexeme, tmp_sym, dbg);
- tmp_sym = NULL;
- } else {
- t->sym = get_sym(lexeme, address, t, islocal, dbg);
+ } else {
+ uint8_t spaces = 0;
+ for (; isdelm(str[i+spaces], dbg) == 16; spaces++);
+ uint8_t ret = get_ptok(str[i+spaces], dbg);
+ if (ret == PTOK_COLON || ret == PTOK_EQU) {
+ islocal = (lex_type == TOK_LOCAL);
}
- isfixup += (t && t->sym == NULL);
- islocal = 0;
+ lex_type = TOK_SYM;
+ l->count++;
+ t = make_token(lex_type, islocal, space, tab, 0, "", NULL);
+ memcpy(sym, lexeme, j+1);
if (dbg) {
- printf("lex(): isfixup: %u\n", isfixup);
+ printf("lex(): spaces: %u\n", spaces);
+ }
+ if (is_struct) {
+ create_struct(cur_sym, l, t, lt, sym, dbg);
+ islocal = 0;
+ } else if ((str[i+spaces] != ':' && str[i+spaces] != '=')) {
+ uint8_t sym_struct = 0;
+ symbol *s;
+ /*tmp_sym = (s && s->isstruct) ? NULL : tmp_sym;*/
+ if (tmp_sym) {
+ t->sym = find_member(lexeme, tmp_sym, dbg);
+ tmp_sym = NULL;
+ } else {
+ t->sym = get_sym(lexeme, address, t, islocal, dbg);
+ }
+ isfixup += (t && t->sym == NULL);
+ islocal = 0;
+ if (dbg) {
+ printf("lex(): isfixup: %u\n", isfixup);
+ }
+ }
+ if (!is_struct && t && t->sym && t->sym->isstruct) {
+ tmp_sym = t->sym;
}
- }
- if (!is_struct && t && t->sym && t->sym->isstruct) {
- tmp_sym = t->sym;
}
}
break;