10000 Merge remote-tracking branch 'upstream/master' · jrdek/python@b77b4f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit b77b4f9

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 1189574 + 05a7310 commit b77b4f9

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.13.5 (2021-02-11)
2+
3+
### Bug fixes
4+
5+
Fixes an inefficiency in the parsing of large strings.
6+
17
## 0.13.4 (2021-01-27)
28

39
### Bug fixes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lezer-python",
3-
"version": "0.13.4",
3+
"version": "0.13.5",
44
"description": "Lezer-based Python grammar",
55
"main": "dist/index.cjs",
66
"type": "module",

src/python.grammar

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,29 +242,31 @@ FormatReplacement { "{" (YieldExpression | commaSep<"*"? test>) FormatConversion
242242

243243
formatStringSpecChars { ![{}]+ }
244244

245-
formatString1Content { !['{\\] | "\\" _ | "{{" }
246-
formatString2Content { !["{\\] | "\\" _ | "{{" }
245+
formatString1Content { (!['{\\] | "\\" _ | "{{")+ }
246+
formatString2Content { (!["{\\] | "\\" _ | "{{")+ }
247247

248248
longStringStart<quote> { stringPrefix? quote quote quote }
249249

250-
longString1Content { !['\\] | "\\" _ | "'" longString1_2 }
250+
longString1Content { (!['\\] | "\\" _ | "'" longString1_2)+ }
251251
longString1_2 { !['\\] | "\\" _ | "'" longString1_3 }
252252
longString1_3 { !['\\] | "\\" _ }
253253

254-
longString2Content { !["\\] | "\\" _ | '"' longString2_2 }
254+
longString2Content { (!["\\] | "\\" _ | '"' longString2_2)+ }
255255
longString2_2 { !["\\] | "\\" _ | '"' longString2_3 }
256256
longString2_3 { !["\\] | "\\" _ }
257257

258258
longFormatStringStart<quote> { formatPrefix quote quote quote }
259259

260-
longFormatString1Content { !['\\{] | "\\" _ | "'" longFormatString1_2 | "{{" }
260+
longFormatString1Content { (!['\\{] | "\\" _ | "'" longFormatString1_2 | "{{")+ }
261261
longFormatString1_2 { !['\\{] | "\\" _ | "{{" | "'" longFormatString1_3 }
262262
longFormatString1_3 { !['\\{] | "\\" _ | "{{" }
263263

264-
longFormatString2Content { !["\\{] | "\\" _ | "'" longFormatString2_2 | "{{" }
264+
longFormatString2Content { (!["\\{] | "\\" _ | "'" longFormatString2_2 | "{{")+ }
265265
longFormatString2_2 { !["\\{] | "\\" _ | "{{" | "'" longFormatString2_3 }
266266
longFormatString2_3 { !["\\{] | "\\" _ | "{{" }
267267

268+
@precedence { "{", formatString1Content, formatString2Content, longFormatString1Content, longFormatString2Content }
269+
268270
Number {
269271
(std.digit ("_" | std.digit)* ("." std.digit ("_" | std.digit)*)? | "." std.digit ("_" | std.digit)*)
270272
($[eE] $[+\-]? std.digit ("_" | std.digit)*)? $[jJ]? |

src/tokens.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const newlines = new ExternalTokenizer((input, token, stack) => {
9696
let ch = input.get(scan)
9797
if (ch == space) indent++
9898
else if (ch == tab) indent += 8 - (indent % 8)
99-
else if (ch == newline || indent == carriageReturn || ch == hash) {
99+
else if (ch == newline || ch == carriageReturn || ch == hash) {
100100
token.accept(newlineEmpty, token.start + 1)
101101
return
102102
} else {

0 commit comments

Comments
 (0)
0