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


java.lang.Object
   gnu.expr.Language

All known Subclasses:   gnu.xquery.lang.XQuery,  gnu.kawa.lispexpr.LispLanguage,
Language
abstract public class Language (Code)
Contains various language-dependent methods. Also contains "global" state about the executation environment, such as the global Environment. There can be multiple Languages associated with different threads, representing mutiple top-levels. (However, this functionality is incomplete.)


Field Summary
final public static  intFUNCTION_NAMESPACE
    
final public static  intNAMESPACE_PREFIX_NAMESPACE
    
final public static  intPARSE_IMMEDIATE
     Flag to tell parse that expression will be evaluated immediately. I.e.
final public static  intPARSE_ONE_LINE
     Flag to tell parse to only read a single line if possible. Multiple lines may be read if syntactically required.
final public static  intPARSE_PROLOG
     Flag to tell parser to continue until we have the module name. The parser is allowed to continue further, but must stop before any module import.
final public static  intVALUE_NAMESPACE
    
final protected static  ThreadLocationcurrent
    
static  intenvCounter
    
protected static  intenv_counter
    
protected  Environmentenviron
     The environment for language built-ins and predefined bindings.
static  String[][]languages
     List of known languages and their Language classes.
public static  booleanrequirePedantic
    
protected  EnvironmentuserEnv
     If non-null, the user environment. This allows "bunding" an Environment with a Language.

Constructor Summary
protected  Language()
    

Method Summary
final public  TypeasType(Object spec)
     "Coerce" a language-specific "type specifier" object to a Type.
public  ObjectbooleanObject(boolean b)
    
public  ObjectcoerceFromObject(Class clas, Object obj)
    
public  ObjectcoerceToObject(Class clas, Object obj)
    
public  ObjectcoerceToObject(int val)
    
public  DeclarationdeclFromField(ModuleExp mod, Object fvalue, Field fld)
    
protected  voiddefAliasStFld(String name, String cname, String fname)
     Declare in the current Environment a variable aliased to a static field.
protected  voiddefProcStFld(String name, String cname, String fname)
     Declare in the current Environment a procedure bound to a static field.
protected  voiddefProcStFld(String name, String cname)
     Declare in the current Environment a procedure bound to a static field.
public  voiddefine(String sym, Object p)
     Enter a value into the current environment.
final public  voiddefineFunction(Named proc)
     Enter a named function into the current environment.
public  voiddefineFunction(String name, Object proc)
     Enter a function into the current environment.
public static  Languagedetect(InputStream in)
     Detect the programming language of a file based on its first line.
public static  Languagedetect(InPort port)
     Detect the programming language of a file based on its first line.
public static  Languagedetect(String line)
     Detect the programming language of a file based on its first line.
public  voidemitCoerceToBoolean(CodeAttr code)
     Generate code to test if an object is considered true. Assume the object has been pushed on the JVM stack. Generate code to push true or false as appropriate.
public  voidemitPushBoolean(boolean value, CodeAttr code)
    
final public  Objecteval(String string)
     Return the result of evaluating a string as a source expression.
final public  Objecteval(Reader in)
     Evaluate expression(s) read from a Reader.
final public  Objecteval(InPort port)
     Evaluate expression(s) read from an InPort.
final public  voideval(String string, Writer out)
     Evaluate a string and write the result value(s) on a Writer.
final public  voideval(String string, PrintConsumer out)
     Evaluate a string and write the result value(s) to a PrintConsumer. This is to disambiguate calls using OutPort or XMLPrinter, which are both Writer and Consumer.
final public  voideval(String string, Consumer out)
     Evaluate a string and write the result value(s) to a Consumer.
final public  voideval(Reader in, Writer out)
     Read expressions from a Reader and write the result to a Writer.
public  voideval(Reader in, Consumer out)
     Read expressions from a Reader and write the result to a Consumer.
public  voideval(InPort port, CallContext ctx)
    
public  StringformatType(Type type)
    
public  CompilationgetCompilation(Lexer lexer, SourceMessages messages)
    
public static  LanguagegetDefaultLanguage()
    
public  ObjectgetEnvPropertyFor(java.lang.reflect.Field fld, Object value)
    
public  ObjectgetEnvPropertyFor(Declaration decl)
    
final public  EnvironmentgetEnvironment()
     Get current user environment.
public  AbstractFormatgetFormat(boolean readable)
    
public static  LanguagegetInstance(String name)
     Look for a language with the given name or extension. If name is null, look for the first language available.
public static  LanguagegetInstance(String langName, Class langClass)
    
public static  LanguagegetInstanceFromFilenameExtension(String filename)
    
public  EnvironmentgetLangEnvironment()
    
final public  TypegetLangTypeFor(Type type)
    
public static  String[][]getLanguages()
    
abstract public  LexergetLexer(InPort inp, SourceMessages messages)
    
public  StringgetName()
    
public  intgetNamespaceOf(Declaration decl)
     Return the namespace (e.g value or function) of a Declaration.
final public  EnvironmentgetNewEnvironment()
    
public  ConsumergetOutputConsumer(Writer out)
    
public  ProceduregetPrompter()
    
public  SymbolgetSymbol(String name)
    
public  TypegetTypeFor(Class clas)
    
public  TypegetTypeFor(String name)
    
final public  TypegetTypeFor(Object spec, boolean lenient)
    
final public  TypegetTypeFor(Expression exp)
    
public  TypegetTypeFor(Expression exp, boolean lenient)
    
public  booleanhasNamespace(Declaration decl, int namespace)
     True if a Declaration is in the specified namespace.
Parameters:
  namespace - normally a bitmask as returned by getNamespaceOf.
public  booleanhasSeparateFunctionNamespace()
     True if functions are in a separate anme space from variable. Is true for e.g.
public  booleanisTrue(Object value)
     Test if a value is considered "true" in this language.
public  voidloadClass(String name)
    
public  Objectlookup(String name)
    
public  NamedLocationlookupBuiltin(Symbol name, Object property, int hash)
    
public  ObjectnoValue()
     The value to return for a "void" result.
final public  Compilationparse(InPort port, gnu.text.SourceMessages messages, int options)
     Parse one or more expressions.
final public  Compilationparse(InPort port, gnu.text.SourceMessages messages, ModuleInfo info)
    
final public  Compilationparse(Lexer lexer, int options, ModuleInfo info)
    
abstract public  booleanparse(Compilation comp, int options)
    
public static  voidregisterLanguage(String[] langMapping)
     Add a language to the list.
public  voidresolve(Compilation comp)
     Perform any need post-processing after we've read all the modules to be compiled. Using a separate pass allows compiling mutually recursive modules.
public  voidrunAsApplication(String[] args)
    
public static  voidsetDefaultLanguage(Language language)
    
public static synchronized  voidsetDefaults(Language lang)
    
public static  Typestring2Type(String name)
    

Field Detail
FUNCTION_NAMESPACE
final public static int FUNCTION_NAMESPACE(Code)



NAMESPACE_PREFIX_NAMESPACE
final public static int NAMESPACE_PREFIX_NAMESPACE(Code)



PARSE_IMMEDIATE
final public static int PARSE_IMMEDIATE(Code)
Flag to tell parse that expression will be evaluated immediately. I.e. we're not creating class files for future execution.



PARSE_ONE_LINE
final public static int PARSE_ONE_LINE(Code)
Flag to tell parse to only read a single line if possible. Multiple lines may be read if syntactically required.



PARSE_PROLOG
final public static int PARSE_PROLOG(Code)
Flag to tell parser to continue until we have the module name. The parser is allowed to continue further, but must stop before any module import.



VALUE_NAMESPACE
final public static int VALUE_NAMESPACE(Code)



current
final protected static ThreadLocation current(Code)



envCounter
static int envCounter(Code)



env_counter
protected static int env_counter(Code)



environ
protected Environment environ(Code)
The environment for language built-ins and predefined bindings.



languages
static String[][] languages(Code)
List of known languages and their Language classes. Each element is one or more language names, or filename extensions, followed by the name of the Language sub-class. The table is searched from the beginning.



requirePedantic
public static boolean requirePedantic(Code)



userEnv
protected Environment userEnv(Code)
If non-null, the user environment. This allows "bunding" an Environment with a Language. This is partly to match existing documentation, and partly for convenience from Java code. Normally, userEnv is null, in which case the user environment is extracted from the current thread.




Constructor Detail
Language
protected Language()(Code)




Method Detail
asType
final public Type asType(Object spec)(Code)
"Coerce" a language-specific "type specifier" object to a Type.



booleanObject
public Object booleanObject(boolean b)(Code)



coerceFromObject
public Object coerceFromObject(Class clas, Object obj)(Code)



coerceToObject
public Object coerceToObject(Class clas, Object obj)(Code)



coerceToObject
public Object coerceToObject(int val)(Code)



declFromField
public Declaration declFromField(ModuleExp mod, Object fvalue, Field fld)(Code)



defAliasStFld
protected void defAliasStFld(String name, String cname, String fname)(Code)
Declare in the current Environment a variable aliased to a static field.



defProcStFld
protected void defProcStFld(String name, String cname, String fname)(Code)
Declare in the current Environment a procedure bound to a static field.
Parameters:
  name - the procedure's source-level name.
Parameters:
  cname - the name of the class containing the field.
Parameters:
  fname - the name of the field, which should be a staticfinal field whose type extends gnu.mapping.Procedure.



defProcStFld
protected void defProcStFld(String name, String cname)(Code)
Declare in the current Environment a procedure bound to a static field.
Parameters:
  name - the procedure's source-level name.
Parameters:
  cname - the name of the class containing the field.The name of the field is the mangling of name.



define
public void define(String sym, Object p)(Code)
Enter a value into the current environment.



defineFunction
final public void defineFunction(Named proc)(Code)
Enter a named function into the current environment.



defineFunction
public void defineFunction(String name, Object proc)(Code)
Enter a function into the current environment. Same as define(name,proc) for Scheme, but not for (say) Common Lisp.



detect
public static Language detect(InputStream in) throws IOException(Code)
Detect the programming language of a file based on its first line. a suitable Language or null if we didn't recognize one.



detect
public static Language detect(InPort port) throws IOException(Code)
Detect the programming language of a file based on its first line. a suitable Language or null if we didn't recognize one.



detect
public static Language detect(String line)(Code)
Detect the programming language of a file based on its first line.
Parameters:
  line - the first input line a suitable Language or null if we didn't recognize one.



emitCoerceToBoolean
public void emitCoerceToBoolean(CodeAttr code)(Code)
Generate code to test if an object is considered true. Assume the object has been pushed on the JVM stack. Generate code to push true or false as appropriate.



emitPushBoolean
public void emitPushBoolean(boolean value, CodeAttr code)(Code)



eval
final public Object eval(String string) throws Throwable(Code)
Return the result of evaluating a string as a source expression.



eval
final public Object eval(Reader in) throws Throwable(Code)
Evaluate expression(s) read from a Reader. This just calls eval(InPort).



eval
final public Object eval(InPort port) throws Throwable(Code)
Evaluate expression(s) read from an InPort.



eval
final public void eval(String string, Writer out) throws Throwable(Code)
Evaluate a string and write the result value(s) on a Writer.



eval
final public void eval(String string, PrintConsumer out) throws Throwable(Code)
Evaluate a string and write the result value(s) to a PrintConsumer. This is to disambiguate calls using OutPort or XMLPrinter, which are both Writer and Consumer.



eval
final public void eval(String string, Consumer out) throws Throwable(Code)
Evaluate a string and write the result value(s) to a Consumer.



eval
final public void eval(Reader in, Writer out) throws Throwable(Code)
Read expressions from a Reader and write the result to a Writer.



eval
public void eval(Reader in, Consumer out) throws Throwable(Code)
Read expressions from a Reader and write the result to a Consumer.



eval
public void eval(InPort port, CallContext ctx) throws Throwable(Code)



formatType
public String formatType(Type type)(Code)



getCompilation
public Compilation getCompilation(Lexer lexer, SourceMessages messages)(Code)



getDefaultLanguage
public static Language getDefaultLanguage()(Code)



getEnvPropertyFor
public Object getEnvPropertyFor(java.lang.reflect.Field fld, Object value)(Code)



getEnvPropertyFor
public Object getEnvPropertyFor(Declaration decl)(Code)



getEnvironment
final public Environment getEnvironment()(Code)
Get current user environment.



getFormat
public AbstractFormat getFormat(boolean readable)(Code)



getInstance
public static Language getInstance(String name)(Code)
Look for a language with the given name or extension. If name is null, look for the first language available.



getInstance
public static Language getInstance(String langName, Class langClass)(Code)



getInstanceFromFilenameExtension
public static Language getInstanceFromFilenameExtension(String filename)(Code)



getLangEnvironment
public Environment getLangEnvironment()(Code)



getLangTypeFor
final public Type getLangTypeFor(Type type)(Code)



getLanguages
public static String[][] getLanguages()(Code)
Get a list of all available languages



getLexer
abstract public Lexer getLexer(InPort inp, SourceMessages messages)(Code)



getName
public String getName()(Code)



getNamespaceOf
public int getNamespaceOf(Declaration decl)(Code)
Return the namespace (e.g value or function) of a Declaration. Return a bitmask of all the namespaces "covered" by the Declaration. Note this isn't a namespace in the XML sense; if a Declaration has a specific namespace URI, then that is part of its symbol. This namespace bitmap is a separate dimension, for the use of languages that have separate namespaces for different kinds of declarations, such as variables and functions.



getNewEnvironment
final public Environment getNewEnvironment()(Code)



getOutputConsumer
public Consumer getOutputConsumer(Writer out)(Code)



getPrompter
public Procedure getPrompter()(Code)



getSymbol
public Symbol getSymbol(String name)(Code)



getTypeFor
public Type getTypeFor(Class clas)(Code)



getTypeFor
public Type getTypeFor(String name)(Code)



getTypeFor
final public Type getTypeFor(Object spec, boolean lenient)(Code)



getTypeFor
final public Type getTypeFor(Expression exp)(Code)



getTypeFor
public Type getTypeFor(Expression exp, boolean lenient)(Code)



hasNamespace
public boolean hasNamespace(Declaration decl, int namespace)(Code)
True if a Declaration is in the specified namespace.
Parameters:
  namespace - normally a bitmask as returned by getNamespaceOf.



hasSeparateFunctionNamespace
public boolean hasSeparateFunctionNamespace()(Code)
True if functions are in a separate anme space from variable. Is true for e.g. Common Lisp, Emacs Lisp; false for Scheme.



isTrue
public boolean isTrue(Object value)(Code)
Test if a value is considered "true" in this language.



loadClass
public void loadClass(String name) throws java.lang.ClassNotFoundException(Code)



lookup
public Object lookup(String name)(Code)



lookupBuiltin
public NamedLocation lookupBuiltin(Symbol name, Object property, int hash)(Code)



noValue
public Object noValue()(Code)
The value to return for a "void" result.



parse
final public Compilation parse(InPort port, gnu.text.SourceMessages messages, int options) throws java.io.IOException, gnu.text.SyntaxException(Code)
Parse one or more expressions.
Parameters:
  port - the InPort to read the expressions from.
Parameters:
  messages - where to send error messages and warnings
Parameters:
  options - various flags, includding PARSE_IMMEDIATE and PARSE_ONE_LINE a new Compilation.May return null if PARSE_ONE_LINE on end-of-file.



parse
final public Compilation parse(InPort port, gnu.text.SourceMessages messages, ModuleInfo info) throws java.io.IOException, gnu.text.SyntaxException(Code)



parse
final public Compilation parse(Lexer lexer, int options, ModuleInfo info) throws java.io.IOException, gnu.text.SyntaxException(Code)



parse
abstract public boolean parse(Compilation comp, int options) throws java.io.IOException, gnu.text.SyntaxException(Code)



registerLanguage
public static void registerLanguage(String[] langMapping)(Code)
Add a language to the list.
Parameters:
  langMapping - is a language definition, the first indexis the language name, subsequent indexes are file types thatmight cause the language to be used and the final index is thename of the class that implements the language.



resolve
public void resolve(Compilation comp)(Code)
Perform any need post-processing after we've read all the modules to be compiled. Using a separate pass allows compiling mutually recursive modules.



runAsApplication
public void runAsApplication(String[] args)(Code)



setDefaultLanguage
public static void setDefaultLanguage(Language language)(Code)



setDefaults
public static synchronized void setDefaults(Language lang)(Code)



string2Type
public static Type string2Type(String name)(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.