Update parsers
This commit is contained in:
@@ -11,9 +11,8 @@ import ../parser/utils
|
|||||||
|
|
||||||
{.experimental: "caseStmtMacros".}
|
{.experimental: "caseStmtMacros".}
|
||||||
|
|
||||||
|
|
||||||
let propertiesKeyParser* = ignore(ch(':')) + anyUntil(choice(@[str(": "), newline]))
|
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 propertiesParser* = proc(parser: Parser): ParserResult {.closure.} =
|
||||||
let tokens = parser.tokens
|
let tokens = parser.tokens
|
||||||
@@ -48,15 +47,15 @@ let parseProperties* = @[
|
|||||||
propertiesParser,
|
propertiesParser,
|
||||||
propertiesEndParser,
|
propertiesEndParser,
|
||||||
),
|
),
|
||||||
ignore(propertiesEndParser),
|
# ignore(propertiesEndParser),
|
||||||
]
|
]
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
let example = initParserResult(""":PROPERTIES:
|
let example = initParserResult(""":PROPERTIES:
|
||||||
:PROP_NAME: Value
|
:PROP_NAME: VALUE
|
||||||
:PROP_NAME: Value
|
:PROP_NAME: VAL
|
||||||
:PROP_NAME: Value
|
:PROP_NAME: 3
|
||||||
:PROP_NAME: Value
|
:PROP_NAME: 2
|
||||||
:PROPERTIES_END:""").parseSeq(parseProperties)
|
:PROPERTIES_END:""").parseSeq(parseProperties)
|
||||||
|
|
||||||
echo example
|
echo example
|
||||||
|
|||||||
Reference in New Issue
Block a user