Java Doc for CompilerVisitor.java in  » Scripting » oscript-2.10.4 » oscript » compiler » 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 » oscript 2.10.4 » oscript.compiler 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   oscript.compiler.CompilerVisitor

CompilerVisitor
public class CompilerVisitor implements oscript.visitor.Visitor,oscript.parser.OscriptParserConstants(Code)
The CompilerVisitor is the compiler, which compiles functions to an instance of CompiledNodeEvaluator.

Some assumptions are made with respect to tracking the info needed to generate useful stack traces, for example that the entire function is defined within the same file.
author:
   Rob Clark (rob@ti.com)
author:
  
version:
   1.84



Field Summary
 CompilerContextctx
    
 CompilerInstructionListil
     The instruction list which becomes the code of the evalNode method which is generated.
 MethodGenmg
     The current method being generated.
 CompilerScopescope
    

Constructor Summary
 CompilerVisitor(CompilerContext ctx, String name, Node node)
    

Method Summary
 voiddefer(Runnable r)
     Add a deferred runnable, which is run after the first pass over the syntax-tree.
 StringgetDebugName()
    
 StringgetDesc()
     get the "desc" of the syntax-tree being parsed...
 voidgetInstanceConstant(Object obj)
     push the instance constant onto the stack, setting ret-val to true.
 voidhandle(NodeToken n)
     Handles storing line # info for a node-token.
public  StringtoString()
    
public  voidvisit(NodeList n)
    
public  voidvisit(NodeListOptional n)
    
public  voidvisit(NodeOptional n)
    
public  voidvisit(NodeSequence n)
    
public  voidvisit(NodeToken n)
    
public  voidvisit(ProgramFile n)
    
public  voidvisit(Program n)
    
public  voidvisit(EvaluationUnit n)
    
public  voidvisit(ScopeBlock n)
    
public  voidvisit(VariableDeclarationBlock n)
    
public  voidvisit(ExpressionBlock n)
    
public  voidvisit(ThrowBlock n)
    
public  voidvisit(ImportBlock n)
    
public  voidvisit(MixinBlock n)
    
public  voidvisit(EvalBlock n)
    
public  voidvisit(VariableDeclaration n)
    
public  voidvisit(FunctionDeclaration n)
    
public  voidvisit(Arglist n)
    
public  voidvisit(TryStatement n)
    
public  voidvisit(ForLoopStatement n)
    
public  voidvisit(CollectionForLoopStatement n)
    
public  voidvisit(PreLoopStatement n)
    
public  voidvisit(WhileLoopStatement n)
    
public  voidvisit(ConditionalStatement n)
    
public  voidvisit(SynchronizedStatement n)
    
public  voidvisit(ReturnStatement n)
    
public  voidvisit(BreakStatement n)
    
public  voidvisit(ContinueStatement n)
    
public  voidvisit(Expression n)
     Note, Expression always returns a value on the stack, even if that value is Value.NULL.
public  voidvisit(FunctionCallExpressionList n)
    
public  voidvisit(FunctionCallExpressionListBody n)
    
public  voidvisit(AssignmentExpression n)
    
public  voidvisit(ConditionalExpression n)
    
public  voidvisit(LogicalOrExpression n)
    
public  voidvisit(LogicalAndExpression n)
    
public  voidvisit(BitwiseOrExpression n)
    
public  voidvisit(BitwiseXorExpression n)
    
public  voidvisit(BitwiseAndExpression n)
    
public  voidvisit(EqualityExpression n)
    
public  voidvisit(RelationalExpression n)
    
public  voidvisit(ShiftExpression n)
    
public  voidvisit(AdditiveExpression n)
    
public  voidvisit(MultiplicativeExpression n)
    
public  voidvisit(UnaryExpression n)
    
public  voidvisit(PostfixExpression n)
    
public  voidvisit(TypeExpression n)
    
public  voidvisit(AllocationExpression n)
    
public  voidvisit(CastExpression n)
    
public  voidvisit(PrimaryExpression n)
    
public  voidvisit(PrimaryExpressionNotFunction n)
    
public  voidvisit(PrimaryExpressionWithTrailingFxnCallExpList n)
    
public  voidvisit(PrimaryPrefix n)
    
public  voidvisit(PrimaryPrefixNotFunction n)
    
public  voidvisit(ThisPrimaryPrefix n)
    
public  voidvisit(SuperPrimaryPrefix n)
    
public  voidvisit(CalleePrimaryPrefix n)
    
public  voidvisit(IdentifierPrimaryPrefix n)
    
public  voidvisit(ParenPrimaryPrefix n)
    
public  voidvisit(FunctionPrimaryPrefix n)
    
public  voidvisit(ShorthandFunctionPrimaryPrefix n)
    
public  voidvisit(ArrayDeclarationPrimaryPrefix n)
    
public  voidvisit(PrimaryPostfix n)
    
public  voidvisit(PrimaryPostfixWithTrailingFxnCallExpList n)
    
public  voidvisit(FunctionCallPrimaryPostfix n)
    
public  voidvisit(ArraySubscriptPrimaryPostfix n)
    
public  voidvisit(PropertyIdentifierPrimaryPostfix n)
    
public  voidvisit(ThisScopeQualifierPrimaryPostfix n)
    
public  voidvisit(Literal n)
    
public  voidvisit(Permissions n)
    

Field Detail
ctx
CompilerContext ctx(Code)



il
CompilerInstructionList il(Code)
The instruction list which becomes the code of the evalNode method which is generated.



mg
MethodGen mg(Code)
The current method being generated.



scope
CompilerScope scope(Code)




Constructor Detail
CompilerVisitor
CompilerVisitor(CompilerContext ctx, String name, Node node)(Code)
Create a new compiler-visitor, which generates compiled code




Method Detail
defer
void defer(Runnable r)(Code)
Add a deferred runnable, which is run after the first pass over the syntax-tree. This gives various parts of the compiler a way to defer a decision until after the first pass.
Parameters:
  r - the runnable that is invoked in an unspecified order afterthe first pass



getDebugName
String getDebugName()(Code)



getDesc
String getDesc()(Code)
get the "desc" of the syntax-tree being parsed... ie. the filename



getInstanceConstant
void getInstanceConstant(Object obj)(Code)
push the instance constant onto the stack, setting ret-val to true.



handle
void handle(NodeToken n)(Code)
Handles storing line # info for a node-token. This should really be called for every node-token to ensure that no line # info is lost.



toString
public String toString()(Code)



visit
public void visit(NodeList n)(Code)



visit
public void visit(NodeListOptional n)(Code)



visit
public void visit(NodeOptional n)(Code)



visit
public void visit(NodeSequence n)(Code)



visit
public void visit(NodeToken n)(Code)



visit
public void visit(ProgramFile n)(Code)
 f0 -> ( <UNIX_SELF_EXECUTABLE_COMMENT> )?
 f1 -> Program(false)
 f2 -> <EOF>
 



visit
public void visit(Program n)(Code)
 f0 -> ( EvaluationUnit() )*
 



visit
public void visit(EvaluationUnit n)(Code)
 f0 -> ScopeBlock()
 | VariableDeclarationBlock()
 | FunctionDeclaration()
 | TryStatement()
 | ForLoopStatement()
 | WhileLoopStatement()
 | ConditionalStatement()
 | SynchronizedStatement()
 | ReturnStatement()
 | BreakStatement()
 | ContinueStatement()
 | ExpressionBlock()
 | ThrowBlock()
 | ImportBlock()
 | MixinBlock()
 | EvalBlock()
 



visit
public void visit(ScopeBlock n)(Code)
 f0 -> "{"
 f1 -> Program()
 f2 -> "}"
 



visit
public void visit(VariableDeclarationBlock n)(Code)
 f0 -> VariableDeclaration()
 f1 -> ";"
 



visit
public void visit(ExpressionBlock n)(Code)
 f0 -> Expression()
 f1 -> ";"
 



visit
public void visit(ThrowBlock n)(Code)
 f0 -> "throw"
 f1 -> Expression()
 f2 -> ";"
 



visit
public void visit(ImportBlock n)(Code)
 f0 -> "import"
 f1 -> Expression()
 f2 -> ";"
 



visit
public void visit(MixinBlock n)(Code)
 f0 -> "mixin"
 f1 -> Expression()
 f2 -> ";"
 



visit
public void visit(EvalBlock n)(Code)
 f0 -> "eval"
 f1 -> Expression()
 f2 -> ";"
 



visit
public void visit(VariableDeclaration n)(Code)
 f0 -> Permissions()
 f1 -> "var"
 f2 -> <IDENTIFIER>
 f3 -> ( "=" Expression() )?
 



visit
public void visit(FunctionDeclaration n)(Code)
 f0 -> Permissions()
 f1 -> "function"
 f2 -> <IDENTIFIER>
 f3 -> "("
 f4 -> ( Arglist() )?
 f5 -> ")"
 f6 -> ( "extends" PrimaryExpressionWithTrailingFxnCallExpList() FunctionCallExpressionList() )?
 f7 -> "{"
 f8 -> Program()
 f9 -> "}"
 



visit
public void visit(Arglist n)(Code)
 f0 -> Permissions()
 f1 -> <IDENTIFIER>
 f2 -> ( "," Permissions() <IDENTIFIER> )*
 f3 -> ( "..." )?
 



visit
public void visit(TryStatement n)(Code)
 f0 -> "try"
 f1 -> EvaluationUnit()
 f2 -> ( "catch" "(" Expression() <IDENTIFIER> ")" EvaluationUnit() )*
 f3 -> ( "catch" "(" <IDENTIFIER> ")" EvaluationUnit() )?
 f4 -> ( "finally" EvaluationUnit() )?
 



visit
public void visit(ForLoopStatement n)(Code)
 f0 -> "for"
 f1 -> "("
 f2 -> ( PreLoopStatement() )?
 f3 -> ";"
 f4 -> ( Expression() )?
 f5 -> ";"
 f6 -> ( Expression() )?
 f7 -> ")"
 f8 -> EvaluationUnit()
 



visit
public void visit(CollectionForLoopStatement n)(Code)
 f0 -> "for"
 f1 -> "("
 f2 -> PreLoopStatement()
 f3 -> ":"
 f4 -> Expression()
 f5 -> ")"
 f6 -> EvaluationUnit()
 



visit
public void visit(PreLoopStatement n)(Code)
 f0 -> VariableDeclaration()
 | Expression()
 



visit
public void visit(WhileLoopStatement n)(Code)
 f0 -> "while"
 f1 -> "("
 f2 -> Expression()
 f3 -> ")"
 f4 -> EvaluationUnit()
 



visit
public void visit(ConditionalStatement n)(Code)
 f0 -> "if"
 f1 -> "("
 f2 -> Expression()
 f3 -> ")"
 f4 -> EvaluationUnit()
 f5 -> ( "else" EvaluationUnit() )?
 



visit
public void visit(SynchronizedStatement n)(Code)
 f0 -> "synchronized"
 f1 -> "("
 f2 -> Expression()
 f3 -> ")"
 f4 -> EvaluationUnit()
 



visit
public void visit(ReturnStatement n)(Code)
 f0 -> "return"
 f1 -> ( Expression() )?
 



visit
public void visit(BreakStatement n)(Code)
 f0 -> "break"
 f1 -> ";"
 



visit
public void visit(ContinueStatement n)(Code)
 f0 -> "continue"
 f1 -> ";"
 



visit
public void visit(Expression n)(Code)
Note, Expression always returns a value on the stack, even if that value is Value.NULL.
 f0 -> AssignmentExpression()
 f1 -> ( "," AssignmentExpression() )*
 



visit
public void visit(FunctionCallExpressionList n)(Code)
 f0 -> "("
 f1 -> ( FunctionCallExpressionListBody() )?
 f2 -> ")"
 



visit
public void visit(FunctionCallExpressionListBody n)(Code)
 f0 -> AssignmentExpression()
 f1 -> ( "," AssignmentExpression() )*
 



visit
public void visit(AssignmentExpression n)(Code)
 f0 -> ConditionalExpression()
 f1 -> ( ( "=" | "+=" | "-=" | "*=" | "/=" | "%=" | ">>=" | "<<=" | ">>>=" | "&=" | "^=" | "|=" ) ConditionalExpression() )*
 



visit
public void visit(ConditionalExpression n)(Code)
 f0 -> LogicalOrExpression()
 f1 -> ( "?" LogicalOrExpression() ":" LogicalOrExpression() )?
 



visit
public void visit(LogicalOrExpression n)(Code)
 f0 -> LogicalAndExpression()
 f1 -> ( "||" LogicalAndExpression() )*
 



visit
public void visit(LogicalAndExpression n)(Code)
 f0 -> BitwiseOrExpression()
 f1 -> ( "&&" BitwiseOrExpression() )*
 



visit
public void visit(BitwiseOrExpression n)(Code)
 f0 -> BitwiseXorExpression()
 f1 -> ( "|" BitwiseXorExpression() )*
 



visit
public void visit(BitwiseXorExpression n)(Code)
 f0 -> BitwiseAndExpression()
 f1 -> ( "^" BitwiseAndExpression() )*
 



visit
public void visit(BitwiseAndExpression n)(Code)
 f0 -> EqualityExpression()
 f1 -> ( "&" EqualityExpression() )*
 



visit
public void visit(EqualityExpression n)(Code)
 f0 -> RelationalExpression()
 f1 -> ( ( "==" | "!=" ) RelationalExpression() )*
 



visit
public void visit(RelationalExpression n)(Code)
 f0 -> ShiftExpression()
 f1 -> ( ( "<" | ">" | ">=" | "<=" | "instanceof" ) ShiftExpression() )*
 



visit
public void visit(ShiftExpression n)(Code)
 f0 -> AdditiveExpression()
 f1 -> ( ( "<<" | ">>" | ">>>" ) AdditiveExpression() )*
 



visit
public void visit(AdditiveExpression n)(Code)
 f0 -> MultiplicativeExpression()
 f1 -> ( ( "+" | "-" ) MultiplicativeExpression() )*
 



visit
public void visit(MultiplicativeExpression n)(Code)
 f0 -> UnaryExpression()
 f1 -> ( ( "*" | "/" | "%" ) UnaryExpression() )*
 



visit
public void visit(UnaryExpression n)(Code)
 f0 -> ( ( "++" | "--" | "+" | "-" | "~" | "!" ) )?
 f1 -> PostfixExpression()
 



visit
public void visit(PostfixExpression n)(Code)
 f0 -> TypeExpression()
 f1 -> ( "++" | "--" )?
 



visit
public void visit(TypeExpression n)(Code)
 f0 -> AllocationExpression()
 | CastExpression()
 | PrimaryExpression()
 



visit
public void visit(AllocationExpression n)(Code)
 f0 -> "new"
 f1 -> PrimaryExpressionWithTrailingFxnCallExpList()
 f2 -> FunctionCallExpressionList()
 



visit
public void visit(CastExpression n)(Code)
 f0 -> "("
 f1 -> PrimaryExpressionNotFunction()
 f2 -> ")"
 f3 -> PrimaryExpression()
 



visit
public void visit(PrimaryExpression n)(Code)
 f0 -> PrimaryPrefix()
 f1 -> ( PrimaryPostfix() )*
 



visit
public void visit(PrimaryExpressionNotFunction n)(Code)
 f0 -> PrimaryPrefix()
 f1 -> ( PrimaryPostfix() )*
 



visit
public void visit(PrimaryExpressionWithTrailingFxnCallExpList n)(Code)
 f0 -> PrimaryPrefix()
 f1 -> ( PrimaryPostfixWithTrailingFxnCallExpList() )*
 



visit
public void visit(PrimaryPrefix n)(Code)
 f0 -> PrimaryPrefixNotFunction()
 | FunctionPrimaryPrefix()
 | ShorthandFunctionPrimaryPrefix()
 



visit
public void visit(PrimaryPrefixNotFunction n)(Code)
 f0 -> ThisPrimaryPrefix()
 | SuperPrimaryPrefix()
 | CalleePrimaryPrefix()
 | IdentifierPrimaryPrefix()
 | ParenPrimaryPrefix()
 | ArrayDeclarationPrimaryPrefix()
 | Literal()
 



visit
public void visit(ThisPrimaryPrefix n)(Code)
 f0 -> "this"
 



visit
public void visit(SuperPrimaryPrefix n)(Code)
 f0 -> "super"
 



visit
public void visit(CalleePrimaryPrefix n)(Code)
 f0 -> "callee"
 



visit
public void visit(IdentifierPrimaryPrefix n)(Code)
 f0 -> <IDENTIFIER>
 



visit
public void visit(ParenPrimaryPrefix n)(Code)
 f0 -> "("
 f1 -> Expression()
 f2 -> ")"
 



visit
public void visit(FunctionPrimaryPrefix n)(Code)
 f0 -> "function"
 f1 -> "("
 f2 -> ( Arglist() )?
 f3 -> ")"
 f4 -> ( "extends" PrimaryExpressionWithTrailingFxnCallExpList() FunctionCallExpressionList() )?
 f5 -> "{"
 f6 -> Program()
 f7 -> "}"
 



visit
public void visit(ShorthandFunctionPrimaryPrefix n)(Code)
 f0 -> "'{"
 f1 -> Program(true)
 f2 -> "}"
 



visit
public void visit(ArrayDeclarationPrimaryPrefix n)(Code)
 f0 -> "["
 f1 ->   (FunctionCallExpressionListBody())?
 f2 -> "]"
 



visit
public void visit(PrimaryPostfix n)(Code)
 f0 -> FunctionCallPrimaryPostfix()
 | ArraySubscriptPrimaryPostfix()
 | ThisScopeQualifierPrimaryPostfix()
 | PropertyIdentifierPrimaryPostfix()
 



visit
public void visit(PrimaryPostfixWithTrailingFxnCallExpList n)(Code)
 f0 -> ArraySubscriptPrimaryPostfix()
 | ThisScopeQualifierPrimaryPostfix()
 | PropertyIdentifierPrimaryPostfix()
 



visit
public void visit(FunctionCallPrimaryPostfix n)(Code)
 f0 -> FunctionCallExpressionList()
 



visit
public void visit(ArraySubscriptPrimaryPostfix n)(Code)
 
 f0 -> "["
 f1 -> Expression()
 f2 -> ( ".." Expression() )?
 f3 -> "]"
 



visit
public void visit(PropertyIdentifierPrimaryPostfix n)(Code)
 f0 -> "."
 f1 -> <IDENTIFIER>
 



visit
public void visit(ThisScopeQualifierPrimaryPostfix n)(Code)
 f0 -> "."
 f1 -> "this"
 



visit
public void visit(Literal n)(Code)
 f0 -> <INTEGER_LITERAL>
 | <FLOATING_POINT_LITERAL>
 | <STRING_LITERAL>
 | <REGEXP_LITERAL>
 | "true"
 | "false"
 | "null"
 | "undefined"
 



visit
public void visit(Permissions n)(Code)
 f0 -> ( "static" | "const" | "private" | "protected" | "public" )*
 



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.