Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2008-03-04 18:41:34 +0000
committerMike Kucera2008-03-04 18:41:34 +0000
commit3b41669fc20caa01f5fd26ccdac15b01438d471f (patch)
tree020a5888b37ec3af849023372f334c55265c2e83 /lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp
parentd860addc6d1f0336dfd4e0ddd13e9ebf99b5b257 (diff)
downloadorg.eclipse.cdt-3b41669fc20caa01f5fd26ccdac15b01438d471f.tar.gz
org.eclipse.cdt-3b41669fc20caa01f5fd26ccdac15b01438d471f.tar.xz
org.eclipse.cdt-3b41669fc20caa01f5fd26ccdac15b01438d471f.zip
resolve sizeof ambiguity for C++
Diffstat (limited to 'lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp')
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPSizeofExpressionParser.g40
1 files changed, 40 insertions, 0 deletions
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPSizeofExpressionParser.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPSizeofExpressionParser.g
new file mode 100644
index 00000000000..ea977476189
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPSizeofExpressionParser.g
@@ -0,0 +1,40 @@
+-----------------------------------------------------------------------------------
+-- Copyright (c) 2006, 2008 IBM Corporation and others.
+-- All rights reserved. This program and the accompanying materials
+-- are made available under the terms of the Eclipse Public License v1.0
+-- which accompanies this distribution, and is available at
+-- http://www.eclipse.org/legal/epl-v10.html
+--
+-- Contributors:
+-- IBM Corporation - initial API and implementation
+-----------------------------------------------------------------------------------
+
+%options la=2
+%options package=org.eclipse.cdt.internal.core.dom.lrparser.cpp
+%options template=btParserTemplateD.g
+
+
+$Import
+ CPPGrammar.g
+$DropRules
+
+ unary_expression
+ ::= 'sizeof' '(' type_id ')'
+
+ postfix_expression
+ ::= 'typeid' '(' type_id ')'
+
+$End
+
+$Start
+ no_sizeof_type_name_start
+$End
+
+$Rules
+
+ no_sizeof_type_name_start
+ ::= expression
+ | ERROR_TOKEN
+ /. $Build consumeExpressionProblem(); $EndBuild ./
+
+$End \ No newline at end of file

Back to the top