mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Merge remote-tracking branch 'origin/master' into ruby-assignment-ftw
This commit is contained in:
commit
29834cd3de
@ -6,5 +6,5 @@ import TreeSitter.Language
|
||||
import TreeSitter.Python
|
||||
|
||||
-- | Statically-known rules corresponding to symbols in the grammar.
|
||||
-- v3 - bump this to regenerate
|
||||
-- v4 - bump this to regenerate
|
||||
mkSymbolDatatype (mkName "Grammar") tree_sitter_python
|
||||
|
@ -117,12 +117,11 @@ expression = handleError (term everything)
|
||||
-- We may at some point wish to write something to perform this chunking for us.
|
||||
-- Medium-term, we should consider the construction of choices from first principles; maybe there’s a better API for us to construct these tables.
|
||||
-- Long-term, can we de/serialize assignments and avoid paying the cost of construction altogether?
|
||||
everything = abcd <|> efil <|> pstv
|
||||
everything = abcd <|> efil <|> pstv <|> w
|
||||
abcd = a <|> b <|> c <|> d
|
||||
efil = e <|> f <|> i <|> l
|
||||
pstv = p <|> s <|> t <|> v
|
||||
a = argument
|
||||
<|> argumentList
|
||||
a = argumentList
|
||||
<|> assertStatement
|
||||
<|> assignment'
|
||||
<|> await
|
||||
@ -181,6 +180,10 @@ expression = handleError (term everything)
|
||||
<|> whileStatement
|
||||
<|> withStatement
|
||||
<|> yield
|
||||
<|> listSplat
|
||||
w = dictionarySplat
|
||||
<|> keywordArgument
|
||||
<|> parenthesizedExpression
|
||||
|
||||
expressions :: Assignment
|
||||
expressions = makeTerm <$> location <*> many expression
|
||||
@ -195,15 +198,20 @@ expressionList = mk <$> symbol ExpressionList <*> children (some expression)
|
||||
where mk _ [child] = child
|
||||
mk location children = makeTerm location children
|
||||
|
||||
argument :: Assignment
|
||||
argument = makeTerm <$> symbol ListSplatArgument <*> (Syntax.Identifier <$> source)
|
||||
<|> makeTerm <$> symbol DictionarySplatArgument <*> (Syntax.Identifier <$> source)
|
||||
<|> makeTerm <$> symbol KeywordArgument <*> children (Statement.Assignment <$> expression <*> expression)
|
||||
listSplat :: Assignment
|
||||
listSplat = makeTerm <$> symbol ListSplat <*> (Syntax.Identifier <$> source)
|
||||
|
||||
dictionarySplat :: Assignment
|
||||
dictionarySplat = makeTerm <$> symbol DictionarySplat <*> (Syntax.Identifier <$> source)
|
||||
|
||||
keywordArgument :: Assignment
|
||||
keywordArgument = makeTerm <$> symbol KeywordArgument <*> children (Statement.Assignment <$> expression <*> expression)
|
||||
|
||||
parenthesizedExpression :: Assignment
|
||||
parenthesizedExpression = symbol ParenthesizedExpression *> children expressions
|
||||
|
||||
parameter :: Assignment
|
||||
parameter = makeTerm <$> symbol DefaultParameter <*> children (Statement.Assignment <$> expression <*> expression)
|
||||
<|> makeTerm <$> symbol ListSplatParameter <*> (Syntax.Identifier <$> source)
|
||||
<|> makeTerm <$> symbol DictionarySplatParameter <*> (Syntax.Identifier <$> source)
|
||||
<|> makeTerm <$> symbol TypedParameter <*> children (Type.Annotation <$> expression <*> type')
|
||||
<|> makeAnnotation <$> symbol TypedDefaultParameter <*> children ((,,) <$> expression <*> expression <*> expression)
|
||||
where
|
||||
|
3
test/fixtures/python/tuple.diffA-B.txt
vendored
3
test/fixtures/python/tuple.diffA-B.txt
vendored
@ -7,8 +7,7 @@
|
||||
{-(Identifier)-}
|
||||
(Identifier)
|
||||
{+(Identifier)+})
|
||||
{+(Tuple
|
||||
(Identifier))+}
|
||||
{+((Identifier))+}
|
||||
{-(Tuple
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
|
3
test/fixtures/python/tuple.diffB-A.txt
vendored
3
test/fixtures/python/tuple.diffB-A.txt
vendored
@ -9,5 +9,4 @@
|
||||
{-(Tuple
|
||||
(Identifier)
|
||||
(Identifier))-}
|
||||
{-(Tuple
|
||||
(Identifier))-})
|
||||
{-((Identifier))-})
|
||||
|
3
test/fixtures/python/tuple.parseB.txt
vendored
3
test/fixtures/python/tuple.parseB.txt
vendored
@ -6,5 +6,4 @@
|
||||
(Tuple
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Tuple
|
||||
(Identifier)))
|
||||
((Identifier)))
|
||||
|
2
vendor/haskell-tree-sitter
vendored
2
vendor/haskell-tree-sitter
vendored
@ -1 +1 @@
|
||||
Subproject commit 415584f7833c49bf06504c14b8fe7b613ae81fa1
|
||||
Subproject commit 58901a36aab575ccb1c1909da7ee92d6d009998c
|
Loading…
Reference in New Issue
Block a user