|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.scheinerman.phoenix.interpreter.Interpreter
net.scheinerman.phoenix.interpreter.ImportInterpreter
public class ImportInterpreter
Extends the standard interpreter to provide functionality for importing functions from modules into the
currently executing program. This provides five different ways of importing modules into the current
program. Each import type has an import statement which is a variant of the general phrase:
[modifier] import [*] module_path.phx
. Whether or not there is a modifier
or a
*
depends on the import type. The module_path.phx
is the relative path of a
Phoenix program. This path should be delimited by slashes and specify an existing file. If no
.phx
file extension is specified, the import will be taken from the Phoenix standard library.
All imported functions are imported as module_name.function_name
.
All of the possible import types are listed below, along with the import statement necessary to get it
and the description of what it does.
Type | Import statement | Description |
Full | import module.phx |
Imports all top-level (no indent) global and local functions as their respective types. Thus, all top-level global functions become global function and all top-level local functions become local functions in the current scope (the scope in which the import is called). |
Global only | global import module.phx |
Imports only top-level global functions as global functions. |
Global full | global import * module.phx |
Imports all top-level global and local functions as global functions. |
Local only | local import module.phx |
Imports only top-level local functions as local functions in the current scope. |
Local full | local import * module.phx |
Imports all top-level global and local functions as local functions in the current scope. |
Field Summary | |
---|---|
static int |
ALL
A constant that indicates that the imports from a module should be all top-level functions as their respective types. |
static int |
ALL_AS_GLOBAL
A constant that indicates that the imports from a module should be all top-level functions as global functions. |
static int |
ALL_AS_LOCAL
A constant that indicates that the imports from a module should be all top-level functions as local functions. |
static int |
GLOBAL_ONLY
A constant that indicates that the imports from a module should only be the top-level global functions as global functions. |
private java.util.Scanner |
input
|
static int |
LOCAL_ONLY
A constant that indicates that the imports from a module should only be the top-level local functions as local functions. |
private java.io.File |
modFile
|
private java.lang.String |
module
|
private java.lang.String |
prefix
|
private int |
type
|
Fields inherited from class net.scheinerman.phoenix.interpreter.Interpreter |
---|
_break, _continue, _return, breakValue, code, fat, file, keywordList, line, line_diff, printValues, retType, retTypeSet, retValue, run_code, stop, vat |
Constructor Summary | |
---|---|
ImportInterpreter(java.lang.String module,
int type,
java.util.LinkedList<java.util.HashMap<java.lang.String,Variable>> vat,
java.util.LinkedList<java.util.HashMap<java.lang.String,Function>> fat)
|
Method Summary | |
---|---|
void |
run()
Begins the interpretation process. |
Methods inherited from class net.scheinerman.phoenix.interpreter.Interpreter |
---|
dealWithBreak, dealWithContinue, dealWithError, dealWithReturn, delete, doRun, getBlock, getFunction, getFunctionArguments, getFunctionFromDefinition, getReturnValue, getVariable, getWhitespace, initNewTables, isValidIdentifier, makeDefaultVariable, makeFunction, makeVariable, makeVariable, parsePhrase, putFunction, removeComments, removeWhitespace, retValueMatches |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ALL
import module.phx
public static final int GLOBAL_ONLY
global import module.phx
public static final int ALL_AS_GLOBAL
global import * module.phx
public static final int LOCAL_ONLY
local import module.phx
public static final int ALL_AS_LOCAL
local import * module.phx
private java.lang.String module
private java.io.File modFile
private java.util.Scanner input
private int type
private java.lang.String prefix
Constructor Detail |
---|
public ImportInterpreter(java.lang.String module, int type, java.util.LinkedList<java.util.HashMap<java.lang.String,Variable>> vat, java.util.LinkedList<java.util.HashMap<java.lang.String,Function>> fat)
Method Detail |
---|
public void run()
Interpreter
doRun()
method and then
removes the front entries of the VAT and FAT queues. If the interpreter class is to be subclassed,
this method should be overridden to provide surrounding functionality to the doRun()
method.
run
in class Interpreter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |