1
0
Fork 0

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

This commit is contained in:
Heiko Kernbach 2012-05-03 18:58:47 +02:00
commit 2b10b4c59c
3 changed files with 1032 additions and 21 deletions

File diff suppressed because it is too large Load Diff

View File

@ -29,10 +29,11 @@
#define TRIAGENS_DURHAM_AHUACATL_CODEGEN_JS_H 1
#include <BasicsC/common.h>
#include <BasicsC/associative.h>
#include <BasicsC/conversions.h>
#include <BasicsC/strings.h>
#include <BasicsC/string-buffer.h>
#include <BasicsC/vector.h>
#include <BasicsC/conversions.h>
#include "Ahuacatl/ahuacatl-ast-node.h"
#include "Ahuacatl/ahuacatl-conversions.h"
@ -54,6 +55,8 @@ extern "C" {
/// @brief internal function types
////////////////////////////////////////////////////////////////////////////////
typedef uint32_t TRI_aql_codegen_register_t;
typedef enum {
AQL_FUNCTION_STANDALONE,
AQL_FUNCTION_COMPARE
@ -64,14 +67,47 @@ TRI_aql_codegen_function_type_e;
/// @brief code generator internal function struct
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_aql_codegen_function_s {
typedef struct TRI_aql_codegen_functionx_s {
TRI_string_buffer_t _buffer;
size_t _index;
size_t _forCount;
char* _prefix;
}
TRI_aql_codegen_functionx_t;
TRI_aql_codegen_function_t;
typedef enum {
TRI_AQL_SCOPE_MAIN,
TRI_AQL_SCOPE_LET,
TRI_AQL_SCOPE_FOR,
TRI_AQL_SCOPE_FOR_NESTED,
TRI_AQL_SCOPE_FUNCTION
}
TRI_aql_codegen_scope_e;
typedef struct TRI_aql_codegen_variable_s {
char* _name;
TRI_aql_codegen_register_t _register;
}
TRI_aql_codegen_variable_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief code generator scope
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_aql_codegen_scope_s {
TRI_string_buffer_t* _buffer;
TRI_aql_codegen_scope_e _type;
TRI_aql_codegen_register_t _listRegister;
TRI_aql_codegen_register_t _keyRegister;
TRI_aql_codegen_register_t _ownRegister;
TRI_aql_codegen_register_t _resultRegister;
TRI_associative_pointer_t _variables;
const char* _variableName;
const char* _name;
char* _prefix;
}
TRI_aql_codegen_scope_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief code generator struct
@ -80,6 +116,8 @@ TRI_aql_codegen_function_t;
typedef struct TRI_aql_codegen_js_s {
TRI_string_buffer_t _buffer;
TRI_vector_pointer_t _functions;
TRI_vector_pointer_t _scopes;
size_t _registerIndex;
size_t _functionIndex;
bool _error;

View File

@ -329,9 +329,9 @@ TRI_aql_scope_t* TRI_CreateScopeAql (void) {
TRI_InitAssociativePointer(&scope->_variables,
TRI_UNKNOWN_MEM_ZONE,
TRI_HashStringKeyAssociativePointer,
TRI_HashVariableAql,
TRI_EqualVariableAql,
&TRI_HashStringKeyAssociativePointer,
&TRI_HashVariableAql,
&TRI_EqualVariableAql,
0);
scope->_first = NULL;