1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

symbol constructs Jump nodes.

This commit is contained in:
Rob Rix 2017-08-31 12:33:24 -04:00
parent 3e5953c0c2
commit 38ec3182e8

View File

@ -167,7 +167,7 @@ currentNode = tracing CurrentNode `Then` return
-- | Zero-width match of a node with the given symbol, producing the current nodes location. -- | Zero-width match of a node with the given symbol, producing the current nodes location.
symbol :: (Bounded grammar, Ix grammar, HasCallStack) => grammar -> Assignment ast grammar (Record Location) symbol :: (Bounded grammar, Ix grammar, HasCallStack) => grammar -> Assignment ast grammar (Record Location)
symbol s = tracing (Choose [s] (IntMap.singleton (toIndex s) location) Nothing) `Then` id symbol s = tracing (Jump [s] (array (s, s) [(s, Just location)]) Nothing) `Then` id
-- | A rule to produce a nodes source as a ByteString. -- | A rule to produce a nodes source as a ByteString.
source :: HasCallStack => Assignment ast grammar ByteString source :: HasCallStack => Assignment ast grammar ByteString