wandb 0.19.1rc1__py3-none-musllinux_1_2_aarch64.whl
Sign up to get free protection for your applications and to get access to all the features.
- package_readme.md +97 -0
- wandb/__init__.py +252 -0
- wandb/__init__.pyi +1197 -0
- wandb/__main__.py +3 -0
- wandb/_globals.py +19 -0
- wandb/agents/__init__.py +0 -0
- wandb/agents/pyagent.py +363 -0
- wandb/analytics/__init__.py +3 -0
- wandb/analytics/sentry.py +263 -0
- wandb/apis/__init__.py +48 -0
- wandb/apis/attrs.py +51 -0
- wandb/apis/importers/__init__.py +1 -0
- wandb/apis/importers/internals/internal.py +385 -0
- wandb/apis/importers/internals/protocols.py +103 -0
- wandb/apis/importers/internals/util.py +78 -0
- wandb/apis/importers/mlflow.py +254 -0
- wandb/apis/importers/validation.py +108 -0
- wandb/apis/importers/wandb.py +1603 -0
- wandb/apis/internal.py +232 -0
- wandb/apis/normalize.py +73 -0
- wandb/apis/paginator.py +81 -0
- wandb/apis/public/__init__.py +34 -0
- wandb/apis/public/api.py +1387 -0
- wandb/apis/public/artifacts.py +1095 -0
- wandb/apis/public/const.py +4 -0
- wandb/apis/public/files.py +263 -0
- wandb/apis/public/history.py +149 -0
- wandb/apis/public/jobs.py +653 -0
- wandb/apis/public/projects.py +154 -0
- wandb/apis/public/query_generator.py +166 -0
- wandb/apis/public/reports.py +458 -0
- wandb/apis/public/runs.py +1012 -0
- wandb/apis/public/sweeps.py +240 -0
- wandb/apis/public/teams.py +198 -0
- wandb/apis/public/users.py +136 -0
- wandb/apis/public/utils.py +68 -0
- wandb/apis/reports/__init__.py +1 -0
- wandb/apis/reports/v1/__init__.py +8 -0
- wandb/apis/reports/v2/__init__.py +8 -0
- wandb/apis/workspaces/__init__.py +8 -0
- wandb/beta/workflows.py +288 -0
- wandb/bin/gpu_stats +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/__init__.py +0 -0
- wandb/cli/beta.py +178 -0
- wandb/cli/cli.py +2812 -0
- wandb/data_types.py +66 -0
- wandb/docker/__init__.py +343 -0
- wandb/docker/auth.py +435 -0
- wandb/docker/wandb-entrypoint.sh +33 -0
- wandb/docker/www_authenticate.py +94 -0
- wandb/env.py +513 -0
- wandb/errors/__init__.py +17 -0
- wandb/errors/errors.py +37 -0
- wandb/errors/links.py +73 -0
- wandb/errors/term.py +415 -0
- wandb/errors/util.py +57 -0
- wandb/errors/warnings.py +2 -0
- wandb/filesync/__init__.py +0 -0
- wandb/filesync/dir_watcher.py +403 -0
- wandb/filesync/stats.py +100 -0
- wandb/filesync/step_checksum.py +142 -0
- wandb/filesync/step_prepare.py +179 -0
- wandb/filesync/step_upload.py +287 -0
- wandb/filesync/upload_job.py +142 -0
- wandb/integration/__init__.py +0 -0
- wandb/integration/catboost/__init__.py +5 -0
- wandb/integration/catboost/catboost.py +178 -0
- wandb/integration/cohere/__init__.py +3 -0
- wandb/integration/cohere/cohere.py +21 -0
- wandb/integration/cohere/resolver.py +347 -0
- wandb/integration/diffusers/__init__.py +3 -0
- wandb/integration/diffusers/autologger.py +76 -0
- wandb/integration/diffusers/pipeline_resolver.py +50 -0
- wandb/integration/diffusers/resolvers/__init__.py +9 -0
- wandb/integration/diffusers/resolvers/multimodal.py +882 -0
- wandb/integration/diffusers/resolvers/utils.py +102 -0
- wandb/integration/fastai/__init__.py +245 -0
- wandb/integration/gym/__init__.py +99 -0
- wandb/integration/huggingface/__init__.py +3 -0
- wandb/integration/huggingface/huggingface.py +18 -0
- wandb/integration/huggingface/resolver.py +213 -0
- wandb/integration/keras/__init__.py +11 -0
- wandb/integration/keras/callbacks/__init__.py +5 -0
- wandb/integration/keras/callbacks/metrics_logger.py +129 -0
- wandb/integration/keras/callbacks/model_checkpoint.py +188 -0
- wandb/integration/keras/callbacks/tables_builder.py +228 -0
- wandb/integration/keras/keras.py +1089 -0
- wandb/integration/kfp/__init__.py +6 -0
- wandb/integration/kfp/helpers.py +28 -0
- wandb/integration/kfp/kfp_patch.py +334 -0
- wandb/integration/kfp/wandb_logging.py +182 -0
- wandb/integration/langchain/__init__.py +3 -0
- wandb/integration/langchain/wandb_tracer.py +48 -0
- wandb/integration/lightgbm/__init__.py +239 -0
- wandb/integration/lightning/__init__.py +0 -0
- wandb/integration/lightning/fabric/__init__.py +3 -0
- wandb/integration/lightning/fabric/logger.py +764 -0
- wandb/integration/metaflow/__init__.py +3 -0
- wandb/integration/metaflow/metaflow.py +383 -0
- wandb/integration/openai/__init__.py +3 -0
- wandb/integration/openai/fine_tuning.py +480 -0
- wandb/integration/openai/openai.py +22 -0
- wandb/integration/openai/resolver.py +240 -0
- wandb/integration/prodigy/__init__.py +3 -0
- wandb/integration/prodigy/prodigy.py +299 -0
- wandb/integration/sacred/__init__.py +117 -0
- wandb/integration/sagemaker/__init__.py +12 -0
- wandb/integration/sagemaker/auth.py +28 -0
- wandb/integration/sagemaker/config.py +49 -0
- wandb/integration/sagemaker/files.py +3 -0
- wandb/integration/sagemaker/resources.py +34 -0
- wandb/integration/sb3/__init__.py +3 -0
- wandb/integration/sb3/sb3.py +147 -0
- wandb/integration/sklearn/__init__.py +37 -0
- wandb/integration/sklearn/calculate/__init__.py +32 -0
- wandb/integration/sklearn/calculate/calibration_curves.py +125 -0
- wandb/integration/sklearn/calculate/class_proportions.py +68 -0
- wandb/integration/sklearn/calculate/confusion_matrix.py +93 -0
- wandb/integration/sklearn/calculate/decision_boundaries.py +40 -0
- wandb/integration/sklearn/calculate/elbow_curve.py +55 -0
- wandb/integration/sklearn/calculate/feature_importances.py +67 -0
- wandb/integration/sklearn/calculate/learning_curve.py +64 -0
- wandb/integration/sklearn/calculate/outlier_candidates.py +69 -0
- wandb/integration/sklearn/calculate/residuals.py +86 -0
- wandb/integration/sklearn/calculate/silhouette.py +118 -0
- wandb/integration/sklearn/calculate/summary_metrics.py +62 -0
- wandb/integration/sklearn/plot/__init__.py +35 -0
- wandb/integration/sklearn/plot/classifier.py +329 -0
- wandb/integration/sklearn/plot/clusterer.py +146 -0
- wandb/integration/sklearn/plot/regressor.py +121 -0
- wandb/integration/sklearn/plot/shared.py +91 -0
- wandb/integration/sklearn/utils.py +183 -0
- wandb/integration/tensorboard/__init__.py +10 -0
- wandb/integration/tensorboard/log.py +354 -0
- wandb/integration/tensorboard/monkeypatch.py +186 -0
- wandb/integration/tensorflow/__init__.py +5 -0
- wandb/integration/tensorflow/estimator_hook.py +54 -0
- wandb/integration/torch/__init__.py +0 -0
- wandb/integration/torch/wandb_torch.py +554 -0
- wandb/integration/ultralytics/__init__.py +11 -0
- wandb/integration/ultralytics/bbox_utils.py +215 -0
- wandb/integration/ultralytics/callback.py +524 -0
- wandb/integration/ultralytics/classification_utils.py +83 -0
- wandb/integration/ultralytics/mask_utils.py +202 -0
- wandb/integration/ultralytics/pose_utils.py +103 -0
- wandb/integration/xgboost/__init__.py +11 -0
- wandb/integration/xgboost/xgboost.py +189 -0
- wandb/integration/yolov8/__init__.py +0 -0
- wandb/integration/yolov8/yolov8.py +284 -0
- wandb/jupyter.py +513 -0
- wandb/mpmain/__init__.py +0 -0
- wandb/mpmain/__main__.py +1 -0
- wandb/old/__init__.py +0 -0
- wandb/old/core.py +53 -0
- wandb/old/settings.py +173 -0
- wandb/old/summary.py +440 -0
- wandb/plot/__init__.py +28 -0
- wandb/plot/bar.py +70 -0
- wandb/plot/confusion_matrix.py +181 -0
- wandb/plot/custom_chart.py +124 -0
- wandb/plot/histogram.py +65 -0
- wandb/plot/line.py +74 -0
- wandb/plot/line_series.py +176 -0
- wandb/plot/pr_curve.py +185 -0
- wandb/plot/roc_curve.py +163 -0
- wandb/plot/scatter.py +66 -0
- wandb/plot/utils.py +183 -0
- wandb/plot/viz.py +41 -0
- wandb/proto/__init__.py +0 -0
- wandb/proto/v3/__init__.py +0 -0
- wandb/proto/v3/wandb_base_pb2.py +55 -0
- wandb/proto/v3/wandb_internal_pb2.py +1658 -0
- wandb/proto/v3/wandb_server_pb2.py +228 -0
- wandb/proto/v3/wandb_settings_pb2.py +122 -0
- wandb/proto/v3/wandb_telemetry_pb2.py +106 -0
- wandb/proto/v4/__init__.py +0 -0
- wandb/proto/v4/wandb_base_pb2.py +30 -0
- wandb/proto/v4/wandb_internal_pb2.py +370 -0
- wandb/proto/v4/wandb_server_pb2.py +67 -0
- wandb/proto/v4/wandb_settings_pb2.py +47 -0
- wandb/proto/v4/wandb_telemetry_pb2.py +41 -0
- wandb/proto/v5/wandb_base_pb2.py +31 -0
- wandb/proto/v5/wandb_internal_pb2.py +371 -0
- wandb/proto/v5/wandb_server_pb2.py +68 -0
- wandb/proto/v5/wandb_settings_pb2.py +48 -0
- wandb/proto/v5/wandb_telemetry_pb2.py +42 -0
- wandb/proto/wandb_base_pb2.py +10 -0
- wandb/proto/wandb_deprecated.py +45 -0
- wandb/proto/wandb_generate_deprecated.py +30 -0
- wandb/proto/wandb_generate_proto.py +49 -0
- wandb/proto/wandb_internal_pb2.py +16 -0
- wandb/proto/wandb_server_pb2.py +10 -0
- wandb/proto/wandb_settings_pb2.py +10 -0
- wandb/proto/wandb_telemetry_pb2.py +10 -0
- wandb/py.typed +0 -0
- wandb/sdk/__init__.py +37 -0
- wandb/sdk/artifacts/__init__.py +0 -0
- wandb/sdk/artifacts/_validators.py +121 -0
- wandb/sdk/artifacts/artifact.py +2364 -0
- wandb/sdk/artifacts/artifact_download_logger.py +43 -0
- wandb/sdk/artifacts/artifact_file_cache.py +249 -0
- wandb/sdk/artifacts/artifact_instance_cache.py +17 -0
- wandb/sdk/artifacts/artifact_manifest.py +75 -0
- wandb/sdk/artifacts/artifact_manifest_entry.py +249 -0
- wandb/sdk/artifacts/artifact_manifests/__init__.py +0 -0
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +92 -0
- wandb/sdk/artifacts/artifact_saver.py +265 -0
- wandb/sdk/artifacts/artifact_state.py +11 -0
- wandb/sdk/artifacts/artifact_ttl.py +7 -0
- wandb/sdk/artifacts/exceptions.py +57 -0
- wandb/sdk/artifacts/staging.py +25 -0
- wandb/sdk/artifacts/storage_handler.py +62 -0
- wandb/sdk/artifacts/storage_handlers/__init__.py +0 -0
- wandb/sdk/artifacts/storage_handlers/azure_handler.py +213 -0
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +224 -0
- wandb/sdk/artifacts/storage_handlers/http_handler.py +114 -0
- wandb/sdk/artifacts/storage_handlers/local_file_handler.py +139 -0
- wandb/sdk/artifacts/storage_handlers/multi_handler.py +56 -0
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +298 -0
- wandb/sdk/artifacts/storage_handlers/tracking_handler.py +72 -0
- wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +135 -0
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +74 -0
- wandb/sdk/artifacts/storage_layout.py +6 -0
- wandb/sdk/artifacts/storage_policies/__init__.py +4 -0
- wandb/sdk/artifacts/storage_policies/register.py +1 -0
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +378 -0
- wandb/sdk/artifacts/storage_policy.py +72 -0
- wandb/sdk/backend/__init__.py +0 -0
- wandb/sdk/backend/backend.py +221 -0
- wandb/sdk/data_types/__init__.py +0 -0
- wandb/sdk/data_types/_dtypes.py +918 -0
- wandb/sdk/data_types/_private.py +10 -0
- wandb/sdk/data_types/audio.py +165 -0
- wandb/sdk/data_types/base_types/__init__.py +0 -0
- wandb/sdk/data_types/base_types/json_metadata.py +55 -0
- wandb/sdk/data_types/base_types/media.py +376 -0
- wandb/sdk/data_types/base_types/wb_value.py +282 -0
- wandb/sdk/data_types/bokeh.py +70 -0
- wandb/sdk/data_types/graph.py +405 -0
- wandb/sdk/data_types/helper_types/__init__.py +0 -0
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +305 -0
- wandb/sdk/data_types/helper_types/classes.py +159 -0
- wandb/sdk/data_types/helper_types/image_mask.py +241 -0
- wandb/sdk/data_types/histogram.py +94 -0
- wandb/sdk/data_types/html.py +115 -0
- wandb/sdk/data_types/image.py +847 -0
- wandb/sdk/data_types/molecule.py +241 -0
- wandb/sdk/data_types/object_3d.py +470 -0
- wandb/sdk/data_types/plotly.py +82 -0
- wandb/sdk/data_types/saved_model.py +445 -0
- wandb/sdk/data_types/table.py +1204 -0
- wandb/sdk/data_types/trace_tree.py +438 -0
- wandb/sdk/data_types/utils.py +228 -0
- wandb/sdk/data_types/video.py +268 -0
- wandb/sdk/integration_utils/__init__.py +0 -0
- wandb/sdk/integration_utils/auto_logging.py +232 -0
- wandb/sdk/integration_utils/data_logging.py +475 -0
- wandb/sdk/interface/__init__.py +0 -0
- wandb/sdk/interface/constants.py +4 -0
- wandb/sdk/interface/interface.py +1010 -0
- wandb/sdk/interface/interface_queue.py +53 -0
- wandb/sdk/interface/interface_relay.py +53 -0
- wandb/sdk/interface/interface_shared.py +546 -0
- wandb/sdk/interface/interface_sock.py +61 -0
- wandb/sdk/interface/message_future.py +27 -0
- wandb/sdk/interface/message_future_poll.py +50 -0
- wandb/sdk/interface/router.py +115 -0
- wandb/sdk/interface/router_queue.py +41 -0
- wandb/sdk/interface/router_relay.py +37 -0
- wandb/sdk/interface/router_sock.py +36 -0
- wandb/sdk/interface/summary_record.py +67 -0
- wandb/sdk/internal/__init__.py +0 -0
- wandb/sdk/internal/context.py +89 -0
- wandb/sdk/internal/datastore.py +297 -0
- wandb/sdk/internal/file_pusher.py +181 -0
- wandb/sdk/internal/file_stream.py +695 -0
- wandb/sdk/internal/flow_control.py +263 -0
- wandb/sdk/internal/handler.py +905 -0
- wandb/sdk/internal/internal.py +403 -0
- wandb/sdk/internal/internal_api.py +4587 -0
- wandb/sdk/internal/internal_util.py +97 -0
- wandb/sdk/internal/job_builder.py +638 -0
- wandb/sdk/internal/profiler.py +78 -0
- wandb/sdk/internal/progress.py +79 -0
- wandb/sdk/internal/run.py +25 -0
- wandb/sdk/internal/sample.py +70 -0
- wandb/sdk/internal/sender.py +1696 -0
- wandb/sdk/internal/sender_config.py +197 -0
- wandb/sdk/internal/settings_static.py +97 -0
- wandb/sdk/internal/system/__init__.py +0 -0
- wandb/sdk/internal/system/assets/__init__.py +25 -0
- wandb/sdk/internal/system/assets/aggregators.py +37 -0
- wandb/sdk/internal/system/assets/asset_registry.py +20 -0
- wandb/sdk/internal/system/assets/cpu.py +163 -0
- wandb/sdk/internal/system/assets/disk.py +210 -0
- wandb/sdk/internal/system/assets/gpu.py +416 -0
- wandb/sdk/internal/system/assets/gpu_amd.py +233 -0
- wandb/sdk/internal/system/assets/interfaces.py +205 -0
- wandb/sdk/internal/system/assets/ipu.py +177 -0
- wandb/sdk/internal/system/assets/memory.py +166 -0
- wandb/sdk/internal/system/assets/network.py +125 -0
- wandb/sdk/internal/system/assets/open_metrics.py +293 -0
- wandb/sdk/internal/system/assets/tpu.py +154 -0
- wandb/sdk/internal/system/assets/trainium.py +393 -0
- wandb/sdk/internal/system/env_probe_helpers.py +13 -0
- wandb/sdk/internal/system/system_info.py +250 -0
- wandb/sdk/internal/system/system_monitor.py +222 -0
- wandb/sdk/internal/tb_watcher.py +519 -0
- wandb/sdk/internal/thread_local_settings.py +18 -0
- wandb/sdk/internal/writer.py +204 -0
- wandb/sdk/launch/__init__.py +15 -0
- wandb/sdk/launch/_launch.py +331 -0
- wandb/sdk/launch/_launch_add.py +255 -0
- wandb/sdk/launch/_project_spec.py +566 -0
- wandb/sdk/launch/agent/__init__.py +5 -0
- wandb/sdk/launch/agent/agent.py +924 -0
- wandb/sdk/launch/agent/config.py +296 -0
- wandb/sdk/launch/agent/job_status_tracker.py +53 -0
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +39 -0
- wandb/sdk/launch/builder/__init__.py +0 -0
- wandb/sdk/launch/builder/abstract.py +156 -0
- wandb/sdk/launch/builder/build.py +297 -0
- wandb/sdk/launch/builder/context_manager.py +235 -0
- wandb/sdk/launch/builder/docker_builder.py +177 -0
- wandb/sdk/launch/builder/kaniko_builder.py +594 -0
- wandb/sdk/launch/builder/noop.py +58 -0
- wandb/sdk/launch/builder/templates/_wandb_bootstrap.py +188 -0
- wandb/sdk/launch/builder/templates/dockerfile.py +92 -0
- wandb/sdk/launch/create_job.py +528 -0
- wandb/sdk/launch/environment/abstract.py +29 -0
- wandb/sdk/launch/environment/aws_environment.py +322 -0
- wandb/sdk/launch/environment/azure_environment.py +105 -0
- wandb/sdk/launch/environment/gcp_environment.py +335 -0
- wandb/sdk/launch/environment/local_environment.py +65 -0
- wandb/sdk/launch/errors.py +13 -0
- wandb/sdk/launch/git_reference.py +109 -0
- wandb/sdk/launch/inputs/files.py +148 -0
- wandb/sdk/launch/inputs/internal.py +315 -0
- wandb/sdk/launch/inputs/manage.py +113 -0
- wandb/sdk/launch/inputs/schema.py +39 -0
- wandb/sdk/launch/loader.py +249 -0
- wandb/sdk/launch/registry/abstract.py +48 -0
- wandb/sdk/launch/registry/anon.py +29 -0
- wandb/sdk/launch/registry/azure_container_registry.py +124 -0
- wandb/sdk/launch/registry/elastic_container_registry.py +192 -0
- wandb/sdk/launch/registry/google_artifact_registry.py +219 -0
- wandb/sdk/launch/registry/local_registry.py +65 -0
- wandb/sdk/launch/runner/__init__.py +0 -0
- wandb/sdk/launch/runner/abstract.py +185 -0
- wandb/sdk/launch/runner/kubernetes_monitor.py +472 -0
- wandb/sdk/launch/runner/kubernetes_runner.py +963 -0
- wandb/sdk/launch/runner/local_container.py +301 -0
- wandb/sdk/launch/runner/local_process.py +78 -0
- wandb/sdk/launch/runner/sagemaker_runner.py +426 -0
- wandb/sdk/launch/runner/vertex_runner.py +230 -0
- wandb/sdk/launch/sweeps/__init__.py +37 -0
- wandb/sdk/launch/sweeps/scheduler.py +740 -0
- wandb/sdk/launch/sweeps/scheduler_sweep.py +90 -0
- wandb/sdk/launch/sweeps/utils.py +316 -0
- wandb/sdk/launch/utils.py +747 -0
- wandb/sdk/launch/wandb_reference.py +138 -0
- wandb/sdk/lib/__init__.py +5 -0
- wandb/sdk/lib/apikey.py +269 -0
- wandb/sdk/lib/capped_dict.py +26 -0
- wandb/sdk/lib/config_util.py +101 -0
- wandb/sdk/lib/credentials.py +141 -0
- wandb/sdk/lib/deprecate.py +42 -0
- wandb/sdk/lib/disabled.py +29 -0
- wandb/sdk/lib/exit_hooks.py +54 -0
- wandb/sdk/lib/file_stream_utils.py +118 -0
- wandb/sdk/lib/filenames.py +64 -0
- wandb/sdk/lib/filesystem.py +372 -0
- wandb/sdk/lib/fsm.py +180 -0
- wandb/sdk/lib/gitlib.py +239 -0
- wandb/sdk/lib/gql_request.py +65 -0
- wandb/sdk/lib/handler_util.py +21 -0
- wandb/sdk/lib/hashutil.py +84 -0
- wandb/sdk/lib/import_hooks.py +275 -0
- wandb/sdk/lib/ipython.py +126 -0
- wandb/sdk/lib/json_util.py +80 -0
- wandb/sdk/lib/lazyloader.py +63 -0
- wandb/sdk/lib/mailbox.py +456 -0
- wandb/sdk/lib/module.py +78 -0
- wandb/sdk/lib/paths.py +106 -0
- wandb/sdk/lib/preinit.py +42 -0
- wandb/sdk/lib/printer.py +548 -0
- wandb/sdk/lib/progress.py +273 -0
- wandb/sdk/lib/proto_util.py +90 -0
- wandb/sdk/lib/redirect.py +845 -0
- wandb/sdk/lib/retry.py +289 -0
- wandb/sdk/lib/run_moment.py +72 -0
- wandb/sdk/lib/runid.py +12 -0
- wandb/sdk/lib/server.py +38 -0
- wandb/sdk/lib/service_connection.py +216 -0
- wandb/sdk/lib/service_token.py +94 -0
- wandb/sdk/lib/sock_client.py +290 -0
- wandb/sdk/lib/sparkline.py +44 -0
- wandb/sdk/lib/telemetry.py +100 -0
- wandb/sdk/lib/timed_input.py +133 -0
- wandb/sdk/lib/timer.py +19 -0
- wandb/sdk/service/__init__.py +0 -0
- wandb/sdk/service/_startup_debug.py +22 -0
- wandb/sdk/service/port_file.py +53 -0
- wandb/sdk/service/server.py +107 -0
- wandb/sdk/service/server_sock.py +274 -0
- wandb/sdk/service/service.py +242 -0
- wandb/sdk/service/streams.py +425 -0
- wandb/sdk/verify/__init__.py +0 -0
- wandb/sdk/verify/verify.py +501 -0
- wandb/sdk/wandb_alerts.py +12 -0
- wandb/sdk/wandb_config.py +322 -0
- wandb/sdk/wandb_helper.py +54 -0
- wandb/sdk/wandb_init.py +1313 -0
- wandb/sdk/wandb_login.py +339 -0
- wandb/sdk/wandb_metric.py +110 -0
- wandb/sdk/wandb_require.py +94 -0
- wandb/sdk/wandb_require_helpers.py +44 -0
- wandb/sdk/wandb_run.py +4066 -0
- wandb/sdk/wandb_settings.py +1309 -0
- wandb/sdk/wandb_setup.py +402 -0
- wandb/sdk/wandb_summary.py +150 -0
- wandb/sdk/wandb_sweep.py +119 -0
- wandb/sdk/wandb_sync.py +82 -0
- wandb/sdk/wandb_watch.py +150 -0
- wandb/sklearn.py +35 -0
- wandb/sync/__init__.py +3 -0
- wandb/sync/sync.py +442 -0
- wandb/trigger.py +29 -0
- wandb/util.py +1955 -0
- wandb/vendor/__init__.py +0 -0
- wandb/vendor/gql-0.2.0/setup.py +40 -0
- wandb/vendor/gql-0.2.0/tests/__init__.py +0 -0
- wandb/vendor/gql-0.2.0/tests/starwars/__init__.py +0 -0
- wandb/vendor/gql-0.2.0/tests/starwars/fixtures.py +96 -0
- wandb/vendor/gql-0.2.0/tests/starwars/schema.py +146 -0
- wandb/vendor/gql-0.2.0/tests/starwars/test_dsl.py +293 -0
- wandb/vendor/gql-0.2.0/tests/starwars/test_query.py +355 -0
- wandb/vendor/gql-0.2.0/tests/starwars/test_validation.py +171 -0
- wandb/vendor/gql-0.2.0/tests/test_client.py +31 -0
- wandb/vendor/gql-0.2.0/tests/test_transport.py +89 -0
- wandb/vendor/gql-0.2.0/wandb_gql/__init__.py +4 -0
- wandb/vendor/gql-0.2.0/wandb_gql/client.py +75 -0
- wandb/vendor/gql-0.2.0/wandb_gql/dsl.py +152 -0
- wandb/vendor/gql-0.2.0/wandb_gql/gql.py +10 -0
- wandb/vendor/gql-0.2.0/wandb_gql/transport/__init__.py +0 -0
- wandb/vendor/gql-0.2.0/wandb_gql/transport/http.py +6 -0
- wandb/vendor/gql-0.2.0/wandb_gql/transport/local_schema.py +15 -0
- wandb/vendor/gql-0.2.0/wandb_gql/transport/requests.py +46 -0
- wandb/vendor/gql-0.2.0/wandb_gql/utils.py +21 -0
- wandb/vendor/graphql-core-1.1/setup.py +86 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/__init__.py +287 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/error/__init__.py +6 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/error/base.py +42 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/error/format_error.py +11 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/error/located_error.py +29 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/error/syntax_error.py +36 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/__init__.py +26 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/base.py +311 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executor.py +398 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__init__.py +0 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/asyncio.py +53 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/gevent.py +22 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/process.py +32 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/sync.py +7 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/thread.py +35 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/utils.py +6 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/__init__.py +0 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/executor.py +66 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/fragment.py +252 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/resolver.py +151 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/utils.py +7 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/middleware.py +57 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/values.py +145 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/graphql.py +60 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/__init__.py +0 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/ast.py +1349 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/base.py +19 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/lexer.py +435 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/location.py +30 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/parser.py +779 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py +193 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/source.py +18 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor.py +222 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor_meta.py +82 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__init__.py +0 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/cached_property.py +17 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/contain_subset.py +28 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/default_ordered_dict.py +40 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/ordereddict.py +8 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/pair_set.py +43 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/version.py +78 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/__init__.py +67 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py +619 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/directives.py +132 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py +440 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py +131 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py +100 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py +145 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__init__.py +0 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/assert_valid_name.py +9 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_from_value.py +65 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_to_code.py +49 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_to_dict.py +24 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/base.py +75 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/build_ast_schema.py +291 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/build_client_schema.py +250 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/concat_ast.py +9 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/extend_schema.py +357 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/get_field_def.py +27 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/get_operation_ast.py +21 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/introspection_query.py +90 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/is_valid_literal_value.py +67 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/is_valid_value.py +66 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/quoted_or_list.py +21 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/schema_printer.py +168 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/suggestion_list.py +56 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_comparators.py +69 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_from_ast.py +21 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_info.py +149 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/value_from_ast.py +69 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/__init__.py +4 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__init__.py +79 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/arguments_of_correct_type.py +24 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/base.py +8 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/default_values_of_correct_type.py +44 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/fields_on_correct_type.py +113 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/fragments_on_composite_types.py +33 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_argument_names.py +70 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_directives.py +97 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_fragment_names.py +19 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_type_names.py +43 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/lone_anonymous_operation.py +23 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_fragment_cycles.py +59 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_undefined_variables.py +36 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_fragments.py +38 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_variables.py +37 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/overlapping_fields_can_be_merged.py +529 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/possible_fragment_spreads.py +44 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/provided_non_null_arguments.py +46 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/scalar_leafs.py +33 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_argument_names.py +32 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_fragment_names.py +28 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_input_field_names.py +33 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_operation_names.py +31 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_variable_names.py +27 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/variables_are_input_types.py +21 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/variables_in_allowed_position.py +53 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/validation.py +158 -0
- wandb/vendor/promise-2.3.0/conftest.py +30 -0
- wandb/vendor/promise-2.3.0/setup.py +64 -0
- wandb/vendor/promise-2.3.0/tests/__init__.py +0 -0
- wandb/vendor/promise-2.3.0/tests/conftest.py +8 -0
- wandb/vendor/promise-2.3.0/tests/test_awaitable.py +32 -0
- wandb/vendor/promise-2.3.0/tests/test_awaitable_35.py +47 -0
- wandb/vendor/promise-2.3.0/tests/test_benchmark.py +116 -0
- wandb/vendor/promise-2.3.0/tests/test_complex_threads.py +23 -0
- wandb/vendor/promise-2.3.0/tests/test_dataloader.py +452 -0
- wandb/vendor/promise-2.3.0/tests/test_dataloader_awaitable_35.py +99 -0
- wandb/vendor/promise-2.3.0/tests/test_dataloader_extra.py +65 -0
- wandb/vendor/promise-2.3.0/tests/test_extra.py +670 -0
- wandb/vendor/promise-2.3.0/tests/test_issues.py +132 -0
- wandb/vendor/promise-2.3.0/tests/test_promise_list.py +70 -0
- wandb/vendor/promise-2.3.0/tests/test_spec.py +584 -0
- wandb/vendor/promise-2.3.0/tests/test_thread_safety.py +115 -0
- wandb/vendor/promise-2.3.0/tests/utils.py +3 -0
- wandb/vendor/promise-2.3.0/wandb_promise/__init__.py +38 -0
- wandb/vendor/promise-2.3.0/wandb_promise/async_.py +135 -0
- wandb/vendor/promise-2.3.0/wandb_promise/compat.py +32 -0
- wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py +326 -0
- wandb/vendor/promise-2.3.0/wandb_promise/iterate_promise.py +12 -0
- wandb/vendor/promise-2.3.0/wandb_promise/promise.py +848 -0
- wandb/vendor/promise-2.3.0/wandb_promise/promise_list.py +151 -0
- wandb/vendor/promise-2.3.0/wandb_promise/pyutils/__init__.py +0 -0
- wandb/vendor/promise-2.3.0/wandb_promise/pyutils/version.py +83 -0
- wandb/vendor/promise-2.3.0/wandb_promise/schedulers/__init__.py +0 -0
- wandb/vendor/promise-2.3.0/wandb_promise/schedulers/asyncio.py +22 -0
- wandb/vendor/promise-2.3.0/wandb_promise/schedulers/gevent.py +21 -0
- wandb/vendor/promise-2.3.0/wandb_promise/schedulers/immediate.py +27 -0
- wandb/vendor/promise-2.3.0/wandb_promise/schedulers/thread.py +18 -0
- wandb/vendor/promise-2.3.0/wandb_promise/utils.py +56 -0
- wandb/vendor/pygments/__init__.py +90 -0
- wandb/vendor/pygments/cmdline.py +568 -0
- wandb/vendor/pygments/console.py +74 -0
- wandb/vendor/pygments/filter.py +74 -0
- wandb/vendor/pygments/filters/__init__.py +350 -0
- wandb/vendor/pygments/formatter.py +95 -0
- wandb/vendor/pygments/formatters/__init__.py +153 -0
- wandb/vendor/pygments/formatters/_mapping.py +85 -0
- wandb/vendor/pygments/formatters/bbcode.py +109 -0
- wandb/vendor/pygments/formatters/html.py +851 -0
- wandb/vendor/pygments/formatters/img.py +600 -0
- wandb/vendor/pygments/formatters/irc.py +182 -0
- wandb/vendor/pygments/formatters/latex.py +482 -0
- wandb/vendor/pygments/formatters/other.py +160 -0
- wandb/vendor/pygments/formatters/rtf.py +147 -0
- wandb/vendor/pygments/formatters/svg.py +153 -0
- wandb/vendor/pygments/formatters/terminal.py +136 -0
- wandb/vendor/pygments/formatters/terminal256.py +309 -0
- wandb/vendor/pygments/lexer.py +871 -0
- wandb/vendor/pygments/lexers/__init__.py +329 -0
- wandb/vendor/pygments/lexers/_asy_builtins.py +1645 -0
- wandb/vendor/pygments/lexers/_cl_builtins.py +232 -0
- wandb/vendor/pygments/lexers/_cocoa_builtins.py +72 -0
- wandb/vendor/pygments/lexers/_csound_builtins.py +1346 -0
- wandb/vendor/pygments/lexers/_lasso_builtins.py +5327 -0
- wandb/vendor/pygments/lexers/_lua_builtins.py +295 -0
- wandb/vendor/pygments/lexers/_mapping.py +500 -0
- wandb/vendor/pygments/lexers/_mql_builtins.py +1172 -0
- wandb/vendor/pygments/lexers/_openedge_builtins.py +2547 -0
- wandb/vendor/pygments/lexers/_php_builtins.py +4756 -0
- wandb/vendor/pygments/lexers/_postgres_builtins.py +621 -0
- wandb/vendor/pygments/lexers/_scilab_builtins.py +3094 -0
- wandb/vendor/pygments/lexers/_sourcemod_builtins.py +1163 -0
- wandb/vendor/pygments/lexers/_stan_builtins.py +532 -0
- wandb/vendor/pygments/lexers/_stata_builtins.py +419 -0
- wandb/vendor/pygments/lexers/_tsql_builtins.py +1004 -0
- wandb/vendor/pygments/lexers/_vim_builtins.py +1939 -0
- wandb/vendor/pygments/lexers/actionscript.py +240 -0
- wandb/vendor/pygments/lexers/agile.py +24 -0
- wandb/vendor/pygments/lexers/algebra.py +221 -0
- wandb/vendor/pygments/lexers/ambient.py +76 -0
- wandb/vendor/pygments/lexers/ampl.py +87 -0
- wandb/vendor/pygments/lexers/apl.py +101 -0
- wandb/vendor/pygments/lexers/archetype.py +318 -0
- wandb/vendor/pygments/lexers/asm.py +641 -0
- wandb/vendor/pygments/lexers/automation.py +374 -0
- wandb/vendor/pygments/lexers/basic.py +500 -0
- wandb/vendor/pygments/lexers/bibtex.py +160 -0
- wandb/vendor/pygments/lexers/business.py +612 -0
- wandb/vendor/pygments/lexers/c_cpp.py +252 -0
- wandb/vendor/pygments/lexers/c_like.py +541 -0
- wandb/vendor/pygments/lexers/capnproto.py +78 -0
- wandb/vendor/pygments/lexers/chapel.py +102 -0
- wandb/vendor/pygments/lexers/clean.py +288 -0
- wandb/vendor/pygments/lexers/compiled.py +34 -0
- wandb/vendor/pygments/lexers/configs.py +833 -0
- wandb/vendor/pygments/lexers/console.py +114 -0
- wandb/vendor/pygments/lexers/crystal.py +393 -0
- wandb/vendor/pygments/lexers/csound.py +366 -0
- wandb/vendor/pygments/lexers/css.py +689 -0
- wandb/vendor/pygments/lexers/d.py +251 -0
- wandb/vendor/pygments/lexers/dalvik.py +125 -0
- wandb/vendor/pygments/lexers/data.py +555 -0
- wandb/vendor/pygments/lexers/diff.py +165 -0
- wandb/vendor/pygments/lexers/dotnet.py +691 -0
- wandb/vendor/pygments/lexers/dsls.py +878 -0
- wandb/vendor/pygments/lexers/dylan.py +289 -0
- wandb/vendor/pygments/lexers/ecl.py +125 -0
- wandb/vendor/pygments/lexers/eiffel.py +65 -0
- wandb/vendor/pygments/lexers/elm.py +121 -0
- wandb/vendor/pygments/lexers/erlang.py +533 -0
- wandb/vendor/pygments/lexers/esoteric.py +277 -0
- wandb/vendor/pygments/lexers/ezhil.py +69 -0
- wandb/vendor/pygments/lexers/factor.py +344 -0
- wandb/vendor/pygments/lexers/fantom.py +250 -0
- wandb/vendor/pygments/lexers/felix.py +273 -0
- wandb/vendor/pygments/lexers/forth.py +177 -0
- wandb/vendor/pygments/lexers/fortran.py +205 -0
- wandb/vendor/pygments/lexers/foxpro.py +428 -0
- wandb/vendor/pygments/lexers/functional.py +21 -0
- wandb/vendor/pygments/lexers/go.py +101 -0
- wandb/vendor/pygments/lexers/grammar_notation.py +213 -0
- wandb/vendor/pygments/lexers/graph.py +80 -0
- wandb/vendor/pygments/lexers/graphics.py +553 -0
- wandb/vendor/pygments/lexers/haskell.py +843 -0
- wandb/vendor/pygments/lexers/haxe.py +936 -0
- wandb/vendor/pygments/lexers/hdl.py +382 -0
- wandb/vendor/pygments/lexers/hexdump.py +103 -0
- wandb/vendor/pygments/lexers/html.py +602 -0
- wandb/vendor/pygments/lexers/idl.py +270 -0
- wandb/vendor/pygments/lexers/igor.py +288 -0
- wandb/vendor/pygments/lexers/inferno.py +96 -0
- wandb/vendor/pygments/lexers/installers.py +322 -0
- wandb/vendor/pygments/lexers/int_fiction.py +1343 -0
- wandb/vendor/pygments/lexers/iolang.py +63 -0
- wandb/vendor/pygments/lexers/j.py +146 -0
- wandb/vendor/pygments/lexers/javascript.py +1525 -0
- wandb/vendor/pygments/lexers/julia.py +333 -0
- wandb/vendor/pygments/lexers/jvm.py +1573 -0
- wandb/vendor/pygments/lexers/lisp.py +2621 -0
- wandb/vendor/pygments/lexers/make.py +202 -0
- wandb/vendor/pygments/lexers/markup.py +595 -0
- wandb/vendor/pygments/lexers/math.py +21 -0
- wandb/vendor/pygments/lexers/matlab.py +663 -0
- wandb/vendor/pygments/lexers/ml.py +769 -0
- wandb/vendor/pygments/lexers/modeling.py +358 -0
- wandb/vendor/pygments/lexers/modula2.py +1561 -0
- wandb/vendor/pygments/lexers/monte.py +204 -0
- wandb/vendor/pygments/lexers/ncl.py +894 -0
- wandb/vendor/pygments/lexers/nimrod.py +159 -0
- wandb/vendor/pygments/lexers/nit.py +64 -0
- wandb/vendor/pygments/lexers/nix.py +136 -0
- wandb/vendor/pygments/lexers/oberon.py +105 -0
- wandb/vendor/pygments/lexers/objective.py +504 -0
- wandb/vendor/pygments/lexers/ooc.py +85 -0
- wandb/vendor/pygments/lexers/other.py +41 -0
- wandb/vendor/pygments/lexers/parasail.py +79 -0
- wandb/vendor/pygments/lexers/parsers.py +835 -0
- wandb/vendor/pygments/lexers/pascal.py +644 -0
- wandb/vendor/pygments/lexers/pawn.py +199 -0
- wandb/vendor/pygments/lexers/perl.py +620 -0
- wandb/vendor/pygments/lexers/php.py +267 -0
- wandb/vendor/pygments/lexers/praat.py +294 -0
- wandb/vendor/pygments/lexers/prolog.py +306 -0
- wandb/vendor/pygments/lexers/python.py +939 -0
- wandb/vendor/pygments/lexers/qvt.py +152 -0
- wandb/vendor/pygments/lexers/r.py +453 -0
- wandb/vendor/pygments/lexers/rdf.py +270 -0
- wandb/vendor/pygments/lexers/rebol.py +431 -0
- wandb/vendor/pygments/lexers/resource.py +85 -0
- wandb/vendor/pygments/lexers/rnc.py +67 -0
- wandb/vendor/pygments/lexers/roboconf.py +82 -0
- wandb/vendor/pygments/lexers/robotframework.py +560 -0
- wandb/vendor/pygments/lexers/ruby.py +519 -0
- wandb/vendor/pygments/lexers/rust.py +220 -0
- wandb/vendor/pygments/lexers/sas.py +228 -0
- wandb/vendor/pygments/lexers/scripting.py +1222 -0
- wandb/vendor/pygments/lexers/shell.py +794 -0
- wandb/vendor/pygments/lexers/smalltalk.py +195 -0
- wandb/vendor/pygments/lexers/smv.py +79 -0
- wandb/vendor/pygments/lexers/snobol.py +83 -0
- wandb/vendor/pygments/lexers/special.py +103 -0
- wandb/vendor/pygments/lexers/sql.py +681 -0
- wandb/vendor/pygments/lexers/stata.py +108 -0
- wandb/vendor/pygments/lexers/supercollider.py +90 -0
- wandb/vendor/pygments/lexers/tcl.py +145 -0
- wandb/vendor/pygments/lexers/templates.py +2283 -0
- wandb/vendor/pygments/lexers/testing.py +207 -0
- wandb/vendor/pygments/lexers/text.py +25 -0
- wandb/vendor/pygments/lexers/textedit.py +169 -0
- wandb/vendor/pygments/lexers/textfmts.py +297 -0
- wandb/vendor/pygments/lexers/theorem.py +458 -0
- wandb/vendor/pygments/lexers/trafficscript.py +54 -0
- wandb/vendor/pygments/lexers/typoscript.py +226 -0
- wandb/vendor/pygments/lexers/urbi.py +133 -0
- wandb/vendor/pygments/lexers/varnish.py +190 -0
- wandb/vendor/pygments/lexers/verification.py +111 -0
- wandb/vendor/pygments/lexers/web.py +24 -0
- wandb/vendor/pygments/lexers/webmisc.py +988 -0
- wandb/vendor/pygments/lexers/whiley.py +116 -0
- wandb/vendor/pygments/lexers/x10.py +69 -0
- wandb/vendor/pygments/modeline.py +44 -0
- wandb/vendor/pygments/plugin.py +68 -0
- wandb/vendor/pygments/regexopt.py +92 -0
- wandb/vendor/pygments/scanner.py +105 -0
- wandb/vendor/pygments/sphinxext.py +158 -0
- wandb/vendor/pygments/style.py +155 -0
- wandb/vendor/pygments/styles/__init__.py +80 -0
- wandb/vendor/pygments/styles/abap.py +29 -0
- wandb/vendor/pygments/styles/algol.py +63 -0
- wandb/vendor/pygments/styles/algol_nu.py +63 -0
- wandb/vendor/pygments/styles/arduino.py +98 -0
- wandb/vendor/pygments/styles/autumn.py +65 -0
- wandb/vendor/pygments/styles/borland.py +51 -0
- wandb/vendor/pygments/styles/bw.py +49 -0
- wandb/vendor/pygments/styles/colorful.py +81 -0
- wandb/vendor/pygments/styles/default.py +73 -0
- wandb/vendor/pygments/styles/emacs.py +72 -0
- wandb/vendor/pygments/styles/friendly.py +72 -0
- wandb/vendor/pygments/styles/fruity.py +42 -0
- wandb/vendor/pygments/styles/igor.py +29 -0
- wandb/vendor/pygments/styles/lovelace.py +97 -0
- wandb/vendor/pygments/styles/manni.py +75 -0
- wandb/vendor/pygments/styles/monokai.py +106 -0
- wandb/vendor/pygments/styles/murphy.py +80 -0
- wandb/vendor/pygments/styles/native.py +65 -0
- wandb/vendor/pygments/styles/paraiso_dark.py +125 -0
- wandb/vendor/pygments/styles/paraiso_light.py +125 -0
- wandb/vendor/pygments/styles/pastie.py +75 -0
- wandb/vendor/pygments/styles/perldoc.py +69 -0
- wandb/vendor/pygments/styles/rainbow_dash.py +89 -0
- wandb/vendor/pygments/styles/rrt.py +33 -0
- wandb/vendor/pygments/styles/sas.py +44 -0
- wandb/vendor/pygments/styles/stata.py +40 -0
- wandb/vendor/pygments/styles/tango.py +141 -0
- wandb/vendor/pygments/styles/trac.py +63 -0
- wandb/vendor/pygments/styles/vim.py +63 -0
- wandb/vendor/pygments/styles/vs.py +38 -0
- wandb/vendor/pygments/styles/xcode.py +51 -0
- wandb/vendor/pygments/token.py +213 -0
- wandb/vendor/pygments/unistring.py +217 -0
- wandb/vendor/pygments/util.py +388 -0
- wandb/vendor/pynvml/__init__.py +0 -0
- wandb/vendor/pynvml/pynvml.py +4779 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/__init__.py +17 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/events.py +615 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__init__.py +98 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py +369 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py +172 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents2.py +239 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py +218 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_buffer.py +81 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_c.py +575 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/kqueue.py +730 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/polling.py +145 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/read_directory_changes.py +133 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py +348 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/patterns.py +265 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/tricks/__init__.py +174 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__init__.py +151 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/bricks.py +249 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/compat.py +29 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py +198 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/delayed_queue.py +88 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/dirsnapshot.py +293 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/echo.py +157 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/event_backport.py +41 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/importlib2.py +40 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/platform.py +57 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/unicode_paths.py +64 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/win32stat.py +123 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/version.py +28 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/watchmedo.py +577 -0
- wandb/wandb_agent.py +588 -0
- wandb/wandb_controller.py +719 -0
- wandb/wandb_run.py +9 -0
- wandb-0.19.1rc1.dist-info/METADATA +223 -0
- wandb-0.19.1rc1.dist-info/RECORD +822 -0
- wandb-0.19.1rc1.dist-info/WHEEL +5 -0
- wandb-0.19.1rc1.dist-info/entry_points.txt +3 -0
- wandb-0.19.1rc1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1343 @@
|
|
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
|