Eliminated dead code, fixed serialization

* fpBlockContinueScalar wasn't used anymore and has been removed
 * Do not mark scalarContent in events as shallow because it breaks
   peeking in YamlStreams
This commit is contained in:
Felix Krause 2016-03-20 14:19:46 +01:00
parent a1f914eee4
commit a9b565c35c
1 changed files with 2 additions and 28 deletions

View File

@ -6,9 +6,8 @@
type type
FastParseState = enum FastParseState = enum
fpInitial, fpBlockAfterObject, fpBlockAfterPlainScalar, fpInitial, fpBlockAfterObject, fpBlockAfterPlainScalar, fpBlockObjectStart,
fpBlockObjectStart, fpBlockContinueScalar, fpExpectDocEnd, fpFlow, fpExpectDocEnd, fpFlow, fpFlowAfterObject, fpAfterDocument
fpFlowAfterObject, fpAfterDocument
FastParseLevelKind = enum FastParseLevelKind = enum
fplUnknown, fplSequence, fplMapKey, fplMapValue, fplSinglePairKey, fplUnknown, fplSequence, fplMapKey, fplMapValue, fplSinglePairKey,
@ -92,7 +91,6 @@ template yieldShallowScalar(content: string) {.dirty.} =
var e = YamlStreamEvent(kind: yamlScalar, scalarTag: tag, var e = YamlStreamEvent(kind: yamlScalar, scalarTag: tag,
scalarAnchor: anchor) scalarAnchor: anchor)
shallowCopy(e.scalarContent, content) shallowCopy(e.scalarContent, content)
shallow(e.scalarContent)
yield e yield e
template yieldLevelEnd() {.dirty.} = template yieldLevelEnd() {.dirty.} =
@ -1130,30 +1128,6 @@ proc parse*(p: YamlParser, s: Stream): YamlStream =
else: else:
yield startDocEvent() yield startDocEvent()
state = fpBlockObjectStart state = fpBlockObjectStart
of fpBlockContinueScalar:
debug("state: fpBlockContinueScalar")
p.lexer.skipWhitespace()
case p.lexer.buf[p.lexer.bufpos]
of '\l':
newlines.inc()
p.lexer.bufpos = p.lexer.handleLF(p.lexer.bufpos)
state = fpBlockObjectStart
of '\c':
newlines.inc()
p.lexer.bufpos = p.lexer.handleCR(p.lexer.bufpos)
of ':':
if p.lexer.isPlainSafe(p.lexer.bufpos + 1, cBlock):
continueMultilineScalar()
else:
startToken()
parserError("Unexpected token")
of '#':
yieldShallowScalar(content)
p.lexer.lineEnding()
handleLineEnd(true)
handleObjectEnd(fpBlockObjectStart)
else:
continueMultilineScalar()
of fpBlockAfterPlainScalar: of fpBlockAfterPlainScalar:
debug("state: blockAfterPlainScalar") debug("state: blockAfterPlainScalar")
p.lexer.skipWhitespace() p.lexer.skipWhitespace()