From 81bf8ccb71a0e08cb0044c770b59b6fd75e91ddb Mon Sep 17 00:00:00 2001 From: Xiaofan Hu Date: Tue, 8 Jun 2021 16:05:55 +0200 Subject: [PATCH] parser: fix a few typos and grammar mistakes --- pkg/parser/interface.go | 8 ++++---- pkg/parser/parser.go | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/parser/interface.go b/pkg/parser/interface.go index bbee34c9..8f5690e6 100644 --- a/pkg/parser/interface.go +++ b/pkg/parser/interface.go @@ -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. diff --git a/pkg/parser/parser.go b/pkg/parser/parser.go index a75743bf..f01ad444 100644 --- a/pkg/parser/parser.go +++ b/pkg/parser/parser.go @@ -582,7 +582,7 @@ 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 @@ -590,12 +590,12 @@ FOR: 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-- @@ -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-- @@ -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) {