gisele 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/CHANGELOG.md +73 -44
  2. data/Gemfile.lock +1 -0
  3. data/examples/meeting-scheduler/MeetingScheduling.gis +23 -23
  4. data/examples/rectal-cancer-pathway/RectalCancerPathway.gis +64 -0
  5. data/gisele.noespec +1 -1
  6. data/lib/gisele/command.rb +6 -4
  7. data/lib/gisele/language/ast/case_st.rb +14 -0
  8. data/lib/gisele/language/ast/else_clause.rb +14 -0
  9. data/lib/gisele/language/ast/node.rb +3 -1
  10. data/lib/gisele/language/ast/{unit.rb → unit_def.rb} +2 -2
  11. data/lib/gisele/language/dot.yml +1 -1
  12. data/lib/gisele/language/elsif_flattener.rb +35 -0
  13. data/lib/gisele/language/if_to_case.rb +63 -0
  14. data/lib/gisele/language/rewriter/helper.rb +41 -0
  15. data/lib/gisele/language/rewriter/scoping.rb +34 -0
  16. data/lib/gisele/language/rewriter/work_on_nodes.rb +30 -0
  17. data/lib/gisele/language/rewriter.rb +60 -0
  18. data/lib/gisele/language/sugar_removal.rb +2 -64
  19. data/lib/gisele/language/syntax/case_st.rb +19 -0
  20. data/lib/gisele/language/syntax/grammar.citrus +61 -28
  21. data/lib/gisele/language/syntax/node.rb +3 -3
  22. data/lib/gisele/language/syntax/task_def.rb +5 -4
  23. data/lib/gisele/language/syntax/{unit.rb → unit_def.rb} +3 -3
  24. data/lib/gisele/language/syntax/when_clause.rb +16 -0
  25. data/lib/gisele/language/to_graph.rb +43 -16
  26. data/lib/gisele/language.rb +25 -1
  27. data/lib/gisele/version.rb +1 -1
  28. data/spec/command/main/gisele_ast_ruby.stdout +29 -35
  29. data/spec/command/main/gisele_graph.stdout +24 -14
  30. data/spec/command/main/gisele_help.stdout +1 -1
  31. data/spec/command/main/gisele_no_sugar.cmd +1 -1
  32. data/spec/command/main/gisele_no_sugar.stdout +119 -25
  33. data/spec/command/main/gisele_version.stdout +1 -1
  34. data/spec/fixtures/tasks/complete.gis +24 -2
  35. data/spec/fixtures/tasks/simple.ast +29 -35
  36. data/spec/fixtures/tasks/simple.gis +7 -2
  37. data/spec/spec_helper.rb +10 -0
  38. data/spec/unit/language/ast/test_node.rb +10 -11
  39. data/spec/unit/language/rewriter/test_helper.rb +87 -0
  40. data/spec/unit/language/rewriter/test_scoping.rb +46 -0
  41. data/spec/unit/language/rewriter/test_work_on_nodes.rb +45 -0
  42. data/spec/unit/language/syntax/grammar/test_bool_expr.rb +34 -0
  43. data/spec/unit/language/syntax/grammar/test_boolean_literal.rb +17 -0
  44. data/spec/unit/language/syntax/grammar/test_case_st.rb +60 -0
  45. data/spec/unit/language/syntax/grammar/test_event.rb +18 -0
  46. data/spec/unit/language/syntax/grammar/test_event_name.rb +21 -0
  47. data/spec/unit/language/syntax/grammar/test_event_set.rb +27 -0
  48. data/spec/unit/language/syntax/grammar/test_fluent_def.rb +21 -0
  49. data/spec/unit/language/syntax/grammar/test_if_st.rb +21 -0
  50. data/spec/unit/language/syntax/grammar/test_par_st.rb +11 -0
  51. data/spec/unit/language/syntax/grammar/test_process_statement.rb +19 -0
  52. data/spec/unit/language/syntax/grammar/test_seq_st.rb +11 -0
  53. data/spec/unit/language/syntax/grammar/test_spaces.rb +19 -0
  54. data/spec/unit/language/syntax/grammar/test_spacing.rb +18 -0
  55. data/spec/unit/language/syntax/grammar/test_task_def.rb +35 -0
  56. data/spec/unit/language/syntax/grammar/test_task_name.rb +19 -0
  57. data/spec/unit/language/syntax/grammar/test_task_start_or_end.rb +17 -0
  58. data/spec/unit/language/syntax/grammar/test_trackvar_def.rb +21 -0
  59. data/spec/unit/language/syntax/grammar/test_unit_def.rb +29 -0
  60. data/spec/unit/language/syntax/grammar/test_variable_name.rb +30 -0
  61. data/spec/unit/language/syntax/grammar/test_when_clause.rb +21 -0
  62. data/spec/unit/language/syntax/grammar/test_while_st.rb +11 -0
  63. data/spec/unit/language/syntax/to_ast/test_bool_expr.rb +28 -0
  64. data/spec/unit/language/syntax/to_ast/test_case_st.rb +47 -0
  65. data/spec/unit/language/syntax/to_ast/test_else_clause.rb +13 -0
  66. data/spec/unit/language/syntax/to_ast/test_elsif_clause.rb +15 -0
  67. data/spec/unit/language/syntax/to_ast/test_event_set.rb +24 -0
  68. data/spec/unit/language/syntax/to_ast/test_fluent_def.rb +26 -0
  69. data/spec/unit/language/syntax/to_ast/test_if_st.rb +39 -0
  70. data/spec/unit/language/syntax/to_ast/test_par_st.rb +12 -0
  71. data/spec/unit/language/syntax/to_ast/test_seq_st.rb +12 -0
  72. data/spec/unit/language/syntax/to_ast/test_task_call_st.rb +10 -0
  73. data/spec/unit/language/syntax/to_ast/test_task_def.rb +44 -0
  74. data/spec/unit/language/syntax/to_ast/test_trackvar_def.rb +26 -0
  75. data/spec/unit/language/syntax/to_ast/test_unit_def.rb +28 -0
  76. data/spec/unit/language/syntax/to_ast/test_var_ref.rb +12 -0
  77. data/spec/unit/language/syntax/to_ast/test_when_clause.rb +15 -0
  78. data/spec/unit/language/syntax/to_ast/test_while_st.rb +24 -0
  79. data/spec/unit/language/test_ast.rb +4 -4
  80. data/spec/unit/language/test_elsif_flattener.rb +90 -0
  81. data/spec/unit/language/test_if_to_case.rb +107 -0
  82. data/spec/unit/language/{test_transformer.rb → test_rewriter.rb} +24 -11
  83. data/spec/unit/language/test_syntax.rb +1 -1
  84. data/spec/unit/language/test_to_graph.rb +9 -2
  85. metadata +120 -34
  86. data/lib/gisele/language/syntax/task_refinement.rb +0 -15
  87. data/lib/gisele/language/syntax/task_signature.rb +0 -15
  88. data/lib/gisele/language/transformer.rb +0 -38
  89. data/spec/unit/language/sugar_removal/test_if_to_guarded_commands.rb +0 -110
  90. data/spec/unit/language/syntax/test_grammar.rb +0 -317
  91. data/spec/unit/language/syntax/test_to_ast.rb +0 -257
@@ -1,45 +1,136 @@
1
1
  [
2
- :unit,
2
+ :unit_def,
3
3
  [
4
4
  :task_def,
5
- "Simple",
5
+ "Complete",
6
6
  [
7
- :task_signature,
7
+ :trackvar,
8
+ "everyOneHappy",
8
9
  [
9
- :fluent,
10
- "diagKnown",
10
+ :event_set,
11
+ "FirstTask:start"
12
+ ],
13
+ [
14
+ :event_set
15
+ ],
16
+ nil
17
+ ],
18
+ [
19
+ :fluent,
20
+ "someoneHappy",
21
+ [
22
+ :event_set,
23
+ "DrinkBeer:start",
24
+ "DrinkBeers:start"
25
+ ],
26
+ [
27
+ :event_set,
28
+ "DoNothingSpecial:end"
29
+ ],
30
+ false
31
+ ],
32
+ [
33
+ :task_def,
34
+ "DrinkBeers",
35
+ [
36
+ :while_st,
11
37
  [
12
- :event_set,
13
- "Diagnosis:start"
38
+ :bool_expr,
39
+ [
40
+ :bool_not,
41
+ [
42
+ :var_ref,
43
+ "drunk"
44
+ ]
45
+ ]
14
46
  ],
15
47
  [
16
- :event_set,
17
- "Treatment:end"
18
- ],
19
- nil
48
+ :task_call_st,
49
+ "DrinkBeer"
50
+ ]
20
51
  ]
21
52
  ],
22
53
  [
23
- :task_refinement,
54
+ :seq_st,
55
+ [
56
+ :task_call_st,
57
+ "FirstTask"
58
+ ],
24
59
  [
25
- :seq_st,
60
+ :if_st,
61
+ [
62
+ :bool_expr,
63
+ [
64
+ :var_ref,
65
+ "everyoneHappy"
66
+ ]
67
+ ],
68
+ [
69
+ :par_st,
70
+ [
71
+ :task_call_st,
72
+ "MakeJoy"
73
+ ],
74
+ [
75
+ :task_call_st,
76
+ "DrinkBeers"
77
+ ]
78
+ ],
79
+ [
80
+ :else_clause,
81
+ [
82
+ :if_st,
83
+ [
84
+ :bool_expr,
85
+ [
86
+ :var_ref,
87
+ "someoneHappy"
88
+ ]
89
+ ],
90
+ [
91
+ :task_call_st,
92
+ "DrinkBeer"
93
+ ],
94
+ [
95
+ :else_clause,
96
+ [
97
+ :task_call_st,
98
+ "DoNothingSpecial"
99
+ ]
100
+ ]
101
+ ]
102
+ ]
103
+ ],
104
+ [
105
+ :while_st,
106
+ [
107
+ :bool_expr,
108
+ [
109
+ :bool_not,
110
+ [
111
+ :var_ref,
112
+ "endOfTheDay"
113
+ ]
114
+ ]
115
+ ],
26
116
  [
27
117
  :case_st,
118
+ [
119
+ :var_ref,
120
+ "curState"
121
+ ],
28
122
  [
29
123
  :when_clause,
30
124
  [
31
125
  :bool_expr,
32
126
  [
33
- :bool_not,
34
- [
35
- :var_ref,
36
- "diagKnown"
37
- ]
127
+ :var_ref,
128
+ "somethingToDo"
38
129
  ]
39
130
  ],
40
131
  [
41
132
  :task_call_st,
42
- "Diagnosis"
133
+ "DoSomething"
43
134
  ]
44
135
  ],
45
136
  [
@@ -48,18 +139,21 @@
48
139
  :bool_expr,
49
140
  [
50
141
  :var_ref,
51
- "diagKnown"
142
+ "nothingToDo"
52
143
  ]
53
144
  ],
54
145
  [
55
146
  :task_call_st,
56
- "NoDiag"
147
+ "DoNothing"
148
+ ]
149
+ ],
150
+ [
151
+ :else_clause,
152
+ [
153
+ :task_call_st,
154
+ "WaitAndSee"
57
155
  ]
58
156
  ]
59
- ],
60
- [
61
- :task_call_st,
62
- "Treatment"
63
157
  ]
64
158
  ]
65
159
  ]
@@ -1,2 +1,2 @@
1
- gisele 0.2.0 (c) The University of Louvain
1
+ gisele 0.3.0 (c) The University of Louvain
2
2
  SystemExit
@@ -1,5 +1,20 @@
1
1
  task Complete
2
- refinement
2
+
3
+ trackvar everyOneHappy
4
+ {FirstTask:start}
5
+
6
+ fluent someoneHappy
7
+ {DrinkBeer:start, DrinkBeers:start},
8
+ {DoNothingSpecial:end}
9
+ initially false
10
+
11
+ task DrinkBeers
12
+ while not(drunk)
13
+ DrinkBeer
14
+ end
15
+ end
16
+
17
+ seq
3
18
  FirstTask
4
19
  if everyoneHappy
5
20
  par
@@ -12,7 +27,14 @@ task Complete
12
27
  DoNothingSpecial
13
28
  end
14
29
  while not(endOfTheDay)
15
- WaitAndSee
30
+ case curState
31
+ when somethingToDo
32
+ DoSomething
33
+ when nothingToDo
34
+ DoNothing
35
+ else
36
+ WaitAndSee
37
+ end
16
38
  end
17
39
  end
18
40
  end
@@ -1,56 +1,50 @@
1
1
  [
2
- :unit,
2
+ :unit_def,
3
3
  [
4
4
  :task_def,
5
5
  "Simple",
6
6
  [
7
- :task_signature,
7
+ :fluent,
8
+ "diagKnown",
8
9
  [
9
- :fluent,
10
- "diagKnown",
11
- [
12
- :event_set,
13
- "Diagnosis:start"
14
- ],
15
- [
16
- :event_set,
17
- "Treatment:end"
18
- ],
19
- nil
20
- ]
10
+ :event_set,
11
+ "Diagnosis:start"
12
+ ],
13
+ [
14
+ :event_set,
15
+ "Treatment:end"
16
+ ],
17
+ nil
21
18
  ],
22
19
  [
23
- :task_refinement,
20
+ :seq_st,
24
21
  [
25
- :seq_st,
22
+ :if_st,
26
23
  [
27
- :if_st,
24
+ :bool_expr,
28
25
  [
29
- :bool_expr,
26
+ :bool_not,
30
27
  [
31
- :bool_not,
32
- [
33
- :var_ref,
34
- "diagKnown"
35
- ]
36
- ]
37
- ],
38
- [
39
- :task_call_st,
40
- "Diagnosis"
41
- ],
42
- [
43
- :else_clause,
44
- [
45
- :task_call_st,
46
- "NoDiag"
28
+ :var_ref,
29
+ "diagKnown"
47
30
  ]
48
31
  ]
49
32
  ],
50
33
  [
51
34
  :task_call_st,
52
- "Treatment"
35
+ "Diagnosis"
36
+ ],
37
+ [
38
+ :else_clause,
39
+ [
40
+ :task_call_st,
41
+ "NoDiag"
42
+ ]
53
43
  ]
44
+ ],
45
+ [
46
+ :task_call_st,
47
+ "Treatment"
54
48
  ]
55
49
  ]
56
50
  ]
@@ -1,6 +1,10 @@
1
1
  task Simple
2
- fluent diagKnown {Diagnosis:start}, {Treatment:end}
3
- refinement
2
+
3
+ fluent diagKnown
4
+ {Diagnosis:start},
5
+ {Treatment:end}
6
+
7
+ seq
4
8
  if not(diagKnown)
5
9
  Diagnosis
6
10
  else
@@ -8,4 +12,5 @@ task Simple
8
12
  end
9
13
  Treatment
10
14
  end
15
+
11
16
  end
data/spec/spec_helper.rb CHANGED
@@ -12,6 +12,16 @@ ensure
12
12
  end
13
13
 
14
14
  module SpecHelpers
15
+ include Gisele::Language::AST::Helpers
16
+
17
+ def parse(text, rule, consume = true)
18
+ grammar = Gisele::Language::Syntax::Grammar
19
+ grammar.parse(text, :root => rule, :consume => consume)
20
+ end
21
+
22
+ def ast(text, rule, consume = true)
23
+ parse(text, rule, consume).to_ast
24
+ end
15
25
 
16
26
  def fixtures_dir
17
27
  (Path.dir/:fixtures)
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
  module Gisele::Language::AST
3
3
  describe Node do
4
- include Helpers
5
4
 
6
5
  describe 'rule_name' do
7
6
  it 'returns the first array element' do
@@ -32,24 +31,24 @@ module Gisele::Language::AST
32
31
  describe 'copy' do
33
32
 
34
33
  it 'collects block results ala `inject`' do
35
- source = node([:unit, "world", "gisele"])
34
+ source = node([:unit_def, "world", "gisele"])
36
35
  target = source.copy do |memo,child|
37
36
  memo << child.upcase
38
37
  end
39
- target.should be_a(Unit)
40
- target.should eq([:unit, "WORLD", "GISELE"])
38
+ target.should be_a(UnitDef)
39
+ target.should eq([:unit_def, "WORLD", "GISELE"])
41
40
  end
42
41
 
43
42
  it 'returns a real equal copy when no children' do
44
- source = node([:unit])
43
+ source = node([:unit_def])
45
44
  target = source.copy do |memo,child| end
46
45
  target.should eq(source)
47
46
  target.object_id.should_not eq(source.object_id)
48
- target.should be_a(Unit)
47
+ target.should be_a(UnitDef)
49
48
  end
50
49
 
51
50
  it 'keeps the markers unchanged' do
52
- node = node([:unit], {:hello => "World"})
51
+ node = node([:unit_def], {:hello => "World"})
53
52
  copy = node.copy do |memo,child| end
54
53
  copy.markers.should eq({:hello => "World"})
55
54
  copy.markers.object_id.should_not eq(node.markers.object_id)
@@ -60,18 +59,18 @@ module Gisele::Language::AST
60
59
  describe 'dup' do
61
60
 
62
61
  it 'duplicates the underlying array' do
63
- arr = [:unit, "etc."]
62
+ arr = [:unit_def, "etc."]
64
63
  node(arr).dup.should eq(arr)
65
64
  end
66
65
 
67
66
  it 'ensures duplicated array is still a node' do
68
- arr = [:unit, "etc."]
69
- node(arr).dup.should be_a(Unit)
67
+ arr = [:unit_def, "etc."]
68
+ node(arr).dup.should be_a(UnitDef)
70
69
  node(arr).dup.should be_a(Node)
71
70
  end
72
71
 
73
72
  it 'keeps the markers unchanged' do
74
- node = node([:unit, "etc."], {:hello => "World"})
73
+ node = node([:unit_def, "etc."], {:hello => "World"})
75
74
  copy = node.dup
76
75
  copy.markers.should eq({:hello => "World"})
77
76
  copy.markers.object_id.should_not eq(node.markers.object_id)
@@ -0,0 +1,87 @@
1
+ require 'spec_helper'
2
+ module Gisele::Language
3
+ class Rewriter
4
+ describe Helper do
5
+
6
+ class FooHelper < Helper
7
+ module Methods end
8
+
9
+ def on_hello(rw, node)
10
+ raise unless rw.is_a?(FooRewriter)
11
+ [:foo_hello, yield(rw, node)]
12
+ end
13
+
14
+ end
15
+
16
+ class FooRewriter < Rewriter
17
+ FooHelper.install_on(self)
18
+ end
19
+
20
+ describe "install_on" do
21
+
22
+ it 'installs the methods module on the rewriter' do
23
+ modules = FooRewriter.included_modules
24
+ modules.include?(FooHelper::Methods).should be_true
25
+ end
26
+
27
+ it 'adds an instance of the helper to the helpers list' do
28
+ helper = FooRewriter.helpers.last
29
+ helper.should be_a(FooHelper)
30
+ end
31
+
32
+ it 'does not polute the Rewriter class' do
33
+ Rewriter.helpers.size.should eq(1)
34
+ end
35
+
36
+ end # install_on
37
+
38
+ describe 'call' do
39
+
40
+ let(:helper) { FooHelper.new }
41
+ let(:rewriter) { FooRewriter.new }
42
+ let(:toplevel) {
43
+ Proc.new do |rw,node|
44
+ rw.should eq(rewriter)
45
+ [:toplevel, node]
46
+ end
47
+ }
48
+
49
+ it 'dispatches to the method when it exists' do
50
+ expected = \
51
+ [:foo_hello,
52
+ [:toplevel,
53
+ [:hello, "world"] ]]
54
+ got = helper.call(rewriter, [:hello, "world"], &toplevel)
55
+ got.should eq(expected)
56
+ end
57
+
58
+ it 'falls back to yielding when no method' do
59
+ expected = \
60
+ [:toplevel,
61
+ [:nosuchone] ]
62
+ got = helper.call(rewriter, [:nosuchone], &toplevel)
63
+ got.should eq(expected)
64
+ end
65
+
66
+ it 'calls next_in_chain when set' do
67
+ helper.next_in_chain = Class.new do
68
+ def call(rw, node)
69
+ raise unless rw.is_a?(FooRewriter)
70
+ yield rw, [:next, node]
71
+ end
72
+ end.new
73
+
74
+ expected = \
75
+ [:foo_hello,
76
+ [:toplevel,
77
+ [:next,
78
+ [:hello, "world"] ]]]
79
+ got = helper.call(rewriter, [:hello, "world"], &toplevel)
80
+ got.should eq(expected)
81
+ end
82
+
83
+ end # call
84
+
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+ module Gisele::Language
3
+ class Rewriter
4
+ describe Scoping do
5
+
6
+ let(:rw_class) do
7
+ Class.new(Rewriter) do
8
+
9
+ def on_hello(node)
10
+ scope_stack.dup
11
+ end
12
+
13
+ def on_missing(node)
14
+ call(node.children.last)
15
+ end
16
+
17
+ Scoping.install_on self
18
+ end
19
+ end
20
+ let(:rw){ rw_class.new }
21
+
22
+ it 'installs the methods on the rewriter' do
23
+ rw.respond_to?(:scope_stack).should be_true
24
+ end
25
+
26
+ it 'does nothing special on non _def nodes' do
27
+ node = [:hello, "world"]
28
+ rw.call(node).should eq([])
29
+ end
30
+
31
+ it 'keeps _def nodes as successive scopes' do
32
+ second = [:task_def, [:hello]]
33
+ first = [:task_def, second]
34
+ rw.call(first).should eq([first, second])
35
+ end
36
+
37
+ it 'pops scopes when returning along the stack' do
38
+ second = [:task_def, [:hello]]
39
+ first = [:task_def, second]
40
+ rw.call(first)
41
+ rw.scope_stack.should eq([])
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+ module Gisele::Language
3
+ class Rewriter
4
+ describe WorkOnNodes do
5
+
6
+ let(:won){ WorkOnNodes.new }
7
+
8
+ it 'extends input nodes' do
9
+ node = [:hello, "world"]
10
+ seen = won.call(:rw, node) do |_,n|
11
+ n.should be_a(AST::Node)
12
+ n
13
+ end
14
+ seen.should eq(node)
15
+ end
16
+
17
+ it 'extends output nodes' do
18
+ node = [:hello, "world"]
19
+ seen = won.call(:rw, node) do |_,n|
20
+ n.should be_a(AST::Node)
21
+ [:result]
22
+ end
23
+ seen.should eq([:result])
24
+ seen.should be_a(AST::Node)
25
+ end
26
+
27
+ it 'does not require the output to be a node' do
28
+ node = [:hello, "world"]
29
+ seen = won.call(:rw, node) do |_,n|
30
+ n.should be_a(AST::Node)
31
+ "blah"
32
+ end
33
+ seen.should eq("blah")
34
+ seen.should_not be_a(AST::Node)
35
+ end
36
+
37
+ it 'fails unless the input looks a node' do
38
+ lambda{
39
+ won.call(:rw, "blah") do |_,n| end
40
+ }.should raise_error(ArgumentError, /blah/)
41
+ end
42
+
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+ module Gisele::Language::Syntax
3
+ describe Grammar, 'bool_expr' do
4
+
5
+ it 'parses single variable references' do
6
+ parse('diagKnown', :bool_expr).should eq('diagKnown')
7
+ end
8
+
9
+ it 'parses boolean literals' do
10
+ parse('true', :bool_expr).should eq('true')
11
+ parse('false', :bool_expr).should eq('false')
12
+ end
13
+
14
+ it 'parses negated expression' do
15
+ parse('not diagKnown', :bool_expr).should eq('not diagKnown')
16
+ parse('not true', :bool_expr).should eq('not true')
17
+ parse('not false', :bool_expr).should eq('not false')
18
+ end
19
+
20
+ it 'parses or expressions' do
21
+ parse('diagKnown or platLow', :bool_expr).should eq('diagKnown or platLow')
22
+ end
23
+
24
+ it 'parses and expressions' do
25
+ parse('diagKnown and platLow', :bool_expr).should eq('diagKnown and platLow')
26
+ end
27
+
28
+ it 'parses complex expressions' do
29
+ expr = 'diagKnown and (platLow or not(metastased and mplus))'
30
+ parse(expr, :bool_expr).should eq(expr)
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+ module Gisele::Language::Syntax
3
+ describe Grammar, 'boolean_literal' do
4
+
5
+ it 'parses booleans' do
6
+ parse('true', :boolean_literal).should eq('true')
7
+ parse('false', :boolean_literal).should eq('false')
8
+ end
9
+
10
+ it 'does not parses integers' do
11
+ lambda{
12
+ parse('0', :boolean_literal)
13
+ }.should raise_error(Citrus::ParseError)
14
+ end
15
+
16
+ end
17
+ end