summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eo_tokenizer.rl50
1 files changed, 48 insertions, 2 deletions
diff --git a/eo_tokenizer.rl b/eo_tokenizer.rl
index 50200bc..9281126 100644
--- a/eo_tokenizer.rl
+++ b/eo_tokenizer.rl
@@ -46,6 +46,17 @@ _eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p)
return kls;
}
+static Eo_Property_Def*
+_eo_tokenizer_property_get(Eo_Tokenizer *toknz, char *p)
+{
+ Eo_Property_Def *prop = calloc(1, sizeof(Eo_Property_Def));
+ if (prop == NULL) ABORT(toknz, "calloc Eo_Property_Def failure");
+
+ prop->name = _eo_tokenizer_token_get(toknz, p);
+
+ return prop;
+}
+
%%{
machine common;
@@ -125,6 +136,41 @@ _eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p)
write data;
+###### TOKENIZE PROPERTIES
+
+ action end_prop_name {
+ Eo_Property_Def *prop = _eo_tokenizer_property_get(toknz);
+ prop->name = _eo_tokenizer_token_get(toknz, fpc-1);
+ }
+
+ action begin_property {
+ INF(" %s {", toknz->tmp.prop->name);
+ toknz->current_nesting++;
+ #fgoto tokenize_property;
+ }
+
+ action end_property_name {
+ if (toknz->tmp.prop != NULL)
+ ABORT(toknz, "there is a pending property definition %s", toknz->tmp.prop->name);
+ toknz->tmp.prop = _eo_tokenizer_property_get(toknz, fpc);
+ }
+
+ action end_properties {
+ INF(" }");
+ toknz->current_nesting--;
+ fgoto tokenize_class;
+ }
+
+ begin_property = ident %end_property_name ignore* begin_def;
+
+ tokenize_properties := |*
+ ignore+; #=> show_ignore;
+ comment => show_comment;
+ begin_property => begin_property;
+ end_def => end_properties;
+ any => show_error;
+ *|;
+
###### TOKENIZE CLASS
action end_class_comment {
@@ -139,9 +185,9 @@ _eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p)
}
action begin_properties {
- INF(" begin properties");
+ INF(" properties {");
toknz->current_nesting++;
- /* fgoto tokenize_properties; */
+ fgoto tokenize_properties;
}
action begin_methods {