ESCCompiler
Extends: Resource
Description
Compiler for the ASHES language.
Constants
COMMAND_DIRECTORIES
const COMMAND_DIRECTORIES = "escoria/main/command_directories"
This must match ESCProjectSettingsManager.COMMAND_DIRECTORIES. We do not reference it directly in order to avoid circular dependencies.
Members
had_error
var had_error: bool
Whether an error has been encountered during the compilation process.
Methods
load_commands
func load_commands() -> Array
Static method to pre-load all ASHES commands from ESCProjectSettingsManager.COMMAND_DIRECTORIES. All commands must extend ESCBaseCommand.
Parameters
None.
Returns
Returns a Array value. (Array)
load_globals
func load_globals() -> Dictionary
Static method to load all Escoria reserved objects and reserved globals.
Parameters
None.
Returns
Returns a Dictionary value. (Dictionary)
load_esc_file
func load_esc_file(path: String, associated_global_id: String) -> ESCScript
Load an ESC file from a file resource. We also accept an optional global ID of whatever object is associated with the ESC file. Note that we don’t need to do the same for a room-attached script since the current room’s global_id is always available as an Escoria global.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
path |
|
the path of the script file to load |
yes |
associated_global_id |
|
global ID of the object/room associated with the script file, if any (may be empty) |
no |
Returns
Returns a ESCScript value. (ESCScript)
compile
func compile(script: String, _path: String) -> ESCScript
Compiles the passed-in script. TODO: path is extraneous and left in for legacy purposes; at some point, this will be removed which will require updating other methods that reference this one to ensure they don’t pass in a second argument.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
script |
|
A |
yes |
path |
|
NOT USED. |
no |
Returns
Returns a ESCScript value. (ESCScript)