@@ -5461,11 +5461,7 @@ impl<'a> Parser<'a> {
5461
5461
&& self.parse_keyword(Keyword::COMMENT)
5462
5462
{
5463
5463
self.expect_token(&Token::Eq)?;
5464
- let next_token = self.next_token();
5465
- match next_token.token {
5466
- Token::SingleQuotedString(str) => Some(str),
5467
- _ => self.expected("string literal", next_token)?,
5468
- }
5464
+ Some(self.parse_comment_value()?)
5469
5465
} else {
5470
5466
None
5471
5467
};
@@ -7069,21 +7065,28 @@ impl<'a> Parser<'a> {
7069
7065
pub fn parse_optional_inline_comment(&mut self) -> Result<Option<CommentDef>, ParserError> {
7070
7066
let comment = if self.parse_keyword(Keyword::COMMENT) {
7071
7067
let has_eq = self.consume_token(&Token::Eq);
7072
- let next_token = self.next_token();
7073
- match next_token.token {
7074
- Token::SingleQuotedString(str) => Some(if has_eq {
7075
- CommentDef::WithEq(str)
7076
- } else {
7077
- CommentDef::WithoutEq(str)
7078
- }),
7079
- _ => self.expected("comment", next_token)?,
7080
- }
7068
+ let comment = self.parse_comment_value()?;
7069
+ Some(if has_eq {
7070
+ CommentDef::WithEq(comment)
7071
+ } else {
7072
+ CommentDef::WithoutEq(comment)
7073
+ })
7081
7074
} else {
7082
7075
None
7083
7076
};
7084
7077
Ok(comment)
7085
7078
}
7086
7079
7080
+ pub fn parse_comment_value(&mut self) -> Result<String, ParserError> {
7081
+ let next_token = self.next_token();
7082
+ let value = match next_token.token {
7083
+ Token::SingleQuotedString(str) => str,
7084
+ Token::DollarQuotedString(str) => str.value,
7085
+ _ => self.expected("string literal", next_token)?,
7086
+ };
7087
+ Ok(value)
7088
+ }
7089
+
7087
7090
pub fn parse_optional_procedure_parameters(
7088
7091
&mut self,
7089
7092
) -> Result<Option<Vec<ProcedureParam>>, ParserError> {
@@ -7219,11 +7222,7 @@ impl<'a> Parser<'a> {
7219
7222
} else if self.parse_keywords(&[Keyword::NOT, Keyword::NULL]) {
7220
7223
Ok(Some(ColumnOption::NotNull))
7221
7224
} else if self.parse_keywords(&[Keyword::COMMENT]) {
7222
- let next_token = self.next_token();
7223
- match next_token.token {
7224
- Token::SingleQuotedString(value, ..) => Ok(Some(ColumnOption::Comment(value))),
7225
- _ => self.expected("string", next_token),
7226
- }
7225
+ Ok(Some(ColumnOption::Comment(self.parse_comment_value()?)))
7227
7226
} else if self.parse_keyword(Keyword::NULL) {
7228
7227
Ok(Some(ColumnOption::Null))
7229
7228
} else if self.parse_keyword(Keyword::DEFAULT) {
0 commit comments