php7: save all comments
This commit is contained in:
@@ -3,7 +3,6 @@ package php7
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/comment"
|
||||
"github.com/z7zmey/php-parser/errors"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/parser"
|
||||
@@ -72,16 +71,6 @@ func (l *Parser) Parse() int {
|
||||
return yyParse(l)
|
||||
}
|
||||
|
||||
func (l *Parser) listGetFirstNodeComments(list []node.Node) []*comment.Comment {
|
||||
if len(list) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
node := list[0]
|
||||
|
||||
return l.comments[node]
|
||||
}
|
||||
|
||||
// GetPath return path to file
|
||||
func (l *Parser) GetPath() string {
|
||||
return l.path
|
||||
@@ -106,3 +95,19 @@ func (l *Parser) GetComments() parser.Comments {
|
||||
func (l *Parser) GetPositions() parser.Positions {
|
||||
return l.positions
|
||||
}
|
||||
|
||||
// GetPositions returns positions list
|
||||
func (l *Parser) setCommentsFromChildNode(n node.Node, c node.Node) {
|
||||
l.comments.AddComments(n, l.comments[c])
|
||||
delete(l.comments, c)
|
||||
}
|
||||
|
||||
// helpers
|
||||
|
||||
func lastNode(nn []node.Node) node.Node {
|
||||
return nn[len(nn)-1]
|
||||
}
|
||||
|
||||
func firstNode(nn []node.Node) node.Node {
|
||||
return nn[0]
|
||||
}
|
||||
|
||||
4627
php7/php7.go
4627
php7/php7.go
File diff suppressed because it is too large
Load Diff
4836
php7/php7.y
4836
php7/php7.y
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user