projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
#pragma lib
[m6w6/ext-psi]
/
src
/
token.c
diff --git
a/src/token.c
b/src/token.c
index 7a6100793d2493f614d2c82d8eb431d04ca5b1a5..18c74375fe0b84eb18cd5fadf0994e7774755762 100644
(file)
--- a/
src/token.c
+++ b/
src/token.c
@@
-52,7
+52,8
@@
struct psi_token *psi_token_init(token_t token_typ, const char *token_txt,
T->file = zend_string_copy(file);
T->text = psi_string_init_interned(token_txt, token_len, 1);
#if PSI_DEBUG_TOKEN_ALLOC
T->file = zend_string_copy(file);
T->text = psi_string_init_interned(token_txt, token_len, 1);
#if PSI_DEBUG_TOKEN_ALLOC
- PSI_DEBUG_PRINT(cpp->parser, "PSI: token_init %p\n", T);
+ fprintf(stderr, "PSI: token_init %p\t", T);
+ psi_token_dump(NULL, T);
#endif
return T;
}
#endif
return T;
}
@@
-61,7
+62,8
@@
void psi_token_free(struct psi_token **token_ptr) {
if (*token_ptr) {
struct psi_token *token = *token_ptr;
#if PSI_DEBUG_TOKEN_ALLOC
if (*token_ptr) {
struct psi_token *token = *token_ptr;
#if PSI_DEBUG_TOKEN_ALLOC
- PSI_DEBUG_PRINT(cpp->parser, "PSI: token_free %p\n", token);
+ fprintf(stderr, "PSI: token_free %p\t", token);
+ psi_token_dump(NULL, token);
#endif
*token_ptr = NULL;
zend_string_release(token->text);
#endif
*token_ptr = NULL;
zend_string_release(token->text);
@@
-75,7
+77,8
@@
struct psi_token *psi_token_copy(struct psi_token *src) {
*ptr = *src;
#if PSI_DEBUG_TOKEN_ALLOC
*ptr = *src;
#if PSI_DEBUG_TOKEN_ALLOC
- PSI_DEBUG_PRINT(cpp->parser, "PSI: token_copy %p <= %p\n", ptr, src);
+ fprintf(stderr, "PSI: token_copy %p\t", ptr);
+ psi_token_dump(NULL, src);
#endif
ptr->text = zend_string_copy(ptr->text);
ptr->file = zend_string_copy(ptr->file);
#endif
ptr->text = zend_string_copy(ptr->text);
ptr->file = zend_string_copy(ptr->file);
@@
-114,7
+117,7
@@
struct psi_token *psi_token_cat(const char *sep, unsigned argc, ...) {
T->text = smart_str_extract(&text);
#if PSI_DEBUG_TOKEN_ALLOC
T->text = smart_str_extract(&text);
#if PSI_DEBUG_TOKEN_ALLOC
-
PSI_DEBUG_PRINT(cpp->parse
r, "PSI: token_cat %p\n", T);
+
fprintf(stder
r, "PSI: token_cat %p\n", T);
#endif
return T;
}
#endif
return T;
}
@@
-193,6
+196,11
@@
void psi_token_dump(struct psi_dump *dump, struct psi_token *t)
{
size_t i;
{
size_t i;
+ if (!t) {
+ PSI_DUMP(dump, "TOKEN deleted\n");
+ return;
+ }
+
PSI_DUMP(dump, "TOKEN %p (%u) ", t, t->type);
if (t->type == PSI_T_EOF) {
PSI_DUMP(dump, "EOF");
PSI_DUMP(dump, "TOKEN %p (%u) ", t, t->type);
if (t->type == PSI_T_EOF) {
PSI_DUMP(dump, "EOF");