From 3a3a33b28e9374f6179897df2cc8404c747a94ff Mon Sep 17 00:00:00 2001 From: Luni-4 Date: Fri, 23 Dec 2022 10:29:06 +0100 Subject: [PATCH 1/4] enums: Update grammars --- enums/Cargo.lock | 16 ++++++++-------- enums/Cargo.toml | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/enums/Cargo.lock b/enums/Cargo.lock index 9ec19953b..747c66993 100644 --- a/enums/Cargo.lock +++ b/enums/Cargo.lock @@ -376,9 +376,9 @@ dependencies = [ [[package]] name = "tree-sitter" -version = "0.20.2" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36be3222512d85a112491ae0cc280a38076022414f00b64582da1b7565ffd82" +checksum = "d4423c784fe11398ca91e505cdc71356b07b1a924fc8735cfab5333afe3e18bc" dependencies = [ "cc", "regex", @@ -450,9 +450,9 @@ dependencies = [ [[package]] name = "tree-sitter-python" -version = "0.20.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0d315475c65416274539dd1db9fa2de94918a6ef399dc1287be7cb7bc83dd6d" +checksum = "dda114f58048f5059dcf158aff691dffb8e113e6d2b50d94263fd68711975287" dependencies = [ "cc", "tree-sitter", @@ -460,9 +460,9 @@ dependencies = [ [[package]] name = "tree-sitter-rust" -version = "0.20.0" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df540a493d754015d22eaf57c38f58804be3713a22f6062db983ec15f85c3c9" +checksum = "797842733e252dc11ae5d403a18060bf337b822fc2ae5ddfaa6ff4d9cc20bda6" dependencies = [ "cc", "tree-sitter", @@ -470,9 +470,9 @@ dependencies = [ [[package]] name = "tree-sitter-typescript" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8935efd97c92067c9b2b6d7acb647607590996ba80f3a7be09a197f9c1fdab73" +checksum = "4e8ed0ecb931cdff13c6a13f45ccd615156e2779d9ffb0395864e05505e6e86d" dependencies = [ "cc", "tree-sitter", diff --git a/enums/Cargo.toml b/enums/Cargo.toml index 1c2b1a711..19825da24 100644 --- a/enums/Cargo.toml +++ b/enums/Cargo.toml @@ -8,12 +8,12 @@ edition = "2021" clap = { version = "^3.2", features = ["derive"] } askama = "^0.11" -tree-sitter = ">= 0.20, < 0.21" +tree-sitter = "0.20.9" tree-sitter-java = "=0.20.0" -tree-sitter-typescript = "=0.20.0" +tree-sitter-typescript = "=0.20.1" tree-sitter-javascript = "=0.20.0" -tree-sitter-python = "=0.20.0" -tree-sitter-rust = "=0.20.0" +tree-sitter-python = "=0.20.2" +tree-sitter-rust = "=0.20.3" tree-sitter-preproc = { path = "../tree-sitter-preproc", version = "=0.20.0" } tree-sitter-ccomment = { path = "../tree-sitter-ccomment", version = "=0.20.0" } tree-sitter-mozcpp = { path = "../tree-sitter-mozcpp", version = "=0.20.1" } From 0f7dee751cd9f847cabd4391d746367bb8da0029 Mon Sep 17 00:00:00 2001 From: Luni-4 Date: Fri, 23 Dec 2022 10:29:58 +0100 Subject: [PATCH 2/4] Update grammars --- Cargo.toml | 8 +- src/languages/language_rust.rs | 366 ++++++++++++------------ src/languages/language_tsx.rs | 398 ++++++++++++++------------- src/languages/language_typescript.rs | 384 +++++++++++++------------- 4 files changed, 591 insertions(+), 565 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b773306d8..216fc37ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,12 +27,12 @@ serde = { version = "^1.0", features = ["derive"] } termcolor = "^1.1" walkdir = "^2.3" -tree-sitter = "=0.20.2" +tree-sitter = "=0.20.9" tree-sitter-java = "=0.20.0" -tree-sitter-typescript = "=0.20.0" +tree-sitter-typescript = "=0.20.1" tree-sitter-javascript = "=0.20.0" -tree-sitter-python = "=0.20.0" -tree-sitter-rust = "=0.20.0" +tree-sitter-python = "=0.20.2" +tree-sitter-rust = "=0.20.3" tree-sitter-preproc = { path = "./tree-sitter-preproc", version = "=0.20.0" } tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "=0.20.0" } tree-sitter-mozcpp = { path = "./tree-sitter-mozcpp", version = "=0.20.1" } diff --git a/src/languages/language_rust.rs b/src/languages/language_rust.rs index 235141e50..f4b8817b7 100644 --- a/src/languages/language_rust.rs +++ b/src/languages/language_rust.rs @@ -89,76 +89,76 @@ pub enum Rust { DASHGT = 82, LT = 83, GT = 84, - COLONCOLON = 85, - UNDERSCORE = 86, - AMP = 87, - DOTDOTDOT = 88, - In = 89, - LT2 = 90, - Dyn = 91, - MutableSpecifier = 92, - DOTDOT = 93, - DOTDOTEQ = 94, - DASH = 95, - AMPAMP = 96, - PIPEPIPE = 97, - PIPE = 98, - CARET = 99, - EQEQ = 100, - BANGEQ = 101, - LTEQ = 102, - GTEQ = 103, - LTLT = 104, - GTGT = 105, - SLASH = 106, - PERCENT = 107, - PLUSEQ = 108, - DASHEQ = 109, - STAREQ = 110, - SLASHEQ = 111, - PERCENTEQ = 112, - AMPEQ = 113, - PIPEEQ = 114, - CARETEQ = 115, - LTLTEQ = 116, - GTGTEQ = 117, - Else = 118, - Move = 119, - DOT = 120, - AT = 121, - IntegerLiteral = 122, - DQUOTE = 123, - DQUOTE2 = 124, - CharLiteral = 125, - EscapeSequence = 126, - True = 127, - False = 128, - LineComment = 129, - Zelf = 130, - Super = 131, - Crate = 132, - Metavariable = 133, - StringContent = 134, - RawStringLiteral = 135, - FloatLiteral = 136, - BlockComment = 137, - SourceFile = 138, - Statement = 139, - EmptyStatement = 140, - ExpressionStatement = 141, - MacroDefinition = 142, - MacroRule = 143, - TokenPattern = 144, - TokenTreePattern = 145, - TokenBindingPattern = 146, - TokenRepetitionPattern = 147, - FragmentSpecifier = 148, - TokenTree = 149, - TokenRepetition = 150, - AttributeItem = 151, - InnerAttributeItem = 152, - MetaItem = 153, - MetaArguments = 154, + Else = 85, + COLONCOLON = 86, + UNDERSCORE = 87, + AMP = 88, + DOTDOTDOT = 89, + In = 90, + LT2 = 91, + Dyn = 92, + MutableSpecifier = 93, + DOTDOT = 94, + DOTDOTEQ = 95, + DASH = 96, + AMPAMP = 97, + PIPEPIPE = 98, + PIPE = 99, + CARET = 100, + EQEQ = 101, + BANGEQ = 102, + LTEQ = 103, + GTEQ = 104, + LTLT = 105, + GTGT = 106, + SLASH = 107, + PERCENT = 108, + PLUSEQ = 109, + DASHEQ = 110, + STAREQ = 111, + SLASHEQ = 112, + PERCENTEQ = 113, + AMPEQ = 114, + PIPEEQ = 115, + CARETEQ = 116, + LTLTEQ = 117, + GTGTEQ = 118, + Yield = 119, + Move = 120, + DOT = 121, + AT = 122, + IntegerLiteral = 123, + DQUOTE = 124, + DQUOTE2 = 125, + CharLiteral = 126, + EscapeSequence = 127, + True = 128, + False = 129, + LineComment = 130, + Zelf = 131, + Super = 132, + Crate = 133, + Metavariable = 134, + StringContent = 135, + RawStringLiteral = 136, + FloatLiteral = 137, + BlockComment = 138, + SourceFile = 139, + Statement = 140, + EmptyStatement = 141, + ExpressionStatement = 142, + MacroDefinition = 143, + MacroRule = 144, + TokenPattern = 145, + TokenTreePattern = 146, + TokenBindingPattern = 147, + TokenRepetitionPattern = 148, + FragmentSpecifier = 149, + TokenTree = 150, + TokenRepetition = 151, + AttributeItem = 152, + InnerAttributeItem = 153, + Attribute = 154, ModItem = 155, ForeignModItem = 156, DeclarationList = 157, @@ -222,105 +222,112 @@ pub enum Rust { EmptyType = 215, AbstractType = 216, DynamicType = 217, - Expression = 218, - MacroInvocation = 219, - ScopedIdentifier = 220, - ScopedTypeIdentifier = 221, - ScopedTypeIdentifier2 = 222, - RangeExpression = 223, - UnaryExpression = 224, - TryExpression = 225, - ReferenceExpression = 226, - BinaryExpression = 227, - AssignmentExpression = 228, - CompoundAssignmentExpr = 229, - TypeCastExpression = 230, - ReturnExpression = 231, - CallExpression = 232, - Arguments = 233, - ArrayExpression = 234, - ParenthesizedExpression = 235, - TupleExpression = 236, - UnitExpression = 237, - StructExpression = 238, - FieldInitializerList = 239, - ShorthandFieldInitializer = 240, - FieldInitializer = 241, - BaseFieldInitializer = 242, - IfExpression = 243, - IfLetExpression = 244, - ElseClause = 245, - MatchExpression = 246, - MatchBlock = 247, - MatchArm = 248, - MatchArm2 = 249, - MatchPattern = 250, - WhileExpression = 251, - WhileLetExpression = 252, - LoopExpression = 253, - ForExpression = 254, - ConstBlock = 255, - ClosureExpression = 256, - ClosureParameters = 257, - LoopLabel = 258, - BreakExpression = 259, - ContinueExpression = 260, - IndexExpression = 261, - AwaitExpression = 262, - FieldExpression = 263, - UnsafeBlock = 264, - AsyncBlock = 265, - Block = 266, - Pattern = 267, - TuplePattern = 268, - SlicePattern = 269, - TupleStructPattern = 270, - StructPattern = 271, - FieldPattern = 272, - RemainingFieldPattern = 273, - MutPattern = 274, - RangePattern = 275, - RefPattern = 276, - CapturedPattern = 277, - ReferencePattern = 278, - OrPattern = 279, - Literal2 = 280, - LiteralPattern = 281, - NegativeLiteral = 282, - StringLiteral = 283, - BooleanLiteral = 284, - SourceFileRepeat1 = 285, - MacroDefinitionRepeat1 = 286, - TokenTreePatternRepeat1 = 287, - TokenTreeRepeat1 = 288, - MetaArgumentsRepeat1 = 289, - DeclarationListRepeat1 = 290, - EnumVariantListRepeat1 = 291, - EnumVariantListRepeat2 = 292, - FieldDeclarationListRepeat1 = 293, - OrderedFieldDeclarationListRepeat1 = 294, - FunctionModifiersRepeat1 = 295, - WhereClauseRepeat1 = 296, - TraitBoundsRepeat1 = 297, - TypeParametersRepeat1 = 298, - UseListRepeat1 = 299, - ParametersRepeat1 = 300, - ForLifetimesRepeat1 = 301, - TupleTypeRepeat1 = 302, - TypeArgumentsRepeat1 = 303, - ArgumentsRepeat1 = 304, - ArrayExpressionRepeat1 = 305, - TupleExpressionRepeat1 = 306, - FieldInitializerListRepeat1 = 307, - MatchBlockRepeat1 = 308, - ClosureParametersRepeat1 = 309, - TuplePatternRepeat1 = 310, - StructPatternRepeat1 = 311, - StringLiteralRepeat1 = 312, - FieldIdentifier = 313, - ShorthandFieldIdentifier = 314, - TypeIdentifier = 315, - Error = 316, + ExpressionExceptRange = 218, + Expression = 219, + MacroInvocation = 220, + TokenTree2 = 221, + DelimTokens = 222, + NonDelimToken = 223, + ScopedIdentifier = 224, + ScopedTypeIdentifier = 225, + ScopedTypeIdentifier2 = 226, + RangeExpression = 227, + UnaryExpression = 228, + TryExpression = 229, + ReferenceExpression = 230, + BinaryExpression = 231, + AssignmentExpression = 232, + CompoundAssignmentExpr = 233, + TypeCastExpression = 234, + ReturnExpression = 235, + YieldExpression = 236, + CallExpression = 237, + Arguments = 238, + ArrayExpression = 239, + ParenthesizedExpression = 240, + TupleExpression = 241, + UnitExpression = 242, + StructExpression = 243, + FieldInitializerList = 244, + ShorthandFieldInitializer = 245, + FieldInitializer = 246, + BaseFieldInitializer = 247, + IfExpression = 248, + LetCondition = 249, + LetChain2 = 250, + Condition = 251, + ElseClause = 252, + MatchExpression = 253, + MatchBlock = 254, + MatchArm = 255, + MatchArm2 = 256, + MatchPattern = 257, + WhileExpression = 258, + LoopExpression = 259, + ForExpression = 260, + ConstBlock = 261, + ClosureExpression = 262, + ClosureParameters = 263, + LoopLabel = 264, + BreakExpression = 265, + ContinueExpression = 266, + IndexExpression = 267, + AwaitExpression = 268, + FieldExpression = 269, + UnsafeBlock = 270, + AsyncBlock = 271, + Block = 272, + Pattern = 273, + TuplePattern = 274, + SlicePattern = 275, + TupleStructPattern = 276, + StructPattern = 277, + FieldPattern = 278, + RemainingFieldPattern = 279, + MutPattern = 280, + RangePattern = 281, + RefPattern = 282, + CapturedPattern = 283, + ReferencePattern = 284, + OrPattern = 285, + Literal2 = 286, + LiteralPattern = 287, + NegativeLiteral = 288, + StringLiteral = 289, + BooleanLiteral = 290, + SourceFileRepeat1 = 291, + MacroDefinitionRepeat1 = 292, + TokenTreePatternRepeat1 = 293, + TokenTreeRepeat1 = 294, + DeclarationListRepeat1 = 295, + EnumVariantListRepeat1 = 296, + EnumVariantListRepeat2 = 297, + FieldDeclarationListRepeat1 = 298, + OrderedFieldDeclarationListRepeat1 = 299, + FunctionModifiersRepeat1 = 300, + WhereClauseRepeat1 = 301, + TraitBoundsRepeat1 = 302, + TypeParametersRepeat1 = 303, + UseListRepeat1 = 304, + ParametersRepeat1 = 305, + ForLifetimesRepeat1 = 306, + TupleTypeRepeat1 = 307, + TypeArgumentsRepeat1 = 308, + DelimTokenTreeRepeat1 = 309, + ArgumentsRepeat1 = 310, + ArrayExpressionRepeat1 = 311, + TupleExpressionRepeat1 = 312, + FieldInitializerListRepeat1 = 313, + MatchBlockRepeat1 = 314, + ClosureParametersRepeat1 = 315, + TuplePatternRepeat1 = 316, + StructPatternRepeat1 = 317, + StringLiteralRepeat1 = 318, + FieldIdentifier = 319, + LetChain = 320, + ShorthandFieldIdentifier = 321, + TypeIdentifier = 322, + Error = 323, } impl From for &'static str { @@ -412,6 +419,7 @@ impl From for &'static str { Rust::DASHGT => "->", Rust::LT => "<", Rust::GT => ">", + Rust::Else => "else", Rust::COLONCOLON => "::", Rust::UNDERSCORE => "_", Rust::AMP => "&", @@ -445,7 +453,7 @@ impl From for &'static str { Rust::CARETEQ => "^=", Rust::LTLTEQ => "<<=", Rust::GTGTEQ => ">>=", - Rust::Else => "else", + Rust::Yield => "yield", Rust::Move => "move", Rust::DOT => ".", Rust::AT => "@", @@ -468,7 +476,7 @@ impl From for &'static str { Rust::SourceFile => "source_file", Rust::Statement => "_statement", Rust::EmptyStatement => "empty_statement", - Rust::ExpressionStatement => "_expression_statement", + Rust::ExpressionStatement => "expression_statement", Rust::MacroDefinition => "macro_definition", Rust::MacroRule => "macro_rule", Rust::TokenPattern => "_token_pattern", @@ -480,8 +488,7 @@ impl From for &'static str { Rust::TokenRepetition => "token_repetition", Rust::AttributeItem => "attribute_item", Rust::InnerAttributeItem => "inner_attribute_item", - Rust::MetaItem => "meta_item", - Rust::MetaArguments => "meta_arguments", + Rust::Attribute => "attribute", Rust::ModItem => "mod_item", Rust::ForeignModItem => "foreign_mod_item", Rust::DeclarationList => "declaration_list", @@ -545,8 +552,12 @@ impl From for &'static str { Rust::EmptyType => "empty_type", Rust::AbstractType => "abstract_type", Rust::DynamicType => "dynamic_type", + Rust::ExpressionExceptRange => "_expression_except_range", Rust::Expression => "_expression", Rust::MacroInvocation => "macro_invocation", + Rust::TokenTree2 => "token_tree", + Rust::DelimTokens => "_delim_tokens", + Rust::NonDelimToken => "_non_delim_token", Rust::ScopedIdentifier => "scoped_identifier", Rust::ScopedTypeIdentifier => "scoped_type_identifier", Rust::ScopedTypeIdentifier2 => "scoped_type_identifier", @@ -559,6 +570,7 @@ impl From for &'static str { Rust::CompoundAssignmentExpr => "compound_assignment_expr", Rust::TypeCastExpression => "type_cast_expression", Rust::ReturnExpression => "return_expression", + Rust::YieldExpression => "yield_expression", Rust::CallExpression => "call_expression", Rust::Arguments => "arguments", Rust::ArrayExpression => "array_expression", @@ -571,7 +583,9 @@ impl From for &'static str { Rust::FieldInitializer => "field_initializer", Rust::BaseFieldInitializer => "base_field_initializer", Rust::IfExpression => "if_expression", - Rust::IfLetExpression => "if_let_expression", + Rust::LetCondition => "let_condition", + Rust::LetChain2 => "_let_chain", + Rust::Condition => "_condition", Rust::ElseClause => "else_clause", Rust::MatchExpression => "match_expression", Rust::MatchBlock => "match_block", @@ -579,7 +593,6 @@ impl From for &'static str { Rust::MatchArm2 => "match_arm", Rust::MatchPattern => "match_pattern", Rust::WhileExpression => "while_expression", - Rust::WhileLetExpression => "while_let_expression", Rust::LoopExpression => "loop_expression", Rust::ForExpression => "for_expression", Rust::ConstBlock => "const_block", @@ -616,7 +629,6 @@ impl From for &'static str { Rust::MacroDefinitionRepeat1 => "macro_definition_repeat1", Rust::TokenTreePatternRepeat1 => "token_tree_pattern_repeat1", Rust::TokenTreeRepeat1 => "token_tree_repeat1", - Rust::MetaArgumentsRepeat1 => "meta_arguments_repeat1", Rust::DeclarationListRepeat1 => "declaration_list_repeat1", Rust::EnumVariantListRepeat1 => "enum_variant_list_repeat1", Rust::EnumVariantListRepeat2 => "enum_variant_list_repeat2", @@ -631,6 +643,7 @@ impl From for &'static str { Rust::ForLifetimesRepeat1 => "for_lifetimes_repeat1", Rust::TupleTypeRepeat1 => "tuple_type_repeat1", Rust::TypeArgumentsRepeat1 => "type_arguments_repeat1", + Rust::DelimTokenTreeRepeat1 => "delim_token_tree_repeat1", Rust::ArgumentsRepeat1 => "arguments_repeat1", Rust::ArrayExpressionRepeat1 => "array_expression_repeat1", Rust::TupleExpressionRepeat1 => "tuple_expression_repeat1", @@ -641,6 +654,7 @@ impl From for &'static str { Rust::StructPatternRepeat1 => "struct_pattern_repeat1", Rust::StringLiteralRepeat1 => "string_literal_repeat1", Rust::FieldIdentifier => "field_identifier", + Rust::LetChain => "let_chain", Rust::ShorthandFieldIdentifier => "shorthand_field_identifier", Rust::TypeIdentifier => "type_identifier", Rust::Error => "ERROR", diff --git a/src/languages/language_tsx.rs b/src/languages/language_tsx.rs index 5ffb58c70..31dc158dc 100644 --- a/src/languages/language_tsx.rs +++ b/src/languages/language_tsx.rs @@ -78,57 +78,57 @@ pub enum Tsx { PIPEPIPEEQ = 71, QMARKQMARKEQ = 72, DOTDOTDOT = 73, - QMARK = 74, - AMPAMP = 75, - PIPEPIPE = 76, - GTGT = 77, - GTGTGT = 78, - LTLT = 79, - AMP = 80, - CARET = 81, - PIPE = 82, - PLUS = 83, - DASH = 84, - PERCENT = 85, - STARSTAR = 86, - LTEQ = 87, - EQEQ = 88, - EQEQEQ = 89, - BANGEQ = 90, - BANGEQEQ = 91, - GTEQ = 92, - QMARKQMARK = 93, - Instanceof = 94, - TILDE = 95, - Void = 96, - Delete = 97, - PLUSPLUS = 98, - DASHDASH = 99, - DQUOTE = 100, - SQUOTE = 101, - StringFragment = 102, - StringFragment2 = 103, - EscapeSequence = 104, - Comment = 105, - BQUOTE = 106, - DOLLARLBRACE = 107, - SLASH2 = 108, - RegexPattern = 109, - RegexFlags = 110, - Number = 111, - PrivatePropertyIdentifier = 112, - Target = 113, - This = 114, - Super = 115, - True = 116, - False = 117, - Null = 118, - Undefined = 119, - AT = 120, - Static = 121, - Readonly = 122, - Get = 123, - Set = 124, + AMPAMP = 74, + PIPEPIPE = 75, + GTGT = 76, + GTGTGT = 77, + LTLT = 78, + AMP = 79, + CARET = 80, + PIPE = 81, + PLUS = 82, + DASH = 83, + PERCENT = 84, + STARSTAR = 85, + LTEQ = 86, + EQEQ = 87, + EQEQEQ = 88, + BANGEQ = 89, + BANGEQEQ = 90, + GTEQ = 91, + QMARKQMARK = 92, + Instanceof = 93, + TILDE = 94, + Void = 95, + Delete = 96, + PLUSPLUS = 97, + DASHDASH = 98, + DQUOTE = 99, + SQUOTE = 100, + StringFragment = 101, + StringFragment2 = 102, + EscapeSequence = 103, + Comment = 104, + BQUOTE = 105, + DOLLARLBRACE = 106, + SLASH2 = 107, + RegexPattern = 108, + RegexFlags = 109, + Number = 110, + PrivatePropertyIdentifier = 111, + Target = 112, + This = 113, + Super = 114, + True = 115, + False = 116, + Null = 117, + Undefined = 118, + AT = 119, + Static = 120, + Readonly = 121, + Get = 122, + Set = 123, + QMARK = 124, Declare = 125, Public = 126, Private = 127, @@ -142,10 +142,10 @@ pub enum Tsx { Symbol = 135, Abstract = 136, Require = 137, - Implements = 138, - Global = 139, - Interface = 140, - Extends = 141, + Extends = 138, + Implements = 139, + Global = 140, + Interface = 141, Enum = 142, DASHQMARKCOLON = 143, QMARKCOLON = 144, @@ -160,127 +160,127 @@ pub enum Tsx { PIPERBRACE = 153, AutomaticSemicolon = 154, TemplateChars = 155, - FunctionSignatureAutomaticSemicolon = 156, - Program = 157, - ExportStatement = 158, - ExportClause = 159, - ExportSpecifier = 160, - Declaration = 161, - Import = 162, - ImportStatement = 163, - ImportClause = 164, - FromClause = 165, - NamespaceImport = 166, - NamedImports = 167, - ExpressionStatement = 168, - VariableDeclaration = 169, - LexicalDeclaration = 170, - VariableDeclarator = 171, - StatementBlock = 172, - ElseClause = 173, - IfStatement = 174, - SwitchStatement = 175, - ForStatement = 176, - ForInStatement = 177, - ForHeader = 178, - WhileStatement = 179, - DoStatement = 180, - TryStatement = 181, - WithStatement = 182, - BreakStatement = 183, - ContinueStatement = 184, - DebuggerStatement = 185, - ReturnStatement = 186, - ThrowStatement = 187, - EmptyStatement = 188, - LabeledStatement = 189, - SwitchBody = 190, - SwitchCase = 191, - SwitchDefault = 192, - CatchClause = 193, - FinallyClause = 194, - ParenthesizedExpression = 195, - Expression = 196, - PrimaryExpression = 197, - YieldExpression = 198, - Object = 199, - ObjectPattern = 200, - AssignmentPattern = 201, - ObjectAssignmentPattern = 202, - Array = 203, - ArrayPattern = 204, - JsxElement = 205, - JsxFragment = 206, - JsxExpression = 207, - JsxOpeningElement = 208, - NestedIdentifier = 209, - JsxNamespaceName = 210, - JsxClosingElement = 211, - JsxSelfClosingElement = 212, - JsxAttribute = 213, - Class = 214, - ClassDeclaration = 215, - ClassHeritage = 216, - Function = 217, - FunctionDeclaration = 218, - GeneratorFunction = 219, - GeneratorFunctionDeclaration = 220, - ArrowFunction = 221, - CallSignature2 = 222, - FormalParameter = 223, - CallExpression = 224, - NewExpression = 225, - AwaitExpression = 226, - MemberExpression = 227, - SubscriptExpression = 228, - AssignmentExpression = 229, - AugmentedAssignmentLhs = 230, - AugmentedAssignmentExpression = 231, - Initializer = 232, - DestructuringPattern = 233, - SpreadElement = 234, - TernaryExpression = 235, - BinaryExpression = 236, - UnaryExpression = 237, - UpdateExpression = 238, - SequenceExpression = 239, - String = 240, - TemplateString = 241, - TemplateSubstitution = 242, - Regex = 243, - MetaProperty = 244, - Arguments = 245, - Decorator = 246, - MemberExpression2 = 247, - CallExpression2 = 248, - ClassBody = 249, - FormalParameters = 250, - Pattern = 251, - RestPattern = 252, - MethodDefinition = 253, - Pair = 254, - PairPattern = 255, - PropertyName = 256, - ComputedPropertyName = 257, - PublicFieldDefinition = 258, - NonNullExpression = 259, - MethodSignature = 260, - AbstractMethodSignature = 261, - FunctionSignature = 262, - AsExpression = 263, - ImportRequireClause = 264, - ImplementsClause = 265, - AmbientDeclaration = 266, - AbstractClassDeclaration = 267, - Module = 268, - InternalModule = 269, - Module3 = 270, - ImportAlias = 271, - NestedTypeIdentifier = 272, - InterfaceDeclaration = 273, - ExtendsType = 274, - FunctionalExtension = 275, - ExtendsClause = 276, + QMARK2 = 156, + FunctionSignatureAutomaticSemicolon = 157, + Program = 158, + ExportStatement = 159, + ExportClause = 160, + ExportSpecifier = 161, + Declaration = 162, + Import = 163, + ImportStatement = 164, + ImportClause = 165, + FromClause = 166, + NamespaceImport = 167, + NamedImports = 168, + ExpressionStatement = 169, + VariableDeclaration = 170, + LexicalDeclaration = 171, + VariableDeclarator = 172, + StatementBlock = 173, + ElseClause = 174, + IfStatement = 175, + SwitchStatement = 176, + ForStatement = 177, + ForInStatement = 178, + ForHeader = 179, + WhileStatement = 180, + DoStatement = 181, + TryStatement = 182, + WithStatement = 183, + BreakStatement = 184, + ContinueStatement = 185, + DebuggerStatement = 186, + ReturnStatement = 187, + ThrowStatement = 188, + EmptyStatement = 189, + LabeledStatement = 190, + SwitchBody = 191, + SwitchCase = 192, + SwitchDefault = 193, + CatchClause = 194, + FinallyClause = 195, + ParenthesizedExpression = 196, + Expression = 197, + PrimaryExpression = 198, + YieldExpression = 199, + Object = 200, + ObjectPattern = 201, + AssignmentPattern = 202, + ObjectAssignmentPattern = 203, + Array = 204, + ArrayPattern = 205, + JsxElement = 206, + JsxFragment = 207, + JsxExpression = 208, + JsxOpeningElement = 209, + NestedIdentifier = 210, + JsxNamespaceName = 211, + JsxClosingElement = 212, + JsxSelfClosingElement = 213, + JsxAttribute = 214, + Class = 215, + ClassDeclaration = 216, + ClassHeritage = 217, + Function = 218, + FunctionDeclaration = 219, + GeneratorFunction = 220, + GeneratorFunctionDeclaration = 221, + ArrowFunction = 222, + CallSignature2 = 223, + FormalParameter = 224, + CallExpression = 225, + NewExpression = 226, + AwaitExpression = 227, + MemberExpression = 228, + SubscriptExpression = 229, + AssignmentExpression = 230, + AugmentedAssignmentLhs = 231, + AugmentedAssignmentExpression = 232, + Initializer = 233, + DestructuringPattern = 234, + SpreadElement = 235, + TernaryExpression = 236, + BinaryExpression = 237, + UnaryExpression = 238, + UpdateExpression = 239, + SequenceExpression = 240, + String = 241, + TemplateString = 242, + TemplateSubstitution = 243, + Regex = 244, + MetaProperty = 245, + Arguments = 246, + Decorator = 247, + MemberExpression2 = 248, + CallExpression2 = 249, + ClassBody = 250, + FormalParameters = 251, + Pattern = 252, + RestPattern = 253, + MethodDefinition = 254, + Pair = 255, + PairPattern = 256, + PropertyName = 257, + ComputedPropertyName = 258, + PublicFieldDefinition = 259, + NonNullExpression = 260, + MethodSignature = 261, + AbstractMethodSignature = 262, + FunctionSignature = 263, + AsExpression = 264, + ImportRequireClause = 265, + ExtendsClause = 266, + ImplementsClause = 267, + AmbientDeclaration = 268, + AbstractClassDeclaration = 269, + Module = 270, + InternalModule = 271, + Module3 = 272, + ImportAlias = 273, + NestedTypeIdentifier = 274, + InterfaceDeclaration = 275, + ExtendsTypeClause = 276, EnumDeclaration = 277, EnumBody = 278, EnumAssignment = 279, @@ -355,20 +355,23 @@ pub enum Tsx { ClassBodyRepeat1 = 348, FormalParametersRepeat1 = 349, JsxStartOpeningElementRepeat1 = 350, - ImplementsClauseRepeat1 = 351, - ExtendsClauseRepeat1 = 352, - EnumBodyRepeat1 = 353, - TemplateLiteralTypeRepeat1 = 354, - ObjectTypeRepeat1 = 355, - TypeParametersRepeat1 = 356, - TupleTypeRepeat1 = 357, - ImportSpecifier = 358, - PropertyIdentifier = 359, - ShorthandPropertyIdentifier = 360, - ShorthandPropertyIdentifierPattern = 361, - StatementIdentifier = 362, - TypeIdentifier = 363, - Error = 364, + ExtendsClauseRepeat1 = 351, + ImplementsClauseRepeat1 = 352, + ExtendsTypeClauseRepeat1 = 353, + EnumBodyRepeat1 = 354, + TemplateLiteralTypeRepeat1 = 355, + ObjectTypeRepeat1 = 356, + TypeParametersRepeat1 = 357, + TupleTypeRepeat1 = 358, + ImportSpecifier = 359, + NamespaceExport = 360, + PropertyIdentifier = 361, + ShorthandPropertyIdentifier = 362, + ShorthandPropertyIdentifierPattern = 363, + StatementIdentifier = 364, + ThisType = 365, + TypeIdentifier = 366, + Error = 367, } impl From for &'static str { @@ -449,7 +452,6 @@ impl From for &'static str { Tsx::PIPEPIPEEQ => "||=", Tsx::QMARKQMARKEQ => "??=", Tsx::DOTDOTDOT => "...", - Tsx::QMARK => "?", Tsx::AMPAMP => "&&", Tsx::PIPEPIPE => "||", Tsx::GTGT => ">>", @@ -500,6 +502,7 @@ impl From for &'static str { Tsx::Readonly => "readonly", Tsx::Get => "get", Tsx::Set => "set", + Tsx::QMARK => "?", Tsx::Declare => "declare", Tsx::Public => "public", Tsx::Private => "private", @@ -513,10 +516,10 @@ impl From for &'static str { Tsx::Symbol => "symbol", Tsx::Abstract => "abstract", Tsx::Require => "require", + Tsx::Extends => "extends", Tsx::Implements => "implements", Tsx::Global => "global", Tsx::Interface => "interface", - Tsx::Extends => "extends", Tsx::Enum => "enum", Tsx::DASHQMARKCOLON => "-?:", Tsx::QMARKCOLON => "?:", @@ -531,6 +534,7 @@ impl From for &'static str { Tsx::PIPERBRACE => "|}", Tsx::AutomaticSemicolon => "_automatic_semicolon", Tsx::TemplateChars => "_template_chars", + Tsx::QMARK2 => "?", Tsx::FunctionSignatureAutomaticSemicolon => "_function_signature_automatic_semicolon", Tsx::Program => "program", Tsx::ExportStatement => "export_statement", @@ -640,6 +644,7 @@ impl From for &'static str { Tsx::FunctionSignature => "function_signature", Tsx::AsExpression => "as_expression", Tsx::ImportRequireClause => "import_require_clause", + Tsx::ExtendsClause => "extends_clause", Tsx::ImplementsClause => "implements_clause", Tsx::AmbientDeclaration => "ambient_declaration", Tsx::AbstractClassDeclaration => "abstract_class_declaration", @@ -649,9 +654,7 @@ impl From for &'static str { Tsx::ImportAlias => "import_alias", Tsx::NestedTypeIdentifier => "nested_type_identifier", Tsx::InterfaceDeclaration => "interface_declaration", - Tsx::ExtendsType => "_extends_type", - Tsx::FunctionalExtension => "functional_extension", - Tsx::ExtendsClause => "extends_clause", + Tsx::ExtendsTypeClause => "extends_type_clause", Tsx::EnumDeclaration => "enum_declaration", Tsx::EnumBody => "enum_body", Tsx::EnumAssignment => "enum_assignment", @@ -726,18 +729,21 @@ impl From for &'static str { Tsx::ClassBodyRepeat1 => "class_body_repeat1", Tsx::FormalParametersRepeat1 => "formal_parameters_repeat1", Tsx::JsxStartOpeningElementRepeat1 => "_jsx_start_opening_element_repeat1", - Tsx::ImplementsClauseRepeat1 => "implements_clause_repeat1", Tsx::ExtendsClauseRepeat1 => "extends_clause_repeat1", + Tsx::ImplementsClauseRepeat1 => "implements_clause_repeat1", + Tsx::ExtendsTypeClauseRepeat1 => "extends_type_clause_repeat1", Tsx::EnumBodyRepeat1 => "enum_body_repeat1", Tsx::TemplateLiteralTypeRepeat1 => "template_literal_type_repeat1", Tsx::ObjectTypeRepeat1 => "object_type_repeat1", Tsx::TypeParametersRepeat1 => "type_parameters_repeat1", Tsx::TupleTypeRepeat1 => "tuple_type_repeat1", Tsx::ImportSpecifier => "import_specifier", + Tsx::NamespaceExport => "namespace_export", Tsx::PropertyIdentifier => "property_identifier", Tsx::ShorthandPropertyIdentifier => "shorthand_property_identifier", Tsx::ShorthandPropertyIdentifierPattern => "shorthand_property_identifier_pattern", Tsx::StatementIdentifier => "statement_identifier", + Tsx::ThisType => "this_type", Tsx::TypeIdentifier => "type_identifier", Tsx::Error => "ERROR", } diff --git a/src/languages/language_typescript.rs b/src/languages/language_typescript.rs index ad18cad5f..05c41438a 100644 --- a/src/languages/language_typescript.rs +++ b/src/languages/language_typescript.rs @@ -76,57 +76,57 @@ pub enum Typescript { PIPEPIPEEQ = 69, QMARKQMARKEQ = 70, DOTDOTDOT = 71, - QMARK = 72, - AMPAMP = 73, - PIPEPIPE = 74, - GTGT = 75, - GTGTGT = 76, - LTLT = 77, - AMP = 78, - CARET = 79, - PIPE = 80, - PLUS = 81, - DASH = 82, - PERCENT = 83, - STARSTAR = 84, - LTEQ = 85, - EQEQ = 86, - EQEQEQ = 87, - BANGEQ = 88, - BANGEQEQ = 89, - GTEQ = 90, - QMARKQMARK = 91, - Instanceof = 92, - TILDE = 93, - Void = 94, - Delete = 95, - PLUSPLUS = 96, - DASHDASH = 97, - DQUOTE = 98, - SQUOTE = 99, - StringFragment = 100, - StringFragment2 = 101, - EscapeSequence = 102, - Comment = 103, - BQUOTE = 104, - DOLLARLBRACE = 105, - SLASH2 = 106, - RegexPattern = 107, - RegexFlags = 108, - Number = 109, - PrivatePropertyIdentifier = 110, - Target = 111, - This = 112, - Super = 113, - True = 114, - False = 115, - Null = 116, - Undefined = 117, - AT = 118, - Static = 119, - Readonly = 120, - Get = 121, - Set = 122, + AMPAMP = 72, + PIPEPIPE = 73, + GTGT = 74, + GTGTGT = 75, + LTLT = 76, + AMP = 77, + CARET = 78, + PIPE = 79, + PLUS = 80, + DASH = 81, + PERCENT = 82, + STARSTAR = 83, + LTEQ = 84, + EQEQ = 85, + EQEQEQ = 86, + BANGEQ = 87, + BANGEQEQ = 88, + GTEQ = 89, + QMARKQMARK = 90, + Instanceof = 91, + TILDE = 92, + Void = 93, + Delete = 94, + PLUSPLUS = 95, + DASHDASH = 96, + DQUOTE = 97, + SQUOTE = 98, + StringFragment = 99, + StringFragment2 = 100, + EscapeSequence = 101, + Comment = 102, + BQUOTE = 103, + DOLLARLBRACE = 104, + SLASH2 = 105, + RegexPattern = 106, + RegexFlags = 107, + Number = 108, + PrivatePropertyIdentifier = 109, + Target = 110, + This = 111, + Super = 112, + True = 113, + False = 114, + Null = 115, + Undefined = 116, + AT = 117, + Static = 118, + Readonly = 119, + Get = 120, + Set = 121, + QMARK = 122, Declare = 123, Public = 124, Private = 125, @@ -140,10 +140,10 @@ pub enum Typescript { Symbol = 133, Abstract = 134, Require = 135, - Implements = 136, - Global = 137, - Interface = 138, - Extends = 139, + Extends = 136, + Implements = 137, + Global = 138, + Interface = 139, Enum = 140, DASHQMARKCOLON = 141, QMARKCOLON = 142, @@ -158,120 +158,120 @@ pub enum Typescript { PIPERBRACE = 151, AutomaticSemicolon = 152, TemplateChars = 153, - FunctionSignatureAutomaticSemicolon = 154, - Program = 155, - ExportStatement = 156, - ExportClause = 157, - ExportSpecifier = 158, - Declaration = 159, - Import = 160, - ImportStatement = 161, - ImportClause = 162, - FromClause = 163, - NamespaceImport = 164, - NamedImports = 165, - ExpressionStatement = 166, - VariableDeclaration = 167, - LexicalDeclaration = 168, - VariableDeclarator = 169, - StatementBlock = 170, - ElseClause = 171, - IfStatement = 172, - SwitchStatement = 173, - ForStatement = 174, - ForInStatement = 175, - ForHeader = 176, - WhileStatement = 177, - DoStatement = 178, - TryStatement = 179, - WithStatement = 180, - BreakStatement = 181, - ContinueStatement = 182, - DebuggerStatement = 183, - ReturnStatement = 184, - ThrowStatement = 185, - EmptyStatement = 186, - LabeledStatement = 187, - SwitchBody = 188, - SwitchCase = 189, - SwitchDefault = 190, - CatchClause = 191, - FinallyClause = 192, - ParenthesizedExpression = 193, - Expression = 194, - PrimaryExpression = 195, - YieldExpression = 196, - Object = 197, - ObjectPattern = 198, - AssignmentPattern = 199, - ObjectAssignmentPattern = 200, - Array = 201, - ArrayPattern = 202, - NestedIdentifier = 203, - Class = 204, - ClassDeclaration = 205, - ClassHeritage = 206, - Function = 207, - FunctionDeclaration = 208, - GeneratorFunction = 209, - GeneratorFunctionDeclaration = 210, - ArrowFunction = 211, - CallSignature2 = 212, - FormalParameter = 213, - CallExpression = 214, - NewExpression = 215, - AwaitExpression = 216, - MemberExpression = 217, - SubscriptExpression = 218, - AssignmentExpression = 219, - AugmentedAssignmentLhs = 220, - AugmentedAssignmentExpression = 221, - Initializer = 222, - DestructuringPattern = 223, - SpreadElement = 224, - TernaryExpression = 225, - BinaryExpression = 226, - UnaryExpression = 227, - UpdateExpression = 228, - SequenceExpression = 229, - String = 230, - TemplateString = 231, - TemplateSubstitution = 232, - Regex = 233, - MetaProperty = 234, - Arguments = 235, - Decorator = 236, - MemberExpression2 = 237, - CallExpression2 = 238, - ClassBody = 239, - FormalParameters = 240, - Pattern = 241, - RestPattern = 242, - MethodDefinition = 243, - Pair = 244, - PairPattern = 245, - PropertyName = 246, - ComputedPropertyName = 247, - PublicFieldDefinition = 248, - NonNullExpression = 249, - MethodSignature = 250, - AbstractMethodSignature = 251, - FunctionSignature = 252, - TypeAssertion = 253, - AsExpression = 254, - ImportRequireClause = 255, - ImplementsClause = 256, - AmbientDeclaration = 257, - AbstractClassDeclaration = 258, - Module = 259, - InternalModule = 260, - Module3 = 261, - ImportAlias = 262, - NestedTypeIdentifier = 263, - InterfaceDeclaration = 264, - ExtendsType = 265, - FunctionalExtension = 266, - ExtendsClause = 267, + QMARK2 = 154, + FunctionSignatureAutomaticSemicolon = 155, + Program = 156, + ExportStatement = 157, + ExportClause = 158, + ExportSpecifier = 159, + Declaration = 160, + Import = 161, + ImportStatement = 162, + ImportClause = 163, + FromClause = 164, + NamespaceImport = 165, + NamedImports = 166, + ExpressionStatement = 167, + VariableDeclaration = 168, + LexicalDeclaration = 169, + VariableDeclarator = 170, + StatementBlock = 171, + ElseClause = 172, + IfStatement = 173, + SwitchStatement = 174, + ForStatement = 175, + ForInStatement = 176, + ForHeader = 177, + WhileStatement = 178, + DoStatement = 179, + TryStatement = 180, + WithStatement = 181, + BreakStatement = 182, + ContinueStatement = 183, + DebuggerStatement = 184, + ReturnStatement = 185, + ThrowStatement = 186, + EmptyStatement = 187, + LabeledStatement = 188, + SwitchBody = 189, + SwitchCase = 190, + SwitchDefault = 191, + CatchClause = 192, + FinallyClause = 193, + ParenthesizedExpression = 194, + Expression = 195, + PrimaryExpression = 196, + YieldExpression = 197, + Object = 198, + ObjectPattern = 199, + AssignmentPattern = 200, + ObjectAssignmentPattern = 201, + Array = 202, + ArrayPattern = 203, + NestedIdentifier = 204, + Class = 205, + ClassDeclaration = 206, + ClassHeritage = 207, + Function = 208, + FunctionDeclaration = 209, + GeneratorFunction = 210, + GeneratorFunctionDeclaration = 211, + ArrowFunction = 212, + CallSignature2 = 213, + FormalParameter = 214, + CallExpression = 215, + NewExpression = 216, + AwaitExpression = 217, + MemberExpression = 218, + SubscriptExpression = 219, + AssignmentExpression = 220, + AugmentedAssignmentLhs = 221, + AugmentedAssignmentExpression = 222, + Initializer = 223, + DestructuringPattern = 224, + SpreadElement = 225, + TernaryExpression = 226, + BinaryExpression = 227, + UnaryExpression = 228, + UpdateExpression = 229, + SequenceExpression = 230, + String = 231, + TemplateString = 232, + TemplateSubstitution = 233, + Regex = 234, + MetaProperty = 235, + Arguments = 236, + Decorator = 237, + MemberExpression2 = 238, + CallExpression2 = 239, + ClassBody = 240, + FormalParameters = 241, + Pattern = 242, + RestPattern = 243, + MethodDefinition = 244, + Pair = 245, + PairPattern = 246, + PropertyName = 247, + ComputedPropertyName = 248, + PublicFieldDefinition = 249, + NonNullExpression = 250, + MethodSignature = 251, + AbstractMethodSignature = 252, + FunctionSignature = 253, + TypeAssertion = 254, + AsExpression = 255, + ImportRequireClause = 256, + ExtendsClause = 257, + ImplementsClause = 258, + AmbientDeclaration = 259, + AbstractClassDeclaration = 260, + Module = 261, + InternalModule = 262, + Module3 = 263, + ImportAlias = 264, + NestedTypeIdentifier = 265, + InterfaceDeclaration = 266, + ExtendsTypeClause = 267, EnumDeclaration = 268, EnumBody = 269, EnumAssignment = 270, @@ -344,20 +344,23 @@ pub enum Typescript { TemplateStringRepeat1 = 337, ClassBodyRepeat1 = 338, FormalParametersRepeat1 = 339, - ImplementsClauseRepeat1 = 340, - ExtendsClauseRepeat1 = 341, - EnumBodyRepeat1 = 342, - TemplateLiteralTypeRepeat1 = 343, - ObjectTypeRepeat1 = 344, - TypeParametersRepeat1 = 345, - TupleTypeRepeat1 = 346, - ImportSpecifier = 347, - PropertyIdentifier = 348, - ShorthandPropertyIdentifier = 349, - ShorthandPropertyIdentifierPattern = 350, - StatementIdentifier = 351, - TypeIdentifier = 352, - Error = 353, + ExtendsClauseRepeat1 = 340, + ImplementsClauseRepeat1 = 341, + ExtendsTypeClauseRepeat1 = 342, + EnumBodyRepeat1 = 343, + TemplateLiteralTypeRepeat1 = 344, + ObjectTypeRepeat1 = 345, + TypeParametersRepeat1 = 346, + TupleTypeRepeat1 = 347, + ImportSpecifier = 348, + NamespaceExport = 349, + PropertyIdentifier = 350, + ShorthandPropertyIdentifier = 351, + ShorthandPropertyIdentifierPattern = 352, + StatementIdentifier = 353, + ThisType = 354, + TypeIdentifier = 355, + Error = 356, } impl From for &'static str { @@ -436,7 +439,6 @@ impl From for &'static str { Typescript::PIPEPIPEEQ => "||=", Typescript::QMARKQMARKEQ => "??=", Typescript::DOTDOTDOT => "...", - Typescript::QMARK => "?", Typescript::AMPAMP => "&&", Typescript::PIPEPIPE => "||", Typescript::GTGT => ">>", @@ -487,6 +489,7 @@ impl From for &'static str { Typescript::Readonly => "readonly", Typescript::Get => "get", Typescript::Set => "set", + Typescript::QMARK => "?", Typescript::Declare => "declare", Typescript::Public => "public", Typescript::Private => "private", @@ -500,10 +503,10 @@ impl From for &'static str { Typescript::Symbol => "symbol", Typescript::Abstract => "abstract", Typescript::Require => "require", + Typescript::Extends => "extends", Typescript::Implements => "implements", Typescript::Global => "global", Typescript::Interface => "interface", - Typescript::Extends => "extends", Typescript::Enum => "enum", Typescript::DASHQMARKCOLON => "-?:", Typescript::QMARKCOLON => "?:", @@ -518,6 +521,7 @@ impl From for &'static str { Typescript::PIPERBRACE => "|}", Typescript::AutomaticSemicolon => "_automatic_semicolon", Typescript::TemplateChars => "_template_chars", + Typescript::QMARK2 => "?", Typescript::FunctionSignatureAutomaticSemicolon => { "_function_signature_automatic_semicolon" } @@ -622,6 +626,7 @@ impl From for &'static str { Typescript::TypeAssertion => "type_assertion", Typescript::AsExpression => "as_expression", Typescript::ImportRequireClause => "import_require_clause", + Typescript::ExtendsClause => "extends_clause", Typescript::ImplementsClause => "implements_clause", Typescript::AmbientDeclaration => "ambient_declaration", Typescript::AbstractClassDeclaration => "abstract_class_declaration", @@ -631,9 +636,7 @@ impl From for &'static str { Typescript::ImportAlias => "import_alias", Typescript::NestedTypeIdentifier => "nested_type_identifier", Typescript::InterfaceDeclaration => "interface_declaration", - Typescript::ExtendsType => "_extends_type", - Typescript::FunctionalExtension => "functional_extension", - Typescript::ExtendsClause => "extends_clause", + Typescript::ExtendsTypeClause => "extends_type_clause", Typescript::EnumDeclaration => "enum_declaration", Typescript::EnumBody => "enum_body", Typescript::EnumAssignment => "enum_assignment", @@ -706,20 +709,23 @@ impl From for &'static str { Typescript::TemplateStringRepeat1 => "template_string_repeat1", Typescript::ClassBodyRepeat1 => "class_body_repeat1", Typescript::FormalParametersRepeat1 => "formal_parameters_repeat1", - Typescript::ImplementsClauseRepeat1 => "implements_clause_repeat1", Typescript::ExtendsClauseRepeat1 => "extends_clause_repeat1", + Typescript::ImplementsClauseRepeat1 => "implements_clause_repeat1", + Typescript::ExtendsTypeClauseRepeat1 => "extends_type_clause_repeat1", Typescript::EnumBodyRepeat1 => "enum_body_repeat1", Typescript::TemplateLiteralTypeRepeat1 => "template_literal_type_repeat1", Typescript::ObjectTypeRepeat1 => "object_type_repeat1", Typescript::TypeParametersRepeat1 => "type_parameters_repeat1", Typescript::TupleTypeRepeat1 => "tuple_type_repeat1", Typescript::ImportSpecifier => "import_specifier", + Typescript::NamespaceExport => "namespace_export", Typescript::PropertyIdentifier => "property_identifier", Typescript::ShorthandPropertyIdentifier => "shorthand_property_identifier", Typescript::ShorthandPropertyIdentifierPattern => { "shorthand_property_identifier_pattern" } Typescript::StatementIdentifier => "statement_identifier", + Typescript::ThisType => "this_type", Typescript::TypeIdentifier => "type_identifier", Typescript::Error => "ERROR", } From 4330f10167ff0d63ab5a8169e137ab6be0fdbcb5 Mon Sep 17 00:00:00 2001 From: Luni-4 Date: Fri, 23 Dec 2022 11:15:03 +0100 Subject: [PATCH 3/4] rust: Fix tests with the new grammar --- src/metrics/cognitive.rs | 2 +- src/metrics/loc.rs | 38 ++++---------------------------------- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/src/metrics/cognitive.rs b/src/metrics/cognitive.rs index cbb65a2d6..d15feca1e 100644 --- a/src/metrics/cognitive.rs +++ b/src/metrics/cognitive.rs @@ -308,7 +308,7 @@ impl Cognitive for RustCode { let (mut nesting, mut depth, mut lambda) = get_nesting_from_map(node, nesting_map); match node.object().kind_id().into() { - IfExpression | IfLetExpression => { + IfExpression => { // Check if a node is not an else-if if !Self::is_else_if(node) { increase_nesting(stats,&mut nesting, depth, lambda); diff --git a/src/metrics/loc.rs b/src/metrics/loc.rs index 960259700..b95119dd1 100644 --- a/src/metrics/loc.rs +++ b/src/metrics/loc.rs @@ -733,39 +733,9 @@ impl Loc for RustCode { | ExpressionStatement | LetDeclaration | AssignmentExpression - | CompoundAssignmentExpr - | ReturnExpression - | IfExpression - | IfLetExpression - | WhileExpression - | WhileLetExpression - | LoopExpression - | ForExpression - | BreakExpression - | ContinueExpression - | AwaitExpression => { + | CompoundAssignmentExpr => { stats.lloc.logical_lines += 1; } - CallExpression | MacroInvocation | ClosureExpression => { - if count_specific_ancestors!( - node, - CallExpression - | MacroInvocation - | ClosureExpression - | LetDeclaration - | WhileExpression - | WhileLetExpression - | ForExpression - | IfExpression - | IfLetExpression - | ReturnExpression - | AwaitExpression, - Block - ) == 0 - { - stats.lloc.logical_lines += 1; - } - } _ => { check_comment_ends_on_code_line(stats, start); stats.ploc.lines.insert(start); @@ -1612,12 +1582,12 @@ mod tests { field: usize, } let foo = Foo { 42 }; - foo.field", + foo.field;", "foo.rs", RustParser, loc, - [(lloc, 1, usize), (lloc_min, 1, usize), (lloc_max, 1, usize)], - [(lloc_average, 1.0)] // The number of spaces is 1 + [(lloc, 2, usize), (lloc_min, 2, usize), (lloc_max, 2, usize)], + [(lloc_average, 2.0)] // The number of spaces is 1 ); } From ea5abdaee17b2cee479e229e756358a568bc4211 Mon Sep 17 00:00:00 2001 From: Luni-4 Date: Fri, 23 Dec 2022 11:20:15 +0100 Subject: [PATCH 4/4] Update submodule --- tests/repositories/rca-output | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/repositories/rca-output b/tests/repositories/rca-output index dc717ba0a..0977615a6 160000 --- a/tests/repositories/rca-output +++ b/tests/repositories/rca-output @@ -1 +1 @@ -Subproject commit dc717ba0a38be492b7d56335d3ed1a1b59d08f7b +Subproject commit 0977615a6617737229db2d0a63a927bc87ad4f36