php-parser/test/code/expr/fetchAndCall/simple.test
nikic db3181aff1 More test coverage and doc string parsing fixes
The parser didn't account for the additional newline after the content of doc strings, which is left there by the tokenizer for some reason. Additoinally esacape sequences were parsed in nowdoc strings.

Additionally this contains some minor changes to the grammar: Some _list nonterminals were refactored to have the possible single elements in a reparate rule and only assemble those single elements. (This reduces duplication and gives better assignment of line number context.)
2011-12-04 16:52:43 +01:00

74 lines
1.1 KiB
Plaintext

Simple fetches (array, property, constant) and calls
-----
<?php
// simple calls
$a->b();
// simple properties
$a->b;
A::$b;
// simple array access
$a[$b];
$a{$b};
// simple constants
A;
A::B;
-----
array(
0: Expr_MethodCall(
var: Expr_Variable(
name: a
)
name: b
args: array(
)
)
1: Expr_PropertyFetch(
var: Expr_Variable(
name: a
)
name: b
)
2: Expr_StaticPropertyFetch(
class: Name(
parts: array(
0: A
)
)
name: b
)
3: Expr_ArrayDimFetch(
var: Expr_Variable(
name: a
)
dim: Expr_Variable(
name: b
)
)
4: Expr_ArrayDimFetch(
var: Expr_Variable(
name: a
)
dim: Expr_Variable(
name: b
)
)
5: Expr_ConstFetch(
name: Name(
parts: array(
0: A
)
)
)
6: Expr_ClassConstFetch(
class: Name(
parts: array(
0: A
)
)
name: B
)
)