diff --git a/CHANGELOG b/CHANGELOG index 8c6c0c5d94..0db966212f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ devel ----- +* allow usage of floating point values in AQL without leading zeros, e.g. + `.1234`. Previous versions of ArangoDB required a leading zero in front of + the decimal separator, i.e `0.1234`. + * fixed Foxx complaining about valid `$schema` value in manifest.json * Foxx `req.makeAbsolute` now will return meaningful values when ArangoDB is using diff --git a/arangod/Aql/tokens.cpp b/arangod/Aql/tokens.cpp index c3e17bf8ef..3320148992 100644 --- a/arangod/Aql/tokens.cpp +++ b/arangod/Aql/tokens.cpp @@ -746,7 +746,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[265] = +static const flex_int16_t yy_accept[266] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 100, 87, 88, @@ -757,26 +757,26 @@ static const flex_int16_t yy_accept[265] = 63, 58, 100, 59, 100, 67, 66, 67, 64, 72, 71, 72, 72, 82, 81, 79, 82, 77, 76, 74, 77, 91, 90, 94, 96, 95, 99, 98, 98, 99, - 87, 37, 35, 62, 44, 54, 92, 89, 0, 0, + 87, 37, 35, 62, 44, 54, 84, 92, 89, 0, - 83, 52, 40, 36, 34, 38, 85, 0, 0, 62, + 0, 83, 52, 40, 36, 34, 38, 85, 0, 0, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62, 15, 62, 62, 62, 62, 14, 62, 62, 62, - 62, 62, 62, 62, 62, 0, 45, 68, 65, 70, - 69, 80, 75, 91, 94, 93, 97, 84, 0, 84, - 85, 86, 0, 85, 62, 28, 13, 27, 10, 62, - 62, 62, 62, 62, 1, 62, 62, 62, 62, 2, - 62, 62, 62, 12, 62, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 86, 86, 85, - 85, 62, 62, 11, 62, 62, 62, 62, 62, 62, + 62, 62, 15, 62, 62, 62, 62, 14, 62, 62, + 62, 62, 62, 62, 62, 62, 0, 45, 68, 65, + 70, 69, 80, 75, 91, 94, 93, 97, 84, 0, + 84, 85, 86, 0, 85, 62, 28, 13, 27, 10, + 62, 62, 62, 62, 62, 1, 62, 62, 62, 62, + 2, 62, 62, 62, 12, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 62, 86, 86, + 85, 85, 62, 62, 11, 62, 62, 62, 62, 62, - 16, 30, 62, 29, 31, 62, 62, 62, 62, 62, - 6, 32, 62, 62, 17, 86, 86, 62, 62, 62, - 33, 62, 23, 62, 62, 7, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 3, 62, 19, 62, - 18, 62, 4, 62, 20, 22, 62, 5, 62, 26, - 62, 21, 62, 62, 8, 25, 62, 9, 62, 62, - 62, 62, 24, 0 + 62, 16, 30, 62, 29, 31, 62, 62, 62, 62, + 62, 6, 32, 62, 62, 17, 86, 86, 62, 62, + 62, 33, 62, 23, 62, 62, 7, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 3, 62, 19, + 62, 18, 62, 4, 62, 20, 22, 62, 5, 62, + 26, 62, 21, 62, 62, 8, 25, 62, 9, 62, + 62, 62, 62, 24, 0 } ; static const YY_CHAR yy_ec[256] = @@ -824,81 +824,81 @@ static const YY_CHAR yy_meta[82] = 1 } ; -static const flex_int16_t yy_base[293] = +static const flex_int16_t yy_base[294] = { 0, 0, 0, 79, 80, 81, 84, 85, 86, 87, 88, - 428, 424, 93, 94, 83, 105, 425, 580, 422, 580, - 76, 580, 0, 580, 414, 580, 580, 580, 580, 580, - 580, 580, 404, 87, 84, 93, 397, 390, 79, 387, - 580, 88, 83, 0, 79, 94, 134, 79, 88, 127, - 119, 121, 86, 136, 108, 130, 138, 580, 580, 355, - 580, 580, 306, 580, 271, 580, 580, 0, 580, 580, - 580, 0, 250, 580, 580, 580, 0, 580, 580, 580, - 0, 0, 580, 0, 580, 276, 580, 580, 580, 136, - 288, 580, 580, 0, 580, 580, 580, 580, 84, 165, + 433, 430, 93, 94, 83, 105, 426, 587, 423, 587, + 76, 587, 0, 587, 416, 587, 587, 587, 587, 587, + 587, 587, 83, 92, 84, 94, 400, 397, 81, 395, + 587, 91, 114, 0, 80, 92, 132, 79, 102, 129, + 104, 128, 98, 142, 119, 128, 130, 587, 587, 364, + 587, 587, 338, 587, 334, 587, 587, 0, 587, 587, + 587, 0, 222, 587, 587, 587, 0, 587, 587, 587, + 0, 0, 587, 0, 587, 282, 587, 587, 587, 138, + 291, 587, 587, 0, 587, 587, 171, 587, 587, 100, - 176, 580, 580, 580, 580, 580, 0, 226, 188, 0, - 147, 144, 170, 154, 150, 161, 162, 172, 174, 170, - 187, 199, 173, 183, 181, 185, 0, 179, 215, 184, - 186, 185, 231, 191, 245, 185, 580, 580, 580, 580, - 580, 580, 580, 0, 0, 580, 580, 247, 197, 249, - 0, 0, 177, 121, 216, 0, 0, 0, 0, 234, - 205, 228, 230, 231, 0, 235, 239, 251, 244, 0, - 252, 253, 259, 0, 254, 265, 254, 258, 251, 262, - 263, 278, 286, 283, 281, 0, 306, 0, 118, 89, - 0, 286, 289, 0, 292, 297, 298, 296, 287, 291, + 192, 196, 587, 587, 587, 587, 587, 0, 235, 201, + 0, 153, 142, 173, 167, 144, 150, 155, 179, 180, + 176, 193, 195, 180, 195, 193, 191, 0, 190, 208, + 195, 194, 195, 213, 197, 253, 175, 587, 587, 587, + 587, 587, 587, 587, 0, 0, 587, 587, 256, 259, + 262, 0, 0, 131, 88, 215, 0, 0, 0, 0, + 232, 254, 241, 245, 245, 0, 249, 251, 262, 254, + 0, 265, 263, 268, 0, 263, 274, 263, 267, 261, + 265, 264, 279, 285, 283, 286, 0, 324, 0, 75, + 73, 0, 292, 294, 0, 294, 302, 306, 305, 295, - 0, 0, 291, 0, 0, 297, 292, 313, 301, 301, - 0, 0, 302, 306, 0, 73, 0, 317, 322, 313, - 0, 311, 0, 322, 319, 0, 321, 338, 341, 332, - 344, 346, 337, 356, 340, 357, 0, 357, 0, 350, - 0, 357, 0, 348, 0, 0, 348, 0, 350, 0, - 366, 0, 355, 370, 0, 0, 66, 0, 362, 375, - 361, 373, 0, 580, 434, 441, 448, 455, 462, 469, - 476, 104, 480, 484, 486, 493, 500, 507, 514, 521, - 528, 532, 536, 540, 544, 548, 552, 556, 560, 564, - 568, 572 + 302, 0, 0, 301, 0, 0, 306, 302, 323, 309, + 309, 0, 0, 310, 313, 0, 71, 0, 325, 330, + 322, 0, 320, 0, 324, 321, 0, 323, 329, 341, + 335, 340, 349, 339, 358, 347, 365, 0, 365, 0, + 357, 0, 369, 0, 359, 0, 0, 359, 0, 360, + 0, 371, 0, 361, 376, 0, 0, 63, 0, 367, + 383, 367, 380, 0, 587, 441, 448, 455, 462, 469, + 476, 483, 105, 487, 491, 493, 500, 507, 514, 521, + 528, 535, 539, 543, 547, 551, 555, 559, 563, 567, + 571, 575, 579 } ; -static const flex_int16_t yy_def[293] = +static const flex_int16_t yy_def[294] = { 0, - 264, 1, 265, 265, 266, 266, 267, 267, 268, 268, - 269, 269, 270, 270, 271, 271, 264, 264, 264, 264, - 264, 264, 272, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 273, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 264, 264, 275, - 264, 264, 264, 264, 264, 264, 264, 276, 264, 264, - 264, 277, 264, 264, 264, 264, 278, 264, 264, 264, - 279, 280, 264, 281, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 274, 264, 264, 264, 264, 264, 264, + 265, 1, 266, 266, 267, 267, 268, 268, 269, 269, + 270, 270, 271, 271, 272, 272, 265, 265, 265, 265, + 265, 265, 273, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 274, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 265, 265, 276, + 265, 265, 265, 265, 265, 265, 265, 277, 265, 265, + 265, 278, 265, 265, 265, 265, 279, 265, 265, 265, + 280, 281, 265, 282, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 275, 265, 265, 265, 265, 265, 265, - 264, 264, 264, 264, 264, 264, 282, 283, 284, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 285, 275, 264, 264, 264, 264, - 264, 264, 264, 280, 281, 264, 264, 264, 264, 264, - 282, 286, 287, 288, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 289, 285, 286, 290, 288, - 291, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 265, 265, 265, 265, 265, 265, 265, 283, 284, 285, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 286, 276, 265, 265, 265, + 265, 265, 265, 265, 281, 282, 265, 265, 265, 265, + 265, 283, 287, 288, 289, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 290, 286, 287, 291, + 289, 292, 275, 275, 275, 275, 275, 275, 275, 275, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 290, 292, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 0, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264 + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 291, 293, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 0, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265 } ; -static const flex_int16_t yy_nxt[662] = +static const flex_int16_t yy_nxt[669] = { 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, @@ -909,73 +909,73 @@ static const flex_int16_t yy_nxt[662] = 44, 49, 44, 50, 44, 51, 52, 44, 53, 54, 55, 56, 44, 57, 44, 62, 63, 64, 18, 18, 65, 67, 67, 71, 88, 89, 71, 75, 75, 79, - 79, 80, 80, 76, 76, 85, 85, 92, 97, 99, + 79, 80, 80, 76, 76, 85, 85, 92, 96, 100, - 104, 148, 148, 98, 86, 86, 88, 89, 99, 94, - 101, 101, 108, 100, 111, 129, 90, 259, 115, 112, - 121, 113, 100, 116, 217, 114, 122, 117, 68, 68, - 72, 69, 69, 72, 77, 77, 81, 81, 90, 109, - 191, 100, 111, 129, 90, 115, 112, 121, 113, 132, - 100, 116, 114, 122, 93, 117, 123, 105, 125, 118, - 124, 73, 127, 126, 73, 128, 90, 119, 130, 217, - 133, 134, 191, 120, 147, 131, 132, 149, 155, 149, - 156, 159, 150, 150, 123, 125, 160, 118, 124, 127, - 126, 99, 128, 101, 101, 119, 130, 133, 157, 134, + 97, 97, 105, 98, 86, 86, 88, 89, 99, 100, + 94, 102, 102, 101, 260, 109, 90, 149, 149, 116, + 122, 117, 218, 101, 192, 118, 218, 130, 68, 68, + 72, 69, 69, 72, 77, 77, 81, 81, 90, 192, + 123, 101, 110, 126, 90, 112, 116, 122, 127, 117, + 113, 101, 114, 118, 93, 130, 115, 119, 124, 106, + 133, 73, 125, 135, 73, 120, 90, 123, 134, 128, + 126, 121, 129, 112, 131, 127, 148, 113, 157, 114, + 161, 132, 154, 115, 156, 119, 124, 133, 97, 97, + 125, 135, 162, 120, 160, 134, 128, 163, 121, 129, - 120, 147, 131, 161, 162, 100, 155, 156, 163, 159, - 164, 165, 166, 160, 150, 150, 170, 158, 171, 173, - 172, 175, 176, 180, 174, 167, 157, 181, 153, 182, - 161, 162, 194, 100, 185, 163, 136, 164, 165, 109, - 166, 168, 169, 170, 158, 171, 173, 172, 175, 176, - 180, 174, 177, 167, 181, 178, 182, 192, 179, 183, - 194, 185, 186, 186, 148, 148, 150, 150, 168, 169, - 193, 195, 196, 184, 197, 198, 100, 153, 199, 177, - 200, 202, 178, 201, 192, 179, 203, 183, 204, 91, - 205, 206, 146, 207, 208, 209, 186, 193, 195, 196, + 101, 158, 131, 148, 150, 157, 150, 161, 132, 151, + 151, 100, 156, 102, 102, 164, 165, 166, 167, 162, + 159, 168, 160, 171, 163, 101, 137, 176, 101, 158, + 172, 174, 173, 177, 181, 182, 175, 169, 170, 183, + 186, 184, 164, 165, 166, 178, 167, 159, 179, 168, + 171, 180, 110, 101, 176, 185, 193, 172, 174, 173, + 177, 181, 182, 175, 169, 170, 183, 186, 194, 184, + 187, 187, 178, 149, 149, 179, 151, 151, 180, 151, + 151, 195, 185, 193, 196, 101, 154, 197, 198, 199, + 200, 201, 91, 202, 203, 194, 204, 205, 147, 206, - 184, 197, 198, 210, 100, 199, 211, 212, 200, 202, - 201, 213, 214, 215, 203, 218, 204, 205, 219, 206, - 207, 208, 209, 186, 186, 220, 221, 222, 223, 141, - 210, 224, 225, 211, 226, 212, 227, 228, 229, 213, - 214, 215, 230, 218, 231, 232, 219, 233, 234, 235, - 138, 236, 237, 220, 221, 222, 223, 186, 224, 225, - 238, 226, 239, 227, 228, 240, 229, 241, 242, 230, - 243, 231, 232, 244, 233, 245, 234, 235, 236, 237, - 246, 247, 137, 248, 249, 250, 252, 238, 251, 239, - 253, 254, 240, 255, 256, 241, 242, 243, 257, 258, + 207, 142, 208, 209, 187, 210, 211, 212, 213, 195, + 214, 196, 215, 101, 197, 198, 199, 200, 216, 201, + 202, 219, 203, 220, 204, 205, 206, 221, 207, 208, + 209, 222, 210, 211, 212, 223, 213, 224, 214, 225, + 215, 187, 187, 226, 227, 228, 216, 229, 230, 219, + 231, 220, 232, 233, 234, 221, 235, 236, 242, 222, + 237, 238, 239, 223, 240, 224, 225, 241, 243, 245, + 226, 227, 228, 244, 229, 187, 230, 231, 246, 232, + 233, 234, 247, 248, 235, 236, 242, 237, 238, 239, + 249, 240, 250, 251, 241, 252, 243, 245, 253, 257, - 261, 244, 260, 245, 262, 263, 136, 246, 106, 247, - 248, 103, 249, 250, 252, 251, 102, 253, 254, 96, - 255, 95, 256, 91, 264, 257, 83, 258, 261, 260, - 83, 262, 264, 263, 66, 66, 66, 66, 66, 66, - 66, 70, 70, 70, 70, 70, 70, 70, 74, 74, - 74, 74, 74, 74, 74, 78, 78, 78, 78, 78, - 78, 78, 82, 82, 82, 82, 82, 82, 82, 84, - 84, 84, 84, 84, 84, 84, 87, 87, 87, 87, - 87, 87, 87, 107, 107, 107, 107, 110, 264, 110, - 110, 135, 135, 139, 264, 139, 139, 139, 139, 139, + 244, 254, 255, 256, 258, 259, 246, 261, 262, 247, + 263, 248, 264, 139, 138, 137, 107, 249, 104, 103, + 250, 251, 252, 95, 91, 265, 253, 257, 254, 255, + 256, 258, 83, 259, 261, 83, 262, 263, 265, 265, + 264, 66, 66, 66, 66, 66, 66, 66, 70, 70, + 70, 70, 70, 70, 70, 74, 74, 74, 74, 74, + 74, 74, 78, 78, 78, 78, 78, 78, 78, 82, + 82, 82, 82, 82, 82, 82, 84, 84, 84, 84, + 84, 84, 84, 87, 87, 87, 87, 87, 87, 87, + 108, 108, 108, 108, 111, 265, 111, 111, 136, 136, - 140, 264, 140, 140, 140, 140, 140, 142, 264, 142, - 142, 142, 142, 142, 143, 264, 143, 143, 143, 143, - 143, 144, 264, 144, 144, 144, 144, 144, 145, 264, - 264, 145, 145, 145, 145, 151, 264, 151, 151, 152, - 264, 152, 152, 154, 264, 154, 154, 187, 264, 187, - 187, 188, 264, 188, 188, 189, 264, 189, 189, 190, - 264, 190, 190, 186, 264, 186, 186, 216, 264, 216, - 216, 191, 264, 191, 191, 217, 264, 217, 217, 17, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + 140, 265, 140, 140, 140, 140, 140, 141, 265, 141, + 141, 141, 141, 141, 143, 265, 143, 143, 143, 143, + 143, 144, 265, 144, 144, 144, 144, 144, 145, 265, + 145, 145, 145, 145, 145, 146, 265, 265, 146, 146, + 146, 146, 152, 265, 152, 152, 153, 265, 153, 153, + 155, 265, 155, 155, 188, 265, 188, 188, 189, 265, + 189, 189, 190, 265, 190, 190, 191, 265, 191, 191, + 187, 265, 187, 187, 217, 265, 217, 217, 192, 265, + 192, 192, 218, 265, 218, 218, 17, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264 + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265 } ; -static const flex_int16_t yy_chk[662] = +static const flex_int16_t yy_chk[669] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -986,70 +986,70 @@ static const flex_int16_t yy_chk[662] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 5, 15, 15, 6, 7, 8, 9, - 10, 9, 10, 7, 8, 13, 14, 21, 34, 35, + 10, 9, 10, 7, 8, 13, 14, 21, 33, 35, - 39, 99, 99, 34, 13, 14, 16, 16, 36, 272, - 36, 36, 42, 35, 43, 53, 15, 257, 45, 43, - 48, 43, 36, 46, 216, 43, 49, 46, 3, 4, - 5, 3, 4, 6, 7, 8, 9, 10, 16, 42, - 190, 35, 43, 53, 15, 45, 43, 48, 43, 55, - 36, 46, 43, 49, 21, 46, 50, 39, 51, 47, - 50, 5, 52, 51, 6, 52, 16, 47, 54, 189, - 56, 57, 154, 47, 90, 54, 55, 100, 111, 100, - 112, 114, 100, 100, 50, 51, 115, 47, 50, 52, - 51, 101, 52, 101, 101, 47, 54, 56, 113, 57, + 33, 33, 39, 34, 13, 14, 16, 16, 34, 36, + 273, 36, 36, 35, 258, 42, 15, 100, 100, 45, + 48, 46, 217, 36, 191, 46, 190, 53, 3, 4, + 5, 3, 4, 6, 7, 8, 9, 10, 16, 155, + 49, 35, 42, 51, 15, 43, 45, 48, 51, 46, + 43, 36, 43, 46, 21, 53, 43, 47, 50, 39, + 55, 5, 50, 57, 6, 47, 16, 49, 56, 52, + 51, 47, 52, 43, 54, 51, 90, 43, 113, 43, + 116, 54, 154, 43, 112, 47, 50, 55, 97, 97, + 50, 57, 117, 47, 115, 56, 52, 118, 47, 52, - 47, 90, 54, 116, 117, 101, 111, 112, 118, 114, - 119, 120, 121, 115, 149, 149, 123, 113, 124, 125, - 124, 126, 128, 130, 125, 122, 113, 131, 153, 132, - 116, 117, 161, 101, 134, 118, 136, 119, 120, 109, - 121, 122, 122, 123, 113, 124, 125, 124, 126, 128, - 130, 125, 129, 122, 131, 129, 132, 155, 129, 133, - 161, 134, 135, 135, 148, 148, 150, 150, 122, 122, - 160, 162, 163, 133, 164, 166, 148, 108, 167, 129, - 168, 171, 129, 169, 155, 129, 172, 133, 173, 91, - 175, 176, 86, 177, 178, 179, 135, 160, 162, 163, + 97, 114, 54, 90, 101, 113, 101, 116, 54, 101, + 101, 102, 112, 102, 102, 119, 120, 121, 122, 117, + 114, 123, 115, 124, 118, 102, 137, 127, 97, 114, + 125, 126, 125, 129, 131, 132, 126, 123, 123, 133, + 135, 134, 119, 120, 121, 130, 122, 114, 130, 123, + 124, 130, 110, 102, 127, 134, 156, 125, 126, 125, + 129, 131, 132, 126, 123, 123, 133, 135, 161, 134, + 136, 136, 130, 149, 149, 130, 150, 150, 130, 151, + 151, 162, 134, 156, 163, 149, 109, 164, 165, 167, + 168, 169, 91, 170, 172, 161, 173, 174, 86, 176, - 133, 164, 166, 180, 148, 167, 181, 182, 168, 171, - 169, 183, 184, 185, 172, 192, 173, 175, 193, 176, - 177, 178, 179, 187, 187, 195, 196, 197, 198, 73, - 180, 199, 200, 181, 203, 182, 206, 207, 208, 183, - 184, 185, 209, 192, 210, 213, 193, 214, 218, 219, - 65, 220, 222, 195, 196, 197, 198, 187, 199, 200, - 224, 203, 225, 206, 207, 227, 208, 228, 229, 209, - 230, 210, 213, 231, 214, 232, 218, 219, 220, 222, - 233, 234, 63, 235, 236, 238, 242, 224, 240, 225, - 244, 247, 227, 249, 251, 228, 229, 230, 253, 254, + 177, 73, 178, 179, 136, 180, 181, 182, 183, 162, + 184, 163, 185, 149, 164, 165, 167, 168, 186, 169, + 170, 193, 172, 194, 173, 174, 176, 196, 177, 178, + 179, 197, 180, 181, 182, 198, 183, 199, 184, 200, + 185, 188, 188, 201, 204, 207, 186, 208, 209, 193, + 210, 194, 211, 214, 215, 196, 219, 220, 229, 197, + 221, 223, 225, 198, 226, 199, 200, 228, 230, 232, + 201, 204, 207, 231, 208, 188, 209, 210, 233, 211, + 214, 215, 234, 235, 219, 220, 229, 221, 223, 225, + 236, 226, 237, 239, 228, 241, 230, 232, 243, 252, - 260, 231, 259, 232, 261, 262, 60, 233, 40, 234, - 235, 38, 236, 238, 242, 240, 37, 244, 247, 33, - 249, 25, 251, 19, 17, 253, 12, 254, 260, 259, - 11, 261, 0, 262, 265, 265, 265, 265, 265, 265, - 265, 266, 266, 266, 266, 266, 266, 266, 267, 267, + 231, 245, 248, 250, 254, 255, 233, 260, 261, 234, + 262, 235, 263, 65, 63, 60, 40, 236, 38, 37, + 237, 239, 241, 25, 19, 17, 243, 252, 245, 248, + 250, 254, 12, 255, 260, 11, 261, 262, 0, 0, + 263, 266, 266, 266, 266, 266, 266, 266, 267, 267, 267, 267, 267, 267, 267, 268, 268, 268, 268, 268, 268, 268, 269, 269, 269, 269, 269, 269, 269, 270, 270, 270, 270, 270, 270, 270, 271, 271, 271, 271, - 271, 271, 271, 273, 273, 273, 273, 274, 0, 274, - 274, 275, 275, 276, 0, 276, 276, 276, 276, 276, + 271, 271, 271, 272, 272, 272, 272, 272, 272, 272, + 274, 274, 274, 274, 275, 0, 275, 275, 276, 276, 277, 0, 277, 277, 277, 277, 277, 278, 0, 278, 278, 278, 278, 278, 279, 0, 279, 279, 279, 279, 279, 280, 0, 280, 280, 280, 280, 280, 281, 0, - 0, 281, 281, 281, 281, 282, 0, 282, 282, 283, - 0, 283, 283, 284, 0, 284, 284, 285, 0, 285, - 285, 286, 0, 286, 286, 287, 0, 287, 287, 288, - 0, 288, 288, 289, 0, 289, 289, 290, 0, 290, - 290, 291, 0, 291, 291, 292, 0, 292, 292, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + 281, 281, 281, 281, 281, 282, 0, 0, 282, 282, + 282, 282, 283, 0, 283, 283, 284, 0, 284, 284, + 285, 0, 285, 285, 286, 0, 286, 286, 287, 0, + 287, 287, 288, 0, 288, 288, 289, 0, 289, 289, + 290, 0, 290, 290, 291, 0, 291, 291, 292, 0, + 292, 292, 293, 0, 293, 293, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264 + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265 } ; @@ -1561,13 +1561,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 >= 265 ) + if ( yy_current_state >= 266 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_current_state != 264 ); + while ( yy_current_state != 265 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -2158,15 +2158,14 @@ YY_RULE_SETUP if (valid) { node = parser->ast()->createNodeValueInt(value1); } else { - try { - double value2 = TRI_DoubleString(yytext); - node = parser->ast()->createNodeValueDouble(value2); - } catch (...) { - parser->registerWarning( - TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, - TRI_errno_string(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE), - yylloc->first_line, yylloc->first_column); + // TODO: use std::from_chars + double value2 = TRI_DoubleString(yytext); + + if (TRI_errno() != TRI_ERROR_NO_ERROR) { + parser->registerWarning(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, TRI_errno_string(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE), yylloc->first_line, yylloc->first_column); node = parser->ast()->createNodeValueNull(); + } else { + node = parser->ast()->createNodeValueDouble(value2); } } @@ -2182,13 +2181,13 @@ YY_RULE_SETUP arangodb::aql::AstNode* node = nullptr; auto parser = yyextra; + // TODO: use std::from_chars double value = TRI_DoubleString(yytext); if (TRI_errno() != TRI_ERROR_NO_ERROR) { parser->registerWarning(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, TRI_errno_string(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE), yylloc->first_line, yylloc->first_column); node = parser->ast()->createNodeValueNull(); - } - else { + } else { node = parser->ast()->createNodeValueDouble(value); } @@ -2653,7 +2652,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 >= 265 ) + if ( yy_current_state >= 266 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -2683,11 +2682,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 >= 265 ) + if ( yy_current_state >= 266 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 264); + yy_is_jam = (yy_current_state == 265); (void)yyg; return yy_is_jam ? 0 : yy_current_state; diff --git a/arangod/Aql/tokens.ll b/arangod/Aql/tokens.ll index c6ad2440f5..e17466c7bb 100644 --- a/arangod/Aql/tokens.ll +++ b/arangod/Aql/tokens.ll @@ -459,15 +459,14 @@ class Parser; if (valid) { node = parser->ast()->createNodeValueInt(value1); } else { - try { - double value2 = TRI_DoubleString(yytext); - node = parser->ast()->createNodeValueDouble(value2); - } catch (...) { - parser->registerWarning( - TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, - TRI_errno_string(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE), - yylloc->first_line, yylloc->first_column); + // TODO: use std::from_chars + double value2 = TRI_DoubleString(yytext); + + if (TRI_errno() != TRI_ERROR_NO_ERROR) { + parser->registerWarning(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, TRI_errno_string(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE), yylloc->first_line, yylloc->first_column); node = parser->ast()->createNodeValueNull(); + } else { + node = parser->ast()->createNodeValueDouble(value2); } } @@ -476,18 +475,18 @@ class Parser; return T_INTEGER; } -(0|[1-9][0-9]*)((\.[0-9]+)?([eE][\-\+]?[0-9]+)?) { +((0|[1-9][0-9]*)(\.[0-9]+)?|\.[0-9]+)([eE][\-\+]?[0-9]+)? { /* a numeric double value */ arangodb::aql::AstNode* node = nullptr; auto parser = yyextra; + // TODO: use std::from_chars double value = TRI_DoubleString(yytext); if (TRI_errno() != TRI_ERROR_NO_ERROR) { parser->registerWarning(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, TRI_errno_string(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE), yylloc->first_line, yylloc->first_column); node = parser->ast()->createNodeValueNull(); - } - else { + } else { node = parser->ast()->createNodeValueDouble(value); } diff --git a/tests/js/server/aql/aql-parse.js b/tests/js/server/aql/aql-parse.js index 4a6add2dfd..5c32f14b65 100644 --- a/tests/js/server/aql/aql-parse.js +++ b/tests/js/server/aql/aql-parse.js @@ -119,6 +119,12 @@ function ahuacatlParseTestSuite () { assertParseError(errors.ERROR_QUERY_PARSE.code, "return 1 + 1 +"); assertParseError(errors.ERROR_QUERY_PARSE.code, "return (1"); assertParseError(errors.ERROR_QUERY_PARSE.code, "for f1 in x1"); + assertParseError(errors.ERROR_QUERY_PARSE.code, "return 00"); + assertParseError(errors.ERROR_QUERY_PARSE.code, "return 01"); + assertParseError(errors.ERROR_QUERY_PARSE.code, "return 1."); + assertParseError(errors.ERROR_QUERY_PARSE.code, "return -"); + assertParseError(errors.ERROR_QUERY_PARSE.code, "return +"); + assertParseError(errors.ERROR_QUERY_PARSE.code, "return ."); }, //////////////////////////////////////////////////////////////////////////////// @@ -164,6 +170,79 @@ function ahuacatlParseTestSuite () { assertEqual([ ], getParameters(getParseResults("/* @nada */ return /* @@nada */ /*@@nada*/ 1 /*@nada*/"))); }, +//////////////////////////////////////////////////////////////////////////////// +/// @brief test number parsing +//////////////////////////////////////////////////////////////////////////////// + + testNumbers : function () { + function getRoot(query) { return getParseResults(query).ast[0]; } + + var returnNode = getRoot("return 0").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("value", returnNode.subNodes[0].type); + assertEqual(0, returnNode.subNodes[0].value); + + returnNode = getRoot("return 1").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("value", returnNode.subNodes[0].type); + assertEqual(1, returnNode.subNodes[0].value); + + returnNode = getRoot("return 9993835").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("value", returnNode.subNodes[0].type); + assertEqual(9993835, returnNode.subNodes[0].value); + + returnNode = getRoot("return .24982").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("value", returnNode.subNodes[0].type); + assertEqual(0.24982, returnNode.subNodes[0].value); + + returnNode = getRoot("return 1.2").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("value", returnNode.subNodes[0].type); + assertEqual(1.2, returnNode.subNodes[0].value); + + returnNode = getRoot("return 13442.029285").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("value", returnNode.subNodes[0].type); + assertEqual(13442.029285, returnNode.subNodes[0].value); + + returnNode = getRoot("return 12345").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("value", returnNode.subNodes[0].type); + assertEqual(12345, returnNode.subNodes[0].value); + + returnNode = getRoot("return -1").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("unary minus", returnNode.subNodes[0].type); + assertEqual("value", returnNode.subNodes[0].subNodes[0].type); + assertEqual(1, returnNode.subNodes[0].subNodes[0].value); + + returnNode = getRoot("return -193817872892").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("unary minus", returnNode.subNodes[0].type); + assertEqual("value", returnNode.subNodes[0].subNodes[0].type); + assertEqual(193817872892, returnNode.subNodes[0].subNodes[0].value); + + returnNode = getRoot("return -.95264").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("unary minus", returnNode.subNodes[0].type); + assertEqual("value", returnNode.subNodes[0].subNodes[0].type); + assertEqual(0.95264, returnNode.subNodes[0].subNodes[0].value); + + returnNode = getRoot("return -12345").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("unary minus", returnNode.subNodes[0].type); + assertEqual("value", returnNode.subNodes[0].subNodes[0].type); + assertEqual(12345, returnNode.subNodes[0].subNodes[0].value); + + returnNode = getRoot("return -92.4987521").subNodes[0]; + assertEqual("return", returnNode.type); + assertEqual("unary minus", returnNode.subNodes[0].type); + assertEqual("value", returnNode.subNodes[0].subNodes[0].type); + assertEqual(92.4987521, returnNode.subNodes[0].subNodes[0].value); + }, + //////////////////////////////////////////////////////////////////////////////// /// @brief test string parsing //////////////////////////////////////////////////////////////////////////////// @@ -262,8 +341,7 @@ function ahuacatlParseTestSuite () { try { AQL_EXECUTE(query[0]); fail(); - } - catch (err) { + } catch (err) { assertEqual(errors.ERROR_QUERY_PARSE.code, err.errorNum); assertMatch(/at position \d+:\d+/, err.errorMessage); var matches = err.errorMessage.match(/at position (\d+):(\d+)/); @@ -278,11 +356,6 @@ function ahuacatlParseTestSuite () { }; } -//////////////////////////////////////////////////////////////////////////////// -/// @brief executes the test suite -//////////////////////////////////////////////////////////////////////////////// - jsunity.run(ahuacatlParseTestSuite); return jsunity.done(); -