This is an archive of the discontinued LLVM Phabricator instance.

YAML: Implement block scalar parsing
ClosedPublic

Authored by arphaman on May 5 2015, 12:57 PM.

Details

Summary

This patch implements the parsing of YAML block scalars. Some code existed there before, but it couldn't parse block scalars.
This patch is based on the patch 'http://reviews.llvm.org/D9448' that enables the YAMLParser tests.
I've added a new yaml node type to represent the block scalar values.
I've deleted the files 'spec-09-27.test' and 'spec-09-28.test' as they are identical to the file 'spec-09-26.test'.

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman updated this revision to Diff 24963.May 5 2015, 12:57 PM
arphaman retitled this revision from to YAML: Implement block scalar parsing.
arphaman updated this object.
arphaman edited the test plan for this revision. (Show Details)
arphaman added reviewers: bogner, bob.wilson, dexonsmith.
arphaman set the repository for this revision to rL LLVM.
arphaman added a subscriber: Unknown Object (MLST).
arphaman updated this revision to Diff 25106.May 6 2015, 4:47 PM

As suggested by Duncan, I took out the extraction of the skipComment method from this patch,
which I've committed separately in r236663. I also took out the change to the KeyValueNode skip method,
which I've committed separately in r236669.

arphaman updated this revision to Diff 25701.May 13 2015, 9:47 AM

I've applied Duncan's suggestions to this patch:

  • Got rid of line folding, it will go into a separate patch.
  • Refactored and extracted functions that scan block scalar header, chomping indicator, indent indicator, search for block's indentation and scan the block indentation.
  • Added helper functions advanceWhile, consumeLineBreakIfPresent and applyChompingIndicator.
  • Decided to keep the name Start instead of renaming it to BlockStart.
  • Used a SmallString instead of an output stream.
  • Asserted that the first character is either an '|' or '>'.
arphaman updated this revision to Diff 25702.May 13 2015, 9:53 AM

This update uses a new helper function that consumes a line break in another part of code that I forgot to update last time.

arphaman updated this revision to Diff 25736.May 13 2015, 3:06 PM

I've updated the patch taking Duncan's suggestions into account.

This revision was automatically updated to reflect the committed changes.
llvm/trunk/test/YAMLParser/spec-09-24.test