Source Code Cross Referenced for NamespaceStatement.java in  » Web-Framework » anvil » anvil » script » statements » 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 » Web Framework » anvil » anvil.script.statements 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: NamespaceStatement.java,v 1.5 2002/09/16 08:05:06 jkl Exp $
003:         *
004:         * Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
005:         *
006:         * Use is subject to license terms, as defined in
007:         * Anvil Sofware License, Version 1.1. See LICENSE 
008:         * file, or http://njet.org/license-1.1.txt
009:         */
010:        package anvil.script.statements;
011:
012:        import anvil.Location;
013:        import anvil.codec.ConstantPool;
014:        import anvil.codec.Code;
015:        import anvil.codec.ClassRoom;
016:        import anvil.codec.Field;
017:        import anvil.codec.Method;
018:        import anvil.doc.Doc;
019:        import anvil.doc.DocParser;
020:        import anvil.ErrorListener;
021:        import anvil.parser.Tag;
022:        import anvil.script.Type;
023:        import anvil.script.Scope;
024:        import anvil.script.Module;
025:        import anvil.script.compiler.ByteCompiler;
026:        import anvil.script.CompilableFunction;
027:        import anvil.script.expression.Expression;
028:        import anvil.script.parser.TemplateParser;
029:        import anvil.java.util.Hashlist;
030:        import java.io.IOException;
031:        import java.util.Enumeration;
032:
033:        /**
034:         * class NamespaceStatement
035:         *
036:         * @author: Jani Lehtimäki
037:         */
038:        public class NamespaceStatement extends DefinitionStatement implements 
039:                Scope {
040:
041:            protected int _poplevel = 0;
042:
043:            public NamespaceStatement(Location location,
044:                    DefinitionStatement parent) {
045:                super (parent, location);
046:            }
047:
048:            public NamespaceStatement(Location location,
049:                    DefinitionStatement parent, String name, String document) {
050:                super (parent, location, name, DocParser.parseNamespace(name,
051:                        document));
052:                setName(name);
053:            }
054:
055:            public int typeOf() {
056:                return Statement.ST_NAMESPACE;
057:            }
058:
059:            public String name() {
060:                return "namespace";
061:            }
062:
063:            public void setName(String name) {
064:                _name = name;
065:                _descriptor = _parent.getDescriptor() + "$n_" + _name;
066:            }
067:
068:            public void setPopLevel(int level) {
069:                _poplevel = level;
070:            }
071:
072:            public int getType() {
073:                return NAMESPACE;
074:            }
075:
076:            public VariableStatement declare(Location location, String name,
077:                    Expression expr, String document, boolean statik) {
078:                VariableStatement var = new StaticVariableStatement(location,
079:                        this , name, expr, document);
080:                declare(var);
081:                return var;
082:            }
083:
084:            public Type lookupDeclaration(String name) {
085:                Type type = (Type) _types.get(name);
086:                if (type != null) {
087:                    return type;
088:                }
089:                return super .lookupDeclaration(name);
090:            }
091:
092:            public void parse(TemplateParser parser, Tag tag) {
093:                super .parse(parser, tag);
094:            }
095:
096:            public void onCharacters(TemplateParser parser, String cdata) {
097:            }
098:
099:            public boolean onTag(TemplateParser parser, int type, Tag tag) {
100:                switch (type) {
101:                case ST_TAG:
102:                    break;
103:
104:                case ST_IMPORT:
105:                    onImport(parser, tag);
106:                    break;
107:
108:                case ST_VAR:
109:                    onVar(parser, tag);
110:                    break;
111:
112:                case ST_CONST:
113:                    onConst(parser, tag);
114:                    break;
115:
116:                case ST_FUNCTION:
117:                    onFunction(parser, type, tag);
118:                    break;
119:
120:                case ST_CLASS:
121:                    onClass(parser, type, tag);
122:                    break;
123:
124:                case ST_NAMESPACE:
125:                    onNamespace(parser, type, tag);
126:                    break;
127:
128:                case ST_ENDNAMESPACE:
129:                    while (_poplevel-- > 0) {
130:                        parser.pop();
131:                    }
132:                    break;
133:
134:                default:
135:                    return false;
136:
137:                }
138:                return true;
139:            }
140:
141:            public void check(ErrorListener context) {
142:                super .check(context);
143:            }
144:
145:            public void compile(ByteCompiler context) {
146:                ClassRoom clazz = context.getClassRoom().createClass(
147:                        getDescriptor(), "n_" + _name);
148:                clazz.setAccessFlags(context.ACC_PUBLIC);
149:                ConstantPool pool = clazz.getPool();
150:                context.pushClass(clazz);
151:                Field typefield1 = clazz.createField("_class",
152:                        "Lanvil/script/compiler/CompiledNamespace;",
153:                        Code.ACC_PUBLIC | Code.ACC_STATIC);
154:                Field typefield2 = clazz.createField("_type",
155:                        "Lanvil/core/Any;", Code.ACC_PUBLIC | Code.ACC_STATIC);
156:                clazz.setSuperClassname(context.TYPE_OBJECT);
157:                clazz.setAccessFlags(Code.ACC_SUPER | Code.ACC_PUBLIC);
158:
159:                compileMembers(context, _types.size(), _types.elements());
160:
161:                Code code = clazz.getStatic().getCode();
162:                context.pushCode(code);
163:                //code.println("INTERFACE-START:"+getDescriptor());
164:                code.getstatic(pool.addFieldRef(_parent.getDescriptor(),
165:                        "_members", "[Ljava/lang/Object;"));
166:                code.pop();
167:                //code.println("INTERFACE-END:"+getDescriptor());
168:                code.vreturn();
169:                context.popCode();
170:
171:                super.compile(context);
172:
173:                context.popClass();
174:            }
175:
176:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.