diff options
author | Alex Lorenz <arphaman@gmail.com> | 2015-05-13 23:10:51 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2015-05-13 23:10:51 +0000 |
commit | b96942f6ec1c91a4531e7ecf845abdba0e5285f6 (patch) | |
tree | 08abde5057ffad1b25bcc6fc582d0a8536198e8a /test/YAMLParser | |
parent | 7c001dac7a65dc2560f116bbd907968c3150193f (diff) |
YAML: Implement block scalar parsing.
This commit implements the parsing of YAML block scalars.
Some code existed for it before, but it couldn't parse block
scalars.
This commit adds a new yaml node type to represent the block
scalar values.
This commit also deletes the 'spec-09-27' and 'spec-09-28' tests
as they are identical to the test file 'spec-09-26'.
This commit introduces 3 new utility functions to the YAML scanner
class: `skip_s_space`, `advanceWhile` and `consumeLineBreakIfPresent`.
Reviewers: Duncan P. N. Exon Smith
Differential Revision: http://reviews.llvm.org/D9503
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/YAMLParser')
-rw-r--r-- | test/YAMLParser/spec-09-14.test | 7 | ||||
-rw-r--r-- | test/YAMLParser/spec-09-18.test | 6 | ||||
-rw-r--r-- | test/YAMLParser/spec-09-19.test | 4 | ||||
-rw-r--r-- | test/YAMLParser/spec-09-20.test | 6 | ||||
-rw-r--r-- | test/YAMLParser/spec-09-21.test | 2 | ||||
-rw-r--r-- | test/YAMLParser/spec-09-22.test | 14 | ||||
-rw-r--r-- | test/YAMLParser/spec-09-24.test | 9 | ||||
-rw-r--r-- | test/YAMLParser/spec-09-25.test | 3 | ||||
-rw-r--r-- | test/YAMLParser/spec-09-26.test | 3 | ||||
-rw-r--r-- | test/YAMLParser/spec-09-27.test | 10 | ||||
-rw-r--r-- | test/YAMLParser/spec-09-28.test | 10 |
11 files changed, 37 insertions, 37 deletions
diff --git a/test/YAMLParser/spec-09-14.test b/test/YAMLParser/spec-09-14.test index 55d881de433..5f028f920fc 100644 --- a/test/YAMLParser/spec-09-14.test +++ b/test/YAMLParser/spec-09-14.test @@ -1,9 +1,6 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s +# RUN: not yaml-bench -canonical %s 2>&1 | FileCheck %s # -# FIXME: This test should actually fail. Yaml bench should report an error that -# says that the '---' and '...' document start/end markers must not be specified -# as the first content line of a non-indented plain scalar. -# CHECK: !!str +# CHECK: error: Expected a line break after block scalar header --- --- ||| : foo diff --git a/test/YAMLParser/spec-09-18.test b/test/YAMLParser/spec-09-18.test index ac623f9973f..cb05bb3774c 100644 --- a/test/YAMLParser/spec-09-18.test +++ b/test/YAMLParser/spec-09-18.test @@ -1,4 +1,8 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s +# CHECK: !!str "literal\n" +# CHECK: !!str " folded\n" +# CHECK: !!str "keep\n\n" +# CHECK: !!str " strip" - | # Just the style literal diff --git a/test/YAMLParser/spec-09-19.test b/test/YAMLParser/spec-09-19.test index 52aa157137b..f385717b035 100644 --- a/test/YAMLParser/spec-09-19.test +++ b/test/YAMLParser/spec-09-19.test @@ -1,4 +1,6 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s +# CHECK: !!str "literal\n" +# CHECK: !!str "folded\n" - | literal diff --git a/test/YAMLParser/spec-09-20.test b/test/YAMLParser/spec-09-20.test index 86fc7ab9a2e..47c255b8573 100644 --- a/test/YAMLParser/spec-09-20.test +++ b/test/YAMLParser/spec-09-20.test @@ -1,4 +1,8 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s +# CHECK: !!str "detected\n" +# CHECK: !!str "\n\n# detected\n" +# CHECK: !!str " explicit\n" +# CHECK: !!str "\t\ndetected\n" - | detected diff --git a/test/YAMLParser/spec-09-21.test b/test/YAMLParser/spec-09-21.test index 76bc7d6bd31..661f986917a 100644 --- a/test/YAMLParser/spec-09-21.test +++ b/test/YAMLParser/spec-09-21.test @@ -9,4 +9,4 @@ - |1 text -# CHECK: error +# CHECK: 8:2: error: A text line is less indented than the block scalar diff --git a/test/YAMLParser/spec-09-22.test b/test/YAMLParser/spec-09-22.test index b95faa50b5d..726358dd5ba 100644 --- a/test/YAMLParser/spec-09-22.test +++ b/test/YAMLParser/spec-09-22.test @@ -1,6 +1,12 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s +# CHECK: !!str "text" +# CHECK: !!str "text\n" +# CHECK: !!str "text\n\n" strip: |- - text
clip: | - text
keep: |+ - text
+ text +clip: | + text +keep: |+ + text + diff --git a/test/YAMLParser/spec-09-24.test b/test/YAMLParser/spec-09-24.test index f08eae6a80e..9cf51413855 100644 --- a/test/YAMLParser/spec-09-24.test +++ b/test/YAMLParser/spec-09-24.test @@ -1,8 +1,13 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s +# CHECK: ? !!str "strip" +# CHECK: : !!str "" +# CHECK: ? !!str "clip" +# CHECK: : !!str "" +# CHECK: ? !!str "keep" +# CHECK: : !!str "\n" strip: >- clip: > keep: |+ - diff --git a/test/YAMLParser/spec-09-25.test b/test/YAMLParser/spec-09-25.test index b15edb523d2..697b47e9ac7 100644 --- a/test/YAMLParser/spec-09-25.test +++ b/test/YAMLParser/spec-09-25.test @@ -1,4 +1,5 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s +# CHECK: !!str "literal\n\ttext\n" | # Simple block scalar literal diff --git a/test/YAMLParser/spec-09-26.test b/test/YAMLParser/spec-09-26.test index 286740ed39c..c8f31aea2b3 100644 --- a/test/YAMLParser/spec-09-26.test +++ b/test/YAMLParser/spec-09-26.test @@ -1,4 +1,5 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s +# CHECK: !!str "\n\nliteral\n\ntext\n" | diff --git a/test/YAMLParser/spec-09-27.test b/test/YAMLParser/spec-09-27.test deleted file mode 100644 index 286740ed39c..00000000000 --- a/test/YAMLParser/spec-09-27.test +++ /dev/null @@ -1,10 +0,0 @@ -# RUN: yaml-bench -canonical %s - -| - - - literal - - text - - # Comment diff --git a/test/YAMLParser/spec-09-28.test b/test/YAMLParser/spec-09-28.test deleted file mode 100644 index 286740ed39c..00000000000 --- a/test/YAMLParser/spec-09-28.test +++ /dev/null @@ -1,10 +0,0 @@ -# RUN: yaml-bench -canonical %s - -| - - - literal - - text - - # Comment |