13 lines
326 B
Nim
13 lines
326 B
Nim
|
import ../types
|
||
|
import json
|
||
|
|
||
|
proc mkParseMsg*(common: CommonData): proc =
|
||
|
proc parseMsg(m: JsonNode): Remark =
|
||
|
let typeStr = m{"type"}.getStr()
|
||
|
if typeStr != "REM":
|
||
|
raise newException(CatchableError, "Unimplemented hafas msg type: " & typeStr)
|
||
|
return common.remarks[m{"remX"}.getInt()]
|
||
|
|
||
|
return parseMsg
|
||
|
|