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

Commit4a8e28a

Browse files
committed
Instead of comparing with a set of ints, use maths
1 parent8ebff2e commit4a8e28a

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

‎html5lib/_tokenizer.py‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,14 @@ def consumeNumberEntity(self, isHex):
125125
"illegal-codepoint-for-numeric-entity",
126126
"datavars": {"charAsInt":charAsInt}})
127127
else:
128-
# Should speed up this check somehow (e.g. move the set to a constant)
129-
if ((0x0001<=charAsInt<=0x0008)or
128+
if (
129+
(0x0001<=charAsInt<=0x0008)or
130130
(0x000E<=charAsInt<=0x001F)or
131131
(0x007F<=charAsInt<=0x009F)or
132132
(0xFDD0<=charAsInt<=0xFDEF)or
133-
charAsIntinfrozenset([0x000B,0xFFFE,0xFFFF,0x1FFFE,
134-
0x1FFFF,0x2FFFE,0x2FFFF,0x3FFFE,
135-
0x3FFFF,0x4FFFE,0x4FFFF,0x5FFFE,
136-
0x5FFFF,0x6FFFE,0x6FFFF,0x7FFFE,
137-
0x7FFFF,0x8FFFE,0x8FFFF,0x9FFFE,
138-
0x9FFFF,0xAFFFE,0xAFFFF,0xBFFFE,
139-
0xBFFFF,0xCFFFE,0xCFFFF,0xDFFFE,
140-
0xDFFFF,0xEFFFE,0xEFFFF,0xFFFFE,
141-
0xFFFFF,0x10FFFE,0x10FFFF])):
133+
charAsInt==0x000Bor
134+
(charAsInt&0xFFFE)==0xFFFE
135+
):
142136
self.tokenQueue.append({"type":tokenTypes["ParseError"],
143137
"data":
144138
"illegal-codepoint-for-numeric-entity",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp