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,1222 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.scripting
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
Lexer for scripting and embedded languages.
|
7
|
+
|
8
|
+
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
|
9
|
+
:license: BSD, see LICENSE for details.
|
10
|
+
"""
|
11
|
+
|
12
|
+
import re
|
13
|
+
|
14
|
+
from pygments.lexer import RegexLexer, include, bygroups, default, combined, \
|
15
|
+
words
|
16
|
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
17
|
+
Number, Punctuation, Error, Whitespace, Other
|
18
|
+
from pygments.util import get_bool_opt, get_list_opt, iteritems
|
19
|
+
|
20
|
+
__all__ = ['LuaLexer', 'MoonScriptLexer', 'ChaiscriptLexer', 'LSLLexer',
|
21
|
+
'AppleScriptLexer', 'RexxLexer', 'MOOCodeLexer', 'HybrisLexer',
|
22
|
+
'EasytrieveLexer', 'JclLexer']
|
23
|
+
|
24
|
+
|
25
|
+
class LuaLexer(RegexLexer):
|
26
|
+
"""
|
27
|
+
For `Lua <http://www.lua.org>`_ source code.
|
28
|
+
|
29
|
+
Additional options accepted:
|
30
|
+
|
31
|
+
`func_name_highlighting`
|
32
|
+
If given and ``True``, highlight builtin function names
|
33
|
+
(default: ``True``).
|
34
|
+
`disabled_modules`
|
35
|
+
If given, must be a list of module names whose function names
|
36
|
+
should not be highlighted. By default all modules are highlighted.
|
37
|
+
|
38
|
+
To get a list of allowed modules have a look into the
|
39
|
+
`_lua_builtins` module:
|
40
|
+
|
41
|
+
.. sourcecode:: pycon
|
42
|
+
|
43
|
+
>>> from pygments.lexers._lua_builtins import MODULES
|
44
|
+
>>> MODULES.keys()
|
45
|
+
['string', 'coroutine', 'modules', 'io', 'basic', ...]
|
46
|
+
"""
|
47
|
+
|
48
|
+
name = 'Lua'
|
49
|
+
aliases = ['lua']
|
50
|
+
filenames = ['*.lua', '*.wlua']
|
51
|
+
mimetypes = ['text/x-lua', 'application/x-lua']
|
52
|
+
|
53
|
+
_comment_multiline = r'(?:--\[(?P<level>=*)\[[\w\W]*?\](?P=level)\])'
|
54
|
+
_comment_single = r'(?:--.*$)'
|
55
|
+
_space = r'(?:\s+)'
|
56
|
+
_s = r'(?:%s|%s|%s)' % (_comment_multiline, _comment_single, _space)
|
57
|
+
_name = r'(?:[^\W\d]\w*)'
|
58
|
+
|
59
|
+
tokens = {
|
60
|
+
'root': [
|
61
|
+
# Lua allows a file to start with a shebang.
|
62
|
+
(r'#!.*', Comment.Preproc),
|
63
|
+
default('base'),
|
64
|
+
],
|
65
|
+
'ws': [
|
66
|
+
(_comment_multiline, Comment.Multiline),
|
67
|
+
(_comment_single, Comment.Single),
|
68
|
+
(_space, Text),
|
69
|
+
],
|
70
|
+
'base': [
|
71
|
+
include('ws'),
|
72
|
+
|
73
|
+
(r'(?i)0x[\da-f]*(\.[\da-f]*)?(p[+-]?\d+)?', Number.Hex),
|
74
|
+
(r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float),
|
75
|
+
(r'(?i)\d+e[+-]?\d+', Number.Float),
|
76
|
+
(r'\d+', Number.Integer),
|
77
|
+
|
78
|
+
# multiline strings
|
79
|
+
(r'(?s)\[(=*)\[.*?\]\1\]', String),
|
80
|
+
|
81
|
+
(r'::', Punctuation, 'label'),
|
82
|
+
(r'\.{3}', Punctuation),
|
83
|
+
(r'[=<>|~&+\-*/%#^]+|\.\.', Operator),
|
84
|
+
(r'[\[\]{}().,:;]', Punctuation),
|
85
|
+
(r'(and|or|not)\b', Operator.Word),
|
86
|
+
|
87
|
+
('(break|do|else|elseif|end|for|if|in|repeat|return|then|until|'
|
88
|
+
r'while)\b', Keyword.Reserved),
|
89
|
+
(r'goto\b', Keyword.Reserved, 'goto'),
|
90
|
+
(r'(local)\b', Keyword.Declaration),
|
91
|
+
(r'(true|false|nil)\b', Keyword.Constant),
|
92
|
+
|
93
|
+
(r'(function)\b', Keyword.Reserved, 'funcname'),
|
94
|
+
|
95
|
+
(r'[A-Za-z_]\w*(\.[A-Za-z_]\w*)?', Name),
|
96
|
+
|
97
|
+
("'", String.Single, combined('stringescape', 'sqs')),
|
98
|
+
('"', String.Double, combined('stringescape', 'dqs'))
|
99
|
+
],
|
100
|
+
|
101
|
+
'funcname': [
|
102
|
+
include('ws'),
|
103
|
+
(r'[.:]', Punctuation),
|
104
|
+
(r'%s(?=%s*[.:])' % (_name, _s), Name.Class),
|
105
|
+
(_name, Name.Function, '#pop'),
|
106
|
+
# inline function
|
107
|
+
('\(', Punctuation, '#pop'),
|
108
|
+
],
|
109
|
+
|
110
|
+
'goto': [
|
111
|
+
include('ws'),
|
112
|
+
(_name, Name.Label, '#pop'),
|
113
|
+
],
|
114
|
+
|
115
|
+
'label': [
|
116
|
+
include('ws'),
|
117
|
+
(r'::', Punctuation, '#pop'),
|
118
|
+
(_name, Name.Label),
|
119
|
+
],
|
120
|
+
|
121
|
+
'stringescape': [
|
122
|
+
(r'\\([abfnrtv\\"\']|[\r\n]{1,2}|z\s*|x[0-9a-fA-F]{2}|\d{1,3}|'
|
123
|
+
r'u\{[0-9a-fA-F]+\})', String.Escape),
|
124
|
+
],
|
125
|
+
|
126
|
+
'sqs': [
|
127
|
+
(r"'", String.Single, '#pop'),
|
128
|
+
(r"[^\\']+", String.Single),
|
129
|
+
],
|
130
|
+
|
131
|
+
'dqs': [
|
132
|
+
(r'"', String.Double, '#pop'),
|
133
|
+
(r'[^\\"]+', String.Double),
|
134
|
+
]
|
135
|
+
}
|
136
|
+
|
137
|
+
def __init__(self, **options):
|
138
|
+
self.func_name_highlighting = get_bool_opt(
|
139
|
+
options, 'func_name_highlighting', True)
|
140
|
+
self.disabled_modules = get_list_opt(options, 'disabled_modules', [])
|
141
|
+
|
142
|
+
self._functions = set()
|
143
|
+
if self.func_name_highlighting:
|
144
|
+
from pygments.lexers._lua_builtins import MODULES
|
145
|
+
for mod, func in iteritems(MODULES):
|
146
|
+
if mod not in self.disabled_modules:
|
147
|
+
self._functions.update(func)
|
148
|
+
RegexLexer.__init__(self, **options)
|
149
|
+
|
150
|
+
def get_tokens_unprocessed(self, text):
|
151
|
+
for index, token, value in \
|
152
|
+
RegexLexer.get_tokens_unprocessed(self, text):
|
153
|
+
if token is Name:
|
154
|
+
if value in self._functions:
|
155
|
+
yield index, Name.Builtin, value
|
156
|
+
continue
|
157
|
+
elif '.' in value:
|
158
|
+
a, b = value.split('.')
|
159
|
+
yield index, Name, a
|
160
|
+
yield index + len(a), Punctuation, u'.'
|
161
|
+
yield index + len(a) + 1, Name, b
|
162
|
+
continue
|
163
|
+
yield index, token, value
|
164
|
+
|
165
|
+
|
166
|
+
class MoonScriptLexer(LuaLexer):
|
167
|
+
"""
|
168
|
+
For `MoonScript <http://moonscript.org>`_ source code.
|
169
|
+
|
170
|
+
.. versionadded:: 1.5
|
171
|
+
"""
|
172
|
+
|
173
|
+
name = "MoonScript"
|
174
|
+
aliases = ["moon", "moonscript"]
|
175
|
+
filenames = ["*.moon"]
|
176
|
+
mimetypes = ['text/x-moonscript', 'application/x-moonscript']
|
177
|
+
|
178
|
+
tokens = {
|
179
|
+
'root': [
|
180
|
+
(r'#!(.*?)$', Comment.Preproc),
|
181
|
+
default('base'),
|
182
|
+
],
|
183
|
+
'base': [
|
184
|
+
('--.*$', Comment.Single),
|
185
|
+
(r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float),
|
186
|
+
(r'(?i)\d+e[+-]?\d+', Number.Float),
|
187
|
+
(r'(?i)0x[0-9a-f]*', Number.Hex),
|
188
|
+
(r'\d+', Number.Integer),
|
189
|
+
(r'\n', Text),
|
190
|
+
(r'[^\S\n]+', Text),
|
191
|
+
(r'(?s)\[(=*)\[.*?\]\1\]', String),
|
192
|
+
(r'(->|=>)', Name.Function),
|
193
|
+
(r':[a-zA-Z_]\w*', Name.Variable),
|
194
|
+
(r'(==|!=|~=|<=|>=|\.\.\.|\.\.|[=+\-*/%^<>#!.\\:])', Operator),
|
195
|
+
(r'[;,]', Punctuation),
|
196
|
+
(r'[\[\]{}()]', Keyword.Type),
|
197
|
+
(r'[a-zA-Z_]\w*:', Name.Variable),
|
198
|
+
(words((
|
199
|
+
'class', 'extends', 'if', 'then', 'super', 'do', 'with',
|
200
|
+
'import', 'export', 'while', 'elseif', 'return', 'for', 'in',
|
201
|
+
'from', 'when', 'using', 'else', 'and', 'or', 'not', 'switch',
|
202
|
+
'break'), suffix=r'\b'),
|
203
|
+
Keyword),
|
204
|
+
(r'(true|false|nil)\b', Keyword.Constant),
|
205
|
+
(r'(and|or|not)\b', Operator.Word),
|
206
|
+
(r'(self)\b', Name.Builtin.Pseudo),
|
207
|
+
(r'@@?([a-zA-Z_]\w*)?', Name.Variable.Class),
|
208
|
+
(r'[A-Z]\w*', Name.Class), # proper name
|
209
|
+
(r'[A-Za-z_]\w*(\.[A-Za-z_]\w*)?', Name),
|
210
|
+
("'", String.Single, combined('stringescape', 'sqs')),
|
211
|
+
('"', String.Double, combined('stringescape', 'dqs'))
|
212
|
+
],
|
213
|
+
'stringescape': [
|
214
|
+
(r'''\\([abfnrtv\\"']|\d{1,3})''', String.Escape)
|
215
|
+
],
|
216
|
+
'sqs': [
|
217
|
+
("'", String.Single, '#pop'),
|
218
|
+
(".", String)
|
219
|
+
],
|
220
|
+
'dqs': [
|
221
|
+
('"', String.Double, '#pop'),
|
222
|
+
(".", String)
|
223
|
+
]
|
224
|
+
}
|
225
|
+
|
226
|
+
def get_tokens_unprocessed(self, text):
|
227
|
+
# set . as Operator instead of Punctuation
|
228
|
+
for index, token, value in LuaLexer.get_tokens_unprocessed(self, text):
|
229
|
+
if token == Punctuation and value == ".":
|
230
|
+
token = Operator
|
231
|
+
yield index, token, value
|
232
|
+
|
233
|
+
|
234
|
+
class ChaiscriptLexer(RegexLexer):
|
235
|
+
"""
|
236
|
+
For `ChaiScript <http://chaiscript.com/>`_ source code.
|
237
|
+
|
238
|
+
.. versionadded:: 2.0
|
239
|
+
"""
|
240
|
+
|
241
|
+
name = 'ChaiScript'
|
242
|
+
aliases = ['chai', 'chaiscript']
|
243
|
+
filenames = ['*.chai']
|
244
|
+
mimetypes = ['text/x-chaiscript', 'application/x-chaiscript']
|
245
|
+
|
246
|
+
flags = re.DOTALL | re.MULTILINE
|
247
|
+
|
248
|
+
tokens = {
|
249
|
+
'commentsandwhitespace': [
|
250
|
+
(r'\s+', Text),
|
251
|
+
(r'//.*?\n', Comment.Single),
|
252
|
+
(r'/\*.*?\*/', Comment.Multiline),
|
253
|
+
(r'^\#.*?\n', Comment.Single)
|
254
|
+
],
|
255
|
+
'slashstartsregex': [
|
256
|
+
include('commentsandwhitespace'),
|
257
|
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
258
|
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
259
|
+
(r'(?=/)', Text, ('#pop', 'badregex')),
|
260
|
+
default('#pop')
|
261
|
+
],
|
262
|
+
'badregex': [
|
263
|
+
(r'\n', Text, '#pop')
|
264
|
+
],
|
265
|
+
'root': [
|
266
|
+
include('commentsandwhitespace'),
|
267
|
+
(r'\n', Text),
|
268
|
+
(r'[^\S\n]+', Text),
|
269
|
+
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|\.\.'
|
270
|
+
r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
|
271
|
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
272
|
+
(r'[})\].]', Punctuation),
|
273
|
+
(r'[=+\-*/]', Operator),
|
274
|
+
(r'(for|in|while|do|break|return|continue|if|else|'
|
275
|
+
r'throw|try|catch'
|
276
|
+
r')\b', Keyword, 'slashstartsregex'),
|
277
|
+
(r'(var)\b', Keyword.Declaration, 'slashstartsregex'),
|
278
|
+
(r'(attr|def|fun)\b', Keyword.Reserved),
|
279
|
+
(r'(true|false)\b', Keyword.Constant),
|
280
|
+
(r'(eval|throw)\b', Name.Builtin),
|
281
|
+
(r'`\S+`', Name.Builtin),
|
282
|
+
(r'[$a-zA-Z_]\w*', Name.Other),
|
283
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
284
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
285
|
+
(r'[0-9]+', Number.Integer),
|
286
|
+
(r'"', String.Double, 'dqstring'),
|
287
|
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
288
|
+
],
|
289
|
+
'dqstring': [
|
290
|
+
(r'\$\{[^"}]+?\}', String.Interpol),
|
291
|
+
(r'\$', String.Double),
|
292
|
+
(r'\\\\', String.Double),
|
293
|
+
(r'\\"', String.Double),
|
294
|
+
(r'[^\\"$]+', String.Double),
|
295
|
+
(r'"', String.Double, '#pop'),
|
296
|
+
],
|
297
|
+
}
|
298
|
+
|
299
|
+
|
300
|
+
class LSLLexer(RegexLexer):
|
301
|
+
"""
|
302
|
+
For Second Life's Linden Scripting Language source code.
|
303
|
+
|
304
|
+
.. versionadded:: 2.0
|
305
|
+
"""
|
306
|
+
|
307
|
+
name = 'LSL'
|
308
|
+
aliases = ['lsl']
|
309
|
+
filenames = ['*.lsl']
|
310
|
+
mimetypes = ['text/x-lsl']
|
311
|
+
|
312
|
+
flags = re.MULTILINE
|
313
|
+
|
314
|
+
lsl_keywords = r'\b(?:do|else|for|if|jump|return|while)\b'
|
315
|
+
lsl_types = r'\b(?:float|integer|key|list|quaternion|rotation|string|vector)\b'
|
316
|
+
lsl_states = r'\b(?:(?:state)\s+\w+|default)\b'
|
317
|
+
lsl_events = r'\b(?:state_(?:entry|exit)|touch(?:_(?:start|end))?|(?:land_)?collision(?:_(?:start|end))?|timer|listen|(?:no_)?sensor|control|(?:not_)?at_(?:rot_)?target|money|email|run_time_permissions|changed|attach|dataserver|moving_(?:start|end)|link_message|(?:on|object)_rez|remote_data|http_re(?:sponse|quest)|path_update|transaction_result)\b'
|
318
|
+
lsl_functions_builtin = r'\b(?:ll(?:ReturnObjectsBy(?:ID|Owner)|Json(?:2List|[GS]etValue|ValueType)|Sin|Cos|Tan|Atan2|Sqrt|Pow|Abs|Fabs|Frand|Floor|Ceil|Round|Vec(?:Mag|Norm|Dist)|Rot(?:Between|2(?:Euler|Fwd|Left|Up))|(?:Euler|Axes)2Rot|Whisper|(?:Region|Owner)?Say|Shout|Listen(?:Control|Remove)?|Sensor(?:Repeat|Remove)?|Detected(?:Name|Key|Owner|Type|Pos|Vel|Grab|Rot|Group|LinkNumber)|Die|Ground|Wind|(?:[GS]et)(?:AnimationOverride|MemoryLimit|PrimMediaParams|ParcelMusicURL|Object(?:Desc|Name)|PhysicsMaterial|Status|Scale|Color|Alpha|Texture|Pos|Rot|Force|Torque)|ResetAnimationOverride|(?:Scale|Offset|Rotate)Texture|(?:Rot)?Target(?:Remove)?|(?:Stop)?MoveToTarget|Apply(?:Rotational)?Impulse|Set(?:KeyframedMotion|ContentType|RegionPos|(?:Angular)?Velocity|Buoyancy|HoverHeight|ForceAndTorque|TimerEvent|ScriptState|Damage|TextureAnim|Sound(?:Queueing|Radius)|Vehicle(?:Type|(?:Float|Vector|Rotation)Param)|(?:Touch|Sit)?Text|Camera(?:Eye|At)Offset|PrimitiveParams|ClickAction|Link(?:Alpha|Color|PrimitiveParams(?:Fast)?|Texture(?:Anim)?|Camera|Media)|RemoteScriptAccessPin|PayPrice|LocalRot)|ScaleByFactor|Get(?:(?:Max|Min)ScaleFactor|ClosestNavPoint|StaticPath|SimStats|Env|PrimitiveParams|Link(?:PrimitiveParams|Number(?:OfSides)?|Key|Name|Media)|HTTPHeader|FreeURLs|Object(?:Details|PermMask|PrimCount)|Parcel(?:MaxPrims|Details|Prim(?:Count|Owners))|Attached|(?:SPMax|Free|Used)Memory|Region(?:Name|TimeDilation|FPS|Corner|AgentCount)|Root(?:Position|Rotation)|UnixTime|(?:Parcel|Region)Flags|(?:Wall|GMT)clock|SimulatorHostname|BoundingBox|GeometricCenter|Creator|NumberOf(?:Prims|NotecardLines|Sides)|Animation(?:List)?|(?:Camera|Local)(?:Pos|Rot)|Vel|Accel|Omega|Time(?:stamp|OfDay)|(?:Object|CenterOf)?Mass|MassMKS|Energy|Owner|(?:Owner)?Key|SunDirection|Texture(?:Offset|Scale|Rot)|Inventory(?:Number|Name|Key|Type|Creator|PermMask)|Permissions(?:Key)?|StartParameter|List(?:Length|EntryType)|Date|Agent(?:Size|Info|Language|List)|LandOwnerAt|NotecardLine|Script(?:Name|State))|(?:Get|Reset|GetAndReset)Time|PlaySound(?:Slave)?|LoopSound(?:Master|Slave)?|(?:Trigger|Stop|Preload)Sound|(?:(?:Get|Delete)Sub|Insert)String|To(?:Upper|Lower)|Give(?:InventoryList|Money)|RezObject|(?:Stop)?LookAt|Sleep|CollisionFilter|(?:Take|Release)Controls|DetachFromAvatar|AttachToAvatar(?:Temp)?|InstantMessage|(?:GetNext)?Email|StopHover|MinEventDelay|RotLookAt|String(?:Length|Trim)|(?:Start|Stop)Animation|TargetOmega|RequestPermissions|(?:Create|Break)Link|BreakAllLinks|(?:Give|Remove)Inventory|Water|PassTouches|Request(?:Agent|Inventory)Data|TeleportAgent(?:Home|GlobalCoords)?|ModifyLand|CollisionSound|ResetScript|MessageLinked|PushObject|PassCollisions|AxisAngle2Rot|Rot2(?:Axis|Angle)|A(?:cos|sin)|AngleBetween|AllowInventoryDrop|SubStringIndex|List2(?:CSV|Integer|Json|Float|String|Key|Vector|Rot|List(?:Strided)?)|DeleteSubList|List(?:Statistics|Sort|Randomize|(?:Insert|Find|Replace)List)|EdgeOfWorld|AdjustSoundVolume|Key2Name|TriggerSoundLimited|EjectFromLand|(?:CSV|ParseString)2List|OverMyLand|SameGroup|UnSit|Ground(?:Slope|Normal|Contour)|GroundRepel|(?:Set|Remove)VehicleFlags|(?:AvatarOn)?(?:Link)?SitTarget|Script(?:Danger|Profiler)|Dialog|VolumeDetect|ResetOtherScript|RemoteLoadScriptPin|(?:Open|Close)RemoteDataChannel|SendRemoteData|RemoteDataReply|(?:Integer|String)ToBase64|XorBase64|Log(?:10)?|Base64To(?:String|Integer)|ParseStringKeepNulls|RezAtRoot|RequestSimulatorData|ForceMouselook|(?:Load|Release|(?:E|Une)scape)URL|ParcelMedia(?:CommandList|Query)|ModPow|MapDestination|(?:RemoveFrom|AddTo|Reset)Land(?:Pass|Ban)List|(?:Set|Clear)CameraParams|HTTP(?:Request|Response)|TextBox|DetectedTouch(?:UV|Face|Pos|(?:N|Bin)ormal|ST)|(?:MD5|SHA1|DumpList2)String|Request(?:Secure)?URL|Clear(?:Prim|Link)Media|(?:Link)?ParticleSystem|(?:Get|Request)(?:Username|DisplayName)|RegionSayTo|CastRay|GenerateKey|TransferLindenDollars|ManageEstateAccess|(?:Create|Delete)Character|ExecCharacterCmd|Evade|FleeFrom|NavigateTo|PatrolPoints|Pursue|UpdateCharacter|WanderWithin))\b'
|
319
|
+
lsl_constants_float = r'\b(?:DEG_TO_RAD|PI(?:_BY_TWO)?|RAD_TO_DEG|SQRT2|TWO_PI)\b'
|
320
|
+
lsl_constants_integer = r'\b(?:JSON_APPEND|STATUS_(?:PHYSICS|ROTATE_[XYZ]|PHANTOM|SANDBOX|BLOCK_GRAB(?:_OBJECT)?|(?:DIE|RETURN)_AT_EDGE|CAST_SHADOWS|OK|MALFORMED_PARAMS|TYPE_MISMATCH|BOUNDS_ERROR|NOT_(?:FOUND|SUPPORTED)|INTERNAL_ERROR|WHITELIST_FAILED)|AGENT(?:_(?:BY_(?:LEGACY_|USER)NAME|FLYING|ATTACHMENTS|SCRIPTED|MOUSELOOK|SITTING|ON_OBJECT|AWAY|WALKING|IN_AIR|TYPING|CROUCHING|BUSY|ALWAYS_RUN|AUTOPILOT|LIST_(?:PARCEL(?:_OWNER)?|REGION)))?|CAMERA_(?:PITCH|DISTANCE|BEHINDNESS_(?:ANGLE|LAG)|(?:FOCUS|POSITION)(?:_(?:THRESHOLD|LOCKED|LAG))?|FOCUS_OFFSET|ACTIVE)|ANIM_ON|LOOP|REVERSE|PING_PONG|SMOOTH|ROTATE|SCALE|ALL_SIDES|LINK_(?:ROOT|SET|ALL_(?:OTHERS|CHILDREN)|THIS)|ACTIVE|PASSIVE|SCRIPTED|CONTROL_(?:FWD|BACK|(?:ROT_)?(?:LEFT|RIGHT)|UP|DOWN|(?:ML_)?LBUTTON)|PERMISSION_(?:RETURN_OBJECTS|DEBIT|OVERRIDE_ANIMATIONS|SILENT_ESTATE_MANAGEMENT|TAKE_CONTROLS|TRIGGER_ANIMATION|ATTACH|CHANGE_LINKS|(?:CONTROL|TRACK)_CAMERA|TELEPORT)|INVENTORY_(?:TEXTURE|SOUND|OBJECT|SCRIPT|LANDMARK|CLOTHING|NOTECARD|BODYPART|ANIMATION|GESTURE|ALL|NONE)|CHANGED_(?:INVENTORY|COLOR|SHAPE|SCALE|TEXTURE|LINK|ALLOWED_DROP|OWNER|REGION(?:_START)?|TELEPORT|MEDIA)|OBJECT_(?:(?:PHYSICS|SERVER|STREAMING)_COST|UNKNOWN_DETAIL|CHARACTER_TIME|PHANTOM|PHYSICS|TEMP_ON_REZ|NAME|DESC|POS|PRIM_EQUIVALENCE|RETURN_(?:PARCEL(?:_OWNER)?|REGION)|ROO?T|VELOCITY|OWNER|GROUP|CREATOR|ATTACHED_POINT|RENDER_WEIGHT|PATHFINDING_TYPE|(?:RUNNING|TOTAL)_SCRIPT_COUNT|SCRIPT_(?:MEMORY|TIME))|TYPE_(?:INTEGER|FLOAT|STRING|KEY|VECTOR|ROTATION|INVALID)|(?:DEBUG|PUBLIC)_CHANNEL|ATTACH_(?:AVATAR_CENTER|CHEST|HEAD|BACK|PELVIS|MOUTH|CHIN|NECK|NOSE|BELLY|[LR](?:SHOULDER|HAND|FOOT|EAR|EYE|[UL](?:ARM|LEG)|HIP)|(?:LEFT|RIGHT)_PEC|HUD_(?:CENTER_[12]|TOP_(?:RIGHT|CENTER|LEFT)|BOTTOM(?:_(?:RIGHT|LEFT))?))|LAND_(?:LEVEL|RAISE|LOWER|SMOOTH|NOISE|REVERT)|DATA_(?:ONLINE|NAME|BORN|SIM_(?:POS|STATUS|RATING)|PAYINFO)|PAYMENT_INFO_(?:ON_FILE|USED)|REMOTE_DATA_(?:CHANNEL|REQUEST|REPLY)|PSYS_(?:PART_(?:BF_(?:ZERO|ONE(?:_MINUS_(?:DEST_COLOR|SOURCE_(ALPHA|COLOR)))?|DEST_COLOR|SOURCE_(ALPHA|COLOR))|BLEND_FUNC_(DEST|SOURCE)|FLAGS|(?:START|END)_(?:COLOR|ALPHA|SCALE|GLOW)|MAX_AGE|(?:RIBBON|WIND|INTERP_(?:COLOR|SCALE)|BOUNCE|FOLLOW_(?:SRC|VELOCITY)|TARGET_(?:POS|LINEAR)|EMISSIVE)_MASK)|SRC_(?:MAX_AGE|PATTERN|ANGLE_(?:BEGIN|END)|BURST_(?:RATE|PART_COUNT|RADIUS|SPEED_(?:MIN|MAX))|ACCEL|TEXTURE|TARGET_KEY|OMEGA|PATTERN_(?:DROP|EXPLODE|ANGLE(?:_CONE(?:_EMPTY)?)?)))|VEHICLE_(?:REFERENCE_FRAME|TYPE_(?:NONE|SLED|CAR|BOAT|AIRPLANE|BALLOON)|(?:LINEAR|ANGULAR)_(?:FRICTION_TIMESCALE|MOTOR_DIRECTION)|LINEAR_MOTOR_OFFSET|HOVER_(?:HEIGHT|EFFICIENCY|TIMESCALE)|BUOYANCY|(?:LINEAR|ANGULAR)_(?:DEFLECTION_(?:EFFICIENCY|TIMESCALE)|MOTOR_(?:DECAY_)?TIMESCALE)|VERTICAL_ATTRACTION_(?:EFFICIENCY|TIMESCALE)|BANKING_(?:EFFICIENCY|MIX|TIMESCALE)|FLAG_(?:NO_DEFLECTION_UP|LIMIT_(?:ROLL_ONLY|MOTOR_UP)|HOVER_(?:(?:WATER|TERRAIN|UP)_ONLY|GLOBAL_HEIGHT)|MOUSELOOK_(?:STEER|BANK)|CAMERA_DECOUPLED))|PRIM_(?:TYPE(?:_(?:BOX|CYLINDER|PRISM|SPHERE|TORUS|TUBE|RING|SCULPT))?|HOLE_(?:DEFAULT|CIRCLE|SQUARE|TRIANGLE)|MATERIAL(?:_(?:STONE|METAL|GLASS|WOOD|FLESH|PLASTIC|RUBBER))?|SHINY_(?:NONE|LOW|MEDIUM|HIGH)|BUMP_(?:NONE|BRIGHT|DARK|WOOD|BARK|BRICKS|CHECKER|CONCRETE|TILE|STONE|DISKS|GRAVEL|BLOBS|SIDING|LARGETILE|STUCCO|SUCTION|WEAVE)|TEXGEN_(?:DEFAULT|PLANAR)|SCULPT_(?:TYPE_(?:SPHERE|TORUS|PLANE|CYLINDER|MASK)|FLAG_(?:MIRROR|INVERT))|PHYSICS(?:_(?:SHAPE_(?:CONVEX|NONE|PRIM|TYPE)))?|(?:POS|ROT)_LOCAL|SLICE|TEXT|FLEXIBLE|POINT_LIGHT|TEMP_ON_REZ|PHANTOM|POSITION|SIZE|ROTATION|TEXTURE|NAME|OMEGA|DESC|LINK_TARGET|COLOR|BUMP_SHINY|FULLBRIGHT|TEXGEN|GLOW|MEDIA_(?:ALT_IMAGE_ENABLE|CONTROLS|(?:CURRENT|HOME)_URL|AUTO_(?:LOOP|PLAY|SCALE|ZOOM)|FIRST_CLICK_INTERACT|(?:WIDTH|HEIGHT)_PIXELS|WHITELIST(?:_ENABLE)?|PERMS_(?:INTERACT|CONTROL)|PARAM_MAX|CONTROLS_(?:STANDARD|MINI)|PERM_(?:NONE|OWNER|GROUP|ANYONE)|MAX_(?:URL_LENGTH|WHITELIST_(?:SIZE|COUNT)|(?:WIDTH|HEIGHT)_PIXELS)))|MASK_(?:BASE|OWNER|GROUP|EVERYONE|NEXT)|PERM_(?:TRANSFER|MODIFY|COPY|MOVE|ALL)|PARCEL_(?:MEDIA_COMMAND_(?:STOP|PAUSE|PLAY|LOOP|TEXTURE|URL|TIME|AGENT|UNLOAD|AUTO_ALIGN|TYPE|SIZE|DESC|LOOP_SET)|FLAG_(?:ALLOW_(?:FLY|(?:GROUP_)?SCRIPTS|LANDMARK|TERRAFORM|DAMAGE|CREATE_(?:GROUP_)?OBJECTS)|USE_(?:ACCESS_(?:GROUP|LIST)|BAN_LIST|LAND_PASS_LIST)|LOCAL_SOUND_ONLY|RESTRICT_PUSHOBJECT|ALLOW_(?:GROUP|ALL)_OBJECT_ENTRY)|COUNT_(?:TOTAL|OWNER|GROUP|OTHER|SELECTED|TEMP)|DETAILS_(?:NAME|DESC|OWNER|GROUP|AREA|ID|SEE_AVATARS))|LIST_STAT_(?:MAX|MIN|MEAN|MEDIAN|STD_DEV|SUM(?:_SQUARES)?|NUM_COUNT|GEOMETRIC_MEAN|RANGE)|PAY_(?:HIDE|DEFAULT)|REGION_FLAG_(?:ALLOW_DAMAGE|FIXED_SUN|BLOCK_TERRAFORM|SANDBOX|DISABLE_(?:COLLISIONS|PHYSICS)|BLOCK_FLY|ALLOW_DIRECT_TELEPORT|RESTRICT_PUSHOBJECT)|HTTP_(?:METHOD|MIMETYPE|BODY_(?:MAXLENGTH|TRUNCATED)|CUSTOM_HEADER|PRAGMA_NO_CACHE|VERBOSE_THROTTLE|VERIFY_CERT)|STRING_(?:TRIM(?:_(?:HEAD|TAIL))?)|CLICK_ACTION_(?:NONE|TOUCH|SIT|BUY|PAY|OPEN(?:_MEDIA)?|PLAY|ZOOM)|TOUCH_INVALID_FACE|PROFILE_(?:NONE|SCRIPT_MEMORY)|RC_(?:DATA_FLAGS|DETECT_PHANTOM|GET_(?:LINK_NUM|NORMAL|ROOT_KEY)|MAX_HITS|REJECT_(?:TYPES|AGENTS|(?:NON)?PHYSICAL|LAND))|RCERR_(?:CAST_TIME_EXCEEDED|SIM_PERF_LOW|UNKNOWN)|ESTATE_ACCESS_(?:ALLOWED_(?:AGENT|GROUP)_(?:ADD|REMOVE)|BANNED_AGENT_(?:ADD|REMOVE))|DENSITY|FRICTION|RESTITUTION|GRAVITY_MULTIPLIER|KFM_(?:COMMAND|CMD_(?:PLAY|STOP|PAUSE|SET_MODE)|MODE|FORWARD|LOOP|PING_PONG|REVERSE|DATA|ROTATION|TRANSLATION)|ERR_(?:GENERIC|PARCEL_PERMISSIONS|MALFORMED_PARAMS|RUNTIME_PERMISSIONS|THROTTLED)|CHARACTER_(?:CMD_(?:(?:SMOOTH_)?STOP|JUMP)|DESIRED_(?:TURN_)?SPEED|RADIUS|STAY_WITHIN_PARCEL|LENGTH|ORIENTATION|ACCOUNT_FOR_SKIPPED_FRAMES|AVOIDANCE_MODE|TYPE(?:_(?:[A-D]|NONE))?|MAX_(?:DECEL|TURN_RADIUS|(?:ACCEL|SPEED)))|PURSUIT_(?:OFFSET|FUZZ_FACTOR|GOAL_TOLERANCE|INTERCEPT)|REQUIRE_LINE_OF_SIGHT|FORCE_DIRECT_PATH|VERTICAL|HORIZONTAL|AVOID_(?:CHARACTERS|DYNAMIC_OBSTACLES|NONE)|PU_(?:EVADE_(?:HIDDEN|SPOTTED)|FAILURE_(?:DYNAMIC_PATHFINDING_DISABLED|INVALID_(?:GOAL|START)|NO_(?:NAVMESH|VALID_DESTINATION)|OTHER|TARGET_GONE|(?:PARCEL_)?UNREACHABLE)|(?:GOAL|SLOWDOWN_DISTANCE)_REACHED)|TRAVERSAL_TYPE(?:_(?:FAST|NONE|SLOW))?|CONTENT_TYPE_(?:ATOM|FORM|HTML|JSON|LLSD|RSS|TEXT|XHTML|XML)|GCNP_(?:RADIUS|STATIC)|(?:PATROL|WANDER)_PAUSE_AT_WAYPOINTS|OPT_(?:AVATAR|CHARACTER|EXCLUSION_VOLUME|LEGACY_LINKSET|MATERIAL_VOLUME|OTHER|STATIC_OBSTACLE|WALKABLE)|SIM_STAT_PCT_CHARS_STEPPED)\b'
|
321
|
+
lsl_constants_integer_boolean = r'\b(?:FALSE|TRUE)\b'
|
322
|
+
lsl_constants_rotation = r'\b(?:ZERO_ROTATION)\b'
|
323
|
+
lsl_constants_string = r'\b(?:EOF|JSON_(?:ARRAY|DELETE|FALSE|INVALID|NULL|NUMBER|OBJECT|STRING|TRUE)|NULL_KEY|TEXTURE_(?:BLANK|DEFAULT|MEDIA|PLYWOOD|TRANSPARENT)|URL_REQUEST_(?:GRANTED|DENIED))\b'
|
324
|
+
lsl_constants_vector = r'\b(?:TOUCH_INVALID_(?:TEXCOORD|VECTOR)|ZERO_VECTOR)\b'
|
325
|
+
lsl_invalid_broken = r'\b(?:LAND_(?:LARGE|MEDIUM|SMALL)_BRUSH)\b'
|
326
|
+
lsl_invalid_deprecated = r'\b(?:ATTACH_[LR]PEC|DATA_RATING|OBJECT_ATTACHMENT_(?:GEOMETRY_BYTES|SURFACE_AREA)|PRIM_(?:CAST_SHADOWS|MATERIAL_LIGHT|TYPE_LEGACY)|PSYS_SRC_(?:INNER|OUTER)ANGLE|VEHICLE_FLAG_NO_FLY_UP|ll(?:Cloud|Make(?:Explosion|Fountain|Smoke|Fire)|RemoteDataSetRegion|Sound(?:Preload)?|XorBase64Strings(?:Correct)?))\b'
|
327
|
+
lsl_invalid_illegal = r'\b(?:event)\b'
|
328
|
+
lsl_invalid_unimplemented = r'\b(?:CHARACTER_(?:MAX_ANGULAR_(?:ACCEL|SPEED)|TURN_SPEED_MULTIPLIER)|PERMISSION_(?:CHANGE_(?:JOINTS|PERMISSIONS)|RELEASE_OWNERSHIP|REMAP_CONTROLS)|PRIM_PHYSICS_MATERIAL|PSYS_SRC_OBJ_REL_MASK|ll(?:CollisionSprite|(?:Stop)?PointAt|(?:(?:Refresh|Set)Prim)URL|(?:Take|Release)Camera|RemoteLoadScript))\b'
|
329
|
+
lsl_reserved_godmode = r'\b(?:ll(?:GodLikeRezObject|Set(?:Inventory|Object)PermMask))\b'
|
330
|
+
lsl_reserved_log = r'\b(?:print)\b'
|
331
|
+
lsl_operators = r'\+\+|\-\-|<<|>>|&&?|\|\|?|\^|~|[!%<>=*+\-/]=?'
|
332
|
+
|
333
|
+
tokens = {
|
334
|
+
'root':
|
335
|
+
[
|
336
|
+
(r'//.*?\n', Comment.Single),
|
337
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
338
|
+
(r'"', String.Double, 'string'),
|
339
|
+
(lsl_keywords, Keyword),
|
340
|
+
(lsl_types, Keyword.Type),
|
341
|
+
(lsl_states, Name.Class),
|
342
|
+
(lsl_events, Name.Builtin),
|
343
|
+
(lsl_functions_builtin, Name.Function),
|
344
|
+
(lsl_constants_float, Keyword.Constant),
|
345
|
+
(lsl_constants_integer, Keyword.Constant),
|
346
|
+
(lsl_constants_integer_boolean, Keyword.Constant),
|
347
|
+
(lsl_constants_rotation, Keyword.Constant),
|
348
|
+
(lsl_constants_string, Keyword.Constant),
|
349
|
+
(lsl_constants_vector, Keyword.Constant),
|
350
|
+
(lsl_invalid_broken, Error),
|
351
|
+
(lsl_invalid_deprecated, Error),
|
352
|
+
(lsl_invalid_illegal, Error),
|
353
|
+
(lsl_invalid_unimplemented, Error),
|
354
|
+
(lsl_reserved_godmode, Keyword.Reserved),
|
355
|
+
(lsl_reserved_log, Keyword.Reserved),
|
356
|
+
(r'\b([a-zA-Z_]\w*)\b', Name.Variable),
|
357
|
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d*', Number.Float),
|
358
|
+
(r'(\d+\.\d*|\.\d+)', Number.Float),
|
359
|
+
(r'0[xX][0-9a-fA-F]+', Number.Hex),
|
360
|
+
(r'\d+', Number.Integer),
|
361
|
+
(lsl_operators, Operator),
|
362
|
+
(r':=?', Error),
|
363
|
+
(r'[,;{}()\[\]]', Punctuation),
|
364
|
+
(r'\n+', Whitespace),
|
365
|
+
(r'\s+', Whitespace)
|
366
|
+
],
|
367
|
+
'comment':
|
368
|
+
[
|
369
|
+
(r'[^*/]+', Comment.Multiline),
|
370
|
+
(r'/\*', Comment.Multiline, '#push'),
|
371
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
372
|
+
(r'[*/]', Comment.Multiline)
|
373
|
+
],
|
374
|
+
'string':
|
375
|
+
[
|
376
|
+
(r'\\([nt"\\])', String.Escape),
|
377
|
+
(r'"', String.Double, '#pop'),
|
378
|
+
(r'\\.', Error),
|
379
|
+
(r'[^"\\]+', String.Double),
|
380
|
+
]
|
381
|
+
}
|
382
|
+
|
383
|
+
|
384
|
+
class AppleScriptLexer(RegexLexer):
|
385
|
+
"""
|
386
|
+
For `AppleScript source code
|
387
|
+
<http://developer.apple.com/documentation/AppleScript/
|
388
|
+
Conceptual/AppleScriptLangGuide>`_,
|
389
|
+
including `AppleScript Studio
|
390
|
+
<http://developer.apple.com/documentation/AppleScript/
|
391
|
+
Reference/StudioReference>`_.
|
392
|
+
Contributed by Andreas Amann <aamann@mac.com>.
|
393
|
+
|
394
|
+
.. versionadded:: 1.0
|
395
|
+
"""
|
396
|
+
|
397
|
+
name = 'AppleScript'
|
398
|
+
aliases = ['applescript']
|
399
|
+
filenames = ['*.applescript']
|
400
|
+
|
401
|
+
flags = re.MULTILINE | re.DOTALL
|
402
|
+
|
403
|
+
Identifiers = r'[a-zA-Z]\w*'
|
404
|
+
|
405
|
+
# XXX: use words() for all of these
|
406
|
+
Literals = ('AppleScript', 'current application', 'false', 'linefeed',
|
407
|
+
'missing value', 'pi', 'quote', 'result', 'return', 'space',
|
408
|
+
'tab', 'text item delimiters', 'true', 'version')
|
409
|
+
Classes = ('alias ', 'application ', 'boolean ', 'class ', 'constant ',
|
410
|
+
'date ', 'file ', 'integer ', 'list ', 'number ', 'POSIX file ',
|
411
|
+
'real ', 'record ', 'reference ', 'RGB color ', 'script ',
|
412
|
+
'text ', 'unit types', '(?:Unicode )?text', 'string')
|
413
|
+
BuiltIn = ('attachment', 'attribute run', 'character', 'day', 'month',
|
414
|
+
'paragraph', 'word', 'year')
|
415
|
+
HandlerParams = ('about', 'above', 'against', 'apart from', 'around',
|
416
|
+
'aside from', 'at', 'below', 'beneath', 'beside',
|
417
|
+
'between', 'for', 'given', 'instead of', 'on', 'onto',
|
418
|
+
'out of', 'over', 'since')
|
419
|
+
Commands = ('ASCII (character|number)', 'activate', 'beep', 'choose URL',
|
420
|
+
'choose application', 'choose color', 'choose file( name)?',
|
421
|
+
'choose folder', 'choose from list',
|
422
|
+
'choose remote application', 'clipboard info',
|
423
|
+
'close( access)?', 'copy', 'count', 'current date', 'delay',
|
424
|
+
'delete', 'display (alert|dialog)', 'do shell script',
|
425
|
+
'duplicate', 'exists', 'get eof', 'get volume settings',
|
426
|
+
'info for', 'launch', 'list (disks|folder)', 'load script',
|
427
|
+
'log', 'make', 'mount volume', 'new', 'offset',
|
428
|
+
'open( (for access|location))?', 'path to', 'print', 'quit',
|
429
|
+
'random number', 'read', 'round', 'run( script)?',
|
430
|
+
'say', 'scripting components',
|
431
|
+
'set (eof|the clipboard to|volume)', 'store script',
|
432
|
+
'summarize', 'system attribute', 'system info',
|
433
|
+
'the clipboard', 'time to GMT', 'write', 'quoted form')
|
434
|
+
References = ('(in )?back of', '(in )?front of', '[0-9]+(st|nd|rd|th)',
|
435
|
+
'first', 'second', 'third', 'fourth', 'fifth', 'sixth',
|
436
|
+
'seventh', 'eighth', 'ninth', 'tenth', 'after', 'back',
|
437
|
+
'before', 'behind', 'every', 'front', 'index', 'last',
|
438
|
+
'middle', 'some', 'that', 'through', 'thru', 'where', 'whose')
|
439
|
+
Operators = ("and", "or", "is equal", "equals", "(is )?equal to", "is not",
|
440
|
+
"isn't", "isn't equal( to)?", "is not equal( to)?",
|
441
|
+
"doesn't equal", "does not equal", "(is )?greater than",
|
442
|
+
"comes after", "is not less than or equal( to)?",
|
443
|
+
"isn't less than or equal( to)?", "(is )?less than",
|
444
|
+
"comes before", "is not greater than or equal( to)?",
|
445
|
+
"isn't greater than or equal( to)?",
|
446
|
+
"(is )?greater than or equal( to)?", "is not less than",
|
447
|
+
"isn't less than", "does not come before",
|
448
|
+
"doesn't come before", "(is )?less than or equal( to)?",
|
449
|
+
"is not greater than", "isn't greater than",
|
450
|
+
"does not come after", "doesn't come after", "starts? with",
|
451
|
+
"begins? with", "ends? with", "contains?", "does not contain",
|
452
|
+
"doesn't contain", "is in", "is contained by", "is not in",
|
453
|
+
"is not contained by", "isn't contained by", "div", "mod",
|
454
|
+
"not", "(a )?(ref( to)?|reference to)", "is", "does")
|
455
|
+
Control = ('considering', 'else', 'error', 'exit', 'from', 'if',
|
456
|
+
'ignoring', 'in', 'repeat', 'tell', 'then', 'times', 'to',
|
457
|
+
'try', 'until', 'using terms from', 'while', 'whith',
|
458
|
+
'with timeout( of)?', 'with transaction', 'by', 'continue',
|
459
|
+
'end', 'its?', 'me', 'my', 'return', 'of', 'as')
|
460
|
+
Declarations = ('global', 'local', 'prop(erty)?', 'set', 'get')
|
461
|
+
Reserved = ('but', 'put', 'returning', 'the')
|
462
|
+
StudioClasses = ('action cell', 'alert reply', 'application', 'box',
|
463
|
+
'browser( cell)?', 'bundle', 'button( cell)?', 'cell',
|
464
|
+
'clip view', 'color well', 'color-panel',
|
465
|
+
'combo box( item)?', 'control',
|
466
|
+
'data( (cell|column|item|row|source))?', 'default entry',
|
467
|
+
'dialog reply', 'document', 'drag info', 'drawer',
|
468
|
+
'event', 'font(-panel)?', 'formatter',
|
469
|
+
'image( (cell|view))?', 'matrix', 'menu( item)?', 'item',
|
470
|
+
'movie( view)?', 'open-panel', 'outline view', 'panel',
|
471
|
+
'pasteboard', 'plugin', 'popup button',
|
472
|
+
'progress indicator', 'responder', 'save-panel',
|
473
|
+
'scroll view', 'secure text field( cell)?', 'slider',
|
474
|
+
'sound', 'split view', 'stepper', 'tab view( item)?',
|
475
|
+
'table( (column|header cell|header view|view))',
|
476
|
+
'text( (field( cell)?|view))?', 'toolbar( item)?',
|
477
|
+
'user-defaults', 'view', 'window')
|
478
|
+
StudioEvents = ('accept outline drop', 'accept table drop', 'action',
|
479
|
+
'activated', 'alert ended', 'awake from nib', 'became key',
|
480
|
+
'became main', 'begin editing', 'bounds changed',
|
481
|
+
'cell value', 'cell value changed', 'change cell value',
|
482
|
+
'change item value', 'changed', 'child of item',
|
483
|
+
'choose menu item', 'clicked', 'clicked toolbar item',
|
484
|
+
'closed', 'column clicked', 'column moved',
|
485
|
+
'column resized', 'conclude drop', 'data representation',
|
486
|
+
'deminiaturized', 'dialog ended', 'document nib name',
|
487
|
+
'double clicked', 'drag( (entered|exited|updated))?',
|
488
|
+
'drop', 'end editing', 'exposed', 'idle', 'item expandable',
|
489
|
+
'item value', 'item value changed', 'items changed',
|
490
|
+
'keyboard down', 'keyboard up', 'launched',
|
491
|
+
'load data representation', 'miniaturized', 'mouse down',
|
492
|
+
'mouse dragged', 'mouse entered', 'mouse exited',
|
493
|
+
'mouse moved', 'mouse up', 'moved',
|
494
|
+
'number of browser rows', 'number of items',
|
495
|
+
'number of rows', 'open untitled', 'opened', 'panel ended',
|
496
|
+
'parameters updated', 'plugin loaded', 'prepare drop',
|
497
|
+
'prepare outline drag', 'prepare outline drop',
|
498
|
+
'prepare table drag', 'prepare table drop',
|
499
|
+
'read from file', 'resigned active', 'resigned key',
|
500
|
+
'resigned main', 'resized( sub views)?',
|
501
|
+
'right mouse down', 'right mouse dragged',
|
502
|
+
'right mouse up', 'rows changed', 'scroll wheel',
|
503
|
+
'selected tab view item', 'selection changed',
|
504
|
+
'selection changing', 'should begin editing',
|
505
|
+
'should close', 'should collapse item',
|
506
|
+
'should end editing', 'should expand item',
|
507
|
+
'should open( untitled)?',
|
508
|
+
'should quit( after last window closed)?',
|
509
|
+
'should select column', 'should select item',
|
510
|
+
'should select row', 'should select tab view item',
|
511
|
+
'should selection change', 'should zoom', 'shown',
|
512
|
+
'update menu item', 'update parameters',
|
513
|
+
'update toolbar item', 'was hidden', 'was miniaturized',
|
514
|
+
'will become active', 'will close', 'will dismiss',
|
515
|
+
'will display browser cell', 'will display cell',
|
516
|
+
'will display item cell', 'will display outline cell',
|
517
|
+
'will finish launching', 'will hide', 'will miniaturize',
|
518
|
+
'will move', 'will open', 'will pop up', 'will quit',
|
519
|
+
'will resign active', 'will resize( sub views)?',
|
520
|
+
'will select tab view item', 'will show', 'will zoom',
|
521
|
+
'write to file', 'zoomed')
|
522
|
+
StudioCommands = ('animate', 'append', 'call method', 'center',
|
523
|
+
'close drawer', 'close panel', 'display',
|
524
|
+
'display alert', 'display dialog', 'display panel', 'go',
|
525
|
+
'hide', 'highlight', 'increment', 'item for',
|
526
|
+
'load image', 'load movie', 'load nib', 'load panel',
|
527
|
+
'load sound', 'localized string', 'lock focus', 'log',
|
528
|
+
'open drawer', 'path for', 'pause', 'perform action',
|
529
|
+
'play', 'register', 'resume', 'scroll', 'select( all)?',
|
530
|
+
'show', 'size to fit', 'start', 'step back',
|
531
|
+
'step forward', 'stop', 'synchronize', 'unlock focus',
|
532
|
+
'update')
|
533
|
+
StudioProperties = ('accepts arrow key', 'action method', 'active',
|
534
|
+
'alignment', 'allowed identifiers',
|
535
|
+
'allows branch selection', 'allows column reordering',
|
536
|
+
'allows column resizing', 'allows column selection',
|
537
|
+
'allows customization',
|
538
|
+
'allows editing text attributes',
|
539
|
+
'allows empty selection', 'allows mixed state',
|
540
|
+
'allows multiple selection', 'allows reordering',
|
541
|
+
'allows undo', 'alpha( value)?', 'alternate image',
|
542
|
+
'alternate increment value', 'alternate title',
|
543
|
+
'animation delay', 'associated file name',
|
544
|
+
'associated object', 'auto completes', 'auto display',
|
545
|
+
'auto enables items', 'auto repeat',
|
546
|
+
'auto resizes( outline column)?',
|
547
|
+
'auto save expanded items', 'auto save name',
|
548
|
+
'auto save table columns', 'auto saves configuration',
|
549
|
+
'auto scroll', 'auto sizes all columns to fit',
|
550
|
+
'auto sizes cells', 'background color', 'bezel state',
|
551
|
+
'bezel style', 'bezeled', 'border rect', 'border type',
|
552
|
+
'bordered', 'bounds( rotation)?', 'box type',
|
553
|
+
'button returned', 'button type',
|
554
|
+
'can choose directories', 'can choose files',
|
555
|
+
'can draw', 'can hide',
|
556
|
+
'cell( (background color|size|type))?', 'characters',
|
557
|
+
'class', 'click count', 'clicked( data)? column',
|
558
|
+
'clicked data item', 'clicked( data)? row',
|
559
|
+
'closeable', 'collating', 'color( (mode|panel))',
|
560
|
+
'command key down', 'configuration',
|
561
|
+
'content(s| (size|view( margins)?))?', 'context',
|
562
|
+
'continuous', 'control key down', 'control size',
|
563
|
+
'control tint', 'control view',
|
564
|
+
'controller visible', 'coordinate system',
|
565
|
+
'copies( on scroll)?', 'corner view', 'current cell',
|
566
|
+
'current column', 'current( field)? editor',
|
567
|
+
'current( menu)? item', 'current row',
|
568
|
+
'current tab view item', 'data source',
|
569
|
+
'default identifiers', 'delta (x|y|z)',
|
570
|
+
'destination window', 'directory', 'display mode',
|
571
|
+
'displayed cell', 'document( (edited|rect|view))?',
|
572
|
+
'double value', 'dragged column', 'dragged distance',
|
573
|
+
'dragged items', 'draws( cell)? background',
|
574
|
+
'draws grid', 'dynamically scrolls', 'echos bullets',
|
575
|
+
'edge', 'editable', 'edited( data)? column',
|
576
|
+
'edited data item', 'edited( data)? row', 'enabled',
|
577
|
+
'enclosing scroll view', 'ending page',
|
578
|
+
'error handling', 'event number', 'event type',
|
579
|
+
'excluded from windows menu', 'executable path',
|
580
|
+
'expanded', 'fax number', 'field editor', 'file kind',
|
581
|
+
'file name', 'file type', 'first responder',
|
582
|
+
'first visible column', 'flipped', 'floating',
|
583
|
+
'font( panel)?', 'formatter', 'frameworks path',
|
584
|
+
'frontmost', 'gave up', 'grid color', 'has data items',
|
585
|
+
'has horizontal ruler', 'has horizontal scroller',
|
586
|
+
'has parent data item', 'has resize indicator',
|
587
|
+
'has shadow', 'has sub menu', 'has vertical ruler',
|
588
|
+
'has vertical scroller', 'header cell', 'header view',
|
589
|
+
'hidden', 'hides when deactivated', 'highlights by',
|
590
|
+
'horizontal line scroll', 'horizontal page scroll',
|
591
|
+
'horizontal ruler view', 'horizontally resizable',
|
592
|
+
'icon image', 'id', 'identifier',
|
593
|
+
'ignores multiple clicks',
|
594
|
+
'image( (alignment|dims when disabled|frame style|scaling))?',
|
595
|
+
'imports graphics', 'increment value',
|
596
|
+
'indentation per level', 'indeterminate', 'index',
|
597
|
+
'integer value', 'intercell spacing', 'item height',
|
598
|
+
'key( (code|equivalent( modifier)?|window))?',
|
599
|
+
'knob thickness', 'label', 'last( visible)? column',
|
600
|
+
'leading offset', 'leaf', 'level', 'line scroll',
|
601
|
+
'loaded', 'localized sort', 'location', 'loop mode',
|
602
|
+
'main( (bunde|menu|window))?', 'marker follows cell',
|
603
|
+
'matrix mode', 'maximum( content)? size',
|
604
|
+
'maximum visible columns',
|
605
|
+
'menu( form representation)?', 'miniaturizable',
|
606
|
+
'miniaturized', 'minimized image', 'minimized title',
|
607
|
+
'minimum column width', 'minimum( content)? size',
|
608
|
+
'modal', 'modified', 'mouse down state',
|
609
|
+
'movie( (controller|file|rect))?', 'muted', 'name',
|
610
|
+
'needs display', 'next state', 'next text',
|
611
|
+
'number of tick marks', 'only tick mark values',
|
612
|
+
'opaque', 'open panel', 'option key down',
|
613
|
+
'outline table column', 'page scroll', 'pages across',
|
614
|
+
'pages down', 'palette label', 'pane splitter',
|
615
|
+
'parent data item', 'parent window', 'pasteboard',
|
616
|
+
'path( (names|separator))?', 'playing',
|
617
|
+
'plays every frame', 'plays selection only', 'position',
|
618
|
+
'preferred edge', 'preferred type', 'pressure',
|
619
|
+
'previous text', 'prompt', 'properties',
|
620
|
+
'prototype cell', 'pulls down', 'rate',
|
621
|
+
'released when closed', 'repeated',
|
622
|
+
'requested print time', 'required file type',
|
623
|
+
'resizable', 'resized column', 'resource path',
|
624
|
+
'returns records', 'reuses columns', 'rich text',
|
625
|
+
'roll over', 'row height', 'rulers visible',
|
626
|
+
'save panel', 'scripts path', 'scrollable',
|
627
|
+
'selectable( identifiers)?', 'selected cell',
|
628
|
+
'selected( data)? columns?', 'selected data items?',
|
629
|
+
'selected( data)? rows?', 'selected item identifier',
|
630
|
+
'selection by rect', 'send action on arrow key',
|
631
|
+
'sends action when done editing', 'separates columns',
|
632
|
+
'separator item', 'sequence number', 'services menu',
|
633
|
+
'shared frameworks path', 'shared support path',
|
634
|
+
'sheet', 'shift key down', 'shows alpha',
|
635
|
+
'shows state by', 'size( mode)?',
|
636
|
+
'smart insert delete enabled', 'sort case sensitivity',
|
637
|
+
'sort column', 'sort order', 'sort type',
|
638
|
+
'sorted( data rows)?', 'sound', 'source( mask)?',
|
639
|
+
'spell checking enabled', 'starting page', 'state',
|
640
|
+
'string value', 'sub menu', 'super menu', 'super view',
|
641
|
+
'tab key traverses cells', 'tab state', 'tab type',
|
642
|
+
'tab view', 'table view', 'tag', 'target( printer)?',
|
643
|
+
'text color', 'text container insert',
|
644
|
+
'text container origin', 'text returned',
|
645
|
+
'tick mark position', 'time stamp',
|
646
|
+
'title(d| (cell|font|height|position|rect))?',
|
647
|
+
'tool tip', 'toolbar', 'trailing offset', 'transparent',
|
648
|
+
'treat packages as directories', 'truncated labels',
|
649
|
+
'types', 'unmodified characters', 'update views',
|
650
|
+
'use sort indicator', 'user defaults',
|
651
|
+
'uses data source', 'uses ruler',
|
652
|
+
'uses threaded animation',
|
653
|
+
'uses title from previous column', 'value wraps',
|
654
|
+
'version',
|
655
|
+
'vertical( (line scroll|page scroll|ruler view))?',
|
656
|
+
'vertically resizable', 'view',
|
657
|
+
'visible( document rect)?', 'volume', 'width', 'window',
|
658
|
+
'windows menu', 'wraps', 'zoomable', 'zoomed')
|
659
|
+
|
660
|
+
tokens = {
|
661
|
+
'root': [
|
662
|
+
(r'\s+', Text),
|
663
|
+
(u'¬\\n', String.Escape),
|
664
|
+
(r"'s\s+", Text), # This is a possessive, consider moving
|
665
|
+
(r'(--|#).*?$', Comment),
|
666
|
+
(r'\(\*', Comment.Multiline, 'comment'),
|
667
|
+
(r'[(){}!,.:]', Punctuation),
|
668
|
+
(u'(«)([^»]+)(»)',
|
669
|
+
bygroups(Text, Name.Builtin, Text)),
|
670
|
+
(r'\b((?:considering|ignoring)\s*)'
|
671
|
+
r'(application responses|case|diacriticals|hyphens|'
|
672
|
+
r'numeric strings|punctuation|white space)',
|
673
|
+
bygroups(Keyword, Name.Builtin)),
|
674
|
+
(u'(-|\\*|\\+|&|≠|>=?|<=?|=|≥|≤|/|÷|\\^)', Operator),
|
675
|
+
(r"\b(%s)\b" % '|'.join(Operators), Operator.Word),
|
676
|
+
(r'^(\s*(?:on|end)\s+)'
|
677
|
+
r'(%s)' % '|'.join(StudioEvents[::-1]),
|
678
|
+
bygroups(Keyword, Name.Function)),
|
679
|
+
(r'^(\s*)(in|on|script|to)(\s+)', bygroups(Text, Keyword, Text)),
|
680
|
+
(r'\b(as )(%s)\b' % '|'.join(Classes),
|
681
|
+
bygroups(Keyword, Name.Class)),
|
682
|
+
(r'\b(%s)\b' % '|'.join(Literals), Name.Constant),
|
683
|
+
(r'\b(%s)\b' % '|'.join(Commands), Name.Builtin),
|
684
|
+
(r'\b(%s)\b' % '|'.join(Control), Keyword),
|
685
|
+
(r'\b(%s)\b' % '|'.join(Declarations), Keyword),
|
686
|
+
(r'\b(%s)\b' % '|'.join(Reserved), Name.Builtin),
|
687
|
+
(r'\b(%s)s?\b' % '|'.join(BuiltIn), Name.Builtin),
|
688
|
+
(r'\b(%s)\b' % '|'.join(HandlerParams), Name.Builtin),
|
689
|
+
(r'\b(%s)\b' % '|'.join(StudioProperties), Name.Attribute),
|
690
|
+
(r'\b(%s)s?\b' % '|'.join(StudioClasses), Name.Builtin),
|
691
|
+
(r'\b(%s)\b' % '|'.join(StudioCommands), Name.Builtin),
|
692
|
+
(r'\b(%s)\b' % '|'.join(References), Name.Builtin),
|
693
|
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
694
|
+
(r'\b(%s)\b' % Identifiers, Name.Variable),
|
695
|
+
(r'[-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?', Number.Float),
|
696
|
+
(r'[-+]?\d+', Number.Integer),
|
697
|
+
],
|
698
|
+
'comment': [
|
699
|
+
('\(\*', Comment.Multiline, '#push'),
|
700
|
+
('\*\)', Comment.Multiline, '#pop'),
|
701
|
+
('[^*(]+', Comment.Multiline),
|
702
|
+
('[*(]', Comment.Multiline),
|
703
|
+
],
|
704
|
+
}
|
705
|
+
|
706
|
+
|
707
|
+
class RexxLexer(RegexLexer):
|
708
|
+
"""
|
709
|
+
`Rexx <http://www.rexxinfo.org/>`_ is a scripting language available for
|
710
|
+
a wide range of different platforms with its roots found on mainframe
|
711
|
+
systems. It is popular for I/O- and data based tasks and can act as glue
|
712
|
+
language to bind different applications together.
|
713
|
+
|
714
|
+
.. versionadded:: 2.0
|
715
|
+
"""
|
716
|
+
name = 'Rexx'
|
717
|
+
aliases = ['rexx', 'arexx']
|
718
|
+
filenames = ['*.rexx', '*.rex', '*.rx', '*.arexx']
|
719
|
+
mimetypes = ['text/x-rexx']
|
720
|
+
flags = re.IGNORECASE
|
721
|
+
|
722
|
+
tokens = {
|
723
|
+
'root': [
|
724
|
+
(r'\s', Whitespace),
|
725
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
726
|
+
(r'"', String, 'string_double'),
|
727
|
+
(r"'", String, 'string_single'),
|
728
|
+
(r'[0-9]+(\.[0-9]+)?(e[+-]?[0-9])?', Number),
|
729
|
+
(r'([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b',
|
730
|
+
bygroups(Name.Function, Whitespace, Operator, Whitespace,
|
731
|
+
Keyword.Declaration)),
|
732
|
+
(r'([a-z_]\w*)(\s*)(:)',
|
733
|
+
bygroups(Name.Label, Whitespace, Operator)),
|
734
|
+
include('function'),
|
735
|
+
include('keyword'),
|
736
|
+
include('operator'),
|
737
|
+
(r'[a-z_]\w*', Text),
|
738
|
+
],
|
739
|
+
'function': [
|
740
|
+
(words((
|
741
|
+
'abbrev', 'abs', 'address', 'arg', 'b2x', 'bitand', 'bitor', 'bitxor',
|
742
|
+
'c2d', 'c2x', 'center', 'charin', 'charout', 'chars', 'compare',
|
743
|
+
'condition', 'copies', 'd2c', 'd2x', 'datatype', 'date', 'delstr',
|
744
|
+
'delword', 'digits', 'errortext', 'form', 'format', 'fuzz', 'insert',
|
745
|
+
'lastpos', 'left', 'length', 'linein', 'lineout', 'lines', 'max',
|
746
|
+
'min', 'overlay', 'pos', 'queued', 'random', 'reverse', 'right', 'sign',
|
747
|
+
'sourceline', 'space', 'stream', 'strip', 'substr', 'subword', 'symbol',
|
748
|
+
'time', 'trace', 'translate', 'trunc', 'value', 'verify', 'word',
|
749
|
+
'wordindex', 'wordlength', 'wordpos', 'words', 'x2b', 'x2c', 'x2d',
|
750
|
+
'xrange'), suffix=r'(\s*)(\()'),
|
751
|
+
bygroups(Name.Builtin, Whitespace, Operator)),
|
752
|
+
],
|
753
|
+
'keyword': [
|
754
|
+
(r'(address|arg|by|call|do|drop|else|end|exit|for|forever|if|'
|
755
|
+
r'interpret|iterate|leave|nop|numeric|off|on|options|parse|'
|
756
|
+
r'pull|push|queue|return|say|select|signal|to|then|trace|until|'
|
757
|
+
r'while)\b', Keyword.Reserved),
|
758
|
+
],
|
759
|
+
'operator': [
|
760
|
+
(r'(-|//|/|\(|\)|\*\*|\*|\\<<|\\<|\\==|\\=|\\>>|\\>|\\|\|\||\||'
|
761
|
+
r'&&|&|%|\+|<<=|<<|<=|<>|<|==|=|><|>=|>>=|>>|>|¬<<|¬<|¬==|¬=|'
|
762
|
+
r'¬>>|¬>|¬|\.|,)', Operator),
|
763
|
+
],
|
764
|
+
'string_double': [
|
765
|
+
(r'[^"\n]+', String),
|
766
|
+
(r'""', String),
|
767
|
+
(r'"', String, '#pop'),
|
768
|
+
(r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
|
769
|
+
],
|
770
|
+
'string_single': [
|
771
|
+
(r'[^\'\n]', String),
|
772
|
+
(r'\'\'', String),
|
773
|
+
(r'\'', String, '#pop'),
|
774
|
+
(r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
|
775
|
+
],
|
776
|
+
'comment': [
|
777
|
+
(r'[^*]+', Comment.Multiline),
|
778
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
779
|
+
(r'\*', Comment.Multiline),
|
780
|
+
]
|
781
|
+
}
|
782
|
+
|
783
|
+
_c = lambda s: re.compile(s, re.MULTILINE)
|
784
|
+
_ADDRESS_COMMAND_PATTERN = _c(r'^\s*address\s+command\b')
|
785
|
+
_ADDRESS_PATTERN = _c(r'^\s*address\s+')
|
786
|
+
_DO_WHILE_PATTERN = _c(r'^\s*do\s+while\b')
|
787
|
+
_IF_THEN_DO_PATTERN = _c(r'^\s*if\b.+\bthen\s+do\s*$')
|
788
|
+
_PROCEDURE_PATTERN = _c(r'^\s*([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b')
|
789
|
+
_ELSE_DO_PATTERN = _c(r'\belse\s+do\s*$')
|
790
|
+
_PARSE_ARG_PATTERN = _c(r'^\s*parse\s+(upper\s+)?(arg|value)\b')
|
791
|
+
PATTERNS_AND_WEIGHTS = (
|
792
|
+
(_ADDRESS_COMMAND_PATTERN, 0.2),
|
793
|
+
(_ADDRESS_PATTERN, 0.05),
|
794
|
+
(_DO_WHILE_PATTERN, 0.1),
|
795
|
+
(_ELSE_DO_PATTERN, 0.1),
|
796
|
+
(_IF_THEN_DO_PATTERN, 0.1),
|
797
|
+
(_PROCEDURE_PATTERN, 0.5),
|
798
|
+
(_PARSE_ARG_PATTERN, 0.2),
|
799
|
+
)
|
800
|
+
|
801
|
+
def analyse_text(text):
|
802
|
+
"""
|
803
|
+
Check for inital comment and patterns that distinguish Rexx from other
|
804
|
+
C-like languages.
|
805
|
+
"""
|
806
|
+
if re.search(r'/\*\**\s*rexx', text, re.IGNORECASE):
|
807
|
+
# Header matches MVS Rexx requirements, this is certainly a Rexx
|
808
|
+
# script.
|
809
|
+
return 1.0
|
810
|
+
elif text.startswith('/*'):
|
811
|
+
# Header matches general Rexx requirements; the source code might
|
812
|
+
# still be any language using C comments such as C++, C# or Java.
|
813
|
+
lowerText = text.lower()
|
814
|
+
result = sum(weight
|
815
|
+
for (pattern, weight) in RexxLexer.PATTERNS_AND_WEIGHTS
|
816
|
+
if pattern.search(lowerText)) + 0.01
|
817
|
+
return min(result, 1.0)
|
818
|
+
|
819
|
+
|
820
|
+
class MOOCodeLexer(RegexLexer):
|
821
|
+
"""
|
822
|
+
For `MOOCode <http://www.moo.mud.org/>`_ (the MOO scripting
|
823
|
+
language).
|
824
|
+
|
825
|
+
.. versionadded:: 0.9
|
826
|
+
"""
|
827
|
+
name = 'MOOCode'
|
828
|
+
filenames = ['*.moo']
|
829
|
+
aliases = ['moocode', 'moo']
|
830
|
+
mimetypes = ['text/x-moocode']
|
831
|
+
|
832
|
+
tokens = {
|
833
|
+
'root': [
|
834
|
+
# Numbers
|
835
|
+
(r'(0|[1-9][0-9_]*)', Number.Integer),
|
836
|
+
# Strings
|
837
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
838
|
+
# exceptions
|
839
|
+
(r'(E_PERM|E_DIV)', Name.Exception),
|
840
|
+
# db-refs
|
841
|
+
(r'((#[-0-9]+)|(\$\w+))', Name.Entity),
|
842
|
+
# Keywords
|
843
|
+
(r'\b(if|else|elseif|endif|for|endfor|fork|endfork|while'
|
844
|
+
r'|endwhile|break|continue|return|try'
|
845
|
+
r'|except|endtry|finally|in)\b', Keyword),
|
846
|
+
# builtins
|
847
|
+
(r'(random|length)', Name.Builtin),
|
848
|
+
# special variables
|
849
|
+
(r'(player|caller|this|args)', Name.Variable.Instance),
|
850
|
+
# skip whitespace
|
851
|
+
(r'\s+', Text),
|
852
|
+
(r'\n', Text),
|
853
|
+
# other operators
|
854
|
+
(r'([!;=,{}&|:.\[\]@()<>?]+)', Operator),
|
855
|
+
# function call
|
856
|
+
(r'(\w+)(\()', bygroups(Name.Function, Operator)),
|
857
|
+
# variables
|
858
|
+
(r'(\w+)', Text),
|
859
|
+
]
|
860
|
+
}
|
861
|
+
|
862
|
+
|
863
|
+
class HybrisLexer(RegexLexer):
|
864
|
+
"""
|
865
|
+
For `Hybris <http://www.hybris-lang.org>`_ source code.
|
866
|
+
|
867
|
+
.. versionadded:: 1.4
|
868
|
+
"""
|
869
|
+
|
870
|
+
name = 'Hybris'
|
871
|
+
aliases = ['hybris', 'hy']
|
872
|
+
filenames = ['*.hy', '*.hyb']
|
873
|
+
mimetypes = ['text/x-hybris', 'application/x-hybris']
|
874
|
+
|
875
|
+
flags = re.MULTILINE | re.DOTALL
|
876
|
+
|
877
|
+
tokens = {
|
878
|
+
'root': [
|
879
|
+
# method names
|
880
|
+
(r'^(\s*(?:function|method|operator\s+)+?)'
|
881
|
+
r'([a-zA-Z_]\w*)'
|
882
|
+
r'(\s*)(\()', bygroups(Keyword, Name.Function, Text, Operator)),
|
883
|
+
(r'[^\S\n]+', Text),
|
884
|
+
(r'//.*?\n', Comment.Single),
|
885
|
+
(r'/\*.*?\*/', Comment.Multiline),
|
886
|
+
(r'@[a-zA-Z_][\w.]*', Name.Decorator),
|
887
|
+
(r'(break|case|catch|next|default|do|else|finally|for|foreach|of|'
|
888
|
+
r'unless|if|new|return|switch|me|throw|try|while)\b', Keyword),
|
889
|
+
(r'(extends|private|protected|public|static|throws|function|method|'
|
890
|
+
r'operator)\b', Keyword.Declaration),
|
891
|
+
(r'(true|false|null|__FILE__|__LINE__|__VERSION__|__LIB_PATH__|'
|
892
|
+
r'__INC_PATH__)\b', Keyword.Constant),
|
893
|
+
(r'(class|struct)(\s+)',
|
894
|
+
bygroups(Keyword.Declaration, Text), 'class'),
|
895
|
+
(r'(import|include)(\s+)',
|
896
|
+
bygroups(Keyword.Namespace, Text), 'import'),
|
897
|
+
(words((
|
898
|
+
'gc_collect', 'gc_mm_items', 'gc_mm_usage', 'gc_collect_threshold',
|
899
|
+
'urlencode', 'urldecode', 'base64encode', 'base64decode', 'sha1', 'crc32',
|
900
|
+
'sha2', 'md5', 'md5_file', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos',
|
901
|
+
'cosh', 'exp', 'fabs', 'floor', 'fmod', 'log', 'log10', 'pow', 'sin',
|
902
|
+
'sinh', 'sqrt', 'tan', 'tanh', 'isint', 'isfloat', 'ischar', 'isstring',
|
903
|
+
'isarray', 'ismap', 'isalias', 'typeof', 'sizeof', 'toint', 'tostring',
|
904
|
+
'fromxml', 'toxml', 'binary', 'pack', 'load', 'eval', 'var_names',
|
905
|
+
'var_values', 'user_functions', 'dyn_functions', 'methods', 'call',
|
906
|
+
'call_method', 'mknod', 'mkfifo', 'mount', 'umount2', 'umount', 'ticks',
|
907
|
+
'usleep', 'sleep', 'time', 'strtime', 'strdate', 'dllopen', 'dlllink',
|
908
|
+
'dllcall', 'dllcall_argv', 'dllclose', 'env', 'exec', 'fork', 'getpid',
|
909
|
+
'wait', 'popen', 'pclose', 'exit', 'kill', 'pthread_create',
|
910
|
+
'pthread_create_argv', 'pthread_exit', 'pthread_join', 'pthread_kill',
|
911
|
+
'smtp_send', 'http_get', 'http_post', 'http_download', 'socket', 'bind',
|
912
|
+
'listen', 'accept', 'getsockname', 'getpeername', 'settimeout', 'connect',
|
913
|
+
'server', 'recv', 'send', 'close', 'print', 'println', 'printf', 'input',
|
914
|
+
'readline', 'serial_open', 'serial_fcntl', 'serial_get_attr',
|
915
|
+
'serial_get_ispeed', 'serial_get_ospeed', 'serial_set_attr',
|
916
|
+
'serial_set_ispeed', 'serial_set_ospeed', 'serial_write', 'serial_read',
|
917
|
+
'serial_close', 'xml_load', 'xml_parse', 'fopen', 'fseek', 'ftell',
|
918
|
+
'fsize', 'fread', 'fwrite', 'fgets', 'fclose', 'file', 'readdir',
|
919
|
+
'pcre_replace', 'size', 'pop', 'unmap', 'has', 'keys', 'values',
|
920
|
+
'length', 'find', 'substr', 'replace', 'split', 'trim', 'remove',
|
921
|
+
'contains', 'join'), suffix=r'\b'),
|
922
|
+
Name.Builtin),
|
923
|
+
(words((
|
924
|
+
'MethodReference', 'Runner', 'Dll', 'Thread', 'Pipe', 'Process',
|
925
|
+
'Runnable', 'CGI', 'ClientSocket', 'Socket', 'ServerSocket',
|
926
|
+
'File', 'Console', 'Directory', 'Exception'), suffix=r'\b'),
|
927
|
+
Keyword.Type),
|
928
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
929
|
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
|
930
|
+
(r'(\.)([a-zA-Z_]\w*)',
|
931
|
+
bygroups(Operator, Name.Attribute)),
|
932
|
+
(r'[a-zA-Z_]\w*:', Name.Label),
|
933
|
+
(r'[a-zA-Z_$]\w*', Name),
|
934
|
+
(r'[~^*!%&\[\](){}<>|+=:;,./?\-@]+', Operator),
|
935
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
936
|
+
(r'0x[0-9a-f]+', Number.Hex),
|
937
|
+
(r'[0-9]+L?', Number.Integer),
|
938
|
+
(r'\n', Text),
|
939
|
+
],
|
940
|
+
'class': [
|
941
|
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop')
|
942
|
+
],
|
943
|
+
'import': [
|
944
|
+
(r'[\w.]+\*?', Name.Namespace, '#pop')
|
945
|
+
],
|
946
|
+
}
|
947
|
+
|
948
|
+
|
949
|
+
class EasytrieveLexer(RegexLexer):
|
950
|
+
"""
|
951
|
+
Easytrieve Plus is a programming language for extracting, filtering and
|
952
|
+
converting sequential data. Furthermore it can layout data for reports.
|
953
|
+
It is mainly used on mainframe platforms and can access several of the
|
954
|
+
mainframe's native file formats. It is somewhat comparable to awk.
|
955
|
+
|
956
|
+
.. versionadded:: 2.1
|
957
|
+
"""
|
958
|
+
name = 'Easytrieve'
|
959
|
+
aliases = ['easytrieve']
|
960
|
+
filenames = ['*.ezt', '*.mac']
|
961
|
+
mimetypes = ['text/x-easytrieve']
|
962
|
+
flags = 0
|
963
|
+
|
964
|
+
# Note: We cannot use r'\b' at the start and end of keywords because
|
965
|
+
# Easytrieve Plus delimiter characters are:
|
966
|
+
#
|
967
|
+
# * space ( )
|
968
|
+
# * apostrophe (')
|
969
|
+
# * period (.)
|
970
|
+
# * comma (,)
|
971
|
+
# * paranthesis ( and )
|
972
|
+
# * colon (:)
|
973
|
+
#
|
974
|
+
# Additionally words end once a '*' appears, indicatins a comment.
|
975
|
+
_DELIMITERS = r' \'.,():\n'
|
976
|
+
_DELIMITERS_OR_COMENT = _DELIMITERS + '*'
|
977
|
+
_DELIMITER_PATTERN = '[' + _DELIMITERS + ']'
|
978
|
+
_DELIMITER_PATTERN_CAPTURE = '(' + _DELIMITER_PATTERN + ')'
|
979
|
+
_NON_DELIMITER_OR_COMMENT_PATTERN = '[^' + _DELIMITERS_OR_COMENT + ']'
|
980
|
+
_OPERATORS_PATTERN = u'[.+\\-/=\\[\\](){}<>;,&%¬]'
|
981
|
+
_KEYWORDS = [
|
982
|
+
'AFTER-BREAK', 'AFTER-LINE', 'AFTER-SCREEN', 'AIM', 'AND', 'ATTR',
|
983
|
+
'BEFORE', 'BEFORE-BREAK', 'BEFORE-LINE', 'BEFORE-SCREEN', 'BUSHU',
|
984
|
+
'BY', 'CALL', 'CASE', 'CHECKPOINT', 'CHKP', 'CHKP-STATUS', 'CLEAR',
|
985
|
+
'CLOSE', 'COL', 'COLOR', 'COMMIT', 'CONTROL', 'COPY', 'CURSOR', 'D',
|
986
|
+
'DECLARE', 'DEFAULT', 'DEFINE', 'DELETE', 'DENWA', 'DISPLAY', 'DLI',
|
987
|
+
'DO', 'DUPLICATE', 'E', 'ELSE', 'ELSE-IF', 'END', 'END-CASE',
|
988
|
+
'END-DO', 'END-IF', 'END-PROC', 'ENDPAGE', 'ENDTABLE', 'ENTER', 'EOF',
|
989
|
+
'EQ', 'ERROR', 'EXIT', 'EXTERNAL', 'EZLIB', 'F1', 'F10', 'F11', 'F12',
|
990
|
+
'F13', 'F14', 'F15', 'F16', 'F17', 'F18', 'F19', 'F2', 'F20', 'F21',
|
991
|
+
'F22', 'F23', 'F24', 'F25', 'F26', 'F27', 'F28', 'F29', 'F3', 'F30',
|
992
|
+
'F31', 'F32', 'F33', 'F34', 'F35', 'F36', 'F4', 'F5', 'F6', 'F7',
|
993
|
+
'F8', 'F9', 'FETCH', 'FILE-STATUS', 'FILL', 'FINAL', 'FIRST',
|
994
|
+
'FIRST-DUP', 'FOR', 'GE', 'GET', 'GO', 'GOTO', 'GQ', 'GR', 'GT',
|
995
|
+
'HEADING', 'HEX', 'HIGH-VALUES', 'IDD', 'IDMS', 'IF', 'IN', 'INSERT',
|
996
|
+
'JUSTIFY', 'KANJI-DATE', 'KANJI-DATE-LONG', 'KANJI-TIME', 'KEY',
|
997
|
+
'KEY-PRESSED', 'KOKUGO', 'KUN', 'LAST-DUP', 'LE', 'LEVEL', 'LIKE',
|
998
|
+
'LINE', 'LINE-COUNT', 'LINE-NUMBER', 'LINK', 'LIST', 'LOW-VALUES',
|
999
|
+
'LQ', 'LS', 'LT', 'MACRO', 'MASK', 'MATCHED', 'MEND', 'MESSAGE',
|
1000
|
+
'MOVE', 'MSTART', 'NE', 'NEWPAGE', 'NOMASK', 'NOPRINT', 'NOT',
|
1001
|
+
'NOTE', 'NOVERIFY', 'NQ', 'NULL', 'OF', 'OR', 'OTHERWISE', 'PA1',
|
1002
|
+
'PA2', 'PA3', 'PAGE-COUNT', 'PAGE-NUMBER', 'PARM-REGISTER',
|
1003
|
+
'PATH-ID', 'PATTERN', 'PERFORM', 'POINT', 'POS', 'PRIMARY', 'PRINT',
|
1004
|
+
'PROCEDURE', 'PROGRAM', 'PUT', 'READ', 'RECORD', 'RECORD-COUNT',
|
1005
|
+
'RECORD-LENGTH', 'REFRESH', 'RELEASE', 'RENUM', 'REPEAT', 'REPORT',
|
1006
|
+
'REPORT-INPUT', 'RESHOW', 'RESTART', 'RETRIEVE', 'RETURN-CODE',
|
1007
|
+
'ROLLBACK', 'ROW', 'S', 'SCREEN', 'SEARCH', 'SECONDARY', 'SELECT',
|
1008
|
+
'SEQUENCE', 'SIZE', 'SKIP', 'SOKAKU', 'SORT', 'SQL', 'STOP', 'SUM',
|
1009
|
+
'SYSDATE', 'SYSDATE-LONG', 'SYSIN', 'SYSIPT', 'SYSLST', 'SYSPRINT',
|
1010
|
+
'SYSSNAP', 'SYSTIME', 'TALLY', 'TERM-COLUMNS', 'TERM-NAME',
|
1011
|
+
'TERM-ROWS', 'TERMINATION', 'TITLE', 'TO', 'TRANSFER', 'TRC',
|
1012
|
+
'UNIQUE', 'UNTIL', 'UPDATE', 'UPPERCASE', 'USER', 'USERID', 'VALUE',
|
1013
|
+
'VERIFY', 'W', 'WHEN', 'WHILE', 'WORK', 'WRITE', 'X', 'XDM', 'XRST'
|
1014
|
+
]
|
1015
|
+
|
1016
|
+
tokens = {
|
1017
|
+
'root': [
|
1018
|
+
(r'\*.*\n', Comment.Single),
|
1019
|
+
(r'\n+', Whitespace),
|
1020
|
+
# Macro argument
|
1021
|
+
(r'&' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+\.', Name.Variable,
|
1022
|
+
'after_macro_argument'),
|
1023
|
+
# Macro call
|
1024
|
+
(r'%' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name.Variable),
|
1025
|
+
(r'(FILE|MACRO|REPORT)(\s+)',
|
1026
|
+
bygroups(Keyword.Declaration, Whitespace), 'after_declaration'),
|
1027
|
+
(r'(JOB|PARM)' + r'(' + _DELIMITER_PATTERN + r')',
|
1028
|
+
bygroups(Keyword.Declaration, Operator)),
|
1029
|
+
(words(_KEYWORDS, suffix=_DELIMITER_PATTERN_CAPTURE),
|
1030
|
+
bygroups(Keyword.Reserved, Operator)),
|
1031
|
+
(_OPERATORS_PATTERN, Operator),
|
1032
|
+
# Procedure declaration
|
1033
|
+
(r'(' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+)(\s*)(\.?)(\s*)(PROC)(\s*\n)',
|
1034
|
+
bygroups(Name.Function, Whitespace, Operator, Whitespace,
|
1035
|
+
Keyword.Declaration, Whitespace)),
|
1036
|
+
(r'[0-9]+\.[0-9]*', Number.Float),
|
1037
|
+
(r'[0-9]+', Number.Integer),
|
1038
|
+
(r"'(''|[^'])*'", String),
|
1039
|
+
(r'\s+', Whitespace),
|
1040
|
+
# Everything else just belongs to a name
|
1041
|
+
(_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name),
|
1042
|
+
],
|
1043
|
+
'after_declaration': [
|
1044
|
+
(_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name.Function),
|
1045
|
+
default('#pop'),
|
1046
|
+
],
|
1047
|
+
'after_macro_argument': [
|
1048
|
+
(r'\*.*\n', Comment.Single, '#pop'),
|
1049
|
+
(r'\s+', Whitespace, '#pop'),
|
1050
|
+
(_OPERATORS_PATTERN, Operator, '#pop'),
|
1051
|
+
(r"'(''|[^'])*'", String, '#pop'),
|
1052
|
+
# Everything else just belongs to a name
|
1053
|
+
(_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name),
|
1054
|
+
],
|
1055
|
+
}
|
1056
|
+
_COMMENT_LINE_REGEX = re.compile(r'^\s*\*')
|
1057
|
+
_MACRO_HEADER_REGEX = re.compile(r'^\s*MACRO')
|
1058
|
+
|
1059
|
+
def analyse_text(text):
|
1060
|
+
"""
|
1061
|
+
Perform a structural analysis for basic Easytrieve constructs.
|
1062
|
+
"""
|
1063
|
+
result = 0.0
|
1064
|
+
lines = text.split('\n')
|
1065
|
+
hasEndProc = False
|
1066
|
+
hasHeaderComment = False
|
1067
|
+
hasFile = False
|
1068
|
+
hasJob = False
|
1069
|
+
hasProc = False
|
1070
|
+
hasParm = False
|
1071
|
+
hasReport = False
|
1072
|
+
|
1073
|
+
def isCommentLine(line):
|
1074
|
+
return EasytrieveLexer._COMMENT_LINE_REGEX.match(lines[0]) is not None
|
1075
|
+
|
1076
|
+
def isEmptyLine(line):
|
1077
|
+
return not bool(line.strip())
|
1078
|
+
|
1079
|
+
# Remove possible empty lines and header comments.
|
1080
|
+
while lines and (isEmptyLine(lines[0]) or isCommentLine(lines[0])):
|
1081
|
+
if not isEmptyLine(lines[0]):
|
1082
|
+
hasHeaderComment = True
|
1083
|
+
del lines[0]
|
1084
|
+
|
1085
|
+
if EasytrieveLexer._MACRO_HEADER_REGEX.match(lines[0]):
|
1086
|
+
# Looks like an Easytrieve macro.
|
1087
|
+
result = 0.4
|
1088
|
+
if hasHeaderComment:
|
1089
|
+
result += 0.4
|
1090
|
+
else:
|
1091
|
+
# Scan the source for lines starting with indicators.
|
1092
|
+
for line in lines:
|
1093
|
+
words = line.split()
|
1094
|
+
if (len(words) >= 2):
|
1095
|
+
firstWord = words[0]
|
1096
|
+
if not hasReport:
|
1097
|
+
if not hasJob:
|
1098
|
+
if not hasFile:
|
1099
|
+
if not hasParm:
|
1100
|
+
if firstWord == 'PARM':
|
1101
|
+
hasParm = True
|
1102
|
+
if firstWord == 'FILE':
|
1103
|
+
hasFile = True
|
1104
|
+
if firstWord == 'JOB':
|
1105
|
+
hasJob = True
|
1106
|
+
elif firstWord == 'PROC':
|
1107
|
+
hasProc = True
|
1108
|
+
elif firstWord == 'END-PROC':
|
1109
|
+
hasEndProc = True
|
1110
|
+
elif firstWord == 'REPORT':
|
1111
|
+
hasReport = True
|
1112
|
+
|
1113
|
+
# Weight the findings.
|
1114
|
+
if hasJob and (hasProc == hasEndProc):
|
1115
|
+
if hasHeaderComment:
|
1116
|
+
result += 0.1
|
1117
|
+
if hasParm:
|
1118
|
+
if hasProc:
|
1119
|
+
# Found PARM, JOB and PROC/END-PROC:
|
1120
|
+
# pretty sure this is Easytrieve.
|
1121
|
+
result += 0.8
|
1122
|
+
else:
|
1123
|
+
# Found PARAM and JOB: probably this is Easytrieve
|
1124
|
+
result += 0.5
|
1125
|
+
else:
|
1126
|
+
# Found JOB and possibly other keywords: might be Easytrieve
|
1127
|
+
result += 0.11
|
1128
|
+
if hasParm:
|
1129
|
+
# Note: PARAM is not a proper English word, so this is
|
1130
|
+
# regarded a much better indicator for Easytrieve than
|
1131
|
+
# the other words.
|
1132
|
+
result += 0.2
|
1133
|
+
if hasFile:
|
1134
|
+
result += 0.01
|
1135
|
+
if hasReport:
|
1136
|
+
result += 0.01
|
1137
|
+
assert 0.0 <= result <= 1.0
|
1138
|
+
return result
|
1139
|
+
|
1140
|
+
|
1141
|
+
class JclLexer(RegexLexer):
|
1142
|
+
"""
|
1143
|
+
`Job Control Language (JCL)
|
1144
|
+
<http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA2B570/CCONTENTS>`_
|
1145
|
+
is a scripting language used on mainframe platforms to instruct the system
|
1146
|
+
on how to run a batch job or start a subsystem. It is somewhat
|
1147
|
+
comparable to MS DOS batch and Unix shell scripts.
|
1148
|
+
|
1149
|
+
.. versionadded:: 2.1
|
1150
|
+
"""
|
1151
|
+
name = 'JCL'
|
1152
|
+
aliases = ['jcl']
|
1153
|
+
filenames = ['*.jcl']
|
1154
|
+
mimetypes = ['text/x-jcl']
|
1155
|
+
flags = re.IGNORECASE
|
1156
|
+
|
1157
|
+
tokens = {
|
1158
|
+
'root': [
|
1159
|
+
(r'//\*.*\n', Comment.Single),
|
1160
|
+
(r'//', Keyword.Pseudo, 'statement'),
|
1161
|
+
(r'/\*', Keyword.Pseudo, 'jes2_statement'),
|
1162
|
+
# TODO: JES3 statement
|
1163
|
+
(r'.*\n', Other) # Input text or inline code in any language.
|
1164
|
+
],
|
1165
|
+
'statement': [
|
1166
|
+
(r'\s*\n', Whitespace, '#pop'),
|
1167
|
+
(r'([a-z]\w*)(\s+)(exec|job)(\s*)',
|
1168
|
+
bygroups(Name.Label, Whitespace, Keyword.Reserved, Whitespace),
|
1169
|
+
'option'),
|
1170
|
+
(r'[a-z]\w*', Name.Variable, 'statement_command'),
|
1171
|
+
(r'\s+', Whitespace, 'statement_command'),
|
1172
|
+
],
|
1173
|
+
'statement_command': [
|
1174
|
+
(r'\s+(command|cntl|dd|endctl|endif|else|include|jcllib|'
|
1175
|
+
r'output|pend|proc|set|then|xmit)\s+', Keyword.Reserved, 'option'),
|
1176
|
+
include('option')
|
1177
|
+
],
|
1178
|
+
'jes2_statement': [
|
1179
|
+
(r'\s*\n', Whitespace, '#pop'),
|
1180
|
+
(r'\$', Keyword, 'option'),
|
1181
|
+
(r'\b(jobparam|message|netacct|notify|output|priority|route|'
|
1182
|
+
r'setup|signoff|xeq|xmit)\b', Keyword, 'option'),
|
1183
|
+
],
|
1184
|
+
'option': [
|
1185
|
+
# (r'\n', Text, 'root'),
|
1186
|
+
(r'\*', Name.Builtin),
|
1187
|
+
(r'[\[\](){}<>;,]', Punctuation),
|
1188
|
+
(r'[-+*/=&%]', Operator),
|
1189
|
+
(r'[a-z_]\w*', Name),
|
1190
|
+
(r'\d+\.\d*', Number.Float),
|
1191
|
+
(r'\.\d+', Number.Float),
|
1192
|
+
(r'\d+', Number.Integer),
|
1193
|
+
(r"'", String, 'option_string'),
|
1194
|
+
(r'[ \t]+', Whitespace, 'option_comment'),
|
1195
|
+
(r'\.', Punctuation),
|
1196
|
+
],
|
1197
|
+
'option_string': [
|
1198
|
+
(r"(\n)(//)", bygroups(Text, Keyword.Pseudo)),
|
1199
|
+
(r"''", String),
|
1200
|
+
(r"[^']", String),
|
1201
|
+
(r"'", String, '#pop'),
|
1202
|
+
],
|
1203
|
+
'option_comment': [
|
1204
|
+
# (r'\n', Text, 'root'),
|
1205
|
+
(r'.+', Comment.Single),
|
1206
|
+
]
|
1207
|
+
}
|
1208
|
+
|
1209
|
+
_JOB_HEADER_PATTERN = re.compile(r'^//[a-z#$@][a-z0-9#$@]{0,7}\s+job(\s+.*)?$',
|
1210
|
+
re.IGNORECASE)
|
1211
|
+
|
1212
|
+
def analyse_text(text):
|
1213
|
+
"""
|
1214
|
+
Recognize JCL job by header.
|
1215
|
+
"""
|
1216
|
+
result = 0.0
|
1217
|
+
lines = text.split('\n')
|
1218
|
+
if len(lines) > 0:
|
1219
|
+
if JclLexer._JOB_HEADER_PATTERN.match(lines[0]):
|
1220
|
+
result = 1.0
|
1221
|
+
assert 0.0 <= result <= 1.0
|
1222
|
+
return result
|