1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Duplicate Symbol

This commit is contained in:
Timothy Clem 2017-07-06 09:44:31 -07:00
parent 0aa0c614b7
commit 83642f15e6

View File

@ -133,15 +133,12 @@ literal =
<|> makeTerm <$> symbol Grammar.False <*> (Literal.false <$ source) <|> makeTerm <$> symbol Grammar.False <*> (Literal.false <$ source)
<|> makeTerm <$> symbol Grammar.Integer <*> (Literal.Integer <$> source) <|> makeTerm <$> symbol Grammar.Integer <*> (Literal.Integer <$> source)
<|> makeTerm <$> symbol Grammar.Nil <*> (Literal.Null <$ source) <|> makeTerm <$> symbol Grammar.Nil <*> (Literal.Null <$ source)
<|> makeTerm <$> symbol Symbol <*> (Literal.Symbol <$> source)
-- TODO: Do we want to represent the difference between .. and ... -- TODO: Do we want to represent the difference between .. and ...
<|> makeTerm <$> symbol Range <*> children (Literal.Range <$> statement <*> statement) <|> makeTerm <$> symbol Range <*> children (Literal.Range <$> statement <*> statement)
<|> makeTerm <$> symbol Array <*> children (Literal.Array <$> many statement) <|> makeTerm <$> symbol Array <*> children (Literal.Array <$> many statement)
<|> makeTerm <$> symbol Hash <*> children (Literal.Hash <$> many pairs) <|> makeTerm <$> symbol Hash <*> children (Literal.Hash <$> many pairs)
-- TODO: Give subshell it's own literal and allow interpolation -- TODO: Give subshell it's own literal and allow interpolation
<|> makeTerm <$> symbol Subshell <*> (Literal.TextElement <$> source) <|> makeTerm <$> symbol Subshell <*> (Literal.TextElement <$> source)
-- TODO: Handle interpolation
<|> makeTerm <$> symbol Symbol <*> (Literal.Symbol <$> source)
<|> makeTerm <$> symbol Integer <*> (Literal.Integer <$> source) <|> makeTerm <$> symbol Integer <*> (Literal.Integer <$> source)
<|> makeTerm <$> symbol Float <*> (Literal.Float <$> source) <|> makeTerm <$> symbol Float <*> (Literal.Float <$> source)
-- TODO: Handle interpolation -- TODO: Handle interpolation
@ -150,6 +147,8 @@ literal =
<|> makeTerm <$> symbol ChainedString <*> children (Literal.TextElement . mconcat <$> many (symbol String *> source)) <|> makeTerm <$> symbol ChainedString <*> children (Literal.TextElement . mconcat <$> many (symbol String *> source))
-- TODO: Handle interpolation, dedicated literal? -- TODO: Handle interpolation, dedicated literal?
<|> makeTerm <$> symbol Regex <*> (Literal.TextElement <$> source) <|> makeTerm <$> symbol Regex <*> (Literal.TextElement <$> source)
-- TODO: Handle interpolation
<|> makeTerm <$> symbol Symbol <*> (Literal.Symbol <$> source)
where where
pairs = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> statement <*> statement) pairs = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> statement <*> statement)