svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.api / src / main / java / org / gvsig / expressionevaluator / Statement.java @ 45131
History | View | Annotate | Download (3.08 KB)
1 | 44139 | jjdelcerro | package org.gvsig.expressionevaluator; |
---|---|---|---|
2 | |||
3 | /**
|
||
4 | *
|
||
5 | * @author jjdelcerro
|
||
6 | */
|
||
7 | public interface Statement { |
||
8 | |||
9 | public interface StatementContext { |
||
10 | |||
11 | public Compiler getCompiler(); |
||
12 | |||
13 | public LexicalAnalyzer getLexicalAnalyzer();
|
||
14 | |||
15 | public void setCode(String id, Code code); |
||
16 | |||
17 | public Code getCode(String id); |
||
18 | |||
19 | public void setCodeClassifier(String classifier); |
||
20 | |||
21 | public String getCodeClassifier(); |
||
22 | |||
23 | public CodeBuilder getCodeBuilder();
|
||
24 | |||
25 | public LexicalAnalyzer.Token look_token();
|
||
26 | |||
27 | public LexicalAnalyzer.Token next_token();
|
||
28 | |||
29 | public Code parse_expression();
|
||
30 | |||
31 | public Codes parse_expressions(String separator); |
||
32 | 44384 | jjdelcerro | |
33 | public boolean isReservedWord(String s); |
||
34 | 44750 | jjdelcerro | |
35 | public void save_state(); |
||
36 | |||
37 | public void restore_state(); |
||
38 | |||
39 | public void drop_state(); |
||
40 | |||
41 | 44384 | jjdelcerro | |
42 | 44738 | jjdelcerro | public void trace(String msg); |
43 | 44139 | jjdelcerro | } |
44 | |||
45 | public interface Rule { |
||
46 | |||
47 | public void parse(StatementContext context); |
||
48 | 44750 | jjdelcerro | |
49 | public Rule capture_as(String...ids); |
||
50 | 44139 | jjdelcerro | } |
51 | |||
52 | public interface CompoundRule extends Rule { |
||
53 | |||
54 | public CompoundRule addRule(Rule rule);
|
||
55 | } |
||
56 | 44750 | jjdelcerro | |
57 | 44139 | jjdelcerro | |
58 | public interface ConditionalRule extends Rule { |
||
59 | |||
60 | 44750 | jjdelcerro | @Override
|
61 | public ConditionalRule capture_as(String...ids); |
||
62 | |||
63 | 44139 | jjdelcerro | public ConditionalRule addRuleOnTrue(Rule rule);
|
64 | |||
65 | public ConditionalRule addRuleOnFalse(Rule rule);
|
||
66 | } |
||
67 | 44738 | jjdelcerro | |
68 | public interface SwichTokenRule extends Rule { |
||
69 | public SwichTokenRule addCase(String token, Rule... rules); |
||
70 | public SwichTokenRule addDefault(Rule... rules);
|
||
71 | } |
||
72 | 44139 | jjdelcerro | |
73 | public interface ArgsBuilder { |
||
74 | |||
75 | public Codes build(StatementContext context);
|
||
76 | } |
||
77 | |||
78 | 44384 | jjdelcerro | public interface StatementBuilder { |
79 | |||
80 | public String getCodeID(); |
||
81 | |||
82 | public ArgsBuilder getArgsBuilder();
|
||
83 | |||
84 | public Code build(StatementContext context);
|
||
85 | 44139 | jjdelcerro | |
86 | 44384 | jjdelcerro | } |
87 | |||
88 | 44139 | jjdelcerro | public String getName(); |
89 | |||
90 | public Statement addRule(Rule rule); |
||
91 | |||
92 | 44147 | jjdelcerro | public Rule require_any_token(String... token); |
93 | 44139 | jjdelcerro | |
94 | 44147 | jjdelcerro | public CompoundRule repeat_until_any_tokens(String... token); |
95 | 44139 | jjdelcerro | |
96 | 44738 | jjdelcerro | public CompoundRule repeat();
|
97 | |||
98 | 44750 | jjdelcerro | public Rule require_identifier();
|
99 | 44740 | jjdelcerro | |
100 | 44750 | jjdelcerro | public Rule require_identifiers(String sep); |
101 | 44139 | jjdelcerro | |
102 | 44750 | jjdelcerro | public Rule require_literal_string();
|
103 | 44533 | jjdelcerro | |
104 | 44379 | jjdelcerro | public Rule set_expression(String id, Object value); |
105 | |||
106 | 44750 | jjdelcerro | public Rule require_expression();
|
107 | 44139 | jjdelcerro | |
108 | 44750 | jjdelcerro | public Rule require_expressions(String separator); |
109 | 44139 | jjdelcerro | |
110 | 44738 | jjdelcerro | public Rule break_loop();
|
111 | |||
112 | 44750 | jjdelcerro | public Rule fail();
|
113 | |||
114 | 44738 | jjdelcerro | public SwichTokenRule switch_token();
|
115 | |||
116 | 44147 | jjdelcerro | public ConditionalRule optional_any_token(String... id); |
117 | 44139 | jjdelcerro | |
118 | 44750 | jjdelcerro | public ConditionalRule optional_identifiers(String separator); |
119 | 44533 | jjdelcerro | |
120 | 44750 | jjdelcerro | public ConditionalRule optional_literal_string();
|
121 | 44533 | jjdelcerro | |
122 | 44139 | jjdelcerro | public ArgsBuilder args_names(String... args); |
123 | |||
124 | 44750 | jjdelcerro | public ArgsBuilder fixed_args_names(String... args); |
125 | |||
126 | 44139 | jjdelcerro | public ArgsBuilder args_expand(String... args); |
127 | |||
128 | public void code(String id, ArgsBuilder argsBuilder); |
||
129 | |||
130 | 44384 | jjdelcerro | public void builder(StatementBuilder stmtBuilder); |
131 | |||
132 | 44139 | jjdelcerro | public Code parse(StatementContext context);
|
133 | |||
134 | public boolean isApplicable(StatementContext context); |
||
135 | |||
136 | |||
137 | } |