fix token consts
This commit is contained in:
parent
9fad8f790f
commit
70c091d323
5420
php5/php5.go
5420
php5/php5.go
File diff suppressed because it is too large
Load Diff
340
php5/php5.y
340
php5/php5.y
@ -6,10 +6,10 @@ import (
|
||||
// "strconv"
|
||||
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
// "github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
// "github.com/z7zmey/php-parser/node/scalar"
|
||||
// "github.com/z7zmey/php-parser/node/name"
|
||||
// "github.com/z7zmey/php-parser/node/stmt"
|
||||
"github.com/z7zmey/php-parser/node/name"
|
||||
"github.com/z7zmey/php-parser/node/stmt"
|
||||
// "github.com/z7zmey/php-parser/node/expr"
|
||||
// "github.com/z7zmey/php-parser/node/expr/assign_op"
|
||||
// "github.com/z7zmey/php-parser/node/expr/binary_op"
|
||||
@ -19,39 +19,15 @@ import (
|
||||
%}
|
||||
|
||||
%union{
|
||||
node node.Node
|
||||
token token.Token
|
||||
// boolWithToken boolWithToken
|
||||
list []node.Node
|
||||
// foreachVariable foreachVariable
|
||||
// nodesWithEndToken *nodesWithEndToken
|
||||
// str string
|
||||
}
|
||||
|
||||
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
|
||||
%left ','
|
||||
%left T_LOGICAL_OR
|
||||
%left T_LOGICAL_XOR
|
||||
%left T_LOGICAL_AND
|
||||
%right T_PRINT
|
||||
%right T_YIELD
|
||||
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL
|
||||
%left '?' ':'
|
||||
%left T_BOOLEAN_OR
|
||||
%left T_BOOLEAN_AND
|
||||
%left '|'
|
||||
%left '^'
|
||||
%left '&'
|
||||
%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
|
||||
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
|
||||
%left T_SL T_SR
|
||||
%left '+' '-' '.'
|
||||
%left '*' '/' '%'
|
||||
%right '!'
|
||||
%nonassoc T_INSTANCEOF
|
||||
%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
|
||||
%right T_POW
|
||||
%right '['
|
||||
%nonassoc T_NEW T_CLONE
|
||||
%left T_ELSEIF
|
||||
%left T_ELSE
|
||||
%left T_ENDIF
|
||||
%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
|
||||
|
||||
%type <token> $unk
|
||||
%token <token> T_INCLUDE
|
||||
%token <token> T_INCLUDE_ONCE
|
||||
@ -163,6 +139,9 @@ import (
|
||||
%token <token> T_OBJECT_CAST
|
||||
%token <token> T_BOOL_CAST
|
||||
%token <token> T_UNSET_CAST
|
||||
%token <token> T_COALESCE
|
||||
%token <token> T_SPACESHIP
|
||||
%token <token> T_NOELSE
|
||||
%token <token> '"'
|
||||
%token <token> '`'
|
||||
%token <token> '{'
|
||||
@ -182,72 +161,303 @@ import (
|
||||
%token <token> '@'
|
||||
%token <token> '$'
|
||||
|
||||
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
|
||||
%left ','
|
||||
%left T_LOGICAL_OR
|
||||
%left T_LOGICAL_XOR
|
||||
%left T_LOGICAL_AND
|
||||
%right T_PRINT
|
||||
%right T_YIELD
|
||||
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL
|
||||
%left '?' ':'
|
||||
%left T_BOOLEAN_OR
|
||||
%left T_BOOLEAN_AND
|
||||
%left '|'
|
||||
%left '^'
|
||||
%left '&'
|
||||
%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
|
||||
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
|
||||
%left T_SL T_SR
|
||||
%left '+' '-' '.'
|
||||
%left '*' '/' '%'
|
||||
%right '!'
|
||||
%nonassoc T_INSTANCEOF
|
||||
%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
|
||||
%right T_POW
|
||||
%right '['
|
||||
%nonassoc T_NEW T_CLONE
|
||||
%left T_ELSEIF
|
||||
%left T_ELSE
|
||||
%left T_ENDIF
|
||||
%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
|
||||
|
||||
%type <node> top_statement use_declaration use_function_declaration use_const_declaration
|
||||
|
||||
%type <list> top_statement_list namespace_name use_declarations use_function_declarations use_const_declarations
|
||||
|
||||
%%
|
||||
|
||||
start:
|
||||
top_statement_list { }
|
||||
top_statement_list
|
||||
{
|
||||
rootnode = stmt.NewStmtList($1)
|
||||
}
|
||||
;
|
||||
|
||||
top_statement_list:
|
||||
top_statement_list { }
|
||||
| /* empty */
|
||||
top_statement_list top_statement { $$ = append($1, $2) }
|
||||
| /* empty */ { $$ = []node.Node{} }
|
||||
;
|
||||
|
||||
namespace_name:
|
||||
T_STRING { }
|
||||
| namespace_name T_NS_SEPARATOR T_STRING { }
|
||||
T_STRING
|
||||
{
|
||||
namePart := name.NewNamePart($1.Value)
|
||||
positions.AddPosition(namePart, positionBuilder.NewTokenPosition($1))
|
||||
$$ = []node.Node{namePart}
|
||||
comments.AddComments(namePart, $1.Comments())
|
||||
}
|
||||
| namespace_name T_NS_SEPARATOR T_STRING
|
||||
{
|
||||
namePart := name.NewNamePart($3.Value)
|
||||
positions.AddPosition(namePart, positionBuilder.NewTokenPosition($3))
|
||||
$$ = append($1, namePart)
|
||||
comments.AddComments(namePart, $3.Comments())
|
||||
}
|
||||
;
|
||||
|
||||
top_statement:
|
||||
statement { }
|
||||
| function_declaration_statement { }
|
||||
| class_declaration_statement { }
|
||||
| T_HALT_COMPILER '(' ')' ';' { }
|
||||
| T_NAMESPACE namespace_name ';' { }
|
||||
| T_NAMESPACE namespace_name '{' { }
|
||||
top_statement_list '}' { }
|
||||
| T_NAMESPACE '{' { }
|
||||
top_statement_list '}' { }
|
||||
| T_USE use_declarations ';' { }
|
||||
| T_USE T_FUNCTION use_function_declarations ';' { }
|
||||
| T_USE T_CONST use_const_declarations ';' { }
|
||||
| constant_declaration ';' { }
|
||||
statement { $$ = nil }
|
||||
| function_declaration_statement { $$ = nil }
|
||||
| class_declaration_statement { $$ = nil }
|
||||
| T_HALT_COMPILER '(' ')' ';' { $$ = stmt.NewHaltCompiler() }
|
||||
| T_NAMESPACE namespace_name ';'
|
||||
{
|
||||
name := name.NewName($2)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($2))
|
||||
$$ = stmt.NewNamespace(name, nil)
|
||||
positions.AddPosition($$, positionBuilder.NewTokensPosition($1, $3))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($2))
|
||||
comments.AddComments($$, $1.Comments())
|
||||
}
|
||||
| T_NAMESPACE namespace_name '{' top_statement_list '}'
|
||||
{
|
||||
name := name.NewName($2)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($2))
|
||||
$$ = stmt.NewNamespace(name, $4)
|
||||
positions.AddPosition($$, positionBuilder.NewTokensPosition($1, $5))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($2))
|
||||
comments.AddComments($$, $1.Comments())
|
||||
}
|
||||
| T_NAMESPACE '{' top_statement_list '}'
|
||||
{
|
||||
$$ = stmt.NewNamespace(nil, $3)
|
||||
positions.AddPosition($$, positionBuilder.NewTokensPosition($1, $4))
|
||||
comments.AddComments($$, $1.Comments())
|
||||
}
|
||||
| T_USE use_declarations ';'
|
||||
{
|
||||
$$ = stmt.NewUseList(nil, $2)
|
||||
positions.AddPosition($$, positionBuilder.NewTokensPosition($1, $3))
|
||||
comments.AddComments($$, $1.Comments())
|
||||
}
|
||||
| T_USE T_FUNCTION use_function_declarations ';'
|
||||
{
|
||||
useType := node.NewIdentifier($2.Value)
|
||||
positions.AddPosition($$, positionBuilder.NewTokenPosition($2))
|
||||
comments.AddComments($$, $2.Comments())
|
||||
|
||||
$$ = stmt.NewUseList(useType, $3)
|
||||
positions.AddPosition($$, positionBuilder.NewTokensPosition($1, $4))
|
||||
comments.AddComments($$, $1.Comments())
|
||||
}
|
||||
| T_USE T_CONST use_const_declarations ';'
|
||||
{
|
||||
useType := node.NewIdentifier($2.Value)
|
||||
positions.AddPosition($$, positionBuilder.NewTokenPosition($2))
|
||||
comments.AddComments($$, $2.Comments())
|
||||
|
||||
$$ = stmt.NewUseList(useType, $3)
|
||||
positions.AddPosition($$, positionBuilder.NewTokensPosition($1, $4))
|
||||
comments.AddComments($$, $1.Comments())
|
||||
}
|
||||
| constant_declaration ';' { $$ = nil }
|
||||
;
|
||||
|
||||
use_declarations:
|
||||
use_declarations ',' use_declaration
|
||||
| use_declaration
|
||||
use_declarations ',' use_declaration { $$ = append($1, $3) }
|
||||
| use_declaration { $$ = []node.Node{$1} }
|
||||
;
|
||||
|
||||
use_declaration:
|
||||
namespace_name { }
|
||||
| namespace_name T_AS T_STRING { }
|
||||
| T_NS_SEPARATOR namespace_name { }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { }
|
||||
namespace_name
|
||||
{
|
||||
name := name.NewName($1)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($1))
|
||||
$$ = stmt.NewUse(nil, name, nil)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListPosition($1))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($1))
|
||||
comments.AddComments($$, ListGetFirstNodeComments($1))
|
||||
}
|
||||
| namespace_name T_AS T_STRING
|
||||
{
|
||||
name := name.NewName($1)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($1))
|
||||
alias := node.NewIdentifier($3.Value)
|
||||
positions.AddPosition(alias, positionBuilder.NewTokenPosition($3))
|
||||
$$ = stmt.NewUse(nil, name, alias)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListTokenPosition($1, $3))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($1))
|
||||
comments.AddComments(alias, $3.Comments())
|
||||
comments.AddComments($$, ListGetFirstNodeComments($1))
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name
|
||||
{
|
||||
name := name.NewName($2)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($2))
|
||||
$$ = stmt.NewUse(nil, name, nil)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListPosition($2))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($2))
|
||||
comments.AddComments($$, ListGetFirstNodeComments($2))
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING
|
||||
{
|
||||
name := name.NewName($2)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($2))
|
||||
alias := node.NewIdentifier($4.Value)
|
||||
positions.AddPosition(alias, positionBuilder.NewTokenPosition($4))
|
||||
$$ = stmt.NewUse(nil, name, alias)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListTokenPosition($2, $4))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($2))
|
||||
comments.AddComments(alias, $4.Comments())
|
||||
comments.AddComments($$, ListGetFirstNodeComments($2))
|
||||
}
|
||||
;
|
||||
|
||||
use_function_declarations:
|
||||
use_function_declarations ',' use_function_declaration
|
||||
{
|
||||
$$ = append($1, $3)
|
||||
}
|
||||
| use_function_declaration
|
||||
{
|
||||
$$ = []node.Node{$1}
|
||||
}
|
||||
;
|
||||
|
||||
use_function_declaration:
|
||||
namespace_name { }
|
||||
| namespace_name T_AS T_STRING { }
|
||||
| T_NS_SEPARATOR namespace_name { }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { }
|
||||
namespace_name
|
||||
{
|
||||
name := name.NewName($1)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($1))
|
||||
$$ = stmt.NewUse(nil, name, nil)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListPosition($1))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($1))
|
||||
comments.AddComments($$, ListGetFirstNodeComments($1))
|
||||
}
|
||||
| namespace_name T_AS T_STRING
|
||||
{
|
||||
name := name.NewName($1)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($1))
|
||||
alias := node.NewIdentifier($3.Value)
|
||||
positions.AddPosition(alias, positionBuilder.NewTokenPosition($3))
|
||||
$$ = stmt.NewUse(nil, name, alias)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListTokenPosition($1, $3))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($1))
|
||||
comments.AddComments(alias, $3.Comments())
|
||||
comments.AddComments($$, ListGetFirstNodeComments($1))
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name
|
||||
{
|
||||
name := name.NewName($2)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($2))
|
||||
$$ = stmt.NewUse(nil, name, nil)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListPosition($2))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($2))
|
||||
comments.AddComments($$, ListGetFirstNodeComments($2))
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING
|
||||
{
|
||||
name := name.NewName($2)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($2))
|
||||
alias := node.NewIdentifier($4.Value)
|
||||
positions.AddPosition(alias, positionBuilder.NewTokenPosition($4))
|
||||
$$ = stmt.NewUse(nil, name, alias)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListTokenPosition($2, $4))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($2))
|
||||
comments.AddComments(alias, $4.Comments())
|
||||
comments.AddComments($$, ListGetFirstNodeComments($2))
|
||||
}
|
||||
;
|
||||
|
||||
use_const_declarations:
|
||||
use_const_declarations ',' use_const_declaration
|
||||
{
|
||||
$$ = append($1, $3)
|
||||
}
|
||||
| use_const_declaration
|
||||
{
|
||||
$$ = []node.Node{$1}
|
||||
}
|
||||
;
|
||||
|
||||
use_const_declaration:
|
||||
namespace_name { }
|
||||
| namespace_name T_AS T_STRING { }
|
||||
| T_NS_SEPARATOR namespace_name { }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { }
|
||||
namespace_name
|
||||
{
|
||||
name := name.NewName($1)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($1))
|
||||
$$ = stmt.NewUse(nil, name, nil)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListPosition($1))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($1))
|
||||
comments.AddComments($$, ListGetFirstNodeComments($1))
|
||||
}
|
||||
| namespace_name T_AS T_STRING
|
||||
{
|
||||
name := name.NewName($1)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($1))
|
||||
alias := node.NewIdentifier($3.Value)
|
||||
positions.AddPosition(alias, positionBuilder.NewTokenPosition($3))
|
||||
$$ = stmt.NewUse(nil, name, alias)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListTokenPosition($1, $3))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($1))
|
||||
comments.AddComments(alias, $3.Comments())
|
||||
comments.AddComments($$, ListGetFirstNodeComments($1))
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name
|
||||
{
|
||||
name := name.NewName($2)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($2))
|
||||
$$ = stmt.NewUse(nil, name, nil)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListPosition($2))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($2))
|
||||
comments.AddComments($$, ListGetFirstNodeComments($2))
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING
|
||||
{
|
||||
name := name.NewName($2)
|
||||
positions.AddPosition(name, positionBuilder.NewNodeListPosition($2))
|
||||
alias := node.NewIdentifier($4.Value)
|
||||
positions.AddPosition(alias, positionBuilder.NewTokenPosition($4))
|
||||
$$ = stmt.NewUse(nil, name, alias)
|
||||
positions.AddPosition($$, positionBuilder.NewNodeListTokenPosition($2, $4))
|
||||
|
||||
comments.AddComments(name, ListGetFirstNodeComments($2))
|
||||
comments.AddComments(alias, $4.Comments())
|
||||
comments.AddComments($$, ListGetFirstNodeComments($2))
|
||||
}
|
||||
;
|
||||
|
||||
constant_declaration:
|
||||
|
3328
php7/php7.go
3328
php7/php7.go
File diff suppressed because it is too large
Load Diff
71
php7/php7.y
71
php7/php7.y
@ -28,40 +28,6 @@ import (
|
||||
str string
|
||||
}
|
||||
|
||||
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
|
||||
%left ','
|
||||
%left T_LOGICAL_OR
|
||||
%left T_LOGICAL_XOR
|
||||
%left T_LOGICAL_AND
|
||||
%right T_PRINT
|
||||
%right T_YIELD
|
||||
%right T_DOUBLE_ARROW
|
||||
%right T_YIELD_FROM
|
||||
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL
|
||||
%left '?' ':'
|
||||
%right T_COALESCE
|
||||
%left T_BOOLEAN_OR
|
||||
%left T_BOOLEAN_AND
|
||||
%left '|'
|
||||
%left '^'
|
||||
%left '&'
|
||||
%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL T_SPACESHIP
|
||||
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
|
||||
%left T_SL T_SR
|
||||
%left '+' '-' '.'
|
||||
%left '*' '/' '%'
|
||||
%right '!'
|
||||
%nonassoc T_INSTANCEOF
|
||||
%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
|
||||
%right T_POW
|
||||
%right '['
|
||||
%nonassoc T_NEW T_CLONE
|
||||
%left T_NOELSE
|
||||
%left T_ELSEIF
|
||||
%left T_ELSE
|
||||
%left T_ENDIF
|
||||
%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
|
||||
|
||||
%type <token> $unk
|
||||
%token <token> T_INCLUDE
|
||||
%token <token> T_INCLUDE_ONCE
|
||||
@ -173,6 +139,9 @@ import (
|
||||
%token <token> T_OBJECT_CAST
|
||||
%token <token> T_BOOL_CAST
|
||||
%token <token> T_UNSET_CAST
|
||||
%token <token> T_COALESCE
|
||||
%token <token> T_SPACESHIP
|
||||
%token <token> T_NOELSE
|
||||
%token <token> '"'
|
||||
%token <token> '`'
|
||||
%token <token> '{'
|
||||
@ -192,6 +161,40 @@ import (
|
||||
%token <token> '@'
|
||||
%token <token> '$'
|
||||
|
||||
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
|
||||
%left ','
|
||||
%left T_LOGICAL_OR
|
||||
%left T_LOGICAL_XOR
|
||||
%left T_LOGICAL_AND
|
||||
%right T_PRINT
|
||||
%right T_YIELD
|
||||
%right T_DOUBLE_ARROW
|
||||
%right T_YIELD_FROM
|
||||
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL
|
||||
%left '?' ':'
|
||||
%right T_COALESCE
|
||||
%left T_BOOLEAN_OR
|
||||
%left T_BOOLEAN_AND
|
||||
%left '|'
|
||||
%left '^'
|
||||
%left '&'
|
||||
%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL T_SPACESHIP
|
||||
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
|
||||
%left T_SL T_SR
|
||||
%left '+' '-' '.'
|
||||
%left '*' '/' '%'
|
||||
%right '!'
|
||||
%nonassoc T_INSTANCEOF
|
||||
%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
|
||||
%right T_POW
|
||||
%right '['
|
||||
%nonassoc T_NEW T_CLONE
|
||||
%left T_NOELSE
|
||||
%left T_ELSEIF
|
||||
%left T_ELSE
|
||||
%left T_ENDIF
|
||||
%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
|
||||
|
||||
%type <boolWithToken> is_reference is_variadic returns_ref
|
||||
|
||||
%type <token> reserved_non_modifiers
|
||||
|
268
scanner/lexer.go
268
scanner/lexer.go
@ -22,140 +22,140 @@ const (
|
||||
|
||||
const T_INCLUDE = 57346
|
||||
const T_INCLUDE_ONCE = 57347
|
||||
const T_EVAL = 57348
|
||||
const T_REQUIRE = 57349
|
||||
const T_REQUIRE_ONCE = 57350
|
||||
const T_LOGICAL_OR = 57351
|
||||
const T_LOGICAL_XOR = 57352
|
||||
const T_LOGICAL_AND = 57353
|
||||
const T_PRINT = 57354
|
||||
const T_YIELD = 57355
|
||||
const T_DOUBLE_ARROW = 57356
|
||||
const T_YIELD_FROM = 57357
|
||||
const T_PLUS_EQUAL = 57358
|
||||
const T_MINUS_EQUAL = 57359
|
||||
const T_MUL_EQUAL = 57360
|
||||
const T_DIV_EQUAL = 57361
|
||||
const T_CONCAT_EQUAL = 57362
|
||||
const T_MOD_EQUAL = 57363
|
||||
const T_AND_EQUAL = 57364
|
||||
const T_OR_EQUAL = 57365
|
||||
const T_XOR_EQUAL = 57366
|
||||
const T_SL_EQUAL = 57367
|
||||
const T_SR_EQUAL = 57368
|
||||
const T_POW_EQUAL = 57369
|
||||
const T_COALESCE = 57370
|
||||
const T_BOOLEAN_OR = 57371
|
||||
const T_BOOLEAN_AND = 57372
|
||||
const T_IS_EQUAL = 57373
|
||||
const T_IS_NOT_EQUAL = 57374
|
||||
const T_IS_IDENTICAL = 57375
|
||||
const T_IS_NOT_IDENTICAL = 57376
|
||||
const T_SPACESHIP = 57377
|
||||
const T_IS_SMALLER_OR_EQUAL = 57378
|
||||
const T_IS_GREATER_OR_EQUAL = 57379
|
||||
const T_SL = 57380
|
||||
const T_SR = 57381
|
||||
const T_INSTANCEOF = 57382
|
||||
const T_INC = 57383
|
||||
const T_DEC = 57384
|
||||
const T_INT_CAST = 57385
|
||||
const T_DOUBLE_CAST = 57386
|
||||
const T_STRING_CAST = 57387
|
||||
const T_ARRAY_CAST = 57388
|
||||
const T_OBJECT_CAST = 57389
|
||||
const T_BOOL_CAST = 57390
|
||||
const T_UNSET_CAST = 57391
|
||||
const T_POW = 57392
|
||||
const T_NEW = 57393
|
||||
const T_CLONE = 57394
|
||||
const T_NOELSE = 57395
|
||||
const T_ELSEIF = 57396
|
||||
const T_ELSE = 57397
|
||||
const T_ENDIF = 57398
|
||||
const T_STATIC = 57399
|
||||
const T_ABSTRACT = 57400
|
||||
const T_FINAL = 57401
|
||||
const T_PRIVATE = 57402
|
||||
const T_PROTECTED = 57403
|
||||
const T_PUBLIC = 57404
|
||||
const T_EXIT = 57405
|
||||
const T_IF = 57406
|
||||
const T_LNUMBER = 57407
|
||||
const T_DNUMBER = 57408
|
||||
const T_STRING = 57409
|
||||
const T_STRING_VARNAME = 57410
|
||||
const T_VARIABLE = 57411
|
||||
const T_NUM_STRING = 57412
|
||||
const T_INLINE_HTML = 57413
|
||||
const T_CHARACTER = 57414
|
||||
const T_BAD_CHARACTER = 57415
|
||||
const T_ENCAPSED_AND_WHITESPACE = 57416
|
||||
const T_CONSTANT_ENCAPSED_STRING = 57417
|
||||
const T_ECHO = 57418
|
||||
const T_DO = 57419
|
||||
const T_WHILE = 57420
|
||||
const T_ENDWHILE = 57421
|
||||
const T_FOR = 57422
|
||||
const T_ENDFOR = 57423
|
||||
const T_FOREACH = 57424
|
||||
const T_ENDFOREACH = 57425
|
||||
const T_DECLARE = 57426
|
||||
const T_ENDDECLARE = 57427
|
||||
const T_AS = 57428
|
||||
const T_SWITCH = 57429
|
||||
const T_ENDSWITCH = 57430
|
||||
const T_CASE = 57431
|
||||
const T_DEFAULT = 57432
|
||||
const T_BREAK = 57433
|
||||
const T_CONTINUE = 57434
|
||||
const T_GOTO = 57435
|
||||
const T_FUNCTION = 57436
|
||||
const T_CONST = 57437
|
||||
const T_RETURN = 57438
|
||||
const T_TRY = 57439
|
||||
const T_CATCH = 57440
|
||||
const T_FINALLY = 57441
|
||||
const T_THROW = 57442
|
||||
const T_USE = 57443
|
||||
const T_INSTEADOF = 57444
|
||||
const T_GLOBAL = 57445
|
||||
const T_VAR = 57446
|
||||
const T_UNSET = 57447
|
||||
const T_ISSET = 57448
|
||||
const T_EMPTY = 57449
|
||||
const T_HALT_COMPILER = 57450
|
||||
const T_CLASS = 57451
|
||||
const T_TRAIT = 57452
|
||||
const T_INTERFACE = 57453
|
||||
const T_EXTENDS = 57454
|
||||
const T_IMPLEMENTS = 57455
|
||||
const T_OBJECT_OPERATOR = 57456
|
||||
const T_LIST = 57457
|
||||
const T_ARRAY = 57458
|
||||
const T_CALLABLE = 57459
|
||||
const T_CLASS_C = 57460
|
||||
const T_TRAIT_C = 57461
|
||||
const T_METHOD_C = 57462
|
||||
const T_FUNC_C = 57463
|
||||
const T_LINE = 57464
|
||||
const T_FILE = 57465
|
||||
const T_COMMENT = 57466
|
||||
const T_DOC_COMMENT = 57467
|
||||
const T_OPEN_TAG = 57468
|
||||
const T_OPEN_TAG_WITH_ECHO = 57469
|
||||
const T_CLOSE_TAG = 57470
|
||||
const T_WHITESPACE = 57471
|
||||
const T_START_HEREDOC = 57472
|
||||
const T_END_HEREDOC = 57473
|
||||
const T_DOLLAR_OPEN_CURLY_BRACES = 57474
|
||||
const T_CURLY_OPEN = 57475
|
||||
const T_PAAMAYIM_NEKUDOTAYIM = 57476
|
||||
const T_NAMESPACE = 57477
|
||||
const T_NS_C = 57478
|
||||
const T_DIR = 57479
|
||||
const T_NS_SEPARATOR = 57480
|
||||
const T_ELLIPSIS = 57481
|
||||
const T_EXIT = 57348
|
||||
const T_IF = 57349
|
||||
const T_LNUMBER = 57350
|
||||
const T_DNUMBER = 57351
|
||||
const T_STRING = 57352
|
||||
const T_STRING_VARNAME = 57353
|
||||
const T_VARIABLE = 57354
|
||||
const T_NUM_STRING = 57355
|
||||
const T_INLINE_HTML = 57356
|
||||
const T_CHARACTER = 57357
|
||||
const T_BAD_CHARACTER = 57358
|
||||
const T_ENCAPSED_AND_WHITESPACE = 57359
|
||||
const T_CONSTANT_ENCAPSED_STRING = 57360
|
||||
const T_ECHO = 57361
|
||||
const T_DO = 57362
|
||||
const T_WHILE = 57363
|
||||
const T_ENDWHILE = 57364
|
||||
const T_FOR = 57365
|
||||
const T_ENDFOR = 57366
|
||||
const T_FOREACH = 57367
|
||||
const T_ENDFOREACH = 57368
|
||||
const T_DECLARE = 57369
|
||||
const T_ENDDECLARE = 57370
|
||||
const T_AS = 57371
|
||||
const T_SWITCH = 57372
|
||||
const T_ENDSWITCH = 57373
|
||||
const T_CASE = 57374
|
||||
const T_DEFAULT = 57375
|
||||
const T_BREAK = 57376
|
||||
const T_CONTINUE = 57377
|
||||
const T_GOTO = 57378
|
||||
const T_FUNCTION = 57379
|
||||
const T_CONST = 57380
|
||||
const T_RETURN = 57381
|
||||
const T_TRY = 57382
|
||||
const T_CATCH = 57383
|
||||
const T_FINALLY = 57384
|
||||
const T_THROW = 57385
|
||||
const T_USE = 57386
|
||||
const T_INSTEADOF = 57387
|
||||
const T_GLOBAL = 57388
|
||||
const T_VAR = 57389
|
||||
const T_UNSET = 57390
|
||||
const T_ISSET = 57391
|
||||
const T_EMPTY = 57392
|
||||
const T_HALT_COMPILER = 57393
|
||||
const T_CLASS = 57394
|
||||
const T_TRAIT = 57395
|
||||
const T_INTERFACE = 57396
|
||||
const T_EXTENDS = 57397
|
||||
const T_IMPLEMENTS = 57398
|
||||
const T_OBJECT_OPERATOR = 57399
|
||||
const T_DOUBLE_ARROW = 57400
|
||||
const T_LIST = 57401
|
||||
const T_ARRAY = 57402
|
||||
const T_CALLABLE = 57403
|
||||
const T_CLASS_C = 57404
|
||||
const T_TRAIT_C = 57405
|
||||
const T_METHOD_C = 57406
|
||||
const T_FUNC_C = 57407
|
||||
const T_LINE = 57408
|
||||
const T_FILE = 57409
|
||||
const T_COMMENT = 57410
|
||||
const T_DOC_COMMENT = 57411
|
||||
const T_OPEN_TAG = 57412
|
||||
const T_OPEN_TAG_WITH_ECHO = 57413
|
||||
const T_CLOSE_TAG = 57414
|
||||
const T_WHITESPACE = 57415
|
||||
const T_START_HEREDOC = 57416
|
||||
const T_END_HEREDOC = 57417
|
||||
const T_DOLLAR_OPEN_CURLY_BRACES = 57418
|
||||
const T_CURLY_OPEN = 57419
|
||||
const T_PAAMAYIM_NEKUDOTAYIM = 57420
|
||||
const T_NAMESPACE = 57421
|
||||
const T_NS_C = 57422
|
||||
const T_DIR = 57423
|
||||
const T_NS_SEPARATOR = 57424
|
||||
const T_ELLIPSIS = 57425
|
||||
const T_EVAL = 57426
|
||||
const T_REQUIRE = 57427
|
||||
const T_REQUIRE_ONCE = 57428
|
||||
const T_LOGICAL_OR = 57429
|
||||
const T_LOGICAL_XOR = 57430
|
||||
const T_LOGICAL_AND = 57431
|
||||
const T_INSTANCEOF = 57432
|
||||
const T_NEW = 57433
|
||||
const T_CLONE = 57434
|
||||
const T_ELSEIF = 57435
|
||||
const T_ELSE = 57436
|
||||
const T_ENDIF = 57437
|
||||
const T_PRINT = 57438
|
||||
const T_YIELD = 57439
|
||||
const T_STATIC = 57440
|
||||
const T_ABSTRACT = 57441
|
||||
const T_FINAL = 57442
|
||||
const T_PRIVATE = 57443
|
||||
const T_PROTECTED = 57444
|
||||
const T_PUBLIC = 57445
|
||||
const T_INC = 57446
|
||||
const T_DEC = 57447
|
||||
const T_YIELD_FROM = 57448
|
||||
const T_INT_CAST = 57449
|
||||
const T_DOUBLE_CAST = 57450
|
||||
const T_STRING_CAST = 57451
|
||||
const T_ARRAY_CAST = 57452
|
||||
const T_OBJECT_CAST = 57453
|
||||
const T_BOOL_CAST = 57454
|
||||
const T_UNSET_CAST = 57455
|
||||
const T_COALESCE = 57456
|
||||
const T_SPACESHIP = 57457
|
||||
const T_NOELSE = 57458
|
||||
const T_PLUS_EQUAL = 57459
|
||||
const T_MINUS_EQUAL = 57460
|
||||
const T_MUL_EQUAL = 57461
|
||||
const T_DIV_EQUAL = 57462
|
||||
const T_CONCAT_EQUAL = 57463
|
||||
const T_MOD_EQUAL = 57464
|
||||
const T_AND_EQUAL = 57465
|
||||
const T_OR_EQUAL = 57466
|
||||
const T_XOR_EQUAL = 57467
|
||||
const T_SL_EQUAL = 57468
|
||||
const T_SR_EQUAL = 57469
|
||||
const T_POW_EQUAL = 57470
|
||||
const T_BOOLEAN_OR = 57471
|
||||
const T_BOOLEAN_AND = 57472
|
||||
const T_IS_EQUAL = 57473
|
||||
const T_IS_NOT_EQUAL = 57474
|
||||
const T_IS_IDENTICAL = 57475
|
||||
const T_IS_NOT_IDENTICAL = 57476
|
||||
const T_IS_SMALLER_OR_EQUAL = 57477
|
||||
const T_IS_GREATER_OR_EQUAL = 57478
|
||||
const T_SL = 57479
|
||||
const T_SR = 57480
|
||||
const T_POW = 57481
|
||||
|
||||
type Lval interface {
|
||||
Token(tkn t.Token)
|
||||
|
Loading…
Reference in New Issue
Block a user