From 195d6903c1b443f725d14b6196391be55c07031c Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sun, 14 Oct 2012 16:18:28 +0200 Subject: [PATCH] added generated files --- README | 99 ++ arangod/Ahuacatl/ahuacatl-tokens.c | 2447 +++++++++++++++++++++++++++ js/common/bootstrap/errors.js | 139 ++ lib/BasicsC/voc-errors.c | 138 ++ lib/BasicsC/voc-errors.h | 1572 +++++++++++++++++ lib/JsonParser/json-parser.c | 2515 ++++++++++++++++++++++++++++ lib/V8/v8-json.cpp | 2357 ++++++++++++++++++++++++++ 7 files changed, 9267 insertions(+) create mode 100644 README create mode 100644 arangod/Ahuacatl/ahuacatl-tokens.c create mode 100644 js/common/bootstrap/errors.js create mode 100644 lib/BasicsC/voc-errors.c create mode 100644 lib/BasicsC/voc-errors.h create mode 100644 lib/JsonParser/json-parser.c create mode 100644 lib/V8/v8-json.cpp diff --git a/README b/README new file mode 100644 index 0000000000..03435098e4 --- /dev/null +++ b/README @@ -0,0 +1,99 @@ + + +AArraannggooDDBB + +_ _B_u_i_l_d_ _S_t_a_t_u_s_ +ArangoDB is a universal open-source database with flexible data model for +documents, graphs, and key-values. Build high performance application using a +convenient sql-like query language or JavaScript/Ruby extensions. +Key features include: + +* SScchheemmaa--ffrreeee sscchheemmaattaa let you combine the space efficiency of MySQL with the + performance power of NoSQL +* Use ArangoDB as an aapppplliiccaattiioonn sseerrvveerr and fuse your application and database + together for maximal throughput +* JavaScript for all: nnoo llaanngguuaaggee zzoooo, you can use one language from your + browser to your back-end +* ArangoDB is mmuullttii--tthhrreeaaddeedd - exploit the power of all your cores +* FFlleexxiibbllee ddaattaa mmooddeelliinngg: model your data as combination of key-value pairs, + documents or graphs - perfect for social relations +* Free iinnddeexx cchhooiiccee: use the correct index for your problem, be it a skip list + or a n-gram search +* Configurable dduurraabbiilliittyy: let the application decide if it needs more + durability or more performance +* No-nonsense storage: ArangoDB uses all of the power of mmooddeerrnn ssttoorraaggee + hhaarrddwwaarree, like SSD and large caches +* PPoowweerrffuull qquueerryy llaanngguuaaggee (AQL) to retrieve data +* It is ooppeenn ssoouurrccee (Apache Licence 2.0) + +For more in-depth information + +* read more on the _d_e_s_i_g_n_ _g_o_a_l_s_ _o_f_ _A_r_a_n_g_o_D_B +* _w_a_t_c_h_ _t_h_e_ _v_i_d_e_o - Martin Schoenert, architect of ArangoDB, gives an + introduction of what the ArangoDB project is about. +* or give it a try. + + +CCoommppiillaattiioonn + +Please check the _I_n_s_t_a_l_l_a_t_i_o_n_ _M_a_n_u_a_l for installation and compilation +instructions. + +MMaacc OOSS XX HHiinnttss + +On Mac OS X you can install ArangoDB using the packagemanager _H_o_m_e_b_r_e_w: + +* brew install arangodb (use --HEAD in order to build ArangoDB from current + master) + +This will install ArangoDB and all dependencies. Note that the server will be +installed as + + /usr/local/sbin/arangod + +The ArangoDB shell will be install as + + /usr/local/bin/arangosh + + +FFiirrsstt SStteeppss + +Start the server: + + > /usr/sbin/arangod + 2012-03-30T12:54:19Z [11794] INFO ArangoDB (version 1.x.y) is ready for + business + 2012-03-30T12:54:19Z [11794] INFO Have Fun! + +Start the shell in another windows: + + > /usr/bin/arangosh + _ + __ _ _ __ __ _ _ __ __ _ ___ ___| |__ + / _` | '__/ _` | '_ \ / _` |/ _ \/ __| '_ \ + | (_| | | | (_| | | | | (_| | (_) \__ \ | | | + \__,_|_| \__,_|_| |_|\__, |\___/|___/_| |_| + |___/ + + Welcome to arangosh 1.x.y. Copyright (c) 2012 triAGENS GmbH. + Using Google V8 3.9.4.0 JavaScript engine. + Using READLINE 6.1. + + Connected to Arango DB 127.0.0.1:8529 Version 1.x.y + + arangosh> db._create("examples") + [ArangoCollection 106097, "examples] + + arangosh> db.examples.save({ Hallo: "World" }); + {"error":false,"_id":"106097/2333739","_rev":2333739} + + arangosh> db.examples.all(); + [{ _id : "82883/1524675", _rev : 1524675, Hallo : "World" }] + + +CCaavveeaatt + +Please note that this is an early version of ArangoDB. There will be bugs and +we'd really appreciate it if you >report + them: +https://github.com/triAGENS/ArangoDB/issues diff --git a/arangod/Ahuacatl/ahuacatl-tokens.c b/arangod/Ahuacatl/ahuacatl-tokens.c new file mode 100644 index 0000000000..f14d639f07 --- /dev/null +++ b/arangod/Ahuacatl/ahuacatl-tokens.c @@ -0,0 +1,2447 @@ + +#line 3 "arangod/Ahuacatl/ahuacatl-tokens.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE Ahuacatlrestart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE Ahuacatllex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-yylineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + yy_size_t yyl;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via Ahuacatlrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void Ahuacatlrestart (FILE *input_file ,yyscan_t yyscanner ); +void Ahuacatl_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE Ahuacatl_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void Ahuacatl_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void Ahuacatl_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void Ahuacatlpush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void Ahuacatlpop_buffer_state (yyscan_t yyscanner ); + +static void Ahuacatlensure_buffer_stack (yyscan_t yyscanner ); +static void Ahuacatl_load_buffer_state (yyscan_t yyscanner ); +static void Ahuacatl_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER Ahuacatl_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE Ahuacatl_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE Ahuacatl_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE Ahuacatl_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); + +void *Ahuacatlalloc (yy_size_t ,yyscan_t yyscanner ); +void *Ahuacatlrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void Ahuacatlfree (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer Ahuacatl_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + Ahuacatlensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + Ahuacatl_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + Ahuacatlensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + Ahuacatl_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define Ahuacatlwrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 54 +#define YY_END_OF_BUFFER 55 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[133] = + { 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, + 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, + + 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 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 6, 1, 1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 20, 1, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 27, 27, 32, 27, 27, 33, 34, 35, 36, 27, + 27, 37, 38, 39, 40, 27, 27, 27, 27, 27, + 41, 42, 43, 1, 44, 45, 46, 27, 47, 48, + + 49, 50, 27, 27, 51, 27, 27, 52, 53, 54, + 55, 27, 27, 56, 57, 58, 59, 27, 27, 27, + 27, 27, 60, 61, 62, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[63] = + { 0, + 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 1, 3, 3, 1, + 1, 1, 1, 1, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 1, 1, 1, 6, 1, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, + 1, 1 + } ; + +static yyconst flex_int16_t yy_base[144] = + { 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, 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 + } ; + +static yyconst flex_int16_t yy_def[144] = + { 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, + + 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 + } ; + +static yyconst flex_int16_t yy_nxt[336] = + { 0, + 6, 7, 8, 7, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 6, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 30, + 33, 34, 35, 30, 36, 30, 37, 38, 39, 30, + 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, + + 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, + + 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, + + 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 + } ; + +static yyconst flex_int16_t yy_chk[336] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 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, + + 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, + + 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, + + 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 + } ; + +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[55] = + { 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, }; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET + +#include +#include + +#include "Ahuacatl/ahuacatl-ast-node.h" +#include "Ahuacatl/ahuacatl-context.h" +#include "Ahuacatl/ahuacatl-grammar.h" +#include "Ahuacatl/ahuacatl-parser.h" + +#define YY_EXTRA_TYPE TRI_aql_context_t* + +#define YY_USER_ACTION yylloc->first_line = yylineno; yylloc->first_column = yycolumn; yylloc->last_column = yycolumn + yyleng - 1; yycolumn += yyleng; + +#define YY_NO_INPUT 1 + +#define YY_INPUT(resultBuffer, resultState, maxBytesToRead) { \ + TRI_aql_parser_t* parser = (TRI_aql_parser_t*) (yyextra)->_parser; \ + int length = parser->_length; \ + if (length > maxBytesToRead) { \ + length = maxBytesToRead; \ + } \ + if (length > 0) { \ + memcpy(resultBuffer, parser->_buffer, length); \ + parser->_buffer += length; \ + parser->_length -= length; \ + resultState = length; \ + } \ + else { \ + resultState = YY_NULL; \ + } \ +} + +#define INITIAL 0 +#define COMMENT 1 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + yy_size_t yy_n_chars; + yy_size_t yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + YYSTYPE * yylval_r; + + YYLTYPE * yylloc_r; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + + /* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ + # define yylval yyg->yylval_r + + # define yylloc yyg->yylloc_r + +int Ahuacatllex_init (yyscan_t* scanner); + +int Ahuacatllex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int Ahuacatllex_destroy (yyscan_t yyscanner ); + +int Ahuacatlget_debug (yyscan_t yyscanner ); + +void Ahuacatlset_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE Ahuacatlget_extra (yyscan_t yyscanner ); + +void Ahuacatlset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *Ahuacatlget_in (yyscan_t yyscanner ); + +void Ahuacatlset_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *Ahuacatlget_out (yyscan_t yyscanner ); + +void Ahuacatlset_out (FILE * out_str ,yyscan_t yyscanner ); + +yy_size_t Ahuacatlget_leng (yyscan_t yyscanner ); + +char *Ahuacatlget_text (yyscan_t yyscanner ); + +int Ahuacatlget_lineno (yyscan_t yyscanner ); + +void Ahuacatlset_lineno (int line_number ,yyscan_t yyscanner ); + +YYSTYPE * Ahuacatlget_lval (yyscan_t yyscanner ); + +void Ahuacatlset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); + + YYLTYPE *Ahuacatlget_lloc (yyscan_t yyscanner ); + + void Ahuacatlset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int Ahuacatlwrap (yyscan_t yyscanner ); +#else +extern int Ahuacatlwrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + yy_size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int Ahuacatllex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); + +#define YY_DECL int Ahuacatllex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* --------------------------------------------------------------------------- + * language keywords + * --------------------------------------------------------------------------- */ + + yylval = yylval_param; + + yylloc = yylloc_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + Ahuacatlensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + Ahuacatl_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + Ahuacatl_load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + 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 ) + 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 ); + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + yy_size_t yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + } + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +{ + return T_FOR; +} + YY_BREAK +case 2: +YY_RULE_SETUP +{ + return T_LET; +} + YY_BREAK +case 3: +YY_RULE_SETUP +{ + return T_FILTER; +} + YY_BREAK +case 4: +YY_RULE_SETUP +{ + return T_RETURN; +} + YY_BREAK +case 5: +YY_RULE_SETUP +{ + return T_COLLECT; +} + YY_BREAK +case 6: +YY_RULE_SETUP +{ + return T_SORT; +} + YY_BREAK +case 7: +YY_RULE_SETUP +{ + return T_LIMIT; +} + YY_BREAK +case 8: +YY_RULE_SETUP +{ + return T_ASC; +} + YY_BREAK +case 9: +YY_RULE_SETUP +{ + return T_DESC; +} + YY_BREAK +case 10: +YY_RULE_SETUP +{ + return T_IN; +} + YY_BREAK +case 11: +YY_RULE_SETUP +{ + return T_INTO; +} + YY_BREAK +/* --------------------------------------------------------------------------- + * predefined type literals + * --------------------------------------------------------------------------- */ +case 12: +YY_RULE_SETUP +{ + return T_NULL; +} + YY_BREAK +case 13: +YY_RULE_SETUP +{ + return T_TRUE; +} + YY_BREAK +case 14: +YY_RULE_SETUP +{ + return T_FALSE; +} + YY_BREAK +/* --------------------------------------------------------------------------- + * operators + * --------------------------------------------------------------------------- */ +case 15: +YY_RULE_SETUP +{ + return T_EQ; +} + YY_BREAK +case 16: +YY_RULE_SETUP +{ + return T_NE; +} + YY_BREAK +case 17: +YY_RULE_SETUP +{ + return T_GE; +} + YY_BREAK +case 18: +YY_RULE_SETUP +{ + return T_GT; +} + YY_BREAK +case 19: +YY_RULE_SETUP +{ + return T_LE; +} + YY_BREAK +case 20: +YY_RULE_SETUP +{ + return T_LT; +} + YY_BREAK +case 21: +YY_RULE_SETUP +{ + return T_ASSIGN; +} + YY_BREAK +case 22: +YY_RULE_SETUP +{ + return T_NOT; +} + YY_BREAK +case 23: +YY_RULE_SETUP +{ + return T_AND; +} + YY_BREAK +case 24: +YY_RULE_SETUP +{ + return T_OR; +} + YY_BREAK +case 25: +YY_RULE_SETUP +{ + return T_PLUS; +} + YY_BREAK +case 26: +YY_RULE_SETUP +{ + return T_MINUS; +} + YY_BREAK +case 27: +YY_RULE_SETUP +{ + return T_TIMES; +} + YY_BREAK +case 28: +YY_RULE_SETUP +{ + return T_DIV; +} + YY_BREAK +case 29: +YY_RULE_SETUP +{ + return T_MOD; +} + YY_BREAK +case 30: +YY_RULE_SETUP +{ + return T_QUESTION; +} + YY_BREAK +case 31: +YY_RULE_SETUP +{ + return T_COLON; +} + YY_BREAK +case 32: +YY_RULE_SETUP +{ + return T_EXPAND; +} + YY_BREAK +/* --------------------------------------------------------------------------- + * punctuation + * --------------------------------------------------------------------------- */ +case 33: +YY_RULE_SETUP +{ + return T_COMMA; +} + YY_BREAK +case 34: +YY_RULE_SETUP +{ + return T_OPEN; +} + YY_BREAK +case 35: +YY_RULE_SETUP +{ + return T_CLOSE; +} + YY_BREAK +case 36: +YY_RULE_SETUP +{ + return T_DOC_OPEN; +} + YY_BREAK +case 37: +YY_RULE_SETUP +{ + return T_DOC_CLOSE; +} + YY_BREAK +case 38: +YY_RULE_SETUP +{ + return T_LIST_OPEN; +} + YY_BREAK +case 39: +YY_RULE_SETUP +{ + return T_LIST_CLOSE; +} + YY_BREAK +/* --------------------------------------------------------------------------- + * literals + * --------------------------------------------------------------------------- */ +case 40: +YY_RULE_SETUP +{ + /* unquoted string */ + yylval->strval = TRI_RegisterStringAql(yyextra, yytext, yyleng, false); + return T_STRING; +} + YY_BREAK +case 41: +/* rule 41 can match eol */ +YY_RULE_SETUP +{ + /* string enclosed in backticks */ + yylval->strval = TRI_RegisterStringAql(yyextra, yytext + 1, yyleng - 2, true); + return T_STRING; +} + YY_BREAK +case 42: +/* rule 42 can match eol */ +YY_RULE_SETUP +{ + /* string enclosed in double quotes */ + yylval->strval = TRI_RegisterStringAql(yyextra, yytext + 1, yyleng - 2, true); + return T_QUOTED_STRING; +} + YY_BREAK +case 43: +/* rule 43 can match eol */ +YY_RULE_SETUP +{ + /* string enclosed in single quotes */ + yylval->strval = TRI_RegisterStringAql(yyextra, yytext + 1, yyleng - 2, true); + return T_QUOTED_STRING; +} + YY_BREAK +case 44: +YY_RULE_SETUP +{ + /* a numeric value */ + yylval->strval = TRI_RegisterStringAql(yyextra, yytext, yyleng, false); + return T_NUMBER; +} + YY_BREAK +/* --------------------------------------------------------------------------- + * bind parameters + * --------------------------------------------------------------------------- */ +case 45: +YY_RULE_SETUP +{ + /* bind parameters must start with a @ + if followed by another @, this is a collection name parameter */ + yylval->strval = TRI_RegisterStringAql(yyextra, yytext + 1, yyleng - 1, false); + return T_PARAMETER; +} + YY_BREAK +/* --------------------------------------------------------------------------- + * whitespace etc. + * --------------------------------------------------------------------------- */ +case 46: +/* rule 46 can match eol */ +YY_RULE_SETUP +{ + /* whitespace is ignored */ +} + YY_BREAK +case 47: +YY_RULE_SETUP +{ + BEGIN(COMMENT); +} + YY_BREAK +case 48: +YY_RULE_SETUP +{ + BEGIN(INITIAL); +} + YY_BREAK +case 49: +YY_RULE_SETUP +{ + // eat comment in chunks +} + YY_BREAK +case 50: +YY_RULE_SETUP +{ + // eat the lone star +} + YY_BREAK +case 51: +/* rule 51 can match eol */ +YY_RULE_SETUP +{ + yylineno++; +} + YY_BREAK +case 52: +YY_RULE_SETUP +{ + yylineno++; +} + YY_BREAK +case 53: +YY_RULE_SETUP +{ + /* anything else is returned as it is */ + return (int) yytext[0]; +} + YY_BREAK +case 54: +YY_RULE_SETUP +ECHO; + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(COMMENT): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * Ahuacatllex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( Ahuacatlwrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of Ahuacatllex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + Ahuacatlrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + Ahuacatlrestart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) Ahuacatlrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + 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 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + 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 ) + 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); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + Ahuacatlrestart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( Ahuacatlwrap(yyscanner ) ) + return 0; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + if ( c == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void Ahuacatlrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + Ahuacatlensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + Ahuacatl_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + Ahuacatl_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + Ahuacatl_load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void Ahuacatl_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * Ahuacatlpop_buffer_state(); + * Ahuacatlpush_buffer_state(new_buffer); + */ + Ahuacatlensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + Ahuacatl_load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (Ahuacatlwrap()) processing, but the only time this flag + * is looked at is after Ahuacatlwrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void Ahuacatl_load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE Ahuacatl_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) Ahuacatlalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in Ahuacatl_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) Ahuacatlalloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in Ahuacatl_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + Ahuacatl_init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with Ahuacatl_create_buffer() + * @param yyscanner The scanner object. + */ + void Ahuacatl_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + Ahuacatlfree((void *) b->yy_ch_buf ,yyscanner ); + + Ahuacatlfree((void *) b ,yyscanner ); +} + +#ifndef __cplusplus +#ifndef _WIN32 +extern int isatty (int ); +#endif +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a Ahuacatlrestart() or at EOF. + */ + static void Ahuacatl_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + Ahuacatl_flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then Ahuacatl_init_buffer was _probably_ + * called from Ahuacatlrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void Ahuacatl_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + Ahuacatl_load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void Ahuacatlpush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + Ahuacatlensure_buffer_stack(yyscanner); + + /* This block is copied from Ahuacatl_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from Ahuacatl_switch_to_buffer. */ + Ahuacatl_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void Ahuacatlpop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + Ahuacatl_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + Ahuacatl_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void Ahuacatlensure_buffer_stack (yyscan_t yyscanner) +{ + yy_size_t num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)Ahuacatlalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in Ahuacatlensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)Ahuacatlrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in Ahuacatlensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE Ahuacatl_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) Ahuacatlalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in Ahuacatl_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + Ahuacatl_switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to Ahuacatllex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * Ahuacatl_scan_bytes() instead. + */ +YY_BUFFER_STATE Ahuacatl_scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return Ahuacatl_scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to Ahuacatllex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE Ahuacatl_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n, i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) Ahuacatlalloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in Ahuacatl_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = Ahuacatl_scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in Ahuacatl_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE Ahuacatlget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int Ahuacatlget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int Ahuacatlget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *Ahuacatlget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *Ahuacatlget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +yy_size_t Ahuacatlget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *Ahuacatlget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void Ahuacatlset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void Ahuacatlset_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "Ahuacatlset_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void Ahuacatlset_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "Ahuacatlset_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see Ahuacatl_switch_to_buffer + */ +void Ahuacatlset_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void Ahuacatlset_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int Ahuacatlget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void Ahuacatlset_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * Ahuacatlget_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void Ahuacatlset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +YYLTYPE *Ahuacatlget_lloc (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylloc; +} + +void Ahuacatlset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylloc = yylloc_param; +} + +/* User-visible API */ + +/* Ahuacatllex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int Ahuacatllex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) Ahuacatlalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* Ahuacatllex_init_extra has the same functionality as Ahuacatllex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to Ahuacatlalloc in + * the yyextra field. + */ + +int Ahuacatllex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + Ahuacatlset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) Ahuacatlalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + Ahuacatlset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from Ahuacatllex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * Ahuacatllex_init() + */ + return 0; +} + +/* Ahuacatllex_destroy is for both reentrant and non-reentrant scanners. */ +int Ahuacatllex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + Ahuacatl_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + Ahuacatlpop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + Ahuacatlfree(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + Ahuacatlfree(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * Ahuacatllex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + Ahuacatlfree ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *Ahuacatlalloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *Ahuacatlrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void Ahuacatlfree (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see Ahuacatlrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + diff --git a/js/common/bootstrap/errors.js b/js/common/bootstrap/errors.js new file mode 100644 index 0000000000..d1458cf94e --- /dev/null +++ b/js/common/bootstrap/errors.js @@ -0,0 +1,139 @@ +/*jslint indent: 2, + nomen: true, + maxlen: 240, + sloppy: true, + vars: true, + white: true, + plusplus: true */ +/*global require */ + +//////////////////////////////////////////////////////////////////////////////// +/// @brief auto-generated file generated from errors.dat +//////////////////////////////////////////////////////////////////////////////// + +(function () { + var internal = require("internal"); + + internal.errors = { + "ERROR_NO_ERROR" : { "code" : 0, "message" : "no error" }, + "ERROR_FAILED" : { "code" : 1, "message" : "failed" }, + "ERROR_SYS_ERROR" : { "code" : 2, "message" : "system error" }, + "ERROR_OUT_OF_MEMORY" : { "code" : 3, "message" : "out of memory" }, + "ERROR_INTERNAL" : { "code" : 4, "message" : "internal error" }, + "ERROR_ILLEGAL_NUMBER" : { "code" : 5, "message" : "illegal number" }, + "ERROR_NUMERIC_OVERFLOW" : { "code" : 6, "message" : "numeric overflow" }, + "ERROR_ILLEGAL_OPTION" : { "code" : 7, "message" : "illegal option" }, + "ERROR_DEAD_PID" : { "code" : 8, "message" : "dead process identifier" }, + "ERROR_NOT_IMPLEMENTED" : { "code" : 9, "message" : "not implemented" }, + "ERROR_BAD_PARAMETER" : { "code" : 10, "message" : "bad parameter" }, + "ERROR_FORBIDDEN" : { "code" : 11, "message" : "forbidden" }, + "ERROR_OUT_OF_MEMORY_MMAP" : { "code" : 12, "message" : "out of memory in mmap" }, + "ERROR_CORRUPTED_CSV" : { "code" : 13, "message" : "csv is corrupt" }, + "ERROR_HTTP_BAD_PARAMETER" : { "code" : 400, "message" : "bad parameter" }, + "ERROR_HTTP_FORBIDDEN" : { "code" : 403, "message" : "forbidden" }, + "ERROR_HTTP_NOT_FOUND" : { "code" : 404, "message" : "not found" }, + "ERROR_HTTP_METHOD_NOT_ALLOWED" : { "code" : 405, "message" : "method not supported" }, + "ERROR_HTTP_SERVER_ERROR" : { "code" : 500, "message" : "internal server error" }, + "ERROR_HTTP_CORRUPTED_JSON" : { "code" : 600, "message" : "invalid JSON object" }, + "ERROR_HTTP_SUPERFLUOUS_SUFFICES" : { "code" : 601, "message" : "superfluous URL suffices" }, + "ERROR_ARANGO_ILLEGAL_STATE" : { "code" : 1000, "message" : "illegal state" }, + "ERROR_ARANGO_SHAPER_FAILED" : { "code" : 1001, "message" : "illegal shaper" }, + "ERROR_ARANGO_DATAFILE_SEALED" : { "code" : 1002, "message" : "datafile sealed" }, + "ERROR_ARANGO_UNKNOWN_COLLECTION_TYPE" : { "code" : 1003, "message" : "unknown type" }, + "ERROR_ARANGO_READ_ONLY" : { "code" : 1004, "message" : "ready only" }, + "ERROR_ARANGO_DUPLICATE_IDENTIFIER" : { "code" : 1005, "message" : "duplicate identifier" }, + "ERROR_ARANGO_DATAFILE_UNREADABLE" : { "code" : 1006, "message" : "datafile unreadable" }, + "ERROR_ARANGO_CORRUPTED_DATAFILE" : { "code" : 1100, "message" : "corrupted datafile" }, + "ERROR_ARANGO_ILLEGAL_PARAMETER_FILE" : { "code" : 1101, "message" : "illegal parameter file" }, + "ERROR_ARANGO_CORRUPTED_COLLECTION" : { "code" : 1102, "message" : "corrupted collection" }, + "ERROR_ARANGO_MMAP_FAILED" : { "code" : 1103, "message" : "mmap failed" }, + "ERROR_ARANGO_FILESYSTEM_FULL" : { "code" : 1104, "message" : "filesystem full" }, + "ERROR_ARANGO_NO_JOURNAL" : { "code" : 1105, "message" : "no journal" }, + "ERROR_ARANGO_DATAFILE_ALREADY_EXISTS" : { "code" : 1106, "message" : "cannot create/rename datafile because it already exists" }, + "ERROR_ARANGO_DATABASE_LOCKED" : { "code" : 1107, "message" : "database is locked" }, + "ERROR_ARANGO_COLLECTION_DIRECTORY_ALREADY_EXISTS" : { "code" : 1108, "message" : "cannot create/rename collection because directory already exists" }, + "ERROR_ARANGO_CONFLICT" : { "code" : 1200, "message" : "conflict" }, + "ERROR_ARANGO_WRONG_VOCBASE_PATH" : { "code" : 1201, "message" : "wrong path for database" }, + "ERROR_ARANGO_DOCUMENT_NOT_FOUND" : { "code" : 1202, "message" : "document not found" }, + "ERROR_ARANGO_COLLECTION_NOT_FOUND" : { "code" : 1203, "message" : "collection not found" }, + "ERROR_ARANGO_COLLECTION_PARAMETER_MISSING" : { "code" : 1204, "message" : "parameter 'collection' not found" }, + "ERROR_ARANGO_DOCUMENT_HANDLE_BAD" : { "code" : 1205, "message" : "illegal document handle" }, + "ERROR_ARANGO_MAXIMAL_SIZE_TOO_SMALL" : { "code" : 1206, "message" : "maixaml size of journal too small" }, + "ERROR_ARANGO_DUPLICATE_NAME" : { "code" : 1207, "message" : "duplicate name" }, + "ERROR_ARANGO_ILLEGAL_NAME" : { "code" : 1208, "message" : "illegal name" }, + "ERROR_ARANGO_NO_INDEX" : { "code" : 1209, "message" : "no suitable index known" }, + "ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED" : { "code" : 1210, "message" : "unique constraint violated" }, + "ERROR_ARANGO_GEO_INDEX_VIOLATED" : { "code" : 1211, "message" : "geo index violated" }, + "ERROR_ARANGO_INDEX_NOT_FOUND" : { "code" : 1212, "message" : "index not found" }, + "ERROR_ARANGO_CROSS_COLLECTION_REQUEST" : { "code" : 1213, "message" : "cross collection request not allowed" }, + "ERROR_ARANGO_INDEX_HANDLE_BAD" : { "code" : 1214, "message" : "illegal index handle" }, + "ERROR_ARANGO_CAP_CONSTRAINT_ALREADY_DEFINED" : { "code" : 1215, "message" : "cap constraint already defined" }, + "ERROR_ARANGO_DOCUMENT_TOO_LARGE" : { "code" : 1216, "message" : "document too large" }, + "ERROR_ARANGO_COLLECTION_NOT_UNLOADED" : { "code" : 1217, "message" : "collection must be unloaded" }, + "ERROR_ARANGO_COLLECTION_TYPE_INVALID" : { "code" : 1218, "message" : "collection type invalid" }, + "ERROR_ARANGO_DATAFILE_FULL" : { "code" : 1300, "message" : "datafile full" }, + "ERROR_QUERY_KILLED" : { "code" : 1500, "message" : "query killed" }, + "ERROR_QUERY_PARSE" : { "code" : 1501, "message" : "%s" }, + "ERROR_QUERY_EMPTY" : { "code" : 1502, "message" : "query is empty" }, + "ERROR_QUERY_SCRIPT" : { "code" : 1503, "message" : "runtime error '%s'" }, + "ERROR_QUERY_NUMBER_OUT_OF_RANGE" : { "code" : 1504, "message" : "number out of range" }, + "ERROR_QUERY_VARIABLE_NAME_INVALID" : { "code" : 1510, "message" : "variable name '%s' has an invalid format" }, + "ERROR_QUERY_VARIABLE_REDECLARED" : { "code" : 1511, "message" : "variable '%s' is assigned multiple times" }, + "ERROR_QUERY_VARIABLE_NAME_UNKNOWN" : { "code" : 1512, "message" : "unknown variable '%s'" }, + "ERROR_QUERY_COLLECTION_NOT_FOUND" : { "code" : 1520, "message" : "unable to open collection '%s'" }, + "ERROR_QUERY_COLLECTION_LOCK_FAILED" : { "code" : 1521, "message" : "unable to read-lock collection %s" }, + "ERROR_QUERY_TOO_MANY_COLLECTIONS" : { "code" : 1522, "message" : "too many collections" }, + "ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED" : { "code" : 1530, "message" : "document attribute '%s' is assigned multiple times" }, + "ERROR_QUERY_FUNCTION_NAME_UNKNOWN" : { "code" : 1540, "message" : "usage of unknown function '%s'" }, + "ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH" : { "code" : 1541, "message" : "invalid number of arguments for function '%s'" }, + "ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH" : { "code" : 1542, "message" : "invalid argument type used in call to function '%s()'" }, + "ERROR_QUERY_BIND_PARAMETERS_INVALID" : { "code" : 1550, "message" : "invalid structure of bind parameters" }, + "ERROR_QUERY_BIND_PARAMETER_MISSING" : { "code" : 1551, "message" : "no value specified for declared bind parameter '%s'" }, + "ERROR_QUERY_BIND_PARAMETER_UNDECLARED" : { "code" : 1552, "message" : "bind parameter '%s' was not declared in the query" }, + "ERROR_QUERY_BIND_PARAMETER_TYPE" : { "code" : 1553, "message" : "bind parameter '%s' has an invalid value or type" }, + "ERROR_QUERY_INVALID_LOGICAL_VALUE" : { "code" : 1560, "message" : "invalid logical value" }, + "ERROR_QUERY_INVALID_ARITHMETIC_VALUE" : { "code" : 1561, "message" : "invalid arithmetic value" }, + "ERROR_QUERY_DIVISION_BY_ZERO" : { "code" : 1562, "message" : "division by zero" }, + "ERROR_QUERY_LIST_EXPECTED" : { "code" : 1563, "message" : "list expected" }, + "ERROR_QUERY_FAIL_CALLED" : { "code" : 1569, "message" : "FAIL(%s) called" }, + "ERROR_QUERY_GEO_INDEX_MISSING" : { "code" : 1570, "message" : "no suitable geo index found for geo restriction on '%s'" }, + "ERROR_CURSOR_NOT_FOUND" : { "code" : 1600, "message" : "cursor not found" }, + "ERROR_KEYVALUE_INVALID_KEY" : { "code" : 1800, "message" : "invalid key declaration" }, + "ERROR_KEYVALUE_KEY_EXISTS" : { "code" : 1801, "message" : "key already exists" }, + "ERROR_KEYVALUE_KEY_NOT_FOUND" : { "code" : 1802, "message" : "key not found" }, + "ERROR_KEYVALUE_KEY_NOT_UNIQUE" : { "code" : 1803, "message" : "key is not unique" }, + "ERROR_KEYVALUE_KEY_NOT_CHANGED" : { "code" : 1804, "message" : "key value not changed" }, + "ERROR_KEYVALUE_KEY_NOT_REMOVED" : { "code" : 1805, "message" : "key value not removed" }, + "ERROR_KEYVALUE_NO_VALUE" : { "code" : 1806, "message" : "missing value" }, + "ERROR_GRAPH_INVALID_GRAPH" : { "code" : 1901, "message" : "invalid graph" }, + "ERROR_GRAPH_COULD_NOT_CREATE_GRAPH" : { "code" : 1902, "message" : "could not create graph" }, + "ERROR_GRAPH_INVALID_VERTEX" : { "code" : 1903, "message" : "invalid vertex" }, + "ERROR_GRAPH_COULD_NOT_CREATE_VERTEX" : { "code" : 1904, "message" : "could not create vertex" }, + "ERROR_GRAPH_COULD_NOT_CHANGE_VERTEX" : { "code" : 1905, "message" : "could not change vertex" }, + "ERROR_GRAPH_INVALID_EDGE" : { "code" : 1906, "message" : "invalid edge" }, + "ERROR_GRAPH_COULD_NOT_CREATE_EDGE" : { "code" : 1907, "message" : "could not create edge" }, + "ERROR_GRAPH_COULD_NOT_CHANGE_EDGE" : { "code" : 1908, "message" : "could not change edge" }, + "SIMPLE_CLIENT_UNKNOWN_ERROR" : { "code" : 2000, "message" : "unknown client error" }, + "SIMPLE_CLIENT_COULD_NOT_CONNECT" : { "code" : 2001, "message" : "could not connect to server" }, + "SIMPLE_CLIENT_COULD_NOT_WRITE" : { "code" : 2002, "message" : "could not write to server" }, + "SIMPLE_CLIENT_COULD_NOT_READ" : { "code" : 2003, "message" : "could not read from server" }, + "ERROR_ARANGO_INDEX_PQ_INSERT_FAILED" : { "code" : 3100, "message" : "priority queue insert failure" }, + "ERROR_ARANGO_INDEX_PQ_REMOVE_FAILED" : { "code" : 3110, "message" : "priority queue remove failure" }, + "ERROR_ARANGO_INDEX_PQ_REMOVE_ITEM_MISSING" : { "code" : 3111, "message" : "priority queue remove failure - item missing in index" }, + "ERROR_ARANGO_INDEX_HASH_INSERT_ITEM_DUPLICATED" : { "code" : 3312, "message" : "(non-unique) hash index insert failure - document duplicated in index" }, + "ERROR_ARANGO_INDEX_SKIPLIST_INSERT_ITEM_DUPLICATED" : { "code" : 3313, "message" : "(non-unique) skiplist index insert failure - document duplicated in index" }, + "WARNING_ARANGO_INDEX_HASH_DOCUMENT_ATTRIBUTE_MISSING" : { "code" : 3200, "message" : "hash index insertion warning - attribute missing in document" }, + "WARNING_ARANGO_INDEX_HASH_UPDATE_ATTRIBUTE_MISSING" : { "code" : 3202, "message" : "hash index update warning - attribute missing in revised document" }, + "WARNING_ARANGO_INDEX_HASH_REMOVE_ITEM_MISSING" : { "code" : 3211, "message" : "hash index remove failure - item missing in index" }, + "WARNING_ARANGO_INDEX_SKIPLIST_DOCUMENT_ATTRIBUTE_MISSING" : { "code" : 3300, "message" : "skiplist index insertion warning - attribute missing in document" }, + "WARNING_ARANGO_INDEX_SKIPLIST_UPDATE_ATTRIBUTE_MISSING" : { "code" : 3302, "message" : "skiplist index update warning - attribute missing in revised document" }, + "WARNING_ARANGO_INDEX_SKIPLIST_REMOVE_ITEM_MISSING" : { "code" : 3311, "message" : "skiplist index remove failure - item missing in index" }, + "WARNING_ARANGO_INDEX_BITARRAY_DOCUMENT_ATTRIBUTE_MISSING" : { "code" : 3400, "message" : "bitarray index insertion warning - attribute missing in document" }, + "WARNING_ARANGO_INDEX_BITARRAY_UPDATE_ATTRIBUTE_MISSING" : { "code" : 3402, "message" : "bitarray index update warning - attribute missing in revised document" }, + "WARNING_ARANGO_INDEX_BITARRAY_REMOVE_ITEM_MISSING" : { "code" : 3411, "message" : "bitarray index remove failure - item missing in index" }, + "ERROR_ARANGO_INDEX_BITARRAY_INSERT_ITEM_UNSUPPORTED_VALUE" : { "code" : 3413, "message" : "bitarray index insert failure - document attribute value unsupported in index" }, + "ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_ATTRIBUTES" : { "code" : 3415, "message" : "bitarray index creation failure - one or more index attributes are duplicated." }, + "ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_VALUES" : { "code" : 3417, "message" : "bitarray index creation failure - one or more index attribute values are duplicated." }, +}; +}()); + diff --git a/lib/BasicsC/voc-errors.c b/lib/BasicsC/voc-errors.c new file mode 100644 index 0000000000..266bc28237 --- /dev/null +++ b/lib/BasicsC/voc-errors.c @@ -0,0 +1,138 @@ +//////////////////////////////////////////////////////////////////////////////// +/// @brief auto-generated file generated from errors.dat +//////////////////////////////////////////////////////////////////////////////// + +#include +#include "./lib/BasicsC/voc-errors.h" + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup VocError +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +void TRI_InitialiseErrorMessages (void) { + REG_ERROR(ERROR_NO_ERROR, "no error"); + REG_ERROR(ERROR_FAILED, "failed"); + REG_ERROR(ERROR_SYS_ERROR, "system error"); + REG_ERROR(ERROR_OUT_OF_MEMORY, "out of memory"); + REG_ERROR(ERROR_INTERNAL, "internal error"); + REG_ERROR(ERROR_ILLEGAL_NUMBER, "illegal number"); + REG_ERROR(ERROR_NUMERIC_OVERFLOW, "numeric overflow"); + REG_ERROR(ERROR_ILLEGAL_OPTION, "illegal option"); + REG_ERROR(ERROR_DEAD_PID, "dead process identifier"); + REG_ERROR(ERROR_NOT_IMPLEMENTED, "not implemented"); + REG_ERROR(ERROR_BAD_PARAMETER, "bad parameter"); + REG_ERROR(ERROR_FORBIDDEN, "forbidden"); + REG_ERROR(ERROR_OUT_OF_MEMORY_MMAP, "out of memory in mmap"); + REG_ERROR(ERROR_CORRUPTED_CSV, "csv is corrupt"); + REG_ERROR(ERROR_HTTP_BAD_PARAMETER, "bad parameter"); + REG_ERROR(ERROR_HTTP_FORBIDDEN, "forbidden"); + REG_ERROR(ERROR_HTTP_NOT_FOUND, "not found"); + REG_ERROR(ERROR_HTTP_METHOD_NOT_ALLOWED, "method not supported"); + REG_ERROR(ERROR_HTTP_SERVER_ERROR, "internal server error"); + REG_ERROR(ERROR_HTTP_CORRUPTED_JSON, "invalid JSON object"); + REG_ERROR(ERROR_HTTP_SUPERFLUOUS_SUFFICES, "superfluous URL suffices"); + REG_ERROR(ERROR_ARANGO_ILLEGAL_STATE, "illegal state"); + REG_ERROR(ERROR_ARANGO_SHAPER_FAILED, "illegal shaper"); + REG_ERROR(ERROR_ARANGO_DATAFILE_SEALED, "datafile sealed"); + REG_ERROR(ERROR_ARANGO_UNKNOWN_COLLECTION_TYPE, "unknown type"); + REG_ERROR(ERROR_ARANGO_READ_ONLY, "ready only"); + REG_ERROR(ERROR_ARANGO_DUPLICATE_IDENTIFIER, "duplicate identifier"); + REG_ERROR(ERROR_ARANGO_DATAFILE_UNREADABLE, "datafile unreadable"); + REG_ERROR(ERROR_ARANGO_CORRUPTED_DATAFILE, "corrupted datafile"); + REG_ERROR(ERROR_ARANGO_ILLEGAL_PARAMETER_FILE, "illegal parameter file"); + REG_ERROR(ERROR_ARANGO_CORRUPTED_COLLECTION, "corrupted collection"); + REG_ERROR(ERROR_ARANGO_MMAP_FAILED, "mmap failed"); + REG_ERROR(ERROR_ARANGO_FILESYSTEM_FULL, "filesystem full"); + REG_ERROR(ERROR_ARANGO_NO_JOURNAL, "no journal"); + REG_ERROR(ERROR_ARANGO_DATAFILE_ALREADY_EXISTS, "cannot create/rename datafile because it already exists"); + REG_ERROR(ERROR_ARANGO_DATABASE_LOCKED, "database is locked"); + REG_ERROR(ERROR_ARANGO_COLLECTION_DIRECTORY_ALREADY_EXISTS, "cannot create/rename collection because directory already exists"); + REG_ERROR(ERROR_ARANGO_CONFLICT, "conflict"); + REG_ERROR(ERROR_ARANGO_WRONG_VOCBASE_PATH, "wrong path for database"); + REG_ERROR(ERROR_ARANGO_DOCUMENT_NOT_FOUND, "document not found"); + REG_ERROR(ERROR_ARANGO_COLLECTION_NOT_FOUND, "collection not found"); + REG_ERROR(ERROR_ARANGO_COLLECTION_PARAMETER_MISSING, "parameter 'collection' not found"); + REG_ERROR(ERROR_ARANGO_DOCUMENT_HANDLE_BAD, "illegal document handle"); + REG_ERROR(ERROR_ARANGO_MAXIMAL_SIZE_TOO_SMALL, "maixaml size of journal too small"); + REG_ERROR(ERROR_ARANGO_DUPLICATE_NAME, "duplicate name"); + REG_ERROR(ERROR_ARANGO_ILLEGAL_NAME, "illegal name"); + REG_ERROR(ERROR_ARANGO_NO_INDEX, "no suitable index known"); + REG_ERROR(ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED, "unique constraint violated"); + REG_ERROR(ERROR_ARANGO_GEO_INDEX_VIOLATED, "geo index violated"); + REG_ERROR(ERROR_ARANGO_INDEX_NOT_FOUND, "index not found"); + REG_ERROR(ERROR_ARANGO_CROSS_COLLECTION_REQUEST, "cross collection request not allowed"); + REG_ERROR(ERROR_ARANGO_INDEX_HANDLE_BAD, "illegal index handle"); + REG_ERROR(ERROR_ARANGO_CAP_CONSTRAINT_ALREADY_DEFINED, "cap constraint already defined"); + REG_ERROR(ERROR_ARANGO_DOCUMENT_TOO_LARGE, "document too large"); + REG_ERROR(ERROR_ARANGO_COLLECTION_NOT_UNLOADED, "collection must be unloaded"); + REG_ERROR(ERROR_ARANGO_COLLECTION_TYPE_INVALID, "collection type invalid"); + REG_ERROR(ERROR_ARANGO_DATAFILE_FULL, "datafile full"); + REG_ERROR(ERROR_QUERY_KILLED, "query killed"); + REG_ERROR(ERROR_QUERY_PARSE, "%s"); + REG_ERROR(ERROR_QUERY_EMPTY, "query is empty"); + REG_ERROR(ERROR_QUERY_SCRIPT, "runtime error '%s'"); + REG_ERROR(ERROR_QUERY_NUMBER_OUT_OF_RANGE, "number out of range"); + REG_ERROR(ERROR_QUERY_VARIABLE_NAME_INVALID, "variable name '%s' has an invalid format"); + REG_ERROR(ERROR_QUERY_VARIABLE_REDECLARED, "variable '%s' is assigned multiple times"); + REG_ERROR(ERROR_QUERY_VARIABLE_NAME_UNKNOWN, "unknown variable '%s'"); + REG_ERROR(ERROR_QUERY_COLLECTION_NOT_FOUND, "unable to open collection '%s'"); + REG_ERROR(ERROR_QUERY_COLLECTION_LOCK_FAILED, "unable to read-lock collection %s"); + REG_ERROR(ERROR_QUERY_TOO_MANY_COLLECTIONS, "too many collections"); + REG_ERROR(ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED, "document attribute '%s' is assigned multiple times"); + REG_ERROR(ERROR_QUERY_FUNCTION_NAME_UNKNOWN, "usage of unknown function '%s'"); + REG_ERROR(ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH, "invalid number of arguments for function '%s'"); + REG_ERROR(ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH, "invalid argument type used in call to function '%s()'"); + REG_ERROR(ERROR_QUERY_BIND_PARAMETERS_INVALID, "invalid structure of bind parameters"); + REG_ERROR(ERROR_QUERY_BIND_PARAMETER_MISSING, "no value specified for declared bind parameter '%s'"); + REG_ERROR(ERROR_QUERY_BIND_PARAMETER_UNDECLARED, "bind parameter '%s' was not declared in the query"); + REG_ERROR(ERROR_QUERY_BIND_PARAMETER_TYPE, "bind parameter '%s' has an invalid value or type"); + REG_ERROR(ERROR_QUERY_INVALID_LOGICAL_VALUE, "invalid logical value"); + REG_ERROR(ERROR_QUERY_INVALID_ARITHMETIC_VALUE, "invalid arithmetic value"); + REG_ERROR(ERROR_QUERY_DIVISION_BY_ZERO, "division by zero"); + REG_ERROR(ERROR_QUERY_LIST_EXPECTED, "list expected"); + REG_ERROR(ERROR_QUERY_FAIL_CALLED, "FAIL(%s) called"); + REG_ERROR(ERROR_QUERY_GEO_INDEX_MISSING, "no suitable geo index found for geo restriction on '%s'"); + REG_ERROR(ERROR_CURSOR_NOT_FOUND, "cursor not found"); + REG_ERROR(ERROR_KEYVALUE_INVALID_KEY, "invalid key declaration"); + REG_ERROR(ERROR_KEYVALUE_KEY_EXISTS, "key already exists"); + REG_ERROR(ERROR_KEYVALUE_KEY_NOT_FOUND, "key not found"); + REG_ERROR(ERROR_KEYVALUE_KEY_NOT_UNIQUE, "key is not unique"); + REG_ERROR(ERROR_KEYVALUE_KEY_NOT_CHANGED, "key value not changed"); + REG_ERROR(ERROR_KEYVALUE_KEY_NOT_REMOVED, "key value not removed"); + REG_ERROR(ERROR_KEYVALUE_NO_VALUE, "missing value"); + REG_ERROR(ERROR_GRAPH_INVALID_GRAPH, "invalid graph"); + REG_ERROR(ERROR_GRAPH_COULD_NOT_CREATE_GRAPH, "could not create graph"); + REG_ERROR(ERROR_GRAPH_INVALID_VERTEX, "invalid vertex"); + REG_ERROR(ERROR_GRAPH_COULD_NOT_CREATE_VERTEX, "could not create vertex"); + REG_ERROR(ERROR_GRAPH_COULD_NOT_CHANGE_VERTEX, "could not change vertex"); + REG_ERROR(ERROR_GRAPH_INVALID_EDGE, "invalid edge"); + REG_ERROR(ERROR_GRAPH_COULD_NOT_CREATE_EDGE, "could not create edge"); + REG_ERROR(ERROR_GRAPH_COULD_NOT_CHANGE_EDGE, "could not change edge"); + REG_ERROR(SIMPLE_CLIENT_UNKNOWN_ERROR, "unknown client error"); + REG_ERROR(SIMPLE_CLIENT_COULD_NOT_CONNECT, "could not connect to server"); + REG_ERROR(SIMPLE_CLIENT_COULD_NOT_WRITE, "could not write to server"); + REG_ERROR(SIMPLE_CLIENT_COULD_NOT_READ, "could not read from server"); + REG_ERROR(ERROR_ARANGO_INDEX_PQ_INSERT_FAILED, "priority queue insert failure"); + REG_ERROR(ERROR_ARANGO_INDEX_PQ_REMOVE_FAILED, "priority queue remove failure"); + REG_ERROR(ERROR_ARANGO_INDEX_PQ_REMOVE_ITEM_MISSING, "priority queue remove failure - item missing in index"); + REG_ERROR(ERROR_ARANGO_INDEX_HASH_INSERT_ITEM_DUPLICATED, "(non-unique) hash index insert failure - document duplicated in index"); + REG_ERROR(ERROR_ARANGO_INDEX_SKIPLIST_INSERT_ITEM_DUPLICATED, "(non-unique) skiplist index insert failure - document duplicated in index"); + REG_ERROR(WARNING_ARANGO_INDEX_HASH_DOCUMENT_ATTRIBUTE_MISSING, "hash index insertion warning - attribute missing in document"); + REG_ERROR(WARNING_ARANGO_INDEX_HASH_UPDATE_ATTRIBUTE_MISSING, "hash index update warning - attribute missing in revised document"); + REG_ERROR(WARNING_ARANGO_INDEX_HASH_REMOVE_ITEM_MISSING, "hash index remove failure - item missing in index"); + REG_ERROR(WARNING_ARANGO_INDEX_SKIPLIST_DOCUMENT_ATTRIBUTE_MISSING, "skiplist index insertion warning - attribute missing in document"); + REG_ERROR(WARNING_ARANGO_INDEX_SKIPLIST_UPDATE_ATTRIBUTE_MISSING, "skiplist index update warning - attribute missing in revised document"); + REG_ERROR(WARNING_ARANGO_INDEX_SKIPLIST_REMOVE_ITEM_MISSING, "skiplist index remove failure - item missing in index"); + REG_ERROR(WARNING_ARANGO_INDEX_BITARRAY_DOCUMENT_ATTRIBUTE_MISSING, "bitarray index insertion warning - attribute missing in document"); + REG_ERROR(WARNING_ARANGO_INDEX_BITARRAY_UPDATE_ATTRIBUTE_MISSING, "bitarray index update warning - attribute missing in revised document"); + REG_ERROR(WARNING_ARANGO_INDEX_BITARRAY_REMOVE_ITEM_MISSING, "bitarray index remove failure - item missing in index"); + REG_ERROR(ERROR_ARANGO_INDEX_BITARRAY_INSERT_ITEM_UNSUPPORTED_VALUE, "bitarray index insert failure - document attribute value unsupported in index"); + REG_ERROR(ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_ATTRIBUTES, "bitarray index creation failure - one or more index attributes are duplicated."); + REG_ERROR(ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_VALUES, "bitarray index creation failure - one or more index attribute values are duplicated."); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + diff --git a/lib/BasicsC/voc-errors.h b/lib/BasicsC/voc-errors.h new file mode 100644 index 0000000000..da64186eb6 --- /dev/null +++ b/lib/BasicsC/voc-errors.h @@ -0,0 +1,1572 @@ + +#ifndef TRIAGENS_DURHAM_VOC_BASE_ERRORS_H +#define TRIAGENS_DURHAM_VOC_BASE_ERRORS_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +//////////////////////////////////////////////////////////////////////////////// +/// @page ArangoErrors Error codes and meanings +/// +/// The following errors might be raised when running ArangoDB: +/// +/// - 0: @CODE{no error} +/// No error has occurred. +/// - 1: @CODE{failed} +/// Will be raised when a general error occurred. +/// - 2: @CODE{system error} +/// Will be raised when operating system error occurred. +/// - 3: @CODE{out of memory} +/// Will be raised when there is a memory shortage. +/// - 4: @CODE{internal error} +/// Will be raised when an internal error occurred. +/// - 5: @CODE{illegal number} +/// Will be raised when an illegal representation of a number was given. +/// - 6: @CODE{numeric overflow} +/// Will be raised when a numeric overflow occurred. +/// - 7: @CODE{illegal option} +/// Will be raised when an unknown option was supplied by the user. +/// - 8: @CODE{dead process identifier} +/// Will be raised when a PID without a living process was found. +/// - 9: @CODE{not implemented} +/// Will be raised when hitting an unimplemented feature. +/// - 10: @CODE{bad parameter} +/// Will be raised when the parameter does not fulfill the requirements. +/// - 11: @CODE{forbidden} +/// Will be raised when you are missing permission for the operation. +/// - 12: @CODE{out of memory in mmap} +/// Will be raised when there is a memory shortage. +/// - 13: @CODE{csv is corrupt} +/// Will be raised when encountering a corrupt csv line. +/// - 400: @CODE{bad parameter} +/// Will be raised when the HTTP request does not fulfill the requirements. +/// - 403: @CODE{forbidden} +/// Will be raised when the operation is forbidden. +/// - 404: @CODE{not found} +/// Will be raised when an URI is unknown. +/// - 405: @CODE{method not supported} +/// Will be raised when an unsupported HTTP method is used for an operation. +/// - 500: @CODE{internal server error} +/// Will be raised when an internal server is encountered. +/// - 600: @CODE{invalid JSON object} +/// Will be raised when a string representation of a JSON object is corrupt. +/// - 601: @CODE{superfluous URL suffices} +/// Will be raised when the URL contains superfluous suffices. +/// - 1000: @CODE{illegal state} +/// Internal error that will be raised when the datafile is not in the +/// required state. +/// - 1001: @CODE{illegal shaper} +/// Internal error that will be raised when the shaper encountered a porblem. +/// - 1002: @CODE{datafile sealed} +/// Internal error that will be raised when trying to write to a datafile. +/// - 1003: @CODE{unknown type} +/// Internal error that will be raised when an unknown collection type is +/// encountered. +/// - 1004: @CODE{ready only} +/// Internal error that will be raised when trying to write to a read-only +/// datafile or collection. +/// - 1005: @CODE{duplicate identifier} +/// Internal error that will be raised when a identifier duplicate is +/// detected. +/// - 1006: @CODE{datafile unreadable} +/// Internal error that will be raised when the datafile is unreadable. +/// - 1100: @CODE{corrupted datafile} +/// Will be raised when a corruption is detected in a datafile. +/// - 1101: @CODE{illegal parameter file} +/// Will be raised if a parameter file is corrupted. +/// - 1102: @CODE{corrupted collection} +/// Will be raised when a collection contains one or more corrupted datafiles. +/// - 1103: @CODE{mmap failed} +/// Will be raised when the system call mmap failed. +/// - 1104: @CODE{filesystem full} +/// Will be raised when the filesystem is full. +/// - 1105: @CODE{no journal} +/// Will be raised when a journal cannot be created. +/// - 1106: @CODE{cannot create/rename datafile because it already exists} +/// Will be raised when the datafile cannot be created or renamed because a +/// file of the same name already exists. +/// - 1107: @CODE{database is locked} +/// Will be raised when the database is locked by a different process. +/// - 1108: @CODE{cannot create/rename collection because directory already exists} +/// Will be raised when the collection cannot be created because a directory +/// of the same name already exists. +/// - 1200: @CODE{conflict} +/// Will be raised when updating or deleting a document and a conflict has +/// been detected. +/// - 1201: @CODE{wrong path for database} +/// Will be raised when a non-existing directory was specified as path for +/// the database. +/// - 1202: @CODE{document not found} +/// Will be raised when a document with a given identifier or handle is +/// unknown. +/// - 1203: @CODE{collection not found} +/// Will be raised when a collection with a given identifier or name is +/// unknown. +/// - 1204: @CODE{parameter 'collection' not found} +/// Will be raised when the collection parameter is missing. +/// - 1205: @CODE{illegal document handle} +/// Will be raised when a document handle is corrupt. +/// - 1206: @CODE{maixaml size of journal too small} +/// Will be raised when the maximal size of the journal is too small. +/// - 1207: @CODE{duplicate name} +/// Will be raised when a name duplicate is detected. +/// - 1208: @CODE{illegal name} +/// Will be raised when an illegal name is detected. +/// - 1209: @CODE{no suitable index known} +/// Will be raised when no suitable index for the query is known. +/// - 1210: @CODE{unique constraint violated} +/// Will be raised when there is a unique constraint violation. +/// - 1211: @CODE{geo index violated} +/// Will be raised when a illegale coordinate is used. +/// - 1212: @CODE{index not found} +/// Will be raised when an index with a given identifier is unknown. +/// - 1213: @CODE{cross collection request not allowed} +/// Will be raised when a cross-collection is requested. +/// - 1214: @CODE{illegal index handle} +/// Will be raised when a index handle is corrupt. +/// - 1215: @CODE{cap constraint already defined} +/// Will be raised when a cap constraint was already defined. +/// - 1216: @CODE{document too large} +/// Will be raised when the document cannot fit into any datafile because of +/// it is too large. +/// - 1217: @CODE{collection must be unloaded} +/// Will be raised when a collection should be unloaded, but has a different +/// status. +/// - 1218: @CODE{collection type invalid} +/// Will be raised when an invalid collection type is used in a request. +/// - 1300: @CODE{datafile full} +/// Will be raised when the datafile reaches its limit. +/// - 1500: @CODE{query killed} +/// Will be raised when a running query is killed by an explicit admin +/// command. +/// - 1501: @CODE{\%s} +/// Will be raised when query is parsed and is found to be syntactially +/// invalid. +/// - 1502: @CODE{query is empty} +/// Will be raised when an empty query is specified. +/// - 1503: @CODE{runtime error '\%s'} +/// Will be raised when a runtime error is caused by the query. +/// - 1504: @CODE{number out of range} +/// Will be raised when a number is outside the expected range. +/// - 1510: @CODE{variable name '\%s' has an invalid format} +/// Will be raised when an invalid variable name is used. +/// - 1511: @CODE{variable '\%s' is assigned multiple times} +/// Will be raised when a variable gets re-assigned in a query. +/// - 1512: @CODE{unknown variable '\%s'} +/// Will be raised when an unknown variable is used or the variable is +/// undefined the context it is used. +/// - 1520: @CODE{unable to open collection '\%s'} +/// Will be raised when one of the collections referenced in the query was +/// not found. +/// - 1521: @CODE{unable to read-lock collection \%s} +/// Will be raised when a read lock on the collection cannot be acquired. +/// - 1522: @CODE{too many collections} +/// Will be raised when the number of collections in a query is beyond the +/// allowed value. +/// - 1530: @CODE{document attribute '\%s' is assigned multiple times} +/// Will be raised when a document attribute is re-assigned. +/// - 1540: @CODE{usage of unknown function '\%s'} +/// Will be raised when an undefined function is called. +/// - 1541: @CODE{invalid number of arguments for function '\%s'} +/// Will be raised when the number of arguments used in a function call does +/// not match the expected number of arguments for the function. +/// - 1542: @CODE{invalid argument type used in call to function '\%s()'} +/// Will be raised when the type of an argument used in a function call does +/// not match the expected argument type. +/// - 1550: @CODE{invalid structure of bind parameters} +/// Will be raised when the structure of bind parameters passed has an +/// unexpected format. +/// - 1551: @CODE{no value specified for declared bind parameter '\%s'} +/// Will be raised when a bind parameter was declared in the query but the +/// query is being executed with no value for that parameter. +/// - 1552: @CODE{bind parameter '\%s' was not declared in the query} +/// Will be raised when a value gets specified for an undeclared bind +/// parameter. +/// - 1553: @CODE{bind parameter '\%s' has an invalid value or type} +/// Will be raised when a bind parameter has an invalid value or type. +/// - 1560: @CODE{invalid logical value} +/// Will be raised when a non-boolean value is used in a logical operation. +/// - 1561: @CODE{invalid arithmetic value} +/// Will be raised when a non-numeric value is used in an arithmetic +/// operation. +/// - 1562: @CODE{division by zero} +/// Will be raised when there is an attempt to divide by zero. +/// - 1563: @CODE{list expected} +/// Will be raised when a non-list operand is used for an operation that +/// expects a list argument operand. +/// - 1569: @CODE{FAIL(\%s) called} +/// Will be raised when the function FAIL() is called from inside a query. +/// - 1570: @CODE{no suitable geo index found for geo restriction on '\%s'} +/// Will be raised when a geo restriction was specified but no suitable geo +/// index is found to resolve it. +/// - 1600: @CODE{cursor not found} +/// Will be raised when a cursor is requested via its id but a cursor with +/// that id cannot be found. +/// - 1800: @CODE{invalid key declaration} +/// Will be raised when an invalid key specification is passed to the server +/// - 1801: @CODE{key already exists} +/// Will be raised when a key is to be created that already exists +/// - 1802: @CODE{key not found} +/// Will be raised when the specified key is not found +/// - 1803: @CODE{key is not unique} +/// Will be raised when the specified key is not unique +/// - 1804: @CODE{key value not changed} +/// Will be raised when updating the value for a key does not work +/// - 1805: @CODE{key value not removed} +/// Will be raised when deleting a key/value pair does not work +/// - 1806: @CODE{missing value} +/// Will be raised when the value is missing +/// - 1901: @CODE{invalid graph} +/// Will be raised when an invalid name is passed to the server +/// - 1902: @CODE{could not create graph} +/// Will be raised when an invalid name, vertices or edges is passed to the +/// server +/// - 1903: @CODE{invalid vertex} +/// Will be raised when an invalid vertex id is passed to the server +/// - 1904: @CODE{could not create vertex} +/// Will be raised when the vertex could not be created +/// - 1905: @CODE{could not change vertex} +/// Will be raised when the vertex could not be changed +/// - 1906: @CODE{invalid edge} +/// Will be raised when an invalid edge id is passed to the server +/// - 1907: @CODE{could not create edge} +/// Will be raised when the edge could not be created +/// - 1908: @CODE{could not change edge} +/// Will be raised when the edge could not be changed +/// - 2000: @CODE{unknown client error} +/// This error should not happen. +/// - 2001: @CODE{could not connect to server} +/// Will be raised when the client could not connect to the server. +/// - 2002: @CODE{could not write to server} +/// Will be raised when the client could not write data. +/// - 2003: @CODE{could not read from server} +/// Will be raised when the client could not read data. +/// - 3100: @CODE{priority queue insert failure} +/// Will be raised when an attempt to insert a document into a priority queue +/// index fails for some reason. +/// - 3110: @CODE{priority queue remove failure} +/// Will be raised when an attempt to remove a document from a priority queue +/// index fails for some reason. +/// - 3111: @CODE{priority queue remove failure - item missing in index} +/// Will be raised when an attempt to remove a document from a priority queue +/// index fails when document can not be located within the index. +/// - 3312: @CODE{(non-unique) hash index insert failure - document duplicated in index} +/// Will be raised when an attempt to insert a document into a non-unique +/// hash index fails due to the fact that document is duplicated within that +/// index. +/// - 3313: @CODE{(non-unique) skiplist index insert failure - document duplicated in index} +/// Will be raised when an attempt to insert a document into a non-unique +/// skiplist index fails due to the fact that document is duplicated within +/// that index. +/// - 3200: @CODE{hash index insertion warning - attribute missing in document} +/// Will be raised when an attempt to insert a document into a hash index is +/// caused by the document not having one or more attributes which are +/// required by the hash index. +/// - 3202: @CODE{hash index update warning - attribute missing in revised document} +/// Will be raised when an attempt to update a document results in the +/// revised document not having one or more attributes which are required by +/// the hash index. +/// - 3211: @CODE{hash index remove failure - item missing in index} +/// Will be raised when an attempt to remove a document from a hash index +/// fails when document can not be located within that index. +/// - 3300: @CODE{skiplist index insertion warning - attribute missing in document} +/// Will be raised when an attempt to insert a document into a skiplist index +/// is caused by in the document not having one or more attributes which are +/// required by the skiplist index. +/// - 3302: @CODE{skiplist index update warning - attribute missing in revised document} +/// Will be raised when an attempt to update a document results in the +/// revised document not having one or more attributes which are required by +/// the skiplist index. +/// - 3311: @CODE{skiplist index remove failure - item missing in index} +/// Will be raised when an attempt to remove a document from a skiplist index +/// fails when document can not be located within that index. +/// - 3400: @CODE{bitarray index insertion warning - attribute missing in document} +/// Will be raised when an attempt to insert a document into a bitarray index +/// is caused by in the document not having one or more attributes which are +/// required by the bitarray index. +/// - 3402: @CODE{bitarray index update warning - attribute missing in revised document} +/// Will be raised when an attempt to update a document results in the +/// revised document not having one or more attributes which are required by +/// the bitarray index. +/// - 3411: @CODE{bitarray index remove failure - item missing in index} +/// Will be raised when an attempt to remove a document from a bitarray index +/// fails when document can not be located within that index. +/// - 3413: @CODE{bitarray index insert failure - document attribute value unsupported in index} +/// Will be raised when an attempt to insert a document into a bitarray index +/// fails due to the fact that one or more values for an index attribute is +/// not supported within that index. +/// - 3415: @CODE{bitarray index creation failure - one or more index attributes are duplicated.} +/// Will be raised when an attempt to create an index with two or more index +/// attributes repeated. +/// - 3417: @CODE{bitarray index creation failure - one or more index attribute values are duplicated.} +/// Will be raised when an attempt to create an index with two or more index +/// attribute values repeated. +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup VocError +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief helper macro to define an error string +//////////////////////////////////////////////////////////////////////////////// + +#define REG_ERROR(id, label) TRI_set_errno_string(TRI_ ## id, label); + +//////////////////////////////////////////////////////////////////////////////// +/// @brief register all errors for ArangoDB +//////////////////////////////////////////////////////////////////////////////// + +void TRI_InitialiseErrorMessages (void); + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 0: ERROR_NO_ERROR +/// +/// no error +/// +/// No error has occurred. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_NO_ERROR (0) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1: ERROR_FAILED +/// +/// failed +/// +/// Will be raised when a general error occurred. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_FAILED (1) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 2: ERROR_SYS_ERROR +/// +/// system error +/// +/// Will be raised when operating system error occurred. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_SYS_ERROR (2) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3: ERROR_OUT_OF_MEMORY +/// +/// out of memory +/// +/// Will be raised when there is a memory shortage. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_OUT_OF_MEMORY (3) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 4: ERROR_INTERNAL +/// +/// internal error +/// +/// Will be raised when an internal error occurred. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_INTERNAL (4) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 5: ERROR_ILLEGAL_NUMBER +/// +/// illegal number +/// +/// Will be raised when an illegal representation of a number was given. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ILLEGAL_NUMBER (5) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 6: ERROR_NUMERIC_OVERFLOW +/// +/// numeric overflow +/// +/// Will be raised when a numeric overflow occurred. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_NUMERIC_OVERFLOW (6) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 7: ERROR_ILLEGAL_OPTION +/// +/// illegal option +/// +/// Will be raised when an unknown option was supplied by the user. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ILLEGAL_OPTION (7) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8: ERROR_DEAD_PID +/// +/// dead process identifier +/// +/// Will be raised when a PID without a living process was found. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_DEAD_PID (8) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 9: ERROR_NOT_IMPLEMENTED +/// +/// not implemented +/// +/// Will be raised when hitting an unimplemented feature. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_NOT_IMPLEMENTED (9) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 10: ERROR_BAD_PARAMETER +/// +/// bad parameter +/// +/// Will be raised when the parameter does not fulfill the requirements. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_BAD_PARAMETER (10) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 11: ERROR_FORBIDDEN +/// +/// forbidden +/// +/// Will be raised when you are missing permission for the operation. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_FORBIDDEN (11) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 12: ERROR_OUT_OF_MEMORY_MMAP +/// +/// out of memory in mmap +/// +/// Will be raised when there is a memory shortage. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_OUT_OF_MEMORY_MMAP (12) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 13: ERROR_CORRUPTED_CSV +/// +/// csv is corrupt +/// +/// Will be raised when encountering a corrupt csv line. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_CORRUPTED_CSV (13) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 400: ERROR_HTTP_BAD_PARAMETER +/// +/// bad parameter +/// +/// Will be raised when the HTTP request does not fulfill the requirements. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_HTTP_BAD_PARAMETER (400) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 403: ERROR_HTTP_FORBIDDEN +/// +/// forbidden +/// +/// Will be raised when the operation is forbidden. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_HTTP_FORBIDDEN (403) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 404: ERROR_HTTP_NOT_FOUND +/// +/// not found +/// +/// Will be raised when an URI is unknown. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_HTTP_NOT_FOUND (404) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 405: ERROR_HTTP_METHOD_NOT_ALLOWED +/// +/// method not supported +/// +/// Will be raised when an unsupported HTTP method is used for an operation. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_HTTP_METHOD_NOT_ALLOWED (405) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 500: ERROR_HTTP_SERVER_ERROR +/// +/// internal server error +/// +/// Will be raised when an internal server is encountered. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_HTTP_SERVER_ERROR (500) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 600: ERROR_HTTP_CORRUPTED_JSON +/// +/// invalid JSON object +/// +/// Will be raised when a string representation of a JSON object is corrupt. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_HTTP_CORRUPTED_JSON (600) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 601: ERROR_HTTP_SUPERFLUOUS_SUFFICES +/// +/// superfluous URL suffices +/// +/// Will be raised when the URL contains superfluous suffices. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_HTTP_SUPERFLUOUS_SUFFICES (601) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1000: ERROR_ARANGO_ILLEGAL_STATE +/// +/// illegal state +/// +/// Internal error that will be raised when the datafile is not in the required +/// state. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_ILLEGAL_STATE (1000) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1001: ERROR_ARANGO_SHAPER_FAILED +/// +/// illegal shaper +/// +/// Internal error that will be raised when the shaper encountered a porblem. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_SHAPER_FAILED (1001) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1002: ERROR_ARANGO_DATAFILE_SEALED +/// +/// datafile sealed +/// +/// Internal error that will be raised when trying to write to a datafile. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_DATAFILE_SEALED (1002) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1003: ERROR_ARANGO_UNKNOWN_COLLECTION_TYPE +/// +/// unknown type +/// +/// Internal error that will be raised when an unknown collection type is +/// encountered. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_UNKNOWN_COLLECTION_TYPE (1003) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1004: ERROR_ARANGO_READ_ONLY +/// +/// ready only +/// +/// Internal error that will be raised when trying to write to a read-only +/// datafile or collection. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_READ_ONLY (1004) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1005: ERROR_ARANGO_DUPLICATE_IDENTIFIER +/// +/// duplicate identifier +/// +/// Internal error that will be raised when a identifier duplicate is detected. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_DUPLICATE_IDENTIFIER (1005) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1006: ERROR_ARANGO_DATAFILE_UNREADABLE +/// +/// datafile unreadable +/// +/// Internal error that will be raised when the datafile is unreadable. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_DATAFILE_UNREADABLE (1006) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1100: ERROR_ARANGO_CORRUPTED_DATAFILE +/// +/// corrupted datafile +/// +/// Will be raised when a corruption is detected in a datafile. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_CORRUPTED_DATAFILE (1100) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1101: ERROR_ARANGO_ILLEGAL_PARAMETER_FILE +/// +/// illegal parameter file +/// +/// Will be raised if a parameter file is corrupted. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_ILLEGAL_PARAMETER_FILE (1101) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1102: ERROR_ARANGO_CORRUPTED_COLLECTION +/// +/// corrupted collection +/// +/// Will be raised when a collection contains one or more corrupted datafiles. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_CORRUPTED_COLLECTION (1102) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1103: ERROR_ARANGO_MMAP_FAILED +/// +/// mmap failed +/// +/// Will be raised when the system call mmap failed. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_MMAP_FAILED (1103) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1104: ERROR_ARANGO_FILESYSTEM_FULL +/// +/// filesystem full +/// +/// Will be raised when the filesystem is full. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_FILESYSTEM_FULL (1104) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1105: ERROR_ARANGO_NO_JOURNAL +/// +/// no journal +/// +/// Will be raised when a journal cannot be created. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_NO_JOURNAL (1105) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1106: ERROR_ARANGO_DATAFILE_ALREADY_EXISTS +/// +/// cannot create/rename datafile because it already exists +/// +/// Will be raised when the datafile cannot be created or renamed because a +/// file of the same name already exists. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_DATAFILE_ALREADY_EXISTS (1106) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1107: ERROR_ARANGO_DATABASE_LOCKED +/// +/// database is locked +/// +/// Will be raised when the database is locked by a different process. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_DATABASE_LOCKED (1107) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1108: ERROR_ARANGO_COLLECTION_DIRECTORY_ALREADY_EXISTS +/// +/// cannot create/rename collection because directory already exists +/// +/// Will be raised when the collection cannot be created because a directory of +/// the same name already exists. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_COLLECTION_DIRECTORY_ALREADY_EXISTS (1108) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1200: ERROR_ARANGO_CONFLICT +/// +/// conflict +/// +/// Will be raised when updating or deleting a document and a conflict has been +/// detected. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_CONFLICT (1200) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1201: ERROR_ARANGO_WRONG_VOCBASE_PATH +/// +/// wrong path for database +/// +/// Will be raised when a non-existing directory was specified as path for the +/// database. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_WRONG_VOCBASE_PATH (1201) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1202: ERROR_ARANGO_DOCUMENT_NOT_FOUND +/// +/// document not found +/// +/// Will be raised when a document with a given identifier or handle is unknown. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND (1202) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1203: ERROR_ARANGO_COLLECTION_NOT_FOUND +/// +/// collection not found +/// +/// Will be raised when a collection with a given identifier or name is unknown. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND (1203) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1204: ERROR_ARANGO_COLLECTION_PARAMETER_MISSING +/// +/// parameter 'collection' not found +/// +/// Will be raised when the collection parameter is missing. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_COLLECTION_PARAMETER_MISSING (1204) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1205: ERROR_ARANGO_DOCUMENT_HANDLE_BAD +/// +/// illegal document handle +/// +/// Will be raised when a document handle is corrupt. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD (1205) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1206: ERROR_ARANGO_MAXIMAL_SIZE_TOO_SMALL +/// +/// maixaml size of journal too small +/// +/// Will be raised when the maximal size of the journal is too small. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_MAXIMAL_SIZE_TOO_SMALL (1206) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1207: ERROR_ARANGO_DUPLICATE_NAME +/// +/// duplicate name +/// +/// Will be raised when a name duplicate is detected. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_DUPLICATE_NAME (1207) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1208: ERROR_ARANGO_ILLEGAL_NAME +/// +/// illegal name +/// +/// Will be raised when an illegal name is detected. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_ILLEGAL_NAME (1208) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1209: ERROR_ARANGO_NO_INDEX +/// +/// no suitable index known +/// +/// Will be raised when no suitable index for the query is known. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_NO_INDEX (1209) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1210: ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED +/// +/// unique constraint violated +/// +/// Will be raised when there is a unique constraint violation. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED (1210) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1211: ERROR_ARANGO_GEO_INDEX_VIOLATED +/// +/// geo index violated +/// +/// Will be raised when a illegale coordinate is used. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_GEO_INDEX_VIOLATED (1211) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1212: ERROR_ARANGO_INDEX_NOT_FOUND +/// +/// index not found +/// +/// Will be raised when an index with a given identifier is unknown. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_INDEX_NOT_FOUND (1212) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1213: ERROR_ARANGO_CROSS_COLLECTION_REQUEST +/// +/// cross collection request not allowed +/// +/// Will be raised when a cross-collection is requested. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_CROSS_COLLECTION_REQUEST (1213) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1214: ERROR_ARANGO_INDEX_HANDLE_BAD +/// +/// illegal index handle +/// +/// Will be raised when a index handle is corrupt. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_INDEX_HANDLE_BAD (1214) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1215: ERROR_ARANGO_CAP_CONSTRAINT_ALREADY_DEFINED +/// +/// cap constraint already defined +/// +/// Will be raised when a cap constraint was already defined. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_CAP_CONSTRAINT_ALREADY_DEFINED (1215) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1216: ERROR_ARANGO_DOCUMENT_TOO_LARGE +/// +/// document too large +/// +/// Will be raised when the document cannot fit into any datafile because of it +/// is too large. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_DOCUMENT_TOO_LARGE (1216) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1217: ERROR_ARANGO_COLLECTION_NOT_UNLOADED +/// +/// collection must be unloaded +/// +/// Will be raised when a collection should be unloaded, but has a different +/// status. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_COLLECTION_NOT_UNLOADED (1217) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1218: ERROR_ARANGO_COLLECTION_TYPE_INVALID +/// +/// collection type invalid +/// +/// Will be raised when an invalid collection type is used in a request. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_COLLECTION_TYPE_INVALID (1218) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1300: ERROR_ARANGO_DATAFILE_FULL +/// +/// datafile full +/// +/// Will be raised when the datafile reaches its limit. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_DATAFILE_FULL (1300) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1500: ERROR_QUERY_KILLED +/// +/// query killed +/// +/// Will be raised when a running query is killed by an explicit admin command. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_KILLED (1500) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1501: ERROR_QUERY_PARSE +/// +/// %s +/// +/// Will be raised when query is parsed and is found to be syntactially invalid. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_PARSE (1501) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1502: ERROR_QUERY_EMPTY +/// +/// query is empty +/// +/// Will be raised when an empty query is specified. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_EMPTY (1502) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1503: ERROR_QUERY_SCRIPT +/// +/// runtime error '%s' +/// +/// Will be raised when a runtime error is caused by the query. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_SCRIPT (1503) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1504: ERROR_QUERY_NUMBER_OUT_OF_RANGE +/// +/// number out of range +/// +/// Will be raised when a number is outside the expected range. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE (1504) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1510: ERROR_QUERY_VARIABLE_NAME_INVALID +/// +/// variable name '%s' has an invalid format +/// +/// Will be raised when an invalid variable name is used. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_VARIABLE_NAME_INVALID (1510) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1511: ERROR_QUERY_VARIABLE_REDECLARED +/// +/// variable '%s' is assigned multiple times +/// +/// Will be raised when a variable gets re-assigned in a query. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_VARIABLE_REDECLARED (1511) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1512: ERROR_QUERY_VARIABLE_NAME_UNKNOWN +/// +/// unknown variable '%s' +/// +/// Will be raised when an unknown variable is used or the variable is +/// undefined the context it is used. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_VARIABLE_NAME_UNKNOWN (1512) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1520: ERROR_QUERY_COLLECTION_NOT_FOUND +/// +/// unable to open collection '%s' +/// +/// Will be raised when one of the collections referenced in the query was not +/// found. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_COLLECTION_NOT_FOUND (1520) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1521: ERROR_QUERY_COLLECTION_LOCK_FAILED +/// +/// unable to read-lock collection %s +/// +/// Will be raised when a read lock on the collection cannot be acquired. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_COLLECTION_LOCK_FAILED (1521) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1522: ERROR_QUERY_TOO_MANY_COLLECTIONS +/// +/// too many collections +/// +/// Will be raised when the number of collections in a query is beyond the +/// allowed value. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_TOO_MANY_COLLECTIONS (1522) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1530: ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED +/// +/// document attribute '%s' is assigned multiple times +/// +/// Will be raised when a document attribute is re-assigned. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED (1530) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1540: ERROR_QUERY_FUNCTION_NAME_UNKNOWN +/// +/// usage of unknown function '%s' +/// +/// Will be raised when an undefined function is called. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_FUNCTION_NAME_UNKNOWN (1540) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1541: ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH +/// +/// invalid number of arguments for function '%s' +/// +/// Will be raised when the number of arguments used in a function call does +/// not match the expected number of arguments for the function. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH (1541) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1542: ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH +/// +/// invalid argument type used in call to function '%s()' +/// +/// Will be raised when the type of an argument used in a function call does +/// not match the expected argument type. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH (1542) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1550: ERROR_QUERY_BIND_PARAMETERS_INVALID +/// +/// invalid structure of bind parameters +/// +/// Will be raised when the structure of bind parameters passed has an +/// unexpected format. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_BIND_PARAMETERS_INVALID (1550) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1551: ERROR_QUERY_BIND_PARAMETER_MISSING +/// +/// no value specified for declared bind parameter '%s' +/// +/// Will be raised when a bind parameter was declared in the query but the +/// query is being executed with no value for that parameter. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_BIND_PARAMETER_MISSING (1551) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1552: ERROR_QUERY_BIND_PARAMETER_UNDECLARED +/// +/// bind parameter '%s' was not declared in the query +/// +/// Will be raised when a value gets specified for an undeclared bind parameter. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_BIND_PARAMETER_UNDECLARED (1552) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1553: ERROR_QUERY_BIND_PARAMETER_TYPE +/// +/// bind parameter '%s' has an invalid value or type +/// +/// Will be raised when a bind parameter has an invalid value or type. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_BIND_PARAMETER_TYPE (1553) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1560: ERROR_QUERY_INVALID_LOGICAL_VALUE +/// +/// invalid logical value +/// +/// Will be raised when a non-boolean value is used in a logical operation. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_INVALID_LOGICAL_VALUE (1560) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1561: ERROR_QUERY_INVALID_ARITHMETIC_VALUE +/// +/// invalid arithmetic value +/// +/// Will be raised when a non-numeric value is used in an arithmetic operation. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_INVALID_ARITHMETIC_VALUE (1561) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1562: ERROR_QUERY_DIVISION_BY_ZERO +/// +/// division by zero +/// +/// Will be raised when there is an attempt to divide by zero. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_DIVISION_BY_ZERO (1562) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1563: ERROR_QUERY_LIST_EXPECTED +/// +/// list expected +/// +/// Will be raised when a non-list operand is used for an operation that +/// expects a list argument operand. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_LIST_EXPECTED (1563) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1569: ERROR_QUERY_FAIL_CALLED +/// +/// FAIL(%s) called +/// +/// Will be raised when the function FAIL() is called from inside a query. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_FAIL_CALLED (1569) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1570: ERROR_QUERY_GEO_INDEX_MISSING +/// +/// no suitable geo index found for geo restriction on '%s' +/// +/// Will be raised when a geo restriction was specified but no suitable geo +/// index is found to resolve it. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_GEO_INDEX_MISSING (1570) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1600: ERROR_CURSOR_NOT_FOUND +/// +/// cursor not found +/// +/// Will be raised when a cursor is requested via its id but a cursor with that +/// id cannot be found. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_CURSOR_NOT_FOUND (1600) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1800: ERROR_KEYVALUE_INVALID_KEY +/// +/// invalid key declaration +/// +/// Will be raised when an invalid key specification is passed to the server +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_KEYVALUE_INVALID_KEY (1800) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1801: ERROR_KEYVALUE_KEY_EXISTS +/// +/// key already exists +/// +/// Will be raised when a key is to be created that already exists +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_KEYVALUE_KEY_EXISTS (1801) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1802: ERROR_KEYVALUE_KEY_NOT_FOUND +/// +/// key not found +/// +/// Will be raised when the specified key is not found +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_KEYVALUE_KEY_NOT_FOUND (1802) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1803: ERROR_KEYVALUE_KEY_NOT_UNIQUE +/// +/// key is not unique +/// +/// Will be raised when the specified key is not unique +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_KEYVALUE_KEY_NOT_UNIQUE (1803) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1804: ERROR_KEYVALUE_KEY_NOT_CHANGED +/// +/// key value not changed +/// +/// Will be raised when updating the value for a key does not work +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_KEYVALUE_KEY_NOT_CHANGED (1804) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1805: ERROR_KEYVALUE_KEY_NOT_REMOVED +/// +/// key value not removed +/// +/// Will be raised when deleting a key/value pair does not work +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_KEYVALUE_KEY_NOT_REMOVED (1805) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1806: ERROR_KEYVALUE_NO_VALUE +/// +/// missing value +/// +/// Will be raised when the value is missing +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_KEYVALUE_NO_VALUE (1806) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1901: ERROR_GRAPH_INVALID_GRAPH +/// +/// invalid graph +/// +/// Will be raised when an invalid name is passed to the server +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_GRAPH_INVALID_GRAPH (1901) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1902: ERROR_GRAPH_COULD_NOT_CREATE_GRAPH +/// +/// could not create graph +/// +/// Will be raised when an invalid name, vertices or edges is passed to the +/// server +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_GRAPH_COULD_NOT_CREATE_GRAPH (1902) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1903: ERROR_GRAPH_INVALID_VERTEX +/// +/// invalid vertex +/// +/// Will be raised when an invalid vertex id is passed to the server +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_GRAPH_INVALID_VERTEX (1903) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1904: ERROR_GRAPH_COULD_NOT_CREATE_VERTEX +/// +/// could not create vertex +/// +/// Will be raised when the vertex could not be created +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_GRAPH_COULD_NOT_CREATE_VERTEX (1904) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1905: ERROR_GRAPH_COULD_NOT_CHANGE_VERTEX +/// +/// could not change vertex +/// +/// Will be raised when the vertex could not be changed +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_GRAPH_COULD_NOT_CHANGE_VERTEX (1905) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1906: ERROR_GRAPH_INVALID_EDGE +/// +/// invalid edge +/// +/// Will be raised when an invalid edge id is passed to the server +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_GRAPH_INVALID_EDGE (1906) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1907: ERROR_GRAPH_COULD_NOT_CREATE_EDGE +/// +/// could not create edge +/// +/// Will be raised when the edge could not be created +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_GRAPH_COULD_NOT_CREATE_EDGE (1907) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1908: ERROR_GRAPH_COULD_NOT_CHANGE_EDGE +/// +/// could not change edge +/// +/// Will be raised when the edge could not be changed +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_GRAPH_COULD_NOT_CHANGE_EDGE (1908) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 2000: SIMPLE_CLIENT_UNKNOWN_ERROR +/// +/// unknown client error +/// +/// This error should not happen. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_SIMPLE_CLIENT_UNKNOWN_ERROR (2000) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 2001: SIMPLE_CLIENT_COULD_NOT_CONNECT +/// +/// could not connect to server +/// +/// Will be raised when the client could not connect to the server. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT (2001) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 2002: SIMPLE_CLIENT_COULD_NOT_WRITE +/// +/// could not write to server +/// +/// Will be raised when the client could not write data. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_SIMPLE_CLIENT_COULD_NOT_WRITE (2002) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 2003: SIMPLE_CLIENT_COULD_NOT_READ +/// +/// could not read from server +/// +/// Will be raised when the client could not read data. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_SIMPLE_CLIENT_COULD_NOT_READ (2003) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3100: ERROR_ARANGO_INDEX_PQ_INSERT_FAILED +/// +/// priority queue insert failure +/// +/// Will be raised when an attempt to insert a document into a priority queue +/// index fails for some reason. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_INDEX_PQ_INSERT_FAILED (3100) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3110: ERROR_ARANGO_INDEX_PQ_REMOVE_FAILED +/// +/// priority queue remove failure +/// +/// Will be raised when an attempt to remove a document from a priority queue +/// index fails for some reason. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_INDEX_PQ_REMOVE_FAILED (3110) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3111: ERROR_ARANGO_INDEX_PQ_REMOVE_ITEM_MISSING +/// +/// priority queue remove failure - item missing in index +/// +/// Will be raised when an attempt to remove a document from a priority queue +/// index fails when document can not be located within the index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_INDEX_PQ_REMOVE_ITEM_MISSING (3111) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3312: ERROR_ARANGO_INDEX_HASH_INSERT_ITEM_DUPLICATED +/// +/// (non-unique) hash index insert failure - document duplicated in index +/// +/// Will be raised when an attempt to insert a document into a non-unique hash +/// index fails due to the fact that document is duplicated within that index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_INDEX_HASH_INSERT_ITEM_DUPLICATED (3312) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3313: ERROR_ARANGO_INDEX_SKIPLIST_INSERT_ITEM_DUPLICATED +/// +/// (non-unique) skiplist index insert failure - document duplicated in index +/// +/// Will be raised when an attempt to insert a document into a non-unique +/// skiplist index fails due to the fact that document is duplicated within +/// that index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_INDEX_SKIPLIST_INSERT_ITEM_DUPLICATED (3313) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3200: WARNING_ARANGO_INDEX_HASH_DOCUMENT_ATTRIBUTE_MISSING +/// +/// hash index insertion warning - attribute missing in document +/// +/// Will be raised when an attempt to insert a document into a hash index is +/// caused by the document not having one or more attributes which are required +/// by the hash index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_WARNING_ARANGO_INDEX_HASH_DOCUMENT_ATTRIBUTE_MISSING (3200) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3202: WARNING_ARANGO_INDEX_HASH_UPDATE_ATTRIBUTE_MISSING +/// +/// hash index update warning - attribute missing in revised document +/// +/// Will be raised when an attempt to update a document results in the revised +/// document not having one or more attributes which are required by the hash +/// index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_WARNING_ARANGO_INDEX_HASH_UPDATE_ATTRIBUTE_MISSING (3202) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3211: WARNING_ARANGO_INDEX_HASH_REMOVE_ITEM_MISSING +/// +/// hash index remove failure - item missing in index +/// +/// Will be raised when an attempt to remove a document from a hash index fails +/// when document can not be located within that index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_WARNING_ARANGO_INDEX_HASH_REMOVE_ITEM_MISSING (3211) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3300: WARNING_ARANGO_INDEX_SKIPLIST_DOCUMENT_ATTRIBUTE_MISSING +/// +/// skiplist index insertion warning - attribute missing in document +/// +/// Will be raised when an attempt to insert a document into a skiplist index +/// is caused by in the document not having one or more attributes which are +/// required by the skiplist index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_WARNING_ARANGO_INDEX_SKIPLIST_DOCUMENT_ATTRIBUTE_MISSING (3300) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3302: WARNING_ARANGO_INDEX_SKIPLIST_UPDATE_ATTRIBUTE_MISSING +/// +/// skiplist index update warning - attribute missing in revised document +/// +/// Will be raised when an attempt to update a document results in the revised +/// document not having one or more attributes which are required by the +/// skiplist index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_WARNING_ARANGO_INDEX_SKIPLIST_UPDATE_ATTRIBUTE_MISSING (3302) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3311: WARNING_ARANGO_INDEX_SKIPLIST_REMOVE_ITEM_MISSING +/// +/// skiplist index remove failure - item missing in index +/// +/// Will be raised when an attempt to remove a document from a skiplist index +/// fails when document can not be located within that index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_WARNING_ARANGO_INDEX_SKIPLIST_REMOVE_ITEM_MISSING (3311) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3400: WARNING_ARANGO_INDEX_BITARRAY_DOCUMENT_ATTRIBUTE_MISSING +/// +/// bitarray index insertion warning - attribute missing in document +/// +/// Will be raised when an attempt to insert a document into a bitarray index +/// is caused by in the document not having one or more attributes which are +/// required by the bitarray index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_WARNING_ARANGO_INDEX_BITARRAY_DOCUMENT_ATTRIBUTE_MISSING (3400) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3402: WARNING_ARANGO_INDEX_BITARRAY_UPDATE_ATTRIBUTE_MISSING +/// +/// bitarray index update warning - attribute missing in revised document +/// +/// Will be raised when an attempt to update a document results in the revised +/// document not having one or more attributes which are required by the +/// bitarray index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_WARNING_ARANGO_INDEX_BITARRAY_UPDATE_ATTRIBUTE_MISSING (3402) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3411: WARNING_ARANGO_INDEX_BITARRAY_REMOVE_ITEM_MISSING +/// +/// bitarray index remove failure - item missing in index +/// +/// Will be raised when an attempt to remove a document from a bitarray index +/// fails when document can not be located within that index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_WARNING_ARANGO_INDEX_BITARRAY_REMOVE_ITEM_MISSING (3411) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3413: ERROR_ARANGO_INDEX_BITARRAY_INSERT_ITEM_UNSUPPORTED_VALUE +/// +/// bitarray index insert failure - document attribute value unsupported in +/// index +/// +/// Will be raised when an attempt to insert a document into a bitarray index +/// fails due to the fact that one or more values for an index attribute is not +/// supported within that index. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_INDEX_BITARRAY_INSERT_ITEM_UNSUPPORTED_VALUE (3413) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3415: ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_ATTRIBUTES +/// +/// bitarray index creation failure - one or more index attributes are +/// duplicated. +/// +/// Will be raised when an attempt to create an index with two or more index +/// attributes repeated. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_ATTRIBUTES (3415) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 3417: ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_VALUES +/// +/// bitarray index creation failure - one or more index attribute values are +/// duplicated. +/// +/// Will be raised when an attempt to create an index with two or more index +/// attribute values repeated. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_VALUES (3417) + + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/lib/JsonParser/json-parser.c b/lib/JsonParser/json-parser.c new file mode 100644 index 0000000000..bd5694fe51 --- /dev/null +++ b/lib/JsonParser/json-parser.c @@ -0,0 +1,2515 @@ +#line 2 "lib/JsonParser/json-parser.l" +//////////////////////////////////////////////////////////////////////////////// +/// @brief json parser +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2004-2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +#include "BasicsC/common.h" + +#include "BasicsC/json.h" +#include "BasicsC/strings.h" +#include "BasicsC/logging.h" + +#ifdef _WIN32 +#define YY_NO_UNISTD_H 1 +#else +int fileno(FILE *stream); +#endif + +#define YY_NO_INPUT + + + +#line 46 "lib/JsonParser/json-parser.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE tri_jsp_restart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via tri_jsp_restart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void tri_jsp_restart (FILE *input_file ,yyscan_t yyscanner ); +void tri_jsp__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE tri_jsp__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void tri_jsp__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void tri_jsp__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void tri_jsp_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void tri_jsp_pop_buffer_state (yyscan_t yyscanner ); + +static void tri_jsp_ensure_buffer_stack (yyscan_t yyscanner ); +static void tri_jsp__load_buffer_state (yyscan_t yyscanner ); +static void tri_jsp__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER tri_jsp__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE tri_jsp__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE tri_jsp__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE tri_jsp__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); + +void *tri_jsp_alloc (yy_size_t ,yyscan_t yyscanner ); +void *tri_jsp_realloc (void *,yy_size_t ,yyscan_t yyscanner ); +void tri_jsp_free (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer tri_jsp__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + tri_jsp_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + tri_jsp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + tri_jsp_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + tri_jsp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define tri_jsp_wrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 15 +#define YY_END_OF_BUFFER 16 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[45] = + { 0, + 13, 13, 16, 14, 13, 13, 14, 14, 11, 6, + 6, 12, 14, 14, 14, 9, 10, 7, 8, 13, + 0, 0, 4, 0, 6, 6, 0, 6, 0, 0, + 0, 5, 6, 0, 0, 0, 0, 0, 2, 3, + 0, 6, 1, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 5, 6, 5, 5, 5, 5, 5, 5, + 5, 5, 7, 8, 9, 10, 5, 11, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 13, 5, 5, + 5, 5, 5, 5, 14, 5, 5, 5, 15, 16, + 5, 5, 5, 5, 5, 17, 5, 18, 5, 5, + 5, 19, 20, 21, 22, 5, 5, 5, 5, 5, + 23, 24, 25, 5, 5, 5, 26, 5, 5, 5, + + 27, 28, 5, 5, 5, 5, 5, 29, 5, 30, + 5, 5, 5, 31, 32, 33, 34, 5, 5, 5, + 1, 1, 35, 1, 36, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[37] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[47] = + { 0, + 0, 0, 110, 115, 35, 38, 42, 35, 115, 99, + 39, 115, 38, 31, 36, 115, 115, 115, 115, 54, + 48, 78, 115, 104, 96, 49, 51, 58, 54, 56, + 52, 115, 76, 62, 72, 77, 86, 81, 115, 115, + 64, 88, 115, 115, 104, 89 + } ; + +static yyconst flex_int16_t yy_def[47] = + { 0, + 44, 1, 44, 44, 44, 44, 45, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 46, 45, 44, 46, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 0, 44, 44 + } ; + +static yyconst flex_int16_t yy_nxt[152] = + { 0, + 4, 5, 6, 5, 4, 7, 8, 9, 8, 4, + 10, 11, 12, 4, 4, 13, 4, 14, 4, 4, + 15, 4, 16, 4, 17, 4, 4, 13, 4, 14, + 4, 4, 15, 4, 18, 19, 20, 20, 20, 20, + 20, 20, 21, 21, 21, 25, 26, 23, 27, 28, + 28, 29, 30, 32, 31, 20, 20, 20, 27, 28, + 28, 33, 33, 29, 30, 24, 31, 27, 28, 28, + 34, 24, 35, 36, 42, 42, 21, 21, 21, 21, + 21, 38, 34, 23, 35, 36, 33, 33, 39, 21, + 37, 40, 41, 38, 41, 43, 42, 42, 42, 42, + + 39, 24, 37, 40, 22, 27, 44, 43, 27, 44, + 44, 44, 21, 21, 3, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44 + } ; + +static yyconst flex_int16_t yy_chk[152] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 5, 5, 5, 6, + 6, 6, 7, 7, 7, 8, 8, 7, 11, 11, + 11, 13, 14, 21, 15, 20, 20, 20, 26, 26, + 26, 27, 27, 13, 14, 7, 15, 28, 28, 28, + 29, 21, 30, 31, 41, 41, 7, 7, 22, 22, + 22, 34, 29, 22, 30, 31, 33, 33, 35, 46, + 33, 36, 37, 34, 37, 38, 37, 37, 42, 42, + + 35, 22, 33, 36, 45, 25, 24, 38, 10, 3, + 0, 0, 22, 22, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET + +#define END_OF_FILE 0 +#define FALSE_CONSTANT 1 +#define TRUE_CONSTANT 2 +#define NULL_CONSTANT 3 +#define NUMBER_CONSTANT 4 +#define STRING_CONSTANT 5 +#define OPEN_BRACE 6 +#define CLOSE_BRACE 7 +#define OPEN_BRACKET 8 +#define CLOSE_BRACKET 9 +#define COMMA 10 +#define COLON 11 +#define UNQUOTED_STRING 12 +#define STRING_CONSTANT_ASCII 13 + +struct jsonData { + char const* _message; + TRI_memory_zone_t* _memoryZone; +}; + +#define YY_FATAL_ERROR(a) \ + LOG_DEBUG("json-paser: %s", (a)) + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#define YY_EXTRA_TYPE struct jsonData + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + yy_size_t yy_n_chars; + yy_size_t yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + +int tri_jsp_lex_init (yyscan_t* scanner); + +int tri_jsp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int tri_jsp_lex_destroy (yyscan_t yyscanner ); + +int tri_jsp_get_debug (yyscan_t yyscanner ); + +void tri_jsp_set_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE tri_jsp_get_extra (yyscan_t yyscanner ); + +void tri_jsp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *tri_jsp_get_in (yyscan_t yyscanner ); + +void tri_jsp_set_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *tri_jsp_get_out (yyscan_t yyscanner ); + +void tri_jsp_set_out (FILE * out_str ,yyscan_t yyscanner ); + +yy_size_t tri_jsp_get_leng (yyscan_t yyscanner ); + +char *tri_jsp_get_text (yyscan_t yyscanner ); + +int tri_jsp_get_lineno (yyscan_t yyscanner ); + +void tri_jsp_set_lineno (int line_number ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int tri_jsp_wrap (yyscan_t yyscanner ); +#else +extern int tri_jsp_wrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + yy_size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int tri_jsp_lex (yyscan_t yyscanner); + +#define YY_DECL int tri_jsp_lex (yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* ----------------------------------------------------------------------------- + * keywords + * ----------------------------------------------------------------------------- */ + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + tri_jsp_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + tri_jsp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + tri_jsp__load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + 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 >= 45 ) + 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 != 44 ); + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +{ + return FALSE_CONSTANT; +} + YY_BREAK +case 2: +YY_RULE_SETUP +{ + return NULL_CONSTANT; +} + YY_BREAK +case 3: +YY_RULE_SETUP +{ + return TRUE_CONSTANT; +} + YY_BREAK +/* ----------------------------------------------------------------------------- + * strings + * ----------------------------------------------------------------------------- */ +case 4: +YY_RULE_SETUP +{ + // performance optimisation for all-ASCII strings without escape characters + // this matches the ASCII chars with ordinal numbers 35 (x23) to 127 (x7f), + // plus space (32) and ! (33) but no quotation marks (34, x22) and backslashes (92, x5c) + return STRING_CONSTANT_ASCII; +} + YY_BREAK +case 5: +/* rule 5 can match eol */ +YY_RULE_SETUP +{ + return STRING_CONSTANT; +} + YY_BREAK +/* ----------------------------------------------------------------------------- + * numbers + * ----------------------------------------------------------------------------- */ +case 6: +YY_RULE_SETUP +{ + return NUMBER_CONSTANT; +} + YY_BREAK +/* ----------------------------------------------------------------------------- + * special characters + * ----------------------------------------------------------------------------- */ +case 7: +YY_RULE_SETUP +{ + return OPEN_BRACE; +} + YY_BREAK +case 8: +YY_RULE_SETUP +{ + return CLOSE_BRACE; +} + YY_BREAK +case 9: +YY_RULE_SETUP +{ + return OPEN_BRACKET; +} + YY_BREAK +case 10: +YY_RULE_SETUP +{ + return CLOSE_BRACKET; +} + YY_BREAK +case 11: +YY_RULE_SETUP +{ + return COMMA; +} + YY_BREAK +case 12: +YY_RULE_SETUP +{ + return COLON; +} + YY_BREAK +/* ----------------------------------------------------------------------------- + * Skip whitespaces. Whatever is left, should be an unquoted string appearing + * somewhere. This will be reported as an error. + * ----------------------------------------------------------------------------- */ +case 13: +/* rule 13 can match eol */ +YY_RULE_SETUP +{ +} + YY_BREAK +case 14: +YY_RULE_SETUP +{ + return UNQUOTED_STRING; +} + YY_BREAK +case 15: +YY_RULE_SETUP +ECHO; + YY_BREAK +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * tri_jsp_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( tri_jsp_wrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of tri_jsp_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + tri_jsp_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + tri_jsp_restart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) tri_jsp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + 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 >= 45 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + 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 >= 45 ) + 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 == 44); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + tri_jsp_restart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( tri_jsp_wrap(yyscanner ) ) + return 0; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void tri_jsp_restart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + tri_jsp_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + tri_jsp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + tri_jsp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + tri_jsp__load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void tri_jsp__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * tri_jsp_pop_buffer_state(); + * tri_jsp_push_buffer_state(new_buffer); + */ + tri_jsp_ensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + tri_jsp__load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (tri_jsp_wrap()) processing, but the only time this flag + * is looked at is after tri_jsp_wrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void tri_jsp__load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE tri_jsp__create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) tri_jsp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in tri_jsp__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) tri_jsp_alloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in tri_jsp__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + tri_jsp__init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with tri_jsp__create_buffer() + * @param yyscanner The scanner object. + */ + void tri_jsp__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + tri_jsp_free((void *) b->yy_ch_buf ,yyscanner ); + + tri_jsp_free((void *) b ,yyscanner ); +} + +#ifndef __cplusplus +#ifndef _WIN32 +extern int isatty (int ); +#endif +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a tri_jsp_restart() or at EOF. + */ + static void tri_jsp__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + tri_jsp__flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then tri_jsp__init_buffer was _probably_ + * called from tri_jsp_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void tri_jsp__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + tri_jsp__load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void tri_jsp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + tri_jsp_ensure_buffer_stack(yyscanner); + + /* This block is copied from tri_jsp__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from tri_jsp__switch_to_buffer. */ + tri_jsp__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void tri_jsp_pop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + tri_jsp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + tri_jsp__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void tri_jsp_ensure_buffer_stack (yyscan_t yyscanner) +{ + yy_size_t num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)tri_jsp_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in tri_jsp_ensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)tri_jsp_realloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in tri_jsp_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE tri_jsp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) tri_jsp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in tri_jsp__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + tri_jsp__switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to tri_jsp_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * tri_jsp__scan_bytes() instead. + */ +YY_BUFFER_STATE tri_jsp__scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return tri_jsp__scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to tri_jsp_lex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE tri_jsp__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n, i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) tri_jsp_alloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in tri_jsp__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = tri_jsp__scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in tri_jsp__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE tri_jsp_get_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int tri_jsp_get_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int tri_jsp_get_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *tri_jsp_get_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *tri_jsp_get_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +yy_size_t tri_jsp_get_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *tri_jsp_get_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void tri_jsp_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void tri_jsp_set_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "tri_jsp_set_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void tri_jsp_set_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "tri_jsp_set_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see tri_jsp__switch_to_buffer + */ +void tri_jsp_set_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void tri_jsp_set_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int tri_jsp_get_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void tri_jsp_set_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +/* User-visible API */ + +/* tri_jsp_lex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int tri_jsp_lex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) tri_jsp_alloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* tri_jsp_lex_init_extra has the same functionality as tri_jsp_lex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to tri_jsp_alloc in + * the yyextra field. + */ + +int tri_jsp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + tri_jsp_set_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) tri_jsp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + tri_jsp_set_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from tri_jsp_lex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * tri_jsp_lex_init() + */ + return 0; +} + +/* tri_jsp_lex_destroy is for both reentrant and non-reentrant scanners. */ +int tri_jsp_lex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + tri_jsp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + tri_jsp_pop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + tri_jsp_free(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + tri_jsp_free(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * tri_jsp_lex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + tri_jsp_free ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *tri_jsp_alloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *tri_jsp_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void tri_jsp_free (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see tri_jsp_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +// ----------------------------------------------------------------------------- +// --SECTION-- forward declarations +// ----------------------------------------------------------------------------- + +static TRI_json_t* ParseArray (yyscan_t scanner); +static TRI_json_t* ParseObject (yyscan_t scanner, int c); + +// ----------------------------------------------------------------------------- +// --SECTION-- private functions +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup Json +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief parses a list +//////////////////////////////////////////////////////////////////////////////// + +static TRI_json_t* ParseList (yyscan_t scanner) { + struct yyguts_t * yyg = (struct yyguts_t*) scanner; + + TRI_json_t* list; + bool comma; + int c; + + list = TRI_CreateListJson(yyextra._memoryZone); + + if (list == NULL) { + yyextra._message = "out-of-memory"; + return NULL; + } + + c = tri_jsp_lex(scanner); + comma = false; + + while (c != END_OF_FILE) { + TRI_json_t* sub; + + if (c == CLOSE_BRACKET) { + return list; + } + + if (comma) { + if (c != COMMA) { + TRI_FreeJson(yyextra._memoryZone, list); + yyextra._message = "expecting comma"; + return NULL; + } + + c = tri_jsp_lex(scanner); + } + else { + comma = true; + } + + sub = ParseObject(scanner, c); + + if (sub == NULL) { + TRI_FreeJson(yyextra._memoryZone, list); + return NULL; + } + + TRI_PushBack3ListJson(yyextra._memoryZone, list, sub); + + c = tri_jsp_lex(scanner); + } + + TRI_FreeJson(yyextra._memoryZone, list); + yyextra._message = "expecting a list element, got end-of-file"; + + return NULL; +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief parse an array +//////////////////////////////////////////////////////////////////////////////// + +static TRI_json_t* ParseArray (yyscan_t scanner) { + struct yyguts_t * yyg = (struct yyguts_t*) scanner; + + TRI_json_t* array; + TRI_json_t* sub; + bool comma; + char* name; + size_t nameLen; + int c; + + comma = false; + array = TRI_CreateArrayJson(yyextra._memoryZone); + + if (array == NULL) { + yyextra._message = "out-of-memory"; + } + + c = tri_jsp_lex(scanner); + + while (c != END_OF_FILE) { + if (c == CLOSE_BRACE) { + return array; + } + + if (comma) { + if (c != COMMA) { + TRI_FreeJson(yyextra._memoryZone, array); + yyextra._message = "expecting comma"; + return NULL; + } + + c = tri_jsp_lex(scanner); + } + else { + comma = true; + } + + // attribute name + if (c == STRING_CONSTANT) { + // "complex" attribute name + size_t outLength; + nameLen = yyleng - 2; + + // do proper unescaping + name = TRI_UnescapeUtf8StringZ(yyextra._memoryZone, yytext + 1, nameLen, &outLength); + + } + else if (c == STRING_CONSTANT_ASCII) { + // ASCII-only attribute name + nameLen = yyleng - 2; + + // no unescaping necessary. just copy it + name = TRI_DuplicateString2Z(yyextra._memoryZone, yytext + 1, nameLen); + } + else { + // some other token found => invalid + TRI_FreeJson(yyextra._memoryZone, array); + yyextra._message = "expecting attribute name"; + return NULL; + } + + if (name == NULL) { + TRI_FreeJson(yyextra._memoryZone, array); + yyextra._message = "out-of-memory"; + return NULL; + } + + // followed by a colon + c = tri_jsp_lex(scanner); + + if (c != COLON) { + TRI_FreeString(yyextra._memoryZone, name); + TRI_FreeJson(yyextra._memoryZone, array); + yyextra._message = "expecting colon"; + return NULL; + } + + // followed by an object + c = tri_jsp_lex(scanner); + sub = ParseObject(scanner, c); + + if (sub == NULL) { + TRI_FreeString(yyextra._memoryZone, name); + TRI_FreeJson(yyextra._memoryZone, array); + return NULL; + } + + TRI_Insert4ArrayJson(yyextra._memoryZone, array, name, nameLen, sub); + + c = tri_jsp_lex(scanner); + } + + TRI_FreeJson(yyextra._memoryZone, array); + yyextra._message = "expecting a object attribute name or element, got end-of-file"; + + return NULL; +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief parse an object +//////////////////////////////////////////////////////////////////////////////// + +static TRI_json_t* ParseObject (yyscan_t scanner, int c) { + struct yyguts_t * yyg = (struct yyguts_t*) scanner; + TRI_json_t* result; + + switch (c) { + case FALSE_CONSTANT: + result = TRI_CreateBooleanJson(yyextra._memoryZone, false); + + if (result == NULL) { + yyextra._message = "out-of-memory"; + } + + return result; + + case TRUE_CONSTANT: + result = TRI_CreateBooleanJson(yyextra._memoryZone, true); + + if (result == NULL) { + yyextra._message = "out-of-memory"; + } + + return result; + + case NULL_CONSTANT: + result = TRI_CreateNullJson(yyextra._memoryZone); + + if (result == NULL) { + yyextra._message = "out-of-memory"; + } + + return result; + + case NUMBER_CONSTANT: { + char* ep; + double d; + + if ((size_t) yyleng >= 512) { + yyextra._message = "number too big"; + return NULL; + } + + // yytext is null-terminated. can use it directly without copying it into a temporary buffer + d = strtod(yytext, &ep); + + if (d == HUGE_VAL && errno == ERANGE) { + yyextra._message = "number too big"; + return NULL; + } + + if (d == 0 && errno == ERANGE) { + yyextra._message = "number too small"; + return NULL; + } + + if (ep != yytext + yyleng) { + yyextra._message = "cannot parse number"; + return NULL; + } + + result = TRI_CreateNumberJson(yyextra._memoryZone, d); + + if (result == NULL) { + yyextra._message = "out-of-memory"; + } + + return result; + } + + case STRING_CONSTANT: { + char* ptr; + size_t outLength; + + ptr = TRI_UnescapeUtf8StringZ(yyextra._memoryZone, yytext + 1, yyleng - 2, &outLength); + + if (ptr == NULL) { + yyextra._message = "out-of-memory"; + return NULL; + } + + result = TRI_CreateString2Json(yyextra._memoryZone, ptr, outLength); + + if (result == NULL) { + yyextra._message = "out-of-memory"; + } + + return result; + } + + case STRING_CONSTANT_ASCII: { + result = TRI_CreateString2CopyJson(yyextra._memoryZone, yytext + 1, yyleng - 2); + + if (result == NULL) { + yyextra._message = "out-of-memory"; + } + + return result; + } + + case OPEN_BRACE: + return ParseArray(scanner); + + case OPEN_BRACKET: + return ParseList(scanner); + + case CLOSE_BRACE: + yyextra._message = "expected object, got '}'"; + return NULL; + + case CLOSE_BRACKET: + yyextra._message = "expected object, got ']'"; + return NULL; + + case COMMA: + yyextra._message = "expected object, got ','"; + return NULL; + + case COLON: + yyextra._message = "expected object, got ':'"; + return NULL; + + case UNQUOTED_STRING: + yyextra._message = "expected object, got unquoted string"; + return NULL; + + case END_OF_FILE: + yyextra._message = "expecting atom, got end-of-file"; + return NULL; + } + + yyextra._message = "unknown atom"; + return NULL; +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- public functions +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup Json +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief parses a json string +//////////////////////////////////////////////////////////////////////////////// + +TRI_json_t* TRI_Json2String (TRI_memory_zone_t* zone, char const* text, char** error) { + TRI_json_t* object; + YY_BUFFER_STATE buf; + int c; + struct yyguts_t * yyg; + yyscan_t scanner; + + object = 0; + + tri_jsp_lex_init(&scanner); + yyg = (struct yyguts_t*) scanner; + + yyextra._memoryZone = zone; + + buf = tri_jsp__scan_string((char yyconst*) text,scanner); + + c = tri_jsp_lex(scanner); + object = ParseObject(scanner, c); + + if (object == NULL) { + LOG_DEBUG("failed to parse json object: '%s'", yyextra._message); + } + else { + c = tri_jsp_lex(scanner); + + if (c != END_OF_FILE) { + object = NULL; + yyextra._message = "failed to parse json object: expecting EOF"; + + LOG_DEBUG("failed to parse json object: expecting EOF"); + } + } + + if (error != NULL) { + if (yyextra._message != NULL) { + *error = TRI_DuplicateString(yyextra._message); + } + else { + *error = NULL; + } + } + + tri_jsp__delete_buffer(buf,scanner); + tri_jsp_lex_destroy(scanner); + + return object; +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief parses a json string +//////////////////////////////////////////////////////////////////////////////// + +TRI_json_t* TRI_JsonString (TRI_memory_zone_t* zone, char const* text) { + return TRI_Json2String(zone, text, 0); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief parses a json file +//////////////////////////////////////////////////////////////////////////////// + +TRI_json_t* TRI_JsonFile (TRI_memory_zone_t* zone, char const* path, char** error) { + FILE* in; + TRI_json_t* object; + int c; + struct yyguts_t * yyg; + yyscan_t scanner; + + object = 0; + in = fopen(path, "rb"); + + if (in == 0) { + LOG_ERROR("cannot open file '%s': '%s'", path, TRI_LAST_ERROR_STR); + return 0; + } + + tri_jsp_lex_init(&scanner); + yyg = (struct yyguts_t*) scanner; + + yyextra._memoryZone = zone; + yyin = in; + + c = tri_jsp_lex(scanner); + object = ParseObject(scanner, c); + + if (object == NULL) { + LOG_DEBUG("failed to parse json object: '%s'", yyextra._message); + } + else { + c = tri_jsp_lex(scanner); + + if (c != END_OF_FILE) { + object = NULL; + LOG_DEBUG("failed to parse json object: expecting EOF"); + } + } + + if (error != NULL) { + if (yyextra._message != NULL) { + *error = TRI_DuplicateString(yyextra._message); + } + else { + *error = NULL; + } + } + + tri_jsp_lex_destroy(scanner); + + fclose(in); + + return object; +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// Local Variables: +// mode: C +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)" +// End: + diff --git a/lib/V8/v8-json.cpp b/lib/V8/v8-json.cpp new file mode 100644 index 0000000000..f5a3fb2440 --- /dev/null +++ b/lib/V8/v8-json.cpp @@ -0,0 +1,2357 @@ +#line 2 "lib/V8/v8-json.ll" +//////////////////////////////////////////////////////////////////////////////// +/// @brief json parser +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2011 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2011, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +#include + +#include "V8/v8-globals.h" + +#include +#include + +#define YY_NO_INPUT + + + +#line 41 "lib/V8/v8-json.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE tri_v8_restart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via tri_v8_restart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void tri_v8_restart (FILE *input_file ,yyscan_t yyscanner ); +void tri_v8__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE tri_v8__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void tri_v8__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void tri_v8__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void tri_v8_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void tri_v8_pop_buffer_state (yyscan_t yyscanner ); + +static void tri_v8_ensure_buffer_stack (yyscan_t yyscanner ); +static void tri_v8__load_buffer_state (yyscan_t yyscanner ); +static void tri_v8__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER tri_v8__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE tri_v8__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE tri_v8__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE tri_v8__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); + +void *tri_v8_alloc (yy_size_t ,yyscan_t yyscanner ); +void *tri_v8_realloc (void *,yy_size_t ,yyscan_t yyscanner ); +void tri_v8_free (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer tri_v8__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + tri_v8_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + tri_v8__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + tri_v8_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + tri_v8__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define tri_v8_wrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 14 +#define YY_END_OF_BUFFER 15 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[43] = + { 0, + 12, 12, 15, 13, 12, 12, 13, 13, 10, 5, + 5, 11, 13, 13, 13, 8, 9, 6, 7, 12, + 0, 4, 0, 5, 5, 0, 5, 0, 0, 0, + 5, 0, 0, 0, 0, 0, 2, 3, 0, 5, + 1, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 5, 6, 7, 8, 1, 9, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 11, 1, 1, + 1, 1, 1, 1, 12, 1, 1, 1, 13, 14, + 1, 1, 1, 1, 1, 15, 1, 16, 1, 1, + 1, 17, 18, 19, 20, 1, 1, 1, 1, 1, + 21, 22, 23, 1, 1, 1, 24, 1, 1, 1, + + 25, 26, 1, 1, 1, 1, 1, 27, 1, 28, + 1, 1, 1, 29, 30, 31, 32, 1, 1, 1, + 1, 1, 33, 1, 34, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[35] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[44] = + { 0, + 0, 0, 94, 95, 33, 35, 35, 31, 95, 85, + 34, 95, 34, 27, 31, 95, 95, 95, 95, 47, + 41, 95, 82, 75, 43, 45, 56, 41, 46, 42, + 62, 49, 54, 57, 79, 65, 95, 95, 67, 82, + 95, 95, 79 + } ; + +static yyconst flex_int16_t yy_def[44] = + { 0, + 42, 1, 42, 42, 42, 42, 43, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 43, 42, 43, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 0, 42 + } ; + +static yyconst flex_int16_t yy_nxt[130] = + { 0, + 4, 5, 6, 7, 8, 9, 8, 4, 10, 11, + 12, 4, 4, 13, 4, 14, 4, 4, 15, 4, + 16, 4, 17, 4, 4, 13, 4, 14, 4, 4, + 15, 4, 18, 19, 20, 20, 20, 20, 22, 24, + 25, 26, 27, 27, 22, 28, 29, 30, 20, 20, + 26, 27, 27, 31, 31, 32, 23, 28, 29, 30, + 33, 34, 23, 26, 27, 27, 36, 32, 37, 38, + 31, 31, 33, 34, 35, 40, 40, 41, 36, 21, + 37, 38, 26, 39, 42, 39, 35, 40, 40, 41, + 40, 40, 26, 42, 3, 42, 42, 42, 42, 42, + + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42 + } ; + +static yyconst flex_int16_t yy_chk[130] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 5, 5, 6, 6, 7, 8, + 8, 11, 11, 11, 21, 13, 14, 15, 20, 20, + 25, 25, 25, 26, 26, 28, 7, 13, 14, 15, + 29, 30, 21, 27, 27, 27, 32, 28, 33, 34, + 31, 31, 29, 30, 31, 39, 39, 36, 32, 43, + 33, 34, 24, 35, 23, 35, 31, 35, 35, 36, + 40, 40, 10, 3, 42, 42, 42, 42, 42, 42, + + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET + +#define END_OF_FILE 0 +#define FALSE_CONSTANT 1 +#define TRUE_CONSTANT 2 +#define NULL_CONSTANT 3 +#define NUMBER_CONSTANT 4 +#define STRING_CONSTANT 5 +#define OPEN_BRACE 6 +#define CLOSE_BRACE 7 +#define OPEN_BRACKET 8 +#define CLOSE_BRACKET 9 +#define COMMA 10 +#define COLON 11 +#define UNQUOTED_STRING 12 + +struct jsonData { + char const* _message; + TRI_memory_zone_t* _memoryZone; +}; + +#define YY_FATAL_ERROR(a) \ + LOG_DEBUG("json-paser: %s", (a)) + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#define YY_EXTRA_TYPE struct jsonData + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + yy_size_t yy_n_chars; + yy_size_t yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + +int tri_v8_lex_init (yyscan_t* scanner); + +int tri_v8_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int tri_v8_lex_destroy (yyscan_t yyscanner ); + +int tri_v8_get_debug (yyscan_t yyscanner ); + +void tri_v8_set_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE tri_v8_get_extra (yyscan_t yyscanner ); + +void tri_v8_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *tri_v8_get_in (yyscan_t yyscanner ); + +void tri_v8_set_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *tri_v8_get_out (yyscan_t yyscanner ); + +void tri_v8_set_out (FILE * out_str ,yyscan_t yyscanner ); + +yy_size_t tri_v8_get_leng (yyscan_t yyscanner ); + +char *tri_v8_get_text (yyscan_t yyscanner ); + +int tri_v8_get_lineno (yyscan_t yyscanner ); + +void tri_v8_set_lineno (int line_number ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int tri_v8_wrap (yyscan_t yyscanner ); +#else +extern int tri_v8_wrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + yy_size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int tri_v8_lex (yyscan_t yyscanner); + +#define YY_DECL int tri_v8_lex (yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* ----------------------------------------------------------------------------- + * keywords + * ----------------------------------------------------------------------------- */ + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + tri_v8_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + tri_v8__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + tri_v8__load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + 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 >= 43 ) + 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 != 42 ); + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +{ + return FALSE_CONSTANT; +} + YY_BREAK +case 2: +YY_RULE_SETUP +{ + return NULL_CONSTANT; +} + YY_BREAK +case 3: +YY_RULE_SETUP +{ + return TRUE_CONSTANT; +} + YY_BREAK +/* ----------------------------------------------------------------------------- + * strings + * ----------------------------------------------------------------------------- */ +case 4: +/* rule 4 can match eol */ +YY_RULE_SETUP +{ + return STRING_CONSTANT; +} + YY_BREAK +/* ----------------------------------------------------------------------------- + * numbers + * ----------------------------------------------------------------------------- */ +case 5: +YY_RULE_SETUP +{ + return NUMBER_CONSTANT; +} + YY_BREAK +/* ----------------------------------------------------------------------------- + * special characters + * ----------------------------------------------------------------------------- */ +case 6: +YY_RULE_SETUP +{ + return OPEN_BRACE; +} + YY_BREAK +case 7: +YY_RULE_SETUP +{ + return CLOSE_BRACE; +} + YY_BREAK +case 8: +YY_RULE_SETUP +{ + return OPEN_BRACKET; +} + YY_BREAK +case 9: +YY_RULE_SETUP +{ + return CLOSE_BRACKET; +} + YY_BREAK +case 10: +YY_RULE_SETUP +{ + return COMMA; +} + YY_BREAK +case 11: +YY_RULE_SETUP +{ + return COLON; +} + YY_BREAK +/* ----------------------------------------------------------------------------- + * Skip whitespaces. Whatever is left, should be an unquoted string appearing + * somewhere. This will be reported as an error. + * ----------------------------------------------------------------------------- */ +case 12: +/* rule 12 can match eol */ +YY_RULE_SETUP +{ +} + YY_BREAK +case 13: +YY_RULE_SETUP +{ + return UNQUOTED_STRING; +} + YY_BREAK +case 14: +YY_RULE_SETUP +ECHO; + YY_BREAK +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * tri_v8_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( tri_v8_wrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of tri_v8_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + tri_v8_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + tri_v8_restart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) tri_v8_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + 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 >= 43 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + 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 >= 43 ) + 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 == 42); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + tri_v8_restart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( tri_v8_wrap(yyscanner ) ) + return 0; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void tri_v8_restart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + tri_v8_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + tri_v8__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + tri_v8__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + tri_v8__load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void tri_v8__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * tri_v8_pop_buffer_state(); + * tri_v8_push_buffer_state(new_buffer); + */ + tri_v8_ensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + tri_v8__load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (tri_v8_wrap()) processing, but the only time this flag + * is looked at is after tri_v8_wrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void tri_v8__load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE tri_v8__create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) tri_v8_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in tri_v8__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) tri_v8_alloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in tri_v8__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + tri_v8__init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with tri_v8__create_buffer() + * @param yyscanner The scanner object. + */ + void tri_v8__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + tri_v8_free((void *) b->yy_ch_buf ,yyscanner ); + + tri_v8_free((void *) b ,yyscanner ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a tri_v8_restart() or at EOF. + */ + static void tri_v8__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + tri_v8__flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then tri_v8__init_buffer was _probably_ + * called from tri_v8_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void tri_v8__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + tri_v8__load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void tri_v8_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + tri_v8_ensure_buffer_stack(yyscanner); + + /* This block is copied from tri_v8__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from tri_v8__switch_to_buffer. */ + tri_v8__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void tri_v8_pop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + tri_v8__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + tri_v8__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void tri_v8_ensure_buffer_stack (yyscan_t yyscanner) +{ + yy_size_t num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)tri_v8_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in tri_v8_ensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)tri_v8_realloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in tri_v8_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE tri_v8__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) tri_v8_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in tri_v8__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + tri_v8__switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to tri_v8_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * tri_v8__scan_bytes() instead. + */ +YY_BUFFER_STATE tri_v8__scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return tri_v8__scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to tri_v8_lex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE tri_v8__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n, i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) tri_v8_alloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in tri_v8__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = tri_v8__scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in tri_v8__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE tri_v8_get_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int tri_v8_get_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int tri_v8_get_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *tri_v8_get_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *tri_v8_get_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +yy_size_t tri_v8_get_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *tri_v8_get_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void tri_v8_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void tri_v8_set_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "tri_v8_set_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void tri_v8_set_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "tri_v8_set_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see tri_v8__switch_to_buffer + */ +void tri_v8_set_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void tri_v8_set_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int tri_v8_get_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void tri_v8_set_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +/* User-visible API */ + +/* tri_v8_lex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int tri_v8_lex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) tri_v8_alloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* tri_v8_lex_init_extra has the same functionality as tri_v8_lex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to tri_v8_alloc in + * the yyextra field. + */ + +int tri_v8_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + tri_v8_set_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) tri_v8_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + tri_v8_set_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from tri_v8_lex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * tri_v8_lex_init() + */ + return 0; +} + +/* tri_v8_lex_destroy is for both reentrant and non-reentrant scanners. */ +int tri_v8_lex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + tri_v8__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + tri_v8_pop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + tri_v8_free(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + tri_v8_free(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * tri_v8_lex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + tri_v8_free ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *tri_v8_alloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *tri_v8_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void tri_v8_free (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see tri_v8_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +// ----------------------------------------------------------------------------- +// --SECTION-- forward declarations +// ----------------------------------------------------------------------------- + +static v8::Handle ParseArray (yyscan_t scanner); +static v8::Handle ParseObject (yyscan_t scanner, int c); + +// ----------------------------------------------------------------------------- +// --SECTION-- private functions +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup Json +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief parses a list +//////////////////////////////////////////////////////////////////////////////// + +static v8::Handle ParseList (yyscan_t scanner) { + v8::HandleScope scope; + + struct yyguts_t * yyg = (struct yyguts_t*) scanner; + + v8::Handle list = v8::Array::New(); + bool comma = false; + size_t pos = 0; + + int c = tri_v8_lex(scanner); + + while (c != END_OF_FILE) { + if (c == CLOSE_BRACKET) { + return scope.Close(list); + } + + if (comma) { + if (c != COMMA) { + yyextra._message = "expecting comma"; + return scope.Close(v8::Undefined()); + } + + c = tri_v8_lex(scanner); + } + else { + comma = true; + } + + v8::Handle sub = ParseObject(scanner, c); + + if (sub->IsUndefined()) { + return scope.Close(v8::Undefined()); + } + + list->Set(pos++, sub); + + c = tri_v8_lex(scanner); + } + + yyextra._message = "expecting a list element, got end-of-file"; + + return scope.Close(v8::Undefined()); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief parses an array +//////////////////////////////////////////////////////////////////////////////// + +static v8::Handle ParseArray (yyscan_t scanner) { + v8::HandleScope scope; + + struct yyguts_t * yyg = (struct yyguts_t*) scanner; + + v8::Handle array = v8::Object::New(); + bool comma = false; + char* name; + char const* ptr; + size_t len; + size_t outLength; + + int c = tri_v8_lex(scanner); + + while (c != END_OF_FILE) { + if (c == CLOSE_BRACE) { + return scope.Close(array); + } + + if (comma) { + if (c != COMMA) { + yyextra._message = "expecting comma"; + return scope.Close(v8::Undefined()); + } + + c = tri_v8_lex(scanner); + } + else { + comma = true; + } + + // attribute name + if (c != STRING_CONSTANT) { + yyextra._message = "expecting attribute name"; + return scope.Close(v8::Undefined()); + } + + ptr = yytext; + len = yyleng; + name = TRI_UnescapeUtf8StringZ(yyextra._memoryZone, ptr + 1, len - 2, &outLength); + + if (name == NULL) { + yyextra._message = "out-of-memory"; + return scope.Close(v8::Undefined()); + } + + // followed by a colon + c = tri_v8_lex(scanner); + + if (c != COLON) { + TRI_FreeString(yyextra._memoryZone, name); + yyextra._message = "expecting colon"; + return scope.Close(v8::Undefined()); + } + + // fallowed by an object + c = tri_v8_lex(scanner); + v8::Handle sub = ParseObject(scanner, c); + + if (sub->IsUndefined()) { + TRI_FreeString(yyextra._memoryZone, name); + return scope.Close(v8::Undefined()); + } + + array->Set(v8::String::New(name), sub); + + TRI_FreeString(yyextra._memoryZone, name); + + c = tri_v8_lex(scanner); + } + + yyextra._message = "expecting a object attribute name or element, got end-of-file"; + return scope.Close(v8::Undefined()); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief parses an object +//////////////////////////////////////////////////////////////////////////////// + +static v8::Handle ParseObject (yyscan_t scanner, int c) { + v8::HandleScope scope; + + struct yyguts_t * yyg = (struct yyguts_t*) scanner; + + char buffer[1024]; + + char* ep; + char* ptr; + double d; + size_t outLength; + + v8::Handle str; + + switch (c) { + case END_OF_FILE: + yyextra._message = "expecting atom, got end-of-file"; + return scope.Close(v8::Undefined()); + + case FALSE_CONSTANT: + return scope.Close(v8::False()); + + case TRUE_CONSTANT: + return scope.Close(v8::True()); + + case NULL_CONSTANT: + return scope.Close(v8::Null()); + + case NUMBER_CONSTANT: + if ((size_t) yyleng >= sizeof(buffer)) { + yyextra._message = "number too big"; + return scope.Close(v8::Undefined()); + } + + memcpy(buffer, yytext, yyleng); + buffer[yyleng] = '\0'; + + d = strtod(buffer, &ep); + + if (d == HUGE_VAL && errno == ERANGE) { + yyextra._message = "number too big"; + return scope.Close(v8::Undefined()); + } + + if (d == 0 && errno == ERANGE) { + yyextra._message = "number too small"; + return scope.Close(v8::Undefined()); + } + + if (ep != buffer + yyleng) { + yyextra._message = "cannot parse number"; + return scope.Close(v8::Undefined()); + } + + return scope.Close(v8::Number::New(d)); + + case STRING_CONSTANT: + ptr = TRI_UnescapeUtf8StringZ(yyextra._memoryZone, yytext + 1, yyleng - 2, &outLength); + + if (ptr == NULL) { + yyextra._message = "out-of-memory"; + return scope.Close(v8::Undefined()); + } + + str = v8::String::New(ptr, outLength); + TRI_FreeString(yyextra._memoryZone, ptr); + + return scope.Close(str); + + case OPEN_BRACE: + return scope.Close(ParseArray(scanner)); + + case CLOSE_BRACE: + yyextra._message = "expected object, got '}'"; + return scope.Close(v8::Undefined()); + + case OPEN_BRACKET: + return scope.Close(ParseList(scanner)); + + case CLOSE_BRACKET: + yyextra._message = "expected object, got ']'"; + return scope.Close(v8::Undefined()); + + case COMMA: + yyextra._message = "expected object, got ','"; + return scope.Close(v8::Undefined()); + + case COLON: + yyextra._message = "expected object, got ':'"; + return scope.Close(v8::Undefined()); + + case UNQUOTED_STRING: + yyextra._message = "expected object, got unquoted string"; + return scope.Close(v8::Undefined()); + } + + yyextra._message = "unknown atom"; + return scope.Close(v8::Undefined()); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- public functions +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup Json +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief parses a json string +//////////////////////////////////////////////////////////////////////////////// + +v8::Handle TRI_FromJsonString (char const* text, char** error) { + v8::HandleScope scope; + + v8::Handle object = v8::Undefined(); + YY_BUFFER_STATE buf; + int c; + struct yyguts_t * yyg; + yyscan_t scanner; + + tri_v8_lex_init(&scanner); + yyg = (struct yyguts_t*) scanner; + + buf = tri_v8__scan_string(text,scanner); + + c = tri_v8_lex(scanner); + object = ParseObject(scanner, c); + + if (object->IsUndefined()) { + LOG_DEBUG("failed to parse json object: '%s'", yyextra._message); + } + else { + c = tri_v8_lex(scanner); + + if (c != END_OF_FILE) { + object = v8::Undefined(); + LOG_DEBUG("failed to parse json object: expecting EOF"); + } + } + + if (error != NULL) { + if (yyextra._message != 0) { + *error = TRI_DuplicateString(yyextra._message); + } + else { + *error = NULL; + } + } + + tri_v8__delete_buffer(buf,scanner); + tri_v8_lex_destroy(scanner); + + return scope.Close(object); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// Local Variables: +// mode: C +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\)" +// End: +