Author: marvin
Date: Fri Jun 29 03:02:35 2012
New Revision: 1355223
URL: http://svn.apache.org/viewvc?rev=1355223&view=rev
Log:
Break out ParserElem into a separate file.
Added:
lucy/trunk/core/Lucy/Search/QueryParser/
lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.c (with props)
lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.cfh (with props)
Modified:
lucy/trunk/core/Lucy/Search/QueryParser.c
lucy/trunk/core/Lucy/Search/QueryParser.cfh
Modified: lucy/trunk/core/Lucy/Search/QueryParser.c
URL:
http://svn.apache.org/viewvc/lucy/trunk/core/Lucy/Search/QueryParser.c?rev=1355223&r1=1355222&r2=1355223&view=diff
==============================================================================
--- lucy/trunk/core/Lucy/Search/QueryParser.c (original)
+++ lucy/trunk/core/Lucy/Search/QueryParser.c Fri Jun 29 03:02:35 2012
@@ -23,6 +23,7 @@
#include "Lucy/Util/ToolSet.h"
#include "Lucy/Search/QueryParser.h"
+#include "Lucy/Search/QueryParser/ParserElem.h"
#include "Lucy/Analysis/Analyzer.h"
#include "Lucy/Plan/FieldType.h"
#include "Lucy/Plan/Schema.h"
@@ -37,18 +38,18 @@
#include "Lucy/Search/TermQuery.h"
#include "Lucy/Search/Query.h"
-#define SHOULD 0x00000001
-#define MUST 0x00000002
-#define MUST_NOT 0x00000004
-#define TOKEN_OPEN_PAREN 0x00000008
-#define TOKEN_CLOSE_PAREN 0x00000010
-#define TOKEN_MINUS 0x00000020
-#define TOKEN_PLUS 0x00000040
-#define TOKEN_NOT 0x00000080
-#define TOKEN_OR 0x00000100
-#define TOKEN_AND 0x00000200
-#define TOKEN_FIELD 0x00000400
-#define TOKEN_QUERY 0x00000800
+#define SHOULD LUCY_QPARSER_SHOULD
+#define MUST LUCY_QPARSER_MUST
+#define MUST_NOT LUCY_QPARSER_MUST_NOT
+#define TOKEN_OPEN_PAREN LUCY_QPARSER_TOKEN_OPEN_PAREN
+#define TOKEN_CLOSE_PAREN LUCY_QPARSER_TOKEN_CLOSE_PAREN
+#define TOKEN_MINUS LUCY_QPARSER_TOKEN_MINUS
+#define TOKEN_PLUS LUCY_QPARSER_TOKEN_PLUS
+#define TOKEN_NOT LUCY_QPARSER_TOKEN_NOT
+#define TOKEN_OR LUCY_QPARSER_TOKEN_OR
+#define TOKEN_AND LUCY_QPARSER_TOKEN_AND
+#define TOKEN_FIELD LUCY_QPARSER_TOKEN_FIELD
+#define TOKEN_QUERY LUCY_QPARSER_TOKEN_QUERY
// Recursing helper function for Tree().
static Query*
@@ -1213,26 +1214,3 @@ ParserClause_destroy(ParserClause *self)
SUPER_DESTROY(self, PARSERCLAUSE);
}
-/********************************************************************/
-
-ParserElem*
-ParserElem_new(uint32_t type, const char *text, size_t len) {
- ParserElem *self = (ParserElem*)VTable_Make_Obj(PARSERELEM);
- return ParserElem_init(self, type, text, len);
-}
-
-ParserElem*
-ParserElem_init(ParserElem *self, uint32_t type, const char *text,
- size_t len) {
- self->type = type;
- self->text = text ? CB_new_from_utf8(text, len) : NULL;
- return self;
-}
-
-void
-ParserElem_destroy(ParserElem *self) {
- DECREF(self->text);
- SUPER_DESTROY(self, PARSERELEM);
-}
-
-
Modified: lucy/trunk/core/Lucy/Search/QueryParser.cfh
URL:
http://svn.apache.org/viewvc/lucy/trunk/core/Lucy/Search/QueryParser.cfh?rev=1355223&r1=1355222&r2=1355223&view=diff
==============================================================================
--- lucy/trunk/core/Lucy/Search/QueryParser.cfh (original)
+++ lucy/trunk/core/Lucy/Search/QueryParser.cfh Fri Jun 29 03:02:35 2012
@@ -244,22 +244,20 @@ class Lucy::QueryParser::ParserClause in
Destroy(ParserClause *self);
}
-/** Private utility class.
- */
-class Lucy::QueryParser::ParserElem inherits Lucy::Object::Obj {
+__C__
- uint32_t type;
- CharBuf *text;
-
- inert incremented ParserElem*
- new(uint32_t type, const char *text = NULL, size_t len = 0);
-
- inert ParserElem*
- init(ParserElem *self, uint32_t type, const char *text = NULL,
- size_t len = 0);
-
- public void
- Destroy(ParserElem *self);
-}
+#define LUCY_QPARSER_SHOULD 0x00000001
+#define LUCY_QPARSER_MUST 0x00000002
+#define LUCY_QPARSER_MUST_NOT 0x00000004
+#define LUCY_QPARSER_TOKEN_OPEN_PAREN 0x00000008
+#define LUCY_QPARSER_TOKEN_CLOSE_PAREN 0x00000010
+#define LUCY_QPARSER_TOKEN_MINUS 0x00000020
+#define LUCY_QPARSER_TOKEN_PLUS 0x00000040
+#define LUCY_QPARSER_TOKEN_NOT 0x00000080
+#define LUCY_QPARSER_TOKEN_OR 0x00000100
+#define LUCY_QPARSER_TOKEN_AND 0x00000200
+#define LUCY_QPARSER_TOKEN_FIELD 0x00000400
+#define LUCY_QPARSER_TOKEN_QUERY 0x00000800
+__END_C__
Added: lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.c
URL:
http://svn.apache.org/viewvc/lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.c?rev=1355223&view=auto
==============================================================================
--- lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.c (added)
+++ lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.c Fri Jun 29 03:02:35
2012
@@ -0,0 +1,41 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define C_LUCY_PARSERELEM
+#include "Lucy/Util/ToolSet.h"
+#include "Lucy/Search/QueryParser/ParserElem.h"
+
+ParserElem*
+ParserElem_new(uint32_t type, const char *text, size_t len) {
+ ParserElem *self = (ParserElem*)VTable_Make_Obj(PARSERELEM);
+ return ParserElem_init(self, type, text, len);
+}
+
+ParserElem*
+ParserElem_init(ParserElem *self, uint32_t type, const char *text,
+ size_t len) {
+ self->type = type;
+ self->text = text ? CB_new_from_utf8(text, len) : NULL;
+ return self;
+}
+
+void
+ParserElem_destroy(ParserElem *self) {
+ DECREF(self->text);
+ SUPER_DESTROY(self, PARSERELEM);
+}
+
+
Propchange: lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.cfh
URL:
http://svn.apache.org/viewvc/lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.cfh?rev=1355223&view=auto
==============================================================================
--- lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.cfh (added)
+++ lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.cfh Fri Jun 29 03:02:35
2012
@@ -0,0 +1,36 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+parcel Lucy;
+
+/** Private utility class.
+ */
+class Lucy::QueryParser::ParserElem inherits Lucy::Object::Obj {
+
+ uint32_t type;
+ CharBuf *text;
+
+ inert incremented ParserElem*
+ new(uint32_t type, const char *text = NULL, size_t len = 0);
+
+ inert ParserElem*
+ init(ParserElem *self, uint32_t type, const char *text = NULL,
+ size_t len = 0);
+
+ public void
+ Destroy(ParserElem *self);
+}
+
Propchange: lucy/trunk/core/Lucy/Search/QueryParser/ParserElem.cfh
------------------------------------------------------------------------------
svn:eol-style = native