From d5f4af5e61cc5ec77a5417080a611b5d8e092d9b Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Mon, 30 Jun 2014 22:07:13 +0100 Subject: [PATCH] eolian: different syntax for functions (func ret_type (arg_types)) --- src/lib/eolian/eo_lexer.c | 7 ------- src/lib/eolian/eo_lexer.h | 2 +- src/lib/eolian/eo_parser.c | 9 ++++----- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index 9c7483a4fe..87e9c2a627 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -182,13 +182,6 @@ lex(Eo_Lexer *ls, const char **value, int *kwid, const char *chars) next_char(ls); continue; } - case '-': - { - next_char(ls); - if (ls->current != '>') return '-'; - next_char(ls); - return TOK_ARROW; - } case '\0': return TOK_EOF; default: diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index c5e0f0b250..de47dc3fdd 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -11,7 +11,7 @@ enum Tokens { - TOK_ARROW = START_CUSTOM, TOK_COMMENT, TOK_EOF, TOK_VALUE + TOK_COMMENT = START_CUSTOM, TOK_EOF, TOK_VALUE }; #define KEYWORDS KW(class), KW(const), KW(private), KW(protected), \ diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 35a5ecd7cc..37105442a6 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -156,11 +156,10 @@ parse_function_type(Eo_Lexer *ls) Eo_Type_Def *def = calloc(1, sizeof(Eo_Type_Def)); ls->tmp.type_def = def; eo_lexer_get(ls); - if (ls->t.token == TOK_ARROW) - { - eo_lexer_get(ls); - def->ret_type = parse_type(ls); - } + if (ls->t.kw == KW_void) + eo_lexer_get(ls); + else + def->ret_type = parse_type(ls); line = ls->line_number; check_next(ls, '('); if (ls->t.token != ')')