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 arepo_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 !delimiter ","
58 ?descr "A highlighted test value"
59 ?authors "Ada Lovelace, Emmy Noether"
60 ?title "DIPL Highlighting Fixture"
61 ?journal "Scientific Numerical Tools Examples"
62 ?year "2026"
63 ?volume "8"
64 ?issue "1"
65 ?pages "1-2"
66 ?doi "10.0000/example.dipl"
67 ?url "https://example.invalid/dipl-fixture"
68 ?version "1.0"
69 ?created "2026-09-21"
70 ?modified "2026-09-21"
71 ?license "CC BY 4.0"
72 ?rationale "Balances accuracy and cost"
73 ?native ["ErrTolTheta", "TreeOpeningAngle"]
74 ?requires ["build.gravity.self_gravity", "build.gravity.tree"]
75 ?conflicts "build.gravity.direct"
76 ?implies "build.gravity.tree"
77 ?see ["gravity.force_accuracy", "gravity.softening"]
78 ?example ["0.5", "0.7"]
79 ?recommended_range "0.3 to 1.0"
80 ?performance_impact "Smaller values cost more"
81 ?scientific_impact "Smaller values improve accuracy"
82 ?deprecated "Never"
83 ?replacement "gravity.opening_angle"
84 ?since "3.0"
85 ?category "Gravity"
86 ?visibility "advanced"
87
88# Conditional branches.
89@if ({?enabled})
90 selected str = "yes"
91@elif ({?count} > 0)
92 selected str = "positive"
93@else
94 selected str = "no"
95@end
96
97# Nested nodes and additional units.
98vehicle
99 wheels int = 4
100 mass float = 1200 kg
101
102# Override bodies contain value modifications without type declarations.
103$override # Tune the existing vehicle settings.
104 vehicle
105 wheels = 6
106 mass = 1.5e3 kg
107
108# Indexed collection items.
109units[]
110 name str = "length"
111 unit str = "23*au"
112sources[constants]
113 filepath str = "data/constants.dip"
114
115# Import complete source and unit trees.
116$source {imported?.}
117$unit {imported?units?.}