mirror of https://github.com/status-im/NimYAML.git
Fixed small bugs
* allow '!' at beginning of tag URI in %TAG directive * recognise \t as start of more indented line in block flow scalar * Made testEventParser more robust
This commit is contained in:
parent
91cbf92650
commit
1c61486739
|
@ -492,6 +492,10 @@ template tagUri(lexer: BaseLexer, uri: var string) =
|
||||||
while lexer.buf[lexer.bufpos] in space:
|
while lexer.buf[lexer.bufpos] in space:
|
||||||
lexer.bufpos.inc()
|
lexer.bufpos.inc()
|
||||||
var c = lexer.buf[lexer.bufpos]
|
var c = lexer.buf[lexer.bufpos]
|
||||||
|
if c == '!':
|
||||||
|
uri.add(c)
|
||||||
|
lexer.bufpos.inc()
|
||||||
|
c = lexer.buf[lexer.bufpos]
|
||||||
while c notin spaceOrLineEnd:
|
while c notin spaceOrLineEnd:
|
||||||
case c
|
case c
|
||||||
of 'a' .. 'z', 'A' .. 'Z', '0' .. '9', '#', ';', '/', '?', ':', '@', '&',
|
of 'a' .. 'z', 'A' .. 'Z', '0' .. '9', '#', ';', '/', '?', ':', '@', '&',
|
||||||
|
@ -964,7 +968,7 @@ template blockScalar(lexer: BaseLexer, content: var string,
|
||||||
of EndOfFile:
|
of EndOfFile:
|
||||||
stateAfter = fpBlockLineStart
|
stateAfter = fpBlockLineStart
|
||||||
break outer
|
break outer
|
||||||
of ' ':
|
of ' ', '\t':
|
||||||
if not literal:
|
if not literal:
|
||||||
if not recentLineMoreIndented:
|
if not recentLineMoreIndented:
|
||||||
recentLineMoreIndented = true
|
recentLineMoreIndented = true
|
||||||
|
|
|
@ -63,6 +63,8 @@ proc nextToken(lex: var EventLexer): LexerToken =
|
||||||
while lex.buf[lex.bufpos] != '>':
|
while lex.buf[lex.bufpos] != '>':
|
||||||
lex.content.add(lex.buf[lex.bufpos])
|
lex.content.add(lex.buf[lex.bufpos])
|
||||||
lex.bufpos.inc()
|
lex.bufpos.inc()
|
||||||
|
if lex.buf[lex.bufpos] == EndOfFile:
|
||||||
|
raise newException(EventStreamError, "Unclosed tag URI!")
|
||||||
result = chevTag
|
result = chevTag
|
||||||
lex.bufpos.inc()
|
lex.bufpos.inc()
|
||||||
of '&':
|
of '&':
|
||||||
|
|
Loading…
Reference in New Issue