From 5ba68c5f613657ccc401dbd81f56b2aaa355a885 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Thu, 20 Jan 2022 17:00:00 +0100 Subject: [PATCH] Update parsers --- src/org/org_parser_properties_block.nim | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/org/org_parser_properties_block.nim b/src/org/org_parser_properties_block.nim index 6cbac4b..2b49fe7 100644 --- a/src/org/org_parser_properties_block.nim +++ b/src/org/org_parser_properties_block.nim @@ -11,9 +11,8 @@ import ../parser/utils {.experimental: "caseStmtMacros".} - let propertiesKeyParser* = ignore(ch(':')) + anyUntil(choice(@[str(": "), newline])) -let propertiesValueParser* = ignore(str(": ")) + anyUntil(newline) + ignore(newline) +let propertiesValueParser* = ignore(str(":") + optional(ch(' '))) + optional(anyUntil(newline)) + ignore(newline) let propertiesParser* = proc(parser: Parser): ParserResult {.closure.} = let tokens = parser.tokens @@ -48,15 +47,15 @@ let parseProperties* = @[ propertiesParser, propertiesEndParser, ), - ignore(propertiesEndParser), + # ignore(propertiesEndParser), ] when isMainModule: let example = initParserResult(""":PROPERTIES: -:PROP_NAME: Value -:PROP_NAME: Value -:PROP_NAME: Value -:PROP_NAME: Value +:PROP_NAME: VALUE +:PROP_NAME: VAL +:PROP_NAME: 3 +:PROP_NAME: 2 :PROPERTIES_END:""").parseSeq(parseProperties) echo example