mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 00:03:29 +00:00
feat(wgsl-in): add unimpl. diag. for compound stmt. @diagnostic(…)
s
This commit is contained in:
parent
c259f3b5a0
commit
435514176e
@ -136,6 +136,8 @@ pub enum ExpectedToken<'a> {
|
|||||||
Variable,
|
Variable,
|
||||||
/// Access of a function
|
/// Access of a function
|
||||||
Function,
|
Function,
|
||||||
|
/// The `diagnostic` identifier of the `@diagnostic(…)` attribute.
|
||||||
|
DiagnosticAttribute,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Error, PartialEq)]
|
#[derive(Clone, Copy, Debug, Error, PartialEq)]
|
||||||
@ -388,6 +390,9 @@ impl<'a> Error<'a> {
|
|||||||
ExpectedToken::AfterIdentListComma => {
|
ExpectedToken::AfterIdentListComma => {
|
||||||
"next argument or end of list (';')".to_string()
|
"next argument or end of list (';')".to_string()
|
||||||
}
|
}
|
||||||
|
ExpectedToken::DiagnosticAttribute => {
|
||||||
|
"the 'diagnostic' attribute identifier".to_string()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
ParseError {
|
ParseError {
|
||||||
message: format!(
|
message: format!(
|
||||||
|
@ -2159,6 +2159,32 @@ impl Parser {
|
|||||||
|
|
||||||
ctx.local_table.push_scope();
|
ctx.local_table.push_scope();
|
||||||
|
|
||||||
|
let mut diagnostic_filters = DiagnosticFilterMap::new();
|
||||||
|
|
||||||
|
self.push_rule_span(Rule::Attribute, lexer);
|
||||||
|
while lexer.skip(Token::Attribute) {
|
||||||
|
let (name, name_span) = lexer.next_ident_with_span()?;
|
||||||
|
if let Some(DirectiveKind::Diagnostic) = DirectiveKind::from_ident(name) {
|
||||||
|
if let Some(filter) = self.diagnostic_filter(lexer)? {
|
||||||
|
let span = self.peek_rule_span(lexer);
|
||||||
|
diagnostic_filters.add(filter, span)?;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Err(Error::Unexpected(
|
||||||
|
name_span,
|
||||||
|
ExpectedToken::DiagnosticAttribute,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.pop_rule_span(lexer);
|
||||||
|
|
||||||
|
if !diagnostic_filters.is_empty() {
|
||||||
|
return Err(Error::DiagnosticAttributeNotYetImplementedAtParseSite {
|
||||||
|
site_name_plural: "compound statements",
|
||||||
|
spans: diagnostic_filters.spans().collect(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let brace_span = lexer.expect_span(Token::Paren('{'))?;
|
let brace_span = lexer.expect_span(Token::Paren('{'))?;
|
||||||
let brace_nesting_level = Self::increase_brace_nesting(brace_nesting_level, brace_span)?;
|
let brace_nesting_level = Self::increase_brace_nesting(brace_nesting_level, brace_span)?;
|
||||||
let mut block = ast::Block::default();
|
let mut block = ast::Block::default();
|
||||||
|
Loading…
Reference in New Issue
Block a user