cue/parser: remove dead code

Change-Id: I0b151765dbb358d4990a097bf690959e6a0d747b
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2304
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/cue/parser/import.go b/cue/parser/import.go
index 62f2520..9b5afe6 100644
--- a/cue/parser/import.go
+++ b/cue/parser/import.go
@@ -161,11 +161,3 @@
 	}
 	return importComment(x[i]) < importComment(x[j])
 }
-
-type byCommentPos []*ast.CommentGroup
-
-func (x byCommentPos) Len() int      { return len(x) }
-func (x byCommentPos) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-func (x byCommentPos) Less(i, j int) bool {
-	return x[i].Pos().Before(x[j].Pos())
-}
diff --git a/cue/parser/parser.go b/cue/parser/parser.go
index cee8f7b..b84f6b7 100644
--- a/cue/parser/parser.go
+++ b/cue/parser/parser.go
@@ -558,31 +558,6 @@
 	return c.closeExpr(p, &ast.BadExpr{From: pos, To: p.pos})
 }
 
-func (p *parser) parseParams(ident *ast.Ident, follow token.Token) (params []*ast.Field) {
-	for {
-		c := p.openComments()
-		if ident == nil {
-			ident = p.parseIdent()
-		}
-		m := &ast.Field{Label: ident}
-		if p.tok == token.COLON {
-			m.Colon = p.expect(token.COLON)
-			m.Value = p.parseRHS()
-		}
-		hasComma := p.tok == token.COMMA
-		if hasComma {
-			p.expect(token.COMMA)
-		}
-		c.closeNode(p, m)
-		params = append(params, m)
-		if !hasComma || p.tok == follow || p.tok == token.EOF {
-			break
-		}
-		ident = nil
-	}
-	return params
-}
-
 func (p *parser) parseIndexOrSlice(x ast.Expr) (expr ast.Expr) {
 	if p.trace {
 		defer un(trace(p, "IndexOrSlice"))
diff --git a/cue/parser/walk.go b/cue/parser/walk.go
index f952f50..6ffaf48 100644
--- a/cue/parser/walk.go
+++ b/cue/parser/walk.go
@@ -18,7 +18,6 @@
 	"fmt"
 
 	"cuelang.org/go/cue/ast"
-	"cuelang.org/go/cue/token"
 )
 
 // TODO: use ast.Walk or adopt that version to allow visitors.
@@ -33,12 +32,6 @@
 
 // Helper functions for common node lists. They may be empty.
 
-func walkIdentList(v visitor, list []*ast.Ident) {
-	for _, x := range list {
-		walk(v, x)
-	}
-}
-
 func walkExprList(v visitor, list []ast.Expr) {
 	for _, x := range list {
 		walk(v, x)
@@ -204,67 +197,3 @@
 
 	v.After(node)
 }
-
-type inspector struct {
-	before func(ast.Node) bool
-	after  func(ast.Node)
-
-	commentStack []commentFrame
-	current      commentFrame
-}
-
-type commentFrame struct {
-	cg  []*ast.CommentGroup
-	pos int8
-}
-
-func (f *inspector) Before(node ast.Node) visitor {
-	if f.before == nil || f.before(node) {
-		f.commentStack = append(f.commentStack, f.current)
-		f.current = commentFrame{cg: node.Comments()}
-		f.visitComments(f.current.pos)
-		return f
-	}
-	return nil
-}
-
-func (f *inspector) After(node ast.Node) {
-	f.visitComments(127)
-	p := len(f.commentStack) - 1
-	f.current = f.commentStack[p]
-	f.commentStack = f.commentStack[:p]
-	f.current.pos++
-	if f.after != nil {
-		f.after(node)
-	}
-}
-
-func (f *inspector) Token(t token.Token) {
-	f.current.pos++
-}
-
-func (f *inspector) setPos(i int8) {
-	f.current.pos = i
-}
-
-func (f *inspector) visitComments(pos int8) {
-	c := &f.current
-	for ; len(c.cg) > 0; c.cg = c.cg[1:] {
-		cg := c.cg[0]
-		if cg.Position == pos {
-			continue
-		}
-		if f.before == nil || f.before(cg) {
-			for _, c := range cg.List {
-				if f.before == nil || f.before(c) {
-					if f.after != nil {
-						f.after(c)
-					}
-				}
-			}
-			if f.after != nil {
-				f.after(cg)
-			}
-		}
-	}
-}