]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathParser.C
Fix comment according to Enricos explanation
[lyx.git] / src / mathed / MathParser.C
index 2fe641cf93c659cca2eaf4641fcfbfacc565ad7d..623b9234e87fede82fce8c24a6437066e50c966a 100644 (file)
@@ -213,11 +213,22 @@ enum CatCode {
        catInvalid     // 15   <delete>
 };
 
-CatCode theCatcode[256];
+CatCode theCatcode[128];
 
 
-inline CatCode catcode(unsigned char c)
+inline CatCode catcode(char_type c)
 {
+       /* The only characters that are not catOther lie in the pure ASCII
+        * range. Therefore theCatcode has only 128 entries.
+        * TeX itself deals with 8bit characters, so if needed this table
+        * could be enlarged to 256 entries.
+        * Any larger value does not make sense, since the fact that we use
+        * unicode internally does not change Knuth's TeX engine.
+        * Apart from that a table for the full 21bit UCS4 range would waste
+        * too much memory. */
+       if (c >= 128)
+               return catOther;
+
        return theCatcode[c];
 }
 
@@ -1448,7 +1459,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);