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