Sujet : Re: Case Insensitive File Systems -- Torvalds Hates Them
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.os.linux.miscDate : 07. May 2025, 22:49:44
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vvgkho$18rfl$3@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Pan/0.162 (Pokrosvk)
On Wed, 7 May 2025 08:14:57 -0700, John Ames wrote:
There's no ultimate solution to *that* problem, though - any system for
representing a delimited sequence of tokens where the delimiter itself
is a valid token is gonna run into this at *some* point. (It's escape
characters all the way down...)
It was long ago recognized that you needed at least one special character
which said “take the next character literally”, and that that would apply
even if the following character was the same special character.
page.write \
(
"function JSString(Str)\n"
# /* returns a JavaScript string literal that evaluates to Str. */
" {\n"
" let Result = \"\\"\"\n"
" for (let i = 0; i < Str.length; ++i)\n"
" {\n"
" let ThisCh = Str.charAt(i)\n"
" if (ThisCh == \"\\\")\n"
" {\n"
" ThisCh = \"\\\\\"\n"
" }\n"
" else if (ThisCh == \"\\"\")\n"
" {\n"
" ThisCh = \"\\\\"\"\n"
" }\n"
" else if (ThisCh == \"\t\")\n"
" {\n"
" ThisCh = \"\\t\"\n"
" }\n"
" else if (ThisCh == \"\n\")\n"
" {\n"
" ThisCh = \"\\n\"\n"
" } /*if*/\n"
" Result += ThisCh\n"
" } /*for*/\n"
" return Result + \"\\"\"\n"
" } /*JSString*/\n"
)