Skip to content

Commit b4682dc

Browse files
committed
remove single-use diagnostics
1 parent 3a19ea5 commit b4682dc

File tree

12 files changed

+298
-398
lines changed

12 files changed

+298
-398
lines changed

experimental/internal/taxa/classify.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,17 @@ import (
2626

2727
// IsFloat checks whether or not tok is intended to be a floating-point literal.
2828
func IsFloat(tok token.Token) bool {
29-
digits := tok.Text()
29+
return IsFloatText(tok.Text())
30+
}
31+
32+
// IsFloatText checks whether or not the given number text is intended to be
33+
// a floating-point literal.
34+
func IsFloatText(digits string) bool {
35+
needle := ".Ee"
3036
if strings.HasPrefix(digits, "0x") || strings.HasPrefix(digits, "0X") {
31-
return strings.ContainsRune(digits, '.')
37+
needle = ".Pp"
3238
}
33-
return strings.ContainsAny(digits, ".eE")
39+
return strings.ContainsAny(digits, needle)
3440
}
3541

3642
// Classify attempts to classify node for use in a diagnostic.

experimental/parser/diagnostics_file.go

Lines changed: 0 additions & 53 deletions
This file was deleted.

experimental/parser/diagnostics_number.go

Lines changed: 0 additions & 116 deletions
This file was deleted.

experimental/parser/diagnostics_string.go

Lines changed: 0 additions & 93 deletions
This file was deleted.

experimental/parser/diagnostics_token.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,8 @@ import (
1818
"fmt"
1919

2020
"github.com/bufbuild/protocompile/experimental/report"
21-
"github.com/bufbuild/protocompile/experimental/token"
2221
)
2322

24-
// errUnrecognized diagnoses the presence of an unrecognized token.
25-
type errUnrecognized struct {
26-
Token token.Token // The offending token.
27-
}
28-
29-
// Diagnose implements [report.Diagnose].
30-
func (e errUnrecognized) Diagnose(d *report.Diagnostic) {
31-
d.Apply(
32-
report.Message("unrecognized token"),
33-
report.Snippet(e.Token),
34-
report.Debugf("%v, %v, %q", e.Token.ID(), e.Token.Span(), e.Token.Text()),
35-
)
36-
}
37-
38-
// errNonASCIIIdent diagnoses an identifier that contains non-ASCII runes.
39-
type errNonASCIIIdent struct {
40-
Token token.Token // The offending identifier token.
41-
}
42-
43-
// Diagnose implements [report.Diagnose].
44-
func (e errNonASCIIIdent) Diagnose(d *report.Diagnostic) {
45-
d.Apply(
46-
report.Message("non-ASCII identifiers are not allowed"),
47-
report.Snippet(e.Token),
48-
)
49-
}
50-
5123
// errUnmatched diagnoses a delimiter for which we found one half of a matched
5224
// delimiter but not the other.
5325
type errUnmatched struct {

0 commit comments

Comments
 (0)