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/17 20:07:32 UTC
[lucy-commits] svn commit: r1185314 - in
/incubator/lucy/branches/clownfish_lemon/clownfish: src/CFCLexHeader.l
src/CFCParseHeader.y t/050-docucomment.t
Author: marvin
Date: Mon Oct 17 18:07:31 2011
New Revision: 1185314
URL: http://svn.apache.org/viewvc?rev=1185314&view=rev
Log:
Add support for parsing docu-comments and skipping ordinary comments to
Lemon-based parser.
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/050-docucomment.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=1185314&r1=1185313&r2=1185314&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCLexHeader.l (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCLexHeader.l Mon Oct 17 18:07:31 2011
@@ -105,6 +105,11 @@ NULL { PARSE(CFC_TOKENTYPE_NULL, N
PARSE(CFC_TOKENTYPE_IDENTIFIER, NULL);
}
+"/**"([^*]|"*"[^/])*"*/" { /* Parse docucomments. */
+ S_save_yytext();
+ PARSE(CFC_TOKENTYPE_DOCUCOMMENT, NULL);
+ }
+"/*"([^*]|"*"[^/])*"*/" { /* Skip ordinary comments. */ }
[ \t\r\n] /* Skip whitespace. */
. {
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=1185314&r1=1185313&r2=1185314&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParseHeader.y (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParseHeader.y Mon Oct 17 18:07:31 2011
@@ -68,6 +68,7 @@ static const char KW_DOUBLE[] = "doubl
result ::= type(A). { state->result = A; }
result ::= param_list(A). { state->result = A; }
result ::= param_variable(A). { state->result = A; }
+result ::= docucomment(A). { state->result = A; }
type(A) ::= simple_type(B). { A = B; }
type(A) ::= composite_type(B). { A = B; }
@@ -302,3 +303,8 @@ param_list_elems(A) ::= param_variable(B
CFCParamList_add_param((CFCParamList*)A, (CFCVariable*)B, C);
}
+docucomment(A) ::= DOCUCOMMENT.
+{
+ A = (CFCBase*)CFCDocuComment_parse(CFCParser_current_state->text);
+}
+
Modified: incubator/lucy/branches/clownfish_lemon/clownfish/t/050-docucomment.t
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/t/050-docucomment.t?rev=1185314&r1=1185313&r2=1185314&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/t/050-docucomment.t (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/t/050-docucomment.t Mon Oct 17 18:07:31 2011
@@ -22,7 +22,7 @@ BEGIN { use_ok('Clownfish::DocuComment')
use Clownfish::Parser;
my $parser = Clownfish::Parser->new;
-isa_ok( $parser->docucomment('/** foo. */'), "Clownfish::DocuComment" );
+isa_ok( $parser->parse('/** foo. */'), "Clownfish::DocuComment" );
my $text = <<'END_COMMENT';
/**
@@ -38,7 +38,7 @@ my $text = <<'END_COMMENT';
*/
END_COMMENT
-my $docucomment = Clownfish::DocuComment->parse($text);
+my $docucomment = $parser->parse($text);
like(
$docucomment->get_description,