#62: save the all text after __halt_compiler(); as Meta

This commit is contained in:
z7zmey 2018-09-13 20:07:50 +03:00
parent 4989d31874
commit b805f0b167
4 changed files with 8 additions and 4 deletions

View File

@ -1037,7 +1037,9 @@ func TestParseAndPrintPhp5Goto(t *testing.T) {
func TestParseAndPrintPhp5HaltCompiler(t *testing.T) { func TestParseAndPrintPhp5HaltCompiler(t *testing.T) {
src := `<?php src := `<?php
__halt_compiler ( ) ;` __halt_compiler ( ) ;
this text is ignored by parser
`
actual := printPhp5(parsePhp5(src)) actual := printPhp5(parsePhp5(src))

View File

@ -1146,7 +1146,9 @@ func TestParseAndPrintGroupUse(t *testing.T) {
func TestParseAndPrintHaltCompiler(t *testing.T) { func TestParseAndPrintHaltCompiler(t *testing.T) {
src := `<?php src := `<?php
__halt_compiler ( ) ;` __halt_compiler ( ) ;
this text is ignored by parser
`
actual := print(parse(src)) actual := print(parse(src))

View File

@ -8948,7 +8948,7 @@ yyrule167: // .
} }
yyrule168: // .|[ \t\n\r] yyrule168: // .|[ \t\n\r]
{ {
// do nothing l.addMeta(meta.TokenType, l.Token())
goto yystate0 goto yystate0
} }
panic("unreachable") panic("unreachable")

View File

@ -673,7 +673,7 @@ NEW_LINE (\r|\n|\r\n)
<STRING_VAR_NAME>{VAR_NAME}[\[\}] l.popState();l.pushState(PHP);lval.Token(l.createToken(l.ungetChars(1))); return int(T_STRING_VARNAME) <STRING_VAR_NAME>{VAR_NAME}[\[\}] l.popState();l.pushState(PHP);lval.Token(l.createToken(l.ungetChars(1))); return int(T_STRING_VARNAME)
<STRING_VAR_NAME>. l.ungetChars(1);l.popState();l.pushState(PHP) <STRING_VAR_NAME>. l.ungetChars(1);l.popState();l.pushState(PHP)
<HALT_COMPILER>.|[ \t\n\r] // do nothing <HALT_COMPILER>.|[ \t\n\r] l.addMeta(meta.TokenType, l.Token())
%% %%
if _, ok := l.Abort(); ok { if _, ok := l.Abort(); ok {