Debian Codegraph @

debian/rust-vendor/ariadne/examples/stresstest.rs

raw
1 use ariadne::{Color, ColorGenerator, Config, Label, Report, ReportKind, Source};
2
3 fn main() {
4 let mut colors = ColorGenerator::new();
5
6 Report::build(ReportKind::Error, ("stresstest.tao", 13..13))
7 .with_code(3)
8 .with_message("Incompatible types".to_string())
9 .with_label(
10 Label::new(("stresstest.tao", 0..1))
11 .with_message("Color")
12 .with_color(colors.next()),
13 )
14 .with_label(
15 Label::new(("stresstest.tao", 1..2))
16 .with_message("Color")
17 .with_color(colors.next()),
18 )
19 .with_label(
20 Label::new(("stresstest.tao", 2..3))
21 .with_message("Color")
22 .with_color(colors.next()),
23 )
24 .with_label(
25 Label::new(("stresstest.tao", 3..4))
26 .with_message("Color")
27 .with_color(colors.next()),
28 )
29 .with_label(
30 Label::new(("stresstest.tao", 4..5))
31 .with_message("Color")
32 .with_color(colors.next()),
33 )
34 .with_label(
35 Label::new(("stresstest.tao", 5..6))
36 .with_message("Color")
37 .with_color(colors.next()),
38 )
39 .with_label(
40 Label::new(("stresstest.tao", 6..7))
41 .with_message("Color")
42 .with_color(colors.next()),
43 )
44 .with_label(
45 Label::new(("stresstest.tao", 7..8))
46 .with_message("Color")
47 .with_color(colors.next()),
48 )
49 .with_label(
50 Label::new(("stresstest.tao", 8..9))
51 .with_message("Color")
52 .with_color(colors.next()),
53 )
54 .with_label(
55 Label::new(("stresstest.tao", 9..10))
56 .with_message("Color")
57 .with_color(colors.next()),
58 )
59 .with_label(
60 Label::new(("stresstest.tao", 10..11))
61 .with_message("Color")
62 .with_color(colors.next()),
63 )
64 .with_label(
65 Label::new(("stresstest.tao", 11..12))
66 .with_message("Color")
67 .with_color(colors.next()),
68 )
69 .with_label(
70 Label::new(("stresstest.tao", 12..13))
71 .with_message("Color")
72 .with_color(colors.next()),
73 )
74 .with_label(
75 Label::new(("stresstest.tao", 13..14))
76 .with_message("Color")
77 .with_color(colors.next()),
78 )
79 .with_label(
80 Label::new(("stresstest.tao", 14..15))
81 .with_message("Color")
82 .with_color(colors.next()),
83 )
84 .with_label(
85 Label::new(("stresstest.tao", 15..16))
86 .with_message("Color")
87 .with_color(colors.next()),
88 )
89 .with_label(
90 Label::new(("stresstest.tao", 16..17))
91 .with_message("Color")
92 .with_color(colors.next()),
93 )
94 .with_label(
95 Label::new(("stresstest.tao", 17..18))
96 .with_message("Color")
97 .with_color(colors.next()),
98 )
99 .with_label(
100 Label::new(("stresstest.tao", 18..19))
101 .with_message("Color")
102 .with_color(colors.next()),
103 )
104 .with_label(
105 Label::new(("stresstest.tao", 19..20))
106 .with_message("Color")
107 .with_color(colors.next()),
108 )
109 .with_label(
110 Label::new(("stresstest.tao", 20..21))
111 .with_message("Color")
112 .with_color(colors.next()),
113 )
114 .with_label(
115 Label::new(("stresstest.tao", 18..19))
116 .with_message("This is of type Nat")
117 .with_color(colors.next()),
118 )
119 .with_label(
120 Label::new(("stresstest.tao", 13..16))
121 .with_message("This is of type Str")
122 .with_color(colors.next()),
123 )
124 .with_label(
125 Label::new(("stresstest.tao", 40..41))
126 .with_message("This is of type Nat")
127 .with_color(colors.next()),
128 )
129 .with_label(
130 Label::new(("stresstest.tao", 43..47))
131 .with_message("This is of type Bool")
132 .with_color(colors.next()),
133 )
134 .with_label(
135 Label::new(("stresstest.tao", 49..51))
136 .with_message("This is of type ()")
137 .with_color(colors.next()),
138 )
139 .with_label(
140 Label::new(("stresstest.tao", 53..55))
141 .with_message("This is of type [_]")
142 .with_color(colors.next()),
143 )
144 .with_label(
145 Label::new(("stresstest.tao", 25..78))
146 .with_message("This is of type Str")
147 .with_color(colors.next()),
148 )
149 .with_label(
150 Label::new(("stresstest.tao", 81..124))
151 .with_message("This is of type Nat")
152 .with_color(colors.next()),
153 )
154 .with_label(
155 Label::new(("stresstest.tao", 100..126))
156 .with_message("This is an inner multi-line")
157 .with_color(colors.next()),
158 )
159 .with_label(
160 Label::new(("stresstest.tao", 106..120))
161 .with_message("This is another inner multi-line")
162 .with_color(colors.next()),
163 )
164 .with_label(
165 Label::new(("stresstest.tao", 108..122))
166 .with_message("This is *really* nested multi-line")
167 .with_color(colors.next()),
168 )
169 .with_label(
170 Label::new(("stresstest.tao", 110..111))
171 .with_message("This is an inline within the nesting!")
172 .with_color(colors.next()),
173 )
174 .with_label(
175 Label::new(("stresstest.tao", 111..112))
176 .with_message("And another!")
177 .with_color(colors.next()),
178 )
179 .with_label(
180 Label::new(("stresstest.tao", 103..123))
181 .with_message("This is *really* nested multi-line")
182 .with_color(colors.next()),
183 )
184 .with_label(
185 Label::new(("stresstest.tao", 105..125))
186 .with_message("This is *really* nested multi-line")
187 .with_color(colors.next()),
188 )
189 .with_label(
190 Label::new(("stresstest.tao", 112..116))
191 .with_message("This is *really* nested multi-line")
192 .with_color(colors.next()),
193 )
194 .with_label(
195 Label::new(("stresstest.tao", 26..100))
196 .with_message("Hahaha!")
197 .with_color(Color::Fixed(75)),
198 )
199 .with_label(
200 Label::new(("stresstest.tao", 85..110))
201 .with_message("Oh god, no more 1")
202 .with_color(colors.next()),
203 )
204 .with_label(
205 Label::new(("stresstest.tao", 84..114))
206 .with_message("Oh god, no more 2")
207 .with_color(colors.next()),
208 )
209 .with_label(
210 Label::new(("stresstest.tao", 89..113))
211 .with_message("Oh god, no more 3")
212 .with_color(colors.next()),
213 )
214 .with_config(
215 Config::default()
216 .with_cross_gap(false)
217 .with_compact(true)
218 .with_underlines(true)
219 .with_tab_width(4),
220 )
221 .finish()
222 .print((
223 "stresstest.tao",
224 Source::from(include_str!("stresstest.tao")),
225 ))
226 .unwrap();
227 }