Changeset e612146c for src/Parser
- Timestamp:
- Sep 3, 2017, 11:30:57 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 3f8dd01
- Parents:
- f43df73
- Location:
- src/Parser
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
rf43df73 re612146c 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Sep 1 22:57:24201713 // Update Count : 6 2512 // Last Modified On : Sun Sep 3 22:21:21 2017 13 // Update Count : 639 14 14 // 15 15 … … 218 218 } // build_constantChar 219 219 220 ConstantExpr* build_constantStr( string & str ) {220 Expression * build_constantStr( string & str ) { 221 221 string units; // units 222 222 sepString( str, units, '"' ); // separate constant from units 223 223 224 ArrayType * at = new ArrayType( noQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), 224 BasicType::Kind strtype = BasicType::Char; // default string type 225 switch ( str[0] ) { // str has >= 2 characters, i.e, null string "" 226 case 'u': 227 if ( str[1] == '8' ) break; // utf-8 characters 228 strtype = BasicType::ShortUnsignedInt; 229 break; 230 case 'U': 231 strtype = BasicType::UnsignedInt; 232 break; 233 case 'L': 234 strtype = BasicType::SignedInt; 235 break; 236 } // switch 237 ArrayType * at = new ArrayType( noQualifiers, new BasicType( Type::Qualifiers( Type::Const ), strtype ), 225 238 new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ), // +1 for '\0' and -2 for '"' 226 239 false, false ); 227 ConstantExpr * ret = new ConstantExpr( Constant( at, str, (unsigned long long int)0 ) ); // constant 0 is ignored for pure string value 228 // ROB: type mismatch 229 // if ( units.length() != 0 ) { 230 // ret = new UntypedExpr( new NameExpr( units ), { ret } ); 231 // } // if 240 Expression * ret = new ConstantExpr( Constant( at, str, (unsigned long long int)0 ) ); // constant 0 is ignored for pure string value 241 if ( units.length() != 0 ) { 242 ret = new UntypedExpr( new NameExpr( units ), { ret } ); 243 } // if 232 244 233 245 delete &str; // created by lex … … 410 422 } // build_range 411 423 412 Expression * build_asmexpr( ExpressionNode * inout, ConstantExpr* constraint, ExpressionNode * operand ) {424 Expression * build_asmexpr( ExpressionNode * inout, Expression * constraint, ExpressionNode * operand ) { 413 425 return new AsmExpr( maybeMoveBuild< Expression >( inout ), constraint, maybeMoveBuild< Expression >(operand) ); 414 426 } // build_asmexpr -
src/Parser/ParseNode.h
rf43df73 re612146c 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 31 17:42:49201713 // Update Count : 79 712 // Last Modified On : Sun Sep 3 19:24:34 2017 13 // Update Count : 799 14 14 // 15 15 … … 165 165 Expression * build_constantFloat( std::string &str ); 166 166 Expression * build_constantChar( std::string &str ); 167 ConstantExpr* build_constantStr( std::string &str );167 Expression * build_constantStr( std::string &str ); 168 168 Expression * build_field_name_FLOATINGconstant( const std::string & str ); 169 169 Expression * build_field_name_fraction_constants( Expression * fieldName, ExpressionNode * fracts ); … … 197 197 Expression * build_func( ExpressionNode * function, ExpressionNode * expr_node ); 198 198 Expression * build_range( ExpressionNode * low, ExpressionNode * high ); 199 Expression * build_asmexpr( ExpressionNode * inout, ConstantExpr* constraint, ExpressionNode * operand );199 Expression * build_asmexpr( ExpressionNode * inout, Expression * constraint, ExpressionNode * operand ); 200 200 Expression * build_valexpr( StatementNode * s ); 201 201 Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids ); … … 330 330 bool hasEllipsis; 331 331 LinkageSpec::Spec linkage; 332 ConstantExpr*asmName;332 Expression *asmName; 333 333 std::list< Attribute * > attributes; 334 334 InitializerNode * initializer; … … 413 413 Statement * build_finally( StatementNode * stmt ); 414 414 Statement * build_compound( StatementNode * first ); 415 Statement * build_asmstmt( bool voltile, ConstantExpr* instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );415 Statement * build_asmstmt( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr ); 416 416 WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when ); 417 417 WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when, WaitForStmt * existing ); -
src/Parser/StatementNode.cc
rf43df73 re612146c 10 10 // Created On : Sat May 16 14:59:41 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 17 16:01:31201713 // Update Count : 34 512 // Last Modified On : Fri Sep 1 23:25:23 2017 13 // Update Count : 346 14 14 // 15 15 … … 300 300 } 301 301 302 Statement *build_asmstmt( bool voltile, ConstantExpr*instruction, ExpressionNode *output, ExpressionNode *input, ExpressionNode *clobber, LabelNode *gotolabels ) {302 Statement *build_asmstmt( bool voltile, Expression *instruction, ExpressionNode *output, ExpressionNode *input, ExpressionNode *clobber, LabelNode *gotolabels ) { 303 303 std::list< Expression * > out, in; 304 304 std::list< ConstantExpr * > clob; -
src/Parser/TypeData.cc
rf43df73 re612146c 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:12:51 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Aug 14 10:41:00201713 // Update Count : 56 811 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Sep 1 23:13:38 2017 13 // Update Count : 569 14 14 // 15 15 … … 814 814 } // buildTypeof 815 815 816 Declaration * buildDecl( const TypeData * td, const string &name, Type::StorageClasses scs, Expression * bitfieldWidth, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, ConstantExpr*asmName, Initializer * init, std::list< Attribute * > attributes ) {816 Declaration * buildDecl( const TypeData * td, const string &name, Type::StorageClasses scs, Expression * bitfieldWidth, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, Expression *asmName, Initializer * init, std::list< Attribute * > attributes ) { 817 817 if ( td->kind == TypeData::Function ) { 818 818 if ( td->function.idList ) { // KR function ? -
src/Parser/TypeData.h
rf43df73 re612146c 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:18:36 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Aug 14 10:38:00201713 // Update Count : 1 8911 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Sep 1 23:33:45 2017 13 // Update Count : 190 14 14 // 15 15 … … 118 118 TupleType * buildTuple( const TypeData * ); 119 119 TypeofType * buildTypeof( const TypeData * ); 120 Declaration * buildDecl( const TypeData *, const std::string &, Type::StorageClasses, Expression *, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec, ConstantExpr *asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );120 Declaration * buildDecl( const TypeData *, const std::string &, Type::StorageClasses, Expression *, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec, Expression * asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() ); 121 121 FunctionType * buildFunction( const TypeData * ); 122 122 void buildKRFunction( const TypeData::Function_t & function ); -
src/Parser/parser.yy
rf43df73 re612146c 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 30 07:04:19 201713 // Update Count : 274 012 // Last Modified On : Sun Sep 3 20:43:19 2017 13 // Update Count : 2742 14 14 // 15 15 … … 100 100 StatementNode * sn; 101 101 WaitForStmt * wfs; 102 ConstantExpr* constant;102 Expression * constant; 103 103 IfCtl * ifctl; 104 104 ForCtl * fctl;
Note:
See TracChangeset
for help on using the changeset viewer.