Source Code Cross Referenced for DebuggingCharScanner.java in  » Database-ORM » toplink » persistence » 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 » Database ORM » toplink » persistence.antlr.debug 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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