00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #define ANTLR_VERSION 13333
00014 #include "pcctscfg.h"
00015 #include "pccts_stdio.h"
00016
00017 #include "charbuf.h"
00018 #include "stringbuffer.h"
00019 #include "libicl.h"
00020 #include "libicl_private.h"
00021 #include "glib.h"
00022 #include <stdio.h>
00023 #ifdef _WINDOWS
00024 #include "oaa-windows.h"
00025 #endif
00026
00027
00028 #define AST_FIELDS int isDefined; int type; char* tokenData; size_t tokenLen;
00029
00030 #define ZZCOL
00031
00032 #define USER_ZZSYN
00033
00034
00035 #define ZZLEXBUFSIZE 10485760
00036
00037 extern GByteArray* parser_dblQuoteBuf;
00038 extern char* parser_tmpStrIn;
00039 #ifdef NORMAL_GC
00040 extern void* GC_debug_malloc(size_t, const char*, int);
00041 extern char* gc_strdup(char*);
00042 #endif
00043
00044 #ifdef NORMAL_GC
00045 #define zzcr_ast(ast, attr, ttype, text) { \
00046 if(((ttype) == ICLDATAQ) || \
00047 ((ttype) == DBLQUOTED)) { \
00048 char* buf = parser_dblQuoteBuf->data; \
00049 g_byte_array_free(parser_dblQuoteBuf, FALSE); \
00050
00051
00052
00053
00054 \
00055 ast->tokenData = buf; \
00056 ast->tokenLen = parser_dblQuoteLen; \
00057 } \
00058 else { \
00059 if(zzbufovf) { \
00060 ast->tokenLen = ZZLEXBUFSIZE; \
00061 ast->tokenData = (char*)GC_debug_malloc(ZZLEXBUFSIZE + 1, __FILE__, __LINE__); \
00062 strncpy(ast->tokenData, text, ZZLEXBUFSIZE); \
00063 fprintf(stderr, "ZZLEXBUFSIZE overflowed (%i)\n", ZZLEXBUFSIZE); \
00064 } \
00065 else { \
00066 ast->tokenData = gc_strdup(text); \
00067 ast->tokenLen = strlen(text); \
00068 } \
00069 } \
00070 ast->type = (ttype); \
00071 ast->isDefined = 1; \
00072 ast->right = NULL; \
00073 ast->down = NULL; \
00074 \
00075 };
00076
00077
00078
00079
00080
00081
00082
00083
00084 #undef zzd_ast
00085
00086 #else
00087 #define zzcr_ast(ast, attr, ttype, text) { \
00088 if(((ttype) == ICLDATAQ) || \
00089 ((ttype) == DBLQUOTED)) { \
00090 char* buf = parser_dblQuoteBuf->data; \
00091 g_byte_array_free(parser_dblQuoteBuf, FALSE); \
00092
00093
00094
00095
00096 \
00097 ast->tokenData = buf; \
00098 ast->tokenLen = parser_dblQuoteLen; \
00099 } \
00100 else { \
00101 if(zzbufovf) { \
00102 ast->tokenLen = ZZLEXBUFSIZE; \
00103 ast->tokenData = (char*)malloc(ZZLEXBUFSIZE + 1); \
00104 strncpy(ast->tokenData, text, ZZLEXBUFSIZE); \
00105 fprintf(stderr, "ZZLEXBUFSIZE overflowed (%i)\n", ZZLEXBUFSIZE); \
00106 } \
00107 else { \
00108 ast->tokenData = strdup(text); \
00109 ast->tokenLen = strlen(text); \
00110 } \
00111 } \
00112 ast->type = (ttype); \
00113 ast->isDefined = 1; \
00114 ast->right = NULL; \
00115 ast->down = NULL; \
00116 \
00117 };
00118
00119
00120
00121
00122
00123
00124
00125 #undef zzd_ast
00126
00127 #endif
00128
00129 extern int parser_dblQuoteLen;
00130 extern ICLTerm* parser_getTermFromString(char* str, size_t len);
00131 extern ICLTerm* parser_getTermFromStringDebug(char* str, size_t len);
00132 extern int parser_getTermFromBuf(ICLTerm** result, stringbuffer_t* buf, int* lookedAhead);
00133 extern int parser_getNetTermFromBuf(ICLTerm** result, stringbuffer_t* buf);
00134
00135 extern int parser_error;
00136 extern int parser_setDebug(int b);
00137 extern void handleDblQuotedData();
00138 #define LL_K 2
00139 #define zzSET_SIZE 8
00140 #include "antlr.h"
00141 #include "ast.h"
00142 #include "tokens.h"
00143 #include "dlgdef.h"
00144 #include "err.h"
00145
00146 ANTLRChar *zztokens[49]={
00147 "Invalid",
00148 "@",
00149 "GROUP",
00150 "LIST",
00151 "VAR",
00152 "STRUCT",
00153 "ICLDATAQ",
00154 "STR",
00155 "INT",
00156 "FLOAT",
00157 "TERM_LITERAL",
00158 "ICLDATAQ_LITERAL",
00159 "LBRACE",
00160 "RBRACE",
00161 "LBRACK",
00162 "RBRACK",
00163 "LPAREN",
00164 "RPAREN",
00165 "DBL_COLON",
00166 "TURNSTILE",
00167 "COLON",
00168 "SEMI",
00169 "COMMA",
00170 "PLUS",
00171 "MINUS",
00172 "STAR",
00173 "DIV",
00174 "EQUAL",
00175 "BACKSLASH",
00176 "BANG",
00177 "TILDE",
00178 "PIPE",
00179 "DOT",
00180 "NUM_INTONE",
00181 "NUM_INTTWO",
00182 "NUM_FLOATONE",
00183 "NUM_FLOATTWO",
00184 "WS",
00185 "NEWLINE",
00186 "SPECIAL_CHAR_LITERAL",
00187 "IDENT",
00188 "VARIABLE",
00189 "'",
00190 "\"",
00191 "''",
00192 "STRING_LITERAL",
00193 "[\\n\\r]",
00194 "~['\\n\\r]+",
00195 "DBLQUOTED"
00196 };
00197 SetWordType zzerr1[8] = {0x2,0x0,0x0,0x0, 0x1,0x0,0x0,0x0};
00198 SetWordType zzerr2[8] = {0x0,0x4,0x0,0x0, 0x1,0x0,0x0,0x0};
00199 SetWordType zzerr3[8] = {0x0,0x0,0x14,0x0, 0x0,0x0,0x0,0x0};
00200 SetWordType setwd1[49] = {0x0,0x7f,0x0,0x0,0x0,0x0,0x0,
00201 0x0,0x0,0x0,0x0,0x0,0x0,0x78,0x0,
00202 0x78,0x0,0x78,0x80,0x70,0x80,0x60,0x78,
00203 0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,
00204 0x0,0x78,0x0,0x0,0x0,0x0,0x0,0x0,
00205 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
00206 0x0,0x0};
00207 SetWordType zzerr4[8] = {0x0,0x0,0x80,0x1, 0x0,0x0,0x0,0x0};
00208 SetWordType zzerr5[8] = {0x0,0x0,0x0,0x6, 0x0,0x0,0x0,0x0};
00209 SetWordType zzerr6[8] = {0x0,0x5c,0xbd,0x3f, 0x9e,0x23,0x0,0x0};
00210 SetWordType zzerr7[8] = {0x2,0xfc,0xff,0x3f, 0x9f,0x23,0x0,0x0};
00211 SetWordType setwd2[49] = {0x0,0x95,0x0,0x0,0x0,0x0,0x0,
00212 0x0,0x0,0x0,0xc0,0xc0,0xc0,0x95,0xc0,
00213 0x95,0xc0,0x95,0xb4,0xf5,0xb4,0xf5,0x95,
00214 0xf2,0xf2,0xe8,0xe8,0xf5,0xb5,0xe0,0x0,
00215 0x0,0x95,0xc0,0xc0,0xc0,0xc0,0x0,0x0,
00216 0xe0,0xe0,0xc0,0x0,0x0,0x0,0xe0,0x0,
00217 0x0,0x0};
00218 SetWordType zzerr8[8] = {0x0,0x0,0xbc,0x3f, 0x80,0x21,0x0,0x0};
00219 SetWordType zzerr9[8] = {0x0,0xfc,0xbf,0x3f, 0x9e,0x23,0x0,0x0};
00220 SetWordType zzerr10[8] = {0x0,0x0,0x0,0x0, 0x6,0x0,0x1,0x0};
00221 SetWordType setwd3[49] = {0x0,0x83,0x0,0x0,0x0,0x0,0x0,
00222 0x0,0x0,0x0,0x8,0x8,0x8,0xb3,0x8,
00223 0xb3,0x8,0xb7,0x8b,0x8b,0x8b,0x8b,0x83,
00224 0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8,0x0,
00225 0x0,0x83,0x48,0x48,0x8,0x8,0x0,0x0,
00226 0x8,0x8,0x8,0x0,0x0,0x0,0x8,0x0,
00227 0x0,0x0};
00228 SetWordType zzerr11[8] = {0x0,0x0,0x0,0x0, 0x6,0x0,0x0,0x0};
00229 SetWordType zzerr12[8] = {0x0,0x0,0x0,0x0, 0x6,0x0,0x0,0x0};
00230 SetWordType zzerr13[8] = {0x0,0x5c,0xa9,0x2f, 0x9e,0x23,0x0,0x0};
00231 SetWordType zzerr14[8] = {0x0,0xc,0xa8,0x2f, 0x80,0x21,0x0,0x0};
00232 SetWordType zzerr15[8] = {0x0,0x10,0x1,0x0, 0x0,0x0,0x0,0x0};
00233 SetWordType setwd4[49] = {0x0,0xf0,0x0,0x0,0x0,0x0,0x0,
00234 0x0,0x0,0x0,0x4,0x4,0x8,0xf0,0x0,
00235 0xf0,0x8,0xf3,0xf0,0xf4,0xf0,0xf4,0xf0,
00236 0xf4,0xf4,0xf4,0xf4,0xf4,0xf0,0x4,0x0,
00237 0x0,0xf0,0x0,0x0,0x0,0x0,0x0,0x0,
00238 0x4,0x4,0x0,0x0,0x0,0x0,0x4,0x0,
00239 0x0,0x0};
00240 SetWordType setwd5[49] = {0x0,0x1,0x0,0x0,0x0,0x0,0x0,
00241 0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,
00242 0x1,0x0,0x1,0x1,0x1,0x1,0x1,0x1,
00243 0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0,
00244 0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,
00245 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
00246 0x0,0x0};