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 '\'':
|
of '\'':
|
||||||
state = ylSingleQuotedScalar
|
state = ylSingleQuotedScalar
|
||||||
of '!':
|
of '!':
|
||||||
my.content.add(c)
|
lastSpecialChar = '!'
|
||||||
state = ylTagHandle
|
|
||||||
of '&':
|
of '&':
|
||||||
state = ylAnchor
|
state = ylAnchor
|
||||||
of '*':
|
of '*':
|
||||||
|
|
|
@ -182,4 +182,15 @@ foo:
|
||||||
test "Alias":
|
test "Alias":
|
||||||
ensure("foo: *bar", [t(yamlLineStart, ""), t(yamlScalar, "foo"),
|
ensure("foo: *bar", [t(yamlLineStart, ""), t(yamlScalar, "foo"),
|
||||||
t(yamlColon, nil), t(yamlAlias, "bar"),
|
t(yamlColon, nil), t(yamlAlias, "bar"),
|
||||||
t(yamlStreamEnd, nil)])
|
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