xref: /linux/scripts/dtc/dt-style-selftest/good/yaml-tricky-parsing.yaml (revision 9611c0ce215a66770ccbe5c126bf57ba8c31bcad)
1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/test-good-tricky-parsing.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Test fixture exercising parser corner cases
8
9description: |
10  Covers patterns that previously broke the classifier:
11    - "/* ... */ code;" with code following the closing of a one-line
12      block comment must still parse the code.
13    - a label on a node whose name starts with a digit (1wire@10).
14    - a multi-line C preprocessor macro using backslash continuations
15      must not be parsed as DTS lines.
16    - a /* comment that opens and closes on the same code line must
17      not leave the parser in block-comment state.
18
19maintainers:
20  - Test User <test@example.com>
21
22properties:
23  compatible:
24    const: example,test-tricky-parsing
25  reg:
26    maxItems: 1
27
28required:
29  - compatible
30  - reg
31
32additionalProperties: false
33
34examples:
35  - |
36    #define MY_REG(a, b) \
37        ((a) << 16 |     \
38         (b) << 0)
39
40    one_wire: 1wire@10 {
41        compatible = "example,test-tricky-parsing";
42        reg = <MY_REG(0x10, 0)>;
43        /* inline-closed */ status = "okay";
44    };
45
46    other: device@20 {
47        compatible = "example,test-tricky-parsing";
48        reg = <0x20 0x10>;
49    };
50
51    &one_wire {
52        status = "okay";
53    };
54
55    &other {
56        status = "okay";
57    };
58