Documentation
¶
Overview ¶
Package parser turns PHP source (the limited subset described in the project README) into the shared model AST consumed by the runner.
Scope of v0: the parser targets the README's "desired syntax" subset — php tags, $-variables, echo, assignment, if/elseif/else, foreach, for, while, function and class declarations, the `function Class::method()` form, method and property access via both `->` and `.`, array/new expressions, and the usual operators. It intentionally does not implement the full PHP grammar (see the README "omissions" list: namespaces, inheritance, interfaces, etc.).
Index ¶
Constants ¶
const ( T_INLINE_HTML = 256 + iota T_OPEN_TAG T_CLOSE_TAG T_WHITESPACE T_COMMENT T_VARIABLE T_STRING // bare identifier / constant name / function name T_LNUMBER T_DNUMBER T_CONSTANT_ENCAPSED_STRING T_OBJECT_OPERATOR // -> T_DOUBLE_ARROW // => T_DOUBLE_COLON // :: (a.k.a. T_PAAMAYIM_NEKUDOTAYIM) T_IS_EQUAL // == T_IS_NOT_EQUAL // != T_IS_IDENTICAL // === T_IS_NOT_IDENTICAL T_IS_SMALLER_OR_EQUAL T_IS_GREATER_OR_EQUAL T_BOOLEAN_AND // && T_BOOLEAN_OR // || T_INC // ++ T_DEC // -- T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_MOD_EQUAL T_CONCAT_EQUAL // .= // keywords T_IF T_ELSE T_ELSEIF T_FOREACH T_FOR T_WHILE T_AS T_FUNCTION T_RETURN T_NEW T_ECHO T_ARRAY T_CLASS T_VAR T_INCLUDE T_INCLUDE_ONCE T_REQUIRE T_REQUIRE_ONCE )
T_* token identifiers. PHP's concrete integer values are version-specific; only self-consistency matters here because callers use token_name() and the named constants. We start at 256 like PHP (single-char tokens are < 256).
Variables ¶
This section is empty.
Functions ¶
func TokenGetAll ¶
TokenGetAll tokenizes src the way PHP's token_get_all does, returning a *model.Array of single-char strings and [id, text, line] arrays.
Types ¶
This section is empty.