Skip to content

Commit 82e7131

Browse files
authored
Merge pull request #1047 from TheAwiteb/fix-fn-params-reserved-keyword
fix: detect reserved keyword in functions params
2 parents be8b38d + e44834e commit 82e7131

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/parser.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3654,6 +3654,12 @@ impl Engine {
36543654
params.push((s, pos));
36553655
}
36563656
(Token::LexError(err), pos) => return Err(err.into_err(pos)),
3657+
(token, pos) if token.is_reserved() => {
3658+
return Err(PERR::Reserved(token.to_string()).into_err(pos))
3659+
}
3660+
(token, pos) if token.is_standard_keyword() => {
3661+
return Err(PERR::VariableExpected.into_err(pos))
3662+
}
36573663
(.., pos) => {
36583664
return Err(PERR::MissingToken(
36593665
Token::RightParen.into(),
@@ -3816,6 +3822,12 @@ impl Engine {
38163822
params_list.push(s);
38173823
}
38183824
(Token::LexError(err), pos) => return Err(err.into_err(pos)),
3825+
(token, pos) if token.is_reserved() => {
3826+
return Err(PERR::Reserved(token.to_string()).into_err(pos))
3827+
}
3828+
(token, pos) if token.is_standard_keyword() => {
3829+
return Err(PERR::VariableExpected.into_err(pos))
3830+
}
38193831
(.., pos) => {
38203832
return Err(PERR::MissingToken(
38213833
Token::Pipe.into(),

0 commit comments

Comments
 (0)