@@ -5451,11 +5451,7 @@ impl<'a> Parser<'a> {
5451
5451
&& self.parse_keyword(Keyword::COMMENT)
5452
5452
{
5453
5453
self.expect_token(&Token::Eq)?;
5454
- let next_token = self.next_token();
5455
- match next_token.token {
5456
- Token::SingleQuotedString(str) => Some(str),
5457
- _ => self.expected("string literal", next_token)?,
5458
- }
5454
+ Some(self.parse_comment_value()?)
5459
5455
} else {
5460
5456
None
5461
5457
};
@@ -7059,21 +7055,28 @@ impl<'a> Parser<'a> {
7059
7055
pub fn parse_optional_inline_comment(&mut self) -> Result<Option<CommentDef>, ParserError> {
7060
7056
let comment = if self.parse_keyword(Keyword::COMMENT) {
7061
7057
let has_eq = self.consume_token(&Token::Eq);
7062
- let next_token = self.next_token();
7063
- match next_token.token {
7064
- Token::SingleQuotedString(str) => Some(if has_eq {
7065
- CommentDef::WithEq(str)
7066
- } else {
7067
- CommentDef::WithoutEq(str)
7068
- }),
7069
- _ => self.expected("comment", next_token)?,
7070
- }
7058
+ let comment = self.parse_comment_value()?;
7059
+ Some(if has_eq {
7060
+ CommentDef::WithEq(comment)
7061
+ } else {
7062
+ CommentDef::WithoutEq(comment)
7063
+ })
7071
7064
} else {
7072
7065
None
7073
7066
};
7074
7067
Ok(comment)
7075
7068
}
7076
7069
7070
+ pub fn parse_comment_value(&mut self) -> Result<String, ParserError> {
7071
+ let next_token = self.next_token();
7072
+ let value = match next_token.token {
7073
+ Token::SingleQuotedString(str) => str,
7074
+ Token::DollarQuotedString(str) => str.value,
7075
+ _ => self.expected("string literal", next_token)?,
7076
+ };
7077
+ Ok(value)
7078
+ }
7079
+
7077
7080
pub fn parse_optional_procedure_parameters(
7078
7081
&mut self,
7079
7082
) -> Result<Option<Vec<ProcedureParam>>, ParserError> {
@@ -7209,11 +7212,7 @@ impl<'a> Parser<'a> {
7209
7212
} else if self.parse_keywords(&[Keyword::NOT, Keyword::NULL]) {
7210
7213
Ok(Some(ColumnOption::NotNull))
7211
7214
} else if self.parse_keywords(&[Keyword::COMMENT]) {
7212
- let next_token = self.next_token();
7213
- match next_token.token {
7214
- Token::SingleQuotedString(value, ..) => Ok(Some(ColumnOption::Comment(value))),
7215
- _ => self.expected("string", next_token),
7216
- }
7215
+ Ok(Some(ColumnOption::Comment(self.parse_comment_value()?)))
7217
7216
} else if self.parse_keyword(Keyword::NULL) {
7218
7217
Ok(Some(ColumnOption::Null))
7219
7218
} else if self.parse_keyword(Keyword::DEFAULT) {
0 commit comments