@markuplint/php-parser 4.0.0-alpha.1 → 4.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017-2019 Yusuke Hirao
3
+ Copyright (c) 2017-2024 Yusuke Hirao
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -53,13 +53,3 @@ If it doesn't nest by quotations.
53
53
  <div attr=<?php echo value; ?>></div>
54
54
  ```
55
55
  <!-- prettier-ignore-end -->
56
-
57
- If it mixes the tags and spaces.
58
-
59
- ```html
60
- <div attr=" <?php echo value; ?> "></div>
61
- ```
62
-
63
- ```html
64
- <div attr="<?php echo value; ?> <?php echo value2; ?>"></div>
65
- ```
package/lib/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { parse } from './parse.js';
1
+ export { parser } from './parser.js';
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export { parse } from './parse.js';
1
+ export { parser } from './parser.js';
@@ -0,0 +1,6 @@
1
+ import { HtmlParser } from '@markuplint/html-parser';
2
+ declare class PHPParser extends HtmlParser {
3
+ constructor();
4
+ }
5
+ export declare const parser: PHPParser;
6
+ export {};
package/lib/parser.js ADDED
@@ -0,0 +1,25 @@
1
+ import { HtmlParser } from '@markuplint/html-parser';
2
+ class PHPParser extends HtmlParser {
3
+ constructor() {
4
+ super({
5
+ ignoreTags: [
6
+ {
7
+ type: 'php-tag',
8
+ start: '<?php',
9
+ end: /\?>|$/,
10
+ },
11
+ {
12
+ type: 'php-echo',
13
+ start: '<?=',
14
+ end: '?>',
15
+ },
16
+ {
17
+ type: 'php-short-tag',
18
+ start: '<?',
19
+ end: /\?>|$/,
20
+ },
21
+ ],
22
+ });
23
+ }
24
+ }
25
+ export const parser = new PHPParser();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/php-parser",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-alpha.11",
4
4
  "description": "PHP parser for markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -21,9 +21,10 @@
21
21
  "clean": "tsc --build --clean"
22
22
  },
23
23
  "dependencies": {
24
- "@markuplint/html-parser": "4.0.0-alpha.1",
25
- "@markuplint/ml-ast": "4.0.0-alpha.1",
26
- "@markuplint/parser-utils": "4.0.0-alpha.1"
24
+ "@markuplint/html-parser": "4.0.0-alpha.11"
27
25
  },
28
- "gitHead": "22502ee22a378ae766033d687dbc0443e5ed35dc"
26
+ "devDependencies": {
27
+ "@markuplint/parser-utils": "4.0.0-alpha.11"
28
+ },
29
+ "gitHead": "78ab1adaa4e178b4187f6c5f135bb8fc0c8f4b9e"
29
30
  }
package/lib/parse.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import type { Parse } from '@markuplint/ml-ast';
2
- export declare const parse: Parse;
package/lib/parse.js DELETED
@@ -1,24 +0,0 @@
1
- import { parse as htmlParse } from '@markuplint/html-parser';
2
- import { ignoreBlock, restoreNode } from '@markuplint/parser-utils';
3
- export const parse = (rawCode, options) => {
4
- const blocks = ignoreBlock(rawCode, [
5
- {
6
- type: 'php-tag',
7
- start: /<\?php/,
8
- end: /\?>|$/,
9
- },
10
- {
11
- type: 'php-echo',
12
- start: /<\?=/,
13
- end: /\?>/,
14
- },
15
- {
16
- type: 'php-short-tag',
17
- start: /<\?/,
18
- end: /\?>|$/,
19
- },
20
- ]);
21
- const doc = htmlParse(blocks.replaced, options);
22
- doc.nodeList = restoreNode(doc.nodeList, blocks);
23
- return doc;
24
- };