JinghuiLuAstronaut commited on
Commit
2f895b5
·
verified ·
1 Parent(s): c6cc616

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. LTA_openwebtext_dualt/logs/lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_10k_save1k_20260523.log +396 -0
  2. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/asm.py +1058 -0
  3. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/bdd.py +57 -0
  4. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/business.py +625 -0
  5. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/c_cpp.py +415 -0
  6. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/carbon.py +95 -0
  7. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/diff.py +169 -0
  8. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/dotnet.py +873 -0
  9. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/hare.py +73 -0
  10. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/idl.py +284 -0
  11. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/javascript.py +1591 -0
  12. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/lean.py +241 -0
  13. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/mojo.py +707 -0
  14. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ncl.py +894 -0
  15. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/parasail.py +78 -0
  16. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/q.py +187 -0
  17. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ride.py +138 -0
  18. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/roboconf.py +81 -0
  19. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/supercollider.py +94 -0
  20. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/whiley.py +115 -0
LTA_openwebtext_dualt/logs/lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_10k_save1k_20260523.log ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ *****************************************
3
+ Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.
4
+ *****************************************
5
+ NCCL version 2.25.1+cuda12.8
6
+ {
7
+ "device": "cuda:0",
8
+ "rank": 0,
9
+ "world_size": 4,
10
+ "samples": "wrapped_stream",
11
+ "vocab_size": 30522,
12
+ "tokenizer_vocab_size": 30522,
13
+ "save_dir": "runs/lta_lm1b_classic_c1024_fullvocab_len128_repro_save10k_gbs512_4gpu_1m_20260523_134443",
14
+ "max_len": 512,
15
+ "effective_model_max_len": 512,
16
+ "batch_size": 16,
17
+ "grad_accum": 8,
18
+ "effective_batch_size": 512,
19
+ "global_batch_size": 512,
20
+ "lr_schedule": "constant_warmup",
21
+ "optimizer": "adamw",
22
+ "epochs": 0.0,
23
+ "steps_per_epoch": 0,
24
+ "total_steps": 10000,
25
+ "warmup_steps": 2500,
26
+ "warmup_epochs": -1.0,
27
+ "min_lr": 6e-05,
28
+ "weight_decay": 0.0,
29
+ "output_weight_decay": -1.0,
30
+ "adamw_param_groups": "nanogpt",
31
+ "adam_beta1": 0.9,
32
+ "adam_beta2": 0.999,
33
+ "adam_eps": 1e-08,
34
+ "muon_impl": "legacy",
35
+ "muon_momentum": 0.95,
36
+ "muon_ns_steps": 5,
37
+ "muon_update_scale": 1.0,
38
+ "muon_nesterov": false,
39
+ "muon_width_scale": false,
40
+ "muon_grouping": "",
41
+ "muon_param_count": 0,
42
+ "muon_adam_param_count": 0,
43
+ "muon_param_names": [],
44
+ "muon_adam_param_names": [],
45
+ "muon_effective_nesterov": false,
46
+ "muon_effective_width_scale": false,
47
+ "muon_effective_weight_decay": 0.0,
48
+ "muon_adam_fallback_nesterov": false,
49
+ "muon_adam_fallback_weight_decay": 0.0,
50
+ "ema_decay": 0.0,
51
+ "ema_start_step": 0,
52
+ "model_type": "ddit",
53
+ "ddit_mlp_type": "gelu",
54
+ "block_anchor_every": 0,
55
+ "block_anchor_init_std": 0.02,
56
+ "bos_anchor_every": 0,
57
+ "bos_anchor_token_id": -1,
58
+ "bos_anchor_extra_len": 0,
59
+ "abs_pos_embed": false,
60
+ "abs_pos_init_std": 0.02,
61
+ "elf_num_time_tokens": 4,
62
+ "elf_num_model_mode_tokens": 0,
63
+ "qk_norm": true,
64
+ "output_bias": false,
65
+ "output_init_std": -1.0,
66
+ "norm_type": "rmsnorm",
67
+ "target_loss": "hard_ce",
68
+ "linear_soft_target_power": 1.0,
69
+ "linear_soft_target_min_conf": 0.0,
70
+ "linear_soft_target_max_conf": 1.0,
71
+ "t_sampling_mode": "uniform",
72
+ "t_sampling_power": 1.0,
73
+ "t_sampling_eps": 0.0001,
74
+ "t_sampling_logit_mean": -1.5,
75
+ "t_sampling_logit_std": 0.8,
76
+ "t_sampling_gumbel_loc": 2.2,
77
+ "t_sampling_gumbel_scale": 0.8,
78
+ "dual_t": true,
79
+ "corrupt_t_mode": "same",
80
+ "corrupt_min_t": 0.0,
81
+ "corrupt_max_t": 1.0,
82
+ "prefix_block_prob": 0.0,
83
+ "prefix_block_len": 128,
84
+ "block_ar_two_stream": false,
85
+ "block_ar_block_len": 128,
86
+ "mask_ratio_floor_schedule": "none",
87
+ "dirichlet_endpoint_mode": "categorical_dual_t",
88
+ "dirichlet_semantic_t_mode": "same",
89
+ "dirichlet_semantic_t_value": 0.0,
90
+ "dirichlet_semantic_t_curve": "linear",
91
+ "dirichlet_semantic_t_power": 1.0,
92
+ "dirichlet_support_t_curve": "linear",
93
+ "dirichlet_support_t_power": 1.0,
94
+ "endpoint_sequence_random_prob_alpha": 0.0,
95
+ "categorical_wrong_from_full_vocab": true,
96
+ "categorical_wrong_from_batch_valid_tokens": false,
97
+ "categorical_wrong_basin_token_ids": "",
98
+ "categorical_wrong_basin_prob": 0.0,
99
+ "categorical_wrong_unigram_prob": 0.0,
100
+ "categorical_wrong_uniform_prob": 0.0,
101
+ "categorical_wrong_prob_floor": 0.0,
102
+ "categorical_gold_prob_floor": 0.0,
103
+ "categorical_gold_prob_ceil": 1.0,
104
+ "categorical_wrong_corpus_unigram_path": "",
105
+ "categorical_wrong_corpus_unigram_alpha": 1.0,
106
+ "categorical_wrong_basin_shared_prob": 0.0,
107
+ "categorical_wrong_unigram_shared_prob": 0.0,
108
+ "mask_mixture_original_prob": 0.0,
109
+ "mask_mixture_lowk_prob": 0.0,
110
+ "mask_mixture_lowcorrupt_prob": 0.0,
111
+ "mask_mixture_block_prob": 0.0,
112
+ "mask_mixture_all_prob": 0.0,
113
+ "mask_mixture_lowk_clean_tokens": "1,2,4,8,16,32,64",
114
+ "mask_mixture_lowcorrupt_tokens": "1,2,4,8,16,32,64",
115
+ "mask_mixture_block_tokens": "64,128",
116
+ "simplex_bridge_sampler": "dirichlet",
117
+ "logistic_normal_sigma_min": 0.18,
118
+ "logistic_normal_sigma_max": 2.2,
119
+ "logistic_normal_tau_min": 0.65,
120
+ "logistic_normal_tau_max": 1.15,
121
+ "torch_compile": false,
122
+ "compile_mode": "max-autotune",
123
+ "state_format": "prob",
124
+ "meanflow_weight": 0.0,
125
+ "rollout_train_prob": 0.0,
126
+ "rollout_train_steps": 1,
127
+ "rollout_train_steps_min": -1,
128
+ "rollout_train_infer_steps": 64,
129
+ "rollout_train_time_mode": "fixed_steps",
130
+ "rollout_train_s_dist": "uniform",
131
+ "rollout_train_s_min_frac": 0.0,
132
+ "rollout_train_s_max_frac": 0.125,
133
+ "rollout_train_s_beta_alpha": 2.0,
134
+ "rollout_train_s_beta_beta": 6.0,
135
+ "rollout_train_temp": 1.0,
136
+ "rollout_train_max_gamma": 1.0,
137
+ "rollout_train_rule": "flowmap",
138
+ "rollout_train_corrupt_only": true,
139
+ "rollout_train_samplewise": false,
140
+ "rollout_train_compute_always": false,
141
+ "rollout_train_keep_grad": false,
142
+ "rollout_train_sync_t": false,
143
+ "rollout_train_state_mix_mode": "final",
144
+ "rollout_train_state_mix_alpha": 0.5,
145
+ "bridge_noise_init": "logistic_normal",
146
+ "noise_sigma": -1.0,
147
+ "allow_tf32": true,
148
+ "activation_checkpointing": false,
149
+ "activation_checkpoint_interval": 1,
150
+ "activation_checkpoint_scope": "block",
151
+ "ddp_static_graph": false,
152
+ "ddp_gradient_as_bucket_view": true,
153
+ "blocking_data_transfer": false,
154
+ "dataloader_prefetch_factor": 2,
155
+ "full_train_stats": false,
156
+ "tokenized_hf": false,
157
+ "tokenized_pad_token": "pad",
158
+ "elf_conditional_hf": false,
159
+ "record_pad_truncate": false,
160
+ "record_add_eos": false,
161
+ "record_add_special_tokens": false,
162
+ "record_pad_token": "pad",
163
+ "record_shuffle_buffer": 10000,
164
+ "wrap": true,
165
+ "wrap_mode": "stream",
166
+ "wrap_record_buffer_size": 200,
167
+ "owt_cached_chunks": false,
168
+ "owt_chunk_cache_dir": "",
169
+ "owt_chunk_cache_rebuild": false,
170
+ "owt_chunk_cache_write_batch": 4096,
171
+ "owt_exact_repeat_per_chunk": 0,
172
+ "online_chunk_shuffle": false,
173
+ "online_chunk_shuffle_buffer": 10000,
174
+ "openwebtext_split": "all",
175
+ "detokenizer": "auto",
176
+ "resolved_detokenizer": "lm1b",
177
+ "num_workers": 0,
178
+ "latest_every": 1000,
179
+ "resume_path": ""
180
+ }
181
+ W0523 13:45:54.669000 993567 torch/distributed/elastic/agent/server/api.py:719] Received 15 death signal, shutting down workers
182
+ W0523 13:45:54.670000 993567 torch/distributed/elastic/multiprocessing/api.py:898] Sending process 993634 closing signal SIGTERM
183
+ W0523 13:45:54.671000 993567 torch/distributed/elastic/multiprocessing/api.py:898] Sending process 993635 closing signal SIGTERM
184
+ W0523 13:45:54.671000 993567 torch/distributed/elastic/multiprocessing/api.py:898] Sending process 993636 closing signal SIGTERM
185
+ W0523 13:45:54.671000 993567 torch/distributed/elastic/multiprocessing/api.py:898] Sending process 993637 closing signal SIGTERM
186
+ Traceback (most recent call last):
187
+ File "<frozen runpy>", line 198, in _run_module_as_main
188
+ File "<frozen runpy>", line 88, in _run_code
189
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/run.py", line 922, in <module>
190
+ main()
191
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 355, in wrapper
192
+ return f(*args, **kwargs)
193
+ ^^^^^^^^^^^^^^^^^^
194
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/run.py", line 918, in main
195
+ run(args)
196
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/run.py", line 909, in run
197
+ elastic_launch(
198
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/launcher/api.py", line 139, in __call__
199
+ return launch_agent(self._config, self._entrypoint, list(args))
200
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
201
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/launcher/api.py", line 261, in launch_agent
202
+ result = agent.run()
203
+ ^^^^^^^^^^^
204
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/elastic/metrics/api.py", line 137, in wrapper
205
+ result = f(*args, **kwargs)
206
+ ^^^^^^^^^^^^^^^^^^
207
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/elastic/agent/server/api.py", line 711, in run
208
+ result = self._invoke_run(role)
209
+ ^^^^^^^^^^^^^^^^^^^^^^
210
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/elastic/agent/server/api.py", line 870, in _invoke_run
211
+ time.sleep(monitor_interval)
212
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/elastic/multiprocessing/api.py", line 84, in _terminate_process_handler
213
+ raise SignalException(f"Process {os.getpid()} got signal: {sigval}", sigval=sigval)
214
+ torch.distributed.elastic.multiprocessing.api.SignalException: Process 993567 got signal: 15
215
+
216
+ *****************************************
217
+ Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.
218
+ *****************************************
219
+ NCCL version 2.25.1+cuda12.8
220
+ {
221
+ "device": "cuda:0",
222
+ "rank": 0,
223
+ "world_size": 4,
224
+ "samples": "wrapped_stream",
225
+ "vocab_size": 30522,
226
+ "tokenizer_vocab_size": 30522,
227
+ "save_dir": "runs/lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_10k_save1k_20260523",
228
+ "max_len": 512,
229
+ "effective_model_max_len": 512,
230
+ "batch_size": 16,
231
+ "grad_accum": 8,
232
+ "effective_batch_size": 512,
233
+ "global_batch_size": 512,
234
+ "lr_schedule": "constant_warmup",
235
+ "optimizer": "adamw",
236
+ "epochs": 0.0,
237
+ "steps_per_epoch": 0,
238
+ "total_steps": 10000,
239
+ "warmup_steps": 2500,
240
+ "warmup_epochs": -1.0,
241
+ "min_lr": 6e-05,
242
+ "weight_decay": 0.0,
243
+ "output_weight_decay": -1.0,
244
+ "adamw_param_groups": "nanogpt",
245
+ "adam_beta1": 0.9,
246
+ "adam_beta2": 0.999,
247
+ "adam_eps": 1e-08,
248
+ "muon_impl": "legacy",
249
+ "muon_momentum": 0.95,
250
+ "muon_ns_steps": 5,
251
+ "muon_update_scale": 1.0,
252
+ "muon_nesterov": false,
253
+ "muon_width_scale": false,
254
+ "muon_grouping": "",
255
+ "muon_param_count": 0,
256
+ "muon_adam_param_count": 0,
257
+ "muon_param_names": [],
258
+ "muon_adam_param_names": [],
259
+ "muon_effective_nesterov": false,
260
+ "muon_effective_width_scale": false,
261
+ "muon_effective_weight_decay": 0.0,
262
+ "muon_adam_fallback_nesterov": false,
263
+ "muon_adam_fallback_weight_decay": 0.0,
264
+ "ema_decay": 0.0,
265
+ "ema_start_step": 0,
266
+ "model_type": "ddit",
267
+ "ddit_mlp_type": "gelu",
268
+ "block_anchor_every": 0,
269
+ "block_anchor_init_std": 0.02,
270
+ "bos_anchor_every": 0,
271
+ "bos_anchor_token_id": -1,
272
+ "bos_anchor_extra_len": 0,
273
+ "abs_pos_embed": false,
274
+ "abs_pos_init_std": 0.02,
275
+ "elf_num_time_tokens": 4,
276
+ "elf_num_model_mode_tokens": 0,
277
+ "qk_norm": true,
278
+ "output_bias": false,
279
+ "output_init_std": -1.0,
280
+ "norm_type": "rmsnorm",
281
+ "target_loss": "hard_ce",
282
+ "linear_soft_target_power": 1.0,
283
+ "linear_soft_target_min_conf": 0.0,
284
+ "linear_soft_target_max_conf": 1.0,
285
+ "t_sampling_mode": "uniform",
286
+ "t_sampling_power": 1.0,
287
+ "t_sampling_eps": 0.0001,
288
+ "t_sampling_logit_mean": -1.5,
289
+ "t_sampling_logit_std": 0.8,
290
+ "t_sampling_gumbel_loc": 2.2,
291
+ "t_sampling_gumbel_scale": 0.8,
292
+ "dual_t": true,
293
+ "corrupt_t_mode": "same",
294
+ "corrupt_min_t": 0.0,
295
+ "corrupt_max_t": 1.0,
296
+ "prefix_block_prob": 0.0,
297
+ "prefix_block_len": 128,
298
+ "block_ar_two_stream": false,
299
+ "block_ar_block_len": 128,
300
+ "mask_ratio_floor_schedule": "none",
301
+ "dirichlet_endpoint_mode": "categorical_dual_t",
302
+ "dirichlet_semantic_t_mode": "same",
303
+ "dirichlet_semantic_t_value": 0.0,
304
+ "dirichlet_semantic_t_curve": "linear",
305
+ "dirichlet_semantic_t_power": 1.0,
306
+ "dirichlet_support_t_curve": "linear",
307
+ "dirichlet_support_t_power": 1.0,
308
+ "endpoint_sequence_random_prob_alpha": 0.0,
309
+ "categorical_wrong_from_full_vocab": true,
310
+ "categorical_wrong_from_batch_valid_tokens": false,
311
+ "categorical_wrong_basin_token_ids": "",
312
+ "categorical_wrong_basin_prob": 0.0,
313
+ "categorical_wrong_unigram_prob": 0.0,
314
+ "categorical_wrong_uniform_prob": 0.0,
315
+ "categorical_wrong_prob_floor": 0.0,
316
+ "categorical_gold_prob_floor": 0.0,
317
+ "categorical_gold_prob_ceil": 1.0,
318
+ "categorical_wrong_corpus_unigram_path": "",
319
+ "categorical_wrong_corpus_unigram_alpha": 1.0,
320
+ "categorical_wrong_basin_shared_prob": 0.0,
321
+ "categorical_wrong_unigram_shared_prob": 0.0,
322
+ "mask_mixture_original_prob": 0.0,
323
+ "mask_mixture_lowk_prob": 0.0,
324
+ "mask_mixture_lowcorrupt_prob": 0.0,
325
+ "mask_mixture_block_prob": 0.0,
326
+ "mask_mixture_all_prob": 0.0,
327
+ "mask_mixture_lowk_clean_tokens": "1,2,4,8,16,32,64",
328
+ "mask_mixture_lowcorrupt_tokens": "1,2,4,8,16,32,64",
329
+ "mask_mixture_block_tokens": "64,128",
330
+ "simplex_bridge_sampler": "dirichlet",
331
+ "logistic_normal_sigma_min": 0.18,
332
+ "logistic_normal_sigma_max": 2.2,
333
+ "logistic_normal_tau_min": 0.65,
334
+ "logistic_normal_tau_max": 1.15,
335
+ "torch_compile": false,
336
+ "compile_mode": "max-autotune",
337
+ "state_format": "prob",
338
+ "meanflow_weight": 0.0,
339
+ "rollout_train_prob": 0.0,
340
+ "rollout_train_steps": 1,
341
+ "rollout_train_steps_min": -1,
342
+ "rollout_train_infer_steps": 64,
343
+ "rollout_train_time_mode": "fixed_steps",
344
+ "rollout_train_s_dist": "uniform",
345
+ "rollout_train_s_min_frac": 0.0,
346
+ "rollout_train_s_max_frac": 0.125,
347
+ "rollout_train_s_beta_alpha": 2.0,
348
+ "rollout_train_s_beta_beta": 6.0,
349
+ "rollout_train_temp": 1.0,
350
+ "rollout_train_max_gamma": 1.0,
351
+ "rollout_train_rule": "flowmap",
352
+ "rollout_train_corrupt_only": true,
353
+ "rollout_train_samplewise": false,
354
+ "rollout_train_compute_always": false,
355
+ "rollout_train_keep_grad": false,
356
+ "rollout_train_sync_t": false,
357
+ "rollout_train_state_mix_mode": "final",
358
+ "rollout_train_state_mix_alpha": 0.5,
359
+ "bridge_noise_init": "logistic_normal",
360
+ "noise_sigma": -1.0,
361
+ "allow_tf32": true,
362
+ "activation_checkpointing": false,
363
+ "activation_checkpoint_interval": 1,
364
+ "activation_checkpoint_scope": "block",
365
+ "ddp_static_graph": false,
366
+ "ddp_gradient_as_bucket_view": true,
367
+ "blocking_data_transfer": false,
368
+ "dataloader_prefetch_factor": 2,
369
+ "full_train_stats": false,
370
+ "tokenized_hf": false,
371
+ "tokenized_pad_token": "pad",
372
+ "elf_conditional_hf": false,
373
+ "record_pad_truncate": false,
374
+ "record_add_eos": false,
375
+ "record_add_special_tokens": false,
376
+ "record_pad_token": "pad",
377
+ "record_shuffle_buffer": 10000,
378
+ "wrap": true,
379
+ "wrap_mode": "stream",
380
+ "wrap_record_buffer_size": 200,
381
+ "owt_cached_chunks": false,
382
+ "owt_chunk_cache_dir": "",
383
+ "owt_chunk_cache_rebuild": false,
384
+ "owt_chunk_cache_write_batch": 4096,
385
+ "owt_exact_repeat_per_chunk": 0,
386
+ "online_chunk_shuffle": false,
387
+ "online_chunk_shuffle_buffer": 10000,
388
+ "openwebtext_split": "all",
389
+ "detokenizer": "auto",
390
+ "resolved_detokenizer": "lm1b",
391
+ "num_workers": 0,
392
+ "latest_every": 1000,
393
+ "resume_path": ""
394
+ }
395
+ step=100 micro_steps=800 elapsed=113.9s lr=1.212000e-05 loss=10.1664 loss_recon=10.1664 loss_meanflow=0.0000 mean_model_t=0.5038 mean_corrupt_t=0.5038 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5548 corrupt_frac=0.5518 acc_corrupt=0.3656 loss_corrupt=10.1664 wrong_frac=0.4958 init_acc_corrupt=0.4706 acc_corrupt_t_0p0_0p2=0.0425 corrupt_frac_t_0p0_0p2=0.1990 acc_corrupt_t_0p2_0p4=0.1861 corrupt_frac_t_0p2_0p4=0.2039 acc_corrupt_t_0p4_0p6=0.3616 corrupt_frac_t_0p4_0p6=0.2161 acc_corrupt_t_0p6_0p8=0.5196 corrupt_frac_t_0p6_0p8=0.2048 acc_corrupt_t_0p8_1p0=0.7048 corrupt_frac_t_0p8_1p0=0.2042 out_w_norm=0.9052 out_g_norm=1.0607 loss_all=9.7275 init_gold_top10=0.3325 init_gold_top100=0.3384
396
+ step=200 micro_steps=1600 elapsed=112.6s lr=2.412000e-05 loss=8.9011 loss_recon=8.9011 loss_meanflow=0.0000 mean_model_t=0.4980 mean_corrupt_t=0.4980 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.1209 corrupt_frac=0.5492 acc_corrupt=0.0894 loss_corrupt=8.9011 wrong_frac=0.5023 init_acc_corrupt=0.4627 acc_corrupt_t_0p0_0p2=0.0467 corrupt_frac_t_0p0_0p2=0.2138 acc_corrupt_t_0p2_0p4=0.0625 corrupt_frac_t_0p2_0p4=0.2042 acc_corrupt_t_0p4_0p6=0.0872 corrupt_frac_t_0p4_0p6=0.2022 acc_corrupt_t_0p6_0p8=0.1112 corrupt_frac_t_0p6_0p8=0.2056 acc_corrupt_t_0p8_1p0=0.1402 corrupt_frac_t_0p8_1p0=0.2064 out_w_norm=6.6949 out_g_norm=1.6497 loss_all=7.9412 init_gold_top10=0.5039 init_gold_top100=0.5121
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/asm.py ADDED
@@ -0,0 +1,1058 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.asm
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for assembly languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups, using, words, \
14
+ DelegatingLexer, default
15
+ from pygments.lexers.c_cpp import CppLexer, CLexer
16
+ from pygments.lexers.d import DLexer
17
+ from pygments.token import Text, Name, Number, String, Comment, Punctuation, \
18
+ Other, Keyword, Operator, Whitespace
19
+
20
+ __all__ = ['GasLexer', 'ObjdumpLexer', 'DObjdumpLexer', 'CppObjdumpLexer',
21
+ 'CObjdumpLexer', 'HsailLexer', 'LlvmLexer', 'LlvmMirBodyLexer',
22
+ 'LlvmMirLexer', 'NasmLexer', 'NasmObjdumpLexer', 'TasmLexer',
23
+ 'Ca65Lexer', 'Dasm16Lexer']
24
+
25
+
26
+ class GasLexer(RegexLexer):
27
+ """
28
+ For Gas (AT&T) assembly code.
29
+ """
30
+ name = 'GAS'
31
+ aliases = ['gas', 'asm']
32
+ filenames = ['*.s', '*.S']
33
+ mimetypes = ['text/x-gas']
34
+ url = 'https://www.gnu.org/software/binutils'
35
+ version_added = ''
36
+
37
+ #: optional Comment or Whitespace
38
+ string = r'"(\\"|[^"])*"'
39
+ char = r'[\w$.@-]'
40
+ identifier = r'(?:[a-zA-Z$_]' + char + r'*|\.' + char + '+)'
41
+ number = r'(?:0[xX][a-fA-F0-9]+|#?-?\d+)'
42
+ register = '%' + identifier + r'\b'
43
+
44
+ tokens = {
45
+ 'root': [
46
+ include('whitespace'),
47
+ (identifier + ':', Name.Label),
48
+ (r'\.' + identifier, Name.Attribute, 'directive-args'),
49
+ (r'lock|rep(n?z)?|data\d+', Name.Attribute),
50
+ (identifier, Name.Function, 'instruction-args'),
51
+ (r'[\r\n]+', Text)
52
+ ],
53
+ 'directive-args': [
54
+ (identifier, Name.Constant),
55
+ (string, String),
56
+ ('@' + identifier, Name.Attribute),
57
+ (number, Number.Integer),
58
+ (register, Name.Variable),
59
+ (r'[\r\n]+', Whitespace, '#pop'),
60
+ (r'([;#]|//).*?\n', Comment.Single, '#pop'),
61
+ (r'/[*].*?[*]/', Comment.Multiline),
62
+ (r'/[*].*?\n[\w\W]*?[*]/', Comment.Multiline, '#pop'),
63
+
64
+ include('punctuation'),
65
+ include('whitespace')
66
+ ],
67
+ 'instruction-args': [
68
+ # For objdump-disassembled code, shouldn't occur in
69
+ # actual assembler input
70
+ ('([a-z0-9]+)( )(<)('+identifier+')(>)',
71
+ bygroups(Number.Hex, Text, Punctuation, Name.Constant,
72
+ Punctuation)),
73
+ ('([a-z0-9]+)( )(<)('+identifier+')([-+])('+number+')(>)',
74
+ bygroups(Number.Hex, Text, Punctuation, Name.Constant,
75
+ Punctuation, Number.Integer, Punctuation)),
76
+
77
+ # Address constants
78
+ (identifier, Name.Constant),
79
+ (number, Number.Integer),
80
+ # Registers
81
+ (register, Name.Variable),
82
+ # Numeric constants
83
+ ('$'+number, Number.Integer),
84
+ (r"$'(.|\\')'", String.Char),
85
+ (r'[\r\n]+', Whitespace, '#pop'),
86
+ (r'([;#]|//).*?\n', Comment.Single, '#pop'),
87
+ (r'/[*].*?[*]/', Comment.Multiline),
88
+ (r'/[*].*?\n[\w\W]*?[*]/', Comment.Multiline, '#pop'),
89
+
90
+ include('punctuation'),
91
+ include('whitespace')
92
+ ],
93
+ 'whitespace': [
94
+ (r'\n', Whitespace),
95
+ (r'\s+', Whitespace),
96
+ (r'([;#]|//).*?\n', Comment.Single),
97
+ (r'/[*][\w\W]*?[*]/', Comment.Multiline)
98
+ ],
99
+ 'punctuation': [
100
+ (r'[-*,.()\[\]!:{}]+', Punctuation)
101
+ ]
102
+ }
103
+
104
+ def analyse_text(text):
105
+ if re.search(r'^\.(text|data|section)', text, re.M):
106
+ return True
107
+ elif re.search(r'^\.\w+', text, re.M):
108
+ return 0.1
109
+
110
+
111
+ def _objdump_lexer_tokens(asm_lexer):
112
+ """
113
+ Common objdump lexer tokens to wrap an ASM lexer.
114
+ """
115
+ hex_re = r'[0-9A-Za-z]'
116
+ return {
117
+ 'root': [
118
+ # File name & format:
119
+ ('(.*?)(:)( +file format )(.*?)$',
120
+ bygroups(Name.Label, Punctuation, Text, String)),
121
+ # Section header
122
+ ('(Disassembly of section )(.*?)(:)$',
123
+ bygroups(Text, Name.Label, Punctuation)),
124
+ # Function labels
125
+ # (With offset)
126
+ ('('+hex_re+'+)( )(<)(.*?)([-+])(0[xX][A-Za-z0-9]+)(>:)$',
127
+ bygroups(Number.Hex, Whitespace, Punctuation, Name.Function,
128
+ Punctuation, Number.Hex, Punctuation)),
129
+ # (Without offset)
130
+ ('('+hex_re+'+)( )(<)(.*?)(>:)$',
131
+ bygroups(Number.Hex, Whitespace, Punctuation, Name.Function,
132
+ Punctuation)),
133
+ # Code line with disassembled instructions
134
+ ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)( *\t)([a-zA-Z].*?)$',
135
+ bygroups(Whitespace, Name.Label, Whitespace, Number.Hex, Whitespace,
136
+ using(asm_lexer))),
137
+ # Code line without raw instructions (objdump --no-show-raw-insn)
138
+ ('( *)('+hex_re+r'+:)( *\t)([a-zA-Z].*?)$',
139
+ bygroups(Whitespace, Name.Label, Whitespace,
140
+ using(asm_lexer))),
141
+ # Code line with ascii
142
+ ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)( *)(.*?)$',
143
+ bygroups(Whitespace, Name.Label, Whitespace, Number.Hex, Whitespace, String)),
144
+ # Continued code line, only raw opcodes without disassembled
145
+ # instruction
146
+ ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)$',
147
+ bygroups(Whitespace, Name.Label, Whitespace, Number.Hex)),
148
+ # Skipped a few bytes
149
+ (r'\t\.\.\.$', Text),
150
+ # Relocation line
151
+ # (With offset)
152
+ (r'(\t\t\t)('+hex_re+r'+:)( )([^\t]+)(\t)(.*?)([-+])(0x'+hex_re+'+)$',
153
+ bygroups(Whitespace, Name.Label, Whitespace, Name.Property, Whitespace,
154
+ Name.Constant, Punctuation, Number.Hex)),
155
+ # (Without offset)
156
+ (r'(\t\t\t)('+hex_re+r'+:)( )([^\t]+)(\t)(.*?)$',
157
+ bygroups(Whitespace, Name.Label, Whitespace, Name.Property, Whitespace,
158
+ Name.Constant)),
159
+ (r'[^\n]+\n', Other)
160
+ ]
161
+ }
162
+
163
+
164
+ class ObjdumpLexer(RegexLexer):
165
+ """
166
+ For the output of ``objdump -dr``.
167
+ """
168
+ name = 'objdump'
169
+ aliases = ['objdump']
170
+ filenames = ['*.objdump']
171
+ mimetypes = ['text/x-objdump']
172
+ url = 'https://www.gnu.org/software/binutils'
173
+ version_added = ''
174
+
175
+ tokens = _objdump_lexer_tokens(GasLexer)
176
+
177
+
178
+ class DObjdumpLexer(DelegatingLexer):
179
+ """
180
+ For the output of ``objdump -Sr`` on compiled D files.
181
+ """
182
+ name = 'd-objdump'
183
+ aliases = ['d-objdump']
184
+ filenames = ['*.d-objdump']
185
+ mimetypes = ['text/x-d-objdump']
186
+ url = 'https://www.gnu.org/software/binutils'
187
+ version_added = ''
188
+
189
+ def __init__(self, **options):
190
+ super().__init__(DLexer, ObjdumpLexer, **options)
191
+
192
+
193
+ class CppObjdumpLexer(DelegatingLexer):
194
+ """
195
+ For the output of ``objdump -Sr`` on compiled C++ files.
196
+ """
197
+ name = 'cpp-objdump'
198
+ aliases = ['cpp-objdump', 'c++-objdumb', 'cxx-objdump']
199
+ filenames = ['*.cpp-objdump', '*.c++-objdump', '*.cxx-objdump']
200
+ mimetypes = ['text/x-cpp-objdump']
201
+ url = 'https://www.gnu.org/software/binutils'
202
+ version_added = ''
203
+
204
+ def __init__(self, **options):
205
+ super().__init__(CppLexer, ObjdumpLexer, **options)
206
+
207
+
208
+ class CObjdumpLexer(DelegatingLexer):
209
+ """
210
+ For the output of ``objdump -Sr`` on compiled C files.
211
+ """
212
+ name = 'c-objdump'
213
+ aliases = ['c-objdump']
214
+ filenames = ['*.c-objdump']
215
+ mimetypes = ['text/x-c-objdump']
216
+ url = 'https://www.gnu.org/software/binutils'
217
+ version_added = ''
218
+
219
+
220
+ def __init__(self, **options):
221
+ super().__init__(CLexer, ObjdumpLexer, **options)
222
+
223
+
224
+ class HsailLexer(RegexLexer):
225
+ """
226
+ For HSAIL assembly code.
227
+ """
228
+ name = 'HSAIL'
229
+ aliases = ['hsail', 'hsa']
230
+ filenames = ['*.hsail']
231
+ mimetypes = ['text/x-hsail']
232
+ url = 'https://en.wikipedia.org/wiki/Heterogeneous_System_Architecture#HSA_Intermediate_Layer'
233
+ version_added = '2.2'
234
+
235
+ string = r'"[^"]*?"'
236
+ identifier = r'[a-zA-Z_][\w.]*'
237
+ # Registers
238
+ register_number = r'[0-9]+'
239
+ register = r'(\$(c|s|d|q)' + register_number + r')\b'
240
+ # Qualifiers
241
+ alignQual = r'(align\(\d+\))'
242
+ widthQual = r'(width\((\d+|all)\))'
243
+ allocQual = r'(alloc\(agent\))'
244
+ # Instruction Modifiers
245
+ roundingMod = (r'((_ftz)?(_up|_down|_zero|_near))')
246
+ datatypeMod = (r'_('
247
+ # packedTypes
248
+ r'u8x4|s8x4|u16x2|s16x2|u8x8|s8x8|u16x4|s16x4|u32x2|s32x2|'
249
+ r'u8x16|s8x16|u16x8|s16x8|u32x4|s32x4|u64x2|s64x2|'
250
+ r'f16x2|f16x4|f16x8|f32x2|f32x4|f64x2|'
251
+ # baseTypes
252
+ r'u8|s8|u16|s16|u32|s32|u64|s64|'
253
+ r'b128|b8|b16|b32|b64|b1|'
254
+ r'f16|f32|f64|'
255
+ # opaqueType
256
+ r'roimg|woimg|rwimg|samp|sig32|sig64)')
257
+
258
+ # Numeric Constant
259
+ float = r'((\d+\.)|(\d*\.\d+))[eE][+-]?\d+'
260
+ hexfloat = r'0[xX](([0-9a-fA-F]+\.[0-9a-fA-F]*)|([0-9a-fA-F]*\.[0-9a-fA-F]+))[pP][+-]?\d+'
261
+ ieeefloat = r'0((h|H)[0-9a-fA-F]{4}|(f|F)[0-9a-fA-F]{8}|(d|D)[0-9a-fA-F]{16})'
262
+
263
+ tokens = {
264
+ 'root': [
265
+ include('whitespace'),
266
+ include('comments'),
267
+
268
+ (string, String),
269
+
270
+ (r'@' + identifier + ':?', Name.Label),
271
+
272
+ (register, Name.Variable.Anonymous),
273
+
274
+ include('keyword'),
275
+
276
+ (r'&' + identifier, Name.Variable.Global),
277
+ (r'%' + identifier, Name.Variable),
278
+
279
+ (hexfloat, Number.Hex),
280
+ (r'0[xX][a-fA-F0-9]+', Number.Hex),
281
+ (ieeefloat, Number.Float),
282
+ (float, Number.Float),
283
+ (r'\d+', Number.Integer),
284
+
285
+ (r'[=<>{}\[\]()*.,:;!]|x\b', Punctuation)
286
+ ],
287
+ 'whitespace': [
288
+ (r'(\n|\s)+', Whitespace),
289
+ ],
290
+ 'comments': [
291
+ (r'/\*.*?\*/', Comment.Multiline),
292
+ (r'//.*?\n', Comment.Single),
293
+ ],
294
+ 'keyword': [
295
+ # Types
296
+ (r'kernarg' + datatypeMod, Keyword.Type),
297
+
298
+ # Regular keywords
299
+ (r'\$(full|base|small|large|default|zero|near)', Keyword),
300
+ (words((
301
+ 'module', 'extension', 'pragma', 'prog', 'indirect', 'signature',
302
+ 'decl', 'kernel', 'function', 'enablebreakexceptions',
303
+ 'enabledetectexceptions', 'maxdynamicgroupsize', 'maxflatgridsize',
304
+ 'maxflatworkgroupsize', 'requireddim', 'requiredgridsize',
305
+ 'requiredworkgroupsize', 'requirenopartialworkgroups'),
306
+ suffix=r'\b'), Keyword),
307
+
308
+ # instructions
309
+ (roundingMod, Keyword),
310
+ (datatypeMod, Keyword),
311
+ (r'_(' + alignQual + '|' + widthQual + ')', Keyword),
312
+ (r'_kernarg', Keyword),
313
+ (r'(nop|imagefence)\b', Keyword),
314
+ (words((
315
+ 'cleardetectexcept', 'clock', 'cuid', 'debugtrap', 'dim',
316
+ 'getdetectexcept', 'groupbaseptr', 'kernargbaseptr', 'laneid',
317
+ 'maxcuid', 'maxwaveid', 'packetid', 'setdetectexcept', 'waveid',
318
+ 'workitemflatabsid', 'workitemflatid', 'nullptr', 'abs', 'bitrev',
319
+ 'currentworkgroupsize', 'currentworkitemflatid', 'fract', 'ncos',
320
+ 'neg', 'nexp2', 'nlog2', 'nrcp', 'nrsqrt', 'nsin', 'nsqrt',
321
+ 'gridgroups', 'gridsize', 'not', 'sqrt', 'workgroupid',
322
+ 'workgroupsize', 'workitemabsid', 'workitemid', 'ceil', 'floor',
323
+ 'rint', 'trunc', 'add', 'bitmask', 'borrow', 'carry', 'copysign',
324
+ 'div', 'rem', 'sub', 'shl', 'shr', 'and', 'or', 'xor', 'unpackhi',
325
+ 'unpacklo', 'max', 'min', 'fma', 'mad', 'bitextract', 'bitselect',
326
+ 'shuffle', 'cmov', 'bitalign', 'bytealign', 'lerp', 'nfma', 'mul',
327
+ 'mulhi', 'mul24hi', 'mul24', 'mad24', 'mad24hi', 'bitinsert',
328
+ 'combine', 'expand', 'lda', 'mov', 'pack', 'unpack', 'packcvt',
329
+ 'unpackcvt', 'sad', 'sementp', 'ftos', 'stof', 'cmp', 'ld', 'st',
330
+ '_eq', '_ne', '_lt', '_le', '_gt', '_ge', '_equ', '_neu', '_ltu',
331
+ '_leu', '_gtu', '_geu', '_num', '_nan', '_seq', '_sne', '_slt',
332
+ '_sle', '_sgt', '_sge', '_snum', '_snan', '_sequ', '_sneu', '_sltu',
333
+ '_sleu', '_sgtu', '_sgeu', 'atomic', '_ld', '_st', '_cas', '_add',
334
+ '_and', '_exch', '_max', '_min', '_or', '_sub', '_wrapdec',
335
+ '_wrapinc', '_xor', 'ret', 'cvt', '_readonly', '_kernarg', '_global',
336
+ 'br', 'cbr', 'sbr', '_scacq', '_screl', '_scar', '_rlx', '_wave',
337
+ '_wg', '_agent', '_system', 'ldimage', 'stimage', '_v2', '_v3', '_v4',
338
+ '_1d', '_2d', '_3d', '_1da', '_2da', '_1db', '_2ddepth', '_2dadepth',
339
+ '_width', '_height', '_depth', '_array', '_channelorder',
340
+ '_channeltype', 'querysampler', '_coord', '_filter', '_addressing',
341
+ 'barrier', 'wavebarrier', 'initfbar', 'joinfbar', 'waitfbar',
342
+ 'arrivefbar', 'leavefbar', 'releasefbar', 'ldf', 'activelaneid',
343
+ 'activelanecount', 'activelanemask', 'activelanepermute', 'call',
344
+ 'scall', 'icall', 'alloca', 'packetcompletionsig',
345
+ 'addqueuewriteindex', 'casqueuewriteindex', 'ldqueuereadindex',
346
+ 'stqueuereadindex', 'readonly', 'global', 'private', 'group',
347
+ 'spill', 'arg', '_upi', '_downi', '_zeroi', '_neari', '_upi_sat',
348
+ '_downi_sat', '_zeroi_sat', '_neari_sat', '_supi', '_sdowni',
349
+ '_szeroi', '_sneari', '_supi_sat', '_sdowni_sat', '_szeroi_sat',
350
+ '_sneari_sat', '_pp', '_ps', '_sp', '_ss', '_s', '_p', '_pp_sat',
351
+ '_ps_sat', '_sp_sat', '_ss_sat', '_s_sat', '_p_sat')), Keyword),
352
+
353
+ # Integer types
354
+ (r'i[1-9]\d*', Keyword)
355
+ ]
356
+ }
357
+
358
+
359
+ class LlvmLexer(RegexLexer):
360
+ """
361
+ For LLVM assembly code.
362
+ """
363
+ name = 'LLVM'
364
+ url = 'https://llvm.org/docs/LangRef.html'
365
+ aliases = ['llvm']
366
+ filenames = ['*.ll']
367
+ mimetypes = ['text/x-llvm']
368
+ version_added = ''
369
+
370
+ #: optional Comment or Whitespace
371
+ string = r'"[^"]*?"'
372
+ identifier = r'([-a-zA-Z$._][\w\-$.]*|' + string + ')'
373
+ block_label = r'(' + identifier + r'|(\d+))'
374
+
375
+ tokens = {
376
+ 'root': [
377
+ include('whitespace'),
378
+
379
+ # Before keywords, because keywords are valid label names :(...
380
+ (block_label + r'\s*:', Name.Label),
381
+
382
+ include('keyword'),
383
+
384
+ (r'%' + identifier, Name.Variable),
385
+ (r'@' + identifier, Name.Variable.Global),
386
+ (r'%\d+', Name.Variable.Anonymous),
387
+ (r'@\d+', Name.Variable.Global),
388
+ (r'#\d+', Name.Variable.Global),
389
+ (r'!' + identifier, Name.Variable),
390
+ (r'!\d+', Name.Variable.Anonymous),
391
+ (r'c?' + string, String),
392
+
393
+ (r'0[xX][KLMHR]?[a-fA-F0-9]+', Number),
394
+ (r'-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?', Number),
395
+
396
+ (r'[=<>{}\[\]()*.,!]|x\b', Punctuation)
397
+ ],
398
+ 'whitespace': [
399
+ (r'(\n|\s+)+', Whitespace),
400
+ (r';.*?\n', Comment),
401
+ (r'/\*', Comment, 'c-comment'),
402
+ ],
403
+ 'c-comment': [
404
+ (r'[^*]+', Comment),
405
+ (r'\*/', Comment, '#pop'),
406
+ # Consume lone asterisks as non-comment-ending content.
407
+ (r'\*', Comment),
408
+ ],
409
+ 'keyword': [
410
+ # Regular keywords
411
+ (words((
412
+ 'aarch64_sve_vector_pcs', 'aarch64_vector_pcs', 'acq_rel',
413
+ 'acquire', 'add', 'addrspace', 'addrspacecast', 'afn', 'alias',
414
+ 'aliasee', 'align', 'alignLog2', 'alignstack', 'alloca',
415
+ 'allocsize', 'allOnes', 'alwaysinline', 'alwaysInline',
416
+ 'amdgpu_cs', 'amdgpu_es', 'amdgpu_gfx', 'amdgpu_gs',
417
+ 'amdgpu_hs', 'amdgpu_kernel', 'amdgpu_ls', 'amdgpu_ps',
418
+ 'amdgpu_vs', 'and', 'any', 'anyregcc', 'appending', 'arcp',
419
+ 'argmemonly', 'args', 'arm_aapcs_vfpcc', 'arm_aapcscc',
420
+ 'arm_apcscc', 'ashr', 'asm', 'atomic', 'atomicrmw',
421
+ 'attributes', 'available_externally', 'avr_intrcc',
422
+ 'avr_signalcc', 'bit', 'bitcast', 'bitMask', 'blockaddress',
423
+ 'blockcount', 'br', 'branchFunnel', 'builtin', 'byArg',
424
+ 'byref', 'byte', 'byteArray', 'byval', 'c', 'call', 'callbr',
425
+ 'callee', 'caller', 'calls', 'canAutoHide', 'catch',
426
+ 'catchpad', 'catchret', 'catchswitch', 'cc', 'ccc',
427
+ 'cfguard_checkcc', 'cleanup', 'cleanuppad', 'cleanupret',
428
+ 'cmpxchg', 'cold', 'coldcc', 'comdat', 'common', 'constant',
429
+ 'contract', 'convergent', 'critical', 'cxx_fast_tlscc',
430
+ 'datalayout', 'declare', 'default', 'define', 'deplibs',
431
+ 'dereferenceable', 'dereferenceable_or_null', 'distinct',
432
+ 'dllexport', 'dllimport', 'dso_local', 'dso_local_equivalent',
433
+ 'dso_preemptable', 'dsoLocal', 'eq', 'exact', 'exactmatch',
434
+ 'extern_weak', 'external', 'externally_initialized',
435
+ 'extractelement', 'extractvalue', 'fadd', 'false', 'fast',
436
+ 'fastcc', 'fcmp', 'fdiv', 'fence', 'filter', 'flags', 'fmul',
437
+ 'fneg', 'fpext', 'fptosi', 'fptoui', 'fptrunc', 'freeze',
438
+ 'frem', 'from', 'fsub', 'funcFlags', 'function', 'gc',
439
+ 'getelementptr', 'ghccc', 'global', 'guid', 'gv', 'hash',
440
+ 'hhvm_ccc', 'hhvmcc', 'hidden', 'hot', 'hotness', 'icmp',
441
+ 'ifunc', 'inaccessiblemem_or_argmemonly',
442
+ 'inaccessiblememonly', 'inalloca', 'inbounds', 'indir',
443
+ 'indirectbr', 'info', 'initialexec', 'inline', 'inlineBits',
444
+ 'inlinehint', 'inrange', 'inreg', 'insertelement',
445
+ 'insertvalue', 'insts', 'intel_ocl_bicc', 'inteldialect',
446
+ 'internal', 'inttoptr', 'invoke', 'jumptable', 'kind',
447
+ 'landingpad', 'largest', 'linkage', 'linkonce', 'linkonce_odr',
448
+ 'live', 'load', 'local_unnamed_addr', 'localdynamic',
449
+ 'localexec', 'lshr', 'max', 'metadata', 'min', 'minsize',
450
+ 'module', 'monotonic', 'msp430_intrcc', 'mul', 'mustprogress',
451
+ 'musttail', 'naked', 'name', 'nand', 'ne', 'nest', 'ninf',
452
+ 'nnan', 'noalias', 'nobuiltin', 'nocallback', 'nocapture',
453
+ 'nocf_check', 'noduplicate', 'noduplicates', 'nofree',
454
+ 'noimplicitfloat', 'noinline', 'noInline', 'nomerge', 'none',
455
+ 'nonlazybind', 'nonnull', 'noprofile', 'norecurse',
456
+ 'noRecurse', 'noredzone', 'noreturn', 'nosync', 'notail',
457
+ 'notEligibleToImport', 'noundef', 'nounwind', 'nsw',
458
+ 'nsz', 'null', 'null_pointer_is_valid', 'nuw', 'oeq', 'offset',
459
+ 'oge', 'ogt', 'ole', 'olt', 'one', 'opaque', 'optforfuzzing',
460
+ 'optnone', 'optsize', 'or', 'ord', 'param', 'params',
461
+ 'partition', 'path', 'personality', 'phi', 'poison',
462
+ 'preallocated', 'prefix', 'preserve_allcc', 'preserve_mostcc',
463
+ 'private', 'prologue', 'protected', 'ptrtoint', 'ptx_device',
464
+ 'ptx_kernel', 'readnone', 'readNone', 'readonly', 'readOnly',
465
+ 'reassoc', 'refs', 'relbf', 'release', 'resByArg', 'resume',
466
+ 'ret', 'returnDoesNotAlias', 'returned', 'returns_twice',
467
+ 'safestack', 'samesize', 'sanitize_address',
468
+ 'sanitize_hwaddress', 'sanitize_memory', 'sanitize_memtag',
469
+ 'sanitize_thread', 'sdiv', 'section', 'select', 'seq_cst',
470
+ 'sext', 'sge', 'sgt', 'shadowcallstack', 'shl',
471
+ 'shufflevector', 'sideeffect', 'signext', 'single',
472
+ 'singleImpl', 'singleImplName', 'sitofp', 'sizeM1',
473
+ 'sizeM1BitWidth', 'sle', 'slt', 'source_filename',
474
+ 'speculatable', 'speculative_load_hardening', 'spir_func',
475
+ 'spir_kernel', 'splat', 'srem', 'sret', 'ssp', 'sspreq',
476
+ 'sspstrong', 'store', 'strictfp', 'sub', 'summaries',
477
+ 'summary', 'swiftcc', 'swifterror', 'swiftself', 'switch',
478
+ 'syncscope', 'tail', 'tailcc', 'target', 'thread_local', 'to',
479
+ 'token', 'triple', 'true', 'trunc', 'type',
480
+ 'typeCheckedLoadConstVCalls', 'typeCheckedLoadVCalls',
481
+ 'typeid', 'typeidCompatibleVTable', 'typeIdInfo',
482
+ 'typeTestAssumeConstVCalls', 'typeTestAssumeVCalls',
483
+ 'typeTestRes', 'typeTests', 'udiv', 'ueq', 'uge', 'ugt',
484
+ 'uitofp', 'ule', 'ult', 'umax', 'umin', 'undef', 'une',
485
+ 'uniformRetVal', 'uniqueRetVal', 'unknown', 'unnamed_addr',
486
+ 'uno', 'unordered', 'unreachable', 'unsat', 'unwind', 'urem',
487
+ 'uselistorder', 'uselistorder_bb', 'uwtable', 'va_arg',
488
+ 'varFlags', 'variable', 'vcall_visibility', 'vFuncId',
489
+ 'virtFunc', 'virtualConstProp', 'void', 'volatile', 'vscale',
490
+ 'vTableFuncs', 'weak', 'weak_odr', 'webkit_jscc', 'win64cc',
491
+ 'within', 'wpdRes', 'wpdResolutions', 'writeonly', 'x',
492
+ 'x86_64_sysvcc', 'x86_fastcallcc', 'x86_intrcc', 'x86_mmx',
493
+ 'x86_regcallcc', 'x86_stdcallcc', 'x86_thiscallcc',
494
+ 'x86_vectorcallcc', 'xchg', 'xor', 'zeroext',
495
+ 'zeroinitializer', 'zext', 'immarg', 'willreturn'),
496
+ suffix=r'\b'), Keyword),
497
+
498
+ # Types
499
+ (words(('void', 'half', 'bfloat', 'float', 'double', 'fp128',
500
+ 'x86_fp80', 'ppc_fp128', 'label', 'metadata', 'x86_mmx',
501
+ 'x86_amx', 'token', 'ptr')),
502
+ Keyword.Type),
503
+
504
+ # Integer types
505
+ (r'i[1-9]\d*', Keyword.Type)
506
+ ]
507
+ }
508
+
509
+
510
+ class LlvmMirBodyLexer(RegexLexer):
511
+ """
512
+ For LLVM MIR examples without the YAML wrapper.
513
+ """
514
+ name = 'LLVM-MIR Body'
515
+ url = 'https://llvm.org/docs/MIRLangRef.html'
516
+ aliases = ['llvm-mir-body']
517
+ filenames = []
518
+ mimetypes = []
519
+ version_added = '2.6'
520
+
521
+ tokens = {
522
+ 'root': [
523
+ # Attributes on basic blocks
524
+ (words(('liveins', 'successors'), suffix=':'), Keyword),
525
+ # Basic Block Labels
526
+ (r'bb\.[0-9]+(\.[a-zA-Z0-9_.-]+)?( \(address-taken\))?:', Name.Label),
527
+ (r'bb\.[0-9]+ \(%[a-zA-Z0-9_.-]+\)( \(address-taken\))?:', Name.Label),
528
+ (r'%bb\.[0-9]+(\.\w+)?', Name.Label),
529
+ # Stack references
530
+ (r'%stack\.[0-9]+(\.\w+\.addr)?', Name),
531
+ # Subreg indices
532
+ (r'%subreg\.\w+', Name),
533
+ # Virtual registers
534
+ (r'%[a-zA-Z0-9_]+ *', Name.Variable, 'vreg'),
535
+ # Reference to LLVM-IR global
536
+ include('global'),
537
+ # Reference to Intrinsic
538
+ (r'intrinsic\(\@[a-zA-Z0-9_.]+\)', Name.Variable.Global),
539
+ # Comparison predicates
540
+ (words(('eq', 'ne', 'sgt', 'sge', 'slt', 'sle', 'ugt', 'uge', 'ult',
541
+ 'ule'), prefix=r'intpred\(', suffix=r'\)'), Name.Builtin),
542
+ (words(('oeq', 'one', 'ogt', 'oge', 'olt', 'ole', 'ugt', 'uge',
543
+ 'ult', 'ule'), prefix=r'floatpred\(', suffix=r'\)'),
544
+ Name.Builtin),
545
+ # Physical registers
546
+ (r'\$\w+', String.Single),
547
+ # Assignment operator
548
+ (r'=', Operator),
549
+ # gMIR Opcodes
550
+ (r'(G_ANYEXT|G_[SZ]EXT|G_SEXT_INREG|G_TRUNC|G_IMPLICIT_DEF|G_PHI|'
551
+ r'G_FRAME_INDEX|G_GLOBAL_VALUE|G_INTTOPTR|G_PTRTOINT|G_BITCAST|'
552
+ r'G_CONSTANT|G_FCONSTANT|G_VASTART|G_VAARG|G_CTLZ|G_CTLZ_ZERO_UNDEF|'
553
+ r'G_CTTZ|G_CTTZ_ZERO_UNDEF|G_CTPOP|G_BSWAP|G_BITREVERSE|'
554
+ r'G_ADDRSPACE_CAST|G_BLOCK_ADDR|G_JUMP_TABLE|G_DYN_STACKALLOC|'
555
+ r'G_ADD|G_SUB|G_MUL|G_[SU]DIV|G_[SU]REM|G_AND|G_OR|G_XOR|G_SHL|'
556
+ r'G_[LA]SHR|G_[IF]CMP|G_SELECT|G_GEP|G_PTR_MASK|G_SMIN|G_SMAX|'
557
+ r'G_UMIN|G_UMAX|G_[US]ADDO|G_[US]ADDE|G_[US]SUBO|G_[US]SUBE|'
558
+ r'G_[US]MULO|G_[US]MULH|G_FNEG|G_FPEXT|G_FPTRUNC|G_FPTO[US]I|'
559
+ r'G_[US]ITOFP|G_FABS|G_FCOPYSIGN|G_FCANONICALIZE|G_FMINNUM|'
560
+ r'G_FMAXNUM|G_FMINNUM_IEEE|G_FMAXNUM_IEEE|G_FMINIMUM|G_FMAXIMUM|'
561
+ r'G_FADD|G_FSUB|G_FMUL|G_FMA|G_FMAD|G_FDIV|G_FREM|G_FPOW|G_FEXP|'
562
+ r'G_FEXP2|G_FLOG|G_FLOG2|G_FLOG10|G_FCEIL|G_FCOS|G_FSIN|G_FSQRT|'
563
+ r'G_FFLOOR|G_FRINT|G_FNEARBYINT|G_INTRINSIC_TRUNC|'
564
+ r'G_INTRINSIC_ROUND|G_LOAD|G_[ZS]EXTLOAD|G_INDEXED_LOAD|'
565
+ r'G_INDEXED_[ZS]EXTLOAD|G_STORE|G_INDEXED_STORE|'
566
+ r'G_ATOMIC_CMPXCHG_WITH_SUCCESS|G_ATOMIC_CMPXCHG|'
567
+ r'G_ATOMICRMW_(XCHG|ADD|SUB|AND|NAND|OR|XOR|MAX|MIN|UMAX|UMIN|FADD|'
568
+ r'FSUB)'
569
+ r'|G_FENCE|G_EXTRACT|G_UNMERGE_VALUES|G_INSERT|G_MERGE_VALUES|'
570
+ r'G_BUILD_VECTOR|G_BUILD_VECTOR_TRUNC|G_CONCAT_VECTORS|'
571
+ r'G_INTRINSIC|G_INTRINSIC_W_SIDE_EFFECTS|G_BR|G_BRCOND|'
572
+ r'G_BRINDIRECT|G_BRJT|G_INSERT_VECTOR_ELT|G_EXTRACT_VECTOR_ELT|'
573
+ r'G_SHUFFLE_VECTOR)\b',
574
+ Name.Builtin),
575
+ # Target independent opcodes
576
+ (r'(COPY|PHI|INSERT_SUBREG|EXTRACT_SUBREG|REG_SEQUENCE)\b',
577
+ Name.Builtin),
578
+ # Flags
579
+ (words(('killed', 'implicit')), Keyword),
580
+ # ConstantInt values
581
+ (r'(i[0-9]+)( +)', bygroups(Keyword.Type, Whitespace), 'constantint'),
582
+ # ConstantFloat values
583
+ (r'(half|float|double) +', Keyword.Type, 'constantfloat'),
584
+ # Bare immediates
585
+ include('integer'),
586
+ # MMO's
587
+ (r'(::)( *)', bygroups(Operator, Whitespace), 'mmo'),
588
+ # MIR Comments
589
+ (r';.*', Comment),
590
+ # If we get here, assume it's a target instruction
591
+ (r'[a-zA-Z0-9_]+', Name),
592
+ # Everything else that isn't highlighted
593
+ (r'[(), \n]+', Text),
594
+ ],
595
+ # The integer constant from a ConstantInt value
596
+ 'constantint': [
597
+ include('integer'),
598
+ (r'(?=.)', Text, '#pop'),
599
+ ],
600
+ # The floating point constant from a ConstantFloat value
601
+ 'constantfloat': [
602
+ include('float'),
603
+ (r'(?=.)', Text, '#pop'),
604
+ ],
605
+ 'vreg': [
606
+ # The bank or class if there is one
607
+ (r'( *)(:(?!:))', bygroups(Whitespace, Keyword), ('#pop', 'vreg_bank_or_class')),
608
+ # The LLT if there is one
609
+ (r'( *)(\()', bygroups(Whitespace, Text), 'vreg_type'),
610
+ (r'(?=.)', Text, '#pop'),
611
+ ],
612
+ 'vreg_bank_or_class': [
613
+ # The unassigned bank/class
614
+ (r'( *)(_)', bygroups(Whitespace, Name.Variable.Magic)),
615
+ (r'( *)([a-zA-Z0-9_]+)', bygroups(Whitespace, Name.Variable)),
616
+ # The LLT if there is one
617
+ (r'( *)(\()', bygroups(Whitespace, Text), 'vreg_type'),
618
+ (r'(?=.)', Text, '#pop'),
619
+ ],
620
+ 'vreg_type': [
621
+ # Scalar and pointer types
622
+ (r'( *)([sp][0-9]+)', bygroups(Whitespace, Keyword.Type)),
623
+ (r'( *)(<[0-9]+ *x *[sp][0-9]+>)', bygroups(Whitespace, Keyword.Type)),
624
+ (r'\)', Text, '#pop'),
625
+ (r'(?=.)', Text, '#pop'),
626
+ ],
627
+ 'mmo': [
628
+ (r'\(', Text),
629
+ (r' +', Whitespace),
630
+ (words(('load', 'store', 'on', 'into', 'from', 'align', 'monotonic',
631
+ 'acquire', 'release', 'acq_rel', 'seq_cst')),
632
+ Keyword),
633
+ # IR references
634
+ (r'%ir\.[a-zA-Z0-9_.-]+', Name),
635
+ (r'%ir-block\.[a-zA-Z0-9_.-]+', Name),
636
+ (r'[-+]', Operator),
637
+ include('integer'),
638
+ include('global'),
639
+ (r',', Punctuation),
640
+ (r'\), \(', Text),
641
+ (r'\)', Text, '#pop'),
642
+ ],
643
+ 'integer': [(r'-?[0-9]+', Number.Integer),],
644
+ 'float': [(r'-?[0-9]+\.[0-9]+(e[+-][0-9]+)?', Number.Float)],
645
+ 'global': [(r'\@[a-zA-Z0-9_.]+', Name.Variable.Global)],
646
+ }
647
+
648
+
649
+ class LlvmMirLexer(RegexLexer):
650
+ """
651
+ Lexer for the overall LLVM MIR document format.
652
+
653
+ MIR is a human readable serialization format that's used to represent LLVM's
654
+ machine specific intermediate representation. It allows LLVM's developers to
655
+ see the state of the compilation process at various points, as well as test
656
+ individual pieces of the compiler.
657
+ """
658
+ name = 'LLVM-MIR'
659
+ url = 'https://llvm.org/docs/MIRLangRef.html'
660
+ aliases = ['llvm-mir']
661
+ filenames = ['*.mir']
662
+ version_added = '2.6'
663
+
664
+ tokens = {
665
+ 'root': [
666
+ # Comments are hashes at the YAML level
667
+ (r'#.*', Comment),
668
+ # Documents starting with | are LLVM-IR
669
+ (r'--- \|$', Keyword, 'llvm_ir'),
670
+ # Other documents are MIR
671
+ (r'---', Keyword, 'llvm_mir'),
672
+ # Consume everything else in one token for efficiency
673
+ (r'[^-#]+|.', Text),
674
+ ],
675
+ 'llvm_ir': [
676
+ # Documents end with '...' or '---'
677
+ (r'(\.\.\.|(?=---))', Keyword, '#pop'),
678
+ # Delegate to the LlvmLexer
679
+ (r'((?:.|\n)+?)(?=(\.\.\.|---))', bygroups(using(LlvmLexer))),
680
+ ],
681
+ 'llvm_mir': [
682
+ # Comments are hashes at the YAML level
683
+ (r'#.*', Comment),
684
+ # Documents end with '...' or '---'
685
+ (r'(\.\.\.|(?=---))', Keyword, '#pop'),
686
+ # Handle the simple attributes
687
+ (r'name:', Keyword, 'name'),
688
+ (words(('alignment', ),
689
+ suffix=':'), Keyword, 'number'),
690
+ (words(('legalized', 'regBankSelected', 'tracksRegLiveness',
691
+ 'selected', 'exposesReturnsTwice'),
692
+ suffix=':'), Keyword, 'boolean'),
693
+ # Handle the attributes don't highlight inside
694
+ (words(('registers', 'stack', 'fixedStack', 'liveins', 'frameInfo',
695
+ 'machineFunctionInfo'),
696
+ suffix=':'), Keyword),
697
+ # Delegate the body block to the LlvmMirBodyLexer
698
+ (r'body: *\|', Keyword, 'llvm_mir_body'),
699
+ # Consume everything else
700
+ (r'.+', Text),
701
+ (r'\n', Whitespace),
702
+ ],
703
+ 'name': [
704
+ (r'[^\n]+', Name),
705
+ default('#pop'),
706
+ ],
707
+ 'boolean': [
708
+ (r' *(true|false)', Name.Builtin),
709
+ default('#pop'),
710
+ ],
711
+ 'number': [
712
+ (r' *[0-9]+', Number),
713
+ default('#pop'),
714
+ ],
715
+ 'llvm_mir_body': [
716
+ # Documents end with '...' or '---'.
717
+ # We have to pop llvm_mir_body and llvm_mir
718
+ (r'(\.\.\.|(?=---))', Keyword, '#pop:2'),
719
+ # Delegate the body block to the LlvmMirBodyLexer
720
+ (r'((?:.|\n)+?)(?=\.\.\.|---)', bygroups(using(LlvmMirBodyLexer))),
721
+ # The '...' is optional. If we didn't already find it then it isn't
722
+ # there. There might be a '---' instead though.
723
+ (r'(?!\.\.\.|---)((?:.|\n)+)', bygroups(using(LlvmMirBodyLexer))),
724
+ ],
725
+ }
726
+
727
+
728
+ class NasmLexer(RegexLexer):
729
+ """
730
+ For Nasm (Intel) assembly code.
731
+ """
732
+ name = 'NASM'
733
+ aliases = ['nasm']
734
+ filenames = ['*.asm', '*.ASM', '*.nasm']
735
+ mimetypes = ['text/x-nasm']
736
+ url = 'https://nasm.us'
737
+ version_added = ''
738
+
739
+ # Tasm uses the same file endings, but TASM is not as common as NASM, so
740
+ # we prioritize NASM higher by default
741
+ priority = 1.0
742
+
743
+ identifier = r'[a-z$._?][\w$.?#@~]*'
744
+ hexn = r'(?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)'
745
+ octn = r'[0-7]+q'
746
+ binn = r'[01]+b'
747
+ decn = r'[0-9]+'
748
+ floatn = decn + r'\.e?' + decn
749
+ string = r'"(\\"|[^"\n])*"|' + r"'(\\'|[^'\n])*'|" + r"`(\\`|[^`\n])*`"
750
+ declkw = r'(?:res|d)[bwdqt]|times'
751
+ register = (r'(r[0-9][0-5]?[bwd]?|'
752
+ r'[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|'
753
+ r'mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]|k[0-7]|'
754
+ r'[xyz]mm(?:[12][0-9]?|3[01]?|[04-9]))\b')
755
+ wordop = r'seg|wrt|strict|rel|abs'
756
+ type = r'byte|[dq]?word'
757
+ # Directives must be followed by whitespace, otherwise CPU will match
758
+ # cpuid for instance.
759
+ directives = (r'(?:BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|'
760
+ r'ORG|ALIGN|STRUC|ENDSTRUC|COMMON|CPU|GROUP|UPPERCASE|IMPORT|'
761
+ r'EXPORT|LIBRARY|MODULE)(?=\s)')
762
+
763
+ flags = re.IGNORECASE | re.MULTILINE
764
+ tokens = {
765
+ 'root': [
766
+ (r'^\s*%', Comment.Preproc, 'preproc'),
767
+ include('whitespace'),
768
+ (identifier + ':', Name.Label),
769
+ (rf'({identifier})(\s+)(equ)',
770
+ bygroups(Name.Constant, Whitespace, Keyword.Declaration),
771
+ 'instruction-args'),
772
+ (directives, Keyword, 'instruction-args'),
773
+ (declkw, Keyword.Declaration, 'instruction-args'),
774
+ (identifier, Name.Function, 'instruction-args'),
775
+ (r'[\r\n]+', Whitespace)
776
+ ],
777
+ 'instruction-args': [
778
+ (string, String),
779
+ (hexn, Number.Hex),
780
+ (octn, Number.Oct),
781
+ (binn, Number.Bin),
782
+ (floatn, Number.Float),
783
+ (decn, Number.Integer),
784
+ include('punctuation'),
785
+ (register, Name.Builtin),
786
+ (identifier, Name.Variable),
787
+ (r'[\r\n]+', Whitespace, '#pop'),
788
+ include('whitespace')
789
+ ],
790
+ 'preproc': [
791
+ (r'[^;\n]+', Comment.Preproc),
792
+ (r';.*?\n', Comment.Single, '#pop'),
793
+ (r'\n', Comment.Preproc, '#pop'),
794
+ ],
795
+ 'whitespace': [
796
+ (r'\n', Whitespace),
797
+ (r'[ \t]+', Whitespace),
798
+ (r';.*', Comment.Single),
799
+ (r'#.*', Comment.Single)
800
+ ],
801
+ 'punctuation': [
802
+ (r'[,{}():\[\]]+', Punctuation),
803
+ (r'[&|^<>+*/%~-]+', Operator),
804
+ (r'[$]+', Keyword.Constant),
805
+ (wordop, Operator.Word),
806
+ (type, Keyword.Type)
807
+ ],
808
+ }
809
+
810
+ def analyse_text(text):
811
+ # Probably TASM
812
+ if re.match(r'PROC', text, re.IGNORECASE):
813
+ return False
814
+
815
+
816
+ class NasmObjdumpLexer(ObjdumpLexer):
817
+ """
818
+ For the output of ``objdump -d -M intel``.
819
+ """
820
+ name = 'objdump-nasm'
821
+ aliases = ['objdump-nasm']
822
+ filenames = ['*.objdump-intel']
823
+ mimetypes = ['text/x-nasm-objdump']
824
+ url = 'https://www.gnu.org/software/binutils'
825
+ version_added = '2.0'
826
+
827
+ tokens = _objdump_lexer_tokens(NasmLexer)
828
+
829
+
830
+ class TasmLexer(RegexLexer):
831
+ """
832
+ For Tasm (Turbo Assembler) assembly code.
833
+ """
834
+ name = 'TASM'
835
+ aliases = ['tasm']
836
+ filenames = ['*.asm', '*.ASM', '*.tasm']
837
+ mimetypes = ['text/x-tasm']
838
+ url = 'https://en.wikipedia.org/wiki/Turbo_Assembler'
839
+ version_added = ''
840
+
841
+ identifier = r'[@a-z$._?][\w$.?#@~]*'
842
+ hexn = r'(?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)'
843
+ octn = r'[0-7]+q'
844
+ binn = r'[01]+b'
845
+ decn = r'[0-9]+'
846
+ floatn = decn + r'\.e?' + decn
847
+ string = r'"(\\"|[^"\n])*"|' + r"'(\\'|[^'\n])*'|" + r"`(\\`|[^`\n])*`"
848
+ declkw = r'(?:res|d)[bwdqt]|times'
849
+ register = (r'(r[0-9][0-5]?[bwd]|'
850
+ r'[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|'
851
+ r'mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7])\b')
852
+ wordop = r'seg|wrt|strict'
853
+ type = r'byte|[dq]?word'
854
+ directives = (r'BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|'
855
+ r'ORG|ALIGN|STRUC|ENDSTRUC|ENDS|COMMON|CPU|GROUP|UPPERCASE|INCLUDE|'
856
+ r'EXPORT|LIBRARY|MODULE|PROC|ENDP|USES|ARG|DATASEG|UDATASEG|END|IDEAL|'
857
+ r'P386|MODEL|ASSUME|CODESEG|SIZE')
858
+ # T[A-Z][a-z] is more of a convention. Lexer should filter out STRUC definitions
859
+ # and then 'add' them to datatype somehow.
860
+ datatype = (r'db|dd|dw|T[A-Z][a-z]+')
861
+
862
+ flags = re.IGNORECASE | re.MULTILINE
863
+ tokens = {
864
+ 'root': [
865
+ (r'^\s*%', Comment.Preproc, 'preproc'),
866
+ include('whitespace'),
867
+ (identifier + ':', Name.Label),
868
+ (directives, Keyword, 'instruction-args'),
869
+ (rf'({identifier})(\s+)({datatype})',
870
+ bygroups(Name.Constant, Whitespace, Keyword.Declaration),
871
+ 'instruction-args'),
872
+ (declkw, Keyword.Declaration, 'instruction-args'),
873
+ (identifier, Name.Function, 'instruction-args'),
874
+ (r'[\r\n]+', Whitespace)
875
+ ],
876
+ 'instruction-args': [
877
+ (string, String),
878
+ (hexn, Number.Hex),
879
+ (octn, Number.Oct),
880
+ (binn, Number.Bin),
881
+ (floatn, Number.Float),
882
+ (decn, Number.Integer),
883
+ include('punctuation'),
884
+ (register, Name.Builtin),
885
+ (identifier, Name.Variable),
886
+ # Do not match newline when it's preceded by a backslash
887
+ (r'(\\)(\s*)(;.*)([\r\n])',
888
+ bygroups(Text, Whitespace, Comment.Single, Whitespace)),
889
+ (r'[\r\n]+', Whitespace, '#pop'),
890
+ include('whitespace')
891
+ ],
892
+ 'preproc': [
893
+ (r'[^;\n]+', Comment.Preproc),
894
+ (r';.*?\n', Comment.Single, '#pop'),
895
+ (r'\n', Comment.Preproc, '#pop'),
896
+ ],
897
+ 'whitespace': [
898
+ (r'[\n\r]', Whitespace),
899
+ (r'(\\)([\n\r])', bygroups(Text, Whitespace)),
900
+ (r'[ \t]+', Whitespace),
901
+ (r';.*', Comment.Single)
902
+ ],
903
+ 'punctuation': [
904
+ (r'[,():\[\]]+', Punctuation),
905
+ (r'[&|^<>+*=/%~-]+', Operator),
906
+ (r'[$]+', Keyword.Constant),
907
+ (wordop, Operator.Word),
908
+ (type, Keyword.Type)
909
+ ],
910
+ }
911
+
912
+ def analyse_text(text):
913
+ # See above
914
+ if re.match(r'PROC', text, re.I):
915
+ return True
916
+
917
+
918
+ class Ca65Lexer(RegexLexer):
919
+ """
920
+ For ca65 assembler sources.
921
+ """
922
+ name = 'ca65 assembler'
923
+ aliases = ['ca65']
924
+ filenames = ['*.s']
925
+ url = 'https://cc65.github.io'
926
+ version_added = '1.6'
927
+
928
+ flags = re.IGNORECASE
929
+
930
+ tokens = {
931
+ 'root': [
932
+ (r';.*', Comment.Single),
933
+ (r'\s+', Whitespace),
934
+ (r'[a-z_.@$][\w.@$]*:', Name.Label),
935
+ (r'((ld|st)[axy]|(in|de)[cxy]|asl|lsr|ro[lr]|adc|sbc|cmp|cp[xy]'
936
+ r'|cl[cvdi]|se[cdi]|jmp|jsr|bne|beq|bpl|bmi|bvc|bvs|bcc|bcs'
937
+ r'|p[lh][ap]|rt[is]|brk|nop|ta[xy]|t[xy]a|txs|tsx|and|ora|eor'
938
+ r'|bit)\b', Keyword),
939
+ (r'\.\w+', Keyword.Pseudo),
940
+ (r'[-+~*/^&|!<>=]', Operator),
941
+ (r'"[^"\n]*.', String),
942
+ (r"'[^'\n]*.", String.Char),
943
+ (r'\$[0-9a-f]+|[0-9a-f]+h\b', Number.Hex),
944
+ (r'\d+', Number.Integer),
945
+ (r'%[01]+', Number.Bin),
946
+ (r'[#,.:()=\[\]]', Punctuation),
947
+ (r'[a-z_.@$][\w.@$]*', Name),
948
+ ]
949
+ }
950
+
951
+ def analyse_text(self, text):
952
+ # comments in GAS start with "#"
953
+ if re.search(r'^\s*;', text, re.MULTILINE):
954
+ return 0.9
955
+
956
+
957
+ class Dasm16Lexer(RegexLexer):
958
+ """
959
+ For DCPU-16 Assembly.
960
+ """
961
+ name = 'DASM16'
962
+ url = 'http://0x10c.com/doc/dcpu-16.txt'
963
+ aliases = ['dasm16']
964
+ filenames = ['*.dasm16', '*.dasm']
965
+ mimetypes = ['text/x-dasm16']
966
+ version_added = '2.4'
967
+
968
+ INSTRUCTIONS = [
969
+ 'SET',
970
+ 'ADD', 'SUB',
971
+ 'MUL', 'MLI',
972
+ 'DIV', 'DVI',
973
+ 'MOD', 'MDI',
974
+ 'AND', 'BOR', 'XOR',
975
+ 'SHR', 'ASR', 'SHL',
976
+ 'IFB', 'IFC', 'IFE', 'IFN', 'IFG', 'IFA', 'IFL', 'IFU',
977
+ 'ADX', 'SBX',
978
+ 'STI', 'STD',
979
+ 'JSR',
980
+ 'INT', 'IAG', 'IAS', 'RFI', 'IAQ', 'HWN', 'HWQ', 'HWI',
981
+ ]
982
+
983
+ REGISTERS = [
984
+ 'A', 'B', 'C',
985
+ 'X', 'Y', 'Z',
986
+ 'I', 'J',
987
+ 'SP', 'PC', 'EX',
988
+ 'POP', 'PEEK', 'PUSH'
989
+ ]
990
+
991
+ # Regexes yo
992
+ char = r'[a-zA-Z0-9_$@.]'
993
+ identifier = r'(?:[a-zA-Z$_]' + char + r'*|\.' + char + '+)'
994
+ number = r'[+-]?(?:0[xX][a-zA-Z0-9]+|\d+)'
995
+ binary_number = r'0b[01_]+'
996
+ instruction = r'(?i)(' + '|'.join(INSTRUCTIONS) + ')'
997
+ single_char = r"'\\?" + char + "'"
998
+ string = r'"(\\"|[^"])*"'
999
+
1000
+ def guess_identifier(lexer, match):
1001
+ ident = match.group(0)
1002
+ klass = Name.Variable if ident.upper() in lexer.REGISTERS else Name.Label
1003
+ yield match.start(), klass, ident
1004
+
1005
+ tokens = {
1006
+ 'root': [
1007
+ include('whitespace'),
1008
+ (':' + identifier, Name.Label),
1009
+ (identifier + ':', Name.Label),
1010
+ (instruction, Name.Function, 'instruction-args'),
1011
+ (r'\.' + identifier, Name.Function, 'data-args'),
1012
+ (r'[\r\n]+', Whitespace)
1013
+ ],
1014
+
1015
+ 'numeric' : [
1016
+ (binary_number, Number.Integer),
1017
+ (number, Number.Integer),
1018
+ (single_char, String),
1019
+ ],
1020
+
1021
+ 'arg' : [
1022
+ (identifier, guess_identifier),
1023
+ include('numeric')
1024
+ ],
1025
+
1026
+ 'deref' : [
1027
+ (r'\+', Punctuation),
1028
+ (r'\]', Punctuation, '#pop'),
1029
+ include('arg'),
1030
+ include('whitespace')
1031
+ ],
1032
+
1033
+ 'instruction-line' : [
1034
+ (r'[\r\n]+', Whitespace, '#pop'),
1035
+ (r';.*?$', Comment, '#pop'),
1036
+ include('whitespace')
1037
+ ],
1038
+
1039
+ 'instruction-args': [
1040
+ (r',', Punctuation),
1041
+ (r'\[', Punctuation, 'deref'),
1042
+ include('arg'),
1043
+ include('instruction-line')
1044
+ ],
1045
+
1046
+ 'data-args' : [
1047
+ (r',', Punctuation),
1048
+ include('numeric'),
1049
+ (string, String),
1050
+ include('instruction-line')
1051
+ ],
1052
+
1053
+ 'whitespace': [
1054
+ (r'\n', Whitespace),
1055
+ (r'\s+', Whitespace),
1056
+ (r';.*?\n', Comment)
1057
+ ],
1058
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/bdd.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.bdd
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for BDD(Behavior-driven development).
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, include
12
+ from pygments.token import Comment, Keyword, Name, String, Number, Text, \
13
+ Punctuation, Whitespace
14
+
15
+ __all__ = ['BddLexer']
16
+
17
+ class BddLexer(RegexLexer):
18
+ """
19
+ Lexer for BDD(Behavior-driven development), which highlights not only
20
+ keywords, but also comments, punctuations, strings, numbers, and variables.
21
+ """
22
+
23
+ name = 'Bdd'
24
+ aliases = ['bdd']
25
+ filenames = ['*.feature']
26
+ mimetypes = ['text/x-bdd']
27
+ url = 'https://en.wikipedia.org/wiki/Behavior-driven_development'
28
+ version_added = '2.11'
29
+
30
+ step_keywords = (r'Given|When|Then|Add|And|Feature|Scenario Outline|'
31
+ r'Scenario|Background|Examples|But')
32
+
33
+ tokens = {
34
+ 'comments': [
35
+ (r'^\s*#.*$', Comment),
36
+ ],
37
+ 'miscellaneous': [
38
+ (r'(<|>|\[|\]|=|\||:|\(|\)|\{|\}|,|\.|;|-|_|\$)', Punctuation),
39
+ (r'((?<=\<)[^\\>]+(?=\>))', Name.Variable),
40
+ (r'"([^\"]*)"', String),
41
+ (r'^@\S+', Name.Label),
42
+ ],
43
+ 'numbers': [
44
+ (r'(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number),
45
+ ],
46
+ 'root': [
47
+ (r'\n|\s+', Whitespace),
48
+ (step_keywords, Keyword),
49
+ include('comments'),
50
+ include('miscellaneous'),
51
+ include('numbers'),
52
+ (r'\S+', Text),
53
+ ]
54
+ }
55
+
56
+ def analyse_text(self, text):
57
+ return
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/business.py ADDED
@@ -0,0 +1,625 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.business
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for "business-oriented" languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, words, bygroups
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Error, Whitespace
16
+
17
+ from pygments.lexers._openedge_builtins import OPENEDGEKEYWORDS
18
+
19
+ __all__ = ['CobolLexer', 'CobolFreeformatLexer', 'ABAPLexer', 'OpenEdgeLexer',
20
+ 'GoodDataCLLexer', 'MaqlLexer']
21
+
22
+
23
+ class CobolLexer(RegexLexer):
24
+ """
25
+ Lexer for OpenCOBOL code.
26
+ """
27
+ name = 'COBOL'
28
+ aliases = ['cobol']
29
+ filenames = ['*.cob', '*.COB', '*.cpy', '*.CPY']
30
+ mimetypes = ['text/x-cobol']
31
+ url = 'https://en.wikipedia.org/wiki/COBOL'
32
+ version_added = '1.6'
33
+
34
+ flags = re.IGNORECASE | re.MULTILINE
35
+
36
+ # Data Types: by PICTURE and USAGE
37
+ # Operators: **, *, +, -, /, <, >, <=, >=, =, <>
38
+ # Logical (?): NOT, AND, OR
39
+
40
+ # Reserved words:
41
+ # http://opencobol.add1tocobol.com/#reserved-words
42
+ # Intrinsics:
43
+ # http://opencobol.add1tocobol.com/#does-opencobol-implement-any-intrinsic-functions
44
+
45
+ tokens = {
46
+ 'root': [
47
+ include('comment'),
48
+ include('strings'),
49
+ include('core'),
50
+ include('nums'),
51
+ (r'[a-z0-9]([\w\-]*[a-z0-9]+)?', Name.Variable),
52
+ # (r'[\s]+', Text),
53
+ (r'[ \t]+', Whitespace),
54
+ ],
55
+ 'comment': [
56
+ (r'(^.{6}[*/].*\n|^.{6}|\*>.*\n)', Comment),
57
+ ],
58
+ 'core': [
59
+ # Figurative constants
60
+ (r'(^|(?<=[^\w\-]))(ALL\s+)?'
61
+ r'((ZEROES)|(HIGH-VALUE|LOW-VALUE|QUOTE|SPACE|ZERO)(S)?)'
62
+ r'\s*($|(?=[^\w\-]))',
63
+ Name.Constant),
64
+
65
+ # Reserved words STATEMENTS and other bolds
66
+ (words((
67
+ 'ACCEPT', 'ADD', 'ALLOCATE', 'CALL', 'CANCEL', 'CLOSE', 'COMPUTE',
68
+ 'CONFIGURATION', 'CONTINUE', 'DATA', 'DELETE', 'DISPLAY', 'DIVIDE',
69
+ 'DIVISION', 'ELSE', 'END', 'END-ACCEPT',
70
+ 'END-ADD', 'END-CALL', 'END-COMPUTE', 'END-DELETE', 'END-DISPLAY',
71
+ 'END-DIVIDE', 'END-EVALUATE', 'END-IF', 'END-MULTIPLY', 'END-OF-PAGE',
72
+ 'END-PERFORM', 'END-READ', 'END-RETURN', 'END-REWRITE', 'END-SEARCH',
73
+ 'END-START', 'END-STRING', 'END-SUBTRACT', 'END-UNSTRING', 'END-WRITE',
74
+ 'ENVIRONMENT', 'EVALUATE', 'EXIT', 'FD', 'FILE', 'FILE-CONTROL', 'FOREVER',
75
+ 'FREE', 'GENERATE', 'GO', 'GOBACK', 'IDENTIFICATION', 'IF', 'INITIALIZE',
76
+ 'INITIATE', 'INPUT-OUTPUT', 'INSPECT', 'INVOKE', 'I-O-CONTROL', 'LINKAGE',
77
+ 'LOCAL-STORAGE', 'MERGE', 'MOVE', 'MULTIPLY', 'OPEN', 'PERFORM',
78
+ 'PROCEDURE', 'PROGRAM-ID', 'RAISE', 'READ', 'RELEASE', 'RESUME',
79
+ 'RETURN', 'REWRITE', 'SCREEN', 'SD', 'SEARCH', 'SECTION', 'SET',
80
+ 'SORT', 'START', 'STOP', 'STRING', 'SUBTRACT', 'SUPPRESS',
81
+ 'TERMINATE', 'THEN', 'UNLOCK', 'UNSTRING', 'USE', 'VALIDATE',
82
+ 'WORKING-STORAGE', 'WRITE'), prefix=r'(^|(?<=[^\w\-]))',
83
+ suffix=r'\s*($|(?=[^\w\-]))'),
84
+ Keyword.Reserved),
85
+
86
+ # Reserved words
87
+ (words((
88
+ 'ACCESS', 'ADDRESS', 'ADVANCING', 'AFTER', 'ALL',
89
+ 'ALPHABET', 'ALPHABETIC', 'ALPHABETIC-LOWER', 'ALPHABETIC-UPPER',
90
+ 'ALPHANUMERIC', 'ALPHANUMERIC-EDITED', 'ALSO', 'ALTER', 'ALTERNATE'
91
+ 'ANY', 'ARE', 'AREA', 'AREAS', 'ARGUMENT-NUMBER', 'ARGUMENT-VALUE', 'AS',
92
+ 'ASCENDING', 'ASSIGN', 'AT', 'AUTO', 'AUTO-SKIP', 'AUTOMATIC',
93
+ 'AUTOTERMINATE', 'BACKGROUND-COLOR', 'BASED', 'BEEP', 'BEFORE', 'BELL',
94
+ 'BLANK', 'BLINK', 'BLOCK', 'BOTTOM', 'BY', 'BYTE-LENGTH', 'CHAINING',
95
+ 'CHARACTER', 'CHARACTERS', 'CLASS', 'CODE', 'CODE-SET', 'COL',
96
+ 'COLLATING', 'COLS', 'COLUMN', 'COLUMNS', 'COMMA', 'COMMAND-LINE',
97
+ 'COMMIT', 'COMMON', 'CONSTANT', 'CONTAINS', 'CONTENT', 'CONTROL',
98
+ 'CONTROLS', 'CONVERTING', 'COPY', 'CORR', 'CORRESPONDING', 'COUNT', 'CRT',
99
+ 'CURRENCY', 'CURSOR', 'CYCLE', 'DATE', 'DAY', 'DAY-OF-WEEK', 'DE',
100
+ 'DEBUGGING', 'DECIMAL-POINT', 'DECLARATIVES', 'DEFAULT', 'DELIMITED',
101
+ 'DELIMITER', 'DEPENDING', 'DESCENDING', 'DETAIL', 'DISK',
102
+ 'DOWN', 'DUPLICATES', 'DYNAMIC', 'EBCDIC',
103
+ 'ENTRY', 'ENVIRONMENT-NAME', 'ENVIRONMENT-VALUE', 'EOL', 'EOP',
104
+ 'EOS', 'ERASE', 'ERROR', 'ESCAPE', 'EXCEPTION',
105
+ 'EXCLUSIVE', 'EXTEND', 'EXTERNAL', 'FILE-ID', 'FILLER', 'FINAL',
106
+ 'FIRST', 'FIXED', 'FLOAT-LONG', 'FLOAT-SHORT',
107
+ 'FOOTING', 'FOR', 'FOREGROUND-COLOR', 'FORMAT', 'FROM', 'FULL',
108
+ 'FUNCTION', 'FUNCTION-ID', 'GIVING', 'GLOBAL', 'GROUP',
109
+ 'HEADING', 'HIGHLIGHT', 'I-O', 'ID',
110
+ 'IGNORE', 'IGNORING', 'IN', 'INDEX', 'INDEXED', 'INDICATE',
111
+ 'INITIAL', 'INITIALIZED', 'INPUT', 'INTO', 'INTRINSIC', 'INVALID',
112
+ 'IS', 'JUST', 'JUSTIFIED', 'KEY', 'LABEL',
113
+ 'LAST', 'LEADING', 'LEFT', 'LENGTH', 'LIMIT', 'LIMITS', 'LINAGE',
114
+ 'LINAGE-COUNTER', 'LINE', 'LINES', 'LOCALE', 'LOCK',
115
+ 'LOWLIGHT', 'MANUAL', 'MEMORY', 'MINUS', 'MODE', 'MULTIPLE',
116
+ 'NATIONAL', 'NATIONAL-EDITED', 'NATIVE', 'NEGATIVE', 'NEXT', 'NO',
117
+ 'NULL', 'NULLS', 'NUMBER', 'NUMBERS', 'NUMERIC', 'NUMERIC-EDITED',
118
+ 'OBJECT-COMPUTER', 'OCCURS', 'OF', 'OFF', 'OMITTED', 'ON', 'ONLY',
119
+ 'OPTIONAL', 'ORDER', 'ORGANIZATION', 'OTHER', 'OUTPUT', 'OVERFLOW',
120
+ 'OVERLINE', 'PACKED-DECIMAL', 'PADDING', 'PAGE', 'PARAGRAPH',
121
+ 'PLUS', 'POINTER', 'POSITION', 'POSITIVE', 'PRESENT', 'PREVIOUS',
122
+ 'PRINTER', 'PRINTING', 'PROCEDURE-POINTER', 'PROCEDURES',
123
+ 'PROCEED', 'PROGRAM', 'PROGRAM-POINTER', 'PROMPT', 'QUOTE',
124
+ 'QUOTES', 'RANDOM', 'RD', 'RECORD', 'RECORDING', 'RECORDS', 'RECURSIVE',
125
+ 'REDEFINES', 'REEL', 'REFERENCE', 'RELATIVE', 'REMAINDER', 'REMOVAL',
126
+ 'RENAMES', 'REPLACING', 'REPORT', 'REPORTING', 'REPORTS', 'REPOSITORY',
127
+ 'REQUIRED', 'RESERVE', 'RETURNING', 'REVERSE-VIDEO', 'REWIND',
128
+ 'RIGHT', 'ROLLBACK', 'ROUNDED', 'RUN', 'SAME', 'SCROLL',
129
+ 'SECURE', 'SEGMENT-LIMIT', 'SELECT', 'SENTENCE', 'SEPARATE',
130
+ 'SEQUENCE', 'SEQUENTIAL', 'SHARING', 'SIGN', 'SIGNED', 'SIGNED-INT',
131
+ 'SIGNED-LONG', 'SIGNED-SHORT', 'SIZE', 'SORT-MERGE', 'SOURCE',
132
+ 'SOURCE-COMPUTER', 'SPECIAL-NAMES', 'STANDARD',
133
+ 'STANDARD-1', 'STANDARD-2', 'STATUS', 'SUBKEY', 'SUM',
134
+ 'SYMBOLIC', 'SYNC', 'SYNCHRONIZED', 'TALLYING', 'TAPE',
135
+ 'TEST', 'THROUGH', 'THRU', 'TIME', 'TIMES', 'TO', 'TOP', 'TRAILING',
136
+ 'TRANSFORM', 'TYPE', 'UNDERLINE', 'UNIT', 'UNSIGNED',
137
+ 'UNSIGNED-INT', 'UNSIGNED-LONG', 'UNSIGNED-SHORT', 'UNTIL', 'UP',
138
+ 'UPDATE', 'UPON', 'USAGE', 'USING', 'VALUE', 'VALUES', 'VARYING',
139
+ 'WAIT', 'WHEN', 'WITH', 'WORDS', 'YYYYDDD', 'YYYYMMDD'),
140
+ prefix=r'(^|(?<=[^\w\-]))', suffix=r'\s*($|(?=[^\w\-]))'),
141
+ Keyword.Pseudo),
142
+
143
+ # inactive reserved words
144
+ (words((
145
+ 'ACTIVE-CLASS', 'ALIGNED', 'ANYCASE', 'ARITHMETIC', 'ATTRIBUTE',
146
+ 'B-AND', 'B-NOT', 'B-OR', 'B-XOR', 'BIT', 'BOOLEAN', 'CD', 'CENTER',
147
+ 'CF', 'CH', 'CHAIN', 'CLASS-ID', 'CLASSIFICATION', 'COMMUNICATION',
148
+ 'CONDITION', 'DATA-POINTER', 'DESTINATION', 'DISABLE', 'EC', 'EGI',
149
+ 'EMI', 'ENABLE', 'END-RECEIVE', 'ENTRY-CONVENTION', 'EO', 'ESI',
150
+ 'EXCEPTION-OBJECT', 'EXPANDS', 'FACTORY', 'FLOAT-BINARY-16',
151
+ 'FLOAT-BINARY-34', 'FLOAT-BINARY-7', 'FLOAT-DECIMAL-16',
152
+ 'FLOAT-DECIMAL-34', 'FLOAT-EXTENDED', 'FORMAT', 'FUNCTION-POINTER',
153
+ 'GET', 'GROUP-USAGE', 'IMPLEMENTS', 'INFINITY', 'INHERITS',
154
+ 'INTERFACE', 'INTERFACE-ID', 'INVOKE', 'LC_ALL', 'LC_COLLATE',
155
+ 'LC_CTYPE', 'LC_MESSAGES', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME',
156
+ 'LINE-COUNTER', 'MESSAGE', 'METHOD', 'METHOD-ID', 'NESTED', 'NONE',
157
+ 'NORMAL', 'OBJECT', 'OBJECT-REFERENCE', 'OPTIONS', 'OVERRIDE',
158
+ 'PAGE-COUNTER', 'PF', 'PH', 'PROPERTY', 'PROTOTYPE', 'PURGE',
159
+ 'QUEUE', 'RAISE', 'RAISING', 'RECEIVE', 'RELATION', 'REPLACE',
160
+ 'REPRESENTS-NOT-A-NUMBER', 'RESET', 'RESUME', 'RETRY', 'RF', 'RH',
161
+ 'SECONDS', 'SEGMENT', 'SELF', 'SEND', 'SOURCES', 'STATEMENT',
162
+ 'STEP', 'STRONG', 'SUB-QUEUE-1', 'SUB-QUEUE-2', 'SUB-QUEUE-3',
163
+ 'SUPER', 'SYMBOL', 'SYSTEM-DEFAULT', 'TABLE', 'TERMINAL', 'TEXT',
164
+ 'TYPEDEF', 'UCS-4', 'UNIVERSAL', 'USER-DEFAULT', 'UTF-16', 'UTF-8',
165
+ 'VAL-STATUS', 'VALID', 'VALIDATE', 'VALIDATE-STATUS'),
166
+ prefix=r'(^|(?<=[^\w\-]))', suffix=r'\s*($|(?=[^\w\-]))'),
167
+ Error),
168
+
169
+ # Data Types
170
+ (r'(^|(?<=[^\w\-]))'
171
+ r'(PIC\s+.+?(?=(\s|\.\s))|PICTURE\s+.+?(?=(\s|\.\s))|'
172
+ r'(COMPUTATIONAL)(-[1-5X])?|(COMP)(-[1-5X])?|'
173
+ r'BINARY-C-LONG|'
174
+ r'BINARY-CHAR|BINARY-DOUBLE|BINARY-LONG|BINARY-SHORT|'
175
+ r'BINARY)\s*($|(?=[^\w\-]))', Keyword.Type),
176
+
177
+ # Operators
178
+ (r'(\*\*|\*|\+|-|/|<=|>=|<|>|==|/=|=)', Operator),
179
+
180
+ # (r'(::)', Keyword.Declaration),
181
+
182
+ (r'([(),;:&%.])', Punctuation),
183
+
184
+ # Intrinsics
185
+ (r'(^|(?<=[^\w\-]))(ABS|ACOS|ANNUITY|ASIN|ATAN|BYTE-LENGTH|'
186
+ r'CHAR|COMBINED-DATETIME|CONCATENATE|COS|CURRENT-DATE|'
187
+ r'DATE-OF-INTEGER|DATE-TO-YYYYMMDD|DAY-OF-INTEGER|DAY-TO-YYYYDDD|'
188
+ r'EXCEPTION-(?:FILE|LOCATION|STATEMENT|STATUS)|EXP10|EXP|E|'
189
+ r'FACTORIAL|FRACTION-PART|INTEGER-OF-(?:DATE|DAY|PART)|INTEGER|'
190
+ r'LENGTH|LOCALE-(?:DATE|TIME(?:-FROM-SECONDS)?)|LOG(?:10)?|'
191
+ r'LOWER-CASE|MAX|MEAN|MEDIAN|MIDRANGE|MIN|MOD|NUMVAL(?:-C)?|'
192
+ r'ORD(?:-MAX|-MIN)?|PI|PRESENT-VALUE|RANDOM|RANGE|REM|REVERSE|'
193
+ r'SECONDS-FROM-FORMATTED-TIME|SECONDS-PAST-MIDNIGHT|SIGN|SIN|SQRT|'
194
+ r'STANDARD-DEVIATION|STORED-CHAR-LENGTH|SUBSTITUTE(?:-CASE)?|'
195
+ r'SUM|TAN|TEST-DATE-YYYYMMDD|TEST-DAY-YYYYDDD|TRIM|'
196
+ r'UPPER-CASE|VARIANCE|WHEN-COMPILED|YEAR-TO-YYYY)\s*'
197
+ r'($|(?=[^\w\-]))', Name.Function),
198
+
199
+ # Booleans
200
+ (r'(^|(?<=[^\w\-]))(true|false)\s*($|(?=[^\w\-]))', Name.Builtin),
201
+ # Comparing Operators
202
+ (r'(^|(?<=[^\w\-]))(equal|equals|ne|lt|le|gt|ge|'
203
+ r'greater|less|than|not|and|or)\s*($|(?=[^\w\-]))', Operator.Word),
204
+ ],
205
+
206
+ # \"[^\"\n]*\"|\'[^\'\n]*\'
207
+ 'strings': [
208
+ # apparently strings can be delimited by EOL if they are continued
209
+ # in the next line
210
+ (r'"[^"\n]*("|\n)', String.Double),
211
+ (r"'[^'\n]*('|\n)", String.Single),
212
+ ],
213
+
214
+ 'nums': [
215
+ (r'\d+(\s*|\.$|$)', Number.Integer),
216
+ (r'[+-]?\d*\.\d+(E[-+]?\d+)?', Number.Float),
217
+ (r'[+-]?\d+\.\d*(E[-+]?\d+)?', Number.Float),
218
+ ],
219
+ }
220
+
221
+
222
+ class CobolFreeformatLexer(CobolLexer):
223
+ """
224
+ Lexer for Free format OpenCOBOL code.
225
+ """
226
+ name = 'COBOLFree'
227
+ aliases = ['cobolfree']
228
+ filenames = ['*.cbl', '*.CBL']
229
+ mimetypes = []
230
+ url = 'https://opencobol.add1tocobol.com'
231
+ version_added = '1.6'
232
+
233
+ flags = re.IGNORECASE | re.MULTILINE
234
+
235
+ tokens = {
236
+ 'comment': [
237
+ (r'(\*>.*\n|^\w*\*.*$)', Comment),
238
+ ],
239
+ }
240
+
241
+
242
+ class ABAPLexer(RegexLexer):
243
+ """
244
+ Lexer for ABAP, SAP's integrated language.
245
+ """
246
+ name = 'ABAP'
247
+ aliases = ['abap']
248
+ filenames = ['*.abap', '*.ABAP']
249
+ mimetypes = ['text/x-abap']
250
+ url = 'https://community.sap.com/topics/abap'
251
+ version_added = '1.1'
252
+
253
+ flags = re.IGNORECASE | re.MULTILINE
254
+
255
+ tokens = {
256
+ 'common': [
257
+ (r'\s+', Whitespace),
258
+ (r'^\*.*$', Comment.Single),
259
+ (r'\".*?\n', Comment.Single),
260
+ (r'##\w+', Comment.Special),
261
+ ],
262
+ 'variable-names': [
263
+ (r'<\S+>', Name.Variable),
264
+ (r'\w[\w~]*(?:(\[\])|->\*)?', Name.Variable),
265
+ ],
266
+ 'root': [
267
+ include('common'),
268
+ # function calls
269
+ (r'CALL\s+(?:BADI|CUSTOMER-FUNCTION|FUNCTION)',
270
+ Keyword),
271
+ (r'(CALL\s+(?:DIALOG|SCREEN|SUBSCREEN|SELECTION-SCREEN|'
272
+ r'TRANSACTION|TRANSFORMATION))\b',
273
+ Keyword),
274
+ (r'(FORM|PERFORM)(\s+)(\w+)',
275
+ bygroups(Keyword, Whitespace, Name.Function)),
276
+ (r'(PERFORM)(\s+)(\()(\w+)(\))',
277
+ bygroups(Keyword, Whitespace, Punctuation, Name.Variable, Punctuation)),
278
+ (r'(MODULE)(\s+)(\S+)(\s+)(INPUT|OUTPUT)',
279
+ bygroups(Keyword, Whitespace, Name.Function, Whitespace, Keyword)),
280
+
281
+ # method implementation
282
+ (r'(METHOD)(\s+)([\w~]+)',
283
+ bygroups(Keyword, Whitespace, Name.Function)),
284
+ # method calls
285
+ (r'(\s+)([\w\-]+)([=\-]>)([\w\-~]+)',
286
+ bygroups(Whitespace, Name.Variable, Operator, Name.Function)),
287
+ # call methodnames returning style
288
+ (r'(?<=(=|-)>)([\w\-~]+)(?=\()', Name.Function),
289
+
290
+ # text elements
291
+ (r'(TEXT)(-)(\d{3})',
292
+ bygroups(Keyword, Punctuation, Number.Integer)),
293
+ (r'(TEXT)(-)(\w{3})',
294
+ bygroups(Keyword, Punctuation, Name.Variable)),
295
+
296
+ # keywords with dashes in them.
297
+ # these need to be first, because for instance the -ID part
298
+ # of MESSAGE-ID wouldn't get highlighted if MESSAGE was
299
+ # first in the list of keywords.
300
+ (r'(ADD-CORRESPONDING|AUTHORITY-CHECK|'
301
+ r'CLASS-DATA|CLASS-EVENTS|CLASS-METHODS|CLASS-POOL|'
302
+ r'DELETE-ADJACENT|DIVIDE-CORRESPONDING|'
303
+ r'EDITOR-CALL|ENHANCEMENT-POINT|ENHANCEMENT-SECTION|EXIT-COMMAND|'
304
+ r'FIELD-GROUPS|FIELD-SYMBOLS|FIELD-SYMBOL|FUNCTION-POOL|'
305
+ r'INTERFACE-POOL|INVERTED-DATE|'
306
+ r'LOAD-OF-PROGRAM|LOG-POINT|'
307
+ r'MESSAGE-ID|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|'
308
+ r'NEW-LINE|NEW-PAGE|NEW-SECTION|NO-EXTENSION|'
309
+ r'OUTPUT-LENGTH|PRINT-CONTROL|'
310
+ r'SELECT-OPTIONS|START-OF-SELECTION|SUBTRACT-CORRESPONDING|'
311
+ r'SYNTAX-CHECK|SYSTEM-EXCEPTIONS|'
312
+ r'TYPE-POOL|TYPE-POOLS|NO-DISPLAY'
313
+ r')\b', Keyword),
314
+
315
+ # keyword kombinations
316
+ (r'(?<![-\>])(CREATE\s+(PUBLIC|PRIVATE|DATA|OBJECT)|'
317
+ r'(PUBLIC|PRIVATE|PROTECTED)\s+SECTION|'
318
+ r'(TYPE|LIKE)\s+((LINE\s+OF|REF\s+TO|'
319
+ r'(SORTED|STANDARD|HASHED)\s+TABLE\s+OF))?|'
320
+ r'FROM\s+(DATABASE|MEMORY)|CALL\s+METHOD|'
321
+ r'(GROUP|ORDER) BY|HAVING|SEPARATED BY|'
322
+ r'GET\s+(BADI|BIT|CURSOR|DATASET|LOCALE|PARAMETER|'
323
+ r'PF-STATUS|(PROPERTY|REFERENCE)\s+OF|'
324
+ r'RUN\s+TIME|TIME\s+(STAMP)?)?|'
325
+ r'SET\s+(BIT|BLANK\s+LINES|COUNTRY|CURSOR|DATASET|EXTENDED\s+CHECK|'
326
+ r'HANDLER|HOLD\s+DATA|LANGUAGE|LEFT\s+SCROLL-BOUNDARY|'
327
+ r'LOCALE|MARGIN|PARAMETER|PF-STATUS|PROPERTY\s+OF|'
328
+ r'RUN\s+TIME\s+(ANALYZER|CLOCK\s+RESOLUTION)|SCREEN|'
329
+ r'TITLEBAR|UPADTE\s+TASK\s+LOCAL|USER-COMMAND)|'
330
+ r'CONVERT\s+((INVERTED-)?DATE|TIME|TIME\s+STAMP|TEXT)|'
331
+ r'(CLOSE|OPEN)\s+(DATASET|CURSOR)|'
332
+ r'(TO|FROM)\s+(DATA BUFFER|INTERNAL TABLE|MEMORY ID|'
333
+ r'DATABASE|SHARED\s+(MEMORY|BUFFER))|'
334
+ r'DESCRIBE\s+(DISTANCE\s+BETWEEN|FIELD|LIST|TABLE)|'
335
+ r'FREE\s(MEMORY|OBJECT)?|'
336
+ r'PROCESS\s+(BEFORE\s+OUTPUT|AFTER\s+INPUT|'
337
+ r'ON\s+(VALUE-REQUEST|HELP-REQUEST))|'
338
+ r'AT\s+(LINE-SELECTION|USER-COMMAND|END\s+OF|NEW)|'
339
+ r'AT\s+SELECTION-SCREEN(\s+(ON(\s+(BLOCK|(HELP|VALUE)-REQUEST\s+FOR|'
340
+ r'END\s+OF|RADIOBUTTON\s+GROUP))?|OUTPUT))?|'
341
+ r'SELECTION-SCREEN:?\s+((BEGIN|END)\s+OF\s+((TABBED\s+)?BLOCK|LINE|'
342
+ r'SCREEN)|COMMENT|FUNCTION\s+KEY|'
343
+ r'INCLUDE\s+BLOCKS|POSITION|PUSHBUTTON|'
344
+ r'SKIP|ULINE)|'
345
+ r'LEAVE\s+(LIST-PROCESSING|PROGRAM|SCREEN|'
346
+ r'TO LIST-PROCESSING|TO TRANSACTION)'
347
+ r'(ENDING|STARTING)\s+AT|'
348
+ r'FORMAT\s+(COLOR|INTENSIFIED|INVERSE|HOTSPOT|INPUT|FRAMES|RESET)|'
349
+ r'AS\s+(CHECKBOX|SUBSCREEN|WINDOW)|'
350
+ r'WITH\s+(((NON-)?UNIQUE)?\s+KEY|FRAME)|'
351
+ r'(BEGIN|END)\s+OF|'
352
+ r'DELETE(\s+ADJACENT\s+DUPLICATES\sFROM)?|'
353
+ r'COMPARING(\s+ALL\s+FIELDS)?|'
354
+ r'(INSERT|APPEND)(\s+INITIAL\s+LINE\s+(IN)?TO|\s+LINES\s+OF)?|'
355
+ r'IN\s+((BYTE|CHARACTER)\s+MODE|PROGRAM)|'
356
+ r'END-OF-(DEFINITION|PAGE|SELECTION)|'
357
+ r'WITH\s+FRAME(\s+TITLE)|'
358
+ r'(REPLACE|FIND)\s+((FIRST|ALL)\s+OCCURRENCES?\s+OF\s+)?(SUBSTRING|REGEX)?|'
359
+ r'MATCH\s+(LENGTH|COUNT|LINE|OFFSET)|'
360
+ r'(RESPECTING|IGNORING)\s+CASE|'
361
+ r'IN\s+UPDATE\s+TASK|'
362
+ r'(SOURCE|RESULT)\s+(XML)?|'
363
+ r'REFERENCE\s+INTO|'
364
+
365
+ # simple kombinations
366
+ r'AND\s+(MARK|RETURN)|CLIENT\s+SPECIFIED|CORRESPONDING\s+FIELDS\s+OF|'
367
+ r'IF\s+FOUND|FOR\s+EVENT|INHERITING\s+FROM|LEAVE\s+TO\s+SCREEN|'
368
+ r'LOOP\s+AT\s+(SCREEN)?|LOWER\s+CASE|MATCHCODE\s+OBJECT|MODIF\s+ID|'
369
+ r'MODIFY\s+SCREEN|NESTING\s+LEVEL|NO\s+INTERVALS|OF\s+STRUCTURE|'
370
+ r'RADIOBUTTON\s+GROUP|RANGE\s+OF|REF\s+TO|SUPPRESS DIALOG|'
371
+ r'TABLE\s+OF|UPPER\s+CASE|TRANSPORTING\s+NO\s+FIELDS|'
372
+ r'VALUE\s+CHECK|VISIBLE\s+LENGTH|HEADER\s+LINE|COMMON\s+PART)\b', Keyword),
373
+
374
+ # single word keywords.
375
+ (r'(^|(?<=(\s|\.)))(ABBREVIATED|ABSTRACT|ADD|ALIASES|ALIGN|ALPHA|'
376
+ r'ASSERT|AS|ASSIGN(ING)?|AT(\s+FIRST)?|'
377
+ r'BACK|BLOCK|BREAK-POINT|'
378
+ r'CASE|CAST|CATCH|CHANGING|CHECK|CLASS|CLEAR|COLLECT|COLOR|COMMIT|COND|CONV|'
379
+ r'CREATE|COMMUNICATION|COMPONENTS?|COMPUTE|CONCATENATE|CONDENSE|'
380
+ r'CONSTANTS|CONTEXTS|CONTINUE|CONTROLS|COUNTRY|CURRENCY|'
381
+ r'DATA|DATE|DECIMALS|DEFAULT|DEFINE|DEFINITION|DEFERRED|DEMAND|'
382
+ r'DETAIL|DIRECTORY|DIVIDE|DO|DUMMY|'
383
+ r'ELSE(IF)?|ENDAT|ENDCASE|ENDCATCH|ENDCLASS|ENDDO|ENDFORM|ENDFUNCTION|'
384
+ r'ENDIF|ENDINTERFACE|ENDLOOP|ENDMETHOD|ENDMODULE|ENDSELECT|ENDTRY|ENDWHILE|'
385
+ r'ENHANCEMENT|EVENTS|EXACT|EXCEPTIONS?|EXIT|EXPONENT|EXPORT|EXPORTING|EXTRACT|'
386
+ r'FETCH|FIELDS?|FOR|FORM|FORMAT|FREE|FROM|FUNCTION|'
387
+ r'HIDE|'
388
+ r'ID|IF|IMPORT|IMPLEMENTATION|IMPORTING|IN|INCLUDE|INCLUDING|'
389
+ r'INDEX|INFOTYPES|INITIALIZATION|INTERFACE|INTERFACES|INTO|'
390
+ r'LANGUAGE|LEAVE|LENGTH|LINES|LOAD|LOCAL|'
391
+ r'JOIN|'
392
+ r'KEY|'
393
+ r'NEW|NEXT|'
394
+ r'MAXIMUM|MESSAGE|METHOD[S]?|MINIMUM|MODULE|MODIFIER|MODIFY|MOVE|MULTIPLY|'
395
+ r'NODES|NUMBER|'
396
+ r'OBLIGATORY|OBJECT|OF|OFF|ON|OTHERS|OVERLAY|'
397
+ r'PACK|PAD|PARAMETERS|PERCENTAGE|POSITION|PROGRAM|PROVIDE|PUBLIC|PUT|PF\d\d|'
398
+ r'RAISE|RAISING|RANGES?|READ|RECEIVE|REDEFINITION|REFRESH|REJECT|REPORT|RESERVE|'
399
+ r'REF|RESUME|RETRY|RETURN|RETURNING|RIGHT|ROLLBACK|REPLACE|'
400
+ r'SCROLL|SEARCH|SELECT|SHIFT|SIGN|SINGLE|SIZE|SKIP|SORT|SPLIT|STATICS|STOP|'
401
+ r'STYLE|SUBMATCHES|SUBMIT|SUBTRACT|SUM(?!\()|SUMMARY|SUMMING|SUPPLY|SWITCH|'
402
+ r'TABLE|TABLES|TIMESTAMP|TIMES?|TIMEZONE|TITLE|\??TO|'
403
+ r'TOP-OF-PAGE|TRANSFER|TRANSLATE|TRY|TYPES|'
404
+ r'ULINE|UNDER|UNPACK|UPDATE|USING|'
405
+ r'VALUE|VALUES|VIA|VARYING|VARY|'
406
+ r'WAIT|WHEN|WHERE|WIDTH|WHILE|WITH|WINDOW|WRITE|XSD|ZERO)\b', Keyword),
407
+
408
+ # builtins
409
+ (r'(abs|acos|asin|atan|'
410
+ r'boolc|boolx|bit_set|'
411
+ r'char_off|charlen|ceil|cmax|cmin|condense|contains|'
412
+ r'contains_any_of|contains_any_not_of|concat_lines_of|cos|cosh|'
413
+ r'count|count_any_of|count_any_not_of|'
414
+ r'dbmaxlen|distance|'
415
+ r'escape|exp|'
416
+ r'find|find_end|find_any_of|find_any_not_of|floor|frac|from_mixed|'
417
+ r'insert|'
418
+ r'lines|log|log10|'
419
+ r'match|matches|'
420
+ r'nmax|nmin|numofchar|'
421
+ r'repeat|replace|rescale|reverse|round|'
422
+ r'segment|shift_left|shift_right|sign|sin|sinh|sqrt|strlen|'
423
+ r'substring|substring_after|substring_from|substring_before|substring_to|'
424
+ r'tan|tanh|to_upper|to_lower|to_mixed|translate|trunc|'
425
+ r'xstrlen)(\()\b', bygroups(Name.Builtin, Punctuation)),
426
+
427
+ (r'&[0-9]', Name),
428
+ (r'[0-9]+', Number.Integer),
429
+
430
+ # operators which look like variable names before
431
+ # parsing variable names.
432
+ (r'(?<=(\s|.))(AND|OR|EQ|NE|GT|LT|GE|LE|CO|CN|CA|NA|CS|NOT|NS|CP|NP|'
433
+ r'BYTE-CO|BYTE-CN|BYTE-CA|BYTE-NA|BYTE-CS|BYTE-NS|'
434
+ r'IS\s+(NOT\s+)?(INITIAL|ASSIGNED|REQUESTED|BOUND))\b', Operator.Word),
435
+
436
+ include('variable-names'),
437
+
438
+ # standard operators after variable names,
439
+ # because < and > are part of field symbols.
440
+ (r'[?*<>=\-+&]', Operator),
441
+ (r"'(''|[^'])*'", String.Single),
442
+ (r"`([^`])*`", String.Single),
443
+ (r"([|}])([^{}|]*?)([|{])",
444
+ bygroups(Punctuation, String.Single, Punctuation)),
445
+ (r'[/;:()\[\],.]', Punctuation),
446
+ (r'(!)(\w+)', bygroups(Operator, Name)),
447
+ ],
448
+ }
449
+
450
+
451
+ class OpenEdgeLexer(RegexLexer):
452
+ """
453
+ Lexer for OpenEdge ABL (formerly Progress) source code.
454
+ """
455
+ name = 'OpenEdge ABL'
456
+ aliases = ['openedge', 'abl', 'progress']
457
+ filenames = ['*.p', '*.cls']
458
+ mimetypes = ['text/x-openedge', 'application/x-openedge']
459
+ url = 'https://www.progress.com/openedge/features/abl'
460
+ version_added = '1.5'
461
+
462
+ types = (r'(?i)(^|(?<=[^\w\-]))(CHARACTER|CHAR|CHARA|CHARAC|CHARACT|CHARACTE|'
463
+ r'COM-HANDLE|DATE|DATETIME|DATETIME-TZ|'
464
+ r'DECIMAL|DEC|DECI|DECIM|DECIMA|HANDLE|'
465
+ r'INT64|INTEGER|INT|INTE|INTEG|INTEGE|'
466
+ r'LOGICAL|LONGCHAR|MEMPTR|RAW|RECID|ROWID)\s*($|(?=[^\w\-]))')
467
+
468
+ keywords = words(OPENEDGEKEYWORDS,
469
+ prefix=r'(?i)(^|(?<=[^\w\-]))',
470
+ suffix=r'\s*($|(?=[^\w\-]))')
471
+
472
+ tokens = {
473
+ 'root': [
474
+ (r'/\*', Comment.Multiline, 'comment'),
475
+ (r'\{', Comment.Preproc, 'preprocessor'),
476
+ (r'\s*&.*', Comment.Preproc),
477
+ (r'0[xX][0-9a-fA-F]+[LlUu]*', Number.Hex),
478
+ (r'(?i)(DEFINE|DEF|DEFI|DEFIN)\b', Keyword.Declaration),
479
+ (types, Keyword.Type),
480
+ (keywords, Name.Builtin),
481
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
482
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
483
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
484
+ (r'[0-9]+', Number.Integer),
485
+ (r'\s+', Whitespace),
486
+ (r'[+*/=-]', Operator),
487
+ (r'[.:()]', Punctuation),
488
+ (r'.', Name.Variable), # Lazy catch-all
489
+ ],
490
+ 'comment': [
491
+ (r'[^*/]', Comment.Multiline),
492
+ (r'/\*', Comment.Multiline, '#push'),
493
+ (r'\*/', Comment.Multiline, '#pop'),
494
+ (r'[*/]', Comment.Multiline)
495
+ ],
496
+ 'preprocessor': [
497
+ (r'[^{}]', Comment.Preproc),
498
+ (r'\{', Comment.Preproc, '#push'),
499
+ (r'\}', Comment.Preproc, '#pop'),
500
+ ],
501
+ }
502
+
503
+ def analyse_text(text):
504
+ """Try to identify OpenEdge ABL based on a few common constructs."""
505
+ result = 0
506
+
507
+ if 'END.' in text:
508
+ result += 0.05
509
+
510
+ if 'END PROCEDURE.' in text:
511
+ result += 0.05
512
+
513
+ if 'ELSE DO:' in text:
514
+ result += 0.05
515
+
516
+ return result
517
+
518
+
519
+ class GoodDataCLLexer(RegexLexer):
520
+ """
521
+ Lexer for GoodData-CL script files.
522
+ """
523
+
524
+ name = 'GoodData-CL'
525
+ aliases = ['gooddata-cl']
526
+ filenames = ['*.gdc']
527
+ mimetypes = ['text/x-gooddata-cl']
528
+ url = 'https://github.com/gooddata/GoodData-CL'
529
+ version_added = '1.4'
530
+
531
+ flags = re.IGNORECASE
532
+
533
+ # Syntax:
534
+ # https://github.com/gooddata/GoodData-CL/raw/master/cli/src/main/resources/com/gooddata/processor/COMMANDS.txt
535
+ tokens = {
536
+ 'root': [
537
+ # Comments
538
+ (r'#.*', Comment.Single),
539
+ # Function call
540
+ (r'[a-z]\w*', Name.Function),
541
+ # Argument list
542
+ (r'\(', Punctuation, 'args-list'),
543
+ # Punctuation
544
+ (r';', Punctuation),
545
+ # Space is not significant
546
+ (r'\s+', Text)
547
+ ],
548
+ 'args-list': [
549
+ (r'\)', Punctuation, '#pop'),
550
+ (r',', Punctuation),
551
+ (r'[a-z]\w*', Name.Variable),
552
+ (r'=', Operator),
553
+ (r'"', String, 'string-literal'),
554
+ (r'[0-9]+(?:\.[0-9]+)?(?:e[+-]?[0-9]{1,3})?', Number),
555
+ # Space is not significant
556
+ (r'\s', Whitespace)
557
+ ],
558
+ 'string-literal': [
559
+ (r'\\[tnrfbae"\\]', String.Escape),
560
+ (r'"', String, '#pop'),
561
+ (r'[^\\"]+', String)
562
+ ]
563
+ }
564
+
565
+
566
+ class MaqlLexer(RegexLexer):
567
+ """
568
+ Lexer for GoodData MAQL scripts.
569
+ """
570
+
571
+ name = 'MAQL'
572
+ aliases = ['maql']
573
+ filenames = ['*.maql']
574
+ mimetypes = ['text/x-gooddata-maql', 'application/x-gooddata-maql']
575
+ url = 'https://help.gooddata.com/doc/enterprise/en/dashboards-and-insights/maql-analytical-query-language'
576
+ version_added = '1.4'
577
+
578
+ flags = re.IGNORECASE
579
+ tokens = {
580
+ 'root': [
581
+ # IDENTITY
582
+ (r'IDENTIFIER\b', Name.Builtin),
583
+ # IDENTIFIER
584
+ (r'\{[^}]+\}', Name.Variable),
585
+ # NUMBER
586
+ (r'[0-9]+(?:\.[0-9]+)?(?:e[+-]?[0-9]{1,3})?', Number),
587
+ # STRING
588
+ (r'"', String, 'string-literal'),
589
+ # RELATION
590
+ (r'\<\>|\!\=', Operator),
591
+ (r'\=|\>\=|\>|\<\=|\<', Operator),
592
+ # :=
593
+ (r'\:\=', Operator),
594
+ # OBJECT
595
+ (r'\[[^]]+\]', Name.Variable.Class),
596
+ # keywords
597
+ (words((
598
+ 'DIMENSION', 'DIMENSIONS', 'BOTTOM', 'METRIC', 'COUNT', 'OTHER',
599
+ 'FACT', 'WITH', 'TOP', 'OR', 'ATTRIBUTE', 'CREATE', 'PARENT',
600
+ 'FALSE', 'ROW', 'ROWS', 'FROM', 'ALL', 'AS', 'PF', 'COLUMN',
601
+ 'COLUMNS', 'DEFINE', 'REPORT', 'LIMIT', 'TABLE', 'LIKE', 'AND',
602
+ 'BY', 'BETWEEN', 'EXCEPT', 'SELECT', 'MATCH', 'WHERE', 'TRUE',
603
+ 'FOR', 'IN', 'WITHOUT', 'FILTER', 'ALIAS', 'WHEN', 'NOT', 'ON',
604
+ 'KEYS', 'KEY', 'FULLSET', 'PRIMARY', 'LABELS', 'LABEL',
605
+ 'VISUAL', 'TITLE', 'DESCRIPTION', 'FOLDER', 'ALTER', 'DROP',
606
+ 'ADD', 'DATASET', 'DATATYPE', 'INT', 'BIGINT', 'DOUBLE', 'DATE',
607
+ 'VARCHAR', 'DECIMAL', 'SYNCHRONIZE', 'TYPE', 'DEFAULT', 'ORDER',
608
+ 'ASC', 'DESC', 'HYPERLINK', 'INCLUDE', 'TEMPLATE', 'MODIFY'),
609
+ suffix=r'\b'),
610
+ Keyword),
611
+ # FUNCNAME
612
+ (r'[a-z]\w*\b', Name.Function),
613
+ # Comments
614
+ (r'#.*', Comment.Single),
615
+ # Punctuation
616
+ (r'[,;()]', Punctuation),
617
+ # Space is not significant
618
+ (r'\s+', Whitespace)
619
+ ],
620
+ 'string-literal': [
621
+ (r'\\[tnrfbae"\\]', String.Escape),
622
+ (r'"', String, '#pop'),
623
+ (r'[^\\"]+', String)
624
+ ],
625
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/c_cpp.py ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.c_cpp
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for C/C++ languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups, using, \
14
+ this, inherit, default, words
15
+ from pygments.util import get_bool_opt
16
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
17
+ Number, Punctuation, Whitespace
18
+
19
+ __all__ = ['CLexer', 'CppLexer']
20
+
21
+
22
+ class CFamilyLexer(RegexLexer):
23
+ """
24
+ For C family source code. This is used as a base class to avoid repetitious
25
+ definitions.
26
+ """
27
+
28
+ # The trailing ?, rather than *, avoids a geometric performance drop here.
29
+ #: only one /* */ style comment
30
+ _ws1 = r'\s*(?:/[*].*?[*]/\s*)?'
31
+
32
+ # Hexadecimal part in an hexadecimal integer/floating-point literal.
33
+ # This includes decimal separators matching.
34
+ _hexpart = r'[0-9a-fA-F](\'?[0-9a-fA-F])*'
35
+ # Decimal part in an decimal integer/floating-point literal.
36
+ # This includes decimal separators matching.
37
+ _decpart = r'\d(\'?\d)*'
38
+ # Integer literal suffix (e.g. 'ull' or 'll').
39
+ _intsuffix = r'(([uU]?[zZ])|([zZ][uU])|([uU][lL]{0,2})|([lL]{1,2}[uU]?))?'
40
+
41
+ # Identifier regex with C and C++ Universal Character Name (UCN) support.
42
+ _ident = r'(?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})+'
43
+ _namespaced_ident = r'(?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|::)+'
44
+
45
+ # Single and multiline comment regexes
46
+ # Beware not to use *? for the inner content! When these regexes
47
+ # are embedded in larger regexes, that can cause the stuff*? to
48
+ # match more than it would have if the regex had been used in
49
+ # a standalone way ...
50
+ _comment_single = r'//(?:.|(?<=\\)\n)*\n'
51
+ _comment_multiline = r'/(?:\\\n)?[*](?:[^*]|[*](?!(?:\\\n)?/))*[*](?:\\\n)?/'
52
+
53
+ # Regex to match optional comments
54
+ _possible_comments = rf'\s*(?:(?:(?:{_comment_single})|(?:{_comment_multiline}))\s*)*'
55
+
56
+ tokens = {
57
+ 'whitespace': [
58
+ # preprocessor directives: without whitespace
59
+ (r'^#if\s+0', Comment.Preproc, 'if0'),
60
+ ('^#', Comment.Preproc, 'macro'),
61
+ # or with whitespace
62
+ ('^(' + _ws1 + r')(#if\s+0)',
63
+ bygroups(using(this), Comment.Preproc), 'if0'),
64
+ ('^(' + _ws1 + ')(#)',
65
+ bygroups(using(this), Comment.Preproc), 'macro'),
66
+ # Labels:
67
+ # Line start and possible indentation.
68
+ (r'(^[ \t]*)'
69
+ # Not followed by keywords which can be mistaken as labels.
70
+ r'(?!(?:public|private|protected|default)\b)'
71
+ # Actual label, followed by a single colon.
72
+ r'(' + _ident + r')(\s*)(:)(?!:)',
73
+ bygroups(Whitespace, Name.Label, Whitespace, Punctuation)),
74
+ (r'\n', Whitespace),
75
+ (r'[^\S\n]+', Whitespace),
76
+ (r'\\\n', Text), # line continuation
77
+ (_comment_single, Comment.Single),
78
+ (_comment_multiline, Comment.Multiline),
79
+ # Open until EOF, so no ending delimiter
80
+ (r'/(\\\n)?[*][\w\W]*', Comment.Multiline),
81
+ ],
82
+ 'statements': [
83
+ include('keywords'),
84
+ include('types'),
85
+ (r'([LuU]|u8)?(")', bygroups(String.Affix, String), 'string'),
86
+ (r"([LuU]|u8)?(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')",
87
+ bygroups(String.Affix, String.Char, String.Char, String.Char)),
88
+
89
+ # Hexadecimal floating-point literals (C11, C++17)
90
+ (r'0[xX](' + _hexpart + r'\.' + _hexpart + r'|\.' + _hexpart +
91
+ r'|' + _hexpart + r')[pP][+-]?' + _hexpart + r'[lL]?', Number.Float),
92
+
93
+ (r'(-)?(' + _decpart + r'\.' + _decpart + r'|\.' + _decpart + r'|' +
94
+ _decpart + r')[eE][+-]?' + _decpart + r'[fFlL]?', Number.Float),
95
+ (r'(-)?((' + _decpart + r'\.(' + _decpart + r')?|\.' +
96
+ _decpart + r')[fFlL]?)|(' + _decpart + r'[fFlL])', Number.Float),
97
+ (r'(-)?0[xX]' + _hexpart + _intsuffix, Number.Hex),
98
+ (r'(-)?0[bB][01](\'?[01])*' + _intsuffix, Number.Bin),
99
+ (r'(-)?0(\'?[0-7])+' + _intsuffix, Number.Oct),
100
+ (r'(-)?' + _decpart + _intsuffix, Number.Integer),
101
+ (r'[~!%^&*+=|?:<>/-]', Operator),
102
+ (r'[()\[\],.]', Punctuation),
103
+ (r'(true|false|NULL|nullptr)\b', Name.Builtin),
104
+ (_ident, Name)
105
+ ],
106
+ 'types': [
107
+ (words(('int8', 'int16', 'int32', 'int64', 'wchar_t'), prefix=r'__',
108
+ suffix=r'\b'), Keyword.Reserved),
109
+ (words(('bool', 'int', 'long', 'float', 'short', 'double', 'char',
110
+ 'unsigned', 'signed', 'void', '_BitInt',
111
+ '__int128'), suffix=r'\b'), Keyword.Type)
112
+ ],
113
+ 'keywords': [
114
+ (r'(struct|union)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
115
+ (r'case\b', Keyword, 'case-value'),
116
+ (words(('asm', 'auto', 'break', 'const', 'constexpr', 'continue', 'default',
117
+ 'do', 'else', 'enum', 'extern', 'for', 'goto', 'if', 'register',
118
+ 'restricted', 'return', 'sizeof', 'struct', 'static', 'switch',
119
+ 'typedef', 'typeof', 'typeof_unqual', 'volatile', 'while', 'union',
120
+ 'thread_local', 'alignas', 'alignof', 'static_assert', '_Pragma', 'fortran'),
121
+ suffix=r'\b'), Keyword),
122
+ (words(('inline', '_inline', '__inline', 'naked', 'restrict',
123
+ 'thread'), suffix=r'\b'), Keyword.Reserved),
124
+ # Vector intrinsics
125
+ (r'(__m(128i|128d|128|64))\b', Keyword.Reserved),
126
+ # Microsoft-isms
127
+ (words((
128
+ 'asm', 'based', 'except', 'stdcall', 'cdecl',
129
+ 'fastcall', 'declspec', 'finally', 'try',
130
+ 'leave', 'w64', 'unaligned', 'raise', 'noop',
131
+ 'identifier', 'forceinline', 'assume', 'null'),
132
+ prefix=r'__', suffix=r'\b'), Keyword.Reserved)
133
+ ],
134
+ 'root': [
135
+ include('whitespace'),
136
+ include('keywords'),
137
+ # functions
138
+ (r'(' + _namespaced_ident + r'(?:[&*\s])+)' # return arguments
139
+ r'(' + _possible_comments + r')'
140
+ r'(' + _namespaced_ident + r')' # method name
141
+ r'(' + _possible_comments + r')'
142
+ r'(\([^;"\')]*?\))' # signature
143
+ r'(' + _possible_comments + r')'
144
+ r'([^;{/"\']*)(\{)',
145
+ bygroups(using(this), using(this, state='whitespace'),
146
+ Name.Function, using(this, state='whitespace'),
147
+ using(this), using(this, state='whitespace'),
148
+ using(this), Punctuation),
149
+ 'function'),
150
+ # function declarations
151
+ (r'(' + _namespaced_ident + r'(?:[&*\s])+)' # return arguments
152
+ r'(' + _possible_comments + r')'
153
+ r'(' + _namespaced_ident + r')' # method name
154
+ r'(' + _possible_comments + r')'
155
+ r'(\([^;"\')]*?\))' # signature
156
+ r'(' + _possible_comments + r')'
157
+ r'([^;/"\']*)(;)',
158
+ bygroups(using(this), using(this, state='whitespace'),
159
+ Name.Function, using(this, state='whitespace'),
160
+ using(this), using(this, state='whitespace'),
161
+ using(this), Punctuation)),
162
+ include('types'),
163
+ default('statement'),
164
+ ],
165
+ 'statement': [
166
+ include('whitespace'),
167
+ include('statements'),
168
+ (r'\}', Punctuation),
169
+ (r'[{;]', Punctuation, '#pop'),
170
+ ],
171
+ 'function': [
172
+ include('whitespace'),
173
+ include('statements'),
174
+ (';', Punctuation),
175
+ (r'\{', Punctuation, '#push'),
176
+ (r'\}', Punctuation, '#pop'),
177
+ ],
178
+ 'string': [
179
+ (r'"', String, '#pop'),
180
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|'
181
+ r'u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})', String.Escape),
182
+ (r'[^\\"\n]+', String), # all other characters
183
+ (r'\\\n', String), # line continuation
184
+ (r'\\', String), # stray backslash
185
+ ],
186
+ 'macro': [
187
+ (r'('+_ws1+r')(include)('+_ws1+r')("[^"]+")([^\n]*)',
188
+ bygroups(using(this), Comment.Preproc, using(this),
189
+ Comment.PreprocFile, Comment.Single)),
190
+ (r'('+_ws1+r')(include)('+_ws1+r')(<[^>]+>)([^\n]*)',
191
+ bygroups(using(this), Comment.Preproc, using(this),
192
+ Comment.PreprocFile, Comment.Single)),
193
+ (r'[^/\n]+', Comment.Preproc),
194
+ (r'/[*](.|\n)*?[*]/', Comment.Multiline),
195
+ (r'//.*?\n', Comment.Single, '#pop'),
196
+ (r'/', Comment.Preproc),
197
+ (r'(?<=\\)\n', Comment.Preproc),
198
+ (r'\n', Comment.Preproc, '#pop'),
199
+ ],
200
+ 'if0': [
201
+ (r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
202
+ (r'^\s*#el(?:se|if).*\n', Comment.Preproc, '#pop'),
203
+ (r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
204
+ (r'.*?\n', Comment),
205
+ ],
206
+ 'classname': [
207
+ (_ident, Name.Class, '#pop'),
208
+ # template specification
209
+ (r'\s*(?=>)', Text, '#pop'),
210
+ default('#pop')
211
+ ],
212
+ # Mark identifiers preceded by `case` keyword as constants.
213
+ 'case-value': [
214
+ (r'(?<!:)(:)(?!:)', Punctuation, '#pop'),
215
+ (_ident, Name.Constant),
216
+ include('whitespace'),
217
+ include('statements'),
218
+ ]
219
+ }
220
+
221
+ stdlib_types = {
222
+ 'size_t', 'ssize_t', 'off_t', 'wchar_t', 'ptrdiff_t', 'sig_atomic_t', 'fpos_t',
223
+ 'clock_t', 'time_t', 'va_list', 'jmp_buf', 'FILE', 'DIR', 'div_t', 'ldiv_t',
224
+ 'mbstate_t', 'wctrans_t', 'wint_t', 'wctype_t'}
225
+ c99_types = {
226
+ 'int8_t', 'int16_t', 'int32_t', 'int64_t', 'uint8_t',
227
+ 'uint16_t', 'uint32_t', 'uint64_t', 'int_least8_t', 'int_least16_t',
228
+ 'int_least32_t', 'int_least64_t', 'uint_least8_t', 'uint_least16_t',
229
+ 'uint_least32_t', 'uint_least64_t', 'int_fast8_t', 'int_fast16_t', 'int_fast32_t',
230
+ 'int_fast64_t', 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t',
231
+ 'intptr_t', 'uintptr_t', 'intmax_t', 'uintmax_t'}
232
+ linux_types = {
233
+ 'clockid_t', 'cpu_set_t', 'cpumask_t', 'dev_t', 'gid_t', 'id_t', 'ino_t', 'key_t',
234
+ 'mode_t', 'nfds_t', 'pid_t', 'rlim_t', 'sig_t', 'sighandler_t', 'siginfo_t',
235
+ 'sigset_t', 'sigval_t', 'socklen_t', 'timer_t', 'uid_t'}
236
+ c11_atomic_types = {
237
+ 'atomic_bool', 'atomic_char', 'atomic_schar', 'atomic_uchar', 'atomic_short',
238
+ 'atomic_ushort', 'atomic_int', 'atomic_uint', 'atomic_long', 'atomic_ulong',
239
+ 'atomic_llong', 'atomic_ullong', 'atomic_char16_t', 'atomic_char32_t', 'atomic_wchar_t',
240
+ 'atomic_int_least8_t', 'atomic_uint_least8_t', 'atomic_int_least16_t',
241
+ 'atomic_uint_least16_t', 'atomic_int_least32_t', 'atomic_uint_least32_t',
242
+ 'atomic_int_least64_t', 'atomic_uint_least64_t', 'atomic_int_fast8_t',
243
+ 'atomic_uint_fast8_t', 'atomic_int_fast16_t', 'atomic_uint_fast16_t',
244
+ 'atomic_int_fast32_t', 'atomic_uint_fast32_t', 'atomic_int_fast64_t',
245
+ 'atomic_uint_fast64_t', 'atomic_intptr_t', 'atomic_uintptr_t', 'atomic_size_t',
246
+ 'atomic_ptrdiff_t', 'atomic_intmax_t', 'atomic_uintmax_t'}
247
+
248
+ def __init__(self, **options):
249
+ self.stdlibhighlighting = get_bool_opt(options, 'stdlibhighlighting', True)
250
+ self.c99highlighting = get_bool_opt(options, 'c99highlighting', True)
251
+ self.c11highlighting = get_bool_opt(options, 'c11highlighting', True)
252
+ self.platformhighlighting = get_bool_opt(options, 'platformhighlighting', True)
253
+ RegexLexer.__init__(self, **options)
254
+
255
+ def get_tokens_unprocessed(self, text, stack=('root',)):
256
+ for index, token, value in \
257
+ RegexLexer.get_tokens_unprocessed(self, text, stack):
258
+ if token is Name:
259
+ if self.stdlibhighlighting and value in self.stdlib_types:
260
+ token = Keyword.Type
261
+ elif self.c99highlighting and value in self.c99_types:
262
+ token = Keyword.Type
263
+ elif self.c11highlighting and value in self.c11_atomic_types:
264
+ token = Keyword.Type
265
+ elif self.platformhighlighting and value in self.linux_types:
266
+ token = Keyword.Type
267
+ yield index, token, value
268
+
269
+
270
+ class CLexer(CFamilyLexer):
271
+ """
272
+ For C source code with preprocessor directives.
273
+
274
+ Additional options accepted:
275
+
276
+ `stdlibhighlighting`
277
+ Highlight common types found in the C/C++ standard library (e.g. `size_t`).
278
+ (default: ``True``).
279
+
280
+ `c99highlighting`
281
+ Highlight common types found in the C99 standard library (e.g. `int8_t`).
282
+ Actually, this includes all fixed-width integer types.
283
+ (default: ``True``).
284
+
285
+ `c11highlighting`
286
+ Highlight atomic types found in the C11 standard library (e.g. `atomic_bool`).
287
+ (default: ``True``).
288
+
289
+ `platformhighlighting`
290
+ Highlight common types found in the platform SDK headers (e.g. `clockid_t` on Linux).
291
+ (default: ``True``).
292
+ """
293
+ name = 'C'
294
+ aliases = ['c']
295
+ filenames = ['*.c', '*.h', '*.idc', '*.x[bp]m']
296
+ mimetypes = ['text/x-chdr', 'text/x-csrc', 'image/x-xbitmap', 'image/x-xpixmap']
297
+ url = 'https://en.wikipedia.org/wiki/C_(programming_language)'
298
+ version_added = ''
299
+ priority = 0.1
300
+
301
+ tokens = {
302
+ 'keywords': [
303
+ (words((
304
+ '_Alignas', '_Alignof', '_Noreturn', '_Countof', '_Generic', '_Thread_local',
305
+ '_Static_assert', '_Imaginary', 'countof', 'noreturn', 'imaginary', 'complex'),
306
+ suffix=r'\b'), Keyword),
307
+ inherit
308
+ ],
309
+ 'types': [
310
+ (words(('_Bool', '_Complex', '_Atomic', '_Decimal32', '_Decimal64', '_Decimal128'), suffix=r'\b'), Keyword.Type),
311
+ inherit
312
+ ]
313
+ }
314
+
315
+ def analyse_text(text):
316
+ if re.search(r'^\s*#include [<"]', text, re.MULTILINE):
317
+ return 0.1
318
+ if re.search(r'^\s*#ifn?def ', text, re.MULTILINE):
319
+ return 0.1
320
+
321
+
322
+ class CppLexer(CFamilyLexer):
323
+ """
324
+ For C++ source code with preprocessor directives.
325
+
326
+ Additional options accepted:
327
+
328
+ `stdlibhighlighting`
329
+ Highlight common types found in the C/C++ standard library (e.g. `size_t`).
330
+ (default: ``True``).
331
+
332
+ `c99highlighting`
333
+ Highlight common types found in the C99 standard library (e.g. `int8_t`).
334
+ Actually, this includes all fixed-width integer types.
335
+ (default: ``True``).
336
+
337
+ `c11highlighting`
338
+ Highlight atomic types found in the C11 standard library (e.g. `atomic_bool`).
339
+ (default: ``True``).
340
+
341
+ `platformhighlighting`
342
+ Highlight common types found in the platform SDK headers (e.g. `clockid_t` on Linux).
343
+ (default: ``True``).
344
+ """
345
+ name = 'C++'
346
+ url = 'https://isocpp.org/'
347
+ aliases = ['cpp', 'c++']
348
+ filenames = ['*.cpp', '*.hpp', '*.c++', '*.h++',
349
+ '*.cc', '*.hh', '*.cxx', '*.hxx',
350
+ '*.C', '*.H', '*.cp', '*.CPP', '*.tpp',
351
+ '*.cppm', '*.ixx', '*.mxx']
352
+ mimetypes = ['text/x-c++hdr', 'text/x-c++src']
353
+ version_added = ''
354
+ priority = 0.1
355
+
356
+ tokens = {
357
+ 'statements': [
358
+ # C++11 raw strings
359
+ (r'((?:[LuU]|u8)?R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)(")',
360
+ bygroups(String.Affix, String, String.Delimiter, String.Delimiter,
361
+ String, String.Delimiter, String)),
362
+ inherit,
363
+ ],
364
+ 'root': [
365
+ inherit,
366
+ # C++ Microsoft-isms
367
+ (words(('virtual_inheritance', 'uuidof', 'super', 'extends', 'single_inheritance',
368
+ 'multiple_inheritance', 'interface', 'implements', 'event', 'finally', 'null'),
369
+ prefix=r'__', suffix=r'\b'), Keyword.Reserved),
370
+ # Offload C++ extensions, http://offload.codeplay.com/
371
+ (r'__(offload|blockingoffload|outer)\b', Keyword.Pseudo),
372
+ ],
373
+ 'enumname': [
374
+ include('whitespace'),
375
+ # 'enum class' and 'enum struct' C++11 support
376
+ (words(('class', 'struct'), suffix=r'\b'), Keyword),
377
+ (CFamilyLexer._ident, Name.Class, '#pop'),
378
+ # template specification
379
+ (r'\s*(?=>)', Text, '#pop'),
380
+ default('#pop')
381
+ ],
382
+ 'keywords': [
383
+ (r'(class|concept|typename)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
384
+ (words((
385
+ 'catch', 'const_cast', 'delete', 'dynamic_cast', 'explicit',
386
+ 'export', 'friend', 'mutable', 'new', 'operator',
387
+ 'private', 'protected', 'public', 'reinterpret_cast', 'class',
388
+ '__restrict', 'static_cast', 'template', 'this', 'throw', 'throws',
389
+ 'try', 'typeid', 'using', 'virtual', 'concept',
390
+ 'decltype', 'noexcept', 'override', 'final', 'constinit', 'consteval',
391
+ 'co_await', 'co_return', 'co_yield', 'requires', 'import', 'module',
392
+ 'typename', 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not',
393
+ 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq', 'contract_assert', 'pre', 'post'),
394
+ suffix=r'\b'), Keyword),
395
+ (r'namespace\b', Keyword, 'namespace'),
396
+ (r'(enum)(\s+)', bygroups(Keyword, Whitespace), 'enumname'),
397
+ inherit
398
+ ],
399
+ 'types': [
400
+ (r'char(16_t|32_t|8_t)\b', Keyword.Type),
401
+ inherit
402
+ ],
403
+ 'namespace': [
404
+ (r'[;{]', Punctuation, ('#pop', 'root')),
405
+ (r'inline\b', Keyword.Reserved),
406
+ (CFamilyLexer._ident, Name.Namespace),
407
+ include('statement')
408
+ ]
409
+ }
410
+
411
+ def analyse_text(text):
412
+ if re.search('#include <[a-z_]+>', text):
413
+ return 0.2
414
+ if re.search('using namespace ', text):
415
+ return 0.4
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/carbon.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.carbon
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Carbon programming language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+ import re
11
+
12
+ from pygments.lexer import RegexLexer, words
13
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
14
+ Number, Punctuation, Whitespace
15
+
16
+ __all__ = ['CarbonLexer']
17
+
18
+
19
+ class CarbonLexer(RegexLexer):
20
+ """
21
+ For Carbon source.
22
+ """
23
+ name = 'Carbon'
24
+ url = 'https://github.com/carbon-language/carbon-lang'
25
+ filenames = ['*.carbon']
26
+ aliases = ['carbon']
27
+ mimetypes = ['text/x-carbon']
28
+ version_added = '2.15'
29
+
30
+ flags = re.MULTILINE | re.DOTALL
31
+
32
+ tokens = {
33
+ 'root': [
34
+ (r'\n', Whitespace),
35
+ (r'\s+', Whitespace),
36
+ (r'\\\n', Text),
37
+ # comments
38
+ (r'//(.*?)\n', Comment.Single),
39
+ (r'/(\\\n)?[*].*?[*](\\\n)?/', Comment.Multiline),
40
+ # Declaration
41
+ (r'(package|import|api|namespace|library)\b', Keyword.Namespace),
42
+ (r'(abstract|alias|fn|class|interface|let|var|virtual|external|'
43
+ r'base|addr|extends|choice|constraint|impl)\b', Keyword.Declaration),
44
+ # Keywords
45
+ (words(('as', 'or', 'not', 'and', 'break', 'continue', 'case',
46
+ 'default', 'if', 'else', 'destructor', 'for', 'forall',
47
+ 'while', 'where', 'then', 'in', 'is', 'return', 'returned',
48
+ 'friend', 'partial', 'private', 'protected', 'observe', 'Self',
49
+ 'override', 'final', 'match', 'type', 'like'), suffix=r'\b'), Keyword),
50
+ (r'(self)\b', Keyword.Pseudo),
51
+ (r'(true|false)\b', Keyword.Constant),
52
+ (r'(auto|bool|string|i8|i16|i32|i64|u8|u16|u32|u64|'
53
+ r'f8|f16|f32|f64)\b', Keyword.Type),
54
+ # numeric literals
55
+ (r'[0-9]*[.][0-9]+', Number.Double),
56
+ (r'0b[01]+', Number.Bin),
57
+ (r'0o[0-7]+', Number.Oct),
58
+ (r'0x[0-9a-fA-F]+', Number.Hex),
59
+ (r'[0-9]+', Number.Integer),
60
+ # string literal
61
+ (r'"(\\.|[^"\\])*"', String),
62
+ # char literal
63
+ (r'\'(\\.|[^\'\\])\'', String.Char),
64
+ # tokens
65
+ (r'<<=|>>=|<<|>>|<=|>=|\+=|-=|\*=|/=|\%=|\|=|&=|\^=|&&|\|\||&|\||'
66
+ r'\+\+|--|\%|\^|\~|==|!=|::|[.]{3}|->|=>|[+\-*/&]', Operator),
67
+ (r'[|<>=!()\[\]{}.,;:\?]', Punctuation),
68
+ # identifiers
69
+ (r'[^\W\d]\w*', Name.Other),
70
+ ]
71
+ }
72
+
73
+ def analyse_text(text):
74
+ result = 0
75
+ if 'forall' in text:
76
+ result += 0.1
77
+ if 'type' in text:
78
+ result += 0.1
79
+ if 'Self' in text:
80
+ result += 0.1
81
+ if 'observe' in text:
82
+ result += 0.1
83
+ if 'package' in text:
84
+ result += 0.1
85
+ if 'library' in text:
86
+ result += 0.1
87
+ if 'choice' in text:
88
+ result += 0.1
89
+ if 'addr' in text:
90
+ result += 0.1
91
+ if 'constraint' in text:
92
+ result += 0.1
93
+ if 'impl' in text:
94
+ result += 0.1
95
+ return result
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/diff.py ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.diff
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for diff/patch formats.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, Generic, \
15
+ Literal, Whitespace
16
+
17
+ __all__ = ['DiffLexer', 'DarcsPatchLexer', 'WDiffLexer']
18
+
19
+
20
+ class DiffLexer(RegexLexer):
21
+ """
22
+ Lexer for unified or context-style diffs or patches.
23
+ """
24
+
25
+ name = 'Diff'
26
+ aliases = ['diff', 'udiff']
27
+ filenames = ['*.diff', '*.patch']
28
+ mimetypes = ['text/x-diff', 'text/x-patch']
29
+ url = 'https://en.wikipedia.org/wiki/Diff'
30
+ version_added = ''
31
+
32
+ tokens = {
33
+ 'root': [
34
+ (r'( )(.*)(\n)', bygroups(Whitespace, Text, Whitespace)),
35
+ (r'(!.*|---)(\n)', bygroups(Generic.Strong, Whitespace)),
36
+ (r'((?:< |-).*)(\n)', bygroups(Generic.Deleted, Whitespace)),
37
+ (r'((?:> |\+).*)(\n)', bygroups(Generic.Inserted, Whitespace)),
38
+ (
39
+ r'(@.*|\d(?:,\d+)?(?:a|c|d)\d+(?:,\d+)?)(\n)',
40
+ bygroups(Generic.Subheading, Whitespace),
41
+ ),
42
+ (r'((?:[Ii]ndex|diff).*)(\n)', bygroups(Generic.Heading, Whitespace)),
43
+ (r'(=.*)(\n)', bygroups(Generic.Heading, Whitespace)),
44
+ (r'(.*)(\n)', bygroups(Text, Whitespace)),
45
+ ]
46
+ }
47
+
48
+ def analyse_text(text):
49
+ if text[:7] == 'Index: ':
50
+ return True
51
+ if text[:5] == 'diff ':
52
+ return True
53
+ if text[:4] == '--- ':
54
+ return 0.9
55
+
56
+
57
+ class DarcsPatchLexer(RegexLexer):
58
+ """
59
+ DarcsPatchLexer is a lexer for the various versions of the darcs patch
60
+ format. Examples of this format are derived by commands such as
61
+ ``darcs annotate --patch`` and ``darcs send``.
62
+ """
63
+
64
+ name = 'Darcs Patch'
65
+ aliases = ['dpatch']
66
+ filenames = ['*.dpatch', '*.darcspatch']
67
+ url = 'https://darcs.net'
68
+ version_added = '0.10'
69
+
70
+ DPATCH_KEYWORDS = ('hunk', 'addfile', 'adddir', 'rmfile', 'rmdir', 'move',
71
+ 'replace')
72
+
73
+ tokens = {
74
+ 'root': [
75
+ (r'<', Operator),
76
+ (r'>', Operator),
77
+ (r'\{', Operator),
78
+ (r'\}', Operator),
79
+ (r'(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)(\])',
80
+ bygroups(Operator, Keyword, Name, Whitespace, Name, Operator,
81
+ Literal.Date, Whitespace, Operator)),
82
+ (r'(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)',
83
+ bygroups(Operator, Keyword, Name, Whitespace, Name, Operator,
84
+ Literal.Date, Whitespace), 'comment'),
85
+ (r'New patches:', Generic.Heading),
86
+ (r'Context:', Generic.Heading),
87
+ (r'Patch bundle hash:', Generic.Heading),
88
+ (r'(\s*)({})(.*)(\n)'.format('|'.join(DPATCH_KEYWORDS)),
89
+ bygroups(Whitespace, Keyword, Text, Whitespace)),
90
+ (r'\+', Generic.Inserted, "insert"),
91
+ (r'-', Generic.Deleted, "delete"),
92
+ (r'(.*)(\n)', bygroups(Text, Whitespace)),
93
+ ],
94
+ 'comment': [
95
+ (r'[^\]].*\n', Comment),
96
+ (r'\]', Operator, "#pop"),
97
+ ],
98
+ 'specialText': [ # darcs add [_CODE_] special operators for clarity
99
+ (r'\n', Whitespace, "#pop"), # line-based
100
+ (r'\[_[^_]*_]', Operator),
101
+ ],
102
+ 'insert': [
103
+ include('specialText'),
104
+ (r'\[', Generic.Inserted),
105
+ (r'[^\n\[]+', Generic.Inserted),
106
+ ],
107
+ 'delete': [
108
+ include('specialText'),
109
+ (r'\[', Generic.Deleted),
110
+ (r'[^\n\[]+', Generic.Deleted),
111
+ ],
112
+ }
113
+
114
+
115
+ class WDiffLexer(RegexLexer):
116
+ """
117
+ A wdiff lexer.
118
+
119
+ Note that:
120
+
121
+ * It only works with normal output (without options like ``-l``).
122
+ * If the target files contain "[-", "-]", "{+", or "+}",
123
+ especially they are unbalanced, the lexer will get confused.
124
+ """
125
+
126
+ name = 'WDiff'
127
+ url = 'https://www.gnu.org/software/wdiff/'
128
+ aliases = ['wdiff']
129
+ filenames = ['*.wdiff']
130
+ mimetypes = []
131
+ version_added = '2.2'
132
+
133
+ flags = re.MULTILINE | re.DOTALL
134
+
135
+ # We can only assume "[-" after "[-" before "-]" is `nested`,
136
+ # for instance wdiff to wdiff outputs. We have no way to
137
+ # distinct these marker is of wdiff output from original text.
138
+
139
+ ins_op = r"\{\+"
140
+ ins_cl = r"\+\}"
141
+ del_op = r"\[\-"
142
+ del_cl = r"\-\]"
143
+ normal = r'[^{}[\]+-]+' # for performance
144
+ tokens = {
145
+ 'root': [
146
+ (ins_op, Generic.Inserted, 'inserted'),
147
+ (del_op, Generic.Deleted, 'deleted'),
148
+ (normal, Text),
149
+ (r'.', Text),
150
+ ],
151
+ 'inserted': [
152
+ (ins_op, Generic.Inserted, '#push'),
153
+ (del_op, Generic.Inserted, '#push'),
154
+ (del_cl, Generic.Inserted, '#pop'),
155
+
156
+ (ins_cl, Generic.Inserted, '#pop'),
157
+ (normal, Generic.Inserted),
158
+ (r'.', Generic.Inserted),
159
+ ],
160
+ 'deleted': [
161
+ (del_op, Generic.Deleted, '#push'),
162
+ (ins_op, Generic.Deleted, '#push'),
163
+ (ins_cl, Generic.Deleted, '#pop'),
164
+
165
+ (del_cl, Generic.Deleted, '#pop'),
166
+ (normal, Generic.Deleted),
167
+ (r'.', Generic.Deleted),
168
+ ],
169
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/dotnet.py ADDED
@@ -0,0 +1,873 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.dotnet
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for .net languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+ import re
11
+
12
+ from pygments.lexer import RegexLexer, DelegatingLexer, bygroups, include, \
13
+ using, this, default, words
14
+ from pygments.token import Punctuation, Text, Comment, Operator, Keyword, \
15
+ Name, String, Number, Literal, Other, Whitespace
16
+ from pygments.util import get_choice_opt
17
+ from pygments import unistring as uni
18
+
19
+ from pygments.lexers.html import XmlLexer
20
+
21
+ __all__ = ['CSharpLexer', 'NemerleLexer', 'BooLexer', 'VbNetLexer',
22
+ 'CSharpAspxLexer', 'VbNetAspxLexer', 'FSharpLexer', 'XppLexer']
23
+
24
+
25
+ class CSharpLexer(RegexLexer):
26
+ """
27
+ For C# source code.
28
+
29
+ Additional options accepted:
30
+
31
+ `unicodelevel`
32
+ Determines which Unicode characters this lexer allows for identifiers.
33
+ The possible values are:
34
+
35
+ * ``none`` -- only the ASCII letters and numbers are allowed. This
36
+ is the fastest selection.
37
+ * ``basic`` -- all Unicode characters from the specification except
38
+ category ``Lo`` are allowed.
39
+ * ``full`` -- all Unicode characters as specified in the C# specs
40
+ are allowed. Note that this means a considerable slowdown since the
41
+ ``Lo`` category has more than 40,000 characters in it!
42
+
43
+ The default value is ``basic``.
44
+
45
+ .. versionadded:: 0.8
46
+ """
47
+
48
+ name = 'C#'
49
+ url = 'https://docs.microsoft.com/en-us/dotnet/csharp/'
50
+ aliases = ['csharp', 'c#', 'cs']
51
+ filenames = ['*.cs']
52
+ mimetypes = ['text/x-csharp'] # inferred
53
+ version_added = ''
54
+
55
+ flags = re.MULTILINE | re.DOTALL
56
+
57
+ # for the range of allowed unicode characters in identifiers, see
58
+ # http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
59
+
60
+ levels = {
61
+ 'none': r'@?[_a-zA-Z]\w*',
62
+ 'basic': ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
63
+ '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc',
64
+ 'Cf', 'Mn', 'Mc') + ']*'),
65
+ 'full': ('@?(?:_|[^' +
66
+ uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])' +
67
+ '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
68
+ 'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'),
69
+ }
70
+
71
+ tokens = {}
72
+ token_variants = True
73
+
74
+ for levelname, cs_ident in levels.items():
75
+ tokens[levelname] = {
76
+ 'root': [
77
+ include('numbers'),
78
+ # method names
79
+ (r'^([ \t]*)((?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type
80
+ r'(' + cs_ident + ')' # method name
81
+ r'(\s*)(\()', # signature start
82
+ bygroups(Whitespace, using(this), Name.Function, Whitespace,
83
+ Punctuation)),
84
+ (r'^(\s*)(\[.*?\])', bygroups(Whitespace, Name.Attribute)),
85
+ (r'[^\S\n]+', Whitespace),
86
+ (r'(\\)(\n)', bygroups(Text, Whitespace)), # line continuation
87
+ (r'//.*?\n', Comment.Single),
88
+ (r'/[*].*?[*]/', Comment.Multiline),
89
+ (r'\n', Whitespace),
90
+ (words((
91
+ '>>>=', '>>=', '<<=', '<=', '>=', '+=', '-=', '*=', '/=',
92
+ '%=', '&=', '|=', '^=', '??=', '=>', '??', '?.', '!=', '==',
93
+ '&&', '||', '>>>', '>>', '<<', '++', '--', '+', '-', '*',
94
+ '/', '%', '&', '|', '^', '<', '>', '?', '!', '~', '=',
95
+ )), Operator),
96
+ (r'=~|!=|==|<<|>>|[-+/*%=<>&^|]', Operator),
97
+ (r'[()\[\];:,.]', Punctuation),
98
+ (r'[{}]', Punctuation),
99
+ (r'@"(""|[^"])*"', String),
100
+ (r'\$?"(\\\\|\\[^\\]|[^"\\\n])*["\n]', String),
101
+ (r"'\\.'|'[^\\]'", String.Char),
102
+ (r"[0-9]+(\.[0-9]*)?([eE][+-][0-9]+)?"
103
+ r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number),
104
+ (r'(#)([ \t]*)(if|endif|else|elif|define|undef|'
105
+ r'line|error|warning|region|endregion|pragma)\b(.*?)(\n)',
106
+ bygroups(Comment.Preproc, Whitespace, Comment.Preproc,
107
+ Comment.Preproc, Whitespace)),
108
+ (r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Whitespace,
109
+ Keyword)),
110
+ (words((
111
+ 'abstract', 'as', 'async', 'await', 'base', 'break', 'by',
112
+ 'case', 'catch', 'checked', 'const', 'continue', 'default',
113
+ 'delegate', 'do', 'else', 'enum', 'event', 'explicit',
114
+ 'extern', 'false', 'finally', 'fixed', 'for', 'foreach',
115
+ 'goto', 'if', 'implicit', 'in', 'interface', 'internal',
116
+ 'is', 'let', 'lock', 'new', 'null', 'on', 'operator',
117
+ 'out', 'override', 'params', 'private', 'protected',
118
+ 'public', 'readonly', 'ref', 'return', 'sealed', 'sizeof',
119
+ 'stackalloc', 'static', 'switch', 'this', 'throw', 'true',
120
+ 'try', 'typeof', 'unchecked', 'unsafe', 'virtual', 'void',
121
+ 'while', 'get', 'set', 'new', 'partial', 'yield', 'add',
122
+ 'remove', 'value', 'alias', 'ascending', 'descending',
123
+ 'from', 'group', 'into', 'orderby', 'select', 'thenby',
124
+ 'where', 'join', 'equals', 'record', 'allows',
125
+ 'and', 'init', 'managed', 'nameof', 'nint', 'not',
126
+ 'notnull', 'nuint', 'or', 'scoped', 'unmanaged', 'when',
127
+ 'with'
128
+ ), suffix=r'\b'), Keyword),
129
+ # version 1: assumes that 'file' is the only contextual keyword
130
+ # that is a class modifier
131
+ (r'(file)(\s+)(record|class|abstract|enum|new|sealed|static)\b',
132
+ bygroups(Keyword, Whitespace, Keyword)),
133
+ (r'(global)(::)', bygroups(Keyword, Punctuation)),
134
+ (r'(bool|byte|char|decimal|double|dynamic|float|int|long|object|'
135
+ r'sbyte|short|string|uint|ulong|ushort|var)\b\??', Keyword.Type),
136
+ (r'(class|struct)(\s+)', bygroups(Keyword, Whitespace), 'class'),
137
+ (r'(namespace|using)(\s+)', bygroups(Keyword, Whitespace), 'namespace'),
138
+ (cs_ident, Name),
139
+ ],
140
+ 'numbers_int': [
141
+ (r"0[xX][0-9a-fA-F]+(([uU][lL]?)|[lL][uU]?)?", Number.Hex),
142
+ (r"0[bB][01]+(([uU][lL]?)|[lL][uU]?)?", Number.Bin),
143
+ (r"[0-9]+(([uU][lL]?)|[lL][uU]?)?", Number.Integer),
144
+ ],
145
+ 'numbers_float': [
146
+ (r"([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fFdDmM]?)|"
147
+ r"(\.[0-9]+([eE][+-]?[0-9]+)?[fFdDmM]?)|"
148
+ r"([0-9]+([eE][+-]?[0-9]+)[fFdDmM]?)|"
149
+ r"([0-9]+[fFdDmM])", Number.Float),
150
+ ],
151
+ 'numbers': [
152
+ include('numbers_float'),
153
+ include('numbers_int'),
154
+ ],
155
+ 'class': [
156
+ (cs_ident, Name.Class, '#pop'),
157
+ default('#pop'),
158
+ ],
159
+ 'namespace': [
160
+ (r'(?=\()', Text, '#pop'), # using (resource)
161
+ ('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop'),
162
+ ]
163
+ }
164
+
165
+ def __init__(self, **options):
166
+ level = get_choice_opt(options, 'unicodelevel', list(self.tokens), 'basic')
167
+ if level not in self._all_tokens:
168
+ # compile the regexes now
169
+ self._tokens = self.__class__.process_tokendef(level)
170
+ else:
171
+ self._tokens = self._all_tokens[level]
172
+
173
+ RegexLexer.__init__(self, **options)
174
+
175
+
176
+ class NemerleLexer(RegexLexer):
177
+ """
178
+ For Nemerle source code.
179
+
180
+ Additional options accepted:
181
+
182
+ `unicodelevel`
183
+ Determines which Unicode characters this lexer allows for identifiers.
184
+ The possible values are:
185
+
186
+ * ``none`` -- only the ASCII letters and numbers are allowed. This
187
+ is the fastest selection.
188
+ * ``basic`` -- all Unicode characters from the specification except
189
+ category ``Lo`` are allowed.
190
+ * ``full`` -- all Unicode characters as specified in the C# specs
191
+ are allowed. Note that this means a considerable slowdown since the
192
+ ``Lo`` category has more than 40,000 characters in it!
193
+
194
+ The default value is ``basic``.
195
+ """
196
+
197
+ name = 'Nemerle'
198
+ url = 'http://nemerle.org'
199
+ aliases = ['nemerle']
200
+ filenames = ['*.n']
201
+ mimetypes = ['text/x-nemerle'] # inferred
202
+ version_added = '1.5'
203
+
204
+ flags = re.MULTILINE | re.DOTALL
205
+
206
+ # for the range of allowed unicode characters in identifiers, see
207
+ # http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
208
+
209
+ levels = {
210
+ 'none': r'@?[_a-zA-Z]\w*',
211
+ 'basic': ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
212
+ '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc',
213
+ 'Cf', 'Mn', 'Mc') + ']*'),
214
+ 'full': ('@?(?:_|[^' +
215
+ uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])' +
216
+ '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
217
+ 'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'),
218
+ }
219
+
220
+ tokens = {}
221
+ token_variants = True
222
+
223
+ for levelname, cs_ident in levels.items():
224
+ tokens[levelname] = {
225
+ 'root': [
226
+ # method names
227
+ (r'^([ \t]*)((?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type
228
+ r'(' + cs_ident + ')' # method name
229
+ r'(\s*)(\()', # signature start
230
+ bygroups(Whitespace, using(this), Name.Function, Whitespace, \
231
+ Punctuation)),
232
+ (r'^(\s*)(\[.*?\])', bygroups(Whitespace, Name.Attribute)),
233
+ (r'[^\S\n]+', Whitespace),
234
+ (r'(\\)(\n)', bygroups(Text, Whitespace)), # line continuation
235
+ (r'//.*?\n', Comment.Single),
236
+ (r'/[*].*?[*]/', Comment.Multiline),
237
+ (r'\n', Whitespace),
238
+ (r'(\$)(\s*)(")', bygroups(String, Whitespace, String),
239
+ 'splice-string'),
240
+ (r'(\$)(\s*)(<#)', bygroups(String, Whitespace, String),
241
+ 'splice-string2'),
242
+ (r'<#', String, 'recursive-string'),
243
+
244
+ (r'(<\[)(\s*)(' + cs_ident + ':)?',
245
+ bygroups(Keyword, Whitespace, Keyword)),
246
+ (r'\]\>', Keyword),
247
+
248
+ # quasiquotation only
249
+ (r'\$' + cs_ident, Name),
250
+ (r'(\$)(\()', bygroups(Name, Punctuation),
251
+ 'splice-string-content'),
252
+
253
+ (r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation),
254
+ (r'[{}]', Punctuation),
255
+ (r'@"(""|[^"])*"', String),
256
+ (r'"(\\\\|\\[^\\]|[^"\\\n])*["\n]', String),
257
+ (r"'\\.'|'[^\\]'", String.Char),
258
+ (r"0[xX][0-9a-fA-F]+[Ll]?", Number),
259
+ (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFLdD]?", Number),
260
+ (r'(#)([ \t]*)(if|endif|else|elif|define|undef|'
261
+ r'line|error|warning|region|endregion|pragma)\b',
262
+ bygroups(Comment.Preproc, Whitespace, Comment.Preproc), 'preproc'),
263
+ (r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Whitespace, Keyword)),
264
+ (r'(abstract|and|as|base|catch|def|delegate|'
265
+ r'enum|event|extern|false|finally|'
266
+ r'fun|implements|interface|internal|'
267
+ r'is|macro|match|matches|module|mutable|new|'
268
+ r'null|out|override|params|partial|private|'
269
+ r'protected|public|ref|sealed|static|'
270
+ r'syntax|this|throw|true|try|type|typeof|'
271
+ r'virtual|volatile|when|where|with|'
272
+ r'assert|assert2|async|break|checked|continue|do|else|'
273
+ r'ensures|for|foreach|if|late|lock|new|nolate|'
274
+ r'otherwise|regexp|repeat|requires|return|surroundwith|'
275
+ r'unchecked|unless|using|while|yield)\b', Keyword),
276
+ (r'(global)(::)', bygroups(Keyword, Punctuation)),
277
+ (r'(bool|byte|char|decimal|double|float|int|long|object|sbyte|'
278
+ r'short|string|uint|ulong|ushort|void|array|list)\b\??',
279
+ Keyword.Type),
280
+ (r'(:>?)(\s*)(' + cs_ident + r'\??)',
281
+ bygroups(Punctuation, Whitespace, Keyword.Type)),
282
+ (r'(class|struct|variant|module)(\s+)',
283
+ bygroups(Keyword, Whitespace), 'class'),
284
+ (r'(namespace|using)(\s+)', bygroups(Keyword, Whitespace),
285
+ 'namespace'),
286
+ (cs_ident, Name),
287
+ ],
288
+ 'class': [
289
+ (cs_ident, Name.Class, '#pop')
290
+ ],
291
+ 'preproc': [
292
+ (r'\w+', Comment.Preproc),
293
+ (r'[ \t]+', Whitespace),
294
+ (r'\n', Whitespace, '#pop')
295
+ ],
296
+ 'namespace': [
297
+ (r'(?=\()', Text, '#pop'), # using (resource)
298
+ ('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop')
299
+ ],
300
+ 'splice-string': [
301
+ (r'[^"$]', String),
302
+ (r'\$' + cs_ident, Name),
303
+ (r'(\$)(\()', bygroups(Name, Punctuation),
304
+ 'splice-string-content'),
305
+ (r'\\"', String),
306
+ (r'"', String, '#pop')
307
+ ],
308
+ 'splice-string2': [
309
+ (r'[^#<>$]', String),
310
+ (r'\$' + cs_ident, Name),
311
+ (r'(\$)(\()', bygroups(Name, Punctuation),
312
+ 'splice-string-content'),
313
+ (r'<#', String, '#push'),
314
+ (r'#>', String, '#pop')
315
+ ],
316
+ 'recursive-string': [
317
+ (r'[^#<>]', String),
318
+ (r'<#', String, '#push'),
319
+ (r'#>', String, '#pop')
320
+ ],
321
+ 'splice-string-content': [
322
+ (r'if|match', Keyword),
323
+ (r'[~!%^&*+=|\[\]:;,.<>/?-\\"$ ]', Punctuation),
324
+ (cs_ident, Name),
325
+ (r'\d+', Number),
326
+ (r'\(', Punctuation, '#push'),
327
+ (r'\)', Punctuation, '#pop')
328
+ ]
329
+ }
330
+
331
+ def __init__(self, **options):
332
+ level = get_choice_opt(options, 'unicodelevel', list(self.tokens),
333
+ 'basic')
334
+ if level not in self._all_tokens:
335
+ # compile the regexes now
336
+ self._tokens = self.__class__.process_tokendef(level)
337
+ else:
338
+ self._tokens = self._all_tokens[level]
339
+
340
+ RegexLexer.__init__(self, **options)
341
+
342
+ def analyse_text(text):
343
+ """Nemerle is quite similar to Python, but @if is relatively uncommon
344
+ elsewhere."""
345
+ result = 0
346
+
347
+ if '@if' in text:
348
+ result += 0.1
349
+
350
+ return result
351
+
352
+
353
+ class BooLexer(RegexLexer):
354
+ """
355
+ For Boo source code.
356
+ """
357
+
358
+ name = 'Boo'
359
+ url = 'https://github.com/boo-lang/boo'
360
+ aliases = ['boo']
361
+ filenames = ['*.boo']
362
+ mimetypes = ['text/x-boo']
363
+ version_added = ''
364
+
365
+ tokens = {
366
+ 'root': [
367
+ (r'\s+', Whitespace),
368
+ (r'(#|//).*$', Comment.Single),
369
+ (r'/[*]', Comment.Multiline, 'comment'),
370
+ (r'[]{}:(),.;[]', Punctuation),
371
+ (r'(\\)(\n)', bygroups(Text, Whitespace)),
372
+ (r'\\', Text),
373
+ (r'(in|is|and|or|not)\b', Operator.Word),
374
+ (r'/(\\\\|\\[^\\]|[^/\\\s])/', String.Regex),
375
+ (r'@/(\\\\|\\[^\\]|[^/\\])*/', String.Regex),
376
+ (r'=~|!=|==|<<|>>|[-+/*%=<>&^|]', Operator),
377
+ (r'(as|abstract|callable|constructor|destructor|do|import|'
378
+ r'enum|event|final|get|interface|internal|of|override|'
379
+ r'partial|private|protected|public|return|set|static|'
380
+ r'struct|transient|virtual|yield|super|and|break|cast|'
381
+ r'continue|elif|else|ensure|except|for|given|goto|if|in|'
382
+ r'is|isa|not|or|otherwise|pass|raise|ref|try|unless|when|'
383
+ r'while|from|as)\b', Keyword),
384
+ (r'def(?=\s+\(.*?\))', Keyword),
385
+ (r'(def)(\s+)', bygroups(Keyword, Whitespace), 'funcname'),
386
+ (r'(class)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
387
+ (r'(namespace)(\s+)', bygroups(Keyword, Whitespace), 'namespace'),
388
+ (r'(?<!\.)(true|false|null|self|__eval__|__switch__|array|'
389
+ r'assert|checked|enumerate|filter|getter|len|lock|map|'
390
+ r'matrix|max|min|normalArrayIndexing|print|property|range|'
391
+ r'rawArrayIndexing|required|typeof|unchecked|using|'
392
+ r'yieldAll|zip)\b', Name.Builtin),
393
+ (r'"""(\\\\|\\"|.*?)"""', String.Double),
394
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
395
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
396
+ (r'[a-zA-Z_]\w*', Name),
397
+ (r'(\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?', Number.Float),
398
+ (r'[0-9][0-9.]*(ms?|d|h|s)', Number),
399
+ (r'0\d+', Number.Oct),
400
+ (r'0x[a-fA-F0-9]+', Number.Hex),
401
+ (r'\d+L', Number.Integer.Long),
402
+ (r'\d+', Number.Integer),
403
+ ],
404
+ 'comment': [
405
+ ('/[*]', Comment.Multiline, '#push'),
406
+ ('[*]/', Comment.Multiline, '#pop'),
407
+ ('[^/*]', Comment.Multiline),
408
+ ('[*/]', Comment.Multiline)
409
+ ],
410
+ 'funcname': [
411
+ (r'[a-zA-Z_]\w*', Name.Function, '#pop')
412
+ ],
413
+ 'classname': [
414
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
415
+ ],
416
+ 'namespace': [
417
+ (r'[a-zA-Z_][\w.]*', Name.Namespace, '#pop')
418
+ ]
419
+ }
420
+
421
+
422
+ class VbNetLexer(RegexLexer):
423
+ """
424
+ For Visual Basic.NET source code.
425
+ Also LibreOffice Basic, OpenOffice Basic, and StarOffice Basic.
426
+ """
427
+
428
+ name = 'VB.net'
429
+ url = 'https://docs.microsoft.com/en-us/dotnet/visual-basic/'
430
+ aliases = ['vb.net', 'vbnet', 'lobas', 'oobas', 'sobas', 'visual-basic', 'visualbasic']
431
+ filenames = ['*.vb', '*.bas']
432
+ mimetypes = ['text/x-vbnet', 'text/x-vba'] # (?)
433
+ version_added = ''
434
+
435
+ uni_name = '[_' + uni.combine('Ll', 'Lt', 'Lm', 'Nl') + ']' + \
436
+ '[' + uni.combine('Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc',
437
+ 'Cf', 'Mn', 'Mc') + ']*'
438
+
439
+ flags = re.MULTILINE | re.IGNORECASE
440
+ tokens = {
441
+ 'root': [
442
+ (r'^\s*<.*?>', Name.Attribute),
443
+ (r'\s+', Whitespace),
444
+ (r'\n', Whitespace),
445
+ (r'(rem\b.*?)(\n)', bygroups(Comment, Whitespace)),
446
+ (r"('.*?)(\n)", bygroups(Comment, Whitespace)),
447
+ (r'#If\s.*?\sThen|#ElseIf\s.*?\sThen|#Else|#End\s+If|#Const|'
448
+ r'#ExternalSource.*?\n|#End\s+ExternalSource|'
449
+ r'#Region.*?\n|#End\s+Region|#ExternalChecksum',
450
+ Comment.Preproc),
451
+ (r'[(){}!#,.:]', Punctuation),
452
+ (r'(Option)(\s+)(Strict|Explicit|Compare)(\s+)'
453
+ r'(On|Off|Binary|Text)',
454
+ bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration,
455
+ Whitespace, Keyword.Declaration)),
456
+ (words((
457
+ 'AddHandler', 'Alias', 'ByRef', 'ByVal', 'Call', 'Case',
458
+ 'Catch', 'CBool', 'CByte', 'CChar', 'CDate', 'CDec', 'CDbl',
459
+ 'CInt', 'CLng', 'CObj', 'Continue', 'CSByte', 'CShort', 'CSng',
460
+ 'CStr', 'CType', 'CUInt', 'CULng', 'CUShort', 'Declare',
461
+ 'Default', 'Delegate', 'DirectCast', 'Do', 'Each', 'Else',
462
+ 'ElseIf', 'EndIf', 'Erase', 'Error', 'Event', 'Exit', 'False',
463
+ 'Finally', 'For', 'Friend', 'Get', 'Global', 'GoSub', 'GoTo',
464
+ 'Handles', 'If', 'Implements', 'Inherits', 'Interface', 'Let',
465
+ 'Lib', 'Loop', 'Me', 'MustInherit', 'MustOverride', 'MyBase',
466
+ 'MyClass', 'Narrowing', 'New', 'Next', 'Not', 'Nothing',
467
+ 'NotInheritable', 'NotOverridable', 'Of', 'On', 'Operator',
468
+ 'Option', 'Optional', 'Overloads', 'Overridable', 'Overrides',
469
+ 'ParamArray', 'Partial', 'Private', 'Protected', 'Public',
470
+ 'RaiseEvent', 'ReadOnly', 'ReDim', 'RemoveHandler', 'Resume',
471
+ 'Return', 'Select', 'Set', 'Shadows', 'Shared', 'Single',
472
+ 'Static', 'Step', 'Stop', 'SyncLock', 'Then', 'Throw', 'To',
473
+ 'True', 'Try', 'TryCast', 'Wend', 'Using', 'When', 'While',
474
+ 'Widening', 'With', 'WithEvents', 'WriteOnly'),
475
+ prefix=r'(?<!\.)', suffix=r'\b'), Keyword),
476
+ (r'(?<!\.)End\b', Keyword, 'end'),
477
+ (r'(?<!\.)(Dim|Const)\b', Keyword, 'dim'),
478
+ (r'(?<!\.)(Function|Sub|Property)(\s+)',
479
+ bygroups(Keyword, Whitespace), 'funcname'),
480
+ (r'(?<!\.)(Class|Structure|Enum)(\s+)',
481
+ bygroups(Keyword, Whitespace), 'classname'),
482
+ (r'(?<!\.)(Module|Namespace|Imports)(\s+)',
483
+ bygroups(Keyword, Whitespace), 'namespace'),
484
+ (r'(?<!\.)(Boolean|Byte|Char|Date|Decimal|Double|Integer|Long|'
485
+ r'Object|SByte|Short|Single|String|Variant|UInteger|ULong|'
486
+ r'UShort)\b', Keyword.Type),
487
+ (r'(?<!\.)(AddressOf|And|AndAlso|As|GetType|In|Is|IsNot|Like|Mod|'
488
+ r'Or|OrElse|TypeOf|Xor)\b', Operator.Word),
489
+ (r'&=|[*]=|/=|\\=|\^=|\+=|-=|<<=|>>=|<<|>>|:=|'
490
+ r'<=|>=|<>|[-&*/\\^+=<>\[\]]',
491
+ Operator),
492
+ ('"', String, 'string'),
493
+ (r'(_)(\n)', bygroups(Text, Whitespace)), # Line continuation (must be before Name)
494
+ (uni_name + '[%&@!#$]?', Name),
495
+ ('#.*?#', Literal.Date),
496
+ (r'(\d+\.\d*|\d*\.\d+)(F[+-]?[0-9]+)?', Number.Float),
497
+ (r'\d+([SILDFR]|US|UI|UL)?', Number.Integer),
498
+ (r'&H[0-9a-f]+([SILDFR]|US|UI|UL)?', Number.Integer),
499
+ (r'&O[0-7]+([SILDFR]|US|UI|UL)?', Number.Integer),
500
+ ],
501
+ 'string': [
502
+ (r'""', String),
503
+ (r'"C?', String, '#pop'),
504
+ (r'[^"]+', String),
505
+ ],
506
+ 'dim': [
507
+ (uni_name, Name.Variable, '#pop'),
508
+ default('#pop'), # any other syntax
509
+ ],
510
+ 'funcname': [
511
+ (uni_name, Name.Function, '#pop'),
512
+ ],
513
+ 'classname': [
514
+ (uni_name, Name.Class, '#pop'),
515
+ ],
516
+ 'namespace': [
517
+ (uni_name, Name.Namespace),
518
+ (r'\.', Name.Namespace),
519
+ default('#pop'),
520
+ ],
521
+ 'end': [
522
+ (r'\s+', Whitespace),
523
+ (r'(Function|Sub|Property|Class|Structure|Enum|Module|Namespace)\b',
524
+ Keyword, '#pop'),
525
+ default('#pop'),
526
+ ]
527
+ }
528
+
529
+ def analyse_text(text):
530
+ if re.search(r'^\s*(#If|Module|Namespace)', text, re.MULTILINE):
531
+ return 0.5
532
+
533
+
534
+ class GenericAspxLexer(RegexLexer):
535
+ """
536
+ Lexer for ASP.NET pages.
537
+ """
538
+
539
+ name = 'aspx-gen'
540
+ filenames = []
541
+ mimetypes = []
542
+ url = 'https://dotnet.microsoft.com/en-us/apps/aspnet'
543
+
544
+ flags = re.DOTALL
545
+
546
+ tokens = {
547
+ 'root': [
548
+ (r'(<%[@=#]?)(.*?)(%>)', bygroups(Name.Tag, Other, Name.Tag)),
549
+ (r'(<script.*?>)(.*?)(</script>)', bygroups(using(XmlLexer),
550
+ Other,
551
+ using(XmlLexer))),
552
+ (r'(.+?)(?=<)', using(XmlLexer)),
553
+ (r'.+', using(XmlLexer)),
554
+ ],
555
+ }
556
+
557
+
558
+ # TODO support multiple languages within the same source file
559
+ class CSharpAspxLexer(DelegatingLexer):
560
+ """
561
+ Lexer for highlighting C# within ASP.NET pages.
562
+ """
563
+
564
+ name = 'aspx-cs'
565
+ aliases = ['aspx-cs']
566
+ filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd']
567
+ mimetypes = []
568
+ url = 'https://dotnet.microsoft.com/en-us/apps/aspnet'
569
+ version_added = ''
570
+
571
+ def __init__(self, **options):
572
+ super().__init__(CSharpLexer, GenericAspxLexer, **options)
573
+
574
+ def analyse_text(text):
575
+ if re.search(r'Page\s*Language="C#"', text, re.I) is not None:
576
+ return 0.2
577
+ elif re.search(r'script[^>]+language=["\']C#', text, re.I) is not None:
578
+ return 0.15
579
+
580
+
581
+ class VbNetAspxLexer(DelegatingLexer):
582
+ """
583
+ Lexer for highlighting Visual Basic.net within ASP.NET pages.
584
+ """
585
+
586
+ name = 'aspx-vb'
587
+ aliases = ['aspx-vb']
588
+ filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd']
589
+ mimetypes = []
590
+ url = 'https://dotnet.microsoft.com/en-us/apps/aspnet'
591
+ version_added = ''
592
+
593
+ def __init__(self, **options):
594
+ super().__init__(VbNetLexer, GenericAspxLexer, **options)
595
+
596
+ def analyse_text(text):
597
+ if re.search(r'Page\s*Language="Vb"', text, re.I) is not None:
598
+ return 0.2
599
+ elif re.search(r'script[^>]+language=["\']vb', text, re.I) is not None:
600
+ return 0.15
601
+
602
+
603
+ # Very close to functional.OcamlLexer
604
+ class FSharpLexer(RegexLexer):
605
+ """
606
+ For the F# language (version 3.0).
607
+ """
608
+
609
+ name = 'F#'
610
+ url = 'https://fsharp.org/'
611
+ aliases = ['fsharp', 'f#']
612
+ filenames = ['*.fs', '*.fsi', '*.fsx']
613
+ mimetypes = ['text/x-fsharp']
614
+ version_added = '1.5'
615
+
616
+ keywords = [
617
+ 'abstract', 'as', 'assert', 'base', 'begin', 'class', 'default',
618
+ 'delegate', 'do!', 'do', 'done', 'downcast', 'downto', 'elif', 'else',
619
+ 'end', 'exception', 'extern', 'false', 'finally', 'for', 'function',
620
+ 'fun', 'global', 'if', 'inherit', 'inline', 'interface', 'internal',
621
+ 'in', 'lazy', 'let!', 'let', 'match', 'member', 'module', 'mutable',
622
+ 'namespace', 'new', 'null', 'of', 'open', 'override', 'private', 'public',
623
+ 'rec', 'return!', 'return', 'select', 'static', 'struct', 'then', 'to',
624
+ 'true', 'try', 'type', 'upcast', 'use!', 'use', 'val', 'void', 'when',
625
+ 'while', 'with', 'yield!', 'yield',
626
+ ]
627
+ # Reserved words; cannot hurt to color them as keywords too.
628
+ keywords += [
629
+ 'atomic', 'break', 'checked', 'component', 'const', 'constraint',
630
+ 'constructor', 'continue', 'eager', 'event', 'external', 'fixed',
631
+ 'functor', 'include', 'method', 'mixin', 'object', 'parallel',
632
+ 'process', 'protected', 'pure', 'sealed', 'tailcall', 'trait',
633
+ 'virtual', 'volatile',
634
+ ]
635
+ keyopts = [
636
+ '!=', '#', '&&', '&', r'\(', r'\)', r'\*', r'\+', ',', r'-\.',
637
+ '->', '-', r'\.\.', r'\.', '::', ':=', ':>', ':', ';;', ';', '<-',
638
+ r'<\]', '<', r'>\]', '>', r'\?\?', r'\?', r'\[<', r'\[\|', r'\[', r'\]',
639
+ '_', '`', r'\{', r'\|\]', r'\|', r'\}', '~', '<@@', '<@', '=', '@>', '@@>',
640
+ ]
641
+
642
+ operators = r'[!$%&*+\./:<=>?@^|~-]'
643
+ word_operators = ['and', 'or', 'not']
644
+ prefix_syms = r'[!?~]'
645
+ infix_syms = r'[=<>@^|&+\*/$%-]'
646
+ primitives = [
647
+ 'sbyte', 'byte', 'char', 'nativeint', 'unativeint', 'float32', 'single',
648
+ 'float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32',
649
+ 'uint32', 'int64', 'uint64', 'decimal', 'unit', 'bool', 'string',
650
+ 'list', 'exn', 'obj', 'enum',
651
+ ]
652
+
653
+ # See http://msdn.microsoft.com/en-us/library/dd233181.aspx and/or
654
+ # http://fsharp.org/about/files/spec.pdf for reference. Good luck.
655
+
656
+ tokens = {
657
+ 'escape-sequence': [
658
+ (r'\\[\\"\'ntbrafv]', String.Escape),
659
+ (r'\\[0-9]{3}', String.Escape),
660
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
661
+ (r'\\U[0-9a-fA-F]{8}', String.Escape),
662
+ ],
663
+ 'root': [
664
+ (r'\s+', Whitespace),
665
+ (r'\(\)|\[\]', Name.Builtin.Pseudo),
666
+ (r'\b(?<!\.)([A-Z][\w\']*)(?=\s*\.)',
667
+ Name.Namespace, 'dotted'),
668
+ (r'\b([A-Z][\w\']*)', Name),
669
+ (r'(///.*?)(\n)', bygroups(String.Doc, Whitespace)),
670
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
671
+ (r'\(\*(?!\))', Comment, 'comment'),
672
+
673
+ (r'@"', String, 'lstring'),
674
+ (r'"""', String, 'tqs'),
675
+ (r'"', String, 'string'),
676
+
677
+ (r'\b(open|module)(\s+)([\w.]+)',
678
+ bygroups(Keyword, Whitespace, Name.Namespace)),
679
+ (r'\b(let!?)(\s+)(\w+)',
680
+ bygroups(Keyword, Whitespace, Name.Variable)),
681
+ (r'\b(type)(\s+)(\w+)',
682
+ bygroups(Keyword, Whitespace, Name.Class)),
683
+ (r'\b(member|override)(\s+)(\w+)(\.)(\w+)',
684
+ bygroups(Keyword, Whitespace, Name, Punctuation, Name.Function)),
685
+ (r'\b({})\b'.format('|'.join(keywords)), Keyword),
686
+ (r'``([^`\n\r\t]|`[^`\n\r\t])+``', Name),
687
+ (r'({})'.format('|'.join(keyopts)), Operator),
688
+ (rf'({infix_syms}|{prefix_syms})?{operators}', Operator),
689
+ (r'\b({})\b'.format('|'.join(word_operators)), Operator.Word),
690
+ (r'\b({})\b'.format('|'.join(primitives)), Keyword.Type),
691
+ (r'(#)([ \t]*)(if|endif|else|line|nowarn|light|\d+)\b(.*?)(\n)',
692
+ bygroups(Comment.Preproc, Whitespace, Comment.Preproc,
693
+ Comment.Preproc, Whitespace)),
694
+
695
+ (r"[^\W\d][\w']*", Name),
696
+
697
+ (r'\d[\d_]*[uU]?[yslLnQRZINGmM]?', Number.Integer),
698
+ (r'0[xX][\da-fA-F][\da-fA-F_]*[uU]?[yslLn]?[fF]?', Number.Hex),
699
+ (r'0[oO][0-7][0-7_]*[uU]?[yslLn]?', Number.Oct),
700
+ (r'0[bB][01][01_]*[uU]?[yslLn]?', Number.Bin),
701
+ (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)[fFmM]?',
702
+ Number.Float),
703
+
704
+ (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'B?",
705
+ String.Char),
706
+ (r"'.'", String.Char),
707
+ (r"'", Keyword), # a stray quote is another syntax element
708
+
709
+ (r'@?"', String.Double, 'string'),
710
+
711
+ (r'[~?][a-z][\w\']*:', Name.Variable),
712
+ ],
713
+ 'dotted': [
714
+ (r'\s+', Whitespace),
715
+ (r'\.', Punctuation),
716
+ (r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
717
+ (r'[A-Z][\w\']*', Name, '#pop'),
718
+ (r'[a-z_][\w\']*', Name, '#pop'),
719
+ # e.g. dictionary index access
720
+ default('#pop'),
721
+ ],
722
+ 'comment': [
723
+ (r'[^(*)@"]+', Comment),
724
+ (r'\(\*', Comment, '#push'),
725
+ (r'\*\)', Comment, '#pop'),
726
+ # comments cannot be closed within strings in comments
727
+ (r'@"', String, 'lstring'),
728
+ (r'"""', String, 'tqs'),
729
+ (r'"', String, 'string'),
730
+ (r'[(*)@]', Comment),
731
+ ],
732
+ 'string': [
733
+ (r'[^\\"]+', String),
734
+ include('escape-sequence'),
735
+ (r'\\\n', String),
736
+ (r'\n', String), # newlines are allowed in any string
737
+ (r'"B?', String, '#pop'),
738
+ ],
739
+ 'lstring': [
740
+ (r'[^"]+', String),
741
+ (r'\n', String),
742
+ (r'""', String),
743
+ (r'"B?', String, '#pop'),
744
+ ],
745
+ 'tqs': [
746
+ (r'[^"]+', String),
747
+ (r'\n', String),
748
+ (r'"""B?', String, '#pop'),
749
+ (r'"', String),
750
+ ],
751
+ }
752
+
753
+ def analyse_text(text):
754
+ """F# doesn't have that many unique features -- |> and <| are weak
755
+ indicators."""
756
+ result = 0
757
+ if '|>' in text:
758
+ result += 0.05
759
+ if '<|' in text:
760
+ result += 0.05
761
+
762
+ return result
763
+
764
+
765
+ class XppLexer(RegexLexer):
766
+
767
+ """
768
+ For X++ source code. This is based loosely on the CSharpLexer
769
+ """
770
+
771
+ name = 'X++'
772
+ url = 'https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-language-reference'
773
+ aliases = ['xpp', 'x++']
774
+ filenames = ['*.xpp']
775
+ version_added = '2.15'
776
+
777
+ flags = re.MULTILINE
778
+
779
+ XPP_CHARS = ('@?(?:_|[^' +
780
+ uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])' +
781
+ '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
782
+ 'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*')
783
+ # Temporary, see
784
+ # https://github.com/thatch/regexlint/pull/49
785
+ XPP_CHARS = XPP_CHARS.replace('\x00', '\x01')
786
+
787
+ OPERATORS = (
788
+ '<=', '>=', '+=', '-=', '*=', '/=', '!=', '==',
789
+ '&&', '||', '>>', '<<', '++', '--', '+', '-', '*',
790
+ '/', '%', '&', '|', '^', '<', '>', '?', '!', '~', '=',
791
+ )
792
+ KEYWORDS = ('abstract','anytype','as','async','asc','at','avg','break','breakpoint','by','byref','case','catch',
793
+ 'changecompany','client','container','continue','count','crosscompany','default','delegate',
794
+ 'delete_from','desc','display','div','do','edit','else','element','eventhandler','exists','false','final',
795
+ 'firstfast','firstonly','firstonly10','firstonly100','firstonly1000','flush','for','forceliterals',
796
+ 'forcenestedloop','forceplaceholders','forceselectorder','forupdate','from','group','if','insert_recordset',
797
+ 'interface','is','join','like','maxof','minof','mod','new','next','nofetch','notexists','null','optimisticlock','order',
798
+ 'outer','pause','pessimisticlock','print','private','protected','public','repeatableread','retry','return',
799
+ 'reverse','select','server','setting','static','sum','super','switch','tablelock','this','throw','true','try','ttsabort','ttsbegin',
800
+ 'ttscommit','update_recordset','validtimestate','void','where','while','window')
801
+ RUNTIME_FUNCTIONS = ('_duration','abs','acos','any2Date','any2Enum','any2Guid','any2Int','any2Int64','any2Real','any2Str','anytodate',
802
+ 'anytoenum','anytoguid','anytoint','anytoint64','anytoreal','anytostr','asin','atan','beep','cTerm','char2Num','classIdGet',
803
+ 'corrFlagGet','corrFlagSet','cos','cosh','curExt','curUserId','date2Num','date2Str','datetime2Str','dayName','dayOfMth',
804
+ 'dayOfWk','dayOfYr','ddb','decRound','dg','dimOf','endMth','enum2str','exp','exp10','fV','fieldId2Name','fieldId2PName',
805
+ 'fieldName2Id','frac','funcName','getCurrentPartition','getCurrentPartitionRecId','getPrefix','guid2Str','idg','indexId2Name',
806
+ 'indexName2Id','int2Str','int642Str','intvMax','intvName','intvNo','intvNorm','log10','logN','match','max','min','mkDate','mthName',
807
+ 'mthOfYr','newGuid','nextMth','nextQtr','nextYr','num2Char','num2Date','num2Str','pmt','power','prevMth','prevQtr','prevYr',
808
+ 'prmIsDefault','pt','pv','rate','refPrintAll','round','runAs','sessionId','setPrefix','sin','sinh','sleep','sln','str2Date',
809
+ 'str2Datetime','str2Enum','str2Guid','str2Int','str2Int64','str2Num','str2Time','strAlpha','strCmp','strColSeq','strDel',
810
+ 'strFind','strFmt','strIns','strKeep','strLTrim','strLen','strLine','strLwr','strNFind','strPoke','strPrompt','strRTrim',
811
+ 'strRem','strRep','strScan','strUpr','subStr','syd','systemDateGet','systemDateSet','tableId2Name',
812
+ 'tableId2PName','tableName2Id','tan','tanh','term','time2Str','timeNow','today','trunc','typeOf','uint2Str','wkOfYr','year')
813
+ COMPILE_FUNCTIONS = ('attributeStr','classNum','classStr','configurationKeyNum','configurationKeyStr','dataEntityDataSourceStr','delegateStr',
814
+ 'dimensionHierarchyLevelStr','dimensionHierarchyStr','dimensionReferenceStr','dutyStr','enumCnt','enumLiteralStr','enumNum','enumStr',
815
+ 'extendedTypeNum','extendedTypeStr','fieldNum','fieldPName','fieldStr','formControlStr','formDataFieldStr','formDataSourceStr',
816
+ 'formMethodStr','formStr','identifierStr','indexNum','indexStr','licenseCodeNum','licenseCodeStr','literalStr','maxDate','maxInt',
817
+ 'measureStr','measurementStr','menuItemActionStr','menuItemDisplayStr','menuItemOutputStr','menuStr','methodStr','minInt','privilegeStr',
818
+ 'queryDatasourceStr','queryMethodStr','queryStr','reportStr','resourceStr','roleStr','ssrsReportStr','staticDelegateStr','staticMethodStr',
819
+ 'tableCollectionStr','tableFieldGroupStr','tableMethodStr','tableNum','tablePName','tableStaticMethodStr','tableStr','tileStr','varStr',
820
+ 'webActionItemStr','webDisplayContentItemStr','webFormStr','webMenuStr','webOutputContentItemStr','webReportStr','webSiteTempStr',
821
+ 'webStaticFileStr','webUrlItemStr','webWebPartStr','webletItemStr','webpageDefStr','websiteDefStr','workflowApprovalStr',
822
+ 'workflowCategoryStr','workflowTaskStr','workflowTypeStr')
823
+
824
+ tokens = {}
825
+
826
+ tokens = {
827
+ 'root': [
828
+ # method names
829
+ (r'(\s*)\b(else|if)\b([^\n])', bygroups(Whitespace, Keyword, using(this))), # ensure that if is not treated like a function
830
+ (r'^([ \t]*)((?:' + XPP_CHARS + r'(?:\[\])?\s+)+?)' # return type
831
+ r'(' + XPP_CHARS + ')' # method name
832
+ r'(\s*)(\()', # signature start
833
+ bygroups(Whitespace, using(this), Name.Function, Whitespace,
834
+ Punctuation)),
835
+ (r'^(\s*)(\[)([^\n]*?)(\])', bygroups(Whitespace, Name.Attribute, Name.Variable.Class, Name.Attribute)),
836
+ (r'[^\S\n]+', Whitespace),
837
+ (r'(\\)(\n)', bygroups(Text, Whitespace)), # line continuation
838
+ (r'//[^\n]*?\n', Comment.Single),
839
+ (r'/[*][^\n]*?[*]/', Comment.Multiline),
840
+ (r'\n', Whitespace),
841
+ (words(OPERATORS), Operator),
842
+ (r'=~|!=|==|<<|>>|[-+/*%=<>&^|]', Operator),
843
+ (r'[()\[\];:,.#@]', Punctuation),
844
+ (r'[{}]', Punctuation),
845
+ (r'@"(""|[^"])*"', String),
846
+ (r'\$?"(\\\\|\\[^\\]|[^"\\\n])*["\n]', String),
847
+ (r"'\\.'|'[^\\]'", String.Char),
848
+ (r"[0-9]+(\.[0-9]*)?([eE][+-][0-9]+)?"
849
+ r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number),
850
+ (words(KEYWORDS, suffix=r'\b'), Keyword),
851
+ (r'(boolean|int|int64|str|real|guid|date)\b\??', Keyword.Type),
852
+ (r'(class|struct|extends|implements)(\s+)', bygroups(Keyword, Whitespace), 'class'),
853
+ (r'('+XPP_CHARS+')(::)', bygroups(Name.Variable.Class, Punctuation)),
854
+ (r'(\s*)(\w+)(\s+\w+(,|=)?[^\n]*;)', bygroups(Whitespace, Name.Variable.Class, using(this))), # declaration
855
+ # x++ specific function to get field should highlight the classname
856
+ (r'(fieldNum\()('+XPP_CHARS+r')(\s*,\s*)('+XPP_CHARS+r')(\s*\))',
857
+ bygroups(using(this), Name.Variable.Class, using(this), Name.Property, using(this))),
858
+ # x++ specific function to get table should highlight the classname
859
+ (r'(tableNum\()('+XPP_CHARS+r')(\s*\))',
860
+ bygroups(using(this), Name.Variable.Class, using(this))),
861
+ (words(RUNTIME_FUNCTIONS, suffix=r'(?=\()'), Name.Function.Magic),
862
+ (words(COMPILE_FUNCTIONS, suffix=r'(?=\()'), Name.Function.Magic),
863
+ (XPP_CHARS, Name),
864
+ ],
865
+ 'class': [
866
+ (XPP_CHARS, Name.Class, '#pop'),
867
+ default('#pop'),
868
+ ],
869
+ 'namespace': [
870
+ (r'(?=\()', Text, '#pop'), # using (resource)
871
+ ('(' + XPP_CHARS + r'|\.)+', Name.Namespace, '#pop'),
872
+ ]
873
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/hare.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.hare
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Hare language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, include, words
12
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation, Whitespace
14
+
15
+ __all__ = ['HareLexer']
16
+
17
+ class HareLexer(RegexLexer):
18
+ """
19
+ Lexer for the Hare programming language.
20
+ """
21
+ name = 'Hare'
22
+ url = 'https://harelang.org/'
23
+ aliases = ['hare']
24
+ filenames = ['*.ha']
25
+ mimetypes = ['text/x-hare']
26
+ version_added = '2.19'
27
+
28
+ _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
29
+ _ws1 = r'\s*(?:/[*].*?[*]/\s*)?'
30
+
31
+ tokens = {
32
+ 'whitespace': [
33
+ (r'^use.*;', Comment.Preproc),
34
+ (r'@[a-z]+', Comment.Preproc),
35
+ (r'\n', Whitespace),
36
+ (r'\s+', Whitespace),
37
+ (r'//.*?$', Comment.Single),
38
+ ],
39
+ 'statements': [
40
+ (r'"', String, 'string'),
41
+ (r'`[^`]*`', String),
42
+ (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
43
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
44
+ (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
45
+ (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
46
+ (r'0o[0-7]+[LlUu]*', Number.Oct),
47
+ (r'\d+[zui]?(\d+)?', Number.Integer),
48
+ (r'[~!%^&*+=|?:<>/-]', Operator),
49
+ (words(('as', 'is', '=>', '..', '...')), Operator),
50
+ (r'[()\[\],.{};]+', Punctuation),
51
+ (words(('abort', 'align', 'alloc', 'append', 'assert', 'case',
52
+ 'const', 'def', 'defer', 'delete', 'else', 'enum', 'export',
53
+ 'fn', 'for', 'free', 'if', 'let', 'len', 'match', 'offset',
54
+ 'return', 'static', 'struct', 'switch', 'type', 'union',
55
+ 'yield', 'vastart', 'vaarg', 'vaend'),
56
+ suffix=r'\b'), Keyword),
57
+ (r'(bool|int|uint|uintptr|u8|u16|u32|u64|i8|i16|i32|i64|f32|f64|null|done|never|void|nullable|rune|size|valist)\b',
58
+ Keyword.Type),
59
+ (r'(true|false|null)\b', Name.Builtin),
60
+ (r'[a-zA-Z_]\w*', Name),
61
+ ],
62
+ 'string': [
63
+ (r'"', String, '#pop'),
64
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|'
65
+ r'u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})', String.Escape),
66
+ (r'[^\\"\n]+', String), # all other characters
67
+ (r'\\', String), # stray backslash
68
+ ],
69
+ 'root': [
70
+ include('whitespace'),
71
+ include('statements'),
72
+ ],
73
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/idl.py ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.idl
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for IDL.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, words, bygroups
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, Number, \
15
+ String, Whitespace
16
+
17
+ __all__ = ['IDLLexer']
18
+
19
+
20
+ class IDLLexer(RegexLexer):
21
+ """
22
+ Pygments Lexer for IDL (Interactive Data Language).
23
+ """
24
+ name = 'IDL'
25
+ url = 'https://www.l3harrisgeospatial.com/Software-Technology/IDL'
26
+ aliases = ['idl']
27
+ filenames = ['*.pro']
28
+ mimetypes = ['text/idl']
29
+ version_added = '1.6'
30
+
31
+ flags = re.IGNORECASE | re.MULTILINE
32
+
33
+ _RESERVED = (
34
+ 'and', 'begin', 'break', 'case', 'common', 'compile_opt',
35
+ 'continue', 'do', 'else', 'end', 'endcase', 'endelse',
36
+ 'endfor', 'endforeach', 'endif', 'endrep', 'endswitch',
37
+ 'endwhile', 'eq', 'for', 'foreach', 'forward_function',
38
+ 'function', 'ge', 'goto', 'gt', 'if', 'inherits', 'le',
39
+ 'lt', 'mod', 'ne', 'not', 'of', 'on_ioerror', 'or', 'pro',
40
+ 'repeat', 'switch', 'then', 'until', 'while', 'xor')
41
+ """Reserved words from: http://www.exelisvis.com/docs/reswords.html"""
42
+
43
+ _BUILTIN_LIB = (
44
+ 'abs', 'acos', 'adapt_hist_equal', 'alog', 'alog10',
45
+ 'amoeba', 'annotate', 'app_user_dir', 'app_user_dir_query',
46
+ 'arg_present', 'array_equal', 'array_indices', 'arrow',
47
+ 'ascii_template', 'asin', 'assoc', 'atan', 'axis',
48
+ 'a_correlate', 'bandpass_filter', 'bandreject_filter',
49
+ 'barplot', 'bar_plot', 'beseli', 'beselj', 'beselk',
50
+ 'besely', 'beta', 'bilinear', 'binary_template', 'bindgen',
51
+ 'binomial', 'bin_date', 'bit_ffs', 'bit_population',
52
+ 'blas_axpy', 'blk_con', 'box_cursor', 'breakpoint',
53
+ 'broyden', 'butterworth', 'bytarr', 'byte', 'byteorder',
54
+ 'bytscl', 'caldat', 'calendar', 'call_external',
55
+ 'call_function', 'call_method', 'call_procedure', 'canny',
56
+ 'catch', 'cd', r'cdf_\w*', 'ceil', 'chebyshev',
57
+ 'check_math',
58
+ 'chisqr_cvf', 'chisqr_pdf', 'choldc', 'cholsol', 'cindgen',
59
+ 'cir_3pnt', 'close', 'cluster', 'cluster_tree', 'clust_wts',
60
+ 'cmyk_convert', 'colorbar', 'colorize_sample',
61
+ 'colormap_applicable', 'colormap_gradient',
62
+ 'colormap_rotation', 'colortable', 'color_convert',
63
+ 'color_exchange', 'color_quan', 'color_range_map', 'comfit',
64
+ 'command_line_args', 'complex', 'complexarr', 'complexround',
65
+ 'compute_mesh_normals', 'cond', 'congrid', 'conj',
66
+ 'constrained_min', 'contour', 'convert_coord', 'convol',
67
+ 'convol_fft', 'coord2to3', 'copy_lun', 'correlate', 'cos',
68
+ 'cosh', 'cpu', 'cramer', 'create_cursor', 'create_struct',
69
+ 'create_view', 'crossp', 'crvlength', 'cti_test',
70
+ 'ct_luminance', 'cursor', 'curvefit', 'cvttobm', 'cv_coord',
71
+ 'cw_animate', 'cw_animate_getp', 'cw_animate_load',
72
+ 'cw_animate_run', 'cw_arcball', 'cw_bgroup', 'cw_clr_index',
73
+ 'cw_colorsel', 'cw_defroi', 'cw_field', 'cw_filesel',
74
+ 'cw_form', 'cw_fslider', 'cw_light_editor',
75
+ 'cw_light_editor_get', 'cw_light_editor_set', 'cw_orient',
76
+ 'cw_palette_editor', 'cw_palette_editor_get',
77
+ 'cw_palette_editor_set', 'cw_pdmenu', 'cw_rgbslider',
78
+ 'cw_tmpl', 'cw_zoom', 'c_correlate', 'dblarr', 'db_exists',
79
+ 'dcindgen', 'dcomplex', 'dcomplexarr', 'define_key',
80
+ 'define_msgblk', 'define_msgblk_from_file', 'defroi',
81
+ 'defsysv', 'delvar', 'dendrogram', 'dendro_plot', 'deriv',
82
+ 'derivsig', 'determ', 'device', 'dfpmin', 'diag_matrix',
83
+ 'dialog_dbconnect', 'dialog_message', 'dialog_pickfile',
84
+ 'dialog_printersetup', 'dialog_printjob',
85
+ 'dialog_read_image', 'dialog_write_image', 'digital_filter',
86
+ 'dilate', 'dindgen', 'dissolve', 'dist', 'distance_measure',
87
+ 'dlm_load', 'dlm_register', 'doc_library', 'double',
88
+ 'draw_roi', 'edge_dog', 'efont', 'eigenql', 'eigenvec',
89
+ 'ellipse', 'elmhes', 'emboss', 'empty', 'enable_sysrtn',
90
+ 'eof', r'eos_\w*', 'erase', 'erf', 'erfc', 'erfcx',
91
+ 'erode', 'errorplot', 'errplot', 'estimator_filter',
92
+ 'execute', 'exit', 'exp', 'expand', 'expand_path', 'expint',
93
+ 'extrac', 'extract_slice', 'factorial', 'fft', 'filepath',
94
+ 'file_basename', 'file_chmod', 'file_copy', 'file_delete',
95
+ 'file_dirname', 'file_expand_path', 'file_info',
96
+ 'file_lines', 'file_link', 'file_mkdir', 'file_move',
97
+ 'file_poll_input', 'file_readlink', 'file_same',
98
+ 'file_search', 'file_test', 'file_which', 'findgen',
99
+ 'finite', 'fix', 'flick', 'float', 'floor', 'flow3',
100
+ 'fltarr', 'flush', 'format_axis_values', 'free_lun',
101
+ 'fstat', 'fulstr', 'funct', 'fv_test', 'fx_root',
102
+ 'fz_roots', 'f_cvf', 'f_pdf', 'gamma', 'gamma_ct',
103
+ 'gauss2dfit', 'gaussfit', 'gaussian_function', 'gaussint',
104
+ 'gauss_cvf', 'gauss_pdf', 'gauss_smooth', 'getenv',
105
+ 'getwindows', 'get_drive_list', 'get_dxf_objects',
106
+ 'get_kbrd', 'get_login_info', 'get_lun', 'get_screen_size',
107
+ 'greg2jul', r'grib_\w*', 'grid3', 'griddata',
108
+ 'grid_input', 'grid_tps', 'gs_iter',
109
+ r'h5[adfgirst]_\w*', 'h5_browser', 'h5_close',
110
+ 'h5_create', 'h5_get_libversion', 'h5_open', 'h5_parse',
111
+ 'hanning', 'hash', r'hdf_\w*', 'heap_free',
112
+ 'heap_gc', 'heap_nosave', 'heap_refcount', 'heap_save',
113
+ 'help', 'hilbert', 'histogram', 'hist_2d', 'hist_equal',
114
+ 'hls', 'hough', 'hqr', 'hsv', 'h_eq_ct', 'h_eq_int',
115
+ 'i18n_multibytetoutf8', 'i18n_multibytetowidechar',
116
+ 'i18n_utf8tomultibyte', 'i18n_widechartomultibyte',
117
+ 'ibeta', 'icontour', 'iconvertcoord', 'idelete', 'identity',
118
+ 'idlexbr_assistant', 'idlitsys_createtool', 'idl_base64',
119
+ 'idl_validname', 'iellipse', 'igamma', 'igetcurrent',
120
+ 'igetdata', 'igetid', 'igetproperty', 'iimage', 'image',
121
+ 'image_cont', 'image_statistics', 'imaginary', 'imap',
122
+ 'indgen', 'intarr', 'interpol', 'interpolate',
123
+ 'interval_volume', 'int_2d', 'int_3d', 'int_tabulated',
124
+ 'invert', 'ioctl', 'iopen', 'iplot', 'ipolygon',
125
+ 'ipolyline', 'iputdata', 'iregister', 'ireset', 'iresolve',
126
+ 'irotate', 'ir_filter', 'isa', 'isave', 'iscale',
127
+ 'isetcurrent', 'isetproperty', 'ishft', 'isocontour',
128
+ 'isosurface', 'isurface', 'itext', 'itranslate', 'ivector',
129
+ 'ivolume', 'izoom', 'i_beta', 'journal', 'json_parse',
130
+ 'json_serialize', 'jul2greg', 'julday', 'keyword_set',
131
+ 'krig2d', 'kurtosis', 'kw_test', 'l64indgen', 'label_date',
132
+ 'label_region', 'ladfit', 'laguerre', 'laplacian',
133
+ 'la_choldc', 'la_cholmprove', 'la_cholsol', 'la_determ',
134
+ 'la_eigenproblem', 'la_eigenql', 'la_eigenvec', 'la_elmhes',
135
+ 'la_gm_linear_model', 'la_hqr', 'la_invert',
136
+ 'la_least_squares', 'la_least_square_equality',
137
+ 'la_linear_equation', 'la_ludc', 'la_lumprove', 'la_lusol',
138
+ 'la_svd', 'la_tridc', 'la_trimprove', 'la_triql',
139
+ 'la_trired', 'la_trisol', 'least_squares_filter', 'leefilt',
140
+ 'legend', 'legendre', 'linbcg', 'lindgen', 'linfit',
141
+ 'linkimage', 'list', 'll_arc_distance', 'lmfit', 'lmgr',
142
+ 'lngamma', 'lnp_test', 'loadct', 'locale_get',
143
+ 'logical_and', 'logical_or', 'logical_true', 'lon64arr',
144
+ 'lonarr', 'long', 'long64', 'lsode', 'ludc', 'lumprove',
145
+ 'lusol', 'lu_complex', 'machar', 'make_array', 'make_dll',
146
+ 'make_rt', 'map', 'mapcontinents', 'mapgrid', 'map_2points',
147
+ 'map_continents', 'map_grid', 'map_image', 'map_patch',
148
+ 'map_proj_forward', 'map_proj_image', 'map_proj_info',
149
+ 'map_proj_init', 'map_proj_inverse', 'map_set',
150
+ 'matrix_multiply', 'matrix_power', 'max', 'md_test',
151
+ 'mean', 'meanabsdev', 'mean_filter', 'median', 'memory',
152
+ 'mesh_clip', 'mesh_decimate', 'mesh_issolid', 'mesh_merge',
153
+ 'mesh_numtriangles', 'mesh_obj', 'mesh_smooth',
154
+ 'mesh_surfacearea', 'mesh_validate', 'mesh_volume',
155
+ 'message', 'min', 'min_curve_surf', 'mk_html_help',
156
+ 'modifyct', 'moment', 'morph_close', 'morph_distance',
157
+ 'morph_gradient', 'morph_hitormiss', 'morph_open',
158
+ 'morph_thin', 'morph_tophat', 'multi', 'm_correlate',
159
+ r'ncdf_\w*', 'newton', 'noise_hurl', 'noise_pick',
160
+ 'noise_scatter', 'noise_slur', 'norm', 'n_elements',
161
+ 'n_params', 'n_tags', 'objarr', 'obj_class', 'obj_destroy',
162
+ 'obj_hasmethod', 'obj_isa', 'obj_new', 'obj_valid',
163
+ 'online_help', 'on_error', 'open', 'oplot', 'oploterr',
164
+ 'parse_url', 'particle_trace', 'path_cache', 'path_sep',
165
+ 'pcomp', 'plot', 'plot3d', 'ploterr', 'plots', 'plot_3dbox',
166
+ 'plot_field', 'pnt_line', 'point_lun', 'polarplot',
167
+ 'polar_contour', 'polar_surface', 'poly', 'polyfill',
168
+ 'polyfillv', 'polygon', 'polyline', 'polyshade', 'polywarp',
169
+ 'poly_2d', 'poly_area', 'poly_fit', 'popd', 'powell',
170
+ 'pref_commit', 'pref_get', 'pref_set', 'prewitt', 'primes',
171
+ 'print', 'printd', 'product', 'profile', 'profiler',
172
+ 'profiles', 'project_vol', 'psafm', 'pseudo',
173
+ 'ps_show_fonts', 'ptrarr', 'ptr_free', 'ptr_new',
174
+ 'ptr_valid', 'pushd', 'p_correlate', 'qgrid3', 'qhull',
175
+ 'qromb', 'qromo', 'qsimp', 'query_ascii', 'query_bmp',
176
+ 'query_csv', 'query_dicom', 'query_gif', 'query_image',
177
+ 'query_jpeg', 'query_jpeg2000', 'query_mrsid', 'query_pict',
178
+ 'query_png', 'query_ppm', 'query_srf', 'query_tiff',
179
+ 'query_wav', 'radon', 'randomn', 'randomu', 'ranks',
180
+ 'rdpix', 'read', 'reads', 'readu', 'read_ascii',
181
+ 'read_binary', 'read_bmp', 'read_csv', 'read_dicom',
182
+ 'read_gif', 'read_image', 'read_interfile', 'read_jpeg',
183
+ 'read_jpeg2000', 'read_mrsid', 'read_pict', 'read_png',
184
+ 'read_ppm', 'read_spr', 'read_srf', 'read_sylk',
185
+ 'read_tiff', 'read_wav', 'read_wave', 'read_x11_bitmap',
186
+ 'read_xwd', 'real_part', 'rebin', 'recall_commands',
187
+ 'recon3', 'reduce_colors', 'reform', 'region_grow',
188
+ 'register_cursor', 'regress', 'replicate',
189
+ 'replicate_inplace', 'resolve_all', 'resolve_routine',
190
+ 'restore', 'retall', 'return', 'reverse', 'rk4', 'roberts',
191
+ 'rot', 'rotate', 'round', 'routine_filepath',
192
+ 'routine_info', 'rs_test', 'r_correlate', 'r_test',
193
+ 'save', 'savgol', 'scale3', 'scale3d', 'scope_level',
194
+ 'scope_traceback', 'scope_varfetch', 'scope_varname',
195
+ 'search2d', 'search3d', 'sem_create', 'sem_delete',
196
+ 'sem_lock', 'sem_release', 'setenv', 'set_plot',
197
+ 'set_shading', 'sfit', 'shade_surf', 'shade_surf_irr',
198
+ 'shade_volume', 'shift', 'shift_diff', 'shmdebug', 'shmmap',
199
+ 'shmunmap', 'shmvar', 'show3', 'showfont', 'simplex', 'sin',
200
+ 'sindgen', 'sinh', 'size', 'skewness', 'skip_lun',
201
+ 'slicer3', 'slide_image', 'smooth', 'sobel', 'socket',
202
+ 'sort', 'spawn', 'spher_harm', 'sph_4pnt', 'sph_scat',
203
+ 'spline', 'spline_p', 'spl_init', 'spl_interp', 'sprsab',
204
+ 'sprsax', 'sprsin', 'sprstp', 'sqrt', 'standardize',
205
+ 'stddev', 'stop', 'strarr', 'strcmp', 'strcompress',
206
+ 'streamline', 'stregex', 'stretch', 'string', 'strjoin',
207
+ 'strlen', 'strlowcase', 'strmatch', 'strmessage', 'strmid',
208
+ 'strpos', 'strput', 'strsplit', 'strtrim', 'struct_assign',
209
+ 'struct_hide', 'strupcase', 'surface', 'surfr', 'svdc',
210
+ 'svdfit', 'svsol', 'swap_endian', 'swap_endian_inplace',
211
+ 'symbol', 'systime', 's_test', 't3d', 'tag_names', 'tan',
212
+ 'tanh', 'tek_color', 'temporary', 'tetra_clip',
213
+ 'tetra_surface', 'tetra_volume', 'text', 'thin', 'threed',
214
+ 'timegen', 'time_test2', 'tm_test', 'total', 'trace',
215
+ 'transpose', 'triangulate', 'trigrid', 'triql', 'trired',
216
+ 'trisol', 'tri_surf', 'truncate_lun', 'ts_coef', 'ts_diff',
217
+ 'ts_fcast', 'ts_smooth', 'tv', 'tvcrs', 'tvlct', 'tvrd',
218
+ 'tvscl', 'typename', 't_cvt', 't_pdf', 'uindgen', 'uint',
219
+ 'uintarr', 'ul64indgen', 'ulindgen', 'ulon64arr', 'ulonarr',
220
+ 'ulong', 'ulong64', 'uniq', 'unsharp_mask', 'usersym',
221
+ 'value_locate', 'variance', 'vector', 'vector_field', 'vel',
222
+ 'velovect', 'vert_t3d', 'voigt', 'voronoi', 'voxel_proj',
223
+ 'wait', 'warp_tri', 'watershed', 'wdelete', 'wf_draw',
224
+ 'where', 'widget_base', 'widget_button', 'widget_combobox',
225
+ 'widget_control', 'widget_displaycontextmen', 'widget_draw',
226
+ 'widget_droplist', 'widget_event', 'widget_info',
227
+ 'widget_label', 'widget_list', 'widget_propertysheet',
228
+ 'widget_slider', 'widget_tab', 'widget_table',
229
+ 'widget_text', 'widget_tree', 'widget_tree_move',
230
+ 'widget_window', 'wiener_filter', 'window', 'writeu',
231
+ 'write_bmp', 'write_csv', 'write_gif', 'write_image',
232
+ 'write_jpeg', 'write_jpeg2000', 'write_nrif', 'write_pict',
233
+ 'write_png', 'write_ppm', 'write_spr', 'write_srf',
234
+ 'write_sylk', 'write_tiff', 'write_wav', 'write_wave',
235
+ 'wset', 'wshow', 'wtn', 'wv_applet', 'wv_cwt',
236
+ 'wv_cw_wavelet', 'wv_denoise', 'wv_dwt', 'wv_fn_coiflet',
237
+ 'wv_fn_daubechies', 'wv_fn_gaussian', 'wv_fn_haar',
238
+ 'wv_fn_morlet', 'wv_fn_paul', 'wv_fn_symlet',
239
+ 'wv_import_data', 'wv_import_wavelet', 'wv_plot3d_wps',
240
+ 'wv_plot_multires', 'wv_pwt', 'wv_tool_denoise',
241
+ 'xbm_edit', 'xdisplayfile', 'xdxf', 'xfont',
242
+ 'xinteranimate', 'xloadct', 'xmanager', 'xmng_tmpl',
243
+ 'xmtool', 'xobjview', 'xobjview_rotate',
244
+ 'xobjview_write_image', 'xpalette', 'xpcolor', 'xplot3d',
245
+ 'xregistered', 'xroi', 'xsq_test', 'xsurface', 'xvaredit',
246
+ 'xvolume', 'xvolume_rotate', 'xvolume_write_image',
247
+ 'xyouts', 'zoom', 'zoom_24')
248
+ """Functions from: http://www.exelisvis.com/docs/routines-1.html"""
249
+
250
+ tokens = {
251
+ 'root': [
252
+ (r'(^\s*)(;.*?)(\n)', bygroups(Whitespace, Comment.Single,
253
+ Whitespace)),
254
+ (words(_RESERVED, prefix=r'\b', suffix=r'\b'), Keyword),
255
+ (words(_BUILTIN_LIB, prefix=r'\b', suffix=r'\b'), Name.Builtin),
256
+ (r'\+=|-=|\^=|\*=|/=|#=|##=|<=|>=|=', Operator),
257
+ (r'\+\+|--|->|\+|-|##|#|\*|/|<|>|&&|\^|~|\|\|\?|:', Operator),
258
+ (r'\b(mod=|lt=|le=|eq=|ne=|ge=|gt=|not=|and=|or=|xor=)', Operator),
259
+ (r'\b(mod|lt|le|eq|ne|ge|gt|not|and|or|xor)\b', Operator),
260
+ (r'"[^\"]*"', String.Double),
261
+ (r"'[^\']*'", String.Single),
262
+ (r'\b[+\-]?([0-9]*\.[0-9]+|[0-9]+\.[0-9]*)(D|E)?([+\-]?[0-9]+)?\b',
263
+ Number.Float),
264
+ (r'\b\'[+\-]?[0-9A-F]+\'X(U?(S?|L{1,2})|B)\b', Number.Hex),
265
+ (r'\b\'[+\-]?[0-7]+\'O(U?(S?|L{1,2})|B)\b', Number.Oct),
266
+ (r'\b[+\-]?[0-9]+U?L{1,2}\b', Number.Integer.Long),
267
+ (r'\b[+\-]?[0-9]+U?S?\b', Number.Integer),
268
+ (r'\b[+\-]?[0-9]+B\b', Number),
269
+ (r'[ \t]+', Whitespace),
270
+ (r'\n', Whitespace),
271
+ (r'.', Text),
272
+ ]
273
+ }
274
+
275
+ def analyse_text(text):
276
+ """endelse seems to be unique to IDL, endswitch is rare at least."""
277
+ result = 0
278
+
279
+ if 'endelse' in text:
280
+ result += 0.2
281
+ if 'endswitch' in text:
282
+ result += 0.01
283
+
284
+ return result
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/javascript.py ADDED
@@ -0,0 +1,1591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.javascript
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for JavaScript and related languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import bygroups, combined, default, do_insertions, include, \
14
+ inherit, Lexer, RegexLexer, this, using, words, line_re
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Other, Generic, Whitespace
17
+ from pygments.util import get_bool_opt
18
+ import pygments.unistring as uni
19
+
20
+ __all__ = ['JavascriptLexer', 'KalLexer', 'LiveScriptLexer', 'DartLexer',
21
+ 'TypeScriptLexer', 'LassoLexer', 'ObjectiveJLexer',
22
+ 'CoffeeScriptLexer', 'MaskLexer', 'EarlGreyLexer', 'JuttleLexer',
23
+ 'NodeConsoleLexer']
24
+
25
+ JS_IDENT_START = ('(?:[$_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') +
26
+ ']|\\\\u[a-fA-F0-9]{4})')
27
+ JS_IDENT_PART = ('(?:[$' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
28
+ 'Mn', 'Mc', 'Nd', 'Pc') +
29
+ '\u200c\u200d]|\\\\u[a-fA-F0-9]{4})')
30
+ JS_IDENT = JS_IDENT_START + '(?:' + JS_IDENT_PART + ')*'
31
+
32
+
33
+ class JavascriptLexer(RegexLexer):
34
+ """
35
+ For JavaScript source code.
36
+ """
37
+
38
+ name = 'JavaScript'
39
+ url = 'https://www.ecma-international.org/publications-and-standards/standards/ecma-262/'
40
+ aliases = ['javascript', 'js']
41
+ filenames = ['*.js', '*.jsm', '*.mjs', '*.cjs']
42
+ mimetypes = ['application/javascript', 'application/x-javascript',
43
+ 'text/x-javascript', 'text/javascript']
44
+ version_added = ''
45
+
46
+ flags = re.DOTALL | re.MULTILINE
47
+
48
+ tokens = {
49
+ 'commentsandwhitespace': [
50
+ (r'\s+', Whitespace),
51
+ (r'<!--', Comment),
52
+ (r'//.*?$', Comment.Single),
53
+ (r'/\*.*?\*/', Comment.Multiline)
54
+ ],
55
+ 'slashstartsregex': [
56
+ include('commentsandwhitespace'),
57
+ (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
58
+ r'([gimuysd]+\b|\B)', String.Regex, '#pop'),
59
+ (r'(?=/)', Text, ('#pop', 'badregex')),
60
+ default('#pop')
61
+ ],
62
+ 'badregex': [
63
+ (r'\n', Whitespace, '#pop')
64
+ ],
65
+ 'root': [
66
+ (r'\A#! ?/.*?$', Comment.Hashbang), # recognized by node.js
67
+ (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
68
+ include('commentsandwhitespace'),
69
+
70
+ # Numeric literals
71
+ (r'0[bB][01]+n?', Number.Bin),
72
+ (r'0[oO]?[0-7]+n?', Number.Oct), # Browsers support "0o7" and "07" (< ES5) notations
73
+ (r'0[xX][0-9a-fA-F]+n?', Number.Hex),
74
+ (r'[0-9]+n', Number.Integer), # Javascript BigInt requires an "n" postfix
75
+ # Javascript doesn't have actual integer literals, so every other
76
+ # numeric literal is handled by the regex below (including "normal")
77
+ # integers
78
+ (r'(\.[0-9]+|[0-9]+\.[0-9]*|[0-9]+)([eE][-+]?[0-9]+)?', Number.Float),
79
+
80
+ (r'\.\.\.|=>', Punctuation),
81
+ (r'\+\+|--|~|\?\?=?|\?|:|\\(?=\n)|'
82
+ r'(<<|>>>?|==?|!=?|(?:\*\*|\|\||&&|[-<>+*%&|^/]))=?', Operator, 'slashstartsregex'),
83
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
84
+ (r'[})\].]', Punctuation),
85
+
86
+ (r'(typeof|instanceof|in|void|delete|new)\b', Operator.Word, 'slashstartsregex'),
87
+
88
+ # Match stuff like: constructor
89
+ (r'\b(constructor|from|as)\b', Keyword.Reserved),
90
+
91
+ (r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
92
+ r'throw|try|catch|finally|yield|await|async|this|of|static|export|'
93
+ r'import|debugger|extends|super)\b', Keyword, 'slashstartsregex'),
94
+ (r'(var|let|const|with|function|class)\b', Keyword.Declaration, 'slashstartsregex'),
95
+
96
+ (r'(abstract|boolean|byte|char|double|enum|final|float|goto|'
97
+ r'implements|int|interface|long|native|package|private|protected|'
98
+ r'public|short|synchronized|throws|transient|volatile)\b', Keyword.Reserved),
99
+ (r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
100
+
101
+ (r'(Array|Boolean|Date|BigInt|Function|Math|ArrayBuffer|'
102
+ r'Number|Object|RegExp|String|Promise|Proxy|decodeURI|'
103
+ r'decodeURIComponent|encodeURI|encodeURIComponent|'
104
+ r'eval|isFinite|isNaN|parseFloat|parseInt|DataView|'
105
+ r'document|window|globalThis|global|Symbol|Intl|'
106
+ r'WeakSet|WeakMap|Set|Map|Reflect|JSON|Atomics|'
107
+ r'Int(?:8|16|32)Array|BigInt64Array|Float32Array|Float64Array|'
108
+ r'Uint8ClampedArray|Uint(?:8|16|32)Array|BigUint64Array)\b', Name.Builtin),
109
+
110
+ (r'((?:Eval|Internal|Range|Reference|Syntax|Type|URI)?Error)\b', Name.Exception),
111
+
112
+ # Match stuff like: super(argument, list)
113
+ (r'(super)(\s*)(\([\w,?.$\s]+\s*\))',
114
+ bygroups(Keyword, Whitespace), 'slashstartsregex'),
115
+ # Match stuff like: function() {...}
116
+ (r'([a-zA-Z_?.$][\w?.$]*)(?=\(\) \{)', Name.Other, 'slashstartsregex'),
117
+
118
+ (JS_IDENT, Name.Other),
119
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
120
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
121
+ (r'`', String.Backtick, 'interp'),
122
+ # private identifier
123
+ (r'#[a-zA-Z_]\w*', Name),
124
+ ],
125
+ 'interp': [
126
+ (r'`', String.Backtick, '#pop'),
127
+ (r'\\.', String.Backtick),
128
+ (r'\$\{', String.Interpol, 'interp-inside'),
129
+ (r'\$', String.Backtick),
130
+ (r'[^`\\$]+', String.Backtick),
131
+ ],
132
+ 'interp-inside': [
133
+ # TODO: should this include single-line comments and allow nesting strings?
134
+ (r'\}', String.Interpol, '#pop'),
135
+ include('root'),
136
+ ],
137
+ }
138
+
139
+
140
+ class TypeScriptLexer(JavascriptLexer):
141
+ """
142
+ For TypeScript source code.
143
+ """
144
+
145
+ name = 'TypeScript'
146
+ url = 'https://www.typescriptlang.org/'
147
+ aliases = ['typescript', 'ts']
148
+ filenames = ['*.ts']
149
+ mimetypes = ['application/x-typescript', 'text/x-typescript']
150
+ version_added = '1.6'
151
+
152
+ # Higher priority than the TypoScriptLexer, as TypeScript is far more
153
+ # common these days
154
+ priority = 0.5
155
+
156
+ tokens = {
157
+ 'root': [
158
+ (r'(abstract|implements|private|protected|public|readonly)\b',
159
+ Keyword, 'slashstartsregex'),
160
+ (r'(enum|interface|override)\b', Keyword.Declaration, 'slashstartsregex'),
161
+ (r'\b(declare|type)\b', Keyword.Reserved),
162
+ # Match variable type keywords
163
+ (r'\b(string|boolean|number)\b', Keyword.Type),
164
+ # Match stuff like: module name {...}
165
+ (r'\b(module)(\s*)([\w?.$]+)(\s*)',
166
+ bygroups(Keyword.Reserved, Whitespace, Name.Other, Whitespace), 'slashstartsregex'),
167
+ # Match stuff like: (function: return type)
168
+ (r'([\w?.$]+)(\s*)(:)(\s*)([\w?.$]+)',
169
+ bygroups(Name.Other, Whitespace, Operator, Whitespace, Keyword.Type)),
170
+ # Match stuff like: Decorators
171
+ (r'@' + JS_IDENT, Keyword.Declaration),
172
+ inherit,
173
+ # private identifier
174
+ (r'#[a-zA-Z_]\w*', Name),
175
+ ],
176
+ }
177
+
178
+
179
+ class KalLexer(RegexLexer):
180
+ """
181
+ For Kal source code.
182
+ """
183
+
184
+ name = 'Kal'
185
+ url = 'http://rzimmerman.github.io/kal'
186
+ aliases = ['kal']
187
+ filenames = ['*.kal']
188
+ mimetypes = ['text/kal', 'application/kal']
189
+ version_added = '2.0'
190
+
191
+ flags = re.DOTALL
192
+ tokens = {
193
+ 'commentsandwhitespace': [
194
+ (r'\s+', Whitespace),
195
+ (r'###[^#].*?###', Comment.Multiline),
196
+ (r'(#(?!##[^#]).*?)(\n)', bygroups(Comment.Single, Whitespace)),
197
+ ],
198
+ 'functiondef': [
199
+ (r'([$a-zA-Z_][\w$]*)(\s*)', bygroups(Name.Function, Whitespace),
200
+ '#pop'),
201
+ include('commentsandwhitespace'),
202
+ ],
203
+ 'classdef': [
204
+ (r'\b(inherits)(\s+)(from)\b',
205
+ bygroups(Keyword, Whitespace, Keyword)),
206
+ (r'([$a-zA-Z_][\w$]*)(?=\s*\n)', Name.Class, '#pop'),
207
+ (r'[$a-zA-Z_][\w$]*\b', Name.Class),
208
+ include('commentsandwhitespace'),
209
+ ],
210
+ 'listcomprehension': [
211
+ (r'\]', Punctuation, '#pop'),
212
+ (r'\b(property|value)\b', Keyword),
213
+ include('root'),
214
+ ],
215
+ 'waitfor': [
216
+ (r'\n', Whitespace, '#pop'),
217
+ (r'\bfrom\b', Keyword),
218
+ include('root'),
219
+ ],
220
+ 'root': [
221
+ include('commentsandwhitespace'),
222
+ (r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
223
+ r'([gimuysd]+\b|\B)', String.Regex),
224
+ (r'\?|:|_(?=\n)|==?|!=|-(?!>)|[<>+*/-]=?',
225
+ Operator),
226
+ (r'\b(and|or|isnt|is|not|but|bitwise|mod|\^|xor|exists|'
227
+ r'doesnt\s+exist)\b', Operator.Word),
228
+ (r'(\([^()]+\))?(\s*)(>)',
229
+ bygroups(Name.Function, Whitespace, Punctuation)),
230
+ (r'[{(]', Punctuation),
231
+ (r'\[', Punctuation, 'listcomprehension'),
232
+ (r'[})\].,]', Punctuation),
233
+ (r'\b(function|method|task)\b', Keyword.Declaration, 'functiondef'),
234
+ (r'\bclass\b', Keyword.Declaration, 'classdef'),
235
+ (r'\b(safe(?=\s))?(\s*)(wait(?=\s))(\s+)(for)\b',
236
+ bygroups(Keyword, Whitespace, Keyword, Whitespace,
237
+ Keyword), 'waitfor'),
238
+ (r'\b(me|this)(\.[$a-zA-Z_][\w.$]*)?\b', Name.Variable.Instance),
239
+ (r'(?<![.$])(run)(\s+)(in)(\s+)(parallel)\b',
240
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword)),
241
+ (r'(?<![.$])(for)(\s+)(parallel|series)?\b',
242
+ bygroups(Keyword, Whitespace, Keyword)),
243
+ (r'(?<![.$])(except)(\s+)(when)?\b',
244
+ bygroups(Keyword, Whitespace, Keyword)),
245
+ (r'(?<![.$])(fail)(\s+)(with)?\b',
246
+ bygroups(Keyword, Whitespace, Keyword)),
247
+ (r'(?<![.$])(inherits)(\s+)(from)?\b',
248
+ bygroups(Keyword, Whitespace, Keyword)),
249
+ (r'(?<![.$])(for)(\s+)(parallel|series)?\b',
250
+ bygroups(Keyword, Whitespace, Keyword)),
251
+ (words((
252
+ 'in', 'of', 'while', 'until', 'break', 'return', 'continue',
253
+ 'when', 'if', 'unless', 'else', 'otherwise', 'throw', 'raise',
254
+ 'try', 'catch', 'finally', 'new', 'delete', 'typeof',
255
+ 'instanceof', 'super'), prefix=r'(?<![.$])', suffix=r'\b'),
256
+ Keyword),
257
+ (words((
258
+ 'true', 'false', 'yes', 'no', 'on', 'off', 'null', 'nothing',
259
+ 'none', 'NaN', 'Infinity', 'undefined'), prefix=r'(?<![.$])',
260
+ suffix=r'\b'), Keyword.Constant),
261
+ (words((
262
+ 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math',
263
+ 'Number', 'Object', 'RegExp', 'String', 'decodeURI',
264
+ 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'eval',
265
+ 'isFinite', 'isNaN', 'isSafeInteger', 'parseFloat', 'parseInt',
266
+ 'document', 'window', 'globalThis', 'Symbol', 'print'),
267
+ suffix=r'\b'), Name.Builtin),
268
+ (r'([$a-zA-Z_][\w.$]*)(\s*)(:|[+\-*/]?\=)?\b',
269
+ bygroups(Name.Variable, Whitespace, Operator)),
270
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
271
+ (r'0x[0-9a-fA-F]+', Number.Hex),
272
+ (r'[0-9]+', Number.Integer),
273
+ ('"""', String, 'tdqs'),
274
+ ("'''", String, 'tsqs'),
275
+ ('"', String, 'dqs'),
276
+ ("'", String, 'sqs'),
277
+ ],
278
+ 'strings': [
279
+ (r'[^#\\\'"]+', String),
280
+ # note that all kal strings are multi-line.
281
+ # hashmarks, quotes and backslashes must be parsed one at a time
282
+ ],
283
+ 'interpoling_string': [
284
+ (r'\}', String.Interpol, "#pop"),
285
+ include('root')
286
+ ],
287
+ 'dqs': [
288
+ (r'"', String, '#pop'),
289
+ (r'\\.|\'', String), # double-quoted string don't need ' escapes
290
+ (r'#\{', String.Interpol, "interpoling_string"),
291
+ include('strings')
292
+ ],
293
+ 'sqs': [
294
+ (r"'", String, '#pop'),
295
+ (r'#|\\.|"', String), # single quoted strings don't need " escapses
296
+ include('strings')
297
+ ],
298
+ 'tdqs': [
299
+ (r'"""', String, '#pop'),
300
+ (r'\\.|\'|"', String), # no need to escape quotes in triple-string
301
+ (r'#\{', String.Interpol, "interpoling_string"),
302
+ include('strings'),
303
+ ],
304
+ 'tsqs': [
305
+ (r"'''", String, '#pop'),
306
+ (r'#|\\.|\'|"', String), # no need to escape quotes in triple-strings
307
+ include('strings')
308
+ ],
309
+ }
310
+
311
+
312
+ class LiveScriptLexer(RegexLexer):
313
+ """
314
+ For LiveScript source code.
315
+ """
316
+
317
+ name = 'LiveScript'
318
+ url = 'https://livescript.net/'
319
+ aliases = ['livescript', 'live-script']
320
+ filenames = ['*.ls']
321
+ mimetypes = ['text/livescript']
322
+ version_added = '1.6'
323
+
324
+ flags = re.DOTALL
325
+ tokens = {
326
+ 'commentsandwhitespace': [
327
+ (r'\s+', Whitespace),
328
+ (r'/\*.*?\*/', Comment.Multiline),
329
+ (r'(#.*?)(\n)', bygroups(Comment.Single, Whitespace)),
330
+ ],
331
+ 'multilineregex': [
332
+ include('commentsandwhitespace'),
333
+ (r'//([gimuysd]+\b|\B)', String.Regex, '#pop'),
334
+ (r'/', String.Regex),
335
+ (r'[^/#]+', String.Regex)
336
+ ],
337
+ 'slashstartsregex': [
338
+ include('commentsandwhitespace'),
339
+ (r'//', String.Regex, ('#pop', 'multilineregex')),
340
+ (r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
341
+ r'([gimuysd]+\b|\B)', String.Regex, '#pop'),
342
+ (r'/', Operator, '#pop'),
343
+ default('#pop'),
344
+ ],
345
+ 'root': [
346
+ (r'\A(?=\s|/)', Text, 'slashstartsregex'),
347
+ include('commentsandwhitespace'),
348
+ (r'(?:\([^()]+\))?[ ]*[~-]{1,2}>|'
349
+ r'(?:\(?[^()\n]+\)?)?[ ]*<[~-]{1,2}', Name.Function),
350
+ (r'\+\+|&&|(?<![.$])\b(?:and|x?or|is|isnt|not)\b|\?|:|=|'
351
+ r'\|\||\\(?=\n)|(<<|>>>?|==?|!=?|'
352
+ r'~(?!\~?>)|-(?!\-?>)|<(?!\[)|(?<!\])>|'
353
+ r'[+*`%&|^/])=?',
354
+ Operator, 'slashstartsregex'),
355
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
356
+ (r'[})\].]', Punctuation),
357
+ (r'(?<![.$])(for|own|in|of|while|until|loop|break|'
358
+ r'return|continue|switch|when|then|if|unless|else|'
359
+ r'throw|try|catch|finally|new|delete|typeof|instanceof|super|'
360
+ r'extends|this|class|by|const|var|to|til)\b', Keyword,
361
+ 'slashstartsregex'),
362
+ (r'(?<![.$])(true|false|yes|no|on|off|'
363
+ r'null|NaN|Infinity|undefined|void)\b',
364
+ Keyword.Constant),
365
+ (r'(Array|Boolean|Date|Error|Function|Math|'
366
+ r'Number|Object|RegExp|String|decodeURI|'
367
+ r'decodeURIComponent|encodeURI|encodeURIComponent|'
368
+ r'eval|isFinite|isNaN|parseFloat|parseInt|document|window|'
369
+ r'globalThis|Symbol|Symbol|BigInt)\b', Name.Builtin),
370
+ (r'([$a-zA-Z_][\w.\-:$]*)(\s*)([:=])(\s+)',
371
+ bygroups(Name.Variable, Whitespace, Operator, Whitespace),
372
+ 'slashstartsregex'),
373
+ (r'(@[$a-zA-Z_][\w.\-:$]*)(\s*)([:=])(\s+)',
374
+ bygroups(Name.Variable.Instance, Whitespace, Operator,
375
+ Whitespace),
376
+ 'slashstartsregex'),
377
+ (r'@', Name.Other, 'slashstartsregex'),
378
+ (r'@?[$a-zA-Z_][\w-]*', Name.Other, 'slashstartsregex'),
379
+ (r'[0-9]+\.[0-9]+([eE][0-9]+)?[fd]?(?:[a-zA-Z_]+)?', Number.Float),
380
+ (r'[0-9]+(~[0-9a-z]+)?(?:[a-zA-Z_]+)?', Number.Integer),
381
+ ('"""', String, 'tdqs'),
382
+ ("'''", String, 'tsqs'),
383
+ ('"', String, 'dqs'),
384
+ ("'", String, 'sqs'),
385
+ (r'\\\S+', String),
386
+ (r'<\[.*?\]>', String),
387
+ ],
388
+ 'strings': [
389
+ (r'[^#\\\'"]+', String),
390
+ # note that all coffee script strings are multi-line.
391
+ # hashmarks, quotes and backslashes must be parsed one at a time
392
+ ],
393
+ 'interpoling_string': [
394
+ (r'\}', String.Interpol, "#pop"),
395
+ include('root')
396
+ ],
397
+ 'dqs': [
398
+ (r'"', String, '#pop'),
399
+ (r'\\.|\'', String), # double-quoted string don't need ' escapes
400
+ (r'#\{', String.Interpol, "interpoling_string"),
401
+ (r'#', String),
402
+ include('strings')
403
+ ],
404
+ 'sqs': [
405
+ (r"'", String, '#pop'),
406
+ (r'#|\\.|"', String), # single quoted strings don't need " escapses
407
+ include('strings')
408
+ ],
409
+ 'tdqs': [
410
+ (r'"""', String, '#pop'),
411
+ (r'\\.|\'|"', String), # no need to escape quotes in triple-string
412
+ (r'#\{', String.Interpol, "interpoling_string"),
413
+ (r'#', String),
414
+ include('strings'),
415
+ ],
416
+ 'tsqs': [
417
+ (r"'''", String, '#pop'),
418
+ (r'#|\\.|\'|"', String), # no need to escape quotes in triple-strings
419
+ include('strings')
420
+ ],
421
+ }
422
+
423
+
424
+ class DartLexer(RegexLexer):
425
+ """
426
+ For Dart source code.
427
+ """
428
+
429
+ name = 'Dart'
430
+ url = 'http://dart.dev/'
431
+ aliases = ['dart']
432
+ filenames = ['*.dart']
433
+ mimetypes = ['text/x-dart']
434
+ version_added = '1.5'
435
+
436
+ flags = re.MULTILINE | re.DOTALL
437
+
438
+ tokens = {
439
+ 'root': [
440
+ include('string_literal'),
441
+ (r'#!(.*?)$', Comment.Preproc),
442
+ (r'\b(import|export)\b', Keyword, 'import_decl'),
443
+ (r'\b(library|source|part of|part)\b', Keyword),
444
+ (r'[^\S\n]+', Whitespace),
445
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
446
+ (r'/\*.*?\*/', Comment.Multiline),
447
+ (r'\b(class|extension|mixin)\b(\s+)',
448
+ bygroups(Keyword.Declaration, Whitespace), 'class'),
449
+ (r'\b(as|assert|break|case|catch|const|continue|default|do|else|finally|'
450
+ r'for|if|in|is|new|rethrow|return|super|switch|this|throw|try|while)\b',
451
+ Keyword),
452
+ (r'\b(abstract|async|await|const|covariant|extends|external|factory|final|'
453
+ r'get|implements|late|native|on|operator|required|set|static|sync|typedef|'
454
+ r'var|with|yield)\b', Keyword.Declaration),
455
+ (r'\b(bool|double|dynamic|int|num|Function|Never|Null|Object|String|void)\b',
456
+ Keyword.Type),
457
+ (r'\b(false|null|true)\b', Keyword.Constant),
458
+ (r'[~!%^&*+=|?:<>/-]|as\b', Operator),
459
+ (r'@[a-zA-Z_$]\w*', Name.Decorator),
460
+ (r'[a-zA-Z_$]\w*:', Name.Label),
461
+ (r'[a-zA-Z_$]\w*', Name),
462
+ (r'[(){}\[\],.;]', Punctuation),
463
+ (r'0[xX][0-9a-fA-F]+', Number.Hex),
464
+ # DIGIT+ (‘.’ DIGIT*)? EXPONENT?
465
+ (r'\d+(\.\d*)?([eE][+-]?\d+)?', Number),
466
+ (r'\.\d+([eE][+-]?\d+)?', Number), # ‘.’ DIGIT+ EXPONENT?
467
+ (r'\n', Whitespace)
468
+ # pseudo-keyword negate intentionally left out
469
+ ],
470
+ 'class': [
471
+ (r'[a-zA-Z_$]\w*', Name.Class, '#pop')
472
+ ],
473
+ 'import_decl': [
474
+ include('string_literal'),
475
+ (r'\s+', Whitespace),
476
+ (r'\b(as|deferred|show|hide)\b', Keyword),
477
+ (r'[a-zA-Z_$]\w*', Name),
478
+ (r'\,', Punctuation),
479
+ (r'\;', Punctuation, '#pop')
480
+ ],
481
+ 'string_literal': [
482
+ # Raw strings.
483
+ (r'r"""([\w\W]*?)"""', String.Double),
484
+ (r"r'''([\w\W]*?)'''", String.Single),
485
+ (r'r"(.*?)"', String.Double),
486
+ (r"r'(.*?)'", String.Single),
487
+ # Normal Strings.
488
+ (r'"""', String.Double, 'string_double_multiline'),
489
+ (r"'''", String.Single, 'string_single_multiline'),
490
+ (r'"', String.Double, 'string_double'),
491
+ (r"'", String.Single, 'string_single')
492
+ ],
493
+ 'string_common': [
494
+ (r"\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]*\}|[a-z'\"$\\])",
495
+ String.Escape),
496
+ (r'(\$)([a-zA-Z_]\w*)', bygroups(String.Interpol, Name)),
497
+ (r'(\$\{)(.*?)(\})',
498
+ bygroups(String.Interpol, using(this), String.Interpol))
499
+ ],
500
+ 'string_double': [
501
+ (r'"', String.Double, '#pop'),
502
+ (r'[^"$\\\n]+', String.Double),
503
+ include('string_common'),
504
+ (r'\$+', String.Double)
505
+ ],
506
+ 'string_double_multiline': [
507
+ (r'"""', String.Double, '#pop'),
508
+ (r'[^"$\\]+', String.Double),
509
+ include('string_common'),
510
+ (r'(\$|\")+', String.Double)
511
+ ],
512
+ 'string_single': [
513
+ (r"'", String.Single, '#pop'),
514
+ (r"[^'$\\\n]+", String.Single),
515
+ include('string_common'),
516
+ (r'\$+', String.Single)
517
+ ],
518
+ 'string_single_multiline': [
519
+ (r"'''", String.Single, '#pop'),
520
+ (r'[^\'$\\]+', String.Single),
521
+ include('string_common'),
522
+ (r'(\$|\')+', String.Single)
523
+ ]
524
+ }
525
+
526
+
527
+ class LassoLexer(RegexLexer):
528
+ """
529
+ For Lasso source code, covering both Lasso 9
530
+ syntax and LassoScript for Lasso 8.6 and earlier. For Lasso embedded in
531
+ HTML, use the `LassoHtmlLexer`.
532
+
533
+ Additional options accepted:
534
+
535
+ `builtinshighlighting`
536
+ If given and ``True``, highlight builtin types, traits, methods, and
537
+ members (default: ``True``).
538
+ `requiredelimiters`
539
+ If given and ``True``, only highlight code between delimiters as Lasso
540
+ (default: ``False``).
541
+ """
542
+
543
+ name = 'Lasso'
544
+ aliases = ['lasso', 'lassoscript']
545
+ filenames = ['*.lasso', '*.lasso[89]']
546
+ version_added = '1.6'
547
+ alias_filenames = ['*.incl', '*.inc', '*.las']
548
+ mimetypes = ['text/x-lasso']
549
+ url = 'https://www.lassosoft.com'
550
+
551
+ flags = re.IGNORECASE | re.DOTALL | re.MULTILINE
552
+
553
+ tokens = {
554
+ 'root': [
555
+ (r'^#![ \S]+lasso9\b', Comment.Preproc, 'lasso'),
556
+ (r'(?=\[|<)', Other, 'delimiters'),
557
+ (r'\s+', Whitespace),
558
+ default(('delimiters', 'lassofile')),
559
+ ],
560
+ 'delimiters': [
561
+ (r'\[no_square_brackets\]', Comment.Preproc, 'nosquarebrackets'),
562
+ (r'\[noprocess\]', Comment.Preproc, 'noprocess'),
563
+ (r'\[', Comment.Preproc, 'squarebrackets'),
564
+ (r'<\?(lasso(script)?|=)', Comment.Preproc, 'anglebrackets'),
565
+ (r'<(!--.*?-->)?', Other),
566
+ (r'[^[<]+', Other),
567
+ ],
568
+ 'nosquarebrackets': [
569
+ (r'\[noprocess\]', Comment.Preproc, 'noprocess'),
570
+ (r'\[', Other),
571
+ (r'<\?(lasso(script)?|=)', Comment.Preproc, 'anglebrackets'),
572
+ (r'<(!--.*?-->)?', Other),
573
+ (r'[^[<]+', Other),
574
+ ],
575
+ 'noprocess': [
576
+ (r'\[/noprocess\]', Comment.Preproc, '#pop'),
577
+ (r'\[', Other),
578
+ (r'[^[]', Other),
579
+ ],
580
+ 'squarebrackets': [
581
+ (r'\]', Comment.Preproc, '#pop'),
582
+ include('lasso'),
583
+ ],
584
+ 'anglebrackets': [
585
+ (r'\?>', Comment.Preproc, '#pop'),
586
+ include('lasso'),
587
+ ],
588
+ 'lassofile': [
589
+ (r'\]|\?>', Comment.Preproc, '#pop'),
590
+ include('lasso'),
591
+ ],
592
+ 'whitespacecomments': [
593
+ (r'\s+', Whitespace),
594
+ (r'(//.*?)(\s*)$', bygroups(Comment.Single, Whitespace)),
595
+ (r'/\*\*!.*?\*/', String.Doc),
596
+ (r'/\*.*?\*/', Comment.Multiline),
597
+ ],
598
+ 'lasso': [
599
+ # whitespace/comments
600
+ include('whitespacecomments'),
601
+
602
+ # literals
603
+ (r'\d*\.\d+(e[+-]?\d+)?', Number.Float),
604
+ (r'0x[\da-f]+', Number.Hex),
605
+ (r'\d+', Number.Integer),
606
+ (r'(infinity|NaN)\b', Number),
607
+ (r"'", String.Single, 'singlestring'),
608
+ (r'"', String.Double, 'doublestring'),
609
+ (r'`[^`]*`', String.Backtick),
610
+
611
+ # names
612
+ (r'\$[a-z_][\w.]*', Name.Variable),
613
+ (r'#([a-z_][\w.]*|\d+\b)', Name.Variable.Instance),
614
+ (r"(\.)(\s*)('[a-z_][\w.]*')",
615
+ bygroups(Name.Builtin.Pseudo, Whitespace, Name.Variable.Class)),
616
+ (r"(self)(\s*)(->)(\s*)('[a-z_][\w.]*')",
617
+ bygroups(Name.Builtin.Pseudo, Whitespace, Operator, Whitespace,
618
+ Name.Variable.Class)),
619
+ (r'(\.\.?)(\s*)([a-z_][\w.]*(=(?!=))?)',
620
+ bygroups(Name.Builtin.Pseudo, Whitespace, Name.Other.Member)),
621
+ (r'(->\\?|&)(\s*)([a-z_][\w.]*(=(?!=))?)',
622
+ bygroups(Operator, Whitespace, Name.Other.Member)),
623
+ (r'(?<!->)(self|inherited|currentcapture|givenblock)\b',
624
+ Name.Builtin.Pseudo),
625
+ (r'-(?!infinity)[a-z_][\w.]*', Name.Attribute),
626
+ (r'(::)(\s*)([a-z_][\w.]*)',
627
+ bygroups(Punctuation, Whitespace, Name.Label)),
628
+ (r'(error_(code|msg)_\w+|Error_AddError|Error_ColumnRestriction|'
629
+ r'Error_DatabaseConnectionUnavailable|Error_DatabaseTimeout|'
630
+ r'Error_DeleteError|Error_FieldRestriction|Error_FileNotFound|'
631
+ r'Error_InvalidDatabase|Error_InvalidPassword|'
632
+ r'Error_InvalidUsername|Error_ModuleNotFound|'
633
+ r'Error_NoError|Error_NoPermission|Error_OutOfMemory|'
634
+ r'Error_ReqColumnMissing|Error_ReqFieldMissing|'
635
+ r'Error_RequiredColumnMissing|Error_RequiredFieldMissing|'
636
+ r'Error_UpdateError)\b', Name.Exception),
637
+
638
+ # definitions
639
+ (r'(define)(\s+)([a-z_][\w.]*)(\s*)(=>)(\s*)(type|trait|thread)\b',
640
+ bygroups(Keyword.Declaration, Whitespace, Name.Class,
641
+ Whitespace, Operator, Whitespace, Keyword)),
642
+ (r'(define)(\s+)([a-z_][\w.]*)(\s*)(->)(\s*)([a-z_][\w.]*=?|[-+*/%])',
643
+ bygroups(Keyword.Declaration, Whitespace, Name.Class,
644
+ Whitespace, Operator, Whitespace, Name.Function),
645
+ 'signature'),
646
+ (r'(define)(\s+)([a-z_][\w.]*)',
647
+ bygroups(Keyword.Declaration, Whitespace, Name.Function), 'signature'),
648
+ (r'(public|protected|private|provide)(\s+)(([a-z_][\w.]*=?|[-+*/%])'
649
+ r'(?=\s*\())', bygroups(Keyword, Whitespace, Name.Function),
650
+ 'signature'),
651
+ (r'(public|protected|private|provide)(\s+)([a-z_][\w.]*)',
652
+ bygroups(Keyword, Whitespace, Name.Function)),
653
+
654
+ # keywords
655
+ (r'(true|false|none|minimal|full|all|void)\b', Keyword.Constant),
656
+ (r'(local|var|variable|global|data(?=\s))\b', Keyword.Declaration),
657
+ (r'(array|date|decimal|duration|integer|map|pair|string|tag|xml|'
658
+ r'null|boolean|bytes|keyword|list|locale|queue|set|stack|'
659
+ r'staticarray)\b', Keyword.Type),
660
+ (r'([a-z_][\w.]*)(\s+)(in)\b', bygroups(Name, Whitespace, Keyword)),
661
+ (r'(let|into)(\s+)([a-z_][\w.]*)', bygroups(Keyword, Whitespace, Name)),
662
+ (r'require\b', Keyword, 'requiresection'),
663
+ (r'(/?)(Namespace_Using)\b', bygroups(Punctuation, Keyword.Namespace)),
664
+ (r'(/?)(Cache|Database_Names|Database_SchemaNames|'
665
+ r'Database_TableNames|Define_Tag|Define_Type|Email_Batch|'
666
+ r'Encode_Set|HTML_Comment|Handle|Handle_Error|Header|If|Inline|'
667
+ r'Iterate|LJAX_Target|Link|Link_CurrentAction|Link_CurrentGroup|'
668
+ r'Link_CurrentRecord|Link_Detail|Link_FirstGroup|Link_FirstRecord|'
669
+ r'Link_LastGroup|Link_LastRecord|Link_NextGroup|Link_NextRecord|'
670
+ r'Link_PrevGroup|Link_PrevRecord|Log|Loop|Output_None|Portal|'
671
+ r'Private|Protect|Records|Referer|Referrer|Repeating|ResultSet|'
672
+ r'Rows|Search_Args|Search_Arguments|Select|Sort_Args|'
673
+ r'Sort_Arguments|Thread_Atomic|Value_List|While|Abort|Case|Else|'
674
+ r'Fail_If|Fail_IfNot|Fail|If_Empty|If_False|If_Null|If_True|'
675
+ r'Loop_Abort|Loop_Continue|Loop_Count|Params|Params_Up|Return|'
676
+ r'Return_Value|Run_Children|SOAP_DefineTag|SOAP_LastRequest|'
677
+ r'SOAP_LastResponse|Tag_Name|ascending|average|by|define|'
678
+ r'descending|do|equals|frozen|group|handle_failure|import|in|into|'
679
+ r'join|let|match|max|min|on|order|parent|protected|provide|public|'
680
+ r'require|returnhome|skip|split_thread|sum|take|thread|to|trait|'
681
+ r'type|where|with|yield|yieldhome)\b',
682
+ bygroups(Punctuation, Keyword)),
683
+
684
+ # other
685
+ (r',', Punctuation, 'commamember'),
686
+ (r'(and|or|not)\b', Operator.Word),
687
+ (r'([a-z_][\w.]*)(\s*)(::)(\s*)([a-z_][\w.]*)?(\s*=(?!=))',
688
+ bygroups(Name, Whitespace, Punctuation, Whitespace, Name.Label,
689
+ Operator)),
690
+ (r'(/?)([\w.]+)', bygroups(Punctuation, Name.Other)),
691
+ (r'(=)(n?bw|n?ew|n?cn|lte?|gte?|n?eq|n?rx|ft)\b',
692
+ bygroups(Operator, Operator.Word)),
693
+ (r':=|[-+*/%=<>&|!?\\]+', Operator),
694
+ (r'[{}():;,@^]', Punctuation),
695
+ ],
696
+ 'singlestring': [
697
+ (r"'", String.Single, '#pop'),
698
+ (r"[^'\\]+", String.Single),
699
+ include('escape'),
700
+ (r"\\", String.Single),
701
+ ],
702
+ 'doublestring': [
703
+ (r'"', String.Double, '#pop'),
704
+ (r'[^"\\]+', String.Double),
705
+ include('escape'),
706
+ (r'\\', String.Double),
707
+ ],
708
+ 'escape': [
709
+ (r'\\(U[\da-f]{8}|u[\da-f]{4}|x[\da-f]{1,2}|[0-7]{1,3}|:[^:\n\r]+:|'
710
+ r'[abefnrtv?"\'\\]|$)', String.Escape),
711
+ ],
712
+ 'signature': [
713
+ (r'=>', Operator, '#pop'),
714
+ (r'\)', Punctuation, '#pop'),
715
+ (r'[(,]', Punctuation, 'parameter'),
716
+ include('lasso'),
717
+ ],
718
+ 'parameter': [
719
+ (r'\)', Punctuation, '#pop'),
720
+ (r'-?[a-z_][\w.]*', Name.Attribute, '#pop'),
721
+ (r'\.\.\.', Name.Builtin.Pseudo),
722
+ include('lasso'),
723
+ ],
724
+ 'requiresection': [
725
+ (r'(([a-z_][\w.]*=?|[-+*/%])(?=\s*\())', Name, 'requiresignature'),
726
+ (r'(([a-z_][\w.]*=?|[-+*/%])(?=(\s*::\s*[\w.]+)?\s*,))', Name),
727
+ (r'[a-z_][\w.]*=?|[-+*/%]', Name, '#pop'),
728
+ (r'(::)(\s*)([a-z_][\w.]*)',
729
+ bygroups(Punctuation, Whitespace, Name.Label)),
730
+ (r',', Punctuation),
731
+ include('whitespacecomments'),
732
+ ],
733
+ 'requiresignature': [
734
+ (r'(\)(?=(\s*::\s*[\w.]+)?\s*,))', Punctuation, '#pop'),
735
+ (r'\)', Punctuation, '#pop:2'),
736
+ (r'-?[a-z_][\w.]*', Name.Attribute),
737
+ (r'(::)(\s*)([a-z_][\w.]*)',
738
+ bygroups(Punctuation, Whitespace, Name.Label)),
739
+ (r'\.\.\.', Name.Builtin.Pseudo),
740
+ (r'[(,]', Punctuation),
741
+ include('whitespacecomments'),
742
+ ],
743
+ 'commamember': [
744
+ (r'(([a-z_][\w.]*=?|[-+*/%])'
745
+ r'(?=\s*(\(([^()]*\([^()]*\))*[^)]*\)\s*)?(::[\w.\s]+)?=>))',
746
+ Name.Function, 'signature'),
747
+ include('whitespacecomments'),
748
+ default('#pop'),
749
+ ],
750
+ }
751
+
752
+ def __init__(self, **options):
753
+ self.builtinshighlighting = get_bool_opt(
754
+ options, 'builtinshighlighting', True)
755
+ self.requiredelimiters = get_bool_opt(
756
+ options, 'requiredelimiters', False)
757
+
758
+ self._builtins = set()
759
+ self._members = set()
760
+ if self.builtinshighlighting:
761
+ from pygments.lexers._lasso_builtins import BUILTINS, MEMBERS
762
+ for key, value in BUILTINS.items():
763
+ self._builtins.update(value)
764
+ for key, value in MEMBERS.items():
765
+ self._members.update(value)
766
+ RegexLexer.__init__(self, **options)
767
+
768
+ def get_tokens_unprocessed(self, text):
769
+ stack = ['root']
770
+ if self.requiredelimiters:
771
+ stack.append('delimiters')
772
+ for index, token, value in \
773
+ RegexLexer.get_tokens_unprocessed(self, text, stack):
774
+ if (token is Name.Other and value.lower() in self._builtins or
775
+ token is Name.Other.Member and
776
+ value.lower().rstrip('=') in self._members):
777
+ yield index, Name.Builtin, value
778
+ continue
779
+ yield index, token, value
780
+
781
+ def analyse_text(text):
782
+ rv = 0.0
783
+ if 'bin/lasso9' in text:
784
+ rv += 0.8
785
+ if re.search(r'<\?lasso', text, re.I):
786
+ rv += 0.4
787
+ if re.search(r'local\(', text, re.I):
788
+ rv += 0.4
789
+ return rv
790
+
791
+
792
+ class ObjectiveJLexer(RegexLexer):
793
+ """
794
+ For Objective-J source code with preprocessor directives.
795
+ """
796
+
797
+ name = 'Objective-J'
798
+ aliases = ['objective-j', 'objectivej', 'obj-j', 'objj']
799
+ filenames = ['*.j']
800
+ mimetypes = ['text/x-objective-j']
801
+ url = 'https://www.cappuccino.dev/learn/objective-j.html'
802
+ version_added = '1.3'
803
+
804
+ #: optional Comment or Whitespace
805
+ _ws = r'(?:\s|//[^\n]*\n|/[*](?:[^*]|[*][^/])*[*]/)*'
806
+
807
+ flags = re.DOTALL | re.MULTILINE
808
+
809
+ tokens = {
810
+ 'root': [
811
+ include('whitespace'),
812
+
813
+ # function definition
814
+ (r'^(' + _ws + r'[+-]' + _ws + r')([(a-zA-Z_].*?[^(])(' + _ws + r'\{)',
815
+ bygroups(using(this), using(this, state='function_signature'),
816
+ using(this))),
817
+
818
+ # class definition
819
+ (r'(@interface|@implementation)(\s+)', bygroups(Keyword, Whitespace),
820
+ 'classname'),
821
+ (r'(@class|@protocol)(\s*)', bygroups(Keyword, Whitespace),
822
+ 'forward_classname'),
823
+ (r'(\s*)(@end)(\s*)', bygroups(Whitespace, Keyword, Whitespace)),
824
+
825
+ include('statements'),
826
+ ('[{()}]', Punctuation),
827
+ (';', Punctuation),
828
+ ],
829
+ 'whitespace': [
830
+ (r'(@import)(\s+)("(?:\\\\|\\"|[^"])*")',
831
+ bygroups(Comment.Preproc, Whitespace, String.Double)),
832
+ (r'(@import)(\s+)(<(?:\\\\|\\>|[^>])*>)',
833
+ bygroups(Comment.Preproc, Whitespace, String.Double)),
834
+ (r'(#(?:include|import))(\s+)("(?:\\\\|\\"|[^"])*")',
835
+ bygroups(Comment.Preproc, Whitespace, String.Double)),
836
+ (r'(#(?:include|import))(\s+)(<(?:\\\\|\\>|[^>])*>)',
837
+ bygroups(Comment.Preproc, Whitespace, String.Double)),
838
+
839
+ (r'#if\s+0', Comment.Preproc, 'if0'),
840
+ (r'#', Comment.Preproc, 'macro'),
841
+
842
+ (r'\s+', Whitespace),
843
+ (r'(\\)(\n)',
844
+ bygroups(String.Escape, Whitespace)), # line continuation
845
+ (r'//(\n|(.|\n)*?[^\\]\n)', Comment.Single),
846
+ (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
847
+ (r'<!--', Comment),
848
+ ],
849
+ 'slashstartsregex': [
850
+ include('whitespace'),
851
+ (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
852
+ r'([gim]+\b|\B)', String.Regex, '#pop'),
853
+ (r'(?=/)', Text, ('#pop', 'badregex')),
854
+ default('#pop'),
855
+ ],
856
+ 'badregex': [
857
+ (r'\n', Whitespace, '#pop'),
858
+ ],
859
+ 'statements': [
860
+ (r'(L|@)?"', String, 'string'),
861
+ (r"(L|@)?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'",
862
+ String.Char),
863
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
864
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
865
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
866
+ (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
867
+ (r'0x[0-9a-fA-F]+[Ll]?', Number.Hex),
868
+ (r'0[0-7]+[Ll]?', Number.Oct),
869
+ (r'\d+[Ll]?', Number.Integer),
870
+
871
+ (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
872
+
873
+ (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
874
+ r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?',
875
+ Operator, 'slashstartsregex'),
876
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
877
+ (r'[})\].]', Punctuation),
878
+
879
+ (r'(for|in|while|do|break|return|continue|switch|case|default|if|'
880
+ r'else|throw|try|catch|finally|new|delete|typeof|instanceof|void|'
881
+ r'prototype|__proto__)\b', Keyword, 'slashstartsregex'),
882
+
883
+ (r'(var|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
884
+
885
+ (r'(@selector|@private|@protected|@public|@encode|'
886
+ r'@synchronized|@try|@throw|@catch|@finally|@end|@property|'
887
+ r'@synthesize|@dynamic|@for|@accessors|new)\b', Keyword),
888
+
889
+ (r'(int|long|float|short|double|char|unsigned|signed|void|'
890
+ r'id|BOOL|bool|boolean|IBOutlet|IBAction|SEL|@outlet|@action)\b',
891
+ Keyword.Type),
892
+
893
+ (r'(self|super)\b', Name.Builtin),
894
+
895
+ (r'(TRUE|YES|FALSE|NO|Nil|nil|NULL)\b', Keyword.Constant),
896
+ (r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
897
+ (r'(ABS|ASIN|ACOS|ATAN|ATAN2|SIN|COS|TAN|EXP|POW|CEIL|FLOOR|ROUND|'
898
+ r'MIN|MAX|RAND|SQRT|E|LN2|LN10|LOG2E|LOG10E|PI|PI2|PI_2|SQRT1_2|'
899
+ r'SQRT2)\b', Keyword.Constant),
900
+
901
+ (r'(Array|Boolean|Date|Error|Function|Math|'
902
+ r'Number|Object|RegExp|String|decodeURI|'
903
+ r'decodeURIComponent|encodeURI|encodeURIComponent|'
904
+ r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
905
+ r'window|globalThis|Symbol)\b', Name.Builtin),
906
+
907
+ (r'([$a-zA-Z_]\w*)(' + _ws + r')(?=\()',
908
+ bygroups(Name.Function, using(this))),
909
+
910
+ (r'[$a-zA-Z_]\w*', Name),
911
+ ],
912
+ 'classname': [
913
+ # interface definition that inherits
914
+ (r'([a-zA-Z_]\w*)(' + _ws + r':' + _ws +
915
+ r')([a-zA-Z_]\w*)?',
916
+ bygroups(Name.Class, using(this), Name.Class), '#pop'),
917
+ # interface definition for a category
918
+ (r'([a-zA-Z_]\w*)(' + _ws + r'\()([a-zA-Z_]\w*)(\))',
919
+ bygroups(Name.Class, using(this), Name.Label, Text), '#pop'),
920
+ # simple interface / implementation
921
+ (r'([a-zA-Z_]\w*)', Name.Class, '#pop'),
922
+ ],
923
+ 'forward_classname': [
924
+ (r'([a-zA-Z_]\w*)(\s*)(,)(\s*)',
925
+ bygroups(Name.Class, Whitespace, Text, Whitespace), '#push'),
926
+ (r'([a-zA-Z_]\w*)(\s*)(;?)',
927
+ bygroups(Name.Class, Whitespace, Text), '#pop'),
928
+ ],
929
+ 'function_signature': [
930
+ include('whitespace'),
931
+
932
+ # start of a selector w/ parameters
933
+ (r'(\(' + _ws + r')' # open paren
934
+ r'([a-zA-Z_]\w+)' # return type
935
+ r'(' + _ws + r'\)' + _ws + r')' # close paren
936
+ r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
937
+ bygroups(using(this), Keyword.Type, using(this),
938
+ Name.Function), 'function_parameters'),
939
+
940
+ # no-param function
941
+ (r'(\(' + _ws + r')' # open paren
942
+ r'([a-zA-Z_]\w+)' # return type
943
+ r'(' + _ws + r'\)' + _ws + r')' # close paren
944
+ r'([$a-zA-Z_]\w+)', # function name
945
+ bygroups(using(this), Keyword.Type, using(this),
946
+ Name.Function), "#pop"),
947
+
948
+ # no return type given, start of a selector w/ parameters
949
+ (r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
950
+ bygroups(Name.Function), 'function_parameters'),
951
+
952
+ # no return type given, no-param function
953
+ (r'([$a-zA-Z_]\w+)', # function name
954
+ bygroups(Name.Function), "#pop"),
955
+
956
+ default('#pop'),
957
+ ],
958
+ 'function_parameters': [
959
+ include('whitespace'),
960
+
961
+ # parameters
962
+ (r'(\(' + _ws + ')' # open paren
963
+ r'([^)]+)' # type
964
+ r'(' + _ws + r'\)' + _ws + r')' # close paren
965
+ r'([$a-zA-Z_]\w+)', # param name
966
+ bygroups(using(this), Keyword.Type, using(this), Text)),
967
+
968
+ # one piece of a selector name
969
+ (r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
970
+ Name.Function),
971
+
972
+ # smallest possible selector piece
973
+ (r'(:)', Name.Function),
974
+
975
+ # var args
976
+ (r'(,' + _ws + r'\.\.\.)', using(this)),
977
+
978
+ # param name
979
+ (r'([$a-zA-Z_]\w+)', Text),
980
+ ],
981
+ 'expression': [
982
+ (r'([$a-zA-Z_]\w*)(\()', bygroups(Name.Function,
983
+ Punctuation)),
984
+ (r'(\))', Punctuation, "#pop"),
985
+ ],
986
+ 'string': [
987
+ (r'"', String, '#pop'),
988
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
989
+ (r'[^\\"\n]+', String), # all other characters
990
+ (r'(\\)(\n)', bygroups(String.Escape, Whitespace)), # line continuation
991
+ (r'\\', String), # stray backslash
992
+ ],
993
+ 'macro': [
994
+ (r'[^/\n]+', Comment.Preproc),
995
+ (r'/[*](.|\n)*?[*]/', Comment.Multiline),
996
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace), '#pop'),
997
+ (r'/', Comment.Preproc),
998
+ (r'(?<=\\)\n', Whitespace),
999
+ (r'\n', Whitespace, '#pop'),
1000
+ ],
1001
+ 'if0': [
1002
+ (r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
1003
+ (r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
1004
+ (r'(.*?)(\n)', bygroups(Comment, Whitespace)),
1005
+ ]
1006
+ }
1007
+
1008
+ def analyse_text(text):
1009
+ if re.search(r'^\s*@import\s+[<"]', text, re.MULTILINE):
1010
+ # special directive found in most Objective-J files
1011
+ return True
1012
+ return False
1013
+
1014
+
1015
+ class CoffeeScriptLexer(RegexLexer):
1016
+ """
1017
+ For CoffeeScript source code.
1018
+ """
1019
+
1020
+ name = 'CoffeeScript'
1021
+ url = 'http://coffeescript.org'
1022
+ aliases = ['coffeescript', 'coffee-script', 'coffee']
1023
+ filenames = ['*.coffee']
1024
+ mimetypes = ['text/coffeescript']
1025
+ version_added = '1.3'
1026
+
1027
+ _operator_re = (
1028
+ r'\+\+|~|&&|\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|\?|:|'
1029
+ r'\|\||\\(?=\n)|'
1030
+ r'(<<|>>>?|==?(?!>)|!=?|=(?!>)|-(?!>)|[<>+*`%&|\^/])=?')
1031
+
1032
+ flags = re.DOTALL
1033
+ tokens = {
1034
+ 'commentsandwhitespace': [
1035
+ (r'\s+', Whitespace),
1036
+ (r'###[^#].*?###', Comment.Multiline),
1037
+ (r'(#(?!##[^#]).*?)(\n)', bygroups(Comment.Single, Whitespace)),
1038
+ ],
1039
+ 'multilineregex': [
1040
+ (r'[^/#]+', String.Regex),
1041
+ (r'///([gimuysd]+\b|\B)', String.Regex, '#pop'),
1042
+ (r'#\{', String.Interpol, 'interpoling_string'),
1043
+ (r'[/#]', String.Regex),
1044
+ ],
1045
+ 'slashstartsregex': [
1046
+ include('commentsandwhitespace'),
1047
+ (r'///', String.Regex, ('#pop', 'multilineregex')),
1048
+ (r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
1049
+ r'([gimuysd]+\b|\B)', String.Regex, '#pop'),
1050
+ # This isn't really guarding against mishighlighting well-formed
1051
+ # code, just the ability to infinite-loop between root and
1052
+ # slashstartsregex.
1053
+ (r'/', Operator, '#pop'),
1054
+ default('#pop'),
1055
+ ],
1056
+ 'root': [
1057
+ include('commentsandwhitespace'),
1058
+ (r'\A(?=\s|/)', Text, 'slashstartsregex'),
1059
+ (_operator_re, Operator, 'slashstartsregex'),
1060
+ (r'(?:\([^()]*\))?\s*[=-]>', Name.Function, 'slashstartsregex'),
1061
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
1062
+ (r'[})\].]', Punctuation),
1063
+ (r'(?<![.$])(for|own|in|of|while|until|'
1064
+ r'loop|break|return|continue|'
1065
+ r'switch|when|then|if|unless|else|'
1066
+ r'throw|try|catch|finally|new|delete|typeof|instanceof|super|'
1067
+ r'extends|this|class|by)\b', Keyword, 'slashstartsregex'),
1068
+ (r'(?<![.$])(true|false|yes|no|on|off|null|'
1069
+ r'NaN|Infinity|undefined)\b',
1070
+ Keyword.Constant),
1071
+ (r'(Array|Boolean|Date|Error|Function|Math|'
1072
+ r'Number|Object|RegExp|String|decodeURI|'
1073
+ r'decodeURIComponent|encodeURI|encodeURIComponent|'
1074
+ r'eval|isFinite|isNaN|parseFloat|parseInt|document|window|globalThis|Symbol)\b',
1075
+ Name.Builtin),
1076
+ (r'([$a-zA-Z_][\w.:$]*)(\s*)([:=])(\s+)',
1077
+ bygroups(Name.Variable, Whitespace, Operator, Whitespace),
1078
+ 'slashstartsregex'),
1079
+ (r'(@[$a-zA-Z_][\w.:$]*)(\s*)([:=])(\s+)',
1080
+ bygroups(Name.Variable.Instance, Whitespace, Operator, Whitespace),
1081
+ 'slashstartsregex'),
1082
+ (r'@', Name.Other, 'slashstartsregex'),
1083
+ (r'@?[$a-zA-Z_][\w$]*', Name.Other),
1084
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
1085
+ (r'0x[0-9a-fA-F]+', Number.Hex),
1086
+ (r'[0-9]+', Number.Integer),
1087
+ ('"""', String, 'tdqs'),
1088
+ ("'''", String, 'tsqs'),
1089
+ ('"', String, 'dqs'),
1090
+ ("'", String, 'sqs'),
1091
+ ],
1092
+ 'strings': [
1093
+ (r'[^#\\\'"]+', String),
1094
+ # note that all coffee script strings are multi-line.
1095
+ # hashmarks, quotes and backslashes must be parsed one at a time
1096
+ ],
1097
+ 'interpoling_string': [
1098
+ (r'\}', String.Interpol, "#pop"),
1099
+ include('root')
1100
+ ],
1101
+ 'dqs': [
1102
+ (r'"', String, '#pop'),
1103
+ (r'\\.|\'', String), # double-quoted string don't need ' escapes
1104
+ (r'#\{', String.Interpol, "interpoling_string"),
1105
+ (r'#', String),
1106
+ include('strings')
1107
+ ],
1108
+ 'sqs': [
1109
+ (r"'", String, '#pop'),
1110
+ (r'#|\\.|"', String), # single quoted strings don't need " escapses
1111
+ include('strings')
1112
+ ],
1113
+ 'tdqs': [
1114
+ (r'"""', String, '#pop'),
1115
+ (r'\\.|\'|"', String), # no need to escape quotes in triple-string
1116
+ (r'#\{', String.Interpol, "interpoling_string"),
1117
+ (r'#', String),
1118
+ include('strings'),
1119
+ ],
1120
+ 'tsqs': [
1121
+ (r"'''", String, '#pop'),
1122
+ (r'#|\\.|\'|"', String), # no need to escape quotes in triple-strings
1123
+ include('strings')
1124
+ ],
1125
+ }
1126
+
1127
+
1128
+ class MaskLexer(RegexLexer):
1129
+ """
1130
+ For Mask markup.
1131
+ """
1132
+ name = 'Mask'
1133
+ url = 'https://github.com/atmajs/MaskJS'
1134
+ aliases = ['mask']
1135
+ filenames = ['*.mask']
1136
+ mimetypes = ['text/x-mask']
1137
+ version_added = '2.0'
1138
+
1139
+ flags = re.MULTILINE | re.IGNORECASE | re.DOTALL
1140
+ tokens = {
1141
+ 'root': [
1142
+ (r'\s+', Whitespace),
1143
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
1144
+ (r'/\*.*?\*/', Comment.Multiline),
1145
+ (r'[{};>]', Punctuation),
1146
+ (r"'''", String, 'string-trpl-single'),
1147
+ (r'"""', String, 'string-trpl-double'),
1148
+ (r"'", String, 'string-single'),
1149
+ (r'"', String, 'string-double'),
1150
+ (r'([\w-]+)', Name.Tag, 'node'),
1151
+ (r'([^.#;{>\s]+)', Name.Class, 'node'),
1152
+ (r'(#[\w-]+)', Name.Function, 'node'),
1153
+ (r'(\.[\w-]+)', Name.Variable.Class, 'node')
1154
+ ],
1155
+ 'string-base': [
1156
+ (r'\\.', String.Escape),
1157
+ (r'~\[', String.Interpol, 'interpolation'),
1158
+ (r'.', String.Single),
1159
+ ],
1160
+ 'string-single': [
1161
+ (r"'", String.Single, '#pop'),
1162
+ include('string-base')
1163
+ ],
1164
+ 'string-double': [
1165
+ (r'"', String.Single, '#pop'),
1166
+ include('string-base')
1167
+ ],
1168
+ 'string-trpl-single': [
1169
+ (r"'''", String.Single, '#pop'),
1170
+ include('string-base')
1171
+ ],
1172
+ 'string-trpl-double': [
1173
+ (r'"""', String.Single, '#pop'),
1174
+ include('string-base')
1175
+ ],
1176
+ 'interpolation': [
1177
+ (r'\]', String.Interpol, '#pop'),
1178
+ (r'(\s*)(:)', bygroups(Whitespace, String.Interpol), 'expression'),
1179
+ (r'(\s*)(\w+)(:)', bygroups(Whitespace, Name.Other, Punctuation)),
1180
+ (r'[^\]]+', String.Interpol)
1181
+ ],
1182
+ 'expression': [
1183
+ (r'[^\]]+', using(JavascriptLexer), '#pop')
1184
+ ],
1185
+ 'node': [
1186
+ (r'\s+', Whitespace),
1187
+ (r'\.', Name.Variable.Class, 'node-class'),
1188
+ (r'\#', Name.Function, 'node-id'),
1189
+ (r'(style)([ \t]*)(=)',
1190
+ bygroups(Name.Attribute, Whitespace, Operator),
1191
+ 'node-attr-style-value'),
1192
+ (r'([\w:-]+)([ \t]*)(=)',
1193
+ bygroups(Name.Attribute, Whitespace, Operator),
1194
+ 'node-attr-value'),
1195
+ (r'[\w:-]+', Name.Attribute),
1196
+ (r'[>{;]', Punctuation, '#pop')
1197
+ ],
1198
+ 'node-class': [
1199
+ (r'[\w-]+', Name.Variable.Class),
1200
+ (r'~\[', String.Interpol, 'interpolation'),
1201
+ default('#pop')
1202
+ ],
1203
+ 'node-id': [
1204
+ (r'[\w-]+', Name.Function),
1205
+ (r'~\[', String.Interpol, 'interpolation'),
1206
+ default('#pop')
1207
+ ],
1208
+ 'node-attr-value': [
1209
+ (r'\s+', Whitespace),
1210
+ (r'\w+', Name.Variable, '#pop'),
1211
+ (r"'", String, 'string-single-pop2'),
1212
+ (r'"', String, 'string-double-pop2'),
1213
+ default('#pop')
1214
+ ],
1215
+ 'node-attr-style-value': [
1216
+ (r'\s+', Whitespace),
1217
+ (r"'", String.Single, 'css-single-end'),
1218
+ (r'"', String.Single, 'css-double-end'),
1219
+ include('node-attr-value')
1220
+ ],
1221
+ 'css-base': [
1222
+ (r'\s+', Whitespace),
1223
+ (r";", Punctuation),
1224
+ (r"[\w\-]+\s*:", Name.Builtin)
1225
+ ],
1226
+ 'css-single-end': [
1227
+ include('css-base'),
1228
+ (r"'", String.Single, '#pop:2'),
1229
+ (r"[^;']+", Name.Entity)
1230
+ ],
1231
+ 'css-double-end': [
1232
+ include('css-base'),
1233
+ (r'"', String.Single, '#pop:2'),
1234
+ (r'[^;"]+', Name.Entity)
1235
+ ],
1236
+ 'string-single-pop2': [
1237
+ (r"'", String.Single, '#pop:2'),
1238
+ include('string-base')
1239
+ ],
1240
+ 'string-double-pop2': [
1241
+ (r'"', String.Single, '#pop:2'),
1242
+ include('string-base')
1243
+ ],
1244
+ }
1245
+
1246
+
1247
+ class EarlGreyLexer(RegexLexer):
1248
+ """
1249
+ For Earl-Grey source code.
1250
+
1251
+ .. versionadded: 2.1
1252
+ """
1253
+
1254
+ name = 'Earl Grey'
1255
+ aliases = ['earl-grey', 'earlgrey', 'eg']
1256
+ filenames = ['*.eg']
1257
+ mimetypes = ['text/x-earl-grey']
1258
+ url = 'https://github.com/breuleux/earl-grey'
1259
+ version_added = ''
1260
+
1261
+ tokens = {
1262
+ 'root': [
1263
+ (r'\n', Whitespace),
1264
+ include('control'),
1265
+ (r'[^\S\n]+', Text),
1266
+ (r'(;;.*)(\n)', bygroups(Comment, Whitespace)),
1267
+ (r'[\[\]{}:(),;]', Punctuation),
1268
+ (r'(\\)(\n)', bygroups(String.Escape, Whitespace)),
1269
+ (r'\\', Text),
1270
+ include('errors'),
1271
+ (words((
1272
+ 'with', 'where', 'when', 'and', 'not', 'or', 'in',
1273
+ 'as', 'of', 'is'),
1274
+ prefix=r'(?<=\s|\[)', suffix=r'(?![\w$\-])'),
1275
+ Operator.Word),
1276
+ (r'[*@]?->', Name.Function),
1277
+ (r'[+\-*/~^<>%&|?!@#.]*=', Operator.Word),
1278
+ (r'\.{2,3}', Operator.Word), # Range Operator
1279
+ (r'([+*/~^<>&|?!]+)|([#\-](?=\s))|@@+(?=\s)|=+', Operator),
1280
+ (r'(?<![\w$\-])(var|let)(?:[^\w$])', Keyword.Declaration),
1281
+ include('keywords'),
1282
+ include('builtins'),
1283
+ include('assignment'),
1284
+ (r'''(?x)
1285
+ (?:()([a-zA-Z$_](?:[\w$\-]*[\w$])?)|
1286
+ (?<=[\s{\[(])(\.)([a-zA-Z$_](?:[\w$\-]*[\w$])?))
1287
+ (?=.*%)''',
1288
+ bygroups(Punctuation, Name.Tag, Punctuation, Name.Class.Start), 'dbs'),
1289
+ (r'[rR]?`', String.Backtick, 'bt'),
1290
+ (r'[rR]?```', String.Backtick, 'tbt'),
1291
+ (r'(?<=[\s\[{(,;])\.([a-zA-Z$_](?:[\w$\-]*[\w$])?)'
1292
+ r'(?=[\s\]}),;])', String.Symbol),
1293
+ include('nested'),
1294
+ (r'(?:[rR]|[rR]\.[gmi]{1,3})?"', String, combined('stringescape', 'dqs')),
1295
+ (r'(?:[rR]|[rR]\.[gmi]{1,3})?\'', String, combined('stringescape', 'sqs')),
1296
+ (r'"""', String, combined('stringescape', 'tdqs')),
1297
+ include('tuple'),
1298
+ include('import_paths'),
1299
+ include('name'),
1300
+ include('numbers'),
1301
+ ],
1302
+ 'dbs': [
1303
+ (r'(\.)([a-zA-Z$_](?:[\w$\-]*[\w$])?)(?=[.\[\s])',
1304
+ bygroups(Punctuation, Name.Class.DBS)),
1305
+ (r'(\[)([\^#][a-zA-Z$_](?:[\w$\-]*[\w$])?)(\])',
1306
+ bygroups(Punctuation, Name.Entity.DBS, Punctuation)),
1307
+ (r'\s+', Whitespace),
1308
+ (r'%', Operator.DBS, '#pop'),
1309
+ ],
1310
+ 'import_paths': [
1311
+ (r'(?<=[\s:;,])(\.{1,3}(?:[\w\-]*/)*)(\w(?:[\w\-]*\w)*)(?=[\s;,])',
1312
+ bygroups(Text.Whitespace, Text)),
1313
+ ],
1314
+ 'assignment': [
1315
+ (r'(\.)?([a-zA-Z$_](?:[\w$\-]*[\w$])?)'
1316
+ r'(?=\s+[+\-*/~^<>%&|?!@#.]*\=\s)',
1317
+ bygroups(Punctuation, Name.Variable))
1318
+ ],
1319
+ 'errors': [
1320
+ (words(('Error', 'TypeError', 'ReferenceError'),
1321
+ prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$.])'),
1322
+ Name.Exception),
1323
+ (r'''(?x)
1324
+ (?<![\w$])
1325
+ E\.[\w$](?:[\w$\-]*[\w$])?
1326
+ (?:\.[\w$](?:[\w$\-]*[\w$])?)*
1327
+ (?=[({\[?!\s])''',
1328
+ Name.Exception),
1329
+ ],
1330
+ 'control': [
1331
+ (r'''(?x)
1332
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)
1333
+ (?!\n)\s+
1334
+ (?!and|as|each\*|each|in|is|mod|of|or|when|where|with)
1335
+ (?=(?:[+\-*/~^<>%&|?!@#.])?[a-zA-Z$_](?:[\w$-]*[\w$])?)''',
1336
+ Keyword.Control),
1337
+ (r'([a-zA-Z$_](?:[\w$-]*[\w$])?)(?!\n)(\s+)(?=[\'"\d{\[(])',
1338
+ bygroups(Keyword.Control, Whitespace)),
1339
+ (r'''(?x)
1340
+ (?:
1341
+ (?<=[%=])|
1342
+ (?<=[=\-]>)|
1343
+ (?<=with|each|with)|
1344
+ (?<=each\*|where)
1345
+ )(\s+)
1346
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)(:)''',
1347
+ bygroups(Whitespace, Keyword.Control, Punctuation)),
1348
+ (r'''(?x)
1349
+ (?<![+\-*/~^<>%&|?!@#.])(\s+)
1350
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)(:)''',
1351
+ bygroups(Whitespace, Keyword.Control, Punctuation)),
1352
+ ],
1353
+ 'nested': [
1354
+ (r'''(?x)
1355
+ (?<=[\w$\]})])(\.)
1356
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)
1357
+ (?=\s+with(?:\s|\n))''',
1358
+ bygroups(Punctuation, Name.Function)),
1359
+ (r'''(?x)
1360
+ (?<!\s)(\.)
1361
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)
1362
+ (?=[}\]).,;:\s])''',
1363
+ bygroups(Punctuation, Name.Field)),
1364
+ (r'''(?x)
1365
+ (?<=[\w$\]})])(\.)
1366
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)
1367
+ (?=[\[{(:])''',
1368
+ bygroups(Punctuation, Name.Function)),
1369
+ ],
1370
+ 'keywords': [
1371
+ (words((
1372
+ 'each', 'each*', 'mod', 'await', 'break', 'chain',
1373
+ 'continue', 'elif', 'expr-value', 'if', 'match',
1374
+ 'return', 'yield', 'pass', 'else', 'require', 'var',
1375
+ 'let', 'async', 'method', 'gen'),
1376
+ prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$.])'),
1377
+ Keyword.Pseudo),
1378
+ (words(('this', 'self', '@'),
1379
+ prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$])'),
1380
+ Keyword.Constant),
1381
+ (words((
1382
+ 'Function', 'Object', 'Array', 'String', 'Number',
1383
+ 'Boolean', 'ErrorFactory', 'ENode', 'Promise'),
1384
+ prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$])'),
1385
+ Keyword.Type),
1386
+ ],
1387
+ 'builtins': [
1388
+ (words((
1389
+ 'send', 'object', 'keys', 'items', 'enumerate', 'zip',
1390
+ 'product', 'neighbours', 'predicate', 'equal',
1391
+ 'nequal', 'contains', 'repr', 'clone', 'range',
1392
+ 'getChecker', 'get-checker', 'getProperty', 'get-property',
1393
+ 'getProjector', 'get-projector', 'consume', 'take',
1394
+ 'promisify', 'spawn', 'constructor'),
1395
+ prefix=r'(?<![\w\-#.])', suffix=r'(?![\w\-.])'),
1396
+ Name.Builtin),
1397
+ (words((
1398
+ 'true', 'false', 'null', 'undefined'),
1399
+ prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$.])'),
1400
+ Name.Constant),
1401
+ ],
1402
+ 'name': [
1403
+ (r'@([a-zA-Z$_](?:[\w$-]*[\w$])?)', Name.Variable.Instance),
1404
+ (r'([a-zA-Z$_](?:[\w$-]*[\w$])?)(\+\+|\-\-)?',
1405
+ bygroups(Name.Symbol, Operator.Word))
1406
+ ],
1407
+ 'tuple': [
1408
+ (r'#[a-zA-Z_][\w\-]*(?=[\s{(,;])', Name.Namespace)
1409
+ ],
1410
+ 'interpoling_string': [
1411
+ (r'\}', String.Interpol, '#pop'),
1412
+ include('root')
1413
+ ],
1414
+ 'stringescape': [
1415
+ (r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
1416
+ r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
1417
+ ],
1418
+ 'strings': [
1419
+ (r'[^\\\'"]', String),
1420
+ (r'[\'"\\]', String),
1421
+ (r'\n', String) # All strings are multiline in EG
1422
+ ],
1423
+ 'dqs': [
1424
+ (r'"', String, '#pop'),
1425
+ (r'\\\\|\\"|\\\n', String.Escape),
1426
+ include('strings')
1427
+ ],
1428
+ 'sqs': [
1429
+ (r"'", String, '#pop'),
1430
+ (r"\\\\|\\'|\\\n", String.Escape),
1431
+ (r'\{', String.Interpol, 'interpoling_string'),
1432
+ include('strings')
1433
+ ],
1434
+ 'tdqs': [
1435
+ (r'"""', String, '#pop'),
1436
+ include('strings'),
1437
+ ],
1438
+ 'bt': [
1439
+ (r'`', String.Backtick, '#pop'),
1440
+ (r'(?<!`)\n', String.Backtick),
1441
+ (r'\^=?', String.Escape),
1442
+ (r'.+', String.Backtick),
1443
+ ],
1444
+ 'tbt': [
1445
+ (r'```', String.Backtick, '#pop'),
1446
+ (r'\n', String.Backtick),
1447
+ (r'\^=?', String.Escape),
1448
+ (r'[^`]+', String.Backtick),
1449
+ ],
1450
+ 'numbers': [
1451
+ (r'\d+\.(?!\.)\d*([eE][+-]?[0-9]+)?', Number.Float),
1452
+ (r'\d+[eE][+-]?[0-9]+', Number.Float),
1453
+ (r'8r[0-7]+', Number.Oct),
1454
+ (r'2r[01]+', Number.Bin),
1455
+ (r'16r[a-fA-F0-9]+', Number.Hex),
1456
+ (r'([3-79]|[12][0-9]|3[0-6])r[a-zA-Z\d]+(\.[a-zA-Z\d]+)?',
1457
+ Number.Radix),
1458
+ (r'\d+', Number.Integer)
1459
+ ],
1460
+ }
1461
+
1462
+
1463
+ class JuttleLexer(RegexLexer):
1464
+ """
1465
+ For Juttle source code.
1466
+ """
1467
+
1468
+ name = 'Juttle'
1469
+ url = 'http://juttle.github.io/'
1470
+ aliases = ['juttle']
1471
+ filenames = ['*.juttle']
1472
+ mimetypes = ['application/juttle', 'application/x-juttle',
1473
+ 'text/x-juttle', 'text/juttle']
1474
+ version_added = '2.2'
1475
+
1476
+ flags = re.DOTALL | re.MULTILINE
1477
+
1478
+ tokens = {
1479
+ 'commentsandwhitespace': [
1480
+ (r'\s+', Whitespace),
1481
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
1482
+ (r'/\*.*?\*/', Comment.Multiline)
1483
+ ],
1484
+ 'slashstartsregex': [
1485
+ include('commentsandwhitespace'),
1486
+ (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
1487
+ r'([gimuysd]+\b|\B)', String.Regex, '#pop'),
1488
+ (r'(?=/)', Text, ('#pop', 'badregex')),
1489
+ default('#pop')
1490
+ ],
1491
+ 'badregex': [
1492
+ (r'\n', Text, '#pop')
1493
+ ],
1494
+ 'root': [
1495
+ (r'^(?=\s|/)', Text, 'slashstartsregex'),
1496
+ include('commentsandwhitespace'),
1497
+ (r':\d{2}:\d{2}:\d{2}(\.\d*)?:', String.Moment),
1498
+ (r':(now|beginning|end|forever|yesterday|today|tomorrow|'
1499
+ r'(\d+(\.\d*)?|\.\d+)(ms|[smhdwMy])?):', String.Moment),
1500
+ (r':\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d*)?)?'
1501
+ r'(Z|[+-]\d{2}:\d{2}|[+-]\d{4})?:', String.Moment),
1502
+ (r':((\d+(\.\d*)?|\.\d+)[ ]+)?(millisecond|second|minute|hour|'
1503
+ r'day|week|month|year)[s]?'
1504
+ r'(([ ]+and[ ]+(\d+[ ]+)?(millisecond|second|minute|hour|'
1505
+ r'day|week|month|year)[s]?)'
1506
+ r'|[ ]+(ago|from[ ]+now))*:', String.Moment),
1507
+ (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
1508
+ r'(==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
1509
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
1510
+ (r'[})\].]', Punctuation),
1511
+ (r'(import|return|continue|if|else)\b', Keyword, 'slashstartsregex'),
1512
+ (r'(var|const|function|reducer|sub|input)\b', Keyword.Declaration,
1513
+ 'slashstartsregex'),
1514
+ (r'(batch|emit|filter|head|join|keep|pace|pass|put|read|reduce|remove|'
1515
+ r'sequence|skip|sort|split|tail|unbatch|uniq|view|write)\b',
1516
+ Keyword.Reserved),
1517
+ (r'(true|false|null|Infinity)\b', Keyword.Constant),
1518
+ (r'(Array|Date|Juttle|Math|Number|Object|RegExp|String)\b',
1519
+ Name.Builtin),
1520
+ (JS_IDENT, Name.Other),
1521
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
1522
+ (r'[0-9]+', Number.Integer),
1523
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
1524
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
1525
+ ]
1526
+
1527
+ }
1528
+
1529
+
1530
+ class NodeConsoleLexer(Lexer):
1531
+ """
1532
+ For parsing within an interactive Node.js REPL, such as:
1533
+
1534
+ .. sourcecode:: nodejsrepl
1535
+
1536
+ > let a = 3
1537
+ undefined
1538
+ > a
1539
+ 3
1540
+ > let b = '4'
1541
+ undefined
1542
+ > b
1543
+ '4'
1544
+ > b == a
1545
+ false
1546
+
1547
+ .. versionadded: 2.10
1548
+ """
1549
+ name = 'Node.js REPL console session'
1550
+ aliases = ['nodejsrepl', ]
1551
+ mimetypes = ['text/x-nodejsrepl', ]
1552
+ url = 'https://nodejs.org'
1553
+ version_added = ''
1554
+
1555
+ def get_tokens_unprocessed(self, text):
1556
+ jslexer = JavascriptLexer(**self.options)
1557
+
1558
+ curcode = ''
1559
+ insertions = []
1560
+
1561
+ for match in line_re.finditer(text):
1562
+ line = match.group()
1563
+ if line.startswith('> '):
1564
+ insertions.append((len(curcode),
1565
+ [(0, Generic.Prompt, line[:1]),
1566
+ (1, Whitespace, line[1:2])]))
1567
+
1568
+ curcode += line[2:]
1569
+ elif line.startswith('...'):
1570
+ # node does a nested ... thing depending on depth
1571
+ code = line.lstrip('.')
1572
+ lead = len(line) - len(code)
1573
+
1574
+ insertions.append((len(curcode),
1575
+ [(0, Generic.Prompt, line[:lead])]))
1576
+
1577
+ curcode += code
1578
+ else:
1579
+ if curcode:
1580
+ yield from do_insertions(insertions,
1581
+ jslexer.get_tokens_unprocessed(curcode))
1582
+
1583
+ curcode = ''
1584
+ insertions = []
1585
+
1586
+ yield from do_insertions([],
1587
+ jslexer.get_tokens_unprocessed(line))
1588
+
1589
+ if curcode:
1590
+ yield from do_insertions(insertions,
1591
+ jslexer.get_tokens_unprocessed(curcode))
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/lean.py ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.lean
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Lean theorem prover.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, words, include
14
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
15
+ Number, Generic, Whitespace
16
+
17
+ __all__ = ['Lean3Lexer', 'Lean4Lexer']
18
+
19
+ class Lean3Lexer(RegexLexer):
20
+ """
21
+ For the Lean 3 theorem prover.
22
+ """
23
+ name = 'Lean'
24
+ url = 'https://leanprover-community.github.io/lean3'
25
+ aliases = ['lean', 'lean3']
26
+ filenames = ['*.lean']
27
+ mimetypes = ['text/x-lean', 'text/x-lean3']
28
+ version_added = '2.0'
29
+
30
+ # from https://github.com/leanprover/vscode-lean/blob/1589ca3a65e394b3789409707febbd2d166c9344/syntaxes/lean.json#L186C20-L186C217
31
+ _name_segment = (
32
+ "(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟]"
33
+ "(?:(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟0-9'ⁿ-₉ₐ-ₜᵢ-ᵪ])*")
34
+ _name = _name_segment + r"(\." + _name_segment + r")*"
35
+
36
+ tokens = {
37
+ 'expression': [
38
+ (r'\s+', Whitespace),
39
+ (r'/--', String.Doc, 'docstring'),
40
+ (r'/-', Comment, 'comment'),
41
+ (r'--.*?$', Comment.Single),
42
+ (words((
43
+ 'forall', 'fun', 'Pi', 'from', 'have', 'show', 'assume', 'suffices',
44
+ 'let', 'if', 'else', 'then', 'in', 'with', 'calc', 'match',
45
+ 'do'
46
+ ), prefix=r'\b', suffix=r'\b'), Keyword),
47
+ (words(('sorry', 'admit'), prefix=r'\b', suffix=r'\b'), Generic.Error),
48
+ (words(('Sort', 'Prop', 'Type'), prefix=r'\b', suffix=r'\b'), Keyword.Type),
49
+ (words((
50
+ '(', ')', ':', '{', '}', '[', ']', '⟨', '⟩', '‹', '›', '⦃', '⦄', ':=', ',',
51
+ )), Operator),
52
+ (_name, Name),
53
+ (r'``?' + _name, String.Symbol),
54
+ (r'0x[A-Za-z0-9]+', Number.Integer),
55
+ (r'0b[01]+', Number.Integer),
56
+ (r'\d+', Number.Integer),
57
+ (r'"', String.Double, 'string'),
58
+ (r"'(?:(\\[\\\"'nt])|(\\x[0-9a-fA-F]{2})|(\\u[0-9a-fA-F]{4})|.)'", String.Char),
59
+ (r'[~?][a-z][\w\']*:', Name.Variable),
60
+ (r'\S', Name.Builtin.Pseudo),
61
+ ],
62
+ 'root': [
63
+ (words((
64
+ 'import', 'renaming', 'hiding',
65
+ 'namespace',
66
+ 'local',
67
+ 'private', 'protected', 'section',
68
+ 'include', 'omit', 'section',
69
+ 'protected', 'export',
70
+ 'open',
71
+ 'attribute',
72
+ ), prefix=r'\b', suffix=r'\b'), Keyword.Namespace),
73
+ (words((
74
+ 'lemma', 'theorem', 'def', 'definition', 'example',
75
+ 'axiom', 'axioms', 'constant', 'constants',
76
+ 'universe', 'universes',
77
+ 'inductive', 'coinductive', 'structure', 'extends',
78
+ 'class', 'instance',
79
+ 'abbreviation',
80
+
81
+ 'noncomputable theory',
82
+
83
+ 'noncomputable', 'mutual', 'meta',
84
+
85
+ 'attribute',
86
+
87
+ 'parameter', 'parameters',
88
+ 'variable', 'variables',
89
+
90
+ 'reserve', 'precedence',
91
+ 'postfix', 'prefix', 'notation', 'infix', 'infixl', 'infixr',
92
+
93
+ 'begin', 'by', 'end',
94
+
95
+ 'set_option',
96
+ 'run_cmd',
97
+ ), prefix=r'\b', suffix=r'\b'), Keyword.Declaration),
98
+ (r'@\[', Keyword.Declaration, 'attribute'),
99
+ (words((
100
+ '#eval', '#check', '#reduce', '#exit',
101
+ '#print', '#help',
102
+ ), suffix=r'\b'), Keyword),
103
+ include('expression')
104
+ ],
105
+ 'attribute': [
106
+ (r'\]', Keyword.Declaration, '#pop'),
107
+ include('expression'),
108
+ ],
109
+ 'comment': [
110
+ (r'[^/-]+', Comment.Multiline),
111
+ (r'/-', Comment.Multiline, '#push'),
112
+ (r'-/', Comment.Multiline, '#pop'),
113
+ (r'[/-]', Comment.Multiline)
114
+ ],
115
+ 'docstring': [
116
+ (r'[^/-]+', String.Doc),
117
+ (r'-/', String.Doc, '#pop'),
118
+ (r'[/-]', String.Doc)
119
+ ],
120
+ 'string': [
121
+ (r'[^\\"]+', String.Double),
122
+ (r"(?:(\\[\\\"'nt])|(\\x[0-9a-fA-F]{2})|(\\u[0-9a-fA-F]{4}))", String.Escape),
123
+ ('"', String.Double, '#pop'),
124
+ ],
125
+ }
126
+
127
+ def analyse_text(text):
128
+ if re.search(r'^import [a-z]', text, re.MULTILINE):
129
+ return 0.1
130
+
131
+
132
+ LeanLexer = Lean3Lexer
133
+
134
+
135
+ class Lean4Lexer(RegexLexer):
136
+ """
137
+ For the Lean 4 theorem prover.
138
+ """
139
+
140
+ name = 'Lean4'
141
+ url = 'https://github.com/leanprover/lean4'
142
+ aliases = ['lean4']
143
+ filenames = ['*.lean']
144
+ mimetypes = ['text/x-lean4']
145
+ version_added = '2.18'
146
+
147
+ # same as Lean3Lexer, with `!` and `?` allowed
148
+ _name_segment = (
149
+ "(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟]"
150
+ "(?:(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟0-9'ⁿ-₉ₐ-ₜᵢ-ᵪ!?])*")
151
+ _name = _name_segment + r"(\." + _name_segment + r")*"
152
+
153
+ keywords1 = (
154
+ 'import', 'unif_hint',
155
+ 'renaming', 'inline', 'hiding', 'lemma', 'variable',
156
+ 'theorem', 'axiom', 'inductive', 'structure', 'universe', 'alias',
157
+ '#help', 'precedence', 'postfix', 'prefix',
158
+ 'infix', 'infixl', 'infixr', 'notation', '#eval',
159
+ '#check', '#reduce', '#exit', 'end', 'private', 'using', 'namespace',
160
+ 'instance', 'section', 'protected',
161
+ 'export', 'set_option', 'extends', 'open', 'example',
162
+ '#print', 'opaque',
163
+ 'def', 'macro', 'elab', 'syntax', 'macro_rules', '#reduce', 'where',
164
+ 'abbrev', 'noncomputable', 'class', 'attribute', '#synth', 'mutual',
165
+ 'scoped', 'local',
166
+ )
167
+
168
+ keywords2 = (
169
+ 'forall', 'fun', 'obtain', 'from', 'have', 'show', 'assume',
170
+ 'let', 'if', 'else', 'then', 'by', 'in', 'with',
171
+ 'calc', 'match', 'nomatch', 'do', 'at',
172
+ )
173
+
174
+ keywords3 = (
175
+ # Sorts
176
+ 'Type', 'Prop', 'Sort',
177
+ )
178
+
179
+ operators = (
180
+ '!=', '#', '&', '&&', '*', '+', '-', '/', '@', '!',
181
+ '-.', '->', '.', '..', '...', '::', ':>', ';', ';;', '<',
182
+ '<-', '=', '==', '>', '_', '|', '||', '~', '=>', '<=', '>=',
183
+ '/\\', '\\/', '∀', 'Π', 'λ', '↔', '∧', '∨', '≠', '≤', '≥',
184
+ '¬', '⁻¹', '⬝', '▸', '→', '∃', '≈', '×', '⌞',
185
+ '⌟', '≡', '⟨', '⟩', "↦",
186
+ )
187
+
188
+ punctuation = ('(', ')', ':', '{', '}', '[', ']', '⦃', '⦄',
189
+ ':=', ',', ']\'', ']?', ']!')
190
+
191
+ tokens = {
192
+ 'expression': [
193
+ (r'\s+', Whitespace),
194
+ (r'/--', String.Doc, 'docstring'),
195
+ (r'/-', Comment, 'comment'),
196
+ (r'--.*$', Comment.Single),
197
+ (words(keywords3, prefix=r'\b', suffix=r'\b'), Keyword.Type),
198
+ (words(('sorry', 'admit'), prefix=r'\b', suffix=r'\b'), Generic.Error),
199
+ (words(operators), Name.Builtin.Pseudo),
200
+ (words(punctuation), Operator),
201
+ (_name_segment, Name),
202
+ (r'``?' + _name, String.Symbol),
203
+ (r'(?<=\.)\d+', Number),
204
+ (r'(\d+\.\d*)([eE][+-]?[0-9]+)?', Number.Float),
205
+ (r'\d+', Number.Integer),
206
+ (r'"', String.Double, 'string'),
207
+ (r'[~?][a-z][\w\']*:', Name.Variable),
208
+ (r'\S', Name.Builtin.Pseudo),
209
+ ],
210
+ 'root': [
211
+ (words(keywords1, prefix=r'\b', suffix=r'\b'), Keyword.Namespace),
212
+ (words(keywords2, prefix=r'\b', suffix=r'\b'), Keyword),
213
+ (r'@\[', Keyword.Declaration, 'attribute'),
214
+ include('expression')
215
+ ],
216
+ 'attribute': [
217
+ (r'\]', Keyword.Declaration, '#pop'),
218
+ include('expression'),
219
+ ],
220
+ 'comment': [
221
+ # Multiline Comments
222
+ (r'[^/-]+', Comment.Multiline),
223
+ (r'/-', Comment.Multiline, '#push'),
224
+ (r'-/', Comment.Multiline, '#pop'),
225
+ (r'[/-]', Comment.Multiline)
226
+ ],
227
+ 'docstring': [
228
+ (r'[^/-]+', String.Doc),
229
+ (r'-/', String.Doc, '#pop'),
230
+ (r'[/-]', String.Doc)
231
+ ],
232
+ 'string': [
233
+ (r'[^\\"]+', String.Double),
234
+ (r'\\[n"\\\n]', String.Escape),
235
+ ('"', String.Double, '#pop'),
236
+ ],
237
+ }
238
+
239
+ def analyse_text(text):
240
+ if re.search(r'^import [A-Z]', text, re.MULTILINE):
241
+ return 0.1
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/mojo.py ADDED
@@ -0,0 +1,707 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.mojo
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Mojo and related languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import keyword
12
+
13
+ from pygments import unistring as uni
14
+ from pygments.lexer import (
15
+ RegexLexer,
16
+ bygroups,
17
+ combined,
18
+ default,
19
+ include,
20
+ this,
21
+ using,
22
+ words,
23
+ )
24
+ from pygments.token import (
25
+ Comment,
26
+ # Error,
27
+ Keyword,
28
+ Name,
29
+ Number,
30
+ Operator,
31
+ Punctuation,
32
+ String,
33
+ Text,
34
+ Whitespace,
35
+ )
36
+ from pygments.util import shebang_matches
37
+
38
+ __all__ = ["MojoLexer"]
39
+
40
+
41
+ class MojoLexer(RegexLexer):
42
+ """
43
+ For Mojo source code (version 24.2.1).
44
+ """
45
+
46
+ name = "Mojo"
47
+ url = "https://docs.modular.com/mojo/"
48
+ aliases = ["mojo", "🔥"]
49
+ filenames = [
50
+ "*.mojo",
51
+ "*.🔥",
52
+ ]
53
+ mimetypes = [
54
+ "text/x-mojo",
55
+ "application/x-mojo",
56
+ ]
57
+ version_added = "2.18"
58
+
59
+ uni_name = f"[{uni.xid_start}][{uni.xid_continue}]*"
60
+
61
+ def innerstring_rules(ttype):
62
+ return [
63
+ # the old style '%s' % (...) string formatting (still valid in Py3)
64
+ (
65
+ r"%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?"
66
+ "[hlL]?[E-GXc-giorsaux%]",
67
+ String.Interpol,
68
+ ),
69
+ # the new style '{}'.format(...) string formatting
70
+ (
71
+ r"\{"
72
+ r"((\w+)((\.\w+)|(\[[^\]]+\]))*)?" # field name
73
+ r"(\![sra])?" # conversion
74
+ r"(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?"
75
+ r"\}",
76
+ String.Interpol,
77
+ ),
78
+ # backslashes, quotes and formatting signs must be parsed one at a time
79
+ (r'[^\\\'"%{\n]+', ttype),
80
+ (r'[\'"\\]', ttype),
81
+ # unhandled string formatting sign
82
+ (r"%|(\{{1,2})", ttype),
83
+ # newlines are an error (use "nl" state)
84
+ ]
85
+
86
+ def fstring_rules(ttype):
87
+ return [
88
+ # Assuming that a '}' is the closing brace after format specifier.
89
+ # Sadly, this means that we won't detect syntax error. But it's
90
+ # more important to parse correct syntax correctly, than to
91
+ # highlight invalid syntax.
92
+ (r"\}", String.Interpol),
93
+ (r"\{", String.Interpol, "expr-inside-fstring"),
94
+ # backslashes, quotes and formatting signs must be parsed one at a time
95
+ (r'[^\\\'"{}\n]+', ttype),
96
+ (r'[\'"\\]', ttype),
97
+ # newlines are an error (use "nl" state)
98
+ ]
99
+
100
+ tokens = {
101
+ "root": [
102
+ (r"\s+", Whitespace),
103
+ (
104
+ r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")',
105
+ bygroups(Whitespace, String.Affix, String.Doc),
106
+ ),
107
+ (
108
+ r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')",
109
+ bygroups(Whitespace, String.Affix, String.Doc),
110
+ ),
111
+ (r"\A#!.+$", Comment.Hashbang),
112
+ (r"#.*$", Comment.Single),
113
+ (r"\\\n", Whitespace),
114
+ (r"\\", Whitespace),
115
+ include("keywords"),
116
+ include("soft-keywords"),
117
+ # In the original PR, all the below here used ((?:\s|\\\s)+) to
118
+ # designate whitespace, but I can't find any example of this being
119
+ # needed in the example file, so we're replacing it with `\s+`.
120
+ (
121
+ r"(alias)(\s+)",
122
+ bygroups(Keyword, Whitespace),
123
+ "varname", # TODO varname the right fit?
124
+ ),
125
+ (r"(var)(\s+)", bygroups(Keyword, Whitespace), "varname"),
126
+ (r"(def)(\s+)", bygroups(Keyword, Whitespace), "funcname"),
127
+ (r"(fn)(\s+)", bygroups(Keyword, Whitespace), "funcname"),
128
+ (
129
+ r"(class)(\s+)",
130
+ bygroups(Keyword, Whitespace),
131
+ "classname",
132
+ ), # not implemented yet
133
+ (r"(struct)(\s+)", bygroups(Keyword, Whitespace), "structname"),
134
+ (r"(trait)(\s+)", bygroups(Keyword, Whitespace), "structname"),
135
+ (r"(from)(\s+)", bygroups(Keyword.Namespace, Whitespace), "fromimport"),
136
+ (r"(import)(\s+)", bygroups(Keyword.Namespace, Whitespace), "import"),
137
+ include("expr"),
138
+ ],
139
+ "expr": [
140
+ # raw f-strings
141
+ (
142
+ '(?i)(rf|fr)(""")',
143
+ bygroups(String.Affix, String.Double),
144
+ combined("rfstringescape", "tdqf"),
145
+ ),
146
+ (
147
+ "(?i)(rf|fr)(''')",
148
+ bygroups(String.Affix, String.Single),
149
+ combined("rfstringescape", "tsqf"),
150
+ ),
151
+ (
152
+ '(?i)(rf|fr)(")',
153
+ bygroups(String.Affix, String.Double),
154
+ combined("rfstringescape", "dqf"),
155
+ ),
156
+ (
157
+ "(?i)(rf|fr)(')",
158
+ bygroups(String.Affix, String.Single),
159
+ combined("rfstringescape", "sqf"),
160
+ ),
161
+ # non-raw f-strings
162
+ (
163
+ '([fF])(""")',
164
+ bygroups(String.Affix, String.Double),
165
+ combined("fstringescape", "tdqf"),
166
+ ),
167
+ (
168
+ "([fF])(''')",
169
+ bygroups(String.Affix, String.Single),
170
+ combined("fstringescape", "tsqf"),
171
+ ),
172
+ (
173
+ '([fF])(")',
174
+ bygroups(String.Affix, String.Double),
175
+ combined("fstringescape", "dqf"),
176
+ ),
177
+ (
178
+ "([fF])(')",
179
+ bygroups(String.Affix, String.Single),
180
+ combined("fstringescape", "sqf"),
181
+ ),
182
+ # raw bytes and strings
183
+ ('(?i)(rb|br|r)(""")', bygroups(String.Affix, String.Double), "tdqs"),
184
+ ("(?i)(rb|br|r)(''')", bygroups(String.Affix, String.Single), "tsqs"),
185
+ ('(?i)(rb|br|r)(")', bygroups(String.Affix, String.Double), "dqs"),
186
+ ("(?i)(rb|br|r)(')", bygroups(String.Affix, String.Single), "sqs"),
187
+ # non-raw strings
188
+ (
189
+ '([uU]?)(""")',
190
+ bygroups(String.Affix, String.Double),
191
+ combined("stringescape", "tdqs"),
192
+ ),
193
+ (
194
+ "([uU]?)(''')",
195
+ bygroups(String.Affix, String.Single),
196
+ combined("stringescape", "tsqs"),
197
+ ),
198
+ (
199
+ '([uU]?)(")',
200
+ bygroups(String.Affix, String.Double),
201
+ combined("stringescape", "dqs"),
202
+ ),
203
+ (
204
+ "([uU]?)(')",
205
+ bygroups(String.Affix, String.Single),
206
+ combined("stringescape", "sqs"),
207
+ ),
208
+ # non-raw bytes
209
+ (
210
+ '([bB])(""")',
211
+ bygroups(String.Affix, String.Double),
212
+ combined("bytesescape", "tdqs"),
213
+ ),
214
+ (
215
+ "([bB])(''')",
216
+ bygroups(String.Affix, String.Single),
217
+ combined("bytesescape", "tsqs"),
218
+ ),
219
+ (
220
+ '([bB])(")',
221
+ bygroups(String.Affix, String.Double),
222
+ combined("bytesescape", "dqs"),
223
+ ),
224
+ (
225
+ "([bB])(')",
226
+ bygroups(String.Affix, String.Single),
227
+ combined("bytesescape", "sqs"),
228
+ ),
229
+ (r"[^\S\n]+", Text),
230
+ include("numbers"),
231
+ (r"!=|==|<<|>>|:=|[-~+/*%=<>&^|.]", Operator),
232
+ (r"([]{}:\(\),;[])+", Punctuation),
233
+ (r"(in|is|and|or|not)\b", Operator.Word),
234
+ include("expr-keywords"),
235
+ include("builtins"),
236
+ include("magicfuncs"),
237
+ include("magicvars"),
238
+ include("name"),
239
+ ],
240
+ "expr-inside-fstring": [
241
+ (r"[{([]", Punctuation, "expr-inside-fstring-inner"),
242
+ # without format specifier
243
+ (
244
+ r"(=\s*)?" # debug (https://bugs.python.org/issue36817)
245
+ r"(\![sraf])?" # conversion
246
+ r"\}",
247
+ String.Interpol,
248
+ "#pop",
249
+ ),
250
+ # with format specifier
251
+ # we'll catch the remaining '}' in the outer scope
252
+ (
253
+ r"(=\s*)?" # debug (https://bugs.python.org/issue36817)
254
+ r"(\![sraf])?" # conversion
255
+ r":",
256
+ String.Interpol,
257
+ "#pop",
258
+ ),
259
+ (r"\s+", Whitespace), # allow new lines
260
+ include("expr"),
261
+ ],
262
+ "expr-inside-fstring-inner": [
263
+ (r"[{([]", Punctuation, "expr-inside-fstring-inner"),
264
+ (r"[])}]", Punctuation, "#pop"),
265
+ (r"\s+", Whitespace), # allow new lines
266
+ include("expr"),
267
+ ],
268
+ "expr-keywords": [
269
+ # Based on https://docs.python.org/3/reference/expressions.html
270
+ (
271
+ words(
272
+ (
273
+ "async for", # TODO https://docs.modular.com/mojo/roadmap#no-async-for-or-async-with
274
+ "async with", # TODO https://docs.modular.com/mojo/roadmap#no-async-for-or-async-with
275
+ "await",
276
+ "else",
277
+ "for",
278
+ "if",
279
+ "lambda",
280
+ "yield",
281
+ "yield from",
282
+ ),
283
+ suffix=r"\b",
284
+ ),
285
+ Keyword,
286
+ ),
287
+ (words(("True", "False", "None"), suffix=r"\b"), Keyword.Constant),
288
+ ],
289
+ "keywords": [
290
+ (
291
+ words(
292
+ (
293
+ "assert",
294
+ "async",
295
+ "await",
296
+ "borrowed",
297
+ "break",
298
+ "continue",
299
+ "del",
300
+ "elif",
301
+ "else",
302
+ "except",
303
+ "finally",
304
+ "for",
305
+ "global",
306
+ "if",
307
+ "lambda",
308
+ "pass",
309
+ "raise",
310
+ "nonlocal",
311
+ "return",
312
+ "try",
313
+ "while",
314
+ "yield",
315
+ "yield from",
316
+ "as",
317
+ "with",
318
+ ),
319
+ suffix=r"\b",
320
+ ),
321
+ Keyword,
322
+ ),
323
+ (words(("True", "False", "None"), suffix=r"\b"), Keyword.Constant),
324
+ ],
325
+ "soft-keywords": [
326
+ # `match`, `case` and `_` soft keywords
327
+ (
328
+ r"(^[ \t]*)" # at beginning of line + possible indentation
329
+ r"(match|case)\b" # a possible keyword
330
+ r"(?![ \t]*(?:" # not followed by...
331
+ r"[:,;=^&|@~)\]}]|(?:" + # characters and keywords that mean this isn't
332
+ # pattern matching (but None/True/False is ok)
333
+ r"|".join(k for k in keyword.kwlist if k[0].islower())
334
+ + r")\b))",
335
+ bygroups(Whitespace, Keyword),
336
+ "soft-keywords-inner",
337
+ ),
338
+ ],
339
+ "soft-keywords-inner": [
340
+ # optional `_` keyword
341
+ (r"(\s+)([^\n_]*)(_\b)", bygroups(Whitespace, using(this), Keyword)),
342
+ default("#pop"),
343
+ ],
344
+ "builtins": [
345
+ (
346
+ words(
347
+ (
348
+ "__import__",
349
+ "abs",
350
+ "aiter",
351
+ "all",
352
+ "any",
353
+ "bin",
354
+ "bool",
355
+ "bytearray",
356
+ "breakpoint",
357
+ "bytes",
358
+ "callable",
359
+ "chr",
360
+ "classmethod",
361
+ "compile",
362
+ "complex",
363
+ "delattr",
364
+ "dict",
365
+ "dir",
366
+ "divmod",
367
+ "enumerate",
368
+ "eval",
369
+ "filter",
370
+ "float",
371
+ "format",
372
+ "frozenset",
373
+ "getattr",
374
+ "globals",
375
+ "hasattr",
376
+ "hash",
377
+ "hex",
378
+ "id",
379
+ "input",
380
+ "int",
381
+ "isinstance",
382
+ "issubclass",
383
+ "iter",
384
+ "len",
385
+ "list",
386
+ "locals",
387
+ "map",
388
+ "max",
389
+ "memoryview",
390
+ "min",
391
+ "next",
392
+ "object",
393
+ "oct",
394
+ "open",
395
+ "ord",
396
+ "pow",
397
+ "print",
398
+ "property",
399
+ "range",
400
+ "repr",
401
+ "reversed",
402
+ "round",
403
+ "set",
404
+ "setattr",
405
+ "slice",
406
+ "sorted",
407
+ "staticmethod",
408
+ "str",
409
+ "sum",
410
+ "super",
411
+ "tuple",
412
+ "type",
413
+ "vars",
414
+ "zip",
415
+ # Mojo builtin types: https://docs.modular.com/mojo/stdlib/builtin/
416
+ "AnyType",
417
+ "Coroutine",
418
+ "DType",
419
+ "Error",
420
+ "Int",
421
+ "List",
422
+ "ListLiteral",
423
+ "Scalar",
424
+ "Int8",
425
+ "UInt8",
426
+ "Int16",
427
+ "UInt16",
428
+ "Int32",
429
+ "UInt32",
430
+ "Int64",
431
+ "UInt64",
432
+ "BFloat16",
433
+ "Float16",
434
+ "Float32",
435
+ "Float64",
436
+ "SIMD",
437
+ "String",
438
+ "Tensor",
439
+ "Tuple",
440
+ "Movable",
441
+ "Copyable",
442
+ "CollectionElement",
443
+ ),
444
+ prefix=r"(?<!\.)",
445
+ suffix=r"\b",
446
+ ),
447
+ Name.Builtin,
448
+ ),
449
+ (r"(?<!\.)(self|Ellipsis|NotImplemented|cls)\b", Name.Builtin.Pseudo),
450
+ (
451
+ words(
452
+ ("Error",),
453
+ prefix=r"(?<!\.)",
454
+ suffix=r"\b",
455
+ ),
456
+ Name.Exception,
457
+ ),
458
+ ],
459
+ "magicfuncs": [
460
+ (
461
+ words(
462
+ (
463
+ "__abs__",
464
+ "__add__",
465
+ "__aenter__",
466
+ "__aexit__",
467
+ "__aiter__",
468
+ "__and__",
469
+ "__anext__",
470
+ "__await__",
471
+ "__bool__",
472
+ "__bytes__",
473
+ "__call__",
474
+ "__complex__",
475
+ "__contains__",
476
+ "__del__",
477
+ "__delattr__",
478
+ "__delete__",
479
+ "__delitem__",
480
+ "__dir__",
481
+ "__divmod__",
482
+ "__enter__",
483
+ "__eq__",
484
+ "__exit__",
485
+ "__float__",
486
+ "__floordiv__",
487
+ "__format__",
488
+ "__ge__",
489
+ "__get__",
490
+ "__getattr__",
491
+ "__getattribute__",
492
+ "__getitem__",
493
+ "__gt__",
494
+ "__hash__",
495
+ "__iadd__",
496
+ "__iand__",
497
+ "__ifloordiv__",
498
+ "__ilshift__",
499
+ "__imatmul__",
500
+ "__imod__",
501
+ "__imul__",
502
+ "__index__",
503
+ "__init__",
504
+ "__instancecheck__",
505
+ "__int__",
506
+ "__invert__",
507
+ "__ior__",
508
+ "__ipow__",
509
+ "__irshift__",
510
+ "__isub__",
511
+ "__iter__",
512
+ "__itruediv__",
513
+ "__ixor__",
514
+ "__le__",
515
+ "__len__",
516
+ "__length_hint__",
517
+ "__lshift__",
518
+ "__lt__",
519
+ "__matmul__",
520
+ "__missing__",
521
+ "__mod__",
522
+ "__mul__",
523
+ "__ne__",
524
+ "__neg__",
525
+ "__new__",
526
+ "__next__",
527
+ "__or__",
528
+ "__pos__",
529
+ "__pow__",
530
+ "__prepare__",
531
+ "__radd__",
532
+ "__rand__",
533
+ "__rdivmod__",
534
+ "__repr__",
535
+ "__reversed__",
536
+ "__rfloordiv__",
537
+ "__rlshift__",
538
+ "__rmatmul__",
539
+ "__rmod__",
540
+ "__rmul__",
541
+ "__ror__",
542
+ "__round__",
543
+ "__rpow__",
544
+ "__rrshift__",
545
+ "__rshift__",
546
+ "__rsub__",
547
+ "__rtruediv__",
548
+ "__rxor__",
549
+ "__set__",
550
+ "__setattr__",
551
+ "__setitem__",
552
+ "__str__",
553
+ "__sub__",
554
+ "__subclasscheck__",
555
+ "__truediv__",
556
+ "__xor__",
557
+ ),
558
+ suffix=r"\b",
559
+ ),
560
+ Name.Function.Magic,
561
+ ),
562
+ ],
563
+ "magicvars": [
564
+ (
565
+ words(
566
+ (
567
+ "__annotations__",
568
+ "__bases__",
569
+ "__class__",
570
+ "__closure__",
571
+ "__code__",
572
+ "__defaults__",
573
+ "__dict__",
574
+ "__doc__",
575
+ "__file__",
576
+ "__func__",
577
+ "__globals__",
578
+ "__kwdefaults__",
579
+ "__module__",
580
+ "__mro__",
581
+ "__name__",
582
+ "__objclass__",
583
+ "__qualname__",
584
+ "__self__",
585
+ "__slots__",
586
+ "__weakref__",
587
+ ),
588
+ suffix=r"\b",
589
+ ),
590
+ Name.Variable.Magic,
591
+ ),
592
+ ],
593
+ "numbers": [
594
+ (
595
+ r"(\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)"
596
+ r"([eE][+-]?\d(?:_?\d)*)?",
597
+ Number.Float,
598
+ ),
599
+ (r"\d(?:_?\d)*[eE][+-]?\d(?:_?\d)*j?", Number.Float),
600
+ (r"0[oO](?:_?[0-7])+", Number.Oct),
601
+ (r"0[bB](?:_?[01])+", Number.Bin),
602
+ (r"0[xX](?:_?[a-fA-F0-9])+", Number.Hex),
603
+ (r"\d(?:_?\d)*", Number.Integer),
604
+ ],
605
+ "name": [
606
+ (r"@" + uni_name, Name.Decorator),
607
+ (r"@", Operator), # new matrix multiplication operator
608
+ (uni_name, Name),
609
+ ],
610
+ "varname": [
611
+ (uni_name, Name.Variable, "#pop"),
612
+ ],
613
+ "funcname": [
614
+ include("magicfuncs"),
615
+ (uni_name, Name.Function, "#pop"),
616
+ default("#pop"),
617
+ ],
618
+ "classname": [
619
+ (uni_name, Name.Class, "#pop"),
620
+ ],
621
+ "structname": [
622
+ (uni_name, Name.Struct, "#pop"),
623
+ ],
624
+ "import": [
625
+ (r"(\s+)(as)(\s+)", bygroups(Whitespace, Keyword, Whitespace)),
626
+ (r"\.", Name.Namespace),
627
+ (uni_name, Name.Namespace),
628
+ (r"(\s*)(,)(\s*)", bygroups(Whitespace, Operator, Whitespace)),
629
+ default("#pop"), # all else: go back
630
+ ],
631
+ "fromimport": [
632
+ (r"(\s+)(import)\b", bygroups(Whitespace, Keyword.Namespace), "#pop"),
633
+ (r"\.", Name.Namespace),
634
+ # if None occurs here, it's "raise x from None", since None can
635
+ # never be a module name
636
+ (r"None\b", Keyword.Constant, "#pop"),
637
+ (uni_name, Name.Namespace),
638
+ default("#pop"),
639
+ ],
640
+ "rfstringescape": [
641
+ (r"\{\{", String.Escape),
642
+ (r"\}\}", String.Escape),
643
+ ],
644
+ "fstringescape": [
645
+ include("rfstringescape"),
646
+ include("stringescape"),
647
+ ],
648
+ "bytesescape": [
649
+ (r'\\([\\abfnrtv"\']|\n|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
650
+ ],
651
+ "stringescape": [
652
+ (r"\\(N\{.*?\}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8})", String.Escape),
653
+ include("bytesescape"),
654
+ ],
655
+ "fstrings-single": fstring_rules(String.Single),
656
+ "fstrings-double": fstring_rules(String.Double),
657
+ "strings-single": innerstring_rules(String.Single),
658
+ "strings-double": innerstring_rules(String.Double),
659
+ "dqf": [
660
+ (r'"', String.Double, "#pop"),
661
+ (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
662
+ include("fstrings-double"),
663
+ ],
664
+ "sqf": [
665
+ (r"'", String.Single, "#pop"),
666
+ (r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
667
+ include("fstrings-single"),
668
+ ],
669
+ "dqs": [
670
+ (r'"', String.Double, "#pop"),
671
+ (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
672
+ include("strings-double"),
673
+ ],
674
+ "sqs": [
675
+ (r"'", String.Single, "#pop"),
676
+ (r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
677
+ include("strings-single"),
678
+ ],
679
+ "tdqf": [
680
+ (r'"""', String.Double, "#pop"),
681
+ include("fstrings-double"),
682
+ (r"\n", String.Double),
683
+ ],
684
+ "tsqf": [
685
+ (r"'''", String.Single, "#pop"),
686
+ include("fstrings-single"),
687
+ (r"\n", String.Single),
688
+ ],
689
+ "tdqs": [
690
+ (r'"""', String.Double, "#pop"),
691
+ include("strings-double"),
692
+ (r"\n", String.Double),
693
+ ],
694
+ "tsqs": [
695
+ (r"'''", String.Single, "#pop"),
696
+ include("strings-single"),
697
+ (r"\n", String.Single),
698
+ ],
699
+ }
700
+
701
+ def analyse_text(text):
702
+ # TODO supported?
703
+ if shebang_matches(text, r"mojo?"):
704
+ return 1.0
705
+ if "import " in text[:1000]:
706
+ return 0.9
707
+ return 0
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ncl.py ADDED
@@ -0,0 +1,894 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ncl
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for NCAR Command Language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, words
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation
16
+
17
+ __all__ = ['NCLLexer']
18
+
19
+
20
+ class NCLLexer(RegexLexer):
21
+ """
22
+ Lexer for NCL code.
23
+ """
24
+ name = 'NCL'
25
+ aliases = ['ncl']
26
+ filenames = ['*.ncl']
27
+ mimetypes = ['text/ncl']
28
+ url = 'https://www.ncl.ucar.edu'
29
+ version_added = '2.2'
30
+
31
+ flags = re.MULTILINE
32
+
33
+ tokens = {
34
+ 'root': [
35
+ (r';.*\n', Comment),
36
+ include('strings'),
37
+ include('core'),
38
+ (r'[a-zA-Z_]\w*', Name),
39
+ include('nums'),
40
+ (r'[\s]+', Text),
41
+ ],
42
+ 'core': [
43
+ # Statements
44
+ (words((
45
+ 'begin', 'break', 'continue', 'create', 'defaultapp', 'do',
46
+ 'else', 'end', 'external', 'exit', 'True', 'False', 'file', 'function',
47
+ 'getvalues', 'graphic', 'group', 'if', 'list', 'load', 'local',
48
+ 'new', '_Missing', 'Missing', 'noparent', 'procedure',
49
+ 'quit', 'QUIT', 'Quit', 'record', 'return', 'setvalues', 'stop',
50
+ 'then', 'while'), prefix=r'\b', suffix=r'\s*\b'),
51
+ Keyword),
52
+
53
+ # Data Types
54
+ (words((
55
+ 'ubyte', 'uint', 'uint64', 'ulong', 'string', 'byte',
56
+ 'character', 'double', 'float', 'integer', 'int64', 'logical',
57
+ 'long', 'short', 'ushort', 'enumeric', 'numeric', 'snumeric'),
58
+ prefix=r'\b', suffix=r'\s*\b'),
59
+ Keyword.Type),
60
+
61
+ # Operators
62
+ (r'[\%^*+\-/<>]', Operator),
63
+
64
+ # punctuation:
65
+ (r'[\[\]():@$!&|.,\\{}]', Punctuation),
66
+ (r'[=:]', Punctuation),
67
+
68
+ # Intrinsics
69
+ (words((
70
+ 'abs', 'acos', 'addfile', 'addfiles', 'all', 'angmom_atm', 'any',
71
+ 'area_conserve_remap', 'area_hi2lores', 'area_poly_sphere',
72
+ 'asciiread', 'asciiwrite', 'asin', 'atan', 'atan2', 'attsetvalues',
73
+ 'avg', 'betainc', 'bin_avg', 'bin_sum', 'bw_bandpass_filter',
74
+ 'cancor', 'cbinread', 'cbinwrite', 'cd_calendar', 'cd_inv_calendar',
75
+ 'cdfbin_p', 'cdfbin_pr', 'cdfbin_s', 'cdfbin_xn', 'cdfchi_p',
76
+ 'cdfchi_x', 'cdfgam_p', 'cdfgam_x', 'cdfnor_p', 'cdfnor_x',
77
+ 'cdft_p', 'cdft_t', 'ceil', 'center_finite_diff',
78
+ 'center_finite_diff_n', 'cfftb', 'cfftf', 'cfftf_frq_reorder',
79
+ 'charactertodouble', 'charactertofloat', 'charactertointeger',
80
+ 'charactertolong', 'charactertoshort', 'charactertostring',
81
+ 'chartodouble', 'chartofloat', 'chartoint', 'chartointeger',
82
+ 'chartolong', 'chartoshort', 'chartostring', 'chiinv', 'clear',
83
+ 'color_index_to_rgba', 'conform', 'conform_dims', 'cos', 'cosh',
84
+ 'count_unique_values', 'covcorm', 'covcorm_xy', 'craybinnumrec',
85
+ 'craybinrecread', 'create_graphic', 'csa1', 'csa1d', 'csa1s',
86
+ 'csa1x', 'csa1xd', 'csa1xs', 'csa2', 'csa2d', 'csa2l', 'csa2ld',
87
+ 'csa2ls', 'csa2lx', 'csa2lxd', 'csa2lxs', 'csa2s', 'csa2x',
88
+ 'csa2xd', 'csa2xs', 'csa3', 'csa3d', 'csa3l', 'csa3ld', 'csa3ls',
89
+ 'csa3lx', 'csa3lxd', 'csa3lxs', 'csa3s', 'csa3x', 'csa3xd',
90
+ 'csa3xs', 'csc2s', 'csgetp', 'css2c', 'cssetp', 'cssgrid', 'csstri',
91
+ 'csvoro', 'cumsum', 'cz2ccm', 'datatondc', 'day_of_week',
92
+ 'day_of_year', 'days_in_month', 'default_fillvalue', 'delete',
93
+ 'depth_to_pres', 'destroy', 'determinant', 'dewtemp_trh',
94
+ 'dgeevx_lapack', 'dim_acumrun_n', 'dim_avg', 'dim_avg_n',
95
+ 'dim_avg_wgt', 'dim_avg_wgt_n', 'dim_cumsum', 'dim_cumsum_n',
96
+ 'dim_gamfit_n', 'dim_gbits', 'dim_max', 'dim_max_n', 'dim_median',
97
+ 'dim_median_n', 'dim_min', 'dim_min_n', 'dim_num', 'dim_num_n',
98
+ 'dim_numrun_n', 'dim_pqsort', 'dim_pqsort_n', 'dim_product',
99
+ 'dim_product_n', 'dim_rmsd', 'dim_rmsd_n', 'dim_rmvmean',
100
+ 'dim_rmvmean_n', 'dim_rmvmed', 'dim_rmvmed_n', 'dim_spi_n',
101
+ 'dim_standardize', 'dim_standardize_n', 'dim_stat4', 'dim_stat4_n',
102
+ 'dim_stddev', 'dim_stddev_n', 'dim_sum', 'dim_sum_n', 'dim_sum_wgt',
103
+ 'dim_sum_wgt_n', 'dim_variance', 'dim_variance_n', 'dimsizes',
104
+ 'doubletobyte', 'doubletochar', 'doubletocharacter',
105
+ 'doubletofloat', 'doubletoint', 'doubletointeger', 'doubletolong',
106
+ 'doubletoshort', 'dpres_hybrid_ccm', 'dpres_plevel', 'draw',
107
+ 'draw_color_palette', 'dsgetp', 'dsgrid2', 'dsgrid2d', 'dsgrid2s',
108
+ 'dsgrid3', 'dsgrid3d', 'dsgrid3s', 'dspnt2', 'dspnt2d', 'dspnt2s',
109
+ 'dspnt3', 'dspnt3d', 'dspnt3s', 'dssetp', 'dtrend', 'dtrend_msg',
110
+ 'dtrend_msg_n', 'dtrend_n', 'dtrend_quadratic',
111
+ 'dtrend_quadratic_msg_n', 'dv2uvf', 'dv2uvg', 'dz_height',
112
+ 'echo_off', 'echo_on', 'eof2data', 'eof_varimax', 'eofcor',
113
+ 'eofcor_pcmsg', 'eofcor_ts', 'eofcov', 'eofcov_pcmsg', 'eofcov_ts',
114
+ 'eofunc', 'eofunc_ts', 'eofunc_varimax', 'equiv_sample_size', 'erf',
115
+ 'erfc', 'esacr', 'esacv', 'esccr', 'esccv', 'escorc', 'escorc_n',
116
+ 'escovc', 'exit', 'exp', 'exp_tapersh', 'exp_tapersh_wgts',
117
+ 'exp_tapershC', 'ezfftb', 'ezfftb_n', 'ezfftf', 'ezfftf_n',
118
+ 'f2fosh', 'f2foshv', 'f2fsh', 'f2fshv', 'f2gsh', 'f2gshv', 'fabs',
119
+ 'fbindirread', 'fbindirwrite', 'fbinnumrec', 'fbinread',
120
+ 'fbinrecread', 'fbinrecwrite', 'fbinwrite', 'fft2db', 'fft2df',
121
+ 'fftshift', 'fileattdef', 'filechunkdimdef', 'filedimdef',
122
+ 'fileexists', 'filegrpdef', 'filevarattdef', 'filevarchunkdef',
123
+ 'filevarcompressleveldef', 'filevardef', 'filevardimsizes',
124
+ 'filwgts_lancos', 'filwgts_lanczos', 'filwgts_normal',
125
+ 'floattobyte', 'floattochar', 'floattocharacter', 'floattoint',
126
+ 'floattointeger', 'floattolong', 'floattoshort', 'floor',
127
+ 'fluxEddy', 'fo2fsh', 'fo2fshv', 'fourier_info', 'frame', 'fspan',
128
+ 'ftcurv', 'ftcurvd', 'ftcurvi', 'ftcurvp', 'ftcurvpi', 'ftcurvps',
129
+ 'ftcurvs', 'ftest', 'ftgetp', 'ftkurv', 'ftkurvd', 'ftkurvp',
130
+ 'ftkurvpd', 'ftsetp', 'ftsurf', 'g2fsh', 'g2fshv', 'g2gsh',
131
+ 'g2gshv', 'gamma', 'gammainc', 'gaus', 'gaus_lobat',
132
+ 'gaus_lobat_wgt', 'gc_aangle', 'gc_clkwise', 'gc_dangle',
133
+ 'gc_inout', 'gc_latlon', 'gc_onarc', 'gc_pnt2gc', 'gc_qarea',
134
+ 'gc_tarea', 'generate_2d_array', 'get_color_index',
135
+ 'get_color_rgba', 'get_cpu_time', 'get_isolines', 'get_ncl_version',
136
+ 'get_script_name', 'get_script_prefix_name', 'get_sphere_radius',
137
+ 'get_unique_values', 'getbitsone', 'getenv', 'getfiledimsizes',
138
+ 'getfilegrpnames', 'getfilepath', 'getfilevaratts',
139
+ 'getfilevarchunkdimsizes', 'getfilevardims', 'getfilevardimsizes',
140
+ 'getfilevarnames', 'getfilevartypes', 'getvaratts', 'getvardims',
141
+ 'gradsf', 'gradsg', 'greg2jul', 'grid2triple', 'hlsrgb', 'hsvrgb',
142
+ 'hydro', 'hyi2hyo', 'idsfft', 'igradsf', 'igradsg', 'ilapsf',
143
+ 'ilapsg', 'ilapvf', 'ilapvg', 'ind', 'ind_resolve', 'int2p',
144
+ 'int2p_n', 'integertobyte', 'integertochar', 'integertocharacter',
145
+ 'integertoshort', 'inttobyte', 'inttochar', 'inttoshort',
146
+ 'inverse_matrix', 'isatt', 'isbigendian', 'isbyte', 'ischar',
147
+ 'iscoord', 'isdefined', 'isdim', 'isdimnamed', 'isdouble',
148
+ 'isenumeric', 'isfile', 'isfilepresent', 'isfilevar',
149
+ 'isfilevaratt', 'isfilevarcoord', 'isfilevardim', 'isfloat',
150
+ 'isfunc', 'isgraphic', 'isint', 'isint64', 'isinteger',
151
+ 'isleapyear', 'islogical', 'islong', 'ismissing', 'isnan_ieee',
152
+ 'isnumeric', 'ispan', 'isproc', 'isshort', 'issnumeric', 'isstring',
153
+ 'isubyte', 'isuint', 'isuint64', 'isulong', 'isunlimited',
154
+ 'isunsigned', 'isushort', 'isvar', 'jul2greg', 'kmeans_as136',
155
+ 'kolsm2_n', 'kron_product', 'lapsf', 'lapsg', 'lapvf', 'lapvg',
156
+ 'latlon2utm', 'lclvl', 'lderuvf', 'lderuvg', 'linint1', 'linint1_n',
157
+ 'linint2', 'linint2_points', 'linmsg', 'linmsg_n', 'linrood_latwgt',
158
+ 'linrood_wgt', 'list_files', 'list_filevars', 'list_hlus',
159
+ 'list_procfuncs', 'list_vars', 'ListAppend', 'ListCount',
160
+ 'ListGetType', 'ListIndex', 'ListIndexFromName', 'ListPop',
161
+ 'ListPush', 'ListSetType', 'loadscript', 'local_max', 'local_min',
162
+ 'log', 'log10', 'longtobyte', 'longtochar', 'longtocharacter',
163
+ 'longtoint', 'longtointeger', 'longtoshort', 'lspoly', 'lspoly_n',
164
+ 'mask', 'max', 'maxind', 'min', 'minind', 'mixed_layer_depth',
165
+ 'mixhum_ptd', 'mixhum_ptrh', 'mjo_cross_coh2pha',
166
+ 'mjo_cross_segment', 'moc_globe_atl', 'monthday', 'natgrid',
167
+ 'natgridd', 'natgrids', 'ncargpath', 'ncargversion', 'ndctodata',
168
+ 'ndtooned', 'new', 'NewList', 'ngezlogo', 'nggcog', 'nggetp',
169
+ 'nglogo', 'ngsetp', 'NhlAddAnnotation', 'NhlAddData',
170
+ 'NhlAddOverlay', 'NhlAddPrimitive', 'NhlAppGetDefaultParentId',
171
+ 'NhlChangeWorkstation', 'NhlClassName', 'NhlClearWorkstation',
172
+ 'NhlDataPolygon', 'NhlDataPolyline', 'NhlDataPolymarker',
173
+ 'NhlDataToNDC', 'NhlDestroy', 'NhlDraw', 'NhlFrame', 'NhlFreeColor',
174
+ 'NhlGetBB', 'NhlGetClassResources', 'NhlGetErrorObjectId',
175
+ 'NhlGetNamedColorIndex', 'NhlGetParentId',
176
+ 'NhlGetParentWorkstation', 'NhlGetWorkspaceObjectId',
177
+ 'NhlIsAllocatedColor', 'NhlIsApp', 'NhlIsDataComm', 'NhlIsDataItem',
178
+ 'NhlIsDataSpec', 'NhlIsTransform', 'NhlIsView', 'NhlIsWorkstation',
179
+ 'NhlName', 'NhlNDCPolygon', 'NhlNDCPolyline', 'NhlNDCPolymarker',
180
+ 'NhlNDCToData', 'NhlNewColor', 'NhlNewDashPattern', 'NhlNewMarker',
181
+ 'NhlPalGetDefined', 'NhlRemoveAnnotation', 'NhlRemoveData',
182
+ 'NhlRemoveOverlay', 'NhlRemovePrimitive', 'NhlSetColor',
183
+ 'NhlSetDashPattern', 'NhlSetMarker', 'NhlUpdateData',
184
+ 'NhlUpdateWorkstation', 'nice_mnmxintvl', 'nngetaspectd',
185
+ 'nngetaspects', 'nngetp', 'nngetsloped', 'nngetslopes', 'nngetwts',
186
+ 'nngetwtsd', 'nnpnt', 'nnpntd', 'nnpntend', 'nnpntendd',
187
+ 'nnpntinit', 'nnpntinitd', 'nnpntinits', 'nnpnts', 'nnsetp', 'num',
188
+ 'obj_anal_ic', 'omega_ccm', 'onedtond', 'overlay', 'paleo_outline',
189
+ 'pdfxy_bin', 'poisson_grid_fill', 'pop_remap', 'potmp_insitu_ocn',
190
+ 'prcwater_dp', 'pres2hybrid', 'pres_hybrid_ccm', 'pres_sigma',
191
+ 'print', 'print_table', 'printFileVarSummary', 'printVarSummary',
192
+ 'product', 'pslec', 'pslhor', 'pslhyp', 'qsort', 'rand',
193
+ 'random_chi', 'random_gamma', 'random_normal', 'random_setallseed',
194
+ 'random_uniform', 'rcm2points', 'rcm2rgrid', 'rdsstoi',
195
+ 'read_colormap_file', 'reg_multlin', 'regcoef', 'regCoef_n',
196
+ 'regline', 'relhum', 'replace_ieeenan', 'reshape', 'reshape_ind',
197
+ 'rgba_to_color_index', 'rgbhls', 'rgbhsv', 'rgbyiq', 'rgrid2rcm',
198
+ 'rhomb_trunc', 'rip_cape_2d', 'rip_cape_3d', 'round', 'rtest',
199
+ 'runave', 'runave_n', 'set_default_fillvalue', 'set_sphere_radius',
200
+ 'setfileoption', 'sfvp2uvf', 'sfvp2uvg', 'shaec', 'shagc',
201
+ 'shgetnp', 'shgetp', 'shgrid', 'shorttobyte', 'shorttochar',
202
+ 'shorttocharacter', 'show_ascii', 'shsec', 'shsetp', 'shsgc',
203
+ 'shsgc_R42', 'sigma2hybrid', 'simpeq', 'simpne', 'sin',
204
+ 'sindex_yrmo', 'sinh', 'sizeof', 'sleep', 'smth9', 'snindex_yrmo',
205
+ 'solve_linsys', 'span_color_indexes', 'span_color_rgba',
206
+ 'sparse_matrix_mult', 'spcorr', 'spcorr_n', 'specx_anal',
207
+ 'specxy_anal', 'spei', 'sprintf', 'sprinti', 'sqrt', 'sqsort',
208
+ 'srand', 'stat2', 'stat4', 'stat_medrng', 'stat_trim',
209
+ 'status_exit', 'stdatmus_p2tdz', 'stdatmus_z2tdp', 'stddev',
210
+ 'str_capital', 'str_concat', 'str_fields_count', 'str_get_cols',
211
+ 'str_get_dq', 'str_get_field', 'str_get_nl', 'str_get_sq',
212
+ 'str_get_tab', 'str_index_of_substr', 'str_insert', 'str_is_blank',
213
+ 'str_join', 'str_left_strip', 'str_lower', 'str_match',
214
+ 'str_match_ic', 'str_match_ic_regex', 'str_match_ind',
215
+ 'str_match_ind_ic', 'str_match_ind_ic_regex', 'str_match_ind_regex',
216
+ 'str_match_regex', 'str_right_strip', 'str_split',
217
+ 'str_split_by_length', 'str_split_csv', 'str_squeeze', 'str_strip',
218
+ 'str_sub_str', 'str_switch', 'str_upper', 'stringtochar',
219
+ 'stringtocharacter', 'stringtodouble', 'stringtofloat',
220
+ 'stringtoint', 'stringtointeger', 'stringtolong', 'stringtoshort',
221
+ 'strlen', 'student_t', 'sum', 'svd_lapack', 'svdcov', 'svdcov_sv',
222
+ 'svdstd', 'svdstd_sv', 'system', 'systemfunc', 'tan', 'tanh',
223
+ 'taper', 'taper_n', 'tdclrs', 'tdctri', 'tdcudp', 'tdcurv',
224
+ 'tddtri', 'tdez2d', 'tdez3d', 'tdgetp', 'tdgrds', 'tdgrid',
225
+ 'tdgtrs', 'tdinit', 'tditri', 'tdlbla', 'tdlblp', 'tdlbls',
226
+ 'tdline', 'tdlndp', 'tdlnpa', 'tdlpdp', 'tdmtri', 'tdotri',
227
+ 'tdpara', 'tdplch', 'tdprpa', 'tdprpi', 'tdprpt', 'tdsetp',
228
+ 'tdsort', 'tdstri', 'tdstrs', 'tdttri', 'thornthwaite', 'tobyte',
229
+ 'tochar', 'todouble', 'tofloat', 'toint', 'toint64', 'tointeger',
230
+ 'tolong', 'toshort', 'tosigned', 'tostring', 'tostring_with_format',
231
+ 'totype', 'toubyte', 'touint', 'touint64', 'toulong', 'tounsigned',
232
+ 'toushort', 'trend_manken', 'tri_trunc', 'triple2grid',
233
+ 'triple2grid2d', 'trop_wmo', 'ttest', 'typeof', 'undef',
234
+ 'unique_string', 'update', 'ushorttoint', 'ut_calendar',
235
+ 'ut_inv_calendar', 'utm2latlon', 'uv2dv_cfd', 'uv2dvf', 'uv2dvg',
236
+ 'uv2sfvpf', 'uv2sfvpg', 'uv2vr_cfd', 'uv2vrdvf', 'uv2vrdvg',
237
+ 'uv2vrf', 'uv2vrg', 'v5d_close', 'v5d_create', 'v5d_setLowLev',
238
+ 'v5d_setUnits', 'v5d_write', 'v5d_write_var', 'variance', 'vhaec',
239
+ 'vhagc', 'vhsec', 'vhsgc', 'vibeta', 'vinth2p', 'vinth2p_ecmwf',
240
+ 'vinth2p_ecmwf_nodes', 'vinth2p_nodes', 'vintp2p_ecmwf', 'vr2uvf',
241
+ 'vr2uvg', 'vrdv2uvf', 'vrdv2uvg', 'wavelet', 'wavelet_default',
242
+ 'weibull', 'wgt_area_smooth', 'wgt_areaave', 'wgt_areaave2',
243
+ 'wgt_arearmse', 'wgt_arearmse2', 'wgt_areasum2', 'wgt_runave',
244
+ 'wgt_runave_n', 'wgt_vert_avg_beta', 'wgt_volave', 'wgt_volave_ccm',
245
+ 'wgt_volrmse', 'wgt_volrmse_ccm', 'where', 'wk_smooth121', 'wmbarb',
246
+ 'wmbarbmap', 'wmdrft', 'wmgetp', 'wmlabs', 'wmsetp', 'wmstnm',
247
+ 'wmvect', 'wmvectmap', 'wmvlbl', 'wrf_avo', 'wrf_cape_2d',
248
+ 'wrf_cape_3d', 'wrf_dbz', 'wrf_eth', 'wrf_helicity', 'wrf_ij_to_ll',
249
+ 'wrf_interp_1d', 'wrf_interp_2d_xy', 'wrf_interp_3d_z',
250
+ 'wrf_latlon_to_ij', 'wrf_ll_to_ij', 'wrf_omega', 'wrf_pvo',
251
+ 'wrf_rh', 'wrf_slp', 'wrf_smooth_2d', 'wrf_td', 'wrf_tk',
252
+ 'wrf_updraft_helicity', 'wrf_uvmet', 'wrf_virtual_temp',
253
+ 'wrf_wetbulb', 'wrf_wps_close_int', 'wrf_wps_open_int',
254
+ 'wrf_wps_rddata_int', 'wrf_wps_rdhead_int', 'wrf_wps_read_int',
255
+ 'wrf_wps_write_int', 'write_matrix', 'write_table', 'yiqrgb',
256
+ 'z2geouv', 'zonal_mpsi', 'addfiles_GetVar', 'advect_variable',
257
+ 'area_conserve_remap_Wrap', 'area_hi2lores_Wrap',
258
+ 'array_append_record', 'assignFillValue', 'byte2flt',
259
+ 'byte2flt_hdf', 'calcDayAnomTLL', 'calcMonAnomLLLT',
260
+ 'calcMonAnomLLT', 'calcMonAnomTLL', 'calcMonAnomTLLL',
261
+ 'calculate_monthly_values', 'cd_convert', 'changeCase',
262
+ 'changeCaseChar', 'clmDayTLL', 'clmDayTLLL', 'clmMon2clmDay',
263
+ 'clmMonLLLT', 'clmMonLLT', 'clmMonTLL', 'clmMonTLLL', 'closest_val',
264
+ 'copy_VarAtts', 'copy_VarCoords', 'copy_VarCoords_1',
265
+ 'copy_VarCoords_2', 'copy_VarMeta', 'copyatt', 'crossp3',
266
+ 'cshstringtolist', 'cssgrid_Wrap', 'dble2flt', 'decimalPlaces',
267
+ 'delete_VarAtts', 'dim_avg_n_Wrap', 'dim_avg_wgt_n_Wrap',
268
+ 'dim_avg_wgt_Wrap', 'dim_avg_Wrap', 'dim_cumsum_n_Wrap',
269
+ 'dim_cumsum_Wrap', 'dim_max_n_Wrap', 'dim_min_n_Wrap',
270
+ 'dim_rmsd_n_Wrap', 'dim_rmsd_Wrap', 'dim_rmvmean_n_Wrap',
271
+ 'dim_rmvmean_Wrap', 'dim_rmvmed_n_Wrap', 'dim_rmvmed_Wrap',
272
+ 'dim_standardize_n_Wrap', 'dim_standardize_Wrap',
273
+ 'dim_stddev_n_Wrap', 'dim_stddev_Wrap', 'dim_sum_n_Wrap',
274
+ 'dim_sum_wgt_n_Wrap', 'dim_sum_wgt_Wrap', 'dim_sum_Wrap',
275
+ 'dim_variance_n_Wrap', 'dim_variance_Wrap', 'dpres_plevel_Wrap',
276
+ 'dtrend_leftdim', 'dv2uvF_Wrap', 'dv2uvG_Wrap', 'eof_north',
277
+ 'eofcor_Wrap', 'eofcov_Wrap', 'eofunc_north', 'eofunc_ts_Wrap',
278
+ 'eofunc_varimax_reorder', 'eofunc_varimax_Wrap', 'eofunc_Wrap',
279
+ 'epsZero', 'f2fosh_Wrap', 'f2foshv_Wrap', 'f2fsh_Wrap',
280
+ 'f2fshv_Wrap', 'f2gsh_Wrap', 'f2gshv_Wrap', 'fbindirSwap',
281
+ 'fbinseqSwap1', 'fbinseqSwap2', 'flt2dble', 'flt2string',
282
+ 'fo2fsh_Wrap', 'fo2fshv_Wrap', 'g2fsh_Wrap', 'g2fshv_Wrap',
283
+ 'g2gsh_Wrap', 'g2gshv_Wrap', 'generate_resample_indices',
284
+ 'generate_sample_indices', 'generate_unique_indices',
285
+ 'genNormalDist', 'get1Dindex', 'get1Dindex_Collapse',
286
+ 'get1Dindex_Exclude', 'get_file_suffix', 'GetFillColor',
287
+ 'GetFillColorIndex', 'getFillValue', 'getind_latlon2d',
288
+ 'getVarDimNames', 'getVarFillValue', 'grib_stime2itime',
289
+ 'hyi2hyo_Wrap', 'ilapsF_Wrap', 'ilapsG_Wrap', 'ind_nearest_coord',
290
+ 'indStrSubset', 'int2dble', 'int2flt', 'int2p_n_Wrap', 'int2p_Wrap',
291
+ 'isMonotonic', 'isStrSubset', 'latGau', 'latGauWgt', 'latGlobeF',
292
+ 'latGlobeFo', 'latRegWgt', 'linint1_n_Wrap', 'linint1_Wrap',
293
+ 'linint2_points_Wrap', 'linint2_Wrap', 'local_max_1d',
294
+ 'local_min_1d', 'lonFlip', 'lonGlobeF', 'lonGlobeFo', 'lonPivot',
295
+ 'merge_levels_sfc', 'mod', 'month_to_annual',
296
+ 'month_to_annual_weighted', 'month_to_season', 'month_to_season12',
297
+ 'month_to_seasonN', 'monthly_total_to_daily_mean', 'nameDim',
298
+ 'natgrid_Wrap', 'NewCosWeight', 'niceLatLon2D', 'NormCosWgtGlobe',
299
+ 'numAsciiCol', 'numAsciiRow', 'numeric2int',
300
+ 'obj_anal_ic_deprecated', 'obj_anal_ic_Wrap', 'omega_ccm_driver',
301
+ 'omega_to_w', 'oneDtostring', 'pack_values', 'pattern_cor', 'pdfx',
302
+ 'pdfxy', 'pdfxy_conform', 'pot_temp', 'pot_vort_hybrid',
303
+ 'pot_vort_isobaric', 'pres2hybrid_Wrap', 'print_clock',
304
+ 'printMinMax', 'quadroots', 'rcm2points_Wrap', 'rcm2rgrid_Wrap',
305
+ 'readAsciiHead', 'readAsciiTable', 'reg_multlin_stats',
306
+ 'region_ind', 'regline_stats', 'relhum_ttd', 'replaceSingleChar',
307
+ 'RGBtoCmap', 'rgrid2rcm_Wrap', 'rho_mwjf', 'rm_single_dims',
308
+ 'rmAnnCycle1D', 'rmInsufData', 'rmMonAnnCycLLLT', 'rmMonAnnCycLLT',
309
+ 'rmMonAnnCycTLL', 'runave_n_Wrap', 'runave_Wrap', 'short2flt',
310
+ 'short2flt_hdf', 'shsgc_R42_Wrap', 'sign_f90', 'sign_matlab',
311
+ 'smth9_Wrap', 'smthClmDayTLL', 'smthClmDayTLLL', 'SqrtCosWeight',
312
+ 'stat_dispersion', 'static_stability', 'stdMonLLLT', 'stdMonLLT',
313
+ 'stdMonTLL', 'stdMonTLLL', 'symMinMaxPlt', 'table_attach_columns',
314
+ 'table_attach_rows', 'time_to_newtime', 'transpose',
315
+ 'triple2grid_Wrap', 'ut_convert', 'uv2dvF_Wrap', 'uv2dvG_Wrap',
316
+ 'uv2vrF_Wrap', 'uv2vrG_Wrap', 'vr2uvF_Wrap', 'vr2uvG_Wrap',
317
+ 'w_to_omega', 'wallClockElapseTime', 'wave_number_spc',
318
+ 'wgt_areaave_Wrap', 'wgt_runave_leftdim', 'wgt_runave_n_Wrap',
319
+ 'wgt_runave_Wrap', 'wgt_vertical_n', 'wind_component',
320
+ 'wind_direction', 'yyyyddd_to_yyyymmdd', 'yyyymm_time',
321
+ 'yyyymm_to_yyyyfrac', 'yyyymmdd_time', 'yyyymmdd_to_yyyyddd',
322
+ 'yyyymmdd_to_yyyyfrac', 'yyyymmddhh_time', 'yyyymmddhh_to_yyyyfrac',
323
+ 'zonal_mpsi_Wrap', 'zonalAve', 'calendar_decode2', 'cd_string',
324
+ 'kf_filter', 'run_cor', 'time_axis_labels', 'ut_string',
325
+ 'wrf_contour', 'wrf_map', 'wrf_map_overlay', 'wrf_map_overlays',
326
+ 'wrf_map_resources', 'wrf_map_zoom', 'wrf_overlay', 'wrf_overlays',
327
+ 'wrf_user_getvar', 'wrf_user_ij_to_ll', 'wrf_user_intrp2d',
328
+ 'wrf_user_intrp3d', 'wrf_user_latlon_to_ij', 'wrf_user_list_times',
329
+ 'wrf_user_ll_to_ij', 'wrf_user_unstagger', 'wrf_user_vert_interp',
330
+ 'wrf_vector', 'gsn_add_annotation', 'gsn_add_polygon',
331
+ 'gsn_add_polyline', 'gsn_add_polymarker',
332
+ 'gsn_add_shapefile_polygons', 'gsn_add_shapefile_polylines',
333
+ 'gsn_add_shapefile_polymarkers', 'gsn_add_text', 'gsn_attach_plots',
334
+ 'gsn_blank_plot', 'gsn_contour', 'gsn_contour_map',
335
+ 'gsn_contour_shade', 'gsn_coordinates', 'gsn_create_labelbar',
336
+ 'gsn_create_legend', 'gsn_create_text',
337
+ 'gsn_csm_attach_zonal_means', 'gsn_csm_blank_plot',
338
+ 'gsn_csm_contour', 'gsn_csm_contour_map', 'gsn_csm_contour_map_ce',
339
+ 'gsn_csm_contour_map_overlay', 'gsn_csm_contour_map_polar',
340
+ 'gsn_csm_hov', 'gsn_csm_lat_time', 'gsn_csm_map', 'gsn_csm_map_ce',
341
+ 'gsn_csm_map_polar', 'gsn_csm_pres_hgt',
342
+ 'gsn_csm_pres_hgt_streamline', 'gsn_csm_pres_hgt_vector',
343
+ 'gsn_csm_streamline', 'gsn_csm_streamline_contour_map',
344
+ 'gsn_csm_streamline_contour_map_ce',
345
+ 'gsn_csm_streamline_contour_map_polar', 'gsn_csm_streamline_map',
346
+ 'gsn_csm_streamline_map_ce', 'gsn_csm_streamline_map_polar',
347
+ 'gsn_csm_streamline_scalar', 'gsn_csm_streamline_scalar_map',
348
+ 'gsn_csm_streamline_scalar_map_ce',
349
+ 'gsn_csm_streamline_scalar_map_polar', 'gsn_csm_time_lat',
350
+ 'gsn_csm_vector', 'gsn_csm_vector_map', 'gsn_csm_vector_map_ce',
351
+ 'gsn_csm_vector_map_polar', 'gsn_csm_vector_scalar',
352
+ 'gsn_csm_vector_scalar_map', 'gsn_csm_vector_scalar_map_ce',
353
+ 'gsn_csm_vector_scalar_map_polar', 'gsn_csm_x2y', 'gsn_csm_x2y2',
354
+ 'gsn_csm_xy', 'gsn_csm_xy2', 'gsn_csm_xy3', 'gsn_csm_y',
355
+ 'gsn_define_colormap', 'gsn_draw_colormap', 'gsn_draw_named_colors',
356
+ 'gsn_histogram', 'gsn_labelbar_ndc', 'gsn_legend_ndc', 'gsn_map',
357
+ 'gsn_merge_colormaps', 'gsn_open_wks', 'gsn_panel', 'gsn_polygon',
358
+ 'gsn_polygon_ndc', 'gsn_polyline', 'gsn_polyline_ndc',
359
+ 'gsn_polymarker', 'gsn_polymarker_ndc', 'gsn_retrieve_colormap',
360
+ 'gsn_reverse_colormap', 'gsn_streamline', 'gsn_streamline_map',
361
+ 'gsn_streamline_scalar', 'gsn_streamline_scalar_map', 'gsn_table',
362
+ 'gsn_text', 'gsn_text_ndc', 'gsn_vector', 'gsn_vector_map',
363
+ 'gsn_vector_scalar', 'gsn_vector_scalar_map', 'gsn_xy', 'gsn_y',
364
+ 'hsv2rgb', 'maximize_output', 'namedcolor2rgb', 'namedcolor2rgba',
365
+ 'reset_device_coordinates', 'span_named_colors'), prefix=r'\b'),
366
+ Name.Builtin),
367
+
368
+ # Resources
369
+ (words((
370
+ 'amDataXF', 'amDataYF', 'amJust', 'amOn', 'amOrthogonalPosF',
371
+ 'amParallelPosF', 'amResizeNotify', 'amSide', 'amTrackData',
372
+ 'amViewId', 'amZone', 'appDefaultParent', 'appFileSuffix',
373
+ 'appResources', 'appSysDir', 'appUsrDir', 'caCopyArrays',
374
+ 'caXArray', 'caXCast', 'caXMaxV', 'caXMinV', 'caXMissingV',
375
+ 'caYArray', 'caYCast', 'caYMaxV', 'caYMinV', 'caYMissingV',
376
+ 'cnCellFillEdgeColor', 'cnCellFillMissingValEdgeColor',
377
+ 'cnConpackParams', 'cnConstFEnableFill', 'cnConstFLabelAngleF',
378
+ 'cnConstFLabelBackgroundColor', 'cnConstFLabelConstantSpacingF',
379
+ 'cnConstFLabelFont', 'cnConstFLabelFontAspectF',
380
+ 'cnConstFLabelFontColor', 'cnConstFLabelFontHeightF',
381
+ 'cnConstFLabelFontQuality', 'cnConstFLabelFontThicknessF',
382
+ 'cnConstFLabelFormat', 'cnConstFLabelFuncCode', 'cnConstFLabelJust',
383
+ 'cnConstFLabelOn', 'cnConstFLabelOrthogonalPosF',
384
+ 'cnConstFLabelParallelPosF', 'cnConstFLabelPerimColor',
385
+ 'cnConstFLabelPerimOn', 'cnConstFLabelPerimSpaceF',
386
+ 'cnConstFLabelPerimThicknessF', 'cnConstFLabelSide',
387
+ 'cnConstFLabelString', 'cnConstFLabelTextDirection',
388
+ 'cnConstFLabelZone', 'cnConstFUseInfoLabelRes',
389
+ 'cnExplicitLabelBarLabelsOn', 'cnExplicitLegendLabelsOn',
390
+ 'cnExplicitLineLabelsOn', 'cnFillBackgroundColor', 'cnFillColor',
391
+ 'cnFillColors', 'cnFillDotSizeF', 'cnFillDrawOrder', 'cnFillMode',
392
+ 'cnFillOn', 'cnFillOpacityF', 'cnFillPalette', 'cnFillPattern',
393
+ 'cnFillPatterns', 'cnFillScaleF', 'cnFillScales', 'cnFixFillBleed',
394
+ 'cnGridBoundFillColor', 'cnGridBoundFillPattern',
395
+ 'cnGridBoundFillScaleF', 'cnGridBoundPerimColor',
396
+ 'cnGridBoundPerimDashPattern', 'cnGridBoundPerimOn',
397
+ 'cnGridBoundPerimThicknessF', 'cnHighLabelAngleF',
398
+ 'cnHighLabelBackgroundColor', 'cnHighLabelConstantSpacingF',
399
+ 'cnHighLabelCount', 'cnHighLabelFont', 'cnHighLabelFontAspectF',
400
+ 'cnHighLabelFontColor', 'cnHighLabelFontHeightF',
401
+ 'cnHighLabelFontQuality', 'cnHighLabelFontThicknessF',
402
+ 'cnHighLabelFormat', 'cnHighLabelFuncCode', 'cnHighLabelPerimColor',
403
+ 'cnHighLabelPerimOn', 'cnHighLabelPerimSpaceF',
404
+ 'cnHighLabelPerimThicknessF', 'cnHighLabelString', 'cnHighLabelsOn',
405
+ 'cnHighLowLabelOverlapMode', 'cnHighUseLineLabelRes',
406
+ 'cnInfoLabelAngleF', 'cnInfoLabelBackgroundColor',
407
+ 'cnInfoLabelConstantSpacingF', 'cnInfoLabelFont',
408
+ 'cnInfoLabelFontAspectF', 'cnInfoLabelFontColor',
409
+ 'cnInfoLabelFontHeightF', 'cnInfoLabelFontQuality',
410
+ 'cnInfoLabelFontThicknessF', 'cnInfoLabelFormat',
411
+ 'cnInfoLabelFuncCode', 'cnInfoLabelJust', 'cnInfoLabelOn',
412
+ 'cnInfoLabelOrthogonalPosF', 'cnInfoLabelParallelPosF',
413
+ 'cnInfoLabelPerimColor', 'cnInfoLabelPerimOn',
414
+ 'cnInfoLabelPerimSpaceF', 'cnInfoLabelPerimThicknessF',
415
+ 'cnInfoLabelSide', 'cnInfoLabelString', 'cnInfoLabelTextDirection',
416
+ 'cnInfoLabelZone', 'cnLabelBarEndLabelsOn', 'cnLabelBarEndStyle',
417
+ 'cnLabelDrawOrder', 'cnLabelMasking', 'cnLabelScaleFactorF',
418
+ 'cnLabelScaleValueF', 'cnLabelScalingMode', 'cnLegendLevelFlags',
419
+ 'cnLevelCount', 'cnLevelFlag', 'cnLevelFlags', 'cnLevelSelectionMode',
420
+ 'cnLevelSpacingF', 'cnLevels', 'cnLineColor', 'cnLineColors',
421
+ 'cnLineDashPattern', 'cnLineDashPatterns', 'cnLineDashSegLenF',
422
+ 'cnLineDrawOrder', 'cnLineLabelAngleF', 'cnLineLabelBackgroundColor',
423
+ 'cnLineLabelConstantSpacingF', 'cnLineLabelCount',
424
+ 'cnLineLabelDensityF', 'cnLineLabelFont', 'cnLineLabelFontAspectF',
425
+ 'cnLineLabelFontColor', 'cnLineLabelFontColors',
426
+ 'cnLineLabelFontHeightF', 'cnLineLabelFontQuality',
427
+ 'cnLineLabelFontThicknessF', 'cnLineLabelFormat',
428
+ 'cnLineLabelFuncCode', 'cnLineLabelInterval', 'cnLineLabelPerimColor',
429
+ 'cnLineLabelPerimOn', 'cnLineLabelPerimSpaceF',
430
+ 'cnLineLabelPerimThicknessF', 'cnLineLabelPlacementMode',
431
+ 'cnLineLabelStrings', 'cnLineLabelsOn', 'cnLinePalette',
432
+ 'cnLineThicknessF', 'cnLineThicknesses', 'cnLinesOn',
433
+ 'cnLowLabelAngleF', 'cnLowLabelBackgroundColor',
434
+ 'cnLowLabelConstantSpacingF', 'cnLowLabelCount', 'cnLowLabelFont',
435
+ 'cnLowLabelFontAspectF', 'cnLowLabelFontColor',
436
+ 'cnLowLabelFontHeightF', 'cnLowLabelFontQuality',
437
+ 'cnLowLabelFontThicknessF', 'cnLowLabelFormat', 'cnLowLabelFuncCode',
438
+ 'cnLowLabelPerimColor', 'cnLowLabelPerimOn', 'cnLowLabelPerimSpaceF',
439
+ 'cnLowLabelPerimThicknessF', 'cnLowLabelString', 'cnLowLabelsOn',
440
+ 'cnLowUseHighLabelRes', 'cnMaxDataValueFormat', 'cnMaxLevelCount',
441
+ 'cnMaxLevelValF', 'cnMaxPointDistanceF', 'cnMinLevelValF',
442
+ 'cnMissingValFillColor', 'cnMissingValFillPattern',
443
+ 'cnMissingValFillScaleF', 'cnMissingValPerimColor',
444
+ 'cnMissingValPerimDashPattern', 'cnMissingValPerimGridBoundOn',
445
+ 'cnMissingValPerimOn', 'cnMissingValPerimThicknessF',
446
+ 'cnMonoFillColor', 'cnMonoFillPattern', 'cnMonoFillScale',
447
+ 'cnMonoLevelFlag', 'cnMonoLineColor', 'cnMonoLineDashPattern',
448
+ 'cnMonoLineLabelFontColor', 'cnMonoLineThickness', 'cnNoDataLabelOn',
449
+ 'cnNoDataLabelString', 'cnOutOfRangeFillColor',
450
+ 'cnOutOfRangeFillPattern', 'cnOutOfRangeFillScaleF',
451
+ 'cnOutOfRangePerimColor', 'cnOutOfRangePerimDashPattern',
452
+ 'cnOutOfRangePerimOn', 'cnOutOfRangePerimThicknessF',
453
+ 'cnRasterCellSizeF', 'cnRasterMinCellSizeF', 'cnRasterModeOn',
454
+ 'cnRasterSampleFactorF', 'cnRasterSmoothingOn', 'cnScalarFieldData',
455
+ 'cnSmoothingDistanceF', 'cnSmoothingOn', 'cnSmoothingTensionF',
456
+ 'cnSpanFillPalette', 'cnSpanLinePalette', 'ctCopyTables',
457
+ 'ctXElementSize', 'ctXMaxV', 'ctXMinV', 'ctXMissingV', 'ctXTable',
458
+ 'ctXTableLengths', 'ctXTableType', 'ctYElementSize', 'ctYMaxV',
459
+ 'ctYMinV', 'ctYMissingV', 'ctYTable', 'ctYTableLengths',
460
+ 'ctYTableType', 'dcDelayCompute', 'errBuffer',
461
+ 'errFileName', 'errFilePtr', 'errLevel', 'errPrint', 'errUnitNumber',
462
+ 'gsClipOn', 'gsColors', 'gsEdgeColor', 'gsEdgeDashPattern',
463
+ 'gsEdgeDashSegLenF', 'gsEdgeThicknessF', 'gsEdgesOn',
464
+ 'gsFillBackgroundColor', 'gsFillColor', 'gsFillDotSizeF',
465
+ 'gsFillIndex', 'gsFillLineThicknessF', 'gsFillOpacityF',
466
+ 'gsFillScaleF', 'gsFont', 'gsFontAspectF', 'gsFontColor',
467
+ 'gsFontHeightF', 'gsFontOpacityF', 'gsFontQuality',
468
+ 'gsFontThicknessF', 'gsLineColor', 'gsLineDashPattern',
469
+ 'gsLineDashSegLenF', 'gsLineLabelConstantSpacingF', 'gsLineLabelFont',
470
+ 'gsLineLabelFontAspectF', 'gsLineLabelFontColor',
471
+ 'gsLineLabelFontHeightF', 'gsLineLabelFontQuality',
472
+ 'gsLineLabelFontThicknessF', 'gsLineLabelFuncCode',
473
+ 'gsLineLabelString', 'gsLineOpacityF', 'gsLineThicknessF',
474
+ 'gsMarkerColor', 'gsMarkerIndex', 'gsMarkerOpacityF', 'gsMarkerSizeF',
475
+ 'gsMarkerThicknessF', 'gsSegments', 'gsTextAngleF',
476
+ 'gsTextConstantSpacingF', 'gsTextDirection', 'gsTextFuncCode',
477
+ 'gsTextJustification', 'gsnAboveYRefLineBarColors',
478
+ 'gsnAboveYRefLineBarFillScales', 'gsnAboveYRefLineBarPatterns',
479
+ 'gsnAboveYRefLineColor', 'gsnAddCyclic', 'gsnAttachBorderOn',
480
+ 'gsnAttachPlotsXAxis', 'gsnBelowYRefLineBarColors',
481
+ 'gsnBelowYRefLineBarFillScales', 'gsnBelowYRefLineBarPatterns',
482
+ 'gsnBelowYRefLineColor', 'gsnBoxMargin', 'gsnCenterString',
483
+ 'gsnCenterStringFontColor', 'gsnCenterStringFontHeightF',
484
+ 'gsnCenterStringFuncCode', 'gsnCenterStringOrthogonalPosF',
485
+ 'gsnCenterStringParallelPosF', 'gsnContourLineThicknessesScale',
486
+ 'gsnContourNegLineDashPattern', 'gsnContourPosLineDashPattern',
487
+ 'gsnContourZeroLineThicknessF', 'gsnDebugWriteFileName', 'gsnDraw',
488
+ 'gsnFrame', 'gsnHistogramBarWidthPercent', 'gsnHistogramBinIntervals',
489
+ 'gsnHistogramBinMissing', 'gsnHistogramBinWidth',
490
+ 'gsnHistogramClassIntervals', 'gsnHistogramCompare',
491
+ 'gsnHistogramComputePercentages',
492
+ 'gsnHistogramComputePercentagesNoMissing',
493
+ 'gsnHistogramDiscreteBinValues', 'gsnHistogramDiscreteClassValues',
494
+ 'gsnHistogramHorizontal', 'gsnHistogramMinMaxBinsOn',
495
+ 'gsnHistogramNumberOfBins', 'gsnHistogramPercentSign',
496
+ 'gsnHistogramSelectNiceIntervals', 'gsnLeftString',
497
+ 'gsnLeftStringFontColor', 'gsnLeftStringFontHeightF',
498
+ 'gsnLeftStringFuncCode', 'gsnLeftStringOrthogonalPosF',
499
+ 'gsnLeftStringParallelPosF', 'gsnMajorLatSpacing',
500
+ 'gsnMajorLonSpacing', 'gsnMaskLambertConformal',
501
+ 'gsnMaskLambertConformalOutlineOn', 'gsnMaximize',
502
+ 'gsnMinorLatSpacing', 'gsnMinorLonSpacing', 'gsnPanelBottom',
503
+ 'gsnPanelCenter', 'gsnPanelDebug', 'gsnPanelFigureStrings',
504
+ 'gsnPanelFigureStringsBackgroundFillColor',
505
+ 'gsnPanelFigureStringsFontHeightF', 'gsnPanelFigureStringsJust',
506
+ 'gsnPanelFigureStringsPerimOn', 'gsnPanelLabelBar', 'gsnPanelLeft',
507
+ 'gsnPanelMainFont', 'gsnPanelMainFontColor',
508
+ 'gsnPanelMainFontHeightF', 'gsnPanelMainString', 'gsnPanelRight',
509
+ 'gsnPanelRowSpec', 'gsnPanelScalePlotIndex', 'gsnPanelTop',
510
+ 'gsnPanelXF', 'gsnPanelXWhiteSpacePercent', 'gsnPanelYF',
511
+ 'gsnPanelYWhiteSpacePercent', 'gsnPaperHeight', 'gsnPaperMargin',
512
+ 'gsnPaperOrientation', 'gsnPaperWidth', 'gsnPolar',
513
+ 'gsnPolarLabelDistance', 'gsnPolarLabelFont',
514
+ 'gsnPolarLabelFontHeightF', 'gsnPolarLabelSpacing', 'gsnPolarTime',
515
+ 'gsnPolarUT', 'gsnRightString', 'gsnRightStringFontColor',
516
+ 'gsnRightStringFontHeightF', 'gsnRightStringFuncCode',
517
+ 'gsnRightStringOrthogonalPosF', 'gsnRightStringParallelPosF',
518
+ 'gsnScalarContour', 'gsnScale', 'gsnShape', 'gsnSpreadColorEnd',
519
+ 'gsnSpreadColorStart', 'gsnSpreadColors', 'gsnStringFont',
520
+ 'gsnStringFontColor', 'gsnStringFontHeightF', 'gsnStringFuncCode',
521
+ 'gsnTickMarksOn', 'gsnXAxisIrregular2Linear', 'gsnXAxisIrregular2Log',
522
+ 'gsnXRefLine', 'gsnXRefLineColor', 'gsnXRefLineDashPattern',
523
+ 'gsnXRefLineThicknessF', 'gsnXYAboveFillColors', 'gsnXYBarChart',
524
+ 'gsnXYBarChartBarWidth', 'gsnXYBarChartColors',
525
+ 'gsnXYBarChartColors2', 'gsnXYBarChartFillDotSizeF',
526
+ 'gsnXYBarChartFillLineThicknessF', 'gsnXYBarChartFillOpacityF',
527
+ 'gsnXYBarChartFillScaleF', 'gsnXYBarChartOutlineOnly',
528
+ 'gsnXYBarChartOutlineThicknessF', 'gsnXYBarChartPatterns',
529
+ 'gsnXYBarChartPatterns2', 'gsnXYBelowFillColors', 'gsnXYFillColors',
530
+ 'gsnXYFillOpacities', 'gsnXYLeftFillColors', 'gsnXYRightFillColors',
531
+ 'gsnYAxisIrregular2Linear', 'gsnYAxisIrregular2Log', 'gsnYRefLine',
532
+ 'gsnYRefLineColor', 'gsnYRefLineColors', 'gsnYRefLineDashPattern',
533
+ 'gsnYRefLineDashPatterns', 'gsnYRefLineThicknessF',
534
+ 'gsnYRefLineThicknesses', 'gsnZonalMean', 'gsnZonalMeanXMaxF',
535
+ 'gsnZonalMeanXMinF', 'gsnZonalMeanYRefLine', 'lbAutoManage',
536
+ 'lbBottomMarginF', 'lbBoxCount', 'lbBoxEndCapStyle', 'lbBoxFractions',
537
+ 'lbBoxLineColor', 'lbBoxLineDashPattern', 'lbBoxLineDashSegLenF',
538
+ 'lbBoxLineThicknessF', 'lbBoxLinesOn', 'lbBoxMajorExtentF',
539
+ 'lbBoxMinorExtentF', 'lbBoxSeparatorLinesOn', 'lbBoxSizing',
540
+ 'lbFillBackground', 'lbFillColor', 'lbFillColors', 'lbFillDotSizeF',
541
+ 'lbFillLineThicknessF', 'lbFillPattern', 'lbFillPatterns',
542
+ 'lbFillScaleF', 'lbFillScales', 'lbJustification', 'lbLabelAlignment',
543
+ 'lbLabelAngleF', 'lbLabelAutoStride', 'lbLabelBarOn',
544
+ 'lbLabelConstantSpacingF', 'lbLabelDirection', 'lbLabelFont',
545
+ 'lbLabelFontAspectF', 'lbLabelFontColor', 'lbLabelFontHeightF',
546
+ 'lbLabelFontQuality', 'lbLabelFontThicknessF', 'lbLabelFuncCode',
547
+ 'lbLabelJust', 'lbLabelOffsetF', 'lbLabelPosition', 'lbLabelStride',
548
+ 'lbLabelStrings', 'lbLabelsOn', 'lbLeftMarginF', 'lbMaxLabelLenF',
549
+ 'lbMinLabelSpacingF', 'lbMonoFillColor', 'lbMonoFillPattern',
550
+ 'lbMonoFillScale', 'lbOrientation', 'lbPerimColor',
551
+ 'lbPerimDashPattern', 'lbPerimDashSegLenF', 'lbPerimFill',
552
+ 'lbPerimFillColor', 'lbPerimOn', 'lbPerimThicknessF',
553
+ 'lbRasterFillOn', 'lbRightMarginF', 'lbTitleAngleF',
554
+ 'lbTitleConstantSpacingF', 'lbTitleDirection', 'lbTitleExtentF',
555
+ 'lbTitleFont', 'lbTitleFontAspectF', 'lbTitleFontColor',
556
+ 'lbTitleFontHeightF', 'lbTitleFontQuality', 'lbTitleFontThicknessF',
557
+ 'lbTitleFuncCode', 'lbTitleJust', 'lbTitleOffsetF', 'lbTitleOn',
558
+ 'lbTitlePosition', 'lbTitleString', 'lbTopMarginF', 'lgAutoManage',
559
+ 'lgBottomMarginF', 'lgBoxBackground', 'lgBoxLineColor',
560
+ 'lgBoxLineDashPattern', 'lgBoxLineDashSegLenF', 'lgBoxLineThicknessF',
561
+ 'lgBoxLinesOn', 'lgBoxMajorExtentF', 'lgBoxMinorExtentF',
562
+ 'lgDashIndex', 'lgDashIndexes', 'lgItemCount', 'lgItemOrder',
563
+ 'lgItemPlacement', 'lgItemPositions', 'lgItemType', 'lgItemTypes',
564
+ 'lgJustification', 'lgLabelAlignment', 'lgLabelAngleF',
565
+ 'lgLabelAutoStride', 'lgLabelConstantSpacingF', 'lgLabelDirection',
566
+ 'lgLabelFont', 'lgLabelFontAspectF', 'lgLabelFontColor',
567
+ 'lgLabelFontHeightF', 'lgLabelFontQuality', 'lgLabelFontThicknessF',
568
+ 'lgLabelFuncCode', 'lgLabelJust', 'lgLabelOffsetF', 'lgLabelPosition',
569
+ 'lgLabelStride', 'lgLabelStrings', 'lgLabelsOn', 'lgLeftMarginF',
570
+ 'lgLegendOn', 'lgLineColor', 'lgLineColors', 'lgLineDashSegLenF',
571
+ 'lgLineDashSegLens', 'lgLineLabelConstantSpacingF', 'lgLineLabelFont',
572
+ 'lgLineLabelFontAspectF', 'lgLineLabelFontColor',
573
+ 'lgLineLabelFontColors', 'lgLineLabelFontHeightF',
574
+ 'lgLineLabelFontHeights', 'lgLineLabelFontQuality',
575
+ 'lgLineLabelFontThicknessF', 'lgLineLabelFuncCode',
576
+ 'lgLineLabelStrings', 'lgLineLabelsOn', 'lgLineThicknessF',
577
+ 'lgLineThicknesses', 'lgMarkerColor', 'lgMarkerColors',
578
+ 'lgMarkerIndex', 'lgMarkerIndexes', 'lgMarkerSizeF', 'lgMarkerSizes',
579
+ 'lgMarkerThicknessF', 'lgMarkerThicknesses', 'lgMonoDashIndex',
580
+ 'lgMonoItemType', 'lgMonoLineColor', 'lgMonoLineDashSegLen',
581
+ 'lgMonoLineLabelFontColor', 'lgMonoLineLabelFontHeight',
582
+ 'lgMonoLineThickness', 'lgMonoMarkerColor', 'lgMonoMarkerIndex',
583
+ 'lgMonoMarkerSize', 'lgMonoMarkerThickness', 'lgOrientation',
584
+ 'lgPerimColor', 'lgPerimDashPattern', 'lgPerimDashSegLenF',
585
+ 'lgPerimFill', 'lgPerimFillColor', 'lgPerimOn', 'lgPerimThicknessF',
586
+ 'lgRightMarginF', 'lgTitleAngleF', 'lgTitleConstantSpacingF',
587
+ 'lgTitleDirection', 'lgTitleExtentF', 'lgTitleFont',
588
+ 'lgTitleFontAspectF', 'lgTitleFontColor', 'lgTitleFontHeightF',
589
+ 'lgTitleFontQuality', 'lgTitleFontThicknessF', 'lgTitleFuncCode',
590
+ 'lgTitleJust', 'lgTitleOffsetF', 'lgTitleOn', 'lgTitlePosition',
591
+ 'lgTitleString', 'lgTopMarginF', 'mpAreaGroupCount',
592
+ 'mpAreaMaskingOn', 'mpAreaNames', 'mpAreaTypes', 'mpBottomAngleF',
593
+ 'mpBottomMapPosF', 'mpBottomNDCF', 'mpBottomNPCF',
594
+ 'mpBottomPointLatF', 'mpBottomPointLonF', 'mpBottomWindowF',
595
+ 'mpCenterLatF', 'mpCenterLonF', 'mpCenterRotF', 'mpCountyLineColor',
596
+ 'mpCountyLineDashPattern', 'mpCountyLineDashSegLenF',
597
+ 'mpCountyLineThicknessF', 'mpDataBaseVersion', 'mpDataResolution',
598
+ 'mpDataSetName', 'mpDefaultFillColor', 'mpDefaultFillPattern',
599
+ 'mpDefaultFillScaleF', 'mpDynamicAreaGroups', 'mpEllipticalBoundary',
600
+ 'mpFillAreaSpecifiers', 'mpFillBoundarySets', 'mpFillColor',
601
+ 'mpFillColors', 'mpFillColors-default', 'mpFillDotSizeF',
602
+ 'mpFillDrawOrder', 'mpFillOn', 'mpFillPatternBackground',
603
+ 'mpFillPattern', 'mpFillPatterns', 'mpFillPatterns-default',
604
+ 'mpFillScaleF', 'mpFillScales', 'mpFillScales-default',
605
+ 'mpFixedAreaGroups', 'mpGeophysicalLineColor',
606
+ 'mpGeophysicalLineDashPattern', 'mpGeophysicalLineDashSegLenF',
607
+ 'mpGeophysicalLineThicknessF', 'mpGreatCircleLinesOn',
608
+ 'mpGridAndLimbDrawOrder', 'mpGridAndLimbOn', 'mpGridLatSpacingF',
609
+ 'mpGridLineColor', 'mpGridLineDashPattern', 'mpGridLineDashSegLenF',
610
+ 'mpGridLineThicknessF', 'mpGridLonSpacingF', 'mpGridMaskMode',
611
+ 'mpGridMaxLatF', 'mpGridPolarLonSpacingF', 'mpGridSpacingF',
612
+ 'mpInlandWaterFillColor', 'mpInlandWaterFillPattern',
613
+ 'mpInlandWaterFillScaleF', 'mpLabelDrawOrder', 'mpLabelFontColor',
614
+ 'mpLabelFontHeightF', 'mpLabelsOn', 'mpLambertMeridianF',
615
+ 'mpLambertParallel1F', 'mpLambertParallel2F', 'mpLandFillColor',
616
+ 'mpLandFillPattern', 'mpLandFillScaleF', 'mpLeftAngleF',
617
+ 'mpLeftCornerLatF', 'mpLeftCornerLonF', 'mpLeftMapPosF',
618
+ 'mpLeftNDCF', 'mpLeftNPCF', 'mpLeftPointLatF',
619
+ 'mpLeftPointLonF', 'mpLeftWindowF', 'mpLimbLineColor',
620
+ 'mpLimbLineDashPattern', 'mpLimbLineDashSegLenF',
621
+ 'mpLimbLineThicknessF', 'mpLimitMode', 'mpMaskAreaSpecifiers',
622
+ 'mpMaskOutlineSpecifiers', 'mpMaxLatF', 'mpMaxLonF',
623
+ 'mpMinLatF', 'mpMinLonF', 'mpMonoFillColor', 'mpMonoFillPattern',
624
+ 'mpMonoFillScale', 'mpNationalLineColor', 'mpNationalLineDashPattern',
625
+ 'mpNationalLineThicknessF', 'mpOceanFillColor', 'mpOceanFillPattern',
626
+ 'mpOceanFillScaleF', 'mpOutlineBoundarySets', 'mpOutlineDrawOrder',
627
+ 'mpOutlineMaskingOn', 'mpOutlineOn', 'mpOutlineSpecifiers',
628
+ 'mpPerimDrawOrder', 'mpPerimLineColor', 'mpPerimLineDashPattern',
629
+ 'mpPerimLineDashSegLenF', 'mpPerimLineThicknessF', 'mpPerimOn',
630
+ 'mpPolyMode', 'mpProjection', 'mpProvincialLineColor',
631
+ 'mpProvincialLineDashPattern', 'mpProvincialLineDashSegLenF',
632
+ 'mpProvincialLineThicknessF', 'mpRelativeCenterLat',
633
+ 'mpRelativeCenterLon', 'mpRightAngleF', 'mpRightCornerLatF',
634
+ 'mpRightCornerLonF', 'mpRightMapPosF', 'mpRightNDCF',
635
+ 'mpRightNPCF', 'mpRightPointLatF', 'mpRightPointLonF',
636
+ 'mpRightWindowF', 'mpSatelliteAngle1F', 'mpSatelliteAngle2F',
637
+ 'mpSatelliteDistF', 'mpShapeMode', 'mpSpecifiedFillColors',
638
+ 'mpSpecifiedFillDirectIndexing', 'mpSpecifiedFillPatterns',
639
+ 'mpSpecifiedFillPriority', 'mpSpecifiedFillScales',
640
+ 'mpTopAngleF', 'mpTopMapPosF', 'mpTopNDCF', 'mpTopNPCF',
641
+ 'mpTopPointLatF', 'mpTopPointLonF', 'mpTopWindowF',
642
+ 'mpUSStateLineColor', 'mpUSStateLineDashPattern',
643
+ 'mpUSStateLineDashSegLenF', 'mpUSStateLineThicknessF',
644
+ 'pmAnnoManagers', 'pmAnnoViews', 'pmLabelBarDisplayMode',
645
+ 'pmLabelBarHeightF', 'pmLabelBarKeepAspect', 'pmLabelBarOrthogonalPosF',
646
+ 'pmLabelBarParallelPosF', 'pmLabelBarSide', 'pmLabelBarWidthF',
647
+ 'pmLabelBarZone', 'pmLegendDisplayMode', 'pmLegendHeightF',
648
+ 'pmLegendKeepAspect', 'pmLegendOrthogonalPosF',
649
+ 'pmLegendParallelPosF', 'pmLegendSide', 'pmLegendWidthF',
650
+ 'pmLegendZone', 'pmOverlaySequenceIds', 'pmTickMarkDisplayMode',
651
+ 'pmTickMarkZone', 'pmTitleDisplayMode', 'pmTitleZone',
652
+ 'prGraphicStyle', 'prPolyType', 'prXArray', 'prYArray',
653
+ 'sfCopyData', 'sfDataArray', 'sfDataMaxV', 'sfDataMinV',
654
+ 'sfElementNodes', 'sfExchangeDimensions', 'sfFirstNodeIndex',
655
+ 'sfMissingValueV', 'sfXArray', 'sfXCActualEndF', 'sfXCActualStartF',
656
+ 'sfXCEndIndex', 'sfXCEndSubsetV', 'sfXCEndV', 'sfXCStartIndex',
657
+ 'sfXCStartSubsetV', 'sfXCStartV', 'sfXCStride', 'sfXCellBounds',
658
+ 'sfYArray', 'sfYCActualEndF', 'sfYCActualStartF', 'sfYCEndIndex',
659
+ 'sfYCEndSubsetV', 'sfYCEndV', 'sfYCStartIndex', 'sfYCStartSubsetV',
660
+ 'sfYCStartV', 'sfYCStride', 'sfYCellBounds', 'stArrowLengthF',
661
+ 'stArrowStride', 'stCrossoverCheckCount',
662
+ 'stExplicitLabelBarLabelsOn', 'stLabelBarEndLabelsOn',
663
+ 'stLabelFormat', 'stLengthCheckCount', 'stLevelColors',
664
+ 'stLevelCount', 'stLevelPalette', 'stLevelSelectionMode',
665
+ 'stLevelSpacingF', 'stLevels', 'stLineColor', 'stLineOpacityF',
666
+ 'stLineStartStride', 'stLineThicknessF', 'stMapDirection',
667
+ 'stMaxLevelCount', 'stMaxLevelValF', 'stMinArrowSpacingF',
668
+ 'stMinDistanceF', 'stMinLevelValF', 'stMinLineSpacingF',
669
+ 'stMinStepFactorF', 'stMonoLineColor', 'stNoDataLabelOn',
670
+ 'stNoDataLabelString', 'stScalarFieldData', 'stScalarMissingValColor',
671
+ 'stSpanLevelPalette', 'stStepSizeF', 'stStreamlineDrawOrder',
672
+ 'stUseScalarArray', 'stVectorFieldData', 'stZeroFLabelAngleF',
673
+ 'stZeroFLabelBackgroundColor', 'stZeroFLabelConstantSpacingF',
674
+ 'stZeroFLabelFont', 'stZeroFLabelFontAspectF',
675
+ 'stZeroFLabelFontColor', 'stZeroFLabelFontHeightF',
676
+ 'stZeroFLabelFontQuality', 'stZeroFLabelFontThicknessF',
677
+ 'stZeroFLabelFuncCode', 'stZeroFLabelJust', 'stZeroFLabelOn',
678
+ 'stZeroFLabelOrthogonalPosF', 'stZeroFLabelParallelPosF',
679
+ 'stZeroFLabelPerimColor', 'stZeroFLabelPerimOn',
680
+ 'stZeroFLabelPerimSpaceF', 'stZeroFLabelPerimThicknessF',
681
+ 'stZeroFLabelSide', 'stZeroFLabelString', 'stZeroFLabelTextDirection',
682
+ 'stZeroFLabelZone', 'tfDoNDCOverlay', 'tfPlotManagerOn',
683
+ 'tfPolyDrawList', 'tfPolyDrawOrder', 'tiDeltaF', 'tiMainAngleF',
684
+ 'tiMainConstantSpacingF', 'tiMainDirection', 'tiMainFont',
685
+ 'tiMainFontAspectF', 'tiMainFontColor', 'tiMainFontHeightF',
686
+ 'tiMainFontQuality', 'tiMainFontThicknessF', 'tiMainFuncCode',
687
+ 'tiMainJust', 'tiMainOffsetXF', 'tiMainOffsetYF', 'tiMainOn',
688
+ 'tiMainPosition', 'tiMainSide', 'tiMainString', 'tiUseMainAttributes',
689
+ 'tiXAxisAngleF', 'tiXAxisConstantSpacingF', 'tiXAxisDirection',
690
+ 'tiXAxisFont', 'tiXAxisFontAspectF', 'tiXAxisFontColor',
691
+ 'tiXAxisFontHeightF', 'tiXAxisFontQuality', 'tiXAxisFontThicknessF',
692
+ 'tiXAxisFuncCode', 'tiXAxisJust', 'tiXAxisOffsetXF',
693
+ 'tiXAxisOffsetYF', 'tiXAxisOn', 'tiXAxisPosition', 'tiXAxisSide',
694
+ 'tiXAxisString', 'tiYAxisAngleF', 'tiYAxisConstantSpacingF',
695
+ 'tiYAxisDirection', 'tiYAxisFont', 'tiYAxisFontAspectF',
696
+ 'tiYAxisFontColor', 'tiYAxisFontHeightF', 'tiYAxisFontQuality',
697
+ 'tiYAxisFontThicknessF', 'tiYAxisFuncCode', 'tiYAxisJust',
698
+ 'tiYAxisOffsetXF', 'tiYAxisOffsetYF', 'tiYAxisOn', 'tiYAxisPosition',
699
+ 'tiYAxisSide', 'tiYAxisString', 'tmBorderLineColor',
700
+ 'tmBorderThicknessF', 'tmEqualizeXYSizes', 'tmLabelAutoStride',
701
+ 'tmSciNoteCutoff', 'tmXBAutoPrecision', 'tmXBBorderOn',
702
+ 'tmXBDataLeftF', 'tmXBDataRightF', 'tmXBFormat', 'tmXBIrrTensionF',
703
+ 'tmXBIrregularPoints', 'tmXBLabelAngleF', 'tmXBLabelConstantSpacingF',
704
+ 'tmXBLabelDeltaF', 'tmXBLabelDirection', 'tmXBLabelFont',
705
+ 'tmXBLabelFontAspectF', 'tmXBLabelFontColor', 'tmXBLabelFontHeightF',
706
+ 'tmXBLabelFontQuality', 'tmXBLabelFontThicknessF',
707
+ 'tmXBLabelFuncCode', 'tmXBLabelJust', 'tmXBLabelStride', 'tmXBLabels',
708
+ 'tmXBLabelsOn', 'tmXBMajorLengthF', 'tmXBMajorLineColor',
709
+ 'tmXBMajorOutwardLengthF', 'tmXBMajorThicknessF', 'tmXBMaxLabelLenF',
710
+ 'tmXBMaxTicks', 'tmXBMinLabelSpacingF', 'tmXBMinorLengthF',
711
+ 'tmXBMinorLineColor', 'tmXBMinorOn', 'tmXBMinorOutwardLengthF',
712
+ 'tmXBMinorPerMajor', 'tmXBMinorThicknessF', 'tmXBMinorValues',
713
+ 'tmXBMode', 'tmXBOn', 'tmXBPrecision', 'tmXBStyle', 'tmXBTickEndF',
714
+ 'tmXBTickSpacingF', 'tmXBTickStartF', 'tmXBValues', 'tmXMajorGrid',
715
+ 'tmXMajorGridLineColor', 'tmXMajorGridLineDashPattern',
716
+ 'tmXMajorGridThicknessF', 'tmXMinorGrid', 'tmXMinorGridLineColor',
717
+ 'tmXMinorGridLineDashPattern', 'tmXMinorGridThicknessF',
718
+ 'tmXTAutoPrecision', 'tmXTBorderOn', 'tmXTDataLeftF',
719
+ 'tmXTDataRightF', 'tmXTFormat', 'tmXTIrrTensionF',
720
+ 'tmXTIrregularPoints', 'tmXTLabelAngleF', 'tmXTLabelConstantSpacingF',
721
+ 'tmXTLabelDeltaF', 'tmXTLabelDirection', 'tmXTLabelFont',
722
+ 'tmXTLabelFontAspectF', 'tmXTLabelFontColor', 'tmXTLabelFontHeightF',
723
+ 'tmXTLabelFontQuality', 'tmXTLabelFontThicknessF',
724
+ 'tmXTLabelFuncCode', 'tmXTLabelJust', 'tmXTLabelStride', 'tmXTLabels',
725
+ 'tmXTLabelsOn', 'tmXTMajorLengthF', 'tmXTMajorLineColor',
726
+ 'tmXTMajorOutwardLengthF', 'tmXTMajorThicknessF', 'tmXTMaxLabelLenF',
727
+ 'tmXTMaxTicks', 'tmXTMinLabelSpacingF', 'tmXTMinorLengthF',
728
+ 'tmXTMinorLineColor', 'tmXTMinorOn', 'tmXTMinorOutwardLengthF',
729
+ 'tmXTMinorPerMajor', 'tmXTMinorThicknessF', 'tmXTMinorValues',
730
+ 'tmXTMode', 'tmXTOn', 'tmXTPrecision', 'tmXTStyle', 'tmXTTickEndF',
731
+ 'tmXTTickSpacingF', 'tmXTTickStartF', 'tmXTValues', 'tmXUseBottom',
732
+ 'tmYLAutoPrecision', 'tmYLBorderOn', 'tmYLDataBottomF',
733
+ 'tmYLDataTopF', 'tmYLFormat', 'tmYLIrrTensionF',
734
+ 'tmYLIrregularPoints', 'tmYLLabelAngleF', 'tmYLLabelConstantSpacingF',
735
+ 'tmYLLabelDeltaF', 'tmYLLabelDirection', 'tmYLLabelFont',
736
+ 'tmYLLabelFontAspectF', 'tmYLLabelFontColor', 'tmYLLabelFontHeightF',
737
+ 'tmYLLabelFontQuality', 'tmYLLabelFontThicknessF',
738
+ 'tmYLLabelFuncCode', 'tmYLLabelJust', 'tmYLLabelStride', 'tmYLLabels',
739
+ 'tmYLLabelsOn', 'tmYLMajorLengthF', 'tmYLMajorLineColor',
740
+ 'tmYLMajorOutwardLengthF', 'tmYLMajorThicknessF', 'tmYLMaxLabelLenF',
741
+ 'tmYLMaxTicks', 'tmYLMinLabelSpacingF', 'tmYLMinorLengthF',
742
+ 'tmYLMinorLineColor', 'tmYLMinorOn', 'tmYLMinorOutwardLengthF',
743
+ 'tmYLMinorPerMajor', 'tmYLMinorThicknessF', 'tmYLMinorValues',
744
+ 'tmYLMode', 'tmYLOn', 'tmYLPrecision', 'tmYLStyle', 'tmYLTickEndF',
745
+ 'tmYLTickSpacingF', 'tmYLTickStartF', 'tmYLValues', 'tmYMajorGrid',
746
+ 'tmYMajorGridLineColor', 'tmYMajorGridLineDashPattern',
747
+ 'tmYMajorGridThicknessF', 'tmYMinorGrid', 'tmYMinorGridLineColor',
748
+ 'tmYMinorGridLineDashPattern', 'tmYMinorGridThicknessF',
749
+ 'tmYRAutoPrecision', 'tmYRBorderOn', 'tmYRDataBottomF',
750
+ 'tmYRDataTopF', 'tmYRFormat', 'tmYRIrrTensionF',
751
+ 'tmYRIrregularPoints', 'tmYRLabelAngleF', 'tmYRLabelConstantSpacingF',
752
+ 'tmYRLabelDeltaF', 'tmYRLabelDirection', 'tmYRLabelFont',
753
+ 'tmYRLabelFontAspectF', 'tmYRLabelFontColor', 'tmYRLabelFontHeightF',
754
+ 'tmYRLabelFontQuality', 'tmYRLabelFontThicknessF',
755
+ 'tmYRLabelFuncCode', 'tmYRLabelJust', 'tmYRLabelStride', 'tmYRLabels',
756
+ 'tmYRLabelsOn', 'tmYRMajorLengthF', 'tmYRMajorLineColor',
757
+ 'tmYRMajorOutwardLengthF', 'tmYRMajorThicknessF', 'tmYRMaxLabelLenF',
758
+ 'tmYRMaxTicks', 'tmYRMinLabelSpacingF', 'tmYRMinorLengthF',
759
+ 'tmYRMinorLineColor', 'tmYRMinorOn', 'tmYRMinorOutwardLengthF',
760
+ 'tmYRMinorPerMajor', 'tmYRMinorThicknessF', 'tmYRMinorValues',
761
+ 'tmYRMode', 'tmYROn', 'tmYRPrecision', 'tmYRStyle', 'tmYRTickEndF',
762
+ 'tmYRTickSpacingF', 'tmYRTickStartF', 'tmYRValues', 'tmYUseLeft',
763
+ 'trGridType', 'trLineInterpolationOn',
764
+ 'trXAxisType', 'trXCoordPoints', 'trXInterPoints', 'trXLog',
765
+ 'trXMaxF', 'trXMinF', 'trXReverse', 'trXSamples', 'trXTensionF',
766
+ 'trYAxisType', 'trYCoordPoints', 'trYInterPoints', 'trYLog',
767
+ 'trYMaxF', 'trYMinF', 'trYReverse', 'trYSamples', 'trYTensionF',
768
+ 'txAngleF', 'txBackgroundFillColor', 'txConstantSpacingF', 'txDirection',
769
+ 'txFont', 'HLU-Fonts', 'txFontAspectF', 'txFontColor',
770
+ 'txFontHeightF', 'txFontOpacityF', 'txFontQuality',
771
+ 'txFontThicknessF', 'txFuncCode', 'txJust', 'txPerimColor',
772
+ 'txPerimDashLengthF', 'txPerimDashPattern', 'txPerimOn',
773
+ 'txPerimSpaceF', 'txPerimThicknessF', 'txPosXF', 'txPosYF',
774
+ 'txString', 'vcExplicitLabelBarLabelsOn', 'vcFillArrowEdgeColor',
775
+ 'vcFillArrowEdgeThicknessF', 'vcFillArrowFillColor',
776
+ 'vcFillArrowHeadInteriorXF', 'vcFillArrowHeadMinFracXF',
777
+ 'vcFillArrowHeadMinFracYF', 'vcFillArrowHeadXF', 'vcFillArrowHeadYF',
778
+ 'vcFillArrowMinFracWidthF', 'vcFillArrowWidthF', 'vcFillArrowsOn',
779
+ 'vcFillOverEdge', 'vcGlyphOpacityF', 'vcGlyphStyle',
780
+ 'vcLabelBarEndLabelsOn', 'vcLabelFontColor', 'vcLabelFontHeightF',
781
+ 'vcLabelsOn', 'vcLabelsUseVectorColor', 'vcLevelColors',
782
+ 'vcLevelCount', 'vcLevelPalette', 'vcLevelSelectionMode',
783
+ 'vcLevelSpacingF', 'vcLevels', 'vcLineArrowColor',
784
+ 'vcLineArrowHeadMaxSizeF', 'vcLineArrowHeadMinSizeF',
785
+ 'vcLineArrowThicknessF', 'vcMagnitudeFormat',
786
+ 'vcMagnitudeScaleFactorF', 'vcMagnitudeScaleValueF',
787
+ 'vcMagnitudeScalingMode', 'vcMapDirection', 'vcMaxLevelCount',
788
+ 'vcMaxLevelValF', 'vcMaxMagnitudeF', 'vcMinAnnoAngleF',
789
+ 'vcMinAnnoArrowAngleF', 'vcMinAnnoArrowEdgeColor',
790
+ 'vcMinAnnoArrowFillColor', 'vcMinAnnoArrowLineColor',
791
+ 'vcMinAnnoArrowMinOffsetF', 'vcMinAnnoArrowSpaceF',
792
+ 'vcMinAnnoArrowUseVecColor', 'vcMinAnnoBackgroundColor',
793
+ 'vcMinAnnoConstantSpacingF', 'vcMinAnnoExplicitMagnitudeF',
794
+ 'vcMinAnnoFont', 'vcMinAnnoFontAspectF', 'vcMinAnnoFontColor',
795
+ 'vcMinAnnoFontHeightF', 'vcMinAnnoFontQuality',
796
+ 'vcMinAnnoFontThicknessF', 'vcMinAnnoFuncCode', 'vcMinAnnoJust',
797
+ 'vcMinAnnoOn', 'vcMinAnnoOrientation', 'vcMinAnnoOrthogonalPosF',
798
+ 'vcMinAnnoParallelPosF', 'vcMinAnnoPerimColor', 'vcMinAnnoPerimOn',
799
+ 'vcMinAnnoPerimSpaceF', 'vcMinAnnoPerimThicknessF', 'vcMinAnnoSide',
800
+ 'vcMinAnnoString1', 'vcMinAnnoString1On', 'vcMinAnnoString2',
801
+ 'vcMinAnnoString2On', 'vcMinAnnoTextDirection', 'vcMinAnnoZone',
802
+ 'vcMinDistanceF', 'vcMinFracLengthF', 'vcMinLevelValF',
803
+ 'vcMinMagnitudeF', 'vcMonoFillArrowEdgeColor',
804
+ 'vcMonoFillArrowFillColor', 'vcMonoLineArrowColor',
805
+ 'vcMonoWindBarbColor', 'vcNoDataLabelOn', 'vcNoDataLabelString',
806
+ 'vcPositionMode', 'vcRefAnnoAngleF', 'vcRefAnnoArrowAngleF',
807
+ 'vcRefAnnoArrowEdgeColor', 'vcRefAnnoArrowFillColor',
808
+ 'vcRefAnnoArrowLineColor', 'vcRefAnnoArrowMinOffsetF',
809
+ 'vcRefAnnoArrowSpaceF', 'vcRefAnnoArrowUseVecColor',
810
+ 'vcRefAnnoBackgroundColor', 'vcRefAnnoConstantSpacingF',
811
+ 'vcRefAnnoExplicitMagnitudeF', 'vcRefAnnoFont',
812
+ 'vcRefAnnoFontAspectF', 'vcRefAnnoFontColor', 'vcRefAnnoFontHeightF',
813
+ 'vcRefAnnoFontQuality', 'vcRefAnnoFontThicknessF',
814
+ 'vcRefAnnoFuncCode', 'vcRefAnnoJust', 'vcRefAnnoOn',
815
+ 'vcRefAnnoOrientation', 'vcRefAnnoOrthogonalPosF',
816
+ 'vcRefAnnoParallelPosF', 'vcRefAnnoPerimColor', 'vcRefAnnoPerimOn',
817
+ 'vcRefAnnoPerimSpaceF', 'vcRefAnnoPerimThicknessF', 'vcRefAnnoSide',
818
+ 'vcRefAnnoString1', 'vcRefAnnoString1On', 'vcRefAnnoString2',
819
+ 'vcRefAnnoString2On', 'vcRefAnnoTextDirection', 'vcRefAnnoZone',
820
+ 'vcRefLengthF', 'vcRefMagnitudeF', 'vcScalarFieldData',
821
+ 'vcScalarMissingValColor', 'vcScalarValueFormat',
822
+ 'vcScalarValueScaleFactorF', 'vcScalarValueScaleValueF',
823
+ 'vcScalarValueScalingMode', 'vcSpanLevelPalette', 'vcUseRefAnnoRes',
824
+ 'vcUseScalarArray', 'vcVectorDrawOrder', 'vcVectorFieldData',
825
+ 'vcWindBarbCalmCircleSizeF', 'vcWindBarbColor',
826
+ 'vcWindBarbLineThicknessF', 'vcWindBarbScaleFactorF',
827
+ 'vcWindBarbTickAngleF', 'vcWindBarbTickLengthF',
828
+ 'vcWindBarbTickSpacingF', 'vcZeroFLabelAngleF',
829
+ 'vcZeroFLabelBackgroundColor', 'vcZeroFLabelConstantSpacingF',
830
+ 'vcZeroFLabelFont', 'vcZeroFLabelFontAspectF',
831
+ 'vcZeroFLabelFontColor', 'vcZeroFLabelFontHeightF',
832
+ 'vcZeroFLabelFontQuality', 'vcZeroFLabelFontThicknessF',
833
+ 'vcZeroFLabelFuncCode', 'vcZeroFLabelJust', 'vcZeroFLabelOn',
834
+ 'vcZeroFLabelOrthogonalPosF', 'vcZeroFLabelParallelPosF',
835
+ 'vcZeroFLabelPerimColor', 'vcZeroFLabelPerimOn',
836
+ 'vcZeroFLabelPerimSpaceF', 'vcZeroFLabelPerimThicknessF',
837
+ 'vcZeroFLabelSide', 'vcZeroFLabelString', 'vcZeroFLabelTextDirection',
838
+ 'vcZeroFLabelZone', 'vfCopyData', 'vfDataArray',
839
+ 'vfExchangeDimensions', 'vfExchangeUVData', 'vfMagMaxV', 'vfMagMinV',
840
+ 'vfMissingUValueV', 'vfMissingVValueV', 'vfPolarData',
841
+ 'vfSingleMissingValue', 'vfUDataArray', 'vfUMaxV', 'vfUMinV',
842
+ 'vfVDataArray', 'vfVMaxV', 'vfVMinV', 'vfXArray', 'vfXCActualEndF',
843
+ 'vfXCActualStartF', 'vfXCEndIndex', 'vfXCEndSubsetV', 'vfXCEndV',
844
+ 'vfXCStartIndex', 'vfXCStartSubsetV', 'vfXCStartV', 'vfXCStride',
845
+ 'vfYArray', 'vfYCActualEndF', 'vfYCActualStartF', 'vfYCEndIndex',
846
+ 'vfYCEndSubsetV', 'vfYCEndV', 'vfYCStartIndex', 'vfYCStartSubsetV',
847
+ 'vfYCStartV', 'vfYCStride', 'vpAnnoManagerId', 'vpClipOn',
848
+ 'vpHeightF', 'vpKeepAspect', 'vpOn', 'vpUseSegments', 'vpWidthF',
849
+ 'vpXF', 'vpYF', 'wkAntiAlias', 'wkBackgroundColor', 'wkBackgroundOpacityF',
850
+ 'wkColorMapLen', 'wkColorMap', 'wkColorModel', 'wkDashTableLength',
851
+ 'wkDefGraphicStyleId', 'wkDeviceLowerX', 'wkDeviceLowerY',
852
+ 'wkDeviceUpperX', 'wkDeviceUpperY', 'wkFileName', 'wkFillTableLength',
853
+ 'wkForegroundColor', 'wkFormat', 'wkFullBackground', 'wkGksWorkId',
854
+ 'wkHeight', 'wkMarkerTableLength', 'wkMetaName', 'wkOrientation',
855
+ 'wkPDFFileName', 'wkPDFFormat', 'wkPDFResolution', 'wkPSFileName',
856
+ 'wkPSFormat', 'wkPSResolution', 'wkPaperHeightF', 'wkPaperSize',
857
+ 'wkPaperWidthF', 'wkPause', 'wkTopLevelViews', 'wkViews',
858
+ 'wkVisualType', 'wkWidth', 'wkWindowId', 'wkXColorMode', 'wsCurrentSize',
859
+ 'wsMaximumSize', 'wsThresholdSize', 'xyComputeXMax',
860
+ 'xyComputeXMin', 'xyComputeYMax', 'xyComputeYMin', 'xyCoordData',
861
+ 'xyCoordDataSpec', 'xyCurveDrawOrder', 'xyDashPattern',
862
+ 'xyDashPatterns', 'xyExplicitLabels', 'xyExplicitLegendLabels',
863
+ 'xyLabelMode', 'xyLineColor', 'xyLineColors', 'xyLineDashSegLenF',
864
+ 'xyLineLabelConstantSpacingF', 'xyLineLabelFont',
865
+ 'xyLineLabelFontAspectF', 'xyLineLabelFontColor',
866
+ 'xyLineLabelFontColors', 'xyLineLabelFontHeightF',
867
+ 'xyLineLabelFontQuality', 'xyLineLabelFontThicknessF',
868
+ 'xyLineLabelFuncCode', 'xyLineThicknessF', 'xyLineThicknesses',
869
+ 'xyMarkLineMode', 'xyMarkLineModes', 'xyMarker', 'xyMarkerColor',
870
+ 'xyMarkerColors', 'xyMarkerSizeF', 'xyMarkerSizes',
871
+ 'xyMarkerThicknessF', 'xyMarkerThicknesses', 'xyMarkers',
872
+ 'xyMonoDashPattern', 'xyMonoLineColor', 'xyMonoLineLabelFontColor',
873
+ 'xyMonoLineThickness', 'xyMonoMarkLineMode', 'xyMonoMarker',
874
+ 'xyMonoMarkerColor', 'xyMonoMarkerSize', 'xyMonoMarkerThickness',
875
+ 'xyXIrrTensionF', 'xyXIrregularPoints', 'xyXStyle', 'xyYIrrTensionF',
876
+ 'xyYIrregularPoints', 'xyYStyle'), prefix=r'\b'),
877
+ Name.Builtin),
878
+
879
+ # Booleans
880
+ (r'\.(True|False)\.', Name.Builtin),
881
+ # Comparing Operators
882
+ (r'\.(eq|ne|lt|le|gt|ge|not|and|or|xor)\.', Operator.Word),
883
+ ],
884
+
885
+ 'strings': [
886
+ (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
887
+ ],
888
+
889
+ 'nums': [
890
+ (r'\d+(?![.e])(_[a-z]\w+)?', Number.Integer),
891
+ (r'[+-]?\d*\.\d+(e[-+]?\d+)?(_[a-z]\w+)?', Number.Float),
892
+ (r'[+-]?\d+\.\d*(e[-+]?\d+)?(_[a-z]\w+)?', Number.Float),
893
+ ],
894
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/parasail.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.parasail
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for ParaSail.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Literal
16
+
17
+ __all__ = ['ParaSailLexer']
18
+
19
+
20
+ class ParaSailLexer(RegexLexer):
21
+ """
22
+ For ParaSail source code.
23
+ """
24
+
25
+ name = 'ParaSail'
26
+ url = 'http://www.parasail-lang.org'
27
+ aliases = ['parasail']
28
+ filenames = ['*.psi', '*.psl']
29
+ mimetypes = ['text/x-parasail']
30
+ version_added = '2.1'
31
+
32
+ flags = re.MULTILINE
33
+
34
+ tokens = {
35
+ 'root': [
36
+ (r'[^\S\n]+', Text),
37
+ (r'//.*?\n', Comment.Single),
38
+ (r'\b(and|or|xor)=', Operator.Word),
39
+ (r'\b(and(\s+then)?|or(\s+else)?|xor|rem|mod|'
40
+ r'(is|not)\s+null)\b',
41
+ Operator.Word),
42
+ # Keywords
43
+ (r'\b(abs|abstract|all|block|class|concurrent|const|continue|'
44
+ r'each|end|exit|extends|exports|forward|func|global|implements|'
45
+ r'import|in|interface|is|lambda|locked|new|not|null|of|op|'
46
+ r'optional|private|queued|ref|return|reverse|separate|some|'
47
+ r'type|until|var|with|'
48
+ # Control flow
49
+ r'if|then|else|elsif|case|for|while|loop)\b',
50
+ Keyword.Reserved),
51
+ (r'(abstract\s+)?(interface|class|op|func|type)',
52
+ Keyword.Declaration),
53
+ # Literals
54
+ (r'"[^"]*"', String),
55
+ (r'\\[\'ntrf"0]', String.Escape),
56
+ (r'#[a-zA-Z]\w*', Literal), # Enumeration
57
+ include('numbers'),
58
+ (r"'[^']'", String.Char),
59
+ (r'[a-zA-Z]\w*', Name),
60
+ # Operators and Punctuation
61
+ (r'(<==|==>|<=>|\*\*=|<\|=|<<=|>>=|==|!=|=\?|<=|>=|'
62
+ r'\*\*|<<|>>|=>|:=|\+=|-=|\*=|\|=|\||/=|\+|-|\*|/|'
63
+ r'\.\.|<\.\.|\.\.<|<\.\.<)',
64
+ Operator),
65
+ (r'(<|>|\[|\]|\(|\)|\||:|;|,|.|\{|\}|->)',
66
+ Punctuation),
67
+ (r'\n+', Text),
68
+ ],
69
+ 'numbers': [
70
+ (r'\d[0-9_]*#[0-9a-fA-F][0-9a-fA-F_]*#', Number.Hex), # any base
71
+ (r'0[xX][0-9a-fA-F][0-9a-fA-F_]*', Number.Hex), # C-like hex
72
+ (r'0[bB][01][01_]*', Number.Bin), # C-like bin
73
+ (r'\d[0-9_]*\.\d[0-9_]*[eE][+-]\d[0-9_]*', # float exp
74
+ Number.Float),
75
+ (r'\d[0-9_]*\.\d[0-9_]*', Number.Float), # float
76
+ (r'\d[0-9_]*', Number.Integer), # integer
77
+ ],
78
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/q.py ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.q
3
+ ~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Q programming language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words, include, bygroups, inherit
12
+ from pygments.token import Comment, Name, Number, Operator, Punctuation, \
13
+ String, Whitespace, Literal, Generic
14
+
15
+ __all__ = ["KLexer", "QLexer"]
16
+
17
+
18
+ class KLexer(RegexLexer):
19
+ """
20
+ For K source code.
21
+ """
22
+
23
+ name = "K"
24
+ aliases = ["k"]
25
+ filenames = ["*.k"]
26
+ url = "https://code.kx.com"
27
+ version_added = '2.12'
28
+
29
+ tokens = {
30
+ "whitespace": [
31
+ # hashbang script
32
+ (r"^#!.*", Comment.Hashbang),
33
+ # Comments
34
+ (r"^/\s*\n", Comment.Multiline, "comments"),
35
+ (r"(?<!\S)/.*", Comment.Single),
36
+ # Whitespace
37
+ (r"\s+", Whitespace),
38
+ # Strings
39
+ (r"\"", String.Double, "strings"),
40
+ ],
41
+ "root": [
42
+ include("whitespace"),
43
+ include("keywords"),
44
+ include("declarations"),
45
+ ],
46
+ "keywords": [
47
+ (words(("abs", "acos", "asin", "atan", "avg", "bin",
48
+ "binr", "by", "cor", "cos", "cov", "dev",
49
+ "delete", "div", "do", "enlist", "exec", "exit",
50
+ "exp", "from", "getenv", "hopen", "if", "in",
51
+ "insert", "last", "like", "log", "max", "min",
52
+ "prd", "select", "setenv", "sin", "sqrt", "ss",
53
+ "sum", "tan", "update", "var", "wavg", "while",
54
+ "within", "wsum", "xexp"),
55
+ suffix=r"\b"), Operator.Word),
56
+ ],
57
+ "declarations": [
58
+ # Timing
59
+ (r"^\\ts?", Comment.Preproc),
60
+ (r"^(\\\w\s+[^/\n]*?)(/.*)",
61
+ bygroups(Comment.Preproc, Comment.Single)),
62
+ # Generic System Commands
63
+ (r"^\\\w.*", Comment.Preproc),
64
+ # Prompt
65
+ (r"^[a-zA-Z]\)", Generic.Prompt),
66
+ # Function Names
67
+ (r"([.]?[a-zA-Z][\w.]*)(\s*)([-.~=!@#$%^&*_+|,<>?/\\:']?:)(\s*)(\{)",
68
+ bygroups(Name.Function, Whitespace, Operator, Whitespace, Punctuation),
69
+ "functions"),
70
+ # Variable Names
71
+ (r"([.]?[a-zA-Z][\w.]*)(\s*)([-.~=!@#$%^&*_+|,<>?/\\:']?:)",
72
+ bygroups(Name.Variable, Whitespace, Operator)),
73
+ # Functions
74
+ (r"\{", Punctuation, "functions"),
75
+ # Parentheses
76
+ (r"\(", Punctuation, "parentheses"),
77
+ # Brackets
78
+ (r"\[", Punctuation, "brackets"),
79
+ # Errors
80
+ (r"'`([a-zA-Z][\w.]*)?", Name.Exception),
81
+ # File Symbols
82
+ (r"`:([a-zA-Z/][\w./]*)?", String.Symbol),
83
+ # Symbols
84
+ (r"`([a-zA-Z][\w.]*)?", String.Symbol),
85
+ # Numbers
86
+ include("numbers"),
87
+ # Variable Names
88
+ (r"[a-zA-Z][\w.]*", Name),
89
+ # Operators
90
+ (r"[-=+*#$%@!~^&:.,<>'\\|/?_]", Operator),
91
+ # Punctuation
92
+ (r";", Punctuation),
93
+ ],
94
+ "functions": [
95
+ include("root"),
96
+ (r"\}", Punctuation, "#pop"),
97
+ ],
98
+ "parentheses": [
99
+ include("root"),
100
+ (r"\)", Punctuation, "#pop"),
101
+ ],
102
+ "brackets": [
103
+ include("root"),
104
+ (r"\]", Punctuation, "#pop"),
105
+ ],
106
+ "numbers": [
107
+ # Binary Values
108
+ (r"[01]+b", Number.Bin),
109
+ # Nulls/Infinities
110
+ (r"0[nNwW][cefghijmndzuvtp]?", Number),
111
+ # Timestamps
112
+ ((r"(?:[0-9]{4}[.][0-9]{2}[.][0-9]{2}|[0-9]+)"
113
+ "D(?:[0-9](?:[0-9](?::[0-9]{2}"
114
+ "(?::[0-9]{2}(?:[.][0-9]*)?)?)?)?)?"), Literal.Date),
115
+ # Datetimes
116
+ ((r"[0-9]{4}[.][0-9]{2}"
117
+ "(?:m|[.][0-9]{2}(?:T(?:[0-9]{2}:[0-9]{2}"
118
+ "(?::[0-9]{2}(?:[.][0-9]*)?)?)?)?)"), Literal.Date),
119
+ # Times
120
+ (r"[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:[.][0-9]{1,3})?)?",
121
+ Literal.Date),
122
+ # GUIDs
123
+ (r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",
124
+ Number.Hex),
125
+ # Byte Vectors
126
+ (r"0x[0-9a-fA-F]+", Number.Hex),
127
+ # Floats
128
+ (r"([0-9]*[.]?[0-9]+|[0-9]+[.]?[0-9]*)[eE][+-]?[0-9]+[ef]?",
129
+ Number.Float),
130
+ (r"([0-9]*[.][0-9]+|[0-9]+[.][0-9]*)[ef]?", Number.Float),
131
+ (r"[0-9]+[ef]", Number.Float),
132
+ # Characters
133
+ (r"[0-9]+c", Number),
134
+ # Integers
135
+ (r"[0-9]+[ihtuv]", Number.Integer),
136
+ # Long Integers
137
+ (r"[0-9]+[jnp]?", Number.Integer.Long),
138
+ ],
139
+ "comments": [
140
+ (r"[^\\]+", Comment.Multiline),
141
+ (r"^\\", Comment.Multiline, "#pop"),
142
+ (r"\\", Comment.Multiline),
143
+ ],
144
+ "strings": [
145
+ (r'[^"\\]+', String.Double),
146
+ (r"\\.", String.Escape),
147
+ (r'"', String.Double, "#pop"),
148
+ ],
149
+ }
150
+
151
+
152
+ class QLexer(KLexer):
153
+ """
154
+ For `Q <https://code.kx.com/>`_ source code.
155
+ """
156
+
157
+ name = "Q"
158
+ aliases = ["q"]
159
+ filenames = ["*.q"]
160
+ version_added = '2.12'
161
+
162
+ tokens = {
163
+ "root": [
164
+ (words(("aj", "aj0", "ajf", "ajf0", "all", "and", "any", "asc",
165
+ "asof", "attr", "avgs", "ceiling", "cols", "count", "cross",
166
+ "csv", "cut", "deltas", "desc", "differ", "distinct", "dsave",
167
+ "each", "ej", "ema", "eval", "except", "fby", "fills", "first",
168
+ "fkeys", "flip", "floor", "get", "group", "gtime", "hclose",
169
+ "hcount", "hdel", "hsym", "iasc", "idesc", "ij", "ijf",
170
+ "inter", "inv", "key", "keys", "lj", "ljf", "load", "lower",
171
+ "lsq", "ltime", "ltrim", "mavg", "maxs", "mcount", "md5",
172
+ "mdev", "med", "meta", "mins", "mmax", "mmin", "mmu", "mod",
173
+ "msum", "neg", "next", "not", "null", "or", "over", "parse",
174
+ "peach", "pj", "prds", "prior", "prev", "rand", "rank", "ratios",
175
+ "raze", "read0", "read1", "reciprocal", "reval", "reverse",
176
+ "rload", "rotate", "rsave", "rtrim", "save", "scan", "scov",
177
+ "sdev", "set", "show", "signum", "ssr", "string", "sublist",
178
+ "sums", "sv", "svar", "system", "tables", "til", "trim", "txf",
179
+ "type", "uj", "ujf", "ungroup", "union", "upper", "upsert",
180
+ "value", "view", "views", "vs", "where", "wj", "wj1", "ww",
181
+ "xasc", "xbar", "xcol", "xcols", "xdesc", "xgroup", "xkey",
182
+ "xlog", "xprev", "xrank"),
183
+ suffix=r"\b"), Name.Builtin,
184
+ ),
185
+ inherit,
186
+ ],
187
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ride.py ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ride
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Ride programming language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words, include
12
+ from pygments.token import Comment, Keyword, Name, Number, Punctuation, \
13
+ String, Text
14
+
15
+ __all__ = ['RideLexer']
16
+
17
+
18
+ class RideLexer(RegexLexer):
19
+ """
20
+ For Ride source code.
21
+ """
22
+
23
+ name = 'Ride'
24
+ aliases = ['ride']
25
+ filenames = ['*.ride']
26
+ mimetypes = ['text/x-ride']
27
+ url = 'https://docs.waves.tech/en/ride'
28
+ version_added = '2.6'
29
+
30
+ validName = r'[a-zA-Z_][a-zA-Z0-9_\']*'
31
+
32
+ builtinOps = (
33
+ '||', '|', '>=', '>', '==', '!',
34
+ '=', '<=', '<', '::', ':+', ':', '!=', '/',
35
+ '.', '=>', '-', '+', '*', '&&', '%', '++',
36
+ )
37
+
38
+ globalVariablesName = (
39
+ 'NOALG', 'MD5', 'SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512',
40
+ 'SHA3224', 'SHA3256', 'SHA3384', 'SHA3512', 'nil', 'this', 'unit',
41
+ 'height', 'lastBlock', 'Buy', 'Sell', 'CEILING', 'FLOOR', 'DOWN',
42
+ 'HALFDOWN', 'HALFEVEN', 'HALFUP', 'UP',
43
+ )
44
+
45
+ typesName = (
46
+ 'Unit', 'Int', 'Boolean', 'ByteVector', 'String', 'Address', 'Alias',
47
+ 'Transfer', 'AssetPair', 'DataEntry', 'Order', 'Transaction',
48
+ 'GenesisTransaction', 'PaymentTransaction', 'ReissueTransaction',
49
+ 'BurnTransaction', 'MassTransferTransaction', 'ExchangeTransaction',
50
+ 'TransferTransaction', 'SetAssetScriptTransaction',
51
+ 'InvokeScriptTransaction', 'IssueTransaction', 'LeaseTransaction',
52
+ 'LeaseCancelTransaction', 'CreateAliasTransaction',
53
+ 'SetScriptTransaction', 'SponsorFeeTransaction', 'DataTransaction',
54
+ 'WriteSet', 'AttachedPayment', 'ScriptTransfer', 'TransferSet',
55
+ 'ScriptResult', 'Invocation', 'Asset', 'BlockInfo', 'Issue', 'Reissue',
56
+ 'Burn', 'NoAlg', 'Md5', 'Sha1', 'Sha224', 'Sha256', 'Sha384', 'Sha512',
57
+ 'Sha3224', 'Sha3256', 'Sha3384', 'Sha3512', 'BinaryEntry',
58
+ 'BooleanEntry', 'IntegerEntry', 'StringEntry', 'List', 'Ceiling',
59
+ 'Down', 'Floor', 'HalfDown', 'HalfEven', 'HalfUp', 'Up',
60
+ )
61
+
62
+ functionsName = (
63
+ 'fraction', 'size', 'toBytes', 'take', 'drop', 'takeRight', 'dropRight',
64
+ 'toString', 'isDefined', 'extract', 'throw', 'getElement', 'value',
65
+ 'cons', 'toUtf8String', 'toInt', 'indexOf', 'lastIndexOf', 'split',
66
+ 'parseInt', 'parseIntValue', 'keccak256', 'blake2b256', 'sha256',
67
+ 'sigVerify', 'toBase58String', 'fromBase58String', 'toBase64String',
68
+ 'fromBase64String', 'transactionById', 'transactionHeightById',
69
+ 'getInteger', 'getBoolean', 'getBinary', 'getString',
70
+ 'addressFromPublicKey', 'addressFromString', 'addressFromRecipient',
71
+ 'assetBalance', 'wavesBalance', 'getIntegerValue', 'getBooleanValue',
72
+ 'getBinaryValue', 'getStringValue', 'addressFromStringValue',
73
+ 'assetInfo', 'rsaVerify', 'checkMerkleProof', 'median',
74
+ 'valueOrElse', 'valueOrErrorMessage', 'contains', 'log', 'pow',
75
+ 'toBase16String', 'fromBase16String', 'blockInfoByHeight',
76
+ 'transferTransactionById',
77
+ )
78
+
79
+ reservedWords = words((
80
+ 'match', 'case', 'else', 'func', 'if',
81
+ 'let', 'then', '@Callable', '@Verifier',
82
+ ), suffix=r'\b')
83
+
84
+ tokens = {
85
+ 'root': [
86
+ # Comments
87
+ (r'#.*', Comment.Single),
88
+ # Whitespace
89
+ (r'\s+', Text),
90
+ # Strings
91
+ (r'"', String, 'doublequote'),
92
+ (r'utf8\'', String, 'utf8quote'),
93
+ (r'base(58|64|16)\'', String, 'singlequote'),
94
+ # Keywords
95
+ (reservedWords, Keyword.Reserved),
96
+ (r'\{-#.*?#-\}', Keyword.Reserved),
97
+ (r'FOLD<\d+>', Keyword.Reserved),
98
+ # Types
99
+ (words(typesName), Keyword.Type),
100
+ # Main
101
+ # (specialName, Keyword.Reserved),
102
+ # Prefix Operators
103
+ (words(builtinOps, prefix=r'\(', suffix=r'\)'), Name.Function),
104
+ # Infix Operators
105
+ (words(builtinOps), Name.Function),
106
+ (words(globalVariablesName), Name.Function),
107
+ (words(functionsName), Name.Function),
108
+ # Numbers
109
+ include('numbers'),
110
+ # Variable Names
111
+ (validName, Name.Variable),
112
+ # Parens
113
+ (r'[,()\[\]{}]', Punctuation),
114
+ ],
115
+
116
+ 'doublequote': [
117
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
118
+ (r'\\[nrfvb\\"]', String.Escape),
119
+ (r'[^"]', String),
120
+ (r'"', String, '#pop'),
121
+ ],
122
+
123
+ 'utf8quote': [
124
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
125
+ (r'\\[nrfvb\\\']', String.Escape),
126
+ (r'[^\']', String),
127
+ (r'\'', String, '#pop'),
128
+ ],
129
+
130
+ 'singlequote': [
131
+ (r'[^\']', String),
132
+ (r'\'', String, '#pop'),
133
+ ],
134
+
135
+ 'numbers': [
136
+ (r'_?\d+', Number.Integer),
137
+ ],
138
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/roboconf.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.roboconf
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Roboconf DSL.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words, re
12
+ from pygments.token import Text, Operator, Keyword, Name, Comment
13
+
14
+ __all__ = ['RoboconfGraphLexer', 'RoboconfInstancesLexer']
15
+
16
+
17
+ class RoboconfGraphLexer(RegexLexer):
18
+ """
19
+ Lexer for Roboconf graph files.
20
+ """
21
+ name = 'Roboconf Graph'
22
+ aliases = ['roboconf-graph']
23
+ filenames = ['*.graph']
24
+ url = 'https://roboconf.github.io/en/user-guide/graph-definition.html'
25
+ version_added = '2.1'
26
+
27
+ flags = re.IGNORECASE | re.MULTILINE
28
+ tokens = {
29
+ 'root': [
30
+ # Skip white spaces
31
+ (r'\s+', Text),
32
+
33
+ # There is one operator
34
+ (r'=', Operator),
35
+
36
+ # Keywords
37
+ (words(('facet', 'import'), suffix=r'\s*\b', prefix=r'\b'), Keyword),
38
+ (words((
39
+ 'installer', 'extends', 'exports', 'imports', 'facets',
40
+ 'children'), suffix=r'\s*:?', prefix=r'\b'), Name),
41
+
42
+ # Comments
43
+ (r'#.*\n', Comment),
44
+
45
+ # Default
46
+ (r'[^#]', Text),
47
+ (r'.*\n', Text)
48
+ ]
49
+ }
50
+
51
+
52
+ class RoboconfInstancesLexer(RegexLexer):
53
+ """
54
+ Lexer for Roboconf instances files.
55
+ """
56
+ name = 'Roboconf Instances'
57
+ aliases = ['roboconf-instances']
58
+ filenames = ['*.instances']
59
+ url = 'https://roboconf.github.io'
60
+ version_added = '2.1'
61
+
62
+ flags = re.IGNORECASE | re.MULTILINE
63
+ tokens = {
64
+ 'root': [
65
+
66
+ # Skip white spaces
67
+ (r'\s+', Text),
68
+
69
+ # Keywords
70
+ (words(('instance of', 'import'), suffix=r'\s*\b', prefix=r'\b'), Keyword),
71
+ (words(('name', 'count'), suffix=r's*:?', prefix=r'\b'), Name),
72
+ (r'\s*[\w.-]+\s*:', Name),
73
+
74
+ # Comments
75
+ (r'#.*\n', Comment),
76
+
77
+ # Default
78
+ (r'[^#]', Text),
79
+ (r'.*\n', Text)
80
+ ]
81
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/supercollider.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.supercollider
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for SuperCollider
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, words, default
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation
16
+
17
+ __all__ = ['SuperColliderLexer']
18
+
19
+
20
+ class SuperColliderLexer(RegexLexer):
21
+ """
22
+ For SuperCollider source code.
23
+ """
24
+
25
+ name = 'SuperCollider'
26
+ url = 'http://supercollider.github.io/'
27
+ aliases = ['supercollider', 'sc']
28
+ filenames = ['*.sc', '*.scd']
29
+ mimetypes = ['application/supercollider', 'text/supercollider']
30
+ version_added = '2.1'
31
+
32
+ flags = re.DOTALL | re.MULTILINE
33
+ tokens = {
34
+ 'commentsandwhitespace': [
35
+ (r'\s+', Text),
36
+ (r'<!--', Comment),
37
+ (r'//.*?\n', Comment.Single),
38
+ (r'/\*.*?\*/', Comment.Multiline)
39
+ ],
40
+ 'slashstartsregex': [
41
+ include('commentsandwhitespace'),
42
+ (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
43
+ r'([gim]+\b|\B)', String.Regex, '#pop'),
44
+ (r'(?=/)', Text, ('#pop', 'badregex')),
45
+ default('#pop'),
46
+ ],
47
+ 'badregex': [
48
+ (r'\n', Text, '#pop')
49
+ ],
50
+ 'root': [
51
+ (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
52
+ include('commentsandwhitespace'),
53
+ (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
54
+ r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
55
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
56
+ (r'[})\].]', Punctuation),
57
+ (words((
58
+ 'for', 'in', 'while', 'do', 'break', 'return', 'continue',
59
+ 'switch', 'case', 'default', 'if', 'else', 'throw', 'try',
60
+ 'catch', 'finally', 'new', 'delete', 'typeof', 'instanceof',
61
+ 'void'), suffix=r'\b'),
62
+ Keyword, 'slashstartsregex'),
63
+ (words(('var', 'let', 'with', 'function', 'arg'), suffix=r'\b'),
64
+ Keyword.Declaration, 'slashstartsregex'),
65
+ (words((
66
+ '(abstract', 'boolean', 'byte', 'char', 'class', 'const',
67
+ 'debugger', 'double', 'enum', 'export', 'extends', 'final',
68
+ 'float', 'goto', 'implements', 'import', 'int', 'interface',
69
+ 'long', 'native', 'package', 'private', 'protected', 'public',
70
+ 'short', 'static', 'super', 'synchronized', 'throws',
71
+ 'transient', 'volatile'), suffix=r'\b'),
72
+ Keyword.Reserved),
73
+ (words(('true', 'false', 'nil', 'inf'), suffix=r'\b'), Keyword.Constant),
74
+ (words((
75
+ 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Number',
76
+ 'Object', 'Packages', 'RegExp', 'String',
77
+ 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'super',
78
+ 'thisFunctionDef', 'thisFunction', 'thisMethod', 'thisProcess',
79
+ 'thisThread', 'this'), suffix=r'\b'),
80
+ Name.Builtin),
81
+ (r'[$a-zA-Z_]\w*', Name.Other),
82
+ (r'\\?[$a-zA-Z_]\w*', String.Symbol),
83
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
84
+ (r'0x[0-9a-fA-F]+', Number.Hex),
85
+ (r'[0-9]+', Number.Integer),
86
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
87
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
88
+ ]
89
+ }
90
+
91
+ def analyse_text(text):
92
+ """We're searching for a common function and a unique keyword here."""
93
+ if 'SinOsc' in text or 'thisFunctionDef' in text:
94
+ return 0.1
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/whiley.py ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.whiley
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Whiley language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, words
12
+ from pygments.token import Comment, Keyword, Name, Number, Operator, \
13
+ Punctuation, String, Text
14
+
15
+ __all__ = ['WhileyLexer']
16
+
17
+
18
+ class WhileyLexer(RegexLexer):
19
+ """
20
+ Lexer for the Whiley programming language.
21
+ """
22
+ name = 'Whiley'
23
+ url = 'http://whiley.org/'
24
+ filenames = ['*.whiley']
25
+ aliases = ['whiley']
26
+ mimetypes = ['text/x-whiley']
27
+ version_added = '2.2'
28
+
29
+ # See the language specification:
30
+ # http://whiley.org/download/WhileyLanguageSpec.pdf
31
+
32
+ tokens = {
33
+ 'root': [
34
+ # Whitespace
35
+ (r'\s+', Text),
36
+
37
+ # Comments
38
+ (r'//.*', Comment.Single),
39
+ # don't parse empty comment as doc comment
40
+ (r'/\*\*/', Comment.Multiline),
41
+ (r'(?s)/\*\*.*?\*/', String.Doc),
42
+ (r'(?s)/\*.*?\*/', Comment.Multiline),
43
+
44
+ # Keywords
45
+ (words((
46
+ 'if', 'else', 'while', 'for', 'do', 'return',
47
+ 'switch', 'case', 'default', 'break', 'continue',
48
+ 'requires', 'ensures', 'where', 'assert', 'assume',
49
+ 'all', 'no', 'some', 'in', 'is', 'new',
50
+ 'throw', 'try', 'catch', 'debug', 'skip', 'fail',
51
+ 'finite', 'total'), suffix=r'\b'), Keyword.Reserved),
52
+ (words((
53
+ 'function', 'method', 'public', 'private', 'protected',
54
+ 'export', 'native'), suffix=r'\b'), Keyword.Declaration),
55
+ # "constant" & "type" are not keywords unless used in declarations
56
+ (r'(constant|type)(\s+)([a-zA-Z_]\w*)(\s+)(is)\b',
57
+ bygroups(Keyword.Declaration, Text, Name, Text, Keyword.Reserved)),
58
+ (r'(true|false|null)\b', Keyword.Constant),
59
+ (r'(bool|byte|int|real|any|void)\b', Keyword.Type),
60
+ # "from" is not a keyword unless used with import
61
+ (r'(import)(\s+)(\*)([^\S\n]+)(from)\b',
62
+ bygroups(Keyword.Namespace, Text, Punctuation, Text, Keyword.Namespace)),
63
+ (r'(import)(\s+)([a-zA-Z_]\w*)([^\S\n]+)(from)\b',
64
+ bygroups(Keyword.Namespace, Text, Name, Text, Keyword.Namespace)),
65
+ (r'(package|import)\b', Keyword.Namespace),
66
+
67
+ # standard library: https://github.com/Whiley/WhileyLibs/
68
+ (words((
69
+ # types defined in whiley.lang.Int
70
+ 'i8', 'i16', 'i32', 'i64',
71
+ 'u8', 'u16', 'u32', 'u64',
72
+ 'uint', 'nat',
73
+
74
+ # whiley.lang.Any
75
+ 'toString'), suffix=r'\b'), Name.Builtin),
76
+
77
+ # byte literal
78
+ (r'[01]+b', Number.Bin),
79
+
80
+ # decimal literal
81
+ (r'[0-9]+\.[0-9]+', Number.Float),
82
+ # match "1." but not ranges like "3..5"
83
+ (r'[0-9]+\.(?!\.)', Number.Float),
84
+
85
+ # integer literal
86
+ (r'0x[0-9a-fA-F]+', Number.Hex),
87
+ (r'[0-9]+', Number.Integer),
88
+
89
+ # character literal
90
+ (r"""'[^\\]'""", String.Char),
91
+ (r"""(')(\\['"\\btnfr])(')""",
92
+ bygroups(String.Char, String.Escape, String.Char)),
93
+
94
+ # string literal
95
+ (r'"', String, 'string'),
96
+
97
+ # operators and punctuation
98
+ (r'[{}()\[\],.;]', Punctuation),
99
+ (r'[+\-*/%&|<>^!~@=:?'
100
+ # unicode operators
101
+ r'\u2200\u2203\u2205\u2282\u2286\u2283\u2287'
102
+ r'\u222A\u2229\u2264\u2265\u2208\u2227\u2228'
103
+ r']', Operator),
104
+
105
+ # identifier
106
+ (r'[a-zA-Z_]\w*', Name),
107
+ ],
108
+ 'string': [
109
+ (r'"', String, '#pop'),
110
+ (r'\\[btnfr]', String.Escape),
111
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
112
+ (r'\\.', String),
113
+ (r'[^\\"]+', String),
114
+ ],
115
+ }