NAME

VERSION

This document describes version 0.23 of module Language::Expr::Compiler::Base (in distribution Language-Expr), released on 2014-05-01.

ATTRIBUTES (MANUAL)

markers => ARRAYREF

Used to mark compile output string with various unique strings, and later on revisit these markers and substitute for other, final values. This technique is kind of a hack, used for subexpression, inserting PHP use() statement (because they must be processed outward to inward), etc.

func_mapping => HASHREF

Map Expr function to target language's function/method/property.

ATTRIBUTES

hook_var

Can be set to a coderef that will be called during parsing whenever variable is encountered. The coderef is called with variable name as argument, and expected to return target language code to handle the variable. By default, if this attribute is not set, variable in expression is returned as is (e.g. '$foo' becomes '$foo' in Perl), which means some will result in error (e.g. '${name that contains some symbols that makes it invalid Perl}').

If the coderef returns undef, the default behaviour is used.

Note that due to current limitation of Perl regex and/or Regexp::Grammars, you cannot use any regex in your hook_var.

hook_func

Can be set to a coderef that will be called during parsing whenever a function call is encountered. The coderef is called as its arguments function name and list of arguments and expected to return target language code to handle the function call. By default, if this attribute is not set, variable in expression is returned as is (e.g. 'foo(1, 2, 3)' becomes 'foo(1, 2, 3)' in Perl).

If the coderef returns undef, the default behaviour is used.

Note that due to current limitation of Perl regex and/or Regexp::Grammars, you cannot use any regex in your hook_var.

METHODS

new_marker(TYPE[, DATA]) => UUID

Create a new marker. Return a unique ID to be placed in compiled output.