Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/INSTALLER +1 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/METADATA +241 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/RECORD +0 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/REQUESTED +0 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/WHEEL +5 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/entry_points.txt +3 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/licenses/LICENSE +21 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/diff.py +165 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dotnet.py +691 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dsls.py +878 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dylan.py +289 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ecl.py +125 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/eiffel.py +65 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/elm.py +121 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/erlang.py +533 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/esoteric.py +277 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ezhil.py +69 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/factor.py +344 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/fantom.py +250 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/felix.py +273 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/forth.py +177 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/fortran.py +205 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/foxpro.py +428 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/functional.py +21 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/go.py +101 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/grammar_notation.py +213 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/graph.py +80 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/graphics.py +553 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/haskell.py +843 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/haxe.py +936 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/hdl.py +382 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/hexdump.py +103 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/html.py +602 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/idl.py +270 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/igor.py +288 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/inferno.py +96 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/installers.py +322 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/int_fiction.py +1343 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/iolang.py +63 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/j.py +146 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/javascript.py +1525 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/julia.py +333 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/jvm.py +1573 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/lisp.py +0 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/make.py +202 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/markup.py +595 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/math.py +21 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/matlab.py +663 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ml.py +769 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/modeling.py +358 -0
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: wandb
|
| 3 |
+
Version: 0.25.0
|
| 4 |
+
Summary: A CLI and library for interacting with the Weights & Biases API.
|
| 5 |
+
Project-URL: Source, https://github.com/wandb/wandb
|
| 6 |
+
Project-URL: Bug Reports, https://github.com/wandb/wandb/issues
|
| 7 |
+
Project-URL: Documentation, https://docs.wandb.ai/
|
| 8 |
+
Author-email: Weights & Biases <support@wandb.com>
|
| 9 |
+
License: MIT License
|
| 10 |
+
|
| 11 |
+
Copyright (c) 2021 Weights and Biases, Inc.
|
| 12 |
+
|
| 13 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 14 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 15 |
+
in the Software without restriction, including without limitation the rights
|
| 16 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 17 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 18 |
+
furnished to do so, subject to the following conditions:
|
| 19 |
+
|
| 20 |
+
The above copyright notice and this permission notice shall be included in all
|
| 21 |
+
copies or substantial portions of the Software.
|
| 22 |
+
|
| 23 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 24 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 26 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 27 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 28 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 29 |
+
SOFTWARE.
|
| 30 |
+
License-File: LICENSE
|
| 31 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 32 |
+
Classifier: Intended Audience :: Developers
|
| 33 |
+
Classifier: Intended Audience :: Science/Research
|
| 34 |
+
Classifier: License :: OSI Approved :: MIT License
|
| 35 |
+
Classifier: Natural Language :: English
|
| 36 |
+
Classifier: Programming Language :: Go
|
| 37 |
+
Classifier: Programming Language :: Python :: 3
|
| 38 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 39 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 40 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 41 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 42 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 43 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 44 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 45 |
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
| 46 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 47 |
+
Classifier: Topic :: System :: Logging
|
| 48 |
+
Classifier: Topic :: System :: Monitoring
|
| 49 |
+
Requires-Python: >=3.9
|
| 50 |
+
Requires-Dist: click>=8.0.1
|
| 51 |
+
Requires-Dist: eval-type-backport; python_version < '3.10'
|
| 52 |
+
Requires-Dist: gitpython!=3.1.29,>=1.0.0
|
| 53 |
+
Requires-Dist: packaging
|
| 54 |
+
Requires-Dist: platformdirs
|
| 55 |
+
Requires-Dist: protobuf!=4.21.0,!=5.28.0,<7,>=3.15.0; python_version == '3.9' and sys_platform == 'linux'
|
| 56 |
+
Requires-Dist: protobuf!=4.21.0,!=5.28.0,<7,>=3.19.0; python_version > '3.9' and sys_platform == 'linux'
|
| 57 |
+
Requires-Dist: protobuf!=4.21.0,!=5.28.0,<7,>=3.19.0; sys_platform != 'linux'
|
| 58 |
+
Requires-Dist: pydantic<3
|
| 59 |
+
Requires-Dist: pyyaml
|
| 60 |
+
Requires-Dist: requests<3,>=2.0.0
|
| 61 |
+
Requires-Dist: sentry-sdk>=2.0.0
|
| 62 |
+
Requires-Dist: typing-extensions<5,>=4.8
|
| 63 |
+
Provides-Extra: aws
|
| 64 |
+
Requires-Dist: boto3; extra == 'aws'
|
| 65 |
+
Requires-Dist: botocore>=1.5.76; extra == 'aws'
|
| 66 |
+
Provides-Extra: azure
|
| 67 |
+
Requires-Dist: azure-identity; extra == 'azure'
|
| 68 |
+
Requires-Dist: azure-storage-blob; extra == 'azure'
|
| 69 |
+
Provides-Extra: gcp
|
| 70 |
+
Requires-Dist: google-cloud-storage; extra == 'gcp'
|
| 71 |
+
Provides-Extra: importers
|
| 72 |
+
Requires-Dist: filelock; extra == 'importers'
|
| 73 |
+
Requires-Dist: mlflow; extra == 'importers'
|
| 74 |
+
Requires-Dist: polars<=1.2.1; extra == 'importers'
|
| 75 |
+
Requires-Dist: rich; extra == 'importers'
|
| 76 |
+
Requires-Dist: tenacity; extra == 'importers'
|
| 77 |
+
Provides-Extra: kubeflow
|
| 78 |
+
Requires-Dist: google-cloud-storage; extra == 'kubeflow'
|
| 79 |
+
Requires-Dist: kubernetes; extra == 'kubeflow'
|
| 80 |
+
Requires-Dist: minio; extra == 'kubeflow'
|
| 81 |
+
Requires-Dist: sh; extra == 'kubeflow'
|
| 82 |
+
Provides-Extra: launch
|
| 83 |
+
Requires-Dist: awscli; extra == 'launch'
|
| 84 |
+
Requires-Dist: azure-containerregistry; extra == 'launch'
|
| 85 |
+
Requires-Dist: azure-identity; extra == 'launch'
|
| 86 |
+
Requires-Dist: azure-storage-blob; extra == 'launch'
|
| 87 |
+
Requires-Dist: boto3; extra == 'launch'
|
| 88 |
+
Requires-Dist: botocore>=1.5.76; extra == 'launch'
|
| 89 |
+
Requires-Dist: chardet; extra == 'launch'
|
| 90 |
+
Requires-Dist: google-auth; extra == 'launch'
|
| 91 |
+
Requires-Dist: google-cloud-aiplatform; extra == 'launch'
|
| 92 |
+
Requires-Dist: google-cloud-artifact-registry; extra == 'launch'
|
| 93 |
+
Requires-Dist: google-cloud-compute; extra == 'launch'
|
| 94 |
+
Requires-Dist: google-cloud-storage; extra == 'launch'
|
| 95 |
+
Requires-Dist: iso8601; extra == 'launch'
|
| 96 |
+
Requires-Dist: jsonschema; extra == 'launch'
|
| 97 |
+
Requires-Dist: kubernetes; extra == 'launch'
|
| 98 |
+
Requires-Dist: kubernetes-asyncio; extra == 'launch'
|
| 99 |
+
Requires-Dist: nbconvert; extra == 'launch'
|
| 100 |
+
Requires-Dist: nbformat; extra == 'launch'
|
| 101 |
+
Requires-Dist: optuna; extra == 'launch'
|
| 102 |
+
Requires-Dist: pydantic; extra == 'launch'
|
| 103 |
+
Requires-Dist: pyyaml>=6.0.0; extra == 'launch'
|
| 104 |
+
Requires-Dist: tomli; extra == 'launch'
|
| 105 |
+
Requires-Dist: tornado>=6.5.0; (python_version >= '3.9') and extra == 'launch'
|
| 106 |
+
Requires-Dist: typing-extensions; extra == 'launch'
|
| 107 |
+
Provides-Extra: media
|
| 108 |
+
Requires-Dist: bokeh; extra == 'media'
|
| 109 |
+
Requires-Dist: imageio>=2.28.1; extra == 'media'
|
| 110 |
+
Requires-Dist: moviepy>=1.0.0; extra == 'media'
|
| 111 |
+
Requires-Dist: numpy; extra == 'media'
|
| 112 |
+
Requires-Dist: pillow; extra == 'media'
|
| 113 |
+
Requires-Dist: plotly>=5.18.0; extra == 'media'
|
| 114 |
+
Requires-Dist: rdkit; extra == 'media'
|
| 115 |
+
Requires-Dist: soundfile; extra == 'media'
|
| 116 |
+
Provides-Extra: models
|
| 117 |
+
Requires-Dist: cloudpickle; extra == 'models'
|
| 118 |
+
Provides-Extra: perf
|
| 119 |
+
Requires-Dist: orjson; extra == 'perf'
|
| 120 |
+
Provides-Extra: sweeps
|
| 121 |
+
Requires-Dist: sweeps>=0.2.0; extra == 'sweeps'
|
| 122 |
+
Provides-Extra: workspaces
|
| 123 |
+
Requires-Dist: wandb-workspaces; extra == 'workspaces'
|
| 124 |
+
Description-Content-Type: text/markdown
|
| 125 |
+
|
| 126 |
+
<div align="center">
|
| 127 |
+
<img src="https://i.imgur.com/dQLeGCc.png" width="600" /><br><br>
|
| 128 |
+
</div>
|
| 129 |
+
|
| 130 |
+
<p align="center">
|
| 131 |
+
<a href="https://pypi.python.org/pypi/wandb"><img src="https://img.shields.io/pypi/v/wandb" /></a>
|
| 132 |
+
<a href="https://anaconda.org/conda-forge/wandb"><img src="https://img.shields.io/conda/vn/conda-forge/wandb" /></a>
|
| 133 |
+
<a href="https://pypi.python.org/pypi/wandb"><img src="https://img.shields.io/pypi/pyversions/wandb" /></a>
|
| 134 |
+
<a href="https://circleci.com/gh/wandb/wandb"><img src="https://img.shields.io/circleci/build/github/wandb/wandb/main" /></a>
|
| 135 |
+
<a href="https://codecov.io/gh/wandb/wandb"><img src="https://img.shields.io/codecov/c/gh/wandb/wandb" /></a>
|
| 136 |
+
</p>
|
| 137 |
+
<p align='center'>
|
| 138 |
+
<a href="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/intro/Intro_to_Weights_%26_Biases.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" /></a>
|
| 139 |
+
</p>
|
| 140 |
+
|
| 141 |
+
Use W&B to build better models faster. Track and visualize all the pieces of your machine learning pipeline, from datasets to production machine learning models. Get started with W&B today, [sign up for a W&B account](https://wandb.com?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=readme)!
|
| 142 |
+
|
| 143 |
+
<br>
|
| 144 |
+
|
| 145 |
+
Building an LLM app? Track, debug, evaluate, and monitor LLM apps with [Weave](https://wandb.github.io/weave?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=readme), our new suite of tools for GenAI.
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
# Documentation
|
| 150 |
+
|
| 151 |
+
See the [W&B Developer Guide](https://docs.wandb.ai/?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=documentation) and [API Reference Guide](https://docs.wandb.ai/training/api-reference#api-overview?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=documentation) for a full technical description of the W&B platform.
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
# Quickstart
|
| 156 |
+
|
| 157 |
+
Install W&B to track, visualize, and manage machine learning experiments of any size.
|
| 158 |
+
|
| 159 |
+
## Install the wandb library
|
| 160 |
+
|
| 161 |
+
```shell
|
| 162 |
+
pip install wandb
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
## Sign up and create an API key
|
| 166 |
+
|
| 167 |
+
Sign up for a [W&B account](https://wandb.ai/login?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=quickstart). Optionally, use the `wandb login` CLI to configure an API key on your machine. You can skip this step -- W&B will prompt you for an API key the first time you use it.
|
| 168 |
+
|
| 169 |
+
## Create a machine learning training experiment
|
| 170 |
+
|
| 171 |
+
In your Python script or notebook, initialize a W&B run with `wandb.init()`.
|
| 172 |
+
Specify hyperparameters and log metrics and other information to W&B.
|
| 173 |
+
|
| 174 |
+
```python
|
| 175 |
+
import wandb
|
| 176 |
+
|
| 177 |
+
# Project that the run is recorded to
|
| 178 |
+
project = "my-awesome-project"
|
| 179 |
+
|
| 180 |
+
# Dictionary with hyperparameters
|
| 181 |
+
config = {"epochs" : 1337, "lr" : 3e-4}
|
| 182 |
+
|
| 183 |
+
# The `with` syntax marks the run as finished upon exiting the `with` block,
|
| 184 |
+
# and it marks the run "failed" if there's an exception.
|
| 185 |
+
#
|
| 186 |
+
# In a notebook, it may be more convenient to write `run = wandb.init()`
|
| 187 |
+
# and manually call `run.finish()` instead of using a `with` block.
|
| 188 |
+
with wandb.init(project=project, config=config) as run:
|
| 189 |
+
# Training code here
|
| 190 |
+
|
| 191 |
+
# Log values to W&B with run.log()
|
| 192 |
+
run.log({"accuracy": 0.9, "loss": 0.1})
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
Visit [wandb.ai/home](https://wandb.ai/home) to view recorded metrics such as accuracy and loss and how they changed during each training step. Each run object appears in the Runs column with generated names.
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
# Integrations
|
| 200 |
+
|
| 201 |
+
W&B [integrates](https://docs.wandb.ai/models/integrations) with popular ML frameworks and libraries making it fast and easy to set up experiment tracking and data versioning inside existing projects.
|
| 202 |
+
|
| 203 |
+
For developers adding W&B to a new framework, follow the [W&B Developer Guide](https://docs.wandb.ai/models/integrations/add-wandb-to-any-library).
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
# W&B Hosting Options
|
| 208 |
+
|
| 209 |
+
Weights & Biases is available in the cloud or installed on your private infrastructure. Set up a W&B Server in a production environment in one of three ways:
|
| 210 |
+
|
| 211 |
+
1. [Multi-tenant Cloud](https://docs.wandb.ai/platform/hosting/hosting-options/multi_tenant_cloud?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=hosting): Fully managed platform deployed in W&B’s Google Cloud Platform (GCP) account in GCP��s North America regions.
|
| 212 |
+
2. [Dedicated Cloud](https://docs.wandb.ai/platform/hosting/hosting-options/dedicated_cloud?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=hosting): Single-tenant, fully managed platform deployed in W&B’s AWS, GCP, or Azure cloud accounts. Each Dedicated Cloud instance has its own isolated network, compute and storage from other W&B Dedicated Cloud instances.
|
| 213 |
+
3. [Self-Managed](https://docs.wandb.ai/platform/hosting/hosting-options/self-managed?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=hosting): Deploy W&B Server on your AWS, GCP, or Azure cloud account or within your on-premises infrastructure.
|
| 214 |
+
|
| 215 |
+
See the [Hosting documentation](https://docs.wandb.ai/guides/hosting?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=hosting) in the W&B Developer Guide for more information.
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
# Python Version Support
|
| 220 |
+
|
| 221 |
+
We are committed to supporting our minimum required Python version for _at least_ six months after its official end-of-life (EOL) date, as defined by the Python Software Foundation. You can find a list of Python EOL dates [here](https://devguide.python.org/versions/).
|
| 222 |
+
|
| 223 |
+
When we discontinue support for a Python version, we will increment the library’s minor version number to reflect this change.
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
# Contribution guidelines
|
| 228 |
+
|
| 229 |
+
Weights & Biases ❤️ open source, and we welcome contributions from the community! See the [Contribution guide](https://github.com/wandb/wandb/blob/main/CONTRIBUTING.md) for more information on the development workflow and the internals of the wandb library. For wandb bugs and feature requests, visit [GitHub Issues](https://github.com/wandb/wandb/issues) or contact support@wandb.com.
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
# W&B Community
|
| 234 |
+
|
| 235 |
+
Be a part of the growing W&B Community and interact with the W&B team in our [Discord](https://wandb.me/discord). Stay connected with the latest ML updates and tutorials with [W&B Fully Connected](https://wandb.ai/fully-connected).
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
# License
|
| 240 |
+
|
| 241 |
+
[MIT License](https://github.com/wandb/wandb/blob/main/LICENSE)
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/RECORD
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/REQUESTED
ADDED
|
File without changes
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: hatchling 1.27.0
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-manylinux_2_28_x86_64
|
| 5 |
+
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
wandb = wandb.cli.cli:cli
|
| 3 |
+
wb = wandb.cli.cli:cli
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2021 Weights and Biases, Inc.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/diff.py
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.diff
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for diff/patch formats.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, include, bygroups
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, Generic, \
|
| 16 |
+
Literal
|
| 17 |
+
|
| 18 |
+
__all__ = ['DiffLexer', 'DarcsPatchLexer', 'WDiffLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class DiffLexer(RegexLexer):
|
| 22 |
+
"""
|
| 23 |
+
Lexer for unified or context-style diffs or patches.
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
name = 'Diff'
|
| 27 |
+
aliases = ['diff', 'udiff']
|
| 28 |
+
filenames = ['*.diff', '*.patch']
|
| 29 |
+
mimetypes = ['text/x-diff', 'text/x-patch']
|
| 30 |
+
|
| 31 |
+
tokens = {
|
| 32 |
+
'root': [
|
| 33 |
+
(r' .*\n', Text),
|
| 34 |
+
(r'\+.*\n', Generic.Inserted),
|
| 35 |
+
(r'-.*\n', Generic.Deleted),
|
| 36 |
+
(r'!.*\n', Generic.Strong),
|
| 37 |
+
(r'@.*\n', Generic.Subheading),
|
| 38 |
+
(r'([Ii]ndex|diff).*\n', Generic.Heading),
|
| 39 |
+
(r'=.*\n', Generic.Heading),
|
| 40 |
+
(r'.*\n', Text),
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
def analyse_text(text):
|
| 45 |
+
if text[:7] == 'Index: ':
|
| 46 |
+
return True
|
| 47 |
+
if text[:5] == 'diff ':
|
| 48 |
+
return True
|
| 49 |
+
if text[:4] == '--- ':
|
| 50 |
+
return 0.9
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class DarcsPatchLexer(RegexLexer):
|
| 54 |
+
"""
|
| 55 |
+
DarcsPatchLexer is a lexer for the various versions of the darcs patch
|
| 56 |
+
format. Examples of this format are derived by commands such as
|
| 57 |
+
``darcs annotate --patch`` and ``darcs send``.
|
| 58 |
+
|
| 59 |
+
.. versionadded:: 0.10
|
| 60 |
+
"""
|
| 61 |
+
|
| 62 |
+
name = 'Darcs Patch'
|
| 63 |
+
aliases = ['dpatch']
|
| 64 |
+
filenames = ['*.dpatch', '*.darcspatch']
|
| 65 |
+
|
| 66 |
+
DPATCH_KEYWORDS = ('hunk', 'addfile', 'adddir', 'rmfile', 'rmdir', 'move',
|
| 67 |
+
'replace')
|
| 68 |
+
|
| 69 |
+
tokens = {
|
| 70 |
+
'root': [
|
| 71 |
+
(r'<', Operator),
|
| 72 |
+
(r'>', Operator),
|
| 73 |
+
(r'\{', Operator),
|
| 74 |
+
(r'\}', Operator),
|
| 75 |
+
(r'(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)(\])',
|
| 76 |
+
bygroups(Operator, Keyword, Name, Text, Name, Operator,
|
| 77 |
+
Literal.Date, Text, Operator)),
|
| 78 |
+
(r'(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)',
|
| 79 |
+
bygroups(Operator, Keyword, Name, Text, Name, Operator,
|
| 80 |
+
Literal.Date, Text), 'comment'),
|
| 81 |
+
(r'New patches:', Generic.Heading),
|
| 82 |
+
(r'Context:', Generic.Heading),
|
| 83 |
+
(r'Patch bundle hash:', Generic.Heading),
|
| 84 |
+
(r'(\s*)(%s)(.*\n)' % '|'.join(DPATCH_KEYWORDS),
|
| 85 |
+
bygroups(Text, Keyword, Text)),
|
| 86 |
+
(r'\+', Generic.Inserted, "insert"),
|
| 87 |
+
(r'-', Generic.Deleted, "delete"),
|
| 88 |
+
(r'.*\n', Text),
|
| 89 |
+
],
|
| 90 |
+
'comment': [
|
| 91 |
+
(r'[^\]].*\n', Comment),
|
| 92 |
+
(r'\]', Operator, "#pop"),
|
| 93 |
+
],
|
| 94 |
+
'specialText': [ # darcs add [_CODE_] special operators for clarity
|
| 95 |
+
(r'\n', Text, "#pop"), # line-based
|
| 96 |
+
(r'\[_[^_]*_]', Operator),
|
| 97 |
+
],
|
| 98 |
+
'insert': [
|
| 99 |
+
include('specialText'),
|
| 100 |
+
(r'\[', Generic.Inserted),
|
| 101 |
+
(r'[^\n\[]+', Generic.Inserted),
|
| 102 |
+
],
|
| 103 |
+
'delete': [
|
| 104 |
+
include('specialText'),
|
| 105 |
+
(r'\[', Generic.Deleted),
|
| 106 |
+
(r'[^\n\[]+', Generic.Deleted),
|
| 107 |
+
],
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
class WDiffLexer(RegexLexer):
|
| 112 |
+
"""
|
| 113 |
+
A `wdiff <https://www.gnu.org/software/wdiff/>`_ lexer.
|
| 114 |
+
|
| 115 |
+
Note that:
|
| 116 |
+
|
| 117 |
+
* only to normal output (without option like -l).
|
| 118 |
+
* if target files of wdiff contain "[-", "-]", "{+", "+}",
|
| 119 |
+
especially they are unbalanced, this lexer will get confusing.
|
| 120 |
+
|
| 121 |
+
.. versionadded:: 2.2
|
| 122 |
+
"""
|
| 123 |
+
|
| 124 |
+
name = 'WDiff'
|
| 125 |
+
aliases = ['wdiff']
|
| 126 |
+
filenames = ['*.wdiff']
|
| 127 |
+
mimetypes = []
|
| 128 |
+
|
| 129 |
+
flags = re.MULTILINE | re.DOTALL
|
| 130 |
+
|
| 131 |
+
# We can only assume "[-" after "[-" before "-]" is `nested`,
|
| 132 |
+
# for instance wdiff to wdiff outputs. We have no way to
|
| 133 |
+
# distinct these marker is of wdiff output from original text.
|
| 134 |
+
|
| 135 |
+
ins_op = r"\{\+"
|
| 136 |
+
ins_cl = r"\+\}"
|
| 137 |
+
del_op = r"\[\-"
|
| 138 |
+
del_cl = r"\-\]"
|
| 139 |
+
normal = r'[^{}[\]+-]+' # for performance
|
| 140 |
+
tokens = {
|
| 141 |
+
'root': [
|
| 142 |
+
(ins_op, Generic.Inserted, 'inserted'),
|
| 143 |
+
(del_op, Generic.Deleted, 'deleted'),
|
| 144 |
+
(normal, Text),
|
| 145 |
+
(r'.', Text),
|
| 146 |
+
],
|
| 147 |
+
'inserted': [
|
| 148 |
+
(ins_op, Generic.Inserted, '#push'),
|
| 149 |
+
(del_op, Generic.Inserted, '#push'),
|
| 150 |
+
(del_cl, Generic.Inserted, '#pop'),
|
| 151 |
+
|
| 152 |
+
(ins_cl, Generic.Inserted, '#pop'),
|
| 153 |
+
(normal, Generic.Inserted),
|
| 154 |
+
(r'.', Generic.Inserted),
|
| 155 |
+
],
|
| 156 |
+
'deleted': [
|
| 157 |
+
(del_op, Generic.Deleted, '#push'),
|
| 158 |
+
(ins_op, Generic.Deleted, '#push'),
|
| 159 |
+
(ins_cl, Generic.Deleted, '#pop'),
|
| 160 |
+
|
| 161 |
+
(del_cl, Generic.Deleted, '#pop'),
|
| 162 |
+
(normal, Generic.Deleted),
|
| 163 |
+
(r'.', Generic.Deleted),
|
| 164 |
+
],
|
| 165 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dotnet.py
ADDED
|
@@ -0,0 +1,691 @@
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.dotnet
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for .net languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import RegexLexer, DelegatingLexer, bygroups, include, \
|
| 14 |
+
using, this, default, words
|
| 15 |
+
from pygments.token import Punctuation, \
|
| 16 |
+
Text, Comment, Operator, Keyword, Name, String, Number, Literal, Other
|
| 17 |
+
from pygments.util import get_choice_opt, iteritems
|
| 18 |
+
from pygments import unistring as uni
|
| 19 |
+
|
| 20 |
+
from pygments.lexers.html import XmlLexer
|
| 21 |
+
|
| 22 |
+
__all__ = ['CSharpLexer', 'NemerleLexer', 'BooLexer', 'VbNetLexer',
|
| 23 |
+
'CSharpAspxLexer', 'VbNetAspxLexer', 'FSharpLexer']
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class CSharpLexer(RegexLexer):
|
| 27 |
+
"""
|
| 28 |
+
For `C# <http://msdn2.microsoft.com/en-us/vcsharp/default.aspx>`_
|
| 29 |
+
source code.
|
| 30 |
+
|
| 31 |
+
Additional options accepted:
|
| 32 |
+
|
| 33 |
+
`unicodelevel`
|
| 34 |
+
Determines which Unicode characters this lexer allows for identifiers.
|
| 35 |
+
The possible values are:
|
| 36 |
+
|
| 37 |
+
* ``none`` -- only the ASCII letters and numbers are allowed. This
|
| 38 |
+
is the fastest selection.
|
| 39 |
+
* ``basic`` -- all Unicode characters from the specification except
|
| 40 |
+
category ``Lo`` are allowed.
|
| 41 |
+
* ``full`` -- all Unicode characters as specified in the C# specs
|
| 42 |
+
are allowed. Note that this means a considerable slowdown since the
|
| 43 |
+
``Lo`` category has more than 40,000 characters in it!
|
| 44 |
+
|
| 45 |
+
The default value is ``basic``.
|
| 46 |
+
|
| 47 |
+
.. versionadded:: 0.8
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
name = 'C#'
|
| 51 |
+
aliases = ['csharp', 'c#']
|
| 52 |
+
filenames = ['*.cs']
|
| 53 |
+
mimetypes = ['text/x-csharp'] # inferred
|
| 54 |
+
|
| 55 |
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
| 56 |
+
|
| 57 |
+
# for the range of allowed unicode characters in identifiers, see
|
| 58 |
+
# http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
|
| 59 |
+
|
| 60 |
+
levels = {
|
| 61 |
+
'none': '@?[_a-zA-Z]\w*',
|
| 62 |
+
'basic': ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
|
| 63 |
+
'[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc',
|
| 64 |
+
'Cf', 'Mn', 'Mc') + ']*'),
|
| 65 |
+
'full': ('@?(?:_|[^' +
|
| 66 |
+
uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])'
|
| 67 |
+
+ '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
|
| 68 |
+
'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'),
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
tokens = {}
|
| 72 |
+
token_variants = True
|
| 73 |
+
|
| 74 |
+
for levelname, cs_ident in iteritems(levels):
|
| 75 |
+
tokens[levelname] = {
|
| 76 |
+
'root': [
|
| 77 |
+
# method names
|
| 78 |
+
(r'^([ \t]*(?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type
|
| 79 |
+
r'(' + cs_ident + ')' # method name
|
| 80 |
+
r'(\s*)(\()', # signature start
|
| 81 |
+
bygroups(using(this), Name.Function, Text, Punctuation)),
|
| 82 |
+
(r'^\s*\[.*?\]', Name.Attribute),
|
| 83 |
+
(r'[^\S\n]+', Text),
|
| 84 |
+
(r'\\\n', Text), # line continuation
|
| 85 |
+
(r'//.*?\n', Comment.Single),
|
| 86 |
+
(r'/[*].*?[*]/', Comment.Multiline),
|
| 87 |
+
(r'\n', Text),
|
| 88 |
+
(r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation),
|
| 89 |
+
(r'[{}]', Punctuation),
|
| 90 |
+
(r'@"(""|[^"])*"', String),
|
| 91 |
+
(r'"(\\\\|\\"|[^"\n])*["\n]', String),
|
| 92 |
+
(r"'\\.'|'[^\\]'", String.Char),
|
| 93 |
+
(r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?"
|
| 94 |
+
r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number),
|
| 95 |
+
(r'#[ \t]*(if|endif|else|elif|define|undef|'
|
| 96 |
+
r'line|error|warning|region|endregion|pragma)\b.*?\n',
|
| 97 |
+
Comment.Preproc),
|
| 98 |
+
(r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Text,
|
| 99 |
+
Keyword)),
|
| 100 |
+
(r'(abstract|as|async|await|base|break|by|case|catch|'
|
| 101 |
+
r'checked|const|continue|default|delegate|'
|
| 102 |
+
r'do|else|enum|event|explicit|extern|false|finally|'
|
| 103 |
+
r'fixed|for|foreach|goto|if|implicit|in|interface|'
|
| 104 |
+
r'internal|is|let|lock|new|null|on|operator|'
|
| 105 |
+
r'out|override|params|private|protected|public|readonly|'
|
| 106 |
+
r'ref|return|sealed|sizeof|stackalloc|static|'
|
| 107 |
+
r'switch|this|throw|true|try|typeof|'
|
| 108 |
+
r'unchecked|unsafe|virtual|void|while|'
|
| 109 |
+
r'get|set|new|partial|yield|add|remove|value|alias|ascending|'
|
| 110 |
+
r'descending|from|group|into|orderby|select|thenby|where|'
|
| 111 |
+
r'join|equals)\b', Keyword),
|
| 112 |
+
(r'(global)(::)', bygroups(Keyword, Punctuation)),
|
| 113 |
+
(r'(bool|byte|char|decimal|double|dynamic|float|int|long|object|'
|
| 114 |
+
r'sbyte|short|string|uint|ulong|ushort|var)\b\??', Keyword.Type),
|
| 115 |
+
(r'(class|struct)(\s+)', bygroups(Keyword, Text), 'class'),
|
| 116 |
+
(r'(namespace|using)(\s+)', bygroups(Keyword, Text), 'namespace'),
|
| 117 |
+
(cs_ident, Name),
|
| 118 |
+
],
|
| 119 |
+
'class': [
|
| 120 |
+
(cs_ident, Name.Class, '#pop'),
|
| 121 |
+
default('#pop'),
|
| 122 |
+
],
|
| 123 |
+
'namespace': [
|
| 124 |
+
(r'(?=\()', Text, '#pop'), # using (resource)
|
| 125 |
+
('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop'),
|
| 126 |
+
]
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
def __init__(self, **options):
|
| 130 |
+
level = get_choice_opt(options, 'unicodelevel', list(self.tokens), 'basic')
|
| 131 |
+
if level not in self._all_tokens:
|
| 132 |
+
# compile the regexes now
|
| 133 |
+
self._tokens = self.__class__.process_tokendef(level)
|
| 134 |
+
else:
|
| 135 |
+
self._tokens = self._all_tokens[level]
|
| 136 |
+
|
| 137 |
+
RegexLexer.__init__(self, **options)
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
class NemerleLexer(RegexLexer):
|
| 141 |
+
"""
|
| 142 |
+
For `Nemerle <http://nemerle.org>`_ source code.
|
| 143 |
+
|
| 144 |
+
Additional options accepted:
|
| 145 |
+
|
| 146 |
+
`unicodelevel`
|
| 147 |
+
Determines which Unicode characters this lexer allows for identifiers.
|
| 148 |
+
The possible values are:
|
| 149 |
+
|
| 150 |
+
* ``none`` -- only the ASCII letters and numbers are allowed. This
|
| 151 |
+
is the fastest selection.
|
| 152 |
+
* ``basic`` -- all Unicode characters from the specification except
|
| 153 |
+
category ``Lo`` are allowed.
|
| 154 |
+
* ``full`` -- all Unicode characters as specified in the C# specs
|
| 155 |
+
are allowed. Note that this means a considerable slowdown since the
|
| 156 |
+
``Lo`` category has more than 40,000 characters in it!
|
| 157 |
+
|
| 158 |
+
The default value is ``basic``.
|
| 159 |
+
|
| 160 |
+
.. versionadded:: 1.5
|
| 161 |
+
"""
|
| 162 |
+
|
| 163 |
+
name = 'Nemerle'
|
| 164 |
+
aliases = ['nemerle']
|
| 165 |
+
filenames = ['*.n']
|
| 166 |
+
mimetypes = ['text/x-nemerle'] # inferred
|
| 167 |
+
|
| 168 |
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
| 169 |
+
|
| 170 |
+
# for the range of allowed unicode characters in identifiers, see
|
| 171 |
+
# http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
|
| 172 |
+
|
| 173 |
+
levels = {
|
| 174 |
+
'none': '@?[_a-zA-Z]\w*',
|
| 175 |
+
'basic': ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
|
| 176 |
+
'[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc',
|
| 177 |
+
'Cf', 'Mn', 'Mc') + ']*'),
|
| 178 |
+
'full': ('@?(?:_|[^' +
|
| 179 |
+
uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])'
|
| 180 |
+
+ '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
|
| 181 |
+
'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'),
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
tokens = {}
|
| 185 |
+
token_variants = True
|
| 186 |
+
|
| 187 |
+
for levelname, cs_ident in iteritems(levels):
|
| 188 |
+
tokens[levelname] = {
|
| 189 |
+
'root': [
|
| 190 |
+
# method names
|
| 191 |
+
(r'^([ \t]*(?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type
|
| 192 |
+
r'(' + cs_ident + ')' # method name
|
| 193 |
+
r'(\s*)(\()', # signature start
|
| 194 |
+
bygroups(using(this), Name.Function, Text, Punctuation)),
|
| 195 |
+
(r'^\s*\[.*?\]', Name.Attribute),
|
| 196 |
+
(r'[^\S\n]+', Text),
|
| 197 |
+
(r'\\\n', Text), # line continuation
|
| 198 |
+
(r'//.*?\n', Comment.Single),
|
| 199 |
+
(r'/[*].*?[*]/', Comment.Multiline),
|
| 200 |
+
(r'\n', Text),
|
| 201 |
+
(r'\$\s*"', String, 'splice-string'),
|
| 202 |
+
(r'\$\s*<#', String, 'splice-string2'),
|
| 203 |
+
(r'<#', String, 'recursive-string'),
|
| 204 |
+
|
| 205 |
+
(r'(<\[)\s*(' + cs_ident + ':)?', Keyword),
|
| 206 |
+
(r'\]\>', Keyword),
|
| 207 |
+
|
| 208 |
+
# quasiquotation only
|
| 209 |
+
(r'\$' + cs_ident, Name),
|
| 210 |
+
(r'(\$)(\()', bygroups(Name, Punctuation),
|
| 211 |
+
'splice-string-content'),
|
| 212 |
+
|
| 213 |
+
(r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation),
|
| 214 |
+
(r'[{}]', Punctuation),
|
| 215 |
+
(r'@"(""|[^"])*"', String),
|
| 216 |
+
(r'"(\\\\|\\"|[^"\n])*["\n]', String),
|
| 217 |
+
(r"'\\.'|'[^\\]'", String.Char),
|
| 218 |
+
(r"0[xX][0-9a-fA-F]+[Ll]?", Number),
|
| 219 |
+
(r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFLdD]?", Number),
|
| 220 |
+
(r'#[ \t]*(if|endif|else|elif|define|undef|'
|
| 221 |
+
r'line|error|warning|region|endregion|pragma)\b.*?\n',
|
| 222 |
+
Comment.Preproc),
|
| 223 |
+
(r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Text,
|
| 224 |
+
Keyword)),
|
| 225 |
+
(r'(abstract|and|as|base|catch|def|delegate|'
|
| 226 |
+
r'enum|event|extern|false|finally|'
|
| 227 |
+
r'fun|implements|interface|internal|'
|
| 228 |
+
r'is|macro|match|matches|module|mutable|new|'
|
| 229 |
+
r'null|out|override|params|partial|private|'
|
| 230 |
+
r'protected|public|ref|sealed|static|'
|
| 231 |
+
r'syntax|this|throw|true|try|type|typeof|'
|
| 232 |
+
r'virtual|volatile|when|where|with|'
|
| 233 |
+
r'assert|assert2|async|break|checked|continue|do|else|'
|
| 234 |
+
r'ensures|for|foreach|if|late|lock|new|nolate|'
|
| 235 |
+
r'otherwise|regexp|repeat|requires|return|surroundwith|'
|
| 236 |
+
r'unchecked|unless|using|while|yield)\b', Keyword),
|
| 237 |
+
(r'(global)(::)', bygroups(Keyword, Punctuation)),
|
| 238 |
+
(r'(bool|byte|char|decimal|double|float|int|long|object|sbyte|'
|
| 239 |
+
r'short|string|uint|ulong|ushort|void|array|list)\b\??',
|
| 240 |
+
Keyword.Type),
|
| 241 |
+
(r'(:>?)\s*(' + cs_ident + r'\??)',
|
| 242 |
+
bygroups(Punctuation, Keyword.Type)),
|
| 243 |
+
(r'(class|struct|variant|module)(\s+)',
|
| 244 |
+
bygroups(Keyword, Text), 'class'),
|
| 245 |
+
(r'(namespace|using)(\s+)', bygroups(Keyword, Text),
|
| 246 |
+
'namespace'),
|
| 247 |
+
(cs_ident, Name),
|
| 248 |
+
],
|
| 249 |
+
'class': [
|
| 250 |
+
(cs_ident, Name.Class, '#pop')
|
| 251 |
+
],
|
| 252 |
+
'namespace': [
|
| 253 |
+
(r'(?=\()', Text, '#pop'), # using (resource)
|
| 254 |
+
('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop')
|
| 255 |
+
],
|
| 256 |
+
'splice-string': [
|
| 257 |
+
(r'[^"$]', String),
|
| 258 |
+
(r'\$' + cs_ident, Name),
|
| 259 |
+
(r'(\$)(\()', bygroups(Name, Punctuation),
|
| 260 |
+
'splice-string-content'),
|
| 261 |
+
(r'\\"', String),
|
| 262 |
+
(r'"', String, '#pop')
|
| 263 |
+
],
|
| 264 |
+
'splice-string2': [
|
| 265 |
+
(r'[^#<>$]', String),
|
| 266 |
+
(r'\$' + cs_ident, Name),
|
| 267 |
+
(r'(\$)(\()', bygroups(Name, Punctuation),
|
| 268 |
+
'splice-string-content'),
|
| 269 |
+
(r'<#', String, '#push'),
|
| 270 |
+
(r'#>', String, '#pop')
|
| 271 |
+
],
|
| 272 |
+
'recursive-string': [
|
| 273 |
+
(r'[^#<>]', String),
|
| 274 |
+
(r'<#', String, '#push'),
|
| 275 |
+
(r'#>', String, '#pop')
|
| 276 |
+
],
|
| 277 |
+
'splice-string-content': [
|
| 278 |
+
(r'if|match', Keyword),
|
| 279 |
+
(r'[~!%^&*+=|\[\]:;,.<>/?-\\"$ ]', Punctuation),
|
| 280 |
+
(cs_ident, Name),
|
| 281 |
+
(r'\d+', Number),
|
| 282 |
+
(r'\(', Punctuation, '#push'),
|
| 283 |
+
(r'\)', Punctuation, '#pop')
|
| 284 |
+
]
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
def __init__(self, **options):
|
| 288 |
+
level = get_choice_opt(options, 'unicodelevel', list(self.tokens),
|
| 289 |
+
'basic')
|
| 290 |
+
if level not in self._all_tokens:
|
| 291 |
+
# compile the regexes now
|
| 292 |
+
self._tokens = self.__class__.process_tokendef(level)
|
| 293 |
+
else:
|
| 294 |
+
self._tokens = self._all_tokens[level]
|
| 295 |
+
|
| 296 |
+
RegexLexer.__init__(self, **options)
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
class BooLexer(RegexLexer):
|
| 300 |
+
"""
|
| 301 |
+
For `Boo <http://boo.codehaus.org/>`_ source code.
|
| 302 |
+
"""
|
| 303 |
+
|
| 304 |
+
name = 'Boo'
|
| 305 |
+
aliases = ['boo']
|
| 306 |
+
filenames = ['*.boo']
|
| 307 |
+
mimetypes = ['text/x-boo']
|
| 308 |
+
|
| 309 |
+
tokens = {
|
| 310 |
+
'root': [
|
| 311 |
+
(r'\s+', Text),
|
| 312 |
+
(r'(#|//).*$', Comment.Single),
|
| 313 |
+
(r'/[*]', Comment.Multiline, 'comment'),
|
| 314 |
+
(r'[]{}:(),.;[]', Punctuation),
|
| 315 |
+
(r'\\\n', Text),
|
| 316 |
+
(r'\\', Text),
|
| 317 |
+
(r'(in|is|and|or|not)\b', Operator.Word),
|
| 318 |
+
(r'/(\\\\|\\/|[^/\s])/', String.Regex),
|
| 319 |
+
(r'@/(\\\\|\\/|[^/])*/', String.Regex),
|
| 320 |
+
(r'=~|!=|==|<<|>>|[-+/*%=<>&^|]', Operator),
|
| 321 |
+
(r'(as|abstract|callable|constructor|destructor|do|import|'
|
| 322 |
+
r'enum|event|final|get|interface|internal|of|override|'
|
| 323 |
+
r'partial|private|protected|public|return|set|static|'
|
| 324 |
+
r'struct|transient|virtual|yield|super|and|break|cast|'
|
| 325 |
+
r'continue|elif|else|ensure|except|for|given|goto|if|in|'
|
| 326 |
+
r'is|isa|not|or|otherwise|pass|raise|ref|try|unless|when|'
|
| 327 |
+
r'while|from|as)\b', Keyword),
|
| 328 |
+
(r'def(?=\s+\(.*?\))', Keyword),
|
| 329 |
+
(r'(def)(\s+)', bygroups(Keyword, Text), 'funcname'),
|
| 330 |
+
(r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
|
| 331 |
+
(r'(namespace)(\s+)', bygroups(Keyword, Text), 'namespace'),
|
| 332 |
+
(r'(?<!\.)(true|false|null|self|__eval__|__switch__|array|'
|
| 333 |
+
r'assert|checked|enumerate|filter|getter|len|lock|map|'
|
| 334 |
+
r'matrix|max|min|normalArrayIndexing|print|property|range|'
|
| 335 |
+
r'rawArrayIndexing|required|typeof|unchecked|using|'
|
| 336 |
+
r'yieldAll|zip)\b', Name.Builtin),
|
| 337 |
+
(r'"""(\\\\|\\"|.*?)"""', String.Double),
|
| 338 |
+
(r'"(\\\\|\\"|[^"]*?)"', String.Double),
|
| 339 |
+
(r"'(\\\\|\\'|[^']*?)'", String.Single),
|
| 340 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 341 |
+
(r'(\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?', Number.Float),
|
| 342 |
+
(r'[0-9][0-9.]*(ms?|d|h|s)', Number),
|
| 343 |
+
(r'0\d+', Number.Oct),
|
| 344 |
+
(r'0x[a-fA-F0-9]+', Number.Hex),
|
| 345 |
+
(r'\d+L', Number.Integer.Long),
|
| 346 |
+
(r'\d+', Number.Integer),
|
| 347 |
+
],
|
| 348 |
+
'comment': [
|
| 349 |
+
('/[*]', Comment.Multiline, '#push'),
|
| 350 |
+
('[*]/', Comment.Multiline, '#pop'),
|
| 351 |
+
('[^/*]', Comment.Multiline),
|
| 352 |
+
('[*/]', Comment.Multiline)
|
| 353 |
+
],
|
| 354 |
+
'funcname': [
|
| 355 |
+
('[a-zA-Z_]\w*', Name.Function, '#pop')
|
| 356 |
+
],
|
| 357 |
+
'classname': [
|
| 358 |
+
('[a-zA-Z_]\w*', Name.Class, '#pop')
|
| 359 |
+
],
|
| 360 |
+
'namespace': [
|
| 361 |
+
('[a-zA-Z_][\w.]*', Name.Namespace, '#pop')
|
| 362 |
+
]
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
class VbNetLexer(RegexLexer):
|
| 367 |
+
"""
|
| 368 |
+
For
|
| 369 |
+
`Visual Basic.NET <http://msdn2.microsoft.com/en-us/vbasic/default.aspx>`_
|
| 370 |
+
source code.
|
| 371 |
+
"""
|
| 372 |
+
|
| 373 |
+
name = 'VB.net'
|
| 374 |
+
aliases = ['vb.net', 'vbnet']
|
| 375 |
+
filenames = ['*.vb', '*.bas']
|
| 376 |
+
mimetypes = ['text/x-vbnet', 'text/x-vba'] # (?)
|
| 377 |
+
|
| 378 |
+
uni_name = '[_' + uni.combine('Ll', 'Lt', 'Lm', 'Nl') + ']' + \
|
| 379 |
+
'[' + uni.combine('Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc',
|
| 380 |
+
'Cf', 'Mn', 'Mc') + ']*'
|
| 381 |
+
|
| 382 |
+
flags = re.MULTILINE | re.IGNORECASE
|
| 383 |
+
tokens = {
|
| 384 |
+
'root': [
|
| 385 |
+
(r'^\s*<.*?>', Name.Attribute),
|
| 386 |
+
(r'\s+', Text),
|
| 387 |
+
(r'\n', Text),
|
| 388 |
+
(r'rem\b.*?\n', Comment),
|
| 389 |
+
(r"'.*?\n", Comment),
|
| 390 |
+
(r'#If\s.*?\sThen|#ElseIf\s.*?\sThen|#Else|#End\s+If|#Const|'
|
| 391 |
+
r'#ExternalSource.*?\n|#End\s+ExternalSource|'
|
| 392 |
+
r'#Region.*?\n|#End\s+Region|#ExternalChecksum',
|
| 393 |
+
Comment.Preproc),
|
| 394 |
+
(r'[(){}!#,.:]', Punctuation),
|
| 395 |
+
(r'Option\s+(Strict|Explicit|Compare)\s+'
|
| 396 |
+
r'(On|Off|Binary|Text)', Keyword.Declaration),
|
| 397 |
+
(words((
|
| 398 |
+
'AddHandler', 'Alias', 'ByRef', 'ByVal', 'Call', 'Case',
|
| 399 |
+
'Catch', 'CBool', 'CByte', 'CChar', 'CDate', 'CDec', 'CDbl',
|
| 400 |
+
'CInt', 'CLng', 'CObj', 'Continue', 'CSByte', 'CShort', 'CSng',
|
| 401 |
+
'CStr', 'CType', 'CUInt', 'CULng', 'CUShort', 'Declare',
|
| 402 |
+
'Default', 'Delegate', 'DirectCast', 'Do', 'Each', 'Else',
|
| 403 |
+
'ElseIf', 'EndIf', 'Erase', 'Error', 'Event', 'Exit', 'False',
|
| 404 |
+
'Finally', 'For', 'Friend', 'Get', 'Global', 'GoSub', 'GoTo',
|
| 405 |
+
'Handles', 'If', 'Implements', 'Inherits', 'Interface', 'Let',
|
| 406 |
+
'Lib', 'Loop', 'Me', 'MustInherit', 'MustOverride', 'MyBase',
|
| 407 |
+
'MyClass', 'Narrowing', 'New', 'Next', 'Not', 'Nothing',
|
| 408 |
+
'NotInheritable', 'NotOverridable', 'Of', 'On', 'Operator',
|
| 409 |
+
'Option', 'Optional', 'Overloads', 'Overridable', 'Overrides',
|
| 410 |
+
'ParamArray', 'Partial', 'Private', 'Protected', 'Public',
|
| 411 |
+
'RaiseEvent', 'ReadOnly', 'ReDim', 'RemoveHandler', 'Resume',
|
| 412 |
+
'Return', 'Select', 'Set', 'Shadows', 'Shared', 'Single',
|
| 413 |
+
'Static', 'Step', 'Stop', 'SyncLock', 'Then', 'Throw', 'To',
|
| 414 |
+
'True', 'Try', 'TryCast', 'Wend', 'Using', 'When', 'While',
|
| 415 |
+
'Widening', 'With', 'WithEvents', 'WriteOnly'),
|
| 416 |
+
prefix='(?<!\.)', suffix=r'\b'), Keyword),
|
| 417 |
+
(r'(?<!\.)End\b', Keyword, 'end'),
|
| 418 |
+
(r'(?<!\.)(Dim|Const)\b', Keyword, 'dim'),
|
| 419 |
+
(r'(?<!\.)(Function|Sub|Property)(\s+)',
|
| 420 |
+
bygroups(Keyword, Text), 'funcname'),
|
| 421 |
+
(r'(?<!\.)(Class|Structure|Enum)(\s+)',
|
| 422 |
+
bygroups(Keyword, Text), 'classname'),
|
| 423 |
+
(r'(?<!\.)(Module|Namespace|Imports)(\s+)',
|
| 424 |
+
bygroups(Keyword, Text), 'namespace'),
|
| 425 |
+
(r'(?<!\.)(Boolean|Byte|Char|Date|Decimal|Double|Integer|Long|'
|
| 426 |
+
r'Object|SByte|Short|Single|String|Variant|UInteger|ULong|'
|
| 427 |
+
r'UShort)\b', Keyword.Type),
|
| 428 |
+
(r'(?<!\.)(AddressOf|And|AndAlso|As|GetType|In|Is|IsNot|Like|Mod|'
|
| 429 |
+
r'Or|OrElse|TypeOf|Xor)\b', Operator.Word),
|
| 430 |
+
(r'&=|[*]=|/=|\\=|\^=|\+=|-=|<<=|>>=|<<|>>|:=|'
|
| 431 |
+
r'<=|>=|<>|[-&*/\\^+=<>\[\]]',
|
| 432 |
+
Operator),
|
| 433 |
+
('"', String, 'string'),
|
| 434 |
+
(r'_\n', Text), # Line continuation (must be before Name)
|
| 435 |
+
(uni_name + '[%&@!#$]?', Name),
|
| 436 |
+
('#.*?#', Literal.Date),
|
| 437 |
+
(r'(\d+\.\d*|\d*\.\d+)(F[+-]?[0-9]+)?', Number.Float),
|
| 438 |
+
(r'\d+([SILDFR]|US|UI|UL)?', Number.Integer),
|
| 439 |
+
(r'&H[0-9a-f]+([SILDFR]|US|UI|UL)?', Number.Integer),
|
| 440 |
+
(r'&O[0-7]+([SILDFR]|US|UI|UL)?', Number.Integer),
|
| 441 |
+
],
|
| 442 |
+
'string': [
|
| 443 |
+
(r'""', String),
|
| 444 |
+
(r'"C?', String, '#pop'),
|
| 445 |
+
(r'[^"]+', String),
|
| 446 |
+
],
|
| 447 |
+
'dim': [
|
| 448 |
+
(uni_name, Name.Variable, '#pop'),
|
| 449 |
+
default('#pop'), # any other syntax
|
| 450 |
+
],
|
| 451 |
+
'funcname': [
|
| 452 |
+
(uni_name, Name.Function, '#pop'),
|
| 453 |
+
],
|
| 454 |
+
'classname': [
|
| 455 |
+
(uni_name, Name.Class, '#pop'),
|
| 456 |
+
],
|
| 457 |
+
'namespace': [
|
| 458 |
+
(uni_name, Name.Namespace),
|
| 459 |
+
(r'\.', Name.Namespace),
|
| 460 |
+
default('#pop'),
|
| 461 |
+
],
|
| 462 |
+
'end': [
|
| 463 |
+
(r'\s+', Text),
|
| 464 |
+
(r'(Function|Sub|Property|Class|Structure|Enum|Module|Namespace)\b',
|
| 465 |
+
Keyword, '#pop'),
|
| 466 |
+
default('#pop'),
|
| 467 |
+
]
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
def analyse_text(text):
|
| 471 |
+
if re.search(r'^\s*(#If|Module|Namespace)', text, re.MULTILINE):
|
| 472 |
+
return 0.5
|
| 473 |
+
|
| 474 |
+
|
| 475 |
+
class GenericAspxLexer(RegexLexer):
|
| 476 |
+
"""
|
| 477 |
+
Lexer for ASP.NET pages.
|
| 478 |
+
"""
|
| 479 |
+
|
| 480 |
+
name = 'aspx-gen'
|
| 481 |
+
filenames = []
|
| 482 |
+
mimetypes = []
|
| 483 |
+
|
| 484 |
+
flags = re.DOTALL
|
| 485 |
+
|
| 486 |
+
tokens = {
|
| 487 |
+
'root': [
|
| 488 |
+
(r'(<%[@=#]?)(.*?)(%>)', bygroups(Name.Tag, Other, Name.Tag)),
|
| 489 |
+
(r'(<script.*?>)(.*?)(</script>)', bygroups(using(XmlLexer),
|
| 490 |
+
Other,
|
| 491 |
+
using(XmlLexer))),
|
| 492 |
+
(r'(.+?)(?=<)', using(XmlLexer)),
|
| 493 |
+
(r'.+', using(XmlLexer)),
|
| 494 |
+
],
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
|
| 498 |
+
# TODO support multiple languages within the same source file
|
| 499 |
+
class CSharpAspxLexer(DelegatingLexer):
|
| 500 |
+
"""
|
| 501 |
+
Lexer for highlighting C# within ASP.NET pages.
|
| 502 |
+
"""
|
| 503 |
+
|
| 504 |
+
name = 'aspx-cs'
|
| 505 |
+
aliases = ['aspx-cs']
|
| 506 |
+
filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd']
|
| 507 |
+
mimetypes = []
|
| 508 |
+
|
| 509 |
+
def __init__(self, **options):
|
| 510 |
+
super(CSharpAspxLexer, self).__init__(CSharpLexer, GenericAspxLexer,
|
| 511 |
+
**options)
|
| 512 |
+
|
| 513 |
+
def analyse_text(text):
|
| 514 |
+
if re.search(r'Page\s*Language="C#"', text, re.I) is not None:
|
| 515 |
+
return 0.2
|
| 516 |
+
elif re.search(r'script[^>]+language=["\']C#', text, re.I) is not None:
|
| 517 |
+
return 0.15
|
| 518 |
+
|
| 519 |
+
|
| 520 |
+
class VbNetAspxLexer(DelegatingLexer):
|
| 521 |
+
"""
|
| 522 |
+
Lexer for highlighting Visual Basic.net within ASP.NET pages.
|
| 523 |
+
"""
|
| 524 |
+
|
| 525 |
+
name = 'aspx-vb'
|
| 526 |
+
aliases = ['aspx-vb']
|
| 527 |
+
filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd']
|
| 528 |
+
mimetypes = []
|
| 529 |
+
|
| 530 |
+
def __init__(self, **options):
|
| 531 |
+
super(VbNetAspxLexer, self).__init__(VbNetLexer, GenericAspxLexer,
|
| 532 |
+
**options)
|
| 533 |
+
|
| 534 |
+
def analyse_text(text):
|
| 535 |
+
if re.search(r'Page\s*Language="Vb"', text, re.I) is not None:
|
| 536 |
+
return 0.2
|
| 537 |
+
elif re.search(r'script[^>]+language=["\']vb', text, re.I) is not None:
|
| 538 |
+
return 0.15
|
| 539 |
+
|
| 540 |
+
|
| 541 |
+
# Very close to functional.OcamlLexer
|
| 542 |
+
class FSharpLexer(RegexLexer):
|
| 543 |
+
"""
|
| 544 |
+
For the F# language (version 3.0).
|
| 545 |
+
|
| 546 |
+
AAAAACK Strings
|
| 547 |
+
http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/spec.html#_Toc335818775
|
| 548 |
+
|
| 549 |
+
.. versionadded:: 1.5
|
| 550 |
+
"""
|
| 551 |
+
|
| 552 |
+
name = 'FSharp'
|
| 553 |
+
aliases = ['fsharp']
|
| 554 |
+
filenames = ['*.fs', '*.fsi']
|
| 555 |
+
mimetypes = ['text/x-fsharp']
|
| 556 |
+
|
| 557 |
+
keywords = [
|
| 558 |
+
'abstract', 'as', 'assert', 'base', 'begin', 'class', 'default',
|
| 559 |
+
'delegate', 'do!', 'do', 'done', 'downcast', 'downto', 'elif', 'else',
|
| 560 |
+
'end', 'exception', 'extern', 'false', 'finally', 'for', 'function',
|
| 561 |
+
'fun', 'global', 'if', 'inherit', 'inline', 'interface', 'internal',
|
| 562 |
+
'in', 'lazy', 'let!', 'let', 'match', 'member', 'module', 'mutable',
|
| 563 |
+
'namespace', 'new', 'null', 'of', 'open', 'override', 'private', 'public',
|
| 564 |
+
'rec', 'return!', 'return', 'select', 'static', 'struct', 'then', 'to',
|
| 565 |
+
'true', 'try', 'type', 'upcast', 'use!', 'use', 'val', 'void', 'when',
|
| 566 |
+
'while', 'with', 'yield!', 'yield',
|
| 567 |
+
]
|
| 568 |
+
# Reserved words; cannot hurt to color them as keywords too.
|
| 569 |
+
keywords += [
|
| 570 |
+
'atomic', 'break', 'checked', 'component', 'const', 'constraint',
|
| 571 |
+
'constructor', 'continue', 'eager', 'event', 'external', 'fixed',
|
| 572 |
+
'functor', 'include', 'method', 'mixin', 'object', 'parallel',
|
| 573 |
+
'process', 'protected', 'pure', 'sealed', 'tailcall', 'trait',
|
| 574 |
+
'virtual', 'volatile',
|
| 575 |
+
]
|
| 576 |
+
keyopts = [
|
| 577 |
+
'!=', '#', '&&', '&', '\(', '\)', '\*', '\+', ',', '-\.',
|
| 578 |
+
'->', '-', '\.\.', '\.', '::', ':=', ':>', ':', ';;', ';', '<-',
|
| 579 |
+
'<\]', '<', '>\]', '>', '\?\?', '\?', '\[<', '\[\|', '\[', '\]',
|
| 580 |
+
'_', '`', '\{', '\|\]', '\|', '\}', '~', '<@@', '<@', '=', '@>', '@@>',
|
| 581 |
+
]
|
| 582 |
+
|
| 583 |
+
operators = r'[!$%&*+\./:<=>?@^|~-]'
|
| 584 |
+
word_operators = ['and', 'or', 'not']
|
| 585 |
+
prefix_syms = r'[!?~]'
|
| 586 |
+
infix_syms = r'[=<>@^|&+\*/$%-]'
|
| 587 |
+
primitives = [
|
| 588 |
+
'sbyte', 'byte', 'char', 'nativeint', 'unativeint', 'float32', 'single',
|
| 589 |
+
'float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32',
|
| 590 |
+
'uint32', 'int64', 'uint64', 'decimal', 'unit', 'bool', 'string',
|
| 591 |
+
'list', 'exn', 'obj', 'enum',
|
| 592 |
+
]
|
| 593 |
+
|
| 594 |
+
# See http://msdn.microsoft.com/en-us/library/dd233181.aspx and/or
|
| 595 |
+
# http://fsharp.org/about/files/spec.pdf for reference. Good luck.
|
| 596 |
+
|
| 597 |
+
tokens = {
|
| 598 |
+
'escape-sequence': [
|
| 599 |
+
(r'\\[\\"\'ntbrafv]', String.Escape),
|
| 600 |
+
(r'\\[0-9]{3}', String.Escape),
|
| 601 |
+
(r'\\u[0-9a-fA-F]{4}', String.Escape),
|
| 602 |
+
(r'\\U[0-9a-fA-F]{8}', String.Escape),
|
| 603 |
+
],
|
| 604 |
+
'root': [
|
| 605 |
+
(r'\s+', Text),
|
| 606 |
+
(r'\(\)|\[\]', Name.Builtin.Pseudo),
|
| 607 |
+
(r'\b(?<!\.)([A-Z][\w\']*)(?=\s*\.)',
|
| 608 |
+
Name.Namespace, 'dotted'),
|
| 609 |
+
(r'\b([A-Z][\w\']*)', Name),
|
| 610 |
+
(r'///.*?\n', String.Doc),
|
| 611 |
+
(r'//.*?\n', Comment.Single),
|
| 612 |
+
(r'\(\*(?!\))', Comment, 'comment'),
|
| 613 |
+
|
| 614 |
+
(r'@"', String, 'lstring'),
|
| 615 |
+
(r'"""', String, 'tqs'),
|
| 616 |
+
(r'"', String, 'string'),
|
| 617 |
+
|
| 618 |
+
(r'\b(open|module)(\s+)([\w.]+)',
|
| 619 |
+
bygroups(Keyword, Text, Name.Namespace)),
|
| 620 |
+
(r'\b(let!?)(\s+)(\w+)',
|
| 621 |
+
bygroups(Keyword, Text, Name.Variable)),
|
| 622 |
+
(r'\b(type)(\s+)(\w+)',
|
| 623 |
+
bygroups(Keyword, Text, Name.Class)),
|
| 624 |
+
(r'\b(member|override)(\s+)(\w+)(\.)(\w+)',
|
| 625 |
+
bygroups(Keyword, Text, Name, Punctuation, Name.Function)),
|
| 626 |
+
(r'\b(%s)\b' % '|'.join(keywords), Keyword),
|
| 627 |
+
(r'``([^`\n\r\t]|`[^`\n\r\t])+``', Name),
|
| 628 |
+
(r'(%s)' % '|'.join(keyopts), Operator),
|
| 629 |
+
(r'(%s|%s)?%s' % (infix_syms, prefix_syms, operators), Operator),
|
| 630 |
+
(r'\b(%s)\b' % '|'.join(word_operators), Operator.Word),
|
| 631 |
+
(r'\b(%s)\b' % '|'.join(primitives), Keyword.Type),
|
| 632 |
+
(r'#[ \t]*(if|endif|else|line|nowarn|light|\d+)\b.*?\n',
|
| 633 |
+
Comment.Preproc),
|
| 634 |
+
|
| 635 |
+
(r"[^\W\d][\w']*", Name),
|
| 636 |
+
|
| 637 |
+
(r'\d[\d_]*[uU]?[yslLnQRZINGmM]?', Number.Integer),
|
| 638 |
+
(r'0[xX][\da-fA-F][\da-fA-F_]*[uU]?[yslLn]?[fF]?', Number.Hex),
|
| 639 |
+
(r'0[oO][0-7][0-7_]*[uU]?[yslLn]?', Number.Oct),
|
| 640 |
+
(r'0[bB][01][01_]*[uU]?[yslLn]?', Number.Bin),
|
| 641 |
+
(r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)[fFmM]?',
|
| 642 |
+
Number.Float),
|
| 643 |
+
|
| 644 |
+
(r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'B?",
|
| 645 |
+
String.Char),
|
| 646 |
+
(r"'.'", String.Char),
|
| 647 |
+
(r"'", Keyword), # a stray quote is another syntax element
|
| 648 |
+
|
| 649 |
+
(r'@?"', String.Double, 'string'),
|
| 650 |
+
|
| 651 |
+
(r'[~?][a-z][\w\']*:', Name.Variable),
|
| 652 |
+
],
|
| 653 |
+
'dotted': [
|
| 654 |
+
(r'\s+', Text),
|
| 655 |
+
(r'\.', Punctuation),
|
| 656 |
+
(r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
|
| 657 |
+
(r'[A-Z][\w\']*', Name, '#pop'),
|
| 658 |
+
(r'[a-z_][\w\']*', Name, '#pop'),
|
| 659 |
+
# e.g. dictionary index access
|
| 660 |
+
default('#pop'),
|
| 661 |
+
],
|
| 662 |
+
'comment': [
|
| 663 |
+
(r'[^(*)@"]+', Comment),
|
| 664 |
+
(r'\(\*', Comment, '#push'),
|
| 665 |
+
(r'\*\)', Comment, '#pop'),
|
| 666 |
+
# comments cannot be closed within strings in comments
|
| 667 |
+
(r'@"', String, 'lstring'),
|
| 668 |
+
(r'"""', String, 'tqs'),
|
| 669 |
+
(r'"', String, 'string'),
|
| 670 |
+
(r'[(*)@]', Comment),
|
| 671 |
+
],
|
| 672 |
+
'string': [
|
| 673 |
+
(r'[^\\"]+', String),
|
| 674 |
+
include('escape-sequence'),
|
| 675 |
+
(r'\\\n', String),
|
| 676 |
+
(r'\n', String), # newlines are allowed in any string
|
| 677 |
+
(r'"B?', String, '#pop'),
|
| 678 |
+
],
|
| 679 |
+
'lstring': [
|
| 680 |
+
(r'[^"]+', String),
|
| 681 |
+
(r'\n', String),
|
| 682 |
+
(r'""', String),
|
| 683 |
+
(r'"B?', String, '#pop'),
|
| 684 |
+
],
|
| 685 |
+
'tqs': [
|
| 686 |
+
(r'[^"]+', String),
|
| 687 |
+
(r'\n', String),
|
| 688 |
+
(r'"""B?', String, '#pop'),
|
| 689 |
+
(r'"', String),
|
| 690 |
+
],
|
| 691 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dsls.py
ADDED
|
@@ -0,0 +1,878 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.dsls
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for various domain-specific languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import ExtendedRegexLexer, RegexLexer, bygroups, words, \
|
| 15 |
+
include, default, this, using, combined
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Number, Punctuation, Literal, Whitespace
|
| 18 |
+
|
| 19 |
+
__all__ = ['ProtoBufLexer', 'BroLexer', 'PuppetLexer', 'RslLexer',
|
| 20 |
+
'MscgenLexer', 'VGLLexer', 'AlloyLexer', 'PanLexer',
|
| 21 |
+
'CrmshLexer', 'ThriftLexer', 'FlatlineLexer', 'SnowballLexer']
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class ProtoBufLexer(RegexLexer):
|
| 25 |
+
"""
|
| 26 |
+
Lexer for `Protocol Buffer <http://code.google.com/p/protobuf/>`_
|
| 27 |
+
definition files.
|
| 28 |
+
|
| 29 |
+
.. versionadded:: 1.4
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
name = 'Protocol Buffer'
|
| 33 |
+
aliases = ['protobuf', 'proto']
|
| 34 |
+
filenames = ['*.proto']
|
| 35 |
+
|
| 36 |
+
tokens = {
|
| 37 |
+
'root': [
|
| 38 |
+
(r'[ \t]+', Text),
|
| 39 |
+
(r'[,;{}\[\]()<>]', Punctuation),
|
| 40 |
+
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
| 41 |
+
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
|
| 42 |
+
(words((
|
| 43 |
+
'import', 'option', 'optional', 'required', 'repeated', 'default',
|
| 44 |
+
'packed', 'ctype', 'extensions', 'to', 'max', 'rpc', 'returns',
|
| 45 |
+
'oneof'), prefix=r'\b', suffix=r'\b'),
|
| 46 |
+
Keyword),
|
| 47 |
+
(words((
|
| 48 |
+
'int32', 'int64', 'uint32', 'uint64', 'sint32', 'sint64',
|
| 49 |
+
'fixed32', 'fixed64', 'sfixed32', 'sfixed64',
|
| 50 |
+
'float', 'double', 'bool', 'string', 'bytes'), suffix=r'\b'),
|
| 51 |
+
Keyword.Type),
|
| 52 |
+
(r'(true|false)\b', Keyword.Constant),
|
| 53 |
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text), 'package'),
|
| 54 |
+
(r'(message|extend)(\s+)',
|
| 55 |
+
bygroups(Keyword.Declaration, Text), 'message'),
|
| 56 |
+
(r'(enum|group|service)(\s+)',
|
| 57 |
+
bygroups(Keyword.Declaration, Text), 'type'),
|
| 58 |
+
(r'\".*?\"', String),
|
| 59 |
+
(r'\'.*?\'', String),
|
| 60 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
|
| 61 |
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
| 62 |
+
(r'(\-?(inf|nan))\b', Number.Float),
|
| 63 |
+
(r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
|
| 64 |
+
(r'0[0-7]+[LlUu]*', Number.Oct),
|
| 65 |
+
(r'\d+[LlUu]*', Number.Integer),
|
| 66 |
+
(r'[+-=]', Operator),
|
| 67 |
+
(r'([a-zA-Z_][\w.]*)([ \t]*)(=)',
|
| 68 |
+
bygroups(Name.Attribute, Text, Operator)),
|
| 69 |
+
('[a-zA-Z_][\w.]*', Name),
|
| 70 |
+
],
|
| 71 |
+
'package': [
|
| 72 |
+
(r'[a-zA-Z_]\w*', Name.Namespace, '#pop'),
|
| 73 |
+
default('#pop'),
|
| 74 |
+
],
|
| 75 |
+
'message': [
|
| 76 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop'),
|
| 77 |
+
default('#pop'),
|
| 78 |
+
],
|
| 79 |
+
'type': [
|
| 80 |
+
(r'[a-zA-Z_]\w*', Name, '#pop'),
|
| 81 |
+
default('#pop'),
|
| 82 |
+
],
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
class ThriftLexer(RegexLexer):
|
| 87 |
+
"""
|
| 88 |
+
For `Thrift <https://thrift.apache.org/>`__ interface definitions.
|
| 89 |
+
|
| 90 |
+
.. versionadded:: 2.1
|
| 91 |
+
"""
|
| 92 |
+
name = 'Thrift'
|
| 93 |
+
aliases = ['thrift']
|
| 94 |
+
filenames = ['*.thrift']
|
| 95 |
+
mimetypes = ['application/x-thrift']
|
| 96 |
+
|
| 97 |
+
tokens = {
|
| 98 |
+
'root': [
|
| 99 |
+
include('whitespace'),
|
| 100 |
+
include('comments'),
|
| 101 |
+
(r'"', String.Double, combined('stringescape', 'dqs')),
|
| 102 |
+
(r'\'', String.Single, combined('stringescape', 'sqs')),
|
| 103 |
+
(r'(namespace)(\s+)',
|
| 104 |
+
bygroups(Keyword.Namespace, Text.Whitespace), 'namespace'),
|
| 105 |
+
(r'(enum|union|struct|service|exception)(\s+)',
|
| 106 |
+
bygroups(Keyword.Declaration, Text.Whitespace), 'class'),
|
| 107 |
+
(r'((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)' # return arguments
|
| 108 |
+
r'((?:[^\W\d]|\$)[\w$]*)' # method name
|
| 109 |
+
r'(\s*)(\()', # signature start
|
| 110 |
+
bygroups(using(this), Name.Function, Text, Operator)),
|
| 111 |
+
include('keywords'),
|
| 112 |
+
include('numbers'),
|
| 113 |
+
(r'[&=]', Operator),
|
| 114 |
+
(r'[:;,{}()<>\[\]]', Punctuation),
|
| 115 |
+
(r'[a-zA-Z_](\.\w|\w)*', Name),
|
| 116 |
+
],
|
| 117 |
+
'whitespace': [
|
| 118 |
+
(r'\n', Text.Whitespace),
|
| 119 |
+
(r'\s+', Text.Whitespace),
|
| 120 |
+
],
|
| 121 |
+
'comments': [
|
| 122 |
+
(r'#.*$', Comment),
|
| 123 |
+
(r'//.*?\n', Comment),
|
| 124 |
+
(r'/\*[\w\W]*?\*/', Comment.Multiline),
|
| 125 |
+
],
|
| 126 |
+
'stringescape': [
|
| 127 |
+
(r'\\([\\nrt"\'])', String.Escape),
|
| 128 |
+
],
|
| 129 |
+
'dqs': [
|
| 130 |
+
(r'"', String.Double, '#pop'),
|
| 131 |
+
(r'[^\\"\n]+', String.Double),
|
| 132 |
+
],
|
| 133 |
+
'sqs': [
|
| 134 |
+
(r"'", String.Single, '#pop'),
|
| 135 |
+
(r'[^\\\'\n]+', String.Single),
|
| 136 |
+
],
|
| 137 |
+
'namespace': [
|
| 138 |
+
(r'[a-z*](\.\w|\w)*', Name.Namespace, '#pop'),
|
| 139 |
+
default('#pop'),
|
| 140 |
+
],
|
| 141 |
+
'class': [
|
| 142 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop'),
|
| 143 |
+
default('#pop'),
|
| 144 |
+
],
|
| 145 |
+
'keywords': [
|
| 146 |
+
(r'(async|oneway|extends|throws|required|optional)\b', Keyword),
|
| 147 |
+
(r'(true|false)\b', Keyword.Constant),
|
| 148 |
+
(r'(const|typedef)\b', Keyword.Declaration),
|
| 149 |
+
(words((
|
| 150 |
+
'cpp_namespace', 'cpp_include', 'cpp_type', 'java_package',
|
| 151 |
+
'cocoa_prefix', 'csharp_namespace', 'delphi_namespace',
|
| 152 |
+
'php_namespace', 'py_module', 'perl_package',
|
| 153 |
+
'ruby_namespace', 'smalltalk_category', 'smalltalk_prefix',
|
| 154 |
+
'xsd_all', 'xsd_optional', 'xsd_nillable', 'xsd_namespace',
|
| 155 |
+
'xsd_attrs', 'include'), suffix=r'\b'),
|
| 156 |
+
Keyword.Namespace),
|
| 157 |
+
(words((
|
| 158 |
+
'void', 'bool', 'byte', 'i16', 'i32', 'i64', 'double',
|
| 159 |
+
'string', 'binary', 'map', 'list', 'set', 'slist',
|
| 160 |
+
'senum'), suffix=r'\b'),
|
| 161 |
+
Keyword.Type),
|
| 162 |
+
(words((
|
| 163 |
+
'BEGIN', 'END', '__CLASS__', '__DIR__', '__FILE__',
|
| 164 |
+
'__FUNCTION__', '__LINE__', '__METHOD__', '__NAMESPACE__',
|
| 165 |
+
'abstract', 'alias', 'and', 'args', 'as', 'assert', 'begin',
|
| 166 |
+
'break', 'case', 'catch', 'class', 'clone', 'continue',
|
| 167 |
+
'declare', 'def', 'default', 'del', 'delete', 'do', 'dynamic',
|
| 168 |
+
'elif', 'else', 'elseif', 'elsif', 'end', 'enddeclare',
|
| 169 |
+
'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile',
|
| 170 |
+
'ensure', 'except', 'exec', 'finally', 'float', 'for',
|
| 171 |
+
'foreach', 'function', 'global', 'goto', 'if', 'implements',
|
| 172 |
+
'import', 'in', 'inline', 'instanceof', 'interface', 'is',
|
| 173 |
+
'lambda', 'module', 'native', 'new', 'next', 'nil', 'not',
|
| 174 |
+
'or', 'pass', 'public', 'print', 'private', 'protected',
|
| 175 |
+
'raise', 'redo', 'rescue', 'retry', 'register', 'return',
|
| 176 |
+
'self', 'sizeof', 'static', 'super', 'switch', 'synchronized',
|
| 177 |
+
'then', 'this', 'throw', 'transient', 'try', 'undef',
|
| 178 |
+
'unless', 'unsigned', 'until', 'use', 'var', 'virtual',
|
| 179 |
+
'volatile', 'when', 'while', 'with', 'xor', 'yield'),
|
| 180 |
+
prefix=r'\b', suffix=r'\b'),
|
| 181 |
+
Keyword.Reserved),
|
| 182 |
+
],
|
| 183 |
+
'numbers': [
|
| 184 |
+
(r'[+-]?(\d+\.\d+([eE][+-]?\d+)?|\.?\d+[eE][+-]?\d+)', Number.Float),
|
| 185 |
+
(r'[+-]?0x[0-9A-Fa-f]+', Number.Hex),
|
| 186 |
+
(r'[+-]?[0-9]+', Number.Integer),
|
| 187 |
+
],
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
class BroLexer(RegexLexer):
|
| 192 |
+
"""
|
| 193 |
+
For `Bro <http://bro-ids.org/>`_ scripts.
|
| 194 |
+
|
| 195 |
+
.. versionadded:: 1.5
|
| 196 |
+
"""
|
| 197 |
+
name = 'Bro'
|
| 198 |
+
aliases = ['bro']
|
| 199 |
+
filenames = ['*.bro']
|
| 200 |
+
|
| 201 |
+
_hex = r'[0-9a-fA-F_]'
|
| 202 |
+
_float = r'((\d*\.?\d+)|(\d+\.?\d*))([eE][-+]?\d+)?'
|
| 203 |
+
_h = r'[A-Za-z0-9][-A-Za-z0-9]*'
|
| 204 |
+
|
| 205 |
+
tokens = {
|
| 206 |
+
'root': [
|
| 207 |
+
# Whitespace
|
| 208 |
+
(r'^@.*?\n', Comment.Preproc),
|
| 209 |
+
(r'#.*?\n', Comment.Single),
|
| 210 |
+
(r'\n', Text),
|
| 211 |
+
(r'\s+', Text),
|
| 212 |
+
(r'\\\n', Text),
|
| 213 |
+
# Keywords
|
| 214 |
+
(r'(add|alarm|break|case|const|continue|delete|do|else|enum|event'
|
| 215 |
+
r'|export|for|function|if|global|hook|local|module|next'
|
| 216 |
+
r'|of|print|redef|return|schedule|switch|type|when|while)\b', Keyword),
|
| 217 |
+
(r'(addr|any|bool|count|counter|double|file|int|interval|net'
|
| 218 |
+
r'|pattern|port|record|set|string|subnet|table|time|timer'
|
| 219 |
+
r'|vector)\b', Keyword.Type),
|
| 220 |
+
(r'(T|F)\b', Keyword.Constant),
|
| 221 |
+
(r'(&)((?:add|delete|expire)_func|attr|(?:create|read|write)_expire'
|
| 222 |
+
r'|default|disable_print_hook|raw_output|encrypt|group|log'
|
| 223 |
+
r'|mergeable|optional|persistent|priority|redef'
|
| 224 |
+
r'|rotate_(?:interval|size)|synchronized)\b',
|
| 225 |
+
bygroups(Punctuation, Keyword)),
|
| 226 |
+
(r'\s+module\b', Keyword.Namespace),
|
| 227 |
+
# Addresses, ports and networks
|
| 228 |
+
(r'\d+/(tcp|udp|icmp|unknown)\b', Number),
|
| 229 |
+
(r'(\d+\.){3}\d+', Number),
|
| 230 |
+
(r'(' + _hex + r'){7}' + _hex, Number),
|
| 231 |
+
(r'0x' + _hex + r'(' + _hex + r'|:)*::(' + _hex + r'|:)*', Number),
|
| 232 |
+
(r'((\d+|:)(' + _hex + r'|:)*)?::(' + _hex + r'|:)*', Number),
|
| 233 |
+
(r'(\d+\.\d+\.|(\d+\.){2}\d+)', Number),
|
| 234 |
+
# Hostnames
|
| 235 |
+
(_h + r'(\.' + _h + r')+', String),
|
| 236 |
+
# Numeric
|
| 237 |
+
(_float + r'\s+(day|hr|min|sec|msec|usec)s?\b', Literal.Date),
|
| 238 |
+
(r'0[xX]' + _hex, Number.Hex),
|
| 239 |
+
(_float, Number.Float),
|
| 240 |
+
(r'\d+', Number.Integer),
|
| 241 |
+
(r'/', String.Regex, 'regex'),
|
| 242 |
+
(r'"', String, 'string'),
|
| 243 |
+
# Operators
|
| 244 |
+
(r'[!%*/+:<=>?~|-]', Operator),
|
| 245 |
+
(r'([-+=&|]{2}|[+=!><-]=)', Operator),
|
| 246 |
+
(r'(in|match)\b', Operator.Word),
|
| 247 |
+
(r'[{}()\[\]$.,;]', Punctuation),
|
| 248 |
+
# Identfier
|
| 249 |
+
(r'([_a-zA-Z]\w*)(::)', bygroups(Name, Name.Namespace)),
|
| 250 |
+
(r'[a-zA-Z_]\w*', Name)
|
| 251 |
+
],
|
| 252 |
+
'string': [
|
| 253 |
+
(r'"', String, '#pop'),
|
| 254 |
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
| 255 |
+
(r'[^\\"\n]+', String),
|
| 256 |
+
(r'\\\n', String),
|
| 257 |
+
(r'\\', String)
|
| 258 |
+
],
|
| 259 |
+
'regex': [
|
| 260 |
+
(r'/', String.Regex, '#pop'),
|
| 261 |
+
(r'\\[\\nt/]', String.Regex), # String.Escape is too intense here.
|
| 262 |
+
(r'[^\\/\n]+', String.Regex),
|
| 263 |
+
(r'\\\n', String.Regex),
|
| 264 |
+
(r'\\', String.Regex)
|
| 265 |
+
]
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
class PuppetLexer(RegexLexer):
|
| 270 |
+
"""
|
| 271 |
+
For `Puppet <http://puppetlabs.com/>`__ configuration DSL.
|
| 272 |
+
|
| 273 |
+
.. versionadded:: 1.6
|
| 274 |
+
"""
|
| 275 |
+
name = 'Puppet'
|
| 276 |
+
aliases = ['puppet']
|
| 277 |
+
filenames = ['*.pp']
|
| 278 |
+
|
| 279 |
+
tokens = {
|
| 280 |
+
'root': [
|
| 281 |
+
include('comments'),
|
| 282 |
+
include('keywords'),
|
| 283 |
+
include('names'),
|
| 284 |
+
include('numbers'),
|
| 285 |
+
include('operators'),
|
| 286 |
+
include('strings'),
|
| 287 |
+
|
| 288 |
+
(r'[]{}:(),;[]', Punctuation),
|
| 289 |
+
(r'[^\S\n]+', Text),
|
| 290 |
+
],
|
| 291 |
+
|
| 292 |
+
'comments': [
|
| 293 |
+
(r'\s*#.*$', Comment),
|
| 294 |
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
| 295 |
+
],
|
| 296 |
+
|
| 297 |
+
'operators': [
|
| 298 |
+
(r'(=>|\?|<|>|=|\+|-|/|\*|~|!|\|)', Operator),
|
| 299 |
+
(r'(in|and|or|not)\b', Operator.Word),
|
| 300 |
+
],
|
| 301 |
+
|
| 302 |
+
'names': [
|
| 303 |
+
('[a-zA-Z_]\w*', Name.Attribute),
|
| 304 |
+
(r'(\$\S+)(\[)(\S+)(\])', bygroups(Name.Variable, Punctuation,
|
| 305 |
+
String, Punctuation)),
|
| 306 |
+
(r'\$\S+', Name.Variable),
|
| 307 |
+
],
|
| 308 |
+
|
| 309 |
+
'numbers': [
|
| 310 |
+
# Copypasta from the Python lexer
|
| 311 |
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
|
| 312 |
+
(r'\d+[eE][+-]?[0-9]+j?', Number.Float),
|
| 313 |
+
(r'0[0-7]+j?', Number.Oct),
|
| 314 |
+
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
| 315 |
+
(r'\d+L', Number.Integer.Long),
|
| 316 |
+
(r'\d+j?', Number.Integer)
|
| 317 |
+
],
|
| 318 |
+
|
| 319 |
+
'keywords': [
|
| 320 |
+
# Left out 'group' and 'require'
|
| 321 |
+
# Since they're often used as attributes
|
| 322 |
+
(words((
|
| 323 |
+
'absent', 'alert', 'alias', 'audit', 'augeas', 'before', 'case',
|
| 324 |
+
'check', 'class', 'computer', 'configured', 'contained',
|
| 325 |
+
'create_resources', 'crit', 'cron', 'debug', 'default',
|
| 326 |
+
'define', 'defined', 'directory', 'else', 'elsif', 'emerg',
|
| 327 |
+
'err', 'exec', 'extlookup', 'fail', 'false', 'file',
|
| 328 |
+
'filebucket', 'fqdn_rand', 'generate', 'host', 'if', 'import',
|
| 329 |
+
'include', 'info', 'inherits', 'inline_template', 'installed',
|
| 330 |
+
'interface', 'k5login', 'latest', 'link', 'loglevel',
|
| 331 |
+
'macauthorization', 'mailalias', 'maillist', 'mcx', 'md5',
|
| 332 |
+
'mount', 'mounted', 'nagios_command', 'nagios_contact',
|
| 333 |
+
'nagios_contactgroup', 'nagios_host', 'nagios_hostdependency',
|
| 334 |
+
'nagios_hostescalation', 'nagios_hostextinfo', 'nagios_hostgroup',
|
| 335 |
+
'nagios_service', 'nagios_servicedependency', 'nagios_serviceescalation',
|
| 336 |
+
'nagios_serviceextinfo', 'nagios_servicegroup', 'nagios_timeperiod',
|
| 337 |
+
'node', 'noop', 'notice', 'notify', 'package', 'present', 'purged',
|
| 338 |
+
'realize', 'regsubst', 'resources', 'role', 'router', 'running',
|
| 339 |
+
'schedule', 'scheduled_task', 'search', 'selboolean', 'selmodule',
|
| 340 |
+
'service', 'sha1', 'shellquote', 'split', 'sprintf',
|
| 341 |
+
'ssh_authorized_key', 'sshkey', 'stage', 'stopped', 'subscribe',
|
| 342 |
+
'tag', 'tagged', 'template', 'tidy', 'true', 'undef', 'unmounted',
|
| 343 |
+
'user', 'versioncmp', 'vlan', 'warning', 'yumrepo', 'zfs', 'zone',
|
| 344 |
+
'zpool'), prefix='(?i)', suffix=r'\b'),
|
| 345 |
+
Keyword),
|
| 346 |
+
],
|
| 347 |
+
|
| 348 |
+
'strings': [
|
| 349 |
+
(r'"([^"])*"', String),
|
| 350 |
+
(r"'(\\'|[^'])*'", String),
|
| 351 |
+
],
|
| 352 |
+
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
class RslLexer(RegexLexer):
|
| 357 |
+
"""
|
| 358 |
+
`RSL <http://en.wikipedia.org/wiki/RAISE>`_ is the formal specification
|
| 359 |
+
language used in RAISE (Rigorous Approach to Industrial Software Engineering)
|
| 360 |
+
method.
|
| 361 |
+
|
| 362 |
+
.. versionadded:: 2.0
|
| 363 |
+
"""
|
| 364 |
+
name = 'RSL'
|
| 365 |
+
aliases = ['rsl']
|
| 366 |
+
filenames = ['*.rsl']
|
| 367 |
+
mimetypes = ['text/rsl']
|
| 368 |
+
|
| 369 |
+
flags = re.MULTILINE | re.DOTALL
|
| 370 |
+
|
| 371 |
+
tokens = {
|
| 372 |
+
'root': [
|
| 373 |
+
(words((
|
| 374 |
+
'Bool', 'Char', 'Int', 'Nat', 'Real', 'Text', 'Unit', 'abs',
|
| 375 |
+
'all', 'always', 'any', 'as', 'axiom', 'card', 'case', 'channel',
|
| 376 |
+
'chaos', 'class', 'devt_relation', 'dom', 'elems', 'else', 'elif',
|
| 377 |
+
'end', 'exists', 'extend', 'false', 'for', 'hd', 'hide', 'if',
|
| 378 |
+
'in', 'is', 'inds', 'initialise', 'int', 'inter', 'isin', 'len',
|
| 379 |
+
'let', 'local', 'ltl_assertion', 'object', 'of', 'out', 'post',
|
| 380 |
+
'pre', 'read', 'real', 'rng', 'scheme', 'skip', 'stop', 'swap',
|
| 381 |
+
'then', 'theory', 'test_case', 'tl', 'transition_system', 'true',
|
| 382 |
+
'type', 'union', 'until', 'use', 'value', 'variable', 'while',
|
| 383 |
+
'with', 'write', '~isin', '-inflist', '-infset', '-list',
|
| 384 |
+
'-set'), prefix=r'\b', suffix=r'\b'),
|
| 385 |
+
Keyword),
|
| 386 |
+
(r'(variable|value)\b', Keyword.Declaration),
|
| 387 |
+
(r'--.*?\n', Comment),
|
| 388 |
+
(r'<:.*?:>', Comment),
|
| 389 |
+
(r'\{!.*?!\}', Comment),
|
| 390 |
+
(r'/\*.*?\*/', Comment),
|
| 391 |
+
(r'^[ \t]*([\w]+)[ \t]*:[^:]', Name.Function),
|
| 392 |
+
(r'(^[ \t]*)([\w]+)([ \t]*\([\w\s,]*\)[ \t]*)(is|as)',
|
| 393 |
+
bygroups(Text, Name.Function, Text, Keyword)),
|
| 394 |
+
(r'\b[A-Z]\w*\b', Keyword.Type),
|
| 395 |
+
(r'(true|false)\b', Keyword.Constant),
|
| 396 |
+
(r'".*"', String),
|
| 397 |
+
(r'\'.\'', String.Char),
|
| 398 |
+
(r'(><|->|-m->|/\\|<=|<<=|<\.|\|\||\|\^\||-~->|-~m->|\\/|>=|>>|'
|
| 399 |
+
r'\.>|\+\+|-\\|<->|=>|:-|~=|\*\*|<<|>>=|\+>|!!|\|=\||#)',
|
| 400 |
+
Operator),
|
| 401 |
+
(r'[0-9]+\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 402 |
+
(r'0x[0-9a-f]+', Number.Hex),
|
| 403 |
+
(r'[0-9]+', Number.Integer),
|
| 404 |
+
(r'.', Text),
|
| 405 |
+
],
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
def analyse_text(text):
|
| 409 |
+
"""
|
| 410 |
+
Check for the most common text in the beginning of a RSL file.
|
| 411 |
+
"""
|
| 412 |
+
if re.search(r'scheme\s*.*?=\s*class\s*type', text, re.I) is not None:
|
| 413 |
+
return 1.0
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
class MscgenLexer(RegexLexer):
|
| 417 |
+
"""
|
| 418 |
+
For `Mscgen <http://www.mcternan.me.uk/mscgen/>`_ files.
|
| 419 |
+
|
| 420 |
+
.. versionadded:: 1.6
|
| 421 |
+
"""
|
| 422 |
+
name = 'Mscgen'
|
| 423 |
+
aliases = ['mscgen', 'msc']
|
| 424 |
+
filenames = ['*.msc']
|
| 425 |
+
|
| 426 |
+
_var = r'(\w+|"(?:\\"|[^"])*")'
|
| 427 |
+
|
| 428 |
+
tokens = {
|
| 429 |
+
'root': [
|
| 430 |
+
(r'msc\b', Keyword.Type),
|
| 431 |
+
# Options
|
| 432 |
+
(r'(hscale|HSCALE|width|WIDTH|wordwraparcs|WORDWRAPARCS'
|
| 433 |
+
r'|arcgradient|ARCGRADIENT)\b', Name.Property),
|
| 434 |
+
# Operators
|
| 435 |
+
(r'(abox|ABOX|rbox|RBOX|box|BOX|note|NOTE)\b', Operator.Word),
|
| 436 |
+
(r'(\.|-|\|){3}', Keyword),
|
| 437 |
+
(r'(?:-|=|\.|:){2}'
|
| 438 |
+
r'|<<=>>|<->|<=>|<<>>|<:>'
|
| 439 |
+
r'|->|=>>|>>|=>|:>|-x|-X'
|
| 440 |
+
r'|<-|<<=|<<|<=|<:|x-|X-|=', Operator),
|
| 441 |
+
# Names
|
| 442 |
+
(r'\*', Name.Builtin),
|
| 443 |
+
(_var, Name.Variable),
|
| 444 |
+
# Other
|
| 445 |
+
(r'\[', Punctuation, 'attrs'),
|
| 446 |
+
(r'\{|\}|,|;', Punctuation),
|
| 447 |
+
include('comments')
|
| 448 |
+
],
|
| 449 |
+
'attrs': [
|
| 450 |
+
(r'\]', Punctuation, '#pop'),
|
| 451 |
+
(_var + r'(\s*)(=)(\s*)' + _var,
|
| 452 |
+
bygroups(Name.Attribute, Text.Whitespace, Operator, Text.Whitespace,
|
| 453 |
+
String)),
|
| 454 |
+
(r',', Punctuation),
|
| 455 |
+
include('comments')
|
| 456 |
+
],
|
| 457 |
+
'comments': [
|
| 458 |
+
(r'(?://|#).*?\n', Comment.Single),
|
| 459 |
+
(r'/\*(?:.|\n)*?\*/', Comment.Multiline),
|
| 460 |
+
(r'[ \t\r\n]+', Text.Whitespace)
|
| 461 |
+
]
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
|
| 465 |
+
class VGLLexer(RegexLexer):
|
| 466 |
+
"""
|
| 467 |
+
For `SampleManager VGL <http://www.thermoscientific.com/samplemanager>`_
|
| 468 |
+
source code.
|
| 469 |
+
|
| 470 |
+
.. versionadded:: 1.6
|
| 471 |
+
"""
|
| 472 |
+
name = 'VGL'
|
| 473 |
+
aliases = ['vgl']
|
| 474 |
+
filenames = ['*.rpf']
|
| 475 |
+
|
| 476 |
+
flags = re.MULTILINE | re.DOTALL | re.IGNORECASE
|
| 477 |
+
|
| 478 |
+
tokens = {
|
| 479 |
+
'root': [
|
| 480 |
+
(r'\{[^}]*\}', Comment.Multiline),
|
| 481 |
+
(r'declare', Keyword.Constant),
|
| 482 |
+
(r'(if|then|else|endif|while|do|endwhile|and|or|prompt|object'
|
| 483 |
+
r'|create|on|line|with|global|routine|value|endroutine|constant'
|
| 484 |
+
r'|global|set|join|library|compile_option|file|exists|create|copy'
|
| 485 |
+
r'|delete|enable|windows|name|notprotected)(?! *[=<>.,()])',
|
| 486 |
+
Keyword),
|
| 487 |
+
(r'(true|false|null|empty|error|locked)', Keyword.Constant),
|
| 488 |
+
(r'[~^*#!%&\[\]()<>|+=:;,./?-]', Operator),
|
| 489 |
+
(r'"[^"]*"', String),
|
| 490 |
+
(r'(\.)([a-z_$][\w$]*)', bygroups(Operator, Name.Attribute)),
|
| 491 |
+
(r'[0-9][0-9]*(\.[0-9]+(e[+\-]?[0-9]+)?)?', Number),
|
| 492 |
+
(r'[a-z_$][\w$]*', Name),
|
| 493 |
+
(r'[\r\n]+', Text),
|
| 494 |
+
(r'\s+', Text)
|
| 495 |
+
]
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
|
| 499 |
+
class AlloyLexer(RegexLexer):
|
| 500 |
+
"""
|
| 501 |
+
For `Alloy <http://alloy.mit.edu>`_ source code.
|
| 502 |
+
|
| 503 |
+
.. versionadded:: 2.0
|
| 504 |
+
"""
|
| 505 |
+
|
| 506 |
+
name = 'Alloy'
|
| 507 |
+
aliases = ['alloy']
|
| 508 |
+
filenames = ['*.als']
|
| 509 |
+
mimetypes = ['text/x-alloy']
|
| 510 |
+
|
| 511 |
+
flags = re.MULTILINE | re.DOTALL
|
| 512 |
+
|
| 513 |
+
iden_rex = r'[a-zA-Z_][\w\']*'
|
| 514 |
+
text_tuple = (r'[^\S\n]+', Text)
|
| 515 |
+
|
| 516 |
+
tokens = {
|
| 517 |
+
'sig': [
|
| 518 |
+
(r'(extends)\b', Keyword, '#pop'),
|
| 519 |
+
(iden_rex, Name),
|
| 520 |
+
text_tuple,
|
| 521 |
+
(r',', Punctuation),
|
| 522 |
+
(r'\{', Operator, '#pop'),
|
| 523 |
+
],
|
| 524 |
+
'module': [
|
| 525 |
+
text_tuple,
|
| 526 |
+
(iden_rex, Name, '#pop'),
|
| 527 |
+
],
|
| 528 |
+
'fun': [
|
| 529 |
+
text_tuple,
|
| 530 |
+
(r'\{', Operator, '#pop'),
|
| 531 |
+
(iden_rex, Name, '#pop'),
|
| 532 |
+
],
|
| 533 |
+
'root': [
|
| 534 |
+
(r'--.*?$', Comment.Single),
|
| 535 |
+
(r'//.*?$', Comment.Single),
|
| 536 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 537 |
+
text_tuple,
|
| 538 |
+
(r'(module|open)(\s+)', bygroups(Keyword.Namespace, Text),
|
| 539 |
+
'module'),
|
| 540 |
+
(r'(sig|enum)(\s+)', bygroups(Keyword.Declaration, Text), 'sig'),
|
| 541 |
+
(r'(iden|univ|none)\b', Keyword.Constant),
|
| 542 |
+
(r'(int|Int)\b', Keyword.Type),
|
| 543 |
+
(r'(this|abstract|extends|set|seq|one|lone|let)\b', Keyword),
|
| 544 |
+
(r'(all|some|no|sum|disj|when|else)\b', Keyword),
|
| 545 |
+
(r'(run|check|for|but|exactly|expect|as)\b', Keyword),
|
| 546 |
+
(r'(and|or|implies|iff|in)\b', Operator.Word),
|
| 547 |
+
(r'(fun|pred|fact|assert)(\s+)', bygroups(Keyword, Text), 'fun'),
|
| 548 |
+
(r'!|#|&&|\+\+|<<|>>|>=|<=>|<=|\.|->', Operator),
|
| 549 |
+
(r'[-+/*%=<>&!^|~{}\[\]().]', Operator),
|
| 550 |
+
(iden_rex, Name),
|
| 551 |
+
(r'[:,]', Punctuation),
|
| 552 |
+
(r'[0-9]+', Number.Integer),
|
| 553 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 554 |
+
(r'\n', Text),
|
| 555 |
+
]
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
|
| 559 |
+
class PanLexer(RegexLexer):
|
| 560 |
+
"""
|
| 561 |
+
Lexer for `pan <http://github.com/quattor/pan/>`_ source files.
|
| 562 |
+
|
| 563 |
+
Based on tcsh lexer.
|
| 564 |
+
|
| 565 |
+
.. versionadded:: 2.0
|
| 566 |
+
"""
|
| 567 |
+
|
| 568 |
+
name = 'Pan'
|
| 569 |
+
aliases = ['pan']
|
| 570 |
+
filenames = ['*.pan']
|
| 571 |
+
|
| 572 |
+
tokens = {
|
| 573 |
+
'root': [
|
| 574 |
+
include('basic'),
|
| 575 |
+
(r'\(', Keyword, 'paren'),
|
| 576 |
+
(r'\{', Keyword, 'curly'),
|
| 577 |
+
include('data'),
|
| 578 |
+
],
|
| 579 |
+
'basic': [
|
| 580 |
+
(words((
|
| 581 |
+
'if', 'for', 'with', 'else', 'type', 'bind', 'while', 'valid', 'final',
|
| 582 |
+
'prefix', 'unique', 'object', 'foreach', 'include', 'template',
|
| 583 |
+
'function', 'variable', 'structure', 'extensible', 'declaration'),
|
| 584 |
+
prefix=r'\b', suffix=r'\s*\b'),
|
| 585 |
+
Keyword),
|
| 586 |
+
(words((
|
| 587 |
+
'file_contents', 'format', 'index', 'length', 'match', 'matches',
|
| 588 |
+
'replace', 'splice', 'split', 'substr', 'to_lowercase', 'to_uppercase',
|
| 589 |
+
'debug', 'error', 'traceback', 'deprecated', 'base64_decode',
|
| 590 |
+
'base64_encode', 'digest', 'escape', 'unescape', 'append', 'create',
|
| 591 |
+
'first', 'nlist', 'key', 'list', 'merge', 'next', 'prepend', 'is_boolean',
|
| 592 |
+
'is_defined', 'is_double', 'is_list', 'is_long', 'is_nlist', 'is_null',
|
| 593 |
+
'is_number', 'is_property', 'is_resource', 'is_string', 'to_boolean',
|
| 594 |
+
'to_double', 'to_long', 'to_string', 'clone', 'delete', 'exists',
|
| 595 |
+
'path_exists', 'if_exists', 'return', 'value'),
|
| 596 |
+
prefix=r'\b', suffix=r'\s*\b'),
|
| 597 |
+
Name.Builtin),
|
| 598 |
+
(r'#.*', Comment),
|
| 599 |
+
(r'\\[\w\W]', String.Escape),
|
| 600 |
+
(r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Text, Operator)),
|
| 601 |
+
(r'[\[\]{}()=]+', Operator),
|
| 602 |
+
(r'<<\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
|
| 603 |
+
(r';', Punctuation),
|
| 604 |
+
],
|
| 605 |
+
'data': [
|
| 606 |
+
(r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
|
| 607 |
+
(r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
|
| 608 |
+
(r'\s+', Text),
|
| 609 |
+
(r'[^=\s\[\]{}()$"\'`\\;#]+', Text),
|
| 610 |
+
(r'\d+(?= |\Z)', Number),
|
| 611 |
+
],
|
| 612 |
+
'curly': [
|
| 613 |
+
(r'\}', Keyword, '#pop'),
|
| 614 |
+
(r':-', Keyword),
|
| 615 |
+
(r'\w+', Name.Variable),
|
| 616 |
+
(r'[^}:"\'`$]+', Punctuation),
|
| 617 |
+
(r':', Punctuation),
|
| 618 |
+
include('root'),
|
| 619 |
+
],
|
| 620 |
+
'paren': [
|
| 621 |
+
(r'\)', Keyword, '#pop'),
|
| 622 |
+
include('root'),
|
| 623 |
+
],
|
| 624 |
+
}
|
| 625 |
+
|
| 626 |
+
|
| 627 |
+
class CrmshLexer(RegexLexer):
|
| 628 |
+
"""
|
| 629 |
+
Lexer for `crmsh <http://crmsh.github.io/>`_ configuration files
|
| 630 |
+
for Pacemaker clusters.
|
| 631 |
+
|
| 632 |
+
.. versionadded:: 2.1
|
| 633 |
+
"""
|
| 634 |
+
name = 'Crmsh'
|
| 635 |
+
aliases = ['crmsh', 'pcmk']
|
| 636 |
+
filenames = ['*.crmsh', '*.pcmk']
|
| 637 |
+
mimetypes = []
|
| 638 |
+
|
| 639 |
+
elem = words((
|
| 640 |
+
'node', 'primitive', 'group', 'clone', 'ms', 'location',
|
| 641 |
+
'colocation', 'order', 'fencing_topology', 'rsc_ticket',
|
| 642 |
+
'rsc_template', 'property', 'rsc_defaults',
|
| 643 |
+
'op_defaults', 'acl_target', 'acl_group', 'user', 'role',
|
| 644 |
+
'tag'), suffix=r'(?![\w#$-])')
|
| 645 |
+
sub = words((
|
| 646 |
+
'params', 'meta', 'operations', 'op', 'rule',
|
| 647 |
+
'attributes', 'utilization'), suffix=r'(?![\w#$-])')
|
| 648 |
+
acl = words(('read', 'write', 'deny'), suffix=r'(?![\w#$-])')
|
| 649 |
+
bin_rel = words(('and', 'or'), suffix=r'(?![\w#$-])')
|
| 650 |
+
un_ops = words(('defined', 'not_defined'), suffix=r'(?![\w#$-])')
|
| 651 |
+
date_exp = words(('in_range', 'date', 'spec', 'in'), suffix=r'(?![\w#$-])')
|
| 652 |
+
acl_mod = (r'(?:tag|ref|reference|attribute|type|xpath)')
|
| 653 |
+
bin_ops = (r'(?:lt|gt|lte|gte|eq|ne)')
|
| 654 |
+
val_qual = (r'(?:string|version|number)')
|
| 655 |
+
rsc_role_action = (r'(?:Master|Started|Slave|Stopped|'
|
| 656 |
+
r'start|promote|demote|stop)')
|
| 657 |
+
|
| 658 |
+
tokens = {
|
| 659 |
+
'root': [
|
| 660 |
+
(r'^#.*\n?', Comment),
|
| 661 |
+
# attr=value (nvpair)
|
| 662 |
+
(r'([\w#$-]+)(=)("(?:""|[^"])*"|\S+)',
|
| 663 |
+
bygroups(Name.Attribute, Punctuation, String)),
|
| 664 |
+
# need this construct, otherwise numeric node ids
|
| 665 |
+
# are matched as scores
|
| 666 |
+
# elem id:
|
| 667 |
+
(r'(node)(\s+)([\w#$-]+)(:)',
|
| 668 |
+
bygroups(Keyword, Whitespace, Name, Punctuation)),
|
| 669 |
+
# scores
|
| 670 |
+
(r'([+-]?([0-9]+|inf)):', Number),
|
| 671 |
+
# keywords (elements and other)
|
| 672 |
+
(elem, Keyword),
|
| 673 |
+
(sub, Keyword),
|
| 674 |
+
(acl, Keyword),
|
| 675 |
+
# binary operators
|
| 676 |
+
(r'(?:%s:)?(%s)(?![\w#$-])' % (val_qual, bin_ops), Operator.Word),
|
| 677 |
+
# other operators
|
| 678 |
+
(bin_rel, Operator.Word),
|
| 679 |
+
(un_ops, Operator.Word),
|
| 680 |
+
(date_exp, Operator.Word),
|
| 681 |
+
# builtin attributes (e.g. #uname)
|
| 682 |
+
(r'#[a-z]+(?![\w#$-])', Name.Builtin),
|
| 683 |
+
# acl_mod:blah
|
| 684 |
+
(r'(%s)(:)("(?:""|[^"])*"|\S+)' % acl_mod,
|
| 685 |
+
bygroups(Keyword, Punctuation, Name)),
|
| 686 |
+
# rsc_id[:(role|action)]
|
| 687 |
+
# NB: this matches all other identifiers
|
| 688 |
+
(r'([\w#$-]+)(?:(:)(%s))?(?![\w#$-])' % rsc_role_action,
|
| 689 |
+
bygroups(Name, Punctuation, Operator.Word)),
|
| 690 |
+
# punctuation
|
| 691 |
+
(r'(\\(?=\n)|[[\](){}/:@])', Punctuation),
|
| 692 |
+
(r'\s+|\n', Whitespace),
|
| 693 |
+
],
|
| 694 |
+
}
|
| 695 |
+
|
| 696 |
+
|
| 697 |
+
class FlatlineLexer(RegexLexer):
|
| 698 |
+
"""
|
| 699 |
+
Lexer for `Flatline <https://github.com/bigmlcom/flatline>`_ expressions.
|
| 700 |
+
|
| 701 |
+
.. versionadded:: 2.2
|
| 702 |
+
"""
|
| 703 |
+
name = 'Flatline'
|
| 704 |
+
aliases = ['flatline']
|
| 705 |
+
filenames = []
|
| 706 |
+
mimetypes = ['text/x-flatline']
|
| 707 |
+
|
| 708 |
+
special_forms = ('let',)
|
| 709 |
+
|
| 710 |
+
builtins = (
|
| 711 |
+
"!=", "*", "+", "-", "<", "<=", "=", ">", ">=", "abs", "acos", "all",
|
| 712 |
+
"all-but", "all-with-defaults", "all-with-numeric-default", "and",
|
| 713 |
+
"asin", "atan", "avg", "avg-window", "bin-center", "bin-count", "call",
|
| 714 |
+
"category-count", "ceil", "cond", "cond-window", "cons", "cos", "cosh",
|
| 715 |
+
"count", "diff-window", "div", "ensure-value", "ensure-weighted-value",
|
| 716 |
+
"epoch", "epoch-day", "epoch-fields", "epoch-hour", "epoch-millisecond",
|
| 717 |
+
"epoch-minute", "epoch-month", "epoch-second", "epoch-weekday",
|
| 718 |
+
"epoch-year", "exp", "f", "field", "field-prop", "fields", "filter",
|
| 719 |
+
"first", "floor", "head", "if", "in", "integer", "language", "length",
|
| 720 |
+
"levenshtein", "linear-regression", "list", "ln", "log", "log10", "map",
|
| 721 |
+
"matches", "matches?", "max", "maximum", "md5", "mean", "median", "min",
|
| 722 |
+
"minimum", "missing", "missing-count", "missing?", "missing_count",
|
| 723 |
+
"mod", "mode", "normalize", "not", "nth", "occurrences", "or",
|
| 724 |
+
"percentile", "percentile-label", "population", "population-fraction",
|
| 725 |
+
"pow", "preferred", "preferred?", "quantile-label", "rand", "rand-int",
|
| 726 |
+
"random-value", "re-quote", "real", "replace", "replace-first", "rest",
|
| 727 |
+
"round", "row-number", "segment-label", "sha1", "sha256", "sin", "sinh",
|
| 728 |
+
"sqrt", "square", "standard-deviation", "standard_deviation", "str",
|
| 729 |
+
"subs", "sum", "sum-squares", "sum-window", "sum_squares", "summary",
|
| 730 |
+
"summary-no", "summary-str", "tail", "tan", "tanh", "to-degrees",
|
| 731 |
+
"to-radians", "variance", "vectorize", "weighted-random-value", "window",
|
| 732 |
+
"winnow", "within-percentiles?", "z-score",
|
| 733 |
+
)
|
| 734 |
+
|
| 735 |
+
valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+'
|
| 736 |
+
|
| 737 |
+
tokens = {
|
| 738 |
+
'root': [
|
| 739 |
+
# whitespaces - usually not relevant
|
| 740 |
+
(r'[,\s]+', Text),
|
| 741 |
+
|
| 742 |
+
# numbers
|
| 743 |
+
(r'-?\d+\.\d+', Number.Float),
|
| 744 |
+
(r'-?\d+', Number.Integer),
|
| 745 |
+
(r'0x-?[a-f\d]+', Number.Hex),
|
| 746 |
+
|
| 747 |
+
# strings, symbols and characters
|
| 748 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 749 |
+
(r"\\(.|[a-z]+)", String.Char),
|
| 750 |
+
|
| 751 |
+
# expression template placeholder
|
| 752 |
+
(r'_', String.Symbol),
|
| 753 |
+
|
| 754 |
+
# highlight the special forms
|
| 755 |
+
(words(special_forms, suffix=' '), Keyword),
|
| 756 |
+
|
| 757 |
+
# highlight the builtins
|
| 758 |
+
(words(builtins, suffix=' '), Name.Builtin),
|
| 759 |
+
|
| 760 |
+
# the remaining functions
|
| 761 |
+
(r'(?<=\()' + valid_name, Name.Function),
|
| 762 |
+
|
| 763 |
+
# find the remaining variables
|
| 764 |
+
(valid_name, Name.Variable),
|
| 765 |
+
|
| 766 |
+
# parentheses
|
| 767 |
+
(r'(\(|\))', Punctuation),
|
| 768 |
+
],
|
| 769 |
+
}
|
| 770 |
+
|
| 771 |
+
|
| 772 |
+
class SnowballLexer(ExtendedRegexLexer):
|
| 773 |
+
"""
|
| 774 |
+
Lexer for `Snowball <http://snowballstem.org/>`_ source code.
|
| 775 |
+
|
| 776 |
+
.. versionadded:: 2.2
|
| 777 |
+
"""
|
| 778 |
+
|
| 779 |
+
name = 'Snowball'
|
| 780 |
+
aliases = ['snowball']
|
| 781 |
+
filenames = ['*.sbl']
|
| 782 |
+
|
| 783 |
+
_ws = r'\n\r\t '
|
| 784 |
+
|
| 785 |
+
def __init__(self, **options):
|
| 786 |
+
self._reset_stringescapes()
|
| 787 |
+
ExtendedRegexLexer.__init__(self, **options)
|
| 788 |
+
|
| 789 |
+
def _reset_stringescapes(self):
|
| 790 |
+
self._start = "'"
|
| 791 |
+
self._end = "'"
|
| 792 |
+
|
| 793 |
+
def _string(do_string_first):
|
| 794 |
+
def callback(lexer, match, ctx):
|
| 795 |
+
s = match.start()
|
| 796 |
+
text = match.group()
|
| 797 |
+
string = re.compile(r'([^%s]*)(.)' % re.escape(lexer._start)).match
|
| 798 |
+
escape = re.compile(r'([^%s]*)(.)' % re.escape(lexer._end)).match
|
| 799 |
+
pos = 0
|
| 800 |
+
do_string = do_string_first
|
| 801 |
+
while pos < len(text):
|
| 802 |
+
if do_string:
|
| 803 |
+
match = string(text, pos)
|
| 804 |
+
yield s + match.start(1), String.Single, match.group(1)
|
| 805 |
+
if match.group(2) == "'":
|
| 806 |
+
yield s + match.start(2), String.Single, match.group(2)
|
| 807 |
+
ctx.stack.pop()
|
| 808 |
+
break
|
| 809 |
+
yield s + match.start(2), String.Escape, match.group(2)
|
| 810 |
+
pos = match.end()
|
| 811 |
+
match = escape(text, pos)
|
| 812 |
+
yield s + match.start(), String.Escape, match.group()
|
| 813 |
+
if match.group(2) != lexer._end:
|
| 814 |
+
ctx.stack[-1] = 'escape'
|
| 815 |
+
break
|
| 816 |
+
pos = match.end()
|
| 817 |
+
do_string = True
|
| 818 |
+
ctx.pos = s + match.end()
|
| 819 |
+
return callback
|
| 820 |
+
|
| 821 |
+
def _stringescapes(lexer, match, ctx):
|
| 822 |
+
lexer._start = match.group(3)
|
| 823 |
+
lexer._end = match.group(5)
|
| 824 |
+
return bygroups(Keyword.Reserved, Text, String.Escape, Text,
|
| 825 |
+
String.Escape)(lexer, match, ctx)
|
| 826 |
+
|
| 827 |
+
tokens = {
|
| 828 |
+
'root': [
|
| 829 |
+
(words(('len', 'lenof'), suffix=r'\b'), Operator.Word),
|
| 830 |
+
include('root1'),
|
| 831 |
+
],
|
| 832 |
+
'root1': [
|
| 833 |
+
(r'[%s]+' % _ws, Text),
|
| 834 |
+
(r'\d+', Number.Integer),
|
| 835 |
+
(r"'", String.Single, 'string'),
|
| 836 |
+
(r'[()]', Punctuation),
|
| 837 |
+
(r'/\*[\w\W]*?\*/', Comment.Multiline),
|
| 838 |
+
(r'//.*', Comment.Single),
|
| 839 |
+
(r'[!*+\-/<=>]=|[-=]>|<[+-]|[$*+\-/<=>?\[\]]', Operator),
|
| 840 |
+
(words(('as', 'get', 'hex', 'among', 'define', 'decimal',
|
| 841 |
+
'backwardmode'), suffix=r'\b'),
|
| 842 |
+
Keyword.Reserved),
|
| 843 |
+
(words(('strings', 'booleans', 'integers', 'routines', 'externals',
|
| 844 |
+
'groupings'), suffix=r'\b'),
|
| 845 |
+
Keyword.Reserved, 'declaration'),
|
| 846 |
+
(words(('do', 'or', 'and', 'for', 'hop', 'non', 'not', 'set', 'try',
|
| 847 |
+
'fail', 'goto', 'loop', 'next', 'test', 'true',
|
| 848 |
+
'false', 'unset', 'atmark', 'attach', 'delete', 'gopast',
|
| 849 |
+
'insert', 'repeat', 'sizeof', 'tomark', 'atleast',
|
| 850 |
+
'atlimit', 'reverse', 'setmark', 'tolimit', 'setlimit',
|
| 851 |
+
'backwards', 'substring'), suffix=r'\b'),
|
| 852 |
+
Operator.Word),
|
| 853 |
+
(words(('size', 'limit', 'cursor', 'maxint', 'minint'),
|
| 854 |
+
suffix=r'\b'),
|
| 855 |
+
Name.Builtin),
|
| 856 |
+
(r'(stringdef\b)([%s]*)([^%s]+)' % (_ws, _ws),
|
| 857 |
+
bygroups(Keyword.Reserved, Text, String.Escape)),
|
| 858 |
+
(r'(stringescapes\b)([%s]*)(.)([%s]*)(.)' % (_ws, _ws),
|
| 859 |
+
_stringescapes),
|
| 860 |
+
(r'[A-Za-z]\w*', Name),
|
| 861 |
+
],
|
| 862 |
+
'declaration': [
|
| 863 |
+
(r'\)', Punctuation, '#pop'),
|
| 864 |
+
(words(('len', 'lenof'), suffix=r'\b'), Name,
|
| 865 |
+
('root1', 'declaration')),
|
| 866 |
+
include('root1'),
|
| 867 |
+
],
|
| 868 |
+
'string': [
|
| 869 |
+
(r"[^']*'", _string(True)),
|
| 870 |
+
],
|
| 871 |
+
'escape': [
|
| 872 |
+
(r"[^']*'", _string(False)),
|
| 873 |
+
],
|
| 874 |
+
}
|
| 875 |
+
|
| 876 |
+
def get_tokens_unprocessed(self, text=None, context=None):
|
| 877 |
+
self._reset_stringescapes()
|
| 878 |
+
return ExtendedRegexLexer.get_tokens_unprocessed(self, text, context)
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dylan.py
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, default
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Generic, Literal
|
| 17 |
+
|
| 18 |
+
__all__ = ['DylanLexer', 'DylanConsoleLexer', 'DylanLidLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class DylanLexer(RegexLexer):
|
| 22 |
+
"""
|
| 23 |
+
For the `Dylan <http://www.opendylan.org/>`_ language.
|
| 24 |
+
|
| 25 |
+
.. versionadded:: 0.7
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
name = 'Dylan'
|
| 29 |
+
aliases = ['dylan']
|
| 30 |
+
filenames = ['*.dylan', '*.dyl', '*.intr']
|
| 31 |
+
mimetypes = ['text/x-dylan']
|
| 32 |
+
|
| 33 |
+
flags = re.IGNORECASE
|
| 34 |
+
|
| 35 |
+
builtins = set((
|
| 36 |
+
'subclass', 'abstract', 'block', 'concrete', 'constant', 'class',
|
| 37 |
+
'compiler-open', 'compiler-sideways', 'domain', 'dynamic',
|
| 38 |
+
'each-subclass', 'exception', 'exclude', 'function', 'generic',
|
| 39 |
+
'handler', 'inherited', 'inline', 'inline-only', 'instance',
|
| 40 |
+
'interface', 'import', 'keyword', 'library', 'macro', 'method',
|
| 41 |
+
'module', 'open', 'primary', 'required', 'sealed', 'sideways',
|
| 42 |
+
'singleton', 'slot', 'thread', 'variable', 'virtual'))
|
| 43 |
+
|
| 44 |
+
keywords = set((
|
| 45 |
+
'above', 'afterwards', 'begin', 'below', 'by', 'case', 'cleanup',
|
| 46 |
+
'create', 'define', 'else', 'elseif', 'end', 'export', 'finally',
|
| 47 |
+
'for', 'from', 'if', 'in', 'let', 'local', 'otherwise', 'rename',
|
| 48 |
+
'select', 'signal', 'then', 'to', 'unless', 'until', 'use', 'when',
|
| 49 |
+
'while'))
|
| 50 |
+
|
| 51 |
+
operators = set((
|
| 52 |
+
'~', '+', '-', '*', '|', '^', '=', '==', '~=', '~==', '<', '<=',
|
| 53 |
+
'>', '>=', '&', '|'))
|
| 54 |
+
|
| 55 |
+
functions = set((
|
| 56 |
+
'abort', 'abs', 'add', 'add!', 'add-method', 'add-new', 'add-new!',
|
| 57 |
+
'all-superclasses', 'always', 'any?', 'applicable-method?', 'apply',
|
| 58 |
+
'aref', 'aref-setter', 'as', 'as-lowercase', 'as-lowercase!',
|
| 59 |
+
'as-uppercase', 'as-uppercase!', 'ash', 'backward-iteration-protocol',
|
| 60 |
+
'break', 'ceiling', 'ceiling/', 'cerror', 'check-type', 'choose',
|
| 61 |
+
'choose-by', 'complement', 'compose', 'concatenate', 'concatenate-as',
|
| 62 |
+
'condition-format-arguments', 'condition-format-string', 'conjoin',
|
| 63 |
+
'copy-sequence', 'curry', 'default-handler', 'dimension', 'dimensions',
|
| 64 |
+
'direct-subclasses', 'direct-superclasses', 'disjoin', 'do',
|
| 65 |
+
'do-handlers', 'element', 'element-setter', 'empty?', 'error', 'even?',
|
| 66 |
+
'every?', 'false-or', 'fill!', 'find-key', 'find-method', 'first',
|
| 67 |
+
'first-setter', 'floor', 'floor/', 'forward-iteration-protocol',
|
| 68 |
+
'function-arguments', 'function-return-values',
|
| 69 |
+
'function-specializers', 'gcd', 'generic-function-mandatory-keywords',
|
| 70 |
+
'generic-function-methods', 'head', 'head-setter', 'identity',
|
| 71 |
+
'initialize', 'instance?', 'integral?', 'intersection',
|
| 72 |
+
'key-sequence', 'key-test', 'last', 'last-setter', 'lcm', 'limited',
|
| 73 |
+
'list', 'logand', 'logbit?', 'logior', 'lognot', 'logxor', 'make',
|
| 74 |
+
'map', 'map-as', 'map-into', 'max', 'member?', 'merge-hash-codes',
|
| 75 |
+
'min', 'modulo', 'negative', 'negative?', 'next-method',
|
| 76 |
+
'object-class', 'object-hash', 'odd?', 'one-of', 'pair', 'pop',
|
| 77 |
+
'pop-last', 'positive?', 'push', 'push-last', 'range', 'rank',
|
| 78 |
+
'rcurry', 'reduce', 'reduce1', 'remainder', 'remove', 'remove!',
|
| 79 |
+
'remove-duplicates', 'remove-duplicates!', 'remove-key!',
|
| 80 |
+
'remove-method', 'replace-elements!', 'replace-subsequence!',
|
| 81 |
+
'restart-query', 'return-allowed?', 'return-description',
|
| 82 |
+
'return-query', 'reverse', 'reverse!', 'round', 'round/',
|
| 83 |
+
'row-major-index', 'second', 'second-setter', 'shallow-copy',
|
| 84 |
+
'signal', 'singleton', 'size', 'size-setter', 'slot-initialized?',
|
| 85 |
+
'sort', 'sort!', 'sorted-applicable-methods', 'subsequence-position',
|
| 86 |
+
'subtype?', 'table-protocol', 'tail', 'tail-setter', 'third',
|
| 87 |
+
'third-setter', 'truncate', 'truncate/', 'type-error-expected-type',
|
| 88 |
+
'type-error-value', 'type-for-copy', 'type-union', 'union', 'values',
|
| 89 |
+
'vector', 'zero?'))
|
| 90 |
+
|
| 91 |
+
valid_name = '\\\\?[\\w!&*<>|^$%@\\-+~?/=]+'
|
| 92 |
+
|
| 93 |
+
def get_tokens_unprocessed(self, text):
|
| 94 |
+
for index, token, value in RegexLexer.get_tokens_unprocessed(self, text):
|
| 95 |
+
if token is Name:
|
| 96 |
+
lowercase_value = value.lower()
|
| 97 |
+
if lowercase_value in self.builtins:
|
| 98 |
+
yield index, Name.Builtin, value
|
| 99 |
+
continue
|
| 100 |
+
if lowercase_value in self.keywords:
|
| 101 |
+
yield index, Keyword, value
|
| 102 |
+
continue
|
| 103 |
+
if lowercase_value in self.functions:
|
| 104 |
+
yield index, Name.Builtin, value
|
| 105 |
+
continue
|
| 106 |
+
if lowercase_value in self.operators:
|
| 107 |
+
yield index, Operator, value
|
| 108 |
+
continue
|
| 109 |
+
yield index, token, value
|
| 110 |
+
|
| 111 |
+
tokens = {
|
| 112 |
+
'root': [
|
| 113 |
+
# Whitespace
|
| 114 |
+
(r'\s+', Text),
|
| 115 |
+
|
| 116 |
+
# single line comment
|
| 117 |
+
(r'//.*?\n', Comment.Single),
|
| 118 |
+
|
| 119 |
+
# lid header
|
| 120 |
+
(r'([a-z0-9-]+)(:)([ \t]*)(.*(?:\n[ \t].+)*)',
|
| 121 |
+
bygroups(Name.Attribute, Operator, Text, String)),
|
| 122 |
+
|
| 123 |
+
default('code') # no header match, switch to code
|
| 124 |
+
],
|
| 125 |
+
'code': [
|
| 126 |
+
# Whitespace
|
| 127 |
+
(r'\s+', Text),
|
| 128 |
+
|
| 129 |
+
# single line comment
|
| 130 |
+
(r'//.*?\n', Comment.Single),
|
| 131 |
+
|
| 132 |
+
# multi-line comment
|
| 133 |
+
(r'/\*', Comment.Multiline, 'comment'),
|
| 134 |
+
|
| 135 |
+
# strings and characters
|
| 136 |
+
(r'"', String, 'string'),
|
| 137 |
+
(r"'(\\.|\\[0-7]{1,3}|\\x[a-f0-9]{1,2}|[^\\\'\n])'", String.Char),
|
| 138 |
+
|
| 139 |
+
# binary integer
|
| 140 |
+
(r'#b[01]+', Number.Bin),
|
| 141 |
+
|
| 142 |
+
# octal integer
|
| 143 |
+
(r'#o[0-7]+', Number.Oct),
|
| 144 |
+
|
| 145 |
+
# floating point
|
| 146 |
+
(r'[-+]?(\d*\.\d+(e[-+]?\d+)?|\d+(\.\d*)?e[-+]?\d+)', Number.Float),
|
| 147 |
+
|
| 148 |
+
# decimal integer
|
| 149 |
+
(r'[-+]?\d+', Number.Integer),
|
| 150 |
+
|
| 151 |
+
# hex integer
|
| 152 |
+
(r'#x[0-9a-f]+', Number.Hex),
|
| 153 |
+
|
| 154 |
+
# Macro parameters
|
| 155 |
+
(r'(\?' + valid_name + ')(:)'
|
| 156 |
+
r'(token|name|variable|expression|body|case-body|\*)',
|
| 157 |
+
bygroups(Name.Tag, Operator, Name.Builtin)),
|
| 158 |
+
(r'(\?)(:)(token|name|variable|expression|body|case-body|\*)',
|
| 159 |
+
bygroups(Name.Tag, Operator, Name.Builtin)),
|
| 160 |
+
(r'\?' + valid_name, Name.Tag),
|
| 161 |
+
|
| 162 |
+
# Punctuation
|
| 163 |
+
(r'(=>|::|#\(|#\[|##|\?\?|\?=|\?|[(){}\[\],.;])', Punctuation),
|
| 164 |
+
|
| 165 |
+
# Most operators are picked up as names and then re-flagged.
|
| 166 |
+
# This one isn't valid in a name though, so we pick it up now.
|
| 167 |
+
(r':=', Operator),
|
| 168 |
+
|
| 169 |
+
# Pick up #t / #f before we match other stuff with #.
|
| 170 |
+
(r'#[tf]', Literal),
|
| 171 |
+
|
| 172 |
+
# #"foo" style keywords
|
| 173 |
+
(r'#"', String.Symbol, 'keyword'),
|
| 174 |
+
|
| 175 |
+
# #rest, #key, #all-keys, etc.
|
| 176 |
+
(r'#[a-z0-9-]+', Keyword),
|
| 177 |
+
|
| 178 |
+
# required-init-keyword: style keywords.
|
| 179 |
+
(valid_name + ':', Keyword),
|
| 180 |
+
|
| 181 |
+
# class names
|
| 182 |
+
(r'<' + valid_name + '>', Name.Class),
|
| 183 |
+
|
| 184 |
+
# define variable forms.
|
| 185 |
+
(r'\*' + valid_name + '\*', Name.Variable.Global),
|
| 186 |
+
|
| 187 |
+
# define constant forms.
|
| 188 |
+
(r'\$' + valid_name, Name.Constant),
|
| 189 |
+
|
| 190 |
+
# everything else. We re-flag some of these in the method above.
|
| 191 |
+
(valid_name, Name),
|
| 192 |
+
],
|
| 193 |
+
'comment': [
|
| 194 |
+
(r'[^*/]', Comment.Multiline),
|
| 195 |
+
(r'/\*', Comment.Multiline, '#push'),
|
| 196 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 197 |
+
(r'[*/]', Comment.Multiline)
|
| 198 |
+
],
|
| 199 |
+
'keyword': [
|
| 200 |
+
(r'"', String.Symbol, '#pop'),
|
| 201 |
+
(r'[^\\"]+', String.Symbol), # all other characters
|
| 202 |
+
],
|
| 203 |
+
'string': [
|
| 204 |
+
(r'"', String, '#pop'),
|
| 205 |
+
(r'\\([\\abfnrtv"\']|x[a-f0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
| 206 |
+
(r'[^\\"\n]+', String), # all other characters
|
| 207 |
+
(r'\\\n', String), # line continuation
|
| 208 |
+
(r'\\', String), # stray backslash
|
| 209 |
+
]
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
class DylanLidLexer(RegexLexer):
|
| 214 |
+
"""
|
| 215 |
+
For Dylan LID (Library Interchange Definition) files.
|
| 216 |
+
|
| 217 |
+
.. versionadded:: 1.6
|
| 218 |
+
"""
|
| 219 |
+
|
| 220 |
+
name = 'DylanLID'
|
| 221 |
+
aliases = ['dylan-lid', 'lid']
|
| 222 |
+
filenames = ['*.lid', '*.hdp']
|
| 223 |
+
mimetypes = ['text/x-dylan-lid']
|
| 224 |
+
|
| 225 |
+
flags = re.IGNORECASE
|
| 226 |
+
|
| 227 |
+
tokens = {
|
| 228 |
+
'root': [
|
| 229 |
+
# Whitespace
|
| 230 |
+
(r'\s+', Text),
|
| 231 |
+
|
| 232 |
+
# single line comment
|
| 233 |
+
(r'//.*?\n', Comment.Single),
|
| 234 |
+
|
| 235 |
+
# lid header
|
| 236 |
+
(r'(.*?)(:)([ \t]*)(.*(?:\n[ \t].+)*)',
|
| 237 |
+
bygroups(Name.Attribute, Operator, Text, String)),
|
| 238 |
+
]
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
class DylanConsoleLexer(Lexer):
|
| 243 |
+
"""
|
| 244 |
+
For Dylan interactive console output like:
|
| 245 |
+
|
| 246 |
+
.. sourcecode:: dylan-console
|
| 247 |
+
|
| 248 |
+
? let a = 1;
|
| 249 |
+
=> 1
|
| 250 |
+
? a
|
| 251 |
+
=> 1
|
| 252 |
+
|
| 253 |
+
This is based on a copy of the RubyConsoleLexer.
|
| 254 |
+
|
| 255 |
+
.. versionadded:: 1.6
|
| 256 |
+
"""
|
| 257 |
+
name = 'Dylan session'
|
| 258 |
+
aliases = ['dylan-console', 'dylan-repl']
|
| 259 |
+
filenames = ['*.dylan-console']
|
| 260 |
+
mimetypes = ['text/x-dylan-console']
|
| 261 |
+
|
| 262 |
+
_line_re = re.compile('.*?\n')
|
| 263 |
+
_prompt_re = re.compile('\?| ')
|
| 264 |
+
|
| 265 |
+
def get_tokens_unprocessed(self, text):
|
| 266 |
+
dylexer = DylanLexer(**self.options)
|
| 267 |
+
|
| 268 |
+
curcode = ''
|
| 269 |
+
insertions = []
|
| 270 |
+
for match in self._line_re.finditer(text):
|
| 271 |
+
line = match.group()
|
| 272 |
+
m = self._prompt_re.match(line)
|
| 273 |
+
if m is not None:
|
| 274 |
+
end = m.end()
|
| 275 |
+
insertions.append((len(curcode),
|
| 276 |
+
[(0, Generic.Prompt, line[:end])]))
|
| 277 |
+
curcode += line[end:]
|
| 278 |
+
else:
|
| 279 |
+
if curcode:
|
| 280 |
+
for item in do_insertions(insertions,
|
| 281 |
+
dylexer.get_tokens_unprocessed(curcode)):
|
| 282 |
+
yield item
|
| 283 |
+
curcode = ''
|
| 284 |
+
insertions = []
|
| 285 |
+
yield match.start(), Generic.Output, line
|
| 286 |
+
if curcode:
|
| 287 |
+
for item in do_insertions(insertions,
|
| 288 |
+
dylexer.get_tokens_unprocessed(curcode)):
|
| 289 |
+
yield item
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ecl.py
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.ecl
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for the ECL language.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, include, bygroups, words
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Error
|
| 17 |
+
|
| 18 |
+
__all__ = ['ECLLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class ECLLexer(RegexLexer):
|
| 22 |
+
"""
|
| 23 |
+
Lexer for the declarative big-data `ECL
|
| 24 |
+
<http://hpccsystems.com/community/docs/ecl-language-reference/html>`_
|
| 25 |
+
language.
|
| 26 |
+
|
| 27 |
+
.. versionadded:: 1.5
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
name = 'ECL'
|
| 31 |
+
aliases = ['ecl']
|
| 32 |
+
filenames = ['*.ecl']
|
| 33 |
+
mimetypes = ['application/x-ecl']
|
| 34 |
+
|
| 35 |
+
flags = re.IGNORECASE | re.MULTILINE
|
| 36 |
+
|
| 37 |
+
tokens = {
|
| 38 |
+
'root': [
|
| 39 |
+
include('whitespace'),
|
| 40 |
+
include('statements'),
|
| 41 |
+
],
|
| 42 |
+
'whitespace': [
|
| 43 |
+
(r'\s+', Text),
|
| 44 |
+
(r'\/\/.*', Comment.Single),
|
| 45 |
+
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
|
| 46 |
+
],
|
| 47 |
+
'statements': [
|
| 48 |
+
include('types'),
|
| 49 |
+
include('keywords'),
|
| 50 |
+
include('functions'),
|
| 51 |
+
include('hash'),
|
| 52 |
+
(r'"', String, 'string'),
|
| 53 |
+
(r'\'', String, 'string'),
|
| 54 |
+
(r'(\d+\.\d*|\.\d+|\d+)e[+-]?\d+[lu]*', Number.Float),
|
| 55 |
+
(r'(\d+\.\d*|\.\d+|\d+f)f?', Number.Float),
|
| 56 |
+
(r'0x[0-9a-f]+[lu]*', Number.Hex),
|
| 57 |
+
(r'0[0-7]+[lu]*', Number.Oct),
|
| 58 |
+
(r'\d+[lu]*', Number.Integer),
|
| 59 |
+
(r'\*/', Error),
|
| 60 |
+
(r'[~!%^&*+=|?:<>/-]+', Operator),
|
| 61 |
+
(r'[{}()\[\],.;]', Punctuation),
|
| 62 |
+
(r'[a-z_]\w*', Name),
|
| 63 |
+
],
|
| 64 |
+
'hash': [
|
| 65 |
+
(r'^#.*$', Comment.Preproc),
|
| 66 |
+
],
|
| 67 |
+
'types': [
|
| 68 |
+
(r'(RECORD|END)\D', Keyword.Declaration),
|
| 69 |
+
(r'((?:ASCII|BIG_ENDIAN|BOOLEAN|DATA|DECIMAL|EBCDIC|INTEGER|PATTERN|'
|
| 70 |
+
r'QSTRING|REAL|RECORD|RULE|SET OF|STRING|TOKEN|UDECIMAL|UNICODE|'
|
| 71 |
+
r'UNSIGNED|VARSTRING|VARUNICODE)\d*)(\s+)',
|
| 72 |
+
bygroups(Keyword.Type, Text)),
|
| 73 |
+
],
|
| 74 |
+
'keywords': [
|
| 75 |
+
(words((
|
| 76 |
+
'APPLY', 'ASSERT', 'BUILD', 'BUILDINDEX', 'EVALUATE', 'FAIL',
|
| 77 |
+
'KEYDIFF', 'KEYPATCH', 'LOADXML', 'NOTHOR', 'NOTIFY', 'OUTPUT',
|
| 78 |
+
'PARALLEL', 'SEQUENTIAL', 'SOAPCALL', 'CHECKPOINT', 'DEPRECATED',
|
| 79 |
+
'FAILCODE', 'FAILMESSAGE', 'FAILURE', 'GLOBAL', 'INDEPENDENT',
|
| 80 |
+
'ONWARNING', 'PERSIST', 'PRIORITY', 'RECOVERY', 'STORED', 'SUCCESS',
|
| 81 |
+
'WAIT', 'WHEN'), suffix=r'\b'),
|
| 82 |
+
Keyword.Reserved),
|
| 83 |
+
# These are classed differently, check later
|
| 84 |
+
(words((
|
| 85 |
+
'ALL', 'AND', 'ANY', 'AS', 'ATMOST', 'BEFORE', 'BEGINC++', 'BEST', 'BETWEEN', 'CASE',
|
| 86 |
+
'CONST', 'COUNTER', 'CSV', 'DESCEND', 'ENCRYPT', 'ENDC++', 'ENDMACRO', 'EXCEPT',
|
| 87 |
+
'EXCLUSIVE', 'EXPIRE', 'EXPORT', 'EXTEND', 'FALSE', 'FEW', 'FIRST', 'FLAT', 'FULL',
|
| 88 |
+
'FUNCTION', 'GROUP', 'HEADER', 'HEADING', 'HOLE', 'IFBLOCK', 'IMPORT', 'IN', 'JOINED',
|
| 89 |
+
'KEEP', 'KEYED', 'LAST', 'LEFT', 'LIMIT', 'LOAD', 'LOCAL', 'LOCALE', 'LOOKUP', 'MACRO',
|
| 90 |
+
'MANY', 'MAXCOUNT', 'MAXLENGTH', 'MIN SKEW', 'MODULE', 'INTERFACE', 'NAMED', 'NOCASE',
|
| 91 |
+
'NOROOT', 'NOSCAN', 'NOSORT', 'NOT', 'OF', 'ONLY', 'OPT', 'OR', 'OUTER', 'OVERWRITE',
|
| 92 |
+
'PACKED', 'PARTITION', 'PENALTY', 'PHYSICALLENGTH', 'PIPE', 'QUOTE', 'RELATIONSHIP',
|
| 93 |
+
'REPEAT', 'RETURN', 'RIGHT', 'SCAN', 'SELF', 'SEPARATOR', 'SERVICE', 'SHARED', 'SKEW',
|
| 94 |
+
'SKIP', 'SQL', 'STORE', 'TERMINATOR', 'THOR', 'THRESHOLD', 'TOKEN', 'TRANSFORM', 'TRIM',
|
| 95 |
+
'TRUE', 'TYPE', 'UNICODEORDER', 'UNSORTED', 'VALIDATE', 'VIRTUAL', 'WHOLE', 'WILD',
|
| 96 |
+
'WITHIN', 'XML', 'XPATH', '__COMPRESSED__'), suffix=r'\b'),
|
| 97 |
+
Keyword.Reserved),
|
| 98 |
+
],
|
| 99 |
+
'functions': [
|
| 100 |
+
(words((
|
| 101 |
+
'ABS', 'ACOS', 'ALLNODES', 'ASCII', 'ASIN', 'ASSTRING', 'ATAN', 'ATAN2', 'AVE', 'CASE',
|
| 102 |
+
'CHOOSE', 'CHOOSEN', 'CHOOSESETS', 'CLUSTERSIZE', 'COMBINE', 'CORRELATION', 'COS',
|
| 103 |
+
'COSH', 'COUNT', 'COVARIANCE', 'CRON', 'DATASET', 'DEDUP', 'DEFINE', 'DENORMALIZE',
|
| 104 |
+
'DISTRIBUTE', 'DISTRIBUTED', 'DISTRIBUTION', 'EBCDIC', 'ENTH', 'ERROR', 'EVALUATE',
|
| 105 |
+
'EVENT', 'EVENTEXTRA', 'EVENTNAME', 'EXISTS', 'EXP', 'FAILCODE', 'FAILMESSAGE',
|
| 106 |
+
'FETCH', 'FROMUNICODE', 'GETISVALID', 'GLOBAL', 'GRAPH', 'GROUP', 'HASH', 'HASH32',
|
| 107 |
+
'HASH64', 'HASHCRC', 'HASHMD5', 'HAVING', 'IF', 'INDEX', 'INTFORMAT', 'ISVALID',
|
| 108 |
+
'ITERATE', 'JOIN', 'KEYUNICODE', 'LENGTH', 'LIBRARY', 'LIMIT', 'LN', 'LOCAL', 'LOG', 'LOOP',
|
| 109 |
+
'MAP', 'MATCHED', 'MATCHLENGTH', 'MATCHPOSITION', 'MATCHTEXT', 'MATCHUNICODE',
|
| 110 |
+
'MAX', 'MERGE', 'MERGEJOIN', 'MIN', 'NOLOCAL', 'NONEMPTY', 'NORMALIZE', 'PARSE', 'PIPE',
|
| 111 |
+
'POWER', 'PRELOAD', 'PROCESS', 'PROJECT', 'PULL', 'RANDOM', 'RANGE', 'RANK', 'RANKED',
|
| 112 |
+
'REALFORMAT', 'RECORDOF', 'REGEXFIND', 'REGEXREPLACE', 'REGROUP', 'REJECTED',
|
| 113 |
+
'ROLLUP', 'ROUND', 'ROUNDUP', 'ROW', 'ROWDIFF', 'SAMPLE', 'SET', 'SIN', 'SINH', 'SIZEOF',
|
| 114 |
+
'SOAPCALL', 'SORT', 'SORTED', 'SQRT', 'STEPPED', 'STORED', 'SUM', 'TABLE', 'TAN', 'TANH',
|
| 115 |
+
'THISNODE', 'TOPN', 'TOUNICODE', 'TRANSFER', 'TRIM', 'TRUNCATE', 'TYPEOF', 'UNGROUP',
|
| 116 |
+
'UNICODEORDER', 'VARIANCE', 'WHICH', 'WORKUNIT', 'XMLDECODE', 'XMLENCODE',
|
| 117 |
+
'XMLTEXT', 'XMLUNICODE'), suffix=r'\b'),
|
| 118 |
+
Name.Function),
|
| 119 |
+
],
|
| 120 |
+
'string': [
|
| 121 |
+
(r'"', String, '#pop'),
|
| 122 |
+
(r'\'', String, '#pop'),
|
| 123 |
+
(r'[^"\']+', String),
|
| 124 |
+
],
|
| 125 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/eiffel.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.eiffel
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexer for the Eiffel language.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from pygments.lexer import RegexLexer, include, words
|
| 13 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 14 |
+
Number, Punctuation
|
| 15 |
+
|
| 16 |
+
__all__ = ['EiffelLexer']
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class EiffelLexer(RegexLexer):
|
| 20 |
+
"""
|
| 21 |
+
For `Eiffel <http://www.eiffel.com>`_ source code.
|
| 22 |
+
|
| 23 |
+
.. versionadded:: 2.0
|
| 24 |
+
"""
|
| 25 |
+
name = 'Eiffel'
|
| 26 |
+
aliases = ['eiffel']
|
| 27 |
+
filenames = ['*.e']
|
| 28 |
+
mimetypes = ['text/x-eiffel']
|
| 29 |
+
|
| 30 |
+
tokens = {
|
| 31 |
+
'root': [
|
| 32 |
+
(r'[^\S\n]+', Text),
|
| 33 |
+
(r'--.*?\n', Comment.Single),
|
| 34 |
+
(r'[^\S\n]+', Text),
|
| 35 |
+
# Please note that keyword and operator are case insensitive.
|
| 36 |
+
(r'(?i)(true|false|void|current|result|precursor)\b', Keyword.Constant),
|
| 37 |
+
(r'(?i)(and(\s+then)?|not|xor|implies|or(\s+else)?)\b', Operator.Word),
|
| 38 |
+
(words((
|
| 39 |
+
'across', 'agent', 'alias', 'all', 'as', 'assign', 'attached',
|
| 40 |
+
'attribute', 'check', 'class', 'convert', 'create', 'debug',
|
| 41 |
+
'deferred', 'detachable', 'do', 'else', 'elseif', 'end', 'ensure',
|
| 42 |
+
'expanded', 'export', 'external', 'feature', 'from', 'frozen', 'if',
|
| 43 |
+
'inherit', 'inspect', 'invariant', 'like', 'local', 'loop', 'none',
|
| 44 |
+
'note', 'obsolete', 'old', 'once', 'only', 'redefine', 'rename',
|
| 45 |
+
'require', 'rescue', 'retry', 'select', 'separate', 'then',
|
| 46 |
+
'undefine', 'until', 'variant', 'when'), prefix=r'(?i)\b', suffix=r'\b'),
|
| 47 |
+
Keyword.Reserved),
|
| 48 |
+
(r'"\[(([^\]%]|\n)|%(.|\n)|\][^"])*?\]"', String),
|
| 49 |
+
(r'"([^"%\n]|%.)*?"', String),
|
| 50 |
+
include('numbers'),
|
| 51 |
+
(r"'([^'%]|%'|%%)'", String.Char),
|
| 52 |
+
(r"(//|\\\\|>=|<=|:=|/=|~|/~|[\\?!#%&@|+/\-=>*$<^\[\]])", Operator),
|
| 53 |
+
(r"([{}():;,.])", Punctuation),
|
| 54 |
+
(r'([a-z]\w*)|([A-Z][A-Z0-9_]*[a-z]\w*)', Name),
|
| 55 |
+
(r'([A-Z][A-Z0-9_]*)', Name.Class),
|
| 56 |
+
(r'\n+', Text),
|
| 57 |
+
],
|
| 58 |
+
'numbers': [
|
| 59 |
+
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
| 60 |
+
(r'0[bB][01]+', Number.Bin),
|
| 61 |
+
(r'0[cC][0-7]+', Number.Oct),
|
| 62 |
+
(r'([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)', Number.Float),
|
| 63 |
+
(r'[0-9]+', Number.Integer),
|
| 64 |
+
],
|
| 65 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/elm.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.elm
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexer for the Elm programming language.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from pygments.lexer import RegexLexer, words, include
|
| 13 |
+
from pygments.token import Comment, Keyword, Name, Number, Punctuation, String, Text
|
| 14 |
+
|
| 15 |
+
__all__ = ['ElmLexer']
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class ElmLexer(RegexLexer):
|
| 19 |
+
"""
|
| 20 |
+
For `Elm <http://elm-lang.org/>`_ source code.
|
| 21 |
+
|
| 22 |
+
.. versionadded:: 2.1
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
name = 'Elm'
|
| 26 |
+
aliases = ['elm']
|
| 27 |
+
filenames = ['*.elm']
|
| 28 |
+
mimetypes = ['text/x-elm']
|
| 29 |
+
|
| 30 |
+
validName = r'[a-z_][a-zA-Z_\']*'
|
| 31 |
+
|
| 32 |
+
specialName = r'^main '
|
| 33 |
+
|
| 34 |
+
builtinOps = (
|
| 35 |
+
'~', '||', '|>', '|', '`', '^', '\\', '\'', '>>', '>=', '>', '==',
|
| 36 |
+
'=', '<~', '<|', '<=', '<<', '<-', '<', '::', ':', '/=', '//', '/',
|
| 37 |
+
'..', '.', '->', '-', '++', '+', '*', '&&', '%',
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
reservedWords = words((
|
| 41 |
+
'alias', 'as', 'case', 'else', 'if', 'import', 'in',
|
| 42 |
+
'let', 'module', 'of', 'port', 'then', 'type', 'where',
|
| 43 |
+
), suffix=r'\b')
|
| 44 |
+
|
| 45 |
+
tokens = {
|
| 46 |
+
'root': [
|
| 47 |
+
|
| 48 |
+
# Comments
|
| 49 |
+
(r'\{-', Comment.Multiline, 'comment'),
|
| 50 |
+
(r'--.*', Comment.Single),
|
| 51 |
+
|
| 52 |
+
# Whitespace
|
| 53 |
+
(r'\s+', Text),
|
| 54 |
+
|
| 55 |
+
# Strings
|
| 56 |
+
(r'"', String, 'doublequote'),
|
| 57 |
+
|
| 58 |
+
# Modules
|
| 59 |
+
(r'^\s*module\s*', Keyword.Namespace, 'imports'),
|
| 60 |
+
|
| 61 |
+
# Imports
|
| 62 |
+
(r'^\s*import\s*', Keyword.Namespace, 'imports'),
|
| 63 |
+
|
| 64 |
+
# Shaders
|
| 65 |
+
(r'\[glsl\|.*', Name.Entity, 'shader'),
|
| 66 |
+
|
| 67 |
+
# Keywords
|
| 68 |
+
(reservedWords, Keyword.Reserved),
|
| 69 |
+
|
| 70 |
+
# Types
|
| 71 |
+
(r'[A-Z]\w*', Keyword.Type),
|
| 72 |
+
|
| 73 |
+
# Main
|
| 74 |
+
(specialName, Keyword.Reserved),
|
| 75 |
+
|
| 76 |
+
# Prefix Operators
|
| 77 |
+
(words((builtinOps), prefix=r'\(', suffix=r'\)'), Name.Function),
|
| 78 |
+
|
| 79 |
+
# Infix Operators
|
| 80 |
+
(words((builtinOps)), Name.Function),
|
| 81 |
+
|
| 82 |
+
# Numbers
|
| 83 |
+
include('numbers'),
|
| 84 |
+
|
| 85 |
+
# Variable Names
|
| 86 |
+
(validName, Name.Variable),
|
| 87 |
+
|
| 88 |
+
# Parens
|
| 89 |
+
(r'[,()\[\]{}]', Punctuation),
|
| 90 |
+
|
| 91 |
+
],
|
| 92 |
+
|
| 93 |
+
'comment': [
|
| 94 |
+
(r'-(?!\})', Comment.Multiline),
|
| 95 |
+
(r'\{-', Comment.Multiline, 'comment'),
|
| 96 |
+
(r'[^-}]', Comment.Multiline),
|
| 97 |
+
(r'-\}', Comment.Multiline, '#pop'),
|
| 98 |
+
],
|
| 99 |
+
|
| 100 |
+
'doublequote': [
|
| 101 |
+
(r'\\u[0-9a-fA-F]{4}', String.Escape),
|
| 102 |
+
(r'\\[nrfvb\\"]', String.Escape),
|
| 103 |
+
(r'[^"]', String),
|
| 104 |
+
(r'"', String, '#pop'),
|
| 105 |
+
],
|
| 106 |
+
|
| 107 |
+
'imports': [
|
| 108 |
+
(r'\w+(\.\w+)*', Name.Class, '#pop'),
|
| 109 |
+
],
|
| 110 |
+
|
| 111 |
+
'numbers': [
|
| 112 |
+
(r'_?\d+\.(?=\d+)', Number.Float),
|
| 113 |
+
(r'_?\d+', Number.Integer),
|
| 114 |
+
],
|
| 115 |
+
|
| 116 |
+
'shader': [
|
| 117 |
+
(r'\|(?!\])', Name.Entity),
|
| 118 |
+
(r'\|\]', Name.Entity, '#pop'),
|
| 119 |
+
(r'.*\n', Name.Entity),
|
| 120 |
+
],
|
| 121 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/erlang.py
ADDED
|
@@ -0,0 +1,533 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.erlang
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for Erlang.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import Lexer, RegexLexer, bygroups, words, do_insertions, \
|
| 15 |
+
include, default
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Number, Punctuation, Generic
|
| 18 |
+
|
| 19 |
+
__all__ = ['ErlangLexer', 'ErlangShellLexer', 'ElixirConsoleLexer',
|
| 20 |
+
'ElixirLexer']
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
line_re = re.compile('.*?\n')
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class ErlangLexer(RegexLexer):
|
| 27 |
+
"""
|
| 28 |
+
For the Erlang functional programming language.
|
| 29 |
+
|
| 30 |
+
Blame Jeremy Thurgood (http://jerith.za.net/).
|
| 31 |
+
|
| 32 |
+
.. versionadded:: 0.9
|
| 33 |
+
"""
|
| 34 |
+
|
| 35 |
+
name = 'Erlang'
|
| 36 |
+
aliases = ['erlang']
|
| 37 |
+
filenames = ['*.erl', '*.hrl', '*.es', '*.escript']
|
| 38 |
+
mimetypes = ['text/x-erlang']
|
| 39 |
+
|
| 40 |
+
keywords = (
|
| 41 |
+
'after', 'begin', 'case', 'catch', 'cond', 'end', 'fun', 'if',
|
| 42 |
+
'let', 'of', 'query', 'receive', 'try', 'when',
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
builtins = ( # See erlang(3) man page
|
| 46 |
+
'abs', 'append_element', 'apply', 'atom_to_list', 'binary_to_list',
|
| 47 |
+
'bitstring_to_list', 'binary_to_term', 'bit_size', 'bump_reductions',
|
| 48 |
+
'byte_size', 'cancel_timer', 'check_process_code', 'delete_module',
|
| 49 |
+
'demonitor', 'disconnect_node', 'display', 'element', 'erase', 'exit',
|
| 50 |
+
'float', 'float_to_list', 'fun_info', 'fun_to_list',
|
| 51 |
+
'function_exported', 'garbage_collect', 'get', 'get_keys',
|
| 52 |
+
'group_leader', 'hash', 'hd', 'integer_to_list', 'iolist_to_binary',
|
| 53 |
+
'iolist_size', 'is_atom', 'is_binary', 'is_bitstring', 'is_boolean',
|
| 54 |
+
'is_builtin', 'is_float', 'is_function', 'is_integer', 'is_list',
|
| 55 |
+
'is_number', 'is_pid', 'is_port', 'is_process_alive', 'is_record',
|
| 56 |
+
'is_reference', 'is_tuple', 'length', 'link', 'list_to_atom',
|
| 57 |
+
'list_to_binary', 'list_to_bitstring', 'list_to_existing_atom',
|
| 58 |
+
'list_to_float', 'list_to_integer', 'list_to_pid', 'list_to_tuple',
|
| 59 |
+
'load_module', 'localtime_to_universaltime', 'make_tuple', 'md5',
|
| 60 |
+
'md5_final', 'md5_update', 'memory', 'module_loaded', 'monitor',
|
| 61 |
+
'monitor_node', 'node', 'nodes', 'open_port', 'phash', 'phash2',
|
| 62 |
+
'pid_to_list', 'port_close', 'port_command', 'port_connect',
|
| 63 |
+
'port_control', 'port_call', 'port_info', 'port_to_list',
|
| 64 |
+
'process_display', 'process_flag', 'process_info', 'purge_module',
|
| 65 |
+
'put', 'read_timer', 'ref_to_list', 'register', 'resume_process',
|
| 66 |
+
'round', 'send', 'send_after', 'send_nosuspend', 'set_cookie',
|
| 67 |
+
'setelement', 'size', 'spawn', 'spawn_link', 'spawn_monitor',
|
| 68 |
+
'spawn_opt', 'split_binary', 'start_timer', 'statistics',
|
| 69 |
+
'suspend_process', 'system_flag', 'system_info', 'system_monitor',
|
| 70 |
+
'system_profile', 'term_to_binary', 'tl', 'trace', 'trace_delivered',
|
| 71 |
+
'trace_info', 'trace_pattern', 'trunc', 'tuple_size', 'tuple_to_list',
|
| 72 |
+
'universaltime_to_localtime', 'unlink', 'unregister', 'whereis'
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
operators = r'(\+\+?|--?|\*|/|<|>|/=|=:=|=/=|=<|>=|==?|<-|!|\?)'
|
| 76 |
+
word_operators = (
|
| 77 |
+
'and', 'andalso', 'band', 'bnot', 'bor', 'bsl', 'bsr', 'bxor',
|
| 78 |
+
'div', 'not', 'or', 'orelse', 'rem', 'xor'
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
atom_re = r"(?:[a-z]\w*|'[^\n']*[^\\]')"
|
| 82 |
+
|
| 83 |
+
variable_re = r'(?:[A-Z_]\w*)'
|
| 84 |
+
|
| 85 |
+
esc_char_re = r'[bdefnrstv\'"\\]'
|
| 86 |
+
esc_octal_re = r'[0-7][0-7]?[0-7]?'
|
| 87 |
+
esc_hex_re = r'(?:x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\})'
|
| 88 |
+
esc_ctrl_re = r'\^[a-zA-Z]'
|
| 89 |
+
escape_re = r'(?:\\(?:'+esc_char_re+r'|'+esc_octal_re+r'|'+esc_hex_re+r'|'+esc_ctrl_re+r'))'
|
| 90 |
+
|
| 91 |
+
macro_re = r'(?:'+variable_re+r'|'+atom_re+r')'
|
| 92 |
+
|
| 93 |
+
base_re = r'(?:[2-9]|[12][0-9]|3[0-6])'
|
| 94 |
+
|
| 95 |
+
tokens = {
|
| 96 |
+
'root': [
|
| 97 |
+
(r'\s+', Text),
|
| 98 |
+
(r'%.*\n', Comment),
|
| 99 |
+
(words(keywords, suffix=r'\b'), Keyword),
|
| 100 |
+
(words(builtins, suffix=r'\b'), Name.Builtin),
|
| 101 |
+
(words(word_operators, suffix=r'\b'), Operator.Word),
|
| 102 |
+
(r'^-', Punctuation, 'directive'),
|
| 103 |
+
(operators, Operator),
|
| 104 |
+
(r'"', String, 'string'),
|
| 105 |
+
(r'<<', Name.Label),
|
| 106 |
+
(r'>>', Name.Label),
|
| 107 |
+
('(' + atom_re + ')(:)', bygroups(Name.Namespace, Punctuation)),
|
| 108 |
+
('(?:^|(?<=:))(' + atom_re + r')(\s*)(\()',
|
| 109 |
+
bygroups(Name.Function, Text, Punctuation)),
|
| 110 |
+
(r'[+-]?' + base_re + r'#[0-9a-zA-Z]+', Number.Integer),
|
| 111 |
+
(r'[+-]?\d+', Number.Integer),
|
| 112 |
+
(r'[+-]?\d+.\d+', Number.Float),
|
| 113 |
+
(r'[]\[:_@\".{}()|;,]', Punctuation),
|
| 114 |
+
(variable_re, Name.Variable),
|
| 115 |
+
(atom_re, Name),
|
| 116 |
+
(r'\?'+macro_re, Name.Constant),
|
| 117 |
+
(r'\$(?:'+escape_re+r'|\\[ %]|[^\\])', String.Char),
|
| 118 |
+
(r'#'+atom_re+r'(:?\.'+atom_re+r')?', Name.Label),
|
| 119 |
+
|
| 120 |
+
# Erlang script shebang
|
| 121 |
+
(r'\A#!.+\n', Comment.Hashbang),
|
| 122 |
+
|
| 123 |
+
# EEP 43: Maps
|
| 124 |
+
# http://www.erlang.org/eeps/eep-0043.html
|
| 125 |
+
(r'#\{', Punctuation, 'map_key'),
|
| 126 |
+
],
|
| 127 |
+
'string': [
|
| 128 |
+
(escape_re, String.Escape),
|
| 129 |
+
(r'"', String, '#pop'),
|
| 130 |
+
(r'~[0-9.*]*[~#+BPWXb-ginpswx]', String.Interpol),
|
| 131 |
+
(r'[^"\\~]+', String),
|
| 132 |
+
(r'~', String),
|
| 133 |
+
],
|
| 134 |
+
'directive': [
|
| 135 |
+
(r'(define)(\s*)(\()('+macro_re+r')',
|
| 136 |
+
bygroups(Name.Entity, Text, Punctuation, Name.Constant), '#pop'),
|
| 137 |
+
(r'(record)(\s*)(\()('+macro_re+r')',
|
| 138 |
+
bygroups(Name.Entity, Text, Punctuation, Name.Label), '#pop'),
|
| 139 |
+
(atom_re, Name.Entity, '#pop'),
|
| 140 |
+
],
|
| 141 |
+
'map_key': [
|
| 142 |
+
include('root'),
|
| 143 |
+
(r'=>', Punctuation, 'map_val'),
|
| 144 |
+
(r':=', Punctuation, 'map_val'),
|
| 145 |
+
(r'\}', Punctuation, '#pop'),
|
| 146 |
+
],
|
| 147 |
+
'map_val': [
|
| 148 |
+
include('root'),
|
| 149 |
+
(r',', Punctuation, '#pop'),
|
| 150 |
+
(r'(?=\})', Punctuation, '#pop'),
|
| 151 |
+
],
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
class ErlangShellLexer(Lexer):
|
| 156 |
+
"""
|
| 157 |
+
Shell sessions in erl (for Erlang code).
|
| 158 |
+
|
| 159 |
+
.. versionadded:: 1.1
|
| 160 |
+
"""
|
| 161 |
+
name = 'Erlang erl session'
|
| 162 |
+
aliases = ['erl']
|
| 163 |
+
filenames = ['*.erl-sh']
|
| 164 |
+
mimetypes = ['text/x-erl-shellsession']
|
| 165 |
+
|
| 166 |
+
_prompt_re = re.compile(r'\d+>(?=\s|\Z)')
|
| 167 |
+
|
| 168 |
+
def get_tokens_unprocessed(self, text):
|
| 169 |
+
erlexer = ErlangLexer(**self.options)
|
| 170 |
+
|
| 171 |
+
curcode = ''
|
| 172 |
+
insertions = []
|
| 173 |
+
for match in line_re.finditer(text):
|
| 174 |
+
line = match.group()
|
| 175 |
+
m = self._prompt_re.match(line)
|
| 176 |
+
if m is not None:
|
| 177 |
+
end = m.end()
|
| 178 |
+
insertions.append((len(curcode),
|
| 179 |
+
[(0, Generic.Prompt, line[:end])]))
|
| 180 |
+
curcode += line[end:]
|
| 181 |
+
else:
|
| 182 |
+
if curcode:
|
| 183 |
+
for item in do_insertions(insertions,
|
| 184 |
+
erlexer.get_tokens_unprocessed(curcode)):
|
| 185 |
+
yield item
|
| 186 |
+
curcode = ''
|
| 187 |
+
insertions = []
|
| 188 |
+
if line.startswith('*'):
|
| 189 |
+
yield match.start(), Generic.Traceback, line
|
| 190 |
+
else:
|
| 191 |
+
yield match.start(), Generic.Output, line
|
| 192 |
+
if curcode:
|
| 193 |
+
for item in do_insertions(insertions,
|
| 194 |
+
erlexer.get_tokens_unprocessed(curcode)):
|
| 195 |
+
yield item
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
def gen_elixir_string_rules(name, symbol, token):
|
| 199 |
+
states = {}
|
| 200 |
+
states['string_' + name] = [
|
| 201 |
+
(r'[^#%s\\]+' % (symbol,), token),
|
| 202 |
+
include('escapes'),
|
| 203 |
+
(r'\\.', token),
|
| 204 |
+
(r'(%s)' % (symbol,), bygroups(token), "#pop"),
|
| 205 |
+
include('interpol')
|
| 206 |
+
]
|
| 207 |
+
return states
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def gen_elixir_sigstr_rules(term, token, interpol=True):
|
| 211 |
+
if interpol:
|
| 212 |
+
return [
|
| 213 |
+
(r'[^#%s\\]+' % (term,), token),
|
| 214 |
+
include('escapes'),
|
| 215 |
+
(r'\\.', token),
|
| 216 |
+
(r'%s[a-zA-Z]*' % (term,), token, '#pop'),
|
| 217 |
+
include('interpol')
|
| 218 |
+
]
|
| 219 |
+
else:
|
| 220 |
+
return [
|
| 221 |
+
(r'[^%s\\]+' % (term,), token),
|
| 222 |
+
(r'\\.', token),
|
| 223 |
+
(r'%s[a-zA-Z]*' % (term,), token, '#pop'),
|
| 224 |
+
]
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
class ElixirLexer(RegexLexer):
|
| 228 |
+
"""
|
| 229 |
+
For the `Elixir language <http://elixir-lang.org>`_.
|
| 230 |
+
|
| 231 |
+
.. versionadded:: 1.5
|
| 232 |
+
"""
|
| 233 |
+
|
| 234 |
+
name = 'Elixir'
|
| 235 |
+
aliases = ['elixir', 'ex', 'exs']
|
| 236 |
+
filenames = ['*.ex', '*.exs']
|
| 237 |
+
mimetypes = ['text/x-elixir']
|
| 238 |
+
|
| 239 |
+
KEYWORD = ('fn', 'do', 'end', 'after', 'else', 'rescue', 'catch')
|
| 240 |
+
KEYWORD_OPERATOR = ('not', 'and', 'or', 'when', 'in')
|
| 241 |
+
BUILTIN = (
|
| 242 |
+
'case', 'cond', 'for', 'if', 'unless', 'try', 'receive', 'raise',
|
| 243 |
+
'quote', 'unquote', 'unquote_splicing', 'throw', 'super',
|
| 244 |
+
)
|
| 245 |
+
BUILTIN_DECLARATION = (
|
| 246 |
+
'def', 'defp', 'defmodule', 'defprotocol', 'defmacro', 'defmacrop',
|
| 247 |
+
'defdelegate', 'defexception', 'defstruct', 'defimpl', 'defcallback',
|
| 248 |
+
)
|
| 249 |
+
|
| 250 |
+
BUILTIN_NAMESPACE = ('import', 'require', 'use', 'alias')
|
| 251 |
+
CONSTANT = ('nil', 'true', 'false')
|
| 252 |
+
|
| 253 |
+
PSEUDO_VAR = ('_', '__MODULE__', '__DIR__', '__ENV__', '__CALLER__')
|
| 254 |
+
|
| 255 |
+
OPERATORS3 = (
|
| 256 |
+
'<<<', '>>>', '|||', '&&&', '^^^', '~~~', '===', '!==',
|
| 257 |
+
'~>>', '<~>', '|~>', '<|>',
|
| 258 |
+
)
|
| 259 |
+
OPERATORS2 = (
|
| 260 |
+
'==', '!=', '<=', '>=', '&&', '||', '<>', '++', '--', '|>', '=~',
|
| 261 |
+
'->', '<-', '|', '.', '=', '~>', '<~',
|
| 262 |
+
)
|
| 263 |
+
OPERATORS1 = ('<', '>', '+', '-', '*', '/', '!', '^', '&')
|
| 264 |
+
|
| 265 |
+
PUNCTUATION = (
|
| 266 |
+
'\\\\', '<<', '>>', '=>', '(', ')', ':', ';', ',', '[', ']',
|
| 267 |
+
)
|
| 268 |
+
|
| 269 |
+
def get_tokens_unprocessed(self, text):
|
| 270 |
+
for index, token, value in RegexLexer.get_tokens_unprocessed(self, text):
|
| 271 |
+
if token is Name:
|
| 272 |
+
if value in self.KEYWORD:
|
| 273 |
+
yield index, Keyword, value
|
| 274 |
+
elif value in self.KEYWORD_OPERATOR:
|
| 275 |
+
yield index, Operator.Word, value
|
| 276 |
+
elif value in self.BUILTIN:
|
| 277 |
+
yield index, Keyword, value
|
| 278 |
+
elif value in self.BUILTIN_DECLARATION:
|
| 279 |
+
yield index, Keyword.Declaration, value
|
| 280 |
+
elif value in self.BUILTIN_NAMESPACE:
|
| 281 |
+
yield index, Keyword.Namespace, value
|
| 282 |
+
elif value in self.CONSTANT:
|
| 283 |
+
yield index, Name.Constant, value
|
| 284 |
+
elif value in self.PSEUDO_VAR:
|
| 285 |
+
yield index, Name.Builtin.Pseudo, value
|
| 286 |
+
else:
|
| 287 |
+
yield index, token, value
|
| 288 |
+
else:
|
| 289 |
+
yield index, token, value
|
| 290 |
+
|
| 291 |
+
def gen_elixir_sigil_rules():
|
| 292 |
+
# all valid sigil terminators (excluding heredocs)
|
| 293 |
+
terminators = [
|
| 294 |
+
(r'\{', r'\}', 'cb'),
|
| 295 |
+
(r'\[', r'\]', 'sb'),
|
| 296 |
+
(r'\(', r'\)', 'pa'),
|
| 297 |
+
(r'<', r'>', 'ab'),
|
| 298 |
+
(r'/', r'/', 'slas'),
|
| 299 |
+
(r'\|', r'\|', 'pipe'),
|
| 300 |
+
('"', '"', 'quot'),
|
| 301 |
+
("'", "'", 'apos'),
|
| 302 |
+
]
|
| 303 |
+
|
| 304 |
+
# heredocs have slightly different rules
|
| 305 |
+
triquotes = [(r'"""', 'triquot'), (r"'''", 'triapos')]
|
| 306 |
+
|
| 307 |
+
token = String.Other
|
| 308 |
+
states = {'sigils': []}
|
| 309 |
+
|
| 310 |
+
for term, name in triquotes:
|
| 311 |
+
states['sigils'] += [
|
| 312 |
+
(r'(~[a-z])(%s)' % (term,), bygroups(token, String.Heredoc),
|
| 313 |
+
(name + '-end', name + '-intp')),
|
| 314 |
+
(r'(~[A-Z])(%s)' % (term,), bygroups(token, String.Heredoc),
|
| 315 |
+
(name + '-end', name + '-no-intp')),
|
| 316 |
+
]
|
| 317 |
+
|
| 318 |
+
states[name + '-end'] = [
|
| 319 |
+
(r'[a-zA-Z]+', token, '#pop'),
|
| 320 |
+
default('#pop'),
|
| 321 |
+
]
|
| 322 |
+
states[name + '-intp'] = [
|
| 323 |
+
(r'^\s*' + term, String.Heredoc, '#pop'),
|
| 324 |
+
include('heredoc_interpol'),
|
| 325 |
+
]
|
| 326 |
+
states[name + '-no-intp'] = [
|
| 327 |
+
(r'^\s*' + term, String.Heredoc, '#pop'),
|
| 328 |
+
include('heredoc_no_interpol'),
|
| 329 |
+
]
|
| 330 |
+
|
| 331 |
+
for lterm, rterm, name in terminators:
|
| 332 |
+
states['sigils'] += [
|
| 333 |
+
(r'~[a-z]' + lterm, token, name + '-intp'),
|
| 334 |
+
(r'~[A-Z]' + lterm, token, name + '-no-intp'),
|
| 335 |
+
]
|
| 336 |
+
states[name + '-intp'] = gen_elixir_sigstr_rules(rterm, token)
|
| 337 |
+
states[name + '-no-intp'] = \
|
| 338 |
+
gen_elixir_sigstr_rules(rterm, token, interpol=False)
|
| 339 |
+
|
| 340 |
+
return states
|
| 341 |
+
|
| 342 |
+
op3_re = "|".join(re.escape(s) for s in OPERATORS3)
|
| 343 |
+
op2_re = "|".join(re.escape(s) for s in OPERATORS2)
|
| 344 |
+
op1_re = "|".join(re.escape(s) for s in OPERATORS1)
|
| 345 |
+
ops_re = r'(?:%s|%s|%s)' % (op3_re, op2_re, op1_re)
|
| 346 |
+
punctuation_re = "|".join(re.escape(s) for s in PUNCTUATION)
|
| 347 |
+
alnum = '\w'
|
| 348 |
+
name_re = r'(?:\.\.\.|[a-z_]%s*[!?]?)' % alnum
|
| 349 |
+
modname_re = r'[A-Z]%(alnum)s*(?:\.[A-Z]%(alnum)s*)*' % {'alnum': alnum}
|
| 350 |
+
complex_name_re = r'(?:%s|%s|%s)' % (name_re, modname_re, ops_re)
|
| 351 |
+
special_atom_re = r'(?:\.\.\.|<<>>|%\{\}|%|\{\})'
|
| 352 |
+
|
| 353 |
+
long_hex_char_re = r'(\\x\{)([\da-fA-F]+)(\})'
|
| 354 |
+
hex_char_re = r'(\\x[\da-fA-F]{1,2})'
|
| 355 |
+
escape_char_re = r'(\\[abdefnrstv])'
|
| 356 |
+
|
| 357 |
+
tokens = {
|
| 358 |
+
'root': [
|
| 359 |
+
(r'\s+', Text),
|
| 360 |
+
(r'#.*$', Comment.Single),
|
| 361 |
+
|
| 362 |
+
# Various kinds of characters
|
| 363 |
+
(r'(\?)' + long_hex_char_re,
|
| 364 |
+
bygroups(String.Char,
|
| 365 |
+
String.Escape, Number.Hex, String.Escape)),
|
| 366 |
+
(r'(\?)' + hex_char_re,
|
| 367 |
+
bygroups(String.Char, String.Escape)),
|
| 368 |
+
(r'(\?)' + escape_char_re,
|
| 369 |
+
bygroups(String.Char, String.Escape)),
|
| 370 |
+
(r'\?\\?.', String.Char),
|
| 371 |
+
|
| 372 |
+
# '::' has to go before atoms
|
| 373 |
+
(r':::', String.Symbol),
|
| 374 |
+
(r'::', Operator),
|
| 375 |
+
|
| 376 |
+
# atoms
|
| 377 |
+
(r':' + special_atom_re, String.Symbol),
|
| 378 |
+
(r':' + complex_name_re, String.Symbol),
|
| 379 |
+
(r':"', String.Symbol, 'string_double_atom'),
|
| 380 |
+
(r":'", String.Symbol, 'string_single_atom'),
|
| 381 |
+
|
| 382 |
+
# [keywords: ...]
|
| 383 |
+
(r'(%s|%s)(:)(?=\s|\n)' % (special_atom_re, complex_name_re),
|
| 384 |
+
bygroups(String.Symbol, Punctuation)),
|
| 385 |
+
|
| 386 |
+
# @attributes
|
| 387 |
+
(r'@' + name_re, Name.Attribute),
|
| 388 |
+
|
| 389 |
+
# identifiers
|
| 390 |
+
(name_re, Name),
|
| 391 |
+
(r'(%%?)(%s)' % (modname_re,), bygroups(Punctuation, Name.Class)),
|
| 392 |
+
|
| 393 |
+
# operators and punctuation
|
| 394 |
+
(op3_re, Operator),
|
| 395 |
+
(op2_re, Operator),
|
| 396 |
+
(punctuation_re, Punctuation),
|
| 397 |
+
(r'&\d', Name.Entity), # anon func arguments
|
| 398 |
+
(op1_re, Operator),
|
| 399 |
+
|
| 400 |
+
# numbers
|
| 401 |
+
(r'0b[01]+', Number.Bin),
|
| 402 |
+
(r'0o[0-7]+', Number.Oct),
|
| 403 |
+
(r'0x[\da-fA-F]+', Number.Hex),
|
| 404 |
+
(r'\d(_?\d)*\.\d(_?\d)*([eE][-+]?\d(_?\d)*)?', Number.Float),
|
| 405 |
+
(r'\d(_?\d)*', Number.Integer),
|
| 406 |
+
|
| 407 |
+
# strings and heredocs
|
| 408 |
+
(r'"""\s*', String.Heredoc, 'heredoc_double'),
|
| 409 |
+
(r"'''\s*$", String.Heredoc, 'heredoc_single'),
|
| 410 |
+
(r'"', String.Double, 'string_double'),
|
| 411 |
+
(r"'", String.Single, 'string_single'),
|
| 412 |
+
|
| 413 |
+
include('sigils'),
|
| 414 |
+
|
| 415 |
+
(r'%\{', Punctuation, 'map_key'),
|
| 416 |
+
(r'\{', Punctuation, 'tuple'),
|
| 417 |
+
],
|
| 418 |
+
'heredoc_double': [
|
| 419 |
+
(r'^\s*"""', String.Heredoc, '#pop'),
|
| 420 |
+
include('heredoc_interpol'),
|
| 421 |
+
],
|
| 422 |
+
'heredoc_single': [
|
| 423 |
+
(r"^\s*'''", String.Heredoc, '#pop'),
|
| 424 |
+
include('heredoc_interpol'),
|
| 425 |
+
],
|
| 426 |
+
'heredoc_interpol': [
|
| 427 |
+
(r'[^#\\\n]+', String.Heredoc),
|
| 428 |
+
include('escapes'),
|
| 429 |
+
(r'\\.', String.Heredoc),
|
| 430 |
+
(r'\n+', String.Heredoc),
|
| 431 |
+
include('interpol'),
|
| 432 |
+
],
|
| 433 |
+
'heredoc_no_interpol': [
|
| 434 |
+
(r'[^\\\n]+', String.Heredoc),
|
| 435 |
+
(r'\\.', String.Heredoc),
|
| 436 |
+
(r'\n+', String.Heredoc),
|
| 437 |
+
],
|
| 438 |
+
'escapes': [
|
| 439 |
+
(long_hex_char_re,
|
| 440 |
+
bygroups(String.Escape, Number.Hex, String.Escape)),
|
| 441 |
+
(hex_char_re, String.Escape),
|
| 442 |
+
(escape_char_re, String.Escape),
|
| 443 |
+
],
|
| 444 |
+
'interpol': [
|
| 445 |
+
(r'#\{', String.Interpol, 'interpol_string'),
|
| 446 |
+
],
|
| 447 |
+
'interpol_string': [
|
| 448 |
+
(r'\}', String.Interpol, "#pop"),
|
| 449 |
+
include('root')
|
| 450 |
+
],
|
| 451 |
+
'map_key': [
|
| 452 |
+
include('root'),
|
| 453 |
+
(r':', Punctuation, 'map_val'),
|
| 454 |
+
(r'=>', Punctuation, 'map_val'),
|
| 455 |
+
(r'\}', Punctuation, '#pop'),
|
| 456 |
+
],
|
| 457 |
+
'map_val': [
|
| 458 |
+
include('root'),
|
| 459 |
+
(r',', Punctuation, '#pop'),
|
| 460 |
+
(r'(?=\})', Punctuation, '#pop'),
|
| 461 |
+
],
|
| 462 |
+
'tuple': [
|
| 463 |
+
include('root'),
|
| 464 |
+
(r'\}', Punctuation, '#pop'),
|
| 465 |
+
],
|
| 466 |
+
}
|
| 467 |
+
tokens.update(gen_elixir_string_rules('double', '"', String.Double))
|
| 468 |
+
tokens.update(gen_elixir_string_rules('single', "'", String.Single))
|
| 469 |
+
tokens.update(gen_elixir_string_rules('double_atom', '"', String.Symbol))
|
| 470 |
+
tokens.update(gen_elixir_string_rules('single_atom', "'", String.Symbol))
|
| 471 |
+
tokens.update(gen_elixir_sigil_rules())
|
| 472 |
+
|
| 473 |
+
|
| 474 |
+
class ElixirConsoleLexer(Lexer):
|
| 475 |
+
"""
|
| 476 |
+
For Elixir interactive console (iex) output like:
|
| 477 |
+
|
| 478 |
+
.. sourcecode:: iex
|
| 479 |
+
|
| 480 |
+
iex> [head | tail] = [1,2,3]
|
| 481 |
+
[1,2,3]
|
| 482 |
+
iex> head
|
| 483 |
+
1
|
| 484 |
+
iex> tail
|
| 485 |
+
[2,3]
|
| 486 |
+
iex> [head | tail]
|
| 487 |
+
[1,2,3]
|
| 488 |
+
iex> length [head | tail]
|
| 489 |
+
3
|
| 490 |
+
|
| 491 |
+
.. versionadded:: 1.5
|
| 492 |
+
"""
|
| 493 |
+
|
| 494 |
+
name = 'Elixir iex session'
|
| 495 |
+
aliases = ['iex']
|
| 496 |
+
mimetypes = ['text/x-elixir-shellsession']
|
| 497 |
+
|
| 498 |
+
_prompt_re = re.compile('(iex|\.{3})(\(\d+\))?> ')
|
| 499 |
+
|
| 500 |
+
def get_tokens_unprocessed(self, text):
|
| 501 |
+
exlexer = ElixirLexer(**self.options)
|
| 502 |
+
|
| 503 |
+
curcode = ''
|
| 504 |
+
in_error = False
|
| 505 |
+
insertions = []
|
| 506 |
+
for match in line_re.finditer(text):
|
| 507 |
+
line = match.group()
|
| 508 |
+
if line.startswith(u'** '):
|
| 509 |
+
in_error = True
|
| 510 |
+
insertions.append((len(curcode),
|
| 511 |
+
[(0, Generic.Error, line[:-1])]))
|
| 512 |
+
curcode += line[-1:]
|
| 513 |
+
else:
|
| 514 |
+
m = self._prompt_re.match(line)
|
| 515 |
+
if m is not None:
|
| 516 |
+
in_error = False
|
| 517 |
+
end = m.end()
|
| 518 |
+
insertions.append((len(curcode),
|
| 519 |
+
[(0, Generic.Prompt, line[:end])]))
|
| 520 |
+
curcode += line[end:]
|
| 521 |
+
else:
|
| 522 |
+
if curcode:
|
| 523 |
+
for item in do_insertions(
|
| 524 |
+
insertions, exlexer.get_tokens_unprocessed(curcode)):
|
| 525 |
+
yield item
|
| 526 |
+
curcode = ''
|
| 527 |
+
insertions = []
|
| 528 |
+
token = Generic.Error if in_error else Generic.Output
|
| 529 |
+
yield match.start(), token, line
|
| 530 |
+
if curcode:
|
| 531 |
+
for item in do_insertions(
|
| 532 |
+
insertions, exlexer.get_tokens_unprocessed(curcode)):
|
| 533 |
+
yield item
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/esoteric.py
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.esoteric
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for esoteric languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from pygments.lexer import RegexLexer, include, words
|
| 13 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 14 |
+
Number, Punctuation, Error
|
| 15 |
+
|
| 16 |
+
__all__ = ['BrainfuckLexer', 'BefungeLexer', 'RedcodeLexer', 'CAmkESLexer',
|
| 17 |
+
'CapDLLexer', 'AheuiLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class BrainfuckLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
Lexer for the esoteric `BrainFuck <http://www.muppetlabs.com/~breadbox/bf/>`_
|
| 23 |
+
language.
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
name = 'Brainfuck'
|
| 27 |
+
aliases = ['brainfuck', 'bf']
|
| 28 |
+
filenames = ['*.bf', '*.b']
|
| 29 |
+
mimetypes = ['application/x-brainfuck']
|
| 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 |
+
|
| 52 |
+
class BefungeLexer(RegexLexer):
|
| 53 |
+
"""
|
| 54 |
+
Lexer for the esoteric `Befunge <http://en.wikipedia.org/wiki/Befunge>`_
|
| 55 |
+
language.
|
| 56 |
+
|
| 57 |
+
.. versionadded:: 0.7
|
| 58 |
+
"""
|
| 59 |
+
name = 'Befunge'
|
| 60 |
+
aliases = ['befunge']
|
| 61 |
+
filenames = ['*.befunge']
|
| 62 |
+
mimetypes = ['application/x-befunge']
|
| 63 |
+
|
| 64 |
+
tokens = {
|
| 65 |
+
'root': [
|
| 66 |
+
(r'[0-9a-f]', Number),
|
| 67 |
+
(r'[+*/%!`-]', Operator), # Traditional math
|
| 68 |
+
(r'[<>^v?\[\]rxjk]', Name.Variable), # Move, imperatives
|
| 69 |
+
(r'[:\\$.,n]', Name.Builtin), # Stack ops, imperatives
|
| 70 |
+
(r'[|_mw]', Keyword),
|
| 71 |
+
(r'[{}]', Name.Tag), # Befunge-98 stack ops
|
| 72 |
+
(r'".*?"', String.Double), # Strings don't appear to allow escapes
|
| 73 |
+
(r'\'.', String.Single), # Single character
|
| 74 |
+
(r'[#;]', Comment), # Trampoline... depends on direction hit
|
| 75 |
+
(r'[pg&~=@iotsy]', Keyword), # Misc
|
| 76 |
+
(r'[()A-Z]', Comment), # Fingerprints
|
| 77 |
+
(r'\s+', Text), # Whitespace doesn't matter
|
| 78 |
+
],
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
class CAmkESLexer(RegexLexer):
|
| 83 |
+
"""
|
| 84 |
+
Basic lexer for the input language for the
|
| 85 |
+
`CAmkES <https://sel4.systems/CAmkES/>`_ component platform.
|
| 86 |
+
|
| 87 |
+
.. versionadded:: 2.1
|
| 88 |
+
"""
|
| 89 |
+
name = 'CAmkES'
|
| 90 |
+
aliases = ['camkes', 'idl4']
|
| 91 |
+
filenames = ['*.camkes', '*.idl4']
|
| 92 |
+
|
| 93 |
+
tokens = {
|
| 94 |
+
'root': [
|
| 95 |
+
# C pre-processor directive
|
| 96 |
+
(r'^\s*#.*\n', Comment.Preproc),
|
| 97 |
+
|
| 98 |
+
# Whitespace, comments
|
| 99 |
+
(r'\s+', Text),
|
| 100 |
+
(r'/\*(.|\n)*?\*/', Comment),
|
| 101 |
+
(r'//.*\n', Comment),
|
| 102 |
+
|
| 103 |
+
(r'[\[(){},.;\]]', Punctuation),
|
| 104 |
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
| 105 |
+
|
| 106 |
+
(words(('assembly', 'attribute', 'component', 'composition',
|
| 107 |
+
'configuration', 'connection', 'connector', 'consumes',
|
| 108 |
+
'control', 'dataport', 'Dataport', 'Dataports', 'emits',
|
| 109 |
+
'event', 'Event', 'Events', 'export', 'from', 'group',
|
| 110 |
+
'hardware', 'has', 'interface', 'Interface', 'maybe',
|
| 111 |
+
'procedure', 'Procedure', 'Procedures', 'provides',
|
| 112 |
+
'template', 'thread', 'threads', 'to', 'uses', 'with'),
|
| 113 |
+
suffix=r'\b'), Keyword),
|
| 114 |
+
|
| 115 |
+
(words(('bool', 'boolean', 'Buf', 'char', 'character', 'double',
|
| 116 |
+
'float', 'in', 'inout', 'int', 'int16_6', 'int32_t',
|
| 117 |
+
'int64_t', 'int8_t', 'integer', 'mutex', 'out', 'real',
|
| 118 |
+
'refin', 'semaphore', 'signed', 'string', 'struct',
|
| 119 |
+
'uint16_t', 'uint32_t', 'uint64_t', 'uint8_t', 'uintptr_t',
|
| 120 |
+
'unsigned', 'void'),
|
| 121 |
+
suffix=r'\b'), Keyword.Type),
|
| 122 |
+
|
| 123 |
+
# Recognised attributes
|
| 124 |
+
(r'[a-zA-Z_]\w*_(priority|domain|buffer)', Keyword.Reserved),
|
| 125 |
+
(words(('dma_pool', 'from_access', 'to_access'), suffix=r'\b'),
|
| 126 |
+
Keyword.Reserved),
|
| 127 |
+
|
| 128 |
+
# CAmkES-level include
|
| 129 |
+
(r'import\s+(<[^>]*>|"[^"]*");', Comment.Preproc),
|
| 130 |
+
|
| 131 |
+
# C-level include
|
| 132 |
+
(r'include\s+(<[^>]*>|"[^"]*");', Comment.Preproc),
|
| 133 |
+
|
| 134 |
+
# Literals
|
| 135 |
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
| 136 |
+
(r'-?[\d]+', Number),
|
| 137 |
+
(r'-?[\d]+\.[\d]+', Number.Float),
|
| 138 |
+
(r'"[^"]*"', String),
|
| 139 |
+
(r'[Tt]rue|[Ff]alse', Name.Builtin),
|
| 140 |
+
|
| 141 |
+
# Identifiers
|
| 142 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 143 |
+
],
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
class CapDLLexer(RegexLexer):
|
| 148 |
+
"""
|
| 149 |
+
Basic lexer for
|
| 150 |
+
`CapDL <https://ssrg.nicta.com.au/publications/nictaabstracts/Kuz_KLW_10.abstract.pml>`_.
|
| 151 |
+
|
| 152 |
+
The source of the primary tool that reads such specifications is available
|
| 153 |
+
at https://github.com/seL4/capdl/tree/master/capDL-tool. Note that this
|
| 154 |
+
lexer only supports a subset of the grammar. For example, identifiers can
|
| 155 |
+
shadow type names, but these instances are currently incorrectly
|
| 156 |
+
highlighted as types. Supporting this would need a stateful lexer that is
|
| 157 |
+
considered unnecessarily complex for now.
|
| 158 |
+
|
| 159 |
+
.. versionadded:: 2.2
|
| 160 |
+
"""
|
| 161 |
+
name = 'CapDL'
|
| 162 |
+
aliases = ['capdl']
|
| 163 |
+
filenames = ['*.cdl']
|
| 164 |
+
|
| 165 |
+
tokens = {
|
| 166 |
+
'root': [
|
| 167 |
+
# C pre-processor directive
|
| 168 |
+
(r'^\s*#.*\n', Comment.Preproc),
|
| 169 |
+
|
| 170 |
+
# Whitespace, comments
|
| 171 |
+
(r'\s+', Text),
|
| 172 |
+
(r'/\*(.|\n)*?\*/', Comment),
|
| 173 |
+
(r'(//|--).*\n', Comment),
|
| 174 |
+
|
| 175 |
+
(r'[<>\[(){},:;=\]]', Punctuation),
|
| 176 |
+
(r'\.\.', Punctuation),
|
| 177 |
+
|
| 178 |
+
(words(('arch', 'arm11', 'caps', 'child_of', 'ia32', 'irq', 'maps',
|
| 179 |
+
'objects'), suffix=r'\b'), Keyword),
|
| 180 |
+
|
| 181 |
+
(words(('aep', 'asid_pool', 'cnode', 'ep', 'frame', 'io_device',
|
| 182 |
+
'io_ports', 'io_pt', 'notification', 'pd', 'pt', 'tcb',
|
| 183 |
+
'ut', 'vcpu'), suffix=r'\b'), Keyword.Type),
|
| 184 |
+
|
| 185 |
+
# Properties
|
| 186 |
+
(words(('asid', 'addr', 'badge', 'cached', 'dom', 'domainID', 'elf',
|
| 187 |
+
'fault_ep', 'G', 'guard', 'guard_size', 'init', 'ip',
|
| 188 |
+
'prio', 'sp', 'R', 'RG', 'RX', 'RW', 'RWG', 'RWX', 'W',
|
| 189 |
+
'WG', 'WX', 'level', 'masked', 'master_reply', 'paddr',
|
| 190 |
+
'ports', 'reply', 'uncached'), suffix=r'\b'),
|
| 191 |
+
Keyword.Reserved),
|
| 192 |
+
|
| 193 |
+
# Literals
|
| 194 |
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
| 195 |
+
(r'\d+(\.\d+)?(k|M)?', Number),
|
| 196 |
+
(words(('bits',), suffix=r'\b'), Number),
|
| 197 |
+
(words(('cspace', 'vspace', 'reply_slot', 'caller_slot',
|
| 198 |
+
'ipc_buffer_slot'), suffix=r'\b'), Number),
|
| 199 |
+
|
| 200 |
+
# Identifiers
|
| 201 |
+
(r'[a-zA-Z_][-@\.\w]*', Name),
|
| 202 |
+
],
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
class RedcodeLexer(RegexLexer):
|
| 207 |
+
"""
|
| 208 |
+
A simple Redcode lexer based on ICWS'94.
|
| 209 |
+
Contributed by Adam Blinkinsop <blinks@acm.org>.
|
| 210 |
+
|
| 211 |
+
.. versionadded:: 0.8
|
| 212 |
+
"""
|
| 213 |
+
name = 'Redcode'
|
| 214 |
+
aliases = ['redcode']
|
| 215 |
+
filenames = ['*.cw']
|
| 216 |
+
|
| 217 |
+
opcodes = ('DAT', 'MOV', 'ADD', 'SUB', 'MUL', 'DIV', 'MOD',
|
| 218 |
+
'JMP', 'JMZ', 'JMN', 'DJN', 'CMP', 'SLT', 'SPL',
|
| 219 |
+
'ORG', 'EQU', 'END')
|
| 220 |
+
modifiers = ('A', 'B', 'AB', 'BA', 'F', 'X', 'I')
|
| 221 |
+
|
| 222 |
+
tokens = {
|
| 223 |
+
'root': [
|
| 224 |
+
# Whitespace:
|
| 225 |
+
(r'\s+', Text),
|
| 226 |
+
(r';.*$', Comment.Single),
|
| 227 |
+
# Lexemes:
|
| 228 |
+
# Identifiers
|
| 229 |
+
(r'\b(%s)\b' % '|'.join(opcodes), Name.Function),
|
| 230 |
+
(r'\b(%s)\b' % '|'.join(modifiers), Name.Decorator),
|
| 231 |
+
(r'[A-Za-z_]\w+', Name),
|
| 232 |
+
# Operators
|
| 233 |
+
(r'[-+*/%]', Operator),
|
| 234 |
+
(r'[#$@<>]', Operator), # mode
|
| 235 |
+
(r'[.,]', Punctuation), # mode
|
| 236 |
+
# Numbers
|
| 237 |
+
(r'[-+]?\d+', Number.Integer),
|
| 238 |
+
],
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
class AheuiLexer(RegexLexer):
|
| 243 |
+
"""
|
| 244 |
+
Aheui_ Lexer.
|
| 245 |
+
|
| 246 |
+
Aheui_ is esoteric language based on Korean alphabets.
|
| 247 |
+
|
| 248 |
+
.. _Aheui:: http://aheui.github.io/
|
| 249 |
+
|
| 250 |
+
"""
|
| 251 |
+
|
| 252 |
+
name = 'Aheui'
|
| 253 |
+
aliases = ['aheui']
|
| 254 |
+
filenames = ['*.aheui']
|
| 255 |
+
|
| 256 |
+
tokens = {
|
| 257 |
+
'root': [
|
| 258 |
+
(u'['
|
| 259 |
+
u'나-낳냐-냫너-넣녀-녛노-놓뇨-눟뉴-닇'
|
| 260 |
+
u'다-닿댜-댷더-덯뎌-뎧도-돟됴-둫듀-딓'
|
| 261 |
+
u'따-땋땨-떃떠-떻뗘-뗳또-똫뚀-뚷뜌-띟'
|
| 262 |
+
u'라-랗랴-럏러-렇려-렿로-롷료-뤃류-릫'
|
| 263 |
+
u'마-맣먀-먛머-멓며-몋모-뫃묘-뭏뮤-믷'
|
| 264 |
+
u'바-밯뱌-뱧버-벟벼-볗보-봏뵤-붛뷰-빃'
|
| 265 |
+
u'빠-빻뺘-뺳뻐-뻫뼈-뼣뽀-뽛뾰-뿧쀼-삏'
|
| 266 |
+
u'사-샇샤-샿서-섷셔-셯소-솧쇼-숳슈-싛'
|
| 267 |
+
u'싸-쌓쌰-썋써-쎃쎠-쎻쏘-쏳쑈-쑿쓔-씧'
|
| 268 |
+
u'자-잫쟈-쟣저-젛져-졓조-좋죠-줗쥬-즿'
|
| 269 |
+
u'차-챃챠-챻처-첳쳐-쳫초-촣쵸-춯츄-칗'
|
| 270 |
+
u'카-캏캬-컇커-컿켜-켷코-콯쿄-쿻큐-킣'
|
| 271 |
+
u'타-탛탸-턓터-텋텨-톃토-톻툐-퉇튜-틯'
|
| 272 |
+
u'파-팧퍄-퍟퍼-펗펴-폏포-퐇표-풓퓨-픻'
|
| 273 |
+
u'하-핳햐-햫허-헣혀-혛호-홓효-훟휴-힇'
|
| 274 |
+
u']', Operator),
|
| 275 |
+
('.', Comment),
|
| 276 |
+
],
|
| 277 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ezhil.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.ezhil
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Pygments lexers for Ezhil language.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
from pygments.lexer import RegexLexer, include, words
|
| 14 |
+
from pygments.token import Keyword, Text, Comment, Name
|
| 15 |
+
from pygments.token import String, Number, Punctuation, Operator
|
| 16 |
+
|
| 17 |
+
__all__ = ['EzhilLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class EzhilLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
Lexer for `Ezhil, a Tamil script-based programming language <http://ezhillang.org>`_
|
| 23 |
+
|
| 24 |
+
.. versionadded:: 2.1
|
| 25 |
+
"""
|
| 26 |
+
name = 'Ezhil'
|
| 27 |
+
aliases = ['ezhil']
|
| 28 |
+
filenames = ['*.n']
|
| 29 |
+
mimetypes = ['text/x-ezhil']
|
| 30 |
+
flags = re.MULTILINE | re.UNICODE
|
| 31 |
+
# Refer to tamil.utf8.tamil_letters from open-tamil for a stricter version of this.
|
| 32 |
+
# This much simpler version is close enough, and includes combining marks.
|
| 33 |
+
_TALETTERS = u'[a-zA-Z_]|[\u0b80-\u0bff]'
|
| 34 |
+
tokens = {
|
| 35 |
+
'root': [
|
| 36 |
+
include('keywords'),
|
| 37 |
+
(r'#.*\n', Comment.Single),
|
| 38 |
+
(r'[@+/*,^\-%]|[!<>=]=?|&&?|\|\|?', Operator),
|
| 39 |
+
(u'இல்', Operator.Word),
|
| 40 |
+
(words((u'assert', u'max', u'min',
|
| 41 |
+
u'நீளம்', u'சரம்_இடமாற்று', u'சரம்_கண்டுபிடி',
|
| 42 |
+
u'பட்டியல்', u'பின்இணை', u'வரிசைப்படுத்து',
|
| 43 |
+
u'எடு', u'தலைகீழ்', u'நீட்டிக்க', u'நுழைக்க', u'வை',
|
| 44 |
+
u'கோப்பை_திற', u'கோப்பை_எழுது', u'கோப்பை_மூடு',
|
| 45 |
+
u'pi', u'sin', u'cos', u'tan', u'sqrt', u'hypot', u'pow',
|
| 46 |
+
u'exp', u'log', u'log10', u'exit',
|
| 47 |
+
), suffix=r'\b'), Name.Builtin),
|
| 48 |
+
(r'(True|False)\b', Keyword.Constant),
|
| 49 |
+
(r'[^\S\n]+', Text),
|
| 50 |
+
include('identifier'),
|
| 51 |
+
include('literal'),
|
| 52 |
+
(r'[(){}\[\]:;.]', Punctuation),
|
| 53 |
+
],
|
| 54 |
+
'keywords': [
|
| 55 |
+
(u'பதிப்பி|தேர்ந்தெடு|தேர்வு|ஏதேனில்|ஆனால்|இல்லைஆனால்|இல்லை|ஆக|ஒவ்வொன்றாக|இல்|வரை|செய்|முடியேனில்|பின்கொடு|முடி|நிரல்பாகம்|தொடர்|நிறுத்து|நிரல்பாகம்', Keyword),
|
| 56 |
+
],
|
| 57 |
+
'identifier': [
|
| 58 |
+
(u'(?:'+_TALETTERS+u')(?:[0-9]|'+_TALETTERS+u')*', Name),
|
| 59 |
+
],
|
| 60 |
+
'literal': [
|
| 61 |
+
(r'".*?"', String),
|
| 62 |
+
(r'(?u)\d+((\.\d*)?[eE][+-]?\d+|\.\d*)', Number.Float),
|
| 63 |
+
(r'(?u)\d+', Number.Integer),
|
| 64 |
+
]
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
def __init__(self, **options):
|
| 68 |
+
super(EzhilLexer, self).__init__(**options)
|
| 69 |
+
self.encoding = options.get('encoding', 'utf-8')
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/factor.py
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.factor
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for the Factor language.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, bygroups, default, words
|
| 15 |
+
from pygments.token import Text, Comment, Keyword, Name, String, Number
|
| 16 |
+
|
| 17 |
+
__all__ = ['FactorLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class FactorLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
Lexer for the `Factor <http://factorcode.org>`_ language.
|
| 23 |
+
|
| 24 |
+
.. versionadded:: 1.4
|
| 25 |
+
"""
|
| 26 |
+
name = 'Factor'
|
| 27 |
+
aliases = ['factor']
|
| 28 |
+
filenames = ['*.factor']
|
| 29 |
+
mimetypes = ['text/x-factor']
|
| 30 |
+
|
| 31 |
+
flags = re.MULTILINE | re.UNICODE
|
| 32 |
+
|
| 33 |
+
builtin_kernel = words((
|
| 34 |
+
'-rot', '2bi', '2bi@', '2bi*', '2curry', '2dip', '2drop', '2dup', '2keep', '2nip',
|
| 35 |
+
'2over', '2tri', '2tri@', '2tri*', '3bi', '3curry', '3dip', '3drop', '3dup', '3keep',
|
| 36 |
+
'3tri', '4dip', '4drop', '4dup', '4keep', '<wrapper>', '=', '>boolean', 'clone',
|
| 37 |
+
'?', '?execute', '?if', 'and', 'assert', 'assert=', 'assert?', 'bi', 'bi-curry',
|
| 38 |
+
'bi-curry@', 'bi-curry*', 'bi@', 'bi*', 'boa', 'boolean', 'boolean?', 'both?',
|
| 39 |
+
'build', 'call', 'callstack', 'callstack>array', 'callstack?', 'clear', '(clone)',
|
| 40 |
+
'compose', 'compose?', 'curry', 'curry?', 'datastack', 'die', 'dip', 'do', 'drop',
|
| 41 |
+
'dup', 'dupd', 'either?', 'eq?', 'equal?', 'execute', 'hashcode', 'hashcode*',
|
| 42 |
+
'identity-hashcode', 'identity-tuple', 'identity-tuple?', 'if', 'if*',
|
| 43 |
+
'keep', 'loop', 'most', 'new', 'nip', 'not', 'null', 'object', 'or', 'over',
|
| 44 |
+
'pick', 'prepose', 'retainstack', 'rot', 'same?', 'swap', 'swapd', 'throw',
|
| 45 |
+
'tri', 'tri-curry', 'tri-curry@', 'tri-curry*', 'tri@', 'tri*', 'tuple',
|
| 46 |
+
'tuple?', 'unless', 'unless*', 'until', 'when', 'when*', 'while', 'with',
|
| 47 |
+
'wrapper', 'wrapper?', 'xor'), suffix=r'\s')
|
| 48 |
+
|
| 49 |
+
builtin_assocs = words((
|
| 50 |
+
'2cache', '<enum>', '>alist', '?at', '?of', 'assoc', 'assoc-all?',
|
| 51 |
+
'assoc-any?', 'assoc-clone-like', 'assoc-combine', 'assoc-diff',
|
| 52 |
+
'assoc-diff!', 'assoc-differ', 'assoc-each', 'assoc-empty?',
|
| 53 |
+
'assoc-filter', 'assoc-filter!', 'assoc-filter-as', 'assoc-find',
|
| 54 |
+
'assoc-hashcode', 'assoc-intersect', 'assoc-like', 'assoc-map',
|
| 55 |
+
'assoc-map-as', 'assoc-partition', 'assoc-refine', 'assoc-size',
|
| 56 |
+
'assoc-stack', 'assoc-subset?', 'assoc-union', 'assoc-union!',
|
| 57 |
+
'assoc=', 'assoc>map', 'assoc?', 'at', 'at+', 'at*', 'cache', 'change-at',
|
| 58 |
+
'clear-assoc', 'delete-at', 'delete-at*', 'enum', 'enum?', 'extract-keys',
|
| 59 |
+
'inc-at', 'key?', 'keys', 'map>assoc', 'maybe-set-at', 'new-assoc', 'of',
|
| 60 |
+
'push-at', 'rename-at', 'set-at', 'sift-keys', 'sift-values', 'substitute',
|
| 61 |
+
'unzip', 'value-at', 'value-at*', 'value?', 'values', 'zip'), suffix=r'\s')
|
| 62 |
+
|
| 63 |
+
builtin_combinators = words((
|
| 64 |
+
'2cleave', '2cleave>quot', '3cleave', '3cleave>quot', '4cleave',
|
| 65 |
+
'4cleave>quot', 'alist>quot', 'call-effect', 'case', 'case-find',
|
| 66 |
+
'case>quot', 'cleave', 'cleave>quot', 'cond', 'cond>quot', 'deep-spread>quot',
|
| 67 |
+
'execute-effect', 'linear-case-quot', 'no-case', 'no-case?', 'no-cond',
|
| 68 |
+
'no-cond?', 'recursive-hashcode', 'shallow-spread>quot', 'spread',
|
| 69 |
+
'to-fixed-point', 'wrong-values', 'wrong-values?'), suffix=r'\s')
|
| 70 |
+
|
| 71 |
+
builtin_math = words((
|
| 72 |
+
'-', '/', '/f', '/i', '/mod', '2/', '2^', '<', '<=', '<fp-nan>', '>',
|
| 73 |
+
'>=', '>bignum', '>fixnum', '>float', '>integer', '(all-integers?)',
|
| 74 |
+
'(each-integer)', '(find-integer)', '*', '+', '?1+',
|
| 75 |
+
'abs', 'align', 'all-integers?', 'bignum', 'bignum?', 'bit?', 'bitand',
|
| 76 |
+
'bitnot', 'bitor', 'bits>double', 'bits>float', 'bitxor', 'complex',
|
| 77 |
+
'complex?', 'denominator', 'double>bits', 'each-integer', 'even?',
|
| 78 |
+
'find-integer', 'find-last-integer', 'fixnum', 'fixnum?', 'float',
|
| 79 |
+
'float>bits', 'float?', 'fp-bitwise=', 'fp-infinity?', 'fp-nan-payload',
|
| 80 |
+
'fp-nan?', 'fp-qnan?', 'fp-sign', 'fp-snan?', 'fp-special?',
|
| 81 |
+
'if-zero', 'imaginary-part', 'integer', 'integer>fixnum',
|
| 82 |
+
'integer>fixnum-strict', 'integer?', 'log2', 'log2-expects-positive',
|
| 83 |
+
'log2-expects-positive?', 'mod', 'neg', 'neg?', 'next-float',
|
| 84 |
+
'next-power-of-2', 'number', 'number=', 'number?', 'numerator', 'odd?',
|
| 85 |
+
'out-of-fixnum-range', 'out-of-fixnum-range?', 'power-of-2?',
|
| 86 |
+
'prev-float', 'ratio', 'ratio?', 'rational', 'rational?', 'real',
|
| 87 |
+
'real-part', 'real?', 'recip', 'rem', 'sgn', 'shift', 'sq', 'times',
|
| 88 |
+
'u<', 'u<=', 'u>', 'u>=', 'unless-zero', 'unordered?', 'when-zero',
|
| 89 |
+
'zero?'), suffix=r'\s')
|
| 90 |
+
|
| 91 |
+
builtin_sequences = words((
|
| 92 |
+
'1sequence', '2all?', '2each', '2map', '2map-as', '2map-reduce', '2reduce',
|
| 93 |
+
'2selector', '2sequence', '3append', '3append-as', '3each', '3map', '3map-as',
|
| 94 |
+
'3sequence', '4sequence', '<repetition>', '<reversed>', '<slice>', '?first',
|
| 95 |
+
'?last', '?nth', '?second', '?set-nth', 'accumulate', 'accumulate!',
|
| 96 |
+
'accumulate-as', 'all?', 'any?', 'append', 'append!', 'append-as',
|
| 97 |
+
'assert-sequence', 'assert-sequence=', 'assert-sequence?',
|
| 98 |
+
'binary-reduce', 'bounds-check', 'bounds-check?', 'bounds-error',
|
| 99 |
+
'bounds-error?', 'but-last', 'but-last-slice', 'cartesian-each',
|
| 100 |
+
'cartesian-map', 'cartesian-product', 'change-nth', 'check-slice',
|
| 101 |
+
'check-slice-error', 'clone-like', 'collapse-slice', 'collector',
|
| 102 |
+
'collector-for', 'concat', 'concat-as', 'copy', 'count', 'cut', 'cut-slice',
|
| 103 |
+
'cut*', 'delete-all', 'delete-slice', 'drop-prefix', 'each', 'each-from',
|
| 104 |
+
'each-index', 'empty?', 'exchange', 'filter', 'filter!', 'filter-as', 'find',
|
| 105 |
+
'find-from', 'find-index', 'find-index-from', 'find-last', 'find-last-from',
|
| 106 |
+
'first', 'first2', 'first3', 'first4', 'flip', 'follow', 'fourth', 'glue', 'halves',
|
| 107 |
+
'harvest', 'head', 'head-slice', 'head-slice*', 'head*', 'head?',
|
| 108 |
+
'if-empty', 'immutable', 'immutable-sequence', 'immutable-sequence?',
|
| 109 |
+
'immutable?', 'index', 'index-from', 'indices', 'infimum', 'infimum-by',
|
| 110 |
+
'insert-nth', 'interleave', 'iota', 'iota-tuple', 'iota-tuple?', 'join',
|
| 111 |
+
'join-as', 'last', 'last-index', 'last-index-from', 'length', 'lengthen',
|
| 112 |
+
'like', 'longer', 'longer?', 'longest', 'map', 'map!', 'map-as', 'map-find',
|
| 113 |
+
'map-find-last', 'map-index', 'map-integers', 'map-reduce', 'map-sum',
|
| 114 |
+
'max-length', 'member-eq?', 'member?', 'midpoint@', 'min-length',
|
| 115 |
+
'mismatch', 'move', 'new-like', 'new-resizable', 'new-sequence',
|
| 116 |
+
'non-negative-integer-expected', 'non-negative-integer-expected?',
|
| 117 |
+
'nth', 'nths', 'pad-head', 'pad-tail', 'padding', 'partition', 'pop', 'pop*',
|
| 118 |
+
'prefix', 'prepend', 'prepend-as', 'produce', 'produce-as', 'product', 'push',
|
| 119 |
+
'push-all', 'push-either', 'push-if', 'reduce', 'reduce-index', 'remove',
|
| 120 |
+
'remove!', 'remove-eq', 'remove-eq!', 'remove-nth', 'remove-nth!', 'repetition',
|
| 121 |
+
'repetition?', 'replace-slice', 'replicate', 'replicate-as', 'rest',
|
| 122 |
+
'rest-slice', 'reverse', 'reverse!', 'reversed', 'reversed?', 'second',
|
| 123 |
+
'selector', 'selector-for', 'sequence', 'sequence-hashcode', 'sequence=',
|
| 124 |
+
'sequence?', 'set-first', 'set-fourth', 'set-last', 'set-length', 'set-nth',
|
| 125 |
+
'set-second', 'set-third', 'short', 'shorten', 'shorter', 'shorter?',
|
| 126 |
+
'shortest', 'sift', 'slice', 'slice-error', 'slice-error?', 'slice?',
|
| 127 |
+
'snip', 'snip-slice', 'start', 'start*', 'subseq', 'subseq?', 'suffix',
|
| 128 |
+
'suffix!', 'sum', 'sum-lengths', 'supremum', 'supremum-by', 'surround', 'tail',
|
| 129 |
+
'tail-slice', 'tail-slice*', 'tail*', 'tail?', 'third', 'trim',
|
| 130 |
+
'trim-head', 'trim-head-slice', 'trim-slice', 'trim-tail', 'trim-tail-slice',
|
| 131 |
+
'unclip', 'unclip-last', 'unclip-last-slice', 'unclip-slice', 'unless-empty',
|
| 132 |
+
'virtual-exemplar', 'virtual-sequence', 'virtual-sequence?', 'virtual@',
|
| 133 |
+
'when-empty'), suffix=r'\s')
|
| 134 |
+
|
| 135 |
+
builtin_namespaces = words((
|
| 136 |
+
'+@', 'change', 'change-global', 'counter', 'dec', 'get', 'get-global',
|
| 137 |
+
'global', 'inc', 'init-namespaces', 'initialize', 'is-global', 'make-assoc',
|
| 138 |
+
'namespace', 'namestack', 'off', 'on', 'set', 'set-global', 'set-namestack',
|
| 139 |
+
'toggle', 'with-global', 'with-scope', 'with-variable', 'with-variables'),
|
| 140 |
+
suffix=r'\s')
|
| 141 |
+
|
| 142 |
+
builtin_arrays = words((
|
| 143 |
+
'1array', '2array', '3array', '4array', '<array>', '>array', 'array',
|
| 144 |
+
'array?', 'pair', 'pair?', 'resize-array'), suffix=r'\s')
|
| 145 |
+
|
| 146 |
+
builtin_io = words((
|
| 147 |
+
'(each-stream-block-slice)', '(each-stream-block)',
|
| 148 |
+
'(stream-contents-by-block)', '(stream-contents-by-element)',
|
| 149 |
+
'(stream-contents-by-length-or-block)',
|
| 150 |
+
'(stream-contents-by-length)', '+byte+', '+character+',
|
| 151 |
+
'bad-seek-type', 'bad-seek-type?', 'bl', 'contents', 'each-block',
|
| 152 |
+
'each-block-size', 'each-block-slice', 'each-line', 'each-morsel',
|
| 153 |
+
'each-stream-block', 'each-stream-block-slice', 'each-stream-line',
|
| 154 |
+
'error-stream', 'flush', 'input-stream', 'input-stream?',
|
| 155 |
+
'invalid-read-buffer', 'invalid-read-buffer?', 'lines', 'nl',
|
| 156 |
+
'output-stream', 'output-stream?', 'print', 'read', 'read-into',
|
| 157 |
+
'read-partial', 'read-partial-into', 'read-until', 'read1', 'readln',
|
| 158 |
+
'seek-absolute', 'seek-absolute?', 'seek-end', 'seek-end?',
|
| 159 |
+
'seek-input', 'seek-output', 'seek-relative', 'seek-relative?',
|
| 160 |
+
'stream-bl', 'stream-contents', 'stream-contents*', 'stream-copy',
|
| 161 |
+
'stream-copy*', 'stream-element-type', 'stream-flush',
|
| 162 |
+
'stream-length', 'stream-lines', 'stream-nl', 'stream-print',
|
| 163 |
+
'stream-read', 'stream-read-into', 'stream-read-partial',
|
| 164 |
+
'stream-read-partial-into', 'stream-read-partial-unsafe',
|
| 165 |
+
'stream-read-unsafe', 'stream-read-until', 'stream-read1',
|
| 166 |
+
'stream-readln', 'stream-seek', 'stream-seekable?', 'stream-tell',
|
| 167 |
+
'stream-write', 'stream-write1', 'tell-input', 'tell-output',
|
| 168 |
+
'with-error-stream', 'with-error-stream*', 'with-error>output',
|
| 169 |
+
'with-input-output+error-streams',
|
| 170 |
+
'with-input-output+error-streams*', 'with-input-stream',
|
| 171 |
+
'with-input-stream*', 'with-output-stream', 'with-output-stream*',
|
| 172 |
+
'with-output>error', 'with-output+error-stream',
|
| 173 |
+
'with-output+error-stream*', 'with-streams', 'with-streams*',
|
| 174 |
+
'write', 'write1'), suffix=r'\s')
|
| 175 |
+
|
| 176 |
+
builtin_strings = words((
|
| 177 |
+
'1string', '<string>', '>string', 'resize-string', 'string',
|
| 178 |
+
'string?'), suffix=r'\s')
|
| 179 |
+
|
| 180 |
+
builtin_vectors = words((
|
| 181 |
+
'1vector', '<vector>', '>vector', '?push', 'vector', 'vector?'),
|
| 182 |
+
suffix=r'\s')
|
| 183 |
+
|
| 184 |
+
builtin_continuations = words((
|
| 185 |
+
'<condition>', '<continuation>', '<restart>', 'attempt-all',
|
| 186 |
+
'attempt-all-error', 'attempt-all-error?', 'callback-error-hook',
|
| 187 |
+
'callcc0', 'callcc1', 'cleanup', 'compute-restarts', 'condition',
|
| 188 |
+
'condition?', 'continuation', 'continuation?', 'continue',
|
| 189 |
+
'continue-restart', 'continue-with', 'current-continuation',
|
| 190 |
+
'error', 'error-continuation', 'error-in-thread', 'error-thread',
|
| 191 |
+
'ifcc', 'ignore-errors', 'in-callback?', 'original-error', 'recover',
|
| 192 |
+
'restart', 'restart?', 'restarts', 'rethrow', 'rethrow-restarts',
|
| 193 |
+
'return', 'return-continuation', 'thread-error-hook', 'throw-continue',
|
| 194 |
+
'throw-restarts', 'with-datastack', 'with-return'), suffix=r'\s')
|
| 195 |
+
|
| 196 |
+
tokens = {
|
| 197 |
+
'root': [
|
| 198 |
+
# factor allows a file to start with a shebang
|
| 199 |
+
(r'#!.*$', Comment.Preproc),
|
| 200 |
+
default('base'),
|
| 201 |
+
],
|
| 202 |
+
'base': [
|
| 203 |
+
(r'\s+', Text),
|
| 204 |
+
|
| 205 |
+
# defining words
|
| 206 |
+
(r'((?:MACRO|MEMO|TYPED)?:[:]?)(\s+)(\S+)',
|
| 207 |
+
bygroups(Keyword, Text, Name.Function)),
|
| 208 |
+
(r'(M:[:]?)(\s+)(\S+)(\s+)(\S+)',
|
| 209 |
+
bygroups(Keyword, Text, Name.Class, Text, Name.Function)),
|
| 210 |
+
(r'(C:)(\s+)(\S+)(\s+)(\S+)',
|
| 211 |
+
bygroups(Keyword, Text, Name.Function, Text, Name.Class)),
|
| 212 |
+
(r'(GENERIC:)(\s+)(\S+)',
|
| 213 |
+
bygroups(Keyword, Text, Name.Function)),
|
| 214 |
+
(r'(HOOK:|GENERIC#)(\s+)(\S+)(\s+)(\S+)',
|
| 215 |
+
bygroups(Keyword, Text, Name.Function, Text, Name.Function)),
|
| 216 |
+
(r'\(\s', Name.Function, 'stackeffect'),
|
| 217 |
+
(r';\s', Keyword),
|
| 218 |
+
|
| 219 |
+
# imports and namespaces
|
| 220 |
+
(r'(USING:)(\s+)',
|
| 221 |
+
bygroups(Keyword.Namespace, Text), 'vocabs'),
|
| 222 |
+
(r'(USE:|UNUSE:|IN:|QUALIFIED:)(\s+)(\S+)',
|
| 223 |
+
bygroups(Keyword.Namespace, Text, Name.Namespace)),
|
| 224 |
+
(r'(QUALIFIED-WITH:)(\s+)(\S+)(\s+)(\S+)',
|
| 225 |
+
bygroups(Keyword.Namespace, Text, Name.Namespace, Text, Name.Namespace)),
|
| 226 |
+
(r'(FROM:|EXCLUDE:)(\s+)(\S+)(\s+=>\s)',
|
| 227 |
+
bygroups(Keyword.Namespace, Text, Name.Namespace, Text), 'words'),
|
| 228 |
+
(r'(RENAME:)(\s+)(\S+)(\s+)(\S+)(\s+=>\s+)(\S+)',
|
| 229 |
+
bygroups(Keyword.Namespace, Text, Name.Function, Text, Name.Namespace, Text, Name.Function)),
|
| 230 |
+
(r'(ALIAS:|TYPEDEF:)(\s+)(\S+)(\s+)(\S+)',
|
| 231 |
+
bygroups(Keyword.Namespace, Text, Name.Function, Text, Name.Function)),
|
| 232 |
+
(r'(DEFER:|FORGET:|POSTPONE:)(\s+)(\S+)',
|
| 233 |
+
bygroups(Keyword.Namespace, Text, Name.Function)),
|
| 234 |
+
|
| 235 |
+
# tuples and classes
|
| 236 |
+
(r'(TUPLE:|ERROR:)(\s+)(\S+)(\s+<\s+)(\S+)',
|
| 237 |
+
bygroups(Keyword, Text, Name.Class, Text, Name.Class), 'slots'),
|
| 238 |
+
(r'(TUPLE:|ERROR:|BUILTIN:)(\s+)(\S+)',
|
| 239 |
+
bygroups(Keyword, Text, Name.Class), 'slots'),
|
| 240 |
+
(r'(MIXIN:|UNION:|INTERSECTION:)(\s+)(\S+)',
|
| 241 |
+
bygroups(Keyword, Text, Name.Class)),
|
| 242 |
+
(r'(PREDICATE:)(\s+)(\S+)(\s+<\s+)(\S+)',
|
| 243 |
+
bygroups(Keyword, Text, Name.Class, Text, Name.Class)),
|
| 244 |
+
(r'(C:)(\s+)(\S+)(\s+)(\S+)',
|
| 245 |
+
bygroups(Keyword, Text, Name.Function, Text, Name.Class)),
|
| 246 |
+
(r'(INSTANCE:)(\s+)(\S+)(\s+)(\S+)',
|
| 247 |
+
bygroups(Keyword, Text, Name.Class, Text, Name.Class)),
|
| 248 |
+
(r'(SLOT:)(\s+)(\S+)', bygroups(Keyword, Text, Name.Function)),
|
| 249 |
+
(r'(SINGLETON:)(\s+)(\S+)', bygroups(Keyword, Text, Name.Class)),
|
| 250 |
+
(r'SINGLETONS:', Keyword, 'classes'),
|
| 251 |
+
|
| 252 |
+
# other syntax
|
| 253 |
+
(r'(CONSTANT:|SYMBOL:|MAIN:|HELP:)(\s+)(\S+)',
|
| 254 |
+
bygroups(Keyword, Text, Name.Function)),
|
| 255 |
+
(r'SYMBOLS:\s', Keyword, 'words'),
|
| 256 |
+
(r'SYNTAX:\s', Keyword),
|
| 257 |
+
(r'ALIEN:\s', Keyword),
|
| 258 |
+
(r'(STRUCT:)(\s+)(\S+)', bygroups(Keyword, Text, Name.Class)),
|
| 259 |
+
(r'(FUNCTION:)(\s+\S+\s+)(\S+)(\s+\(\s+[^)]+\)\s)',
|
| 260 |
+
bygroups(Keyword.Namespace, Text, Name.Function, Text)),
|
| 261 |
+
(r'(FUNCTION-ALIAS:)(\s+)(\S+)(\s+\S+\s+)(\S+)(\s+\(\s+[^)]+\)\s)',
|
| 262 |
+
bygroups(Keyword.Namespace, Text, Name.Function, Text, Name.Function, Text)),
|
| 263 |
+
|
| 264 |
+
# vocab.private
|
| 265 |
+
(r'(?:<PRIVATE|PRIVATE>)\s', Keyword.Namespace),
|
| 266 |
+
|
| 267 |
+
# strings
|
| 268 |
+
(r'"""\s+(?:.|\n)*?\s+"""', String),
|
| 269 |
+
(r'"(?:\\\\|\\"|[^"])*"', String),
|
| 270 |
+
(r'\S+"\s+(?:\\\\|\\"|[^"])*"', String),
|
| 271 |
+
(r'CHAR:\s+(?:\\[\\abfnrstv]|[^\\]\S*)\s', String.Char),
|
| 272 |
+
|
| 273 |
+
# comments
|
| 274 |
+
(r'!\s+.*$', Comment),
|
| 275 |
+
(r'#!\s+.*$', Comment),
|
| 276 |
+
(r'/\*\s+(?:.|\n)*?\s\*/\s', Comment),
|
| 277 |
+
|
| 278 |
+
# boolean constants
|
| 279 |
+
(r'[tf]\s', Name.Constant),
|
| 280 |
+
|
| 281 |
+
# symbols and literals
|
| 282 |
+
(r'[\\$]\s+\S+', Name.Constant),
|
| 283 |
+
(r'M\\\s+\S+\s+\S+', Name.Constant),
|
| 284 |
+
|
| 285 |
+
# numbers
|
| 286 |
+
(r'[+-]?(?:[\d,]*\d)?\.(?:\d([\d,]*\d)?)?(?:[eE][+-]?\d+)?\s', Number),
|
| 287 |
+
(r'[+-]?\d(?:[\d,]*\d)?(?:[eE][+-]?\d+)?\s', Number),
|
| 288 |
+
(r'0x[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s', Number),
|
| 289 |
+
(r'NAN:\s+[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s', Number),
|
| 290 |
+
(r'0b[01]+\s', Number.Bin),
|
| 291 |
+
(r'0o[0-7]+\s', Number.Oct),
|
| 292 |
+
(r'(?:\d([\d,]*\d)?)?\+\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s', Number),
|
| 293 |
+
(r'(?:\-\d([\d,]*\d)?)?\-\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s', Number),
|
| 294 |
+
|
| 295 |
+
# keywords
|
| 296 |
+
(r'(?:deprecated|final|foldable|flushable|inline|recursive)\s',
|
| 297 |
+
Keyword),
|
| 298 |
+
|
| 299 |
+
# builtins
|
| 300 |
+
(builtin_kernel, Name.Builtin),
|
| 301 |
+
(builtin_assocs, Name.Builtin),
|
| 302 |
+
(builtin_combinators, Name.Builtin),
|
| 303 |
+
(builtin_math, Name.Builtin),
|
| 304 |
+
(builtin_sequences, Name.Builtin),
|
| 305 |
+
(builtin_namespaces, Name.Builtin),
|
| 306 |
+
(builtin_arrays, Name.Builtin),
|
| 307 |
+
(builtin_io, Name.Builtin),
|
| 308 |
+
(builtin_strings, Name.Builtin),
|
| 309 |
+
(builtin_vectors, Name.Builtin),
|
| 310 |
+
(builtin_continuations, Name.Builtin),
|
| 311 |
+
|
| 312 |
+
# everything else is text
|
| 313 |
+
(r'\S+', Text),
|
| 314 |
+
],
|
| 315 |
+
'stackeffect': [
|
| 316 |
+
(r'\s+', Text),
|
| 317 |
+
(r'\(\s+', Name.Function, 'stackeffect'),
|
| 318 |
+
(r'\)\s', Name.Function, '#pop'),
|
| 319 |
+
(r'--\s', Name.Function),
|
| 320 |
+
(r'\S+', Name.Variable),
|
| 321 |
+
],
|
| 322 |
+
'slots': [
|
| 323 |
+
(r'\s+', Text),
|
| 324 |
+
(r';\s', Keyword, '#pop'),
|
| 325 |
+
(r'(\{\s+)(\S+)(\s+[^}]+\s+\}\s)',
|
| 326 |
+
bygroups(Text, Name.Variable, Text)),
|
| 327 |
+
(r'\S+', Name.Variable),
|
| 328 |
+
],
|
| 329 |
+
'vocabs': [
|
| 330 |
+
(r'\s+', Text),
|
| 331 |
+
(r';\s', Keyword, '#pop'),
|
| 332 |
+
(r'\S+', Name.Namespace),
|
| 333 |
+
],
|
| 334 |
+
'classes': [
|
| 335 |
+
(r'\s+', Text),
|
| 336 |
+
(r';\s', Keyword, '#pop'),
|
| 337 |
+
(r'\S+', Name.Class),
|
| 338 |
+
],
|
| 339 |
+
'words': [
|
| 340 |
+
(r'\s+', Text),
|
| 341 |
+
(r';\s', Keyword, '#pop'),
|
| 342 |
+
(r'\S+', Name.Function),
|
| 343 |
+
],
|
| 344 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/fantom.py
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.fantom
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexer for the Fantom language.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from string import Template
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, include, bygroups, using, \
|
| 15 |
+
this, default, words
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Number, Punctuation, Literal
|
| 18 |
+
|
| 19 |
+
__all__ = ['FantomLexer']
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class FantomLexer(RegexLexer):
|
| 23 |
+
"""
|
| 24 |
+
For Fantom source code.
|
| 25 |
+
|
| 26 |
+
.. versionadded:: 1.5
|
| 27 |
+
"""
|
| 28 |
+
name = 'Fantom'
|
| 29 |
+
aliases = ['fan']
|
| 30 |
+
filenames = ['*.fan']
|
| 31 |
+
mimetypes = ['application/x-fantom']
|
| 32 |
+
|
| 33 |
+
# often used regexes
|
| 34 |
+
def s(str):
|
| 35 |
+
return Template(str).substitute(
|
| 36 |
+
dict(
|
| 37 |
+
pod=r'[\"\w\.]+',
|
| 38 |
+
eos=r'\n|;',
|
| 39 |
+
id=r'[a-zA-Z_]\w*',
|
| 40 |
+
# all chars which can be part of type definition. Starts with
|
| 41 |
+
# either letter, or [ (maps), or | (funcs)
|
| 42 |
+
type=r'(?:\[|[a-zA-Z_]|\|)[:\w\[\]|\->?]*?',
|
| 43 |
+
)
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
tokens = {
|
| 47 |
+
'comments': [
|
| 48 |
+
(r'(?s)/\*.*?\*/', Comment.Multiline), # Multiline
|
| 49 |
+
(r'//.*?\n', Comment.Single), # Single line
|
| 50 |
+
# TODO: highlight references in fandocs
|
| 51 |
+
(r'\*\*.*?\n', Comment.Special), # Fandoc
|
| 52 |
+
(r'#.*\n', Comment.Single) # Shell-style
|
| 53 |
+
],
|
| 54 |
+
'literals': [
|
| 55 |
+
(r'\b-?[\d_]+(ns|ms|sec|min|hr|day)', Number), # Duration
|
| 56 |
+
(r'\b-?[\d_]*\.[\d_]+(ns|ms|sec|min|hr|day)', Number), # Duration with dot
|
| 57 |
+
(r'\b-?(\d+)?\.\d+(f|F|d|D)?', Number.Float), # Float/Decimal
|
| 58 |
+
(r'\b-?0x[0-9a-fA-F_]+', Number.Hex), # Hex
|
| 59 |
+
(r'\b-?[\d_]+', Number.Integer), # Int
|
| 60 |
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char), # Char
|
| 61 |
+
(r'"', Punctuation, 'insideStr'), # Opening quote
|
| 62 |
+
(r'`', Punctuation, 'insideUri'), # Opening accent
|
| 63 |
+
(r'\b(true|false|null)\b', Keyword.Constant), # Bool & null
|
| 64 |
+
(r'(?:(\w+)(::))?(\w+)(<\|)(.*?)(\|>)', # DSL
|
| 65 |
+
bygroups(Name.Namespace, Punctuation, Name.Class,
|
| 66 |
+
Punctuation, String, Punctuation)),
|
| 67 |
+
(r'(?:(\w+)(::))?(\w+)?(#)(\w+)?', # Type/slot literal
|
| 68 |
+
bygroups(Name.Namespace, Punctuation, Name.Class,
|
| 69 |
+
Punctuation, Name.Function)),
|
| 70 |
+
(r'\[,\]', Literal), # Empty list
|
| 71 |
+
(s(r'($type)(\[,\])'), # Typed empty list
|
| 72 |
+
bygroups(using(this, state='inType'), Literal)),
|
| 73 |
+
(r'\[:\]', Literal), # Empty Map
|
| 74 |
+
(s(r'($type)(\[:\])'),
|
| 75 |
+
bygroups(using(this, state='inType'), Literal)),
|
| 76 |
+
],
|
| 77 |
+
'insideStr': [
|
| 78 |
+
(r'\\\\', String.Escape), # Escaped backslash
|
| 79 |
+
(r'\\"', String.Escape), # Escaped "
|
| 80 |
+
(r'\\`', String.Escape), # Escaped `
|
| 81 |
+
(r'\$\w+', String.Interpol), # Subst var
|
| 82 |
+
(r'\$\{.*?\}', String.Interpol), # Subst expr
|
| 83 |
+
(r'"', Punctuation, '#pop'), # Closing quot
|
| 84 |
+
(r'.', String) # String content
|
| 85 |
+
],
|
| 86 |
+
'insideUri': [ # TODO: remove copy/paste str/uri
|
| 87 |
+
(r'\\\\', String.Escape), # Escaped backslash
|
| 88 |
+
(r'\\"', String.Escape), # Escaped "
|
| 89 |
+
(r'\\`', String.Escape), # Escaped `
|
| 90 |
+
(r'\$\w+', String.Interpol), # Subst var
|
| 91 |
+
(r'\$\{.*?\}', String.Interpol), # Subst expr
|
| 92 |
+
(r'`', Punctuation, '#pop'), # Closing tick
|
| 93 |
+
(r'.', String.Backtick) # URI content
|
| 94 |
+
],
|
| 95 |
+
'protectionKeywords': [
|
| 96 |
+
(r'\b(public|protected|private|internal)\b', Keyword),
|
| 97 |
+
],
|
| 98 |
+
'typeKeywords': [
|
| 99 |
+
(r'\b(abstract|final|const|native|facet|enum)\b', Keyword),
|
| 100 |
+
],
|
| 101 |
+
'methodKeywords': [
|
| 102 |
+
(r'\b(abstract|native|once|override|static|virtual|final)\b',
|
| 103 |
+
Keyword),
|
| 104 |
+
],
|
| 105 |
+
'fieldKeywords': [
|
| 106 |
+
(r'\b(abstract|const|final|native|override|static|virtual|'
|
| 107 |
+
r'readonly)\b', Keyword)
|
| 108 |
+
],
|
| 109 |
+
'otherKeywords': [
|
| 110 |
+
(words((
|
| 111 |
+
'try', 'catch', 'throw', 'finally', 'for', 'if', 'else', 'while',
|
| 112 |
+
'as', 'is', 'isnot', 'switch', 'case', 'default', 'continue',
|
| 113 |
+
'break', 'do', 'return', 'get', 'set'), prefix=r'\b', suffix=r'\b'),
|
| 114 |
+
Keyword),
|
| 115 |
+
(r'\b(it|this|super)\b', Name.Builtin.Pseudo),
|
| 116 |
+
],
|
| 117 |
+
'operators': [
|
| 118 |
+
(r'\+\+|\-\-|\+|\-|\*|/|\|\||&&|<=>|<=|<|>=|>|=|!|\[|\]', Operator)
|
| 119 |
+
],
|
| 120 |
+
'inType': [
|
| 121 |
+
(r'[\[\]|\->:?]', Punctuation),
|
| 122 |
+
(s(r'$id'), Name.Class),
|
| 123 |
+
default('#pop'),
|
| 124 |
+
|
| 125 |
+
],
|
| 126 |
+
'root': [
|
| 127 |
+
include('comments'),
|
| 128 |
+
include('protectionKeywords'),
|
| 129 |
+
include('typeKeywords'),
|
| 130 |
+
include('methodKeywords'),
|
| 131 |
+
include('fieldKeywords'),
|
| 132 |
+
include('literals'),
|
| 133 |
+
include('otherKeywords'),
|
| 134 |
+
include('operators'),
|
| 135 |
+
(r'using\b', Keyword.Namespace, 'using'), # Using stmt
|
| 136 |
+
(r'@\w+', Name.Decorator, 'facet'), # Symbol
|
| 137 |
+
(r'(class|mixin)(\s+)(\w+)', bygroups(Keyword, Text, Name.Class),
|
| 138 |
+
'inheritance'), # Inheritance list
|
| 139 |
+
|
| 140 |
+
# Type var := val
|
| 141 |
+
(s(r'($type)([ \t]+)($id)(\s*)(:=)'),
|
| 142 |
+
bygroups(using(this, state='inType'), Text,
|
| 143 |
+
Name.Variable, Text, Operator)),
|
| 144 |
+
|
| 145 |
+
# var := val
|
| 146 |
+
(s(r'($id)(\s*)(:=)'),
|
| 147 |
+
bygroups(Name.Variable, Text, Operator)),
|
| 148 |
+
|
| 149 |
+
# .someId( or ->someId( ###
|
| 150 |
+
(s(r'(\.|(?:\->))($id)(\s*)(\()'),
|
| 151 |
+
bygroups(Operator, Name.Function, Text, Punctuation),
|
| 152 |
+
'insideParen'),
|
| 153 |
+
|
| 154 |
+
# .someId or ->someId
|
| 155 |
+
(s(r'(\.|(?:\->))($id)'),
|
| 156 |
+
bygroups(Operator, Name.Function)),
|
| 157 |
+
|
| 158 |
+
# new makeXXX (
|
| 159 |
+
(r'(new)(\s+)(make\w*)(\s*)(\()',
|
| 160 |
+
bygroups(Keyword, Text, Name.Function, Text, Punctuation),
|
| 161 |
+
'insideMethodDeclArgs'),
|
| 162 |
+
|
| 163 |
+
# Type name (
|
| 164 |
+
(s(r'($type)([ \t]+)' # Return type and whitespace
|
| 165 |
+
r'($id)(\s*)(\()'), # method name + open brace
|
| 166 |
+
bygroups(using(this, state='inType'), Text,
|
| 167 |
+
Name.Function, Text, Punctuation),
|
| 168 |
+
'insideMethodDeclArgs'),
|
| 169 |
+
|
| 170 |
+
# ArgType argName,
|
| 171 |
+
(s(r'($type)(\s+)($id)(\s*)(,)'),
|
| 172 |
+
bygroups(using(this, state='inType'), Text, Name.Variable,
|
| 173 |
+
Text, Punctuation)),
|
| 174 |
+
|
| 175 |
+
# ArgType argName)
|
| 176 |
+
# Covered in 'insideParen' state
|
| 177 |
+
|
| 178 |
+
# ArgType argName -> ArgType|
|
| 179 |
+
(s(r'($type)(\s+)($id)(\s*)(\->)(\s*)($type)(\|)'),
|
| 180 |
+
bygroups(using(this, state='inType'), Text, Name.Variable,
|
| 181 |
+
Text, Punctuation, Text, using(this, state='inType'),
|
| 182 |
+
Punctuation)),
|
| 183 |
+
|
| 184 |
+
# ArgType argName|
|
| 185 |
+
(s(r'($type)(\s+)($id)(\s*)(\|)'),
|
| 186 |
+
bygroups(using(this, state='inType'), Text, Name.Variable,
|
| 187 |
+
Text, Punctuation)),
|
| 188 |
+
|
| 189 |
+
# Type var
|
| 190 |
+
(s(r'($type)([ \t]+)($id)'),
|
| 191 |
+
bygroups(using(this, state='inType'), Text,
|
| 192 |
+
Name.Variable)),
|
| 193 |
+
|
| 194 |
+
(r'\(', Punctuation, 'insideParen'),
|
| 195 |
+
(r'\{', Punctuation, 'insideBrace'),
|
| 196 |
+
(r'.', Text)
|
| 197 |
+
],
|
| 198 |
+
'insideParen': [
|
| 199 |
+
(r'\)', Punctuation, '#pop'),
|
| 200 |
+
include('root'),
|
| 201 |
+
],
|
| 202 |
+
'insideMethodDeclArgs': [
|
| 203 |
+
(r'\)', Punctuation, '#pop'),
|
| 204 |
+
(s(r'($type)(\s+)($id)(\s*)(\))'),
|
| 205 |
+
bygroups(using(this, state='inType'), Text, Name.Variable,
|
| 206 |
+
Text, Punctuation), '#pop'),
|
| 207 |
+
include('root'),
|
| 208 |
+
],
|
| 209 |
+
'insideBrace': [
|
| 210 |
+
(r'\}', Punctuation, '#pop'),
|
| 211 |
+
include('root'),
|
| 212 |
+
],
|
| 213 |
+
'inheritance': [
|
| 214 |
+
(r'\s+', Text), # Whitespace
|
| 215 |
+
(r':|,', Punctuation),
|
| 216 |
+
(r'(?:(\w+)(::))?(\w+)',
|
| 217 |
+
bygroups(Name.Namespace, Punctuation, Name.Class)),
|
| 218 |
+
(r'\{', Punctuation, '#pop')
|
| 219 |
+
],
|
| 220 |
+
'using': [
|
| 221 |
+
(r'[ \t]+', Text), # consume whitespaces
|
| 222 |
+
(r'(\[)(\w+)(\])',
|
| 223 |
+
bygroups(Punctuation, Comment.Special, Punctuation)), # ffi
|
| 224 |
+
(r'(\")?([\w.]+)(\")?',
|
| 225 |
+
bygroups(Punctuation, Name.Namespace, Punctuation)), # podname
|
| 226 |
+
(r'::', Punctuation, 'usingClass'),
|
| 227 |
+
default('#pop')
|
| 228 |
+
],
|
| 229 |
+
'usingClass': [
|
| 230 |
+
(r'[ \t]+', Text), # consume whitespaces
|
| 231 |
+
(r'(as)(\s+)(\w+)',
|
| 232 |
+
bygroups(Keyword.Declaration, Text, Name.Class), '#pop:2'),
|
| 233 |
+
(r'[\w$]+', Name.Class),
|
| 234 |
+
default('#pop:2') # jump out to root state
|
| 235 |
+
],
|
| 236 |
+
'facet': [
|
| 237 |
+
(r'\s+', Text),
|
| 238 |
+
(r'\{', Punctuation, 'facetFields'),
|
| 239 |
+
default('#pop')
|
| 240 |
+
],
|
| 241 |
+
'facetFields': [
|
| 242 |
+
include('comments'),
|
| 243 |
+
include('literals'),
|
| 244 |
+
include('operators'),
|
| 245 |
+
(r'\s+', Text),
|
| 246 |
+
(r'(\s*)(\w+)(\s*)(=)', bygroups(Text, Name, Text, Operator)),
|
| 247 |
+
(r'\}', Punctuation, '#pop'),
|
| 248 |
+
(r'.', Text)
|
| 249 |
+
],
|
| 250 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/felix.py
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.felix
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexer for the Felix language.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from pygments.lexer import RegexLexer, include, bygroups, default, words, \
|
| 13 |
+
combined
|
| 14 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 15 |
+
Number, Punctuation
|
| 16 |
+
|
| 17 |
+
__all__ = ['FelixLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class FelixLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
For `Felix <http://www.felix-lang.org>`_ source code.
|
| 23 |
+
|
| 24 |
+
.. versionadded:: 1.2
|
| 25 |
+
"""
|
| 26 |
+
|
| 27 |
+
name = 'Felix'
|
| 28 |
+
aliases = ['felix', 'flx']
|
| 29 |
+
filenames = ['*.flx', '*.flxh']
|
| 30 |
+
mimetypes = ['text/x-felix']
|
| 31 |
+
|
| 32 |
+
preproc = (
|
| 33 |
+
'elif', 'else', 'endif', 'if', 'ifdef', 'ifndef',
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
keywords = (
|
| 37 |
+
'_', '_deref', 'all', 'as',
|
| 38 |
+
'assert', 'attempt', 'call', 'callback', 'case', 'caseno', 'cclass',
|
| 39 |
+
'code', 'compound', 'ctypes', 'do', 'done', 'downto', 'elif', 'else',
|
| 40 |
+
'endattempt', 'endcase', 'endif', 'endmatch', 'enum', 'except',
|
| 41 |
+
'exceptions', 'expect', 'finally', 'for', 'forall', 'forget', 'fork',
|
| 42 |
+
'functor', 'goto', 'ident', 'if', 'incomplete', 'inherit', 'instance',
|
| 43 |
+
'interface', 'jump', 'lambda', 'loop', 'match', 'module', 'namespace',
|
| 44 |
+
'new', 'noexpand', 'nonterm', 'obj', 'of', 'open', 'parse', 'raise',
|
| 45 |
+
'regexp', 'reglex', 'regmatch', 'rename', 'return', 'the', 'then',
|
| 46 |
+
'to', 'type', 'typecase', 'typedef', 'typematch', 'typeof', 'upto',
|
| 47 |
+
'when', 'whilst', 'with', 'yield',
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
keyword_directives = (
|
| 51 |
+
'_gc_pointer', '_gc_type', 'body', 'comment', 'const', 'export',
|
| 52 |
+
'header', 'inline', 'lval', 'macro', 'noinline', 'noreturn',
|
| 53 |
+
'package', 'private', 'pod', 'property', 'public', 'publish',
|
| 54 |
+
'requires', 'todo', 'virtual', 'use',
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
keyword_declarations = (
|
| 58 |
+
'def', 'let', 'ref', 'val', 'var',
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
keyword_types = (
|
| 62 |
+
'unit', 'void', 'any', 'bool',
|
| 63 |
+
'byte', 'offset',
|
| 64 |
+
'address', 'caddress', 'cvaddress', 'vaddress',
|
| 65 |
+
'tiny', 'short', 'int', 'long', 'vlong',
|
| 66 |
+
'utiny', 'ushort', 'vshort', 'uint', 'ulong', 'uvlong',
|
| 67 |
+
'int8', 'int16', 'int32', 'int64',
|
| 68 |
+
'uint8', 'uint16', 'uint32', 'uint64',
|
| 69 |
+
'float', 'double', 'ldouble',
|
| 70 |
+
'complex', 'dcomplex', 'lcomplex',
|
| 71 |
+
'imaginary', 'dimaginary', 'limaginary',
|
| 72 |
+
'char', 'wchar', 'uchar',
|
| 73 |
+
'charp', 'charcp', 'ucharp', 'ucharcp',
|
| 74 |
+
'string', 'wstring', 'ustring',
|
| 75 |
+
'cont',
|
| 76 |
+
'array', 'varray', 'list',
|
| 77 |
+
'lvalue', 'opt', 'slice',
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
keyword_constants = (
|
| 81 |
+
'false', 'true',
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
operator_words = (
|
| 85 |
+
'and', 'not', 'in', 'is', 'isin', 'or', 'xor',
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
name_builtins = (
|
| 89 |
+
'_svc', 'while',
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
name_pseudo = (
|
| 93 |
+
'root', 'self', 'this',
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
decimal_suffixes = '([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?'
|
| 97 |
+
|
| 98 |
+
tokens = {
|
| 99 |
+
'root': [
|
| 100 |
+
include('whitespace'),
|
| 101 |
+
|
| 102 |
+
# Keywords
|
| 103 |
+
(words(('axiom', 'ctor', 'fun', 'gen', 'proc', 'reduce',
|
| 104 |
+
'union'), suffix=r'\b'),
|
| 105 |
+
Keyword, 'funcname'),
|
| 106 |
+
(words(('class', 'cclass', 'cstruct', 'obj', 'struct'), suffix=r'\b'),
|
| 107 |
+
Keyword, 'classname'),
|
| 108 |
+
(r'(instance|module|typeclass)\b', Keyword, 'modulename'),
|
| 109 |
+
|
| 110 |
+
(words(keywords, suffix=r'\b'), Keyword),
|
| 111 |
+
(words(keyword_directives, suffix=r'\b'), Name.Decorator),
|
| 112 |
+
(words(keyword_declarations, suffix=r'\b'), Keyword.Declaration),
|
| 113 |
+
(words(keyword_types, suffix=r'\b'), Keyword.Type),
|
| 114 |
+
(words(keyword_constants, suffix=r'\b'), Keyword.Constant),
|
| 115 |
+
|
| 116 |
+
# Operators
|
| 117 |
+
include('operators'),
|
| 118 |
+
|
| 119 |
+
# Float Literal
|
| 120 |
+
# -- Hex Float
|
| 121 |
+
(r'0[xX]([0-9a-fA-F_]*\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)'
|
| 122 |
+
r'[pP][+\-]?[0-9_]+[lLfFdD]?', Number.Float),
|
| 123 |
+
# -- DecimalFloat
|
| 124 |
+
(r'[0-9_]+(\.[0-9_]+[eE][+\-]?[0-9_]+|'
|
| 125 |
+
r'\.[0-9_]*|[eE][+\-]?[0-9_]+)[lLfFdD]?', Number.Float),
|
| 126 |
+
(r'\.(0|[1-9][0-9_]*)([eE][+\-]?[0-9_]+)?[lLfFdD]?',
|
| 127 |
+
Number.Float),
|
| 128 |
+
|
| 129 |
+
# IntegerLiteral
|
| 130 |
+
# -- Binary
|
| 131 |
+
(r'0[Bb][01_]+%s' % decimal_suffixes, Number.Bin),
|
| 132 |
+
# -- Octal
|
| 133 |
+
(r'0[0-7_]+%s' % decimal_suffixes, Number.Oct),
|
| 134 |
+
# -- Hexadecimal
|
| 135 |
+
(r'0[xX][0-9a-fA-F_]+%s' % decimal_suffixes, Number.Hex),
|
| 136 |
+
# -- Decimal
|
| 137 |
+
(r'(0|[1-9][0-9_]*)%s' % decimal_suffixes, Number.Integer),
|
| 138 |
+
|
| 139 |
+
# Strings
|
| 140 |
+
('([rR][cC]?|[cC][rR])"""', String, 'tdqs'),
|
| 141 |
+
("([rR][cC]?|[cC][rR])'''", String, 'tsqs'),
|
| 142 |
+
('([rR][cC]?|[cC][rR])"', String, 'dqs'),
|
| 143 |
+
("([rR][cC]?|[cC][rR])'", String, 'sqs'),
|
| 144 |
+
('[cCfFqQwWuU]?"""', String, combined('stringescape', 'tdqs')),
|
| 145 |
+
("[cCfFqQwWuU]?'''", String, combined('stringescape', 'tsqs')),
|
| 146 |
+
('[cCfFqQwWuU]?"', String, combined('stringescape', 'dqs')),
|
| 147 |
+
("[cCfFqQwWuU]?'", String, combined('stringescape', 'sqs')),
|
| 148 |
+
|
| 149 |
+
# Punctuation
|
| 150 |
+
(r'[\[\]{}:(),;?]', Punctuation),
|
| 151 |
+
|
| 152 |
+
# Labels
|
| 153 |
+
(r'[a-zA-Z_]\w*:>', Name.Label),
|
| 154 |
+
|
| 155 |
+
# Identifiers
|
| 156 |
+
(r'(%s)\b' % '|'.join(name_builtins), Name.Builtin),
|
| 157 |
+
(r'(%s)\b' % '|'.join(name_pseudo), Name.Builtin.Pseudo),
|
| 158 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 159 |
+
],
|
| 160 |
+
'whitespace': [
|
| 161 |
+
(r'\n', Text),
|
| 162 |
+
(r'\s+', Text),
|
| 163 |
+
|
| 164 |
+
include('comment'),
|
| 165 |
+
|
| 166 |
+
# Preprocessor
|
| 167 |
+
(r'#\s*if\s+0', Comment.Preproc, 'if0'),
|
| 168 |
+
(r'#', Comment.Preproc, 'macro'),
|
| 169 |
+
],
|
| 170 |
+
'operators': [
|
| 171 |
+
(r'(%s)\b' % '|'.join(operator_words), Operator.Word),
|
| 172 |
+
(r'!=|==|<<|>>|\|\||&&|[-~+/*%=<>&^|.$]', Operator),
|
| 173 |
+
],
|
| 174 |
+
'comment': [
|
| 175 |
+
(r'//(.*?)\n', Comment.Single),
|
| 176 |
+
(r'/[*]', Comment.Multiline, 'comment2'),
|
| 177 |
+
],
|
| 178 |
+
'comment2': [
|
| 179 |
+
(r'[^/*]', Comment.Multiline),
|
| 180 |
+
(r'/[*]', Comment.Multiline, '#push'),
|
| 181 |
+
(r'[*]/', Comment.Multiline, '#pop'),
|
| 182 |
+
(r'[/*]', Comment.Multiline),
|
| 183 |
+
],
|
| 184 |
+
'if0': [
|
| 185 |
+
(r'^\s*#if.*?(?<!\\)\n', Comment, '#push'),
|
| 186 |
+
(r'^\s*#endif.*?(?<!\\)\n', Comment, '#pop'),
|
| 187 |
+
(r'.*?\n', Comment),
|
| 188 |
+
],
|
| 189 |
+
'macro': [
|
| 190 |
+
include('comment'),
|
| 191 |
+
(r'(import|include)(\s+)(<[^>]*?>)',
|
| 192 |
+
bygroups(Comment.Preproc, Text, String), '#pop'),
|
| 193 |
+
(r'(import|include)(\s+)("[^"]*?")',
|
| 194 |
+
bygroups(Comment.Preproc, Text, String), '#pop'),
|
| 195 |
+
(r"(import|include)(\s+)('[^']*?')",
|
| 196 |
+
bygroups(Comment.Preproc, Text, String), '#pop'),
|
| 197 |
+
(r'[^/\n]+', Comment.Preproc),
|
| 198 |
+
# (r'/[*](.|\n)*?[*]/', Comment),
|
| 199 |
+
# (r'//.*?\n', Comment, '#pop'),
|
| 200 |
+
(r'/', Comment.Preproc),
|
| 201 |
+
(r'(?<=\\)\n', Comment.Preproc),
|
| 202 |
+
(r'\n', Comment.Preproc, '#pop'),
|
| 203 |
+
],
|
| 204 |
+
'funcname': [
|
| 205 |
+
include('whitespace'),
|
| 206 |
+
(r'[a-zA-Z_]\w*', Name.Function, '#pop'),
|
| 207 |
+
# anonymous functions
|
| 208 |
+
(r'(?=\()', Text, '#pop'),
|
| 209 |
+
],
|
| 210 |
+
'classname': [
|
| 211 |
+
include('whitespace'),
|
| 212 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop'),
|
| 213 |
+
# anonymous classes
|
| 214 |
+
(r'(?=\{)', Text, '#pop'),
|
| 215 |
+
],
|
| 216 |
+
'modulename': [
|
| 217 |
+
include('whitespace'),
|
| 218 |
+
(r'\[', Punctuation, ('modulename2', 'tvarlist')),
|
| 219 |
+
default('modulename2'),
|
| 220 |
+
],
|
| 221 |
+
'modulename2': [
|
| 222 |
+
include('whitespace'),
|
| 223 |
+
(r'([a-zA-Z_]\w*)', Name.Namespace, '#pop:2'),
|
| 224 |
+
],
|
| 225 |
+
'tvarlist': [
|
| 226 |
+
include('whitespace'),
|
| 227 |
+
include('operators'),
|
| 228 |
+
(r'\[', Punctuation, '#push'),
|
| 229 |
+
(r'\]', Punctuation, '#pop'),
|
| 230 |
+
(r',', Punctuation),
|
| 231 |
+
(r'(with|where)\b', Keyword),
|
| 232 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 233 |
+
],
|
| 234 |
+
'stringescape': [
|
| 235 |
+
(r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
|
| 236 |
+
r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
|
| 237 |
+
],
|
| 238 |
+
'strings': [
|
| 239 |
+
(r'%(\([a-zA-Z0-9]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
|
| 240 |
+
'[hlL]?[E-GXc-giorsux%]', String.Interpol),
|
| 241 |
+
(r'[^\\\'"%\n]+', String),
|
| 242 |
+
# quotes, percents and backslashes must be parsed one at a time
|
| 243 |
+
(r'[\'"\\]', String),
|
| 244 |
+
# unhandled string formatting sign
|
| 245 |
+
(r'%', String)
|
| 246 |
+
# newlines are an error (use "nl" state)
|
| 247 |
+
],
|
| 248 |
+
'nl': [
|
| 249 |
+
(r'\n', String)
|
| 250 |
+
],
|
| 251 |
+
'dqs': [
|
| 252 |
+
(r'"', String, '#pop'),
|
| 253 |
+
# included here again for raw strings
|
| 254 |
+
(r'\\\\|\\"|\\\n', String.Escape),
|
| 255 |
+
include('strings')
|
| 256 |
+
],
|
| 257 |
+
'sqs': [
|
| 258 |
+
(r"'", String, '#pop'),
|
| 259 |
+
# included here again for raw strings
|
| 260 |
+
(r"\\\\|\\'|\\\n", String.Escape),
|
| 261 |
+
include('strings')
|
| 262 |
+
],
|
| 263 |
+
'tdqs': [
|
| 264 |
+
(r'"""', String, '#pop'),
|
| 265 |
+
include('strings'),
|
| 266 |
+
include('nl')
|
| 267 |
+
],
|
| 268 |
+
'tsqs': [
|
| 269 |
+
(r"'''", String, '#pop'),
|
| 270 |
+
include('strings'),
|
| 271 |
+
include('nl')
|
| 272 |
+
],
|
| 273 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/forth.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.forth
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 7 |
+
:license: BSD, see LICENSE for details.
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import re
|
| 11 |
+
|
| 12 |
+
from pygments.lexer import RegexLexer, include, bygroups
|
| 13 |
+
from pygments.token import Error, Punctuation, Literal, Token, \
|
| 14 |
+
Text, Comment, Operator, Keyword, Name, String, Number, Generic
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
__all__ = ['ForthLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class ForthLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
Lexer for Forth files.
|
| 23 |
+
|
| 24 |
+
.. versionadded:: 2.2
|
| 25 |
+
"""
|
| 26 |
+
name = 'Forth'
|
| 27 |
+
aliases = ['forth']
|
| 28 |
+
filenames = ['*.frt', '*.fs']
|
| 29 |
+
mimetypes = ['application/x-forth']
|
| 30 |
+
|
| 31 |
+
delimiter = r'\s'
|
| 32 |
+
delimiter_end = r'(?=[%s])' % delimiter
|
| 33 |
+
|
| 34 |
+
valid_name_chars = r'[^%s]' % delimiter
|
| 35 |
+
valid_name = r"%s+%s" % (valid_name_chars, delimiter_end)
|
| 36 |
+
|
| 37 |
+
flags = re.IGNORECASE | re.MULTILINE
|
| 38 |
+
|
| 39 |
+
tokens = {
|
| 40 |
+
'root': [
|
| 41 |
+
(r'\s+', Text),
|
| 42 |
+
# All comment types
|
| 43 |
+
(r'\\.*?\n', Comment.Single),
|
| 44 |
+
(r'\([\s].*?\)', Comment.Single),
|
| 45 |
+
# defining words. The next word is a new command name
|
| 46 |
+
(r'(:|variable|constant|value|buffer:)(\s+)',
|
| 47 |
+
bygroups(Keyword.Namespace, Text), 'worddef'),
|
| 48 |
+
# strings are rather simple
|
| 49 |
+
(r'([.sc]")(\s+?)', bygroups(String, Text), 'stringdef'),
|
| 50 |
+
# keywords from the various wordsets
|
| 51 |
+
# *** Wordset BLOCK
|
| 52 |
+
(r'(blk|block|buffer|evaluate|flush|load|save-buffers|update|'
|
| 53 |
+
# *** Wordset BLOCK-EXT
|
| 54 |
+
r'empty-buffers|list|refill|scr|thru|'
|
| 55 |
+
# *** Wordset CORE
|
| 56 |
+
r'\#s|\*\/mod|\+loop|\/mod|0<|0=|1\+|1-|2!|'
|
| 57 |
+
r'2\*|2\/|2@|2drop|2dup|2over|2swap|>body|'
|
| 58 |
+
r'>in|>number|>r|\?dup|abort|abort\"|abs|'
|
| 59 |
+
r'accept|align|aligned|allot|and|base|begin|'
|
| 60 |
+
r'bl|c!|c,|c@|cell\+|cells|char|char\+|'
|
| 61 |
+
r'chars|constant|count|cr|create|decimal|'
|
| 62 |
+
r'depth|do|does>|drop|dup|else|emit|environment\?|'
|
| 63 |
+
r'evaluate|execute|exit|fill|find|fm\/mod|'
|
| 64 |
+
r'here|hold|i|if|immediate|invert|j|key|'
|
| 65 |
+
r'leave|literal|loop|lshift|m\*|max|min|'
|
| 66 |
+
r'mod|move|negate|or|over|postpone|quit|'
|
| 67 |
+
r'r>|r@|recurse|repeat|rot|rshift|s\"|s>d|'
|
| 68 |
+
r'sign|sm\/rem|source|space|spaces|state|swap|'
|
| 69 |
+
r'then|type|u\.|u\<|um\*|um\/mod|unloop|until|'
|
| 70 |
+
r'variable|while|word|xor|\[char\]|\[\'\]|'
|
| 71 |
+
r'@|!|\#|<\#|\#>|:|;|\+|-|\*|\/|,|<|>|\|1\+|1-|\.|'
|
| 72 |
+
# *** Wordset CORE-EXT
|
| 73 |
+
r'\.r|0<>|'
|
| 74 |
+
r'0>|2>r|2r>|2r@|:noname|\?do|again|c\"|'
|
| 75 |
+
r'case|compile,|endcase|endof|erase|false|'
|
| 76 |
+
r'hex|marker|nip|of|pad|parse|pick|refill|'
|
| 77 |
+
r'restore-input|roll|save-input|source-id|to|'
|
| 78 |
+
r'true|tuck|u\.r|u>|unused|value|within|'
|
| 79 |
+
r'\[compile\]|'
|
| 80 |
+
# *** Wordset CORE-EXT-obsolescent
|
| 81 |
+
r'\#tib|convert|expect|query|span|'
|
| 82 |
+
r'tib|'
|
| 83 |
+
# *** Wordset DOUBLE
|
| 84 |
+
r'2constant|2literal|2variable|d\+|d-|'
|
| 85 |
+
r'd\.|d\.r|d0<|d0=|d2\*|d2\/|d<|d=|d>s|'
|
| 86 |
+
r'dabs|dmax|dmin|dnegate|m\*\/|m\+|'
|
| 87 |
+
# *** Wordset DOUBLE-EXT
|
| 88 |
+
r'2rot|du<|'
|
| 89 |
+
# *** Wordset EXCEPTION
|
| 90 |
+
r'catch|throw|'
|
| 91 |
+
# *** Wordset EXCEPTION-EXT
|
| 92 |
+
r'abort|abort\"|'
|
| 93 |
+
# *** Wordset FACILITY
|
| 94 |
+
r'at-xy|key\?|page|'
|
| 95 |
+
# *** Wordset FACILITY-EXT
|
| 96 |
+
r'ekey|ekey>char|ekey\?|emit\?|ms|time&date|'
|
| 97 |
+
# *** Wordset FILE
|
| 98 |
+
r'BIN|CLOSE-FILE|CREATE-FILE|DELETE-FILE|FILE-POSITION|'
|
| 99 |
+
r'FILE-SIZE|INCLUDE-FILE|INCLUDED|OPEN-FILE|R\/O|'
|
| 100 |
+
r'R\/W|READ-FILE|READ-LINE|REPOSITION-FILE|RESIZE-FILE|'
|
| 101 |
+
r'S\"|SOURCE-ID|W/O|WRITE-FILE|WRITE-LINE|'
|
| 102 |
+
# *** Wordset FILE-EXT
|
| 103 |
+
r'FILE-STATUS|FLUSH-FILE|REFILL|RENAME-FILE|'
|
| 104 |
+
# *** Wordset FLOAT
|
| 105 |
+
r'>float|d>f|'
|
| 106 |
+
r'f!|f\*|f\+|f-|f\/|f0<|f0=|f<|f>d|f@|'
|
| 107 |
+
r'falign|faligned|fconstant|fdepth|fdrop|fdup|'
|
| 108 |
+
r'fliteral|float\+|floats|floor|fmax|fmin|'
|
| 109 |
+
r'fnegate|fover|frot|fround|fswap|fvariable|'
|
| 110 |
+
r'represent|'
|
| 111 |
+
# *** Wordset FLOAT-EXT
|
| 112 |
+
r'df!|df@|dfalign|dfaligned|dfloat\+|'
|
| 113 |
+
r'dfloats|f\*\*|f\.|fabs|facos|facosh|falog|'
|
| 114 |
+
r'fasin|fasinh|fatan|fatan2|fatanh|fcos|fcosh|'
|
| 115 |
+
r'fe\.|fexp|fexpm1|fln|flnp1|flog|fs\.|fsin|'
|
| 116 |
+
r'fsincos|fsinh|fsqrt|ftan|ftanh|f~|precision|'
|
| 117 |
+
r'set-precision|sf!|sf@|sfalign|sfaligned|sfloat\+|'
|
| 118 |
+
r'sfloats|'
|
| 119 |
+
# *** Wordset LOCAL
|
| 120 |
+
r'\(local\)|to|'
|
| 121 |
+
# *** Wordset LOCAL-EXT
|
| 122 |
+
r'locals\||'
|
| 123 |
+
# *** Wordset MEMORY
|
| 124 |
+
r'allocate|free|resize|'
|
| 125 |
+
# *** Wordset SEARCH
|
| 126 |
+
r'definitions|find|forth-wordlist|get-current|'
|
| 127 |
+
r'get-order|search-wordlist|set-current|set-order|'
|
| 128 |
+
r'wordlist|'
|
| 129 |
+
# *** Wordset SEARCH-EXT
|
| 130 |
+
r'also|forth|only|order|previous|'
|
| 131 |
+
# *** Wordset STRING
|
| 132 |
+
r'-trailing|\/string|blank|cmove|cmove>|compare|'
|
| 133 |
+
r'search|sliteral|'
|
| 134 |
+
# *** Wordset TOOLS
|
| 135 |
+
r'.s|dump|see|words|'
|
| 136 |
+
# *** Wordset TOOLS-EXT
|
| 137 |
+
r';code|'
|
| 138 |
+
r'ahead|assembler|bye|code|cs-pick|cs-roll|'
|
| 139 |
+
r'editor|state|\[else\]|\[if\]|\[then\]|'
|
| 140 |
+
# *** Wordset TOOLS-EXT-obsolescent
|
| 141 |
+
r'forget|'
|
| 142 |
+
# Forth 2012
|
| 143 |
+
r'defer|defer@|defer!|action-of|begin-structure|field:|buffer:|'
|
| 144 |
+
r'parse-name|buffer:|traverse-wordlist|n>r|nr>|2value|fvalue|'
|
| 145 |
+
r'name>interpret|name>compile|name>string|'
|
| 146 |
+
r'cfield:|end-structure)'+delimiter, Keyword),
|
| 147 |
+
|
| 148 |
+
# Numbers
|
| 149 |
+
(r'(\$[0-9A-F]+)', Number.Hex),
|
| 150 |
+
(r'(\#|%|&|\-|\+)?[0-9]+', Number.Integer),
|
| 151 |
+
(r'(\#|%|&|\-|\+)?[0-9.]+', Keyword.Type),
|
| 152 |
+
# amforth specific
|
| 153 |
+
(r'(@i|!i|@e|!e|pause|noop|turnkey|sleep|'
|
| 154 |
+
r'itype|icompare|sp@|sp!|rp@|rp!|up@|up!|'
|
| 155 |
+
r'>a|a>|a@|a!|a@+|a@-|>b|b>|b@|b!|b@+|b@-|'
|
| 156 |
+
r'find-name|1ms|'
|
| 157 |
+
r'sp0|rp0|\(evaluate\)|int-trap|int!)' + delimiter,
|
| 158 |
+
Name.Constant),
|
| 159 |
+
# a proposal
|
| 160 |
+
(r'(do-recognizer|r:fail|recognizer:|get-recognizers|'
|
| 161 |
+
r'set-recognizers|r:float|r>comp|r>int|r>post|'
|
| 162 |
+
r'r:name|r:word|r:dnum|r:num|recognizer|forth-recognizer|'
|
| 163 |
+
r'rec:num|rec:float|rec:word)' + delimiter, Name.Decorator),
|
| 164 |
+
# defining words. The next word is a new command name
|
| 165 |
+
(r'(Evalue|Rvalue|Uvalue|Edefer|Rdefer|Udefer)(\s+)',
|
| 166 |
+
bygroups(Keyword.Namespace, Text), 'worddef'),
|
| 167 |
+
|
| 168 |
+
(valid_name, Name.Function), # Anything else is executed
|
| 169 |
+
|
| 170 |
+
],
|
| 171 |
+
'worddef': [
|
| 172 |
+
(r'\S+', Name.Class, '#pop'),
|
| 173 |
+
],
|
| 174 |
+
'stringdef': [
|
| 175 |
+
(r'[^"]+', String, '#pop'),
|
| 176 |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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.fortran
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for Fortran languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, bygroups, include, words, using, default
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Generic
|
| 17 |
+
|
| 18 |
+
__all__ = ['FortranLexer', 'FortranFixedLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class FortranLexer(RegexLexer):
|
| 22 |
+
"""
|
| 23 |
+
Lexer for FORTRAN 90 code.
|
| 24 |
+
|
| 25 |
+
.. versionadded:: 0.10
|
| 26 |
+
"""
|
| 27 |
+
name = 'Fortran'
|
| 28 |
+
aliases = ['fortran']
|
| 29 |
+
filenames = ['*.f03', '*.f90', '*.F03', '*.F90']
|
| 30 |
+
mimetypes = ['text/x-fortran']
|
| 31 |
+
flags = re.IGNORECASE | re.MULTILINE
|
| 32 |
+
|
| 33 |
+
# Data Types: INTEGER, REAL, COMPLEX, LOGICAL, CHARACTER and DOUBLE PRECISION
|
| 34 |
+
# Operators: **, *, +, -, /, <, >, <=, >=, ==, /=
|
| 35 |
+
# Logical (?): NOT, AND, OR, EQV, NEQV
|
| 36 |
+
|
| 37 |
+
# Builtins:
|
| 38 |
+
# http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/Table-of-Intrinsic-Functions.html
|
| 39 |
+
|
| 40 |
+
tokens = {
|
| 41 |
+
'root': [
|
| 42 |
+
(r'^#.*\n', Comment.Preproc),
|
| 43 |
+
(r'!.*\n', Comment),
|
| 44 |
+
include('strings'),
|
| 45 |
+
include('core'),
|
| 46 |
+
(r'[a-z][\w$]*', Name),
|
| 47 |
+
include('nums'),
|
| 48 |
+
(r'[\s]+', Text),
|
| 49 |
+
],
|
| 50 |
+
'core': [
|
| 51 |
+
# Statements
|
| 52 |
+
(words((
|
| 53 |
+
'ABSTRACT', 'ACCEPT', 'ALL', 'ALLSTOP', 'ALLOCATABLE', 'ALLOCATE',
|
| 54 |
+
'ARRAY', 'ASSIGN', 'ASSOCIATE', 'ASYNCHRONOUS', 'BACKSPACE', 'BIND',
|
| 55 |
+
'BLOCK', 'BLOCKDATA', 'BYTE', 'CALL', 'CASE', 'CLASS', 'CLOSE',
|
| 56 |
+
'CODIMENSION', 'COMMON', 'CONCURRRENT', 'CONTIGUOUS', 'CONTAINS',
|
| 57 |
+
'CONTINUE', 'CRITICAL', 'CYCLE', 'DATA', 'DEALLOCATE', 'DECODE',
|
| 58 |
+
'DEFERRED', 'DIMENSION', 'DO', 'ELEMENTAL', 'ELSE', 'ENCODE', 'END',
|
| 59 |
+
'ENTRY', 'ENUM', 'ENUMERATOR', 'EQUIVALENCE', 'EXIT', 'EXTENDS',
|
| 60 |
+
'EXTERNAL', 'EXTRINSIC', 'FILE', 'FINAL', 'FORALL', 'FORMAT',
|
| 61 |
+
'FUNCTION', 'GENERIC', 'GOTO', 'IF', 'IMAGES', 'IMPLICIT',
|
| 62 |
+
'IMPORT', 'IMPURE', 'INCLUDE', 'INQUIRE', 'INTENT', 'INTERFACE',
|
| 63 |
+
'INTRINSIC', 'IS', 'LOCK', 'MEMORY', 'MODULE', 'NAMELIST', 'NULLIFY',
|
| 64 |
+
'NONE', 'NON_INTRINSIC', 'NON_OVERRIDABLE', 'NOPASS', 'OPEN', 'OPTIONAL',
|
| 65 |
+
'OPTIONS', 'PARAMETER', 'PASS', 'PAUSE', 'POINTER', 'PRINT', 'PRIVATE',
|
| 66 |
+
'PROGRAM', 'PROCEDURE', 'PROTECTED', 'PUBLIC', 'PURE', 'READ',
|
| 67 |
+
'RECURSIVE', 'RESULT', 'RETURN', 'REWIND', 'SAVE', 'SELECT', 'SEQUENCE',
|
| 68 |
+
'STOP', 'SUBMODULE', 'SUBROUTINE', 'SYNC', 'SYNCALL', 'SYNCIMAGES',
|
| 69 |
+
'SYNCMEMORY', 'TARGET', 'THEN', 'TYPE', 'UNLOCK', 'USE', 'VALUE',
|
| 70 |
+
'VOLATILE', 'WHERE', 'WRITE', 'WHILE'), prefix=r'\b', suffix=r'\s*\b'),
|
| 71 |
+
Keyword),
|
| 72 |
+
|
| 73 |
+
# Data Types
|
| 74 |
+
(words((
|
| 75 |
+
'CHARACTER', 'COMPLEX', 'DOUBLE PRECISION', 'DOUBLE COMPLEX', 'INTEGER',
|
| 76 |
+
'LOGICAL', 'REAL', 'C_INT', 'C_SHORT', 'C_LONG', 'C_LONG_LONG',
|
| 77 |
+
'C_SIGNED_CHAR', 'C_SIZE_T', 'C_INT8_T', 'C_INT16_T', 'C_INT32_T',
|
| 78 |
+
'C_INT64_T', 'C_INT_LEAST8_T', 'C_INT_LEAST16_T', 'C_INT_LEAST32_T',
|
| 79 |
+
'C_INT_LEAST64_T', 'C_INT_FAST8_T', 'C_INT_FAST16_T', 'C_INT_FAST32_T',
|
| 80 |
+
'C_INT_FAST64_T', 'C_INTMAX_T', 'C_INTPTR_T', 'C_FLOAT', 'C_DOUBLE',
|
| 81 |
+
'C_LONG_DOUBLE', 'C_FLOAT_COMPLEX', 'C_DOUBLE_COMPLEX',
|
| 82 |
+
'C_LONG_DOUBLE_COMPLEX', 'C_BOOL', 'C_CHAR', 'C_PTR', 'C_FUNPTR'),
|
| 83 |
+
prefix=r'\b', suffix=r'\s*\b'),
|
| 84 |
+
Keyword.Type),
|
| 85 |
+
|
| 86 |
+
# Operators
|
| 87 |
+
(r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)', Operator),
|
| 88 |
+
|
| 89 |
+
(r'(::)', Keyword.Declaration),
|
| 90 |
+
|
| 91 |
+
(r'[()\[\],:&%;.]', Punctuation),
|
| 92 |
+
# Intrinsics
|
| 93 |
+
(words((
|
| 94 |
+
'Abort', 'Abs', 'Access', 'AChar', 'ACos', 'ACosH', 'AdjustL',
|
| 95 |
+
'AdjustR', 'AImag', 'AInt', 'Alarm', 'All', 'Allocated', 'ALog',
|
| 96 |
+
'AMax', 'AMin', 'AMod', 'And', 'ANInt', 'Any', 'ASin', 'ASinH',
|
| 97 |
+
'Associated', 'ATan', 'ATanH', 'Atomic_Define', 'Atomic_Ref',
|
| 98 |
+
'BesJ', 'BesJN', 'Bessel_J0', 'Bessel_J1', 'Bessel_JN', 'Bessel_Y0',
|
| 99 |
+
'Bessel_Y1', 'Bessel_YN', 'BesY', 'BesYN', 'BGE', 'BGT', 'BLE',
|
| 100 |
+
'BLT', 'Bit_Size', 'BTest', 'CAbs', 'CCos', 'Ceiling', 'CExp',
|
| 101 |
+
'Char', 'ChDir', 'ChMod', 'CLog', 'Cmplx', 'Command_Argument_Count',
|
| 102 |
+
'Complex', 'Conjg', 'Cos', 'CosH', 'Count', 'CPU_Time', 'CShift',
|
| 103 |
+
'CSin', 'CSqRt', 'CTime', 'C_Loc', 'C_Associated',
|
| 104 |
+
'C_Null_Ptr', 'C_Null_Funptr', 'C_F_Pointer', 'C_F_ProcPointer',
|
| 105 |
+
'C_Null_Char', 'C_Alert', 'C_Backspace', 'C_Form_Feed', 'C_FunLoc',
|
| 106 |
+
'C_Sizeof', 'C_New_Line', 'C_Carriage_Return',
|
| 107 |
+
'C_Horizontal_Tab', 'C_Vertical_Tab', 'DAbs', 'DACos', 'DASin',
|
| 108 |
+
'DATan', 'Date_and_Time', 'DbesJ', 'DbesJN', 'DbesY',
|
| 109 |
+
'DbesYN', 'Dble', 'DCos', 'DCosH', 'DDiM', 'DErF',
|
| 110 |
+
'DErFC', 'DExp', 'Digits', 'DiM', 'DInt', 'DLog', 'DMax',
|
| 111 |
+
'DMin', 'DMod', 'DNInt', 'Dot_Product', 'DProd', 'DSign', 'DSinH',
|
| 112 |
+
'DShiftL', 'DShiftR', 'DSin', 'DSqRt', 'DTanH', 'DTan', 'DTime',
|
| 113 |
+
'EOShift', 'Epsilon', 'ErF', 'ErFC', 'ErFC_Scaled', 'ETime',
|
| 114 |
+
'Execute_Command_Line', 'Exit', 'Exp', 'Exponent', 'Extends_Type_Of',
|
| 115 |
+
'FDate', 'FGet', 'FGetC', 'FindLoc', 'Float', 'Floor', 'Flush',
|
| 116 |
+
'FNum', 'FPutC', 'FPut', 'Fraction', 'FSeek', 'FStat', 'FTell',
|
| 117 |
+
'Gamma', 'GError', 'GetArg', 'Get_Command', 'Get_Command_Argument',
|
| 118 |
+
'Get_Environment_Variable', 'GetCWD', 'GetEnv', 'GetGId', 'GetLog',
|
| 119 |
+
'GetPId', 'GetUId', 'GMTime', 'HostNm', 'Huge', 'Hypot', 'IAbs',
|
| 120 |
+
'IAChar', 'IAll', 'IAnd', 'IAny', 'IArgC', 'IBClr', 'IBits',
|
| 121 |
+
'IBSet', 'IChar', 'IDate', 'IDiM', 'IDInt', 'IDNInt', 'IEOr',
|
| 122 |
+
'IErrNo', 'IFix', 'Imag', 'ImagPart', 'Image_Index', 'Index',
|
| 123 |
+
'Int', 'IOr', 'IParity', 'IRand', 'IsaTty', 'IShft', 'IShftC',
|
| 124 |
+
'ISign', 'Iso_C_Binding', 'Is_Contiguous', 'Is_Iostat_End',
|
| 125 |
+
'Is_Iostat_Eor', 'ITime', 'Kill', 'Kind', 'LBound', 'LCoBound',
|
| 126 |
+
'Len', 'Len_Trim', 'LGe', 'LGt', 'Link', 'LLe', 'LLt', 'LnBlnk',
|
| 127 |
+
'Loc', 'Log', 'Log_Gamma', 'Logical', 'Long', 'LShift', 'LStat',
|
| 128 |
+
'LTime', 'MaskL', 'MaskR', 'MatMul', 'Max', 'MaxExponent',
|
| 129 |
+
'MaxLoc', 'MaxVal', 'MClock', 'Merge', 'Merge_Bits', 'Move_Alloc',
|
| 130 |
+
'Min', 'MinExponent', 'MinLoc', 'MinVal', 'Mod', 'Modulo', 'MvBits',
|
| 131 |
+
'Nearest', 'New_Line', 'NInt', 'Norm2', 'Not', 'Null', 'Num_Images',
|
| 132 |
+
'Or', 'Pack', 'Parity', 'PError', 'Precision', 'Present', 'Product',
|
| 133 |
+
'Radix', 'Rand', 'Random_Number', 'Random_Seed', 'Range', 'Real',
|
| 134 |
+
'RealPart', 'Rename', 'Repeat', 'Reshape', 'RRSpacing', 'RShift',
|
| 135 |
+
'Same_Type_As', 'Scale', 'Scan', 'Second', 'Selected_Char_Kind',
|
| 136 |
+
'Selected_Int_Kind', 'Selected_Real_Kind', 'Set_Exponent', 'Shape',
|
| 137 |
+
'ShiftA', 'ShiftL', 'ShiftR', 'Short', 'Sign', 'Signal', 'SinH',
|
| 138 |
+
'Sin', 'Sleep', 'Sngl', 'Spacing', 'Spread', 'SqRt', 'SRand',
|
| 139 |
+
'Stat', 'Storage_Size', 'Sum', 'SymLnk', 'System', 'System_Clock',
|
| 140 |
+
'Tan', 'TanH', 'Time', 'This_Image', 'Tiny', 'TrailZ', 'Transfer',
|
| 141 |
+
'Transpose', 'Trim', 'TtyNam', 'UBound', 'UCoBound', 'UMask',
|
| 142 |
+
'Unlink', 'Unpack', 'Verify', 'XOr', 'ZAbs', 'ZCos', 'ZExp',
|
| 143 |
+
'ZLog', 'ZSin', 'ZSqRt'), prefix=r'\b', suffix=r'\s*\b'),
|
| 144 |
+
Name.Builtin),
|
| 145 |
+
|
| 146 |
+
# Booleans
|
| 147 |
+
(r'\.(true|false)\.', Name.Builtin),
|
| 148 |
+
# Comparing Operators
|
| 149 |
+
(r'\.(eq|ne|lt|le|gt|ge|not|and|or|eqv|neqv)\.', Operator.Word),
|
| 150 |
+
],
|
| 151 |
+
|
| 152 |
+
'strings': [
|
| 153 |
+
(r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
|
| 154 |
+
(r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
|
| 155 |
+
],
|
| 156 |
+
|
| 157 |
+
'nums': [
|
| 158 |
+
(r'\d+(?![.e])(_[a-z]\w+)?', Number.Integer),
|
| 159 |
+
(r'[+-]?\d*\.\d+([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float),
|
| 160 |
+
(r'[+-]?\d+\.\d*([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float),
|
| 161 |
+
],
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
class FortranFixedLexer(RegexLexer):
|
| 166 |
+
"""
|
| 167 |
+
Lexer for fixed format Fortran.
|
| 168 |
+
|
| 169 |
+
.. versionadded:: 2.1
|
| 170 |
+
"""
|
| 171 |
+
name = 'FortranFixed'
|
| 172 |
+
aliases = ['fortranfixed']
|
| 173 |
+
filenames = ['*.f', '*.F']
|
| 174 |
+
|
| 175 |
+
flags = re.IGNORECASE
|
| 176 |
+
|
| 177 |
+
def _lex_fortran(self, match, ctx=None):
|
| 178 |
+
"""Lex a line just as free form fortran without line break."""
|
| 179 |
+
lexer = FortranLexer()
|
| 180 |
+
text = match.group(0) + "\n"
|
| 181 |
+
for index, token, value in lexer.get_tokens_unprocessed(text):
|
| 182 |
+
value = value.replace('\n', '')
|
| 183 |
+
if value != '':
|
| 184 |
+
yield index, token, value
|
| 185 |
+
|
| 186 |
+
tokens = {
|
| 187 |
+
'root': [
|
| 188 |
+
(r'[C*].*\n', Comment),
|
| 189 |
+
(r'#.*\n', Comment.Preproc),
|
| 190 |
+
(r' {0,4}!.*\n', Comment),
|
| 191 |
+
(r'(.{5})', Name.Label, 'cont-char'),
|
| 192 |
+
(r'.*\n', using(FortranLexer)),
|
| 193 |
+
],
|
| 194 |
+
'cont-char': [
|
| 195 |
+
(' ', Text, 'code'),
|
| 196 |
+
('0', Comment, 'code'),
|
| 197 |
+
('.', Generic.Strong, 'code'),
|
| 198 |
+
],
|
| 199 |
+
'code': [
|
| 200 |
+
(r'(.{66})(.*)(\n)',
|
| 201 |
+
bygroups(_lex_fortran, Comment, Text), 'root'),
|
| 202 |
+
(r'(.*)(\n)', bygroups(_lex_fortran, Text), 'root'),
|
| 203 |
+
default('root'),
|
| 204 |
+
]
|
| 205 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/foxpro.py
ADDED
|
@@ -0,0 +1,428 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.foxpro
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Simple lexer for Microsoft Visual FoxPro source code.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer
|
| 15 |
+
from pygments.token import Punctuation, Text, Comment, Operator, Keyword, \
|
| 16 |
+
Name, String
|
| 17 |
+
|
| 18 |
+
__all__ = ['FoxProLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class FoxProLexer(RegexLexer):
|
| 22 |
+
"""Lexer for Microsoft Visual FoxPro language.
|
| 23 |
+
|
| 24 |
+
FoxPro syntax allows to shorten all keywords and function names
|
| 25 |
+
to 4 characters. Shortened forms are not recognized by this lexer.
|
| 26 |
+
|
| 27 |
+
.. versionadded:: 1.6
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
name = 'FoxPro'
|
| 31 |
+
aliases = ['foxpro', 'vfp', 'clipper', 'xbase']
|
| 32 |
+
filenames = ['*.PRG', '*.prg']
|
| 33 |
+
mimetype = []
|
| 34 |
+
|
| 35 |
+
flags = re.IGNORECASE | re.MULTILINE
|
| 36 |
+
|
| 37 |
+
tokens = {
|
| 38 |
+
'root': [
|
| 39 |
+
(r';\s*\n', Punctuation), # consume newline
|
| 40 |
+
(r'(^|\n)\s*', Text, 'newline'),
|
| 41 |
+
|
| 42 |
+
# Square brackets may be used for array indices
|
| 43 |
+
# and for string literal. Look for arrays
|
| 44 |
+
# before matching string literals.
|
| 45 |
+
(r'(?<=\w)\[[0-9, ]+\]', Text),
|
| 46 |
+
(r'\'[^\'\n]*\'|"[^"\n]*"|\[[^]*]\]', String),
|
| 47 |
+
(r'(^\s*\*|&&|&&).*?\n', Comment.Single),
|
| 48 |
+
|
| 49 |
+
(r'(ABS|ACLASS|ACOPY|ACOS|ADATABASES|ADBOBJECTS|ADDBS|'
|
| 50 |
+
r'ADDPROPERTY|ADEL|ADIR|ADLLS|ADOCKSTATE|AELEMENT|AERROR|'
|
| 51 |
+
r'AEVENTS|AFIELDS|AFONT|AGETCLASS|AGETFILEVERSION|AINS|'
|
| 52 |
+
r'AINSTANCE|ALANGUAGE|ALEN|ALIAS|ALINES|ALLTRIM|'
|
| 53 |
+
r'AMEMBERS|AMOUSEOBJ|ANETRESOURCES|APRINTERS|APROCINFO|'
|
| 54 |
+
r'ASC|ASCAN|ASELOBJ|ASESSIONS|ASIN|ASORT|ASQLHANDLES|'
|
| 55 |
+
r'ASTACKINFO|ASUBSCRIPT|AT|AT_C|ATAGINFO|ATAN|ATC|ATCC|'
|
| 56 |
+
r'ATCLINE|ATLINE|ATN2|AUSED|AVCXCLASSES|BAR|BARCOUNT|'
|
| 57 |
+
r'BARPROMPT|BETWEEN|BINDEVENT|BINTOC|BITAND|BITCLEAR|'
|
| 58 |
+
r'BITLSHIFT|BITNOT|BITOR|BITRSHIFT|BITSET|BITTEST|BITXOR|'
|
| 59 |
+
r'BOF|CANDIDATE|CAPSLOCK|CAST|CDOW|CDX|CEILING|CHR|CHRSAW|'
|
| 60 |
+
r'CHRTRAN|CHRTRANC|CLEARRESULTSET|CMONTH|CNTBAR|CNTPAD|COL|'
|
| 61 |
+
r'COM|Functions|COMARRAY|COMCLASSINFO|COMPOBJ|COMPROP|'
|
| 62 |
+
r'COMRETURNERROR|COS|CPCONVERT|CPCURRENT|CPDBF|CREATEBINARY|'
|
| 63 |
+
r'CREATEOBJECT|CREATEOBJECTEX|CREATEOFFLINE|CTOBIN|CTOD|'
|
| 64 |
+
r'CTOT|CURDIR|CURSORGETPROP|CURSORSETPROP|CURSORTOXML|'
|
| 65 |
+
r'CURVAL|DATE|DATETIME|DAY|DBC|DBF|DBGETPROP|DBSETPROP|'
|
| 66 |
+
r'DBUSED|DDEAbortTrans|DDEAdvise|DDEEnabled|DDEExecute|'
|
| 67 |
+
r'DDEInitiate|DDELastError|DDEPoke|DDERequest|DDESetOption|'
|
| 68 |
+
r'DDESetService|DDESetTopic|DDETerminate|DEFAULTEXT|'
|
| 69 |
+
r'DELETED|DESCENDING|DIFFERENCE|DIRECTORY|DISKSPACE|'
|
| 70 |
+
r'DisplayPath|DMY|DODEFAULT|DOW|DRIVETYPE|DROPOFFLINE|'
|
| 71 |
+
r'DTOC|DTOR|DTOS|DTOT|EDITSOURCE|EMPTY|EOF|ERROR|EVAL(UATE)?|'
|
| 72 |
+
r'EVENTHANDLER|EVL|EXECSCRIPT|EXP|FCHSIZE|FCLOSE|FCOUNT|'
|
| 73 |
+
r'FCREATE|FDATE|FEOF|FERROR|FFLUSH|FGETS|FIELD|FILE|'
|
| 74 |
+
r'FILETOSTR|FILTER|FKLABEL|FKMAX|FLDLIST|FLOCK|FLOOR|'
|
| 75 |
+
r'FONTMETRIC|FOPEN|FOR|FORCEEXT|FORCEPATH|FOUND|FPUTS|'
|
| 76 |
+
r'FREAD|FSEEK|FSIZE|FTIME|FULLPATH|FV|FWRITE|'
|
| 77 |
+
r'GETAUTOINCVALUE|GETBAR|GETCOLOR|GETCP|GETDIR|GETENV|'
|
| 78 |
+
r'GETFILE|GETFLDSTATE|GETFONT|GETINTERFACE|'
|
| 79 |
+
r'GETNEXTMODIFIED|GETOBJECT|GETPAD|GETPEM|GETPICT|'
|
| 80 |
+
r'GETPRINTER|GETRESULTSET|GETWORDCOUNT|GETWORDNUM|'
|
| 81 |
+
r'GETCURSORADAPTER|GOMONTH|HEADER|HOME|HOUR|ICASE|'
|
| 82 |
+
r'IDXCOLLATE|IIF|IMESTATUS|INDBC|INDEXSEEK|INKEY|INLIST|'
|
| 83 |
+
r'INPUTBOX|INSMODE|INT|ISALPHA|ISBLANK|ISCOLOR|ISDIGIT|'
|
| 84 |
+
r'ISEXCLUSIVE|ISFLOCKED|ISLEADBYTE|ISLOWER|ISMEMOFETCHED|'
|
| 85 |
+
r'ISMOUSE|ISNULL|ISPEN|ISREADONLY|ISRLOCKED|'
|
| 86 |
+
r'ISTRANSACTABLE|ISUPPER|JUSTDRIVE|JUSTEXT|JUSTFNAME|'
|
| 87 |
+
r'JUSTPATH|JUSTSTEM|KEY|KEYMATCH|LASTKEY|LEFT|LEFTC|LEN|'
|
| 88 |
+
r'LENC|LIKE|LIKEC|LINENO|LOADPICTURE|LOCFILE|LOCK|LOG|'
|
| 89 |
+
r'LOG10|LOOKUP|LOWER|LTRIM|LUPDATE|MAKETRANSACTABLE|MAX|'
|
| 90 |
+
r'MCOL|MDOWN|MDX|MDY|MEMLINES|MEMORY|MENU|MESSAGE|'
|
| 91 |
+
r'MESSAGEBOX|MIN|MINUTE|MLINE|MOD|MONTH|MRKBAR|MRKPAD|'
|
| 92 |
+
r'MROW|MTON|MWINDOW|NDX|NEWOBJECT|NORMALIZE|NTOM|NUMLOCK|'
|
| 93 |
+
r'NVL|OBJNUM|OBJTOCLIENT|OBJVAR|OCCURS|OEMTOANSI|OLDVAL|'
|
| 94 |
+
r'ON|ORDER|OS|PAD|PADL|PARAMETERS|PAYMENT|PCOL|PCOUNT|'
|
| 95 |
+
r'PEMSTATUS|PI|POPUP|PRIMARY|PRINTSTATUS|PRMBAR|PRMPAD|'
|
| 96 |
+
r'PROGRAM|PROMPT|PROPER|PROW|PRTINFO|PUTFILE|PV|QUARTER|'
|
| 97 |
+
r'RAISEEVENT|RAND|RAT|RATC|RATLINE|RDLEVEL|READKEY|RECCOUNT|'
|
| 98 |
+
r'RECNO|RECSIZE|REFRESH|RELATION|REPLICATE|REQUERY|RGB|'
|
| 99 |
+
r'RGBSCHEME|RIGHT|RIGHTC|RLOCK|ROUND|ROW|RTOD|RTRIM|'
|
| 100 |
+
r'SAVEPICTURE|SCHEME|SCOLS|SEC|SECONDS|SEEK|SELECT|SET|'
|
| 101 |
+
r'SETFLDSTATE|SETRESULTSET|SIGN|SIN|SKPBAR|SKPPAD|SOUNDEX|'
|
| 102 |
+
r'SPACE|SQLCANCEL|SQLCOLUMNS|SQLCOMMIT|SQLCONNECT|'
|
| 103 |
+
r'SQLDISCONNECT|SQLEXEC|SQLGETPROP|SQLIDLEDISCONNECT|'
|
| 104 |
+
r'SQLMORERESULTS|SQLPREPARE|SQLROLLBACK|SQLSETPROP|'
|
| 105 |
+
r'SQLSTRINGCONNECT|SQLTABLES|SQRT|SROWS|STR|STRCONV|'
|
| 106 |
+
r'STREXTRACT|STRTOFILE|STRTRAN|STUFF|STUFFC|SUBSTR|'
|
| 107 |
+
r'SUBSTRC|SYS|SYSMETRIC|TABLEREVERT|TABLEUPDATE|TAG|'
|
| 108 |
+
r'TAGCOUNT|TAGNO|TAN|TARGET|TEXTMERGE|TIME|TRANSFORM|'
|
| 109 |
+
r'TRIM|TTOC|TTOD|TXNLEVEL|TXTWIDTH|TYPE|UNBINDEVENTS|'
|
| 110 |
+
r'UNIQUE|UPDATED|UPPER|USED|VAL|VARREAD|VARTYPE|VERSION|'
|
| 111 |
+
r'WBORDER|WCHILD|WCOLS|WDOCKABLE|WEEK|WEXIST|WFONT|WLAST|'
|
| 112 |
+
r'WLCOL|WLROW|WMAXIMUM|WMINIMUM|WONTOP|WOUTPUT|WPARENT|'
|
| 113 |
+
r'WREAD|WROWS|WTITLE|WVISIBLE|XMLTOCURSOR|XMLUPDATEGRAM|'
|
| 114 |
+
r'YEAR)(?=\s*\()', Name.Function),
|
| 115 |
+
|
| 116 |
+
(r'_ALIGNMENT|_ASCIICOLS|_ASCIIROWS|_ASSIST|_BEAUTIFY|_BOX|'
|
| 117 |
+
r'_BROWSER|_BUILDER|_CALCMEM|_CALCVALUE|_CLIPTEXT|_CONVERTER|'
|
| 118 |
+
r'_COVERAGE|_CUROBJ|_DBLCLICK|_DIARYDATE|_DOS|_FOXDOC|_FOXREF|'
|
| 119 |
+
r'_GALLERY|_GENGRAPH|_GENHTML|_GENMENU|_GENPD|_GENSCRN|'
|
| 120 |
+
r'_GENXTAB|_GETEXPR|_INCLUDE|_INCSEEK|_INDENT|_LMARGIN|_MAC|'
|
| 121 |
+
r'_MENUDESIGNER|_MLINE|_PADVANCE|_PAGENO|_PAGETOTAL|_PBPAGE|'
|
| 122 |
+
r'_PCOLNO|_PCOPIES|_PDRIVER|_PDSETUP|_PECODE|_PEJECT|_PEPAGE|'
|
| 123 |
+
r'_PLENGTH|_PLINENO|_PLOFFSET|_PPITCH|_PQUALITY|_PRETEXT|'
|
| 124 |
+
r'_PSCODE|_PSPACING|_PWAIT|_RMARGIN|_REPORTBUILDER|'
|
| 125 |
+
r'_REPORTOUTPUT|_REPORTPREVIEW|_SAMPLES|_SCCTEXT|_SCREEN|'
|
| 126 |
+
r'_SHELL|_SPELLCHK|_STARTUP|_TABS|_TALLY|_TASKPANE|_TEXT|'
|
| 127 |
+
r'_THROTTLE|_TOOLBOX|_TOOLTIPTIMEOUT|_TRANSPORT|_TRIGGERLEVEL|'
|
| 128 |
+
r'_UNIX|_VFP|_WINDOWS|_WIZARD|_WRAP', Keyword.Pseudo),
|
| 129 |
+
|
| 130 |
+
(r'THISFORMSET|THISFORM|THIS', Name.Builtin),
|
| 131 |
+
|
| 132 |
+
(r'Application|CheckBox|Collection|Column|ComboBox|'
|
| 133 |
+
r'CommandButton|CommandGroup|Container|Control|CursorAdapter|'
|
| 134 |
+
r'Cursor|Custom|DataEnvironment|DataObject|EditBox|'
|
| 135 |
+
r'Empty|Exception|Fields|Files|File|FormSet|Form|FoxCode|'
|
| 136 |
+
r'Grid|Header|Hyperlink|Image|Label|Line|ListBox|Objects|'
|
| 137 |
+
r'OptionButton|OptionGroup|PageFrame|Page|ProjectHook|Projects|'
|
| 138 |
+
r'Project|Relation|ReportListener|Separator|Servers|Server|'
|
| 139 |
+
r'Session|Shape|Spinner|Tables|TextBox|Timer|ToolBar|'
|
| 140 |
+
r'XMLAdapter|XMLField|XMLTable', Name.Class),
|
| 141 |
+
|
| 142 |
+
(r'm\.[a-z_]\w*', Name.Variable),
|
| 143 |
+
(r'\.(F|T|AND|OR|NOT|NULL)\.|\b(AND|OR|NOT|NULL)\b', Operator.Word),
|
| 144 |
+
|
| 145 |
+
(r'\.(ActiveColumn|ActiveControl|ActiveForm|ActivePage|'
|
| 146 |
+
r'ActiveProject|ActiveRow|AddLineFeeds|ADOCodePage|Alias|'
|
| 147 |
+
r'Alignment|Align|AllowAddNew|AllowAutoColumnFit|'
|
| 148 |
+
r'AllowCellSelection|AllowDelete|AllowHeaderSizing|'
|
| 149 |
+
r'AllowInsert|AllowModalMessages|AllowOutput|AllowRowSizing|'
|
| 150 |
+
r'AllowSimultaneousFetch|AllowTabs|AllowUpdate|'
|
| 151 |
+
r'AlwaysOnBottom|AlwaysOnTop|Anchor|Application|'
|
| 152 |
+
r'AutoActivate|AutoCenter|AutoCloseTables|AutoComplete|'
|
| 153 |
+
r'AutoCompSource|AutoCompTable|AutoHideScrollBar|'
|
| 154 |
+
r'AutoIncrement|AutoOpenTables|AutoRelease|AutoSize|'
|
| 155 |
+
r'AutoVerbMenu|AutoYield|BackColor|ForeColor|BackStyle|'
|
| 156 |
+
r'BaseClass|BatchUpdateCount|BindControls|BorderColor|'
|
| 157 |
+
r'BorderStyle|BorderWidth|BoundColumn|BoundTo|Bound|'
|
| 158 |
+
r'BreakOnError|BufferModeOverride|BufferMode|'
|
| 159 |
+
r'BuildDateTime|ButtonCount|Buttons|Cancel|Caption|'
|
| 160 |
+
r'Centered|Century|ChildAlias|ChildOrder|ChildTable|'
|
| 161 |
+
r'ClassLibrary|Class|ClipControls|Closable|CLSID|CodePage|'
|
| 162 |
+
r'ColorScheme|ColorSource|ColumnCount|ColumnLines|'
|
| 163 |
+
r'ColumnOrder|Columns|ColumnWidths|CommandClauses|'
|
| 164 |
+
r'Comment|CompareMemo|ConflictCheckCmd|ConflictCheckType|'
|
| 165 |
+
r'ContinuousScroll|ControlBox|ControlCount|Controls|'
|
| 166 |
+
r'ControlSource|ConversionFunc|Count|CurrentControl|'
|
| 167 |
+
r'CurrentDataSession|CurrentPass|CurrentX|CurrentY|'
|
| 168 |
+
r'CursorSchema|CursorSource|CursorStatus|Curvature|'
|
| 169 |
+
r'Database|DataSessionID|DataSession|DataSourceType|'
|
| 170 |
+
r'DataSource|DataType|DateFormat|DateMark|Debug|'
|
| 171 |
+
r'DeclareXMLPrefix|DEClassLibrary|DEClass|DefaultFilePath|'
|
| 172 |
+
r'Default|DefOLELCID|DeleteCmdDataSourceType|DeleteCmdDataSource|'
|
| 173 |
+
r'DeleteCmd|DeleteMark|Description|Desktop|'
|
| 174 |
+
r'Details|DisabledBackColor|DisabledForeColor|'
|
| 175 |
+
r'DisabledItemBackColor|DisabledItemForeColor|'
|
| 176 |
+
r'DisabledPicture|DisableEncode|DisplayCount|'
|
| 177 |
+
r'DisplayValue|Dockable|Docked|DockPosition|'
|
| 178 |
+
r'DocumentFile|DownPicture|DragIcon|DragMode|DrawMode|'
|
| 179 |
+
r'DrawStyle|DrawWidth|DynamicAlignment|DynamicBackColor|'
|
| 180 |
+
r'DynamicForeColor|DynamicCurrentControl|DynamicFontBold|'
|
| 181 |
+
r'DynamicFontItalic|DynamicFontStrikethru|'
|
| 182 |
+
r'DynamicFontUnderline|DynamicFontName|DynamicFontOutline|'
|
| 183 |
+
r'DynamicFontShadow|DynamicFontSize|DynamicInputMask|'
|
| 184 |
+
r'DynamicLineHeight|EditorOptions|Enabled|'
|
| 185 |
+
r'EnableHyperlinks|Encrypted|ErrorNo|Exclude|Exclusive|'
|
| 186 |
+
r'FetchAsNeeded|FetchMemoCmdList|FetchMemoDataSourceType|'
|
| 187 |
+
r'FetchMemoDataSource|FetchMemo|FetchSize|'
|
| 188 |
+
r'FileClassLibrary|FileClass|FillColor|FillStyle|Filter|'
|
| 189 |
+
r'FirstElement|FirstNestedTable|Flags|FontBold|FontItalic|'
|
| 190 |
+
r'FontStrikethru|FontUnderline|FontCharSet|FontCondense|'
|
| 191 |
+
r'FontExtend|FontName|FontOutline|FontShadow|FontSize|'
|
| 192 |
+
r'ForceCloseTag|Format|FormCount|FormattedOutput|Forms|'
|
| 193 |
+
r'FractionDigits|FRXDataSession|FullName|GDIPlusGraphics|'
|
| 194 |
+
r'GridLineColor|GridLines|GridLineWidth|HalfHeightCaption|'
|
| 195 |
+
r'HeaderClassLibrary|HeaderClass|HeaderHeight|Height|'
|
| 196 |
+
r'HelpContextID|HideSelection|HighlightBackColor|'
|
| 197 |
+
r'HighlightForeColor|HighlightStyle|HighlightRowLineWidth|'
|
| 198 |
+
r'HighlightRow|Highlight|HomeDir|Hours|HostName|'
|
| 199 |
+
r'HScrollSmallChange|hWnd|Icon|IncrementalSearch|Increment|'
|
| 200 |
+
r'InitialSelectedAlias|InputMask|InsertCmdDataSourceType|'
|
| 201 |
+
r'InsertCmdDataSource|InsertCmdRefreshCmd|'
|
| 202 |
+
r'InsertCmdRefreshFieldList|InsertCmdRefreshKeyFieldList|'
|
| 203 |
+
r'InsertCmd|Instancing|IntegralHeight|'
|
| 204 |
+
r'Interval|IMEMode|IsAttribute|IsBase64|IsBinary|IsNull|'
|
| 205 |
+
r'IsDiffGram|IsLoaded|ItemBackColor,|ItemData|ItemIDData|'
|
| 206 |
+
r'ItemTips|IXMLDOMElement|KeyboardHighValue|KeyboardLowValue|'
|
| 207 |
+
r'Keyfield|KeyFieldList|KeyPreview|KeySort|LanguageOptions|'
|
| 208 |
+
r'LeftColumn|Left|LineContents|LineNo|LineSlant|LinkMaster|'
|
| 209 |
+
r'ListCount|ListenerType|ListIndex|ListItemID|ListItem|'
|
| 210 |
+
r'List|LockColumnsLeft|LockColumns|LockScreen|MacDesktop|'
|
| 211 |
+
r'MainFile|MapN19_4ToCurrency|MapBinary|MapVarchar|Margin|'
|
| 212 |
+
r'MaxButton|MaxHeight|MaxLeft|MaxLength|MaxRecords|MaxTop|'
|
| 213 |
+
r'MaxWidth|MDIForm|MemberClassLibrary|MemberClass|'
|
| 214 |
+
r'MemoWindow|Message|MinButton|MinHeight|MinWidth|'
|
| 215 |
+
r'MouseIcon|MousePointer|Movable|MoverBars|MultiSelect|'
|
| 216 |
+
r'Name|NestedInto|NewIndex|NewItemID|NextSiblingTable|'
|
| 217 |
+
r'NoCpTrans|NoDataOnLoad|NoData|NullDisplay|'
|
| 218 |
+
r'NumberOfElements|Object|OLEClass|OLEDragMode|'
|
| 219 |
+
r'OLEDragPicture|OLEDropEffects|OLEDropHasData|'
|
| 220 |
+
r'OLEDropMode|OLEDropTextInsertion|OLELCID|'
|
| 221 |
+
r'OLERequestPendingTimeout|OLEServerBusyRaiseError|'
|
| 222 |
+
r'OLEServerBusyTimeout|OLETypeAllowed|OneToMany|'
|
| 223 |
+
r'OpenViews|OpenWindow|Optimize|OrderDirection|Order|'
|
| 224 |
+
r'OutputPageCount|OutputType|PageCount|PageHeight|'
|
| 225 |
+
r'PageNo|PageOrder|Pages|PageTotal|PageWidth|'
|
| 226 |
+
r'PanelLink|Panel|ParentAlias|ParentClass|ParentTable|'
|
| 227 |
+
r'Parent|Partition|PasswordChar|PictureMargin|'
|
| 228 |
+
r'PicturePosition|PictureSpacing|PictureSelectionDisplay|'
|
| 229 |
+
r'PictureVal|Picture|Prepared|'
|
| 230 |
+
r'PolyPoints|PreserveWhiteSpace|PreviewContainer|'
|
| 231 |
+
r'PrintJobName|Procedure|PROCESSID|ProgID|ProjectHookClass|'
|
| 232 |
+
r'ProjectHookLibrary|ProjectHook|QuietMode|'
|
| 233 |
+
r'ReadCycle|ReadLock|ReadMouse|ReadObject|ReadOnly|'
|
| 234 |
+
r'ReadSave|ReadTimeout|RecordMark|RecordSourceType|'
|
| 235 |
+
r'RecordSource|RefreshAlias|'
|
| 236 |
+
r'RefreshCmdDataSourceType|RefreshCmdDataSource|RefreshCmd|'
|
| 237 |
+
r'RefreshIgnoreFieldList|RefreshTimeStamp|RelationalExpr|'
|
| 238 |
+
r'RelativeColumn|RelativeRow|ReleaseType|Resizable|'
|
| 239 |
+
r'RespectCursorCP|RespectNesting|RightToLeft|RotateFlip|'
|
| 240 |
+
r'Rotation|RowColChange|RowHeight|RowSourceType|'
|
| 241 |
+
r'RowSource|ScaleMode|SCCProvider|SCCStatus|ScrollBars|'
|
| 242 |
+
r'Seconds|SelectCmd|SelectedID|'
|
| 243 |
+
r'SelectedItemBackColor|SelectedItemForeColor|Selected|'
|
| 244 |
+
r'SelectionNamespaces|SelectOnEntry|SelLength|SelStart|'
|
| 245 |
+
r'SelText|SendGDIPlusImage|SendUpdates|ServerClassLibrary|'
|
| 246 |
+
r'ServerClass|ServerHelpFile|ServerName|'
|
| 247 |
+
r'ServerProject|ShowTips|ShowInTaskbar|ShowWindow|'
|
| 248 |
+
r'Sizable|SizeBox|SOM|Sorted|Sparse|SpecialEffect|'
|
| 249 |
+
r'SpinnerHighValue|SpinnerLowValue|SplitBar|StackLevel|'
|
| 250 |
+
r'StartMode|StatusBarText|StatusBar|Stretch|StrictDateEntry|'
|
| 251 |
+
r'Style|TabIndex|Tables|TabOrientation|Tabs|TabStop|'
|
| 252 |
+
r'TabStretch|TabStyle|Tag|TerminateRead|Text|Themes|'
|
| 253 |
+
r'ThreadID|TimestampFieldList|TitleBar|ToolTipText|'
|
| 254 |
+
r'TopIndex|TopItemID|Top|TwoPassProcess|TypeLibCLSID|'
|
| 255 |
+
r'TypeLibDesc|TypeLibName|Type|Unicode|UpdatableFieldList|'
|
| 256 |
+
r'UpdateCmdDataSourceType|UpdateCmdDataSource|'
|
| 257 |
+
r'UpdateCmdRefreshCmd|UpdateCmdRefreshFieldList|'
|
| 258 |
+
r'UpdateCmdRefreshKeyFieldList|UpdateCmd|'
|
| 259 |
+
r'UpdateGramSchemaLocation|UpdateGram|UpdateNameList|UpdateType|'
|
| 260 |
+
r'UseCodePage|UseCursorSchema|UseDeDataSource|UseMemoSize|'
|
| 261 |
+
r'UserValue|UseTransactions|UTF8Encoded|Value|VersionComments|'
|
| 262 |
+
r'VersionCompany|VersionCopyright|VersionDescription|'
|
| 263 |
+
r'VersionNumber|VersionProduct|VersionTrademarks|Version|'
|
| 264 |
+
r'VFPXMLProgID|ViewPortHeight|ViewPortLeft|'
|
| 265 |
+
r'ViewPortTop|ViewPortWidth|VScrollSmallChange|View|Visible|'
|
| 266 |
+
r'VisualEffect|WhatsThisButton|WhatsThisHelpID|WhatsThisHelp|'
|
| 267 |
+
r'WhereType|Width|WindowList|WindowState|WindowType|WordWrap|'
|
| 268 |
+
r'WrapCharInCDATA|WrapInCDATA|WrapMemoInCDATA|XMLAdapter|'
|
| 269 |
+
r'XMLConstraints|XMLNameIsXPath|XMLNamespace|XMLName|'
|
| 270 |
+
r'XMLPrefix|XMLSchemaLocation|XMLTable|XMLType|'
|
| 271 |
+
r'XSDfractionDigits|XSDmaxLength|XSDtotalDigits|'
|
| 272 |
+
r'XSDtype|ZoomBox)', Name.Attribute),
|
| 273 |
+
|
| 274 |
+
(r'\.(ActivateCell|AddColumn|AddItem|AddListItem|AddObject|'
|
| 275 |
+
r'AddProperty|AddTableSchema|AddToSCC|Add|'
|
| 276 |
+
r'ApplyDiffgram|Attach|AutoFit|AutoOpen|Box|Build|'
|
| 277 |
+
r'CancelReport|ChangesToCursor|CheckIn|CheckOut|Circle|'
|
| 278 |
+
r'CleanUp|ClearData|ClearStatus|Clear|CloneObject|CloseTables|'
|
| 279 |
+
r'Close|Cls|CursorAttach|CursorDetach|CursorFill|'
|
| 280 |
+
r'CursorRefresh|DataToClip|DelayedMemoFetch|DeleteColumn|'
|
| 281 |
+
r'Dock|DoMessage|DoScroll|DoStatus|DoVerb|Drag|Draw|Eval|'
|
| 282 |
+
r'GetData|GetDockState|GetFormat|GetKey|GetLatestVersion|'
|
| 283 |
+
r'GetPageHeight|GetPageWidth|Help|Hide|IncludePageInOutput|'
|
| 284 |
+
r'IndexToItemID|ItemIDToIndex|Item|LoadXML|Line|Modify|'
|
| 285 |
+
r'MoveItem|Move|Nest|OLEDrag|OnPreviewClose|OutputPage|'
|
| 286 |
+
r'Point|Print|PSet|Quit|ReadExpression|ReadMethod|'
|
| 287 |
+
r'RecordRefresh|Refresh|ReleaseXML|Release|RemoveFromSCC|'
|
| 288 |
+
r'RemoveItem|RemoveListItem|RemoveObject|Remove|'
|
| 289 |
+
r'Render|Requery|RequestData|ResetToDefault|Reset|Run|'
|
| 290 |
+
r'SaveAsClass|SaveAs|SetAll|SetData|SetFocus|SetFormat|'
|
| 291 |
+
r'SetMain|SetVar|SetViewPort|ShowWhatsThis|Show|'
|
| 292 |
+
r'SupportsListenerType|TextHeight|TextWidth|ToCursor|'
|
| 293 |
+
r'ToXML|UndoCheckOut|Unnest|UpdateStatus|WhatsThisMode|'
|
| 294 |
+
r'WriteExpression|WriteMethod|ZOrder)', Name.Function),
|
| 295 |
+
|
| 296 |
+
(r'\.(Activate|AdjustObjectSize|AfterBand|AfterBuild|'
|
| 297 |
+
r'AfterCloseTables|AfterCursorAttach|AfterCursorClose|'
|
| 298 |
+
r'AfterCursorDetach|AfterCursorFill|AfterCursorRefresh|'
|
| 299 |
+
r'AfterCursorUpdate|AfterDelete|AfterInsert|'
|
| 300 |
+
r'AfterRecordRefresh|AfterUpdate|AfterDock|AfterReport|'
|
| 301 |
+
r'AfterRowColChange|BeforeBand|BeforeCursorAttach|'
|
| 302 |
+
r'BeforeCursorClose|BeforeCursorDetach|BeforeCursorFill|'
|
| 303 |
+
r'BeforeCursorRefresh|BeforeCursorUpdate|BeforeDelete|'
|
| 304 |
+
r'BeforeInsert|BeforeDock|BeforeOpenTables|'
|
| 305 |
+
r'BeforeRecordRefresh|BeforeReport|BeforeRowColChange|'
|
| 306 |
+
r'BeforeUpdate|Click|dbc_Activate|dbc_AfterAddTable|'
|
| 307 |
+
r'dbc_AfterAppendProc|dbc_AfterCloseTable|dbc_AfterCopyProc|'
|
| 308 |
+
r'dbc_AfterCreateConnection|dbc_AfterCreateOffline|'
|
| 309 |
+
r'dbc_AfterCreateTable|dbc_AfterCreateView|dbc_AfterDBGetProp|'
|
| 310 |
+
r'dbc_AfterDBSetProp|dbc_AfterDeleteConnection|'
|
| 311 |
+
r'dbc_AfterDropOffline|dbc_AfterDropTable|'
|
| 312 |
+
r'dbc_AfterModifyConnection|dbc_AfterModifyProc|'
|
| 313 |
+
r'dbc_AfterModifyTable|dbc_AfterModifyView|dbc_AfterOpenTable|'
|
| 314 |
+
r'dbc_AfterRemoveTable|dbc_AfterRenameConnection|'
|
| 315 |
+
r'dbc_AfterRenameTable|dbc_AfterRenameView|'
|
| 316 |
+
r'dbc_AfterValidateData|dbc_BeforeAddTable|'
|
| 317 |
+
r'dbc_BeforeAppendProc|dbc_BeforeCloseTable|'
|
| 318 |
+
r'dbc_BeforeCopyProc|dbc_BeforeCreateConnection|'
|
| 319 |
+
r'dbc_BeforeCreateOffline|dbc_BeforeCreateTable|'
|
| 320 |
+
r'dbc_BeforeCreateView|dbc_BeforeDBGetProp|'
|
| 321 |
+
r'dbc_BeforeDBSetProp|dbc_BeforeDeleteConnection|'
|
| 322 |
+
r'dbc_BeforeDropOffline|dbc_BeforeDropTable|'
|
| 323 |
+
r'dbc_BeforeModifyConnection|dbc_BeforeModifyProc|'
|
| 324 |
+
r'dbc_BeforeModifyTable|dbc_BeforeModifyView|'
|
| 325 |
+
r'dbc_BeforeOpenTable|dbc_BeforeRemoveTable|'
|
| 326 |
+
r'dbc_BeforeRenameConnection|dbc_BeforeRenameTable|'
|
| 327 |
+
r'dbc_BeforeRenameView|dbc_BeforeValidateData|'
|
| 328 |
+
r'dbc_CloseData|dbc_Deactivate|dbc_ModifyData|dbc_OpenData|'
|
| 329 |
+
r'dbc_PackData|DblClick|Deactivate|Deleted|Destroy|DoCmd|'
|
| 330 |
+
r'DownClick|DragDrop|DragOver|DropDown|ErrorMessage|Error|'
|
| 331 |
+
r'EvaluateContents|GotFocus|Init|InteractiveChange|KeyPress|'
|
| 332 |
+
r'LoadReport|Load|LostFocus|Message|MiddleClick|MouseDown|'
|
| 333 |
+
r'MouseEnter|MouseLeave|MouseMove|MouseUp|MouseWheel|Moved|'
|
| 334 |
+
r'OLECompleteDrag|OLEDragOver|OLEGiveFeedback|OLESetData|'
|
| 335 |
+
r'OLEStartDrag|OnMoveItem|Paint|ProgrammaticChange|'
|
| 336 |
+
r'QueryAddFile|QueryModifyFile|QueryNewFile|QueryRemoveFile|'
|
| 337 |
+
r'QueryRunFile|QueryUnload|RangeHigh|RangeLow|ReadActivate|'
|
| 338 |
+
r'ReadDeactivate|ReadShow|ReadValid|ReadWhen|Resize|'
|
| 339 |
+
r'RightClick|SCCInit|SCCDestroy|Scrolled|Timer|UIEnable|'
|
| 340 |
+
r'UnDock|UnloadReport|Unload|UpClick|Valid|When)', Name.Function),
|
| 341 |
+
|
| 342 |
+
(r'\s+', Text),
|
| 343 |
+
# everything else is not colored
|
| 344 |
+
(r'.', Text),
|
| 345 |
+
],
|
| 346 |
+
'newline': [
|
| 347 |
+
(r'\*.*?$', Comment.Single, '#pop'),
|
| 348 |
+
(r'(ACCEPT|ACTIVATE\s*MENU|ACTIVATE\s*POPUP|ACTIVATE\s*SCREEN|'
|
| 349 |
+
r'ACTIVATE\s*WINDOW|APPEND|APPEND\s*FROM|APPEND\s*FROM\s*ARRAY|'
|
| 350 |
+
r'APPEND\s*GENERAL|APPEND\s*MEMO|ASSIST|AVERAGE|BLANK|BROWSE|'
|
| 351 |
+
r'BUILD\s*APP|BUILD\s*EXE|BUILD\s*PROJECT|CALCULATE|CALL|'
|
| 352 |
+
r'CANCEL|CHANGE|CLEAR|CLOSE|CLOSE\s*MEMO|COMPILE|CONTINUE|'
|
| 353 |
+
r'COPY\s*FILE|COPY\s*INDEXES|COPY\s*MEMO|COPY\s*STRUCTURE|'
|
| 354 |
+
r'COPY\s*STRUCTURE\s*EXTENDED|COPY\s*TAG|COPY\s*TO|'
|
| 355 |
+
r'COPY\s*TO\s*ARRAY|COUNT|CREATE|CREATE\s*COLOR\s*SET|'
|
| 356 |
+
r'CREATE\s*CURSOR|CREATE\s*FROM|CREATE\s*LABEL|CREATE\s*MENU|'
|
| 357 |
+
r'CREATE\s*PROJECT|CREATE\s*QUERY|CREATE\s*REPORT|'
|
| 358 |
+
r'CREATE\s*SCREEN|CREATE\s*TABLE|CREATE\s*VIEW|DDE|'
|
| 359 |
+
r'DEACTIVATE\s*MENU|DEACTIVATE\s*POPUP|DEACTIVATE\s*WINDOW|'
|
| 360 |
+
r'DECLARE|DEFINE\s*BAR|DEFINE\s*BOX|DEFINE\s*MENU|'
|
| 361 |
+
r'DEFINE\s*PAD|DEFINE\s*POPUP|DEFINE\s*WINDOW|DELETE|'
|
| 362 |
+
r'DELETE\s*FILE|DELETE\s*TAG|DIMENSION|DIRECTORY|DISPLAY|'
|
| 363 |
+
r'DISPLAY\s*FILES|DISPLAY\s*MEMORY|DISPLAY\s*STATUS|'
|
| 364 |
+
r'DISPLAY\s*STRUCTURE|DO|EDIT|EJECT|EJECT\s*PAGE|ERASE|'
|
| 365 |
+
r'EXIT|EXPORT|EXTERNAL|FILER|FIND|FLUSH|FUNCTION|GATHER|'
|
| 366 |
+
r'GETEXPR|GO|GOTO|HELP|HIDE\s*MENU|HIDE\s*POPUP|'
|
| 367 |
+
r'HIDE\s*WINDOW|IMPORT|INDEX|INPUT|INSERT|JOIN|KEYBOARD|'
|
| 368 |
+
r'LABEL|LIST|LOAD|LOCATE|LOOP|MENU|MENU\s*TO|MODIFY\s*COMMAND|'
|
| 369 |
+
r'MODIFY\s*FILE|MODIFY\s*GENERAL|MODIFY\s*LABEL|MODIFY\s*MEMO|'
|
| 370 |
+
r'MODIFY\s*MENU|MODIFY\s*PROJECT|MODIFY\s*QUERY|'
|
| 371 |
+
r'MODIFY\s*REPORT|MODIFY\s*SCREEN|MODIFY\s*STRUCTURE|'
|
| 372 |
+
r'MODIFY\s*WINDOW|MOVE\s*POPUP|MOVE\s*WINDOW|NOTE|'
|
| 373 |
+
r'ON\s*APLABOUT|ON\s*BAR|ON\s*ERROR|ON\s*ESCAPE|'
|
| 374 |
+
r'ON\s*EXIT\s*BAR|ON\s*EXIT\s*MENU|ON\s*EXIT\s*PAD|'
|
| 375 |
+
r'ON\s*EXIT\s*POPUP|ON\s*KEY|ON\s*KEY\s*=|ON\s*KEY\s*LABEL|'
|
| 376 |
+
r'ON\s*MACHELP|ON\s*PAD|ON\s*PAGE|ON\s*READERROR|'
|
| 377 |
+
r'ON\s*SELECTION\s*BAR|ON\s*SELECTION\s*MENU|'
|
| 378 |
+
r'ON\s*SELECTION\s*PAD|ON\s*SELECTION\s*POPUP|ON\s*SHUTDOWN|'
|
| 379 |
+
r'PACK|PARAMETERS|PLAY\s*MACRO|POP\s*KEY|POP\s*MENU|'
|
| 380 |
+
r'POP\s*POPUP|PRIVATE|PROCEDURE|PUBLIC|PUSH\s*KEY|'
|
| 381 |
+
r'PUSH\s*MENU|PUSH\s*POPUP|QUIT|READ|READ\s*MENU|RECALL|'
|
| 382 |
+
r'REINDEX|RELEASE|RELEASE\s*MODULE|RENAME|REPLACE|'
|
| 383 |
+
r'REPLACE\s*FROM\s*ARRAY|REPORT|RESTORE\s*FROM|'
|
| 384 |
+
r'RESTORE\s*MACROS|RESTORE\s*SCREEN|RESTORE\s*WINDOW|'
|
| 385 |
+
r'RESUME|RETRY|RETURN|RUN|RUN\s*\/N"|RUNSCRIPT|'
|
| 386 |
+
r'SAVE\s*MACROS|SAVE\s*SCREEN|SAVE\s*TO|SAVE\s*WINDOWS|'
|
| 387 |
+
r'SCATTER|SCROLL|SEEK|SELECT|SET|SET\s*ALTERNATE|'
|
| 388 |
+
r'SET\s*ANSI|SET\s*APLABOUT|SET\s*AUTOSAVE|SET\s*BELL|'
|
| 389 |
+
r'SET\s*BLINK|SET\s*BLOCKSIZE|SET\s*BORDER|SET\s*BRSTATUS|'
|
| 390 |
+
r'SET\s*CARRY|SET\s*CENTURY|SET\s*CLEAR|SET\s*CLOCK|'
|
| 391 |
+
r'SET\s*COLLATE|SET\s*COLOR\s*OF|SET\s*COLOR\s*OF\s*SCHEME|'
|
| 392 |
+
r'SET\s*COLOR\s*SET|SET\s*COLOR\s*TO|SET\s*COMPATIBLE|'
|
| 393 |
+
r'SET\s*CONFIRM|SET\s*CONSOLE|SET\s*CURRENCY|SET\s*CURSOR|'
|
| 394 |
+
r'SET\s*DATE|SET\s*DEBUG|SET\s*DECIMALS|SET\s*DEFAULT|'
|
| 395 |
+
r'SET\s*DELETED|SET\s*DELIMITERS|SET\s*DEVELOPMENT|'
|
| 396 |
+
r'SET\s*DEVICE|SET\s*DISPLAY|SET\s*DOHISTORY|SET\s*ECHO|'
|
| 397 |
+
r'SET\s*ESCAPE|SET\s*EXACT|SET\s*EXCLUSIVE|SET\s*FIELDS|'
|
| 398 |
+
r'SET\s*FILTER|SET\s*FIXED|SET\s*FORMAT|SET\s*FULLPATH|'
|
| 399 |
+
r'SET\s*FUNCTION|SET\s*HEADINGS|SET\s*HELP|SET\s*HELPFILTER|'
|
| 400 |
+
r'SET\s*HOURS|SET\s*INDEX|SET\s*INTENSITY|SET\s*KEY|'
|
| 401 |
+
r'SET\s*KEYCOMP|SET\s*LIBRARY|SET\s*LOCK|SET\s*LOGERRORS|'
|
| 402 |
+
r'SET\s*MACDESKTOP|SET\s*MACHELP|SET\s*MACKEY|SET\s*MARGIN|'
|
| 403 |
+
r'SET\s*MARK\s*OF|SET\s*MARK\s*TO|SET\s*MEMOWIDTH|'
|
| 404 |
+
r'SET\s*MESSAGE|SET\s*MOUSE|SET\s*MULTILOCKS|SET\s*NEAR|'
|
| 405 |
+
r'SET\s*NOCPTRANS|SET\s*NOTIFY|SET\s*ODOMETER|SET\s*OPTIMIZE|'
|
| 406 |
+
r'SET\s*ORDER|SET\s*PALETTE|SET\s*PATH|SET\s*PDSETUP|'
|
| 407 |
+
r'SET\s*POINT|SET\s*PRINTER|SET\s*PROCEDURE|SET\s*READBORDER|'
|
| 408 |
+
r'SET\s*REFRESH|SET\s*RELATION|SET\s*RELATION\s*OFF|'
|
| 409 |
+
r'SET\s*REPROCESS|SET\s*RESOURCE|SET\s*SAFETY|SET\s*SCOREBOARD|'
|
| 410 |
+
r'SET\s*SEPARATOR|SET\s*SHADOWS|SET\s*SKIP|SET\s*SKIP\s*OF|'
|
| 411 |
+
r'SET\s*SPACE|SET\s*STATUS|SET\s*STATUS\s*BAR|SET\s*STEP|'
|
| 412 |
+
r'SET\s*STICKY|SET\s*SYSMENU|SET\s*TALK|SET\s*TEXTMERGE|'
|
| 413 |
+
r'SET\s*TEXTMERGE\s*DELIMITERS|SET\s*TOPIC|SET\s*TRBETWEEN|'
|
| 414 |
+
r'SET\s*TYPEAHEAD|SET\s*UDFPARMS|SET\s*UNIQUE|SET\s*VIEW|'
|
| 415 |
+
r'SET\s*VOLUME|SET\s*WINDOW\s*OF\s*MEMO|SET\s*XCMDFILE|'
|
| 416 |
+
r'SHOW\s*GET|SHOW\s*GETS|SHOW\s*MENU|SHOW\s*OBJECT|'
|
| 417 |
+
r'SHOW\s*POPUP|SHOW\s*WINDOW|SIZE\s*POPUP|SKIP|SORT|'
|
| 418 |
+
r'STORE|SUM|SUSPEND|TOTAL|TYPE|UNLOCK|UPDATE|USE|WAIT|'
|
| 419 |
+
r'ZAP|ZOOM\s*WINDOW|DO\s*CASE|CASE|OTHERWISE|ENDCASE|'
|
| 420 |
+
r'DO\s*WHILE|ENDDO|FOR|ENDFOR|NEXT|IF|ELSE|ENDIF|PRINTJOB|'
|
| 421 |
+
r'ENDPRINTJOB|SCAN|ENDSCAN|TEXT|ENDTEXT|=)',
|
| 422 |
+
Keyword.Reserved, '#pop'),
|
| 423 |
+
(r'#\s*(IF|ELIF|ELSE|ENDIF|DEFINE|IFDEF|IFNDEF|INCLUDE)',
|
| 424 |
+
Comment.Preproc, '#pop'),
|
| 425 |
+
(r'(m\.)?[a-z_]\w*', Name.Variable, '#pop'),
|
| 426 |
+
(r'.', Text, '#pop'),
|
| 427 |
+
],
|
| 428 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/functional.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.functional
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Just export lexer classes previously contained in this module.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from pygments.lexers.lisp import SchemeLexer, CommonLispLexer, RacketLexer, \
|
| 13 |
+
NewLispLexer, ShenLexer
|
| 14 |
+
from pygments.lexers.haskell import HaskellLexer, LiterateHaskellLexer, \
|
| 15 |
+
KokaLexer
|
| 16 |
+
from pygments.lexers.theorem import CoqLexer
|
| 17 |
+
from pygments.lexers.erlang import ErlangLexer, ErlangShellLexer, \
|
| 18 |
+
ElixirConsoleLexer, ElixirLexer
|
| 19 |
+
from pygments.lexers.ml import SMLLexer, OcamlLexer, OpaLexer
|
| 20 |
+
|
| 21 |
+
__all__ = []
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/go.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.go
|
| 4 |
+
~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for the Google Go language.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, bygroups, words
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation
|
| 17 |
+
|
| 18 |
+
__all__ = ['GoLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class GoLexer(RegexLexer):
|
| 22 |
+
"""
|
| 23 |
+
For `Go <http://golang.org>`_ source.
|
| 24 |
+
|
| 25 |
+
.. versionadded:: 1.2
|
| 26 |
+
"""
|
| 27 |
+
name = 'Go'
|
| 28 |
+
filenames = ['*.go']
|
| 29 |
+
aliases = ['go']
|
| 30 |
+
mimetypes = ['text/x-gosrc']
|
| 31 |
+
|
| 32 |
+
flags = re.MULTILINE | re.UNICODE
|
| 33 |
+
|
| 34 |
+
tokens = {
|
| 35 |
+
'root': [
|
| 36 |
+
(r'\n', Text),
|
| 37 |
+
(r'\s+', Text),
|
| 38 |
+
(r'\\\n', Text), # line continuations
|
| 39 |
+
(r'//(.*?)\n', Comment.Single),
|
| 40 |
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
| 41 |
+
(r'(import|package)\b', Keyword.Namespace),
|
| 42 |
+
(r'(var|func|struct|map|chan|type|interface|const)\b',
|
| 43 |
+
Keyword.Declaration),
|
| 44 |
+
(words((
|
| 45 |
+
'break', 'default', 'select', 'case', 'defer', 'go',
|
| 46 |
+
'else', 'goto', 'switch', 'fallthrough', 'if', 'range',
|
| 47 |
+
'continue', 'for', 'return'), suffix=r'\b'),
|
| 48 |
+
Keyword),
|
| 49 |
+
(r'(true|false|iota|nil)\b', Keyword.Constant),
|
| 50 |
+
# It seems the builtin types aren't actually keywords, but
|
| 51 |
+
# can be used as functions. So we need two declarations.
|
| 52 |
+
(words((
|
| 53 |
+
'uint', 'uint8', 'uint16', 'uint32', 'uint64',
|
| 54 |
+
'int', 'int8', 'int16', 'int32', 'int64',
|
| 55 |
+
'float', 'float32', 'float64',
|
| 56 |
+
'complex64', 'complex128', 'byte', 'rune',
|
| 57 |
+
'string', 'bool', 'error', 'uintptr',
|
| 58 |
+
'print', 'println', 'panic', 'recover', 'close', 'complex',
|
| 59 |
+
'real', 'imag', 'len', 'cap', 'append', 'copy', 'delete',
|
| 60 |
+
'new', 'make'), suffix=r'\b(\()'),
|
| 61 |
+
bygroups(Name.Builtin, Punctuation)),
|
| 62 |
+
(words((
|
| 63 |
+
'uint', 'uint8', 'uint16', 'uint32', 'uint64',
|
| 64 |
+
'int', 'int8', 'int16', 'int32', 'int64',
|
| 65 |
+
'float', 'float32', 'float64',
|
| 66 |
+
'complex64', 'complex128', 'byte', 'rune',
|
| 67 |
+
'string', 'bool', 'error', 'uintptr'), suffix=r'\b'),
|
| 68 |
+
Keyword.Type),
|
| 69 |
+
# imaginary_lit
|
| 70 |
+
(r'\d+i', Number),
|
| 71 |
+
(r'\d+\.\d*([Ee][-+]\d+)?i', Number),
|
| 72 |
+
(r'\.\d+([Ee][-+]\d+)?i', Number),
|
| 73 |
+
(r'\d+[Ee][-+]\d+i', Number),
|
| 74 |
+
# float_lit
|
| 75 |
+
(r'\d+(\.\d+[eE][+\-]?\d+|'
|
| 76 |
+
r'\.\d*|[eE][+\-]?\d+)', Number.Float),
|
| 77 |
+
(r'\.\d+([eE][+\-]?\d+)?', Number.Float),
|
| 78 |
+
# int_lit
|
| 79 |
+
# -- octal_lit
|
| 80 |
+
(r'0[0-7]+', Number.Oct),
|
| 81 |
+
# -- hex_lit
|
| 82 |
+
(r'0[xX][0-9a-fA-F]+', Number.Hex),
|
| 83 |
+
# -- decimal_lit
|
| 84 |
+
(r'(0|[1-9][0-9]*)', Number.Integer),
|
| 85 |
+
# char_lit
|
| 86 |
+
(r"""'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}"""
|
| 87 |
+
r"""|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'""",
|
| 88 |
+
String.Char),
|
| 89 |
+
# StringLiteral
|
| 90 |
+
# -- raw_string_lit
|
| 91 |
+
(r'`[^`]*`', String),
|
| 92 |
+
# -- interpreted_string_lit
|
| 93 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 94 |
+
# Tokens
|
| 95 |
+
(r'(<<=|>>=|<<|>>|<=|>=|&\^=|&\^|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\|'
|
| 96 |
+
r'|<-|\+\+|--|==|!=|:=|\.\.\.|[+\-*/%&])', Operator),
|
| 97 |
+
(r'[|^<>=!()\[\]{}.,;:]', Punctuation),
|
| 98 |
+
# identifier
|
| 99 |
+
(r'[^\W\d]\w*', Name.Other),
|
| 100 |
+
]
|
| 101 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/grammar_notation.py
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.grammar_notation
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for grammer notations like BNF.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, bygroups, include, this, using, words
|
| 15 |
+
from pygments.token import Comment, Keyword, Literal, Name, Number, \
|
| 16 |
+
Operator, Punctuation, String, Text
|
| 17 |
+
|
| 18 |
+
__all__ = ['BnfLexer', 'AbnfLexer', 'JsgfLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class BnfLexer(RegexLexer):
|
| 22 |
+
"""
|
| 23 |
+
This lexer is for grammer notations which are similar to
|
| 24 |
+
original BNF.
|
| 25 |
+
|
| 26 |
+
In order to maximize a number of targets of this lexer,
|
| 27 |
+
let's decide some designs:
|
| 28 |
+
|
| 29 |
+
* We don't distinguish `Terminal Symbol`.
|
| 30 |
+
|
| 31 |
+
* We do assume that `NonTerminal Symbol` are always enclosed
|
| 32 |
+
with arrow brackets.
|
| 33 |
+
|
| 34 |
+
* We do assume that `NonTerminal Symbol` may include
|
| 35 |
+
any printable characters except arrow brackets and ASCII 0x20.
|
| 36 |
+
This assumption is for `RBNF <http://www.rfc-base.org/txt/rfc-5511.txt>`_.
|
| 37 |
+
|
| 38 |
+
* We do assume that target notation doesn't support comment.
|
| 39 |
+
|
| 40 |
+
* We don't distinguish any operators and punctuation except
|
| 41 |
+
`::=`.
|
| 42 |
+
|
| 43 |
+
Though these desision making might cause too minimal highlighting
|
| 44 |
+
and you might be disappointed, but it is reasonable for us.
|
| 45 |
+
|
| 46 |
+
.. versionadded:: 2.1
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
name = 'BNF'
|
| 50 |
+
aliases = ['bnf']
|
| 51 |
+
filenames = ['*.bnf']
|
| 52 |
+
mimetypes = ['text/x-bnf']
|
| 53 |
+
|
| 54 |
+
tokens = {
|
| 55 |
+
'root': [
|
| 56 |
+
(r'(<)([ -;=?-~]+)(>)',
|
| 57 |
+
bygroups(Punctuation, Name.Class, Punctuation)),
|
| 58 |
+
|
| 59 |
+
# an only operator
|
| 60 |
+
(r'::=', Operator),
|
| 61 |
+
|
| 62 |
+
# fallback
|
| 63 |
+
(r'[^<>:]+', Text), # for performance
|
| 64 |
+
(r'.', Text),
|
| 65 |
+
],
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class AbnfLexer(RegexLexer):
|
| 70 |
+
"""
|
| 71 |
+
Lexer for `IETF 7405 ABNF
|
| 72 |
+
<http://www.ietf.org/rfc/rfc7405.txt>`_
|
| 73 |
+
(Updates `5234 <http://www.ietf.org/rfc/rfc5234.txt>`_)
|
| 74 |
+
grammars.
|
| 75 |
+
|
| 76 |
+
.. versionadded:: 2.1
|
| 77 |
+
"""
|
| 78 |
+
|
| 79 |
+
name = 'ABNF'
|
| 80 |
+
aliases = ['abnf']
|
| 81 |
+
filenames = ['*.abnf']
|
| 82 |
+
mimetypes = ['text/x-abnf']
|
| 83 |
+
|
| 84 |
+
_core_rules = (
|
| 85 |
+
'ALPHA', 'BIT', 'CHAR', 'CR', 'CRLF', 'CTL', 'DIGIT',
|
| 86 |
+
'DQUOTE', 'HEXDIG', 'HTAB', 'LF', 'LWSP', 'OCTET',
|
| 87 |
+
'SP', 'VCHAR', 'WSP')
|
| 88 |
+
|
| 89 |
+
tokens = {
|
| 90 |
+
'root': [
|
| 91 |
+
# comment
|
| 92 |
+
(r';.*$', Comment.Single),
|
| 93 |
+
|
| 94 |
+
# quoted
|
| 95 |
+
# double quote itself in this state, it is as '%x22'.
|
| 96 |
+
(r'(%[si])?"[^"]*"', Literal),
|
| 97 |
+
|
| 98 |
+
# binary (but i have never seen...)
|
| 99 |
+
(r'%b[01]+\-[01]+\b', Literal), # range
|
| 100 |
+
(r'%b[01]+(\.[01]+)*\b', Literal), # concat
|
| 101 |
+
|
| 102 |
+
# decimal
|
| 103 |
+
(r'%d[0-9]+\-[0-9]+\b', Literal), # range
|
| 104 |
+
(r'%d[0-9]+(\.[0-9]+)*\b', Literal), # concat
|
| 105 |
+
|
| 106 |
+
# hexadecimal
|
| 107 |
+
(r'%x[0-9a-fA-F]+\-[0-9a-fA-F]+\b', Literal), # range
|
| 108 |
+
(r'%x[0-9a-fA-F]+(\.[0-9a-fA-F]+)*\b', Literal), # concat
|
| 109 |
+
|
| 110 |
+
# repetition (<a>*<b>element) including nRule
|
| 111 |
+
(r'\b[0-9]+\*[0-9]+', Operator),
|
| 112 |
+
(r'\b[0-9]+\*', Operator),
|
| 113 |
+
(r'\b[0-9]+', Operator),
|
| 114 |
+
(r'\*', Operator),
|
| 115 |
+
|
| 116 |
+
# Strictly speaking, these are not keyword but
|
| 117 |
+
# are called `Core Rule'.
|
| 118 |
+
(words(_core_rules, suffix=r'\b'), Keyword),
|
| 119 |
+
|
| 120 |
+
# nonterminals (ALPHA *(ALPHA / DIGIT / "-"))
|
| 121 |
+
(r'[a-zA-Z][a-zA-Z0-9-]+\b', Name.Class),
|
| 122 |
+
|
| 123 |
+
# operators
|
| 124 |
+
(r'(=/|=|/)', Operator),
|
| 125 |
+
|
| 126 |
+
# punctuation
|
| 127 |
+
(r'[\[\]()]', Punctuation),
|
| 128 |
+
|
| 129 |
+
# fallback
|
| 130 |
+
(r'\s+', Text),
|
| 131 |
+
(r'.', Text),
|
| 132 |
+
],
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
class JsgfLexer(RegexLexer):
|
| 137 |
+
"""
|
| 138 |
+
For `JSpeech Grammar Format <https://www.w3.org/TR/jsgf/>`_
|
| 139 |
+
grammars.
|
| 140 |
+
|
| 141 |
+
.. versionadded:: 2.2
|
| 142 |
+
"""
|
| 143 |
+
name = 'JSGF'
|
| 144 |
+
aliases = ['jsgf']
|
| 145 |
+
filenames = ['*.jsgf']
|
| 146 |
+
mimetypes = ['application/jsgf', 'application/x-jsgf', 'text/jsgf']
|
| 147 |
+
|
| 148 |
+
flags = re.MULTILINE | re.UNICODE
|
| 149 |
+
|
| 150 |
+
tokens = {
|
| 151 |
+
'root': [
|
| 152 |
+
include('comments'),
|
| 153 |
+
include('non-comments'),
|
| 154 |
+
],
|
| 155 |
+
'comments': [
|
| 156 |
+
(r'/\*\*(?!/)', Comment.Multiline, 'documentation comment'),
|
| 157 |
+
(r'/\*[\w\W]*?\*/', Comment.Multiline),
|
| 158 |
+
(r'//.*', Comment.Single),
|
| 159 |
+
],
|
| 160 |
+
'non-comments': [
|
| 161 |
+
('\A#JSGF[^;]*', Comment.Preproc),
|
| 162 |
+
(r'\s+', Text),
|
| 163 |
+
(r';', Punctuation),
|
| 164 |
+
(r'[=|()\[\]*+]', Operator),
|
| 165 |
+
(r'/[^/]+/', Number.Float),
|
| 166 |
+
(r'"', String.Double, 'string'),
|
| 167 |
+
(r'\{', String.Other, 'tag'),
|
| 168 |
+
(words(('import', 'public'), suffix=r'\b'), Keyword.Reserved),
|
| 169 |
+
(r'grammar\b', Keyword.Reserved, 'grammar name'),
|
| 170 |
+
(r'(<)(NULL|VOID)(>)',
|
| 171 |
+
bygroups(Punctuation, Name.Builtin, Punctuation)),
|
| 172 |
+
(r'<', Punctuation, 'rulename'),
|
| 173 |
+
(r'\w+|[^\s;=|()\[\]*+/"{<\w]+', Text),
|
| 174 |
+
],
|
| 175 |
+
'string': [
|
| 176 |
+
(r'"', String.Double, '#pop'),
|
| 177 |
+
(r'\\.', String.Escape),
|
| 178 |
+
(r'[^\\"]+', String.Double),
|
| 179 |
+
],
|
| 180 |
+
'tag': [
|
| 181 |
+
(r'\}', String.Other, '#pop'),
|
| 182 |
+
(r'\\.', String.Escape),
|
| 183 |
+
(r'[^\\}]+', String.Other),
|
| 184 |
+
],
|
| 185 |
+
'grammar name': [
|
| 186 |
+
(r';', Punctuation, '#pop'),
|
| 187 |
+
(r'\s+', Text),
|
| 188 |
+
(r'\.', Punctuation),
|
| 189 |
+
(r'[^;\s.]+', Name.Namespace),
|
| 190 |
+
],
|
| 191 |
+
'rulename': [
|
| 192 |
+
(r'>', Punctuation, '#pop'),
|
| 193 |
+
(r'\*', Punctuation),
|
| 194 |
+
(r'\s+', Text),
|
| 195 |
+
(r'([^.>]+)(\s*)(\.)', bygroups(Name.Namespace, Text, Punctuation)),
|
| 196 |
+
(r'[^.>]+', Name.Constant),
|
| 197 |
+
],
|
| 198 |
+
'documentation comment': [
|
| 199 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 200 |
+
(r'(^\s*\*?\s*)(@(?:example|see)\s+)'
|
| 201 |
+
r'([\w\W]*?(?=(?:^\s*\*?\s*@|\*/)))',
|
| 202 |
+
bygroups(Comment.Multiline, Comment.Special,
|
| 203 |
+
using(this, state='example'))),
|
| 204 |
+
(r'(^\s*\*?\s*)(@\S*)',
|
| 205 |
+
bygroups(Comment.Multiline, Comment.Special)),
|
| 206 |
+
(r'[^*\n@]+|\w|\W', Comment.Multiline),
|
| 207 |
+
],
|
| 208 |
+
'example': [
|
| 209 |
+
(r'\n\s*\*', Comment.Multiline),
|
| 210 |
+
include('non-comments'),
|
| 211 |
+
(r'.', Comment.Multiline),
|
| 212 |
+
],
|
| 213 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/graph.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.graph
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for graph query languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, include, bygroups, using, this
|
| 15 |
+
from pygments.token import Keyword, Punctuation, Comment, Operator, Name,\
|
| 16 |
+
String, Number, Whitespace
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
__all__ = ['CypherLexer']
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class CypherLexer(RegexLexer):
|
| 23 |
+
"""
|
| 24 |
+
For `Cypher Query Language
|
| 25 |
+
<http://docs.neo4j.org/chunked/milestone/cypher-query-lang.html>`_
|
| 26 |
+
|
| 27 |
+
For the Cypher version in Neo4J 2.0
|
| 28 |
+
|
| 29 |
+
.. versionadded:: 2.0
|
| 30 |
+
"""
|
| 31 |
+
name = 'Cypher'
|
| 32 |
+
aliases = ['cypher']
|
| 33 |
+
filenames = ['*.cyp', '*.cypher']
|
| 34 |
+
|
| 35 |
+
flags = re.MULTILINE | re.IGNORECASE
|
| 36 |
+
|
| 37 |
+
tokens = {
|
| 38 |
+
'root': [
|
| 39 |
+
include('comment'),
|
| 40 |
+
include('keywords'),
|
| 41 |
+
include('clauses'),
|
| 42 |
+
include('relations'),
|
| 43 |
+
include('strings'),
|
| 44 |
+
include('whitespace'),
|
| 45 |
+
include('barewords'),
|
| 46 |
+
],
|
| 47 |
+
'comment': [
|
| 48 |
+
(r'^.*//.*\n', Comment.Single),
|
| 49 |
+
],
|
| 50 |
+
'keywords': [
|
| 51 |
+
(r'(create|order|match|limit|set|skip|start|return|with|where|'
|
| 52 |
+
r'delete|foreach|not|by)\b', Keyword),
|
| 53 |
+
],
|
| 54 |
+
'clauses': [
|
| 55 |
+
# TODO: many missing ones, see http://docs.neo4j.org/refcard/2.0/
|
| 56 |
+
(r'(all|any|as|asc|create|create\s+unique|delete|'
|
| 57 |
+
r'desc|distinct|foreach|in|is\s+null|limit|match|none|'
|
| 58 |
+
r'order\s+by|return|set|skip|single|start|union|where|with)\b',
|
| 59 |
+
Keyword),
|
| 60 |
+
],
|
| 61 |
+
'relations': [
|
| 62 |
+
(r'(-\[)(.*?)(\]->)', bygroups(Operator, using(this), Operator)),
|
| 63 |
+
(r'(<-\[)(.*?)(\]-)', bygroups(Operator, using(this), Operator)),
|
| 64 |
+
(r'(-\[)(.*?)(\]-)', bygroups(Operator, using(this), Operator)),
|
| 65 |
+
(r'-->|<--|\[|\]', Operator),
|
| 66 |
+
(r'<|>|<>|=|<=|=>|\(|\)|\||:|,|;', Punctuation),
|
| 67 |
+
(r'[.*{}]', Punctuation),
|
| 68 |
+
],
|
| 69 |
+
'strings': [
|
| 70 |
+
(r'"(?:\\[tbnrf\'"\\]|[^\\"])*"', String),
|
| 71 |
+
(r'`(?:``|[^`])+`', Name.Variable),
|
| 72 |
+
],
|
| 73 |
+
'whitespace': [
|
| 74 |
+
(r'\s+', Whitespace),
|
| 75 |
+
],
|
| 76 |
+
'barewords': [
|
| 77 |
+
(r'[a-z]\w*', Name),
|
| 78 |
+
(r'\d+', Number),
|
| 79 |
+
],
|
| 80 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/graphics.py
ADDED
|
@@ -0,0 +1,553 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.graphics
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for computer graphics and plotting related languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from pygments.lexer import RegexLexer, words, include, bygroups, using, \
|
| 13 |
+
this, default
|
| 14 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, \
|
| 15 |
+
Number, Punctuation, String
|
| 16 |
+
|
| 17 |
+
__all__ = ['GLShaderLexer', 'PostScriptLexer', 'AsymptoteLexer', 'GnuplotLexer',
|
| 18 |
+
'PovrayLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class GLShaderLexer(RegexLexer):
|
| 22 |
+
"""
|
| 23 |
+
GLSL (OpenGL Shader) lexer.
|
| 24 |
+
|
| 25 |
+
.. versionadded:: 1.1
|
| 26 |
+
"""
|
| 27 |
+
name = 'GLSL'
|
| 28 |
+
aliases = ['glsl']
|
| 29 |
+
filenames = ['*.vert', '*.frag', '*.geo']
|
| 30 |
+
mimetypes = ['text/x-glslsrc']
|
| 31 |
+
|
| 32 |
+
tokens = {
|
| 33 |
+
'root': [
|
| 34 |
+
(r'^#.*', Comment.Preproc),
|
| 35 |
+
(r'//.*', Comment.Single),
|
| 36 |
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
| 37 |
+
(r'\+|-|~|!=?|\*|/|%|<<|>>|<=?|>=?|==?|&&?|\^|\|\|?',
|
| 38 |
+
Operator),
|
| 39 |
+
(r'[?:]', Operator), # quick hack for ternary
|
| 40 |
+
(r'\bdefined\b', Operator),
|
| 41 |
+
(r'[;{}(),\[\]]', Punctuation),
|
| 42 |
+
# FIXME when e is present, no decimal point needed
|
| 43 |
+
(r'[+-]?\d*\.\d+([eE][-+]?\d+)?', Number.Float),
|
| 44 |
+
(r'[+-]?\d+\.\d*([eE][-+]?\d+)?', Number.Float),
|
| 45 |
+
(r'0[xX][0-9a-fA-F]*', Number.Hex),
|
| 46 |
+
(r'0[0-7]*', Number.Oct),
|
| 47 |
+
(r'[1-9][0-9]*', Number.Integer),
|
| 48 |
+
(words((
|
| 49 |
+
'attribute', 'const', 'uniform', 'varying', 'centroid', 'break',
|
| 50 |
+
'continue', 'do', 'for', 'while', 'if', 'else', 'in', 'out',
|
| 51 |
+
'inout', 'float', 'int', 'void', 'bool', 'true', 'false',
|
| 52 |
+
'invariant', 'discard', 'return', 'mat2', 'mat3' 'mat4',
|
| 53 |
+
'mat2x2', 'mat3x2', 'mat4x2', 'mat2x3', 'mat3x3', 'mat4x3',
|
| 54 |
+
'mat2x4', 'mat3x4', 'mat4x4', 'vec2', 'vec3', 'vec4',
|
| 55 |
+
'ivec2', 'ivec3', 'ivec4', 'bvec2', 'bvec3', 'bvec4',
|
| 56 |
+
'sampler1D', 'sampler2D', 'sampler3D' 'samplerCube',
|
| 57 |
+
'sampler1DShadow', 'sampler2DShadow', 'struct'),
|
| 58 |
+
prefix=r'\b', suffix=r'\b'),
|
| 59 |
+
Keyword),
|
| 60 |
+
(words((
|
| 61 |
+
'asm', 'class', 'union', 'enum', 'typedef', 'template', 'this',
|
| 62 |
+
'packed', 'goto', 'switch', 'default', 'inline', 'noinline',
|
| 63 |
+
'volatile', 'public', 'static', 'extern', 'external', 'interface',
|
| 64 |
+
'long', 'short', 'double', 'half', 'fixed', 'unsigned', 'lowp',
|
| 65 |
+
'mediump', 'highp', 'precision', 'input', 'output',
|
| 66 |
+
'hvec2', 'hvec3', 'hvec4', 'dvec2', 'dvec3', 'dvec4',
|
| 67 |
+
'fvec2', 'fvec3', 'fvec4', 'sampler2DRect', 'sampler3DRect',
|
| 68 |
+
'sampler2DRectShadow', 'sizeof', 'cast', 'namespace', 'using'),
|
| 69 |
+
prefix=r'\b', suffix=r'\b'),
|
| 70 |
+
Keyword), # future use
|
| 71 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 72 |
+
(r'\.', Punctuation),
|
| 73 |
+
(r'\s+', Text),
|
| 74 |
+
],
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
class PostScriptLexer(RegexLexer):
|
| 79 |
+
"""
|
| 80 |
+
Lexer for PostScript files.
|
| 81 |
+
|
| 82 |
+
The PostScript Language Reference published by Adobe at
|
| 83 |
+
<http://partners.adobe.com/public/developer/en/ps/PLRM.pdf>
|
| 84 |
+
is the authority for this.
|
| 85 |
+
|
| 86 |
+
.. versionadded:: 1.4
|
| 87 |
+
"""
|
| 88 |
+
name = 'PostScript'
|
| 89 |
+
aliases = ['postscript', 'postscr']
|
| 90 |
+
filenames = ['*.ps', '*.eps']
|
| 91 |
+
mimetypes = ['application/postscript']
|
| 92 |
+
|
| 93 |
+
delimiter = r'()<>\[\]{}/%\s'
|
| 94 |
+
delimiter_end = r'(?=[%s])' % delimiter
|
| 95 |
+
|
| 96 |
+
valid_name_chars = r'[^%s]' % delimiter
|
| 97 |
+
valid_name = r"%s+%s" % (valid_name_chars, delimiter_end)
|
| 98 |
+
|
| 99 |
+
tokens = {
|
| 100 |
+
'root': [
|
| 101 |
+
# All comment types
|
| 102 |
+
(r'^%!.+\n', Comment.Preproc),
|
| 103 |
+
(r'%%.*\n', Comment.Special),
|
| 104 |
+
(r'(^%.*\n){2,}', Comment.Multiline),
|
| 105 |
+
(r'%.*\n', Comment.Single),
|
| 106 |
+
|
| 107 |
+
# String literals are awkward; enter separate state.
|
| 108 |
+
(r'\(', String, 'stringliteral'),
|
| 109 |
+
|
| 110 |
+
(r'[{}<>\[\]]', Punctuation),
|
| 111 |
+
|
| 112 |
+
# Numbers
|
| 113 |
+
(r'<[0-9A-Fa-f]+>' + delimiter_end, Number.Hex),
|
| 114 |
+
# Slight abuse: use Oct to signify any explicit base system
|
| 115 |
+
(r'[0-9]+\#(\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)'
|
| 116 |
+
r'((e|E)[0-9]+)?' + delimiter_end, Number.Oct),
|
| 117 |
+
(r'(\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)((e|E)[0-9]+)?'
|
| 118 |
+
+ delimiter_end, Number.Float),
|
| 119 |
+
(r'(\-|\+)?[0-9]+' + delimiter_end, Number.Integer),
|
| 120 |
+
|
| 121 |
+
# References
|
| 122 |
+
(r'\/%s' % valid_name, Name.Variable),
|
| 123 |
+
|
| 124 |
+
# Names
|
| 125 |
+
(valid_name, Name.Function), # Anything else is executed
|
| 126 |
+
|
| 127 |
+
# These keywords taken from
|
| 128 |
+
# <http://www.math.ubc.ca/~cass/graphics/manual/pdf/a1.pdf>
|
| 129 |
+
# Is there an authoritative list anywhere that doesn't involve
|
| 130 |
+
# trawling documentation?
|
| 131 |
+
|
| 132 |
+
(r'(false|true)' + delimiter_end, Keyword.Constant),
|
| 133 |
+
|
| 134 |
+
# Conditionals / flow control
|
| 135 |
+
(r'(eq|ne|g[et]|l[et]|and|or|not|if(?:else)?|for(?:all)?)'
|
| 136 |
+
+ delimiter_end, Keyword.Reserved),
|
| 137 |
+
|
| 138 |
+
(words((
|
| 139 |
+
'abs', 'add', 'aload', 'arc', 'arcn', 'array', 'atan', 'begin',
|
| 140 |
+
'bind', 'ceiling', 'charpath', 'clip', 'closepath', 'concat',
|
| 141 |
+
'concatmatrix', 'copy', 'cos', 'currentlinewidth', 'currentmatrix',
|
| 142 |
+
'currentpoint', 'curveto', 'cvi', 'cvs', 'def', 'defaultmatrix',
|
| 143 |
+
'dict', 'dictstackoverflow', 'div', 'dtransform', 'dup', 'end',
|
| 144 |
+
'exch', 'exec', 'exit', 'exp', 'fill', 'findfont', 'floor', 'get',
|
| 145 |
+
'getinterval', 'grestore', 'gsave', 'gt', 'identmatrix', 'idiv',
|
| 146 |
+
'idtransform', 'index', 'invertmatrix', 'itransform', 'length',
|
| 147 |
+
'lineto', 'ln', 'load', 'log', 'loop', 'matrix', 'mod', 'moveto',
|
| 148 |
+
'mul', 'neg', 'newpath', 'pathforall', 'pathbbox', 'pop', 'print',
|
| 149 |
+
'pstack', 'put', 'quit', 'rand', 'rangecheck', 'rcurveto', 'repeat',
|
| 150 |
+
'restore', 'rlineto', 'rmoveto', 'roll', 'rotate', 'round', 'run',
|
| 151 |
+
'save', 'scale', 'scalefont', 'setdash', 'setfont', 'setgray',
|
| 152 |
+
'setlinecap', 'setlinejoin', 'setlinewidth', 'setmatrix',
|
| 153 |
+
'setrgbcolor', 'shfill', 'show', 'showpage', 'sin', 'sqrt',
|
| 154 |
+
'stack', 'stringwidth', 'stroke', 'strokepath', 'sub', 'syntaxerror',
|
| 155 |
+
'transform', 'translate', 'truncate', 'typecheck', 'undefined',
|
| 156 |
+
'undefinedfilename', 'undefinedresult'), suffix=delimiter_end),
|
| 157 |
+
Name.Builtin),
|
| 158 |
+
|
| 159 |
+
(r'\s+', Text),
|
| 160 |
+
],
|
| 161 |
+
|
| 162 |
+
'stringliteral': [
|
| 163 |
+
(r'[^()\\]+', String),
|
| 164 |
+
(r'\\', String.Escape, 'escape'),
|
| 165 |
+
(r'\(', String, '#push'),
|
| 166 |
+
(r'\)', String, '#pop'),
|
| 167 |
+
],
|
| 168 |
+
|
| 169 |
+
'escape': [
|
| 170 |
+
(r'[0-8]{3}|n|r|t|b|f|\\|\(|\)', String.Escape, '#pop'),
|
| 171 |
+
default('#pop'),
|
| 172 |
+
],
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
class AsymptoteLexer(RegexLexer):
|
| 177 |
+
"""
|
| 178 |
+
For `Asymptote <http://asymptote.sf.net/>`_ source code.
|
| 179 |
+
|
| 180 |
+
.. versionadded:: 1.2
|
| 181 |
+
"""
|
| 182 |
+
name = 'Asymptote'
|
| 183 |
+
aliases = ['asy', 'asymptote']
|
| 184 |
+
filenames = ['*.asy']
|
| 185 |
+
mimetypes = ['text/x-asymptote']
|
| 186 |
+
|
| 187 |
+
#: optional Comment or Whitespace
|
| 188 |
+
_ws = r'(?:\s|//.*?\n|/\*.*?\*/)+'
|
| 189 |
+
|
| 190 |
+
tokens = {
|
| 191 |
+
'whitespace': [
|
| 192 |
+
(r'\n', Text),
|
| 193 |
+
(r'\s+', Text),
|
| 194 |
+
(r'\\\n', Text), # line continuation
|
| 195 |
+
(r'//(\n|(.|\n)*?[^\\]\n)', Comment),
|
| 196 |
+
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment),
|
| 197 |
+
],
|
| 198 |
+
'statements': [
|
| 199 |
+
# simple string (TeX friendly)
|
| 200 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 201 |
+
# C style string (with character escapes)
|
| 202 |
+
(r"'", String, 'string'),
|
| 203 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
|
| 204 |
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
| 205 |
+
(r'0x[0-9a-fA-F]+[Ll]?', Number.Hex),
|
| 206 |
+
(r'0[0-7]+[Ll]?', Number.Oct),
|
| 207 |
+
(r'\d+[Ll]?', Number.Integer),
|
| 208 |
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
| 209 |
+
(r'[()\[\],.]', Punctuation),
|
| 210 |
+
(r'\b(case)(.+?)(:)', bygroups(Keyword, using(this), Text)),
|
| 211 |
+
(r'(and|controls|tension|atleast|curl|if|else|while|for|do|'
|
| 212 |
+
r'return|break|continue|struct|typedef|new|access|import|'
|
| 213 |
+
r'unravel|from|include|quote|static|public|private|restricted|'
|
| 214 |
+
r'this|explicit|true|false|null|cycle|newframe|operator)\b', Keyword),
|
| 215 |
+
# Since an asy-type-name can be also an asy-function-name,
|
| 216 |
+
# in the following we test if the string " [a-zA-Z]" follows
|
| 217 |
+
# the Keyword.Type.
|
| 218 |
+
# Of course it is not perfect !
|
| 219 |
+
(r'(Braid|FitResult|Label|Legend|TreeNode|abscissa|arc|arrowhead|'
|
| 220 |
+
r'binarytree|binarytreeNode|block|bool|bool3|bounds|bqe|circle|'
|
| 221 |
+
r'conic|coord|coordsys|cputime|ellipse|file|filltype|frame|grid3|'
|
| 222 |
+
r'guide|horner|hsv|hyperbola|indexedTransform|int|inversion|key|'
|
| 223 |
+
r'light|line|linefit|marginT|marker|mass|object|pair|parabola|path|'
|
| 224 |
+
r'path3|pen|picture|point|position|projection|real|revolution|'
|
| 225 |
+
r'scaleT|scientific|segment|side|slice|splitface|string|surface|'
|
| 226 |
+
r'tensionSpecifier|ticklocate|ticksgridT|tickvalues|transform|'
|
| 227 |
+
r'transformation|tree|triangle|trilinear|triple|vector|'
|
| 228 |
+
r'vertex|void)(?=\s+[a-zA-Z])', Keyword.Type),
|
| 229 |
+
# Now the asy-type-name which are not asy-function-name
|
| 230 |
+
# except yours !
|
| 231 |
+
# Perhaps useless
|
| 232 |
+
(r'(Braid|FitResult|TreeNode|abscissa|arrowhead|block|bool|bool3|'
|
| 233 |
+
r'bounds|coord|frame|guide|horner|int|linefit|marginT|pair|pen|'
|
| 234 |
+
r'picture|position|real|revolution|slice|splitface|ticksgridT|'
|
| 235 |
+
r'tickvalues|tree|triple|vertex|void)\b', Keyword.Type),
|
| 236 |
+
('[a-zA-Z_]\w*:(?!:)', Name.Label),
|
| 237 |
+
('[a-zA-Z_]\w*', Name),
|
| 238 |
+
],
|
| 239 |
+
'root': [
|
| 240 |
+
include('whitespace'),
|
| 241 |
+
# functions
|
| 242 |
+
(r'((?:[\w*\s])+?(?:\s|\*))' # return arguments
|
| 243 |
+
r'([a-zA-Z_]\w*)' # method name
|
| 244 |
+
r'(\s*\([^;]*?\))' # signature
|
| 245 |
+
r'(' + _ws + r')(\{)',
|
| 246 |
+
bygroups(using(this), Name.Function, using(this), using(this),
|
| 247 |
+
Punctuation),
|
| 248 |
+
'function'),
|
| 249 |
+
# function declarations
|
| 250 |
+
(r'((?:[\w*\s])+?(?:\s|\*))' # return arguments
|
| 251 |
+
r'([a-zA-Z_]\w*)' # method name
|
| 252 |
+
r'(\s*\([^;]*?\))' # signature
|
| 253 |
+
r'(' + _ws + r')(;)',
|
| 254 |
+
bygroups(using(this), Name.Function, using(this), using(this),
|
| 255 |
+
Punctuation)),
|
| 256 |
+
default('statement'),
|
| 257 |
+
],
|
| 258 |
+
'statement': [
|
| 259 |
+
include('whitespace'),
|
| 260 |
+
include('statements'),
|
| 261 |
+
('[{}]', Punctuation),
|
| 262 |
+
(';', Punctuation, '#pop'),
|
| 263 |
+
],
|
| 264 |
+
'function': [
|
| 265 |
+
include('whitespace'),
|
| 266 |
+
include('statements'),
|
| 267 |
+
(';', Punctuation),
|
| 268 |
+
(r'\{', Punctuation, '#push'),
|
| 269 |
+
(r'\}', Punctuation, '#pop'),
|
| 270 |
+
],
|
| 271 |
+
'string': [
|
| 272 |
+
(r"'", String, '#pop'),
|
| 273 |
+
(r'\\([\\abfnrtv"\'?]|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
| 274 |
+
(r'\n', String),
|
| 275 |
+
(r"[^\\'\n]+", String), # all other characters
|
| 276 |
+
(r'\\\n', String),
|
| 277 |
+
(r'\\n', String), # line continuation
|
| 278 |
+
(r'\\', String), # stray backslash
|
| 279 |
+
],
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
def get_tokens_unprocessed(self, text):
|
| 283 |
+
from pygments.lexers._asy_builtins import ASYFUNCNAME, ASYVARNAME
|
| 284 |
+
for index, token, value in \
|
| 285 |
+
RegexLexer.get_tokens_unprocessed(self, text):
|
| 286 |
+
if token is Name and value in ASYFUNCNAME:
|
| 287 |
+
token = Name.Function
|
| 288 |
+
elif token is Name and value in ASYVARNAME:
|
| 289 |
+
token = Name.Variable
|
| 290 |
+
yield index, token, value
|
| 291 |
+
|
| 292 |
+
|
| 293 |
+
def _shortened(word):
|
| 294 |
+
dpos = word.find('$')
|
| 295 |
+
return '|'.join(word[:dpos] + word[dpos+1:i] + r'\b'
|
| 296 |
+
for i in range(len(word), dpos, -1))
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
def _shortened_many(*words):
|
| 300 |
+
return '|'.join(map(_shortened, words))
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
class GnuplotLexer(RegexLexer):
|
| 304 |
+
"""
|
| 305 |
+
For `Gnuplot <http://gnuplot.info/>`_ plotting scripts.
|
| 306 |
+
|
| 307 |
+
.. versionadded:: 0.11
|
| 308 |
+
"""
|
| 309 |
+
|
| 310 |
+
name = 'Gnuplot'
|
| 311 |
+
aliases = ['gnuplot']
|
| 312 |
+
filenames = ['*.plot', '*.plt']
|
| 313 |
+
mimetypes = ['text/x-gnuplot']
|
| 314 |
+
|
| 315 |
+
tokens = {
|
| 316 |
+
'root': [
|
| 317 |
+
include('whitespace'),
|
| 318 |
+
(_shortened('bi$nd'), Keyword, 'bind'),
|
| 319 |
+
(_shortened_many('ex$it', 'q$uit'), Keyword, 'quit'),
|
| 320 |
+
(_shortened('f$it'), Keyword, 'fit'),
|
| 321 |
+
(r'(if)(\s*)(\()', bygroups(Keyword, Text, Punctuation), 'if'),
|
| 322 |
+
(r'else\b', Keyword),
|
| 323 |
+
(_shortened('pa$use'), Keyword, 'pause'),
|
| 324 |
+
(_shortened_many('p$lot', 'rep$lot', 'sp$lot'), Keyword, 'plot'),
|
| 325 |
+
(_shortened('sa$ve'), Keyword, 'save'),
|
| 326 |
+
(_shortened('se$t'), Keyword, ('genericargs', 'optionarg')),
|
| 327 |
+
(_shortened_many('sh$ow', 'uns$et'),
|
| 328 |
+
Keyword, ('noargs', 'optionarg')),
|
| 329 |
+
(_shortened_many('low$er', 'ra$ise', 'ca$ll', 'cd$', 'cl$ear',
|
| 330 |
+
'h$elp', '\\?$', 'hi$story', 'l$oad', 'pr$int',
|
| 331 |
+
'pwd$', 're$read', 'res$et', 'scr$eendump',
|
| 332 |
+
'she$ll', 'sy$stem', 'up$date'),
|
| 333 |
+
Keyword, 'genericargs'),
|
| 334 |
+
(_shortened_many('pwd$', 're$read', 'res$et', 'scr$eendump',
|
| 335 |
+
'she$ll', 'test$'),
|
| 336 |
+
Keyword, 'noargs'),
|
| 337 |
+
('([a-zA-Z_]\w*)(\s*)(=)',
|
| 338 |
+
bygroups(Name.Variable, Text, Operator), 'genericargs'),
|
| 339 |
+
('([a-zA-Z_]\w*)(\s*\(.*?\)\s*)(=)',
|
| 340 |
+
bygroups(Name.Function, Text, Operator), 'genericargs'),
|
| 341 |
+
(r'@[a-zA-Z_]\w*', Name.Constant), # macros
|
| 342 |
+
(r';', Keyword),
|
| 343 |
+
],
|
| 344 |
+
'comment': [
|
| 345 |
+
(r'[^\\\n]', Comment),
|
| 346 |
+
(r'\\\n', Comment),
|
| 347 |
+
(r'\\', Comment),
|
| 348 |
+
# don't add the newline to the Comment token
|
| 349 |
+
default('#pop'),
|
| 350 |
+
],
|
| 351 |
+
'whitespace': [
|
| 352 |
+
('#', Comment, 'comment'),
|
| 353 |
+
(r'[ \t\v\f]+', Text),
|
| 354 |
+
],
|
| 355 |
+
'noargs': [
|
| 356 |
+
include('whitespace'),
|
| 357 |
+
# semicolon and newline end the argument list
|
| 358 |
+
(r';', Punctuation, '#pop'),
|
| 359 |
+
(r'\n', Text, '#pop'),
|
| 360 |
+
],
|
| 361 |
+
'dqstring': [
|
| 362 |
+
(r'"', String, '#pop'),
|
| 363 |
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
| 364 |
+
(r'[^\\"\n]+', String), # all other characters
|
| 365 |
+
(r'\\\n', String), # line continuation
|
| 366 |
+
(r'\\', String), # stray backslash
|
| 367 |
+
(r'\n', String, '#pop'), # newline ends the string too
|
| 368 |
+
],
|
| 369 |
+
'sqstring': [
|
| 370 |
+
(r"''", String), # escaped single quote
|
| 371 |
+
(r"'", String, '#pop'),
|
| 372 |
+
(r"[^\\'\n]+", String), # all other characters
|
| 373 |
+
(r'\\\n', String), # line continuation
|
| 374 |
+
(r'\\', String), # normal backslash
|
| 375 |
+
(r'\n', String, '#pop'), # newline ends the string too
|
| 376 |
+
],
|
| 377 |
+
'genericargs': [
|
| 378 |
+
include('noargs'),
|
| 379 |
+
(r'"', String, 'dqstring'),
|
| 380 |
+
(r"'", String, 'sqstring'),
|
| 381 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float),
|
| 382 |
+
(r'(\d+\.\d*|\.\d+)', Number.Float),
|
| 383 |
+
(r'-?\d+', Number.Integer),
|
| 384 |
+
('[,.~!%^&*+=|?:<>/-]', Operator),
|
| 385 |
+
('[{}()\[\]]', Punctuation),
|
| 386 |
+
(r'(eq|ne)\b', Operator.Word),
|
| 387 |
+
(r'([a-zA-Z_]\w*)(\s*)(\()',
|
| 388 |
+
bygroups(Name.Function, Text, Punctuation)),
|
| 389 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 390 |
+
(r'@[a-zA-Z_]\w*', Name.Constant), # macros
|
| 391 |
+
(r'\\\n', Text),
|
| 392 |
+
],
|
| 393 |
+
'optionarg': [
|
| 394 |
+
include('whitespace'),
|
| 395 |
+
(_shortened_many(
|
| 396 |
+
"a$ll", "an$gles", "ar$row", "au$toscale", "b$ars", "bor$der",
|
| 397 |
+
"box$width", "cl$abel", "c$lip", "cn$trparam", "co$ntour", "da$ta",
|
| 398 |
+
"data$file", "dg$rid3d", "du$mmy", "enc$oding", "dec$imalsign",
|
| 399 |
+
"fit$", "font$path", "fo$rmat", "fu$nction", "fu$nctions", "g$rid",
|
| 400 |
+
"hid$den3d", "his$torysize", "is$osamples", "k$ey", "keyt$itle",
|
| 401 |
+
"la$bel", "li$nestyle", "ls$", "loa$dpath", "loc$ale", "log$scale",
|
| 402 |
+
"mac$ros", "map$ping", "map$ping3d", "mar$gin", "lmar$gin",
|
| 403 |
+
"rmar$gin", "tmar$gin", "bmar$gin", "mo$use", "multi$plot",
|
| 404 |
+
"mxt$ics", "nomxt$ics", "mx2t$ics", "nomx2t$ics", "myt$ics",
|
| 405 |
+
"nomyt$ics", "my2t$ics", "nomy2t$ics", "mzt$ics", "nomzt$ics",
|
| 406 |
+
"mcbt$ics", "nomcbt$ics", "of$fsets", "or$igin", "o$utput",
|
| 407 |
+
"pa$rametric", "pm$3d", "pal$ette", "colorb$ox", "p$lot",
|
| 408 |
+
"poi$ntsize", "pol$ar", "pr$int", "obj$ect", "sa$mples", "si$ze",
|
| 409 |
+
"st$yle", "su$rface", "table$", "t$erminal", "termo$ptions", "ti$cs",
|
| 410 |
+
"ticsc$ale", "ticsl$evel", "timef$mt", "tim$estamp", "tit$le",
|
| 411 |
+
"v$ariables", "ve$rsion", "vi$ew", "xyp$lane", "xda$ta", "x2da$ta",
|
| 412 |
+
"yda$ta", "y2da$ta", "zda$ta", "cbda$ta", "xl$abel", "x2l$abel",
|
| 413 |
+
"yl$abel", "y2l$abel", "zl$abel", "cbl$abel", "xti$cs", "noxti$cs",
|
| 414 |
+
"x2ti$cs", "nox2ti$cs", "yti$cs", "noyti$cs", "y2ti$cs", "noy2ti$cs",
|
| 415 |
+
"zti$cs", "nozti$cs", "cbti$cs", "nocbti$cs", "xdti$cs", "noxdti$cs",
|
| 416 |
+
"x2dti$cs", "nox2dti$cs", "ydti$cs", "noydti$cs", "y2dti$cs",
|
| 417 |
+
"noy2dti$cs", "zdti$cs", "nozdti$cs", "cbdti$cs", "nocbdti$cs",
|
| 418 |
+
"xmti$cs", "noxmti$cs", "x2mti$cs", "nox2mti$cs", "ymti$cs",
|
| 419 |
+
"noymti$cs", "y2mti$cs", "noy2mti$cs", "zmti$cs", "nozmti$cs",
|
| 420 |
+
"cbmti$cs", "nocbmti$cs", "xr$ange", "x2r$ange", "yr$ange",
|
| 421 |
+
"y2r$ange", "zr$ange", "cbr$ange", "rr$ange", "tr$ange", "ur$ange",
|
| 422 |
+
"vr$ange", "xzeroa$xis", "x2zeroa$xis", "yzeroa$xis", "y2zeroa$xis",
|
| 423 |
+
"zzeroa$xis", "zeroa$xis", "z$ero"), Name.Builtin, '#pop'),
|
| 424 |
+
],
|
| 425 |
+
'bind': [
|
| 426 |
+
('!', Keyword, '#pop'),
|
| 427 |
+
(_shortened('all$windows'), Name.Builtin),
|
| 428 |
+
include('genericargs'),
|
| 429 |
+
],
|
| 430 |
+
'quit': [
|
| 431 |
+
(r'gnuplot\b', Keyword),
|
| 432 |
+
include('noargs'),
|
| 433 |
+
],
|
| 434 |
+
'fit': [
|
| 435 |
+
(r'via\b', Name.Builtin),
|
| 436 |
+
include('plot'),
|
| 437 |
+
],
|
| 438 |
+
'if': [
|
| 439 |
+
(r'\)', Punctuation, '#pop'),
|
| 440 |
+
include('genericargs'),
|
| 441 |
+
],
|
| 442 |
+
'pause': [
|
| 443 |
+
(r'(mouse|any|button1|button2|button3)\b', Name.Builtin),
|
| 444 |
+
(_shortened('key$press'), Name.Builtin),
|
| 445 |
+
include('genericargs'),
|
| 446 |
+
],
|
| 447 |
+
'plot': [
|
| 448 |
+
(_shortened_many('ax$es', 'axi$s', 'bin$ary', 'ev$ery', 'i$ndex',
|
| 449 |
+
'mat$rix', 's$mooth', 'thru$', 't$itle',
|
| 450 |
+
'not$itle', 'u$sing', 'w$ith'),
|
| 451 |
+
Name.Builtin),
|
| 452 |
+
include('genericargs'),
|
| 453 |
+
],
|
| 454 |
+
'save': [
|
| 455 |
+
(_shortened_many('f$unctions', 's$et', 't$erminal', 'v$ariables'),
|
| 456 |
+
Name.Builtin),
|
| 457 |
+
include('genericargs'),
|
| 458 |
+
],
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
|
| 462 |
+
class PovrayLexer(RegexLexer):
|
| 463 |
+
"""
|
| 464 |
+
For `Persistence of Vision Raytracer <http://www.povray.org/>`_ files.
|
| 465 |
+
|
| 466 |
+
.. versionadded:: 0.11
|
| 467 |
+
"""
|
| 468 |
+
name = 'POVRay'
|
| 469 |
+
aliases = ['pov']
|
| 470 |
+
filenames = ['*.pov', '*.inc']
|
| 471 |
+
mimetypes = ['text/x-povray']
|
| 472 |
+
|
| 473 |
+
tokens = {
|
| 474 |
+
'root': [
|
| 475 |
+
(r'/\*[\w\W]*?\*/', Comment.Multiline),
|
| 476 |
+
(r'//.*\n', Comment.Single),
|
| 477 |
+
(r'(?s)"(?:\\.|[^"\\])+"', String.Double),
|
| 478 |
+
(words((
|
| 479 |
+
'break', 'case', 'debug', 'declare', 'default', 'define', 'else',
|
| 480 |
+
'elseif', 'end', 'error', 'fclose', 'fopen', 'for', 'if', 'ifdef',
|
| 481 |
+
'ifndef', 'include', 'local', 'macro', 'range', 'read', 'render',
|
| 482 |
+
'statistics', 'switch', 'undef', 'version', 'warning', 'while',
|
| 483 |
+
'write'), prefix=r'#', suffix=r'\b'),
|
| 484 |
+
Comment.Preproc),
|
| 485 |
+
(words((
|
| 486 |
+
'aa_level', 'aa_threshold', 'abs', 'acos', 'acosh', 'adaptive', 'adc_bailout',
|
| 487 |
+
'agate', 'agate_turb', 'all', 'alpha', 'ambient', 'ambient_light', 'angle',
|
| 488 |
+
'aperture', 'arc_angle', 'area_light', 'asc', 'asin', 'asinh', 'assumed_gamma',
|
| 489 |
+
'atan', 'atan2', 'atanh', 'atmosphere', 'atmospheric_attenuation',
|
| 490 |
+
'attenuating', 'average', 'background', 'black_hole', 'blue', 'blur_samples',
|
| 491 |
+
'bounded_by', 'box_mapping', 'bozo', 'break', 'brick', 'brick_size',
|
| 492 |
+
'brightness', 'brilliance', 'bumps', 'bumpy1', 'bumpy2', 'bumpy3', 'bump_map',
|
| 493 |
+
'bump_size', 'case', 'caustics', 'ceil', 'checker', 'chr', 'clipped_by', 'clock',
|
| 494 |
+
'color', 'color_map', 'colour', 'colour_map', 'component', 'composite', 'concat',
|
| 495 |
+
'confidence', 'conic_sweep', 'constant', 'control0', 'control1', 'cos', 'cosh',
|
| 496 |
+
'count', 'crackle', 'crand', 'cube', 'cubic_spline', 'cylindrical_mapping',
|
| 497 |
+
'debug', 'declare', 'default', 'degrees', 'dents', 'diffuse', 'direction',
|
| 498 |
+
'distance', 'distance_maximum', 'div', 'dust', 'dust_type', 'eccentricity',
|
| 499 |
+
'else', 'emitting', 'end', 'error', 'error_bound', 'exp', 'exponent',
|
| 500 |
+
'fade_distance', 'fade_power', 'falloff', 'falloff_angle', 'false',
|
| 501 |
+
'file_exists', 'filter', 'finish', 'fisheye', 'flatness', 'flip', 'floor',
|
| 502 |
+
'focal_point', 'fog', 'fog_alt', 'fog_offset', 'fog_type', 'frequency', 'gif',
|
| 503 |
+
'global_settings', 'glowing', 'gradient', 'granite', 'gray_threshold',
|
| 504 |
+
'green', 'halo', 'hexagon', 'hf_gray_16', 'hierarchy', 'hollow', 'hypercomplex',
|
| 505 |
+
'if', 'ifdef', 'iff', 'image_map', 'incidence', 'include', 'int', 'interpolate',
|
| 506 |
+
'inverse', 'ior', 'irid', 'irid_wavelength', 'jitter', 'lambda', 'leopard',
|
| 507 |
+
'linear', 'linear_spline', 'linear_sweep', 'location', 'log', 'looks_like',
|
| 508 |
+
'look_at', 'low_error_factor', 'mandel', 'map_type', 'marble', 'material_map',
|
| 509 |
+
'matrix', 'max', 'max_intersections', 'max_iteration', 'max_trace_level',
|
| 510 |
+
'max_value', 'metallic', 'min', 'minimum_reuse', 'mod', 'mortar',
|
| 511 |
+
'nearest_count', 'no', 'normal', 'normal_map', 'no_shadow', 'number_of_waves',
|
| 512 |
+
'octaves', 'off', 'offset', 'omega', 'omnimax', 'on', 'once', 'onion', 'open',
|
| 513 |
+
'orthographic', 'panoramic', 'pattern1', 'pattern2', 'pattern3',
|
| 514 |
+
'perspective', 'pgm', 'phase', 'phong', 'phong_size', 'pi', 'pigment',
|
| 515 |
+
'pigment_map', 'planar_mapping', 'png', 'point_at', 'pot', 'pow', 'ppm',
|
| 516 |
+
'precision', 'pwr', 'quadratic_spline', 'quaternion', 'quick_color',
|
| 517 |
+
'quick_colour', 'quilted', 'radial', 'radians', 'radiosity', 'radius', 'rainbow',
|
| 518 |
+
'ramp_wave', 'rand', 'range', 'reciprocal', 'recursion_limit', 'red',
|
| 519 |
+
'reflection', 'refraction', 'render', 'repeat', 'rgb', 'rgbf', 'rgbft', 'rgbt',
|
| 520 |
+
'right', 'ripples', 'rotate', 'roughness', 'samples', 'scale', 'scallop_wave',
|
| 521 |
+
'scattering', 'seed', 'shadowless', 'sin', 'sine_wave', 'sinh', 'sky', 'sky_sphere',
|
| 522 |
+
'slice', 'slope_map', 'smooth', 'specular', 'spherical_mapping', 'spiral',
|
| 523 |
+
'spiral1', 'spiral2', 'spotlight', 'spotted', 'sqr', 'sqrt', 'statistics', 'str',
|
| 524 |
+
'strcmp', 'strength', 'strlen', 'strlwr', 'strupr', 'sturm', 'substr', 'switch', 'sys',
|
| 525 |
+
't', 'tan', 'tanh', 'test_camera_1', 'test_camera_2', 'test_camera_3',
|
| 526 |
+
'test_camera_4', 'texture', 'texture_map', 'tga', 'thickness', 'threshold',
|
| 527 |
+
'tightness', 'tile2', 'tiles', 'track', 'transform', 'translate', 'transmit',
|
| 528 |
+
'triangle_wave', 'true', 'ttf', 'turbulence', 'turb_depth', 'type',
|
| 529 |
+
'ultra_wide_angle', 'up', 'use_color', 'use_colour', 'use_index', 'u_steps',
|
| 530 |
+
'val', 'variance', 'vaxis_rotate', 'vcross', 'vdot', 'version', 'vlength',
|
| 531 |
+
'vnormalize', 'volume_object', 'volume_rendered', 'vol_with_light',
|
| 532 |
+
'vrotate', 'v_steps', 'warning', 'warp', 'water_level', 'waves', 'while', 'width',
|
| 533 |
+
'wood', 'wrinkles', 'yes'), prefix=r'\b', suffix=r'\b'),
|
| 534 |
+
Keyword),
|
| 535 |
+
(words((
|
| 536 |
+
'bicubic_patch', 'blob', 'box', 'camera', 'cone', 'cubic', 'cylinder', 'difference',
|
| 537 |
+
'disc', 'height_field', 'intersection', 'julia_fractal', 'lathe',
|
| 538 |
+
'light_source', 'merge', 'mesh', 'object', 'plane', 'poly', 'polygon', 'prism',
|
| 539 |
+
'quadric', 'quartic', 'smooth_triangle', 'sor', 'sphere', 'superellipsoid',
|
| 540 |
+
'text', 'torus', 'triangle', 'union'), suffix=r'\b'),
|
| 541 |
+
Name.Builtin),
|
| 542 |
+
# TODO: <=, etc
|
| 543 |
+
(r'[\[\](){}<>;,]', Punctuation),
|
| 544 |
+
(r'[-+*/=]', Operator),
|
| 545 |
+
(r'\b(x|y|z|u|v)\b', Name.Builtin.Pseudo),
|
| 546 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 547 |
+
(r'[0-9]+\.[0-9]*', Number.Float),
|
| 548 |
+
(r'\.[0-9]+', Number.Float),
|
| 549 |
+
(r'[0-9]+', Number.Integer),
|
| 550 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 551 |
+
(r'\s+', Text),
|
| 552 |
+
]
|
| 553 |
+
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
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.haskell
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for Haskell and related languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, \
|
| 15 |
+
default, include
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Number, Punctuation, Generic
|
| 18 |
+
from pygments import unistring as uni
|
| 19 |
+
|
| 20 |
+
__all__ = ['HaskellLexer', 'IdrisLexer', 'AgdaLexer', 'CryptolLexer',
|
| 21 |
+
'LiterateHaskellLexer', 'LiterateIdrisLexer', 'LiterateAgdaLexer',
|
| 22 |
+
'LiterateCryptolLexer', 'KokaLexer']
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
line_re = re.compile('.*?\n')
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class HaskellLexer(RegexLexer):
|
| 29 |
+
"""
|
| 30 |
+
A Haskell lexer based on the lexemes defined in the Haskell 98 Report.
|
| 31 |
+
|
| 32 |
+
.. versionadded:: 0.8
|
| 33 |
+
"""
|
| 34 |
+
name = 'Haskell'
|
| 35 |
+
aliases = ['haskell', 'hs']
|
| 36 |
+
filenames = ['*.hs']
|
| 37 |
+
mimetypes = ['text/x-haskell']
|
| 38 |
+
|
| 39 |
+
flags = re.MULTILINE | re.UNICODE
|
| 40 |
+
|
| 41 |
+
reserved = ('case', 'class', 'data', 'default', 'deriving', 'do', 'else',
|
| 42 |
+
'family', 'if', 'in', 'infix[lr]?', 'instance',
|
| 43 |
+
'let', 'newtype', 'of', 'then', 'type', 'where', '_')
|
| 44 |
+
ascii = ('NUL', 'SOH', '[SE]TX', 'EOT', 'ENQ', 'ACK',
|
| 45 |
+
'BEL', 'BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'S[OI]', 'DLE',
|
| 46 |
+
'DC[1-4]', 'NAK', 'SYN', 'ETB', 'CAN',
|
| 47 |
+
'EM', 'SUB', 'ESC', '[FGRU]S', 'SP', 'DEL')
|
| 48 |
+
|
| 49 |
+
tokens = {
|
| 50 |
+
'root': [
|
| 51 |
+
# Whitespace:
|
| 52 |
+
(r'\s+', Text),
|
| 53 |
+
# (r'--\s*|.*$', Comment.Doc),
|
| 54 |
+
(r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single),
|
| 55 |
+
(r'\{-', Comment.Multiline, 'comment'),
|
| 56 |
+
# Lexemes:
|
| 57 |
+
# Identifiers
|
| 58 |
+
(r'\bimport\b', Keyword.Reserved, 'import'),
|
| 59 |
+
(r'\bmodule\b', Keyword.Reserved, 'module'),
|
| 60 |
+
(r'\berror\b', Name.Exception),
|
| 61 |
+
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
| 62 |
+
(r"'[^\\]'", String.Char), # this has to come before the TH quote
|
| 63 |
+
(r'^[_' + uni.Ll + r'][\w\']*', Name.Function),
|
| 64 |
+
(r"'?[_" + uni.Ll + r"][\w']*", Name),
|
| 65 |
+
(r"('')?[" + uni.Lu + r"][\w\']*", Keyword.Type),
|
| 66 |
+
(r"(')[" + uni.Lu + r"][\w\']*", Keyword.Type),
|
| 67 |
+
(r"(')\[[^\]]*\]", Keyword.Type), # tuples and lists get special treatment in GHC
|
| 68 |
+
(r"(')\([^)]*\)", Keyword.Type), # ..
|
| 69 |
+
# Operators
|
| 70 |
+
(r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator
|
| 71 |
+
(r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
|
| 72 |
+
(r':[:!#$%&*+.\\/<=>?@^|~-]*', Keyword.Type), # Constructor operators
|
| 73 |
+
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), # Other operators
|
| 74 |
+
# Numbers
|
| 75 |
+
(r'\d+[eE][+-]?\d+', Number.Float),
|
| 76 |
+
(r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
|
| 77 |
+
(r'0[oO][0-7]+', Number.Oct),
|
| 78 |
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
| 79 |
+
(r'\d+', Number.Integer),
|
| 80 |
+
# Character/String Literals
|
| 81 |
+
(r"'", String.Char, 'character'),
|
| 82 |
+
(r'"', String, 'string'),
|
| 83 |
+
# Special
|
| 84 |
+
(r'\[\]', Keyword.Type),
|
| 85 |
+
(r'\(\)', Name.Builtin),
|
| 86 |
+
(r'[][(),;`{}]', Punctuation),
|
| 87 |
+
],
|
| 88 |
+
'import': [
|
| 89 |
+
# Import statements
|
| 90 |
+
(r'\s+', Text),
|
| 91 |
+
(r'"', String, 'string'),
|
| 92 |
+
# after "funclist" state
|
| 93 |
+
(r'\)', Punctuation, '#pop'),
|
| 94 |
+
(r'qualified\b', Keyword),
|
| 95 |
+
# import X as Y
|
| 96 |
+
(r'([' + uni.Lu + r'][\w.]*)(\s+)(as)(\s+)([' + uni.Lu + r'][\w.]*)',
|
| 97 |
+
bygroups(Name.Namespace, Text, Keyword, Text, Name), '#pop'),
|
| 98 |
+
# import X hiding (functions)
|
| 99 |
+
(r'([' + uni.Lu + r'][\w.]*)(\s+)(hiding)(\s+)(\()',
|
| 100 |
+
bygroups(Name.Namespace, Text, Keyword, Text, Punctuation), 'funclist'),
|
| 101 |
+
# import X (functions)
|
| 102 |
+
(r'([' + uni.Lu + r'][\w.]*)(\s+)(\()',
|
| 103 |
+
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
| 104 |
+
# import X
|
| 105 |
+
(r'[\w.]+', Name.Namespace, '#pop'),
|
| 106 |
+
],
|
| 107 |
+
'module': [
|
| 108 |
+
(r'\s+', Text),
|
| 109 |
+
(r'([' + uni.Lu + r'][\w.]*)(\s+)(\()',
|
| 110 |
+
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
| 111 |
+
(r'[' + uni.Lu + r'][\w.]*', Name.Namespace, '#pop'),
|
| 112 |
+
],
|
| 113 |
+
'funclist': [
|
| 114 |
+
(r'\s+', Text),
|
| 115 |
+
(r'[' + uni.Lu + r']\w*', Keyword.Type),
|
| 116 |
+
(r'(_[\w\']+|[' + uni.Ll + r'][\w\']*)', Name.Function),
|
| 117 |
+
(r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single),
|
| 118 |
+
(r'\{-', Comment.Multiline, 'comment'),
|
| 119 |
+
(r',', Punctuation),
|
| 120 |
+
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
|
| 121 |
+
# (HACK, but it makes sense to push two instances, believe me)
|
| 122 |
+
(r'\(', Punctuation, ('funclist', 'funclist')),
|
| 123 |
+
(r'\)', Punctuation, '#pop:2'),
|
| 124 |
+
],
|
| 125 |
+
# NOTE: the next four states are shared in the AgdaLexer; make sure
|
| 126 |
+
# any change is compatible with Agda as well or copy over and change
|
| 127 |
+
'comment': [
|
| 128 |
+
# Multiline Comments
|
| 129 |
+
(r'[^-{}]+', Comment.Multiline),
|
| 130 |
+
(r'\{-', Comment.Multiline, '#push'),
|
| 131 |
+
(r'-\}', Comment.Multiline, '#pop'),
|
| 132 |
+
(r'[-{}]', Comment.Multiline),
|
| 133 |
+
],
|
| 134 |
+
'character': [
|
| 135 |
+
# Allows multi-chars, incorrectly.
|
| 136 |
+
(r"[^\\']'", String.Char, '#pop'),
|
| 137 |
+
(r"\\", String.Escape, 'escape'),
|
| 138 |
+
("'", String.Char, '#pop'),
|
| 139 |
+
],
|
| 140 |
+
'string': [
|
| 141 |
+
(r'[^\\"]+', String),
|
| 142 |
+
(r"\\", String.Escape, 'escape'),
|
| 143 |
+
('"', String, '#pop'),
|
| 144 |
+
],
|
| 145 |
+
'escape': [
|
| 146 |
+
(r'[abfnrtv"\'&\\]', String.Escape, '#pop'),
|
| 147 |
+
(r'\^[][' + uni.Lu + r'@^_]', String.Escape, '#pop'),
|
| 148 |
+
('|'.join(ascii), String.Escape, '#pop'),
|
| 149 |
+
(r'o[0-7]+', String.Escape, '#pop'),
|
| 150 |
+
(r'x[\da-fA-F]+', String.Escape, '#pop'),
|
| 151 |
+
(r'\d+', String.Escape, '#pop'),
|
| 152 |
+
(r'\s+\\', String.Escape, '#pop'),
|
| 153 |
+
],
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
class IdrisLexer(RegexLexer):
|
| 158 |
+
"""
|
| 159 |
+
A lexer for the dependently typed programming language Idris.
|
| 160 |
+
|
| 161 |
+
Based on the Haskell and Agda Lexer.
|
| 162 |
+
|
| 163 |
+
.. versionadded:: 2.0
|
| 164 |
+
"""
|
| 165 |
+
name = 'Idris'
|
| 166 |
+
aliases = ['idris', 'idr']
|
| 167 |
+
filenames = ['*.idr']
|
| 168 |
+
mimetypes = ['text/x-idris']
|
| 169 |
+
|
| 170 |
+
reserved = ('case', 'class', 'data', 'default', 'using', 'do', 'else',
|
| 171 |
+
'if', 'in', 'infix[lr]?', 'instance', 'rewrite', 'auto',
|
| 172 |
+
'namespace', 'codata', 'mutual', 'private', 'public', 'abstract',
|
| 173 |
+
'total', 'partial',
|
| 174 |
+
'let', 'proof', 'of', 'then', 'static', 'where', '_', 'with',
|
| 175 |
+
'pattern', 'term', 'syntax', 'prefix',
|
| 176 |
+
'postulate', 'parameters', 'record', 'dsl', 'impossible', 'implicit',
|
| 177 |
+
'tactics', 'intros', 'intro', 'compute', 'refine', 'exact', 'trivial')
|
| 178 |
+
|
| 179 |
+
ascii = ('NUL', 'SOH', '[SE]TX', 'EOT', 'ENQ', 'ACK',
|
| 180 |
+
'BEL', 'BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'S[OI]', 'DLE',
|
| 181 |
+
'DC[1-4]', 'NAK', 'SYN', 'ETB', 'CAN',
|
| 182 |
+
'EM', 'SUB', 'ESC', '[FGRU]S', 'SP', 'DEL')
|
| 183 |
+
|
| 184 |
+
directives = ('lib', 'link', 'flag', 'include', 'hide', 'freeze', 'access',
|
| 185 |
+
'default', 'logging', 'dynamic', 'name', 'error_handlers', 'language')
|
| 186 |
+
|
| 187 |
+
tokens = {
|
| 188 |
+
'root': [
|
| 189 |
+
# Comments
|
| 190 |
+
(r'^(\s*)(%%%s)' % '|'.join(directives),
|
| 191 |
+
bygroups(Text, Keyword.Reserved)),
|
| 192 |
+
(r'(\s*)(--(?![!#$%&*+./<=>?@^|_~:\\]).*?)$', bygroups(Text, Comment.Single)),
|
| 193 |
+
(r'(\s*)(\|{3}.*?)$', bygroups(Text, Comment.Single)),
|
| 194 |
+
(r'(\s*)(\{-)', bygroups(Text, Comment.Multiline), 'comment'),
|
| 195 |
+
# Declaration
|
| 196 |
+
(r'^(\s*)([^\s(){}]+)(\s*)(:)(\s*)',
|
| 197 |
+
bygroups(Text, Name.Function, Text, Operator.Word, Text)),
|
| 198 |
+
# Identifiers
|
| 199 |
+
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
| 200 |
+
(r'(import|module)(\s+)', bygroups(Keyword.Reserved, Text), 'module'),
|
| 201 |
+
(r"('')?[A-Z][\w\']*", Keyword.Type),
|
| 202 |
+
(r'[a-z][\w\']*', Text),
|
| 203 |
+
# Special Symbols
|
| 204 |
+
(r'(<-|::|->|=>|=)', Operator.Word), # specials
|
| 205 |
+
(r'([(){}\[\]:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
|
| 206 |
+
# Numbers
|
| 207 |
+
(r'\d+[eE][+-]?\d+', Number.Float),
|
| 208 |
+
(r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
|
| 209 |
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
| 210 |
+
(r'\d+', Number.Integer),
|
| 211 |
+
# Strings
|
| 212 |
+
(r"'", String.Char, 'character'),
|
| 213 |
+
(r'"', String, 'string'),
|
| 214 |
+
(r'[^\s(){}]+', Text),
|
| 215 |
+
(r'\s+?', Text), # Whitespace
|
| 216 |
+
],
|
| 217 |
+
'module': [
|
| 218 |
+
(r'\s+', Text),
|
| 219 |
+
(r'([A-Z][\w.]*)(\s+)(\()',
|
| 220 |
+
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
| 221 |
+
(r'[A-Z][\w.]*', Name.Namespace, '#pop'),
|
| 222 |
+
],
|
| 223 |
+
'funclist': [
|
| 224 |
+
(r'\s+', Text),
|
| 225 |
+
(r'[A-Z]\w*', Keyword.Type),
|
| 226 |
+
(r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
|
| 227 |
+
(r'--.*$', Comment.Single),
|
| 228 |
+
(r'\{-', Comment.Multiline, 'comment'),
|
| 229 |
+
(r',', Punctuation),
|
| 230 |
+
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
|
| 231 |
+
# (HACK, but it makes sense to push two instances, believe me)
|
| 232 |
+
(r'\(', Punctuation, ('funclist', 'funclist')),
|
| 233 |
+
(r'\)', Punctuation, '#pop:2'),
|
| 234 |
+
],
|
| 235 |
+
# NOTE: the next four states are shared in the AgdaLexer; make sure
|
| 236 |
+
# any change is compatible with Agda as well or copy over and change
|
| 237 |
+
'comment': [
|
| 238 |
+
# Multiline Comments
|
| 239 |
+
(r'[^-{}]+', Comment.Multiline),
|
| 240 |
+
(r'\{-', Comment.Multiline, '#push'),
|
| 241 |
+
(r'-\}', Comment.Multiline, '#pop'),
|
| 242 |
+
(r'[-{}]', Comment.Multiline),
|
| 243 |
+
],
|
| 244 |
+
'character': [
|
| 245 |
+
# Allows multi-chars, incorrectly.
|
| 246 |
+
(r"[^\\']", String.Char),
|
| 247 |
+
(r"\\", String.Escape, 'escape'),
|
| 248 |
+
("'", String.Char, '#pop'),
|
| 249 |
+
],
|
| 250 |
+
'string': [
|
| 251 |
+
(r'[^\\"]+', String),
|
| 252 |
+
(r"\\", String.Escape, 'escape'),
|
| 253 |
+
('"', String, '#pop'),
|
| 254 |
+
],
|
| 255 |
+
'escape': [
|
| 256 |
+
(r'[abfnrtv"\'&\\]', String.Escape, '#pop'),
|
| 257 |
+
(r'\^[][A-Z@^_]', String.Escape, '#pop'),
|
| 258 |
+
('|'.join(ascii), String.Escape, '#pop'),
|
| 259 |
+
(r'o[0-7]+', String.Escape, '#pop'),
|
| 260 |
+
(r'x[\da-fA-F]+', String.Escape, '#pop'),
|
| 261 |
+
(r'\d+', String.Escape, '#pop'),
|
| 262 |
+
(r'\s+\\', String.Escape, '#pop')
|
| 263 |
+
],
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
class AgdaLexer(RegexLexer):
|
| 268 |
+
"""
|
| 269 |
+
For the `Agda <http://wiki.portal.chalmers.se/agda/pmwiki.php>`_
|
| 270 |
+
dependently typed functional programming language and proof assistant.
|
| 271 |
+
|
| 272 |
+
.. versionadded:: 2.0
|
| 273 |
+
"""
|
| 274 |
+
|
| 275 |
+
name = 'Agda'
|
| 276 |
+
aliases = ['agda']
|
| 277 |
+
filenames = ['*.agda']
|
| 278 |
+
mimetypes = ['text/x-agda']
|
| 279 |
+
|
| 280 |
+
reserved = ['abstract', 'codata', 'coinductive', 'constructor', 'data',
|
| 281 |
+
'field', 'forall', 'hiding', 'in', 'inductive', 'infix',
|
| 282 |
+
'infixl', 'infixr', 'instance', 'let', 'mutual', 'open',
|
| 283 |
+
'pattern', 'postulate', 'primitive', 'private',
|
| 284 |
+
'quote', 'quoteGoal', 'quoteTerm',
|
| 285 |
+
'record', 'renaming', 'rewrite', 'syntax', 'tactic',
|
| 286 |
+
'unquote', 'unquoteDecl', 'using', 'where', 'with']
|
| 287 |
+
|
| 288 |
+
tokens = {
|
| 289 |
+
'root': [
|
| 290 |
+
# Declaration
|
| 291 |
+
(r'^(\s*)([^\s(){}]+)(\s*)(:)(\s*)',
|
| 292 |
+
bygroups(Text, Name.Function, Text, Operator.Word, Text)),
|
| 293 |
+
# Comments
|
| 294 |
+
(r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single),
|
| 295 |
+
(r'\{-', Comment.Multiline, 'comment'),
|
| 296 |
+
# Holes
|
| 297 |
+
(r'\{!', Comment.Directive, 'hole'),
|
| 298 |
+
# Lexemes:
|
| 299 |
+
# Identifiers
|
| 300 |
+
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
| 301 |
+
(r'(import|module)(\s+)', bygroups(Keyword.Reserved, Text), 'module'),
|
| 302 |
+
(r'\b(Set|Prop)\b', Keyword.Type),
|
| 303 |
+
# Special Symbols
|
| 304 |
+
(r'(\(|\)|\{|\})', Operator),
|
| 305 |
+
(u'(\\.{1,3}|\\||\u039B|\u2200|\u2192|:|=|->)', Operator.Word),
|
| 306 |
+
# Numbers
|
| 307 |
+
(r'\d+[eE][+-]?\d+', Number.Float),
|
| 308 |
+
(r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
|
| 309 |
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
| 310 |
+
(r'\d+', Number.Integer),
|
| 311 |
+
# Strings
|
| 312 |
+
(r"'", String.Char, 'character'),
|
| 313 |
+
(r'"', String, 'string'),
|
| 314 |
+
(r'[^\s(){}]+', Text),
|
| 315 |
+
(r'\s+?', Text), # Whitespace
|
| 316 |
+
],
|
| 317 |
+
'hole': [
|
| 318 |
+
# Holes
|
| 319 |
+
(r'[^!{}]+', Comment.Directive),
|
| 320 |
+
(r'\{!', Comment.Directive, '#push'),
|
| 321 |
+
(r'!\}', Comment.Directive, '#pop'),
|
| 322 |
+
(r'[!{}]', Comment.Directive),
|
| 323 |
+
],
|
| 324 |
+
'module': [
|
| 325 |
+
(r'\{-', Comment.Multiline, 'comment'),
|
| 326 |
+
(r'[a-zA-Z][\w.]*', Name, '#pop'),
|
| 327 |
+
(r'[\W0-9_]+', Text)
|
| 328 |
+
],
|
| 329 |
+
'comment': HaskellLexer.tokens['comment'],
|
| 330 |
+
'character': HaskellLexer.tokens['character'],
|
| 331 |
+
'string': HaskellLexer.tokens['string'],
|
| 332 |
+
'escape': HaskellLexer.tokens['escape']
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
|
| 336 |
+
class CryptolLexer(RegexLexer):
|
| 337 |
+
"""
|
| 338 |
+
FIXME: A Cryptol2 lexer based on the lexemes defined in the Haskell 98 Report.
|
| 339 |
+
|
| 340 |
+
.. versionadded:: 2.0
|
| 341 |
+
"""
|
| 342 |
+
name = 'Cryptol'
|
| 343 |
+
aliases = ['cryptol', 'cry']
|
| 344 |
+
filenames = ['*.cry']
|
| 345 |
+
mimetypes = ['text/x-cryptol']
|
| 346 |
+
|
| 347 |
+
reserved = ('Arith', 'Bit', 'Cmp', 'False', 'Inf', 'True', 'else',
|
| 348 |
+
'export', 'extern', 'fin', 'if', 'import', 'inf', 'lg2',
|
| 349 |
+
'max', 'min', 'module', 'newtype', 'pragma', 'property',
|
| 350 |
+
'then', 'type', 'where', 'width')
|
| 351 |
+
ascii = ('NUL', 'SOH', '[SE]TX', 'EOT', 'ENQ', 'ACK',
|
| 352 |
+
'BEL', 'BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'S[OI]', 'DLE',
|
| 353 |
+
'DC[1-4]', 'NAK', 'SYN', 'ETB', 'CAN',
|
| 354 |
+
'EM', 'SUB', 'ESC', '[FGRU]S', 'SP', 'DEL')
|
| 355 |
+
|
| 356 |
+
tokens = {
|
| 357 |
+
'root': [
|
| 358 |
+
# Whitespace:
|
| 359 |
+
(r'\s+', Text),
|
| 360 |
+
# (r'--\s*|.*$', Comment.Doc),
|
| 361 |
+
(r'//.*$', Comment.Single),
|
| 362 |
+
(r'/\*', Comment.Multiline, 'comment'),
|
| 363 |
+
# Lexemes:
|
| 364 |
+
# Identifiers
|
| 365 |
+
(r'\bimport\b', Keyword.Reserved, 'import'),
|
| 366 |
+
(r'\bmodule\b', Keyword.Reserved, 'module'),
|
| 367 |
+
(r'\berror\b', Name.Exception),
|
| 368 |
+
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
| 369 |
+
(r'^[_a-z][\w\']*', Name.Function),
|
| 370 |
+
(r"'?[_a-z][\w']*", Name),
|
| 371 |
+
(r"('')?[A-Z][\w\']*", Keyword.Type),
|
| 372 |
+
# Operators
|
| 373 |
+
(r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator
|
| 374 |
+
(r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
|
| 375 |
+
(r':[:!#$%&*+.\\/<=>?@^|~-]*', Keyword.Type), # Constructor operators
|
| 376 |
+
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), # Other operators
|
| 377 |
+
# Numbers
|
| 378 |
+
(r'\d+[eE][+-]?\d+', Number.Float),
|
| 379 |
+
(r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
|
| 380 |
+
(r'0[oO][0-7]+', Number.Oct),
|
| 381 |
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
| 382 |
+
(r'\d+', Number.Integer),
|
| 383 |
+
# Character/String Literals
|
| 384 |
+
(r"'", String.Char, 'character'),
|
| 385 |
+
(r'"', String, 'string'),
|
| 386 |
+
# Special
|
| 387 |
+
(r'\[\]', Keyword.Type),
|
| 388 |
+
(r'\(\)', Name.Builtin),
|
| 389 |
+
(r'[][(),;`{}]', Punctuation),
|
| 390 |
+
],
|
| 391 |
+
'import': [
|
| 392 |
+
# Import statements
|
| 393 |
+
(r'\s+', Text),
|
| 394 |
+
(r'"', String, 'string'),
|
| 395 |
+
# after "funclist" state
|
| 396 |
+
(r'\)', Punctuation, '#pop'),
|
| 397 |
+
(r'qualified\b', Keyword),
|
| 398 |
+
# import X as Y
|
| 399 |
+
(r'([A-Z][\w.]*)(\s+)(as)(\s+)([A-Z][\w.]*)',
|
| 400 |
+
bygroups(Name.Namespace, Text, Keyword, Text, Name), '#pop'),
|
| 401 |
+
# import X hiding (functions)
|
| 402 |
+
(r'([A-Z][\w.]*)(\s+)(hiding)(\s+)(\()',
|
| 403 |
+
bygroups(Name.Namespace, Text, Keyword, Text, Punctuation), 'funclist'),
|
| 404 |
+
# import X (functions)
|
| 405 |
+
(r'([A-Z][\w.]*)(\s+)(\()',
|
| 406 |
+
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
| 407 |
+
# import X
|
| 408 |
+
(r'[\w.]+', Name.Namespace, '#pop'),
|
| 409 |
+
],
|
| 410 |
+
'module': [
|
| 411 |
+
(r'\s+', Text),
|
| 412 |
+
(r'([A-Z][\w.]*)(\s+)(\()',
|
| 413 |
+
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
| 414 |
+
(r'[A-Z][\w.]*', Name.Namespace, '#pop'),
|
| 415 |
+
],
|
| 416 |
+
'funclist': [
|
| 417 |
+
(r'\s+', Text),
|
| 418 |
+
(r'[A-Z]\w*', Keyword.Type),
|
| 419 |
+
(r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
|
| 420 |
+
# TODO: these don't match the comments in docs, remove.
|
| 421 |
+
#(r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single),
|
| 422 |
+
#(r'{-', Comment.Multiline, 'comment'),
|
| 423 |
+
(r',', Punctuation),
|
| 424 |
+
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
|
| 425 |
+
# (HACK, but it makes sense to push two instances, believe me)
|
| 426 |
+
(r'\(', Punctuation, ('funclist', 'funclist')),
|
| 427 |
+
(r'\)', Punctuation, '#pop:2'),
|
| 428 |
+
],
|
| 429 |
+
'comment': [
|
| 430 |
+
# Multiline Comments
|
| 431 |
+
(r'[^/*]+', Comment.Multiline),
|
| 432 |
+
(r'/\*', Comment.Multiline, '#push'),
|
| 433 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 434 |
+
(r'[*/]', Comment.Multiline),
|
| 435 |
+
],
|
| 436 |
+
'character': [
|
| 437 |
+
# Allows multi-chars, incorrectly.
|
| 438 |
+
(r"[^\\']'", String.Char, '#pop'),
|
| 439 |
+
(r"\\", String.Escape, 'escape'),
|
| 440 |
+
("'", String.Char, '#pop'),
|
| 441 |
+
],
|
| 442 |
+
'string': [
|
| 443 |
+
(r'[^\\"]+', String),
|
| 444 |
+
(r"\\", String.Escape, 'escape'),
|
| 445 |
+
('"', String, '#pop'),
|
| 446 |
+
],
|
| 447 |
+
'escape': [
|
| 448 |
+
(r'[abfnrtv"\'&\\]', String.Escape, '#pop'),
|
| 449 |
+
(r'\^[][A-Z@^_]', String.Escape, '#pop'),
|
| 450 |
+
('|'.join(ascii), String.Escape, '#pop'),
|
| 451 |
+
(r'o[0-7]+', String.Escape, '#pop'),
|
| 452 |
+
(r'x[\da-fA-F]+', String.Escape, '#pop'),
|
| 453 |
+
(r'\d+', String.Escape, '#pop'),
|
| 454 |
+
(r'\s+\\', String.Escape, '#pop'),
|
| 455 |
+
],
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
EXTRA_KEYWORDS = set(('join', 'split', 'reverse', 'transpose', 'width',
|
| 459 |
+
'length', 'tail', '<<', '>>', '<<<', '>>>', 'const',
|
| 460 |
+
'reg', 'par', 'seq', 'ASSERT', 'undefined', 'error',
|
| 461 |
+
'trace'))
|
| 462 |
+
|
| 463 |
+
def get_tokens_unprocessed(self, text):
|
| 464 |
+
stack = ['root']
|
| 465 |
+
for index, token, value in \
|
| 466 |
+
RegexLexer.get_tokens_unprocessed(self, text, stack):
|
| 467 |
+
if token is Name and value in self.EXTRA_KEYWORDS:
|
| 468 |
+
yield index, Name.Builtin, value
|
| 469 |
+
else:
|
| 470 |
+
yield index, token, value
|
| 471 |
+
|
| 472 |
+
|
| 473 |
+
class LiterateLexer(Lexer):
|
| 474 |
+
"""
|
| 475 |
+
Base class for lexers of literate file formats based on LaTeX or Bird-style
|
| 476 |
+
(prefixing each code line with ">").
|
| 477 |
+
|
| 478 |
+
Additional options accepted:
|
| 479 |
+
|
| 480 |
+
`litstyle`
|
| 481 |
+
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
| 482 |
+
is autodetected: if the first non-whitespace character in the source
|
| 483 |
+
is a backslash or percent character, LaTeX is assumed, else Bird.
|
| 484 |
+
"""
|
| 485 |
+
|
| 486 |
+
bird_re = re.compile(r'(>[ \t]*)(.*\n)')
|
| 487 |
+
|
| 488 |
+
def __init__(self, baselexer, **options):
|
| 489 |
+
self.baselexer = baselexer
|
| 490 |
+
Lexer.__init__(self, **options)
|
| 491 |
+
|
| 492 |
+
def get_tokens_unprocessed(self, text):
|
| 493 |
+
style = self.options.get('litstyle')
|
| 494 |
+
if style is None:
|
| 495 |
+
style = (text.lstrip()[0:1] in '%\\') and 'latex' or 'bird'
|
| 496 |
+
|
| 497 |
+
code = ''
|
| 498 |
+
insertions = []
|
| 499 |
+
if style == 'bird':
|
| 500 |
+
# bird-style
|
| 501 |
+
for match in line_re.finditer(text):
|
| 502 |
+
line = match.group()
|
| 503 |
+
m = self.bird_re.match(line)
|
| 504 |
+
if m:
|
| 505 |
+
insertions.append((len(code),
|
| 506 |
+
[(0, Comment.Special, m.group(1))]))
|
| 507 |
+
code += m.group(2)
|
| 508 |
+
else:
|
| 509 |
+
insertions.append((len(code), [(0, Text, line)]))
|
| 510 |
+
else:
|
| 511 |
+
# latex-style
|
| 512 |
+
from pygments.lexers.markup import TexLexer
|
| 513 |
+
lxlexer = TexLexer(**self.options)
|
| 514 |
+
codelines = 0
|
| 515 |
+
latex = ''
|
| 516 |
+
for match in line_re.finditer(text):
|
| 517 |
+
line = match.group()
|
| 518 |
+
if codelines:
|
| 519 |
+
if line.lstrip().startswith('\\end{code}'):
|
| 520 |
+
codelines = 0
|
| 521 |
+
latex += line
|
| 522 |
+
else:
|
| 523 |
+
code += line
|
| 524 |
+
elif line.lstrip().startswith('\\begin{code}'):
|
| 525 |
+
codelines = 1
|
| 526 |
+
latex += line
|
| 527 |
+
insertions.append((len(code),
|
| 528 |
+
list(lxlexer.get_tokens_unprocessed(latex))))
|
| 529 |
+
latex = ''
|
| 530 |
+
else:
|
| 531 |
+
latex += line
|
| 532 |
+
insertions.append((len(code),
|
| 533 |
+
list(lxlexer.get_tokens_unprocessed(latex))))
|
| 534 |
+
for item in do_insertions(insertions, self.baselexer.get_tokens_unprocessed(code)):
|
| 535 |
+
yield item
|
| 536 |
+
|
| 537 |
+
|
| 538 |
+
class LiterateHaskellLexer(LiterateLexer):
|
| 539 |
+
"""
|
| 540 |
+
For Literate Haskell (Bird-style or LaTeX) source.
|
| 541 |
+
|
| 542 |
+
Additional options accepted:
|
| 543 |
+
|
| 544 |
+
`litstyle`
|
| 545 |
+
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
| 546 |
+
is autodetected: if the first non-whitespace character in the source
|
| 547 |
+
is a backslash or percent character, LaTeX is assumed, else Bird.
|
| 548 |
+
|
| 549 |
+
.. versionadded:: 0.9
|
| 550 |
+
"""
|
| 551 |
+
name = 'Literate Haskell'
|
| 552 |
+
aliases = ['lhs', 'literate-haskell', 'lhaskell']
|
| 553 |
+
filenames = ['*.lhs']
|
| 554 |
+
mimetypes = ['text/x-literate-haskell']
|
| 555 |
+
|
| 556 |
+
def __init__(self, **options):
|
| 557 |
+
hslexer = HaskellLexer(**options)
|
| 558 |
+
LiterateLexer.__init__(self, hslexer, **options)
|
| 559 |
+
|
| 560 |
+
|
| 561 |
+
class LiterateIdrisLexer(LiterateLexer):
|
| 562 |
+
"""
|
| 563 |
+
For Literate Idris (Bird-style or LaTeX) source.
|
| 564 |
+
|
| 565 |
+
Additional options accepted:
|
| 566 |
+
|
| 567 |
+
`litstyle`
|
| 568 |
+
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
| 569 |
+
is autodetected: if the first non-whitespace character in the source
|
| 570 |
+
is a backslash or percent character, LaTeX is assumed, else Bird.
|
| 571 |
+
|
| 572 |
+
.. versionadded:: 2.0
|
| 573 |
+
"""
|
| 574 |
+
name = 'Literate Idris'
|
| 575 |
+
aliases = ['lidr', 'literate-idris', 'lidris']
|
| 576 |
+
filenames = ['*.lidr']
|
| 577 |
+
mimetypes = ['text/x-literate-idris']
|
| 578 |
+
|
| 579 |
+
def __init__(self, **options):
|
| 580 |
+
hslexer = IdrisLexer(**options)
|
| 581 |
+
LiterateLexer.__init__(self, hslexer, **options)
|
| 582 |
+
|
| 583 |
+
|
| 584 |
+
class LiterateAgdaLexer(LiterateLexer):
|
| 585 |
+
"""
|
| 586 |
+
For Literate Agda source.
|
| 587 |
+
|
| 588 |
+
Additional options accepted:
|
| 589 |
+
|
| 590 |
+
`litstyle`
|
| 591 |
+
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
| 592 |
+
is autodetected: if the first non-whitespace character in the source
|
| 593 |
+
is a backslash or percent character, LaTeX is assumed, else Bird.
|
| 594 |
+
|
| 595 |
+
.. versionadded:: 2.0
|
| 596 |
+
"""
|
| 597 |
+
name = 'Literate Agda'
|
| 598 |
+
aliases = ['lagda', 'literate-agda']
|
| 599 |
+
filenames = ['*.lagda']
|
| 600 |
+
mimetypes = ['text/x-literate-agda']
|
| 601 |
+
|
| 602 |
+
def __init__(self, **options):
|
| 603 |
+
agdalexer = AgdaLexer(**options)
|
| 604 |
+
LiterateLexer.__init__(self, agdalexer, litstyle='latex', **options)
|
| 605 |
+
|
| 606 |
+
|
| 607 |
+
class LiterateCryptolLexer(LiterateLexer):
|
| 608 |
+
"""
|
| 609 |
+
For Literate Cryptol (Bird-style or LaTeX) source.
|
| 610 |
+
|
| 611 |
+
Additional options accepted:
|
| 612 |
+
|
| 613 |
+
`litstyle`
|
| 614 |
+
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
| 615 |
+
is autodetected: if the first non-whitespace character in the source
|
| 616 |
+
is a backslash or percent character, LaTeX is assumed, else Bird.
|
| 617 |
+
|
| 618 |
+
.. versionadded:: 2.0
|
| 619 |
+
"""
|
| 620 |
+
name = 'Literate Cryptol'
|
| 621 |
+
aliases = ['lcry', 'literate-cryptol', 'lcryptol']
|
| 622 |
+
filenames = ['*.lcry']
|
| 623 |
+
mimetypes = ['text/x-literate-cryptol']
|
| 624 |
+
|
| 625 |
+
def __init__(self, **options):
|
| 626 |
+
crylexer = CryptolLexer(**options)
|
| 627 |
+
LiterateLexer.__init__(self, crylexer, **options)
|
| 628 |
+
|
| 629 |
+
|
| 630 |
+
class KokaLexer(RegexLexer):
|
| 631 |
+
"""
|
| 632 |
+
Lexer for the `Koka <http://koka.codeplex.com>`_
|
| 633 |
+
language.
|
| 634 |
+
|
| 635 |
+
.. versionadded:: 1.6
|
| 636 |
+
"""
|
| 637 |
+
|
| 638 |
+
name = 'Koka'
|
| 639 |
+
aliases = ['koka']
|
| 640 |
+
filenames = ['*.kk', '*.kki']
|
| 641 |
+
mimetypes = ['text/x-koka']
|
| 642 |
+
|
| 643 |
+
keywords = [
|
| 644 |
+
'infix', 'infixr', 'infixl',
|
| 645 |
+
'type', 'cotype', 'rectype', 'alias',
|
| 646 |
+
'struct', 'con',
|
| 647 |
+
'fun', 'function', 'val', 'var',
|
| 648 |
+
'external',
|
| 649 |
+
'if', 'then', 'else', 'elif', 'return', 'match',
|
| 650 |
+
'private', 'public', 'private',
|
| 651 |
+
'module', 'import', 'as',
|
| 652 |
+
'include', 'inline',
|
| 653 |
+
'rec',
|
| 654 |
+
'try', 'yield', 'enum',
|
| 655 |
+
'interface', 'instance',
|
| 656 |
+
]
|
| 657 |
+
|
| 658 |
+
# keywords that are followed by a type
|
| 659 |
+
typeStartKeywords = [
|
| 660 |
+
'type', 'cotype', 'rectype', 'alias', 'struct', 'enum',
|
| 661 |
+
]
|
| 662 |
+
|
| 663 |
+
# keywords valid in a type
|
| 664 |
+
typekeywords = [
|
| 665 |
+
'forall', 'exists', 'some', 'with',
|
| 666 |
+
]
|
| 667 |
+
|
| 668 |
+
# builtin names and special names
|
| 669 |
+
builtin = [
|
| 670 |
+
'for', 'while', 'repeat',
|
| 671 |
+
'foreach', 'foreach-indexed',
|
| 672 |
+
'error', 'catch', 'finally',
|
| 673 |
+
'cs', 'js', 'file', 'ref', 'assigned',
|
| 674 |
+
]
|
| 675 |
+
|
| 676 |
+
# symbols that can be in an operator
|
| 677 |
+
symbols = r'[$%&*+@!/\\^~=.:\-?|<>]+'
|
| 678 |
+
|
| 679 |
+
# symbol boundary: an operator keyword should not be followed by any of these
|
| 680 |
+
sboundary = '(?!'+symbols+')'
|
| 681 |
+
|
| 682 |
+
# name boundary: a keyword should not be followed by any of these
|
| 683 |
+
boundary = '(?![\w/])'
|
| 684 |
+
|
| 685 |
+
# koka token abstractions
|
| 686 |
+
tokenType = Name.Attribute
|
| 687 |
+
tokenTypeDef = Name.Class
|
| 688 |
+
tokenConstructor = Generic.Emph
|
| 689 |
+
|
| 690 |
+
# main lexer
|
| 691 |
+
tokens = {
|
| 692 |
+
'root': [
|
| 693 |
+
include('whitespace'),
|
| 694 |
+
|
| 695 |
+
# go into type mode
|
| 696 |
+
(r'::?' + sboundary, tokenType, 'type'),
|
| 697 |
+
(r'(alias)(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef),
|
| 698 |
+
'alias-type'),
|
| 699 |
+
(r'(struct)(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef),
|
| 700 |
+
'struct-type'),
|
| 701 |
+
((r'(%s)' % '|'.join(typeStartKeywords)) +
|
| 702 |
+
r'(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef),
|
| 703 |
+
'type'),
|
| 704 |
+
|
| 705 |
+
# special sequences of tokens (we use ?: for non-capturing group as
|
| 706 |
+
# required by 'bygroups')
|
| 707 |
+
(r'(module)(\s+)(interface\s+)?((?:[a-z]\w*/)*[a-z]\w*)',
|
| 708 |
+
bygroups(Keyword, Text, Keyword, Name.Namespace)),
|
| 709 |
+
(r'(import)(\s+)((?:[a-z]\w*/)*[a-z]\w*)'
|
| 710 |
+
r'(?:(\s*)(=)(\s*)((?:qualified\s*)?)'
|
| 711 |
+
r'((?:[a-z]\w*/)*[a-z]\w*))?',
|
| 712 |
+
bygroups(Keyword, Text, Name.Namespace, Text, Keyword, Text,
|
| 713 |
+
Keyword, Name.Namespace)),
|
| 714 |
+
|
| 715 |
+
(r'(^(?:(?:public|private)\s*)?(?:function|fun|val))'
|
| 716 |
+
r'(\s+)([a-z]\w*|\((?:' + symbols + r'|/)\))',
|
| 717 |
+
bygroups(Keyword, Text, Name.Function)),
|
| 718 |
+
(r'(^(?:(?:public|private)\s*)?external)(\s+)(inline\s+)?'
|
| 719 |
+
r'([a-z]\w*|\((?:' + symbols + r'|/)\))',
|
| 720 |
+
bygroups(Keyword, Text, Keyword, Name.Function)),
|
| 721 |
+
|
| 722 |
+
# keywords
|
| 723 |
+
(r'(%s)' % '|'.join(typekeywords) + boundary, Keyword.Type),
|
| 724 |
+
(r'(%s)' % '|'.join(keywords) + boundary, Keyword),
|
| 725 |
+
(r'(%s)' % '|'.join(builtin) + boundary, Keyword.Pseudo),
|
| 726 |
+
(r'::?|:=|\->|[=.]' + sboundary, Keyword),
|
| 727 |
+
|
| 728 |
+
# names
|
| 729 |
+
(r'((?:[a-z]\w*/)*)([A-Z]\w*)',
|
| 730 |
+
bygroups(Name.Namespace, tokenConstructor)),
|
| 731 |
+
(r'((?:[a-z]\w*/)*)([a-z]\w*)', bygroups(Name.Namespace, Name)),
|
| 732 |
+
(r'((?:[a-z]\w*/)*)(\((?:' + symbols + r'|/)\))',
|
| 733 |
+
bygroups(Name.Namespace, Name)),
|
| 734 |
+
(r'_\w*', Name.Variable),
|
| 735 |
+
|
| 736 |
+
# literal string
|
| 737 |
+
(r'@"', String.Double, 'litstring'),
|
| 738 |
+
|
| 739 |
+
# operators
|
| 740 |
+
(symbols + "|/(?![*/])", Operator),
|
| 741 |
+
(r'`', Operator),
|
| 742 |
+
(r'[{}()\[\];,]', Punctuation),
|
| 743 |
+
|
| 744 |
+
# literals. No check for literal characters with len > 1
|
| 745 |
+
(r'[0-9]+\.[0-9]+([eE][\-+]?[0-9]+)?', Number.Float),
|
| 746 |
+
(r'0[xX][0-9a-fA-F]+', Number.Hex),
|
| 747 |
+
(r'[0-9]+', Number.Integer),
|
| 748 |
+
|
| 749 |
+
(r"'", String.Char, 'char'),
|
| 750 |
+
(r'"', String.Double, 'string'),
|
| 751 |
+
],
|
| 752 |
+
|
| 753 |
+
# type started by alias
|
| 754 |
+
'alias-type': [
|
| 755 |
+
(r'=', Keyword),
|
| 756 |
+
include('type')
|
| 757 |
+
],
|
| 758 |
+
|
| 759 |
+
# type started by struct
|
| 760 |
+
'struct-type': [
|
| 761 |
+
(r'(?=\((?!,*\)))', Punctuation, '#pop'),
|
| 762 |
+
include('type')
|
| 763 |
+
],
|
| 764 |
+
|
| 765 |
+
# type started by colon
|
| 766 |
+
'type': [
|
| 767 |
+
(r'[(\[<]', tokenType, 'type-nested'),
|
| 768 |
+
include('type-content')
|
| 769 |
+
],
|
| 770 |
+
|
| 771 |
+
# type nested in brackets: can contain parameters, comma etc.
|
| 772 |
+
'type-nested': [
|
| 773 |
+
(r'[)\]>]', tokenType, '#pop'),
|
| 774 |
+
(r'[(\[<]', tokenType, 'type-nested'),
|
| 775 |
+
(r',', tokenType),
|
| 776 |
+
(r'([a-z]\w*)(\s*)(:)(?!:)',
|
| 777 |
+
bygroups(Name, Text, tokenType)), # parameter name
|
| 778 |
+
include('type-content')
|
| 779 |
+
],
|
| 780 |
+
|
| 781 |
+
# shared contents of a type
|
| 782 |
+
'type-content': [
|
| 783 |
+
include('whitespace'),
|
| 784 |
+
|
| 785 |
+
# keywords
|
| 786 |
+
(r'(%s)' % '|'.join(typekeywords) + boundary, Keyword),
|
| 787 |
+
(r'(?=((%s)' % '|'.join(keywords) + boundary + '))',
|
| 788 |
+
Keyword, '#pop'), # need to match because names overlap...
|
| 789 |
+
|
| 790 |
+
# kinds
|
| 791 |
+
(r'[EPHVX]' + boundary, tokenType),
|
| 792 |
+
|
| 793 |
+
# type names
|
| 794 |
+
(r'[a-z][0-9]*(?![\w/])', tokenType),
|
| 795 |
+
(r'_\w*', tokenType.Variable), # Generic.Emph
|
| 796 |
+
(r'((?:[a-z]\w*/)*)([A-Z]\w*)',
|
| 797 |
+
bygroups(Name.Namespace, tokenType)),
|
| 798 |
+
(r'((?:[a-z]\w*/)*)([a-z]\w+)',
|
| 799 |
+
bygroups(Name.Namespace, tokenType)),
|
| 800 |
+
|
| 801 |
+
# type keyword operators
|
| 802 |
+
(r'::|->|[.:|]', tokenType),
|
| 803 |
+
|
| 804 |
+
# catchall
|
| 805 |
+
default('#pop')
|
| 806 |
+
],
|
| 807 |
+
|
| 808 |
+
# comments and literals
|
| 809 |
+
'whitespace': [
|
| 810 |
+
(r'\n\s*#.*$', Comment.Preproc),
|
| 811 |
+
(r'\s+', Text),
|
| 812 |
+
(r'/\*', Comment.Multiline, 'comment'),
|
| 813 |
+
(r'//.*$', Comment.Single)
|
| 814 |
+
],
|
| 815 |
+
'comment': [
|
| 816 |
+
(r'[^/*]+', Comment.Multiline),
|
| 817 |
+
(r'/\*', Comment.Multiline, '#push'),
|
| 818 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 819 |
+
(r'[*/]', Comment.Multiline),
|
| 820 |
+
],
|
| 821 |
+
'litstring': [
|
| 822 |
+
(r'[^"]+', String.Double),
|
| 823 |
+
(r'""', String.Escape),
|
| 824 |
+
(r'"', String.Double, '#pop'),
|
| 825 |
+
],
|
| 826 |
+
'string': [
|
| 827 |
+
(r'[^\\"\n]+', String.Double),
|
| 828 |
+
include('escape-sequence'),
|
| 829 |
+
(r'["\n]', String.Double, '#pop'),
|
| 830 |
+
],
|
| 831 |
+
'char': [
|
| 832 |
+
(r'[^\\\'\n]+', String.Char),
|
| 833 |
+
include('escape-sequence'),
|
| 834 |
+
(r'[\'\n]', String.Char, '#pop'),
|
| 835 |
+
],
|
| 836 |
+
'escape-sequence': [
|
| 837 |
+
(r'\\[nrt\\"\']', String.Escape),
|
| 838 |
+
(r'\\x[0-9a-fA-F]{2}', String.Escape),
|
| 839 |
+
(r'\\u[0-9a-fA-F]{4}', String.Escape),
|
| 840 |
+
# Yes, \U literals are 6 hex digits.
|
| 841 |
+
(r'\\U[0-9a-fA-F]{6}', String.Escape)
|
| 842 |
+
]
|
| 843 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/haxe.py
ADDED
|
@@ -0,0 +1,936 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.haxe
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for Haxe and related stuff.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import ExtendedRegexLexer, RegexLexer, include, bygroups, \
|
| 15 |
+
default
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Number, Punctuation, Generic, Whitespace
|
| 18 |
+
|
| 19 |
+
__all__ = ['HaxeLexer', 'HxmlLexer']
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class HaxeLexer(ExtendedRegexLexer):
|
| 23 |
+
"""
|
| 24 |
+
For Haxe source code (http://haxe.org/).
|
| 25 |
+
|
| 26 |
+
.. versionadded:: 1.3
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
name = 'Haxe'
|
| 30 |
+
aliases = ['hx', 'haxe', 'hxsl']
|
| 31 |
+
filenames = ['*.hx', '*.hxsl']
|
| 32 |
+
mimetypes = ['text/haxe', 'text/x-haxe', 'text/x-hx']
|
| 33 |
+
|
| 34 |
+
# keywords extracted from lexer.mll in the haxe compiler source
|
| 35 |
+
keyword = (r'(?:function|class|static|var|if|else|while|do|for|'
|
| 36 |
+
r'break|return|continue|extends|implements|import|'
|
| 37 |
+
r'switch|case|default|public|private|try|untyped|'
|
| 38 |
+
r'catch|new|this|throw|extern|enum|in|interface|'
|
| 39 |
+
r'cast|override|dynamic|typedef|package|'
|
| 40 |
+
r'inline|using|null|true|false|abstract)\b')
|
| 41 |
+
|
| 42 |
+
# idtype in lexer.mll
|
| 43 |
+
typeid = r'_*[A-Z]\w*'
|
| 44 |
+
|
| 45 |
+
# combined ident and dollar and idtype
|
| 46 |
+
ident = r'(?:_*[a-z]\w*|_+[0-9]\w*|' + typeid + '|_+|\$\w+)'
|
| 47 |
+
|
| 48 |
+
binop = (r'(?:%=|&=|\|=|\^=|\+=|\-=|\*=|/=|<<=|>\s*>\s*=|>\s*>\s*>\s*=|==|'
|
| 49 |
+
r'!=|<=|>\s*=|&&|\|\||<<|>>>|>\s*>|\.\.\.|<|>|%|&|\||\^|\+|\*|'
|
| 50 |
+
r'/|\-|=>|=)')
|
| 51 |
+
|
| 52 |
+
# ident except keywords
|
| 53 |
+
ident_no_keyword = r'(?!' + keyword + ')' + ident
|
| 54 |
+
|
| 55 |
+
flags = re.DOTALL | re.MULTILINE
|
| 56 |
+
|
| 57 |
+
preproc_stack = []
|
| 58 |
+
|
| 59 |
+
def preproc_callback(self, match, ctx):
|
| 60 |
+
proc = match.group(2)
|
| 61 |
+
|
| 62 |
+
if proc == 'if':
|
| 63 |
+
# store the current stack
|
| 64 |
+
self.preproc_stack.append(ctx.stack[:])
|
| 65 |
+
elif proc in ['else', 'elseif']:
|
| 66 |
+
# restore the stack back to right before #if
|
| 67 |
+
if self.preproc_stack:
|
| 68 |
+
ctx.stack = self.preproc_stack[-1][:]
|
| 69 |
+
elif proc == 'end':
|
| 70 |
+
# remove the saved stack of previous #if
|
| 71 |
+
if self.preproc_stack:
|
| 72 |
+
self.preproc_stack.pop()
|
| 73 |
+
|
| 74 |
+
# #if and #elseif should follow by an expr
|
| 75 |
+
if proc in ['if', 'elseif']:
|
| 76 |
+
ctx.stack.append('preproc-expr')
|
| 77 |
+
|
| 78 |
+
# #error can be optionally follow by the error msg
|
| 79 |
+
if proc in ['error']:
|
| 80 |
+
ctx.stack.append('preproc-error')
|
| 81 |
+
|
| 82 |
+
yield match.start(), Comment.Preproc, '#' + proc
|
| 83 |
+
ctx.pos = match.end()
|
| 84 |
+
|
| 85 |
+
tokens = {
|
| 86 |
+
'root': [
|
| 87 |
+
include('spaces'),
|
| 88 |
+
include('meta'),
|
| 89 |
+
(r'(?:package)\b', Keyword.Namespace, ('semicolon', 'package')),
|
| 90 |
+
(r'(?:import)\b', Keyword.Namespace, ('semicolon', 'import')),
|
| 91 |
+
(r'(?:using)\b', Keyword.Namespace, ('semicolon', 'using')),
|
| 92 |
+
(r'(?:extern|private)\b', Keyword.Declaration),
|
| 93 |
+
(r'(?:abstract)\b', Keyword.Declaration, 'abstract'),
|
| 94 |
+
(r'(?:class|interface)\b', Keyword.Declaration, 'class'),
|
| 95 |
+
(r'(?:enum)\b', Keyword.Declaration, 'enum'),
|
| 96 |
+
(r'(?:typedef)\b', Keyword.Declaration, 'typedef'),
|
| 97 |
+
|
| 98 |
+
# top-level expression
|
| 99 |
+
# although it is not supported in haxe, but it is common to write
|
| 100 |
+
# expression in web pages the positive lookahead here is to prevent
|
| 101 |
+
# an infinite loop at the EOF
|
| 102 |
+
(r'(?=.)', Text, 'expr-statement'),
|
| 103 |
+
],
|
| 104 |
+
|
| 105 |
+
# space/tab/comment/preproc
|
| 106 |
+
'spaces': [
|
| 107 |
+
(r'\s+', Text),
|
| 108 |
+
(r'//[^\n\r]*', Comment.Single),
|
| 109 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 110 |
+
(r'(#)(if|elseif|else|end|error)\b', preproc_callback),
|
| 111 |
+
],
|
| 112 |
+
|
| 113 |
+
'string-single-interpol': [
|
| 114 |
+
(r'\$\{', String.Interpol, ('string-interpol-close', 'expr')),
|
| 115 |
+
(r'\$\$', String.Escape),
|
| 116 |
+
(r'\$(?=' + ident + ')', String.Interpol, 'ident'),
|
| 117 |
+
include('string-single'),
|
| 118 |
+
],
|
| 119 |
+
|
| 120 |
+
'string-single': [
|
| 121 |
+
(r"'", String.Single, '#pop'),
|
| 122 |
+
(r'\\.', String.Escape),
|
| 123 |
+
(r'.', String.Single),
|
| 124 |
+
],
|
| 125 |
+
|
| 126 |
+
'string-double': [
|
| 127 |
+
(r'"', String.Double, '#pop'),
|
| 128 |
+
(r'\\.', String.Escape),
|
| 129 |
+
(r'.', String.Double),
|
| 130 |
+
],
|
| 131 |
+
|
| 132 |
+
'string-interpol-close': [
|
| 133 |
+
(r'\$'+ident, String.Interpol),
|
| 134 |
+
(r'\}', String.Interpol, '#pop'),
|
| 135 |
+
],
|
| 136 |
+
|
| 137 |
+
'package': [
|
| 138 |
+
include('spaces'),
|
| 139 |
+
(ident, Name.Namespace),
|
| 140 |
+
(r'\.', Punctuation, 'import-ident'),
|
| 141 |
+
default('#pop'),
|
| 142 |
+
],
|
| 143 |
+
|
| 144 |
+
'import': [
|
| 145 |
+
include('spaces'),
|
| 146 |
+
(ident, Name.Namespace),
|
| 147 |
+
(r'\*', Keyword), # wildcard import
|
| 148 |
+
(r'\.', Punctuation, 'import-ident'),
|
| 149 |
+
(r'in', Keyword.Namespace, 'ident'),
|
| 150 |
+
default('#pop'),
|
| 151 |
+
],
|
| 152 |
+
|
| 153 |
+
'import-ident': [
|
| 154 |
+
include('spaces'),
|
| 155 |
+
(r'\*', Keyword, '#pop'), # wildcard import
|
| 156 |
+
(ident, Name.Namespace, '#pop'),
|
| 157 |
+
],
|
| 158 |
+
|
| 159 |
+
'using': [
|
| 160 |
+
include('spaces'),
|
| 161 |
+
(ident, Name.Namespace),
|
| 162 |
+
(r'\.', Punctuation, 'import-ident'),
|
| 163 |
+
default('#pop'),
|
| 164 |
+
],
|
| 165 |
+
|
| 166 |
+
'preproc-error': [
|
| 167 |
+
(r'\s+', Comment.Preproc),
|
| 168 |
+
(r"'", String.Single, ('#pop', 'string-single')),
|
| 169 |
+
(r'"', String.Double, ('#pop', 'string-double')),
|
| 170 |
+
default('#pop'),
|
| 171 |
+
],
|
| 172 |
+
|
| 173 |
+
'preproc-expr': [
|
| 174 |
+
(r'\s+', Comment.Preproc),
|
| 175 |
+
(r'\!', Comment.Preproc),
|
| 176 |
+
(r'\(', Comment.Preproc, ('#pop', 'preproc-parenthesis')),
|
| 177 |
+
|
| 178 |
+
(ident, Comment.Preproc, '#pop'),
|
| 179 |
+
|
| 180 |
+
# Float
|
| 181 |
+
(r'\.[0-9]+', Number.Float),
|
| 182 |
+
(r'[0-9]+[eE][+\-]?[0-9]+', Number.Float),
|
| 183 |
+
(r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float),
|
| 184 |
+
(r'[0-9]+\.[0-9]+', Number.Float),
|
| 185 |
+
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float),
|
| 186 |
+
|
| 187 |
+
# Int
|
| 188 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 189 |
+
(r'[0-9]+', Number.Integer),
|
| 190 |
+
|
| 191 |
+
# String
|
| 192 |
+
(r"'", String.Single, ('#pop', 'string-single')),
|
| 193 |
+
(r'"', String.Double, ('#pop', 'string-double')),
|
| 194 |
+
],
|
| 195 |
+
|
| 196 |
+
'preproc-parenthesis': [
|
| 197 |
+
(r'\s+', Comment.Preproc),
|
| 198 |
+
(r'\)', Comment.Preproc, '#pop'),
|
| 199 |
+
default('preproc-expr-in-parenthesis'),
|
| 200 |
+
],
|
| 201 |
+
|
| 202 |
+
'preproc-expr-chain': [
|
| 203 |
+
(r'\s+', Comment.Preproc),
|
| 204 |
+
(binop, Comment.Preproc, ('#pop', 'preproc-expr-in-parenthesis')),
|
| 205 |
+
default('#pop'),
|
| 206 |
+
],
|
| 207 |
+
|
| 208 |
+
# same as 'preproc-expr' but able to chain 'preproc-expr-chain'
|
| 209 |
+
'preproc-expr-in-parenthesis': [
|
| 210 |
+
(r'\s+', Comment.Preproc),
|
| 211 |
+
(r'\!', Comment.Preproc),
|
| 212 |
+
(r'\(', Comment.Preproc,
|
| 213 |
+
('#pop', 'preproc-expr-chain', 'preproc-parenthesis')),
|
| 214 |
+
|
| 215 |
+
(ident, Comment.Preproc, ('#pop', 'preproc-expr-chain')),
|
| 216 |
+
|
| 217 |
+
# Float
|
| 218 |
+
(r'\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
| 219 |
+
(r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
| 220 |
+
(r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
| 221 |
+
(r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
| 222 |
+
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, ('#pop', 'preproc-expr-chain')),
|
| 223 |
+
|
| 224 |
+
# Int
|
| 225 |
+
(r'0x[0-9a-fA-F]+', Number.Hex, ('#pop', 'preproc-expr-chain')),
|
| 226 |
+
(r'[0-9]+', Number.Integer, ('#pop', 'preproc-expr-chain')),
|
| 227 |
+
|
| 228 |
+
# String
|
| 229 |
+
(r"'", String.Single,
|
| 230 |
+
('#pop', 'preproc-expr-chain', 'string-single')),
|
| 231 |
+
(r'"', String.Double,
|
| 232 |
+
('#pop', 'preproc-expr-chain', 'string-double')),
|
| 233 |
+
],
|
| 234 |
+
|
| 235 |
+
'abstract': [
|
| 236 |
+
include('spaces'),
|
| 237 |
+
default(('#pop', 'abstract-body', 'abstract-relation',
|
| 238 |
+
'abstract-opaque', 'type-param-constraint', 'type-name')),
|
| 239 |
+
],
|
| 240 |
+
|
| 241 |
+
'abstract-body': [
|
| 242 |
+
include('spaces'),
|
| 243 |
+
(r'\{', Punctuation, ('#pop', 'class-body')),
|
| 244 |
+
],
|
| 245 |
+
|
| 246 |
+
'abstract-opaque': [
|
| 247 |
+
include('spaces'),
|
| 248 |
+
(r'\(', Punctuation, ('#pop', 'parenthesis-close', 'type')),
|
| 249 |
+
default('#pop'),
|
| 250 |
+
],
|
| 251 |
+
|
| 252 |
+
'abstract-relation': [
|
| 253 |
+
include('spaces'),
|
| 254 |
+
(r'(?:to|from)', Keyword.Declaration, 'type'),
|
| 255 |
+
(r',', Punctuation),
|
| 256 |
+
default('#pop'),
|
| 257 |
+
],
|
| 258 |
+
|
| 259 |
+
'meta': [
|
| 260 |
+
include('spaces'),
|
| 261 |
+
(r'@', Name.Decorator, ('meta-body', 'meta-ident', 'meta-colon')),
|
| 262 |
+
],
|
| 263 |
+
|
| 264 |
+
# optional colon
|
| 265 |
+
'meta-colon': [
|
| 266 |
+
include('spaces'),
|
| 267 |
+
(r':', Name.Decorator, '#pop'),
|
| 268 |
+
default('#pop'),
|
| 269 |
+
],
|
| 270 |
+
|
| 271 |
+
# same as 'ident' but set token as Name.Decorator instead of Name
|
| 272 |
+
'meta-ident': [
|
| 273 |
+
include('spaces'),
|
| 274 |
+
(ident, Name.Decorator, '#pop'),
|
| 275 |
+
],
|
| 276 |
+
|
| 277 |
+
'meta-body': [
|
| 278 |
+
include('spaces'),
|
| 279 |
+
(r'\(', Name.Decorator, ('#pop', 'meta-call')),
|
| 280 |
+
default('#pop'),
|
| 281 |
+
],
|
| 282 |
+
|
| 283 |
+
'meta-call': [
|
| 284 |
+
include('spaces'),
|
| 285 |
+
(r'\)', Name.Decorator, '#pop'),
|
| 286 |
+
default(('#pop', 'meta-call-sep', 'expr')),
|
| 287 |
+
],
|
| 288 |
+
|
| 289 |
+
'meta-call-sep': [
|
| 290 |
+
include('spaces'),
|
| 291 |
+
(r'\)', Name.Decorator, '#pop'),
|
| 292 |
+
(r',', Punctuation, ('#pop', 'meta-call')),
|
| 293 |
+
],
|
| 294 |
+
|
| 295 |
+
'typedef': [
|
| 296 |
+
include('spaces'),
|
| 297 |
+
default(('#pop', 'typedef-body', 'type-param-constraint',
|
| 298 |
+
'type-name')),
|
| 299 |
+
],
|
| 300 |
+
|
| 301 |
+
'typedef-body': [
|
| 302 |
+
include('spaces'),
|
| 303 |
+
(r'=', Operator, ('#pop', 'optional-semicolon', 'type')),
|
| 304 |
+
],
|
| 305 |
+
|
| 306 |
+
'enum': [
|
| 307 |
+
include('spaces'),
|
| 308 |
+
default(('#pop', 'enum-body', 'bracket-open',
|
| 309 |
+
'type-param-constraint', 'type-name')),
|
| 310 |
+
],
|
| 311 |
+
|
| 312 |
+
'enum-body': [
|
| 313 |
+
include('spaces'),
|
| 314 |
+
include('meta'),
|
| 315 |
+
(r'\}', Punctuation, '#pop'),
|
| 316 |
+
(ident_no_keyword, Name, ('enum-member', 'type-param-constraint')),
|
| 317 |
+
],
|
| 318 |
+
|
| 319 |
+
'enum-member': [
|
| 320 |
+
include('spaces'),
|
| 321 |
+
(r'\(', Punctuation,
|
| 322 |
+
('#pop', 'semicolon', 'flag', 'function-param')),
|
| 323 |
+
default(('#pop', 'semicolon', 'flag')),
|
| 324 |
+
],
|
| 325 |
+
|
| 326 |
+
'class': [
|
| 327 |
+
include('spaces'),
|
| 328 |
+
default(('#pop', 'class-body', 'bracket-open', 'extends',
|
| 329 |
+
'type-param-constraint', 'type-name')),
|
| 330 |
+
],
|
| 331 |
+
|
| 332 |
+
'extends': [
|
| 333 |
+
include('spaces'),
|
| 334 |
+
(r'(?:extends|implements)\b', Keyword.Declaration, 'type'),
|
| 335 |
+
(r',', Punctuation), # the comma is made optional here, since haxe2
|
| 336 |
+
# requires the comma but haxe3 does not allow it
|
| 337 |
+
default('#pop'),
|
| 338 |
+
],
|
| 339 |
+
|
| 340 |
+
'bracket-open': [
|
| 341 |
+
include('spaces'),
|
| 342 |
+
(r'\{', Punctuation, '#pop'),
|
| 343 |
+
],
|
| 344 |
+
|
| 345 |
+
'bracket-close': [
|
| 346 |
+
include('spaces'),
|
| 347 |
+
(r'\}', Punctuation, '#pop'),
|
| 348 |
+
],
|
| 349 |
+
|
| 350 |
+
'class-body': [
|
| 351 |
+
include('spaces'),
|
| 352 |
+
include('meta'),
|
| 353 |
+
(r'\}', Punctuation, '#pop'),
|
| 354 |
+
(r'(?:static|public|private|override|dynamic|inline|macro)\b',
|
| 355 |
+
Keyword.Declaration),
|
| 356 |
+
default('class-member'),
|
| 357 |
+
],
|
| 358 |
+
|
| 359 |
+
'class-member': [
|
| 360 |
+
include('spaces'),
|
| 361 |
+
(r'(var)\b', Keyword.Declaration,
|
| 362 |
+
('#pop', 'optional-semicolon', 'var')),
|
| 363 |
+
(r'(function)\b', Keyword.Declaration,
|
| 364 |
+
('#pop', 'optional-semicolon', 'class-method')),
|
| 365 |
+
],
|
| 366 |
+
|
| 367 |
+
# local function, anonymous or not
|
| 368 |
+
'function-local': [
|
| 369 |
+
include('spaces'),
|
| 370 |
+
(ident_no_keyword, Name.Function,
|
| 371 |
+
('#pop', 'optional-expr', 'flag', 'function-param',
|
| 372 |
+
'parenthesis-open', 'type-param-constraint')),
|
| 373 |
+
default(('#pop', 'optional-expr', 'flag', 'function-param',
|
| 374 |
+
'parenthesis-open', 'type-param-constraint')),
|
| 375 |
+
],
|
| 376 |
+
|
| 377 |
+
'optional-expr': [
|
| 378 |
+
include('spaces'),
|
| 379 |
+
include('expr'),
|
| 380 |
+
default('#pop'),
|
| 381 |
+
],
|
| 382 |
+
|
| 383 |
+
'class-method': [
|
| 384 |
+
include('spaces'),
|
| 385 |
+
(ident, Name.Function, ('#pop', 'optional-expr', 'flag',
|
| 386 |
+
'function-param', 'parenthesis-open',
|
| 387 |
+
'type-param-constraint')),
|
| 388 |
+
],
|
| 389 |
+
|
| 390 |
+
# function arguments
|
| 391 |
+
'function-param': [
|
| 392 |
+
include('spaces'),
|
| 393 |
+
(r'\)', Punctuation, '#pop'),
|
| 394 |
+
(r'\?', Punctuation),
|
| 395 |
+
(ident_no_keyword, Name,
|
| 396 |
+
('#pop', 'function-param-sep', 'assign', 'flag')),
|
| 397 |
+
],
|
| 398 |
+
|
| 399 |
+
'function-param-sep': [
|
| 400 |
+
include('spaces'),
|
| 401 |
+
(r'\)', Punctuation, '#pop'),
|
| 402 |
+
(r',', Punctuation, ('#pop', 'function-param')),
|
| 403 |
+
],
|
| 404 |
+
|
| 405 |
+
'prop-get-set': [
|
| 406 |
+
include('spaces'),
|
| 407 |
+
(r'\(', Punctuation, ('#pop', 'parenthesis-close',
|
| 408 |
+
'prop-get-set-opt', 'comma', 'prop-get-set-opt')),
|
| 409 |
+
default('#pop'),
|
| 410 |
+
],
|
| 411 |
+
|
| 412 |
+
'prop-get-set-opt': [
|
| 413 |
+
include('spaces'),
|
| 414 |
+
(r'(?:default|null|never|dynamic|get|set)\b', Keyword, '#pop'),
|
| 415 |
+
(ident_no_keyword, Text, '#pop'), # custom getter/setter
|
| 416 |
+
],
|
| 417 |
+
|
| 418 |
+
'expr-statement': [
|
| 419 |
+
include('spaces'),
|
| 420 |
+
# makes semicolon optional here, just to avoid checking the last
|
| 421 |
+
# one is bracket or not.
|
| 422 |
+
default(('#pop', 'optional-semicolon', 'expr')),
|
| 423 |
+
],
|
| 424 |
+
|
| 425 |
+
'expr': [
|
| 426 |
+
include('spaces'),
|
| 427 |
+
(r'@', Name.Decorator, ('#pop', 'optional-expr', 'meta-body',
|
| 428 |
+
'meta-ident', 'meta-colon')),
|
| 429 |
+
(r'(?:\+\+|\-\-|~(?!/)|!|\-)', Operator),
|
| 430 |
+
(r'\(', Punctuation, ('#pop', 'expr-chain', 'parenthesis')),
|
| 431 |
+
(r'(?:static|public|private|override|dynamic|inline)\b',
|
| 432 |
+
Keyword.Declaration),
|
| 433 |
+
(r'(?:function)\b', Keyword.Declaration, ('#pop', 'expr-chain',
|
| 434 |
+
'function-local')),
|
| 435 |
+
(r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket')),
|
| 436 |
+
(r'(?:true|false|null)\b', Keyword.Constant, ('#pop', 'expr-chain')),
|
| 437 |
+
(r'(?:this)\b', Keyword, ('#pop', 'expr-chain')),
|
| 438 |
+
(r'(?:cast)\b', Keyword, ('#pop', 'expr-chain', 'cast')),
|
| 439 |
+
(r'(?:try)\b', Keyword, ('#pop', 'catch', 'expr')),
|
| 440 |
+
(r'(?:var)\b', Keyword.Declaration, ('#pop', 'var')),
|
| 441 |
+
(r'(?:new)\b', Keyword, ('#pop', 'expr-chain', 'new')),
|
| 442 |
+
(r'(?:switch)\b', Keyword, ('#pop', 'switch')),
|
| 443 |
+
(r'(?:if)\b', Keyword, ('#pop', 'if')),
|
| 444 |
+
(r'(?:do)\b', Keyword, ('#pop', 'do')),
|
| 445 |
+
(r'(?:while)\b', Keyword, ('#pop', 'while')),
|
| 446 |
+
(r'(?:for)\b', Keyword, ('#pop', 'for')),
|
| 447 |
+
(r'(?:untyped|throw)\b', Keyword),
|
| 448 |
+
(r'(?:return)\b', Keyword, ('#pop', 'optional-expr')),
|
| 449 |
+
(r'(?:macro)\b', Keyword, ('#pop', 'macro')),
|
| 450 |
+
(r'(?:continue|break)\b', Keyword, '#pop'),
|
| 451 |
+
(r'(?:\$\s*[a-z]\b|\$(?!'+ident+'))', Name, ('#pop', 'dollar')),
|
| 452 |
+
(ident_no_keyword, Name, ('#pop', 'expr-chain')),
|
| 453 |
+
|
| 454 |
+
# Float
|
| 455 |
+
(r'\.[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
| 456 |
+
(r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
| 457 |
+
(r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
| 458 |
+
(r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
| 459 |
+
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, ('#pop', 'expr-chain')),
|
| 460 |
+
|
| 461 |
+
# Int
|
| 462 |
+
(r'0x[0-9a-fA-F]+', Number.Hex, ('#pop', 'expr-chain')),
|
| 463 |
+
(r'[0-9]+', Number.Integer, ('#pop', 'expr-chain')),
|
| 464 |
+
|
| 465 |
+
# String
|
| 466 |
+
(r"'", String.Single, ('#pop', 'expr-chain', 'string-single-interpol')),
|
| 467 |
+
(r'"', String.Double, ('#pop', 'expr-chain', 'string-double')),
|
| 468 |
+
|
| 469 |
+
# EReg
|
| 470 |
+
(r'~/(\\\\|\\/|[^/\n])*/[gimsu]*', String.Regex, ('#pop', 'expr-chain')),
|
| 471 |
+
|
| 472 |
+
# Array
|
| 473 |
+
(r'\[', Punctuation, ('#pop', 'expr-chain', 'array-decl')),
|
| 474 |
+
],
|
| 475 |
+
|
| 476 |
+
'expr-chain': [
|
| 477 |
+
include('spaces'),
|
| 478 |
+
(r'(?:\+\+|\-\-)', Operator),
|
| 479 |
+
(binop, Operator, ('#pop', 'expr')),
|
| 480 |
+
(r'(?:in)\b', Keyword, ('#pop', 'expr')),
|
| 481 |
+
(r'\?', Operator, ('#pop', 'expr', 'ternary', 'expr')),
|
| 482 |
+
(r'(\.)(' + ident_no_keyword + ')', bygroups(Punctuation, Name)),
|
| 483 |
+
(r'\[', Punctuation, 'array-access'),
|
| 484 |
+
(r'\(', Punctuation, 'call'),
|
| 485 |
+
default('#pop'),
|
| 486 |
+
],
|
| 487 |
+
|
| 488 |
+
# macro reification
|
| 489 |
+
'macro': [
|
| 490 |
+
include('spaces'),
|
| 491 |
+
include('meta'),
|
| 492 |
+
(r':', Punctuation, ('#pop', 'type')),
|
| 493 |
+
|
| 494 |
+
(r'(?:extern|private)\b', Keyword.Declaration),
|
| 495 |
+
(r'(?:abstract)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'abstract')),
|
| 496 |
+
(r'(?:class|interface)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'macro-class')),
|
| 497 |
+
(r'(?:enum)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'enum')),
|
| 498 |
+
(r'(?:typedef)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'typedef')),
|
| 499 |
+
|
| 500 |
+
default(('#pop', 'expr')),
|
| 501 |
+
],
|
| 502 |
+
|
| 503 |
+
'macro-class': [
|
| 504 |
+
(r'\{', Punctuation, ('#pop', 'class-body')),
|
| 505 |
+
include('class')
|
| 506 |
+
],
|
| 507 |
+
|
| 508 |
+
# cast can be written as "cast expr" or "cast(expr, type)"
|
| 509 |
+
'cast': [
|
| 510 |
+
include('spaces'),
|
| 511 |
+
(r'\(', Punctuation, ('#pop', 'parenthesis-close',
|
| 512 |
+
'cast-type', 'expr')),
|
| 513 |
+
default(('#pop', 'expr')),
|
| 514 |
+
],
|
| 515 |
+
|
| 516 |
+
# optionally give a type as the 2nd argument of cast()
|
| 517 |
+
'cast-type': [
|
| 518 |
+
include('spaces'),
|
| 519 |
+
(r',', Punctuation, ('#pop', 'type')),
|
| 520 |
+
default('#pop'),
|
| 521 |
+
],
|
| 522 |
+
|
| 523 |
+
'catch': [
|
| 524 |
+
include('spaces'),
|
| 525 |
+
(r'(?:catch)\b', Keyword, ('expr', 'function-param',
|
| 526 |
+
'parenthesis-open')),
|
| 527 |
+
default('#pop'),
|
| 528 |
+
],
|
| 529 |
+
|
| 530 |
+
# do-while loop
|
| 531 |
+
'do': [
|
| 532 |
+
include('spaces'),
|
| 533 |
+
default(('#pop', 'do-while', 'expr')),
|
| 534 |
+
],
|
| 535 |
+
|
| 536 |
+
# the while after do
|
| 537 |
+
'do-while': [
|
| 538 |
+
include('spaces'),
|
| 539 |
+
(r'(?:while)\b', Keyword, ('#pop', 'parenthesis',
|
| 540 |
+
'parenthesis-open')),
|
| 541 |
+
],
|
| 542 |
+
|
| 543 |
+
'while': [
|
| 544 |
+
include('spaces'),
|
| 545 |
+
(r'\(', Punctuation, ('#pop', 'expr', 'parenthesis')),
|
| 546 |
+
],
|
| 547 |
+
|
| 548 |
+
'for': [
|
| 549 |
+
include('spaces'),
|
| 550 |
+
(r'\(', Punctuation, ('#pop', 'expr', 'parenthesis')),
|
| 551 |
+
],
|
| 552 |
+
|
| 553 |
+
'if': [
|
| 554 |
+
include('spaces'),
|
| 555 |
+
(r'\(', Punctuation, ('#pop', 'else', 'optional-semicolon', 'expr',
|
| 556 |
+
'parenthesis')),
|
| 557 |
+
],
|
| 558 |
+
|
| 559 |
+
'else': [
|
| 560 |
+
include('spaces'),
|
| 561 |
+
(r'(?:else)\b', Keyword, ('#pop', 'expr')),
|
| 562 |
+
default('#pop'),
|
| 563 |
+
],
|
| 564 |
+
|
| 565 |
+
'switch': [
|
| 566 |
+
include('spaces'),
|
| 567 |
+
default(('#pop', 'switch-body', 'bracket-open', 'expr')),
|
| 568 |
+
],
|
| 569 |
+
|
| 570 |
+
'switch-body': [
|
| 571 |
+
include('spaces'),
|
| 572 |
+
(r'(?:case|default)\b', Keyword, ('case-block', 'case')),
|
| 573 |
+
(r'\}', Punctuation, '#pop'),
|
| 574 |
+
],
|
| 575 |
+
|
| 576 |
+
'case': [
|
| 577 |
+
include('spaces'),
|
| 578 |
+
(r':', Punctuation, '#pop'),
|
| 579 |
+
default(('#pop', 'case-sep', 'case-guard', 'expr')),
|
| 580 |
+
],
|
| 581 |
+
|
| 582 |
+
'case-sep': [
|
| 583 |
+
include('spaces'),
|
| 584 |
+
(r':', Punctuation, '#pop'),
|
| 585 |
+
(r',', Punctuation, ('#pop', 'case')),
|
| 586 |
+
],
|
| 587 |
+
|
| 588 |
+
'case-guard': [
|
| 589 |
+
include('spaces'),
|
| 590 |
+
(r'(?:if)\b', Keyword, ('#pop', 'parenthesis', 'parenthesis-open')),
|
| 591 |
+
default('#pop'),
|
| 592 |
+
],
|
| 593 |
+
|
| 594 |
+
# optional multiple expr under a case
|
| 595 |
+
'case-block': [
|
| 596 |
+
include('spaces'),
|
| 597 |
+
(r'(?!(?:case|default)\b|\})', Keyword, 'expr-statement'),
|
| 598 |
+
default('#pop'),
|
| 599 |
+
],
|
| 600 |
+
|
| 601 |
+
'new': [
|
| 602 |
+
include('spaces'),
|
| 603 |
+
default(('#pop', 'call', 'parenthesis-open', 'type')),
|
| 604 |
+
],
|
| 605 |
+
|
| 606 |
+
'array-decl': [
|
| 607 |
+
include('spaces'),
|
| 608 |
+
(r'\]', Punctuation, '#pop'),
|
| 609 |
+
default(('#pop', 'array-decl-sep', 'expr')),
|
| 610 |
+
],
|
| 611 |
+
|
| 612 |
+
'array-decl-sep': [
|
| 613 |
+
include('spaces'),
|
| 614 |
+
(r'\]', Punctuation, '#pop'),
|
| 615 |
+
(r',', Punctuation, ('#pop', 'array-decl')),
|
| 616 |
+
],
|
| 617 |
+
|
| 618 |
+
'array-access': [
|
| 619 |
+
include('spaces'),
|
| 620 |
+
default(('#pop', 'array-access-close', 'expr')),
|
| 621 |
+
],
|
| 622 |
+
|
| 623 |
+
'array-access-close': [
|
| 624 |
+
include('spaces'),
|
| 625 |
+
(r'\]', Punctuation, '#pop'),
|
| 626 |
+
],
|
| 627 |
+
|
| 628 |
+
'comma': [
|
| 629 |
+
include('spaces'),
|
| 630 |
+
(r',', Punctuation, '#pop'),
|
| 631 |
+
],
|
| 632 |
+
|
| 633 |
+
'colon': [
|
| 634 |
+
include('spaces'),
|
| 635 |
+
(r':', Punctuation, '#pop'),
|
| 636 |
+
],
|
| 637 |
+
|
| 638 |
+
'semicolon': [
|
| 639 |
+
include('spaces'),
|
| 640 |
+
(r';', Punctuation, '#pop'),
|
| 641 |
+
],
|
| 642 |
+
|
| 643 |
+
'optional-semicolon': [
|
| 644 |
+
include('spaces'),
|
| 645 |
+
(r';', Punctuation, '#pop'),
|
| 646 |
+
default('#pop'),
|
| 647 |
+
],
|
| 648 |
+
|
| 649 |
+
# identity that CAN be a Haxe keyword
|
| 650 |
+
'ident': [
|
| 651 |
+
include('spaces'),
|
| 652 |
+
(ident, Name, '#pop'),
|
| 653 |
+
],
|
| 654 |
+
|
| 655 |
+
'dollar': [
|
| 656 |
+
include('spaces'),
|
| 657 |
+
(r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket-close', 'expr')),
|
| 658 |
+
default(('#pop', 'expr-chain')),
|
| 659 |
+
],
|
| 660 |
+
|
| 661 |
+
'type-name': [
|
| 662 |
+
include('spaces'),
|
| 663 |
+
(typeid, Name, '#pop'),
|
| 664 |
+
],
|
| 665 |
+
|
| 666 |
+
'type-full-name': [
|
| 667 |
+
include('spaces'),
|
| 668 |
+
(r'\.', Punctuation, 'ident'),
|
| 669 |
+
default('#pop'),
|
| 670 |
+
],
|
| 671 |
+
|
| 672 |
+
'type': [
|
| 673 |
+
include('spaces'),
|
| 674 |
+
(r'\?', Punctuation),
|
| 675 |
+
(ident, Name, ('#pop', 'type-check', 'type-full-name')),
|
| 676 |
+
(r'\{', Punctuation, ('#pop', 'type-check', 'type-struct')),
|
| 677 |
+
(r'\(', Punctuation, ('#pop', 'type-check', 'type-parenthesis')),
|
| 678 |
+
],
|
| 679 |
+
|
| 680 |
+
'type-parenthesis': [
|
| 681 |
+
include('spaces'),
|
| 682 |
+
default(('#pop', 'parenthesis-close', 'type')),
|
| 683 |
+
],
|
| 684 |
+
|
| 685 |
+
'type-check': [
|
| 686 |
+
include('spaces'),
|
| 687 |
+
(r'->', Punctuation, ('#pop', 'type')),
|
| 688 |
+
(r'<(?!=)', Punctuation, 'type-param'),
|
| 689 |
+
default('#pop'),
|
| 690 |
+
],
|
| 691 |
+
|
| 692 |
+
'type-struct': [
|
| 693 |
+
include('spaces'),
|
| 694 |
+
(r'\}', Punctuation, '#pop'),
|
| 695 |
+
(r'\?', Punctuation),
|
| 696 |
+
(r'>', Punctuation, ('comma', 'type')),
|
| 697 |
+
(ident_no_keyword, Name, ('#pop', 'type-struct-sep', 'type', 'colon')),
|
| 698 |
+
include('class-body'),
|
| 699 |
+
],
|
| 700 |
+
|
| 701 |
+
'type-struct-sep': [
|
| 702 |
+
include('spaces'),
|
| 703 |
+
(r'\}', Punctuation, '#pop'),
|
| 704 |
+
(r',', Punctuation, ('#pop', 'type-struct')),
|
| 705 |
+
],
|
| 706 |
+
|
| 707 |
+
# type-param can be a normal type or a constant literal...
|
| 708 |
+
'type-param-type': [
|
| 709 |
+
# Float
|
| 710 |
+
(r'\.[0-9]+', Number.Float, '#pop'),
|
| 711 |
+
(r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, '#pop'),
|
| 712 |
+
(r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, '#pop'),
|
| 713 |
+
(r'[0-9]+\.[0-9]+', Number.Float, '#pop'),
|
| 714 |
+
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, '#pop'),
|
| 715 |
+
|
| 716 |
+
# Int
|
| 717 |
+
(r'0x[0-9a-fA-F]+', Number.Hex, '#pop'),
|
| 718 |
+
(r'[0-9]+', Number.Integer, '#pop'),
|
| 719 |
+
|
| 720 |
+
# String
|
| 721 |
+
(r"'", String.Single, ('#pop', 'string-single')),
|
| 722 |
+
(r'"', String.Double, ('#pop', 'string-double')),
|
| 723 |
+
|
| 724 |
+
# EReg
|
| 725 |
+
(r'~/(\\\\|\\/|[^/\n])*/[gim]*', String.Regex, '#pop'),
|
| 726 |
+
|
| 727 |
+
# Array
|
| 728 |
+
(r'\[', Operator, ('#pop', 'array-decl')),
|
| 729 |
+
|
| 730 |
+
include('type'),
|
| 731 |
+
],
|
| 732 |
+
|
| 733 |
+
# type-param part of a type
|
| 734 |
+
# ie. the <A,B> path in Map<A,B>
|
| 735 |
+
'type-param': [
|
| 736 |
+
include('spaces'),
|
| 737 |
+
default(('#pop', 'type-param-sep', 'type-param-type')),
|
| 738 |
+
],
|
| 739 |
+
|
| 740 |
+
'type-param-sep': [
|
| 741 |
+
include('spaces'),
|
| 742 |
+
(r'>', Punctuation, '#pop'),
|
| 743 |
+
(r',', Punctuation, ('#pop', 'type-param')),
|
| 744 |
+
],
|
| 745 |
+
|
| 746 |
+
# optional type-param that may include constraint
|
| 747 |
+
# ie. <T:Constraint, T2:(ConstraintA,ConstraintB)>
|
| 748 |
+
'type-param-constraint': [
|
| 749 |
+
include('spaces'),
|
| 750 |
+
(r'<(?!=)', Punctuation, ('#pop', 'type-param-constraint-sep',
|
| 751 |
+
'type-param-constraint-flag', 'type-name')),
|
| 752 |
+
default('#pop'),
|
| 753 |
+
],
|
| 754 |
+
|
| 755 |
+
'type-param-constraint-sep': [
|
| 756 |
+
include('spaces'),
|
| 757 |
+
(r'>', Punctuation, '#pop'),
|
| 758 |
+
(r',', Punctuation, ('#pop', 'type-param-constraint-sep',
|
| 759 |
+
'type-param-constraint-flag', 'type-name')),
|
| 760 |
+
],
|
| 761 |
+
|
| 762 |
+
# the optional constraint inside type-param
|
| 763 |
+
'type-param-constraint-flag': [
|
| 764 |
+
include('spaces'),
|
| 765 |
+
(r':', Punctuation, ('#pop', 'type-param-constraint-flag-type')),
|
| 766 |
+
default('#pop'),
|
| 767 |
+
],
|
| 768 |
+
|
| 769 |
+
'type-param-constraint-flag-type': [
|
| 770 |
+
include('spaces'),
|
| 771 |
+
(r'\(', Punctuation, ('#pop', 'type-param-constraint-flag-type-sep',
|
| 772 |
+
'type')),
|
| 773 |
+
default(('#pop', 'type')),
|
| 774 |
+
],
|
| 775 |
+
|
| 776 |
+
'type-param-constraint-flag-type-sep': [
|
| 777 |
+
include('spaces'),
|
| 778 |
+
(r'\)', Punctuation, '#pop'),
|
| 779 |
+
(r',', Punctuation, 'type'),
|
| 780 |
+
],
|
| 781 |
+
|
| 782 |
+
# a parenthesis expr that contain exactly one expr
|
| 783 |
+
'parenthesis': [
|
| 784 |
+
include('spaces'),
|
| 785 |
+
default(('#pop', 'parenthesis-close', 'flag', 'expr')),
|
| 786 |
+
],
|
| 787 |
+
|
| 788 |
+
'parenthesis-open': [
|
| 789 |
+
include('spaces'),
|
| 790 |
+
(r'\(', Punctuation, '#pop'),
|
| 791 |
+
],
|
| 792 |
+
|
| 793 |
+
'parenthesis-close': [
|
| 794 |
+
include('spaces'),
|
| 795 |
+
(r'\)', Punctuation, '#pop'),
|
| 796 |
+
],
|
| 797 |
+
|
| 798 |
+
'var': [
|
| 799 |
+
include('spaces'),
|
| 800 |
+
(ident_no_keyword, Text, ('#pop', 'var-sep', 'assign', 'flag', 'prop-get-set')),
|
| 801 |
+
],
|
| 802 |
+
|
| 803 |
+
# optional more var decl.
|
| 804 |
+
'var-sep': [
|
| 805 |
+
include('spaces'),
|
| 806 |
+
(r',', Punctuation, ('#pop', 'var')),
|
| 807 |
+
default('#pop'),
|
| 808 |
+
],
|
| 809 |
+
|
| 810 |
+
# optional assignment
|
| 811 |
+
'assign': [
|
| 812 |
+
include('spaces'),
|
| 813 |
+
(r'=', Operator, ('#pop', 'expr')),
|
| 814 |
+
default('#pop'),
|
| 815 |
+
],
|
| 816 |
+
|
| 817 |
+
# optional type flag
|
| 818 |
+
'flag': [
|
| 819 |
+
include('spaces'),
|
| 820 |
+
(r':', Punctuation, ('#pop', 'type')),
|
| 821 |
+
default('#pop'),
|
| 822 |
+
],
|
| 823 |
+
|
| 824 |
+
# colon as part of a ternary operator (?:)
|
| 825 |
+
'ternary': [
|
| 826 |
+
include('spaces'),
|
| 827 |
+
(r':', Operator, '#pop'),
|
| 828 |
+
],
|
| 829 |
+
|
| 830 |
+
# function call
|
| 831 |
+
'call': [
|
| 832 |
+
include('spaces'),
|
| 833 |
+
(r'\)', Punctuation, '#pop'),
|
| 834 |
+
default(('#pop', 'call-sep', 'expr')),
|
| 835 |
+
],
|
| 836 |
+
|
| 837 |
+
# after a call param
|
| 838 |
+
'call-sep': [
|
| 839 |
+
include('spaces'),
|
| 840 |
+
(r'\)', Punctuation, '#pop'),
|
| 841 |
+
(r',', Punctuation, ('#pop', 'call')),
|
| 842 |
+
],
|
| 843 |
+
|
| 844 |
+
# bracket can be block or object
|
| 845 |
+
'bracket': [
|
| 846 |
+
include('spaces'),
|
| 847 |
+
(r'(?!(?:\$\s*[a-z]\b|\$(?!'+ident+')))' + ident_no_keyword, Name,
|
| 848 |
+
('#pop', 'bracket-check')),
|
| 849 |
+
(r"'", String.Single, ('#pop', 'bracket-check', 'string-single')),
|
| 850 |
+
(r'"', String.Double, ('#pop', 'bracket-check', 'string-double')),
|
| 851 |
+
default(('#pop', 'block')),
|
| 852 |
+
],
|
| 853 |
+
|
| 854 |
+
'bracket-check': [
|
| 855 |
+
include('spaces'),
|
| 856 |
+
(r':', Punctuation, ('#pop', 'object-sep', 'expr')), # is object
|
| 857 |
+
default(('#pop', 'block', 'optional-semicolon', 'expr-chain')), # is block
|
| 858 |
+
],
|
| 859 |
+
|
| 860 |
+
# code block
|
| 861 |
+
'block': [
|
| 862 |
+
include('spaces'),
|
| 863 |
+
(r'\}', Punctuation, '#pop'),
|
| 864 |
+
default('expr-statement'),
|
| 865 |
+
],
|
| 866 |
+
|
| 867 |
+
# object in key-value pairs
|
| 868 |
+
'object': [
|
| 869 |
+
include('spaces'),
|
| 870 |
+
(r'\}', Punctuation, '#pop'),
|
| 871 |
+
default(('#pop', 'object-sep', 'expr', 'colon', 'ident-or-string'))
|
| 872 |
+
],
|
| 873 |
+
|
| 874 |
+
# a key of an object
|
| 875 |
+
'ident-or-string': [
|
| 876 |
+
include('spaces'),
|
| 877 |
+
(ident_no_keyword, Name, '#pop'),
|
| 878 |
+
(r"'", String.Single, ('#pop', 'string-single')),
|
| 879 |
+
(r'"', String.Double, ('#pop', 'string-double')),
|
| 880 |
+
],
|
| 881 |
+
|
| 882 |
+
# after a key-value pair in object
|
| 883 |
+
'object-sep': [
|
| 884 |
+
include('spaces'),
|
| 885 |
+
(r'\}', Punctuation, '#pop'),
|
| 886 |
+
(r',', Punctuation, ('#pop', 'object')),
|
| 887 |
+
],
|
| 888 |
+
|
| 889 |
+
|
| 890 |
+
|
| 891 |
+
}
|
| 892 |
+
|
| 893 |
+
def analyse_text(text):
|
| 894 |
+
if re.match(r'\w+\s*:\s*\w', text):
|
| 895 |
+
return 0.3
|
| 896 |
+
|
| 897 |
+
|
| 898 |
+
class HxmlLexer(RegexLexer):
|
| 899 |
+
"""
|
| 900 |
+
Lexer for `haXe build <http://haxe.org/doc/compiler>`_ files.
|
| 901 |
+
|
| 902 |
+
.. versionadded:: 1.6
|
| 903 |
+
"""
|
| 904 |
+
name = 'Hxml'
|
| 905 |
+
aliases = ['haxeml', 'hxml']
|
| 906 |
+
filenames = ['*.hxml']
|
| 907 |
+
|
| 908 |
+
tokens = {
|
| 909 |
+
'root': [
|
| 910 |
+
# Seperator
|
| 911 |
+
(r'(--)(next)', bygroups(Punctuation, Generic.Heading)),
|
| 912 |
+
# Compiler switches with one dash
|
| 913 |
+
(r'(-)(prompt|debug|v)', bygroups(Punctuation, Keyword.Keyword)),
|
| 914 |
+
# Compilerswitches with two dashes
|
| 915 |
+
(r'(--)(neko-source|flash-strict|flash-use-stage|no-opt|no-traces|'
|
| 916 |
+
r'no-inline|times|no-output)', bygroups(Punctuation, Keyword)),
|
| 917 |
+
# Targets and other options that take an argument
|
| 918 |
+
(r'(-)(cpp|js|neko|x|as3|swf9?|swf-lib|php|xml|main|lib|D|resource|'
|
| 919 |
+
r'cp|cmd)( +)(.+)',
|
| 920 |
+
bygroups(Punctuation, Keyword, Whitespace, String)),
|
| 921 |
+
# Options that take only numerical arguments
|
| 922 |
+
(r'(-)(swf-version)( +)(\d+)',
|
| 923 |
+
bygroups(Punctuation, Keyword, Number.Integer)),
|
| 924 |
+
# An Option that defines the size, the fps and the background
|
| 925 |
+
# color of an flash movie
|
| 926 |
+
(r'(-)(swf-header)( +)(\d+)(:)(\d+)(:)(\d+)(:)([A-Fa-f0-9]{6})',
|
| 927 |
+
bygroups(Punctuation, Keyword, Whitespace, Number.Integer,
|
| 928 |
+
Punctuation, Number.Integer, Punctuation, Number.Integer,
|
| 929 |
+
Punctuation, Number.Hex)),
|
| 930 |
+
# options with two dashes that takes arguments
|
| 931 |
+
(r'(--)(js-namespace|php-front|php-lib|remap|gen-hx-classes)( +)'
|
| 932 |
+
r'(.+)', bygroups(Punctuation, Keyword, Whitespace, String)),
|
| 933 |
+
# Single line comment, multiline ones are not allowed.
|
| 934 |
+
(r'#.*', Comment.Single)
|
| 935 |
+
]
|
| 936 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/hdl.py
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.hdl
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for hardware descriptor languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, bygroups, include, using, this, words
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Error
|
| 17 |
+
|
| 18 |
+
__all__ = ['VerilogLexer', 'SystemVerilogLexer', 'VhdlLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class VerilogLexer(RegexLexer):
|
| 22 |
+
"""
|
| 23 |
+
For verilog source code with preprocessor directives.
|
| 24 |
+
|
| 25 |
+
.. versionadded:: 1.4
|
| 26 |
+
"""
|
| 27 |
+
name = 'verilog'
|
| 28 |
+
aliases = ['verilog', 'v']
|
| 29 |
+
filenames = ['*.v']
|
| 30 |
+
mimetypes = ['text/x-verilog']
|
| 31 |
+
|
| 32 |
+
#: optional Comment or Whitespace
|
| 33 |
+
_ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
|
| 34 |
+
|
| 35 |
+
tokens = {
|
| 36 |
+
'root': [
|
| 37 |
+
(r'^\s*`define', Comment.Preproc, 'macro'),
|
| 38 |
+
(r'\n', Text),
|
| 39 |
+
(r'\s+', Text),
|
| 40 |
+
(r'\\\n', Text), # line continuation
|
| 41 |
+
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
| 42 |
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
| 43 |
+
(r'[{}#@]', Punctuation),
|
| 44 |
+
(r'L?"', String, 'string'),
|
| 45 |
+
(r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
|
| 46 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
|
| 47 |
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
| 48 |
+
(r'([0-9]+)|(\'h)[0-9a-fA-F]+', Number.Hex),
|
| 49 |
+
(r'([0-9]+)|(\'b)[01]+', Number.Bin),
|
| 50 |
+
(r'([0-9]+)|(\'d)[0-9]+', Number.Integer),
|
| 51 |
+
(r'([0-9]+)|(\'o)[0-7]+', Number.Oct),
|
| 52 |
+
(r'\'[01xz]', Number),
|
| 53 |
+
(r'\d+[Ll]?', Number.Integer),
|
| 54 |
+
(r'\*/', Error),
|
| 55 |
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
| 56 |
+
(r'[()\[\],.;\']', Punctuation),
|
| 57 |
+
(r'`[a-zA-Z_]\w*', Name.Constant),
|
| 58 |
+
|
| 59 |
+
(r'^(\s*)(package)(\s+)', bygroups(Text, Keyword.Namespace, Text)),
|
| 60 |
+
(r'^(\s*)(import)(\s+)', bygroups(Text, Keyword.Namespace, Text),
|
| 61 |
+
'import'),
|
| 62 |
+
|
| 63 |
+
(words((
|
| 64 |
+
'always', 'always_comb', 'always_ff', 'always_latch', 'and',
|
| 65 |
+
'assign', 'automatic', 'begin', 'break', 'buf', 'bufif0', 'bufif1',
|
| 66 |
+
'case', 'casex', 'casez', 'cmos', 'const', 'continue', 'deassign',
|
| 67 |
+
'default', 'defparam', 'disable', 'do', 'edge', 'else', 'end', 'endcase',
|
| 68 |
+
'endfunction', 'endgenerate', 'endmodule', 'endpackage', 'endprimitive',
|
| 69 |
+
'endspecify', 'endtable', 'endtask', 'enum', 'event', 'final', 'for',
|
| 70 |
+
'force', 'forever', 'fork', 'function', 'generate', 'genvar', 'highz0',
|
| 71 |
+
'highz1', 'if', 'initial', 'inout', 'input', 'integer', 'join', 'large',
|
| 72 |
+
'localparam', 'macromodule', 'medium', 'module', 'nand', 'negedge',
|
| 73 |
+
'nmos', 'nor', 'not', 'notif0', 'notif1', 'or', 'output', 'packed',
|
| 74 |
+
'parameter', 'pmos', 'posedge', 'primitive', 'pull0', 'pull1',
|
| 75 |
+
'pulldown', 'pullup', 'rcmos', 'ref', 'release', 'repeat', 'return',
|
| 76 |
+
'rnmos', 'rpmos', 'rtran', 'rtranif0', 'rtranif1', 'scalared', 'signed',
|
| 77 |
+
'small', 'specify', 'specparam', 'strength', 'string', 'strong0',
|
| 78 |
+
'strong1', 'struct', 'table', 'task', 'tran', 'tranif0', 'tranif1',
|
| 79 |
+
'type', 'typedef', 'unsigned', 'var', 'vectored', 'void', 'wait',
|
| 80 |
+
'weak0', 'weak1', 'while', 'xnor', 'xor'), suffix=r'\b'),
|
| 81 |
+
Keyword),
|
| 82 |
+
|
| 83 |
+
(words((
|
| 84 |
+
'accelerate', 'autoexpand_vectornets', 'celldefine', 'default_nettype',
|
| 85 |
+
'else', 'elsif', 'endcelldefine', 'endif', 'endprotect', 'endprotected',
|
| 86 |
+
'expand_vectornets', 'ifdef', 'ifndef', 'include', 'noaccelerate',
|
| 87 |
+
'noexpand_vectornets', 'noremove_gatenames', 'noremove_netnames',
|
| 88 |
+
'nounconnected_drive', 'protect', 'protected', 'remove_gatenames',
|
| 89 |
+
'remove_netnames', 'resetall', 'timescale', 'unconnected_drive',
|
| 90 |
+
'undef'), prefix=r'`', suffix=r'\b'),
|
| 91 |
+
Comment.Preproc),
|
| 92 |
+
|
| 93 |
+
(words((
|
| 94 |
+
'bits', 'bitstoreal', 'bitstoshortreal', 'countdrivers', 'display', 'fclose',
|
| 95 |
+
'fdisplay', 'finish', 'floor', 'fmonitor', 'fopen', 'fstrobe', 'fwrite',
|
| 96 |
+
'getpattern', 'history', 'incsave', 'input', 'itor', 'key', 'list', 'log',
|
| 97 |
+
'monitor', 'monitoroff', 'monitoron', 'nokey', 'nolog', 'printtimescale',
|
| 98 |
+
'random', 'readmemb', 'readmemh', 'realtime', 'realtobits', 'reset',
|
| 99 |
+
'reset_count', 'reset_value', 'restart', 'rtoi', 'save', 'scale', 'scope',
|
| 100 |
+
'shortrealtobits', 'showscopes', 'showvariables', 'showvars', 'sreadmemb',
|
| 101 |
+
'sreadmemh', 'stime', 'stop', 'strobe', 'time', 'timeformat', 'write'),
|
| 102 |
+
prefix=r'\$', suffix=r'\b'),
|
| 103 |
+
Name.Builtin),
|
| 104 |
+
|
| 105 |
+
(words((
|
| 106 |
+
'byte', 'shortint', 'int', 'longint', 'integer', 'time',
|
| 107 |
+
'bit', 'logic', 'reg', 'supply0', 'supply1', 'tri', 'triand',
|
| 108 |
+
'trior', 'tri0', 'tri1', 'trireg', 'uwire', 'wire', 'wand', 'wo'
|
| 109 |
+
'shortreal', 'real', 'realtime'), suffix=r'\b'),
|
| 110 |
+
Keyword.Type),
|
| 111 |
+
(r'[a-zA-Z_]\w*:(?!:)', Name.Label),
|
| 112 |
+
(r'\$?[a-zA-Z_]\w*', Name),
|
| 113 |
+
],
|
| 114 |
+
'string': [
|
| 115 |
+
(r'"', String, '#pop'),
|
| 116 |
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
| 117 |
+
(r'[^\\"\n]+', String), # all other characters
|
| 118 |
+
(r'\\\n', String), # line continuation
|
| 119 |
+
(r'\\', String), # stray backslash
|
| 120 |
+
],
|
| 121 |
+
'macro': [
|
| 122 |
+
(r'[^/\n]+', Comment.Preproc),
|
| 123 |
+
(r'/[*](.|\n)*?[*]/', Comment.Multiline),
|
| 124 |
+
(r'//.*?\n', Comment.Single, '#pop'),
|
| 125 |
+
(r'/', Comment.Preproc),
|
| 126 |
+
(r'(?<=\\)\n', Comment.Preproc),
|
| 127 |
+
(r'\n', Comment.Preproc, '#pop'),
|
| 128 |
+
],
|
| 129 |
+
'import': [
|
| 130 |
+
(r'[\w:]+\*?', Name.Namespace, '#pop')
|
| 131 |
+
]
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
def get_tokens_unprocessed(self, text):
|
| 135 |
+
for index, token, value in \
|
| 136 |
+
RegexLexer.get_tokens_unprocessed(self, text):
|
| 137 |
+
# Convention: mark all upper case names as constants
|
| 138 |
+
if token is Name:
|
| 139 |
+
if value.isupper():
|
| 140 |
+
token = Name.Constant
|
| 141 |
+
yield index, token, value
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
class SystemVerilogLexer(RegexLexer):
|
| 145 |
+
"""
|
| 146 |
+
Extends verilog lexer to recognise all SystemVerilog keywords from IEEE
|
| 147 |
+
1800-2009 standard.
|
| 148 |
+
|
| 149 |
+
.. versionadded:: 1.5
|
| 150 |
+
"""
|
| 151 |
+
name = 'systemverilog'
|
| 152 |
+
aliases = ['systemverilog', 'sv']
|
| 153 |
+
filenames = ['*.sv', '*.svh']
|
| 154 |
+
mimetypes = ['text/x-systemverilog']
|
| 155 |
+
|
| 156 |
+
#: optional Comment or Whitespace
|
| 157 |
+
_ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
|
| 158 |
+
|
| 159 |
+
tokens = {
|
| 160 |
+
'root': [
|
| 161 |
+
(r'^\s*`define', Comment.Preproc, 'macro'),
|
| 162 |
+
(r'^(\s*)(package)(\s+)', bygroups(Text, Keyword.Namespace, Text)),
|
| 163 |
+
(r'^(\s*)(import)(\s+)', bygroups(Text, Keyword.Namespace, Text), 'import'),
|
| 164 |
+
|
| 165 |
+
(r'\n', Text),
|
| 166 |
+
(r'\s+', Text),
|
| 167 |
+
(r'\\\n', Text), # line continuation
|
| 168 |
+
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
| 169 |
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
| 170 |
+
(r'[{}#@]', Punctuation),
|
| 171 |
+
(r'L?"', String, 'string'),
|
| 172 |
+
(r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
|
| 173 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
|
| 174 |
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
| 175 |
+
(r'([0-9]+)|(\'h)[0-9a-fA-F]+', Number.Hex),
|
| 176 |
+
(r'([0-9]+)|(\'b)[01]+', Number.Bin),
|
| 177 |
+
(r'([0-9]+)|(\'d)[0-9]+', Number.Integer),
|
| 178 |
+
(r'([0-9]+)|(\'o)[0-7]+', Number.Oct),
|
| 179 |
+
(r'\'[01xz]', Number),
|
| 180 |
+
(r'\d+[Ll]?', Number.Integer),
|
| 181 |
+
(r'\*/', Error),
|
| 182 |
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
| 183 |
+
(r'[()\[\],.;\']', Punctuation),
|
| 184 |
+
(r'`[a-zA-Z_]\w*', Name.Constant),
|
| 185 |
+
|
| 186 |
+
(words((
|
| 187 |
+
'accept_on', 'alias', 'always', 'always_comb', 'always_ff', 'always_latch',
|
| 188 |
+
'and', 'assert', 'assign', 'assume', 'automatic', 'before', 'begin', 'bind', 'bins',
|
| 189 |
+
'binsof', 'bit', 'break', 'buf', 'bufif0', 'bufif1', 'byte', 'case', 'casex', 'casez',
|
| 190 |
+
'cell', 'chandle', 'checker', 'class', 'clocking', 'cmos', 'config', 'const', 'constraint',
|
| 191 |
+
'context', 'continue', 'cover', 'covergroup', 'coverpoint', 'cross', 'deassign',
|
| 192 |
+
'default', 'defparam', 'design', 'disable', 'dist', 'do', 'edge', 'else', 'end', 'endcase',
|
| 193 |
+
'endchecker', 'endclass', 'endclocking', 'endconfig', 'endfunction', 'endgenerate',
|
| 194 |
+
'endgroup', 'endinterface', 'endmodule', 'endpackage', 'endprimitive',
|
| 195 |
+
'endprogram', 'endproperty', 'endsequence', 'endspecify', 'endtable',
|
| 196 |
+
'endtask', 'enum', 'event', 'eventually', 'expect', 'export', 'extends', 'extern',
|
| 197 |
+
'final', 'first_match', 'for', 'force', 'foreach', 'forever', 'fork', 'forkjoin',
|
| 198 |
+
'function', 'generate', 'genvar', 'global', 'highz0', 'highz1', 'if', 'iff', 'ifnone',
|
| 199 |
+
'ignore_bins', 'illegal_bins', 'implies', 'import', 'incdir', 'include',
|
| 200 |
+
'initial', 'inout', 'input', 'inside', 'instance', 'int', 'integer', 'interface',
|
| 201 |
+
'intersect', 'join', 'join_any', 'join_none', 'large', 'let', 'liblist', 'library',
|
| 202 |
+
'local', 'localparam', 'logic', 'longint', 'macromodule', 'matches', 'medium',
|
| 203 |
+
'modport', 'module', 'nand', 'negedge', 'new', 'nexttime', 'nmos', 'nor', 'noshowcancelled',
|
| 204 |
+
'not', 'notif0', 'notif1', 'null', 'or', 'output', 'package', 'packed', 'parameter',
|
| 205 |
+
'pmos', 'posedge', 'primitive', 'priority', 'program', 'property', 'protected',
|
| 206 |
+
'pull0', 'pull1', 'pulldown', 'pullup', 'pulsestyle_ondetect', 'pulsestyle_onevent',
|
| 207 |
+
'pure', 'rand', 'randc', 'randcase', 'randsequence', 'rcmos', 'real', 'realtime',
|
| 208 |
+
'ref', 'reg', 'reject_on', 'release', 'repeat', 'restrict', 'return', 'rnmos',
|
| 209 |
+
'rpmos', 'rtran', 'rtranif0', 'rtranif1', 's_always', 's_eventually', 's_nexttime',
|
| 210 |
+
's_until', 's_until_with', 'scalared', 'sequence', 'shortint', 'shortreal',
|
| 211 |
+
'showcancelled', 'signed', 'small', 'solve', 'specify', 'specparam', 'static',
|
| 212 |
+
'string', 'strong', 'strong0', 'strong1', 'struct', 'super', 'supply0', 'supply1',
|
| 213 |
+
'sync_accept_on', 'sync_reject_on', 'table', 'tagged', 'task', 'this', 'throughout',
|
| 214 |
+
'time', 'timeprecision', 'timeunit', 'tran', 'tranif0', 'tranif1', 'tri', 'tri0',
|
| 215 |
+
'tri1', 'triand', 'trior', 'trireg', 'type', 'typedef', 'union', 'unique', 'unique0',
|
| 216 |
+
'unsigned', 'until', 'until_with', 'untyped', 'use', 'uwire', 'var', 'vectored',
|
| 217 |
+
'virtual', 'void', 'wait', 'wait_order', 'wand', 'weak', 'weak0', 'weak1', 'while',
|
| 218 |
+
'wildcard', 'wire', 'with', 'within', 'wor', 'xnor', 'xor'), suffix=r'\b'),
|
| 219 |
+
Keyword),
|
| 220 |
+
|
| 221 |
+
(words((
|
| 222 |
+
'`__FILE__', '`__LINE__', '`begin_keywords', '`celldefine', '`default_nettype',
|
| 223 |
+
'`define', '`else', '`elsif', '`end_keywords', '`endcelldefine', '`endif',
|
| 224 |
+
'`ifdef', '`ifndef', '`include', '`line', '`nounconnected_drive', '`pragma',
|
| 225 |
+
'`resetall', '`timescale', '`unconnected_drive', '`undef', '`undefineall'),
|
| 226 |
+
suffix=r'\b'),
|
| 227 |
+
Comment.Preproc),
|
| 228 |
+
|
| 229 |
+
(words((
|
| 230 |
+
'$display', '$displayb', '$displayh', '$displayo', '$dumpall', '$dumpfile',
|
| 231 |
+
'$dumpflush', '$dumplimit', '$dumpoff', '$dumpon', '$dumpports',
|
| 232 |
+
'$dumpportsall', '$dumpportsflush', '$dumpportslimit', '$dumpportsoff',
|
| 233 |
+
'$dumpportson', '$dumpvars', '$fclose', '$fdisplay', '$fdisplayb',
|
| 234 |
+
'$fdisplayh', '$fdisplayo', '$feof', '$ferror', '$fflush', '$fgetc',
|
| 235 |
+
'$fgets', '$finish', '$fmonitor', '$fmonitorb', '$fmonitorh', '$fmonitoro',
|
| 236 |
+
'$fopen', '$fread', '$fscanf', '$fseek', '$fstrobe', '$fstrobeb', '$fstrobeh',
|
| 237 |
+
'$fstrobeo', '$ftell', '$fwrite', '$fwriteb', '$fwriteh', '$fwriteo',
|
| 238 |
+
'$monitor', '$monitorb', '$monitorh', '$monitoro', '$monitoroff',
|
| 239 |
+
'$monitoron', '$plusargs', '$random', '$readmemb', '$readmemh', '$rewind',
|
| 240 |
+
'$sformat', '$sformatf', '$sscanf', '$strobe', '$strobeb', '$strobeh', '$strobeo',
|
| 241 |
+
'$swrite', '$swriteb', '$swriteh', '$swriteo', '$test', '$ungetc',
|
| 242 |
+
'$value$plusargs', '$write', '$writeb', '$writeh', '$writememb',
|
| 243 |
+
'$writememh', '$writeo'), suffix=r'\b'),
|
| 244 |
+
Name.Builtin),
|
| 245 |
+
|
| 246 |
+
(r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
|
| 247 |
+
(words((
|
| 248 |
+
'byte', 'shortint', 'int', 'longint', 'integer', 'time',
|
| 249 |
+
'bit', 'logic', 'reg', 'supply0', 'supply1', 'tri', 'triand',
|
| 250 |
+
'trior', 'tri0', 'tri1', 'trireg', 'uwire', 'wire', 'wand', 'wo'
|
| 251 |
+
'shortreal', 'real', 'realtime'), suffix=r'\b'),
|
| 252 |
+
Keyword.Type),
|
| 253 |
+
(r'[a-zA-Z_]\w*:(?!:)', Name.Label),
|
| 254 |
+
(r'\$?[a-zA-Z_]\w*', Name),
|
| 255 |
+
],
|
| 256 |
+
'classname': [
|
| 257 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop'),
|
| 258 |
+
],
|
| 259 |
+
'string': [
|
| 260 |
+
(r'"', String, '#pop'),
|
| 261 |
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
| 262 |
+
(r'[^\\"\n]+', String), # all other characters
|
| 263 |
+
(r'\\\n', String), # line continuation
|
| 264 |
+
(r'\\', String), # stray backslash
|
| 265 |
+
],
|
| 266 |
+
'macro': [
|
| 267 |
+
(r'[^/\n]+', Comment.Preproc),
|
| 268 |
+
(r'/[*](.|\n)*?[*]/', Comment.Multiline),
|
| 269 |
+
(r'//.*?\n', Comment.Single, '#pop'),
|
| 270 |
+
(r'/', Comment.Preproc),
|
| 271 |
+
(r'(?<=\\)\n', Comment.Preproc),
|
| 272 |
+
(r'\n', Comment.Preproc, '#pop'),
|
| 273 |
+
],
|
| 274 |
+
'import': [
|
| 275 |
+
(r'[\w:]+\*?', Name.Namespace, '#pop')
|
| 276 |
+
]
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
def get_tokens_unprocessed(self, text):
|
| 280 |
+
for index, token, value in \
|
| 281 |
+
RegexLexer.get_tokens_unprocessed(self, text):
|
| 282 |
+
# Convention: mark all upper case names as constants
|
| 283 |
+
if token is Name:
|
| 284 |
+
if value.isupper():
|
| 285 |
+
token = Name.Constant
|
| 286 |
+
yield index, token, value
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
class VhdlLexer(RegexLexer):
|
| 290 |
+
"""
|
| 291 |
+
For VHDL source code.
|
| 292 |
+
|
| 293 |
+
.. versionadded:: 1.5
|
| 294 |
+
"""
|
| 295 |
+
name = 'vhdl'
|
| 296 |
+
aliases = ['vhdl']
|
| 297 |
+
filenames = ['*.vhdl', '*.vhd']
|
| 298 |
+
mimetypes = ['text/x-vhdl']
|
| 299 |
+
flags = re.MULTILINE | re.IGNORECASE
|
| 300 |
+
|
| 301 |
+
tokens = {
|
| 302 |
+
'root': [
|
| 303 |
+
(r'\n', Text),
|
| 304 |
+
(r'\s+', Text),
|
| 305 |
+
(r'\\\n', Text), # line continuation
|
| 306 |
+
(r'--.*?$', Comment.Single),
|
| 307 |
+
(r"'(U|X|0|1|Z|W|L|H|-)'", String.Char),
|
| 308 |
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
| 309 |
+
(r"'[a-z_]\w*", Name.Attribute),
|
| 310 |
+
(r'[()\[\],.;\']', Punctuation),
|
| 311 |
+
(r'"[^\n\\"]*"', String),
|
| 312 |
+
|
| 313 |
+
(r'(library)(\s+)([a-z_]\w*)',
|
| 314 |
+
bygroups(Keyword, Text, Name.Namespace)),
|
| 315 |
+
(r'(use)(\s+)(entity)', bygroups(Keyword, Text, Keyword)),
|
| 316 |
+
(r'(use)(\s+)([a-z_][\w.]*\.)(all)',
|
| 317 |
+
bygroups(Keyword, Text, Name.Namespace, Keyword)),
|
| 318 |
+
(r'(use)(\s+)([a-z_][\w.]*)',
|
| 319 |
+
bygroups(Keyword, Text, Name.Namespace)),
|
| 320 |
+
(r'(std|ieee)(\.[a-z_]\w*)',
|
| 321 |
+
bygroups(Name.Namespace, Name.Namespace)),
|
| 322 |
+
(words(('std', 'ieee', 'work'), suffix=r'\b'),
|
| 323 |
+
Name.Namespace),
|
| 324 |
+
(r'(entity|component)(\s+)([a-z_]\w*)',
|
| 325 |
+
bygroups(Keyword, Text, Name.Class)),
|
| 326 |
+
(r'(architecture|configuration)(\s+)([a-z_]\w*)(\s+)'
|
| 327 |
+
r'(of)(\s+)([a-z_]\w*)(\s+)(is)',
|
| 328 |
+
bygroups(Keyword, Text, Name.Class, Text, Keyword, Text,
|
| 329 |
+
Name.Class, Text, Keyword)),
|
| 330 |
+
(r'([a-z_]\w*)(:)(\s+)(process|for)',
|
| 331 |
+
bygroups(Name.Class, Operator, Text, Keyword)),
|
| 332 |
+
(r'(end)(\s+)', bygroups(using(this), Text), 'endblock'),
|
| 333 |
+
|
| 334 |
+
include('types'),
|
| 335 |
+
include('keywords'),
|
| 336 |
+
include('numbers'),
|
| 337 |
+
|
| 338 |
+
(r'[a-z_]\w*', Name),
|
| 339 |
+
],
|
| 340 |
+
'endblock': [
|
| 341 |
+
include('keywords'),
|
| 342 |
+
(r'[a-z_]\w*', Name.Class),
|
| 343 |
+
(r'(\s+)', Text),
|
| 344 |
+
(r';', Punctuation, '#pop'),
|
| 345 |
+
],
|
| 346 |
+
'types': [
|
| 347 |
+
(words((
|
| 348 |
+
'boolean', 'bit', 'character', 'severity_level', 'integer', 'time',
|
| 349 |
+
'delay_length', 'natural', 'positive', 'string', 'bit_vector',
|
| 350 |
+
'file_open_kind', 'file_open_status', 'std_ulogic', 'std_ulogic_vector',
|
| 351 |
+
'std_logic', 'std_logic_vector', 'signed', 'unsigned'), suffix=r'\b'),
|
| 352 |
+
Keyword.Type),
|
| 353 |
+
],
|
| 354 |
+
'keywords': [
|
| 355 |
+
(words((
|
| 356 |
+
'abs', 'access', 'after', 'alias', 'all', 'and',
|
| 357 |
+
'architecture', 'array', 'assert', 'attribute', 'begin', 'block',
|
| 358 |
+
'body', 'buffer', 'bus', 'case', 'component', 'configuration',
|
| 359 |
+
'constant', 'disconnect', 'downto', 'else', 'elsif', 'end',
|
| 360 |
+
'entity', 'exit', 'file', 'for', 'function', 'generate',
|
| 361 |
+
'generic', 'group', 'guarded', 'if', 'impure', 'in',
|
| 362 |
+
'inertial', 'inout', 'is', 'label', 'library', 'linkage',
|
| 363 |
+
'literal', 'loop', 'map', 'mod', 'nand', 'new',
|
| 364 |
+
'next', 'nor', 'not', 'null', 'of', 'on',
|
| 365 |
+
'open', 'or', 'others', 'out', 'package', 'port',
|
| 366 |
+
'postponed', 'procedure', 'process', 'pure', 'range', 'record',
|
| 367 |
+
'register', 'reject', 'rem', 'return', 'rol', 'ror', 'select',
|
| 368 |
+
'severity', 'signal', 'shared', 'sla', 'sll', 'sra',
|
| 369 |
+
'srl', 'subtype', 'then', 'to', 'transport', 'type',
|
| 370 |
+
'units', 'until', 'use', 'variable', 'wait', 'when',
|
| 371 |
+
'while', 'with', 'xnor', 'xor'), suffix=r'\b'),
|
| 372 |
+
Keyword),
|
| 373 |
+
],
|
| 374 |
+
'numbers': [
|
| 375 |
+
(r'\d{1,2}#[0-9a-f_]+#?', Number.Integer),
|
| 376 |
+
(r'\d+', Number.Integer),
|
| 377 |
+
(r'(\d+\.\d*|\.\d+|\d+)E[+-]?\d+', Number.Float),
|
| 378 |
+
(r'X"[0-9a-f_]+"', Number.Hex),
|
| 379 |
+
(r'O"[0-7_]+"', Number.Oct),
|
| 380 |
+
(r'B"[01_]+"', Number.Bin),
|
| 381 |
+
],
|
| 382 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/hexdump.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.hexdump
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for hexadecimal dumps.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from pygments.lexer import RegexLexer, bygroups, include
|
| 13 |
+
from pygments.token import Text, Name, Number, String, Punctuation
|
| 14 |
+
|
| 15 |
+
__all__ = ['HexdumpLexer']
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class HexdumpLexer(RegexLexer):
|
| 19 |
+
"""
|
| 20 |
+
For typical hex dump output formats by the UNIX and GNU/Linux tools ``hexdump``,
|
| 21 |
+
``hd``, ``hexcat``, ``od`` and ``xxd``, and the DOS tool ``DEBUG``. For example:
|
| 22 |
+
|
| 23 |
+
.. sourcecode:: hexdump
|
| 24 |
+
|
| 25 |
+
00000000 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 |.ELF............|
|
| 26 |
+
00000010 02 00 3e 00 01 00 00 00 c5 48 40 00 00 00 00 00 |..>......H@.....|
|
| 27 |
+
|
| 28 |
+
The specific supported formats are the outputs of:
|
| 29 |
+
|
| 30 |
+
* ``hexdump FILE``
|
| 31 |
+
* ``hexdump -C FILE`` -- the `canonical` format used in the example.
|
| 32 |
+
* ``hd FILE`` -- same as ``hexdump -C FILE``.
|
| 33 |
+
* ``hexcat FILE``
|
| 34 |
+
* ``od -t x1z FILE``
|
| 35 |
+
* ``xxd FILE``
|
| 36 |
+
* ``DEBUG.EXE FILE.COM`` and entering ``d`` to the prompt.
|
| 37 |
+
|
| 38 |
+
.. versionadded:: 2.1
|
| 39 |
+
"""
|
| 40 |
+
name = 'Hexdump'
|
| 41 |
+
aliases = ['hexdump']
|
| 42 |
+
|
| 43 |
+
hd = r'[0-9A-Ha-h]'
|
| 44 |
+
|
| 45 |
+
tokens = {
|
| 46 |
+
'root': [
|
| 47 |
+
(r'\n', Text),
|
| 48 |
+
include('offset'),
|
| 49 |
+
(r'('+hd+r'{2})(\-)('+hd+r'{2})',
|
| 50 |
+
bygroups(Number.Hex, Punctuation, Number.Hex)),
|
| 51 |
+
(hd+r'{2}', Number.Hex),
|
| 52 |
+
(r'(\s{2,3})(\>)(.{16})(\<)$',
|
| 53 |
+
bygroups(Text, Punctuation, String, Punctuation), 'bracket-strings'),
|
| 54 |
+
(r'(\s{2,3})(\|)(.{16})(\|)$',
|
| 55 |
+
bygroups(Text, Punctuation, String, Punctuation), 'piped-strings'),
|
| 56 |
+
(r'(\s{2,3})(\>)(.{1,15})(\<)$',
|
| 57 |
+
bygroups(Text, Punctuation, String, Punctuation)),
|
| 58 |
+
(r'(\s{2,3})(\|)(.{1,15})(\|)$',
|
| 59 |
+
bygroups(Text, Punctuation, String, Punctuation)),
|
| 60 |
+
(r'(\s{2,3})(.{1,15})$', bygroups(Text, String)),
|
| 61 |
+
(r'(\s{2,3})(.{16}|.{20})$', bygroups(Text, String), 'nonpiped-strings'),
|
| 62 |
+
(r'\s', Text),
|
| 63 |
+
(r'^\*', Punctuation),
|
| 64 |
+
],
|
| 65 |
+
'offset': [
|
| 66 |
+
(r'^('+hd+'+)(:)', bygroups(Name.Label, Punctuation), 'offset-mode'),
|
| 67 |
+
(r'^'+hd+'+', Name.Label),
|
| 68 |
+
],
|
| 69 |
+
'offset-mode': [
|
| 70 |
+
(r'\s', Text, '#pop'),
|
| 71 |
+
(hd+'+', Name.Label),
|
| 72 |
+
(r':', Punctuation)
|
| 73 |
+
],
|
| 74 |
+
'piped-strings': [
|
| 75 |
+
(r'\n', Text),
|
| 76 |
+
include('offset'),
|
| 77 |
+
(hd+r'{2}', Number.Hex),
|
| 78 |
+
(r'(\s{2,3})(\|)(.{1,16})(\|)$',
|
| 79 |
+
bygroups(Text, Punctuation, String, Punctuation)),
|
| 80 |
+
(r'\s', Text),
|
| 81 |
+
(r'^\*', Punctuation),
|
| 82 |
+
],
|
| 83 |
+
'bracket-strings': [
|
| 84 |
+
(r'\n', Text),
|
| 85 |
+
include('offset'),
|
| 86 |
+
(hd+r'{2}', Number.Hex),
|
| 87 |
+
(r'(\s{2,3})(\>)(.{1,16})(\<)$',
|
| 88 |
+
bygroups(Text, Punctuation, String, Punctuation)),
|
| 89 |
+
(r'\s', Text),
|
| 90 |
+
(r'^\*', Punctuation),
|
| 91 |
+
],
|
| 92 |
+
'nonpiped-strings': [
|
| 93 |
+
(r'\n', Text),
|
| 94 |
+
include('offset'),
|
| 95 |
+
(r'('+hd+r'{2})(\-)('+hd+r'{2})',
|
| 96 |
+
bygroups(Number.Hex, Punctuation, Number.Hex)),
|
| 97 |
+
(hd+r'{2}', Number.Hex),
|
| 98 |
+
(r'(\s{19,})(.{1,20}?)$', bygroups(Text, String)),
|
| 99 |
+
(r'(\s{2,3})(.{1,20})$', bygroups(Text, String)),
|
| 100 |
+
(r'\s', Text),
|
| 101 |
+
(r'^\*', Punctuation),
|
| 102 |
+
],
|
| 103 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/html.py
ADDED
|
@@ -0,0 +1,602 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.html
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for HTML, XML and related markup.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, bygroups, \
|
| 15 |
+
default, using
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Punctuation
|
| 18 |
+
from pygments.util import looks_like_xml, html_doctype_matches
|
| 19 |
+
|
| 20 |
+
from pygments.lexers.javascript import JavascriptLexer
|
| 21 |
+
from pygments.lexers.jvm import ScalaLexer
|
| 22 |
+
from pygments.lexers.css import CssLexer, _indentation, _starts_block
|
| 23 |
+
from pygments.lexers.ruby import RubyLexer
|
| 24 |
+
|
| 25 |
+
__all__ = ['HtmlLexer', 'DtdLexer', 'XmlLexer', 'XsltLexer', 'HamlLexer',
|
| 26 |
+
'ScamlLexer', 'PugLexer']
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class HtmlLexer(RegexLexer):
|
| 30 |
+
"""
|
| 31 |
+
For HTML 4 and XHTML 1 markup. Nested JavaScript and CSS is highlighted
|
| 32 |
+
by the appropriate lexer.
|
| 33 |
+
"""
|
| 34 |
+
|
| 35 |
+
name = 'HTML'
|
| 36 |
+
aliases = ['html']
|
| 37 |
+
filenames = ['*.html', '*.htm', '*.xhtml', '*.xslt']
|
| 38 |
+
mimetypes = ['text/html', 'application/xhtml+xml']
|
| 39 |
+
|
| 40 |
+
flags = re.IGNORECASE | re.DOTALL
|
| 41 |
+
tokens = {
|
| 42 |
+
'root': [
|
| 43 |
+
('[^<&]+', Text),
|
| 44 |
+
(r'&\S*?;', Name.Entity),
|
| 45 |
+
(r'\<\!\[CDATA\[.*?\]\]\>', Comment.Preproc),
|
| 46 |
+
('<!--', Comment, 'comment'),
|
| 47 |
+
(r'<\?.*?\?>', Comment.Preproc),
|
| 48 |
+
('<![^>]*>', Comment.Preproc),
|
| 49 |
+
(r'(<)(\s*)(script)(\s*)',
|
| 50 |
+
bygroups(Punctuation, Text, Name.Tag, Text),
|
| 51 |
+
('script-content', 'tag')),
|
| 52 |
+
(r'(<)(\s*)(style)(\s*)',
|
| 53 |
+
bygroups(Punctuation, Text, Name.Tag, Text),
|
| 54 |
+
('style-content', 'tag')),
|
| 55 |
+
# note: this allows tag names not used in HTML like <x:with-dash>,
|
| 56 |
+
# this is to support yet-unknown template engines and the like
|
| 57 |
+
(r'(<)(\s*)([\w:.-]+)',
|
| 58 |
+
bygroups(Punctuation, Text, Name.Tag), 'tag'),
|
| 59 |
+
(r'(<)(\s*)(/)(\s*)([\w:.-]+)(\s*)(>)',
|
| 60 |
+
bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text,
|
| 61 |
+
Punctuation)),
|
| 62 |
+
],
|
| 63 |
+
'comment': [
|
| 64 |
+
('[^-]+', Comment),
|
| 65 |
+
('-->', Comment, '#pop'),
|
| 66 |
+
('-', Comment),
|
| 67 |
+
],
|
| 68 |
+
'tag': [
|
| 69 |
+
(r'\s+', Text),
|
| 70 |
+
(r'([\w:-]+\s*)(=)(\s*)', bygroups(Name.Attribute, Operator, Text),
|
| 71 |
+
'attr'),
|
| 72 |
+
(r'[\w:-]+', Name.Attribute),
|
| 73 |
+
(r'(/?)(\s*)(>)', bygroups(Punctuation, Text, Punctuation), '#pop'),
|
| 74 |
+
],
|
| 75 |
+
'script-content': [
|
| 76 |
+
(r'(<)(\s*)(/)(\s*)(script)(\s*)(>)',
|
| 77 |
+
bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text,
|
| 78 |
+
Punctuation), '#pop'),
|
| 79 |
+
(r'.+?(?=<\s*/\s*script\s*>)', using(JavascriptLexer)),
|
| 80 |
+
],
|
| 81 |
+
'style-content': [
|
| 82 |
+
(r'(<)(\s*)(/)(\s*)(style)(\s*)(>)',
|
| 83 |
+
bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text,
|
| 84 |
+
Punctuation),'#pop'),
|
| 85 |
+
(r'.+?(?=<\s*/\s*style\s*>)', using(CssLexer)),
|
| 86 |
+
],
|
| 87 |
+
'attr': [
|
| 88 |
+
('".*?"', String, '#pop'),
|
| 89 |
+
("'.*?'", String, '#pop'),
|
| 90 |
+
(r'[^\s>]+', String, '#pop'),
|
| 91 |
+
],
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
def analyse_text(text):
|
| 95 |
+
if html_doctype_matches(text):
|
| 96 |
+
return 0.5
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
class DtdLexer(RegexLexer):
|
| 100 |
+
"""
|
| 101 |
+
A lexer for DTDs (Document Type Definitions).
|
| 102 |
+
|
| 103 |
+
.. versionadded:: 1.5
|
| 104 |
+
"""
|
| 105 |
+
|
| 106 |
+
flags = re.MULTILINE | re.DOTALL
|
| 107 |
+
|
| 108 |
+
name = 'DTD'
|
| 109 |
+
aliases = ['dtd']
|
| 110 |
+
filenames = ['*.dtd']
|
| 111 |
+
mimetypes = ['application/xml-dtd']
|
| 112 |
+
|
| 113 |
+
tokens = {
|
| 114 |
+
'root': [
|
| 115 |
+
include('common'),
|
| 116 |
+
|
| 117 |
+
(r'(<!ELEMENT)(\s+)(\S+)',
|
| 118 |
+
bygroups(Keyword, Text, Name.Tag), 'element'),
|
| 119 |
+
(r'(<!ATTLIST)(\s+)(\S+)',
|
| 120 |
+
bygroups(Keyword, Text, Name.Tag), 'attlist'),
|
| 121 |
+
(r'(<!ENTITY)(\s+)(\S+)',
|
| 122 |
+
bygroups(Keyword, Text, Name.Entity), 'entity'),
|
| 123 |
+
(r'(<!NOTATION)(\s+)(\S+)',
|
| 124 |
+
bygroups(Keyword, Text, Name.Tag), 'notation'),
|
| 125 |
+
(r'(<!\[)([^\[\s]+)(\s*)(\[)', # conditional sections
|
| 126 |
+
bygroups(Keyword, Name.Entity, Text, Keyword)),
|
| 127 |
+
|
| 128 |
+
(r'(<!DOCTYPE)(\s+)([^>\s]+)',
|
| 129 |
+
bygroups(Keyword, Text, Name.Tag)),
|
| 130 |
+
(r'PUBLIC|SYSTEM', Keyword.Constant),
|
| 131 |
+
(r'[\[\]>]', Keyword),
|
| 132 |
+
],
|
| 133 |
+
|
| 134 |
+
'common': [
|
| 135 |
+
(r'\s+', Text),
|
| 136 |
+
(r'(%|&)[^;]*;', Name.Entity),
|
| 137 |
+
('<!--', Comment, 'comment'),
|
| 138 |
+
(r'[(|)*,?+]', Operator),
|
| 139 |
+
(r'"[^"]*"', String.Double),
|
| 140 |
+
(r'\'[^\']*\'', String.Single),
|
| 141 |
+
],
|
| 142 |
+
|
| 143 |
+
'comment': [
|
| 144 |
+
('[^-]+', Comment),
|
| 145 |
+
('-->', Comment, '#pop'),
|
| 146 |
+
('-', Comment),
|
| 147 |
+
],
|
| 148 |
+
|
| 149 |
+
'element': [
|
| 150 |
+
include('common'),
|
| 151 |
+
(r'EMPTY|ANY|#PCDATA', Keyword.Constant),
|
| 152 |
+
(r'[^>\s|()?+*,]+', Name.Tag),
|
| 153 |
+
(r'>', Keyword, '#pop'),
|
| 154 |
+
],
|
| 155 |
+
|
| 156 |
+
'attlist': [
|
| 157 |
+
include('common'),
|
| 158 |
+
(r'CDATA|IDREFS|IDREF|ID|NMTOKENS|NMTOKEN|ENTITIES|ENTITY|NOTATION',
|
| 159 |
+
Keyword.Constant),
|
| 160 |
+
(r'#REQUIRED|#IMPLIED|#FIXED', Keyword.Constant),
|
| 161 |
+
(r'xml:space|xml:lang', Keyword.Reserved),
|
| 162 |
+
(r'[^>\s|()?+*,]+', Name.Attribute),
|
| 163 |
+
(r'>', Keyword, '#pop'),
|
| 164 |
+
],
|
| 165 |
+
|
| 166 |
+
'entity': [
|
| 167 |
+
include('common'),
|
| 168 |
+
(r'SYSTEM|PUBLIC|NDATA', Keyword.Constant),
|
| 169 |
+
(r'[^>\s|()?+*,]+', Name.Entity),
|
| 170 |
+
(r'>', Keyword, '#pop'),
|
| 171 |
+
],
|
| 172 |
+
|
| 173 |
+
'notation': [
|
| 174 |
+
include('common'),
|
| 175 |
+
(r'SYSTEM|PUBLIC', Keyword.Constant),
|
| 176 |
+
(r'[^>\s|()?+*,]+', Name.Attribute),
|
| 177 |
+
(r'>', Keyword, '#pop'),
|
| 178 |
+
],
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
def analyse_text(text):
|
| 182 |
+
if not looks_like_xml(text) and \
|
| 183 |
+
('<!ELEMENT' in text or '<!ATTLIST' in text or '<!ENTITY' in text):
|
| 184 |
+
return 0.8
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
class XmlLexer(RegexLexer):
|
| 188 |
+
"""
|
| 189 |
+
Generic lexer for XML (eXtensible Markup Language).
|
| 190 |
+
"""
|
| 191 |
+
|
| 192 |
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
| 193 |
+
|
| 194 |
+
name = 'XML'
|
| 195 |
+
aliases = ['xml']
|
| 196 |
+
filenames = ['*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd',
|
| 197 |
+
'*.wsdl', '*.wsf']
|
| 198 |
+
mimetypes = ['text/xml', 'application/xml', 'image/svg+xml',
|
| 199 |
+
'application/rss+xml', 'application/atom+xml']
|
| 200 |
+
|
| 201 |
+
tokens = {
|
| 202 |
+
'root': [
|
| 203 |
+
('[^<&]+', Text),
|
| 204 |
+
(r'&\S*?;', Name.Entity),
|
| 205 |
+
(r'\<\!\[CDATA\[.*?\]\]\>', Comment.Preproc),
|
| 206 |
+
('<!--', Comment, 'comment'),
|
| 207 |
+
(r'<\?.*?\?>', Comment.Preproc),
|
| 208 |
+
('<![^>]*>', Comment.Preproc),
|
| 209 |
+
(r'<\s*[\w:.-]+', Name.Tag, 'tag'),
|
| 210 |
+
(r'<\s*/\s*[\w:.-]+\s*>', Name.Tag),
|
| 211 |
+
],
|
| 212 |
+
'comment': [
|
| 213 |
+
('[^-]+', Comment),
|
| 214 |
+
('-->', Comment, '#pop'),
|
| 215 |
+
('-', Comment),
|
| 216 |
+
],
|
| 217 |
+
'tag': [
|
| 218 |
+
(r'\s+', Text),
|
| 219 |
+
(r'[\w.:-]+\s*=', Name.Attribute, 'attr'),
|
| 220 |
+
(r'/?\s*>', Name.Tag, '#pop'),
|
| 221 |
+
],
|
| 222 |
+
'attr': [
|
| 223 |
+
('\s+', Text),
|
| 224 |
+
('".*?"', String, '#pop'),
|
| 225 |
+
("'.*?'", String, '#pop'),
|
| 226 |
+
(r'[^\s>]+', String, '#pop'),
|
| 227 |
+
],
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
def analyse_text(text):
|
| 231 |
+
if looks_like_xml(text):
|
| 232 |
+
return 0.45 # less than HTML
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
class XsltLexer(XmlLexer):
|
| 236 |
+
"""
|
| 237 |
+
A lexer for XSLT.
|
| 238 |
+
|
| 239 |
+
.. versionadded:: 0.10
|
| 240 |
+
"""
|
| 241 |
+
|
| 242 |
+
name = 'XSLT'
|
| 243 |
+
aliases = ['xslt']
|
| 244 |
+
filenames = ['*.xsl', '*.xslt', '*.xpl'] # xpl is XProc
|
| 245 |
+
mimetypes = ['application/xsl+xml', 'application/xslt+xml']
|
| 246 |
+
|
| 247 |
+
EXTRA_KEYWORDS = set((
|
| 248 |
+
'apply-imports', 'apply-templates', 'attribute',
|
| 249 |
+
'attribute-set', 'call-template', 'choose', 'comment',
|
| 250 |
+
'copy', 'copy-of', 'decimal-format', 'element', 'fallback',
|
| 251 |
+
'for-each', 'if', 'import', 'include', 'key', 'message',
|
| 252 |
+
'namespace-alias', 'number', 'otherwise', 'output', 'param',
|
| 253 |
+
'preserve-space', 'processing-instruction', 'sort',
|
| 254 |
+
'strip-space', 'stylesheet', 'template', 'text', 'transform',
|
| 255 |
+
'value-of', 'variable', 'when', 'with-param'
|
| 256 |
+
))
|
| 257 |
+
|
| 258 |
+
def get_tokens_unprocessed(self, text):
|
| 259 |
+
for index, token, value in XmlLexer.get_tokens_unprocessed(self, text):
|
| 260 |
+
m = re.match('</?xsl:([^>]*)/?>?', value)
|
| 261 |
+
|
| 262 |
+
if token is Name.Tag and m and m.group(1) in self.EXTRA_KEYWORDS:
|
| 263 |
+
yield index, Keyword, value
|
| 264 |
+
else:
|
| 265 |
+
yield index, token, value
|
| 266 |
+
|
| 267 |
+
def analyse_text(text):
|
| 268 |
+
if looks_like_xml(text) and '<xsl' in text:
|
| 269 |
+
return 0.8
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
class HamlLexer(ExtendedRegexLexer):
|
| 273 |
+
"""
|
| 274 |
+
For Haml markup.
|
| 275 |
+
|
| 276 |
+
.. versionadded:: 1.3
|
| 277 |
+
"""
|
| 278 |
+
|
| 279 |
+
name = 'Haml'
|
| 280 |
+
aliases = ['haml']
|
| 281 |
+
filenames = ['*.haml']
|
| 282 |
+
mimetypes = ['text/x-haml']
|
| 283 |
+
|
| 284 |
+
flags = re.IGNORECASE
|
| 285 |
+
# Haml can include " |\n" anywhere,
|
| 286 |
+
# which is ignored and used to wrap long lines.
|
| 287 |
+
# To accomodate this, use this custom faux dot instead.
|
| 288 |
+
_dot = r'(?: \|\n(?=.* \|)|.)'
|
| 289 |
+
|
| 290 |
+
# In certain places, a comma at the end of the line
|
| 291 |
+
# allows line wrapping as well.
|
| 292 |
+
_comma_dot = r'(?:,\s*\n|' + _dot + ')'
|
| 293 |
+
tokens = {
|
| 294 |
+
'root': [
|
| 295 |
+
(r'[ \t]*\n', Text),
|
| 296 |
+
(r'[ \t]*', _indentation),
|
| 297 |
+
],
|
| 298 |
+
|
| 299 |
+
'css': [
|
| 300 |
+
(r'\.[\w:-]+', Name.Class, 'tag'),
|
| 301 |
+
(r'\#[\w:-]+', Name.Function, 'tag'),
|
| 302 |
+
],
|
| 303 |
+
|
| 304 |
+
'eval-or-plain': [
|
| 305 |
+
(r'[&!]?==', Punctuation, 'plain'),
|
| 306 |
+
(r'([&!]?[=~])(' + _comma_dot + r'*\n)',
|
| 307 |
+
bygroups(Punctuation, using(RubyLexer)),
|
| 308 |
+
'root'),
|
| 309 |
+
default('plain'),
|
| 310 |
+
],
|
| 311 |
+
|
| 312 |
+
'content': [
|
| 313 |
+
include('css'),
|
| 314 |
+
(r'%[\w:-]+', Name.Tag, 'tag'),
|
| 315 |
+
(r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'),
|
| 316 |
+
(r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)',
|
| 317 |
+
bygroups(Comment, Comment.Special, Comment),
|
| 318 |
+
'#pop'),
|
| 319 |
+
(r'/' + _dot + r'*\n', _starts_block(Comment, 'html-comment-block'),
|
| 320 |
+
'#pop'),
|
| 321 |
+
(r'-#' + _dot + r'*\n', _starts_block(Comment.Preproc,
|
| 322 |
+
'haml-comment-block'), '#pop'),
|
| 323 |
+
(r'(-)(' + _comma_dot + r'*\n)',
|
| 324 |
+
bygroups(Punctuation, using(RubyLexer)),
|
| 325 |
+
'#pop'),
|
| 326 |
+
(r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'),
|
| 327 |
+
'#pop'),
|
| 328 |
+
include('eval-or-plain'),
|
| 329 |
+
],
|
| 330 |
+
|
| 331 |
+
'tag': [
|
| 332 |
+
include('css'),
|
| 333 |
+
(r'\{(,\n|' + _dot + ')*?\}', using(RubyLexer)),
|
| 334 |
+
(r'\[' + _dot + '*?\]', using(RubyLexer)),
|
| 335 |
+
(r'\(', Text, 'html-attributes'),
|
| 336 |
+
(r'/[ \t]*\n', Punctuation, '#pop:2'),
|
| 337 |
+
(r'[<>]{1,2}(?=[ \t=])', Punctuation),
|
| 338 |
+
include('eval-or-plain'),
|
| 339 |
+
],
|
| 340 |
+
|
| 341 |
+
'plain': [
|
| 342 |
+
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text),
|
| 343 |
+
(r'(#\{)(' + _dot + '*?)(\})',
|
| 344 |
+
bygroups(String.Interpol, using(RubyLexer), String.Interpol)),
|
| 345 |
+
(r'\n', Text, 'root'),
|
| 346 |
+
],
|
| 347 |
+
|
| 348 |
+
'html-attributes': [
|
| 349 |
+
(r'\s+', Text),
|
| 350 |
+
(r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'),
|
| 351 |
+
(r'[\w:-]+', Name.Attribute),
|
| 352 |
+
(r'\)', Text, '#pop'),
|
| 353 |
+
],
|
| 354 |
+
|
| 355 |
+
'html-attribute-value': [
|
| 356 |
+
(r'[ \t]+', Text),
|
| 357 |
+
(r'\w+', Name.Variable, '#pop'),
|
| 358 |
+
(r'@\w+', Name.Variable.Instance, '#pop'),
|
| 359 |
+
(r'\$\w+', Name.Variable.Global, '#pop'),
|
| 360 |
+
(r"'(\\\\|\\'|[^'\n])*'", String, '#pop'),
|
| 361 |
+
(r'"(\\\\|\\"|[^"\n])*"', String, '#pop'),
|
| 362 |
+
],
|
| 363 |
+
|
| 364 |
+
'html-comment-block': [
|
| 365 |
+
(_dot + '+', Comment),
|
| 366 |
+
(r'\n', Text, 'root'),
|
| 367 |
+
],
|
| 368 |
+
|
| 369 |
+
'haml-comment-block': [
|
| 370 |
+
(_dot + '+', Comment.Preproc),
|
| 371 |
+
(r'\n', Text, 'root'),
|
| 372 |
+
],
|
| 373 |
+
|
| 374 |
+
'filter-block': [
|
| 375 |
+
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Name.Decorator),
|
| 376 |
+
(r'(#\{)(' + _dot + '*?)(\})',
|
| 377 |
+
bygroups(String.Interpol, using(RubyLexer), String.Interpol)),
|
| 378 |
+
(r'\n', Text, 'root'),
|
| 379 |
+
],
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
|
| 383 |
+
class ScamlLexer(ExtendedRegexLexer):
|
| 384 |
+
"""
|
| 385 |
+
For `Scaml markup <http://scalate.fusesource.org/>`_. Scaml is Haml for Scala.
|
| 386 |
+
|
| 387 |
+
.. versionadded:: 1.4
|
| 388 |
+
"""
|
| 389 |
+
|
| 390 |
+
name = 'Scaml'
|
| 391 |
+
aliases = ['scaml']
|
| 392 |
+
filenames = ['*.scaml']
|
| 393 |
+
mimetypes = ['text/x-scaml']
|
| 394 |
+
|
| 395 |
+
flags = re.IGNORECASE
|
| 396 |
+
# Scaml does not yet support the " |\n" notation to
|
| 397 |
+
# wrap long lines. Once it does, use the custom faux
|
| 398 |
+
# dot instead.
|
| 399 |
+
# _dot = r'(?: \|\n(?=.* \|)|.)'
|
| 400 |
+
_dot = r'.'
|
| 401 |
+
|
| 402 |
+
tokens = {
|
| 403 |
+
'root': [
|
| 404 |
+
(r'[ \t]*\n', Text),
|
| 405 |
+
(r'[ \t]*', _indentation),
|
| 406 |
+
],
|
| 407 |
+
|
| 408 |
+
'css': [
|
| 409 |
+
(r'\.[\w:-]+', Name.Class, 'tag'),
|
| 410 |
+
(r'\#[\w:-]+', Name.Function, 'tag'),
|
| 411 |
+
],
|
| 412 |
+
|
| 413 |
+
'eval-or-plain': [
|
| 414 |
+
(r'[&!]?==', Punctuation, 'plain'),
|
| 415 |
+
(r'([&!]?[=~])(' + _dot + r'*\n)',
|
| 416 |
+
bygroups(Punctuation, using(ScalaLexer)),
|
| 417 |
+
'root'),
|
| 418 |
+
default('plain'),
|
| 419 |
+
],
|
| 420 |
+
|
| 421 |
+
'content': [
|
| 422 |
+
include('css'),
|
| 423 |
+
(r'%[\w:-]+', Name.Tag, 'tag'),
|
| 424 |
+
(r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'),
|
| 425 |
+
(r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)',
|
| 426 |
+
bygroups(Comment, Comment.Special, Comment),
|
| 427 |
+
'#pop'),
|
| 428 |
+
(r'/' + _dot + r'*\n', _starts_block(Comment, 'html-comment-block'),
|
| 429 |
+
'#pop'),
|
| 430 |
+
(r'-#' + _dot + r'*\n', _starts_block(Comment.Preproc,
|
| 431 |
+
'scaml-comment-block'), '#pop'),
|
| 432 |
+
(r'(-@\s*)(import)?(' + _dot + r'*\n)',
|
| 433 |
+
bygroups(Punctuation, Keyword, using(ScalaLexer)),
|
| 434 |
+
'#pop'),
|
| 435 |
+
(r'(-)(' + _dot + r'*\n)',
|
| 436 |
+
bygroups(Punctuation, using(ScalaLexer)),
|
| 437 |
+
'#pop'),
|
| 438 |
+
(r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'),
|
| 439 |
+
'#pop'),
|
| 440 |
+
include('eval-or-plain'),
|
| 441 |
+
],
|
| 442 |
+
|
| 443 |
+
'tag': [
|
| 444 |
+
include('css'),
|
| 445 |
+
(r'\{(,\n|' + _dot + ')*?\}', using(ScalaLexer)),
|
| 446 |
+
(r'\[' + _dot + '*?\]', using(ScalaLexer)),
|
| 447 |
+
(r'\(', Text, 'html-attributes'),
|
| 448 |
+
(r'/[ \t]*\n', Punctuation, '#pop:2'),
|
| 449 |
+
(r'[<>]{1,2}(?=[ \t=])', Punctuation),
|
| 450 |
+
include('eval-or-plain'),
|
| 451 |
+
],
|
| 452 |
+
|
| 453 |
+
'plain': [
|
| 454 |
+
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text),
|
| 455 |
+
(r'(#\{)(' + _dot + '*?)(\})',
|
| 456 |
+
bygroups(String.Interpol, using(ScalaLexer), String.Interpol)),
|
| 457 |
+
(r'\n', Text, 'root'),
|
| 458 |
+
],
|
| 459 |
+
|
| 460 |
+
'html-attributes': [
|
| 461 |
+
(r'\s+', Text),
|
| 462 |
+
(r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'),
|
| 463 |
+
(r'[\w:-]+', Name.Attribute),
|
| 464 |
+
(r'\)', Text, '#pop'),
|
| 465 |
+
],
|
| 466 |
+
|
| 467 |
+
'html-attribute-value': [
|
| 468 |
+
(r'[ \t]+', Text),
|
| 469 |
+
(r'\w+', Name.Variable, '#pop'),
|
| 470 |
+
(r'@\w+', Name.Variable.Instance, '#pop'),
|
| 471 |
+
(r'\$\w+', Name.Variable.Global, '#pop'),
|
| 472 |
+
(r"'(\\\\|\\'|[^'\n])*'", String, '#pop'),
|
| 473 |
+
(r'"(\\\\|\\"|[^"\n])*"', String, '#pop'),
|
| 474 |
+
],
|
| 475 |
+
|
| 476 |
+
'html-comment-block': [
|
| 477 |
+
(_dot + '+', Comment),
|
| 478 |
+
(r'\n', Text, 'root'),
|
| 479 |
+
],
|
| 480 |
+
|
| 481 |
+
'scaml-comment-block': [
|
| 482 |
+
(_dot + '+', Comment.Preproc),
|
| 483 |
+
(r'\n', Text, 'root'),
|
| 484 |
+
],
|
| 485 |
+
|
| 486 |
+
'filter-block': [
|
| 487 |
+
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Name.Decorator),
|
| 488 |
+
(r'(#\{)(' + _dot + '*?)(\})',
|
| 489 |
+
bygroups(String.Interpol, using(ScalaLexer), String.Interpol)),
|
| 490 |
+
(r'\n', Text, 'root'),
|
| 491 |
+
],
|
| 492 |
+
}
|
| 493 |
+
|
| 494 |
+
|
| 495 |
+
class PugLexer(ExtendedRegexLexer):
|
| 496 |
+
"""
|
| 497 |
+
For Pug markup.
|
| 498 |
+
Pug is a variant of Scaml, see:
|
| 499 |
+
http://scalate.fusesource.org/documentation/scaml-reference.html
|
| 500 |
+
|
| 501 |
+
.. versionadded:: 1.4
|
| 502 |
+
"""
|
| 503 |
+
|
| 504 |
+
name = 'Pug'
|
| 505 |
+
aliases = ['pug', 'jade']
|
| 506 |
+
filenames = ['*.pug', '*.jade']
|
| 507 |
+
mimetypes = ['text/x-pug', 'text/x-jade']
|
| 508 |
+
|
| 509 |
+
flags = re.IGNORECASE
|
| 510 |
+
_dot = r'.'
|
| 511 |
+
|
| 512 |
+
tokens = {
|
| 513 |
+
'root': [
|
| 514 |
+
(r'[ \t]*\n', Text),
|
| 515 |
+
(r'[ \t]*', _indentation),
|
| 516 |
+
],
|
| 517 |
+
|
| 518 |
+
'css': [
|
| 519 |
+
(r'\.[\w:-]+', Name.Class, 'tag'),
|
| 520 |
+
(r'\#[\w:-]+', Name.Function, 'tag'),
|
| 521 |
+
],
|
| 522 |
+
|
| 523 |
+
'eval-or-plain': [
|
| 524 |
+
(r'[&!]?==', Punctuation, 'plain'),
|
| 525 |
+
(r'([&!]?[=~])(' + _dot + r'*\n)',
|
| 526 |
+
bygroups(Punctuation, using(ScalaLexer)), 'root'),
|
| 527 |
+
default('plain'),
|
| 528 |
+
],
|
| 529 |
+
|
| 530 |
+
'content': [
|
| 531 |
+
include('css'),
|
| 532 |
+
(r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'),
|
| 533 |
+
(r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)',
|
| 534 |
+
bygroups(Comment, Comment.Special, Comment),
|
| 535 |
+
'#pop'),
|
| 536 |
+
(r'/' + _dot + r'*\n', _starts_block(Comment, 'html-comment-block'),
|
| 537 |
+
'#pop'),
|
| 538 |
+
(r'-#' + _dot + r'*\n', _starts_block(Comment.Preproc,
|
| 539 |
+
'scaml-comment-block'), '#pop'),
|
| 540 |
+
(r'(-@\s*)(import)?(' + _dot + r'*\n)',
|
| 541 |
+
bygroups(Punctuation, Keyword, using(ScalaLexer)),
|
| 542 |
+
'#pop'),
|
| 543 |
+
(r'(-)(' + _dot + r'*\n)',
|
| 544 |
+
bygroups(Punctuation, using(ScalaLexer)),
|
| 545 |
+
'#pop'),
|
| 546 |
+
(r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'),
|
| 547 |
+
'#pop'),
|
| 548 |
+
(r'[\w:-]+', Name.Tag, 'tag'),
|
| 549 |
+
(r'\|', Text, 'eval-or-plain'),
|
| 550 |
+
],
|
| 551 |
+
|
| 552 |
+
'tag': [
|
| 553 |
+
include('css'),
|
| 554 |
+
(r'\{(,\n|' + _dot + ')*?\}', using(ScalaLexer)),
|
| 555 |
+
(r'\[' + _dot + '*?\]', using(ScalaLexer)),
|
| 556 |
+
(r'\(', Text, 'html-attributes'),
|
| 557 |
+
(r'/[ \t]*\n', Punctuation, '#pop:2'),
|
| 558 |
+
(r'[<>]{1,2}(?=[ \t=])', Punctuation),
|
| 559 |
+
include('eval-or-plain'),
|
| 560 |
+
],
|
| 561 |
+
|
| 562 |
+
'plain': [
|
| 563 |
+
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text),
|
| 564 |
+
(r'(#\{)(' + _dot + '*?)(\})',
|
| 565 |
+
bygroups(String.Interpol, using(ScalaLexer), String.Interpol)),
|
| 566 |
+
(r'\n', Text, 'root'),
|
| 567 |
+
],
|
| 568 |
+
|
| 569 |
+
'html-attributes': [
|
| 570 |
+
(r'\s+', Text),
|
| 571 |
+
(r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'),
|
| 572 |
+
(r'[\w:-]+', Name.Attribute),
|
| 573 |
+
(r'\)', Text, '#pop'),
|
| 574 |
+
],
|
| 575 |
+
|
| 576 |
+
'html-attribute-value': [
|
| 577 |
+
(r'[ \t]+', Text),
|
| 578 |
+
(r'\w+', Name.Variable, '#pop'),
|
| 579 |
+
(r'@\w+', Name.Variable.Instance, '#pop'),
|
| 580 |
+
(r'\$\w+', Name.Variable.Global, '#pop'),
|
| 581 |
+
(r"'(\\\\|\\'|[^'\n])*'", String, '#pop'),
|
| 582 |
+
(r'"(\\\\|\\"|[^"\n])*"', String, '#pop'),
|
| 583 |
+
],
|
| 584 |
+
|
| 585 |
+
'html-comment-block': [
|
| 586 |
+
(_dot + '+', Comment),
|
| 587 |
+
(r'\n', Text, 'root'),
|
| 588 |
+
],
|
| 589 |
+
|
| 590 |
+
'scaml-comment-block': [
|
| 591 |
+
(_dot + '+', Comment.Preproc),
|
| 592 |
+
(r'\n', Text, 'root'),
|
| 593 |
+
],
|
| 594 |
+
|
| 595 |
+
'filter-block': [
|
| 596 |
+
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Name.Decorator),
|
| 597 |
+
(r'(#\{)(' + _dot + '*?)(\})',
|
| 598 |
+
bygroups(String.Interpol, using(ScalaLexer), String.Interpol)),
|
| 599 |
+
(r'\n', Text, 'root'),
|
| 600 |
+
],
|
| 601 |
+
}
|
| 602 |
+
JadeLexer = PugLexer # compat
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/idl.py
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.idl
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for IDL.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, words
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, Number, String
|
| 16 |
+
|
| 17 |
+
__all__ = ['IDLLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class IDLLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
Pygments Lexer for IDL (Interactive Data Language).
|
| 23 |
+
|
| 24 |
+
.. versionadded:: 1.6
|
| 25 |
+
"""
|
| 26 |
+
name = 'IDL'
|
| 27 |
+
aliases = ['idl']
|
| 28 |
+
filenames = ['*.pro']
|
| 29 |
+
mimetypes = ['text/idl']
|
| 30 |
+
|
| 31 |
+
flags = re.IGNORECASE | re.MULTILINE
|
| 32 |
+
|
| 33 |
+
_RESERVED = (
|
| 34 |
+
'and', 'begin', 'break', 'case', 'common', 'compile_opt',
|
| 35 |
+
'continue', 'do', 'else', 'end', 'endcase', 'elseelse',
|
| 36 |
+
'endfor', 'endforeach', 'endif', 'endrep', 'endswitch',
|
| 37 |
+
'endwhile', 'eq', 'for', 'foreach', 'forward_function',
|
| 38 |
+
'function', 'ge', 'goto', 'gt', 'if', 'inherits', 'le',
|
| 39 |
+
'lt', 'mod', 'ne', 'not', 'of', 'on_ioerror', 'or', 'pro',
|
| 40 |
+
'repeat', 'switch', 'then', 'until', 'while', 'xor')
|
| 41 |
+
"""Reserved words from: http://www.exelisvis.com/docs/reswords.html"""
|
| 42 |
+
|
| 43 |
+
_BUILTIN_LIB = (
|
| 44 |
+
'abs', 'acos', 'adapt_hist_equal', 'alog', 'alog10',
|
| 45 |
+
'amoeba', 'annotate', 'app_user_dir', 'app_user_dir_query',
|
| 46 |
+
'arg_present', 'array_equal', 'array_indices', 'arrow',
|
| 47 |
+
'ascii_template', 'asin', 'assoc', 'atan', 'axis',
|
| 48 |
+
'a_correlate', 'bandpass_filter', 'bandreject_filter',
|
| 49 |
+
'barplot', 'bar_plot', 'beseli', 'beselj', 'beselk',
|
| 50 |
+
'besely', 'beta', 'bilinear', 'binary_template', 'bindgen',
|
| 51 |
+
'binomial', 'bin_date', 'bit_ffs', 'bit_population',
|
| 52 |
+
'blas_axpy', 'blk_con', 'box_cursor', 'breakpoint',
|
| 53 |
+
'broyden', 'butterworth', 'bytarr', 'byte', 'byteorder',
|
| 54 |
+
'bytscl', 'caldat', 'calendar', 'call_external',
|
| 55 |
+
'call_function', 'call_method', 'call_procedure', 'canny',
|
| 56 |
+
'catch', 'cd', 'cdf_\w*', 'ceil', 'chebyshev',
|
| 57 |
+
'check_math',
|
| 58 |
+
'chisqr_cvf', 'chisqr_pdf', 'choldc', 'cholsol', 'cindgen',
|
| 59 |
+
'cir_3pnt', 'close', 'cluster', 'cluster_tree', 'clust_wts',
|
| 60 |
+
'cmyk_convert', 'colorbar', 'colorize_sample',
|
| 61 |
+
'colormap_applicable', 'colormap_gradient',
|
| 62 |
+
'colormap_rotation', 'colortable', 'color_convert',
|
| 63 |
+
'color_exchange', 'color_quan', 'color_range_map', 'comfit',
|
| 64 |
+
'command_line_args', 'complex', 'complexarr', 'complexround',
|
| 65 |
+
'compute_mesh_normals', 'cond', 'congrid', 'conj',
|
| 66 |
+
'constrained_min', 'contour', 'convert_coord', 'convol',
|
| 67 |
+
'convol_fft', 'coord2to3', 'copy_lun', 'correlate', 'cos',
|
| 68 |
+
'cosh', 'cpu', 'cramer', 'create_cursor', 'create_struct',
|
| 69 |
+
'create_view', 'crossp', 'crvlength', 'cti_test',
|
| 70 |
+
'ct_luminance', 'cursor', 'curvefit', 'cvttobm', 'cv_coord',
|
| 71 |
+
'cw_animate', 'cw_animate_getp', 'cw_animate_load',
|
| 72 |
+
'cw_animate_run', 'cw_arcball', 'cw_bgroup', 'cw_clr_index',
|
| 73 |
+
'cw_colorsel', 'cw_defroi', 'cw_field', 'cw_filesel',
|
| 74 |
+
'cw_form', 'cw_fslider', 'cw_light_editor',
|
| 75 |
+
'cw_light_editor_get', 'cw_light_editor_set', 'cw_orient',
|
| 76 |
+
'cw_palette_editor', 'cw_palette_editor_get',
|
| 77 |
+
'cw_palette_editor_set', 'cw_pdmenu', 'cw_rgbslider',
|
| 78 |
+
'cw_tmpl', 'cw_zoom', 'c_correlate', 'dblarr', 'db_exists',
|
| 79 |
+
'dcindgen', 'dcomplex', 'dcomplexarr', 'define_key',
|
| 80 |
+
'define_msgblk', 'define_msgblk_from_file', 'defroi',
|
| 81 |
+
'defsysv', 'delvar', 'dendrogram', 'dendro_plot', 'deriv',
|
| 82 |
+
'derivsig', 'determ', 'device', 'dfpmin', 'diag_matrix',
|
| 83 |
+
'dialog_dbconnect', 'dialog_message', 'dialog_pickfile',
|
| 84 |
+
'dialog_printersetup', 'dialog_printjob',
|
| 85 |
+
'dialog_read_image', 'dialog_write_image', 'digital_filter',
|
| 86 |
+
'dilate', 'dindgen', 'dissolve', 'dist', 'distance_measure',
|
| 87 |
+
'dlm_load', 'dlm_register', 'doc_library', 'double',
|
| 88 |
+
'draw_roi', 'edge_dog', 'efont', 'eigenql', 'eigenvec',
|
| 89 |
+
'ellipse', 'elmhes', 'emboss', 'empty', 'enable_sysrtn',
|
| 90 |
+
'eof', 'eos_\w*', 'erase', 'erf', 'erfc', 'erfcx',
|
| 91 |
+
'erode', 'errorplot', 'errplot', 'estimator_filter',
|
| 92 |
+
'execute', 'exit', 'exp', 'expand', 'expand_path', 'expint',
|
| 93 |
+
'extrac', 'extract_slice', 'factorial', 'fft', 'filepath',
|
| 94 |
+
'file_basename', 'file_chmod', 'file_copy', 'file_delete',
|
| 95 |
+
'file_dirname', 'file_expand_path', 'file_info',
|
| 96 |
+
'file_lines', 'file_link', 'file_mkdir', 'file_move',
|
| 97 |
+
'file_poll_input', 'file_readlink', 'file_same',
|
| 98 |
+
'file_search', 'file_test', 'file_which', 'findgen',
|
| 99 |
+
'finite', 'fix', 'flick', 'float', 'floor', 'flow3',
|
| 100 |
+
'fltarr', 'flush', 'format_axis_values', 'free_lun',
|
| 101 |
+
'fstat', 'fulstr', 'funct', 'fv_test', 'fx_root',
|
| 102 |
+
'fz_roots', 'f_cvf', 'f_pdf', 'gamma', 'gamma_ct',
|
| 103 |
+
'gauss2dfit', 'gaussfit', 'gaussian_function', 'gaussint',
|
| 104 |
+
'gauss_cvf', 'gauss_pdf', 'gauss_smooth', 'getenv',
|
| 105 |
+
'getwindows', 'get_drive_list', 'get_dxf_objects',
|
| 106 |
+
'get_kbrd', 'get_login_info', 'get_lun', 'get_screen_size',
|
| 107 |
+
'greg2jul', 'grib_\w*', 'grid3', 'griddata',
|
| 108 |
+
'grid_input', 'grid_tps', 'gs_iter',
|
| 109 |
+
'h5[adfgirst]_\w*', 'h5_browser', 'h5_close',
|
| 110 |
+
'h5_create', 'h5_get_libversion', 'h5_open', 'h5_parse',
|
| 111 |
+
'hanning', 'hash', 'hdf_\w*', 'heap_free',
|
| 112 |
+
'heap_gc', 'heap_nosave', 'heap_refcount', 'heap_save',
|
| 113 |
+
'help', 'hilbert', 'histogram', 'hist_2d', 'hist_equal',
|
| 114 |
+
'hls', 'hough', 'hqr', 'hsv', 'h_eq_ct', 'h_eq_int',
|
| 115 |
+
'i18n_multibytetoutf8', 'i18n_multibytetowidechar',
|
| 116 |
+
'i18n_utf8tomultibyte', 'i18n_widechartomultibyte',
|
| 117 |
+
'ibeta', 'icontour', 'iconvertcoord', 'idelete', 'identity',
|
| 118 |
+
'idlexbr_assistant', 'idlitsys_createtool', 'idl_base64',
|
| 119 |
+
'idl_validname', 'iellipse', 'igamma', 'igetcurrent',
|
| 120 |
+
'igetdata', 'igetid', 'igetproperty', 'iimage', 'image',
|
| 121 |
+
'image_cont', 'image_statistics', 'imaginary', 'imap',
|
| 122 |
+
'indgen', 'intarr', 'interpol', 'interpolate',
|
| 123 |
+
'interval_volume', 'int_2d', 'int_3d', 'int_tabulated',
|
| 124 |
+
'invert', 'ioctl', 'iopen', 'iplot', 'ipolygon',
|
| 125 |
+
'ipolyline', 'iputdata', 'iregister', 'ireset', 'iresolve',
|
| 126 |
+
'irotate', 'ir_filter', 'isa', 'isave', 'iscale',
|
| 127 |
+
'isetcurrent', 'isetproperty', 'ishft', 'isocontour',
|
| 128 |
+
'isosurface', 'isurface', 'itext', 'itranslate', 'ivector',
|
| 129 |
+
'ivolume', 'izoom', 'i_beta', 'journal', 'json_parse',
|
| 130 |
+
'json_serialize', 'jul2greg', 'julday', 'keyword_set',
|
| 131 |
+
'krig2d', 'kurtosis', 'kw_test', 'l64indgen', 'label_date',
|
| 132 |
+
'label_region', 'ladfit', 'laguerre', 'laplacian',
|
| 133 |
+
'la_choldc', 'la_cholmprove', 'la_cholsol', 'la_determ',
|
| 134 |
+
'la_eigenproblem', 'la_eigenql', 'la_eigenvec', 'la_elmhes',
|
| 135 |
+
'la_gm_linear_model', 'la_hqr', 'la_invert',
|
| 136 |
+
'la_least_squares', 'la_least_square_equality',
|
| 137 |
+
'la_linear_equation', 'la_ludc', 'la_lumprove', 'la_lusol',
|
| 138 |
+
'la_svd', 'la_tridc', 'la_trimprove', 'la_triql',
|
| 139 |
+
'la_trired', 'la_trisol', 'least_squares_filter', 'leefilt',
|
| 140 |
+
'legend', 'legendre', 'linbcg', 'lindgen', 'linfit',
|
| 141 |
+
'linkimage', 'list', 'll_arc_distance', 'lmfit', 'lmgr',
|
| 142 |
+
'lngamma', 'lnp_test', 'loadct', 'locale_get',
|
| 143 |
+
'logical_and', 'logical_or', 'logical_true', 'lon64arr',
|
| 144 |
+
'lonarr', 'long', 'long64', 'lsode', 'ludc', 'lumprove',
|
| 145 |
+
'lusol', 'lu_complex', 'machar', 'make_array', 'make_dll',
|
| 146 |
+
'make_rt', 'map', 'mapcontinents', 'mapgrid', 'map_2points',
|
| 147 |
+
'map_continents', 'map_grid', 'map_image', 'map_patch',
|
| 148 |
+
'map_proj_forward', 'map_proj_image', 'map_proj_info',
|
| 149 |
+
'map_proj_init', 'map_proj_inverse', 'map_set',
|
| 150 |
+
'matrix_multiply', 'matrix_power', 'max', 'md_test',
|
| 151 |
+
'mean', 'meanabsdev', 'mean_filter', 'median', 'memory',
|
| 152 |
+
'mesh_clip', 'mesh_decimate', 'mesh_issolid', 'mesh_merge',
|
| 153 |
+
'mesh_numtriangles', 'mesh_obj', 'mesh_smooth',
|
| 154 |
+
'mesh_surfacearea', 'mesh_validate', 'mesh_volume',
|
| 155 |
+
'message', 'min', 'min_curve_surf', 'mk_html_help',
|
| 156 |
+
'modifyct', 'moment', 'morph_close', 'morph_distance',
|
| 157 |
+
'morph_gradient', 'morph_hitormiss', 'morph_open',
|
| 158 |
+
'morph_thin', 'morph_tophat', 'multi', 'm_correlate',
|
| 159 |
+
'ncdf_\w*', 'newton', 'noise_hurl', 'noise_pick',
|
| 160 |
+
'noise_scatter', 'noise_slur', 'norm', 'n_elements',
|
| 161 |
+
'n_params', 'n_tags', 'objarr', 'obj_class', 'obj_destroy',
|
| 162 |
+
'obj_hasmethod', 'obj_isa', 'obj_new', 'obj_valid',
|
| 163 |
+
'online_help', 'on_error', 'open', 'oplot', 'oploterr',
|
| 164 |
+
'parse_url', 'particle_trace', 'path_cache', 'path_sep',
|
| 165 |
+
'pcomp', 'plot', 'plot3d', 'ploterr', 'plots', 'plot_3dbox',
|
| 166 |
+
'plot_field', 'pnt_line', 'point_lun', 'polarplot',
|
| 167 |
+
'polar_contour', 'polar_surface', 'poly', 'polyfill',
|
| 168 |
+
'polyfillv', 'polygon', 'polyline', 'polyshade', 'polywarp',
|
| 169 |
+
'poly_2d', 'poly_area', 'poly_fit', 'popd', 'powell',
|
| 170 |
+
'pref_commit', 'pref_get', 'pref_set', 'prewitt', 'primes',
|
| 171 |
+
'print', 'printd', 'product', 'profile', 'profiler',
|
| 172 |
+
'profiles', 'project_vol', 'psafm', 'pseudo',
|
| 173 |
+
'ps_show_fonts', 'ptrarr', 'ptr_free', 'ptr_new',
|
| 174 |
+
'ptr_valid', 'pushd', 'p_correlate', 'qgrid3', 'qhull',
|
| 175 |
+
'qromb', 'qromo', 'qsimp', 'query_ascii', 'query_bmp',
|
| 176 |
+
'query_csv', 'query_dicom', 'query_gif', 'query_image',
|
| 177 |
+
'query_jpeg', 'query_jpeg2000', 'query_mrsid', 'query_pict',
|
| 178 |
+
'query_png', 'query_ppm', 'query_srf', 'query_tiff',
|
| 179 |
+
'query_wav', 'radon', 'randomn', 'randomu', 'ranks',
|
| 180 |
+
'rdpix', 'read', 'reads', 'readu', 'read_ascii',
|
| 181 |
+
'read_binary', 'read_bmp', 'read_csv', 'read_dicom',
|
| 182 |
+
'read_gif', 'read_image', 'read_interfile', 'read_jpeg',
|
| 183 |
+
'read_jpeg2000', 'read_mrsid', 'read_pict', 'read_png',
|
| 184 |
+
'read_ppm', 'read_spr', 'read_srf', 'read_sylk',
|
| 185 |
+
'read_tiff', 'read_wav', 'read_wave', 'read_x11_bitmap',
|
| 186 |
+
'read_xwd', 'real_part', 'rebin', 'recall_commands',
|
| 187 |
+
'recon3', 'reduce_colors', 'reform', 'region_grow',
|
| 188 |
+
'register_cursor', 'regress', 'replicate',
|
| 189 |
+
'replicate_inplace', 'resolve_all', 'resolve_routine',
|
| 190 |
+
'restore', 'retall', 'return', 'reverse', 'rk4', 'roberts',
|
| 191 |
+
'rot', 'rotate', 'round', 'routine_filepath',
|
| 192 |
+
'routine_info', 'rs_test', 'r_correlate', 'r_test',
|
| 193 |
+
'save', 'savgol', 'scale3', 'scale3d', 'scope_level',
|
| 194 |
+
'scope_traceback', 'scope_varfetch', 'scope_varname',
|
| 195 |
+
'search2d', 'search3d', 'sem_create', 'sem_delete',
|
| 196 |
+
'sem_lock', 'sem_release', 'setenv', 'set_plot',
|
| 197 |
+
'set_shading', 'sfit', 'shade_surf', 'shade_surf_irr',
|
| 198 |
+
'shade_volume', 'shift', 'shift_diff', 'shmdebug', 'shmmap',
|
| 199 |
+
'shmunmap', 'shmvar', 'show3', 'showfont', 'simplex', 'sin',
|
| 200 |
+
'sindgen', 'sinh', 'size', 'skewness', 'skip_lun',
|
| 201 |
+
'slicer3', 'slide_image', 'smooth', 'sobel', 'socket',
|
| 202 |
+
'sort', 'spawn', 'spher_harm', 'sph_4pnt', 'sph_scat',
|
| 203 |
+
'spline', 'spline_p', 'spl_init', 'spl_interp', 'sprsab',
|
| 204 |
+
'sprsax', 'sprsin', 'sprstp', 'sqrt', 'standardize',
|
| 205 |
+
'stddev', 'stop', 'strarr', 'strcmp', 'strcompress',
|
| 206 |
+
'streamline', 'stregex', 'stretch', 'string', 'strjoin',
|
| 207 |
+
'strlen', 'strlowcase', 'strmatch', 'strmessage', 'strmid',
|
| 208 |
+
'strpos', 'strput', 'strsplit', 'strtrim', 'struct_assign',
|
| 209 |
+
'struct_hide', 'strupcase', 'surface', 'surfr', 'svdc',
|
| 210 |
+
'svdfit', 'svsol', 'swap_endian', 'swap_endian_inplace',
|
| 211 |
+
'symbol', 'systime', 's_test', 't3d', 'tag_names', 'tan',
|
| 212 |
+
'tanh', 'tek_color', 'temporary', 'tetra_clip',
|
| 213 |
+
'tetra_surface', 'tetra_volume', 'text', 'thin', 'threed',
|
| 214 |
+
'timegen', 'time_test2', 'tm_test', 'total', 'trace',
|
| 215 |
+
'transpose', 'triangulate', 'trigrid', 'triql', 'trired',
|
| 216 |
+
'trisol', 'tri_surf', 'truncate_lun', 'ts_coef', 'ts_diff',
|
| 217 |
+
'ts_fcast', 'ts_smooth', 'tv', 'tvcrs', 'tvlct', 'tvrd',
|
| 218 |
+
'tvscl', 'typename', 't_cvt', 't_pdf', 'uindgen', 'uint',
|
| 219 |
+
'uintarr', 'ul64indgen', 'ulindgen', 'ulon64arr', 'ulonarr',
|
| 220 |
+
'ulong', 'ulong64', 'uniq', 'unsharp_mask', 'usersym',
|
| 221 |
+
'value_locate', 'variance', 'vector', 'vector_field', 'vel',
|
| 222 |
+
'velovect', 'vert_t3d', 'voigt', 'voronoi', 'voxel_proj',
|
| 223 |
+
'wait', 'warp_tri', 'watershed', 'wdelete', 'wf_draw',
|
| 224 |
+
'where', 'widget_base', 'widget_button', 'widget_combobox',
|
| 225 |
+
'widget_control', 'widget_displaycontextmen', 'widget_draw',
|
| 226 |
+
'widget_droplist', 'widget_event', 'widget_info',
|
| 227 |
+
'widget_label', 'widget_list', 'widget_propertysheet',
|
| 228 |
+
'widget_slider', 'widget_tab', 'widget_table',
|
| 229 |
+
'widget_text', 'widget_tree', 'widget_tree_move',
|
| 230 |
+
'widget_window', 'wiener_filter', 'window', 'writeu',
|
| 231 |
+
'write_bmp', 'write_csv', 'write_gif', 'write_image',
|
| 232 |
+
'write_jpeg', 'write_jpeg2000', 'write_nrif', 'write_pict',
|
| 233 |
+
'write_png', 'write_ppm', 'write_spr', 'write_srf',
|
| 234 |
+
'write_sylk', 'write_tiff', 'write_wav', 'write_wave',
|
| 235 |
+
'wset', 'wshow', 'wtn', 'wv_applet', 'wv_cwt',
|
| 236 |
+
'wv_cw_wavelet', 'wv_denoise', 'wv_dwt', 'wv_fn_coiflet',
|
| 237 |
+
'wv_fn_daubechies', 'wv_fn_gaussian', 'wv_fn_haar',
|
| 238 |
+
'wv_fn_morlet', 'wv_fn_paul', 'wv_fn_symlet',
|
| 239 |
+
'wv_import_data', 'wv_import_wavelet', 'wv_plot3d_wps',
|
| 240 |
+
'wv_plot_multires', 'wv_pwt', 'wv_tool_denoise',
|
| 241 |
+
'xbm_edit', 'xdisplayfile', 'xdxf', 'xfont',
|
| 242 |
+
'xinteranimate', 'xloadct', 'xmanager', 'xmng_tmpl',
|
| 243 |
+
'xmtool', 'xobjview', 'xobjview_rotate',
|
| 244 |
+
'xobjview_write_image', 'xpalette', 'xpcolor', 'xplot3d',
|
| 245 |
+
'xregistered', 'xroi', 'xsq_test', 'xsurface', 'xvaredit',
|
| 246 |
+
'xvolume', 'xvolume_rotate', 'xvolume_write_image',
|
| 247 |
+
'xyouts', 'zoom', 'zoom_24')
|
| 248 |
+
"""Functions from: http://www.exelisvis.com/docs/routines-1.html"""
|
| 249 |
+
|
| 250 |
+
tokens = {
|
| 251 |
+
'root': [
|
| 252 |
+
(r'^\s*;.*?\n', Comment.Singleline),
|
| 253 |
+
(words(_RESERVED, prefix=r'\b', suffix=r'\b'), Keyword),
|
| 254 |
+
(words(_BUILTIN_LIB, prefix=r'\b', suffix=r'\b'), Name.Builtin),
|
| 255 |
+
(r'\+=|-=|\^=|\*=|/=|#=|##=|<=|>=|=', Operator),
|
| 256 |
+
(r'\+\+|--|->|\+|-|##|#|\*|/|<|>|&&|\^|~|\|\|\?|:', Operator),
|
| 257 |
+
(r'\b(mod=|lt=|le=|eq=|ne=|ge=|gt=|not=|and=|or=|xor=)', Operator),
|
| 258 |
+
(r'\b(mod|lt|le|eq|ne|ge|gt|not|and|or|xor)\b', Operator),
|
| 259 |
+
(r'"[^\"]*"', String.Double),
|
| 260 |
+
(r"'[^\']*'", String.Single),
|
| 261 |
+
(r'\b[+\-]?([0-9]*\.[0-9]+|[0-9]+\.[0-9]*)(D|E)?([+\-]?[0-9]+)?\b',
|
| 262 |
+
Number.Float),
|
| 263 |
+
(r'\b\'[+\-]?[0-9A-F]+\'X(U?(S?|L{1,2})|B)\b', Number.Hex),
|
| 264 |
+
(r'\b\'[+\-]?[0-7]+\'O(U?(S?|L{1,2})|B)\b', Number.Oct),
|
| 265 |
+
(r'\b[+\-]?[0-9]+U?L{1,2}\b', Number.Integer.Long),
|
| 266 |
+
(r'\b[+\-]?[0-9]+U?S?\b', Number.Integer),
|
| 267 |
+
(r'\b[+\-]?[0-9]+B\b', Number),
|
| 268 |
+
(r'.', Text),
|
| 269 |
+
]
|
| 270 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/igor.py
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.igor
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for Igor Pro.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, words
|
| 15 |
+
from pygments.token import Text, Comment, Keyword, Name, String
|
| 16 |
+
|
| 17 |
+
__all__ = ['IgorLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class IgorLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
Pygments Lexer for Igor Pro procedure files (.ipf).
|
| 23 |
+
See http://www.wavemetrics.com/ and http://www.igorexchange.com/.
|
| 24 |
+
|
| 25 |
+
.. versionadded:: 2.0
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
name = 'Igor'
|
| 29 |
+
aliases = ['igor', 'igorpro']
|
| 30 |
+
filenames = ['*.ipf']
|
| 31 |
+
mimetypes = ['text/ipf']
|
| 32 |
+
|
| 33 |
+
flags = re.IGNORECASE | re.MULTILINE
|
| 34 |
+
|
| 35 |
+
flowControl = (
|
| 36 |
+
'if', 'else', 'elseif', 'endif', 'for', 'endfor', 'strswitch', 'switch',
|
| 37 |
+
'case', 'default', 'endswitch', 'do', 'while', 'try', 'catch', 'endtry',
|
| 38 |
+
'break', 'continue', 'return', 'AbortOnRTE', 'AbortOnValue'
|
| 39 |
+
)
|
| 40 |
+
types = (
|
| 41 |
+
'variable', 'string', 'constant', 'strconstant', 'NVAR', 'SVAR', 'WAVE',
|
| 42 |
+
'STRUCT', 'dfref', 'funcref', 'char', 'uchar', 'int16', 'uint16', 'int32',
|
| 43 |
+
'uint32', 'int64', 'uint64', 'float', 'double'
|
| 44 |
+
)
|
| 45 |
+
keywords = (
|
| 46 |
+
'override', 'ThreadSafe', 'MultiThread', 'static', 'Proc',
|
| 47 |
+
'Picture', 'Prompt', 'DoPrompt', 'macro', 'window', 'function', 'end',
|
| 48 |
+
'Structure', 'EndStructure', 'EndMacro', 'Menu', 'SubMenu'
|
| 49 |
+
)
|
| 50 |
+
operations = (
|
| 51 |
+
'Abort', 'AddFIFOData', 'AddFIFOVectData', 'AddMovieAudio', 'AddMovieFrame',
|
| 52 |
+
'AdoptFiles', 'APMath', 'Append', 'AppendImage', 'AppendLayoutObject',
|
| 53 |
+
'AppendMatrixContour', 'AppendText', 'AppendToGizmo', 'AppendToGraph',
|
| 54 |
+
'AppendToLayout', 'AppendToTable', 'AppendXYZContour', 'AutoPositionWindow',
|
| 55 |
+
'BackgroundInfo', 'Beep', 'BoundingBall', 'BoxSmooth', 'BrowseURL', 'BuildMenu',
|
| 56 |
+
'Button', 'cd', 'Chart', 'CheckBox', 'CheckDisplayed', 'ChooseColor', 'Close',
|
| 57 |
+
'CloseHelp', 'CloseMovie', 'CloseProc', 'ColorScale', 'ColorTab2Wave',
|
| 58 |
+
'Concatenate', 'ControlBar', 'ControlInfo', 'ControlUpdate',
|
| 59 |
+
'ConvertGlobalStringTextEncoding', 'ConvexHull', 'Convolve', 'CopyFile',
|
| 60 |
+
'CopyFolder', 'CopyScales', 'Correlate', 'CreateAliasShortcut', 'CreateBrowser',
|
| 61 |
+
'Cross', 'CtrlBackground', 'CtrlFIFO', 'CtrlNamedBackground', 'Cursor',
|
| 62 |
+
'CurveFit', 'CustomControl', 'CWT', 'Debugger', 'DebuggerOptions', 'DefaultFont',
|
| 63 |
+
'DefaultGuiControls', 'DefaultGuiFont', 'DefaultTextEncoding', 'DefineGuide',
|
| 64 |
+
'DelayUpdate', 'DeleteAnnotations', 'DeleteFile', 'DeleteFolder', 'DeletePoints',
|
| 65 |
+
'Differentiate', 'dir', 'Display', 'DisplayHelpTopic', 'DisplayProcedure',
|
| 66 |
+
'DoAlert', 'DoIgorMenu', 'DoUpdate', 'DoWindow', 'DoXOPIdle', 'DPSS',
|
| 67 |
+
'DrawAction', 'DrawArc', 'DrawBezier', 'DrawLine', 'DrawOval', 'DrawPICT',
|
| 68 |
+
'DrawPoly', 'DrawRect', 'DrawRRect', 'DrawText', 'DrawUserShape', 'DSPDetrend',
|
| 69 |
+
'DSPPeriodogram', 'Duplicate', 'DuplicateDataFolder', 'DWT', 'EdgeStats', 'Edit',
|
| 70 |
+
'ErrorBars', 'EstimatePeakSizes', 'Execute', 'ExecuteScriptText',
|
| 71 |
+
'ExperimentModified', 'ExportGizmo', 'Extract', 'FastGaussTransform', 'FastOp',
|
| 72 |
+
'FBinRead', 'FBinWrite', 'FFT', 'FIFOStatus', 'FIFO2Wave', 'FilterFIR',
|
| 73 |
+
'FilterIIR', 'FindAPeak', 'FindContour', 'FindDuplicates', 'FindLevel',
|
| 74 |
+
'FindLevels', 'FindPeak', 'FindPointsInPoly', 'FindRoots', 'FindSequence',
|
| 75 |
+
'FindValue', 'FPClustering', 'fprintf', 'FReadLine', 'FSetPos', 'FStatus',
|
| 76 |
+
'FTPCreateDirectory', 'FTPDelete', 'FTPDownload', 'FTPUpload', 'FuncFit',
|
| 77 |
+
'FuncFitMD', 'GBLoadWave', 'GetAxis', 'GetCamera', 'GetFileFolderInfo',
|
| 78 |
+
'GetGizmo', 'GetLastUserMenuInfo', 'GetMarquee', 'GetMouse', 'GetSelection',
|
| 79 |
+
'GetWindow', 'GPIBReadBinaryWave2', 'GPIBReadBinary2', 'GPIBReadWave2',
|
| 80 |
+
'GPIBRead2', 'GPIBWriteBinaryWave2', 'GPIBWriteBinary2', 'GPIBWriteWave2',
|
| 81 |
+
'GPIBWrite2', 'GPIB2', 'GraphNormal', 'GraphWaveDraw', 'GraphWaveEdit', 'Grep',
|
| 82 |
+
'GroupBox', 'Hanning', 'HDF5CloseFile', 'HDF5CloseGroup', 'HDF5ConvertColors',
|
| 83 |
+
'HDF5CreateFile', 'HDF5CreateGroup', 'HDF5CreateLink', 'HDF5Dump',
|
| 84 |
+
'HDF5DumpErrors', 'HDF5DumpState', 'HDF5ListAttributes', 'HDF5ListGroup',
|
| 85 |
+
'HDF5LoadData', 'HDF5LoadGroup', 'HDF5LoadImage', 'HDF5OpenFile', 'HDF5OpenGroup',
|
| 86 |
+
'HDF5SaveData', 'HDF5SaveGroup', 'HDF5SaveImage', 'HDF5TestOperation',
|
| 87 |
+
'HDF5UnlinkObject', 'HideIgorMenus', 'HideInfo', 'HideProcedures', 'HideTools',
|
| 88 |
+
'HilbertTransform', 'Histogram', 'ICA', 'IFFT', 'ImageAnalyzeParticles',
|
| 89 |
+
'ImageBlend', 'ImageBoundaryToMask', 'ImageEdgeDetection', 'ImageFileInfo',
|
| 90 |
+
'ImageFilter', 'ImageFocus', 'ImageFromXYZ', 'ImageGenerateROIMask', 'ImageGLCM',
|
| 91 |
+
'ImageHistModification', 'ImageHistogram', 'ImageInterpolate', 'ImageLineProfile',
|
| 92 |
+
'ImageLoad', 'ImageMorphology', 'ImageRegistration', 'ImageRemoveBackground',
|
| 93 |
+
'ImageRestore', 'ImageRotate', 'ImageSave', 'ImageSeedFill', 'ImageSkeleton3d',
|
| 94 |
+
'ImageSnake', 'ImageStats', 'ImageThreshold', 'ImageTransform',
|
| 95 |
+
'ImageUnwrapPhase', 'ImageWindow', 'IndexSort', 'InsertPoints', 'Integrate',
|
| 96 |
+
'IntegrateODE', 'Integrate2D', 'Interpolate2', 'Interpolate3D', 'Interp3DPath',
|
| 97 |
+
'JCAMPLoadWave', 'JointHistogram', 'KillBackground', 'KillControl',
|
| 98 |
+
'KillDataFolder', 'KillFIFO', 'KillFreeAxis', 'KillPath', 'KillPICTs',
|
| 99 |
+
'KillStrings', 'KillVariables', 'KillWaves', 'KillWindow', 'KMeans', 'Label',
|
| 100 |
+
'Layout', 'LayoutPageAction', 'LayoutSlideShow', 'Legend',
|
| 101 |
+
'LinearFeedbackShiftRegister', 'ListBox', 'LoadData', 'LoadPackagePreferences',
|
| 102 |
+
'LoadPICT', 'LoadWave', 'Loess', 'LombPeriodogram', 'Make', 'MakeIndex',
|
| 103 |
+
'MarkPerfTestTime', 'MatrixConvolve', 'MatrixCorr', 'MatrixEigenV',
|
| 104 |
+
'MatrixFilter', 'MatrixGaussJ', 'MatrixGLM', 'MatrixInverse', 'MatrixLinearSolve',
|
| 105 |
+
'MatrixLinearSolveTD', 'MatrixLLS', 'MatrixLUBkSub', 'MatrixLUD', 'MatrixLUDTD',
|
| 106 |
+
'MatrixMultiply', 'MatrixOP', 'MatrixSchur', 'MatrixSolve', 'MatrixSVBkSub',
|
| 107 |
+
'MatrixSVD', 'MatrixTranspose', 'MeasureStyledText', 'MLLoadWave', 'Modify',
|
| 108 |
+
'ModifyBrowser', 'ModifyCamera', 'ModifyContour', 'ModifyControl',
|
| 109 |
+
'ModifyControlList', 'ModifyFreeAxis', 'ModifyGizmo', 'ModifyGraph',
|
| 110 |
+
'ModifyImage', 'ModifyLayout', 'ModifyPanel', 'ModifyTable', 'ModifyWaterfall',
|
| 111 |
+
'MoveDataFolder', 'MoveFile', 'MoveFolder', 'MoveString', 'MoveSubwindow',
|
| 112 |
+
'MoveVariable', 'MoveWave', 'MoveWindow', 'MultiTaperPSD',
|
| 113 |
+
'MultiThreadingControl', 'NeuralNetworkRun', 'NeuralNetworkTrain', 'NewCamera',
|
| 114 |
+
'NewDataFolder', 'NewFIFO', 'NewFIFOChan', 'NewFreeAxis', 'NewGizmo', 'NewImage',
|
| 115 |
+
'NewLayout', 'NewMovie', 'NewNotebook', 'NewPanel', 'NewPath', 'NewWaterfall',
|
| 116 |
+
'NI4882', 'Note', 'Notebook', 'NotebookAction', 'Open', 'OpenHelp',
|
| 117 |
+
'OpenNotebook', 'Optimize', 'ParseOperationTemplate', 'PathInfo', 'PauseForUser',
|
| 118 |
+
'PauseUpdate', 'PCA', 'PlayMovie', 'PlayMovieAction', 'PlaySound',
|
| 119 |
+
'PopupContextualMenu', 'PopupMenu', 'Preferences', 'PrimeFactors', 'Print',
|
| 120 |
+
'printf', 'PrintGraphs', 'PrintLayout', 'PrintNotebook', 'PrintSettings',
|
| 121 |
+
'PrintTable', 'Project', 'PulseStats', 'PutScrapText', 'pwd', 'Quit',
|
| 122 |
+
'RatioFromNumber', 'Redimension', 'Remove', 'RemoveContour', 'RemoveFromGizmo',
|
| 123 |
+
'RemoveFromGraph', 'RemoveFromLayout', 'RemoveFromTable', 'RemoveImage',
|
| 124 |
+
'RemoveLayoutObjects', 'RemovePath', 'Rename', 'RenameDataFolder', 'RenamePath',
|
| 125 |
+
'RenamePICT', 'RenameWindow', 'ReorderImages', 'ReorderTraces', 'ReplaceText',
|
| 126 |
+
'ReplaceWave', 'Resample', 'ResumeUpdate', 'Reverse', 'Rotate', 'Save',
|
| 127 |
+
'SaveData', 'SaveExperiment', 'SaveGraphCopy', 'SaveNotebook',
|
| 128 |
+
'SavePackagePreferences', 'SavePICT', 'SaveTableCopy', 'SetActiveSubwindow',
|
| 129 |
+
'SetAxis', 'SetBackground', 'SetDashPattern', 'SetDataFolder', 'SetDimLabel',
|
| 130 |
+
'SetDrawEnv', 'SetDrawLayer', 'SetFileFolderInfo', 'SetFormula', 'SetIgorHook',
|
| 131 |
+
'SetIgorMenuMode', 'SetIgorOption', 'SetMarquee', 'SetProcessSleep',
|
| 132 |
+
'SetRandomSeed', 'SetScale', 'SetVariable', 'SetWaveLock', 'SetWaveTextEncoding',
|
| 133 |
+
'SetWindow', 'ShowIgorMenus', 'ShowInfo', 'ShowTools', 'Silent', 'Sleep',
|
| 134 |
+
'Slider', 'Smooth', 'SmoothCustom', 'Sort', 'SortColumns', 'SoundInRecord',
|
| 135 |
+
'SoundInSet', 'SoundInStartChart', 'SoundInStatus', 'SoundInStopChart',
|
| 136 |
+
'SoundLoadWave', 'SoundSaveWave', 'SphericalInterpolate', 'SphericalTriangulate',
|
| 137 |
+
'SplitString', 'SplitWave', 'sprintf', 'sscanf', 'Stack', 'StackWindows',
|
| 138 |
+
'StatsAngularDistanceTest', 'StatsANOVA1Test', 'StatsANOVA2NRTest',
|
| 139 |
+
'StatsANOVA2RMTest', 'StatsANOVA2Test', 'StatsChiTest',
|
| 140 |
+
'StatsCircularCorrelationTest', 'StatsCircularMeans', 'StatsCircularMoments',
|
| 141 |
+
'StatsCircularTwoSampleTest', 'StatsCochranTest', 'StatsContingencyTable',
|
| 142 |
+
'StatsDIPTest', 'StatsDunnettTest', 'StatsFriedmanTest', 'StatsFTest',
|
| 143 |
+
'StatsHodgesAjneTest', 'StatsJBTest', 'StatsKDE', 'StatsKendallTauTest',
|
| 144 |
+
'StatsKSTest', 'StatsKWTest', 'StatsLinearCorrelationTest',
|
| 145 |
+
'StatsLinearRegression', 'StatsMultiCorrelationTest', 'StatsNPMCTest',
|
| 146 |
+
'StatsNPNominalSRTest', 'StatsQuantiles', 'StatsRankCorrelationTest',
|
| 147 |
+
'StatsResample', 'StatsSample', 'StatsScheffeTest', 'StatsShapiroWilkTest',
|
| 148 |
+
'StatsSignTest', 'StatsSRTest', 'StatsTTest', 'StatsTukeyTest',
|
| 149 |
+
'StatsVariancesTest', 'StatsWatsonUSquaredTest', 'StatsWatsonWilliamsTest',
|
| 150 |
+
'StatsWheelerWatsonTest', 'StatsWilcoxonRankTest', 'StatsWRCorrelationTest',
|
| 151 |
+
'String', 'StructGet', 'StructPut', 'SumDimension', 'SumSeries', 'TabControl',
|
| 152 |
+
'Tag', 'TextBox', 'ThreadGroupPutDF', 'ThreadStart', 'Tile', 'TileWindows',
|
| 153 |
+
'TitleBox', 'ToCommandLine', 'ToolsGrid', 'Triangulate3d', 'Unwrap', 'URLRequest',
|
| 154 |
+
'ValDisplay', 'Variable', 'VDTClosePort2', 'VDTGetPortList2', 'VDTGetStatus2',
|
| 155 |
+
'VDTOpenPort2', 'VDTOperationsPort2', 'VDTReadBinaryWave2', 'VDTReadBinary2',
|
| 156 |
+
'VDTReadHexWave2', 'VDTReadHex2', 'VDTReadWave2', 'VDTRead2', 'VDTTerminalPort2',
|
| 157 |
+
'VDTWriteBinaryWave2', 'VDTWriteBinary2', 'VDTWriteHexWave2', 'VDTWriteHex2',
|
| 158 |
+
'VDTWriteWave2', 'VDTWrite2', 'VDT2', 'WaveMeanStdv', 'WaveStats',
|
| 159 |
+
'WaveTransform', 'wfprintf', 'WignerTransform', 'WindowFunction', 'XLLoadWave'
|
| 160 |
+
)
|
| 161 |
+
functions = (
|
| 162 |
+
'abs', 'acos', 'acosh', 'AddListItem', 'AiryA', 'AiryAD', 'AiryB', 'AiryBD',
|
| 163 |
+
'alog', 'AnnotationInfo', 'AnnotationList', 'area', 'areaXY', 'asin', 'asinh',
|
| 164 |
+
'atan', 'atanh', 'atan2', 'AxisInfo', 'AxisList', 'AxisValFromPixel', 'Besseli',
|
| 165 |
+
'Besselj', 'Besselk', 'Bessely', 'beta', 'betai', 'BinarySearch',
|
| 166 |
+
'BinarySearchInterp', 'binomial', 'binomialln', 'binomialNoise', 'cabs',
|
| 167 |
+
'CaptureHistory', 'CaptureHistoryStart', 'ceil', 'cequal', 'char2num',
|
| 168 |
+
'chebyshev', 'chebyshevU', 'CheckName', 'ChildWindowList', 'CleanupName', 'cmplx',
|
| 169 |
+
'cmpstr', 'conj', 'ContourInfo', 'ContourNameList', 'ContourNameToWaveRef',
|
| 170 |
+
'ContourZ', 'ControlNameList', 'ConvertTextEncoding', 'cos', 'cosh',
|
| 171 |
+
'cosIntegral', 'cot', 'coth', 'CountObjects', 'CountObjectsDFR', 'cpowi',
|
| 172 |
+
'CreationDate', 'csc', 'csch', 'CsrInfo', 'CsrWave', 'CsrWaveRef', 'CsrXWave',
|
| 173 |
+
'CsrXWaveRef', 'CTabList', 'DataFolderDir', 'DataFolderExists',
|
| 174 |
+
'DataFolderRefsEqual', 'DataFolderRefStatus', 'date', 'datetime', 'DateToJulian',
|
| 175 |
+
'date2secs', 'Dawson', 'DDERequestString', 'defined', 'deltax', 'digamma',
|
| 176 |
+
'dilogarithm', 'DimDelta', 'DimOffset', 'DimSize', 'ei', 'enoise', 'equalWaves',
|
| 177 |
+
'erf', 'erfc', 'erfcw', 'exists', 'exp', 'ExpConvExp', 'ExpConvExpFit',
|
| 178 |
+
'ExpConvExpFitBL', 'ExpConvExpFit1Shape', 'ExpConvExpFit1ShapeBL', 'ExpGauss',
|
| 179 |
+
'ExpGaussFit', 'ExpGaussFitBL', 'ExpGaussFit1Shape', 'ExpGaussFit1ShapeBL',
|
| 180 |
+
'expInt', 'expIntegralE1', 'expNoise', 'factorial', 'fakedata', 'faverage',
|
| 181 |
+
'faverageXY', 'FetchURL', 'FindDimLabel', 'FindListItem', 'floor', 'FontList',
|
| 182 |
+
'FontSizeHeight', 'FontSizeStringWidth', 'FresnelCos', 'FresnelSin',
|
| 183 |
+
'FuncRefInfo', 'FunctionInfo', 'FunctionList', 'FunctionPath', 'gamma',
|
| 184 |
+
'gammaEuler', 'gammaInc', 'gammaNoise', 'gammln', 'gammp', 'gammq', 'Gauss',
|
| 185 |
+
'GaussFit', 'GaussFitBL', 'GaussFit1Width', 'GaussFit1WidthBL', 'Gauss1D',
|
| 186 |
+
'Gauss2D', 'gcd', 'GetBrowserLine', 'GetBrowserSelection', 'GetDataFolder',
|
| 187 |
+
'GetDataFolderDFR', 'GetDefaultFont', 'GetDefaultFontSize', 'GetDefaultFontStyle',
|
| 188 |
+
'GetDimLabel', 'GetEnvironmentVariable', 'GetErrMessage', 'GetFormula',
|
| 189 |
+
'GetIndependentModuleName', 'GetIndexedObjName', 'GetIndexedObjNameDFR',
|
| 190 |
+
'GetKeyState', 'GetRTErrMessage', 'GetRTError', 'GetRTLocation', 'GetRTLocInfo',
|
| 191 |
+
'GetRTStackInfo', 'GetScrapText', 'GetUserData', 'GetWavesDataFolder',
|
| 192 |
+
'GetWavesDataFolderDFR', 'GizmoInfo', 'GizmoScale', 'gnoise', 'GrepList',
|
| 193 |
+
'GrepString', 'GuideInfo', 'GuideNameList', 'Hash', 'hcsr', 'HDF5AttributeInfo',
|
| 194 |
+
'HDF5DatasetInfo', 'HDF5LibraryInfo', 'HDF5TypeInfo', 'hermite', 'hermiteGauss',
|
| 195 |
+
'HyperGNoise', 'HyperGPFQ', 'HyperG0F1', 'HyperG1F1', 'HyperG2F1', 'IgorInfo',
|
| 196 |
+
'IgorVersion', 'imag', 'ImageInfo', 'ImageNameList', 'ImageNameToWaveRef',
|
| 197 |
+
'IndependentModuleList', 'IndexedDir', 'IndexedFile', 'Inf', 'Integrate1D',
|
| 198 |
+
'interp', 'Interp2D', 'Interp3D', 'inverseERF', 'inverseERFC', 'ItemsInList',
|
| 199 |
+
'JacobiCn', 'JacobiSn', 'JulianToDate', 'Laguerre', 'LaguerreA', 'LaguerreGauss',
|
| 200 |
+
'LambertW', 'LayoutInfo', 'leftx', 'LegendreA', 'limit', 'ListMatch',
|
| 201 |
+
'ListToTextWave', 'ListToWaveRefWave', 'ln', 'log', 'logNormalNoise',
|
| 202 |
+
'LorentzianFit', 'LorentzianFitBL', 'LorentzianFit1Width',
|
| 203 |
+
'LorentzianFit1WidthBL', 'lorentzianNoise', 'LowerStr', 'MacroList', 'magsqr',
|
| 204 |
+
'MandelbrotPoint', 'MarcumQ', 'MatrixCondition', 'MatrixDet', 'MatrixDot',
|
| 205 |
+
'MatrixRank', 'MatrixTrace', 'max', 'mean', 'median', 'min', 'mod', 'ModDate',
|
| 206 |
+
'MPFXEMGPeak', 'MPFXExpConvExpPeak', 'MPFXGaussPeak', 'MPFXLorenzianPeak',
|
| 207 |
+
'MPFXVoigtPeak', 'NameOfWave', 'NaN', 'NewFreeDataFolder', 'NewFreeWave', 'norm',
|
| 208 |
+
'NormalizeUnicode', 'note', 'NumberByKey', 'numpnts', 'numtype',
|
| 209 |
+
'NumVarOrDefault', 'num2char', 'num2istr', 'num2str', 'NVAR_Exists',
|
| 210 |
+
'OperationList', 'PadString', 'PanelResolution', 'ParamIsDefault',
|
| 211 |
+
'ParseFilePath', 'PathList', 'pcsr', 'Pi', 'PICTInfo', 'PICTList',
|
| 212 |
+
'PixelFromAxisVal', 'pnt2x', 'poissonNoise', 'poly', 'PolygonArea', 'poly2D',
|
| 213 |
+
'PossiblyQuoteName', 'ProcedureText', 'p2rect', 'qcsr', 'real', 'RemoveByKey',
|
| 214 |
+
'RemoveEnding', 'RemoveFromList', 'RemoveListItem', 'ReplaceNumberByKey',
|
| 215 |
+
'ReplaceString', 'ReplaceStringByKey', 'rightx', 'round', 'r2polar', 'sawtooth',
|
| 216 |
+
'scaleToIndex', 'ScreenResolution', 'sec', 'sech', 'Secs2Date', 'Secs2Time',
|
| 217 |
+
'SelectNumber', 'SelectString', 'SetEnvironmentVariable', 'sign', 'sin', 'sinc',
|
| 218 |
+
'sinh', 'sinIntegral', 'SortList', 'SpecialCharacterInfo', 'SpecialCharacterList',
|
| 219 |
+
'SpecialDirPath', 'SphericalBessJ', 'SphericalBessJD', 'SphericalBessY',
|
| 220 |
+
'SphericalBessYD', 'SphericalHarmonics', 'sqrt', 'StartMSTimer', 'StatsBetaCDF',
|
| 221 |
+
'StatsBetaPDF', 'StatsBinomialCDF', 'StatsBinomialPDF', 'StatsCauchyCDF',
|
| 222 |
+
'StatsCauchyPDF', 'StatsChiCDF', 'StatsChiPDF', 'StatsCMSSDCDF',
|
| 223 |
+
'StatsCorrelation', 'StatsDExpCDF', 'StatsDExpPDF', 'StatsErlangCDF',
|
| 224 |
+
'StatsErlangPDF', 'StatsErrorPDF', 'StatsEValueCDF', 'StatsEValuePDF',
|
| 225 |
+
'StatsExpCDF', 'StatsExpPDF', 'StatsFCDF', 'StatsFPDF', 'StatsFriedmanCDF',
|
| 226 |
+
'StatsGammaCDF', 'StatsGammaPDF', 'StatsGeometricCDF', 'StatsGeometricPDF',
|
| 227 |
+
'StatsGEVCDF', 'StatsGEVPDF', 'StatsHyperGCDF', 'StatsHyperGPDF',
|
| 228 |
+
'StatsInvBetaCDF', 'StatsInvBinomialCDF', 'StatsInvCauchyCDF', 'StatsInvChiCDF',
|
| 229 |
+
'StatsInvCMSSDCDF', 'StatsInvDExpCDF', 'StatsInvEValueCDF', 'StatsInvExpCDF',
|
| 230 |
+
'StatsInvFCDF', 'StatsInvFriedmanCDF', 'StatsInvGammaCDF', 'StatsInvGeometricCDF',
|
| 231 |
+
'StatsInvKuiperCDF', 'StatsInvLogisticCDF', 'StatsInvLogNormalCDF',
|
| 232 |
+
'StatsInvMaxwellCDF', 'StatsInvMooreCDF', 'StatsInvNBinomialCDF',
|
| 233 |
+
'StatsInvNCChiCDF', 'StatsInvNCFCDF', 'StatsInvNormalCDF', 'StatsInvParetoCDF',
|
| 234 |
+
'StatsInvPoissonCDF', 'StatsInvPowerCDF', 'StatsInvQCDF', 'StatsInvQpCDF',
|
| 235 |
+
'StatsInvRayleighCDF', 'StatsInvRectangularCDF', 'StatsInvSpearmanCDF',
|
| 236 |
+
'StatsInvStudentCDF', 'StatsInvTopDownCDF', 'StatsInvTriangularCDF',
|
| 237 |
+
'StatsInvUsquaredCDF', 'StatsInvVonMisesCDF', 'StatsInvWeibullCDF',
|
| 238 |
+
'StatsKuiperCDF', 'StatsLogisticCDF', 'StatsLogisticPDF', 'StatsLogNormalCDF',
|
| 239 |
+
'StatsLogNormalPDF', 'StatsMaxwellCDF', 'StatsMaxwellPDF', 'StatsMedian',
|
| 240 |
+
'StatsMooreCDF', 'StatsNBinomialCDF', 'StatsNBinomialPDF', 'StatsNCChiCDF',
|
| 241 |
+
'StatsNCChiPDF', 'StatsNCFCDF', 'StatsNCFPDF', 'StatsNCTCDF', 'StatsNCTPDF',
|
| 242 |
+
'StatsNormalCDF', 'StatsNormalPDF', 'StatsParetoCDF', 'StatsParetoPDF',
|
| 243 |
+
'StatsPermute', 'StatsPoissonCDF', 'StatsPoissonPDF', 'StatsPowerCDF',
|
| 244 |
+
'StatsPowerNoise', 'StatsPowerPDF', 'StatsQCDF', 'StatsQpCDF', 'StatsRayleighCDF',
|
| 245 |
+
'StatsRayleighPDF', 'StatsRectangularCDF', 'StatsRectangularPDF', 'StatsRunsCDF',
|
| 246 |
+
'StatsSpearmanRhoCDF', 'StatsStudentCDF', 'StatsStudentPDF', 'StatsTopDownCDF',
|
| 247 |
+
'StatsTriangularCDF', 'StatsTriangularPDF', 'StatsTrimmedMean',
|
| 248 |
+
'StatsUSquaredCDF', 'StatsVonMisesCDF', 'StatsVonMisesNoise', 'StatsVonMisesPDF',
|
| 249 |
+
'StatsWaldCDF', 'StatsWaldPDF', 'StatsWeibullCDF', 'StatsWeibullPDF',
|
| 250 |
+
'StopMSTimer', 'StringByKey', 'stringCRC', 'StringFromList', 'StringList',
|
| 251 |
+
'stringmatch', 'strlen', 'strsearch', 'StrVarOrDefault', 'str2num', 'StudentA',
|
| 252 |
+
'StudentT', 'sum', 'SVAR_Exists', 'TableInfo', 'TagVal', 'TagWaveRef', 'tan',
|
| 253 |
+
'tanh', 'TextEncodingCode', 'TextEncodingName', 'TextFile', 'ThreadGroupCreate',
|
| 254 |
+
'ThreadGroupGetDF', 'ThreadGroupGetDFR', 'ThreadGroupRelease', 'ThreadGroupWait',
|
| 255 |
+
'ThreadProcessorCount', 'ThreadReturnValue', 'ticks', 'time', 'TraceFromPixel',
|
| 256 |
+
'TraceInfo', 'TraceNameList', 'TraceNameToWaveRef', 'trunc', 'UniqueName',
|
| 257 |
+
'UnPadString', 'UnsetEnvironmentVariable', 'UpperStr', 'URLDecode', 'URLEncode',
|
| 258 |
+
'VariableList', 'Variance', 'vcsr', 'Voigt', 'VoigtFit', 'VoigtFitBL',
|
| 259 |
+
'VoigtFit1Shape', 'VoigtFit1ShapeBL', 'VoigtFit1Shape1Width',
|
| 260 |
+
'VoigtFit1Shape1WidthBL', 'VoigtFunc', 'WaveCRC', 'WaveDims', 'WaveExists',
|
| 261 |
+
'WaveInfo', 'WaveList', 'WaveMax', 'WaveMin', 'WaveName', 'WaveRefIndexed',
|
| 262 |
+
'WaveRefIndexedDFR', 'WaveRefsEqual', 'WaveRefWaveToList', 'WaveTextEncoding',
|
| 263 |
+
'WaveType', 'WaveUnits', 'WhichListItem', 'WinList', 'WinName', 'WinRecreation',
|
| 264 |
+
'WinType', 'WMFindWholeWord', 'WNoise', 'xcsr', 'XWaveName', 'XWaveRefFromTrace',
|
| 265 |
+
'x2pnt', 'zcsr', 'ZernikeR', 'zeta'
|
| 266 |
+
)
|
| 267 |
+
|
| 268 |
+
tokens = {
|
| 269 |
+
'root': [
|
| 270 |
+
(r'//.*$', Comment.Single),
|
| 271 |
+
(r'"([^"\\]|\\.)*"', String),
|
| 272 |
+
# Flow Control.
|
| 273 |
+
(words(flowControl, prefix=r'\b', suffix=r'\b'), Keyword),
|
| 274 |
+
# Types.
|
| 275 |
+
(words(types, prefix=r'\b', suffix=r'\b'), Keyword.Type),
|
| 276 |
+
# Keywords.
|
| 277 |
+
(words(keywords, prefix=r'\b', suffix=r'\b'), Keyword.Reserved),
|
| 278 |
+
# Built-in operations.
|
| 279 |
+
(words(operations, prefix=r'\b', suffix=r'\b'), Name.Class),
|
| 280 |
+
# Built-in functions.
|
| 281 |
+
(words(functions, prefix=r'\b', suffix=r'\b'), Name.Function),
|
| 282 |
+
# Compiler directives.
|
| 283 |
+
(r'^#(include|pragma|define|undef|ifdef|ifndef|if|elif|else|endif)',
|
| 284 |
+
Name.Decorator),
|
| 285 |
+
(r'[^a-z"/]+$', Text),
|
| 286 |
+
(r'.', Text),
|
| 287 |
+
],
|
| 288 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/inferno.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.inferno
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for Inferno os and all the related stuff.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, include, bygroups, default
|
| 15 |
+
from pygments.token import Punctuation, Text, Comment, Operator, Keyword, \
|
| 16 |
+
Name, String, Number
|
| 17 |
+
|
| 18 |
+
__all__ = ['LimboLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class LimboLexer(RegexLexer):
|
| 22 |
+
"""
|
| 23 |
+
Lexer for `Limbo programming language <http://www.vitanuova.com/inferno/limbo.html>`_
|
| 24 |
+
|
| 25 |
+
TODO:
|
| 26 |
+
- maybe implement better var declaration highlighting
|
| 27 |
+
- some simple syntax error highlighting
|
| 28 |
+
|
| 29 |
+
.. versionadded:: 2.0
|
| 30 |
+
"""
|
| 31 |
+
name = 'Limbo'
|
| 32 |
+
aliases = ['limbo']
|
| 33 |
+
filenames = ['*.b']
|
| 34 |
+
mimetypes = ['text/limbo']
|
| 35 |
+
|
| 36 |
+
tokens = {
|
| 37 |
+
'whitespace': [
|
| 38 |
+
(r'^(\s*)([a-zA-Z_]\w*:(\s*)\n)',
|
| 39 |
+
bygroups(Text, Name.Label)),
|
| 40 |
+
(r'\n', Text),
|
| 41 |
+
(r'\s+', Text),
|
| 42 |
+
(r'#(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
| 43 |
+
],
|
| 44 |
+
'string': [
|
| 45 |
+
(r'"', String, '#pop'),
|
| 46 |
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|'
|
| 47 |
+
r'u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})', String.Escape),
|
| 48 |
+
(r'[^\\"\n]+', String), # all other characters
|
| 49 |
+
(r'\\', String), # stray backslash
|
| 50 |
+
],
|
| 51 |
+
'statements': [
|
| 52 |
+
(r'"', String, 'string'),
|
| 53 |
+
(r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
|
| 54 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float),
|
| 55 |
+
(r'(\d+\.\d*|\.\d+|\d+[fF])', Number.Float),
|
| 56 |
+
(r'16r[0-9a-fA-F]+', Number.Hex),
|
| 57 |
+
(r'8r[0-7]+', Number.Oct),
|
| 58 |
+
(r'((([1-3]\d)|([2-9]))r)?(\d+)', Number.Integer),
|
| 59 |
+
(r'[()\[\],.]', Punctuation),
|
| 60 |
+
(r'[~!%^&*+=|?:<>/-]|(->)|(<-)|(=>)|(::)', Operator),
|
| 61 |
+
(r'(alt|break|case|continue|cyclic|do|else|exit'
|
| 62 |
+
r'for|hd|if|implement|import|include|len|load|or'
|
| 63 |
+
r'pick|return|spawn|tagof|tl|to|while)\b', Keyword),
|
| 64 |
+
(r'(byte|int|big|real|string|array|chan|list|adt'
|
| 65 |
+
r'|fn|ref|of|module|self|type)\b', Keyword.Type),
|
| 66 |
+
(r'(con|iota|nil)\b', Keyword.Constant),
|
| 67 |
+
('[a-zA-Z_]\w*', Name),
|
| 68 |
+
],
|
| 69 |
+
'statement' : [
|
| 70 |
+
include('whitespace'),
|
| 71 |
+
include('statements'),
|
| 72 |
+
('[{}]', Punctuation),
|
| 73 |
+
(';', Punctuation, '#pop'),
|
| 74 |
+
],
|
| 75 |
+
'root': [
|
| 76 |
+
include('whitespace'),
|
| 77 |
+
default('statement'),
|
| 78 |
+
],
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
def analyse_text(text):
|
| 82 |
+
# Any limbo module implements something
|
| 83 |
+
if re.search(r'^implement \w+;', text, re.MULTILINE):
|
| 84 |
+
return 0.7
|
| 85 |
+
|
| 86 |
+
# TODO:
|
| 87 |
+
# - Make lexers for:
|
| 88 |
+
# - asm sources
|
| 89 |
+
# - man pages
|
| 90 |
+
# - mkfiles
|
| 91 |
+
# - module definitions
|
| 92 |
+
# - namespace definitions
|
| 93 |
+
# - shell scripts
|
| 94 |
+
# - maybe keyfiles and fonts
|
| 95 |
+
# they all seem to be quite similar to their equivalents
|
| 96 |
+
# from unix world, so there should not be a lot of problems
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/installers.py
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.installers
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for installer/packager DSLs and formats.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, include, bygroups, using, this, default
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Punctuation, Generic, Number, Whitespace
|
| 17 |
+
|
| 18 |
+
__all__ = ['NSISLexer', 'RPMSpecLexer', 'SourcesListLexer',
|
| 19 |
+
'DebianControlLexer']
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class NSISLexer(RegexLexer):
|
| 23 |
+
"""
|
| 24 |
+
For `NSIS <http://nsis.sourceforge.net/>`_ scripts.
|
| 25 |
+
|
| 26 |
+
.. versionadded:: 1.6
|
| 27 |
+
"""
|
| 28 |
+
name = 'NSIS'
|
| 29 |
+
aliases = ['nsis', 'nsi', 'nsh']
|
| 30 |
+
filenames = ['*.nsi', '*.nsh']
|
| 31 |
+
mimetypes = ['text/x-nsis']
|
| 32 |
+
|
| 33 |
+
flags = re.IGNORECASE
|
| 34 |
+
|
| 35 |
+
tokens = {
|
| 36 |
+
'root': [
|
| 37 |
+
(r'[;#].*\n', Comment),
|
| 38 |
+
(r"'.*?'", String.Single),
|
| 39 |
+
(r'"', String.Double, 'str_double'),
|
| 40 |
+
(r'`', String.Backtick, 'str_backtick'),
|
| 41 |
+
include('macro'),
|
| 42 |
+
include('interpol'),
|
| 43 |
+
include('basic'),
|
| 44 |
+
(r'\$\{[a-z_|][\w|]*\}', Keyword.Pseudo),
|
| 45 |
+
(r'/[a-z_]\w*', Name.Attribute),
|
| 46 |
+
('.', Text),
|
| 47 |
+
],
|
| 48 |
+
'basic': [
|
| 49 |
+
(r'(\n)(Function)(\s+)([._a-z][.\w]*)\b',
|
| 50 |
+
bygroups(Text, Keyword, Text, Name.Function)),
|
| 51 |
+
(r'\b([_a-z]\w*)(::)([a-z][a-z0-9]*)\b',
|
| 52 |
+
bygroups(Keyword.Namespace, Punctuation, Name.Function)),
|
| 53 |
+
(r'\b([_a-z]\w*)(:)', bygroups(Name.Label, Punctuation)),
|
| 54 |
+
(r'(\b[ULS]|\B)([!<>=]?=|\<\>?|\>)\B', Operator),
|
| 55 |
+
(r'[|+-]', Operator),
|
| 56 |
+
(r'\\', Punctuation),
|
| 57 |
+
(r'\b(Abort|Add(?:BrandingImage|Size)|'
|
| 58 |
+
r'Allow(?:RootDirInstall|SkipFiles)|AutoCloseWindow|'
|
| 59 |
+
r'BG(?:Font|Gradient)|BrandingText|BringToFront|Call(?:InstDLL)?|'
|
| 60 |
+
r'(?:Sub)?Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|'
|
| 61 |
+
r'ComponentText|CopyFiles|CRCCheck|'
|
| 62 |
+
r'Create(?:Directory|Font|Shortcut)|Delete(?:INI(?:Sec|Str)|'
|
| 63 |
+
r'Reg(?:Key|Value))?|DetailPrint|DetailsButtonText|'
|
| 64 |
+
r'Dir(?:Show|Text|Var|Verify)|(?:Disabled|Enabled)Bitmap|'
|
| 65 |
+
r'EnableWindow|EnumReg(?:Key|Value)|Exch|Exec(?:Shell|Wait)?|'
|
| 66 |
+
r'ExpandEnvStrings|File(?:BufSize|Close|ErrorText|Open|'
|
| 67 |
+
r'Read(?:Byte)?|Seek|Write(?:Byte)?)?|'
|
| 68 |
+
r'Find(?:Close|First|Next|Window)|FlushINI|Function(?:End)?|'
|
| 69 |
+
r'Get(?:CurInstType|CurrentAddress|DlgItem|DLLVersion(?:Local)?|'
|
| 70 |
+
r'ErrorLevel|FileTime(?:Local)?|FullPathName|FunctionAddress|'
|
| 71 |
+
r'InstDirError|LabelAddress|TempFileName)|'
|
| 72 |
+
r'Goto|HideWindow|Icon|'
|
| 73 |
+
r'If(?:Abort|Errors|FileExists|RebootFlag|Silent)|'
|
| 74 |
+
r'InitPluginsDir|Install(?:ButtonText|Colors|Dir(?:RegKey)?)|'
|
| 75 |
+
r'Inst(?:ProgressFlags|Type(?:[GS]etText)?)|Int(?:CmpU?|Fmt|Op)|'
|
| 76 |
+
r'IsWindow|LangString(?:UP)?|'
|
| 77 |
+
r'License(?:BkColor|Data|ForceSelection|LangString|Text)|'
|
| 78 |
+
r'LoadLanguageFile|LockWindow|Log(?:Set|Text)|MessageBox|'
|
| 79 |
+
r'MiscButtonText|Name|Nop|OutFile|(?:Uninst)?Page(?:Ex(?:End)?)?|'
|
| 80 |
+
r'PluginDir|Pop|Push|Quit|Read(?:(?:Env|INI|Reg)Str|RegDWORD)|'
|
| 81 |
+
r'Reboot|(?:Un)?RegDLL|Rename|RequestExecutionLevel|ReserveFile|'
|
| 82 |
+
r'Return|RMDir|SearchPath|Section(?:Divider|End|'
|
| 83 |
+
r'(?:(?:Get|Set)(?:Flags|InstTypes|Size|Text))|Group(?:End)?|In)?|'
|
| 84 |
+
r'SendMessage|Set(?:AutoClose|BrandingImage|Compress(?:ionLevel|'
|
| 85 |
+
r'or(?:DictSize)?)?|CtlColors|CurInstType|DatablockOptimize|'
|
| 86 |
+
r'DateSave|Details(?:Print|View)|Error(?:s|Level)|FileAttributes|'
|
| 87 |
+
r'Font|OutPath|Overwrite|PluginUnload|RebootFlag|ShellVarContext|'
|
| 88 |
+
r'Silent|StaticBkColor)|'
|
| 89 |
+
r'Show(?:(?:I|Uni)nstDetails|Window)|Silent(?:Un)?Install|Sleep|'
|
| 90 |
+
r'SpaceTexts|Str(?:CmpS?|Cpy|Len)|SubSection(?:End)?|'
|
| 91 |
+
r'Uninstall(?:ButtonText|(?:Sub)?Caption|EXEName|Icon|Text)|'
|
| 92 |
+
r'UninstPage|Var|VI(?:AddVersionKey|ProductVersion)|WindowIcon|'
|
| 93 |
+
r'Write(?:INIStr|Reg(:?Bin|DWORD|(?:Expand)?Str)|Uninstaller)|'
|
| 94 |
+
r'XPStyle)\b', Keyword),
|
| 95 |
+
(r'\b(CUR|END|(?:FILE_ATTRIBUTE_)?'
|
| 96 |
+
r'(?:ARCHIVE|HIDDEN|NORMAL|OFFLINE|READONLY|SYSTEM|TEMPORARY)|'
|
| 97 |
+
r'HK(CC|CR|CU|DD|LM|PD|U)|'
|
| 98 |
+
r'HKEY_(?:CLASSES_ROOT|CURRENT_(?:CONFIG|USER)|DYN_DATA|'
|
| 99 |
+
r'LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|'
|
| 100 |
+
r'ID(?:ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|'
|
| 101 |
+
r'MB_(?:ABORTRETRYIGNORE|DEFBUTTON[1-4]|'
|
| 102 |
+
r'ICON(?:EXCLAMATION|INFORMATION|QUESTION|STOP)|'
|
| 103 |
+
r'OK(?:CANCEL)?|RETRYCANCEL|RIGHT|SETFOREGROUND|TOPMOST|USERICON|'
|
| 104 |
+
r'YESNO(?:CANCEL)?)|SET|SHCTX|'
|
| 105 |
+
r'SW_(?:HIDE|SHOW(?:MAXIMIZED|MINIMIZED|NORMAL))|'
|
| 106 |
+
r'admin|all|auto|both|bottom|bzip2|checkbox|colored|current|false|'
|
| 107 |
+
r'force|hide|highest|if(?:diff|newer)|lastused|leave|left|'
|
| 108 |
+
r'listonly|lzma|nevershow|none|normal|off|on|pop|push|'
|
| 109 |
+
r'radiobuttons|right|show|silent|silentlog|smooth|textonly|top|'
|
| 110 |
+
r'true|try|user|zlib)\b', Name.Constant),
|
| 111 |
+
],
|
| 112 |
+
'macro': [
|
| 113 |
+
(r'\!(addincludedir(?:dir)?|addplugindir|appendfile|cd|define|'
|
| 114 |
+
r'delfilefile|echo(?:message)?|else|endif|error|execute|'
|
| 115 |
+
r'if(?:macro)?n?(?:def)?|include|insertmacro|macro(?:end)?|packhdr|'
|
| 116 |
+
r'search(?:parse|replace)|system|tempfilesymbol|undef|verbose|'
|
| 117 |
+
r'warning)\b', Comment.Preproc),
|
| 118 |
+
],
|
| 119 |
+
'interpol': [
|
| 120 |
+
(r'\$(R?[0-9])', Name.Builtin.Pseudo), # registers
|
| 121 |
+
(r'\$(ADMINTOOLS|APPDATA|CDBURN_AREA|COOKIES|COMMONFILES(?:32|64)|'
|
| 122 |
+
r'DESKTOP|DOCUMENTS|EXE(?:DIR|FILE|PATH)|FAVORITES|FONTS|HISTORY|'
|
| 123 |
+
r'HWNDPARENT|INTERNET_CACHE|LOCALAPPDATA|MUSIC|NETHOOD|PICTURES|'
|
| 124 |
+
r'PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES(?:32|64)|QUICKLAUNCH|'
|
| 125 |
+
r'RECENT|RESOURCES(?:_LOCALIZED)?|SENDTO|SM(?:PROGRAMS|STARTUP)|'
|
| 126 |
+
r'STARTMENU|SYSDIR|TEMP(?:LATES)?|VIDEOS|WINDIR|\{NSISDIR\})',
|
| 127 |
+
Name.Builtin),
|
| 128 |
+
(r'\$(CMDLINE|INSTDIR|OUTDIR|LANGUAGE)', Name.Variable.Global),
|
| 129 |
+
(r'\$[a-z_]\w*', Name.Variable),
|
| 130 |
+
],
|
| 131 |
+
'str_double': [
|
| 132 |
+
(r'"', String, '#pop'),
|
| 133 |
+
(r'\$(\\[nrt"]|\$)', String.Escape),
|
| 134 |
+
include('interpol'),
|
| 135 |
+
(r'.', String.Double),
|
| 136 |
+
],
|
| 137 |
+
'str_backtick': [
|
| 138 |
+
(r'`', String, '#pop'),
|
| 139 |
+
(r'\$(\\[nrt"]|\$)', String.Escape),
|
| 140 |
+
include('interpol'),
|
| 141 |
+
(r'.', String.Double),
|
| 142 |
+
],
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
class RPMSpecLexer(RegexLexer):
|
| 147 |
+
"""
|
| 148 |
+
For RPM ``.spec`` files.
|
| 149 |
+
|
| 150 |
+
.. versionadded:: 1.6
|
| 151 |
+
"""
|
| 152 |
+
|
| 153 |
+
name = 'RPMSpec'
|
| 154 |
+
aliases = ['spec']
|
| 155 |
+
filenames = ['*.spec']
|
| 156 |
+
mimetypes = ['text/x-rpm-spec']
|
| 157 |
+
|
| 158 |
+
_directives = ('(?:package|prep|build|install|clean|check|pre[a-z]*|'
|
| 159 |
+
'post[a-z]*|trigger[a-z]*|files)')
|
| 160 |
+
|
| 161 |
+
tokens = {
|
| 162 |
+
'root': [
|
| 163 |
+
(r'#.*\n', Comment),
|
| 164 |
+
include('basic'),
|
| 165 |
+
],
|
| 166 |
+
'description': [
|
| 167 |
+
(r'^(%' + _directives + ')(.*)$',
|
| 168 |
+
bygroups(Name.Decorator, Text), '#pop'),
|
| 169 |
+
(r'\n', Text),
|
| 170 |
+
(r'.', Text),
|
| 171 |
+
],
|
| 172 |
+
'changelog': [
|
| 173 |
+
(r'\*.*\n', Generic.Subheading),
|
| 174 |
+
(r'^(%' + _directives + ')(.*)$',
|
| 175 |
+
bygroups(Name.Decorator, Text), '#pop'),
|
| 176 |
+
(r'\n', Text),
|
| 177 |
+
(r'.', Text),
|
| 178 |
+
],
|
| 179 |
+
'string': [
|
| 180 |
+
(r'"', String.Double, '#pop'),
|
| 181 |
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
| 182 |
+
include('interpol'),
|
| 183 |
+
(r'.', String.Double),
|
| 184 |
+
],
|
| 185 |
+
'basic': [
|
| 186 |
+
include('macro'),
|
| 187 |
+
(r'(?i)^(Name|Version|Release|Epoch|Summary|Group|License|Packager|'
|
| 188 |
+
r'Vendor|Icon|URL|Distribution|Prefix|Patch[0-9]*|Source[0-9]*|'
|
| 189 |
+
r'Requires\(?[a-z]*\)?|[a-z]+Req|Obsoletes|Suggests|Provides|Conflicts|'
|
| 190 |
+
r'Build[a-z]+|[a-z]+Arch|Auto[a-z]+)(:)(.*)$',
|
| 191 |
+
bygroups(Generic.Heading, Punctuation, using(this))),
|
| 192 |
+
(r'^%description', Name.Decorator, 'description'),
|
| 193 |
+
(r'^%changelog', Name.Decorator, 'changelog'),
|
| 194 |
+
(r'^(%' + _directives + ')(.*)$', bygroups(Name.Decorator, Text)),
|
| 195 |
+
(r'%(attr|defattr|dir|doc(?:dir)?|setup|config(?:ure)?|'
|
| 196 |
+
r'make(?:install)|ghost|patch[0-9]+|find_lang|exclude|verify)',
|
| 197 |
+
Keyword),
|
| 198 |
+
include('interpol'),
|
| 199 |
+
(r"'.*?'", String.Single),
|
| 200 |
+
(r'"', String.Double, 'string'),
|
| 201 |
+
(r'.', Text),
|
| 202 |
+
],
|
| 203 |
+
'macro': [
|
| 204 |
+
(r'%define.*\n', Comment.Preproc),
|
| 205 |
+
(r'%\{\!\?.*%define.*\}', Comment.Preproc),
|
| 206 |
+
(r'(%(?:if(?:n?arch)?|else(?:if)?|endif))(.*)$',
|
| 207 |
+
bygroups(Comment.Preproc, Text)),
|
| 208 |
+
],
|
| 209 |
+
'interpol': [
|
| 210 |
+
(r'%\{?__[a-z_]+\}?', Name.Function),
|
| 211 |
+
(r'%\{?_([a-z_]+dir|[a-z_]+path|prefix)\}?', Keyword.Pseudo),
|
| 212 |
+
(r'%\{\?\w+\}', Name.Variable),
|
| 213 |
+
(r'\$\{?RPM_[A-Z0-9_]+\}?', Name.Variable.Global),
|
| 214 |
+
(r'%\{[a-zA-Z]\w+\}', Keyword.Constant),
|
| 215 |
+
]
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
class SourcesListLexer(RegexLexer):
|
| 220 |
+
"""
|
| 221 |
+
Lexer that highlights debian sources.list files.
|
| 222 |
+
|
| 223 |
+
.. versionadded:: 0.7
|
| 224 |
+
"""
|
| 225 |
+
|
| 226 |
+
name = 'Debian Sourcelist'
|
| 227 |
+
aliases = ['sourceslist', 'sources.list', 'debsources']
|
| 228 |
+
filenames = ['sources.list']
|
| 229 |
+
mimetype = ['application/x-debian-sourceslist']
|
| 230 |
+
|
| 231 |
+
tokens = {
|
| 232 |
+
'root': [
|
| 233 |
+
(r'\s+', Text),
|
| 234 |
+
(r'#.*?$', Comment),
|
| 235 |
+
(r'^(deb(?:-src)?)(\s+)',
|
| 236 |
+
bygroups(Keyword, Text), 'distribution')
|
| 237 |
+
],
|
| 238 |
+
'distribution': [
|
| 239 |
+
(r'#.*?$', Comment, '#pop'),
|
| 240 |
+
(r'\$\(ARCH\)', Name.Variable),
|
| 241 |
+
(r'[^\s$[]+', String),
|
| 242 |
+
(r'\[', String.Other, 'escaped-distribution'),
|
| 243 |
+
(r'\$', String),
|
| 244 |
+
(r'\s+', Text, 'components')
|
| 245 |
+
],
|
| 246 |
+
'escaped-distribution': [
|
| 247 |
+
(r'\]', String.Other, '#pop'),
|
| 248 |
+
(r'\$\(ARCH\)', Name.Variable),
|
| 249 |
+
(r'[^\]$]+', String.Other),
|
| 250 |
+
(r'\$', String.Other)
|
| 251 |
+
],
|
| 252 |
+
'components': [
|
| 253 |
+
(r'#.*?$', Comment, '#pop:2'),
|
| 254 |
+
(r'$', Text, '#pop:2'),
|
| 255 |
+
(r'\s+', Text),
|
| 256 |
+
(r'\S+', Keyword.Pseudo),
|
| 257 |
+
]
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
def analyse_text(text):
|
| 261 |
+
for line in text.splitlines():
|
| 262 |
+
line = line.strip()
|
| 263 |
+
if line.startswith('deb ') or line.startswith('deb-src '):
|
| 264 |
+
return True
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
class DebianControlLexer(RegexLexer):
|
| 268 |
+
"""
|
| 269 |
+
Lexer for Debian ``control`` files and ``apt-cache show <pkg>`` outputs.
|
| 270 |
+
|
| 271 |
+
.. versionadded:: 0.9
|
| 272 |
+
"""
|
| 273 |
+
name = 'Debian Control file'
|
| 274 |
+
aliases = ['control', 'debcontrol']
|
| 275 |
+
filenames = ['control']
|
| 276 |
+
|
| 277 |
+
tokens = {
|
| 278 |
+
'root': [
|
| 279 |
+
(r'^(Description)', Keyword, 'description'),
|
| 280 |
+
(r'^(Maintainer)(:\s*)', bygroups(Keyword, Text), 'maintainer'),
|
| 281 |
+
(r'^((Build-)?Depends)', Keyword, 'depends'),
|
| 282 |
+
(r'^((?:Python-)?Version)(:\s*)(\S+)$',
|
| 283 |
+
bygroups(Keyword, Text, Number)),
|
| 284 |
+
(r'^((?:Installed-)?Size)(:\s*)(\S+)$',
|
| 285 |
+
bygroups(Keyword, Text, Number)),
|
| 286 |
+
(r'^(MD5Sum|SHA1|SHA256)(:\s*)(\S+)$',
|
| 287 |
+
bygroups(Keyword, Text, Number)),
|
| 288 |
+
(r'^([a-zA-Z\-0-9\.]*?)(:\s*)(.*?)$',
|
| 289 |
+
bygroups(Keyword, Whitespace, String)),
|
| 290 |
+
],
|
| 291 |
+
'maintainer': [
|
| 292 |
+
(r'<[^>]+>', Generic.Strong),
|
| 293 |
+
(r'<[^>]+>$', Generic.Strong, '#pop'),
|
| 294 |
+
(r',\n?', Text),
|
| 295 |
+
(r'.', Text),
|
| 296 |
+
],
|
| 297 |
+
'description': [
|
| 298 |
+
(r'(.*)(Homepage)(: )(\S+)',
|
| 299 |
+
bygroups(Text, String, Name, Name.Class)),
|
| 300 |
+
(r':.*\n', Generic.Strong),
|
| 301 |
+
(r' .*\n', Text),
|
| 302 |
+
default('#pop'),
|
| 303 |
+
],
|
| 304 |
+
'depends': [
|
| 305 |
+
(r':\s*', Text),
|
| 306 |
+
(r'(\$)(\{)(\w+\s*:\s*\w+)', bygroups(Operator, Text, Name.Entity)),
|
| 307 |
+
(r'\(', Text, 'depend_vers'),
|
| 308 |
+
(r',', Text),
|
| 309 |
+
(r'\|', Operator),
|
| 310 |
+
(r'[\s]+', Text),
|
| 311 |
+
(r'[})]\s*$', Text, '#pop'),
|
| 312 |
+
(r'\}', Text),
|
| 313 |
+
(r'[^,]$', Name.Function, '#pop'),
|
| 314 |
+
(r'([+.a-zA-Z0-9-])(\s*)', bygroups(Name.Function, Text)),
|
| 315 |
+
(r'\[.*?\]', Name.Entity),
|
| 316 |
+
],
|
| 317 |
+
'depend_vers': [
|
| 318 |
+
(r'\),', Text, '#pop'),
|
| 319 |
+
(r'\)[^,]', Text, '#pop:2'),
|
| 320 |
+
(r'([><=]+)(\s*)([^)]+)', bygroups(Operator, Text, Number))
|
| 321 |
+
]
|
| 322 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/int_fiction.py
ADDED
|
@@ -0,0 +1,1343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.int_fiction
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for interactive fiction languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, include, bygroups, using, \
|
| 15 |
+
this, default, words
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Number, Punctuation, Error, Generic
|
| 18 |
+
|
| 19 |
+
__all__ = ['Inform6Lexer', 'Inform6TemplateLexer', 'Inform7Lexer',
|
| 20 |
+
'Tads3Lexer']
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class Inform6Lexer(RegexLexer):
|
| 24 |
+
"""
|
| 25 |
+
For `Inform 6 <http://inform-fiction.org/>`_ source code.
|
| 26 |
+
|
| 27 |
+
.. versionadded:: 2.0
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
name = 'Inform 6'
|
| 31 |
+
aliases = ['inform6', 'i6']
|
| 32 |
+
filenames = ['*.inf']
|
| 33 |
+
|
| 34 |
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
| 35 |
+
|
| 36 |
+
_name = r'[a-zA-Z_]\w*'
|
| 37 |
+
|
| 38 |
+
# Inform 7 maps these four character classes to their ASCII
|
| 39 |
+
# equivalents. To support Inform 6 inclusions within Inform 7,
|
| 40 |
+
# Inform6Lexer maps them too.
|
| 41 |
+
_dash = u'\\-\u2010-\u2014'
|
| 42 |
+
_dquote = u'"\u201c\u201d'
|
| 43 |
+
_squote = u"'\u2018\u2019"
|
| 44 |
+
_newline = u'\\n\u0085\u2028\u2029'
|
| 45 |
+
|
| 46 |
+
tokens = {
|
| 47 |
+
'root': [
|
| 48 |
+
(r'\A(!%%[^%s]*[%s])+' % (_newline, _newline), Comment.Preproc,
|
| 49 |
+
'directive'),
|
| 50 |
+
default('directive')
|
| 51 |
+
],
|
| 52 |
+
'_whitespace': [
|
| 53 |
+
(r'\s+', Text),
|
| 54 |
+
(r'![^%s]*' % _newline, Comment.Single)
|
| 55 |
+
],
|
| 56 |
+
'default': [
|
| 57 |
+
include('_whitespace'),
|
| 58 |
+
(r'\[', Punctuation, 'many-values'), # Array initialization
|
| 59 |
+
(r':|(?=;)', Punctuation, '#pop'),
|
| 60 |
+
(r'<', Punctuation), # Second angle bracket in an action statement
|
| 61 |
+
default(('expression', '_expression'))
|
| 62 |
+
],
|
| 63 |
+
|
| 64 |
+
# Expressions
|
| 65 |
+
'_expression': [
|
| 66 |
+
include('_whitespace'),
|
| 67 |
+
(r'(?=sp\b)', Text, '#pop'),
|
| 68 |
+
(r'(?=[%s%s$0-9#a-zA-Z_])' % (_dquote, _squote), Text,
|
| 69 |
+
('#pop', 'value')),
|
| 70 |
+
(r'\+\+|[%s]{1,2}(?!>)|~~?' % _dash, Operator),
|
| 71 |
+
(r'(?=[()\[%s,?@{:;])' % _dash, Text, '#pop')
|
| 72 |
+
],
|
| 73 |
+
'expression': [
|
| 74 |
+
include('_whitespace'),
|
| 75 |
+
(r'\(', Punctuation, ('expression', '_expression')),
|
| 76 |
+
(r'\)', Punctuation, '#pop'),
|
| 77 |
+
(r'\[', Punctuation, ('#pop', 'statements', 'locals')),
|
| 78 |
+
(r'>(?=(\s+|(![^%s]*))*[>;])' % _newline, Punctuation),
|
| 79 |
+
(r'\+\+|[%s]{2}(?!>)' % _dash, Operator),
|
| 80 |
+
(r',', Punctuation, '_expression'),
|
| 81 |
+
(r'&&?|\|\|?|[=~><]?=|[%s]{1,2}>?|\.\.?[&#]?|::|[<>+*/%%]' % _dash,
|
| 82 |
+
Operator, '_expression'),
|
| 83 |
+
(r'(has|hasnt|in|notin|ofclass|or|provides)\b', Operator.Word,
|
| 84 |
+
'_expression'),
|
| 85 |
+
(r'sp\b', Name),
|
| 86 |
+
(r'\?~?', Name.Label, 'label?'),
|
| 87 |
+
(r'[@{]', Error),
|
| 88 |
+
default('#pop')
|
| 89 |
+
],
|
| 90 |
+
'_assembly-expression': [
|
| 91 |
+
(r'\(', Punctuation, ('#push', '_expression')),
|
| 92 |
+
(r'[\[\]]', Punctuation),
|
| 93 |
+
(r'[%s]>' % _dash, Punctuation, '_expression'),
|
| 94 |
+
(r'sp\b', Keyword.Pseudo),
|
| 95 |
+
(r';', Punctuation, '#pop:3'),
|
| 96 |
+
include('expression')
|
| 97 |
+
],
|
| 98 |
+
'_for-expression': [
|
| 99 |
+
(r'\)', Punctuation, '#pop:2'),
|
| 100 |
+
(r':', Punctuation, '#pop'),
|
| 101 |
+
include('expression')
|
| 102 |
+
],
|
| 103 |
+
'_keyword-expression': [
|
| 104 |
+
(r'(from|near|to)\b', Keyword, '_expression'),
|
| 105 |
+
include('expression')
|
| 106 |
+
],
|
| 107 |
+
'_list-expression': [
|
| 108 |
+
(r',', Punctuation, '#pop'),
|
| 109 |
+
include('expression')
|
| 110 |
+
],
|
| 111 |
+
'_object-expression': [
|
| 112 |
+
(r'has\b', Keyword.Declaration, '#pop'),
|
| 113 |
+
include('_list-expression')
|
| 114 |
+
],
|
| 115 |
+
|
| 116 |
+
# Values
|
| 117 |
+
'value': [
|
| 118 |
+
include('_whitespace'),
|
| 119 |
+
# Strings
|
| 120 |
+
(r'[%s][^@][%s]' % (_squote, _squote), String.Char, '#pop'),
|
| 121 |
+
(r'([%s])(@\{[0-9a-fA-F]{1,4}\})([%s])' % (_squote, _squote),
|
| 122 |
+
bygroups(String.Char, String.Escape, String.Char), '#pop'),
|
| 123 |
+
(r'([%s])(@.{2})([%s])' % (_squote, _squote),
|
| 124 |
+
bygroups(String.Char, String.Escape, String.Char), '#pop'),
|
| 125 |
+
(r'[%s]' % _squote, String.Single, ('#pop', 'dictionary-word')),
|
| 126 |
+
(r'[%s]' % _dquote, String.Double, ('#pop', 'string')),
|
| 127 |
+
# Numbers
|
| 128 |
+
(r'\$[+%s][0-9]*\.?[0-9]*([eE][+%s]?[0-9]+)?' % (_dash, _dash),
|
| 129 |
+
Number.Float, '#pop'),
|
| 130 |
+
(r'\$[0-9a-fA-F]+', Number.Hex, '#pop'),
|
| 131 |
+
(r'\$\$[01]+', Number.Bin, '#pop'),
|
| 132 |
+
(r'[0-9]+', Number.Integer, '#pop'),
|
| 133 |
+
# Values prefixed by hashes
|
| 134 |
+
(r'(##|#a\$)(%s)' % _name, bygroups(Operator, Name), '#pop'),
|
| 135 |
+
(r'(#g\$)(%s)' % _name,
|
| 136 |
+
bygroups(Operator, Name.Variable.Global), '#pop'),
|
| 137 |
+
(r'#[nw]\$', Operator, ('#pop', 'obsolete-dictionary-word')),
|
| 138 |
+
(r'(#r\$)(%s)' % _name, bygroups(Operator, Name.Function), '#pop'),
|
| 139 |
+
(r'#', Name.Builtin, ('#pop', 'system-constant')),
|
| 140 |
+
# System functions
|
| 141 |
+
(words((
|
| 142 |
+
'child', 'children', 'elder', 'eldest', 'glk', 'indirect', 'metaclass',
|
| 143 |
+
'parent', 'random', 'sibling', 'younger', 'youngest'), suffix=r'\b'),
|
| 144 |
+
Name.Builtin, '#pop'),
|
| 145 |
+
# Metaclasses
|
| 146 |
+
(r'(?i)(Class|Object|Routine|String)\b', Name.Builtin, '#pop'),
|
| 147 |
+
# Veneer routines
|
| 148 |
+
(words((
|
| 149 |
+
'Box__Routine', 'CA__Pr', 'CDefArt', 'CInDefArt', 'Cl__Ms',
|
| 150 |
+
'Copy__Primitive', 'CP__Tab', 'DA__Pr', 'DB__Pr', 'DefArt', 'Dynam__String',
|
| 151 |
+
'EnglishNumber', 'Glk__Wrap', 'IA__Pr', 'IB__Pr', 'InDefArt', 'Main__',
|
| 152 |
+
'Meta__class', 'OB__Move', 'OB__Remove', 'OC__Cl', 'OP__Pr', 'Print__Addr',
|
| 153 |
+
'Print__PName', 'PrintShortName', 'RA__Pr', 'RA__Sc', 'RL__Pr', 'R_Process',
|
| 154 |
+
'RT__ChG', 'RT__ChGt', 'RT__ChLDB', 'RT__ChLDW', 'RT__ChPR', 'RT__ChPrintA',
|
| 155 |
+
'RT__ChPrintC', 'RT__ChPrintO', 'RT__ChPrintS', 'RT__ChPS', 'RT__ChR',
|
| 156 |
+
'RT__ChSTB', 'RT__ChSTW', 'RT__ChT', 'RT__Err', 'RT__TrPS', 'RV__Pr',
|
| 157 |
+
'Symb__Tab', 'Unsigned__Compare', 'WV__Pr', 'Z__Region'),
|
| 158 |
+
prefix='(?i)', suffix=r'\b'),
|
| 159 |
+
Name.Builtin, '#pop'),
|
| 160 |
+
# Other built-in symbols
|
| 161 |
+
(words((
|
| 162 |
+
'call', 'copy', 'create', 'DEBUG', 'destroy', 'DICT_CHAR_SIZE',
|
| 163 |
+
'DICT_ENTRY_BYTES', 'DICT_IS_UNICODE', 'DICT_WORD_SIZE', 'false',
|
| 164 |
+
'FLOAT_INFINITY', 'FLOAT_NAN', 'FLOAT_NINFINITY', 'GOBJFIELD_CHAIN',
|
| 165 |
+
'GOBJFIELD_CHILD', 'GOBJFIELD_NAME', 'GOBJFIELD_PARENT',
|
| 166 |
+
'GOBJFIELD_PROPTAB', 'GOBJFIELD_SIBLING', 'GOBJ_EXT_START',
|
| 167 |
+
'GOBJ_TOTAL_LENGTH', 'Grammar__Version', 'INDIV_PROP_START', 'INFIX',
|
| 168 |
+
'infix__watching', 'MODULE_MODE', 'name', 'nothing', 'NUM_ATTR_BYTES', 'print',
|
| 169 |
+
'print_to_array', 'recreate', 'remaining', 'self', 'sender', 'STRICT_MODE',
|
| 170 |
+
'sw__var', 'sys__glob0', 'sys__glob1', 'sys__glob2', 'sys_statusline_flag',
|
| 171 |
+
'TARGET_GLULX', 'TARGET_ZCODE', 'temp__global2', 'temp__global3',
|
| 172 |
+
'temp__global4', 'temp_global', 'true', 'USE_MODULES', 'WORDSIZE'),
|
| 173 |
+
prefix='(?i)', suffix=r'\b'),
|
| 174 |
+
Name.Builtin, '#pop'),
|
| 175 |
+
# Other values
|
| 176 |
+
(_name, Name, '#pop')
|
| 177 |
+
],
|
| 178 |
+
# Strings
|
| 179 |
+
'dictionary-word': [
|
| 180 |
+
(r'[~^]+', String.Escape),
|
| 181 |
+
(r'[^~^\\@({%s]+' % _squote, String.Single),
|
| 182 |
+
(r'[({]', String.Single),
|
| 183 |
+
(r'@\{[0-9a-fA-F]{,4}\}', String.Escape),
|
| 184 |
+
(r'@.{2}', String.Escape),
|
| 185 |
+
(r'[%s]' % _squote, String.Single, '#pop')
|
| 186 |
+
],
|
| 187 |
+
'string': [
|
| 188 |
+
(r'[~^]+', String.Escape),
|
| 189 |
+
(r'[^~^\\@({%s]+' % _dquote, String.Double),
|
| 190 |
+
(r'[({]', String.Double),
|
| 191 |
+
(r'\\', String.Escape),
|
| 192 |
+
(r'@(\\\s*[%s]\s*)*@((\\\s*[%s]\s*)*[0-9])*' %
|
| 193 |
+
(_newline, _newline), String.Escape),
|
| 194 |
+
(r'@(\\\s*[%s]\s*)*\{((\\\s*[%s]\s*)*[0-9a-fA-F]){,4}'
|
| 195 |
+
r'(\\\s*[%s]\s*)*\}' % (_newline, _newline, _newline),
|
| 196 |
+
String.Escape),
|
| 197 |
+
(r'@(\\\s*[%s]\s*)*.(\\\s*[%s]\s*)*.' % (_newline, _newline),
|
| 198 |
+
String.Escape),
|
| 199 |
+
(r'[%s]' % _dquote, String.Double, '#pop')
|
| 200 |
+
],
|
| 201 |
+
'plain-string': [
|
| 202 |
+
(r'[^~^\\({\[\]%s]+' % _dquote, String.Double),
|
| 203 |
+
(r'[~^({\[\]]', String.Double),
|
| 204 |
+
(r'\\', String.Escape),
|
| 205 |
+
(r'[%s]' % _dquote, String.Double, '#pop')
|
| 206 |
+
],
|
| 207 |
+
# Names
|
| 208 |
+
'_constant': [
|
| 209 |
+
include('_whitespace'),
|
| 210 |
+
(_name, Name.Constant, '#pop'),
|
| 211 |
+
include('value')
|
| 212 |
+
],
|
| 213 |
+
'_global': [
|
| 214 |
+
include('_whitespace'),
|
| 215 |
+
(_name, Name.Variable.Global, '#pop'),
|
| 216 |
+
include('value')
|
| 217 |
+
],
|
| 218 |
+
'label?': [
|
| 219 |
+
include('_whitespace'),
|
| 220 |
+
(_name, Name.Label, '#pop'),
|
| 221 |
+
default('#pop')
|
| 222 |
+
],
|
| 223 |
+
'variable?': [
|
| 224 |
+
include('_whitespace'),
|
| 225 |
+
(_name, Name.Variable, '#pop'),
|
| 226 |
+
default('#pop')
|
| 227 |
+
],
|
| 228 |
+
# Values after hashes
|
| 229 |
+
'obsolete-dictionary-word': [
|
| 230 |
+
(r'\S\w*', String.Other, '#pop')
|
| 231 |
+
],
|
| 232 |
+
'system-constant': [
|
| 233 |
+
include('_whitespace'),
|
| 234 |
+
(_name, Name.Builtin, '#pop')
|
| 235 |
+
],
|
| 236 |
+
|
| 237 |
+
# Directives
|
| 238 |
+
'directive': [
|
| 239 |
+
include('_whitespace'),
|
| 240 |
+
(r'#', Punctuation),
|
| 241 |
+
(r';', Punctuation, '#pop'),
|
| 242 |
+
(r'\[', Punctuation,
|
| 243 |
+
('default', 'statements', 'locals', 'routine-name?')),
|
| 244 |
+
(words((
|
| 245 |
+
'abbreviate', 'endif', 'dictionary', 'ifdef', 'iffalse', 'ifndef', 'ifnot',
|
| 246 |
+
'iftrue', 'ifv3', 'ifv5', 'release', 'serial', 'switches', 'system_file',
|
| 247 |
+
'version'), prefix='(?i)', suffix=r'\b'),
|
| 248 |
+
Keyword, 'default'),
|
| 249 |
+
(r'(?i)(array|global)\b', Keyword,
|
| 250 |
+
('default', 'directive-keyword?', '_global')),
|
| 251 |
+
(r'(?i)attribute\b', Keyword, ('default', 'alias?', '_constant')),
|
| 252 |
+
(r'(?i)class\b', Keyword,
|
| 253 |
+
('object-body', 'duplicates', 'class-name')),
|
| 254 |
+
(r'(?i)(constant|default)\b', Keyword,
|
| 255 |
+
('default', 'expression', '_constant')),
|
| 256 |
+
(r'(?i)(end\b)(.*)', bygroups(Keyword, Text)),
|
| 257 |
+
(r'(?i)(extend|verb)\b', Keyword, 'grammar'),
|
| 258 |
+
(r'(?i)fake_action\b', Keyword, ('default', '_constant')),
|
| 259 |
+
(r'(?i)import\b', Keyword, 'manifest'),
|
| 260 |
+
(r'(?i)(include|link)\b', Keyword,
|
| 261 |
+
('default', 'before-plain-string')),
|
| 262 |
+
(r'(?i)(lowstring|undef)\b', Keyword, ('default', '_constant')),
|
| 263 |
+
(r'(?i)message\b', Keyword, ('default', 'diagnostic')),
|
| 264 |
+
(r'(?i)(nearby|object)\b', Keyword,
|
| 265 |
+
('object-body', '_object-head')),
|
| 266 |
+
(r'(?i)property\b', Keyword,
|
| 267 |
+
('default', 'alias?', '_constant', 'property-keyword*')),
|
| 268 |
+
(r'(?i)replace\b', Keyword,
|
| 269 |
+
('default', 'routine-name?', 'routine-name?')),
|
| 270 |
+
(r'(?i)statusline\b', Keyword, ('default', 'directive-keyword?')),
|
| 271 |
+
(r'(?i)stub\b', Keyword, ('default', 'routine-name?')),
|
| 272 |
+
(r'(?i)trace\b', Keyword,
|
| 273 |
+
('default', 'trace-keyword?', 'trace-keyword?')),
|
| 274 |
+
(r'(?i)zcharacter\b', Keyword,
|
| 275 |
+
('default', 'directive-keyword?', 'directive-keyword?')),
|
| 276 |
+
(_name, Name.Class, ('object-body', '_object-head'))
|
| 277 |
+
],
|
| 278 |
+
# [, Replace, Stub
|
| 279 |
+
'routine-name?': [
|
| 280 |
+
include('_whitespace'),
|
| 281 |
+
(_name, Name.Function, '#pop'),
|
| 282 |
+
default('#pop')
|
| 283 |
+
],
|
| 284 |
+
'locals': [
|
| 285 |
+
include('_whitespace'),
|
| 286 |
+
(r';', Punctuation, '#pop'),
|
| 287 |
+
(r'\*', Punctuation),
|
| 288 |
+
(r'"', String.Double, 'plain-string'),
|
| 289 |
+
(_name, Name.Variable)
|
| 290 |
+
],
|
| 291 |
+
# Array
|
| 292 |
+
'many-values': [
|
| 293 |
+
include('_whitespace'),
|
| 294 |
+
(r';', Punctuation),
|
| 295 |
+
(r'\]', Punctuation, '#pop'),
|
| 296 |
+
(r':', Error),
|
| 297 |
+
default(('expression', '_expression'))
|
| 298 |
+
],
|
| 299 |
+
# Attribute, Property
|
| 300 |
+
'alias?': [
|
| 301 |
+
include('_whitespace'),
|
| 302 |
+
(r'alias\b', Keyword, ('#pop', '_constant')),
|
| 303 |
+
default('#pop')
|
| 304 |
+
],
|
| 305 |
+
# Class, Object, Nearby
|
| 306 |
+
'class-name': [
|
| 307 |
+
include('_whitespace'),
|
| 308 |
+
(r'(?=[,;]|(class|has|private|with)\b)', Text, '#pop'),
|
| 309 |
+
(_name, Name.Class, '#pop')
|
| 310 |
+
],
|
| 311 |
+
'duplicates': [
|
| 312 |
+
include('_whitespace'),
|
| 313 |
+
(r'\(', Punctuation, ('#pop', 'expression', '_expression')),
|
| 314 |
+
default('#pop')
|
| 315 |
+
],
|
| 316 |
+
'_object-head': [
|
| 317 |
+
(r'[%s]>' % _dash, Punctuation),
|
| 318 |
+
(r'(class|has|private|with)\b', Keyword.Declaration, '#pop'),
|
| 319 |
+
include('_global')
|
| 320 |
+
],
|
| 321 |
+
'object-body': [
|
| 322 |
+
include('_whitespace'),
|
| 323 |
+
(r';', Punctuation, '#pop:2'),
|
| 324 |
+
(r',', Punctuation),
|
| 325 |
+
(r'class\b', Keyword.Declaration, 'class-segment'),
|
| 326 |
+
(r'(has|private|with)\b', Keyword.Declaration),
|
| 327 |
+
(r':', Error),
|
| 328 |
+
default(('_object-expression', '_expression'))
|
| 329 |
+
],
|
| 330 |
+
'class-segment': [
|
| 331 |
+
include('_whitespace'),
|
| 332 |
+
(r'(?=[,;]|(class|has|private|with)\b)', Text, '#pop'),
|
| 333 |
+
(_name, Name.Class),
|
| 334 |
+
default('value')
|
| 335 |
+
],
|
| 336 |
+
# Extend, Verb
|
| 337 |
+
'grammar': [
|
| 338 |
+
include('_whitespace'),
|
| 339 |
+
(r'=', Punctuation, ('#pop', 'default')),
|
| 340 |
+
(r'\*', Punctuation, ('#pop', 'grammar-line')),
|
| 341 |
+
default('_directive-keyword')
|
| 342 |
+
],
|
| 343 |
+
'grammar-line': [
|
| 344 |
+
include('_whitespace'),
|
| 345 |
+
(r';', Punctuation, '#pop'),
|
| 346 |
+
(r'[/*]', Punctuation),
|
| 347 |
+
(r'[%s]>' % _dash, Punctuation, 'value'),
|
| 348 |
+
(r'(noun|scope)\b', Keyword, '=routine'),
|
| 349 |
+
default('_directive-keyword')
|
| 350 |
+
],
|
| 351 |
+
'=routine': [
|
| 352 |
+
include('_whitespace'),
|
| 353 |
+
(r'=', Punctuation, 'routine-name?'),
|
| 354 |
+
default('#pop')
|
| 355 |
+
],
|
| 356 |
+
# Import
|
| 357 |
+
'manifest': [
|
| 358 |
+
include('_whitespace'),
|
| 359 |
+
(r';', Punctuation, '#pop'),
|
| 360 |
+
(r',', Punctuation),
|
| 361 |
+
(r'(?i)global\b', Keyword, '_global'),
|
| 362 |
+
default('_global')
|
| 363 |
+
],
|
| 364 |
+
# Include, Link, Message
|
| 365 |
+
'diagnostic': [
|
| 366 |
+
include('_whitespace'),
|
| 367 |
+
(r'[%s]' % _dquote, String.Double, ('#pop', 'message-string')),
|
| 368 |
+
default(('#pop', 'before-plain-string', 'directive-keyword?'))
|
| 369 |
+
],
|
| 370 |
+
'before-plain-string': [
|
| 371 |
+
include('_whitespace'),
|
| 372 |
+
(r'[%s]' % _dquote, String.Double, ('#pop', 'plain-string'))
|
| 373 |
+
],
|
| 374 |
+
'message-string': [
|
| 375 |
+
(r'[~^]+', String.Escape),
|
| 376 |
+
include('plain-string')
|
| 377 |
+
],
|
| 378 |
+
|
| 379 |
+
# Keywords used in directives
|
| 380 |
+
'_directive-keyword!': [
|
| 381 |
+
include('_whitespace'),
|
| 382 |
+
(words((
|
| 383 |
+
'additive', 'alias', 'buffer', 'class', 'creature', 'data', 'error', 'fatalerror',
|
| 384 |
+
'first', 'has', 'held', 'initial', 'initstr', 'last', 'long', 'meta', 'multi',
|
| 385 |
+
'multiexcept', 'multiheld', 'multiinside', 'noun', 'number', 'only', 'private',
|
| 386 |
+
'replace', 'reverse', 'scope', 'score', 'special', 'string', 'table', 'terminating',
|
| 387 |
+
'time', 'topic', 'warning', 'with'), suffix=r'\b'),
|
| 388 |
+
Keyword, '#pop'),
|
| 389 |
+
(r'[%s]{1,2}>|[+=]' % _dash, Punctuation, '#pop')
|
| 390 |
+
],
|
| 391 |
+
'_directive-keyword': [
|
| 392 |
+
include('_directive-keyword!'),
|
| 393 |
+
include('value')
|
| 394 |
+
],
|
| 395 |
+
'directive-keyword?': [
|
| 396 |
+
include('_directive-keyword!'),
|
| 397 |
+
default('#pop')
|
| 398 |
+
],
|
| 399 |
+
'property-keyword*': [
|
| 400 |
+
include('_whitespace'),
|
| 401 |
+
(r'(additive|long)\b', Keyword),
|
| 402 |
+
default('#pop')
|
| 403 |
+
],
|
| 404 |
+
'trace-keyword?': [
|
| 405 |
+
include('_whitespace'),
|
| 406 |
+
(words((
|
| 407 |
+
'assembly', 'dictionary', 'expressions', 'lines', 'linker',
|
| 408 |
+
'objects', 'off', 'on', 'symbols', 'tokens', 'verbs'), suffix=r'\b'),
|
| 409 |
+
Keyword, '#pop'),
|
| 410 |
+
default('#pop')
|
| 411 |
+
],
|
| 412 |
+
|
| 413 |
+
# Statements
|
| 414 |
+
'statements': [
|
| 415 |
+
include('_whitespace'),
|
| 416 |
+
(r'\]', Punctuation, '#pop'),
|
| 417 |
+
(r'[;{}]', Punctuation),
|
| 418 |
+
(words((
|
| 419 |
+
'box', 'break', 'continue', 'default', 'give', 'inversion',
|
| 420 |
+
'new_line', 'quit', 'read', 'remove', 'return', 'rfalse', 'rtrue',
|
| 421 |
+
'spaces', 'string', 'until'), suffix=r'\b'),
|
| 422 |
+
Keyword, 'default'),
|
| 423 |
+
(r'(do|else)\b', Keyword),
|
| 424 |
+
(r'(font|style)\b', Keyword,
|
| 425 |
+
('default', 'miscellaneous-keyword?')),
|
| 426 |
+
(r'for\b', Keyword, ('for', '(?')),
|
| 427 |
+
(r'(if|switch|while)', Keyword,
|
| 428 |
+
('expression', '_expression', '(?')),
|
| 429 |
+
(r'(jump|save|restore)\b', Keyword, ('default', 'label?')),
|
| 430 |
+
(r'objectloop\b', Keyword,
|
| 431 |
+
('_keyword-expression', 'variable?', '(?')),
|
| 432 |
+
(r'print(_ret)?\b|(?=[%s])' % _dquote, Keyword, 'print-list'),
|
| 433 |
+
(r'\.', Name.Label, 'label?'),
|
| 434 |
+
(r'@', Keyword, 'opcode'),
|
| 435 |
+
(r'#(?![agrnw]\$|#)', Punctuation, 'directive'),
|
| 436 |
+
(r'<', Punctuation, 'default'),
|
| 437 |
+
(r'move\b', Keyword,
|
| 438 |
+
('default', '_keyword-expression', '_expression')),
|
| 439 |
+
default(('default', '_keyword-expression', '_expression'))
|
| 440 |
+
],
|
| 441 |
+
'miscellaneous-keyword?': [
|
| 442 |
+
include('_whitespace'),
|
| 443 |
+
(r'(bold|fixed|from|near|off|on|reverse|roman|to|underline)\b',
|
| 444 |
+
Keyword, '#pop'),
|
| 445 |
+
(r'(a|A|an|address|char|name|number|object|property|string|the|'
|
| 446 |
+
r'The)\b(?=(\s+|(![^%s]*))*\))' % _newline, Keyword.Pseudo,
|
| 447 |
+
'#pop'),
|
| 448 |
+
(r'%s(?=(\s+|(![^%s]*))*\))' % (_name, _newline), Name.Function,
|
| 449 |
+
'#pop'),
|
| 450 |
+
default('#pop')
|
| 451 |
+
],
|
| 452 |
+
'(?': [
|
| 453 |
+
include('_whitespace'),
|
| 454 |
+
(r'\(', Punctuation, '#pop'),
|
| 455 |
+
default('#pop')
|
| 456 |
+
],
|
| 457 |
+
'for': [
|
| 458 |
+
include('_whitespace'),
|
| 459 |
+
(r';', Punctuation, ('_for-expression', '_expression')),
|
| 460 |
+
default(('_for-expression', '_expression'))
|
| 461 |
+
],
|
| 462 |
+
'print-list': [
|
| 463 |
+
include('_whitespace'),
|
| 464 |
+
(r';', Punctuation, '#pop'),
|
| 465 |
+
(r':', Error),
|
| 466 |
+
default(('_list-expression', '_expression', '_list-expression', 'form'))
|
| 467 |
+
],
|
| 468 |
+
'form': [
|
| 469 |
+
include('_whitespace'),
|
| 470 |
+
(r'\(', Punctuation, ('#pop', 'miscellaneous-keyword?')),
|
| 471 |
+
default('#pop')
|
| 472 |
+
],
|
| 473 |
+
|
| 474 |
+
# Assembly
|
| 475 |
+
'opcode': [
|
| 476 |
+
include('_whitespace'),
|
| 477 |
+
(r'[%s]' % _dquote, String.Double, ('operands', 'plain-string')),
|
| 478 |
+
(_name, Keyword, 'operands')
|
| 479 |
+
],
|
| 480 |
+
'operands': [
|
| 481 |
+
(r':', Error),
|
| 482 |
+
default(('_assembly-expression', '_expression'))
|
| 483 |
+
]
|
| 484 |
+
}
|
| 485 |
+
|
| 486 |
+
def get_tokens_unprocessed(self, text):
|
| 487 |
+
# 'in' is either a keyword or an operator.
|
| 488 |
+
# If the token two tokens after 'in' is ')', 'in' is a keyword:
|
| 489 |
+
# objectloop(a in b)
|
| 490 |
+
# Otherwise, it is an operator:
|
| 491 |
+
# objectloop(a in b && true)
|
| 492 |
+
objectloop_queue = []
|
| 493 |
+
objectloop_token_count = -1
|
| 494 |
+
previous_token = None
|
| 495 |
+
for index, token, value in RegexLexer.get_tokens_unprocessed(self,
|
| 496 |
+
text):
|
| 497 |
+
if previous_token is Name.Variable and value == 'in':
|
| 498 |
+
objectloop_queue = [[index, token, value]]
|
| 499 |
+
objectloop_token_count = 2
|
| 500 |
+
elif objectloop_token_count > 0:
|
| 501 |
+
if token not in Comment and token not in Text:
|
| 502 |
+
objectloop_token_count -= 1
|
| 503 |
+
objectloop_queue.append((index, token, value))
|
| 504 |
+
else:
|
| 505 |
+
if objectloop_token_count == 0:
|
| 506 |
+
if objectloop_queue[-1][2] == ')':
|
| 507 |
+
objectloop_queue[0][1] = Keyword
|
| 508 |
+
while objectloop_queue:
|
| 509 |
+
yield objectloop_queue.pop(0)
|
| 510 |
+
objectloop_token_count = -1
|
| 511 |
+
yield index, token, value
|
| 512 |
+
if token not in Comment and token not in Text:
|
| 513 |
+
previous_token = token
|
| 514 |
+
while objectloop_queue:
|
| 515 |
+
yield objectloop_queue.pop(0)
|
| 516 |
+
|
| 517 |
+
|
| 518 |
+
class Inform7Lexer(RegexLexer):
|
| 519 |
+
"""
|
| 520 |
+
For `Inform 7 <http://inform7.com/>`_ source code.
|
| 521 |
+
|
| 522 |
+
.. versionadded:: 2.0
|
| 523 |
+
"""
|
| 524 |
+
|
| 525 |
+
name = 'Inform 7'
|
| 526 |
+
aliases = ['inform7', 'i7']
|
| 527 |
+
filenames = ['*.ni', '*.i7x']
|
| 528 |
+
|
| 529 |
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
| 530 |
+
|
| 531 |
+
_dash = Inform6Lexer._dash
|
| 532 |
+
_dquote = Inform6Lexer._dquote
|
| 533 |
+
_newline = Inform6Lexer._newline
|
| 534 |
+
_start = r'\A|(?<=[%s])' % _newline
|
| 535 |
+
|
| 536 |
+
# There are three variants of Inform 7, differing in how to
|
| 537 |
+
# interpret at signs and braces in I6T. In top-level inclusions, at
|
| 538 |
+
# signs in the first column are inweb syntax. In phrase definitions
|
| 539 |
+
# and use options, tokens in braces are treated as I7. Use options
|
| 540 |
+
# also interpret "{N}".
|
| 541 |
+
tokens = {}
|
| 542 |
+
token_variants = ['+i6t-not-inline', '+i6t-inline', '+i6t-use-option']
|
| 543 |
+
|
| 544 |
+
for level in token_variants:
|
| 545 |
+
tokens[level] = {
|
| 546 |
+
'+i6-root': list(Inform6Lexer.tokens['root']),
|
| 547 |
+
'+i6t-root': [ # For Inform6TemplateLexer
|
| 548 |
+
(r'[^%s]*' % Inform6Lexer._newline, Comment.Preproc,
|
| 549 |
+
('directive', '+p'))
|
| 550 |
+
],
|
| 551 |
+
'root': [
|
| 552 |
+
(r'(\|?\s)+', Text),
|
| 553 |
+
(r'\[', Comment.Multiline, '+comment'),
|
| 554 |
+
(r'[%s]' % _dquote, Generic.Heading,
|
| 555 |
+
('+main', '+titling', '+titling-string')),
|
| 556 |
+
default(('+main', '+heading?'))
|
| 557 |
+
],
|
| 558 |
+
'+titling-string': [
|
| 559 |
+
(r'[^%s]+' % _dquote, Generic.Heading),
|
| 560 |
+
(r'[%s]' % _dquote, Generic.Heading, '#pop')
|
| 561 |
+
],
|
| 562 |
+
'+titling': [
|
| 563 |
+
(r'\[', Comment.Multiline, '+comment'),
|
| 564 |
+
(r'[^%s.;:|%s]+' % (_dquote, _newline), Generic.Heading),
|
| 565 |
+
(r'[%s]' % _dquote, Generic.Heading, '+titling-string'),
|
| 566 |
+
(r'[%s]{2}|(?<=[\s%s])\|[\s%s]' % (_newline, _dquote, _dquote),
|
| 567 |
+
Text, ('#pop', '+heading?')),
|
| 568 |
+
(r'[.;:]|(?<=[\s%s])\|' % _dquote, Text, '#pop'),
|
| 569 |
+
(r'[|%s]' % _newline, Generic.Heading)
|
| 570 |
+
],
|
| 571 |
+
'+main': [
|
| 572 |
+
(r'(?i)[^%s:a\[(|%s]+' % (_dquote, _newline), Text),
|
| 573 |
+
(r'[%s]' % _dquote, String.Double, '+text'),
|
| 574 |
+
(r':', Text, '+phrase-definition'),
|
| 575 |
+
(r'(?i)\bas\b', Text, '+use-option'),
|
| 576 |
+
(r'\[', Comment.Multiline, '+comment'),
|
| 577 |
+
(r'(\([%s])(.*?)([%s]\))' % (_dash, _dash),
|
| 578 |
+
bygroups(Punctuation,
|
| 579 |
+
using(this, state=('+i6-root', 'directive'),
|
| 580 |
+
i6t='+i6t-not-inline'), Punctuation)),
|
| 581 |
+
(r'(%s|(?<=[\s;:.%s]))\|\s|[%s]{2,}' %
|
| 582 |
+
(_start, _dquote, _newline), Text, '+heading?'),
|
| 583 |
+
(r'(?i)[a(|%s]' % _newline, Text)
|
| 584 |
+
],
|
| 585 |
+
'+phrase-definition': [
|
| 586 |
+
(r'\s+', Text),
|
| 587 |
+
(r'\[', Comment.Multiline, '+comment'),
|
| 588 |
+
(r'(\([%s])(.*?)([%s]\))' % (_dash, _dash),
|
| 589 |
+
bygroups(Punctuation,
|
| 590 |
+
using(this, state=('+i6-root', 'directive',
|
| 591 |
+
'default', 'statements'),
|
| 592 |
+
i6t='+i6t-inline'), Punctuation), '#pop'),
|
| 593 |
+
default('#pop')
|
| 594 |
+
],
|
| 595 |
+
'+use-option': [
|
| 596 |
+
(r'\s+', Text),
|
| 597 |
+
(r'\[', Comment.Multiline, '+comment'),
|
| 598 |
+
(r'(\([%s])(.*?)([%s]\))' % (_dash, _dash),
|
| 599 |
+
bygroups(Punctuation,
|
| 600 |
+
using(this, state=('+i6-root', 'directive'),
|
| 601 |
+
i6t='+i6t-use-option'), Punctuation), '#pop'),
|
| 602 |
+
default('#pop')
|
| 603 |
+
],
|
| 604 |
+
'+comment': [
|
| 605 |
+
(r'[^\[\]]+', Comment.Multiline),
|
| 606 |
+
(r'\[', Comment.Multiline, '#push'),
|
| 607 |
+
(r'\]', Comment.Multiline, '#pop')
|
| 608 |
+
],
|
| 609 |
+
'+text': [
|
| 610 |
+
(r'[^\[%s]+' % _dquote, String.Double),
|
| 611 |
+
(r'\[.*?\]', String.Interpol),
|
| 612 |
+
(r'[%s]' % _dquote, String.Double, '#pop')
|
| 613 |
+
],
|
| 614 |
+
'+heading?': [
|
| 615 |
+
(r'(\|?\s)+', Text),
|
| 616 |
+
(r'\[', Comment.Multiline, '+comment'),
|
| 617 |
+
(r'[%s]{4}\s+' % _dash, Text, '+documentation-heading'),
|
| 618 |
+
(r'[%s]{1,3}' % _dash, Text),
|
| 619 |
+
(r'(?i)(volume|book|part|chapter|section)\b[^%s]*' % _newline,
|
| 620 |
+
Generic.Heading, '#pop'),
|
| 621 |
+
default('#pop')
|
| 622 |
+
],
|
| 623 |
+
'+documentation-heading': [
|
| 624 |
+
(r'\s+', Text),
|
| 625 |
+
(r'\[', Comment.Multiline, '+comment'),
|
| 626 |
+
(r'(?i)documentation\s+', Text, '+documentation-heading2'),
|
| 627 |
+
default('#pop')
|
| 628 |
+
],
|
| 629 |
+
'+documentation-heading2': [
|
| 630 |
+
(r'\s+', Text),
|
| 631 |
+
(r'\[', Comment.Multiline, '+comment'),
|
| 632 |
+
(r'[%s]{4}\s' % _dash, Text, '+documentation'),
|
| 633 |
+
default('#pop:2')
|
| 634 |
+
],
|
| 635 |
+
'+documentation': [
|
| 636 |
+
(r'(?i)(%s)\s*(chapter|example)\s*:[^%s]*' %
|
| 637 |
+
(_start, _newline), Generic.Heading),
|
| 638 |
+
(r'(?i)(%s)\s*section\s*:[^%s]*' % (_start, _newline),
|
| 639 |
+
Generic.Subheading),
|
| 640 |
+
(r'((%s)\t.*?[%s])+' % (_start, _newline),
|
| 641 |
+
using(this, state='+main')),
|
| 642 |
+
(r'[^%s\[]+|[%s\[]' % (_newline, _newline), Text),
|
| 643 |
+
(r'\[', Comment.Multiline, '+comment'),
|
| 644 |
+
],
|
| 645 |
+
'+i6t-not-inline': [
|
| 646 |
+
(r'(%s)@c( .*?)?([%s]|\Z)' % (_start, _newline),
|
| 647 |
+
Comment.Preproc),
|
| 648 |
+
(r'(%s)@([%s]+|Purpose:)[^%s]*' % (_start, _dash, _newline),
|
| 649 |
+
Comment.Preproc),
|
| 650 |
+
(r'(%s)@p( .*?)?([%s]|\Z)' % (_start, _newline),
|
| 651 |
+
Generic.Heading, '+p')
|
| 652 |
+
],
|
| 653 |
+
'+i6t-use-option': [
|
| 654 |
+
include('+i6t-not-inline'),
|
| 655 |
+
(r'(\{)(N)(\})', bygroups(Punctuation, Text, Punctuation))
|
| 656 |
+
],
|
| 657 |
+
'+i6t-inline': [
|
| 658 |
+
(r'(\{)(\S[^}]*)?(\})',
|
| 659 |
+
bygroups(Punctuation, using(this, state='+main'),
|
| 660 |
+
Punctuation))
|
| 661 |
+
],
|
| 662 |
+
'+i6t': [
|
| 663 |
+
(r'(\{[%s])(![^}]*)(\}?)' % _dash,
|
| 664 |
+
bygroups(Punctuation, Comment.Single, Punctuation)),
|
| 665 |
+
(r'(\{[%s])(lines)(:)([^}]*)(\}?)' % _dash,
|
| 666 |
+
bygroups(Punctuation, Keyword, Punctuation, Text,
|
| 667 |
+
Punctuation), '+lines'),
|
| 668 |
+
(r'(\{[%s])([^:}]*)(:?)([^}]*)(\}?)' % _dash,
|
| 669 |
+
bygroups(Punctuation, Keyword, Punctuation, Text,
|
| 670 |
+
Punctuation)),
|
| 671 |
+
(r'(\(\+)(.*?)(\+\)|\Z)',
|
| 672 |
+
bygroups(Punctuation, using(this, state='+main'),
|
| 673 |
+
Punctuation))
|
| 674 |
+
],
|
| 675 |
+
'+p': [
|
| 676 |
+
(r'[^@]+', Comment.Preproc),
|
| 677 |
+
(r'(%s)@c( .*?)?([%s]|\Z)' % (_start, _newline),
|
| 678 |
+
Comment.Preproc, '#pop'),
|
| 679 |
+
(r'(%s)@([%s]|Purpose:)' % (_start, _dash), Comment.Preproc),
|
| 680 |
+
(r'(%s)@p( .*?)?([%s]|\Z)' % (_start, _newline),
|
| 681 |
+
Generic.Heading),
|
| 682 |
+
(r'@', Comment.Preproc)
|
| 683 |
+
],
|
| 684 |
+
'+lines': [
|
| 685 |
+
(r'(%s)@c( .*?)?([%s]|\Z)' % (_start, _newline),
|
| 686 |
+
Comment.Preproc),
|
| 687 |
+
(r'(%s)@([%s]|Purpose:)[^%s]*' % (_start, _dash, _newline),
|
| 688 |
+
Comment.Preproc),
|
| 689 |
+
(r'(%s)@p( .*?)?([%s]|\Z)' % (_start, _newline),
|
| 690 |
+
Generic.Heading, '+p'),
|
| 691 |
+
(r'(%s)@\w*[ %s]' % (_start, _newline), Keyword),
|
| 692 |
+
(r'![^%s]*' % _newline, Comment.Single),
|
| 693 |
+
(r'(\{)([%s]endlines)(\})' % _dash,
|
| 694 |
+
bygroups(Punctuation, Keyword, Punctuation), '#pop'),
|
| 695 |
+
(r'[^@!{]+?([%s]|\Z)|.' % _newline, Text)
|
| 696 |
+
]
|
| 697 |
+
}
|
| 698 |
+
# Inform 7 can include snippets of Inform 6 template language,
|
| 699 |
+
# so all of Inform6Lexer's states are copied here, with
|
| 700 |
+
# modifications to account for template syntax. Inform7Lexer's
|
| 701 |
+
# own states begin with '+' to avoid name conflicts. Some of
|
| 702 |
+
# Inform6Lexer's states begin with '_': these are not modified.
|
| 703 |
+
# They deal with template syntax either by including modified
|
| 704 |
+
# states, or by matching r'' then pushing to modified states.
|
| 705 |
+
for token in Inform6Lexer.tokens:
|
| 706 |
+
if token == 'root':
|
| 707 |
+
continue
|
| 708 |
+
tokens[level][token] = list(Inform6Lexer.tokens[token])
|
| 709 |
+
if not token.startswith('_'):
|
| 710 |
+
tokens[level][token][:0] = [include('+i6t'), include(level)]
|
| 711 |
+
|
| 712 |
+
def __init__(self, **options):
|
| 713 |
+
level = options.get('i6t', '+i6t-not-inline')
|
| 714 |
+
if level not in self._all_tokens:
|
| 715 |
+
self._tokens = self.__class__.process_tokendef(level)
|
| 716 |
+
else:
|
| 717 |
+
self._tokens = self._all_tokens[level]
|
| 718 |
+
RegexLexer.__init__(self, **options)
|
| 719 |
+
|
| 720 |
+
|
| 721 |
+
class Inform6TemplateLexer(Inform7Lexer):
|
| 722 |
+
"""
|
| 723 |
+
For `Inform 6 template
|
| 724 |
+
<http://inform7.com/sources/src/i6template/Woven/index.html>`_ code.
|
| 725 |
+
|
| 726 |
+
.. versionadded:: 2.0
|
| 727 |
+
"""
|
| 728 |
+
|
| 729 |
+
name = 'Inform 6 template'
|
| 730 |
+
aliases = ['i6t']
|
| 731 |
+
filenames = ['*.i6t']
|
| 732 |
+
|
| 733 |
+
def get_tokens_unprocessed(self, text, stack=('+i6t-root',)):
|
| 734 |
+
return Inform7Lexer.get_tokens_unprocessed(self, text, stack)
|
| 735 |
+
|
| 736 |
+
|
| 737 |
+
class Tads3Lexer(RegexLexer):
|
| 738 |
+
"""
|
| 739 |
+
For `TADS 3 <http://www.tads.org/>`_ source code.
|
| 740 |
+
"""
|
| 741 |
+
|
| 742 |
+
name = 'TADS 3'
|
| 743 |
+
aliases = ['tads3']
|
| 744 |
+
filenames = ['*.t']
|
| 745 |
+
|
| 746 |
+
flags = re.DOTALL | re.MULTILINE
|
| 747 |
+
|
| 748 |
+
_comment_single = r'(?://(?:[^\\\n]|\\+[\w\W])*$)'
|
| 749 |
+
_comment_multiline = r'(?:/\*(?:[^*]|\*(?!/))*\*/)'
|
| 750 |
+
_escape = (r'(?:\\(?:[\n\\<>"\'^v bnrt]|u[\da-fA-F]{,4}|x[\da-fA-F]{,2}|'
|
| 751 |
+
r'[0-3]?[0-7]{1,2}))')
|
| 752 |
+
_name = r'(?:[_a-zA-Z]\w*)'
|
| 753 |
+
_no_quote = r'(?=\s|\\?>)'
|
| 754 |
+
_operator = (r'(?:&&|\|\||\+\+|--|\?\?|::|[.,@\[\]~]|'
|
| 755 |
+
r'(?:[=+\-*/%!&|^]|<<?|>>?>?)=?)')
|
| 756 |
+
_ws = r'(?:\\|\s|%s|%s)' % (_comment_single, _comment_multiline)
|
| 757 |
+
_ws_pp = r'(?:\\\n|[^\S\n]|%s|%s)' % (_comment_single, _comment_multiline)
|
| 758 |
+
|
| 759 |
+
def _make_string_state(triple, double, verbatim=None, _escape=_escape):
|
| 760 |
+
if verbatim:
|
| 761 |
+
verbatim = ''.join(['(?:%s|%s)' % (re.escape(c.lower()),
|
| 762 |
+
re.escape(c.upper()))
|
| 763 |
+
for c in verbatim])
|
| 764 |
+
char = r'"' if double else r"'"
|
| 765 |
+
token = String.Double if double else String.Single
|
| 766 |
+
escaped_quotes = r'+|%s(?!%s{2})' % (char, char) if triple else r''
|
| 767 |
+
prefix = '%s%s' % ('t' if triple else '', 'd' if double else 's')
|
| 768 |
+
tag_state_name = '%sqt' % prefix
|
| 769 |
+
state = []
|
| 770 |
+
if triple:
|
| 771 |
+
state += [
|
| 772 |
+
(r'%s{3,}' % char, token, '#pop'),
|
| 773 |
+
(r'\\%s+' % char, String.Escape),
|
| 774 |
+
(char, token)
|
| 775 |
+
]
|
| 776 |
+
else:
|
| 777 |
+
state.append((char, token, '#pop'))
|
| 778 |
+
state += [
|
| 779 |
+
include('s/verbatim'),
|
| 780 |
+
(r'[^\\<&{}%s]+' % char, token)
|
| 781 |
+
]
|
| 782 |
+
if verbatim:
|
| 783 |
+
# This regex can't use `(?i)` because escape sequences are
|
| 784 |
+
# case-sensitive. `<\XMP>` works; `<\xmp>` doesn't.
|
| 785 |
+
state.append((r'\\?<(/|\\\\|(?!%s)\\)%s(?=[\s=>])' %
|
| 786 |
+
(_escape, verbatim),
|
| 787 |
+
Name.Tag, ('#pop', '%sqs' % prefix, tag_state_name)))
|
| 788 |
+
else:
|
| 789 |
+
state += [
|
| 790 |
+
(r'\\?<!([^><\\%s]|<(?!<)|\\%s%s|%s|\\.)*>?' %
|
| 791 |
+
(char, char, escaped_quotes, _escape), Comment.Multiline),
|
| 792 |
+
(r'(?i)\\?<listing(?=[\s=>]|\\>)', Name.Tag,
|
| 793 |
+
('#pop', '%sqs/listing' % prefix, tag_state_name)),
|
| 794 |
+
(r'(?i)\\?<xmp(?=[\s=>]|\\>)', Name.Tag,
|
| 795 |
+
('#pop', '%sqs/xmp' % prefix, tag_state_name)),
|
| 796 |
+
(r'\\?<([^\s=><\\%s]|<(?!<)|\\%s%s|%s|\\.)*' %
|
| 797 |
+
(char, char, escaped_quotes, _escape), Name.Tag,
|
| 798 |
+
tag_state_name),
|
| 799 |
+
include('s/entity')
|
| 800 |
+
]
|
| 801 |
+
state += [
|
| 802 |
+
include('s/escape'),
|
| 803 |
+
(r'\{([^}<\\%s]|<(?!<)|\\%s%s|%s|\\.)*\}' %
|
| 804 |
+
(char, char, escaped_quotes, _escape), String.Interpol),
|
| 805 |
+
(r'[\\&{}<]', token)
|
| 806 |
+
]
|
| 807 |
+
return state
|
| 808 |
+
|
| 809 |
+
def _make_tag_state(triple, double, _escape=_escape):
|
| 810 |
+
char = r'"' if double else r"'"
|
| 811 |
+
quantifier = r'{3,}' if triple else r''
|
| 812 |
+
state_name = '%s%sqt' % ('t' if triple else '', 'd' if double else 's')
|
| 813 |
+
token = String.Double if double else String.Single
|
| 814 |
+
escaped_quotes = r'+|%s(?!%s{2})' % (char, char) if triple else r''
|
| 815 |
+
return [
|
| 816 |
+
(r'%s%s' % (char, quantifier), token, '#pop:2'),
|
| 817 |
+
(r'(\s|\\\n)+', Text),
|
| 818 |
+
(r'(=)(\\?")', bygroups(Punctuation, String.Double),
|
| 819 |
+
'dqs/%s' % state_name),
|
| 820 |
+
(r"(=)(\\?')", bygroups(Punctuation, String.Single),
|
| 821 |
+
'sqs/%s' % state_name),
|
| 822 |
+
(r'=', Punctuation, 'uqs/%s' % state_name),
|
| 823 |
+
(r'\\?>', Name.Tag, '#pop'),
|
| 824 |
+
(r'\{([^}<\\%s]|<(?!<)|\\%s%s|%s|\\.)*\}' %
|
| 825 |
+
(char, char, escaped_quotes, _escape), String.Interpol),
|
| 826 |
+
(r'([^\s=><\\%s]|<(?!<)|\\%s%s|%s|\\.)+' %
|
| 827 |
+
(char, char, escaped_quotes, _escape), Name.Attribute),
|
| 828 |
+
include('s/escape'),
|
| 829 |
+
include('s/verbatim'),
|
| 830 |
+
include('s/entity'),
|
| 831 |
+
(r'[\\{}&]', Name.Attribute)
|
| 832 |
+
]
|
| 833 |
+
|
| 834 |
+
def _make_attribute_value_state(terminator, host_triple, host_double,
|
| 835 |
+
_escape=_escape):
|
| 836 |
+
token = (String.Double if terminator == r'"' else
|
| 837 |
+
String.Single if terminator == r"'" else String.Other)
|
| 838 |
+
host_char = r'"' if host_double else r"'"
|
| 839 |
+
host_quantifier = r'{3,}' if host_triple else r''
|
| 840 |
+
host_token = String.Double if host_double else String.Single
|
| 841 |
+
escaped_quotes = (r'+|%s(?!%s{2})' % (host_char, host_char)
|
| 842 |
+
if host_triple else r'')
|
| 843 |
+
return [
|
| 844 |
+
(r'%s%s' % (host_char, host_quantifier), host_token, '#pop:3'),
|
| 845 |
+
(r'%s%s' % (r'' if token is String.Other else r'\\?', terminator),
|
| 846 |
+
token, '#pop'),
|
| 847 |
+
include('s/verbatim'),
|
| 848 |
+
include('s/entity'),
|
| 849 |
+
(r'\{([^}<\\%s]|<(?!<)|\\%s%s|%s|\\.)*\}' %
|
| 850 |
+
(host_char, host_char, escaped_quotes, _escape), String.Interpol),
|
| 851 |
+
(r'([^\s"\'<%s{}\\&])+' % (r'>' if token is String.Other else r''),
|
| 852 |
+
token),
|
| 853 |
+
include('s/escape'),
|
| 854 |
+
(r'["\'\s&{<}\\]', token)
|
| 855 |
+
]
|
| 856 |
+
|
| 857 |
+
tokens = {
|
| 858 |
+
'root': [
|
| 859 |
+
(u'\ufeff', Text),
|
| 860 |
+
(r'\{', Punctuation, 'object-body'),
|
| 861 |
+
(r';+', Punctuation),
|
| 862 |
+
(r'(?=(argcount|break|case|catch|continue|default|definingobj|'
|
| 863 |
+
r'delegated|do|else|for|foreach|finally|goto|if|inherited|'
|
| 864 |
+
r'invokee|local|nil|new|operator|replaced|return|self|switch|'
|
| 865 |
+
r'targetobj|targetprop|throw|true|try|while)\b)', Text, 'block'),
|
| 866 |
+
(r'(%s)(%s*)(\()' % (_name, _ws),
|
| 867 |
+
bygroups(Name.Function, using(this, state='whitespace'),
|
| 868 |
+
Punctuation),
|
| 869 |
+
('block?/root', 'more/parameters', 'main/parameters')),
|
| 870 |
+
include('whitespace'),
|
| 871 |
+
(r'\++', Punctuation),
|
| 872 |
+
(r'[^\s!"%-(*->@-_a-z{-~]+', Error), # Averts an infinite loop
|
| 873 |
+
(r'(?!\Z)', Text, 'main/root')
|
| 874 |
+
],
|
| 875 |
+
'main/root': [
|
| 876 |
+
include('main/basic'),
|
| 877 |
+
default(('#pop', 'object-body/no-braces', 'classes', 'class'))
|
| 878 |
+
],
|
| 879 |
+
'object-body/no-braces': [
|
| 880 |
+
(r';', Punctuation, '#pop'),
|
| 881 |
+
(r'\{', Punctuation, ('#pop', 'object-body')),
|
| 882 |
+
include('object-body')
|
| 883 |
+
],
|
| 884 |
+
'object-body': [
|
| 885 |
+
(r';', Punctuation),
|
| 886 |
+
(r'\{', Punctuation, '#push'),
|
| 887 |
+
(r'\}', Punctuation, '#pop'),
|
| 888 |
+
(r':', Punctuation, ('classes', 'class')),
|
| 889 |
+
(r'(%s?)(%s*)(\()' % (_name, _ws),
|
| 890 |
+
bygroups(Name.Function, using(this, state='whitespace'),
|
| 891 |
+
Punctuation),
|
| 892 |
+
('block?', 'more/parameters', 'main/parameters')),
|
| 893 |
+
(r'(%s)(%s*)(\{)' % (_name, _ws),
|
| 894 |
+
bygroups(Name.Function, using(this, state='whitespace'),
|
| 895 |
+
Punctuation), 'block'),
|
| 896 |
+
(r'(%s)(%s*)(:)' % (_name, _ws),
|
| 897 |
+
bygroups(Name.Variable, using(this, state='whitespace'),
|
| 898 |
+
Punctuation),
|
| 899 |
+
('object-body/no-braces', 'classes', 'class')),
|
| 900 |
+
include('whitespace'),
|
| 901 |
+
(r'->|%s' % _operator, Punctuation, 'main'),
|
| 902 |
+
default('main/object-body')
|
| 903 |
+
],
|
| 904 |
+
'main/object-body': [
|
| 905 |
+
include('main/basic'),
|
| 906 |
+
(r'(%s)(%s*)(=?)' % (_name, _ws),
|
| 907 |
+
bygroups(Name.Variable, using(this, state='whitespace'),
|
| 908 |
+
Punctuation), ('#pop', 'more', 'main')),
|
| 909 |
+
default('#pop:2')
|
| 910 |
+
],
|
| 911 |
+
'block?/root': [
|
| 912 |
+
(r'\{', Punctuation, ('#pop', 'block')),
|
| 913 |
+
include('whitespace'),
|
| 914 |
+
(r'(?=[[\'"<(:])', Text, # It might be a VerbRule macro.
|
| 915 |
+
('#pop', 'object-body/no-braces', 'grammar', 'grammar-rules')),
|
| 916 |
+
# It might be a macro like DefineAction.
|
| 917 |
+
default(('#pop', 'object-body/no-braces'))
|
| 918 |
+
],
|
| 919 |
+
'block?': [
|
| 920 |
+
(r'\{', Punctuation, ('#pop', 'block')),
|
| 921 |
+
include('whitespace'),
|
| 922 |
+
default('#pop')
|
| 923 |
+
],
|
| 924 |
+
'block/basic': [
|
| 925 |
+
(r'[;:]+', Punctuation),
|
| 926 |
+
(r'\{', Punctuation, '#push'),
|
| 927 |
+
(r'\}', Punctuation, '#pop'),
|
| 928 |
+
(r'default\b', Keyword.Reserved),
|
| 929 |
+
(r'(%s)(%s*)(:)' % (_name, _ws),
|
| 930 |
+
bygroups(Name.Label, using(this, state='whitespace'),
|
| 931 |
+
Punctuation)),
|
| 932 |
+
include('whitespace')
|
| 933 |
+
],
|
| 934 |
+
'block': [
|
| 935 |
+
include('block/basic'),
|
| 936 |
+
(r'(?!\Z)', Text, ('more', 'main'))
|
| 937 |
+
],
|
| 938 |
+
'block/embed': [
|
| 939 |
+
(r'>>', String.Interpol, '#pop'),
|
| 940 |
+
include('block/basic'),
|
| 941 |
+
(r'(?!\Z)', Text, ('more/embed', 'main'))
|
| 942 |
+
],
|
| 943 |
+
'main/basic': [
|
| 944 |
+
include('whitespace'),
|
| 945 |
+
(r'\(', Punctuation, ('#pop', 'more', 'main')),
|
| 946 |
+
(r'\[', Punctuation, ('#pop', 'more/list', 'main')),
|
| 947 |
+
(r'\{', Punctuation, ('#pop', 'more/inner', 'main/inner',
|
| 948 |
+
'more/parameters', 'main/parameters')),
|
| 949 |
+
(r'\*|\.{3}', Punctuation, '#pop'),
|
| 950 |
+
(r'(?i)0x[\da-f]+', Number.Hex, '#pop'),
|
| 951 |
+
(r'(\d+\.(?!\.)\d*|\.\d+)([eE][-+]?\d+)?|\d+[eE][-+]?\d+',
|
| 952 |
+
Number.Float, '#pop'),
|
| 953 |
+
(r'0[0-7]+', Number.Oct, '#pop'),
|
| 954 |
+
(r'\d+', Number.Integer, '#pop'),
|
| 955 |
+
(r'"""', String.Double, ('#pop', 'tdqs')),
|
| 956 |
+
(r"'''", String.Single, ('#pop', 'tsqs')),
|
| 957 |
+
(r'"', String.Double, ('#pop', 'dqs')),
|
| 958 |
+
(r"'", String.Single, ('#pop', 'sqs')),
|
| 959 |
+
(r'R"""', String.Regex, ('#pop', 'tdqr')),
|
| 960 |
+
(r"R'''", String.Regex, ('#pop', 'tsqr')),
|
| 961 |
+
(r'R"', String.Regex, ('#pop', 'dqr')),
|
| 962 |
+
(r"R'", String.Regex, ('#pop', 'sqr')),
|
| 963 |
+
# Two-token keywords
|
| 964 |
+
(r'(extern)(%s+)(object\b)' % _ws,
|
| 965 |
+
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
| 966 |
+
Keyword.Reserved)),
|
| 967 |
+
(r'(function|method)(%s*)(\()' % _ws,
|
| 968 |
+
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
| 969 |
+
Punctuation),
|
| 970 |
+
('#pop', 'block?', 'more/parameters', 'main/parameters')),
|
| 971 |
+
(r'(modify)(%s+)(grammar\b)' % _ws,
|
| 972 |
+
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
| 973 |
+
Keyword.Reserved),
|
| 974 |
+
('#pop', 'object-body/no-braces', ':', 'grammar')),
|
| 975 |
+
(r'(new)(%s+(?=(?:function|method)\b))' % _ws,
|
| 976 |
+
bygroups(Keyword.Reserved, using(this, state='whitespace'))),
|
| 977 |
+
(r'(object)(%s+)(template\b)' % _ws,
|
| 978 |
+
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
| 979 |
+
Keyword.Reserved), ('#pop', 'template')),
|
| 980 |
+
(r'(string)(%s+)(template\b)' % _ws,
|
| 981 |
+
bygroups(Keyword, using(this, state='whitespace'),
|
| 982 |
+
Keyword.Reserved), ('#pop', 'function-name')),
|
| 983 |
+
# Keywords
|
| 984 |
+
(r'(argcount|definingobj|invokee|replaced|targetobj|targetprop)\b',
|
| 985 |
+
Name.Builtin, '#pop'),
|
| 986 |
+
(r'(break|continue|goto)\b', Keyword.Reserved, ('#pop', 'label')),
|
| 987 |
+
(r'(case|extern|if|intrinsic|return|static|while)\b',
|
| 988 |
+
Keyword.Reserved),
|
| 989 |
+
(r'catch\b', Keyword.Reserved, ('#pop', 'catch')),
|
| 990 |
+
(r'class\b', Keyword.Reserved,
|
| 991 |
+
('#pop', 'object-body/no-braces', 'class')),
|
| 992 |
+
(r'(default|do|else|finally|try)\b', Keyword.Reserved, '#pop'),
|
| 993 |
+
(r'(dictionary|property)\b', Keyword.Reserved,
|
| 994 |
+
('#pop', 'constants')),
|
| 995 |
+
(r'enum\b', Keyword.Reserved, ('#pop', 'enum')),
|
| 996 |
+
(r'export\b', Keyword.Reserved, ('#pop', 'main')),
|
| 997 |
+
(r'(for|foreach)\b', Keyword.Reserved,
|
| 998 |
+
('#pop', 'more/inner', 'main/inner')),
|
| 999 |
+
(r'(function|method)\b', Keyword.Reserved,
|
| 1000 |
+
('#pop', 'block?', 'function-name')),
|
| 1001 |
+
(r'grammar\b', Keyword.Reserved,
|
| 1002 |
+
('#pop', 'object-body/no-braces', 'grammar')),
|
| 1003 |
+
(r'inherited\b', Keyword.Reserved, ('#pop', 'inherited')),
|
| 1004 |
+
(r'local\b', Keyword.Reserved,
|
| 1005 |
+
('#pop', 'more/local', 'main/local')),
|
| 1006 |
+
(r'(modify|replace|switch|throw|transient)\b', Keyword.Reserved,
|
| 1007 |
+
'#pop'),
|
| 1008 |
+
(r'new\b', Keyword.Reserved, ('#pop', 'class')),
|
| 1009 |
+
(r'(nil|true)\b', Keyword.Constant, '#pop'),
|
| 1010 |
+
(r'object\b', Keyword.Reserved, ('#pop', 'object-body/no-braces')),
|
| 1011 |
+
(r'operator\b', Keyword.Reserved, ('#pop', 'operator')),
|
| 1012 |
+
(r'propertyset\b', Keyword.Reserved,
|
| 1013 |
+
('#pop', 'propertyset', 'main')),
|
| 1014 |
+
(r'self\b', Name.Builtin.Pseudo, '#pop'),
|
| 1015 |
+
(r'template\b', Keyword.Reserved, ('#pop', 'template')),
|
| 1016 |
+
# Operators
|
| 1017 |
+
(r'(__objref|defined)(%s*)(\()' % _ws,
|
| 1018 |
+
bygroups(Operator.Word, using(this, state='whitespace'),
|
| 1019 |
+
Operator), ('#pop', 'more/__objref', 'main')),
|
| 1020 |
+
(r'delegated\b', Operator.Word),
|
| 1021 |
+
# Compiler-defined macros and built-in properties
|
| 1022 |
+
(r'(__DATE__|__DEBUG|__LINE__|__FILE__|'
|
| 1023 |
+
r'__TADS_MACRO_FORMAT_VERSION|__TADS_SYS_\w*|__TADS_SYSTEM_NAME|'
|
| 1024 |
+
r'__TADS_VERSION_MAJOR|__TADS_VERSION_MINOR|__TADS3|__TIME__|'
|
| 1025 |
+
r'construct|finalize|grammarInfo|grammarTag|lexicalParent|'
|
| 1026 |
+
r'miscVocab|sourceTextGroup|sourceTextGroupName|'
|
| 1027 |
+
r'sourceTextGroupOrder|sourceTextOrder)\b', Name.Builtin, '#pop')
|
| 1028 |
+
],
|
| 1029 |
+
'main': [
|
| 1030 |
+
include('main/basic'),
|
| 1031 |
+
(_name, Name, '#pop'),
|
| 1032 |
+
default('#pop')
|
| 1033 |
+
],
|
| 1034 |
+
'more/basic': [
|
| 1035 |
+
(r'\(', Punctuation, ('more/list', 'main')),
|
| 1036 |
+
(r'\[', Punctuation, ('more', 'main')),
|
| 1037 |
+
(r'\.{3}', Punctuation),
|
| 1038 |
+
(r'->|\.\.', Punctuation, 'main'),
|
| 1039 |
+
(r'(?=;)|[:)\]]', Punctuation, '#pop'),
|
| 1040 |
+
include('whitespace'),
|
| 1041 |
+
(_operator, Operator, 'main'),
|
| 1042 |
+
(r'\?', Operator, ('main', 'more/conditional', 'main')),
|
| 1043 |
+
(r'(is|not)(%s+)(in\b)' % _ws,
|
| 1044 |
+
bygroups(Operator.Word, using(this, state='whitespace'),
|
| 1045 |
+
Operator.Word)),
|
| 1046 |
+
(r'[^\s!"%-_a-z{-~]+', Error) # Averts an infinite loop
|
| 1047 |
+
],
|
| 1048 |
+
'more': [
|
| 1049 |
+
include('more/basic'),
|
| 1050 |
+
default('#pop')
|
| 1051 |
+
],
|
| 1052 |
+
# Then expression (conditional operator)
|
| 1053 |
+
'more/conditional': [
|
| 1054 |
+
(r':(?!:)', Operator, '#pop'),
|
| 1055 |
+
include('more')
|
| 1056 |
+
],
|
| 1057 |
+
# Embedded expressions
|
| 1058 |
+
'more/embed': [
|
| 1059 |
+
(r'>>', String.Interpol, '#pop:2'),
|
| 1060 |
+
include('more')
|
| 1061 |
+
],
|
| 1062 |
+
# For/foreach loop initializer or short-form anonymous function
|
| 1063 |
+
'main/inner': [
|
| 1064 |
+
(r'\(', Punctuation, ('#pop', 'more/inner', 'main/inner')),
|
| 1065 |
+
(r'local\b', Keyword.Reserved, ('#pop', 'main/local')),
|
| 1066 |
+
include('main')
|
| 1067 |
+
],
|
| 1068 |
+
'more/inner': [
|
| 1069 |
+
(r'\}', Punctuation, '#pop'),
|
| 1070 |
+
(r',', Punctuation, 'main/inner'),
|
| 1071 |
+
(r'(in|step)\b', Keyword, 'main/inner'),
|
| 1072 |
+
include('more')
|
| 1073 |
+
],
|
| 1074 |
+
# Local
|
| 1075 |
+
'main/local': [
|
| 1076 |
+
(_name, Name.Variable, '#pop'),
|
| 1077 |
+
include('whitespace')
|
| 1078 |
+
],
|
| 1079 |
+
'more/local': [
|
| 1080 |
+
(r',', Punctuation, 'main/local'),
|
| 1081 |
+
include('more')
|
| 1082 |
+
],
|
| 1083 |
+
# List
|
| 1084 |
+
'more/list': [
|
| 1085 |
+
(r'[,:]', Punctuation, 'main'),
|
| 1086 |
+
include('more')
|
| 1087 |
+
],
|
| 1088 |
+
# Parameter list
|
| 1089 |
+
'main/parameters': [
|
| 1090 |
+
(r'(%s)(%s*)(?=:)' % (_name, _ws),
|
| 1091 |
+
bygroups(Name.Variable, using(this, state='whitespace')), '#pop'),
|
| 1092 |
+
(r'(%s)(%s+)(%s)' % (_name, _ws, _name),
|
| 1093 |
+
bygroups(Name.Class, using(this, state='whitespace'),
|
| 1094 |
+
Name.Variable), '#pop'),
|
| 1095 |
+
(r'\[+', Punctuation),
|
| 1096 |
+
include('main/basic'),
|
| 1097 |
+
(_name, Name.Variable, '#pop'),
|
| 1098 |
+
default('#pop')
|
| 1099 |
+
],
|
| 1100 |
+
'more/parameters': [
|
| 1101 |
+
(r'(:)(%s*(?=[?=,:)]))' % _ws,
|
| 1102 |
+
bygroups(Punctuation, using(this, state='whitespace'))),
|
| 1103 |
+
(r'[?\]]+', Punctuation),
|
| 1104 |
+
(r'[:)]', Punctuation, ('#pop', 'multimethod?')),
|
| 1105 |
+
(r',', Punctuation, 'main/parameters'),
|
| 1106 |
+
(r'=', Punctuation, ('more/parameter', 'main')),
|
| 1107 |
+
include('more')
|
| 1108 |
+
],
|
| 1109 |
+
'more/parameter': [
|
| 1110 |
+
(r'(?=[,)])', Text, '#pop'),
|
| 1111 |
+
include('more')
|
| 1112 |
+
],
|
| 1113 |
+
'multimethod?': [
|
| 1114 |
+
(r'multimethod\b', Keyword, '#pop'),
|
| 1115 |
+
include('whitespace'),
|
| 1116 |
+
default('#pop')
|
| 1117 |
+
],
|
| 1118 |
+
|
| 1119 |
+
# Statements and expressions
|
| 1120 |
+
'more/__objref': [
|
| 1121 |
+
(r',', Punctuation, 'mode'),
|
| 1122 |
+
(r'\)', Operator, '#pop'),
|
| 1123 |
+
include('more')
|
| 1124 |
+
],
|
| 1125 |
+
'mode': [
|
| 1126 |
+
(r'(error|warn)\b', Keyword, '#pop'),
|
| 1127 |
+
include('whitespace')
|
| 1128 |
+
],
|
| 1129 |
+
'catch': [
|
| 1130 |
+
(r'\(+', Punctuation),
|
| 1131 |
+
(_name, Name.Exception, ('#pop', 'variables')),
|
| 1132 |
+
include('whitespace')
|
| 1133 |
+
],
|
| 1134 |
+
'enum': [
|
| 1135 |
+
include('whitespace'),
|
| 1136 |
+
(r'token\b', Keyword, ('#pop', 'constants')),
|
| 1137 |
+
default(('#pop', 'constants'))
|
| 1138 |
+
],
|
| 1139 |
+
'grammar': [
|
| 1140 |
+
(r'\)+', Punctuation),
|
| 1141 |
+
(r'\(', Punctuation, 'grammar-tag'),
|
| 1142 |
+
(r':', Punctuation, 'grammar-rules'),
|
| 1143 |
+
(_name, Name.Class),
|
| 1144 |
+
include('whitespace')
|
| 1145 |
+
],
|
| 1146 |
+
'grammar-tag': [
|
| 1147 |
+
include('whitespace'),
|
| 1148 |
+
(r'"""([^\\"<]|""?(?!")|\\"+|\\.|<(?!<))+("{3,}|<<)|'
|
| 1149 |
+
r'R"""([^\\"]|""?(?!")|\\"+|\\.)+"{3,}|'
|
| 1150 |
+
r"'''([^\\'<]|''?(?!')|\\'+|\\.|<(?!<))+('{3,}|<<)|"
|
| 1151 |
+
r"R'''([^\\']|''?(?!')|\\'+|\\.)+'{3,}|"
|
| 1152 |
+
r'"([^\\"<]|\\.|<(?!<))+("|<<)|R"([^\\"]|\\.)+"|'
|
| 1153 |
+
r"'([^\\'<]|\\.|<(?!<))+('|<<)|R'([^\\']|\\.)+'|"
|
| 1154 |
+
r"([^)\s\\/]|/(?![/*]))+|\)", String.Other, '#pop')
|
| 1155 |
+
],
|
| 1156 |
+
'grammar-rules': [
|
| 1157 |
+
include('string'),
|
| 1158 |
+
include('whitespace'),
|
| 1159 |
+
(r'(\[)(%s*)(badness)' % _ws,
|
| 1160 |
+
bygroups(Punctuation, using(this, state='whitespace'), Keyword),
|
| 1161 |
+
'main'),
|
| 1162 |
+
(r'->|%s|[()]' % _operator, Punctuation),
|
| 1163 |
+
(_name, Name.Constant),
|
| 1164 |
+
default('#pop:2')
|
| 1165 |
+
],
|
| 1166 |
+
':': [
|
| 1167 |
+
(r':', Punctuation, '#pop')
|
| 1168 |
+
],
|
| 1169 |
+
'function-name': [
|
| 1170 |
+
(r'(<<([^>]|>>>|>(?!>))*>>)+', String.Interpol),
|
| 1171 |
+
(r'(?=%s?%s*[({])' % (_name, _ws), Text, '#pop'),
|
| 1172 |
+
(_name, Name.Function, '#pop'),
|
| 1173 |
+
include('whitespace')
|
| 1174 |
+
],
|
| 1175 |
+
'inherited': [
|
| 1176 |
+
(r'<', Punctuation, ('#pop', 'classes', 'class')),
|
| 1177 |
+
include('whitespace'),
|
| 1178 |
+
(_name, Name.Class, '#pop'),
|
| 1179 |
+
default('#pop')
|
| 1180 |
+
],
|
| 1181 |
+
'operator': [
|
| 1182 |
+
(r'negate\b', Operator.Word, '#pop'),
|
| 1183 |
+
include('whitespace'),
|
| 1184 |
+
(_operator, Operator),
|
| 1185 |
+
default('#pop')
|
| 1186 |
+
],
|
| 1187 |
+
'propertyset': [
|
| 1188 |
+
(r'\(', Punctuation, ('more/parameters', 'main/parameters')),
|
| 1189 |
+
(r'\{', Punctuation, ('#pop', 'object-body')),
|
| 1190 |
+
include('whitespace')
|
| 1191 |
+
],
|
| 1192 |
+
'template': [
|
| 1193 |
+
(r'(?=;)', Text, '#pop'),
|
| 1194 |
+
include('string'),
|
| 1195 |
+
(r'inherited\b', Keyword.Reserved),
|
| 1196 |
+
include('whitespace'),
|
| 1197 |
+
(r'->|\?|%s' % _operator, Punctuation),
|
| 1198 |
+
(_name, Name.Variable)
|
| 1199 |
+
],
|
| 1200 |
+
|
| 1201 |
+
# Identifiers
|
| 1202 |
+
'class': [
|
| 1203 |
+
(r'\*|\.{3}', Punctuation, '#pop'),
|
| 1204 |
+
(r'object\b', Keyword.Reserved, '#pop'),
|
| 1205 |
+
(r'transient\b', Keyword.Reserved),
|
| 1206 |
+
(_name, Name.Class, '#pop'),
|
| 1207 |
+
include('whitespace'),
|
| 1208 |
+
default('#pop')
|
| 1209 |
+
],
|
| 1210 |
+
'classes': [
|
| 1211 |
+
(r'[:,]', Punctuation, 'class'),
|
| 1212 |
+
include('whitespace'),
|
| 1213 |
+
(r'>', Punctuation, '#pop'),
|
| 1214 |
+
default('#pop')
|
| 1215 |
+
],
|
| 1216 |
+
'constants': [
|
| 1217 |
+
(r',+', Punctuation),
|
| 1218 |
+
(r';', Punctuation, '#pop'),
|
| 1219 |
+
(r'property\b', Keyword.Reserved),
|
| 1220 |
+
(_name, Name.Constant),
|
| 1221 |
+
include('whitespace')
|
| 1222 |
+
],
|
| 1223 |
+
'label': [
|
| 1224 |
+
(_name, Name.Label, '#pop'),
|
| 1225 |
+
include('whitespace'),
|
| 1226 |
+
default('#pop')
|
| 1227 |
+
],
|
| 1228 |
+
'variables': [
|
| 1229 |
+
(r',+', Punctuation),
|
| 1230 |
+
(r'\)', Punctuation, '#pop'),
|
| 1231 |
+
include('whitespace'),
|
| 1232 |
+
(_name, Name.Variable)
|
| 1233 |
+
],
|
| 1234 |
+
|
| 1235 |
+
# Whitespace and comments
|
| 1236 |
+
'whitespace': [
|
| 1237 |
+
(r'^%s*#(%s|[^\n]|(?<=\\)\n)*\n?' % (_ws_pp, _comment_multiline),
|
| 1238 |
+
Comment.Preproc),
|
| 1239 |
+
(_comment_single, Comment.Single),
|
| 1240 |
+
(_comment_multiline, Comment.Multiline),
|
| 1241 |
+
(r'\\+\n+%s*#?|\n+|([^\S\n]|\\)+' % _ws_pp, Text)
|
| 1242 |
+
],
|
| 1243 |
+
|
| 1244 |
+
# Strings
|
| 1245 |
+
'string': [
|
| 1246 |
+
(r'"""', String.Double, 'tdqs'),
|
| 1247 |
+
(r"'''", String.Single, 'tsqs'),
|
| 1248 |
+
(r'"', String.Double, 'dqs'),
|
| 1249 |
+
(r"'", String.Single, 'sqs')
|
| 1250 |
+
],
|
| 1251 |
+
's/escape': [
|
| 1252 |
+
(r'\{\{|\}\}|%s' % _escape, String.Escape)
|
| 1253 |
+
],
|
| 1254 |
+
's/verbatim': [
|
| 1255 |
+
(r'<<\s*(as\s+decreasingly\s+likely\s+outcomes|cycling|else|end|'
|
| 1256 |
+
r'first\s+time|one\s+of|only|or|otherwise|'
|
| 1257 |
+
r'(sticky|(then\s+)?(purely\s+)?at)\s+random|stopping|'
|
| 1258 |
+
r'(then\s+)?(half\s+)?shuffled|\|\|)\s*>>', String.Interpol),
|
| 1259 |
+
(r'<<(%%(_(%s|\\?.)|[\-+ ,#]|\[\d*\]?)*\d*\.?\d*(%s|\\?.)|'
|
| 1260 |
+
r'\s*((else|otherwise)\s+)?(if|unless)\b)?' % (_escape, _escape),
|
| 1261 |
+
String.Interpol, ('block/embed', 'more/embed', 'main'))
|
| 1262 |
+
],
|
| 1263 |
+
's/entity': [
|
| 1264 |
+
(r'(?i)&(#(x[\da-f]+|\d+)|[a-z][\da-z]*);?', Name.Entity)
|
| 1265 |
+
],
|
| 1266 |
+
'tdqs': _make_string_state(True, True),
|
| 1267 |
+
'tsqs': _make_string_state(True, False),
|
| 1268 |
+
'dqs': _make_string_state(False, True),
|
| 1269 |
+
'sqs': _make_string_state(False, False),
|
| 1270 |
+
'tdqs/listing': _make_string_state(True, True, 'listing'),
|
| 1271 |
+
'tsqs/listing': _make_string_state(True, False, 'listing'),
|
| 1272 |
+
'dqs/listing': _make_string_state(False, True, 'listing'),
|
| 1273 |
+
'sqs/listing': _make_string_state(False, False, 'listing'),
|
| 1274 |
+
'tdqs/xmp': _make_string_state(True, True, 'xmp'),
|
| 1275 |
+
'tsqs/xmp': _make_string_state(True, False, 'xmp'),
|
| 1276 |
+
'dqs/xmp': _make_string_state(False, True, 'xmp'),
|
| 1277 |
+
'sqs/xmp': _make_string_state(False, False, 'xmp'),
|
| 1278 |
+
|
| 1279 |
+
# Tags
|
| 1280 |
+
'tdqt': _make_tag_state(True, True),
|
| 1281 |
+
'tsqt': _make_tag_state(True, False),
|
| 1282 |
+
'dqt': _make_tag_state(False, True),
|
| 1283 |
+
'sqt': _make_tag_state(False, False),
|
| 1284 |
+
'dqs/tdqt': _make_attribute_value_state(r'"', True, True),
|
| 1285 |
+
'dqs/tsqt': _make_attribute_value_state(r'"', True, False),
|
| 1286 |
+
'dqs/dqt': _make_attribute_value_state(r'"', False, True),
|
| 1287 |
+
'dqs/sqt': _make_attribute_value_state(r'"', False, False),
|
| 1288 |
+
'sqs/tdqt': _make_attribute_value_state(r"'", True, True),
|
| 1289 |
+
'sqs/tsqt': _make_attribute_value_state(r"'", True, False),
|
| 1290 |
+
'sqs/dqt': _make_attribute_value_state(r"'", False, True),
|
| 1291 |
+
'sqs/sqt': _make_attribute_value_state(r"'", False, False),
|
| 1292 |
+
'uqs/tdqt': _make_attribute_value_state(_no_quote, True, True),
|
| 1293 |
+
'uqs/tsqt': _make_attribute_value_state(_no_quote, True, False),
|
| 1294 |
+
'uqs/dqt': _make_attribute_value_state(_no_quote, False, True),
|
| 1295 |
+
'uqs/sqt': _make_attribute_value_state(_no_quote, False, False),
|
| 1296 |
+
|
| 1297 |
+
# Regular expressions
|
| 1298 |
+
'tdqr': [
|
| 1299 |
+
(r'[^\\"]+', String.Regex),
|
| 1300 |
+
(r'\\"*', String.Regex),
|
| 1301 |
+
(r'"{3,}', String.Regex, '#pop'),
|
| 1302 |
+
(r'"', String.Regex)
|
| 1303 |
+
],
|
| 1304 |
+
'tsqr': [
|
| 1305 |
+
(r"[^\\']+", String.Regex),
|
| 1306 |
+
(r"\\'*", String.Regex),
|
| 1307 |
+
(r"'{3,}", String.Regex, '#pop'),
|
| 1308 |
+
(r"'", String.Regex)
|
| 1309 |
+
],
|
| 1310 |
+
'dqr': [
|
| 1311 |
+
(r'[^\\"]+', String.Regex),
|
| 1312 |
+
(r'\\"?', String.Regex),
|
| 1313 |
+
(r'"', String.Regex, '#pop')
|
| 1314 |
+
],
|
| 1315 |
+
'sqr': [
|
| 1316 |
+
(r"[^\\']+", String.Regex),
|
| 1317 |
+
(r"\\'?", String.Regex),
|
| 1318 |
+
(r"'", String.Regex, '#pop')
|
| 1319 |
+
]
|
| 1320 |
+
}
|
| 1321 |
+
|
| 1322 |
+
def get_tokens_unprocessed(self, text, **kwargs):
|
| 1323 |
+
pp = r'^%s*#%s*' % (self._ws_pp, self._ws_pp)
|
| 1324 |
+
if_false_level = 0
|
| 1325 |
+
for index, token, value in (
|
| 1326 |
+
RegexLexer.get_tokens_unprocessed(self, text, **kwargs)):
|
| 1327 |
+
if if_false_level == 0: # Not in a false #if
|
| 1328 |
+
if (token is Comment.Preproc and
|
| 1329 |
+
re.match(r'%sif%s+(0|nil)%s*$\n?' %
|
| 1330 |
+
(pp, self._ws_pp, self._ws_pp), value)):
|
| 1331 |
+
if_false_level = 1
|
| 1332 |
+
else: # In a false #if
|
| 1333 |
+
if token is Comment.Preproc:
|
| 1334 |
+
if (if_false_level == 1 and
|
| 1335 |
+
re.match(r'%sel(if|se)\b' % pp, value)):
|
| 1336 |
+
if_false_level = 0
|
| 1337 |
+
elif re.match(r'%sif' % pp, value):
|
| 1338 |
+
if_false_level += 1
|
| 1339 |
+
elif re.match(r'%sendif\b' % pp, value):
|
| 1340 |
+
if_false_level -= 1
|
| 1341 |
+
else:
|
| 1342 |
+
token = Comment
|
| 1343 |
+
yield index, token, value
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/iolang.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.iolang
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for the Io language.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from pygments.lexer import RegexLexer
|
| 13 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 14 |
+
Number
|
| 15 |
+
|
| 16 |
+
__all__ = ['IoLexer']
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class IoLexer(RegexLexer):
|
| 20 |
+
"""
|
| 21 |
+
For `Io <http://iolanguage.com/>`_ (a small, prototype-based
|
| 22 |
+
programming language) source.
|
| 23 |
+
|
| 24 |
+
.. versionadded:: 0.10
|
| 25 |
+
"""
|
| 26 |
+
name = 'Io'
|
| 27 |
+
filenames = ['*.io']
|
| 28 |
+
aliases = ['io']
|
| 29 |
+
mimetypes = ['text/x-iosrc']
|
| 30 |
+
tokens = {
|
| 31 |
+
'root': [
|
| 32 |
+
(r'\n', Text),
|
| 33 |
+
(r'\s+', Text),
|
| 34 |
+
# Comments
|
| 35 |
+
(r'//(.*?)\n', Comment.Single),
|
| 36 |
+
(r'#(.*?)\n', Comment.Single),
|
| 37 |
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
| 38 |
+
(r'/\+', Comment.Multiline, 'nestedcomment'),
|
| 39 |
+
# DoubleQuotedString
|
| 40 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 41 |
+
# Operators
|
| 42 |
+
(r'::=|:=|=|\(|\)|;|,|\*|-|\+|>|<|@|!|/|\||\^|\.|%|&|\[|\]|\{|\}',
|
| 43 |
+
Operator),
|
| 44 |
+
# keywords
|
| 45 |
+
(r'(clone|do|doFile|doString|method|for|if|else|elseif|then)\b',
|
| 46 |
+
Keyword),
|
| 47 |
+
# constants
|
| 48 |
+
(r'(nil|false|true)\b', Name.Constant),
|
| 49 |
+
# names
|
| 50 |
+
(r'(Object|list|List|Map|args|Sequence|Coroutine|File)\b',
|
| 51 |
+
Name.Builtin),
|
| 52 |
+
('[a-zA-Z_]\w*', Name),
|
| 53 |
+
# numbers
|
| 54 |
+
(r'(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
| 55 |
+
(r'\d+', Number.Integer)
|
| 56 |
+
],
|
| 57 |
+
'nestedcomment': [
|
| 58 |
+
(r'[^+/]+', Comment.Multiline),
|
| 59 |
+
(r'/\+', Comment.Multiline, '#push'),
|
| 60 |
+
(r'\+/', Comment.Multiline, '#pop'),
|
| 61 |
+
(r'[+/]', Comment.Multiline),
|
| 62 |
+
]
|
| 63 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/j.py
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|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2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from pygments.lexer import RegexLexer, words, include
|
| 13 |
+
from pygments.token import Comment, Keyword, Name, Number, Operator, Punctuation, \
|
| 14 |
+
String, Text
|
| 15 |
+
|
| 16 |
+
__all__ = ['JLexer']
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class JLexer(RegexLexer):
|
| 20 |
+
"""
|
| 21 |
+
For `J <http://jsoftware.com/>`_ source code.
|
| 22 |
+
|
| 23 |
+
.. versionadded:: 2.1
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
name = 'J'
|
| 27 |
+
aliases = ['j']
|
| 28 |
+
filenames = ['*.ijs']
|
| 29 |
+
mimetypes = ['text/x-j']
|
| 30 |
+
|
| 31 |
+
validName = r'\b[a-zA-Z]\w*'
|
| 32 |
+
|
| 33 |
+
tokens = {
|
| 34 |
+
'root': [
|
| 35 |
+
# Shebang script
|
| 36 |
+
(r'#!.*$', Comment.Preproc),
|
| 37 |
+
|
| 38 |
+
# Comments
|
| 39 |
+
(r'NB\..*', Comment.Single),
|
| 40 |
+
(r'\n+\s*Note', Comment.Multiline, 'comment'),
|
| 41 |
+
(r'\s*Note.*', Comment.Single),
|
| 42 |
+
|
| 43 |
+
# Whitespace
|
| 44 |
+
(r'\s+', Text),
|
| 45 |
+
|
| 46 |
+
# Strings
|
| 47 |
+
(r"'", String, 'singlequote'),
|
| 48 |
+
|
| 49 |
+
# Definitions
|
| 50 |
+
(r'0\s+:\s*0|noun\s+define\s*$', Name.Entity, 'nounDefinition'),
|
| 51 |
+
(r'(([1-4]|13)\s+:\s*0|(adverb|conjunction|dyad|monad|verb)\s+define)\b',
|
| 52 |
+
Name.Function, 'explicitDefinition'),
|
| 53 |
+
|
| 54 |
+
# Flow Control
|
| 55 |
+
(words(('for_', 'goto_', 'label_'), suffix=validName+'\.'), Name.Label),
|
| 56 |
+
(words((
|
| 57 |
+
'assert', 'break', 'case', 'catch', 'catchd',
|
| 58 |
+
'catcht', 'continue', 'do', 'else', 'elseif',
|
| 59 |
+
'end', 'fcase', 'for', 'if', 'return',
|
| 60 |
+
'select', 'throw', 'try', 'while', 'whilst',
|
| 61 |
+
), suffix='\.'), Name.Label),
|
| 62 |
+
|
| 63 |
+
# Variable Names
|
| 64 |
+
(validName, Name.Variable),
|
| 65 |
+
|
| 66 |
+
# Standard Library
|
| 67 |
+
(words((
|
| 68 |
+
'ARGV', 'CR', 'CRLF', 'DEL', 'Debug',
|
| 69 |
+
'EAV', 'EMPTY', 'FF', 'JVERSION', 'LF',
|
| 70 |
+
'LF2', 'Note', 'TAB', 'alpha17', 'alpha27',
|
| 71 |
+
'apply', 'bind', 'boxopen', 'boxxopen', 'bx',
|
| 72 |
+
'clear', 'cutLF', 'cutopen', 'datatype', 'def',
|
| 73 |
+
'dfh', 'drop', 'each', 'echo', 'empty',
|
| 74 |
+
'erase', 'every', 'evtloop', 'exit', 'expand',
|
| 75 |
+
'fetch', 'file2url', 'fixdotdot', 'fliprgb', 'getargs',
|
| 76 |
+
'getenv', 'hfd', 'inv', 'inverse', 'iospath',
|
| 77 |
+
'isatty', 'isutf8', 'items', 'leaf', 'list',
|
| 78 |
+
'nameclass', 'namelist', 'names', 'nc',
|
| 79 |
+
'nl', 'on', 'pick', 'rows',
|
| 80 |
+
'script', 'scriptd', 'sign', 'sminfo', 'smoutput',
|
| 81 |
+
'sort', 'split', 'stderr', 'stdin', 'stdout',
|
| 82 |
+
'table', 'take', 'timespacex', 'timex', 'tmoutput',
|
| 83 |
+
'toCRLF', 'toHOST', 'toJ', 'tolower', 'toupper',
|
| 84 |
+
'type', 'ucp', 'ucpcount', 'usleep', 'utf8',
|
| 85 |
+
'uucp',
|
| 86 |
+
)), Name.Function),
|
| 87 |
+
|
| 88 |
+
# Copula
|
| 89 |
+
(r'=[.:]', Operator),
|
| 90 |
+
|
| 91 |
+
# Builtins
|
| 92 |
+
(r'[-=+*#$%@!~`^&";:.,<>{}\[\]\\|/]', Operator),
|
| 93 |
+
|
| 94 |
+
# Short Keywords
|
| 95 |
+
(r'[abCdDeEfHiIjLMoprtT]\.', Keyword.Reserved),
|
| 96 |
+
(r'[aDiLpqsStux]\:', Keyword.Reserved),
|
| 97 |
+
(r'(_[0-9])\:', Keyword.Constant),
|
| 98 |
+
|
| 99 |
+
# Parens
|
| 100 |
+
(r'\(', Punctuation, 'parentheses'),
|
| 101 |
+
|
| 102 |
+
# Numbers
|
| 103 |
+
include('numbers'),
|
| 104 |
+
],
|
| 105 |
+
|
| 106 |
+
'comment': [
|
| 107 |
+
(r'[^)]', Comment.Multiline),
|
| 108 |
+
(r'^\)', Comment.Multiline, '#pop'),
|
| 109 |
+
(r'[)]', Comment.Multiline),
|
| 110 |
+
],
|
| 111 |
+
|
| 112 |
+
'explicitDefinition': [
|
| 113 |
+
(r'\b[nmuvxy]\b', Name.Decorator),
|
| 114 |
+
include('root'),
|
| 115 |
+
(r'[^)]', Name),
|
| 116 |
+
(r'^\)', Name.Label, '#pop'),
|
| 117 |
+
(r'[)]', Name),
|
| 118 |
+
],
|
| 119 |
+
|
| 120 |
+
'numbers': [
|
| 121 |
+
(r'\b_{1,2}\b', Number),
|
| 122 |
+
(r'_?\d+(\.\d+)?(\s*[ejr]\s*)_?\d+(\.?=\d+)?', Number),
|
| 123 |
+
(r'_?\d+\.(?=\d+)', Number.Float),
|
| 124 |
+
(r'_?\d+x', Number.Integer.Long),
|
| 125 |
+
(r'_?\d+', Number.Integer),
|
| 126 |
+
],
|
| 127 |
+
|
| 128 |
+
'nounDefinition': [
|
| 129 |
+
(r'[^)]', String),
|
| 130 |
+
(r'^\)', Name.Label, '#pop'),
|
| 131 |
+
(r'[)]', String),
|
| 132 |
+
],
|
| 133 |
+
|
| 134 |
+
'parentheses': [
|
| 135 |
+
(r'\)', Punctuation, '#pop'),
|
| 136 |
+
# include('nounDefinition'),
|
| 137 |
+
include('explicitDefinition'),
|
| 138 |
+
include('root'),
|
| 139 |
+
],
|
| 140 |
+
|
| 141 |
+
'singlequote': [
|
| 142 |
+
(r"[^']", String),
|
| 143 |
+
(r"''", String),
|
| 144 |
+
(r"'", String, '#pop'),
|
| 145 |
+
],
|
| 146 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/javascript.py
ADDED
|
@@ -0,0 +1,1525 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.javascript
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for JavaScript and related languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, include, bygroups, default, using, \
|
| 15 |
+
this, words, combined
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Number, Punctuation, Other
|
| 18 |
+
from pygments.util import get_bool_opt, iteritems
|
| 19 |
+
import pygments.unistring as uni
|
| 20 |
+
|
| 21 |
+
__all__ = ['JavascriptLexer', 'KalLexer', 'LiveScriptLexer', 'DartLexer',
|
| 22 |
+
'TypeScriptLexer', 'LassoLexer', 'ObjectiveJLexer',
|
| 23 |
+
'CoffeeScriptLexer', 'MaskLexer', 'EarlGreyLexer', 'JuttleLexer']
|
| 24 |
+
|
| 25 |
+
JS_IDENT_START = ('(?:[$_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') +
|
| 26 |
+
']|\\\\u[a-fA-F0-9]{4})')
|
| 27 |
+
JS_IDENT_PART = ('(?:[$' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
|
| 28 |
+
'Mn', 'Mc', 'Nd', 'Pc') +
|
| 29 |
+
u'\u200c\u200d]|\\\\u[a-fA-F0-9]{4})')
|
| 30 |
+
JS_IDENT = JS_IDENT_START + '(?:' + JS_IDENT_PART + ')*'
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class JavascriptLexer(RegexLexer):
|
| 34 |
+
"""
|
| 35 |
+
For JavaScript source code.
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
name = 'JavaScript'
|
| 39 |
+
aliases = ['js', 'javascript']
|
| 40 |
+
filenames = ['*.js', '*.jsm']
|
| 41 |
+
mimetypes = ['application/javascript', 'application/x-javascript',
|
| 42 |
+
'text/x-javascript', 'text/javascript']
|
| 43 |
+
|
| 44 |
+
flags = re.DOTALL | re.UNICODE | re.MULTILINE
|
| 45 |
+
|
| 46 |
+
tokens = {
|
| 47 |
+
'commentsandwhitespace': [
|
| 48 |
+
(r'\s+', Text),
|
| 49 |
+
(r'<!--', Comment),
|
| 50 |
+
(r'//.*?\n', Comment.Single),
|
| 51 |
+
(r'/\*.*?\*/', Comment.Multiline)
|
| 52 |
+
],
|
| 53 |
+
'slashstartsregex': [
|
| 54 |
+
include('commentsandwhitespace'),
|
| 55 |
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
| 56 |
+
r'([gimuy]+\b|\B)', String.Regex, '#pop'),
|
| 57 |
+
(r'(?=/)', Text, ('#pop', 'badregex')),
|
| 58 |
+
default('#pop')
|
| 59 |
+
],
|
| 60 |
+
'badregex': [
|
| 61 |
+
(r'\n', Text, '#pop')
|
| 62 |
+
],
|
| 63 |
+
'root': [
|
| 64 |
+
(r'\A#! ?/.*?\n', Comment.Hashbang), # recognized by node.js
|
| 65 |
+
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
| 66 |
+
include('commentsandwhitespace'),
|
| 67 |
+
(r'(\.\d+|[0-9]+\.[0-9]*)([eE][-+]?[0-9]+)?', Number.Float),
|
| 68 |
+
(r'0[bB][01]+', Number.Bin),
|
| 69 |
+
(r'0[oO][0-7]+', Number.Oct),
|
| 70 |
+
(r'0[xX][0-9a-fA-F]+', Number.Hex),
|
| 71 |
+
(r'[0-9]+', Number.Integer),
|
| 72 |
+
(r'\.\.\.|=>', Punctuation),
|
| 73 |
+
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
| 74 |
+
r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
|
| 75 |
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
| 76 |
+
(r'[})\].]', Punctuation),
|
| 77 |
+
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
|
| 78 |
+
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|yield|'
|
| 79 |
+
r'this|of)\b', Keyword, 'slashstartsregex'),
|
| 80 |
+
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
| 81 |
+
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
|
| 82 |
+
r'extends|final|float|goto|implements|import|int|interface|long|native|'
|
| 83 |
+
r'package|private|protected|public|short|static|super|synchronized|throws|'
|
| 84 |
+
r'transient|volatile)\b', Keyword.Reserved),
|
| 85 |
+
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
|
| 86 |
+
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
| 87 |
+
r'Number|Object|Packages|RegExp|String|Promise|Proxy|sun|decodeURI|'
|
| 88 |
+
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
| 89 |
+
r'Error|eval|isFinite|isNaN|isSafeInteger|parseFloat|parseInt|'
|
| 90 |
+
r'document|this|window)\b', Name.Builtin),
|
| 91 |
+
(JS_IDENT, Name.Other),
|
| 92 |
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
| 93 |
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
| 94 |
+
(r'`', String.Backtick, 'interp'),
|
| 95 |
+
],
|
| 96 |
+
'interp': [
|
| 97 |
+
(r'`', String.Backtick, '#pop'),
|
| 98 |
+
(r'\\\\', String.Backtick),
|
| 99 |
+
(r'\\`', String.Backtick),
|
| 100 |
+
(r'\$\{', String.Interpol, 'interp-inside'),
|
| 101 |
+
(r'\$', String.Backtick),
|
| 102 |
+
(r'[^`\\$]+', String.Backtick),
|
| 103 |
+
],
|
| 104 |
+
'interp-inside': [
|
| 105 |
+
# TODO: should this include single-line comments and allow nesting strings?
|
| 106 |
+
(r'\}', String.Interpol, '#pop'),
|
| 107 |
+
include('root'),
|
| 108 |
+
],
|
| 109 |
+
# (\\\\|\\`|[^`])*`', String.Backtick),
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
class KalLexer(RegexLexer):
|
| 114 |
+
"""
|
| 115 |
+
For `Kal`_ source code.
|
| 116 |
+
|
| 117 |
+
.. _Kal: http://rzimmerman.github.io/kal
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
.. versionadded:: 2.0
|
| 121 |
+
"""
|
| 122 |
+
|
| 123 |
+
name = 'Kal'
|
| 124 |
+
aliases = ['kal']
|
| 125 |
+
filenames = ['*.kal']
|
| 126 |
+
mimetypes = ['text/kal', 'application/kal']
|
| 127 |
+
|
| 128 |
+
flags = re.DOTALL
|
| 129 |
+
tokens = {
|
| 130 |
+
'commentsandwhitespace': [
|
| 131 |
+
(r'\s+', Text),
|
| 132 |
+
(r'###[^#].*?###', Comment.Multiline),
|
| 133 |
+
(r'#(?!##[^#]).*?\n', Comment.Single),
|
| 134 |
+
],
|
| 135 |
+
'functiondef': [
|
| 136 |
+
(r'[$a-zA-Z_][\w$]*\s*', Name.Function, '#pop'),
|
| 137 |
+
include('commentsandwhitespace'),
|
| 138 |
+
],
|
| 139 |
+
'classdef': [
|
| 140 |
+
(r'\binherits\s+from\b', Keyword),
|
| 141 |
+
(r'[$a-zA-Z_][\w$]*\s*\n', Name.Class, '#pop'),
|
| 142 |
+
(r'[$a-zA-Z_][\w$]*\s*', Name.Class),
|
| 143 |
+
include('commentsandwhitespace'),
|
| 144 |
+
],
|
| 145 |
+
'listcomprehension': [
|
| 146 |
+
(r'\]', Punctuation, '#pop'),
|
| 147 |
+
(r'\b(property|value)\b', Keyword),
|
| 148 |
+
include('root'),
|
| 149 |
+
],
|
| 150 |
+
'waitfor': [
|
| 151 |
+
(r'\n', Punctuation, '#pop'),
|
| 152 |
+
(r'\bfrom\b', Keyword),
|
| 153 |
+
include('root'),
|
| 154 |
+
],
|
| 155 |
+
'root': [
|
| 156 |
+
include('commentsandwhitespace'),
|
| 157 |
+
(r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
| 158 |
+
r'([gim]+\b|\B)', String.Regex),
|
| 159 |
+
(r'\?|:|_(?=\n)|==?|!=|-(?!>)|[<>+*/-]=?',
|
| 160 |
+
Operator),
|
| 161 |
+
(r'\b(and|or|isnt|is|not|but|bitwise|mod|\^|xor|exists|'
|
| 162 |
+
r'doesnt\s+exist)\b', Operator.Word),
|
| 163 |
+
(r'(?:\([^()]+\))?\s*>', Name.Function),
|
| 164 |
+
(r'[{(]', Punctuation),
|
| 165 |
+
(r'\[', Punctuation, 'listcomprehension'),
|
| 166 |
+
(r'[})\].,]', Punctuation),
|
| 167 |
+
(r'\b(function|method|task)\b', Keyword.Declaration, 'functiondef'),
|
| 168 |
+
(r'\bclass\b', Keyword.Declaration, 'classdef'),
|
| 169 |
+
(r'\b(safe\s+)?wait\s+for\b', Keyword, 'waitfor'),
|
| 170 |
+
(r'\b(me|this)(\.[$a-zA-Z_][\w.$]*)?\b', Name.Variable.Instance),
|
| 171 |
+
(r'(?<![.$])(for(\s+(parallel|series))?|in|of|while|until|'
|
| 172 |
+
r'break|return|continue|'
|
| 173 |
+
r'when|if|unless|else|otherwise|except\s+when|'
|
| 174 |
+
r'throw|raise|fail\s+with|try|catch|finally|new|delete|'
|
| 175 |
+
r'typeof|instanceof|super|run\s+in\s+parallel|'
|
| 176 |
+
r'inherits\s+from)\b', Keyword),
|
| 177 |
+
(r'(?<![.$])(true|false|yes|no|on|off|null|nothing|none|'
|
| 178 |
+
r'NaN|Infinity|undefined)\b',
|
| 179 |
+
Keyword.Constant),
|
| 180 |
+
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
| 181 |
+
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
| 182 |
+
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
| 183 |
+
r'eval|isFinite|isNaN|isSafeInteger|parseFloat|parseInt|document|'
|
| 184 |
+
r'window|'
|
| 185 |
+
r'print)\b',
|
| 186 |
+
Name.Builtin),
|
| 187 |
+
(r'[$a-zA-Z_][\w.$]*\s*(:|[+\-*/]?\=)?\b', Name.Variable),
|
| 188 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 189 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 190 |
+
(r'[0-9]+', Number.Integer),
|
| 191 |
+
('"""', String, 'tdqs'),
|
| 192 |
+
("'''", String, 'tsqs'),
|
| 193 |
+
('"', String, 'dqs'),
|
| 194 |
+
("'", String, 'sqs'),
|
| 195 |
+
],
|
| 196 |
+
'strings': [
|
| 197 |
+
(r'[^#\\\'"]+', String),
|
| 198 |
+
# note that all kal strings are multi-line.
|
| 199 |
+
# hashmarks, quotes and backslashes must be parsed one at a time
|
| 200 |
+
],
|
| 201 |
+
'interpoling_string': [
|
| 202 |
+
(r'\}', String.Interpol, "#pop"),
|
| 203 |
+
include('root')
|
| 204 |
+
],
|
| 205 |
+
'dqs': [
|
| 206 |
+
(r'"', String, '#pop'),
|
| 207 |
+
(r'\\.|\'', String), # double-quoted string don't need ' escapes
|
| 208 |
+
(r'#\{', String.Interpol, "interpoling_string"),
|
| 209 |
+
include('strings')
|
| 210 |
+
],
|
| 211 |
+
'sqs': [
|
| 212 |
+
(r"'", String, '#pop'),
|
| 213 |
+
(r'#|\\.|"', String), # single quoted strings don't need " escapses
|
| 214 |
+
include('strings')
|
| 215 |
+
],
|
| 216 |
+
'tdqs': [
|
| 217 |
+
(r'"""', String, '#pop'),
|
| 218 |
+
(r'\\.|\'|"', String), # no need to escape quotes in triple-string
|
| 219 |
+
(r'#\{', String.Interpol, "interpoling_string"),
|
| 220 |
+
include('strings'),
|
| 221 |
+
],
|
| 222 |
+
'tsqs': [
|
| 223 |
+
(r"'''", String, '#pop'),
|
| 224 |
+
(r'#|\\.|\'|"', String), # no need to escape quotes in triple-strings
|
| 225 |
+
include('strings')
|
| 226 |
+
],
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
class LiveScriptLexer(RegexLexer):
|
| 231 |
+
"""
|
| 232 |
+
For `LiveScript`_ source code.
|
| 233 |
+
|
| 234 |
+
.. _LiveScript: http://gkz.github.com/LiveScript/
|
| 235 |
+
|
| 236 |
+
.. versionadded:: 1.6
|
| 237 |
+
"""
|
| 238 |
+
|
| 239 |
+
name = 'LiveScript'
|
| 240 |
+
aliases = ['live-script', 'livescript']
|
| 241 |
+
filenames = ['*.ls']
|
| 242 |
+
mimetypes = ['text/livescript']
|
| 243 |
+
|
| 244 |
+
flags = re.DOTALL
|
| 245 |
+
tokens = {
|
| 246 |
+
'commentsandwhitespace': [
|
| 247 |
+
(r'\s+', Text),
|
| 248 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 249 |
+
(r'#.*?\n', Comment.Single),
|
| 250 |
+
],
|
| 251 |
+
'multilineregex': [
|
| 252 |
+
include('commentsandwhitespace'),
|
| 253 |
+
(r'//([gim]+\b|\B)', String.Regex, '#pop'),
|
| 254 |
+
(r'/', String.Regex),
|
| 255 |
+
(r'[^/#]+', String.Regex)
|
| 256 |
+
],
|
| 257 |
+
'slashstartsregex': [
|
| 258 |
+
include('commentsandwhitespace'),
|
| 259 |
+
(r'//', String.Regex, ('#pop', 'multilineregex')),
|
| 260 |
+
(r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
| 261 |
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
| 262 |
+
default('#pop'),
|
| 263 |
+
],
|
| 264 |
+
'root': [
|
| 265 |
+
# this next expr leads to infinite loops root -> slashstartsregex
|
| 266 |
+
# (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
| 267 |
+
include('commentsandwhitespace'),
|
| 268 |
+
(r'(?:\([^()]+\))?[ ]*[~-]{1,2}>|'
|
| 269 |
+
r'(?:\(?[^()\n]+\)?)?[ ]*<[~-]{1,2}', Name.Function),
|
| 270 |
+
(r'\+\+|&&|(?<![.$])\b(?:and|x?or|is|isnt|not)\b|\?|:|=|'
|
| 271 |
+
r'\|\||\\(?=\n)|(<<|>>>?|==?|!=?|'
|
| 272 |
+
r'~(?!\~?>)|-(?!\-?>)|<(?!\[)|(?<!\])>|'
|
| 273 |
+
r'[+*`%&|^/])=?',
|
| 274 |
+
Operator, 'slashstartsregex'),
|
| 275 |
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
| 276 |
+
(r'[})\].]', Punctuation),
|
| 277 |
+
(r'(?<![.$])(for|own|in|of|while|until|loop|break|'
|
| 278 |
+
r'return|continue|switch|when|then|if|unless|else|'
|
| 279 |
+
r'throw|try|catch|finally|new|delete|typeof|instanceof|super|'
|
| 280 |
+
r'extends|this|class|by|const|var|to|til)\b', Keyword,
|
| 281 |
+
'slashstartsregex'),
|
| 282 |
+
(r'(?<![.$])(true|false|yes|no|on|off|'
|
| 283 |
+
r'null|NaN|Infinity|undefined|void)\b',
|
| 284 |
+
Keyword.Constant),
|
| 285 |
+
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
| 286 |
+
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
| 287 |
+
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
| 288 |
+
r'eval|isFinite|isNaN|parseFloat|parseInt|document|window)\b',
|
| 289 |
+
Name.Builtin),
|
| 290 |
+
(r'[$a-zA-Z_][\w.\-:$]*\s*[:=]\s', Name.Variable,
|
| 291 |
+
'slashstartsregex'),
|
| 292 |
+
(r'@[$a-zA-Z_][\w.\-:$]*\s*[:=]\s', Name.Variable.Instance,
|
| 293 |
+
'slashstartsregex'),
|
| 294 |
+
(r'@', Name.Other, 'slashstartsregex'),
|
| 295 |
+
(r'@?[$a-zA-Z_][\w-]*', Name.Other, 'slashstartsregex'),
|
| 296 |
+
(r'[0-9]+\.[0-9]+([eE][0-9]+)?[fd]?(?:[a-zA-Z_]+)?', Number.Float),
|
| 297 |
+
(r'[0-9]+(~[0-9a-z]+)?(?:[a-zA-Z_]+)?', Number.Integer),
|
| 298 |
+
('"""', String, 'tdqs'),
|
| 299 |
+
("'''", String, 'tsqs'),
|
| 300 |
+
('"', String, 'dqs'),
|
| 301 |
+
("'", String, 'sqs'),
|
| 302 |
+
(r'\\\S+', String),
|
| 303 |
+
(r'<\[.*?\]>', String),
|
| 304 |
+
],
|
| 305 |
+
'strings': [
|
| 306 |
+
(r'[^#\\\'"]+', String),
|
| 307 |
+
# note that all coffee script strings are multi-line.
|
| 308 |
+
# hashmarks, quotes and backslashes must be parsed one at a time
|
| 309 |
+
],
|
| 310 |
+
'interpoling_string': [
|
| 311 |
+
(r'\}', String.Interpol, "#pop"),
|
| 312 |
+
include('root')
|
| 313 |
+
],
|
| 314 |
+
'dqs': [
|
| 315 |
+
(r'"', String, '#pop'),
|
| 316 |
+
(r'\\.|\'', String), # double-quoted string don't need ' escapes
|
| 317 |
+
(r'#\{', String.Interpol, "interpoling_string"),
|
| 318 |
+
(r'#', String),
|
| 319 |
+
include('strings')
|
| 320 |
+
],
|
| 321 |
+
'sqs': [
|
| 322 |
+
(r"'", String, '#pop'),
|
| 323 |
+
(r'#|\\.|"', String), # single quoted strings don't need " escapses
|
| 324 |
+
include('strings')
|
| 325 |
+
],
|
| 326 |
+
'tdqs': [
|
| 327 |
+
(r'"""', String, '#pop'),
|
| 328 |
+
(r'\\.|\'|"', String), # no need to escape quotes in triple-string
|
| 329 |
+
(r'#\{', String.Interpol, "interpoling_string"),
|
| 330 |
+
(r'#', String),
|
| 331 |
+
include('strings'),
|
| 332 |
+
],
|
| 333 |
+
'tsqs': [
|
| 334 |
+
(r"'''", String, '#pop'),
|
| 335 |
+
(r'#|\\.|\'|"', String), # no need to escape quotes in triple-strings
|
| 336 |
+
include('strings')
|
| 337 |
+
],
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
class DartLexer(RegexLexer):
|
| 342 |
+
"""
|
| 343 |
+
For `Dart <http://dartlang.org/>`_ source code.
|
| 344 |
+
|
| 345 |
+
.. versionadded:: 1.5
|
| 346 |
+
"""
|
| 347 |
+
|
| 348 |
+
name = 'Dart'
|
| 349 |
+
aliases = ['dart']
|
| 350 |
+
filenames = ['*.dart']
|
| 351 |
+
mimetypes = ['text/x-dart']
|
| 352 |
+
|
| 353 |
+
flags = re.MULTILINE | re.DOTALL
|
| 354 |
+
|
| 355 |
+
tokens = {
|
| 356 |
+
'root': [
|
| 357 |
+
include('string_literal'),
|
| 358 |
+
(r'#!(.*?)$', Comment.Preproc),
|
| 359 |
+
(r'\b(import|export)\b', Keyword, 'import_decl'),
|
| 360 |
+
(r'\b(library|source|part of|part)\b', Keyword),
|
| 361 |
+
(r'[^\S\n]+', Text),
|
| 362 |
+
(r'//.*?\n', Comment.Single),
|
| 363 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 364 |
+
(r'\b(class)\b(\s+)',
|
| 365 |
+
bygroups(Keyword.Declaration, Text), 'class'),
|
| 366 |
+
(r'\b(assert|break|case|catch|continue|default|do|else|finally|for|'
|
| 367 |
+
r'if|in|is|new|return|super|switch|this|throw|try|while)\b',
|
| 368 |
+
Keyword),
|
| 369 |
+
(r'\b(abstract|async|await|const|extends|factory|final|get|'
|
| 370 |
+
r'implements|native|operator|set|static|sync|typedef|var|with|'
|
| 371 |
+
r'yield)\b', Keyword.Declaration),
|
| 372 |
+
(r'\b(bool|double|dynamic|int|num|Object|String|void)\b', Keyword.Type),
|
| 373 |
+
(r'\b(false|null|true)\b', Keyword.Constant),
|
| 374 |
+
(r'[~!%^&*+=|?:<>/-]|as\b', Operator),
|
| 375 |
+
(r'[a-zA-Z_$]\w*:', Name.Label),
|
| 376 |
+
(r'[a-zA-Z_$]\w*', Name),
|
| 377 |
+
(r'[(){}\[\],.;]', Punctuation),
|
| 378 |
+
(r'0[xX][0-9a-fA-F]+', Number.Hex),
|
| 379 |
+
# DIGIT+ (‘.’ DIGIT*)? EXPONENT?
|
| 380 |
+
(r'\d+(\.\d*)?([eE][+-]?\d+)?', Number),
|
| 381 |
+
(r'\.\d+([eE][+-]?\d+)?', Number), # ‘.’ DIGIT+ EXPONENT?
|
| 382 |
+
(r'\n', Text)
|
| 383 |
+
# pseudo-keyword negate intentionally left out
|
| 384 |
+
],
|
| 385 |
+
'class': [
|
| 386 |
+
(r'[a-zA-Z_$]\w*', Name.Class, '#pop')
|
| 387 |
+
],
|
| 388 |
+
'import_decl': [
|
| 389 |
+
include('string_literal'),
|
| 390 |
+
(r'\s+', Text),
|
| 391 |
+
(r'\b(as|show|hide)\b', Keyword),
|
| 392 |
+
(r'[a-zA-Z_$]\w*', Name),
|
| 393 |
+
(r'\,', Punctuation),
|
| 394 |
+
(r'\;', Punctuation, '#pop')
|
| 395 |
+
],
|
| 396 |
+
'string_literal': [
|
| 397 |
+
# Raw strings.
|
| 398 |
+
(r'r"""([\w\W]*?)"""', String.Double),
|
| 399 |
+
(r"r'''([\w\W]*?)'''", String.Single),
|
| 400 |
+
(r'r"(.*?)"', String.Double),
|
| 401 |
+
(r"r'(.*?)'", String.Single),
|
| 402 |
+
# Normal Strings.
|
| 403 |
+
(r'"""', String.Double, 'string_double_multiline'),
|
| 404 |
+
(r"'''", String.Single, 'string_single_multiline'),
|
| 405 |
+
(r'"', String.Double, 'string_double'),
|
| 406 |
+
(r"'", String.Single, 'string_single')
|
| 407 |
+
],
|
| 408 |
+
'string_common': [
|
| 409 |
+
(r"\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]*\}|[a-z'\"$\\])",
|
| 410 |
+
String.Escape),
|
| 411 |
+
(r'(\$)([a-zA-Z_]\w*)', bygroups(String.Interpol, Name)),
|
| 412 |
+
(r'(\$\{)(.*?)(\})',
|
| 413 |
+
bygroups(String.Interpol, using(this), String.Interpol))
|
| 414 |
+
],
|
| 415 |
+
'string_double': [
|
| 416 |
+
(r'"', String.Double, '#pop'),
|
| 417 |
+
(r'[^"$\\\n]+', String.Double),
|
| 418 |
+
include('string_common'),
|
| 419 |
+
(r'\$+', String.Double)
|
| 420 |
+
],
|
| 421 |
+
'string_double_multiline': [
|
| 422 |
+
(r'"""', String.Double, '#pop'),
|
| 423 |
+
(r'[^"$\\]+', String.Double),
|
| 424 |
+
include('string_common'),
|
| 425 |
+
(r'(\$|\")+', String.Double)
|
| 426 |
+
],
|
| 427 |
+
'string_single': [
|
| 428 |
+
(r"'", String.Single, '#pop'),
|
| 429 |
+
(r"[^'$\\\n]+", String.Single),
|
| 430 |
+
include('string_common'),
|
| 431 |
+
(r'\$+', String.Single)
|
| 432 |
+
],
|
| 433 |
+
'string_single_multiline': [
|
| 434 |
+
(r"'''", String.Single, '#pop'),
|
| 435 |
+
(r'[^\'$\\]+', String.Single),
|
| 436 |
+
include('string_common'),
|
| 437 |
+
(r'(\$|\')+', String.Single)
|
| 438 |
+
]
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
|
| 442 |
+
class TypeScriptLexer(RegexLexer):
|
| 443 |
+
"""
|
| 444 |
+
For `TypeScript <http://typescriptlang.org/>`_ source code.
|
| 445 |
+
|
| 446 |
+
.. versionadded:: 1.6
|
| 447 |
+
"""
|
| 448 |
+
|
| 449 |
+
name = 'TypeScript'
|
| 450 |
+
aliases = ['ts', 'typescript']
|
| 451 |
+
filenames = ['*.ts', '*.tsx']
|
| 452 |
+
mimetypes = ['text/x-typescript']
|
| 453 |
+
|
| 454 |
+
flags = re.DOTALL | re.MULTILINE
|
| 455 |
+
|
| 456 |
+
tokens = {
|
| 457 |
+
'commentsandwhitespace': [
|
| 458 |
+
(r'\s+', Text),
|
| 459 |
+
(r'<!--', Comment),
|
| 460 |
+
(r'//.*?\n', Comment.Single),
|
| 461 |
+
(r'/\*.*?\*/', Comment.Multiline)
|
| 462 |
+
],
|
| 463 |
+
'slashstartsregex': [
|
| 464 |
+
include('commentsandwhitespace'),
|
| 465 |
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
| 466 |
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
| 467 |
+
(r'(?=/)', Text, ('#pop', 'badregex')),
|
| 468 |
+
default('#pop')
|
| 469 |
+
],
|
| 470 |
+
'badregex': [
|
| 471 |
+
(r'\n', Text, '#pop')
|
| 472 |
+
],
|
| 473 |
+
'root': [
|
| 474 |
+
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
| 475 |
+
include('commentsandwhitespace'),
|
| 476 |
+
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
| 477 |
+
r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
|
| 478 |
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
| 479 |
+
(r'[})\].]', Punctuation),
|
| 480 |
+
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
|
| 481 |
+
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|'
|
| 482 |
+
r'this)\b', Keyword, 'slashstartsregex'),
|
| 483 |
+
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
| 484 |
+
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
|
| 485 |
+
r'extends|final|float|goto|implements|import|int|interface|long|native|'
|
| 486 |
+
r'package|private|protected|public|short|static|super|synchronized|throws|'
|
| 487 |
+
r'transient|volatile)\b', Keyword.Reserved),
|
| 488 |
+
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
|
| 489 |
+
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
| 490 |
+
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
| 491 |
+
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
| 492 |
+
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
| 493 |
+
r'window)\b', Name.Builtin),
|
| 494 |
+
# Match stuff like: module name {...}
|
| 495 |
+
(r'\b(module)(\s*)(\s*[\w?.$][\w?.$]*)(\s*)',
|
| 496 |
+
bygroups(Keyword.Reserved, Text, Name.Other, Text), 'slashstartsregex'),
|
| 497 |
+
# Match variable type keywords
|
| 498 |
+
(r'\b(string|bool|number)\b', Keyword.Type),
|
| 499 |
+
# Match stuff like: constructor
|
| 500 |
+
(r'\b(constructor|declare|interface|as|AS)\b', Keyword.Reserved),
|
| 501 |
+
# Match stuff like: super(argument, list)
|
| 502 |
+
(r'(super)(\s*)(\([\w,?.$\s]+\s*\))',
|
| 503 |
+
bygroups(Keyword.Reserved, Text), 'slashstartsregex'),
|
| 504 |
+
# Match stuff like: function() {...}
|
| 505 |
+
(r'([a-zA-Z_?.$][\w?.$]*)\(\) \{', Name.Other, 'slashstartsregex'),
|
| 506 |
+
# Match stuff like: (function: return type)
|
| 507 |
+
(r'([\w?.$][\w?.$]*)(\s*:\s*)([\w?.$][\w?.$]*)',
|
| 508 |
+
bygroups(Name.Other, Text, Keyword.Type)),
|
| 509 |
+
(r'[$a-zA-Z_]\w*', Name.Other),
|
| 510 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 511 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 512 |
+
(r'[0-9]+', Number.Integer),
|
| 513 |
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
| 514 |
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
| 515 |
+
(r'`', String.Backtick, 'interp'),
|
| 516 |
+
# Match stuff like: Decorators
|
| 517 |
+
(r'@\w+', Keyword.Declaration),
|
| 518 |
+
],
|
| 519 |
+
|
| 520 |
+
# The 'interp*' rules match those in JavascriptLexer. Changes made
|
| 521 |
+
# there should be reflected here as well.
|
| 522 |
+
'interp': [
|
| 523 |
+
(r'`', String.Backtick, '#pop'),
|
| 524 |
+
(r'\\\\', String.Backtick),
|
| 525 |
+
(r'\\`', String.Backtick),
|
| 526 |
+
(r'\$\{', String.Interpol, 'interp-inside'),
|
| 527 |
+
(r'\$', String.Backtick),
|
| 528 |
+
(r'[^`\\$]+', String.Backtick),
|
| 529 |
+
],
|
| 530 |
+
'interp-inside': [
|
| 531 |
+
# TODO: should this include single-line comments and allow nesting strings?
|
| 532 |
+
(r'\}', String.Interpol, '#pop'),
|
| 533 |
+
include('root'),
|
| 534 |
+
],
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
def analyse_text(text):
|
| 538 |
+
if re.search('^(import.+(from\s+)?["\']|'
|
| 539 |
+
'(export\s*)?(interface|class|function)\s+)',
|
| 540 |
+
text, re.MULTILINE):
|
| 541 |
+
return 1.0
|
| 542 |
+
|
| 543 |
+
|
| 544 |
+
class LassoLexer(RegexLexer):
|
| 545 |
+
"""
|
| 546 |
+
For `Lasso <http://www.lassosoft.com/>`_ source code, covering both Lasso 9
|
| 547 |
+
syntax and LassoScript for Lasso 8.6 and earlier. For Lasso embedded in
|
| 548 |
+
HTML, use the `LassoHtmlLexer`.
|
| 549 |
+
|
| 550 |
+
Additional options accepted:
|
| 551 |
+
|
| 552 |
+
`builtinshighlighting`
|
| 553 |
+
If given and ``True``, highlight builtin types, traits, methods, and
|
| 554 |
+
members (default: ``True``).
|
| 555 |
+
`requiredelimiters`
|
| 556 |
+
If given and ``True``, only highlight code between delimiters as Lasso
|
| 557 |
+
(default: ``False``).
|
| 558 |
+
|
| 559 |
+
.. versionadded:: 1.6
|
| 560 |
+
"""
|
| 561 |
+
|
| 562 |
+
name = 'Lasso'
|
| 563 |
+
aliases = ['lasso', 'lassoscript']
|
| 564 |
+
filenames = ['*.lasso', '*.lasso[89]']
|
| 565 |
+
alias_filenames = ['*.incl', '*.inc', '*.las']
|
| 566 |
+
mimetypes = ['text/x-lasso']
|
| 567 |
+
flags = re.IGNORECASE | re.DOTALL | re.MULTILINE
|
| 568 |
+
|
| 569 |
+
tokens = {
|
| 570 |
+
'root': [
|
| 571 |
+
(r'^#![ \S]+lasso9\b', Comment.Preproc, 'lasso'),
|
| 572 |
+
(r'(?=\[|<)', Other, 'delimiters'),
|
| 573 |
+
(r'\s+', Other),
|
| 574 |
+
default(('delimiters', 'lassofile')),
|
| 575 |
+
],
|
| 576 |
+
'delimiters': [
|
| 577 |
+
(r'\[no_square_brackets\]', Comment.Preproc, 'nosquarebrackets'),
|
| 578 |
+
(r'\[noprocess\]', Comment.Preproc, 'noprocess'),
|
| 579 |
+
(r'\[', Comment.Preproc, 'squarebrackets'),
|
| 580 |
+
(r'<\?(lasso(script)?|=)', Comment.Preproc, 'anglebrackets'),
|
| 581 |
+
(r'<(!--.*?-->)?', Other),
|
| 582 |
+
(r'[^[<]+', Other),
|
| 583 |
+
],
|
| 584 |
+
'nosquarebrackets': [
|
| 585 |
+
(r'\[noprocess\]', Comment.Preproc, 'noprocess'),
|
| 586 |
+
(r'\[', Other),
|
| 587 |
+
(r'<\?(lasso(script)?|=)', Comment.Preproc, 'anglebrackets'),
|
| 588 |
+
(r'<(!--.*?-->)?', Other),
|
| 589 |
+
(r'[^[<]+', Other),
|
| 590 |
+
],
|
| 591 |
+
'noprocess': [
|
| 592 |
+
(r'\[/noprocess\]', Comment.Preproc, '#pop'),
|
| 593 |
+
(r'\[', Other),
|
| 594 |
+
(r'[^[]', Other),
|
| 595 |
+
],
|
| 596 |
+
'squarebrackets': [
|
| 597 |
+
(r'\]', Comment.Preproc, '#pop'),
|
| 598 |
+
include('lasso'),
|
| 599 |
+
],
|
| 600 |
+
'anglebrackets': [
|
| 601 |
+
(r'\?>', Comment.Preproc, '#pop'),
|
| 602 |
+
include('lasso'),
|
| 603 |
+
],
|
| 604 |
+
'lassofile': [
|
| 605 |
+
(r'\]|\?>', Comment.Preproc, '#pop'),
|
| 606 |
+
include('lasso'),
|
| 607 |
+
],
|
| 608 |
+
'whitespacecomments': [
|
| 609 |
+
(r'\s+', Text),
|
| 610 |
+
(r'//.*?\n', Comment.Single),
|
| 611 |
+
(r'/\*\*!.*?\*/', String.Doc),
|
| 612 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 613 |
+
],
|
| 614 |
+
'lasso': [
|
| 615 |
+
# whitespace/comments
|
| 616 |
+
include('whitespacecomments'),
|
| 617 |
+
|
| 618 |
+
# literals
|
| 619 |
+
(r'\d*\.\d+(e[+-]?\d+)?', Number.Float),
|
| 620 |
+
(r'0x[\da-f]+', Number.Hex),
|
| 621 |
+
(r'\d+', Number.Integer),
|
| 622 |
+
(r'(infinity|NaN)\b', Number),
|
| 623 |
+
(r"'", String.Single, 'singlestring'),
|
| 624 |
+
(r'"', String.Double, 'doublestring'),
|
| 625 |
+
(r'`[^`]*`', String.Backtick),
|
| 626 |
+
|
| 627 |
+
# names
|
| 628 |
+
(r'\$[a-z_][\w.]*', Name.Variable),
|
| 629 |
+
(r'#([a-z_][\w.]*|\d+\b)', Name.Variable.Instance),
|
| 630 |
+
(r"(\.\s*)('[a-z_][\w.]*')",
|
| 631 |
+
bygroups(Name.Builtin.Pseudo, Name.Variable.Class)),
|
| 632 |
+
(r"(self)(\s*->\s*)('[a-z_][\w.]*')",
|
| 633 |
+
bygroups(Name.Builtin.Pseudo, Operator, Name.Variable.Class)),
|
| 634 |
+
(r'(\.\.?\s*)([a-z_][\w.]*(=(?!=))?)',
|
| 635 |
+
bygroups(Name.Builtin.Pseudo, Name.Other.Member)),
|
| 636 |
+
(r'(->\\?\s*|&\s*)([a-z_][\w.]*(=(?!=))?)',
|
| 637 |
+
bygroups(Operator, Name.Other.Member)),
|
| 638 |
+
(r'(?<!->)(self|inherited|currentcapture|givenblock)\b',
|
| 639 |
+
Name.Builtin.Pseudo),
|
| 640 |
+
(r'-(?!infinity)[a-z_][\w.]*', Name.Attribute),
|
| 641 |
+
(r'::\s*[a-z_][\w.]*', Name.Label),
|
| 642 |
+
(r'(error_(code|msg)_\w+|Error_AddError|Error_ColumnRestriction|'
|
| 643 |
+
r'Error_DatabaseConnectionUnavailable|Error_DatabaseTimeout|'
|
| 644 |
+
r'Error_DeleteError|Error_FieldRestriction|Error_FileNotFound|'
|
| 645 |
+
r'Error_InvalidDatabase|Error_InvalidPassword|'
|
| 646 |
+
r'Error_InvalidUsername|Error_ModuleNotFound|'
|
| 647 |
+
r'Error_NoError|Error_NoPermission|Error_OutOfMemory|'
|
| 648 |
+
r'Error_ReqColumnMissing|Error_ReqFieldMissing|'
|
| 649 |
+
r'Error_RequiredColumnMissing|Error_RequiredFieldMissing|'
|
| 650 |
+
r'Error_UpdateError)\b', Name.Exception),
|
| 651 |
+
|
| 652 |
+
# definitions
|
| 653 |
+
(r'(define)(\s+)([a-z_][\w.]*)(\s*=>\s*)(type|trait|thread)\b',
|
| 654 |
+
bygroups(Keyword.Declaration, Text, Name.Class, Operator, Keyword)),
|
| 655 |
+
(r'(define)(\s+)([a-z_][\w.]*)(\s*->\s*)([a-z_][\w.]*=?|[-+*/%])',
|
| 656 |
+
bygroups(Keyword.Declaration, Text, Name.Class, Operator,
|
| 657 |
+
Name.Function), 'signature'),
|
| 658 |
+
(r'(define)(\s+)([a-z_][\w.]*)',
|
| 659 |
+
bygroups(Keyword.Declaration, Text, Name.Function), 'signature'),
|
| 660 |
+
(r'(public|protected|private|provide)(\s+)(([a-z_][\w.]*=?|[-+*/%])'
|
| 661 |
+
r'(?=\s*\())', bygroups(Keyword, Text, Name.Function),
|
| 662 |
+
'signature'),
|
| 663 |
+
(r'(public|protected|private|provide)(\s+)([a-z_][\w.]*)',
|
| 664 |
+
bygroups(Keyword, Text, Name.Function)),
|
| 665 |
+
|
| 666 |
+
# keywords
|
| 667 |
+
(r'(true|false|none|minimal|full|all|void)\b', Keyword.Constant),
|
| 668 |
+
(r'(local|var|variable|global|data(?=\s))\b', Keyword.Declaration),
|
| 669 |
+
(r'(array|date|decimal|duration|integer|map|pair|string|tag|xml|'
|
| 670 |
+
r'null|boolean|bytes|keyword|list|locale|queue|set|stack|'
|
| 671 |
+
r'staticarray)\b', Keyword.Type),
|
| 672 |
+
(r'([a-z_][\w.]*)(\s+)(in)\b', bygroups(Name, Text, Keyword)),
|
| 673 |
+
(r'(let|into)(\s+)([a-z_][\w.]*)', bygroups(Keyword, Text, Name)),
|
| 674 |
+
(r'require\b', Keyword, 'requiresection'),
|
| 675 |
+
(r'(/?)(Namespace_Using)\b', bygroups(Punctuation, Keyword.Namespace)),
|
| 676 |
+
(r'(/?)(Cache|Database_Names|Database_SchemaNames|'
|
| 677 |
+
r'Database_TableNames|Define_Tag|Define_Type|Email_Batch|'
|
| 678 |
+
r'Encode_Set|HTML_Comment|Handle|Handle_Error|Header|If|Inline|'
|
| 679 |
+
r'Iterate|LJAX_Target|Link|Link_CurrentAction|Link_CurrentGroup|'
|
| 680 |
+
r'Link_CurrentRecord|Link_Detail|Link_FirstGroup|Link_FirstRecord|'
|
| 681 |
+
r'Link_LastGroup|Link_LastRecord|Link_NextGroup|Link_NextRecord|'
|
| 682 |
+
r'Link_PrevGroup|Link_PrevRecord|Log|Loop|Output_None|Portal|'
|
| 683 |
+
r'Private|Protect|Records|Referer|Referrer|Repeating|ResultSet|'
|
| 684 |
+
r'Rows|Search_Args|Search_Arguments|Select|Sort_Args|'
|
| 685 |
+
r'Sort_Arguments|Thread_Atomic|Value_List|While|Abort|Case|Else|'
|
| 686 |
+
r'Fail_If|Fail_IfNot|Fail|If_Empty|If_False|If_Null|If_True|'
|
| 687 |
+
r'Loop_Abort|Loop_Continue|Loop_Count|Params|Params_Up|Return|'
|
| 688 |
+
r'Return_Value|Run_Children|SOAP_DefineTag|SOAP_LastRequest|'
|
| 689 |
+
r'SOAP_LastResponse|Tag_Name|ascending|average|by|define|'
|
| 690 |
+
r'descending|do|equals|frozen|group|handle_failure|import|in|into|'
|
| 691 |
+
r'join|let|match|max|min|on|order|parent|protected|provide|public|'
|
| 692 |
+
r'require|returnhome|skip|split_thread|sum|take|thread|to|trait|'
|
| 693 |
+
r'type|where|with|yield|yieldhome)\b',
|
| 694 |
+
bygroups(Punctuation, Keyword)),
|
| 695 |
+
|
| 696 |
+
# other
|
| 697 |
+
(r',', Punctuation, 'commamember'),
|
| 698 |
+
(r'(and|or|not)\b', Operator.Word),
|
| 699 |
+
(r'([a-z_][\w.]*)(\s*::\s*[a-z_][\w.]*)?(\s*=(?!=))',
|
| 700 |
+
bygroups(Name, Name.Label, Operator)),
|
| 701 |
+
(r'(/?)([\w.]+)', bygroups(Punctuation, Name.Other)),
|
| 702 |
+
(r'(=)(n?bw|n?ew|n?cn|lte?|gte?|n?eq|n?rx|ft)\b',
|
| 703 |
+
bygroups(Operator, Operator.Word)),
|
| 704 |
+
(r':=|[-+*/%=<>&|!?\\]+', Operator),
|
| 705 |
+
(r'[{}():;,@^]', Punctuation),
|
| 706 |
+
],
|
| 707 |
+
'singlestring': [
|
| 708 |
+
(r"'", String.Single, '#pop'),
|
| 709 |
+
(r"[^'\\]+", String.Single),
|
| 710 |
+
include('escape'),
|
| 711 |
+
(r"\\", String.Single),
|
| 712 |
+
],
|
| 713 |
+
'doublestring': [
|
| 714 |
+
(r'"', String.Double, '#pop'),
|
| 715 |
+
(r'[^"\\]+', String.Double),
|
| 716 |
+
include('escape'),
|
| 717 |
+
(r'\\', String.Double),
|
| 718 |
+
],
|
| 719 |
+
'escape': [
|
| 720 |
+
(r'\\(U[\da-f]{8}|u[\da-f]{4}|x[\da-f]{1,2}|[0-7]{1,3}|:[^:\n\r]+:|'
|
| 721 |
+
r'[abefnrtv?"\'\\]|$)', String.Escape),
|
| 722 |
+
],
|
| 723 |
+
'signature': [
|
| 724 |
+
(r'=>', Operator, '#pop'),
|
| 725 |
+
(r'\)', Punctuation, '#pop'),
|
| 726 |
+
(r'[(,]', Punctuation, 'parameter'),
|
| 727 |
+
include('lasso'),
|
| 728 |
+
],
|
| 729 |
+
'parameter': [
|
| 730 |
+
(r'\)', Punctuation, '#pop'),
|
| 731 |
+
(r'-?[a-z_][\w.]*', Name.Attribute, '#pop'),
|
| 732 |
+
(r'\.\.\.', Name.Builtin.Pseudo),
|
| 733 |
+
include('lasso'),
|
| 734 |
+
],
|
| 735 |
+
'requiresection': [
|
| 736 |
+
(r'(([a-z_][\w.]*=?|[-+*/%])(?=\s*\())', Name, 'requiresignature'),
|
| 737 |
+
(r'(([a-z_][\w.]*=?|[-+*/%])(?=(\s*::\s*[\w.]+)?\s*,))', Name),
|
| 738 |
+
(r'[a-z_][\w.]*=?|[-+*/%]', Name, '#pop'),
|
| 739 |
+
(r'::\s*[a-z_][\w.]*', Name.Label),
|
| 740 |
+
(r',', Punctuation),
|
| 741 |
+
include('whitespacecomments'),
|
| 742 |
+
],
|
| 743 |
+
'requiresignature': [
|
| 744 |
+
(r'(\)(?=(\s*::\s*[\w.]+)?\s*,))', Punctuation, '#pop'),
|
| 745 |
+
(r'\)', Punctuation, '#pop:2'),
|
| 746 |
+
(r'-?[a-z_][\w.]*', Name.Attribute),
|
| 747 |
+
(r'::\s*[a-z_][\w.]*', Name.Label),
|
| 748 |
+
(r'\.\.\.', Name.Builtin.Pseudo),
|
| 749 |
+
(r'[(,]', Punctuation),
|
| 750 |
+
include('whitespacecomments'),
|
| 751 |
+
],
|
| 752 |
+
'commamember': [
|
| 753 |
+
(r'(([a-z_][\w.]*=?|[-+*/%])'
|
| 754 |
+
r'(?=\s*(\(([^()]*\([^()]*\))*[^)]*\)\s*)?(::[\w.\s]+)?=>))',
|
| 755 |
+
Name.Function, 'signature'),
|
| 756 |
+
include('whitespacecomments'),
|
| 757 |
+
default('#pop'),
|
| 758 |
+
],
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
def __init__(self, **options):
|
| 762 |
+
self.builtinshighlighting = get_bool_opt(
|
| 763 |
+
options, 'builtinshighlighting', True)
|
| 764 |
+
self.requiredelimiters = get_bool_opt(
|
| 765 |
+
options, 'requiredelimiters', False)
|
| 766 |
+
|
| 767 |
+
self._builtins = set()
|
| 768 |
+
self._members = set()
|
| 769 |
+
if self.builtinshighlighting:
|
| 770 |
+
from pygments.lexers._lasso_builtins import BUILTINS, MEMBERS
|
| 771 |
+
for key, value in iteritems(BUILTINS):
|
| 772 |
+
self._builtins.update(value)
|
| 773 |
+
for key, value in iteritems(MEMBERS):
|
| 774 |
+
self._members.update(value)
|
| 775 |
+
RegexLexer.__init__(self, **options)
|
| 776 |
+
|
| 777 |
+
def get_tokens_unprocessed(self, text):
|
| 778 |
+
stack = ['root']
|
| 779 |
+
if self.requiredelimiters:
|
| 780 |
+
stack.append('delimiters')
|
| 781 |
+
for index, token, value in \
|
| 782 |
+
RegexLexer.get_tokens_unprocessed(self, text, stack):
|
| 783 |
+
if (token is Name.Other and value.lower() in self._builtins or
|
| 784 |
+
token is Name.Other.Member and
|
| 785 |
+
value.lower().rstrip('=') in self._members):
|
| 786 |
+
yield index, Name.Builtin, value
|
| 787 |
+
continue
|
| 788 |
+
yield index, token, value
|
| 789 |
+
|
| 790 |
+
def analyse_text(text):
|
| 791 |
+
rv = 0.0
|
| 792 |
+
if 'bin/lasso9' in text:
|
| 793 |
+
rv += 0.8
|
| 794 |
+
if re.search(r'<\?lasso', text, re.I):
|
| 795 |
+
rv += 0.4
|
| 796 |
+
if re.search(r'local\(', text, re.I):
|
| 797 |
+
rv += 0.4
|
| 798 |
+
return rv
|
| 799 |
+
|
| 800 |
+
|
| 801 |
+
class ObjectiveJLexer(RegexLexer):
|
| 802 |
+
"""
|
| 803 |
+
For Objective-J source code with preprocessor directives.
|
| 804 |
+
|
| 805 |
+
.. versionadded:: 1.3
|
| 806 |
+
"""
|
| 807 |
+
|
| 808 |
+
name = 'Objective-J'
|
| 809 |
+
aliases = ['objective-j', 'objectivej', 'obj-j', 'objj']
|
| 810 |
+
filenames = ['*.j']
|
| 811 |
+
mimetypes = ['text/x-objective-j']
|
| 812 |
+
|
| 813 |
+
#: optional Comment or Whitespace
|
| 814 |
+
_ws = r'(?:\s|//.*?\n|/[*].*?[*]/)*'
|
| 815 |
+
|
| 816 |
+
flags = re.DOTALL | re.MULTILINE
|
| 817 |
+
|
| 818 |
+
tokens = {
|
| 819 |
+
'root': [
|
| 820 |
+
include('whitespace'),
|
| 821 |
+
|
| 822 |
+
# function definition
|
| 823 |
+
(r'^(' + _ws + r'[+-]' + _ws + r')([(a-zA-Z_].*?[^(])(' + _ws + r'\{)',
|
| 824 |
+
bygroups(using(this), using(this, state='function_signature'),
|
| 825 |
+
using(this))),
|
| 826 |
+
|
| 827 |
+
# class definition
|
| 828 |
+
(r'(@interface|@implementation)(\s+)', bygroups(Keyword, Text),
|
| 829 |
+
'classname'),
|
| 830 |
+
(r'(@class|@protocol)(\s*)', bygroups(Keyword, Text),
|
| 831 |
+
'forward_classname'),
|
| 832 |
+
(r'(\s*)(@end)(\s*)', bygroups(Text, Keyword, Text)),
|
| 833 |
+
|
| 834 |
+
include('statements'),
|
| 835 |
+
('[{()}]', Punctuation),
|
| 836 |
+
(';', Punctuation),
|
| 837 |
+
],
|
| 838 |
+
'whitespace': [
|
| 839 |
+
(r'(@import)(\s+)("(?:\\\\|\\"|[^"])*")',
|
| 840 |
+
bygroups(Comment.Preproc, Text, String.Double)),
|
| 841 |
+
(r'(@import)(\s+)(<(?:\\\\|\\>|[^>])*>)',
|
| 842 |
+
bygroups(Comment.Preproc, Text, String.Double)),
|
| 843 |
+
(r'(#(?:include|import))(\s+)("(?:\\\\|\\"|[^"])*")',
|
| 844 |
+
bygroups(Comment.Preproc, Text, String.Double)),
|
| 845 |
+
(r'(#(?:include|import))(\s+)(<(?:\\\\|\\>|[^>])*>)',
|
| 846 |
+
bygroups(Comment.Preproc, Text, String.Double)),
|
| 847 |
+
|
| 848 |
+
(r'#if\s+0', Comment.Preproc, 'if0'),
|
| 849 |
+
(r'#', Comment.Preproc, 'macro'),
|
| 850 |
+
|
| 851 |
+
(r'\n', Text),
|
| 852 |
+
(r'\s+', Text),
|
| 853 |
+
(r'\\\n', Text), # line continuation
|
| 854 |
+
(r'//(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
| 855 |
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
| 856 |
+
(r'<!--', Comment),
|
| 857 |
+
],
|
| 858 |
+
'slashstartsregex': [
|
| 859 |
+
include('whitespace'),
|
| 860 |
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
| 861 |
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
| 862 |
+
(r'(?=/)', Text, ('#pop', 'badregex')),
|
| 863 |
+
default('#pop'),
|
| 864 |
+
],
|
| 865 |
+
'badregex': [
|
| 866 |
+
(r'\n', Text, '#pop'),
|
| 867 |
+
],
|
| 868 |
+
'statements': [
|
| 869 |
+
(r'(L|@)?"', String, 'string'),
|
| 870 |
+
(r"(L|@)?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'",
|
| 871 |
+
String.Char),
|
| 872 |
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
| 873 |
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
| 874 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
|
| 875 |
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
| 876 |
+
(r'0x[0-9a-fA-F]+[Ll]?', Number.Hex),
|
| 877 |
+
(r'0[0-7]+[Ll]?', Number.Oct),
|
| 878 |
+
(r'\d+[Ll]?', Number.Integer),
|
| 879 |
+
|
| 880 |
+
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
| 881 |
+
|
| 882 |
+
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
| 883 |
+
r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?',
|
| 884 |
+
Operator, 'slashstartsregex'),
|
| 885 |
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
| 886 |
+
(r'[})\].]', Punctuation),
|
| 887 |
+
|
| 888 |
+
(r'(for|in|while|do|break|return|continue|switch|case|default|if|'
|
| 889 |
+
r'else|throw|try|catch|finally|new|delete|typeof|instanceof|void|'
|
| 890 |
+
r'prototype|__proto__)\b', Keyword, 'slashstartsregex'),
|
| 891 |
+
|
| 892 |
+
(r'(var|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
| 893 |
+
|
| 894 |
+
(r'(@selector|@private|@protected|@public|@encode|'
|
| 895 |
+
r'@synchronized|@try|@throw|@catch|@finally|@end|@property|'
|
| 896 |
+
r'@synthesize|@dynamic|@for|@accessors|new)\b', Keyword),
|
| 897 |
+
|
| 898 |
+
(r'(int|long|float|short|double|char|unsigned|signed|void|'
|
| 899 |
+
r'id|BOOL|bool|boolean|IBOutlet|IBAction|SEL|@outlet|@action)\b',
|
| 900 |
+
Keyword.Type),
|
| 901 |
+
|
| 902 |
+
(r'(self|super)\b', Name.Builtin),
|
| 903 |
+
|
| 904 |
+
(r'(TRUE|YES|FALSE|NO|Nil|nil|NULL)\b', Keyword.Constant),
|
| 905 |
+
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
|
| 906 |
+
(r'(ABS|ASIN|ACOS|ATAN|ATAN2|SIN|COS|TAN|EXP|POW|CEIL|FLOOR|ROUND|'
|
| 907 |
+
r'MIN|MAX|RAND|SQRT|E|LN2|LN10|LOG2E|LOG10E|PI|PI2|PI_2|SQRT1_2|'
|
| 908 |
+
r'SQRT2)\b', Keyword.Constant),
|
| 909 |
+
|
| 910 |
+
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
| 911 |
+
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
| 912 |
+
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
| 913 |
+
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
| 914 |
+
r'window)\b', Name.Builtin),
|
| 915 |
+
|
| 916 |
+
(r'([$a-zA-Z_]\w*)(' + _ws + r')(?=\()',
|
| 917 |
+
bygroups(Name.Function, using(this))),
|
| 918 |
+
|
| 919 |
+
(r'[$a-zA-Z_]\w*', Name),
|
| 920 |
+
],
|
| 921 |
+
'classname': [
|
| 922 |
+
# interface definition that inherits
|
| 923 |
+
(r'([a-zA-Z_]\w*)(' + _ws + r':' + _ws +
|
| 924 |
+
r')([a-zA-Z_]\w*)?',
|
| 925 |
+
bygroups(Name.Class, using(this), Name.Class), '#pop'),
|
| 926 |
+
# interface definition for a category
|
| 927 |
+
(r'([a-zA-Z_]\w*)(' + _ws + r'\()([a-zA-Z_]\w*)(\))',
|
| 928 |
+
bygroups(Name.Class, using(this), Name.Label, Text), '#pop'),
|
| 929 |
+
# simple interface / implementation
|
| 930 |
+
(r'([a-zA-Z_]\w*)', Name.Class, '#pop'),
|
| 931 |
+
],
|
| 932 |
+
'forward_classname': [
|
| 933 |
+
(r'([a-zA-Z_]\w*)(\s*,\s*)',
|
| 934 |
+
bygroups(Name.Class, Text), '#push'),
|
| 935 |
+
(r'([a-zA-Z_]\w*)(\s*;?)',
|
| 936 |
+
bygroups(Name.Class, Text), '#pop'),
|
| 937 |
+
],
|
| 938 |
+
'function_signature': [
|
| 939 |
+
include('whitespace'),
|
| 940 |
+
|
| 941 |
+
# start of a selector w/ parameters
|
| 942 |
+
(r'(\(' + _ws + r')' # open paren
|
| 943 |
+
r'([a-zA-Z_]\w+)' # return type
|
| 944 |
+
r'(' + _ws + r'\)' + _ws + r')' # close paren
|
| 945 |
+
r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
|
| 946 |
+
bygroups(using(this), Keyword.Type, using(this),
|
| 947 |
+
Name.Function), 'function_parameters'),
|
| 948 |
+
|
| 949 |
+
# no-param function
|
| 950 |
+
(r'(\(' + _ws + r')' # open paren
|
| 951 |
+
r'([a-zA-Z_]\w+)' # return type
|
| 952 |
+
r'(' + _ws + r'\)' + _ws + r')' # close paren
|
| 953 |
+
r'([$a-zA-Z_]\w+)', # function name
|
| 954 |
+
bygroups(using(this), Keyword.Type, using(this),
|
| 955 |
+
Name.Function), "#pop"),
|
| 956 |
+
|
| 957 |
+
# no return type given, start of a selector w/ parameters
|
| 958 |
+
(r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
|
| 959 |
+
bygroups(Name.Function), 'function_parameters'),
|
| 960 |
+
|
| 961 |
+
# no return type given, no-param function
|
| 962 |
+
(r'([$a-zA-Z_]\w+)', # function name
|
| 963 |
+
bygroups(Name.Function), "#pop"),
|
| 964 |
+
|
| 965 |
+
default('#pop'),
|
| 966 |
+
],
|
| 967 |
+
'function_parameters': [
|
| 968 |
+
include('whitespace'),
|
| 969 |
+
|
| 970 |
+
# parameters
|
| 971 |
+
(r'(\(' + _ws + ')' # open paren
|
| 972 |
+
r'([^)]+)' # type
|
| 973 |
+
r'(' + _ws + r'\)' + _ws + r')' # close paren
|
| 974 |
+
r'([$a-zA-Z_]\w+)', # param name
|
| 975 |
+
bygroups(using(this), Keyword.Type, using(this), Text)),
|
| 976 |
+
|
| 977 |
+
# one piece of a selector name
|
| 978 |
+
(r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
|
| 979 |
+
Name.Function),
|
| 980 |
+
|
| 981 |
+
# smallest possible selector piece
|
| 982 |
+
(r'(:)', Name.Function),
|
| 983 |
+
|
| 984 |
+
# var args
|
| 985 |
+
(r'(,' + _ws + r'\.\.\.)', using(this)),
|
| 986 |
+
|
| 987 |
+
# param name
|
| 988 |
+
(r'([$a-zA-Z_]\w+)', Text),
|
| 989 |
+
],
|
| 990 |
+
'expression': [
|
| 991 |
+
(r'([$a-zA-Z_]\w*)(\()', bygroups(Name.Function,
|
| 992 |
+
Punctuation)),
|
| 993 |
+
(r'(\))', Punctuation, "#pop"),
|
| 994 |
+
],
|
| 995 |
+
'string': [
|
| 996 |
+
(r'"', String, '#pop'),
|
| 997 |
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
| 998 |
+
(r'[^\\"\n]+', String), # all other characters
|
| 999 |
+
(r'\\\n', String), # line continuation
|
| 1000 |
+
(r'\\', String), # stray backslash
|
| 1001 |
+
],
|
| 1002 |
+
'macro': [
|
| 1003 |
+
(r'[^/\n]+', Comment.Preproc),
|
| 1004 |
+
(r'/[*](.|\n)*?[*]/', Comment.Multiline),
|
| 1005 |
+
(r'//.*?\n', Comment.Single, '#pop'),
|
| 1006 |
+
(r'/', Comment.Preproc),
|
| 1007 |
+
(r'(?<=\\)\n', Comment.Preproc),
|
| 1008 |
+
(r'\n', Comment.Preproc, '#pop'),
|
| 1009 |
+
],
|
| 1010 |
+
'if0': [
|
| 1011 |
+
(r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
|
| 1012 |
+
(r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
|
| 1013 |
+
(r'.*?\n', Comment),
|
| 1014 |
+
]
|
| 1015 |
+
}
|
| 1016 |
+
|
| 1017 |
+
def analyse_text(text):
|
| 1018 |
+
if re.search('^\s*@import\s+[<"]', text, re.MULTILINE):
|
| 1019 |
+
# special directive found in most Objective-J files
|
| 1020 |
+
return True
|
| 1021 |
+
return False
|
| 1022 |
+
|
| 1023 |
+
|
| 1024 |
+
class CoffeeScriptLexer(RegexLexer):
|
| 1025 |
+
"""
|
| 1026 |
+
For `CoffeeScript`_ source code.
|
| 1027 |
+
|
| 1028 |
+
.. _CoffeeScript: http://coffeescript.org
|
| 1029 |
+
|
| 1030 |
+
.. versionadded:: 1.3
|
| 1031 |
+
"""
|
| 1032 |
+
|
| 1033 |
+
name = 'CoffeeScript'
|
| 1034 |
+
aliases = ['coffee-script', 'coffeescript', 'coffee']
|
| 1035 |
+
filenames = ['*.coffee']
|
| 1036 |
+
mimetypes = ['text/coffeescript']
|
| 1037 |
+
|
| 1038 |
+
|
| 1039 |
+
_operator_re = (
|
| 1040 |
+
r'\+\+|~|&&|\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|\?|:|'
|
| 1041 |
+
r'\|\||\\(?=\n)|'
|
| 1042 |
+
r'(<<|>>>?|==?(?!>)|!=?|=(?!>)|-(?!>)|[<>+*`%&\|\^/])=?')
|
| 1043 |
+
|
| 1044 |
+
flags = re.DOTALL
|
| 1045 |
+
tokens = {
|
| 1046 |
+
'commentsandwhitespace': [
|
| 1047 |
+
(r'\s+', Text),
|
| 1048 |
+
(r'###[^#].*?###', Comment.Multiline),
|
| 1049 |
+
(r'#(?!##[^#]).*?\n', Comment.Single),
|
| 1050 |
+
],
|
| 1051 |
+
'multilineregex': [
|
| 1052 |
+
(r'[^/#]+', String.Regex),
|
| 1053 |
+
(r'///([gim]+\b|\B)', String.Regex, '#pop'),
|
| 1054 |
+
(r'#\{', String.Interpol, 'interpoling_string'),
|
| 1055 |
+
(r'[/#]', String.Regex),
|
| 1056 |
+
],
|
| 1057 |
+
'slashstartsregex': [
|
| 1058 |
+
include('commentsandwhitespace'),
|
| 1059 |
+
(r'///', String.Regex, ('#pop', 'multilineregex')),
|
| 1060 |
+
(r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
| 1061 |
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
| 1062 |
+
# This isn't really guarding against mishighlighting well-formed
|
| 1063 |
+
# code, just the ability to infinite-loop between root and
|
| 1064 |
+
# slashstartsregex.
|
| 1065 |
+
(r'/', Operator),
|
| 1066 |
+
default('#pop'),
|
| 1067 |
+
],
|
| 1068 |
+
'root': [
|
| 1069 |
+
include('commentsandwhitespace'),
|
| 1070 |
+
(r'^(?=\s|/)', Text, 'slashstartsregex'),
|
| 1071 |
+
(_operator_re, Operator, 'slashstartsregex'),
|
| 1072 |
+
(r'(?:\([^()]*\))?\s*[=-]>', Name.Function, 'slashstartsregex'),
|
| 1073 |
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
| 1074 |
+
(r'[})\].]', Punctuation),
|
| 1075 |
+
(r'(?<![.$])(for|own|in|of|while|until|'
|
| 1076 |
+
r'loop|break|return|continue|'
|
| 1077 |
+
r'switch|when|then|if|unless|else|'
|
| 1078 |
+
r'throw|try|catch|finally|new|delete|typeof|instanceof|super|'
|
| 1079 |
+
r'extends|this|class|by)\b', Keyword, 'slashstartsregex'),
|
| 1080 |
+
(r'(?<![.$])(true|false|yes|no|on|off|null|'
|
| 1081 |
+
r'NaN|Infinity|undefined)\b',
|
| 1082 |
+
Keyword.Constant),
|
| 1083 |
+
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
| 1084 |
+
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
| 1085 |
+
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
| 1086 |
+
r'eval|isFinite|isNaN|parseFloat|parseInt|document|window)\b',
|
| 1087 |
+
Name.Builtin),
|
| 1088 |
+
(r'[$a-zA-Z_][\w.:$]*\s*[:=]\s', Name.Variable,
|
| 1089 |
+
'slashstartsregex'),
|
| 1090 |
+
(r'@[$a-zA-Z_][\w.:$]*\s*[:=]\s', Name.Variable.Instance,
|
| 1091 |
+
'slashstartsregex'),
|
| 1092 |
+
(r'@', Name.Other, 'slashstartsregex'),
|
| 1093 |
+
(r'@?[$a-zA-Z_][\w$]*', Name.Other),
|
| 1094 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 1095 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 1096 |
+
(r'[0-9]+', Number.Integer),
|
| 1097 |
+
('"""', String, 'tdqs'),
|
| 1098 |
+
("'''", String, 'tsqs'),
|
| 1099 |
+
('"', String, 'dqs'),
|
| 1100 |
+
("'", String, 'sqs'),
|
| 1101 |
+
],
|
| 1102 |
+
'strings': [
|
| 1103 |
+
(r'[^#\\\'"]+', String),
|
| 1104 |
+
# note that all coffee script strings are multi-line.
|
| 1105 |
+
# hashmarks, quotes and backslashes must be parsed one at a time
|
| 1106 |
+
],
|
| 1107 |
+
'interpoling_string': [
|
| 1108 |
+
(r'\}', String.Interpol, "#pop"),
|
| 1109 |
+
include('root')
|
| 1110 |
+
],
|
| 1111 |
+
'dqs': [
|
| 1112 |
+
(r'"', String, '#pop'),
|
| 1113 |
+
(r'\\.|\'', String), # double-quoted string don't need ' escapes
|
| 1114 |
+
(r'#\{', String.Interpol, "interpoling_string"),
|
| 1115 |
+
(r'#', String),
|
| 1116 |
+
include('strings')
|
| 1117 |
+
],
|
| 1118 |
+
'sqs': [
|
| 1119 |
+
(r"'", String, '#pop'),
|
| 1120 |
+
(r'#|\\.|"', String), # single quoted strings don't need " escapses
|
| 1121 |
+
include('strings')
|
| 1122 |
+
],
|
| 1123 |
+
'tdqs': [
|
| 1124 |
+
(r'"""', String, '#pop'),
|
| 1125 |
+
(r'\\.|\'|"', String), # no need to escape quotes in triple-string
|
| 1126 |
+
(r'#\{', String.Interpol, "interpoling_string"),
|
| 1127 |
+
(r'#', String),
|
| 1128 |
+
include('strings'),
|
| 1129 |
+
],
|
| 1130 |
+
'tsqs': [
|
| 1131 |
+
(r"'''", String, '#pop'),
|
| 1132 |
+
(r'#|\\.|\'|"', String), # no need to escape quotes in triple-strings
|
| 1133 |
+
include('strings')
|
| 1134 |
+
],
|
| 1135 |
+
}
|
| 1136 |
+
|
| 1137 |
+
|
| 1138 |
+
class MaskLexer(RegexLexer):
|
| 1139 |
+
"""
|
| 1140 |
+
For `Mask <http://github.com/atmajs/MaskJS>`__ markup.
|
| 1141 |
+
|
| 1142 |
+
.. versionadded:: 2.0
|
| 1143 |
+
"""
|
| 1144 |
+
name = 'Mask'
|
| 1145 |
+
aliases = ['mask']
|
| 1146 |
+
filenames = ['*.mask']
|
| 1147 |
+
mimetypes = ['text/x-mask']
|
| 1148 |
+
|
| 1149 |
+
flags = re.MULTILINE | re.IGNORECASE | re.DOTALL
|
| 1150 |
+
tokens = {
|
| 1151 |
+
'root': [
|
| 1152 |
+
(r'\s+', Text),
|
| 1153 |
+
(r'//.*?\n', Comment.Single),
|
| 1154 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 1155 |
+
(r'[{};>]', Punctuation),
|
| 1156 |
+
(r"'''", String, 'string-trpl-single'),
|
| 1157 |
+
(r'"""', String, 'string-trpl-double'),
|
| 1158 |
+
(r"'", String, 'string-single'),
|
| 1159 |
+
(r'"', String, 'string-double'),
|
| 1160 |
+
(r'([\w-]+)', Name.Tag, 'node'),
|
| 1161 |
+
(r'([^.#;{>\s]+)', Name.Class, 'node'),
|
| 1162 |
+
(r'(#[\w-]+)', Name.Function, 'node'),
|
| 1163 |
+
(r'(\.[\w-]+)', Name.Variable.Class, 'node')
|
| 1164 |
+
],
|
| 1165 |
+
'string-base': [
|
| 1166 |
+
(r'\\.', String.Escape),
|
| 1167 |
+
(r'~\[', String.Interpol, 'interpolation'),
|
| 1168 |
+
(r'.', String.Single),
|
| 1169 |
+
],
|
| 1170 |
+
'string-single': [
|
| 1171 |
+
(r"'", String.Single, '#pop'),
|
| 1172 |
+
include('string-base')
|
| 1173 |
+
],
|
| 1174 |
+
'string-double': [
|
| 1175 |
+
(r'"', String.Single, '#pop'),
|
| 1176 |
+
include('string-base')
|
| 1177 |
+
],
|
| 1178 |
+
'string-trpl-single': [
|
| 1179 |
+
(r"'''", String.Single, '#pop'),
|
| 1180 |
+
include('string-base')
|
| 1181 |
+
],
|
| 1182 |
+
'string-trpl-double': [
|
| 1183 |
+
(r'"""', String.Single, '#pop'),
|
| 1184 |
+
include('string-base')
|
| 1185 |
+
],
|
| 1186 |
+
'interpolation': [
|
| 1187 |
+
(r'\]', String.Interpol, '#pop'),
|
| 1188 |
+
(r'\s*:', String.Interpol, 'expression'),
|
| 1189 |
+
(r'\s*\w+:', Name.Other),
|
| 1190 |
+
(r'[^\]]+', String.Interpol)
|
| 1191 |
+
],
|
| 1192 |
+
'expression': [
|
| 1193 |
+
(r'[^\]]+', using(JavascriptLexer), '#pop')
|
| 1194 |
+
],
|
| 1195 |
+
'node': [
|
| 1196 |
+
(r'\s+', Text),
|
| 1197 |
+
(r'\.', Name.Variable.Class, 'node-class'),
|
| 1198 |
+
(r'\#', Name.Function, 'node-id'),
|
| 1199 |
+
(r'style[ \t]*=', Name.Attribute, 'node-attr-style-value'),
|
| 1200 |
+
(r'[\w:-]+[ \t]*=', Name.Attribute, 'node-attr-value'),
|
| 1201 |
+
(r'[\w:-]+', Name.Attribute),
|
| 1202 |
+
(r'[>{;]', Punctuation, '#pop')
|
| 1203 |
+
],
|
| 1204 |
+
'node-class': [
|
| 1205 |
+
(r'[\w-]+', Name.Variable.Class),
|
| 1206 |
+
(r'~\[', String.Interpol, 'interpolation'),
|
| 1207 |
+
default('#pop')
|
| 1208 |
+
],
|
| 1209 |
+
'node-id': [
|
| 1210 |
+
(r'[\w-]+', Name.Function),
|
| 1211 |
+
(r'~\[', String.Interpol, 'interpolation'),
|
| 1212 |
+
default('#pop')
|
| 1213 |
+
],
|
| 1214 |
+
'node-attr-value': [
|
| 1215 |
+
(r'\s+', Text),
|
| 1216 |
+
(r'\w+', Name.Variable, '#pop'),
|
| 1217 |
+
(r"'", String, 'string-single-pop2'),
|
| 1218 |
+
(r'"', String, 'string-double-pop2'),
|
| 1219 |
+
default('#pop')
|
| 1220 |
+
],
|
| 1221 |
+
'node-attr-style-value': [
|
| 1222 |
+
(r'\s+', Text),
|
| 1223 |
+
(r"'", String.Single, 'css-single-end'),
|
| 1224 |
+
(r'"', String.Single, 'css-double-end'),
|
| 1225 |
+
include('node-attr-value')
|
| 1226 |
+
],
|
| 1227 |
+
'css-base': [
|
| 1228 |
+
(r'\s+', Text),
|
| 1229 |
+
(r";", Punctuation),
|
| 1230 |
+
(r"[\w\-]+\s*:", Name.Builtin)
|
| 1231 |
+
],
|
| 1232 |
+
'css-single-end': [
|
| 1233 |
+
include('css-base'),
|
| 1234 |
+
(r"'", String.Single, '#pop:2'),
|
| 1235 |
+
(r"[^;']+", Name.Entity)
|
| 1236 |
+
],
|
| 1237 |
+
'css-double-end': [
|
| 1238 |
+
include('css-base'),
|
| 1239 |
+
(r'"', String.Single, '#pop:2'),
|
| 1240 |
+
(r'[^;"]+', Name.Entity)
|
| 1241 |
+
],
|
| 1242 |
+
'string-single-pop2': [
|
| 1243 |
+
(r"'", String.Single, '#pop:2'),
|
| 1244 |
+
include('string-base')
|
| 1245 |
+
],
|
| 1246 |
+
'string-double-pop2': [
|
| 1247 |
+
(r'"', String.Single, '#pop:2'),
|
| 1248 |
+
include('string-base')
|
| 1249 |
+
],
|
| 1250 |
+
}
|
| 1251 |
+
|
| 1252 |
+
|
| 1253 |
+
class EarlGreyLexer(RegexLexer):
|
| 1254 |
+
"""
|
| 1255 |
+
For `Earl-Grey`_ source code.
|
| 1256 |
+
|
| 1257 |
+
.. _Earl-Grey: https://breuleux.github.io/earl-grey/
|
| 1258 |
+
|
| 1259 |
+
.. versionadded: 2.1
|
| 1260 |
+
"""
|
| 1261 |
+
|
| 1262 |
+
name = 'Earl Grey'
|
| 1263 |
+
aliases = ['earl-grey', 'earlgrey', 'eg']
|
| 1264 |
+
filenames = ['*.eg']
|
| 1265 |
+
mimetypes = ['text/x-earl-grey']
|
| 1266 |
+
|
| 1267 |
+
tokens = {
|
| 1268 |
+
'root': [
|
| 1269 |
+
(r'\n', Text),
|
| 1270 |
+
include('control'),
|
| 1271 |
+
(r'[^\S\n]+', Text),
|
| 1272 |
+
(r';;.*\n', Comment),
|
| 1273 |
+
(r'[\[\]{}:(),;]', Punctuation),
|
| 1274 |
+
(r'\\\n', Text),
|
| 1275 |
+
(r'\\', Text),
|
| 1276 |
+
include('errors'),
|
| 1277 |
+
(words((
|
| 1278 |
+
'with', 'where', 'when', 'and', 'not', 'or', 'in',
|
| 1279 |
+
'as', 'of', 'is'),
|
| 1280 |
+
prefix=r'(?<=\s|\[)', suffix=r'(?![\w$\-])'),
|
| 1281 |
+
Operator.Word),
|
| 1282 |
+
(r'[*@]?->', Name.Function),
|
| 1283 |
+
(r'[+\-*/~^<>%&|?!@#.]*=', Operator.Word),
|
| 1284 |
+
(r'\.{2,3}', Operator.Word), # Range Operator
|
| 1285 |
+
(r'([+*/~^<>&|?!]+)|([#\-](?=\s))|@@+(?=\s)|=+', Operator),
|
| 1286 |
+
(r'(?<![\w$\-])(var|let)(?:[^\w$])', Keyword.Declaration),
|
| 1287 |
+
include('keywords'),
|
| 1288 |
+
include('builtins'),
|
| 1289 |
+
include('assignment'),
|
| 1290 |
+
(r'''(?x)
|
| 1291 |
+
(?:()([a-zA-Z$_](?:[\w$\-]*[\w$])?)|
|
| 1292 |
+
(?<=[\s{\[(])(\.)([a-zA-Z$_](?:[\w$\-]*[\w$])?))
|
| 1293 |
+
(?=.*%)''',
|
| 1294 |
+
bygroups(Punctuation, Name.Tag, Punctuation, Name.Class.Start), 'dbs'),
|
| 1295 |
+
(r'[rR]?`', String.Backtick, 'bt'),
|
| 1296 |
+
(r'[rR]?```', String.Backtick, 'tbt'),
|
| 1297 |
+
(r'(?<=[\s\[{(,;])\.([a-zA-Z$_](?:[\w$\-]*[\w$])?)'
|
| 1298 |
+
r'(?=[\s\]}),;])', String.Symbol),
|
| 1299 |
+
include('nested'),
|
| 1300 |
+
(r'(?:[rR]|[rR]\.[gmi]{1,3})?"', String, combined('stringescape', 'dqs')),
|
| 1301 |
+
(r'(?:[rR]|[rR]\.[gmi]{1,3})?\'', String, combined('stringescape', 'sqs')),
|
| 1302 |
+
(r'"""', String, combined('stringescape', 'tdqs')),
|
| 1303 |
+
include('tuple'),
|
| 1304 |
+
include('import_paths'),
|
| 1305 |
+
include('name'),
|
| 1306 |
+
include('numbers'),
|
| 1307 |
+
],
|
| 1308 |
+
'dbs': [
|
| 1309 |
+
(r'(\.)([a-zA-Z$_](?:[\w$\-]*[\w$])?)(?=[.\[\s])',
|
| 1310 |
+
bygroups(Punctuation, Name.Class.DBS)),
|
| 1311 |
+
(r'(\[)([\^#][a-zA-Z$_](?:[\w$\-]*[\w$])?)(\])',
|
| 1312 |
+
bygroups(Punctuation, Name.Entity.DBS, Punctuation)),
|
| 1313 |
+
(r'\s+', Text),
|
| 1314 |
+
(r'%', Operator.DBS, '#pop'),
|
| 1315 |
+
],
|
| 1316 |
+
'import_paths': [
|
| 1317 |
+
(r'(?<=[\s:;,])(\.{1,3}(?:[\w\-]*/)*)(\w(?:[\w\-]*\w)*)(?=[\s;,])',
|
| 1318 |
+
bygroups(Text.Whitespace, Text)),
|
| 1319 |
+
],
|
| 1320 |
+
'assignment': [
|
| 1321 |
+
(r'(\.)?([a-zA-Z$_](?:[\w$\-]*[\w$])?)'
|
| 1322 |
+
r'(?=\s+[+\-*/~^<>%&|?!@#.]*\=\s)',
|
| 1323 |
+
bygroups(Punctuation, Name.Variable))
|
| 1324 |
+
],
|
| 1325 |
+
'errors': [
|
| 1326 |
+
(words(('Error', 'TypeError', 'ReferenceError'),
|
| 1327 |
+
prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$.])'),
|
| 1328 |
+
Name.Exception),
|
| 1329 |
+
(r'''(?x)
|
| 1330 |
+
(?<![\w$])
|
| 1331 |
+
E\.[\w$](?:[\w$\-]*[\w$])?
|
| 1332 |
+
(?:\.[\w$](?:[\w$\-]*[\w$])?)*
|
| 1333 |
+
(?=[({\[?!\s])''',
|
| 1334 |
+
Name.Exception),
|
| 1335 |
+
],
|
| 1336 |
+
'control': [
|
| 1337 |
+
(r'''(?x)
|
| 1338 |
+
([a-zA-Z$_](?:[\w$-]*[\w$])?)
|
| 1339 |
+
(?!\n)\s+
|
| 1340 |
+
(?!and|as|each\*|each|in|is|mod|of|or|when|where|with)
|
| 1341 |
+
(?=(?:[+\-*/~^<>%&|?!@#.])?[a-zA-Z$_](?:[\w$-]*[\w$])?)''',
|
| 1342 |
+
Keyword.Control),
|
| 1343 |
+
(r'([a-zA-Z$_](?:[\w$-]*[\w$])?)(?!\n)\s+(?=[\'"\d{\[(])',
|
| 1344 |
+
Keyword.Control),
|
| 1345 |
+
(r'''(?x)
|
| 1346 |
+
(?:
|
| 1347 |
+
(?<=[%=])|
|
| 1348 |
+
(?<=[=\-]>)|
|
| 1349 |
+
(?<=with|each|with)|
|
| 1350 |
+
(?<=each\*|where)
|
| 1351 |
+
)(\s+)
|
| 1352 |
+
([a-zA-Z$_](?:[\w$-]*[\w$])?)(:)''',
|
| 1353 |
+
bygroups(Text, Keyword.Control, Punctuation)),
|
| 1354 |
+
(r'''(?x)
|
| 1355 |
+
(?<![+\-*/~^<>%&|?!@#.])(\s+)
|
| 1356 |
+
([a-zA-Z$_](?:[\w$-]*[\w$])?)(:)''',
|
| 1357 |
+
bygroups(Text, Keyword.Control, Punctuation)),
|
| 1358 |
+
],
|
| 1359 |
+
'nested': [
|
| 1360 |
+
(r'''(?x)
|
| 1361 |
+
(?<=[\w$\]})])(\.)
|
| 1362 |
+
([a-zA-Z$_](?:[\w$-]*[\w$])?)
|
| 1363 |
+
(?=\s+with(?:\s|\n))''',
|
| 1364 |
+
bygroups(Punctuation, Name.Function)),
|
| 1365 |
+
(r'''(?x)
|
| 1366 |
+
(?<!\s)(\.)
|
| 1367 |
+
([a-zA-Z$_](?:[\w$-]*[\w$])?)
|
| 1368 |
+
(?=[}\]).,;:\s])''',
|
| 1369 |
+
bygroups(Punctuation, Name.Field)),
|
| 1370 |
+
(r'''(?x)
|
| 1371 |
+
(?<=[\w$\]})])(\.)
|
| 1372 |
+
([a-zA-Z$_](?:[\w$-]*[\w$])?)
|
| 1373 |
+
(?=[\[{(:])''',
|
| 1374 |
+
bygroups(Punctuation, Name.Function)),
|
| 1375 |
+
],
|
| 1376 |
+
'keywords': [
|
| 1377 |
+
(words((
|
| 1378 |
+
'each', 'each*', 'mod', 'await', 'break', 'chain',
|
| 1379 |
+
'continue', 'elif', 'expr-value', 'if', 'match',
|
| 1380 |
+
'return', 'yield', 'pass', 'else', 'require', 'var',
|
| 1381 |
+
'let', 'async', 'method', 'gen'),
|
| 1382 |
+
prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$.])'),
|
| 1383 |
+
Keyword.Pseudo),
|
| 1384 |
+
(words(('this', 'self', '@'),
|
| 1385 |
+
prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$])'),
|
| 1386 |
+
Keyword.Constant),
|
| 1387 |
+
(words((
|
| 1388 |
+
'Function', 'Object', 'Array', 'String', 'Number',
|
| 1389 |
+
'Boolean', 'ErrorFactory', 'ENode', 'Promise'),
|
| 1390 |
+
prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$])'),
|
| 1391 |
+
Keyword.Type),
|
| 1392 |
+
],
|
| 1393 |
+
'builtins': [
|
| 1394 |
+
(words((
|
| 1395 |
+
'send', 'object', 'keys', 'items', 'enumerate', 'zip',
|
| 1396 |
+
'product', 'neighbours', 'predicate', 'equal',
|
| 1397 |
+
'nequal', 'contains', 'repr', 'clone', 'range',
|
| 1398 |
+
'getChecker', 'get-checker', 'getProperty', 'get-property',
|
| 1399 |
+
'getProjector', 'get-projector', 'consume', 'take',
|
| 1400 |
+
'promisify', 'spawn', 'constructor'),
|
| 1401 |
+
prefix=r'(?<![\w\-#.])', suffix=r'(?![\w\-.])'),
|
| 1402 |
+
Name.Builtin),
|
| 1403 |
+
(words((
|
| 1404 |
+
'true', 'false', 'null', 'undefined'),
|
| 1405 |
+
prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$.])'),
|
| 1406 |
+
Name.Constant),
|
| 1407 |
+
],
|
| 1408 |
+
'name': [
|
| 1409 |
+
(r'@([a-zA-Z$_](?:[\w$-]*[\w$])?)', Name.Variable.Instance),
|
| 1410 |
+
(r'([a-zA-Z$_](?:[\w$-]*[\w$])?)(\+\+|\-\-)?',
|
| 1411 |
+
bygroups(Name.Symbol, Operator.Word))
|
| 1412 |
+
],
|
| 1413 |
+
'tuple': [
|
| 1414 |
+
(r'#[a-zA-Z_][\w\-]*(?=[\s{(,;])', Name.Namespace)
|
| 1415 |
+
],
|
| 1416 |
+
'interpoling_string': [
|
| 1417 |
+
(r'\}', String.Interpol, '#pop'),
|
| 1418 |
+
include('root')
|
| 1419 |
+
],
|
| 1420 |
+
'stringescape': [
|
| 1421 |
+
(r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
|
| 1422 |
+
r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
|
| 1423 |
+
],
|
| 1424 |
+
'strings': [
|
| 1425 |
+
(r'[^\\\'"]', String),
|
| 1426 |
+
(r'[\'"\\]', String),
|
| 1427 |
+
(r'\n', String) # All strings are multiline in EG
|
| 1428 |
+
],
|
| 1429 |
+
'dqs': [
|
| 1430 |
+
(r'"', String, '#pop'),
|
| 1431 |
+
(r'\\\\|\\"|\\\n', String.Escape),
|
| 1432 |
+
include('strings')
|
| 1433 |
+
],
|
| 1434 |
+
'sqs': [
|
| 1435 |
+
(r"'", String, '#pop'),
|
| 1436 |
+
(r"\\\\|\\'|\\\n", String.Escape),
|
| 1437 |
+
(r'\{', String.Interpol, 'interpoling_string'),
|
| 1438 |
+
include('strings')
|
| 1439 |
+
],
|
| 1440 |
+
'tdqs': [
|
| 1441 |
+
(r'"""', String, '#pop'),
|
| 1442 |
+
include('strings'),
|
| 1443 |
+
],
|
| 1444 |
+
'bt': [
|
| 1445 |
+
(r'`', String.Backtick, '#pop'),
|
| 1446 |
+
(r'(?<!`)\n', String.Backtick),
|
| 1447 |
+
(r'\^=?', String.Escape),
|
| 1448 |
+
(r'.+', String.Backtick),
|
| 1449 |
+
],
|
| 1450 |
+
'tbt': [
|
| 1451 |
+
(r'```', String.Backtick, '#pop'),
|
| 1452 |
+
(r'\n', String.Backtick),
|
| 1453 |
+
(r'\^=?', String.Escape),
|
| 1454 |
+
(r'[^`]+', String.Backtick),
|
| 1455 |
+
],
|
| 1456 |
+
'numbers': [
|
| 1457 |
+
(r'\d+\.(?!\.)\d*([eE][+-]?[0-9]+)?', Number.Float),
|
| 1458 |
+
(r'\d+[eE][+-]?[0-9]+', Number.Float),
|
| 1459 |
+
(r'8r[0-7]+', Number.Oct),
|
| 1460 |
+
(r'2r[01]+', Number.Bin),
|
| 1461 |
+
(r'16r[a-fA-F0-9]+', Number.Hex),
|
| 1462 |
+
(r'([3-79]|[12][0-9]|3[0-6])r[a-zA-Z\d]+(\.[a-zA-Z\d]+)?', Number.Radix),
|
| 1463 |
+
(r'\d+', Number.Integer)
|
| 1464 |
+
],
|
| 1465 |
+
}
|
| 1466 |
+
|
| 1467 |
+
class JuttleLexer(RegexLexer):
|
| 1468 |
+
"""
|
| 1469 |
+
For `Juttle`_ source code.
|
| 1470 |
+
|
| 1471 |
+
.. _Juttle: https://github.com/juttle/juttle
|
| 1472 |
+
|
| 1473 |
+
"""
|
| 1474 |
+
|
| 1475 |
+
name = 'Juttle'
|
| 1476 |
+
aliases = ['juttle', 'juttle']
|
| 1477 |
+
filenames = ['*.juttle']
|
| 1478 |
+
mimetypes = ['application/juttle', 'application/x-juttle',
|
| 1479 |
+
'text/x-juttle', 'text/juttle']
|
| 1480 |
+
|
| 1481 |
+
flags = re.DOTALL | re.UNICODE | re.MULTILINE
|
| 1482 |
+
|
| 1483 |
+
tokens = {
|
| 1484 |
+
'commentsandwhitespace': [
|
| 1485 |
+
(r'\s+', Text),
|
| 1486 |
+
(r'//.*?\n', Comment.Single),
|
| 1487 |
+
(r'/\*.*?\*/', Comment.Multiline)
|
| 1488 |
+
],
|
| 1489 |
+
'slashstartsregex': [
|
| 1490 |
+
include('commentsandwhitespace'),
|
| 1491 |
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
| 1492 |
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
| 1493 |
+
(r'(?=/)', Text, ('#pop', 'badregex')),
|
| 1494 |
+
default('#pop')
|
| 1495 |
+
],
|
| 1496 |
+
'badregex': [
|
| 1497 |
+
(r'\n', Text, '#pop')
|
| 1498 |
+
],
|
| 1499 |
+
'root': [
|
| 1500 |
+
(r'^(?=\s|/)', Text, 'slashstartsregex'),
|
| 1501 |
+
include('commentsandwhitespace'),
|
| 1502 |
+
(r':\d{2}:\d{2}:\d{2}(\.\d*)?:', String.Moment),
|
| 1503 |
+
(r':(now|beginning|end|forever|yesterday|today|tomorrow|(\d+(\.\d*)?|\.\d+)(ms|[smhdwMy])?):', String.Moment),
|
| 1504 |
+
(r':\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d*)?)?(Z|[+-]\d{2}:\d{2}|[+-]\d{4})?:', String.Moment),
|
| 1505 |
+
(r':((\d+(\.\d*)?|\.\d+)[ ]+)?(millisecond|second|minute|hour|day|week|month|year)[s]?'
|
| 1506 |
+
r'(([ ]+and[ ]+(\d+[ ]+)?(millisecond|second|minute|hour|day|week|month|year)[s]?)'
|
| 1507 |
+
r'|[ ]+(ago|from[ ]+now))*:', String.Moment),
|
| 1508 |
+
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
| 1509 |
+
r'(==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
|
| 1510 |
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
| 1511 |
+
(r'[})\].]', Punctuation),
|
| 1512 |
+
(r'(import|return|continue|if|else)\b', Keyword, 'slashstartsregex'),
|
| 1513 |
+
(r'(var|const|function|reducer|sub|input)\b', Keyword.Declaration, 'slashstartsregex'),
|
| 1514 |
+
(r'(batch|emit|filter|head|join|keep|pace|pass|put|read|reduce|remove|'
|
| 1515 |
+
r'sequence|skip|sort|split|tail|unbatch|uniq|view|write)\b', Keyword.Reserved),
|
| 1516 |
+
(r'(true|false|null|Infinity)\b', Keyword.Constant),
|
| 1517 |
+
(r'(Array|Date|Juttle|Math|Number|Object|RegExp|String)\b', Name.Builtin),
|
| 1518 |
+
(JS_IDENT, Name.Other),
|
| 1519 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 1520 |
+
(r'[0-9]+', Number.Integer),
|
| 1521 |
+
(r'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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.julia
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for the Julia language.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, \
|
| 15 |
+
words, include
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Number, Punctuation, Generic
|
| 18 |
+
from pygments.util import shebang_matches, unirange
|
| 19 |
+
|
| 20 |
+
__all__ = ['JuliaLexer', 'JuliaConsoleLexer']
|
| 21 |
+
|
| 22 |
+
allowed_variable = (
|
| 23 |
+
u'(?:[a-zA-Z_\u00A1-\uffff]|%s)(?:[a-zA-Z_0-9\u00A1-\uffff]|%s)*!*' %
|
| 24 |
+
((unirange(0x10000, 0x10ffff),) * 2))
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class JuliaLexer(RegexLexer):
|
| 28 |
+
"""
|
| 29 |
+
For `Julia <http://julialang.org/>`_ source code.
|
| 30 |
+
|
| 31 |
+
.. versionadded:: 1.6
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
name = 'Julia'
|
| 35 |
+
aliases = ['julia', 'jl']
|
| 36 |
+
filenames = ['*.jl']
|
| 37 |
+
mimetypes = ['text/x-julia', 'application/x-julia']
|
| 38 |
+
|
| 39 |
+
flags = re.MULTILINE | re.UNICODE
|
| 40 |
+
|
| 41 |
+
tokens = {
|
| 42 |
+
'root': [
|
| 43 |
+
(r'\n', Text),
|
| 44 |
+
(r'[^\S\n]+', Text),
|
| 45 |
+
(r'#=', Comment.Multiline, "blockcomment"),
|
| 46 |
+
(r'#.*$', Comment),
|
| 47 |
+
(r'[\[\]{}(),;]', Punctuation),
|
| 48 |
+
|
| 49 |
+
# keywords
|
| 50 |
+
(r'in\b', Keyword.Pseudo),
|
| 51 |
+
(r'(true|false)\b', Keyword.Constant),
|
| 52 |
+
(r'(local|global|const)\b', Keyword.Declaration),
|
| 53 |
+
(words([
|
| 54 |
+
'function', 'type', 'typealias', 'abstract', 'immutable',
|
| 55 |
+
'baremodule', 'begin', 'bitstype', 'break', 'catch', 'ccall',
|
| 56 |
+
'continue', 'do', 'else', 'elseif', 'end', 'export', 'finally',
|
| 57 |
+
'for', 'if', 'import', 'importall', 'let', 'macro', 'module',
|
| 58 |
+
'quote', 'return', 'try', 'using', 'while'],
|
| 59 |
+
suffix=r'\b'), Keyword),
|
| 60 |
+
|
| 61 |
+
# NOTE
|
| 62 |
+
# Patterns below work only for definition sites and thus hardly reliable.
|
| 63 |
+
#
|
| 64 |
+
# functions
|
| 65 |
+
# (r'(function)(\s+)(' + allowed_variable + ')',
|
| 66 |
+
# bygroups(Keyword, Text, Name.Function)),
|
| 67 |
+
#
|
| 68 |
+
# types
|
| 69 |
+
# (r'(type|typealias|abstract|immutable)(\s+)(' + allowed_variable + ')',
|
| 70 |
+
# bygroups(Keyword, Text, Name.Class)),
|
| 71 |
+
|
| 72 |
+
# type names
|
| 73 |
+
(words([
|
| 74 |
+
'ANY', 'ASCIIString', 'AbstractArray', 'AbstractChannel',
|
| 75 |
+
'AbstractFloat', 'AbstractMatrix', 'AbstractRNG',
|
| 76 |
+
'AbstractSparseArray', 'AbstractSparseMatrix',
|
| 77 |
+
'AbstractSparseVector', 'AbstractString', 'AbstractVecOrMat',
|
| 78 |
+
'AbstractVector', 'Any', 'ArgumentError', 'Array',
|
| 79 |
+
'AssertionError', 'Associative', 'Base64DecodePipe',
|
| 80 |
+
'Base64EncodePipe', 'Bidiagonal', 'BigFloat', 'BigInt',
|
| 81 |
+
'BitArray', 'BitMatrix', 'BitVector', 'Bool', 'BoundsError',
|
| 82 |
+
'Box', 'BufferStream', 'CapturedException', 'CartesianIndex',
|
| 83 |
+
'CartesianRange', 'Cchar', 'Cdouble', 'Cfloat', 'Channel',
|
| 84 |
+
'Char', 'Cint', 'Cintmax_t', 'Clong', 'Clonglong',
|
| 85 |
+
'ClusterManager', 'Cmd', 'Coff_t', 'Colon', 'Complex',
|
| 86 |
+
'Complex128', 'Complex32', 'Complex64', 'CompositeException',
|
| 87 |
+
'Condition', 'Cptrdiff_t', 'Cshort', 'Csize_t', 'Cssize_t',
|
| 88 |
+
'Cstring', 'Cuchar', 'Cuint', 'Cuintmax_t', 'Culong',
|
| 89 |
+
'Culonglong', 'Cushort', 'Cwchar_t', 'Cwstring', 'DataType',
|
| 90 |
+
'Date', 'DateTime', 'DenseArray', 'DenseMatrix',
|
| 91 |
+
'DenseVecOrMat', 'DenseVector', 'Diagonal', 'Dict',
|
| 92 |
+
'DimensionMismatch', 'Dims', 'DirectIndexString', 'Display',
|
| 93 |
+
'DivideError', 'DomainError', 'EOFError', 'EachLine', 'Enum',
|
| 94 |
+
'Enumerate', 'ErrorException', 'Exception', 'Expr',
|
| 95 |
+
'Factorization', 'FileMonitor', 'FileOffset', 'Filter',
|
| 96 |
+
'Float16', 'Float32', 'Float64', 'FloatRange', 'Function',
|
| 97 |
+
'GenSym', 'GlobalRef', 'GotoNode', 'HTML', 'Hermitian', 'IO',
|
| 98 |
+
'IOBuffer', 'IOStream', 'IPv4', 'IPv6', 'InexactError',
|
| 99 |
+
'InitError', 'Int', 'Int128', 'Int16', 'Int32', 'Int64', 'Int8',
|
| 100 |
+
'IntSet', 'Integer', 'InterruptException', 'IntrinsicFunction',
|
| 101 |
+
'InvalidStateException', 'Irrational', 'KeyError', 'LabelNode',
|
| 102 |
+
'LambdaStaticData', 'LinSpace', 'LineNumberNode', 'LoadError',
|
| 103 |
+
'LocalProcess', 'LowerTriangular', 'MIME', 'Matrix',
|
| 104 |
+
'MersenneTwister', 'Method', 'MethodError', 'MethodTable',
|
| 105 |
+
'Module', 'NTuple', 'NewvarNode', 'NullException', 'Nullable',
|
| 106 |
+
'Number', 'ObjectIdDict', 'OrdinalRange', 'OutOfMemoryError',
|
| 107 |
+
'OverflowError', 'Pair', 'ParseError', 'PartialQuickSort',
|
| 108 |
+
'Pipe', 'PollingFileWatcher', 'ProcessExitedException',
|
| 109 |
+
'ProcessGroup', 'Ptr', 'QuoteNode', 'RandomDevice', 'Range',
|
| 110 |
+
'Rational', 'RawFD', 'ReadOnlyMemoryError', 'Real',
|
| 111 |
+
'ReentrantLock', 'Ref', 'Regex', 'RegexMatch',
|
| 112 |
+
'RemoteException', 'RemoteRef', 'RepString', 'RevString',
|
| 113 |
+
'RopeString', 'RoundingMode', 'SegmentationFault',
|
| 114 |
+
'SerializationState', 'Set', 'SharedArray', 'SharedMatrix',
|
| 115 |
+
'SharedVector', 'Signed', 'SimpleVector', 'SparseMatrixCSC',
|
| 116 |
+
'StackOverflowError', 'StatStruct', 'StepRange', 'StridedArray',
|
| 117 |
+
'StridedMatrix', 'StridedVecOrMat', 'StridedVector', 'SubArray',
|
| 118 |
+
'SubString', 'SymTridiagonal', 'Symbol', 'SymbolNode',
|
| 119 |
+
'Symmetric', 'SystemError', 'TCPSocket', 'Task', 'Text',
|
| 120 |
+
'TextDisplay', 'Timer', 'TopNode', 'Tridiagonal', 'Tuple',
|
| 121 |
+
'Type', 'TypeConstructor', 'TypeError', 'TypeName', 'TypeVar',
|
| 122 |
+
'UDPSocket', 'UInt', 'UInt128', 'UInt16', 'UInt32', 'UInt64',
|
| 123 |
+
'UInt8', 'UTF16String', 'UTF32String', 'UTF8String',
|
| 124 |
+
'UndefRefError', 'UndefVarError', 'UnicodeError', 'UniformScaling',
|
| 125 |
+
'Union', 'UnitRange', 'Unsigned', 'UpperTriangular', 'Val',
|
| 126 |
+
'Vararg', 'VecOrMat', 'Vector', 'VersionNumber', 'Void', 'WString',
|
| 127 |
+
'WeakKeyDict', 'WeakRef', 'WorkerConfig', 'Zip'], suffix=r'\b'),
|
| 128 |
+
Keyword.Type),
|
| 129 |
+
|
| 130 |
+
# builtins
|
| 131 |
+
(words([
|
| 132 |
+
u'ARGS', u'CPU_CORES', u'C_NULL', u'DevNull', u'ENDIAN_BOM',
|
| 133 |
+
u'ENV', u'I', u'Inf', u'Inf16', u'Inf32', u'Inf64',
|
| 134 |
+
u'InsertionSort', u'JULIA_HOME', u'LOAD_PATH', u'MergeSort',
|
| 135 |
+
u'NaN', u'NaN16', u'NaN32', u'NaN64', u'OS_NAME',
|
| 136 |
+
u'QuickSort', u'RoundDown', u'RoundFromZero', u'RoundNearest',
|
| 137 |
+
u'RoundNearestTiesAway', u'RoundNearestTiesUp',
|
| 138 |
+
u'RoundToZero', u'RoundUp', u'STDERR', u'STDIN', u'STDOUT',
|
| 139 |
+
u'VERSION', u'WORD_SIZE', u'catalan', u'e', u'eu',
|
| 140 |
+
u'eulergamma', u'golden', u'im', u'nothing', u'pi', u'γ',
|
| 141 |
+
u'π', u'φ'],
|
| 142 |
+
suffix=r'\b'), Name.Builtin),
|
| 143 |
+
|
| 144 |
+
# operators
|
| 145 |
+
# see: https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm
|
| 146 |
+
(words([
|
| 147 |
+
# prec-assignment
|
| 148 |
+
u'=', u':=', u'+=', u'-=', u'*=', u'/=', u'//=', u'.//=', u'.*=', u'./=',
|
| 149 |
+
u'\=', u'.\=', u'^=', u'.^=', u'÷=', u'.÷=', u'%=', u'.%=', u'|=', u'&=',
|
| 150 |
+
u'$=', u'=>', u'<<=', u'>>=', u'>>>=', u'~', u'.+=', u'.-=',
|
| 151 |
+
# prec-conditional
|
| 152 |
+
u'?',
|
| 153 |
+
# prec-arrow
|
| 154 |
+
u'--', u'-->',
|
| 155 |
+
# prec-lazy-or
|
| 156 |
+
u'||',
|
| 157 |
+
# prec-lazy-and
|
| 158 |
+
u'&&',
|
| 159 |
+
# prec-comparison
|
| 160 |
+
u'>', u'<', u'>=', u'≥', u'<=', u'≤', u'==', u'===', u'≡', u'!=', u'≠',
|
| 161 |
+
u'!==', u'≢', u'.>', u'.<', u'.>=', u'.≥', u'.<=', u'.≤', u'.==', u'.!=',
|
| 162 |
+
u'.≠', u'.=', u'.!', u'<:', u'>:', u'∈', u'∉', u'∋', u'∌', u'⊆',
|
| 163 |
+
u'⊈', u'⊂',
|
| 164 |
+
u'⊄', u'⊊',
|
| 165 |
+
# prec-pipe
|
| 166 |
+
u'|>', u'<|',
|
| 167 |
+
# prec-colon
|
| 168 |
+
u':',
|
| 169 |
+
# prec-plus
|
| 170 |
+
u'+', u'-', u'.+', u'.-', u'|', u'∪', u'$',
|
| 171 |
+
# prec-bitshift
|
| 172 |
+
u'<<', u'>>', u'>>>', u'.<<', u'.>>', u'.>>>',
|
| 173 |
+
# prec-times
|
| 174 |
+
u'*', u'/', u'./', u'÷', u'.÷', u'%', u'⋅', u'.%', u'.*', u'\\', u'.\\', u'&', u'∩',
|
| 175 |
+
# prec-rational
|
| 176 |
+
u'//', u'.//',
|
| 177 |
+
# prec-power
|
| 178 |
+
u'^', u'.^',
|
| 179 |
+
# prec-decl
|
| 180 |
+
u'::',
|
| 181 |
+
# prec-dot
|
| 182 |
+
u'.',
|
| 183 |
+
# unary op
|
| 184 |
+
u'+', u'-', u'!', u'~', u'√', u'∛', u'∜'
|
| 185 |
+
]), Operator),
|
| 186 |
+
|
| 187 |
+
# chars
|
| 188 |
+
(r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|"
|
| 189 |
+
r"\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'", String.Char),
|
| 190 |
+
|
| 191 |
+
# try to match trailing transpose
|
| 192 |
+
(r'(?<=[.\w)\]])\'+', Operator),
|
| 193 |
+
|
| 194 |
+
# strings
|
| 195 |
+
(r'"""', String, 'tqstring'),
|
| 196 |
+
(r'"', String, 'string'),
|
| 197 |
+
|
| 198 |
+
# regular expressions
|
| 199 |
+
(r'r"""', String.Regex, 'tqregex'),
|
| 200 |
+
(r'r"', String.Regex, 'regex'),
|
| 201 |
+
|
| 202 |
+
# backticks
|
| 203 |
+
(r'`', String.Backtick, 'command'),
|
| 204 |
+
|
| 205 |
+
# names
|
| 206 |
+
(allowed_variable, Name),
|
| 207 |
+
(r'@' + allowed_variable, Name.Decorator),
|
| 208 |
+
|
| 209 |
+
# numbers
|
| 210 |
+
(r'(\d+(_\d+)+\.\d*|\d*\.\d+(_\d+)+)([eEf][+-]?[0-9]+)?', Number.Float),
|
| 211 |
+
(r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
|
| 212 |
+
(r'\d+(_\d+)+[eEf][+-]?[0-9]+', Number.Float),
|
| 213 |
+
(r'\d+[eEf][+-]?[0-9]+', Number.Float),
|
| 214 |
+
(r'0b[01]+(_[01]+)+', Number.Bin),
|
| 215 |
+
(r'0b[01]+', Number.Bin),
|
| 216 |
+
(r'0o[0-7]+(_[0-7]+)+', Number.Oct),
|
| 217 |
+
(r'0o[0-7]+', Number.Oct),
|
| 218 |
+
(r'0x[a-fA-F0-9]+(_[a-fA-F0-9]+)+', Number.Hex),
|
| 219 |
+
(r'0x[a-fA-F0-9]+', Number.Hex),
|
| 220 |
+
(r'\d+(_\d+)+', Number.Integer),
|
| 221 |
+
(r'\d+', Number.Integer)
|
| 222 |
+
],
|
| 223 |
+
|
| 224 |
+
"blockcomment": [
|
| 225 |
+
(r'[^=#]', Comment.Multiline),
|
| 226 |
+
(r'#=', Comment.Multiline, '#push'),
|
| 227 |
+
(r'=#', Comment.Multiline, '#pop'),
|
| 228 |
+
(r'[=#]', Comment.Multiline),
|
| 229 |
+
],
|
| 230 |
+
|
| 231 |
+
'string': [
|
| 232 |
+
(r'"', String, '#pop'),
|
| 233 |
+
# FIXME: This escape pattern is not perfect.
|
| 234 |
+
(r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape),
|
| 235 |
+
# Interpolation is defined as "$" followed by the shortest full
|
| 236 |
+
# expression, which is something we can't parse.
|
| 237 |
+
# Include the most common cases here: $word, and $(paren'd expr).
|
| 238 |
+
(r'\$' + allowed_variable, String.Interpol),
|
| 239 |
+
# (r'\$[a-zA-Z_]+', String.Interpol),
|
| 240 |
+
(r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'),
|
| 241 |
+
# @printf and @sprintf formats
|
| 242 |
+
(r'%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]',
|
| 243 |
+
String.Interpol),
|
| 244 |
+
(r'.|\s', String),
|
| 245 |
+
],
|
| 246 |
+
|
| 247 |
+
'tqstring': [
|
| 248 |
+
(r'"""', String, '#pop'),
|
| 249 |
+
(r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape),
|
| 250 |
+
(r'\$' + allowed_variable, String.Interpol),
|
| 251 |
+
(r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'),
|
| 252 |
+
(r'.|\s', String),
|
| 253 |
+
],
|
| 254 |
+
|
| 255 |
+
'regex': [
|
| 256 |
+
(r'"', String.Regex, '#pop'),
|
| 257 |
+
(r'\\"', String.Regex),
|
| 258 |
+
(r'.|\s', String.Regex),
|
| 259 |
+
],
|
| 260 |
+
|
| 261 |
+
'tqregex': [
|
| 262 |
+
(r'"""', String.Regex, '#pop'),
|
| 263 |
+
(r'.|\s', String.Regex),
|
| 264 |
+
],
|
| 265 |
+
|
| 266 |
+
'command': [
|
| 267 |
+
(r'`', String.Backtick, '#pop'),
|
| 268 |
+
(r'\$' + allowed_variable, String.Interpol),
|
| 269 |
+
(r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'),
|
| 270 |
+
(r'.|\s', String.Backtick)
|
| 271 |
+
],
|
| 272 |
+
|
| 273 |
+
'in-intp': [
|
| 274 |
+
(r'\(', Punctuation, '#push'),
|
| 275 |
+
(r'\)', Punctuation, '#pop'),
|
| 276 |
+
include('root'),
|
| 277 |
+
]
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
def analyse_text(text):
|
| 281 |
+
return shebang_matches(text, r'julia')
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
class JuliaConsoleLexer(Lexer):
|
| 285 |
+
"""
|
| 286 |
+
For Julia console sessions. Modeled after MatlabSessionLexer.
|
| 287 |
+
|
| 288 |
+
.. versionadded:: 1.6
|
| 289 |
+
"""
|
| 290 |
+
name = 'Julia console'
|
| 291 |
+
aliases = ['jlcon']
|
| 292 |
+
|
| 293 |
+
def get_tokens_unprocessed(self, text):
|
| 294 |
+
jllexer = JuliaLexer(**self.options)
|
| 295 |
+
start = 0
|
| 296 |
+
curcode = ''
|
| 297 |
+
insertions = []
|
| 298 |
+
output = False
|
| 299 |
+
error = False
|
| 300 |
+
|
| 301 |
+
for line in text.splitlines(True):
|
| 302 |
+
if line.startswith('julia>'):
|
| 303 |
+
insertions.append((len(curcode), [(0, Generic.Prompt, line[:6])]))
|
| 304 |
+
curcode += line[6:]
|
| 305 |
+
output = False
|
| 306 |
+
error = False
|
| 307 |
+
elif line.startswith('help?>') or line.startswith('shell>'):
|
| 308 |
+
yield start, Generic.Prompt, line[:6]
|
| 309 |
+
yield start + 6, Text, line[6:]
|
| 310 |
+
output = False
|
| 311 |
+
error = False
|
| 312 |
+
elif line.startswith(' ') and not output:
|
| 313 |
+
insertions.append((len(curcode), [(0, Text, line[:6])]))
|
| 314 |
+
curcode += line[6:]
|
| 315 |
+
else:
|
| 316 |
+
if curcode:
|
| 317 |
+
for item in do_insertions(
|
| 318 |
+
insertions, jllexer.get_tokens_unprocessed(curcode)):
|
| 319 |
+
yield item
|
| 320 |
+
curcode = ''
|
| 321 |
+
insertions = []
|
| 322 |
+
if line.startswith('ERROR: ') or error:
|
| 323 |
+
yield start, Generic.Error, line
|
| 324 |
+
error = True
|
| 325 |
+
else:
|
| 326 |
+
yield start, Generic.Output, line
|
| 327 |
+
output = True
|
| 328 |
+
start += len(line)
|
| 329 |
+
|
| 330 |
+
if curcode:
|
| 331 |
+
for item in do_insertions(
|
| 332 |
+
insertions, jllexer.get_tokens_unprocessed(curcode)):
|
| 333 |
+
yield item
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/jvm.py
ADDED
|
@@ -0,0 +1,1573 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.jvm
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Pygments lexers for JVM languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \
|
| 15 |
+
this, combined, default, words
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Number, Punctuation
|
| 18 |
+
from pygments.util import shebang_matches
|
| 19 |
+
from pygments import unistring as uni
|
| 20 |
+
|
| 21 |
+
__all__ = ['JavaLexer', 'ScalaLexer', 'GosuLexer', 'GosuTemplateLexer',
|
| 22 |
+
'GroovyLexer', 'IokeLexer', 'ClojureLexer', 'ClojureScriptLexer',
|
| 23 |
+
'KotlinLexer', 'XtendLexer', 'AspectJLexer', 'CeylonLexer',
|
| 24 |
+
'PigLexer', 'GoloLexer', 'JasminLexer']
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class JavaLexer(RegexLexer):
|
| 28 |
+
"""
|
| 29 |
+
For `Java <http://www.sun.com/java/>`_ source code.
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
name = 'Java'
|
| 33 |
+
aliases = ['java']
|
| 34 |
+
filenames = ['*.java']
|
| 35 |
+
mimetypes = ['text/x-java']
|
| 36 |
+
|
| 37 |
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
| 38 |
+
|
| 39 |
+
tokens = {
|
| 40 |
+
'root': [
|
| 41 |
+
(r'[^\S\n]+', Text),
|
| 42 |
+
(r'//.*?\n', Comment.Single),
|
| 43 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 44 |
+
# keywords: go before method names to avoid lexing "throw new XYZ"
|
| 45 |
+
# as a method signature
|
| 46 |
+
(r'(assert|break|case|catch|continue|default|do|else|finally|for|'
|
| 47 |
+
r'if|goto|instanceof|new|return|switch|this|throw|try|while)\b',
|
| 48 |
+
Keyword),
|
| 49 |
+
# method names
|
| 50 |
+
(r'((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)' # return arguments
|
| 51 |
+
r'((?:[^\W\d]|\$)[\w$]*)' # method name
|
| 52 |
+
r'(\s*)(\()', # signature start
|
| 53 |
+
bygroups(using(this), Name.Function, Text, Operator)),
|
| 54 |
+
(r'@[^\W\d][\w.]*', Name.Decorator),
|
| 55 |
+
(r'(abstract|const|enum|extends|final|implements|native|private|'
|
| 56 |
+
r'protected|public|static|strictfp|super|synchronized|throws|'
|
| 57 |
+
r'transient|volatile)\b', Keyword.Declaration),
|
| 58 |
+
(r'(boolean|byte|char|double|float|int|long|short|void)\b',
|
| 59 |
+
Keyword.Type),
|
| 60 |
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
| 61 |
+
(r'(true|false|null)\b', Keyword.Constant),
|
| 62 |
+
(r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
|
| 63 |
+
'class'),
|
| 64 |
+
(r'(import(?:\s+static)?)(\s+)', bygroups(Keyword.Namespace, Text),
|
| 65 |
+
'import'),
|
| 66 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 67 |
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
|
| 68 |
+
(r'(\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Operator, Name.Attribute)),
|
| 69 |
+
(r'^\s*([^\W\d]|\$)[\w$]*:', Name.Label),
|
| 70 |
+
(r'([^\W\d]|\$)[\w$]*', Name),
|
| 71 |
+
(r'([0-9][0-9_]*\.([0-9][0-9_]*)?|'
|
| 72 |
+
r'\.[0-9][0-9_]*)'
|
| 73 |
+
r'([eE][+\-]?[0-9][0-9_]*)?[fFdD]?|'
|
| 74 |
+
r'[0-9][eE][+\-]?[0-9][0-9_]*[fFdD]?|'
|
| 75 |
+
r'[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFdD]|'
|
| 76 |
+
r'0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|'
|
| 77 |
+
r'([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)'
|
| 78 |
+
r'[pP][+\-]?[0-9][0-9_]*[fFdD]?', Number.Float),
|
| 79 |
+
(r'0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?', Number.Hex),
|
| 80 |
+
(r'0[bB][01][01_]*[lL]?', Number.Bin),
|
| 81 |
+
(r'0[0-7_]+[lL]?', Number.Oct),
|
| 82 |
+
(r'0|[1-9][0-9_]*[lL]?', Number.Integer),
|
| 83 |
+
(r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
|
| 84 |
+
(r'\n', Text)
|
| 85 |
+
],
|
| 86 |
+
'class': [
|
| 87 |
+
(r'([^\W\d]|\$)[\w$]*', Name.Class, '#pop')
|
| 88 |
+
],
|
| 89 |
+
'import': [
|
| 90 |
+
(r'[\w.]+\*?', Name.Namespace, '#pop')
|
| 91 |
+
],
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
class AspectJLexer(JavaLexer):
|
| 96 |
+
"""
|
| 97 |
+
For `AspectJ <http://www.eclipse.org/aspectj/>`_ source code.
|
| 98 |
+
|
| 99 |
+
.. versionadded:: 1.6
|
| 100 |
+
"""
|
| 101 |
+
|
| 102 |
+
name = 'AspectJ'
|
| 103 |
+
aliases = ['aspectj']
|
| 104 |
+
filenames = ['*.aj']
|
| 105 |
+
mimetypes = ['text/x-aspectj']
|
| 106 |
+
|
| 107 |
+
aj_keywords = set((
|
| 108 |
+
'aspect', 'pointcut', 'privileged', 'call', 'execution',
|
| 109 |
+
'initialization', 'preinitialization', 'handler', 'get', 'set',
|
| 110 |
+
'staticinitialization', 'target', 'args', 'within', 'withincode',
|
| 111 |
+
'cflow', 'cflowbelow', 'annotation', 'before', 'after', 'around',
|
| 112 |
+
'proceed', 'throwing', 'returning', 'adviceexecution', 'declare',
|
| 113 |
+
'parents', 'warning', 'error', 'soft', 'precedence', 'thisJoinPoint',
|
| 114 |
+
'thisJoinPointStaticPart', 'thisEnclosingJoinPointStaticPart',
|
| 115 |
+
'issingleton', 'perthis', 'pertarget', 'percflow', 'percflowbelow',
|
| 116 |
+
'pertypewithin', 'lock', 'unlock', 'thisAspectInstance'
|
| 117 |
+
))
|
| 118 |
+
aj_inter_type = set(('parents:', 'warning:', 'error:', 'soft:', 'precedence:'))
|
| 119 |
+
aj_inter_type_annotation = set(('@type', '@method', '@constructor', '@field'))
|
| 120 |
+
|
| 121 |
+
def get_tokens_unprocessed(self, text):
|
| 122 |
+
for index, token, value in JavaLexer.get_tokens_unprocessed(self, text):
|
| 123 |
+
if token is Name and value in self.aj_keywords:
|
| 124 |
+
yield index, Keyword, value
|
| 125 |
+
elif token is Name.Label and value in self.aj_inter_type:
|
| 126 |
+
yield index, Keyword, value[:-1]
|
| 127 |
+
yield index, Operator, value[-1]
|
| 128 |
+
elif token is Name.Decorator and value in self.aj_inter_type_annotation:
|
| 129 |
+
yield index, Keyword, value
|
| 130 |
+
else:
|
| 131 |
+
yield index, token, value
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
class ScalaLexer(RegexLexer):
|
| 135 |
+
"""
|
| 136 |
+
For `Scala <http://www.scala-lang.org>`_ source code.
|
| 137 |
+
"""
|
| 138 |
+
|
| 139 |
+
name = 'Scala'
|
| 140 |
+
aliases = ['scala']
|
| 141 |
+
filenames = ['*.scala']
|
| 142 |
+
mimetypes = ['text/x-scala']
|
| 143 |
+
|
| 144 |
+
flags = re.MULTILINE | re.DOTALL
|
| 145 |
+
|
| 146 |
+
# don't use raw unicode strings!
|
| 147 |
+
op = (u'[-~\\^\\*!%&\\\\<>\\|+=:/?@\u00a6-\u00a7\u00a9\u00ac\u00ae\u00b0-\u00b1'
|
| 148 |
+
u'\u00b6\u00d7\u00f7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9'
|
| 149 |
+
u'\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2'
|
| 150 |
+
u'\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38'
|
| 151 |
+
u'\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940'
|
| 152 |
+
u'\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c'
|
| 153 |
+
u'\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118'
|
| 154 |
+
u'\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144'
|
| 155 |
+
u'\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767'
|
| 156 |
+
u'\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb'
|
| 157 |
+
u'\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020'
|
| 158 |
+
u'\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3'
|
| 159 |
+
u'\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff'
|
| 160 |
+
u'\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66'
|
| 161 |
+
u'\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+')
|
| 162 |
+
|
| 163 |
+
letter = (u'[a-zA-Z\\$_\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6'
|
| 164 |
+
u'\u00f8-\u02af\u0370-\u0373\u0376-\u0377\u037b-\u037d\u0386'
|
| 165 |
+
u'\u0388-\u03f5\u03f7-\u0481\u048a-\u0556\u0561-\u0587\u05d0-\u05f2'
|
| 166 |
+
u'\u0621-\u063f\u0641-\u064a\u066e-\u066f\u0671-\u06d3\u06d5'
|
| 167 |
+
u'\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5'
|
| 168 |
+
u'\u07b1\u07ca-\u07ea\u0904-\u0939\u093d\u0950\u0958-\u0961'
|
| 169 |
+
u'\u0972-\u097f\u0985-\u09b9\u09bd\u09ce\u09dc-\u09e1\u09f0-\u09f1'
|
| 170 |
+
u'\u0a05-\u0a39\u0a59-\u0a5e\u0a72-\u0a74\u0a85-\u0ab9\u0abd'
|
| 171 |
+
u'\u0ad0-\u0ae1\u0b05-\u0b39\u0b3d\u0b5c-\u0b61\u0b71\u0b83-\u0bb9'
|
| 172 |
+
u'\u0bd0\u0c05-\u0c3d\u0c58-\u0c61\u0c85-\u0cb9\u0cbd\u0cde-\u0ce1'
|
| 173 |
+
u'\u0d05-\u0d3d\u0d60-\u0d61\u0d7a-\u0d7f\u0d85-\u0dc6\u0e01-\u0e30'
|
| 174 |
+
u'\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0eb0\u0eb2-\u0eb3\u0ebd-\u0ec4'
|
| 175 |
+
u'\u0edc-\u0f00\u0f40-\u0f6c\u0f88-\u0f8b\u1000-\u102a\u103f'
|
| 176 |
+
u'\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070'
|
| 177 |
+
u'\u1075-\u1081\u108e\u10a0-\u10fa\u1100-\u135a\u1380-\u138f'
|
| 178 |
+
u'\u13a0-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u16ee-\u1711'
|
| 179 |
+
u'\u1720-\u1731\u1740-\u1751\u1760-\u1770\u1780-\u17b3\u17dc'
|
| 180 |
+
u'\u1820-\u1842\u1844-\u18a8\u18aa-\u191c\u1950-\u19a9\u19c1-\u19c7'
|
| 181 |
+
u'\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf'
|
| 182 |
+
u'\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c77\u1d00-\u1d2b\u1d62-\u1d77'
|
| 183 |
+
u'\u1d79-\u1d9a\u1e00-\u1fbc\u1fbe\u1fc2-\u1fcc\u1fd0-\u1fdb'
|
| 184 |
+
u'\u1fe0-\u1fec\u1ff2-\u1ffc\u2071\u207f\u2102\u2107\u210a-\u2113'
|
| 185 |
+
u'\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139'
|
| 186 |
+
u'\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c7c'
|
| 187 |
+
u'\u2c80-\u2ce4\u2d00-\u2d65\u2d80-\u2dde\u3006-\u3007\u3021-\u3029'
|
| 188 |
+
u'\u3038-\u303a\u303c\u3041-\u3096\u309f\u30a1-\u30fa\u30ff-\u318e'
|
| 189 |
+
u'\u31a0-\u31b7\u31f0-\u31ff\u3400-\u4db5\u4e00-\ua014\ua016-\ua48c'
|
| 190 |
+
u'\ua500-\ua60b\ua610-\ua61f\ua62a-\ua66e\ua680-\ua697\ua722-\ua76f'
|
| 191 |
+
u'\ua771-\ua787\ua78b-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822'
|
| 192 |
+
u'\ua840-\ua873\ua882-\ua8b3\ua90a-\ua925\ua930-\ua946\uaa00-\uaa28'
|
| 193 |
+
u'\uaa40-\uaa42\uaa44-\uaa4b\uac00-\ud7a3\uf900-\ufb1d\ufb1f-\ufb28'
|
| 194 |
+
u'\ufb2a-\ufd3d\ufd50-\ufdfb\ufe70-\ufefc\uff21-\uff3a\uff41-\uff5a'
|
| 195 |
+
u'\uff66-\uff6f\uff71-\uff9d\uffa0-\uffdc]')
|
| 196 |
+
|
| 197 |
+
upper = (u'[A-Z\\$_\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108'
|
| 198 |
+
u'\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c'
|
| 199 |
+
u'\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130'
|
| 200 |
+
u'\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145'
|
| 201 |
+
u'\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a'
|
| 202 |
+
u'\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e'
|
| 203 |
+
u'\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182'
|
| 204 |
+
u'\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194'
|
| 205 |
+
u'\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7'
|
| 206 |
+
u'\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc'
|
| 207 |
+
u'\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9'
|
| 208 |
+
u'\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee'
|
| 209 |
+
u'\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204'
|
| 210 |
+
u'\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218'
|
| 211 |
+
u'\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c'
|
| 212 |
+
u'\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246'
|
| 213 |
+
u'\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038f'
|
| 214 |
+
u'\u0391-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0'
|
| 215 |
+
u'\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7'
|
| 216 |
+
u'\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a'
|
| 217 |
+
u'\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e'
|
| 218 |
+
u'\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a'
|
| 219 |
+
u'\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae'
|
| 220 |
+
u'\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1'
|
| 221 |
+
u'\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6'
|
| 222 |
+
u'\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea'
|
| 223 |
+
u'\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe'
|
| 224 |
+
u'\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512'
|
| 225 |
+
u'\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0531-\u0556'
|
| 226 |
+
u'\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e'
|
| 227 |
+
u'\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22'
|
| 228 |
+
u'\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36'
|
| 229 |
+
u'\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a'
|
| 230 |
+
u'\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e'
|
| 231 |
+
u'\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72'
|
| 232 |
+
u'\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86'
|
| 233 |
+
u'\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2'
|
| 234 |
+
u'\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6'
|
| 235 |
+
u'\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca'
|
| 236 |
+
u'\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede'
|
| 237 |
+
u'\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2'
|
| 238 |
+
u'\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d'
|
| 239 |
+
u'\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59-\u1f5f'
|
| 240 |
+
u'\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb'
|
| 241 |
+
u'\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112'
|
| 242 |
+
u'\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133'
|
| 243 |
+
u'\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67'
|
| 244 |
+
u'\u2c69\u2c6b\u2c6d-\u2c6f\u2c72\u2c75\u2c80\u2c82\u2c84\u2c86'
|
| 245 |
+
u'\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a'
|
| 246 |
+
u'\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae'
|
| 247 |
+
u'\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2'
|
| 248 |
+
u'\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6'
|
| 249 |
+
u'\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\ua640\ua642\ua644\ua646'
|
| 250 |
+
u'\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a'
|
| 251 |
+
u'\ua65c\ua65e\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682'
|
| 252 |
+
u'\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696'
|
| 253 |
+
u'\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736'
|
| 254 |
+
u'\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a'
|
| 255 |
+
u'\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e'
|
| 256 |
+
u'\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b'
|
| 257 |
+
u'\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]')
|
| 258 |
+
|
| 259 |
+
idrest = u'%s(?:%s|[0-9])*(?:(?<=_)%s)?' % (letter, letter, op)
|
| 260 |
+
letter_letter_digit = u'%s(?:%s|\d)*' % (letter, letter)
|
| 261 |
+
|
| 262 |
+
tokens = {
|
| 263 |
+
'root': [
|
| 264 |
+
# method names
|
| 265 |
+
(r'(class|trait|object)(\s+)', bygroups(Keyword, Text), 'class'),
|
| 266 |
+
(r'[^\S\n]+', Text),
|
| 267 |
+
(r'//.*?\n', Comment.Single),
|
| 268 |
+
(r'/\*', Comment.Multiline, 'comment'),
|
| 269 |
+
(u'@%s' % idrest, Name.Decorator),
|
| 270 |
+
(u'(abstract|ca(?:se|tch)|d(?:ef|o)|e(?:lse|xtends)|'
|
| 271 |
+
u'f(?:inal(?:ly)?|or(?:Some)?)|i(?:f|mplicit)|'
|
| 272 |
+
u'lazy|match|new|override|pr(?:ivate|otected)'
|
| 273 |
+
u'|re(?:quires|turn)|s(?:ealed|uper)|'
|
| 274 |
+
u't(?:h(?:is|row)|ry)|va[lr]|w(?:hile|ith)|yield)\\b|'
|
| 275 |
+
u'(<[%:-]|=>|>:|[#=@_\u21D2\u2190])(\\b|(?=\\s)|$)', Keyword),
|
| 276 |
+
(u':(?!%s)' % op, Keyword, 'type'),
|
| 277 |
+
(u'%s%s\\b' % (upper, idrest), Name.Class),
|
| 278 |
+
(r'(true|false|null)\b', Keyword.Constant),
|
| 279 |
+
(r'(import|package)(\s+)', bygroups(Keyword, Text), 'import'),
|
| 280 |
+
(r'(type)(\s+)', bygroups(Keyword, Text), 'type'),
|
| 281 |
+
(r'""".*?"""(?!")', String),
|
| 282 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 283 |
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
|
| 284 |
+
(u"'%s" % idrest, Text.Symbol),
|
| 285 |
+
(r'[fs]"""', String, 'interptriplestring'), # interpolated strings
|
| 286 |
+
(r'[fs]"', String, 'interpstring'), # interpolated strings
|
| 287 |
+
(r'raw"(\\\\|\\"|[^"])*"', String), # raw strings
|
| 288 |
+
# (ur'(\.)(%s|%s|`[^`]+`)' % (idrest, op), bygroups(Operator,
|
| 289 |
+
# Name.Attribute)),
|
| 290 |
+
(idrest, Name),
|
| 291 |
+
(r'`[^`]+`', Name),
|
| 292 |
+
(r'\[', Operator, 'typeparam'),
|
| 293 |
+
(r'[(){};,.#]', Operator),
|
| 294 |
+
(op, Operator),
|
| 295 |
+
(r'([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?',
|
| 296 |
+
Number.Float),
|
| 297 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 298 |
+
(r'[0-9]+L?', Number.Integer),
|
| 299 |
+
(r'\n', Text)
|
| 300 |
+
],
|
| 301 |
+
'class': [
|
| 302 |
+
(u'(%s|%s|`[^`]+`)(\\s*)(\\[)' % (idrest, op),
|
| 303 |
+
bygroups(Name.Class, Text, Operator), 'typeparam'),
|
| 304 |
+
(r'\s+', Text),
|
| 305 |
+
(r'\{', Operator, '#pop'),
|
| 306 |
+
(r'\(', Operator, '#pop'),
|
| 307 |
+
(r'//.*?\n', Comment.Single, '#pop'),
|
| 308 |
+
(u'%s|%s|`[^`]+`' % (idrest, op), Name.Class, '#pop'),
|
| 309 |
+
],
|
| 310 |
+
'type': [
|
| 311 |
+
(r'\s+', Text),
|
| 312 |
+
(r'<[%:]|>:|[#_]|forSome|type', Keyword),
|
| 313 |
+
(u'([,);}]|=>|=|\u21d2)(\\s*)', bygroups(Operator, Text), '#pop'),
|
| 314 |
+
(r'[({]', Operator, '#push'),
|
| 315 |
+
(u'((?:%s|%s|`[^`]+`)(?:\\.(?:%s|%s|`[^`]+`))*)(\\s*)(\\[)' %
|
| 316 |
+
(idrest, op, idrest, op),
|
| 317 |
+
bygroups(Keyword.Type, Text, Operator), ('#pop', 'typeparam')),
|
| 318 |
+
(u'((?:%s|%s|`[^`]+`)(?:\\.(?:%s|%s|`[^`]+`))*)(\\s*)$' %
|
| 319 |
+
(idrest, op, idrest, op),
|
| 320 |
+
bygroups(Keyword.Type, Text), '#pop'),
|
| 321 |
+
(r'//.*?\n', Comment.Single, '#pop'),
|
| 322 |
+
(u'\\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
|
| 323 |
+
],
|
| 324 |
+
'typeparam': [
|
| 325 |
+
(r'[\s,]+', Text),
|
| 326 |
+
(u'<[%:]|=>|>:|[#_\u21D2]|forSome|type', Keyword),
|
| 327 |
+
(r'([\])}])', Operator, '#pop'),
|
| 328 |
+
(r'[(\[{]', Operator, '#push'),
|
| 329 |
+
(u'\\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
|
| 330 |
+
],
|
| 331 |
+
'comment': [
|
| 332 |
+
(r'[^/*]+', Comment.Multiline),
|
| 333 |
+
(r'/\*', Comment.Multiline, '#push'),
|
| 334 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 335 |
+
(r'[*/]', Comment.Multiline)
|
| 336 |
+
],
|
| 337 |
+
'import': [
|
| 338 |
+
(u'(%s|\\.)+' % idrest, Name.Namespace, '#pop')
|
| 339 |
+
],
|
| 340 |
+
'interpstringcommon': [
|
| 341 |
+
(r'[^"$\\]+', String),
|
| 342 |
+
(r'\$\$', String),
|
| 343 |
+
(r'\$' + letter_letter_digit, String.Interpol),
|
| 344 |
+
(r'\$\{', String.Interpol, 'interpbrace'),
|
| 345 |
+
(r'\\.', String),
|
| 346 |
+
],
|
| 347 |
+
'interptriplestring': [
|
| 348 |
+
(r'"""(?!")', String, '#pop'),
|
| 349 |
+
(r'"', String),
|
| 350 |
+
include('interpstringcommon'),
|
| 351 |
+
],
|
| 352 |
+
'interpstring': [
|
| 353 |
+
(r'"', String, '#pop'),
|
| 354 |
+
include('interpstringcommon'),
|
| 355 |
+
],
|
| 356 |
+
'interpbrace': [
|
| 357 |
+
(r'\}', String.Interpol, '#pop'),
|
| 358 |
+
(r'\{', String.Interpol, '#push'),
|
| 359 |
+
include('root'),
|
| 360 |
+
],
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
class GosuLexer(RegexLexer):
|
| 365 |
+
"""
|
| 366 |
+
For Gosu source code.
|
| 367 |
+
|
| 368 |
+
.. versionadded:: 1.5
|
| 369 |
+
"""
|
| 370 |
+
|
| 371 |
+
name = 'Gosu'
|
| 372 |
+
aliases = ['gosu']
|
| 373 |
+
filenames = ['*.gs', '*.gsx', '*.gsp', '*.vark']
|
| 374 |
+
mimetypes = ['text/x-gosu']
|
| 375 |
+
|
| 376 |
+
flags = re.MULTILINE | re.DOTALL
|
| 377 |
+
|
| 378 |
+
tokens = {
|
| 379 |
+
'root': [
|
| 380 |
+
# method names
|
| 381 |
+
(r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # modifiers etc.
|
| 382 |
+
r'([a-zA-Z_]\w*)' # method name
|
| 383 |
+
r'(\s*)(\()', # signature start
|
| 384 |
+
bygroups(using(this), Name.Function, Text, Operator)),
|
| 385 |
+
(r'[^\S\n]+', Text),
|
| 386 |
+
(r'//.*?\n', Comment.Single),
|
| 387 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 388 |
+
(r'@[a-zA-Z_][\w.]*', Name.Decorator),
|
| 389 |
+
(r'(in|as|typeof|statictypeof|typeis|typeas|if|else|foreach|for|'
|
| 390 |
+
r'index|while|do|continue|break|return|try|catch|finally|this|'
|
| 391 |
+
r'throw|new|switch|case|default|eval|super|outer|classpath|'
|
| 392 |
+
r'using)\b', Keyword),
|
| 393 |
+
(r'(var|delegate|construct|function|private|internal|protected|'
|
| 394 |
+
r'public|abstract|override|final|static|extends|transient|'
|
| 395 |
+
r'implements|represents|readonly)\b', Keyword.Declaration),
|
| 396 |
+
(r'(property\s+)(get|set)?', Keyword.Declaration),
|
| 397 |
+
(r'(boolean|byte|char|double|float|int|long|short|void|block)\b',
|
| 398 |
+
Keyword.Type),
|
| 399 |
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
|
| 400 |
+
(r'(true|false|null|NaN|Infinity)\b', Keyword.Constant),
|
| 401 |
+
(r'(class|interface|enhancement|enum)(\s+)([a-zA-Z_]\w*)',
|
| 402 |
+
bygroups(Keyword.Declaration, Text, Name.Class)),
|
| 403 |
+
(r'(uses)(\s+)([\w.]+\*?)',
|
| 404 |
+
bygroups(Keyword.Namespace, Text, Name.Namespace)),
|
| 405 |
+
(r'"', String, 'string'),
|
| 406 |
+
(r'(\??[.#])([a-zA-Z_]\w*)',
|
| 407 |
+
bygroups(Operator, Name.Attribute)),
|
| 408 |
+
(r'(:)([a-zA-Z_]\w*)',
|
| 409 |
+
bygroups(Operator, Name.Attribute)),
|
| 410 |
+
(r'[a-zA-Z_$]\w*', Name),
|
| 411 |
+
(r'and|or|not|[\\~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
|
| 412 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 413 |
+
(r'[0-9]+', Number.Integer),
|
| 414 |
+
(r'\n', Text)
|
| 415 |
+
],
|
| 416 |
+
'templateText': [
|
| 417 |
+
(r'(\\<)|(\\\$)', String),
|
| 418 |
+
(r'(<%@\s+)(extends|params)',
|
| 419 |
+
bygroups(Operator, Name.Decorator), 'stringTemplate'),
|
| 420 |
+
(r'<%!--.*?--%>', Comment.Multiline),
|
| 421 |
+
(r'(<%)|(<%=)', Operator, 'stringTemplate'),
|
| 422 |
+
(r'\$\{', Operator, 'stringTemplateShorthand'),
|
| 423 |
+
(r'.', String)
|
| 424 |
+
],
|
| 425 |
+
'string': [
|
| 426 |
+
(r'"', String, '#pop'),
|
| 427 |
+
include('templateText')
|
| 428 |
+
],
|
| 429 |
+
'stringTemplate': [
|
| 430 |
+
(r'"', String, 'string'),
|
| 431 |
+
(r'%>', Operator, '#pop'),
|
| 432 |
+
include('root')
|
| 433 |
+
],
|
| 434 |
+
'stringTemplateShorthand': [
|
| 435 |
+
(r'"', String, 'string'),
|
| 436 |
+
(r'\{', Operator, 'stringTemplateShorthand'),
|
| 437 |
+
(r'\}', Operator, '#pop'),
|
| 438 |
+
include('root')
|
| 439 |
+
],
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
|
| 443 |
+
class GosuTemplateLexer(Lexer):
|
| 444 |
+
"""
|
| 445 |
+
For Gosu templates.
|
| 446 |
+
|
| 447 |
+
.. versionadded:: 1.5
|
| 448 |
+
"""
|
| 449 |
+
|
| 450 |
+
name = 'Gosu Template'
|
| 451 |
+
aliases = ['gst']
|
| 452 |
+
filenames = ['*.gst']
|
| 453 |
+
mimetypes = ['text/x-gosu-template']
|
| 454 |
+
|
| 455 |
+
def get_tokens_unprocessed(self, text):
|
| 456 |
+
lexer = GosuLexer()
|
| 457 |
+
stack = ['templateText']
|
| 458 |
+
for item in lexer.get_tokens_unprocessed(text, stack):
|
| 459 |
+
yield item
|
| 460 |
+
|
| 461 |
+
|
| 462 |
+
class GroovyLexer(RegexLexer):
|
| 463 |
+
"""
|
| 464 |
+
For `Groovy <http://groovy.codehaus.org/>`_ source code.
|
| 465 |
+
|
| 466 |
+
.. versionadded:: 1.5
|
| 467 |
+
"""
|
| 468 |
+
|
| 469 |
+
name = 'Groovy'
|
| 470 |
+
aliases = ['groovy']
|
| 471 |
+
filenames = ['*.groovy','*.gradle']
|
| 472 |
+
mimetypes = ['text/x-groovy']
|
| 473 |
+
|
| 474 |
+
flags = re.MULTILINE | re.DOTALL
|
| 475 |
+
|
| 476 |
+
tokens = {
|
| 477 |
+
'root': [
|
| 478 |
+
# Groovy allows a file to start with a shebang
|
| 479 |
+
(r'#!(.*?)$', Comment.Preproc, 'base'),
|
| 480 |
+
default('base'),
|
| 481 |
+
],
|
| 482 |
+
'base': [
|
| 483 |
+
# method names
|
| 484 |
+
(r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
|
| 485 |
+
r'([a-zA-Z_]\w*)' # method name
|
| 486 |
+
r'(\s*)(\()', # signature start
|
| 487 |
+
bygroups(using(this), Name.Function, Text, Operator)),
|
| 488 |
+
(r'[^\S\n]+', Text),
|
| 489 |
+
(r'//.*?\n', Comment.Single),
|
| 490 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 491 |
+
(r'@[a-zA-Z_][\w.]*', Name.Decorator),
|
| 492 |
+
(r'(assert|break|case|catch|continue|default|do|else|finally|for|'
|
| 493 |
+
r'if|goto|instanceof|new|return|switch|this|throw|try|while|in|as)\b',
|
| 494 |
+
Keyword),
|
| 495 |
+
(r'(abstract|const|enum|extends|final|implements|native|private|'
|
| 496 |
+
r'protected|public|static|strictfp|super|synchronized|throws|'
|
| 497 |
+
r'transient|volatile)\b', Keyword.Declaration),
|
| 498 |
+
(r'(def|boolean|byte|char|double|float|int|long|short|void)\b',
|
| 499 |
+
Keyword.Type),
|
| 500 |
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
|
| 501 |
+
(r'(true|false|null)\b', Keyword.Constant),
|
| 502 |
+
(r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
|
| 503 |
+
'class'),
|
| 504 |
+
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
| 505 |
+
(r'""".*?"""', String.Double),
|
| 506 |
+
(r"'''.*?'''", String.Single),
|
| 507 |
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
| 508 |
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
| 509 |
+
(r'\$/((?!/\$).)*/\$', String),
|
| 510 |
+
(r'/(\\\\|\\"|[^/])*/', String),
|
| 511 |
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
|
| 512 |
+
(r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)),
|
| 513 |
+
(r'[a-zA-Z_]\w*:', Name.Label),
|
| 514 |
+
(r'[a-zA-Z_$]\w*', Name),
|
| 515 |
+
(r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
|
| 516 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 517 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 518 |
+
(r'[0-9]+L?', Number.Integer),
|
| 519 |
+
(r'\n', Text)
|
| 520 |
+
],
|
| 521 |
+
'class': [
|
| 522 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop')
|
| 523 |
+
],
|
| 524 |
+
'import': [
|
| 525 |
+
(r'[\w.]+\*?', Name.Namespace, '#pop')
|
| 526 |
+
],
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
def analyse_text(text):
|
| 530 |
+
return shebang_matches(text, r'groovy')
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
class IokeLexer(RegexLexer):
|
| 534 |
+
"""
|
| 535 |
+
For `Ioke <http://ioke.org/>`_ (a strongly typed, dynamic,
|
| 536 |
+
prototype based programming language) source.
|
| 537 |
+
|
| 538 |
+
.. versionadded:: 1.4
|
| 539 |
+
"""
|
| 540 |
+
name = 'Ioke'
|
| 541 |
+
filenames = ['*.ik']
|
| 542 |
+
aliases = ['ioke', 'ik']
|
| 543 |
+
mimetypes = ['text/x-iokesrc']
|
| 544 |
+
tokens = {
|
| 545 |
+
'interpolatableText': [
|
| 546 |
+
(r'(\\b|\\e|\\t|\\n|\\f|\\r|\\"|\\\\|\\#|\\\Z|\\u[0-9a-fA-F]{1,4}'
|
| 547 |
+
r'|\\[0-3]?[0-7]?[0-7])', String.Escape),
|
| 548 |
+
(r'#\{', Punctuation, 'textInterpolationRoot')
|
| 549 |
+
],
|
| 550 |
+
|
| 551 |
+
'text': [
|
| 552 |
+
(r'(?<!\\)"', String, '#pop'),
|
| 553 |
+
include('interpolatableText'),
|
| 554 |
+
(r'[^"]', String)
|
| 555 |
+
],
|
| 556 |
+
|
| 557 |
+
'documentation': [
|
| 558 |
+
(r'(?<!\\)"', String.Doc, '#pop'),
|
| 559 |
+
include('interpolatableText'),
|
| 560 |
+
(r'[^"]', String.Doc)
|
| 561 |
+
],
|
| 562 |
+
|
| 563 |
+
'textInterpolationRoot': [
|
| 564 |
+
(r'\}', Punctuation, '#pop'),
|
| 565 |
+
include('root')
|
| 566 |
+
],
|
| 567 |
+
|
| 568 |
+
'slashRegexp': [
|
| 569 |
+
(r'(?<!\\)/[im-psux]*', String.Regex, '#pop'),
|
| 570 |
+
include('interpolatableText'),
|
| 571 |
+
(r'\\/', String.Regex),
|
| 572 |
+
(r'[^/]', String.Regex)
|
| 573 |
+
],
|
| 574 |
+
|
| 575 |
+
'squareRegexp': [
|
| 576 |
+
(r'(?<!\\)][im-psux]*', String.Regex, '#pop'),
|
| 577 |
+
include('interpolatableText'),
|
| 578 |
+
(r'\\]', String.Regex),
|
| 579 |
+
(r'[^\]]', String.Regex)
|
| 580 |
+
],
|
| 581 |
+
|
| 582 |
+
'squareText': [
|
| 583 |
+
(r'(?<!\\)]', String, '#pop'),
|
| 584 |
+
include('interpolatableText'),
|
| 585 |
+
(r'[^\]]', String)
|
| 586 |
+
],
|
| 587 |
+
|
| 588 |
+
'root': [
|
| 589 |
+
(r'\n', Text),
|
| 590 |
+
(r'\s+', Text),
|
| 591 |
+
|
| 592 |
+
# Comments
|
| 593 |
+
(r';(.*?)\n', Comment),
|
| 594 |
+
(r'\A#!(.*?)\n', Comment),
|
| 595 |
+
|
| 596 |
+
# Regexps
|
| 597 |
+
(r'#/', String.Regex, 'slashRegexp'),
|
| 598 |
+
(r'#r\[', String.Regex, 'squareRegexp'),
|
| 599 |
+
|
| 600 |
+
# Symbols
|
| 601 |
+
(r':[\w!:?]+', String.Symbol),
|
| 602 |
+
(r'[\w!:?]+:(?![\w!?])', String.Other),
|
| 603 |
+
(r':"(\\\\|\\"|[^"])*"', String.Symbol),
|
| 604 |
+
|
| 605 |
+
# Documentation
|
| 606 |
+
(r'((?<=fn\()|(?<=fnx\()|(?<=method\()|(?<=macro\()|(?<=lecro\()'
|
| 607 |
+
r'|(?<=syntax\()|(?<=dmacro\()|(?<=dlecro\()|(?<=dlecrox\()'
|
| 608 |
+
r'|(?<=dsyntax\())\s*"', String.Doc, 'documentation'),
|
| 609 |
+
|
| 610 |
+
# Text
|
| 611 |
+
(r'"', String, 'text'),
|
| 612 |
+
(r'#\[', String, 'squareText'),
|
| 613 |
+
|
| 614 |
+
# Mimic
|
| 615 |
+
(r'\w[\w!:?]+(?=\s*=.*mimic\s)', Name.Entity),
|
| 616 |
+
|
| 617 |
+
# Assignment
|
| 618 |
+
(r'[a-zA-Z_][\w!:?]*(?=[\s]*[+*/-]?=[^=].*($|\.))',
|
| 619 |
+
Name.Variable),
|
| 620 |
+
|
| 621 |
+
# keywords
|
| 622 |
+
(r'(break|cond|continue|do|ensure|for|for:dict|for:set|if|let|'
|
| 623 |
+
r'loop|p:for|p:for:dict|p:for:set|return|unless|until|while|'
|
| 624 |
+
r'with)(?![\w!:?])', Keyword.Reserved),
|
| 625 |
+
|
| 626 |
+
# Origin
|
| 627 |
+
(r'(eval|mimic|print|println)(?![\w!:?])', Keyword),
|
| 628 |
+
|
| 629 |
+
# Base
|
| 630 |
+
(r'(cell\?|cellNames|cellOwner\?|cellOwner|cells|cell|'
|
| 631 |
+
r'documentation|hash|identity|mimic|removeCell\!|undefineCell\!)'
|
| 632 |
+
r'(?![\w!:?])', Keyword),
|
| 633 |
+
|
| 634 |
+
# Ground
|
| 635 |
+
(r'(stackTraceAsText)(?![\w!:?])', Keyword),
|
| 636 |
+
|
| 637 |
+
# DefaultBehaviour Literals
|
| 638 |
+
(r'(dict|list|message|set)(?![\w!:?])', Keyword.Reserved),
|
| 639 |
+
|
| 640 |
+
# DefaultBehaviour Case
|
| 641 |
+
(r'(case|case:and|case:else|case:nand|case:nor|case:not|case:or|'
|
| 642 |
+
r'case:otherwise|case:xor)(?![\w!:?])', Keyword.Reserved),
|
| 643 |
+
|
| 644 |
+
# DefaultBehaviour Reflection
|
| 645 |
+
(r'(asText|become\!|derive|freeze\!|frozen\?|in\?|is\?|kind\?|'
|
| 646 |
+
r'mimic\!|mimics|mimics\?|prependMimic\!|removeAllMimics\!|'
|
| 647 |
+
r'removeMimic\!|same\?|send|thaw\!|uniqueHexId)'
|
| 648 |
+
r'(?![\w!:?])', Keyword),
|
| 649 |
+
|
| 650 |
+
# DefaultBehaviour Aspects
|
| 651 |
+
(r'(after|around|before)(?![\w!:?])', Keyword.Reserved),
|
| 652 |
+
|
| 653 |
+
# DefaultBehaviour
|
| 654 |
+
(r'(kind|cellDescriptionDict|cellSummary|genSym|inspect|notice)'
|
| 655 |
+
r'(?![\w!:?])', Keyword),
|
| 656 |
+
(r'(use|destructuring)', Keyword.Reserved),
|
| 657 |
+
|
| 658 |
+
# DefaultBehavior BaseBehavior
|
| 659 |
+
(r'(cell\?|cellOwner\?|cellOwner|cellNames|cells|cell|'
|
| 660 |
+
r'documentation|identity|removeCell!|undefineCell)'
|
| 661 |
+
r'(?![\w!:?])', Keyword),
|
| 662 |
+
|
| 663 |
+
# DefaultBehavior Internal
|
| 664 |
+
(r'(internal:compositeRegexp|internal:concatenateText|'
|
| 665 |
+
r'internal:createDecimal|internal:createNumber|'
|
| 666 |
+
r'internal:createRegexp|internal:createText)'
|
| 667 |
+
r'(?![\w!:?])', Keyword.Reserved),
|
| 668 |
+
|
| 669 |
+
# DefaultBehaviour Conditions
|
| 670 |
+
(r'(availableRestarts|bind|error\!|findRestart|handle|'
|
| 671 |
+
r'invokeRestart|rescue|restart|signal\!|warn\!)'
|
| 672 |
+
r'(?![\w!:?])', Keyword.Reserved),
|
| 673 |
+
|
| 674 |
+
# constants
|
| 675 |
+
(r'(nil|false|true)(?![\w!:?])', Name.Constant),
|
| 676 |
+
|
| 677 |
+
# names
|
| 678 |
+
(r'(Arity|Base|Call|Condition|DateTime|Aspects|Pointcut|'
|
| 679 |
+
r'Assignment|BaseBehavior|Boolean|Case|AndCombiner|Else|'
|
| 680 |
+
r'NAndCombiner|NOrCombiner|NotCombiner|OrCombiner|XOrCombiner|'
|
| 681 |
+
r'Conditions|Definitions|FlowControl|Internal|Literals|'
|
| 682 |
+
r'Reflection|DefaultMacro|DefaultMethod|DefaultSyntax|Dict|'
|
| 683 |
+
r'FileSystem|Ground|Handler|Hook|IO|IokeGround|Struct|'
|
| 684 |
+
r'LexicalBlock|LexicalMacro|List|Message|Method|Mixins|'
|
| 685 |
+
r'NativeMethod|Number|Origin|Pair|Range|Reflector|Regexp Match|'
|
| 686 |
+
r'Regexp|Rescue|Restart|Runtime|Sequence|Set|Symbol|'
|
| 687 |
+
r'System|Text|Tuple)(?![\w!:?])', Name.Builtin),
|
| 688 |
+
|
| 689 |
+
# functions
|
| 690 |
+
(u'(generateMatchMethod|aliasMethod|\u03bb|\u028E|fnx|fn|method|'
|
| 691 |
+
u'dmacro|dlecro|syntax|macro|dlecrox|lecrox|lecro|syntax)'
|
| 692 |
+
u'(?![\w!:?])', Name.Function),
|
| 693 |
+
|
| 694 |
+
# Numbers
|
| 695 |
+
(r'-?0[xX][0-9a-fA-F]+', Number.Hex),
|
| 696 |
+
(r'-?(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
| 697 |
+
(r'-?\d+', Number.Integer),
|
| 698 |
+
|
| 699 |
+
(r'#\(', Punctuation),
|
| 700 |
+
|
| 701 |
+
# Operators
|
| 702 |
+
(r'(&&>>|\|\|>>|\*\*>>|:::|::|\.\.\.|===|\*\*>|\*\*=|&&>|&&=|'
|
| 703 |
+
r'\|\|>|\|\|=|\->>|\+>>|!>>|<>>>|<>>|&>>|%>>|#>>|@>>|/>>|\*>>|'
|
| 704 |
+
r'\?>>|\|>>|\^>>|~>>|\$>>|=>>|<<=|>>=|<=>|<\->|=~|!~|=>|\+\+|'
|
| 705 |
+
r'\-\-|<=|>=|==|!=|&&|\.\.|\+=|\-=|\*=|\/=|%=|&=|\^=|\|=|<\-|'
|
| 706 |
+
r'\+>|!>|<>|&>|%>|#>|\@>|\/>|\*>|\?>|\|>|\^>|~>|\$>|<\->|\->|'
|
| 707 |
+
r'<<|>>|\*\*|\?\||\?&|\|\||>|<|\*|\/|%|\+|\-|&|\^|\||=|\$|!|~|'
|
| 708 |
+
u'\\?|#|\u2260|\u2218|\u2208|\u2209)', Operator),
|
| 709 |
+
(r'(and|nand|or|xor|nor|return|import)(?![\w!?])',
|
| 710 |
+
Operator),
|
| 711 |
+
|
| 712 |
+
# Punctuation
|
| 713 |
+
(r'(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|\{|\})', Punctuation),
|
| 714 |
+
|
| 715 |
+
# kinds
|
| 716 |
+
(r'[A-Z][\w!:?]*', Name.Class),
|
| 717 |
+
|
| 718 |
+
# default cellnames
|
| 719 |
+
(r'[a-z_][\w!:?]*', Name)
|
| 720 |
+
]
|
| 721 |
+
}
|
| 722 |
+
|
| 723 |
+
|
| 724 |
+
class ClojureLexer(RegexLexer):
|
| 725 |
+
"""
|
| 726 |
+
Lexer for `Clojure <http://clojure.org/>`_ source code.
|
| 727 |
+
|
| 728 |
+
.. versionadded:: 0.11
|
| 729 |
+
"""
|
| 730 |
+
name = 'Clojure'
|
| 731 |
+
aliases = ['clojure', 'clj']
|
| 732 |
+
filenames = ['*.clj']
|
| 733 |
+
mimetypes = ['text/x-clojure', 'application/x-clojure']
|
| 734 |
+
|
| 735 |
+
special_forms = (
|
| 736 |
+
'.', 'def', 'do', 'fn', 'if', 'let', 'new', 'quote', 'var', 'loop'
|
| 737 |
+
)
|
| 738 |
+
|
| 739 |
+
# It's safe to consider 'ns' a declaration thing because it defines a new
|
| 740 |
+
# namespace.
|
| 741 |
+
declarations = (
|
| 742 |
+
'def-', 'defn', 'defn-', 'defmacro', 'defmulti', 'defmethod',
|
| 743 |
+
'defstruct', 'defonce', 'declare', 'definline', 'definterface',
|
| 744 |
+
'defprotocol', 'defrecord', 'deftype', 'defproject', 'ns'
|
| 745 |
+
)
|
| 746 |
+
|
| 747 |
+
builtins = (
|
| 748 |
+
'*', '+', '-', '->', '/', '<', '<=', '=', '==', '>', '>=', '..',
|
| 749 |
+
'accessor', 'agent', 'agent-errors', 'aget', 'alength', 'all-ns',
|
| 750 |
+
'alter', 'and', 'append-child', 'apply', 'array-map', 'aset',
|
| 751 |
+
'aset-boolean', 'aset-byte', 'aset-char', 'aset-double', 'aset-float',
|
| 752 |
+
'aset-int', 'aset-long', 'aset-short', 'assert', 'assoc', 'await',
|
| 753 |
+
'await-for', 'bean', 'binding', 'bit-and', 'bit-not', 'bit-or',
|
| 754 |
+
'bit-shift-left', 'bit-shift-right', 'bit-xor', 'boolean', 'branch?',
|
| 755 |
+
'butlast', 'byte', 'cast', 'char', 'children', 'class',
|
| 756 |
+
'clear-agent-errors', 'comment', 'commute', 'comp', 'comparator',
|
| 757 |
+
'complement', 'concat', 'conj', 'cons', 'constantly', 'cond', 'if-not',
|
| 758 |
+
'construct-proxy', 'contains?', 'count', 'create-ns', 'create-struct',
|
| 759 |
+
'cycle', 'dec', 'deref', 'difference', 'disj', 'dissoc', 'distinct',
|
| 760 |
+
'doall', 'doc', 'dorun', 'doseq', 'dosync', 'dotimes', 'doto',
|
| 761 |
+
'double', 'down', 'drop', 'drop-while', 'edit', 'end?', 'ensure',
|
| 762 |
+
'eval', 'every?', 'false?', 'ffirst', 'file-seq', 'filter', 'find',
|
| 763 |
+
'find-doc', 'find-ns', 'find-var', 'first', 'float', 'flush', 'for',
|
| 764 |
+
'fnseq', 'frest', 'gensym', 'get-proxy-class', 'get',
|
| 765 |
+
'hash-map', 'hash-set', 'identical?', 'identity', 'if-let', 'import',
|
| 766 |
+
'in-ns', 'inc', 'index', 'insert-child', 'insert-left', 'insert-right',
|
| 767 |
+
'inspect-table', 'inspect-tree', 'instance?', 'int', 'interleave',
|
| 768 |
+
'intersection', 'into', 'into-array', 'iterate', 'join', 'key', 'keys',
|
| 769 |
+
'keyword', 'keyword?', 'last', 'lazy-cat', 'lazy-cons', 'left',
|
| 770 |
+
'lefts', 'line-seq', 'list*', 'list', 'load', 'load-file',
|
| 771 |
+
'locking', 'long', 'loop', 'macroexpand', 'macroexpand-1',
|
| 772 |
+
'make-array', 'make-node', 'map', 'map-invert', 'map?', 'mapcat',
|
| 773 |
+
'max', 'max-key', 'memfn', 'merge', 'merge-with', 'meta', 'min',
|
| 774 |
+
'min-key', 'name', 'namespace', 'neg?', 'new', 'newline', 'next',
|
| 775 |
+
'nil?', 'node', 'not', 'not-any?', 'not-every?', 'not=', 'ns-imports',
|
| 776 |
+
'ns-interns', 'ns-map', 'ns-name', 'ns-publics', 'ns-refers',
|
| 777 |
+
'ns-resolve', 'ns-unmap', 'nth', 'nthrest', 'or', 'parse', 'partial',
|
| 778 |
+
'path', 'peek', 'pop', 'pos?', 'pr', 'pr-str', 'print', 'print-str',
|
| 779 |
+
'println', 'println-str', 'prn', 'prn-str', 'project', 'proxy',
|
| 780 |
+
'proxy-mappings', 'quot', 'rand', 'rand-int', 'range', 're-find',
|
| 781 |
+
're-groups', 're-matcher', 're-matches', 're-pattern', 're-seq',
|
| 782 |
+
'read', 'read-line', 'reduce', 'ref', 'ref-set', 'refer', 'rem',
|
| 783 |
+
'remove', 'remove-method', 'remove-ns', 'rename', 'rename-keys',
|
| 784 |
+
'repeat', 'replace', 'replicate', 'resolve', 'rest', 'resultset-seq',
|
| 785 |
+
'reverse', 'rfirst', 'right', 'rights', 'root', 'rrest', 'rseq',
|
| 786 |
+
'second', 'select', 'select-keys', 'send', 'send-off', 'seq',
|
| 787 |
+
'seq-zip', 'seq?', 'set', 'short', 'slurp', 'some', 'sort',
|
| 788 |
+
'sort-by', 'sorted-map', 'sorted-map-by', 'sorted-set',
|
| 789 |
+
'special-symbol?', 'split-at', 'split-with', 'str', 'string?',
|
| 790 |
+
'struct', 'struct-map', 'subs', 'subvec', 'symbol', 'symbol?',
|
| 791 |
+
'sync', 'take', 'take-nth', 'take-while', 'test', 'time', 'to-array',
|
| 792 |
+
'to-array-2d', 'tree-seq', 'true?', 'union', 'up', 'update-proxy',
|
| 793 |
+
'val', 'vals', 'var-get', 'var-set', 'var?', 'vector', 'vector-zip',
|
| 794 |
+
'vector?', 'when', 'when-first', 'when-let', 'when-not',
|
| 795 |
+
'with-local-vars', 'with-meta', 'with-open', 'with-out-str',
|
| 796 |
+
'xml-seq', 'xml-zip', 'zero?', 'zipmap', 'zipper')
|
| 797 |
+
|
| 798 |
+
# valid names for identifiers
|
| 799 |
+
# well, names can only not consist fully of numbers
|
| 800 |
+
# but this should be good enough for now
|
| 801 |
+
|
| 802 |
+
# TODO / should divide keywords/symbols into namespace/rest
|
| 803 |
+
# but that's hard, so just pretend / is part of the name
|
| 804 |
+
valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+'
|
| 805 |
+
|
| 806 |
+
tokens = {
|
| 807 |
+
'root': [
|
| 808 |
+
# the comments - always starting with semicolon
|
| 809 |
+
# and going to the end of the line
|
| 810 |
+
(r';.*$', Comment.Single),
|
| 811 |
+
|
| 812 |
+
# whitespaces - usually not relevant
|
| 813 |
+
(r'[,\s]+', Text),
|
| 814 |
+
|
| 815 |
+
# numbers
|
| 816 |
+
(r'-?\d+\.\d+', Number.Float),
|
| 817 |
+
(r'-?\d+', Number.Integer),
|
| 818 |
+
(r'0x-?[abcdef\d]+', Number.Hex),
|
| 819 |
+
|
| 820 |
+
# strings, symbols and characters
|
| 821 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 822 |
+
(r"'" + valid_name, String.Symbol),
|
| 823 |
+
(r"\\(.|[a-z]+)", String.Char),
|
| 824 |
+
|
| 825 |
+
# keywords
|
| 826 |
+
(r'::?#?' + valid_name, String.Symbol),
|
| 827 |
+
|
| 828 |
+
# special operators
|
| 829 |
+
(r'~@|[`\'#^~&@]', Operator),
|
| 830 |
+
|
| 831 |
+
# highlight the special forms
|
| 832 |
+
(words(special_forms, suffix=' '), Keyword),
|
| 833 |
+
|
| 834 |
+
# Technically, only the special forms are 'keywords'. The problem
|
| 835 |
+
# is that only treating them as keywords means that things like
|
| 836 |
+
# 'defn' and 'ns' need to be highlighted as builtins. This is ugly
|
| 837 |
+
# and weird for most styles. So, as a compromise we're going to
|
| 838 |
+
# highlight them as Keyword.Declarations.
|
| 839 |
+
(words(declarations, suffix=' '), Keyword.Declaration),
|
| 840 |
+
|
| 841 |
+
# highlight the builtins
|
| 842 |
+
(words(builtins, suffix=' '), Name.Builtin),
|
| 843 |
+
|
| 844 |
+
# the remaining functions
|
| 845 |
+
(r'(?<=\()' + valid_name, Name.Function),
|
| 846 |
+
|
| 847 |
+
# find the remaining variables
|
| 848 |
+
(valid_name, Name.Variable),
|
| 849 |
+
|
| 850 |
+
# Clojure accepts vector notation
|
| 851 |
+
(r'(\[|\])', Punctuation),
|
| 852 |
+
|
| 853 |
+
# Clojure accepts map notation
|
| 854 |
+
(r'(\{|\})', Punctuation),
|
| 855 |
+
|
| 856 |
+
# the famous parentheses!
|
| 857 |
+
(r'(\(|\))', Punctuation),
|
| 858 |
+
],
|
| 859 |
+
}
|
| 860 |
+
|
| 861 |
+
|
| 862 |
+
class ClojureScriptLexer(ClojureLexer):
|
| 863 |
+
"""
|
| 864 |
+
Lexer for `ClojureScript <http://clojure.org/clojurescript>`_
|
| 865 |
+
source code.
|
| 866 |
+
|
| 867 |
+
.. versionadded:: 2.0
|
| 868 |
+
"""
|
| 869 |
+
name = 'ClojureScript'
|
| 870 |
+
aliases = ['clojurescript', 'cljs']
|
| 871 |
+
filenames = ['*.cljs']
|
| 872 |
+
mimetypes = ['text/x-clojurescript', 'application/x-clojurescript']
|
| 873 |
+
|
| 874 |
+
|
| 875 |
+
class TeaLangLexer(RegexLexer):
|
| 876 |
+
"""
|
| 877 |
+
For `Tea <http://teatrove.org/>`_ source code. Only used within a
|
| 878 |
+
TeaTemplateLexer.
|
| 879 |
+
|
| 880 |
+
.. versionadded:: 1.5
|
| 881 |
+
"""
|
| 882 |
+
|
| 883 |
+
flags = re.MULTILINE | re.DOTALL
|
| 884 |
+
|
| 885 |
+
tokens = {
|
| 886 |
+
'root': [
|
| 887 |
+
# method names
|
| 888 |
+
(r'^(\s*(?:[a-zA-Z_][\w\.\[\]]*\s+)+?)' # return arguments
|
| 889 |
+
r'([a-zA-Z_]\w*)' # method name
|
| 890 |
+
r'(\s*)(\()', # signature start
|
| 891 |
+
bygroups(using(this), Name.Function, Text, Operator)),
|
| 892 |
+
(r'[^\S\n]+', Text),
|
| 893 |
+
(r'//.*?\n', Comment.Single),
|
| 894 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 895 |
+
(r'@[a-zA-Z_][\w\.]*', Name.Decorator),
|
| 896 |
+
(r'(and|break|else|foreach|if|in|not|or|reverse)\b',
|
| 897 |
+
Keyword),
|
| 898 |
+
(r'(as|call|define)\b', Keyword.Declaration),
|
| 899 |
+
(r'(true|false|null)\b', Keyword.Constant),
|
| 900 |
+
(r'(template)(\s+)', bygroups(Keyword.Declaration, Text), 'template'),
|
| 901 |
+
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
| 902 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 903 |
+
(r'\'(\\\\|\\\'|[^\'])*\'', String),
|
| 904 |
+
(r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)),
|
| 905 |
+
(r'[a-zA-Z_]\w*:', Name.Label),
|
| 906 |
+
(r'[a-zA-Z_\$]\w*', Name),
|
| 907 |
+
(r'(isa|[.]{3}|[.]{2}|[=#!<>+-/%&;,.\*\\\(\)\[\]\{\}])', Operator),
|
| 908 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 909 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 910 |
+
(r'[0-9]+L?', Number.Integer),
|
| 911 |
+
(r'\n', Text)
|
| 912 |
+
],
|
| 913 |
+
'template': [
|
| 914 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop')
|
| 915 |
+
],
|
| 916 |
+
'import': [
|
| 917 |
+
(r'[\w.]+\*?', Name.Namespace, '#pop')
|
| 918 |
+
],
|
| 919 |
+
}
|
| 920 |
+
|
| 921 |
+
|
| 922 |
+
class CeylonLexer(RegexLexer):
|
| 923 |
+
"""
|
| 924 |
+
For `Ceylon <http://ceylon-lang.org/>`_ source code.
|
| 925 |
+
|
| 926 |
+
.. versionadded:: 1.6
|
| 927 |
+
"""
|
| 928 |
+
|
| 929 |
+
name = 'Ceylon'
|
| 930 |
+
aliases = ['ceylon']
|
| 931 |
+
filenames = ['*.ceylon']
|
| 932 |
+
mimetypes = ['text/x-ceylon']
|
| 933 |
+
|
| 934 |
+
flags = re.MULTILINE | re.DOTALL
|
| 935 |
+
|
| 936 |
+
#: optional Comment or Whitespace
|
| 937 |
+
_ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
|
| 938 |
+
|
| 939 |
+
tokens = {
|
| 940 |
+
'root': [
|
| 941 |
+
# method names
|
| 942 |
+
(r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
|
| 943 |
+
r'([a-zA-Z_]\w*)' # method name
|
| 944 |
+
r'(\s*)(\()', # signature start
|
| 945 |
+
bygroups(using(this), Name.Function, Text, Operator)),
|
| 946 |
+
(r'[^\S\n]+', Text),
|
| 947 |
+
(r'//.*?\n', Comment.Single),
|
| 948 |
+
(r'/\*', Comment.Multiline, 'comment'),
|
| 949 |
+
(r'(shared|abstract|formal|default|actual|variable|deprecated|small|'
|
| 950 |
+
r'late|literal|doc|by|see|throws|optional|license|tagged|final|native|'
|
| 951 |
+
r'annotation|sealed)\b', Name.Decorator),
|
| 952 |
+
(r'(break|case|catch|continue|else|finally|for|in|'
|
| 953 |
+
r'if|return|switch|this|throw|try|while|is|exists|dynamic|'
|
| 954 |
+
r'nonempty|then|outer|assert|let)\b', Keyword),
|
| 955 |
+
(r'(abstracts|extends|satisfies|'
|
| 956 |
+
r'super|given|of|out|assign)\b', Keyword.Declaration),
|
| 957 |
+
(r'(function|value|void|new)\b',
|
| 958 |
+
Keyword.Type),
|
| 959 |
+
(r'(assembly|module|package)(\s+)', bygroups(Keyword.Namespace, Text)),
|
| 960 |
+
(r'(true|false|null)\b', Keyword.Constant),
|
| 961 |
+
(r'(class|interface|object|alias)(\s+)',
|
| 962 |
+
bygroups(Keyword.Declaration, Text), 'class'),
|
| 963 |
+
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
| 964 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 965 |
+
(r"'\\.'|'[^\\]'|'\\\{#[0-9a-fA-F]{4}\}'", String.Char),
|
| 966 |
+
(r'".*``.*``.*"', String.Interpol),
|
| 967 |
+
(r'(\.)([a-z_]\w*)',
|
| 968 |
+
bygroups(Operator, Name.Attribute)),
|
| 969 |
+
(r'[a-zA-Z_]\w*:', Name.Label),
|
| 970 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 971 |
+
(r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
|
| 972 |
+
(r'\d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
|
| 973 |
+
(r'\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
|
| 974 |
+
Number.Float),
|
| 975 |
+
(r'[0-9][0-9]*\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
|
| 976 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
|
| 977 |
+
Number.Float),
|
| 978 |
+
(r'#([0-9a-fA-F]{4})(_[0-9a-fA-F]{4})+', Number.Hex),
|
| 979 |
+
(r'#[0-9a-fA-F]+', Number.Hex),
|
| 980 |
+
(r'\$([01]{4})(_[01]{4})+', Number.Bin),
|
| 981 |
+
(r'\$[01]+', Number.Bin),
|
| 982 |
+
(r'\d{1,3}(_\d{3})+[kMGTP]?', Number.Integer),
|
| 983 |
+
(r'[0-9]+[kMGTP]?', Number.Integer),
|
| 984 |
+
(r'\n', Text)
|
| 985 |
+
],
|
| 986 |
+
'class': [
|
| 987 |
+
(r'[A-Za-z_]\w*', Name.Class, '#pop')
|
| 988 |
+
],
|
| 989 |
+
'import': [
|
| 990 |
+
(r'[a-z][\w.]*',
|
| 991 |
+
Name.Namespace, '#pop')
|
| 992 |
+
],
|
| 993 |
+
'comment': [
|
| 994 |
+
(r'[^*/]', Comment.Multiline),
|
| 995 |
+
(r'/\*', Comment.Multiline, '#push'),
|
| 996 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 997 |
+
(r'[*/]', Comment.Multiline)
|
| 998 |
+
],
|
| 999 |
+
}
|
| 1000 |
+
|
| 1001 |
+
|
| 1002 |
+
class KotlinLexer(RegexLexer):
|
| 1003 |
+
"""
|
| 1004 |
+
For `Kotlin <http://kotlinlang.org/>`_
|
| 1005 |
+
source code.
|
| 1006 |
+
|
| 1007 |
+
.. versionadded:: 1.5
|
| 1008 |
+
"""
|
| 1009 |
+
|
| 1010 |
+
name = 'Kotlin'
|
| 1011 |
+
aliases = ['kotlin']
|
| 1012 |
+
filenames = ['*.kt']
|
| 1013 |
+
mimetypes = ['text/x-kotlin']
|
| 1014 |
+
|
| 1015 |
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
| 1016 |
+
|
| 1017 |
+
kt_name = ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
|
| 1018 |
+
'[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc', 'Cf',
|
| 1019 |
+
'Mn', 'Mc') + ']*')
|
| 1020 |
+
kt_id = '(' + kt_name + '|`' + kt_name + '`)'
|
| 1021 |
+
|
| 1022 |
+
tokens = {
|
| 1023 |
+
'root': [
|
| 1024 |
+
(r'^\s*\[.*?\]', Name.Attribute),
|
| 1025 |
+
(r'[^\S\n]+', Text),
|
| 1026 |
+
(r'\\\n', Text), # line continuation
|
| 1027 |
+
(r'//.*?\n', Comment.Single),
|
| 1028 |
+
(r'/[*].*?[*]/', Comment.Multiline),
|
| 1029 |
+
(r'\n', Text),
|
| 1030 |
+
(r'::|!!|\?[:.]', Operator),
|
| 1031 |
+
(r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation),
|
| 1032 |
+
(r'[{}]', Punctuation),
|
| 1033 |
+
(r'@"(""|[^"])*"', String),
|
| 1034 |
+
(r'"(\\\\|\\"|[^"\n])*["\n]', String),
|
| 1035 |
+
(r"'\\.'|'[^\\]'", String.Char),
|
| 1036 |
+
(r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFL]?|"
|
| 1037 |
+
r"0[xX][0-9a-fA-F]+[Ll]?", Number),
|
| 1038 |
+
(r'(class)(\s+)(object)', bygroups(Keyword, Text, Keyword)),
|
| 1039 |
+
(r'(class|interface|object)(\s+)', bygroups(Keyword, Text), 'class'),
|
| 1040 |
+
(r'(package|import)(\s+)', bygroups(Keyword, Text), 'package'),
|
| 1041 |
+
(r'(val|var)(\s+)', bygroups(Keyword, Text), 'property'),
|
| 1042 |
+
(r'(fun)(\s+)', bygroups(Keyword, Text), 'function'),
|
| 1043 |
+
(r'(abstract|annotation|as|break|by|catch|class|companion|const|'
|
| 1044 |
+
r'constructor|continue|crossinline|data|do|dynamic|else|enum|'
|
| 1045 |
+
r'external|false|final|finally|for|fun|get|if|import|in|infix|'
|
| 1046 |
+
r'inline|inner|interface|internal|is|lateinit|noinline|null|'
|
| 1047 |
+
r'object|open|operator|out|override|package|private|protected|'
|
| 1048 |
+
r'public|reified|return|sealed|set|super|tailrec|this|throw|'
|
| 1049 |
+
r'true|try|val|var|vararg|when|where|while)\b', Keyword),
|
| 1050 |
+
(kt_id, Name),
|
| 1051 |
+
],
|
| 1052 |
+
'package': [
|
| 1053 |
+
(r'\S+', Name.Namespace, '#pop')
|
| 1054 |
+
],
|
| 1055 |
+
'class': [
|
| 1056 |
+
(kt_id, Name.Class, '#pop')
|
| 1057 |
+
],
|
| 1058 |
+
'property': [
|
| 1059 |
+
(kt_id, Name.Property, '#pop')
|
| 1060 |
+
],
|
| 1061 |
+
'function': [
|
| 1062 |
+
(kt_id, Name.Function, '#pop')
|
| 1063 |
+
],
|
| 1064 |
+
}
|
| 1065 |
+
|
| 1066 |
+
|
| 1067 |
+
class XtendLexer(RegexLexer):
|
| 1068 |
+
"""
|
| 1069 |
+
For `Xtend <http://xtend-lang.org/>`_ source code.
|
| 1070 |
+
|
| 1071 |
+
.. versionadded:: 1.6
|
| 1072 |
+
"""
|
| 1073 |
+
|
| 1074 |
+
name = 'Xtend'
|
| 1075 |
+
aliases = ['xtend']
|
| 1076 |
+
filenames = ['*.xtend']
|
| 1077 |
+
mimetypes = ['text/x-xtend']
|
| 1078 |
+
|
| 1079 |
+
flags = re.MULTILINE | re.DOTALL
|
| 1080 |
+
|
| 1081 |
+
tokens = {
|
| 1082 |
+
'root': [
|
| 1083 |
+
# method names
|
| 1084 |
+
(r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
|
| 1085 |
+
r'([a-zA-Z_$][\w$]*)' # method name
|
| 1086 |
+
r'(\s*)(\()', # signature start
|
| 1087 |
+
bygroups(using(this), Name.Function, Text, Operator)),
|
| 1088 |
+
(r'[^\S\n]+', Text),
|
| 1089 |
+
(r'//.*?\n', Comment.Single),
|
| 1090 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 1091 |
+
(r'@[a-zA-Z_][\w.]*', Name.Decorator),
|
| 1092 |
+
(r'(assert|break|case|catch|continue|default|do|else|finally|for|'
|
| 1093 |
+
r'if|goto|instanceof|new|return|switch|this|throw|try|while|IF|'
|
| 1094 |
+
r'ELSE|ELSEIF|ENDIF|FOR|ENDFOR|SEPARATOR|BEFORE|AFTER)\b',
|
| 1095 |
+
Keyword),
|
| 1096 |
+
(r'(def|abstract|const|enum|extends|final|implements|native|private|'
|
| 1097 |
+
r'protected|public|static|strictfp|super|synchronized|throws|'
|
| 1098 |
+
r'transient|volatile)\b', Keyword.Declaration),
|
| 1099 |
+
(r'(boolean|byte|char|double|float|int|long|short|void)\b',
|
| 1100 |
+
Keyword.Type),
|
| 1101 |
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
|
| 1102 |
+
(r'(true|false|null)\b', Keyword.Constant),
|
| 1103 |
+
(r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
|
| 1104 |
+
'class'),
|
| 1105 |
+
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
| 1106 |
+
(r"(''')", String, 'template'),
|
| 1107 |
+
(u'(\u00BB)', String, 'template'),
|
| 1108 |
+
(r'"(\\\\|\\"|[^"])*"', String),
|
| 1109 |
+
(r"'(\\\\|\\'|[^'])*'", String),
|
| 1110 |
+
(r'[a-zA-Z_]\w*:', Name.Label),
|
| 1111 |
+
(r'[a-zA-Z_$]\w*', Name),
|
| 1112 |
+
(r'[~^*!%&\[\](){}<>\|+=:;,./?-]', Operator),
|
| 1113 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 1114 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 1115 |
+
(r'[0-9]+L?', Number.Integer),
|
| 1116 |
+
(r'\n', Text)
|
| 1117 |
+
],
|
| 1118 |
+
'class': [
|
| 1119 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop')
|
| 1120 |
+
],
|
| 1121 |
+
'import': [
|
| 1122 |
+
(r'[\w.]+\*?', Name.Namespace, '#pop')
|
| 1123 |
+
],
|
| 1124 |
+
'template': [
|
| 1125 |
+
(r"'''", String, '#pop'),
|
| 1126 |
+
(u'\u00AB', String, '#pop'),
|
| 1127 |
+
(r'.', String)
|
| 1128 |
+
],
|
| 1129 |
+
}
|
| 1130 |
+
|
| 1131 |
+
|
| 1132 |
+
class PigLexer(RegexLexer):
|
| 1133 |
+
"""
|
| 1134 |
+
For `Pig Latin <https://pig.apache.org/>`_ source code.
|
| 1135 |
+
|
| 1136 |
+
.. versionadded:: 2.0
|
| 1137 |
+
"""
|
| 1138 |
+
|
| 1139 |
+
name = 'Pig'
|
| 1140 |
+
aliases = ['pig']
|
| 1141 |
+
filenames = ['*.pig']
|
| 1142 |
+
mimetypes = ['text/x-pig']
|
| 1143 |
+
|
| 1144 |
+
flags = re.MULTILINE | re.IGNORECASE
|
| 1145 |
+
|
| 1146 |
+
tokens = {
|
| 1147 |
+
'root': [
|
| 1148 |
+
(r'\s+', Text),
|
| 1149 |
+
(r'--.*', Comment),
|
| 1150 |
+
(r'/\*[\w\W]*?\*/', Comment.Multiline),
|
| 1151 |
+
(r'\\\n', Text),
|
| 1152 |
+
(r'\\', Text),
|
| 1153 |
+
(r'\'(?:\\[ntbrf\\\']|\\u[0-9a-f]{4}|[^\'\\\n\r])*\'', String),
|
| 1154 |
+
include('keywords'),
|
| 1155 |
+
include('types'),
|
| 1156 |
+
include('builtins'),
|
| 1157 |
+
include('punct'),
|
| 1158 |
+
include('operators'),
|
| 1159 |
+
(r'[0-9]*\.[0-9]+(e[0-9]+)?[fd]?', Number.Float),
|
| 1160 |
+
(r'0x[0-9a-f]+', Number.Hex),
|
| 1161 |
+
(r'[0-9]+L?', Number.Integer),
|
| 1162 |
+
(r'\n', Text),
|
| 1163 |
+
(r'([a-z_]\w*)(\s*)(\()',
|
| 1164 |
+
bygroups(Name.Function, Text, Punctuation)),
|
| 1165 |
+
(r'[()#:]', Text),
|
| 1166 |
+
(r'[^(:#\'")\s]+', Text),
|
| 1167 |
+
(r'\S+\s+', Text) # TODO: make tests pass without \s+
|
| 1168 |
+
],
|
| 1169 |
+
'keywords': [
|
| 1170 |
+
(r'(assert|and|any|all|arrange|as|asc|bag|by|cache|CASE|cat|cd|cp|'
|
| 1171 |
+
r'%declare|%default|define|dense|desc|describe|distinct|du|dump|'
|
| 1172 |
+
r'eval|exex|explain|filter|flatten|foreach|full|generate|group|'
|
| 1173 |
+
r'help|if|illustrate|import|inner|input|into|is|join|kill|left|'
|
| 1174 |
+
r'limit|load|ls|map|matches|mkdir|mv|not|null|onschema|or|order|'
|
| 1175 |
+
r'outer|output|parallel|pig|pwd|quit|register|returns|right|rm|'
|
| 1176 |
+
r'rmf|rollup|run|sample|set|ship|split|stderr|stdin|stdout|store|'
|
| 1177 |
+
r'stream|through|union|using|void)\b', Keyword)
|
| 1178 |
+
],
|
| 1179 |
+
'builtins': [
|
| 1180 |
+
(r'(AVG|BinStorage|cogroup|CONCAT|copyFromLocal|copyToLocal|COUNT|'
|
| 1181 |
+
r'cross|DIFF|MAX|MIN|PigDump|PigStorage|SIZE|SUM|TextLoader|'
|
| 1182 |
+
r'TOKENIZE)\b', Name.Builtin)
|
| 1183 |
+
],
|
| 1184 |
+
'types': [
|
| 1185 |
+
(r'(bytearray|BIGINTEGER|BIGDECIMAL|chararray|datetime|double|float|'
|
| 1186 |
+
r'int|long|tuple)\b', Keyword.Type)
|
| 1187 |
+
],
|
| 1188 |
+
'punct': [
|
| 1189 |
+
(r'[;(){}\[\]]', Punctuation),
|
| 1190 |
+
],
|
| 1191 |
+
'operators': [
|
| 1192 |
+
(r'[#=,./%+\-?]', Operator),
|
| 1193 |
+
(r'(eq|gt|lt|gte|lte|neq|matches)\b', Operator),
|
| 1194 |
+
(r'(==|<=|<|>=|>|!=)', Operator),
|
| 1195 |
+
],
|
| 1196 |
+
}
|
| 1197 |
+
|
| 1198 |
+
|
| 1199 |
+
class GoloLexer(RegexLexer):
|
| 1200 |
+
"""
|
| 1201 |
+
For `Golo <http://golo-lang.org/>`_ source code.
|
| 1202 |
+
|
| 1203 |
+
.. versionadded:: 2.0
|
| 1204 |
+
"""
|
| 1205 |
+
|
| 1206 |
+
name = 'Golo'
|
| 1207 |
+
filenames = ['*.golo']
|
| 1208 |
+
aliases = ['golo']
|
| 1209 |
+
|
| 1210 |
+
tokens = {
|
| 1211 |
+
'root': [
|
| 1212 |
+
(r'[^\S\n]+', Text),
|
| 1213 |
+
|
| 1214 |
+
(r'#.*$', Comment),
|
| 1215 |
+
|
| 1216 |
+
(r'(\^|\.\.\.|:|\?:|->|==|!=|=|\+|\*|%|/|<=|<|>=|>|=|\.)',
|
| 1217 |
+
Operator),
|
| 1218 |
+
(r'(?<=[^-])(-)(?=[^-])', Operator),
|
| 1219 |
+
|
| 1220 |
+
(r'(?<=[^`])(is|isnt|and|or|not|oftype|in|orIfNull)\b', Operator.Word),
|
| 1221 |
+
(r'[]{}|(),[]', Punctuation),
|
| 1222 |
+
|
| 1223 |
+
(r'(module|import)(\s+)',
|
| 1224 |
+
bygroups(Keyword.Namespace, Text),
|
| 1225 |
+
'modname'),
|
| 1226 |
+
(r'\b([a-zA-Z_][\w$.]*)(::)', bygroups(Name.Namespace, Punctuation)),
|
| 1227 |
+
(r'\b([a-zA-Z_][\w$]*(?:\.[a-zA-Z_][\w$]*)+)\b', Name.Namespace),
|
| 1228 |
+
|
| 1229 |
+
(r'(let|var)(\s+)',
|
| 1230 |
+
bygroups(Keyword.Declaration, Text),
|
| 1231 |
+
'varname'),
|
| 1232 |
+
(r'(struct)(\s+)',
|
| 1233 |
+
bygroups(Keyword.Declaration, Text),
|
| 1234 |
+
'structname'),
|
| 1235 |
+
(r'(function)(\s+)',
|
| 1236 |
+
bygroups(Keyword.Declaration, Text),
|
| 1237 |
+
'funcname'),
|
| 1238 |
+
|
| 1239 |
+
(r'(null|true|false)\b', Keyword.Constant),
|
| 1240 |
+
(r'(augment|pimp'
|
| 1241 |
+
r'|if|else|case|match|return'
|
| 1242 |
+
r'|case|when|then|otherwise'
|
| 1243 |
+
r'|while|for|foreach'
|
| 1244 |
+
r'|try|catch|finally|throw'
|
| 1245 |
+
r'|local'
|
| 1246 |
+
r'|continue|break)\b', Keyword),
|
| 1247 |
+
|
| 1248 |
+
(r'(map|array|list|set|vector|tuple)(\[)',
|
| 1249 |
+
bygroups(Name.Builtin, Punctuation)),
|
| 1250 |
+
(r'(print|println|readln|raise|fun'
|
| 1251 |
+
r'|asInterfaceInstance)\b', Name.Builtin),
|
| 1252 |
+
(r'(`?[a-zA-Z_][\w$]*)(\()',
|
| 1253 |
+
bygroups(Name.Function, Punctuation)),
|
| 1254 |
+
|
| 1255 |
+
(r'-?[\d_]*\.[\d_]*([eE][+-]?\d[\d_]*)?F?', Number.Float),
|
| 1256 |
+
(r'0[0-7]+j?', Number.Oct),
|
| 1257 |
+
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
| 1258 |
+
(r'-?\d[\d_]*L', Number.Integer.Long),
|
| 1259 |
+
(r'-?\d[\d_]*', Number.Integer),
|
| 1260 |
+
|
| 1261 |
+
('`?[a-zA-Z_][\w$]*', Name),
|
| 1262 |
+
(r'@[a-zA-Z_][\w$.]*', Name.Decorator),
|
| 1263 |
+
|
| 1264 |
+
(r'"""', String, combined('stringescape', 'triplestring')),
|
| 1265 |
+
(r'"', String, combined('stringescape', 'doublestring')),
|
| 1266 |
+
(r"'", String, combined('stringescape', 'singlestring')),
|
| 1267 |
+
(r'----((.|\n)*?)----', String.Doc)
|
| 1268 |
+
|
| 1269 |
+
],
|
| 1270 |
+
|
| 1271 |
+
'funcname': [
|
| 1272 |
+
(r'`?[a-zA-Z_][\w$]*', Name.Function, '#pop'),
|
| 1273 |
+
],
|
| 1274 |
+
'modname': [
|
| 1275 |
+
(r'[a-zA-Z_][\w$.]*\*?', Name.Namespace, '#pop')
|
| 1276 |
+
],
|
| 1277 |
+
'structname': [
|
| 1278 |
+
(r'`?[\w.]+\*?', Name.Class, '#pop')
|
| 1279 |
+
],
|
| 1280 |
+
'varname': [
|
| 1281 |
+
(r'`?[a-zA-Z_][\w$]*', Name.Variable, '#pop'),
|
| 1282 |
+
],
|
| 1283 |
+
'string': [
|
| 1284 |
+
(r'[^\\\'"\n]+', String),
|
| 1285 |
+
(r'[\'"\\]', String)
|
| 1286 |
+
],
|
| 1287 |
+
'stringescape': [
|
| 1288 |
+
(r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
|
| 1289 |
+
r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
|
| 1290 |
+
],
|
| 1291 |
+
'triplestring': [
|
| 1292 |
+
(r'"""', String, '#pop'),
|
| 1293 |
+
include('string'),
|
| 1294 |
+
(r'\n', String),
|
| 1295 |
+
],
|
| 1296 |
+
'doublestring': [
|
| 1297 |
+
(r'"', String.Double, '#pop'),
|
| 1298 |
+
include('string'),
|
| 1299 |
+
],
|
| 1300 |
+
'singlestring': [
|
| 1301 |
+
(r"'", String, '#pop'),
|
| 1302 |
+
include('string'),
|
| 1303 |
+
],
|
| 1304 |
+
'operators': [
|
| 1305 |
+
(r'[#=,./%+\-?]', Operator),
|
| 1306 |
+
(r'(eq|gt|lt|gte|lte|neq|matches)\b', Operator),
|
| 1307 |
+
(r'(==|<=|<|>=|>|!=)', Operator),
|
| 1308 |
+
],
|
| 1309 |
+
}
|
| 1310 |
+
|
| 1311 |
+
|
| 1312 |
+
class JasminLexer(RegexLexer):
|
| 1313 |
+
"""
|
| 1314 |
+
For `Jasmin <http://jasmin.sourceforge.net/>`_ assembly code.
|
| 1315 |
+
|
| 1316 |
+
.. versionadded:: 2.0
|
| 1317 |
+
"""
|
| 1318 |
+
|
| 1319 |
+
name = 'Jasmin'
|
| 1320 |
+
aliases = ['jasmin', 'jasminxt']
|
| 1321 |
+
filenames = ['*.j']
|
| 1322 |
+
|
| 1323 |
+
_whitespace = r' \n\t\r'
|
| 1324 |
+
_ws = r'(?:[%s]+)' % _whitespace
|
| 1325 |
+
_separator = r'%s:=' % _whitespace
|
| 1326 |
+
_break = r'(?=[%s]|$)' % _separator
|
| 1327 |
+
_name = r'[^%s]+' % _separator
|
| 1328 |
+
_unqualified_name = r'(?:[^%s.;\[/]+)' % _separator
|
| 1329 |
+
|
| 1330 |
+
tokens = {
|
| 1331 |
+
'default': [
|
| 1332 |
+
(r'\n', Text, '#pop'),
|
| 1333 |
+
(r"'", String.Single, ('#pop', 'quote')),
|
| 1334 |
+
(r'"', String.Double, 'string'),
|
| 1335 |
+
(r'=', Punctuation),
|
| 1336 |
+
(r':', Punctuation, 'label'),
|
| 1337 |
+
(_ws, Text),
|
| 1338 |
+
(r';.*', Comment.Single),
|
| 1339 |
+
(r'(\$[-+])?0x-?[\da-fA-F]+%s' % _break, Number.Hex),
|
| 1340 |
+
(r'(\$[-+]|\+)?-?\d+%s' % _break, Number.Integer),
|
| 1341 |
+
(r'-?(\d+\.\d*|\.\d+)([eE][-+]?\d+)?[fFdD]?'
|
| 1342 |
+
r'[\x00-\x08\x0b\x0c\x0e-\x1f]*%s' % _break, Number.Float),
|
| 1343 |
+
(r'\$%s' % _name, Name.Variable),
|
| 1344 |
+
|
| 1345 |
+
# Directives
|
| 1346 |
+
(r'\.annotation%s' % _break, Keyword.Reserved, 'annotation'),
|
| 1347 |
+
(r'(\.attribute|\.bytecode|\.debug|\.deprecated|\.enclosing|'
|
| 1348 |
+
r'\.interface|\.line|\.signature|\.source|\.stack|\.var|abstract|'
|
| 1349 |
+
r'annotation|bridge|class|default|enum|field|final|fpstrict|'
|
| 1350 |
+
r'interface|native|private|protected|public|signature|static|'
|
| 1351 |
+
r'synchronized|synthetic|transient|varargs|volatile)%s' % _break,
|
| 1352 |
+
Keyword.Reserved),
|
| 1353 |
+
(r'\.catch%s' % _break, Keyword.Reserved, 'caught-exception'),
|
| 1354 |
+
(r'(\.class|\.implements|\.inner|\.super|inner|invisible|'
|
| 1355 |
+
r'invisibleparam|outer|visible|visibleparam)%s' % _break,
|
| 1356 |
+
Keyword.Reserved, 'class/convert-dots'),
|
| 1357 |
+
(r'\.field%s' % _break, Keyword.Reserved,
|
| 1358 |
+
('descriptor/convert-dots', 'field')),
|
| 1359 |
+
(r'(\.end|\.limit|use)%s' % _break, Keyword.Reserved,
|
| 1360 |
+
'no-verification'),
|
| 1361 |
+
(r'\.method%s' % _break, Keyword.Reserved, 'method'),
|
| 1362 |
+
(r'\.set%s' % _break, Keyword.Reserved, 'var'),
|
| 1363 |
+
(r'\.throws%s' % _break, Keyword.Reserved, 'exception'),
|
| 1364 |
+
(r'(from|offset|to|using)%s' % _break, Keyword.Reserved, 'label'),
|
| 1365 |
+
(r'is%s' % _break, Keyword.Reserved,
|
| 1366 |
+
('descriptor/convert-dots', 'var')),
|
| 1367 |
+
(r'(locals|stack)%s' % _break, Keyword.Reserved, 'verification'),
|
| 1368 |
+
(r'method%s' % _break, Keyword.Reserved, 'enclosing-method'),
|
| 1369 |
+
|
| 1370 |
+
# Instructions
|
| 1371 |
+
(words((
|
| 1372 |
+
'aaload', 'aastore', 'aconst_null', 'aload', 'aload_0', 'aload_1', 'aload_2',
|
| 1373 |
+
'aload_3', 'aload_w', 'areturn', 'arraylength', 'astore', 'astore_0', 'astore_1',
|
| 1374 |
+
'astore_2', 'astore_3', 'astore_w', 'athrow', 'baload', 'bastore', 'bipush',
|
| 1375 |
+
'breakpoint', 'caload', 'castore', 'd2f', 'd2i', 'd2l', 'dadd', 'daload', 'dastore',
|
| 1376 |
+
'dcmpg', 'dcmpl', 'dconst_0', 'dconst_1', 'ddiv', 'dload', 'dload_0', 'dload_1',
|
| 1377 |
+
'dload_2', 'dload_3', 'dload_w', 'dmul', 'dneg', 'drem', 'dreturn', 'dstore', 'dstore_0',
|
| 1378 |
+
'dstore_1', 'dstore_2', 'dstore_3', 'dstore_w', 'dsub', 'dup', 'dup2', 'dup2_x1',
|
| 1379 |
+
'dup2_x2', 'dup_x1', 'dup_x2', 'f2d', 'f2i', 'f2l', 'fadd', 'faload', 'fastore', 'fcmpg',
|
| 1380 |
+
'fcmpl', 'fconst_0', 'fconst_1', 'fconst_2', 'fdiv', 'fload', 'fload_0', 'fload_1',
|
| 1381 |
+
'fload_2', 'fload_3', 'fload_w', 'fmul', 'fneg', 'frem', 'freturn', 'fstore', 'fstore_0',
|
| 1382 |
+
'fstore_1', 'fstore_2', 'fstore_3', 'fstore_w', 'fsub', 'i2b', 'i2c', 'i2d', 'i2f', 'i2l',
|
| 1383 |
+
'i2s', 'iadd', 'iaload', 'iand', 'iastore', 'iconst_0', 'iconst_1', 'iconst_2',
|
| 1384 |
+
'iconst_3', 'iconst_4', 'iconst_5', 'iconst_m1', 'idiv', 'iinc', 'iinc_w', 'iload',
|
| 1385 |
+
'iload_0', 'iload_1', 'iload_2', 'iload_3', 'iload_w', 'imul', 'ineg', 'int2byte',
|
| 1386 |
+
'int2char', 'int2short', 'ior', 'irem', 'ireturn', 'ishl', 'ishr', 'istore', 'istore_0',
|
| 1387 |
+
'istore_1', 'istore_2', 'istore_3', 'istore_w', 'isub', 'iushr', 'ixor', 'l2d', 'l2f',
|
| 1388 |
+
'l2i', 'ladd', 'laload', 'land', 'lastore', 'lcmp', 'lconst_0', 'lconst_1', 'ldc2_w',
|
| 1389 |
+
'ldiv', 'lload', 'lload_0', 'lload_1', 'lload_2', 'lload_3', 'lload_w', 'lmul', 'lneg',
|
| 1390 |
+
'lookupswitch', 'lor', 'lrem', 'lreturn', 'lshl', 'lshr', 'lstore', 'lstore_0',
|
| 1391 |
+
'lstore_1', 'lstore_2', 'lstore_3', 'lstore_w', 'lsub', 'lushr', 'lxor',
|
| 1392 |
+
'monitorenter', 'monitorexit', 'nop', 'pop', 'pop2', 'ret', 'ret_w', 'return', 'saload',
|
| 1393 |
+
'sastore', 'sipush', 'swap'), suffix=_break), Keyword.Reserved),
|
| 1394 |
+
(r'(anewarray|checkcast|instanceof|ldc|ldc_w|new)%s' % _break,
|
| 1395 |
+
Keyword.Reserved, 'class/no-dots'),
|
| 1396 |
+
(r'invoke(dynamic|interface|nonvirtual|special|'
|
| 1397 |
+
r'static|virtual)%s' % _break, Keyword.Reserved,
|
| 1398 |
+
'invocation'),
|
| 1399 |
+
(r'(getfield|putfield)%s' % _break, Keyword.Reserved,
|
| 1400 |
+
('descriptor/no-dots', 'field')),
|
| 1401 |
+
(r'(getstatic|putstatic)%s' % _break, Keyword.Reserved,
|
| 1402 |
+
('descriptor/no-dots', 'static')),
|
| 1403 |
+
(words((
|
| 1404 |
+
'goto', 'goto_w', 'if_acmpeq', 'if_acmpne', 'if_icmpeq',
|
| 1405 |
+
'if_icmpge', 'if_icmpgt', 'if_icmple', 'if_icmplt', 'if_icmpne',
|
| 1406 |
+
'ifeq', 'ifge', 'ifgt', 'ifle', 'iflt', 'ifne', 'ifnonnull',
|
| 1407 |
+
'ifnull', 'jsr', 'jsr_w'), suffix=_break),
|
| 1408 |
+
Keyword.Reserved, 'label'),
|
| 1409 |
+
(r'(multianewarray|newarray)%s' % _break, Keyword.Reserved,
|
| 1410 |
+
'descriptor/convert-dots'),
|
| 1411 |
+
(r'tableswitch%s' % _break, Keyword.Reserved, 'table')
|
| 1412 |
+
],
|
| 1413 |
+
'quote': [
|
| 1414 |
+
(r"'", String.Single, '#pop'),
|
| 1415 |
+
(r'\\u[\da-fA-F]{4}', String.Escape),
|
| 1416 |
+
(r"[^'\\]+", String.Single)
|
| 1417 |
+
],
|
| 1418 |
+
'string': [
|
| 1419 |
+
(r'"', String.Double, '#pop'),
|
| 1420 |
+
(r'\\([nrtfb"\'\\]|u[\da-fA-F]{4}|[0-3]?[0-7]{1,2})',
|
| 1421 |
+
String.Escape),
|
| 1422 |
+
(r'[^"\\]+', String.Double)
|
| 1423 |
+
],
|
| 1424 |
+
'root': [
|
| 1425 |
+
(r'\n+', Text),
|
| 1426 |
+
(r"'", String.Single, 'quote'),
|
| 1427 |
+
include('default'),
|
| 1428 |
+
(r'(%s)([ \t\r]*)(:)' % _name,
|
| 1429 |
+
bygroups(Name.Label, Text, Punctuation)),
|
| 1430 |
+
(_name, String.Other)
|
| 1431 |
+
],
|
| 1432 |
+
'annotation': [
|
| 1433 |
+
(r'\n', Text, ('#pop', 'annotation-body')),
|
| 1434 |
+
(r'default%s' % _break, Keyword.Reserved,
|
| 1435 |
+
('#pop', 'annotation-default')),
|
| 1436 |
+
include('default')
|
| 1437 |
+
],
|
| 1438 |
+
'annotation-body': [
|
| 1439 |
+
(r'\n+', Text),
|
| 1440 |
+
(r'\.end%s' % _break, Keyword.Reserved, '#pop'),
|
| 1441 |
+
include('default'),
|
| 1442 |
+
(_name, String.Other, ('annotation-items', 'descriptor/no-dots'))
|
| 1443 |
+
],
|
| 1444 |
+
'annotation-default': [
|
| 1445 |
+
(r'\n+', Text),
|
| 1446 |
+
(r'\.end%s' % _break, Keyword.Reserved, '#pop'),
|
| 1447 |
+
include('default'),
|
| 1448 |
+
default(('annotation-items', 'descriptor/no-dots'))
|
| 1449 |
+
],
|
| 1450 |
+
'annotation-items': [
|
| 1451 |
+
(r"'", String.Single, 'quote'),
|
| 1452 |
+
include('default'),
|
| 1453 |
+
(_name, String.Other)
|
| 1454 |
+
],
|
| 1455 |
+
'caught-exception': [
|
| 1456 |
+
(r'all%s' % _break, Keyword, '#pop'),
|
| 1457 |
+
include('exception')
|
| 1458 |
+
],
|
| 1459 |
+
'class/convert-dots': [
|
| 1460 |
+
include('default'),
|
| 1461 |
+
(r'(L)((?:%s[/.])*)(%s)(;)' % (_unqualified_name, _name),
|
| 1462 |
+
bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
|
| 1463 |
+
'#pop'),
|
| 1464 |
+
(r'((?:%s[/.])*)(%s)' % (_unqualified_name, _name),
|
| 1465 |
+
bygroups(Name.Namespace, Name.Class), '#pop')
|
| 1466 |
+
],
|
| 1467 |
+
'class/no-dots': [
|
| 1468 |
+
include('default'),
|
| 1469 |
+
(r'\[+', Punctuation, ('#pop', 'descriptor/no-dots')),
|
| 1470 |
+
(r'(L)((?:%s/)*)(%s)(;)' % (_unqualified_name, _name),
|
| 1471 |
+
bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
|
| 1472 |
+
'#pop'),
|
| 1473 |
+
(r'((?:%s/)*)(%s)' % (_unqualified_name, _name),
|
| 1474 |
+
bygroups(Name.Namespace, Name.Class), '#pop')
|
| 1475 |
+
],
|
| 1476 |
+
'descriptor/convert-dots': [
|
| 1477 |
+
include('default'),
|
| 1478 |
+
(r'\[+', Punctuation),
|
| 1479 |
+
(r'(L)((?:%s[/.])*)(%s?)(;)' % (_unqualified_name, _name),
|
| 1480 |
+
bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
|
| 1481 |
+
'#pop'),
|
| 1482 |
+
(r'[^%s\[)L]+' % _separator, Keyword.Type, '#pop'),
|
| 1483 |
+
default('#pop')
|
| 1484 |
+
],
|
| 1485 |
+
'descriptor/no-dots': [
|
| 1486 |
+
include('default'),
|
| 1487 |
+
(r'\[+', Punctuation),
|
| 1488 |
+
(r'(L)((?:%s/)*)(%s)(;)' % (_unqualified_name, _name),
|
| 1489 |
+
bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
|
| 1490 |
+
'#pop'),
|
| 1491 |
+
(r'[^%s\[)L]+' % _separator, Keyword.Type, '#pop'),
|
| 1492 |
+
default('#pop')
|
| 1493 |
+
],
|
| 1494 |
+
'descriptors/convert-dots': [
|
| 1495 |
+
(r'\)', Punctuation, '#pop'),
|
| 1496 |
+
default('descriptor/convert-dots')
|
| 1497 |
+
],
|
| 1498 |
+
'enclosing-method': [
|
| 1499 |
+
(_ws, Text),
|
| 1500 |
+
(r'(?=[^%s]*\()' % _separator, Text, ('#pop', 'invocation')),
|
| 1501 |
+
default(('#pop', 'class/convert-dots'))
|
| 1502 |
+
],
|
| 1503 |
+
'exception': [
|
| 1504 |
+
include('default'),
|
| 1505 |
+
(r'((?:%s[/.])*)(%s)' % (_unqualified_name, _name),
|
| 1506 |
+
bygroups(Name.Namespace, Name.Exception), '#pop')
|
| 1507 |
+
],
|
| 1508 |
+
'field': [
|
| 1509 |
+
(r'static%s' % _break, Keyword.Reserved, ('#pop', 'static')),
|
| 1510 |
+
include('default'),
|
| 1511 |
+
(r'((?:%s[/.](?=[^%s]*[/.]))*)(%s[/.])?(%s)' %
|
| 1512 |
+
(_unqualified_name, _separator, _unqualified_name, _name),
|
| 1513 |
+
bygroups(Name.Namespace, Name.Class, Name.Variable.Instance),
|
| 1514 |
+
'#pop')
|
| 1515 |
+
],
|
| 1516 |
+
'invocation': [
|
| 1517 |
+
include('default'),
|
| 1518 |
+
(r'((?:%s[/.](?=[^%s(]*[/.]))*)(%s[/.])?(%s)(\()' %
|
| 1519 |
+
(_unqualified_name, _separator, _unqualified_name, _name),
|
| 1520 |
+
bygroups(Name.Namespace, Name.Class, Name.Function, Punctuation),
|
| 1521 |
+
('#pop', 'descriptor/convert-dots', 'descriptors/convert-dots',
|
| 1522 |
+
'descriptor/convert-dots'))
|
| 1523 |
+
],
|
| 1524 |
+
'label': [
|
| 1525 |
+
include('default'),
|
| 1526 |
+
(_name, Name.Label, '#pop')
|
| 1527 |
+
],
|
| 1528 |
+
'method': [
|
| 1529 |
+
include('default'),
|
| 1530 |
+
(r'(%s)(\()' % _name, bygroups(Name.Function, Punctuation),
|
| 1531 |
+
('#pop', 'descriptor/convert-dots', 'descriptors/convert-dots',
|
| 1532 |
+
'descriptor/convert-dots'))
|
| 1533 |
+
],
|
| 1534 |
+
'no-verification': [
|
| 1535 |
+
(r'(locals|method|stack)%s' % _break, Keyword.Reserved, '#pop'),
|
| 1536 |
+
include('default')
|
| 1537 |
+
],
|
| 1538 |
+
'static': [
|
| 1539 |
+
include('default'),
|
| 1540 |
+
(r'((?:%s[/.](?=[^%s]*[/.]))*)(%s[/.])?(%s)' %
|
| 1541 |
+
(_unqualified_name, _separator, _unqualified_name, _name),
|
| 1542 |
+
bygroups(Name.Namespace, Name.Class, Name.Variable.Class), '#pop')
|
| 1543 |
+
],
|
| 1544 |
+
'table': [
|
| 1545 |
+
(r'\n+', Text),
|
| 1546 |
+
(r'default%s' % _break, Keyword.Reserved, '#pop'),
|
| 1547 |
+
include('default'),
|
| 1548 |
+
(_name, Name.Label)
|
| 1549 |
+
],
|
| 1550 |
+
'var': [
|
| 1551 |
+
include('default'),
|
| 1552 |
+
(_name, Name.Variable, '#pop')
|
| 1553 |
+
],
|
| 1554 |
+
'verification': [
|
| 1555 |
+
include('default'),
|
| 1556 |
+
(r'(Double|Float|Integer|Long|Null|Top|UninitializedThis)%s' %
|
| 1557 |
+
_break, Keyword, '#pop'),
|
| 1558 |
+
(r'Object%s' % _break, Keyword, ('#pop', 'class/no-dots')),
|
| 1559 |
+
(r'Uninitialized%s' % _break, Keyword, ('#pop', 'label'))
|
| 1560 |
+
]
|
| 1561 |
+
}
|
| 1562 |
+
|
| 1563 |
+
def analyse_text(text):
|
| 1564 |
+
score = 0
|
| 1565 |
+
if re.search(r'^\s*\.class\s', text, re.MULTILINE):
|
| 1566 |
+
score += 0.5
|
| 1567 |
+
if re.search(r'^\s*[a-z]+_[a-z]+\b', text, re.MULTILINE):
|
| 1568 |
+
score += 0.3
|
| 1569 |
+
if re.search(r'^\s*\.(attribute|bytecode|debug|deprecated|enclosing|'
|
| 1570 |
+
r'inner|interface|limit|set|signature|stack)\b', text,
|
| 1571 |
+
re.MULTILINE):
|
| 1572 |
+
score += 0.6
|
| 1573 |
+
return score
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/lisp.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/make.py
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.make
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for Makefiles and similar.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import Lexer, RegexLexer, include, bygroups, \
|
| 15 |
+
do_insertions, using
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Punctuation
|
| 18 |
+
from pygments.lexers.shell import BashLexer
|
| 19 |
+
|
| 20 |
+
__all__ = ['MakefileLexer', 'BaseMakefileLexer', 'CMakeLexer']
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class MakefileLexer(Lexer):
|
| 24 |
+
"""
|
| 25 |
+
Lexer for BSD and GNU make extensions (lenient enough to handle both in
|
| 26 |
+
the same file even).
|
| 27 |
+
|
| 28 |
+
*Rewritten in Pygments 0.10.*
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
name = 'Makefile'
|
| 32 |
+
aliases = ['make', 'makefile', 'mf', 'bsdmake']
|
| 33 |
+
filenames = ['*.mak', '*.mk', 'Makefile', 'makefile', 'Makefile.*', 'GNUmakefile']
|
| 34 |
+
mimetypes = ['text/x-makefile']
|
| 35 |
+
|
| 36 |
+
r_special = re.compile(
|
| 37 |
+
r'^(?:'
|
| 38 |
+
# BSD Make
|
| 39 |
+
r'\.\s*(include|undef|error|warning|if|else|elif|endif|for|endfor)|'
|
| 40 |
+
# GNU Make
|
| 41 |
+
r'\s*(ifeq|ifneq|ifdef|ifndef|else|endif|-?include|define|endef|:|vpath)|'
|
| 42 |
+
# GNU Automake
|
| 43 |
+
r'\s*(if|else|endif))(?=\s)')
|
| 44 |
+
r_comment = re.compile(r'^\s*@?#')
|
| 45 |
+
|
| 46 |
+
def get_tokens_unprocessed(self, text):
|
| 47 |
+
ins = []
|
| 48 |
+
lines = text.splitlines(True)
|
| 49 |
+
done = ''
|
| 50 |
+
lex = BaseMakefileLexer(**self.options)
|
| 51 |
+
backslashflag = False
|
| 52 |
+
for line in lines:
|
| 53 |
+
if self.r_special.match(line) or backslashflag:
|
| 54 |
+
ins.append((len(done), [(0, Comment.Preproc, line)]))
|
| 55 |
+
backslashflag = line.strip().endswith('\\')
|
| 56 |
+
elif self.r_comment.match(line):
|
| 57 |
+
ins.append((len(done), [(0, Comment, line)]))
|
| 58 |
+
else:
|
| 59 |
+
done += line
|
| 60 |
+
for item in do_insertions(ins, lex.get_tokens_unprocessed(done)):
|
| 61 |
+
yield item
|
| 62 |
+
|
| 63 |
+
def analyse_text(text):
|
| 64 |
+
# Many makefiles have $(BIG_CAPS) style variables
|
| 65 |
+
if re.search(r'\$\([A-Z_]+\)', text):
|
| 66 |
+
return 0.1
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class BaseMakefileLexer(RegexLexer):
|
| 70 |
+
"""
|
| 71 |
+
Lexer for simple Makefiles (no preprocessing).
|
| 72 |
+
|
| 73 |
+
.. versionadded:: 0.10
|
| 74 |
+
"""
|
| 75 |
+
|
| 76 |
+
name = 'Base Makefile'
|
| 77 |
+
aliases = ['basemake']
|
| 78 |
+
filenames = []
|
| 79 |
+
mimetypes = []
|
| 80 |
+
|
| 81 |
+
tokens = {
|
| 82 |
+
'root': [
|
| 83 |
+
# recipes (need to allow spaces because of expandtabs)
|
| 84 |
+
(r'^(?:[\t ]+.*\n|\n)+', using(BashLexer)),
|
| 85 |
+
# special variables
|
| 86 |
+
(r'\$[<@$+%?|*]', Keyword),
|
| 87 |
+
(r'\s+', Text),
|
| 88 |
+
(r'#.*?\n', Comment),
|
| 89 |
+
(r'(export)(\s+)(?=[\w${}\t -]+\n)',
|
| 90 |
+
bygroups(Keyword, Text), 'export'),
|
| 91 |
+
(r'export\s+', Keyword),
|
| 92 |
+
# assignment
|
| 93 |
+
(r'([\w${}().-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)',
|
| 94 |
+
bygroups(Name.Variable, Text, Operator, Text, using(BashLexer))),
|
| 95 |
+
# strings
|
| 96 |
+
(r'(?s)"(\\\\|\\.|[^"\\])*"', String.Double),
|
| 97 |
+
(r"(?s)'(\\\\|\\.|[^'\\])*'", String.Single),
|
| 98 |
+
# targets
|
| 99 |
+
(r'([^\n:]+)(:+)([ \t]*)', bygroups(Name.Function, Operator, Text),
|
| 100 |
+
'block-header'),
|
| 101 |
+
# expansions
|
| 102 |
+
(r'\$\(', Keyword, 'expansion'),
|
| 103 |
+
],
|
| 104 |
+
'expansion': [
|
| 105 |
+
(r'[^$a-zA-Z_()]+', Text),
|
| 106 |
+
(r'[a-zA-Z_]+', Name.Variable),
|
| 107 |
+
(r'\$', Keyword),
|
| 108 |
+
(r'\(', Keyword, '#push'),
|
| 109 |
+
(r'\)', Keyword, '#pop'),
|
| 110 |
+
],
|
| 111 |
+
'export': [
|
| 112 |
+
(r'[\w${}-]+', Name.Variable),
|
| 113 |
+
(r'\n', Text, '#pop'),
|
| 114 |
+
(r'\s+', Text),
|
| 115 |
+
],
|
| 116 |
+
'block-header': [
|
| 117 |
+
(r'[,|]', Punctuation),
|
| 118 |
+
(r'#.*?\n', Comment, '#pop'),
|
| 119 |
+
(r'\\\n', Text), # line continuation
|
| 120 |
+
(r'\$\(', Keyword, 'expansion'),
|
| 121 |
+
(r'[a-zA-Z_]+', Name),
|
| 122 |
+
(r'\n', Text, '#pop'),
|
| 123 |
+
(r'.', Text),
|
| 124 |
+
],
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
class CMakeLexer(RegexLexer):
|
| 129 |
+
"""
|
| 130 |
+
Lexer for `CMake <http://cmake.org/Wiki/CMake>`_ files.
|
| 131 |
+
|
| 132 |
+
.. versionadded:: 1.2
|
| 133 |
+
"""
|
| 134 |
+
name = 'CMake'
|
| 135 |
+
aliases = ['cmake']
|
| 136 |
+
filenames = ['*.cmake', 'CMakeLists.txt']
|
| 137 |
+
mimetypes = ['text/x-cmake']
|
| 138 |
+
|
| 139 |
+
tokens = {
|
| 140 |
+
'root': [
|
| 141 |
+
# (r'(ADD_CUSTOM_COMMAND|ADD_CUSTOM_TARGET|ADD_DEFINITIONS|'
|
| 142 |
+
# r'ADD_DEPENDENCIES|ADD_EXECUTABLE|ADD_LIBRARY|ADD_SUBDIRECTORY|'
|
| 143 |
+
# r'ADD_TEST|AUX_SOURCE_DIRECTORY|BUILD_COMMAND|BUILD_NAME|'
|
| 144 |
+
# r'CMAKE_MINIMUM_REQUIRED|CONFIGURE_FILE|CREATE_TEST_SOURCELIST|'
|
| 145 |
+
# r'ELSE|ELSEIF|ENABLE_LANGUAGE|ENABLE_TESTING|ENDFOREACH|'
|
| 146 |
+
# r'ENDFUNCTION|ENDIF|ENDMACRO|ENDWHILE|EXEC_PROGRAM|'
|
| 147 |
+
# r'EXECUTE_PROCESS|EXPORT_LIBRARY_DEPENDENCIES|FILE|FIND_FILE|'
|
| 148 |
+
# r'FIND_LIBRARY|FIND_PACKAGE|FIND_PATH|FIND_PROGRAM|FLTK_WRAP_UI|'
|
| 149 |
+
# r'FOREACH|FUNCTION|GET_CMAKE_PROPERTY|GET_DIRECTORY_PROPERTY|'
|
| 150 |
+
# r'GET_FILENAME_COMPONENT|GET_SOURCE_FILE_PROPERTY|'
|
| 151 |
+
# r'GET_TARGET_PROPERTY|GET_TEST_PROPERTY|IF|INCLUDE|'
|
| 152 |
+
# r'INCLUDE_DIRECTORIES|INCLUDE_EXTERNAL_MSPROJECT|'
|
| 153 |
+
# r'INCLUDE_REGULAR_EXPRESSION|INSTALL|INSTALL_FILES|'
|
| 154 |
+
# r'INSTALL_PROGRAMS|INSTALL_TARGETS|LINK_DIRECTORIES|'
|
| 155 |
+
# r'LINK_LIBRARIES|LIST|LOAD_CACHE|LOAD_COMMAND|MACRO|'
|
| 156 |
+
# r'MAKE_DIRECTORY|MARK_AS_ADVANCED|MATH|MESSAGE|OPTION|'
|
| 157 |
+
# r'OUTPUT_REQUIRED_FILES|PROJECT|QT_WRAP_CPP|QT_WRAP_UI|REMOVE|'
|
| 158 |
+
# r'REMOVE_DEFINITIONS|SEPARATE_ARGUMENTS|SET|'
|
| 159 |
+
# r'SET_DIRECTORY_PROPERTIES|SET_SOURCE_FILES_PROPERTIES|'
|
| 160 |
+
# r'SET_TARGET_PROPERTIES|SET_TESTS_PROPERTIES|SITE_NAME|'
|
| 161 |
+
# r'SOURCE_GROUP|STRING|SUBDIR_DEPENDS|SUBDIRS|'
|
| 162 |
+
# r'TARGET_LINK_LIBRARIES|TRY_COMPILE|TRY_RUN|UNSET|'
|
| 163 |
+
# r'USE_MANGLED_MESA|UTILITY_SOURCE|VARIABLE_REQUIRES|'
|
| 164 |
+
# r'VTK_MAKE_INSTANTIATOR|VTK_WRAP_JAVA|VTK_WRAP_PYTHON|'
|
| 165 |
+
# r'VTK_WRAP_TCL|WHILE|WRITE_FILE|'
|
| 166 |
+
# r'COUNTARGS)\b', Name.Builtin, 'args'),
|
| 167 |
+
(r'\b(\w+)([ \t]*)(\()', bygroups(Name.Builtin, Text,
|
| 168 |
+
Punctuation), 'args'),
|
| 169 |
+
include('keywords'),
|
| 170 |
+
include('ws')
|
| 171 |
+
],
|
| 172 |
+
'args': [
|
| 173 |
+
(r'\(', Punctuation, '#push'),
|
| 174 |
+
(r'\)', Punctuation, '#pop'),
|
| 175 |
+
(r'(\$\{)(.+?)(\})', bygroups(Operator, Name.Variable, Operator)),
|
| 176 |
+
(r'(\$ENV\{)(.+?)(\})', bygroups(Operator, Name.Variable, Operator)),
|
| 177 |
+
(r'(\$<)(.+?)(>)', bygroups(Operator, Name.Variable, Operator)),
|
| 178 |
+
(r'(?s)".*?"', String.Double),
|
| 179 |
+
(r'\\\S+', String),
|
| 180 |
+
(r'[^)$"# \t\n]+', String),
|
| 181 |
+
(r'\n', Text), # explicitly legal
|
| 182 |
+
include('keywords'),
|
| 183 |
+
include('ws')
|
| 184 |
+
],
|
| 185 |
+
'string': [
|
| 186 |
+
|
| 187 |
+
],
|
| 188 |
+
'keywords': [
|
| 189 |
+
(r'\b(WIN32|UNIX|APPLE|CYGWIN|BORLAND|MINGW|MSVC|MSVC_IDE|MSVC60|'
|
| 190 |
+
r'MSVC70|MSVC71|MSVC80|MSVC90)\b', Keyword),
|
| 191 |
+
],
|
| 192 |
+
'ws': [
|
| 193 |
+
(r'[ \t]+', Text),
|
| 194 |
+
(r'#.*\n', Comment),
|
| 195 |
+
]
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
def analyse_text(text):
|
| 199 |
+
exp = r'^ *CMAKE_MINIMUM_REQUIRED *\( *VERSION *\d(\.\d)* *( FATAL_ERROR)? *\) *$'
|
| 200 |
+
if re.search(exp, text, flags=re.MULTILINE | re.IGNORECASE):
|
| 201 |
+
return 0.8
|
| 202 |
+
return 0.0
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/markup.py
ADDED
|
@@ -0,0 +1,595 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.markup
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for non-HTML markup languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexers.html import HtmlLexer, XmlLexer
|
| 15 |
+
from pygments.lexers.javascript import JavascriptLexer
|
| 16 |
+
from pygments.lexers.css import CssLexer
|
| 17 |
+
|
| 18 |
+
from pygments.lexer import RegexLexer, DelegatingLexer, include, bygroups, \
|
| 19 |
+
using, this, do_insertions, default, words
|
| 20 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 21 |
+
Number, Punctuation, Generic, Other
|
| 22 |
+
from pygments.util import get_bool_opt, ClassNotFound
|
| 23 |
+
|
| 24 |
+
__all__ = ['BBCodeLexer', 'MoinWikiLexer', 'RstLexer', 'TexLexer', 'GroffLexer',
|
| 25 |
+
'MozPreprocHashLexer', 'MozPreprocPercentLexer',
|
| 26 |
+
'MozPreprocXulLexer', 'MozPreprocJavascriptLexer',
|
| 27 |
+
'MozPreprocCssLexer', 'MarkdownLexer']
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class BBCodeLexer(RegexLexer):
|
| 31 |
+
"""
|
| 32 |
+
A lexer that highlights BBCode(-like) syntax.
|
| 33 |
+
|
| 34 |
+
.. versionadded:: 0.6
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
name = 'BBCode'
|
| 38 |
+
aliases = ['bbcode']
|
| 39 |
+
mimetypes = ['text/x-bbcode']
|
| 40 |
+
|
| 41 |
+
tokens = {
|
| 42 |
+
'root': [
|
| 43 |
+
(r'[^[]+', Text),
|
| 44 |
+
# tag/end tag begin
|
| 45 |
+
(r'\[/?\w+', Keyword, 'tag'),
|
| 46 |
+
# stray bracket
|
| 47 |
+
(r'\[', Text),
|
| 48 |
+
],
|
| 49 |
+
'tag': [
|
| 50 |
+
(r'\s+', Text),
|
| 51 |
+
# attribute with value
|
| 52 |
+
(r'(\w+)(=)("?[^\s"\]]+"?)',
|
| 53 |
+
bygroups(Name.Attribute, Operator, String)),
|
| 54 |
+
# tag argument (a la [color=green])
|
| 55 |
+
(r'(=)("?[^\s"\]]+"?)',
|
| 56 |
+
bygroups(Operator, String)),
|
| 57 |
+
# tag end
|
| 58 |
+
(r'\]', Keyword, '#pop'),
|
| 59 |
+
],
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class MoinWikiLexer(RegexLexer):
|
| 64 |
+
"""
|
| 65 |
+
For MoinMoin (and Trac) Wiki markup.
|
| 66 |
+
|
| 67 |
+
.. versionadded:: 0.7
|
| 68 |
+
"""
|
| 69 |
+
|
| 70 |
+
name = 'MoinMoin/Trac Wiki markup'
|
| 71 |
+
aliases = ['trac-wiki', 'moin']
|
| 72 |
+
filenames = []
|
| 73 |
+
mimetypes = ['text/x-trac-wiki']
|
| 74 |
+
flags = re.MULTILINE | re.IGNORECASE
|
| 75 |
+
|
| 76 |
+
tokens = {
|
| 77 |
+
'root': [
|
| 78 |
+
(r'^#.*$', Comment),
|
| 79 |
+
(r'(!)(\S+)', bygroups(Keyword, Text)), # Ignore-next
|
| 80 |
+
# Titles
|
| 81 |
+
(r'^(=+)([^=]+)(=+)(\s*#.+)?$',
|
| 82 |
+
bygroups(Generic.Heading, using(this), Generic.Heading, String)),
|
| 83 |
+
# Literal code blocks, with optional shebang
|
| 84 |
+
(r'(\{\{\{)(\n#!.+)?', bygroups(Name.Builtin, Name.Namespace), 'codeblock'),
|
| 85 |
+
(r'(\'\'\'?|\|\||`|__|~~|\^|,,|::)', Comment), # Formatting
|
| 86 |
+
# Lists
|
| 87 |
+
(r'^( +)([.*-])( )', bygroups(Text, Name.Builtin, Text)),
|
| 88 |
+
(r'^( +)([a-z]{1,5}\.)( )', bygroups(Text, Name.Builtin, Text)),
|
| 89 |
+
# Other Formatting
|
| 90 |
+
(r'\[\[\w+.*?\]\]', Keyword), # Macro
|
| 91 |
+
(r'(\[[^\s\]]+)(\s+[^\]]+?)?(\])',
|
| 92 |
+
bygroups(Keyword, String, Keyword)), # Link
|
| 93 |
+
(r'^----+$', Keyword), # Horizontal rules
|
| 94 |
+
(r'[^\n\'\[{!_~^,|]+', Text),
|
| 95 |
+
(r'\n', Text),
|
| 96 |
+
(r'.', Text),
|
| 97 |
+
],
|
| 98 |
+
'codeblock': [
|
| 99 |
+
(r'\}\}\}', Name.Builtin, '#pop'),
|
| 100 |
+
# these blocks are allowed to be nested in Trac, but not MoinMoin
|
| 101 |
+
(r'\{\{\{', Text, '#push'),
|
| 102 |
+
(r'[^{}]+', Comment.Preproc), # slurp boring text
|
| 103 |
+
(r'.', Comment.Preproc), # allow loose { or }
|
| 104 |
+
],
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
class RstLexer(RegexLexer):
|
| 109 |
+
"""
|
| 110 |
+
For `reStructuredText <http://docutils.sf.net/rst.html>`_ markup.
|
| 111 |
+
|
| 112 |
+
.. versionadded:: 0.7
|
| 113 |
+
|
| 114 |
+
Additional options accepted:
|
| 115 |
+
|
| 116 |
+
`handlecodeblocks`
|
| 117 |
+
Highlight the contents of ``.. sourcecode:: language``,
|
| 118 |
+
``.. code:: language`` and ``.. code-block:: language``
|
| 119 |
+
directives with a lexer for the given language (default:
|
| 120 |
+
``True``).
|
| 121 |
+
|
| 122 |
+
.. versionadded:: 0.8
|
| 123 |
+
"""
|
| 124 |
+
name = 'reStructuredText'
|
| 125 |
+
aliases = ['rst', 'rest', 'restructuredtext']
|
| 126 |
+
filenames = ['*.rst', '*.rest']
|
| 127 |
+
mimetypes = ["text/x-rst", "text/prs.fallenstein.rst"]
|
| 128 |
+
flags = re.MULTILINE
|
| 129 |
+
|
| 130 |
+
def _handle_sourcecode(self, match):
|
| 131 |
+
from pygments.lexers import get_lexer_by_name
|
| 132 |
+
|
| 133 |
+
# section header
|
| 134 |
+
yield match.start(1), Punctuation, match.group(1)
|
| 135 |
+
yield match.start(2), Text, match.group(2)
|
| 136 |
+
yield match.start(3), Operator.Word, match.group(3)
|
| 137 |
+
yield match.start(4), Punctuation, match.group(4)
|
| 138 |
+
yield match.start(5), Text, match.group(5)
|
| 139 |
+
yield match.start(6), Keyword, match.group(6)
|
| 140 |
+
yield match.start(7), Text, match.group(7)
|
| 141 |
+
|
| 142 |
+
# lookup lexer if wanted and existing
|
| 143 |
+
lexer = None
|
| 144 |
+
if self.handlecodeblocks:
|
| 145 |
+
try:
|
| 146 |
+
lexer = get_lexer_by_name(match.group(6).strip())
|
| 147 |
+
except ClassNotFound:
|
| 148 |
+
pass
|
| 149 |
+
indention = match.group(8)
|
| 150 |
+
indention_size = len(indention)
|
| 151 |
+
code = (indention + match.group(9) + match.group(10) + match.group(11))
|
| 152 |
+
|
| 153 |
+
# no lexer for this language. handle it like it was a code block
|
| 154 |
+
if lexer is None:
|
| 155 |
+
yield match.start(8), String, code
|
| 156 |
+
return
|
| 157 |
+
|
| 158 |
+
# highlight the lines with the lexer.
|
| 159 |
+
ins = []
|
| 160 |
+
codelines = code.splitlines(True)
|
| 161 |
+
code = ''
|
| 162 |
+
for line in codelines:
|
| 163 |
+
if len(line) > indention_size:
|
| 164 |
+
ins.append((len(code), [(0, Text, line[:indention_size])]))
|
| 165 |
+
code += line[indention_size:]
|
| 166 |
+
else:
|
| 167 |
+
code += line
|
| 168 |
+
for item in do_insertions(ins, lexer.get_tokens_unprocessed(code)):
|
| 169 |
+
yield item
|
| 170 |
+
|
| 171 |
+
# from docutils.parsers.rst.states
|
| 172 |
+
closers = u'\'")]}>\u2019\u201d\xbb!?'
|
| 173 |
+
unicode_delimiters = u'\u2010\u2011\u2012\u2013\u2014\u00a0'
|
| 174 |
+
end_string_suffix = (r'((?=$)|(?=[-/:.,; \n\x00%s%s]))'
|
| 175 |
+
% (re.escape(unicode_delimiters),
|
| 176 |
+
re.escape(closers)))
|
| 177 |
+
|
| 178 |
+
tokens = {
|
| 179 |
+
'root': [
|
| 180 |
+
# Heading with overline
|
| 181 |
+
(r'^(=+|-+|`+|:+|\.+|\'+|"+|~+|\^+|_+|\*+|\++|#+)([ \t]*\n)'
|
| 182 |
+
r'(.+)(\n)(\1)(\n)',
|
| 183 |
+
bygroups(Generic.Heading, Text, Generic.Heading,
|
| 184 |
+
Text, Generic.Heading, Text)),
|
| 185 |
+
# Plain heading
|
| 186 |
+
(r'^(\S.*)(\n)(={3,}|-{3,}|`{3,}|:{3,}|\.{3,}|\'{3,}|"{3,}|'
|
| 187 |
+
r'~{3,}|\^{3,}|_{3,}|\*{3,}|\+{3,}|#{3,})(\n)',
|
| 188 |
+
bygroups(Generic.Heading, Text, Generic.Heading, Text)),
|
| 189 |
+
# Bulleted lists
|
| 190 |
+
(r'^(\s*)([-*+])( .+\n(?:\1 .+\n)*)',
|
| 191 |
+
bygroups(Text, Number, using(this, state='inline'))),
|
| 192 |
+
# Numbered lists
|
| 193 |
+
(r'^(\s*)([0-9#ivxlcmIVXLCM]+\.)( .+\n(?:\1 .+\n)*)',
|
| 194 |
+
bygroups(Text, Number, using(this, state='inline'))),
|
| 195 |
+
(r'^(\s*)(\(?[0-9#ivxlcmIVXLCM]+\))( .+\n(?:\1 .+\n)*)',
|
| 196 |
+
bygroups(Text, Number, using(this, state='inline'))),
|
| 197 |
+
# Numbered, but keep words at BOL from becoming lists
|
| 198 |
+
(r'^(\s*)([A-Z]+\.)( .+\n(?:\1 .+\n)+)',
|
| 199 |
+
bygroups(Text, Number, using(this, state='inline'))),
|
| 200 |
+
(r'^(\s*)(\(?[A-Za-z]+\))( .+\n(?:\1 .+\n)+)',
|
| 201 |
+
bygroups(Text, Number, using(this, state='inline'))),
|
| 202 |
+
# Line blocks
|
| 203 |
+
(r'^(\s*)(\|)( .+\n(?:\| .+\n)*)',
|
| 204 |
+
bygroups(Text, Operator, using(this, state='inline'))),
|
| 205 |
+
# Sourcecode directives
|
| 206 |
+
(r'^( *\.\.)(\s*)((?:source)?code(?:-block)?)(::)([ \t]*)([^\n]+)'
|
| 207 |
+
r'(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\8.*|)\n)+)',
|
| 208 |
+
_handle_sourcecode),
|
| 209 |
+
# A directive
|
| 210 |
+
(r'^( *\.\.)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))',
|
| 211 |
+
bygroups(Punctuation, Text, Operator.Word, Punctuation, Text,
|
| 212 |
+
using(this, state='inline'))),
|
| 213 |
+
# A reference target
|
| 214 |
+
(r'^( *\.\.)(\s*)(_(?:[^:\\]|\\.)+:)(.*?)$',
|
| 215 |
+
bygroups(Punctuation, Text, Name.Tag, using(this, state='inline'))),
|
| 216 |
+
# A footnote/citation target
|
| 217 |
+
(r'^( *\.\.)(\s*)(\[.+\])(.*?)$',
|
| 218 |
+
bygroups(Punctuation, Text, Name.Tag, using(this, state='inline'))),
|
| 219 |
+
# A substitution def
|
| 220 |
+
(r'^( *\.\.)(\s*)(\|.+\|)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))',
|
| 221 |
+
bygroups(Punctuation, Text, Name.Tag, Text, Operator.Word,
|
| 222 |
+
Punctuation, Text, using(this, state='inline'))),
|
| 223 |
+
# Comments
|
| 224 |
+
(r'^ *\.\..*(\n( +.*\n|\n)+)?', Comment.Preproc),
|
| 225 |
+
# Field list
|
| 226 |
+
(r'^( *)(:[a-zA-Z-]+:)(\s*)$', bygroups(Text, Name.Class, Text)),
|
| 227 |
+
(r'^( *)(:.*?:)([ \t]+)(.*?)$',
|
| 228 |
+
bygroups(Text, Name.Class, Text, Name.Function)),
|
| 229 |
+
# Definition list
|
| 230 |
+
(r'^(\S.*(?<!::)\n)((?:(?: +.*)\n)+)',
|
| 231 |
+
bygroups(using(this, state='inline'), using(this, state='inline'))),
|
| 232 |
+
# Code blocks
|
| 233 |
+
(r'(::)(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\3.*|)\n)+)',
|
| 234 |
+
bygroups(String.Escape, Text, String, String, Text, String)),
|
| 235 |
+
include('inline'),
|
| 236 |
+
],
|
| 237 |
+
'inline': [
|
| 238 |
+
(r'\\.', Text), # escape
|
| 239 |
+
(r'``', String, 'literal'), # code
|
| 240 |
+
(r'(`.+?)(<.+?>)(`__?)', # reference with inline target
|
| 241 |
+
bygroups(String, String.Interpol, String)),
|
| 242 |
+
(r'`.+?`__?', String), # reference
|
| 243 |
+
(r'(`.+?`)(:[a-zA-Z0-9:-]+?:)?',
|
| 244 |
+
bygroups(Name.Variable, Name.Attribute)), # role
|
| 245 |
+
(r'(:[a-zA-Z0-9:-]+?:)(`.+?`)',
|
| 246 |
+
bygroups(Name.Attribute, Name.Variable)), # role (content first)
|
| 247 |
+
(r'\*\*.+?\*\*', Generic.Strong), # Strong emphasis
|
| 248 |
+
(r'\*.+?\*', Generic.Emph), # Emphasis
|
| 249 |
+
(r'\[.*?\]_', String), # Footnote or citation
|
| 250 |
+
(r'<.+?>', Name.Tag), # Hyperlink
|
| 251 |
+
(r'[^\\\n\[*`:]+', Text),
|
| 252 |
+
(r'.', Text),
|
| 253 |
+
],
|
| 254 |
+
'literal': [
|
| 255 |
+
(r'[^`]+', String),
|
| 256 |
+
(r'``' + end_string_suffix, String, '#pop'),
|
| 257 |
+
(r'`', String),
|
| 258 |
+
]
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
def __init__(self, **options):
|
| 262 |
+
self.handlecodeblocks = get_bool_opt(options, 'handlecodeblocks', True)
|
| 263 |
+
RegexLexer.__init__(self, **options)
|
| 264 |
+
|
| 265 |
+
def analyse_text(text):
|
| 266 |
+
if text[:2] == '..' and text[2:3] != '.':
|
| 267 |
+
return 0.3
|
| 268 |
+
p1 = text.find("\n")
|
| 269 |
+
p2 = text.find("\n", p1 + 1)
|
| 270 |
+
if (p2 > -1 and # has two lines
|
| 271 |
+
p1 * 2 + 1 == p2 and # they are the same length
|
| 272 |
+
text[p1+1] in '-=' and # the next line both starts and ends with
|
| 273 |
+
text[p1+1] == text[p2-1]): # ...a sufficiently high header
|
| 274 |
+
return 0.5
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
class TexLexer(RegexLexer):
|
| 278 |
+
"""
|
| 279 |
+
Lexer for the TeX and LaTeX typesetting languages.
|
| 280 |
+
"""
|
| 281 |
+
|
| 282 |
+
name = 'TeX'
|
| 283 |
+
aliases = ['tex', 'latex']
|
| 284 |
+
filenames = ['*.tex', '*.aux', '*.toc']
|
| 285 |
+
mimetypes = ['text/x-tex', 'text/x-latex']
|
| 286 |
+
|
| 287 |
+
tokens = {
|
| 288 |
+
'general': [
|
| 289 |
+
(r'%.*?\n', Comment),
|
| 290 |
+
(r'[{}]', Name.Builtin),
|
| 291 |
+
(r'[&_^]', Name.Builtin),
|
| 292 |
+
],
|
| 293 |
+
'root': [
|
| 294 |
+
(r'\\\[', String.Backtick, 'displaymath'),
|
| 295 |
+
(r'\\\(', String, 'inlinemath'),
|
| 296 |
+
(r'\$\$', String.Backtick, 'displaymath'),
|
| 297 |
+
(r'\$', String, 'inlinemath'),
|
| 298 |
+
(r'\\([a-zA-Z]+|.)', Keyword, 'command'),
|
| 299 |
+
(r'\\$', Keyword),
|
| 300 |
+
include('general'),
|
| 301 |
+
(r'[^\\$%&_^{}]+', Text),
|
| 302 |
+
],
|
| 303 |
+
'math': [
|
| 304 |
+
(r'\\([a-zA-Z]+|.)', Name.Variable),
|
| 305 |
+
include('general'),
|
| 306 |
+
(r'[0-9]+', Number),
|
| 307 |
+
(r'[-=!+*/()\[\]]', Operator),
|
| 308 |
+
(r'[^=!+*/()\[\]\\$%&_^{}0-9-]+', Name.Builtin),
|
| 309 |
+
],
|
| 310 |
+
'inlinemath': [
|
| 311 |
+
(r'\\\)', String, '#pop'),
|
| 312 |
+
(r'\$', String, '#pop'),
|
| 313 |
+
include('math'),
|
| 314 |
+
],
|
| 315 |
+
'displaymath': [
|
| 316 |
+
(r'\\\]', String, '#pop'),
|
| 317 |
+
(r'\$\$', String, '#pop'),
|
| 318 |
+
(r'\$', Name.Builtin),
|
| 319 |
+
include('math'),
|
| 320 |
+
],
|
| 321 |
+
'command': [
|
| 322 |
+
(r'\[.*?\]', Name.Attribute),
|
| 323 |
+
(r'\*', Keyword),
|
| 324 |
+
default('#pop'),
|
| 325 |
+
],
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
def analyse_text(text):
|
| 329 |
+
for start in ("\\documentclass", "\\input", "\\documentstyle",
|
| 330 |
+
"\\relax"):
|
| 331 |
+
if text[:len(start)] == start:
|
| 332 |
+
return True
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
class GroffLexer(RegexLexer):
|
| 336 |
+
"""
|
| 337 |
+
Lexer for the (g)roff typesetting language, supporting groff
|
| 338 |
+
extensions. Mainly useful for highlighting manpage sources.
|
| 339 |
+
|
| 340 |
+
.. versionadded:: 0.6
|
| 341 |
+
"""
|
| 342 |
+
|
| 343 |
+
name = 'Groff'
|
| 344 |
+
aliases = ['groff', 'nroff', 'man']
|
| 345 |
+
filenames = ['*.[1234567]', '*.man']
|
| 346 |
+
mimetypes = ['application/x-troff', 'text/troff']
|
| 347 |
+
|
| 348 |
+
tokens = {
|
| 349 |
+
'root': [
|
| 350 |
+
(r'(\.)(\w+)', bygroups(Text, Keyword), 'request'),
|
| 351 |
+
(r'\.', Punctuation, 'request'),
|
| 352 |
+
# Regular characters, slurp till we find a backslash or newline
|
| 353 |
+
(r'[^\\\n]+', Text, 'textline'),
|
| 354 |
+
default('textline'),
|
| 355 |
+
],
|
| 356 |
+
'textline': [
|
| 357 |
+
include('escapes'),
|
| 358 |
+
(r'[^\\\n]+', Text),
|
| 359 |
+
(r'\n', Text, '#pop'),
|
| 360 |
+
],
|
| 361 |
+
'escapes': [
|
| 362 |
+
# groff has many ways to write escapes.
|
| 363 |
+
(r'\\"[^\n]*', Comment),
|
| 364 |
+
(r'\\[fn]\w', String.Escape),
|
| 365 |
+
(r'\\\(.{2}', String.Escape),
|
| 366 |
+
(r'\\.\[.*\]', String.Escape),
|
| 367 |
+
(r'\\.', String.Escape),
|
| 368 |
+
(r'\\\n', Text, 'request'),
|
| 369 |
+
],
|
| 370 |
+
'request': [
|
| 371 |
+
(r'\n', Text, '#pop'),
|
| 372 |
+
include('escapes'),
|
| 373 |
+
(r'"[^\n"]+"', String.Double),
|
| 374 |
+
(r'\d+', Number),
|
| 375 |
+
(r'\S+', String),
|
| 376 |
+
(r'\s+', Text),
|
| 377 |
+
],
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
def analyse_text(text):
|
| 381 |
+
if text[:1] != '.':
|
| 382 |
+
return False
|
| 383 |
+
if text[:3] == '.\\"':
|
| 384 |
+
return True
|
| 385 |
+
if text[:4] == '.TH ':
|
| 386 |
+
return True
|
| 387 |
+
if text[1:3].isalnum() and text[3].isspace():
|
| 388 |
+
return 0.9
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
class MozPreprocHashLexer(RegexLexer):
|
| 392 |
+
"""
|
| 393 |
+
Lexer for Mozilla Preprocessor files (with '#' as the marker).
|
| 394 |
+
|
| 395 |
+
Other data is left untouched.
|
| 396 |
+
|
| 397 |
+
.. versionadded:: 2.0
|
| 398 |
+
"""
|
| 399 |
+
name = 'mozhashpreproc'
|
| 400 |
+
aliases = [name]
|
| 401 |
+
filenames = []
|
| 402 |
+
mimetypes = []
|
| 403 |
+
|
| 404 |
+
tokens = {
|
| 405 |
+
'root': [
|
| 406 |
+
(r'^#', Comment.Preproc, ('expr', 'exprstart')),
|
| 407 |
+
(r'.+', Other),
|
| 408 |
+
],
|
| 409 |
+
'exprstart': [
|
| 410 |
+
(r'(literal)(.*)', bygroups(Comment.Preproc, Text), '#pop:2'),
|
| 411 |
+
(words((
|
| 412 |
+
'define', 'undef', 'if', 'ifdef', 'ifndef', 'else', 'elif',
|
| 413 |
+
'elifdef', 'elifndef', 'endif', 'expand', 'filter', 'unfilter',
|
| 414 |
+
'include', 'includesubst', 'error')),
|
| 415 |
+
Comment.Preproc, '#pop'),
|
| 416 |
+
],
|
| 417 |
+
'expr': [
|
| 418 |
+
(words(('!', '!=', '==', '&&', '||')), Operator),
|
| 419 |
+
(r'(defined)(\()', bygroups(Keyword, Punctuation)),
|
| 420 |
+
(r'\)', Punctuation),
|
| 421 |
+
(r'[0-9]+', Number.Decimal),
|
| 422 |
+
(r'__\w+?__', Name.Variable),
|
| 423 |
+
(r'@\w+?@', Name.Class),
|
| 424 |
+
(r'\w+', Name),
|
| 425 |
+
(r'\n', Text, '#pop'),
|
| 426 |
+
(r'\s+', Text),
|
| 427 |
+
(r'\S', Punctuation),
|
| 428 |
+
],
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
|
| 432 |
+
class MozPreprocPercentLexer(MozPreprocHashLexer):
|
| 433 |
+
"""
|
| 434 |
+
Lexer for Mozilla Preprocessor files (with '%' as the marker).
|
| 435 |
+
|
| 436 |
+
Other data is left untouched.
|
| 437 |
+
|
| 438 |
+
.. versionadded:: 2.0
|
| 439 |
+
"""
|
| 440 |
+
name = 'mozpercentpreproc'
|
| 441 |
+
aliases = [name]
|
| 442 |
+
filenames = []
|
| 443 |
+
mimetypes = []
|
| 444 |
+
|
| 445 |
+
tokens = {
|
| 446 |
+
'root': [
|
| 447 |
+
(r'^%', Comment.Preproc, ('expr', 'exprstart')),
|
| 448 |
+
(r'.+', Other),
|
| 449 |
+
],
|
| 450 |
+
}
|
| 451 |
+
|
| 452 |
+
|
| 453 |
+
class MozPreprocXulLexer(DelegatingLexer):
|
| 454 |
+
"""
|
| 455 |
+
Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
|
| 456 |
+
`XmlLexer`.
|
| 457 |
+
|
| 458 |
+
.. versionadded:: 2.0
|
| 459 |
+
"""
|
| 460 |
+
name = "XUL+mozpreproc"
|
| 461 |
+
aliases = ['xul+mozpreproc']
|
| 462 |
+
filenames = ['*.xul.in']
|
| 463 |
+
mimetypes = []
|
| 464 |
+
|
| 465 |
+
def __init__(self, **options):
|
| 466 |
+
super(MozPreprocXulLexer, self).__init__(
|
| 467 |
+
XmlLexer, MozPreprocHashLexer, **options)
|
| 468 |
+
|
| 469 |
+
|
| 470 |
+
class MozPreprocJavascriptLexer(DelegatingLexer):
|
| 471 |
+
"""
|
| 472 |
+
Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
|
| 473 |
+
`JavascriptLexer`.
|
| 474 |
+
|
| 475 |
+
.. versionadded:: 2.0
|
| 476 |
+
"""
|
| 477 |
+
name = "Javascript+mozpreproc"
|
| 478 |
+
aliases = ['javascript+mozpreproc']
|
| 479 |
+
filenames = ['*.js.in']
|
| 480 |
+
mimetypes = []
|
| 481 |
+
|
| 482 |
+
def __init__(self, **options):
|
| 483 |
+
super(MozPreprocJavascriptLexer, self).__init__(
|
| 484 |
+
JavascriptLexer, MozPreprocHashLexer, **options)
|
| 485 |
+
|
| 486 |
+
|
| 487 |
+
class MozPreprocCssLexer(DelegatingLexer):
|
| 488 |
+
"""
|
| 489 |
+
Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
|
| 490 |
+
`CssLexer`.
|
| 491 |
+
|
| 492 |
+
.. versionadded:: 2.0
|
| 493 |
+
"""
|
| 494 |
+
name = "CSS+mozpreproc"
|
| 495 |
+
aliases = ['css+mozpreproc']
|
| 496 |
+
filenames = ['*.css.in']
|
| 497 |
+
mimetypes = []
|
| 498 |
+
|
| 499 |
+
def __init__(self, **options):
|
| 500 |
+
super(MozPreprocCssLexer, self).__init__(
|
| 501 |
+
CssLexer, MozPreprocPercentLexer, **options)
|
| 502 |
+
|
| 503 |
+
|
| 504 |
+
class MarkdownLexer(RegexLexer):
|
| 505 |
+
"""
|
| 506 |
+
For `Markdown <https://help.github.com/categories/writing-on-github/>`_ markup.
|
| 507 |
+
|
| 508 |
+
.. versionadded:: 2.2
|
| 509 |
+
"""
|
| 510 |
+
name = 'markdown'
|
| 511 |
+
aliases = ['md']
|
| 512 |
+
filenames = ['*.md']
|
| 513 |
+
mimetypes = ["text/x-markdown"]
|
| 514 |
+
flags = re.MULTILINE
|
| 515 |
+
|
| 516 |
+
def _handle_codeblock(self, match):
|
| 517 |
+
"""
|
| 518 |
+
match args: 1:backticks, 2:lang_name, 3:newline, 4:code, 5:backticks
|
| 519 |
+
"""
|
| 520 |
+
from pygments.lexers import get_lexer_by_name
|
| 521 |
+
|
| 522 |
+
# section header
|
| 523 |
+
yield match.start(1), String , match.group(1)
|
| 524 |
+
yield match.start(2), String , match.group(2)
|
| 525 |
+
yield match.start(3), Text , match.group(3)
|
| 526 |
+
|
| 527 |
+
# lookup lexer if wanted and existing
|
| 528 |
+
lexer = None
|
| 529 |
+
if self.handlecodeblocks:
|
| 530 |
+
try:
|
| 531 |
+
lexer = get_lexer_by_name( match.group(2).strip() )
|
| 532 |
+
except ClassNotFound:
|
| 533 |
+
pass
|
| 534 |
+
code = match.group(4)
|
| 535 |
+
|
| 536 |
+
# no lexer for this language. handle it like it was a code block
|
| 537 |
+
if lexer is None:
|
| 538 |
+
yield match.start(4), String, code
|
| 539 |
+
return
|
| 540 |
+
|
| 541 |
+
for item in do_insertions([], lexer.get_tokens_unprocessed(code)):
|
| 542 |
+
yield item
|
| 543 |
+
|
| 544 |
+
yield match.start(5), String , match.group(5)
|
| 545 |
+
|
| 546 |
+
tokens = {
|
| 547 |
+
'root': [
|
| 548 |
+
# heading with pound prefix
|
| 549 |
+
(r'^(#)([^#].+\n)', bygroups(Generic.Heading, Text)),
|
| 550 |
+
(r'^(#{2,6})(.+\n)', bygroups(Generic.Subheading, Text)),
|
| 551 |
+
# task list
|
| 552 |
+
(r'^(\s*)([*-] )(\[[ xX]\])( .+\n)',
|
| 553 |
+
bygroups(Text, Keyword, Keyword, using(this, state='inline'))),
|
| 554 |
+
# bulleted lists
|
| 555 |
+
(r'^(\s*)([*-])(\s)(.+\n)',
|
| 556 |
+
bygroups(Text, Keyword, Text, using(this, state='inline'))),
|
| 557 |
+
# numbered lists
|
| 558 |
+
(r'^(\s*)([0-9]+\.)( .+\n)',
|
| 559 |
+
bygroups(Text, Keyword, using(this, state='inline'))),
|
| 560 |
+
# quote
|
| 561 |
+
(r'^(\s*>\s)(.+\n)', bygroups(Keyword, Generic.Emph)),
|
| 562 |
+
# text block
|
| 563 |
+
(r'^(```\n)([\w\W]*?)(^```$)', bygroups(String, Text, String)),
|
| 564 |
+
# code block with language
|
| 565 |
+
(r'^(```)(\w+)(\n)([\w\W]*?)(^```$)', _handle_codeblock),
|
| 566 |
+
|
| 567 |
+
include('inline'),
|
| 568 |
+
],
|
| 569 |
+
'inline': [
|
| 570 |
+
# escape
|
| 571 |
+
(r'\\.', Text),
|
| 572 |
+
# italics
|
| 573 |
+
(r'(\s)([*_][^*_]+[*_])(\W|\n)', bygroups(Text, Generic.Emph, Text)),
|
| 574 |
+
# bold
|
| 575 |
+
# warning: the following rule eats internal tags. eg. **foo _bar_ baz** bar is not italics
|
| 576 |
+
(r'(\s)((\*\*|__).*\3)((?=\W|\n))', bygroups(Text, Generic.Strong, None, Text)),
|
| 577 |
+
# "proper way" (r'(\s)([*_]{2}[^*_]+[*_]{2})((?=\W|\n))', bygroups(Text, Generic.Strong, Text)),
|
| 578 |
+
# strikethrough
|
| 579 |
+
(r'(\s)(~~[^~]+~~)((?=\W|\n))', bygroups(Text, Generic.Deleted, Text)),
|
| 580 |
+
# inline code
|
| 581 |
+
(r'`[^`]+`', String.Backtick),
|
| 582 |
+
# mentions and topics (twitter and github stuff)
|
| 583 |
+
(r'[@#][\w/:]+', Name.Entity),
|
| 584 |
+
# (image?) links eg: 
|
| 585 |
+
(r'(!?\[)([^]]+)(\])(\()([^)]+)(\))', bygroups(Text, Name.Tag, Text, Text, Name.Attribute, Text)),
|
| 586 |
+
|
| 587 |
+
# general text, must come last!
|
| 588 |
+
(r'[^\\\s]+', Text),
|
| 589 |
+
(r'.', Text),
|
| 590 |
+
],
|
| 591 |
+
}
|
| 592 |
+
|
| 593 |
+
def __init__(self, **options):
|
| 594 |
+
self.handlecodeblocks = get_bool_opt(options, 'handlecodeblocks', True)
|
| 595 |
+
RegexLexer.__init__(self, **options)
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/math.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.math
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Just export lexers that were contained in this module.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from pygments.lexers.python import NumPyLexer
|
| 13 |
+
from pygments.lexers.matlab import MatlabLexer, MatlabSessionLexer, \
|
| 14 |
+
OctaveLexer, ScilabLexer
|
| 15 |
+
from pygments.lexers.julia import JuliaLexer, JuliaConsoleLexer
|
| 16 |
+
from pygments.lexers.r import RConsoleLexer, SLexer, RdLexer
|
| 17 |
+
from pygments.lexers.modeling import BugsLexer, JagsLexer, StanLexer
|
| 18 |
+
from pygments.lexers.idl import IDLLexer
|
| 19 |
+
from pygments.lexers.algebra import MuPADLexer
|
| 20 |
+
|
| 21 |
+
__all__ = []
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/matlab.py
ADDED
|
@@ -0,0 +1,663 @@
|
|
|
|
|
|
|
|
|
|
|
|
|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+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import Lexer, RegexLexer, bygroups, words, do_insertions
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Generic, Whitespace
|
| 17 |
+
|
| 18 |
+
from pygments.lexers import _scilab_builtins
|
| 19 |
+
|
| 20 |
+
__all__ = ['MatlabLexer', 'MatlabSessionLexer', 'OctaveLexer', 'ScilabLexer']
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class MatlabLexer(RegexLexer):
|
| 24 |
+
"""
|
| 25 |
+
For Matlab source code.
|
| 26 |
+
|
| 27 |
+
.. versionadded:: 0.10
|
| 28 |
+
"""
|
| 29 |
+
name = 'Matlab'
|
| 30 |
+
aliases = ['matlab']
|
| 31 |
+
filenames = ['*.m']
|
| 32 |
+
mimetypes = ['text/matlab']
|
| 33 |
+
|
| 34 |
+
#
|
| 35 |
+
# These lists are generated automatically.
|
| 36 |
+
# Run the following in bash shell:
|
| 37 |
+
#
|
| 38 |
+
# for f in elfun specfun elmat; do
|
| 39 |
+
# echo -n "$f = "
|
| 40 |
+
# matlab -nojvm -r "help $f;exit;" | perl -ne \
|
| 41 |
+
# 'push(@c,$1) if /^ (\w+)\s+-/; END {print q{["}.join(q{","},@c).qq{"]\n};}'
|
| 42 |
+
# done
|
| 43 |
+
#
|
| 44 |
+
# elfun: Elementary math functions
|
| 45 |
+
# specfun: Special Math functions
|
| 46 |
+
# elmat: Elementary matrices and matrix manipulation
|
| 47 |
+
#
|
| 48 |
+
# taken from Matlab version 7.4.0.336 (R2007a)
|
| 49 |
+
#
|
| 50 |
+
elfun = ("sin", "sind", "sinh", "asin", "asind", "asinh", "cos", "cosd", "cosh",
|
| 51 |
+
"acos", "acosd", "acosh", "tan", "tand", "tanh", "atan", "atand", "atan2",
|
| 52 |
+
"atanh", "sec", "secd", "sech", "asec", "asecd", "asech", "csc", "cscd",
|
| 53 |
+
"csch", "acsc", "acscd", "acsch", "cot", "cotd", "coth", "acot", "acotd",
|
| 54 |
+
"acoth", "hypot", "exp", "expm1", "log", "log1p", "log10", "log2", "pow2",
|
| 55 |
+
"realpow", "reallog", "realsqrt", "sqrt", "nthroot", "nextpow2", "abs",
|
| 56 |
+
"angle", "complex", "conj", "imag", "real", "unwrap", "isreal", "cplxpair",
|
| 57 |
+
"fix", "floor", "ceil", "round", "mod", "rem", "sign")
|
| 58 |
+
specfun = ("airy", "besselj", "bessely", "besselh", "besseli", "besselk", "beta",
|
| 59 |
+
"betainc", "betaln", "ellipj", "ellipke", "erf", "erfc", "erfcx",
|
| 60 |
+
"erfinv", "expint", "gamma", "gammainc", "gammaln", "psi", "legendre",
|
| 61 |
+
"cross", "dot", "factor", "isprime", "primes", "gcd", "lcm", "rat",
|
| 62 |
+
"rats", "perms", "nchoosek", "factorial", "cart2sph", "cart2pol",
|
| 63 |
+
"pol2cart", "sph2cart", "hsv2rgb", "rgb2hsv")
|
| 64 |
+
elmat = ("zeros", "ones", "eye", "repmat", "rand", "randn", "linspace", "logspace",
|
| 65 |
+
"freqspace", "meshgrid", "accumarray", "size", "length", "ndims", "numel",
|
| 66 |
+
"disp", "isempty", "isequal", "isequalwithequalnans", "cat", "reshape",
|
| 67 |
+
"diag", "blkdiag", "tril", "triu", "fliplr", "flipud", "flipdim", "rot90",
|
| 68 |
+
"find", "end", "sub2ind", "ind2sub", "bsxfun", "ndgrid", "permute",
|
| 69 |
+
"ipermute", "shiftdim", "circshift", "squeeze", "isscalar", "isvector",
|
| 70 |
+
"ans", "eps", "realmax", "realmin", "pi", "i", "inf", "nan", "isnan",
|
| 71 |
+
"isinf", "isfinite", "j", "why", "compan", "gallery", "hadamard", "hankel",
|
| 72 |
+
"hilb", "invhilb", "magic", "pascal", "rosser", "toeplitz", "vander",
|
| 73 |
+
"wilkinson")
|
| 74 |
+
|
| 75 |
+
tokens = {
|
| 76 |
+
'root': [
|
| 77 |
+
# line starting with '!' is sent as a system command. not sure what
|
| 78 |
+
# label to use...
|
| 79 |
+
(r'^!.*', String.Other),
|
| 80 |
+
(r'%\{\s*\n', Comment.Multiline, 'blockcomment'),
|
| 81 |
+
(r'%.*$', Comment),
|
| 82 |
+
(r'^\s*function', Keyword, 'deffunc'),
|
| 83 |
+
|
| 84 |
+
# from 'iskeyword' on version 7.11 (R2010):
|
| 85 |
+
(words((
|
| 86 |
+
'break', 'case', 'catch', 'classdef', 'continue', 'else', 'elseif',
|
| 87 |
+
'end', 'enumerated', 'events', 'for', 'function', 'global', 'if',
|
| 88 |
+
'methods', 'otherwise', 'parfor', 'persistent', 'properties',
|
| 89 |
+
'return', 'spmd', 'switch', 'try', 'while'), suffix=r'\b'),
|
| 90 |
+
Keyword),
|
| 91 |
+
|
| 92 |
+
("(" + "|".join(elfun + specfun + elmat) + r')\b', Name.Builtin),
|
| 93 |
+
|
| 94 |
+
# line continuation with following comment:
|
| 95 |
+
(r'\.\.\..*$', Comment),
|
| 96 |
+
|
| 97 |
+
# operators:
|
| 98 |
+
(r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator),
|
| 99 |
+
# operators requiring escape for re:
|
| 100 |
+
(r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
|
| 101 |
+
|
| 102 |
+
# punctuation:
|
| 103 |
+
(r'\[|\]|\(|\)|\{|\}|:|@|\.|,', Punctuation),
|
| 104 |
+
(r'=|:|;', Punctuation),
|
| 105 |
+
|
| 106 |
+
# quote can be transpose, instead of string:
|
| 107 |
+
# (not great, but handles common cases...)
|
| 108 |
+
(r'(?<=[\w)\].])\'+', Operator),
|
| 109 |
+
|
| 110 |
+
(r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
|
| 111 |
+
(r'\d+[eEf][+-]?[0-9]+', Number.Float),
|
| 112 |
+
(r'\d+', Number.Integer),
|
| 113 |
+
|
| 114 |
+
(r'(?<![\w)\].])\'', String, 'string'),
|
| 115 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 116 |
+
(r'.', Text),
|
| 117 |
+
],
|
| 118 |
+
'string': [
|
| 119 |
+
(r'[^\']*\'', String, '#pop')
|
| 120 |
+
],
|
| 121 |
+
'blockcomment': [
|
| 122 |
+
(r'^\s*%\}', Comment.Multiline, '#pop'),
|
| 123 |
+
(r'^.*\n', Comment.Multiline),
|
| 124 |
+
(r'.', Comment.Multiline),
|
| 125 |
+
],
|
| 126 |
+
'deffunc': [
|
| 127 |
+
(r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',
|
| 128 |
+
bygroups(Whitespace, Text, Whitespace, Punctuation,
|
| 129 |
+
Whitespace, Name.Function, Punctuation, Text,
|
| 130 |
+
Punctuation, Whitespace), '#pop'),
|
| 131 |
+
# function with no args
|
| 132 |
+
(r'(\s*)([a-zA-Z_]\w*)', bygroups(Text, Name.Function), '#pop'),
|
| 133 |
+
],
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
def analyse_text(text):
|
| 137 |
+
if re.match('^\s*%', text, re.M): # comment
|
| 138 |
+
return 0.2
|
| 139 |
+
elif re.match('^!\w+', text, re.M): # system cmd
|
| 140 |
+
return 0.2
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
line_re = re.compile('.*?\n')
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
class MatlabSessionLexer(Lexer):
|
| 147 |
+
"""
|
| 148 |
+
For Matlab sessions. Modeled after PythonConsoleLexer.
|
| 149 |
+
Contributed by Ken Schutte <kschutte@csail.mit.edu>.
|
| 150 |
+
|
| 151 |
+
.. versionadded:: 0.10
|
| 152 |
+
"""
|
| 153 |
+
name = 'Matlab session'
|
| 154 |
+
aliases = ['matlabsession']
|
| 155 |
+
|
| 156 |
+
def get_tokens_unprocessed(self, text):
|
| 157 |
+
mlexer = MatlabLexer(**self.options)
|
| 158 |
+
|
| 159 |
+
curcode = ''
|
| 160 |
+
insertions = []
|
| 161 |
+
|
| 162 |
+
for match in line_re.finditer(text):
|
| 163 |
+
line = match.group()
|
| 164 |
+
|
| 165 |
+
if line.startswith('>> '):
|
| 166 |
+
insertions.append((len(curcode),
|
| 167 |
+
[(0, Generic.Prompt, line[:3])]))
|
| 168 |
+
curcode += line[3:]
|
| 169 |
+
|
| 170 |
+
elif line.startswith('>>'):
|
| 171 |
+
insertions.append((len(curcode),
|
| 172 |
+
[(0, Generic.Prompt, line[:2])]))
|
| 173 |
+
curcode += line[2:]
|
| 174 |
+
|
| 175 |
+
elif line.startswith('???'):
|
| 176 |
+
|
| 177 |
+
idx = len(curcode)
|
| 178 |
+
|
| 179 |
+
# without is showing error on same line as before...?
|
| 180 |
+
# line = "\n" + line
|
| 181 |
+
token = (0, Generic.Traceback, line)
|
| 182 |
+
insertions.append((idx, [token]))
|
| 183 |
+
|
| 184 |
+
else:
|
| 185 |
+
if curcode:
|
| 186 |
+
for item in do_insertions(
|
| 187 |
+
insertions, mlexer.get_tokens_unprocessed(curcode)):
|
| 188 |
+
yield item
|
| 189 |
+
curcode = ''
|
| 190 |
+
insertions = []
|
| 191 |
+
|
| 192 |
+
yield match.start(), Generic.Output, line
|
| 193 |
+
|
| 194 |
+
if curcode: # or item:
|
| 195 |
+
for item in do_insertions(
|
| 196 |
+
insertions, mlexer.get_tokens_unprocessed(curcode)):
|
| 197 |
+
yield item
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
class OctaveLexer(RegexLexer):
|
| 201 |
+
"""
|
| 202 |
+
For GNU Octave source code.
|
| 203 |
+
|
| 204 |
+
.. versionadded:: 1.5
|
| 205 |
+
"""
|
| 206 |
+
name = 'Octave'
|
| 207 |
+
aliases = ['octave']
|
| 208 |
+
filenames = ['*.m']
|
| 209 |
+
mimetypes = ['text/octave']
|
| 210 |
+
|
| 211 |
+
# These lists are generated automatically.
|
| 212 |
+
# Run the following in bash shell:
|
| 213 |
+
#
|
| 214 |
+
# First dump all of the Octave manual into a plain text file:
|
| 215 |
+
#
|
| 216 |
+
# $ info octave --subnodes -o octave-manual
|
| 217 |
+
#
|
| 218 |
+
# Now grep through it:
|
| 219 |
+
|
| 220 |
+
# for i in \
|
| 221 |
+
# "Built-in Function" "Command" "Function File" \
|
| 222 |
+
# "Loadable Function" "Mapping Function";
|
| 223 |
+
# do
|
| 224 |
+
# perl -e '@name = qw('"$i"');
|
| 225 |
+
# print lc($name[0]),"_kw = [\n"';
|
| 226 |
+
#
|
| 227 |
+
# perl -n -e 'print "\"$1\",\n" if /-- '"$i"': .* (\w*) \(/;' \
|
| 228 |
+
# octave-manual | sort | uniq ;
|
| 229 |
+
# echo "]" ;
|
| 230 |
+
# echo;
|
| 231 |
+
# done
|
| 232 |
+
|
| 233 |
+
# taken from Octave Mercurial changeset 8cc154f45e37 (30-jan-2011)
|
| 234 |
+
|
| 235 |
+
builtin_kw = (
|
| 236 |
+
"addlistener", "addpath", "addproperty", "all",
|
| 237 |
+
"and", "any", "argnames", "argv", "assignin",
|
| 238 |
+
"atexit", "autoload",
|
| 239 |
+
"available_graphics_toolkits", "beep_on_error",
|
| 240 |
+
"bitand", "bitmax", "bitor", "bitshift", "bitxor",
|
| 241 |
+
"cat", "cell", "cellstr", "char", "class", "clc",
|
| 242 |
+
"columns", "command_line_path",
|
| 243 |
+
"completion_append_char", "completion_matches",
|
| 244 |
+
"complex", "confirm_recursive_rmdir", "cputime",
|
| 245 |
+
"crash_dumps_octave_core", "ctranspose", "cumprod",
|
| 246 |
+
"cumsum", "debug_on_error", "debug_on_interrupt",
|
| 247 |
+
"debug_on_warning", "default_save_options",
|
| 248 |
+
"dellistener", "diag", "diff", "disp",
|
| 249 |
+
"doc_cache_file", "do_string_escapes", "double",
|
| 250 |
+
"drawnow", "e", "echo_executing_commands", "eps",
|
| 251 |
+
"eq", "errno", "errno_list", "error", "eval",
|
| 252 |
+
"evalin", "exec", "exist", "exit", "eye", "false",
|
| 253 |
+
"fclear", "fclose", "fcntl", "fdisp", "feof",
|
| 254 |
+
"ferror", "feval", "fflush", "fgetl", "fgets",
|
| 255 |
+
"fieldnames", "file_in_loadpath", "file_in_path",
|
| 256 |
+
"filemarker", "filesep", "find_dir_in_path",
|
| 257 |
+
"fixed_point_format", "fnmatch", "fopen", "fork",
|
| 258 |
+
"formula", "fprintf", "fputs", "fread", "freport",
|
| 259 |
+
"frewind", "fscanf", "fseek", "fskipl", "ftell",
|
| 260 |
+
"functions", "fwrite", "ge", "genpath", "get",
|
| 261 |
+
"getegid", "getenv", "geteuid", "getgid",
|
| 262 |
+
"getpgrp", "getpid", "getppid", "getuid", "glob",
|
| 263 |
+
"gt", "gui_mode", "history_control",
|
| 264 |
+
"history_file", "history_size",
|
| 265 |
+
"history_timestamp_format_string", "home",
|
| 266 |
+
"horzcat", "hypot", "ifelse",
|
| 267 |
+
"ignore_function_time_stamp", "inferiorto",
|
| 268 |
+
"info_file", "info_program", "inline", "input",
|
| 269 |
+
"intmax", "intmin", "ipermute",
|
| 270 |
+
"is_absolute_filename", "isargout", "isbool",
|
| 271 |
+
"iscell", "iscellstr", "ischar", "iscomplex",
|
| 272 |
+
"isempty", "isfield", "isfloat", "isglobal",
|
| 273 |
+
"ishandle", "isieee", "isindex", "isinteger",
|
| 274 |
+
"islogical", "ismatrix", "ismethod", "isnull",
|
| 275 |
+
"isnumeric", "isobject", "isreal",
|
| 276 |
+
"is_rooted_relative_filename", "issorted",
|
| 277 |
+
"isstruct", "isvarname", "kbhit", "keyboard",
|
| 278 |
+
"kill", "lasterr", "lasterror", "lastwarn",
|
| 279 |
+
"ldivide", "le", "length", "link", "linspace",
|
| 280 |
+
"logical", "lstat", "lt", "make_absolute_filename",
|
| 281 |
+
"makeinfo_program", "max_recursion_depth", "merge",
|
| 282 |
+
"methods", "mfilename", "minus", "mislocked",
|
| 283 |
+
"mkdir", "mkfifo", "mkstemp", "mldivide", "mlock",
|
| 284 |
+
"mouse_wheel_zoom", "mpower", "mrdivide", "mtimes",
|
| 285 |
+
"munlock", "nargin", "nargout",
|
| 286 |
+
"native_float_format", "ndims", "ne", "nfields",
|
| 287 |
+
"nnz", "norm", "not", "numel", "nzmax",
|
| 288 |
+
"octave_config_info", "octave_core_file_limit",
|
| 289 |
+
"octave_core_file_name",
|
| 290 |
+
"octave_core_file_options", "ones", "or",
|
| 291 |
+
"output_max_field_width", "output_precision",
|
| 292 |
+
"page_output_immediately", "page_screen_output",
|
| 293 |
+
"path", "pathsep", "pause", "pclose", "permute",
|
| 294 |
+
"pi", "pipe", "plus", "popen", "power",
|
| 295 |
+
"print_empty_dimensions", "printf",
|
| 296 |
+
"print_struct_array_contents", "prod",
|
| 297 |
+
"program_invocation_name", "program_name",
|
| 298 |
+
"putenv", "puts", "pwd", "quit", "rats", "rdivide",
|
| 299 |
+
"readdir", "readlink", "read_readline_init_file",
|
| 300 |
+
"realmax", "realmin", "rehash", "rename",
|
| 301 |
+
"repelems", "re_read_readline_init_file", "reset",
|
| 302 |
+
"reshape", "resize", "restoredefaultpath",
|
| 303 |
+
"rethrow", "rmdir", "rmfield", "rmpath", "rows",
|
| 304 |
+
"save_header_format_string", "save_precision",
|
| 305 |
+
"saving_history", "scanf", "set", "setenv",
|
| 306 |
+
"shell_cmd", "sighup_dumps_octave_core",
|
| 307 |
+
"sigterm_dumps_octave_core", "silent_functions",
|
| 308 |
+
"single", "size", "size_equal", "sizemax",
|
| 309 |
+
"sizeof", "sleep", "source", "sparse_auto_mutate",
|
| 310 |
+
"split_long_rows", "sprintf", "squeeze", "sscanf",
|
| 311 |
+
"stat", "stderr", "stdin", "stdout", "strcmp",
|
| 312 |
+
"strcmpi", "string_fill_char", "strncmp",
|
| 313 |
+
"strncmpi", "struct", "struct_levels_to_print",
|
| 314 |
+
"strvcat", "subsasgn", "subsref", "sum", "sumsq",
|
| 315 |
+
"superiorto", "suppress_verbose_help_message",
|
| 316 |
+
"symlink", "system", "tic", "tilde_expand",
|
| 317 |
+
"times", "tmpfile", "tmpnam", "toc", "toupper",
|
| 318 |
+
"transpose", "true", "typeinfo", "umask", "uminus",
|
| 319 |
+
"uname", "undo_string_escapes", "unlink", "uplus",
|
| 320 |
+
"upper", "usage", "usleep", "vec", "vectorize",
|
| 321 |
+
"vertcat", "waitpid", "warning", "warranty",
|
| 322 |
+
"whos_line_format", "yes_or_no", "zeros",
|
| 323 |
+
"inf", "Inf", "nan", "NaN")
|
| 324 |
+
|
| 325 |
+
command_kw = ("close", "load", "who", "whos")
|
| 326 |
+
|
| 327 |
+
function_kw = (
|
| 328 |
+
"accumarray", "accumdim", "acosd", "acotd",
|
| 329 |
+
"acscd", "addtodate", "allchild", "ancestor",
|
| 330 |
+
"anova", "arch_fit", "arch_rnd", "arch_test",
|
| 331 |
+
"area", "arma_rnd", "arrayfun", "ascii", "asctime",
|
| 332 |
+
"asecd", "asind", "assert", "atand",
|
| 333 |
+
"autoreg_matrix", "autumn", "axes", "axis", "bar",
|
| 334 |
+
"barh", "bartlett", "bartlett_test", "beep",
|
| 335 |
+
"betacdf", "betainv", "betapdf", "betarnd",
|
| 336 |
+
"bicgstab", "bicubic", "binary", "binocdf",
|
| 337 |
+
"binoinv", "binopdf", "binornd", "bitcmp",
|
| 338 |
+
"bitget", "bitset", "blackman", "blanks",
|
| 339 |
+
"blkdiag", "bone", "box", "brighten", "calendar",
|
| 340 |
+
"cast", "cauchy_cdf", "cauchy_inv", "cauchy_pdf",
|
| 341 |
+
"cauchy_rnd", "caxis", "celldisp", "center", "cgs",
|
| 342 |
+
"chisquare_test_homogeneity",
|
| 343 |
+
"chisquare_test_independence", "circshift", "cla",
|
| 344 |
+
"clabel", "clf", "clock", "cloglog", "closereq",
|
| 345 |
+
"colon", "colorbar", "colormap", "colperm",
|
| 346 |
+
"comet", "common_size", "commutation_matrix",
|
| 347 |
+
"compan", "compare_versions", "compass",
|
| 348 |
+
"computer", "cond", "condest", "contour",
|
| 349 |
+
"contourc", "contourf", "contrast", "conv",
|
| 350 |
+
"convhull", "cool", "copper", "copyfile", "cor",
|
| 351 |
+
"corrcoef", "cor_test", "cosd", "cotd", "cov",
|
| 352 |
+
"cplxpair", "cross", "cscd", "cstrcat", "csvread",
|
| 353 |
+
"csvwrite", "ctime", "cumtrapz", "curl", "cut",
|
| 354 |
+
"cylinder", "date", "datenum", "datestr",
|
| 355 |
+
"datetick", "datevec", "dblquad", "deal",
|
| 356 |
+
"deblank", "deconv", "delaunay", "delaunayn",
|
| 357 |
+
"delete", "demo", "detrend", "diffpara", "diffuse",
|
| 358 |
+
"dir", "discrete_cdf", "discrete_inv",
|
| 359 |
+
"discrete_pdf", "discrete_rnd", "display",
|
| 360 |
+
"divergence", "dlmwrite", "dos", "dsearch",
|
| 361 |
+
"dsearchn", "duplication_matrix", "durbinlevinson",
|
| 362 |
+
"ellipsoid", "empirical_cdf", "empirical_inv",
|
| 363 |
+
"empirical_pdf", "empirical_rnd", "eomday",
|
| 364 |
+
"errorbar", "etime", "etreeplot", "example",
|
| 365 |
+
"expcdf", "expinv", "expm", "exppdf", "exprnd",
|
| 366 |
+
"ezcontour", "ezcontourf", "ezmesh", "ezmeshc",
|
| 367 |
+
"ezplot", "ezpolar", "ezsurf", "ezsurfc", "factor",
|
| 368 |
+
"factorial", "fail", "fcdf", "feather", "fftconv",
|
| 369 |
+
"fftfilt", "fftshift", "figure", "fileattrib",
|
| 370 |
+
"fileparts", "fill", "findall", "findobj",
|
| 371 |
+
"findstr", "finv", "flag", "flipdim", "fliplr",
|
| 372 |
+
"flipud", "fpdf", "fplot", "fractdiff", "freqz",
|
| 373 |
+
"freqz_plot", "frnd", "fsolve",
|
| 374 |
+
"f_test_regression", "ftp", "fullfile", "fzero",
|
| 375 |
+
"gamcdf", "gaminv", "gampdf", "gamrnd", "gca",
|
| 376 |
+
"gcbf", "gcbo", "gcf", "genvarname", "geocdf",
|
| 377 |
+
"geoinv", "geopdf", "geornd", "getfield", "ginput",
|
| 378 |
+
"glpk", "gls", "gplot", "gradient",
|
| 379 |
+
"graphics_toolkit", "gray", "grid", "griddata",
|
| 380 |
+
"griddatan", "gtext", "gunzip", "gzip", "hadamard",
|
| 381 |
+
"hamming", "hankel", "hanning", "hggroup",
|
| 382 |
+
"hidden", "hilb", "hist", "histc", "hold", "hot",
|
| 383 |
+
"hotelling_test", "housh", "hsv", "hurst",
|
| 384 |
+
"hygecdf", "hygeinv", "hygepdf", "hygernd",
|
| 385 |
+
"idivide", "ifftshift", "image", "imagesc",
|
| 386 |
+
"imfinfo", "imread", "imshow", "imwrite", "index",
|
| 387 |
+
"info", "inpolygon", "inputname", "interpft",
|
| 388 |
+
"interpn", "intersect", "invhilb", "iqr", "isa",
|
| 389 |
+
"isdefinite", "isdir", "is_duplicate_entry",
|
| 390 |
+
"isequal", "isequalwithequalnans", "isfigure",
|
| 391 |
+
"ishermitian", "ishghandle", "is_leap_year",
|
| 392 |
+
"isletter", "ismac", "ismember", "ispc", "isprime",
|
| 393 |
+
"isprop", "isscalar", "issquare", "isstrprop",
|
| 394 |
+
"issymmetric", "isunix", "is_valid_file_id",
|
| 395 |
+
"isvector", "jet", "kendall",
|
| 396 |
+
"kolmogorov_smirnov_cdf",
|
| 397 |
+
"kolmogorov_smirnov_test", "kruskal_wallis_test",
|
| 398 |
+
"krylov", "kurtosis", "laplace_cdf", "laplace_inv",
|
| 399 |
+
"laplace_pdf", "laplace_rnd", "legend", "legendre",
|
| 400 |
+
"license", "line", "linkprop", "list_primes",
|
| 401 |
+
"loadaudio", "loadobj", "logistic_cdf",
|
| 402 |
+
"logistic_inv", "logistic_pdf", "logistic_rnd",
|
| 403 |
+
"logit", "loglog", "loglogerr", "logm", "logncdf",
|
| 404 |
+
"logninv", "lognpdf", "lognrnd", "logspace",
|
| 405 |
+
"lookfor", "ls_command", "lsqnonneg", "magic",
|
| 406 |
+
"mahalanobis", "manova", "matlabroot",
|
| 407 |
+
"mcnemar_test", "mean", "meansq", "median", "menu",
|
| 408 |
+
"mesh", "meshc", "meshgrid", "meshz", "mexext",
|
| 409 |
+
"mget", "mkpp", "mode", "moment", "movefile",
|
| 410 |
+
"mpoles", "mput", "namelengthmax", "nargchk",
|
| 411 |
+
"nargoutchk", "nbincdf", "nbininv", "nbinpdf",
|
| 412 |
+
"nbinrnd", "nchoosek", "ndgrid", "newplot", "news",
|
| 413 |
+
"nonzeros", "normcdf", "normest", "norminv",
|
| 414 |
+
"normpdf", "normrnd", "now", "nthroot", "null",
|
| 415 |
+
"ocean", "ols", "onenormest", "optimget",
|
| 416 |
+
"optimset", "orderfields", "orient", "orth",
|
| 417 |
+
"pack", "pareto", "parseparams", "pascal", "patch",
|
| 418 |
+
"pathdef", "pcg", "pchip", "pcolor", "pcr",
|
| 419 |
+
"peaks", "periodogram", "perl", "perms", "pie",
|
| 420 |
+
"pink", "planerot", "playaudio", "plot",
|
| 421 |
+
"plotmatrix", "plotyy", "poisscdf", "poissinv",
|
| 422 |
+
"poisspdf", "poissrnd", "polar", "poly",
|
| 423 |
+
"polyaffine", "polyarea", "polyderiv", "polyfit",
|
| 424 |
+
"polygcd", "polyint", "polyout", "polyreduce",
|
| 425 |
+
"polyval", "polyvalm", "postpad", "powerset",
|
| 426 |
+
"ppder", "ppint", "ppjumps", "ppplot", "ppval",
|
| 427 |
+
"pqpnonneg", "prepad", "primes", "print",
|
| 428 |
+
"print_usage", "prism", "probit", "qp", "qqplot",
|
| 429 |
+
"quadcc", "quadgk", "quadl", "quadv", "quiver",
|
| 430 |
+
"qzhess", "rainbow", "randi", "range", "rank",
|
| 431 |
+
"ranks", "rat", "reallog", "realpow", "realsqrt",
|
| 432 |
+
"record", "rectangle_lw", "rectangle_sw",
|
| 433 |
+
"rectint", "refresh", "refreshdata",
|
| 434 |
+
"regexptranslate", "repmat", "residue", "ribbon",
|
| 435 |
+
"rindex", "roots", "rose", "rosser", "rotdim",
|
| 436 |
+
"rref", "run", "run_count", "rundemos", "run_test",
|
| 437 |
+
"runtests", "saveas", "saveaudio", "saveobj",
|
| 438 |
+
"savepath", "scatter", "secd", "semilogx",
|
| 439 |
+
"semilogxerr", "semilogy", "semilogyerr",
|
| 440 |
+
"setaudio", "setdiff", "setfield", "setxor",
|
| 441 |
+
"shading", "shift", "shiftdim", "sign_test",
|
| 442 |
+
"sinc", "sind", "sinetone", "sinewave", "skewness",
|
| 443 |
+
"slice", "sombrero", "sortrows", "spaugment",
|
| 444 |
+
"spconvert", "spdiags", "spearman", "spectral_adf",
|
| 445 |
+
"spectral_xdf", "specular", "speed", "spencer",
|
| 446 |
+
"speye", "spfun", "sphere", "spinmap", "spline",
|
| 447 |
+
"spones", "sprand", "sprandn", "sprandsym",
|
| 448 |
+
"spring", "spstats", "spy", "sqp", "stairs",
|
| 449 |
+
"statistics", "std", "stdnormal_cdf",
|
| 450 |
+
"stdnormal_inv", "stdnormal_pdf", "stdnormal_rnd",
|
| 451 |
+
"stem", "stft", "strcat", "strchr", "strjust",
|
| 452 |
+
"strmatch", "strread", "strsplit", "strtok",
|
| 453 |
+
"strtrim", "strtrunc", "structfun", "studentize",
|
| 454 |
+
"subplot", "subsindex", "subspace", "substr",
|
| 455 |
+
"substruct", "summer", "surf", "surface", "surfc",
|
| 456 |
+
"surfl", "surfnorm", "svds", "swapbytes",
|
| 457 |
+
"sylvester_matrix", "symvar", "synthesis", "table",
|
| 458 |
+
"tand", "tar", "tcdf", "tempdir", "tempname",
|
| 459 |
+
"test", "text", "textread", "textscan", "tinv",
|
| 460 |
+
"title", "toeplitz", "tpdf", "trace", "trapz",
|
| 461 |
+
"treelayout", "treeplot", "triangle_lw",
|
| 462 |
+
"triangle_sw", "tril", "trimesh", "triplequad",
|
| 463 |
+
"triplot", "trisurf", "triu", "trnd", "tsearchn",
|
| 464 |
+
"t_test", "t_test_regression", "type", "unidcdf",
|
| 465 |
+
"unidinv", "unidpdf", "unidrnd", "unifcdf",
|
| 466 |
+
"unifinv", "unifpdf", "unifrnd", "union", "unique",
|
| 467 |
+
"unix", "unmkpp", "unpack", "untabify", "untar",
|
| 468 |
+
"unwrap", "unzip", "u_test", "validatestring",
|
| 469 |
+
"vander", "var", "var_test", "vech", "ver",
|
| 470 |
+
"version", "view", "voronoi", "voronoin",
|
| 471 |
+
"waitforbuttonpress", "wavread", "wavwrite",
|
| 472 |
+
"wblcdf", "wblinv", "wblpdf", "wblrnd", "weekday",
|
| 473 |
+
"welch_test", "what", "white", "whitebg",
|
| 474 |
+
"wienrnd", "wilcoxon_test", "wilkinson", "winter",
|
| 475 |
+
"xlabel", "xlim", "ylabel", "yulewalker", "zip",
|
| 476 |
+
"zlabel", "z_test")
|
| 477 |
+
|
| 478 |
+
loadable_kw = (
|
| 479 |
+
"airy", "amd", "balance", "besselh", "besseli",
|
| 480 |
+
"besselj", "besselk", "bessely", "bitpack",
|
| 481 |
+
"bsxfun", "builtin", "ccolamd", "cellfun",
|
| 482 |
+
"cellslices", "chol", "choldelete", "cholinsert",
|
| 483 |
+
"cholinv", "cholshift", "cholupdate", "colamd",
|
| 484 |
+
"colloc", "convhulln", "convn", "csymamd",
|
| 485 |
+
"cummax", "cummin", "daspk", "daspk_options",
|
| 486 |
+
"dasrt", "dasrt_options", "dassl", "dassl_options",
|
| 487 |
+
"dbclear", "dbdown", "dbstack", "dbstatus",
|
| 488 |
+
"dbstop", "dbtype", "dbup", "dbwhere", "det",
|
| 489 |
+
"dlmread", "dmperm", "dot", "eig", "eigs",
|
| 490 |
+
"endgrent", "endpwent", "etree", "fft", "fftn",
|
| 491 |
+
"fftw", "filter", "find", "full", "gcd",
|
| 492 |
+
"getgrent", "getgrgid", "getgrnam", "getpwent",
|
| 493 |
+
"getpwnam", "getpwuid", "getrusage", "givens",
|
| 494 |
+
"gmtime", "gnuplot_binary", "hess", "ifft",
|
| 495 |
+
"ifftn", "inv", "isdebugmode", "issparse", "kron",
|
| 496 |
+
"localtime", "lookup", "lsode", "lsode_options",
|
| 497 |
+
"lu", "luinc", "luupdate", "matrix_type", "max",
|
| 498 |
+
"min", "mktime", "pinv", "qr", "qrdelete",
|
| 499 |
+
"qrinsert", "qrshift", "qrupdate", "quad",
|
| 500 |
+
"quad_options", "qz", "rand", "rande", "randg",
|
| 501 |
+
"randn", "randp", "randperm", "rcond", "regexp",
|
| 502 |
+
"regexpi", "regexprep", "schur", "setgrent",
|
| 503 |
+
"setpwent", "sort", "spalloc", "sparse", "spparms",
|
| 504 |
+
"sprank", "sqrtm", "strfind", "strftime",
|
| 505 |
+
"strptime", "strrep", "svd", "svd_driver", "syl",
|
| 506 |
+
"symamd", "symbfact", "symrcm", "time", "tsearch",
|
| 507 |
+
"typecast", "urlread", "urlwrite")
|
| 508 |
+
|
| 509 |
+
mapping_kw = (
|
| 510 |
+
"abs", "acos", "acosh", "acot", "acoth", "acsc",
|
| 511 |
+
"acsch", "angle", "arg", "asec", "asech", "asin",
|
| 512 |
+
"asinh", "atan", "atanh", "beta", "betainc",
|
| 513 |
+
"betaln", "bincoeff", "cbrt", "ceil", "conj", "cos",
|
| 514 |
+
"cosh", "cot", "coth", "csc", "csch", "erf", "erfc",
|
| 515 |
+
"erfcx", "erfinv", "exp", "finite", "fix", "floor",
|
| 516 |
+
"fmod", "gamma", "gammainc", "gammaln", "imag",
|
| 517 |
+
"isalnum", "isalpha", "isascii", "iscntrl",
|
| 518 |
+
"isdigit", "isfinite", "isgraph", "isinf",
|
| 519 |
+
"islower", "isna", "isnan", "isprint", "ispunct",
|
| 520 |
+
"isspace", "isupper", "isxdigit", "lcm", "lgamma",
|
| 521 |
+
"log", "lower", "mod", "real", "rem", "round",
|
| 522 |
+
"roundb", "sec", "sech", "sign", "sin", "sinh",
|
| 523 |
+
"sqrt", "tan", "tanh", "toascii", "tolower", "xor")
|
| 524 |
+
|
| 525 |
+
builtin_consts = (
|
| 526 |
+
"EDITOR", "EXEC_PATH", "I", "IMAGE_PATH", "NA",
|
| 527 |
+
"OCTAVE_HOME", "OCTAVE_VERSION", "PAGER",
|
| 528 |
+
"PAGER_FLAGS", "SEEK_CUR", "SEEK_END", "SEEK_SET",
|
| 529 |
+
"SIG", "S_ISBLK", "S_ISCHR", "S_ISDIR", "S_ISFIFO",
|
| 530 |
+
"S_ISLNK", "S_ISREG", "S_ISSOCK", "WCONTINUE",
|
| 531 |
+
"WCOREDUMP", "WEXITSTATUS", "WIFCONTINUED",
|
| 532 |
+
"WIFEXITED", "WIFSIGNALED", "WIFSTOPPED", "WNOHANG",
|
| 533 |
+
"WSTOPSIG", "WTERMSIG", "WUNTRACED")
|
| 534 |
+
|
| 535 |
+
tokens = {
|
| 536 |
+
'root': [
|
| 537 |
+
# We should look into multiline comments
|
| 538 |
+
(r'[%#].*$', Comment),
|
| 539 |
+
(r'^\s*function', Keyword, 'deffunc'),
|
| 540 |
+
|
| 541 |
+
# from 'iskeyword' on hg changeset 8cc154f45e37
|
| 542 |
+
(words((
|
| 543 |
+
'__FILE__', '__LINE__', 'break', 'case', 'catch', 'classdef', 'continue', 'do', 'else',
|
| 544 |
+
'elseif', 'end', 'end_try_catch', 'end_unwind_protect', 'endclassdef',
|
| 545 |
+
'endevents', 'endfor', 'endfunction', 'endif', 'endmethods', 'endproperties',
|
| 546 |
+
'endswitch', 'endwhile', 'events', 'for', 'function', 'get', 'global', 'if', 'methods',
|
| 547 |
+
'otherwise', 'persistent', 'properties', 'return', 'set', 'static', 'switch', 'try',
|
| 548 |
+
'until', 'unwind_protect', 'unwind_protect_cleanup', 'while'), suffix=r'\b'),
|
| 549 |
+
Keyword),
|
| 550 |
+
|
| 551 |
+
(words(builtin_kw + command_kw + function_kw + loadable_kw + mapping_kw,
|
| 552 |
+
suffix=r'\b'), Name.Builtin),
|
| 553 |
+
|
| 554 |
+
(words(builtin_consts, suffix=r'\b'), Name.Constant),
|
| 555 |
+
|
| 556 |
+
# operators in Octave but not Matlab:
|
| 557 |
+
(r'-=|!=|!|/=|--', Operator),
|
| 558 |
+
# operators:
|
| 559 |
+
(r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator),
|
| 560 |
+
# operators in Octave but not Matlab requiring escape for re:
|
| 561 |
+
(r'\*=|\+=|\^=|\/=|\\=|\*\*|\+\+|\.\*\*', Operator),
|
| 562 |
+
# operators requiring escape for re:
|
| 563 |
+
(r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
|
| 564 |
+
|
| 565 |
+
|
| 566 |
+
# punctuation:
|
| 567 |
+
(r'[\[\](){}:@.,]', Punctuation),
|
| 568 |
+
(r'=|:|;', Punctuation),
|
| 569 |
+
|
| 570 |
+
(r'"[^"]*"', String),
|
| 571 |
+
|
| 572 |
+
(r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
|
| 573 |
+
(r'\d+[eEf][+-]?[0-9]+', Number.Float),
|
| 574 |
+
(r'\d+', Number.Integer),
|
| 575 |
+
|
| 576 |
+
# quote can be transpose, instead of string:
|
| 577 |
+
# (not great, but handles common cases...)
|
| 578 |
+
(r'(?<=[\w)\].])\'+', Operator),
|
| 579 |
+
(r'(?<![\w)\].])\'', String, 'string'),
|
| 580 |
+
|
| 581 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 582 |
+
(r'.', Text),
|
| 583 |
+
],
|
| 584 |
+
'string': [
|
| 585 |
+
(r"[^']*'", String, '#pop'),
|
| 586 |
+
],
|
| 587 |
+
'deffunc': [
|
| 588 |
+
(r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',
|
| 589 |
+
bygroups(Whitespace, Text, Whitespace, Punctuation,
|
| 590 |
+
Whitespace, Name.Function, Punctuation, Text,
|
| 591 |
+
Punctuation, Whitespace), '#pop'),
|
| 592 |
+
# function with no args
|
| 593 |
+
(r'(\s*)([a-zA-Z_]\w*)', bygroups(Text, Name.Function), '#pop'),
|
| 594 |
+
],
|
| 595 |
+
}
|
| 596 |
+
|
| 597 |
+
|
| 598 |
+
class ScilabLexer(RegexLexer):
|
| 599 |
+
"""
|
| 600 |
+
For Scilab source code.
|
| 601 |
+
|
| 602 |
+
.. versionadded:: 1.5
|
| 603 |
+
"""
|
| 604 |
+
name = 'Scilab'
|
| 605 |
+
aliases = ['scilab']
|
| 606 |
+
filenames = ['*.sci', '*.sce', '*.tst']
|
| 607 |
+
mimetypes = ['text/scilab']
|
| 608 |
+
|
| 609 |
+
tokens = {
|
| 610 |
+
'root': [
|
| 611 |
+
(r'//.*?$', Comment.Single),
|
| 612 |
+
(r'^\s*function', Keyword, 'deffunc'),
|
| 613 |
+
|
| 614 |
+
(words((
|
| 615 |
+
'__FILE__', '__LINE__', 'break', 'case', 'catch', 'classdef', 'continue', 'do', 'else',
|
| 616 |
+
'elseif', 'end', 'end_try_catch', 'end_unwind_protect', 'endclassdef',
|
| 617 |
+
'endevents', 'endfor', 'endfunction', 'endif', 'endmethods', 'endproperties',
|
| 618 |
+
'endswitch', 'endwhile', 'events', 'for', 'function', 'get', 'global', 'if', 'methods',
|
| 619 |
+
'otherwise', 'persistent', 'properties', 'return', 'set', 'static', 'switch', 'try',
|
| 620 |
+
'until', 'unwind_protect', 'unwind_protect_cleanup', 'while'), suffix=r'\b'),
|
| 621 |
+
Keyword),
|
| 622 |
+
|
| 623 |
+
(words(_scilab_builtins.functions_kw +
|
| 624 |
+
_scilab_builtins.commands_kw +
|
| 625 |
+
_scilab_builtins.macros_kw, suffix=r'\b'), Name.Builtin),
|
| 626 |
+
|
| 627 |
+
(words(_scilab_builtins.variables_kw, suffix=r'\b'), Name.Constant),
|
| 628 |
+
|
| 629 |
+
# operators:
|
| 630 |
+
(r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator),
|
| 631 |
+
# operators requiring escape for re:
|
| 632 |
+
(r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
|
| 633 |
+
|
| 634 |
+
# punctuation:
|
| 635 |
+
(r'[\[\](){}@.,=:;]', Punctuation),
|
| 636 |
+
|
| 637 |
+
(r'"[^"]*"', String),
|
| 638 |
+
|
| 639 |
+
# quote can be transpose, instead of string:
|
| 640 |
+
# (not great, but handles common cases...)
|
| 641 |
+
(r'(?<=[\w)\].])\'+', Operator),
|
| 642 |
+
(r'(?<![\w)\].])\'', String, 'string'),
|
| 643 |
+
|
| 644 |
+
(r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
|
| 645 |
+
(r'\d+[eEf][+-]?[0-9]+', Number.Float),
|
| 646 |
+
(r'\d+', Number.Integer),
|
| 647 |
+
|
| 648 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 649 |
+
(r'.', Text),
|
| 650 |
+
],
|
| 651 |
+
'string': [
|
| 652 |
+
(r"[^']*'", String, '#pop'),
|
| 653 |
+
(r'.', String, '#pop'),
|
| 654 |
+
],
|
| 655 |
+
'deffunc': [
|
| 656 |
+
(r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',
|
| 657 |
+
bygroups(Whitespace, Text, Whitespace, Punctuation,
|
| 658 |
+
Whitespace, Name.Function, Punctuation, Text,
|
| 659 |
+
Punctuation, Whitespace), '#pop'),
|
| 660 |
+
# function with no args
|
| 661 |
+
(r'(\s*)([a-zA-Z_]\w*)', bygroups(Text, Name.Function), '#pop'),
|
| 662 |
+
],
|
| 663 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ml.py
ADDED
|
@@ -0,0 +1,769 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.ml
|
| 4 |
+
~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for ML family languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, include, bygroups, default, words
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Error
|
| 17 |
+
|
| 18 |
+
__all__ = ['SMLLexer', 'OcamlLexer', 'OpaLexer']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class SMLLexer(RegexLexer):
|
| 22 |
+
"""
|
| 23 |
+
For the Standard ML language.
|
| 24 |
+
|
| 25 |
+
.. versionadded:: 1.5
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
name = 'Standard ML'
|
| 29 |
+
aliases = ['sml']
|
| 30 |
+
filenames = ['*.sml', '*.sig', '*.fun']
|
| 31 |
+
mimetypes = ['text/x-standardml', 'application/x-standardml']
|
| 32 |
+
|
| 33 |
+
alphanumid_reserved = set((
|
| 34 |
+
# Core
|
| 35 |
+
'abstype', 'and', 'andalso', 'as', 'case', 'datatype', 'do', 'else',
|
| 36 |
+
'end', 'exception', 'fn', 'fun', 'handle', 'if', 'in', 'infix',
|
| 37 |
+
'infixr', 'let', 'local', 'nonfix', 'of', 'op', 'open', 'orelse',
|
| 38 |
+
'raise', 'rec', 'then', 'type', 'val', 'with', 'withtype', 'while',
|
| 39 |
+
# Modules
|
| 40 |
+
'eqtype', 'functor', 'include', 'sharing', 'sig', 'signature',
|
| 41 |
+
'struct', 'structure', 'where',
|
| 42 |
+
))
|
| 43 |
+
|
| 44 |
+
symbolicid_reserved = set((
|
| 45 |
+
# Core
|
| 46 |
+
':', '\|', '=', '=>', '->', '#',
|
| 47 |
+
# Modules
|
| 48 |
+
':>',
|
| 49 |
+
))
|
| 50 |
+
|
| 51 |
+
nonid_reserved = set(('(', ')', '[', ']', '{', '}', ',', ';', '...', '_'))
|
| 52 |
+
|
| 53 |
+
alphanumid_re = r"[a-zA-Z][\w']*"
|
| 54 |
+
symbolicid_re = r"[!%&$#+\-/:<=>?@\\~`^|*]+"
|
| 55 |
+
|
| 56 |
+
# A character constant is a sequence of the form #s, where s is a string
|
| 57 |
+
# constant denoting a string of size one character. This setup just parses
|
| 58 |
+
# the entire string as either a String.Double or a String.Char (depending
|
| 59 |
+
# on the argument), even if the String.Char is an erronous
|
| 60 |
+
# multiple-character string.
|
| 61 |
+
def stringy(whatkind):
|
| 62 |
+
return [
|
| 63 |
+
(r'[^"\\]', whatkind),
|
| 64 |
+
(r'\\[\\"abtnvfr]', String.Escape),
|
| 65 |
+
# Control-character notation is used for codes < 32,
|
| 66 |
+
# where \^@ == \000
|
| 67 |
+
(r'\\\^[\x40-\x5e]', String.Escape),
|
| 68 |
+
# Docs say 'decimal digits'
|
| 69 |
+
(r'\\[0-9]{3}', String.Escape),
|
| 70 |
+
(r'\\u[0-9a-fA-F]{4}', String.Escape),
|
| 71 |
+
(r'\\\s+\\', String.Interpol),
|
| 72 |
+
(r'"', whatkind, '#pop'),
|
| 73 |
+
]
|
| 74 |
+
|
| 75 |
+
# Callbacks for distinguishing tokens and reserved words
|
| 76 |
+
def long_id_callback(self, match):
|
| 77 |
+
if match.group(1) in self.alphanumid_reserved:
|
| 78 |
+
token = Error
|
| 79 |
+
else:
|
| 80 |
+
token = Name.Namespace
|
| 81 |
+
yield match.start(1), token, match.group(1)
|
| 82 |
+
yield match.start(2), Punctuation, match.group(2)
|
| 83 |
+
|
| 84 |
+
def end_id_callback(self, match):
|
| 85 |
+
if match.group(1) in self.alphanumid_reserved:
|
| 86 |
+
token = Error
|
| 87 |
+
elif match.group(1) in self.symbolicid_reserved:
|
| 88 |
+
token = Error
|
| 89 |
+
else:
|
| 90 |
+
token = Name
|
| 91 |
+
yield match.start(1), token, match.group(1)
|
| 92 |
+
|
| 93 |
+
def id_callback(self, match):
|
| 94 |
+
str = match.group(1)
|
| 95 |
+
if str in self.alphanumid_reserved:
|
| 96 |
+
token = Keyword.Reserved
|
| 97 |
+
elif str in self.symbolicid_reserved:
|
| 98 |
+
token = Punctuation
|
| 99 |
+
else:
|
| 100 |
+
token = Name
|
| 101 |
+
yield match.start(1), token, str
|
| 102 |
+
|
| 103 |
+
tokens = {
|
| 104 |
+
# Whitespace and comments are (almost) everywhere
|
| 105 |
+
'whitespace': [
|
| 106 |
+
(r'\s+', Text),
|
| 107 |
+
(r'\(\*', Comment.Multiline, 'comment'),
|
| 108 |
+
],
|
| 109 |
+
|
| 110 |
+
'delimiters': [
|
| 111 |
+
# This lexer treats these delimiters specially:
|
| 112 |
+
# Delimiters define scopes, and the scope is how the meaning of
|
| 113 |
+
# the `|' is resolved - is it a case/handle expression, or function
|
| 114 |
+
# definition by cases? (This is not how the Definition works, but
|
| 115 |
+
# it's how MLton behaves, see http://mlton.org/SMLNJDeviations)
|
| 116 |
+
(r'\(|\[|\{', Punctuation, 'main'),
|
| 117 |
+
(r'\)|\]|\}', Punctuation, '#pop'),
|
| 118 |
+
(r'\b(let|if|local)\b(?!\')', Keyword.Reserved, ('main', 'main')),
|
| 119 |
+
(r'\b(struct|sig|while)\b(?!\')', Keyword.Reserved, 'main'),
|
| 120 |
+
(r'\b(do|else|end|in|then)\b(?!\')', Keyword.Reserved, '#pop'),
|
| 121 |
+
],
|
| 122 |
+
|
| 123 |
+
'core': [
|
| 124 |
+
# Punctuation that doesn't overlap symbolic identifiers
|
| 125 |
+
(r'(%s)' % '|'.join(re.escape(z) for z in nonid_reserved),
|
| 126 |
+
Punctuation),
|
| 127 |
+
|
| 128 |
+
# Special constants: strings, floats, numbers in decimal and hex
|
| 129 |
+
(r'#"', String.Char, 'char'),
|
| 130 |
+
(r'"', String.Double, 'string'),
|
| 131 |
+
(r'~?0x[0-9a-fA-F]+', Number.Hex),
|
| 132 |
+
(r'0wx[0-9a-fA-F]+', Number.Hex),
|
| 133 |
+
(r'0w\d+', Number.Integer),
|
| 134 |
+
(r'~?\d+\.\d+[eE]~?\d+', Number.Float),
|
| 135 |
+
(r'~?\d+\.\d+', Number.Float),
|
| 136 |
+
(r'~?\d+[eE]~?\d+', Number.Float),
|
| 137 |
+
(r'~?\d+', Number.Integer),
|
| 138 |
+
|
| 139 |
+
# Labels
|
| 140 |
+
(r'#\s*[1-9][0-9]*', Name.Label),
|
| 141 |
+
(r'#\s*(%s)' % alphanumid_re, Name.Label),
|
| 142 |
+
(r'#\s+(%s)' % symbolicid_re, Name.Label),
|
| 143 |
+
# Some reserved words trigger a special, local lexer state change
|
| 144 |
+
(r'\b(datatype|abstype)\b(?!\')', Keyword.Reserved, 'dname'),
|
| 145 |
+
(r'(?=\b(exception)\b(?!\'))', Text, ('ename')),
|
| 146 |
+
(r'\b(functor|include|open|signature|structure)\b(?!\')',
|
| 147 |
+
Keyword.Reserved, 'sname'),
|
| 148 |
+
(r'\b(type|eqtype)\b(?!\')', Keyword.Reserved, 'tname'),
|
| 149 |
+
|
| 150 |
+
# Regular identifiers, long and otherwise
|
| 151 |
+
(r'\'[\w\']*', Name.Decorator),
|
| 152 |
+
(r'(%s)(\.)' % alphanumid_re, long_id_callback, "dotted"),
|
| 153 |
+
(r'(%s)' % alphanumid_re, id_callback),
|
| 154 |
+
(r'(%s)' % symbolicid_re, id_callback),
|
| 155 |
+
],
|
| 156 |
+
'dotted': [
|
| 157 |
+
(r'(%s)(\.)' % alphanumid_re, long_id_callback),
|
| 158 |
+
(r'(%s)' % alphanumid_re, end_id_callback, "#pop"),
|
| 159 |
+
(r'(%s)' % symbolicid_re, end_id_callback, "#pop"),
|
| 160 |
+
(r'\s+', Error),
|
| 161 |
+
(r'\S+', Error),
|
| 162 |
+
],
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
# Main parser (prevents errors in files that have scoping errors)
|
| 166 |
+
'root': [
|
| 167 |
+
default('main')
|
| 168 |
+
],
|
| 169 |
+
|
| 170 |
+
# In this scope, I expect '|' to not be followed by a function name,
|
| 171 |
+
# and I expect 'and' to be followed by a binding site
|
| 172 |
+
'main': [
|
| 173 |
+
include('whitespace'),
|
| 174 |
+
|
| 175 |
+
# Special behavior of val/and/fun
|
| 176 |
+
(r'\b(val|and)\b(?!\')', Keyword.Reserved, 'vname'),
|
| 177 |
+
(r'\b(fun)\b(?!\')', Keyword.Reserved,
|
| 178 |
+
('#pop', 'main-fun', 'fname')),
|
| 179 |
+
|
| 180 |
+
include('delimiters'),
|
| 181 |
+
include('core'),
|
| 182 |
+
(r'\S+', Error),
|
| 183 |
+
],
|
| 184 |
+
|
| 185 |
+
# In this scope, I expect '|' and 'and' to be followed by a function
|
| 186 |
+
'main-fun': [
|
| 187 |
+
include('whitespace'),
|
| 188 |
+
|
| 189 |
+
(r'\s', Text),
|
| 190 |
+
(r'\(\*', Comment.Multiline, 'comment'),
|
| 191 |
+
|
| 192 |
+
# Special behavior of val/and/fun
|
| 193 |
+
(r'\b(fun|and)\b(?!\')', Keyword.Reserved, 'fname'),
|
| 194 |
+
(r'\b(val)\b(?!\')', Keyword.Reserved,
|
| 195 |
+
('#pop', 'main', 'vname')),
|
| 196 |
+
|
| 197 |
+
# Special behavior of '|' and '|'-manipulating keywords
|
| 198 |
+
(r'\|', Punctuation, 'fname'),
|
| 199 |
+
(r'\b(case|handle)\b(?!\')', Keyword.Reserved,
|
| 200 |
+
('#pop', 'main')),
|
| 201 |
+
|
| 202 |
+
include('delimiters'),
|
| 203 |
+
include('core'),
|
| 204 |
+
(r'\S+', Error),
|
| 205 |
+
],
|
| 206 |
+
|
| 207 |
+
# Character and string parsers
|
| 208 |
+
'char': stringy(String.Char),
|
| 209 |
+
'string': stringy(String.Double),
|
| 210 |
+
|
| 211 |
+
'breakout': [
|
| 212 |
+
(r'(?=\b(%s)\b(?!\'))' % '|'.join(alphanumid_reserved), Text, '#pop'),
|
| 213 |
+
],
|
| 214 |
+
|
| 215 |
+
# Dealing with what comes after module system keywords
|
| 216 |
+
'sname': [
|
| 217 |
+
include('whitespace'),
|
| 218 |
+
include('breakout'),
|
| 219 |
+
|
| 220 |
+
(r'(%s)' % alphanumid_re, Name.Namespace),
|
| 221 |
+
default('#pop'),
|
| 222 |
+
],
|
| 223 |
+
|
| 224 |
+
# Dealing with what comes after the 'fun' (or 'and' or '|') keyword
|
| 225 |
+
'fname': [
|
| 226 |
+
include('whitespace'),
|
| 227 |
+
(r'\'[\w\']*', Name.Decorator),
|
| 228 |
+
(r'\(', Punctuation, 'tyvarseq'),
|
| 229 |
+
|
| 230 |
+
(r'(%s)' % alphanumid_re, Name.Function, '#pop'),
|
| 231 |
+
(r'(%s)' % symbolicid_re, Name.Function, '#pop'),
|
| 232 |
+
|
| 233 |
+
# Ignore interesting function declarations like "fun (x + y) = ..."
|
| 234 |
+
default('#pop'),
|
| 235 |
+
],
|
| 236 |
+
|
| 237 |
+
# Dealing with what comes after the 'val' (or 'and') keyword
|
| 238 |
+
'vname': [
|
| 239 |
+
include('whitespace'),
|
| 240 |
+
(r'\'[\w\']*', Name.Decorator),
|
| 241 |
+
(r'\(', Punctuation, 'tyvarseq'),
|
| 242 |
+
|
| 243 |
+
(r'(%s)(\s*)(=(?!%s))' % (alphanumid_re, symbolicid_re),
|
| 244 |
+
bygroups(Name.Variable, Text, Punctuation), '#pop'),
|
| 245 |
+
(r'(%s)(\s*)(=(?!%s))' % (symbolicid_re, symbolicid_re),
|
| 246 |
+
bygroups(Name.Variable, Text, Punctuation), '#pop'),
|
| 247 |
+
(r'(%s)' % alphanumid_re, Name.Variable, '#pop'),
|
| 248 |
+
(r'(%s)' % symbolicid_re, Name.Variable, '#pop'),
|
| 249 |
+
|
| 250 |
+
# Ignore interesting patterns like 'val (x, y)'
|
| 251 |
+
default('#pop'),
|
| 252 |
+
],
|
| 253 |
+
|
| 254 |
+
# Dealing with what comes after the 'type' (or 'and') keyword
|
| 255 |
+
'tname': [
|
| 256 |
+
include('whitespace'),
|
| 257 |
+
include('breakout'),
|
| 258 |
+
|
| 259 |
+
(r'\'[\w\']*', Name.Decorator),
|
| 260 |
+
(r'\(', Punctuation, 'tyvarseq'),
|
| 261 |
+
(r'=(?!%s)' % symbolicid_re, Punctuation, ('#pop', 'typbind')),
|
| 262 |
+
|
| 263 |
+
(r'(%s)' % alphanumid_re, Keyword.Type),
|
| 264 |
+
(r'(%s)' % symbolicid_re, Keyword.Type),
|
| 265 |
+
(r'\S+', Error, '#pop'),
|
| 266 |
+
],
|
| 267 |
+
|
| 268 |
+
# A type binding includes most identifiers
|
| 269 |
+
'typbind': [
|
| 270 |
+
include('whitespace'),
|
| 271 |
+
|
| 272 |
+
(r'\b(and)\b(?!\')', Keyword.Reserved, ('#pop', 'tname')),
|
| 273 |
+
|
| 274 |
+
include('breakout'),
|
| 275 |
+
include('core'),
|
| 276 |
+
(r'\S+', Error, '#pop'),
|
| 277 |
+
],
|
| 278 |
+
|
| 279 |
+
# Dealing with what comes after the 'datatype' (or 'and') keyword
|
| 280 |
+
'dname': [
|
| 281 |
+
include('whitespace'),
|
| 282 |
+
include('breakout'),
|
| 283 |
+
|
| 284 |
+
(r'\'[\w\']*', Name.Decorator),
|
| 285 |
+
(r'\(', Punctuation, 'tyvarseq'),
|
| 286 |
+
(r'(=)(\s*)(datatype)',
|
| 287 |
+
bygroups(Punctuation, Text, Keyword.Reserved), '#pop'),
|
| 288 |
+
(r'=(?!%s)' % symbolicid_re, Punctuation,
|
| 289 |
+
('#pop', 'datbind', 'datcon')),
|
| 290 |
+
|
| 291 |
+
(r'(%s)' % alphanumid_re, Keyword.Type),
|
| 292 |
+
(r'(%s)' % symbolicid_re, Keyword.Type),
|
| 293 |
+
(r'\S+', Error, '#pop'),
|
| 294 |
+
],
|
| 295 |
+
|
| 296 |
+
# common case - A | B | C of int
|
| 297 |
+
'datbind': [
|
| 298 |
+
include('whitespace'),
|
| 299 |
+
|
| 300 |
+
(r'\b(and)\b(?!\')', Keyword.Reserved, ('#pop', 'dname')),
|
| 301 |
+
(r'\b(withtype)\b(?!\')', Keyword.Reserved, ('#pop', 'tname')),
|
| 302 |
+
(r'\b(of)\b(?!\')', Keyword.Reserved),
|
| 303 |
+
|
| 304 |
+
(r'(\|)(\s*)(%s)' % alphanumid_re,
|
| 305 |
+
bygroups(Punctuation, Text, Name.Class)),
|
| 306 |
+
(r'(\|)(\s+)(%s)' % symbolicid_re,
|
| 307 |
+
bygroups(Punctuation, Text, Name.Class)),
|
| 308 |
+
|
| 309 |
+
include('breakout'),
|
| 310 |
+
include('core'),
|
| 311 |
+
(r'\S+', Error),
|
| 312 |
+
],
|
| 313 |
+
|
| 314 |
+
# Dealing with what comes after an exception
|
| 315 |
+
'ename': [
|
| 316 |
+
include('whitespace'),
|
| 317 |
+
|
| 318 |
+
(r'(exception|and)\b(\s+)(%s)' % alphanumid_re,
|
| 319 |
+
bygroups(Keyword.Reserved, Text, Name.Class)),
|
| 320 |
+
(r'(exception|and)\b(\s*)(%s)' % symbolicid_re,
|
| 321 |
+
bygroups(Keyword.Reserved, Text, Name.Class)),
|
| 322 |
+
(r'\b(of)\b(?!\')', Keyword.Reserved),
|
| 323 |
+
|
| 324 |
+
include('breakout'),
|
| 325 |
+
include('core'),
|
| 326 |
+
(r'\S+', Error),
|
| 327 |
+
],
|
| 328 |
+
|
| 329 |
+
'datcon': [
|
| 330 |
+
include('whitespace'),
|
| 331 |
+
(r'(%s)' % alphanumid_re, Name.Class, '#pop'),
|
| 332 |
+
(r'(%s)' % symbolicid_re, Name.Class, '#pop'),
|
| 333 |
+
(r'\S+', Error, '#pop'),
|
| 334 |
+
],
|
| 335 |
+
|
| 336 |
+
# Series of type variables
|
| 337 |
+
'tyvarseq': [
|
| 338 |
+
(r'\s', Text),
|
| 339 |
+
(r'\(\*', Comment.Multiline, 'comment'),
|
| 340 |
+
|
| 341 |
+
(r'\'[\w\']*', Name.Decorator),
|
| 342 |
+
(alphanumid_re, Name),
|
| 343 |
+
(r',', Punctuation),
|
| 344 |
+
(r'\)', Punctuation, '#pop'),
|
| 345 |
+
(symbolicid_re, Name),
|
| 346 |
+
],
|
| 347 |
+
|
| 348 |
+
'comment': [
|
| 349 |
+
(r'[^(*)]', Comment.Multiline),
|
| 350 |
+
(r'\(\*', Comment.Multiline, '#push'),
|
| 351 |
+
(r'\*\)', Comment.Multiline, '#pop'),
|
| 352 |
+
(r'[(*)]', Comment.Multiline),
|
| 353 |
+
],
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
class OcamlLexer(RegexLexer):
|
| 358 |
+
"""
|
| 359 |
+
For the OCaml language.
|
| 360 |
+
|
| 361 |
+
.. versionadded:: 0.7
|
| 362 |
+
"""
|
| 363 |
+
|
| 364 |
+
name = 'OCaml'
|
| 365 |
+
aliases = ['ocaml']
|
| 366 |
+
filenames = ['*.ml', '*.mli', '*.mll', '*.mly']
|
| 367 |
+
mimetypes = ['text/x-ocaml']
|
| 368 |
+
|
| 369 |
+
keywords = (
|
| 370 |
+
'as', 'assert', 'begin', 'class', 'constraint', 'do', 'done',
|
| 371 |
+
'downto', 'else', 'end', 'exception', 'external', 'false',
|
| 372 |
+
'for', 'fun', 'function', 'functor', 'if', 'in', 'include',
|
| 373 |
+
'inherit', 'initializer', 'lazy', 'let', 'match', 'method',
|
| 374 |
+
'module', 'mutable', 'new', 'object', 'of', 'open', 'private',
|
| 375 |
+
'raise', 'rec', 'sig', 'struct', 'then', 'to', 'true', 'try',
|
| 376 |
+
'type', 'value', 'val', 'virtual', 'when', 'while', 'with',
|
| 377 |
+
)
|
| 378 |
+
keyopts = (
|
| 379 |
+
'!=', '#', '&', '&&', r'\(', r'\)', r'\*', r'\+', ',', '-',
|
| 380 |
+
r'-\.', '->', r'\.', r'\.\.', ':', '::', ':=', ':>', ';', ';;', '<',
|
| 381 |
+
'<-', '=', '>', '>]', r'>\}', r'\?', r'\?\?', r'\[', r'\[<', r'\[>',
|
| 382 |
+
r'\[\|', ']', '_', '`', r'\{', r'\{<', r'\|', r'\|]', r'\}', '~'
|
| 383 |
+
)
|
| 384 |
+
|
| 385 |
+
operators = r'[!$%&*+\./:<=>?@^|~-]'
|
| 386 |
+
word_operators = ('and', 'asr', 'land', 'lor', 'lsl', 'lxor', 'mod', 'or')
|
| 387 |
+
prefix_syms = r'[!?~]'
|
| 388 |
+
infix_syms = r'[=<>@^|&+\*/$%-]'
|
| 389 |
+
primitives = ('unit', 'int', 'float', 'bool', 'string', 'char', 'list', 'array')
|
| 390 |
+
|
| 391 |
+
tokens = {
|
| 392 |
+
'escape-sequence': [
|
| 393 |
+
(r'\\[\\"\'ntbr]', String.Escape),
|
| 394 |
+
(r'\\[0-9]{3}', String.Escape),
|
| 395 |
+
(r'\\x[0-9a-fA-F]{2}', String.Escape),
|
| 396 |
+
],
|
| 397 |
+
'root': [
|
| 398 |
+
(r'\s+', Text),
|
| 399 |
+
(r'false|true|\(\)|\[\]', Name.Builtin.Pseudo),
|
| 400 |
+
(r'\b([A-Z][\w\']*)(?=\s*\.)', Name.Namespace, 'dotted'),
|
| 401 |
+
(r'\b([A-Z][\w\']*)', Name.Class),
|
| 402 |
+
(r'\(\*(?![)])', Comment, 'comment'),
|
| 403 |
+
(r'\b(%s)\b' % '|'.join(keywords), Keyword),
|
| 404 |
+
(r'(%s)' % '|'.join(keyopts[::-1]), Operator),
|
| 405 |
+
(r'(%s|%s)?%s' % (infix_syms, prefix_syms, operators), Operator),
|
| 406 |
+
(r'\b(%s)\b' % '|'.join(word_operators), Operator.Word),
|
| 407 |
+
(r'\b(%s)\b' % '|'.join(primitives), Keyword.Type),
|
| 408 |
+
|
| 409 |
+
(r"[^\W\d][\w']*", Name),
|
| 410 |
+
|
| 411 |
+
(r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float),
|
| 412 |
+
(r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
|
| 413 |
+
(r'0[oO][0-7][0-7_]*', Number.Oct),
|
| 414 |
+
(r'0[bB][01][01_]*', Number.Bin),
|
| 415 |
+
(r'\d[\d_]*', Number.Integer),
|
| 416 |
+
|
| 417 |
+
(r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'",
|
| 418 |
+
String.Char),
|
| 419 |
+
(r"'.'", String.Char),
|
| 420 |
+
(r"'", Keyword), # a stray quote is another syntax element
|
| 421 |
+
|
| 422 |
+
(r'"', String.Double, 'string'),
|
| 423 |
+
|
| 424 |
+
(r'[~?][a-z][\w\']*:', Name.Variable),
|
| 425 |
+
],
|
| 426 |
+
'comment': [
|
| 427 |
+
(r'[^(*)]+', Comment),
|
| 428 |
+
(r'\(\*', Comment, '#push'),
|
| 429 |
+
(r'\*\)', Comment, '#pop'),
|
| 430 |
+
(r'[(*)]', Comment),
|
| 431 |
+
],
|
| 432 |
+
'string': [
|
| 433 |
+
(r'[^\\"]+', String.Double),
|
| 434 |
+
include('escape-sequence'),
|
| 435 |
+
(r'\\\n', String.Double),
|
| 436 |
+
(r'"', String.Double, '#pop'),
|
| 437 |
+
],
|
| 438 |
+
'dotted': [
|
| 439 |
+
(r'\s+', Text),
|
| 440 |
+
(r'\.', Punctuation),
|
| 441 |
+
(r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
|
| 442 |
+
(r'[A-Z][\w\']*', Name.Class, '#pop'),
|
| 443 |
+
(r'[a-z_][\w\']*', Name, '#pop'),
|
| 444 |
+
default('#pop'),
|
| 445 |
+
],
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
|
| 449 |
+
class OpaLexer(RegexLexer):
|
| 450 |
+
"""
|
| 451 |
+
Lexer for the Opa language (http://opalang.org).
|
| 452 |
+
|
| 453 |
+
.. versionadded:: 1.5
|
| 454 |
+
"""
|
| 455 |
+
|
| 456 |
+
name = 'Opa'
|
| 457 |
+
aliases = ['opa']
|
| 458 |
+
filenames = ['*.opa']
|
| 459 |
+
mimetypes = ['text/x-opa']
|
| 460 |
+
|
| 461 |
+
# most of these aren't strictly keywords
|
| 462 |
+
# but if you color only real keywords, you might just
|
| 463 |
+
# as well not color anything
|
| 464 |
+
keywords = (
|
| 465 |
+
'and', 'as', 'begin', 'case', 'client', 'css', 'database', 'db', 'do',
|
| 466 |
+
'else', 'end', 'external', 'forall', 'function', 'if', 'import',
|
| 467 |
+
'match', 'module', 'or', 'package', 'parser', 'rec', 'server', 'then',
|
| 468 |
+
'type', 'val', 'with', 'xml_parser',
|
| 469 |
+
)
|
| 470 |
+
|
| 471 |
+
# matches both stuff and `stuff`
|
| 472 |
+
ident_re = r'(([a-zA-Z_]\w*)|(`[^`]*`))'
|
| 473 |
+
|
| 474 |
+
op_re = r'[.=\-<>,@~%/+?*&^!]'
|
| 475 |
+
punc_re = r'[()\[\],;|]' # '{' and '}' are treated elsewhere
|
| 476 |
+
# because they are also used for inserts
|
| 477 |
+
|
| 478 |
+
tokens = {
|
| 479 |
+
# copied from the caml lexer, should be adapted
|
| 480 |
+
'escape-sequence': [
|
| 481 |
+
(r'\\[\\"\'ntr}]', String.Escape),
|
| 482 |
+
(r'\\[0-9]{3}', String.Escape),
|
| 483 |
+
(r'\\x[0-9a-fA-F]{2}', String.Escape),
|
| 484 |
+
],
|
| 485 |
+
|
| 486 |
+
# factorizing these rules, because they are inserted many times
|
| 487 |
+
'comments': [
|
| 488 |
+
(r'/\*', Comment, 'nested-comment'),
|
| 489 |
+
(r'//.*?$', Comment),
|
| 490 |
+
],
|
| 491 |
+
'comments-and-spaces': [
|
| 492 |
+
include('comments'),
|
| 493 |
+
(r'\s+', Text),
|
| 494 |
+
],
|
| 495 |
+
|
| 496 |
+
'root': [
|
| 497 |
+
include('comments-and-spaces'),
|
| 498 |
+
# keywords
|
| 499 |
+
(words(keywords, prefix=r'\b', suffix=r'\b'), Keyword),
|
| 500 |
+
# directives
|
| 501 |
+
# we could parse the actual set of directives instead of anything
|
| 502 |
+
# starting with @, but this is troublesome
|
| 503 |
+
# because it needs to be adjusted all the time
|
| 504 |
+
# and assuming we parse only sources that compile, it is useless
|
| 505 |
+
(r'@' + ident_re + r'\b', Name.Builtin.Pseudo),
|
| 506 |
+
|
| 507 |
+
# number literals
|
| 508 |
+
(r'-?.[\d]+([eE][+\-]?\d+)', Number.Float),
|
| 509 |
+
(r'-?\d+.\d*([eE][+\-]?\d+)', Number.Float),
|
| 510 |
+
(r'-?\d+[eE][+\-]?\d+', Number.Float),
|
| 511 |
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
| 512 |
+
(r'0[oO][0-7]+', Number.Oct),
|
| 513 |
+
(r'0[bB][01]+', Number.Bin),
|
| 514 |
+
(r'\d+', Number.Integer),
|
| 515 |
+
# color literals
|
| 516 |
+
(r'#[\da-fA-F]{3,6}', Number.Integer),
|
| 517 |
+
|
| 518 |
+
# string literals
|
| 519 |
+
(r'"', String.Double, 'string'),
|
| 520 |
+
# char literal, should be checked because this is the regexp from
|
| 521 |
+
# the caml lexer
|
| 522 |
+
(r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2})|.)'",
|
| 523 |
+
String.Char),
|
| 524 |
+
|
| 525 |
+
# this is meant to deal with embedded exprs in strings
|
| 526 |
+
# every time we find a '}' we pop a state so that if we were
|
| 527 |
+
# inside a string, we are back in the string state
|
| 528 |
+
# as a consequence, we must also push a state every time we find a
|
| 529 |
+
# '{' or else we will have errors when parsing {} for instance
|
| 530 |
+
(r'\{', Operator, '#push'),
|
| 531 |
+
(r'\}', Operator, '#pop'),
|
| 532 |
+
|
| 533 |
+
# html literals
|
| 534 |
+
# this is a much more strict that the actual parser,
|
| 535 |
+
# since a<b would not be parsed as html
|
| 536 |
+
# but then again, the parser is way too lax, and we can't hope
|
| 537 |
+
# to have something as tolerant
|
| 538 |
+
(r'<(?=[a-zA-Z>])', String.Single, 'html-open-tag'),
|
| 539 |
+
|
| 540 |
+
# db path
|
| 541 |
+
# matching the '[_]' in '/a[_]' because it is a part
|
| 542 |
+
# of the syntax of the db path definition
|
| 543 |
+
# unfortunately, i don't know how to match the ']' in
|
| 544 |
+
# /a[1], so this is somewhat inconsistent
|
| 545 |
+
(r'[@?!]?(/\w+)+(\[_\])?', Name.Variable),
|
| 546 |
+
# putting the same color on <- as on db path, since
|
| 547 |
+
# it can be used only to mean Db.write
|
| 548 |
+
(r'<-(?!'+op_re+r')', Name.Variable),
|
| 549 |
+
|
| 550 |
+
# 'modules'
|
| 551 |
+
# although modules are not distinguished by their names as in caml
|
| 552 |
+
# the standard library seems to follow the convention that modules
|
| 553 |
+
# only area capitalized
|
| 554 |
+
(r'\b([A-Z]\w*)(?=\.)', Name.Namespace),
|
| 555 |
+
|
| 556 |
+
# operators
|
| 557 |
+
# = has a special role because this is the only
|
| 558 |
+
# way to syntactic distinguish binding constructions
|
| 559 |
+
# unfortunately, this colors the equal in {x=2} too
|
| 560 |
+
(r'=(?!'+op_re+r')', Keyword),
|
| 561 |
+
(r'(%s)+' % op_re, Operator),
|
| 562 |
+
(r'(%s)+' % punc_re, Operator),
|
| 563 |
+
|
| 564 |
+
# coercions
|
| 565 |
+
(r':', Operator, 'type'),
|
| 566 |
+
# type variables
|
| 567 |
+
# we need this rule because we don't parse specially type
|
| 568 |
+
# definitions so in "type t('a) = ...", "'a" is parsed by 'root'
|
| 569 |
+
("'"+ident_re, Keyword.Type),
|
| 570 |
+
|
| 571 |
+
# id literal, #something, or #{expr}
|
| 572 |
+
(r'#'+ident_re, String.Single),
|
| 573 |
+
(r'#(?=\{)', String.Single),
|
| 574 |
+
|
| 575 |
+
# identifiers
|
| 576 |
+
# this avoids to color '2' in 'a2' as an integer
|
| 577 |
+
(ident_re, Text),
|
| 578 |
+
|
| 579 |
+
# default, not sure if that is needed or not
|
| 580 |
+
# (r'.', Text),
|
| 581 |
+
],
|
| 582 |
+
|
| 583 |
+
# it is quite painful to have to parse types to know where they end
|
| 584 |
+
# this is the general rule for a type
|
| 585 |
+
# a type is either:
|
| 586 |
+
# * -> ty
|
| 587 |
+
# * type-with-slash
|
| 588 |
+
# * type-with-slash -> ty
|
| 589 |
+
# * type-with-slash (, type-with-slash)+ -> ty
|
| 590 |
+
#
|
| 591 |
+
# the code is pretty funky in here, but this code would roughly
|
| 592 |
+
# translate in caml to:
|
| 593 |
+
# let rec type stream =
|
| 594 |
+
# match stream with
|
| 595 |
+
# | [< "->"; stream >] -> type stream
|
| 596 |
+
# | [< ""; stream >] ->
|
| 597 |
+
# type_with_slash stream
|
| 598 |
+
# type_lhs_1 stream;
|
| 599 |
+
# and type_1 stream = ...
|
| 600 |
+
'type': [
|
| 601 |
+
include('comments-and-spaces'),
|
| 602 |
+
(r'->', Keyword.Type),
|
| 603 |
+
default(('#pop', 'type-lhs-1', 'type-with-slash')),
|
| 604 |
+
],
|
| 605 |
+
|
| 606 |
+
# parses all the atomic or closed constructions in the syntax of type
|
| 607 |
+
# expressions: record types, tuple types, type constructors, basic type
|
| 608 |
+
# and type variables
|
| 609 |
+
'type-1': [
|
| 610 |
+
include('comments-and-spaces'),
|
| 611 |
+
(r'\(', Keyword.Type, ('#pop', 'type-tuple')),
|
| 612 |
+
(r'~?\{', Keyword.Type, ('#pop', 'type-record')),
|
| 613 |
+
(ident_re+r'\(', Keyword.Type, ('#pop', 'type-tuple')),
|
| 614 |
+
(ident_re, Keyword.Type, '#pop'),
|
| 615 |
+
("'"+ident_re, Keyword.Type),
|
| 616 |
+
# this case is not in the syntax but sometimes
|
| 617 |
+
# we think we are parsing types when in fact we are parsing
|
| 618 |
+
# some css, so we just pop the states until we get back into
|
| 619 |
+
# the root state
|
| 620 |
+
default('#pop'),
|
| 621 |
+
],
|
| 622 |
+
|
| 623 |
+
# type-with-slash is either:
|
| 624 |
+
# * type-1
|
| 625 |
+
# * type-1 (/ type-1)+
|
| 626 |
+
'type-with-slash': [
|
| 627 |
+
include('comments-and-spaces'),
|
| 628 |
+
default(('#pop', 'slash-type-1', 'type-1')),
|
| 629 |
+
],
|
| 630 |
+
'slash-type-1': [
|
| 631 |
+
include('comments-and-spaces'),
|
| 632 |
+
('/', Keyword.Type, ('#pop', 'type-1')),
|
| 633 |
+
# same remark as above
|
| 634 |
+
default('#pop'),
|
| 635 |
+
],
|
| 636 |
+
|
| 637 |
+
# we go in this state after having parsed a type-with-slash
|
| 638 |
+
# while trying to parse a type
|
| 639 |
+
# and at this point we must determine if we are parsing an arrow
|
| 640 |
+
# type (in which case we must continue parsing) or not (in which
|
| 641 |
+
# case we stop)
|
| 642 |
+
'type-lhs-1': [
|
| 643 |
+
include('comments-and-spaces'),
|
| 644 |
+
(r'->', Keyword.Type, ('#pop', 'type')),
|
| 645 |
+
(r'(?=,)', Keyword.Type, ('#pop', 'type-arrow')),
|
| 646 |
+
default('#pop'),
|
| 647 |
+
],
|
| 648 |
+
'type-arrow': [
|
| 649 |
+
include('comments-and-spaces'),
|
| 650 |
+
# the look ahead here allows to parse f(x : int, y : float -> truc)
|
| 651 |
+
# correctly
|
| 652 |
+
(r',(?=[^:]*?->)', Keyword.Type, 'type-with-slash'),
|
| 653 |
+
(r'->', Keyword.Type, ('#pop', 'type')),
|
| 654 |
+
# same remark as above
|
| 655 |
+
default('#pop'),
|
| 656 |
+
],
|
| 657 |
+
|
| 658 |
+
# no need to do precise parsing for tuples and records
|
| 659 |
+
# because they are closed constructions, so we can simply
|
| 660 |
+
# find the closing delimiter
|
| 661 |
+
# note that this function would be not work if the source
|
| 662 |
+
# contained identifiers like `{)` (although it could be patched
|
| 663 |
+
# to support it)
|
| 664 |
+
'type-tuple': [
|
| 665 |
+
include('comments-and-spaces'),
|
| 666 |
+
(r'[^()/*]+', Keyword.Type),
|
| 667 |
+
(r'[/*]', Keyword.Type),
|
| 668 |
+
(r'\(', Keyword.Type, '#push'),
|
| 669 |
+
(r'\)', Keyword.Type, '#pop'),
|
| 670 |
+
],
|
| 671 |
+
'type-record': [
|
| 672 |
+
include('comments-and-spaces'),
|
| 673 |
+
(r'[^{}/*]+', Keyword.Type),
|
| 674 |
+
(r'[/*]', Keyword.Type),
|
| 675 |
+
(r'\{', Keyword.Type, '#push'),
|
| 676 |
+
(r'\}', Keyword.Type, '#pop'),
|
| 677 |
+
],
|
| 678 |
+
|
| 679 |
+
# 'type-tuple': [
|
| 680 |
+
# include('comments-and-spaces'),
|
| 681 |
+
# (r'\)', Keyword.Type, '#pop'),
|
| 682 |
+
# default(('#pop', 'type-tuple-1', 'type-1')),
|
| 683 |
+
# ],
|
| 684 |
+
# 'type-tuple-1': [
|
| 685 |
+
# include('comments-and-spaces'),
|
| 686 |
+
# (r',?\s*\)', Keyword.Type, '#pop'), # ,) is a valid end of tuple, in (1,)
|
| 687 |
+
# (r',', Keyword.Type, 'type-1'),
|
| 688 |
+
# ],
|
| 689 |
+
# 'type-record':[
|
| 690 |
+
# include('comments-and-spaces'),
|
| 691 |
+
# (r'\}', Keyword.Type, '#pop'),
|
| 692 |
+
# (r'~?(?:\w+|`[^`]*`)', Keyword.Type, 'type-record-field-expr'),
|
| 693 |
+
# ],
|
| 694 |
+
# 'type-record-field-expr': [
|
| 695 |
+
#
|
| 696 |
+
# ],
|
| 697 |
+
|
| 698 |
+
'nested-comment': [
|
| 699 |
+
(r'[^/*]+', Comment),
|
| 700 |
+
(r'/\*', Comment, '#push'),
|
| 701 |
+
(r'\*/', Comment, '#pop'),
|
| 702 |
+
(r'[/*]', Comment),
|
| 703 |
+
],
|
| 704 |
+
|
| 705 |
+
# the copy pasting between string and single-string
|
| 706 |
+
# is kinda sad. Is there a way to avoid that??
|
| 707 |
+
'string': [
|
| 708 |
+
(r'[^\\"{]+', String.Double),
|
| 709 |
+
(r'"', String.Double, '#pop'),
|
| 710 |
+
(r'\{', Operator, 'root'),
|
| 711 |
+
include('escape-sequence'),
|
| 712 |
+
],
|
| 713 |
+
'single-string': [
|
| 714 |
+
(r'[^\\\'{]+', String.Double),
|
| 715 |
+
(r'\'', String.Double, '#pop'),
|
| 716 |
+
(r'\{', Operator, 'root'),
|
| 717 |
+
include('escape-sequence'),
|
| 718 |
+
],
|
| 719 |
+
|
| 720 |
+
# all the html stuff
|
| 721 |
+
# can't really reuse some existing html parser
|
| 722 |
+
# because we must be able to parse embedded expressions
|
| 723 |
+
|
| 724 |
+
# we are in this state after someone parsed the '<' that
|
| 725 |
+
# started the html literal
|
| 726 |
+
'html-open-tag': [
|
| 727 |
+
(r'[\w\-:]+', String.Single, ('#pop', 'html-attr')),
|
| 728 |
+
(r'>', String.Single, ('#pop', 'html-content')),
|
| 729 |
+
],
|
| 730 |
+
|
| 731 |
+
# we are in this state after someone parsed the '</' that
|
| 732 |
+
# started the end of the closing tag
|
| 733 |
+
'html-end-tag': [
|
| 734 |
+
# this is a star, because </> is allowed
|
| 735 |
+
(r'[\w\-:]*>', String.Single, '#pop'),
|
| 736 |
+
],
|
| 737 |
+
|
| 738 |
+
# we are in this state after having parsed '<ident(:ident)?'
|
| 739 |
+
# we thus parse a possibly empty list of attributes
|
| 740 |
+
'html-attr': [
|
| 741 |
+
(r'\s+', Text),
|
| 742 |
+
(r'[\w\-:]+=', String.Single, 'html-attr-value'),
|
| 743 |
+
(r'/>', String.Single, '#pop'),
|
| 744 |
+
(r'>', String.Single, ('#pop', 'html-content')),
|
| 745 |
+
],
|
| 746 |
+
|
| 747 |
+
'html-attr-value': [
|
| 748 |
+
(r"'", String.Single, ('#pop', 'single-string')),
|
| 749 |
+
(r'"', String.Single, ('#pop', 'string')),
|
| 750 |
+
(r'#'+ident_re, String.Single, '#pop'),
|
| 751 |
+
(r'#(?=\{)', String.Single, ('#pop', 'root')),
|
| 752 |
+
(r'[^"\'{`=<>]+', String.Single, '#pop'),
|
| 753 |
+
(r'\{', Operator, ('#pop', 'root')), # this is a tail call!
|
| 754 |
+
],
|
| 755 |
+
|
| 756 |
+
# we should probably deal with '\' escapes here
|
| 757 |
+
'html-content': [
|
| 758 |
+
(r'<!--', Comment, 'html-comment'),
|
| 759 |
+
(r'</', String.Single, ('#pop', 'html-end-tag')),
|
| 760 |
+
(r'<', String.Single, 'html-open-tag'),
|
| 761 |
+
(r'\{', Operator, 'root'),
|
| 762 |
+
(r'[^<{]+', String.Single),
|
| 763 |
+
],
|
| 764 |
+
|
| 765 |
+
'html-comment': [
|
| 766 |
+
(r'-->', Comment, '#pop'),
|
| 767 |
+
(r'[^\-]+|-', Comment),
|
| 768 |
+
],
|
| 769 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/modeling.py
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
pygments.lexers.modeling
|
| 4 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 5 |
+
|
| 6 |
+
Lexers for modeling languages.
|
| 7 |
+
|
| 8 |
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
| 9 |
+
:license: BSD, see LICENSE for details.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
|
| 14 |
+
from pygments.lexer import RegexLexer, include, bygroups, using, default
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation
|
| 17 |
+
|
| 18 |
+
from pygments.lexers.html import HtmlLexer
|
| 19 |
+
from pygments.lexers import _stan_builtins
|
| 20 |
+
|
| 21 |
+
__all__ = ['ModelicaLexer', 'BugsLexer', 'JagsLexer', 'StanLexer']
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class ModelicaLexer(RegexLexer):
|
| 25 |
+
"""
|
| 26 |
+
For `Modelica <http://www.modelica.org/>`_ source code.
|
| 27 |
+
|
| 28 |
+
.. versionadded:: 1.1
|
| 29 |
+
"""
|
| 30 |
+
name = 'Modelica'
|
| 31 |
+
aliases = ['modelica']
|
| 32 |
+
filenames = ['*.mo']
|
| 33 |
+
mimetypes = ['text/x-modelica']
|
| 34 |
+
|
| 35 |
+
flags = re.DOTALL | re.MULTILINE
|
| 36 |
+
|
| 37 |
+
_name = r"(?:'(?:[^\\']|\\.)+'|[a-zA-Z_]\w*)"
|
| 38 |
+
|
| 39 |
+
tokens = {
|
| 40 |
+
'whitespace': [
|
| 41 |
+
(u'[\\s\ufeff]+', Text),
|
| 42 |
+
(r'//[^\n]*\n?', Comment.Single),
|
| 43 |
+
(r'/\*.*?\*/', Comment.Multiline)
|
| 44 |
+
],
|
| 45 |
+
'root': [
|
| 46 |
+
include('whitespace'),
|
| 47 |
+
(r'"', String.Double, 'string'),
|
| 48 |
+
(r'[()\[\]{},;]+', Punctuation),
|
| 49 |
+
(r'\.?[*^/+-]|\.|<>|[<>:=]=?', Operator),
|
| 50 |
+
(r'\d+(\.?\d*[eE][-+]?\d+|\.\d*)', Number.Float),
|
| 51 |
+
(r'\d+', Number.Integer),
|
| 52 |
+
(r'(abs|acos|actualStream|array|asin|assert|AssertionLevel|atan|'
|
| 53 |
+
r'atan2|backSample|Boolean|cardinality|cat|ceil|change|Clock|'
|
| 54 |
+
r'Connections|cos|cosh|cross|delay|diagonal|div|edge|exp|'
|
| 55 |
+
r'ExternalObject|fill|floor|getInstanceName|hold|homotopy|'
|
| 56 |
+
r'identity|inStream|integer|Integer|interval|inverse|isPresent|'
|
| 57 |
+
r'linspace|log|log10|matrix|max|min|mod|ndims|noClock|noEvent|'
|
| 58 |
+
r'ones|outerProduct|pre|previous|product|Real|reinit|rem|rooted|'
|
| 59 |
+
r'sample|scalar|semiLinear|shiftSample|sign|sin|sinh|size|skew|'
|
| 60 |
+
r'smooth|spatialDistribution|sqrt|StateSelect|String|subSample|'
|
| 61 |
+
r'sum|superSample|symmetric|tan|tanh|terminal|terminate|time|'
|
| 62 |
+
r'transpose|vector|zeros)\b', Name.Builtin),
|
| 63 |
+
(r'(algorithm|annotation|break|connect|constant|constrainedby|der|'
|
| 64 |
+
r'discrete|each|else|elseif|elsewhen|encapsulated|enumeration|'
|
| 65 |
+
r'equation|exit|expandable|extends|external|final|flow|for|if|'
|
| 66 |
+
r'import|impure|in|initial|inner|input|loop|nondiscrete|outer|'
|
| 67 |
+
r'output|parameter|partial|protected|public|pure|redeclare|'
|
| 68 |
+
r'replaceable|return|stream|then|when|while)\b',
|
| 69 |
+
Keyword.Reserved),
|
| 70 |
+
(r'(and|not|or)\b', Operator.Word),
|
| 71 |
+
(r'(block|class|connector|end|function|model|operator|package|'
|
| 72 |
+
r'record|type)\b', Keyword.Reserved, 'class'),
|
| 73 |
+
(r'(false|true)\b', Keyword.Constant),
|
| 74 |
+
(r'within\b', Keyword.Reserved, 'package-prefix'),
|
| 75 |
+
(_name, Name)
|
| 76 |
+
],
|
| 77 |
+
'class': [
|
| 78 |
+
include('whitespace'),
|
| 79 |
+
(r'(function|record)\b', Keyword.Reserved),
|
| 80 |
+
(r'(if|for|when|while)\b', Keyword.Reserved, '#pop'),
|
| 81 |
+
(_name, Name.Class, '#pop'),
|
| 82 |
+
default('#pop')
|
| 83 |
+
],
|
| 84 |
+
'package-prefix': [
|
| 85 |
+
include('whitespace'),
|
| 86 |
+
(_name, Name.Namespace, '#pop'),
|
| 87 |
+
default('#pop')
|
| 88 |
+
],
|
| 89 |
+
'string': [
|
| 90 |
+
(r'"', String.Double, '#pop'),
|
| 91 |
+
(r'\\[\'"?\\abfnrtv]', String.Escape),
|
| 92 |
+
(r'(?i)<\s*html\s*>([^\\"]|\\.)+?(<\s*/\s*html\s*>|(?="))',
|
| 93 |
+
using(HtmlLexer)),
|
| 94 |
+
(r'<|\\?[^"\\<]+', String.Double)
|
| 95 |
+
]
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
class BugsLexer(RegexLexer):
|
| 100 |
+
"""
|
| 101 |
+
Pygments Lexer for `OpenBugs <http://www.openbugs.net/>`_ and WinBugs
|
| 102 |
+
models.
|
| 103 |
+
|
| 104 |
+
.. versionadded:: 1.6
|
| 105 |
+
"""
|
| 106 |
+
|
| 107 |
+
name = 'BUGS'
|
| 108 |
+
aliases = ['bugs', 'winbugs', 'openbugs']
|
| 109 |
+
filenames = ['*.bug']
|
| 110 |
+
|
| 111 |
+
_FUNCTIONS = (
|
| 112 |
+
# Scalar functions
|
| 113 |
+
'abs', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh',
|
| 114 |
+
'cloglog', 'cos', 'cosh', 'cumulative', 'cut', 'density', 'deviance',
|
| 115 |
+
'equals', 'expr', 'gammap', 'ilogit', 'icloglog', 'integral', 'log',
|
| 116 |
+
'logfact', 'loggam', 'logit', 'max', 'min', 'phi', 'post.p.value',
|
| 117 |
+
'pow', 'prior.p.value', 'probit', 'replicate.post', 'replicate.prior',
|
| 118 |
+
'round', 'sin', 'sinh', 'solution', 'sqrt', 'step', 'tan', 'tanh',
|
| 119 |
+
'trunc',
|
| 120 |
+
# Vector functions
|
| 121 |
+
'inprod', 'interp.lin', 'inverse', 'logdet', 'mean', 'eigen.vals',
|
| 122 |
+
'ode', 'prod', 'p.valueM', 'rank', 'ranked', 'replicate.postM',
|
| 123 |
+
'sd', 'sort', 'sum',
|
| 124 |
+
# Special
|
| 125 |
+
'D', 'I', 'F', 'T', 'C')
|
| 126 |
+
""" OpenBUGS built-in functions
|
| 127 |
+
|
| 128 |
+
From http://www.openbugs.info/Manuals/ModelSpecification.html#ContentsAII
|
| 129 |
+
|
| 130 |
+
This also includes
|
| 131 |
+
|
| 132 |
+
- T, C, I : Truncation and censoring.
|
| 133 |
+
``T`` and ``C`` are in OpenBUGS. ``I`` in WinBUGS.
|
| 134 |
+
- D : ODE
|
| 135 |
+
- F : Functional http://www.openbugs.info/Examples/Functionals.html
|
| 136 |
+
|
| 137 |
+
"""
|
| 138 |
+
|
| 139 |
+
_DISTRIBUTIONS = ('dbern', 'dbin', 'dcat', 'dnegbin', 'dpois',
|
| 140 |
+
'dhyper', 'dbeta', 'dchisqr', 'ddexp', 'dexp',
|
| 141 |
+
'dflat', 'dgamma', 'dgev', 'df', 'dggamma', 'dgpar',
|
| 142 |
+
'dloglik', 'dlnorm', 'dlogis', 'dnorm', 'dpar',
|
| 143 |
+
'dt', 'dunif', 'dweib', 'dmulti', 'ddirch', 'dmnorm',
|
| 144 |
+
'dmt', 'dwish')
|
| 145 |
+
""" OpenBUGS built-in distributions
|
| 146 |
+
|
| 147 |
+
Functions from
|
| 148 |
+
http://www.openbugs.info/Manuals/ModelSpecification.html#ContentsAI
|
| 149 |
+
"""
|
| 150 |
+
|
| 151 |
+
tokens = {
|
| 152 |
+
'whitespace': [
|
| 153 |
+
(r"\s+", Text),
|
| 154 |
+
],
|
| 155 |
+
'comments': [
|
| 156 |
+
# Comments
|
| 157 |
+
(r'#.*$', Comment.Single),
|
| 158 |
+
],
|
| 159 |
+
'root': [
|
| 160 |
+
# Comments
|
| 161 |
+
include('comments'),
|
| 162 |
+
include('whitespace'),
|
| 163 |
+
# Block start
|
| 164 |
+
(r'(model)(\s+)(\{)',
|
| 165 |
+
bygroups(Keyword.Namespace, Text, Punctuation)),
|
| 166 |
+
# Reserved Words
|
| 167 |
+
(r'(for|in)(?![\w.])', Keyword.Reserved),
|
| 168 |
+
# Built-in Functions
|
| 169 |
+
(r'(%s)(?=\s*\()'
|
| 170 |
+
% r'|'.join(_FUNCTIONS + _DISTRIBUTIONS),
|
| 171 |
+
Name.Builtin),
|
| 172 |
+
# Regular variable names
|
| 173 |
+
(r'[A-Za-z][\w.]*', Name),
|
| 174 |
+
# Number Literals
|
| 175 |
+
(r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?', Number),
|
| 176 |
+
# Punctuation
|
| 177 |
+
(r'\[|\]|\(|\)|:|,|;', Punctuation),
|
| 178 |
+
# Assignment operators
|
| 179 |
+
# SLexer makes these tokens Operators.
|
| 180 |
+
(r'<-|~', Operator),
|
| 181 |
+
# Infix and prefix operators
|
| 182 |
+
(r'\+|-|\*|/', Operator),
|
| 183 |
+
# Block
|
| 184 |
+
(r'[{}]', Punctuation),
|
| 185 |
+
]
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
def analyse_text(text):
|
| 189 |
+
if re.search(r"^\s*model\s*{", text, re.M):
|
| 190 |
+
return 0.7
|
| 191 |
+
else:
|
| 192 |
+
return 0.0
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
class JagsLexer(RegexLexer):
|
| 196 |
+
"""
|
| 197 |
+
Pygments Lexer for JAGS.
|
| 198 |
+
|
| 199 |
+
.. versionadded:: 1.6
|
| 200 |
+
"""
|
| 201 |
+
|
| 202 |
+
name = 'JAGS'
|
| 203 |
+
aliases = ['jags']
|
| 204 |
+
filenames = ['*.jag', '*.bug']
|
| 205 |
+
|
| 206 |
+
# JAGS
|
| 207 |
+
_FUNCTIONS = (
|
| 208 |
+
'abs', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh',
|
| 209 |
+
'cos', 'cosh', 'cloglog',
|
| 210 |
+
'equals', 'exp', 'icloglog', 'ifelse', 'ilogit', 'log', 'logfact',
|
| 211 |
+
'loggam', 'logit', 'phi', 'pow', 'probit', 'round', 'sin', 'sinh',
|
| 212 |
+
'sqrt', 'step', 'tan', 'tanh', 'trunc', 'inprod', 'interp.lin',
|
| 213 |
+
'logdet', 'max', 'mean', 'min', 'prod', 'sum', 'sd', 'inverse',
|
| 214 |
+
'rank', 'sort', 't', 'acos', 'acosh', 'asin', 'asinh', 'atan',
|
| 215 |
+
# Truncation/Censoring (should I include)
|
| 216 |
+
'T', 'I')
|
| 217 |
+
# Distributions with density, probability and quartile functions
|
| 218 |
+
_DISTRIBUTIONS = tuple('[dpq]%s' % x for x in
|
| 219 |
+
('bern', 'beta', 'dchiqsqr', 'ddexp', 'dexp',
|
| 220 |
+
'df', 'gamma', 'gen.gamma', 'logis', 'lnorm',
|
| 221 |
+
'negbin', 'nchisqr', 'norm', 'par', 'pois', 'weib'))
|
| 222 |
+
# Other distributions without density and probability
|
| 223 |
+
_OTHER_DISTRIBUTIONS = (
|
| 224 |
+
'dt', 'dunif', 'dbetabin', 'dbern', 'dbin', 'dcat', 'dhyper',
|
| 225 |
+
'ddirch', 'dmnorm', 'dwish', 'dmt', 'dmulti', 'dbinom', 'dchisq',
|
| 226 |
+
'dnbinom', 'dweibull', 'ddirich')
|
| 227 |
+
|
| 228 |
+
tokens = {
|
| 229 |
+
'whitespace': [
|
| 230 |
+
(r"\s+", Text),
|
| 231 |
+
],
|
| 232 |
+
'names': [
|
| 233 |
+
# Regular variable names
|
| 234 |
+
(r'[a-zA-Z][\w.]*\b', Name),
|
| 235 |
+
],
|
| 236 |
+
'comments': [
|
| 237 |
+
# do not use stateful comments
|
| 238 |
+
(r'(?s)/\*.*?\*/', Comment.Multiline),
|
| 239 |
+
# Comments
|
| 240 |
+
(r'#.*$', Comment.Single),
|
| 241 |
+
],
|
| 242 |
+
'root': [
|
| 243 |
+
# Comments
|
| 244 |
+
include('comments'),
|
| 245 |
+
include('whitespace'),
|
| 246 |
+
# Block start
|
| 247 |
+
(r'(model|data)(\s+)(\{)',
|
| 248 |
+
bygroups(Keyword.Namespace, Text, Punctuation)),
|
| 249 |
+
(r'var(?![\w.])', Keyword.Declaration),
|
| 250 |
+
# Reserved Words
|
| 251 |
+
(r'(for|in)(?![\w.])', Keyword.Reserved),
|
| 252 |
+
# Builtins
|
| 253 |
+
# Need to use lookahead because . is a valid char
|
| 254 |
+
(r'(%s)(?=\s*\()' % r'|'.join(_FUNCTIONS
|
| 255 |
+
+ _DISTRIBUTIONS
|
| 256 |
+
+ _OTHER_DISTRIBUTIONS),
|
| 257 |
+
Name.Builtin),
|
| 258 |
+
# Names
|
| 259 |
+
include('names'),
|
| 260 |
+
# Number Literals
|
| 261 |
+
(r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?', Number),
|
| 262 |
+
(r'\[|\]|\(|\)|:|,|;', Punctuation),
|
| 263 |
+
# Assignment operators
|
| 264 |
+
(r'<-|~', Operator),
|
| 265 |
+
# # JAGS includes many more than OpenBUGS
|
| 266 |
+
(r'\+|-|\*|\/|\|\|[&]{2}|[<>=]=?|\^|%.*?%', Operator),
|
| 267 |
+
(r'[{}]', Punctuation),
|
| 268 |
+
]
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
def analyse_text(text):
|
| 272 |
+
if re.search(r'^\s*model\s*\{', text, re.M):
|
| 273 |
+
if re.search(r'^\s*data\s*\{', text, re.M):
|
| 274 |
+
return 0.9
|
| 275 |
+
elif re.search(r'^\s*var', text, re.M):
|
| 276 |
+
return 0.9
|
| 277 |
+
else:
|
| 278 |
+
return 0.3
|
| 279 |
+
else:
|
| 280 |
+
return 0
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
class StanLexer(RegexLexer):
|
| 284 |
+
"""Pygments Lexer for Stan models.
|
| 285 |
+
|
| 286 |
+
The Stan modeling language is specified in the *Stan Modeling Language
|
| 287 |
+
User's Guide and Reference Manual, v2.8.0*,
|
| 288 |
+
`pdf <https://github.com/stan-dev/stan/releases/download/v2.8.8/stan-reference-2.8.0.pdf>`__.
|
| 289 |
+
|
| 290 |
+
.. versionadded:: 1.6
|
| 291 |
+
"""
|
| 292 |
+
|
| 293 |
+
name = 'Stan'
|
| 294 |
+
aliases = ['stan']
|
| 295 |
+
filenames = ['*.stan']
|
| 296 |
+
|
| 297 |
+
tokens = {
|
| 298 |
+
'whitespace': [
|
| 299 |
+
(r"\s+", Text),
|
| 300 |
+
],
|
| 301 |
+
'comments': [
|
| 302 |
+
(r'(?s)/\*.*?\*/', Comment.Multiline),
|
| 303 |
+
# Comments
|
| 304 |
+
(r'(//|#).*$', Comment.Single),
|
| 305 |
+
],
|
| 306 |
+
'root': [
|
| 307 |
+
# Stan is more restrictive on strings than this regex
|
| 308 |
+
(r'"[^"]*"', String),
|
| 309 |
+
# Comments
|
| 310 |
+
include('comments'),
|
| 311 |
+
# block start
|
| 312 |
+
include('whitespace'),
|
| 313 |
+
# Block start
|
| 314 |
+
(r'(%s)(\s*)(\{)' %
|
| 315 |
+
r'|'.join(('functions', 'data', r'transformed\s+?data',
|
| 316 |
+
'parameters', r'transformed\s+parameters',
|
| 317 |
+
'model', r'generated\s+quantities')),
|
| 318 |
+
bygroups(Keyword.Namespace, Text, Punctuation)),
|
| 319 |
+
# Reserved Words
|
| 320 |
+
(r'(%s)\b' % r'|'.join(_stan_builtins.KEYWORDS), Keyword),
|
| 321 |
+
# Truncation
|
| 322 |
+
(r'T(?=\s*\[)', Keyword),
|
| 323 |
+
# Data types
|
| 324 |
+
(r'(%s)\b' % r'|'.join(_stan_builtins.TYPES), Keyword.Type),
|
| 325 |
+
# Punctuation
|
| 326 |
+
(r"[;:,\[\]()]", Punctuation),
|
| 327 |
+
# Builtin
|
| 328 |
+
(r'(%s)(?=\s*\()'
|
| 329 |
+
% r'|'.join(_stan_builtins.FUNCTIONS
|
| 330 |
+
+ _stan_builtins.DISTRIBUTIONS),
|
| 331 |
+
Name.Builtin),
|
| 332 |
+
# Special names ending in __, like lp__
|
| 333 |
+
(r'[A-Za-z]\w*__\b', Name.Builtin.Pseudo),
|
| 334 |
+
(r'(%s)\b' % r'|'.join(_stan_builtins.RESERVED), Keyword.Reserved),
|
| 335 |
+
# user-defined functions
|
| 336 |
+
(r'[A-Za-z]\w*(?=\s*\()]', Name.Function),
|
| 337 |
+
# Regular variable names
|
| 338 |
+
(r'[A-Za-z]\w*\b', Name),
|
| 339 |
+
# Real Literals
|
| 340 |
+
(r'-?[0-9]+(\.[0-9]+)?[eE]-?[0-9]+', Number.Float),
|
| 341 |
+
(r'-?[0-9]*\.[0-9]*', Number.Float),
|
| 342 |
+
# Integer Literals
|
| 343 |
+
(r'-?[0-9]+', Number.Integer),
|
| 344 |
+
# Assignment operators
|
| 345 |
+
# SLexer makes these tokens Operators.
|
| 346 |
+
(r'<-|~', Operator),
|
| 347 |
+
# Infix, prefix and postfix operators (and = )
|
| 348 |
+
(r"\+|-|\.?\*|\.?/|\\|'|\^|==?|!=?|<=?|>=?|\|\||&&", Operator),
|
| 349 |
+
# Block delimiters
|
| 350 |
+
(r'[{}]', Punctuation),
|
| 351 |
+
]
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
def analyse_text(text):
|
| 355 |
+
if re.search(r'^\s*parameters\s*\{', text, re.M):
|
| 356 |
+
return 1.0
|
| 357 |
+
else:
|
| 358 |
+
return 0.0
|