handle closing tag in ?>
I wanted to get closer to zend's implementation but they seem to do scanning and parsing at the same time. We don't have the state of the parser when the scanner sees the ##?>## token. I think this is the next best thing if we don't want the refactor of D808985
Esse commit está contido em:
+773
-774
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,3 +1,3 @@
|
||||
NULL
|
||||
|
||||
HipHop Fatal error: %a
|
||||
HipHop Fatal error: %a
|
||||
@@ -2,4 +2,4 @@ object(foo\test)#%d (0) {
|
||||
}
|
||||
NULL
|
||||
|
||||
HipHop Fatal error: %a
|
||||
HipHop Fatal error: %a
|
||||
@@ -829,8 +829,7 @@ top_statement_list:
|
||||
| { }
|
||||
;
|
||||
top_statement:
|
||||
statement { _p->nns($1.num() == T_DECLARE);
|
||||
$$ = $1;}
|
||||
statement { _p->nns($1.num()); $$ = $1;}
|
||||
| function_declaration_statement { _p->nns(); $$ = $1;}
|
||||
| class_declaration_statement { _p->nns(); $$ = $1;}
|
||||
| trait_declaration_statement { _p->nns(); $$ = $1;}
|
||||
@@ -960,7 +959,7 @@ statement:
|
||||
| T_STATIC static_var_list ';' { _p->onStatic($$, $2);}
|
||||
| T_ECHO expr_list ';' { _p->onEcho($$, $2, 0);}
|
||||
| T_UNSET '(' variable_list ')' ';' { _p->onUnset($$, $3);}
|
||||
| ';' { $$.reset();}
|
||||
| ';' { $$.reset(); $$ = ';'}
|
||||
| T_INLINE_HTML { _p->onEcho($$, $1, 1);}
|
||||
| T_FOREACH '(' expr
|
||||
T_AS foreach_variable
|
||||
|
||||
@@ -287,13 +287,13 @@ void ParserBase::popLabelInfo() {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// namespace support
|
||||
|
||||
void ParserBase::nns(bool declare /* = false */) {
|
||||
if (m_nsState == SeenNamespaceStatement) {
|
||||
error("No code may exist outside of namespace {}: %s",
|
||||
getMessage().c_str());
|
||||
void ParserBase::nns(int token) {
|
||||
if (m_nsState == SeenNamespaceStatement && token != ';') {
|
||||
error("No code may exist outside of namespace {}: %d %s",
|
||||
token, getMessage().c_str());
|
||||
return;
|
||||
}
|
||||
if (m_nsState == SeenNothing && !declare) {
|
||||
if (m_nsState == SeenNothing && token != T_DECLARE) {
|
||||
m_nsState = SeenNonNamespaceStatement;
|
||||
}
|
||||
}
|
||||
@@ -305,6 +305,11 @@ void ParserBase::onNamespaceStart(const std::string &ns,
|
||||
"statement in the script: %s", getMessage().c_str());
|
||||
return;
|
||||
}
|
||||
if (m_nsState != SeenNothing && file_scope != m_nsFileScope) {
|
||||
error("Cannot mix bracketed namespace declarations with unbracketed "
|
||||
"namespace declarations");
|
||||
}
|
||||
|
||||
m_nsState = InsideNamespace;
|
||||
m_nsFileScope = file_scope;
|
||||
m_aliases.clear();
|
||||
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
void onNamespaceStart(const std::string &ns, bool file_scope = false);
|
||||
void onNamespaceEnd();
|
||||
void onUse(const std::string &ns, const std::string &as);
|
||||
void nns(bool declare = false);
|
||||
void nns(int token = 0);
|
||||
std::string nsDecl(const std::string &name);
|
||||
std::string resolve(const std::string &ns, bool cls);
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário