gisele 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/CHANGELOG.md +5 -1
  2. data/Gemfile +4 -7
  3. data/Gemfile.lock +19 -19
  4. data/Rakefile +0 -4
  5. data/examples/merge/BreastCancer.dot +30 -0
  6. data/examples/merge/BreastCancer.gif +0 -0
  7. data/examples/merge/BreastCancer.gis +17 -0
  8. data/examples/merge/Merge.dot +46 -0
  9. data/examples/merge/Merge.gif +0 -0
  10. data/examples/merge/RectalCancer.dot +22 -0
  11. data/examples/merge/RectalCancer.gif +0 -0
  12. data/examples/merge/RectalCancer.gis +15 -0
  13. data/gisele.gemspec +3 -6
  14. data/gisele.noespec +11 -19
  15. data/lib/gisele.rb +0 -13
  16. data/lib/gisele/loader.rb +2 -3
  17. data/lib/gisele/version.rb +1 -1
  18. data/spec/command/main/gisele_version.stdout +1 -1
  19. data/spec/spec_helper.rb +0 -17
  20. data/tasks/gem.rake +9 -4
  21. metadata +65 -231
  22. data/lib/gisele/language.rb +0 -31
  23. data/lib/gisele/language/ast/bool_and.rb +0 -14
  24. data/lib/gisele/language/ast/bool_expr.rb +0 -22
  25. data/lib/gisele/language/ast/bool_not.rb +0 -14
  26. data/lib/gisele/language/ast/bool_or.rb +0 -14
  27. data/lib/gisele/language/ast/case_st.rb +0 -14
  28. data/lib/gisele/language/ast/else_clause.rb +0 -14
  29. data/lib/gisele/language/ast/elsif_clause.rb +0 -14
  30. data/lib/gisele/language/ast/if_st.rb +0 -14
  31. data/lib/gisele/language/ast/node.rb +0 -35
  32. data/lib/gisele/language/ast/task_call_st.rb +0 -14
  33. data/lib/gisele/language/ast/var_ref.rb +0 -14
  34. data/lib/gisele/language/ast/when_clause.rb +0 -14
  35. data/lib/gisele/language/ast/while_st.rb +0 -14
  36. data/lib/gisele/language/grammar.citrus +0 -236
  37. data/lib/gisele/language/grammar.sexp.yml +0 -83
  38. data/lib/gisele/language/processors.rb +0 -4
  39. data/lib/gisele/language/processors/elsif_flattener.rb +0 -36
  40. data/lib/gisele/language/processors/if_to_case.rb +0 -65
  41. data/lib/gisele/language/processors/scoping_helper.rb +0 -32
  42. data/lib/gisele/language/processors/sugar_removal.rb +0 -17
  43. data/lib/gisele/language/syntax/bool_and.rb +0 -14
  44. data/lib/gisele/language/syntax/bool_expr.rb +0 -14
  45. data/lib/gisele/language/syntax/bool_lit.rb +0 -14
  46. data/lib/gisele/language/syntax/bool_not.rb +0 -14
  47. data/lib/gisele/language/syntax/bool_or.rb +0 -14
  48. data/lib/gisele/language/syntax/bool_paren.rb +0 -14
  49. data/lib/gisele/language/syntax/case_st.rb +0 -19
  50. data/lib/gisele/language/syntax/else_clause.rb +0 -14
  51. data/lib/gisele/language/syntax/elsif_clause.rb +0 -16
  52. data/lib/gisele/language/syntax/event_set.rb +0 -15
  53. data/lib/gisele/language/syntax/fluent_def.rb +0 -18
  54. data/lib/gisele/language/syntax/if_st.rb +0 -18
  55. data/lib/gisele/language/syntax/implicit_seq_st.rb +0 -16
  56. data/lib/gisele/language/syntax/node.rb +0 -40
  57. data/lib/gisele/language/syntax/par_st.rb +0 -14
  58. data/lib/gisele/language/syntax/seq_st.rb +0 -14
  59. data/lib/gisele/language/syntax/st_list.rb +0 -14
  60. data/lib/gisele/language/syntax/task_call_st.rb +0 -14
  61. data/lib/gisele/language/syntax/task_def.rb +0 -18
  62. data/lib/gisele/language/syntax/trackvar_def.rb +0 -19
  63. data/lib/gisele/language/syntax/unit_def.rb +0 -14
  64. data/lib/gisele/language/syntax/var_ref.rb +0 -14
  65. data/lib/gisele/language/syntax/when_clause.rb +0 -16
  66. data/lib/gisele/language/syntax/while_st.rb +0 -16
  67. data/spec/unit/language/ast/test_bool_expr.rb +0 -50
  68. data/spec/unit/language/grammar_sexp/test_case_st.rb +0 -20
  69. data/spec/unit/language/grammar_sexp/test_event_set.rb +0 -14
  70. data/spec/unit/language/grammar_sexp/test_fluent_def.rb +0 -18
  71. data/spec/unit/language/grammar_sexp/test_initially.rb +0 -18
  72. data/spec/unit/language/grammar_sexp/test_nop_st.rb +0 -10
  73. data/spec/unit/language/grammar_sexp/test_when_clause.rb +0 -12
  74. data/spec/unit/language/processors/test_elsif_flattener.rb +0 -94
  75. data/spec/unit/language/processors/test_if_to_case.rb +0 -105
  76. data/spec/unit/language/processors/test_scoping_helper.rb +0 -45
  77. data/spec/unit/language/syntax/grammar/test_bool_expr.rb +0 -34
  78. data/spec/unit/language/syntax/grammar/test_boolean_literal.rb +0 -17
  79. data/spec/unit/language/syntax/grammar/test_case_st.rb +0 -60
  80. data/spec/unit/language/syntax/grammar/test_event.rb +0 -18
  81. data/spec/unit/language/syntax/grammar/test_event_name.rb +0 -21
  82. data/spec/unit/language/syntax/grammar/test_event_set.rb +0 -26
  83. data/spec/unit/language/syntax/grammar/test_fluent_def.rb +0 -21
  84. data/spec/unit/language/syntax/grammar/test_if_st.rb +0 -21
  85. data/spec/unit/language/syntax/grammar/test_par_st.rb +0 -11
  86. data/spec/unit/language/syntax/grammar/test_process_statement.rb +0 -19
  87. data/spec/unit/language/syntax/grammar/test_seq_st.rb +0 -11
  88. data/spec/unit/language/syntax/grammar/test_spaces.rb +0 -19
  89. data/spec/unit/language/syntax/grammar/test_spacing.rb +0 -17
  90. data/spec/unit/language/syntax/grammar/test_task_def.rb +0 -35
  91. data/spec/unit/language/syntax/grammar/test_task_name.rb +0 -19
  92. data/spec/unit/language/syntax/grammar/test_task_start_or_end.rb +0 -17
  93. data/spec/unit/language/syntax/grammar/test_trackvar_def.rb +0 -21
  94. data/spec/unit/language/syntax/grammar/test_unit_def.rb +0 -29
  95. data/spec/unit/language/syntax/grammar/test_variable_name.rb +0 -51
  96. data/spec/unit/language/syntax/grammar/test_when_clause.rb +0 -21
  97. data/spec/unit/language/syntax/grammar/test_while_st.rb +0 -11
  98. data/spec/unit/language/syntax/to_ast/test_bool_expr.rb +0 -32
  99. data/spec/unit/language/syntax/to_ast/test_case_st.rb +0 -47
  100. data/spec/unit/language/syntax/to_ast/test_else_clause.rb +0 -13
  101. data/spec/unit/language/syntax/to_ast/test_elsif_clause.rb +0 -15
  102. data/spec/unit/language/syntax/to_ast/test_event_set.rb +0 -24
  103. data/spec/unit/language/syntax/to_ast/test_fluent_def.rb +0 -26
  104. data/spec/unit/language/syntax/to_ast/test_if_st.rb +0 -39
  105. data/spec/unit/language/syntax/to_ast/test_par_st.rb +0 -12
  106. data/spec/unit/language/syntax/to_ast/test_seq_st.rb +0 -12
  107. data/spec/unit/language/syntax/to_ast/test_task_call_st.rb +0 -10
  108. data/spec/unit/language/syntax/to_ast/test_task_def.rb +0 -44
  109. data/spec/unit/language/syntax/to_ast/test_trackvar_def.rb +0 -26
  110. data/spec/unit/language/syntax/to_ast/test_unit_def.rb +0 -28
  111. data/spec/unit/language/syntax/to_ast/test_var_ref.rb +0 -12
  112. data/spec/unit/language/syntax/to_ast/test_when_clause.rb +0 -15
  113. data/spec/unit/language/syntax/to_ast/test_while_st.rb +0 -24
  114. 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,10 +0,0 @@
1
- require 'spec_helper'
2
- module Gisele::Language::Syntax
3
- describe TaskCallSt, "to_ast" do
4
-
5
- it 'converts a call as expected' do
6
- ast("Diagnosis", :task_call_st).should eq([:task_call_st, "Diagnosis"])
7
- end
8
-
9
- end
10
- 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,12 +0,0 @@
1
- require 'spec_helper'
2
- module Gisele::Language::Syntax
3
- describe VarRef, "to_ast" do
4
-
5
- it 'converts a reference as expected' do
6
- defn = "goodCond"
7
- expected = [:var_ref, "goodCond"]
8
- ast(defn, :var_ref).should eq(expected)
9
- end
10
-
11
- end
12
- 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