lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] svn commit: r1179354 - in /incubator/lucy/branches/clownfish_lemon/clownfish: src/CFCLexHeader.l src/CFCParseHeader.y t/105-object_type.t
Date Wed, 05 Oct 2011 18:06:10 GMT
Author: marvin
Date: Wed Oct  5 18:06:10 2011
New Revision: 1179354

URL: http://svn.apache.org/viewvc?rev=1179354&view=rev
Log:
Add basic support for object types.

Modified:
    incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCLexHeader.l
    incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParseHeader.y
    incubator/lucy/branches/clownfish_lemon/clownfish/t/105-object_type.t

Modified: incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCLexHeader.l
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCLexHeader.l?rev=1179354&r1=1179353&r2=1179354&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCLexHeader.l (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCLexHeader.l Wed Oct  5 18:06:10
2011
@@ -35,6 +35,8 @@ S_save_yytext() {
 }
 %}
 
+OBJECT_TYPE_SPECIFIER   ([a-z]+[a-z0-9]*_)?[A-Z]+[A-Z0-9]*[a-z]+[A-Za-z0-9]*
+
 %option noyywrap
 
 %%
@@ -61,5 +63,10 @@ va_list    { PARSE(CFC_TOKENTYPE_VA_LIST
                 S_save_yytext();
                 PARSE(CFC_TOKENTYPE_ARBITRARY, NULL); 
            }
+{OBJECT_TYPE_SPECIFIER} {
+                S_save_yytext();
+                PARSE(CFC_TOKENTYPE_OBJECT_TYPE_SPECIFIER, NULL); 
+           }
+[*]        { PARSE(CFC_TOKENTYPE_ASTERISK, NULL); }
 %%
 

Modified: incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParseHeader.y
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParseHeader.y?rev=1179354&r1=1179353&r2=1179354&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParseHeader.y (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParseHeader.y Wed Oct  5 18:06:10
2011
@@ -70,6 +70,7 @@ result ::= simple_type(A).
     state->result = A;
 }
 
+simple_type(A) ::= object_type(B).  { A = B; }
 simple_type(A) ::= void_type(B).    { A = B; }
 simple_type(A) ::= float_type(B).   { A = B; }
 simple_type(A) ::= integer_type(B). { A = B; }
@@ -88,8 +89,10 @@ void_type(A) ::= void_type_specifier.
 
 %type float_type_specifier          {const char*}
 %type integer_type_specifier        {const char*}
+%type object_type_specifier         {char*}
 %destructor float_type_specifier        { }
 %destructor integer_type_specifier      { }
+%destructor object_type_specifier       { FREEMEM($$); }
 
 void_type_specifier ::= VOID.
 va_list_specifier         ::= VA_LIST.
@@ -140,3 +143,13 @@ arbitrary_type(A) ::= ARBITRARY.
     A = (CFCBase*)CFCType_new_arbitrary(current_parcel, CFCParser_current_state->text);
 }
 
+object_type(A) ::= object_type_specifier(B) ASTERISK.
+{
+    A = (CFCBase*)CFCType_new_object(0, CFCParser_get_parcel(), B, 1);
+}
+
+object_type_specifier(A) ::= OBJECT_TYPE_SPECIFIER.
+{
+    A = CFCUtil_strdup(CFCParser_current_state->text);
+}
+

Modified: incubator/lucy/branches/clownfish_lemon/clownfish/t/105-object_type.t
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/t/105-object_type.t?rev=1179354&r1=1179353&r2=1179354&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/t/105-object_type.t (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/t/105-object_type.t Wed Oct  5 18:06:10
2011
@@ -45,9 +45,9 @@ for my $specifier (qw( Foo FooJr FooIII 
         $specifier, "object_type_specifier: $specifier" );
     is( $parser->object_type_specifier("neato_$specifier"),
         "neato_$specifier", "object_type_specifier: neato_$specifier" );
-    my $type = $parser->object_type("$specifier*");
+    my $type = $parser->parse("$specifier*");
     ok( $type && $type->is_object, "$specifier*" );
-    $type = $parser->object_type("neato_$specifier*");
+    $type = $parser->parse("neato_$specifier*");
     ok( $type && $type->is_object, "neato_$specifier*" );
     $type = $parser->object_type("const $specifier*");
     ok( $type && $type->is_object, "const $specifier*" );



Mime
View raw message