mirror of
https://github.com/github/semantic.git
synced 2025-01-03 21:16:12 +03:00
Add in NumberLiteral category
This commit is contained in:
parent
ed00e99250
commit
68d932594e
@ -104,6 +104,8 @@ data Category
|
||||
| RelationalOperator
|
||||
-- | An empty statement. (e.g. ; in JavaScript)
|
||||
| Empty
|
||||
-- | A number literal.
|
||||
| NumberLiteral
|
||||
deriving (Eq, Generic, Ord, Show)
|
||||
|
||||
-- Instances
|
||||
@ -127,6 +129,7 @@ instance Arbitrary Category where
|
||||
, pure Args
|
||||
, pure StringLiteral
|
||||
, pure IntegerLiteral
|
||||
, pure NumberLiteral
|
||||
, pure Regex
|
||||
, pure Return
|
||||
, pure SymbolLiteral
|
||||
|
@ -246,6 +246,7 @@ instance HasCategory Category where
|
||||
C.Operator -> "operator"
|
||||
Identifier -> "identifier"
|
||||
IntegerLiteral -> "integer"
|
||||
NumberLiteral -> "number"
|
||||
Other s -> s
|
||||
C.Pair -> "pair"
|
||||
Params -> "params"
|
||||
|
@ -106,7 +106,7 @@ breakDownLeavesByWord source = cata replaceIn
|
||||
-- Some Category constructors should retain their original structure, and not be sliced
|
||||
-- into words. This Set represents those Category constructors for which we want to
|
||||
-- preserve the original Syntax.
|
||||
preserveSyntax = Set.fromList [Regex, Category.Comment, Category.TemplateString]
|
||||
preserveSyntax = Set.fromList [Regex, Category.Comment, Category.TemplateString, Category.NumberLiteral]
|
||||
|
||||
-- | Transcode a file to a unicode source.
|
||||
transcode :: B1.ByteString -> IO (Source Char)
|
||||
|
@ -108,6 +108,7 @@ categoryForJavaScriptProductionName name = case name of
|
||||
"pair" -> Pair
|
||||
"string" -> StringLiteral
|
||||
"integer" -> IntegerLiteral
|
||||
"number" -> NumberLiteral
|
||||
"symbol" -> SymbolLiteral
|
||||
"array" -> ArrayLiteral
|
||||
"function" -> Function
|
||||
|
@ -42,6 +42,7 @@ styleName category = "category-" <> case category of
|
||||
StringLiteral -> "string"
|
||||
SymbolLiteral -> "symbol"
|
||||
IntegerLiteral -> "integer"
|
||||
NumberLiteral -> "number"
|
||||
C.Comment -> "comment"
|
||||
C.FunctionCall -> "function_call"
|
||||
C.Function -> "function"
|
||||
|
Loading…
Reference in New Issue
Block a user