Skip to content

Commit

Permalink
Remove old TODO, add spacing around comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat15 committed Jan 16, 2025
1 parent fd5b0cc commit c517486
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/composableschemadsl/parser/parser_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ func (p *sourceParser) tryConsumeKeyword(keyword string) bool {
func (p *sourceParser) consumeStringLiteral() (string, bool) {
consumedString, ok := p.tryConsumeStringLiteral()
if !ok {
// TODO: this currently says it's a TokenTypeError. Figure out a better way to handle
// the lexer error.
p.emitErrorf("Expected quote-delimited string, found token %v", p.currentToken.Kind)
return "", false
}
Expand All @@ -217,13 +215,15 @@ func (p *sourceParser) tryConsumeStringLiteral() (string, bool) {
return "", false
}
wrappedString := wrappedStringToken.Value

// NOTE: We can't just trim here, because a user may use a combination of
// single and double quotes to escape.
// If we have a string wrapped in singlequotes (singular or plural),
// strip those specifically.
if strings.Index(wrappedString, `'`) == 0 {
return strings.Trim(wrappedString, `'`), true
}

// Else strip doublequotes, because the set of string delimiters is limited
// by the lexer.
return strings.Trim(wrappedString, `"`), true
Expand Down

0 comments on commit c517486

Please sign in to comment.