1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
package net.sf.jmatchparser.template.engine.template.command.plain; |
19 | |
|
20 | |
import net.sf.jmatchparser.template.engine.operation.XMLBlockEndOperation; |
21 | |
import net.sf.jmatchparser.template.engine.operation.XMLBlockStartOperation; |
22 | |
import net.sf.jmatchparser.template.engine.parameter.Parameter; |
23 | |
import net.sf.jmatchparser.template.engine.template.PlainBlockCommandState; |
24 | |
import net.sf.jmatchparser.template.engine.template.MatchTemplateImpl; |
25 | |
|
26 | 1 | public class XMLBlockCommand extends Command { |
27 | |
|
28 | |
@Override |
29 | |
public PlainBlockCommandState parse(MatchTemplateImpl template, String parameters) { |
30 | 6 | Parameter param = Parameter.parseParameter(parameters, template.getSpecialTags()); |
31 | 6 | template.appendOperation(new XMLBlockStartOperation(template.getCurrentTemplatePosition(), param)); |
32 | 6 | return new XMLBlockCommandState(template); |
33 | |
} |
34 | |
|
35 | 1 | private class XMLBlockCommandState extends PlainBlockCommandState { |
36 | |
|
37 | 6 | public XMLBlockCommandState(MatchTemplateImpl template) { |
38 | 6 | super(template); |
39 | 6 | } |
40 | |
|
41 | |
@Override |
42 | |
public boolean canParse(String commandName) { |
43 | 6 | return commandName.equals("endblock"); |
44 | |
} |
45 | |
|
46 | |
@Override |
47 | |
public PlainBlockCommandState parseCommand(MatchTemplateImpl template, |
48 | |
String commandName, String parameters) { |
49 | 5 | template.appendOperation(new XMLBlockEndOperation(template.getCurrentTemplatePosition())); |
50 | 5 | return null; |
51 | |
} |
52 | |
} |
53 | |
} |