new MetaScript(source, filename)
Constructs a new MetaScript instance.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
source |
string | Source to compile |
|
filename |
string |
<optional> |
Source file name if known, defaults to |
Members
-
<static, constant> IS_NODE :boolean
-
Whether running under node.js or not.
-
filename :string
-
Original source file name.
-
program :string
-
The compiled meta program's source.
-
source :string
-
Original source.
Methods
-
<static> compile(source) → {string}
-
Compiles the specified source to a meta program and returns its source.
Parameters:
Name Type Description source
string Source
Returns:
Meta program
- Type
- string
-
<static> transform(source, filename, scope, basedir) → {string}
-
Compiles the source to a meta program and transforms it using the specified scope. On node.js, this will wrap the entire process in a new VM context.
Parameters:
Name Type Argument Description source
string Source
filename
string <optional>
Source file name
scope
Object Scope
basedir
string <optional>
Base directory for includes, defaults to
.
on node and/
in the browserReturns:
Transformed source
- Type
- string
-
transform(scope, basedir) → {string}
-
Transforms the meta program.
Parameters:
Name Type Argument Description scope
Object Scope
basedir
string <optional>
Base directory for includes, defaults to
.
on node and/
in the browserReturns:
Transformed source
- Type
- string