Skip to content

release 1.0.0 on master #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 115 commits into from
Jan 3, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
76aa80e
Merge pull request #44 from glayzzle/master
ichiriac Dec 27, 2016
37a17ae
implement nodes flags & add tests on classes
ichiriac Dec 27, 2016
b9b63cb
implement traits usage
ichiriac Dec 27, 2016
0249eb4
fix doc
ichiriac Dec 27, 2016
a90dd4f
start tests over trait & interface nodes
ichiriac Dec 27, 2016
1182236
rebuild nodes tree
ichiriac Dec 27, 2016
24f84ca
fix documentation nodes implementation
ichiriac Dec 27, 2016
7e2e192
fix documentation nodes implementation
ichiriac Dec 27, 2016
3fe2360
add interface node
ichiriac Dec 27, 2016
96d38f3
implement trait nodes
ichiriac Dec 27, 2016
170c7ee
rename documentation to doc
ichiriac Dec 27, 2016
9cfdf55
fix function & rename children as body
ichiriac Dec 27, 2016
9d14c69
fix trait insteadof -> identifier[]
ichiriac Dec 27, 2016
20860e3
add a new read_name_list helper
ichiriac Dec 27, 2016
deacdb4
https://github.com/glayzzle/php-parser/issues/11 change the expect re…
ichiriac Dec 27, 2016
59d2866
ignore plateform specific code
ichiriac Dec 28, 2016
7980c44
code array becomes code block nodes
ichiriac Dec 28, 2016
5ecbf5a
implement if node
ichiriac Dec 28, 2016
78f1132
fix coverage on if statements
ichiriac Dec 28, 2016
a40736e
isolate generic function into a utils.js file
ichiriac Dec 28, 2016
b99d1c8
fix doc, use block node instead []
ichiriac Dec 28, 2016
8e9ba7f
implement while & do nodes
ichiriac Dec 28, 2016
353ada4
implement for nodes
ichiriac Dec 28, 2016
1b38288
fix list node
ichiriac Dec 28, 2016
4ea9ac0
fix & byref for vars
ichiriac Dec 28, 2016
4005e58
add a list node
ichiriac Dec 28, 2016
ebae0aa
add coverage on list statements - wip
ichiriac Dec 28, 2016
136d2bf
add foreach node & rebuild docs
ichiriac Dec 28, 2016
fc06912
remove old tests installation requirements
ichiriac Dec 28, 2016
2c8a405
avoid including other docs into readme
ichiriac Dec 28, 2016
28d255d
https://github.com/glayzzle/php-parser-tests/issues/1
ichiriac Dec 28, 2016
89bb053
https://github.com/glayzzle/php-parser-tests/issues/1
ichiriac Dec 28, 2016
73efd7f
prepare release text
ichiriac Dec 28, 2016
c292bc6
fix tests
ichiriac Dec 28, 2016
eeff19c
remove unused references
ichiriac Dec 28, 2016
b748a0d
remove old dependencies
ichiriac Dec 28, 2016
3a59f39
fix coverage
ichiriac Dec 28, 2016
b952c64
update texts
ichiriac Dec 28, 2016
67c9d01
enable open/close tags on eval mode
ichiriac Dec 28, 2016
84ef031
implement switch, case, break nodes
ichiriac Dec 28, 2016
794d765
implement switch, case, break nodes
ichiriac Dec 28, 2016
d520b9f
add goto, label, post nodes
ichiriac Dec 28, 2016
b7f1483
cache node modules in order to speed up builds
ichiriac Dec 28, 2016
2fdd9fa
add try/catch and call nodes
ichiriac Dec 28, 2016
1721238
implement namespace & use nodes (fix https://github.com/glayzzle/php-…
ichiriac Dec 29, 2016
4585ca4
fix https://github.com/glayzzle/php-parser/issues/45 & add some tests
ichiriac Dec 29, 2016
daaf93e
add bin, cast & unary nodes
ichiriac Dec 29, 2016
f674b9f
add bin, cast & unary nodes
ichiriac Dec 29, 2016
aab775b
add bool & retif nodes
ichiriac Dec 30, 2016
88871e0
add silent node
ichiriac Dec 30, 2016
5747a93
add pre node
ichiriac Dec 30, 2016
0bdb379
add new node
ichiriac Dec 30, 2016
ae9fea9
cover ast.js
ichiriac Dec 30, 2016
d75ddd7
add closure node
ichiriac Dec 30, 2016
f74c40a
improve strings coverage on lexer
ichiriac Dec 30, 2016
59760a8
test here doc on lexer
ichiriac Dec 30, 2016
0206c33
rename var.identifier to var.name + enable array tests
ichiriac Dec 30, 2016
adb7f39
fix columns implementation
ichiriac Dec 30, 2016
4039451
fix positions retrieval
ichiriac Dec 30, 2016
91010c0
eat next token before result (fix positions)
ichiriac Dec 30, 2016
4c87f29
fix positions on assign nodes
ichiriac Dec 30, 2016
78ca985
fix var name location
ichiriac Dec 30, 2016
a874732
enable new tests
ichiriac Dec 30, 2016
cdb9f42
fix & test simple_variable parsing
ichiriac Dec 30, 2016
55c96a7
add new lookup nodes & migrate vars (wip)
ichiriac Dec 30, 2016
2143b98
add the static lookup node
ichiriac Dec 30, 2016
ad2b9ab
add global node
ichiriac Dec 31, 2016
0573362
start testing numbers
ichiriac Jan 1, 2017
1901702
cover tests on initial parser
ichiriac Jan 1, 2017
a64128b
fix comment lexing & add tests (wip)
ichiriac Jan 1, 2017
6fd68be
fix scalar endeless loop (edge) + cover strings lexer
ichiriac Jan 1, 2017
f8e0455
Merge pull request #47 from glayzzle/1.0.0
ichiriac Jan 1, 2017
e6d4e37
add some tests on binary node
ichiriac Jan 1, 2017
eeb00b8
fix empty arrays
ichiriac Jan 1, 2017
53318c4
implement the throw node
ichiriac Jan 1, 2017
36e64a8
add static keyword node
ichiriac Jan 1, 2017
9ad99b6
add the variadic node
ichiriac Jan 1, 2017
658f396
handle optional level argument on break & continue statements
ichiriac Jan 1, 2017
4f94f6d
implement the declare node
ichiriac Jan 2, 2017
8972928
handle errors with a SyntaxError error
ichiriac Jan 2, 2017
9660945
fix error properties
ichiriac Jan 2, 2017
7d47ac9
remove unused vars & update docs
ichiriac Jan 2, 2017
94145ab
add the halt compiler node
ichiriac Jan 2, 2017
b8e632d
cover fallback mode
ichiriac Jan 2, 2017
a07fe16
add a parenthesis node & implement operators precedence
ichiriac Jan 2, 2017
521891c
add more tests on expr precedence
ichiriac Jan 2, 2017
b19eeb0
add tests on tokens
ichiriac Jan 2, 2017
fefbccf
https://github.com/glayzzle/php-parser/issues/46 add an encapsed node
ichiriac Jan 2, 2017
43661db
https://github.com/glayzzle/php-parser/issues/46 add a specific node …
ichiriac Jan 2, 2017
309afd7
https://github.com/glayzzle/php-parser/issues/46 register new nodes
ichiriac Jan 2, 2017
0fb9353
implement encapsed nodes
ichiriac Jan 2, 2017
5ef26e8
add yield & yield from nodes
ichiriac Jan 2, 2017
0552a20
release dist
ichiriac Jan 2, 2017
79fc7e1
new nodes
ichiriac Jan 2, 2017
28288ba
remove unused function
ichiriac Jan 2, 2017
7526ea2
improve string tests
ichiriac Jan 2, 2017
6f778bb
add scalar tests & remove unused path
ichiriac Jan 2, 2017
4dcc871
remove dead code (parsed from expr)
ichiriac Jan 2, 2017
9047eca
remove dead code (old method scan method)
ichiriac Jan 2, 2017
3118334
fix class namespace reading on new statements
ichiriac Jan 2, 2017
f504ddd
remove dead case
ichiriac Jan 2, 2017
a8cbde6
improve parser coverage
ichiriac Jan 2, 2017
2fa6bce
dead line
ichiriac Jan 2, 2017
799e911
improve statement coverage
ichiriac Jan 2, 2017
e80e9be
improve statements coverage
ichiriac Jan 2, 2017
b094350
remove unused function
ichiriac Jan 2, 2017
26c187b
revert back deferencable + add tests
ichiriac Jan 2, 2017
97fff46
let top statements in T_DECLARE bodies
ichiriac Jan 2, 2017
1e0a01d
fix lexer state on ST_LOOKING_FOR_PROPERTY
ichiriac Jan 3, 2017
05b0eb3
add some references
ichiriac Jan 3, 2017
ced1ae3
fix continue/break statement with optional level expression
ichiriac Jan 3, 2017
1df5350
update informations
ichiriac Jan 3, 2017
fcf9e7d
rebuild
ichiriac Jan 3, 2017
239daef
up
ichiriac Jan 3, 2017
d045009
Merge pull request #52 from glayzzle/develop
ichiriac Jan 3, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
handle optional level argument on break & continue statements
  • Loading branch information
ichiriac committed Jan 1, 2017
commit 658f396e949448dc4b75f80b38895331405b6543
84 changes: 46 additions & 38 deletions docs/AST.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,44 @@

# AST

The AST builder class

**Parameters**

- `withPositions`
- `withSource`

**Properties**

- `withPositions` **[Boolean](#boolean)** Should locate any node (by default false)
- `withSource` **[Boolean](#boolean)** Should extract the node original code (by default false)

## position

Create a position node from specified parser
including it's lexer current state

**Parameters**

- `Parser`
- `parser`

Returns **[Position](#position)**

## prepare

Prepares an AST node

**Parameters**

- `kind` **([String](#string) | null)** Defines the node type
(if null, the kind must be passed at the function call)
- `parser` **Parser** The parser instance (use for extracting locations)

Returns **[Function](#function)**

# AST

## Class hierarchy

- [Location](#location)
Expand Down Expand Up @@ -117,44 +155,6 @@ Prepares an AST node

Returns **[Function](#function)**

# AST

The AST builder class

**Parameters**

- `withPositions`
- `withSource`

**Properties**

- `withPositions` **[Boolean](#boolean)** Should locate any node (by default false)
- `withSource` **[Boolean](#boolean)** Should extract the node original code (by default false)

## position

Create a position node from specified parser
including it's lexer current state

**Parameters**

- `Parser`
- `parser`

Returns **[Position](#position)**

## prepare

Prepares an AST node

**Parameters**

- `kind` **([String](#string) | null)** Defines the node type
(if null, the kind must be passed at the function call)
- `parser` **Parser** The parser instance (use for extracting locations)

Returns **[Function](#function)**

# Array

**Extends Expression**
Expand Down Expand Up @@ -224,6 +224,10 @@ Defines a boolean value (true/false)

A break statement

**Properties**

- `level` **([Number](#number) \| [Null](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null))**

# Call

**Extends Statement**
Expand Down Expand Up @@ -368,6 +372,10 @@ A constant reference

A continue statement

**Properties**

- `level` **([Number](#number) \| [Null](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null))**

# Declaration

**Extends Statement**
Expand Down
4 changes: 3 additions & 1 deletion src/ast/break.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ var KIND = 'break';
* A break statement
* @constructor Break
* @extends {Node}
* @property {Number|Null} level
*/
var Break = Node.extends(function Break(location) {
var Break = Node.extends(function Break(level, location) {
Node.apply(this, [KIND, location]);
this.level = level;
});

module.exports = Break;
4 changes: 3 additions & 1 deletion src/ast/continue.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ var KIND = 'continue';
* A continue statement
* @constructor Continue
* @extends {Node}
* @property {Number|Null} level
*/
var Continue = Node.extends(function Continue(location) {
var Continue = Node.extends(function Continue(level, location) {
Node.apply(this, [KIND, location]);
this.level = level;
});

module.exports = Continue;
2 changes: 1 addition & 1 deletion src/parser/scalar.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ module.exports = {
this.next().expect([this.tok.T_LNUMBER, this.tok.T_DNUMBER]);
value += this.text();
}
result = result(value);
this.next();
result = result(value);
return result;

// CONSTANTS
Expand Down
18 changes: 11 additions & 7 deletions src/parser/statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,18 @@ module.exports = {
return result(expr);

case this.tok.T_BREAK:
var result = this.node('break');
this.next().expectEndOfStatement();
return result();

case this.tok.T_CONTINUE:
var result = this.node('continue');
this.next().expectEndOfStatement();
return result();
var result = this.node(
this.token === this.tok.T_CONTINUE ? 'continue' : 'break'
), level = null;
if(this.next().token === this.tok.T_LNUMBER) {
level = this.node('number');
var value = this.text();
this.next();
level = level(value);
}
this.expectEndOfStatement();
return result(level);

case this.tok.T_GLOBAL:
var result = this.node('global');
Expand Down
2 changes: 1 addition & 1 deletion test/loopTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Test loops statements (for, while)', function() {
'echo $i;',
'for(;;):',
'echo $ok;',
'continue;;',
'continue 5;;',
'endfor;'
].join('\n'), {
parser: { debug: false }
Expand Down
2 changes: 1 addition & 1 deletion test/switchTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Test SWITCH statements', function() {
' case 1:',
' case $var:',
' $foo = false;',
' break;',
' break 10;',
' case FOO:',
' $foo = true;',
' break;',
Expand Down