1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
a-brandt 2013-02-13 13:29:03 +01:00
commit 067a8d54fb
8 changed files with 668 additions and 545 deletions

View File

@ -263,6 +263,8 @@ BOOST_AUTO_TEST_CASE (tst_int32) {
CHECK_CONVERSION_INT32(10L, "10", buffer)
CHECK_CONVERSION_INT32(100000L, "100000", buffer)
CHECK_CONVERSION_INT32(10000009L, "10000009", buffer)
CHECK_CONVERSION_INT32(2147483646L, "2147483646", buffer)
CHECK_CONVERSION_INT32(2147483647L, "2147483647", buffer)
CHECK_CONVERSION_INT32(INT32_MAX, "2147483647", buffer)
CHECK_CONVERSION_INT32(-1L, "-1", buffer)
@ -271,7 +273,13 @@ BOOST_AUTO_TEST_CASE (tst_int32) {
CHECK_CONVERSION_INT32(-10000009L, "-10000009", buffer)
CHECK_CONVERSION_INT32(-2147483646L, "-2147483646", buffer)
CHECK_CONVERSION_INT32(-2147483647L, "-2147483647", buffer)
CHECK_CONVERSION_INT32(-2147483648L, "-2147483648", buffer)
CHECK_CONVERSION_INT32(INT32_MIN, "-2147483648", buffer)
CHECK_CONVERSION_INT32(65535L, "65535", buffer)
CHECK_CONVERSION_INT32(65536L, "65536", buffer)
CHECK_CONVERSION_INT32(-65535L, "-65535", buffer)
CHECK_CONVERSION_INT32(-65536L, "-65536", buffer)
}
////////////////////////////////////////////////////////////////////////////////
@ -290,6 +298,9 @@ BOOST_AUTO_TEST_CASE (tst_uint32) {
CHECK_CONVERSION_UINT32(2147483647UL, "2147483647", buffer)
CHECK_CONVERSION_UINT32(4294967295UL, "4294967295", buffer)
CHECK_CONVERSION_UINT32(UINT32_MAX, "4294967295", buffer)
CHECK_CONVERSION_UINT32(65535UL, "65535", buffer)
CHECK_CONVERSION_UINT32(65536UL, "65536", buffer)
}
////////////////////////////////////////////////////////////////////////////////
@ -316,6 +327,12 @@ BOOST_AUTO_TEST_CASE (tst_int64) {
CHECK_CONVERSION_INT64(-562949953421311LL, "-562949953421311", buffer)
CHECK_CONVERSION_INT64(-9223372036854775807LL, "-9223372036854775807", buffer)
CHECK_CONVERSION_INT64(INT64_MIN, "-9223372036854775808", buffer)
CHECK_CONVERSION_INT64(2147483647LL, "2147483647", buffer)
CHECK_CONVERSION_INT64(2147483648LL, "2147483648", buffer)
CHECK_CONVERSION_INT64(-2147483647LL, "-2147483647", buffer)
CHECK_CONVERSION_INT64(-2147483648LL, "-2147483648", buffer)
CHECK_CONVERSION_INT64(-2147483649LL, "-2147483649", buffer)
}
////////////////////////////////////////////////////////////////////////////////
@ -337,6 +354,9 @@ BOOST_AUTO_TEST_CASE (tst_uint64) {
CHECK_CONVERSION_UINT64(9223372036854775808ULL, "9223372036854775808", buffer)
CHECK_CONVERSION_UINT64(18446744073709551614ULL, "18446744073709551614", buffer)
CHECK_CONVERSION_UINT64(UINT64_MAX, "18446744073709551615", buffer)
CHECK_CONVERSION_UINT64(2147483647ULL, "2147483647", buffer)
CHECK_CONVERSION_UINT64(2147483648ULL, "2147483648", buffer)
}
////////////////////////////////////////////////////////////////////////////////

File diff suppressed because it is too large Load Diff

View File

@ -56,38 +56,39 @@
T_FALSE = 271,
T_STRING = 272,
T_QUOTED_STRING = 273,
T_NUMBER = 274,
T_PARAMETER = 275,
T_ASSIGN = 276,
T_NOT = 277,
T_AND = 278,
T_OR = 279,
T_EQ = 280,
T_NE = 281,
T_LT = 282,
T_GT = 283,
T_LE = 284,
T_GE = 285,
T_PLUS = 286,
T_MINUS = 287,
T_TIMES = 288,
T_DIV = 289,
T_MOD = 290,
T_EXPAND = 291,
T_QUESTION = 292,
T_COLON = 293,
T_COMMA = 294,
T_OPEN = 295,
T_CLOSE = 296,
T_DOC_OPEN = 297,
T_DOC_CLOSE = 298,
T_LIST_OPEN = 299,
T_LIST_CLOSE = 300,
UPLUS = 301,
UMINUS = 302,
FUNCCALL = 303,
REFERENCE = 304,
INDEXED = 305
T_INTEGER = 274,
T_DOUBLE = 275,
T_PARAMETER = 276,
T_ASSIGN = 277,
T_NOT = 278,
T_AND = 279,
T_OR = 280,
T_EQ = 281,
T_NE = 282,
T_LT = 283,
T_GT = 284,
T_LE = 285,
T_GE = 286,
T_PLUS = 287,
T_MINUS = 288,
T_TIMES = 289,
T_DIV = 290,
T_MOD = 291,
T_EXPAND = 292,
T_QUESTION = 293,
T_COLON = 294,
T_COMMA = 295,
T_OPEN = 296,
T_CLOSE = 297,
T_DOC_OPEN = 298,
T_DOC_CLOSE = 299,
T_LIST_OPEN = 300,
T_LIST_CLOSE = 301,
UPLUS = 302,
UMINUS = 303,
FUNCCALL = 304,
REFERENCE = 305,
INDEXED = 306
};
#endif
@ -108,7 +109,7 @@ typedef union YYSTYPE
/* Line 1676 of yacc.c */
#line 112 "arangod/Ahuacatl/ahuacatl-grammar.h"
#line 113 "arangod/Ahuacatl/ahuacatl-grammar.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */

View File

@ -77,7 +77,8 @@ void Ahuacatlerror (YYLTYPE* locp, TRI_aql_context_t* const context, const char*
%token T_FALSE "false"
%token T_STRING "identifier"
%token T_QUOTED_STRING "quoted string"
%token T_NUMBER "number"
%token T_INTEGER "integer number"
%token T_DOUBLE "number"
%token T_PARAMETER "bind parameter"
%token T_ASSIGN "assignment"
@ -134,7 +135,8 @@ void Ahuacatlerror (YYLTYPE* locp, TRI_aql_context_t* const context, const char*
/* define token return types */
%type <strval> T_STRING
%type <strval> T_QUOTED_STRING
%type <strval> T_NUMBER
%type <strval> T_INTEGER
%type <strval> T_DOUBLE
%type <strval> T_PARAMETER;
%type <node> sort_list;
%type <node> sort_element;
@ -165,7 +167,7 @@ void Ahuacatlerror (YYLTYPE* locp, TRI_aql_context_t* const context, const char*
%type <node> value_literal;
%type <node> bind_parameter;
%type <strval> variable_name;
%type <intval> signed_number;
%type <node> integer_value;
/* define start token of language */
@ -354,8 +356,8 @@ sort_direction:
;
limit_statement:
T_LIMIT signed_number {
TRI_aql_node_t* node = TRI_CreateNodeLimitAql(context, TRI_CreateNodeValueIntAql(context, 0), TRI_CreateNodeValueIntAql(context, $2));
T_LIMIT integer_value {
TRI_aql_node_t* node = TRI_CreateNodeLimitAql(context, TRI_CreateNodeValueIntAql(context, 0), $2);
if (! node) {
ABORT_OOM
}
@ -365,8 +367,8 @@ limit_statement:
}
}
| T_LIMIT signed_number T_COMMA signed_number {
TRI_aql_node_t* node = TRI_CreateNodeLimitAql(context, TRI_CreateNodeValueIntAql(context, $2), TRI_CreateNodeValueIntAql(context, $4));
| T_LIMIT integer_value T_COMMA integer_value {
TRI_aql_node_t* node = TRI_CreateNodeLimitAql(context, $2, $4);
if (! node) {
ABORT_OOM
}
@ -884,14 +886,24 @@ value_literal:
$$ = node;
}
| T_NUMBER {
| integer_value {
$$ = $1;
}
| T_DOUBLE {
TRI_aql_node_t* node;
double value;
if (! $1) {
ABORT_OOM
}
node = TRI_CreateNodeValueDoubleAql(context, TRI_DoubleString($1));
value = TRI_DoubleString($1);
if (TRI_errno() != TRI_ERROR_NO_ERROR) {
TRI_SetErrorContextAql(context, TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, NULL);
YYABORT;
}
node = TRI_CreateNodeValueDoubleAql(context, value);
if (! node) {
ABORT_OOM
}
@ -957,20 +969,23 @@ variable_name:
}
;
signed_number:
T_NUMBER {
if (! $1) {
integer_value:
T_INTEGER {
TRI_aql_node_t* node;
int64_t value;
value = TRI_Int64String($1);
if (TRI_errno() != TRI_ERROR_NO_ERROR) {
TRI_SetErrorContextAql(context, TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, NULL);
YYABORT;
}
node = TRI_CreateNodeValueIntAql(context, value);
if (! node) {
ABORT_OOM
}
$$ = TRI_Int64String($1);
}
| '-' T_NUMBER {
if (! $2) {
ABORT_OOM
}
$$ = - TRI_Int64String($2);
$$ = node;
}
;

View File

@ -361,8 +361,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 54
#define YY_END_OF_BUFFER 55
#define YY_NUM_RULES 55
#define YY_END_OF_BUFFER 56
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@ -370,23 +370,23 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[133] =
static yyconst flex_int16_t yy_accept[134] =
{ 0,
0, 0, 0, 0, 55, 53, 46, 46, 22, 53,
29, 53, 53, 34, 35, 27, 25, 33, 26, 28,
44, 44, 31, 20, 21, 18, 30, 53, 40, 40,
0, 0, 0, 0, 56, 54, 47, 47, 22, 54,
29, 54, 54, 34, 35, 27, 25, 33, 26, 28,
44, 44, 31, 20, 21, 18, 30, 54, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 38,
39, 53, 53, 36, 53, 37, 49, 51, 52, 50,
46, 16, 0, 42, 0, 23, 0, 43, 0, 47,
0, 44, 19, 15, 17, 45, 0, 40, 40, 40,
40, 40, 40, 40, 10, 40, 40, 40, 40, 40,
40, 0, 40, 0, 0, 0, 41, 24, 49, 51,
48, 44, 45, 8, 40, 40, 40, 40, 1, 40,
39, 54, 54, 36, 54, 37, 50, 52, 53, 51,
47, 16, 0, 42, 0, 23, 0, 43, 0, 44,
48, 0, 44, 19, 15, 17, 46, 0, 40, 40,
40, 40, 40, 40, 40, 10, 40, 40, 40, 40,
40, 40, 0, 40, 0, 0, 0, 41, 24, 50,
52, 49, 45, 46, 8, 40, 40, 40, 40, 1,
2, 40, 40, 40, 40, 40, 32, 40, 40, 0,
40, 9, 40, 40, 11, 40, 12, 40, 6, 13,
0, 44, 40, 14, 40, 7, 40, 40, 3, 4,
5, 0
40, 2, 40, 40, 40, 40, 40, 32, 40, 40,
0, 40, 9, 40, 40, 11, 40, 12, 40, 6,
13, 0, 45, 40, 14, 40, 7, 40, 40, 3,
4, 5, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@ -432,47 +432,47 @@ static yyconst flex_int32_t yy_meta[63] =
1, 1
} ;
static yyconst flex_int16_t yy_base[144] =
static yyconst flex_int16_t yy_base[145] =
{ 0,
0, 0, 60, 62, 266, 273, 65, 73, 240, 64,
273, 248, 62, 273, 273, 273, 273, 273, 273, 232,
203, 62, 273, 196, 195, 194, 273, 190, 35, 0,
43, 52, 57, 51, 58, 51, 64, 59, 59, 201,
273, 167, 42, 273, 149, 273, 0, 273, 206, 191,
114, 273, 79, 273, 204, 273, 88, 273, 202, 273,
81, 104, 273, 273, 273, 0, 179, 0, 91, 91,
87, 93, 94, 91, 90, 92, 98, 100, 95, 98,
96, 94, 121, 67, 114, 99, 273, 273, 0, 273,
273, 139, 0, 0, 108, 114, 111, 123, 0, 127,
0, 0, 60, 62, 267, 278, 65, 73, 239, 64,
278, 241, 62, 278, 278, 278, 278, 278, 206, 212,
205, 62, 278, 198, 197, 196, 278, 192, 35, 0,
43, 52, 57, 51, 58, 51, 64, 59, 59, 204,
278, 171, 42, 278, 152, 278, 0, 278, 208, 193,
114, 278, 79, 278, 206, 278, 88, 278, 205, 104,
278, 81, 108, 278, 278, 278, 0, 155, 0, 91,
92, 90, 96, 98, 95, 94, 95, 101, 103, 98,
102, 100, 132, 123, 67, 101, 99, 278, 278, 0,
278, 278, 142, 0, 0, 112, 121, 119, 123, 0,
0, 132, 133, 127, 131, 141, 273, 0, 154, 161,
145, 0, 147, 148, 0, 145, 0, 150, 0, 0,
173, 181, 165, 0, 158, 0, 166, 163, 0, 0,
0, 273, 221, 227, 233, 237, 240, 242, 248, 254,
258, 262, 266
127, 0, 133, 133, 129, 131, 141, 278, 0, 155,
179, 147, 0, 153, 156, 0, 148, 0, 156, 0,
0, 160, 182, 167, 0, 166, 0, 169, 168, 0,
0, 0, 278, 226, 232, 238, 242, 245, 247, 253,
259, 263, 267, 271
} ;
static yyconst flex_int16_t yy_def[144] =
static yyconst flex_int16_t yy_def[145] =
{ 0,
132, 1, 133, 133, 132, 132, 132, 132, 132, 134,
132, 132, 135, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 136, 137, 137,
137, 137, 137, 137, 137, 137, 137, 137, 137, 132,
132, 138, 139, 132, 132, 132, 140, 132, 132, 132,
132, 132, 134, 132, 134, 132, 135, 132, 135, 132,
132, 132, 132, 132, 132, 141, 136, 137, 137, 137,
137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
137, 132, 142, 138, 139, 139, 132, 132, 140, 132,
132, 132, 141, 137, 137, 137, 137, 137, 137, 137,
133, 1, 134, 134, 133, 133, 133, 133, 133, 135,
133, 133, 136, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 137, 138, 138,
138, 138, 138, 138, 138, 138, 138, 138, 138, 133,
133, 139, 140, 133, 133, 133, 141, 133, 133, 133,
133, 133, 135, 133, 135, 133, 136, 133, 136, 133,
133, 133, 133, 133, 133, 133, 142, 137, 138, 138,
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
138, 138, 133, 143, 139, 140, 140, 133, 133, 141,
133, 133, 133, 142, 138, 138, 138, 138, 138, 138,
137, 137, 137, 137, 137, 137, 132, 143, 142, 132,
137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
132, 132, 137, 137, 137, 137, 137, 137, 137, 137,
137, 0, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132
138, 138, 138, 138, 138, 138, 138, 133, 144, 143,
133, 138, 138, 138, 138, 138, 138, 138, 138, 138,
138, 133, 133, 138, 138, 138, 138, 138, 138, 138,
138, 138, 0, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133
} ;
static yyconst flex_int16_t yy_nxt[336] =
static yyconst flex_int16_t yy_nxt[341] =
{ 0,
6, 7, 8, 7, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 6, 20, 21, 22, 23,
@ -481,39 +481,39 @@ static yyconst flex_int16_t yy_nxt[336] =
40, 6, 41, 42, 43, 29, 31, 32, 30, 33,
34, 35, 30, 36, 30, 37, 38, 39, 30, 44,
45, 46, 48, 49, 48, 49, 51, 51, 51, 54,
58, 50, 69, 50, 51, 51, 51, 61, 70, 62,
62, 71, 72, 86, 54, 75, 87, 76, 73, 77,
78, 69, 74, 79, 80, 81, 58, 70, 92, 92,
58, 50, 70, 50, 51, 51, 51, 62, 71, 63,
63, 72, 73, 87, 54, 76, 88, 77, 74, 78,
79, 70, 75, 80, 81, 82, 58, 71, 93, 93,
71, 132, 72, 59, 75, 55, 76, 73, 77, 78,
84, 74, 79, 80, 81, 51, 51, 51, 94, 61,
55, 62, 62, 95, 96, 97, 98, 99, 100, 59,
101, 102, 103, 104, 105, 106, 107, 94, 108, 108,
111, 112, 95, 96, 97, 98, 99, 100, 113, 101,
102, 103, 104, 105, 106, 86, 92, 92, 87, 111,
112, 114, 115, 116, 108, 117, 118, 113, 110, 119,
120, 108, 108, 121, 123, 121, 124, 125, 122, 122,
114, 115, 116, 126, 117, 118, 127, 110, 119, 120,
122, 122, 128, 123, 129, 124, 125, 108, 122, 122,
72, 133, 73, 59, 76, 55, 77, 74, 78, 79,
85, 75, 80, 81, 82, 51, 51, 51, 95, 62,
55, 63, 63, 62, 96, 63, 63, 97, 98, 59,
99, 100, 101, 102, 103, 104, 105, 95, 106, 107,
109, 109, 87, 96, 112, 88, 97, 98, 113, 99,
100, 101, 102, 103, 104, 105, 114, 106, 107, 93,
93, 115, 116, 112, 117, 118, 109, 113, 119, 120,
121, 111, 109, 109, 108, 114, 124, 123, 123, 133,
115, 116, 125, 117, 118, 126, 127, 119, 120, 121,
111, 122, 128, 122, 129, 124, 123, 123, 109, 123,
130, 131, 126, 132, 132, 127, 132, 91, 90, 88,
84, 128, 82, 129, 67, 65, 64, 63, 61, 130,
131, 47, 47, 47, 47, 47, 47, 53, 53, 53,
53, 53, 53, 57, 57, 57, 57, 57, 57, 66,
66, 66, 68, 60, 68, 68, 83, 83, 85, 85,
85, 85, 85, 85, 89, 56, 89, 89, 89, 89,
93, 52, 93, 93, 109, 132, 109, 109, 108, 132,
108, 108, 5, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
123, 125, 130, 131, 126, 127, 132, 133, 133, 92,
91, 128, 89, 129, 85, 83, 68, 66, 65, 64,
62, 130, 131, 61, 60, 132, 47, 47, 47, 47,
47, 47, 53, 53, 53, 53, 53, 53, 57, 57,
57, 57, 57, 57, 67, 67, 67, 69, 56, 69,
69, 84, 84, 86, 86, 86, 86, 86, 86, 90,
52, 90, 90, 90, 90, 94, 133, 94, 94, 110,
133, 110, 110, 109, 133, 109, 109, 5, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133
} ;
static yyconst flex_int16_t yy_chk[336] =
static yyconst flex_int16_t yy_chk[341] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -524,42 +524,42 @@ static yyconst flex_int16_t yy_chk[336] =
1, 1, 3, 3, 4, 4, 7, 7, 7, 10,
13, 3, 29, 4, 8, 8, 8, 22, 31, 22,
22, 32, 33, 43, 53, 34, 43, 35, 33, 35,
36, 29, 33, 37, 38, 39, 57, 31, 61, 61,
36, 29, 33, 37, 38, 39, 57, 31, 62, 62,
32, 86, 33, 13, 34, 10, 35, 33, 35, 36,
84, 33, 37, 38, 39, 51, 51, 51, 69, 62,
53, 62, 62, 70, 71, 72, 73, 74, 75, 57,
76, 77, 78, 79, 80, 81, 82, 69, 83, 83,
95, 96, 70, 71, 72, 73, 74, 75, 97, 76,
77, 78, 79, 80, 81, 85, 92, 92, 85, 95,
96, 98, 100, 102, 83, 103, 104, 97, 92, 105,
106, 109, 109, 110, 111, 110, 113, 114, 110, 110,
98, 100, 102, 116, 103, 104, 118, 92, 105, 106,
121, 121, 123, 111, 125, 113, 114, 109, 122, 122,
32, 87, 33, 13, 34, 10, 35, 33, 35, 36,
85, 33, 37, 38, 39, 51, 51, 51, 70, 60,
53, 60, 60, 63, 71, 63, 63, 72, 73, 57,
74, 75, 76, 77, 78, 79, 80, 70, 81, 82,
84, 84, 86, 71, 96, 86, 72, 73, 97, 74,
75, 76, 77, 78, 79, 80, 98, 81, 82, 93,
93, 99, 101, 96, 103, 104, 84, 97, 105, 106,
107, 93, 110, 110, 83, 98, 112, 122, 122, 68,
99, 101, 114, 103, 104, 115, 117, 105, 106, 107,
93, 111, 119, 111, 124, 112, 111, 111, 110, 123,
127, 128, 116, 67, 59, 118, 55, 50, 49, 45,
42, 123, 40, 125, 28, 26, 25, 24, 21, 127,
128, 133, 133, 133, 133, 133, 133, 134, 134, 134,
134, 134, 134, 135, 135, 135, 135, 135, 135, 136,
136, 136, 137, 20, 137, 137, 138, 138, 139, 139,
139, 139, 139, 139, 140, 12, 140, 140, 140, 140,
141, 9, 141, 141, 142, 5, 142, 142, 143, 0,
143, 143, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
123, 114, 126, 128, 115, 117, 129, 59, 55, 50,
49, 119, 45, 124, 42, 40, 28, 26, 25, 24,
21, 126, 128, 20, 19, 129, 134, 134, 134, 134,
134, 134, 135, 135, 135, 135, 135, 135, 136, 136,
136, 136, 136, 136, 137, 137, 137, 138, 12, 138,
138, 139, 139, 140, 140, 140, 140, 140, 140, 141,
9, 141, 141, 141, 141, 142, 5, 142, 142, 143,
0, 143, 143, 144, 0, 144, 144, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133
} ;
/* Table of booleans, true if rule could match eol. */
static yyconst flex_int32_t yy_rule_can_match_eol[55] =
static yyconst flex_int32_t yy_rule_can_match_eol[56] =
{ 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, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, };
0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, };
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
@ -897,13 +897,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 >= 133 )
if ( yy_current_state >= 134 )
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 != 132 );
while ( yy_current_state != 133 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
@ -1219,15 +1219,23 @@ YY_RULE_SETUP
case 44:
YY_RULE_SETUP
{
/* a numeric value */
/* a numeric integer value */
yylval->strval = TRI_RegisterStringAql(yyextra, yytext, yyleng, false);
return T_NUMBER;
return T_INTEGER;
}
YY_BREAK
case 45:
YY_RULE_SETUP
{
/* a numeric double value */
yylval->strval = TRI_RegisterStringAql(yyextra, yytext, yyleng, false);
return T_DOUBLE;
}
YY_BREAK
/* ---------------------------------------------------------------------------
* bind parameters
* --------------------------------------------------------------------------- */
case 45:
case 46:
YY_RULE_SETUP
{
/* bind parameters must start with a @
@ -1239,45 +1247,39 @@ YY_RULE_SETUP
/* ---------------------------------------------------------------------------
* whitespace etc.
* --------------------------------------------------------------------------- */
case 46:
/* rule 46 can match eol */
case 47:
/* rule 47 can match eol */
YY_RULE_SETUP
{
/* whitespace is ignored */
}
YY_BREAK
case 47:
case 48:
YY_RULE_SETUP
{
BEGIN(COMMENT);
}
YY_BREAK
case 48:
case 49:
YY_RULE_SETUP
{
BEGIN(INITIAL);
}
YY_BREAK
case 49:
case 50:
YY_RULE_SETUP
{
// eat comment in chunks
}
YY_BREAK
case 50:
case 51:
YY_RULE_SETUP
{
// eat the lone star
}
YY_BREAK
case 51:
/* rule 51 can match eol */
YY_RULE_SETUP
{
yylineno++;
}
YY_BREAK
case 52:
/* rule 52 can match eol */
YY_RULE_SETUP
{
yylineno++;
@ -1285,12 +1287,18 @@ YY_RULE_SETUP
YY_BREAK
case 53:
YY_RULE_SETUP
{
yylineno++;
}
YY_BREAK
case 54:
YY_RULE_SETUP
{
/* anything else is returned as it is */
return (int) yytext[0];
}
YY_BREAK
case 54:
case 55:
YY_RULE_SETUP
ECHO;
YY_BREAK
@ -1589,7 +1597,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 >= 133 )
if ( yy_current_state >= 134 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@ -1618,11 +1626,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 >= 133 )
if ( yy_current_state >= 134 )
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 == 132);
yy_is_jam = (yy_current_state == 133);
return yy_is_jam ? 0 : yy_current_state;
}

View File

@ -243,10 +243,16 @@
return T_QUOTED_STRING;
}
(0|[1-9][0-9]*)(\.[0-9]+([eE]([\-\+])?[0-9]+)?)? {
/* a numeric value */
(0|-?[1-9][0-9]*) {
/* a numeric integer value */
yylval->strval = TRI_RegisterStringAql(yyextra, yytext, yyleng, false);
return T_NUMBER;
return T_INTEGER;
}
(0|-?[1-9][0-9]*)(\.[0-9]+([eE]([\-\+])?[0-9]+)?) {
/* a numeric double value */
yylval->strval = TRI_RegisterStringAql(yyextra, yytext, yyleng, false);
return T_DOUBLE;
}
/* ---------------------------------------------------------------------------

View File

@ -838,32 +838,91 @@ function ahuacatlQuerySimpleTestSuite () {
/// @brief numeric overflow at compile time
////////////////////////////////////////////////////////////////////////////////
testOverflowCompile: function () {
testOverflowCompileInt: function () {
assertEqual(errors.ERROR_QUERY_NUMBER_OUT_OF_RANGE.code, getErrorCode(function() { QUERY("LET l = 4444444444444555555555555555555555555555555555554444333333333333333333333334444444544 RETURN l * l * l * l * l"); }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief numeric overflow at compile time
////////////////////////////////////////////////////////////////////////////////
testOverflowCompileDouble: function () {
assertEqual(errors.ERROR_QUERY_NUMBER_OUT_OF_RANGE.code, getErrorCode(function() { QUERY("LET l = 4.0e999 RETURN l * l * l * l * l"); }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief numeric underflow at compile time
////////////////////////////////////////////////////////////////////////////////
testUnderflowCompile: function () {
testUnderflowCompileInt: function () {
assertEqual(errors.ERROR_QUERY_NUMBER_OUT_OF_RANGE.code, getErrorCode(function() { QUERY("LET l = -4444444444444555555555555555555555555555555555554444333333333333333333333334444444544 RETURN l * l * l * l * l"); }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief numeric underflow at compile time
////////////////////////////////////////////////////////////////////////////////
testUnderflowCompileDouble: function () {
assertEqual(errors.ERROR_QUERY_NUMBER_OUT_OF_RANGE.code, getErrorCode(function() { QUERY("LET l = -4.0e999 RETURN l * l * l * l * l"); }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief numeric overflow at execution time
////////////////////////////////////////////////////////////////////////////////
testOverflowExecution: function () {
testOverflowExecutionInt: function () {
assertEqual(errors.ERROR_QUERY_NUMBER_OUT_OF_RANGE.code, getErrorCode(function() { QUERY("FOR l IN [ 33939359949454345354858882332 ] RETURN l * l * l * l * l * l * l * l * l * l * l"); }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief numeric overflow at execution time
////////////////////////////////////////////////////////////////////////////////
testOverflowExecutionDouble: function () {
assertEqual(errors.ERROR_QUERY_NUMBER_OUT_OF_RANGE.code, getErrorCode(function() { QUERY("FOR l IN [ 3.0e300 ] RETURN l * l * l * l * l * l * l * l * l * l * l"); }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief numeric underflow at execution time
////////////////////////////////////////////////////////////////////////////////
testUnderflowExecution: function () {
testUnderflowExecutionInt: function () {
assertEqual(errors.ERROR_QUERY_NUMBER_OUT_OF_RANGE.code, getErrorCode(function() { QUERY("FOR l IN [ -33939359949454345354858882332 ] RETURN l * l * l * l * l * l * l * l * l * l * l"); }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief numeric underflow at execution time
////////////////////////////////////////////////////////////////////////////////
testUnderflowExecutionDouble: function () {
assertEqual(errors.ERROR_QUERY_NUMBER_OUT_OF_RANGE.code, getErrorCode(function() { QUERY("FOR l IN [ -3.0e300 ] RETURN l * l * l * l * l * l * l * l * l * l * l"); }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief big integer overflow
////////////////////////////////////////////////////////////////////////////////
testBigIntOverflow: function () {
assertEqual(errors.ERROR_QUERY_NUMBER_OUT_OF_RANGE.code, getErrorCode(function() { QUERY("RETURN 9223372036854775808"); }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief big integer underflow
////////////////////////////////////////////////////////////////////////////////
testBigIntUnderflow: function () {
assertEqual(errors.ERROR_QUERY_NUMBER_OUT_OF_RANGE.code, getErrorCode(function() { QUERY("RETURN -9223372036854775809"); }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief big integers
////////////////////////////////////////////////////////////////////////////////
testBigInt: function () {
var actual;
actual = getQueryResults("FOR i IN [ 2147483647, 2147483648, -2147483648, -2147483649 /*, 9223372036854775807,*/ /*-9223372036854775808*/ ] RETURN 1");
assertEqual([ 1, 1, 1, 1 ], actual);
}
};

View File

@ -106,8 +106,7 @@ double TRI_DoubleString (char const* str) {
if (*endptr != '\0') {
TRI_set_errno(TRI_ERROR_ILLEGAL_NUMBER);
}
if (errno == ERANGE && (result == HUGE_VAL || result == -HUGE_VAL || result == 0)) {
else if (errno == ERANGE && (result == HUGE_VAL || result == -HUGE_VAL || result == 0)) {
TRI_set_errno(TRI_ERROR_NUMERIC_OVERFLOW);
}
@ -145,8 +144,7 @@ int32_t TRI_Int32String (char const* str) {
if (*endptr != '\0') {
TRI_set_errno(TRI_ERROR_ILLEGAL_NUMBER);
}
if (errno == ERANGE && (result == INT32_MIN || result == INT32_MAX)) {
else if (errno == ERANGE && (result == INT32_MIN || result == INT32_MAX)) {
TRI_set_errno(TRI_ERROR_NUMERIC_OVERFLOW);
}
@ -204,8 +202,7 @@ uint32_t TRI_UInt32String (char const* str) {
if (*endptr != '\0') {
TRI_set_errno(TRI_ERROR_ILLEGAL_NUMBER);
}
if (errno == ERANGE && (result == 0 || result == UINT32_MAX)) {
else if (errno == ERANGE && (result == 0 || result == UINT32_MAX)) {
TRI_set_errno(TRI_ERROR_NUMERIC_OVERFLOW);
}
@ -267,8 +264,7 @@ int64_t TRI_Int64String (char const* str) {
if (*endptr != '\0') {
TRI_set_errno(TRI_ERROR_ILLEGAL_NUMBER);
}
if (errno == ERANGE && (result == INT64_MIN || result == INT64_MAX)) {
else if (errno == ERANGE && (result == INT64_MIN || result == INT64_MAX)) {
TRI_set_errno(TRI_ERROR_NUMERIC_OVERFLOW);
}
@ -330,8 +326,7 @@ uint64_t TRI_UInt64String (char const* str) {
if (*endptr != '\0') {
TRI_set_errno(TRI_ERROR_ILLEGAL_NUMBER);
}
if (errno == ERANGE && (result == 0 || result == UINT64_MAX)) {
else if (errno == ERANGE && (result == 0 || result == UINT64_MAX)) {
TRI_set_errno(TRI_ERROR_NUMERIC_OVERFLOW);
}
@ -576,7 +571,7 @@ size_t TRI_StringInt64InPlace (int64_t attr, char* buffer) {
if (attr >= 0 && (attr >> 32) == 0) {
// shortcut
return TRI_StringInt32InPlace((int32_t) attr, buffer);
return TRI_StringUInt32InPlace((uint32_t) attr, buffer);
}
p = buffer;
@ -584,10 +579,10 @@ size_t TRI_StringInt64InPlace (int64_t attr, char* buffer) {
if (attr < 0) {
*p++ = '-';
attr = -attr;
if ((attr >> 32) == 0) {
// shortcut
return TRI_StringInt32InPlace((int32_t) attr, p) + 1;
return TRI_StringUInt32InPlace((uint32_t) attr, p) + 1;
}
}