regexp literal after for/if/while header causes SyntaxError in js_parse_skip_parens_token
I maintainer di solito rispondono entro 5 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- c, javascript
- Ambito
- compilers
Direzione di ricerca
Start by reading js_parse_skip_parens_token(), is_regexp_allowed(), and js_parse_regexp() in the parser; the issue identifies these as the paths involved in the incorrect lookahead and pending exception. Reproduce with the supplied snippets and trace how parsing handles / after each listed header. Done means all snippets parse and the IIFE leaves no pending syntax error.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
var f1 = (fn = function(e){ for (var r in e) /data-/gi.test(r); var s = "#"; }) => fn;
var f2 = (fn = function(){ for (var x in {a:1}) /[)]/.test(x); }) => fn;
var f3 = (fn = function(){ if (1) /[)]/.test(")"); }) => fn;
var f4 = (fn = function(){ while (0) /[)]/.test(")"); }) => fn;
var f5 = (fn = function(){ with ({}) /[)]/.test(")"); }) => fn;
var f6 = (fn = async function(){ for await (var x of [1]) /[)]/.test(")"); }) => fn;
All the valid snippets above fail to parse with SyntaxError: expecting ';'. In addition, for an IIFE like:
(function(e){ for (var r in e) /data-/gi.test(r); var s = "#"; })({a:1});
JS_Eval() succeeds, but JS_GetException(ctx) still returns a pending SyntaxError: unexpected end of regexp.
The root cause is that is_regexp_allowed(')') always returns FALSE inside js_parse_skip_parens_token(). However, after the closing ) of a for (...), for await (...), if (...), while (...), or with (...) header, a statement follows and / starts a regexp literal rather than division. Treating / as division breaks paren matching during lookahead and also leaves an uncleared exception in rt->current_exception when js_parse_regexp() fails. Could you help look into fixing this?
- Lingua principale
- C
- Stelle
- 11.1k
- Fork
- 1.2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bellard/quickjs
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 5 giorni
-
RegExp: patterns with more than 255 capture groups fail with "too many captures"Forse già presa @andreasrosdal l’ha presa 3 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
bellard/quickjs#624 · 1 commento ·
I maintainer di solito rispondono entro 5 giorni
-
(comment on #611) `function g(a, d = (a = 10)) { return a; }` returns the argument instead of 10Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
I maintainer di solito rispondono entro 5 giorni
-
Account for Map/Set retained strings in JS_ComputeMemoryUsage, or document partial accountingAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
I maintainer di solito rispondono entro 5 giorni
-
`{ ..."ab" }` is `{}`; a throw in a `for await` body does not wait for the iterator's return()Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
bellard/quickjs#611 · 1 commento ·
I maintainer di solito rispondono entro 5 giorni
Tutte le issue di bellard/quickjs
Issue simili
-
documentation good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
JulianKemmerer/PipelineC#409 ·
-
Linux build fails without libspeechd-dev, which INSTALL.md doesn't list and CMake reports as foundAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
GXF: heap buffer overflow in parse_ad_cdp() — unbounded cc_count in CDP cc data sectionForse già presa @pranayr710 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
CCExtractor/ccextractor#2498 ·
I maintainer di solito rispondono entro 1 giorno