mirror of
https://github.com/github/semantic.git
synced 2024-12-25 16:02:43 +03:00
Construct well-formed nodes.
This commit is contained in:
parent
2a3f0294ac
commit
9c75981833
@ -88,8 +88,8 @@ spec = do
|
|||||||
it "does not drop anonymous nodes when requested" $
|
it "does not drop anonymous nodes when requested" $
|
||||||
runAssignment ((,) <$> magenta <*> red) (makeState "magenta red" [Rose (rec Magenta 0 7) [], Rose (rec Red 8 11) []]) `shouldBe` Result [] (Just (AssignmentState 11 (Info.SourcePos 1 12) "" [], (Out "magenta", Out "red")))
|
runAssignment ((,) <$> magenta <*> red) (makeState "magenta red" [Rose (rec Magenta 0 7) [], Rose (rec Red 8 11) []]) `shouldBe` Result [] (Just (AssignmentState 11 (Info.SourcePos 1 12) "" [], (Out "magenta", Out "red")))
|
||||||
|
|
||||||
rec :: symbol -> Int -> Int -> Record '[symbol, Range, SourceSpan]
|
rec :: symbol -> Int -> Int -> Record '[Maybe symbol, Range, SourceSpan]
|
||||||
rec symbol start end = symbol :. Range start end :. Info.SourceSpan (Info.SourcePos 1 (succ start)) (Info.SourcePos 1 (succ end)) :. Nil
|
rec symbol start end = Just symbol :. Range start end :. Info.SourceSpan (Info.SourcePos 1 (succ start)) (Info.SourcePos 1 (succ end)) :. Nil
|
||||||
|
|
||||||
data Grammar = Red | Green | Blue | Magenta
|
data Grammar = Red | Green | Blue | Magenta
|
||||||
deriving (Enum, Eq, Show)
|
deriving (Enum, Eq, Show)
|
||||||
|
Loading…
Reference in New Issue
Block a user