Source Code Cross Referenced for DebuggingCharScanner.java in  » IDE-Netbeans » cnd » antlr » debug » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » cnd » antlr.debug 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package antlr.debug;
002:
003:        import antlr.*;
004:        import antlr.collections.*;
005:        import antlr.collections.impl.*;
006:        import java.io.*;
007:
008:        public abstract class DebuggingCharScanner extends CharScanner
009:                implements  DebuggingParser {
010:            private ParserEventSupport parserEventSupport = new ParserEventSupport(
011:                    this );
012:            private boolean _notDebugMode = false;
013:            protected String ruleNames[];
014:            protected String semPredNames[];
015:
016:            public DebuggingCharScanner(InputBuffer cb) {
017:                super (cb);
018:            }
019:
020:            public DebuggingCharScanner(LexerSharedInputState state) {
021:                super (state);
022:            }
023:
024:            public void addMessageListener(MessageListener l) {
025:                parserEventSupport.addMessageListener(l);
026:            }
027:
028:            public void addNewLineListener(NewLineListener l) {
029:                parserEventSupport.addNewLineListener(l);
030:            }
031:
032:            public void addParserListener(ParserListener l) {
033:                parserEventSupport.addParserListener(l);
034:            }
035:
036:            public void addParserMatchListener(ParserMatchListener l) {
037:                parserEventSupport.addParserMatchListener(l);
038:            }
039:
040:            public void addParserTokenListener(ParserTokenListener l) {
041:                parserEventSupport.addParserTokenListener(l);
042:            }
043:
044:            public void addSemanticPredicateListener(SemanticPredicateListener l) {
045:                parserEventSupport.addSemanticPredicateListener(l);
046:            }
047:
048:            public void addSyntacticPredicateListener(
049:                    SyntacticPredicateListener l) {
050:                parserEventSupport.addSyntacticPredicateListener(l);
051:            }
052:
053:            public void addTraceListener(TraceListener l) {
054:                parserEventSupport.addTraceListener(l);
055:            }
056:
057:            public void consume() {
058:                int la_1 = -99;
059:                //try
060:                la_1 = LA(1);
061:                //catch (CharStreamException ignoreAnIOException) {}
062:                super .consume();
063:                parserEventSupport.fireConsume(la_1);
064:            }
065:
066:            protected void fireEnterRule(int num, int data) {
067:                if (isDebugMode())
068:                    parserEventSupport.fireEnterRule(num, inputState.guessing,
069:                            data);
070:            }
071:
072:            protected void fireExitRule(int num, int ttype) {
073:                if (isDebugMode())
074:                    parserEventSupport.fireExitRule(num, inputState.guessing,
075:                            ttype);
076:            }
077:
078:            protected boolean fireSemanticPredicateEvaluated(int type, int num,
079:                    boolean condition) {
080:                if (isDebugMode())
081:                    return parserEventSupport.fireSemanticPredicateEvaluated(
082:                            type, num, condition, inputState.guessing);
083:                else
084:                    return condition;
085:            }
086:
087:            protected void fireSyntacticPredicateFailed() {
088:                if (isDebugMode())
089:                    parserEventSupport
090:                            .fireSyntacticPredicateFailed(inputState.guessing);
091:            }
092:
093:            protected void fireSyntacticPredicateStarted() {
094:                if (isDebugMode())
095:                    parserEventSupport
096:                            .fireSyntacticPredicateStarted(inputState.guessing);
097:            }
098:
099:            protected void fireSyntacticPredicateSucceeded() {
100:                if (isDebugMode())
101:                    parserEventSupport
102:                            .fireSyntacticPredicateSucceeded(inputState.guessing);
103:            }
104:
105:            public String getRuleName(int num) {
106:                return ruleNames[num];
107:            }
108:
109:            public String getSemPredName(int num) {
110:                return semPredNames[num];
111:            }
112:
113:            public synchronized void goToSleep() {
114:                try {
115:                    wait();
116:                } catch (InterruptedException e) {
117:                }
118:            }
119:
120:            public boolean isDebugMode() {
121:                return !_notDebugMode;
122:            }
123:
124:            public char LA(int i) {
125:                char la = super .LA(i);
126:                parserEventSupport.fireLA(i, la);
127:                return la;
128:            }
129:
130:            protected Token makeToken(int t) {
131:                // do something with char buffer???
132:                //		try {
133:                //			Token tok = (Token)tokenObjectClass.newInstance();
134:                //			tok.setType(t);
135:                //			// tok.setText(getText()); done in generated lexer now
136:                //			tok.setLine(line);
137:                //			return tok;
138:                //		}
139:                //		catch (InstantiationException ie) {
140:                //			panic("can't instantiate a Token");
141:                //		}
142:                //		catch (IllegalAccessException iae) {
143:                //			panic("Token class is not accessible");
144:                //		}
145:                return super .makeToken(t);
146:            }
147:
148:            public void match(char c) throws MismatchedCharException {
149:                char la_1 = LA(1);
150:                try {
151:                    super .match(c);
152:                    parserEventSupport.fireMatch(c, inputState.guessing);
153:                } catch (MismatchedCharException e) {
154:                    if (inputState.guessing == 0)
155:                        parserEventSupport.fireMismatch(la_1, c,
156:                                inputState.guessing);
157:                    throw e;
158:                }
159:            }
160:
161:            public void match(BitSet b) throws MismatchedCharException {
162:                String text = this .text.toString();
163:                char la_1 = LA(1);
164:                try {
165:                    super .match(b);
166:                    parserEventSupport.fireMatch(la_1, b, text,
167:                            inputState.guessing);
168:                } catch (MismatchedCharException e) {
169:                    if (inputState.guessing == 0)
170:                        parserEventSupport.fireMismatch(la_1, b, text,
171:                                inputState.guessing);
172:                    throw e;
173:                }
174:            }
175:
176:            public void match(String s) throws MismatchedCharException {
177:                StringBuffer la_s = new StringBuffer("");
178:                int len = s.length();
179:                // peek at the next len worth of characters
180:                try {
181:                    for (int i = 1; i <= len; i++) {
182:                        la_s.append(super .LA(i));
183:                    }
184:                } catch (Exception ignoreMe) {
185:                }
186:
187:                try {
188:                    super .match(s);
189:                    parserEventSupport.fireMatch(s, inputState.guessing);
190:                } catch (MismatchedCharException e) {
191:                    if (inputState.guessing == 0)
192:                        parserEventSupport.fireMismatch(la_s.toString(), s,
193:                                inputState.guessing);
194:                    throw e;
195:                }
196:
197:            }
198:
199:            public void matchNot(char c) throws MismatchedCharException {
200:                char la_1 = LA(1);
201:                try {
202:                    super .matchNot(c);
203:                    parserEventSupport.fireMatchNot(la_1, c,
204:                            inputState.guessing);
205:                } catch (MismatchedCharException e) {
206:                    if (inputState.guessing == 0)
207:                        parserEventSupport.fireMismatchNot(la_1, c,
208:                                inputState.guessing);
209:                    throw e;
210:                }
211:
212:            }
213:
214:            public void matchRange(char c1, char c2)
215:                    throws MismatchedCharException {
216:                char la_1 = LA(1);
217:                try {
218:                    super .matchRange(c1, c2);
219:                    parserEventSupport.fireMatch(la_1, "" + c1 + c2,
220:                            inputState.guessing);
221:                } catch (MismatchedCharException e) {
222:                    if (inputState.guessing == 0)
223:                        parserEventSupport.fireMismatch(la_1, "" + c1 + c2,
224:                                inputState.guessing);
225:                    throw e;
226:                }
227:
228:            }
229:
230:            public void newline() {
231:                super .newline();
232:                parserEventSupport.fireNewLine(getLine());
233:            }
234:
235:            public void removeMessageListener(MessageListener l) {
236:                parserEventSupport.removeMessageListener(l);
237:            }
238:
239:            public void removeNewLineListener(NewLineListener l) {
240:                parserEventSupport.removeNewLineListener(l);
241:            }
242:
243:            public void removeParserListener(ParserListener l) {
244:                parserEventSupport.removeParserListener(l);
245:            }
246:
247:            public void removeParserMatchListener(ParserMatchListener l) {
248:                parserEventSupport.removeParserMatchListener(l);
249:            }
250:
251:            public void removeParserTokenListener(ParserTokenListener l) {
252:                parserEventSupport.removeParserTokenListener(l);
253:            }
254:
255:            public void removeSemanticPredicateListener(
256:                    SemanticPredicateListener l) {
257:                parserEventSupport.removeSemanticPredicateListener(l);
258:            }
259:
260:            public void removeSyntacticPredicateListener(
261:                    SyntacticPredicateListener l) {
262:                parserEventSupport.removeSyntacticPredicateListener(l);
263:            }
264:
265:            public void removeTraceListener(TraceListener l) {
266:                parserEventSupport.removeTraceListener(l);
267:            }
268:
269:            /** Report exception errors caught in nextToken() */
270:            public void reportError(MismatchedCharException e) {
271:                parserEventSupport.fireReportError(e);
272:                super .reportError(e);
273:            }
274:
275:            /** Parser error-reporting function can be overridden in subclass */
276:            public void reportError(String s) {
277:                parserEventSupport.fireReportError(s);
278:                super .reportError(s);
279:            }
280:
281:            /** Parser warning-reporting function can be overridden in subclass */
282:            public void reportWarning(String s) {
283:                parserEventSupport.fireReportWarning(s);
284:                super .reportWarning(s);
285:            }
286:
287:            public void setDebugMode(boolean value) {
288:                _notDebugMode = !value;
289:            }
290:
291:            public void setupDebugging() {
292:            }
293:
294:            public synchronized void wakeUp() {
295:                notify();
296:            }
297:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.