summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/lexer.c25
-rw-r--r--core/parser.c5
2 files changed, 26 insertions, 4 deletions
diff --git a/core/lexer.c b/core/lexer.c
index 36818bc..27b395e 100644
--- a/core/lexer.c
+++ b/core/lexer.c
@@ -304,6 +304,18 @@ lexer_nom(struct cescal_state *state, struct token *res)
res->type = TT_COLON;
res->c = c;
return 0;
+ case '+':
+ res->type = TT_PLUS;
+ res->c = c;
+ return 0;
+ case '*':
+ res->type = TT_STAR;
+ res->c = c;
+ return 0;
+ case '=':
+ res->type = TT_EQUALS;
+ res->c = c;
+ return 0;
case '#':
if ((c = lexer_consume_single(state, true)) == '\0') {
return -1;
@@ -318,21 +330,26 @@ lexer_nom(struct cescal_state *state, struct token *res)
return 0;
case '/':
- if (lexer_consume_single(state, true) == '/') {
+ if ((c = lexer_consume_single(state, true)) == '/') {
res->type = TT_COMMENT;
res->c = c;
lexer_skip_comment(state);
return 0;
}
- return -1;
+ lexer_putback(state, c);
+ res->type = TT_SLASH;
+ return 0;
case '-':
res->c = c;
- if (lexer_consume_single(state, true) == '>') {
+ if ((c = lexer_consume_single(state, true)) == '>') {
res->type = TT_ARROW;
return 0;
}
- return -1;
+
+ lexer_putback(state, c);
+ res->type = TT_MINUS;
+ return 0;
default:
if (lexer_scan_ident(state, c, res) == 0) {
lexer_check_kw(state, res);
diff --git a/core/parser.c b/core/parser.c
index 6720d84..58a1bc5 100644
--- a/core/parser.c
+++ b/core/parser.c
@@ -39,6 +39,11 @@ static const char *toktab[] = {
[TT_COMMA] = qtok(","),
[TT_COLON] = qtok(":"),
[TT_ARROW] = qtok("->"),
+ [TT_PLUS] = qtok("+"),
+ [TT_MINUS] = qtok("-"),
+ [TT_SLASH] = qtok("/"),
+ [TT_STAR] = qtok("*"),
+ [TT_EQUALS] = qtok("="),
[TT_DEFINE] = qtok("#define"),
[TT_IFNDEF] = qtok("#ifndef"),
[TT_IFDEF] = qtok("#ifdef"),