From: Olivier Matz Date: Thu, 7 Mar 2019 18:17:02 +0000 (+0100) Subject: yaml: more examples X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=61a84a21fe4f71327d652b183a4cd80900510f4f;p=protos%2Flibecoli.git yaml: more examples --- diff --git a/examples/parse-yaml/cond.yaml b/examples/parse-yaml/cond.yaml new file mode 100644 index 0000000..49483ab --- /dev/null +++ b/examples/parse-yaml/cond.yaml @@ -0,0 +1,43 @@ +type: re_lex +patterns: +- pattern: "[_a-zA-Z][._a-zA-Z0-9]*" + keep: true + attr: a_identifier +- pattern: "\\(" + keep: true + attr: a_open +- pattern: "\\)" + keep: true + attr: a_close +- pattern: "," + keep: true +- pattern: "[ ]+" + keep: false +child: + &term + id: term + type: or + children: + - type: seq + id: function + children: + - type: any + id: function_name + attr: a_identifier + - type: any + attr: a_open + - type: option + id: term_list + child: + type: seq + children: + - *term + - type: many + child: + type: seq + children: + - type: str + string: "," + - *term + - type: any + attr: a_close diff --git a/examples/parse-yaml/cross.yaml b/examples/parse-yaml/cross.yaml new file mode 100644 index 0000000..e6e35fa --- /dev/null +++ b/examples/parse-yaml/cross.yaml @@ -0,0 +1,16 @@ +# matches "x", "x + x", "x + x + x", ... +&term +id: term +type: or +children: +- type: seq + children: + - &value + id: value + type: str + string: x + - id: operator + type: str + string: + + - *term +- *value diff --git a/examples/parse-yaml/test.yaml b/examples/parse-yaml/test.yaml index 5642766..4191d94 100644 --- a/examples/parse-yaml/test.yaml +++ b/examples/parse-yaml/test.yaml @@ -1,4 +1,8 @@ type: or +attrs: + key1: val1 + key2: val2 + key3: children: - type: seq id: hello