Package gnu.kawa.lispexpr
Class LispLanguage
java.lang.Object
gnu.expr.Language
gnu.kawa.lispexpr.LispLanguage
- Direct Known Subclasses:
Scheme
Language sub-class for Lisp-like languages (including Scheme).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Symbol
static final Symbol
static final Namespace
protected ReadTable
The defaultReadTable
for this language.static final SimpleSymbol
static final Namespace
static StaticFieldLocation
static final Symbol
Used for Kawa infix ':' operator.static final String
static final Symbol
static final String
static final String
static final Symbol
static final String
static final Symbol
static final Namespace
The unit namespace contains the bindings for symbols such as `cm', `s', etc.static final String
static final String
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 -
Method Summary
Modifier and TypeMethodDescriptionabstract ReadTable
Create a freshReadTable
appropriate for this language.declFromField
(ModuleExp mod, Object fvalue, Field fld) static Type
decodeArrayType
(String name) protected void
defSntxStFld
(String name, String cname) protected void
defSntxStFld
(String name, String cname, String fname) Declare in the current Environment a Syntax bound to a static field.protected Symbol
fromLangSymbol
(Object sym) getLexer
(gnu.kawa.io.InPort inp, SourceMessages messages) getNamedType
(String name) Get the correspondingType
for a given name.getPackageStyleType
(String name) Try to get a type of the form lang:type.getTypeFor
(Class clas) getTypeFor
(Object spec, boolean lenient) Convert a "type value" to a Type.boolean
Are keywords self-evaluating? True in CommonLisp.static Symbol
langSymbolToSymbol
(Object sym) Convert the Language's idea of a symbol to a gnu.mapping.Symbol.boolean
parse
(Compilation comp, int options) void
resolve
(Compilation comp) Resolve names and other post-parsing processing.boolean
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 Details
-
quote_str
- See Also:
-
unquote_str
- See Also:
-
unquotesplicing_str
- See Also:
-
quasiquote_str
- See Also:
-
quasiquote_sym
-
dots3_sym
-
splice_str
- See Also:
-
splice_sym
-
splice_colon_str
- See Also:
-
splice_colon_sym
-
lookup_sym
Used for Kawa infix ':' operator. -
bracket_list_sym
-
bracket_apply_sym
-
getNamedPartLocation
-
unitNamespace
The unit namespace contains the bindings for symbols such as `cm', `s', etc. -
constructNamespace
-
entityNamespace
-
defaultReadTable
The defaultReadTable
for this language.
-
-
Constructor Details
-
LispLanguage
public LispLanguage()
-
-
Method Details
-
createReadTable
Create a freshReadTable
appropriate for this language. -
getLexer
-
getCompilationClass
- Overrides:
getCompilationClass
in classLanguage
-
parse
- Specified by:
parse
in classLanguage
- Throws:
IOException
SyntaxException
-
resolve
Resolve names and other post-parsing processing. -
declFromField
- Overrides:
declFromField
in classLanguage
-
defSntxStFld
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.
-
defSntxStFld
-
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
-
langSymbolToSymbol
Convert the Language's idea of a symbol to a gnu.mapping.Symbol. -
fromLangSymbol
-
getTypeMap
-
getPackageStyleType
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
.
-
decodeArrayType
-
getNamedType
Description copied from class:Language
Get the correspondingType
for a given name. This is currently used as a hook in the conversion of type designators to types.LispLanguage
uses 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:
getNamedType
in classLanguage
- Parameters:
name
- The name of a type to search for.- Returns:
- The corresponding
Type
if a suitable one can be found, otherwisenull
.
-
getTypeFor
Description copied from class:Language
Convert 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:
getTypeFor
in classLanguage
-
getTypeFor
- Overrides:
getTypeFor
in classLanguage
-
getPrimaryPrompt
- Overrides:
getPrimaryPrompt
in classLanguage
-
getSecondaryPrompt
- Overrides:
getSecondaryPrompt
in classLanguage
-