📄 stdpccts.h
字号:
#ifndef STDPCCTS_H
#define STDPCCTS_H
/*
* stdpccts.h -- P C C T S I n c l u d e
*
* Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
* Purdue University Electrical Engineering
* With AHPCRC, University of Minnesota
* ANTLR Version 1.33MR33
*/
#ifndef ANTLR_VERSION
#define ANTLR_VERSION 13333
#endif
#include "pcctscfg.h"
#include "pccts_stdio.h"
#include "charbuf.h"
#include "stringbuffer.h"
#include "libicl.h"
#include "libicl_private.h"
#include "glib.h"
#include <stdio.h>
#ifdef _WINDOWS
#include "oaa-windows.h"
#endif
/* Abstract Syntax Tree fields */
#define AST_FIELDS int isDefined; int type; char* tokenData; size_t tokenLen;
/* Remember column numbers */
#define ZZCOL
/* We define syntax error function */
#define USER_ZZSYN
/* Token buffer size */
/* #define ZZLEXBUFSIZE 10485760*/
#define ZZLEXBUFSIZE 10485760
extern GByteArray* parser_dblQuoteBuf;
extern char* parser_tmpStrIn;
#ifdef NORMAL_GC
extern void* GC_debug_malloc(size_t, const char*, int);
extern char* gc_strdup(char*);
#endif
#ifdef NORMAL_GC
#define zzcr_ast(ast, attr, ttype, text) { \
if(((ttype) == ICLDATAQ) || \
((ttype) == DBLQUOTED)) { \
char* buf = parser_dblQuoteBuf->data; \
g_byte_array_free(parser_dblQuoteBuf, FALSE); \
/* \
char* buf = (char*)malloc(parser_dblQuoteLen + 1); \
memcpy(buf, text, parser_dblQuoteLen); \
buf[parser_dblQuoteLen] = '\0'; \
*/ \
ast->tokenData = buf; \
ast->tokenLen = parser_dblQuoteLen; \
} \
else { \
if(zzbufovf) { \
ast->tokenLen = ZZLEXBUFSIZE; \
ast->tokenData = (char*)GC_debug_malloc(ZZLEXBUFSIZE + 1, __FILE__, __LINE__); \
strncpy(ast->tokenData, text, ZZLEXBUFSIZE); \
fprintf(stderr, "ZZLEXBUFSIZE overflowed (%i)\n", ZZLEXBUFSIZE); \
} \
else { \
ast->tokenData = gc_strdup(text); \
ast->tokenLen = strlen(text); \
} \
} \
ast->type = (ttype); \
ast->isDefined = 1; \
ast->right = NULL; \
ast->down = NULL; \
/* printf("zzcr_ast at pointer %p\n", ast); */ \
};
/*
#define zzd_ast(t) { \
GC_debug_free(t->tokenData); \
fprintf(stderr, "freed token data at pointer %p\n", t); \
t->isDefined = 0; \
} \
*/
#undef zzd_ast
#else
#define zzcr_ast(ast, attr, ttype, text) { \
if(((ttype) == ICLDATAQ) || \
((ttype) == DBLQUOTED)) { \
char* buf = parser_dblQuoteBuf->data; \
g_byte_array_free(parser_dblQuoteBuf, FALSE); \
/* \
char* buf = (char*)malloc(parser_dblQuoteLen + 1); \
memcpy(buf, text, parser_dblQuoteLen); \
buf[parser_dblQuoteLen] = '\0'; \
*/ \
ast->tokenData = buf; \
ast->tokenLen = parser_dblQuoteLen; \
} \
else { \
if(zzbufovf) { \
ast->tokenLen = ZZLEXBUFSIZE; \
ast->tokenData = (char*)malloc(ZZLEXBUFSIZE + 1); \
strncpy(ast->tokenData, text, ZZLEXBUFSIZE); \
fprintf(stderr, "ZZLEXBUFSIZE overflowed (%i)\n", ZZLEXBUFSIZE); \
} \
else { \
ast->tokenData = strdup(text); \
ast->tokenLen = strlen(text); \
} \
} \
ast->type = (ttype); \
ast->isDefined = 1; \
ast->right = NULL; \
ast->down = NULL; \
/* printf("zzcr_ast at pointer %p\n", ast); */ \
};
/*
#define zzd_ast(t) { \
free(t->tokenData); \
t->isDefined = 0; \
} \
*/
#undef zzd_ast
#endif
extern int parser_dblQuoteLen;
extern ICLTerm* parser_getTermFromString(char* str, size_t len);
extern ICLTerm* parser_getTermFromStringDebug(char* str, size_t len);
extern int parser_getNetTermFromBuf(ICLTerm** result, stringbuffer_t* buf);
/*extern void zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok, int k, char *bad_text);*/
extern int parser_error;
extern int parser_setDebug(int b);
extern void handleDblQuotedData();
#define LL_K 2
#define GENAST
#define zzSET_SIZE 8
#include "antlr.h"
#include "ast.h"
#include "tokens.h"
#include "dlgdef.h"
#include "mode.h"
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -