[BRLTTY] Prompt matching.

Aura Kelloniemi kaura.dev at sange.fi
Tue Oct 9 03:23:42 EDT 2018


Hi

Dave Mielke <Dave at mielke.cc> writes:

 > [quoted lines by Aura Kelloniemi on 2018/10/09 at 02:33 +0300]
 > This would create confusion since regular expressions do their own escaping.
 > The mechanism that splits the regular expressions apart mustn't be able to
 > accidentally interfere with the regular expressions themselves.

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. This code
which handles custom escaping just leaves everything else (except the sequences
it understands) alone. There are program using this trick for similar reasons
as brltty would use it, but Iunfortunately don't remember which ones.

 > >It would be a good idea to implement number three in any case as nowadays
 > >there are fancy REPLs with fancy prompts - like Idris' prompt which contains
 > >lambda and pi followed by closing angle bracket.

 > I'm curious to see some examples of these. Right now my plan is to use POSIX
 > extended regular expressions. Does what you're referring to require a fancier
 > syntax?

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

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). 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.

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)).

-- 
Aura


More information about the BRLTTY mailing list