Skip cleaning for search by name scrape queries (#2059)

* Skip pp for search by name queries
* upgrade htmlquery
This commit is contained in:
bnkai
2021-12-16 02:18:39 +02:00
committed by GitHub
parent 439c338049
commit 66dd239732
34 changed files with 10925 additions and 10665 deletions

View File

@@ -65,6 +65,7 @@ const (
nodeOperator
nodeVariable
nodeConstantOperand
nodeGroup
)
type parser struct {
@@ -104,6 +105,10 @@ func newFilterNode(n, m node) node {
return &filterNode{nodeType: nodeFilter, Input: n, Condition: m}
}
func newGroupNode(n node) node {
return &groupNode{nodeType: nodeGroup, Input: n}
}
// newRootNode returns a root node.
func newRootNode(s string) node {
return &rootNode{nodeType: nodeRoot, slash: s}
@@ -492,6 +497,9 @@ func (p *parser) parsePrimaryExpr(n node) (opnd node) {
case itemLParens:
p.next()
opnd = p.parseExpression(n)
if opnd.Type() != nodeConstantOperand {
opnd = newGroupNode(opnd)
}
p.skipItem(itemRParens)
case itemName:
if p.r.canBeFunc && !isNodeType(p.r) {
@@ -587,6 +595,16 @@ func (o *operandNode) String() string {
return fmt.Sprintf("%v", o.Val)
}
// groupNode holds a set of node expression
type groupNode struct {
nodeType
Input node
}
func (g *groupNode) String() string {
return fmt.Sprintf("%s", g.Input)
}
// filterNode holds a condition filter.
type filterNode struct {
nodeType