Changes in src/Parser/parser.yy [4040425:bd85400]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r4040425 rbd85400 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:24:45201613 // Update Count : 14 9512 // Last Modified On : Mon Feb 1 18:22:42 2016 13 // Update Count : 1483 14 14 // 15 15 … … 74 74 %token FORALL LVALUE // CFA 75 75 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED 76 %token VALIST // GCC77 76 %token BOOL COMPLEX IMAGINARY // C99 78 77 %token TYPEOF LABEL // GCC 79 78 %token ENUM STRUCT UNION 80 %token OTYPE FTYPE DTYPE TRAIT// CFA79 %token TYPE FTYPE DTYPE CONTEXT // CFA 81 80 %token SIZEOF OFFSETOF 82 81 %token ATTRIBUTE EXTENSION // GCC … … 172 171 %type<decl> basic_declaration_specifier basic_type_name basic_type_specifier direct_type_name indirect_type_name 173 172 174 %type<decl> trait_declaration trait_declaration_list trait_declaring_list trait_specifier173 %type<decl> context_declaration context_declaration_list context_declaring_list context_specifier 175 174 176 175 %type<decl> declaration declaration_list declaration_list_opt declaration_qualifier_list … … 198 197 %type<decl> new_array_parameter_1st_dimension 199 198 200 %type<decl> new_ trait_declaring_list new_declaration new_field_declaring_list199 %type<decl> new_context_declaring_list new_declaration new_field_declaring_list 201 200 %type<decl> new_function_declaration new_function_return new_function_specifier 202 201 … … 449 448 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), new TypeValueNode( $3 )); } 450 449 | OFFSETOF '(' type_name_no_function ',' no_attr_identifier ')' 451 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); }450 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); } 452 451 | ATTR_IDENTIFIER 453 452 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 )); } … … 1021 1020 | new_function_declaration pop ';' 1022 1021 | type_declaring_list pop ';' 1023 | trait_specifier pop ';'1022 | context_specifier pop ';' 1024 1023 ; 1025 1024 … … 1346 1345 | IMAGINARY // C99 1347 1346 { $$ = DeclarationNode::newBasicType( DeclarationNode::Imaginary ); } 1348 | VALIST // GCC, __builtin_va_list1349 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }1350 1347 ; 1351 1348 … … 1806 1803 1807 1804 type_class: // CFA 1808 OTYPE1805 TYPE 1809 1806 { $$ = DeclarationNode::Type; } 1810 1807 | DTYPE … … 1824 1821 '|' no_attr_identifier_or_type_name '(' type_name_list ')' 1825 1822 { 1826 typedefTable.open Trait( *$2 );1827 $$ = DeclarationNode::new TraitUse( $2, $4 );1828 } 1829 | '|' '{' push trait_declaration_list '}'1823 typedefTable.openContext( *$2 ); 1824 $$ = DeclarationNode::newContextUse( $2, $4 ); 1825 } 1826 | '|' '{' push context_declaration_list '}' 1830 1827 { $$ = $4; } 1831 | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}' '(' type_name_list ')'1828 | '|' '(' push type_parameter_list pop ')' '{' push context_declaration_list '}' '(' type_name_list ')' 1832 1829 { $$ = 0; } 1833 1830 ; … … 1844 1841 1845 1842 type_declaring_list: // CFA 1846 OTYPE type_declarator1847 { $$ = $2; } 1848 | storage_class_list OTYPE type_declarator1843 TYPE type_declarator 1844 { $$ = $2; } 1845 | storage_class_list TYPE type_declarator 1849 1846 { $$ = $3->addQualifiers( $1 ); } 1850 1847 | type_declaring_list ',' type_declarator … … 1872 1869 ; 1873 1870 1874 trait_specifier: // CFA1875 TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}'1871 context_specifier: // CFA 1872 CONTEXT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}' 1876 1873 { 1877 1874 typedefTable.addToEnclosingScope( *$2, TypedefTable::ID ); 1878 $$ = DeclarationNode::new Trait( $2, $5, 0 );1879 } 1880 | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{'1881 { 1882 typedefTable.enter Trait( *$2 );1875 $$ = DeclarationNode::newContext( $2, $5, 0 ); 1876 } 1877 | CONTEXT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' 1878 { 1879 typedefTable.enterContext( *$2 ); 1883 1880 typedefTable.enterScope(); 1884 1881 } 1885 trait_declaration_list '}'1886 { 1887 typedefTable.leave Trait();1882 context_declaration_list '}' 1883 { 1884 typedefTable.leaveContext(); 1888 1885 typedefTable.addToEnclosingScope( *$2, TypedefTable::ID ); 1889 $$ = DeclarationNode::new Trait( $2, $5, $10 );1890 } 1891 ; 1892 1893 trait_declaration_list: // CFA1894 trait_declaration1895 | trait_declaration_list push trait_declaration1886 $$ = DeclarationNode::newContext( $2, $5, $10 ); 1887 } 1888 ; 1889 1890 context_declaration_list: // CFA 1891 context_declaration 1892 | context_declaration_list push context_declaration 1896 1893 { $$ = $1->appendList( $3 ); } 1897 1894 ; 1898 1895 1899 trait_declaration: // CFA1900 new_ trait_declaring_list pop ';'1901 | trait_declaring_list pop ';'1902 ; 1903 1904 new_ trait_declaring_list: // CFA1896 context_declaration: // CFA 1897 new_context_declaring_list pop ';' 1898 | context_declaring_list pop ';' 1899 ; 1900 1901 new_context_declaring_list: // CFA 1905 1902 new_variable_specifier 1906 1903 { … … 1913 1910 $$ = $1; 1914 1911 } 1915 | new_ trait_declaring_list pop ',' push identifier_or_type_name1912 | new_context_declaring_list pop ',' push identifier_or_type_name 1916 1913 { 1917 1914 typedefTable.addToEnclosingScope2( *$5, TypedefTable::ID ); … … 1920 1917 ; 1921 1918 1922 trait_declaring_list: // CFA1919 context_declaring_list: // CFA 1923 1920 type_specifier declarator 1924 1921 { … … 1926 1923 $$ = $2->addType( $1 ); 1927 1924 } 1928 | trait_declaring_list pop ',' push declarator1925 | context_declaring_list pop ',' push declarator 1929 1926 { 1930 1927 typedefTable.addToEnclosingScope2( TypedefTable::ID );
Note:
See TracChangeset
for help on using the changeset viewer.