mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-08-02 22:30:41 +00:00
Improve recovery from unknown directive
This commit is contained in:
parent
454ed3cc0d
commit
115f3f2d58
1 changed files with 9 additions and 1 deletions
|
@ -400,6 +400,7 @@ fn directive<'a, 'input>(
|
||||||
) -> PResult<Option<ast::Directive<'input, ast::ParsedOperand<&'input str>>>> {
|
) -> PResult<Option<ast::Directive<'input, ast::ParsedOperand<&'input str>>>> {
|
||||||
with_recovery(
|
with_recovery(
|
||||||
alt((
|
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))),
|
function.map(|(linking, func)| Some(ast::Directive::Method(linking, func))),
|
||||||
file.map(|_| None),
|
file.map(|_| None),
|
||||||
section.map(|_| None),
|
section.map(|_| None),
|
||||||
|
@ -407,7 +408,14 @@ fn directive<'a, 'input>(
|
||||||
.map(|((linking, var), _)| Some(ast::Directive::Variable(linking, var))),
|
.map(|((linking, var), _)| Some(ast::Directive::Variable(linking, var))),
|
||||||
)),
|
)),
|
||||||
take_till(1.., |(token, _)| match token {
|
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,
|
_ => false,
|
||||||
}),
|
}),
|
||||||
PtxError::UnrecognizedDirective,
|
PtxError::UnrecognizedDirective,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue