mirror of
https://github.com/github/semantic.git
synced 2024-12-21 05:41:54 +03:00
Build the expression choice with the choose operator.
This commit is contained in:
parent
52248fcbd4
commit
7b16cd4ddf
@ -115,73 +115,81 @@ expression = handleError (term everything)
|
|||||||
-- We may at some point wish to write something to perform this chunking for us.
|
-- 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.
|
-- 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?
|
-- Long-term, can we de/serialize assignments and avoid paying the cost of construction altogether?
|
||||||
everything = abcd <|> efil <|> pstv <|> w
|
everything = choose
|
||||||
abcd = a <|> b <|> c <|> d
|
[ (ArgumentList, argumentList)
|
||||||
efil = e <|> f <|> i <|> l
|
, (AssertStatement, assertStatement)
|
||||||
pstv = p <|> s <|> t <|> v
|
, (Assignment, assignment')
|
||||||
a = argumentList
|
, (AugmentedAssignment, assignment')
|
||||||
<|> assertStatement
|
, (Await, await)
|
||||||
<|> assignment'
|
, (BinaryOperator, binaryOperator)
|
||||||
<|> await
|
, (Grammar.True, boolean)
|
||||||
b = binaryOperator
|
, (Grammar.False, boolean)
|
||||||
<|> boolean
|
, (BooleanOperator, booleanOperator)
|
||||||
<|> booleanOperator
|
, (BreakStatement, breakStatement)
|
||||||
<|> breakStatement
|
, (Call, call)
|
||||||
<|> call
|
, (ClassDefinition, classDefinition)
|
||||||
<|> classDefinition
|
, (ComparisonOperator, comparisonOperator)
|
||||||
c = comparisonOperator
|
, (ListComprehension, comprehension)
|
||||||
<|> comprehension
|
, (GeneratorExpression, comprehension)
|
||||||
<|> concatenatedString
|
, (SetComprehension, comprehension)
|
||||||
<|> conditionalExpression
|
, (DictionaryComprehension, comprehension)
|
||||||
<|> continueStatement
|
, (ConcatenatedString, concatenatedString)
|
||||||
d = decoratedDefinition
|
, (ConditionalExpression, conditionalExpression)
|
||||||
<|> deleteStatement
|
, (ContinueStatement, continueStatement)
|
||||||
<|> dictionary
|
, (DecoratedDefinition, decoratedDefinition)
|
||||||
<|> dottedName
|
, (DeleteStatement, deleteStatement)
|
||||||
e = ellipsis
|
, (Dictionary, dictionary)
|
||||||
<|> exceptClause
|
, (DottedName, dottedName)
|
||||||
<|> execStatement
|
, (Grammar.Ellipsis, ellipsis)
|
||||||
<|> expressionList
|
, (ExceptClause, exceptClause)
|
||||||
<|> expressionStatement
|
, (ExecStatement, execStatement)
|
||||||
f = finallyClause
|
, (ExpressionList, expressionList)
|
||||||
<|> float
|
, (ExpressionStatement, expressionStatement)
|
||||||
<|> forInClause
|
, (FinallyClause, finallyClause)
|
||||||
<|> forStatement
|
, (Float, float)
|
||||||
<|> functionDefinition
|
, (ForInClause, forInClause)
|
||||||
<|> globalStatement
|
, (ForStatement, forStatement)
|
||||||
i = identifier
|
, (FunctionDefinition, functionDefinition)
|
||||||
<|> ifClause
|
, (GlobalStatement, globalStatement)
|
||||||
<|> ifStatement
|
, (IfClause, ifClause)
|
||||||
<|> import'
|
, (IfStatement, ifStatement)
|
||||||
<|> identifier
|
, (ImportStatement, import')
|
||||||
<|> integer
|
, (ImportFromStatement, import')
|
||||||
l = list'
|
, (AliasedImport, import')
|
||||||
<|> memberAccess
|
, (WildcardImport, import')
|
||||||
<|> none
|
, (Identifier, identifier)
|
||||||
<|> nonlocalStatement
|
, (Identifier', identifier)
|
||||||
<|> notOperator
|
, (Integer, integer)
|
||||||
p = pair
|
, (List, list')
|
||||||
<|> parameter
|
, (Attribute, memberAccess)
|
||||||
<|> passStatement
|
, (None, none)
|
||||||
<|> printStatement
|
, (NonlocalStatement, nonlocalStatement)
|
||||||
<|> raiseStatement
|
, (NotOperator, notOperator)
|
||||||
<|> returnStatement
|
, (Pair, pair)
|
||||||
s = set
|
, (DefaultParameter, parameter)
|
||||||
<|> slice
|
, (TypedParameter, parameter)
|
||||||
<|> string
|
, (TypedDefaultParameter, parameter)
|
||||||
<|> subscript
|
, (PassStatement, passStatement)
|
||||||
t = tryStatement
|
, (PrintStatement, printStatement)
|
||||||
<|> tuple
|
, (RaiseStatement, raiseStatement)
|
||||||
<|> type'
|
, (ReturnStatement, returnStatement)
|
||||||
<|> unaryOperator
|
, (Set, set)
|
||||||
v = variables
|
, (Slice, slice)
|
||||||
<|> whileStatement
|
, (String, string)
|
||||||
<|> withStatement
|
, (Subscript, subscript)
|
||||||
<|> yield
|
, (TryStatement, tryStatement)
|
||||||
<|> listSplat
|
, (Tuple, tuple)
|
||||||
w = dictionarySplat
|
, (Type, type')
|
||||||
<|> keywordArgument
|
, (UnaryOperator, unaryOperator)
|
||||||
<|> parenthesizedExpression
|
, (Variables, variables)
|
||||||
|
, (WhileStatement, whileStatement)
|
||||||
|
, (WithStatement, withStatement)
|
||||||
|
, (Yield, yield)
|
||||||
|
, (ListSplat, listSplat)
|
||||||
|
, (DictionarySplat, dictionarySplat)
|
||||||
|
, (KeywordArgument, keywordArgument)
|
||||||
|
, (ParenthesizedExpression, parenthesizedExpression)
|
||||||
|
]
|
||||||
|
|
||||||
expressions :: Assignment
|
expressions :: Assignment
|
||||||
expressions = makeTerm <$> location <*> many expression
|
expressions = makeTerm <$> location <*> many expression
|
||||||
|
Loading…
Reference in New Issue
Block a user