@@ -93,7 +93,7 @@ func ParseEntries(data []byte) ([]Entry, error) {
93
93
94
94
// parseEntry parses either a product or a comment.
95
95
//
96
- // Entry = ( product / comment )
96
+ // Entry = ( product / comment )
97
97
func parseEntry (data []byte , from int ) (e Entry , next int , err error ) {
98
98
// We are at the start of a character. Example valid input:
99
99
// `Mozilla/5.0`
@@ -116,8 +116,8 @@ func parseEntry(data []byte, from int) (e Entry, next int, err error) {
116
116
117
117
// parseProduct parses product with optional version.
118
118
//
119
- // product = token ["/" product-version]
120
- // product-version = token
119
+ // product = token ["/" product-version]
120
+ // product-version = token
121
121
func parseProduct (data []byte , from int ) (product , version string , next int , err error ) {
122
122
// Example valid input:
123
123
// `Mozilla`
@@ -148,7 +148,7 @@ func parseProduct(data []byte, from int) (product, version string, next int, err
148
148
149
149
// parseToken parses a token.
150
150
//
151
- // token = 1*tchar
151
+ // token = 1*tchar
152
152
func parseToken (data []byte , from int ) (token string , next int , ok bool ) {
153
153
// token is a sequence of token characters.
154
154
// See tchar for the allowed characters.
@@ -163,10 +163,10 @@ func parseToken(data []byte, from int) (token string, next int, ok bool) {
163
163
164
164
// parseComment parses a potentially comment. This does not allow nesting.
165
165
//
166
- // comment = "(" *( ctext / quoted-pair / comment ) ")"
167
- // ctext = HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E / obs-text
168
- // quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
169
- // obs-text = %x80-FF
166
+ // comment = "(" *( ctext / quoted-pair / comment ) ")"
167
+ // ctext = HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E / obs-text
168
+ // quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
169
+ // obs-text = %x80-FF
170
170
func parseComment (data []byte , from int ) (comment string , next int , err error ) {
171
171
// `(Linux; U; Android 4.4.3;)`
172
172
// `(Linux; \(; Android)`
@@ -212,9 +212,9 @@ func parseComment(data []byte, from int) (comment string, next int, err error) {
212
212
213
213
// parseCommentChar parses comment character.
214
214
//
215
- // ctext = HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E / obs-text
216
- // quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
217
- // obs-text = %x80-FF
215
+ // ctext = HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E / obs-text
216
+ // quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
217
+ // obs-text = %x80-FF
218
218
func parseCommentChar (data []byte , from int ) (ch byte , next int , err error ) {
219
219
p := from
220
220
b := data [p ]
@@ -271,10 +271,12 @@ func requireWhitespace(data []byte, from int) (next int, ok bool) {
271
271
return next , true
272
272
}
273
273
274
- // tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
275
- // / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
276
- // / DIGIT / ALPHA
277
- // ; any VCHAR, except delimiters
274
+ // istchar checks for textual-character
275
+ //
276
+ // tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
277
+ // / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
278
+ // / DIGIT / ALPHA
279
+ // ; any VCHAR, except delimiters
278
280
func istchar (b byte ) bool {
279
281
// DIGIT / ALPHA
280
282
if '0' <= b && b <= '9' || 'a' <= b && b <= 'z' || 'A' <= b && b <= 'Z' {
0 commit comments