servo / unicode-bidi

Implementation of the Unicode Bidirection Algorithm in Rust
Other
78 stars 33 forks source link

Implement N0: Process bracket pairs #3

Closed mbrubeck closed 1 year ago

mbrubeck commented 9 years ago

In the resolve_neutral function, implement step N0: Process bracket pairs in an isolating run sequence.

There are test cases for this in BidiCharacterTest.txt (see issue #1).

vicky-katara commented 8 years ago

@mbrubeck , Step N0 has step BD16 as it's first step. Has this step been implemented already or will this have to be done as well?

mbrubeck commented 8 years ago

BD16 has not been implemented, and will need to be implemented as part of this fix.

vicky-katara commented 8 years ago

Ok. We'll implement BD16 as well. Thanks @mbrubeck

vicky-katara commented 8 years ago

@mbrubeck, to implement BD16, I will need 'pairValues: - unique ID for the pair (or set) of canonically matched brackets' and 'pairTypes: - array of paired bracket type values for each character' where will I find these lists / arrays?

mbrubeck commented 8 years ago

The pairTypes and pairValues arrays can be generated by looking up each input character in a table based on: http://www.unicode.org/Public/UNIDATA/BidiBrackets.txt (Let me know if you'd like any help converting this text file into a Rust-friendly array. The file is simple enough that it could be done either by a script or by hand.)

This table lists bracket characters in pairs; each pair has an "open" character and a "close" character. We can assign an arbitrary unique number to each pair; for example it could be the row number where the "open" character is found.

If the input character at index i is found in the table, then set pairValues[i] to the unique number assigned to that pair, and set pairTypes[i] to Open or Close according to the third column of the table. If the character is not found in the table, then set pairTypes[i] to None (and pairValues[i] is unused so we don't care what it's set to).

vicky-katara commented 8 years ago

@mbrubeck , I'm still working on implementing N0, and I would like some help in converting the test cases to a Rust Table.

mbrubeck commented 8 years ago

Okay, I will work on that tomorrow.

vicky-katara commented 8 years ago

Thanks Matt! On Dec 2, 2015 19:23, "Matt Brubeck" notifications@github.com wrote:

Okay, I will work on that tomorrow.

— Reply to this email directly or view it on GitHub https://github.com/servo/unicode-bidi/issues/3#issuecomment-161475114.

mbrubeck commented 8 years ago

https://github.com/mbrubeck/unicode-bidi/blob/brackets/src/brackets.rs contains a Rust module with the table of paired bracket characters. You can merge from my branch into yours if you want to use this code in your branch.

vicky-katara commented 8 years ago

Thanks @mbrubeck.

Manishearth commented 1 year ago

I'm working on this