Skip to main content
summaryrefslogtreecommitdiffstats
blob: dc1cdd06ef1f130410f81d1cc78953b83a98ec0a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
-----------------------------------------------------------------------------------
-- 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.lrparser.xlc.cpp
%options template=LRParserTemplate.g


$Import
	GPPGrammar.g
$End

$Import
	XlcGrammarExtensions.g
$End 

$Globals
/.
	import org.eclipse.cdt.core.lrparser.xlc.action.XlcCPPBuildASTParserAction;
	import org.eclipse.cdt.core.dom.lrparser.action.gnu.GPPSecondaryParserFactory;
	import org.eclipse.cdt.internal.core.lrparser.xlc.ast.XlcCPPNodeFactory;
./
$End

$Define

	$build_action_class /. XlcCPPBuildASTParserAction ./
	$parser_factory_create_expression /. GPPSecondaryParserFactory.getDefault() ./
	$node_factory_create_expression /. XlcCPPNodeFactory.getDefault() ./
	
$End



$Terminals

	_Complex
	restrict
	
$End


$Start
    translation_unit
$End


$Rules 

simple_type_specifier_token
	::= '_Complex'
	
cv_qualifier
    ::= 'restrict'

block_declaration
    ::= vector_declaration
    

identifier_token
    ::= 'vector' 
      | 'pixel'
    
    
specifier_qualifier
    ::= 'typedef'
          /. $Build  consumeToken(); $EndBuild ./
          
          
array_modifier 
    ::= '[' <openscope-ast> array_modifier_type_qualifiers ']'
          /. $Build  consumeDirectDeclaratorModifiedArrayModifier(false, false, true, false);  $EndBuild ./
      | '[' <openscope-ast> array_modifier_type_qualifiers assignment_expression ']'
          /. $Build  consumeDirectDeclaratorModifiedArrayModifier(false, false, true, true);  $EndBuild ./
      | '[' 'static' assignment_expression ']'
          /. $Build  consumeDirectDeclaratorModifiedArrayModifier(true, false, false, true);  $EndBuild ./
      | '[' 'static' <openscope-ast> array_modifier_type_qualifiers assignment_expression ']'
          /. $Build  consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true);  $EndBuild ./
      | '[' <openscope-ast> array_modifier_type_qualifiers 'static' assignment_expression ']'
          /. $Build  consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true);  $EndBuild ./
      | '[' '*' ']'
          /. $Build  consumeDirectDeclaratorModifiedArrayModifier(false, true, false, false);  $EndBuild ./
      | '[' <openscope-ast> array_modifier_type_qualifiers '*' ']'
          /. $Build  consumeDirectDeclaratorModifiedArrayModifier(false, true, true, false);  $EndBuild ./
          
          
array_modifier_type_qualifiers
    ::= type_qualifier_list 
    
type_qualifier_list
    ::= cv_qualifier         
      | type_qualifier_list cv_qualifier
          
$End

Back to the top