Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2625)

Delta Between Two Patch Sets: src/compiler/glslang.y

Issue 4428058: Implement shader identifier name mapping. (Closed) Base URL: http://angleproject.googlecode.com/svn/trunk/
Left Patch Set: '' Created 12 years, 11 months ago
Right Patch Set: '' Created 12 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/compiler/VariableInfo.cpp ('k') | src/compiler/glslang_tab.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 /* 1 /*
2 // 2 //
3 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 3 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be 4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file. 5 // found in the LICENSE file.
6 // 6 //
7 7
8 This file contains the Yacc grammar for GLSL ES. 8 This file contains the Yacc grammar for GLSL ES.
9 Based on ANSI C Yacc grammar: 9 Based on ANSI C Yacc grammar:
10 http://www.lysator.liu.se/c/ANSI-C-grammar-y.html 10 http://www.lysator.liu.se/c/ANSI-C-grammar-y.html
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 $$ = $1; 1178 $$ = $1;
1179 ········ 1179 ········
1180 if ($$.type.precision == EbpUndefined) { 1180 if ($$.type.precision == EbpUndefined) {
1181 $$.type.precision = context->symbolTable.getDefaultPrecision($1.type .type); 1181 $$.type.precision = context->symbolTable.getDefaultPrecision($1.type .type);
1182 if (context->precisionErrorCheck($1.line, $$.type.precision, $1.type .type)) { 1182 if (context->precisionErrorCheck($1.line, $$.type.precision, $1.type .type)) {
1183 context->recover(); 1183 context->recover();
1184 } 1184 }
1185 } 1185 }
1186 } 1186 }
1187 | init_declarator_list COMMA IDENTIFIER { 1187 | init_declarator_list COMMA IDENTIFIER {
1188 $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, context->intermediate.addSymbol(0, *$3.string, TType($1.type), $3.line), $3.line ); 1188 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$3.string, T Type($1.type), $3.line);
1189 $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, symbol, $3.line);
1189 ········ 1190 ········
1190 if (context->structQualifierErrorCheck($3.line, $$.type)) 1191 if (context->structQualifierErrorCheck($3.line, $$.type))
1191 context->recover(); 1192 context->recover();
1192 1193
1193 if (context->nonInitConstErrorCheck($3.line, *$3.string, $$.type)) 1194 if (context->nonInitConstErrorCheck($3.line, *$3.string, $$.type))
1194 context->recover(); 1195 context->recover();
1195 1196
1196 if (context->nonInitErrorCheck($3.line, *$3.string, $$.type)) 1197 TVariable* variable = 0;
1197 context->recover(); 1198 if (context->nonInitErrorCheck($3.line, *$3.string, $$.type, variable))
1199 context->recover();
1200 if (symbol && variable)
1201 symbol->setId(variable->getUniqueId());
1198 } 1202 }
1199 | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET RIGHT_BRACKET { 1203 | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET RIGHT_BRACKET {
1200 if (context->structQualifierErrorCheck($3.line, $1.type)) 1204 if (context->structQualifierErrorCheck($3.line, $1.type))
1201 context->recover(); 1205 context->recover();
1202 1206
1203 if (context->nonInitConstErrorCheck($3.line, *$3.string, $1.type)) 1207 if (context->nonInitConstErrorCheck($3.line, *$3.string, $1.type))
1204 context->recover(); 1208 context->recover();
1205 1209
1206 $$ = $1; 1210 $$ = $1;
1207 1211
(...skipping 15 matching lines...) Expand all
1223 1227
1224 $$ = $1; 1228 $$ = $1;
1225 1229
1226 if (context->arrayTypeErrorCheck($4.line, $1.type) || context->arrayQual ifierErrorCheck($4.line, $1.type)) 1230 if (context->arrayTypeErrorCheck($4.line, $1.type) || context->arrayQual ifierErrorCheck($4.line, $1.type))
1227 context->recover(); 1231 context->recover();
1228 else { 1232 else {
1229 int size; 1233 int size;
1230 if (context->arraySizeErrorCheck($4.line, $5, size)) 1234 if (context->arraySizeErrorCheck($4.line, $5, size))
1231 context->recover(); 1235 context->recover();
1232 $1.type.setArray(true, size); 1236 $1.type.setArray(true, size);
1233 TVariable* variable; 1237 TVariable* variable = 0;
1234 if (context->arrayErrorCheck($4.line, *$3.string, $1.type, variable) ) 1238 if (context->arrayErrorCheck($4.line, *$3.string, $1.type, variable) )
1235 context->recover(); 1239 context->recover();
1236 TType type = TType($1.type); 1240 TType type = TType($1.type);
1237 type.setArraySize(size); 1241 type.setArraySize(size);
1238 $$.intermAggregate = context->intermediate.growAggregate($1.intermNo de, context->intermediate.addSymbol(0, *$3.string, type, $3.line), $3.line); 1242 $$.intermAggregate = context->intermediate.growAggregate($1.intermNo de, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *$3. string, type, $3.line), $3.line);
1239 } 1243 }
1240 } 1244 }
1241 | init_declarator_list COMMA IDENTIFIER EQUAL initializer { 1245 | init_declarator_list COMMA IDENTIFIER EQUAL initializer {
1242 if (context->structQualifierErrorCheck($3.line, $1.type)) 1246 if (context->structQualifierErrorCheck($3.line, $1.type))
1243 context->recover(); 1247 context->recover();
1244 1248
1245 $$ = $1; 1249 $$ = $1;
1246 1250
1247 TIntermNode* intermNode; 1251 TIntermNode* intermNode;
1248 if (!context->executeInitializer($3.line, *$3.string, $1.type, $5, inter mNode)) { 1252 if (!context->executeInitializer($3.line, *$3.string, $1.type, $5, inter mNode)) {
(...skipping 10 matching lines...) Expand all
1259 } 1263 }
1260 } 1264 }
1261 ; 1265 ;
1262 1266
1263 single_declaration 1267 single_declaration
1264 : fully_specified_type { 1268 : fully_specified_type {
1265 $$.type = $1; 1269 $$.type = $1;
1266 $$.intermAggregate = context->intermediate.makeAggregate(context->interm ediate.addSymbol(0, "", TType($1), $1.line), $1.line); 1270 $$.intermAggregate = context->intermediate.makeAggregate(context->interm ediate.addSymbol(0, "", TType($1), $1.line), $1.line);
1267 } 1271 }
1268 | fully_specified_type IDENTIFIER { 1272 | fully_specified_type IDENTIFIER {
1269 $$.intermAggregate = context->intermediate.makeAggregate(context->interm ediate.addSymbol(0, *$2.string, TType($1), $2.line), $2.line); 1273 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, T Type($1), $2.line);
1274 $$.intermAggregate = context->intermediate.makeAggregate(symbol, $2.line );
1270 ········ 1275 ········
1271 if (context->structQualifierErrorCheck($2.line, $$.type)) 1276 if (context->structQualifierErrorCheck($2.line, $$.type))
1272 context->recover(); 1277 context->recover();
1273 1278
1274 if (context->nonInitConstErrorCheck($2.line, *$2.string, $$.type)) 1279 if (context->nonInitConstErrorCheck($2.line, *$2.string, $$.type))
1275 context->recover(); 1280 context->recover();
1276 ············ 1281 ············
1277 $$.type = $1; 1282 $$.type = $1;
1278 1283
1279 if (context->nonInitErrorCheck($2.line, *$2.string, $$.type)) 1284 TVariable* variable = 0;
1280 context->recover(); 1285 if (context->nonInitErrorCheck($2.line, *$2.string, $$.type, variable))
1286 context->recover();
1287 if (variable && symbol)
1288 symbol->setId(variable->getUniqueId());
1281 } 1289 }
1282 | fully_specified_type IDENTIFIER LEFT_BRACKET RIGHT_BRACKET { 1290 | fully_specified_type IDENTIFIER LEFT_BRACKET RIGHT_BRACKET {
1283 $$.intermAggregate = context->intermediate.makeAggregate(context->interm ediate.addSymbol(0, *$2.string, TType($1), $2.line), $2.line); 1291 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, T Type($1), $2.line);
1292 $$.intermAggregate = context->intermediate.makeAggregate(symbol, $2.line );
1284 ········ 1293 ········
1285 if (context->structQualifierErrorCheck($2.line, $1)) 1294 if (context->structQualifierErrorCheck($2.line, $1))
1286 context->recover(); 1295 context->recover();
1287 1296
1288 if (context->nonInitConstErrorCheck($2.line, *$2.string, $1)) 1297 if (context->nonInitConstErrorCheck($2.line, *$2.string, $1))
1289 context->recover(); 1298 context->recover();
1290 1299
1291 $$.type = $1; 1300 $$.type = $1;
1292 1301
1293 if (context->arrayTypeErrorCheck($3.line, $1) || context->arrayQualifier ErrorCheck($3.line, $1)) 1302 if (context->arrayTypeErrorCheck($3.line, $1) || context->arrayQualifier ErrorCheck($3.line, $1))
1294 context->recover(); 1303 context->recover();
1295 else { 1304 else {
1296 $1.setArray(true); 1305 $1.setArray(true);
1297 TVariable* variable; 1306 TVariable* variable = 0;
1298 if (context->arrayErrorCheck($3.line, *$2.string, $1, variable)) 1307 if (context->arrayErrorCheck($3.line, *$2.string, $1, variable))
1299 context->recover(); 1308 context->recover();
1309 if (variable && symbol)
1310 symbol->setId(variable->getUniqueId());
1300 } 1311 }
1301 } 1312 }
1302 | fully_specified_type IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRA CKET { 1313 | fully_specified_type IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRA CKET {
1303 TType type = TType($1); 1314 TType type = TType($1);
1304 int size; 1315 int size;
1305 if (context->arraySizeErrorCheck($2.line, $4, size)) 1316 if (context->arraySizeErrorCheck($2.line, $4, size))
1306 context->recover(); 1317 context->recover();
1307 type.setArraySize(size); 1318 type.setArraySize(size);
1308 $$.intermAggregate = context->intermediate.makeAggregate(context->interm ediate.addSymbol(0, *$2.string, type, $2.line), $2.line); 1319 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, t ype, $2.line);
1320 $$.intermAggregate = context->intermediate.makeAggregate(symbol, $2.line );
1309 ········ 1321 ········
1310 if (context->structQualifierErrorCheck($2.line, $1)) 1322 if (context->structQualifierErrorCheck($2.line, $1))
1311 context->recover(); 1323 context->recover();
1312 1324
1313 if (context->nonInitConstErrorCheck($2.line, *$2.string, $1)) 1325 if (context->nonInitConstErrorCheck($2.line, *$2.string, $1))
1314 context->recover(); 1326 context->recover();
1315 1327
1316 $$.type = $1; 1328 $$.type = $1;
1317 1329
1318 if (context->arrayTypeErrorCheck($3.line, $1) || context->arrayQualifier ErrorCheck($3.line, $1)) 1330 if (context->arrayTypeErrorCheck($3.line, $1) || context->arrayQualifier ErrorCheck($3.line, $1))
1319 context->recover(); 1331 context->recover();
1320 else { 1332 else {
1321 int size; 1333 int size;
1322 if (context->arraySizeErrorCheck($3.line, $4, size)) 1334 if (context->arraySizeErrorCheck($3.line, $4, size))
1323 context->recover(); 1335 context->recover();
1324 1336
1325 $1.setArray(true, size); 1337 $1.setArray(true, size);
1326 TVariable* variable; 1338 TVariable* variable = 0;
1327 if (context->arrayErrorCheck($3.line, *$2.string, $1, variable)) 1339 if (context->arrayErrorCheck($3.line, *$2.string, $1, variable))
1328 context->recover(); 1340 context->recover();
1341 if (variable && symbol)
1342 symbol->setId(variable->getUniqueId());
1329 } 1343 }
1330 } 1344 }
1331 | fully_specified_type IDENTIFIER EQUAL initializer { 1345 | fully_specified_type IDENTIFIER EQUAL initializer {
1332 if (context->structQualifierErrorCheck($2.line, $1)) 1346 if (context->structQualifierErrorCheck($2.line, $1))
1333 context->recover(); 1347 context->recover();
1334 1348
1335 $$.type = $1; 1349 $$.type = $1;
1336 1350
1337 TIntermNode* intermNode; 1351 TIntermNode* intermNode;
1338 if (!context->executeInitializer($2.line, *$2.string, $1, $4, intermNode )) { 1352 if (!context->executeInitializer($2.line, *$2.string, $1, $4, intermNode )) {
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 $$->getAsAggregate()->setEndLine($3->getAsAggregate()->getEndLine()) ; 2084 $$->getAsAggregate()->setEndLine($3->getAsAggregate()->getEndLine()) ;
2071 } 2085 }
2072 ; 2086 ;
2073 2087
2074 %% 2088 %%
2075 2089
2076 int glslang_parse(TParseContext* context) { 2090 int glslang_parse(TParseContext* context) {
2077 return yyparse(context); 2091 return yyparse(context);
2078 } 2092 }
2079 2093
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b