1 #pragma once
2 
3 #include <stack>
4 #include <string>
5 
6 #include "astnode.hpp"
7 
8 class yy_extra_type {
9   public:
yy_extra_type()10     yy_extra_type() {
11       first_lineno = 0;
12       lineno = 1;
13       terminated = false;
14       last_token = -1;
15       insert_token = -1;
16       heredoc_yyleng = -1;
17       list_size = 0;
18       pushStack();
19     }
20 
21     size_t first_lineno; // line number before scanning the current token
22     size_t lineno; // current line number being scanned.
23     std::string error; // description of error (if terminated true)
24     bool terminated; // becomes true when the parser terminates with an error
25     int last_token; // the last token to be returned by the scanner
26     int insert_token; // insert this token without reading from buffer
27     size_t heredoc_yyleng; // last length of yytext while scanning
28     std::string heredoc_label; // heredoc sentinel label
29     unsigned int list_size;
30 
31     xhpast::token_list_t token_list;
32 
pushStack()33     void pushStack() {
34       tag_stack.push_front(std::deque<std::string>());
35     }
36 
37   protected:
38     std::deque<std::deque<std::string> > tag_stack;
39 };
40 
41 #define YYSTYPE xhpast::Node *
42 #define YY_HEADER_EXPORT_START_CONDITIONS
43 #define YY_EXTRA_TYPE yy_extra_type*
44 
45 #include "parser.yacc.hpp"
46 #ifndef FLEX_SCANNER
47   #include "scanner.lex.hpp"
48 #endif
49 
50 int xhpparse(void*, YYSTYPE *);
51 void xhp_new_push_state(int s, struct yyguts_t* yyg);
52 void xhp_new_pop_state(struct yyguts_t* yyg);
53 void xhp_set_state(int s, struct yyguts_t* yyg);
54