Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2009-01-30 13:31:43 +0000
committerMike Kucera2009-01-30 13:31:43 +0000
commit44907e70565784664cf3c4ab07a658682ff63d96 (patch)
treee78d0cefcf9927c03148b0fe14b383f6d7238e06 /lrparser/org.eclipse.cdt.core.lrparser/grammar/gcc/GCCSizeofExpressionParser.g
parent8a018e449f2c6a6d9c7186d45b735020d6610e14 (diff)
downloadorg.eclipse.cdt-44907e70565784664cf3c4ab07a658682ff63d96.tar.gz
org.eclipse.cdt-44907e70565784664cf3c4ab07a658682ff63d96.tar.xz
org.eclipse.cdt-44907e70565784664cf3c4ab07a658682ff63d96.zip
added support to LR parsers for GNU extensions typeof and alignof, added ISecondaryParserFactory
Diffstat (limited to 'lrparser/org.eclipse.cdt.core.lrparser/grammar/gcc/GCCSizeofExpressionParser.g')
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/grammar/gcc/GCCSizeofExpressionParser.g40
1 files changed, 40 insertions, 0 deletions
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/gcc/GCCSizeofExpressionParser.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/gcc/GCCSizeofExpressionParser.g
new file mode 100644
index 00000000000..36eac42269d
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/gcc/GCCSizeofExpressionParser.g
@@ -0,0 +1,40 @@
+-----------------------------------------------------------------------------------
+-- Copyright (c) 2009 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.gcc
+%options template=FixedBtParserTemplateD.g
+
+
+$Import
+ GCCGrammar.g
+$DropRules
+
+ unary_expression
+ ::= 'sizeof' '(' type_id ')'
+ | '__alignof__' '(' type_id ')'
+ | 'typeof' '(' 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