Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitae42ce3

Browse files
authored
Fix wrong tokenize for lone ampersand (#158)
1 parent806a38c commitae42ce3

File tree

8 files changed

+2033
-15
lines changed

8 files changed

+2033
-15
lines changed

‎.github/workflows/CI.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
-name:Build
9292
run:npm run -s build
9393
-name:Test
94-
run:npm run -s test:mocha
94+
run:npm run -s test:cover
9595
-name:Send Coverage
9696
run:npm run -s codecov
9797
env:

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
"setup":"git submodule update --init && cd test/fixtures/eslint && npm install",
7373
"pretest":"run-s build lint",
7474
"test":"npm run -s test:mocha",
75-
"test:mocha":"nyc mocha\"test/*.js\" --reporter dot --timeout 60000",
75+
"test:mocha":"mocha --require ts-node/register\"test/*.js\" --reporter dot --timeout 60000",
76+
"test:cover":"nyc mocha\"test/*.js\" --reporter dot --timeout 60000",
7677
"test:debug":"mocha --require ts-node/register/transpile-only\"test/*.js\" --reporter dot --timeout 60000",
7778
"preupdate-fixtures":"npm run -s build",
7879
"update-fixtures":"node scripts/update-fixtures-ast.js && node scripts/update-fixtures-document-fragment.js",

‎src/html/tokenizer.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,14 +1610,14 @@ export class Tokenizer {
16101610
this.crStartOffset=this.offset-1
16111611
this.buffer=[AMPERSAND]
16121612

1613-
if(isWhitespace(cp)||cp===LESS_THAN_SIGN||cp===EOF){
1614-
returnthis.reconsumeAs("CHARACTER_REFERENCE_END")
1613+
if(isDigit(cp)||isLetter(cp)){
1614+
returnthis.reconsumeAs("NAMED_CHARACTER_REFERENCE")
16151615
}
16161616
if(cp===NUMBER_SIGN){
16171617
this.buffer.push(cp)
16181618
return"NUMERIC_CHARACTER_REFERENCE"
16191619
}
1620-
returnthis.reconsumeAs("NAMED_CHARACTER_REFERENCE")
1620+
returnthis.reconsumeAs("CHARACTER_REFERENCE_END")
16211621
}
16221622

16231623
/**
@@ -1818,7 +1818,7 @@ export class Tokenizer {
18181818
}
18191819

18201820
/**
1821-
* https://html.spec.whatwg.org/multipage/parsing.html#character-reference-end-state
1821+
* https://html.spec.whatwg.org/multipage/parsing.html#flush-code-points-consumed-as-a-character-reference
18221822
*@param cp The current code point.
18231823
*@returns The next state.
18241824
*/

‎test/espree.js‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ function parentMain() {
1010

1111
describe("Loading espree from ESLint",()=>{
1212
it("should load espree from the ESLint location.",(done)=>{
13-
spawn(process.execPath,[__filename,"--child1"],{
14-
stdio:"inherit",
15-
})
13+
spawn(
14+
process.execPath,
15+
["--require","ts-node/register",__filename,"--child1"],
16+
{
17+
stdio:"inherit",
18+
},
19+
)
1620
.on("error",done)
1721
.on("exit",(code)=>
1822
code
@@ -21,9 +25,13 @@ function parentMain() {
2125
)
2226
})
2327
it("should load espree from the ESLint location.",(done)=>{
24-
spawn(process.execPath,[__filename,"--child1"],{
25-
stdio:"inherit",
26-
})
28+
spawn(
29+
process.execPath,
30+
["--require","ts-node/register",__filename,"--child1"],
31+
{
32+
stdio:"inherit",
33+
},
34+
)
2735
.on("error",done)
2836
.on("exit",(code)=>
2937
code
@@ -38,9 +46,13 @@ function parentMain() {
3846
execSync("npm i",{
3947
stdio:"inherit",
4048
})
41-
spawn(process.execPath,[__filename,"--child2"],{
42-
stdio:"inherit",
43-
})
49+
spawn(
50+
process.execPath,
51+
["--require","ts-node/register",__filename,"--child2"],
52+
{
53+
stdio:"inherit",
54+
},
55+
)
4456
.on("error",done)
4557
.on("exit",(code)=>
4658
code

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp