Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cbaa789
add tests for semi reserved words and remove obsolete ones
marcioAlmada Mar 7, 2015
93a969f
implement context sensitive language with lexical feedback
marcioAlmada Mar 9, 2015
493cc9a
simplify implementation per Dmitry suggestion.
marcioAlmada Mar 12, 2015
1a859db
use lowercase for nonterminal symbols, as suggested by Laurence
marcioAlmada Mar 21, 2015
557308b
fix indentation
marcioAlmada Mar 21, 2015
982fde4
add support API for token stream post processing
marcioAlmada Mar 21, 2015
3e93aec
fix test descriptions
marcioAlmada Mar 21, 2015
5728276
t_look should return -1 on miss, as 0 is a valid index
marcioAlmada Mar 22, 2015
ad82fc0
fix some class name as scalar tests
marcioAlmada Mar 22, 2015
ec16a1e
reverts ad-hoc "fix class name as scalar tests" and puts class_name_s…
marcioAlmada Mar 23, 2015
fe1ca5b
t_parse implementation
marcioAlmada Mar 24, 2015
3dba459
simplify
marcioAlmada Mar 24, 2015
45182e9
code style fix
marcioAlmada Mar 24, 2015
97f9ddb
remove c++ comments - tsc tsc
marcioAlmada Mar 24, 2015
6facceb
cleanup, apply some OO
marcioAlmada Mar 24, 2015
7632c44
add more detailed ext tokenizer tests
marcioAlmada Mar 26, 2015
c4752da
simplify t_parse
marcioAlmada Mar 26, 2015
f84b5d0
add more ext tokenizer tests
marcioAlmada Mar 26, 2015
4de39b7
oops, t_parse call should be out of the loop!
marcioAlmada Mar 27, 2015
608fa98
simplify t_parse a bit more
marcioAlmada Mar 27, 2015
2cdba15
deduplicate code
marcioAlmada Mar 27, 2015
09122cd
adds --SKIPIF-- section to new tests
marcioAlmada Mar 27, 2015
e1e7989
remove obsolete compile time changes
marcioAlmada Mar 28, 2015
c89eee8
add t_destroy to t_* API
marcioAlmada Mar 29, 2015
66c17c0
update tests with `empty` as semi-reserved word
marcioAlmada Apr 1, 2015
be53e24
fix typo
marcioAlmada Apr 1, 2015
abc44c2
add test with property declarations and expr using member access
marcioAlmada Apr 1, 2015
90df11e
reorganize ts_stream post processing into smaller reusable chunks
marcioAlmada Apr 1, 2015
304da10
add test for nested anonymous classes tokenization
marcioAlmada Apr 2, 2015
a0ef2bd
add anonymous class support
marcioAlmada Apr 2, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Zend/tests/grammar/regression_001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--TEST--
Test to check static method calls syntax regression
--FILE--
<?php

class Foo {
public static function function(){ echo __METHOD__, PHP_EOL; }
}

Foo::function();

Foo::
function();

Foo::
function();


Foo::
function(

);

echo "\nDone\n";

--EXPECTF--

Foo::function
Foo::function
Foo::function
Foo::function

Done
22 changes: 22 additions & 0 deletions Zend/tests/grammar/regression_002.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Test to ensure ::class still works
--FILE--
<?php

class Foo {}

var_dump(Foo::class);

var_dump(Foo:: class);

var_dump(Foo:: CLASS);

var_dump(Foo::

CLASS);

--EXPECTF--
string(3) "Foo"
string(3) "Foo"
string(3) "Foo"
string(3) "Foo"
12 changes: 12 additions & 0 deletions Zend/tests/grammar/regression_003.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
Test to ensure ::class is still reserved in obj scope
--FILE--
<?php

class Obj
{
const CLASS = 'class';
}

--EXPECTF--
Parse error: syntax error, unexpected 'CLASS' (T_CLASS) in %s on line 5
15 changes: 15 additions & 0 deletions Zend/tests/grammar/regression_004.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--TEST--
Test possible function naming regression on procedural scope
--FILE--
<?php

class Obj
{
function echo(){} // valid
function return(){} // valid
}

function echo(){} // not valid

--EXPECTF--
Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting identifier (T_STRING) or '(' in %s on line 9
14 changes: 14 additions & 0 deletions Zend/tests/grammar/regression_005.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
Test possible constant naming regression on procedural scope
--FILE--
<?php

class Obj
{
const return = 'yep';
}

const return = 'nope';

--EXPECTF--
Parse error: syntax error, unexpected 'return' (T_RETURN), expecting identifier (T_STRING) in %s on line 8
30 changes: 30 additions & 0 deletions Zend/tests/grammar/regression_006.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--TEST--
Test to ensure const list syntax declaration works
--FILE--
<?php

class Obj
{
const DECLARE = 'declare',
RETURN = 'return',
FUNCTION = 'function',
USE = 'use';
}

echo Obj::DECLARE, PHP_EOL;
echo Obj::RETURN, PHP_EOL;
echo Obj::FUNCTION, PHP_EOL;
echo Obj::USE, PHP_EOL;
echo Obj::

USE, PHP_EOL;
echo "\nDone\n";

--EXPECTF--
declare
return
function
use
use

Done
44 changes: 44 additions & 0 deletions Zend/tests/grammar/regression_007.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
--TEST--
Test to ensure semi reserved words allow deference
--FILE--
<?php

class Foo {
const use = 'yay';

public static function new() {
echo __METHOD__, PHP_EOL;
return new static();
}

public function self() {
echo __METHOD__, PHP_EOL;
return $this;
}
}

Foo::new()::new()::new();

var_dump(
(new Foo)->self()::new()->self()->self()::use
);

Foo::{'new'}();

var_dump(Foo::use);

echo "\nDone\n";

--EXPECTF--
Foo::new
Foo::new
Foo::new
Foo::self
Foo::new
Foo::self
Foo::self
string(3) "yay"
Foo::new
string(3) "yay"

Done
21 changes: 21 additions & 0 deletions Zend/tests/grammar/regression_008.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
Test to check regressions on string interpolation with class members access
--FILE--
<?php

class Friday {
public $require = "fun";
}

$friday = new Friday;

echo "$friday->require ($friday->require) {$friday->require}", PHP_EOL;

echo "\nDone\n";


--EXPECTF--

fun (fun) fun

Done
18 changes: 18 additions & 0 deletions Zend/tests/grammar/regression_009.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
Test to check regressions on use statements and lexer state
--FILE--
<?php

use A\B\C\D;

class Foo
{
private static $foo;

}

echo PHP_EOL, "Done", PHP_EOL;

--EXPECTF--

Done
14 changes: 14 additions & 0 deletions Zend/tests/grammar/regression_010.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
Test to check regressions on T_IMPLEMENTS followed by a T_NS_SEPARATOR
--FILE--
<?php

interface A{}

class B implements\A {}

echo "Done", PHP_EOL;

--EXPECTF--

Done
18 changes: 18 additions & 0 deletions Zend/tests/grammar/regression_011.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
Testing instantiation using namespace:: prefix
--FILE--
<?php

namespace foo;

class bar {
}

class_alias('foo\bar', 'foo\baz');

var_dump(new namespace\baz);

?>
--EXPECTF--
object(foo\bar)#%d (0) {
}
13 changes: 13 additions & 0 deletions Zend/tests/grammar/regression_012.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Testing for regression on const list syntax and arrays
--FILE--
<?php

class A {
const A = [1, FOREACH];
}

?>
--EXPECTF--

Parse error: syntax error, unexpected 'FOREACH' (T_FOREACH), expecting ']' in %s on line %d
13 changes: 13 additions & 0 deletions Zend/tests/grammar/regression_013.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Testing for regression with encapsed variables in class declaration context
--FILE--
<?php

class A { function foo() { "{${$a}}"; } function list() {} }

echo "Done", PHP_EOL;

?>
--EXPECTF--

Done
Loading