Mercurial
annotate third_party/bun/node_modules/js-tokens/index.js @ 22:947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Tue, 07 Oct 2025 07:11:02 -0700 |
| parents | de54585a40f1 |
| children |
| rev | line source |
|---|---|
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1 // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2 // License: MIT. (See LICENSE.) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4 Object.defineProperty(exports, "__esModule", { |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5 value: true |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6 }) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
7 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
8 // This regex comes from regex.coffee, and is inserted here by generate-index.js |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
9 // (run `npm run build`). |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
10 exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
11 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
12 exports.matchToToken = function(match) { |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
13 var token = {type: "invalid", value: match[0], closed: undefined} |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
14 if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4]) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
15 else if (match[ 5]) token.type = "comment" |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
16 else if (match[ 6]) token.type = "comment", token.closed = !!match[7] |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
17 else if (match[ 8]) token.type = "regex" |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
18 else if (match[ 9]) token.type = "number" |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
19 else if (match[10]) token.type = "name" |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
20 else if (match[11]) token.type = "punctuator" |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
21 else if (match[12]) token.type = "whitespace" |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
22 return token |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
23 } |