inline_html node
This commit is contained in:
parent
8cab46a1b4
commit
02ce2bec9a
25
node/stmt/inline_html.go
Normal file
25
node/stmt/inline_html.go
Normal file
@ -0,0 +1,25 @@
|
||||
package stmt
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
type InlineHtml struct {
|
||||
node.SimpleNode
|
||||
token token.Token
|
||||
}
|
||||
|
||||
func NewInlineHtml(token token.Token) node.Node {
|
||||
return InlineHtml{
|
||||
node.SimpleNode{Name: "InlineHtml", Attributes: make(map[string]string)},
|
||||
token,
|
||||
}
|
||||
}
|
||||
|
||||
func (n InlineHtml) Print(out io.Writer, indent string) {
|
||||
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.Name, n.token.StartLine, n.token.EndLine, n.token.Value)
|
||||
}
|
@ -2879,7 +2879,7 @@ yydefault:
|
||||
yyDollar = yyS[yypt-1 : yypt+1]
|
||||
//line parser/parser.y:387
|
||||
{
|
||||
yyVAL.node = node.NewSimpleNode("Echo").Append(node.NewSimpleNode("InlineHtml").Attribute("value", yyDollar[1].token.String()))
|
||||
yyVAL.node = stmt.NewInlineHtml(yyDollar[1].token)
|
||||
}
|
||||
case 143:
|
||||
yyDollar = yyS[yypt-2 : yypt+1]
|
||||
|
@ -384,7 +384,7 @@ statement:
|
||||
| T_GLOBAL global_var_list ';' { $$ = stmt.NewGlobal($1, $2) }
|
||||
| T_STATIC static_var_list ';' { $$ = $2; }
|
||||
| T_ECHO echo_expr_list ';' { $$ = stmt.NewEcho($1, $2) }
|
||||
| T_INLINE_HTML { $$ = node.NewSimpleNode("Echo").Append(node.NewSimpleNode("InlineHtml").Attribute("value", $1.String())) }
|
||||
| T_INLINE_HTML { $$ = stmt.NewInlineHtml($1) }
|
||||
| expr ';' { $$ = stmt.NewExpression($1); }
|
||||
| T_UNSET '(' unset_variables possible_comma ')' ';'
|
||||
{ $$ = node.NewSimpleNode("Unset").Append($3); }
|
||||
|
Loading…
Reference in New Issue
Block a user