From ebe077c7c8fceddf86d5877580a4278f99772c79 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 17 Aug 2016 10:59:24 -0500 Subject: [PATCH 1/6] Add BitwiseOperator Category constructor --- src/Category.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Category.hs b/src/Category.hs index 980ef002a..2f8f6baa2 100644 --- a/src/Category.hs +++ b/src/Category.hs @@ -14,6 +14,8 @@ data Category | Error -- | A boolean expression. | Boolean + -- | A bitwise operator. + | BitwiseOperator -- | An operator with 2 operands. | BinaryOperator -- | A literal key-value data structure. From b93bffe8310fd4e81f66ae5930f446e3464751dd Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 17 Aug 2016 10:59:39 -0500 Subject: [PATCH 2/6] Add BitwiseOperator constructor to list of operators --- src/Parser.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Parser.hs b/src/Parser.hs index f59b65e09..8f98aedd9 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -19,7 +19,7 @@ type Parser f a = SourceBlob -> IO (Cofree f a) -- | Whether a category is an Operator Category isOperator :: Category -> Bool -isOperator = flip Set.member (Set.fromList [ Operator, BinaryOperator ]) +isOperator = flip Set.member (Set.fromList [ Operator, BinaryOperator, BitwiseOperator ]) -- | Construct a term given source, the span covered, the annotation for the term, and its children. -- From c91ec6c9a1861276735bd4d045e9cf4bd6f685c6 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 17 Aug 2016 11:00:01 -0500 Subject: [PATCH 3/6] Allow BitwiseOperator matching in diff summaries --- src/DiffSummary.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DiffSummary.hs b/src/DiffSummary.hs index d9804a821..af38900aa 100644 --- a/src/DiffSummary.hs +++ b/src/DiffSummary.hs @@ -172,6 +172,7 @@ instance HasCategory Category where toCategoryName = \case ArrayLiteral -> "array" BinaryOperator -> "binary operator" + BitwiseOperator -> "bitwise operator" Boolean -> "boolean" DictionaryLiteral -> "dictionary" C.Comment -> "comment" From 9907711099f2d26d9c5489d94c74bd023c31ea32 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 17 Aug 2016 11:00:25 -0500 Subject: [PATCH 4/6] Make "bitwise_op" a generic language production --- src/TreeSitter.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TreeSitter.hs b/src/TreeSitter.hs index d76c460eb..e2ea4b514 100644 --- a/src/TreeSitter.hs +++ b/src/TreeSitter.hs @@ -40,7 +40,6 @@ categoriesForLanguage language name = case (language, name) of (JavaScript, "generator_function") -> Function (JavaScript, "math_op") -> BinaryOperator -- bitwise operator, e.g. +, -, *, /. (JavaScript, "bool_op") -> BinaryOperator -- boolean operator, e.g. ||, &&. - (JavaScript, "bitwise_op") -> BinaryOperator -- bitwise operator, e.g. ^, &, etc. (JavaScript, "rel_op") -> BinaryOperator -- relational operator, e.g. >, <, <=, >=, ==, !=. (JavaScript, "comma_op") -> CommaOperator -- comma operator, e.g. expr1, expr2. (JavaScript, "delete_op") -> Operator -- delete operator, e.g. delete x[2]. @@ -96,6 +95,7 @@ defaultCategoryForNodeName name = case name of "try_statement" -> Try "method_definition" -> Method "comment" -> Comment + "bitwise_op" -> BitwiseOperator _ -> Other name {-# INLINE defaultCategoryForNodeName #-} From 3dae5cb2f86068564a2969f4f81881818b3fda1c Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 17 Aug 2016 11:00:47 -0500 Subject: [PATCH 5/6] Update Split to account for newly added CommaOperator and BitwiseOperator constructors --- src/Renderer/Split.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Renderer/Split.hs b/src/Renderer/Split.hs index c8559d17b..b12418bbe 100644 --- a/src/Renderer/Split.hs +++ b/src/Renderer/Split.hs @@ -34,6 +34,8 @@ styleName category = "category-" <> case category of Program -> "program" C.Error -> "error" BinaryOperator -> "binary-operator" + BitwiseOperator -> "bitwise-operator" + C.CommaOperator -> "comma-operator" Boolean -> "boolean" DictionaryLiteral -> "dictionary" C.Pair -> "pair" From 2fa8f1487e4e23c0fa16ca6df7a2fe73e500fd0c Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 17 Aug 2016 11:17:09 -0500 Subject: [PATCH 6/6] Submodule update --- vendor/tree-sitter-parsers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/tree-sitter-parsers b/vendor/tree-sitter-parsers index 07bc6380b..61b004baf 160000 --- a/vendor/tree-sitter-parsers +++ b/vendor/tree-sitter-parsers @@ -1 +1 @@ -Subproject commit 07bc6380b1e924395b5d40f33209783b96dd45fe +Subproject commit 61b004baf78814b0335c7a1a44f6d2ba0e848e18