1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 04:41:47 +03:00

Merge branch 'master' into method-call-improvements

This commit is contained in:
Rick Winfrey 2016-08-17 16:20:01 -05:00
commit b86b3218dc
6 changed files with 8 additions and 3 deletions

View File

@ -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.

View File

@ -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"

View File

@ -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.
--

View File

@ -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"

View File

@ -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 #-}

@ -1 +1 @@
Subproject commit 07bc6380b1e924395b5d40f33209783b96dd45fe
Subproject commit 61b004baf78814b0335c7a1a44f6d2ba0e848e18