diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lexer.go | 8 | ||||
-rw-r--r-- | spec/parser.go | 6 | ||||
-rw-r--r-- | spec/syntax_error.go | 1 |
3 files changed, 4 insertions, 11 deletions
diff --git a/spec/lexer.go b/spec/lexer.go index 80beba0..ba64925 100644 --- a/spec/lexer.go +++ b/spec/lexer.go @@ -205,7 +205,7 @@ func (l *lexer) lexAndSkipWSs() (*token, error) { // The escape sequences in a pattern string are interpreted by the lexer, except for the \". // We must interpret the \" before passing them to the lexer because they are delimiters for // the pattern strings. - fmt.Fprintf(&b, strings.ReplaceAll(string(tok.Lexeme), `\"`, `"`)) + fmt.Fprint(&b, strings.ReplaceAll(string(tok.Lexeme), `\"`, `"`)) case KindIDEscapeSymbol: return nil, &verr.SpecError{ Cause: synErrIncompletedEscSeq, @@ -240,13 +240,13 @@ func (l *lexer) lexAndSkipWSs() (*token, error) { } switch tok.KindID { case KindIDCharSeq: - fmt.Fprintf(&b, string(tok.Lexeme)) + fmt.Fprint(&b, string(tok.Lexeme)) case KindIDEscapedQuot: // Remove '\' character. - fmt.Fprintf(&b, `'`) + fmt.Fprint(&b, `'`) case KindIDEscapedBackSlash: // Remove '\' character. - fmt.Fprintf(&b, `\`) + fmt.Fprint(&b, `\`) case KindIDEscapeSymbol: return nil, &verr.SpecError{ Cause: synErrIncompletedEscSeq, diff --git a/spec/parser.go b/spec/parser.go index 71ee50b..7f3d8f7 100644 --- a/spec/parser.go +++ b/spec/parser.go @@ -193,8 +193,6 @@ func (p *parser) parseMetaData() *DirectiveNode { p.errs = append(p.errs, specErr) p.skipOverTo(tokenKindNewline) - - return }() p.consume(tokenKindNewline) @@ -241,8 +239,6 @@ func (p *parser) parseFragment() *FragmentNode { p.errs = append(p.errs, specErr) p.skipOverTo(tokenKindSemicolon) - - return }() p.consume(tokenKindNewline) @@ -308,8 +304,6 @@ func (p *parser) parseProduction() *ProductionNode { p.errs = append(p.errs, specErr) p.skipOverTo(tokenKindSemicolon) - - return }() p.consume(tokenKindNewline) diff --git a/spec/syntax_error.go b/spec/syntax_error.go index f82186a..a35a90c 100644 --- a/spec/syntax_error.go +++ b/spec/syntax_error.go @@ -19,7 +19,6 @@ var ( synErrAutoGenID = newSyntaxError("you cannot define an identifier beginning with an underscore") synErrUnclosedTerminal = newSyntaxError("unclosed terminal") synErrUnclosedString = newSyntaxError("unclosed string") - synErrInvalidEscSeq = newSyntaxError("invalid escape sequence") synErrIncompletedEscSeq = newSyntaxError("incompleted escape sequence; unexpected EOF following a backslash") synErrEmptyPattern = newSyntaxError("a pattern must include at least one character") synErrEmptyString = newSyntaxError("a string must include at least one character") |