diff --git a/Cargo.toml b/Cargo.toml index 9fe16ed..08d765d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,17 +24,17 @@ serde = { version = "^1.0", features = ["derive"] } termcolor = "^1.2" walkdir = "^2.3" -tree-sitter = "=0.20.9" -tree-sitter-java = "=0.20.0" -tree-sitter-kotlin = "0.2.11" -tree-sitter-typescript = "=0.20.1" -tree-sitter-javascript = "=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.1" } -tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "=0.20.1" } -tree-sitter-mozcpp = { path = "./tree-sitter-mozcpp", version = "=0.20.2" } -tree-sitter-mozjs = { path = "./tree-sitter-mozjs", version = "=0.20.1" } +tree-sitter = "=0.22.6" +tree-sitter-java = "=0.21.0" +tree-sitter-kotlin = "0.3.6" +tree-sitter-typescript = "=0.21.2" +tree-sitter-javascript = "=0.21.4" +tree-sitter-python = "=0.21.0" +tree-sitter-rust = "=0.21.2" +tree-sitter-preproc = { path = "./tree-sitter-preproc", version = "=0.20.2" } +tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "=0.20.2" } +tree-sitter-mozcpp = { path = "./tree-sitter-mozcpp", version = "=0.20.3" } +tree-sitter-mozjs = { path = "./tree-sitter-mozjs", version = "=0.20.2" } [dev-dependencies] insta = { version = "1.29.0", features = ["yaml", "json", "redactions"] } diff --git a/enums/Cargo.toml b/enums/Cargo.toml index 3714eea..a917c5c 100644 --- a/enums/Cargo.toml +++ b/enums/Cargo.toml @@ -8,17 +8,17 @@ edition = "2021" clap = { version = "^4.0", features = ["derive"] } askama = "^0.12" -tree-sitter = "0.20.9" -tree-sitter-java = "=0.20.0" -tree-sitter-kotlin = "0.2.11" -tree-sitter-typescript = "=0.20.1" -tree-sitter-javascript = "=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.1" } -tree-sitter-ccomment = { path = "../tree-sitter-ccomment", version = "=0.20.1" } -tree-sitter-mozcpp = { path = "../tree-sitter-mozcpp", version = "=0.20.2" } -tree-sitter-mozjs = { path = "../tree-sitter-mozjs", version = "=0.20.1" } +tree-sitter = "=0.22.6" +tree-sitter-java = "=0.21.0" +tree-sitter-kotlin = "0.3.6" +tree-sitter-typescript = "=0.21.2" +tree-sitter-javascript = "=0.21.4" +tree-sitter-python = "=0.21.0" +tree-sitter-rust = "=0.21.2" +tree-sitter-preproc = { path = "../tree-sitter-preproc", version = "=0.20.2" } +tree-sitter-ccomment = { path = "../tree-sitter-ccomment", version = "=0.20.2" } +tree-sitter-mozcpp = { path = "../tree-sitter-mozcpp", version = "=0.20.3" } +tree-sitter-mozjs = { path = "../tree-sitter-mozjs", version = "=0.20.2" } [profile.release] strip = "debuginfo" diff --git a/src/getter.rs b/src/getter.rs index 9034723..95ffb49 100644 --- a/src/getter.rs +++ b/src/getter.rs @@ -216,7 +216,7 @@ impl Getter for JavascriptCode { | GT | PLUSEQ | BANG | BANGEQEQ | EQEQEQ | DASHEQ | STAREQ | SLASHEQ | PERCENTEQ | STARSTAREQ | GTGTEQ | GTGTGTEQ | LTLTEQ | AMPEQ | CARET | CARETEQ | PIPEEQ | Yield | LBRACK | LBRACE | Await | QMARK | QMARKQMARK | New | Let | Var | Const - | Function | Function2 | SEMI => HalsteadType::Operator, + | Function | SEMI => HalsteadType::Operator, Identifier | Identifier2 | MemberExpression | PropertyIdentifier | String | Number | True | False | Null | Void | This | Super | Undefined | Set | Get | Typeof | Instanceof => HalsteadType::Operand, @@ -285,7 +285,7 @@ impl Getter for TypescriptCode { | GT | PLUSEQ | BANG | BANGEQEQ | EQEQEQ | DASHEQ | STAREQ | SLASHEQ | PERCENTEQ | STARSTAREQ | GTGTEQ | GTGTGTEQ | LTLTEQ | AMPEQ | CARET | CARETEQ | PIPEEQ | Yield | LBRACK | LBRACE | Await | QMARK | QMARKQMARK | New | Let | Var | Const - | Function | Function2 | SEMI => HalsteadType::Operator, + | Function | SEMI => HalsteadType::Operator, Identifier | NestedIdentifier | MemberExpression | PropertyIdentifier | String | Number | True | False | Null | Void | This | Super | Undefined | Set | Get | Typeof | Instanceof => HalsteadType::Operand, @@ -354,7 +354,7 @@ impl Getter for TsxCode { | GT | PLUSEQ | BANG | BANGEQEQ | EQEQEQ | DASHEQ | STAREQ | SLASHEQ | PERCENTEQ | STARSTAREQ | GTGTEQ | GTGTGTEQ | LTLTEQ | AMPEQ | CARET | CARETEQ | PIPEEQ | Yield | LBRACK | LBRACE | Await | QMARK | QMARKQMARK | New | Let | Var | Const - | Function | Function2 | SEMI => HalsteadType::Operator, + | Function | SEMI => HalsteadType::Operator, Identifier | NestedIdentifier | MemberExpression | PropertyIdentifier | String | Number | True | False | Null | Void | This | Super | Undefined | Set | Get | Typeof | Instanceof => HalsteadType::Operand, diff --git a/src/languages/language_java.rs b/src/languages/language_java.rs index 31285b5..ac526e5 100644 --- a/src/languages/language_java.rs +++ b/src/languages/language_java.rs @@ -15,289 +15,317 @@ pub enum Java { True = 8, False = 9, CharacterLiteral = 10, - StringLiteral = 11, - TextBlock = 12, - NullLiteral = 13, - LPAREN = 14, - AMP = 15, - RPAREN = 16, - EQ = 17, - PLUSEQ = 18, - DASHEQ = 19, - STAREQ = 20, - SLASHEQ = 21, - AMPEQ = 22, - PIPEEQ = 23, - CARETEQ = 24, - PERCENTEQ = 25, - LTLTEQ = 26, - GTGTEQ = 27, - GTGTGTEQ = 28, - GT = 29, - LT = 30, - GTEQ = 31, - LTEQ = 32, - EQEQ = 33, - BANGEQ = 34, - AMPAMP = 35, - PIPEPIPE = 36, - PLUS = 37, - DASH = 38, - STAR = 39, - SLASH = 40, - PIPE = 41, - CARET = 42, - PERCENT = 43, - LTLT = 44, - GTGT = 45, - GTGTGT = 46, - Instanceof = 47, - Final = 48, - DASHGT = 49, - COMMA = 50, - QMARK = 51, - COLON = 52, - BANG = 53, - TILDE = 54, - PLUSPLUS = 55, - DASHDASH = 56, - New = 57, - LBRACK = 58, - RBRACK = 59, - DOT = 60, - Class = 61, - COLONCOLON = 62, - Extends = 63, - Switch = 64, - LBRACE = 65, - RBRACE = 66, - Case = 67, - Default = 68, - SEMI = 69, - Assert = 70, - Do = 71, - While = 72, - Break = 73, - Continue = 74, - Return = 75, - Yield = 76, - Synchronized = 77, - Throw = 78, - Try = 79, - Catch = 80, - Finally = 81, - If = 82, - Else = 83, - For = 84, - AT = 85, - Open = 86, - Module = 87, - Requires = 88, - Transitive = 89, - Static = 90, - Exports = 91, - To = 92, - Opens = 93, - Uses = 94, - Provides = 95, - With = 96, - Package = 97, - Import = 98, - Enum = 99, - Public = 100, - Protected = 101, - Private = 102, - Abstract = 103, - Strictfp = 104, - Native = 105, - Transient = 106, - Volatile = 107, - Sealed = 108, - NonDASHsealed = 109, - Implements = 110, - Permits2 = 111, - Record = 112, - ATinterface = 113, - Interface = 114, - Byte = 115, - Short = 116, - Int = 117, - Long = 118, - Char = 119, - Float = 120, - Double = 121, - BooleanType = 122, - VoidType = 123, - DOTDOTDOT = 124, - Throws2 = 125, - This = 126, - Super = 127, - LineComment = 128, - BlockComment = 129, - Program = 130, - Literal = 131, - Expression = 132, - CastExpression = 133, - AssignmentExpression = 134, - BinaryExpression = 135, - InstanceofExpression = 136, - LambdaExpression = 137, - InferredParameters = 138, - TernaryExpression = 139, - UnaryExpression = 140, - UpdateExpression = 141, - PrimaryExpression = 142, - ArrayCreationExpression = 143, - DimensionsExpr = 144, - ParenthesizedExpression = 145, - ClassLiteral = 146, - ObjectCreationExpression = 147, - UnqualifiedObjectCreationExpression = 148, - FieldAccess = 149, - ArrayAccess = 150, - MethodInvocation = 151, - ArgumentList = 152, - MethodReference = 153, - TypeArguments = 154, - Wildcard = 155, - WildcardBounds = 156, - Dimensions = 157, - SwitchExpression = 158, - SwitchBlock = 159, - SwitchBlockStatementGroup = 160, - SwitchRule = 161, - SwitchLabel = 162, - Statement = 163, - Block = 164, - ExpressionStatement = 165, - LabeledStatement = 166, - AssertStatement = 167, - DoStatement = 168, - BreakStatement = 169, - ContinueStatement = 170, - ReturnStatement = 171, - YieldStatement = 172, - SynchronizedStatement = 173, - ThrowStatement = 174, - TryStatement = 175, - CatchClause = 176, - CatchFormalParameter = 177, - CatchType = 178, - FinallyClause = 179, - TryWithResourcesStatement = 180, - ResourceSpecification = 181, - Resource = 182, - IfStatement = 183, - WhileStatement = 184, - ForStatement = 185, - EnhancedForStatement = 186, - Annotation2 = 187, - MarkerAnnotation = 188, - Annotation = 189, - AnnotationArgumentList = 190, - ElementValuePair = 191, - ElementValue = 192, - ElementValueArrayInitializer = 193, - Declaration = 194, - ModuleDeclaration = 195, - ModuleBody = 196, - ModuleDirective = 197, - RequiresModuleDirective = 198, - RequiresModifier = 199, - ExportsModuleDirective = 200, - OpensModuleDirective = 201, - UsesModuleDirective = 202, - ProvidesModuleDirective = 203, - PackageDeclaration = 204, - ImportDeclaration = 205, - Asterisk = 206, - EnumDeclaration = 207, - EnumBody = 208, - EnumBodyDeclarations = 209, - EnumConstant = 210, - ClassDeclaration = 211, - Modifiers = 212, - TypeParameters = 213, - TypeParameter = 214, - TypeBound = 215, - Superclass = 216, - SuperInterfaces = 217, - TypeList = 218, - Permits = 219, - ClassBody = 220, - StaticInitializer = 221, - ConstructorDeclaration = 222, - ConstructorDeclarator = 223, - ConstructorBody = 224, - ExplicitConstructorInvocation = 225, - ScopedIdentifier = 226, - FieldDeclaration = 227, - RecordDeclaration = 228, - AnnotationTypeDeclaration = 229, - AnnotationTypeBody = 230, - AnnotationTypeElementDeclaration = 231, - DefaultValue = 232, - InterfaceDeclaration = 233, - ExtendsInterfaces = 234, - InterfaceBody = 235, - ConstantDeclaration = 236, - VariableDeclaratorList = 237, - VariableDeclarator = 238, - VariableDeclaratorId = 239, - ArrayInitializer = 240, - Type = 241, - UnannotatedType = 242, - AnnotatedType = 243, - ScopedTypeIdentifier = 244, - GenericType = 245, - ArrayType = 246, - IntegralType = 247, - FloatingPointType = 248, - MethodHeader = 249, - MethodDeclarator = 250, - FormalParameters = 251, - FormalParameter = 252, - ReceiverParameter = 253, - SpreadParameter = 254, - Throws = 255, - LocalVariableDeclaration = 256, - MethodDeclaration = 257, - CompactConstructorDeclaration = 258, - ProgramRepeat1 = 259, - CastExpressionRepeat1 = 260, - InferredParametersRepeat1 = 261, - ArrayCreationExpressionRepeat1 = 262, - ArrayCreationExpressionRepeat2 = 263, - ArgumentListRepeat1 = 264, - TypeArgumentsRepeat1 = 265, - DimensionsRepeat1 = 266, - SwitchBlockRepeat1 = 267, - SwitchBlockRepeat2 = 268, - SwitchBlockStatementGroupRepeat1 = 269, - TryStatementRepeat1 = 270, - CatchTypeRepeat1 = 271, - ResourceSpecificationRepeat1 = 272, - ForStatementRepeat1 = 273, - ForStatementRepeat2 = 274, - AnnotationArgumentListRepeat1 = 275, - ElementValueArrayInitializerRepeat1 = 276, - ModuleBodyRepeat1 = 277, - RequiresModuleDirectiveRepeat1 = 278, - ExportsModuleDirectiveRepeat1 = 279, - ProvidesModuleDirectiveRepeat1 = 280, - EnumBodyRepeat1 = 281, - EnumBodyDeclarationsRepeat1 = 282, - ModifiersRepeat1 = 283, - TypeParametersRepeat1 = 284, - TypeBoundRepeat1 = 285, - TypeListRepeat1 = 286, - AnnotationTypeBodyRepeat1 = 287, - InterfaceBodyRepeat1 = 288, - VariableDeclaratorListRepeat1 = 289, - ArrayInitializerRepeat1 = 290, - FormalParametersRepeat1 = 291, - TypeIdentifier = 292, - Error = 293, + DQUOTE = 11, + DQUOTEDQUOTEDQUOTE = 12, + StringFragment = 13, + MultilineStringFragmentToken1 = 14, + MultilineStringFragmentToken2 = 15, + BSLASHLBRACE = 16, + RBRACE = 17, + EscapeSequenceToken1 = 18, + EscapeSequence = 19, + NullLiteral = 20, + LPAREN = 21, + RPAREN = 22, + AMP = 23, + EQ = 24, + PLUSEQ = 25, + DASHEQ = 26, + STAREQ = 27, + SLASHEQ = 28, + AMPEQ = 29, + PIPEEQ = 30, + CARETEQ = 31, + PERCENTEQ = 32, + LTLTEQ = 33, + GTGTEQ = 34, + GTGTGTEQ = 35, + GT = 36, + LT = 37, + GTEQ = 38, + LTEQ = 39, + EQEQ = 40, + BANGEQ = 41, + AMPAMP = 42, + PIPEPIPE = 43, + PLUS = 44, + DASH = 45, + STAR = 46, + SLASH = 47, + PIPE = 48, + CARET = 49, + PERCENT = 50, + LTLT = 51, + GTGT = 52, + GTGTGT = 53, + Instanceof = 54, + Final = 55, + DASHGT = 56, + COMMA = 57, + QMARK = 58, + COLON = 59, + BANG = 60, + TILDE = 61, + PLUSPLUS = 62, + DASHDASH = 63, + New = 64, + LBRACK = 65, + RBRACK = 66, + DOT = 67, + Class = 68, + COLONCOLON = 69, + Extends = 70, + Switch = 71, + LBRACE = 72, + Case = 73, + Default = 74, + UnderscorePattern = 75, + When = 76, + SEMI = 77, + Assert = 78, + Do = 79, + While = 80, + Break = 81, + Continue = 82, + Return = 83, + Yield = 84, + Synchronized = 85, + Throw = 86, + Try = 87, + Catch = 88, + Finally = 89, + If = 90, + Else = 91, + For = 92, + AT = 93, + Open = 94, + Module = 95, + Requires = 96, + Transitive = 97, + Static = 98, + Exports = 99, + To = 100, + Opens = 101, + Uses = 102, + Provides = 103, + With = 104, + Package = 105, + Import = 106, + Enum = 107, + Public = 108, + Protected = 109, + Private = 110, + Abstract = 111, + Strictfp = 112, + Native = 113, + Transient = 114, + Volatile = 115, + Sealed = 116, + NonDASHsealed = 117, + Implements = 118, + Permits2 = 119, + Record = 120, + ATinterface = 121, + Interface = 122, + Byte = 123, + Short = 124, + Int = 125, + Long = 126, + Char = 127, + Float = 128, + Double = 129, + BooleanType = 130, + VoidType = 131, + DOTDOTDOT = 132, + Throws2 = 133, + This = 134, + Super = 135, + LineComment = 136, + BlockComment = 137, + Program = 138, + ToplevelStatement = 139, + Literal = 140, + StringLiteral = 141, + StringLiteral2 = 142, + MultilineStringLiteral = 143, + MultilineStringFragment = 144, + StringInterpolation = 145, + EscapeSequence2 = 146, + Expression = 147, + CastExpression = 148, + AssignmentExpression = 149, + BinaryExpression = 150, + InstanceofExpression = 151, + LambdaExpression = 152, + InferredParameters = 153, + TernaryExpression = 154, + UnaryExpression = 155, + UpdateExpression = 156, + PrimaryExpression = 157, + ArrayCreationExpression = 158, + DimensionsExpr = 159, + ParenthesizedExpression = 160, + ClassLiteral = 161, + ObjectCreationExpression = 162, + UnqualifiedObjectCreationExpression = 163, + FieldAccess = 164, + TemplateExpression = 165, + ArrayAccess = 166, + MethodInvocation = 167, + ArgumentList = 168, + MethodReference = 169, + TypeArguments = 170, + Wildcard = 171, + WildcardBounds = 172, + Dimensions = 173, + SwitchExpression = 174, + SwitchBlock = 175, + SwitchBlockStatementGroup = 176, + SwitchRule = 177, + SwitchLabel = 178, + Pattern = 179, + TypePattern = 180, + RecordPattern = 181, + RecordPatternBody = 182, + RecordPatternComponent = 183, + Guard = 184, + Statement = 185, + Block = 186, + ExpressionStatement = 187, + LabeledStatement = 188, + AssertStatement = 189, + DoStatement = 190, + BreakStatement = 191, + ContinueStatement = 192, + ReturnStatement = 193, + YieldStatement = 194, + SynchronizedStatement = 195, + ThrowStatement = 196, + TryStatement = 197, + CatchClause = 198, + CatchFormalParameter = 199, + CatchType = 200, + FinallyClause = 201, + TryWithResourcesStatement = 202, + ResourceSpecification = 203, + Resource = 204, + IfStatement = 205, + WhileStatement = 206, + ForStatement = 207, + EnhancedForStatement = 208, + Annotation2 = 209, + MarkerAnnotation = 210, + Annotation = 211, + AnnotationArgumentList = 212, + ElementValuePair = 213, + ElementValue = 214, + ElementValueArrayInitializer = 215, + Declaration = 216, + ModuleDeclaration = 217, + ModuleBody = 218, + ModuleDirective = 219, + RequiresModuleDirective = 220, + RequiresModifier = 221, + ExportsModuleDirective = 222, + OpensModuleDirective = 223, + UsesModuleDirective = 224, + ProvidesModuleDirective = 225, + PackageDeclaration = 226, + ImportDeclaration = 227, + Asterisk = 228, + EnumDeclaration = 229, + EnumBody = 230, + EnumBodyDeclarations = 231, + EnumConstant = 232, + ClassDeclaration = 233, + Modifiers = 234, + TypeParameters = 235, + TypeParameter = 236, + TypeBound = 237, + Superclass = 238, + SuperInterfaces = 239, + TypeList = 240, + Permits = 241, + ClassBody = 242, + StaticInitializer = 243, + ConstructorDeclaration = 244, + ConstructorDeclarator = 245, + ConstructorBody = 246, + ExplicitConstructorInvocation = 247, + ScopedIdentifier = 248, + FieldDeclaration = 249, + RecordDeclaration = 250, + AnnotationTypeDeclaration = 251, + AnnotationTypeBody = 252, + AnnotationTypeElementDeclaration = 253, + DefaultValue = 254, + InterfaceDeclaration = 255, + ExtendsInterfaces = 256, + InterfaceBody = 257, + ConstantDeclaration = 258, + VariableDeclaratorList = 259, + VariableDeclarator = 260, + VariableDeclaratorId = 261, + ArrayInitializer = 262, + Type = 263, + UnannotatedType = 264, + AnnotatedType = 265, + ScopedTypeIdentifier = 266, + GenericType = 267, + ArrayType = 268, + IntegralType = 269, + FloatingPointType = 270, + MethodHeader = 271, + MethodDeclarator = 272, + FormalParameters = 273, + FormalParameter = 274, + ReceiverParameter = 275, + SpreadParameter = 276, + Throws = 277, + LocalVariableDeclaration = 278, + MethodDeclaration = 279, + CompactConstructorDeclaration = 280, + ReservedIdentifier = 281, + ProgramRepeat1 = 282, + StringLiteralRepeat1 = 283, + MultilineStringLiteralRepeat1 = 284, + CastExpressionRepeat1 = 285, + InferredParametersRepeat1 = 286, + ArrayCreationExpressionRepeat1 = 287, + ArrayCreationExpressionRepeat2 = 288, + ArgumentListRepeat1 = 289, + TypeArgumentsRepeat1 = 290, + DimensionsRepeat1 = 291, + SwitchBlockRepeat1 = 292, + SwitchBlockRepeat2 = 293, + SwitchBlockStatementGroupRepeat1 = 294, + SwitchBlockStatementGroupRepeat2 = 295, + RecordPatternBodyRepeat1 = 296, + TryStatementRepeat1 = 297, + CatchTypeRepeat1 = 298, + ResourceSpecificationRepeat1 = 299, + ForStatementRepeat1 = 300, + ForStatementRepeat2 = 301, + AnnotationArgumentListRepeat1 = 302, + ElementValueArrayInitializerRepeat1 = 303, + ModuleBodyRepeat1 = 304, + RequiresModuleDirectiveRepeat1 = 305, + ExportsModuleDirectiveRepeat1 = 306, + ProvidesModuleDirectiveRepeat1 = 307, + EnumBodyRepeat1 = 308, + EnumBodyDeclarationsRepeat1 = 309, + ModifiersRepeat1 = 310, + TypeParametersRepeat1 = 311, + TypeBoundRepeat1 = 312, + TypeListRepeat1 = 313, + AnnotationTypeBodyRepeat1 = 314, + InterfaceBodyRepeat1 = 315, + VariableDeclaratorListRepeat1 = 316, + ArrayInitializerRepeat1 = 317, + FormalParametersRepeat1 = 318, + ReceiverParameterRepeat1 = 319, + TypeIdentifier = 320, + Error = 321, } impl From for &'static str { @@ -315,12 +343,19 @@ impl From for &'static str { Java::True => "true", Java::False => "false", Java::CharacterLiteral => "character_literal", - Java::StringLiteral => "string_literal", - Java::TextBlock => "text_block", + Java::DQUOTE => "\"", + Java::DQUOTEDQUOTEDQUOTE => "\"\"\"", + Java::StringFragment => "string_fragment", + Java::MultilineStringFragmentToken1 => "_multiline_string_fragment_token1", + Java::MultilineStringFragmentToken2 => "_multiline_string_fragment_token2", + Java::BSLASHLBRACE => "\\{", + Java::RBRACE => "}", + Java::EscapeSequenceToken1 => "_escape_sequence_token1", + Java::EscapeSequence => "escape_sequence", Java::NullLiteral => "null_literal", Java::LPAREN => "(", - Java::AMP => "&", Java::RPAREN => ")", + Java::AMP => "&", Java::EQ => "=", Java::PLUSEQ => "+=", Java::DASHEQ => "-=", @@ -370,9 +405,10 @@ impl From for &'static str { Java::Extends => "extends", Java::Switch => "switch", Java::LBRACE => "{", - Java::RBRACE => "}", Java::Case => "case", Java::Default => "default", + Java::UnderscorePattern => "underscore_pattern", + Java::When => "when", Java::SEMI => ";", Java::Assert => "assert", Java::Do => "do", @@ -435,7 +471,14 @@ impl From for &'static str { Java::LineComment => "line_comment", Java::BlockComment => "block_comment", Java::Program => "program", + Java::ToplevelStatement => "_toplevel_statement", Java::Literal => "_literal", + Java::StringLiteral => "string_literal", + Java::StringLiteral2 => "_string_literal", + Java::MultilineStringLiteral => "_multiline_string_literal", + Java::MultilineStringFragment => "multiline_string_fragment", + Java::StringInterpolation => "string_interpolation", + Java::EscapeSequence2 => "_escape_sequence", Java::Expression => "expression", Java::CastExpression => "cast_expression", Java::AssignmentExpression => "assignment_expression", @@ -454,6 +497,7 @@ impl From for &'static str { Java::ObjectCreationExpression => "object_creation_expression", Java::UnqualifiedObjectCreationExpression => "_unqualified_object_creation_expression", Java::FieldAccess => "field_access", + Java::TemplateExpression => "template_expression", Java::ArrayAccess => "array_access", Java::MethodInvocation => "method_invocation", Java::ArgumentList => "argument_list", @@ -467,6 +511,12 @@ impl From for &'static str { Java::SwitchBlockStatementGroup => "switch_block_statement_group", Java::SwitchRule => "switch_rule", Java::SwitchLabel => "switch_label", + Java::Pattern => "pattern", + Java::TypePattern => "type_pattern", + Java::RecordPattern => "record_pattern", + Java::RecordPatternBody => "record_pattern_body", + Java::RecordPatternComponent => "record_pattern_component", + Java::Guard => "guard", Java::Statement => "statement", Java::Block => "block", Java::ExpressionStatement => "expression_statement", @@ -563,7 +613,10 @@ impl From for &'static str { Java::LocalVariableDeclaration => "local_variable_declaration", Java::MethodDeclaration => "method_declaration", Java::CompactConstructorDeclaration => "compact_constructor_declaration", + Java::ReservedIdentifier => "_reserved_identifier", Java::ProgramRepeat1 => "program_repeat1", + Java::StringLiteralRepeat1 => "_string_literal_repeat1", + Java::MultilineStringLiteralRepeat1 => "_multiline_string_literal_repeat1", Java::CastExpressionRepeat1 => "cast_expression_repeat1", Java::InferredParametersRepeat1 => "inferred_parameters_repeat1", Java::ArrayCreationExpressionRepeat1 => "array_creation_expression_repeat1", @@ -574,6 +627,8 @@ impl From for &'static str { Java::SwitchBlockRepeat1 => "switch_block_repeat1", Java::SwitchBlockRepeat2 => "switch_block_repeat2", Java::SwitchBlockStatementGroupRepeat1 => "switch_block_statement_group_repeat1", + Java::SwitchBlockStatementGroupRepeat2 => "switch_block_statement_group_repeat2", + Java::RecordPatternBodyRepeat1 => "record_pattern_body_repeat1", Java::TryStatementRepeat1 => "try_statement_repeat1", Java::CatchTypeRepeat1 => "catch_type_repeat1", Java::ResourceSpecificationRepeat1 => "resource_specification_repeat1", @@ -596,6 +651,7 @@ impl From for &'static str { Java::VariableDeclaratorListRepeat1 => "_variable_declarator_list_repeat1", Java::ArrayInitializerRepeat1 => "array_initializer_repeat1", Java::FormalParametersRepeat1 => "formal_parameters_repeat1", + Java::ReceiverParameterRepeat1 => "receiver_parameter_repeat1", Java::TypeIdentifier => "type_identifier", Java::Error => "ERROR", } diff --git a/src/languages/language_javascript.rs b/src/languages/language_javascript.rs index 20a7167..45c9072 100644 --- a/src/languages/language_javascript.rs +++ b/src/languages/language_javascript.rs @@ -10,28 +10,28 @@ pub enum Javascript { Export = 3, STAR = 4, Default = 5, - LBRACE = 6, - COMMA = 7, - RBRACE = 8, - As = 9, + As = 6, + LBRACE = 7, + COMMA = 8, + RBRACE = 9, Import2 = 10, From = 11, - Var = 12, - Let = 13, - Const = 14, - Else = 15, - If = 16, - Switch = 17, - For = 18, - LPAREN = 19, - RPAREN = 20, - Await = 21, - In = 22, - Of = 23, - While = 24, - Do = 25, - Try = 26, - With = 27, + With = 12, + Var = 13, + Let = 14, + Const = 15, + Else = 16, + If = 17, + Switch = 18, + For = 19, + LPAREN = 20, + RPAREN = 21, + Await = 22, + In = 23, + Of = 24, + While = 25, + Do = 26, + Try = 27, Break = 28, Continue = 29, Debugger = 30, @@ -46,213 +46,234 @@ pub enum Javascript { EQ = 39, LBRACK = 40, RBRACK = 41, - LT = 42, - GT = 43, - SLASH = 44, - JsxText = 45, - Identifier2 = 46, - DOT = 47, - Class2 = 48, - Extends = 49, - Async = 50, - Function2 = 51, - EQGT = 52, - QMARKDOT = 53, - New = 54, - PLUSEQ = 55, - DASHEQ = 56, - STAREQ = 57, - SLASHEQ = 58, - PERCENTEQ = 59, - CARETEQ = 60, - AMPEQ = 61, - PIPEEQ = 62, - GTGTEQ = 63, - GTGTGTEQ = 64, - LTLTEQ = 65, - STARSTAREQ = 66, - AMPAMPEQ = 67, - PIPEPIPEEQ = 68, - QMARKQMARKEQ = 69, - DOTDOTDOT = 70, - AMPAMP = 71, - PIPEPIPE = 72, - GTGT = 73, - GTGTGT = 74, - LTLT = 75, - AMP = 76, - CARET = 77, - PIPE = 78, - PLUS = 79, - DASH = 80, - PERCENT = 81, - STARSTAR = 82, - LTEQ = 83, - EQEQ = 84, - EQEQEQ = 85, - BANGEQ = 86, - BANGEQEQ = 87, - GTEQ = 88, - QMARKQMARK = 89, - Instanceof = 90, - BANG = 91, - TILDE = 92, - Typeof = 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, - Get = 120, - Set = 121, - AutomaticSemicolon = 122, - TemplateChars = 123, - QMARK = 124, - Program = 125, - ExportStatement = 126, - ExportClause = 127, - ExportSpecifier = 128, - Declaration = 129, - Import = 130, - ImportStatement = 131, - ImportClause = 132, - FromClause = 133, - NamespaceImport = 134, - NamedImports = 135, - ExpressionStatement = 136, - VariableDeclaration = 137, - LexicalDeclaration = 138, - VariableDeclarator = 139, - StatementBlock = 140, - ElseClause = 141, - IfStatement = 142, - SwitchStatement = 143, - ForStatement = 144, - ForInStatement = 145, - ForHeader = 146, - WhileStatement = 147, - DoStatement = 148, - TryStatement = 149, - WithStatement = 150, - BreakStatement = 151, - ContinueStatement = 152, - DebuggerStatement = 153, - ReturnStatement = 154, - ThrowStatement = 155, - EmptyStatement = 156, - LabeledStatement = 157, - SwitchBody = 158, - SwitchCase = 159, - SwitchDefault = 160, - CatchClause = 161, - FinallyClause = 162, - ParenthesizedExpression = 163, - Expression = 164, - PrimaryExpression = 165, - YieldExpression = 166, - Object = 167, - ObjectPattern = 168, - AssignmentPattern = 169, - ObjectAssignmentPattern = 170, - Array = 171, - ArrayPattern = 172, - JsxElement = 173, - JsxFragment = 174, - JsxExpression = 175, - JsxOpeningElement = 176, - NestedIdentifier = 177, - JsxNamespaceName = 178, - JsxClosingElement = 179, - JsxSelfClosingElement = 180, - JsxAttribute = 181, - Class = 182, - ClassDeclaration = 183, - ClassHeritage = 184, - Function = 185, - FunctionDeclaration = 186, - GeneratorFunction = 187, - GeneratorFunctionDeclaration = 188, - ArrowFunction = 189, - CallExpression = 190, - NewExpression = 191, - AwaitExpression = 192, - MemberExpression = 193, - SubscriptExpression = 194, - AssignmentExpression = 195, - AugmentedAssignmentLhs = 196, - AugmentedAssignmentExpression = 197, - Initializer = 198, - DestructuringPattern = 199, - SpreadElement = 200, - TernaryExpression = 201, - BinaryExpression = 202, - UnaryExpression = 203, - UpdateExpression = 204, - SequenceExpression = 205, - String = 206, - TemplateString = 207, - TemplateSubstitution = 208, - Regex = 209, - MetaProperty = 210, - Arguments = 211, - Decorator = 212, - MemberExpression2 = 213, - CallExpression2 = 214, - ClassBody = 215, - FieldDefinition = 216, - FormalParameters = 217, - Pattern = 218, - RestPattern = 219, - MethodDefinition = 220, - Pair = 221, - PairPattern = 222, - PropertyName = 223, - ComputedPropertyName = 224, - ProgramRepeat1 = 225, - ExportStatementRepeat1 = 226, - ExportClauseRepeat1 = 227, - NamedImportsRepeat1 = 228, - VariableDeclarationRepeat1 = 229, - SwitchBodyRepeat1 = 230, - ObjectRepeat1 = 231, - ObjectPatternRepeat1 = 232, - ArrayRepeat1 = 233, - ArrayPatternRepeat1 = 234, - JsxElementRepeat1 = 235, - JsxOpeningElementRepeat1 = 236, - StringRepeat1 = 237, - StringRepeat2 = 238, - TemplateStringRepeat1 = 239, - ClassBodyRepeat1 = 240, - FormalParametersRepeat1 = 241, - ImportSpecifier = 242, - NamespaceExport = 243, - PropertyIdentifier = 244, - ShorthandPropertyIdentifier = 245, - ShorthandPropertyIdentifierPattern = 246, - StatementIdentifier = 247, - Error = 248, + GlimmerTemplateContent = 42, + GlimmerOpeningTag = 43, + GlimmerClosingTag = 44, + JsxTextToken1 = 45, + JsxTextToken2 = 46, + HtmlCharacterReference = 47, + LT = 48, + GT = 49, + Identifier2 = 50, + DOT = 51, + LTSLASH = 52, + SLASHGT = 53, + DQUOTE = 54, + SQUOTE = 55, + StringFragment = 56, + StringFragment2 = 57, + Class2 = 58, + Extends = 59, + Async = 60, + Function = 61, + EQGT = 62, + OptionalChain = 63, + New = 64, + PLUSEQ = 65, + DASHEQ = 66, + STAREQ = 67, + SLASHEQ = 68, + PERCENTEQ = 69, + CARETEQ = 70, + AMPEQ = 71, + PIPEEQ = 72, + GTGTEQ = 73, + GTGTGTEQ = 74, + LTLTEQ = 75, + STARSTAREQ = 76, + AMPAMPEQ = 77, + PIPEPIPEEQ = 78, + QMARKQMARKEQ = 79, + DOTDOTDOT = 80, + AMPAMP = 81, + PIPEPIPE = 82, + GTGT = 83, + GTGTGT = 84, + LTLT = 85, + AMP = 86, + CARET = 87, + PIPE = 88, + PLUS = 89, + DASH = 90, + SLASH = 91, + PERCENT = 92, + STARSTAR = 93, + LTEQ = 94, + EQEQ = 95, + EQEQEQ = 96, + BANGEQ = 97, + BANGEQEQ = 98, + GTEQ = 99, + QMARKQMARK = 100, + Instanceof = 101, + BANG = 102, + TILDE = 103, + Typeof = 104, + Void = 105, + Delete = 106, + PLUSPLUS = 107, + DASHDASH = 108, + StringFragment3 = 109, + StringFragment4 = 110, + EscapeSequence = 111, + Comment = 112, + BQUOTE = 113, + DOLLARLBRACE = 114, + SLASH2 = 115, + RegexPattern = 116, + RegexFlags = 117, + Number = 118, + PrivatePropertyIdentifier = 119, + Target = 120, + This = 121, + Super = 122, + True = 123, + False = 124, + Null = 125, + Undefined = 126, + AT = 127, + Static = 128, + Staticget = 129, + Get = 130, + Set = 131, + AutomaticSemicolon = 132, + StringFragment5 = 133, + QMARK = 134, + HtmlComment = 135, + Program = 136, + ExportStatement = 137, + NamespaceExport = 138, + ExportClause = 139, + ExportSpecifier = 140, + ModuleExportName = 141, + Declaration = 142, + Import = 143, + ImportStatement = 144, + ImportClause = 145, + FromClause = 146, + NamespaceImport = 147, + NamedImports = 148, + ImportSpecifier = 149, + ImportAttribute = 150, + Statement = 151, + ExpressionStatement = 152, + VariableDeclaration = 153, + LexicalDeclaration = 154, + VariableDeclarator = 155, + StatementBlock = 156, + ElseClause = 157, + IfStatement = 158, + SwitchStatement = 159, + ForStatement = 160, + ForInStatement = 161, + ForHeader = 162, + WhileStatement = 163, + DoStatement = 164, + TryStatement = 165, + WithStatement = 166, + BreakStatement = 167, + ContinueStatement = 168, + DebuggerStatement = 169, + ReturnStatement = 170, + ThrowStatement = 171, + EmptyStatement = 172, + LabeledStatement = 173, + SwitchBody = 174, + SwitchCase = 175, + SwitchDefault = 176, + CatchClause = 177, + FinallyClause = 178, + ParenthesizedExpression = 179, + Expression = 180, + PrimaryExpression = 181, + YieldExpression = 182, + Object = 183, + ObjectPattern = 184, + AssignmentPattern = 185, + ObjectAssignmentPattern = 186, + Array = 187, + ArrayPattern = 188, + GlimmerTemplate = 189, + JsxElement = 190, + JsxText = 191, + JsxExpression = 192, + JsxOpeningElement = 193, + MemberExpression = 194, + JsxNamespaceName = 195, + JsxClosingElement = 196, + JsxSelfClosingElement = 197, + JsxAttribute = 198, + String = 199, + Class = 200, + ClassDeclaration = 201, + ClassHeritage = 202, + FunctionExpression = 203, + FunctionDeclaration = 204, + GeneratorFunction = 205, + GeneratorFunctionDeclaration = 206, + ArrowFunction = 207, + CallExpression = 208, + NewExpression = 209, + AwaitExpression = 210, + MemberExpression2 = 211, + SubscriptExpression = 212, + AssignmentExpression = 213, + AugmentedAssignmentLhs = 214, + AugmentedAssignmentExpression = 215, + Initializer = 216, + DestructuringPattern = 217, + SpreadElement = 218, + TernaryExpression = 219, + BinaryExpression = 220, + UnaryExpression = 221, + UpdateExpression = 222, + SequenceExpression = 223, + String2 = 224, + TemplateString = 225, + TemplateSubstitution = 226, + Regex = 227, + MetaProperty = 228, + Arguments = 229, + Decorator = 230, + MemberExpression3 = 231, + CallExpression2 = 232, + ClassBody = 233, + FieldDefinition = 234, + FormalParameters = 235, + ClassStaticBlock = 236, + Pattern = 237, + RestPattern = 238, + MethodDefinition = 239, + Pair = 240, + PairPattern = 241, + PropertyName = 242, + ComputedPropertyName = 243, + ProgramRepeat1 = 244, + ExportStatementRepeat1 = 245, + ExportClauseRepeat1 = 246, + NamedImportsRepeat1 = 247, + VariableDeclarationRepeat1 = 248, + SwitchBodyRepeat1 = 249, + ObjectRepeat1 = 250, + ObjectPatternRepeat1 = 251, + ArrayRepeat1 = 252, + ArrayPatternRepeat1 = 253, + GlimmerTemplateRepeat1 = 254, + JsxElementRepeat1 = 255, + JsxOpeningElementRepeat1 = 256, + JsxStringRepeat1 = 257, + JsxStringRepeat2 = 258, + SequenceExpressionRepeat1 = 259, + StringRepeat1 = 260, + StringRepeat2 = 261, + TemplateStringRepeat1 = 262, + ClassBodyRepeat1 = 263, + FormalParametersRepeat1 = 264, + PropertyIdentifier = 265, + ShorthandPropertyIdentifier = 266, + ShorthandPropertyIdentifierPattern = 267, + StatementIdentifier = 268, + Error = 269, } impl From for &'static str { @@ -265,12 +286,13 @@ impl From for &'static str { Javascript::Export => "export", Javascript::STAR => "*", Javascript::Default => "default", + Javascript::As => "as", Javascript::LBRACE => "{", Javascript::COMMA => ",", Javascript::RBRACE => "}", - Javascript::As => "as", Javascript::Import2 => "import", Javascript::From => "from", + Javascript::With => "with", Javascript::Var => "var", Javascript::Let => "let", Javascript::Const => "const", @@ -286,7 +308,6 @@ impl From for &'static str { Javascript::While => "while", Javascript::Do => "do", Javascript::Try => "try", - Javascript::With => "with", Javascript::Break => "break", Javascript::Continue => "continue", Javascript::Debugger => "debugger", @@ -301,18 +322,28 @@ impl From for &'static str { Javascript::EQ => "=", Javascript::LBRACK => "[", Javascript::RBRACK => "]", + Javascript::GlimmerTemplateContent => "_glimmer_template_content", + Javascript::GlimmerOpeningTag => "glimmer_opening_tag", + Javascript::GlimmerClosingTag => "glimmer_closing_tag", + Javascript::JsxTextToken1 => "jsx_text_token1", + Javascript::JsxTextToken2 => "jsx_text_token2", + Javascript::HtmlCharacterReference => "html_character_reference", Javascript::LT => "<", Javascript::GT => ">", - Javascript::SLASH => "/", - Javascript::JsxText => "jsx_text", Javascript::Identifier2 => "identifier", Javascript::DOT => ".", + Javascript::LTSLASH => " "/>", + Javascript::DQUOTE => "\"", + Javascript::SQUOTE => "'", + Javascript::StringFragment => "string_fragment", + Javascript::StringFragment2 => "string_fragment", Javascript::Class2 => "class", Javascript::Extends => "extends", Javascript::Async => "async", - Javascript::Function2 => "function", + Javascript::Function => "function", Javascript::EQGT => "=>", - Javascript::QMARKDOT => "?.", + Javascript::OptionalChain => "optional_chain", Javascript::New => "new", Javascript::PLUSEQ => "+=", Javascript::DASHEQ => "-=", @@ -340,6 +371,7 @@ impl From for &'static str { Javascript::PIPE => "|", Javascript::PLUS => "+", Javascript::DASH => "-", + Javascript::SLASH => "/", Javascript::PERCENT => "%", Javascript::STARSTAR => "**", Javascript::LTEQ => "<=", @@ -357,10 +389,8 @@ impl From for &'static str { Javascript::Delete => "delete", Javascript::PLUSPLUS => "++", Javascript::DASHDASH => "--", - Javascript::DQUOTE => "\"", - Javascript::SQUOTE => "'", - Javascript::StringFragment => "string_fragment", - Javascript::StringFragment2 => "string_fragment", + Javascript::StringFragment3 => "string_fragment", + Javascript::StringFragment4 => "string_fragment", Javascript::EscapeSequence => "escape_sequence", Javascript::Comment => "comment", Javascript::BQUOTE => "`", @@ -379,15 +409,19 @@ impl From for &'static str { Javascript::Undefined => "undefined", Javascript::AT => "@", Javascript::Static => "static", + Javascript::Staticget => "static get", Javascript::Get => "get", Javascript::Set => "set", Javascript::AutomaticSemicolon => "_automatic_semicolon", - Javascript::TemplateChars => "_template_chars", + Javascript::StringFragment5 => "string_fragment", Javascript::QMARK => "?", + Javascript::HtmlComment => "html_comment", Javascript::Program => "program", Javascript::ExportStatement => "export_statement", + Javascript::NamespaceExport => "namespace_export", Javascript::ExportClause => "export_clause", Javascript::ExportSpecifier => "export_specifier", + Javascript::ModuleExportName => "_module_export_name", Javascript::Declaration => "declaration", Javascript::Import => "import", Javascript::ImportStatement => "import_statement", @@ -395,6 +429,9 @@ impl From for &'static str { Javascript::FromClause => "_from_clause", Javascript::NamespaceImport => "namespace_import", Javascript::NamedImports => "named_imports", + Javascript::ImportSpecifier => "import_specifier", + Javascript::ImportAttribute => "import_attribute", + Javascript::Statement => "statement", Javascript::ExpressionStatement => "expression_statement", Javascript::VariableDeclaration => "variable_declaration", Javascript::LexicalDeclaration => "lexical_declaration", @@ -432,19 +469,21 @@ impl From for &'static str { Javascript::ObjectAssignmentPattern => "object_assignment_pattern", Javascript::Array => "array", Javascript::ArrayPattern => "array_pattern", + Javascript::GlimmerTemplate => "glimmer_template", Javascript::JsxElement => "jsx_element", - Javascript::JsxFragment => "jsx_fragment", + Javascript::JsxText => "jsx_text", Javascript::JsxExpression => "jsx_expression", Javascript::JsxOpeningElement => "jsx_opening_element", - Javascript::NestedIdentifier => "nested_identifier", + Javascript::MemberExpression => "member_expression", Javascript::JsxNamespaceName => "jsx_namespace_name", Javascript::JsxClosingElement => "jsx_closing_element", Javascript::JsxSelfClosingElement => "jsx_self_closing_element", Javascript::JsxAttribute => "jsx_attribute", + Javascript::String => "string", Javascript::Class => "class", Javascript::ClassDeclaration => "class_declaration", Javascript::ClassHeritage => "class_heritage", - Javascript::Function => "function", + Javascript::FunctionExpression => "function_expression", Javascript::FunctionDeclaration => "function_declaration", Javascript::GeneratorFunction => "generator_function", Javascript::GeneratorFunctionDeclaration => "generator_function_declaration", @@ -452,7 +491,7 @@ impl From for &'static str { Javascript::CallExpression => "call_expression", Javascript::NewExpression => "new_expression", Javascript::AwaitExpression => "await_expression", - Javascript::MemberExpression => "member_expression", + Javascript::MemberExpression2 => "member_expression", Javascript::SubscriptExpression => "subscript_expression", Javascript::AssignmentExpression => "assignment_expression", Javascript::AugmentedAssignmentLhs => "_augmented_assignment_lhs", @@ -465,18 +504,19 @@ impl From for &'static str { Javascript::UnaryExpression => "unary_expression", Javascript::UpdateExpression => "update_expression", Javascript::SequenceExpression => "sequence_expression", - Javascript::String => "string", + Javascript::String2 => "string", Javascript::TemplateString => "template_string", Javascript::TemplateSubstitution => "template_substitution", Javascript::Regex => "regex", Javascript::MetaProperty => "meta_property", Javascript::Arguments => "arguments", Javascript::Decorator => "decorator", - Javascript::MemberExpression2 => "member_expression", + Javascript::MemberExpression3 => "member_expression", Javascript::CallExpression2 => "call_expression", Javascript::ClassBody => "class_body", Javascript::FieldDefinition => "field_definition", Javascript::FormalParameters => "formal_parameters", + Javascript::ClassStaticBlock => "class_static_block", Javascript::Pattern => "pattern", Javascript::RestPattern => "rest_pattern", Javascript::MethodDefinition => "method_definition", @@ -494,15 +534,17 @@ impl From for &'static str { Javascript::ObjectPatternRepeat1 => "object_pattern_repeat1", Javascript::ArrayRepeat1 => "array_repeat1", Javascript::ArrayPatternRepeat1 => "array_pattern_repeat1", + Javascript::GlimmerTemplateRepeat1 => "glimmer_template_repeat1", Javascript::JsxElementRepeat1 => "jsx_element_repeat1", Javascript::JsxOpeningElementRepeat1 => "jsx_opening_element_repeat1", + Javascript::JsxStringRepeat1 => "_jsx_string_repeat1", + Javascript::JsxStringRepeat2 => "_jsx_string_repeat2", + Javascript::SequenceExpressionRepeat1 => "sequence_expression_repeat1", Javascript::StringRepeat1 => "string_repeat1", Javascript::StringRepeat2 => "string_repeat2", Javascript::TemplateStringRepeat1 => "template_string_repeat1", Javascript::ClassBodyRepeat1 => "class_body_repeat1", Javascript::FormalParametersRepeat1 => "formal_parameters_repeat1", - Javascript::ImportSpecifier => "import_specifier", - Javascript::NamespaceExport => "namespace_export", Javascript::PropertyIdentifier => "property_identifier", Javascript::ShorthandPropertyIdentifier => "shorthand_property_identifier", Javascript::ShorthandPropertyIdentifierPattern => { diff --git a/src/languages/language_kotlin.rs b/src/languages/language_kotlin.rs index 04687f0..6adbbbe 100644 --- a/src/languages/language_kotlin.rs +++ b/src/languages/language_kotlin.rs @@ -38,324 +38,331 @@ pub enum Kotlin { Companion = 31, Object = 32, Fun = 33, - Get = 34, - Set = 35, - This = 36, - Super = 37, - SEMI = 38, - Dynamic = 39, - Quest = 40, - DOT = 41, - STAR = 42, - DASHGT = 43, - Label = 44, - For = 45, - In = 46, - While = 47, - Do = 48, - SemiToken1 = 49, + DOT = 34, + SEMI = 35, + Get = 36, + Set = 37, + This = 38, + Super = 39, + Dynamic = 40, + AMP = 41, + Quest = 42, + STAR = 43, + DASHGT = 44, + Label = 45, + For = 46, + In = 47, + While = 48, + Do = 49, DOTDOT = 50, QMARKCOLON = 51, AMPAMP = 52, PIPEPIPE = 53, Null = 54, - DQUOTE = 55, - DQUOTEDQUOTEDQUOTE = 56, - DOLLARLBRACE = 57, - DOLLAR = 58, - If = 59, - Else = 60, - When = 61, - Try = 62, - Catch = 63, - Finally = 64, - Throw = 65, - Return = 66, - Continue = 67, - Break = 68, - COLONCOLON = 69, - PLUSEQ = 70, - DASHEQ = 71, - STAREQ = 72, - SLASHEQ = 73, - PERCENTEQ = 74, - BANGEQ = 75, - BANGEQEQ = 76, - EQEQ = 77, - EQEQEQ = 78, - LTEQ = 79, - GTEQ = 80, - BANGin = 81, - Is = 82, - PLUS = 83, - DASH = 84, - SLASH = 85, - PERCENT = 86, - AsQMARK = 87, - PLUSPLUS = 88, - DASHDASH = 89, - BANG = 90, - BANGBANG = 91, - SafeNav = 92, - Suspend = 93, - Sealed = 94, - Annotation2 = 95, - Data = 96, - Inner = 97, - Override = 98, - Lateinit = 99, - Public = 100, - Private = 101, - Internal = 102, - Protected = 103, - Out = 104, - Tailrec = 105, - Operator = 106, - Infix = 107, - Inline = 108, - External = 109, - PropertyModifier = 110, - Abstract = 111, - Final = 112, - Open = 113, - Vararg = 114, - Noinline = 115, - Crossinline = 116, - ReificationModifier = 117, - Expect = 118, - Actual = 119, - Field = 120, - Property = 121, - Receiver = 122, - Param = 123, - Setparam = 124, - Delegate = 125, - Comment = 126, - ReturnAT = 127, - ContinueAT = 128, - BreakAT = 129, - NotIs = 130, - RealLiteral = 131, - IntegerLiteral = 132, - HexLiteral = 133, - BinLiteral = 134, - UnsignedLiteralToken1 = 135, - L = 136, - True = 137, - False = 138, - SQUOTE = 139, - CharacterLiteralToken1 = 140, - BacktickIdentifier = 141, - BSLASH = 142, - U = 143, + DOLLARLBRACE = 55, + DOLLAR = 56, + If = 57, + Else = 58, + When = 59, + Try = 60, + Catch = 61, + Finally = 62, + Throw = 63, + Return = 64, + Continue = 65, + Break = 66, + COLONCOLON = 67, + PLUSEQ = 68, + DASHEQ = 69, + STAREQ = 70, + SLASHEQ = 71, + PERCENTEQ = 72, + BANGEQ = 73, + BANGEQEQ = 74, + EQEQ = 75, + EQEQEQ = 76, + LTEQ = 77, + GTEQ = 78, + BANGin = 79, + Is = 80, + BANGis = 81, + PLUS = 82, + DASH = 83, + SLASH = 84, + PERCENT = 85, + AsQMARK = 86, + PLUSPLUS = 87, + DASHDASH = 88, + BANG = 89, + BANGBANG = 90, + Suspend = 91, + Sealed = 92, + Annotation2 = 93, + Data = 94, + Inner = 95, + Value = 96, + Override = 97, + Lateinit = 98, + Public = 99, + Private = 100, + Internal = 101, + Protected = 102, + Out = 103, + Tailrec = 104, + Operator = 105, + Infix = 106, + Inline = 107, + External = 108, + PropertyModifier = 109, + Abstract = 110, + Final = 111, + Open = 112, + Vararg = 113, + Noinline = 114, + Crossinline = 115, + ReificationModifier = 116, + Expect = 117, + Actual = 118, + Field = 119, + Property = 120, + Receiver = 121, + Param = 122, + Setparam = 123, + Delegate = 124, + LineComment = 125, + ReturnAT = 126, + ContinueAT = 127, + BreakAT = 128, + ThisAT = 129, + SuperAT = 130, + AT2 = 131, + RealLiteral = 132, + IntegerLiteral = 133, + HexLiteral = 134, + BinLiteral = 135, + UnsignedLiteralToken1 = 136, + L = 137, + True = 138, + False = 139, + SQUOTE = 140, + CharacterLiteralToken1 = 141, + BacktickIdentifier = 142, + BSLASHu = 143, UniCharacterLiteralToken1 = 144, EscapedIdentifier = 145, - LineStrText = 146, - MultiLineStrText = 147, - SourceFile = 148, - ShebangLine = 149, - FileAnnotation = 150, - PackageHeader = 151, - ImportHeader = 152, - ImportAlias = 153, - TypeAlias = 154, - Declaration = 155, - ClassDeclaration = 156, - PrimaryConstructor = 157, - ClassBody = 158, - ClassParameters = 159, - ClassParameter = 160, - DelegationSpecifiers = 161, - DelegationSpecifier = 162, - ConstructorInvocation = 163, - ExplicitDelegation = 164, - TypeParameters = 165, - TypeParameter = 166, - TypeConstraints = 167, - TypeConstraint = 168, - ClassMemberDeclarations = 169, - ClassMemberDeclaration = 170, - AnonymousInitializer = 171, - CompanionObject = 172, - FunctionValueParameters = 173, - FunctionValueParameter = 174, - FunctionDeclaration = 175, - FunctionBody = 176, - VariableDeclaration = 177, - PropertyDeclaration = 178, - PropertyDelegate = 179, - Getter = 180, - Setter = 181, - ParameterWithOptionalType = 182, - Parameter = 183, - ObjectDeclaration = 184, - SecondaryConstructor = 185, - ConstructorDelegationCall = 186, - EnumClassBody = 187, - EnumEntries = 188, - EnumEntry = 189, - Type = 190, - TypeReference = 191, - NullableType = 192, - UserType = 193, - SimpleUserType = 194, - TypeProjection = 195, - TypeProjectionModifiers = 196, - TypeProjectionModifier = 197, - FunctionType = 198, - FunctionTypeParameters = 199, - ParenthesizedType = 200, - Statements = 201, - Statement = 202, - ControlStructureBody = 203, - Block = 204, - LoopStatement = 205, - ForStatement = 206, - WhileStatement = 207, - DoWhileStatement = 208, - Semi = 209, - Semis = 210, - Assignment = 211, - Expression = 212, - UnaryExpression = 213, - PostfixExpression = 214, - CallExpression = 215, - IndexingExpression = 216, - NavigationExpression = 217, - PrefixExpression = 218, - AsExpression = 219, - SpreadExpression = 220, - BinaryExpression = 221, - MultiplicativeExpression = 222, - AdditiveExpression = 223, - RangeExpression = 224, - InfixExpression = 225, - ElvisExpression = 226, - CheckExpression = 227, - ComparisonExpression = 228, - EqualityExpression = 229, - ConjunctionExpression = 230, - DisjunctionExpression = 231, - IndexingSuffix = 232, - NavigationSuffix = 233, - CallSuffix = 234, - AnnotatedLambda = 235, - TypeArguments = 236, - ValueArguments = 237, - ValueArgument = 238, - PrimaryExpression = 239, - ParenthesizedExpression = 240, - CollectionLiteral = 241, - LiteralConstant = 242, - StringLiteral = 243, - LineStringLiteral = 244, - MultiLineStringLiteral = 245, - LineStringContent = 246, - MultiLineStringContent = 247, - Interpolation = 248, - LambdaLiteral = 249, - LambdaParameters = 250, - LambdaParameter = 251, - AnonymousFunction = 252, - FunctionLiteral = 253, - ObjectLiteral = 254, - ThisExpression = 255, - SuperExpression = 256, - IfExpression = 257, - WhenSubject = 258, - WhenExpression = 259, - WhenEntry = 260, - WhenCondition = 261, - RangeTest = 262, - TypeTest = 263, - TryExpression = 264, - CatchBlock = 265, - FinallyBlock = 266, - JumpExpression = 267, - CallableReference = 268, - AssignmentAndOperator = 269, - EqualityOperator = 270, - ComparisonOperator = 271, - InOperator = 272, - IsOperator = 273, - AdditiveOperator = 274, - MultiplicativeOperator = 275, - AsOperator = 276, - PrefixUnaryOperator = 277, - PostfixUnaryOperator = 278, - MemberAccessOperator = 279, - PostfixUnarySuffix = 280, - PostfixUnaryExpression = 281, - DirectlyAssignableExpression = 282, - Modifiers = 283, - ParameterModifiers = 284, - Modifier = 285, - TypeModifiers = 286, - TypeModifier = 287, - ClassModifier = 288, - MemberModifier = 289, - VisibilityModifier = 290, - VarianceModifier = 291, - TypeParameterModifiers = 292, - TypeParameterModifier = 293, - FunctionModifier = 294, - InheritanceModifier = 295, - ParameterModifier = 296, - PlatformModifier = 297, - Annotation = 298, - SingleAnnotation = 299, - MultiAnnotation = 300, - UseSiteTarget = 301, - UnescapedAnnotation = 302, - SimpleIdentifier = 303, - Identifier = 304, - ReturnAt = 305, - ContinueAt = 306, - BreakAt = 307, - UnsignedLiteral = 308, - LongLiteral = 309, - BooleanLiteral = 310, - CharacterLiteral = 311, - LexicalIdentifier = 312, - UniCharacterLiteral = 313, - EscapeSeq = 314, - LineStrEscapedChar = 315, - SourceFileRepeat1 = 316, - SourceFileRepeat2 = 317, - SourceFileRepeat3 = 318, - FileAnnotationRepeat1 = 319, - ClassParametersRepeat1 = 320, - DelegationSpecifiersRepeat1 = 321, - AnnotatedDelegationSpecifierRepeat1 = 322, - TypeParametersRepeat1 = 323, - TypeConstraintsRepeat1 = 324, - FunctionValueParametersRepeat1 = 325, - EnumEntriesRepeat1 = 326, - NullableTypeRepeat1 = 327, - UserTypeRepeat1 = 328, - TypeProjectionModifiersRepeat1 = 329, - FunctionTypeParametersRepeat1 = 330, - StatementsRepeat1 = 331, - StatementRepeat1 = 332, - IndexingSuffixRepeat1 = 333, - TypeArgumentsRepeat1 = 334, - ValueArgumentsRepeat1 = 335, - LineStringLiteralRepeat1 = 336, - MultiLineStringLiteralRepeat1 = 337, - LambdaParametersRepeat1 = 338, - WhenExpressionRepeat1 = 339, - WhenEntryRepeat1 = 340, - TryExpressionRepeat1 = 341, - PostfixUnaryExpressionRepeat1 = 342, - ModifiersRepeat1 = 343, - ParameterModifiersRepeat1 = 344, - TypeModifiersRepeat1 = 345, - TypeParameterModifiersRepeat1 = 346, - IdentifierRepeat1 = 347, - InterpolatedExpression = 348, - InterpolatedIdentifier = 349, - TypeIdentifier = 350, - Error = 351, + AutomaticSemicolon = 146, + ImportListDelimiter = 147, + QMARKDOT = 148, + MultilineComment = 149, + StringStart = 150, + StringEnd = 151, + StringContent = 152, + SourceFile = 153, + ShebangLine = 154, + FileAnnotation = 155, + PackageHeader = 156, + ImportList = 157, + ImportHeader = 158, + ImportAlias = 159, + TypeAlias = 160, + Declaration = 161, + ClassDeclaration = 162, + PrimaryConstructor = 163, + ClassBody = 164, + ClassParameters = 165, + ClassParameter = 166, + DelegationSpecifiers = 167, + DelegationSpecifier = 168, + ConstructorInvocation = 169, + ExplicitDelegation = 170, + TypeParameters = 171, + TypeParameter = 172, + TypeConstraints = 173, + TypeConstraint = 174, + ClassMemberDeclarations = 175, + ClassMemberDeclaration = 176, + AnonymousInitializer = 177, + CompanionObject = 178, + FunctionValueParameters = 179, + FunctionValueParameter = 180, + ReceiverType = 181, + FunctionDeclaration = 182, + FunctionBody = 183, + VariableDeclaration = 184, + PropertyDeclaration = 185, + PropertyDelegate = 186, + Getter = 187, + Setter = 188, + ParameterWithOptionalType = 189, + Parameter = 190, + ObjectDeclaration = 191, + SecondaryConstructor = 192, + ConstructorDelegationCall = 193, + EnumClassBody = 194, + EnumEntries = 195, + EnumEntry = 196, + Type = 197, + TypeReference = 198, + NotNullableType = 199, + NullableType = 200, + UserType = 201, + SimpleUserType = 202, + TypeProjection = 203, + TypeProjectionModifiers = 204, + TypeProjectionModifier = 205, + FunctionType = 206, + FunctionTypeParameters = 207, + ParenthesizedType = 208, + ParenthesizedUserType = 209, + Statements = 210, + Statement = 211, + ControlStructureBody = 212, + Block = 213, + LoopStatement = 214, + ForStatement = 215, + WhileStatement = 216, + DoWhileStatement = 217, + Semi = 218, + Assignment = 219, + Expression = 220, + UnaryExpression = 221, + PostfixExpression = 222, + CallExpression = 223, + IndexingExpression = 224, + NavigationExpression = 225, + PrefixExpression = 226, + AsExpression = 227, + SpreadExpression = 228, + BinaryExpression = 229, + MultiplicativeExpression = 230, + AdditiveExpression = 231, + RangeExpression = 232, + InfixExpression = 233, + ElvisExpression = 234, + CheckExpression = 235, + ComparisonExpression = 236, + EqualityExpression = 237, + ConjunctionExpression = 238, + DisjunctionExpression = 239, + IndexingSuffix = 240, + NavigationSuffix = 241, + CallSuffix = 242, + AnnotatedLambda = 243, + TypeArguments = 244, + ValueArguments = 245, + ValueArgument = 246, + PrimaryExpression = 247, + ParenthesizedExpression = 248, + CollectionLiteral = 249, + LiteralConstant = 250, + StringLiteral = 251, + Interpolation = 252, + LambdaLiteral = 253, + MultiVariableDeclaration = 254, + LambdaParameters = 255, + LambdaParameter = 256, + AnonymousFunction = 257, + FunctionLiteral = 258, + ObjectLiteral = 259, + ThisExpression = 260, + SuperExpression = 261, + IfExpression = 262, + WhenSubject = 263, + WhenExpression = 264, + WhenEntry = 265, + WhenCondition = 266, + RangeTest = 267, + TypeTest = 268, + TryExpression = 269, + CatchBlock = 270, + FinallyBlock = 271, + JumpExpression = 272, + CallableReference = 273, + AssignmentAndOperator = 274, + EqualityOperator = 275, + ComparisonOperator = 276, + InOperator = 277, + IsOperator = 278, + AdditiveOperator = 279, + MultiplicativeOperator = 280, + AsOperator = 281, + PrefixUnaryOperator = 282, + PostfixUnaryOperator = 283, + MemberAccessOperator = 284, + PostfixUnarySuffix = 285, + PostfixUnaryExpression = 286, + DirectlyAssignableExpression = 287, + Modifiers = 288, + ParameterModifiers = 289, + Modifier = 290, + TypeModifiers = 291, + TypeModifier = 292, + ClassModifier = 293, + MemberModifier = 294, + VisibilityModifier = 295, + VarianceModifier = 296, + TypeParameterModifiers = 297, + TypeParameterModifier = 298, + FunctionModifier = 299, + InheritanceModifier = 300, + ParameterModifier = 301, + PlatformModifier = 302, + Annotation = 303, + SingleAnnotation = 304, + MultiAnnotation = 305, + UseSiteTarget = 306, + UnescapedAnnotation = 307, + SimpleIdentifier = 308, + Identifier = 309, + ReturnAt = 310, + ContinueAt = 311, + BreakAt = 312, + ThisAt = 313, + SuperAt = 314, + UnsignedLiteral = 315, + LongLiteral = 316, + BooleanLiteral = 317, + CharacterLiteral = 318, + CharacterEscapeSeq = 319, + LexicalIdentifier = 320, + UniCharacterLiteral = 321, + SourceFileRepeat1 = 322, + SourceFileRepeat2 = 323, + SourceFileRepeat3 = 324, + FileAnnotationRepeat1 = 325, + ImportListRepeat1 = 326, + ClassParametersRepeat1 = 327, + DelegationSpecifiersRepeat1 = 328, + AnnotatedDelegationSpecifierRepeat1 = 329, + TypeParametersRepeat1 = 330, + TypeConstraintsRepeat1 = 331, + FunctionValueParametersRepeat1 = 332, + EnumEntriesRepeat1 = 333, + NullableTypeRepeat1 = 334, + UserTypeRepeat1 = 335, + TypeProjectionModifiersRepeat1 = 336, + FunctionTypeParametersRepeat1 = 337, + StatementsRepeat1 = 338, + StatementRepeat1 = 339, + IndexingSuffixRepeat1 = 340, + TypeArgumentsRepeat1 = 341, + ValueArgumentsRepeat1 = 342, + StringLiteralRepeat1 = 343, + MultiVariableDeclarationRepeat1 = 344, + LambdaParametersRepeat1 = 345, + WhenExpressionRepeat1 = 346, + WhenEntryRepeat1 = 347, + TryExpressionRepeat1 = 348, + PostfixUnaryExpressionRepeat1 = 349, + ModifiersRepeat1 = 350, + ParameterModifiersRepeat1 = 351, + TypeModifiersRepeat1 = 352, + TypeParameterModifiersRepeat1 = 353, + IdentifierRepeat1 = 354, + InterpolatedExpression = 355, + InterpolatedIdentifier = 356, + TypeIdentifier = 357, + Error = 358, } impl From for &'static str { @@ -396,14 +403,15 @@ impl From for &'static str { Kotlin::Companion => "companion", Kotlin::Object => "object", Kotlin::Fun => "fun", + Kotlin::DOT => ".", + Kotlin::SEMI => ";", Kotlin::Get => "get", Kotlin::Set => "set", Kotlin::This => "this", Kotlin::Super => "super", - Kotlin::SEMI => ";", Kotlin::Dynamic => "dynamic", + Kotlin::AMP => "&", Kotlin::Quest => "_quest", - Kotlin::DOT => ".", Kotlin::STAR => "*", Kotlin::DASHGT => "->", Kotlin::Label => "label", @@ -411,14 +419,11 @@ impl From for &'static str { Kotlin::In => "in", Kotlin::While => "while", Kotlin::Do => "do", - Kotlin::SemiToken1 => "_semi_token1", Kotlin::DOTDOT => "..", Kotlin::QMARKCOLON => "?:", Kotlin::AMPAMP => "&&", Kotlin::PIPEPIPE => "||", Kotlin::Null => "null", - Kotlin::DQUOTE => "\"", - Kotlin::DQUOTEDQUOTEDQUOTE => "\"\"\"", Kotlin::DOLLARLBRACE => "${", Kotlin::DOLLAR => "$", Kotlin::If => "if", @@ -445,6 +450,7 @@ impl From for &'static str { Kotlin::GTEQ => ">=", Kotlin::BANGin => "!in", Kotlin::Is => "is", + Kotlin::BANGis => "!is", Kotlin::PLUS => "+", Kotlin::DASH => "-", Kotlin::SLASH => "/", @@ -454,12 +460,12 @@ impl From for &'static str { Kotlin::DASHDASH => "--", Kotlin::BANG => "!", Kotlin::BANGBANG => "!!", - Kotlin::SafeNav => "_safe_nav", Kotlin::Suspend => "suspend", Kotlin::Sealed => "sealed", Kotlin::Annotation2 => "annotation", Kotlin::Data => "data", Kotlin::Inner => "inner", + Kotlin::Value => "value", Kotlin::Override => "override", Kotlin::Lateinit => "lateinit", Kotlin::Public => "public", @@ -488,11 +494,13 @@ impl From for &'static str { Kotlin::Param => "param", Kotlin::Setparam => "setparam", Kotlin::Delegate => "delegate", - Kotlin::Comment => "comment", + Kotlin::LineComment => "line_comment", Kotlin::ReturnAT => "return@", Kotlin::ContinueAT => "continue@", Kotlin::BreakAT => "break@", - Kotlin::NotIs => "_not_is", + Kotlin::ThisAT => "this@", + Kotlin::SuperAT => "super@", + Kotlin::AT2 => "@", Kotlin::RealLiteral => "real_literal", Kotlin::IntegerLiteral => "integer_literal", Kotlin::HexLiteral => "hex_literal", @@ -504,16 +512,21 @@ impl From for &'static str { Kotlin::SQUOTE => "'", Kotlin::CharacterLiteralToken1 => "character_literal_token1", Kotlin::BacktickIdentifier => "_backtick_identifier", - Kotlin::BSLASH => "\\", - Kotlin::U => "u", + Kotlin::BSLASHu => "\\u", Kotlin::UniCharacterLiteralToken1 => "_uni_character_literal_token1", Kotlin::EscapedIdentifier => "_escaped_identifier", - Kotlin::LineStrText => "_line_str_text", - Kotlin::MultiLineStrText => "_multi_line_str_text", + Kotlin::AutomaticSemicolon => "_automatic_semicolon", + Kotlin::ImportListDelimiter => "_import_list_delimiter", + Kotlin::QMARKDOT => "?.", + Kotlin::MultilineComment => "multiline_comment", + Kotlin::StringStart => "_string_start", + Kotlin::StringEnd => "_string_end", + Kotlin::StringContent => "_string_content", Kotlin::SourceFile => "source_file", Kotlin::ShebangLine => "shebang_line", Kotlin::FileAnnotation => "file_annotation", Kotlin::PackageHeader => "package_header", + Kotlin::ImportList => "import_list", Kotlin::ImportHeader => "import_header", Kotlin::ImportAlias => "import_alias", Kotlin::TypeAlias => "type_alias", @@ -535,8 +548,9 @@ impl From for &'static str { Kotlin::ClassMemberDeclaration => "_class_member_declaration", Kotlin::AnonymousInitializer => "anonymous_initializer", Kotlin::CompanionObject => "companion_object", - Kotlin::FunctionValueParameters => "_function_value_parameters", + Kotlin::FunctionValueParameters => "function_value_parameters", Kotlin::FunctionValueParameter => "_function_value_parameter", + Kotlin::ReceiverType => "_receiver_type", Kotlin::FunctionDeclaration => "function_declaration", Kotlin::FunctionBody => "function_body", Kotlin::VariableDeclaration => "variable_declaration", @@ -554,6 +568,7 @@ impl From for &'static str { Kotlin::EnumEntry => "enum_entry", Kotlin::Type => "_type", Kotlin::TypeReference => "_type_reference", + Kotlin::NotNullableType => "not_nullable_type", Kotlin::NullableType => "nullable_type", Kotlin::UserType => "user_type", Kotlin::SimpleUserType => "_simple_user_type", @@ -563,6 +578,7 @@ impl From for &'static str { Kotlin::FunctionType => "function_type", Kotlin::FunctionTypeParameters => "function_type_parameters", Kotlin::ParenthesizedType => "parenthesized_type", + Kotlin::ParenthesizedUserType => "parenthesized_user_type", Kotlin::Statements => "statements", Kotlin::Statement => "_statement", Kotlin::ControlStructureBody => "control_structure_body", @@ -572,7 +588,6 @@ impl From for &'static str { Kotlin::WhileStatement => "while_statement", Kotlin::DoWhileStatement => "do_while_statement", Kotlin::Semi => "_semi", - Kotlin::Semis => "_semis", Kotlin::Assignment => "assignment", Kotlin::Expression => "_expression", Kotlin::UnaryExpression => "_unary_expression", @@ -605,13 +620,10 @@ impl From for &'static str { Kotlin::ParenthesizedExpression => "parenthesized_expression", Kotlin::CollectionLiteral => "collection_literal", Kotlin::LiteralConstant => "_literal_constant", - Kotlin::StringLiteral => "_string_literal", - Kotlin::LineStringLiteral => "line_string_literal", - Kotlin::MultiLineStringLiteral => "multi_line_string_literal", - Kotlin::LineStringContent => "_line_string_content", - Kotlin::MultiLineStringContent => "_multi_line_string_content", + Kotlin::StringLiteral => "string_literal", Kotlin::Interpolation => "_interpolation", Kotlin::LambdaLiteral => "lambda_literal", + Kotlin::MultiVariableDeclaration => "multi_variable_declaration", Kotlin::LambdaParameters => "lambda_parameters", Kotlin::LambdaParameter => "_lambda_parameter", Kotlin::AnonymousFunction => "anonymous_function", @@ -670,18 +682,20 @@ impl From for &'static str { Kotlin::ReturnAt => "_return_at", Kotlin::ContinueAt => "_continue_at", Kotlin::BreakAt => "_break_at", + Kotlin::ThisAt => "_this_at", + Kotlin::SuperAt => "_super_at", Kotlin::UnsignedLiteral => "unsigned_literal", Kotlin::LongLiteral => "long_literal", Kotlin::BooleanLiteral => "boolean_literal", Kotlin::CharacterLiteral => "character_literal", + Kotlin::CharacterEscapeSeq => "character_escape_seq", Kotlin::LexicalIdentifier => "_lexical_identifier", Kotlin::UniCharacterLiteral => "_uni_character_literal", - Kotlin::EscapeSeq => "_escape_seq", - Kotlin::LineStrEscapedChar => "_line_str_escaped_char", Kotlin::SourceFileRepeat1 => "source_file_repeat1", Kotlin::SourceFileRepeat2 => "source_file_repeat2", Kotlin::SourceFileRepeat3 => "source_file_repeat3", Kotlin::FileAnnotationRepeat1 => "file_annotation_repeat1", + Kotlin::ImportListRepeat1 => "import_list_repeat1", Kotlin::ClassParametersRepeat1 => "_class_parameters_repeat1", Kotlin::DelegationSpecifiersRepeat1 => "_delegation_specifiers_repeat1", Kotlin::AnnotatedDelegationSpecifierRepeat1 => { @@ -689,7 +703,7 @@ impl From for &'static str { } Kotlin::TypeParametersRepeat1 => "type_parameters_repeat1", Kotlin::TypeConstraintsRepeat1 => "type_constraints_repeat1", - Kotlin::FunctionValueParametersRepeat1 => "_function_value_parameters_repeat1", + Kotlin::FunctionValueParametersRepeat1 => "function_value_parameters_repeat1", Kotlin::EnumEntriesRepeat1 => "_enum_entries_repeat1", Kotlin::NullableTypeRepeat1 => "nullable_type_repeat1", Kotlin::UserTypeRepeat1 => "user_type_repeat1", @@ -700,8 +714,8 @@ impl From for &'static str { Kotlin::IndexingSuffixRepeat1 => "indexing_suffix_repeat1", Kotlin::TypeArgumentsRepeat1 => "type_arguments_repeat1", Kotlin::ValueArgumentsRepeat1 => "value_arguments_repeat1", - Kotlin::LineStringLiteralRepeat1 => "line_string_literal_repeat1", - Kotlin::MultiLineStringLiteralRepeat1 => "multi_line_string_literal_repeat1", + Kotlin::StringLiteralRepeat1 => "string_literal_repeat1", + Kotlin::MultiVariableDeclarationRepeat1 => "multi_variable_declaration_repeat1", Kotlin::LambdaParametersRepeat1 => "lambda_parameters_repeat1", Kotlin::WhenExpressionRepeat1 => "when_expression_repeat1", Kotlin::WhenEntryRepeat1 => "when_entry_repeat1", diff --git a/src/languages/language_python.rs b/src/languages/language_python.rs index 6b55a23..e36ada6 100644 --- a/src/languages/language_python.rs +++ b/src/languages/language_python.rs @@ -20,17 +20,17 @@ pub enum Python { GTGT = 13, Assert = 14, COLONEQ = 15, - Match = 16, - Return = 17, - Del = 18, - Raise = 19, - Pass = 20, - Break = 21, - Continue = 22, - If = 23, - COLON = 24, - Elif = 25, - Else = 26, + Return = 16, + Del = 17, + Raise = 18, + Pass = 19, + Break = 20, + Continue = 21, + If = 22, + COLON = 23, + Elif = 24, + Else = 25, + Match = 26, Case = 27, Async = 28, For = 29, @@ -38,216 +38,247 @@ pub enum Python { While = 31, Try = 32, Except = 33, - Finally = 34, - With = 35, - Def = 36, - DASHGT = 37, - STARSTAR = 38, - Global = 39, - Nonlocal = 40, - Exec = 41, - Class = 42, - AT = 43, - LBRACK = 44, - RBRACK = 45, - EQ = 46, - Not = 47, - And = 48, - Or = 49, - PLUS = 50, - DASH = 51, - SLASH = 52, - PERCENT = 53, - SLASHSLASH = 54, - PIPE = 55, - AMP = 56, - CARET = 57, - LTLT = 58, - TILDE = 59, - LT = 60, - LTEQ = 61, - EQEQ = 62, - BANGEQ = 63, - GTEQ = 64, - GT = 65, - LTGT = 66, - Is = 67, - Lambda3 = 68, - PLUSEQ = 69, - DASHEQ = 70, - STAREQ = 71, - SLASHEQ = 72, - ATEQ = 73, - SLASHSLASHEQ = 74, - PERCENTEQ = 75, - STARSTAREQ = 76, - GTGTEQ = 77, - LTLTEQ = 78, - AMPEQ = 79, - CARETEQ = 80, - PIPEEQ = 81, - Yield2 = 82, - Ellipsis = 83, - LBRACE = 84, - RBRACE = 85, - LBRACELBRACE = 86, - RBRACERBRACE = 87, - EscapeSequence = 88, - NotEscapeSequence = 89, - FormatSpecifierToken1 = 90, - TypeConversion = 91, - Integer = 92, - Float = 93, - Await2 = 94, - True = 95, - False = 96, - None = 97, - Comment = 98, - Newline = 99, - Indent = 100, - Dedent = 101, - DQUOTE = 102, - StringContent = 103, - DQUOTE2 = 104, - Module = 105, - Statement = 106, - SimpleStatements = 107, - ImportStatement = 108, - ImportPrefix = 109, - RelativeImport = 110, - FutureImportStatement = 111, - ImportFromStatement = 112, - ImportList = 113, - AliasedImport = 114, - WildcardImport = 115, - PrintStatement = 116, - Chevron = 117, - AssertStatement = 118, - ExpressionStatement = 119, - NamedExpression = 120, - NamedExpresssionLhs = 121, - ReturnStatement = 122, - DeleteStatement = 123, - RaiseStatement = 124, - PassStatement = 125, - BreakStatement = 126, - ContinueStatement = 127, - IfStatement = 128, - ElifClause = 129, - ElseClause = 130, - MatchStatement = 131, - CaseClause = 132, - ForStatement = 133, - WhileStatement = 134, - TryStatement = 135, - ExceptClause = 136, - FinallyClause = 137, - WithStatement = 138, - WithClause = 139, - WithItem = 140, - FunctionDefinition = 141, - Parameters = 142, - LambdaParameters = 143, - ListSplat = 144, - DictionarySplat = 145, - GlobalStatement = 146, - NonlocalStatement = 147, - ExecStatement = 148, - ClassDefinition = 149, - ParenthesizedListSplat = 150, - ArgumentList = 151, - DecoratedDefinition = 152, - Decorator = 153, - Block = 154, - ExpressionList = 155, - DottedName = 156, - Parameters2 = 157, - Patterns = 158, - Parameter = 159, - Pattern = 160, - TuplePattern = 161, - ListPattern = 162, - DefaultParameter = 163, - TypedDefaultParameter = 164, - ListSplatPattern = 165, - DictionarySplatPattern = 166, - AsPattern = 167, - ExpressionWithinForInClause = 168, - Expression = 169, - PrimaryExpression = 170, - NotOperator = 171, - BooleanOperator = 172, - BinaryOperator = 173, - UnaryOperator = 174, - ComparisonOperator = 175, - Lambda = 176, - Lambda2 = 177, - Assignment = 178, - AugmentedAssignment = 179, - PatternList = 180, - RightHandSide = 181, - Yield = 182, - Attribute = 183, - Subscript = 184, - Slice = 185, - Call = 186, - TypedParameter = 187, - Type = 188, - KeywordArgument = 189, - List = 190, - Set = 191, - Tuple = 192, - Dictionary = 193, - Pair = 194, - ListComprehension = 195, - DictionaryComprehension = 196, - SetComprehension = 197, - GeneratorExpression = 198, - ComprehensionClauses = 199, - ParenthesizedExpression = 200, - CollectionElements = 201, - ForInClause = 202, - IfClause = 203, - ConditionalExpression = 204, - ConcatenatedString = 205, - String = 206, - Interpolation = 207, - EscapeInterpolation = 208, - FormatSpecifier = 209, - FormatExpression = 210, - Await = 211, - PositionalSeparator = 212, - KeywordSeparator = 213, - ModuleRepeat1 = 214, - SimpleStatementsRepeat1 = 215, - ImportPrefixRepeat1 = 216, - ImportListRepeat1 = 217, - PrintStatementRepeat1 = 218, - AssertStatementRepeat1 = 219, - IfStatementRepeat1 = 220, - MatchStatementRepeat1 = 221, - MatchStatementRepeat2 = 222, - CaseClauseRepeat1 = 223, - TryStatementRepeat1 = 224, - WithClauseRepeat1 = 225, - GlobalStatementRepeat1 = 226, - ArgumentListRepeat1 = 227, - DecoratedDefinitionRepeat1 = 228, - DottedNameRepeat1 = 229, - ParametersRepeat1 = 230, - PatternsRepeat1 = 231, - ComparisonOperatorRepeat1 = 232, - SubscriptRepeat1 = 233, - DictionaryRepeat1 = 234, - ComprehensionClausesRepeat1 = 235, - CollectionElementsRepeat1 = 236, - ForInClauseRepeat1 = 237, - ConcatenatedStringRepeat1 = 238, - StringRepeat1 = 239, - FormatSpecifierRepeat1 = 240, - AsPatternTarget = 241, - CasePattern = 242, - Error = 243, + ExceptSTAR = 34, + Finally = 35, + With = 36, + Def = 37, + DASHGT = 38, + STARSTAR = 39, + Global = 40, + Nonlocal = 41, + Exec = 42, + Type2 = 43, + EQ = 44, + Class = 45, + LBRACK = 46, + RBRACK = 47, + AT = 48, + DASH = 49, + UNDERSCORE = 50, + PIPE = 51, + LBRACE = 52, + RBRACE = 53, + PLUS = 54, + Not = 55, + And = 56, + Or = 57, + SLASH = 58, + PERCENT = 59, + SLASHSLASH = 60, + AMP = 61, + CARET = 62, + LTLT = 63, + TILDE = 64, + LT = 65, + LTEQ = 66, + EQEQ = 67, + BANGEQ = 68, + GTEQ = 69, + GT = 70, + LTGT = 71, + Is = 72, + Lambda3 = 73, + PLUSEQ = 74, + DASHEQ = 75, + STAREQ = 76, + SLASHEQ = 77, + ATEQ = 78, + SLASHSLASHEQ = 79, + PERCENTEQ = 80, + STARSTAREQ = 81, + GTGTEQ = 82, + LTLTEQ = 83, + AMPEQ = 84, + CARETEQ = 85, + PIPEEQ = 86, + Yield2 = 87, + Ellipsis = 88, + EscapeSequence = 89, + NotEscapeSequence = 90, + FormatSpecifierToken1 = 91, + TypeConversion = 92, + Integer = 93, + Float = 94, + Await2 = 95, + True = 96, + False = 97, + None = 98, + Comment = 99, + LineContinuation = 100, + Newline = 101, + Indent = 102, + Dedent = 103, + StringStart = 104, + StringContent2 = 105, + EscapeInterpolation = 106, + StringEnd = 107, + Module = 108, + Statement = 109, + SimpleStatements = 110, + ImportStatement = 111, + ImportPrefix = 112, + RelativeImport = 113, + FutureImportStatement = 114, + ImportFromStatement = 115, + ImportList = 116, + AliasedImport = 117, + WildcardImport = 118, + PrintStatement = 119, + Chevron = 120, + AssertStatement = 121, + ExpressionStatement = 122, + NamedExpression = 123, + NamedExpressionLhs = 124, + ReturnStatement = 125, + DeleteStatement = 126, + RaiseStatement = 127, + PassStatement = 128, + BreakStatement = 129, + ContinueStatement = 130, + IfStatement = 131, + ElifClause = 132, + ElseClause = 133, + MatchStatement = 134, + Block = 135, + CaseClause = 136, + ForStatement = 137, + WhileStatement = 138, + TryStatement = 139, + ExceptClause = 140, + ExceptGroupClause = 141, + FinallyClause = 142, + WithStatement = 143, + WithClause = 144, + WithItem = 145, + FunctionDefinition = 146, + Parameters = 147, + LambdaParameters = 148, + ListSplat = 149, + DictionarySplat = 150, + GlobalStatement = 151, + NonlocalStatement = 152, + ExecStatement = 153, + TypeAliasStatement = 154, + ClassDefinition = 155, + TypeParameter = 156, + ParenthesizedListSplat = 157, + ArgumentList = 158, + DecoratedDefinition = 159, + Decorator = 160, + Block2 = 161, + ExpressionList = 162, + DottedName = 163, + CasePattern = 164, + SimplePattern = 165, + AsPattern = 166, + UnionPattern = 167, + ListPattern = 168, + TuplePattern = 169, + DictPattern = 170, + KeyValuePattern = 171, + KeywordPattern = 172, + SplatPattern = 173, + ClassPattern = 174, + ComplexPattern = 175, + Parameters2 = 176, + Patterns = 177, + Parameter = 178, + Pattern = 179, + TuplePattern2 = 180, + ListPattern2 = 181, + DefaultParameter = 182, + TypedDefaultParameter = 183, + ListSplatPattern = 184, + DictionarySplatPattern = 185, + AsPattern2 = 186, + ExpressionWithinForInClause = 187, + Expression = 188, + PrimaryExpression = 189, + NotOperator = 190, + BooleanOperator = 191, + BinaryOperator = 192, + UnaryOperator = 193, + ComparisonOperator = 194, + Lambda = 195, + Lambda2 = 196, + Assignment = 197, + AugmentedAssignment = 198, + PatternList = 199, + RightHandSide = 200, + Yield = 201, + Attribute = 202, + Subscript = 203, + Slice = 204, + Call = 205, + TypedParameter = 206, + Type = 207, + SplatType = 208, + GenericType = 209, + UnionType = 210, + ConstrainedType = 211, + MemberType = 212, + KeywordArgument = 213, + List = 214, + Set = 215, + Tuple = 216, + Dictionary = 217, + Pair = 218, + ListComprehension = 219, + DictionaryComprehension = 220, + SetComprehension = 221, + GeneratorExpression = 222, + ComprehensionClauses = 223, + ParenthesizedExpression = 224, + CollectionElements = 225, + ForInClause = 226, + IfClause = 227, + ConditionalExpression = 228, + ConcatenatedString = 229, + String = 230, + StringContent = 231, + Interpolation = 232, + FExpression = 233, + FormatSpecifier = 234, + Await = 235, + PositionalSeparator = 236, + KeywordSeparator = 237, + ModuleRepeat1 = 238, + SimpleStatementsRepeat1 = 239, + ImportPrefixRepeat1 = 240, + ImportListRepeat1 = 241, + PrintStatementRepeat1 = 242, + AssertStatementRepeat1 = 243, + IfStatementRepeat1 = 244, + MatchStatementRepeat1 = 245, + MatchBlockRepeat1 = 246, + CaseClauseRepeat1 = 247, + TryStatementRepeat1 = 248, + TryStatementRepeat2 = 249, + WithClauseRepeat1 = 250, + GlobalStatementRepeat1 = 251, + TypeParameterRepeat1 = 252, + ArgumentListRepeat1 = 253, + DecoratedDefinitionRepeat1 = 254, + DottedNameRepeat1 = 255, + UnionPatternRepeat1 = 256, + DictPatternRepeat1 = 257, + ParametersRepeat1 = 258, + PatternsRepeat1 = 259, + ComparisonOperatorRepeat1 = 260, + SubscriptRepeat1 = 261, + DictionaryRepeat1 = 262, + ComprehensionClausesRepeat1 = 263, + CollectionElementsRepeat1 = 264, + ForInClauseRepeat1 = 265, + ConcatenatedStringRepeat1 = 266, + StringRepeat1 = 267, + StringContentRepeat1 = 268, + FormatSpecifierRepeat1 = 269, + AsPatternTarget = 270, + FormatExpression = 271, + Isnot = 272, + Notin = 273, + Error = 274, } impl From for &'static str { @@ -270,7 +301,6 @@ impl From for &'static str { Python::GTGT => ">>", Python::Assert => "assert", Python::COLONEQ => ":=", - Python::Match => "match", Python::Return => "return", Python::Del => "del", Python::Raise => "raise", @@ -281,6 +311,7 @@ impl From for &'static str { Python::COLON => ":", Python::Elif => "elif", Python::Else => "else", + Python::Match => "match", Python::Case => "case", Python::Async => "async", Python::For => "for", @@ -288,6 +319,7 @@ impl From for &'static str { Python::While => "while", Python::Try => "try", Python::Except => "except", + Python::ExceptSTAR => "except*", Python::Finally => "finally", Python::With => "with", Python::Def => "def", @@ -296,20 +328,24 @@ impl From for &'static str { Python::Global => "global", Python::Nonlocal => "nonlocal", Python::Exec => "exec", + Python::Type2 => "type", + Python::EQ => "=", Python::Class => "class", - Python::AT => "@", Python::LBRACK => "[", Python::RBRACK => "]", - Python::EQ => "=", + Python::AT => "@", + Python::DASH => "-", + Python::UNDERSCORE => "_", + Python::PIPE => "|", + Python::LBRACE => "{", + Python::RBRACE => "}", + Python::PLUS => "+", Python::Not => "not", Python::And => "and", Python::Or => "or", - Python::PLUS => "+", - Python::DASH => "-", Python::SLASH => "/", Python::PERCENT => "%", Python::SLASHSLASH => "//", - Python::PIPE => "|", Python::AMP => "&", Python::CARET => "^", Python::LTLT => "<<", @@ -338,10 +374,6 @@ impl From for &'static str { Python::PIPEEQ => "|=", Python::Yield2 => "yield", Python::Ellipsis => "ellipsis", - Python::LBRACE => "{", - Python::RBRACE => "}", - Python::LBRACELBRACE => "{{", - Python::RBRACERBRACE => "}}", Python::EscapeSequence => "escape_sequence", Python::NotEscapeSequence => "_not_escape_sequence", Python::FormatSpecifierToken1 => "format_specifier_token1", @@ -353,12 +385,14 @@ impl From for &'static str { Python::False => "false", Python::None => "none", Python::Comment => "comment", + Python::LineContinuation => "line_continuation", Python::Newline => "_newline", Python::Indent => "_indent", Python::Dedent => "_dedent", - Python::DQUOTE => "\"", - Python::StringContent => "_string_content", - Python::DQUOTE2 => "\"", + Python::StringStart => "string_start", + Python::StringContent2 => "_string_content", + Python::EscapeInterpolation => "escape_interpolation", + Python::StringEnd => "string_end", Python::Module => "module", Python::Statement => "_statement", Python::SimpleStatements => "_simple_statements", @@ -375,7 +409,7 @@ impl From for &'static str { Python::AssertStatement => "assert_statement", Python::ExpressionStatement => "expression_statement", Python::NamedExpression => "named_expression", - Python::NamedExpresssionLhs => "_named_expresssion_lhs", + Python::NamedExpressionLhs => "_named_expression_lhs", Python::ReturnStatement => "return_statement", Python::DeleteStatement => "delete_statement", Python::RaiseStatement => "raise_statement", @@ -386,11 +420,13 @@ impl From for &'static str { Python::ElifClause => "elif_clause", Python::ElseClause => "else_clause", Python::MatchStatement => "match_statement", + Python::Block => "block", Python::CaseClause => "case_clause", Python::ForStatement => "for_statement", Python::WhileStatement => "while_statement", Python::TryStatement => "try_statement", Python::ExceptClause => "except_clause", + Python::ExceptGroupClause => "except_group_clause", Python::FinallyClause => "finally_clause", Python::WithStatement => "with_statement", Python::WithClause => "with_clause", @@ -403,25 +439,39 @@ impl From for &'static str { Python::GlobalStatement => "global_statement", Python::NonlocalStatement => "nonlocal_statement", Python::ExecStatement => "exec_statement", + Python::TypeAliasStatement => "type_alias_statement", Python::ClassDefinition => "class_definition", + Python::TypeParameter => "type_parameter", Python::ParenthesizedListSplat => "parenthesized_list_splat", Python::ArgumentList => "argument_list", Python::DecoratedDefinition => "decorated_definition", Python::Decorator => "decorator", - Python::Block => "block", + Python::Block2 => "block", Python::ExpressionList => "expression_list", Python::DottedName => "dotted_name", + Python::CasePattern => "case_pattern", + Python::SimplePattern => "_simple_pattern", + Python::AsPattern => "as_pattern", + Python::UnionPattern => "union_pattern", + Python::ListPattern => "list_pattern", + Python::TuplePattern => "tuple_pattern", + Python::DictPattern => "dict_pattern", + Python::KeyValuePattern => "_key_value_pattern", + Python::KeywordPattern => "keyword_pattern", + Python::SplatPattern => "splat_pattern", + Python::ClassPattern => "class_pattern", + Python::ComplexPattern => "complex_pattern", Python::Parameters2 => "_parameters", Python::Patterns => "_patterns", Python::Parameter => "parameter", Python::Pattern => "pattern", - Python::TuplePattern => "tuple_pattern", - Python::ListPattern => "list_pattern", + Python::TuplePattern2 => "tuple_pattern", + Python::ListPattern2 => "list_pattern", Python::DefaultParameter => "default_parameter", Python::TypedDefaultParameter => "typed_default_parameter", Python::ListSplatPattern => "list_splat_pattern", Python::DictionarySplatPattern => "dictionary_splat_pattern", - Python::AsPattern => "as_pattern", + Python::AsPattern2 => "as_pattern", Python::ExpressionWithinForInClause => "_expression_within_for_in_clause", Python::Expression => "expression", Python::PrimaryExpression => "primary_expression", @@ -443,6 +493,11 @@ impl From for &'static str { Python::Call => "call", Python::TypedParameter => "typed_parameter", Python::Type => "type", + Python::SplatType => "splat_type", + Python::GenericType => "generic_type", + Python::UnionType => "union_type", + Python::ConstrainedType => "constrained_type", + Python::MemberType => "member_type", Python::KeywordArgument => "keyword_argument", Python::List => "list", Python::Set => "set", @@ -461,10 +516,10 @@ impl From for &'static str { Python::ConditionalExpression => "conditional_expression", Python::ConcatenatedString => "concatenated_string", Python::String => "string", + Python::StringContent => "string_content", Python::Interpolation => "interpolation", - Python::EscapeInterpolation => "_escape_interpolation", + Python::FExpression => "_f_expression", Python::FormatSpecifier => "format_specifier", - Python::FormatExpression => "format_expression", Python::Await => "await", Python::PositionalSeparator => "positional_separator", Python::KeywordSeparator => "keyword_separator", @@ -476,14 +531,18 @@ impl From for &'static str { Python::AssertStatementRepeat1 => "assert_statement_repeat1", Python::IfStatementRepeat1 => "if_statement_repeat1", Python::MatchStatementRepeat1 => "match_statement_repeat1", - Python::MatchStatementRepeat2 => "match_statement_repeat2", + Python::MatchBlockRepeat1 => "_match_block_repeat1", Python::CaseClauseRepeat1 => "case_clause_repeat1", Python::TryStatementRepeat1 => "try_statement_repeat1", + Python::TryStatementRepeat2 => "try_statement_repeat2", Python::WithClauseRepeat1 => "with_clause_repeat1", Python::GlobalStatementRepeat1 => "global_statement_repeat1", + Python::TypeParameterRepeat1 => "type_parameter_repeat1", Python::ArgumentListRepeat1 => "argument_list_repeat1", Python::DecoratedDefinitionRepeat1 => "decorated_definition_repeat1", Python::DottedNameRepeat1 => "dotted_name_repeat1", + Python::UnionPatternRepeat1 => "union_pattern_repeat1", + Python::DictPatternRepeat1 => "dict_pattern_repeat1", Python::ParametersRepeat1 => "_parameters_repeat1", Python::PatternsRepeat1 => "_patterns_repeat1", Python::ComparisonOperatorRepeat1 => "comparison_operator_repeat1", @@ -494,9 +553,12 @@ impl From for &'static str { Python::ForInClauseRepeat1 => "for_in_clause_repeat1", Python::ConcatenatedStringRepeat1 => "concatenated_string_repeat1", Python::StringRepeat1 => "string_repeat1", + Python::StringContentRepeat1 => "string_content_repeat1", Python::FormatSpecifierRepeat1 => "format_specifier_repeat1", Python::AsPatternTarget => "as_pattern_target", - Python::CasePattern => "case_pattern", + Python::FormatExpression => "format_expression", + Python::Isnot => "is not", + Python::Notin => "not in", Python::Error => "ERROR", } } diff --git a/src/languages/language_rust.rs b/src/languages/language_rust.rs index 353193e..9303fae 100644 --- a/src/languages/language_rust.rs +++ b/src/languages/language_rust.rs @@ -10,11 +10,11 @@ pub enum Rust { MacroRulesBANG = 3, LPAREN = 4, RPAREN = 5, - LBRACE = 6, - RBRACE = 7, - EQGT = 8, - LBRACK = 9, - RBRACK = 10, + LBRACK = 6, + RBRACK = 7, + LBRACE = 8, + RBRACE = 9, + EQGT = 10, COLON = 11, DOLLAR = 12, TokenRepetitionPatternToken1 = 13, @@ -51,82 +51,82 @@ pub enum Rust { PrimitiveType15 = 44, PrimitiveType16 = 45, PrimitiveType17 = 46, - NonSpecialTokenToken1 = 47, - SQUOTE = 48, - As = 49, - Async = 50, - Await = 51, - Break = 52, - Const = 53, - Continue = 54, - Default = 55, - Enum = 56, - Fn = 57, - For = 58, - If = 59, - Impl = 60, - Let = 61, - Loop = 62, - Match = 63, - Mod = 64, - Pub = 65, - Return = 66, - Static = 67, - Struct = 68, - Trait = 69, - Type = 70, - Union = 71, - Unsafe = 72, - Use = 73, - Where = 74, - While = 75, - HASH = 76, - BANG = 77, - EQ = 78, - COMMA = 79, - Extern = 80, - Ref = 81, - DASHGT = 82, - LT = 83, - GT = 84, - 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, + DASH = 47, + SLASH = 48, + PERCENT = 49, + CARET = 50, + BANG = 51, + AMP = 52, + PIPE = 53, + AMPAMP = 54, + PIPEPIPE = 55, + LTLT = 56, + GTGT = 57, + PLUSEQ = 58, + DASHEQ = 59, + STAREQ = 60, + SLASHEQ = 61, + PERCENTEQ = 62, + CARETEQ = 63, + AMPEQ = 64, + PIPEEQ = 65, + LTLTEQ = 66, + GTGTEQ = 67, + EQ = 68, + EQEQ = 69, + BANGEQ = 70, + GT = 71, + LT = 72, + GTEQ = 73, + LTEQ = 74, + AT = 75, + UNDERSCORE = 76, + DOT = 77, + DOTDOT = 78, + DOTDOTDOT = 79, + DOTDOTEQ = 80, + COMMA = 81, + COLONCOLON = 82, + DASHGT = 83, + HASH = 84, + SQUOTE = 85, + As = 86, + Async = 87, + Await = 88, + Break = 89, + Const = 90, + Continue = 91, + Default = 92, + Enum = 93, + Fn = 94, + For = 95, + If = 96, + Impl = 97, + Let = 98, + Loop = 99, + Match = 100, + Mod = 101, + Pub = 102, + Return = 103, + Static = 104, + Struct = 105, + Trait = 106, + Type = 107, + Union = 108, + Unsafe = 109, + Use = 110, + Where = 111, + While = 112, + Extern = 113, + Ref = 114, + Else = 115, + In = 116, + LT2 = 117, + Dyn = 118, + MutableSpecifier = 119, + Yield = 120, + Move = 121, + Try = 122, IntegerLiteral = 123, DQUOTE = 124, DQUOTE2 = 125, @@ -134,200 +134,222 @@ pub enum Rust { 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, - StructItem = 158, - UnionItem = 159, - EnumItem = 160, - EnumVariantList = 161, - EnumVariant = 162, - FieldDeclarationList = 163, - FieldDeclaration = 164, - OrderedFieldDeclarationList = 165, - ExternCrateDeclaration = 166, - ConstItem = 167, - StaticItem = 168, - TypeItem = 169, - FunctionItem = 170, - FunctionSignatureItem = 171, - FunctionModifiers = 172, - WhereClause = 173, - WherePredicate = 174, - ImplItem = 175, - TraitItem = 176, - AssociatedType = 177, - TraitBounds = 178, - HigherRankedTraitBound = 179, - RemovedTraitBound = 180, - TypeParameters = 181, - ConstParameter = 182, - ConstrainedTypeParameter = 183, - OptionalTypeParameter = 184, - LetDeclaration = 185, - UseDeclaration = 186, - UseClause = 187, - ScopedUseList = 188, - UseList = 189, - UseAsClause = 190, - UseWildcard = 191, - Parameters = 192, - SelfParameter = 193, - VariadicParameter = 194, - Parameter = 195, - ExternModifier = 196, - VisibilityModifier = 197, - Type2 = 198, - BracketedType = 199, - QualifiedType = 200, - Lifetime = 201, - ArrayType = 202, - ForLifetimes = 203, - FunctionType = 204, - TupleType = 205, - UnitType = 206, - GenericFunction = 207, - GenericType = 208, - GenericTypeWithTurbofish = 209, - BoundedType = 210, - TypeArguments = 211, - TypeBinding = 212, - ReferenceType = 213, - PointerType = 214, - EmptyType = 215, - AbstractType = 216, - DynamicType = 217, - 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, + SLASHSLASH = 130, + LineCommentToken1 = 131, + LineCommentToken2 = 132, + LineCommentToken3 = 133, + InnerDocCommentMarker = 134, + OuterDocCommentMarker = 135, + SLASHSTAR = 136, + STARSLASH = 137, + Shebang = 138, + Zelf = 139, + Super = 140, + Crate = 141, + Metavariable = 142, + StringContent = 143, + RawStringLiteralStart = 144, + StringContent2 = 145, + RawStringLiteralEnd = 146, + FloatLiteral = 147, + OuterDocCommentMarker2 = 148, + InnerDocCommentMarker2 = 149, + BlockCommentContent = 150, + DocComment = 151, + ErrorSentinel = 152, + SourceFile = 153, + Statement = 154, + EmptyStatement = 155, + ExpressionStatement = 156, + MacroDefinition = 157, + MacroRule = 158, + TokenPattern = 159, + TokenTreePattern = 160, + TokenBindingPattern = 161, + TokenRepetitionPattern = 162, + FragmentSpecifier = 163, + TokenTree = 164, + TokenRepetition = 165, + AttributeItem = 166, + InnerAttributeItem = 167, + Attribute = 168, + ModItem = 169, + ForeignModItem = 170, + DeclarationList = 171, + StructItem = 172, + UnionItem = 173, + EnumItem = 174, + EnumVariantList = 175, + EnumVariant = 176, + FieldDeclarationList = 177, + FieldDeclaration = 178, + OrderedFieldDeclarationList = 179, + ExternCrateDeclaration = 180, + ConstItem = 181, + StaticItem = 182, + TypeItem = 183, + FunctionItem = 184, + FunctionSignatureItem = 185, + FunctionModifiers = 186, + WhereClause = 187, + WherePredicate = 188, + ImplItem = 189, + TraitItem = 190, + AssociatedType = 191, + TraitBounds = 192, + HigherRankedTraitBound = 193, + RemovedTraitBound = 194, + TypeParameters = 195, + ConstParameter = 196, + ConstrainedTypeParameter = 197, + OptionalTypeParameter = 198, + LetDeclaration = 199, + UseDeclaration = 200, + UseClause = 201, + ScopedUseList = 202, + UseList = 203, + UseAsClause = 204, + UseWildcard = 205, + Parameters = 206, + SelfParameter = 207, + VariadicParameter = 208, + Parameter = 209, + ExternModifier = 210, + VisibilityModifier = 211, + Type2 = 212, + BracketedType = 213, + QualifiedType = 214, + Lifetime = 215, + ArrayType = 216, + ForLifetimes = 217, + FunctionType = 218, + TupleType = 219, + UnitType = 220, + GenericFunction = 221, + GenericType = 222, + GenericTypeWithTurbofish = 223, + BoundedType = 224, + TypeArguments = 225, + TypeBinding = 226, + ReferenceType = 227, + PointerType = 228, + NeverType = 229, + AbstractType = 230, + DynamicType = 231, + ExpressionExceptRange = 232, + Expression = 233, + MacroInvocation = 234, + TokenTree2 = 235, + DelimTokens = 236, + NonDelimToken = 237, + ScopedIdentifier = 238, + ScopedTypeIdentifier = 239, + ScopedTypeIdentifier2 = 240, + RangeExpression = 241, + UnaryExpression = 242, + TryExpression = 243, + ReferenceExpression = 244, + BinaryExpression = 245, + AssignmentExpression = 246, + CompoundAssignmentExpr = 247, + TypeCastExpression = 248, + ReturnExpression = 249, + YieldExpression = 250, + CallExpression = 251, + Arguments = 252, + ArrayExpression = 253, + ParenthesizedExpression = 254, + TupleExpression = 255, + UnitExpression = 256, + StructExpression = 257, + FieldInitializerList = 258, + ShorthandFieldInitializer = 259, + FieldInitializer = 260, + BaseFieldInitializer = 261, + IfExpression = 262, + LetCondition = 263, + LetChain2 = 264, + Condition = 265, + ElseClause = 266, + MatchExpression = 267, + MatchBlock = 268, + MatchArm = 269, + MatchArm2 = 270, + MatchPattern = 271, + WhileExpression = 272, + LoopExpression = 273, + ForExpression = 274, + ConstBlock = 275, + ClosureExpression = 276, + ClosureParameters = 277, + Label = 278, + BreakExpression = 279, + ContinueExpression = 280, + IndexExpression = 281, + AwaitExpression = 282, + FieldExpression = 283, + UnsafeBlock = 284, + AsyncBlock = 285, + TryBlock = 286, + Block = 287, + Pattern = 288, + TuplePattern = 289, + SlicePattern = 290, + TupleStructPattern = 291, + StructPattern = 292, + FieldPattern = 293, + RemainingFieldPattern = 294, + MutPattern = 295, + RangePattern = 296, + RefPattern = 297, + CapturedPattern = 298, + ReferencePattern = 299, + OrPattern = 300, + Literal2 = 301, + LiteralPattern = 302, + NegativeLiteral = 303, + StringLiteral = 304, + RawStringLiteral = 305, + BooleanLiteral = 306, + LineComment = 307, + LineDocCommentMarker = 308, + BlockComment = 309, + BlockDocCommentMarker = 310, + SourceFileRepeat1 = 311, + MacroDefinitionRepeat1 = 312, + TokenTreePatternRepeat1 = 313, + TokenTreeRepeat1 = 314, + NonSpecialTokenRepeat1 = 315, + DeclarationListRepeat1 = 316, + EnumVariantListRepeat1 = 317, + EnumVariantListRepeat2 = 318, + FieldDeclarationListRepeat1 = 319, + OrderedFieldDeclarationListRepeat1 = 320, + FunctionModifiersRepeat1 = 321, + WhereClauseRepeat1 = 322, + TraitBoundsRepeat1 = 323, + TypeParametersRepeat1 = 324, + UseListRepeat1 = 325, + ParametersRepeat1 = 326, + ForLifetimesRepeat1 = 327, + TupleTypeRepeat1 = 328, + TypeArgumentsRepeat1 = 329, + DelimTokenTreeRepeat1 = 330, + ArgumentsRepeat1 = 331, + TupleExpressionRepeat1 = 332, + FieldInitializerListRepeat1 = 333, + MatchBlockRepeat1 = 334, + MatchArmRepeat1 = 335, + ClosureParametersRepeat1 = 336, + TuplePatternRepeat1 = 337, + SlicePatternRepeat1 = 338, + StructPatternRepeat1 = 339, + StringLiteralRepeat1 = 340, + FieldIdentifier = 341, + LetChain = 342, + ShorthandFieldIdentifier = 343, + TypeIdentifier = 344, + Error = 345, } impl From for &'static str { @@ -340,11 +362,11 @@ impl From for &'static str { Rust::MacroRulesBANG => "macro_rules!", Rust::LPAREN => "(", Rust::RPAREN => ")", + Rust::LBRACK => "[", + Rust::RBRACK => "]", Rust::LBRACE => "{", Rust::RBRACE => "}", Rust::EQGT => "=>", - Rust::LBRACK => "[", - Rust::RBRACK => "]", Rust::COLON => ":", Rust::DOLLAR => "$", Rust::TokenRepetitionPatternToken1 => "token_repetition_pattern_token1", @@ -381,7 +403,44 @@ impl From for &'static str { Rust::PrimitiveType15 => "primitive_type", Rust::PrimitiveType16 => "primitive_type", Rust::PrimitiveType17 => "primitive_type", - Rust::NonSpecialTokenToken1 => "_non_special_token_token1", + Rust::DASH => "-", + Rust::SLASH => "/", + Rust::PERCENT => "%", + Rust::CARET => "^", + Rust::BANG => "!", + Rust::AMP => "&", + Rust::PIPE => "|", + Rust::AMPAMP => "&&", + Rust::PIPEPIPE => "||", + Rust::LTLT => "<<", + Rust::GTGT => ">>", + Rust::PLUSEQ => "+=", + Rust::DASHEQ => "-=", + Rust::STAREQ => "*=", + Rust::SLASHEQ => "/=", + Rust::PERCENTEQ => "%=", + Rust::CARETEQ => "^=", + Rust::AMPEQ => "&=", + Rust::PIPEEQ => "|=", + Rust::LTLTEQ => "<<=", + Rust::GTGTEQ => ">>=", + Rust::EQ => "=", + Rust::EQEQ => "==", + Rust::BANGEQ => "!=", + Rust::GT => ">", + Rust::LT => "<", + Rust::GTEQ => ">=", + Rust::LTEQ => "<=", + Rust::AT => "@", + Rust::UNDERSCORE => "_", + Rust::DOT => ".", + Rust::DOTDOT => "..", + Rust::DOTDOTDOT => "...", + Rust::DOTDOTEQ => "..=", + Rust::COMMA => ",", + Rust::COLONCOLON => "::", + Rust::DASHGT => "->", + Rust::HASH => "#", Rust::SQUOTE => "'", Rust::As => "as", Rust::Async => "async", @@ -410,53 +469,16 @@ impl From for &'static str { Rust::Use => "use", Rust::Where => "where", Rust::While => "while", - Rust::HASH => "#", - Rust::BANG => "!", - Rust::EQ => "=", - Rust::COMMA => ",", Rust::Extern => "extern", Rust::Ref => "ref", - Rust::DASHGT => "->", - Rust::LT => "<", - Rust::GT => ">", Rust::Else => "else", - Rust::COLONCOLON => "::", - Rust::UNDERSCORE => "_", - Rust::AMP => "&", - Rust::DOTDOTDOT => "...", Rust::In => "in", Rust::LT2 => "<", Rust::Dyn => "dyn", Rust::MutableSpecifier => "mutable_specifier", - Rust::DOTDOT => "..", - Rust::DOTDOTEQ => "..=", - Rust::DASH => "-", - Rust::AMPAMP => "&&", - Rust::PIPEPIPE => "||", - Rust::PIPE => "|", - Rust::CARET => "^", - Rust::EQEQ => "==", - Rust::BANGEQ => "!=", - Rust::LTEQ => "<=", - Rust::GTEQ => ">=", - Rust::LTLT => "<<", - Rust::GTGT => ">>", - Rust::SLASH => "/", - Rust::PERCENT => "%", - Rust::PLUSEQ => "+=", - Rust::DASHEQ => "-=", - Rust::STAREQ => "*=", - Rust::SLASHEQ => "/=", - Rust::PERCENTEQ => "%=", - Rust::AMPEQ => "&=", - Rust::PIPEEQ => "|=", - Rust::CARETEQ => "^=", - Rust::LTLTEQ => "<<=", - Rust::GTGTEQ => ">>=", Rust::Yield => "yield", Rust::Move => "move", - Rust::DOT => ".", - Rust::AT => "@", + Rust::Try => "try", Rust::IntegerLiteral => "integer_literal", Rust::DQUOTE => "\"", Rust::DQUOTE2 => "\"", @@ -464,15 +486,29 @@ impl From for &'static str { Rust::EscapeSequence => "escape_sequence", Rust::True => "true", Rust::False => "false", - Rust::LineComment => "line_comment", + Rust::SLASHSLASH => "//", + Rust::LineCommentToken1 => "line_comment_token1", + Rust::LineCommentToken2 => "line_comment_token2", + Rust::LineCommentToken3 => "line_comment_token3", + Rust::InnerDocCommentMarker => "inner_doc_comment_marker", + Rust::OuterDocCommentMarker => "outer_doc_comment_marker", + Rust::SLASHSTAR => "/*", + Rust::STARSLASH => "*/", + Rust::Shebang => "shebang", Rust::Zelf => "self", Rust::Super => "super", Rust::Crate => "crate", Rust::Metavariable => "metavariable", - Rust::StringContent => "_string_content", - Rust::RawStringLiteral => "raw_string_literal", + Rust::StringContent => "string_content", + Rust::RawStringLiteralStart => "_raw_string_literal_start", + Rust::StringContent2 => "string_content", + Rust::RawStringLiteralEnd => "_raw_string_literal_end", Rust::FloatLiteral => "float_literal", - Rust::BlockComment => "block_comment", + Rust::OuterDocCommentMarker2 => "outer_doc_comment_marker", + Rust::InnerDocCommentMarker2 => "inner_doc_comment_marker", + Rust::BlockCommentContent => "_block_comment_content", + Rust::DocComment => "doc_comment", + Rust::ErrorSentinel => "_error_sentinel", Rust::SourceFile => "source_file", Rust::Statement => "_statement", Rust::EmptyStatement => "empty_statement", @@ -549,7 +585,7 @@ impl From for &'static str { Rust::TypeBinding => "type_binding", Rust::ReferenceType => "reference_type", Rust::PointerType => "pointer_type", - Rust::EmptyType => "empty_type", + Rust::NeverType => "never_type", Rust::AbstractType => "abstract_type", Rust::DynamicType => "dynamic_type", Rust::ExpressionExceptRange => "_expression_except_range", @@ -598,7 +634,7 @@ impl From for &'static str { Rust::ConstBlock => "const_block", Rust::ClosureExpression => "closure_expression", Rust::ClosureParameters => "closure_parameters", - Rust::LoopLabel => "loop_label", + Rust::Label => "label", Rust::BreakExpression => "break_expression", Rust::ContinueExpression => "continue_expression", Rust::IndexExpression => "index_expression", @@ -606,6 +642,7 @@ impl From for &'static str { Rust::FieldExpression => "field_expression", Rust::UnsafeBlock => "unsafe_block", Rust::AsyncBlock => "async_block", + Rust::TryBlock => "try_block", Rust::Block => "block", Rust::Pattern => "_pattern", Rust::TuplePattern => "tuple_pattern", @@ -624,11 +661,17 @@ impl From for &'static str { Rust::LiteralPattern => "_literal_pattern", Rust::NegativeLiteral => "negative_literal", Rust::StringLiteral => "string_literal", + Rust::RawStringLiteral => "raw_string_literal", Rust::BooleanLiteral => "boolean_literal", + Rust::LineComment => "line_comment", + Rust::LineDocCommentMarker => "_line_doc_comment_marker", + Rust::BlockComment => "block_comment", + Rust::BlockDocCommentMarker => "_block_doc_comment_marker", Rust::SourceFileRepeat1 => "source_file_repeat1", Rust::MacroDefinitionRepeat1 => "macro_definition_repeat1", Rust::TokenTreePatternRepeat1 => "token_tree_pattern_repeat1", Rust::TokenTreeRepeat1 => "token_tree_repeat1", + Rust::NonSpecialTokenRepeat1 => "_non_special_token_repeat1", Rust::DeclarationListRepeat1 => "declaration_list_repeat1", Rust::EnumVariantListRepeat1 => "enum_variant_list_repeat1", Rust::EnumVariantListRepeat2 => "enum_variant_list_repeat2", @@ -645,12 +688,13 @@ impl From for &'static str { 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", Rust::FieldInitializerListRepeat1 => "field_initializer_list_repeat1", Rust::MatchBlockRepeat1 => "match_block_repeat1", + Rust::MatchArmRepeat1 => "match_arm_repeat1", Rust::ClosureParametersRepeat1 => "closure_parameters_repeat1", Rust::TuplePatternRepeat1 => "tuple_pattern_repeat1", + Rust::SlicePatternRepeat1 => "slice_pattern_repeat1", Rust::StructPatternRepeat1 => "struct_pattern_repeat1", Rust::StringLiteralRepeat1 => "string_literal_repeat1", Rust::FieldIdentifier => "field_identifier", diff --git a/src/languages/language_tsx.rs b/src/languages/language_tsx.rs index 153f7d2..31a0031 100644 --- a/src/languages/language_tsx.rs +++ b/src/languages/language_tsx.rs @@ -20,23 +20,23 @@ pub enum Tsx { Typeof = 13, Import2 = 14, From = 15, - Var = 16, - Let = 17, - Const = 18, - BANG = 19, - Else = 20, - If = 21, - Switch = 22, - For = 23, - LPAREN = 24, - RPAREN = 25, - Await = 26, - In = 27, - Of = 28, - While = 29, - Do = 30, - Try = 31, - With = 32, + With = 16, + Var = 17, + Let = 18, + Const = 19, + BANG = 20, + Else = 21, + If = 22, + Switch = 23, + For = 24, + LPAREN = 25, + RPAREN = 26, + Await = 27, + In = 28, + Of = 29, + While = 30, + Do = 31, + Try = 32, Break = 33, Continue = 34, Debugger = 35, @@ -50,328 +50,365 @@ pub enum Tsx { Yield = 43, LBRACK = 44, RBRACK = 45, - LT = 46, - GT = 47, - SLASH = 48, - JsxText = 49, - Identifier2 = 50, - DOT = 51, - Class2 = 52, - Async = 53, - Function2 = 54, - EQGT = 55, - QMARKDOT = 56, - New = 57, - PLUSEQ = 58, - DASHEQ = 59, - STAREQ = 60, - SLASHEQ = 61, - PERCENTEQ = 62, - CARETEQ = 63, - AMPEQ = 64, - PIPEEQ = 65, - GTGTEQ = 66, - GTGTGTEQ = 67, - LTLTEQ = 68, - STARSTAREQ = 69, - AMPAMPEQ = 70, - PIPEPIPEEQ = 71, - QMARKQMARKEQ = 72, - DOTDOTDOT = 73, - 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, - Protected = 128, - Override = 129, - Module2 = 130, - Any = 131, - Number2 = 132, - Boolean = 133, - String2 = 134, - Symbol = 135, - Abstract = 136, - Require = 137, - Extends = 138, - Implements = 139, - Global = 140, - Interface = 141, - Enum = 142, - DASHQMARKCOLON = 143, - QMARKCOLON = 144, - Asserts2 = 145, - Infer = 146, - Is = 147, - Keyof = 148, - Unknown = 149, - Never = 150, - Object2 = 151, - LBRACEPIPE = 152, - PIPERBRACE = 153, - AutomaticSemicolon = 154, - TemplateChars = 155, - 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, - TypeAliasDeclaration = 280, - AccessibilityModifier = 281, - OverrideModifier = 282, - RequiredParameter = 283, - OptionalParameter = 284, - ParameterName = 285, - OmittingTypeAnnotation = 286, - OptingTypeAnnotation = 287, - TypeAnnotation = 288, - Asserts = 289, - Type2 = 290, - RequiredParameter2 = 291, - OptionalParameter2 = 292, - OptionalType = 293, - RestType = 294, - TupleTypeMember = 295, - ConstructorType = 296, - PrimaryType = 297, - TemplateType = 298, - TemplateLiteralType = 299, - InferType = 300, - ConditionalType = 301, - GenericType = 302, - TypePredicate = 303, - TypePredicateAnnotation = 304, - MemberExpression3 = 305, - SubscriptExpression2 = 306, - CallExpression3 = 307, - TypeQuery = 308, - IndexTypeQuery = 309, - LookupType = 310, - MappedTypeClause = 311, - LiteralType = 312, - UnaryExpression2 = 313, - ExistentialType = 314, - FlowMaybeType = 315, - ParenthesizedType = 316, - PredefinedType = 317, - TypeArguments = 318, - ObjectType = 319, - CallSignature = 320, - PropertySignature = 321, - TypeParameters = 322, - TypeParameter = 323, - DefaultType = 324, - Constraint = 325, - ConstructSignature = 326, - IndexSignature = 327, - ArrayType = 328, - TupleType = 329, - ReadonlyType = 330, - UnionType = 331, - IntersectionType = 332, - FunctionType = 333, - ProgramRepeat1 = 334, - ExportStatementRepeat1 = 335, - ExportClauseRepeat1 = 336, - NamedImportsRepeat1 = 337, - VariableDeclarationRepeat1 = 338, - SwitchBodyRepeat1 = 339, - ObjectRepeat1 = 340, - ObjectPatternRepeat1 = 341, - ArrayRepeat1 = 342, - ArrayPatternRepeat1 = 343, - JsxElementRepeat1 = 344, - StringRepeat1 = 345, - StringRepeat2 = 346, - TemplateStringRepeat1 = 347, - ClassBodyRepeat1 = 348, - FormalParametersRepeat1 = 349, - JsxStartOpeningElementRepeat1 = 350, - 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, + GlimmerTemplateContent = 46, + GlimmerOpeningTag = 47, + GlimmerClosingTag = 48, + JsxTextToken1 = 49, + JsxTextToken2 = 50, + HtmlCharacterReference = 51, + GT = 52, + Identifier2 = 53, + DOT = 54, + LTSLASH = 55, + SLASHGT = 56, + DQUOTE = 57, + SQUOTE = 58, + StringFragment = 59, + StringFragment2 = 60, + Class2 = 61, + Async = 62, + Function = 63, + EQGT = 64, + QMARKDOT = 65, + New = 66, + Using = 67, + PLUSEQ = 68, + DASHEQ = 69, + STAREQ = 70, + SLASHEQ = 71, + PERCENTEQ = 72, + CARETEQ = 73, + AMPEQ = 74, + PIPEEQ = 75, + GTGTEQ = 76, + GTGTGTEQ = 77, + LTLTEQ = 78, + STARSTAREQ = 79, + AMPAMPEQ = 80, + PIPEPIPEEQ = 81, + QMARKQMARKEQ = 82, + DOTDOTDOT = 83, + AMPAMP = 84, + PIPEPIPE = 85, + GTGT = 86, + GTGTGT = 87, + LTLT = 88, + AMP = 89, + CARET = 90, + PIPE = 91, + PLUS = 92, + DASH = 93, + SLASH = 94, + PERCENT = 95, + STARSTAR = 96, + LT = 97, + LTEQ = 98, + EQEQ = 99, + EQEQEQ = 100, + BANGEQ = 101, + BANGEQEQ = 102, + GTEQ = 103, + QMARKQMARK = 104, + Instanceof = 105, + TILDE = 106, + Void = 107, + Delete = 108, + PLUSPLUS = 109, + DASHDASH = 110, + StringFragment3 = 111, + StringFragment4 = 112, + EscapeSequence = 113, + Comment = 114, + BQUOTE = 115, + DOLLARLBRACE = 116, + SLASH2 = 117, + RegexPattern = 118, + RegexFlags = 119, + Number = 120, + PrivatePropertyIdentifier = 121, + Target = 122, + This = 123, + Super = 124, + True = 125, + False = 126, + Null = 127, + Undefined = 128, + AT = 129, + Static = 130, + Readonly = 131, + Get = 132, + Set = 133, + QMARK = 134, + Declare = 135, + Public = 136, + Private = 137, + Protected = 138, + Override = 139, + Module2 = 140, + Any = 141, + Number2 = 142, + Boolean = 143, + String3 = 144, + Symbol = 145, + Object2 = 146, + Abstract = 147, + Accessor = 148, + Satisfies = 149, + Require = 150, + Extends = 151, + Implements = 152, + Global = 153, + Interface = 154, + Enum = 155, + DASHQMARKCOLON = 156, + PLUSQMARKCOLON = 157, + QMARKCOLON = 158, + Asserts2 = 159, + Infer = 160, + Is = 161, + Keyof = 162, + Uniquesymbol = 163, + Unknown = 164, + Never = 165, + LBRACEPIPE = 166, + PIPERBRACE = 167, + AutomaticSemicolon = 168, + StringFragment5 = 169, + QMARK2 = 170, + HtmlComment = 171, + FunctionSignatureAutomaticSemicolon = 172, + ErrorRecovery = 173, + Program = 174, + ExportStatement = 175, + NamespaceExport = 176, + ExportClause = 177, + ExportSpecifier = 178, + ModuleExportName = 179, + Declaration = 180, + Import = 181, + ImportStatement = 182, + ImportClause = 183, + FromClause = 184, + NamespaceImport = 185, + NamedImports = 186, + ImportSpecifier = 187, + ImportAttribute = 188, + Statement = 189, + ExpressionStatement = 190, + VariableDeclaration = 191, + LexicalDeclaration = 192, + VariableDeclarator = 193, + StatementBlock = 194, + ElseClause = 195, + IfStatement = 196, + SwitchStatement = 197, + ForStatement = 198, + ForInStatement = 199, + ForHeader = 200, + WhileStatement = 201, + DoStatement = 202, + TryStatement = 203, + WithStatement = 204, + BreakStatement = 205, + ContinueStatement = 206, + DebuggerStatement = 207, + ReturnStatement = 208, + ThrowStatement = 209, + EmptyStatement = 210, + LabeledStatement = 211, + SwitchBody = 212, + SwitchCase = 213, + SwitchDefault = 214, + CatchClause = 215, + FinallyClause = 216, + ParenthesizedExpression = 217, + Expression = 218, + PrimaryExpression = 219, + YieldExpression = 220, + Object = 221, + ObjectPattern = 222, + AssignmentPattern = 223, + ObjectAssignmentPattern = 224, + Array = 225, + ArrayPattern = 226, + GlimmerTemplate = 227, + JsxElement = 228, + JsxText = 229, + JsxExpression = 230, + JsxOpeningElement = 231, + NestedIdentifier = 232, + JsxNamespaceName = 233, + JsxClosingElement = 234, + JsxSelfClosingElement = 235, + JsxAttribute = 236, + String = 237, + Class = 238, + ClassDeclaration = 239, + ClassHeritage = 240, + FunctionExpression = 241, + FunctionDeclaration = 242, + GeneratorFunction = 243, + GeneratorFunctionDeclaration = 244, + ArrowFunction = 245, + CallSignature2 = 246, + FormalParameter = 247, + OptionalChain = 248, + CallExpression = 249, + NewExpression = 250, + AwaitExpression = 251, + MemberExpression = 252, + SubscriptExpression = 253, + AssignmentExpression = 254, + AugmentedAssignmentLhs = 255, + AugmentedAssignmentExpression = 256, + Initializer = 257, + DestructuringPattern = 258, + SpreadElement = 259, + TernaryExpression = 260, + BinaryExpression = 261, + UnaryExpression = 262, + UpdateExpression = 263, + SequenceExpression = 264, + String2 = 265, + TemplateString = 266, + TemplateSubstitution = 267, + Regex = 268, + MetaProperty = 269, + Arguments = 270, + Decorator = 271, + MemberExpression2 = 272, + CallExpression2 = 273, + ClassBody = 274, + FormalParameters = 275, + ClassStaticBlock = 276, + Pattern = 277, + RestPattern = 278, + MethodDefinition = 279, + Pair = 280, + PairPattern = 281, + PropertyName = 282, + ComputedPropertyName = 283, + PublicFieldDefinition = 284, + ImportIdentifier = 285, + NonNullExpression = 286, + MethodSignature = 287, + AbstractMethodSignature = 288, + FunctionSignature = 289, + AsExpression = 290, + SatisfiesExpression = 291, + InstantiationExpression = 292, + ImportRequireClause = 293, + ExtendsClause = 294, + ExtendsClauseSingle = 295, + ImplementsClause = 296, + AmbientDeclaration = 297, + AbstractClassDeclaration = 298, + Module = 299, + InternalModule = 300, + Module3 = 301, + ImportAlias = 302, + NestedTypeIdentifier = 303, + InterfaceDeclaration = 304, + ExtendsTypeClause = 305, + EnumDeclaration = 306, + EnumBody = 307, + EnumAssignment = 308, + TypeAliasDeclaration = 309, + AccessibilityModifier = 310, + OverrideModifier = 311, + RequiredParameter = 312, + OptionalParameter = 313, + ParameterName = 314, + OmittingTypeAnnotation = 315, + AddingTypeAnnotation = 316, + OptingTypeAnnotation = 317, + TypeAnnotation = 318, + MemberExpression3 = 319, + CallExpression3 = 320, + Asserts = 321, + AssertsAnnotation = 322, + Type2 = 323, + RequiredParameter2 = 324, + OptionalParameter2 = 325, + OptionalType = 326, + RestType = 327, + TupleTypeMember = 328, + ConstructorType = 329, + PrimaryType = 330, + TemplateType = 331, + TemplateLiteralType = 332, + InferType = 333, + ConditionalType = 334, + GenericType = 335, + TypePredicate = 336, + TypePredicateAnnotation = 337, + MemberExpression4 = 338, + SubscriptExpression2 = 339, + CallExpression4 = 340, + InstantiationExpression2 = 341, + TypeQuery = 342, + IndexTypeQuery = 343, + LookupType = 344, + MappedTypeClause = 345, + LiteralType = 346, + UnaryExpression2 = 347, + ExistentialType = 348, + FlowMaybeType = 349, + ParenthesizedType = 350, + PredefinedType = 351, + TypeArguments = 352, + ObjectType = 353, + CallSignature = 354, + PropertySignature = 355, + TypeParameters = 356, + TypeParameter = 357, + DefaultType = 358, + Constraint = 359, + ConstructSignature = 360, + IndexSignature = 361, + ArrayType = 362, + TupleType = 363, + ReadonlyType = 364, + UnionType = 365, + IntersectionType = 366, + FunctionType = 367, + ProgramRepeat1 = 368, + ExportStatementRepeat1 = 369, + ExportClauseRepeat1 = 370, + NamedImportsRepeat1 = 371, + VariableDeclarationRepeat1 = 372, + SwitchBodyRepeat1 = 373, + ObjectRepeat1 = 374, + ObjectPatternRepeat1 = 375, + ArrayRepeat1 = 376, + ArrayPatternRepeat1 = 377, + GlimmerTemplateRepeat1 = 378, + JsxElementRepeat1 = 379, + JsxStringRepeat1 = 380, + JsxStringRepeat2 = 381, + SequenceExpressionRepeat1 = 382, + StringRepeat1 = 383, + StringRepeat2 = 384, + TemplateStringRepeat1 = 385, + ClassBodyRepeat1 = 386, + FormalParametersRepeat1 = 387, + JsxStartOpeningElementRepeat1 = 388, + ExtendsClauseRepeat1 = 389, + ImplementsClauseRepeat1 = 390, + ExtendsTypeClauseRepeat1 = 391, + EnumBodyRepeat1 = 392, + TemplateLiteralTypeRepeat1 = 393, + ObjectTypeRepeat1 = 394, + TypeParametersRepeat1 = 395, + TupleTypeRepeat1 = 396, + InterfaceBody = 397, + PropertyIdentifier = 398, + ShorthandPropertyIdentifier = 399, + ShorthandPropertyIdentifierPattern = 400, + StatementIdentifier = 401, + ThisType = 402, + TypeIdentifier = 403, + Error = 404, } impl From for &'static str { @@ -394,6 +431,7 @@ impl From for &'static str { Tsx::Typeof => "typeof", Tsx::Import2 => "import", Tsx::From => "from", + Tsx::With => "with", Tsx::Var => "var", Tsx::Let => "let", Tsx::Const => "const", @@ -410,7 +448,6 @@ impl From for &'static str { Tsx::While => "while", Tsx::Do => "do", Tsx::Try => "try", - Tsx::With => "with", Tsx::Break => "break", Tsx::Continue => "continue", Tsx::Debugger => "debugger", @@ -424,18 +461,28 @@ impl From for &'static str { Tsx::Yield => "yield", Tsx::LBRACK => "[", Tsx::RBRACK => "]", - Tsx::LT => "<", + Tsx::GlimmerTemplateContent => "_glimmer_template_content", + Tsx::GlimmerOpeningTag => "glimmer_opening_tag", + Tsx::GlimmerClosingTag => "glimmer_closing_tag", + Tsx::JsxTextToken1 => "jsx_text_token1", + Tsx::JsxTextToken2 => "jsx_text_token2", + Tsx::HtmlCharacterReference => "html_character_reference", Tsx::GT => ">", - Tsx::SLASH => "/", - Tsx::JsxText => "jsx_text", Tsx::Identifier2 => "identifier", Tsx::DOT => ".", + Tsx::LTSLASH => " "/>", + Tsx::DQUOTE => "\"", + Tsx::SQUOTE => "'", + Tsx::StringFragment => "string_fragment", + Tsx::StringFragment2 => "string_fragment", Tsx::Class2 => "class", Tsx::Async => "async", - Tsx::Function2 => "function", + Tsx::Function => "function", Tsx::EQGT => "=>", Tsx::QMARKDOT => "?.", Tsx::New => "new", + Tsx::Using => "using", Tsx::PLUSEQ => "+=", Tsx::DASHEQ => "-=", Tsx::STAREQ => "*=", @@ -462,8 +509,10 @@ impl From for &'static str { Tsx::PIPE => "|", Tsx::PLUS => "+", Tsx::DASH => "-", + Tsx::SLASH => "/", Tsx::PERCENT => "%", Tsx::STARSTAR => "**", + Tsx::LT => "<", Tsx::LTEQ => "<=", Tsx::EQEQ => "==", Tsx::EQEQEQ => "===", @@ -477,10 +526,8 @@ impl From for &'static str { Tsx::Delete => "delete", Tsx::PLUSPLUS => "++", Tsx::DASHDASH => "--", - Tsx::DQUOTE => "\"", - Tsx::SQUOTE => "'", - Tsx::StringFragment => "string_fragment", - Tsx::StringFragment2 => "string_fragment", + Tsx::StringFragment3 => "string_fragment", + Tsx::StringFragment4 => "string_fragment", Tsx::EscapeSequence => "escape_sequence", Tsx::Comment => "comment", Tsx::BQUOTE => "`", @@ -512,9 +559,12 @@ impl From for &'static str { Tsx::Any => "any", Tsx::Number2 => "number", Tsx::Boolean => "boolean", - Tsx::String2 => "string", + Tsx::String3 => "string", Tsx::Symbol => "symbol", + Tsx::Object2 => "object", Tsx::Abstract => "abstract", + Tsx::Accessor => "accessor", + Tsx::Satisfies => "satisfies", Tsx::Require => "require", Tsx::Extends => "extends", Tsx::Implements => "implements", @@ -522,24 +572,29 @@ impl From for &'static str { Tsx::Interface => "interface", Tsx::Enum => "enum", Tsx::DASHQMARKCOLON => "-?:", + Tsx::PLUSQMARKCOLON => "+?:", Tsx::QMARKCOLON => "?:", Tsx::Asserts2 => "asserts", Tsx::Infer => "infer", Tsx::Is => "is", Tsx::Keyof => "keyof", + Tsx::Uniquesymbol => "unique symbol", Tsx::Unknown => "unknown", Tsx::Never => "never", - Tsx::Object2 => "object", Tsx::LBRACEPIPE => "{|", Tsx::PIPERBRACE => "|}", Tsx::AutomaticSemicolon => "_automatic_semicolon", - Tsx::TemplateChars => "_template_chars", + Tsx::StringFragment5 => "string_fragment", Tsx::QMARK2 => "?", + Tsx::HtmlComment => "html_comment", Tsx::FunctionSignatureAutomaticSemicolon => "_function_signature_automatic_semicolon", + Tsx::ErrorRecovery => "__error_recovery", Tsx::Program => "program", Tsx::ExportStatement => "export_statement", + Tsx::NamespaceExport => "namespace_export", Tsx::ExportClause => "export_clause", Tsx::ExportSpecifier => "export_specifier", + Tsx::ModuleExportName => "_module_export_name", Tsx::Declaration => "declaration", Tsx::Import => "import", Tsx::ImportStatement => "import_statement", @@ -547,6 +602,9 @@ impl From for &'static str { Tsx::FromClause => "_from_clause", Tsx::NamespaceImport => "namespace_import", Tsx::NamedImports => "named_imports", + Tsx::ImportSpecifier => "import_specifier", + Tsx::ImportAttribute => "import_attribute", + Tsx::Statement => "statement", Tsx::ExpressionStatement => "expression_statement", Tsx::VariableDeclaration => "variable_declaration", Tsx::LexicalDeclaration => "lexical_declaration", @@ -584,8 +642,9 @@ impl From for &'static str { Tsx::ObjectAssignmentPattern => "object_assignment_pattern", Tsx::Array => "array", Tsx::ArrayPattern => "array_pattern", + Tsx::GlimmerTemplate => "glimmer_template", Tsx::JsxElement => "jsx_element", - Tsx::JsxFragment => "jsx_fragment", + Tsx::JsxText => "jsx_text", Tsx::JsxExpression => "jsx_expression", Tsx::JsxOpeningElement => "jsx_opening_element", Tsx::NestedIdentifier => "nested_identifier", @@ -593,16 +652,18 @@ impl From for &'static str { Tsx::JsxClosingElement => "jsx_closing_element", Tsx::JsxSelfClosingElement => "jsx_self_closing_element", Tsx::JsxAttribute => "jsx_attribute", + Tsx::String => "string", Tsx::Class => "class", Tsx::ClassDeclaration => "class_declaration", Tsx::ClassHeritage => "class_heritage", - Tsx::Function => "function", + Tsx::FunctionExpression => "function_expression", Tsx::FunctionDeclaration => "function_declaration", Tsx::GeneratorFunction => "generator_function", Tsx::GeneratorFunctionDeclaration => "generator_function_declaration", Tsx::ArrowFunction => "arrow_function", Tsx::CallSignature2 => "_call_signature", Tsx::FormalParameter => "_formal_parameter", + Tsx::OptionalChain => "optional_chain", Tsx::CallExpression => "call_expression", Tsx::NewExpression => "new_expression", Tsx::AwaitExpression => "await_expression", @@ -619,7 +680,7 @@ impl From for &'static str { Tsx::UnaryExpression => "unary_expression", Tsx::UpdateExpression => "update_expression", Tsx::SequenceExpression => "sequence_expression", - Tsx::String => "string", + Tsx::String2 => "string", Tsx::TemplateString => "template_string", Tsx::TemplateSubstitution => "template_substitution", Tsx::Regex => "regex", @@ -630,6 +691,7 @@ impl From for &'static str { Tsx::CallExpression2 => "call_expression", Tsx::ClassBody => "class_body", Tsx::FormalParameters => "formal_parameters", + Tsx::ClassStaticBlock => "class_static_block", Tsx::Pattern => "pattern", Tsx::RestPattern => "rest_pattern", Tsx::MethodDefinition => "method_definition", @@ -638,13 +700,17 @@ impl From for &'static str { Tsx::PropertyName => "_property_name", Tsx::ComputedPropertyName => "computed_property_name", Tsx::PublicFieldDefinition => "public_field_definition", + Tsx::ImportIdentifier => "_import_identifier", Tsx::NonNullExpression => "non_null_expression", Tsx::MethodSignature => "method_signature", Tsx::AbstractMethodSignature => "abstract_method_signature", Tsx::FunctionSignature => "function_signature", Tsx::AsExpression => "as_expression", + Tsx::SatisfiesExpression => "satisfies_expression", + Tsx::InstantiationExpression => "instantiation_expression", Tsx::ImportRequireClause => "import_require_clause", Tsx::ExtendsClause => "extends_clause", + Tsx::ExtendsClauseSingle => "_extends_clause_single", Tsx::ImplementsClause => "implements_clause", Tsx::AmbientDeclaration => "ambient_declaration", Tsx::AbstractClassDeclaration => "abstract_class_declaration", @@ -665,17 +731,21 @@ impl From for &'static str { Tsx::OptionalParameter => "optional_parameter", Tsx::ParameterName => "_parameter_name", Tsx::OmittingTypeAnnotation => "omitting_type_annotation", + Tsx::AddingTypeAnnotation => "adding_type_annotation", Tsx::OptingTypeAnnotation => "opting_type_annotation", Tsx::TypeAnnotation => "type_annotation", + Tsx::MemberExpression3 => "member_expression", + Tsx::CallExpression3 => "call_expression", Tsx::Asserts => "asserts", - Tsx::Type2 => "_type", + Tsx::AssertsAnnotation => "asserts_annotation", + Tsx::Type2 => "type", Tsx::RequiredParameter2 => "required_parameter", Tsx::OptionalParameter2 => "optional_parameter", Tsx::OptionalType => "optional_type", Tsx::RestType => "rest_type", Tsx::TupleTypeMember => "_tuple_type_member", Tsx::ConstructorType => "constructor_type", - Tsx::PrimaryType => "_primary_type", + Tsx::PrimaryType => "primary_type", Tsx::TemplateType => "template_type", Tsx::TemplateLiteralType => "template_literal_type", Tsx::InferType => "infer_type", @@ -683,9 +753,10 @@ impl From for &'static str { Tsx::GenericType => "generic_type", Tsx::TypePredicate => "type_predicate", Tsx::TypePredicateAnnotation => "type_predicate_annotation", - Tsx::MemberExpression3 => "member_expression", + Tsx::MemberExpression4 => "member_expression", Tsx::SubscriptExpression2 => "subscript_expression", - Tsx::CallExpression3 => "call_expression", + Tsx::CallExpression4 => "call_expression", + Tsx::InstantiationExpression2 => "instantiation_expression", Tsx::TypeQuery => "type_query", Tsx::IndexTypeQuery => "index_type_query", Tsx::LookupType => "lookup_type", @@ -722,7 +793,11 @@ impl From for &'static str { Tsx::ObjectPatternRepeat1 => "object_pattern_repeat1", Tsx::ArrayRepeat1 => "array_repeat1", Tsx::ArrayPatternRepeat1 => "array_pattern_repeat1", + Tsx::GlimmerTemplateRepeat1 => "glimmer_template_repeat1", Tsx::JsxElementRepeat1 => "jsx_element_repeat1", + Tsx::JsxStringRepeat1 => "_jsx_string_repeat1", + Tsx::JsxStringRepeat2 => "_jsx_string_repeat2", + Tsx::SequenceExpressionRepeat1 => "sequence_expression_repeat1", Tsx::StringRepeat1 => "string_repeat1", Tsx::StringRepeat2 => "string_repeat2", Tsx::TemplateStringRepeat1 => "template_string_repeat1", @@ -737,8 +812,7 @@ impl From for &'static str { Tsx::ObjectTypeRepeat1 => "object_type_repeat1", Tsx::TypeParametersRepeat1 => "type_parameters_repeat1", Tsx::TupleTypeRepeat1 => "tuple_type_repeat1", - Tsx::ImportSpecifier => "import_specifier", - Tsx::NamespaceExport => "namespace_export", + Tsx::InterfaceBody => "interface_body", Tsx::PropertyIdentifier => "property_identifier", Tsx::ShorthandPropertyIdentifier => "shorthand_property_identifier", Tsx::ShorthandPropertyIdentifierPattern => "shorthand_property_identifier_pattern", diff --git a/src/languages/language_typescript.rs b/src/languages/language_typescript.rs index 90e570c..43326d8 100644 --- a/src/languages/language_typescript.rs +++ b/src/languages/language_typescript.rs @@ -20,23 +20,23 @@ pub enum Typescript { Typeof = 13, Import2 = 14, From = 15, - Var = 16, - Let = 17, - Const = 18, - BANG = 19, - Else = 20, - If = 21, - Switch = 22, - For = 23, - LPAREN = 24, - RPAREN = 25, - Await = 26, - In = 27, - Of = 28, - While = 29, - Do = 30, - Try = 31, - With = 32, + With = 16, + Var = 17, + Let = 18, + Const = 19, + BANG = 20, + Else = 21, + If = 22, + Switch = 23, + For = 24, + LPAREN = 25, + RPAREN = 26, + Await = 27, + In = 28, + Of = 29, + While = 30, + Do = 31, + Try = 32, Break = 33, Continue = 34, Debugger = 35, @@ -50,317 +50,345 @@ pub enum Typescript { Yield = 43, LBRACK = 44, RBRACK = 45, - LT = 46, - GT = 47, - SLASH = 48, - DOT = 49, - Class2 = 50, - Async = 51, - Function2 = 52, - EQGT = 53, - QMARKDOT = 54, - New = 55, - PLUSEQ = 56, - DASHEQ = 57, - STAREQ = 58, - SLASHEQ = 59, - PERCENTEQ = 60, - CARETEQ = 61, - AMPEQ = 62, - PIPEEQ = 63, - GTGTEQ = 64, - GTGTGTEQ = 65, - LTLTEQ = 66, - STARSTAREQ = 67, - AMPAMPEQ = 68, - PIPEPIPEEQ = 69, - QMARKQMARKEQ = 70, - DOTDOTDOT = 71, - 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, - Protected = 126, - Override = 127, - Module2 = 128, - Any = 129, - Number2 = 130, - Boolean = 131, - String2 = 132, - Symbol = 133, - Abstract = 134, - Require = 135, - Extends = 136, - Implements = 137, - Global = 138, - Interface = 139, - Enum = 140, - DASHQMARKCOLON = 141, - QMARKCOLON = 142, - Asserts2 = 143, - Infer = 144, - Is = 145, - Keyof = 146, - Unknown = 147, - Never = 148, - Object2 = 149, - LBRACEPIPE = 150, - PIPERBRACE = 151, - AutomaticSemicolon = 152, - TemplateChars = 153, - 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, - TypeAliasDeclaration = 271, - AccessibilityModifier = 272, - OverrideModifier = 273, - RequiredParameter = 274, - OptionalParameter = 275, - ParameterName = 276, - OmittingTypeAnnotation = 277, - OptingTypeAnnotation = 278, - TypeAnnotation = 279, - Asserts = 280, - Type2 = 281, - RequiredParameter2 = 282, - OptionalParameter2 = 283, - OptionalType = 284, - RestType = 285, - TupleTypeMember = 286, - ConstructorType = 287, - PrimaryType = 288, - TemplateType = 289, - TemplateLiteralType = 290, - InferType = 291, - ConditionalType = 292, - GenericType = 293, - TypePredicate = 294, - TypePredicateAnnotation = 295, - MemberExpression3 = 296, - SubscriptExpression2 = 297, - CallExpression3 = 298, - TypeQuery = 299, - IndexTypeQuery = 300, - LookupType = 301, - MappedTypeClause = 302, - LiteralType = 303, - UnaryExpression2 = 304, - ExistentialType = 305, - FlowMaybeType = 306, - ParenthesizedType = 307, - PredefinedType = 308, - TypeArguments = 309, - ObjectType = 310, - CallSignature = 311, - PropertySignature = 312, - TypeParameters = 313, - TypeParameter = 314, - DefaultType = 315, - Constraint = 316, - ConstructSignature = 317, - IndexSignature = 318, - ArrayType = 319, - TupleType = 320, - ReadonlyType = 321, - UnionType = 322, - IntersectionType = 323, - FunctionType = 324, - ProgramRepeat1 = 325, - ExportStatementRepeat1 = 326, - ExportClauseRepeat1 = 327, - NamedImportsRepeat1 = 328, - VariableDeclarationRepeat1 = 329, - SwitchBodyRepeat1 = 330, - ObjectRepeat1 = 331, - ObjectPatternRepeat1 = 332, - ArrayRepeat1 = 333, - ArrayPatternRepeat1 = 334, - StringRepeat1 = 335, - StringRepeat2 = 336, - TemplateStringRepeat1 = 337, - ClassBodyRepeat1 = 338, - FormalParametersRepeat1 = 339, - 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, + GlimmerTemplateContent = 46, + GlimmerOpeningTag = 47, + GlimmerClosingTag = 48, + GT = 49, + DOT = 50, + DQUOTE = 51, + SQUOTE = 52, + Class2 = 53, + Async = 54, + Function = 55, + EQGT = 56, + QMARKDOT = 57, + New = 58, + Using = 59, + PLUSEQ = 60, + DASHEQ = 61, + STAREQ = 62, + SLASHEQ = 63, + PERCENTEQ = 64, + CARETEQ = 65, + AMPEQ = 66, + PIPEEQ = 67, + GTGTEQ = 68, + GTGTGTEQ = 69, + LTLTEQ = 70, + STARSTAREQ = 71, + AMPAMPEQ = 72, + PIPEPIPEEQ = 73, + QMARKQMARKEQ = 74, + DOTDOTDOT = 75, + AMPAMP = 76, + PIPEPIPE = 77, + GTGT = 78, + GTGTGT = 79, + LTLT = 80, + AMP = 81, + CARET = 82, + PIPE = 83, + PLUS = 84, + DASH = 85, + SLASH = 86, + PERCENT = 87, + STARSTAR = 88, + LT = 89, + LTEQ = 90, + EQEQ = 91, + EQEQEQ = 92, + BANGEQ = 93, + BANGEQEQ = 94, + GTEQ = 95, + QMARKQMARK = 96, + Instanceof = 97, + TILDE = 98, + Void = 99, + Delete = 100, + PLUSPLUS = 101, + DASHDASH = 102, + StringFragment = 103, + StringFragment2 = 104, + EscapeSequence = 105, + Comment = 106, + BQUOTE = 107, + DOLLARLBRACE = 108, + SLASH2 = 109, + RegexPattern = 110, + RegexFlags = 111, + Number = 112, + PrivatePropertyIdentifier = 113, + Target = 114, + This = 115, + Super = 116, + True = 117, + False = 118, + Null = 119, + Undefined = 120, + AT = 121, + Static = 122, + Readonly = 123, + Get = 124, + Set = 125, + QMARK = 126, + Declare = 127, + Public = 128, + Private = 129, + Protected = 130, + Override = 131, + Module2 = 132, + Any = 133, + Number2 = 134, + Boolean = 135, + String2 = 136, + Symbol = 137, + Object2 = 138, + Abstract = 139, + Accessor = 140, + Satisfies = 141, + Require = 142, + Extends = 143, + Implements = 144, + Global = 145, + Interface = 146, + Enum = 147, + DASHQMARKCOLON = 148, + PLUSQMARKCOLON = 149, + QMARKCOLON = 150, + Asserts2 = 151, + Infer = 152, + Is = 153, + Keyof = 154, + Uniquesymbol = 155, + Unknown = 156, + Never = 157, + LBRACEPIPE = 158, + PIPERBRACE = 159, + AutomaticSemicolon = 160, + StringFragment3 = 161, + QMARK2 = 162, + HtmlComment = 163, + FunctionSignatureAutomaticSemicolon = 164, + ErrorRecovery = 165, + Program = 166, + ExportStatement = 167, + NamespaceExport = 168, + ExportClause = 169, + ExportSpecifier = 170, + ModuleExportName = 171, + Declaration = 172, + Import = 173, + ImportStatement = 174, + ImportClause = 175, + FromClause = 176, + NamespaceImport = 177, + NamedImports = 178, + ImportSpecifier = 179, + ImportAttribute = 180, + Statement = 181, + ExpressionStatement = 182, + VariableDeclaration = 183, + LexicalDeclaration = 184, + VariableDeclarator = 185, + StatementBlock = 186, + ElseClause = 187, + IfStatement = 188, + SwitchStatement = 189, + ForStatement = 190, + ForInStatement = 191, + ForHeader = 192, + WhileStatement = 193, + DoStatement = 194, + TryStatement = 195, + WithStatement = 196, + BreakStatement = 197, + ContinueStatement = 198, + DebuggerStatement = 199, + ReturnStatement = 200, + ThrowStatement = 201, + EmptyStatement = 202, + LabeledStatement = 203, + SwitchBody = 204, + SwitchCase = 205, + SwitchDefault = 206, + CatchClause = 207, + FinallyClause = 208, + ParenthesizedExpression = 209, + Expression = 210, + PrimaryExpression = 211, + YieldExpression = 212, + Object = 213, + ObjectPattern = 214, + AssignmentPattern = 215, + ObjectAssignmentPattern = 216, + Array = 217, + ArrayPattern = 218, + GlimmerTemplate = 219, + NestedIdentifier = 220, + Class = 221, + ClassDeclaration = 222, + ClassHeritage = 223, + FunctionExpression = 224, + FunctionDeclaration = 225, + GeneratorFunction = 226, + GeneratorFunctionDeclaration = 227, + ArrowFunction = 228, + CallSignature2 = 229, + FormalParameter = 230, + OptionalChain = 231, + CallExpression = 232, + NewExpression = 233, + AwaitExpression = 234, + MemberExpression = 235, + SubscriptExpression = 236, + AssignmentExpression = 237, + AugmentedAssignmentLhs = 238, + AugmentedAssignmentExpression = 239, + Initializer = 240, + DestructuringPattern = 241, + SpreadElement = 242, + TernaryExpression = 243, + BinaryExpression = 244, + UnaryExpression = 245, + UpdateExpression = 246, + SequenceExpression = 247, + String = 248, + TemplateString = 249, + TemplateSubstitution = 250, + Regex = 251, + MetaProperty = 252, + Arguments = 253, + Decorator = 254, + MemberExpression2 = 255, + CallExpression2 = 256, + ClassBody = 257, + FormalParameters = 258, + ClassStaticBlock = 259, + Pattern = 260, + RestPattern = 261, + MethodDefinition = 262, + Pair = 263, + PairPattern = 264, + PropertyName = 265, + ComputedPropertyName = 266, + PublicFieldDefinition = 267, + ImportIdentifier = 268, + NonNullExpression = 269, + MethodSignature = 270, + AbstractMethodSignature = 271, + FunctionSignature = 272, + TypeAssertion = 273, + AsExpression = 274, + SatisfiesExpression = 275, + InstantiationExpression = 276, + ImportRequireClause = 277, + ExtendsClause = 278, + ExtendsClauseSingle = 279, + ImplementsClause = 280, + AmbientDeclaration = 281, + AbstractClassDeclaration = 282, + Module = 283, + InternalModule = 284, + Module3 = 285, + ImportAlias = 286, + NestedTypeIdentifier = 287, + InterfaceDeclaration = 288, + ExtendsTypeClause = 289, + EnumDeclaration = 290, + EnumBody = 291, + EnumAssignment = 292, + TypeAliasDeclaration = 293, + AccessibilityModifier = 294, + OverrideModifier = 295, + RequiredParameter = 296, + OptionalParameter = 297, + ParameterName = 298, + OmittingTypeAnnotation = 299, + AddingTypeAnnotation = 300, + OptingTypeAnnotation = 301, + TypeAnnotation = 302, + MemberExpression3 = 303, + CallExpression3 = 304, + Asserts = 305, + AssertsAnnotation = 306, + Type2 = 307, + RequiredParameter2 = 308, + OptionalParameter2 = 309, + OptionalType = 310, + RestType = 311, + TupleTypeMember = 312, + ConstructorType = 313, + PrimaryType = 314, + TemplateType = 315, + TemplateLiteralType = 316, + InferType = 317, + ConditionalType = 318, + GenericType = 319, + TypePredicate = 320, + TypePredicateAnnotation = 321, + MemberExpression4 = 322, + SubscriptExpression2 = 323, + CallExpression4 = 324, + InstantiationExpression2 = 325, + TypeQuery = 326, + IndexTypeQuery = 327, + LookupType = 328, + MappedTypeClause = 329, + LiteralType = 330, + UnaryExpression2 = 331, + ExistentialType = 332, + FlowMaybeType = 333, + ParenthesizedType = 334, + PredefinedType = 335, + TypeArguments = 336, + ObjectType = 337, + CallSignature = 338, + PropertySignature = 339, + TypeParameters = 340, + TypeParameter = 341, + DefaultType = 342, + Constraint = 343, + ConstructSignature = 344, + IndexSignature = 345, + ArrayType = 346, + TupleType = 347, + ReadonlyType = 348, + UnionType = 349, + IntersectionType = 350, + FunctionType = 351, + ProgramRepeat1 = 352, + ExportStatementRepeat1 = 353, + ExportClauseRepeat1 = 354, + NamedImportsRepeat1 = 355, + VariableDeclarationRepeat1 = 356, + SwitchBodyRepeat1 = 357, + ObjectRepeat1 = 358, + ObjectPatternRepeat1 = 359, + ArrayRepeat1 = 360, + ArrayPatternRepeat1 = 361, + GlimmerTemplateRepeat1 = 362, + SequenceExpressionRepeat1 = 363, + StringRepeat1 = 364, + StringRepeat2 = 365, + TemplateStringRepeat1 = 366, + ClassBodyRepeat1 = 367, + FormalParametersRepeat1 = 368, + ExtendsClauseRepeat1 = 369, + ImplementsClauseRepeat1 = 370, + ExtendsTypeClauseRepeat1 = 371, + EnumBodyRepeat1 = 372, + TemplateLiteralTypeRepeat1 = 373, + ObjectTypeRepeat1 = 374, + TypeParametersRepeat1 = 375, + TupleTypeRepeat1 = 376, + InterfaceBody = 377, + PropertyIdentifier = 378, + ShorthandPropertyIdentifier = 379, + ShorthandPropertyIdentifierPattern = 380, + StatementIdentifier = 381, + ThisType = 382, + TypeIdentifier = 383, + Error = 384, } impl From for &'static str { @@ -383,6 +411,7 @@ impl From for &'static str { Typescript::Typeof => "typeof", Typescript::Import2 => "import", Typescript::From => "from", + Typescript::With => "with", Typescript::Var => "var", Typescript::Let => "let", Typescript::Const => "const", @@ -399,7 +428,6 @@ impl From for &'static str { Typescript::While => "while", Typescript::Do => "do", Typescript::Try => "try", - Typescript::With => "with", Typescript::Break => "break", Typescript::Continue => "continue", Typescript::Debugger => "debugger", @@ -413,16 +441,20 @@ impl From for &'static str { Typescript::Yield => "yield", Typescript::LBRACK => "[", Typescript::RBRACK => "]", - Typescript::LT => "<", + Typescript::GlimmerTemplateContent => "_glimmer_template_content", + Typescript::GlimmerOpeningTag => "glimmer_opening_tag", + Typescript::GlimmerClosingTag => "glimmer_closing_tag", Typescript::GT => ">", - Typescript::SLASH => "/", Typescript::DOT => ".", + Typescript::DQUOTE => "\"", + Typescript::SQUOTE => "'", Typescript::Class2 => "class", Typescript::Async => "async", - Typescript::Function2 => "function", + Typescript::Function => "function", Typescript::EQGT => "=>", Typescript::QMARKDOT => "?.", Typescript::New => "new", + Typescript::Using => "using", Typescript::PLUSEQ => "+=", Typescript::DASHEQ => "-=", Typescript::STAREQ => "*=", @@ -449,8 +481,10 @@ impl From for &'static str { Typescript::PIPE => "|", Typescript::PLUS => "+", Typescript::DASH => "-", + Typescript::SLASH => "/", Typescript::PERCENT => "%", Typescript::STARSTAR => "**", + Typescript::LT => "<", Typescript::LTEQ => "<=", Typescript::EQEQ => "==", Typescript::EQEQEQ => "===", @@ -464,8 +498,6 @@ impl From for &'static str { Typescript::Delete => "delete", Typescript::PLUSPLUS => "++", Typescript::DASHDASH => "--", - Typescript::DQUOTE => "\"", - Typescript::SQUOTE => "'", Typescript::StringFragment => "string_fragment", Typescript::StringFragment2 => "string_fragment", Typescript::EscapeSequence => "escape_sequence", @@ -501,7 +533,10 @@ impl From for &'static str { Typescript::Boolean => "boolean", Typescript::String2 => "string", Typescript::Symbol => "symbol", + Typescript::Object2 => "object", Typescript::Abstract => "abstract", + Typescript::Accessor => "accessor", + Typescript::Satisfies => "satisfies", Typescript::Require => "require", Typescript::Extends => "extends", Typescript::Implements => "implements", @@ -509,26 +544,31 @@ impl From for &'static str { Typescript::Interface => "interface", Typescript::Enum => "enum", Typescript::DASHQMARKCOLON => "-?:", + Typescript::PLUSQMARKCOLON => "+?:", Typescript::QMARKCOLON => "?:", Typescript::Asserts2 => "asserts", Typescript::Infer => "infer", Typescript::Is => "is", Typescript::Keyof => "keyof", + Typescript::Uniquesymbol => "unique symbol", Typescript::Unknown => "unknown", Typescript::Never => "never", - Typescript::Object2 => "object", Typescript::LBRACEPIPE => "{|", Typescript::PIPERBRACE => "|}", Typescript::AutomaticSemicolon => "_automatic_semicolon", - Typescript::TemplateChars => "_template_chars", + Typescript::StringFragment3 => "string_fragment", Typescript::QMARK2 => "?", + Typescript::HtmlComment => "html_comment", Typescript::FunctionSignatureAutomaticSemicolon => { "_function_signature_automatic_semicolon" } + Typescript::ErrorRecovery => "__error_recovery", Typescript::Program => "program", Typescript::ExportStatement => "export_statement", + Typescript::NamespaceExport => "namespace_export", Typescript::ExportClause => "export_clause", Typescript::ExportSpecifier => "export_specifier", + Typescript::ModuleExportName => "_module_export_name", Typescript::Declaration => "declaration", Typescript::Import => "import", Typescript::ImportStatement => "import_statement", @@ -536,6 +576,9 @@ impl From for &'static str { Typescript::FromClause => "_from_clause", Typescript::NamespaceImport => "namespace_import", Typescript::NamedImports => "named_imports", + Typescript::ImportSpecifier => "import_specifier", + Typescript::ImportAttribute => "import_attribute", + Typescript::Statement => "statement", Typescript::ExpressionStatement => "expression_statement", Typescript::VariableDeclaration => "variable_declaration", Typescript::LexicalDeclaration => "lexical_declaration", @@ -573,17 +616,19 @@ impl From for &'static str { Typescript::ObjectAssignmentPattern => "object_assignment_pattern", Typescript::Array => "array", Typescript::ArrayPattern => "array_pattern", + Typescript::GlimmerTemplate => "glimmer_template", Typescript::NestedIdentifier => "nested_identifier", Typescript::Class => "class", Typescript::ClassDeclaration => "class_declaration", Typescript::ClassHeritage => "class_heritage", - Typescript::Function => "function", + Typescript::FunctionExpression => "function_expression", Typescript::FunctionDeclaration => "function_declaration", Typescript::GeneratorFunction => "generator_function", Typescript::GeneratorFunctionDeclaration => "generator_function_declaration", Typescript::ArrowFunction => "arrow_function", Typescript::CallSignature2 => "_call_signature", Typescript::FormalParameter => "_formal_parameter", + Typescript::OptionalChain => "optional_chain", Typescript::CallExpression => "call_expression", Typescript::NewExpression => "new_expression", Typescript::AwaitExpression => "await_expression", @@ -611,6 +656,7 @@ impl From for &'static str { Typescript::CallExpression2 => "call_expression", Typescript::ClassBody => "class_body", Typescript::FormalParameters => "formal_parameters", + Typescript::ClassStaticBlock => "class_static_block", Typescript::Pattern => "pattern", Typescript::RestPattern => "rest_pattern", Typescript::MethodDefinition => "method_definition", @@ -619,14 +665,18 @@ impl From for &'static str { Typescript::PropertyName => "_property_name", Typescript::ComputedPropertyName => "computed_property_name", Typescript::PublicFieldDefinition => "public_field_definition", + Typescript::ImportIdentifier => "_import_identifier", Typescript::NonNullExpression => "non_null_expression", Typescript::MethodSignature => "method_signature", Typescript::AbstractMethodSignature => "abstract_method_signature", Typescript::FunctionSignature => "function_signature", Typescript::TypeAssertion => "type_assertion", Typescript::AsExpression => "as_expression", + Typescript::SatisfiesExpression => "satisfies_expression", + Typescript::InstantiationExpression => "instantiation_expression", Typescript::ImportRequireClause => "import_require_clause", Typescript::ExtendsClause => "extends_clause", + Typescript::ExtendsClauseSingle => "_extends_clause_single", Typescript::ImplementsClause => "implements_clause", Typescript::AmbientDeclaration => "ambient_declaration", Typescript::AbstractClassDeclaration => "abstract_class_declaration", @@ -647,17 +697,21 @@ impl From for &'static str { Typescript::OptionalParameter => "optional_parameter", Typescript::ParameterName => "_parameter_name", Typescript::OmittingTypeAnnotation => "omitting_type_annotation", + Typescript::AddingTypeAnnotation => "adding_type_annotation", Typescript::OptingTypeAnnotation => "opting_type_annotation", Typescript::TypeAnnotation => "type_annotation", + Typescript::MemberExpression3 => "member_expression", + Typescript::CallExpression3 => "call_expression", Typescript::Asserts => "asserts", - Typescript::Type2 => "_type", + Typescript::AssertsAnnotation => "asserts_annotation", + Typescript::Type2 => "type", Typescript::RequiredParameter2 => "required_parameter", Typescript::OptionalParameter2 => "optional_parameter", Typescript::OptionalType => "optional_type", Typescript::RestType => "rest_type", Typescript::TupleTypeMember => "_tuple_type_member", Typescript::ConstructorType => "constructor_type", - Typescript::PrimaryType => "_primary_type", + Typescript::PrimaryType => "primary_type", Typescript::TemplateType => "template_type", Typescript::TemplateLiteralType => "template_literal_type", Typescript::InferType => "infer_type", @@ -665,9 +719,10 @@ impl From for &'static str { Typescript::GenericType => "generic_type", Typescript::TypePredicate => "type_predicate", Typescript::TypePredicateAnnotation => "type_predicate_annotation", - Typescript::MemberExpression3 => "member_expression", + Typescript::MemberExpression4 => "member_expression", Typescript::SubscriptExpression2 => "subscript_expression", - Typescript::CallExpression3 => "call_expression", + Typescript::CallExpression4 => "call_expression", + Typescript::InstantiationExpression2 => "instantiation_expression", Typescript::TypeQuery => "type_query", Typescript::IndexTypeQuery => "index_type_query", Typescript::LookupType => "lookup_type", @@ -704,6 +759,8 @@ impl From for &'static str { Typescript::ObjectPatternRepeat1 => "object_pattern_repeat1", Typescript::ArrayRepeat1 => "array_repeat1", Typescript::ArrayPatternRepeat1 => "array_pattern_repeat1", + Typescript::GlimmerTemplateRepeat1 => "glimmer_template_repeat1", + Typescript::SequenceExpressionRepeat1 => "sequence_expression_repeat1", Typescript::StringRepeat1 => "string_repeat1", Typescript::StringRepeat2 => "string_repeat2", Typescript::TemplateStringRepeat1 => "template_string_repeat1", @@ -717,8 +774,7 @@ impl From for &'static str { Typescript::ObjectTypeRepeat1 => "object_type_repeat1", Typescript::TypeParametersRepeat1 => "type_parameters_repeat1", Typescript::TupleTypeRepeat1 => "tuple_type_repeat1", - Typescript::ImportSpecifier => "import_specifier", - Typescript::NamespaceExport => "namespace_export", + Typescript::InterfaceBody => "interface_body", Typescript::PropertyIdentifier => "property_identifier", Typescript::ShorthandPropertyIdentifier => "shorthand_property_identifier", Typescript::ShorthandPropertyIdentifierPattern => { diff --git a/src/metrics/cognitive.rs b/src/metrics/cognitive.rs index 272e36c..79326fb 100644 --- a/src/metrics/cognitive.rs +++ b/src/metrics/cognitive.rs @@ -329,7 +329,7 @@ impl Cognitive for RustCode { } BreakExpression | ContinueExpression => { if let Some(label_child) = node.child(1) { - if let LoopLabel = label_child.kind_id().into() { + if let Label = label_child.kind_id().into() { increment_by_one(stats); } } diff --git a/src/metrics/loc.rs b/src/metrics/loc.rs index 63712f1..6c78dcc 100644 --- a/src/metrics/loc.rs +++ b/src/metrics/loc.rs @@ -569,7 +569,7 @@ impl Loc for PythonCode { let (start, end) = init(node, stats, is_func_space, is_unit); match node.kind_id().into() { - DQUOTE | DQUOTE2 | Block | Module => {} + Block | Module => {} Comment => { add_cloc_lines(stats, start, end); } diff --git a/src/node.rs b/src/node.rs index b8cc533..994a774 100644 --- a/src/node.rs +++ b/src/node.rs @@ -12,7 +12,7 @@ impl Tree { pub(crate) fn new(code: &[u8]) -> Self { let mut parser = Parser::new(); parser - .set_language(T::get_lang().get_ts_language()) + .set_language(&T::get_lang().get_ts_language()) .unwrap(); Self(parser.parse(code, None).unwrap()) diff --git a/tree-sitter-ccomment/Cargo.toml b/tree-sitter-ccomment/Cargo.toml index 5dc07e6..d2f34f1 100644 --- a/tree-sitter-ccomment/Cargo.toml +++ b/tree-sitter-ccomment/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tree-sitter-ccomment" description = "Ccomment grammar for the tree-sitter parsing library" -version = "0.20.1" +version = "0.20.2" authors = ["Calixte Denizet "] license = "MIT" readme = "bindings/rust/README.md" @@ -21,7 +21,7 @@ include = [ path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "0.20.9" +tree-sitter = "=0.22.6" [build-dependencies] cc = "^1.0" diff --git a/tree-sitter-ccomment/bindings/rust/lib.rs b/tree-sitter-ccomment/bindings/rust/lib.rs index 649f032..079011f 100644 --- a/tree-sitter-ccomment/bindings/rust/lib.rs +++ b/tree-sitter-ccomment/bindings/rust/lib.rs @@ -19,7 +19,7 @@ //! } //! "#; //! let mut parser = Parser::new(); -//! parser.set_language(tree_sitter_ccomment::language()).expect("Error loading Ccomment grammar"); +//! parser.set_language(&tree_sitter_ccomment::language()).expect("Error loading Ccomment grammar"); //! let parsed = parser.parse(code, None); //! # let parsed = parsed.unwrap(); //! # let root = parsed.root_node(); @@ -58,7 +58,7 @@ mod tests { fn can_load_grammar() { let mut parser = tree_sitter::Parser::new(); parser - .set_language(super::language()) + .set_language(&super::language()) .expect("Error loading Ccomment grammar"); } } diff --git a/tree-sitter-mozcpp/Cargo.toml b/tree-sitter-mozcpp/Cargo.toml index dd3a7eb..0289979 100644 --- a/tree-sitter-mozcpp/Cargo.toml +++ b/tree-sitter-mozcpp/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tree-sitter-mozcpp" description = "Mozcpp grammar for the tree-sitter parsing library" -version = "0.20.2" +version = "0.20.3" authors = ["Calixte Denizet "] license = "MIT" readme = "bindings/rust/README.md" @@ -21,13 +21,13 @@ include = [ path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "=0.20.9" +tree-sitter = "=0.22.6" [build-dependencies] cc = "^1.0" # This dependency is not used at all for this crate, but it is here so that # dependabot can send notifications when there are updates for this grammar -tree-sitter-cpp = "0.20.0" +tree-sitter-cpp = "0.22.3" [package.metadata.cargo-udeps.ignore] build = ["tree-sitter-cpp"] diff --git a/tree-sitter-mozcpp/bindings/rust/lib.rs b/tree-sitter-mozcpp/bindings/rust/lib.rs index c6d7932..f343d2a 100644 --- a/tree-sitter-mozcpp/bindings/rust/lib.rs +++ b/tree-sitter-mozcpp/bindings/rust/lib.rs @@ -19,7 +19,7 @@ //! } //! "#; //! let mut parser = Parser::new(); -//! parser.set_language(tree_sitter_mozcpp::language()).expect("Error loading Mozcpp grammar"); +//! parser.set_language(&tree_sitter_mozcpp::language()).expect("Error loading Mozcpp grammar"); //! let parsed = parser.parse(code, None); //! # let parsed = parsed.unwrap(); //! # let root = parsed.root_node(); @@ -58,7 +58,7 @@ mod tests { fn can_load_grammar() { let mut parser = tree_sitter::Parser::new(); parser - .set_language(super::language()) + .set_language(&super::language()) .expect("Error loading Mozcpp grammar"); } } diff --git a/tree-sitter-mozjs/Cargo.toml b/tree-sitter-mozjs/Cargo.toml index 02fca2d..c894045 100644 --- a/tree-sitter-mozjs/Cargo.toml +++ b/tree-sitter-mozjs/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tree-sitter-mozjs" description = "Mozjs grammar for the tree-sitter parsing library" -version = "0.20.1" +version = "0.20.2" authors = ["Calixte Denizet "] license = "MIT" readme = "bindings/rust/README.md" @@ -21,13 +21,13 @@ include = [ path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "0.20.9" +tree-sitter = "=0.22.6" [build-dependencies] cc = "^1.0" # This dependency is not used at all for this crate, but it is here so that # dependabot can send notifications when there are updates for this grammar -tree-sitter-javascript = "0.20.0" +tree-sitter-javascript = "0.21.4" [package.metadata.cargo-udeps.ignore] build = ["tree-sitter-javascript"] diff --git a/tree-sitter-mozjs/bindings/rust/lib.rs b/tree-sitter-mozjs/bindings/rust/lib.rs index 01a67e3..f31d68f 100644 --- a/tree-sitter-mozjs/bindings/rust/lib.rs +++ b/tree-sitter-mozjs/bindings/rust/lib.rs @@ -19,7 +19,7 @@ //! } //! "#; //! let mut parser = Parser::new(); -//! parser.set_language(tree_sitter_mozjs::language()).expect("Error loading Mozjs grammar"); +//! parser.set_language(&tree_sitter_mozjs::language()).expect("Error loading Mozjs grammar"); //! let parsed = parser.parse(code, None); //! # let parsed = parsed.unwrap(); //! # let root = parsed.root_node(); @@ -58,7 +58,7 @@ mod tests { fn can_load_grammar() { let mut parser = tree_sitter::Parser::new(); parser - .set_language(super::language()) + .set_language(&super::language()) .expect("Error loading Mozjs grammar"); } } diff --git a/tree-sitter-preproc/Cargo.toml b/tree-sitter-preproc/Cargo.toml index 96a27d5..ff8e961 100644 --- a/tree-sitter-preproc/Cargo.toml +++ b/tree-sitter-preproc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tree-sitter-preproc" description = "Preproc grammar for the tree-sitter parsing library" -version = "0.20.1" +version = "0.20.2" authors = ["Calixte Denizet "] license = "MIT" readme = "bindings/rust/README.md" @@ -21,7 +21,7 @@ include = [ path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "0.20.9" +tree-sitter = "=0.22.6" [build-dependencies] cc = "^1.0" diff --git a/tree-sitter-preproc/bindings/rust/lib.rs b/tree-sitter-preproc/bindings/rust/lib.rs index be6502c..2ff077a 100644 --- a/tree-sitter-preproc/bindings/rust/lib.rs +++ b/tree-sitter-preproc/bindings/rust/lib.rs @@ -19,7 +19,7 @@ //! } //! "#; //! let mut parser = Parser::new(); -//! parser.set_language(tree_sitter_preproc::language()).expect("Error loading Preproc grammar"); +//! parser.set_language(&tree_sitter_preproc::language()).expect("Error loading Preproc grammar"); //! let parsed = parser.parse(code, None); //! # let parsed = parsed.unwrap(); //! # let root = parsed.root_node(); @@ -58,7 +58,7 @@ mod tests { fn can_load_grammar() { let mut parser = tree_sitter::Parser::new(); parser - .set_language(super::language()) + .set_language(&super::language()) .expect("Error loading Preproc grammar"); } }