Changeset 36ebd03 for src/Parser/parser.yy
- Timestamp:
- Mar 3, 2016, 1:28:56 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 3627356
- Parents:
- 9d7b3ea (diff), 4040425 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r9d7b3ea r36ebd03 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Feb 1 18:22:42201613 // Update Count : 14 8312 // Last Modified On : Wed Mar 2 17:24:45 2016 13 // Update Count : 1495 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 // GCC 76 77 %token BOOL COMPLEX IMAGINARY // C99 77 78 %token TYPEOF LABEL // GCC 78 79 %token ENUM STRUCT UNION 79 %token TYPE FTYPE DTYPE CONTEXT// CFA80 %token OTYPE FTYPE DTYPE TRAIT // CFA 80 81 %token SIZEOF OFFSETOF 81 82 %token ATTRIBUTE EXTENSION // GCC … … 171 172 %type<decl> basic_declaration_specifier basic_type_name basic_type_specifier direct_type_name indirect_type_name 172 173 173 %type<decl> context_declaration context_declaration_list context_declaring_list context_specifier174 %type<decl> trait_declaration trait_declaration_list trait_declaring_list trait_specifier 174 175 175 176 %type<decl> declaration declaration_list declaration_list_opt declaration_qualifier_list … … 197 198 %type<decl> new_array_parameter_1st_dimension 198 199 199 %type<decl> new_ context_declaring_list new_declaration new_field_declaring_list200 %type<decl> new_trait_declaring_list new_declaration new_field_declaring_list 200 201 %type<decl> new_function_declaration new_function_return new_function_specifier 201 202 … … 448 449 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), new TypeValueNode( $3 )); } 449 450 | OFFSETOF '(' type_name_no_function ',' no_attr_identifier ')' 450 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); }451 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); } 451 452 | ATTR_IDENTIFIER 452 453 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 )); } … … 1020 1021 | new_function_declaration pop ';' 1021 1022 | type_declaring_list pop ';' 1022 | context_specifier pop ';'1023 | trait_specifier pop ';' 1023 1024 ; 1024 1025 … … 1345 1346 | IMAGINARY // C99 1346 1347 { $$ = DeclarationNode::newBasicType( DeclarationNode::Imaginary ); } 1348 | VALIST // GCC, __builtin_va_list 1349 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); } 1347 1350 ; 1348 1351 … … 1803 1806 1804 1807 type_class: // CFA 1805 TYPE1808 OTYPE 1806 1809 { $$ = DeclarationNode::Type; } 1807 1810 | DTYPE … … 1821 1824 '|' no_attr_identifier_or_type_name '(' type_name_list ')' 1822 1825 { 1823 typedefTable.open Context( *$2 );1824 $$ = DeclarationNode::new ContextUse( $2, $4 );1825 } 1826 | '|' '{' push context_declaration_list '}'1826 typedefTable.openTrait( *$2 ); 1827 $$ = DeclarationNode::newTraitUse( $2, $4 ); 1828 } 1829 | '|' '{' push trait_declaration_list '}' 1827 1830 { $$ = $4; } 1828 | '|' '(' push type_parameter_list pop ')' '{' push context_declaration_list '}' '(' type_name_list ')'1831 | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}' '(' type_name_list ')' 1829 1832 { $$ = 0; } 1830 1833 ; … … 1841 1844 1842 1845 type_declaring_list: // CFA 1843 TYPE type_declarator1844 { $$ = $2; } 1845 | storage_class_list TYPE type_declarator1846 OTYPE type_declarator 1847 { $$ = $2; } 1848 | storage_class_list OTYPE type_declarator 1846 1849 { $$ = $3->addQualifiers( $1 ); } 1847 1850 | type_declaring_list ',' type_declarator … … 1869 1872 ; 1870 1873 1871 context_specifier: // CFA1872 CONTEXT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}'1874 trait_specifier: // CFA 1875 TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}' 1873 1876 { 1874 1877 typedefTable.addToEnclosingScope( *$2, TypedefTable::ID ); 1875 $$ = DeclarationNode::new Context( $2, $5, 0 );1876 } 1877 | CONTEXT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{'1878 { 1879 typedefTable.enter Context( *$2 );1878 $$ = DeclarationNode::newTrait( $2, $5, 0 ); 1879 } 1880 | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' 1881 { 1882 typedefTable.enterTrait( *$2 ); 1880 1883 typedefTable.enterScope(); 1881 1884 } 1882 context_declaration_list '}'1883 { 1884 typedefTable.leave Context();1885 trait_declaration_list '}' 1886 { 1887 typedefTable.leaveTrait(); 1885 1888 typedefTable.addToEnclosingScope( *$2, TypedefTable::ID ); 1886 $$ = DeclarationNode::new Context( $2, $5, $10 );1887 } 1888 ; 1889 1890 context_declaration_list: // CFA1891 context_declaration1892 | context_declaration_list push context_declaration1889 $$ = DeclarationNode::newTrait( $2, $5, $10 ); 1890 } 1891 ; 1892 1893 trait_declaration_list: // CFA 1894 trait_declaration 1895 | trait_declaration_list push trait_declaration 1893 1896 { $$ = $1->appendList( $3 ); } 1894 1897 ; 1895 1898 1896 context_declaration: // CFA1897 new_ context_declaring_list pop ';'1898 | context_declaring_list pop ';'1899 ; 1900 1901 new_ context_declaring_list: // CFA1899 trait_declaration: // CFA 1900 new_trait_declaring_list pop ';' 1901 | trait_declaring_list pop ';' 1902 ; 1903 1904 new_trait_declaring_list: // CFA 1902 1905 new_variable_specifier 1903 1906 { … … 1910 1913 $$ = $1; 1911 1914 } 1912 | new_ context_declaring_list pop ',' push identifier_or_type_name1915 | new_trait_declaring_list pop ',' push identifier_or_type_name 1913 1916 { 1914 1917 typedefTable.addToEnclosingScope2( *$5, TypedefTable::ID ); … … 1917 1920 ; 1918 1921 1919 context_declaring_list: // CFA1922 trait_declaring_list: // CFA 1920 1923 type_specifier declarator 1921 1924 { … … 1923 1926 $$ = $2->addType( $1 ); 1924 1927 } 1925 | context_declaring_list pop ',' push declarator1928 | trait_declaring_list pop ',' push declarator 1926 1929 { 1927 1930 typedefTable.addToEnclosingScope2( TypedefTable::ID );
Note: See TracChangeset
for help on using the changeset viewer.