[BRLTTY] Prompt matching.

Dave Mielke Dave at mielke.cc
Tue Oct 9 03:52:17 EDT 2018


[quoted lines by Aura Kelloniemi on 2018/10/09 at 10:23 +0300]

>But it is possible to add additional escaping rules to regular expressions by
>replacing the custom escape sequences by their replacements before feeding the
>pattern to the regexp parser - e.g. replacing the string "\u002C" with the
>string "," before the regex library gets its hands on the pattern. 

Sure, but I wouldn't want to force users to type \u002c (already supported, by
the way), or even \x2c (also already supported), for a comma. That's way too
clumsy, and is also unintuitive.

Perhaps I should go ahead and implement it with the comma restriction for now
just so that it can be used. We can always solve that one later.

>It would be good though that the engine would understand that input is not
>ASCII, but Unicode (UTF-8 or whatever encoding).

Brltty assumes UTF-8 whenever it isn't working with code points.

>Many Haskell users like their prompt to be "λ> " (i.e. a greek small letter
>lamda and greater-than sign). Idris which is another functional programming
>language (and environment) uses "λΠ> " as its prompt (where the gree capital
>letter pi refers to dependent typing). 

Okay. You meant the literal lambda and pi characters.

>Of course we can just declare, that if people have symbols in their prompts
>which they cannot type with their own keyboard layout, they can copy paste
>those characters.

Using my left alt key (for decimal) or my right alt key (for hex), in
combination with my keypad, I can type any code point from my keyboard. :-)

>There will be a problem though if the regex engine thinks that input is ASCII,
>but in reality is UTF-8, because then it mismatches everything that is
>supposed to match one character (e.g. "." (a dot)).

Preprocessing can handle this. All we need to do is search the string for
multi-byte UTF-8 characters, and enclose each within a hidden subgroup, e.g.
(?:character).

-- 
I believe the Bible to be the very Word of God: http://Mielke.cc/bible/
Dave Mielke            | 2213 Fox Crescent | WebHome: http://Mielke.cc/
EMail: Dave at Mielke.cc  | Ottawa, Ontario   | Twitter: @Dave_Mielke
Phone: +1 613 726 0014 | Canada  K2A 1H7   |


More information about the BRLTTY mailing list