File tree Expand file tree Collapse file tree 4 files changed +49
-0
lines changed Expand file tree Collapse file tree 4 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -474,6 +474,7 @@ lexer.prototype.next = function () {
474
474
475
475
// extends the lexer with states
476
476
[
477
+ require ( "./lexer/attribute.js" ) ,
477
478
require ( "./lexer/comments.js" ) ,
478
479
require ( "./lexer/initial.js" ) ,
479
480
require ( "./lexer/numbers.js" ) ,
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict" ;
7
+
8
+ module . exports = {
9
+ matchST_ATTRIBUTE : function ( ) {
10
+ const ch = this . input ( ) ;
11
+ // console.log("Char:", ch);
12
+ if ( this . is_LABEL_START ( ) ) {
13
+ this . consume_LABEL ( ) ;
14
+ return this . tok . T_STRING ;
15
+ }
16
+
17
+ if ( ch === "]" ) {
18
+ this . popState ( ) ;
19
+ return "]" ;
20
+ } else if ( ch === "(" ) {
21
+ return this . consume_TOKEN ( ) ;
22
+ // return "(";
23
+ } else if ( ch === ":" ) {
24
+ return this . consume_TOKEN ( ) ;
25
+ } else if ( ch === ")" ) {
26
+ return this . consume_TOKEN ( ) ;
27
+ } else if ( ch === "," ) {
28
+ return ch ;
29
+ } else if ( ch === '"' ) {
30
+ return this . ST_DOUBLE_QUOTES ( ) ;
31
+ } else if ( ch === "'" ) {
32
+ return this . T_CONSTANT_ENCAPSED_STRING ( ) ;
33
+ } else if ( this . is_NUM ( ) ) {
34
+ return this . consume_NUM ( ) ;
35
+ } else if ( this . is_TABSPACE ( ) ) {
36
+ return this . consume_TABSPACE ( ) ;
37
+ }
38
+
39
+ throw new Error ( "what now?" ) ;
40
+ } ,
41
+ } ;
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ module.exports = {
16
16
case "\r\n" :
17
17
return this . T_WHITESPACE ( ) ;
18
18
case "#" :
19
+ if ( this . _input [ this . offset ] === "[" ) {
20
+ this . input ( ) ;
21
+ this . begin ( "ST_ATTRIBUTE" ) ;
22
+ return this . tok . T_ATTRIBUTE ;
23
+ }
19
24
return this . T_COMMENT ( ) ;
20
25
case "/" :
21
26
if ( this . _input [ this . offset ] === "/" ) {
Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ module.exports = {
148
148
235 : "T_FN" ,
149
149
236 : "T_NULLSAFE_OBJECT_OPERATOR" ,
150
150
237 : "T_MATCH" ,
151
+ 238 : "T_ATTRIBUTE" ,
151
152
} ,
152
153
names : {
153
154
T_HALT_COMPILER : 101 ,
@@ -287,5 +288,6 @@ module.exports = {
287
288
T_FN : 235 ,
288
289
T_NULLSAFE_OBJECT_OPERATOR : 236 ,
289
290
T_MATCH : 237 ,
291
+ T_ATTRIBUTE : 238 ,
290
292
} ,
291
293
} ;
You can’t perform that action at this time.
0 commit comments