mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-04 18:58:41 +00:00
parent
39c198d823
commit
9fce1dfac5
5 changed files with 18 additions and 1 deletions
|
@ -179,6 +179,15 @@ impl<'a> Converter<'a> {
|
|||
COMMENT
|
||||
}
|
||||
|
||||
rustc_lexer::TokenKind::Frontmatter { has_invalid_preceding_whitespace, invalid_infostring } => {
|
||||
if *has_invalid_preceding_whitespace {
|
||||
err = "invalid preceding whitespace for frontmatter opening"
|
||||
} else if *invalid_infostring {
|
||||
err = "invalid infostring for frontmatter"
|
||||
}
|
||||
FRONTMATTER
|
||||
}
|
||||
|
||||
rustc_lexer::TokenKind::Whitespace => WHITESPACE,
|
||||
|
||||
rustc_lexer::TokenKind::Ident if token_text == "_" => UNDERSCORE,
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -133,6 +133,7 @@ Meta =
|
|||
|
||||
SourceFile =
|
||||
'#shebang'?
|
||||
'#frontmatter'?
|
||||
Attr*
|
||||
Item*
|
||||
|
||||
|
|
|
@ -1524,6 +1524,10 @@ impl ast::HasAttrs for SourceFile {}
|
|||
impl ast::HasDocComments for SourceFile {}
|
||||
impl ast::HasModuleItem for SourceFile {}
|
||||
impl SourceFile {
|
||||
#[inline]
|
||||
pub fn frontmatter_token(&self) -> Option<SyntaxToken> {
|
||||
support::token(&self.syntax, T![frontmatter])
|
||||
}
|
||||
#[inline]
|
||||
pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) }
|
||||
}
|
||||
|
|
|
@ -670,6 +670,7 @@ fn generate_syntax_kinds(grammar: KindsSrc) -> String {
|
|||
[ident] => { $crate::SyntaxKind::IDENT };
|
||||
[string] => { $crate::SyntaxKind::STRING };
|
||||
[shebang] => { $crate::SyntaxKind::SHEBANG };
|
||||
[frontmatter] => { $crate::SyntaxKind::FRONTMATTER };
|
||||
}
|
||||
|
||||
impl ::core::marker::Copy for SyntaxKind {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue