1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 09:15:01 +03:00

Don’t match comments in JS or Ruby term assignment.

This commit is contained in:
Rob Rix 2017-01-20 16:35:33 -05:00
parent f55d90084f
commit 5da93d8274
2 changed files with 2 additions and 4 deletions

View File

@ -14,7 +14,7 @@ termAssignment
-> Record '[Range, Category, SourceSpan] -- ^ The proposed annotation for the term.
-> [ SyntaxTerm Text '[Range, Category, SourceSpan] ] -- ^ The child nodes of the term.
-> Maybe (S.Syntax Text (SyntaxTerm Text '[Range, Category, SourceSpan])) -- ^ The resulting term, in IO.
termAssignment source (_ :. category :. _ :. Nil) children
termAssignment _ (_ :. category :. _ :. Nil) children
= case (category, children) of
(Return, _) -> Just $ S.Return children
(Assignment, [ identifier, value ]) -> Just $ S.Assignment identifier value
@ -36,7 +36,6 @@ termAssignment source (_ :. category :. _ :. Nil) children
(Case, [ expr, body ]) -> Just $ S.Case expr [body]
(Object, _) -> Just . S.Object Nothing $ foldMap toTuple children
(Pair, _) -> Just $ S.Fixed children
(Comment, _) -> Just . S.Comment $ toText source
(If, expr : rest ) -> Just $ S.If expr rest
(While, expr : rest ) -> Just $ S.While expr rest
(DoWhile, [ expr, body ]) -> Just $ S.DoWhile expr body

View File

@ -15,7 +15,7 @@ termAssignment
-> Record '[Range, Category, SourceSpan] -- ^ The proposed annotation for the term.
-> [ SyntaxTerm Text '[Range, Category, SourceSpan] ] -- ^ The child nodes of the term.
-> Maybe (S.Syntax Text (SyntaxTerm Text '[Range, Category, SourceSpan])) -- ^ The resulting term, in IO.
termAssignment source (_ :. category :. _ :. Nil) children
termAssignment _ (_ :. category :. _ :. Nil) children
= case (category, children) of
(ArgumentPair, [ k, v ] ) -> Just $ S.Pair k v
(KeywordParameter, [ k, v ] ) -> Just $ S.Pair k v
@ -43,7 +43,6 @@ termAssignment source (_ :. category :. _ :. Nil) children
( superclass : body ) | Superclass <- Info.category (extract superclass) -> S.Class constant (Just superclass) body
_ -> S.Class constant Nothing rest
(SingletonClass, identifier : rest ) -> Just $ S.Class identifier Nothing rest
(Comment, _ ) -> Just . S.Comment $ toText source
(Ternary, condition : cases) -> Just $ S.Ternary condition cases
(Constant, _ ) -> Just $ S.Fixed children
(MethodCall, fn : args) | MemberAccess <- Info.category (extract fn)