summaryrefslogtreecommitdiff
path: root/lexer.c
diff options
context:
space:
mode:
Diffstat (limited to 'lexer.c')
-rw-r--r--lexer.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lexer.c b/lexer.c
index 0540498..699589c 100644
--- a/lexer.c
+++ b/lexer.c
@@ -241,6 +241,10 @@ uint64_t lex(char *str, uint64_t address, uint8_t dbg) {
l->tok = NULL;
l->next = NULL;
l->count = 0;
+ l->espace = 0;
+ l->etab = 0;
+ l->sspace = 0;
+ l->stab = 0;
last_line = l;
}
@@ -422,17 +426,22 @@ uint64_t lex(char *str, uint64_t address, uint8_t dbg) {
case PTOK_MINUS:
case PTOK_GT:
case PTOK_LT:
+ case PTOK_PIPE:
lex_type = TOK_EXPR;
switch (ptok) {
case PTOK_PLUS : value = EXPR_PLUS ; break;
case PTOK_MINUS: value = EXPR_MINUS; break;
- case PTOK_GT : value = EXPR_LOW ; break;
- case PTOK_LT : value = EXPR_HIGH ; break;
+ case PTOK_PIPE : value = EXPR_OR ; break;
+ case PTOK_GT : value = (get_ptok(str[i+1], dbg) == PTOK_GT) ? (EXPR_RSHFT) : (EXPR_LOW) ; break;
+ case PTOK_LT : value = (get_ptok(str[i+1], dbg) == PTOK_LT) ? (EXPR_LSHFT) : (EXPR_HIGH); break;
}
l->count++;
t = make_token(lex_type, value, 0, "", NULL);
memset(lexeme, 0, strlen(lexeme)+1);
lexeme[j++] = str[i];
+ if (value == EXPR_LSHFT || value == EXPR_RSHFT) {
+ lexeme[j++] = str[++i];
+ }
break;
case PTOK_EQU:
i++;