X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMathParser.C;h=cb208ffca3c78798280fe2cb0b0a89a2f54185af;hb=8b7cc1b498b9dc1925647d4a7e7721a569e42dc5;hp=2fe641cf93c659cca2eaf4641fcfbfacc565ad7d;hpb=4689b5eea3fbe0a10332efa03c9463889f68affe;p=lyx.git diff --git a/src/mathed/MathParser.C b/src/mathed/MathParser.C index 2fe641cf93..cb208ffca3 100644 --- a/src/mathed/MathParser.C +++ b/src/mathed/MathParser.C @@ -213,11 +213,19 @@ enum CatCode { catInvalid // 15 }; -CatCode theCatcode[256]; +CatCode theCatcode[128]; -inline CatCode catcode(unsigned char c) +inline CatCode catcode(lyx::char_type c) { + /* The fact that we use unicode internally does not change Knuth's TeX + engine. It is still 7bit only, not even latin1 or something like that. + Therefore, the catcode table needs only to have 128 entries. + Everything not in that range is catOther. + */ + if (c >= 128) + return catOther; + return theCatcode[c]; } @@ -1448,7 +1456,7 @@ void mathed_parse_normal(InsetMathGrid & grid, string const & str) void initParser() { - fill(theCatcode, theCatcode + 256, catOther); + fill(theCatcode, theCatcode + 128, catOther); fill(theCatcode + 'a', theCatcode + 'z' + 1, catLetter); fill(theCatcode + 'A', theCatcode + 'Z' + 1, catLetter);