1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-04 22:23:28 +02:00

Fixes to the C99/UPC parsers. Fix NPE in C99ParserAction. Fix CCE in UPC parser. Fix problem with ## operator in C99Preprocessor. Fix problem with skipping inactive code in C99Preprocessor.

This commit is contained in:
Mike Kucera 2007-06-04 21:20:18 +00:00
parent c18b4fba62
commit 34bb553c49
3 changed files with 1025 additions and 1037 deletions

View file

@ -15,9 +15,10 @@
%options import_terminals=D:\workspaces\cdt-head2\org.eclipse.cdt.core.parser.c99\src\org\eclipse\cdt\internal\core\dom\parser\c99\C99Lexer.g %options import_terminals=D:\workspaces\cdt-head2\org.eclipse.cdt.core.parser.c99\src\org\eclipse\cdt\internal\core\dom\parser\c99\C99Lexer.g
-- Unified Parallel C (UPC) is an extension of C99 -- Unified Parallel C (UPC) is an extension of C99.
-- Must set LPG_INCLUDE environment variable to the location of C99Parser.g
$Import $Import
D:\workspaces\cdt-head2\org.eclipse.cdt.core.parser.c99\src\org\eclipse\cdt\internal\core\dom\parser\c99\C99Parser.g C99Parser.g
$End $End
$Globals $Globals

View file

@ -91,7 +91,7 @@ public class UPCParser extends PrsStream implements RuleAction , IParserActionTo
for (int i = 0; i < unimplemented_symbols.size(); i++) for (int i = 0; i < unimplemented_symbols.size(); i++)
{ {
Integer id = (Integer) unimplemented_symbols.get(i); Integer id = (Integer) unimplemented_symbols.get(i);
System.out.println(" " + UPCParsersym.orderedTerminalSymbols[id.intValue()]); //$NON-NLS-1$ System.out.println(" " + UPCParsersym.orderedTerminalSymbols[id.intValue()]);//$NON-NLS-1$
} }
System.out.println(); System.out.println();
} }
@ -115,7 +115,7 @@ public class UPCParser extends PrsStream implements RuleAction , IParserActionTo
{ {
int firsttok = super.getFirstErrorToken(error_token), int firsttok = super.getFirstErrorToken(error_token),
lasttok = super.getLastErrorToken(error_token); lasttok = super.getLastErrorToken(error_token);
String location = super.getFileName() + ':' +//$NON-NLS-1$ String location = super.getFileName() + ':' +
(firsttok > lasttok (firsttok > lasttok
? (super.getEndLine(lasttok) + ":" + super.getEndColumn(lasttok))//$NON-NLS-1$ ? (super.getEndLine(lasttok) + ":" + super.getEndColumn(lasttok))//$NON-NLS-1$
: (super.getLine(error_token) + ":" +//$NON-NLS-1$ : (super.getLine(error_token) + ":" +//$NON-NLS-1$
@ -633,13 +633,13 @@ public List getRuleTokens() {
} }
// //
// Rule 99: labeled_statement ::= case constant_expression : statement // Rule 99: labeled_statement ::= case constant_expression :
// //
case 99: { action.beforeConsume(); action. consumeStatementCase(); break; case 99: { action.beforeConsume(); action. consumeStatementCase(); break;
} }
// //
// Rule 100: labeled_statement ::= default : statement // Rule 100: labeled_statement ::= default :
// //
case 100: { action.beforeConsume(); action. consumeStatementDefault(); break; case 100: { action.beforeConsume(); action. consumeStatementDefault(); break;
} }