if (is_eol) {
size_t processed = 0;
+ bool parsed = psi_parser_process(cpp->parser, parser_tokens, &processed);
- if (!psi_parser_process(cpp->parser, parser_tokens, &processed)) {
- psi_plist_free(parser_tokens);
- return false;
- }
+ /* EOL */
psi_plist_pop(parser_tokens, NULL);
psi_plist_clean(parser_tokens);
do_cpp = false;
+
+ if (!parsed) {
+ psi_plist_free(parser_tokens);
+ return false;
+ }
} else {
/* leave EOLs in the input stream, else we might end up
- * with a hash not preceeded with a new line after include */
+ * with a hash not preceded with a new line after include */
psi_cpp_tokiter_del_cur(cpp, false);
}
-/* Generated by re2c 0.16 on Tue Mar 28 16:36:22 2017 */
+/* Generated by re2c 0.16 on Tue Mar 28 19:45:29 2017 */
#line 1 "src/parser.re"
/*******************************************************************************
Copyright (c) 2016, Michael Wallner <mike@php.net>.
}
#endif
-struct psi_plist *psi_parser_preprocess(struct psi_parser *P, struct psi_plist *tokens)
+struct psi_plist *psi_parser_preprocess(struct psi_parser *P, struct psi_plist **tokens)
{
- if (psi_cpp_process(P->preproc, &tokens)) {
- return tokens;
+ if (psi_cpp_process(P->preproc, tokens)) {
+ return *tokens;
}
return NULL;
}
return false;
}
- if (!(preproc = psi_parser_preprocess(P, scanned))) {
+ if (!(preproc = psi_parser_preprocess(P, &scanned))) {
psi_plist_free(scanned);
return false;
}
struct psi_parser_input *psi_parser_open_file(struct psi_parser *P, const char *filename, bool report_errors);
struct psi_parser_input *psi_parser_open_string(struct psi_parser *P, const char *string, size_t length);
struct psi_plist *psi_parser_scan(struct psi_parser *P, struct psi_parser_input *I);
-struct psi_plist *psi_parser_preprocess(struct psi_parser *P, struct psi_plist *tokens);
+struct psi_plist *psi_parser_preprocess(struct psi_parser *P, struct psi_plist **tokens);
bool psi_parser_process(struct psi_parser *P, struct psi_plist *tokens, size_t *processed);
bool psi_parser_parse(struct psi_parser *P, struct psi_parser_input *I);
void psi_parser_dtor(struct psi_parser *P);
}
#endif
-struct psi_plist *psi_parser_preprocess(struct psi_parser *P, struct psi_plist *tokens)
+struct psi_plist *psi_parser_preprocess(struct psi_parser *P, struct psi_plist **tokens)
{
- if (psi_cpp_process(P->preproc, &tokens)) {
- return tokens;
+ if (psi_cpp_process(P->preproc, tokens)) {
+ return *tokens;
}
return NULL;
}
return false;
}
- if (!(preproc = psi_parser_preprocess(P, scanned))) {
+ if (!(preproc = psi_parser_preprocess(P, &scanned))) {
psi_plist_free(scanned);
return false;
}