Added support for line continuations.

TRAC #22713
Signed-off-by: Geoff Lang
Signed-off-by: Shannon Woods
Author: Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@2024 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/preprocessor/ExpressionParser.cpp b/src/compiler/preprocessor/ExpressionParser.cpp
index 4c4225d..57645c6 100644
--- a/src/compiler/preprocessor/ExpressionParser.cpp
+++ b/src/compiler/preprocessor/ExpressionParser.cpp
@@ -473,9 +473,9 @@
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    90,    90,    97,    98,   101,   104,   107,   110,   113,
-     116,   119,   122,   125,   128,   131,   134,   137,   140,   143,
-     156,   169,   172,   175,   178,   181,   184
+       0,    91,    91,    98,    99,   102,   105,   108,   111,   114,
+     117,   120,   123,   126,   129,   132,   135,   138,   141,   144,
+     157,   170,   173,   176,   179,   182,   185
 };
 #endif
 
diff --git a/src/compiler/preprocessor/Tokenizer.cpp b/src/compiler/preprocessor/Tokenizer.cpp
index 66e0f3c..0ccd6fd 100644
--- a/src/compiler/preprocessor/Tokenizer.cpp
+++ b/src/compiler/preprocessor/Tokenizer.cpp
@@ -1,6 +1,6 @@
 #line 16 "./Tokenizer.l"
 //
-// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
@@ -359,8 +359,8 @@
 	*yy_cp = '\0'; \
 	yyg->yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 37
-#define YY_END_OF_BUFFER 38
+#define YY_NUM_RULES 38
+#define YY_END_OF_BUFFER 39
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -368,17 +368,17 @@
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[84] =
+static yyconst flex_int16_t yy_accept[87] =
     {   0,
-        0,    0,    0,    0,   38,   36,   34,   35,   35,   33,
+        0,    0,    0,    0,   39,   37,   34,   35,   35,   33,
         7,   33,   33,   33,   33,   33,   33,   33,   33,    9,
-        9,   33,   33,   33,    8,   33,   33,    3,    5,    5,
-        4,   34,   35,   19,   27,   20,   30,   25,   12,   23,
-       13,   24,   10,    2,    1,   26,   10,    9,   11,   11,
-       11,   11,    9,   14,   16,   18,   17,   15,    8,   31,
-       21,   32,   22,    3,    5,    6,   11,   10,   11,    1,
-       10,   11,    0,   10,    9,   28,   29,    0,   10,   10,
-       10,   10,    0
+        9,   33,   33,   33,    8,   37,   33,   33,    3,    5,
+        5,    4,   34,   35,   19,   27,   20,   30,   25,   12,
+       23,   13,   24,   10,    2,    1,   26,   10,    9,   11,
+       11,   11,   11,    9,   14,   16,   18,   17,   15,    8,
+       36,   36,   31,   21,   32,   22,    3,    5,    6,   11,
+       10,   11,    1,   10,   11,    0,   10,    9,   28,   29,
+        0,   10,   10,   10,   10,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -392,11 +392,11 @@
        19,   20,    9,    1,   21,   21,   21,   21,   22,   21,
        23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
        23,   23,   23,   23,   23,   23,   23,   24,   23,   23,
-        9,    1,    9,   25,   23,    1,   21,   21,   21,   21,
+        9,   25,    9,   26,   23,    1,   21,   21,   21,   21,
 
        22,   21,   23,   23,   23,   23,   23,   23,   23,   23,
        23,   23,   23,   23,   23,   23,   23,   23,   23,   24,
-       23,   23,    9,   26,    9,    9,    1,    1,    1,    1,
+       23,   23,    9,   27,    9,    9,    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,
@@ -413,85 +413,89 @@
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[27] =
+static yyconst flex_int32_t yy_meta[28] =
     {   0,
         1,    1,    2,    2,    1,    1,    1,    1,    1,    3,
         1,    1,    4,    1,    5,    5,    5,    1,    1,    1,
-        5,    5,    5,    5,    1,    1
+        5,    5,    5,    5,    1,    1,    1
     } ;
 
-static yyconst flex_int16_t yy_base[89] =
+static yyconst flex_int16_t yy_base[92] =
     {   0,
-        0,    0,   24,   26,  158,  159,  150,  159,  145,  128,
-      159,  112,   23,  159,  111,   21,   25,   30,   29,   36,
-       46,   36,  100,   45,    0,   16,   47,    0,  159,   84,
-       65,   73,  159,  159,  159,  159,  159,  159,  159,  159,
-      159,  159,   61,  159,    0,  159,   73,   32,   56,   83,
-       95,   68,    0,   31,  159,  159,  159,   19,    0,  159,
-      159,  159,  159,    0,  159,  159,   98,    0,  110,    0,
-        0,  117,   52,   90,   80,  159,  159,  101,   97,  112,
-      120,  123,  159,  140,   28,  145,  150,  152
+        0,    0,   25,   27,  162,  163,  159,  163,  152,  132,
+      163,  131,   24,  163,  116,   22,   26,   31,   30,   37,
+       40,   44,  115,   46,    0,   64,   50,   15,    0,  163,
+      124,   91,   88,  163,  163,  163,  163,  163,  163,  163,
+      163,  163,  163,   64,  163,    0,  163,   76,   54,   58,
+       79,   91,   91,    0,   56,  163,  163,  163,   32,    0,
+      163,   36,  163,  163,  163,  163,    0,  163,  163,   94,
+        0,  106,    0,    0,  113,   55,   72,  113,  163,  163,
+      116,  101,  108,  123,  126,  163,  143,   31,  148,  153,
+      155
+
     } ;
 
-static yyconst flex_int16_t yy_def[89] =
+static yyconst flex_int16_t yy_def[92] =
     {   0,
-       83,    1,   84,   84,   83,   83,   83,   83,   83,   83,
-       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
-       20,   83,   83,   83,   85,   83,   83,   86,   83,   83,
-       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
-       83,   83,   83,   83,   87,   83,   83,   20,   20,   47,
-       50,   88,   21,   83,   83,   83,   83,   83,   85,   83,
-       83,   83,   83,   86,   83,   83,   43,   43,   67,   87,
-       47,   50,   83,   51,   88,   83,   83,   83,   69,   72,
-       83,   83,    0,   83,   83,   83,   83,   83
+       86,    1,   87,   87,   86,   86,   86,   86,   86,   86,
+       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,
+       20,   86,   86,   86,   88,   86,   86,   86,   89,   86,
+       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,
+       86,   86,   86,   86,   86,   90,   86,   86,   20,   20,
+       48,   51,   91,   21,   86,   86,   86,   86,   86,   88,
+       86,   86,   86,   86,   86,   86,   89,   86,   86,   44,
+       44,   70,   90,   48,   51,   86,   52,   91,   86,   86,
+       86,   72,   75,   86,   86,    0,   86,   86,   86,   86,
+       86
+
     } ;
 
-static yyconst flex_int16_t yy_nxt[186] =
+static yyconst flex_int16_t yy_nxt[191] =
     {   0,
         6,    7,    8,    9,   10,   11,   12,   13,   14,   15,
        16,   17,   18,   19,   20,   21,   21,   22,   23,   24,
-       25,   25,   25,   25,   26,   27,   29,   30,   29,   30,
-       36,   39,   59,   31,   60,   31,   41,   77,   44,   40,
-       61,   37,   45,   42,   43,   43,   43,   46,   47,   76,
-       48,   48,   49,   54,   55,   50,   50,   51,   50,   52,
-       53,   53,   53,   57,   58,   62,   81,   81,   81,   50,
-       49,   49,   63,   67,   32,   68,   68,   68,   66,   50,
-       50,   67,   69,   67,   67,   50,   65,   71,   71,   71,
-       50,   50,   50,   50,   72,   50,   50,   50,   50,   50,
+       25,   25,   25,   25,   26,   27,   28,   30,   31,   30,
+       31,   37,   40,   65,   32,   60,   32,   42,   61,   45,
+       41,   66,   38,   46,   43,   44,   44,   44,   47,   48,
+       80,   49,   49,   50,   54,   54,   54,   51,   52,   51,
+       53,   55,   56,   51,   58,   59,   61,   62,   63,   84,
+       84,   84,   50,   50,   79,   64,   70,   51,   71,   71,
+       71,   51,   86,   86,   70,   72,   70,   70,   51,   33,
+       74,   74,   74,   51,   51,   51,   51,   75,   51,   51,
 
-       83,   83,   50,   50,   50,   73,   73,   83,   83,   74,
-       74,   74,   67,   67,   67,   82,   82,   82,   56,   67,
-       78,   78,   83,   83,   79,   79,   79,   78,   78,   38,
-       35,   80,   80,   80,   81,   81,   81,   82,   82,   82,
-       28,   28,   28,   28,   28,   64,   34,   33,   64,   64,
-       70,   32,   70,   70,   70,   75,   75,   83,    5,   83,
-       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
-       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
-       83,   83,   83,   83,   83
+       51,   76,   76,   51,   69,   77,   77,   77,   70,   70,
+       70,   86,   86,   51,   51,   70,   81,   81,   86,   86,
+       82,   82,   82,   81,   81,   51,   68,   83,   83,   83,
+       85,   85,   85,   57,   39,   51,   51,   84,   84,   84,
+       85,   85,   85,   29,   29,   29,   29,   29,   67,   36,
+       35,   67,   67,   73,   34,   73,   73,   73,   78,   78,
+       33,   86,    5,   86,   86,   86,   86,   86,   86,   86,
+       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,
+       86,   86,   86,   86,   86,   86,   86,   86,   86,   86
     } ;
 
-static yyconst flex_int16_t yy_chk[186] =
+static yyconst flex_int16_t yy_chk[191] =
     {   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,    3,    3,    4,    4,
-       13,   16,   85,    3,   26,    4,   17,   58,   19,   16,
-       26,   13,   19,   17,   18,   18,   18,   19,   20,   54,
-       20,   20,   20,   22,   22,   48,   20,   20,   20,   20,
-       21,   21,   21,   24,   24,   27,   73,   73,   73,   21,
-       49,   49,   27,   43,   32,   43,   43,   43,   31,   49,
-       52,   43,   43,   43,   43,   47,   30,   47,   47,   47,
-       52,   52,   75,   47,   47,   47,   47,   50,   50,   50,
+        1,    1,    1,    1,    1,    1,    1,    3,    3,    4,
+        4,   13,   16,   28,    3,   88,    4,   17,   62,   19,
+       16,   28,   13,   19,   17,   18,   18,   18,   19,   20,
+       59,   20,   20,   20,   21,   21,   21,   20,   20,   20,
+       20,   22,   22,   21,   24,   24,   26,   26,   27,   76,
+       76,   76,   50,   50,   55,   27,   44,   49,   44,   44,
+       44,   50,   77,   77,   44,   44,   44,   44,   48,   33,
+       48,   48,   48,   51,   51,   51,   48,   48,   48,   48,
 
-       74,   74,   75,   75,   50,   51,   51,   79,   79,   51,
-       51,   51,   67,   67,   67,   78,   78,   78,   23,   67,
-       69,   69,   80,   80,   69,   69,   69,   72,   72,   15,
-       12,   72,   72,   72,   81,   81,   81,   82,   82,   82,
-       84,   84,   84,   84,   84,   86,   10,    9,   86,   86,
-       87,    7,   87,   87,   87,   88,   88,    5,   83,   83,
-       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
-       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
-       83,   83,   83,   83,   83
+       51,   52,   52,   53,   32,   52,   52,   52,   70,   70,
+       70,   82,   82,   53,   53,   70,   72,   72,   83,   83,
+       72,   72,   72,   75,   75,   78,   31,   75,   75,   75,
+       81,   81,   81,   23,   15,   78,   78,   84,   84,   84,
+       85,   85,   85,   87,   87,   87,   87,   87,   89,   12,
+       10,   89,   89,   90,    9,   90,   90,   90,   91,   91,
+        7,    5,   86,   86,   86,   86,   86,   86,   86,   86,
+       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,
+       86,   86,   86,   86,   86,   86,   86,   86,   86,   86
     } ;
 
 /* The intent behind this definition is that it'll catch
@@ -503,7 +507,7 @@
 #define YY_RESTORE_YY_MORE_OFFSET
 /*
 //
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
@@ -843,13 +847,13 @@
 			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 >= 84 )
+				if ( yy_current_state >= 87 )
 					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 != 83 );
+		while ( yy_current_state != 86 );
 		yy_cp = yyg->yy_last_accepting_cpos;
 		yy_current_state = yyg->yy_last_accepting_state;
 
@@ -1106,6 +1110,11 @@
 }
 	YY_BREAK
 case 36:
+/* rule 36 can match eol */
+YY_RULE_SETUP
+{ ++yylineno; }
+	YY_BREAK
+case 37:
 YY_RULE_SETUP
 {
     yylval->assign(1, yytext[0]);
@@ -1141,7 +1150,7 @@
     yyterminate();
 }
 	YY_BREAK
-case 37:
+case 38:
 YY_RULE_SETUP
 ECHO;
 	YY_BREAK
@@ -1437,7 +1446,7 @@
 		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 >= 84 )
+			if ( yy_current_state >= 87 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1466,11 +1475,11 @@
 	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 >= 84 )
+		if ( yy_current_state >= 87 )
 			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 == 83);
+	yy_is_jam = (yy_current_state == 86);
 
 	return yy_is_jam ? 0 : yy_current_state;
 }
diff --git a/src/compiler/preprocessor/Tokenizer.l b/src/compiler/preprocessor/Tokenizer.l
index cdefd20..fc81d84 100644
--- a/src/compiler/preprocessor/Tokenizer.l
+++ b/src/compiler/preprocessor/Tokenizer.l
@@ -1,6 +1,6 @@
 /*
 //
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
@@ -14,7 +14,7 @@
 
 %top{
 //
-// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
@@ -229,6 +229,8 @@
     return '\n';
 }
 
+\\{NEWLINE} { ++yylineno; }
+
 . {
     yylval->assign(1, yytext[0]);
     return pp::Token::PP_OTHER;
diff --git a/src/compiler/preprocessor/preprocessor.vcxproj b/src/compiler/preprocessor/preprocessor.vcxproj
index dccce7d..ca8530b 100644
--- a/src/compiler/preprocessor/preprocessor.vcxproj
+++ b/src/compiler/preprocessor/preprocessor.vcxproj
@@ -163,6 +163,9 @@
     <ClInclude Include="Token.h" />

     <ClInclude Include="Tokenizer.h" />

   </ItemGroup>

+  <ItemGroup>

+    <None Include="Tokenizer.l" />

+  </ItemGroup>

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

   <ImportGroup Label="ExtensionTargets">

   </ImportGroup>

diff --git a/src/compiler/preprocessor/preprocessor.vcxproj.filters b/src/compiler/preprocessor/preprocessor.vcxproj.filters
index 2df91e2..4ac202f 100644
--- a/src/compiler/preprocessor/preprocessor.vcxproj.filters
+++ b/src/compiler/preprocessor/preprocessor.vcxproj.filters
@@ -11,12 +11,6 @@
     </Filter>

   </ItemGroup>

   <ItemGroup>

-    <ClCompile Include="Diagnostics.cpp">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="DirectiveHandler.cpp">

-      <Filter>Source Files</Filter>

-    </ClCompile>

     <ClCompile Include="DirectiveParser.cpp">

       <Filter>Source Files</Filter>

     </ClCompile>

@@ -44,14 +38,14 @@
     <ClCompile Include="Tokenizer.cpp">

       <Filter>Source Files</Filter>

     </ClCompile>

+    <ClCompile Include="DiagnosticsBase.cpp">

+      <Filter>Source Files</Filter>

+    </ClCompile>

+    <ClCompile Include="DirectiveHandlerBase.cpp">

+      <Filter>Source Files</Filter>

+    </ClCompile>

   </ItemGroup>

   <ItemGroup>

-    <ClInclude Include="Diagnostics.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="DirectiveHandler.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

     <ClInclude Include="DirectiveParser.h">

       <Filter>Header Files</Filter>

     </ClInclude>

@@ -91,5 +85,16 @@
     <ClInclude Include="length_limits.h">

       <Filter>Header Files</Filter>

     </ClInclude>

+    <ClInclude Include="DiagnosticsBase.h">

+      <Filter>Header Files</Filter>

+    </ClInclude>

+    <ClInclude Include="DirectiveHandlerBase.h">

+      <Filter>Header Files</Filter>

+    </ClInclude>

+  </ItemGroup>

+  <ItemGroup>

+    <None Include="Tokenizer.l">

+      <Filter>Source Files</Filter>

+    </None>

   </ItemGroup>

 </Project>
\ No newline at end of file