module languages/php/version5/literals/VariableLiterals
exports

  sorts FunctionCall ObjectFunctionCall ObjectProperty ObjectCVar CallParam
  context-free syntax
  %% Results from a function can be used as an object in version 5.
  %% Prefers are needed to prevent ambiguity in foo()->foo()->foo()
   FunctionCall       "->" ObjectProperty  -> ObjectCVar {cons("ObjectAccess")}
   ObjectFunctionCall "->" ObjectProperty  -> ObjectCVar {cons("ObjectAccess"),prefer}

   ObjectFunctionCall "->" ObjectProperty "(" {CallParam ","}* ")" -> ObjectFunctionCall {cons("FunctionCall"),prefer}
   FunctionCall       "->" ObjectProperty "(" {CallParam ","}* ")" -> ObjectFunctionCall {cons("FunctionCall")}