KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fri > patterns > interpreter > parsergenerator > lexer > LexerSemantic


1 package fri.patterns.interpreter.parsergenerator.lexer;
2
3 import java.util.Set JavaDoc;
4 import fri.patterns.interpreter.parsergenerator.syntax.Rule;
5
6 /**
7  * LexerSemantic receives a Rule and its a ResultTree with range.
8  * It can look inside the syntax tree of a scanned token.
9  * 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     /**
21      * This is called by LexerImpl with a lexing Rule and its scanned result tree and range.
22      * Calling <i>resultTree.toString()</i> will return the scanned text for the rule.
23      * Calling <i>resultTree.getRange()</i> will return the range of the rule within input.
24      * No value stack is available for that semantic, so the method does not return anything.
25      */

26     public void ruleEvaluated(Rule rule, ResultTree resultTree);
27     
28     /**
29      * Can return the String Set of nonterminals (must occur in syntax on left side)
30      * this LexerSemantic wants to dispatch. Returning null will enable all nonterminals or rules.
31      */

32     public Set JavaDoc getWantedNonterminals();
33
34     /**
35      * Can return the String Set of nonterminals (must occur in syntax on left side)
36      * this LexerSemantic does not want to dispatch. This is an alternative to
37      * <i>getWantedNonterminals()</i>. Returning null will not ignore any nonterminal or rule.
38      */

39     public Set JavaDoc getIgnoredNonterminals();
40
41 }
42
Popular Tags