aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2024-11-01 19:59:35 +0000
committerAndrzej Janik <[email protected]>2024-11-01 19:59:35 +0000
commit115f3f2d58c87e87834648604fbcc09165ce5020 (patch)
treee0532fa9bd888b7dc526264cff870e44379b02e7
parent454ed3cc0d5ee4ae0587a59a7eef095178fca2cd (diff)
downloadZLUDA-115f3f2d58c87e87834648604fbcc09165ce5020.tar.gz
ZLUDA-115f3f2d58c87e87834648604fbcc09165ce5020.zip
Improve recovery from unknown directiveerror_report
-rw-r--r--ptx_parser/src/lib.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/ptx_parser/src/lib.rs b/ptx_parser/src/lib.rs
index c9b929a..1ea2d71 100644
--- a/ptx_parser/src/lib.rs
+++ b/ptx_parser/src/lib.rs
@@ -400,6 +400,7 @@ fn directive<'a, 'input>(
) -> PResult<Option<ast::Directive<'input, ast::ParsedOperand<&'input str>>>> {
with_recovery(
alt((
+ // When adding a new variant here remember to add its first token into recovery parser down below
function.map(|(linking, func)| Some(ast::Directive::Method(linking, func))),
file.map(|_| None),
section.map(|_| None),
@@ -407,7 +408,14 @@ fn directive<'a, 'input>(
.map(|((linking, var), _)| Some(ast::Directive::Variable(linking, var))),
)),
take_till(1.., |(token, _)| match token {
- Token::DotVisible | Token::DotFile | Token::DotSection => true,
+ // visibility
+ Token::DotExtern | Token::DotVisible | Token::DotWeak
+ // methods
+ | Token::DotFunc | Token::DotEntry
+ // module variables
+ | Token::DotGlobal | Token::DotConst | Token::DotShared
+ // other sections
+ | Token::DotFile | Token::DotSection => true,
_ => false,
}),
PtxError::UnrecognizedDirective,