Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
1,745 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (C) 2018 Glayzzle (BSD3 License) | ||
* @authors https://github.com/glayzzle/php-parser/graphs/contributors | ||
* @url http://glayzzle.com | ||
*/ | ||
"use strict"; | ||
|
||
const Node = require("./node"); | ||
const KIND = "attrgroup"; | ||
|
||
/** | ||
* Attribute group | ||
* @constructor AttrGroup | ||
* @extends {Node} | ||
* @property {Attribute[]} attrs | ||
*/ | ||
module.exports = Node.extends(KIND, function AttrGroup(attrs, docs, location) { | ||
Node.apply(this, [KIND, docs, location]); | ||
this.attrs = attrs || []; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright (C) 2018 Glayzzle (BSD3 License) | ||
* @authors https://github.com/glayzzle/php-parser/graphs/contributors | ||
* @url http://glayzzle.com | ||
*/ | ||
"use strict"; | ||
|
||
const Node = require("./node"); | ||
const KIND = "attribute"; | ||
|
||
/** | ||
* Attribute Value | ||
* @constructor Attribute | ||
* @extends {Node} | ||
* @property {String} name | ||
* @property {Parameter[]} args | ||
*/ | ||
module.exports = Node.extends(KIND, function Attribute( | ||
name, | ||
args, | ||
docs, | ||
location | ||
) { | ||
Node.apply(this, [KIND, docs, location]); | ||
this.name = name; | ||
this.args = args; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Copyright (C) 2018 Glayzzle (BSD3 License) | ||
* @authors https://github.com/glayzzle/php-parser/graphs/contributors | ||
* @url http://glayzzle.com | ||
*/ | ||
"use strict"; | ||
|
||
module.exports = { | ||
matchST_ATTRIBUTE: function () { | ||
let listDepth = 0; | ||
let ch = this.input(); | ||
if (this.is_WHITESPACE()) { | ||
do { | ||
ch = this.input(); | ||
} while (this.is_WHITESPACE()); | ||
this.unput(1); | ||
return null; | ||
} | ||
switch (ch) { | ||
case "]": | ||
if (listDepth === 0) { | ||
this.popState(); | ||
} else { | ||
listDepth--; | ||
} | ||
return "]"; | ||
case "(": | ||
case ")": | ||
case ":": | ||
case "=": | ||
return this.consume_TOKEN(); | ||
case "[": | ||
listDepth++; | ||
return "["; | ||
case ",": | ||
return ","; | ||
case '"': | ||
return this.ST_DOUBLE_QUOTES(); | ||
case "'": | ||
return this.T_CONSTANT_ENCAPSED_STRING(); | ||
case "/": | ||
if (this._input[this.offset] === "/") { | ||
return this.T_COMMENT(); | ||
} else if (this._input[this.offset] === "*") { | ||
this.input(); | ||
return this.T_DOC_COMMENT(); | ||
} | ||
} | ||
if (this.is_LABEL_START()) { | ||
this.consume_LABEL(); | ||
return this.tok.T_STRING; | ||
} else if (this.is_NUM()) { | ||
return this.consume_NUM(); | ||
} | ||
|
||
throw new Error( | ||
`Bad terminal sequence "${ch}" at line ${this.yylineno} (offset ${this.offset})` | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.