pione 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +94 -0
- data/Rakefile +118 -0
- data/bin/pione-broker +5 -0
- data/bin/pione-clean +5 -0
- data/bin/pione-client +5 -0
- data/bin/pione-eval +111 -0
- data/bin/pione-relay +5 -0
- data/bin/pione-relay-account-db +5 -0
- data/bin/pione-relay-client-db +5 -0
- data/bin/pione-search-log +30 -0
- data/bin/pione-syntax-checker +5 -0
- data/bin/pione-task-worker +5 -0
- data/bin/pione-tuple-space-provider +5 -0
- data/bin/pione-tuple-space-receiver +5 -0
- data/bin/pione-tuple-space-viewer +5 -0
- data/demo/demo.rb +311 -0
- data/demo/public/base.css +94 -0
- data/demo/public/demo.js +107 -0
- data/demo/public/index.html +91 -0
- data/demo/public/jquery-1.8.3.min.js +2 -0
- data/example/CountChar/CountChar.pione +64 -0
- data/example/CountChar/misc/CountChar.rb +22 -0
- data/example/CountChar/text/aidokushono_insho.txt +32 -0
- data/example/CountChar/text/aikokuka_shokan.txt +108 -0
- data/example/CountChar/text/carlyle_hakubutsukan.txt +58 -0
- data/example/CountChar/text/dark_minister.txt +2440 -0
- data/example/CountChar/text/kaikano_otto.txt +61 -0
- data/example/CountChar/text/kaikon.txt +30 -0
- data/example/CountChar/text/nagashimano_shi.txt +45 -0
- data/example/CountChar/text/saikachibuchi.txt +80 -0
- data/example/CountChar/text/saikonihonno_josei.txt +91 -0
- data/example/CountChar/text/taishojugonenno_bundan.txt +21 -0
- data/example/FeatureExample/FeatureExample.pione +7 -0
- data/example/Fib/Fib.pione +56 -0
- data/example/Fib/FibBC.pione +56 -0
- data/example/HelloWorld/HelloWorld.pione +5 -0
- data/example/LucasNumber/LucasNumber.pione +64 -0
- data/example/MakePair/MakePair.pione +14 -0
- data/example/MakePair/data/1.i +0 -0
- data/example/MakePair/data/2.i +0 -0
- data/example/MakePair/data/3.i +0 -0
- data/example/MakePair/data/4.i +0 -0
- data/example/MakePair/data/5.i +0 -0
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +61 -0
- data/example/SingleParticlesWithRef/Makefile +289 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.Makefile +153 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.pione +116 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRefFull.pione +400 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift.pdb +3381 -0
- data/example/SingleParticlesWithRef/data/all.ref2d +0 -0
- data/example/SingleParticlesWithRef/data/all.ref3d +0 -0
- data/example/Sum/Sum.pione +52 -0
- data/example/SyntaxError/call_rule_error.pione +6 -0
- data/example/SyntaxError/feature_line_error.pione +7 -0
- data/example/SyntaxError/flow_block_error.pione +5 -0
- data/example/SyntaxError/input_line_error.pione +6 -0
- data/example/SyntaxError/invalid_rule_name.pione +6 -0
- data/example/SyntaxError/param_line_error.pione +7 -0
- data/example/SyntaxError/variable-binding-error.pione +11 -0
- data/lib/pione.rb +241 -0
- data/lib/pione/agent/basic-agent.rb +333 -0
- data/lib/pione/agent/broker.rb +274 -0
- data/lib/pione/agent/command-listener.rb +47 -0
- data/lib/pione/agent/input-generator.rb +194 -0
- data/lib/pione/agent/logger.rb +65 -0
- data/lib/pione/agent/process-manager.rb +38 -0
- data/lib/pione/agent/rule-provider.rb +64 -0
- data/lib/pione/agent/task-worker.rb +274 -0
- data/lib/pione/agent/trivial-routine-worker.rb +28 -0
- data/lib/pione/agent/tuple-space-client.rb +146 -0
- data/lib/pione/agent/tuple-space-server-client-life-checker.rb +29 -0
- data/lib/pione/command-option/basic-option.rb +42 -0
- data/lib/pione/command-option/child-process-option.rb +17 -0
- data/lib/pione/command-option/common-option.rb +29 -0
- data/lib/pione/command-option/daemon-option.rb +12 -0
- data/lib/pione/command-option/presence-notifier-option.rb +15 -0
- data/lib/pione/command-option/task-worker-owner-option.rb +17 -0
- data/lib/pione/command-option/tuple-space-provider-option.rb +26 -0
- data/lib/pione/command-option/tuple-space-provider-owner-option.rb +16 -0
- data/lib/pione/command-option/tuple-space-receiver-option.rb +12 -0
- data/lib/pione/command/basic-command.rb +126 -0
- data/lib/pione/command/child-process.rb +43 -0
- data/lib/pione/command/daemon-process.rb +18 -0
- data/lib/pione/command/front-owner-command.rb +37 -0
- data/lib/pione/command/pione-broker.rb +53 -0
- data/lib/pione/command/pione-clean.rb +16 -0
- data/lib/pione/command/pione-client.rb +273 -0
- data/lib/pione/command/pione-relay-account-db.rb +85 -0
- data/lib/pione/command/pione-relay-client-db.rb +80 -0
- data/lib/pione/command/pione-relay.rb +47 -0
- data/lib/pione/command/pione-syntax-checker.rb +103 -0
- data/lib/pione/command/pione-task-worker.rb +123 -0
- data/lib/pione/command/pione-tuple-space-provider.rb +87 -0
- data/lib/pione/command/pione-tuple-space-receiver.rb +55 -0
- data/lib/pione/command/pione-tuple-space-viewer.rb +151 -0
- data/lib/pione/command/tuple-space-provider-owner.rb +6 -0
- data/lib/pione/front/basic-front.rb +64 -0
- data/lib/pione/front/broker-front.rb +30 -0
- data/lib/pione/front/client-front.rb +28 -0
- data/lib/pione/front/relay-front.rb +19 -0
- data/lib/pione/front/task-worker-front.rb +16 -0
- data/lib/pione/front/task-worker-owner.rb +42 -0
- data/lib/pione/front/tuple-space-provider-front.rb +22 -0
- data/lib/pione/front/tuple-space-provider-owner.rb +11 -0
- data/lib/pione/front/tuple-space-receiver-front.rb +18 -0
- data/lib/pione/model/assignment.rb +89 -0
- data/lib/pione/model/basic-model.rb +395 -0
- data/lib/pione/model/binary-operator.rb +80 -0
- data/lib/pione/model/block.rb +233 -0
- data/lib/pione/model/boolean.rb +138 -0
- data/lib/pione/model/call-rule.rb +69 -0
- data/lib/pione/model/data-expr.rb +360 -0
- data/lib/pione/model/feature-expr.rb +794 -0
- data/lib/pione/model/float.rb +107 -0
- data/lib/pione/model/integer.rb +140 -0
- data/lib/pione/model/list.rb +104 -0
- data/lib/pione/model/message.rb +80 -0
- data/lib/pione/model/package.rb +48 -0
- data/lib/pione/model/parameters.rb +282 -0
- data/lib/pione/model/rule-expr.rb +120 -0
- data/lib/pione/model/rule-io.rb +166 -0
- data/lib/pione/model/rule.rb +294 -0
- data/lib/pione/model/string.rb +111 -0
- data/lib/pione/model/undefined-value.rb +24 -0
- data/lib/pione/model/variable-table.rb +315 -0
- data/lib/pione/model/variable.rb +87 -0
- data/lib/pione/parser/block-parser.rb +83 -0
- data/lib/pione/parser/common-parser.rb +145 -0
- data/lib/pione/parser/document-parser.rb +58 -0
- data/lib/pione/parser/error-message.yml +4 -0
- data/lib/pione/parser/expr-parser.rb +266 -0
- data/lib/pione/parser/feature-expr-parser.rb +105 -0
- data/lib/pione/parser/flow-element-parser.rb +181 -0
- data/lib/pione/parser/literal-parser.rb +182 -0
- data/lib/pione/parser/rule-definition-parser.rb +163 -0
- data/lib/pione/parser/syntax-error.rb +61 -0
- data/lib/pione/patch/array-patch.rb +3 -0
- data/lib/pione/patch/drb-patch.rb +467 -0
- data/lib/pione/patch/monitor-patch.rb +16 -0
- data/lib/pione/patch/rinda-patch.rb +759 -0
- data/lib/pione/patch/uri-patch.rb +66 -0
- data/lib/pione/relay/receiver-socket.rb +69 -0
- data/lib/pione/relay/relay-account-db.rb +55 -0
- data/lib/pione/relay/relay-client-db.rb +53 -0
- data/lib/pione/relay/relay-socket.rb +215 -0
- data/lib/pione/relay/trampoline.rb +22 -0
- data/lib/pione/relay/transmitter-socket.rb +167 -0
- data/lib/pione/resource/basic-resource.rb +92 -0
- data/lib/pione/resource/dropbox-resource.rb +106 -0
- data/lib/pione/resource/ftp.rb +84 -0
- data/lib/pione/resource/local.rb +113 -0
- data/lib/pione/rule-handler/action-handler.rb +184 -0
- data/lib/pione/rule-handler/basic-handler.rb +217 -0
- data/lib/pione/rule-handler/flow-handler.rb +339 -0
- data/lib/pione/rule-handler/root-handler.rb +23 -0
- data/lib/pione/rule-handler/system-handler.rb +13 -0
- data/lib/pione/system/common.rb +22 -0
- data/lib/pione/system/config.rb +20 -0
- data/lib/pione/system/document.rb +81 -0
- data/lib/pione/system/file-cache.rb +150 -0
- data/lib/pione/system/global.rb +346 -0
- data/lib/pione/system/identifier.rb +61 -0
- data/lib/pione/system/init.rb +16 -0
- data/lib/pione/system/object.rb +35 -0
- data/lib/pione/transformer/block-transformer.rb +23 -0
- data/lib/pione/transformer/document-transformer.rb +36 -0
- data/lib/pione/transformer/expr-transformer.rb +89 -0
- data/lib/pione/transformer/feature-expr-transformer.rb +56 -0
- data/lib/pione/transformer/flow-element-transformer.rb +66 -0
- data/lib/pione/transformer/literal-transformer.rb +76 -0
- data/lib/pione/transformer/rule-definition-transformer.rb +62 -0
- data/lib/pione/transformer/transformer-module.rb +37 -0
- data/lib/pione/tuple-space/data-finder.rb +165 -0
- data/lib/pione/tuple-space/presence-notifier.rb +83 -0
- data/lib/pione/tuple-space/relay.rb +9 -0
- data/lib/pione/tuple-space/tuple-space-provider.rb +85 -0
- data/lib/pione/tuple-space/tuple-space-receiver.rb +140 -0
- data/lib/pione/tuple-space/tuple-space-server-interface.rb +60 -0
- data/lib/pione/tuple-space/tuple-space-server.rb +156 -0
- data/lib/pione/tuple-space/update-criteria.rb +96 -0
- data/lib/pione/tuple/agent-tuple.rb +10 -0
- data/lib/pione/tuple/attribute-tuple.rb +7 -0
- data/lib/pione/tuple/base-uri-tuple.rb +9 -0
- data/lib/pione/tuple/basic-tuple.rb +317 -0
- data/lib/pione/tuple/bye-tuple.rb +9 -0
- data/lib/pione/tuple/command-tuple.rb +9 -0
- data/lib/pione/tuple/data-tuple.rb +18 -0
- data/lib/pione/tuple/dry-run-tuple.rb +8 -0
- data/lib/pione/tuple/exception-tuple.rb +11 -0
- data/lib/pione/tuple/finished-tuple.rb +17 -0
- data/lib/pione/tuple/foreground-tuple.rb +7 -0
- data/lib/pione/tuple/log-tuple.rb +14 -0
- data/lib/pione/tuple/process-info-tuple.rb +9 -0
- data/lib/pione/tuple/request-rule-tuple.rb +9 -0
- data/lib/pione/tuple/rule-tuple.rb +10 -0
- data/lib/pione/tuple/shift-tuple.rb +13 -0
- data/lib/pione/tuple/task-tuple.rb +36 -0
- data/lib/pione/tuple/task-worker-resource-tuple.rb +9 -0
- data/lib/pione/tuple/working-tuple.rb +13 -0
- data/lib/pione/uri-scheme/basic-scheme.rb +40 -0
- data/lib/pione/uri-scheme/broadcast-scheme.rb +11 -0
- data/lib/pione/uri-scheme/dropbox-scheme.rb +9 -0
- data/lib/pione/uri-scheme/local-scheme.rb +28 -0
- data/lib/pione/util/error-report.rb +12 -0
- data/lib/pione/util/log.rb +79 -0
- data/lib/pione/util/message.rb +155 -0
- data/lib/pione/util/misc.rb +73 -0
- data/lib/pione/util/terminal.rb +78 -0
- data/lib/pione/util/waiter-table.rb +53 -0
- data/lib/pione/version.rb +3 -0
- data/misc/env.sh +2 -0
- data/misc/test-drb-stop-service.rb +34 -0
- data/misc/test-ensure-and-thread-kill.rb +40 -0
- data/misc/test-many-waiters-client.rb +56 -0
- data/misc/test-many-waiters-server.rb +14 -0
- data/misc/write_and_take_test.png +0 -0
- data/misc/write_and_take_test.rb +36 -0
- data/pione.gemspec +49 -0
- data/test/agent/spec_basic-agent.rb +170 -0
- data/test/agent/spec_broker.rb +36 -0
- data/test/agent/spec_command-listener.rb +30 -0
- data/test/agent/spec_input-generator.rb +123 -0
- data/test/agent/spec_logger.rb +71 -0
- data/test/agent/spec_rule-provider.rb +65 -0
- data/test/agent/spec_task-worker.rb +307 -0
- data/test/agent/spec_tuple-space-client.rb +30 -0
- data/test/model/spec_assignment.rb +51 -0
- data/test/model/spec_binary-operator.rb +39 -0
- data/test/model/spec_block.rb +154 -0
- data/test/model/spec_boolean.rb +115 -0
- data/test/model/spec_call-rule.rb +23 -0
- data/test/model/spec_data-expr.rb +312 -0
- data/test/model/spec_feature-expr.rb +359 -0
- data/test/model/spec_feature-expr.yml +16 -0
- data/test/model/spec_float.rb +141 -0
- data/test/model/spec_integer.rb +141 -0
- data/test/model/spec_list.rb +26 -0
- data/test/model/spec_message.rb +42 -0
- data/test/model/spec_package.rb +15 -0
- data/test/model/spec_parameters.rb +148 -0
- data/test/model/spec_rule-expr.rb +66 -0
- data/test/model/spec_rule-io.rb +32 -0
- data/test/model/spec_rule.rb +158 -0
- data/test/model/spec_string.rb +106 -0
- data/test/model/spec_variable-table.rb +117 -0
- data/test/model/spec_variable.rb +84 -0
- data/test/parser/spec_block-parser.rb +5 -0
- data/test/parser/spec_block-parser.yml +85 -0
- data/test/parser/spec_common-parser.rb +281 -0
- data/test/parser/spec_expr-parser.rb +6 -0
- data/test/parser/spec_expr-parser.yml +82 -0
- data/test/parser/spec_feature-expr-parser.rb +32 -0
- data/test/parser/spec_feature-expr-parser.yml +25 -0
- data/test/parser/spec_flow-element-parser.rb +5 -0
- data/test/parser/spec_flow-element-parser.yml +180 -0
- data/test/parser/spec_literal-parser.rb +5 -0
- data/test/parser/spec_literal-parser.yml +123 -0
- data/test/parser/spec_rule-definition-parser.rb +5 -0
- data/test/parser/spec_rule-definition-parser.yml +93 -0
- data/test/patch/spec_rinda-patch.rb +32 -0
- data/test/patch/spec_uri-patch.rb +23 -0
- data/test/rule-handler/spec_action-handler.rb +135 -0
- data/test/rule-handler/spec_flow-handler.rb +127 -0
- data/test/spec_common.rb +14 -0
- data/test/spec_data-finder.rb +88 -0
- data/test/spec_data-finder.yml +115 -0
- data/test/spec_document.rb +76 -0
- data/test/spec_identifier.rb +29 -0
- data/test/spec_log.rb +52 -0
- data/test/spec_object.rb +20 -0
- data/test/spec_resource.rb +73 -0
- data/test/spec_update-criteria.rb +83 -0
- data/test/test-util.rb +223 -0
- data/test/transformer/spec_block-transformer.rb +26 -0
- data/test/transformer/spec_expr-transformer.rb +106 -0
- data/test/transformer/spec_feature-expr-transformer.rb +21 -0
- data/test/transformer/spec_flow-element-transformer.rb +154 -0
- data/test/transformer/spec_literal-transformer.rb +58 -0
- data/test/transformer/spec_rule-definition-transformer.rb +168 -0
- data/test/tuple-space/spec_tuple-space-provider.rb +36 -0
- data/test/tuple-space/spec_tuple-space-receiver.rb +32 -0
- data/test/tuple-space/spec_tuple-space-server.rb +49 -0
- data/test/tuple/spec_basic-tuple.rb +87 -0
- data/test/tuple/spec_data-tuple.rb +85 -0
- data/test/tuple/spec_finished-tuple.rb +61 -0
- data/test/tuple/spec_task-tuple.rb +127 -0
- data/test/tuple/spec_working-tuple.rb +58 -0
- data/test/uri-scheme/spec_broadcast-scheme.rb +40 -0
- data/test/uri-scheme/spec_dropbox-scheme.rb +31 -0
- data/test/uri-scheme/spec_local-scheme.rb +69 -0
- metadata +660 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
module Pione::Model
|
2
|
+
# Variable represent variable name objects. A variable object can evaluates
|
3
|
+
# its value with the variable table.
|
4
|
+
class Variable < BasicModel
|
5
|
+
set_pione_model_type TypeAny
|
6
|
+
|
7
|
+
attr_reader :name
|
8
|
+
|
9
|
+
# Creates a variable with name.
|
10
|
+
# @param [String] name
|
11
|
+
# variable name
|
12
|
+
def initialize(name)
|
13
|
+
@name = name.to_s
|
14
|
+
super()
|
15
|
+
end
|
16
|
+
|
17
|
+
# Evaluates self variable name in the table and returns it. Return self if
|
18
|
+
# the variable name is unbound in the table.
|
19
|
+
# @param [VariableTable] vtable
|
20
|
+
# variable table for evaluation
|
21
|
+
# @return [BasicModel]
|
22
|
+
# evaluation result
|
23
|
+
def eval(vtable)
|
24
|
+
val = vtable.get(self)
|
25
|
+
raise UnboundVariableError.new(self) if val.nil?
|
26
|
+
return val
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns true because variable is a variable.
|
30
|
+
# @return [Boolean]
|
31
|
+
# true
|
32
|
+
def include_variable?
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
def set_toplevel(b)
|
37
|
+
@toplevel = b
|
38
|
+
end
|
39
|
+
|
40
|
+
# Returns true if the variable is defined in toplevel.
|
41
|
+
# @return [Boolean]
|
42
|
+
# true if the variable is defined in toplevel
|
43
|
+
def toplevel?
|
44
|
+
@toplevel
|
45
|
+
end
|
46
|
+
|
47
|
+
# @api private
|
48
|
+
def task_id_string
|
49
|
+
"Variable<#{@name}>"
|
50
|
+
end
|
51
|
+
|
52
|
+
# @api private
|
53
|
+
def textize
|
54
|
+
"$%s" % [@name]
|
55
|
+
end
|
56
|
+
|
57
|
+
# Comparisons with other variable.
|
58
|
+
# @api private
|
59
|
+
def <=>(other)
|
60
|
+
unless other.kind_of?(self.class)
|
61
|
+
raise ArgumentError.new(other)
|
62
|
+
end
|
63
|
+
@name <=> other.name
|
64
|
+
end
|
65
|
+
|
66
|
+
# Return true if other is a variable object which name is same as myself.
|
67
|
+
# @api private
|
68
|
+
def ==(other)
|
69
|
+
other.kind_of?(self.class) && @name == other.name
|
70
|
+
end
|
71
|
+
|
72
|
+
alias :eql? :"=="
|
73
|
+
|
74
|
+
# @api private
|
75
|
+
def hash
|
76
|
+
@name.hash
|
77
|
+
end
|
78
|
+
|
79
|
+
# @api private
|
80
|
+
def inspect
|
81
|
+
"#<Pione::Model::Variable @name=%s>" % @name.inspect
|
82
|
+
end
|
83
|
+
|
84
|
+
# @api private
|
85
|
+
alias :to_s :inspect
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Pione
|
2
|
+
module Parser
|
3
|
+
# BlockParser is a set of parser atoms for rule block.
|
4
|
+
module BlockParser
|
5
|
+
include Parslet
|
6
|
+
include SyntaxError
|
7
|
+
include CommonParser
|
8
|
+
include LiteralParser
|
9
|
+
include ExprParser
|
10
|
+
include FlowElementParser
|
11
|
+
|
12
|
+
# @!attribute [r] block
|
13
|
+
# +block+ matches flow block or action block.
|
14
|
+
# @return [Parslet::Atoms::Entity] +block+ atom
|
15
|
+
rule(:block) {
|
16
|
+
flow_block |
|
17
|
+
action_block
|
18
|
+
}
|
19
|
+
|
20
|
+
# @!attribute [r] flow_block
|
21
|
+
# +flow_block+ matches flow block.
|
22
|
+
# @return [Parslet::Atoms::Entity] +flow_block+ atom
|
23
|
+
# @example
|
24
|
+
# Flow
|
25
|
+
# rule A
|
26
|
+
# if $X
|
27
|
+
# rule B
|
28
|
+
# end
|
29
|
+
# End
|
30
|
+
rule(:flow_block) {
|
31
|
+
( flow_block_begin_line >>
|
32
|
+
(flow_element.repeat(1) |
|
33
|
+
syntax_error("flow elements not found", [:flow_element])) >>
|
34
|
+
(block_end_line |
|
35
|
+
syntax_error("block end not found", [:keyword_End]))
|
36
|
+
).as(:flow_block)
|
37
|
+
}
|
38
|
+
|
39
|
+
# @!attribute [r] action_block
|
40
|
+
# +action_block+ matches action block.
|
41
|
+
# @return [Parslet::Atoms::Entity] +action_block+ atom
|
42
|
+
# @example
|
43
|
+
# Action
|
44
|
+
# echo "abc" > out.txt
|
45
|
+
# End
|
46
|
+
rule(:action_block) {
|
47
|
+
( action_block_begin_line >>
|
48
|
+
( (block_end_line.absent? >> any).repeat(1).as(:content) |
|
49
|
+
syntax_error("empty action block", [])) >>
|
50
|
+
( block_end_line |
|
51
|
+
syntax_error("block end not found", [:keyword_End]))
|
52
|
+
).as(:action_block)
|
53
|
+
}
|
54
|
+
|
55
|
+
# @!attribute [r] flow_block_begin_line
|
56
|
+
# +flow_block_begin_line+ matches flow block heading.
|
57
|
+
# @return [Parslet::Atoms::Entity] +flow_block_begin_line+ atom
|
58
|
+
# @example
|
59
|
+
# Flow
|
60
|
+
rule(:flow_block_begin_line) {
|
61
|
+
space? >> keyword_Flow >> str('-').repeat >> line_end
|
62
|
+
}
|
63
|
+
|
64
|
+
# @!attribute [r] action_block_begin_line
|
65
|
+
# +flow_block_begin_line+ matches action block heading.
|
66
|
+
# @return [Parslet::Atoms::Entity] +action_block_begin_line+ atom
|
67
|
+
# @example
|
68
|
+
# Action
|
69
|
+
rule(:action_block_begin_line) {
|
70
|
+
space? >> keyword_Action.as(:key) >> str('-').repeat >> line_end
|
71
|
+
}
|
72
|
+
|
73
|
+
# @!attribute [r] block_end_line
|
74
|
+
# +block_end_line+ matches block end keyword.
|
75
|
+
# @return [Parslet::Atoms::Entity] +block_end_line+ atom
|
76
|
+
# @example
|
77
|
+
# End
|
78
|
+
rule(:block_end_line) {
|
79
|
+
space? >> str('-').repeat >> keyword_End >> line_end
|
80
|
+
}
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
module Pione
|
2
|
+
module Parser
|
3
|
+
# CommonParser is a set of symbols, keywords, and utility parsers.
|
4
|
+
module CommonParser
|
5
|
+
include Parslet
|
6
|
+
|
7
|
+
#
|
8
|
+
# symbols
|
9
|
+
#
|
10
|
+
|
11
|
+
SYMBOLS = {
|
12
|
+
:squote => '\'',
|
13
|
+
:dquote => '"',
|
14
|
+
:backslash => "\\",
|
15
|
+
:dot => '.',
|
16
|
+
:comma => ',',
|
17
|
+
:lparen => '(',
|
18
|
+
:rparen =>')',
|
19
|
+
:lbrace => '{',
|
20
|
+
:rbrace => '}',
|
21
|
+
:slash => '/',
|
22
|
+
:plus => '+',
|
23
|
+
:minus => '-',
|
24
|
+
:question => '?',
|
25
|
+
:vbar => '|',
|
26
|
+
:ampersand => '&',
|
27
|
+
:doller => '$',
|
28
|
+
:colon => ':',
|
29
|
+
:equals => '=',
|
30
|
+
:exclamation => '!',
|
31
|
+
:less_than => '<',
|
32
|
+
:greater_than => '>',
|
33
|
+
:asterisk => '*',
|
34
|
+
:percent => '%',
|
35
|
+
:atmark => '@',
|
36
|
+
:hat => '^',
|
37
|
+
:sharp => '#',
|
38
|
+
:lsbracket => '[',
|
39
|
+
:rsbracket => ']'
|
40
|
+
}
|
41
|
+
|
42
|
+
# make symbols
|
43
|
+
SYMBOLS.each do |key, val|
|
44
|
+
rule(key) { str(val) }
|
45
|
+
end
|
46
|
+
|
47
|
+
# @!attribute [r] symbols
|
48
|
+
# +symbols+ matches all symbols in PIONE document.
|
49
|
+
# @return [Parslet::Atoms::Entity] +symbols+ atom
|
50
|
+
rule(:symbols) {
|
51
|
+
SYMBOLS.keys.inject(nil) do |res, elt|
|
52
|
+
res ? res | send(elt) : send(elt)
|
53
|
+
end
|
54
|
+
}
|
55
|
+
|
56
|
+
#
|
57
|
+
# keywords
|
58
|
+
#
|
59
|
+
|
60
|
+
KEYWORDS = {
|
61
|
+
:keyword_Rule => 'Rule',
|
62
|
+
:keyword_Flow => 'Flow',
|
63
|
+
:keyword_Action => 'Action',
|
64
|
+
:keyword_End => 'End',
|
65
|
+
:keyword_input => 'input',
|
66
|
+
:keyword_output => 'output',
|
67
|
+
:keyword_param => 'param',
|
68
|
+
:keyword_feature => 'feature',
|
69
|
+
:keyword_rule => 'rule',
|
70
|
+
:keyword_if => 'if',
|
71
|
+
:keyword_else => 'else',
|
72
|
+
:keyword_case => 'case',
|
73
|
+
:keyword_when => 'when',
|
74
|
+
:keyword_end => 'end',
|
75
|
+
:keyword_package => 'package',
|
76
|
+
:keyword_require => 'require',
|
77
|
+
:keyword_true => 'true',
|
78
|
+
:keyword_false => 'false',
|
79
|
+
:keyword_and => 'and',
|
80
|
+
:keyword_or => 'or'
|
81
|
+
}
|
82
|
+
|
83
|
+
# make keywords
|
84
|
+
KEYWORDS.each do |key, val|
|
85
|
+
rule(key) { str(val) }
|
86
|
+
end
|
87
|
+
|
88
|
+
#
|
89
|
+
# utilities
|
90
|
+
#
|
91
|
+
|
92
|
+
# @!attribute [r] identifier
|
93
|
+
# +identifier+ matches any sequences excluding space, symbols, and
|
94
|
+
# line end.
|
95
|
+
# @return [Parslet::Atoms::Entity] +identifier+ atom
|
96
|
+
rule(:identifier) {
|
97
|
+
((space | symbols | line_end).absent? >> any).repeat(1)
|
98
|
+
}
|
99
|
+
|
100
|
+
# @!attribute [r] digit
|
101
|
+
# +digit+ matches 0-9.
|
102
|
+
# @return [Parslet::Atoms::Entity] +digit+ atom
|
103
|
+
rule(:digit) { match('[0-9]') }
|
104
|
+
|
105
|
+
# @!attribute [r] space
|
106
|
+
# +space+ matches sequences of space character or tab.
|
107
|
+
# @return [Parslet::Atoms::Entity] +space+ atom
|
108
|
+
rule(:space) { match("[ \t]").repeat(1) }
|
109
|
+
|
110
|
+
# @!attribute [r] space?
|
111
|
+
# +space?+ matches +space+ atom or empty.
|
112
|
+
# @return [Parslet::Atoms::Entity] +space?+ atom
|
113
|
+
rule(:space?) { space.maybe }
|
114
|
+
|
115
|
+
# @!attribute [r] pad
|
116
|
+
# +space?+ matches space character, tab, and newline.
|
117
|
+
# @return [Parslet::Atoms::Entity] +pad+ atom
|
118
|
+
rule(:pad) { match("[ \t\n]").repeat(1) }
|
119
|
+
|
120
|
+
# @!attribute [r] pad?
|
121
|
+
# +space?+ matches +pad+ atom or empty.
|
122
|
+
# @return [Parslet::Atoms::Entity] +pad?+ atom
|
123
|
+
rule(:pad?) { pad.maybe }
|
124
|
+
|
125
|
+
# @!attribute [r] line_end
|
126
|
+
# +line_end+ matches a space sequence until line end.
|
127
|
+
# @return [Parslet::Atoms::Entity] +line_end+ atom
|
128
|
+
rule(:line_end) { space? >> (str("\n") | any.absent?) }
|
129
|
+
|
130
|
+
# @!attribute [r] empty_lines
|
131
|
+
# +empty_line+ matches empty lines.
|
132
|
+
# @return [Parslet::Atoms::Entity] +empty_line+ atom
|
133
|
+
rule(:empty_lines) {
|
134
|
+
(space? >> str("\n")).repeat(1) >>
|
135
|
+
(space? >> any.absent?).maybe
|
136
|
+
}
|
137
|
+
|
138
|
+
# @!attribute [r] empty_lines?
|
139
|
+
# +empty_lines?+ matches empty lines or empty.
|
140
|
+
# @return [Parslet::Atoms::Entity] empty_line? atom
|
141
|
+
rule(:empty_lines?) { empty_lines.maybe }
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Pione
|
2
|
+
module Parser
|
3
|
+
# DocumentParser is a parser for PIONE rule document.
|
4
|
+
class DocumentParser < Parslet::Parser
|
5
|
+
include CommonParser
|
6
|
+
include LiteralParser
|
7
|
+
include FeatureExprParser
|
8
|
+
include ExprParser
|
9
|
+
include FlowElementParser
|
10
|
+
include BlockParser
|
11
|
+
include RuleDefinitionParser
|
12
|
+
|
13
|
+
def parse(str)
|
14
|
+
super(str.gsub(/^(?!#!)#.*/, ""))
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# root
|
19
|
+
#
|
20
|
+
|
21
|
+
root(:rule_definitions)
|
22
|
+
|
23
|
+
#
|
24
|
+
# document statement
|
25
|
+
#
|
26
|
+
|
27
|
+
rule(:document_statements) {
|
28
|
+
document_statement.repeat.as(:document_statements)
|
29
|
+
}
|
30
|
+
|
31
|
+
# document_statement
|
32
|
+
rule(:document_statement) {
|
33
|
+
package_line |
|
34
|
+
require_line
|
35
|
+
}
|
36
|
+
|
37
|
+
# package_line
|
38
|
+
rule(:package_line) {
|
39
|
+
( space? >>
|
40
|
+
keyword_package >>
|
41
|
+
space >>
|
42
|
+
package_name >>
|
43
|
+
line_end
|
44
|
+
).as(:package)
|
45
|
+
}
|
46
|
+
|
47
|
+
# require_line
|
48
|
+
rule(:require_line) {
|
49
|
+
( space? >>
|
50
|
+
keyword_require >>
|
51
|
+
space >>
|
52
|
+
package_name >>
|
53
|
+
line_end
|
54
|
+
).as(:require)
|
55
|
+
}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,266 @@
|
|
1
|
+
module Pione
|
2
|
+
module Parser
|
3
|
+
# ExprParser is a set of parser atoms for PIONE expressions.
|
4
|
+
module ExprParser
|
5
|
+
include Parslet
|
6
|
+
include SyntaxError
|
7
|
+
include CommonParser
|
8
|
+
include LiteralParser
|
9
|
+
include FeatureExprParser
|
10
|
+
|
11
|
+
# @!attribute [r] expr
|
12
|
+
# +expr+ matches all expressions in PIONE document.
|
13
|
+
# @return [Parslet::Atoms::Entity] +expr+ atom
|
14
|
+
# @example
|
15
|
+
# 1 + 1
|
16
|
+
# @example
|
17
|
+
# (1 + 1).next
|
18
|
+
# @example
|
19
|
+
# ("abc" + "def")[1]
|
20
|
+
# @example
|
21
|
+
# true
|
22
|
+
# @example
|
23
|
+
# '*.txt'.as_string
|
24
|
+
rule(:expr) {
|
25
|
+
( expr_operator_application |
|
26
|
+
assignment |
|
27
|
+
(expr_element.as(:receiver) >>
|
28
|
+
(index | message).repeat(1).as(:messages)) |
|
29
|
+
expr_element
|
30
|
+
).as(:expr)
|
31
|
+
}
|
32
|
+
|
33
|
+
# @!attribute [r] expr_element
|
34
|
+
# +expr_element+ matches simple expressions.
|
35
|
+
# @return [Parslet::Atoms::Entity] +expr_element+ atom
|
36
|
+
# @example
|
37
|
+
# true
|
38
|
+
# @example
|
39
|
+
# "abc"[0]
|
40
|
+
# @example
|
41
|
+
# 'abc'.as_string
|
42
|
+
# @example
|
43
|
+
# (1 + 1)
|
44
|
+
# @example
|
45
|
+
# ("abc".index(1, 1))
|
46
|
+
rule(:expr_element) {
|
47
|
+
( (atomic_expr.as(:receiver) >> indexes) |
|
48
|
+
(atomic_expr.as(:receiver) >> messages) |
|
49
|
+
atomic_expr |
|
50
|
+
lparen >> expr >> rparen
|
51
|
+
)
|
52
|
+
}
|
53
|
+
|
54
|
+
# @!attribute [r] atomic_expr
|
55
|
+
# +expr+ matches atomic expressions.
|
56
|
+
# @return [Parslet::Atoms::Entity] +atomic_expr+ atom
|
57
|
+
# @example
|
58
|
+
# true
|
59
|
+
# @example
|
60
|
+
# 0.1
|
61
|
+
# @example
|
62
|
+
# 1
|
63
|
+
# @example
|
64
|
+
# "abc"
|
65
|
+
# @example
|
66
|
+
# $var
|
67
|
+
# @example
|
68
|
+
# '*.txt'
|
69
|
+
# @example
|
70
|
+
# {var: 1}
|
71
|
+
# @example
|
72
|
+
# $abc:test
|
73
|
+
# @example
|
74
|
+
# abc
|
75
|
+
rule(:atomic_expr) {
|
76
|
+
boolean |
|
77
|
+
float |
|
78
|
+
integer |
|
79
|
+
string |
|
80
|
+
data_name |
|
81
|
+
rule_expr |
|
82
|
+
feature_expr |
|
83
|
+
parameters |
|
84
|
+
variable
|
85
|
+
}
|
86
|
+
|
87
|
+
# @!attribute [r] rule_expr
|
88
|
+
# +rule_expr+ matches rule expressions.
|
89
|
+
# @return [Parslet::Atoms::Entity] +rule_expr+ atom
|
90
|
+
# @example
|
91
|
+
# &abc:test
|
92
|
+
# @example
|
93
|
+
# :test
|
94
|
+
# @example
|
95
|
+
# test
|
96
|
+
rule(:rule_expr) {
|
97
|
+
( package_name.as(:package) >> colon >> rule_name.as(:expr) |
|
98
|
+
colon >> rule_name |
|
99
|
+
rule_name
|
100
|
+
).as(:rule_expr)
|
101
|
+
}
|
102
|
+
|
103
|
+
# @!attribute [r] expr_operator
|
104
|
+
# +expr_operator+ matches expression operators.
|
105
|
+
# @return [Parslet::Atoms::Entity] +expr_operator+ atom
|
106
|
+
# @example
|
107
|
+
# :=, ==, !=, >=, >, <=, <, &&, ||, +, -, *, /, %, or, and
|
108
|
+
rule(:expr_operator) {
|
109
|
+
equals >> equals |
|
110
|
+
exclamation >> equals |
|
111
|
+
less_than >> equals |
|
112
|
+
less_than |
|
113
|
+
greater_than >> equals |
|
114
|
+
greater_than |
|
115
|
+
ampersand >> ampersand |
|
116
|
+
vbar >> vbar |
|
117
|
+
plus |
|
118
|
+
minus |
|
119
|
+
asterisk |
|
120
|
+
slash |
|
121
|
+
percent |
|
122
|
+
keyword_or |
|
123
|
+
keyword_and
|
124
|
+
}
|
125
|
+
|
126
|
+
# @!attribute [r] expr_operator_application
|
127
|
+
# +expr_operator_application+ matches operator application.
|
128
|
+
# @return [Parslet::Atoms::Entity] +expr_operator_application+ atom
|
129
|
+
# @example
|
130
|
+
# X + X
|
131
|
+
rule(:expr_operator_application) {
|
132
|
+
( expr_element.as(:left) >>
|
133
|
+
pad? >>
|
134
|
+
expr_operator.as(:operator) >>
|
135
|
+
pad? >>
|
136
|
+
expr.as(:right)
|
137
|
+
).as(:expr_operator_application)
|
138
|
+
}
|
139
|
+
|
140
|
+
# @!attribute [r] assignment
|
141
|
+
# +assignment+ matches variable assignment.
|
142
|
+
# @return [Parslet::Atoms::Entity] +assignment+ atom
|
143
|
+
# @example
|
144
|
+
# $X := 1
|
145
|
+
rule(:assignment) {
|
146
|
+
( variable.as(:symbol) >>
|
147
|
+
space? >>
|
148
|
+
colon >> equals >>
|
149
|
+
pad? >>
|
150
|
+
expr.as(:value)
|
151
|
+
).as(:assignment)
|
152
|
+
}
|
153
|
+
|
154
|
+
# @!attribute [r] messages
|
155
|
+
# +messages+ matches message list.
|
156
|
+
# @return [Parslet::Atoms::Entity] +messages+ atom
|
157
|
+
# @example
|
158
|
+
# .params("-w").sync
|
159
|
+
rule(:messages) {
|
160
|
+
message.repeat(1).as(:messages)
|
161
|
+
}
|
162
|
+
|
163
|
+
# @!attribute [r] message
|
164
|
+
# +message+ matches message sending.
|
165
|
+
# @return [Parslet::Atoms::Entity] +message+ atom
|
166
|
+
# @example
|
167
|
+
# # message with no arguments
|
168
|
+
# .to_string
|
169
|
+
# @example
|
170
|
+
# # message with arguments
|
171
|
+
# .params("-w")
|
172
|
+
rule(:message) {
|
173
|
+
( dot >>
|
174
|
+
identifier.as(:message_name) >>
|
175
|
+
message_parameters.maybe
|
176
|
+
).as(:message)
|
177
|
+
}
|
178
|
+
|
179
|
+
# @!attribute [r] message_parameters
|
180
|
+
# +message_parameters+ matches message parameters.
|
181
|
+
# @return [Parslet::Atoms::Entity] +message_parameters+ atom
|
182
|
+
# @example
|
183
|
+
# ("-w")
|
184
|
+
# @example
|
185
|
+
# (true, false)
|
186
|
+
rule(:message_parameters) {
|
187
|
+
lparen >>
|
188
|
+
pad? >>
|
189
|
+
message_parameters_elements.maybe.as(:message_parameters) >>
|
190
|
+
pad? >>
|
191
|
+
rparen
|
192
|
+
}
|
193
|
+
|
194
|
+
# @!attribute [r] message_parameters_elements
|
195
|
+
# +message_parameters_elements+ matches message parameters.
|
196
|
+
# @return [Parslet::Atoms::Entity] +message_parameters_elements+ atom
|
197
|
+
# @example
|
198
|
+
# (true)
|
199
|
+
# @example
|
200
|
+
# (true, true, true)
|
201
|
+
rule(:message_parameters_elements) {
|
202
|
+
expr >> message_parameters_elements_rest.repeat
|
203
|
+
}
|
204
|
+
|
205
|
+
# @!attribute [r] message_paramters_elements_rest
|
206
|
+
# +message_parameters_elements+ matches message parameters rest.
|
207
|
+
# @return [Parslet::Atoms::Entity] +message_paramters_elements_rest+ atom
|
208
|
+
# @example
|
209
|
+
# , true
|
210
|
+
rule(:message_parameters_elements_rest) {
|
211
|
+
pad? >> comma >> pad? >> expr
|
212
|
+
}
|
213
|
+
|
214
|
+
# @!attribute [r] indexes
|
215
|
+
# +indexes+ matches object index list.
|
216
|
+
# @return [Parslet::Atoms::Entity] +indexes+ atom
|
217
|
+
# @example
|
218
|
+
# [1][2][3]
|
219
|
+
rule(:indexes) {
|
220
|
+
index.repeat(1).as(:indexes)
|
221
|
+
}
|
222
|
+
|
223
|
+
# @!attribute [r] index
|
224
|
+
# +index+ matches object index.
|
225
|
+
# @return [Parslet::Atoms::Entity] +index+ atom
|
226
|
+
# @example
|
227
|
+
# [1]
|
228
|
+
# [1,1]
|
229
|
+
# [1,2,3]
|
230
|
+
rule(:index) {
|
231
|
+
( lsbracket >>
|
232
|
+
space? >>
|
233
|
+
( index_arguments.as(:index) |
|
234
|
+
syntax_error("it should be index arguments", :expr)) >>
|
235
|
+
space? >>
|
236
|
+
rsbracket
|
237
|
+
)
|
238
|
+
}
|
239
|
+
|
240
|
+
# @!attribute [r] index_arguments
|
241
|
+
# +index_arguments+ matches arguments of object index.
|
242
|
+
# @return [Parslet::Atoms::Entity] +index_arguments+ atom
|
243
|
+
# @example
|
244
|
+
# 1
|
245
|
+
# 1,1
|
246
|
+
# 1,2,3
|
247
|
+
rule(:index_arguments) {
|
248
|
+
expr.repeat(1,1) >> space? >> index_arguments_rest.repeat
|
249
|
+
}
|
250
|
+
|
251
|
+
# @!attribute [r] index_arguments_rest
|
252
|
+
# +index_arguments_rest+ matches argument tail of object index.
|
253
|
+
# @return [Parslet::Atoms::Entity] +index_arguments_rest+ atom
|
254
|
+
# @example
|
255
|
+
# ,1
|
256
|
+
rule(:index_arguments_rest) {
|
257
|
+
space? >>
|
258
|
+
comma >>
|
259
|
+
space? >>
|
260
|
+
( expr |
|
261
|
+
syntax_error("it should be expr", :expr)
|
262
|
+
)
|
263
|
+
}
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|