@@ -3,12 +3,12 @@ var _ = require("lodash");
3
3
var { trim} = require ( 'lodash' ) ;
4
4
var { LangUtils} = require ( "@themost/common" ) ;
5
5
var { sprintf} = require ( 'sprintf-js' ) ;
6
- var { SwitchExpression, SelectAnyExpression, OrderByAnyExpression, isLogicalOperator,
6
+ var { SwitchExpression, SelectAnyExpression, OrderByAnyExpression, AnyExpressionFormatter , isLogicalOperator,
7
7
createLogicalExpression, isArithmeticOperator, createArithmeticExpression,
8
8
isArithmeticExpression, isLogicalExpression, isComparisonOperator,
9
9
createMemberExpression,
10
10
createComparisonExpression, isMethodCallExpression, isMemberExpression} = require ( './expressions' ) ;
11
- var { whilst} = require ( 'async' ) ;
11
+ var { whilst, series } = require ( 'async' ) ;
12
12
const { MethodCallExpression } = require ( './expressions' ) ;
13
13
/**
14
14
* @class
@@ -36,7 +36,7 @@ function OpenDataParser() {
36
36
this . tokens = [ ] ;
37
37
/**
38
38
* Gets current token
39
- * @type {Token }
39
+ * @type {Token | IdentifierToken | LiteralToken | SyntaxToken }
40
40
*/
41
41
this . currentToken = undefined ;
42
42
/**
@@ -84,7 +84,7 @@ OpenDataParser.create = function() {
84
84
85
85
/**
86
86
* Gets the logical or arithmetic operator of the given token
87
- * @param token
87
+ * @param { Token | IdentifierToken } token
88
88
*/
89
89
OpenDataParser . prototype . getOperator = function ( token ) {
90
90
if ( token . type === Token . TokenType . Identifier ) {
@@ -485,7 +485,7 @@ OpenDataParser.prototype.parseOrderBySequenceAsync = function(str) {
485
485
486
486
/**
487
487
* @param {{$select?:string,$filter?:string,$orderBy?:string,$groupBy?:string,$top:number,$skip:number} } queryOptions
488
- * @param {function(Error,*) } callback
488
+ * @param {function(Error,*= ) } callback
489
489
*/
490
490
OpenDataParser . prototype . parseQueryOptions = function ( queryOptions , callback ) {
491
491
const self = this ;
@@ -588,7 +588,7 @@ OpenDataParser.prototype.parseCommon = function(callback) {
588
588
if ( self . atEnd ( ) ) {
589
589
callback . call ( self , null , result ) ;
590
590
}
591
- //method call exception for [,] or [)] tokens e.g indexOf(Title,'...')
591
+ //method call exception for "," or "()" tokens e.g indexOf(Title,'...')
592
592
else if ( ( self . currentToken . syntax === SyntaxToken . Comma . syntax ) ||
593
593
( self . currentToken . syntax === SyntaxToken . ParenClose . syntax ) ) {
594
594
callback . call ( self , null , result ) ;
@@ -600,7 +600,7 @@ OpenDataParser.prototype.parseCommon = function(callback) {
600
600
}
601
601
else {
602
602
self . moveNext ( ) ;
603
- // if current operator is a logical operator ($or, $and etc)
603
+ // if current operator is a logical operator ($or, $and etc. )
604
604
// parse right operand by using parseCommon() method
605
605
// important note: the current expression probably is not using parentheses
606
606
// e.g. (category eq 'Laptops' or category eq 'Desktops') and round(price,2) ge 500 and round(price,2) le 1000
@@ -903,7 +903,7 @@ OpenDataParser.prototype.parseMember = function(callback) {
903
903
//format identifier
904
904
identifier += '/' + this . currentToken . identifier ;
905
905
}
906
- //support member to member comparison (with $it identifier e.g. $it/address/city or $it/category etc)
906
+ //support member to member comparison (with $it identifier e.g. $it/address/city or $it/category etc. )
907
907
if ( / ^ \$ i t \/ / . test ( identifier ) ) {
908
908
identifier = identifier . replace ( / ^ \$ i t \/ / , '' ) ;
909
909
}
@@ -1577,6 +1577,7 @@ Token.Operator ={
1577
1577
*/
1578
1578
function LiteralToken ( value , literalType )
1579
1579
{
1580
+ // noinspection JSUnresolvedReference
1580
1581
LiteralToken . super_ . call ( this , Token . TokenType . Literal ) ;
1581
1582
this . value = value ;
1582
1583
this . literalType = literalType ;
@@ -1623,6 +1624,7 @@ LiteralToken.Null = new LiteralToken(null, LiteralToken.LiteralType.Null);
1623
1624
*/
1624
1625
function IdentifierToken ( name )
1625
1626
{
1627
+ // noinspection JSUnresolvedReference
1626
1628
IdentifierToken . super_ . call ( this , Token . TokenType . Identifier ) ;
1627
1629
this . identifier = name ;
1628
1630
}
@@ -1639,6 +1641,7 @@ IdentifierToken.prototype.valueOf = function() {
1639
1641
*/
1640
1642
function SyntaxToken ( chr )
1641
1643
{
1644
+ // noinspection JSUnresolvedReference
1642
1645
SyntaxToken . super_ . call ( this , Token . TokenType . Syntax ) ;
1643
1646
this . syntax = chr ;
1644
1647
}
0 commit comments