Ghislain Fourny has proposed merging lp:~gislenius/zorba/jsoniq-pair-operator 
into lp:zorba/3.0.

Requested reviews:
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~gislenius/zorba/jsoniq-pair-operator/+merge/91845

Removed JSON computed constructors, JSON direct object constructor and added 
pair (:) operator between RangeExpr and AdditiveExpr (following Nicolae's 
proposal). 
-- 
https://code.launchpad.net/~gislenius/zorba/jsoniq-pair-operator/+merge/91845
Your team Zorba Coders is subscribed to branch lp:zorba/3.0.
=== modified file 'src/compiler/parser/xquery_parser.y'
--- src/compiler/parser/xquery_parser.y	2012-02-01 11:29:03 +0000
+++ src/compiler/parser/xquery_parser.y	2012-02-07 15:10:57 +0000
@@ -858,17 +858,9 @@
 /* ------------ */
 %type <expr> JSONConstructor
 
-%type <expr> JSONComputedPairConstructor
-
-%type <expr> JSONComputedObjectConstructor
-
-%type <expr> JSONComputedArrayConstructor
-
 %type <expr> JSONDirectArrayConstructor
 
-%type <expr> JSONDirectObjectConstructor
-%type <expr> JSONDirectObjectContent
-%type <expr> JSONDirectPairConstructor
+%type <expr> JSONPairConstructor
 
 %type <node> JSONTest
 %type <node> JSONItemTest
@@ -915,7 +907,7 @@
 %destructor { release_hack( $$ ); } FTAnd FTAnyallOption FTBigUnit FTCaseOption FTContent FTDiacriticsOption FTDistance FTExtensionOption FTExtensionSelection FTIgnoreOption opt_FTIgnoreOption FTLanguageOption FTMatchOption FTMatchOptions opt_FTMatchOptions FTMildNot FTOptionDecl FTOr FTOrder FTPosFilter FTPrimary FTPrimaryWithOptions FTRange FTScope FTScoreVar FTSelection FTStemOption FTStopWords FTStopWordOption FTStopWordsInclExcl FTThesaurusID FTThesaurusOption FTTimes opt_FTTimes FTUnaryNot FTUnit FTWeight FTWildCardOption FTWindow FTWords FTWordsValue
 
 // parsenodes: JSON
-%destructor { release_hack( $$ ); } JSONConstructor JSONComputedPairConstructor JSONComputedArrayConstructor JSONComputedObjectConstructor JSONDirectArrayConstructor JSONDirectObjectConstructor JSONDirectObjectContent JSONDirectPairConstructor 
+%destructor { release_hack( $$ ); } JSONConstructor JSONDirectArrayConstructor JSONPairConstructor 
 
 // exprnodes
 %destructor { release_hack( $$ ); } AdditiveExpr AndExpr AxisStep CDataSection CastExpr CastableExpr CommonContent ComparisonExpr CompAttrConstructor CompCommentConstructor CompDocConstructor CompElemConstructor CompPIConstructor CompTextConstructor ComputedConstructor Constructor ContextItemExpr DirCommentConstructor DirElemConstructor DirElemContent DirPIConstructor DirectConstructor BracedExpr BlockExpr EnclosedStatementsAndOptionalExpr BlockStatement Statement Statements StatementsAndExpr StatementsAndOptionalExpr StatementsAndOptionalExprTop SwitchStatement TypeswitchStatement TryStatement CatchListStatement CatchStatement ApplyStatement IfStatement FLWORStatement ReturnStatement VarDeclStatement Expr ExprSingle ExprSimple ExtensionExpr FLWORExpr ReturnExpr FilterExpr FunctionCall IfExpr InstanceofExpr IntersectExceptExpr Literal MultiplicativeExpr NumericLiteral OrExpr OrderedExpr ParenthesizedExpr PathExpr Predicate PrimaryExpr QuantifiedExpr QueryBody RangeExpr RelativePathExpr StepExpr StringLiteral TreatExpr SwitchExpr TypeswitchExpr UnaryExpr UnionExpr UnorderedExpr ValidateExpr ValueExpr VarRef TryExpr CatchListExpr CatchExpr DeleteExpr InsertExpr RenameExpr ReplaceExpr TransformExpr VarNameList VarNameDecl AssignStatement ExitStatement WhileStatement FlowCtlStatement QNAME EQNAME FUNCTION_NAME FTContainsExpr
@@ -3511,13 +3503,24 @@
     ;
 
 RangeExpr :
+        JSONPairConstructor %prec RANGE_REDUCE
+        {
+            $$ = $1;
+        }
+    |   JSONPairConstructor TO JSONPairConstructor
+        {
+            $$ = new RangeExpr( LOC(@$), $1, $3 );
+        }
+    ;
+
+JSONPairConstructor :
         AdditiveExpr %prec RANGE_REDUCE
         {
             $$ = $1;
         }
-    |   AdditiveExpr TO AdditiveExpr
+    |   AdditiveExpr COLON AdditiveExpr
         {
-            $$ = new RangeExpr( LOC(@$), $1, $3 );
+            $$ = new JSON_PairConstructor(LOC(@$), $1, $3);
         }
     ;
 
@@ -6303,58 +6306,6 @@
     {
       $$ = $1;
     }
-  | JSONDirectObjectConstructor
-    {
-      $$ = $1;
-    }
-  | JSONComputedObjectConstructor
-    {
-      $$ = $1;
-    }
-  | JSONComputedArrayConstructor
-    {
-      $$ = $1;
-    }
-  | JSONComputedPairConstructor
-    {
-      $$ = $1;
-    }
-;
-
-
-JSONComputedPairConstructor :
-    PAIR LBRACE ExprSingle COLON ExprSingle RBRACE
-    {
-      $$ = new JSON_PairConstructor(LOC(@$), $3, $5);
-    }
-;
-
-
-JSONComputedObjectConstructor :
-    OBJECT LBRACE Expr RBRACE
-    {
-      $$ = new JSON_ObjectConstructor(LOC(@$), $3);
-    }
-  | OBJECT LBRACE JSONDirectObjectContent RBRACE
-    {
-      $$ = new JSON_ObjectConstructor(LOC(@$), $3);
-    }
-  | OBJECT LBRACE RBRACE
-    {
-      $$ = new JSON_ObjectConstructor(LOC(@$), NULL);
-    }
-;
-
-
-JSONComputedArrayConstructor :
-    ARRAY LBRACE RBRACE
-    {
-      $$ = new JSON_ArrayConstructor(LOC(@$), NULL);
-    }
-  | ARRAY LBRACE Expr RBRACE
-    {
-      $$ = new JSON_ArrayConstructor(LOC(@$), $3);
-    }
 ;
 
 
@@ -6370,36 +6321,6 @@
 ;
 
 
-JSONDirectObjectConstructor :
-    LBRACE JSONDirectObjectContent RBRACE
-    {
-      $$ = new JSON_ObjectConstructor(LOC(@$), $2);
-    }
-;
-
-
-JSONDirectObjectContent :
-    JSONDirectPairConstructor
-    {
-      JSON_DirectObjectContent* jpl = new JSON_DirectObjectContent(LOC(@$));
-      jpl->push_back($1);
-      $$ = jpl;
-    }
-  | JSONDirectObjectContent COMMA JSONDirectPairConstructor
-    {
-      static_cast<JSON_DirectObjectContent*>($1)->push_back($3);
-      $$ = $1;
-    }
-;
-
-JSONDirectPairConstructor :
-    ExprSingle COLON ExprSingle
-    {
-      $$ = new JSON_PairConstructor(LOC(@$), $1, $3);
-    }
-;
-
-
 JSONTest :
     JSONItemTest
     {

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to