Skip to content

Commit 30a67c7

Browse files
committed
fix #263
1 parent e3c0cbb commit 30a67c7

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

src/lexer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const lexer = function(engine) {
2828
this.comment_tokens = false;
2929
this.mode_eval = false;
3030
this.asp_tags = false;
31-
this.short_tags = true;
31+
this.short_tags = false;
3232
this.php7 = true;
3333
this.yyprevcol = 0;
3434
this.keywords = {

test/debug.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@
1616
*/
1717
const util = require('util');
1818
const parser = require("../src/index");
19-
const ast = parser.parseEval(`
20-
$a = 1
21-
* // A
22-
2
23-
* // B
24-
3;
19+
const ast = parser.parseCode(`
20+
<?php$var = 1; ?>
2521
`, {
2622
parser: {
2723
debug: true,

test/snapshot/__snapshots__/lexer.test.js.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`Test lexer initial state #263 - expect inline 1`] = `
4+
Program {
5+
"children": Array [
6+
Inline {
7+
"kind": "inline",
8+
"raw": "<?php$a ?>",
9+
"value": "<?php$a ?>",
10+
},
11+
],
12+
"errors": Array [],
13+
"kind": "program",
14+
}
15+
`;
16+
317
exports[`Test lexer initial state parse asp echo tag 1`] = `
418
Program {
519
"children": Array [

test/snapshot/lexer.test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ describe("Test lexer", function() {
1111
});
1212

1313
it("parse short echo", function() {
14-
expect(parser.parseCode("<?= $a ?>", {
15-
lexer: {
16-
short_tags: true
17-
}
18-
})).toMatchSnapshot();
14+
expect(parser.parseCode("<?= $a ?>")).toMatchSnapshot();
1915
});
2016

17+
it("#263 - expect inline", function() {
18+
expect(parser.parseCode("<?php$a ?>")).toMatchSnapshot();
19+
});
20+
21+
2122
it("parse asp tag", function() {
2223
expect(parser.parseCode("<% echo $b; %>", {
2324
lexer: {

0 commit comments

Comments
 (0)