Package gnu.kawa.lispexpr
Class LispLanguage
- java.lang.Object
-
- gnu.expr.Language
-
- gnu.kawa.lispexpr.LispLanguage
-
-
Field Summary
Fields Modifier and Type Field Description static Symbolbracket_apply_symstatic Symbolbracket_list_symstatic NamespaceconstructNamespaceprotected ReadTabledefaultReadTableThe defaultReadTablefor this language.static SimpleSymboldots3_symstatic NamespaceentityNamespacestatic StaticFieldLocationgetNamedPartLocationstatic Symbollookup_symUsed for Kawa infix ':' operator.static Stringquasiquote_strstatic Symbolquasiquote_symstatic Stringquote_strstatic Stringsplice_colon_strstatic Symbolsplice_colon_symstatic Stringsplice_strstatic Symbolsplice_symstatic NamespaceunitNamespaceThe unit namespace contains the bindings for symbols such as `cm', `s', etc.static Stringunquote_strstatic Stringunquotesplicing_str-
Fields inherited from class gnu.expr.Language
current, environ, FUNCTION_NAMESPACE, global, NAMESPACE_PREFIX_NAMESPACE, PARSE_CURRENT_NAMES, PARSE_EMIT_MAIN, PARSE_EXPLICIT, PARSE_FOR_APPLET, PARSE_FOR_EVAL, PARSE_FOR_LINT, PARSE_FOR_SERVLET, PARSE_IMMEDIATE, PARSE_INTERACTIVE_MODULE, PARSE_ONE_LINE, PARSE_PROLOG, requirePedantic, userEnv, VALUE_NAMESPACE
-
-
Constructor Summary
Constructors Constructor Description LispLanguage()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract ReadTablecreateReadTable()Create a freshReadTableappropriate for this language.DeclarationdeclFromField(ModuleExp mod, Object fvalue, Field fld)static TypedecodeArrayType(String name)protected voiddefSntxStFld(String name, String cname)protected voiddefSntxStFld(String name, String cname, String fname)Declare in the current Environment a Syntax bound to a static field.protected SymbolfromLangSymbol(Object sym)StringgetCompilationClass()LispReadergetLexer(gnu.kawa.io.InPort inp, SourceMessages messages)TypegetNamedType(String name)Get the correspondingTypefor a given name.TypegetPackageStyleType(String name)Try to get a type of the form lang:type.StringgetPrimaryPrompt()StringgetSecondaryPrompt()TypegetTypeFor(Class clas)TypegetTypeFor(Object spec, boolean lenient)Convert a "type value" to a Type.protected HashMap<String,Type>getTypeMap()booleankeywordsAreSelfEvaluating()Are keywords self-evaluating? True in CommonLisp.static SymbollangSymbolToSymbol(Object sym)Convert the Language's idea of a symbol to a gnu.mapping.Symbol.booleanparse(Compilation comp, int options)voidresolve(Compilation comp)Resolve names and other post-parsing processing.booleanselfEvaluatingSymbol(Object obj)-
Methods inherited from class gnu.expr.Language
asType, booleanObject, booleanValue, coerceFromObject, coerceToObject, decodeType, defAliasStFld, define, defineFunction, defineFunction, defProcStFld, defProcStFld, defProcStFld, defProcStFldAs, detect, detect, detect, encodeType, eval, eval, eval, eval, eval, eval, eval, eval, eval, formatType, getCompilation, getCompilation, getDefaultLanguage, getEnvironment, getEnvPropertyFor, getEnvPropertyFor, getExtensions, getFormat, getInstance, getInstance, getInstanceFromFilenameExtension, getLangEnvironment, getLangTypeFor, getLanguages, getName, getNamespaceOf, getNewEnvironment, getOutputConsumer, getSymbol, getTypeFor, getTypeFor, getTypeFor, hasNamespace, hasSeparateFunctionNamespace, isTrue, isValidJavaName, loadClass, lookup, lookupBuiltin, mangleName, noValue, parse, parse, parse, parse, registerLanguage, restoreCurrent, runAsApplication, setCurrentLanguage, setDefaults, setSaveCurrent, unionType
-
-
-
-
Field Detail
-
quote_str
public static final String quote_str
- See Also:
- Constant Field Values
-
unquote_str
public static final String unquote_str
- See Also:
- Constant Field Values
-
unquotesplicing_str
public static final String unquotesplicing_str
- See Also:
- Constant Field Values
-
quasiquote_str
public static final String quasiquote_str
- See Also:
- Constant Field Values
-
quasiquote_sym
public static final Symbol quasiquote_sym
-
dots3_sym
public static final SimpleSymbol dots3_sym
-
splice_str
public static final String splice_str
- See Also:
- Constant Field Values
-
splice_sym
public static final Symbol splice_sym
-
splice_colon_str
public static final String splice_colon_str
- See Also:
- Constant Field Values
-
splice_colon_sym
public static final Symbol splice_colon_sym
-
lookup_sym
public static final Symbol lookup_sym
Used for Kawa infix ':' operator.
-
bracket_list_sym
public static final Symbol bracket_list_sym
-
bracket_apply_sym
public static final Symbol bracket_apply_sym
-
getNamedPartLocation
public static StaticFieldLocation getNamedPartLocation
-
unitNamespace
public static final Namespace unitNamespace
The unit namespace contains the bindings for symbols such as `cm', `s', etc.
-
constructNamespace
public static final Namespace constructNamespace
-
entityNamespace
public static final Namespace entityNamespace
-
defaultReadTable
protected ReadTable defaultReadTable
The defaultReadTablefor this language.
-
-
Method Detail
-
createReadTable
public abstract ReadTable createReadTable()
Create a freshReadTableappropriate for this language.
-
getLexer
public LispReader getLexer(gnu.kawa.io.InPort inp, SourceMessages messages)
-
getCompilationClass
public String getCompilationClass()
- Overrides:
getCompilationClassin classLanguage
-
parse
public boolean parse(Compilation comp, int options) throws IOException, SyntaxException
- Specified by:
parsein classLanguage- Throws:
IOExceptionSyntaxException
-
resolve
public void resolve(Compilation comp)
Resolve names and other post-parsing processing.
-
declFromField
public Declaration declFromField(ModuleExp mod, Object fvalue, Field fld)
- Overrides:
declFromFieldin classLanguage
-
defSntxStFld
protected void defSntxStFld(String name, String cname, String fname)
Declare in the current Environment a Syntax bound to a static field.- Parameters:
name- the procedure's source-level name.cname- the name of the class containing the field.fname- the name of the field, which should be a static final field whose type extends kawa.lang.Syntax.
-
keywordsAreSelfEvaluating
public boolean keywordsAreSelfEvaluating()
Are keywords self-evaluating? True in CommonLisp. Used to be true for Scheme also, but now in Scheme literal keywords should only be used for keyword arguments; if you want a Keyword value if should be quoted.- Returns:
- true if we should treat keywords as self-evaluating.
-
selfEvaluatingSymbol
public boolean selfEvaluatingSymbol(Object obj)
-
langSymbolToSymbol
public static Symbol langSymbolToSymbol(Object sym)
Convert the Language's idea of a symbol to a gnu.mapping.Symbol.
-
getPackageStyleType
public Type getPackageStyleType(String name)
Try to get a type of the form lang:type. E.g. elisp:buffer.- Parameters:
name- The package-style type name as a string.- Returns:
- null if no such type could be found, or the corresponding
Type.
-
getNamedType
public Type getNamedType(String name)
Description copied from class:LanguageGet the correspondingTypefor a given name. This is currently used as a hook in the conversion of type designators to types.LispLanguageuses it to check for package style type designators such asemacs:buffer, and CommonLisp uses it to check for a type designator "boolean", so that is can return the appropriate boolean type. This is a bit over-specialised, but it beats actually overriding getTypeFor(String) in LispLanguage, CommonLisp just for these minor changes... FIXME!- Overrides:
getNamedTypein classLanguage- Parameters:
name- The name of a type to search for.- Returns:
- The corresponding
Typeif a suitable one can be found, otherwisenull.
-
getTypeFor
public Type getTypeFor(Object spec, boolean lenient)
Description copied from class:LanguageConvert a "type value" to a Type. This is used to process types from source code. Normally, an identifier that resolves to a class name should resolve to the raw ClassType, rather than a language specific class (which might e.g. use a different constructor). These may be exceptions: specifically, given java.lang.String, we do want to use language-specific conversion to String.- Overrides:
getTypeForin classLanguage
-
getTypeFor
public Type getTypeFor(Class clas)
- Overrides:
getTypeForin classLanguage
-
getPrimaryPrompt
public String getPrimaryPrompt()
- Overrides:
getPrimaryPromptin classLanguage
-
getSecondaryPrompt
public String getSecondaryPrompt()
- Overrides:
getSecondaryPromptin classLanguage
-
-