From f7812273e69a83204e97a206ce67440b38f0230e Mon Sep 17 00:00:00 2001 From: Luni-4 Date: Tue, 6 Dec 2022 11:09:11 +0100 Subject: [PATCH 1/5] enums: Update grammars to 0.20 --- enums/Cargo.lock | 54 ++++++++++++++------------------- enums/Cargo.toml | 16 +++++----- tree-sitter-ccomment/Cargo.toml | 4 +-- tree-sitter-mozjs/Cargo.toml | 6 ++-- tree-sitter-preproc/Cargo.toml | 4 +-- 5 files changed, 37 insertions(+), 47 deletions(-) diff --git a/enums/Cargo.lock b/enums/Cargo.lock index 86098a6c3..d26346319 100644 --- a/enums/Cargo.lock +++ b/enums/Cargo.lock @@ -133,7 +133,7 @@ version = "0.0.1" dependencies = [ "askama", "clap", - "tree-sitter 0.19.3", + "tree-sitter", "tree-sitter-ccomment", "tree-sitter-java", "tree-sitter-javascript", @@ -374,16 +374,6 @@ dependencies = [ "serde", ] -[[package]] -name = "tree-sitter" -version = "0.19.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f41201fed3db3b520405a9c01c61773a250d4c3f43e9861c14b2bb232c981ab" -dependencies = [ - "cc", - "regex", -] - [[package]] name = "tree-sitter" version = "0.20.2" @@ -396,10 +386,10 @@ dependencies = [ [[package]] name = "tree-sitter-ccomment" -version = "0.19.0" +version = "0.20.0" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] @@ -409,27 +399,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a869e3c5cef4e5db4e9ab16a8dc84d73010e60ada14cdc60d2f6d8aed17779d" dependencies = [ "cc", - "tree-sitter 0.20.2", + "tree-sitter", ] [[package]] name = "tree-sitter-java" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301ae2ee7813e1bf935dc06db947642400645bbea8878431e1b31131488d5430" +checksum = "f0bf5d3f508cbffcbfe1805834101c0d24297a8b6c2184ad9c595556c46d2420" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] name = "tree-sitter-javascript" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "840bb4d5f3c384cb76b976ff07297f5a24b6e61a708baa4464f53e395caaa5f9" +checksum = "2490fab08630b2c8943c320f7b63473cbf65511c8d83aec551beb9b4375906ed" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] @@ -437,45 +427,45 @@ name = "tree-sitter-mozcpp" version = "0.20.1" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", "tree-sitter-cpp", ] [[package]] name = "tree-sitter-mozjs" -version = "0.19.0" +version = "0.20.0" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", "tree-sitter-javascript", ] [[package]] name = "tree-sitter-preproc" -version = "0.19.0" +version = "0.20.0" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] name = "tree-sitter-python" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5646bfe71c4eb1c21b714ce0c38334c311eab767095582859e85da6281e9fd6c" +checksum = "e0d315475c65416274539dd1db9fa2de94918a6ef399dc1287be7cb7bc83dd6d" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] name = "tree-sitter-rust" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784f7ef9cdbd4c895dc2d4bb785e95b4a5364a602eec803681db83d1927ddf15" +checksum = "3df540a493d754015d22eaf57c38f58804be3713a22f6062db983ec15f85c3c9" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] @@ -485,7 +475,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8935efd97c92067c9b2b6d7acb647607590996ba80f3a7be09a197f9c1fdab73" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] diff --git a/enums/Cargo.toml b/enums/Cargo.toml index 47bef9522..1c2b1a711 100644 --- a/enums/Cargo.toml +++ b/enums/Cargo.toml @@ -8,16 +8,16 @@ edition = "2021" clap = { version = "^3.2", features = ["derive"] } askama = "^0.11" -tree-sitter = ">= 0.19, < 0.21" -tree-sitter-java = "=0.19.0" +tree-sitter = ">= 0.20, < 0.21" +tree-sitter-java = "=0.20.0" tree-sitter-typescript = "=0.20.0" -tree-sitter-javascript = "=0.19.0" -tree-sitter-python = "=0.19.0" -tree-sitter-rust = "=0.19.0" -tree-sitter-preproc = { path = "../tree-sitter-preproc", version = "=0.19.0" } -tree-sitter-ccomment = { path = "../tree-sitter-ccomment", version = "=0.19.0" } +tree-sitter-javascript = "=0.20.0" +tree-sitter-python = "=0.20.0" +tree-sitter-rust = "=0.20.0" +tree-sitter-preproc = { path = "../tree-sitter-preproc", version = "=0.20.0" } +tree-sitter-ccomment = { path = "../tree-sitter-ccomment", version = "=0.20.0" } tree-sitter-mozcpp = { path = "../tree-sitter-mozcpp", version = "=0.20.1" } -tree-sitter-mozjs = { path = "../tree-sitter-mozjs", version = "=0.19.0" } +tree-sitter-mozjs = { path = "../tree-sitter-mozjs", version = "=0.20.0" } [profile.release] strip = "debuginfo" diff --git a/tree-sitter-ccomment/Cargo.toml b/tree-sitter-ccomment/Cargo.toml index c679e3ab9..f491c100c 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.19.0" +version = "0.20.0" authors = ["Calixte Denizet "] license = "MIT" readme = "bindings/rust/README.md" @@ -21,7 +21,7 @@ include = [ path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "0.19.3" +tree-sitter = "0.20.0" [build-dependencies] cc = "^1.0" diff --git a/tree-sitter-mozjs/Cargo.toml b/tree-sitter-mozjs/Cargo.toml index 9a93ecb4a..d396999a0 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.19.0" +version = "0.20.0" authors = ["Calixte Denizet "] license = "MIT" readme = "bindings/rust/README.md" @@ -21,13 +21,13 @@ include = [ path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "0.19.3" +tree-sitter = "0.20.0" [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.19.0" +tree-sitter-javascript = "0.20.0" [package.metadata.cargo-udeps.ignore] build = ["tree-sitter-javascript"] diff --git a/tree-sitter-preproc/Cargo.toml b/tree-sitter-preproc/Cargo.toml index 7cfeac326..311e2bf8f 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.19.0" +version = "0.20.0" authors = ["Calixte Denizet "] license = "MIT" readme = "bindings/rust/README.md" @@ -21,7 +21,7 @@ include = [ path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "0.19.3" +tree-sitter = "0.20.0" [build-dependencies] cc = "^1.0" From 7eb528d4d3eea935605c966345f35f0bbddab51e Mon Sep 17 00:00:00 2001 From: Luni-4 Date: Tue, 6 Dec 2022 11:22:12 +0100 Subject: [PATCH 2/5] Update grammars to 0.20 --- Cargo.lock | 54 +-- Cargo.toml | 16 +- src/languages/language_java.rs | 592 ++++++++++++++------------- src/languages/language_javascript.rs | 338 +++++++-------- src/languages/language_python.rs | 486 ++++++++++++---------- src/languages/language_rust.rs | 16 +- src/languages/language_tsx.rs | 24 +- src/languages/language_typescript.rs | 24 +- 8 files changed, 809 insertions(+), 741 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 659c74a18..a657b2a9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1313,7 +1313,7 @@ dependencies = [ "regex", "serde", "termcolor", - "tree-sitter 0.19.3", + "tree-sitter", "tree-sitter-ccomment", "tree-sitter-java", "tree-sitter-javascript", @@ -1647,16 +1647,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "tree-sitter" -version = "0.19.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f41201fed3db3b520405a9c01c61773a250d4c3f43e9861c14b2bb232c981ab" -dependencies = [ - "cc", - "regex", -] - [[package]] name = "tree-sitter" version = "0.20.2" @@ -1669,10 +1659,10 @@ dependencies = [ [[package]] name = "tree-sitter-ccomment" -version = "0.19.0" +version = "0.20.0" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] @@ -1682,27 +1672,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a869e3c5cef4e5db4e9ab16a8dc84d73010e60ada14cdc60d2f6d8aed17779d" dependencies = [ "cc", - "tree-sitter 0.20.2", + "tree-sitter", ] [[package]] name = "tree-sitter-java" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301ae2ee7813e1bf935dc06db947642400645bbea8878431e1b31131488d5430" +checksum = "f0bf5d3f508cbffcbfe1805834101c0d24297a8b6c2184ad9c595556c46d2420" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] name = "tree-sitter-javascript" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "840bb4d5f3c384cb76b976ff07297f5a24b6e61a708baa4464f53e395caaa5f9" +checksum = "2490fab08630b2c8943c320f7b63473cbf65511c8d83aec551beb9b4375906ed" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] @@ -1710,45 +1700,45 @@ name = "tree-sitter-mozcpp" version = "0.20.1" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", "tree-sitter-cpp", ] [[package]] name = "tree-sitter-mozjs" -version = "0.19.0" +version = "0.20.0" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", "tree-sitter-javascript", ] [[package]] name = "tree-sitter-preproc" -version = "0.19.0" +version = "0.20.0" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] name = "tree-sitter-python" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5646bfe71c4eb1c21b714ce0c38334c311eab767095582859e85da6281e9fd6c" +checksum = "e0d315475c65416274539dd1db9fa2de94918a6ef399dc1287be7cb7bc83dd6d" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] name = "tree-sitter-rust" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784f7ef9cdbd4c895dc2d4bb785e95b4a5364a602eec803681db83d1927ddf15" +checksum = "3df540a493d754015d22eaf57c38f58804be3713a22f6062db983ec15f85c3c9" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] @@ -1758,7 +1748,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8935efd97c92067c9b2b6d7acb647607590996ba80f3a7be09a197f9c1fdab73" dependencies = [ "cc", - "tree-sitter 0.19.3", + "tree-sitter", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index fc2c98e8b..c5b156026 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,16 +27,16 @@ serde = { version = "^1.0", features = ["derive"] } termcolor = "^1.1" walkdir = "^2.3" -tree-sitter = ">= 0.19, < 0.21" -tree-sitter-java = "=0.19.0" +tree-sitter = ">= 0.20, < 0.21" +tree-sitter-java = "=0.20.0" tree-sitter-typescript = "=0.20.0" -tree-sitter-javascript = "=0.19.0" -tree-sitter-python = "=0.19.0" -tree-sitter-rust = "=0.19.0" -tree-sitter-preproc = { path = "./tree-sitter-preproc", version = "=0.19.0" } -tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "=0.19.0" } +tree-sitter-javascript = "=0.20.0" +tree-sitter-python = "=0.20.0" +tree-sitter-rust = "=0.20.0" +tree-sitter-preproc = { path = "./tree-sitter-preproc", version = "=0.20.0" } +tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "=0.20.0" } tree-sitter-mozcpp = { path = "./tree-sitter-mozcpp", version = "=0.20.1" } -tree-sitter-mozjs = { path = "./tree-sitter-mozjs", version = "=0.19.0" } +tree-sitter-mozjs = { path = "./tree-sitter-mozjs", version = "=0.20.0" } [dev-dependencies] insta = { version = "1.22.0", features = ["yaml"] } diff --git a/src/languages/language_java.rs b/src/languages/language_java.rs index c979bf90c..459e5333f 100644 --- a/src/languages/language_java.rs +++ b/src/languages/language_java.rs @@ -16,267 +16,288 @@ pub enum Java { False = 9, CharacterLiteral = 10, StringLiteral = 11, - NullLiteral = 12, - LPAREN = 13, - AMP = 14, - RPAREN = 15, - EQ = 16, - PLUSEQ = 17, - DASHEQ = 18, - STAREQ = 19, - SLASHEQ = 20, - AMPEQ = 21, - PIPEEQ = 22, - CARETEQ = 23, - PERCENTEQ = 24, - LTLTEQ = 25, - GTGTEQ = 26, - GTGTGTEQ = 27, - GT = 28, - LT = 29, - EQEQ = 30, + 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, - BANGEQ = 33, - AMPAMP = 34, - PIPEPIPE = 35, - PLUS = 36, - DASH = 37, - STAR = 38, - SLASH = 39, - PIPE = 40, - CARET = 41, - PERCENT = 42, - LTLT = 43, - GTGT = 44, - GTGTGT = 45, - Instanceof = 46, - DASHGT = 47, - COMMA = 48, - QMARK = 49, - COLON = 50, - BANG = 51, - TILDE = 52, - PLUSPLUS = 53, - DASHDASH = 54, - New = 55, - LBRACK = 56, - RBRACK = 57, - DOT = 58, - Class = 59, - COLONCOLON = 60, - Extends = 61, - SEMI = 62, - LBRACE = 63, - RBRACE = 64, - Assert = 65, - Switch = 66, + 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, - Do = 69, - While = 70, - Break = 71, - Continue = 72, - Return = 73, - Synchronized = 74, - Throw = 75, - Try = 76, - Catch = 77, - Finally = 78, - If = 79, - Else = 80, - For = 81, - AT = 82, - Open = 83, - Module = 84, - Requires = 85, - Exports = 86, - To = 87, - Opens = 88, - Uses = 89, - Provides = 90, - With = 91, - Transitive = 92, - Static = 93, - Package = 94, - Import = 95, - Enum = 96, - Public = 97, - Protected = 98, - Private = 99, - Abstract = 100, - Final = 101, - Strictfp = 102, - Native = 103, - Transient = 104, - Volatile = 105, - Implements = 106, - ATinterface = 107, - Interface = 108, - Byte = 109, - Short = 110, - Int = 111, - Long = 112, - Char = 113, - Float = 114, - Double = 115, - BooleanType = 116, - VoidType = 117, - DOTDOTDOT = 118, - Throws2 = 119, - This = 120, - Super = 121, - Comment = 122, - Program = 123, - Literal = 124, - Expression = 125, - CastExpression = 126, - AssignmentExpression = 127, - BinaryExpression = 128, - InstanceofExpression = 129, - LambdaExpression = 130, - InferredParameters = 131, - TernaryExpression = 132, - UnaryExpression = 133, - UpdateExpression = 134, - PrimaryExpression = 135, - ArrayCreationExpression = 136, - DimensionsExpr = 137, - ParenthesizedExpression = 138, - ClassLiteral = 139, - ObjectCreationExpression = 140, - UnqualifiedObjectCreationExpression = 141, - FieldAccess = 142, - ArrayAccess = 143, - MethodInvocation = 144, - ArgumentList = 145, - MethodReference = 146, - TypeArguments = 147, - Wildcard = 148, - WildcardBounds = 149, - Dimensions = 150, - Statement = 151, - Block = 152, - ExpressionStatement = 153, - LabeledStatement = 154, - AssertStatement = 155, - SwitchStatement = 156, - SwitchBlock = 157, - SwitchLabel = 158, - DoStatement = 159, - BreakStatement = 160, - ContinueStatement = 161, - ReturnStatement = 162, - SynchronizedStatement = 163, - ThrowStatement = 164, - TryStatement = 165, - CatchClause = 166, - CatchFormalParameter = 167, - CatchType = 168, - FinallyClause = 169, - TryWithResourcesStatement = 170, - ResourceSpecification = 171, - Resource = 172, - IfStatement = 173, - WhileStatement = 174, - ForStatement = 175, - EnhancedForStatement = 176, - Annotation = 177, - MarkerAnnotation = 178, - Annotation2 = 179, - AnnotationArgumentList = 180, - ElementValuePair = 181, - ElementValue = 182, - ElementValueArrayInitializer = 183, - Declaration = 184, - ModuleDeclaration = 185, - ModuleBody = 186, - ModuleDirective = 187, - RequiresModifier = 188, - PackageDeclaration = 189, - ImportDeclaration = 190, - Asterisk = 191, - EnumDeclaration = 192, - EnumBody = 193, - EnumBodyDeclarations = 194, - EnumConstant = 195, - ClassDeclaration = 196, - Modifiers = 197, - TypeParameters = 198, - TypeParameter = 199, - TypeBound = 200, - Superclass = 201, - SuperInterfaces = 202, - InterfaceTypeList = 203, - ClassBody = 204, - StaticInitializer = 205, - ConstructorDeclaration = 206, - ConstructorDeclarator = 207, - ConstructorBody = 208, - ExplicitConstructorInvocation = 209, - ScopedIdentifier = 210, - FieldDeclaration = 211, - AnnotationTypeDeclaration = 212, - AnnotationTypeBody = 213, - AnnotationTypeElementDeclaration = 214, - DefaultValue = 215, - InterfaceDeclaration = 216, - ExtendsInterfaces = 217, - InterfaceBody = 218, - ConstantDeclaration = 219, - VariableDeclaratorList = 220, - VariableDeclarator = 221, - VariableDeclaratorId = 222, - ArrayInitializer = 223, - Type = 224, - UnannotatedType = 225, - AnnotatedType = 226, - ScopedTypeIdentifier = 227, - GenericType = 228, - ArrayType = 229, - IntegralType = 230, - FloatingPointType = 231, - MethodHeader = 232, - MethodDeclarator = 233, - FormalParameters = 234, - FormalParameter = 235, - ReceiverParameter = 236, - SpreadParameter = 237, - Throws = 238, - LocalVariableDeclaration = 239, - MethodDeclaration = 240, - ProgramRepeat1 = 241, - CastExpressionRepeat1 = 242, - InferredParametersRepeat1 = 243, - ArrayCreationExpressionRepeat1 = 244, - DimensionsExprRepeat1 = 245, - ArgumentListRepeat1 = 246, - TypeArgumentsRepeat1 = 247, - DimensionsRepeat1 = 248, - SwitchBlockRepeat1 = 249, - TryStatementRepeat1 = 250, - CatchTypeRepeat1 = 251, - ResourceSpecificationRepeat1 = 252, - ForStatementRepeat1 = 253, - ForStatementRepeat2 = 254, - AnnotationArgumentListRepeat1 = 255, - ElementValueArrayInitializerRepeat1 = 256, - ModuleBodyRepeat1 = 257, - ModuleDirectiveRepeat1 = 258, - ModuleDirectiveRepeat2 = 259, - EnumBodyRepeat1 = 260, - EnumBodyDeclarationsRepeat1 = 261, - ModifiersRepeat1 = 262, - TypeParametersRepeat1 = 263, - TypeBoundRepeat1 = 264, - InterfaceTypeListRepeat1 = 265, - AnnotationTypeBodyRepeat1 = 266, - InterfaceBodyRepeat1 = 267, - VariableDeclaratorListRepeat1 = 268, - ArrayInitializerRepeat1 = 269, - FormalParametersRepeat1 = 270, - TypeIdentifier = 271, - Error = 272, + 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, } impl From for &'static str { @@ -295,6 +316,7 @@ impl From for &'static str { Java::False => "false", Java::CharacterLiteral => "character_literal", Java::StringLiteral => "string_literal", + Java::TextBlock => "text_block", Java::NullLiteral => "null_literal", Java::LPAREN => "(", Java::AMP => "&", @@ -313,9 +335,9 @@ impl From for &'static str { Java::GTGTGTEQ => ">>>=", Java::GT => ">", Java::LT => "<", - Java::EQEQ => "==", Java::GTEQ => ">=", Java::LTEQ => "<=", + Java::EQEQ => "==", Java::BANGEQ => "!=", Java::AMPAMP => "&&", Java::PIPEPIPE => "||", @@ -330,6 +352,7 @@ impl From for &'static str { Java::GTGT => ">>", Java::GTGTGT => ">>>", Java::Instanceof => "instanceof", + Java::Final => "final", Java::DASHGT => "->", Java::COMMA => ",", Java::QMARK => "?", @@ -345,18 +368,19 @@ impl From for &'static str { Java::Class => "class", Java::COLONCOLON => "::", Java::Extends => "extends", - Java::SEMI => ";", + Java::Switch => "switch", Java::LBRACE => "{", Java::RBRACE => "}", - Java::Assert => "assert", - Java::Switch => "switch", Java::Case => "case", Java::Default => "default", + Java::SEMI => ";", + Java::Assert => "assert", Java::Do => "do", Java::While => "while", Java::Break => "break", Java::Continue => "continue", Java::Return => "return", + Java::Yield => "yield", Java::Synchronized => "synchronized", Java::Throw => "throw", Java::Try => "try", @@ -369,14 +393,14 @@ impl From for &'static str { Java::Open => "open", Java::Module => "module", Java::Requires => "requires", + Java::Transitive => "transitive", + Java::Static => "static", Java::Exports => "exports", Java::To => "to", Java::Opens => "opens", Java::Uses => "uses", Java::Provides => "provides", Java::With => "with", - Java::Transitive => "transitive", - Java::Static => "static", Java::Package => "package", Java::Import => "import", Java::Enum => "enum", @@ -384,12 +408,15 @@ impl From for &'static str { Java::Protected => "protected", Java::Private => "private", Java::Abstract => "abstract", - Java::Final => "final", Java::Strictfp => "strictfp", Java::Native => "native", Java::Transient => "transient", Java::Volatile => "volatile", + Java::Sealed => "sealed", + Java::NonDASHsealed => "non-sealed", Java::Implements => "implements", + Java::Permits2 => "permits", + Java::Record => "record", Java::ATinterface => "@interface", Java::Interface => "interface", Java::Byte => "byte", @@ -405,7 +432,8 @@ impl From for &'static str { Java::Throws2 => "throws", Java::This => "this", Java::Super => "super", - Java::Comment => "comment", + Java::LineComment => "line_comment", + Java::BlockComment => "block_comment", Java::Program => "program", Java::Literal => "_literal", Java::Expression => "expression", @@ -434,18 +462,21 @@ impl From for &'static str { Java::Wildcard => "wildcard", Java::WildcardBounds => "_wildcard_bounds", Java::Dimensions => "dimensions", + Java::SwitchExpression => "switch_expression", + Java::SwitchBlock => "switch_block", + Java::SwitchBlockStatementGroup => "switch_block_statement_group", + Java::SwitchRule => "switch_rule", + Java::SwitchLabel => "switch_label", Java::Statement => "statement", Java::Block => "block", Java::ExpressionStatement => "expression_statement", Java::LabeledStatement => "labeled_statement", Java::AssertStatement => "assert_statement", - Java::SwitchStatement => "switch_statement", - Java::SwitchBlock => "switch_block", - Java::SwitchLabel => "switch_label", Java::DoStatement => "do_statement", Java::BreakStatement => "break_statement", Java::ContinueStatement => "continue_statement", Java::ReturnStatement => "return_statement", + Java::YieldStatement => "yield_statement", Java::SynchronizedStatement => "synchronized_statement", Java::ThrowStatement => "throw_statement", Java::TryStatement => "try_statement", @@ -460,9 +491,9 @@ impl From for &'static str { Java::WhileStatement => "while_statement", Java::ForStatement => "for_statement", Java::EnhancedForStatement => "enhanced_for_statement", - Java::Annotation => "_annotation", + Java::Annotation2 => "_annotation", Java::MarkerAnnotation => "marker_annotation", - Java::Annotation2 => "annotation", + Java::Annotation => "annotation", Java::AnnotationArgumentList => "annotation_argument_list", Java::ElementValuePair => "element_value_pair", Java::ElementValue => "_element_value", @@ -471,7 +502,12 @@ impl From for &'static str { Java::ModuleDeclaration => "module_declaration", Java::ModuleBody => "module_body", Java::ModuleDirective => "module_directive", + Java::RequiresModuleDirective => "requires_module_directive", Java::RequiresModifier => "requires_modifier", + Java::ExportsModuleDirective => "exports_module_directive", + Java::OpensModuleDirective => "opens_module_directive", + Java::UsesModuleDirective => "uses_module_directive", + Java::ProvidesModuleDirective => "provides_module_directive", Java::PackageDeclaration => "package_declaration", Java::ImportDeclaration => "import_declaration", Java::Asterisk => "asterisk", @@ -486,7 +522,8 @@ impl From for &'static str { Java::TypeBound => "type_bound", Java::Superclass => "superclass", Java::SuperInterfaces => "super_interfaces", - Java::InterfaceTypeList => "interface_type_list", + Java::TypeList => "type_list", + Java::Permits => "permits", Java::ClassBody => "class_body", Java::StaticInitializer => "static_initializer", Java::ConstructorDeclaration => "constructor_declaration", @@ -495,6 +532,7 @@ impl From for &'static str { Java::ExplicitConstructorInvocation => "explicit_constructor_invocation", Java::ScopedIdentifier => "scoped_identifier", Java::FieldDeclaration => "field_declaration", + Java::RecordDeclaration => "record_declaration", Java::AnnotationTypeDeclaration => "annotation_type_declaration", Java::AnnotationTypeBody => "annotation_type_body", Java::AnnotationTypeElementDeclaration => "annotation_type_element_declaration", @@ -524,15 +562,18 @@ impl From for &'static str { Java::Throws => "throws", Java::LocalVariableDeclaration => "local_variable_declaration", Java::MethodDeclaration => "method_declaration", + Java::CompactConstructorDeclaration => "compact_constructor_declaration", Java::ProgramRepeat1 => "program_repeat1", Java::CastExpressionRepeat1 => "cast_expression_repeat1", Java::InferredParametersRepeat1 => "inferred_parameters_repeat1", Java::ArrayCreationExpressionRepeat1 => "array_creation_expression_repeat1", - Java::DimensionsExprRepeat1 => "dimensions_expr_repeat1", + Java::ArrayCreationExpressionRepeat2 => "array_creation_expression_repeat2", Java::ArgumentListRepeat1 => "argument_list_repeat1", Java::TypeArgumentsRepeat1 => "type_arguments_repeat1", Java::DimensionsRepeat1 => "dimensions_repeat1", Java::SwitchBlockRepeat1 => "switch_block_repeat1", + Java::SwitchBlockRepeat2 => "switch_block_repeat2", + Java::SwitchBlockStatementGroupRepeat1 => "switch_block_statement_group_repeat1", Java::TryStatementRepeat1 => "try_statement_repeat1", Java::CatchTypeRepeat1 => "catch_type_repeat1", Java::ResourceSpecificationRepeat1 => "resource_specification_repeat1", @@ -541,14 +582,15 @@ impl From for &'static str { Java::AnnotationArgumentListRepeat1 => "annotation_argument_list_repeat1", Java::ElementValueArrayInitializerRepeat1 => "element_value_array_initializer_repeat1", Java::ModuleBodyRepeat1 => "module_body_repeat1", - Java::ModuleDirectiveRepeat1 => "module_directive_repeat1", - Java::ModuleDirectiveRepeat2 => "module_directive_repeat2", + Java::RequiresModuleDirectiveRepeat1 => "requires_module_directive_repeat1", + Java::ExportsModuleDirectiveRepeat1 => "exports_module_directive_repeat1", + Java::ProvidesModuleDirectiveRepeat1 => "provides_module_directive_repeat1", Java::EnumBodyRepeat1 => "enum_body_repeat1", Java::EnumBodyDeclarationsRepeat1 => "enum_body_declarations_repeat1", Java::ModifiersRepeat1 => "modifiers_repeat1", Java::TypeParametersRepeat1 => "type_parameters_repeat1", Java::TypeBoundRepeat1 => "type_bound_repeat1", - Java::InterfaceTypeListRepeat1 => "interface_type_list_repeat1", + Java::TypeListRepeat1 => "type_list_repeat1", Java::AnnotationTypeBodyRepeat1 => "annotation_type_body_repeat1", Java::InterfaceBodyRepeat1 => "interface_body_repeat1", Java::VariableDeclaratorListRepeat1 => "_variable_declarator_list_repeat1", diff --git a/src/languages/language_javascript.rs b/src/languages/language_javascript.rs index 60bea77c5..b6cb90731 100644 --- a/src/languages/language_javascript.rs +++ b/src/languages/language_javascript.rs @@ -75,46 +75,46 @@ pub enum Javascript { PIPEPIPEEQ = 68, QMARKQMARKEQ = 69, DOTDOTDOT = 70, - QMARK = 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, - BANG = 92, - TILDE = 93, - Typeof = 94, - Void = 95, - Delete = 96, - PLUSPLUS = 97, - DASHDASH = 98, - DQUOTE = 99, - StringToken1 = 100, - SQUOTE = 101, - StringToken2 = 102, - EscapeSequence = 103, - Comment = 104, - BQUOTE = 105, - DOLLARLBRACE = 106, - SLASH2 = 107, - RegexPattern = 108, - RegexFlags = 109, - Number = 110, + 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, @@ -128,129 +128,131 @@ pub enum Javascript { Set = 121, AutomaticSemicolon = 122, TemplateChars = 123, - Program = 124, - ExportStatement = 125, - ExportClause = 126, - ExportSpecifier = 127, - Declaration = 128, - Import = 129, - ImportStatement = 130, - ImportClause = 131, - FromClause = 132, - NamespaceImport = 133, - NamedImports = 134, - ExpressionStatement = 135, - VariableDeclaration = 136, - LexicalDeclaration = 137, - VariableDeclarator = 138, - StatementBlock = 139, - ElseClause = 140, - IfStatement = 141, - SwitchStatement = 142, - ForStatement = 143, - ForInStatement = 144, - ForHeader = 145, - WhileStatement = 146, - DoStatement = 147, - TryStatement = 148, - WithStatement = 149, - BreakStatement = 150, - ContinueStatement = 151, - DebuggerStatement = 152, - ReturnStatement = 153, - ThrowStatement = 154, - EmptyStatement = 155, - LabeledStatement = 156, - SwitchBody = 157, - SwitchCase = 158, - SwitchDefault = 159, - CatchClause = 160, - FinallyClause = 161, - ParenthesizedExpression = 162, - Expression = 163, - PrimaryExpression = 164, - YieldExpression = 165, - Object = 166, - ObjectPattern = 167, - AssignmentPattern = 168, - ObjectAssignmentPattern = 169, - Array = 170, - ArrayPattern = 171, - JsxElement = 172, - JsxFragment = 173, - JsxExpression = 174, - JsxOpeningElement = 175, - NestedIdentifier = 176, - JsxNamespaceName = 177, - JsxClosingElement = 178, - JsxSelfClosingElement = 179, - JsxAttribute = 180, - Class = 181, - ClassDeclaration = 182, - ClassHeritage = 183, - Function = 184, - FunctionDeclaration = 185, - GeneratorFunction = 186, - GeneratorFunctionDeclaration = 187, - ArrowFunction = 188, - CallExpression = 189, - NewExpression = 190, - AwaitExpression = 191, - MemberExpression = 192, - SubscriptExpression = 193, - AssignmentExpression = 194, - AugmentedAssignmentLhs = 195, - AugmentedAssignmentExpression = 196, - Initializer = 197, - DestructuringPattern = 198, - SpreadElement = 199, - TernaryExpression = 200, - BinaryExpression = 201, - UnaryExpression = 202, - UpdateExpression = 203, - SequenceExpression = 204, - String = 205, - TemplateString = 206, - TemplateSubstitution = 207, - Regex = 208, - MetaProperty = 209, - Arguments = 210, - Decorator = 211, - MemberExpression2 = 212, - CallExpression2 = 213, - ClassBody = 214, - PublicFieldDefinition = 215, - FormalParameters = 216, - Pattern = 217, - RestPattern = 218, - MethodDefinition = 219, - Pair = 220, - PairPattern = 221, - PropertyName = 222, - ComputedPropertyName = 223, - ProgramRepeat1 = 224, - ExportStatementRepeat1 = 225, - ExportClauseRepeat1 = 226, - NamedImportsRepeat1 = 227, - VariableDeclarationRepeat1 = 228, - SwitchBodyRepeat1 = 229, - ObjectRepeat1 = 230, - ObjectPatternRepeat1 = 231, - ArrayRepeat1 = 232, - ArrayPatternRepeat1 = 233, - JsxElementRepeat1 = 234, - JsxOpeningElementRepeat1 = 235, - StringRepeat1 = 236, - StringRepeat2 = 237, - TemplateStringRepeat1 = 238, - ClassBodyRepeat1 = 239, - FormalParametersRepeat1 = 240, - ImportSpecifier = 241, - PropertyIdentifier = 242, - ShorthandPropertyIdentifier = 243, - ShorthandPropertyIdentifierPattern = 244, - StatementIdentifier = 245, - Error = 246, + 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, } impl From for &'static str { @@ -328,7 +330,6 @@ impl From for &'static str { Javascript::PIPEPIPEEQ => "||=", Javascript::QMARKQMARKEQ => "??=", Javascript::DOTDOTDOT => "...", - Javascript::QMARK => "?", Javascript::AMPAMP => "&&", Javascript::PIPEPIPE => "||", Javascript::GTGT => ">>", @@ -357,9 +358,9 @@ impl From for &'static str { Javascript::PLUSPLUS => "++", Javascript::DASHDASH => "--", Javascript::DQUOTE => "\"", - Javascript::StringToken1 => "string_token1", Javascript::SQUOTE => "'", - Javascript::StringToken2 => "string_token2", + Javascript::StringFragment => "string_fragment", + Javascript::StringFragment2 => "string_fragment", Javascript::EscapeSequence => "escape_sequence", Javascript::Comment => "comment", Javascript::BQUOTE => "`", @@ -368,6 +369,7 @@ impl From for &'static str { Javascript::RegexPattern => "regex_pattern", Javascript::RegexFlags => "regex_flags", Javascript::Number => "number", + Javascript::PrivatePropertyIdentifier => "private_property_identifier", Javascript::Target => "target", Javascript::This => "this", Javascript::Super => "super", @@ -381,6 +383,7 @@ impl From for &'static str { Javascript::Set => "set", Javascript::AutomaticSemicolon => "_automatic_semicolon", Javascript::TemplateChars => "_template_chars", + Javascript::QMARK => "?", Javascript::Program => "program", Javascript::ExportStatement => "export_statement", Javascript::ExportClause => "export_clause", @@ -472,7 +475,7 @@ impl From for &'static str { Javascript::MemberExpression2 => "member_expression", Javascript::CallExpression2 => "call_expression", Javascript::ClassBody => "class_body", - Javascript::PublicFieldDefinition => "public_field_definition", + Javascript::FieldDefinition => "field_definition", Javascript::FormalParameters => "formal_parameters", Javascript::Pattern => "pattern", Javascript::RestPattern => "rest_pattern", @@ -499,6 +502,7 @@ impl From for &'static str { 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_python.rs b/src/languages/language_python.rs index 95bc1375a..05d5d957c 100644 --- a/src/languages/language_python.rs +++ b/src/languages/language_python.rs @@ -6,232 +6,248 @@ use num_derive::FromPrimitive; pub enum Python { End = 0, Identifier = 1, - Import = 2, - DOT = 3, - From = 4, - Future = 5, - LPAREN = 6, - RPAREN = 7, - COMMA = 8, - As = 9, - STAR = 10, - Print = 11, - GTGT = 12, - Assert = 13, - COLONEQ = 14, - Return = 15, - Del = 16, - Raise = 17, - Pass = 18, - Break = 19, - Continue = 20, - If = 21, - COLON = 22, - Elif = 23, - Else = 24, - Async = 25, - For = 26, - In = 27, - While = 28, - Try = 29, - Except = 30, - Finally = 31, - With = 32, - Def = 33, - DASHGT = 34, - STARSTAR = 35, - Global = 36, - Nonlocal = 37, - Exec = 38, - Class = 39, - AT = 40, - LBRACK = 41, - RBRACK = 42, - EQ = 43, - Not = 44, - And = 45, - Or = 46, - PLUS = 47, - DASH = 48, - SLASH = 49, - PERCENT = 50, - SLASHSLASH = 51, - PIPE = 52, - AMP = 53, - CARET = 54, - LTLT = 55, - TILDE = 56, - LT = 57, - LTEQ = 58, - EQEQ = 59, - BANGEQ = 60, - GTEQ = 61, - GT = 62, - LTGT = 63, - Is = 64, - Lambda3 = 65, - PLUSEQ = 66, - DASHEQ = 67, - STAREQ = 68, - SLASHEQ = 69, - ATEQ = 70, - SLASHSLASHEQ = 71, - PERCENTEQ = 72, - STARSTAREQ = 73, - GTGTEQ = 74, - LTLTEQ = 75, - AMPEQ = 76, - CARETEQ = 77, - PIPEEQ = 78, - Yield2 = 79, - Ellipsis = 80, - LBRACE = 81, - RBRACE = 82, - EscapeSequence = 83, - NotEscapeSequence = 84, - FormatSpecifierToken1 = 85, - TypeConversion = 86, - Integer = 87, - Float = 88, - Await2 = 89, - True = 90, - False = 91, - None = 92, - Comment = 93, - Semicolon = 94, - Newline = 95, - Indent = 96, - Dedent = 97, - DQUOTE = 98, - StringContent = 99, - DQUOTE2 = 100, - Module = 101, - Statement = 102, - SimpleStatements = 103, - ImportStatement = 104, - ImportPrefix = 105, - RelativeImport = 106, - FutureImportStatement = 107, - ImportFromStatement = 108, - ImportList = 109, - AliasedImport = 110, - WildcardImport = 111, - PrintStatement = 112, - Chevron = 113, - AssertStatement = 114, - ExpressionStatement = 115, - NamedExpression = 116, - ReturnStatement = 117, - DeleteStatement = 118, - RaiseStatement = 119, - PassStatement = 120, - BreakStatement = 121, - ContinueStatement = 122, - IfStatement = 123, - ElifClause = 124, - ElseClause = 125, - ForStatement = 126, - WhileStatement = 127, - TryStatement = 128, - ExceptClause = 129, - FinallyClause = 130, - WithStatement = 131, - WithClause = 132, - WithItem = 133, - FunctionDefinition = 134, - Parameters = 135, - LambdaParameters = 136, - ListSplat = 137, - DictionarySplat = 138, - GlobalStatement = 139, - NonlocalStatement = 140, - ExecStatement = 141, - ClassDefinition = 142, - ParenthesizedListSplat = 143, - ArgumentList = 144, - DecoratedDefinition = 145, - Decorator = 146, - Block = 147, - ExpressionList = 148, - DottedName = 149, - Parameters2 = 150, - Patterns = 151, - Parameter = 152, - Pattern = 153, - TuplePattern = 154, - ListPattern = 155, - DefaultParameter = 156, - TypedDefaultParameter = 157, - ListSplatPattern = 158, - DictionarySplatPattern = 159, - ExpressionWithinForInClause = 160, - Expression = 161, - PrimaryExpression = 162, - NotOperator = 163, - BooleanOperator = 164, - BinaryOperator = 165, - UnaryOperator = 166, - ComparisonOperator = 167, - Lambda = 168, - Lambda2 = 169, - Assignment = 170, - AugmentedAssignment = 171, - PatternList = 172, - RightHandSide = 173, - Yield = 174, - Attribute = 175, - Subscript = 176, - Slice = 177, - Call = 178, - TypedParameter = 179, - Type = 180, - KeywordArgument = 181, - List = 182, - Set = 183, - Tuple = 184, - Dictionary = 185, - Pair = 186, - ListComprehension = 187, - DictionaryComprehension = 188, - SetComprehension = 189, - GeneratorExpression = 190, - ComprehensionClauses = 191, - ParenthesizedExpression = 192, - CollectionElements = 193, - ForInClause = 194, - IfClause = 195, - ConditionalExpression = 196, - ConcatenatedString = 197, - String = 198, - Interpolation = 199, - FormatSpecifier = 200, - FormatExpression = 201, - Await = 202, - ModuleRepeat1 = 203, - SimpleStatementsRepeat1 = 204, - ImportPrefixRepeat1 = 205, - ImportListRepeat1 = 206, - PrintStatementRepeat1 = 207, - AssertStatementRepeat1 = 208, - IfStatementRepeat1 = 209, - TryStatementRepeat1 = 210, - WithClauseRepeat1 = 211, - GlobalStatementRepeat1 = 212, - ArgumentListRepeat1 = 213, - DecoratedDefinitionRepeat1 = 214, - DottedNameRepeat1 = 215, - ParametersRepeat1 = 216, - PatternsRepeat1 = 217, - ComparisonOperatorRepeat1 = 218, - SubscriptRepeat1 = 219, - DictionaryRepeat1 = 220, - ComprehensionClausesRepeat1 = 221, - CollectionElementsRepeat1 = 222, - ForInClauseRepeat1 = 223, - ConcatenatedStringRepeat1 = 224, - StringRepeat1 = 225, - FormatSpecifierRepeat1 = 226, - Error = 227, + SEMI = 2, + Import = 3, + DOT = 4, + From = 5, + Future = 6, + LPAREN = 7, + RPAREN = 8, + COMMA = 9, + As = 10, + STAR = 11, + Print = 12, + 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, + Case = 27, + Async = 28, + For = 29, + In = 30, + 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, } impl From for &'static str { @@ -240,6 +256,7 @@ impl From for &'static str { match tok { Python::End => "end", Python::Identifier => "identifier", + Python::SEMI => ";", Python::Import => "import", Python::DOT => ".", Python::From => "from", @@ -253,6 +270,7 @@ impl From for &'static str { Python::GTGT => ">>", Python::Assert => "assert", Python::COLONEQ => ":=", + Python::Match => "match", Python::Return => "return", Python::Del => "del", Python::Raise => "raise", @@ -263,6 +281,7 @@ impl From for &'static str { Python::COLON => ":", Python::Elif => "elif", Python::Else => "else", + Python::Case => "case", Python::Async => "async", Python::For => "for", Python::In => "in", @@ -321,6 +340,8 @@ impl From for &'static str { 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", @@ -332,7 +353,6 @@ impl From for &'static str { Python::False => "false", Python::None => "none", Python::Comment => "comment", - Python::Semicolon => "_semicolon", Python::Newline => "_newline", Python::Indent => "_indent", Python::Dedent => "_dedent", @@ -355,6 +375,7 @@ impl From for &'static str { Python::AssertStatement => "assert_statement", Python::ExpressionStatement => "expression_statement", Python::NamedExpression => "named_expression", + Python::NamedExpresssionLhs => "_named_expresssion_lhs", Python::ReturnStatement => "return_statement", Python::DeleteStatement => "delete_statement", Python::RaiseStatement => "raise_statement", @@ -364,6 +385,8 @@ impl From for &'static str { Python::IfStatement => "if_statement", Python::ElifClause => "elif_clause", Python::ElseClause => "else_clause", + Python::MatchStatement => "match_statement", + Python::CaseClause => "case_clause", Python::ForStatement => "for_statement", Python::WhileStatement => "while_statement", Python::TryStatement => "try_statement", @@ -398,6 +421,7 @@ impl From for &'static str { Python::TypedDefaultParameter => "typed_default_parameter", Python::ListSplatPattern => "list_splat_pattern", Python::DictionarySplatPattern => "dictionary_splat_pattern", + Python::AsPattern => "as_pattern", Python::ExpressionWithinForInClause => "_expression_within_for_in_clause", Python::Expression => "expression", Python::PrimaryExpression => "primary_expression", @@ -438,9 +462,12 @@ impl From for &'static str { Python::ConcatenatedString => "concatenated_string", Python::String => "string", Python::Interpolation => "interpolation", + Python::EscapeInterpolation => "_escape_interpolation", Python::FormatSpecifier => "format_specifier", Python::FormatExpression => "format_expression", Python::Await => "await", + Python::PositionalSeparator => "positional_separator", + Python::KeywordSeparator => "keyword_separator", Python::ModuleRepeat1 => "module_repeat1", Python::SimpleStatementsRepeat1 => "_simple_statements_repeat1", Python::ImportPrefixRepeat1 => "import_prefix_repeat1", @@ -448,6 +475,9 @@ impl From for &'static str { Python::PrintStatementRepeat1 => "print_statement_repeat1", Python::AssertStatementRepeat1 => "assert_statement_repeat1", Python::IfStatementRepeat1 => "if_statement_repeat1", + Python::MatchStatementRepeat1 => "match_statement_repeat1", + Python::MatchStatementRepeat2 => "match_statement_repeat2", + Python::CaseClauseRepeat1 => "case_clause_repeat1", Python::TryStatementRepeat1 => "try_statement_repeat1", Python::WithClauseRepeat1 => "with_clause_repeat1", Python::GlobalStatementRepeat1 => "global_statement_repeat1", @@ -465,6 +495,8 @@ impl From for &'static str { Python::ConcatenatedStringRepeat1 => "concatenated_string_repeat1", Python::StringRepeat1 => "string_repeat1", Python::FormatSpecifierRepeat1 => "format_specifier_repeat1", + Python::AsPatternTarget => "as_pattern_target", + Python::CasePattern => "case_pattern", Python::Error => "ERROR", } } diff --git a/src/languages/language_rust.rs b/src/languages/language_rust.rs index 9120956b6..235141e50 100644 --- a/src/languages/language_rust.rs +++ b/src/languages/language_rust.rs @@ -26,7 +26,7 @@ pub enum Rust { Ident = 19, Item = 20, Lifetime2 = 21, - Literal2 = 22, + Literal = 22, Meta = 23, Pat = 24, Path = 25, @@ -74,7 +74,7 @@ pub enum Rust { Static = 67, Struct = 68, Trait = 69, - Type2 = 70, + Type = 70, Union = 71, Unsafe = 72, Use = 73, @@ -202,7 +202,7 @@ pub enum Rust { Parameter = 195, ExternModifier = 196, VisibilityModifier = 197, - Type = 198, + Type2 = 198, BracketedType = 199, QualifiedType = 200, Lifetime = 201, @@ -284,7 +284,7 @@ pub enum Rust { CapturedPattern = 277, ReferencePattern = 278, OrPattern = 279, - Literal = 280, + Literal2 = 280, LiteralPattern = 281, NegativeLiteral = 282, StringLiteral = 283, @@ -349,7 +349,7 @@ impl From for &'static str { Rust::Ident => "ident", Rust::Item => "item", Rust::Lifetime2 => "lifetime", - Rust::Literal2 => "literal", + Rust::Literal => "literal", Rust::Meta => "meta", Rust::Pat => "pat", Rust::Path => "path", @@ -397,7 +397,7 @@ impl From for &'static str { Rust::Static => "static", Rust::Struct => "struct", Rust::Trait => "trait", - Rust::Type2 => "type", + Rust::Type => "type", Rust::Union => "union", Rust::Unsafe => "unsafe", Rust::Use => "use", @@ -525,7 +525,7 @@ impl From for &'static str { Rust::Parameter => "parameter", Rust::ExternModifier => "extern_modifier", Rust::VisibilityModifier => "visibility_modifier", - Rust::Type => "_type", + Rust::Type2 => "_type", Rust::BracketedType => "bracketed_type", Rust::QualifiedType => "qualified_type", Rust::Lifetime => "lifetime", @@ -607,7 +607,7 @@ impl From for &'static str { Rust::CapturedPattern => "captured_pattern", Rust::ReferencePattern => "reference_pattern", Rust::OrPattern => "or_pattern", - Rust::Literal => "_literal", + Rust::Literal2 => "_literal", Rust::LiteralPattern => "_literal_pattern", Rust::NegativeLiteral => "negative_literal", Rust::StringLiteral => "string_literal", diff --git a/src/languages/language_tsx.rs b/src/languages/language_tsx.rs index fa5810b4c..5ffb58c70 100644 --- a/src/languages/language_tsx.rs +++ b/src/languages/language_tsx.rs @@ -10,7 +10,7 @@ pub enum Tsx { Export = 3, STAR = 4, Default = 5, - Type2 = 6, + Type = 6, EQ = 7, As = 8, Namespace = 9, @@ -134,7 +134,7 @@ pub enum Tsx { Private = 127, Protected = 128, Override = 129, - Module3 = 130, + Module2 = 130, Any = 131, Number2 = 132, Boolean = 133, @@ -226,7 +226,7 @@ pub enum Tsx { GeneratorFunction = 219, GeneratorFunctionDeclaration = 220, ArrowFunction = 221, - CallSignature = 222, + CallSignature2 = 222, FormalParameter = 223, CallExpression = 224, NewExpression = 225, @@ -274,7 +274,7 @@ pub enum Tsx { AbstractClassDeclaration = 267, Module = 268, InternalModule = 269, - Module2 = 270, + Module3 = 270, ImportAlias = 271, NestedTypeIdentifier = 272, InterfaceDeclaration = 273, @@ -294,7 +294,7 @@ pub enum Tsx { OptingTypeAnnotation = 287, TypeAnnotation = 288, Asserts = 289, - Type = 290, + Type2 = 290, RequiredParameter2 = 291, OptionalParameter2 = 292, OptionalType = 293, @@ -324,7 +324,7 @@ pub enum Tsx { PredefinedType = 317, TypeArguments = 318, ObjectType = 319, - CallSignature2 = 320, + CallSignature = 320, PropertySignature = 321, TypeParameters = 322, TypeParameter = 323, @@ -381,7 +381,7 @@ impl From for &'static str { Tsx::Export => "export", Tsx::STAR => "*", Tsx::Default => "default", - Tsx::Type2 => "type", + Tsx::Type => "type", Tsx::EQ => "=", Tsx::As => "as", Tsx::Namespace => "namespace", @@ -505,7 +505,7 @@ impl From for &'static str { Tsx::Private => "private", Tsx::Protected => "protected", Tsx::Override => "override", - Tsx::Module3 => "module", + Tsx::Module2 => "module", Tsx::Any => "any", Tsx::Number2 => "number", Tsx::Boolean => "boolean", @@ -597,7 +597,7 @@ impl From for &'static str { Tsx::GeneratorFunction => "generator_function", Tsx::GeneratorFunctionDeclaration => "generator_function_declaration", Tsx::ArrowFunction => "arrow_function", - Tsx::CallSignature => "_call_signature", + Tsx::CallSignature2 => "_call_signature", Tsx::FormalParameter => "_formal_parameter", Tsx::CallExpression => "call_expression", Tsx::NewExpression => "new_expression", @@ -645,7 +645,7 @@ impl From for &'static str { Tsx::AbstractClassDeclaration => "abstract_class_declaration", Tsx::Module => "module", Tsx::InternalModule => "internal_module", - Tsx::Module2 => "_module", + Tsx::Module3 => "_module", Tsx::ImportAlias => "import_alias", Tsx::NestedTypeIdentifier => "nested_type_identifier", Tsx::InterfaceDeclaration => "interface_declaration", @@ -665,7 +665,7 @@ impl From for &'static str { Tsx::OptingTypeAnnotation => "opting_type_annotation", Tsx::TypeAnnotation => "type_annotation", Tsx::Asserts => "asserts", - Tsx::Type => "_type", + Tsx::Type2 => "_type", Tsx::RequiredParameter2 => "required_parameter", Tsx::OptionalParameter2 => "optional_parameter", Tsx::OptionalType => "optional_type", @@ -695,7 +695,7 @@ impl From for &'static str { Tsx::PredefinedType => "predefined_type", Tsx::TypeArguments => "type_arguments", Tsx::ObjectType => "object_type", - Tsx::CallSignature2 => "call_signature", + Tsx::CallSignature => "call_signature", Tsx::PropertySignature => "property_signature", Tsx::TypeParameters => "type_parameters", Tsx::TypeParameter => "type_parameter", diff --git a/src/languages/language_typescript.rs b/src/languages/language_typescript.rs index d55e227ec..ad18cad5f 100644 --- a/src/languages/language_typescript.rs +++ b/src/languages/language_typescript.rs @@ -10,7 +10,7 @@ pub enum Typescript { Export = 3, STAR = 4, Default = 5, - Type2 = 6, + Type = 6, EQ = 7, As = 8, Namespace = 9, @@ -132,7 +132,7 @@ pub enum Typescript { Private = 125, Protected = 126, Override = 127, - Module3 = 128, + Module2 = 128, Any = 129, Number2 = 130, Boolean = 131, @@ -216,7 +216,7 @@ pub enum Typescript { GeneratorFunction = 209, GeneratorFunctionDeclaration = 210, ArrowFunction = 211, - CallSignature = 212, + CallSignature2 = 212, FormalParameter = 213, CallExpression = 214, NewExpression = 215, @@ -265,7 +265,7 @@ pub enum Typescript { AbstractClassDeclaration = 258, Module = 259, InternalModule = 260, - Module2 = 261, + Module3 = 261, ImportAlias = 262, NestedTypeIdentifier = 263, InterfaceDeclaration = 264, @@ -285,7 +285,7 @@ pub enum Typescript { OptingTypeAnnotation = 278, TypeAnnotation = 279, Asserts = 280, - Type = 281, + Type2 = 281, RequiredParameter2 = 282, OptionalParameter2 = 283, OptionalType = 284, @@ -315,7 +315,7 @@ pub enum Typescript { PredefinedType = 308, TypeArguments = 309, ObjectType = 310, - CallSignature2 = 311, + CallSignature = 311, PropertySignature = 312, TypeParameters = 313, TypeParameter = 314, @@ -370,7 +370,7 @@ impl From for &'static str { Typescript::Export => "export", Typescript::STAR => "*", Typescript::Default => "default", - Typescript::Type2 => "type", + Typescript::Type => "type", Typescript::EQ => "=", Typescript::As => "as", Typescript::Namespace => "namespace", @@ -492,7 +492,7 @@ impl From for &'static str { Typescript::Private => "private", Typescript::Protected => "protected", Typescript::Override => "override", - Typescript::Module3 => "module", + Typescript::Module2 => "module", Typescript::Any => "any", Typescript::Number2 => "number", Typescript::Boolean => "boolean", @@ -578,7 +578,7 @@ impl From for &'static str { Typescript::GeneratorFunction => "generator_function", Typescript::GeneratorFunctionDeclaration => "generator_function_declaration", Typescript::ArrowFunction => "arrow_function", - Typescript::CallSignature => "_call_signature", + Typescript::CallSignature2 => "_call_signature", Typescript::FormalParameter => "_formal_parameter", Typescript::CallExpression => "call_expression", Typescript::NewExpression => "new_expression", @@ -627,7 +627,7 @@ impl From for &'static str { Typescript::AbstractClassDeclaration => "abstract_class_declaration", Typescript::Module => "module", Typescript::InternalModule => "internal_module", - Typescript::Module2 => "_module", + Typescript::Module3 => "_module", Typescript::ImportAlias => "import_alias", Typescript::NestedTypeIdentifier => "nested_type_identifier", Typescript::InterfaceDeclaration => "interface_declaration", @@ -647,7 +647,7 @@ impl From for &'static str { Typescript::OptingTypeAnnotation => "opting_type_annotation", Typescript::TypeAnnotation => "type_annotation", Typescript::Asserts => "asserts", - Typescript::Type => "_type", + Typescript::Type2 => "_type", Typescript::RequiredParameter2 => "required_parameter", Typescript::OptionalParameter2 => "optional_parameter", Typescript::OptionalType => "optional_type", @@ -677,7 +677,7 @@ impl From for &'static str { Typescript::PredefinedType => "predefined_type", Typescript::TypeArguments => "type_arguments", Typescript::ObjectType => "object_type", - Typescript::CallSignature2 => "call_signature", + Typescript::CallSignature => "call_signature", Typescript::PropertySignature => "property_signature", Typescript::TypeParameters => "type_parameters", Typescript::TypeParameter => "type_parameter", From 82412972901cfa991c366d29ff14e90e498ecd68 Mon Sep 17 00:00:00 2001 From: Luni-4 Date: Tue, 6 Dec 2022 11:33:41 +0100 Subject: [PATCH 3/5] Use new Java grammar tokens --- src/checker.rs | 2 +- src/metrics/loc.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/checker.rs b/src/checker.rs index 15f75feb1..e5fec5c4f 100644 --- a/src/checker.rs +++ b/src/checker.rs @@ -204,7 +204,7 @@ impl Checker for PythonCode { } impl Checker for JavaCode { - mk_checker!(is_comment, Comment); + mk_checker!(is_comment, LineComment, BlockComment); mk_checker!(is_string, StringLiteral); mk_checker!(is_call, MethodInvocation); mk_checker!(is_func, MethodDeclaration, ConstructorDeclaration); diff --git a/src/metrics/loc.rs b/src/metrics/loc.rs index 95eaa4fcd..c695007f4 100644 --- a/src/metrics/loc.rs +++ b/src/metrics/loc.rs @@ -820,12 +820,12 @@ impl Loc for JavaCode { // https://docs.oracle.com/javase/tutorial/java/nutsandbolts/expressions.html match kind_id { Program => {} - Comment => { + LineComment | BlockComment => { add_cloc_lines(stats, start, end); } AssertStatement | BreakStatement | ContinueStatement | DoStatement | EnhancedForStatement | ExpressionStatement | ForStatement | IfStatement - | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement + | ReturnStatement | SwitchExpression | ThrowStatement | TryStatement | WhileStatement => { stats.lloc.logical_lines += 1; } From ebdefcaad65daf0f8b79c0ffedbc73840db9e2ec Mon Sep 17 00:00:00 2001 From: Luni-4 Date: Tue, 6 Dec 2022 11:37:01 +0100 Subject: [PATCH 4/5] loc: Semicolon not a statement for JavaScript --- src/metrics/loc.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/metrics/loc.rs b/src/metrics/loc.rs index c695007f4..960259700 100644 --- a/src/metrics/loc.rs +++ b/src/metrics/loc.rs @@ -1853,24 +1853,24 @@ mod tests { [ (sloc, 5, usize), // The number of lines is 5 (ploc, 5, usize), // The number of code lines is 5 - (lloc, 7, usize), // The number of statements is 7 + (lloc, 6, usize), // The number of statements is 6 (cloc, 0, usize), // The number of comments is 0 (blank, 0, usize), // The number of blank lines is 0 (sloc_min, 5, usize), (ploc_min, 5, usize), - (lloc_min, 6, usize), + (lloc_min, 5, usize), (cloc_min, 0, usize), (blank_min, 0, usize), (sloc_max, 5, usize), (ploc_max, 5, usize), - (lloc_max, 6, usize), + (lloc_max, 5, usize), (cloc_max, 0, usize), (blank_max, 0, usize) ], [ (sloc_average, 2.5), // The number of spaces is 2 (ploc_average, 2.5), - (lloc_average, 3.5), + (lloc_average, 3.0), (cloc_average, 0.0), (blank_average, 0.0) ] From 96330cd3466055c3ba6922e02fcef4900f0cbcb2 Mon Sep 17 00:00:00 2001 From: Luni-4 Date: Mon, 19 Dec 2022 16:38:09 +0100 Subject: [PATCH 5/5] Update snapshot repository with new grammar values --- tests/repositories/rca-output | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/repositories/rca-output b/tests/repositories/rca-output index c649aed4d..dc717ba0a 160000 --- a/tests/repositories/rca-output +++ b/tests/repositories/rca-output @@ -1 +1 @@ -Subproject commit c649aed4d2ff64a8c891acb8b4b53b961db58db5 +Subproject commit dc717ba0a38be492b7d56335d3ed1a1b59d08f7b