01: package fri.patterns.interpreter.parsergenerator.lexer;
02:
03: import java.util.Set;
04: import fri.patterns.interpreter.parsergenerator.syntax.Rule;
05:
06: /**
07: * LexerSemantic receives a Rule and its a ResultTree with range.
08: * It can look inside the syntax tree of a scanned token.
09: * Calling resultTree.toString() will return the scanned text for that rule.
10: * The responsibility of a LexerSemantic is to provide a Set of nonterminal
11: * Strings contained in the used lexer syntax which it wants to process.
12: * If it provides no such Set, all rules are passed to the Semantic (which
13: * will be very time-consuming).
14: *
15: * Created on 21.09.2005
16: * @author Fritz Ritzberger
17: */
18: public interface LexerSemantic {
19: /**
20: * This is called by LexerImpl with a lexing Rule and its scanned result tree and range.
21: * Calling <i>resultTree.toString()</i> will return the scanned text for the rule.
22: * Calling <i>resultTree.getRange()</i> will return the range of the rule within input.
23: * No value stack is available for that semantic, so the method does not return anything.
24: */
25: public void ruleEvaluated(Rule rule, ResultTree resultTree);
26:
27: /**
28: * Can return the String Set of nonterminals (must occur in syntax on left side)
29: * this LexerSemantic wants to dispatch. Returning null will enable all nonterminals or rules.
30: */
31: public Set getWantedNonterminals();
32:
33: /**
34: * Can return the String Set of nonterminals (must occur in syntax on left side)
35: * this LexerSemantic does not want to dispatch. This is an alternative to
36: * <i>getWantedNonterminals()</i>. Returning null will not ignore any nonterminal or rule.
37: */
38: public Set getIgnoredNonterminals();
39:
40: }
|