Add files using upload-large-folder tool
Browse files- LTA_openwebtext_dualt/logs/lta_lm1b_nosep_step1000_pos0_probe.log +39 -0
- LTA_openwebtext_dualt/logs/lta_owt_bert_absrope_time4_dirichlet_len1024_C1_to_1024_mask1_sameT_gbs512_b32_8gpu_1m_save10k_20260526.log +0 -0
- LTA_openwebtext_dualt/logs/lta_owt_c1024_gpt2_cached_exact100_repeat1024_4gpu_200step_small384x6_batchvalidwrong.log +83 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/_sourcemod_builtins.py +1151 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ambient.py +75 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/crystal.py +364 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/dsls.py +970 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/esoteric.py +300 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/fortran.py +212 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/gleam.py +74 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/haxe.py +941 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/json5.py +83 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ooc.py +84 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/r.py +196 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/scdoc.py +85 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/teraterm.py +335 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/tnt.py +270 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/urbi.py +145 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/webmisc.py +1006 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/x10.py +66 -0
LTA_openwebtext_dualt/logs/lta_lm1b_nosep_step1000_pos0_probe.log
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
2026-05-25_15:24:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 2 |
+
2026-05-25_15:25:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 3 |
+
2026-05-25_15:25:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 4 |
+
2026-05-25_15:26:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 5 |
+
2026-05-25_15:26:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 6 |
+
2026-05-25_15:27:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 7 |
+
2026-05-25_15:27:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 8 |
+
2026-05-25_15:28:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 9 |
+
2026-05-25_15:28:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 10 |
+
2026-05-25_15:29:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 11 |
+
2026-05-25_15:29:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 12 |
+
2026-05-25_15:30:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 13 |
+
2026-05-25_15:30:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 14 |
+
2026-05-25_15:31:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 15 |
+
2026-05-25_15:31:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 16 |
+
2026-05-25_15:32:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 17 |
+
2026-05-25_15:32:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 18 |
+
2026-05-25_15:33:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 19 |
+
2026-05-25_15:33:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 20 |
+
2026-05-25_15:34:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 21 |
+
2026-05-25_15:34:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 22 |
+
2026-05-25_15:35:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 23 |
+
2026-05-25_15:35:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 24 |
+
2026-05-25_15:36:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 25 |
+
2026-05-25_15:36:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 26 |
+
2026-05-25_15:37:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 27 |
+
2026-05-25_15:37:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 28 |
+
2026-05-25_15:38:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 29 |
+
2026-05-25_15:38:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 30 |
+
2026-05-25_15:39:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 31 |
+
2026-05-25_15:39:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 32 |
+
2026-05-25_15:40:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 33 |
+
2026-05-25_15:40:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 34 |
+
2026-05-25_15:41:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 35 |
+
2026-05-25_15:41:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 36 |
+
2026-05-25_15:42:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 37 |
+
2026-05-25_15:42:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 38 |
+
2026-05-25_15:43:20 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
| 39 |
+
2026-05-25_15:43:50 waiting runs/lta_lm1b_dirichlet_len1024_Cv_to_2v_nosep_gbs512_b32_4gpu_20k_save1k_gumbelwatch_20260525/step_0001000.pt
|
LTA_openwebtext_dualt/logs/lta_owt_bert_absrope_time4_dirichlet_len1024_C1_to_1024_mask1_sameT_gbs512_b32_8gpu_1m_save10k_20260526.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
LTA_openwebtext_dualt/logs/lta_owt_c1024_gpt2_cached_exact100_repeat1024_4gpu_200step_small384x6_batchvalidwrong.log
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
W0512 20:08:32.846000 241078 torch/distributed/run.py:792]
|
| 2 |
+
W0512 20:08:32.846000 241078 torch/distributed/run.py:792] *****************************************
|
| 3 |
+
W0512 20:08:32.846000 241078 torch/distributed/run.py:792] 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 |
+
W0512 20:08:32.846000 241078 torch/distributed/run.py:792] *****************************************
|
| 5 |
+
[rank0]:[W512 20:08:34.635036290 ProcessGroupNCCL.cpp:4571] [PG ID 0 PG GUID 0 Rank 0] using GPU 0 to perform barrier as devices used by this process are currently unknown. This can potentially cause a hang if this rank to GPU mapping is incorrect. Specify device_ids in barrier() to force use of a particular device, or call init_process_group() with a device_id.
|
| 6 |
+
[rank3]:[W512 20:08:34.675343368 ProcessGroupNCCL.cpp:4571] [PG ID 0 PG GUID 0 Rank 3] using GPU 3 to perform barrier as devices used by this process are currently unknown. This can potentially cause a hang if this rank to GPU mapping is incorrect. Specify device_ids in barrier() to force use of a particular device, or call init_process_group() with a device_id.
|
| 7 |
+
[rank1]:[W512 20:08:34.704311615 ProcessGroupNCCL.cpp:4571] [PG ID 0 PG GUID 0 Rank 1] using GPU 1 to perform barrier as devices used by this process are currently unknown. This can potentially cause a hang if this rank to GPU mapping is incorrect. Specify device_ids in barrier() to force use of a particular device, or call init_process_group() with a device_id.
|
| 8 |
+
[rank2]:[W512 20:08:34.712623507 ProcessGroupNCCL.cpp:4571] [PG ID 0 PG GUID 0 Rank 2] using GPU 2 to perform barrier as devices used by this process are currently unknown. This can potentially cause a hang if this rank to GPU mapping is incorrect. Specify device_ids in barrier() to force use of a particular device, or call init_process_group() with a device_id.
|
| 9 |
+
{
|
| 10 |
+
"device": "cuda:0",
|
| 11 |
+
"rank": 0,
|
| 12 |
+
"world_size": 4,
|
| 13 |
+
"samples": "owt_cached_chunks:100",
|
| 14 |
+
"vocab_size": 50257,
|
| 15 |
+
"save_dir": "runs/lta_owt_c1024_gpt2_cached_exact100_repeat1024_4gpu_200step_small384x6_batchvalidwrong",
|
| 16 |
+
"batch_size": 16,
|
| 17 |
+
"grad_accum": 8,
|
| 18 |
+
"effective_batch_size": 512,
|
| 19 |
+
"global_batch_size": 512,
|
| 20 |
+
"lr_schedule": "constant_warmup",
|
| 21 |
+
"warmup_steps": 20,
|
| 22 |
+
"adam_beta1": 0.9,
|
| 23 |
+
"adam_beta2": 0.999,
|
| 24 |
+
"adam_eps": 1e-08,
|
| 25 |
+
"model_type": "ddit",
|
| 26 |
+
"dual_t": true,
|
| 27 |
+
"corrupt_t_mode": "independent",
|
| 28 |
+
"corrupt_min_t": null,
|
| 29 |
+
"corrupt_max_t": null,
|
| 30 |
+
"dirichlet_endpoint_mode": "categorical_dual_t",
|
| 31 |
+
"dirichlet_semantic_t_mode": "same",
|
| 32 |
+
"dirichlet_semantic_t_value": 0.0,
|
| 33 |
+
"categorical_wrong_from_full_vocab": false,
|
| 34 |
+
"categorical_wrong_from_batch_valid_tokens": true,
|
| 35 |
+
"simplex_bridge_sampler": "dirichlet",
|
| 36 |
+
"logistic_normal_sigma_min": 0.18,
|
| 37 |
+
"logistic_normal_sigma_max": 2.2,
|
| 38 |
+
"logistic_normal_tau_min": 0.65,
|
| 39 |
+
"logistic_normal_tau_max": 1.15,
|
| 40 |
+
"torch_compile": false,
|
| 41 |
+
"compile_mode": "max-autotune",
|
| 42 |
+
"state_format": "prob",
|
| 43 |
+
"target_loss": "hard_ce",
|
| 44 |
+
"meanflow_weight": 0.0,
|
| 45 |
+
"bridge_noise_init": "logistic_normal",
|
| 46 |
+
"noise_sigma": -1.0,
|
| 47 |
+
"wrap": true,
|
| 48 |
+
"wrap_mode": "stream",
|
| 49 |
+
"wrap_record_buffer_size": 200,
|
| 50 |
+
"owt_cached_chunks": true,
|
| 51 |
+
"owt_chunk_cache_dir": "/e2e-data/evad-tech-vla/wanghan58/data/small_benchmarks/langflow_2604_11748/openwebtext_lta_cached_chunks/gpt2_len1024_train_minus_100k_exact100",
|
| 52 |
+
"owt_chunk_cache_rebuild": false,
|
| 53 |
+
"owt_chunk_cache_write_batch": 4096,
|
| 54 |
+
"owt_exact_repeat_per_chunk": 1024,
|
| 55 |
+
"online_chunk_shuffle": false,
|
| 56 |
+
"online_chunk_shuffle_buffer": 10000,
|
| 57 |
+
"openwebtext_split": "train_minus_100k",
|
| 58 |
+
"detokenizer": "auto",
|
| 59 |
+
"resolved_detokenizer": null,
|
| 60 |
+
"num_workers": 0,
|
| 61 |
+
"latest_every": 50,
|
| 62 |
+
"resume_path": ""
|
| 63 |
+
}
|
| 64 |
+
step=10 micro_steps=80 elapsed=17.9s lr=1.650000e-04 loss_all=10.7520 acc_all=0.6379 loss_corrupt=10.7665 acc_corrupt=0.4317 corrupt_frac=0.5586 loss=10.7665 loss_recon=10.7665 loss_meanflow=0.0000 mean_model_t=0.4965 mean_corrupt_t=0.5027 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4951 init_acc_corrupt=0.4700 init_gold_top10=0.4988 init_gold_top100=0.5290
|
| 65 |
+
step=20 micro_steps=160 elapsed=17.4s lr=3.000000e-04 loss_all=10.0640 acc_all=0.2622 loss_corrupt=10.0881 acc_corrupt=0.1638 corrupt_frac=0.5436 loss=10.0881 loss_recon=10.0881 loss_meanflow=0.0000 mean_model_t=0.5053 mean_corrupt_t=0.5007 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4917 init_acc_corrupt=0.4748 init_gold_top10=0.5028 init_gold_top100=0.5310
|
| 66 |
+
step=30 micro_steps=240 elapsed=17.4s lr=3.000000e-04 loss_all=8.5907 acc_all=0.0667 loss_corrupt=8.6036 acc_corrupt=0.0557 corrupt_frac=0.5511 loss=8.6036 loss_recon=8.6036 loss_meanflow=0.0000 mean_model_t=0.5046 mean_corrupt_t=0.4955 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4990 init_acc_corrupt=0.4640 init_gold_top10=0.4952 init_gold_top100=0.5250
|
| 67 |
+
step=40 micro_steps=320 elapsed=17.4s lr=3.000000e-04 loss_all=7.4232 acc_all=0.0992 loss_corrupt=7.4581 acc_corrupt=0.0758 corrupt_frac=0.5403 loss=7.4581 loss_recon=7.4581 loss_meanflow=0.0000 mean_model_t=0.5071 mean_corrupt_t=0.5044 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4962 init_acc_corrupt=0.4710 init_gold_top10=0.4983 init_gold_top100=0.5262
|
| 68 |
+
step=50 micro_steps=400 elapsed=17.4s lr=3.000000e-04 loss_all=6.7747 acc_all=0.1536 loss_corrupt=6.9464 acc_corrupt=0.1138 corrupt_frac=0.5425 loss=6.9464 loss_recon=6.9464 loss_meanflow=0.0000 mean_model_t=0.5009 mean_corrupt_t=0.5094 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4919 init_acc_corrupt=0.4734 init_gold_top10=0.5024 init_gold_top100=0.5309
|
| 69 |
+
step=60 micro_steps=480 elapsed=18.1s lr=3.000000e-04 loss_all=5.8968 acc_all=0.2070 loss_corrupt=6.4232 acc_corrupt=0.1466 corrupt_frac=0.5551 loss=6.4232 loss_recon=6.4232 loss_meanflow=0.0000 mean_model_t=0.4866 mean_corrupt_t=0.4882 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.5221 init_acc_corrupt=0.4399 init_gold_top10=0.4717 init_gold_top100=0.5046
|
| 70 |
+
step=70 micro_steps=560 elapsed=17.4s lr=3.000000e-04 loss_all=4.1907 acc_all=0.4661 loss_corrupt=5.3401 acc_corrupt=0.3180 corrupt_frac=0.5530 loss=5.3401 loss_recon=5.3401 loss_meanflow=0.0000 mean_model_t=0.5096 mean_corrupt_t=0.5101 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4880 init_acc_corrupt=0.4800 init_gold_top10=0.5069 init_gold_top100=0.5339
|
| 71 |
+
step=80 micro_steps=640 elapsed=17.4s lr=3.000000e-04 loss_all=2.9934 acc_all=0.6596 loss_corrupt=4.7849 acc_corrupt=0.4321 corrupt_frac=0.5458 loss=4.7849 loss_recon=4.7849 loss_meanflow=0.0000 mean_model_t=0.5029 mean_corrupt_t=0.4971 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.5064 init_acc_corrupt=0.4564 init_gold_top10=0.4874 init_gold_top100=0.5181
|
| 72 |
+
step=90 micro_steps=720 elapsed=17.4s lr=3.000000e-04 loss_all=2.6839 acc_all=0.6965 loss_corrupt=4.4455 acc_corrupt=0.4660 corrupt_frac=0.5379 loss=4.4455 loss_recon=4.4455 loss_meanflow=0.0000 mean_model_t=0.4860 mean_corrupt_t=0.5105 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4883 init_acc_corrupt=0.4772 init_gold_top10=0.5057 init_gold_top100=0.5341
|
| 73 |
+
step=100 micro_steps=800 elapsed=17.4s lr=3.000000e-04 loss_all=2.6332 acc_all=0.7055 loss_corrupt=4.4267 acc_corrupt=0.4659 corrupt_frac=0.5472 loss=4.4267 loss_recon=4.4267 loss_meanflow=0.0000 mean_model_t=0.5105 mean_corrupt_t=0.4932 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.5055 init_acc_corrupt=0.4587 init_gold_top10=0.4886 init_gold_top100=0.5190
|
| 74 |
+
step=110 micro_steps=880 elapsed=18.7s lr=3.000000e-04 loss_all=2.5071 acc_all=0.7149 loss_corrupt=4.2114 acc_corrupt=0.4882 corrupt_frac=0.5545 loss=4.2114 loss_recon=4.2114 loss_meanflow=0.0000 mean_model_t=0.5036 mean_corrupt_t=0.5111 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4856 init_acc_corrupt=0.4813 init_gold_top10=0.5091 init_gold_top100=0.5364
|
| 75 |
+
step=120 micro_steps=960 elapsed=17.4s lr=3.000000e-04 loss_all=2.4989 acc_all=0.7103 loss_corrupt=4.2859 acc_corrupt=0.4678 corrupt_frac=0.5444 loss=4.2859 loss_recon=4.2859 loss_meanflow=0.0000 mean_model_t=0.5067 mean_corrupt_t=0.4960 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.5054 init_acc_corrupt=0.4600 init_gold_top10=0.4886 init_gold_top100=0.5183
|
| 76 |
+
step=130 micro_steps=1040 elapsed=17.4s lr=3.000000e-04 loss_all=2.3946 acc_all=0.7167 loss_corrupt=4.1501 acc_corrupt=0.4788 corrupt_frac=0.5411 loss=4.1501 loss_recon=4.1501 loss_meanflow=0.0000 mean_model_t=0.5008 mean_corrupt_t=0.5035 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4966 init_acc_corrupt=0.4691 init_gold_top10=0.4977 init_gold_top100=0.5270
|
| 77 |
+
step=140 micro_steps=1120 elapsed=17.4s lr=3.000000e-04 loss_all=2.4375 acc_all=0.7048 loss_corrupt=4.1514 acc_corrupt=0.4716 corrupt_frac=0.5580 loss=4.1514 loss_recon=4.1514 loss_meanflow=0.0000 mean_model_t=0.4983 mean_corrupt_t=0.4959 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.5046 init_acc_corrupt=0.4610 init_gold_top10=0.4895 init_gold_top100=0.5205
|
| 78 |
+
step=150 micro_steps=1200 elapsed=17.4s lr=3.000000e-04 loss_all=2.2902 acc_all=0.7165 loss_corrupt=3.9504 acc_corrupt=0.4876 corrupt_frac=0.5521 loss=3.9504 loss_recon=3.9504 loss_meanflow=0.0000 mean_model_t=0.5027 mean_corrupt_t=0.5028 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4911 init_acc_corrupt=0.4772 init_gold_top10=0.5034 init_gold_top100=0.5311
|
| 79 |
+
step=160 micro_steps=1280 elapsed=18.0s lr=3.000000e-04 loss_all=2.2115 acc_all=0.7206 loss_corrupt=3.9186 acc_corrupt=0.4821 corrupt_frac=0.5398 loss=3.9186 loss_recon=3.9186 loss_meanflow=0.0000 mean_model_t=0.5008 mean_corrupt_t=0.5052 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4946 init_acc_corrupt=0.4708 init_gold_top10=0.4994 init_gold_top100=0.5294
|
| 80 |
+
step=170 micro_steps=1360 elapsed=17.4s lr=3.000000e-04 loss_all=2.2306 acc_all=0.7119 loss_corrupt=3.8726 acc_corrupt=0.4791 corrupt_frac=0.5507 loss=3.8726 loss_recon=3.8726 loss_meanflow=0.0000 mean_model_t=0.5059 mean_corrupt_t=0.5007 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4967 init_acc_corrupt=0.4668 init_gold_top10=0.4975 init_gold_top100=0.5268
|
| 81 |
+
step=180 micro_steps=1440 elapsed=17.4s lr=3.000000e-04 loss_all=2.2149 acc_all=0.7080 loss_corrupt=3.8057 acc_corrupt=0.4794 corrupt_frac=0.5600 loss=3.8057 loss_recon=3.8057 loss_meanflow=0.0000 mean_model_t=0.5141 mean_corrupt_t=0.5011 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4974 init_acc_corrupt=0.4651 init_gold_top10=0.4964 init_gold_top100=0.5273
|
| 82 |
+
step=190 micro_steps=1520 elapsed=17.4s lr=3.000000e-04 loss_all=2.2150 acc_all=0.7051 loss_corrupt=3.8357 acc_corrupt=0.4713 corrupt_frac=0.5590 loss=3.8357 loss_recon=3.8357 loss_meanflow=0.0000 mean_model_t=0.4854 mean_corrupt_t=0.4936 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.5086 init_acc_corrupt=0.4567 init_gold_top10=0.4856 init_gold_top100=0.5141
|
| 83 |
+
step=200 micro_steps=1600 elapsed=17.4s lr=3.000000e-04 loss_all=2.0763 acc_all=0.7206 loss_corrupt=3.7013 acc_corrupt=0.4838 corrupt_frac=0.5418 loss=3.7013 loss_recon=3.7013 loss_meanflow=0.0000 mean_model_t=0.4878 mean_corrupt_t=0.5033 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 wrong_frac=0.4982 init_acc_corrupt=0.4673 init_gold_top10=0.4961 init_gold_top100=0.5249
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/_sourcemod_builtins.py
ADDED
|
@@ -0,0 +1,1151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers._sourcemod_builtins
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
This file contains the names of SourceMod functions.
|
| 6 |
+
|
| 7 |
+
Do not edit the FUNCTIONS list by hand.
|
| 8 |
+
|
| 9 |
+
Run with `python -I` to regenerate.
|
| 10 |
+
|
| 11 |
+
:copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
|
| 12 |
+
:license: BSD, see LICENSE for details.
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
FUNCTIONS = (
|
| 16 |
+
'OnEntityCreated',
|
| 17 |
+
'OnEntityDestroyed',
|
| 18 |
+
'OnGetGameDescription',
|
| 19 |
+
'OnLevelInit',
|
| 20 |
+
'SDKHook',
|
| 21 |
+
'SDKHookEx',
|
| 22 |
+
'SDKUnhook',
|
| 23 |
+
'SDKHooks_TakeDamage',
|
| 24 |
+
'SDKHooks_DropWeapon',
|
| 25 |
+
'TopMenuHandler',
|
| 26 |
+
'CreateTopMenu',
|
| 27 |
+
'LoadTopMenuConfig',
|
| 28 |
+
'AddToTopMenu',
|
| 29 |
+
'GetTopMenuInfoString',
|
| 30 |
+
'GetTopMenuObjName',
|
| 31 |
+
'RemoveFromTopMenu',
|
| 32 |
+
'DisplayTopMenu',
|
| 33 |
+
'DisplayTopMenuCategory',
|
| 34 |
+
'FindTopMenuCategory',
|
| 35 |
+
'SetTopMenuTitleCaching',
|
| 36 |
+
'OnAdminMenuCreated',
|
| 37 |
+
'OnAdminMenuReady',
|
| 38 |
+
'GetAdminTopMenu',
|
| 39 |
+
'AddTargetsToMenu',
|
| 40 |
+
'AddTargetsToMenu2',
|
| 41 |
+
'RedisplayAdminMenu',
|
| 42 |
+
'TEHook',
|
| 43 |
+
'AddTempEntHook',
|
| 44 |
+
'RemoveTempEntHook',
|
| 45 |
+
'TE_Start',
|
| 46 |
+
'TE_IsValidProp',
|
| 47 |
+
'TE_WriteNum',
|
| 48 |
+
'TE_ReadNum',
|
| 49 |
+
'TE_WriteFloat',
|
| 50 |
+
'TE_ReadFloat',
|
| 51 |
+
'TE_WriteVector',
|
| 52 |
+
'TE_ReadVector',
|
| 53 |
+
'TE_WriteAngles',
|
| 54 |
+
'TE_WriteFloatArray',
|
| 55 |
+
'TE_Send',
|
| 56 |
+
'TE_WriteEncodedEnt',
|
| 57 |
+
'TE_SendToAll',
|
| 58 |
+
'TE_SendToClient',
|
| 59 |
+
'CreateKeyValues',
|
| 60 |
+
'KvSetString',
|
| 61 |
+
'KvSetNum',
|
| 62 |
+
'KvSetUInt64',
|
| 63 |
+
'KvSetFloat',
|
| 64 |
+
'KvSetColor',
|
| 65 |
+
'KvSetVector',
|
| 66 |
+
'KvGetString',
|
| 67 |
+
'KvGetNum',
|
| 68 |
+
'KvGetFloat',
|
| 69 |
+
'KvGetColor',
|
| 70 |
+
'KvGetUInt64',
|
| 71 |
+
'KvGetVector',
|
| 72 |
+
'KvJumpToKey',
|
| 73 |
+
'KvJumpToKeySymbol',
|
| 74 |
+
'KvGotoFirstSubKey',
|
| 75 |
+
'KvGotoNextKey',
|
| 76 |
+
'KvSavePosition',
|
| 77 |
+
'KvDeleteKey',
|
| 78 |
+
'KvDeleteThis',
|
| 79 |
+
'KvGoBack',
|
| 80 |
+
'KvRewind',
|
| 81 |
+
'KvGetSectionName',
|
| 82 |
+
'KvSetSectionName',
|
| 83 |
+
'KvGetDataType',
|
| 84 |
+
'KeyValuesToFile',
|
| 85 |
+
'FileToKeyValues',
|
| 86 |
+
'StringToKeyValues',
|
| 87 |
+
'KvSetEscapeSequences',
|
| 88 |
+
'KvNodesInStack',
|
| 89 |
+
'KvCopySubkeys',
|
| 90 |
+
'KvFindKeyById',
|
| 91 |
+
'KvGetNameSymbol',
|
| 92 |
+
'KvGetSectionSymbol',
|
| 93 |
+
'TE_SetupSparks',
|
| 94 |
+
'TE_SetupSmoke',
|
| 95 |
+
'TE_SetupDust',
|
| 96 |
+
'TE_SetupMuzzleFlash',
|
| 97 |
+
'TE_SetupMetalSparks',
|
| 98 |
+
'TE_SetupEnergySplash',
|
| 99 |
+
'TE_SetupArmorRicochet',
|
| 100 |
+
'TE_SetupGlowSprite',
|
| 101 |
+
'TE_SetupExplosion',
|
| 102 |
+
'TE_SetupBloodSprite',
|
| 103 |
+
'TE_SetupBeamRingPoint',
|
| 104 |
+
'TE_SetupBeamPoints',
|
| 105 |
+
'TE_SetupBeamLaser',
|
| 106 |
+
'TE_SetupBeamRing',
|
| 107 |
+
'TE_SetupBeamFollow',
|
| 108 |
+
'HookEvent',
|
| 109 |
+
'HookEventEx',
|
| 110 |
+
'UnhookEvent',
|
| 111 |
+
'CreateEvent',
|
| 112 |
+
'FireEvent',
|
| 113 |
+
'CancelCreatedEvent',
|
| 114 |
+
'GetEventBool',
|
| 115 |
+
'SetEventBool',
|
| 116 |
+
'GetEventInt',
|
| 117 |
+
'SetEventInt',
|
| 118 |
+
'GetEventFloat',
|
| 119 |
+
'SetEventFloat',
|
| 120 |
+
'GetEventString',
|
| 121 |
+
'SetEventString',
|
| 122 |
+
'GetEventName',
|
| 123 |
+
'SetEventBroadcast',
|
| 124 |
+
'GetUserMessageType',
|
| 125 |
+
'GetUserMessageId',
|
| 126 |
+
'GetUserMessageName',
|
| 127 |
+
'StartMessage',
|
| 128 |
+
'StartMessageEx',
|
| 129 |
+
'EndMessage',
|
| 130 |
+
'MsgHook',
|
| 131 |
+
'MsgPostHook',
|
| 132 |
+
'HookUserMessage',
|
| 133 |
+
'UnhookUserMessage',
|
| 134 |
+
'StartMessageAll',
|
| 135 |
+
'StartMessageOne',
|
| 136 |
+
'InactivateClient',
|
| 137 |
+
'ReconnectClient',
|
| 138 |
+
'GetMaxEntities',
|
| 139 |
+
'GetEntityCount',
|
| 140 |
+
'IsValidEntity',
|
| 141 |
+
'IsValidEdict',
|
| 142 |
+
'IsEntNetworkable',
|
| 143 |
+
'CreateEdict',
|
| 144 |
+
'RemoveEdict',
|
| 145 |
+
'GetEdictFlags',
|
| 146 |
+
'SetEdictFlags',
|
| 147 |
+
'GetEdictClassname',
|
| 148 |
+
'GetEntityNetClass',
|
| 149 |
+
'ChangeEdictState',
|
| 150 |
+
'GetEntData',
|
| 151 |
+
'SetEntData',
|
| 152 |
+
'GetEntDataFloat',
|
| 153 |
+
'SetEntDataFloat',
|
| 154 |
+
'GetEntDataEnt2',
|
| 155 |
+
'SetEntDataEnt2',
|
| 156 |
+
'GetEntDataVector',
|
| 157 |
+
'SetEntDataVector',
|
| 158 |
+
'GetEntDataString',
|
| 159 |
+
'SetEntDataString',
|
| 160 |
+
'FindSendPropOffs',
|
| 161 |
+
'FindSendPropInfo',
|
| 162 |
+
'FindDataMapOffs',
|
| 163 |
+
'FindDataMapInfo',
|
| 164 |
+
'GetEntSendPropOffs',
|
| 165 |
+
'GetEntProp',
|
| 166 |
+
'SetEntProp',
|
| 167 |
+
'GetEntPropFloat',
|
| 168 |
+
'SetEntPropFloat',
|
| 169 |
+
'GetEntPropEnt',
|
| 170 |
+
'SetEntPropEnt',
|
| 171 |
+
'GetEntPropVector',
|
| 172 |
+
'SetEntPropVector',
|
| 173 |
+
'GetEntPropString',
|
| 174 |
+
'SetEntPropString',
|
| 175 |
+
'GetEntPropArraySize',
|
| 176 |
+
'GetEntDataArray',
|
| 177 |
+
'SetEntDataArray',
|
| 178 |
+
'GetEntityAddress',
|
| 179 |
+
'GetEntityClassname',
|
| 180 |
+
'float',
|
| 181 |
+
'FloatMul',
|
| 182 |
+
'FloatDiv',
|
| 183 |
+
'FloatAdd',
|
| 184 |
+
'FloatSub',
|
| 185 |
+
'FloatFraction',
|
| 186 |
+
'RoundToZero',
|
| 187 |
+
'RoundToCeil',
|
| 188 |
+
'RoundToFloor',
|
| 189 |
+
'RoundToNearest',
|
| 190 |
+
'FloatCompare',
|
| 191 |
+
'SquareRoot',
|
| 192 |
+
'Pow',
|
| 193 |
+
'Exponential',
|
| 194 |
+
'Logarithm',
|
| 195 |
+
'Sine',
|
| 196 |
+
'Cosine',
|
| 197 |
+
'Tangent',
|
| 198 |
+
'FloatAbs',
|
| 199 |
+
'ArcTangent',
|
| 200 |
+
'ArcCosine',
|
| 201 |
+
'ArcSine',
|
| 202 |
+
'ArcTangent2',
|
| 203 |
+
'RoundFloat',
|
| 204 |
+
'operator%',
|
| 205 |
+
'DegToRad',
|
| 206 |
+
'RadToDeg',
|
| 207 |
+
'GetURandomInt',
|
| 208 |
+
'GetURandomFloat',
|
| 209 |
+
'SetURandomSeed',
|
| 210 |
+
'SetURandomSeedSimple',
|
| 211 |
+
'RemovePlayerItem',
|
| 212 |
+
'GivePlayerItem',
|
| 213 |
+
'GetPlayerWeaponSlot',
|
| 214 |
+
'IgniteEntity',
|
| 215 |
+
'ExtinguishEntity',
|
| 216 |
+
'TeleportEntity',
|
| 217 |
+
'ForcePlayerSuicide',
|
| 218 |
+
'SlapPlayer',
|
| 219 |
+
'FindEntityByClassname',
|
| 220 |
+
'GetClientEyeAngles',
|
| 221 |
+
'CreateEntityByName',
|
| 222 |
+
'DispatchSpawn',
|
| 223 |
+
'DispatchKeyValue',
|
| 224 |
+
'DispatchKeyValueFloat',
|
| 225 |
+
'DispatchKeyValueVector',
|
| 226 |
+
'GetClientAimTarget',
|
| 227 |
+
'GetTeamCount',
|
| 228 |
+
'GetTeamName',
|
| 229 |
+
'GetTeamScore',
|
| 230 |
+
'SetTeamScore',
|
| 231 |
+
'GetTeamClientCount',
|
| 232 |
+
'SetEntityModel',
|
| 233 |
+
'GetPlayerDecalFile',
|
| 234 |
+
'GetPlayerJingleFile',
|
| 235 |
+
'GetServerNetStats',
|
| 236 |
+
'EquipPlayerWeapon',
|
| 237 |
+
'ActivateEntity',
|
| 238 |
+
'SetClientInfo',
|
| 239 |
+
'GivePlayerAmmo',
|
| 240 |
+
'SetClientListeningFlags',
|
| 241 |
+
'GetClientListeningFlags',
|
| 242 |
+
'SetListenOverride',
|
| 243 |
+
'GetListenOverride',
|
| 244 |
+
'IsClientMuted',
|
| 245 |
+
'TR_GetPointContents',
|
| 246 |
+
'TR_GetPointContentsEnt',
|
| 247 |
+
'TR_TraceRay',
|
| 248 |
+
'TR_TraceHull',
|
| 249 |
+
'TR_TraceRayFilter',
|
| 250 |
+
'TR_TraceHullFilter',
|
| 251 |
+
'TR_TraceRayEx',
|
| 252 |
+
'TR_TraceHullEx',
|
| 253 |
+
'TR_TraceRayFilterEx',
|
| 254 |
+
'TR_TraceHullFilterEx',
|
| 255 |
+
'TR_GetFraction',
|
| 256 |
+
'TR_GetEndPosition',
|
| 257 |
+
'TR_GetEntityIndex',
|
| 258 |
+
'TR_DidHit',
|
| 259 |
+
'TR_GetHitGroup',
|
| 260 |
+
'TR_GetPlaneNormal',
|
| 261 |
+
'TR_PointOutsideWorld',
|
| 262 |
+
'SortIntegers',
|
| 263 |
+
'SortFloats',
|
| 264 |
+
'SortStrings',
|
| 265 |
+
'SortFunc1D',
|
| 266 |
+
'SortCustom1D',
|
| 267 |
+
'SortCustom2D',
|
| 268 |
+
'SortADTArray',
|
| 269 |
+
'SortFuncADTArray',
|
| 270 |
+
'SortADTArrayCustom',
|
| 271 |
+
'CompileRegex',
|
| 272 |
+
'MatchRegex',
|
| 273 |
+
'GetRegexSubString',
|
| 274 |
+
'SimpleRegexMatch',
|
| 275 |
+
'TF2_GetPlayerClass',
|
| 276 |
+
'TF2_SetPlayerClass',
|
| 277 |
+
'TF2_RemoveWeaponSlot',
|
| 278 |
+
'TF2_RemoveAllWeapons',
|
| 279 |
+
'TF2_IsPlayerInCondition',
|
| 280 |
+
'TF2_GetObjectType',
|
| 281 |
+
'TF2_GetObjectMode',
|
| 282 |
+
'NominateMap',
|
| 283 |
+
'RemoveNominationByMap',
|
| 284 |
+
'RemoveNominationByOwner',
|
| 285 |
+
'GetExcludeMapList',
|
| 286 |
+
'GetNominatedMapList',
|
| 287 |
+
'CanMapChooserStartVote',
|
| 288 |
+
'InitiateMapChooserVote',
|
| 289 |
+
'HasEndOfMapVoteFinished',
|
| 290 |
+
'EndOfMapVoteEnabled',
|
| 291 |
+
'OnNominationRemoved',
|
| 292 |
+
'OnMapVoteStarted',
|
| 293 |
+
'CreateTimer',
|
| 294 |
+
'KillTimer',
|
| 295 |
+
'TriggerTimer',
|
| 296 |
+
'GetTickedTime',
|
| 297 |
+
'GetMapTimeLeft',
|
| 298 |
+
'GetMapTimeLimit',
|
| 299 |
+
'ExtendMapTimeLimit',
|
| 300 |
+
'GetTickInterval',
|
| 301 |
+
'OnMapTimeLeftChanged',
|
| 302 |
+
'IsServerProcessing',
|
| 303 |
+
'CreateDataTimer',
|
| 304 |
+
'ByteCountToCells',
|
| 305 |
+
'CreateArray',
|
| 306 |
+
'ClearArray',
|
| 307 |
+
'CloneArray',
|
| 308 |
+
'ResizeArray',
|
| 309 |
+
'GetArraySize',
|
| 310 |
+
'PushArrayCell',
|
| 311 |
+
'PushArrayString',
|
| 312 |
+
'PushArrayArray',
|
| 313 |
+
'GetArrayCell',
|
| 314 |
+
'GetArrayString',
|
| 315 |
+
'GetArrayArray',
|
| 316 |
+
'SetArrayCell',
|
| 317 |
+
'SetArrayString',
|
| 318 |
+
'SetArrayArray',
|
| 319 |
+
'ShiftArrayUp',
|
| 320 |
+
'RemoveFromArray',
|
| 321 |
+
'SwapArrayItems',
|
| 322 |
+
'FindStringInArray',
|
| 323 |
+
'FindValueInArray',
|
| 324 |
+
'ProcessTargetString',
|
| 325 |
+
'ReplyToTargetError',
|
| 326 |
+
'MultiTargetFilter',
|
| 327 |
+
'AddMultiTargetFilter',
|
| 328 |
+
'RemoveMultiTargetFilter',
|
| 329 |
+
'OnBanClient',
|
| 330 |
+
'OnBanIdentity',
|
| 331 |
+
'OnRemoveBan',
|
| 332 |
+
'BanClient',
|
| 333 |
+
'BanIdentity',
|
| 334 |
+
'RemoveBan',
|
| 335 |
+
'CreateTrie',
|
| 336 |
+
'SetTrieValue',
|
| 337 |
+
'SetTrieArray',
|
| 338 |
+
'SetTrieString',
|
| 339 |
+
'GetTrieValue',
|
| 340 |
+
'GetTrieArray',
|
| 341 |
+
'GetTrieString',
|
| 342 |
+
'RemoveFromTrie',
|
| 343 |
+
'ClearTrie',
|
| 344 |
+
'GetTrieSize',
|
| 345 |
+
'GetFunctionByName',
|
| 346 |
+
'CreateGlobalForward',
|
| 347 |
+
'CreateForward',
|
| 348 |
+
'GetForwardFunctionCount',
|
| 349 |
+
'AddToForward',
|
| 350 |
+
'RemoveFromForward',
|
| 351 |
+
'RemoveAllFromForward',
|
| 352 |
+
'Call_StartForward',
|
| 353 |
+
'Call_StartFunction',
|
| 354 |
+
'Call_PushCell',
|
| 355 |
+
'Call_PushCellRef',
|
| 356 |
+
'Call_PushFloat',
|
| 357 |
+
'Call_PushFloatRef',
|
| 358 |
+
'Call_PushArray',
|
| 359 |
+
'Call_PushArrayEx',
|
| 360 |
+
'Call_PushString',
|
| 361 |
+
'Call_PushStringEx',
|
| 362 |
+
'Call_Finish',
|
| 363 |
+
'Call_Cancel',
|
| 364 |
+
'NativeCall',
|
| 365 |
+
'CreateNative',
|
| 366 |
+
'ThrowNativeError',
|
| 367 |
+
'GetNativeStringLength',
|
| 368 |
+
'GetNativeString',
|
| 369 |
+
'SetNativeString',
|
| 370 |
+
'GetNativeCell',
|
| 371 |
+
'GetNativeCellRef',
|
| 372 |
+
'SetNativeCellRef',
|
| 373 |
+
'GetNativeArray',
|
| 374 |
+
'SetNativeArray',
|
| 375 |
+
'FormatNativeString',
|
| 376 |
+
'RequestFrameCallback',
|
| 377 |
+
'RequestFrame',
|
| 378 |
+
'OnRebuildAdminCache',
|
| 379 |
+
'DumpAdminCache',
|
| 380 |
+
'AddCommandOverride',
|
| 381 |
+
'GetCommandOverride',
|
| 382 |
+
'UnsetCommandOverride',
|
| 383 |
+
'CreateAdmGroup',
|
| 384 |
+
'FindAdmGroup',
|
| 385 |
+
'SetAdmGroupAddFlag',
|
| 386 |
+
'GetAdmGroupAddFlag',
|
| 387 |
+
'GetAdmGroupAddFlags',
|
| 388 |
+
'SetAdmGroupImmuneFrom',
|
| 389 |
+
'GetAdmGroupImmuneCount',
|
| 390 |
+
'GetAdmGroupImmuneFrom',
|
| 391 |
+
'AddAdmGroupCmdOverride',
|
| 392 |
+
'GetAdmGroupCmdOverride',
|
| 393 |
+
'RegisterAuthIdentType',
|
| 394 |
+
'CreateAdmin',
|
| 395 |
+
'GetAdminUsername',
|
| 396 |
+
'BindAdminIdentity',
|
| 397 |
+
'SetAdminFlag',
|
| 398 |
+
'GetAdminFlag',
|
| 399 |
+
'GetAdminFlags',
|
| 400 |
+
'AdminInheritGroup',
|
| 401 |
+
'GetAdminGroupCount',
|
| 402 |
+
'GetAdminGroup',
|
| 403 |
+
'SetAdminPassword',
|
| 404 |
+
'GetAdminPassword',
|
| 405 |
+
'FindAdminByIdentity',
|
| 406 |
+
'RemoveAdmin',
|
| 407 |
+
'FlagBitsToBitArray',
|
| 408 |
+
'FlagBitArrayToBits',
|
| 409 |
+
'FlagArrayToBits',
|
| 410 |
+
'FlagBitsToArray',
|
| 411 |
+
'FindFlagByName',
|
| 412 |
+
'FindFlagByChar',
|
| 413 |
+
'FindFlagChar',
|
| 414 |
+
'ReadFlagString',
|
| 415 |
+
'CanAdminTarget',
|
| 416 |
+
'CreateAuthMethod',
|
| 417 |
+
'SetAdmGroupImmunityLevel',
|
| 418 |
+
'GetAdmGroupImmunityLevel',
|
| 419 |
+
'SetAdminImmunityLevel',
|
| 420 |
+
'GetAdminImmunityLevel',
|
| 421 |
+
'FlagToBit',
|
| 422 |
+
'BitToFlag',
|
| 423 |
+
'ServerCommand',
|
| 424 |
+
'ServerCommandEx',
|
| 425 |
+
'InsertServerCommand',
|
| 426 |
+
'ServerExecute',
|
| 427 |
+
'ClientCommand',
|
| 428 |
+
'FakeClientCommand',
|
| 429 |
+
'FakeClientCommandEx',
|
| 430 |
+
'PrintToServer',
|
| 431 |
+
'PrintToConsole',
|
| 432 |
+
'ReplyToCommand',
|
| 433 |
+
'GetCmdReplySource',
|
| 434 |
+
'SetCmdReplySource',
|
| 435 |
+
'IsChatTrigger',
|
| 436 |
+
'ShowActivity2',
|
| 437 |
+
'ShowActivity',
|
| 438 |
+
'ShowActivityEx',
|
| 439 |
+
'FormatActivitySource',
|
| 440 |
+
'SrvCmd',
|
| 441 |
+
'RegServerCmd',
|
| 442 |
+
'ConCmd',
|
| 443 |
+
'RegConsoleCmd',
|
| 444 |
+
'RegAdminCmd',
|
| 445 |
+
'GetCmdArgs',
|
| 446 |
+
'GetCmdArg',
|
| 447 |
+
'GetCmdArgString',
|
| 448 |
+
'CreateConVar',
|
| 449 |
+
'FindConVar',
|
| 450 |
+
'ConVarChanged',
|
| 451 |
+
'HookConVarChange',
|
| 452 |
+
'UnhookConVarChange',
|
| 453 |
+
'GetConVarBool',
|
| 454 |
+
'SetConVarBool',
|
| 455 |
+
'GetConVarInt',
|
| 456 |
+
'SetConVarInt',
|
| 457 |
+
'GetConVarFloat',
|
| 458 |
+
'SetConVarFloat',
|
| 459 |
+
'GetConVarString',
|
| 460 |
+
'SetConVarString',
|
| 461 |
+
'ResetConVar',
|
| 462 |
+
'GetConVarDefault',
|
| 463 |
+
'GetConVarFlags',
|
| 464 |
+
'SetConVarFlags',
|
| 465 |
+
'GetConVarBounds',
|
| 466 |
+
'SetConVarBounds',
|
| 467 |
+
'GetConVarName',
|
| 468 |
+
'QueryClientConVar',
|
| 469 |
+
'GetCommandIterator',
|
| 470 |
+
'ReadCommandIterator',
|
| 471 |
+
'CheckCommandAccess',
|
| 472 |
+
'CheckAccess',
|
| 473 |
+
'IsValidConVarChar',
|
| 474 |
+
'GetCommandFlags',
|
| 475 |
+
'SetCommandFlags',
|
| 476 |
+
'FindFirstConCommand',
|
| 477 |
+
'FindNextConCommand',
|
| 478 |
+
'SendConVarValue',
|
| 479 |
+
'AddServerTag',
|
| 480 |
+
'RemoveServerTag',
|
| 481 |
+
'CommandListener',
|
| 482 |
+
'AddCommandListener',
|
| 483 |
+
'RemoveCommandListener',
|
| 484 |
+
'CommandExists',
|
| 485 |
+
'OnClientSayCommand',
|
| 486 |
+
'OnClientSayCommand_Post',
|
| 487 |
+
'TF2_IgnitePlayer',
|
| 488 |
+
'TF2_RespawnPlayer',
|
| 489 |
+
'TF2_RegeneratePlayer',
|
| 490 |
+
'TF2_AddCondition',
|
| 491 |
+
'TF2_RemoveCondition',
|
| 492 |
+
'TF2_SetPlayerPowerPlay',
|
| 493 |
+
'TF2_DisguisePlayer',
|
| 494 |
+
'TF2_RemovePlayerDisguise',
|
| 495 |
+
'TF2_StunPlayer',
|
| 496 |
+
'TF2_MakeBleed',
|
| 497 |
+
'TF2_GetClass',
|
| 498 |
+
'TF2_CalcIsAttackCritical',
|
| 499 |
+
'TF2_OnIsHolidayActive',
|
| 500 |
+
'TF2_IsHolidayActive',
|
| 501 |
+
'TF2_IsPlayerInDuel',
|
| 502 |
+
'TF2_RemoveWearable',
|
| 503 |
+
'TF2_OnConditionAdded',
|
| 504 |
+
'TF2_OnConditionRemoved',
|
| 505 |
+
'TF2_OnWaitingForPlayersStart',
|
| 506 |
+
'TF2_OnWaitingForPlayersEnd',
|
| 507 |
+
'TF2_OnPlayerTeleport',
|
| 508 |
+
'SQL_Connect',
|
| 509 |
+
'SQL_DefConnect',
|
| 510 |
+
'SQL_ConnectCustom',
|
| 511 |
+
'SQLite_UseDatabase',
|
| 512 |
+
'SQL_CheckConfig',
|
| 513 |
+
'SQL_GetDriver',
|
| 514 |
+
'SQL_ReadDriver',
|
| 515 |
+
'SQL_GetDriverIdent',
|
| 516 |
+
'SQL_GetDriverProduct',
|
| 517 |
+
'SQL_SetCharset',
|
| 518 |
+
'SQL_GetAffectedRows',
|
| 519 |
+
'SQL_GetInsertId',
|
| 520 |
+
'SQL_GetError',
|
| 521 |
+
'SQL_EscapeString',
|
| 522 |
+
'SQL_QuoteString',
|
| 523 |
+
'SQL_FastQuery',
|
| 524 |
+
'SQL_Query',
|
| 525 |
+
'SQL_PrepareQuery',
|
| 526 |
+
'SQL_FetchMoreResults',
|
| 527 |
+
'SQL_HasResultSet',
|
| 528 |
+
'SQL_GetRowCount',
|
| 529 |
+
'SQL_GetFieldCount',
|
| 530 |
+
'SQL_FieldNumToName',
|
| 531 |
+
'SQL_FieldNameToNum',
|
| 532 |
+
'SQL_FetchRow',
|
| 533 |
+
'SQL_MoreRows',
|
| 534 |
+
'SQL_Rewind',
|
| 535 |
+
'SQL_FetchString',
|
| 536 |
+
'SQL_FetchFloat',
|
| 537 |
+
'SQL_FetchInt',
|
| 538 |
+
'SQL_IsFieldNull',
|
| 539 |
+
'SQL_FetchSize',
|
| 540 |
+
'SQL_BindParamInt',
|
| 541 |
+
'SQL_BindParamFloat',
|
| 542 |
+
'SQL_BindParamString',
|
| 543 |
+
'SQL_Execute',
|
| 544 |
+
'SQL_LockDatabase',
|
| 545 |
+
'SQL_UnlockDatabase',
|
| 546 |
+
'SQLTCallback',
|
| 547 |
+
'SQL_IsSameConnection',
|
| 548 |
+
'SQL_TConnect',
|
| 549 |
+
'SQL_TQuery',
|
| 550 |
+
'SQL_CreateTransaction',
|
| 551 |
+
'SQL_AddQuery',
|
| 552 |
+
'SQLTxnSuccess',
|
| 553 |
+
'SQLTxnFailure',
|
| 554 |
+
'SQL_ExecuteTransaction',
|
| 555 |
+
'CloseHandle',
|
| 556 |
+
'CloneHandle',
|
| 557 |
+
'MenuHandler',
|
| 558 |
+
'CreateMenu',
|
| 559 |
+
'DisplayMenu',
|
| 560 |
+
'DisplayMenuAtItem',
|
| 561 |
+
'AddMenuItem',
|
| 562 |
+
'InsertMenuItem',
|
| 563 |
+
'RemoveMenuItem',
|
| 564 |
+
'RemoveAllMenuItems',
|
| 565 |
+
'GetMenuItem',
|
| 566 |
+
'GetMenuSelectionPosition',
|
| 567 |
+
'GetMenuItemCount',
|
| 568 |
+
'SetMenuPagination',
|
| 569 |
+
'GetMenuPagination',
|
| 570 |
+
'GetMenuStyle',
|
| 571 |
+
'SetMenuTitle',
|
| 572 |
+
'GetMenuTitle',
|
| 573 |
+
'CreatePanelFromMenu',
|
| 574 |
+
'GetMenuExitButton',
|
| 575 |
+
'SetMenuExitButton',
|
| 576 |
+
'GetMenuExitBackButton',
|
| 577 |
+
'SetMenuExitBackButton',
|
| 578 |
+
'SetMenuNoVoteButton',
|
| 579 |
+
'CancelMenu',
|
| 580 |
+
'GetMenuOptionFlags',
|
| 581 |
+
'SetMenuOptionFlags',
|
| 582 |
+
'IsVoteInProgress',
|
| 583 |
+
'CancelVote',
|
| 584 |
+
'VoteMenu',
|
| 585 |
+
'VoteMenuToAll',
|
| 586 |
+
'VoteHandler',
|
| 587 |
+
'SetVoteResultCallback',
|
| 588 |
+
'CheckVoteDelay',
|
| 589 |
+
'IsClientInVotePool',
|
| 590 |
+
'RedrawClientVoteMenu',
|
| 591 |
+
'GetMenuStyleHandle',
|
| 592 |
+
'CreatePanel',
|
| 593 |
+
'CreateMenuEx',
|
| 594 |
+
'GetClientMenu',
|
| 595 |
+
'CancelClientMenu',
|
| 596 |
+
'GetMaxPageItems',
|
| 597 |
+
'GetPanelStyle',
|
| 598 |
+
'SetPanelTitle',
|
| 599 |
+
'DrawPanelItem',
|
| 600 |
+
'DrawPanelText',
|
| 601 |
+
'CanPanelDrawFlags',
|
| 602 |
+
'SetPanelKeys',
|
| 603 |
+
'SendPanelToClient',
|
| 604 |
+
'GetPanelTextRemaining',
|
| 605 |
+
'GetPanelCurrentKey',
|
| 606 |
+
'SetPanelCurrentKey',
|
| 607 |
+
'RedrawMenuItem',
|
| 608 |
+
'InternalShowMenu',
|
| 609 |
+
'GetMenuVoteInfo',
|
| 610 |
+
'IsNewVoteAllowed',
|
| 611 |
+
'PrefetchSound',
|
| 612 |
+
'EmitAmbientSound',
|
| 613 |
+
'FadeClientVolume',
|
| 614 |
+
'StopSound',
|
| 615 |
+
'EmitSound',
|
| 616 |
+
'EmitSentence',
|
| 617 |
+
'GetDistGainFromSoundLevel',
|
| 618 |
+
'AmbientSHook',
|
| 619 |
+
'NormalSHook',
|
| 620 |
+
'AddAmbientSoundHook',
|
| 621 |
+
'AddNormalSoundHook',
|
| 622 |
+
'RemoveAmbientSoundHook',
|
| 623 |
+
'RemoveNormalSoundHook',
|
| 624 |
+
'EmitSoundToClient',
|
| 625 |
+
'EmitSoundToAll',
|
| 626 |
+
'ATTN_TO_SNDLEVEL',
|
| 627 |
+
'GetGameSoundParams',
|
| 628 |
+
'EmitGameSound',
|
| 629 |
+
'EmitAmbientGameSound',
|
| 630 |
+
'EmitGameSoundToClient',
|
| 631 |
+
'EmitGameSoundToAll',
|
| 632 |
+
'PrecacheScriptSound',
|
| 633 |
+
'strlen',
|
| 634 |
+
'StrContains',
|
| 635 |
+
'strcmp',
|
| 636 |
+
'strncmp',
|
| 637 |
+
'StrEqual',
|
| 638 |
+
'strcopy',
|
| 639 |
+
'Format',
|
| 640 |
+
'FormatEx',
|
| 641 |
+
'VFormat',
|
| 642 |
+
'StringToInt',
|
| 643 |
+
'StringToIntEx',
|
| 644 |
+
'IntToString',
|
| 645 |
+
'StringToFloat',
|
| 646 |
+
'StringToFloatEx',
|
| 647 |
+
'FloatToString',
|
| 648 |
+
'BreakString',
|
| 649 |
+
'TrimString',
|
| 650 |
+
'SplitString',
|
| 651 |
+
'ReplaceString',
|
| 652 |
+
'ReplaceStringEx',
|
| 653 |
+
'GetCharBytes',
|
| 654 |
+
'IsCharAlpha',
|
| 655 |
+
'IsCharNumeric',
|
| 656 |
+
'IsCharSpace',
|
| 657 |
+
'IsCharMB',
|
| 658 |
+
'IsCharUpper',
|
| 659 |
+
'IsCharLower',
|
| 660 |
+
'StripQuotes',
|
| 661 |
+
'CharToUpper',
|
| 662 |
+
'CharToLower',
|
| 663 |
+
'FindCharInString',
|
| 664 |
+
'StrCat',
|
| 665 |
+
'ExplodeString',
|
| 666 |
+
'ImplodeStrings',
|
| 667 |
+
'GetVectorLength',
|
| 668 |
+
'GetVectorDistance',
|
| 669 |
+
'GetVectorDotProduct',
|
| 670 |
+
'GetVectorCrossProduct',
|
| 671 |
+
'NormalizeVector',
|
| 672 |
+
'GetAngleVectors',
|
| 673 |
+
'GetVectorAngles',
|
| 674 |
+
'GetVectorVectors',
|
| 675 |
+
'AddVectors',
|
| 676 |
+
'SubtractVectors',
|
| 677 |
+
'ScaleVector',
|
| 678 |
+
'NegateVector',
|
| 679 |
+
'MakeVectorFromPoints',
|
| 680 |
+
'BaseComm_IsClientGagged',
|
| 681 |
+
'BaseComm_IsClientMuted',
|
| 682 |
+
'BaseComm_SetClientGag',
|
| 683 |
+
'BaseComm_SetClientMute',
|
| 684 |
+
'FormatUserLogText',
|
| 685 |
+
'FindPluginByFile',
|
| 686 |
+
'FindTarget',
|
| 687 |
+
'AcceptEntityInput',
|
| 688 |
+
'SetVariantBool',
|
| 689 |
+
'SetVariantString',
|
| 690 |
+
'SetVariantInt',
|
| 691 |
+
'SetVariantFloat',
|
| 692 |
+
'SetVariantVector3D',
|
| 693 |
+
'SetVariantPosVector3D',
|
| 694 |
+
'SetVariantColor',
|
| 695 |
+
'SetVariantEntity',
|
| 696 |
+
'GameRules_GetProp',
|
| 697 |
+
'GameRules_SetProp',
|
| 698 |
+
'GameRules_GetPropFloat',
|
| 699 |
+
'GameRules_SetPropFloat',
|
| 700 |
+
'GameRules_GetPropEnt',
|
| 701 |
+
'GameRules_SetPropEnt',
|
| 702 |
+
'GameRules_GetPropVector',
|
| 703 |
+
'GameRules_SetPropVector',
|
| 704 |
+
'GameRules_GetPropString',
|
| 705 |
+
'GameRules_SetPropString',
|
| 706 |
+
'GameRules_GetRoundState',
|
| 707 |
+
'OnClientConnect',
|
| 708 |
+
'OnClientConnected',
|
| 709 |
+
'OnClientPutInServer',
|
| 710 |
+
'OnClientDisconnect',
|
| 711 |
+
'OnClientDisconnect_Post',
|
| 712 |
+
'OnClientCommand',
|
| 713 |
+
'OnClientSettingsChanged',
|
| 714 |
+
'OnClientAuthorized',
|
| 715 |
+
'OnClientPreAdminCheck',
|
| 716 |
+
'OnClientPostAdminFilter',
|
| 717 |
+
'OnClientPostAdminCheck',
|
| 718 |
+
'GetMaxClients',
|
| 719 |
+
'GetMaxHumanPlayers',
|
| 720 |
+
'GetClientCount',
|
| 721 |
+
'GetClientName',
|
| 722 |
+
'GetClientIP',
|
| 723 |
+
'GetClientAuthString',
|
| 724 |
+
'GetClientAuthId',
|
| 725 |
+
'GetSteamAccountID',
|
| 726 |
+
'GetClientUserId',
|
| 727 |
+
'IsClientConnected',
|
| 728 |
+
'IsClientInGame',
|
| 729 |
+
'IsClientInKickQueue',
|
| 730 |
+
'IsClientAuthorized',
|
| 731 |
+
'IsFakeClient',
|
| 732 |
+
'IsClientSourceTV',
|
| 733 |
+
'IsClientReplay',
|
| 734 |
+
'IsClientObserver',
|
| 735 |
+
'IsPlayerAlive',
|
| 736 |
+
'GetClientInfo',
|
| 737 |
+
'GetClientTeam',
|
| 738 |
+
'SetUserAdmin',
|
| 739 |
+
'GetUserAdmin',
|
| 740 |
+
'AddUserFlags',
|
| 741 |
+
'RemoveUserFlags',
|
| 742 |
+
'SetUserFlagBits',
|
| 743 |
+
'GetUserFlagBits',
|
| 744 |
+
'CanUserTarget',
|
| 745 |
+
'RunAdminCacheChecks',
|
| 746 |
+
'NotifyPostAdminCheck',
|
| 747 |
+
'CreateFakeClient',
|
| 748 |
+
'SetFakeClientConVar',
|
| 749 |
+
'GetClientHealth',
|
| 750 |
+
'GetClientModel',
|
| 751 |
+
'GetClientWeapon',
|
| 752 |
+
'GetClientMaxs',
|
| 753 |
+
'GetClientMins',
|
| 754 |
+
'GetClientAbsAngles',
|
| 755 |
+
'GetClientAbsOrigin',
|
| 756 |
+
'GetClientArmor',
|
| 757 |
+
'GetClientDeaths',
|
| 758 |
+
'GetClientFrags',
|
| 759 |
+
'GetClientDataRate',
|
| 760 |
+
'IsClientTimingOut',
|
| 761 |
+
'GetClientTime',
|
| 762 |
+
'GetClientLatency',
|
| 763 |
+
'GetClientAvgLatency',
|
| 764 |
+
'GetClientAvgLoss',
|
| 765 |
+
'GetClientAvgChoke',
|
| 766 |
+
'GetClientAvgData',
|
| 767 |
+
'GetClientAvgPackets',
|
| 768 |
+
'GetClientOfUserId',
|
| 769 |
+
'KickClient',
|
| 770 |
+
'KickClientEx',
|
| 771 |
+
'ChangeClientTeam',
|
| 772 |
+
'GetClientSerial',
|
| 773 |
+
'GetClientFromSerial',
|
| 774 |
+
'FindStringTable',
|
| 775 |
+
'GetNumStringTables',
|
| 776 |
+
'GetStringTableNumStrings',
|
| 777 |
+
'GetStringTableMaxStrings',
|
| 778 |
+
'GetStringTableName',
|
| 779 |
+
'FindStringIndex',
|
| 780 |
+
'ReadStringTable',
|
| 781 |
+
'GetStringTableDataLength',
|
| 782 |
+
'GetStringTableData',
|
| 783 |
+
'SetStringTableData',
|
| 784 |
+
'AddToStringTable',
|
| 785 |
+
'LockStringTables',
|
| 786 |
+
'AddFileToDownloadsTable',
|
| 787 |
+
'GetEntityFlags',
|
| 788 |
+
'SetEntityFlags',
|
| 789 |
+
'GetEntityMoveType',
|
| 790 |
+
'SetEntityMoveType',
|
| 791 |
+
'GetEntityRenderMode',
|
| 792 |
+
'SetEntityRenderMode',
|
| 793 |
+
'GetEntityRenderFx',
|
| 794 |
+
'SetEntityRenderFx',
|
| 795 |
+
'SetEntityRenderColor',
|
| 796 |
+
'GetEntityGravity',
|
| 797 |
+
'SetEntityGravity',
|
| 798 |
+
'SetEntityHealth',
|
| 799 |
+
'GetClientButtons',
|
| 800 |
+
'EntityOutput',
|
| 801 |
+
'HookEntityOutput',
|
| 802 |
+
'UnhookEntityOutput',
|
| 803 |
+
'HookSingleEntityOutput',
|
| 804 |
+
'UnhookSingleEntityOutput',
|
| 805 |
+
'SMC_CreateParser',
|
| 806 |
+
'SMC_ParseFile',
|
| 807 |
+
'SMC_GetErrorString',
|
| 808 |
+
'SMC_ParseStart',
|
| 809 |
+
'SMC_SetParseStart',
|
| 810 |
+
'SMC_ParseEnd',
|
| 811 |
+
'SMC_SetParseEnd',
|
| 812 |
+
'SMC_NewSection',
|
| 813 |
+
'SMC_KeyValue',
|
| 814 |
+
'SMC_EndSection',
|
| 815 |
+
'SMC_SetReaders',
|
| 816 |
+
'SMC_RawLine',
|
| 817 |
+
'SMC_SetRawLine',
|
| 818 |
+
'BfWriteBool',
|
| 819 |
+
'BfWriteByte',
|
| 820 |
+
'BfWriteChar',
|
| 821 |
+
'BfWriteShort',
|
| 822 |
+
'BfWriteWord',
|
| 823 |
+
'BfWriteNum',
|
| 824 |
+
'BfWriteFloat',
|
| 825 |
+
'BfWriteString',
|
| 826 |
+
'BfWriteEntity',
|
| 827 |
+
'BfWriteAngle',
|
| 828 |
+
'BfWriteCoord',
|
| 829 |
+
'BfWriteVecCoord',
|
| 830 |
+
'BfWriteVecNormal',
|
| 831 |
+
'BfWriteAngles',
|
| 832 |
+
'BfReadBool',
|
| 833 |
+
'BfReadByte',
|
| 834 |
+
'BfReadChar',
|
| 835 |
+
'BfReadShort',
|
| 836 |
+
'BfReadWord',
|
| 837 |
+
'BfReadNum',
|
| 838 |
+
'BfReadFloat',
|
| 839 |
+
'BfReadString',
|
| 840 |
+
'BfReadEntity',
|
| 841 |
+
'BfReadAngle',
|
| 842 |
+
'BfReadCoord',
|
| 843 |
+
'BfReadVecCoord',
|
| 844 |
+
'BfReadVecNormal',
|
| 845 |
+
'BfReadAngles',
|
| 846 |
+
'BfGetNumBytesLeft',
|
| 847 |
+
'CreateProfiler',
|
| 848 |
+
'StartProfiling',
|
| 849 |
+
'StopProfiling',
|
| 850 |
+
'GetProfilerTime',
|
| 851 |
+
'OnPluginStart',
|
| 852 |
+
'AskPluginLoad2',
|
| 853 |
+
'OnPluginEnd',
|
| 854 |
+
'OnPluginPauseChange',
|
| 855 |
+
'OnGameFrame',
|
| 856 |
+
'OnMapStart',
|
| 857 |
+
'OnMapEnd',
|
| 858 |
+
'OnConfigsExecuted',
|
| 859 |
+
'OnAutoConfigsBuffered',
|
| 860 |
+
'OnAllPluginsLoaded',
|
| 861 |
+
'GetMyHandle',
|
| 862 |
+
'GetPluginIterator',
|
| 863 |
+
'MorePlugins',
|
| 864 |
+
'ReadPlugin',
|
| 865 |
+
'GetPluginStatus',
|
| 866 |
+
'GetPluginFilename',
|
| 867 |
+
'IsPluginDebugging',
|
| 868 |
+
'GetPluginInfo',
|
| 869 |
+
'FindPluginByNumber',
|
| 870 |
+
'SetFailState',
|
| 871 |
+
'ThrowError',
|
| 872 |
+
'GetTime',
|
| 873 |
+
'FormatTime',
|
| 874 |
+
'LoadGameConfigFile',
|
| 875 |
+
'GameConfGetOffset',
|
| 876 |
+
'GameConfGetKeyValue',
|
| 877 |
+
'GameConfGetAddress',
|
| 878 |
+
'GetSysTickCount',
|
| 879 |
+
'AutoExecConfig',
|
| 880 |
+
'RegPluginLibrary',
|
| 881 |
+
'LibraryExists',
|
| 882 |
+
'GetExtensionFileStatus',
|
| 883 |
+
'OnLibraryAdded',
|
| 884 |
+
'OnLibraryRemoved',
|
| 885 |
+
'ReadMapList',
|
| 886 |
+
'SetMapListCompatBind',
|
| 887 |
+
'OnClientFloodCheck',
|
| 888 |
+
'OnClientFloodResult',
|
| 889 |
+
'CanTestFeatures',
|
| 890 |
+
'GetFeatureStatus',
|
| 891 |
+
'RequireFeature',
|
| 892 |
+
'LoadFromAddress',
|
| 893 |
+
'StoreToAddress',
|
| 894 |
+
'CreateStack',
|
| 895 |
+
'PushStackCell',
|
| 896 |
+
'PushStackString',
|
| 897 |
+
'PushStackArray',
|
| 898 |
+
'PopStackCell',
|
| 899 |
+
'PopStackString',
|
| 900 |
+
'PopStackArray',
|
| 901 |
+
'IsStackEmpty',
|
| 902 |
+
'PopStack',
|
| 903 |
+
'OnPlayerRunCmd',
|
| 904 |
+
'BuildPath',
|
| 905 |
+
'OpenDirectory',
|
| 906 |
+
'ReadDirEntry',
|
| 907 |
+
'OpenFile',
|
| 908 |
+
'DeleteFile',
|
| 909 |
+
'ReadFileLine',
|
| 910 |
+
'ReadFile',
|
| 911 |
+
'ReadFileString',
|
| 912 |
+
'WriteFile',
|
| 913 |
+
'WriteFileString',
|
| 914 |
+
'WriteFileLine',
|
| 915 |
+
'ReadFileCell',
|
| 916 |
+
'WriteFileCell',
|
| 917 |
+
'IsEndOfFile',
|
| 918 |
+
'FileSeek',
|
| 919 |
+
'FilePosition',
|
| 920 |
+
'FileExists',
|
| 921 |
+
'RenameFile',
|
| 922 |
+
'DirExists',
|
| 923 |
+
'FileSize',
|
| 924 |
+
'FlushFile',
|
| 925 |
+
'RemoveDir',
|
| 926 |
+
'CreateDirectory',
|
| 927 |
+
'GetFileTime',
|
| 928 |
+
'LogToOpenFile',
|
| 929 |
+
'LogToOpenFileEx',
|
| 930 |
+
'PbReadInt',
|
| 931 |
+
'PbReadFloat',
|
| 932 |
+
'PbReadBool',
|
| 933 |
+
'PbReadString',
|
| 934 |
+
'PbReadColor',
|
| 935 |
+
'PbReadAngle',
|
| 936 |
+
'PbReadVector',
|
| 937 |
+
'PbReadVector2D',
|
| 938 |
+
'PbGetRepeatedFieldCount',
|
| 939 |
+
'PbSetInt',
|
| 940 |
+
'PbSetFloat',
|
| 941 |
+
'PbSetBool',
|
| 942 |
+
'PbSetString',
|
| 943 |
+
'PbSetColor',
|
| 944 |
+
'PbSetAngle',
|
| 945 |
+
'PbSetVector',
|
| 946 |
+
'PbSetVector2D',
|
| 947 |
+
'PbAddInt',
|
| 948 |
+
'PbAddFloat',
|
| 949 |
+
'PbAddBool',
|
| 950 |
+
'PbAddString',
|
| 951 |
+
'PbAddColor',
|
| 952 |
+
'PbAddAngle',
|
| 953 |
+
'PbAddVector',
|
| 954 |
+
'PbAddVector2D',
|
| 955 |
+
'PbRemoveRepeatedFieldValue',
|
| 956 |
+
'PbReadMessage',
|
| 957 |
+
'PbReadRepeatedMessage',
|
| 958 |
+
'PbAddMessage',
|
| 959 |
+
'SetNextMap',
|
| 960 |
+
'GetNextMap',
|
| 961 |
+
'ForceChangeLevel',
|
| 962 |
+
'GetMapHistorySize',
|
| 963 |
+
'GetMapHistory',
|
| 964 |
+
'GeoipCode2',
|
| 965 |
+
'GeoipCode3',
|
| 966 |
+
'GeoipCountry',
|
| 967 |
+
'MarkNativeAsOptional',
|
| 968 |
+
'RegClientCookie',
|
| 969 |
+
'FindClientCookie',
|
| 970 |
+
'SetClientCookie',
|
| 971 |
+
'GetClientCookie',
|
| 972 |
+
'SetAuthIdCookie',
|
| 973 |
+
'AreClientCookiesCached',
|
| 974 |
+
'OnClientCookiesCached',
|
| 975 |
+
'CookieMenuHandler',
|
| 976 |
+
'SetCookiePrefabMenu',
|
| 977 |
+
'SetCookieMenuItem',
|
| 978 |
+
'ShowCookieMenu',
|
| 979 |
+
'GetCookieIterator',
|
| 980 |
+
'ReadCookieIterator',
|
| 981 |
+
'GetCookieAccess',
|
| 982 |
+
'GetClientCookieTime',
|
| 983 |
+
'LoadTranslations',
|
| 984 |
+
'SetGlobalTransTarget',
|
| 985 |
+
'GetClientLanguage',
|
| 986 |
+
'GetServerLanguage',
|
| 987 |
+
'GetLanguageCount',
|
| 988 |
+
'GetLanguageInfo',
|
| 989 |
+
'SetClientLanguage',
|
| 990 |
+
'GetLanguageByCode',
|
| 991 |
+
'GetLanguageByName',
|
| 992 |
+
'CS_OnBuyCommand',
|
| 993 |
+
'CS_OnCSWeaponDrop',
|
| 994 |
+
'CS_OnGetWeaponPrice',
|
| 995 |
+
'CS_OnTerminateRound',
|
| 996 |
+
'CS_RespawnPlayer',
|
| 997 |
+
'CS_SwitchTeam',
|
| 998 |
+
'CS_DropWeapon',
|
| 999 |
+
'CS_TerminateRound',
|
| 1000 |
+
'CS_GetTranslatedWeaponAlias',
|
| 1001 |
+
'CS_GetWeaponPrice',
|
| 1002 |
+
'CS_GetClientClanTag',
|
| 1003 |
+
'CS_SetClientClanTag',
|
| 1004 |
+
'CS_GetTeamScore',
|
| 1005 |
+
'CS_SetTeamScore',
|
| 1006 |
+
'CS_GetMVPCount',
|
| 1007 |
+
'CS_SetMVPCount',
|
| 1008 |
+
'CS_GetClientContributionScore',
|
| 1009 |
+
'CS_SetClientContributionScore',
|
| 1010 |
+
'CS_GetClientAssists',
|
| 1011 |
+
'CS_SetClientAssists',
|
| 1012 |
+
'CS_AliasToWeaponID',
|
| 1013 |
+
'CS_WeaponIDToAlias',
|
| 1014 |
+
'CS_IsValidWeaponID',
|
| 1015 |
+
'CS_UpdateClientModel',
|
| 1016 |
+
'LogToGame',
|
| 1017 |
+
'SetRandomSeed',
|
| 1018 |
+
'GetRandomFloat',
|
| 1019 |
+
'GetRandomInt',
|
| 1020 |
+
'IsMapValid',
|
| 1021 |
+
'IsDedicatedServer',
|
| 1022 |
+
'GetEngineTime',
|
| 1023 |
+
'GetGameTime',
|
| 1024 |
+
'GetGameTickCount',
|
| 1025 |
+
'GetGameDescription',
|
| 1026 |
+
'GetGameFolderName',
|
| 1027 |
+
'GetCurrentMap',
|
| 1028 |
+
'PrecacheModel',
|
| 1029 |
+
'PrecacheSentenceFile',
|
| 1030 |
+
'PrecacheDecal',
|
| 1031 |
+
'PrecacheGeneric',
|
| 1032 |
+
'IsModelPrecached',
|
| 1033 |
+
'IsDecalPrecached',
|
| 1034 |
+
'IsGenericPrecached',
|
| 1035 |
+
'PrecacheSound',
|
| 1036 |
+
'IsSoundPrecached',
|
| 1037 |
+
'CreateDialog',
|
| 1038 |
+
'GetEngineVersion',
|
| 1039 |
+
'PrintToChat',
|
| 1040 |
+
'PrintToChatAll',
|
| 1041 |
+
'PrintCenterText',
|
| 1042 |
+
'PrintCenterTextAll',
|
| 1043 |
+
'PrintHintText',
|
| 1044 |
+
'PrintHintTextToAll',
|
| 1045 |
+
'ShowVGUIPanel',
|
| 1046 |
+
'CreateHudSynchronizer',
|
| 1047 |
+
'SetHudTextParams',
|
| 1048 |
+
'SetHudTextParamsEx',
|
| 1049 |
+
'ShowSyncHudText',
|
| 1050 |
+
'ClearSyncHud',
|
| 1051 |
+
'ShowHudText',
|
| 1052 |
+
'ShowMOTDPanel',
|
| 1053 |
+
'DisplayAskConnectBox',
|
| 1054 |
+
'EntIndexToEntRef',
|
| 1055 |
+
'EntRefToEntIndex',
|
| 1056 |
+
'MakeCompatEntRef',
|
| 1057 |
+
'SetClientViewEntity',
|
| 1058 |
+
'SetLightStyle',
|
| 1059 |
+
'GetClientEyePosition',
|
| 1060 |
+
'CreateDataPack',
|
| 1061 |
+
'WritePackCell',
|
| 1062 |
+
'WritePackFloat',
|
| 1063 |
+
'WritePackString',
|
| 1064 |
+
'ReadPackCell',
|
| 1065 |
+
'ReadPackFloat',
|
| 1066 |
+
'ReadPackString',
|
| 1067 |
+
'ResetPack',
|
| 1068 |
+
'GetPackPosition',
|
| 1069 |
+
'SetPackPosition',
|
| 1070 |
+
'IsPackReadable',
|
| 1071 |
+
'LogMessage',
|
| 1072 |
+
'LogToFile',
|
| 1073 |
+
'LogToFileEx',
|
| 1074 |
+
'LogAction',
|
| 1075 |
+
'LogError',
|
| 1076 |
+
'OnLogAction',
|
| 1077 |
+
'GameLogHook',
|
| 1078 |
+
'AddGameLogHook',
|
| 1079 |
+
'RemoveGameLogHook',
|
| 1080 |
+
'FindTeamByName',
|
| 1081 |
+
'StartPrepSDKCall',
|
| 1082 |
+
'PrepSDKCall_SetVirtual',
|
| 1083 |
+
'PrepSDKCall_SetSignature',
|
| 1084 |
+
'PrepSDKCall_SetAddress',
|
| 1085 |
+
'PrepSDKCall_SetFromConf',
|
| 1086 |
+
'PrepSDKCall_SetReturnInfo',
|
| 1087 |
+
'PrepSDKCall_AddParameter',
|
| 1088 |
+
'EndPrepSDKCall',
|
| 1089 |
+
'SDKCall',
|
| 1090 |
+
'GetPlayerResourceEntity',
|
| 1091 |
+
)
|
| 1092 |
+
|
| 1093 |
+
|
| 1094 |
+
if __name__ == '__main__': # pragma: no cover
|
| 1095 |
+
import re
|
| 1096 |
+
from urllib.request import FancyURLopener
|
| 1097 |
+
|
| 1098 |
+
from pygments.util import format_lines
|
| 1099 |
+
|
| 1100 |
+
class Opener(FancyURLopener):
|
| 1101 |
+
version = 'Mozilla/5.0 (Pygments Sourcemod Builtins Update)'
|
| 1102 |
+
|
| 1103 |
+
opener = Opener()
|
| 1104 |
+
|
| 1105 |
+
def get_version():
|
| 1106 |
+
f = opener.open('http://docs.sourcemod.net/api/index.php')
|
| 1107 |
+
r = re.compile(r'SourceMod v\.<b>([\d\.]+(?:-\w+)?)</td>')
|
| 1108 |
+
for line in f:
|
| 1109 |
+
m = r.search(line.decode())
|
| 1110 |
+
if m is not None:
|
| 1111 |
+
return m.groups()[0]
|
| 1112 |
+
raise ValueError('No version in api docs')
|
| 1113 |
+
|
| 1114 |
+
def get_sm_functions():
|
| 1115 |
+
f = opener.open('http://docs.sourcemod.net/api/SMfuncs.js')
|
| 1116 |
+
r = re.compile(r'SMfunctions\[\d+\] = Array \("(?:public )?([^,]+)",".+"\);')
|
| 1117 |
+
functions = []
|
| 1118 |
+
for line in f:
|
| 1119 |
+
m = r.match(line.decode())
|
| 1120 |
+
if m is not None:
|
| 1121 |
+
functions.append(m.groups()[0])
|
| 1122 |
+
return functions
|
| 1123 |
+
|
| 1124 |
+
def regenerate(filename, natives):
|
| 1125 |
+
with open(filename, encoding='utf-8') as fp:
|
| 1126 |
+
content = fp.read()
|
| 1127 |
+
|
| 1128 |
+
header = content[:content.find('FUNCTIONS = (')]
|
| 1129 |
+
footer = content[content.find("if __name__ == '__main__':")-1:]
|
| 1130 |
+
|
| 1131 |
+
|
| 1132 |
+
with open(filename, 'w', encoding='utf-8') as fp:
|
| 1133 |
+
fp.write(header)
|
| 1134 |
+
fp.write(format_lines('FUNCTIONS', natives))
|
| 1135 |
+
fp.write('\n\n' + footer)
|
| 1136 |
+
|
| 1137 |
+
def run():
|
| 1138 |
+
version = get_version()
|
| 1139 |
+
print(f'> Downloading function index for SourceMod {version}')
|
| 1140 |
+
functions = get_sm_functions()
|
| 1141 |
+
print('> %d functions found:' % len(functions))
|
| 1142 |
+
|
| 1143 |
+
functionlist = []
|
| 1144 |
+
for full_function_name in functions:
|
| 1145 |
+
print(f'>> {full_function_name}')
|
| 1146 |
+
functionlist.append(full_function_name)
|
| 1147 |
+
|
| 1148 |
+
regenerate(__file__, functionlist)
|
| 1149 |
+
|
| 1150 |
+
|
| 1151 |
+
run()
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ambient.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.ambient
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for AmbientTalk 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, bygroups
|
| 14 |
+
from pygments.token import Comment, Operator, Keyword, Name, String, \
|
| 15 |
+
Number, Punctuation, Whitespace
|
| 16 |
+
|
| 17 |
+
__all__ = ['AmbientTalkLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class AmbientTalkLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
Lexer for AmbientTalk source code.
|
| 23 |
+
"""
|
| 24 |
+
name = 'AmbientTalk'
|
| 25 |
+
url = 'https://code.google.com/p/ambienttalk'
|
| 26 |
+
filenames = ['*.at']
|
| 27 |
+
aliases = ['ambienttalk', 'ambienttalk/2', 'at']
|
| 28 |
+
mimetypes = ['text/x-ambienttalk']
|
| 29 |
+
version_added = '2.0'
|
| 30 |
+
|
| 31 |
+
flags = re.MULTILINE | re.DOTALL
|
| 32 |
+
|
| 33 |
+
builtin = words(('if:', 'then:', 'else:', 'when:', 'whenever:', 'discovered:',
|
| 34 |
+
'disconnected:', 'reconnected:', 'takenOffline:', 'becomes:',
|
| 35 |
+
'export:', 'as:', 'object:', 'actor:', 'mirror:', 'taggedAs:',
|
| 36 |
+
'mirroredBy:', 'is:'))
|
| 37 |
+
tokens = {
|
| 38 |
+
'root': [
|
| 39 |
+
(r'\s+', Whitespace),
|
| 40 |
+
(r'//.*?\n', Comment.Single),
|
| 41 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 42 |
+
(r'(def|deftype|import|alias|exclude)\b', Keyword),
|
| 43 |
+
(builtin, Name.Builtin),
|
| 44 |
+
(r'(true|false|nil)\b', Keyword.Constant),
|
| 45 |
+
(r'(~|lobby|jlobby|/)\.', Keyword.Constant, 'namespace'),
|
| 46 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String),
|
| 47 |
+
(r'\|', Punctuation, 'arglist'),
|
| 48 |
+
(r'<:|[*^!%&<>+=,./?-]|:=', Operator),
|
| 49 |
+
(r"`[a-zA-Z_]\w*", String.Symbol),
|
| 50 |
+
(r"[a-zA-Z_]\w*:", Name.Function),
|
| 51 |
+
(r"[{}()\[\];`]", Punctuation),
|
| 52 |
+
(r'(self|super)\b', Name.Variable.Instance),
|
| 53 |
+
(r"[a-zA-Z_]\w*", Name.Variable),
|
| 54 |
+
(r"@[a-zA-Z_]\w*", Name.Class),
|
| 55 |
+
(r"@\[", Name.Class, 'annotations'),
|
| 56 |
+
include('numbers'),
|
| 57 |
+
],
|
| 58 |
+
'numbers': [
|
| 59 |
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
| 60 |
+
(r'\d+', Number.Integer)
|
| 61 |
+
],
|
| 62 |
+
'namespace': [
|
| 63 |
+
(r'[a-zA-Z_]\w*\.', Name.Namespace),
|
| 64 |
+
(r'[a-zA-Z_]\w*:', Name.Function, '#pop'),
|
| 65 |
+
(r'[a-zA-Z_]\w*(?!\.)', Name.Function, '#pop')
|
| 66 |
+
],
|
| 67 |
+
'annotations': [
|
| 68 |
+
(r"(.*?)\]", Name.Class, '#pop')
|
| 69 |
+
],
|
| 70 |
+
'arglist': [
|
| 71 |
+
(r'\|', Punctuation, '#pop'),
|
| 72 |
+
(r'(\s*)(,)(\s*)', bygroups(Whitespace, Punctuation, Whitespace)),
|
| 73 |
+
(r'[a-zA-Z_]\w*', Name.Variable),
|
| 74 |
+
],
|
| 75 |
+
}
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/crystal.py
ADDED
|
@@ -0,0 +1,364 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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1 |
+
"""
|
| 2 |
+
pygments.lexers.crystal
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for Crystal.
|
| 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 ExtendedRegexLexer, include, bygroups, default, \
|
| 14 |
+
words, line_re
|
| 15 |
+
from pygments.token import Comment, Operator, Keyword, Name, String, Number, \
|
| 16 |
+
Punctuation, Error, Whitespace
|
| 17 |
+
|
| 18 |
+
__all__ = ['CrystalLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
CRYSTAL_OPERATORS = [
|
| 22 |
+
'!=', '!~', '!', '%', '&&', '&', '**', '*', '+', '-', '/', '<=>', '<<', '<=', '<',
|
| 23 |
+
'===', '==', '=~', '=', '>=', '>>', '>', '[]=', '[]?', '[]', '^', '||', '|', '~'
|
| 24 |
+
]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class CrystalLexer(ExtendedRegexLexer):
|
| 28 |
+
"""
|
| 29 |
+
For Crystal source code.
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
name = 'Crystal'
|
| 33 |
+
url = 'https://crystal-lang.org'
|
| 34 |
+
aliases = ['cr', 'crystal']
|
| 35 |
+
filenames = ['*.cr']
|
| 36 |
+
mimetypes = ['text/x-crystal']
|
| 37 |
+
version_added = '2.2'
|
| 38 |
+
|
| 39 |
+
flags = re.DOTALL | re.MULTILINE
|
| 40 |
+
|
| 41 |
+
def heredoc_callback(self, match, ctx):
|
| 42 |
+
# okay, this is the hardest part of parsing Crystal...
|
| 43 |
+
# match: 1 = <<-?, 2 = quote? 3 = name 4 = quote? 5 = rest of line
|
| 44 |
+
|
| 45 |
+
start = match.start(1)
|
| 46 |
+
yield start, Operator, match.group(1) # <<-?
|
| 47 |
+
yield match.start(2), String.Heredoc, match.group(2) # quote ", ', `
|
| 48 |
+
yield match.start(3), String.Delimiter, match.group(3) # heredoc name
|
| 49 |
+
yield match.start(4), String.Heredoc, match.group(4) # quote again
|
| 50 |
+
|
| 51 |
+
heredocstack = ctx.__dict__.setdefault('heredocstack', [])
|
| 52 |
+
outermost = not bool(heredocstack)
|
| 53 |
+
heredocstack.append((match.group(1) == '<<-', match.group(3)))
|
| 54 |
+
|
| 55 |
+
ctx.pos = match.start(5)
|
| 56 |
+
ctx.end = match.end(5)
|
| 57 |
+
# this may find other heredocs, so limit the recursion depth
|
| 58 |
+
if len(heredocstack) < 100:
|
| 59 |
+
yield from self.get_tokens_unprocessed(context=ctx)
|
| 60 |
+
else:
|
| 61 |
+
yield ctx.pos, String.Heredoc, match.group(5)
|
| 62 |
+
ctx.pos = match.end()
|
| 63 |
+
|
| 64 |
+
if outermost:
|
| 65 |
+
# this is the outer heredoc again, now we can process them all
|
| 66 |
+
for tolerant, hdname in heredocstack:
|
| 67 |
+
lines = []
|
| 68 |
+
for match in line_re.finditer(ctx.text, ctx.pos):
|
| 69 |
+
if tolerant:
|
| 70 |
+
check = match.group().strip()
|
| 71 |
+
else:
|
| 72 |
+
check = match.group().rstrip()
|
| 73 |
+
if check == hdname:
|
| 74 |
+
for amatch in lines:
|
| 75 |
+
yield amatch.start(), String.Heredoc, amatch.group()
|
| 76 |
+
yield match.start(), String.Delimiter, match.group()
|
| 77 |
+
ctx.pos = match.end()
|
| 78 |
+
break
|
| 79 |
+
else:
|
| 80 |
+
lines.append(match)
|
| 81 |
+
else:
|
| 82 |
+
# end of heredoc not found -- error!
|
| 83 |
+
for amatch in lines:
|
| 84 |
+
yield amatch.start(), Error, amatch.group()
|
| 85 |
+
ctx.end = len(ctx.text)
|
| 86 |
+
del heredocstack[:]
|
| 87 |
+
|
| 88 |
+
def gen_crystalstrings_rules():
|
| 89 |
+
states = {}
|
| 90 |
+
states['strings'] = [
|
| 91 |
+
(r'\:\w+[!?]?', String.Symbol),
|
| 92 |
+
(words(CRYSTAL_OPERATORS, prefix=r'\:'), String.Symbol),
|
| 93 |
+
(r":'(\\\\|\\[^\\]|[^'\\])*'", String.Symbol),
|
| 94 |
+
# This allows arbitrary text after '\ for simplicity
|
| 95 |
+
(r"'(\\\\|\\'|[^']|\\[^'\\]+)'", String.Char),
|
| 96 |
+
(r':"', String.Symbol, 'simple-sym'),
|
| 97 |
+
# Crystal doesn't have "symbol:"s but this simplifies function args
|
| 98 |
+
(r'([a-zA-Z_]\w*)(:)(?!:)', bygroups(String.Symbol, Punctuation)),
|
| 99 |
+
(r'"', String.Double, 'simple-string'),
|
| 100 |
+
(r'(?<!\.)`', String.Backtick, 'simple-backtick'),
|
| 101 |
+
]
|
| 102 |
+
|
| 103 |
+
# double-quoted string and symbol
|
| 104 |
+
for name, ttype, end in ('string', String.Double, '"'), \
|
| 105 |
+
('sym', String.Symbol, '"'), \
|
| 106 |
+
('backtick', String.Backtick, '`'):
|
| 107 |
+
states['simple-'+name] = [
|
| 108 |
+
include('string-escaped' if name == 'sym' else 'string-intp-escaped'),
|
| 109 |
+
(rf'[^\\{end}#]+', ttype),
|
| 110 |
+
(r'[\\#]', ttype),
|
| 111 |
+
(end, ttype, '#pop'),
|
| 112 |
+
]
|
| 113 |
+
|
| 114 |
+
# https://crystal-lang.org/docs/syntax_and_semantics/literals/string.html#percent-string-literals
|
| 115 |
+
for lbrace, rbrace, bracecc, name in \
|
| 116 |
+
('\\{', '\\}', '{}', 'cb'), \
|
| 117 |
+
('\\[', '\\]', '\\[\\]', 'sb'), \
|
| 118 |
+
('\\(', '\\)', '()', 'pa'), \
|
| 119 |
+
('<', '>', '<>', 'ab'), \
|
| 120 |
+
('\\|', '\\|', '\\|', 'pi'):
|
| 121 |
+
states[name+'-intp-string'] = [
|
| 122 |
+
(r'\\' + lbrace, String.Other),
|
| 123 |
+
] + (lbrace != rbrace) * [
|
| 124 |
+
(lbrace, String.Other, '#push'),
|
| 125 |
+
] + [
|
| 126 |
+
(rbrace, String.Other, '#pop'),
|
| 127 |
+
include('string-intp-escaped'),
|
| 128 |
+
(r'[\\#' + bracecc + ']', String.Other),
|
| 129 |
+
(r'[^\\#' + bracecc + ']+', String.Other),
|
| 130 |
+
]
|
| 131 |
+
states['strings'].append((r'%Q?' + lbrace, String.Other,
|
| 132 |
+
name+'-intp-string'))
|
| 133 |
+
states[name+'-string'] = [
|
| 134 |
+
(r'\\[\\' + bracecc + ']', String.Other),
|
| 135 |
+
] + (lbrace != rbrace) * [
|
| 136 |
+
(lbrace, String.Other, '#push'),
|
| 137 |
+
] + [
|
| 138 |
+
(rbrace, String.Other, '#pop'),
|
| 139 |
+
(r'[\\#' + bracecc + ']', String.Other),
|
| 140 |
+
(r'[^\\#' + bracecc + ']+', String.Other),
|
| 141 |
+
]
|
| 142 |
+
# https://crystal-lang.org/docs/syntax_and_semantics/literals/array.html#percent-array-literals
|
| 143 |
+
states['strings'].append((r'%[qwi]' + lbrace, String.Other,
|
| 144 |
+
name+'-string'))
|
| 145 |
+
states[name+'-regex'] = [
|
| 146 |
+
(r'\\[\\' + bracecc + ']', String.Regex),
|
| 147 |
+
] + (lbrace != rbrace) * [
|
| 148 |
+
(lbrace, String.Regex, '#push'),
|
| 149 |
+
] + [
|
| 150 |
+
(rbrace + '[imsx]*', String.Regex, '#pop'),
|
| 151 |
+
include('string-intp'),
|
| 152 |
+
(r'[\\#' + bracecc + ']', String.Regex),
|
| 153 |
+
(r'[^\\#' + bracecc + ']+', String.Regex),
|
| 154 |
+
]
|
| 155 |
+
states['strings'].append((r'%r' + lbrace, String.Regex,
|
| 156 |
+
name+'-regex'))
|
| 157 |
+
|
| 158 |
+
return states
|
| 159 |
+
|
| 160 |
+
tokens = {
|
| 161 |
+
'root': [
|
| 162 |
+
(r'#.*?$', Comment.Single),
|
| 163 |
+
# keywords
|
| 164 |
+
(words('''
|
| 165 |
+
abstract asm begin break case do else elsif end ensure extend if in
|
| 166 |
+
include next of private protected require rescue return select self super
|
| 167 |
+
then unless until when while with yield
|
| 168 |
+
'''.split(), suffix=r'\b'), Keyword),
|
| 169 |
+
(words('''
|
| 170 |
+
previous_def forall out uninitialized __DIR__ __FILE__ __LINE__
|
| 171 |
+
__END_LINE__
|
| 172 |
+
'''.split(), prefix=r'(?<!\.)', suffix=r'\b'), Keyword.Pseudo),
|
| 173 |
+
# https://crystal-lang.org/docs/syntax_and_semantics/is_a.html
|
| 174 |
+
(r'\.(is_a\?|nil\?|responds_to\?|as\?|as\b)', Keyword.Pseudo),
|
| 175 |
+
(words(['true', 'false', 'nil'], suffix=r'\b'), Keyword.Constant),
|
| 176 |
+
# start of function, class and module names
|
| 177 |
+
(r'(module|lib)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)',
|
| 178 |
+
bygroups(Keyword, Whitespace, Name.Namespace)),
|
| 179 |
+
(r'(def|fun|macro)(\s+)((?:[a-zA-Z_]\w*::)*)',
|
| 180 |
+
bygroups(Keyword, Whitespace, Name.Namespace), 'funcname'),
|
| 181 |
+
(r'def(?=[*%&^`~+-/\[<>=])', Keyword, 'funcname'),
|
| 182 |
+
(r'(annotation|class|struct|union|type|alias|enum)(\s+)((?:[a-zA-Z_]\w*::)*)',
|
| 183 |
+
bygroups(Keyword, Whitespace, Name.Namespace), 'classname'),
|
| 184 |
+
# https://crystal-lang.org/api/toplevel.html
|
| 185 |
+
(words('''
|
| 186 |
+
instance_sizeof offsetof pointerof sizeof typeof
|
| 187 |
+
'''.split(), prefix=r'(?<!\.)', suffix=r'\b'), Keyword.Pseudo),
|
| 188 |
+
# macros
|
| 189 |
+
(r'(?<!\.)(debugger\b|p!|pp!|record\b|spawn\b)', Name.Builtin.Pseudo),
|
| 190 |
+
# builtins
|
| 191 |
+
(words('''
|
| 192 |
+
abort at_exit caller exit gets loop main p pp print printf puts
|
| 193 |
+
raise rand read_line sleep spawn sprintf system
|
| 194 |
+
'''.split(), prefix=r'(?<!\.)', suffix=r'\b'), Name.Builtin),
|
| 195 |
+
# https://crystal-lang.org/api/Object.html#macro-summary
|
| 196 |
+
(r'(?<!\.)(((class_)?((getter|property)\b[!?]?|setter\b))|'
|
| 197 |
+
r'(def_(clone|equals|equals_and_hash|hash)|delegate|forward_missing_to)\b)',
|
| 198 |
+
Name.Builtin.Pseudo),
|
| 199 |
+
# normal heredocs
|
| 200 |
+
(r'(?<!\w)(<<-?)(["`\']?)([a-zA-Z_]\w*)(\2)(.*?\n)',
|
| 201 |
+
heredoc_callback),
|
| 202 |
+
# empty string heredocs
|
| 203 |
+
(r'(<<-?)("|\')()(\2)(.*?\n)', heredoc_callback),
|
| 204 |
+
(r'__END__', Comment.Preproc, 'end-part'),
|
| 205 |
+
# multiline regex (after keywords or assignments)
|
| 206 |
+
(r'(?:^|(?<=[=<>~!:])|'
|
| 207 |
+
r'(?<=(?:\s|;)when\s)|'
|
| 208 |
+
r'(?<=(?:\s|;)or\s)|'
|
| 209 |
+
r'(?<=(?:\s|;)and\s)|'
|
| 210 |
+
r'(?<=\.index\s)|'
|
| 211 |
+
r'(?<=\.scan\s)|'
|
| 212 |
+
r'(?<=\.sub\s)|'
|
| 213 |
+
r'(?<=\.sub!\s)|'
|
| 214 |
+
r'(?<=\.gsub\s)|'
|
| 215 |
+
r'(?<=\.gsub!\s)|'
|
| 216 |
+
r'(?<=\.match\s)|'
|
| 217 |
+
r'(?<=(?:\s|;)if\s)|'
|
| 218 |
+
r'(?<=(?:\s|;)elsif\s)|'
|
| 219 |
+
r'(?<=^when\s)|'
|
| 220 |
+
r'(?<=^index\s)|'
|
| 221 |
+
r'(?<=^scan\s)|'
|
| 222 |
+
r'(?<=^sub\s)|'
|
| 223 |
+
r'(?<=^gsub\s)|'
|
| 224 |
+
r'(?<=^sub!\s)|'
|
| 225 |
+
r'(?<=^gsub!\s)|'
|
| 226 |
+
r'(?<=^match\s)|'
|
| 227 |
+
r'(?<=^if\s)|'
|
| 228 |
+
r'(?<=^elsif\s)'
|
| 229 |
+
r')(\s*)(/)', bygroups(Whitespace, String.Regex), 'multiline-regex'),
|
| 230 |
+
# multiline regex (in method calls or subscripts)
|
| 231 |
+
(r'(?<=\(|,|\[)/', String.Regex, 'multiline-regex'),
|
| 232 |
+
# multiline regex (this time the funny no whitespace rule)
|
| 233 |
+
(r'(\s+)(/)(?![\s=])', bygroups(Whitespace, String.Regex),
|
| 234 |
+
'multiline-regex'),
|
| 235 |
+
# lex numbers and ignore following regular expressions which
|
| 236 |
+
# are division operators in fact (grrrr. i hate that. any
|
| 237 |
+
# better ideas?)
|
| 238 |
+
# since pygments 0.7 we also eat a "?" operator after numbers
|
| 239 |
+
# so that the char operator does not work. Chars are not allowed
|
| 240 |
+
# there so that you can use the ternary operator.
|
| 241 |
+
# stupid example:
|
| 242 |
+
# x>=0?n[x]:""
|
| 243 |
+
(r'(0o[0-7]+(?:_[0-7]+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?',
|
| 244 |
+
bygroups(Number.Oct, Whitespace, Operator)),
|
| 245 |
+
(r'(0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?',
|
| 246 |
+
bygroups(Number.Hex, Whitespace, Operator)),
|
| 247 |
+
(r'(0b[01]+(?:_[01]+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?',
|
| 248 |
+
bygroups(Number.Bin, Whitespace, Operator)),
|
| 249 |
+
# 3 separate expressions for floats because any of the 3 optional
|
| 250 |
+
# parts makes it a float
|
| 251 |
+
(r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)(?:e[+-]?[0-9]+)?'
|
| 252 |
+
r'(?:_?f[0-9]+)?)(\s*)([/?])?',
|
| 253 |
+
bygroups(Number.Float, Whitespace, Operator)),
|
| 254 |
+
(r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)?(?:e[+-]?[0-9]+)'
|
| 255 |
+
r'(?:_?f[0-9]+)?)(\s*)([/?])?',
|
| 256 |
+
bygroups(Number.Float, Whitespace, Operator)),
|
| 257 |
+
(r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)?(?:e[+-]?[0-9]+)?'
|
| 258 |
+
r'(?:_?f[0-9]+))(\s*)([/?])?',
|
| 259 |
+
bygroups(Number.Float, Whitespace, Operator)),
|
| 260 |
+
(r'(0\b|[1-9][\d]*(?:_\d+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?',
|
| 261 |
+
bygroups(Number.Integer, Whitespace, Operator)),
|
| 262 |
+
# Names
|
| 263 |
+
(r'@@[a-zA-Z_]\w*', Name.Variable.Class),
|
| 264 |
+
(r'@[a-zA-Z_]\w*', Name.Variable.Instance),
|
| 265 |
+
(r'\$\w+', Name.Variable.Global),
|
| 266 |
+
(r'\$[!@&`\'+~=/\\,;.<>_*$?:"^-]', Name.Variable.Global),
|
| 267 |
+
(r'\$-[0adFiIlpvw]', Name.Variable.Global),
|
| 268 |
+
(r'::', Operator),
|
| 269 |
+
include('strings'),
|
| 270 |
+
# https://crystal-lang.org/reference/syntax_and_semantics/literals/char.html
|
| 271 |
+
(r'\?(\\[MC]-)*' # modifiers
|
| 272 |
+
r'(\\([\\abefnrtv#"\']|[0-7]{1,3}|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|u\{[a-fA-F0-9 ]+\})|\S)'
|
| 273 |
+
r'(?!\w)',
|
| 274 |
+
String.Char),
|
| 275 |
+
(r'[A-Z][A-Z_]+\b(?!::|\.)', Name.Constant),
|
| 276 |
+
# macro expansion
|
| 277 |
+
(r'\{%', String.Interpol, 'in-macro-control'),
|
| 278 |
+
(r'\{\{', String.Interpol, 'in-macro-expr'),
|
| 279 |
+
# annotations
|
| 280 |
+
(r'(@\[)(\s*)([A-Z]\w*(::[A-Z]\w*)*)',
|
| 281 |
+
bygroups(Operator, Whitespace, Name.Decorator), 'in-annot'),
|
| 282 |
+
# this is needed because Crystal attributes can look
|
| 283 |
+
# like keywords (class) or like this: ` ?!?
|
| 284 |
+
(words(CRYSTAL_OPERATORS, prefix=r'(\.|::)'),
|
| 285 |
+
bygroups(Operator, Name.Operator)),
|
| 286 |
+
(r'(\.|::)([a-zA-Z_]\w*[!?]?|[*%&^`~+\-/\[<>=])',
|
| 287 |
+
bygroups(Operator, Name)),
|
| 288 |
+
# Names can end with [!?] unless it's "!="
|
| 289 |
+
(r'[a-zA-Z_]\w*(?:[!?](?!=))?', Name),
|
| 290 |
+
(r'(\[|\]\??|\*\*|<=>?|>=|<<?|>>?|=~|===|'
|
| 291 |
+
r'!~|&&?|\|\||\.{1,3})', Operator),
|
| 292 |
+
(r'[-+/*%=<>&!^|~]=?', Operator),
|
| 293 |
+
(r'[(){};,/?:\\]', Punctuation),
|
| 294 |
+
(r'\s+', Whitespace)
|
| 295 |
+
],
|
| 296 |
+
'funcname': [
|
| 297 |
+
(r'(?:([a-zA-Z_]\w*)(\.))?'
|
| 298 |
+
r'([a-zA-Z_]\w*[!?]?|\*\*?|[-+]@?|'
|
| 299 |
+
r'[/%&|^`~]|\[\]=?|<<|>>|<=?>|>=?|===?)',
|
| 300 |
+
bygroups(Name.Class, Operator, Name.Function), '#pop'),
|
| 301 |
+
default('#pop')
|
| 302 |
+
],
|
| 303 |
+
'classname': [
|
| 304 |
+
(r'[A-Z_]\w*', Name.Class),
|
| 305 |
+
(r'(\()(\s*)([A-Z_]\w*)(\s*)(\))',
|
| 306 |
+
bygroups(Punctuation, Whitespace, Name.Class, Whitespace, Punctuation)),
|
| 307 |
+
default('#pop')
|
| 308 |
+
],
|
| 309 |
+
'in-intp': [
|
| 310 |
+
(r'\{', String.Interpol, '#push'),
|
| 311 |
+
(r'\}', String.Interpol, '#pop'),
|
| 312 |
+
include('root'),
|
| 313 |
+
],
|
| 314 |
+
'string-intp': [
|
| 315 |
+
(r'#\{', String.Interpol, 'in-intp'),
|
| 316 |
+
],
|
| 317 |
+
'string-escaped': [
|
| 318 |
+
# https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html
|
| 319 |
+
(r'\\([\\abefnrtv#"\']|[0-7]{1,3}|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|u\{[a-fA-F0-9 ]+\})',
|
| 320 |
+
String.Escape)
|
| 321 |
+
],
|
| 322 |
+
'string-intp-escaped': [
|
| 323 |
+
include('string-intp'),
|
| 324 |
+
include('string-escaped'),
|
| 325 |
+
],
|
| 326 |
+
'interpolated-regex': [
|
| 327 |
+
include('string-intp'),
|
| 328 |
+
(r'[\\#]', String.Regex),
|
| 329 |
+
(r'[^\\#]+', String.Regex),
|
| 330 |
+
],
|
| 331 |
+
'interpolated-string': [
|
| 332 |
+
include('string-intp'),
|
| 333 |
+
(r'[\\#]', String.Other),
|
| 334 |
+
(r'[^\\#]+', String.Other),
|
| 335 |
+
],
|
| 336 |
+
'multiline-regex': [
|
| 337 |
+
include('string-intp'),
|
| 338 |
+
(r'\\\\', String.Regex),
|
| 339 |
+
(r'\\/', String.Regex),
|
| 340 |
+
(r'[\\#]', String.Regex),
|
| 341 |
+
(r'[^\\/#]+', String.Regex),
|
| 342 |
+
(r'/[imsx]*', String.Regex, '#pop'),
|
| 343 |
+
],
|
| 344 |
+
'end-part': [
|
| 345 |
+
(r'.+', Comment.Preproc, '#pop')
|
| 346 |
+
],
|
| 347 |
+
'in-macro-control': [
|
| 348 |
+
(r'\{%', String.Interpol, '#push'),
|
| 349 |
+
(r'%\}', String.Interpol, '#pop'),
|
| 350 |
+
(r'(for|verbatim)\b', Keyword),
|
| 351 |
+
include('root'),
|
| 352 |
+
],
|
| 353 |
+
'in-macro-expr': [
|
| 354 |
+
(r'\{\{', String.Interpol, '#push'),
|
| 355 |
+
(r'\}\}', String.Interpol, '#pop'),
|
| 356 |
+
include('root'),
|
| 357 |
+
],
|
| 358 |
+
'in-annot': [
|
| 359 |
+
(r'\[', Operator, '#push'),
|
| 360 |
+
(r'\]', Operator, '#pop'),
|
| 361 |
+
include('root'),
|
| 362 |
+
],
|
| 363 |
+
}
|
| 364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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.dsls
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for various domain-specific 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 ExtendedRegexLexer, RegexLexer, bygroups, words, \
|
| 14 |
+
include, default, this, using, combined
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Whitespace
|
| 17 |
+
|
| 18 |
+
__all__ = ['ProtoBufLexer', 'ZeekLexer', 'PuppetLexer', 'RslLexer',
|
| 19 |
+
'MscgenLexer', 'VGLLexer', 'AlloyLexer', 'PanLexer',
|
| 20 |
+
'CrmshLexer', 'ThriftLexer', 'FlatlineLexer', 'SnowballLexer']
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class ProtoBufLexer(RegexLexer):
|
| 24 |
+
"""
|
| 25 |
+
Lexer for Protocol Buffer definition files.
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
name = 'Protocol Buffer'
|
| 29 |
+
url = 'https://developers.google.com/protocol-buffers/'
|
| 30 |
+
aliases = ['protobuf', 'proto']
|
| 31 |
+
filenames = ['*.proto']
|
| 32 |
+
version_added = '1.4'
|
| 33 |
+
|
| 34 |
+
tokens = {
|
| 35 |
+
'root': [
|
| 36 |
+
(r'[ \t]+', Whitespace),
|
| 37 |
+
(r'[,;{}\[\]()<>]', Punctuation),
|
| 38 |
+
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
| 39 |
+
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
|
| 40 |
+
(words((
|
| 41 |
+
'import', 'option', 'optional', 'required', 'repeated',
|
| 42 |
+
'reserved', 'default', 'packed', 'ctype', 'extensions', 'to',
|
| 43 |
+
'max', 'rpc', 'returns', 'oneof', 'syntax'), prefix=r'\b', suffix=r'\b'),
|
| 44 |
+
Keyword),
|
| 45 |
+
(words((
|
| 46 |
+
'int32', 'int64', 'uint32', 'uint64', 'sint32', 'sint64',
|
| 47 |
+
'fixed32', 'fixed64', 'sfixed32', 'sfixed64',
|
| 48 |
+
'float', 'double', 'bool', 'string', 'bytes'), suffix=r'\b'),
|
| 49 |
+
Keyword.Type),
|
| 50 |
+
(r'(true|false)\b', Keyword.Constant),
|
| 51 |
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Whitespace), 'package'),
|
| 52 |
+
(r'(message|extend)(\s+)',
|
| 53 |
+
bygroups(Keyword.Declaration, Whitespace), 'message'),
|
| 54 |
+
(r'(enum|group|service)(\s+)',
|
| 55 |
+
bygroups(Keyword.Declaration, Whitespace), 'type'),
|
| 56 |
+
(r'\".*?\"', String),
|
| 57 |
+
(r'\'.*?\'', String),
|
| 58 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
|
| 59 |
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
| 60 |
+
(r'(\-?(inf|nan))\b', Number.Float),
|
| 61 |
+
(r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
|
| 62 |
+
(r'0[0-7]+[LlUu]*', Number.Oct),
|
| 63 |
+
(r'\d+[LlUu]*', Number.Integer),
|
| 64 |
+
(r'[+-=]', Operator),
|
| 65 |
+
(r'([a-zA-Z_][\w.]*)([ \t]*)(=)',
|
| 66 |
+
bygroups(Name.Attribute, Whitespace, Operator)),
|
| 67 |
+
(r'[a-zA-Z_][\w.]*', Name),
|
| 68 |
+
],
|
| 69 |
+
'package': [
|
| 70 |
+
(r'[a-zA-Z_][\w\.]*', Name.Namespace, '#pop'),
|
| 71 |
+
default('#pop'),
|
| 72 |
+
],
|
| 73 |
+
'message': [
|
| 74 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop'),
|
| 75 |
+
default('#pop'),
|
| 76 |
+
],
|
| 77 |
+
'type': [
|
| 78 |
+
(r'[a-zA-Z_]\w*', Name, '#pop'),
|
| 79 |
+
default('#pop'),
|
| 80 |
+
],
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
class ThriftLexer(RegexLexer):
|
| 85 |
+
"""
|
| 86 |
+
For Thrift interface definitions.
|
| 87 |
+
"""
|
| 88 |
+
name = 'Thrift'
|
| 89 |
+
url = 'https://thrift.apache.org/'
|
| 90 |
+
aliases = ['thrift']
|
| 91 |
+
filenames = ['*.thrift']
|
| 92 |
+
mimetypes = ['application/x-thrift']
|
| 93 |
+
version_added = '2.1'
|
| 94 |
+
|
| 95 |
+
tokens = {
|
| 96 |
+
'root': [
|
| 97 |
+
include('whitespace'),
|
| 98 |
+
include('comments'),
|
| 99 |
+
(r'"', String.Double, combined('stringescape', 'dqs')),
|
| 100 |
+
(r'\'', String.Single, combined('stringescape', 'sqs')),
|
| 101 |
+
(r'(namespace)(\s+)',
|
| 102 |
+
bygroups(Keyword.Namespace, Whitespace), 'namespace'),
|
| 103 |
+
(r'(enum|union|struct|service|exception)(\s+)',
|
| 104 |
+
bygroups(Keyword.Declaration, Whitespace), 'class'),
|
| 105 |
+
(r'((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)' # return arguments
|
| 106 |
+
r'((?:[^\W\d]|\$)[\w$]*)' # method name
|
| 107 |
+
r'(\s*)(\()', # signature start
|
| 108 |
+
bygroups(using(this), Name.Function, Whitespace, Operator)),
|
| 109 |
+
include('keywords'),
|
| 110 |
+
include('numbers'),
|
| 111 |
+
(r'[&=]', Operator),
|
| 112 |
+
(r'[:;,{}()<>\[\]]', Punctuation),
|
| 113 |
+
(r'[a-zA-Z_](\.\w|\w)*', Name),
|
| 114 |
+
],
|
| 115 |
+
'whitespace': [
|
| 116 |
+
(r'\n', Whitespace),
|
| 117 |
+
(r'\s+', Whitespace),
|
| 118 |
+
],
|
| 119 |
+
'comments': [
|
| 120 |
+
(r'#.*$', Comment),
|
| 121 |
+
(r'//.*?\n', Comment),
|
| 122 |
+
(r'/\*[\w\W]*?\*/', Comment.Multiline),
|
| 123 |
+
],
|
| 124 |
+
'stringescape': [
|
| 125 |
+
(r'\\([\\nrt"\'])', String.Escape),
|
| 126 |
+
],
|
| 127 |
+
'dqs': [
|
| 128 |
+
(r'"', String.Double, '#pop'),
|
| 129 |
+
(r'[^\\"\n]+', String.Double),
|
| 130 |
+
],
|
| 131 |
+
'sqs': [
|
| 132 |
+
(r"'", String.Single, '#pop'),
|
| 133 |
+
(r'[^\\\'\n]+', String.Single),
|
| 134 |
+
],
|
| 135 |
+
'namespace': [
|
| 136 |
+
(r'[a-z*](\.\w|\w)*', Name.Namespace, '#pop'),
|
| 137 |
+
default('#pop'),
|
| 138 |
+
],
|
| 139 |
+
'class': [
|
| 140 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop'),
|
| 141 |
+
default('#pop'),
|
| 142 |
+
],
|
| 143 |
+
'keywords': [
|
| 144 |
+
(r'(async|oneway|extends|throws|required|optional)\b', Keyword),
|
| 145 |
+
(r'(true|false)\b', Keyword.Constant),
|
| 146 |
+
(r'(const|typedef)\b', Keyword.Declaration),
|
| 147 |
+
(words((
|
| 148 |
+
'cpp_namespace', 'cpp_include', 'cpp_type', 'java_package',
|
| 149 |
+
'cocoa_prefix', 'csharp_namespace', 'delphi_namespace',
|
| 150 |
+
'php_namespace', 'py_module', 'perl_package',
|
| 151 |
+
'ruby_namespace', 'smalltalk_category', 'smalltalk_prefix',
|
| 152 |
+
'xsd_all', 'xsd_optional', 'xsd_nillable', 'xsd_namespace',
|
| 153 |
+
'xsd_attrs', 'include'), suffix=r'\b'),
|
| 154 |
+
Keyword.Namespace),
|
| 155 |
+
(words((
|
| 156 |
+
'void', 'bool', 'byte', 'i16', 'i32', 'i64', 'double',
|
| 157 |
+
'string', 'binary', 'map', 'list', 'set', 'slist',
|
| 158 |
+
'senum'), suffix=r'\b'),
|
| 159 |
+
Keyword.Type),
|
| 160 |
+
(words((
|
| 161 |
+
'BEGIN', 'END', '__CLASS__', '__DIR__', '__FILE__',
|
| 162 |
+
'__FUNCTION__', '__LINE__', '__METHOD__', '__NAMESPACE__',
|
| 163 |
+
'abstract', 'alias', 'and', 'args', 'as', 'assert', 'begin',
|
| 164 |
+
'break', 'case', 'catch', 'class', 'clone', 'continue',
|
| 165 |
+
'declare', 'def', 'default', 'del', 'delete', 'do', 'dynamic',
|
| 166 |
+
'elif', 'else', 'elseif', 'elsif', 'end', 'enddeclare',
|
| 167 |
+
'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile',
|
| 168 |
+
'ensure', 'except', 'exec', 'finally', 'float', 'for',
|
| 169 |
+
'foreach', 'function', 'global', 'goto', 'if', 'implements',
|
| 170 |
+
'import', 'in', 'inline', 'instanceof', 'interface', 'is',
|
| 171 |
+
'lambda', 'module', 'native', 'new', 'next', 'nil', 'not',
|
| 172 |
+
'or', 'pass', 'public', 'print', 'private', 'protected',
|
| 173 |
+
'raise', 'redo', 'rescue', 'retry', 'register', 'return',
|
| 174 |
+
'self', 'sizeof', 'static', 'super', 'switch', 'synchronized',
|
| 175 |
+
'then', 'this', 'throw', 'transient', 'try', 'undef',
|
| 176 |
+
'unless', 'unsigned', 'until', 'use', 'var', 'virtual',
|
| 177 |
+
'volatile', 'when', 'while', 'with', 'xor', 'yield'),
|
| 178 |
+
prefix=r'\b', suffix=r'\b'),
|
| 179 |
+
Keyword.Reserved),
|
| 180 |
+
],
|
| 181 |
+
'numbers': [
|
| 182 |
+
(r'[+-]?(\d+\.\d+([eE][+-]?\d+)?|\.?\d+[eE][+-]?\d+)', Number.Float),
|
| 183 |
+
(r'[+-]?0x[0-9A-Fa-f]+', Number.Hex),
|
| 184 |
+
(r'[+-]?[0-9]+', Number.Integer),
|
| 185 |
+
],
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
class ZeekLexer(RegexLexer):
|
| 190 |
+
"""
|
| 191 |
+
For Zeek scripts.
|
| 192 |
+
"""
|
| 193 |
+
name = 'Zeek'
|
| 194 |
+
url = 'https://www.zeek.org/'
|
| 195 |
+
aliases = ['zeek', 'bro']
|
| 196 |
+
filenames = ['*.zeek', '*.bro']
|
| 197 |
+
version_added = '2.5'
|
| 198 |
+
|
| 199 |
+
_hex = r'[0-9a-fA-F]'
|
| 200 |
+
_float = r'((\d*\.?\d+)|(\d+\.?\d*))([eE][-+]?\d+)?'
|
| 201 |
+
_h = r'[A-Za-z0-9][-A-Za-z0-9]*'
|
| 202 |
+
|
| 203 |
+
tokens = {
|
| 204 |
+
'root': [
|
| 205 |
+
include('whitespace'),
|
| 206 |
+
include('comments'),
|
| 207 |
+
include('directives'),
|
| 208 |
+
include('attributes'),
|
| 209 |
+
include('types'),
|
| 210 |
+
include('keywords'),
|
| 211 |
+
include('literals'),
|
| 212 |
+
include('operators'),
|
| 213 |
+
include('punctuation'),
|
| 214 |
+
(r'((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)(?=\s*\()',
|
| 215 |
+
Name.Function),
|
| 216 |
+
include('identifiers'),
|
| 217 |
+
],
|
| 218 |
+
|
| 219 |
+
'whitespace': [
|
| 220 |
+
(r'\n', Whitespace),
|
| 221 |
+
(r'\s+', Whitespace),
|
| 222 |
+
(r'(\\)(\n)', bygroups(Text, Whitespace)),
|
| 223 |
+
],
|
| 224 |
+
|
| 225 |
+
'comments': [
|
| 226 |
+
(r'#.*$', Comment),
|
| 227 |
+
],
|
| 228 |
+
|
| 229 |
+
'directives': [
|
| 230 |
+
(r'@(load-plugin|load-sigs|load|unload)\b.*$', Comment.Preproc),
|
| 231 |
+
(r'@(DEBUG|DIR|FILENAME|deprecated|if|ifdef|ifndef|else|endif)\b', Comment.Preproc),
|
| 232 |
+
(r'(@prefixes)(\s*)((\+?=).*)$', bygroups(Comment.Preproc,
|
| 233 |
+
Whitespace, Comment.Preproc)),
|
| 234 |
+
],
|
| 235 |
+
|
| 236 |
+
'attributes': [
|
| 237 |
+
(words(('redef', 'priority', 'log', 'optional', 'default', 'add_func',
|
| 238 |
+
'delete_func', 'expire_func', 'read_expire', 'write_expire',
|
| 239 |
+
'create_expire', 'synchronized', 'persistent', 'rotate_interval',
|
| 240 |
+
'rotate_size', 'encrypt', 'raw_output', 'mergeable', 'error_handler',
|
| 241 |
+
'type_column', 'deprecated'),
|
| 242 |
+
prefix=r'&', suffix=r'\b'),
|
| 243 |
+
Keyword.Pseudo),
|
| 244 |
+
],
|
| 245 |
+
|
| 246 |
+
'types': [
|
| 247 |
+
(words(('any',
|
| 248 |
+
'enum', 'record', 'set', 'table', 'vector',
|
| 249 |
+
'function', 'hook', 'event',
|
| 250 |
+
'addr', 'bool', 'count', 'double', 'file', 'int', 'interval',
|
| 251 |
+
'pattern', 'port', 'string', 'subnet', 'time'),
|
| 252 |
+
suffix=r'\b'),
|
| 253 |
+
Keyword.Type),
|
| 254 |
+
|
| 255 |
+
(r'(opaque)(\s+)(of)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)\b',
|
| 256 |
+
bygroups(Keyword.Type, Whitespace, Operator.Word, Whitespace, Keyword.Type)),
|
| 257 |
+
|
| 258 |
+
(r'(type)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)(\s*)(:)(\s*)\b(record|enum)\b',
|
| 259 |
+
bygroups(Keyword, Whitespace, Name.Class, Whitespace, Operator, Whitespace, Keyword.Type)),
|
| 260 |
+
|
| 261 |
+
(r'(type)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)(\s*)(:)',
|
| 262 |
+
bygroups(Keyword, Whitespace, Name, Whitespace, Operator)),
|
| 263 |
+
|
| 264 |
+
(r'(redef)(\s+)(record|enum)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)\b',
|
| 265 |
+
bygroups(Keyword, Whitespace, Keyword.Type, Whitespace, Name.Class)),
|
| 266 |
+
],
|
| 267 |
+
|
| 268 |
+
'keywords': [
|
| 269 |
+
(words(('redef', 'export', 'if', 'else', 'for', 'while',
|
| 270 |
+
'return', 'break', 'next', 'continue', 'fallthrough',
|
| 271 |
+
'switch', 'default', 'case',
|
| 272 |
+
'add', 'delete',
|
| 273 |
+
'when', 'timeout', 'schedule'),
|
| 274 |
+
suffix=r'\b'),
|
| 275 |
+
Keyword),
|
| 276 |
+
(r'(print)\b', Keyword),
|
| 277 |
+
(r'(global|local|const|option)\b', Keyword.Declaration),
|
| 278 |
+
(r'(module)(\s+)(([A-Za-z_]\w*)(?:::([A-Za-z_]\w*))*)\b',
|
| 279 |
+
bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
|
| 280 |
+
],
|
| 281 |
+
|
| 282 |
+
'literals': [
|
| 283 |
+
(r'"', String, 'string'),
|
| 284 |
+
|
| 285 |
+
# Not the greatest match for patterns, but generally helps
|
| 286 |
+
# disambiguate between start of a pattern and just a division
|
| 287 |
+
# operator.
|
| 288 |
+
(r'/(?=.*/)', String.Regex, 'regex'),
|
| 289 |
+
|
| 290 |
+
(r'(T|F)\b', Keyword.Constant),
|
| 291 |
+
|
| 292 |
+
# Port
|
| 293 |
+
(r'\d{1,5}/(udp|tcp|icmp|unknown)\b', Number),
|
| 294 |
+
|
| 295 |
+
# IPv4 Address
|
| 296 |
+
(r'(\d{1,3}.){3}(\d{1,3})\b', Number),
|
| 297 |
+
|
| 298 |
+
# IPv6 Address
|
| 299 |
+
(r'\[([0-9a-fA-F]{0,4}:){2,7}([0-9a-fA-F]{0,4})?((\d{1,3}.){3}(\d{1,3}))?\]', Number),
|
| 300 |
+
|
| 301 |
+
# Numeric
|
| 302 |
+
(r'0[xX]' + _hex + r'+\b', Number.Hex),
|
| 303 |
+
(_float + r'\s*(day|hr|min|sec|msec|usec)s?\b', Number.Float),
|
| 304 |
+
(_float + r'\b', Number.Float),
|
| 305 |
+
(r'(\d+)\b', Number.Integer),
|
| 306 |
+
|
| 307 |
+
# Hostnames
|
| 308 |
+
(_h + r'(\.' + _h + r')+', String),
|
| 309 |
+
],
|
| 310 |
+
|
| 311 |
+
'operators': [
|
| 312 |
+
(r'[!%*/+<=>~|&^-]', Operator),
|
| 313 |
+
(r'([-+=&|]{2}|[+=!><-]=)', Operator),
|
| 314 |
+
(r'(in|as|is|of)\b', Operator.Word),
|
| 315 |
+
(r'\??\$', Operator),
|
| 316 |
+
],
|
| 317 |
+
|
| 318 |
+
'punctuation': [
|
| 319 |
+
(r'[{}()\[\],;.]', Punctuation),
|
| 320 |
+
# The "ternary if", which uses '?' and ':', could instead be
|
| 321 |
+
# treated as an Operator, but colons are more frequently used to
|
| 322 |
+
# separate field/identifier names from their types, so the (often)
|
| 323 |
+
# less-prominent Punctuation is used even with '?' for consistency.
|
| 324 |
+
(r'[?:]', Punctuation),
|
| 325 |
+
],
|
| 326 |
+
|
| 327 |
+
'identifiers': [
|
| 328 |
+
(r'([a-zA-Z_]\w*)(::)', bygroups(Name, Punctuation)),
|
| 329 |
+
(r'[a-zA-Z_]\w*', Name)
|
| 330 |
+
],
|
| 331 |
+
|
| 332 |
+
'string': [
|
| 333 |
+
(r'\\.', String.Escape),
|
| 334 |
+
(r'%-?[0-9]*(\.[0-9]+)?[DTd-gsx]', String.Escape),
|
| 335 |
+
(r'"', String, '#pop'),
|
| 336 |
+
(r'.', String),
|
| 337 |
+
],
|
| 338 |
+
|
| 339 |
+
'regex': [
|
| 340 |
+
(r'\\.', String.Escape),
|
| 341 |
+
(r'/', String.Regex, '#pop'),
|
| 342 |
+
(r'.', String.Regex),
|
| 343 |
+
],
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
BroLexer = ZeekLexer
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
class PuppetLexer(RegexLexer):
|
| 351 |
+
"""
|
| 352 |
+
For Puppet configuration DSL.
|
| 353 |
+
"""
|
| 354 |
+
name = 'Puppet'
|
| 355 |
+
url = 'https://puppet.com/'
|
| 356 |
+
aliases = ['puppet']
|
| 357 |
+
filenames = ['*.pp']
|
| 358 |
+
version_added = '1.6'
|
| 359 |
+
|
| 360 |
+
tokens = {
|
| 361 |
+
'root': [
|
| 362 |
+
include('comments'),
|
| 363 |
+
include('keywords'),
|
| 364 |
+
include('names'),
|
| 365 |
+
include('numbers'),
|
| 366 |
+
include('operators'),
|
| 367 |
+
include('strings'),
|
| 368 |
+
|
| 369 |
+
(r'[]{}:(),;[]', Punctuation),
|
| 370 |
+
(r'\s+', Whitespace),
|
| 371 |
+
],
|
| 372 |
+
|
| 373 |
+
'comments': [
|
| 374 |
+
(r'(\s*)(#.*)$', bygroups(Whitespace, Comment)),
|
| 375 |
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
| 376 |
+
],
|
| 377 |
+
|
| 378 |
+
'operators': [
|
| 379 |
+
(r'(=>|\?|<|>|=|\+|-|/|\*|~|!|\|)', Operator),
|
| 380 |
+
(r'(in|and|or|not)\b', Operator.Word),
|
| 381 |
+
],
|
| 382 |
+
|
| 383 |
+
'names': [
|
| 384 |
+
(r'[a-zA-Z_]\w*', Name.Attribute),
|
| 385 |
+
(r'(\$\S+)(\[)(\S+)(\])', bygroups(Name.Variable, Punctuation,
|
| 386 |
+
String, Punctuation)),
|
| 387 |
+
(r'\$\S+', Name.Variable),
|
| 388 |
+
],
|
| 389 |
+
|
| 390 |
+
'numbers': [
|
| 391 |
+
# Copypasta from the Python lexer
|
| 392 |
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
|
| 393 |
+
(r'\d+[eE][+-]?[0-9]+j?', Number.Float),
|
| 394 |
+
(r'0[0-7]+j?', Number.Oct),
|
| 395 |
+
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
| 396 |
+
(r'\d+L', Number.Integer.Long),
|
| 397 |
+
(r'\d+j?', Number.Integer)
|
| 398 |
+
],
|
| 399 |
+
|
| 400 |
+
'keywords': [
|
| 401 |
+
# Left out 'group' and 'require'
|
| 402 |
+
# Since they're often used as attributes
|
| 403 |
+
(words((
|
| 404 |
+
'absent', 'alert', 'alias', 'audit', 'augeas', 'before', 'case',
|
| 405 |
+
'check', 'class', 'computer', 'configured', 'contained',
|
| 406 |
+
'create_resources', 'crit', 'cron', 'debug', 'default',
|
| 407 |
+
'define', 'defined', 'directory', 'else', 'elsif', 'emerg',
|
| 408 |
+
'err', 'exec', 'extlookup', 'fail', 'false', 'file',
|
| 409 |
+
'filebucket', 'fqdn_rand', 'generate', 'host', 'if', 'import',
|
| 410 |
+
'include', 'info', 'inherits', 'inline_template', 'installed',
|
| 411 |
+
'interface', 'k5login', 'latest', 'link', 'loglevel',
|
| 412 |
+
'macauthorization', 'mailalias', 'maillist', 'mcx', 'md5',
|
| 413 |
+
'mount', 'mounted', 'nagios_command', 'nagios_contact',
|
| 414 |
+
'nagios_contactgroup', 'nagios_host', 'nagios_hostdependency',
|
| 415 |
+
'nagios_hostescalation', 'nagios_hostextinfo', 'nagios_hostgroup',
|
| 416 |
+
'nagios_service', 'nagios_servicedependency', 'nagios_serviceescalation',
|
| 417 |
+
'nagios_serviceextinfo', 'nagios_servicegroup', 'nagios_timeperiod',
|
| 418 |
+
'node', 'noop', 'notice', 'notify', 'package', 'present', 'purged',
|
| 419 |
+
'realize', 'regsubst', 'resources', 'role', 'router', 'running',
|
| 420 |
+
'schedule', 'scheduled_task', 'search', 'selboolean', 'selmodule',
|
| 421 |
+
'service', 'sha1', 'shellquote', 'split', 'sprintf',
|
| 422 |
+
'ssh_authorized_key', 'sshkey', 'stage', 'stopped', 'subscribe',
|
| 423 |
+
'tag', 'tagged', 'template', 'tidy', 'true', 'undef', 'unmounted',
|
| 424 |
+
'user', 'versioncmp', 'vlan', 'warning', 'yumrepo', 'zfs', 'zone',
|
| 425 |
+
'zpool'), prefix='(?i)', suffix=r'\b'),
|
| 426 |
+
Keyword),
|
| 427 |
+
],
|
| 428 |
+
|
| 429 |
+
'strings': [
|
| 430 |
+
(r'"([^"])*"', String),
|
| 431 |
+
(r"'(\\'|[^'])*'", String),
|
| 432 |
+
],
|
| 433 |
+
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
class RslLexer(RegexLexer):
|
| 438 |
+
"""
|
| 439 |
+
RSL is the formal specification
|
| 440 |
+
language used in RAISE (Rigorous Approach to Industrial Software Engineering)
|
| 441 |
+
method.
|
| 442 |
+
"""
|
| 443 |
+
name = 'RSL'
|
| 444 |
+
url = 'http://en.wikipedia.org/wiki/RAISE'
|
| 445 |
+
aliases = ['rsl']
|
| 446 |
+
filenames = ['*.rsl']
|
| 447 |
+
mimetypes = ['text/rsl']
|
| 448 |
+
version_added = '2.0'
|
| 449 |
+
|
| 450 |
+
flags = re.MULTILINE | re.DOTALL
|
| 451 |
+
|
| 452 |
+
tokens = {
|
| 453 |
+
'root': [
|
| 454 |
+
(words((
|
| 455 |
+
'Bool', 'Char', 'Int', 'Nat', 'Real', 'Text', 'Unit', 'abs',
|
| 456 |
+
'all', 'always', 'any', 'as', 'axiom', 'card', 'case', 'channel',
|
| 457 |
+
'chaos', 'class', 'devt_relation', 'dom', 'elems', 'else', 'elif',
|
| 458 |
+
'end', 'exists', 'extend', 'false', 'for', 'hd', 'hide', 'if',
|
| 459 |
+
'in', 'is', 'inds', 'initialise', 'int', 'inter', 'isin', 'len',
|
| 460 |
+
'let', 'local', 'ltl_assertion', 'object', 'of', 'out', 'post',
|
| 461 |
+
'pre', 'read', 'real', 'rng', 'scheme', 'skip', 'stop', 'swap',
|
| 462 |
+
'then', 'theory', 'test_case', 'tl', 'transition_system', 'true',
|
| 463 |
+
'type', 'union', 'until', 'use', 'value', 'variable', 'while',
|
| 464 |
+
'with', 'write', '~isin', '-inflist', '-infset', '-list',
|
| 465 |
+
'-set'), prefix=r'\b', suffix=r'\b'),
|
| 466 |
+
Keyword),
|
| 467 |
+
(r'(variable|value)\b', Keyword.Declaration),
|
| 468 |
+
(r'--.*?\n', Comment),
|
| 469 |
+
(r'<:.*?:>', Comment),
|
| 470 |
+
(r'\{!.*?!\}', Comment),
|
| 471 |
+
(r'/\*.*?\*/', Comment),
|
| 472 |
+
(r'^([ \t]*)([\w]+)([ \t]*)(:[^:])', bygroups(Whitespace,
|
| 473 |
+
Name.Function, Whitespace, Name.Function)),
|
| 474 |
+
(r'(^[ \t]*)([\w]+)([ \t]*)(\([\w\s,]*\))([ \t]*)(is|as)',
|
| 475 |
+
bygroups(Whitespace, Name.Function, Whitespace, Text,
|
| 476 |
+
Whitespace, Keyword)),
|
| 477 |
+
(r'\b[A-Z]\w*\b', Keyword.Type),
|
| 478 |
+
(r'(true|false)\b', Keyword.Constant),
|
| 479 |
+
(r'".*"', String),
|
| 480 |
+
(r'\'.\'', String.Char),
|
| 481 |
+
(r'(><|->|-m->|/\\|<=|<<=|<\.|\|\||\|\^\||-~->|-~m->|\\/|>=|>>|'
|
| 482 |
+
r'\.>|\+\+|-\\|<->|=>|:-|~=|\*\*|<<|>>=|\+>|!!|\|=\||#)',
|
| 483 |
+
Operator),
|
| 484 |
+
(r'[0-9]+\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 485 |
+
(r'0x[0-9a-f]+', Number.Hex),
|
| 486 |
+
(r'[0-9]+', Number.Integer),
|
| 487 |
+
(r'\s+', Whitespace),
|
| 488 |
+
(r'.', Text),
|
| 489 |
+
],
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
def analyse_text(text):
|
| 493 |
+
"""
|
| 494 |
+
Check for the most common text in the beginning of a RSL file.
|
| 495 |
+
"""
|
| 496 |
+
if re.search(r'scheme\s*.*?=\s*class\s*type', text, re.I) is not None:
|
| 497 |
+
return 1.0
|
| 498 |
+
|
| 499 |
+
|
| 500 |
+
class MscgenLexer(RegexLexer):
|
| 501 |
+
"""
|
| 502 |
+
For Mscgen files.
|
| 503 |
+
"""
|
| 504 |
+
name = 'Mscgen'
|
| 505 |
+
url = 'http://www.mcternan.me.uk/mscgen/'
|
| 506 |
+
aliases = ['mscgen', 'msc']
|
| 507 |
+
filenames = ['*.msc']
|
| 508 |
+
version_added = '1.6'
|
| 509 |
+
|
| 510 |
+
_var = r'(\w+|"(?:\\"|[^"])*")'
|
| 511 |
+
|
| 512 |
+
tokens = {
|
| 513 |
+
'root': [
|
| 514 |
+
(r'msc\b', Keyword.Type),
|
| 515 |
+
# Options
|
| 516 |
+
(r'(hscale|HSCALE|width|WIDTH|wordwraparcs|WORDWRAPARCS'
|
| 517 |
+
r'|arcgradient|ARCGRADIENT)\b', Name.Property),
|
| 518 |
+
# Operators
|
| 519 |
+
(r'(abox|ABOX|rbox|RBOX|box|BOX|note|NOTE)\b', Operator.Word),
|
| 520 |
+
(r'(\.|-|\|){3}', Keyword),
|
| 521 |
+
(r'(?:-|=|\.|:){2}'
|
| 522 |
+
r'|<<=>>|<->|<=>|<<>>|<:>'
|
| 523 |
+
r'|->|=>>|>>|=>|:>|-x|-X'
|
| 524 |
+
r'|<-|<<=|<<|<=|<:|x-|X-|=', Operator),
|
| 525 |
+
# Names
|
| 526 |
+
(r'\*', Name.Builtin),
|
| 527 |
+
(_var, Name.Variable),
|
| 528 |
+
# Other
|
| 529 |
+
(r'\[', Punctuation, 'attrs'),
|
| 530 |
+
(r'\{|\}|,|;', Punctuation),
|
| 531 |
+
include('comments')
|
| 532 |
+
],
|
| 533 |
+
'attrs': [
|
| 534 |
+
(r'\]', Punctuation, '#pop'),
|
| 535 |
+
(_var + r'(\s*)(=)(\s*)' + _var,
|
| 536 |
+
bygroups(Name.Attribute, Whitespace, Operator, Whitespace,
|
| 537 |
+
String)),
|
| 538 |
+
(r',', Punctuation),
|
| 539 |
+
include('comments')
|
| 540 |
+
],
|
| 541 |
+
'comments': [
|
| 542 |
+
(r'(?://|#).*?\n', Comment.Single),
|
| 543 |
+
(r'/\*(?:.|\n)*?\*/', Comment.Multiline),
|
| 544 |
+
(r'[ \t\r\n]+', Whitespace)
|
| 545 |
+
]
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
class VGLLexer(RegexLexer):
|
| 550 |
+
"""
|
| 551 |
+
For SampleManager VGL source code.
|
| 552 |
+
"""
|
| 553 |
+
name = 'VGL'
|
| 554 |
+
url = 'http://www.thermoscientific.com/samplemanager'
|
| 555 |
+
aliases = ['vgl']
|
| 556 |
+
filenames = ['*.rpf']
|
| 557 |
+
version_added = '1.6'
|
| 558 |
+
|
| 559 |
+
flags = re.MULTILINE | re.DOTALL | re.IGNORECASE
|
| 560 |
+
|
| 561 |
+
tokens = {
|
| 562 |
+
'root': [
|
| 563 |
+
(r'\{[^}]*\}', Comment.Multiline),
|
| 564 |
+
(r'declare', Keyword.Constant),
|
| 565 |
+
(r'(if|then|else|endif|while|do|endwhile|and|or|prompt|object'
|
| 566 |
+
r'|create|on|line|with|global|routine|value|endroutine|constant'
|
| 567 |
+
r'|global|set|join|library|compile_option|file|exists|create|copy'
|
| 568 |
+
r'|delete|enable|windows|name|notprotected)(?! *[=<>.,()])',
|
| 569 |
+
Keyword),
|
| 570 |
+
(r'(true|false|null|empty|error|locked)', Keyword.Constant),
|
| 571 |
+
(r'[~^*#!%&\[\]()<>|+=:;,./?-]', Operator),
|
| 572 |
+
(r'"[^"]*"', String),
|
| 573 |
+
(r'(\.)([a-z_$][\w$]*)', bygroups(Operator, Name.Attribute)),
|
| 574 |
+
(r'[0-9][0-9]*(\.[0-9]+(e[+\-]?[0-9]+)?)?', Number),
|
| 575 |
+
(r'[a-z_$][\w$]*', Name),
|
| 576 |
+
(r'[\r\n]+', Whitespace),
|
| 577 |
+
(r'\s+', Whitespace)
|
| 578 |
+
]
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
|
| 582 |
+
class AlloyLexer(RegexLexer):
|
| 583 |
+
"""
|
| 584 |
+
For Alloy source code.
|
| 585 |
+
"""
|
| 586 |
+
|
| 587 |
+
name = 'Alloy'
|
| 588 |
+
url = 'http://alloy.mit.edu'
|
| 589 |
+
aliases = ['alloy']
|
| 590 |
+
filenames = ['*.als']
|
| 591 |
+
mimetypes = ['text/x-alloy']
|
| 592 |
+
version_added = '2.0'
|
| 593 |
+
|
| 594 |
+
flags = re.MULTILINE | re.DOTALL
|
| 595 |
+
|
| 596 |
+
iden_rex = r'[a-zA-Z_][\w]*"*'
|
| 597 |
+
string_rex = r'"\b(\\\\|\\[^\\]|[^"\\])*"'
|
| 598 |
+
text_tuple = (r'[^\S\n]+', Whitespace)
|
| 599 |
+
|
| 600 |
+
tokens = {
|
| 601 |
+
'sig': [
|
| 602 |
+
(r'(extends)\b', Keyword, '#pop'),
|
| 603 |
+
(iden_rex, Name),
|
| 604 |
+
text_tuple,
|
| 605 |
+
(r',', Punctuation),
|
| 606 |
+
(r'\{', Operator, '#pop'),
|
| 607 |
+
],
|
| 608 |
+
'module': [
|
| 609 |
+
text_tuple,
|
| 610 |
+
(iden_rex, Name, '#pop'),
|
| 611 |
+
],
|
| 612 |
+
'fun': [
|
| 613 |
+
text_tuple,
|
| 614 |
+
(r'\{', Operator, '#pop'),
|
| 615 |
+
(iden_rex, Name, '#pop'),
|
| 616 |
+
],
|
| 617 |
+
'fact': [
|
| 618 |
+
include('fun'),
|
| 619 |
+
(string_rex, String, '#pop'),
|
| 620 |
+
],
|
| 621 |
+
'root': [
|
| 622 |
+
(r'--.*?$', Comment.Single),
|
| 623 |
+
(r'//.*?$', Comment.Single),
|
| 624 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 625 |
+
text_tuple,
|
| 626 |
+
(r'(module|open)(\s+)', bygroups(Keyword.Namespace, Whitespace),
|
| 627 |
+
'module'),
|
| 628 |
+
(r'(sig|enum)(\s+)', bygroups(Keyword.Declaration, Whitespace), 'sig'),
|
| 629 |
+
(r'(iden|univ|none)\b', Keyword.Constant),
|
| 630 |
+
(r'(int|Int)\b', Keyword.Type),
|
| 631 |
+
(r'(var|this|abstract|extends|set|seq|one|lone|let)\b', Keyword),
|
| 632 |
+
(r'(all|some|no|sum|disj|when|else)\b', Keyword),
|
| 633 |
+
(r'(run|check|for|but|exactly|expect|as|steps)\b', Keyword),
|
| 634 |
+
(r'(always|after|eventually|until|release)\b', Keyword), # future time operators
|
| 635 |
+
(r'(historically|before|once|since|triggered)\b', Keyword), # past time operators
|
| 636 |
+
(r'(and|or|implies|iff|in)\b', Operator.Word),
|
| 637 |
+
(r'(fun|pred|assert)(\s+)', bygroups(Keyword, Whitespace), 'fun'),
|
| 638 |
+
(r'(fact)(\s+)', bygroups(Keyword, Whitespace), 'fact'),
|
| 639 |
+
(r'!|#|&&|\+\+|<<|>>|>=|<=>|<=|\.\.|\.|->', Operator),
|
| 640 |
+
(r'[-+/*%=<>&!^|~{}\[\]().\';]', Operator),
|
| 641 |
+
(iden_rex, Name),
|
| 642 |
+
(r'[:,]', Punctuation),
|
| 643 |
+
(r'[0-9]+', Number.Integer),
|
| 644 |
+
(string_rex, String),
|
| 645 |
+
(r'\n', Whitespace),
|
| 646 |
+
]
|
| 647 |
+
}
|
| 648 |
+
|
| 649 |
+
|
| 650 |
+
class PanLexer(RegexLexer):
|
| 651 |
+
"""
|
| 652 |
+
Lexer for pan source files.
|
| 653 |
+
|
| 654 |
+
Based on tcsh lexer.
|
| 655 |
+
"""
|
| 656 |
+
|
| 657 |
+
name = 'Pan'
|
| 658 |
+
url = 'https://github.com/quattor/pan/'
|
| 659 |
+
aliases = ['pan']
|
| 660 |
+
filenames = ['*.pan']
|
| 661 |
+
version_added = '2.0'
|
| 662 |
+
|
| 663 |
+
tokens = {
|
| 664 |
+
'root': [
|
| 665 |
+
include('basic'),
|
| 666 |
+
(r'\(', Keyword, 'paren'),
|
| 667 |
+
(r'\{', Keyword, 'curly'),
|
| 668 |
+
include('data'),
|
| 669 |
+
],
|
| 670 |
+
'basic': [
|
| 671 |
+
(words((
|
| 672 |
+
'if', 'for', 'with', 'else', 'type', 'bind', 'while', 'valid', 'final',
|
| 673 |
+
'prefix', 'unique', 'object', 'foreach', 'include', 'template',
|
| 674 |
+
'function', 'variable', 'structure', 'extensible', 'declaration'),
|
| 675 |
+
prefix=r'\b', suffix=r'\b'),
|
| 676 |
+
Keyword),
|
| 677 |
+
(words((
|
| 678 |
+
'file_contents', 'format', 'index', 'length', 'match', 'matches',
|
| 679 |
+
'replace', 'splice', 'split', 'substr', 'to_lowercase', 'to_uppercase',
|
| 680 |
+
'debug', 'error', 'traceback', 'deprecated', 'base64_decode',
|
| 681 |
+
'base64_encode', 'digest', 'escape', 'unescape', 'append', 'create',
|
| 682 |
+
'first', 'nlist', 'key', 'list', 'merge', 'next', 'prepend', 'is_boolean',
|
| 683 |
+
'is_defined', 'is_double', 'is_list', 'is_long', 'is_nlist', 'is_null',
|
| 684 |
+
'is_number', 'is_property', 'is_resource', 'is_string', 'to_boolean',
|
| 685 |
+
'to_double', 'to_long', 'to_string', 'clone', 'delete', 'exists',
|
| 686 |
+
'path_exists', 'if_exists', 'return', 'value'),
|
| 687 |
+
prefix=r'\b', suffix=r'\b'),
|
| 688 |
+
Name.Builtin),
|
| 689 |
+
(r'#.*', Comment),
|
| 690 |
+
(r'\\[\w\W]', String.Escape),
|
| 691 |
+
(r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Whitespace, Operator)),
|
| 692 |
+
(r'[\[\]{}()=]+', Operator),
|
| 693 |
+
(r'<<\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
|
| 694 |
+
(r';', Punctuation),
|
| 695 |
+
],
|
| 696 |
+
'data': [
|
| 697 |
+
(r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
|
| 698 |
+
(r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
|
| 699 |
+
(r'\s+', Whitespace),
|
| 700 |
+
(r'[^=\s\[\]{}()$"\'`\\;#]+', Text),
|
| 701 |
+
(r'\d+(?= |\Z)', Number),
|
| 702 |
+
],
|
| 703 |
+
'curly': [
|
| 704 |
+
(r'\}', Keyword, '#pop'),
|
| 705 |
+
(r':-', Keyword),
|
| 706 |
+
(r'\w+', Name.Variable),
|
| 707 |
+
(r'[^}:"\'`$]+', Punctuation),
|
| 708 |
+
(r':', Punctuation),
|
| 709 |
+
include('root'),
|
| 710 |
+
],
|
| 711 |
+
'paren': [
|
| 712 |
+
(r'\)', Keyword, '#pop'),
|
| 713 |
+
include('root'),
|
| 714 |
+
],
|
| 715 |
+
}
|
| 716 |
+
|
| 717 |
+
|
| 718 |
+
class CrmshLexer(RegexLexer):
|
| 719 |
+
"""
|
| 720 |
+
Lexer for crmsh configuration files for Pacemaker clusters.
|
| 721 |
+
"""
|
| 722 |
+
name = 'Crmsh'
|
| 723 |
+
url = 'http://crmsh.github.io/'
|
| 724 |
+
aliases = ['crmsh', 'pcmk']
|
| 725 |
+
filenames = ['*.crmsh', '*.pcmk']
|
| 726 |
+
mimetypes = []
|
| 727 |
+
version_added = '2.1'
|
| 728 |
+
|
| 729 |
+
elem = words((
|
| 730 |
+
'node', 'primitive', 'group', 'clone', 'ms', 'location',
|
| 731 |
+
'colocation', 'order', 'fencing_topology', 'rsc_ticket',
|
| 732 |
+
'rsc_template', 'property', 'rsc_defaults',
|
| 733 |
+
'op_defaults', 'acl_target', 'acl_group', 'user', 'role',
|
| 734 |
+
'tag'), suffix=r'(?![\w#$-])')
|
| 735 |
+
sub = words((
|
| 736 |
+
'params', 'meta', 'operations', 'op', 'rule',
|
| 737 |
+
'attributes', 'utilization'), suffix=r'(?![\w#$-])')
|
| 738 |
+
acl = words(('read', 'write', 'deny'), suffix=r'(?![\w#$-])')
|
| 739 |
+
bin_rel = words(('and', 'or'), suffix=r'(?![\w#$-])')
|
| 740 |
+
un_ops = words(('defined', 'not_defined'), suffix=r'(?![\w#$-])')
|
| 741 |
+
date_exp = words(('in_range', 'date', 'spec', 'in'), suffix=r'(?![\w#$-])')
|
| 742 |
+
acl_mod = (r'(?:tag|ref|reference|attribute|type|xpath)')
|
| 743 |
+
bin_ops = (r'(?:lt|gt|lte|gte|eq|ne)')
|
| 744 |
+
val_qual = (r'(?:string|version|number)')
|
| 745 |
+
rsc_role_action = (r'(?:Master|Started|Slave|Stopped|'
|
| 746 |
+
r'start|promote|demote|stop)')
|
| 747 |
+
|
| 748 |
+
tokens = {
|
| 749 |
+
'root': [
|
| 750 |
+
(r'^(#.*)(\n)?', bygroups(Comment, Whitespace)),
|
| 751 |
+
# attr=value (nvpair)
|
| 752 |
+
(r'([\w#$-]+)(=)("(?:""|[^"])*"|\S+)',
|
| 753 |
+
bygroups(Name.Attribute, Punctuation, String)),
|
| 754 |
+
# need this construct, otherwise numeric node ids
|
| 755 |
+
# are matched as scores
|
| 756 |
+
# elem id:
|
| 757 |
+
(r'(node)(\s+)([\w#$-]+)(:)',
|
| 758 |
+
bygroups(Keyword, Whitespace, Name, Punctuation)),
|
| 759 |
+
# scores
|
| 760 |
+
(r'([+-]?([0-9]+|inf)):', Number),
|
| 761 |
+
# keywords (elements and other)
|
| 762 |
+
(elem, Keyword),
|
| 763 |
+
(sub, Keyword),
|
| 764 |
+
(acl, Keyword),
|
| 765 |
+
# binary operators
|
| 766 |
+
(rf'(?:{val_qual}:)?({bin_ops})(?![\w#$-])', Operator.Word),
|
| 767 |
+
# other operators
|
| 768 |
+
(bin_rel, Operator.Word),
|
| 769 |
+
(un_ops, Operator.Word),
|
| 770 |
+
(date_exp, Operator.Word),
|
| 771 |
+
# builtin attributes (e.g. #uname)
|
| 772 |
+
(r'#[a-z]+(?![\w#$-])', Name.Builtin),
|
| 773 |
+
# acl_mod:blah
|
| 774 |
+
(rf'({acl_mod})(:)("(?:""|[^"])*"|\S+)',
|
| 775 |
+
bygroups(Keyword, Punctuation, Name)),
|
| 776 |
+
# rsc_id[:(role|action)]
|
| 777 |
+
# NB: this matches all other identifiers
|
| 778 |
+
(rf'([\w#$-]+)(?:(:)({rsc_role_action}))?(?![\w#$-])',
|
| 779 |
+
bygroups(Name, Punctuation, Operator.Word)),
|
| 780 |
+
# punctuation
|
| 781 |
+
(r'(\\(?=\n)|[\[\](){}/:@])', Punctuation),
|
| 782 |
+
(r'\s+|\n', Whitespace),
|
| 783 |
+
],
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
+
|
| 787 |
+
class FlatlineLexer(RegexLexer):
|
| 788 |
+
"""
|
| 789 |
+
Lexer for Flatline expressions.
|
| 790 |
+
"""
|
| 791 |
+
name = 'Flatline'
|
| 792 |
+
url = 'https://github.com/bigmlcom/flatline'
|
| 793 |
+
aliases = ['flatline']
|
| 794 |
+
filenames = []
|
| 795 |
+
mimetypes = ['text/x-flatline']
|
| 796 |
+
version_added = '2.2'
|
| 797 |
+
|
| 798 |
+
special_forms = ('let',)
|
| 799 |
+
|
| 800 |
+
builtins = (
|
| 801 |
+
"!=", "*", "+", "-", "<", "<=", "=", ">", ">=", "abs", "acos", "all",
|
| 802 |
+
"all-but", "all-with-defaults", "all-with-numeric-default", "and",
|
| 803 |
+
"asin", "atan", "avg", "avg-window", "bin-center", "bin-count", "call",
|
| 804 |
+
"category-count", "ceil", "cond", "cond-window", "cons", "cos", "cosh",
|
| 805 |
+
"count", "diff-window", "div", "ensure-value", "ensure-weighted-value",
|
| 806 |
+
"epoch", "epoch-day", "epoch-fields", "epoch-hour", "epoch-millisecond",
|
| 807 |
+
"epoch-minute", "epoch-month", "epoch-second", "epoch-weekday",
|
| 808 |
+
"epoch-year", "exp", "f", "field", "field-prop", "fields", "filter",
|
| 809 |
+
"first", "floor", "head", "if", "in", "integer", "language", "length",
|
| 810 |
+
"levenshtein", "linear-regression", "list", "ln", "log", "log10", "map",
|
| 811 |
+
"matches", "matches?", "max", "maximum", "md5", "mean", "median", "min",
|
| 812 |
+
"minimum", "missing", "missing-count", "missing?", "missing_count",
|
| 813 |
+
"mod", "mode", "normalize", "not", "nth", "occurrences", "or",
|
| 814 |
+
"percentile", "percentile-label", "population", "population-fraction",
|
| 815 |
+
"pow", "preferred", "preferred?", "quantile-label", "rand", "rand-int",
|
| 816 |
+
"random-value", "re-quote", "real", "replace", "replace-first", "rest",
|
| 817 |
+
"round", "row-number", "segment-label", "sha1", "sha256", "sin", "sinh",
|
| 818 |
+
"sqrt", "square", "standard-deviation", "standard_deviation", "str",
|
| 819 |
+
"subs", "sum", "sum-squares", "sum-window", "sum_squares", "summary",
|
| 820 |
+
"summary-no", "summary-str", "tail", "tan", "tanh", "to-degrees",
|
| 821 |
+
"to-radians", "variance", "vectorize", "weighted-random-value", "window",
|
| 822 |
+
"winnow", "within-percentiles?", "z-score",
|
| 823 |
+
)
|
| 824 |
+
|
| 825 |
+
valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+'
|
| 826 |
+
|
| 827 |
+
tokens = {
|
| 828 |
+
'root': [
|
| 829 |
+
# whitespaces - usually not relevant
|
| 830 |
+
(r'[,]+', Text),
|
| 831 |
+
(r'\s+', Whitespace),
|
| 832 |
+
|
| 833 |
+
# numbers
|
| 834 |
+
(r'-?\d+\.\d+', Number.Float),
|
| 835 |
+
(r'-?\d+', Number.Integer),
|
| 836 |
+
(r'0x-?[a-f\d]+', Number.Hex),
|
| 837 |
+
|
| 838 |
+
# strings, symbols and characters
|
| 839 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String),
|
| 840 |
+
(r"\\(.|[a-z]+)", String.Char),
|
| 841 |
+
|
| 842 |
+
# expression template placeholder
|
| 843 |
+
(r'_', String.Symbol),
|
| 844 |
+
|
| 845 |
+
# highlight the special forms
|
| 846 |
+
(words(special_forms, suffix=' '), Keyword),
|
| 847 |
+
|
| 848 |
+
# highlight the builtins
|
| 849 |
+
(words(builtins, suffix=' '), Name.Builtin),
|
| 850 |
+
|
| 851 |
+
# the remaining functions
|
| 852 |
+
(r'(?<=\()' + valid_name, Name.Function),
|
| 853 |
+
|
| 854 |
+
# find the remaining variables
|
| 855 |
+
(valid_name, Name.Variable),
|
| 856 |
+
|
| 857 |
+
# parentheses
|
| 858 |
+
(r'(\(|\))', Punctuation),
|
| 859 |
+
],
|
| 860 |
+
}
|
| 861 |
+
|
| 862 |
+
|
| 863 |
+
class SnowballLexer(ExtendedRegexLexer):
|
| 864 |
+
"""
|
| 865 |
+
Lexer for Snowball source code.
|
| 866 |
+
"""
|
| 867 |
+
|
| 868 |
+
name = 'Snowball'
|
| 869 |
+
url = 'https://snowballstem.org/'
|
| 870 |
+
aliases = ['snowball']
|
| 871 |
+
filenames = ['*.sbl']
|
| 872 |
+
version_added = '2.2'
|
| 873 |
+
|
| 874 |
+
_ws = r'\n\r\t '
|
| 875 |
+
|
| 876 |
+
def __init__(self, **options):
|
| 877 |
+
self._reset_stringescapes()
|
| 878 |
+
ExtendedRegexLexer.__init__(self, **options)
|
| 879 |
+
|
| 880 |
+
def _reset_stringescapes(self):
|
| 881 |
+
self._start = "'"
|
| 882 |
+
self._end = "'"
|
| 883 |
+
|
| 884 |
+
def _string(do_string_first):
|
| 885 |
+
def callback(lexer, match, ctx):
|
| 886 |
+
s = match.start()
|
| 887 |
+
text = match.group()
|
| 888 |
+
string = re.compile(rf'([^{re.escape(lexer._start)}]*)(.)').match
|
| 889 |
+
escape = re.compile(rf'([^{re.escape(lexer._end)}]*)(.)').match
|
| 890 |
+
pos = 0
|
| 891 |
+
do_string = do_string_first
|
| 892 |
+
while pos < len(text):
|
| 893 |
+
if do_string:
|
| 894 |
+
match = string(text, pos)
|
| 895 |
+
yield s + match.start(1), String.Single, match.group(1)
|
| 896 |
+
if match.group(2) == "'":
|
| 897 |
+
yield s + match.start(2), String.Single, match.group(2)
|
| 898 |
+
ctx.stack.pop()
|
| 899 |
+
break
|
| 900 |
+
yield s + match.start(2), String.Escape, match.group(2)
|
| 901 |
+
pos = match.end()
|
| 902 |
+
match = escape(text, pos)
|
| 903 |
+
yield s + match.start(), String.Escape, match.group()
|
| 904 |
+
if match.group(2) != lexer._end:
|
| 905 |
+
ctx.stack[-1] = 'escape'
|
| 906 |
+
break
|
| 907 |
+
pos = match.end()
|
| 908 |
+
do_string = True
|
| 909 |
+
ctx.pos = s + match.end()
|
| 910 |
+
return callback
|
| 911 |
+
|
| 912 |
+
def _stringescapes(lexer, match, ctx):
|
| 913 |
+
lexer._start = match.group(3)
|
| 914 |
+
lexer._end = match.group(5)
|
| 915 |
+
return bygroups(Keyword.Reserved, Whitespace, String.Escape, Whitespace,
|
| 916 |
+
String.Escape)(lexer, match, ctx)
|
| 917 |
+
|
| 918 |
+
tokens = {
|
| 919 |
+
'root': [
|
| 920 |
+
(r'len\b', Name.Builtin),
|
| 921 |
+
(r'lenof\b', Operator.Word),
|
| 922 |
+
include('root1'),
|
| 923 |
+
],
|
| 924 |
+
'root1': [
|
| 925 |
+
(rf'[{_ws}]+', Whitespace),
|
| 926 |
+
(r'\d+', Number.Integer),
|
| 927 |
+
(r"'", String.Single, 'string'),
|
| 928 |
+
(r'[()]', Punctuation),
|
| 929 |
+
(r'/\*[\w\W]*?\*/', Comment.Multiline),
|
| 930 |
+
(r'//.*', Comment.Single),
|
| 931 |
+
(r'[!*+\-/<=>]=|[-=]>|<[+-]|[$*+\-/<=>?\[\]]', Operator),
|
| 932 |
+
(words(('as', 'get', 'hex', 'among', 'define', 'decimal',
|
| 933 |
+
'backwardmode'), suffix=r'\b'),
|
| 934 |
+
Keyword.Reserved),
|
| 935 |
+
(words(('strings', 'booleans', 'integers', 'routines', 'externals',
|
| 936 |
+
'groupings'), suffix=r'\b'),
|
| 937 |
+
Keyword.Reserved, 'declaration'),
|
| 938 |
+
(words(('do', 'or', 'and', 'for', 'hop', 'non', 'not', 'set', 'try',
|
| 939 |
+
'fail', 'goto', 'loop', 'next', 'test', 'true',
|
| 940 |
+
'false', 'unset', 'atmark', 'attach', 'delete', 'gopast',
|
| 941 |
+
'insert', 'repeat', 'sizeof', 'tomark', 'atleast',
|
| 942 |
+
'atlimit', 'reverse', 'setmark', 'tolimit', 'setlimit',
|
| 943 |
+
'backwards', 'substring'), suffix=r'\b'),
|
| 944 |
+
Operator.Word),
|
| 945 |
+
(words(('size', 'limit', 'cursor', 'maxint', 'minint'),
|
| 946 |
+
suffix=r'\b'),
|
| 947 |
+
Name.Builtin),
|
| 948 |
+
(rf'(stringdef\b)([{_ws}]*)([^{_ws}]+)',
|
| 949 |
+
bygroups(Keyword.Reserved, Whitespace, String.Escape)),
|
| 950 |
+
(rf'(stringescapes\b)([{_ws}]*)(.)([{_ws}]*)(.)',
|
| 951 |
+
_stringescapes),
|
| 952 |
+
(r'[A-Za-z]\w*', Name),
|
| 953 |
+
],
|
| 954 |
+
'declaration': [
|
| 955 |
+
(r'\)', Punctuation, '#pop'),
|
| 956 |
+
(words(('len', 'lenof'), suffix=r'\b'), Name,
|
| 957 |
+
('root1', 'declaration')),
|
| 958 |
+
include('root1'),
|
| 959 |
+
],
|
| 960 |
+
'string': [
|
| 961 |
+
(r"[^']*'", _string(True)),
|
| 962 |
+
],
|
| 963 |
+
'escape': [
|
| 964 |
+
(r"[^']*'", _string(False)),
|
| 965 |
+
],
|
| 966 |
+
}
|
| 967 |
+
|
| 968 |
+
def get_tokens_unprocessed(self, text=None, context=None):
|
| 969 |
+
self._reset_stringescapes()
|
| 970 |
+
return ExtendedRegexLexer.get_tokens_unprocessed(self, text, context)
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/esoteric.py
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.esoteric
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for esoteric languages.
|
| 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, bygroups
|
| 12 |
+
from pygments.token import Comment, Operator, Keyword, Name, String, Number, \
|
| 13 |
+
Punctuation, Error, Whitespace
|
| 14 |
+
|
| 15 |
+
__all__ = ['BrainfuckLexer', 'BefungeLexer', 'RedcodeLexer', 'CAmkESLexer',
|
| 16 |
+
'CapDLLexer', 'AheuiLexer']
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class BrainfuckLexer(RegexLexer):
|
| 20 |
+
"""
|
| 21 |
+
Lexer for the esoteric BrainFuck language.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
name = 'Brainfuck'
|
| 25 |
+
url = 'http://www.muppetlabs.com/~breadbox/bf/'
|
| 26 |
+
aliases = ['brainfuck', 'bf']
|
| 27 |
+
filenames = ['*.bf', '*.b']
|
| 28 |
+
mimetypes = ['application/x-brainfuck']
|
| 29 |
+
version_added = ''
|
| 30 |
+
|
| 31 |
+
tokens = {
|
| 32 |
+
'common': [
|
| 33 |
+
# use different colors for different instruction types
|
| 34 |
+
(r'[.,]+', Name.Tag),
|
| 35 |
+
(r'[+-]+', Name.Builtin),
|
| 36 |
+
(r'[<>]+', Name.Variable),
|
| 37 |
+
(r'[^.,+\-<>\[\]]+', Comment),
|
| 38 |
+
],
|
| 39 |
+
'root': [
|
| 40 |
+
(r'\[', Keyword, 'loop'),
|
| 41 |
+
(r'\]', Error),
|
| 42 |
+
include('common'),
|
| 43 |
+
],
|
| 44 |
+
'loop': [
|
| 45 |
+
(r'\[', Keyword, '#push'),
|
| 46 |
+
(r'\]', Keyword, '#pop'),
|
| 47 |
+
include('common'),
|
| 48 |
+
]
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
def analyse_text(text):
|
| 52 |
+
"""It's safe to assume that a program which mostly consists of + -
|
| 53 |
+
and < > is brainfuck."""
|
| 54 |
+
plus_minus_count = 0
|
| 55 |
+
greater_less_count = 0
|
| 56 |
+
|
| 57 |
+
range_to_check = max(256, len(text))
|
| 58 |
+
|
| 59 |
+
for c in text[:range_to_check]:
|
| 60 |
+
if c == '+' or c == '-':
|
| 61 |
+
plus_minus_count += 1
|
| 62 |
+
if c == '<' or c == '>':
|
| 63 |
+
greater_less_count += 1
|
| 64 |
+
|
| 65 |
+
if plus_minus_count > (0.25 * range_to_check):
|
| 66 |
+
return 1.0
|
| 67 |
+
if greater_less_count > (0.25 * range_to_check):
|
| 68 |
+
return 1.0
|
| 69 |
+
|
| 70 |
+
result = 0
|
| 71 |
+
if '[-]' in text:
|
| 72 |
+
result += 0.5
|
| 73 |
+
|
| 74 |
+
return result
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class BefungeLexer(RegexLexer):
|
| 78 |
+
"""
|
| 79 |
+
Lexer for the esoteric Befunge language.
|
| 80 |
+
"""
|
| 81 |
+
name = 'Befunge'
|
| 82 |
+
url = 'http://en.wikipedia.org/wiki/Befunge'
|
| 83 |
+
aliases = ['befunge']
|
| 84 |
+
filenames = ['*.befunge']
|
| 85 |
+
mimetypes = ['application/x-befunge']
|
| 86 |
+
version_added = '0.7'
|
| 87 |
+
|
| 88 |
+
tokens = {
|
| 89 |
+
'root': [
|
| 90 |
+
(r'[0-9a-f]', Number),
|
| 91 |
+
(r'[+*/%!`-]', Operator), # Traditional math
|
| 92 |
+
(r'[<>^v?\[\]rxjk]', Name.Variable), # Move, imperatives
|
| 93 |
+
(r'[:\\$.,n]', Name.Builtin), # Stack ops, imperatives
|
| 94 |
+
(r'[|_mw]', Keyword),
|
| 95 |
+
(r'[{}]', Name.Tag), # Befunge-98 stack ops
|
| 96 |
+
(r'".*?"', String.Double), # Strings don't appear to allow escapes
|
| 97 |
+
(r'\'.', String.Single), # Single character
|
| 98 |
+
(r'[#;]', Comment), # Trampoline... depends on direction hit
|
| 99 |
+
(r'[pg&~=@iotsy]', Keyword), # Misc
|
| 100 |
+
(r'[()A-Z]', Comment), # Fingerprints
|
| 101 |
+
(r'\s+', Whitespace), # Whitespace doesn't matter
|
| 102 |
+
],
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
class CAmkESLexer(RegexLexer):
|
| 107 |
+
"""
|
| 108 |
+
Basic lexer for the input language for the CAmkES component platform.
|
| 109 |
+
"""
|
| 110 |
+
name = 'CAmkES'
|
| 111 |
+
url = 'https://sel4.systems/CAmkES/'
|
| 112 |
+
aliases = ['camkes', 'idl4']
|
| 113 |
+
filenames = ['*.camkes', '*.idl4']
|
| 114 |
+
version_added = '2.1'
|
| 115 |
+
|
| 116 |
+
tokens = {
|
| 117 |
+
'root': [
|
| 118 |
+
# C pre-processor directive
|
| 119 |
+
(r'^(\s*)(#.*)(\n)', bygroups(Whitespace, Comment.Preproc,
|
| 120 |
+
Whitespace)),
|
| 121 |
+
|
| 122 |
+
# Whitespace, comments
|
| 123 |
+
(r'\s+', Whitespace),
|
| 124 |
+
(r'/\*(.|\n)*?\*/', Comment),
|
| 125 |
+
(r'//.*$', Comment),
|
| 126 |
+
|
| 127 |
+
(r'[\[(){},.;\]]', Punctuation),
|
| 128 |
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
| 129 |
+
|
| 130 |
+
(words(('assembly', 'attribute', 'component', 'composition',
|
| 131 |
+
'configuration', 'connection', 'connector', 'consumes',
|
| 132 |
+
'control', 'dataport', 'Dataport', 'Dataports', 'emits',
|
| 133 |
+
'event', 'Event', 'Events', 'export', 'from', 'group',
|
| 134 |
+
'hardware', 'has', 'interface', 'Interface', 'maybe',
|
| 135 |
+
'procedure', 'Procedure', 'Procedures', 'provides',
|
| 136 |
+
'template', 'thread', 'threads', 'to', 'uses', 'with'),
|
| 137 |
+
suffix=r'\b'), Keyword),
|
| 138 |
+
|
| 139 |
+
(words(('bool', 'boolean', 'Buf', 'char', 'character', 'double',
|
| 140 |
+
'float', 'in', 'inout', 'int', 'int16_6', 'int32_t',
|
| 141 |
+
'int64_t', 'int8_t', 'integer', 'mutex', 'out', 'real',
|
| 142 |
+
'refin', 'semaphore', 'signed', 'string', 'struct',
|
| 143 |
+
'uint16_t', 'uint32_t', 'uint64_t', 'uint8_t', 'uintptr_t',
|
| 144 |
+
'unsigned', 'void'),
|
| 145 |
+
suffix=r'\b'), Keyword.Type),
|
| 146 |
+
|
| 147 |
+
# Recognised attributes
|
| 148 |
+
(r'[a-zA-Z_]\w*_(priority|domain|buffer)', Keyword.Reserved),
|
| 149 |
+
(words(('dma_pool', 'from_access', 'to_access'), suffix=r'\b'),
|
| 150 |
+
Keyword.Reserved),
|
| 151 |
+
|
| 152 |
+
# CAmkES-level include
|
| 153 |
+
(r'(import)(\s+)((?:<[^>]*>|"[^"]*");)',
|
| 154 |
+
bygroups(Comment.Preproc, Whitespace, Comment.Preproc)),
|
| 155 |
+
|
| 156 |
+
# C-level include
|
| 157 |
+
(r'(include)(\s+)((?:<[^>]*>|"[^"]*");)',
|
| 158 |
+
bygroups(Comment.Preproc, Whitespace, Comment.Preproc)),
|
| 159 |
+
|
| 160 |
+
# Literals
|
| 161 |
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
| 162 |
+
(r'-?[\d]+', Number),
|
| 163 |
+
(r'-?[\d]+\.[\d]+', Number.Float),
|
| 164 |
+
(r'"[^"]*"', String),
|
| 165 |
+
(r'[Tt]rue|[Ff]alse', Name.Builtin),
|
| 166 |
+
|
| 167 |
+
# Identifiers
|
| 168 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 169 |
+
],
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
class CapDLLexer(RegexLexer):
|
| 174 |
+
"""
|
| 175 |
+
Basic lexer for CapDL.
|
| 176 |
+
|
| 177 |
+
The source of the primary tool that reads such specifications is available
|
| 178 |
+
at https://github.com/seL4/capdl/tree/master/capDL-tool. Note that this
|
| 179 |
+
lexer only supports a subset of the grammar. For example, identifiers can
|
| 180 |
+
shadow type names, but these instances are currently incorrectly
|
| 181 |
+
highlighted as types. Supporting this would need a stateful lexer that is
|
| 182 |
+
considered unnecessarily complex for now.
|
| 183 |
+
"""
|
| 184 |
+
name = 'CapDL'
|
| 185 |
+
url = 'https://ssrg.nicta.com.au/publications/nictaabstracts/Kuz_KLW_10.abstract.pml'
|
| 186 |
+
aliases = ['capdl']
|
| 187 |
+
filenames = ['*.cdl']
|
| 188 |
+
version_added = '2.2'
|
| 189 |
+
|
| 190 |
+
tokens = {
|
| 191 |
+
'root': [
|
| 192 |
+
# C pre-processor directive
|
| 193 |
+
(r'^(\s*)(#.*)(\n)',
|
| 194 |
+
bygroups(Whitespace, Comment.Preproc, Whitespace)),
|
| 195 |
+
|
| 196 |
+
# Whitespace, comments
|
| 197 |
+
(r'\s+', Whitespace),
|
| 198 |
+
(r'/\*(.|\n)*?\*/', Comment),
|
| 199 |
+
(r'(//|--).*$', Comment),
|
| 200 |
+
|
| 201 |
+
(r'[<>\[(){},:;=\]]', Punctuation),
|
| 202 |
+
(r'\.\.', Punctuation),
|
| 203 |
+
|
| 204 |
+
(words(('arch', 'arm11', 'caps', 'child_of', 'ia32', 'irq', 'maps',
|
| 205 |
+
'objects'), suffix=r'\b'), Keyword),
|
| 206 |
+
|
| 207 |
+
(words(('aep', 'asid_pool', 'cnode', 'ep', 'frame', 'io_device',
|
| 208 |
+
'io_ports', 'io_pt', 'notification', 'pd', 'pt', 'tcb',
|
| 209 |
+
'ut', 'vcpu'), suffix=r'\b'), Keyword.Type),
|
| 210 |
+
|
| 211 |
+
# Properties
|
| 212 |
+
(words(('asid', 'addr', 'badge', 'cached', 'dom', 'domainID', 'elf',
|
| 213 |
+
'fault_ep', 'G', 'guard', 'guard_size', 'init', 'ip',
|
| 214 |
+
'prio', 'sp', 'R', 'RG', 'RX', 'RW', 'RWG', 'RWX', 'W',
|
| 215 |
+
'WG', 'WX', 'level', 'masked', 'master_reply', 'paddr',
|
| 216 |
+
'ports', 'reply', 'uncached'), suffix=r'\b'),
|
| 217 |
+
Keyword.Reserved),
|
| 218 |
+
|
| 219 |
+
# Literals
|
| 220 |
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
| 221 |
+
(r'\d+(\.\d+)?(k|M)?', Number),
|
| 222 |
+
(words(('bits',), suffix=r'\b'), Number),
|
| 223 |
+
(words(('cspace', 'vspace', 'reply_slot', 'caller_slot',
|
| 224 |
+
'ipc_buffer_slot'), suffix=r'\b'), Number),
|
| 225 |
+
|
| 226 |
+
# Identifiers
|
| 227 |
+
(r'[a-zA-Z_][-@\.\w]*', Name),
|
| 228 |
+
],
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
class RedcodeLexer(RegexLexer):
|
| 233 |
+
"""
|
| 234 |
+
A simple Redcode lexer based on ICWS'94.
|
| 235 |
+
Contributed by Adam Blinkinsop <blinks@acm.org>.
|
| 236 |
+
"""
|
| 237 |
+
name = 'Redcode'
|
| 238 |
+
aliases = ['redcode']
|
| 239 |
+
filenames = ['*.cw']
|
| 240 |
+
url = 'https://en.wikipedia.org/wiki/Core_War'
|
| 241 |
+
version_added = '0.8'
|
| 242 |
+
|
| 243 |
+
opcodes = ('DAT', 'MOV', 'ADD', 'SUB', 'MUL', 'DIV', 'MOD',
|
| 244 |
+
'JMP', 'JMZ', 'JMN', 'DJN', 'CMP', 'SLT', 'SPL',
|
| 245 |
+
'ORG', 'EQU', 'END')
|
| 246 |
+
modifiers = ('A', 'B', 'AB', 'BA', 'F', 'X', 'I')
|
| 247 |
+
|
| 248 |
+
tokens = {
|
| 249 |
+
'root': [
|
| 250 |
+
# Whitespace:
|
| 251 |
+
(r'\s+', Whitespace),
|
| 252 |
+
(r';.*$', Comment.Single),
|
| 253 |
+
# Lexemes:
|
| 254 |
+
# Identifiers
|
| 255 |
+
(r'\b({})\b'.format('|'.join(opcodes)), Name.Function),
|
| 256 |
+
(r'\b({})\b'.format('|'.join(modifiers)), Name.Decorator),
|
| 257 |
+
(r'[A-Za-z_]\w+', Name),
|
| 258 |
+
# Operators
|
| 259 |
+
(r'[-+*/%]', Operator),
|
| 260 |
+
(r'[#$@<>]', Operator), # mode
|
| 261 |
+
(r'[.,]', Punctuation), # mode
|
| 262 |
+
# Numbers
|
| 263 |
+
(r'[-+]?\d+', Number.Integer),
|
| 264 |
+
],
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
class AheuiLexer(RegexLexer):
|
| 269 |
+
"""
|
| 270 |
+
Aheui is esoteric language based on Korean alphabets.
|
| 271 |
+
"""
|
| 272 |
+
|
| 273 |
+
name = 'Aheui'
|
| 274 |
+
url = 'http://aheui.github.io/'
|
| 275 |
+
aliases = ['aheui']
|
| 276 |
+
filenames = ['*.aheui']
|
| 277 |
+
version_added = ''
|
| 278 |
+
|
| 279 |
+
tokens = {
|
| 280 |
+
'root': [
|
| 281 |
+
('['
|
| 282 |
+
'나-낳냐-냫너-넣녀-녛노-놓뇨-눟뉴-닇'
|
| 283 |
+
'다-닿댜-댷더-덯뎌-뎧도-돟됴-둫듀-딓'
|
| 284 |
+
'따-땋땨-떃떠-떻뗘-뗳또-똫뚀-뚷뜌-띟'
|
| 285 |
+
'라-랗랴-럏러-렇려-렿로-롷료-뤃류-릫'
|
| 286 |
+
'마-맣먀-먛머-멓며-몋모-뫃묘-뭏뮤-믷'
|
| 287 |
+
'바-밯뱌-뱧버-벟벼-볗보-봏뵤-붛뷰-빃'
|
| 288 |
+
'빠-빻뺘-뺳뻐-뻫뼈-뼣뽀-뽛뾰-뿧쀼-삏'
|
| 289 |
+
'사-샇샤-샿서-섷셔-셯소-솧쇼-숳슈-싛'
|
| 290 |
+
'싸-쌓쌰-썋써-쎃쎠-쎻쏘-쏳쑈-쑿쓔-씧'
|
| 291 |
+
'자-잫쟈-쟣저-젛져-졓조-좋죠-줗쥬-즿'
|
| 292 |
+
'차-챃챠-챻처-첳쳐-쳫초-촣쵸-춯츄-칗'
|
| 293 |
+
'카-캏캬-컇커-컿켜-켷코-콯쿄-쿻큐-킣'
|
| 294 |
+
'타-탛탸-턓터-텋텨-톃토-톻툐-퉇튜-틯'
|
| 295 |
+
'파-팧퍄-퍟퍼-펗펴-폏포-퐇표-풓퓨-픻'
|
| 296 |
+
'하-핳햐-햫허-헣혀-혛호-홓효-훟휴-힇'
|
| 297 |
+
']', Operator),
|
| 298 |
+
('.', Comment),
|
| 299 |
+
],
|
| 300 |
+
}
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/fortran.py
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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lexers for Fortran 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, bygroups, include, words, using, default
|
| 14 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 15 |
+
Number, Punctuation, Generic
|
| 16 |
+
|
| 17 |
+
__all__ = ['FortranLexer', 'FortranFixedLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class FortranLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
Lexer for FORTRAN 90 code.
|
| 23 |
+
"""
|
| 24 |
+
name = 'Fortran'
|
| 25 |
+
url = 'https://fortran-lang.org/'
|
| 26 |
+
aliases = ['fortran', 'f90']
|
| 27 |
+
filenames = ['*.f03', '*.f90', '*.F03', '*.F90']
|
| 28 |
+
mimetypes = ['text/x-fortran']
|
| 29 |
+
version_added = '0.10'
|
| 30 |
+
flags = re.IGNORECASE | re.MULTILINE
|
| 31 |
+
|
| 32 |
+
# Data Types: INTEGER, REAL, COMPLEX, LOGICAL, CHARACTER and DOUBLE PRECISION
|
| 33 |
+
# Operators: **, *, +, -, /, <, >, <=, >=, ==, /=
|
| 34 |
+
# Logical (?): NOT, AND, OR, EQV, NEQV
|
| 35 |
+
|
| 36 |
+
# Builtins:
|
| 37 |
+
# http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/Table-of-Intrinsic-Functions.html
|
| 38 |
+
|
| 39 |
+
tokens = {
|
| 40 |
+
'root': [
|
| 41 |
+
(r'^#.*\n', Comment.Preproc),
|
| 42 |
+
(r'!.*\n', Comment),
|
| 43 |
+
include('strings'),
|
| 44 |
+
include('core'),
|
| 45 |
+
(r'[a-z][\w$]*', Name),
|
| 46 |
+
include('nums'),
|
| 47 |
+
(r'[\s]+', Text.Whitespace),
|
| 48 |
+
],
|
| 49 |
+
'core': [
|
| 50 |
+
# Statements
|
| 51 |
+
|
| 52 |
+
(r'\b(DO)(\s+)(CONCURRENT)\b', bygroups(Keyword, Text.Whitespace, Keyword)),
|
| 53 |
+
(r'\b(GO)(\s*)(TO)\b', bygroups(Keyword, Text.Whitespace, Keyword)),
|
| 54 |
+
|
| 55 |
+
(words((
|
| 56 |
+
'ABSTRACT', 'ACCEPT', 'ALL', 'ALLSTOP', 'ALLOCATABLE', 'ALLOCATE',
|
| 57 |
+
'ARRAY', 'ASSIGN', 'ASSOCIATE', 'ASYNCHRONOUS', 'BACKSPACE', 'BIND',
|
| 58 |
+
'BLOCK', 'BLOCKDATA', 'BYTE', 'CALL', 'CASE', 'CLASS', 'CLOSE',
|
| 59 |
+
'CODIMENSION', 'COMMON', 'CONTIGUOUS', 'CONTAINS',
|
| 60 |
+
'CONTINUE', 'CRITICAL', 'CYCLE', 'DATA', 'DEALLOCATE', 'DECODE',
|
| 61 |
+
'DEFERRED', 'DIMENSION', 'DO', 'ELEMENTAL', 'ELSE', 'ELSEIF', 'ENCODE',
|
| 62 |
+
'END', 'ENDASSOCIATE', 'ENDBLOCK', 'ENDDO', 'ENDENUM', 'ENDFORALL',
|
| 63 |
+
'ENDFUNCTION', 'ENDIF', 'ENDINTERFACE', 'ENDMODULE', 'ENDPROGRAM',
|
| 64 |
+
'ENDSELECT', 'ENDSUBMODULE', 'ENDSUBROUTINE', 'ENDTYPE', 'ENDWHERE',
|
| 65 |
+
'ENTRY', 'ENUM', 'ENUMERATOR', 'EQUIVALENCE', 'ERROR STOP', 'EXIT',
|
| 66 |
+
'EXTENDS', 'EXTERNAL', 'EXTRINSIC', 'FILE', 'FINAL', 'FORALL', 'FORMAT',
|
| 67 |
+
'FUNCTION', 'GENERIC', 'IF', 'IMAGES', 'IMPLICIT',
|
| 68 |
+
'IMPORT', 'IMPURE', 'INCLUDE', 'INQUIRE', 'INTENT', 'INTERFACE',
|
| 69 |
+
'INTRINSIC', 'IS', 'LOCK', 'MEMORY', 'MODULE', 'NAMELIST', 'NULLIFY',
|
| 70 |
+
'NONE', 'NON_INTRINSIC', 'NON_OVERRIDABLE', 'NOPASS', 'ONLY', 'OPEN',
|
| 71 |
+
'OPTIONAL', 'OPTIONS', 'PARAMETER', 'PASS', 'PAUSE', 'POINTER', 'PRINT',
|
| 72 |
+
'PRIVATE', 'PROGRAM', 'PROCEDURE', 'PROTECTED', 'PUBLIC', 'PURE', 'READ',
|
| 73 |
+
'RECURSIVE', 'RESULT', 'RETURN', 'REWIND', 'SAVE', 'SELECT', 'SEQUENCE',
|
| 74 |
+
'STOP', 'SUBMODULE', 'SUBROUTINE', 'SYNC', 'SYNCALL', 'SYNCIMAGES',
|
| 75 |
+
'SYNCMEMORY', 'TARGET', 'THEN', 'TYPE', 'UNLOCK', 'USE', 'VALUE',
|
| 76 |
+
'VOLATILE', 'WHERE', 'WRITE', 'WHILE'), prefix=r'\b', suffix=r'\s*\b'),
|
| 77 |
+
Keyword),
|
| 78 |
+
|
| 79 |
+
# Data Types
|
| 80 |
+
(words((
|
| 81 |
+
'CHARACTER', 'COMPLEX', 'DOUBLE PRECISION', 'DOUBLE COMPLEX', 'INTEGER',
|
| 82 |
+
'LOGICAL', 'REAL', 'C_INT', 'C_SHORT', 'C_LONG', 'C_LONG_LONG',
|
| 83 |
+
'C_SIGNED_CHAR', 'C_SIZE_T', 'C_INT8_T', 'C_INT16_T', 'C_INT32_T',
|
| 84 |
+
'C_INT64_T', 'C_INT_LEAST8_T', 'C_INT_LEAST16_T', 'C_INT_LEAST32_T',
|
| 85 |
+
'C_INT_LEAST64_T', 'C_INT_FAST8_T', 'C_INT_FAST16_T', 'C_INT_FAST32_T',
|
| 86 |
+
'C_INT_FAST64_T', 'C_INTMAX_T', 'C_INTPTR_T', 'C_FLOAT', 'C_DOUBLE',
|
| 87 |
+
'C_LONG_DOUBLE', 'C_FLOAT_COMPLEX', 'C_DOUBLE_COMPLEX',
|
| 88 |
+
'C_LONG_DOUBLE_COMPLEX', 'C_BOOL', 'C_CHAR', 'C_PTR', 'C_FUNPTR'),
|
| 89 |
+
prefix=r'\b', suffix=r'\s*\b'),
|
| 90 |
+
Keyword.Type),
|
| 91 |
+
|
| 92 |
+
# Operators
|
| 93 |
+
(r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)', Operator),
|
| 94 |
+
|
| 95 |
+
(r'(::)', Keyword.Declaration),
|
| 96 |
+
|
| 97 |
+
(r'[()\[\],:&%;.]', Punctuation),
|
| 98 |
+
# Intrinsics
|
| 99 |
+
(words((
|
| 100 |
+
'Abort', 'Abs', 'Access', 'AChar', 'ACos', 'ACosH', 'AdjustL',
|
| 101 |
+
'AdjustR', 'AImag', 'AInt', 'Alarm', 'All', 'Allocated', 'ALog',
|
| 102 |
+
'AMax', 'AMin', 'AMod', 'And', 'ANInt', 'Any', 'ASin', 'ASinH',
|
| 103 |
+
'Associated', 'ATan', 'ATanH', 'Atomic_Define', 'Atomic_Ref',
|
| 104 |
+
'BesJ', 'BesJN', 'Bessel_J0', 'Bessel_J1', 'Bessel_JN', 'Bessel_Y0',
|
| 105 |
+
'Bessel_Y1', 'Bessel_YN', 'BesY', 'BesYN', 'BGE', 'BGT', 'BLE',
|
| 106 |
+
'BLT', 'Bit_Size', 'BTest', 'CAbs', 'CCos', 'Ceiling', 'CExp',
|
| 107 |
+
'Char', 'ChDir', 'ChMod', 'CLog', 'Cmplx', 'Command_Argument_Count',
|
| 108 |
+
'Complex', 'Conjg', 'Cos', 'CosH', 'Count', 'CPU_Time', 'CShift',
|
| 109 |
+
'CSin', 'CSqRt', 'CTime', 'C_Loc', 'C_Associated',
|
| 110 |
+
'C_Null_Ptr', 'C_Null_Funptr', 'C_F_Pointer', 'C_F_ProcPointer',
|
| 111 |
+
'C_Null_Char', 'C_Alert', 'C_Backspace', 'C_Form_Feed', 'C_FunLoc',
|
| 112 |
+
'C_Sizeof', 'C_New_Line', 'C_Carriage_Return',
|
| 113 |
+
'C_Horizontal_Tab', 'C_Vertical_Tab', 'DAbs', 'DACos', 'DASin',
|
| 114 |
+
'DATan', 'Date_and_Time', 'DbesJ', 'DbesJN', 'DbesY',
|
| 115 |
+
'DbesYN', 'Dble', 'DCos', 'DCosH', 'DDiM', 'DErF',
|
| 116 |
+
'DErFC', 'DExp', 'Digits', 'DiM', 'DInt', 'DLog', 'DMax',
|
| 117 |
+
'DMin', 'DMod', 'DNInt', 'Dot_Product', 'DProd', 'DSign', 'DSinH',
|
| 118 |
+
'DShiftL', 'DShiftR', 'DSin', 'DSqRt', 'DTanH', 'DTan', 'DTime',
|
| 119 |
+
'EOShift', 'Epsilon', 'ErF', 'ErFC', 'ErFC_Scaled', 'ETime',
|
| 120 |
+
'Execute_Command_Line', 'Exit', 'Exp', 'Exponent', 'Extends_Type_Of',
|
| 121 |
+
'FDate', 'FGet', 'FGetC', 'FindLoc', 'Float', 'Floor', 'Flush',
|
| 122 |
+
'FNum', 'FPutC', 'FPut', 'Fraction', 'FSeek', 'FStat', 'FTell',
|
| 123 |
+
'Gamma', 'GError', 'GetArg', 'Get_Command', 'Get_Command_Argument',
|
| 124 |
+
'Get_Environment_Variable', 'GetCWD', 'GetEnv', 'GetGId', 'GetLog',
|
| 125 |
+
'GetPId', 'GetUId', 'GMTime', 'HostNm', 'Huge', 'Hypot', 'IAbs',
|
| 126 |
+
'IAChar', 'IAll', 'IAnd', 'IAny', 'IArgC', 'IBClr', 'IBits',
|
| 127 |
+
'IBSet', 'IChar', 'IDate', 'IDiM', 'IDInt', 'IDNInt', 'IEOr',
|
| 128 |
+
'IErrNo', 'IFix', 'Imag', 'ImagPart', 'Image_Index', 'Index',
|
| 129 |
+
'Int', 'IOr', 'IParity', 'IRand', 'IsaTty', 'IShft', 'IShftC',
|
| 130 |
+
'ISign', 'Iso_C_Binding', 'Is_Contiguous', 'Is_Iostat_End',
|
| 131 |
+
'Is_Iostat_Eor', 'ITime', 'Kill', 'Kind', 'LBound', 'LCoBound',
|
| 132 |
+
'Len', 'Len_Trim', 'LGe', 'LGt', 'Link', 'LLe', 'LLt', 'LnBlnk',
|
| 133 |
+
'Loc', 'Log', 'Log_Gamma', 'Logical', 'Long', 'LShift', 'LStat',
|
| 134 |
+
'LTime', 'MaskL', 'MaskR', 'MatMul', 'Max', 'MaxExponent',
|
| 135 |
+
'MaxLoc', 'MaxVal', 'MClock', 'Merge', 'Merge_Bits', 'Move_Alloc',
|
| 136 |
+
'Min', 'MinExponent', 'MinLoc', 'MinVal', 'Mod', 'Modulo', 'MvBits',
|
| 137 |
+
'Nearest', 'New_Line', 'NInt', 'Norm2', 'Not', 'Null', 'Num_Images',
|
| 138 |
+
'Or', 'Pack', 'Parity', 'PError', 'Precision', 'Present', 'Product',
|
| 139 |
+
'Radix', 'Rand', 'Random_Number', 'Random_Seed', 'Range', 'Real',
|
| 140 |
+
'RealPart', 'Rename', 'Repeat', 'Reshape', 'RRSpacing', 'RShift',
|
| 141 |
+
'Same_Type_As', 'Scale', 'Scan', 'Second', 'Selected_Char_Kind',
|
| 142 |
+
'Selected_Int_Kind', 'Selected_Real_Kind', 'Set_Exponent', 'Shape',
|
| 143 |
+
'ShiftA', 'ShiftL', 'ShiftR', 'Short', 'Sign', 'Signal', 'SinH',
|
| 144 |
+
'Sin', 'Sleep', 'Sngl', 'Spacing', 'Spread', 'SqRt', 'SRand',
|
| 145 |
+
'Stat', 'Storage_Size', 'Sum', 'SymLnk', 'System', 'System_Clock',
|
| 146 |
+
'Tan', 'TanH', 'Time', 'This_Image', 'Tiny', 'TrailZ', 'Transfer',
|
| 147 |
+
'Transpose', 'Trim', 'TtyNam', 'UBound', 'UCoBound', 'UMask',
|
| 148 |
+
'Unlink', 'Unpack', 'Verify', 'XOr', 'ZAbs', 'ZCos', 'ZExp',
|
| 149 |
+
'ZLog', 'ZSin', 'ZSqRt'), prefix=r'\b', suffix=r'\s*\b'),
|
| 150 |
+
Name.Builtin),
|
| 151 |
+
|
| 152 |
+
# Booleans
|
| 153 |
+
(r'\.(true|false)\.', Name.Builtin),
|
| 154 |
+
# Comparing Operators
|
| 155 |
+
(r'\.(eq|ne|lt|le|gt|ge|not|and|or|eqv|neqv)\.', Operator.Word),
|
| 156 |
+
],
|
| 157 |
+
|
| 158 |
+
'strings': [
|
| 159 |
+
(r'"(\\[0-7]+|\\[^0-7]|[^"\\])*"', String.Double),
|
| 160 |
+
(r"'(\\[0-7]+|\\[^0-7]|[^'\\])*'", String.Single),
|
| 161 |
+
],
|
| 162 |
+
|
| 163 |
+
'nums': [
|
| 164 |
+
(r'\d+(?![.e])(_([1-9]|[a-z]\w*))?', Number.Integer),
|
| 165 |
+
(r'[+-]?\d*\.\d+([ed][-+]?\d+)?(_([1-9]|[a-z]\w*))?', Number.Float),
|
| 166 |
+
(r'[+-]?\d+\.\d*([ed][-+]?\d+)?(_([1-9]|[a-z]\w*))?', Number.Float),
|
| 167 |
+
(r'[+-]?\d+(\.\d*)?[ed][-+]?\d+(_([1-9]|[a-z]\w*))?', Number.Float),
|
| 168 |
+
],
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
class FortranFixedLexer(RegexLexer):
|
| 173 |
+
"""
|
| 174 |
+
Lexer for fixed format Fortran.
|
| 175 |
+
"""
|
| 176 |
+
name = 'FortranFixed'
|
| 177 |
+
aliases = ['fortranfixed']
|
| 178 |
+
filenames = ['*.f', '*.F']
|
| 179 |
+
url = 'https://fortran-lang.org/'
|
| 180 |
+
version_added = '2.1'
|
| 181 |
+
|
| 182 |
+
flags = re.IGNORECASE
|
| 183 |
+
|
| 184 |
+
def _lex_fortran(self, match, ctx=None):
|
| 185 |
+
"""Lex a line just as free form fortran without line break."""
|
| 186 |
+
lexer = FortranLexer()
|
| 187 |
+
text = match.group(0) + "\n"
|
| 188 |
+
for index, token, value in lexer.get_tokens_unprocessed(text):
|
| 189 |
+
value = value.replace('\n', '')
|
| 190 |
+
if value != '':
|
| 191 |
+
yield index, token, value
|
| 192 |
+
|
| 193 |
+
tokens = {
|
| 194 |
+
'root': [
|
| 195 |
+
(r'[C*].*\n', Comment),
|
| 196 |
+
(r'#.*\n', Comment.Preproc),
|
| 197 |
+
(r' {0,4}!.*\n', Comment),
|
| 198 |
+
(r'(.{5})', Name.Label, 'cont-char'),
|
| 199 |
+
(r'.*\n', using(FortranLexer)),
|
| 200 |
+
],
|
| 201 |
+
'cont-char': [
|
| 202 |
+
(' ', Text, 'code'),
|
| 203 |
+
('0', Comment, 'code'),
|
| 204 |
+
('.', Generic.Strong, 'code'),
|
| 205 |
+
],
|
| 206 |
+
'code': [
|
| 207 |
+
(r'(.{66})(.*)(\n)',
|
| 208 |
+
bygroups(_lex_fortran, Comment, Text.Whitespace), 'root'),
|
| 209 |
+
(r'(.*)(\n)', bygroups(_lex_fortran, Text.Whitespace), 'root'),
|
| 210 |
+
default('root'),
|
| 211 |
+
]
|
| 212 |
+
}
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/gleam.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.gleam
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for the Gleam 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, bygroups
|
| 12 |
+
from pygments.token import Comment, Operator, Keyword, Name, String, \
|
| 13 |
+
Number, Punctuation, Whitespace
|
| 14 |
+
|
| 15 |
+
__all__ = ['GleamLexer']
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class GleamLexer(RegexLexer):
|
| 19 |
+
"""
|
| 20 |
+
Lexer for the Gleam programming language (version 1.0.0).
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
name = 'Gleam'
|
| 24 |
+
url = 'https://gleam.run/'
|
| 25 |
+
filenames = ['*.gleam']
|
| 26 |
+
aliases = ['gleam']
|
| 27 |
+
mimetypes = ['text/x-gleam']
|
| 28 |
+
version_added = '2.19'
|
| 29 |
+
|
| 30 |
+
keywords = words((
|
| 31 |
+
'as', 'assert', 'auto', 'case', 'const', 'delegate', 'derive', 'echo',
|
| 32 |
+
'else', 'fn', 'if', 'implement', 'import', 'let', 'macro', 'opaque',
|
| 33 |
+
'panic', 'pub', 'test', 'todo', 'type', 'use',
|
| 34 |
+
), suffix=r'\b')
|
| 35 |
+
|
| 36 |
+
tokens = {
|
| 37 |
+
'root': [
|
| 38 |
+
# Comments
|
| 39 |
+
(r'(///.*?)(\n)', bygroups(String.Doc, Whitespace)),
|
| 40 |
+
(r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
|
| 41 |
+
|
| 42 |
+
# Keywords
|
| 43 |
+
(keywords, Keyword),
|
| 44 |
+
(r'([a-zA-Z_]+)(\.)', bygroups(Keyword, Punctuation)),
|
| 45 |
+
|
| 46 |
+
# Punctuation
|
| 47 |
+
(r'[()\[\]{}:;,@]+', Punctuation),
|
| 48 |
+
(r'(#|!=|!|==|\|>|\|\||\||\->|<\-|&&|<<|>>|\.\.|\.|=)', Punctuation),
|
| 49 |
+
|
| 50 |
+
# Operators
|
| 51 |
+
(r'(<>|\+\.?|\-\.?|\*\.?|/\.?|%\.?|<=\.?|>=\.?|<\.?|>\.?|=)', Operator),
|
| 52 |
+
|
| 53 |
+
# Strings
|
| 54 |
+
(r'"(\\"|[^"])*"', String),
|
| 55 |
+
|
| 56 |
+
# Identifiers
|
| 57 |
+
(r'\b(let)(\s+)(\w+)', bygroups(Keyword, Whitespace, Name.Variable)),
|
| 58 |
+
(r'\b(fn)(\s+)(\w+)', bygroups(Keyword, Whitespace, Name.Function)),
|
| 59 |
+
(r'[a-zA-Z_/]\w*', Name),
|
| 60 |
+
|
| 61 |
+
# numbers
|
| 62 |
+
(r'(\d+(_\d+)*\.(?!\.)(\d+(_\d+)*)?|\.\d+(_\d+)*)([eEf][+-]?[0-9]+)?', Number.Float),
|
| 63 |
+
(r'\d+(_\d+)*[eEf][+-]?[0-9]+', Number.Float),
|
| 64 |
+
(r'0[xX][a-fA-F0-9]+(_[a-fA-F0-9]+)*(\.([a-fA-F0-9]+(_[a-fA-F0-9]+)*)?)?p[+-]?\d+', Number.Float),
|
| 65 |
+
(r'0[bB][01]+(_[01]+)*', Number.Bin),
|
| 66 |
+
(r'0[oO][0-7]+(_[0-7]+)*', Number.Oct),
|
| 67 |
+
(r'0[xX][a-fA-F0-9]+(_[a-fA-F0-9]+)*', Number.Hex),
|
| 68 |
+
(r'\d+(_\d+)*', Number.Integer),
|
| 69 |
+
|
| 70 |
+
# Whitespace
|
| 71 |
+
(r'\s+', Whitespace),
|
| 72 |
+
|
| 73 |
+
],
|
| 74 |
+
}
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/haxe.py
ADDED
|
@@ -0,0 +1,941 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.haxe
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for Haxe and related stuff.
|
| 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 ExtendedRegexLexer, RegexLexer, include, bygroups, \
|
| 14 |
+
default
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Generic, Whitespace
|
| 17 |
+
|
| 18 |
+
__all__ = ['HaxeLexer', 'HxmlLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class HaxeLexer(ExtendedRegexLexer):
|
| 22 |
+
"""
|
| 23 |
+
For Haxe source code.
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
name = 'Haxe'
|
| 27 |
+
url = 'http://haxe.org/'
|
| 28 |
+
aliases = ['haxe', 'hxsl', 'hx']
|
| 29 |
+
filenames = ['*.hx', '*.hxsl']
|
| 30 |
+
mimetypes = ['text/haxe', 'text/x-haxe', 'text/x-hx']
|
| 31 |
+
version_added = '1.3'
|
| 32 |
+
|
| 33 |
+
# keywords extracted from lexer.mll in the haxe compiler source
|
| 34 |
+
keyword = (r'(?:function|class|static|var|if|else|while|do|for|'
|
| 35 |
+
r'break|return|continue|extends|implements|import|'
|
| 36 |
+
r'switch|case|default|public|private|try|untyped|'
|
| 37 |
+
r'catch|new|this|throw|extern|enum|in|interface|'
|
| 38 |
+
r'cast|override|dynamic|typedef|package|'
|
| 39 |
+
r'inline|using|null|true|false|abstract)\b')
|
| 40 |
+
|
| 41 |
+
# idtype in lexer.mll
|
| 42 |
+
typeid = r'_*[A-Z]\w*'
|
| 43 |
+
|
| 44 |
+
# combined ident and dollar and idtype
|
| 45 |
+
ident = r'(?:_*[a-z]\w*|_+[0-9]\w*|' + typeid + r'|_+|\$\w+)'
|
| 46 |
+
|
| 47 |
+
binop = (r'(?:%=|&=|\|=|\^=|\+=|\-=|\*=|/=|<<=|>\s*>\s*=|>\s*>\s*>\s*=|==|'
|
| 48 |
+
r'!=|<=|>\s*=|&&|\|\||<<|>>>|>\s*>|\.\.\.|<|>|%|&|\||\^|\+|\*|'
|
| 49 |
+
r'/|\-|=>|=)')
|
| 50 |
+
|
| 51 |
+
# ident except keywords
|
| 52 |
+
ident_no_keyword = r'(?!' + keyword + ')' + ident
|
| 53 |
+
|
| 54 |
+
flags = re.DOTALL | re.MULTILINE
|
| 55 |
+
|
| 56 |
+
preproc_stack = []
|
| 57 |
+
|
| 58 |
+
def preproc_callback(self, match, ctx):
|
| 59 |
+
proc = match.group(2)
|
| 60 |
+
|
| 61 |
+
if proc == 'if':
|
| 62 |
+
# store the current stack
|
| 63 |
+
self.preproc_stack.append(ctx.stack[:])
|
| 64 |
+
elif proc in ['else', 'elseif']:
|
| 65 |
+
# restore the stack back to right before #if
|
| 66 |
+
if self.preproc_stack:
|
| 67 |
+
ctx.stack = self.preproc_stack[-1][:]
|
| 68 |
+
elif proc == 'end':
|
| 69 |
+
# remove the saved stack of previous #if
|
| 70 |
+
if self.preproc_stack:
|
| 71 |
+
self.preproc_stack.pop()
|
| 72 |
+
|
| 73 |
+
# #if and #elseif should follow by an expr
|
| 74 |
+
if proc in ['if', 'elseif']:
|
| 75 |
+
ctx.stack.append('preproc-expr')
|
| 76 |
+
|
| 77 |
+
# #error can be optionally follow by the error msg
|
| 78 |
+
if proc in ['error']:
|
| 79 |
+
ctx.stack.append('preproc-error')
|
| 80 |
+
|
| 81 |
+
yield match.start(), Comment.Preproc, '#' + proc
|
| 82 |
+
ctx.pos = match.end()
|
| 83 |
+
|
| 84 |
+
tokens = {
|
| 85 |
+
'root': [
|
| 86 |
+
include('spaces'),
|
| 87 |
+
include('meta'),
|
| 88 |
+
(r'(?:package)\b', Keyword.Namespace, ('semicolon', 'package')),
|
| 89 |
+
(r'(?:import)\b', Keyword.Namespace, ('semicolon', 'import')),
|
| 90 |
+
(r'(?:using)\b', Keyword.Namespace, ('semicolon', 'using')),
|
| 91 |
+
(r'(?:extern|private)\b', Keyword.Declaration),
|
| 92 |
+
(r'(?:abstract)\b', Keyword.Declaration, 'abstract'),
|
| 93 |
+
(r'(?:class|interface)\b', Keyword.Declaration, 'class'),
|
| 94 |
+
(r'(?:enum)\b', Keyword.Declaration, 'enum'),
|
| 95 |
+
(r'(?:typedef)\b', Keyword.Declaration, 'typedef'),
|
| 96 |
+
|
| 97 |
+
# top-level expression
|
| 98 |
+
# although it is not supported in haxe, but it is common to write
|
| 99 |
+
# expression in web pages the positive lookahead here is to prevent
|
| 100 |
+
# an infinite loop at the EOF
|
| 101 |
+
(r'(?=.)', Text, 'expr-statement'),
|
| 102 |
+
],
|
| 103 |
+
|
| 104 |
+
# space/tab/comment/preproc
|
| 105 |
+
'spaces': [
|
| 106 |
+
(r'\s+', Whitespace),
|
| 107 |
+
(r'//[^\n\r]*', Comment.Single),
|
| 108 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 109 |
+
(r'(#)(if|elseif|else|end|error)\b', preproc_callback),
|
| 110 |
+
],
|
| 111 |
+
|
| 112 |
+
'string-single-interpol': [
|
| 113 |
+
(r'\$\{', String.Interpol, ('string-interpol-close', 'expr')),
|
| 114 |
+
(r'\$\$', String.Escape),
|
| 115 |
+
(r'\$(?=' + ident + ')', String.Interpol, 'ident'),
|
| 116 |
+
include('string-single'),
|
| 117 |
+
],
|
| 118 |
+
|
| 119 |
+
'string-single': [
|
| 120 |
+
(r"'", String.Single, '#pop'),
|
| 121 |
+
(r'\\.', String.Escape),
|
| 122 |
+
(r'.', String.Single),
|
| 123 |
+
],
|
| 124 |
+
|
| 125 |
+
'string-double': [
|
| 126 |
+
(r'"', String.Double, '#pop'),
|
| 127 |
+
(r'\\.', String.Escape),
|
| 128 |
+
(r'.', String.Double),
|
| 129 |
+
],
|
| 130 |
+
|
| 131 |
+
'string-interpol-close': [
|
| 132 |
+
(r'\$'+ident, String.Interpol),
|
| 133 |
+
(r'\}', String.Interpol, '#pop'),
|
| 134 |
+
],
|
| 135 |
+
|
| 136 |
+
'package': [
|
| 137 |
+
include('spaces'),
|
| 138 |
+
(ident, Name.Namespace),
|
| 139 |
+
(r'\.', Punctuation, 'import-ident'),
|
| 140 |
+
default('#pop'),
|
| 141 |
+
],
|
| 142 |
+
|
| 143 |
+
'import': [
|
| 144 |
+
include('spaces'),
|
| 145 |
+
(ident, Name.Namespace),
|
| 146 |
+
(r'\*', Keyword), # wildcard import
|
| 147 |
+
(r'\.', Punctuation, 'import-ident'),
|
| 148 |
+
(r'in', Keyword.Namespace, 'ident'),
|
| 149 |
+
default('#pop'),
|
| 150 |
+
],
|
| 151 |
+
|
| 152 |
+
'import-ident': [
|
| 153 |
+
include('spaces'),
|
| 154 |
+
(r'\*', Keyword, '#pop'), # wildcard import
|
| 155 |
+
(ident, Name.Namespace, '#pop'),
|
| 156 |
+
],
|
| 157 |
+
|
| 158 |
+
'using': [
|
| 159 |
+
include('spaces'),
|
| 160 |
+
(ident, Name.Namespace),
|
| 161 |
+
(r'\.', Punctuation, 'import-ident'),
|
| 162 |
+
default('#pop'),
|
| 163 |
+
],
|
| 164 |
+
|
| 165 |
+
'preproc-error': [
|
| 166 |
+
(r'\s+', Whitespace),
|
| 167 |
+
(r"'", String.Single, ('#pop', 'string-single')),
|
| 168 |
+
(r'"', String.Double, ('#pop', 'string-double')),
|
| 169 |
+
default('#pop'),
|
| 170 |
+
],
|
| 171 |
+
|
| 172 |
+
'preproc-expr': [
|
| 173 |
+
(r'\s+', Whitespace),
|
| 174 |
+
(r'\!', Comment.Preproc),
|
| 175 |
+
(r'\(', Comment.Preproc, ('#pop', 'preproc-parenthesis')),
|
| 176 |
+
|
| 177 |
+
(ident, Comment.Preproc, '#pop'),
|
| 178 |
+
|
| 179 |
+
# Float
|
| 180 |
+
(r'\.[0-9]+', Number.Float),
|
| 181 |
+
(r'[0-9]+[eE][+\-]?[0-9]+', Number.Float),
|
| 182 |
+
(r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float),
|
| 183 |
+
(r'[0-9]+\.[0-9]+', Number.Float),
|
| 184 |
+
(r'[0-9]+\.(?!' + ident + r'|\.\.)', Number.Float),
|
| 185 |
+
|
| 186 |
+
# Int
|
| 187 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 188 |
+
(r'[0-9]+', Number.Integer),
|
| 189 |
+
|
| 190 |
+
# String
|
| 191 |
+
(r"'", String.Single, ('#pop', 'string-single')),
|
| 192 |
+
(r'"', String.Double, ('#pop', 'string-double')),
|
| 193 |
+
],
|
| 194 |
+
|
| 195 |
+
'preproc-parenthesis': [
|
| 196 |
+
(r'\s+', Whitespace),
|
| 197 |
+
(r'\)', Comment.Preproc, '#pop'),
|
| 198 |
+
default('preproc-expr-in-parenthesis'),
|
| 199 |
+
],
|
| 200 |
+
|
| 201 |
+
'preproc-expr-chain': [
|
| 202 |
+
(r'\s+', Whitespace),
|
| 203 |
+
(binop, Comment.Preproc, ('#pop', 'preproc-expr-in-parenthesis')),
|
| 204 |
+
default('#pop'),
|
| 205 |
+
],
|
| 206 |
+
|
| 207 |
+
# same as 'preproc-expr' but able to chain 'preproc-expr-chain'
|
| 208 |
+
'preproc-expr-in-parenthesis': [
|
| 209 |
+
(r'\s+', Whitespace),
|
| 210 |
+
(r'\!', Comment.Preproc),
|
| 211 |
+
(r'\(', Comment.Preproc,
|
| 212 |
+
('#pop', 'preproc-expr-chain', 'preproc-parenthesis')),
|
| 213 |
+
|
| 214 |
+
(ident, Comment.Preproc, ('#pop', 'preproc-expr-chain')),
|
| 215 |
+
|
| 216 |
+
# Float
|
| 217 |
+
(r'\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
| 218 |
+
(r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
| 219 |
+
(r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
| 220 |
+
(r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
| 221 |
+
(r'[0-9]+\.(?!' + ident + r'|\.\.)', Number.Float, ('#pop', 'preproc-expr-chain')),
|
| 222 |
+
|
| 223 |
+
# Int
|
| 224 |
+
(r'0x[0-9a-fA-F]+', Number.Hex, ('#pop', 'preproc-expr-chain')),
|
| 225 |
+
(r'[0-9]+', Number.Integer, ('#pop', 'preproc-expr-chain')),
|
| 226 |
+
|
| 227 |
+
# String
|
| 228 |
+
(r"'", String.Single,
|
| 229 |
+
('#pop', 'preproc-expr-chain', 'string-single')),
|
| 230 |
+
(r'"', String.Double,
|
| 231 |
+
('#pop', 'preproc-expr-chain', 'string-double')),
|
| 232 |
+
],
|
| 233 |
+
|
| 234 |
+
'abstract': [
|
| 235 |
+
include('spaces'),
|
| 236 |
+
default(('#pop', 'abstract-body', 'abstract-relation',
|
| 237 |
+
'abstract-opaque', 'type-param-constraint', 'type-name')),
|
| 238 |
+
],
|
| 239 |
+
|
| 240 |
+
'abstract-body': [
|
| 241 |
+
include('spaces'),
|
| 242 |
+
(r'\{', Punctuation, ('#pop', 'class-body')),
|
| 243 |
+
],
|
| 244 |
+
|
| 245 |
+
'abstract-opaque': [
|
| 246 |
+
include('spaces'),
|
| 247 |
+
(r'\(', Punctuation, ('#pop', 'parenthesis-close', 'type')),
|
| 248 |
+
default('#pop'),
|
| 249 |
+
],
|
| 250 |
+
|
| 251 |
+
'abstract-relation': [
|
| 252 |
+
include('spaces'),
|
| 253 |
+
(r'(?:to|from)', Keyword.Declaration, 'type'),
|
| 254 |
+
(r',', Punctuation),
|
| 255 |
+
default('#pop'),
|
| 256 |
+
],
|
| 257 |
+
|
| 258 |
+
'meta': [
|
| 259 |
+
include('spaces'),
|
| 260 |
+
(r'@', Name.Decorator, ('meta-body', 'meta-ident', 'meta-colon')),
|
| 261 |
+
],
|
| 262 |
+
|
| 263 |
+
# optional colon
|
| 264 |
+
'meta-colon': [
|
| 265 |
+
include('spaces'),
|
| 266 |
+
(r':', Name.Decorator, '#pop'),
|
| 267 |
+
default('#pop'),
|
| 268 |
+
],
|
| 269 |
+
|
| 270 |
+
# same as 'ident' but set token as Name.Decorator instead of Name
|
| 271 |
+
'meta-ident': [
|
| 272 |
+
include('spaces'),
|
| 273 |
+
(ident, Name.Decorator, '#pop'),
|
| 274 |
+
],
|
| 275 |
+
|
| 276 |
+
'meta-body': [
|
| 277 |
+
include('spaces'),
|
| 278 |
+
(r'\(', Name.Decorator, ('#pop', 'meta-call')),
|
| 279 |
+
default('#pop'),
|
| 280 |
+
],
|
| 281 |
+
|
| 282 |
+
'meta-call': [
|
| 283 |
+
include('spaces'),
|
| 284 |
+
(r'\)', Name.Decorator, '#pop'),
|
| 285 |
+
default(('#pop', 'meta-call-sep', 'expr')),
|
| 286 |
+
],
|
| 287 |
+
|
| 288 |
+
'meta-call-sep': [
|
| 289 |
+
include('spaces'),
|
| 290 |
+
(r'\)', Name.Decorator, '#pop'),
|
| 291 |
+
(r',', Punctuation, ('#pop', 'meta-call')),
|
| 292 |
+
],
|
| 293 |
+
|
| 294 |
+
'typedef': [
|
| 295 |
+
include('spaces'),
|
| 296 |
+
default(('#pop', 'typedef-body', 'type-param-constraint',
|
| 297 |
+
'type-name')),
|
| 298 |
+
],
|
| 299 |
+
|
| 300 |
+
'typedef-body': [
|
| 301 |
+
include('spaces'),
|
| 302 |
+
(r'=', Operator, ('#pop', 'optional-semicolon', 'type')),
|
| 303 |
+
],
|
| 304 |
+
|
| 305 |
+
'enum': [
|
| 306 |
+
include('spaces'),
|
| 307 |
+
default(('#pop', 'enum-body', 'bracket-open',
|
| 308 |
+
'type-param-constraint', 'type-name')),
|
| 309 |
+
],
|
| 310 |
+
|
| 311 |
+
'enum-body': [
|
| 312 |
+
include('spaces'),
|
| 313 |
+
include('meta'),
|
| 314 |
+
(r'\}', Punctuation, '#pop'),
|
| 315 |
+
(ident_no_keyword, Name, ('enum-member', 'type-param-constraint')),
|
| 316 |
+
],
|
| 317 |
+
|
| 318 |
+
'enum-member': [
|
| 319 |
+
include('spaces'),
|
| 320 |
+
(r'\(', Punctuation,
|
| 321 |
+
('#pop', 'semicolon', 'flag', 'function-param')),
|
| 322 |
+
default(('#pop', 'semicolon', 'flag')),
|
| 323 |
+
],
|
| 324 |
+
|
| 325 |
+
'class': [
|
| 326 |
+
include('spaces'),
|
| 327 |
+
default(('#pop', 'class-body', 'bracket-open', 'extends',
|
| 328 |
+
'type-param-constraint', 'type-name')),
|
| 329 |
+
],
|
| 330 |
+
|
| 331 |
+
'extends': [
|
| 332 |
+
include('spaces'),
|
| 333 |
+
(r'(?:extends|implements)\b', Keyword.Declaration, 'type'),
|
| 334 |
+
(r',', Punctuation), # the comma is made optional here, since haxe2
|
| 335 |
+
# requires the comma but haxe3 does not allow it
|
| 336 |
+
default('#pop'),
|
| 337 |
+
],
|
| 338 |
+
|
| 339 |
+
'bracket-open': [
|
| 340 |
+
include('spaces'),
|
| 341 |
+
(r'\{', Punctuation, '#pop'),
|
| 342 |
+
],
|
| 343 |
+
|
| 344 |
+
'bracket-close': [
|
| 345 |
+
include('spaces'),
|
| 346 |
+
(r'\}', Punctuation, '#pop'),
|
| 347 |
+
],
|
| 348 |
+
|
| 349 |
+
'class-body': [
|
| 350 |
+
include('spaces'),
|
| 351 |
+
include('meta'),
|
| 352 |
+
(r'\}', Punctuation, '#pop'),
|
| 353 |
+
(r'(?:static|public|private|override|dynamic|inline|macro)\b',
|
| 354 |
+
Keyword.Declaration),
|
| 355 |
+
default('class-member'),
|
| 356 |
+
],
|
| 357 |
+
|
| 358 |
+
'class-member': [
|
| 359 |
+
include('spaces'),
|
| 360 |
+
(r'(var)\b', Keyword.Declaration,
|
| 361 |
+
('#pop', 'optional-semicolon', 'var')),
|
| 362 |
+
(r'(function)\b', Keyword.Declaration,
|
| 363 |
+
('#pop', 'optional-semicolon', 'class-method')),
|
| 364 |
+
],
|
| 365 |
+
|
| 366 |
+
# local function, anonymous or not
|
| 367 |
+
'function-local': [
|
| 368 |
+
include('spaces'),
|
| 369 |
+
(ident_no_keyword, Name.Function,
|
| 370 |
+
('#pop', 'optional-expr', 'flag', 'function-param',
|
| 371 |
+
'parenthesis-open', 'type-param-constraint')),
|
| 372 |
+
default(('#pop', 'optional-expr', 'flag', 'function-param',
|
| 373 |
+
'parenthesis-open', 'type-param-constraint')),
|
| 374 |
+
],
|
| 375 |
+
|
| 376 |
+
'optional-expr': [
|
| 377 |
+
include('spaces'),
|
| 378 |
+
include('expr'),
|
| 379 |
+
default('#pop'),
|
| 380 |
+
],
|
| 381 |
+
|
| 382 |
+
'class-method': [
|
| 383 |
+
include('spaces'),
|
| 384 |
+
(ident, Name.Function, ('#pop', 'optional-expr', 'flag',
|
| 385 |
+
'function-param', 'parenthesis-open',
|
| 386 |
+
'type-param-constraint')),
|
| 387 |
+
],
|
| 388 |
+
|
| 389 |
+
# function arguments
|
| 390 |
+
'function-param': [
|
| 391 |
+
include('spaces'),
|
| 392 |
+
(r'\)', Punctuation, '#pop'),
|
| 393 |
+
(r'\?', Punctuation),
|
| 394 |
+
(ident_no_keyword, Name,
|
| 395 |
+
('#pop', 'function-param-sep', 'assign', 'flag')),
|
| 396 |
+
],
|
| 397 |
+
|
| 398 |
+
'function-param-sep': [
|
| 399 |
+
include('spaces'),
|
| 400 |
+
(r'\)', Punctuation, '#pop'),
|
| 401 |
+
(r',', Punctuation, ('#pop', 'function-param')),
|
| 402 |
+
],
|
| 403 |
+
|
| 404 |
+
'prop-get-set': [
|
| 405 |
+
include('spaces'),
|
| 406 |
+
(r'\(', Punctuation, ('#pop', 'parenthesis-close',
|
| 407 |
+
'prop-get-set-opt', 'comma', 'prop-get-set-opt')),
|
| 408 |
+
default('#pop'),
|
| 409 |
+
],
|
| 410 |
+
|
| 411 |
+
'prop-get-set-opt': [
|
| 412 |
+
include('spaces'),
|
| 413 |
+
(r'(?:default|null|never|dynamic|get|set)\b', Keyword, '#pop'),
|
| 414 |
+
(ident_no_keyword, Text, '#pop'), # custom getter/setter
|
| 415 |
+
],
|
| 416 |
+
|
| 417 |
+
'expr-statement': [
|
| 418 |
+
include('spaces'),
|
| 419 |
+
# makes semicolon optional here, just to avoid checking the last
|
| 420 |
+
# one is bracket or not.
|
| 421 |
+
default(('#pop', 'optional-semicolon', 'expr')),
|
| 422 |
+
],
|
| 423 |
+
|
| 424 |
+
'expr': [
|
| 425 |
+
include('spaces'),
|
| 426 |
+
(r'@', Name.Decorator, ('#pop', 'optional-expr', 'meta-body',
|
| 427 |
+
'meta-ident', 'meta-colon')),
|
| 428 |
+
(r'(?:\+\+|\-\-|~(?!/)|!|\-)', Operator),
|
| 429 |
+
(r'\(', Punctuation, ('#pop', 'expr-chain', 'parenthesis')),
|
| 430 |
+
(r'(?:static|public|private|override|dynamic|inline)\b',
|
| 431 |
+
Keyword.Declaration),
|
| 432 |
+
(r'(?:function)\b', Keyword.Declaration, ('#pop', 'expr-chain',
|
| 433 |
+
'function-local')),
|
| 434 |
+
(r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket')),
|
| 435 |
+
(r'(?:true|false|null)\b', Keyword.Constant, ('#pop', 'expr-chain')),
|
| 436 |
+
(r'(?:this)\b', Keyword, ('#pop', 'expr-chain')),
|
| 437 |
+
(r'(?:cast)\b', Keyword, ('#pop', 'expr-chain', 'cast')),
|
| 438 |
+
(r'(?:try)\b', Keyword, ('#pop', 'catch', 'expr')),
|
| 439 |
+
(r'(?:var)\b', Keyword.Declaration, ('#pop', 'var')),
|
| 440 |
+
(r'(?:new)\b', Keyword, ('#pop', 'expr-chain', 'new')),
|
| 441 |
+
(r'(?:switch)\b', Keyword, ('#pop', 'switch')),
|
| 442 |
+
(r'(?:if)\b', Keyword, ('#pop', 'if')),
|
| 443 |
+
(r'(?:do)\b', Keyword, ('#pop', 'do')),
|
| 444 |
+
(r'(?:while)\b', Keyword, ('#pop', 'while')),
|
| 445 |
+
(r'(?:for)\b', Keyword, ('#pop', 'for')),
|
| 446 |
+
(r'(?:untyped|throw)\b', Keyword),
|
| 447 |
+
(r'(?:return)\b', Keyword, ('#pop', 'optional-expr')),
|
| 448 |
+
(r'(?:macro)\b', Keyword, ('#pop', 'macro')),
|
| 449 |
+
(r'(?:continue|break)\b', Keyword, '#pop'),
|
| 450 |
+
(r'(?:\$\s*[a-z]\b|\$(?!'+ident+'))', Name, ('#pop', 'dollar')),
|
| 451 |
+
(ident_no_keyword, Name, ('#pop', 'expr-chain')),
|
| 452 |
+
|
| 453 |
+
# Float
|
| 454 |
+
(r'\.[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
| 455 |
+
(r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
| 456 |
+
(r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
| 457 |
+
(r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
| 458 |
+
(r'[0-9]+\.(?!' + ident + r'|\.\.)', Number.Float, ('#pop', 'expr-chain')),
|
| 459 |
+
|
| 460 |
+
# Int
|
| 461 |
+
(r'0x[0-9a-fA-F]+', Number.Hex, ('#pop', 'expr-chain')),
|
| 462 |
+
(r'[0-9]+', Number.Integer, ('#pop', 'expr-chain')),
|
| 463 |
+
|
| 464 |
+
# String
|
| 465 |
+
(r"'", String.Single, ('#pop', 'expr-chain', 'string-single-interpol')),
|
| 466 |
+
(r'"', String.Double, ('#pop', 'expr-chain', 'string-double')),
|
| 467 |
+
|
| 468 |
+
# EReg
|
| 469 |
+
(r'~/(\\\\|\\[^\\]|[^/\\\n])*/[gimsu]*', String.Regex, ('#pop', 'expr-chain')),
|
| 470 |
+
|
| 471 |
+
# Array
|
| 472 |
+
(r'\[', Punctuation, ('#pop', 'expr-chain', 'array-decl')),
|
| 473 |
+
],
|
| 474 |
+
|
| 475 |
+
'expr-chain': [
|
| 476 |
+
include('spaces'),
|
| 477 |
+
(r'(?:\+\+|\-\-)', Operator),
|
| 478 |
+
(binop, Operator, ('#pop', 'expr')),
|
| 479 |
+
(r'(?:in)\b', Keyword, ('#pop', 'expr')),
|
| 480 |
+
(r'\?', Operator, ('#pop', 'expr', 'ternary', 'expr')),
|
| 481 |
+
(r'(\.)(' + ident_no_keyword + ')', bygroups(Punctuation, Name)),
|
| 482 |
+
(r'\[', Punctuation, 'array-access'),
|
| 483 |
+
(r'\(', Punctuation, 'call'),
|
| 484 |
+
default('#pop'),
|
| 485 |
+
],
|
| 486 |
+
|
| 487 |
+
# macro reification
|
| 488 |
+
'macro': [
|
| 489 |
+
include('spaces'),
|
| 490 |
+
include('meta'),
|
| 491 |
+
(r':', Punctuation, ('#pop', 'type')),
|
| 492 |
+
|
| 493 |
+
(r'(?:extern|private)\b', Keyword.Declaration),
|
| 494 |
+
(r'(?:abstract)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'abstract')),
|
| 495 |
+
(r'(?:class|interface)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'macro-class')),
|
| 496 |
+
(r'(?:enum)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'enum')),
|
| 497 |
+
(r'(?:typedef)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'typedef')),
|
| 498 |
+
|
| 499 |
+
default(('#pop', 'expr')),
|
| 500 |
+
],
|
| 501 |
+
|
| 502 |
+
'macro-class': [
|
| 503 |
+
(r'\{', Punctuation, ('#pop', 'class-body')),
|
| 504 |
+
include('class')
|
| 505 |
+
],
|
| 506 |
+
|
| 507 |
+
# cast can be written as "cast expr" or "cast(expr, type)"
|
| 508 |
+
'cast': [
|
| 509 |
+
include('spaces'),
|
| 510 |
+
(r'\(', Punctuation, ('#pop', 'parenthesis-close',
|
| 511 |
+
'cast-type', 'expr')),
|
| 512 |
+
default(('#pop', 'expr')),
|
| 513 |
+
],
|
| 514 |
+
|
| 515 |
+
# optionally give a type as the 2nd argument of cast()
|
| 516 |
+
'cast-type': [
|
| 517 |
+
include('spaces'),
|
| 518 |
+
(r',', Punctuation, ('#pop', 'type')),
|
| 519 |
+
default('#pop'),
|
| 520 |
+
],
|
| 521 |
+
|
| 522 |
+
'catch': [
|
| 523 |
+
include('spaces'),
|
| 524 |
+
(r'(?:catch)\b', Keyword, ('expr', 'function-param',
|
| 525 |
+
'parenthesis-open')),
|
| 526 |
+
default('#pop'),
|
| 527 |
+
],
|
| 528 |
+
|
| 529 |
+
# do-while loop
|
| 530 |
+
'do': [
|
| 531 |
+
include('spaces'),
|
| 532 |
+
default(('#pop', 'do-while', 'expr')),
|
| 533 |
+
],
|
| 534 |
+
|
| 535 |
+
# the while after do
|
| 536 |
+
'do-while': [
|
| 537 |
+
include('spaces'),
|
| 538 |
+
(r'(?:while)\b', Keyword, ('#pop', 'parenthesis',
|
| 539 |
+
'parenthesis-open')),
|
| 540 |
+
],
|
| 541 |
+
|
| 542 |
+
'while': [
|
| 543 |
+
include('spaces'),
|
| 544 |
+
(r'\(', Punctuation, ('#pop', 'expr', 'parenthesis')),
|
| 545 |
+
],
|
| 546 |
+
|
| 547 |
+
'for': [
|
| 548 |
+
include('spaces'),
|
| 549 |
+
(r'\(', Punctuation, ('#pop', 'expr', 'parenthesis')),
|
| 550 |
+
],
|
| 551 |
+
|
| 552 |
+
'if': [
|
| 553 |
+
include('spaces'),
|
| 554 |
+
(r'\(', Punctuation, ('#pop', 'else', 'optional-semicolon', 'expr',
|
| 555 |
+
'parenthesis')),
|
| 556 |
+
],
|
| 557 |
+
|
| 558 |
+
'else': [
|
| 559 |
+
include('spaces'),
|
| 560 |
+
(r'(?:else)\b', Keyword, ('#pop', 'expr')),
|
| 561 |
+
default('#pop'),
|
| 562 |
+
],
|
| 563 |
+
|
| 564 |
+
'switch': [
|
| 565 |
+
include('spaces'),
|
| 566 |
+
default(('#pop', 'switch-body', 'bracket-open', 'expr')),
|
| 567 |
+
],
|
| 568 |
+
|
| 569 |
+
'switch-body': [
|
| 570 |
+
include('spaces'),
|
| 571 |
+
(r'(?:case|default)\b', Keyword, ('case-block', 'case')),
|
| 572 |
+
(r'\}', Punctuation, '#pop'),
|
| 573 |
+
],
|
| 574 |
+
|
| 575 |
+
'case': [
|
| 576 |
+
include('spaces'),
|
| 577 |
+
(r':', Punctuation, '#pop'),
|
| 578 |
+
default(('#pop', 'case-sep', 'case-guard', 'expr')),
|
| 579 |
+
],
|
| 580 |
+
|
| 581 |
+
'case-sep': [
|
| 582 |
+
include('spaces'),
|
| 583 |
+
(r':', Punctuation, '#pop'),
|
| 584 |
+
(r',', Punctuation, ('#pop', 'case')),
|
| 585 |
+
],
|
| 586 |
+
|
| 587 |
+
'case-guard': [
|
| 588 |
+
include('spaces'),
|
| 589 |
+
(r'(?:if)\b', Keyword, ('#pop', 'parenthesis', 'parenthesis-open')),
|
| 590 |
+
default('#pop'),
|
| 591 |
+
],
|
| 592 |
+
|
| 593 |
+
# optional multiple expr under a case
|
| 594 |
+
'case-block': [
|
| 595 |
+
include('spaces'),
|
| 596 |
+
(r'(?!(?:case|default)\b|\})', Keyword, 'expr-statement'),
|
| 597 |
+
default('#pop'),
|
| 598 |
+
],
|
| 599 |
+
|
| 600 |
+
'new': [
|
| 601 |
+
include('spaces'),
|
| 602 |
+
default(('#pop', 'call', 'parenthesis-open', 'type')),
|
| 603 |
+
],
|
| 604 |
+
|
| 605 |
+
'array-decl': [
|
| 606 |
+
include('spaces'),
|
| 607 |
+
(r'\]', Punctuation, '#pop'),
|
| 608 |
+
default(('#pop', 'array-decl-sep', 'expr')),
|
| 609 |
+
],
|
| 610 |
+
|
| 611 |
+
'array-decl-sep': [
|
| 612 |
+
include('spaces'),
|
| 613 |
+
(r'\]', Punctuation, '#pop'),
|
| 614 |
+
(r',', Punctuation, ('#pop', 'array-decl')),
|
| 615 |
+
],
|
| 616 |
+
|
| 617 |
+
'array-access': [
|
| 618 |
+
include('spaces'),
|
| 619 |
+
default(('#pop', 'array-access-close', 'expr')),
|
| 620 |
+
],
|
| 621 |
+
|
| 622 |
+
'array-access-close': [
|
| 623 |
+
include('spaces'),
|
| 624 |
+
(r'\]', Punctuation, '#pop'),
|
| 625 |
+
],
|
| 626 |
+
|
| 627 |
+
'comma': [
|
| 628 |
+
include('spaces'),
|
| 629 |
+
(r',', Punctuation, '#pop'),
|
| 630 |
+
],
|
| 631 |
+
|
| 632 |
+
'colon': [
|
| 633 |
+
include('spaces'),
|
| 634 |
+
(r':', Punctuation, '#pop'),
|
| 635 |
+
],
|
| 636 |
+
|
| 637 |
+
'semicolon': [
|
| 638 |
+
include('spaces'),
|
| 639 |
+
(r';', Punctuation, '#pop'),
|
| 640 |
+
],
|
| 641 |
+
|
| 642 |
+
'optional-semicolon': [
|
| 643 |
+
include('spaces'),
|
| 644 |
+
(r';', Punctuation, '#pop'),
|
| 645 |
+
default('#pop'),
|
| 646 |
+
],
|
| 647 |
+
|
| 648 |
+
# identity that CAN be a Haxe keyword
|
| 649 |
+
'ident': [
|
| 650 |
+
include('spaces'),
|
| 651 |
+
(ident, Name, '#pop'),
|
| 652 |
+
],
|
| 653 |
+
|
| 654 |
+
'dollar': [
|
| 655 |
+
include('spaces'),
|
| 656 |
+
(r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket-close', 'expr')),
|
| 657 |
+
default(('#pop', 'expr-chain')),
|
| 658 |
+
],
|
| 659 |
+
|
| 660 |
+
'type-name': [
|
| 661 |
+
include('spaces'),
|
| 662 |
+
(typeid, Name, '#pop'),
|
| 663 |
+
],
|
| 664 |
+
|
| 665 |
+
'type-full-name': [
|
| 666 |
+
include('spaces'),
|
| 667 |
+
(r'\.', Punctuation, 'ident'),
|
| 668 |
+
default('#pop'),
|
| 669 |
+
],
|
| 670 |
+
|
| 671 |
+
'type': [
|
| 672 |
+
include('spaces'),
|
| 673 |
+
(r'\?', Punctuation),
|
| 674 |
+
(ident, Name, ('#pop', 'type-check', 'type-full-name')),
|
| 675 |
+
(r'\{', Punctuation, ('#pop', 'type-check', 'type-struct')),
|
| 676 |
+
(r'\(', Punctuation, ('#pop', 'type-check', 'type-parenthesis')),
|
| 677 |
+
],
|
| 678 |
+
|
| 679 |
+
'type-parenthesis': [
|
| 680 |
+
include('spaces'),
|
| 681 |
+
default(('#pop', 'parenthesis-close', 'type')),
|
| 682 |
+
],
|
| 683 |
+
|
| 684 |
+
'type-check': [
|
| 685 |
+
include('spaces'),
|
| 686 |
+
(r'->', Punctuation, ('#pop', 'type')),
|
| 687 |
+
(r'<(?!=)', Punctuation, 'type-param'),
|
| 688 |
+
default('#pop'),
|
| 689 |
+
],
|
| 690 |
+
|
| 691 |
+
'type-struct': [
|
| 692 |
+
include('spaces'),
|
| 693 |
+
(r'\}', Punctuation, '#pop'),
|
| 694 |
+
(r'\?', Punctuation),
|
| 695 |
+
(r'>', Punctuation, ('comma', 'type')),
|
| 696 |
+
(ident_no_keyword, Name, ('#pop', 'type-struct-sep', 'type', 'colon')),
|
| 697 |
+
include('class-body'),
|
| 698 |
+
],
|
| 699 |
+
|
| 700 |
+
'type-struct-sep': [
|
| 701 |
+
include('spaces'),
|
| 702 |
+
(r'\}', Punctuation, '#pop'),
|
| 703 |
+
(r',', Punctuation, ('#pop', 'type-struct')),
|
| 704 |
+
],
|
| 705 |
+
|
| 706 |
+
# type-param can be a normal type or a constant literal...
|
| 707 |
+
'type-param-type': [
|
| 708 |
+
# Float
|
| 709 |
+
(r'\.[0-9]+', Number.Float, '#pop'),
|
| 710 |
+
(r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, '#pop'),
|
| 711 |
+
(r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, '#pop'),
|
| 712 |
+
(r'[0-9]+\.[0-9]+', Number.Float, '#pop'),
|
| 713 |
+
(r'[0-9]+\.(?!' + ident + r'|\.\.)', Number.Float, '#pop'),
|
| 714 |
+
|
| 715 |
+
# Int
|
| 716 |
+
(r'0x[0-9a-fA-F]+', Number.Hex, '#pop'),
|
| 717 |
+
(r'[0-9]+', Number.Integer, '#pop'),
|
| 718 |
+
|
| 719 |
+
# String
|
| 720 |
+
(r"'", String.Single, ('#pop', 'string-single')),
|
| 721 |
+
(r'"', String.Double, ('#pop', 'string-double')),
|
| 722 |
+
|
| 723 |
+
# EReg
|
| 724 |
+
(r'~/(\\\\|\\[^\\]|[^/\\\n])*/[gim]*', String.Regex, '#pop'),
|
| 725 |
+
|
| 726 |
+
# Array
|
| 727 |
+
(r'\[', Operator, ('#pop', 'array-decl')),
|
| 728 |
+
|
| 729 |
+
include('type'),
|
| 730 |
+
],
|
| 731 |
+
|
| 732 |
+
# type-param part of a type
|
| 733 |
+
# ie. the <A,B> path in Map<A,B>
|
| 734 |
+
'type-param': [
|
| 735 |
+
include('spaces'),
|
| 736 |
+
default(('#pop', 'type-param-sep', 'type-param-type')),
|
| 737 |
+
],
|
| 738 |
+
|
| 739 |
+
'type-param-sep': [
|
| 740 |
+
include('spaces'),
|
| 741 |
+
(r'>', Punctuation, '#pop'),
|
| 742 |
+
(r',', Punctuation, ('#pop', 'type-param')),
|
| 743 |
+
],
|
| 744 |
+
|
| 745 |
+
# optional type-param that may include constraint
|
| 746 |
+
# ie. <T:Constraint, T2:(ConstraintA,ConstraintB)>
|
| 747 |
+
'type-param-constraint': [
|
| 748 |
+
include('spaces'),
|
| 749 |
+
(r'<(?!=)', Punctuation, ('#pop', 'type-param-constraint-sep',
|
| 750 |
+
'type-param-constraint-flag', 'type-name')),
|
| 751 |
+
default('#pop'),
|
| 752 |
+
],
|
| 753 |
+
|
| 754 |
+
'type-param-constraint-sep': [
|
| 755 |
+
include('spaces'),
|
| 756 |
+
(r'>', Punctuation, '#pop'),
|
| 757 |
+
(r',', Punctuation, ('#pop', 'type-param-constraint-sep',
|
| 758 |
+
'type-param-constraint-flag', 'type-name')),
|
| 759 |
+
],
|
| 760 |
+
|
| 761 |
+
# the optional constraint inside type-param
|
| 762 |
+
'type-param-constraint-flag': [
|
| 763 |
+
include('spaces'),
|
| 764 |
+
(r':', Punctuation, ('#pop', 'type-param-constraint-flag-type')),
|
| 765 |
+
default('#pop'),
|
| 766 |
+
],
|
| 767 |
+
|
| 768 |
+
'type-param-constraint-flag-type': [
|
| 769 |
+
include('spaces'),
|
| 770 |
+
(r'\(', Punctuation, ('#pop', 'type-param-constraint-flag-type-sep',
|
| 771 |
+
'type')),
|
| 772 |
+
default(('#pop', 'type')),
|
| 773 |
+
],
|
| 774 |
+
|
| 775 |
+
'type-param-constraint-flag-type-sep': [
|
| 776 |
+
include('spaces'),
|
| 777 |
+
(r'\)', Punctuation, '#pop'),
|
| 778 |
+
(r',', Punctuation, 'type'),
|
| 779 |
+
],
|
| 780 |
+
|
| 781 |
+
# a parenthesis expr that contain exactly one expr
|
| 782 |
+
'parenthesis': [
|
| 783 |
+
include('spaces'),
|
| 784 |
+
default(('#pop', 'parenthesis-close', 'flag', 'expr')),
|
| 785 |
+
],
|
| 786 |
+
|
| 787 |
+
'parenthesis-open': [
|
| 788 |
+
include('spaces'),
|
| 789 |
+
(r'\(', Punctuation, '#pop'),
|
| 790 |
+
],
|
| 791 |
+
|
| 792 |
+
'parenthesis-close': [
|
| 793 |
+
include('spaces'),
|
| 794 |
+
(r'\)', Punctuation, '#pop'),
|
| 795 |
+
],
|
| 796 |
+
|
| 797 |
+
'var': [
|
| 798 |
+
include('spaces'),
|
| 799 |
+
(ident_no_keyword, Text, ('#pop', 'var-sep', 'assign', 'flag', 'prop-get-set')),
|
| 800 |
+
],
|
| 801 |
+
|
| 802 |
+
# optional more var decl.
|
| 803 |
+
'var-sep': [
|
| 804 |
+
include('spaces'),
|
| 805 |
+
(r',', Punctuation, ('#pop', 'var')),
|
| 806 |
+
default('#pop'),
|
| 807 |
+
],
|
| 808 |
+
|
| 809 |
+
# optional assignment
|
| 810 |
+
'assign': [
|
| 811 |
+
include('spaces'),
|
| 812 |
+
(r'=', Operator, ('#pop', 'expr')),
|
| 813 |
+
default('#pop'),
|
| 814 |
+
],
|
| 815 |
+
|
| 816 |
+
# optional type flag
|
| 817 |
+
'flag': [
|
| 818 |
+
include('spaces'),
|
| 819 |
+
(r':', Punctuation, ('#pop', 'type')),
|
| 820 |
+
default('#pop'),
|
| 821 |
+
],
|
| 822 |
+
|
| 823 |
+
# colon as part of a ternary operator (?:)
|
| 824 |
+
'ternary': [
|
| 825 |
+
include('spaces'),
|
| 826 |
+
(r':', Operator, '#pop'),
|
| 827 |
+
],
|
| 828 |
+
|
| 829 |
+
# function call
|
| 830 |
+
'call': [
|
| 831 |
+
include('spaces'),
|
| 832 |
+
(r'\)', Punctuation, '#pop'),
|
| 833 |
+
default(('#pop', 'call-sep', 'expr')),
|
| 834 |
+
],
|
| 835 |
+
|
| 836 |
+
# after a call param
|
| 837 |
+
'call-sep': [
|
| 838 |
+
include('spaces'),
|
| 839 |
+
(r'\)', Punctuation, '#pop'),
|
| 840 |
+
(r',', Punctuation, ('#pop', 'call')),
|
| 841 |
+
],
|
| 842 |
+
|
| 843 |
+
# bracket can be block or object
|
| 844 |
+
'bracket': [
|
| 845 |
+
include('spaces'),
|
| 846 |
+
(r'(?!(?:\$\s*[a-z]\b|\$(?!'+ident+')))' + ident_no_keyword, Name,
|
| 847 |
+
('#pop', 'bracket-check')),
|
| 848 |
+
(r"'", String.Single, ('#pop', 'bracket-check', 'string-single')),
|
| 849 |
+
(r'"', String.Double, ('#pop', 'bracket-check', 'string-double')),
|
| 850 |
+
default(('#pop', 'block')),
|
| 851 |
+
],
|
| 852 |
+
|
| 853 |
+
'bracket-check': [
|
| 854 |
+
include('spaces'),
|
| 855 |
+
(r':', Punctuation, ('#pop', 'object-sep', 'expr')), # is object
|
| 856 |
+
default(('#pop', 'block', 'optional-semicolon', 'expr-chain')), # is block
|
| 857 |
+
],
|
| 858 |
+
|
| 859 |
+
# code block
|
| 860 |
+
'block': [
|
| 861 |
+
include('spaces'),
|
| 862 |
+
(r'\}', Punctuation, '#pop'),
|
| 863 |
+
default('expr-statement'),
|
| 864 |
+
],
|
| 865 |
+
|
| 866 |
+
# object in key-value pairs
|
| 867 |
+
'object': [
|
| 868 |
+
include('spaces'),
|
| 869 |
+
(r'\}', Punctuation, '#pop'),
|
| 870 |
+
default(('#pop', 'object-sep', 'expr', 'colon', 'ident-or-string'))
|
| 871 |
+
],
|
| 872 |
+
|
| 873 |
+
# a key of an object
|
| 874 |
+
'ident-or-string': [
|
| 875 |
+
include('spaces'),
|
| 876 |
+
(ident_no_keyword, Name, '#pop'),
|
| 877 |
+
(r"'", String.Single, ('#pop', 'string-single')),
|
| 878 |
+
(r'"', String.Double, ('#pop', 'string-double')),
|
| 879 |
+
],
|
| 880 |
+
|
| 881 |
+
# after a key-value pair in object
|
| 882 |
+
'object-sep': [
|
| 883 |
+
include('spaces'),
|
| 884 |
+
(r'\}', Punctuation, '#pop'),
|
| 885 |
+
(r',', Punctuation, ('#pop', 'object')),
|
| 886 |
+
],
|
| 887 |
+
|
| 888 |
+
|
| 889 |
+
|
| 890 |
+
}
|
| 891 |
+
|
| 892 |
+
def analyse_text(text):
|
| 893 |
+
rv = 0
|
| 894 |
+
if re.search(r'\bimport\s+haxe\.', text):
|
| 895 |
+
rv = max(rv, 0.2)
|
| 896 |
+
if re.search(r'\bStd\.', text):
|
| 897 |
+
rv = max(rv, 0.1)
|
| 898 |
+
if re.search(r'\btrace\s*\(', text):
|
| 899 |
+
rv = max(rv, 0.05)
|
| 900 |
+
return rv
|
| 901 |
+
|
| 902 |
+
|
| 903 |
+
class HxmlLexer(RegexLexer):
|
| 904 |
+
"""
|
| 905 |
+
Lexer for haXe build files.
|
| 906 |
+
"""
|
| 907 |
+
name = 'Hxml'
|
| 908 |
+
url = 'https://haxe.org/manual/compiler-usage-hxml.html'
|
| 909 |
+
aliases = ['haxeml', 'hxml']
|
| 910 |
+
filenames = ['*.hxml']
|
| 911 |
+
version_added = '1.6'
|
| 912 |
+
|
| 913 |
+
tokens = {
|
| 914 |
+
'root': [
|
| 915 |
+
# Separator
|
| 916 |
+
(r'(--)(next)', bygroups(Punctuation, Generic.Heading)),
|
| 917 |
+
# Compiler switches with one dash
|
| 918 |
+
(r'(-)(prompt|debug|v)', bygroups(Punctuation, Keyword.Keyword)),
|
| 919 |
+
# Compilerswitches with two dashes
|
| 920 |
+
(r'(--)(neko-source|flash-strict|flash-use-stage|no-opt|no-traces|'
|
| 921 |
+
r'no-inline|times|no-output)', bygroups(Punctuation, Keyword)),
|
| 922 |
+
# Targets and other options that take an argument
|
| 923 |
+
(r'(-)(cpp|js|neko|x|as3|swf9?|swf-lib|php|xml|main|lib|D|resource|'
|
| 924 |
+
r'cp|cmd)( +)(.+)',
|
| 925 |
+
bygroups(Punctuation, Keyword, Whitespace, String)),
|
| 926 |
+
# Options that take only numerical arguments
|
| 927 |
+
(r'(-)(swf-version)( +)(\d+)',
|
| 928 |
+
bygroups(Punctuation, Keyword, Whitespace, Number.Integer)),
|
| 929 |
+
# An Option that defines the size, the fps and the background
|
| 930 |
+
# color of an flash movie
|
| 931 |
+
(r'(-)(swf-header)( +)(\d+)(:)(\d+)(:)(\d+)(:)([A-Fa-f0-9]{6})',
|
| 932 |
+
bygroups(Punctuation, Keyword, Whitespace, Number.Integer,
|
| 933 |
+
Punctuation, Number.Integer, Punctuation, Number.Integer,
|
| 934 |
+
Punctuation, Number.Hex)),
|
| 935 |
+
# options with two dashes that takes arguments
|
| 936 |
+
(r'(--)(js-namespace|php-front|php-lib|remap|gen-hx-classes)( +)'
|
| 937 |
+
r'(.+)', bygroups(Punctuation, Keyword, Whitespace, String)),
|
| 938 |
+
# Single line comment, multiline ones are not allowed.
|
| 939 |
+
(r'#.*', Comment.Single)
|
| 940 |
+
]
|
| 941 |
+
}
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/json5.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.json5
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for Json5 file format.
|
| 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 include, RegexLexer, words
|
| 12 |
+
from pygments.token import Comment, Keyword, Name, Number, Punctuation, \
|
| 13 |
+
String, Whitespace
|
| 14 |
+
|
| 15 |
+
__all__ = ['Json5Lexer']
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def string_rules(quote_mark):
|
| 19 |
+
return [
|
| 20 |
+
(rf"[^{quote_mark}\\]+", String),
|
| 21 |
+
(r"\\.", String.Escape),
|
| 22 |
+
(r"\\", Punctuation),
|
| 23 |
+
(quote_mark, String, '#pop'),
|
| 24 |
+
]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def quoted_field_name(quote_mark):
|
| 28 |
+
return [
|
| 29 |
+
(rf'([^{quote_mark}\\]|\\.)*{quote_mark}',
|
| 30 |
+
Name.Variable, ('#pop', 'object_value'))
|
| 31 |
+
]
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class Json5Lexer(RegexLexer):
|
| 35 |
+
"""Lexer for JSON5 data structures."""
|
| 36 |
+
|
| 37 |
+
name = 'JSON5'
|
| 38 |
+
aliases = ['json5']
|
| 39 |
+
filenames = ['*.json5']
|
| 40 |
+
url = "https://json5.org"
|
| 41 |
+
version_added = '2.19'
|
| 42 |
+
tokens = {
|
| 43 |
+
'_comments': [
|
| 44 |
+
(r'(//|#).*\n', Comment.Single),
|
| 45 |
+
(r'/\*\*([^/]|/(?!\*))*\*/', String.Doc),
|
| 46 |
+
(r'/\*([^/]|/(?!\*))*\*/', Comment),
|
| 47 |
+
],
|
| 48 |
+
'root': [
|
| 49 |
+
include('_comments'),
|
| 50 |
+
(r"'", String, 'singlestring'),
|
| 51 |
+
(r'"', String, 'doublestring'),
|
| 52 |
+
(r'[+-]?0[xX][0-9a-fA-F]+', Number.Hex),
|
| 53 |
+
(r'[+-.]?[0-9]+[.]?[0-9]?([eE][-]?[0-9]+)?', Number.Float),
|
| 54 |
+
(r'\{', Punctuation, 'object'),
|
| 55 |
+
(r'\[', Punctuation, 'array'),
|
| 56 |
+
(words(['false', 'Infinity', '+Infinity', '-Infinity', 'NaN',
|
| 57 |
+
'null', 'true',], suffix=r'\b'), Keyword),
|
| 58 |
+
(r'\s+', Whitespace),
|
| 59 |
+
(r':', Punctuation),
|
| 60 |
+
],
|
| 61 |
+
'singlestring': string_rules("'"),
|
| 62 |
+
'doublestring': string_rules('"'),
|
| 63 |
+
'array': [
|
| 64 |
+
(r',', Punctuation),
|
| 65 |
+
(r'\]', Punctuation, '#pop'),
|
| 66 |
+
include('root'),
|
| 67 |
+
],
|
| 68 |
+
'object': [
|
| 69 |
+
(r'\s+', Whitespace),
|
| 70 |
+
(r'\}', Punctuation, '#pop'),
|
| 71 |
+
(r'\b([^:]+)', Name.Variable, 'object_value'),
|
| 72 |
+
(r'"', Name.Variable, 'double_field_name'),
|
| 73 |
+
(r"'", Name.Variable, 'single_field_name'),
|
| 74 |
+
include('_comments'),
|
| 75 |
+
],
|
| 76 |
+
'double_field_name': quoted_field_name('"'),
|
| 77 |
+
'single_field_name': quoted_field_name("'"),
|
| 78 |
+
'object_value': [
|
| 79 |
+
(r',', Punctuation, '#pop'),
|
| 80 |
+
(r'\}', Punctuation, '#pop:2'),
|
| 81 |
+
include('root'),
|
| 82 |
+
],
|
| 83 |
+
}
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ooc.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.ooc
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for the Ooc 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 Text, Comment, Operator, Keyword, Name, String, \
|
| 13 |
+
Number, Punctuation
|
| 14 |
+
|
| 15 |
+
__all__ = ['OocLexer']
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class OocLexer(RegexLexer):
|
| 19 |
+
"""
|
| 20 |
+
For Ooc source code
|
| 21 |
+
"""
|
| 22 |
+
name = 'Ooc'
|
| 23 |
+
url = 'https://ooc-lang.github.io/'
|
| 24 |
+
aliases = ['ooc']
|
| 25 |
+
filenames = ['*.ooc']
|
| 26 |
+
mimetypes = ['text/x-ooc']
|
| 27 |
+
version_added = '1.2'
|
| 28 |
+
|
| 29 |
+
tokens = {
|
| 30 |
+
'root': [
|
| 31 |
+
(words((
|
| 32 |
+
'class', 'interface', 'implement', 'abstract', 'extends', 'from',
|
| 33 |
+
'this', 'super', 'new', 'const', 'final', 'static', 'import',
|
| 34 |
+
'use', 'extern', 'inline', 'proto', 'break', 'continue',
|
| 35 |
+
'fallthrough', 'operator', 'if', 'else', 'for', 'while', 'do',
|
| 36 |
+
'switch', 'case', 'as', 'in', 'version', 'return', 'true',
|
| 37 |
+
'false', 'null'), prefix=r'\b', suffix=r'\b'),
|
| 38 |
+
Keyword),
|
| 39 |
+
(r'include\b', Keyword, 'include'),
|
| 40 |
+
(r'(cover)([ \t]+)(from)([ \t]+)(\w+[*@]?)',
|
| 41 |
+
bygroups(Keyword, Text, Keyword, Text, Name.Class)),
|
| 42 |
+
(r'(func)((?:[ \t]|\\\n)+)(~[a-z_]\w*)',
|
| 43 |
+
bygroups(Keyword, Text, Name.Function)),
|
| 44 |
+
(r'\bfunc\b', Keyword),
|
| 45 |
+
# Note: %= not listed on https://ooc-lang.github.io/docs/lang/operators/
|
| 46 |
+
(r'//.*', Comment),
|
| 47 |
+
(r'(?s)/\*.*?\*/', Comment.Multiline),
|
| 48 |
+
(r'(==?|\+=?|-[=>]?|\*=?|/=?|:=|!=?|%=?|\?|>{1,3}=?|<{1,3}=?|\.\.|'
|
| 49 |
+
r'&&?|\|\|?|\^=?)', Operator),
|
| 50 |
+
(r'(\.)([ \t]*)([a-z]\w*)', bygroups(Operator, Text,
|
| 51 |
+
Name.Function)),
|
| 52 |
+
(r'[A-Z][A-Z0-9_]+', Name.Constant),
|
| 53 |
+
(r'[A-Z]\w*([@*]|\[[ \t]*\])?', Name.Class),
|
| 54 |
+
|
| 55 |
+
(r'([a-z]\w*(?:~[a-z]\w*)?)((?:[ \t]|\\\n)*)(?=\()',
|
| 56 |
+
bygroups(Name.Function, Text)),
|
| 57 |
+
(r'[a-z]\w*', Name.Variable),
|
| 58 |
+
|
| 59 |
+
# : introduces types
|
| 60 |
+
(r'[:(){}\[\];,]', Punctuation),
|
| 61 |
+
|
| 62 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 63 |
+
(r'0c[0-9]+', Number.Oct),
|
| 64 |
+
(r'0b[01]+', Number.Bin),
|
| 65 |
+
(r'[0-9_]\.[0-9_]*(?!\.)', Number.Float),
|
| 66 |
+
(r'[0-9_]+', Number.Decimal),
|
| 67 |
+
|
| 68 |
+
(r'"(?:\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\"])*"',
|
| 69 |
+
String.Double),
|
| 70 |
+
(r"'(?:\\.|\\[0-9]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'",
|
| 71 |
+
String.Char),
|
| 72 |
+
(r'@', Punctuation), # pointer dereference
|
| 73 |
+
(r'\.', Punctuation), # imports or chain operator
|
| 74 |
+
|
| 75 |
+
(r'\\[ \t\n]', Text),
|
| 76 |
+
(r'[ \t]+', Text),
|
| 77 |
+
],
|
| 78 |
+
'include': [
|
| 79 |
+
(r'[\w/]+', Name),
|
| 80 |
+
(r',', Punctuation),
|
| 81 |
+
(r'[ \t]', Text),
|
| 82 |
+
(r'[;\n]', Text, '#pop'),
|
| 83 |
+
],
|
| 84 |
+
}
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/r.py
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.r
|
| 3 |
+
~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for the R/S 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 Lexer, RegexLexer, include, do_insertions
|
| 14 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 15 |
+
Number, Punctuation, Generic, Whitespace
|
| 16 |
+
|
| 17 |
+
__all__ = ['RConsoleLexer', 'SLexer', 'RdLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
line_re = re.compile('.*?\n')
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class RConsoleLexer(Lexer):
|
| 24 |
+
"""
|
| 25 |
+
For R console transcripts or R CMD BATCH output files.
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
name = 'RConsole'
|
| 29 |
+
aliases = ['rconsole', 'rout']
|
| 30 |
+
filenames = ['*.Rout']
|
| 31 |
+
url = 'https://www.r-project.org'
|
| 32 |
+
version_added = ''
|
| 33 |
+
_example = "rconsole/r-console-transcript.Rout"
|
| 34 |
+
|
| 35 |
+
def get_tokens_unprocessed(self, text):
|
| 36 |
+
slexer = SLexer(**self.options)
|
| 37 |
+
|
| 38 |
+
current_code_block = ''
|
| 39 |
+
insertions = []
|
| 40 |
+
|
| 41 |
+
for match in line_re.finditer(text):
|
| 42 |
+
line = match.group()
|
| 43 |
+
if line.startswith('>') or line.startswith('+'):
|
| 44 |
+
# Colorize the prompt as such,
|
| 45 |
+
# then put rest of line into current_code_block
|
| 46 |
+
insertions.append((len(current_code_block),
|
| 47 |
+
[(0, Generic.Prompt, line[:2])]))
|
| 48 |
+
current_code_block += line[2:]
|
| 49 |
+
else:
|
| 50 |
+
# We have reached a non-prompt line!
|
| 51 |
+
# If we have stored prompt lines, need to process them first.
|
| 52 |
+
if current_code_block:
|
| 53 |
+
# Weave together the prompts and highlight code.
|
| 54 |
+
yield from do_insertions(
|
| 55 |
+
insertions, slexer.get_tokens_unprocessed(current_code_block))
|
| 56 |
+
# Reset vars for next code block.
|
| 57 |
+
current_code_block = ''
|
| 58 |
+
insertions = []
|
| 59 |
+
# Now process the actual line itself, this is output from R.
|
| 60 |
+
yield match.start(), Generic.Output, line
|
| 61 |
+
|
| 62 |
+
# If we happen to end on a code block with nothing after it, need to
|
| 63 |
+
# process the last code block. This is neither elegant nor DRY so
|
| 64 |
+
# should be changed.
|
| 65 |
+
if current_code_block:
|
| 66 |
+
yield from do_insertions(
|
| 67 |
+
insertions, slexer.get_tokens_unprocessed(current_code_block))
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class SLexer(RegexLexer):
|
| 71 |
+
"""
|
| 72 |
+
For S, S-plus, and R source code.
|
| 73 |
+
"""
|
| 74 |
+
|
| 75 |
+
name = 'S'
|
| 76 |
+
aliases = ['splus', 's', 'r']
|
| 77 |
+
filenames = ['*.S', '*.R', '.Rhistory', '.Rprofile', '.Renviron']
|
| 78 |
+
mimetypes = ['text/S-plus', 'text/S', 'text/x-r-source', 'text/x-r',
|
| 79 |
+
'text/x-R', 'text/x-r-history', 'text/x-r-profile']
|
| 80 |
+
url = 'https://www.r-project.org'
|
| 81 |
+
version_added = '0.10'
|
| 82 |
+
|
| 83 |
+
valid_name = r'`[^`\\]*(?:\\.[^`\\]*)*`|(?:[a-zA-Z]|\.[A-Za-z_.])[\w.]*|\.'
|
| 84 |
+
tokens = {
|
| 85 |
+
'comments': [
|
| 86 |
+
(r'#.*$', Comment.Single),
|
| 87 |
+
],
|
| 88 |
+
'valid_name': [
|
| 89 |
+
(valid_name, Name),
|
| 90 |
+
],
|
| 91 |
+
'function_name': [
|
| 92 |
+
(rf'({valid_name})\s*(?=\()', Name.Function),
|
| 93 |
+
],
|
| 94 |
+
'punctuation': [
|
| 95 |
+
(r'\[{1,2}|\]{1,2}|\(|\)|;|,', Punctuation),
|
| 96 |
+
],
|
| 97 |
+
'keywords': [
|
| 98 |
+
(r'(if|else|for|while|repeat|in|next|break|return|switch|function)'
|
| 99 |
+
r'(?![\w.])',
|
| 100 |
+
Keyword.Reserved),
|
| 101 |
+
],
|
| 102 |
+
'operators': [
|
| 103 |
+
(r'<<?-|->>?|-|==|<=|>=|\|>|<|>|&&?|!=|\|\|?|\?', Operator),
|
| 104 |
+
(r'\*|\+|\^|/|!|%[^%]*%|=|~|\$|@|:{1,3}', Operator),
|
| 105 |
+
],
|
| 106 |
+
'builtin_symbols': [
|
| 107 |
+
(r'(NULL|NA(_(integer|real|complex|character)_)?|'
|
| 108 |
+
r'letters|LETTERS|Inf|TRUE|FALSE|NaN|pi|\.\.(\.|[0-9]+))'
|
| 109 |
+
r'(?![\w.])',
|
| 110 |
+
Keyword.Constant),
|
| 111 |
+
(r'(T|F)\b', Name.Builtin.Pseudo),
|
| 112 |
+
],
|
| 113 |
+
'numbers': [
|
| 114 |
+
# hex number
|
| 115 |
+
(r'0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?', Number.Hex),
|
| 116 |
+
# decimal number
|
| 117 |
+
(r'[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)([eE][+-]?[0-9]+)?[Li]?',
|
| 118 |
+
Number),
|
| 119 |
+
],
|
| 120 |
+
'statements': [
|
| 121 |
+
include('comments'),
|
| 122 |
+
# whitespaces
|
| 123 |
+
(r'\s+', Whitespace),
|
| 124 |
+
(r'\'', String, 'string_squote'),
|
| 125 |
+
(r'\"', String, 'string_dquote'),
|
| 126 |
+
include('builtin_symbols'),
|
| 127 |
+
include('keywords'),
|
| 128 |
+
include('function_name'),
|
| 129 |
+
include('valid_name'),
|
| 130 |
+
include('numbers'),
|
| 131 |
+
include('punctuation'),
|
| 132 |
+
include('operators'),
|
| 133 |
+
],
|
| 134 |
+
'root': [
|
| 135 |
+
# calls:
|
| 136 |
+
include('statements'),
|
| 137 |
+
# blocks:
|
| 138 |
+
(r'\{|\}', Punctuation),
|
| 139 |
+
# (r'\{', Punctuation, 'block'),
|
| 140 |
+
(r'.', Text),
|
| 141 |
+
],
|
| 142 |
+
# 'block': [
|
| 143 |
+
# include('statements'),
|
| 144 |
+
# ('\{', Punctuation, '#push'),
|
| 145 |
+
# ('\}', Punctuation, '#pop')
|
| 146 |
+
# ],
|
| 147 |
+
'string_squote': [
|
| 148 |
+
(r'([^\'\\]|\\.)*\'', String, '#pop'),
|
| 149 |
+
],
|
| 150 |
+
'string_dquote': [
|
| 151 |
+
(r'([^"\\]|\\.)*"', String, '#pop'),
|
| 152 |
+
],
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
def analyse_text(text):
|
| 156 |
+
if re.search(r'[a-z0-9_\])\s]<-(?!-)', text):
|
| 157 |
+
return 0.11
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
class RdLexer(RegexLexer):
|
| 161 |
+
"""
|
| 162 |
+
Pygments Lexer for R documentation (Rd) files
|
| 163 |
+
|
| 164 |
+
This is a very minimal implementation, highlighting little more
|
| 165 |
+
than the macros. A description of Rd syntax is found in `Writing R
|
| 166 |
+
Extensions <http://cran.r-project.org/doc/manuals/R-exts.html>`_
|
| 167 |
+
and `Parsing Rd files <http://developer.r-project.org/parseRd.pdf>`_.
|
| 168 |
+
"""
|
| 169 |
+
name = 'Rd'
|
| 170 |
+
aliases = ['rd']
|
| 171 |
+
filenames = ['*.Rd']
|
| 172 |
+
mimetypes = ['text/x-r-doc']
|
| 173 |
+
url = 'http://cran.r-project.org/doc/manuals/R-exts.html'
|
| 174 |
+
version_added = '1.6'
|
| 175 |
+
|
| 176 |
+
# To account for verbatim / LaTeX-like / and R-like areas
|
| 177 |
+
# would require parsing.
|
| 178 |
+
tokens = {
|
| 179 |
+
'root': [
|
| 180 |
+
# catch escaped brackets and percent sign
|
| 181 |
+
(r'\\[\\{}%]', String.Escape),
|
| 182 |
+
# comments
|
| 183 |
+
(r'%.*$', Comment),
|
| 184 |
+
# special macros with no arguments
|
| 185 |
+
(r'\\(?:cr|l?dots|R|tab)\b', Keyword.Constant),
|
| 186 |
+
# macros
|
| 187 |
+
(r'\\[a-zA-Z]+\b', Keyword),
|
| 188 |
+
# special preprocessor macros
|
| 189 |
+
(r'^\s*#(?:ifn?def|endif).*\b', Comment.Preproc),
|
| 190 |
+
# non-escaped brackets
|
| 191 |
+
(r'[{}]', Name.Builtin),
|
| 192 |
+
# everything else
|
| 193 |
+
(r'[^\\%\n{}]+', Text),
|
| 194 |
+
(r'.', Text),
|
| 195 |
+
]
|
| 196 |
+
}
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/scdoc.py
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.scdoc
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for scdoc, a simple man page generator.
|
| 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, this
|
| 14 |
+
from pygments.token import Text, Comment, Keyword, String, Generic
|
| 15 |
+
|
| 16 |
+
__all__ = ['ScdocLexer']
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class ScdocLexer(RegexLexer):
|
| 20 |
+
"""
|
| 21 |
+
`scdoc` is a simple man page generator for POSIX systems written in C99.
|
| 22 |
+
"""
|
| 23 |
+
name = 'scdoc'
|
| 24 |
+
url = 'https://git.sr.ht/~sircmpwn/scdoc'
|
| 25 |
+
aliases = ['scdoc', 'scd']
|
| 26 |
+
filenames = ['*.scd', '*.scdoc']
|
| 27 |
+
version_added = '2.5'
|
| 28 |
+
flags = re.MULTILINE
|
| 29 |
+
|
| 30 |
+
tokens = {
|
| 31 |
+
'root': [
|
| 32 |
+
# comment
|
| 33 |
+
(r'^(;.+\n)', bygroups(Comment)),
|
| 34 |
+
|
| 35 |
+
# heading with pound prefix
|
| 36 |
+
(r'^(#)([^#].+\n)', bygroups(Generic.Heading, Text)),
|
| 37 |
+
(r'^(#{2})(.+\n)', bygroups(Generic.Subheading, Text)),
|
| 38 |
+
# bulleted lists
|
| 39 |
+
(r'^(\s*)([*-])(\s)(.+\n)',
|
| 40 |
+
bygroups(Text, Keyword, Text, using(this, state='inline'))),
|
| 41 |
+
# numbered lists
|
| 42 |
+
(r'^(\s*)(\.+\.)( .+\n)',
|
| 43 |
+
bygroups(Text, Keyword, using(this, state='inline'))),
|
| 44 |
+
# quote
|
| 45 |
+
(r'^(\s*>\s)(.+\n)', bygroups(Keyword, Generic.Emph)),
|
| 46 |
+
# text block
|
| 47 |
+
(r'^(```\n)([\w\W]*?)(^```$)', bygroups(String, Text, String)),
|
| 48 |
+
|
| 49 |
+
include('inline'),
|
| 50 |
+
],
|
| 51 |
+
'inline': [
|
| 52 |
+
# escape
|
| 53 |
+
(r'\\.', Text),
|
| 54 |
+
# underlines
|
| 55 |
+
(r'(\s)(_[^_]+_)(\W|\n)', bygroups(Text, Generic.Emph, Text)),
|
| 56 |
+
# bold
|
| 57 |
+
(r'(\s)(\*[^*]+\*)(\W|\n)', bygroups(Text, Generic.Strong, Text)),
|
| 58 |
+
# inline code
|
| 59 |
+
(r'`[^`]+`', String.Backtick),
|
| 60 |
+
|
| 61 |
+
# general text, must come last!
|
| 62 |
+
(r'[^\\\s]+', Text),
|
| 63 |
+
(r'.', Text),
|
| 64 |
+
],
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
def analyse_text(text):
|
| 68 |
+
"""We checks for bold and underline text with * and _. Also
|
| 69 |
+
every scdoc file must start with a strictly defined first line."""
|
| 70 |
+
result = 0
|
| 71 |
+
|
| 72 |
+
if '*' in text:
|
| 73 |
+
result += 0.01
|
| 74 |
+
|
| 75 |
+
if '_' in text:
|
| 76 |
+
result += 0.01
|
| 77 |
+
|
| 78 |
+
# name(section) ["left_footer" ["center_header"]]
|
| 79 |
+
first_line = text.partition('\n')[0]
|
| 80 |
+
scdoc_preamble_pattern = r'^.*\([1-7]\)( "[^"]+"){0,2}$'
|
| 81 |
+
|
| 82 |
+
if re.search(scdoc_preamble_pattern, first_line):
|
| 83 |
+
result += 0.5
|
| 84 |
+
|
| 85 |
+
return result
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/teraterm.py
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.teraterm
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for Tera Term macro files.
|
| 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, Name, String, \
|
| 15 |
+
Number, Keyword, Error
|
| 16 |
+
|
| 17 |
+
__all__ = ['TeraTermLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class TeraTermLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
For Tera Term macro source code.
|
| 23 |
+
"""
|
| 24 |
+
name = 'Tera Term macro'
|
| 25 |
+
url = 'https://ttssh2.osdn.jp/'
|
| 26 |
+
aliases = ['teratermmacro', 'teraterm', 'ttl']
|
| 27 |
+
filenames = ['*.ttl']
|
| 28 |
+
mimetypes = ['text/x-teratermmacro']
|
| 29 |
+
version_added = '2.4'
|
| 30 |
+
|
| 31 |
+
tokens = {
|
| 32 |
+
'root': [
|
| 33 |
+
include('comments'),
|
| 34 |
+
include('labels'),
|
| 35 |
+
include('commands'),
|
| 36 |
+
include('builtin-variables'),
|
| 37 |
+
include('user-variables'),
|
| 38 |
+
include('operators'),
|
| 39 |
+
include('numeric-literals'),
|
| 40 |
+
include('string-literals'),
|
| 41 |
+
include('all-whitespace'),
|
| 42 |
+
(r'\S', Text),
|
| 43 |
+
],
|
| 44 |
+
'comments': [
|
| 45 |
+
(r';[^\r\n]*', Comment.Single),
|
| 46 |
+
(r'/\*', Comment.Multiline, 'in-comment'),
|
| 47 |
+
],
|
| 48 |
+
'in-comment': [
|
| 49 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 50 |
+
(r'[^*/]+', Comment.Multiline),
|
| 51 |
+
(r'[*/]', Comment.Multiline)
|
| 52 |
+
],
|
| 53 |
+
'labels': [
|
| 54 |
+
(r'(?i)^(\s*)(:[a-z0-9_]+)', bygroups(Text.Whitespace, Name.Label)),
|
| 55 |
+
],
|
| 56 |
+
'commands': [
|
| 57 |
+
(
|
| 58 |
+
r'(?i)\b('
|
| 59 |
+
r'basename|'
|
| 60 |
+
r'beep|'
|
| 61 |
+
r'bplusrecv|'
|
| 62 |
+
r'bplussend|'
|
| 63 |
+
r'break|'
|
| 64 |
+
r'bringupbox|'
|
| 65 |
+
# 'call' is handled separately.
|
| 66 |
+
r'callmenu|'
|
| 67 |
+
r'changedir|'
|
| 68 |
+
r'checksum16|'
|
| 69 |
+
r'checksum16file|'
|
| 70 |
+
r'checksum32|'
|
| 71 |
+
r'checksum32file|'
|
| 72 |
+
r'checksum8|'
|
| 73 |
+
r'checksum8file|'
|
| 74 |
+
r'clearscreen|'
|
| 75 |
+
r'clipb2var|'
|
| 76 |
+
r'closesbox|'
|
| 77 |
+
r'closett|'
|
| 78 |
+
r'code2str|'
|
| 79 |
+
r'connect|'
|
| 80 |
+
r'continue|'
|
| 81 |
+
r'crc16|'
|
| 82 |
+
r'crc16file|'
|
| 83 |
+
r'crc32|'
|
| 84 |
+
r'crc32file|'
|
| 85 |
+
r'cygconnect|'
|
| 86 |
+
r'delpassword|'
|
| 87 |
+
r'delpassword2|'
|
| 88 |
+
r'dirname|'
|
| 89 |
+
r'dirnamebox|'
|
| 90 |
+
r'disconnect|'
|
| 91 |
+
r'dispstr|'
|
| 92 |
+
r'do|'
|
| 93 |
+
r'else|'
|
| 94 |
+
r'elseif|'
|
| 95 |
+
r'enablekeyb|'
|
| 96 |
+
r'end|'
|
| 97 |
+
r'endif|'
|
| 98 |
+
r'enduntil|'
|
| 99 |
+
r'endwhile|'
|
| 100 |
+
r'exec|'
|
| 101 |
+
r'execcmnd|'
|
| 102 |
+
r'exit|'
|
| 103 |
+
r'expandenv|'
|
| 104 |
+
r'fileclose|'
|
| 105 |
+
r'fileconcat|'
|
| 106 |
+
r'filecopy|'
|
| 107 |
+
r'filecreate|'
|
| 108 |
+
r'filedelete|'
|
| 109 |
+
r'filelock|'
|
| 110 |
+
r'filemarkptr|'
|
| 111 |
+
r'filenamebox|'
|
| 112 |
+
r'fileopen|'
|
| 113 |
+
r'fileread|'
|
| 114 |
+
r'filereadln|'
|
| 115 |
+
r'filerename|'
|
| 116 |
+
r'filesearch|'
|
| 117 |
+
r'fileseek|'
|
| 118 |
+
r'fileseekback|'
|
| 119 |
+
r'filestat|'
|
| 120 |
+
r'filestrseek|'
|
| 121 |
+
r'filestrseek2|'
|
| 122 |
+
r'filetruncate|'
|
| 123 |
+
r'fileunlock|'
|
| 124 |
+
r'filewrite|'
|
| 125 |
+
r'filewriteln|'
|
| 126 |
+
r'findclose|'
|
| 127 |
+
r'findfirst|'
|
| 128 |
+
r'findnext|'
|
| 129 |
+
r'flushrecv|'
|
| 130 |
+
r'foldercreate|'
|
| 131 |
+
r'folderdelete|'
|
| 132 |
+
r'foldersearch|'
|
| 133 |
+
r'for|'
|
| 134 |
+
r'getdate|'
|
| 135 |
+
r'getdir|'
|
| 136 |
+
r'getenv|'
|
| 137 |
+
r'getfileattr|'
|
| 138 |
+
r'gethostname|'
|
| 139 |
+
r'getipv4addr|'
|
| 140 |
+
r'getipv6addr|'
|
| 141 |
+
r'getmodemstatus|'
|
| 142 |
+
r'getpassword|'
|
| 143 |
+
r'getpassword2|'
|
| 144 |
+
r'getspecialfolder|'
|
| 145 |
+
r'gettime|'
|
| 146 |
+
r'gettitle|'
|
| 147 |
+
r'getttdir|'
|
| 148 |
+
r'getttpos|'
|
| 149 |
+
r'getver|'
|
| 150 |
+
# 'goto' is handled separately.
|
| 151 |
+
r'if|'
|
| 152 |
+
r'ifdefined|'
|
| 153 |
+
r'include|'
|
| 154 |
+
r'inputbox|'
|
| 155 |
+
r'int2str|'
|
| 156 |
+
r'intdim|'
|
| 157 |
+
r'ispassword|'
|
| 158 |
+
r'ispassword2|'
|
| 159 |
+
r'kmtfinish|'
|
| 160 |
+
r'kmtget|'
|
| 161 |
+
r'kmtrecv|'
|
| 162 |
+
r'kmtsend|'
|
| 163 |
+
r'listbox|'
|
| 164 |
+
r'loadkeymap|'
|
| 165 |
+
r'logautoclosemode|'
|
| 166 |
+
r'logclose|'
|
| 167 |
+
r'loginfo|'
|
| 168 |
+
r'logopen|'
|
| 169 |
+
r'logpause|'
|
| 170 |
+
r'logrotate|'
|
| 171 |
+
r'logstart|'
|
| 172 |
+
r'logwrite|'
|
| 173 |
+
r'loop|'
|
| 174 |
+
r'makepath|'
|
| 175 |
+
r'messagebox|'
|
| 176 |
+
r'mpause|'
|
| 177 |
+
r'next|'
|
| 178 |
+
r'passwordbox|'
|
| 179 |
+
r'pause|'
|
| 180 |
+
r'quickvanrecv|'
|
| 181 |
+
r'quickvansend|'
|
| 182 |
+
r'random|'
|
| 183 |
+
r'recvfile'
|
| 184 |
+
r'recvln|'
|
| 185 |
+
r'regexoption|'
|
| 186 |
+
r'restoresetup|'
|
| 187 |
+
r'return|'
|
| 188 |
+
r'rotateleft|'
|
| 189 |
+
r'rotateright|'
|
| 190 |
+
r'scprecv|'
|
| 191 |
+
r'scpsend|'
|
| 192 |
+
r'send|'
|
| 193 |
+
r'sendbinary|'
|
| 194 |
+
r'sendbreak|'
|
| 195 |
+
r'sendbroadcast|'
|
| 196 |
+
r'sendfile|'
|
| 197 |
+
r'sendkcode|'
|
| 198 |
+
r'sendln|'
|
| 199 |
+
r'sendlnbroadcast|'
|
| 200 |
+
r'sendlnmulticast|'
|
| 201 |
+
r'sendmulticast|'
|
| 202 |
+
r'sendtext|'
|
| 203 |
+
r'setbaud|'
|
| 204 |
+
r'setdate|'
|
| 205 |
+
r'setdebug|'
|
| 206 |
+
r'setdir|'
|
| 207 |
+
r'setdlgpos|'
|
| 208 |
+
r'setdtr|'
|
| 209 |
+
r'setecho|'
|
| 210 |
+
r'setenv|'
|
| 211 |
+
r'setexitcode|'
|
| 212 |
+
r'setfileattr|'
|
| 213 |
+
r'setflowctrl|'
|
| 214 |
+
r'setmulticastname|'
|
| 215 |
+
r'setpassword|'
|
| 216 |
+
r'setpassword2|'
|
| 217 |
+
r'setrts|'
|
| 218 |
+
r'setserialdelaychar'
|
| 219 |
+
r'setserialdelayline'
|
| 220 |
+
r'setspeed|'
|
| 221 |
+
r'setsync|'
|
| 222 |
+
r'settime|'
|
| 223 |
+
r'settitle|'
|
| 224 |
+
r'show|'
|
| 225 |
+
r'showtt|'
|
| 226 |
+
r'sprintf|'
|
| 227 |
+
r'sprintf2|'
|
| 228 |
+
r'statusbox|'
|
| 229 |
+
r'str2code|'
|
| 230 |
+
r'str2int|'
|
| 231 |
+
r'strcompare|'
|
| 232 |
+
r'strconcat|'
|
| 233 |
+
r'strcopy|'
|
| 234 |
+
r'strdim|'
|
| 235 |
+
r'strinsert|'
|
| 236 |
+
r'strjoin|'
|
| 237 |
+
r'strlen|'
|
| 238 |
+
r'strmatch|'
|
| 239 |
+
r'strremove|'
|
| 240 |
+
r'strreplace|'
|
| 241 |
+
r'strscan|'
|
| 242 |
+
r'strspecial|'
|
| 243 |
+
r'strsplit|'
|
| 244 |
+
r'strtrim|'
|
| 245 |
+
r'testlink|'
|
| 246 |
+
r'then|'
|
| 247 |
+
r'tolower|'
|
| 248 |
+
r'toupper|'
|
| 249 |
+
r'unlink|'
|
| 250 |
+
r'until|'
|
| 251 |
+
r'uptime|'
|
| 252 |
+
r'var2clipb|'
|
| 253 |
+
r'wait|'
|
| 254 |
+
r'wait4all|'
|
| 255 |
+
r'waitevent|'
|
| 256 |
+
r'waitln|'
|
| 257 |
+
r'waitn|'
|
| 258 |
+
r'waitrecv|'
|
| 259 |
+
r'waitregex|'
|
| 260 |
+
r'while|'
|
| 261 |
+
r'xmodemrecv|'
|
| 262 |
+
r'xmodemsend|'
|
| 263 |
+
r'yesnobox|'
|
| 264 |
+
r'ymodemrecv|'
|
| 265 |
+
r'ymodemsend|'
|
| 266 |
+
r'zmodemrecv|'
|
| 267 |
+
r'zmodemsend'
|
| 268 |
+
r')\b',
|
| 269 |
+
Keyword,
|
| 270 |
+
),
|
| 271 |
+
(r'(?i)(call|goto)([ \t]+)([a-z0-9_]+)',
|
| 272 |
+
bygroups(Keyword, Text.Whitespace, Name.Label)),
|
| 273 |
+
],
|
| 274 |
+
'builtin-variables': [
|
| 275 |
+
(
|
| 276 |
+
r'(?i)('
|
| 277 |
+
r'groupmatchstr1|'
|
| 278 |
+
r'groupmatchstr2|'
|
| 279 |
+
r'groupmatchstr3|'
|
| 280 |
+
r'groupmatchstr4|'
|
| 281 |
+
r'groupmatchstr5|'
|
| 282 |
+
r'groupmatchstr6|'
|
| 283 |
+
r'groupmatchstr7|'
|
| 284 |
+
r'groupmatchstr8|'
|
| 285 |
+
r'groupmatchstr9|'
|
| 286 |
+
r'inputstr|'
|
| 287 |
+
r'matchstr|'
|
| 288 |
+
r'mtimeout|'
|
| 289 |
+
r'param1|'
|
| 290 |
+
r'param2|'
|
| 291 |
+
r'param3|'
|
| 292 |
+
r'param4|'
|
| 293 |
+
r'param5|'
|
| 294 |
+
r'param6|'
|
| 295 |
+
r'param7|'
|
| 296 |
+
r'param8|'
|
| 297 |
+
r'param9|'
|
| 298 |
+
r'paramcnt|'
|
| 299 |
+
r'params|'
|
| 300 |
+
r'result|'
|
| 301 |
+
r'timeout'
|
| 302 |
+
r')\b',
|
| 303 |
+
Name.Builtin
|
| 304 |
+
),
|
| 305 |
+
],
|
| 306 |
+
'user-variables': [
|
| 307 |
+
(r'(?i)[a-z_][a-z0-9_]*', Name.Variable),
|
| 308 |
+
],
|
| 309 |
+
'numeric-literals': [
|
| 310 |
+
(r'(-?)([0-9]+)', bygroups(Operator, Number.Integer)),
|
| 311 |
+
(r'(?i)\$[0-9a-f]+', Number.Hex),
|
| 312 |
+
],
|
| 313 |
+
'string-literals': [
|
| 314 |
+
(r'(?i)#(?:[0-9]+|\$[0-9a-f]+)', String.Char),
|
| 315 |
+
(r"'[^'\n]*'", String.Single),
|
| 316 |
+
(r'"[^"\n]*"', String.Double),
|
| 317 |
+
# Opening quotes without a closing quote on the same line are errors.
|
| 318 |
+
(r"('[^']*)(\n)", bygroups(Error, Text.Whitespace)),
|
| 319 |
+
(r'("[^"]*)(\n)', bygroups(Error, Text.Whitespace)),
|
| 320 |
+
],
|
| 321 |
+
'operators': [
|
| 322 |
+
(r'and|not|or|xor', Operator.Word),
|
| 323 |
+
(r'[!%&*+<=>^~\|\/-]+', Operator),
|
| 324 |
+
(r'[()]', String.Symbol),
|
| 325 |
+
],
|
| 326 |
+
'all-whitespace': [
|
| 327 |
+
(r'\s+', Text.Whitespace),
|
| 328 |
+
],
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
# Turtle and Tera Term macro files share the same file extension
|
| 332 |
+
# but each has a recognizable and distinct syntax.
|
| 333 |
+
def analyse_text(text):
|
| 334 |
+
if re.search(TeraTermLexer.tokens['commands'][0][0], text):
|
| 335 |
+
return 0.01
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/tnt.py
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import Lexer
|
| 14 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, Number, \
|
| 15 |
+
Punctuation, Error
|
| 16 |
+
|
| 17 |
+
__all__ = ['TNTLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class TNTLexer(Lexer):
|
| 21 |
+
"""
|
| 22 |
+
Lexer for Typographic Number Theory, as described in the book
|
| 23 |
+
Gödel, Escher, Bach, by Douglas R. Hofstadter
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
name = 'Typographic Number Theory'
|
| 27 |
+
url = 'https://github.com/Kenny2github/language-tnt'
|
| 28 |
+
aliases = ['tnt']
|
| 29 |
+
filenames = ['*.tnt']
|
| 30 |
+
version_added = '2.7'
|
| 31 |
+
|
| 32 |
+
cur = []
|
| 33 |
+
|
| 34 |
+
LOGIC = set('⊃→]&∧^|∨Vv')
|
| 35 |
+
OPERATORS = set('+.⋅*')
|
| 36 |
+
VARIABLES = set('abcde')
|
| 37 |
+
PRIMES = set("'′")
|
| 38 |
+
NEGATORS = set('~!')
|
| 39 |
+
QUANTIFIERS = set('AE∀∃')
|
| 40 |
+
NUMBERS = set('0123456789')
|
| 41 |
+
WHITESPACE = set('\t \v\n')
|
| 42 |
+
|
| 43 |
+
RULES = re.compile('''(?xi)
|
| 44 |
+
joining | separation | double-tilde | fantasy\\ rule
|
| 45 |
+
| carry[- ]over(?:\\ of)?(?:\\ line)?\\ ([0-9]+) | detachment
|
| 46 |
+
| contrapositive | De\\ Morgan | switcheroo
|
| 47 |
+
| specification | generalization | interchange
|
| 48 |
+
| existence | symmetry | transitivity
|
| 49 |
+
| add\\ S | drop\\ S | induction
|
| 50 |
+
| axiom\\ ([1-5]) | premise | push | pop
|
| 51 |
+
''')
|
| 52 |
+
LINENOS = re.compile(r'(?:[0-9]+)(?:(?:, ?|,? and )(?:[0-9]+))*')
|
| 53 |
+
COMMENT = re.compile(r'\[[^\n\]]+\]')
|
| 54 |
+
|
| 55 |
+
def __init__(self, *args, **kwargs):
|
| 56 |
+
Lexer.__init__(self, *args, **kwargs)
|
| 57 |
+
self.cur = []
|
| 58 |
+
|
| 59 |
+
def whitespace(self, start, text, required=False):
|
| 60 |
+
"""Tokenize whitespace."""
|
| 61 |
+
end = start
|
| 62 |
+
try:
|
| 63 |
+
while text[end] in self.WHITESPACE:
|
| 64 |
+
end += 1
|
| 65 |
+
except IndexError:
|
| 66 |
+
end = len(text)
|
| 67 |
+
if required and end == start:
|
| 68 |
+
raise AssertionError
|
| 69 |
+
if end != start:
|
| 70 |
+
self.cur.append((start, Text, text[start:end]))
|
| 71 |
+
return end
|
| 72 |
+
|
| 73 |
+
def variable(self, start, text):
|
| 74 |
+
"""Tokenize a variable."""
|
| 75 |
+
if text[start] not in self.VARIABLES:
|
| 76 |
+
raise AssertionError
|
| 77 |
+
end = start+1
|
| 78 |
+
while text[end] in self.PRIMES:
|
| 79 |
+
end += 1
|
| 80 |
+
self.cur.append((start, Name.Variable, text[start:end]))
|
| 81 |
+
return end
|
| 82 |
+
|
| 83 |
+
def term(self, start, text):
|
| 84 |
+
"""Tokenize a term."""
|
| 85 |
+
if text[start] == 'S': # S...S(...) or S...0
|
| 86 |
+
end = start+1
|
| 87 |
+
while text[end] == 'S':
|
| 88 |
+
end += 1
|
| 89 |
+
self.cur.append((start, Number.Integer, text[start:end]))
|
| 90 |
+
return self.term(end, text)
|
| 91 |
+
if text[start] == '0': # the singleton 0
|
| 92 |
+
self.cur.append((start, Number.Integer, text[start]))
|
| 93 |
+
return start+1
|
| 94 |
+
if text[start] in self.VARIABLES: # a''...
|
| 95 |
+
return self.variable(start, text)
|
| 96 |
+
if text[start] == '(': # (...+...)
|
| 97 |
+
self.cur.append((start, Punctuation, text[start]))
|
| 98 |
+
start = self.term(start+1, text)
|
| 99 |
+
if text[start] not in self.OPERATORS:
|
| 100 |
+
raise AssertionError
|
| 101 |
+
self.cur.append((start, Operator, text[start]))
|
| 102 |
+
start = self.term(start+1, text)
|
| 103 |
+
if text[start] != ')':
|
| 104 |
+
raise AssertionError
|
| 105 |
+
self.cur.append((start, Punctuation, text[start]))
|
| 106 |
+
return start+1
|
| 107 |
+
raise AssertionError # no matches
|
| 108 |
+
|
| 109 |
+
def formula(self, start, text):
|
| 110 |
+
"""Tokenize a formula."""
|
| 111 |
+
if text[start] in self.NEGATORS: # ~<...>
|
| 112 |
+
end = start+1
|
| 113 |
+
while text[end] in self.NEGATORS:
|
| 114 |
+
end += 1
|
| 115 |
+
self.cur.append((start, Operator, text[start:end]))
|
| 116 |
+
return self.formula(end, text)
|
| 117 |
+
if text[start] in self.QUANTIFIERS: # Aa:<...>
|
| 118 |
+
self.cur.append((start, Keyword.Declaration, text[start]))
|
| 119 |
+
start = self.variable(start+1, text)
|
| 120 |
+
if text[start] != ':':
|
| 121 |
+
raise AssertionError
|
| 122 |
+
self.cur.append((start, Punctuation, text[start]))
|
| 123 |
+
return self.formula(start+1, text)
|
| 124 |
+
if text[start] == '<': # <...&...>
|
| 125 |
+
self.cur.append((start, Punctuation, text[start]))
|
| 126 |
+
start = self.formula(start+1, text)
|
| 127 |
+
if text[start] not in self.LOGIC:
|
| 128 |
+
raise AssertionError
|
| 129 |
+
self.cur.append((start, Operator, text[start]))
|
| 130 |
+
start = self.formula(start+1, text)
|
| 131 |
+
if text[start] != '>':
|
| 132 |
+
raise AssertionError
|
| 133 |
+
self.cur.append((start, Punctuation, text[start]))
|
| 134 |
+
return start+1
|
| 135 |
+
# ...=...
|
| 136 |
+
start = self.term(start, text)
|
| 137 |
+
if text[start] != '=':
|
| 138 |
+
raise AssertionError
|
| 139 |
+
self.cur.append((start, Operator, text[start]))
|
| 140 |
+
start = self.term(start+1, text)
|
| 141 |
+
return start
|
| 142 |
+
|
| 143 |
+
def rule(self, start, text):
|
| 144 |
+
"""Tokenize a rule."""
|
| 145 |
+
match = self.RULES.match(text, start)
|
| 146 |
+
if match is None:
|
| 147 |
+
raise AssertionError
|
| 148 |
+
groups = sorted(match.regs[1:]) # exclude whole match
|
| 149 |
+
for group in groups:
|
| 150 |
+
if group[0] >= 0: # this group matched
|
| 151 |
+
self.cur.append((start, Keyword, text[start:group[0]]))
|
| 152 |
+
self.cur.append((group[0], Number.Integer,
|
| 153 |
+
text[group[0]:group[1]]))
|
| 154 |
+
if group[1] != match.end():
|
| 155 |
+
self.cur.append((group[1], Keyword,
|
| 156 |
+
text[group[1]:match.end()]))
|
| 157 |
+
break
|
| 158 |
+
else:
|
| 159 |
+
self.cur.append((start, Keyword, text[start:match.end()]))
|
| 160 |
+
return match.end()
|
| 161 |
+
|
| 162 |
+
def lineno(self, start, text):
|
| 163 |
+
"""Tokenize a line referral."""
|
| 164 |
+
end = start
|
| 165 |
+
while text[end] not in self.NUMBERS:
|
| 166 |
+
end += 1
|
| 167 |
+
self.cur.append((start, Punctuation, text[start]))
|
| 168 |
+
self.cur.append((start+1, Text, text[start+1:end]))
|
| 169 |
+
start = end
|
| 170 |
+
match = self.LINENOS.match(text, start)
|
| 171 |
+
if match is None:
|
| 172 |
+
raise AssertionError
|
| 173 |
+
if text[match.end()] != ')':
|
| 174 |
+
raise AssertionError
|
| 175 |
+
self.cur.append((match.start(), Number.Integer, match.group(0)))
|
| 176 |
+
self.cur.append((match.end(), Punctuation, text[match.end()]))
|
| 177 |
+
return match.end() + 1
|
| 178 |
+
|
| 179 |
+
def error_till_line_end(self, start, text):
|
| 180 |
+
"""Mark everything from ``start`` to the end of the line as Error."""
|
| 181 |
+
end = start
|
| 182 |
+
try:
|
| 183 |
+
while text[end] != '\n': # there's whitespace in rules
|
| 184 |
+
end += 1
|
| 185 |
+
except IndexError:
|
| 186 |
+
end = len(text)
|
| 187 |
+
if end != start:
|
| 188 |
+
self.cur.append((start, Error, text[start:end]))
|
| 189 |
+
end = self.whitespace(end, text)
|
| 190 |
+
return end
|
| 191 |
+
|
| 192 |
+
def get_tokens_unprocessed(self, text):
|
| 193 |
+
"""Returns a list of TNT tokens."""
|
| 194 |
+
self.cur = []
|
| 195 |
+
start = end = self.whitespace(0, text)
|
| 196 |
+
while start <= end < len(text):
|
| 197 |
+
try:
|
| 198 |
+
# try line number
|
| 199 |
+
while text[end] in self.NUMBERS:
|
| 200 |
+
end += 1
|
| 201 |
+
if end != start: # actual number present
|
| 202 |
+
self.cur.append((start, Number.Integer, text[start:end]))
|
| 203 |
+
# whitespace is required after a line number
|
| 204 |
+
orig = len(self.cur)
|
| 205 |
+
try:
|
| 206 |
+
start = end = self.whitespace(end, text, True)
|
| 207 |
+
except AssertionError:
|
| 208 |
+
del self.cur[orig:]
|
| 209 |
+
start = end = self.error_till_line_end(end, text)
|
| 210 |
+
continue
|
| 211 |
+
# at this point it could be a comment
|
| 212 |
+
match = self.COMMENT.match(text, start)
|
| 213 |
+
if match is not None:
|
| 214 |
+
self.cur.append((start, Comment, text[start:match.end()]))
|
| 215 |
+
start = end = match.end()
|
| 216 |
+
# anything after the closing bracket is invalid
|
| 217 |
+
start = end = self.error_till_line_end(start, text)
|
| 218 |
+
# do not attempt to process the rest
|
| 219 |
+
continue
|
| 220 |
+
del match
|
| 221 |
+
if text[start] in '[]': # fantasy push or pop
|
| 222 |
+
self.cur.append((start, Keyword, text[start]))
|
| 223 |
+
start += 1
|
| 224 |
+
end += 1
|
| 225 |
+
else:
|
| 226 |
+
# one formula, possibly containing subformulae
|
| 227 |
+
orig = len(self.cur)
|
| 228 |
+
try:
|
| 229 |
+
start = end = self.formula(start, text)
|
| 230 |
+
except (AssertionError, RecursionError): # not well-formed
|
| 231 |
+
del self.cur[orig:]
|
| 232 |
+
while text[end] not in self.WHITESPACE:
|
| 233 |
+
end += 1
|
| 234 |
+
self.cur.append((start, Error, text[start:end]))
|
| 235 |
+
start = end
|
| 236 |
+
# skip whitespace after formula
|
| 237 |
+
orig = len(self.cur)
|
| 238 |
+
try:
|
| 239 |
+
start = end = self.whitespace(end, text, True)
|
| 240 |
+
except AssertionError:
|
| 241 |
+
del self.cur[orig:]
|
| 242 |
+
start = end = self.error_till_line_end(start, text)
|
| 243 |
+
continue
|
| 244 |
+
# rule proving this formula a theorem
|
| 245 |
+
orig = len(self.cur)
|
| 246 |
+
try:
|
| 247 |
+
start = end = self.rule(start, text)
|
| 248 |
+
except AssertionError:
|
| 249 |
+
del self.cur[orig:]
|
| 250 |
+
start = end = self.error_till_line_end(start, text)
|
| 251 |
+
continue
|
| 252 |
+
# skip whitespace after rule
|
| 253 |
+
start = end = self.whitespace(end, text)
|
| 254 |
+
# line marker
|
| 255 |
+
if text[start] == '(':
|
| 256 |
+
orig = len(self.cur)
|
| 257 |
+
try:
|
| 258 |
+
start = end = self.lineno(start, text)
|
| 259 |
+
except AssertionError:
|
| 260 |
+
del self.cur[orig:]
|
| 261 |
+
start = end = self.error_till_line_end(start, text)
|
| 262 |
+
continue
|
| 263 |
+
start = end = self.whitespace(start, text)
|
| 264 |
+
except IndexError:
|
| 265 |
+
try:
|
| 266 |
+
del self.cur[orig:]
|
| 267 |
+
except NameError:
|
| 268 |
+
pass # if orig was never defined, fine
|
| 269 |
+
self.error_till_line_end(start, text)
|
| 270 |
+
return self.cur
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/urbi.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.urbi
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for UrbiScript 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 ExtendedRegexLexer, words
|
| 14 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 15 |
+
Number, Punctuation
|
| 16 |
+
|
| 17 |
+
__all__ = ['UrbiscriptLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class UrbiscriptLexer(ExtendedRegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
For UrbiScript source code.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
name = 'UrbiScript'
|
| 26 |
+
aliases = ['urbiscript']
|
| 27 |
+
filenames = ['*.u']
|
| 28 |
+
mimetypes = ['application/x-urbiscript']
|
| 29 |
+
url = 'https://github.com/urbiforge/urbi'
|
| 30 |
+
version_added = '1.5'
|
| 31 |
+
|
| 32 |
+
flags = re.DOTALL
|
| 33 |
+
|
| 34 |
+
# TODO
|
| 35 |
+
# - handle Experimental and deprecated tags with specific tokens
|
| 36 |
+
# - handle Angles and Durations with specific tokens
|
| 37 |
+
|
| 38 |
+
def blob_callback(lexer, match, ctx):
|
| 39 |
+
text_before_blob = match.group(1)
|
| 40 |
+
blob_start = match.group(2)
|
| 41 |
+
blob_size_str = match.group(3)
|
| 42 |
+
blob_size = int(blob_size_str)
|
| 43 |
+
yield match.start(), String, text_before_blob
|
| 44 |
+
ctx.pos += len(text_before_blob)
|
| 45 |
+
|
| 46 |
+
# if blob size doesn't match blob format (example : "\B(2)(aaa)")
|
| 47 |
+
# yield blob as a string
|
| 48 |
+
if ctx.text[match.end() + blob_size] != ")":
|
| 49 |
+
result = "\\B(" + blob_size_str + ")("
|
| 50 |
+
yield match.start(), String, result
|
| 51 |
+
ctx.pos += len(result)
|
| 52 |
+
return
|
| 53 |
+
|
| 54 |
+
# if blob is well formatted, yield as Escape
|
| 55 |
+
blob_text = blob_start + ctx.text[match.end():match.end()+blob_size] + ")"
|
| 56 |
+
yield match.start(), String.Escape, blob_text
|
| 57 |
+
ctx.pos = match.end() + blob_size + 1 # +1 is the ending ")"
|
| 58 |
+
|
| 59 |
+
tokens = {
|
| 60 |
+
'root': [
|
| 61 |
+
(r'\s+', Text),
|
| 62 |
+
# comments
|
| 63 |
+
(r'//.*?\n', Comment),
|
| 64 |
+
(r'/\*', Comment.Multiline, 'comment'),
|
| 65 |
+
(r'(every|for|loop|while)(?:;|&|\||,)', Keyword),
|
| 66 |
+
(words((
|
| 67 |
+
'assert', 'at', 'break', 'case', 'catch', 'closure', 'compl',
|
| 68 |
+
'continue', 'default', 'else', 'enum', 'every', 'external',
|
| 69 |
+
'finally', 'for', 'freezeif', 'if', 'new', 'onleave', 'return',
|
| 70 |
+
'stopif', 'switch', 'this', 'throw', 'timeout', 'try',
|
| 71 |
+
'waituntil', 'whenever', 'while'), suffix=r'\b'),
|
| 72 |
+
Keyword),
|
| 73 |
+
(words((
|
| 74 |
+
'asm', 'auto', 'bool', 'char', 'const_cast', 'delete', 'double',
|
| 75 |
+
'dynamic_cast', 'explicit', 'export', 'extern', 'float', 'friend',
|
| 76 |
+
'goto', 'inline', 'int', 'long', 'mutable', 'namespace', 'register',
|
| 77 |
+
'reinterpret_cast', 'short', 'signed', 'sizeof', 'static_cast',
|
| 78 |
+
'struct', 'template', 'typedef', 'typeid', 'typename', 'union',
|
| 79 |
+
'unsigned', 'using', 'virtual', 'volatile', 'wchar_t'), suffix=r'\b'),
|
| 80 |
+
Keyword.Reserved),
|
| 81 |
+
# deprecated keywords, use a meaningful token when available
|
| 82 |
+
(r'(emit|foreach|internal|loopn|static)\b', Keyword),
|
| 83 |
+
# ignored keywords, use a meaningful token when available
|
| 84 |
+
(r'(private|protected|public)\b', Keyword),
|
| 85 |
+
(r'(var|do|const|function|class)\b', Keyword.Declaration),
|
| 86 |
+
(r'(true|false|nil|void)\b', Keyword.Constant),
|
| 87 |
+
(words((
|
| 88 |
+
'Barrier', 'Binary', 'Boolean', 'CallMessage', 'Channel', 'Code',
|
| 89 |
+
'Comparable', 'Container', 'Control', 'Date', 'Dictionary', 'Directory',
|
| 90 |
+
'Duration', 'Enumeration', 'Event', 'Exception', 'Executable', 'File',
|
| 91 |
+
'Finalizable', 'Float', 'FormatInfo', 'Formatter', 'Global', 'Group',
|
| 92 |
+
'Hash', 'InputStream', 'IoService', 'Job', 'Kernel', 'Lazy', 'List',
|
| 93 |
+
'Loadable', 'Lobby', 'Location', 'Logger', 'Math', 'Mutex', 'nil',
|
| 94 |
+
'Object', 'Orderable', 'OutputStream', 'Pair', 'Path', 'Pattern',
|
| 95 |
+
'Position', 'Primitive', 'Process', 'Profile', 'PseudoLazy', 'PubSub',
|
| 96 |
+
'RangeIterable', 'Regexp', 'Semaphore', 'Server', 'Singleton', 'Socket',
|
| 97 |
+
'StackFrame', 'Stream', 'String', 'System', 'Tag', 'Timeout',
|
| 98 |
+
'Traceable', 'TrajectoryGenerator', 'Triplet', 'Tuple', 'UObject',
|
| 99 |
+
'UValue', 'UVar'), suffix=r'\b'),
|
| 100 |
+
Name.Builtin),
|
| 101 |
+
(r'(?:this)\b', Name.Builtin.Pseudo),
|
| 102 |
+
# don't match single | and &
|
| 103 |
+
(r'(?:[-=+*%/<>~^:]+|\.&?|\|\||&&)', Operator),
|
| 104 |
+
(r'(?:and_eq|and|bitand|bitor|in|not|not_eq|or_eq|or|xor_eq|xor)\b',
|
| 105 |
+
Operator.Word),
|
| 106 |
+
(r'[{}\[\]()]+', Punctuation),
|
| 107 |
+
(r'(?:;|\||,|&|\?|!)+', Punctuation),
|
| 108 |
+
(r'[$a-zA-Z_]\w*', Name.Other),
|
| 109 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 110 |
+
# Float, Integer, Angle and Duration
|
| 111 |
+
(r'(?:[0-9]+(?:(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?)?'
|
| 112 |
+
r'((?:rad|deg|grad)|(?:ms|s|min|h|d))?)\b', Number.Float),
|
| 113 |
+
# handle binary blob in strings
|
| 114 |
+
(r'"', String.Double, "string.double"),
|
| 115 |
+
(r"'", String.Single, "string.single"),
|
| 116 |
+
],
|
| 117 |
+
'string.double': [
|
| 118 |
+
(r'((?:\\\\|\\"|[^"])*?)(\\B\((\d+)\)\()', blob_callback),
|
| 119 |
+
(r'(\\\\|\\[^\\]|[^"\\])*?"', String.Double, '#pop'),
|
| 120 |
+
],
|
| 121 |
+
'string.single': [
|
| 122 |
+
(r"((?:\\\\|\\'|[^'])*?)(\\B\((\d+)\)\()", blob_callback),
|
| 123 |
+
(r"(\\\\|\\[^\\]|[^'\\])*?'", String.Single, '#pop'),
|
| 124 |
+
],
|
| 125 |
+
# from http://pygments.org/docs/lexerdevelopment/#changing-states
|
| 126 |
+
'comment': [
|
| 127 |
+
(r'[^*/]', Comment.Multiline),
|
| 128 |
+
(r'/\*', Comment.Multiline, '#push'),
|
| 129 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 130 |
+
(r'[*/]', Comment.Multiline),
|
| 131 |
+
]
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
def analyse_text(text):
|
| 135 |
+
"""This is fairly similar to C and others, but freezeif and
|
| 136 |
+
waituntil are unique keywords."""
|
| 137 |
+
result = 0
|
| 138 |
+
|
| 139 |
+
if 'freezeif' in text:
|
| 140 |
+
result += 0.05
|
| 141 |
+
|
| 142 |
+
if 'waituntil' in text:
|
| 143 |
+
result += 0.05
|
| 144 |
+
|
| 145 |
+
return result
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/webmisc.py
ADDED
|
@@ -0,0 +1,1006 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.webmisc
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for misc. web stuff.
|
| 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, ExtendedRegexLexer, include, bygroups, \
|
| 14 |
+
default, using
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Literal, Whitespace
|
| 17 |
+
|
| 18 |
+
from pygments.lexers.css import _indentation, _starts_block
|
| 19 |
+
from pygments.lexers.html import HtmlLexer
|
| 20 |
+
from pygments.lexers.javascript import JavascriptLexer
|
| 21 |
+
from pygments.lexers.ruby import RubyLexer
|
| 22 |
+
|
| 23 |
+
__all__ = ['DuelLexer', 'SlimLexer', 'XQueryLexer', 'QmlLexer', 'CirruLexer']
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class DuelLexer(RegexLexer):
|
| 27 |
+
"""
|
| 28 |
+
Lexer for Duel Views Engine (formerly JBST) markup with JavaScript code blocks.
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
name = 'Duel'
|
| 32 |
+
url = 'http://duelengine.org/'
|
| 33 |
+
aliases = ['duel', 'jbst', 'jsonml+bst']
|
| 34 |
+
filenames = ['*.duel', '*.jbst']
|
| 35 |
+
mimetypes = ['text/x-duel', 'text/x-jbst']
|
| 36 |
+
version_added = '1.4'
|
| 37 |
+
|
| 38 |
+
flags = re.DOTALL
|
| 39 |
+
|
| 40 |
+
tokens = {
|
| 41 |
+
'root': [
|
| 42 |
+
(r'(<%[@=#!:]?)(.*?)(%>)',
|
| 43 |
+
bygroups(Name.Tag, using(JavascriptLexer), Name.Tag)),
|
| 44 |
+
(r'(<%\$)(.*?)(:)(.*?)(%>)',
|
| 45 |
+
bygroups(Name.Tag, Name.Function, Punctuation, String, Name.Tag)),
|
| 46 |
+
(r'(<%--)(.*?)(--%>)',
|
| 47 |
+
bygroups(Name.Tag, Comment.Multiline, Name.Tag)),
|
| 48 |
+
(r'(<script.*?>)(.*?)(</script>)',
|
| 49 |
+
bygroups(using(HtmlLexer),
|
| 50 |
+
using(JavascriptLexer), using(HtmlLexer))),
|
| 51 |
+
(r'(.+?)(?=<)', using(HtmlLexer)),
|
| 52 |
+
(r'.+', using(HtmlLexer)),
|
| 53 |
+
],
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class XQueryLexer(ExtendedRegexLexer):
|
| 58 |
+
"""
|
| 59 |
+
An XQuery lexer, parsing a stream and outputting the tokens needed to
|
| 60 |
+
highlight xquery code.
|
| 61 |
+
"""
|
| 62 |
+
name = 'XQuery'
|
| 63 |
+
url = 'https://www.w3.org/XML/Query/'
|
| 64 |
+
aliases = ['xquery', 'xqy', 'xq', 'xql', 'xqm']
|
| 65 |
+
filenames = ['*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm']
|
| 66 |
+
mimetypes = ['text/xquery', 'application/xquery']
|
| 67 |
+
version_added = '1.4'
|
| 68 |
+
|
| 69 |
+
xquery_parse_state = []
|
| 70 |
+
|
| 71 |
+
# FIX UNICODE LATER
|
| 72 |
+
# ncnamestartchar = (
|
| 73 |
+
# r"[A-Z]|_|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|"
|
| 74 |
+
# r"[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|"
|
| 75 |
+
# r"[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|"
|
| 76 |
+
# r"[\u10000-\uEFFFF]"
|
| 77 |
+
# )
|
| 78 |
+
ncnamestartchar = r"(?:[A-Z]|_|[a-z])"
|
| 79 |
+
# FIX UNICODE LATER
|
| 80 |
+
# ncnamechar = ncnamestartchar + (r"|-|\.|[0-9]|\u00B7|[\u0300-\u036F]|"
|
| 81 |
+
# r"[\u203F-\u2040]")
|
| 82 |
+
ncnamechar = r"(?:" + ncnamestartchar + r"|-|\.|[0-9])"
|
| 83 |
+
ncname = f"(?:{ncnamestartchar}+{ncnamechar}*)"
|
| 84 |
+
pitarget_namestartchar = r"(?:[A-KN-WYZ]|_|:|[a-kn-wyz])"
|
| 85 |
+
pitarget_namechar = r"(?:" + pitarget_namestartchar + r"|-|\.|[0-9])"
|
| 86 |
+
pitarget = f"{pitarget_namestartchar}+{pitarget_namechar}*"
|
| 87 |
+
prefixedname = f"{ncname}:{ncname}"
|
| 88 |
+
unprefixedname = ncname
|
| 89 |
+
qname = f"(?:{prefixedname}|{unprefixedname})"
|
| 90 |
+
|
| 91 |
+
entityref = r'(?:&(?:lt|gt|amp|quot|apos|nbsp);)'
|
| 92 |
+
charref = r'(?:&#[0-9]+;|&#x[0-9a-fA-F]+;)'
|
| 93 |
+
|
| 94 |
+
stringdouble = r'(?:"(?:' + entityref + r'|' + charref + r'|""|[^&"])*")'
|
| 95 |
+
stringsingle = r"(?:'(?:" + entityref + r"|" + charref + r"|''|[^&'])*')"
|
| 96 |
+
|
| 97 |
+
# FIX UNICODE LATER
|
| 98 |
+
# elementcontentchar = (r'\t|\r|\n|[\u0020-\u0025]|[\u0028-\u003b]|'
|
| 99 |
+
# r'[\u003d-\u007a]|\u007c|[\u007e-\u007F]')
|
| 100 |
+
elementcontentchar = r'[A-Za-z]|\s|\d|[!"#$%()*+,\-./:;=?@\[\\\]^_\'`|~]'
|
| 101 |
+
# quotattrcontentchar = (r'\t|\r|\n|[\u0020-\u0021]|[\u0023-\u0025]|'
|
| 102 |
+
# r'[\u0027-\u003b]|[\u003d-\u007a]|\u007c|[\u007e-\u007F]')
|
| 103 |
+
quotattrcontentchar = r'[A-Za-z]|\s|\d|[!#$%()*+,\-./:;=?@\[\\\]^_\'`|~]'
|
| 104 |
+
# aposattrcontentchar = (r'\t|\r|\n|[\u0020-\u0025]|[\u0028-\u003b]|'
|
| 105 |
+
# r'[\u003d-\u007a]|\u007c|[\u007e-\u007F]')
|
| 106 |
+
aposattrcontentchar = r'[A-Za-z]|\s|\d|[!"#$%()*+,\-./:;=?@\[\\\]^_`|~]'
|
| 107 |
+
|
| 108 |
+
# CHAR elements - fix the above elementcontentchar, quotattrcontentchar,
|
| 109 |
+
# aposattrcontentchar
|
| 110 |
+
# x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
|
| 111 |
+
|
| 112 |
+
flags = re.DOTALL | re.MULTILINE
|
| 113 |
+
|
| 114 |
+
def punctuation_root_callback(lexer, match, ctx):
|
| 115 |
+
yield match.start(), Punctuation, match.group(1)
|
| 116 |
+
# transition to root always - don't pop off stack
|
| 117 |
+
ctx.stack = ['root']
|
| 118 |
+
ctx.pos = match.end()
|
| 119 |
+
|
| 120 |
+
def operator_root_callback(lexer, match, ctx):
|
| 121 |
+
yield match.start(), Operator, match.group(1)
|
| 122 |
+
# transition to root always - don't pop off stack
|
| 123 |
+
ctx.stack = ['root']
|
| 124 |
+
ctx.pos = match.end()
|
| 125 |
+
|
| 126 |
+
def popstate_tag_callback(lexer, match, ctx):
|
| 127 |
+
yield match.start(), Name.Tag, match.group(1)
|
| 128 |
+
if lexer.xquery_parse_state:
|
| 129 |
+
ctx.stack.append(lexer.xquery_parse_state.pop())
|
| 130 |
+
ctx.pos = match.end()
|
| 131 |
+
|
| 132 |
+
def popstate_xmlcomment_callback(lexer, match, ctx):
|
| 133 |
+
yield match.start(), String.Doc, match.group(1)
|
| 134 |
+
ctx.stack.append(lexer.xquery_parse_state.pop())
|
| 135 |
+
ctx.pos = match.end()
|
| 136 |
+
|
| 137 |
+
def popstate_kindtest_callback(lexer, match, ctx):
|
| 138 |
+
yield match.start(), Punctuation, match.group(1)
|
| 139 |
+
next_state = lexer.xquery_parse_state.pop()
|
| 140 |
+
if next_state == 'occurrenceindicator':
|
| 141 |
+
if re.match("[?*+]+", match.group(2)):
|
| 142 |
+
yield match.start(), Punctuation, match.group(2)
|
| 143 |
+
ctx.stack.append('operator')
|
| 144 |
+
ctx.pos = match.end()
|
| 145 |
+
else:
|
| 146 |
+
ctx.stack.append('operator')
|
| 147 |
+
ctx.pos = match.end(1)
|
| 148 |
+
else:
|
| 149 |
+
ctx.stack.append(next_state)
|
| 150 |
+
ctx.pos = match.end(1)
|
| 151 |
+
|
| 152 |
+
def popstate_callback(lexer, match, ctx):
|
| 153 |
+
yield match.start(), Punctuation, match.group(1)
|
| 154 |
+
# if we have run out of our state stack, pop whatever is on the pygments
|
| 155 |
+
# state stack
|
| 156 |
+
if len(lexer.xquery_parse_state) == 0:
|
| 157 |
+
ctx.stack.pop()
|
| 158 |
+
if not ctx.stack:
|
| 159 |
+
# make sure we have at least the root state on invalid inputs
|
| 160 |
+
ctx.stack = ['root']
|
| 161 |
+
elif len(ctx.stack) > 1:
|
| 162 |
+
ctx.stack.append(lexer.xquery_parse_state.pop())
|
| 163 |
+
else:
|
| 164 |
+
# i don't know if i'll need this, but in case, default back to root
|
| 165 |
+
ctx.stack = ['root']
|
| 166 |
+
ctx.pos = match.end()
|
| 167 |
+
|
| 168 |
+
def pushstate_element_content_starttag_callback(lexer, match, ctx):
|
| 169 |
+
yield match.start(), Name.Tag, match.group(1)
|
| 170 |
+
lexer.xquery_parse_state.append('element_content')
|
| 171 |
+
ctx.stack.append('start_tag')
|
| 172 |
+
ctx.pos = match.end()
|
| 173 |
+
|
| 174 |
+
def pushstate_cdata_section_callback(lexer, match, ctx):
|
| 175 |
+
yield match.start(), String.Doc, match.group(1)
|
| 176 |
+
ctx.stack.append('cdata_section')
|
| 177 |
+
lexer.xquery_parse_state.append(ctx.state.pop)
|
| 178 |
+
ctx.pos = match.end()
|
| 179 |
+
|
| 180 |
+
def pushstate_starttag_callback(lexer, match, ctx):
|
| 181 |
+
yield match.start(), Name.Tag, match.group(1)
|
| 182 |
+
lexer.xquery_parse_state.append(ctx.state.pop)
|
| 183 |
+
ctx.stack.append('start_tag')
|
| 184 |
+
ctx.pos = match.end()
|
| 185 |
+
|
| 186 |
+
def pushstate_operator_order_callback(lexer, match, ctx):
|
| 187 |
+
yield match.start(), Keyword, match.group(1)
|
| 188 |
+
yield match.start(), Whitespace, match.group(2)
|
| 189 |
+
yield match.start(), Punctuation, match.group(3)
|
| 190 |
+
ctx.stack = ['root']
|
| 191 |
+
lexer.xquery_parse_state.append('operator')
|
| 192 |
+
ctx.pos = match.end()
|
| 193 |
+
|
| 194 |
+
def pushstate_operator_map_callback(lexer, match, ctx):
|
| 195 |
+
yield match.start(), Keyword, match.group(1)
|
| 196 |
+
yield match.start(), Whitespace, match.group(2)
|
| 197 |
+
yield match.start(), Punctuation, match.group(3)
|
| 198 |
+
ctx.stack = ['root']
|
| 199 |
+
lexer.xquery_parse_state.append('operator')
|
| 200 |
+
ctx.pos = match.end()
|
| 201 |
+
|
| 202 |
+
def pushstate_operator_root_validate(lexer, match, ctx):
|
| 203 |
+
yield match.start(), Keyword, match.group(1)
|
| 204 |
+
yield match.start(), Whitespace, match.group(2)
|
| 205 |
+
yield match.start(), Punctuation, match.group(3)
|
| 206 |
+
ctx.stack = ['root']
|
| 207 |
+
lexer.xquery_parse_state.append('operator')
|
| 208 |
+
ctx.pos = match.end()
|
| 209 |
+
|
| 210 |
+
def pushstate_operator_root_validate_withmode(lexer, match, ctx):
|
| 211 |
+
yield match.start(), Keyword, match.group(1)
|
| 212 |
+
yield match.start(), Whitespace, match.group(2)
|
| 213 |
+
yield match.start(), Keyword, match.group(3)
|
| 214 |
+
ctx.stack = ['root']
|
| 215 |
+
lexer.xquery_parse_state.append('operator')
|
| 216 |
+
ctx.pos = match.end()
|
| 217 |
+
|
| 218 |
+
def pushstate_operator_processing_instruction_callback(lexer, match, ctx):
|
| 219 |
+
yield match.start(), String.Doc, match.group(1)
|
| 220 |
+
ctx.stack.append('processing_instruction')
|
| 221 |
+
lexer.xquery_parse_state.append('operator')
|
| 222 |
+
ctx.pos = match.end()
|
| 223 |
+
|
| 224 |
+
def pushstate_element_content_processing_instruction_callback(lexer, match, ctx):
|
| 225 |
+
yield match.start(), String.Doc, match.group(1)
|
| 226 |
+
ctx.stack.append('processing_instruction')
|
| 227 |
+
lexer.xquery_parse_state.append('element_content')
|
| 228 |
+
ctx.pos = match.end()
|
| 229 |
+
|
| 230 |
+
def pushstate_element_content_cdata_section_callback(lexer, match, ctx):
|
| 231 |
+
yield match.start(), String.Doc, match.group(1)
|
| 232 |
+
ctx.stack.append('cdata_section')
|
| 233 |
+
lexer.xquery_parse_state.append('element_content')
|
| 234 |
+
ctx.pos = match.end()
|
| 235 |
+
|
| 236 |
+
def pushstate_operator_cdata_section_callback(lexer, match, ctx):
|
| 237 |
+
yield match.start(), String.Doc, match.group(1)
|
| 238 |
+
ctx.stack.append('cdata_section')
|
| 239 |
+
lexer.xquery_parse_state.append('operator')
|
| 240 |
+
ctx.pos = match.end()
|
| 241 |
+
|
| 242 |
+
def pushstate_element_content_xmlcomment_callback(lexer, match, ctx):
|
| 243 |
+
yield match.start(), String.Doc, match.group(1)
|
| 244 |
+
ctx.stack.append('xml_comment')
|
| 245 |
+
lexer.xquery_parse_state.append('element_content')
|
| 246 |
+
ctx.pos = match.end()
|
| 247 |
+
|
| 248 |
+
def pushstate_operator_xmlcomment_callback(lexer, match, ctx):
|
| 249 |
+
yield match.start(), String.Doc, match.group(1)
|
| 250 |
+
ctx.stack.append('xml_comment')
|
| 251 |
+
lexer.xquery_parse_state.append('operator')
|
| 252 |
+
ctx.pos = match.end()
|
| 253 |
+
|
| 254 |
+
def pushstate_kindtest_callback(lexer, match, ctx):
|
| 255 |
+
yield match.start(), Keyword, match.group(1)
|
| 256 |
+
yield match.start(), Whitespace, match.group(2)
|
| 257 |
+
yield match.start(), Punctuation, match.group(3)
|
| 258 |
+
lexer.xquery_parse_state.append('kindtest')
|
| 259 |
+
ctx.stack.append('kindtest')
|
| 260 |
+
ctx.pos = match.end()
|
| 261 |
+
|
| 262 |
+
def pushstate_operator_kindtestforpi_callback(lexer, match, ctx):
|
| 263 |
+
yield match.start(), Keyword, match.group(1)
|
| 264 |
+
yield match.start(), Whitespace, match.group(2)
|
| 265 |
+
yield match.start(), Punctuation, match.group(3)
|
| 266 |
+
lexer.xquery_parse_state.append('operator')
|
| 267 |
+
ctx.stack.append('kindtestforpi')
|
| 268 |
+
ctx.pos = match.end()
|
| 269 |
+
|
| 270 |
+
def pushstate_operator_kindtest_callback(lexer, match, ctx):
|
| 271 |
+
yield match.start(), Keyword, match.group(1)
|
| 272 |
+
yield match.start(), Whitespace, match.group(2)
|
| 273 |
+
yield match.start(), Punctuation, match.group(3)
|
| 274 |
+
lexer.xquery_parse_state.append('operator')
|
| 275 |
+
ctx.stack.append('kindtest')
|
| 276 |
+
ctx.pos = match.end()
|
| 277 |
+
|
| 278 |
+
def pushstate_occurrenceindicator_kindtest_callback(lexer, match, ctx):
|
| 279 |
+
yield match.start(), Name.Tag, match.group(1)
|
| 280 |
+
yield match.start(), Whitespace, match.group(2)
|
| 281 |
+
yield match.start(), Punctuation, match.group(3)
|
| 282 |
+
lexer.xquery_parse_state.append('occurrenceindicator')
|
| 283 |
+
ctx.stack.append('kindtest')
|
| 284 |
+
ctx.pos = match.end()
|
| 285 |
+
|
| 286 |
+
def pushstate_operator_starttag_callback(lexer, match, ctx):
|
| 287 |
+
yield match.start(), Name.Tag, match.group(1)
|
| 288 |
+
lexer.xquery_parse_state.append('operator')
|
| 289 |
+
ctx.stack.append('start_tag')
|
| 290 |
+
ctx.pos = match.end()
|
| 291 |
+
|
| 292 |
+
def pushstate_operator_root_callback(lexer, match, ctx):
|
| 293 |
+
yield match.start(), Punctuation, match.group(1)
|
| 294 |
+
lexer.xquery_parse_state.append('operator')
|
| 295 |
+
ctx.stack = ['root']
|
| 296 |
+
ctx.pos = match.end()
|
| 297 |
+
|
| 298 |
+
def pushstate_operator_root_construct_callback(lexer, match, ctx):
|
| 299 |
+
yield match.start(), Keyword, match.group(1)
|
| 300 |
+
yield match.start(), Whitespace, match.group(2)
|
| 301 |
+
yield match.start(), Punctuation, match.group(3)
|
| 302 |
+
lexer.xquery_parse_state.append('operator')
|
| 303 |
+
ctx.stack = ['root']
|
| 304 |
+
ctx.pos = match.end()
|
| 305 |
+
|
| 306 |
+
def pushstate_root_callback(lexer, match, ctx):
|
| 307 |
+
yield match.start(), Punctuation, match.group(1)
|
| 308 |
+
cur_state = ctx.stack.pop()
|
| 309 |
+
lexer.xquery_parse_state.append(cur_state)
|
| 310 |
+
ctx.stack = ['root']
|
| 311 |
+
ctx.pos = match.end()
|
| 312 |
+
|
| 313 |
+
def pushstate_operator_attribute_callback(lexer, match, ctx):
|
| 314 |
+
yield match.start(), Name.Attribute, match.group(1)
|
| 315 |
+
ctx.stack.append('operator')
|
| 316 |
+
ctx.pos = match.end()
|
| 317 |
+
|
| 318 |
+
tokens = {
|
| 319 |
+
'comment': [
|
| 320 |
+
# xquery comments
|
| 321 |
+
(r'[^:()]+', Comment),
|
| 322 |
+
(r'\(:', Comment, '#push'),
|
| 323 |
+
(r':\)', Comment, '#pop'),
|
| 324 |
+
(r'[:()]', Comment),
|
| 325 |
+
],
|
| 326 |
+
'whitespace': [
|
| 327 |
+
(r'\s+', Whitespace),
|
| 328 |
+
],
|
| 329 |
+
'operator': [
|
| 330 |
+
include('whitespace'),
|
| 331 |
+
(r'(\})', popstate_callback),
|
| 332 |
+
(r'\(:', Comment, 'comment'),
|
| 333 |
+
|
| 334 |
+
(r'(\{)', pushstate_root_callback),
|
| 335 |
+
(r'then|else|external|at|div|except', Keyword, 'root'),
|
| 336 |
+
(r'order by', Keyword, 'root'),
|
| 337 |
+
(r'group by', Keyword, 'root'),
|
| 338 |
+
(r'is|mod|order\s+by|stable\s+order\s+by', Keyword, 'root'),
|
| 339 |
+
(r'and|or', Operator.Word, 'root'),
|
| 340 |
+
(r'(eq|ge|gt|le|lt|ne|idiv|intersect|in)(?=\b)',
|
| 341 |
+
Operator.Word, 'root'),
|
| 342 |
+
(r'return|satisfies|to|union|where|count|preserve\s+strip',
|
| 343 |
+
Keyword, 'root'),
|
| 344 |
+
(r'(>=|>>|>|<=|<<|<|-|\*|!=|\+|\|\||\||:=|=|!)',
|
| 345 |
+
operator_root_callback),
|
| 346 |
+
(r'(::|:|;|\[|//|/|,)',
|
| 347 |
+
punctuation_root_callback),
|
| 348 |
+
(r'(castable|cast)(\s+)(as)\b',
|
| 349 |
+
bygroups(Keyword, Whitespace, Keyword), 'singletype'),
|
| 350 |
+
(r'(instance)(\s+)(of)\b',
|
| 351 |
+
bygroups(Keyword, Whitespace, Keyword), 'itemtype'),
|
| 352 |
+
(r'(treat)(\s+)(as)\b',
|
| 353 |
+
bygroups(Keyword, Whitespace, Keyword), 'itemtype'),
|
| 354 |
+
(r'(case)(\s+)(' + stringdouble + ')',
|
| 355 |
+
bygroups(Keyword, Whitespace, String.Double), 'itemtype'),
|
| 356 |
+
(r'(case)(\s+)(' + stringsingle + ')',
|
| 357 |
+
bygroups(Keyword, Whitespace, String.Single), 'itemtype'),
|
| 358 |
+
(r'(case|as)\b', Keyword, 'itemtype'),
|
| 359 |
+
(r'(\))(\s*)(as)',
|
| 360 |
+
bygroups(Punctuation, Whitespace, Keyword), 'itemtype'),
|
| 361 |
+
(r'\$', Name.Variable, 'varname'),
|
| 362 |
+
(r'(for|let|previous|next)(\s+)(\$)',
|
| 363 |
+
bygroups(Keyword, Whitespace, Name.Variable), 'varname'),
|
| 364 |
+
(r'(for)(\s+)(tumbling|sliding)(\s+)(window)(\s+)(\$)',
|
| 365 |
+
bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword,
|
| 366 |
+
Whitespace, Name.Variable),
|
| 367 |
+
'varname'),
|
| 368 |
+
# (r'\)|\?|\]', Punctuation, '#push'),
|
| 369 |
+
(r'\)|\?|\]', Punctuation),
|
| 370 |
+
(r'(empty)(\s+)(greatest|least)',
|
| 371 |
+
bygroups(Keyword, Whitespace, Keyword)),
|
| 372 |
+
(r'ascending|descending|default', Keyword, '#push'),
|
| 373 |
+
(r'(allowing)(\s+)(empty)',
|
| 374 |
+
bygroups(Keyword, Whitespace, Keyword)),
|
| 375 |
+
(r'external', Keyword),
|
| 376 |
+
(r'(start|when|end)', Keyword, 'root'),
|
| 377 |
+
(r'(only)(\s+)(end)', bygroups(Keyword, Whitespace, Keyword),
|
| 378 |
+
'root'),
|
| 379 |
+
(r'collation', Keyword, 'uritooperator'),
|
| 380 |
+
|
| 381 |
+
# eXist specific XQUF
|
| 382 |
+
(r'(into|following|preceding|with)', Keyword, 'root'),
|
| 383 |
+
|
| 384 |
+
# support for current context on rhs of Simple Map Operator
|
| 385 |
+
(r'\.', Operator),
|
| 386 |
+
|
| 387 |
+
# finally catch all string literals and stay in operator state
|
| 388 |
+
(stringdouble, String.Double),
|
| 389 |
+
(stringsingle, String.Single),
|
| 390 |
+
|
| 391 |
+
(r'(catch)(\s*)', bygroups(Keyword, Whitespace), 'root'),
|
| 392 |
+
],
|
| 393 |
+
'uritooperator': [
|
| 394 |
+
(stringdouble, String.Double, '#pop'),
|
| 395 |
+
(stringsingle, String.Single, '#pop'),
|
| 396 |
+
],
|
| 397 |
+
'namespacedecl': [
|
| 398 |
+
include('whitespace'),
|
| 399 |
+
(r'\(:', Comment, 'comment'),
|
| 400 |
+
(r'(at)(\s+)('+stringdouble+')',
|
| 401 |
+
bygroups(Keyword, Whitespace, String.Double)),
|
| 402 |
+
(r"(at)(\s+)("+stringsingle+')',
|
| 403 |
+
bygroups(Keyword, Whitespace, String.Single)),
|
| 404 |
+
(stringdouble, String.Double),
|
| 405 |
+
(stringsingle, String.Single),
|
| 406 |
+
(r',', Punctuation),
|
| 407 |
+
(r'=', Operator),
|
| 408 |
+
(r';', Punctuation, 'root'),
|
| 409 |
+
(ncname, Name.Namespace),
|
| 410 |
+
],
|
| 411 |
+
'namespacekeyword': [
|
| 412 |
+
include('whitespace'),
|
| 413 |
+
(r'\(:', Comment, 'comment'),
|
| 414 |
+
(stringdouble, String.Double, 'namespacedecl'),
|
| 415 |
+
(stringsingle, String.Single, 'namespacedecl'),
|
| 416 |
+
(r'inherit|no-inherit', Keyword, 'root'),
|
| 417 |
+
(r'namespace', Keyword, 'namespacedecl'),
|
| 418 |
+
(r'(default)(\s+)(element)', bygroups(Keyword, Text, Keyword)),
|
| 419 |
+
(r'preserve|no-preserve', Keyword),
|
| 420 |
+
(r',', Punctuation),
|
| 421 |
+
],
|
| 422 |
+
'annotationname': [
|
| 423 |
+
(r'\(:', Comment, 'comment'),
|
| 424 |
+
(qname, Name.Decorator),
|
| 425 |
+
(r'(\()(' + stringdouble + ')', bygroups(Punctuation, String.Double)),
|
| 426 |
+
(r'(\()(' + stringsingle + ')', bygroups(Punctuation, String.Single)),
|
| 427 |
+
(r'(\,)(\s+)(' + stringdouble + ')',
|
| 428 |
+
bygroups(Punctuation, Text, String.Double)),
|
| 429 |
+
(r'(\,)(\s+)(' + stringsingle + ')',
|
| 430 |
+
bygroups(Punctuation, Text, String.Single)),
|
| 431 |
+
(r'\)', Punctuation),
|
| 432 |
+
(r'(\s+)(\%)', bygroups(Text, Name.Decorator), 'annotationname'),
|
| 433 |
+
(r'(\s+)(variable)(\s+)(\$)',
|
| 434 |
+
bygroups(Text, Keyword.Declaration, Text, Name.Variable), 'varname'),
|
| 435 |
+
(r'(\s+)(function)(\s+)',
|
| 436 |
+
bygroups(Text, Keyword.Declaration, Text), 'root')
|
| 437 |
+
],
|
| 438 |
+
'varname': [
|
| 439 |
+
(r'\(:', Comment, 'comment'),
|
| 440 |
+
(r'(' + qname + r')(\()?', bygroups(Name, Punctuation), 'operator'),
|
| 441 |
+
],
|
| 442 |
+
'singletype': [
|
| 443 |
+
include('whitespace'),
|
| 444 |
+
(r'\(:', Comment, 'comment'),
|
| 445 |
+
(ncname + r'(:\*)', Name.Variable, 'operator'),
|
| 446 |
+
(qname, Name.Variable, 'operator'),
|
| 447 |
+
],
|
| 448 |
+
'itemtype': [
|
| 449 |
+
include('whitespace'),
|
| 450 |
+
(r'\(:', Comment, 'comment'),
|
| 451 |
+
(r'\$', Name.Variable, 'varname'),
|
| 452 |
+
(r'(void)(\s*)(\()(\s*)(\))',
|
| 453 |
+
bygroups(Keyword, Text, Punctuation, Text, Punctuation), 'operator'),
|
| 454 |
+
(r'(element|attribute|schema-element|schema-attribute|comment|text|'
|
| 455 |
+
r'node|binary|document-node|empty-sequence)(\s*)(\()',
|
| 456 |
+
pushstate_occurrenceindicator_kindtest_callback),
|
| 457 |
+
# Marklogic specific type?
|
| 458 |
+
(r'(processing-instruction)(\s*)(\()',
|
| 459 |
+
bygroups(Keyword, Text, Punctuation),
|
| 460 |
+
('occurrenceindicator', 'kindtestforpi')),
|
| 461 |
+
(r'(item)(\s*)(\()(\s*)(\))(?=[*+?])',
|
| 462 |
+
bygroups(Keyword, Text, Punctuation, Text, Punctuation),
|
| 463 |
+
'occurrenceindicator'),
|
| 464 |
+
(r'(\(\#)(\s*)', bygroups(Punctuation, Text), 'pragma'),
|
| 465 |
+
(r';', Punctuation, '#pop'),
|
| 466 |
+
(r'then|else', Keyword, '#pop'),
|
| 467 |
+
(r'(at)(\s+)(' + stringdouble + ')',
|
| 468 |
+
bygroups(Keyword, Text, String.Double), 'namespacedecl'),
|
| 469 |
+
(r'(at)(\s+)(' + stringsingle + ')',
|
| 470 |
+
bygroups(Keyword, Text, String.Single), 'namespacedecl'),
|
| 471 |
+
(r'except|intersect|in|is|return|satisfies|to|union|where|count',
|
| 472 |
+
Keyword, 'root'),
|
| 473 |
+
(r'and|div|eq|ge|gt|le|lt|ne|idiv|mod|or', Operator.Word, 'root'),
|
| 474 |
+
(r':=|=|,|>=|>>|>|\[|\(|<=|<<|<|-|!=|\|\||\|', Operator, 'root'),
|
| 475 |
+
(r'external|at', Keyword, 'root'),
|
| 476 |
+
(r'(stable)(\s+)(order)(\s+)(by)',
|
| 477 |
+
bygroups(Keyword, Text, Keyword, Text, Keyword), 'root'),
|
| 478 |
+
(r'(castable|cast)(\s+)(as)',
|
| 479 |
+
bygroups(Keyword, Text, Keyword), 'singletype'),
|
| 480 |
+
(r'(treat)(\s+)(as)', bygroups(Keyword, Text, Keyword)),
|
| 481 |
+
(r'(instance)(\s+)(of)', bygroups(Keyword, Text, Keyword)),
|
| 482 |
+
(r'(case)(\s+)(' + stringdouble + ')',
|
| 483 |
+
bygroups(Keyword, Text, String.Double), 'itemtype'),
|
| 484 |
+
(r'(case)(\s+)(' + stringsingle + ')',
|
| 485 |
+
bygroups(Keyword, Text, String.Single), 'itemtype'),
|
| 486 |
+
(r'case|as', Keyword, 'itemtype'),
|
| 487 |
+
(r'(\))(\s*)(as)', bygroups(Operator, Text, Keyword), 'itemtype'),
|
| 488 |
+
(ncname + r':\*', Keyword.Type, 'operator'),
|
| 489 |
+
(r'(function|map|array)(\()', bygroups(Keyword.Type, Punctuation)),
|
| 490 |
+
(qname, Keyword.Type, 'occurrenceindicator'),
|
| 491 |
+
],
|
| 492 |
+
'kindtest': [
|
| 493 |
+
(r'\(:', Comment, 'comment'),
|
| 494 |
+
(r'\{', Punctuation, 'root'),
|
| 495 |
+
(r'(\))([*+?]?)', popstate_kindtest_callback),
|
| 496 |
+
(r'\*', Name, 'closekindtest'),
|
| 497 |
+
(qname, Name, 'closekindtest'),
|
| 498 |
+
(r'(element|schema-element)(\s*)(\()', pushstate_kindtest_callback),
|
| 499 |
+
],
|
| 500 |
+
'kindtestforpi': [
|
| 501 |
+
(r'\(:', Comment, 'comment'),
|
| 502 |
+
(r'\)', Punctuation, '#pop'),
|
| 503 |
+
(ncname, Name.Variable),
|
| 504 |
+
(stringdouble, String.Double),
|
| 505 |
+
(stringsingle, String.Single),
|
| 506 |
+
],
|
| 507 |
+
'closekindtest': [
|
| 508 |
+
(r'\(:', Comment, 'comment'),
|
| 509 |
+
(r'(\))', popstate_callback),
|
| 510 |
+
(r',', Punctuation),
|
| 511 |
+
(r'(\{)', pushstate_operator_root_callback),
|
| 512 |
+
(r'\?', Punctuation),
|
| 513 |
+
],
|
| 514 |
+
'xml_comment': [
|
| 515 |
+
(r'(-->)', popstate_xmlcomment_callback),
|
| 516 |
+
(r'[^-]{1,2}', Literal),
|
| 517 |
+
(r'\t|\r|\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|[\U00010000-\U0010FFFF]',
|
| 518 |
+
Literal),
|
| 519 |
+
],
|
| 520 |
+
'processing_instruction': [
|
| 521 |
+
(r'\s+', Text, 'processing_instruction_content'),
|
| 522 |
+
(r'\?>', String.Doc, '#pop'),
|
| 523 |
+
(pitarget, Name),
|
| 524 |
+
],
|
| 525 |
+
'processing_instruction_content': [
|
| 526 |
+
(r'\?>', String.Doc, '#pop'),
|
| 527 |
+
(r'\t|\r|\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|[\U00010000-\U0010FFFF]',
|
| 528 |
+
Literal),
|
| 529 |
+
],
|
| 530 |
+
'cdata_section': [
|
| 531 |
+
(r']]>', String.Doc, '#pop'),
|
| 532 |
+
(r'\t|\r|\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|[\U00010000-\U0010FFFF]',
|
| 533 |
+
Literal),
|
| 534 |
+
],
|
| 535 |
+
'start_tag': [
|
| 536 |
+
include('whitespace'),
|
| 537 |
+
(r'(/>)', popstate_tag_callback),
|
| 538 |
+
(r'>', Name.Tag, 'element_content'),
|
| 539 |
+
(r'"', Punctuation, 'quot_attribute_content'),
|
| 540 |
+
(r"'", Punctuation, 'apos_attribute_content'),
|
| 541 |
+
(r'=', Operator),
|
| 542 |
+
(qname, Name.Tag),
|
| 543 |
+
],
|
| 544 |
+
'quot_attribute_content': [
|
| 545 |
+
(r'"', Punctuation, 'start_tag'),
|
| 546 |
+
(r'(\{)', pushstate_root_callback),
|
| 547 |
+
(r'""', Name.Attribute),
|
| 548 |
+
(quotattrcontentchar, Name.Attribute),
|
| 549 |
+
(entityref, Name.Attribute),
|
| 550 |
+
(charref, Name.Attribute),
|
| 551 |
+
(r'\{\{|\}\}', Name.Attribute),
|
| 552 |
+
],
|
| 553 |
+
'apos_attribute_content': [
|
| 554 |
+
(r"'", Punctuation, 'start_tag'),
|
| 555 |
+
(r'\{', Punctuation, 'root'),
|
| 556 |
+
(r"''", Name.Attribute),
|
| 557 |
+
(aposattrcontentchar, Name.Attribute),
|
| 558 |
+
(entityref, Name.Attribute),
|
| 559 |
+
(charref, Name.Attribute),
|
| 560 |
+
(r'\{\{|\}\}', Name.Attribute),
|
| 561 |
+
],
|
| 562 |
+
'element_content': [
|
| 563 |
+
(r'</', Name.Tag, 'end_tag'),
|
| 564 |
+
(r'(\{)', pushstate_root_callback),
|
| 565 |
+
(r'(<!--)', pushstate_element_content_xmlcomment_callback),
|
| 566 |
+
(r'(<\?)', pushstate_element_content_processing_instruction_callback),
|
| 567 |
+
(r'(<!\[CDATA\[)', pushstate_element_content_cdata_section_callback),
|
| 568 |
+
(r'(<)', pushstate_element_content_starttag_callback),
|
| 569 |
+
(elementcontentchar, Literal),
|
| 570 |
+
(entityref, Literal),
|
| 571 |
+
(charref, Literal),
|
| 572 |
+
(r'\{\{|\}\}', Literal),
|
| 573 |
+
],
|
| 574 |
+
'end_tag': [
|
| 575 |
+
include('whitespace'),
|
| 576 |
+
(r'(>)', popstate_tag_callback),
|
| 577 |
+
(qname, Name.Tag),
|
| 578 |
+
],
|
| 579 |
+
'xmlspace_decl': [
|
| 580 |
+
include('whitespace'),
|
| 581 |
+
(r'\(:', Comment, 'comment'),
|
| 582 |
+
(r'preserve|strip', Keyword, '#pop'),
|
| 583 |
+
],
|
| 584 |
+
'declareordering': [
|
| 585 |
+
(r'\(:', Comment, 'comment'),
|
| 586 |
+
include('whitespace'),
|
| 587 |
+
(r'ordered|unordered', Keyword, '#pop'),
|
| 588 |
+
],
|
| 589 |
+
'xqueryversion': [
|
| 590 |
+
include('whitespace'),
|
| 591 |
+
(r'\(:', Comment, 'comment'),
|
| 592 |
+
(stringdouble, String.Double),
|
| 593 |
+
(stringsingle, String.Single),
|
| 594 |
+
(r'encoding', Keyword),
|
| 595 |
+
(r';', Punctuation, '#pop'),
|
| 596 |
+
],
|
| 597 |
+
'pragma': [
|
| 598 |
+
(qname, Name.Variable, 'pragmacontents'),
|
| 599 |
+
],
|
| 600 |
+
'pragmacontents': [
|
| 601 |
+
(r'#\)', Punctuation, 'operator'),
|
| 602 |
+
(r'\t|\r|\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|[\U00010000-\U0010FFFF]',
|
| 603 |
+
Literal),
|
| 604 |
+
(r'(\s+)', Whitespace),
|
| 605 |
+
],
|
| 606 |
+
'occurrenceindicator': [
|
| 607 |
+
include('whitespace'),
|
| 608 |
+
(r'\(:', Comment, 'comment'),
|
| 609 |
+
(r'\*|\?|\+', Operator, 'operator'),
|
| 610 |
+
(r':=', Operator, 'root'),
|
| 611 |
+
default('operator'),
|
| 612 |
+
],
|
| 613 |
+
'option': [
|
| 614 |
+
include('whitespace'),
|
| 615 |
+
(qname, Name.Variable, '#pop'),
|
| 616 |
+
],
|
| 617 |
+
'qname_braren': [
|
| 618 |
+
include('whitespace'),
|
| 619 |
+
(r'(\{)', pushstate_operator_root_callback),
|
| 620 |
+
(r'(\()', Punctuation, 'root'),
|
| 621 |
+
],
|
| 622 |
+
'element_qname': [
|
| 623 |
+
(qname, Name.Variable, 'root'),
|
| 624 |
+
],
|
| 625 |
+
'attribute_qname': [
|
| 626 |
+
(qname, Name.Variable, 'root'),
|
| 627 |
+
],
|
| 628 |
+
'root': [
|
| 629 |
+
include('whitespace'),
|
| 630 |
+
(r'\(:', Comment, 'comment'),
|
| 631 |
+
|
| 632 |
+
# handle operator state
|
| 633 |
+
# order on numbers matters - handle most complex first
|
| 634 |
+
(r'\d+(\.\d*)?[eE][+-]?\d+', Number.Float, 'operator'),
|
| 635 |
+
(r'(\.\d+)[eE][+-]?\d+', Number.Float, 'operator'),
|
| 636 |
+
(r'(\.\d+|\d+\.\d*)', Number.Float, 'operator'),
|
| 637 |
+
(r'(\d+)', Number.Integer, 'operator'),
|
| 638 |
+
(r'(\.\.|\.|\))', Punctuation, 'operator'),
|
| 639 |
+
(r'(declare)(\s+)(construction)',
|
| 640 |
+
bygroups(Keyword.Declaration, Text, Keyword.Declaration), 'operator'),
|
| 641 |
+
(r'(declare)(\s+)(default)(\s+)(order)',
|
| 642 |
+
bygroups(Keyword.Declaration, Text, Keyword.Declaration, Text, Keyword.Declaration), 'operator'),
|
| 643 |
+
(r'(declare)(\s+)(context)(\s+)(item)',
|
| 644 |
+
bygroups(Keyword.Declaration, Text, Keyword.Declaration, Text, Keyword.Declaration), 'operator'),
|
| 645 |
+
(ncname + r':\*', Name, 'operator'),
|
| 646 |
+
(r'\*:'+ncname, Name.Tag, 'operator'),
|
| 647 |
+
(r'\*', Name.Tag, 'operator'),
|
| 648 |
+
(stringdouble, String.Double, 'operator'),
|
| 649 |
+
(stringsingle, String.Single, 'operator'),
|
| 650 |
+
|
| 651 |
+
(r'(\}|\])', popstate_callback),
|
| 652 |
+
|
| 653 |
+
# NAMESPACE DECL
|
| 654 |
+
(r'(declare)(\s+)(default)(\s+)(collation)',
|
| 655 |
+
bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration,
|
| 656 |
+
Whitespace, Keyword.Declaration)),
|
| 657 |
+
(r'(module|declare)(\s+)(namespace)',
|
| 658 |
+
bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration),
|
| 659 |
+
'namespacedecl'),
|
| 660 |
+
(r'(declare)(\s+)(base-uri)',
|
| 661 |
+
bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration),
|
| 662 |
+
'namespacedecl'),
|
| 663 |
+
|
| 664 |
+
# NAMESPACE KEYWORD
|
| 665 |
+
(r'(declare)(\s+)(default)(\s+)(element|function)',
|
| 666 |
+
bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration,
|
| 667 |
+
Whitespace, Keyword.Declaration),
|
| 668 |
+
'namespacekeyword'),
|
| 669 |
+
(r'(import)(\s+)(schema|module)',
|
| 670 |
+
bygroups(Keyword.Pseudo, Whitespace, Keyword.Pseudo),
|
| 671 |
+
'namespacekeyword'),
|
| 672 |
+
(r'(declare)(\s+)(copy-namespaces)',
|
| 673 |
+
bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration),
|
| 674 |
+
'namespacekeyword'),
|
| 675 |
+
|
| 676 |
+
# VARNAMEs
|
| 677 |
+
(r'(for|let|some|every)(\s+)(\$)',
|
| 678 |
+
bygroups(Keyword, Whitespace, Name.Variable), 'varname'),
|
| 679 |
+
(r'(for)(\s+)(tumbling|sliding)(\s+)(window)(\s+)(\$)',
|
| 680 |
+
bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword,
|
| 681 |
+
Whitespace, Name.Variable),
|
| 682 |
+
'varname'),
|
| 683 |
+
(r'\$', Name.Variable, 'varname'),
|
| 684 |
+
(r'(declare)(\s+)(variable)(\s+)(\$)',
|
| 685 |
+
bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration,
|
| 686 |
+
Whitespace, Name.Variable),
|
| 687 |
+
'varname'),
|
| 688 |
+
|
| 689 |
+
# ANNOTATED GLOBAL VARIABLES AND FUNCTIONS
|
| 690 |
+
(r'(declare)(\s+)(\%)', bygroups(Keyword.Declaration, Whitespace,
|
| 691 |
+
Name.Decorator),
|
| 692 |
+
'annotationname'),
|
| 693 |
+
|
| 694 |
+
# ITEMTYPE
|
| 695 |
+
(r'(\))(\s+)(as)', bygroups(Operator, Whitespace, Keyword),
|
| 696 |
+
'itemtype'),
|
| 697 |
+
|
| 698 |
+
(r'(element|attribute|schema-element|schema-attribute|comment|'
|
| 699 |
+
r'text|node|document-node|empty-sequence)(\s+)(\()',
|
| 700 |
+
pushstate_operator_kindtest_callback),
|
| 701 |
+
|
| 702 |
+
(r'(processing-instruction)(\s+)(\()',
|
| 703 |
+
pushstate_operator_kindtestforpi_callback),
|
| 704 |
+
|
| 705 |
+
(r'(<!--)', pushstate_operator_xmlcomment_callback),
|
| 706 |
+
|
| 707 |
+
(r'(<\?)', pushstate_operator_processing_instruction_callback),
|
| 708 |
+
|
| 709 |
+
(r'(<!\[CDATA\[)', pushstate_operator_cdata_section_callback),
|
| 710 |
+
|
| 711 |
+
# (r'</', Name.Tag, 'end_tag'),
|
| 712 |
+
(r'(<)', pushstate_operator_starttag_callback),
|
| 713 |
+
|
| 714 |
+
(r'(declare)(\s+)(boundary-space)',
|
| 715 |
+
bygroups(Keyword.Declaration, Text, Keyword.Declaration), 'xmlspace_decl'),
|
| 716 |
+
|
| 717 |
+
(r'(validate)(\s+)(lax|strict)',
|
| 718 |
+
pushstate_operator_root_validate_withmode),
|
| 719 |
+
(r'(validate)(\s*)(\{)', pushstate_operator_root_validate),
|
| 720 |
+
(r'(typeswitch)(\s*)(\()', bygroups(Keyword, Whitespace,
|
| 721 |
+
Punctuation)),
|
| 722 |
+
(r'(switch)(\s*)(\()', bygroups(Keyword, Whitespace, Punctuation)),
|
| 723 |
+
(r'(element|attribute|namespace)(\s*)(\{)',
|
| 724 |
+
pushstate_operator_root_construct_callback),
|
| 725 |
+
|
| 726 |
+
(r'(document|text|processing-instruction|comment)(\s*)(\{)',
|
| 727 |
+
pushstate_operator_root_construct_callback),
|
| 728 |
+
# ATTRIBUTE
|
| 729 |
+
(r'(attribute)(\s+)(?=' + qname + r')',
|
| 730 |
+
bygroups(Keyword, Whitespace), 'attribute_qname'),
|
| 731 |
+
# ELEMENT
|
| 732 |
+
(r'(element)(\s+)(?=' + qname + r')',
|
| 733 |
+
bygroups(Keyword, Whitespace), 'element_qname'),
|
| 734 |
+
# PROCESSING_INSTRUCTION
|
| 735 |
+
(r'(processing-instruction|namespace)(\s+)(' + ncname + r')(\s*)(\{)',
|
| 736 |
+
bygroups(Keyword, Whitespace, Name.Variable, Whitespace,
|
| 737 |
+
Punctuation),
|
| 738 |
+
'operator'),
|
| 739 |
+
|
| 740 |
+
(r'(declare|define)(\s+)(function)',
|
| 741 |
+
bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration)),
|
| 742 |
+
|
| 743 |
+
(r'(\{|\[)', pushstate_operator_root_callback),
|
| 744 |
+
|
| 745 |
+
(r'(unordered|ordered)(\s*)(\{)',
|
| 746 |
+
pushstate_operator_order_callback),
|
| 747 |
+
|
| 748 |
+
(r'(map|array)(\s*)(\{)',
|
| 749 |
+
pushstate_operator_map_callback),
|
| 750 |
+
|
| 751 |
+
(r'(declare)(\s+)(ordering)',
|
| 752 |
+
bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration),
|
| 753 |
+
'declareordering'),
|
| 754 |
+
|
| 755 |
+
(r'(xquery)(\s+)(version)',
|
| 756 |
+
bygroups(Keyword.Pseudo, Whitespace, Keyword.Pseudo),
|
| 757 |
+
'xqueryversion'),
|
| 758 |
+
|
| 759 |
+
(r'(\(#)(\s*)', bygroups(Punctuation, Whitespace), 'pragma'),
|
| 760 |
+
|
| 761 |
+
# sometimes return can occur in root state
|
| 762 |
+
(r'return', Keyword),
|
| 763 |
+
|
| 764 |
+
(r'(declare)(\s+)(option)', bygroups(Keyword.Declaration,
|
| 765 |
+
Whitespace,
|
| 766 |
+
Keyword.Declaration),
|
| 767 |
+
'option'),
|
| 768 |
+
|
| 769 |
+
# URI LITERALS - single and double quoted
|
| 770 |
+
(r'(at)(\s+)('+stringdouble+')', String.Double, 'namespacedecl'),
|
| 771 |
+
(r'(at)(\s+)('+stringsingle+')', String.Single, 'namespacedecl'),
|
| 772 |
+
|
| 773 |
+
(r'(ancestor-or-self|ancestor|attribute|child|descendant-or-self)(::)',
|
| 774 |
+
bygroups(Keyword, Punctuation)),
|
| 775 |
+
(r'(descendant|following-sibling|following|parent|preceding-sibling'
|
| 776 |
+
r'|preceding|self)(::)', bygroups(Keyword, Punctuation)),
|
| 777 |
+
|
| 778 |
+
(r'(if)(\s*)(\()', bygroups(Keyword, Whitespace, Punctuation)),
|
| 779 |
+
|
| 780 |
+
(r'then|else', Keyword),
|
| 781 |
+
|
| 782 |
+
# eXist specific XQUF
|
| 783 |
+
(r'(update)(\s*)(insert|delete|replace|value|rename)',
|
| 784 |
+
bygroups(Keyword, Whitespace, Keyword)),
|
| 785 |
+
(r'(into|following|preceding|with)', Keyword),
|
| 786 |
+
|
| 787 |
+
# Marklogic specific
|
| 788 |
+
(r'(try)(\s*)', bygroups(Keyword, Whitespace), 'root'),
|
| 789 |
+
(r'(catch)(\s*)(\()(\$)',
|
| 790 |
+
bygroups(Keyword, Whitespace, Punctuation, Name.Variable),
|
| 791 |
+
'varname'),
|
| 792 |
+
|
| 793 |
+
|
| 794 |
+
(r'(@'+qname+')', Name.Attribute, 'operator'),
|
| 795 |
+
(r'(@'+ncname+')', Name.Attribute, 'operator'),
|
| 796 |
+
(r'@\*:'+ncname, Name.Attribute, 'operator'),
|
| 797 |
+
(r'@\*', Name.Attribute, 'operator'),
|
| 798 |
+
(r'(@)', Name.Attribute, 'operator'),
|
| 799 |
+
|
| 800 |
+
(r'//|/|\+|-|;|,|\(|\)', Punctuation),
|
| 801 |
+
|
| 802 |
+
# STANDALONE QNAMES
|
| 803 |
+
(qname + r'(?=\s*\{)', Name.Tag, 'qname_braren'),
|
| 804 |
+
(qname + r'(?=\s*\([^:])', Name.Function, 'qname_braren'),
|
| 805 |
+
(r'(' + qname + ')(#)([0-9]+)', bygroups(Name.Function, Keyword.Type, Number.Integer)),
|
| 806 |
+
(qname, Name.Tag, 'operator'),
|
| 807 |
+
]
|
| 808 |
+
}
|
| 809 |
+
|
| 810 |
+
|
| 811 |
+
class QmlLexer(RegexLexer):
|
| 812 |
+
"""
|
| 813 |
+
For QML files.
|
| 814 |
+
"""
|
| 815 |
+
|
| 816 |
+
# QML is based on javascript, so much of this is taken from the
|
| 817 |
+
# JavascriptLexer above.
|
| 818 |
+
|
| 819 |
+
name = 'QML'
|
| 820 |
+
url = 'https://doc.qt.io/qt-6/qmlapplications.html'
|
| 821 |
+
aliases = ['qml', 'qbs']
|
| 822 |
+
filenames = ['*.qml', '*.qbs']
|
| 823 |
+
mimetypes = ['application/x-qml', 'application/x-qt.qbs+qml']
|
| 824 |
+
version_added = '1.6'
|
| 825 |
+
|
| 826 |
+
# pasted from JavascriptLexer, with some additions
|
| 827 |
+
flags = re.DOTALL | re.MULTILINE
|
| 828 |
+
|
| 829 |
+
tokens = {
|
| 830 |
+
'commentsandwhitespace': [
|
| 831 |
+
(r'\s+', Text),
|
| 832 |
+
(r'<!--', Comment),
|
| 833 |
+
(r'//.*?\n', Comment.Single),
|
| 834 |
+
(r'/\*.*?\*/', Comment.Multiline)
|
| 835 |
+
],
|
| 836 |
+
'slashstartsregex': [
|
| 837 |
+
include('commentsandwhitespace'),
|
| 838 |
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
| 839 |
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
| 840 |
+
(r'(?=/)', Text, ('#pop', 'badregex')),
|
| 841 |
+
default('#pop')
|
| 842 |
+
],
|
| 843 |
+
'badregex': [
|
| 844 |
+
(r'\n', Text, '#pop')
|
| 845 |
+
],
|
| 846 |
+
'root': [
|
| 847 |
+
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
| 848 |
+
include('commentsandwhitespace'),
|
| 849 |
+
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
| 850 |
+
r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
|
| 851 |
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
| 852 |
+
(r'[})\].]', Punctuation),
|
| 853 |
+
|
| 854 |
+
# QML insertions
|
| 855 |
+
(r'\bid\s*:\s*[A-Za-z][\w.]*', Keyword.Declaration,
|
| 856 |
+
'slashstartsregex'),
|
| 857 |
+
(r'\b[A-Za-z][\w.]*\s*:', Keyword, 'slashstartsregex'),
|
| 858 |
+
|
| 859 |
+
# the rest from JavascriptLexer
|
| 860 |
+
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
|
| 861 |
+
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|'
|
| 862 |
+
r'this)\b', Keyword, 'slashstartsregex'),
|
| 863 |
+
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
| 864 |
+
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
|
| 865 |
+
r'extends|final|float|goto|implements|import|int|interface|long|native|'
|
| 866 |
+
r'package|private|protected|public|short|static|super|synchronized|throws|'
|
| 867 |
+
r'transient|volatile)\b', Keyword.Reserved),
|
| 868 |
+
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
|
| 869 |
+
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
| 870 |
+
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
| 871 |
+
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
| 872 |
+
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
| 873 |
+
r'window)\b', Name.Builtin),
|
| 874 |
+
(r'[$a-zA-Z_]\w*', Name.Other),
|
| 875 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 876 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 877 |
+
(r'[0-9]+', Number.Integer),
|
| 878 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
|
| 879 |
+
(r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
|
| 880 |
+
]
|
| 881 |
+
}
|
| 882 |
+
|
| 883 |
+
|
| 884 |
+
class CirruLexer(RegexLexer):
|
| 885 |
+
r"""
|
| 886 |
+
* using ``()`` for expressions, but restricted in a same line
|
| 887 |
+
* using ``""`` for strings, with ``\`` for escaping chars
|
| 888 |
+
* using ``$`` as folding operator
|
| 889 |
+
* using ``,`` as unfolding operator
|
| 890 |
+
* using indentations for nested blocks
|
| 891 |
+
"""
|
| 892 |
+
|
| 893 |
+
name = 'Cirru'
|
| 894 |
+
url = 'http://cirru.org/'
|
| 895 |
+
aliases = ['cirru']
|
| 896 |
+
filenames = ['*.cirru']
|
| 897 |
+
mimetypes = ['text/x-cirru']
|
| 898 |
+
version_added = '2.0'
|
| 899 |
+
flags = re.MULTILINE
|
| 900 |
+
|
| 901 |
+
tokens = {
|
| 902 |
+
'string': [
|
| 903 |
+
(r'[^"\\\n]+', String),
|
| 904 |
+
(r'\\', String.Escape, 'escape'),
|
| 905 |
+
(r'"', String, '#pop'),
|
| 906 |
+
],
|
| 907 |
+
'escape': [
|
| 908 |
+
(r'.', String.Escape, '#pop'),
|
| 909 |
+
],
|
| 910 |
+
'function': [
|
| 911 |
+
(r'\,', Operator, '#pop'),
|
| 912 |
+
(r'[^\s"()]+', Name.Function, '#pop'),
|
| 913 |
+
(r'\)', Operator, '#pop'),
|
| 914 |
+
(r'(?=\n)', Text, '#pop'),
|
| 915 |
+
(r'\(', Operator, '#push'),
|
| 916 |
+
(r'"', String, ('#pop', 'string')),
|
| 917 |
+
(r'[ ]+', Text.Whitespace),
|
| 918 |
+
],
|
| 919 |
+
'line': [
|
| 920 |
+
(r'(?<!\w)\$(?!\w)', Operator, 'function'),
|
| 921 |
+
(r'\(', Operator, 'function'),
|
| 922 |
+
(r'\)', Operator),
|
| 923 |
+
(r'\n', Text, '#pop'),
|
| 924 |
+
(r'"', String, 'string'),
|
| 925 |
+
(r'[ ]+', Text.Whitespace),
|
| 926 |
+
(r'[+-]?[\d.]+\b', Number),
|
| 927 |
+
(r'[^\s"()]+', Name.Variable)
|
| 928 |
+
],
|
| 929 |
+
'root': [
|
| 930 |
+
(r'^\n+', Text.Whitespace),
|
| 931 |
+
default(('line', 'function')),
|
| 932 |
+
]
|
| 933 |
+
}
|
| 934 |
+
|
| 935 |
+
|
| 936 |
+
class SlimLexer(ExtendedRegexLexer):
|
| 937 |
+
"""
|
| 938 |
+
For Slim markup.
|
| 939 |
+
"""
|
| 940 |
+
|
| 941 |
+
name = 'Slim'
|
| 942 |
+
aliases = ['slim']
|
| 943 |
+
filenames = ['*.slim']
|
| 944 |
+
mimetypes = ['text/x-slim']
|
| 945 |
+
url = 'https://slim-template.github.io'
|
| 946 |
+
version_added = '2.0'
|
| 947 |
+
|
| 948 |
+
flags = re.IGNORECASE
|
| 949 |
+
_dot = r'(?: \|\n(?=.* \|)|.)'
|
| 950 |
+
tokens = {
|
| 951 |
+
'root': [
|
| 952 |
+
(r'[ \t]*\n', Text),
|
| 953 |
+
(r'[ \t]*', _indentation),
|
| 954 |
+
],
|
| 955 |
+
|
| 956 |
+
'css': [
|
| 957 |
+
(r'\.[\w:-]+', Name.Class, 'tag'),
|
| 958 |
+
(r'\#[\w:-]+', Name.Function, 'tag'),
|
| 959 |
+
],
|
| 960 |
+
|
| 961 |
+
'eval-or-plain': [
|
| 962 |
+
(r'([ \t]*==?)(.*\n)',
|
| 963 |
+
bygroups(Punctuation, using(RubyLexer)),
|
| 964 |
+
'root'),
|
| 965 |
+
(r'[ \t]+[\w:-]+(?==)', Name.Attribute, 'html-attributes'),
|
| 966 |
+
default('plain'),
|
| 967 |
+
],
|
| 968 |
+
|
| 969 |
+
'content': [
|
| 970 |
+
include('css'),
|
| 971 |
+
(r'[\w:-]+:[ \t]*\n', Text, 'plain'),
|
| 972 |
+
(r'(-)(.*\n)',
|
| 973 |
+
bygroups(Punctuation, using(RubyLexer)),
|
| 974 |
+
'#pop'),
|
| 975 |
+
(r'\|' + _dot + r'*\n', _starts_block(Text, 'plain'), '#pop'),
|
| 976 |
+
(r'/' + _dot + r'*\n', _starts_block(Comment.Preproc, 'slim-comment-block'), '#pop'),
|
| 977 |
+
(r'[\w:-]+', Name.Tag, 'tag'),
|
| 978 |
+
include('eval-or-plain'),
|
| 979 |
+
],
|
| 980 |
+
|
| 981 |
+
'tag': [
|
| 982 |
+
include('css'),
|
| 983 |
+
(r'[<>]{1,2}(?=[ \t=])', Punctuation),
|
| 984 |
+
(r'[ \t]+\n', Punctuation, '#pop:2'),
|
| 985 |
+
include('eval-or-plain'),
|
| 986 |
+
],
|
| 987 |
+
|
| 988 |
+
'plain': [
|
| 989 |
+
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text),
|
| 990 |
+
(r'(#\{)(.*?)(\})',
|
| 991 |
+
bygroups(String.Interpol, using(RubyLexer), String.Interpol)),
|
| 992 |
+
(r'\n', Text, 'root'),
|
| 993 |
+
],
|
| 994 |
+
|
| 995 |
+
'html-attributes': [
|
| 996 |
+
(r'=', Punctuation),
|
| 997 |
+
(r'"[^"]+"', using(RubyLexer), 'tag'),
|
| 998 |
+
(r'\'[^\']+\'', using(RubyLexer), 'tag'),
|
| 999 |
+
(r'\w+', Text, 'tag'),
|
| 1000 |
+
],
|
| 1001 |
+
|
| 1002 |
+
'slim-comment-block': [
|
| 1003 |
+
(_dot + '+', Comment.Preproc),
|
| 1004 |
+
(r'\n', Text, 'root'),
|
| 1005 |
+
],
|
| 1006 |
+
}
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/x10.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.x10
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for the X10 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
|
| 12 |
+
from pygments.token import Text, Comment, Keyword, String
|
| 13 |
+
|
| 14 |
+
__all__ = ['X10Lexer']
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class X10Lexer(RegexLexer):
|
| 18 |
+
"""
|
| 19 |
+
For the X10 language.
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
name = 'X10'
|
| 23 |
+
url = 'http://x10-lang.org/'
|
| 24 |
+
aliases = ['x10', 'xten']
|
| 25 |
+
filenames = ['*.x10']
|
| 26 |
+
mimetypes = ['text/x-x10']
|
| 27 |
+
version_added = '2.2'
|
| 28 |
+
|
| 29 |
+
keywords = (
|
| 30 |
+
'as', 'assert', 'async', 'at', 'athome', 'ateach', 'atomic',
|
| 31 |
+
'break', 'case', 'catch', 'class', 'clocked', 'continue',
|
| 32 |
+
'def', 'default', 'do', 'else', 'final', 'finally', 'finish',
|
| 33 |
+
'for', 'goto', 'haszero', 'here', 'if', 'import', 'in',
|
| 34 |
+
'instanceof', 'interface', 'isref', 'new', 'offer',
|
| 35 |
+
'operator', 'package', 'return', 'struct', 'switch', 'throw',
|
| 36 |
+
'try', 'type', 'val', 'var', 'when', 'while'
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
types = (
|
| 40 |
+
'void'
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
values = (
|
| 44 |
+
'false', 'null', 'self', 'super', 'this', 'true'
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
modifiers = (
|
| 48 |
+
'abstract', 'extends', 'implements', 'native', 'offers',
|
| 49 |
+
'private', 'property', 'protected', 'public', 'static',
|
| 50 |
+
'throws', 'transient'
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
tokens = {
|
| 54 |
+
'root': [
|
| 55 |
+
(r'[^\S\n]+', Text),
|
| 56 |
+
(r'//.*?\n', Comment.Single),
|
| 57 |
+
(r'/\*(.|\n)*?\*/', Comment.Multiline),
|
| 58 |
+
(r'\b({})\b'.format('|'.join(keywords)), Keyword),
|
| 59 |
+
(r'\b({})\b'.format('|'.join(types)), Keyword.Type),
|
| 60 |
+
(r'\b({})\b'.format('|'.join(values)), Keyword.Constant),
|
| 61 |
+
(r'\b({})\b'.format('|'.join(modifiers)), Keyword.Declaration),
|
| 62 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String),
|
| 63 |
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
|
| 64 |
+
(r'.', Text)
|
| 65 |
+
],
|
| 66 |
+
}
|