From ab8fe63afa5f28649295d78e4ce1c428e1135211 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 22 Jul 2014 16:35:54 +0100 Subject: [PATCH] eolian: use @protected syntax as per wiki --- src/lib/eolian/eo_lexer.h | 8 ++++---- src/lib/eolian/eo_parser.c | 15 ++++++++------- src/tests/eolian/data/scope.eo | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index 90b6d65..f9607d7 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -18,15 +18,15 @@ enum Tokens /* all keywords in eolian, they can still be used as names (they're TOK_VALUE) * they just fill in the "kw" field of the token */ -#define KEYWORDS KW(class), KW(const), KW(private), KW(protected), \ - KW(return), KW(signed), KW(struct), KW(unsigned), KW(virtual), \ +#define KEYWORDS KW(class), KW(const), KW(private), KW(return), KW(signed), \ + KW(struct), KW(unsigned), KW(virtual), \ \ KW(abstract), KW(constructor), KW(constructors), KW(data), \ KW(destructor), KW(eo_prefix), KW(events), KW(func), KW(get), \ KW(implements), KW(interface), KW(keys), KW(legacy), KW(legacy_prefix), \ KW(methods), KW(mixin), KW(own), KW(params), KW(properties), KW(set), \ - KW(type), KW(values), KWAT(extern), KWAT(in), KWAT(inout), KWAT(nonull), \ - KWAT(out), KWAT(warn_unused), \ + KW(type), KW(values), KWAT(const), KWAT(extern), KWAT(in), KWAT(inout), \ + KWAT(nonull), KWAT(out), KWAT(protected), KWAT(warn_unused), \ \ KW(byte), KW(ubyte), KW(char), KW(short), KW(ushort), KW(int), KW(uint), \ KW(long), KW(ulong), KW(llong), KW(ullong), \ diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 7af32c6..21ec998 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -715,13 +715,14 @@ parse_property(Eo_Lexer *ls) has_keys = EINA_FALSE, has_values = EINA_FALSE; prop = calloc(1, sizeof(Eo_Property_Def)); ls->tmp.prop = prop; - if (ls->t.kw == KW_protected) + check(ls, TOK_VALUE); + prop->name = eina_stringshare_ref(ls->t.value); + eo_lexer_get(ls); + if (ls->t.kw == KW_at_protected) { prop->scope = EOLIAN_SCOPE_PROTECTED; eo_lexer_get(ls); } - prop->name = eina_stringshare_ref(ls->t.value); - eo_lexer_get(ls); line = ls->line_number; col = ls->column; check_next(ls, '{'); @@ -778,14 +779,14 @@ parse_method(Eo_Lexer *ls, Eina_Bool ctor) } else { - if (ls->t.kw == KW_protected) + check(ls, TOK_VALUE); + meth->name = eina_stringshare_ref(ls->t.value); + eo_lexer_get(ls); + if (ls->t.kw == KW_at_protected) { meth->scope = EOLIAN_SCOPE_PROTECTED; eo_lexer_get(ls); } - check(ls, TOK_VALUE); - meth->name = eina_stringshare_ref(ls->t.value); - eo_lexer_get(ls); } line = ls->line_number; col = ls->column; diff --git a/src/tests/eolian/data/scope.eo b/src/tests/eolian/data/scope.eo index 40dfed4..fe5045c 100644 --- a/src/tests/eolian/data/scope.eo +++ b/src/tests/eolian/data/scope.eo @@ -1,6 +1,6 @@ class Simple { properties { - protected a { + a @protected { get { } } @@ -16,7 +16,7 @@ class Simple { methods { foo { } - protected bar { + bar @protected { } foobar { } -- 2.7.4