DIPL syntax highlighting fixture
This page renders the shared DIPL highlighting fixture with the local Pygments
dipl lexer. It is a visual regression check for the Sphinx highlighter,
including scalar values, blocks, references, arrays, schemas, and keyed and
indexed collections.
1# DIPL highlighting fixture: covers the syntax categories used by the lexer.
2
3# Numeric-looking commented configuration must remain entirely a comment.
4# size = 10000 custom_length
5# files = 4
6# courant_factor = 0.25
7
8# Declarations: external sources, custom units, and schemas.
9$source imported = "data/other.dip"
10$unit local_length = 2.5 m
11$schema vehicle
12
13# Strings and scalar values.
14name str = "escaped quote: \"DIPL\""
15multiline str = """triple quoted
16value without interpolation and # text"""
17formatted str = f"Length: {{?length}}"
18formatted_slice str = f"Surname: {{?name}[9:]}"
19formatted_multiline str = f"""Length: {{?length}}
20Width: {{?width}}"""
21
22# The same reference must retain its reference colour in every context.
23reference_direct float = {?length}
24reference_expression float = ({?length} * 2)
25reference_template str = f"Length: {{?length}}"
26
27enabled bool = true
28disabled bool = false
29missing bool = none
30count int = -42
31unsigned uint64 = 18446744073709551615
32ratio float = 3.14159e-4
33length float = 2.5 m
34duration float = 12.0 s
35
36# Arrays and table-like values.
37values float[3] = [1.0, 2.0, 3.0] m
38labels str[3:4] = "[\"John\", \"Peter\", \"Simon\"]"
39table table = [1, 2, 3]
40
41# Local and remote references, including subtree imports.
42copied float = {?length}
43selected float = {?values}[1]
44row float[2] = {?values}[:2]
45surname str = {?name}[9:]
46remote float = {imported?length}
47children
48 {?vehicle.}
49
50# Expressions and node properties.
51calculated float = ({?length} * 2) cm
52 !condition ({.} > 0 cm)
53 !constant
54 !format "%.3f"
55 !tags ["example", "highlight"]
56 !options [1, 2, 3] cm
57 !labels ["One", "Two", "Three"]
58 !delimiter ","
59 ?descr "A highlighted test value"
60 ?authors "Ada Lovelace, Emmy Noether"
61 ?title "DIPL Highlighting Fixture"
62 ?journal "Scientific Numerical Tools Examples"
63 ?year "2026"
64 ?volume "8"
65 ?issue "1"
66 ?pages "1-2"
67 ?doi "10.0000/example.dipl"
68 ?url "https://example.invalid/dipl-fixture"
69 ?version "1.0"
70 ?created "2026-09-21"
71 ?modified "2026-09-21"
72 ?license "CC BY 4.0"
73 ?rationale "Balances accuracy and cost"
74 ?native ["ErrTolTheta", "TreeOpeningAngle"]
75 ?requires ["build.gravity.self_gravity", "build.gravity.tree"]
76 ?conflicts "build.gravity.direct"
77 ?implies "build.gravity.tree"
78 ?see ["gravity.force_accuracy", "gravity.softening"]
79 ?example ["0.5", "0.7"]
80 ?recommended_range "0.3 to 1.0"
81 ?performance_impact "Smaller values cost more"
82 ?scientific_impact "Smaller values improve accuracy"
83 ?deprecated "Never"
84 ?replacement "gravity.opening_angle"
85 ?since "3.0"
86 ?category "Gravity"
87 ?visibility "advanced"
88
89# Conditional branches.
90@if ({?enabled})
91 selected str = "yes"
92@elif ({?count} > 0)
93 selected str = "positive"
94@else
95 selected str = "no"
96@end
97
98# Nested nodes and additional units.
99vehicle
100 wheels int = 4
101 mass float = 1200 kg
102
103# Override bodies contain value modifications without type declarations.
104$override # Tune the existing vehicle settings.
105 vehicle
106 wheels = 6
107 mass = 1.5e3 kg
108
109# Collection declarations and items.
110units list
111units[]
112 name str = "length"
113 unit str = "23*au"
114sources map
115sources[constants]
116 filepath str = "data/constants.dip"
117
118# Import complete source and unit trees.
119$source {imported?.}
120$unit {imported?units?.}