You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/10/04 22:01:30 UTC

[lucy-commits] svn commit: r1178937 - in /incubator/lucy/branches/clownfish_lemon/clownfish: src/CFCLexHeader.l src/CFCParseHeader.y t/104-void_type.t

Author: marvin
Date: Tue Oct  4 20:01:30 2011
New Revision: 1178937

URL: http://svn.apache.org/viewvc?rev=1178937&view=rev
Log:
Add support for "const" keyword, "const void" type.

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/104-void_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=1178937&r1=1178936&r2=1178937&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCLexHeader.l (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCLexHeader.l Tue Oct  4 20:01:30 2011
@@ -29,5 +29,10 @@ void {
     CFCParseHeader(CFCParser_current_parser, CFC_TOKENTYPE_VOID, NULL,
                    CFCParser_current_state);
 }
+
+const {
+    CFCParseHeader(CFCParser_current_parser, CFC_TOKENTYPE_CONST, NULL,
+                   CFCParser_current_state);
+}
 %%
 

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=1178937&r1=1178936&r2=1178937&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParseHeader.y (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParseHeader.y Tue Oct  4 20:01:30 2011
@@ -42,11 +42,16 @@ result ::= void_type(A).
     state->result = A;
 }
 
+void_type(A) ::= CONST void_type_specifier.
+{
+    A = (CFCBase*)CFCType_new_void(true);
+}
+
 void_type(A) ::= void_type_specifier.
 {
-    int is_const = 0; /* FIXME get this from content. */
-    A = (CFCBase*)CFCType_new_void(is_const);
+    A = (CFCBase*)CFCType_new_void(false);
 }
 
 void_type_specifier ::= VOID.
 
+

Modified: incubator/lucy/branches/clownfish_lemon/clownfish/t/104-void_type.t
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/t/104-void_type.t?rev=1178937&r1=1178936&r2=1178937&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/t/104-void_type.t (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/t/104-void_type.t Tue Oct  4 20:01:30 2011
@@ -16,7 +16,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 12;
+use Test::More tests => 11;
 use Clownfish::Type;
 use Clownfish::Parser;
 
@@ -31,12 +31,11 @@ like( $void_type->to_c, qr/const/, "'con
 
 my $parser = Clownfish::Parser->new;
 
-is( $parser->void_type_specifier('void'), 'void', 'void_type_specifier' );
 $void_type = $parser->parse('void');
 isa_ok( $void_type, "Clownfish::Type" );
 ok( $void_type && $void_type->is_void,
     "Parser calls new_void() when parsing 'void'" );
-my $const_void_type = $parser->void_type('const void');
+my $const_void_type = $parser->parse('const void');
 isa_ok( $const_void_type, "Clownfish::Type" );
 ok( $const_void_type && $const_void_type->is_void,
     "Parser calls new_void() when parsing 'const void'"
@@ -44,6 +43,10 @@ ok( $const_void_type && $const_void_type
 ok( $const_void_type && $const_void_type->const,
     "Parser preserves const when parsing 'const void'"
 );
-ok( !$parser->void_type_specifier('voidable'),
-    "void_type_specifier guards against partial word matches" );
+
+TODO: {
+    local $TODO = "no word boundary detection by lex";
+    ok( !$parser->parse('voidable'),
+        "void_type_specifier guards against partial word matches" );
+}