aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_assists/src/handlers/introduce_variable.rs2
-rw-r--r--crates/ra_hir_def/src/nameres/raw.rs2
-rw-r--r--crates/ra_ide/src/typing.rs2
-rw-r--r--crates/ra_syntax/src/ast/edit.rs4
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs44
-rw-r--r--xtask/src/ast_src.rs22
-rw-r--r--xtask/src/codegen/gen_syntax.rs10
7 files changed, 57 insertions, 29 deletions
diff --git a/crates/ra_assists/src/handlers/introduce_variable.rs b/crates/ra_assists/src/handlers/introduce_variable.rs
index ab6bdf6bb..8d0f7e922 100644
--- a/crates/ra_assists/src/handlers/introduce_variable.rs
+++ b/crates/ra_assists/src/handlers/introduce_variable.rs
@@ -61,7 +61,7 @@ pub(crate) fn introduce_variable(ctx: AssistCtx) -> Option<Assist> {
61 }; 61 };
62 if is_full_stmt { 62 if is_full_stmt {
63 tested_by!(test_introduce_var_expr_stmt); 63 tested_by!(test_introduce_var_expr_stmt);
64 if full_stmt.unwrap().semi_token().is_none() { 64 if full_stmt.unwrap().semicolon_token().is_none() {
65 buf.push_str(";"); 65 buf.push_str(";");
66 } 66 }
67 edit.replace(expr.syntax().text_range(), buf); 67 edit.replace(expr.syntax().text_range(), buf);
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs
index e72ba52cf..afd538e4a 100644
--- a/crates/ra_hir_def/src/nameres/raw.rs
+++ b/crates/ra_hir_def/src/nameres/raw.rs
@@ -287,7 +287,7 @@ impl RawItemsCollector {
287 let visibility = RawVisibility::from_ast_with_hygiene(module.visibility(), &self.hygiene); 287 let visibility = RawVisibility::from_ast_with_hygiene(module.visibility(), &self.hygiene);
288 288
289 let ast_id = self.source_ast_id_map.ast_id(&module); 289 let ast_id = self.source_ast_id_map.ast_id(&module);
290 if module.semi_token().is_some() { 290 if module.semicolon_token().is_some() {
291 let item = 291 let item =
292 self.raw_items.modules.alloc(ModuleData::Declaration { name, visibility, ast_id }); 292 self.raw_items.modules.alloc(ModuleData::Declaration { name, visibility, ast_id });
293 self.push_item(current_module, attrs, RawItemKind::Module(item)); 293 self.push_item(current_module, attrs, RawItemKind::Module(item));
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs
index 71d2bcb04..f55cd3bf5 100644
--- a/crates/ra_ide/src/typing.rs
+++ b/crates/ra_ide/src/typing.rs
@@ -63,7 +63,7 @@ fn on_char_typed_inner(
63fn on_eq_typed(file: &SourceFile, offset: TextUnit) -> Option<SingleFileChange> { 63fn on_eq_typed(file: &SourceFile, offset: TextUnit) -> Option<SingleFileChange> {
64 assert_eq!(file.syntax().text().char_at(offset), Some('=')); 64 assert_eq!(file.syntax().text().char_at(offset), Some('='));
65 let let_stmt: ast::LetStmt = find_node_at_offset(file.syntax(), offset)?; 65 let let_stmt: ast::LetStmt = find_node_at_offset(file.syntax(), offset)?;
66 if let_stmt.semi_token().is_some() { 66 if let_stmt.semicolon_token().is_some() {
67 return None; 67 return None;
68 } 68 }
69 if let Some(expr) = let_stmt.initializer() { 69 if let Some(expr) = let_stmt.initializer() {
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index 3d428fab3..a01f6487d 100644
--- a/crates/ra_syntax/src/ast/edit.rs
+++ b/crates/ra_syntax/src/ast/edit.rs
@@ -32,9 +32,9 @@ impl ast::FnDef {
32 let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new(); 32 let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new();
33 let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() { 33 let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() {
34 old_body.syntax().clone().into() 34 old_body.syntax().clone().into()
35 } else if let Some(semi) = self.semi_token() { 35 } else if let Some(semi) = self.semicolon_token() {
36 to_insert.push(make::tokens::single_space().into()); 36 to_insert.push(make::tokens::single_space().into());
37 semi.syntax.clone().into() 37 semi.into()
38 } else { 38 } else {
39 to_insert.push(make::tokens::single_space().into()); 39 to_insert.push(make::tokens::single_space().into());
40 to_insert.push(body.syntax().clone().into()); 40 to_insert.push(body.syntax().clone().into());
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 3b014e312..214e12918 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -58,7 +58,9 @@ impl FnDef {
58 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } 58 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
59 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } 59 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
60 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } 60 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
61 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 61 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
62 support::token2(&self.syntax, T ! [ ; ])
63 }
62} 64}
63#[derive(Debug, Clone, PartialEq, Eq, Hash)] 65#[derive(Debug, Clone, PartialEq, Eq, Hash)]
64pub struct RetType { 66pub struct RetType {
@@ -102,7 +104,9 @@ impl ast::DocCommentsOwner for StructDef {}
102impl StructDef { 104impl StructDef {
103 pub fn struct_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![struct]) } 105 pub fn struct_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![struct]) }
104 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } 106 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) }
105 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 107 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
108 support::token2(&self.syntax, T ! [ ; ])
109 }
106} 110}
107#[derive(Debug, Clone, PartialEq, Eq, Hash)] 111#[derive(Debug, Clone, PartialEq, Eq, Hash)]
108pub struct UnionDef { 112pub struct UnionDef {
@@ -328,7 +332,9 @@ impl ast::DocCommentsOwner for Module {}
328impl Module { 332impl Module {
329 pub fn mod_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![mod]) } 333 pub fn mod_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![mod]) }
330 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } 334 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
331 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 335 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
336 support::token2(&self.syntax, T ! [ ; ])
337 }
332} 338}
333#[derive(Debug, Clone, PartialEq, Eq, Hash)] 339#[derive(Debug, Clone, PartialEq, Eq, Hash)]
334pub struct ItemList { 340pub struct ItemList {
@@ -379,7 +385,9 @@ impl ConstDef {
379 pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![const]) } 385 pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![const]) }
380 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 386 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
381 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 387 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
382 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 388 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
389 support::token2(&self.syntax, T ! [ ; ])
390 }
383} 391}
384#[derive(Debug, Clone, PartialEq, Eq, Hash)] 392#[derive(Debug, Clone, PartialEq, Eq, Hash)]
385pub struct StaticDef { 393pub struct StaticDef {
@@ -407,7 +415,9 @@ impl StaticDef {
407 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![mut]) } 415 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![mut]) }
408 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 416 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
409 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 417 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
410 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 418 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
419 support::token2(&self.syntax, T ! [ ; ])
420 }
411} 421}
412#[derive(Debug, Clone, PartialEq, Eq, Hash)] 422#[derive(Debug, Clone, PartialEq, Eq, Hash)]
413pub struct TypeAliasDef { 423pub struct TypeAliasDef {
@@ -437,7 +447,9 @@ impl TypeAliasDef {
437 pub fn type_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![type]) } 447 pub fn type_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![type]) }
438 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 448 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
439 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 449 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
440 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 450 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
451 support::token2(&self.syntax, T ! [ ; ])
452 }
441} 453}
442#[derive(Debug, Clone, PartialEq, Eq, Hash)] 454#[derive(Debug, Clone, PartialEq, Eq, Hash)]
443pub struct ImplDef { 455pub struct ImplDef {
@@ -582,7 +594,9 @@ impl AstNode for ArrayType {
582impl ArrayType { 594impl ArrayType {
583 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } 595 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) }
584 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 596 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
585 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 597 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
598 support::token2(&self.syntax, T ! [ ; ])
599 }
586 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 600 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
587 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } 601 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) }
588} 602}
@@ -765,7 +779,9 @@ impl ast::AttrsOwner for ArrayExpr {}
765impl ArrayExpr { 779impl ArrayExpr {
766 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } 780 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) }
767 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } 781 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
768 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 782 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
783 support::token2(&self.syntax, T ! [ ; ])
784 }
769 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } 785 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) }
770} 786}
771#[derive(Debug, Clone, PartialEq, Eq, Hash)] 787#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -1859,7 +1875,9 @@ impl MacroCall {
1859 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1875 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1860 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) } 1876 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) }
1861 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } 1877 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
1862 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 1878 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
1879 support::token2(&self.syntax, T ! [ ; ])
1880 }
1863} 1881}
1864#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1882#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1865pub struct Attr { 1883pub struct Attr {
@@ -2100,7 +2118,9 @@ impl AstNode for ExprStmt {
2100impl ast::AttrsOwner for ExprStmt {} 2118impl ast::AttrsOwner for ExprStmt {}
2101impl ExprStmt { 2119impl ExprStmt {
2102 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 2120 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2103 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 2121 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
2122 support::token2(&self.syntax, T ! [ ; ])
2123 }
2104} 2124}
2105#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2125#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2106pub struct LetStmt { 2126pub struct LetStmt {
@@ -2124,7 +2144,9 @@ impl LetStmt {
2124 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 2144 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2125 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2145 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
2126 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } 2146 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
2127 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 2147 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
2148 support::token2(&self.syntax, T ! [ ; ])
2149 }
2128} 2150}
2129#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2151#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2130pub struct Condition { 2152pub struct Condition {
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs
index 3da280551..1a6ee935f 100644
--- a/xtask/src/ast_src.rs
+++ b/xtask/src/ast_src.rs
@@ -319,7 +319,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
319 ParamList, 319 ParamList,
320 RetType, 320 RetType,
321 body: BlockExpr, 321 body: BlockExpr,
322 Semi 322 T![;]
323 } 323 }
324 324
325 struct RetType { ThinArrow, TypeRef } 325 struct RetType { ThinArrow, TypeRef }
@@ -327,7 +327,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
327 struct StructDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner { 327 struct StructDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner {
328 T![struct], 328 T![struct],
329 FieldDefList, 329 FieldDefList,
330 Semi 330 T![;]
331 } 331 }
332 332
333 struct UnionDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner { 333 struct UnionDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner {
@@ -368,7 +368,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
368 struct Module: VisibilityOwner, NameOwner, AttrsOwner, DocCommentsOwner { 368 struct Module: VisibilityOwner, NameOwner, AttrsOwner, DocCommentsOwner {
369 T![mod], 369 T![mod],
370 ItemList, 370 ItemList,
371 Semi 371 T![;]
372 } 372 }
373 373
374 struct ItemList: ModuleItemOwner { 374 struct ItemList: ModuleItemOwner {
@@ -382,7 +382,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
382 T![const], 382 T![const],
383 Eq, 383 Eq,
384 body: Expr, 384 body: Expr,
385 Semi 385 T![;]
386 } 386 }
387 387
388 struct StaticDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { 388 struct StaticDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner {
@@ -390,7 +390,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
390 T![mut], 390 T![mut],
391 Eq, 391 Eq,
392 body: Expr, 392 body: Expr,
393 Semi 393 T![;]
394 } 394 }
395 395
396 struct TypeAliasDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeBoundsOwner { 396 struct TypeAliasDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeBoundsOwner {
@@ -398,7 +398,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
398 T![type], 398 T![type],
399 Eq, 399 Eq,
400 TypeRef, 400 TypeRef,
401 Semi 401 T![;]
402 } 402 }
403 403
404 struct ImplDef: TypeParamsOwner, AttrsOwner { 404 struct ImplDef: TypeParamsOwner, AttrsOwner {
@@ -416,7 +416,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
416 struct NeverType { Excl } 416 struct NeverType { Excl }
417 struct PathType { Path } 417 struct PathType { Path }
418 struct PointerType { Star, T![const], T![mut], TypeRef } 418 struct PointerType { Star, T![const], T![mut], TypeRef }
419 struct ArrayType { LBrack, TypeRef, Semi, Expr, RBrack } 419 struct ArrayType { LBrack, TypeRef, T![;], Expr, RBrack }
420 struct SliceType { LBrack, TypeRef, RBrack } 420 struct SliceType { LBrack, TypeRef, RBrack }
421 struct ReferenceType { Amp, Lifetime, T![mut], TypeRef } 421 struct ReferenceType { Amp, Lifetime, T![mut], TypeRef }
422 struct PlaceholderType { Underscore } 422 struct PlaceholderType { Underscore }
@@ -426,7 +426,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
426 struct DynTraitType: TypeBoundsOwner { T![dyn] } 426 struct DynTraitType: TypeBoundsOwner { T![dyn] }
427 427
428 struct TupleExpr: AttrsOwner { LParen, exprs: [Expr], RParen } 428 struct TupleExpr: AttrsOwner { LParen, exprs: [Expr], RParen }
429 struct ArrayExpr: AttrsOwner { LBrack, exprs: [Expr], Semi, RBrack } 429 struct ArrayExpr: AttrsOwner { LBrack, exprs: [Expr], T![;], RBrack }
430 struct ParenExpr: AttrsOwner { LParen, Expr, RParen } 430 struct ParenExpr: AttrsOwner { LParen, Expr, RParen }
431 struct PathExpr { Path } 431 struct PathExpr { Path }
432 struct LambdaExpr: AttrsOwner { 432 struct LambdaExpr: AttrsOwner {
@@ -520,7 +520,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
520 struct NameRef { NameRefToken } 520 struct NameRef { NameRefToken }
521 521
522 struct MacroCall: NameOwner, AttrsOwner,DocCommentsOwner { 522 struct MacroCall: NameOwner, AttrsOwner,DocCommentsOwner {
523 Path, Excl, TokenTree, Semi 523 Path, Excl, TokenTree, T![;]
524 } 524 }
525 struct Attr { Pound, Excl, LBrack, Path, Eq, input: AttrInput, RBrack } 525 struct Attr { Pound, Excl, LBrack, Path, Eq, input: AttrInput, RBrack }
526 struct TokenTree {} 526 struct TokenTree {}
@@ -546,13 +546,13 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
546 struct WherePred: TypeBoundsOwner { Lifetime, TypeRef } 546 struct WherePred: TypeBoundsOwner { Lifetime, TypeRef }
547 struct WhereClause { T![where], predicates: [WherePred] } 547 struct WhereClause { T![where], predicates: [WherePred] }
548 struct Abi { String } 548 struct Abi { String }
549 struct ExprStmt: AttrsOwner { Expr, Semi } 549 struct ExprStmt: AttrsOwner { Expr, T![;] }
550 struct LetStmt: AttrsOwner, TypeAscriptionOwner { 550 struct LetStmt: AttrsOwner, TypeAscriptionOwner {
551 T![let], 551 T![let],
552 Pat, 552 Pat,
553 Eq, 553 Eq,
554 initializer: Expr, 554 initializer: Expr,
555 Semi, 555 T![;],
556 } 556 }
557 struct Condition { T![let], Pat, Eq, Expr } 557 struct Condition { T![let], Pat, Eq, Expr }
558 struct Block: AttrsOwner, ModuleItemOwner { 558 struct Block: AttrsOwner, ModuleItemOwner {
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs
index c4fb29bbf..26f541da1 100644
--- a/xtask/src/codegen/gen_syntax.rs
+++ b/xtask/src/codegen/gen_syntax.rs
@@ -515,7 +515,7 @@ impl Field<'_> {
515 fn token_kind(&self) -> Option<proc_macro2::TokenStream> { 515 fn token_kind(&self) -> Option<proc_macro2::TokenStream> {
516 let res = match self { 516 let res = match self {
517 Field::Token(token) => { 517 Field::Token(token) => {
518 let token = format_ident!("{}", token); 518 let token: proc_macro2::TokenStream = token.parse().unwrap();
519 quote! { T![#token] } 519 quote! { T![#token] }
520 } 520 }
521 _ => return None, 521 _ => return None,
@@ -524,7 +524,13 @@ impl Field<'_> {
524 } 524 }
525 fn method_name(&self) -> proc_macro2::Ident { 525 fn method_name(&self) -> proc_macro2::Ident {
526 match self { 526 match self {
527 Field::Token(name) => format_ident!("{}_token", name), 527 Field::Token(name) => {
528 let name = match *name {
529 ";" => "semicolon",
530 _ => name,
531 };
532 format_ident!("{}_token", name)
533 }
528 Field::Node { name, src } => match src { 534 Field::Node { name, src } => match src {
529 FieldSrc::Shorthand => format_ident!("{}", to_lower_snake_case(name)), 535 FieldSrc::Shorthand => format_ident!("{}", to_lower_snake_case(name)),
530 _ => format_ident!("{}", name), 536 _ => format_ident!("{}", name),