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:
Felix Krause 2016-03-16 19:20:18 +01:00
parent 91cbf92650
commit 1c61486739
2 changed files with 7 additions and 1 deletions

View File

@ -492,6 +492,10 @@ template tagUri(lexer: BaseLexer, uri: var string) =
while lexer.buf[lexer.bufpos] in space:
lexer.bufpos.inc()
var c = lexer.buf[lexer.bufpos]
if c == '!':
uri.add(c)
lexer.bufpos.inc()
c = lexer.buf[lexer.bufpos]
while c notin spaceOrLineEnd:
case c
of 'a' .. 'z', 'A' .. 'Z', '0' .. '9', '#', ';', '/', '?', ':', '@', '&',
@ -964,7 +968,7 @@ template blockScalar(lexer: BaseLexer, content: var string,
of EndOfFile:
stateAfter = fpBlockLineStart
break outer
of ' ':
of ' ', '\t':
if not literal:
if not recentLineMoreIndented:
recentLineMoreIndented = true

View File

@ -63,6 +63,8 @@ proc nextToken(lex: var EventLexer): LexerToken =
while lex.buf[lex.bufpos] != '>':
lex.content.add(lex.buf[lex.bufpos])
lex.bufpos.inc()
if lex.buf[lex.bufpos] == EndOfFile:
raise newException(EventStreamError, "Unclosed tag URI!")
result = chevTag
lex.bufpos.inc()
of '&':