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

Fix wrong tokenize for lone ampersand#158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ota-meshi merged 4 commits intomasterfromissue157
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion.github/workflows/CI.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -91,7 +91,7 @@ jobs:
- name: Build
run: npm run -s build
- name: Test
run: npm run -s test:mocha
run: npm run -s test:cover
- name: Send Coverage
run: npm run -s codecov
env:
Expand Down
3 changes: 2 additions & 1 deletionpackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,7 +72,8 @@
"setup": "git submodule update --init && cd test/fixtures/eslint && npm install",
"pretest": "run-s build lint",
"test": "npm run -s test:mocha",
"test:mocha": "nyc mocha \"test/*.js\" --reporter dot --timeout 60000",
"test:mocha": "mocha --require ts-node/register \"test/*.js\" --reporter dot --timeout 60000",
"test:cover": "nyc mocha \"test/*.js\" --reporter dot --timeout 60000",
"test:debug": "mocha --require ts-node/register/transpile-only \"test/*.js\" --reporter dot --timeout 60000",
"preupdate-fixtures": "npm run -s build",
"update-fixtures": "node scripts/update-fixtures-ast.js && node scripts/update-fixtures-document-fragment.js",
Expand Down
8 changes: 4 additions & 4 deletionssrc/html/tokenizer.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1610,14 +1610,14 @@ export class Tokenizer {
this.crStartOffset = this.offset - 1
this.buffer = [AMPERSAND]

if (isWhitespace(cp) ||cp === LESS_THAN_SIGN || cp === EOF) {
return this.reconsumeAs("CHARACTER_REFERENCE_END")
if (isDigit(cp) ||isLetter(cp)) {
return this.reconsumeAs("NAMED_CHARACTER_REFERENCE")
}
if (cp === NUMBER_SIGN) {
this.buffer.push(cp)
return "NUMERIC_CHARACTER_REFERENCE"
}
return this.reconsumeAs("NAMED_CHARACTER_REFERENCE")
return this.reconsumeAs("CHARACTER_REFERENCE_END")
}

/**
Expand DownExpand Up@@ -1818,7 +1818,7 @@ export class Tokenizer {
}

/**
* https://html.spec.whatwg.org/multipage/parsing.html#character-reference-end-state
* https://html.spec.whatwg.org/multipage/parsing.html#flush-code-points-consumed-as-a-character-reference
* @param cp The current code point.
* @returns The next state.
*/
Expand Down
30 changes: 21 additions & 9 deletionstest/espree.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,9 +10,13 @@ function parentMain() {

describe("Loading espree from ESLint", () => {
it("should load espree from the ESLint location.", (done) => {
spawn(process.execPath, [__filename, "--child1"], {
stdio: "inherit",
})
spawn(
process.execPath,
["--require", "ts-node/register", __filename, "--child1"],
{
stdio: "inherit",
},
)
.on("error", done)
.on("exit", (code) =>
code
Expand All@@ -21,9 +25,13 @@ function parentMain() {
)
})
it("should load espree from the ESLint location.", (done) => {
spawn(process.execPath, [__filename, "--child1"], {
stdio: "inherit",
})
spawn(
process.execPath,
["--require", "ts-node/register", __filename, "--child1"],
{
stdio: "inherit",
},
)
.on("error", done)
.on("exit", (code) =>
code
Expand All@@ -38,9 +46,13 @@ function parentMain() {
execSync("npm i", {
stdio: "inherit",
})
spawn(process.execPath, [__filename, "--child2"], {
stdio: "inherit",
})
spawn(
process.execPath,
["--require", "ts-node/register", __filename, "--child2"],
{
stdio: "inherit",
},
)
.on("error", done)
.on("exit", (code) =>
code
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp