Skip to content

Commit 23c05cf

Browse files
author
mgeipel
committed
fixed #102
1 parent 205a527 commit 23c05cf

File tree

11 files changed

+1194
-880
lines changed

11 files changed

+1194
-880
lines changed

src/main/antlr3/org/culturegraph/mf/flux/parser/FlowBuilder.g

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,54 +29,62 @@ import java.util.HashMap;
2929
import java.util.ArrayList;
3030
import java.util.List;
3131
import java.util.Collections;
32-
import org.culturegraph.mf.flux.Flow;
32+
import org.culturegraph.mf.flux.parser.FluxProgramm;
3333
import org.culturegraph.mf.exceptions.FluxParseException;
3434
}
3535

3636
@members {
37-
private Flow flow;
37+
private FluxProgramm flux = new FluxProgramm();
3838
private Map<String, String> vars = new HashMap<String, String>();
3939

4040
public final void addVaribleAssignements(final Map<String, String> vars) {
4141
this.vars.putAll(vars);
4242
}
4343
}
4444

45-
flux returns [List<Flow> flows = new ArrayList<Flow>()]
45+
flux returns [FluxProgramm retValue = flux]
4646
:
4747
varDefs
4848
(
4949
flow
5050
{
51-
$flows.add(this.flow);
51+
flux.nextFlow();
5252
}
5353
)*
54+
55+
{
56+
flux.compile();
57+
}
5458
;
5559

5660
flow
57-
@init {
58-
this.flow = new Flow();
59-
}
6061
:
6162
(
6263
StdIn
6364
{
64-
flow.setStdInStart();
65+
flux.setStdInStart();
6566
}
6667
| e=exp
6768
{
68-
flow.setStringStart($e.value);
69+
flux.setStringStart($e.value);
6970
}
71+
| ws=Wormhole
72+
{
73+
flux.setWormholeStart($ws.text);
74+
}
7075
)
7176
flowtail
77+
(
78+
we=Wormhole
79+
{
80+
flux.setWormholeEnd($we.text);
81+
}
82+
)?
7283
;
7384

7485
varDefs
7586
:
76-
varDef*
77-
{
78-
79-
}
87+
varDef*
8088
;
8189

8290
varDef
@@ -101,21 +109,21 @@ tee
101109
^(
102110
TEE
103111
{
104-
flow.startTee();
112+
flux.startTee();
105113
//System.out.println("start tee");
106114
}
107115
(
108116
^(SUBFLOW flowtail)
109117

110118
{
111-
flow.endSubFlow();
119+
flux.endSubFlow();
112120
// System.out.println("end subflow");
113121
}
114122
)+
115123
)
116124

117125
{
118-
flow.endTee();
126+
flux.endTee();
119127
//System.out.println("end tee");
120128
}
121129
;
@@ -178,7 +186,7 @@ final List<Object> cArgs = new ArrayList<Object>();
178186
)
179187

180188
{
181-
flow.addElement(flow.createElement($name.text, namedArgs, cArgs));
189+
flux.addElement($name.text, namedArgs, cArgs);
182190
}
183191
;
184192

0 commit comments

Comments
 (0)