1
0
Fork 0

simplified parser

This commit is contained in:
Jan Steemann 2015-06-10 20:25:25 +02:00
parent ba62da36bc
commit d99d164c0a
15 changed files with 964 additions and 1073 deletions

View File

@ -776,15 +776,15 @@ AstNode* Ast::createNodeIndexedAccess (AstNode const* accessed,
}
////////////////////////////////////////////////////////////////////////////////
/// @brief create an AST expand node
/// @brief create an AST expansion node
////////////////////////////////////////////////////////////////////////////////
AstNode* Ast::createNodeExpand (AstNode const* iterator,
AstNode const* expansion) {
AstNode* node = createNode(NODE_TYPE_EXPAND);
AstNode* Ast::createNodeExpansion (AstNode const* iterator,
AstNode const* expanded) {
AstNode* node = createNode(NODE_TYPE_EXPANSION);
node->addMember(iterator);
node->addMember(expansion);
node->addMember(expanded);
return node;
}

View File

@ -446,11 +446,11 @@ namespace triagens {
AstNode const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief create an AST expand node
/// @brief create an AST expansion node
////////////////////////////////////////////////////////////////////////////////
AstNode* createNodeExpand (AstNode const*,
AstNode const*);
AstNode* createNodeExpansion (AstNode const*,
AstNode const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief create an AST iterator node

View File

@ -130,7 +130,7 @@ std::unordered_map<int, std::string const> const AstNode::TypeNames{
{ static_cast<int>(NODE_TYPE_ATTRIBUTE_ACCESS), "attribute access" },
{ static_cast<int>(NODE_TYPE_BOUND_ATTRIBUTE_ACCESS), "bound attribute access" },
{ static_cast<int>(NODE_TYPE_INDEXED_ACCESS), "indexed access" },
{ static_cast<int>(NODE_TYPE_EXPAND), "expand" },
{ static_cast<int>(NODE_TYPE_EXPANSION), "expansion" },
{ static_cast<int>(NODE_TYPE_ITERATOR), "iterator" },
{ static_cast<int>(NODE_TYPE_VALUE), "value" },
{ static_cast<int>(NODE_TYPE_ARRAY), "array" },
@ -555,7 +555,7 @@ AstNode::AstNode (Ast* ast,
case NODE_TYPE_SUBQUERY:
case NODE_TYPE_BOUND_ATTRIBUTE_ACCESS:
case NODE_TYPE_INDEXED_ACCESS:
case NODE_TYPE_EXPAND:
case NODE_TYPE_EXPANSION:
case NODE_TYPE_ITERATOR:
case NODE_TYPE_ARRAY:
case NODE_TYPE_RANGE:
@ -1687,13 +1687,13 @@ void AstNode::stringify (triagens::basics::StringBuffer* buffer,
buffer->appendChar(')');
return;
}
if (type == NODE_TYPE_EXPAND) {
if (type == NODE_TYPE_EXPANSION) {
// not used by V8
buffer->appendText("_EXPAND(");
getMember(1)->stringify(buffer, verbose, failIfLong);
buffer->appendChar(',');
buffer->appendText("_EXPANSION(");
getMember(0)->stringify(buffer, verbose, failIfLong);
buffer->appendChar(',');
getMember(1)->stringify(buffer, verbose, failIfLong);
buffer->appendChar(')');
return;
}

View File

@ -154,7 +154,7 @@ namespace triagens {
NODE_TYPE_ATTRIBUTE_ACCESS = 35,
NODE_TYPE_BOUND_ATTRIBUTE_ACCESS = 36,
NODE_TYPE_INDEXED_ACCESS = 37,
NODE_TYPE_EXPAND = 38,
NODE_TYPE_EXPANSION = 38,
NODE_TYPE_ITERATOR = 39,
NODE_TYPE_VALUE = 40,
NODE_TYPE_ARRAY = 41,

View File

@ -813,22 +813,22 @@ void Executor::generateCodeUserFunctionCall (AstNode const* node) {
/// @brief generate JavaScript code for an expansion (i.e. [*] operator)
////////////////////////////////////////////////////////////////////////////////
void Executor::generateCodeExpand (AstNode const* node) {
void Executor::generateCodeExpansion (AstNode const* node) {
TRI_ASSERT(node != nullptr);
TRI_ASSERT(node->numMembers() == 2);
_buffer->appendText("(function () { var r = []; _AQL.AQL_TO_LIST(");
_buffer->appendText("(function () { return _AQL.AQL_TO_LIST(");
generateCodeNode(node->getMember(0));
_buffer->appendText(").forEach(function (v) { ");
_buffer->appendText(").map(function (v) { ");
auto iterator = node->getMember(0);
auto variable = static_cast<Variable*>(iterator->getMember(0)->getData());
_buffer->appendText("vars[\"");
_buffer->appendText(variable->name);
_buffer->appendText("\"]=v; ");
_buffer->appendText("r.push(");
_buffer->appendText("return ");
generateCodeNode(node->getMember(1));
_buffer->appendText("); }); return r; })()");
_buffer->appendText("; }); })()");
}
////////////////////////////////////////////////////////////////////////////////
@ -967,8 +967,8 @@ void Executor::generateCodeNode (AstNode const* node) {
generateCodeUserFunctionCall(node);
break;
case NODE_TYPE_EXPAND:
generateCodeExpand(node);
case NODE_TYPE_EXPANSION:
generateCodeExpansion(node);
break;
case NODE_TYPE_ITERATOR:

View File

@ -207,7 +207,7 @@ namespace triagens {
/// @brief generate JavaScript code for an expansion (i.e. [*] operator)
////////////////////////////////////////////////////////////////////////////////
void generateCodeExpand (AstNode const*);
void generateCodeExpansion (AstNode const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief generate JavaScript code for an expansion iterator

View File

@ -311,7 +311,7 @@ struct CollectVariableFinder {
auto const size = stack.size();
if (size >= 3 &&
stack[size - 3]->type == NODE_TYPE_EXPAND) {
stack[size - 3]->type == NODE_TYPE_EXPANSION) {
// our variable is used in an expansion, e.g. g[*].attribute
auto expandNode = stack[size - 3];
TRI_ASSERT(expandNode->numMembers() == 2);

File diff suppressed because it is too large Load Diff

View File

@ -86,21 +86,21 @@ extern int Aqldebug;
T_TIMES = 295,
T_DIV = 296,
T_MOD = 297,
T_EXPAND = 298,
T_QUESTION = 299,
T_COLON = 300,
T_SCOPE = 301,
T_RANGE = 302,
T_COMMA = 303,
T_OPEN = 304,
T_CLOSE = 305,
T_OBJECT_OPEN = 306,
T_OBJECT_CLOSE = 307,
T_ARRAY_OPEN = 308,
T_ARRAY_CLOSE = 309,
T_NIN = 310,
UMINUS = 311,
UPLUS = 312,
T_QUESTION = 298,
T_COLON = 299,
T_SCOPE = 300,
T_RANGE = 301,
T_COMMA = 302,
T_OPEN = 303,
T_CLOSE = 304,
T_OBJECT_OPEN = 305,
T_OBJECT_CLOSE = 306,
T_ARRAY_OPEN = 307,
T_ARRAY_CLOSE = 308,
T_NIN = 309,
UMINUS = 310,
UPLUS = 311,
EXPANSION = 312,
FUNCCALL = 313,
REFERENCE = 314,
INDEXED = 315

View File

@ -108,7 +108,6 @@ void Aqlerror (YYLTYPE* locp,
%token T_TIMES "* operator"
%token T_DIV "/ operator"
%token T_MOD "% operator"
%token T_EXPAND "[*] operator"
%token T_QUESTION "?"
%token T_COLON ":"
@ -141,7 +140,7 @@ void Aqlerror (YYLTYPE* locp,
%left T_PLUS T_MINUS
%left T_TIMES T_DIV T_MOD
%right UMINUS UPLUS T_NOT
%left T_EXPAND
%left EXPANSION
%left FUNCCALL
%left REFERENCE
%left INDEXED
@ -182,8 +181,6 @@ void Aqlerror (YYLTYPE* locp,
%type <node> object_element;
%type <strval> object_element_name;
%type <node> reference;
%type <node> single_reference;
%type <node> expansion;
%type <node> atomic_value;
%type <node> value_literal;
%type <node> collection_name;
@ -997,34 +994,6 @@ object_element:
;
reference:
single_reference {
// start of reference (collection or variable name)
$$ = $1;
}
| reference {
// expanded variable access, e.g. variable[*]
// create a temporary iterator variable
std::string const nextName = parser->ast()->variables()->nextName() + "_";
char const* iteratorName = nextName.c_str();
auto iterator = parser->ast()->createNodeIterator(iteratorName, $1);
parser->pushStack(iterator);
parser->pushStack(parser->ast()->createNodeReference(iteratorName));
} T_EXPAND expansion {
// return from the "expansion" subrule
// push the expand node into the statement list
auto iterator = static_cast<AstNode*>(parser->popStack());
$$ = parser->ast()->createNodeExpand(iterator, $4);
if ($$ == nullptr) {
ABORT_OOM
}
}
;
single_reference:
T_STRING {
// variable or collection
auto ast = parser->ast();
@ -1068,47 +1037,49 @@ single_reference:
ABORT_OOM
}
}
| single_reference '.' T_STRING %prec REFERENCE {
| reference '.' T_STRING %prec REFERENCE {
// named variable access, e.g. variable.reference
$$ = parser->ast()->createNodeAttributeAccess($1, $3);
if ($1->type == NODE_TYPE_EXPANSION) {
// if left operand is an expansion already...
// patch the existing expansion
$1->changeMember(1, parser->ast()->createNodeAttributeAccess($1->getMember(1), $3));
$$ = $1;
}
else {
$$ = parser->ast()->createNodeAttributeAccess($1, $3);
}
}
| single_reference '.' bind_parameter %prec REFERENCE {
| reference '.' bind_parameter %prec REFERENCE {
// named variable access, e.g. variable.@reference
$$ = parser->ast()->createNodeBoundAttributeAccess($1, $3);
if ($1->type == NODE_TYPE_EXPANSION) {
// if left operand is an expansion already...
// patch the existing expansion
$1->changeMember(1, parser->ast()->createNodeBoundAttributeAccess($1->getMember(1), $3));
$$ = $1;
}
else {
$$ = parser->ast()->createNodeBoundAttributeAccess($1, $3);
}
}
| single_reference T_ARRAY_OPEN expression T_ARRAY_CLOSE %prec INDEXED {
| reference T_ARRAY_OPEN expression T_ARRAY_CLOSE %prec INDEXED {
// indexed variable access, e.g. variable[index]
$$ = parser->ast()->createNodeIndexedAccess($1, $3);
if ($1->type == NODE_TYPE_EXPANSION) {
// if left operand is an expansion already...
// patch the existing expansion
$1->changeMember(1, parser->ast()->createNodeIndexedAccess($1->getMember(1), $3));
$$ = $1;
}
else {
$$ = parser->ast()->createNodeIndexedAccess($1, $3);
}
}
;
expansion:
'.' T_STRING %prec REFERENCE {
// named variable access, continuation from * expansion, e.g. [*].variable.reference
auto node = static_cast<AstNode*>(parser->popStack());
$$ = parser->ast()->createNodeAttributeAccess(node, $2);
}
| '.' bind_parameter %prec REFERENCE {
// named variable access w/ bind parameter, continuation from * expansion, e.g. [*].variable.@reference
auto node = static_cast<AstNode*>(parser->popStack());
$$ = parser->ast()->createNodeBoundAttributeAccess(node, $2);
}
| T_ARRAY_OPEN expression T_ARRAY_CLOSE %prec INDEXED {
// indexed variable access, continuation from * expansion, e.g. [*].variable[index]
auto node = static_cast<AstNode*>(parser->popStack());
$$ = parser->ast()->createNodeIndexedAccess(node, $2);
}
| expansion '.' T_STRING %prec REFERENCE {
// named variable access, continuation from * expansion, e.g. [*].variable.xx.reference
$$ = parser->ast()->createNodeAttributeAccess($1, $3);
}
| expansion '.' bind_parameter %prec REFERENCE {
// named variable access w/ bind parameter, continuation from * expansion, e.g. [*].variable.xx.@reference
$$ = parser->ast()->createNodeBoundAttributeAccess($1, $3);
}
| expansion T_ARRAY_OPEN expression T_ARRAY_CLOSE %prec INDEXED {
// indexed variable access, continuation from * expansion, e.g. [*].variable.xx.[index]
$$ = parser->ast()->createNodeIndexedAccess($1, $3);
| reference T_ARRAY_OPEN T_TIMES T_ARRAY_CLOSE %prec EXPANSION {
// variable expansion, e.g. variable[*]
// create a temporary iterator variable
std::string const nextName = parser->ast()->variables()->nextName() + "_";
char const* iteratorName = nextName.c_str();
auto iterator = parser->ast()->createNodeIterator(iteratorName, $1);
$$ = parser->ast()->createNodeExpansion(iterator, parser->ast()->createNodeReference(iteratorName));
}
;

View File

@ -381,8 +381,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 81
#define YY_END_OF_BUFFER 82
#define YY_NUM_RULES 80
#define YY_END_OF_BUFFER 81
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@ -390,28 +390,28 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[191] =
static yyconst flex_int16_t yy_accept[189] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 82, 80, 70, 71, 31, 57, 80, 38,
80, 62, 45, 46, 36, 34, 44, 35, 80, 37,
67, 67, 41, 29, 30, 27, 39, 80, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
51, 51, 49, 50, 80, 52, 47, 80, 48, 56,
55, 56, 53, 66, 65, 63, 66, 61, 60, 58,
61, 74, 73, 77, 79, 78, 70, 25, 51, 32,
43, 75, 72, 0, 0, 67, 40, 28, 24, 26,
69, 0, 0, 51, 51, 51, 51, 51, 51, 51,
0, 0, 81, 79, 69, 70, 31, 56, 79, 38,
79, 61, 44, 45, 36, 34, 43, 35, 79, 37,
66, 66, 41, 29, 30, 27, 39, 79, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 48, 49, 79, 51, 46, 79, 47, 55,
54, 55, 52, 65, 64, 62, 65, 60, 59, 57,
60, 73, 72, 76, 78, 77, 69, 25, 50, 32,
42, 74, 71, 0, 0, 66, 40, 28, 24, 26,
68, 0, 0, 50, 50, 50, 50, 50, 50, 50,
51, 13, 51, 51, 51, 51, 12, 51, 51, 51,
51, 51, 0, 51, 0, 33, 54, 64, 59, 74,
77, 76, 68, 0, 68, 69, 69, 11, 8, 51,
51, 51, 51, 1, 51, 51, 2, 51, 10, 51,
51, 51, 51, 51, 51, 51, 51, 51, 42, 51,
51, 69, 69, 51, 9, 51, 51, 51, 14, 51,
21, 51, 51, 51, 6, 22, 51, 51, 15, 51,
23, 51, 51, 7, 51, 51, 51, 51, 51, 51,
3, 17, 16, 51, 4, 18, 20, 5, 19, 0
50, 13, 50, 50, 50, 50, 12, 50, 50, 50,
50, 50, 50, 0, 33, 53, 63, 58, 73, 76,
75, 67, 0, 67, 68, 68, 11, 8, 50, 50,
50, 50, 1, 50, 50, 2, 50, 10, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 68,
68, 50, 9, 50, 50, 50, 14, 50, 21, 50,
50, 50, 6, 22, 50, 50, 15, 50, 23, 50,
50, 7, 50, 50, 50, 50, 50, 50, 3, 17,
16, 50, 4, 18, 20, 5, 19, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@ -457,58 +457,58 @@ static yyconst flex_int32_t yy_meta[71] =
6, 6, 6, 6, 6, 6, 6, 1, 1, 1
} ;
static yyconst flex_int16_t yy_base[211] =
static yyconst flex_int16_t yy_base[209] =
{ 0,
0, 0, 68, 69, 70, 73, 75, 78, 377, 373,
72, 74, 370, 399, 367, 399, 340, 399, 0, 399,
347, 399, 399, 399, 399, 399, 399, 399, 332, 73,
58, 73, 321, 313, 271, 267, 399, 62, 64, 0,
0, 0, 68, 69, 70, 73, 75, 78, 367, 366,
72, 74, 362, 399, 353, 399, 326, 399, 0, 399,
333, 399, 399, 399, 399, 399, 399, 399, 319, 73,
58, 73, 273, 267, 261, 260, 399, 62, 64, 0,
60, 69, 75, 69, 76, 96, 68, 83, 97, 98,
101, 107, 271, 399, 234, 399, 399, 211, 399, 399,
101, 107, 399, 399, 232, 399, 399, 209, 399, 399,
399, 0, 399, 399, 399, 399, 0, 399, 399, 399,
0, 0, 399, 0, 399, 261, 275, 399, 0, 399,
0, 0, 399, 0, 399, 260, 272, 399, 0, 399,
399, 399, 399, 75, 128, 134, 399, 399, 399, 399,
0, 117, 226, 0, 115, 117, 114, 109, 117, 120,
0, 117, 225, 0, 115, 117, 114, 109, 117, 120,
116, 118, 125, 134, 129, 139, 0, 145, 136, 134,
150, 143, 226, 176, 188, 399, 399, 399, 399, 0,
0, 399, 182, 77, 186, 0, 178, 0, 0, 151,
160, 151, 156, 0, 180, 178, 0, 183, 0, 183,
181, 185, 179, 181, 193, 199, 197, 196, 399, 0,
211, 54, 0, 201, 0, 202, 204, 198, 0, 202,
0, 204, 222, 213, 0, 0, 212, 217, 0, 230,
0, 222, 221, 0, 233, 236, 229, 237, 227, 228,
0, 0, 0, 241, 0, 0, 0, 0, 0, 399,
294, 301, 308, 315, 322, 92, 326, 330, 332, 339,
150, 143, 176, 188, 399, 399, 399, 399, 0, 0,
399, 182, 77, 186, 0, 178, 0, 0, 151, 160,
151, 156, 0, 180, 178, 0, 183, 0, 183, 181,
185, 179, 181, 193, 199, 197, 196, 0, 211, 54,
0, 201, 0, 202, 204, 198, 0, 202, 0, 204,
222, 213, 0, 0, 212, 217, 0, 230, 0, 222,
221, 0, 233, 236, 229, 237, 227, 228, 0, 0,
0, 241, 0, 0, 0, 0, 0, 399, 294, 301,
308, 315, 322, 92, 326, 330, 332, 339, 346, 353,
346, 353, 360, 367, 371, 375, 379, 383, 387, 391
360, 367, 371, 375, 379, 383, 387, 391
} ;
static yyconst flex_int16_t yy_def[211] =
static yyconst flex_int16_t yy_def[209] =
{ 0,
190, 1, 191, 191, 192, 192, 193, 193, 194, 194,
195, 195, 190, 190, 190, 190, 190, 190, 196, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 197, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 190, 190, 199, 190, 190, 190, 190, 190,
190, 200, 190, 190, 190, 190, 201, 190, 190, 190,
202, 203, 190, 204, 190, 190, 190, 190, 198, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
205, 197, 206, 198, 198, 198, 198, 198, 198, 198,
188, 1, 189, 189, 190, 190, 191, 191, 192, 192,
193, 193, 188, 188, 188, 188, 188, 188, 194, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 195, 196, 196,
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
196, 196, 188, 188, 197, 188, 188, 188, 188, 188,
188, 198, 188, 188, 188, 188, 199, 188, 188, 188,
200, 201, 188, 202, 188, 188, 188, 188, 196, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
203, 195, 204, 196, 196, 196, 196, 196, 196, 196,
198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 190, 207, 199, 190, 190, 190, 190, 203,
204, 190, 190, 190, 190, 205, 208, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 190, 209,
207, 208, 210, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 198, 0,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
196, 196, 205, 197, 188, 188, 188, 188, 201, 202,
188, 188, 188, 188, 203, 206, 196, 196, 196, 196,
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
196, 196, 196, 196, 196, 196, 196, 207, 205, 206,
208, 196, 196, 196, 196, 196, 196, 196, 196, 196,
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
196, 196, 196, 196, 196, 196, 196, 0, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190
188, 188, 188, 188, 188, 188, 188, 188
} ;
static yyconst flex_int16_t yy_nxt[470] =
@ -522,48 +522,48 @@ static yyconst flex_int16_t yy_nxt[470] =
40, 48, 49, 50, 51, 40, 52, 57, 58, 59,
61, 61, 65, 84, 75, 65, 75, 69, 66, 70,
69, 66, 70, 76, 82, 76, 92, 85, 84, 83,
86, 86, 123, 123, 125, 125, 97, 79, 98, 95,
86, 86, 122, 122, 124, 124, 97, 79, 98, 95,
99, 153, 85, 96, 102, 103, 107, 100, 104, 93,
99, 151, 85, 96, 102, 103, 107, 100, 104, 93,
85, 101, 108, 62, 62, 67, 63, 63, 67, 97,
71, 98, 95, 71, 99, 85, 96, 102, 103, 107,
100, 104, 105, 109, 101, 108, 110, 106, 111, 112,
124, 190, 124, 128, 129, 125, 125, 130, 131, 84,
132, 86, 86, 133, 134, 105, 109, 135, 136, 110,
106, 111, 112, 85, 93, 137, 128, 129, 138, 139,
130, 131, 140, 132, 144, 145, 133, 134, 146, 141,
135, 136, 142, 148, 154, 143, 85, 155, 137, 147,
156, 138, 139, 150, 150, 140, 157, 144, 145, 123,
123, 188, 123, 127, 128, 124, 124, 129, 130, 84,
131, 86, 86, 132, 133, 105, 109, 134, 135, 110,
106, 111, 112, 85, 93, 136, 127, 128, 137, 138,
129, 130, 139, 131, 143, 144, 132, 133, 145, 140,
134, 135, 141, 147, 152, 142, 85, 153, 136, 146,
154, 137, 138, 148, 148, 139, 155, 143, 144, 122,
123, 146, 141, 125, 125, 142, 148, 154, 143, 158,
155, 85, 147, 156, 159, 160, 161, 162, 163, 157,
164, 165, 166, 150, 167, 153, 168, 169, 150, 150,
170, 171, 158, 172, 85, 115, 173, 159, 160, 161,
162, 163, 174, 164, 165, 166, 175, 176, 167, 168,
169, 177, 178, 170, 171, 179, 172, 180, 150, 173,
181, 182, 183, 184, 185, 174, 186, 187, 188, 175,
189, 176, 149, 93, 177, 178, 77, 122, 179, 116,
180, 115, 113, 181, 182, 183, 184, 185, 90, 186,
187, 188, 89, 189, 60, 60, 60, 60, 60, 60,
122, 145, 140, 124, 124, 141, 147, 152, 142, 156,
153, 85, 146, 154, 157, 158, 159, 160, 161, 155,
162, 163, 164, 148, 165, 151, 166, 167, 148, 148,
168, 169, 156, 170, 85, 114, 171, 157, 158, 159,
160, 161, 172, 162, 163, 164, 173, 174, 165, 166,
167, 175, 176, 168, 169, 177, 170, 178, 148, 171,
179, 180, 181, 182, 183, 172, 184, 185, 186, 173,
187, 174, 93, 77, 175, 176, 121, 115, 177, 114,
178, 90, 89, 179, 180, 181, 182, 183, 88, 184,
185, 186, 87, 187, 60, 60, 60, 60, 60, 60,
60, 64, 64, 64, 64, 64, 64, 64, 68, 68,
68, 68, 68, 68, 68, 72, 72, 72, 72, 72,
72, 72, 74, 74, 74, 74, 74, 74, 74, 91,
91, 91, 91, 94, 88, 94, 94, 114, 114, 117,
87, 117, 117, 117, 117, 117, 118, 81, 118, 118,
118, 118, 118, 119, 80, 119, 119, 119, 119, 119,
120, 78, 120, 120, 120, 120, 120, 121, 77, 190,
121, 121, 121, 121, 126, 73, 126, 126, 127, 73,
127, 127, 151, 190, 151, 151, 152, 190, 152, 152,
150, 190, 150, 150, 153, 190, 153, 153, 13, 190,
91, 91, 91, 94, 81, 94, 94, 113, 113, 116,
80, 116, 116, 116, 116, 116, 117, 78, 117, 117,
117, 117, 117, 118, 77, 118, 118, 118, 118, 118,
119, 188, 119, 119, 119, 119, 119, 120, 73, 73,
120, 120, 120, 120, 125, 188, 125, 125, 126, 188,
126, 126, 149, 188, 149, 149, 150, 188, 150, 150,
148, 188, 148, 148, 151, 188, 151, 151, 13, 188,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188
} ;
static yyconst flex_int16_t yy_chk[470] =
@ -577,9 +577,9 @@ static yyconst flex_int16_t yy_chk[470] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3, 4, 5, 31, 11, 6, 12, 7, 5, 7,
8, 6, 8, 11, 30, 12, 38, 31, 32, 30,
32, 32, 84, 84, 124, 124, 41, 196, 42, 39,
32, 32, 84, 84, 123, 123, 41, 194, 42, 39,
43, 152, 32, 39, 44, 45, 47, 43, 45, 38,
43, 150, 32, 39, 44, 45, 47, 43, 45, 38,
31, 43, 48, 3, 4, 5, 3, 4, 6, 41,
7, 42, 39, 8, 43, 32, 39, 44, 45, 47,
43, 45, 46, 49, 43, 48, 50, 46, 51, 52,
@ -587,48 +587,48 @@ static yyconst flex_int16_t yy_chk[470] =
99, 86, 86, 100, 101, 46, 49, 102, 102, 50,
46, 51, 52, 86, 92, 103, 95, 96, 104, 105,
97, 98, 106, 99, 109, 110, 100, 101, 111, 108,
102, 102, 108, 112, 130, 108, 86, 131, 103, 111,
132, 104, 105, 114, 114, 106, 133, 109, 110, 123,
102, 102, 108, 112, 129, 108, 86, 130, 103, 111,
131, 104, 105, 113, 113, 106, 132, 109, 110, 122,
123, 111, 108, 125, 125, 108, 112, 130, 108, 135,
131, 123, 111, 132, 136, 138, 140, 141, 142, 133,
143, 144, 145, 114, 146, 127, 147, 148, 151, 151,
154, 156, 135, 157, 123, 115, 158, 136, 138, 140,
141, 142, 160, 143, 144, 145, 162, 163, 146, 147,
148, 164, 167, 154, 156, 168, 157, 170, 151, 158,
172, 173, 175, 176, 177, 160, 178, 179, 180, 162,
184, 163, 113, 93, 164, 167, 77, 76, 168, 58,
170, 55, 53, 172, 173, 175, 176, 177, 36, 178,
179, 180, 35, 184, 191, 191, 191, 191, 191, 191,
122, 111, 108, 124, 124, 108, 112, 129, 108, 134,
130, 122, 111, 131, 135, 137, 139, 140, 141, 132,
142, 143, 144, 113, 145, 126, 146, 147, 149, 149,
152, 154, 134, 155, 122, 114, 156, 135, 137, 139,
140, 141, 158, 142, 143, 144, 160, 161, 145, 146,
147, 162, 165, 152, 154, 166, 155, 168, 149, 156,
170, 171, 173, 174, 175, 158, 176, 177, 178, 160,
182, 161, 93, 77, 162, 165, 76, 58, 166, 55,
168, 36, 35, 170, 171, 173, 174, 175, 34, 176,
177, 178, 33, 182, 189, 189, 189, 189, 189, 189,
191, 192, 192, 192, 192, 192, 192, 192, 193, 193,
193, 193, 193, 193, 193, 194, 194, 194, 194, 194,
194, 194, 195, 195, 195, 195, 195, 195, 195, 197,
197, 197, 197, 198, 34, 198, 198, 199, 199, 200,
33, 200, 200, 200, 200, 200, 201, 29, 201, 201,
201, 201, 201, 202, 21, 202, 202, 202, 202, 202,
203, 17, 203, 203, 203, 203, 203, 204, 15, 13,
204, 204, 204, 204, 205, 10, 205, 205, 206, 9,
206, 206, 207, 0, 207, 207, 208, 0, 208, 208,
209, 0, 209, 209, 210, 0, 210, 210, 190, 190,
189, 190, 190, 190, 190, 190, 190, 190, 191, 191,
191, 191, 191, 191, 191, 192, 192, 192, 192, 192,
192, 192, 193, 193, 193, 193, 193, 193, 193, 195,
195, 195, 195, 196, 29, 196, 196, 197, 197, 198,
21, 198, 198, 198, 198, 198, 199, 17, 199, 199,
199, 199, 199, 200, 15, 200, 200, 200, 200, 200,
201, 13, 201, 201, 201, 201, 201, 202, 10, 9,
202, 202, 202, 202, 203, 0, 203, 203, 204, 0,
204, 204, 205, 0, 205, 205, 206, 0, 206, 206,
207, 0, 207, 207, 208, 0, 208, 208, 188, 188,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
190, 190, 190, 190, 190, 190, 190, 190, 190
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 188
} ;
/* Table of booleans, true if rule could match eol. */
static yyconst flex_int32_t yy_rule_can_match_eol[82] =
static yyconst flex_int32_t yy_rule_can_match_eol[81] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1,
0, 0, };
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0,
0, };
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
@ -987,13 +987,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 191 )
if ( yy_current_state >= 189 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_current_state != 190 );
while ( yy_current_state != 188 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
@ -1279,12 +1279,6 @@ YY_RULE_SETUP
YY_BREAK
case 42:
YY_RULE_SETUP
{
return T_EXPAND;
}
YY_BREAK
case 43:
YY_RULE_SETUP
{
return T_RANGE;
}
@ -1292,43 +1286,43 @@ YY_RULE_SETUP
/* ---------------------------------------------------------------------------
* punctuation
* --------------------------------------------------------------------------- */
case 44:
case 43:
YY_RULE_SETUP
{
return T_COMMA;
}
YY_BREAK
case 45:
case 44:
YY_RULE_SETUP
{
return T_OPEN;
}
YY_BREAK
case 46:
case 45:
YY_RULE_SETUP
{
return T_CLOSE;
}
YY_BREAK
case 47:
case 46:
YY_RULE_SETUP
{
return T_OBJECT_OPEN;
}
YY_BREAK
case 48:
case 47:
YY_RULE_SETUP
{
return T_OBJECT_CLOSE;
}
YY_BREAK
case 49:
case 48:
YY_RULE_SETUP
{
return T_ARRAY_OPEN;
}
YY_BREAK
case 50:
case 49:
YY_RULE_SETUP
{
return T_ARRAY_CLOSE;
@ -1337,7 +1331,7 @@ YY_RULE_SETUP
/* ---------------------------------------------------------------------------
* literals
* --------------------------------------------------------------------------- */
case 51:
case 50:
YY_RULE_SETUP
{
/* unquoted string */
@ -1345,7 +1339,7 @@ YY_RULE_SETUP
return T_STRING;
}
YY_BREAK
case 52:
case 51:
YY_RULE_SETUP
{
/* string enclosed in backticks */
@ -1353,7 +1347,7 @@ YY_RULE_SETUP
BEGIN(BACKTICK);
}
YY_BREAK
case 53:
case 52:
YY_RULE_SETUP
{
/* end of backtick-enclosed string */
@ -1362,36 +1356,36 @@ YY_RULE_SETUP
return T_STRING;
}
YY_BREAK
case 54:
case 53:
YY_RULE_SETUP
{
/* character escaped by backslash */
BEGIN(BACKTICK);
}
YY_BREAK
case 55:
/* rule 55 can match eol */
case 54:
/* rule 54 can match eol */
YY_RULE_SETUP
{
/* newline character inside backtick */
BEGIN(BACKTICK);
}
YY_BREAK
case 56:
case 55:
YY_RULE_SETUP
{
/* any character (except newline) inside backtick */
BEGIN(BACKTICK);
}
YY_BREAK
case 57:
case 56:
YY_RULE_SETUP
{
yyextra->marker(yyextra->queryString() + yyextra->offset());
BEGIN(DOUBLE_QUOTE);
}
YY_BREAK
case 58:
case 57:
YY_RULE_SETUP
{
/* end of quote-enclosed string */
@ -1400,36 +1394,36 @@ YY_RULE_SETUP
return T_QUOTED_STRING;
}
YY_BREAK
case 59:
case 58:
YY_RULE_SETUP
{
/* character escaped by backslash */
BEGIN(DOUBLE_QUOTE);
}
YY_BREAK
case 60:
/* rule 60 can match eol */
case 59:
/* rule 59 can match eol */
YY_RULE_SETUP
{
/* newline character inside quote */
BEGIN(DOUBLE_QUOTE);
}
YY_BREAK
case 60:
YY_RULE_SETUP
{
/* any character (except newline) inside quote */
BEGIN(DOUBLE_QUOTE);
}
YY_BREAK
case 61:
YY_RULE_SETUP
{
/* any character (except newline) inside quote */
BEGIN(DOUBLE_QUOTE);
}
YY_BREAK
case 62:
YY_RULE_SETUP
{
yyextra->marker(yyextra->queryString() + yyextra->offset());
BEGIN(SINGLE_QUOTE);
}
YY_BREAK
case 63:
case 62:
YY_RULE_SETUP
{
/* end of quote-enclosed string */
@ -1438,29 +1432,29 @@ YY_RULE_SETUP
return T_QUOTED_STRING;
}
YY_BREAK
case 64:
case 63:
YY_RULE_SETUP
{
/* character escaped by backslash */
BEGIN(SINGLE_QUOTE);
}
YY_BREAK
case 65:
/* rule 65 can match eol */
case 64:
/* rule 64 can match eol */
YY_RULE_SETUP
{
/* newline character inside quote */
BEGIN(SINGLE_QUOTE);
}
YY_BREAK
case 66:
case 65:
YY_RULE_SETUP
{
/* any character (except newline) inside quote */
BEGIN(SINGLE_QUOTE);
}
YY_BREAK
case 67:
case 66:
YY_RULE_SETUP
{
/* a numeric integer value */
@ -1487,7 +1481,7 @@ YY_RULE_SETUP
return T_INTEGER;
}
YY_BREAK
case 68:
case 67:
YY_RULE_SETUP
{
/* a numeric double value */
@ -1512,7 +1506,7 @@ YY_RULE_SETUP
/* ---------------------------------------------------------------------------
* bind parameters
* --------------------------------------------------------------------------- */
case 69:
case 68:
YY_RULE_SETUP
{
/* bind parameters must start with a @
@ -1524,78 +1518,78 @@ YY_RULE_SETUP
/* ---------------------------------------------------------------------------
* whitespace etc.
* --------------------------------------------------------------------------- */
case 70:
case 69:
YY_RULE_SETUP
{
/* whitespace is ignored */
}
YY_BREAK
case 71:
/* rule 71 can match eol */
case 70:
/* rule 70 can match eol */
YY_RULE_SETUP
{
yycolumn = 0;
}
YY_BREAK
case 72:
case 71:
YY_RULE_SETUP
{
BEGIN(COMMENT_SINGLE);
}
YY_BREAK
case 73:
/* rule 73 can match eol */
case 72:
/* rule 72 can match eol */
YY_RULE_SETUP
{
yylineno++;
BEGIN(INITIAL);
}
YY_BREAK
case 74:
case 73:
YY_RULE_SETUP
{
// eat comment in chunks
}
YY_BREAK
case 75:
case 74:
YY_RULE_SETUP
{
BEGIN(COMMENT_MULTI);
}
YY_BREAK
case 76:
case 75:
YY_RULE_SETUP
{
BEGIN(INITIAL);
}
YY_BREAK
case 77:
case 76:
YY_RULE_SETUP
{
// eat comment in chunks
}
YY_BREAK
case 78:
case 77:
YY_RULE_SETUP
{
// eat the lone star
}
YY_BREAK
case 79:
/* rule 79 can match eol */
case 78:
/* rule 78 can match eol */
YY_RULE_SETUP
{
yylineno++;
}
YY_BREAK
case 80:
case 79:
YY_RULE_SETUP
{
/* anything else is returned as it is */
return (int) yytext[0];
}
YY_BREAK
case 81:
case 80:
YY_RULE_SETUP
ECHO;
YY_BREAK
@ -1899,7 +1893,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 191 )
if ( yy_current_state >= 189 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@ -1928,11 +1922,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 191 )
if ( yy_current_state >= 189 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 190);
yy_is_jam = (yy_current_state == 188);
(void)yyg;
return yy_is_jam ? 0 : yy_current_state;

View File

@ -233,10 +233,6 @@ namespace triagens {
return T_COLON;
}
"[*]" {
return T_EXPAND;
}
".." {
return T_RANGE;
}

View File

@ -347,8 +347,11 @@ function processQuery (query, explain) {
case "range":
return buildExpression(node.subNodes[0]) + " .. " + buildExpression(node.subNodes[1]) + " " + annotation("/* range */");
case "expand":
case "expansion":
references[node.subNodes[0].subNodes[0].name] = node.subNodes[0].subNodes[1];
return buildExpression(node.subNodes[1]);
case "verticalizer":
return buildExpression(node.subNodes[0]);
case "user function call":
return func(node.name) + "(" + ((node.subNodes && node.subNodes[0].subNodes) || [ ]).map(buildExpression).join(", ") + ")" + " " + annotation("/* user-defined function */");
case "function call":

View File

@ -346,8 +346,11 @@ function processQuery (query, explain) {
case "range":
return buildExpression(node.subNodes[0]) + " .. " + buildExpression(node.subNodes[1]) + " " + annotation("/* range */");
case "expand":
case "expansion":
references[node.subNodes[0].subNodes[0].name] = node.subNodes[0].subNodes[1];
return buildExpression(node.subNodes[1]);
case "verticalizer":
return buildExpression(node.subNodes[0]);
case "user function call":
return func(node.name) + "(" + ((node.subNodes && node.subNodes[0].subNodes) || [ ]).map(buildExpression).join(", ") + ")" + " " + annotation("/* user-defined function */");
case "function call":

View File

@ -492,7 +492,7 @@ namespace triagens {
/// @brief appends as json-encoded
////////////////////////////////////////////////////////////////////////////////
StringBuffer& appendJsonEncoded (const char * str) {
StringBuffer& appendJsonEncoded (char const* str) {
TRI_AppendJsonEncodedStringStringBuffer(&_buffer, str, true);
return *this;
}
@ -501,7 +501,7 @@ namespace triagens {
/// @brief appends characters
////////////////////////////////////////////////////////////////////////////////
StringBuffer& appendText (const char * str, size_t len) {
StringBuffer& appendText (char const* str, size_t len) {
TRI_AppendString2StringBuffer(&_buffer, str, len);
return *this;
}
@ -510,8 +510,8 @@ namespace triagens {
/// @brief appends characters
////////////////////////////////////////////////////////////////////////////////
StringBuffer& appendText (const char * str) {
TRI_AppendStringStringBuffer(&_buffer, str);
StringBuffer& appendText (char const* str) {
TRI_AppendString2StringBuffer(&_buffer, str, strlen(str));
return *this;
}