mirror of https://github.com/status-im/NimYAML.git
Lexer: Fixed parsing verbatim tags
This commit is contained in:
parent
0544a8bba0
commit
ada4a36e6e
|
@ -551,8 +551,7 @@ iterator tokens*(my: var YamlLexer): YamlLexerToken {.closure.} =
|
|||
of '\'':
|
||||
state = ylSingleQuotedScalar
|
||||
of '!':
|
||||
my.content.add(c)
|
||||
state = ylTagHandle
|
||||
lastSpecialChar = '!'
|
||||
of '&':
|
||||
state = ylAnchor
|
||||
of '*':
|
||||
|
|
|
@ -183,3 +183,14 @@ foo:
|
|||
ensure("foo: *bar", [t(yamlLineStart, ""), t(yamlScalar, "foo"),
|
||||
t(yamlColon, nil), t(yamlAlias, "bar"),
|
||||
t(yamlStreamEnd, nil)])
|
||||
|
||||
test "Tag handle":
|
||||
ensure("!t!str tagged", [t(yamlLineStart, ""), t(yamlTagHandle, "!t!"),
|
||||
t(yamlTagSuffix, "str"),
|
||||
t(yamlScalar, "tagged"), t(yamlStreamEnd, nil)])
|
||||
|
||||
test "Verbatim tag handle":
|
||||
ensure("!<tag:http://example.com/str> tagged",
|
||||
[t(yamlLineStart, ""),
|
||||
t(yamlVerbatimTag, "tag:http://example.com/str"),
|
||||
t(yamlScalar, "tagged"), t(yamlStreamEnd, nil)])
|
Loading…
Reference in New Issue