[Scummvm-git-logs] scummvm master -> 4ef5d6d62cdb5fc0d4db97d4e2423ff39cde4217

sev- sev at scummvm.org
Fri May 15 18:25:12 UTC 2020


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
314658ab1f DIRECTOR: LINGO: Added more test for \xC2
4ef5d6d62c DIRECTOR: LINGO: Fully reworked continuation symbol handling


Commit: 314658ab1f078bf764cc49711b20f12f1472ef28
    https://github.com/scummvm/scummvm/commit/314658ab1f078bf764cc49711b20f12f1472ef28
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-15T20:24:39+02:00

Commit Message:
DIRECTOR: LINGO: Added more test for \xC2

Changed paths:
    engines/director/lingo/tests/c2.lingo


diff --git a/engines/director/lingo/tests/c2.lingo b/engines/director/lingo/tests/c2.lingo
index 4922030dfa..1ba075997c 100644
--- a/engines/director/lingo/tests/c2.lingo
+++ b/engines/director/lingo/tests/c2.lingo
@@ -11,3 +11,13 @@ set the selStart to 
 
 set the selStart to Â
 0
+
+-- This comment is Â
+the continuationÂ
+of previous line
+
+   if the castNum of sprite 1 > the number of cast "StarLast" then set the castNum of sprite 1 to the number of Â
+        cast "StarFirst" end if
+
+put "HelloÂ
+World!"


Commit: 4ef5d6d62cdb5fc0d4db97d4e2423ff39cde4217
    https://github.com/scummvm/scummvm/commit/4ef5d6d62cdb5fc0d4db97d4e2423ff39cde4217
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-15T20:24:39+02:00

Commit Message:
DIRECTOR: LINGO: Fully reworked continuation symbol handling

Changed paths:
    engines/director/lingo/lingo-lex.cpp
    engines/director/lingo/lingo-lex.l
    engines/director/lingo/lingo-preprocessor.cpp
    engines/director/lingo/lingo.cpp


diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 3a6b7d2d16..9c24268235 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -364,8 +364,8 @@ static void yy_fatal_error (yyconst char msg[]  );
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
 
-#define YY_NUM_RULES 73
-#define YY_END_OF_BUFFER 74
+#define YY_NUM_RULES 70
+#define YY_END_OF_BUFFER 71
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -373,43 +373,41 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[315] =
+static yyconst flex_int16_t yy_accept[299] =
     {   0,
-        0,    0,   74,   72,    4,   70,   70,   72,   72,   72,
-       69,   69,   69,   68,   69,   65,   69,   66,   66,   66,
-       66,   66,   66,   66,   66,   66,   66,   66,   66,   66,
-       66,   66,   66,   66,   72,    3,    3,   66,    4,   70,
-        0,    0,    0,   71,    0,    5,   64,    2,   67,   68,
-       63,   61,   62,   66,   66,   66,   66,   66,   66,   66,
-       66,   66,   66,   66,   66,   12,   24,   66,   66,   66,
-       66,   66,   66,   66,   66,   34,   35,   66,   37,   66,
-       66,   66,   66,   66,   66,   66,   66,   66,   54,   66,
-       66,   66,    1,    3,    3,    0,   66,    5,    2,   67,
-
-       66,    7,   66,   66,   66,   66,   66,   15,   66,   66,
-       20,   66,   66,   66,   66,   66,   66,   66,   30,   66,
-       66,   33,   66,   66,   66,   66,   43,   66,   45,   66,
-       66,   66,   66,   66,   66,   66,   66,    0,   66,   66,
-       66,    9,   66,   11,   14,    0,   17,   66,    0,    0,
-       66,   66,   23,   25,   26,   27,   66,   66,   66,   32,
-       36,   39,   66,   66,   66,   66,   66,   47,    0,   53,
-       58,   66,   56,   60,    0,   66,    6,   66,   66,    0,
-       15,   66,    0,   20,   66,   66,   28,   66,   31,    0,
-       66,   66,   66,   66,   66,   66,   52,   52,   52,   59,
-
-       66,    0,   66,    8,   66,    0,   15,   18,    0,    0,
-       66,   66,   66,    0,   66,   66,   66,   44,   55,   46,
-        0,    0,   52,   52,   57,    0,   66,   66,   13,    0,
-       66,   66,    0,   29,    0,   66,   66,   66,    0,    0,
-        0,    0,   52,   52,    0,   16,   10,   19,   21,   66,
-       29,   29,    0,   66,   41,   42,    0,    0,    0,   52,
-       52,   16,   66,   29,    0,   40,    0,    0,    0,    0,
-       52,   22,   38,   51,   50,   51,    0,    0,    0,    0,
-       52,   50,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,   51,   50,   50,   51,
-
-        0,   49,   50,   50,    0,   50,    0,   50,    0,    0,
-        0,    0,   48,    0
+        0,    0,   71,   69,    1,   67,   67,   69,   69,   66,
+       66,   65,   66,   62,   66,   63,   63,   63,   63,   63,
+       63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
+       63,   63,    1,   63,    1,   67,    0,   68,    2,   61,
+       64,   65,   60,   58,   59,   63,   63,   63,   63,   63,
+       63,   63,   63,   63,   63,   63,   63,    9,   21,   63,
+       63,   63,   63,   63,   63,   63,   63,   31,   32,   63,
+       34,   63,   63,   63,   63,   63,   63,   63,   63,   63,
+       51,   63,   63,   63,    1,    0,   63,    2,   64,   63,
+        4,   63,   63,   63,   63,   63,   12,   63,   63,   17,
+
+       63,   63,   63,   63,   63,   63,   63,   27,   63,   63,
+       30,   63,   63,   63,   63,   40,   63,   42,   63,   63,
+       63,   63,   63,   63,   63,   63,    0,   63,   63,   63,
+        6,   63,    8,   11,    0,   14,   63,    0,    0,   63,
+       63,   20,   22,   23,   24,   63,   63,   63,   29,   33,
+       36,   63,   63,   63,   63,   63,   44,    0,   50,   55,
+       63,   53,   57,    0,   63,    3,   63,   63,    0,   12,
+       63,    0,   17,   63,   63,   25,   63,   28,    0,   63,
+       63,   63,   63,   63,   63,   49,   49,   49,   56,   63,
+        0,   63,    5,   63,    0,   12,   15,    0,    0,   63,
+
+       63,   63,    0,   63,   63,   63,   41,   52,   43,    0,
+       49,   49,   54,    0,   63,   63,   10,    0,   63,   63,
+        0,    0,   63,   63,   63,    0,    0,    0,   49,   49,
+        0,   13,    7,   16,   18,   63,   26,    0,   63,   38,
+       39,    0,    0,    0,   49,   49,   13,   63,   26,    0,
+       37,    0,    0,    0,    0,   49,   19,   35,   48,   47,
+       48,    0,    0,    0,    0,   49,   47,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+       48,   47,   47,   48,    0,   46,   47,   47,    0,   47,
+        0,   47,    0,    0,    0,    0,   45,    0
+
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -417,24 +415,24 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
         1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    5,    1,    6,    7,    1,    8,    9,    1,    8,
-        8,    8,   10,    8,   11,   12,    8,   13,   13,   13,
-       13,   13,   13,   13,   13,   13,   13,    8,    1,   14,
-       15,   16,    1,    1,   17,   18,   19,   20,   21,   22,
-       23,   24,   25,   26,   26,   27,   28,   29,   30,   31,
-       26,   32,   33,   34,   35,   36,   37,   38,   39,   26,
-        8,    1,    8,    8,   40,    1,   41,   42,   43,   44,
-
-       45,   46,   47,   48,   49,   26,   26,   50,   51,   52,
-       53,   54,   26,   55,   56,   57,   58,   59,   60,   61,
-       62,   26,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    2,    1,    5,    6,    1,    7,    8,    1,    7,
+        7,    7,    7,    7,    7,    9,    7,   10,   10,   10,
+       10,   10,   10,   10,   10,   10,   10,    7,    1,   11,
+       12,   13,    1,    1,   14,   15,   16,   17,   18,   19,
+       20,   21,   22,   23,   23,   24,   25,   26,   27,   28,
+       23,   29,   30,   31,   32,   33,   34,   35,   36,   23,
+        7,    1,    7,    7,   37,    1,   38,   39,   40,   41,
+
+       42,   43,   44,   45,   46,   23,   23,   47,   48,   49,
+       50,   51,   23,   52,   53,   54,   55,   56,   57,   58,
+       59,   23,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,   63,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    2,    1,    1,    1,    1,    1,    1,
 
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -444,305 +442,260 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[64] =
+static yyconst flex_int32_t yy_meta[60] =
     {   0,
-        1,    2,    3,    3,    2,    1,    1,    1,    1,    1,
-        1,    1,    4,    1,    1,    1,    5,    5,    5,    5,
-        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    5,    5,    5,    5,    5,    5,    5,    6,
+        1,    2,    3,    3,    1,    1,    1,    1,    1,    4,
+        1,    1,    1,    5,    5,    5,    5,    5,    5,    5,
         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
+        5,    5,    5,    5,    5,    5,    6,    5,    5,    5,
         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    1
+        5,    5,    5,    5,    5,    5,    5,    5,    5
     } ;
 
-static yyconst flex_int16_t yy_base[332] =
+static yyconst flex_int16_t yy_base[313] =
     {   0,
-        0,   62,  128,  847,   66,  847,  847,   70,   59,    0,
-      847,  115,  108,   64,   63,  847,   84,   58,   45,   58,
-       56,   62,    0,   65,   91,   68,   86,  105,  120,  109,
-       60,  126,  149,  138,   93,  196,  201,  113,  205,  847,
-      209,   98,   77,  847,  178,    0,  847,    0,   81,  133,
-      847,  847,  847,    0,   98,  133,  139,  148,  140,  156,
-      163,  195,  195,  187,  219,    0,  192,  201,  198,  198,
-      210,  197,  216,  194,  199,    0,    0,  213,    0,  220,
-      236,  228,  232,  231,  235,  228,  243,  250,    0,  252,
-      242,  247,  847,  301,  305,  257,  268,    0,    0,   72,
-
-      270,    0,  264,  264,  278,  284,  271,  233,  280,  282,
-      316,  286,  301,  297,  307,  295,  298,  308,    0,  308,
-      306,    0,  313,  305,  319,  327,    0,  324,    0,  334,
-      329,  339,  369,  341,  345,  351,  356,  358,  345,  348,
-      350,    0,  368,    0,  278,  385,    0,  369,  356,  361,
-      375,  362,    0,    0,    0,    0,  366,  367,  383,    0,
-        0,  410,  381,  386,  391,  379,  384,    0,  420,    0,
-        0,  403,  401,    0,  389,  399,    0,  412,  409,  435,
-        0,  411,  418,  437,  414,  411,    0,  425,    0,  451,
-      435,  432,  431,  430,  434,  432,  466,  472,  488,    0,
-
-      451,  451,  451,    0,  462,  453,    0,    0,  464,  503,
-      475,  474,  507,  469,  483,  472,  476,    0,    0,    0,
-      527,  497,  532,  534,    0,  490,  488,  495,  847,  490,
-      495,  524,  550,    0,  531,  532,  523,  519,  561,  542,
-      546,  544,  568,  585,  535,    0,    0,  847,    0,  541,
-        0,    0,  548,  555,    0,    0,  552,  599,  561,  605,
-      611,  847,  561,    0,  575,    0,  579,  606,  585,  617,
-      621,    0,  847,  847,    0,  847,  631,  637,  633,  638,
-      639,    0,  620,  655,  657,  662,  663,  600,  612,  670,
-      675,  680,  679,  649,  694,  701,  706,  665,  664,  716,
-
-      717,  847,  721,  725,  729,  731,  710,  736,  685,  707,
-      737,  741,  847,  847,  776,  778,  781,  784,  790,  795,
-      800,  802,  807,  812,  815,  818,  823,  828,  830,  835,
-      840
+        0,   58,  594,  671,   59,  671,  671,  585,    0,  671,
+      581,   55,   54,  671,  576,   49,   51,   49,   45,   55,
+        0,   56,   65,   78,   93,   91,   97,   98,   55,  116,
+      133,  134,  162,   72,   85,  671,  582,  671,    0,  671,
+      573,  127,  671,  671,  671,    0,   84,  122,  133,  148,
+      133,  134,  139,  154,  150,  147,  580,    0,  157,  159,
+      159,  162,  174,  162,  182,  159,  167,    0,    0,  182,
+        0,  188,  186,  175,  179,  178,  189,  189,  195,  202,
+        0,  213,  191,  196,  247,  219,  218,    0,  569,  219,
+        0,  212,  211,  215,  221,  225,  573,  221,  238,  252,
+
+      225,  246,  243,  242,  246,  247,  244,    0,  256,  249,
+        0,  255,  246,  252,  258,    0,  269,    0,  270,  265,
+      274,  298,  281,  286,  280,  295,  297,  284,  289,  290,
+        0,  306,    0,  571,  559,    0,  308,  297,  300,  314,
+      302,    0,    0,    0,    0,  305,  307,  311,    0,    0,
+      321,  317,  322,  329,  314,  317,    0,  349,    0,    0,
+      338,  336,    0,  329,  334,    0,  344,  343,  368,    0,
+      345,  362,  537,  346,  344,    0,  360,    0,  383,  363,
+      354,  358,  357,  373,  363,  534,  392,  376,    0,  373,
+      378,  380,    0,  386,  394,    0,    0,  392,  405,  402,
+
+      401,  532,  392,  407,  395,  398,    0,    0,    0,  432,
+      423,  431,    0,  409,  403,  411,  671,  418,  427,  430,
+      515,  437,  436,  427,  422,  451,  447,  445,  453,  470,
+      435,    0,    0,  671,    0,  443,    0,  452,  459,    0,
+        0,  456,  466,  463,  418,  490,  671,  463,    0,  477,
+        0,  478,  364,  480,  497,  500,    0,  671,  671,    0,
+      671,  312,  499,  502,  503,  291,    0,  513,  510,  270,
+      521,  531,  477,  499,  525,  528,  542,  534,  171,  155,
+      140,  505,  537,  130,  127,  119,  110,   83,   80,  555,
+      564,  566,  544,  552,   76,   72,   69,  671,  614,  616,
+
+      619,  622,  627,  632,  634,  639,  642,  647,  652,  654,
+      659,  664
     } ;
 
-static yyconst flex_int16_t yy_def[332] =
+static yyconst flex_int16_t yy_def[313] =
     {   0,
-      314,    1,  314,  314,  314,  314,  314,  314,  315,  316,
-      314,  314,  314,  314,  314,  314,  314,  317,  317,  317,
-      317,  317,  317,  317,  317,  317,  317,  317,  317,  317,
-      317,  317,  317,  317,  314,  314,  314,  317,  314,  314,
-      314,  314,  315,  314,  315,  318,  314,  319,  314,  314,
-      314,  314,  314,  317,  317,  317,  317,  317,  317,  317,
-      317,  317,  317,  317,  317,  317,  317,  317,  317,  317,
-      317,  317,  317,  317,  317,  317,  317,  317,  317,  317,
-      317,  317,  317,  317,  317,  317,  317,  317,  317,  317,
-      317,  317,  314,  314,  314,  314,  317,  318,  319,  314,
-
-      317,  317,  317,  317,  317,  317,  317,  317,  317,  317,
-      314,  317,  317,  317,  317,  317,  317,  317,  317,  317,
-      317,  317,  317,  317,  317,  317,  317,  317,  317,  317,
-      317,  317,  317,  317,  317,  317,  317,  314,  317,  317,
-      317,  317,  317,  317,  317,  320,  317,  317,  314,  314,
-      317,  317,  317,  317,  317,  317,  317,  317,  317,  317,
-      317,  317,  317,  317,  317,  317,  317,  317,  321,  317,
-      317,  317,  317,  317,  314,  317,  317,  317,  317,  314,
-      322,  317,  314,  314,  317,  317,  317,  317,  317,  314,
-      317,  317,  317,  317,  317,  317,  321,  321,  321,  317,
-
-      317,  314,  317,  317,  317,  314,  322,  317,  314,  314,
-      317,  317,  323,  314,  317,  317,  317,  317,  317,  317,
-      314,  314,  321,  321,  317,  314,  317,  317,  314,  314,
-      317,  317,  324,  325,  314,  317,  317,  317,  314,  314,
-      314,  314,  321,  321,  314,  317,  317,  314,  317,  317,
-      326,  325,  314,  317,  317,  317,  314,  314,  314,  321,
-      321,  314,  317,  326,  314,  317,  314,  327,  314,  328,
-      321,  317,  314,  314,  329,  314,  328,  328,  328,  328,
-      321,  329,  314,  328,  328,  328,  314,  314,  314,  328,
-      327,  328,  314,  314,  314,  314,  328,  329,  329,  328,
-
-      314,  314,  329,  329,  330,  331,  314,  331,  314,  314,
-      314,  314,  314,    0,  314,  314,  314,  314,  314,  314,
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314,
-      314
+      298,    1,  298,  298,  298,  298,  298,  299,  300,  298,
+      298,  298,  298,  298,  298,  301,  301,  301,  301,  301,
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      301,  301,  298,  301,  298,  298,  299,  298,  302,  298,
+      298,  298,  298,  298,  298,  301,  301,  301,  301,  301,
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      301,  301,  301,  301,  298,  298,  301,  302,  298,  301,
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  298,
+
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      301,  301,  301,  301,  301,  301,  298,  301,  301,  301,
+      301,  301,  301,  301,  303,  301,  301,  298,  298,  301,
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      301,  301,  301,  301,  301,  301,  301,  304,  301,  301,
+      301,  301,  301,  298,  301,  301,  301,  301,  298,  305,
+      301,  298,  298,  301,  301,  301,  301,  301,  298,  301,
+      301,  301,  301,  301,  301,  304,  304,  304,  301,  301,
+      298,  301,  301,  301,  298,  305,  301,  298,  298,  301,
+
+      301,  301,  298,  301,  301,  301,  301,  301,  301,  298,
+      304,  304,  301,  298,  301,  301,  298,  298,  301,  301,
+      306,  298,  301,  301,  301,  298,  298,  298,  304,  304,
+      298,  301,  301,  298,  301,  301,  307,  298,  301,  301,
+      301,  298,  298,  298,  304,  304,  298,  301,  307,  298,
+      301,  298,  308,  298,  309,  304,  301,  298,  298,  310,
+      298,  309,  309,  309,  309,  304,  310,  298,  309,  309,
+      309,  298,  298,  298,  309,  308,  309,  298,  298,  298,
+      309,  310,  310,  309,  298,  298,  310,  310,  311,  312,
+      298,  312,  298,  298,  298,  298,  298,    0,  298,  298,
+
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298
     } ;
 
-static yyconst flex_int16_t yy_nxt[911] =
+static yyconst flex_int16_t yy_nxt[731] =
     {   0,
-        4,    5,    6,    7,    8,    9,   10,   11,   12,   11,
-       13,    4,   14,   15,   16,   17,   18,   19,   20,   21,
-       22,   23,   24,   23,   25,   23,   26,   27,   28,   29,
-       30,   31,   32,   33,   23,   23,   34,   23,   23,   23,
-       18,   19,   20,   21,   22,   23,   24,   23,   25,   26,
-       27,   28,   29,   30,   31,   32,   33,   23,   23,   34,
-       23,   23,   35,   36,   44,   57,   37,   39,   40,   40,
-       41,   41,   40,   40,   41,   49,   50,   51,   52,   55,
-       83,   58,   44,   38,  100,   60,   56,   59,   61,   57,
-       62,   64,   69,  100,   65,   93,   93,   70,   53,   63,
-
-       93,   93,   71,   55,   83,   58,   72,   38,   60,   56,
-       59,   61,   66,   62,   64,   73,   69,   65,   48,   67,
-       70,   45,   63,   47,   68,   74,   71,  314,   42,   97,
-       72,  101,   42,  314,   75,   80,   66,  314,   73,   45,
-       81,   76,   67,   82,   49,   50,   84,   68,   77,   74,
-       78,   79,  102,   97,  101,  314,   85,   75,   80,   86,
-      103,   90,   91,   81,  104,   76,   82,   92,  105,   87,
-       84,   77,   88,   78,   79,  314,  102,  314,   89,   85,
-       43,   43,   86,   44,  103,   90,   91,  314,  104,  314,
-       92,  105,  106,   87,  314,  107,   88,   94,   40,   40,
-
-       95,   89,   95,   40,   40,   95,   39,   40,   40,   41,
-       41,   40,   40,   41,  108,  106,  110,   96,  107,  109,
-      111,  114,   96,  111,  112,  113,  115,  116,  117,  314,
-      118,  121,  122,  123,  146,  119,  124,  146,  108,  110,
-       45,   96,  314,  109,  131,  114,   96,  112,  113,  115,
-      116,  120,  117,  118,  121,  122,  125,  123,   42,  119,
-      124,  127,  128,   42,  129,  126,  130,   42,  131,  132,
-      133,   42,  134,  138,  120,  136,  135,  314,  137,  180,
-      125,  314,  180,  314,  127,  128,  139,  129,  126,  130,
-      140,  145,  132,  141,  133,  142,  134,  138,  136,  148,
-
-      135,  137,   94,   40,   40,   95,   95,   40,   40,   95,
-      139,  143,  144,  147,  140,  145,  141,  111,  142,  151,
-      111,  152,   96,  148,  154,  156,   96,  155,  314,  157,
-      153,  158,  159,  314,  143,  144,  147,  149,  314,  160,
-      314,  161,  151,  162,  165,  152,   96,  154,  156,  150,
-       96,  155,  157,  153,  163,  158,  159,  164,  166,  314,
-      167,  149,  160,   42,  161,  168,  162,   42,  165,  171,
-      169,  172,  150,  169,  173,  174,  175,  163,  176,  177,
-      164,  178,  166,  167,  179,  182,  146,  183,  168,  146,
-      184,  185,  171,  186,  172,  187,  188,  170,  173,  174,
-
-      175,  176,  177,  189,  178,  192,  193,  194,  179,  182,
-      183,  190,  195,  184,  190,  185,  186,  196,  187,  188,
-      170,  169,  202,  200,  169,  201,  191,  189,  203,  192,
-      193,  194,  204,  205,  209,  195,  180,  208,  210,  180,
-      196,  210,  211,  212,  213,  202,  198,  200,  199,  201,
-      191,  203,  190,  215,  219,  190,  204,  205,  209,  206,
-      208,  216,  217,  218,  220,  211,  212,  221,  213,  198,
-      221,  199,  214,  221,  229,  222,  221,  215,  219,  225,
-      226,  222,  227,  206,  216,  217,  218,  220,  223,  221,
-      228,  230,  221,  231,  232,  314,  214,  222,  229,  314,
-
-      235,  236,  225,  226,  210,  227,  237,  210,  233,  238,
-      248,  233,  223,  228,  230,  249,  240,  231,  232,   54,
-      314,  245,  224,  235,  149,  236,  246,  247,  239,  237,
-      242,  239,  238,  221,  248,  221,  221,  314,  221,  249,
-      240,  222,  250,  222,  245,  224,  240,  253,  149,  246,
-      247,  233,  254,  242,  233,  255,  241,  256,  257,  314,
-      242,  244,  239,  314,  243,  239,  250,  258,  259,  221,
-      240,  253,  221,  262,  263,  265,  254,  222,  255,  241,
-      256,  266,  257,  242,  244,  267,  221,  243,  269,  221,
-      241,  258,  259,  272,  222,  273,  262,  263,  265,  274,
-
-      268,  260,  261,  268,  266,  276,  270,  268,  267,  270,
-      268,  269,  221,  241,  222,  221,  272,  314,  239,  273,
-      222,  239,  221,  274,  260,  221,  261,  314,  295,  276,
-      222,  271,  283,  296,  283,  283,  278,  283,  283,  283,
-      287,  283,  283,  287,  288,  314,  279,  314,  222,  289,
-      280,  295,  281,  284,  285,  271,  283,  296,  291,  283,
-      278,  291,  286,  283,  293,  314,  283,  293,  288,  279,
-      301,  283,  289,  280,  283,  281,  268,  284,  285,  268,
-      293,  283,  240,  293,  283,  304,  286,  314,  290,  292,
-      297,  314,  294,  303,  301,  302,  242,  314,  302,  298,
-
-      300,  314,  302,  314,  299,  302,  240,  283,  294,  304,
-      283,  290,  292,  311,  297,  294,  303,  283,  305,  242,
-      283,  305,  302,  298,  300,  302,  302,  299,  312,  302,
-      305,  294,  307,  305,  309,  307,  311,  307,  313,  310,
-      307,  313,  313,  282,  314,  313,  314,  314,  282,  314,
-      314,  314,  312,  314,  314,  314,  314,  314,  309,  314,
-      314,  314,  310,  314,  314,  314,  314,  314,  275,  314,
-      282,  314,  314,  314,  314,  282,   43,   43,  314,   43,
-       43,   43,   46,   46,   54,   54,   54,   98,   98,   98,
-       99,   99,  314,   99,   99,   99,  181,  314,  314,  181,
-
-      181,  197,  314,  314,  197,  207,  207,  207,  234,  314,
-      234,  234,  234,  251,  314,  314,  251,  251,  252,  252,
-      252,  264,  264,  264,  275,  314,  314,  275,  275,  277,
-      314,  314,  277,  282,  282,  282,  306,  314,  314,  306,
-      306,  308,  314,  308,  308,  308,    3,  314,  314,  314,
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314,
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314,
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314,
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314,
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314,
-
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314
+        4,    5,    6,    7,    8,    9,   10,   11,    4,   12,
+       13,   14,   15,   16,   17,   18,   19,   20,   21,   22,
+       21,   23,   21,   24,   25,   26,   27,   28,   29,   30,
+       31,   21,   21,   32,   21,   21,   21,   16,   17,   18,
+       19,   20,   21,   22,   21,   23,   24,   25,   26,   27,
+       28,   29,   30,   31,   21,   21,   32,   21,   21,   33,
+       35,   36,   36,   41,   42,   43,   44,   47,   49,   50,
+      297,   52,   75,  297,   48,   51,   34,  297,   53,   56,
+       54,  289,   57,   58,  286,   87,   35,   36,   36,   55,
+       59,   47,   49,   50,   52,   60,   75,   48,   51,   61,
+
+       34,   53,   56,   54,   62,   57,   63,   58,   66,   87,
+       64,  286,   55,   59,   90,   68,  260,   67,   60,   65,
+      286,   72,   69,   61,   70,   71,   73,   62,  289,   74,
+       63,  268,   66,   76,   64,   41,   42,   90,   91,   68,
+       67,  268,   65,   77,   72,   69,   78,   70,   71,   73,
+       79,   92,   74,   80,   82,   83,  286,   76,   94,   81,
+       84,   93,   91,   85,   36,   36,   77,   95,   96,   78,
+       97,   98,  286,   99,   79,   92,  103,   80,   82,   83,
+       86,   94,   81,   84,  104,   93,  101,  102,  105,  106,
+       95,   96,  107,  110,   97,   98,   99,  111,  108,  112,
+
+      103,  113,  120,  114,   86,  116,  117,  104,  118,  101,
+      102,  105,  115,  106,  109,  107,  110,  119,  121,  122,
+      111,  125,  108,  112,  126,  113,  120,  114,  116,  117,
+      123,  118,  127,  128,  124,  115,  129,  109,  130,  131,
+      119,  121,  134,  122,  125,  132,  133,  126,   85,   36,
+       36,  136,  137,  100,  123,  140,  127,  128,  124,  144,
+      129,  130,  131,  141,  147,   86,  134,  143,  132,  133,
+      138,  276,  142,  145,  136,  146,  137,  148,  140,  149,
+      150,  151,  139,  144,  152,  153,  154,  141,  147,   86,
+      143,  155,  272,  156,  138,  142,  145,  157,  146,  158,
+
+      162,  148,  149,  150,  151,  139,  160,  152,  153,  161,
+      154,  163,  164,  268,  165,  155,  156,  166,  167,  168,
+      157,  171,  179,  159,  162,  172,  173,  174,  178,  160,
+      175,  176,  161,  177,  180,  163,  164,  165,  181,  182,
+      166,  167,  183,  168,  184,  171,  159,  185,  172,  173,
+      158,  174,  178,  175,  176,  189,  177,  190,  180,  191,
+      192,  193,  181,  182,  194,  253,  183,  184,  197,  169,
+      185,  200,  187,  201,  188,  198,  202,  210,  204,  189,
+      205,  190,  191,  192,  179,  193,  206,  207,  194,  195,
+      208,  197,  209,  210,  200,  187,  201,  188,  213,  198,
+
+      202,  203,  204,  205,  214,  211,  199,  212,  215,  206,
+      207,  216,  217,  195,  208,  209,  218,  219,  220,  255,
+      222,  213,  223,  138,  210,  203,  224,  214,  225,  211,
+      212,  215,  210,  210,  216,  234,  217,  231,  232,  218,
+      233,  219,  220,  222,  235,  236,  223,  138,  226,  224,
+      238,  225,  229,  239,  210,  230,  240,  241,  227,  234,
+      231,  232,  228,  233,  242,  243,  244,  253,  235,  236,
+      247,  210,  226,  248,  238,  229,  250,  239,  230,  240,
+      241,  227,  251,  245,  246,  228,  252,  254,  242,  243,
+      244,  210,  257,  247,  258,  259,  248,  261,  255,  250,
+
+      268,  210,  279,  268,  268,  251,  245,  256,  246,  252,
+      254,  268,  269,  263,  268,  257,  221,  280,  258,  259,
+      270,  261,  268,  264,  271,  279,  268,  265,  266,  276,
+      287,  256,  272,  221,  273,  210,  269,  263,  199,  274,
+      275,  280,  281,  268,  270,  277,  264,  226,  271,  282,
+      265,  266,  285,  287,  283,  288,  291,  278,  273,  284,
+      135,  228,  274,  275,  267,  291,  281,  291,  277,  295,
+      296,  226,  169,  282,  135,  267,  285,  283,   89,  288,
+      278,  100,   89,  284,  228,  293,   38,   45,   40,   38,
+      294,  267,  295,  298,  296,  298,  298,  298,  298,  298,
+
+      298,  298,  267,  298,  298,  298,  298,  298,  298,  293,
+      298,  298,  298,  294,   37,   37,  298,   37,   37,   37,
+       39,   39,   46,   46,   46,   88,   88,   88,  170,  298,
+      298,  170,  170,  186,  298,  298,  186,  196,  196,  196,
+      237,  298,  298,  237,  237,  249,  249,  249,  260,  298,
+      298,  260,  260,  262,  298,  298,  262,  267,  267,  267,
+      290,  298,  298,  290,  290,  292,  298,  292,  292,  292,
+        3,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298
     } ;
 
-static yyconst flex_int16_t yy_chk[911] =
+static yyconst flex_int16_t yy_chk[731] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    2,    9,   19,    2,    5,    5,    5,
-        5,    8,    8,    8,    8,   14,   14,   15,   15,   18,
-       31,   20,   43,    2,  100,   21,   18,   20,   22,   19,
-       22,   24,   26,   49,   24,   35,   35,   26,   17,   22,
-
-       42,   42,   27,   18,   31,   20,   27,    2,   21,   18,
-       20,   22,   25,   22,   24,   27,   26,   24,   13,   25,
-       26,    9,   22,   12,   25,   28,   27,    3,    5,   38,
-       27,   55,    8,    0,   28,   30,   25,    0,   27,   43,
-       30,   29,   25,   30,   50,   50,   32,   25,   29,   28,
-       29,   29,   56,   38,   55,    0,   32,   28,   30,   32,
-       57,   34,   34,   30,   58,   29,   30,   34,   59,   33,
-       32,   29,   33,   29,   29,    0,   56,    0,   33,   32,
-       45,   45,   32,   45,   57,   34,   34,    0,   58,    0,
-       34,   59,   60,   33,    0,   61,   33,   36,   36,   36,
-
-       36,   33,   37,   37,   37,   37,   39,   39,   39,   39,
-       41,   41,   41,   41,   62,   60,   64,   36,   61,   63,
-       65,   68,   37,   65,   67,   67,   69,   70,   71,    0,
-       72,   74,   75,   78,  108,   73,   80,  108,   62,   64,
-       45,   36,    0,   63,   86,   68,   37,   67,   67,   69,
-       70,   73,   71,   72,   74,   75,   81,   78,   36,   73,
-       80,   82,   83,   37,   84,   81,   85,   39,   86,   87,
-       88,   41,   90,   96,   73,   91,   90,    0,   92,  145,
-       81,    0,  145,    0,   82,   83,   97,   84,   81,   85,
-      101,  107,   87,  103,   88,  104,   90,   96,   91,  110,
-
-       90,   92,   94,   94,   94,   94,   95,   95,   95,   95,
-       97,  105,  106,  109,  101,  107,  103,  111,  104,  112,
-      111,  113,   94,  110,  114,  116,   95,  115,    0,  117,
-      113,  118,  120,    0,  105,  106,  109,  111,    0,  121,
-        0,  123,  112,  124,  128,  113,   94,  114,  116,  111,
-       95,  115,  117,  113,  125,  118,  120,  126,  130,    0,
-      131,  111,  121,   94,  123,  132,  124,   95,  128,  134,
-      133,  135,  111,  133,  136,  137,  138,  125,  139,  140,
-      126,  141,  130,  131,  143,  148,  146,  149,  132,  146,
-      150,  151,  134,  152,  135,  157,  158,  133,  136,  137,
-
-      138,  139,  140,  159,  141,  163,  164,  165,  143,  148,
-      149,  162,  166,  150,  162,  151,  152,  167,  157,  158,
-      133,  169,  175,  172,  169,  173,  162,  159,  176,  163,
-      164,  165,  178,  179,  183,  166,  180,  182,  184,  180,
-      167,  184,  185,  186,  188,  175,  169,  172,  169,  173,
-      162,  176,  190,  191,  195,  190,  178,  179,  183,  180,
-      182,  192,  193,  194,  196,  185,  186,  197,  188,  169,
-      197,  169,  190,  198,  206,  197,  198,  191,  195,  201,
-      202,  198,  203,  180,  192,  193,  194,  196,  198,  199,
-      205,  209,  199,  211,  212,    0,  190,  199,  206,    0,
-
-      214,  215,  201,  202,  210,  203,  216,  210,  213,  217,
-      230,  213,  198,  205,  209,  231,  222,  211,  212,  213,
-        0,  226,  199,  214,  210,  215,  227,  228,  221,  216,
-      222,  221,  217,  223,  230,  224,  223,    0,  224,  231,
-      222,  223,  232,  224,  226,  199,  221,  235,  210,  227,
-      228,  233,  236,  222,  233,  237,  221,  238,  240,    0,
-      221,  224,  239,    0,  223,  239,  232,  241,  242,  243,
-      221,  235,  243,  245,  250,  253,  236,  243,  237,  221,
-      238,  254,  240,  221,  224,  257,  244,  223,  259,  244,
-      239,  241,  242,  263,  244,  265,  245,  250,  253,  267,
-
-      258,  243,  244,  258,  254,  269,  260,  268,  257,  260,
-      268,  259,  261,  239,  260,  261,  263,    0,  270,  265,
-      261,  270,  271,  267,  243,  271,  244,    0,  288,  269,
-      271,  261,  277,  289,  279,  277,  270,  279,  278,  280,
-      281,  278,  280,  281,  283,    0,  270,    0,  281,  283,
-      270,  288,  271,  278,  279,  261,  284,  289,  285,  284,
-      270,  285,  280,  286,  287,    0,  286,  287,  283,  270,
-      294,  290,  283,  270,  290,  271,  291,  278,  279,  291,
-      293,  292,  287,  293,  292,  299,  280,    0,  284,  286,
-      290,    0,  287,  298,  294,  295,  287,    0,  295,  291,
-
-      292,    0,  296,    0,  291,  296,  287,  297,  293,  299,
-      297,  284,  286,  309,  290,  287,  298,  300,  301,  287,
-      300,  301,  303,  291,  292,  303,  304,  291,  310,  304,
-      305,  293,  306,  305,  307,  306,  309,  308,  311,  307,
-      308,  311,  312,  306,    0,  312,    0,    0,  308,    0,
-        0,    0,  310,    0,    0,    0,    0,    0,  307,    0,
-        0,    0,  307,    0,    0,    0,    0,    0,  305,    0,
-      306,    0,    0,    0,    0,  308,  315,  315,    0,  315,
-      315,  315,  316,  316,  317,  317,  317,  318,  318,  318,
-      319,  319,    0,  319,  319,  319,  320,    0,    0,  320,
-
-      320,  321,    0,    0,  321,  322,  322,  322,  323,    0,
-      323,  323,  323,  324,    0,    0,  324,  324,  325,  325,
-      325,  326,  326,  326,  327,    0,    0,  327,  327,  328,
-        0,    0,  328,  329,  329,  329,  330,    0,    0,  330,
-      330,  331,    0,  331,  331,  331,  314,  314,  314,  314,
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314,
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314,
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314,
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314,
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314,
-
-      314,  314,  314,  314,  314,  314,  314,  314,  314,  314
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
+        5,    5,    5,   12,   12,   13,   13,   16,   17,   18,
+      297,   19,   29,  296,   16,   18,    2,  295,   20,   22,
+       20,  289,   22,   23,  288,   34,   35,   35,   35,   20,
+       23,   16,   17,   18,   19,   23,   29,   16,   18,   24,
+
+        2,   20,   22,   20,   24,   22,   25,   23,   26,   34,
+       25,  287,   20,   23,   47,   27,  289,   26,   23,   25,
+      286,   28,   27,   24,   27,   27,   28,   24,  285,   28,
+       25,  284,   26,   30,   25,   42,   42,   47,   48,   27,
+       26,  281,   25,   30,   28,   27,   30,   27,   27,   28,
+       31,   49,   28,   31,   32,   32,  280,   30,   51,   31,
+       32,   50,   48,   33,   33,   33,   30,   52,   53,   30,
+       54,   55,  279,   56,   31,   49,   60,   31,   32,   32,
+       33,   51,   31,   32,   61,   50,   59,   59,   62,   63,
+       52,   53,   64,   66,   54,   55,   56,   67,   65,   70,
+
+       60,   72,   78,   73,   33,   74,   75,   61,   76,   59,
+       59,   62,   73,   63,   65,   64,   66,   77,   79,   80,
+       67,   83,   65,   70,   84,   72,   78,   73,   74,   75,
+       82,   76,   86,   87,   82,   73,   90,   65,   92,   93,
+       77,   79,   96,   80,   83,   94,   95,   84,   85,   85,
+       85,   98,   99,  100,   82,  101,   86,   87,   82,  104,
+       90,   92,   93,  102,  107,   85,   96,  103,   94,   95,
+      100,  270,  102,  105,   98,  106,   99,  109,  101,  110,
+      112,  113,  100,  104,  114,  115,  117,  102,  107,   85,
+      103,  119,  266,  120,  100,  102,  105,  121,  106,  122,
+
+      125,  109,  110,  112,  113,  100,  123,  114,  115,  124,
+      117,  126,  127,  262,  128,  119,  120,  129,  130,  132,
+      121,  137,  151,  122,  125,  138,  139,  140,  148,  123,
+      141,  146,  124,  147,  151,  126,  127,  128,  152,  153,
+      129,  130,  154,  132,  155,  137,  122,  156,  138,  139,
+      158,  140,  148,  141,  146,  161,  147,  162,  151,  164,
+      165,  167,  152,  153,  168,  253,  154,  155,  171,  169,
+      156,  174,  158,  175,  158,  172,  177,  188,  180,  161,
+      181,  162,  164,  165,  179,  167,  182,  183,  168,  169,
+      184,  171,  185,  187,  174,  158,  175,  158,  190,  172,
+
+      177,  179,  180,  181,  191,  187,  199,  188,  192,  182,
+      183,  194,  195,  169,  184,  185,  198,  200,  201,  245,
+      203,  190,  204,  199,  211,  179,  205,  191,  206,  187,
+      188,  192,  212,  210,  194,  218,  195,  214,  215,  198,
+      216,  200,  201,  203,  219,  220,  204,  199,  210,  205,
+      222,  206,  211,  223,  229,  212,  224,  225,  210,  218,
+      214,  215,  210,  216,  226,  227,  228,  243,  219,  220,
+      231,  230,  210,  236,  222,  211,  238,  223,  212,  224,
+      225,  210,  239,  229,  230,  210,  242,  244,  226,  227,
+      228,  246,  248,  231,  250,  252,  236,  254,  255,  238,
+
+      263,  256,  273,  264,  265,  239,  229,  246,  230,  242,
+      244,  269,  263,  255,  268,  248,  221,  274,  250,  252,
+      264,  254,  271,  255,  265,  273,  275,  255,  256,  276,
+      282,  246,  272,  202,  268,  186,  263,  255,  173,  268,
+      269,  274,  275,  277,  264,  271,  255,  272,  265,  276,
+      255,  256,  278,  282,  276,  283,  290,  272,  268,  277,
+      135,  272,  268,  269,  290,  291,  275,  292,  271,  293,
+      294,  272,  134,  276,   97,  292,  278,  276,   89,  283,
+      272,   57,   41,  277,  272,  291,   37,   15,   11,    8,
+      291,  290,  293,    3,  294,    0,    0,    0,    0,    0,
+
+        0,    0,  292,    0,    0,    0,    0,    0,    0,  291,
+        0,    0,    0,  291,  299,  299,    0,  299,  299,  299,
+      300,  300,  301,  301,  301,  302,  302,  302,  303,    0,
+        0,  303,  303,  304,    0,    0,  304,  305,  305,  305,
+      306,    0,    0,  306,  306,  307,  307,  307,  308,    0,
+        0,  308,  308,  309,    0,    0,  309,  310,  310,  310,
+      311,    0,    0,  311,  311,  312,    0,  312,  312,  312,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -808,13 +761,13 @@ static void count() {
 	g_lingo->_lasttoken = yytext;
 	g_lingo->_lastbytenumber = g_lingo->_bytenumber;
 
-	while (*p && *p != '\n' && *p != '\r') {
+	while (*p && *p != '\n' && *p != '\r' && *p != '\xC2') {
 		p++;
 		g_lingo->_colnumber++;
 		g_lingo->_bytenumber++;
 	}
 
-	while (*p == '\n' || *p == '\r') {
+	while (*p == '\n' || *p == '\r' || *p == '\xC2') {
 		if (*p == '\n') {
 			g_lingo->_linenumber++;
 			g_lingo->_colnumber = 0;
@@ -840,7 +793,7 @@ static Common::String *cleanupString(const char *s) {
 	while (*s) {
 		if (*s == '\xC2') {
 			s++;
-			s++;
+			*res += ' ';
 			continue;
 		}
 		*res += *s;
@@ -850,7 +803,7 @@ static Common::String *cleanupString(const char *s) {
 	return res;
 }
 
-#line 854 "engines/director/lingo/lingo-lex.cpp"
+#line 807 "engines/director/lingo/lingo-lex.cpp"
 
 #define INITIAL 0
 
@@ -1038,7 +991,7 @@ YY_DECL
 #line 108 "engines/director/lingo/lingo-lex.l"
 
 
-#line 1042 "engines/director/lingo/lingo-lex.cpp"
+#line 995 "engines/director/lingo/lingo-lex.cpp"
 
 	if ( !(yy_init) )
 		{
@@ -1092,13 +1045,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 315 )
+				if ( yy_current_state >= 299 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_current_state != 314 );
+		while ( yy_current_state != 298 );
 		yy_cp = (yy_last_accepting_cpos);
 		yy_current_state = (yy_last_accepting_state);
 
@@ -1119,84 +1072,68 @@ do_action:	/* This label is used only to access EOF actions. */
 			goto yy_find_action;
 
 case 1:
-/* rule 1 can match eol */
 YY_RULE_SETUP
 #line 110 "engines/director/lingo/lingo-lex.l"
 { count(); }
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 111 "engines/director/lingo/lingo-lex.l"
-
+#line 112 "engines/director/lingo/lingo-lex.l"
+{ count(); yylval.s = new Common::String(yytext + 1); return SYMBOL; }	// D3, skip '#'
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 112 "engines/director/lingo/lingo-lex.l"
-{ count(); }
+#line 114 "engines/director/lingo/lingo-lex.l"
+{ count(); return tAFTER; }		// D3
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 113 "engines/director/lingo/lingo-lex.l"
-{ count(); return ' '; }
+#line 115 "engines/director/lingo/lingo-lex.l"
+{ count(); return tAND; }
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 115 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.s = new Common::String(yytext + 1); return SYMBOL; }	// D3, skip '#'
+#line 116 "engines/director/lingo/lingo-lex.l"
+{ count(); return tBEFORE; }	// D3
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
 #line 117 "engines/director/lingo/lingo-lex.l"
-{ count(); return tAFTER; }		// D3
+{ count(); return tCHAR; }		// D3
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
 #line 118 "engines/director/lingo/lingo-lex.l"
-{ count(); return tAND; }
+{ count(); return tCONTAINS; }
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
 #line 119 "engines/director/lingo/lingo-lex.l"
-{ count(); return tBEFORE; }	// D3
+{ count(); return tDOWN; }
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
 #line 120 "engines/director/lingo/lingo-lex.l"
-{ count(); return tCHAR; }		// D3
+{ count(); return tIF; }
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
 #line 121 "engines/director/lingo/lingo-lex.l"
-{ count(); return tCONTAINS; }
+{ count(); return tELSIF; }
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
 #line 122 "engines/director/lingo/lingo-lex.l"
-{ count(); return tDOWN; }
+{ count(); return tELSE; }
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
 #line 123 "engines/director/lingo/lingo-lex.l"
-{ count(); return tIF; }
-	YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 124 "engines/director/lingo/lingo-lex.l"
-{ count(); return tELSIF; }
-	YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 125 "engines/director/lingo/lingo-lex.l"
-{ count(); return tELSE; }
-	YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 126 "engines/director/lingo/lingo-lex.l"
 {
 		count();
 
 		const char *ptr = &yytext[4]; // Skip 'end '
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		if (!scumm_stricmp(ptr, "if"))
@@ -1211,79 +1148,79 @@ YY_RULE_SETUP
 		return ENDCLAUSE;
 	}
 	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 141 "engines/director/lingo/lingo-lex.l"
+{ count(); return tFACTORY; }
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 142 "engines/director/lingo/lingo-lex.l"
+{ count(); return tEXIT; }
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 143 "engines/director/lingo/lingo-lex.l"
+{ count(); return tGLOBAL; }
+	YY_BREAK
 case 16:
 YY_RULE_SETUP
 #line 144 "engines/director/lingo/lingo-lex.l"
-{ count(); return tFACTORY; }
+{ count(); return tGO; }
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
 #line 145 "engines/director/lingo/lingo-lex.l"
-{ count(); return tEXIT; }
+{ count(); return tGO; }
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
 #line 146 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGLOBAL; }
+{ count(); return tINSTANCE; }
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
 #line 147 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGO; }
+{ count(); return tINTERSECTS; }
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
 #line 148 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGO; }
+{ count(); return tINTO; }
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
 #line 149 "engines/director/lingo/lingo-lex.l"
-{ count(); return tINSTANCE; }
+{ count(); return tIN; }
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
 #line 150 "engines/director/lingo/lingo-lex.l"
-{ count(); return tINTERSECTS; }
+{ count(); return tITEM; }
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
 #line 151 "engines/director/lingo/lingo-lex.l"
-{ count(); return tINTO; }
+{ count(); return tLINE; }
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
 #line 152 "engines/director/lingo/lingo-lex.l"
-{ count(); return tIN; }
+{ count(); return checkImmediate(tLOOP); }
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
 #line 153 "engines/director/lingo/lingo-lex.l"
-{ count(); return tITEM; }
+{ count(); return tMACRO; }
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
 #line 154 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLINE; }
-	YY_BREAK
-case 27:
-YY_RULE_SETUP
-#line 155 "engines/director/lingo/lingo-lex.l"
-{ count(); return checkImmediate(tLOOP); }
-	YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 156 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMACRO; }
-	YY_BREAK
-case 29:
-YY_RULE_SETUP
-#line 157 "engines/director/lingo/lingo-lex.l"
 {
 		count();
 
 		const char *ptr = &yytext[6]; // Skip 'method '
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		yylval.s = new Common::String(ptr);
@@ -1291,113 +1228,113 @@ YY_RULE_SETUP
 		return tMETHOD;
 	}
 	YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 165 "engines/director/lingo/lingo-lex.l"
+{ count(); return tMOD; }
+	YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 166 "engines/director/lingo/lingo-lex.l"
+{ count(); return tMOVIE; }
+	YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 167 "engines/director/lingo/lingo-lex.l"
+{ count(); return tNEXT; }
+	YY_BREAK
 case 30:
 YY_RULE_SETUP
 #line 168 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMOD; }
+{ count(); return tNOT; }
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
 #line 169 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMOVIE; }
+{ count(); return tOF; }
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
 #line 170 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEXT; }
+{ count(); return tON; }		// D3
 	YY_BREAK
 case 33:
 YY_RULE_SETUP
 #line 171 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNOT; }
+{ count(); return tOPEN; }
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
 #line 172 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOF; }
+{ count(); return tOR; }
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
 #line 173 "engines/director/lingo/lingo-lex.l"
-{ count(); return tON; }		// D3
+{ count(); return tPLAY; }
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
 #line 174 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOPEN; }
+{ count(); return tPLAY; }
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
 #line 175 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOR; }
+{ count(); yylval.s = new Common::String(yytext); return tPLAYACCEL; }
 	YY_BREAK
 case 38:
 YY_RULE_SETUP
 #line 176 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPLAY; }
+{ count(); return tPREVIOUS; }
 	YY_BREAK
 case 39:
 YY_RULE_SETUP
 #line 177 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPLAY; }
+{ count(); return tPROPERTY; }	// D4
 	YY_BREAK
 case 40:
 YY_RULE_SETUP
 #line 178 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.s = new Common::String(yytext); return tPLAYACCEL; }
+{ count(); return tPUT; }
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
 #line 179 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPREVIOUS; }
+{ count(); return checkImmediate(tREPEAT); }
 	YY_BREAK
 case 42:
 YY_RULE_SETUP
 #line 180 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPROPERTY; }	// D4
+{ count(); return tSET; }
 	YY_BREAK
 case 43:
 YY_RULE_SETUP
 #line 181 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPUT; }
+{ count(); return tSTARTS; }
 	YY_BREAK
 case 44:
 YY_RULE_SETUP
 #line 182 "engines/director/lingo/lingo-lex.l"
-{ count(); return checkImmediate(tREPEAT); }
+{ count(); return tTELL; }
 	YY_BREAK
 case 45:
 YY_RULE_SETUP
 #line 183 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSET; }
-	YY_BREAK
-case 46:
-YY_RULE_SETUP
-#line 184 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSTARTS; }
-	YY_BREAK
-case 47:
-YY_RULE_SETUP
-#line 185 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTELL; }
-	YY_BREAK
-case 48:
-YY_RULE_SETUP
-#line 186 "engines/director/lingo/lingo-lex.l"
 {
 		count();
 
 		const char *ptr = &yytext[4]; // Skip 'the '
-		while (*ptr == ' ' || *ptr == '\t') ptr++;
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2') ptr++;
 
 		ptr += 6; // skip 'number '
-		while (*ptr == ' ' || *ptr == '\t') ptr++;
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2') ptr++;
 
 		ptr += 3; // Skip 'of '
-		while (*ptr == ' ' || *ptr == '\t') ptr++;
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2') ptr++;
 
 		Common::String field;
-		while (*ptr != ' ' && *ptr != '\t')
+		while (*ptr != ' ' && *ptr != '\t' && *ptr != '\xC2')
 			field += *ptr++;
 
 		// the number of menuItems of menu <xx>
@@ -1420,9 +1357,9 @@ YY_RULE_SETUP
 		}
 	}
 	YY_BREAK
-case 49:
+case 46:
 YY_RULE_SETUP
-#line 221 "engines/director/lingo/lingo-lex.l"
+#line 218 "engines/director/lingo/lingo-lex.l"
 {
 		count();
 
@@ -1446,26 +1383,26 @@ YY_RULE_SETUP
 		}
 	}
 	YY_BREAK
-case 50:
+case 47:
 YY_RULE_SETUP
-#line 243 "engines/director/lingo/lingo-lex.l"
+#line 240 "engines/director/lingo/lingo-lex.l"
 {
 		count();
 
 		const char *ptr = &yytext[4]; // Skip 'the '
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		Common::String field;
-		while (*ptr != ' ' && *ptr != '\t')
+		while (*ptr != ' ' && *ptr != '\t' && *ptr != '\xC2')
 			field += *ptr++;
 
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		ptr += 3; // Skip 'of '
 
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		if (g_lingo->_theEntities.contains(ptr)) {
@@ -1513,21 +1450,21 @@ YY_RULE_SETUP
 		warning("LEXER: Unhandled the entity '%s', field '%s'", ptr, field.c_str());
 	}
 	YY_BREAK
-case 51:
+case 48:
 YY_RULE_SETUP
-#line 306 "engines/director/lingo/lingo-lex.l"
+#line 303 "engines/director/lingo/lingo-lex.l"
 {
 		count();
 
 		const char *ptr = &yytext[4]; // Skip 'the '
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		Common::String field;
-		while (*ptr != ' ' && *ptr != '\t')
+		while (*ptr != ' ' && *ptr != '\t' && *ptr != '\xC2')
 			field += *ptr++;
 
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		field = Common::String::format("%d%s", g_lingo->_theEntities[ptr]->entity, field.c_str());
@@ -1551,14 +1488,14 @@ YY_RULE_SETUP
 			return THEENTITY;
 	}
 	YY_BREAK
-case 52:
+case 49:
 YY_RULE_SETUP
-#line 340 "engines/director/lingo/lingo-lex.l"
+#line 337 "engines/director/lingo/lingo-lex.l"
 {
 		count();
 
 		const char *ptr = &yytext[4]; // Skip 'the '
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		if (g_lingo->_theEntities.contains(ptr)) {
@@ -1582,74 +1519,74 @@ YY_RULE_SETUP
 		warning("LEXER: Unhandled the entity '%s'", ptr);
 	}
 	YY_BREAK
-case 53:
+case 50:
 YY_RULE_SETUP
-#line 367 "engines/director/lingo/lingo-lex.l"
+#line 364 "engines/director/lingo/lingo-lex.l"
 { count(); return tTHEN; }
 	YY_BREAK
-case 54:
+case 51:
 YY_RULE_SETUP
-#line 368 "engines/director/lingo/lingo-lex.l"
+#line 365 "engines/director/lingo/lingo-lex.l"
 { count(); return tTO; }
 	YY_BREAK
-case 55:
+case 52:
 YY_RULE_SETUP
-#line 369 "engines/director/lingo/lingo-lex.l"
+#line 366 "engines/director/lingo/lingo-lex.l"
 { count(); return tSPRITE; }
 	YY_BREAK
-case 56:
+case 53:
 YY_RULE_SETUP
-#line 370 "engines/director/lingo/lingo-lex.l"
+#line 367 "engines/director/lingo/lingo-lex.l"
 { count(); return tWITH; }
 	YY_BREAK
-case 57:
+case 54:
 YY_RULE_SETUP
-#line 371 "engines/director/lingo/lingo-lex.l"
+#line 368 "engines/director/lingo/lingo-lex.l"
 { count(); return tWITHIN; }
 	YY_BREAK
-case 58:
+case 55:
 YY_RULE_SETUP
-#line 372 "engines/director/lingo/lingo-lex.l"
+#line 369 "engines/director/lingo/lingo-lex.l"
 { count(); return tWHEN; }
 	YY_BREAK
-case 59:
+case 56:
 YY_RULE_SETUP
-#line 373 "engines/director/lingo/lingo-lex.l"
+#line 370 "engines/director/lingo/lingo-lex.l"
 { count(); return tWHILE; }
 	YY_BREAK
-case 60:
+case 57:
 YY_RULE_SETUP
-#line 374 "engines/director/lingo/lingo-lex.l"
+#line 371 "engines/director/lingo/lingo-lex.l"
 { count(); return tWORD; }
 	YY_BREAK
-case 61:
+case 58:
 YY_RULE_SETUP
-#line 376 "engines/director/lingo/lingo-lex.l"
+#line 373 "engines/director/lingo/lingo-lex.l"
 { count(); return tNEQ; }
 	YY_BREAK
-case 62:
+case 59:
 YY_RULE_SETUP
-#line 377 "engines/director/lingo/lingo-lex.l"
+#line 374 "engines/director/lingo/lingo-lex.l"
 { count(); return tGE; }
 	YY_BREAK
-case 63:
+case 60:
 YY_RULE_SETUP
-#line 378 "engines/director/lingo/lingo-lex.l"
+#line 375 "engines/director/lingo/lingo-lex.l"
 { count(); return tLE; }
 	YY_BREAK
-case 64:
+case 61:
 YY_RULE_SETUP
-#line 379 "engines/director/lingo/lingo-lex.l"
+#line 376 "engines/director/lingo/lingo-lex.l"
 { count(); return tCONCAT; }
 	YY_BREAK
-case 65:
+case 62:
 YY_RULE_SETUP
-#line 380 "engines/director/lingo/lingo-lex.l"
+#line 377 "engines/director/lingo/lingo-lex.l"
 { count(); return tEQ; }
 	YY_BREAK
-case 66:
+case 63:
 YY_RULE_SETUP
-#line 382 "engines/director/lingo/lingo-lex.l"
+#line 379 "engines/director/lingo/lingo-lex.l"
 {
 		count();
 		yylval.s = new Common::String(yytext);
@@ -1685,44 +1622,43 @@ YY_RULE_SETUP
 		return ID;
 	}
 	YY_BREAK
-case 67:
+case 64:
 YY_RULE_SETUP
-#line 416 "engines/director/lingo/lingo-lex.l"
+#line 413 "engines/director/lingo/lingo-lex.l"
 { count(); yylval.f = atof(yytext); return FLOAT; }
 	YY_BREAK
-case 68:
+case 65:
 YY_RULE_SETUP
-#line 417 "engines/director/lingo/lingo-lex.l"
+#line 414 "engines/director/lingo/lingo-lex.l"
 { count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
 	YY_BREAK
-case 69:
+case 66:
 YY_RULE_SETUP
-#line 418 "engines/director/lingo/lingo-lex.l"
+#line 415 "engines/director/lingo/lingo-lex.l"
 { count(); return *yytext; }
 	YY_BREAK
-case 70:
-/* rule 70 can match eol */
+case 67:
+/* rule 67 can match eol */
 YY_RULE_SETUP
-#line 419 "engines/director/lingo/lingo-lex.l"
+#line 416 "engines/director/lingo/lingo-lex.l"
 { count(); return '\n'; }
 	YY_BREAK
-case 71:
-/* rule 71 can match eol */
+case 68:
 YY_RULE_SETUP
-#line 420 "engines/director/lingo/lingo-lex.l"
+#line 417 "engines/director/lingo/lingo-lex.l"
 { count(); yylval.s = cleanupString(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
 	YY_BREAK
-case 72:
+case 69:
 YY_RULE_SETUP
-#line 421 "engines/director/lingo/lingo-lex.l"
+#line 418 "engines/director/lingo/lingo-lex.l"
 { count(); }
 	YY_BREAK
-case 73:
+case 70:
 YY_RULE_SETUP
-#line 423 "engines/director/lingo/lingo-lex.l"
+#line 420 "engines/director/lingo/lingo-lex.l"
 ECHO;
 	YY_BREAK
-#line 1726 "engines/director/lingo/lingo-lex.cpp"
+#line 1662 "engines/director/lingo/lingo-lex.cpp"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -2016,7 +1952,7 @@ static int yy_get_next_buffer (void)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 315 )
+			if ( yy_current_state >= 299 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -2044,11 +1980,11 @@ static int yy_get_next_buffer (void)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 315 )
+		if ( yy_current_state >= 299 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 314);
+	yy_is_jam = (yy_current_state == 298);
 
 	return yy_is_jam ? 0 : yy_current_state;
 }
@@ -2719,7 +2655,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 423 "engines/director/lingo/lingo-lex.l"
+#line 420 "engines/director/lingo/lingo-lex.l"
 
 
 
@@ -2745,7 +2681,7 @@ bool lex_check_parens() {
 	const char *ptr = &inputbuffer[g_lingo->_lastbytenumber];
 
 	while (*ptr && *ptr != '\n') {
-		if (*ptr != ')' && *ptr != '(' && *ptr != ' ' && *ptr != '\xC2')
+		if (*ptr != ')' && *ptr != '(' && *ptr != ' ' && *ptr != '\t' && *ptr != '\xC2')
 			return false;
 
 		ptr++;
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 53b8e351bc..b06c1c27f3 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -53,13 +53,13 @@ static void count() {
 	g_lingo->_lasttoken = yytext;
 	g_lingo->_lastbytenumber = g_lingo->_bytenumber;
 
-	while (*p && *p != '\n' && *p != '\r') {
+	while (*p && *p != '\n' && *p != '\r' && *p != '\xC2') {
 		p++;
 		g_lingo->_colnumber++;
 		g_lingo->_bytenumber++;
 	}
 
-	while (*p == '\n' || *p == '\r') {
+	while (*p == '\n' || *p == '\r' || *p == '\xC2') {
 		if (*p == '\n') {
 			g_lingo->_linenumber++;
 			g_lingo->_colnumber = 0;
@@ -85,7 +85,7 @@ static Common::String *cleanupString(const char *s) {
 	while (*s) {
 		if (*s == '\xC2') {
 			s++;
-			s++;
+			*res += ' ';
 			continue;
 		}
 		*res += *s;
@@ -100,17 +100,14 @@ static Common::String *cleanupString(const char *s) {
 identifier [_[:alpha:]][_[:alnum:]]*
 constfloat [[:digit:]]+\.[[:digit:]]*
 constinteger [[:digit:]]+
-conststring \"([^\"\r\n]|\xC2[\r\n])*\"
+conststring \"[^\"\r\n]*\"
 operator [-+*/%^:,()><&\[\]]
-newline [ \t]*[\n\r]
-whitespace [ \t]
+newline [ \t\xC2]*[\n\r]
+spc [ \t\xC2]
 
 %%
 
-{whitespace}*\xC2[\r\n]	{ count(); }
---[^\r\n]*
-^{whitespace}+	{ count(); }
-[\t]+			{ count(); return ' '; }
+{spc}+		{ count(); }
 
 [#]{identifier}	{ count(); yylval.s = new Common::String(yytext + 1); return SYMBOL; }	// D3, skip '#'
 
@@ -121,13 +118,13 @@ char		{ count(); return tCHAR; }		// D3
 contains	{ count(); return tCONTAINS; }
 down		{ count(); return tDOWN; }
 if			{ count(); return tIF; }
-else[ \t]+if { count(); return tELSIF; }
+else{spc}+if { count(); return tELSIF; }
 else		{ count(); return tELSE; }
-end([ \t]+{identifier})?	{
+end({spc}+{identifier})?	{
 		count();
 
 		const char *ptr = &yytext[4]; // Skip 'end '
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		if (!scumm_stricmp(ptr, "if"))
@@ -141,11 +138,11 @@ end([ \t]+{identifier})?	{
 
 		return ENDCLAUSE;
 	}
-^[ \t]*factory { count(); return tFACTORY; }
+^{spc}*factory { count(); return tFACTORY; }
 exit		{ count(); return tEXIT; }
 global		{ count(); return tGLOBAL; }
-go[ \t]+(to[ \t]+)?frame	{ count(); return tGO; }
-go[ \t]+(to)?	{ count(); return tGO; }
+go{spc}+(to{spc}+)?frame	{ count(); return tGO; }
+go{spc}+(to)?	{ count(); return tGO; }
 instance	{ count(); return tINSTANCE; }
 intersects	{ count(); return tINTERSECTS; }
 into		{ count(); return tINTO; }
@@ -154,11 +151,11 @@ item		{ count(); return tITEM; }
 line		{ count(); return tLINE; }
 loop		{ count(); return checkImmediate(tLOOP); }
 macro		{ count(); return tMACRO; }
-method[ \t]*{identifier}		{
+method{spc}+{identifier}		{
 		count();
 
 		const char *ptr = &yytext[6]; // Skip 'method '
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		yylval.s = new Common::String(ptr);
@@ -173,7 +170,7 @@ of			{ count(); return tOF; }
 on			{ count(); return tON; }		// D3
 open		{ count(); return tOPEN; }
 or			{ count(); return tOR; }
-play[ \t]+frame	{ count(); return tPLAY; }
+play{spc}+frame	{ count(); return tPLAY; }
 play		{ count(); return tPLAY; }
 playAccel	{ count(); yylval.s = new Common::String(yytext); return tPLAYACCEL; }
 previous	{ count(); return tPREVIOUS; }
@@ -183,20 +180,20 @@ repeat		{ count(); return checkImmediate(tREPEAT); }
 set			{ count(); return tSET; }
 starts		{ count(); return tSTARTS; }
 tell		{ count(); return tTELL; }
-the[ \t]+number[ \t]+of[ \t]+[[:alpha:]]+[ \t](in|of)[ \t]	{
+the{spc}+number{spc}+of{spc}+[[:alpha:]]+{spc}+(in|of){spc}+ {
 		count();
 
 		const char *ptr = &yytext[4]; // Skip 'the '
-		while (*ptr == ' ' || *ptr == '\t') ptr++;
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2') ptr++;
 
 		ptr += 6; // skip 'number '
-		while (*ptr == ' ' || *ptr == '\t') ptr++;
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2') ptr++;
 
 		ptr += 3; // Skip 'of '
-		while (*ptr == ' ' || *ptr == '\t') ptr++;
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2') ptr++;
 
 		Common::String field;
-		while (*ptr != ' ' && *ptr != '\t')
+		while (*ptr != ' ' && *ptr != '\t' && *ptr != '\xC2')
 			field += *ptr++;
 
 		// the number of menuItems of menu <xx>
@@ -218,7 +215,7 @@ the[ \t]+number[ \t]+of[ \t]+[[:alpha:]]+[ \t](in|of)[ \t]	{
 			return LEXERROR;
 		}
 	}
-the[ \t]+last[ \t][[:alpha:]]+[ \t](in|of)[ \t]	{
+the{spc}+last{spc}+[[:alpha:]]+{spc}+(in|of){spc}+	{
 		count();
 
 		const char *ptr = &yytext[4]; // Skip 'the '
@@ -240,23 +237,23 @@ the[ \t]+last[ \t][[:alpha:]]+[ \t](in|of)[ \t]	{
 			return LEXERROR;
 		}
 	}
-the[ \t]+[[:alpha:]]+[ \t]+of[ \t]+{identifier}	{
+the{spc}+[[:alpha:]]+{spc}+of{spc}+{identifier}	{
 		count();
 
 		const char *ptr = &yytext[4]; // Skip 'the '
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		Common::String field;
-		while (*ptr != ' ' && *ptr != '\t')
+		while (*ptr != ' ' && *ptr != '\t' && *ptr != '\xC2')
 			field += *ptr++;
 
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		ptr += 3; // Skip 'of '
 
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		if (g_lingo->_theEntities.contains(ptr)) {
@@ -303,18 +300,18 @@ the[ \t]+[[:alpha:]]+[ \t]+of[ \t]+{identifier}	{
 
 		warning("LEXER: Unhandled the entity '%s', field '%s'", ptr, field.c_str());
 	}
-the[ \t]+[[:alpha:]]+[ \t+](date|time)		{
+the{spc}+[[:alpha:]]+{spc}+(date|time)		{
 		count();
 
 		const char *ptr = &yytext[4]; // Skip 'the '
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		Common::String field;
-		while (*ptr != ' ' && *ptr != '\t')
+		while (*ptr != ' ' && *ptr != '\t' && *ptr != '\xC2')
 			field += *ptr++;
 
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		field = Common::String::format("%d%s", g_lingo->_theEntities[ptr]->entity, field.c_str());
@@ -337,11 +334,11 @@ the[ \t]+[[:alpha:]]+[ \t+](date|time)		{
 		else
 			return THEENTITY;
 	}
-the[ \t]+[[:alpha:]]+		{
+the{spc}+[[:alpha:]]+		{
 		count();
 
 		const char *ptr = &yytext[4]; // Skip 'the '
-		while (*ptr == ' ' || *ptr == '\t')
+		while (*ptr == ' ' || *ptr == '\t' || *ptr == '\xC2')
 			ptr++;
 
 		if (g_lingo->_theEntities.contains(ptr)) {
@@ -373,11 +370,11 @@ when			{ count(); return tWHEN; }
 while			{ count(); return tWHILE; }
 word			{ count(); return tWORD; }
 
-[<][>]				{ count(); return tNEQ; }
-[>][=]				{ count(); return tGE; }
-[<][=]				{ count(); return tLE; }
-[&][&]				{ count(); return tCONCAT; }
-[=]					{ count(); return tEQ; }
+[<][>]			{ count(); return tNEQ; }
+[>][=]			{ count(); return tGE; }
+[<][=]			{ count(); return tLE; }
+[&][&]			{ count(); return tCONCAT; }
+[=]				{ count(); return tEQ; }
 
 {identifier}		{
 		count();
@@ -444,7 +441,7 @@ bool lex_check_parens() {
 	const char *ptr = &inputbuffer[g_lingo->_lastbytenumber];
 
 	while (*ptr && *ptr != '\n') {
-		if (*ptr != ')' && *ptr != '(' && *ptr != ' ' && *ptr != '\xC2')
+		if (*ptr != ')' && *ptr != '(' && *ptr != ' ' && *ptr != '\t' && *ptr != '\xC2')
 			return false;
 
 		ptr++;
diff --git a/engines/director/lingo/lingo-preprocessor.cpp b/engines/director/lingo/lingo-preprocessor.cpp
index ab5c1e65df..9e0f4627e1 100644
--- a/engines/director/lingo/lingo-preprocessor.cpp
+++ b/engines/director/lingo/lingo-preprocessor.cpp
@@ -37,7 +37,7 @@ static Common::String nexttok(const char *s, const char **newP = nullptr) {
 	Common::String res;
 
 	// Scan first non-whitespace
-	while (*s && (*s == ' ' || *s == '\t')) // If we see a whitespace
+	while (*s && (*s == ' ' || *s == '\t' || *s == '\xC2')) // If we see a whitespace
 		s++;
 
 	if (Common::isAlnum(*s)) {
@@ -59,7 +59,7 @@ static Common::String prevtok(const char *s, const char *lineStart, const char *
 	Common::String res;
 
 	// Scan first non-whitespace
-	while (s >= lineStart && (*s == ' ' || *s == '\t')) // If we see a whitespace
+	while (s >= lineStart && (*s == ' ' || *s == '\t' || *s == '\xC2')) // If we see a whitespace
 		if (s > lineStart) {
 			s--;
 		} else {
@@ -85,6 +85,25 @@ static Common::String prevtok(const char *s, const char *lineStart, const char *
 Common::String Lingo::codePreprocessor(const char *s, bool simple) {
 	Common::String res;
 
+	// We start from processing the continuation synbols
+	// \xC2\n  ->  \xC2
+	// This will greatly simplify newline processing, still leaving
+	// the line number tracking intact
+	while (*s) {
+		if (*s == '\xC2') {
+			res += *s++;
+			if (!*s)	// Who knows, maybe it is the last symbol in the script
+				break;
+			s++;
+			continue;
+		}
+		res += *s++;
+	}
+
+	Common::String tmp(res);
+	res.clear();
+	s = tmp.c_str();
+
 	// Strip comments
 	while (*s) {
 		if (*s == '-' && *(s + 1) == '-') { // At the end of the line we will have \0
@@ -101,16 +120,16 @@ Common::String Lingo::codePreprocessor(const char *s, bool simple) {
 			s++;
 	}
 
-	Common::String tmp(res);
+	tmp = res;
 	res.clear();
 
 	// Strip trailing whitespaces
 	s = tmp.c_str();
 	while (*s) {
-		if (*s == ' ' || *s == '\t') { // If we see a whitespace
+		if (*s == ' ' || *s == '\t' || *s == '\xC2') { // If we see a whitespace
 			const char *ps = s; // Remember where we saw it
 
-			while (*ps == ' ' || *ps == '\t')	// Scan until end of whitespaces
+			while (*ps == ' ' || *ps == '\t' || *ps == '\xC2') // Scan until end of whitespaces
 				ps++;
 
 			if (*ps) {	// Not end of the string
@@ -151,16 +170,8 @@ Common::String Lingo::codePreprocessor(const char *s, bool simple) {
 
 		// Get next line
 		while (*s && *s != '\n') { // If we see a whitespace
-			if (*s == '\xc2') {
-				res1 += *s++;
-				if (*s == '\n') {
-					line += ' ';
-					res1 += *s++;
-				}
-			} else {
-				res1 += *s;
-				line += tolower(*s++);
-			}
+			res1 += *s;
+			line += tolower(*s++);
 		}
 		debugC(2, kDebugLingoParse, "line: %d                         '%s'", iflevel, line.c_str());
 
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index b344c3c0cb..acdff6b961 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -287,7 +287,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
 		return;
 	}
 
-	// Strip comments for ease of the parser
+	// Preprocess the code for ease of the parser
 	Common::String codeNorm = codePreprocessor(code);
 	code = codeNorm.c_str();
 	begin = code;




More information about the Scummvm-git-logs mailing list