module php/pp/common/expressions

rules
// All common scalar from language parser
  php-to-box:
    LNumber(number) -> H([], [ number ])
H [ ~number ]
php-to-box: DNumber(s) -> H([], [ S(s) ])
H [ s ]
php-to-box: ConstantEncapsedString(string) -> H([], [ string ])
H [ ~string ]
php-to-box: MagicConstant(s) -> H([], [ S(s) ])
H [ s ]
rules // Normal function call and function calls on static objects php-to-box: FunctionCall(name,exprs) -> H([SOpt(HS(), "0")], [ name | [ args ] ])
H hs=0 [ ~name ~args]
where <list-to-args> exprs => args php-to-box: StaticFunctionCall(class,func,exprs) -> H([SOpt(HS(), "0")], [ class | [ S("::") | [ func | [ args ] ] ] ])
H hs=0 [ ~class "::" ~func ~args]
where <list-to-args> exprs => args php-to-box: FunctionName(s) -> H([], [ S(s) ])
H [ s ]
rules // List php-to-box: List(exprs) -> H([SOpt(HS(), "0")], [ FBOX(KW(), S("list")) | [ args ] ])
H hs=0 [ KW["list"] ~args ]
where <list-to-args> exprs => args php-to-box: List(Some(var))->
H([SOpt(HS(), "0")], [ FBOX(KW(), S("list")) | [ S("(") | [ var | [ S(")") ] ] ] ])
H hs=0 [ KW["list"] "(" ~var ")" ]
php-to-box: List(None())-> H([SOpt(HS(), "0")], [ FBOX(KW(), S("list")) | [ S("()") ] ])
H hs=0 [ KW["list"] "()" ]
php-to-box: ListAssign(l,e) -> H([SOpt(HS(), "1")], [ l | [ S("=") | [ e ] ] ])
H hs=1 [ ~l "=" ~e ]
rules // Reference assign php-to-box: ReferenceAssign(e1,e2) -> H([SOpt(HS(), "1")], [ e1 | [ S("=&") | [ e2 ] ] ])
H hs=1 [ ~e1 "=&" ~e2 ]
rules // Exit and Die php-to-box: Exit() -> H([SOpt(HS(), "0")], [ FBOX(KW(), S("exit")) | [ S("()") ] ])
H hs=0 [ KW["exit"] "()" ]
php-to-box: Exit(e) ->
H([SOpt(HS(), "0")], [ FBOX(KW(), S("exit")) | [ S("(") | [ e | [ S(")") ] ] ] ])
H hs=0 [ KW["exit"]"(" ~e ")" ]
php-to-box: Die() -> H([SOpt(HS(), "0")], [ FBOX(KW(), S("die")) | [ S("()") ] ])
H hs=0 [ KW["die"] "()" ]
php-to-box: Die(e) -> H([SOpt(HS(), "0")], [ FBOX(KW(), S("die")) | [ S("(") | [ e | [ S(")") ] ] ] ])
H hs=0 [ KW["die"]"(" ~e ")" ]
rules // Error supressing php-to-box: ErrorFree(e) -> H([SOpt(HS(), "0")], [ FBOX(KW(), S("@")) | [ e ] ])
H hs=0 [ KW["@"] ~e ]
rules // Array php-to-box: Array(exprs) -> H([SOpt(HS(), "0")], [ FBOX(KW(), S("array")) | [ args ] ])
H hs=0 [ KW["array"] ~args ]
where <list-to-args> exprs => args php-to-box: Pair(k,v) -> H([SOpt(HS(), "1")], [ k | [ v ] ])
H hs=1 [ ~k ~v ]
where not(!k => None()) php-to-box: Pair(None(),v) -> H([], [ v ])
H [ ~v ]
//Key is also defined for foreach php-to-box: Value(e) -> H([], [ e ])
H [ ~e ]
php-to-box: RefValue(e) -> H([SOpt(HS(), "0")], [ S("&") | [ e ] ])
H hs=0 [ "&" ~e ]
rules // Print php-to-box: Print(e) -> H([SOpt(HS(), "1")], [ FBOX(KW(), S("print")) | [ e ] ])
H hs=1 [ KW["print"] ~e ]
rules // Internal functions php-to-box: InternalFunction(e) -> e php-to-box: Isset(exprs) -> H([SOpt(HS(), "0")], [ FBOX(KW(), S("isset")) | [ args ] ])
H hs=0 [ KW["isset"] ~args ]
where <list-to-args> exprs => args php-to-box: Empty(e) ->
H([SOpt(HS(), "0")], [ FBOX(KW(), S("empty")) | [ S("(") | [ e | [ S(")") ] ] ] ])
H hs=0 [ KW["empty"] "(" ~e ")" ]
php-to-box: Eval(e) ->
H([SOpt(HS(), "0")], [ FBOX(KW(), S("eval")) | [ S("(") | [ e | [ S(")") ] ] ] ])
H hs=0 [ KW["eval"] "(" ~e ")" ]
// The "(" and ")" are not neccesary, but it is clearer php-to-box: Include(e) -> H([SOpt(HS(), "1")], [ FBOX(KW(), S("include")) | [ e ] ])
H hs=1 [ KW["include"] ~e ]
php-to-box: IncludeOnce(e) -> H([SOpt(HS(), "1")], [ FBOX(KW(), S("include_once")) | [ e ] ])
H hs=1 [ KW["include_once"] ~e ]
php-to-box: Require(e) -> H([SOpt(HS(), "1")], [ FBOX(KW(), S("require")) | [ e ] ])
H hs=1 [ KW["require"] ~e ]
php-to-box: RequireOnce(e) -> H([SOpt(HS(), "1")], [ FBOX(KW(), S("require_once")) | [ e ] ])
H hs=1 [ KW["require_once"] ~e ]
rules // Shell command php-to-box: ShellCommand(parts) -> H([SOpt(HS(), "0")], [ S("`") | [ str | [ S("`") ] ] ])
H hs=0 [ "`" ~str "`" ]
where <lit-of-esc-to-string> parts => str