diff --git a/src/main/php/lang/ast/nodes/Start.class.php b/src/main/php/lang/ast/nodes/Start.class.php deleted file mode 100755 index a2b9a12..0000000 --- a/src/main/php/lang/ast/nodes/Start.class.php +++ /dev/null @@ -1,13 +0,0 @@ -syntax= $syntax; - $this->line= $line; - } -} \ No newline at end of file diff --git a/src/main/php/lang/ast/syntax/PHP.class.php b/src/main/php/lang/ast/syntax/PHP.class.php index fd02b16..6f1c2f8 100755 --- a/src/main/php/lang/ast/syntax/PHP.class.php +++ b/src/main/php/lang/ast/syntax/PHP.class.php @@ -37,7 +37,6 @@ ReturnStatement, ScopeExpression, Signature, - Start, StaticLocals, SwitchStatement, TernaryExpression, @@ -520,8 +519,12 @@ public function __construct() { $this->stmt('token->value; + if ('php' !== $syntax) { + $parse->raise('Unexpected syntax '.$syntax.', expecting php', $token->value); + } + $parse->forward(); - return new Start($syntax, $token->line); + return $this->statement($parse); }); $this->stmt('{', function($parse, $token) { diff --git a/src/test/php/lang/ast/unittest/parse/StartTokensTest.class.php b/src/test/php/lang/ast/unittest/parse/StartTokensTest.class.php index 82fa071..1db55e7 100755 --- a/src/test/php/lang/ast/unittest/parse/StartTokensTest.class.php +++ b/src/test/php/lang/ast/unittest/parse/StartTokensTest.class.php @@ -1,6 +1,7 @@ assertParsed( - [new Start('php', self::LINE), new NamespaceDeclaration('test', self::LINE)], + [new NamespaceDeclaration('test', self::LINE)], 'assertParsed( - [new Start('hh', self::LINE), new NamespaceDeclaration('test', self::LINE)], - 'parse('tree(); } } \ No newline at end of file