Skip to content

Commit

Permalink
parser: fix a few typos and grammar mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
bom-d-van committed Jun 8, 2021
1 parent b3e5511 commit 81bf8cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions pkg/parser/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ var (
ErrMissingQuote = ParseError("missing quote")
// ErrUnexpectedCharacter is a parse error returned when an expression contains an unexpected character.
ErrUnexpectedCharacter = ParseError("unexpected character")
// ErrMissinggBracket is a parse error returned when an expression is missing an opening or closing bracket.
ErrMissinggBracket = ParseError("missing opening or closing bracket []")
// ErrMissinggBrace is a parse error returned when an expression is missing an opening or closing brace.
ErrMissinggBrace = ParseError("missing opening or closing brace {}")
// ErrMissingBracket is a parse error returned when an expression is missing an opening or closing bracket.
ErrMissingBracket = ParseError("missing opening or closing bracket []")
// ErrMissingBrace is a parse error returned when an expression is missing an opening or closing brace.
ErrMissingBrace = ParseError("missing opening or closing brace {}")
// ErrCommaInBrackets is a parse error returned when an expression has comma within brackets.
ErrCommaInBrackets = ParseError("comma within brackets")
// ErrSpacesInMetricName is a parse error returned when an expression has space in metric name.
Expand Down
12 changes: 6 additions & 6 deletions pkg/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,20 +582,20 @@ FOR:
// Graphite render spec: https://graphite.readthedocs.io/en/latest/render_api.html#graphing-metrics
switch s[i] {
case '{':
// No way escape { in metric names, thus supporting it
// No way escape { in metric names, thus using it
// in the range brackets should be an error.
if brackets > 0 {
return s, "", ErrBraceInBrackets
}

braces++
case '}':
// No way escape } in metric names, thus supporting it
// No way escape } in metric names, thus using it
// in the range brackets should be an error.
if brackets > 0 {
return s, "", ErrBraceInBrackets
} else if braces == 0 {
return s, "", ErrMissinggBrace
return s, "", ErrMissingBrace
}

braces--
Expand All @@ -616,7 +616,7 @@ FOR:
// No way to escape braces {} and brackets [] in
// graphite query, thus missing open [ means it's a query bug.
if brackets == 0 {
return s, "", ErrMissinggBracket
return s, "", ErrMissingBracket
}

brackets--
Expand Down Expand Up @@ -662,10 +662,10 @@ FOR:
// No way to escape braces {} and brackets [] in graphite query, thus
// missing closed }/] means it's a query bug.
if braces > 0 {
return s, "", ErrMissinggBrace
return s, "", ErrMissingBrace
}
if brackets > 0 {
return s, "", ErrMissinggBracket
return s, "", ErrMissingBracket
}

if i == len(s) {
Expand Down

0 comments on commit 81bf8cc

Please sign in to comment.