pione 0.4.2 → 0.5.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +1 -1
- data/History.txt +6 -0
- data/example/ActionError/ActionError.action.md +11 -0
- data/example/ActionError/ActionError.pione +6 -3
- data/example/ActionError/ActionError.pnml +86 -0
- data/example/ActionError/Package.pione +2 -0
- data/example/ActionError/pione-package.json +5 -1
- data/example/CTFCorrection/CTFCorrection.action.md +46 -0
- data/example/CTFCorrection/CTFCorrection.pione +19 -41
- data/example/CTFCorrection/CTFCorrection.pnml +839 -0
- data/example/CTFCorrection/Package.pione +1 -0
- data/example/CTFCorrection/Params.pione +21 -0
- data/example/CTFCorrection/pione-package.json +20 -0
- data/example/ChildPackage/ChildPackage.pione +8 -0
- data/example/ChildPackage/pione-package.json +20 -0
- data/example/CountChar/CountChar.pione +31 -0
- data/example/CountChar/CountChar.pnml +239 -0
- data/example/CountChar/Main.pione +6 -26
- data/example/CountChar/Main.pnml +32 -100
- data/example/CountChar/Package.pione +1 -0
- data/example/CountChar/pione-package.json +3 -1
- data/example/DeferredChoice/DeferredChoice.action.md +46 -0
- data/example/DeferredChoice/DeferredChoice.pione +2 -7
- data/example/DeferredChoice/DeferredChoice.pnml +371 -0
- data/example/DeferredChoice/Package.pione +4 -0
- data/example/DeferredChoice/pione-package.json +7 -3
- data/example/DeferredChoiceWithPage/DeferredChoiceWithPage.action.md +34 -0
- data/example/DeferredChoiceWithPage/DefferredChoiceWithPage.pnml +371 -0
- data/example/DeferredChoiceWithPage/Package.pione +2 -0
- data/example/FeatureExample/FeatureExample.action.md +7 -0
- data/example/FeatureExample/FeatureExample.pione +7 -4
- data/example/FeatureExample/FeatureExample.pnml +86 -0
- data/example/FeatureExample/Package.pione +1 -0
- data/example/FeatureExample/pione-package.json +4 -0
- data/example/Fib/Fib.action.md +33 -0
- data/example/Fib/Fib.pnml +208 -0
- data/example/Fib/FibN.pnml +807 -0
- data/example/Fib/Package.pione +6 -0
- data/example/HelloWorld/HelloWorld.action.md +7 -0
- data/example/HelloWorld/HelloWorld.pione +6 -2
- data/example/HelloWorld/HelloWorld.pnml +86 -0
- data/example/HelloWorld/Package.pione +2 -0
- data/example/HelloWorld/pione-package.json +5 -1
- data/example/Interaction/Interaction.action.md +21 -0
- data/example/Interaction/Interaction.pnml +89 -0
- data/example/Interaction/Package.pione +2 -0
- data/example/LoopByTouch/LoopByTouch.pione +32 -12
- data/example/LoopByTouch/LoopByTouch.pnml +575 -0
- data/example/LoopByTouch/Package.pione +3 -0
- data/example/LoopByTouch/PairLoop.pione +6 -7
- data/example/LoopByTouch/PairLoop.pnml +188 -0
- data/example/LoopByTouch/SingleLoop.pione +6 -0
- data/example/LoopByTouch/SingleLoop.pnml +86 -0
- data/example/LoopByTouch/TripletLoop.pione +12 -13
- data/example/LoopByTouch/TripletLoop.pnml +239 -0
- data/example/LoopByTouch/pione-package.json +7 -3
- data/example/LucasNumber/LucasNumber.action.md +25 -0
- data/example/LucasNumber/LucasNumber.pnml +244 -0
- data/example/LucasNumber/LucasNumberN.pnml +1719 -0
- data/example/LucasNumber/Package.pione +2 -0
- data/example/MakePair/MakePair.pione +8 -10
- data/example/MakePair/MakePair.pnml +1141 -0
- data/example/MakePair/Package.pione +2 -0
- data/example/MakePair/pione-package.json +7 -3
- data/example/MakePair/scenario/case1/pione-scenario.json +30 -30
- data/example/MakePair/scenario/case2/pione-scenario.json +10 -10
- data/example/MakePair/scenario/case3/pione-scenario.json +28 -28
- data/example/OddSelector/OddSelector.pione +8 -8
- data/example/OddSelector/OddSelector.pnml +401 -0
- data/example/OddSelector/Package.pione +2 -0
- data/example/OddSelector/pione-package.json +4 -0
- data/example/OddSelector/scenario/pione-scenario.json +8 -8
- data/example/ParentPackage/ParentPackage.pione +13 -0
- data/example/ParentPackage/pione-package.json +18 -0
- data/example/PegasusWMS/Merge/Package.pione +2 -0
- data/example/PegasusWMS/Merge/PegasusWMSMerge.action.md +17 -0
- data/example/PegasusWMS/Merge/{Merge.pione → PegasusWMSMerge.pione} +9 -10
- data/example/PegasusWMS/Merge/PegasusWMSMerge.pnml +217 -0
- data/example/PegasusWMS/Merge/pione-package.json +6 -2
- data/example/PegasusWMS/Pipeline/Package.pione +2 -0
- data/example/PegasusWMS/Pipeline/PegasusWMSPipeline.action.md +17 -0
- data/example/PegasusWMS/Pipeline/{Pipeline.pione → PegasusWMSPipeline.pione} +7 -9
- data/example/PegasusWMS/Pipeline/PegasusWMSPipeline.pnml +137 -0
- data/example/PegasusWMS/Pipeline/pione-package.json +6 -2
- data/example/PegasusWMS/Split/Package.pione +2 -0
- data/example/PegasusWMS/Split/PegasusWMSSplit.action.md +19 -0
- data/example/PegasusWMS/Split/{Split.pione → PegasusWMSSplit.pione} +9 -10
- data/example/PegasusWMS/Split/PegasusWMSSplit.pnml +293 -0
- data/example/PegasusWMS/Split/pione-package.json +6 -2
- data/example/ScoreAggregation/Package.pione +2 -0
- data/example/ScoreAggregation/ScoreAggregation.action.md +56 -0
- data/example/ScoreAggregation/ScoreAggregation.pione +37 -76
- data/example/ScoreAggregation/ScoreAggregation.pnml +1221 -0
- data/example/ScoreAggregation/pione-package.json +6 -2
- data/example/ScoreAggregation/scenario/case1/pione-scenario.json +21 -21
- data/example/SelectRuleByParam/Package.pione +2 -0
- data/example/SelectRuleByParam/SelectRuleByParam.action.md +19 -0
- data/example/SelectRuleByParam/SelectRuleByParam.pnml +388 -0
- data/example/SequentialParameter/Package.pione +2 -0
- data/example/SequentialParameter/SequentialParameter.pione +9 -3
- data/example/SequentialParameter/SequentialParameter.pnml +140 -0
- data/example/SequentialParameter/pione-package.json +19 -0
- data/example/SerialProcessing/A.pione +25 -0
- data/example/SerialProcessing/A.pnml +395 -0
- data/example/SerialProcessing/B.pione +25 -0
- data/example/SerialProcessing/B.pnml +395 -0
- data/example/SerialProcessing/Package.pione +2 -0
- data/example/SerialProcessing/SerialProcessing.pione +9 -60
- data/example/SerialProcessing/SerialProcessing.pnml +160 -0
- data/example/SerialProcessing/pione-package.json +7 -1
- data/example/SieveOfEratosthenes/CreateUndeterminedNumbers.pnml +157 -0
- data/example/SieveOfEratosthenes/Package.pione +4 -0
- data/example/SieveOfEratosthenes/Sieve.pnml +1493 -0
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pnml +174 -0
- data/example/SingleParticlesWithRef/Create3dinfo.pnml +342 -0
- data/example/SingleParticlesWithRef/Package.pione +42 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.action.md +34 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.pnml +404 -0
- data/example/SingleParticlesWithRef/{Makefile → misc/Makefile} +0 -0
- data/example/SingleParticlesWithRef/{SingleParticlesWithRef.Display2.pione → misc/SingleParticlesWithRef.Display2.pione} +0 -0
- data/example/SingleParticlesWithRef/{SingleParticlesWithRef.Makefile → misc/SingleParticlesWithRef.Makefile} +0 -0
- data/example/SingleParticlesWithRef/{SingleParticlesWithRefFull.pione → misc/SingleParticlesWithRefFull.pione} +0 -0
- data/example/Sum/CalcEachLine.pione +30 -0
- data/example/Sum/CalcEachLine.pnml +327 -0
- data/example/Sum/Package.pione +2 -0
- data/example/Sum/Sum.action.md +35 -0
- data/example/Sum/Sum.pione +9 -35
- data/example/Sum/Sum.pnml +191 -0
- data/example/Sum/pione-package.json +5 -0
- data/example/Touch/Package.pione +2 -0
- data/example/Touch/Touch.pione +8 -2
- data/example/Touch/Touch.pnml +89 -0
- data/example/Touch/pione-package.json +4 -0
- data/example/WorkflowPatterns/01_Sequence/Package.pione +2 -0
- data/example/WorkflowPatterns/01_Sequence/Sequence.pione +9 -9
- data/example/WorkflowPatterns/01_Sequence/Sequence.pnml +191 -0
- data/example/WorkflowPatterns/01_Sequence/pione-package.json +19 -0
- data/example/WorkflowPatterns/02_PrallelSplit/Package.pione +2 -0
- data/example/WorkflowPatterns/02_PrallelSplit/ParallelSplit.pione +12 -12
- data/example/WorkflowPatterns/02_PrallelSplit/ParallelSplit.pnml +265 -0
- data/example/WorkflowPatterns/02_PrallelSplit/pione-package.json +19 -0
- data/example/WorkflowPatterns/03_Synchronization/Package.pione +2 -0
- data/example/WorkflowPatterns/03_Synchronization/Synchronization.pione +12 -13
- data/example/WorkflowPatterns/03_Synchronization/Synchronization.pnml +273 -0
- data/example/WorkflowPatterns/03_Synchronization/pione-package.json +19 -0
- data/example/WorkflowPatterns/04_ExclusiveChoice/ExclusiveChoice.pione +15 -22
- data/example/WorkflowPatterns/04_ExclusiveChoice/ExclusiveChoice.pnml +533 -0
- data/example/WorkflowPatterns/04_ExclusiveChoice/Package.pione +4 -0
- data/example/WorkflowPatterns/04_ExclusiveChoice/pione-package.json +19 -0
- data/example/WorkflowPatterns/05_SimpleMerge/Package.pione +4 -0
- data/example/WorkflowPatterns/05_SimpleMerge/SimpleMerge.pione +10 -18
- data/example/WorkflowPatterns/05_SimpleMerge/SimpleMerge.pnml +431 -0
- data/example/WorkflowPatterns/05_SimpleMerge/pione-package.json +19 -0
- data/example/WorkflowPatterns/06_MultiChoice/MultiChoice.pione +20 -28
- data/example/WorkflowPatterns/06_MultiChoice/MultiChoice.pnml +797 -0
- data/example/WorkflowPatterns/06_MultiChoice/Package.pione +5 -0
- data/example/WorkflowPatterns/06_MultiChoice/pione-package.json +19 -0
- data/example/WorkflowPatterns/07_StructuredSynchronizingMerge/Package.pione +5 -0
- data/example/WorkflowPatterns/07_StructuredSynchronizingMerge/StructuredSynchronizingMerge.pnml +668 -0
- data/example/WorkflowPatterns/08_MultiMerge/MultiMerge.pione +9 -20
- data/example/WorkflowPatterns/08_MultiMerge/MultiMerge.pnml +551 -0
- data/example/WorkflowPatterns/08_MultiMerge/Package.pione +4 -0
- data/example/WorkflowPatterns/08_MultiMerge/pione-package.json +19 -0
- data/example/WorkflowPatterns/11_ImplicitTermination/ImplicitTermination.pione +9 -17
- data/example/WorkflowPatterns/11_ImplicitTermination/ImplicitTermination.pnml +188 -0
- data/example/WorkflowPatterns/11_ImplicitTermination/Package.pione +2 -0
- data/example/WorkflowPatterns/11_ImplicitTermination/pione-package.json +19 -0
- data/example/WorkflowPatterns/12_MultipleInstancesWithoutSynchronization/MultipleInstancesWithoutSynchronization.pione +11 -11
- data/example/WorkflowPatterns/12_MultipleInstancesWithoutSynchronization/MultipleInstancesWithoutSynchronization.pnml +319 -0
- data/example/WorkflowPatterns/12_MultipleInstancesWithoutSynchronization/Package.pione +4 -0
- data/example/WorkflowPatterns/12_MultipleInstancesWithoutSynchronization/pione-package.json +19 -0
- data/example/WorkflowPatterns/13_MultipleInstancesWithDesignTimeKnowledge/MultipleInstancesWithDesignTimeKnowledge.pione +11 -11
- data/example/WorkflowPatterns/13_MultipleInstancesWithDesignTimeKnowledge/MultipleInstancesWithDesignTimeKnowledge.pnml +319 -0
- data/example/WorkflowPatterns/13_MultipleInstancesWithDesignTimeKnowledge/Package.pione +2 -0
- data/example/WorkflowPatterns/13_MultipleInstancesWithDesignTimeKnowledge/pione-package.json +19 -0
- data/example/WorkflowPatterns/14_MultipleInstancesWithRunTimeKnowledge/MultipleInstancesWithRunTimeKnowledge.pione +14 -17
- data/example/WorkflowPatterns/14_MultipleInstancesWithRunTimeKnowledge/MultipleInstancesWithRunTimeKnowledge.pnml +355 -0
- data/example/WorkflowPatterns/14_MultipleInstancesWithRunTimeKnowledge/Package.pione +4 -0
- data/example/WorkflowPatterns/14_MultipleInstancesWithRunTimeKnowledge/pione-package.json +19 -0
- data/example/WorkflowPatterns/33_GeneralizedANDJoin/GeneralizedANDJoin.pione +9 -10
- data/example/WorkflowPatterns/33_GeneralizedANDJoin/GeneralizedANDJoin.pnml +409 -0
- data/example/WorkflowPatterns/33_GeneralizedANDJoin/Package.pione +2 -0
- data/example/WorkflowPatterns/33_GeneralizedANDJoin/pione-package.json +19 -0
- data/example/WorkflowPatterns/37_LocalSynchronizingMerge/A.pione +34 -0
- data/example/WorkflowPatterns/37_LocalSynchronizingMerge/A.pnml +570 -0
- data/example/WorkflowPatterns/37_LocalSynchronizingMerge/LocalSynchronizingMerge.pione +36 -70
- data/example/WorkflowPatterns/37_LocalSynchronizingMerge/LocalSynchronizingMerge.pnml +854 -0
- data/example/WorkflowPatterns/37_LocalSynchronizingMerge/Package.pione +5 -0
- data/example/WorkflowPatterns/37_LocalSynchronizingMerge/pione-package.json +20 -0
- data/example/WorkflowPatterns/38_GeneralSynchronizingMerge/GeneralSynchronizingMerge.pnml +1003 -0
- data/example/WorkflowPatterns/38_GeneralSynchronizingMerge/Package.pione +6 -0
- data/example/WorkflowPatterns/41_ThreadMerge/A.pnml +429 -0
- data/example/WorkflowPatterns/41_ThreadMerge/A1.pnml +141 -0
- data/example/WorkflowPatterns/41_ThreadMerge/Package.pione +2 -0
- data/example/WorkflowPatterns/41_ThreadMerge/ThreadMerge.pnml +205 -0
- data/example/WorkflowPatterns/42_ThreadSplit/Package.pione +2 -0
- data/example/WorkflowPatterns/42_ThreadSplit/ThreadSplit.pnml +217 -0
- data/lib/pione/agent/job-manager.rb +4 -3
- data/lib/pione/agent/task-worker.rb +2 -7
- data/lib/pione/command.rb +1 -0
- data/lib/pione/command/basic-command.rb +3 -1
- data/lib/pione/command/command-exception.rb +14 -0
- data/lib/pione/command/pione-action-exec.rb +4 -1
- data/lib/pione/command/pione-clean.rb +13 -6
- data/lib/pione/command/pione-client.rb +5 -5
- data/lib/pione/command/pione-compile.rb +1 -1
- data/lib/pione/command/pione-log-format.rb +1 -1
- data/lib/pione/command/pione-package-add.rb +1 -1
- data/lib/pione/command/pione-package-build.rb +87 -32
- data/lib/pione/command/pione-package-remove.rb +117 -0
- data/lib/pione/command/pione-package.rb +1 -0
- data/lib/pione/command/spawner.rb +12 -3
- data/lib/pione/lang/boolean.rb +1 -1
- data/lib/pione/lang/common-parser.rb +5 -3
- data/lib/pione/lang/context-parser.rb +8 -2
- data/lib/pione/lang/context-transformer.rb +13 -3
- data/lib/pione/lang/context.rb +20 -2
- data/lib/pione/lang/data-expr.rb +1 -1
- data/lib/pione/lang/declaration-parser.rb +18 -4
- data/lib/pione/lang/declaration-transformer.rb +1 -1
- data/lib/pione/lang/declaration.rb +5 -3
- data/lib/pione/lang/definition.rb +1 -0
- data/lib/pione/lang/environment.rb +37 -2
- data/lib/pione/lang/expr.rb +10 -12
- data/lib/pione/lang/feature-expr.rb +1 -1
- data/lib/pione/lang/float.rb +1 -1
- data/lib/pione/lang/integer.rb +1 -1
- data/lib/pione/lang/keyed-sequence.rb +5 -5
- data/lib/pione/lang/lang-exception.rb +9 -5
- data/lib/pione/lang/literal-parser.rb +2 -2
- data/lib/pione/lang/literal-transformer.rb +3 -0
- data/lib/pione/lang/message.rb +3 -3
- data/lib/pione/lang/ordinal-sequence.rb +1 -1
- data/lib/pione/lang/package-expr.rb +1 -1
- data/lib/pione/lang/parameters.rb +1 -1
- data/lib/pione/lang/pione-method.rb +16 -16
- data/lib/pione/lang/rule-expr.rb +6 -1
- data/lib/pione/lang/sequence.rb +8 -3
- data/lib/pione/lang/string.rb +1 -1
- data/lib/pione/lang/ticket-expr.rb +1 -1
- data/lib/pione/lang/type.rb +17 -8
- data/lib/pione/lang/variable.rb +4 -1
- data/lib/pione/literate-action.rb +1 -2
- data/lib/pione/literate-action/document.rb +1 -1
- data/lib/pione/literate-action/handler.rb +22 -7
- data/lib/pione/literate-action/{parser.rb → markdown-parser.rb} +2 -1
- data/lib/pione/log/domain-log.rb +1 -1
- data/lib/pione/model/task-worker-broker-model.rb +1 -1
- data/lib/pione/package/package-database.rb +16 -2
- data/lib/pione/package/package-exception.rb +1 -1
- data/lib/pione/package/package-handler.rb +11 -7
- data/lib/pione/package/package-info.rb +13 -7
- data/lib/pione/package/package-scanner.rb +1 -1
- data/lib/pione/package/scenario-info.rb +2 -2
- data/lib/pione/pnml.rb +6 -0
- data/lib/pione/pnml/compiler.rb +329 -95
- data/lib/pione/pnml/declaration-extractor.rb +90 -0
- data/lib/pione/pnml/input-merge-complement.rb +17 -11
- data/lib/pione/pnml/input-parallelization-complement.rb +10 -6
- data/lib/pione/pnml/input-reduction.rb +5 -5
- data/lib/pione/pnml/invalid-arc-elimination.rb +2 -2
- data/lib/pione/pnml/io-expansion.rb +9 -5
- data/lib/pione/pnml/isolated-element-elimination.rb +2 -2
- data/lib/pione/pnml/label-extractor.rb +258 -0
- data/lib/pione/pnml/net-rewriter.rb +6 -4
- data/lib/pione/pnml/output-decomposition-complement.rb +12 -7
- data/lib/pione/pnml/output-reduction.rb +11 -5
- data/lib/pione/pnml/output-synchronization-complement.rb +11 -7
- data/lib/pione/pnml/parser.rb +106 -0
- data/lib/pione/pnml/pione-model.rb +685 -230
- data/lib/pione/pnml/pnml-model.rb +73 -41
- data/lib/pione/pnml/ticket-instantiation.rb +42 -0
- data/lib/pione/rule-engine/action-handler.rb +212 -135
- data/lib/pione/rule-engine/basic-handler.rb +29 -3
- data/lib/pione/rule-engine/engine-exception.rb +10 -6
- data/lib/pione/system/status.rb +12 -6
- data/lib/pione/version.rb +1 -1
- data/lib/rootage/help.md.erb +45 -0
- data/lib/rootage/help.rb +1 -0
- data/lib/rootage/scenario.rb +20 -2
- data/misc/pione-completion.bash +15 -5
- data/misc/pione-completion.zsh +16 -6
- data/test/command/spec_pione-client.rb +60 -60
- data/test/lang/data/context-parser.yml +12 -1
- data/test/lang/spec_pione-method.rb +7 -6
- data/test/literate-action/spec_handler.rb +19 -13
- data/test/literate-action/{spec_parser.rb → spec_markdown-parser.rb} +3 -3
- data/test/log/spec_message-log-receiver.rb +1 -1
- data/test/package/spec_package-info.rb +1 -1
- data/test/pnml/spec_input-merge-complement.rb +4 -2
- data/test/pnml/spec_input-parallelization-complement.rb +4 -2
- data/test/pnml/spec_input-reduction.rb +8 -4
- data/test/pnml/spec_invalid-arc-elimination.rb +2 -1
- data/test/pnml/spec_io-expansion.rb +4 -2
- data/test/pnml/spec_isolated-element-elimination.rb +2 -1
- data/test/pnml/spec_label-extractor.rb +100 -0
- data/test/pnml/spec_output-decomposition-complement.rb +4 -2
- data/test/pnml/spec_output-reduction.rb +8 -4
- data/test/pnml/spec_output-synchronization-complement.rb +4 -2
- data/test/pnml/spec_pione-element.rb +116 -37
- data/test/pnml/spec_pnml-element.rb +32 -8
- data/test/rule-engine/spec_action-handler.rb +12 -20
- metadata +159 -16
- data/example/CTFCorrection/package.yml +0 -1
- data/example/DeferredChoice/bin/ui.xml +0 -28
@@ -64,7 +64,7 @@ module Pione
|
|
64
64
|
# @example
|
65
65
|
# {a: 1, b: 2, c: 3}
|
66
66
|
rule(:parameter_set) {
|
67
|
-
(lbrace.as(:header) >> padded?(parameter_set_elements.maybe.as(:elements)) >> rbrace
|
67
|
+
(lbrace.as(:header) >> padded?(parameter_set_elements.maybe.as(:elements)) >> rbrace!.as(:footer)).as(:parameter_set)
|
68
68
|
}
|
69
69
|
|
70
70
|
# +parameter_set_elements+ matches elements of parameter set.
|
@@ -72,7 +72,7 @@ module Pione
|
|
72
72
|
# @example
|
73
73
|
# a: 1, b: 2, c: 3
|
74
74
|
rule(:parameter_set_elements) {
|
75
|
-
parameter_set_element >> (padded?(comma) >> parameter_set_element).repeat
|
75
|
+
parameter_set_element >> (padded?(comma).as(:separator) >> parameter_set_element).repeat
|
76
76
|
}
|
77
77
|
|
78
78
|
# +parameter_set_element+ matches each element of parameter set.
|
@@ -105,6 +105,9 @@ module Pione
|
|
105
105
|
rule(:parameter_set_element => subtree(:tree)) {
|
106
106
|
OpenStruct.new(key: tree[:key].str, value: tree[:value])
|
107
107
|
}
|
108
|
+
rule(:separator => simple(:sep), :parameter_set_element => subtree(:tree)) {
|
109
|
+
OpenStruct.new(key: tree[:key].str, value: tree[:value])
|
110
|
+
}
|
108
111
|
|
109
112
|
# Transform +feature+ into FeatureSequence.
|
110
113
|
rule(:feature => simple(:piece)) do
|
data/lib/pione/lang/message.rb
CHANGED
@@ -8,10 +8,10 @@ module Pione
|
|
8
8
|
|
9
9
|
# Return PIONE model type of the message result according to type interface.
|
10
10
|
def pione_type(env)
|
11
|
-
if pione_method = receiver.pione_type.find_method(env, name, receiver, arguments)
|
12
|
-
pione_method.get_output_type(receiver)
|
11
|
+
if pione_method = receiver.pione_type(env).find_method(env, name, receiver, arguments)
|
12
|
+
pione_method.get_output_type(env, receiver)
|
13
13
|
else
|
14
|
-
raise MethodNotFound.new(name.to_s, receiver, arguments)
|
14
|
+
raise MethodNotFound.new(env, name.to_s, receiver, arguments)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -39,13 +39,13 @@ module Pione
|
|
39
39
|
|
40
40
|
# Call the method with recevier and arguemnts.
|
41
41
|
def call(env, receiver, args)
|
42
|
-
_output = receiver.pione_type.instance_exec(env, receiver, *args, &body)
|
42
|
+
_output = receiver.pione_type(env).instance_exec(env, receiver, *args, &body)
|
43
43
|
if _output.nil?
|
44
44
|
p self
|
45
45
|
p receiver
|
46
46
|
p args
|
47
47
|
end
|
48
|
-
validate_output(receiver, _output)
|
48
|
+
validate_output(env, receiver, _output)
|
49
49
|
return _output
|
50
50
|
end
|
51
51
|
|
@@ -57,14 +57,14 @@ module Pione
|
|
57
57
|
# arguments
|
58
58
|
# @return [Boolean]
|
59
59
|
# true if input data are valid
|
60
|
-
def validate_inputs(rec, args)
|
60
|
+
def validate_inputs(env, rec, args)
|
61
61
|
# check size
|
62
62
|
return false unless inputs.size == args.size
|
63
63
|
|
64
64
|
# check type
|
65
65
|
inputs.each_with_index do |input, i|
|
66
|
-
input = get_type(input, rec)
|
67
|
-
unless input.match(args[i])
|
66
|
+
input = get_type(env, input, rec)
|
67
|
+
unless input.match(env, args[i])
|
68
68
|
return false
|
69
69
|
end
|
70
70
|
end
|
@@ -72,34 +72,34 @@ module Pione
|
|
72
72
|
end
|
73
73
|
|
74
74
|
# Validate output data type for the method.
|
75
|
-
def validate_output(receiver, value)
|
76
|
-
_output = get_type(output, receiver)
|
77
|
-
unless _output.match(value)
|
75
|
+
def validate_output(env, receiver, value)
|
76
|
+
_output = get_type(env, output, receiver)
|
77
|
+
unless _output.match(env, value)
|
78
78
|
raise MethodInterfaceError.new(:output, name, [_output], [value])
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
82
|
# Get the input types of receiver.
|
83
|
-
def get_input_types(receiver)
|
84
|
-
inputs.map{|input| get_type(input, receiver)}
|
83
|
+
def get_input_types(env, receiver)
|
84
|
+
inputs.map{|input| get_type(env, input, receiver)}
|
85
85
|
end
|
86
86
|
|
87
87
|
# Get the output type of receiver.
|
88
|
-
def get_output_type(receiver)
|
89
|
-
get_type(output, receiver)
|
88
|
+
def get_output_type(env, receiver)
|
89
|
+
get_type(env, output, receiver)
|
90
90
|
end
|
91
91
|
|
92
92
|
private
|
93
93
|
|
94
94
|
# Get a type object.
|
95
|
-
def get_type(type, receiver)
|
95
|
+
def get_type(env, type, receiver)
|
96
96
|
case type
|
97
97
|
when :index_type
|
98
|
-
receiver.index_type
|
98
|
+
receiver.index_type(env)
|
99
99
|
when :element_type
|
100
|
-
receiver.element_type
|
100
|
+
receiver.element_type(env)
|
101
101
|
when :receiver_type
|
102
|
-
receiver.pione_type
|
102
|
+
receiver.pione_type(env)
|
103
103
|
else
|
104
104
|
type
|
105
105
|
end
|
data/lib/pione/lang/rule-expr.rb
CHANGED
@@ -13,7 +13,7 @@ module Pione
|
|
13
13
|
|
14
14
|
# RuleExprSequence is a ordinal sequence of rule expressions.
|
15
15
|
class RuleExprSequence < OrdinalSequence
|
16
|
-
|
16
|
+
set_pione_type TypeRuleExpr
|
17
17
|
piece_class RuleExpr
|
18
18
|
end
|
19
19
|
|
@@ -65,6 +65,11 @@ module Pione
|
|
65
65
|
# concat sequence
|
66
66
|
left + right
|
67
67
|
end
|
68
|
+
|
69
|
+
# Specify entrance rule of the package.
|
70
|
+
define_pione_method("Entrance", [], TypeRuleExpr) do |env, rec|
|
71
|
+
rec.set_annotation_type("Entrance")
|
72
|
+
end
|
68
73
|
end
|
69
74
|
end
|
70
75
|
end
|
data/lib/pione/lang/sequence.rb
CHANGED
@@ -22,7 +22,7 @@ module Pione
|
|
22
22
|
def inherited(subclass)
|
23
23
|
members.each {|member_name| subclass.member(member_name, default: default_values[member_name])}
|
24
24
|
subclass.immutable true
|
25
|
-
subclass.index_type(
|
25
|
+
subclass.set_index_type(index_type(nil))
|
26
26
|
end
|
27
27
|
|
28
28
|
# Get/set piece class.
|
@@ -35,8 +35,13 @@ module Pione
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# Set the index type.
|
38
|
-
def index_type(
|
39
|
-
|
38
|
+
def index_type(env)
|
39
|
+
@index_type
|
40
|
+
end
|
41
|
+
|
42
|
+
# Set the index type.
|
43
|
+
def set_index_type(type)
|
44
|
+
@index_type = type
|
40
45
|
end
|
41
46
|
end
|
42
47
|
|
data/lib/pione/lang/string.rb
CHANGED
@@ -23,7 +23,7 @@ module Pione
|
|
23
23
|
|
24
24
|
# TicketExprSequence is a ordinal sequence of ticket expressions.
|
25
25
|
class TicketExprSequence < OrdinalSequence
|
26
|
-
|
26
|
+
set_pione_type TypeTicketExpr
|
27
27
|
piece_class TicketExpr
|
28
28
|
|
29
29
|
# Return ticket names of all elements in the sequence.
|
data/lib/pione/lang/type.rb
CHANGED
@@ -24,8 +24,8 @@ module Pione
|
|
24
24
|
# matching test target
|
25
25
|
# @return [Boolean]
|
26
26
|
# true if it matches, or false
|
27
|
-
def match(target)
|
28
|
-
target_type = target.pione_type
|
27
|
+
def match(env, target)
|
28
|
+
target_type = target.pione_type(env)
|
29
29
|
while target_type do
|
30
30
|
return true if self == target_type
|
31
31
|
target_type = target_type.parent_type
|
@@ -41,14 +41,18 @@ module Pione
|
|
41
41
|
|
42
42
|
# exist deferred methods
|
43
43
|
if group.has_key?(:deferred)
|
44
|
-
if m = group[:deferred].find {|m| m.validate_inputs(rec, args)}
|
44
|
+
if m = group[:deferred].find {|m| m.validate_inputs(env, rec, args)}
|
45
45
|
return m
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
# try immediate methods
|
50
50
|
_args = args.map {|arg| arg.eval(env)} # FIXME : should be replaced by type inference
|
51
|
-
|
51
|
+
if group.has_key?(:immediate)
|
52
|
+
return group[:immediate].find {|m| m.validate_inputs(env, rec, _args)}
|
53
|
+
else
|
54
|
+
return nil
|
55
|
+
end
|
52
56
|
end
|
53
57
|
|
54
58
|
# find from parent type
|
@@ -70,9 +74,9 @@ module Pione
|
|
70
74
|
# Return true if the data has the type.
|
71
75
|
#
|
72
76
|
# @return [void]
|
73
|
-
def check(data)
|
74
|
-
unless match(data)
|
75
|
-
raise LangTypeError.new(data, self)
|
77
|
+
def check(env, data)
|
78
|
+
unless match(env, data)
|
79
|
+
raise LangTypeError.new(data, self, env)
|
76
80
|
end
|
77
81
|
end
|
78
82
|
|
@@ -212,8 +216,13 @@ module Pione
|
|
212
216
|
# ticket expression type
|
213
217
|
TypeTicketExpr = Type.new("ticket-expr", TypeOrdinalSequence)
|
214
218
|
|
215
|
-
def TypeSequence.match(
|
219
|
+
def TypeSequence.match(env, target)
|
216
220
|
true
|
217
221
|
end
|
222
|
+
|
223
|
+
# Type variable matches variable object.
|
224
|
+
def TypeVariable.match(env, target)
|
225
|
+
target.kind_of?(Variable)
|
226
|
+
end
|
218
227
|
end
|
219
228
|
end
|
data/lib/pione/lang/variable.rb
CHANGED
@@ -8,10 +8,13 @@ module Pione
|
|
8
8
|
# is a concept of elements joined by sequencial operators and the
|
9
9
|
# receivers should be evaluated.
|
10
10
|
class Variable < Expr
|
11
|
-
pione_type TypeVariable
|
12
11
|
member :name
|
13
12
|
member :package_id
|
14
13
|
|
14
|
+
def pione_type(env)
|
15
|
+
env.variable_get(self).pione_type(env)
|
16
|
+
end
|
17
|
+
|
15
18
|
# Get the value from variable table in the environment.
|
16
19
|
def eval(env)
|
17
20
|
env.variable_get(self)
|
@@ -1,10 +1,9 @@
|
|
1
1
|
module Pione
|
2
2
|
module LiterateAction
|
3
|
-
|
4
3
|
end
|
5
4
|
end
|
6
5
|
|
7
|
-
require 'pione/literate-action/parser' # literate action parser
|
6
|
+
require 'pione/literate-action/markdown-parser' # literate action parser
|
8
7
|
require 'pione/literate-action/document' # literate action document
|
9
8
|
require 'pione/literate-action/handler' # action handler
|
10
9
|
|
@@ -1,24 +1,39 @@
|
|
1
1
|
module Pione
|
2
2
|
module LiterateAction
|
3
|
-
# Handler
|
3
|
+
# Handler handles action documents.
|
4
4
|
class Handler
|
5
5
|
def initialize(action)
|
6
|
-
@lang = action[:lang]
|
6
|
+
@lang = action[:lang] || "sh"
|
7
7
|
@content = action[:content]
|
8
8
|
end
|
9
9
|
|
10
10
|
# Convert the action to a string.
|
11
|
-
def textize(
|
11
|
+
def textize(domain_dump)
|
12
12
|
@content.to_s
|
13
13
|
end
|
14
14
|
|
15
15
|
# Execute the action.
|
16
|
-
|
17
|
-
|
16
|
+
#
|
17
|
+
# @param options [Hash]
|
18
|
+
# the options
|
19
|
+
# @option options [DomainDump] :domain_dump
|
20
|
+
# domain dump
|
21
|
+
# @option options [Loacation] :chdir
|
22
|
+
# the location of working directory for action
|
23
|
+
# @option options [Location] :out
|
24
|
+
# the file writing STDOUT
|
25
|
+
# @return [Boolean]
|
26
|
+
# true if the action succeeded
|
27
|
+
def execute(options={})
|
18
28
|
location = Location[Temppath.create]
|
19
|
-
location.write(("#!/usr/bin/env %s\n" % @lang) +
|
29
|
+
location.write(("#!/usr/bin/env %s\n" % @lang) + textize(options[:domain_dump]))
|
20
30
|
location.path.chmod(0700)
|
21
|
-
|
31
|
+
|
32
|
+
_options = {}
|
33
|
+
_options[:chdir] = options[:chdir] ? options[:chdir].path.to_s : Location[Global.pwd].path.to_s
|
34
|
+
_options[:out] = options[:out].path.to_s if options.has_key?(:out)
|
35
|
+
|
36
|
+
return system(location.path.to_s, _options)
|
22
37
|
end
|
23
38
|
end
|
24
39
|
end
|
data/lib/pione/log/domain-log.rb
CHANGED
@@ -33,7 +33,7 @@ module Pione
|
|
33
33
|
:dry_run => handler.dry_run.to_s
|
34
34
|
}
|
35
35
|
if handler.respond_to?(:working_directory)
|
36
|
-
@record[:working_directory] = handler.working_directory.uri.to_s
|
36
|
+
@record[:working_directory] = handler.working_directory.location.uri.to_s
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -46,7 +46,7 @@ module Pione
|
|
46
46
|
@task_workers << spawner.child_front
|
47
47
|
spawner.when_terminated {delete_task_worker(spawner.child_front)}
|
48
48
|
rescue Command::SpawnError => e
|
49
|
-
Log::Debug.system("Task worker broker agent failed to spawn a task worker: %
|
49
|
+
Log::Debug.system("Task worker broker agent failed to spawn a task worker: %s" % e.message)
|
50
50
|
res = false
|
51
51
|
end
|
52
52
|
else
|
@@ -75,6 +75,20 @@ module Pione
|
|
75
75
|
@table[name][editor || "origin"][tag]
|
76
76
|
end
|
77
77
|
|
78
|
+
# Return true if the package exists in database.
|
79
|
+
#
|
80
|
+
# @param [String] name
|
81
|
+
# package name
|
82
|
+
# @param [String] editor
|
83
|
+
# editor name
|
84
|
+
# @param [String] tag
|
85
|
+
# tag name
|
86
|
+
# @return [Boolean]
|
87
|
+
# true if the package exists in database
|
88
|
+
def exist?(name, editor, tag)
|
89
|
+
not(find(name, editor, tag).nil?)
|
90
|
+
end
|
91
|
+
|
78
92
|
# Save the database to the location.
|
79
93
|
def save(location=Global.package_database_location)
|
80
94
|
json = JSON.generate(self)
|
@@ -92,7 +106,7 @@ module Pione
|
|
92
106
|
# Convert to JSON.
|
93
107
|
def to_json(*args)
|
94
108
|
@table.each_with_object([]) do |(_, t1), list|
|
95
|
-
t1.each{|_, t2| t2.each{|_, record| list << record}}
|
109
|
+
t1.each{|_, t2| t2.each{|_, record| list << record if record}}
|
96
110
|
end.to_json(*args)
|
97
111
|
end
|
98
112
|
end
|
@@ -109,7 +123,7 @@ module Pione
|
|
109
123
|
def to_json(*args)
|
110
124
|
data = Hash.new
|
111
125
|
data["PackageName"] = name
|
112
|
-
data["Editor"] = editor
|
126
|
+
data["Editor"] = editor || "origin"
|
113
127
|
data["Tag"] = tag
|
114
128
|
data["Location"] = location if location
|
115
129
|
data["State"] = state if state
|