Possible bug in line break trie data

Aperta
#29 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
backend

Direzione di ricerca

Read src/generate_data.js at the linked line and inspect how the line break trie ranges are generated. The report also suggests simplifying the range parsing and notes that 30 tests still fail, but it does not identify those tests or explain their failures. Determine whether the range issue is real and what changes are needed for the tests to pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I was just going through cleaning up my version of this code that I ported to C# and noticed a possible problem with the way the trie data is generated for the line break data.

See this line of code

https://github.com/foliojs/linebreak/blob/9096a22b389ea62df45252638d7bd6ebaab0f72d/src/generate_data.js#L31

Seems this code is trying to coalesce consecutive ranges with the same class into a single trie.setRange call. The problem is that it's checking for a change of class, but not that the ranges are consecutive and without gaps.

Shouldn't that line read something like this:

    if (((type != null) && (rangeType !== type)) || parseInt(rangeStart, 16) != parseInt(end, 16) + 1)

Also, it seems the UnicodeTrieBuilder already coalesces runs so this isn't even necessary. I reduced it to this:

  var re = /^([0-9A-F]+)(?:\.\.([0-9A-F]+))?\s*;\s*(.*?)\s*#/gm
  var m;
  while (m = re.exec(data))
  {
    var from = parseInt(m[1], 16);
    var to = m[2] === undefined ? from : parseInt(m[2], 16);
    var prop = m[3];

    lineBreakClassesTrie.setRange(from, to, LineBreakClass[prop], true);
  }

Unfortunately none of this resolves any of those 30 non-passing tests.

Lingua principale
JavaScript
Stelle
229
Fork
45
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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di foliojs/linebreak

Tutte le issue di foliojs/linebreak

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.