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,105 @@
|
|
1
|
+
module Pione
|
2
|
+
module Parser
|
3
|
+
# FeatureExprParser is a set of parser atoms for feature expressions.
|
4
|
+
module FeatureExprParser
|
5
|
+
include Parslet
|
6
|
+
include SyntaxError
|
7
|
+
include CommonParser
|
8
|
+
include LiteralParser
|
9
|
+
|
10
|
+
# @!attribute [r] atomic_feature
|
11
|
+
# +atomic_feature+ matches all atomic features.
|
12
|
+
# @return [Parslet::Atoms::Entity] +atomic_feature+ atom
|
13
|
+
# @example
|
14
|
+
# # requisite feature
|
15
|
+
# +X
|
16
|
+
# @example
|
17
|
+
# # blocking feature
|
18
|
+
# -X
|
19
|
+
# @example
|
20
|
+
# # preferred feature
|
21
|
+
# ?X
|
22
|
+
# @example
|
23
|
+
# # possible feature
|
24
|
+
# ^X
|
25
|
+
# @example
|
26
|
+
# # restrictive feature
|
27
|
+
# !X
|
28
|
+
# @example
|
29
|
+
# # empty feature
|
30
|
+
# *
|
31
|
+
# @example
|
32
|
+
# # boundless feature
|
33
|
+
# @
|
34
|
+
rule(:atomic_feature) {
|
35
|
+
( (plus.as(:operator) >> identifier.as(:symbol)) |
|
36
|
+
(minus.as(:operator) >> identifier.as(:symbol)) |
|
37
|
+
(question.as(:operator) >> identifier.as(:symbol)) |
|
38
|
+
(hat.as(:operator) >> identifier.as(:symbol)) |
|
39
|
+
(exclamation.as(:operator) >> identifier.as(:symbol)) |
|
40
|
+
(asterisk.as(:symbol)) |
|
41
|
+
(atmark.as(:symbol))
|
42
|
+
).as(:atomic_feature)
|
43
|
+
}
|
44
|
+
|
45
|
+
# @!attribute [r] feature_expr
|
46
|
+
# +feature_expr+ matches all features.
|
47
|
+
# @return [Parslet::Atoms::Entity] +feature_expr+ atom
|
48
|
+
# @example
|
49
|
+
# # atomic feature
|
50
|
+
# +X
|
51
|
+
# @example
|
52
|
+
# # feature conjunction
|
53
|
+
# +X & +Y
|
54
|
+
# @example
|
55
|
+
# # feature disjunction
|
56
|
+
# +X | +Y
|
57
|
+
rule(:feature_expr) {
|
58
|
+
(feature_conjunction |
|
59
|
+
feature_disjunction |
|
60
|
+
feature_element).as(:feature_expr)
|
61
|
+
}
|
62
|
+
|
63
|
+
# @!attribute [r] feature_element
|
64
|
+
# +feature_element+ matches all features.
|
65
|
+
# @return [Parslet::Atoms::Entity] +feature_element+ atom
|
66
|
+
# @example
|
67
|
+
# +X
|
68
|
+
# @example
|
69
|
+
# # feature with parethese
|
70
|
+
# (+X)
|
71
|
+
rule(:feature_element) {
|
72
|
+
atomic_feature |
|
73
|
+
lparen >> feature_expr >> rparen
|
74
|
+
}
|
75
|
+
|
76
|
+
# @!attribute [r] feature_conjunction
|
77
|
+
# +feature_conjunction+ matches feature conjunction.
|
78
|
+
# @return [Parslet::Atoms::Entity] +feature_conjunction+ atom
|
79
|
+
# @example
|
80
|
+
# +X & +Y
|
81
|
+
rule(:feature_conjunction) {
|
82
|
+
(feature_element.as(:left) >>
|
83
|
+
space? >>
|
84
|
+
ampersand >>
|
85
|
+
space? >>
|
86
|
+
feature_expr.as(:right)
|
87
|
+
).as(:feature_conjunction)
|
88
|
+
}
|
89
|
+
|
90
|
+
# @!attribute [r] feature_disjunction
|
91
|
+
# +feature_disjunction+ matches feature disjunction.
|
92
|
+
# @return [Parslet::Atoms::Entity] +feature_disjunction+ atom
|
93
|
+
# @example
|
94
|
+
# +X | +Y
|
95
|
+
rule(:feature_disjunction) {
|
96
|
+
(feature_element.as(:left) >>
|
97
|
+
space? >>
|
98
|
+
vbar >>
|
99
|
+
space? >>
|
100
|
+
feature_expr.as(:right)
|
101
|
+
).as(:feature_disjunction)
|
102
|
+
}
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
module Pione
|
2
|
+
module Parser
|
3
|
+
# FlowElementParser is a set of parser atoms for flow elements.
|
4
|
+
module FlowElementParser
|
5
|
+
include Parslet
|
6
|
+
include SyntaxError
|
7
|
+
include CommonParser
|
8
|
+
include LiteralParser
|
9
|
+
include ExprParser
|
10
|
+
|
11
|
+
# @!attribute [r] flow_element
|
12
|
+
# +flow_element+ matches flow element.
|
13
|
+
# @return [Parslet::Atoms::Entity] +flow_element+ atom
|
14
|
+
# @example
|
15
|
+
# # rule calling
|
16
|
+
# rule A
|
17
|
+
# @example
|
18
|
+
# # if block
|
19
|
+
# if $VAR
|
20
|
+
# rule A
|
21
|
+
# end
|
22
|
+
# @example
|
23
|
+
# # case block
|
24
|
+
# case $VAR
|
25
|
+
# when "A"
|
26
|
+
# rule A
|
27
|
+
# when "B"
|
28
|
+
# rule B
|
29
|
+
# end
|
30
|
+
# @example
|
31
|
+
# # assignment
|
32
|
+
# $VAR := true
|
33
|
+
rule(:flow_element) {
|
34
|
+
call_rule_line |
|
35
|
+
if_block |
|
36
|
+
case_block |
|
37
|
+
assignment_line
|
38
|
+
}
|
39
|
+
|
40
|
+
# @!attribute [r] call_rule_line
|
41
|
+
# +call_rule_line+ matches calling rule.
|
42
|
+
# @return [Parslet::Atoms::Entity] +call_rule_line+ atom
|
43
|
+
# @example
|
44
|
+
# rule Test
|
45
|
+
rule(:call_rule_line) {
|
46
|
+
( space? >>
|
47
|
+
keyword_rule >>
|
48
|
+
space? >>
|
49
|
+
expr >>
|
50
|
+
line_end
|
51
|
+
).as(:call_rule)
|
52
|
+
}
|
53
|
+
|
54
|
+
# @!attribute [r] if_block
|
55
|
+
# +if_block+ matches +if+ conditional block.
|
56
|
+
# @return [Parslet::Atoms::Entity] +if_block+ atom
|
57
|
+
# @example
|
58
|
+
# if $Var
|
59
|
+
# rule Test1
|
60
|
+
# else
|
61
|
+
# rule Test2
|
62
|
+
# end
|
63
|
+
rule(:if_block) {
|
64
|
+
( if_block_begin >>
|
65
|
+
flow_element.repeat.as(:if_true_elements) >>
|
66
|
+
else_block.maybe.as(:if_else_block) >>
|
67
|
+
conditional_block_end
|
68
|
+
).as(:if_block)
|
69
|
+
}
|
70
|
+
|
71
|
+
# @!attribute [r] if_block_begin
|
72
|
+
# +if_block_begin+ matches +if+ block condition.
|
73
|
+
# @return [Parslet::Atoms::Entity] +if_block_begin+ atom
|
74
|
+
# @example
|
75
|
+
# if $Var
|
76
|
+
rule(:if_block_begin) {
|
77
|
+
space? >>
|
78
|
+
keyword_if >>
|
79
|
+
space? >>
|
80
|
+
expr.as(:condition) >>
|
81
|
+
line_end
|
82
|
+
}
|
83
|
+
|
84
|
+
# @!attribute [r] else_block
|
85
|
+
# +else_block+ matches +else+ block.
|
86
|
+
# @return [Parslet::Atoms::Entity] +else_block+ atom
|
87
|
+
# @example
|
88
|
+
# else
|
89
|
+
# rule Test1
|
90
|
+
# rule Test2
|
91
|
+
# ...
|
92
|
+
rule(:else_block) {
|
93
|
+
( space? >>
|
94
|
+
keyword_else >>
|
95
|
+
line_end >>
|
96
|
+
flow_element.repeat.as(:elements)
|
97
|
+
).as(:else_block)
|
98
|
+
}
|
99
|
+
|
100
|
+
# @!attribute [r] conditional_block_end
|
101
|
+
# +conditional_block_end+ matches conditional block end.
|
102
|
+
# @return [Parslet::Atoms::Entity] +conditional_block_end+ atom
|
103
|
+
# @example
|
104
|
+
# end
|
105
|
+
rule(:conditional_block_end) {
|
106
|
+
space? >> keyword_end >> line_end
|
107
|
+
}
|
108
|
+
|
109
|
+
# @!attribute [r] case_block
|
110
|
+
# +case_block+ matches conditional block end.
|
111
|
+
# @return [Parslet::Atoms::Entity] +case_block+ atom
|
112
|
+
# @example
|
113
|
+
# case $Var
|
114
|
+
# when 1
|
115
|
+
# rule Test1
|
116
|
+
# when 2
|
117
|
+
# rule Test2
|
118
|
+
# else
|
119
|
+
# rule Test3
|
120
|
+
# end
|
121
|
+
rule(:case_block) {
|
122
|
+
( case_block_begin >>
|
123
|
+
when_block.repeat.as(:when_blocks) >>
|
124
|
+
else_block.maybe.as(:case_else_block) >>
|
125
|
+
conditional_block_end
|
126
|
+
).as(:case_block)
|
127
|
+
}
|
128
|
+
|
129
|
+
# @!attribute [r] case_block_begin
|
130
|
+
# +case_block_begin+ matches +case+ block beginning.
|
131
|
+
# @return [Parslet::Atoms::Entity] +case_block_begin+ atom
|
132
|
+
# @example
|
133
|
+
# case $Var
|
134
|
+
rule(:case_block_begin) {
|
135
|
+
space? >>
|
136
|
+
keyword_case >>
|
137
|
+
space? >>
|
138
|
+
expr.as(:condition) >>
|
139
|
+
line_end
|
140
|
+
}
|
141
|
+
|
142
|
+
# @!attribute [r] when_block
|
143
|
+
# +when_block+ matches +when+ block.
|
144
|
+
# @return [Parslet::Atoms::Entity] +when_block+ atom
|
145
|
+
# @example
|
146
|
+
# when 1
|
147
|
+
# rule Test1
|
148
|
+
# rule Test2
|
149
|
+
# ...
|
150
|
+
rule(:when_block) {
|
151
|
+
( when_block_begin >>
|
152
|
+
flow_element.repeat.as(:elements)
|
153
|
+
).as(:when_block)
|
154
|
+
}
|
155
|
+
|
156
|
+
# @!attribute [r] when_block_begin
|
157
|
+
# +when_block_begin+ matches +when+ block beginning.
|
158
|
+
# @return [Parslet::Atoms::Entity] +when_block_begin+ atom
|
159
|
+
# @example
|
160
|
+
# when 1
|
161
|
+
rule(:when_block_begin) {
|
162
|
+
space? >>
|
163
|
+
keyword_when >>
|
164
|
+
space? >>
|
165
|
+
expr.as(:value) >>
|
166
|
+
line_end
|
167
|
+
}
|
168
|
+
|
169
|
+
# @!attribute [r] assignment_line
|
170
|
+
# +assignment_line+ matches variable assignment line.
|
171
|
+
# @return [Parslet::Atoms::Entity] +assignment_line+ atom
|
172
|
+
# @example
|
173
|
+
# $X := 1
|
174
|
+
rule(:assignment_line) {
|
175
|
+
space? >>
|
176
|
+
assignment >>
|
177
|
+
line_end
|
178
|
+
}
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
@@ -0,0 +1,182 @@
|
|
1
|
+
module Pione
|
2
|
+
module Parser
|
3
|
+
# LiteralParser is a set of parser atom for literal descriptions.
|
4
|
+
module LiteralParser
|
5
|
+
include Parslet
|
6
|
+
|
7
|
+
# @!attribute [r] boolean
|
8
|
+
# +boolean+ matches +true+ or +false+.
|
9
|
+
# @return [Parslet::Atoms::Entity] +boolean+ atom
|
10
|
+
# @example
|
11
|
+
# true
|
12
|
+
# @example
|
13
|
+
# false
|
14
|
+
rule(:boolean) {
|
15
|
+
(keyword_true | keyword_false).as(:boolean)
|
16
|
+
}
|
17
|
+
|
18
|
+
# @!attribute [r] string
|
19
|
+
# +string+ matches string.
|
20
|
+
# @return [Parslet::Atoms::Entity] +string+ atom
|
21
|
+
# @example
|
22
|
+
# "abc"
|
23
|
+
rule(:string) {
|
24
|
+
dquote >>
|
25
|
+
(backslash >> any | dquote.absent? >> any).repeat.as(:string) >>
|
26
|
+
(dquote | syntax_error("It should be double quotation.", :dquote))
|
27
|
+
}
|
28
|
+
|
29
|
+
# @!attribute [r] integer
|
30
|
+
# +integer+ matches integer number.
|
31
|
+
# @return [Parslet::Atoms::Entity] +integer+ atom
|
32
|
+
# @example
|
33
|
+
# 123
|
34
|
+
# @example
|
35
|
+
# +123
|
36
|
+
# @example
|
37
|
+
# -123
|
38
|
+
rule(:integer) {
|
39
|
+
( match('[+-]').maybe >>
|
40
|
+
digit.repeat(1)
|
41
|
+
).as(:integer)
|
42
|
+
}
|
43
|
+
|
44
|
+
# @!attribute [r] float
|
45
|
+
# +float+ matches float number.
|
46
|
+
# @return [Parslet::Atoms::Entity] +float+ atom
|
47
|
+
# @example
|
48
|
+
# 1.0
|
49
|
+
# @example
|
50
|
+
# +1.0
|
51
|
+
# @example
|
52
|
+
# -1.0
|
53
|
+
# @example
|
54
|
+
# 1.0e100
|
55
|
+
# @example
|
56
|
+
# 1.0e+100
|
57
|
+
# @example
|
58
|
+
# 1.0e-100
|
59
|
+
rule(:float) {
|
60
|
+
( match('[+-]').maybe >>
|
61
|
+
digit.repeat(1) >>
|
62
|
+
dot >>
|
63
|
+
digit.repeat(1) >>
|
64
|
+
(match('[eE]') >> match('[+-]').maybe >> digit.repeat(1)).maybe
|
65
|
+
).as(:float)
|
66
|
+
}
|
67
|
+
|
68
|
+
# @!attribute [r] float
|
69
|
+
# +float+ matches float number.
|
70
|
+
# @return [Parslet::Atoms::Entity] +float+ atom
|
71
|
+
# @example
|
72
|
+
# $VAR
|
73
|
+
# @example
|
74
|
+
# $*
|
75
|
+
rule(:variable) {
|
76
|
+
doller >>
|
77
|
+
(asterisk | identifier).as(:variable)
|
78
|
+
}
|
79
|
+
|
80
|
+
# @!attribute [r] data_name
|
81
|
+
# +data_name+ matches data name.
|
82
|
+
# @return [Parslet::Atoms::Entity] +data_name+ atom
|
83
|
+
# @example
|
84
|
+
# 'result.txt'
|
85
|
+
# @example
|
86
|
+
# '*.txt'
|
87
|
+
rule(:data_name) {
|
88
|
+
squote >>
|
89
|
+
(backslash >> any | squote.absent? >> any).repeat.as(:data_name) >>
|
90
|
+
squote
|
91
|
+
}
|
92
|
+
|
93
|
+
# @!attribute [r] package_name
|
94
|
+
# +package_name+ matches package name.
|
95
|
+
# @return [Parslet::Atoms::Entity] +package_name+ atom
|
96
|
+
# @example
|
97
|
+
# &Main
|
98
|
+
rule(:package_name) {
|
99
|
+
ampersand >>
|
100
|
+
identifier.repeat(1).as(:package_name)
|
101
|
+
}
|
102
|
+
|
103
|
+
# @!attribute [r] rule_name
|
104
|
+
# +rule_name+ matches rule name.
|
105
|
+
# @return [Parslet::Atoms::Entity] +rule_name+ atom
|
106
|
+
# @example
|
107
|
+
# Main
|
108
|
+
rule(:rule_name) {
|
109
|
+
identifier.as(:rule_name)
|
110
|
+
}
|
111
|
+
|
112
|
+
# @!attribute [r] parameters
|
113
|
+
# +parameters+ matches parameters table.
|
114
|
+
# @return [Parslet::Atoms::Entity] +parameters+ atom
|
115
|
+
# @example
|
116
|
+
# {abc: "a"}
|
117
|
+
# @example
|
118
|
+
# {a: 1, b: 2, c: 3}
|
119
|
+
rule(:parameters) {
|
120
|
+
lbrace >>
|
121
|
+
( pad? >>
|
122
|
+
( parameters_elements.maybe.as(:parameters) |
|
123
|
+
syntax_error("it should be parameter key", :identifier)
|
124
|
+
) >>
|
125
|
+
pad? >>
|
126
|
+
(rbrace | syntax_error("it should be parameters end.", :parameters_end))
|
127
|
+
)
|
128
|
+
}
|
129
|
+
|
130
|
+
# @!attribute [r] parameters_elements
|
131
|
+
# +parameters_elements+ matches elements of parameters.
|
132
|
+
# @return [Parslet::Atoms::Entity] +parameters_elements+ atom
|
133
|
+
# @example
|
134
|
+
# a: 1, b: 2, c: 3
|
135
|
+
rule(:parameters_elements) {
|
136
|
+
( parameters_element >>
|
137
|
+
parameters_elements_rest.repeat
|
138
|
+
)
|
139
|
+
}
|
140
|
+
|
141
|
+
# @api private
|
142
|
+
MSG_MISSING_COLON =
|
143
|
+
"Parameter elements should be 'key:value' form, but colon is missing."
|
144
|
+
|
145
|
+
# @api private
|
146
|
+
MSG_MISSING_VALUE =
|
147
|
+
"it should be parameter value."
|
148
|
+
|
149
|
+
# @!attribute [r] parameters_element
|
150
|
+
# +parameters_element+ matches each element of parameters.
|
151
|
+
# @return [Parslet::Atoms::Entity] +parameters_element+ atom
|
152
|
+
# @example
|
153
|
+
# a: 1
|
154
|
+
# @example
|
155
|
+
# b: 2
|
156
|
+
# @example
|
157
|
+
# c: 3
|
158
|
+
rule(:parameters_element) {
|
159
|
+
( identifier.as(:key) >>
|
160
|
+
pad? >>
|
161
|
+
(colon | syntax_error(MSG_MISSING_COLON, :colon)) >>
|
162
|
+
pad? >>
|
163
|
+
(expr.as(:value) | syntax_error(MSG_MISSING_VALUE, :expr))
|
164
|
+
).as(:parameters_element)
|
165
|
+
}
|
166
|
+
|
167
|
+
# @!attribute [r] parameters_elements_rest
|
168
|
+
# +parameters_elements_rest+ matches elements rest of parameters.
|
169
|
+
# @return [Parslet::Atoms::Entity] +parameters_elements_rest+ atom
|
170
|
+
# @example
|
171
|
+
# , a: 1
|
172
|
+
rule(:parameters_elements_rest) {
|
173
|
+
pad? >>
|
174
|
+
comma >>
|
175
|
+
pad? >>
|
176
|
+
( parameters_element |
|
177
|
+
syntax_error("it should be parameter key", :identifier)
|
178
|
+
)
|
179
|
+
}
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|