Java Doc for SyntaxTemplate.java in  » Scripting » Kawa » kawa » lang » 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 » Kawa » kawa.lang 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   kawa.lang.SyntaxTemplate

All known Subclasses:   kawa.lang.SyntaxRule,
SyntaxTemplate
public class SyntaxTemplate implements Externalizable(Code)
The translated form of a (syntax template).


Field Summary
final static  intBUILD_CONS
     Instruction to creat a Pair from sub-expressions. Instruction BUILD_CONS+4*delta is followed by a sub-expression for the car (whose length is delta chars), followed by the expression for the cdr.
final static  intBUILD_DOTS
     Instruction BUILD_DOTS+8*i repeats a sub-expression. The value i is a variable index of a pattern variable of at least the needed depth.
final static  intBUILD_LIST1
     Make following operand into a 1-element list.
final static  intBUILD_LITERAL
     Instruction BUILD_LITERAL+8*i pushes literal_values[i].
final static  intBUILD_MISC
     Template instructions that don't have an operand value.
final static  intBUILD_NIL
    
final static  intBUILD_SYNTAX
     Wrap following sub-expression in a SyntaxForm.
final static  intBUILD_VAR
     Instruction BUILD_VAR+8*i pushes vars[i]. This array contains the values of pattern variables.
final static  intBUILD_VAR_CAR
     Instruction BUILD_VAR_CAR+8*i pushes car(vars[i]). It assumes that vars[i] is actually a pair whose car was the matched pattern variable.
final static  intBUILD_VECTOR
     Build a vector (an FVector) from following sub-expression. The latter must evaluate to a list.
final static  intBUILD_WIDE
     Unfinished support for "operand" values that need more tahn 13 bits.
final static  Stringdots3
    
 Object[]literal_values
    
 intmax_nesting
    
 StringpatternNesting
     Map variable to ellipsis nesting depth. The nesting depth of the i'th pattern variable is (int) patternNesting.charAt(i)/2. The low-order bit indicates that if matched value is the car of the value saved in the vars array. (We use a String because it is compact both at runtime and in .class files.
 Stringtemplate_program
     A syntax or syntax-rules template is translated into a "template program." The template program is a simple bytecode stored in a string.

Constructor Summary
protected  SyntaxTemplate()
    
public  SyntaxTemplate(String patternNesting, String template_program, Object[] literal_values, int max_nesting)
    
public  SyntaxTemplate(Object template, SyntaxForm syntax, Translator tr)
    

Method Summary
public  intconvert_template(Object form, SyntaxForm syntax, StringBuffer template_program, int nesting, java.util.Vector literals_vector, Object seen, boolean isVector, Translator tr)
     Recursively translate a syntax-rule template to a template program.
Parameters:
  form - the template from the syntax-rule
Parameters:
  syntax - if non-null, the closest surrounding SyntaxForm
Parameters:
  template_program - (output) the translated template
Parameters:
  nesting - the depth of ...
public  Objectexecute(Object[] vars, TemplateScope templateScope)
     Expand this template The compiler translates (syntax template) to a call to this method.
public  Objectexecute(Object[] vars, Translator tr, TemplateScope templateScope)
    
 Objectexecute(int pc, Object[] vars, int nesting, int[] indexes, Translator tr, TemplateScope templateScope)
    
Parameters:
  nesting - number of levels of ...
 LListexecuteToList(int pc, Object[] vars, int nesting, int[] indexes, Translator tr, TemplateScope templateScope)
     Similar to execute, but return is wrapped in a list. Normally the result is a single Pair, BUILD_DOTS can return zero or many Pairs.
 Objectget_var(int var_num, Object[] vars, int[] indexes)
    
static  intindexOf(java.util.Vector vec, Object elem)
     Similar to vec.indexOf(elem), but uses == (not equals) to compare.
public  voidreadExternal(ObjectInput in)
    
public  voidwriteExternal(ObjectOutput out)
    

Field Detail
BUILD_CONS
final static int BUILD_CONS(Code)
Instruction to creat a Pair from sub-expressions. Instruction BUILD_CONS+4*delta is followed by a sub-expression for the car (whose length is delta chars), followed by the expression for the cdr.



BUILD_DOTS
final static int BUILD_DOTS(Code)
Instruction BUILD_DOTS+8*i repeats a sub-expression. The value i is a variable index of a pattern variable of at least the needed depth. The result is spliced in.



BUILD_LIST1
final static int BUILD_LIST1(Code)
Make following operand into a 1-element list.



BUILD_LITERAL
final static int BUILD_LITERAL(Code)
Instruction BUILD_LITERAL+8*i pushes literal_values[i].



BUILD_MISC
final static int BUILD_MISC(Code)
Template instructions that don't have an operand value.



BUILD_NIL
final static int BUILD_NIL(Code)



BUILD_SYNTAX
final static int BUILD_SYNTAX(Code)
Wrap following sub-expression in a SyntaxForm.



BUILD_VAR
final static int BUILD_VAR(Code)
Instruction BUILD_VAR+8*i pushes vars[i]. This array contains the values of pattern variables.



BUILD_VAR_CAR
final static int BUILD_VAR_CAR(Code)
Instruction BUILD_VAR_CAR+8*i pushes car(vars[i]). It assumes that vars[i] is actually a pair whose car was the matched pattern variable. (This is done so we can preserve PairWithPosition source positions).



BUILD_VECTOR
final static int BUILD_VECTOR(Code)
Build a vector (an FVector) from following sub-expression. The latter must evaluate to a list.



BUILD_WIDE
final static int BUILD_WIDE(Code)
Unfinished support for "operand" values that need more tahn 13 bits.



dots3
final static String dots3(Code)



literal_values
Object[] literal_values(Code)



max_nesting
int max_nesting(Code)



patternNesting
String patternNesting(Code)
Map variable to ellipsis nesting depth. The nesting depth of the i'th pattern variable is (int) patternNesting.charAt(i)/2. The low-order bit indicates that if matched value is the car of the value saved in the vars array. (We use a String because it is compact both at runtime and in .class files.



template_program
String template_program(Code)
A syntax or syntax-rules template is translated into a "template program." The template program is a simple bytecode stored in a string. The encoding is designed so that instructions are normally in the range 1..127, which makes the CONSTANT_Utf8 encoding used in .class files compact. The folowing BUILD_XXX are the "opcode" of the encoding, stored in the low-order 3 bits of a char.




Constructor Detail
SyntaxTemplate
protected SyntaxTemplate()(Code)



SyntaxTemplate
public SyntaxTemplate(String patternNesting, String template_program, Object[] literal_values, int max_nesting)(Code)



SyntaxTemplate
public SyntaxTemplate(Object template, SyntaxForm syntax, Translator tr)(Code)




Method Detail
convert_template
public int convert_template(Object form, SyntaxForm syntax, StringBuffer template_program, int nesting, java.util.Vector literals_vector, Object seen, boolean isVector, Translator tr)(Code)
Recursively translate a syntax-rule template to a template program.
Parameters:
  form - the template from the syntax-rule
Parameters:
  syntax - if non-null, the closest surrounding SyntaxForm
Parameters:
  template_program - (output) the translated template
Parameters:
  nesting - the depth of ... we are inside
Parameters:
  literals_vector - (output) the literal data in the template
Parameters:
  tr - the current Translator the index of a pattern variable (in pattern_names)that is nested at least as much as nesting;if there is none such, -1 if there is any pattern variable or elipsis;and -2 if the is no pattern variable or elipsis.



execute
public Object execute(Object[] vars, TemplateScope templateScope)(Code)
Expand this template The compiler translates (syntax template) to a call to this method.



execute
public Object execute(Object[] vars, Translator tr, TemplateScope templateScope)(Code)



execute
Object execute(int pc, Object[] vars, int nesting, int[] indexes, Translator tr, TemplateScope templateScope)(Code)

Parameters:
  nesting - number of levels of ... we are nested inside
Parameters:
  indexes - element i (where i in [0 .. nesting-1] specifiesthe iteration index for the i'level of nesting



executeToList
LList executeToList(int pc, Object[] vars, int nesting, int[] indexes, Translator tr, TemplateScope templateScope)(Code)
Similar to execute, but return is wrapped in a list. Normally the result is a single Pair, BUILD_DOTS can return zero or many Pairs.



get_var
Object get_var(int var_num, Object[] vars, int[] indexes)(Code)



indexOf
static int indexOf(java.util.Vector vec, Object elem)(Code)
Similar to vec.indexOf(elem), but uses == (not equals) to compare.



readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException(Code)



writeExternal
public void writeExternal(ObjectOutput out) throws IOException(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.