blob: 15d992c397764c55a22f058f72493ee6ded2722a [file] [log] [blame]
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -07001// Temporary AsterixExpression Placeholder
2function AExpression () {
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -07003 this._properties = {};
4 this._success = function() {};
5
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -07006 return this;
7}
8
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -07009
10AExpression.prototype.bind = function(options) {
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070011 var options = options || {};
12
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070013 if (options.hasOwnProperty("success")) {
14 this._success = options["success"];
15 }
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -070016
17 if (options.hasOwnProperty("return")) {
18 this._properties["return"] = " return " + options["return"].val();
19 }
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070020};
21
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070022
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -070023AExpression.prototype.run = function(successFn) {
24 var success_fn = successFn;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070025
26 $.ajax({
27 type : 'GET',
genia.likes.science@gmail.comfc5f5092013-06-12 00:49:46 -070028 url : "http://localhost:19002/query",
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -070029 data : {"query" : "use dataverse TinySocial;\n" + this.val()},
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070030 dataType : "json",
31 success : function(data) {
32 success_fn(data);
33 }
34 });
35
36 return this;
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -070037};
38
39
40AExpression.prototype.val = function() {
41
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -070042 var value = "";
43
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -070044 // If there is a dataverse defined, provide it.
45 if (this._properties.hasOwnProperty("dataverse")) {
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -070046 value += "use dataverse " + this._properties["dataverse"] + ";\n";
47 };
48
49 if (this._properties.hasOwnProperty("value")) {
50 value += this._properties["value"];
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -070051 }
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -070052
53 return value;
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -070054};
55
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -070056// @param expressionValue [String]
57AExpression.prototype.set = function(expressionValue) {
58 this._properties["value"] = expressionValue;
59 return this;
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -070060};
61
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -070062
genia.likes.science@gmail.comd2f753e2013-06-12 13:51:03 -070063// Pretty AExpressAliases
64AExpression.prototype.ReturnClause = function(expression) {
65 return this.bind(new ReturnClause(expression));
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -070066};
67
68
69// FunctionExpression
70// Parent: AsterixExpression
71//
72// @param options [Various],
73// @key function [String], a function to be applid to the expression
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -070074// @key expression [AsterixExpression or AQLClause] an AsterixExpression/Clause to which the fn will be applied
75function FunctionExpression() {
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -070076
77 // Initialize superclass
78 AExpression.call(this);
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -070079
80 this._properties["function"] = "";
81 this._properties["expression"] = new AExpression().set("");
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -070082
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -070083 // Check for fn/expression input
84 if (arguments.length == 2 && typeof arguments[0] == "string" &&
85 (arguments[1] instanceof AExpression || arguments[1] instanceof AQLClause)) {
86
87 this._properties["function"] = arguments[0];
88 this._properties["expression"] = arguments[1];
89
90 }
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -070091
92 // Return object
93 return this;
94}
95
96
97FunctionExpression.prototype = Object.create(AExpression.prototype);
98FunctionExpression.prototype.constructor = FunctionExpression;
99
100
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700101FunctionExpression.prototype.fn = function(fnName) {
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700102
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700103 if (typeof fnName == "string") {
104 this._properties["function"] = fnName;
105 }
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700106
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700107 return this;
108};
109
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700110
111FunctionExpression.prototype.expression = function(expression) {
112 if (expression instanceof AExpression || expression instanceof AQLClause) {
113 this._properties["expression"] = expression;
114 }
115
116 return this;
117};
118
119
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700120FunctionExpression.prototype.val = function () {
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700121 return this._properties["function"] + "(" + this._properties["expression"].val() + ")";
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700122};
123
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700124
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700125// FLWOGR ::= ( ForClause | LetClause ) ( Clause )* "return" Expression
126// Clause ::= ForClause | LetClause | WhereClause | OrderbyClause | GroupClause | LimitClause | DistinctClause
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700127//
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700128// WhereClause ::= "where" Expression
129// OrderbyClause ::= "order" "by" Expression ( ( "asc" ) | ( "desc" ) )? ( "," Expression ( ( "asc" ) | ( "desc" ) )? )*
genia.likes.science@gmail.comb4cb6b32013-05-29 04:30:38 -0700130//
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700131// GroupClause ::= "group" "by" ( Variable ":=" )? Expression ( "," ( Variable ":=" )? Expression )* ( "decor" Variable ":=" Expression ( "," "decor" Variable ":=" Expression )* )? "with" VariableRef ( "," VariableRef )*
132// LimitClause ::= "limit" Expression ( "offset" Expression )?
133// DistinctClause ::= "distinct" "by" Expression ( "," Expression )*
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700134
135
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700136// FLWOGRExpression
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700137//
138// FLWOGRExpression ::= ( ForClause | LetClause ) ( Clause )* "return" Expression
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700139function FLWOGRExpression (options) {
140 // Initialize superclass
141 AExpression.call(this);
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700142
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700143 this._properties["clauses"] = [];
genia.likes.science@gmail.com79e603a2013-05-31 10:03:23 -0700144 this._properties["minSize"] = 0;
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700145
146 // Bind options and return
147 this.bind(options);
148 return this;
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700149}
150
151
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700152FLWOGRExpression.prototype = Object.create(AExpression.prototype);
153FLWOGRExpression.prototype.constructor = FLWOGRExpression;
154
155
156FLWOGRExpression.prototype.bind = function(options) {
157 AExpression.prototype.bind.call(this, options);
158
159 var options = options || {};
160
genia.likes.science@gmail.com79e603a2013-05-31 10:03:23 -0700161 if (options instanceof SetStatement) {
162 this._properties["clauses"].push(options);
163 this._properties["minSize"] += 1;
164 }
165
166 if (this._properties["clauses"].length <= this._properties["minSize"]) {
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700167 // Needs to start with for or let clause
168 if (options instanceof ForClause || options instanceof LetClause) {
169 this._properties["clauses"].push(options);
170 }
171 } else {
172 if (options instanceof AQLClause) {
173 this._properties["clauses"].push(options);
174 }
175 }
176
177 return this;
178};
179
180
181FLWOGRExpression.prototype.val = function() {
182 var value = AExpression.prototype.val.call(this);
183
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700184 var clauseValues = [];
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700185 for (var c in this._properties["clauses"]) {
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700186 clauseValues.push(this._properties["clauses"][c].val());
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700187 }
188
genia.likes.science@gmail.com79e603a2013-05-31 10:03:23 -0700189 return value + clauseValues.join("\n");// + ";";
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700190};
191
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700192
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700193// AQLClause
194//
195// Base Clause ::= ForClause | LetClause | WhereClause | OrderbyClause | GroupClause | LimitClause | DistinctClause
196function AQLClause() {
197 this._properties = {};
198 this._properties["clause"] = "";
199}
200
201AQLClause.prototype.val = function() {
202 var value = this._properties["clause"];
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700203
204 return value;
205};
206
207AQLClause.prototype.bind = function(options) {
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700208
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700209 if (options instanceof AQLClause) {
210 this._properties["clause"] += " " + options.val();
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700211 }
212
213 return this;
214};
215
genia.likes.science@gmail.com39578302013-05-31 04:42:26 -0700216AQLClause.prototype.set = function(value) {
217 this._properties["clause"] = value;
218 return this;
219};
220
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700221
genia.likes.science@gmail.comd2f753e2013-06-12 13:51:03 -0700222AQLClause.prototype.ReturnClause = function(expression) {
223 return this.bind(new ReturnClause(expression));
224};
225
226
227
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700228// ForClause
229//
230// Grammar:
231// "for" Variable ( "at" Variable )? "in" ( Expression )
232//
233// @param for_variable [String], REQUIRED, first variable in clause
234// @param at_variable [String], NOT REQUIRED, first variable in clause
235// @param expression [AsterixExpression], REQUIRED, expression to evaluate
236//
237// TODO Error Checking
238function ForClause(for_variable, at_variable, expression) {
239 AQLClause.call(this);
240
241 // at_variable is optional, check if defined
242 var at = typeof at_variable ? at_variable : null;
243
244 // Prepare clause
245 this._properties["clause"] = "for $" + for_variable;
246 if (at != null) {
247 this._properties["clause"] += " at $" + at_variable;
248 }
249 this._properties["clause"] += " in " + expression.val();
250 return this;
251}
252
253ForClause.prototype = Object.create(AQLClause.prototype);
254ForClause.prototype.constructor = ForClause;
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700255
256
257// LetClause
258//
259// Grammar:
260// LetClause ::= "let" Variable ":=" Expression
261//
262// @param let_variable [String]
263// @param expression [AExpression]
264//
265// TODO Vigorous error checking
266function LetClause(let_variable, expression) {
267 AQLClause.call(this);
268
269 this._properties["clause"] = "let $" + let_variable + " := ";
270 this._properties["clause"] += expression.val();
271
272 return this;
273}
274
275LetClause.prototype = Object.create(AQLClause.prototype);
276LetClause.prototype.constructor = LetClause;
277
278
genia.likes.science@gmail.com5ca104c2013-05-29 05:39:26 -0700279// ReturnClause
280//
281// Grammar:
282// return [AQLExpression]
283function ReturnClause(expression) {
284 AQLClause.call(this);
285
286 this._properties["clause"] = "return ";
genia.likes.science@gmail.com5749ef92013-06-12 07:59:25 -0700287
genia.likes.science@gmail.com79e603a2013-05-31 10:03:23 -0700288 if (expression instanceof AExpression || expression instanceof AQLClause) {
genia.likes.science@gmail.com5ca104c2013-05-29 05:39:26 -0700289 this._properties["clause"] += expression.val();
genia.likes.science@gmail.com5749ef92013-06-12 07:59:25 -0700290
291 } else if ( typeof expression == "object" && Object.getPrototypeOf( expression ) === Object.prototype ) {
292
293 // TODO Null object check
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700294
295 this._properties["clause"] += "{";
296 var returnStatements = [];
297 for (returnValue in expression) {
298
299 if (expression[returnValue] instanceof AExpression) {
genia.likes.science@gmail.comfba7cc82013-05-31 04:04:08 -0700300 returnStatements.push('"' + returnValue + '" ' + " : " + expression[returnValue].val());
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700301 } else if (typeof expression[returnValue] == "string") {
genia.likes.science@gmail.comfba7cc82013-05-31 04:04:08 -0700302 returnStatements.push('"' + returnValue + '" ' + " : " + expression[returnValue]);
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700303 }
304 }
305 this._properties["clause"] += returnStatements.join(",\n");
genia.likes.science@gmail.comf7929d82013-06-12 11:30:01 -0700306 this._properties["clause"] += "\n}";
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700307
genia.likes.science@gmail.com5ca104c2013-05-29 05:39:26 -0700308 } else {
genia.likes.science@gmail.com5749ef92013-06-12 07:59:25 -0700309 this._properties["clause"] += new AQLClause().set(expression).val();
genia.likes.science@gmail.com5ca104c2013-05-29 05:39:26 -0700310 }
311
312 return this;
313}
314
genia.likes.science@gmail.com5749ef92013-06-12 07:59:25 -0700315
genia.likes.science@gmail.com5ca104c2013-05-29 05:39:26 -0700316ReturnClause.prototype = Object.create(AQLClause.prototype);
317ReturnClause.prototype.constructor = ReturnClause;
318
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700319
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700320// WhereClause
321//
322// Grammar:
323// ::= "where" Expression
324//
325// @param expression [BooleanExpression], pushes this expression onto the stack
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700326function WhereClause(expression) {
327 AQLClause.call(this);
328
329 this._properties["stack"] = [];
330
331 this.bind(expression);
332
333 return this;
334}
335
336
337WhereClause.prototype = Object.create(AQLClause.prototype);
338WhereClause.prototype.constructor = WhereClause;
339
340
341WhereClause.prototype.bind = function(expression) {
genia.likes.science@gmail.com64ca88e2013-05-31 10:40:39 -0700342 if (expression instanceof AExpression) {
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700343 this._properties["stack"].push(expression);
344 }
345};
346
347
348WhereClause.prototype.val = function() {
349 var value = "where ";
350
351 var count = this._properties["stack"].length - 1;
352 while (count >= 0) {
353 value += this._properties["stack"][count].val() + " ";
354 count -= 1;
355 }
356
357 return value;
genia.likes.science@gmail.com64ca88e2013-05-31 10:40:39 -0700358};
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700359
360
genia.likes.science@gmail.comd2f753e2013-06-12 13:51:03 -0700361WhereClause.prototype.and = function() {
362
363 var andClauses = [];
364 for (var expression in arguments) {
365
366 if (arguments[expression] instanceof AExpression) {
367 andClauses.push(arguments[expression].val());
368 }
369 }
370
371 if (andClauses.length > 0) {
372 this._properties["stack"].push(new AExpression().set(andClauses.join(" and ")));
373 }
374
375 return this;
376};
377
378
379WhereClause.prototype.or = function() {
380 var orClauses = [];
381 for (var expression in arguments) {
382
383 if (arguments[expression] instanceof AExpression) {
384 orClauses.push(arguments[expression].val());
385 }
386 }
387
388 if (andClauses.length > 0) {
389 this._properties["stack"].push(new AExpression().set(orClauses.join(" and ")));
390 }
391
392 return this;
393};
394
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700395// LimitClause
396// Grammar:
397// LimitClause ::= "limit" Expression ( "offset" Expression )?
398//
399// @param limitExpression [REQUIRED, AQLExpression]
400// @param offsetExpression [OPTIONAL, AQLExpression]
401function LimitClause(limitExpression, offsetExpression) {
402
403 AQLClause.call(this);
404
405 // limitExpression required
406 this._properties["clause"] = "limit " + limitExpression.val();
407
408 // Optional: Offset
409 var offset = typeof offsetExpression ? offsetExpression : null;
410 if (offset != null) {
411 this._properties["clause"] += " offset " + offsetExpression.val();
412 }
413
414 return this;
415}
416
417LimitClause.prototype = Object.create(AQLClause.prototype);
418LimitClause.prototype.constructor = LimitClause;
419
420
421// OrderbyClause
422//
423// Grammar:
424// OrderbyClause ::= "order" "by" Expression ( ( "asc" ) | ( "desc" ) )? ( "," Expression ( ( "asc" ) | ( "desc" ) )? )*
425//
426// @params AQLExpressions and asc/desc strings, in any quantity. At least one required.
427function OrderbyClause() {
428
429 AQLClause.call(this);
430
431 // At least one argument expression is required, and first should be expression
432 if (arguments.length == 0 || !(arguments[0] instanceof AExpression)) {
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700433
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700434 // TODO Not sure which error to throw for an empty OrderBy but this should fail.
435 alert("Order By Error");
436 this._properties["clause"] = null;
437 return this;
438 }
439
440 var expc = 0;
441 var expressions = [];
442
443 while (expc < arguments.length) {
444
445 var expression = "";
446
447 if (arguments[expc] instanceof AExpression) {
448 expression += arguments[expc].val();
449 }
450
451 var next = expc + 1;
452 if (next < arguments.length && (arguments[next] == "asc" || arguments[next] == "desc")) {
453 expc++;
454 expression += " " + arguments[expc];
455 }
456
457 expressions.push(expression);
458
459 expc++;
460 }
461
462 this._properties["clause"] = "order by " + expressions.join(", ");
463 return this;
464}
465
466OrderbyClause.prototype = Object.create(AQLClause.prototype);
467OrderbyClause.prototype.constructor = OrderbyClause;
468
469
genia.likes.science@gmail.com6e392912013-05-31 03:46:59 -0700470// GroupClause
471//
472// Grammar:
473// GroupClause ::= "group" "by" ( Variable ":=" )? Expression ( "," ( Variable ":=" )? Expression )* ( "decor" Variable ":=" Expression ( "," "decor" Variable ":=" Expression )* )? "with" VariableRef ( "," VariableRef )*
474function GroupClause() {
475 AQLClause.call(this);
476
477 if (arguments.length == 0) {
478 // TODO Not sure which error to throw for an empty GroupBy but this should fail.
479 alert("Group Error");
480 this._properties["clause"] = null;
481 return this;
482 }
483
484 var expc = 0;
485 var expressions = [];
486 var variableRefs = [];
487 var isDecor = false;
488
489 while (expc < arguments.length) {
490
491 if (arguments[expc] instanceof AExpression) {
492
493 isDecor = false;
494 expressions.push(arguments[expc].val());
495
496 } else if (typeof arguments[expc] == "string") {
497
498 // Special keywords, decor & with
499 if (arguments[expc] == "decor") {
500 isDecor = true;
501 } else if (arguments[expc] == "with") {
502 isDecor = false;
503 expc++;
504 while (expc < arguments.length) {
505 variableRefs.push("$" + arguments[expc]);
506 expc++;
507 }
508
509 // Variables and variable refs
510 } else {
511
512 var nextc = expc + 1;
513 var expression = "";
514
515 if (isDecor) {
516 expression += "decor ";
517 isDecor = false;
518 }
519
520 expression += "$" + arguments[expc] + " := " + arguments[nextc].val();
521 expressions.push(expression);
522 expc++;
523 }
524 }
525
526 expc++;
527 }
528
529 this._properties["clause"] = "group by " + expressions.join(", ") + " with " + variableRefs.join(", ");
530 return this;
531}
532
533GroupClause.prototype = Object.create(AQLClause.prototype);
534GroupClause.prototype.constructor = GroupClause;
535
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700536// BooleanExpression
537//
538// TODO
539function BooleanExpression(expression) {
540 this.value = expression;
genia.likes.science@gmail.com6fd7b2e2013-05-31 00:40:28 -0700541 alert("Debugging Bool: " + arguments.length + " " + expression);
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700542}
543
544BooleanExpression.prototype.val = function() {
545 return this.value;
546}
genia.likes.science@gmail.com79e603a2013-05-31 10:03:23 -0700547
548
549// SetStatement
550//
551// Grammar
552// "set" Identifier StringLiteral
553function SetStatement (identifier, stringLiteral) {
554 AExpression.call(this);
555
556 var statement = "set " + identifier + ' "' + stringLiteral + '";';
557
558 AExpression.prototype.set.call(this, statement);
559
560 return this;
561}
562
563SetStatement.prototype = Object.create(AExpression.prototype);
564SetStatement.prototype.constructor = SetStatement;
genia.likes.science@gmail.come34c57b2013-05-31 10:15:49 -0700565
566
567// Quantified Expression
568//
569// Grammar
570// QuantifiedExpression ::= ( ( "some" ) | ( "every" ) ) Variable "in" Expression ( "," Variable "in" Expression )* "satisfies" Expression
571//
572// @param String some/every
573// @param [AExpression]
574// @param [Aexpression] satisfiesExpression
575function QuantifiedExpression (keyword, expressions, satisfiesExpression) {
576 AExpression.call(this);
577
578 var expression = keyword + " ";
579 var varsInExpressions = [];
580
581 for (var varInExpression in expressions) {
582 varsInExpressions.push(varInExpression + " in " + expressions[varInExpression].val());
583 }
584 expression += varsInExpressions.join(", ") + " satisfies " + satisfiesExpression.val();
585
586 AExpression.prototype.set.call(this, expression);
587
588 return this;
589}
590
591QuantifiedExpression.prototype = Object.create(AExpression.prototype);
592QuantifiedExpression.prototype.constructor = QuantifiedExpression;
genia.likes.science@gmail.com64ca88e2013-05-31 10:40:39 -0700593
594QuantifiedExpression.prototype.val = function() {
595 var value = AExpression.prototype.val.call(this);
596 return "(" + value + ")";
597};