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/19 21:13:34 UTC
[lucy-commits] svn commit: r1186413 - in
/incubator/lucy/branches/clownfish_lemon/clownfish: lib/Clownfish.xs
src/CFCParser.c
Author: marvin
Date: Wed Oct 19 19:13:34 2011
New Revision: 1186413
URL: http://svn.apache.org/viewvc?rev=1186413&view=rev
Log:
Make it possible to set the class name on the parser before calling parse().
This makes it easier to test parsing of small chunks that require a class to
be in effect, such as methods.
Modified:
incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs
incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.c
Modified: incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs?rev=1186413&r1=1186412&r2=1186413&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs Wed Oct 19 19:13:34 2011
@@ -2075,6 +2075,20 @@ set_parcel(unused, parcel)
PPCODE:
CFCParser_set_parcel(parcel);
+void
+set_class_name(self, class_name)
+ CFCParser *self;
+ const char *class_name;
+PPCODE:
+ CFCParser_set_class_name(self, class_name);
+
+void
+set_class_cnick(self, class_cnick)
+ CFCParser *self;
+ const char *class_cnick;
+PPCODE:
+ CFCParser_set_class_cnick(self, class_cnick);
+
SV*
get_parcel(...)
CODE:
Modified: incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.c
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.c?rev=1186413&r1=1186412&r2=1186413&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.c (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.c Wed Oct 19 19:13:34 2011
@@ -88,14 +88,6 @@ CFCParser *CFCParser_current_state = NU
void *CFCParser_current_parser = NULL;
CFCParcel *CFCParser_current_parcel = NULL;
-static void
-S_zero_out_parser(CFCParser *self) {
- CFCParser_set_text(self, "", 0);
- CFCParser_set_class_name(self, NULL);
- CFCParser_set_class_cnick(self, NULL);
- self->errors = false;
-}
-
CFCBase*
CFCParser_parse(CFCParser *self, const char *string) {
// Make Lemon-based parser and parser state available from Flex-based scanner.
@@ -103,7 +95,7 @@ CFCParser_parse(CFCParser *self, const c
CFCParser_current_parser = self->header_parser;
// Zero out, then parse.
- S_zero_out_parser(self);
+ self->errors = false;
YY_BUFFER_STATE buffer = yy_scan_bytes(string, (int)strlen(string));
yylex();
yy_delete_buffer(buffer);