Skip to content

Commit

Permalink
Merge pull request #4 from rom1504/fix_const
Browse files Browse the repository at this point in the history
fix const with an expression
  • Loading branch information
ichiriac committed Oct 4, 2015
2 parents 48f65fb + db6396d commit 6012a0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parser/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ module.exports = function(api, tokens, EOF) {
/**
* Reads a constant declaration
* <ebnf>
* constant_declaration ::= T_STRING '=' scalar
* constant_declaration ::= T_STRING '=' expr
* </ebnf>
*/
,read_constant_declaration: function() {
Expand All @@ -169,7 +169,7 @@ module.exports = function(api, tokens, EOF) {
.next()
.expect('=')
.next()
.read_scalar()
.read_expr()
;
return [name, value];
}
Expand Down
6 changes: 6 additions & 0 deletions test/parser/class.parser
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ interface a1 extends i1, i2 {
public function a1();
protected function a1();
}
--PASS--
class a {
const e=5;
const f=6;
const A=(self::e | self::f);
}
--FAIL--
class a1 {
echo 123;
Expand Down

0 comments on commit 6012a0d

Please sign in to comment.