Skip to content

Commit

Permalink
Clean is enclose function
Browse files Browse the repository at this point in the history
  • Loading branch information
lighttiger2505 committed Mar 9, 2021
1 parent a249239 commit 7767dad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
11 changes: 2 additions & 9 deletions ast/astutil/astutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,6 @@ func (nr *NodeReader) CurNodeIs(nm NodeMatcher) bool {
return false
}

func isEnclose(node ast.Node, pos token.Pos) bool {
if 0 <= token.ComparePos(pos, node.Pos()) && 0 >= token.ComparePos(pos, node.End()) {
return true
}
return false
}

func IsEnclose(node ast.Node, pos token.Pos) bool {
if 0 <= token.ComparePos(pos, node.Pos()) && 0 >= token.ComparePos(pos, node.End()) {
return true
Expand All @@ -183,15 +176,15 @@ func IsEnclose(node ast.Node, pos token.Pos) bool {

func (nr *NodeReader) CurNodeEncloseIs(pos token.Pos) bool {
if nr.CurNode != nil {
return isEnclose(nr.CurNode, pos)
return IsEnclose(nr.CurNode, pos)
}
return false
}

func (nr *NodeReader) PeekNodeEncloseIs(pos token.Pos) bool {
_, peekNode := nr.PeekNode(false)
if peekNode != nil {
return isEnclose(peekNode, pos)
return IsEnclose(peekNode, pos)
}
return false
}
Expand Down
3 changes: 0 additions & 3 deletions parser/parseutil/position.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package parseutil

import (
"fmt"

"github.com/lighttiger2505/sqls/ast"
"github.com/lighttiger2505/sqls/ast/astutil"
"github.com/lighttiger2505/sqls/token"
Expand Down Expand Up @@ -136,7 +134,6 @@ func isInsertValues(nw *NodeWalker) bool {
return true
}
if nw.PrevNodesIsWithDepth(true, genTokenMatcher([]token.Kind{token.Comma}), depth) {
fmt.Println("PrevNodesIs Comma")
return true
}
}
Expand Down

0 comments on commit 7767dad

Please sign in to comment.