Skip to content

Commit

Permalink
Use ES6 IdentifierStart and IdentifierPart.
Browse files Browse the repository at this point in the history
In particular, this is now using Unicode derived properties:
* ID_Start and Other_ID_Start
* ID_Continue, Other_ID_Continue, Other_ID_Start

Update the tool to generate the right regular expressions for IdentifierPart
and IdentifierStart based on the appopriate Unicode properties.

Fixes #1232
Closes gh-1233
  • Loading branch information
ariya committed Jul 14, 2015
1 parent 3b17c76 commit b6b316c
Show file tree
Hide file tree
Showing 12 changed files with 415 additions and 28 deletions.
9 changes: 6 additions & 3 deletions esprima.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/fixtures/ES6/identifier/dakuten_handakuten.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+
90 changes: 90 additions & 0 deletions test/fixtures/ES6/identifier/dakuten_handakuten.tree.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"range": [
0,
4
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
},
"type": "Program",
"body": [
{
"range": [
0,
4
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
},
"type": "ExpressionStatement",
"expression": {
"range": [
0,
4
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
},
"type": "BinaryExpression",
"operator": "+",
"left": {
"range": [
0,
1
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
}
},
"type": "Identifier",
"name": ""
},
"right": {
"range": [
3,
4
],
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 4
}
},
"type": "Identifier",
"name": ""
}
}
}
]
}
1 change: 1 addition & 0 deletions test/fixtures/ES6/identifier/estimated.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let
75 changes: 75 additions & 0 deletions test/fixtures/ES6/identifier/estimated.tree.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"range": [
0,
5
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 5
}
},
"type": "Program",
"body": [
{
"range": [
0,
5
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 5
}
},
"type": "VariableDeclaration",
"declarations": [
{
"range": [
4,
5
],
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 5
}
},
"type": "VariableDeclarator",
"id": {
"range": [
4,
5
],
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 5
}
},
"type": "Identifier",
"name": ""
},
"init": null
}
],
"kind": "let"
}
]
}
1 change: 1 addition & 0 deletions test/fixtures/ES6/identifier/ethiopic_digits.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var _፩፪፫፬፭፮፯፰፱
75 changes: 75 additions & 0 deletions test/fixtures/ES6/identifier/ethiopic_digits.tree.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"range": [
0,
14
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 14
}
},
"type": "Program",
"body": [
{
"range": [
0,
14
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 14
}
},
"type": "VariableDeclaration",
"declarations": [
{
"range": [
4,
14
],
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 14
}
},
"type": "VariableDeclarator",
"id": {
"range": [
4,
14
],
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 14
}
},
"type": "Identifier",
"name": "_፩፪፫፬፭፮፯፰፱"
},
"init": null
}
],
"kind": "var"
}
]
}
1 change: 1 addition & 0 deletions test/fixtures/ES6/identifier/weierstrass.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var ;
75 changes: 75 additions & 0 deletions test/fixtures/ES6/identifier/weierstrass.tree.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"range": [
0,
6
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"type": "Program",
"body": [
{
"range": [
0,
6
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"type": "VariableDeclaration",
"declarations": [
{
"range": [
4,
5
],
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 5
}
},
"type": "VariableDeclarator",
"id": {
"range": [
4,
5
],
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 5
}
},
"type": "Identifier",
"name": ""
},
"init": null
}
],
"kind": "var"
}
]
}
1 change: 1 addition & 0 deletions test/fixtures/ES6/identifier/weierstrass_weierstrass.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var ℘\u2118

0 comments on commit b6b316c

Please sign in to comment.