remove meta.IdentifierToken

This commit is contained in:
z7zmey
2018-10-25 12:31:17 +03:00
parent dbdedc20de
commit 2efb4dc4cf
12 changed files with 175 additions and 198 deletions

View File

@@ -421,36 +421,14 @@ func (p *Printer) printNode(n node.Node) {
func (p *Printer) printNodeRoot(n node.Node) {
nn := n.(*node.Root)
p.printMeta(nn, meta.NodeStart)
// var stmts []node.Node
// if len(nn.Stmts) > 0 {
// firstStmt := nn.Stmts[0]
// stmts = nn.Stmts[1:]
// switch fs := firstStmt.(type) {
// case *stmt.InlineHtml:
// io.WriteString(p.w, fs.Value)
// io.WriteString(p.w, "<?php")
// default:
// io.WriteString(p.w, "<?php")
// p.Print(fs)
// }
// }
// p.printNodes(stmts)
p.printNodes(nn.Stmts)
p.printMeta(nn, meta.NodeEnd)
}
func (p *Printer) printNodeIdentifier(n node.Node) {
nn := n.(*node.Identifier)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.IdentifierToken)
io.WriteString(p.w, nn.Value)
p.printMeta(nn, meta.NodeEnd)
}

View File

@@ -126,7 +126,7 @@ func TestPrinterPrintIdentifier(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.IdentifierToken,
TokenName: meta.NodeStart,
},
},
Value: "test",
@@ -3019,7 +3019,7 @@ func TestPrinterPrintExprClassConstFetch(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.IdentifierToken,
TokenName: meta.NodeStart,
},
},
Value: "CONST",