Skip to content

Commit 819c265

Browse files
jugglinmikeariya
authored andcommitted
Documentation: Describe RegExp parsing dependency
Document Esprima's dependency on the regular expression parser of the host environment. Fix jquery#1883 Closes jquerygh-1890
1 parent df749a7 commit 819c265

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/syntactic-analysis.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ In the above case, the parser does not throw an exception and it still returns a
166166

167167
Note that the tolerant mode is intended to deal with very few types of syntax errors. It is unable to robustly handle every possible invalid program.
168168

169+
## Regular Expression Literals
170+
171+
Esprima does not implement logic to fully parse ECMAScript regular expressions. Instead, it delegates this responsibility to the JavaScript engine in which it executed (i.e. via the built-in `RegExp` function). This approach means that Esprima may respond to the same input differently depending on the JavaScript engine in use. It will exhibit the same bugs and features of the regular expression parser in the host environment.
172+
169173
## Node Location
170174

171175
By default, Esprima parser produces an [abstract syntax tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree). For some uses cases, this abstract syntax tree is not sufficient. For instance, having the location information of each node is necessary in a few cases of static analysis, e.g. to give a meaningful feedback to the user.

0 commit comments

Comments
 (0)