Update of /cvsroot/monetdb/pathfinder/compiler/parser
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv14577/compiler/parser
Modified Files:
Tag: M5XQ
parser.y
Log Message:
propagated changes of Thursday Nov 05 2009 - Monday Nov 09 2009
from the development trunk to the M5XQ branch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/11/05 - singhan: compiler/parser/parser.y,1.74
XQuery full-text search support initial version!
This initial version provides support to
-ftcontains keyword,
e.g., for $f in doc("menu.xml")//food[./name ftcontains "Belgian Waffles"]
return $f
The above query will return all the food nodes that has some relevancy over
"Belgian Waffles"
-initial score variable support
e.g., for $f score $s in doc("menu.xml")//food[./name ftcontains "Belgian
Waffles"]
return $s
The above query will return the relevancy score of all the matched food
nodes, however since its an initial version, the support to this score variable
is very limited.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: parser.y
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/parser/parser.y,v
retrieving revision 1.71.4.2
retrieving revision 1.71.4.3
diff -u -d -r1.71.4.2 -r1.71.4.3
--- parser.y 3 Aug 2009 13:19:06 -0000 1.71.4.2
+++ parser.y 9 Nov 2009 00:04:33 -0000 1.71.4.3
@@ -373,6 +373,11 @@
%token following_colon_colon "following::"
%token following_sibling_colon_colon "following-sibling::"
%token for_dollar "for $"
+%token ftand "ftand"
+%token ftcontains "ftcontains"
+%token ftmildnot "not in"
+%token ftnot "ftnot"
+%token ftor "ftor"
%token ge "ge"
%token greater_than ">"
%token greater_than_equal ">="
@@ -395,7 +400,7 @@
%token le "le"
%token less_than "<"
%token less_than_equal "<="
-%token let_dollar "let $"
+%token let "let"
%token lparen "("
%token lt "lt"
%token lt_lt "<<"
@@ -433,6 +438,7 @@
%token satisfies "satisfies"
%token schema_attribute_lparen "schema-attribute ("
%token schema_element_lparen "schema-element ("
+%token score_dollar "score $"
/* Pathfinder extension: recursion */
%token seeded_by "seeded by"
/* StandOff */
@@ -463,6 +469,7 @@
%token with "with"
/* Pathfinder extension: recursion */
%token with_dollar "with $"
+%token without_content "without content"
%token xml_comment_end "-->"
%token xml_comment_start "<!--"
%token xquery_version "xquery version"
@@ -559,6 +566,7 @@
%type <ptype>
DivOp_
+ FTOp_
GeneralComp
NodeComp
SomeEvery_
@@ -626,6 +634,18 @@
FilterExpr
FLWORExpr
ForwardStep
+ FTAndExpr
+ FTContainsExpr
+ FTIgnoreOption
+ FTMildNot
+ FTOrExpr
+ FTPrimaryExpr
+ FTPrimaryWithOptions
+ FTScoreVar
+ FTSelectionExpr
+ FTUnaryNot
+ FTWordsExpr
+ FTWordsValueExpr
FuncArgList_
FunctionCall
FunctionDecl
@@ -1441,40 +1461,92 @@
$5),
$8.root);
}
+ | /* full-text support */
+ VarName OptTypeDeclaration_ OptPositionalVar_
FTScoreVar
+ "in" ExprSingle
+ { $$.root = $$.hole =
+ wire2 (p_binds, @$,
+ wire2 (p_bind, @$,
+ wire2 (p_vars, loc_rng (@1, @4),
+ wire2 (p_vars, loc_rng (@1, @3),
+ wire2 (p_var_type, loc_rng (@1, @2),
+ $1,
+ $2),
+ $3),
+ $4),
+ $6),
+ nil (@$));
+ }
+ | /* full-text support */
+ VarName OptTypeDeclaration_ OptPositionalVar_
FTScoreVar
+ "in" ExprSingle "," "$" VarPosBindings_
+ { $$.hole = $9.hole;
+ $$.root =
+ wire2 (p_binds, @$,
+ wire2 (p_bind, @$,
+ wire2 (p_vars, loc_rng (@1, @4),
+ wire2 (p_vars, loc_rng (@1, @3),
+ wire2 (p_var_type, loc_rng (@1, @2),
+ $1,
+ $2),
+ $3),
+ $4),
+ $6),
+ $9.root);
+ }
;
OptPositionalVar_ : /* empty */ { $$ = nil (@$); }
| PositionalVar { $$ = $1; }
;
+/* Full-text support */
+FTScoreVar : "score $" VarName { $$ = $2; }
+ ;
+
/* [35] */
PositionalVar : "at $" VarName { $$ = $2; }
;
/* [36] */
-LetClause : "let $" LetBindings_ { $$ = $2; }
+LetClause : "let" LetBindings_ { $$ = $2; }
;
-LetBindings_ : VarName OptTypeDeclaration_ ":=" ExprSingle
+LetBindings_ : "$" VarName OptTypeDeclaration_ ":=" ExprSingle
{ $$.root = $$.hole =
wire2 (p_binds, @$,
wire2 (p_let, @$,
- wire2 (p_var_type, loc_rng (@1, @2),
- $1, $2),
- $4),
+ wire2 (p_var_type, loc_rng (@2, @3),
+ $2, $3),
+ $5),
nil (@$));
}
- | VarName OptTypeDeclaration_ ":=" ExprSingle
- "," "$" LetBindings_
+ | "$" VarName OptTypeDeclaration_ ":=" ExprSingle
+ "," LetBindings_
{ $$.hole = $7.hole;
$$.root =
wire2 (p_binds, @$,
wire2 (p_let, @$,
- wire2 (p_var_type, loc_rng (@1, @2),
- $1, $2),
- $4),
+ wire2 (p_var_type, loc_rng (@2, @3),
+ $2, $3),
+ $5),
$7.root);
}
+ | FTScoreVar ":=" ExprSingle
+ { $$.root = $$.hole =
+ wire2 (p_binds, @$,
+ wire2 (p_let, @$, $1, $3),
+ nil (@$));
+ }
+ | FTScoreVar ":=" ExprSingle
+ "," LetBindings_
+ {
+ $$.hole = $5.hole;
+ $$.root =
+ wire2 (p_binds, @$,
+ wire2 (p_let, @$, $1, $3),
+ $5.root);
+ }
;
/* [37] */
@@ -1613,15 +1685,79 @@
;
/* [48] */
-ComparisonExpr : RangeExpr { $$ = $1; }
+/*ComparisonExpr : RangeExpr { $$ = $1; }
| RangeExpr ValueComp RangeExpr
{ $$ = wire2 ($2, @$, $1, $3); }
| RangeExpr GeneralComp RangeExpr
{ $$ = wire2 ($2, @$, $1, $3); }
| RangeExpr NodeComp RangeExpr
{ $$ = wire2 ($2, @$, $1, $3); }
+ ;*/
+
+/* Full-text */
+ComparisonExpr : FTContainsExpr { $$ = $1; }
+ | FTContainsExpr ValueComp FTContainsExpr
+ { $$ = wire2 ($2, @$, $1, $3); }
+ | FTContainsExpr GeneralComp FTContainsExpr
+ { $$ = wire2 ($2, @$, $1, $3); }
+ | FTContainsExpr NodeComp FTContainsExpr
+ { $$ = wire2 ($2, @$, $1, $3); }
+ ;
+
+FTContainsExpr : RangeExpr { $$ = $1; }
+ | RangeExpr FTOp_ FTSelectionExpr
+ { $$ = wire2 ($2, @$, $1, $3); }
+ | RangeExpr FTOp_ FTSelectionExpr FTIgnoreOption
+ { $$ = wire2 ($2, @$, $1,
+ wire2 (p_ftfilter, loc_rng (@3,
@4), $3, $4)); }
+ ;
+
+FTOp_ : "ftcontains" { $$ = p_ftcontains; }
+ ;
+
+FTSelectionExpr : FTOrExpr { $$ = $1; }
;
+FTIgnoreOption : "without content" UnionExpr
+ { $$ = wire1 (p_ftignore, @$, $2); }
+ ;
+
+FTOrExpr : FTAndExpr { $$ = $1; }
+ | FTOrExpr "ftor" FTAndExpr
+ { $$ = wire2 (p_ftor, @$,
$1, $3); }
+ ;
+
+FTAndExpr : FTMildNot { $$ = $1; }
+ | FTAndExpr "ftand" FTMildNot
+ { $$ = wire2 (p_ftand, @$,
$1, $3); }
+ ;
+
+FTMildNot : FTUnaryNot { $$ = $1; }
+ | FTMildNot "not in" FTUnaryNot
+ { $$ = wire2 (p_ftmildnot, @$, $1, $3); }
+ ;
+
+FTUnaryNot : FTPrimaryWithOptions { $$ = $1; }
+ | "ftnot" FTPrimaryWithOptions
+ { $$ = wire1 (p_ftnot, @$, $2); }
+ ;
+
+
+FTPrimaryWithOptions : FTPrimaryExpr { $$ = $1; }
+ ;
+
+FTPrimaryExpr : FTWordsExpr { $$ = $1; }
+ | "(" FTSelectionExpr ")"
+ { $$ = $2; }
+ ;
+
+FTWordsExpr : FTWordsValueExpr { $$ = $1; }
+ ;
+
+FTWordsValueExpr : Literal { $$ = $1; }
+ ;
+
+
/* [49] */
RangeExpr : AdditiveExpr { $$ = $1; }
| AdditiveExpr "to" AdditiveExpr
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins