Skip to content

Commit 3254953

Browse files
author
aleksei.p
committed
update
1 parent eaf66bc commit 3254953

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/parser/mod.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -5320,12 +5320,7 @@ impl<'a> Parser<'a> {
53205320
&& self.parse_keyword(Keyword::COMMENT)
53215321
{
53225322
self.expect_token(&Token::Eq)?;
5323-
let next_token = self.next_token();
5324-
match next_token.token {
5325-
Token::SingleQuotedString(str) => Some(str),
5326-
Token::DollarQuotedString(str) => Some(str.value),
5327-
_ => self.expected("string literal", next_token)?,
5328-
}
5323+
Some(self.parse_comment_value()?)
53295324
} else {
53305325
None
53315326
};
@@ -6926,12 +6921,7 @@ impl<'a> Parser<'a> {
69266921
pub fn parse_optional_inline_comment(&mut self) -> Result<Option<CommentDef>, ParserError> {
69276922
let comment = if self.parse_keyword(Keyword::COMMENT) {
69286923
let has_eq = self.consume_token(&Token::Eq);
6929-
let next_token = self.next_token();
6930-
let comment = match next_token.token {
6931-
Token::SingleQuotedString(str) => str,
6932-
Token::DollarQuotedString(str) => str.value,
6933-
_ => self.expected("comment", next_token)?,
6934-
};
6924+
let comment = self.parse_comment_value()?;
69356925
Some(if has_eq {
69366926
CommentDef::WithEq(comment)
69376927
} else {
@@ -6943,6 +6933,16 @@ impl<'a> Parser<'a> {
69436933
Ok(comment)
69446934
}
69456935

6936+
fn parse_comment_value(&mut self) -> Result<String, ParserError> {
6937+
let next_token = self.next_token();
6938+
let value = match next_token.token {
6939+
Token::SingleQuotedString(str) => str,
6940+
Token::DollarQuotedString(str) => str.value,
6941+
_ => self.expected("string literal", next_token)?,
6942+
};
6943+
Ok(value)
6944+
}
6945+
69466946
pub fn parse_optional_procedure_parameters(
69476947
&mut self,
69486948
) -> Result<Option<Vec<ProcedureParam>>, ParserError> {

0 commit comments

Comments
 (0)