diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/Data/JLD/Flattening/NodeMap.hs | 26 |
2 files changed, 11 insertions, 17 deletions
@@ -9,5 +9,5 @@ Tests are generated from the [official test suite](https://github.com/w3c/json-l | |||
9 | | Feature | Tests | Pass | Status | | 9 | | Feature | Tests | Pass | Status | |
10 | | ---------- | ----- | ---- | ------ | | 10 | | ---------- | ----- | ---- | ------ | |
11 | | Expansion | 371 | 371 | 100% | | 11 | | Expansion | 371 | 371 | 100% | |
12 | | Compaction | ? | 0 | 0% | | 12 | | Compaction | 55 | 54 | 98% | |
13 | | Flattening | ? | 0 | 0% | | 13 | | Flattening | ? | 0 | 0% | |
diff --git a/src/Data/JLD/Flattening/NodeMap.hs b/src/Data/JLD/Flattening/NodeMap.hs index 6c35302..2e6b8e3 100644 --- a/src/Data/JLD/Flattening/NodeMap.hs +++ b/src/Data/JLD/Flattening/NodeMap.hs | |||
@@ -185,9 +185,9 @@ buildNodeMap' element = case element of | |||
185 | if | 185 | if |
186 | -- 6.5. | 186 | -- 6.5. |
187 | | Just referenceNode <- bnmEnvReferenceNode -> bnmModifyNodeMap \nodeMap -> | 187 | | Just referenceNode <- bnmEnvReferenceNode -> bnmModifyNodeMap \nodeMap -> |
188 | if N.memberArray bnmEnvActiveGraph bnmEnvActiveSubject bnmEnvActiveProperty (Object referenceNode) nodeMap | 188 | if N.memberArray bnmEnvActiveGraph (Just id') bnmEnvActiveProperty (Object referenceNode) nodeMap |
189 | then nodeMap | 189 | then nodeMap |
190 | else N.modifyArray bnmEnvActiveGraph bnmEnvActiveSubject bnmEnvActiveProperty (`V.snoc` Object referenceNode) nodeMap | 190 | else N.modifyArray bnmEnvActiveGraph (Just id') bnmEnvActiveProperty (`V.snoc` Object referenceNode) nodeMap |
191 | -- 6.6. | 191 | -- 6.6. |
192 | | isJust bnmEnvActiveProperty -> do | 192 | | isJust bnmEnvActiveProperty -> do |
193 | -- 6.6.1. | 193 | -- 6.6.1. |
@@ -223,25 +223,19 @@ buildNodeMap' element = case element of | |||
223 | case KM.lookup (show KeywordIndex) elementObject' of | 223 | case KM.lookup (show KeywordIndex) elementObject' of |
224 | Just indexValue | 224 | Just indexValue |
225 | | N.hasKey3 bnmEnvActiveGraph (Just id') (Just <| show KeywordIndex) nodeMap' -> throwError <| Left ConflictingIndexes | 225 | | N.hasKey3 bnmEnvActiveGraph (Just id') (Just <| show KeywordIndex) nodeMap' -> throwError <| Left ConflictingIndexes |
226 | | otherwise -> bnmModifyNodeMap <| N.insert bnmEnvActiveGraph (Just id') (Just <| show KeywordType) indexValue | 226 | | otherwise -> bnmModifyNodeMap <| N.insert bnmEnvActiveGraph (Just id') (Just <| show KeywordIndex) indexValue |
227 | -- | 227 | -- |
228 | Nothing -> pure () | 228 | Nothing -> pure () |
229 | 229 | ||
230 | -- 6.9. | 230 | -- 6.9. |
231 | case KM.lookup (show KeywordReverse) elementObject' of | 231 | case KM.lookup (show KeywordReverse) elementObject' of |
232 | Just (Object reverseMap) -> do | 232 | Just (Object reverseMap) -> iforM_ reverseMap \key -> |
233 | -- 6.9.1. | 233 | valueToArray .> mapM_ \value -> |
234 | let referenced = KM.singleton (show KeywordId) (String id') | 234 | void <| bnmBuildNodeMap value \params -> |
235 | 235 | params | |
236 | -- 6.9.3. | 236 | { bnmParamsReferenceNode = Just <| KM.singleton (show KeywordId) (String id') |
237 | iforM_ reverseMap \key -> | 237 | , bnmParamsActiveProperty = Just <| K.toText key |
238 | valueToArray .> mapM_ \value -> do | 238 | } |
239 | void <| bnmBuildNodeMap value \params -> | ||
240 | params | ||
241 | { bnmParamsReferenceNode = Just referenced | ||
242 | , bnmParamsActiveProperty = Just <| K.toText key | ||
243 | } | ||
244 | pure () | ||
245 | -- | 239 | -- |
246 | _ -> pure () | 240 | _ -> pure () |
247 | 241 | ||