Class CompilerEnvironment()->PikeCompiler

Inheritance graph
::this_program predef::CompilerEnvironment.PikeCompiler
Description

The Pike compiler.

An object of this class compiles a single string of Pike code.


Variable handler
Variable compat_handler

object CompilerEnvironment.PikeCompiler.handler
object CompilerEnvironment.PikeCompiler.compat_handler


Variable current_file

string CompilerEnvironment.PikeCompiler.current_file

Description

The name of the file currently being compiled (during an active compilation).


Variable current_line

int CompilerEnvironment.PikeCompiler.current_line

Description

The current line number (during an active compilation).


Inherit this_program

inherit ::this_program : this_program


Method create

CompilerEnvironment.PikeCompiler CompilerEnvironment.PikeCompiler(string|void source, CompilationHandler|void handler, int|void major, int|void minor, program|void target, object|void placeholder)

Description

Create a PikeCompiler object for a source string.

This function takes a piece of Pike code as a string and initializes a compiler object accordingly.

Parameter source

Source code to compile.

Parameter handler

The optional argument handler is used to specify an alternative error handler. If it is not specified the current master object at compile time will be used.

Parameter major
Parameter minor

The optional arguments major and minor are used to tell the compiler to attempt to be compatible with Pike major.minor.

Parameter target

__empty_program() program to fill in. The virgin program returned by __empty_program() will be modified and returned by compile() on success.

Parameter placeholder

__null_program() placeholder object to fill in. The object will be modified into an instance of the resulting program on successfull compile. Note that lfun::create() in the program will be called without any arguments.

Note

Note that source must contain the complete source for a program. It is not possible to compile a single expression or statement.

Also note that no preprocessing is performed. To preprocess the program you can use compile_string() or call the preprocessor manually by calling cpp().

Note

Note that all references to target and placeholder should removed if compile() failes. On failure the placeholder object will be destructed.

See also

compile_string(), compile_file(), cpp(), master(), CompilationHandler