gisele 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +33 -13
- data/Gemfile +3 -2
- data/Gemfile.lock +6 -3
- data/LICENCE.md +1 -1
- data/README.md +5 -2
- data/Rakefile +0 -8
- data/examples/rectal-cancer-pathway/RectalCancerPathway.gis +1 -1
- data/gisele.gemspec +3 -2
- data/gisele.noespec +4 -3
- data/lib/gisele.rb +11 -7
- data/lib/gisele/command.rb +28 -19
- data/lib/gisele/compiling.rb +2 -0
- data/lib/gisele/compiling/to_glts.rb +125 -0
- data/lib/gisele/compiling/to_graph.rb +160 -0
- data/lib/gisele/compiling/to_graph.yml +20 -0
- data/lib/gisele/language.rb +22 -36
- data/lib/gisele/language/ast/bool_and.rb +1 -1
- data/lib/gisele/language/ast/bool_expr.rb +9 -1
- data/lib/gisele/language/ast/bool_not.rb +1 -1
- data/lib/gisele/language/ast/bool_or.rb +1 -1
- data/lib/gisele/language/ast/case_st.rb +1 -1
- data/lib/gisele/language/ast/else_clause.rb +1 -1
- data/lib/gisele/language/ast/node.rb +4 -66
- data/lib/gisele/language/grammar.citrus +2 -2
- data/lib/gisele/language/grammar.sexp.yml +83 -80
- data/lib/gisele/language/processors.rb +2 -2
- data/lib/gisele/language/processors/elsif_flattener.rb +14 -13
- data/lib/gisele/language/processors/if_to_case.rb +20 -18
- data/lib/gisele/language/processors/scoping_helper.rb +32 -0
- data/lib/gisele/language/processors/sugar_removal.rb +10 -5
- data/lib/gisele/language/syntax/case_st.rb +1 -1
- data/lib/gisele/language/syntax/node.rb +6 -2
- data/lib/gisele/language/syntax/when_clause.rb +1 -1
- data/lib/gisele/loader.rb +2 -1
- data/lib/gisele/version.rb +1 -1
- data/spec/command/main/gisele_glts.cmd +1 -0
- data/spec/command/main/gisele_glts.stdout +85 -0
- data/spec/command/main/gisele_help.stdout +3 -2
- data/spec/spec_helper.rb +2 -3
- data/spec/test_examples.rb +2 -2
- data/spec/unit/compiling/test_to_glts.rb +20 -0
- data/spec/unit/compiling/test_to_graph.rb +19 -0
- data/spec/unit/language/ast/test_bool_expr.rb +50 -0
- data/spec/unit/language/grammar_sexp/test_fluent_def.rb +1 -1
- data/spec/unit/language/processors/test_elsif_flattener.rb +3 -3
- data/spec/unit/language/processors/test_if_to_case.rb +7 -7
- data/spec/unit/language/processors/test_scoping_helper.rb +45 -0
- data/spec/unit/language/syntax/grammar/test_bool_expr.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_boolean_literal.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_case_st.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_event.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_event_name.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_event_set.rb +2 -3
- data/spec/unit/language/syntax/grammar/test_fluent_def.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_if_st.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_par_st.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_process_statement.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_seq_st.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_spaces.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_spacing.rb +2 -3
- data/spec/unit/language/syntax/grammar/test_task_def.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_task_name.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_task_start_or_end.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_trackvar_def.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_unit_def.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_variable_name.rb +24 -3
- data/spec/unit/language/syntax/grammar/test_when_clause.rb +2 -2
- data/spec/unit/language/syntax/grammar/test_while_st.rb +2 -2
- data/spec/unit/language/syntax/to_ast/test_bool_expr.rb +5 -1
- data/spec/unit/language/syntax/to_ast/test_case_st.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_else_clause.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_elsif_clause.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_event_set.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_fluent_def.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_if_st.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_par_st.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_seq_st.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_task_call_st.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_task_def.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_trackvar_def.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_unit_def.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_var_ref.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_when_clause.rb +1 -1
- data/spec/unit/language/syntax/to_ast/test_while_st.rb +1 -1
- data/spec/unit/language/test_syntax.rb +36 -38
- data/spec/unit/test_gisele.rb +1 -1
- metadata +189 -190
- data/lib/gisele/language/ast.rb +0 -14
- data/lib/gisele/language/ast/helpers.rb +0 -43
- data/lib/gisele/language/ast/unit_def.rb +0 -10
- data/lib/gisele/language/grammar.dot.yml +0 -19
- data/lib/gisele/language/processors/to_graph.rb +0 -146
- data/lib/gisele/language/rewriter.rb +0 -60
- data/lib/gisele/language/rewriter/helper.rb +0 -41
- data/lib/gisele/language/rewriter/scoping.rb +0 -34
- data/lib/gisele/language/rewriter/work_on_nodes.rb +0 -30
- data/lib/gisele/language/syntax.rb +0 -29
- data/spec/unit/language/ast/test_node.rb +0 -82
- data/spec/unit/language/processors/test_to_graph.rb +0 -17
- data/spec/unit/language/rewriter/test_helper.rb +0 -87
- data/spec/unit/language/rewriter/test_scoping.rb +0 -46
- data/spec/unit/language/rewriter/test_work_on_nodes.rb +0 -45
- data/spec/unit/language/test_ast.rb +0 -38
- data/spec/unit/language/test_rewriter.rb +0 -81
- data/spec/unit/test_language.rb +0 -35
@@ -1,28 +1,28 @@
|
|
1
1
|
module Gisele
|
2
2
|
module Language
|
3
|
-
class IfToCase < Rewriter
|
4
|
-
|
3
|
+
class IfToCase < Sexpr::Rewriter
|
4
|
+
grammar Language
|
5
5
|
|
6
|
-
def on_if_st(
|
7
|
-
condition, dost, *clauses =
|
6
|
+
def on_if_st(sexpr)
|
7
|
+
condition, dost, *clauses = sexpr.sexpr_body
|
8
8
|
|
9
9
|
# create case_st with same markers as the if_st
|
10
|
-
when_clause = [:when_clause, condition,
|
11
|
-
when_clause =
|
10
|
+
when_clause = [:when_clause, condition, apply(dost)]
|
11
|
+
when_clause = sexpr(when_clause, sexpr.tracking_markers)
|
12
12
|
base = [:case_st, nil, when_clause]
|
13
|
-
base =
|
13
|
+
base = sexpr(base, sexpr.tracking_markers)
|
14
14
|
|
15
15
|
# this is the condition for elsif clauses
|
16
16
|
@condition = negate(condition.last)
|
17
17
|
|
18
18
|
# make injection now
|
19
19
|
clauses.inject base do |memo,clause|
|
20
|
-
memo <<
|
20
|
+
memo << apply(clause)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def on_elsif_clause(
|
25
|
-
condition, dost, =
|
24
|
+
def on_elsif_clause(sexpr)
|
25
|
+
condition, dost, = sexpr.sexpr_body
|
26
26
|
|
27
27
|
# install new conditions for me and next elsif clauses
|
28
28
|
condition = condition.last
|
@@ -33,25 +33,27 @@ module Gisele
|
|
33
33
|
base = \
|
34
34
|
[:when_clause,
|
35
35
|
[:bool_expr, [:bool_and, condition, previous]],
|
36
|
-
|
37
|
-
|
36
|
+
apply(dost) ]
|
37
|
+
sexpr(base, sexpr.tracking_markers)
|
38
38
|
end
|
39
39
|
|
40
|
-
def on_else_clause(
|
41
|
-
dost, =
|
40
|
+
def on_else_clause(sexpr)
|
41
|
+
dost, = sexpr.sexpr_body
|
42
42
|
|
43
43
|
# convert else to when and keep the markers
|
44
44
|
base = \
|
45
45
|
[:when_clause,
|
46
46
|
[:bool_expr, @condition],
|
47
|
-
|
48
|
-
|
47
|
+
apply(dost)]
|
48
|
+
sexpr(base, sexpr.tracking_markers)
|
49
49
|
end
|
50
50
|
|
51
|
+
alias :on_missing :copy_and_apply
|
52
|
+
|
51
53
|
private
|
52
54
|
|
53
55
|
def negate(cond)
|
54
|
-
if cond.
|
56
|
+
if cond.first == :bool_not
|
55
57
|
cond.last
|
56
58
|
else
|
57
59
|
[:bool_not, cond]
|
@@ -60,4 +62,4 @@ module Gisele
|
|
60
62
|
|
61
63
|
end # class IfToCase
|
62
64
|
end # module Language
|
63
|
-
end # module Gisele
|
65
|
+
end # module Gisele
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Gisele
|
2
|
+
module Language
|
3
|
+
class ScopingHelper < Sexpr::Processor::Helper
|
4
|
+
|
5
|
+
module Methods
|
6
|
+
|
7
|
+
def scope_stack
|
8
|
+
@scope_stack ||= []
|
9
|
+
end
|
10
|
+
|
11
|
+
def with_scope(scope)
|
12
|
+
scope_stack.push(scope)
|
13
|
+
result = yield
|
14
|
+
scope_stack.pop
|
15
|
+
result
|
16
|
+
end
|
17
|
+
|
18
|
+
end # module Methods
|
19
|
+
|
20
|
+
def on_missing(rw, sexpr)
|
21
|
+
if sexpr.first.to_s =~ /_def/
|
22
|
+
rw.with_scope(sexpr) do
|
23
|
+
yield(rw, sexpr)
|
24
|
+
end
|
25
|
+
else
|
26
|
+
yield(rw, sexpr)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end # module ScopingHelper
|
31
|
+
end # module Language
|
32
|
+
end # module Gisele
|
@@ -1,12 +1,17 @@
|
|
1
1
|
module Gisele
|
2
2
|
module Language
|
3
|
-
class SugarRemoval < Rewriter
|
4
|
-
|
3
|
+
class SugarRemoval < Sexpr::Rewriter
|
4
|
+
grammar Language
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
# (elsif ... -> else if ...)
|
7
|
+
use ElsifFlattener
|
8
|
+
|
9
|
+
def apply(sexpr)
|
10
|
+
# all is already done by preprocessors so that we can simply return
|
11
|
+
# the s-expression.
|
12
|
+
sexpr
|
8
13
|
end
|
9
14
|
|
10
15
|
end # class SugarRemoval
|
11
16
|
end # module Language
|
12
|
-
end # module Gisele
|
17
|
+
end # module Gisele
|
@@ -4,7 +4,11 @@ module Gisele
|
|
4
4
|
module Node
|
5
5
|
|
6
6
|
def to_ast
|
7
|
-
Language::
|
7
|
+
Language::sexpr(value, {:citrus_match => self})
|
8
|
+
end
|
9
|
+
|
10
|
+
def value
|
11
|
+
_to_ast
|
8
12
|
end
|
9
13
|
|
10
14
|
end # module Node
|
@@ -33,4 +37,4 @@ require_relative 'elsif_clause'
|
|
33
37
|
require_relative 'case_st'
|
34
38
|
require_relative 'when_clause'
|
35
39
|
require_relative 'task_def'
|
36
|
-
require_relative 'unit_def'
|
40
|
+
require_relative 'unit_def'
|
data/lib/gisele/loader.rb
CHANGED
data/lib/gisele/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
gisele --glts tasks/complete.gis
|
@@ -0,0 +1,85 @@
|
|
1
|
+
digraph G {
|
2
|
+
graph [rankdir="LR"];
|
3
|
+
0 [color="black" fillcolor="green" shape="circle" style="filled"];
|
4
|
+
2 [color="black" fillcolor="white" shape="circle" style="filled"];
|
5
|
+
4 [color="black" fillcolor="white" shape="circle" style="filled"];
|
6
|
+
6 [color="black" fillcolor="white" shape="circle" style="filled"];
|
7
|
+
5 [color="black" fillcolor="white" shape="circle" style="filled"];
|
8
|
+
7 [color="black" fillcolor="white" shape="circle" style="filled"];
|
9
|
+
9 [color="black" fillcolor="white" shape="circle" style="filled"];
|
10
|
+
10 [color="black" fillcolor="white" shape="circle" style="filled"];
|
11
|
+
21 [color="black" fillcolor="white" shape="circle" style="filled"];
|
12
|
+
18 [color="black" fillcolor="white" shape="circle" style="filled"];
|
13
|
+
23 [color="black" fillcolor="white" shape="circle" style="filled"];
|
14
|
+
20 [color="black" fillcolor="white" shape="circle" style="filled"];
|
15
|
+
12 [color="black" fillcolor="white" shape="circle" style="filled"];
|
16
|
+
22 [color="black" fillcolor="white" shape="circle" style="filled"];
|
17
|
+
14 [color="black" fillcolor="white" shape="circle" style="filled"];
|
18
|
+
19 [color="black" fillcolor="white" shape="circle" style="filled"];
|
19
|
+
8 [color="black" fillcolor="white" shape="circle" style="filled"];
|
20
|
+
13 [color="black" fillcolor="white" shape="circle" style="filled"];
|
21
|
+
15 [color="black" fillcolor="white" shape="circle" style="filled"];
|
22
|
+
24 [color="black" fillcolor="white" shape="circle" style="filled"];
|
23
|
+
17 [color="black" fillcolor="white" shape="circle" style="filled"];
|
24
|
+
26 [color="black" fillcolor="white" shape="circle" style="filled"];
|
25
|
+
16 [color="black" fillcolor="white" shape="circle" style="filled"];
|
26
|
+
25 [color="black" fillcolor="white" shape="circle" style="filled"];
|
27
|
+
27 [color="black" fillcolor="white" shape="circle" style="filled"];
|
28
|
+
3 [color="black" fillcolor="white" shape="circle" style="filled"];
|
29
|
+
29 [color="black" fillcolor="white" shape="circle" style="filled"];
|
30
|
+
11 [color="black" fillcolor="white" shape="circle" style="filled"];
|
31
|
+
36 [color="black" fillcolor="white" shape="circle" style="filled"];
|
32
|
+
1 [color="black" fillcolor="white" shape="circle" style="filled"];
|
33
|
+
30 [color="black" fillcolor="white" shape="circle" style="filled"];
|
34
|
+
33 [color="black" fillcolor="white" shape="circle" style="filled"];
|
35
|
+
32 [color="black" fillcolor="white" shape="circle" style="filled"];
|
36
|
+
38 [color="black" fillcolor="white" shape="circle" style="filled"];
|
37
|
+
35 [color="black" fillcolor="white" shape="circle" style="filled"];
|
38
|
+
34 [color="black" fillcolor="white" shape="circle" style="filled"];
|
39
|
+
37 [color="black" fillcolor="white" shape="circle" style="filled"];
|
40
|
+
31 [color="black" fillcolor="white" shape="circle" style="filled"];
|
41
|
+
28 [color="black" fillcolor="white" shape="circle" style="filled"];
|
42
|
+
4 -> 6 [label="FirstTask:start"];
|
43
|
+
6 -> 5 [label="FirstTask:end"];
|
44
|
+
2 -> 4 [label=""];
|
45
|
+
7 -> 9 [label=""];
|
46
|
+
12 -> 14 [label="MakeJoy:start"];
|
47
|
+
14 -> 13 [label="MakeJoy:end"];
|
48
|
+
10 -> 12 [label=""];
|
49
|
+
15 -> 17 [label="DrinkBeers:start"];
|
50
|
+
17 -> 16 [label="DrinkBeers:end"];
|
51
|
+
13 -> 15 [label=""];
|
52
|
+
16 -> 11 [label=""];
|
53
|
+
9 -> 10 [label="[everyoneHappy]"];
|
54
|
+
11 -> 8 [label=""];
|
55
|
+
18 -> 20 [label="DrinkBeer:start"];
|
56
|
+
20 -> 19 [label="DrinkBeer:end"];
|
57
|
+
9 -> 18 [label="[(someoneHappy and not(everyoneHappy))]"];
|
58
|
+
19 -> 8 [label=""];
|
59
|
+
21 -> 23 [label="DoNothingSpecial:start"];
|
60
|
+
23 -> 22 [label="DoNothingSpecial:end"];
|
61
|
+
9 -> 21 [label="[(not(someoneHappy) and not(everyoneHappy))]"];
|
62
|
+
22 -> 8 [label=""];
|
63
|
+
5 -> 7 [label=""];
|
64
|
+
24 -> 26 [label=""];
|
65
|
+
27 -> 29 [label=""];
|
66
|
+
30 -> 32 [label="DoSomething:start"];
|
67
|
+
32 -> 31 [label="DoSomething:end"];
|
68
|
+
29 -> 30 [label="[somethingToDo]"];
|
69
|
+
31 -> 28 [label=""];
|
70
|
+
33 -> 35 [label="DoNothing:start"];
|
71
|
+
35 -> 34 [label="DoNothing:end"];
|
72
|
+
29 -> 33 [label="[nothingToDo]"];
|
73
|
+
34 -> 28 [label=""];
|
74
|
+
36 -> 38 [label="WaitAndSee:start"];
|
75
|
+
38 -> 37 [label="WaitAndSee:end"];
|
76
|
+
29 -> 36 [label="[(not(someoneHappy) and not(everyoneHappy))]"];
|
77
|
+
37 -> 28 [label=""];
|
78
|
+
26 -> 25 [label="[endOfTheDay]"];
|
79
|
+
26 -> 27 [label="[not(endOfTheDay)]"];
|
80
|
+
28 -> 26 [label=""];
|
81
|
+
8 -> 24 [label=""];
|
82
|
+
25 -> 3 [label=""];
|
83
|
+
0 -> 2 [label=""];
|
84
|
+
3 -> 1 [label=""];
|
85
|
+
}
|
@@ -6,9 +6,10 @@ SYNOPSIS
|
|
6
6
|
gisele [--ast | --graph] PROCESS_FILE
|
7
7
|
|
8
8
|
OPTIONS
|
9
|
-
--ast=[MODE] Prints the process abstract syntax tree (debug,ruby)
|
10
9
|
--no-sugar Apply syntactic sugar removal
|
11
|
-
--
|
10
|
+
--ast=[MODE] Compile as an abstract syntax tree (debug,ruby)
|
11
|
+
--graph=[MODE] Compile as a workflow graph (dot)
|
12
|
+
--glts=[MODE] Compile as guarded labeled transition system (dot)
|
12
13
|
--help Show this help message
|
13
14
|
--version Show version and exit
|
14
15
|
|
data/spec/spec_helper.rb
CHANGED
@@ -12,10 +12,9 @@ ensure
|
|
12
12
|
end
|
13
13
|
|
14
14
|
module SpecHelpers
|
15
|
-
include Gisele::Language::AST::Helpers
|
16
15
|
|
17
16
|
def parse(text, rule, consume = true)
|
18
|
-
grammar = Gisele::Language::
|
17
|
+
grammar = Gisele::Language::Grammar
|
19
18
|
grammar.parse(text, :root => rule, :consume => consume)
|
20
19
|
end
|
21
20
|
|
@@ -36,7 +35,7 @@ module SpecHelpers
|
|
36
35
|
end
|
37
36
|
|
38
37
|
def sexp_grammar
|
39
|
-
Gisele::Language
|
38
|
+
Gisele::Language
|
40
39
|
end
|
41
40
|
|
42
41
|
def simple_ast
|
data/spec/test_examples.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Gisele
|
3
|
+
module Compiling
|
4
|
+
describe ToGlts do
|
5
|
+
|
6
|
+
it 'returns an array of Automaton when called on a unit_def' do
|
7
|
+
got = ToGlts.call(complete_ast)
|
8
|
+
got.should be_a(Array)
|
9
|
+
got.all?{|x| x.is_a? Stamina::Automaton}.should be_true
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'returns a Digraph when called on a task_def' do
|
13
|
+
got = ToGlts.call(complete_ast.last)
|
14
|
+
got.should be_a(Stamina::Automaton)
|
15
|
+
got.depth
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Gisele
|
3
|
+
module Compiling
|
4
|
+
describe ToGraph do
|
5
|
+
|
6
|
+
it 'returns an array of Digraphs when called on a unit_def' do
|
7
|
+
got = ToGraph.call(complete_ast)
|
8
|
+
got.should be_a(Array)
|
9
|
+
got.all?{|x| x.is_a? Yargi::Digraph}.should be_true
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'returns a Digraph when called on a task_def' do
|
13
|
+
got = ToGraph.call(complete_ast.last)
|
14
|
+
got.should be_a(Yargi::Digraph)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Gisele::Language::AST
|
3
|
+
describe BoolExpr, "negate" do
|
4
|
+
|
5
|
+
def sexpr(expr, options = {})
|
6
|
+
Gisele.sexpr(Gisele.parse(expr, options))
|
7
|
+
end
|
8
|
+
|
9
|
+
subject{ sexpr(expr, :root => :bool_expr).negate }
|
10
|
+
|
11
|
+
shared_examples_for 'A negated bool_expr' do
|
12
|
+
|
13
|
+
it 'is consistently rewrited' do
|
14
|
+
(Gisele::Language[:bool_expr] === subject).should be_true
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'is correctly tagged' do
|
18
|
+
subject.should be_a(Sexpr)
|
19
|
+
subject.should be_a(BoolExpr)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'has no immediate traceability marker' do
|
23
|
+
subject.citrus_match.should be_nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "on a normal expression" do
|
28
|
+
let(:expr){ "x and y" }
|
29
|
+
|
30
|
+
it_behaves_like 'A negated bool_expr'
|
31
|
+
|
32
|
+
it "negates as expected" do
|
33
|
+
expected = sexpr("not(x and y)", :root => :bool_expr)
|
34
|
+
subject.should eq(expected)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "on a negated expression" do
|
39
|
+
let(:expr){ "not(x and y)" }
|
40
|
+
|
41
|
+
it_behaves_like 'A negated bool_expr'
|
42
|
+
|
43
|
+
it "removes the negation" do
|
44
|
+
expected = sexpr("x and y", :root => :bool_expr)
|
45
|
+
subject.should eq(expected)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
module Gisele::Language
|
3
3
|
describe "the Sexp grammar", "fluent_def" do
|
4
4
|
|
5
|
-
let(:g){
|
5
|
+
let(:g){ Gisele::Language }
|
6
6
|
|
7
7
|
it 'matches an fluent with initial value' do
|
8
8
|
fluent = [:fluent_def, "name", [:event_set, "start"], [:event_set, "stop"], true]
|
@@ -3,11 +3,11 @@ module Gisele::Language
|
|
3
3
|
describe ElsifFlattener do
|
4
4
|
|
5
5
|
def ast(source)
|
6
|
-
|
6
|
+
Gisele.ast(Gisele.parse(source.strip, :root => :if_st))
|
7
7
|
end
|
8
8
|
|
9
9
|
def rewrite(ast)
|
10
|
-
@rewrited = ElsifFlattener.
|
10
|
+
@rewrited = ElsifFlattener.call(ast)
|
11
11
|
end
|
12
12
|
|
13
13
|
after{
|
@@ -91,4 +91,4 @@ module Gisele::Language
|
|
91
91
|
end
|
92
92
|
|
93
93
|
end
|
94
|
-
end
|
94
|
+
end
|