Skip to content

Commit 97e061f

Browse files
committed
Bump chroma to latest
1 parent 80a59df commit 97e061f

File tree

3 files changed

+9
-31
lines changed

3 files changed

+9
-31
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.25.5
55
require (
66
github.com/Azure/go-ntlmssp v0.1.0
77
github.com/alecthomas/assert v1.0.0
8-
github.com/alecthomas/chroma/v2 v2.19.0
8+
github.com/alecthomas/chroma/v2 v2.20.0
99
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
1010
github.com/dlclark/regexp2 v1.11.5
1111
github.com/gandarez/go-olson-timezone v0.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ github.com/alecthomas/assert v1.0.0 h1:3XmGh/PSuLzDbK3W2gUbRXwgW5lqPkuqvRgeQ30FI
44
github.com/alecthomas/assert v1.0.0/go.mod h1:va/d2JC+M7F6s+80kl/R3G7FUiW6JzUO+hPhLyJ36ZY=
55
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
66
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
7-
github.com/alecthomas/chroma/v2 v2.19.0 h1:Im+SLRgT8maArxv81mULDWN8oKxkzboH07CHesxElq4=
8-
github.com/alecthomas/chroma/v2 v2.19.0/go.mod h1:RVX6AvYm4VfYe/zsk7mjHueLDZor3aWCNE14TFlepBk=
7+
github.com/alecthomas/chroma/v2 v2.20.0 h1:sfIHpxPyR07/Oylvmcai3X/exDlE8+FA820NTz+9sGw=
8+
github.com/alecthomas/chroma/v2 v2.20.0/go.mod h1:e7tViK0xh/Nf4BYHl00ycY6rV7b8iXBksI9E359yNmA=
99
github.com/alecthomas/colour v0.1.0 h1:nOE9rJm6dsZ66RGWYSFrXw461ZIt9A6+nHgL7FRrDUk=
1010
github.com/alecthomas/colour v0.1.0/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
1111
github.com/alecthomas/repr v0.5.1 h1:E3G4t2QbHTSNpPKBgMTln5KLkZHLOcU7r37J4pXBuIg=

pkg/deps/golang.go

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ const (
2727
// ParserGo is a dependency parser for the go programming language.
2828
// It is not thread safe.
2929
type ParserGo struct {
30-
Parenthesis int
31-
State StateGo
32-
Output []string
30+
State StateGo
31+
Output []string
3332
}
3433

3534
// Parse parses dependencies from Golang file content using the chroma Golang lexer.
@@ -63,7 +62,6 @@ func (p *ParserGo) append(dep string) {
6362
}
6463

6564
func (p *ParserGo) init() {
66-
p.Parenthesis = 0
6765
p.State = StateGoUnknown
6866
p.Output = nil
6967
}
@@ -72,18 +70,14 @@ func (p *ParserGo) processToken(token chroma.Token) {
7270
switch token.Type {
7371
case chroma.KeywordNamespace:
7472
p.processKeywordNamespace(token.Value)
75-
case chroma.Punctuation:
76-
p.processPunctuation(token.Value)
7773
case chroma.LiteralString:
7874
p.processLiteralString(token.Value)
79-
case chroma.Text:
80-
p.processText(token.Value)
75+
case chroma.NameFunction:
76+
p.processNameFunction()
8177
}
8278
}
8379

8480
func (p *ParserGo) processKeywordNamespace(value string) {
85-
p.Parenthesis = 0
86-
8781
switch value {
8882
case "import":
8983
p.State = StateGoImport
@@ -92,28 +86,12 @@ func (p *ParserGo) processKeywordNamespace(value string) {
9286
}
9387
}
9488

95-
func (p *ParserGo) processPunctuation(value string) {
96-
switch value {
97-
case "(":
98-
p.Parenthesis++
99-
case ")":
100-
p.Parenthesis--
101-
}
102-
}
103-
10489
func (p *ParserGo) processLiteralString(value string) {
10590
if p.State == StateGoImport {
10691
p.append(value)
10792
}
10893
}
10994

110-
func (p *ParserGo) processText(value string) {
111-
if p.State == StateGoImport {
112-
if value == "\n" && p.Parenthesis <= 0 {
113-
p.State = StateGoUnknown
114-
p.Parenthesis = 0
115-
}
116-
} else {
117-
p.State = StateGoUnknown
118-
}
95+
func (p *ParserGo) processNameFunction() {
96+
p.State = StateGoUnknown
11997
}

0 commit comments

Comments
 (0)