Changeset View
Changeset View
Standalone View
Standalone View
support/xhpast/ast.hpp
| #pragma once | #pragma once | ||||
| #include <stdint.h> | #include <stdint.h> | ||||
| #include <deque> | #include <deque> | ||||
| #include <stack> | #include <stack> | ||||
| #include <string> | #include <string> | ||||
| #include "astnode.hpp" | #include "astnode.hpp" | ||||
| class yy_extra_type { | class yy_extra_type { | ||||
| public: | public: | ||||
| yy_extra_type() { | yy_extra_type() { | ||||
| first_lineno = 0; | first_lineno = 0; | ||||
| lineno = 1; | lineno = 1; | ||||
| terminated = false; | terminated = false; | ||||
| used = false; | |||||
| last_token = -1; | last_token = -1; | ||||
| insert_token = -1; | insert_token = -1; | ||||
| heredoc_yyleng = -1; | heredoc_yyleng = -1; | ||||
| heredoc_data = (char *) 0; | |||||
| short_tags = true; | short_tags = true; | ||||
| asp_tags = false; | asp_tags = false; | ||||
| idx_expr = false; | idx_expr = false; | ||||
| include_debug = false; | include_debug = false; | ||||
| expecting_xhp_class_statements = false; | |||||
| old_expecting_xhp_class_statements = false; | |||||
| used_attributes = false; | |||||
| list_size = 0; | list_size = 0; | ||||
| colon_hack = false; | |||||
| pushStack(); | pushStack(); | ||||
| } | } | ||||
| bool short_tags; // `short_open_tag` in php.ini | bool short_tags; // `short_open_tag` in php.ini | ||||
| bool asp_tags; // `asp_tags` in php.ini | bool asp_tags; // `asp_tags` in php.ini | ||||
| bool idx_expr; // allow code like `foo()['bar']` | bool idx_expr; // allow code like `foo()['bar']` | ||||
| size_t first_lineno; // line number before scanning the current token | size_t first_lineno; // line number before scanning the current token | ||||
| size_t lineno; // current line number being scanned. | size_t lineno; // current line number being scanned. | ||||
| std::string error; // description of error (if terminated true) | std::string error; // description of error (if terminated true) | ||||
| bool terminated; // becomes true when the parser terminates with an error | bool terminated; // becomes true when the parser terminates with an error | ||||
| bool used; // were any XHP-specific extensions found in this code? | |||||
| int last_token; // the last token to be returned by the scanner | int last_token; // the last token to be returned by the scanner | ||||
| int insert_token; // insert this token without reading from buffer | int insert_token; // insert this token without reading from buffer | ||||
| size_t heredoc_yyleng; // last length of yytext while scanning | size_t heredoc_yyleng; // last length of yytext while scanning | ||||
| const char* heredoc_data; // where our heredoc data starts | |||||
| std::string heredoc_label; // heredoc sentinel label | std::string heredoc_label; // heredoc sentinel label | ||||
| std::stack<int> curly_stack; // tokens appearing before a { | std::stack<int> curly_stack; // tokens appearing before a { | ||||
| bool expecting_xhp_class_statements; // when we're one level deep in a class | |||||
| bool used_attributes; // did this class use the `attribute` keyword | |||||
| unsigned int list_size; | unsigned int list_size; | ||||
| bool colon_hack; | |||||
| // Include line numbers and file names in XHP object creation. | // Include line numbers and file names in XHP object creation. | ||||
| bool include_debug; | bool include_debug; | ||||
| // Store old value while inside class method. | |||||
| bool old_expecting_xhp_class_statements; | |||||
| xhpast::token_list_t token_list; | xhpast::token_list_t token_list; | ||||
| /* Utility functions for checking proper tag closing */ | /* Utility functions for checking proper tag closing */ | ||||
| bool haveTag() { | bool haveTag() { | ||||
| return !tag_stack.front().empty(); | return !tag_stack.front().empty(); | ||||
| } | } | ||||
| const std::string &peekTag() { | const std::string &peekTag() { | ||||
| return tag_stack.front().front(); | return tag_stack.front().front(); | ||||
| Show All 31 Lines | |||||