Skip to content

Commit df8d41c

Browse files
committed
chore: minor cleanups
1 parent f7bb800 commit df8d41c

File tree

3 files changed

+20
-95
lines changed

3 files changed

+20
-95
lines changed

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ module.exports = {
99
env: {
1010
browser: true,
1111
node: true,
12-
mocha: true,
1312
jest: true,
1413
es6: true,
1514
},

.github/dependabot.yml

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,3 @@ updates:
66
interval: daily
77
time: "04:00"
88
open-pull-requests-limit: 10
9-
ignore:
10-
- dependency-name: webpack
11-
versions:
12-
- 5.31.0
13-
- 5.31.2
14-
- 5.32.0
15-
- 5.33.2
16-
- 5.34.0
17-
- 5.35.0
18-
- 5.35.1
19-
- dependency-name: eslint-plugin-jest
20-
versions:
21-
- 24.1.3
22-
- 24.1.4
23-
- 24.1.5
24-
- 24.1.8
25-
- 24.1.9
26-
- 24.2.0
27-
- 24.2.1
28-
- 24.3.1
29-
- 24.3.2
30-
- 24.3.4
31-
- 24.3.5
32-
- dependency-name: "@babel/core"
33-
versions:
34-
- 7.12.10
35-
- 7.12.13
36-
- 7.12.16
37-
- 7.12.17
38-
- 7.13.1
39-
- 7.13.10
40-
- 7.13.13
41-
- 7.13.15
42-
- 7.13.8
43-
- dependency-name: husky
44-
versions:
45-
- 4.3.8
46-
- 5.0.9
47-
- 5.1.0
48-
- 5.1.1
49-
- 5.1.2
50-
- 5.1.3
51-
- 5.2.0
52-
- dependency-name: "@babel/preset-env"
53-
versions:
54-
- 7.12.11
55-
- 7.12.13
56-
- 7.12.16
57-
- 7.12.17
58-
- 7.13.0
59-
- 7.13.10
60-
- 7.13.5
61-
- 7.13.8
62-
- 7.13.9
63-
- dependency-name: webpack-cli
64-
versions:
65-
- 4.4.0
66-
- 4.5.0
67-
- dependency-name: node-notifier
68-
versions:
69-
- 8.0.1

README.md

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,55 @@
11
<h1 align="center">php-parser</h1>
22
<p align="center">
3-
<a href="https://circleci.com/gh/glayzzle/php-parser/tree/master"><img src="https://circleci.com/gh/glayzzle/php-parser/tree/master.svg?style=svg"></a>
4-
<a href="https://coveralls.io/github/glayzzle/php-parser?branch=master"><img src="https://coveralls.io/repos/github/glayzzle/php-parser/badge.svg?branch=master&v=20170115" alt="Coverage Status" /></a>
53
<a title="npm version" href="https://www.npmjs.com/package/php-parser"><img src="https://badge.fury.io/js/php-parser.svg"></a>
64
<a title="npm downloads" href="https://www.npmjs.com/package/php-parser"><img src="https://img.shields.io/npm/dm/php-parser.svg?style=flat"></a>
75
<a title="Gitter" href="https://gitter.im/glayzzle/Lobby"><img src="https://img.shields.io/badge/GITTER-join%20chat-green.svg"></a>
8-
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fglayzzle%2Fphp-parser?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fglayzzle%2Fphp-parser.svg?type=shield"/></a>
96
</p>
10-
<p align="center">This javascript library parses PHP code and convert it to AST.</p>
7+
<p align="center">This JavaScript library parses PHP code and converts it to an AST.</p>
118

12-
Installation
13-
------------
9+
## Installation
1410

1511
This library is distributed with [npm](https://www.npmjs.com/package/php-parser) :
1612

1713
```sh
1814
npm install php-parser --save
1915
```
2016

21-
Usage
22-
-----
17+
## Usage
2318

2419
```js
2520
// initialize the php parser factory class
26-
var fs = require('fs');
27-
var path = require('path');
28-
var engine = require('php-parser');
21+
const fs = require("fs");
22+
const path = require("path");
23+
const engine = require("php-parser");
2924

3025
// initialize a new parser instance
31-
var parser = new engine({
26+
const parser = new engine({
3227
// some options :
3328
parser: {
3429
extractDoc: true,
35-
php7: true
30+
php7: true,
3631
},
3732
ast: {
38-
withPositions: true
39-
}
33+
withPositions: true,
34+
},
4035
});
4136

4237
// Retrieve the AST from the specified source
43-
var eval = parser.parseEval('echo "Hello World";');
38+
const eval = parser.parseEval('echo "Hello World";');
4439

4540
// Retrieve an array of tokens (same as php function token_get_all)
46-
var tokens = parser.tokenGetAll('<?php echo "Hello World";');
41+
const tokens = parser.tokenGetAll('<?php echo "Hello World";');
4742

4843
// Load a static file (Note: this file should exist on your computer)
49-
var phpFile = fs.readFileSync( './example.php' );
44+
const phpFile = fs.readFileSync("./example.php");
5045

5146
// Log out results
52-
console.log( 'Eval parse:', eval );
53-
console.log( 'Tokens parse:', tokens );
54-
console.log( 'File parse:', parser.parseCode(phpFile) );
55-
47+
console.log("Eval parse:", eval);
48+
console.log("Tokens parse:", tokens);
49+
console.log("File parse:", parser.parseCode(phpFile));
5650
```
5751

58-
Sample AST output
59-
-----------------
52+
## Sample AST output
6053

6154
```js
6255
{
@@ -79,9 +72,7 @@ Sample AST output
7972
- Try it online (demo) : http://glayzzle.com/php-parser/
8073
- Or from AST Explorer : https://astexplorer.net/
8174

82-
83-
API Overview
84-
------------
75+
## API Overview
8576

8677
The main API exposes a class with the following methods :
8778

@@ -91,15 +82,13 @@ The main API exposes a class with the following methods :
9182

9283
You can also [pass options](https://github.com/glayzzle/php-parser/wiki/Options) that change the behavior of the parser/lexer.
9384

94-
Documentation
95-
-------------
85+
## Documentation
9686

9787
- [AST nodes definition](https://php-parser.glayzzle.com/api/ast.js)
9888
- [Sandbox](https://php-parser.glayzzle.com/demo)
9989
- [List of options](https://php-parser.glayzzle.com/guides/options)
10090

101-
Related projects
102-
----------------
91+
## Related projects
10392

10493
- [prettier/plugin-php](https://github.com/prettier/plugin-php) : Prettier PHP Plugin
10594
- [babel-preset-php](https://gitlab.com/kornelski/babel-preset-php) : Babel preset for converting PHP syntax to JavaScript. It can run subset of PHP in the browser or in Node.js
@@ -117,5 +106,3 @@ Related projects
117106
## License
118107

119108
This library is released under BSD-3 license clause.
120-
121-
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fglayzzle%2Fphp-parser.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fglayzzle%2Fphp-parser?ref=badge_large)

0 commit comments

Comments
 (0)