Java Doc for Decompiler.java in  » Scripting » rhino » org » mozilla » javascript » 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 » rhino » org.mozilla.javascript 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.mozilla.javascript.Decompiler

Decompiler
public class Decompiler (Code)
The following class save decompilation information about the source. Source information is returned from the parser as a String associated with function nodes and with the toplevel script. When saved in the constant pool of a class, this string will be UTF-8 encoded, and token values will occupy a single byte. Source is saved (mostly) as token numbers. The tokens saved pretty much correspond to the token stream of a 'canonical' representation of the input program, as directed by the parser. (There were a few cases where tokens could have been left out where decompiler could easily reconstruct them, but I left them in for clarity). (I also looked adding source collection to TokenStream instead, where I could have limited the changes to a few lines in getToken... but this wouldn't have saved any space in the resulting source representation, and would have meant that I'd have to duplicate parser logic in the decompiler to disambiguate situations where newlines are important.) The function decompile expands the tokens back into their string representations, using simple lookahead to correct spacing and indentation. Assignments are saved as two-token pairs (Token.ASSIGN, op). Number tokens are stored inline, as a NUMBER token, a character representing the type, and either 1 or 4 characters representing the bit-encoding of the number. String types NAME, STRING and OBJECT are currently stored as a token type, followed by a character giving the length of the string (assumed to be less than 2^16), followed by the characters of the string inlined into the source string. Changing this to some reference to to the string in the compiled class' constant pool would probably save a lot of space... but would require some method of deriving the final constant pool entry from information available at parse time.


Field Summary
final public static  intCASE_GAP_PROP
     Decompilation property to specify identation offset for case labels.
final public static  intINDENT_GAP_PROP
     Decompilation property to specify default identation offset.
final public static  intINITIAL_INDENT_PROP
     Decompilation property to specify initial ident value.
final public static  intONLY_BODY_FLAG
     Flag to indicate that the decompilation should omit the function header and trailing brace.
final public static  intTO_SOURCE_FLAG
     Flag to indicate that the decompilation generates toSource result.


Method Summary
 voidaddEOL(int token)
    
 voidaddName(String str)
    
 voidaddNumber(double n)
    
 voidaddRegexp(String regexp, String flags)
    
 voidaddString(String str)
    
 voidaddToken(int token)
    
public static  Stringdecompile(String source, int flags, UintMap properties)
     Decompile the source information associated with this js function/script back into a string.
 intgetCurrentOffset()
    
 StringgetEncodedSource()
    
 intmarkFunctionEnd(int functionStart)
    
 intmarkFunctionStart(int functionType)
    

Field Detail
CASE_GAP_PROP
final public static int CASE_GAP_PROP(Code)
Decompilation property to specify identation offset for case labels.



INDENT_GAP_PROP
final public static int INDENT_GAP_PROP(Code)
Decompilation property to specify default identation offset.



INITIAL_INDENT_PROP
final public static int INITIAL_INDENT_PROP(Code)
Decompilation property to specify initial ident value.



ONLY_BODY_FLAG
final public static int ONLY_BODY_FLAG(Code)
Flag to indicate that the decompilation should omit the function header and trailing brace.



TO_SOURCE_FLAG
final public static int TO_SOURCE_FLAG(Code)
Flag to indicate that the decompilation generates toSource result.





Method Detail
addEOL
void addEOL(int token)(Code)



addName
void addName(String str)(Code)



addNumber
void addNumber(double n)(Code)



addRegexp
void addRegexp(String regexp, String flags)(Code)



addString
void addString(String str)(Code)



addToken
void addToken(int token)(Code)



decompile
public static String decompile(String source, int flags, UintMap properties)(Code)
Decompile the source information associated with this js function/script back into a string. For the most part, this just means translating tokens back to their string representations; there's a little bit of lookahead logic to decide the proper spacing/indentation. Most of the work in mapping the original source to the prettyprinted decompiled version is done by the parser.
Parameters:
  source - encoded source tree presentation
Parameters:
  flags - flags to select output format
Parameters:
  properties - indentation properties



getCurrentOffset
int getCurrentOffset()(Code)



getEncodedSource
String getEncodedSource()(Code)



markFunctionEnd
int markFunctionEnd(int functionStart)(Code)



markFunctionStart
int markFunctionStart(int functionType)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.