gisele 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -1
- data/Gemfile +4 -7
- data/Gemfile.lock +19 -19
- data/Rakefile +0 -4
- data/examples/merge/BreastCancer.dot +30 -0
- data/examples/merge/BreastCancer.gif +0 -0
- data/examples/merge/BreastCancer.gis +17 -0
- data/examples/merge/Merge.dot +46 -0
- data/examples/merge/Merge.gif +0 -0
- data/examples/merge/RectalCancer.dot +22 -0
- data/examples/merge/RectalCancer.gif +0 -0
- data/examples/merge/RectalCancer.gis +15 -0
- data/gisele.gemspec +3 -6
- data/gisele.noespec +11 -19
- data/lib/gisele.rb +0 -13
- data/lib/gisele/loader.rb +2 -3
- data/lib/gisele/version.rb +1 -1
- data/spec/command/main/gisele_version.stdout +1 -1
- data/spec/spec_helper.rb +0 -17
- data/tasks/gem.rake +9 -4
- metadata +65 -231
- data/lib/gisele/language.rb +0 -31
- data/lib/gisele/language/ast/bool_and.rb +0 -14
- data/lib/gisele/language/ast/bool_expr.rb +0 -22
- data/lib/gisele/language/ast/bool_not.rb +0 -14
- data/lib/gisele/language/ast/bool_or.rb +0 -14
- data/lib/gisele/language/ast/case_st.rb +0 -14
- data/lib/gisele/language/ast/else_clause.rb +0 -14
- data/lib/gisele/language/ast/elsif_clause.rb +0 -14
- data/lib/gisele/language/ast/if_st.rb +0 -14
- data/lib/gisele/language/ast/node.rb +0 -35
- data/lib/gisele/language/ast/task_call_st.rb +0 -14
- data/lib/gisele/language/ast/var_ref.rb +0 -14
- data/lib/gisele/language/ast/when_clause.rb +0 -14
- data/lib/gisele/language/ast/while_st.rb +0 -14
- data/lib/gisele/language/grammar.citrus +0 -236
- data/lib/gisele/language/grammar.sexp.yml +0 -83
- data/lib/gisele/language/processors.rb +0 -4
- data/lib/gisele/language/processors/elsif_flattener.rb +0 -36
- data/lib/gisele/language/processors/if_to_case.rb +0 -65
- data/lib/gisele/language/processors/scoping_helper.rb +0 -32
- data/lib/gisele/language/processors/sugar_removal.rb +0 -17
- data/lib/gisele/language/syntax/bool_and.rb +0 -14
- data/lib/gisele/language/syntax/bool_expr.rb +0 -14
- data/lib/gisele/language/syntax/bool_lit.rb +0 -14
- data/lib/gisele/language/syntax/bool_not.rb +0 -14
- data/lib/gisele/language/syntax/bool_or.rb +0 -14
- data/lib/gisele/language/syntax/bool_paren.rb +0 -14
- data/lib/gisele/language/syntax/case_st.rb +0 -19
- data/lib/gisele/language/syntax/else_clause.rb +0 -14
- data/lib/gisele/language/syntax/elsif_clause.rb +0 -16
- data/lib/gisele/language/syntax/event_set.rb +0 -15
- data/lib/gisele/language/syntax/fluent_def.rb +0 -18
- data/lib/gisele/language/syntax/if_st.rb +0 -18
- data/lib/gisele/language/syntax/implicit_seq_st.rb +0 -16
- data/lib/gisele/language/syntax/node.rb +0 -40
- data/lib/gisele/language/syntax/par_st.rb +0 -14
- data/lib/gisele/language/syntax/seq_st.rb +0 -14
- data/lib/gisele/language/syntax/st_list.rb +0 -14
- data/lib/gisele/language/syntax/task_call_st.rb +0 -14
- data/lib/gisele/language/syntax/task_def.rb +0 -18
- data/lib/gisele/language/syntax/trackvar_def.rb +0 -19
- data/lib/gisele/language/syntax/unit_def.rb +0 -14
- data/lib/gisele/language/syntax/var_ref.rb +0 -14
- data/lib/gisele/language/syntax/when_clause.rb +0 -16
- data/lib/gisele/language/syntax/while_st.rb +0 -16
- data/spec/unit/language/ast/test_bool_expr.rb +0 -50
- data/spec/unit/language/grammar_sexp/test_case_st.rb +0 -20
- data/spec/unit/language/grammar_sexp/test_event_set.rb +0 -14
- data/spec/unit/language/grammar_sexp/test_fluent_def.rb +0 -18
- data/spec/unit/language/grammar_sexp/test_initially.rb +0 -18
- data/spec/unit/language/grammar_sexp/test_nop_st.rb +0 -10
- data/spec/unit/language/grammar_sexp/test_when_clause.rb +0 -12
- data/spec/unit/language/processors/test_elsif_flattener.rb +0 -94
- data/spec/unit/language/processors/test_if_to_case.rb +0 -105
- data/spec/unit/language/processors/test_scoping_helper.rb +0 -45
- data/spec/unit/language/syntax/grammar/test_bool_expr.rb +0 -34
- data/spec/unit/language/syntax/grammar/test_boolean_literal.rb +0 -17
- data/spec/unit/language/syntax/grammar/test_case_st.rb +0 -60
- data/spec/unit/language/syntax/grammar/test_event.rb +0 -18
- data/spec/unit/language/syntax/grammar/test_event_name.rb +0 -21
- data/spec/unit/language/syntax/grammar/test_event_set.rb +0 -26
- data/spec/unit/language/syntax/grammar/test_fluent_def.rb +0 -21
- data/spec/unit/language/syntax/grammar/test_if_st.rb +0 -21
- data/spec/unit/language/syntax/grammar/test_par_st.rb +0 -11
- data/spec/unit/language/syntax/grammar/test_process_statement.rb +0 -19
- data/spec/unit/language/syntax/grammar/test_seq_st.rb +0 -11
- data/spec/unit/language/syntax/grammar/test_spaces.rb +0 -19
- data/spec/unit/language/syntax/grammar/test_spacing.rb +0 -17
- data/spec/unit/language/syntax/grammar/test_task_def.rb +0 -35
- data/spec/unit/language/syntax/grammar/test_task_name.rb +0 -19
- data/spec/unit/language/syntax/grammar/test_task_start_or_end.rb +0 -17
- data/spec/unit/language/syntax/grammar/test_trackvar_def.rb +0 -21
- data/spec/unit/language/syntax/grammar/test_unit_def.rb +0 -29
- data/spec/unit/language/syntax/grammar/test_variable_name.rb +0 -51
- data/spec/unit/language/syntax/grammar/test_when_clause.rb +0 -21
- data/spec/unit/language/syntax/grammar/test_while_st.rb +0 -11
- data/spec/unit/language/syntax/to_ast/test_bool_expr.rb +0 -32
- data/spec/unit/language/syntax/to_ast/test_case_st.rb +0 -47
- data/spec/unit/language/syntax/to_ast/test_else_clause.rb +0 -13
- data/spec/unit/language/syntax/to_ast/test_elsif_clause.rb +0 -15
- data/spec/unit/language/syntax/to_ast/test_event_set.rb +0 -24
- data/spec/unit/language/syntax/to_ast/test_fluent_def.rb +0 -26
- data/spec/unit/language/syntax/to_ast/test_if_st.rb +0 -39
- data/spec/unit/language/syntax/to_ast/test_par_st.rb +0 -12
- data/spec/unit/language/syntax/to_ast/test_seq_st.rb +0 -12
- data/spec/unit/language/syntax/to_ast/test_task_call_st.rb +0 -10
- data/spec/unit/language/syntax/to_ast/test_task_def.rb +0 -44
- data/spec/unit/language/syntax/to_ast/test_trackvar_def.rb +0 -26
- data/spec/unit/language/syntax/to_ast/test_unit_def.rb +0 -28
- data/spec/unit/language/syntax/to_ast/test_var_ref.rb +0 -12
- data/spec/unit/language/syntax/to_ast/test_when_clause.rb +0 -15
- data/spec/unit/language/syntax/to_ast/test_while_st.rb +0 -24
- data/spec/unit/language/test_syntax.rb +0 -51
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe SeqSt, "to_ast" do
|
4
|
-
|
5
|
-
it 'parses as expected' do
|
6
|
-
expr = "seq Task1 Task2 end"
|
7
|
-
expected = [:seq_st, [:task_call_st, "Task1"], [:task_call_st, "Task2"]]
|
8
|
-
ast(expr, :seq_st).should eq(expected)
|
9
|
-
end
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe TaskDef, "to_ast" do
|
4
|
-
|
5
|
-
it 'parses an explicit definition as expected' do
|
6
|
-
expr = <<-EXPR.strip
|
7
|
-
task Task1
|
8
|
-
fluent diagKnown {}, {}
|
9
|
-
Task2
|
10
|
-
end
|
11
|
-
EXPR
|
12
|
-
expected = \
|
13
|
-
[:task_def, "Task1",
|
14
|
-
[:fluent_def, "diagKnown", [:event_set], [:event_set], nil],
|
15
|
-
[:task_call_st, "Task2"]]
|
16
|
-
ast(expr, :task_def).should eq(expected)
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'uses :nop_st if no statement' do
|
20
|
-
expr = <<-EXPR.strip
|
21
|
-
task Task1
|
22
|
-
fluent diagKnown {}, {}
|
23
|
-
end
|
24
|
-
EXPR
|
25
|
-
expected = \
|
26
|
-
[:task_def, "Task1",
|
27
|
-
[:fluent_def, "diagKnown", [:event_set], [:event_set], nil],
|
28
|
-
[:nop_st]]
|
29
|
-
ast(expr, :task_def).should eq(expected)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'uses :nop_st when empty' do
|
33
|
-
expr = <<-EXPR.strip
|
34
|
-
task Task1
|
35
|
-
end
|
36
|
-
EXPR
|
37
|
-
expected = \
|
38
|
-
[:task_def, "Task1",
|
39
|
-
[:nop_st]]
|
40
|
-
ast(expr, :task_def).should eq(expected)
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe TrackvarDef, "to_ast" do
|
4
|
-
|
5
|
-
it 'converts tracking variable definitions as expected' do
|
6
|
-
defn = "trackvar mplus {Diagnosis:start}"
|
7
|
-
expected = [:trackvar_def,
|
8
|
-
"mplus",
|
9
|
-
[:event_set, "Diagnosis:start"],
|
10
|
-
[:event_set],
|
11
|
-
nil]
|
12
|
-
ast(defn, :trackvar_def).should eq(expected)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'supports obsolete events and initial value' do
|
16
|
-
defn = "trackvar mplus {Diagnosis:start}, {Treatment:end} initially true"
|
17
|
-
expected = [:trackvar_def,
|
18
|
-
"mplus",
|
19
|
-
[:event_set, "Diagnosis:start"],
|
20
|
-
[:event_set, "Treatment:end"],
|
21
|
-
true]
|
22
|
-
ast(defn, :trackvar_def).should eq(expected)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe UnitDef, 'to_ast' do
|
4
|
-
|
5
|
-
it 'converts a single task definition as expected' do
|
6
|
-
expr = <<-UNIT.strip
|
7
|
-
task Task1 end
|
8
|
-
UNIT
|
9
|
-
expected = \
|
10
|
-
[:unit_def,
|
11
|
-
[:task_def, "Task1", [:nop_st]]]
|
12
|
-
ast(expr, :unit_def).should eq(expected)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'accepts multiple task definitions' do
|
16
|
-
expr = <<-UNIT.strip
|
17
|
-
task Task1 end
|
18
|
-
task Task2 end
|
19
|
-
UNIT
|
20
|
-
expected = \
|
21
|
-
[:unit_def,
|
22
|
-
[:task_def, "Task1", [:nop_st]],
|
23
|
-
[:task_def, "Task2", [:nop_st]] ]
|
24
|
-
ast(expr, :unit_def).should eq(expected)
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe WhenClause, 'to_ast' do
|
4
|
-
|
5
|
-
it 'converts a when clause as expected' do
|
6
|
-
expr = 'when goodCond Task'
|
7
|
-
expected = \
|
8
|
-
[:when_clause,
|
9
|
-
[:bool_expr, [:var_ref, "goodCond"] ],
|
10
|
-
[:task_call_st, "Task"]]
|
11
|
-
ast(expr, :when_clause).should eq(expected)
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe WhileSt, "to_ast" do
|
4
|
-
|
5
|
-
it 'parses as expected' do
|
6
|
-
expr = "while goodCond Task1 end"
|
7
|
-
expected = \
|
8
|
-
[:while_st,
|
9
|
-
[:bool_expr, [:var_ref, "goodCond"]],
|
10
|
-
[:task_call_st, "Task1"]]
|
11
|
-
ast(expr, :while_st).should eq(expected)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'recognizes implicit sequences' do
|
15
|
-
expr = "while goodCond Task1 Task2 end"
|
16
|
-
expected = \
|
17
|
-
[:while_st,
|
18
|
-
[:bool_expr, [:var_ref, "goodCond"]],
|
19
|
-
[:seq_st, [:task_call_st, "Task1"], [:task_call_st, "Task2"]]]
|
20
|
-
ast(expr, :while_st).should eq(expected)
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
describe Gisele do
|
3
|
-
include Gisele
|
4
|
-
|
5
|
-
describe "parse" do
|
6
|
-
|
7
|
-
it 'works with a file' do
|
8
|
-
parsed = parse(fixtures_dir/:tasks/"simple.gis")
|
9
|
-
parsed.should be_a(Citrus::Match)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'works on a String' do
|
13
|
-
parsed = parse("task Hello end")
|
14
|
-
parsed.should be_a(Citrus::Match)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'accepts parse options' do
|
18
|
-
parsed = parse("if goodCond Task1 end", :root => :if_st)
|
19
|
-
parsed.should be_a(Citrus::Match)
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "ast" do
|
25
|
-
|
26
|
-
it 'accepts parse options' do
|
27
|
-
ast = ast(parse("if goodCond Task1 end", :root => :if_st))
|
28
|
-
ast.should be_a(Sexpr)
|
29
|
-
ast.first.should eq(:if_st)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'sets traceability marks correctly' do
|
33
|
-
ast = ast(parse("if goodCond Task1 end", :root => :if_st))
|
34
|
-
ast.tracking_markers[:citrus_match].should_not be_nil
|
35
|
-
end
|
36
|
-
|
37
|
-
fixture_files('tasks/**/*.gis').each do |file|
|
38
|
-
it "works on #{file}" do
|
39
|
-
parsed = ast(parse(file))
|
40
|
-
parsed.should be_a(Array)
|
41
|
-
parsed.should be_a(Sexpr)
|
42
|
-
parsed.first.should eq(:unit_def)
|
43
|
-
if (astfile = file.sub_ext(".ast")).exist?
|
44
|
-
parsed.should eq(Kernel::eval(astfile.read, TOPLEVEL_BINDING, astfile.to_s))
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|