Source Code Cross Referenced for SimpleNode.java in  » Scripting » jython » org » python » parser » 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 » Scripting » jython » org.python.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright (c) Corporation for National Research Initiatives
002:        package org.python.parser;
003:
004:        import org.python.parser.ast.*;
005:        import java.io.DataOutputStream;
006:        import java.io.IOException;
007:
008:        public class SimpleNode implements  Node {
009:            public int beginLine, beginColumn;
010:
011:            public boolean from_future_checked = false; // from __future__ support
012:
013:            public SimpleNode() {
014:            }
015:
016:            public static Node jjtCreate(PythonGrammar p, int id) {
017:                return p.jjtree.openNode(id);
018:            }
019:
020:            public int getId() {
021:                return -1;
022:            }
023:
024:            public Object getImage() {
025:                return null;
026:            }
027:
028:            public void setImage(Object image) {
029:            }
030:
031:            /* You can override these two methods in subclasses of SimpleNode to
032:               customize the way the node appears when the tree is dumped.  If
033:               your output uses more than one line you should override
034:               toString(String), otherwise overriding toString() is probably all
035:               you need to do. */
036:
037:            public String toString() {
038:                return super .toString() + " at line " + beginLine;
039:            }
040:
041:            public String toString(String prefix) {
042:                return prefix + toString();
043:            }
044:
045:            public Object accept(VisitorIF visitor) throws Exception {
046:                throw new ParseException("Unexpected node: " + this );
047:            }
048:
049:            public void traverse(VisitorIF visitor) throws Exception {
050:                throw new ParseException("Unexpected node: " + this );
051:            }
052:
053:            /* Override this method if you want to customize how the node dumps
054:               ut its children. */
055:
056:            protected String dumpThis(String s) {
057:                return s;
058:            }
059:
060:            protected String dumpThis(Object o) {
061:                return String.valueOf(o);
062:            }
063:
064:            protected String dumpThis(Object[] s) {
065:                StringBuffer sb = new StringBuffer();
066:                if (s == null) {
067:                    sb.append("null");
068:                } else {
069:                    sb.append("[");
070:                    for (int i = 0; i < s.length; i++) {
071:                        if (i > 0)
072:                            sb.append(", ");
073:                        sb.append(String.valueOf(s[i]));
074:                    }
075:                    sb.append("]");
076:                }
077:
078:                return sb.toString();
079:            }
080:
081:            protected String dumpThis(int i) {
082:                return Integer.toString(i);
083:            }
084:
085:            protected String dumpThis(int i, String[] names) {
086:                // XXX Verify bounds.
087:                return names[i];
088:            }
089:
090:            protected String dumpThis(int[] arr, String[] names) {
091:                StringBuffer sb = new StringBuffer();
092:                if (arr == null) {
093:                    sb.append("null");
094:                } else {
095:                    sb.append("[");
096:                    for (int i = 0; i < arr.length; i++) {
097:                        if (i > 0)
098:                            sb.append(", ");
099:                        // XXX Verify bounds.
100:                        sb.append(names[arr[i]]);
101:                    }
102:                    sb.append("]");
103:                }
104:                return sb.toString();
105:            }
106:
107:            protected String dumpThis(boolean b) {
108:                return String.valueOf(b);
109:            }
110:
111:            public void pickle(DataOutputStream ostream) throws IOException {
112:                throw new IOException("Pickling not implemented");
113:            }
114:
115:            protected void pickleThis(String s, DataOutputStream ostream)
116:                    throws IOException {
117:                if (s == null) {
118:                    ostream.writeInt(-1);
119:                } else {
120:                    ostream.writeInt(s.length());
121:                    ostream.writeBytes(s);
122:                }
123:            }
124:
125:            protected void pickleThis(String[] s, DataOutputStream ostream)
126:                    throws IOException {
127:                if (s == null) {
128:                    ostream.writeInt(-1);
129:                } else {
130:                    ostream.writeInt(s.length);
131:                    for (int i = 0; i < s.length; i++) {
132:                        pickleThis(s[i], ostream);
133:                    }
134:                }
135:            }
136:
137:            protected void pickleThis(SimpleNode o, DataOutputStream ostream)
138:                    throws IOException {
139:                if (o == null) {
140:                    ostream.writeInt(-1);
141:                } else {
142:                    o.pickle(ostream);
143:                }
144:            }
145:
146:            protected void pickleThis(SimpleNode[] s, DataOutputStream ostream)
147:                    throws IOException {
148:                if (s == null) {
149:                    ostream.writeInt(-1);
150:                } else {
151:                    ostream.writeInt(s.length);
152:                    for (int i = 0; i < s.length; i++) {
153:                        pickleThis(s[i], ostream);
154:                    }
155:                }
156:            }
157:
158:            protected void pickleThis(int i, DataOutputStream ostream)
159:                    throws IOException {
160:                ostream.writeInt(i);
161:            }
162:
163:            protected void pickleThis(int[] arr, DataOutputStream ostream)
164:                    throws IOException {
165:                if (arr == null) {
166:                    ostream.writeInt(-1);
167:                } else {
168:                    ostream.writeInt(arr.length);
169:                    for (int i = 0; i < arr.length; i++) {
170:                        ostream.writeInt(arr[i]);
171:                    }
172:                }
173:            }
174:
175:            protected void pickleThis(boolean b, DataOutputStream ostream)
176:                    throws IOException {
177:                ostream.writeBoolean(b);
178:            }
179:
180:            protected void pickleThis(Object n, DataOutputStream ostream)
181:                    throws IOException {
182:                String s = n.toString();
183:                ostream.writeInt(s.length());
184:                ostream.writeBytes(s);
185:            }
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.