Changes in / [e20f53c:ea29e73]
- Location:
- src
- Files:
-
- 1 deleted
- 13 edited
-
ControlStruct/CaseRangeMutator.cc (modified) (1 diff)
-
GenPoly/Box.cc (modified) (2 diffs)
-
GenPoly/GenPoly.cc (modified) (2 diffs)
-
InitTweak/FixGlobalInit.cc (modified) (5 diffs)
-
Parser/ExpressionNode.cc (modified) (5 diffs)
-
Parser/ParseNode.cc (modified) (1 diff)
-
Parser/ParseNode.h (modified) (2 diffs)
-
Parser/parser.cc (modified) (8 diffs)
-
Parser/parser.yy (modified) (6 diffs)
-
SynTree/Constant.h (modified) (2 diffs)
-
libcfa/stdlib (modified) (2 diffs)
-
libcfa/stdlib.c (modified) (2 diffs)
-
tests/.expect/quoted_keyword.txt (deleted)
-
tests/quoted_keyword.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/CaseRangeMutator.cc
re20f53c rea29e73 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 30 13:28:55201613 // Update Count : 812 // Last Modified On : Mon Jan 25 21:22:40 2016 13 // Update Count : 4 14 14 // 15 15 -
src/GenPoly/Box.cc
re20f53c rea29e73 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Jun 29 21:43:03201613 // Update Count : 29 611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 14:51:21 2016 13 // Update Count : 295 14 14 // 15 15 … … 2294 2294 // all union members are at offset zero 2295 2295 delete offsetofExpr; 2296 return new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), "0") );2296 return new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), std::string("0") ) ); 2297 2297 } else return offsetofExpr; 2298 2298 } -
src/GenPoly/GenPoly.cc
re20f53c rea29e73 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Jun 29 21:45:53201613 // Update Count : 1 411 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed May 25 13:39:21 2016 13 // Update Count : 13 14 14 // 15 15 … … 78 78 type = replaceTypeInst( type, env ); 79 79 80 if ( dynamic_cast< TypeInstType * >( type ) ) {80 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) { 81 81 return type; 82 82 } else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) { -
src/InitTweak/FixGlobalInit.cc
re20f53c rea29e73 9 9 // Author : Rob Schluntz 10 10 // Created On : Mon May 04 15:14:56 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Jun 29 22:33:15201613 // Update Count : 411 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:37:30 2016 13 // Update Count : 2 14 14 // 15 15 … … 85 85 init->accept( checker ); 86 86 return checker.isConstExpr; 87 } // if87 } 88 88 // for all intents and purposes, no initializer means const expr 89 89 return true; … … 98 98 } else { 99 99 translationUnit.push_back( fixer.initFunction ); 100 } // if 101 100 } 102 101 if ( fixer.destroyFunction->get_statements()->get_kids().empty() ) { 103 102 delete fixer.destroyFunction; 104 103 } else { 105 104 translationUnit.push_back( fixer.destroyFunction ); 106 } // if105 } 107 106 } 108 107 … … 147 146 // if ( isConstExpr( objDecl->get_init() ) ) return; 148 147 149 if ( dynamic_cast< ArrayType * > ( objDecl->get_type() ) ) {148 if ( ArrayType * at = dynamic_cast< ArrayType * > ( objDecl->get_type() ) ) { 150 149 // xxx - initialize each element of the array 151 150 } else { … … 165 164 destroy->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) ); 166 165 destroyStatements.push_front( new ImplicitCtorDtorStmt( new ExprStmt( noLabels, destroy ) ) ); 167 } // if166 } 168 167 } 169 168 -
src/Parser/ExpressionNode.cc
re20f53c rea29e73 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 30 13:33:16201613 // Update Count : 3 1912 // Last Modified On : Mon Jun 13 14:46:17 2016 13 // Update Count : 307 14 14 // 15 15 … … 19 19 #include <sstream> 20 20 #include <cstdio> 21 #include <climits> 21 22 22 23 #include "ParseNode.h" … … 89 90 //############################################################################## 90 91 91 ConstantNode::ConstantNode( ConstantExpr *expr ) : expr( expr ) { 92 static inline bool checkU( char c ) { return c == 'u' || c == 'U'; } 93 static inline bool checkL( char c ) { return c == 'l' || c == 'L'; } 94 static inline bool checkF( char c ) { return c == 'f' || c == 'F'; } 95 static inline bool checkD( char c ) { return c == 'd' || c == 'D'; } 96 static inline bool checkI( char c ) { return c == 'i' || c == 'I'; } 97 static inline bool checkX( char c ) { return c == 'x' || c == 'X'; } 98 99 // Difficult to separate extra parts of constants during lexing because actions are not allow in the middle of patterns: 100 // 101 // prefix action constant action suffix 102 // 103 // Alternatively, breaking a pattern using BEGIN does not work if the following pattern can be empty: 104 // 105 // constant BEGIN CONT ... 106 // <CONT>(...)? BEGIN 0 ... // possible empty suffix 107 // 108 // because the CONT rule is NOT triggered if the pattern is empty. Hence, constants are reparsed here to determine their 109 // type. 110 111 ConstantNode::ConstantNode( Type t, string *inVal ) : type( t ), value( *inVal ) { 112 // lexing divides constants into 4 kinds 113 switch ( type ) { 114 case Integer: 115 { 116 static const BasicType::Kind kind[2][3] = { 117 { BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt }, 118 { BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt }, 119 }; 120 bool dec = true, Unsigned = false; // decimal, unsigned constant 121 int size; // 0 => int, 1 => long, 2 => long long 122 unsigned long long v; // converted integral value 123 size_t last = value.length() - 1; // last character of constant 124 125 if ( value[0] == '0' ) { // octal constant ? 126 dec = false; 127 if ( last != 0 && checkX( value[1] ) ) { // hex constant ? 128 sscanf( (char *)value.c_str(), "%llx", &v ); 129 //printf( "%llx %llu\n", v, v ); 130 } else { 131 sscanf( (char *)value.c_str(), "%llo", &v ); 132 //printf( "%llo %llu\n", v, v ); 133 } // if 134 } else { // decimal constant ? 135 sscanf( (char *)value.c_str(), "%llu", &v ); 136 //printf( "%llu %llu\n", v, v ); 137 } // if 138 139 if ( v <= INT_MAX ) { // signed int 140 size = 0; 141 } else if ( v <= UINT_MAX && ! dec ) { // unsigned int 142 size = 0; 143 Unsigned = true; // unsigned 144 } else if ( v <= LONG_MAX ) { // signed long int 145 size = 1; 146 } else if ( v <= ULONG_MAX && ( ! dec || LONG_MAX == LLONG_MAX ) ) { // signed long int 147 size = 1; 148 Unsigned = true; // unsigned long int 149 } else if ( v <= LLONG_MAX ) { // signed long long int 150 size = 2; 151 } else { // unsigned long long int 152 size = 2; 153 Unsigned = true; // unsigned long long int 154 } // if 155 156 if ( checkU( value[last] ) ) { // suffix 'u' ? 157 Unsigned = true; 158 if ( last > 0 && checkL( value[ last - 1 ] ) ) { // suffix 'l' ? 159 size = 1; 160 if ( last > 1 && checkL( value[ last - 2 ] ) ) { // suffix 'll' ? 161 size = 2; 162 } // if 163 } // if 164 } else if ( checkL( value[ last ] ) ) { // suffix 'l' ? 165 size = 1; 166 if ( last > 0 && checkL( value[ last - 1 ] ) ) { // suffix 'll' ? 167 size = 2; 168 if ( last > 1 && checkU( value[ last - 2 ] ) ) { // suffix 'u' ? 169 Unsigned = true; 170 } // if 171 } else { 172 if ( last > 0 && checkU( value[ last - 1 ] ) ) { // suffix 'u' ? 173 Unsigned = true; 174 } // if 175 } // if 176 } // if 177 btype = kind[Unsigned][size]; // lookup constant type 178 break; 179 } 180 case Float: 181 { 182 static const BasicType::Kind kind[2][3] = { 183 { BasicType::Float, BasicType::Double, BasicType::LongDouble }, 184 { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex }, 185 }; 186 bool complx = false; // real, complex 187 int size = 1; // 0 => float, 1 => double (default), 2 => long double 188 // floating-point constant has minimum of 2 characters: 1. or .1 189 size_t last = value.length() - 1; 190 191 if ( checkI( value[last] ) ) { // imaginary ? 192 complx = true; 193 last -= 1; // backup one character 194 } // if 195 if ( checkF( value[last] ) ) { // float ? 196 size = 0; 197 } else if ( checkD( value[last] ) ) { // double ? 198 size = 1; 199 } else if ( checkL( value[last] ) ) { // long double ? 200 size = 2; 201 } // if 202 if ( ! complx && checkI( value[last - 1] ) ) { // imaginary ? 203 complx = true; 204 } // if 205 btype = kind[complx][size]; // lookup constant type 206 break; 207 } 208 case Character: 209 btype = BasicType::Char; // default 210 if ( string( "LUu" ).find( value[0] ) != string::npos ) { 211 // ??? 212 } // if 213 break; 214 case String: 215 // array of char 216 if ( string( "LUu" ).find( value[0] ) != string::npos ) { 217 if ( value[0] == 'u' && value[1] == '8' ) { 218 // ??? 219 } else { 220 // ??? 221 } // if 222 } // if 223 break; 224 } // switch 92 225 } // ConstantNode::ConstantNode 93 226 94 227 ConstantNode *ConstantNode::appendstr( const std::string *newValue ) { 95 228 assert( newValue != 0 ); 96 string value = expr->get_constant()->get_value();229 assert( type == String ); 97 230 98 231 // "abc" "def" "ghi" => "abcdefghi", remove new text from quotes and insert before last quote in old string. … … 104 237 105 238 void ConstantNode::printOneLine( std::ostream &os, int indent ) const { 106 //os << string( indent, ' ' );107 //printDesignation( os );108 109 //switch ( type ) {110 //case Integer:111 //case Float:112 //os << value ;113 //break;114 //case Character:115 //os << "'" << value << "'";116 //break;117 //case String:118 //os << '"' << value << '"';119 //break;120 //} // switch121 122 //os << ' ';239 os << string( indent, ' ' ); 240 printDesignation( os ); 241 242 switch ( type ) { 243 case Integer: 244 case Float: 245 os << value ; 246 break; 247 case Character: 248 os << "'" << value << "'"; 249 break; 250 case String: 251 os << '"' << value << '"'; 252 break; 253 } // switch 254 255 os << ' '; 123 256 } 124 257 … … 129 262 130 263 Expression *ConstantNode::build() const { 131 return expr->clone(); 264 ::Type::Qualifiers q; // no qualifiers on constants 265 266 switch ( get_type() ) { 267 case String: 268 { 269 // string should probably be a primitive type 270 ArrayType *at = new ArrayType( q, new BasicType( q, BasicType::Char ), 271 new ConstantExpr( 272 Constant( new BasicType( q, BasicType::UnsignedInt ), 273 toString( value.size()+1-2 ) ) ), // +1 for '\0' and -2 for '"' 274 false, false ); 275 return new ConstantExpr( Constant( at, value ), maybeBuild< Expression >( get_argName() ) ); 276 } 277 default: 278 return new ConstantExpr( Constant( new BasicType( q, btype ), get_value() ), maybeBuild< Expression >( get_argName() ) ); 279 } 132 280 } 133 281 -
src/Parser/ParseNode.cc
re20f53c rea29e73 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:26:29 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Jun 30 13:30:43 201613 // Update Count : 5011 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Aug 12 13:26:00 2015 13 // Update Count : 36 14 14 // 15 15 16 #include <climits>17 16 #include "ParseNode.h" 18 17 using namespace std; 19 20 // Difficult to separate extra parts of constants during lexing because actions are not allow in the middle of patterns:21 //22 // prefix action constant action suffix23 //24 // Alternatively, breaking a pattern using BEGIN does not work if the following pattern can be empty:25 //26 // constant BEGIN CONT ...27 // <CONT>(...)? BEGIN 0 ... // possible empty suffix28 //29 // because the CONT rule is NOT triggered if the pattern is empty. Hence, constants are reparsed here to determine their30 // type.31 32 static inline bool checkU( char c ) { return c == 'u' || c == 'U'; }33 static inline bool checkL( char c ) { return c == 'l' || c == 'L'; }34 static inline bool checkF( char c ) { return c == 'f' || c == 'F'; }35 static inline bool checkD( char c ) { return c == 'd' || c == 'D'; }36 static inline bool checkI( char c ) { return c == 'i' || c == 'I'; }37 static inline bool checkX( char c ) { return c == 'x' || c == 'X'; }38 39 BasicType::Kind literalType( ConstantNode::Type type, string &value ) {40 BasicType::Kind btype;41 42 // lexing divides constants into 4 kinds43 switch ( type ) {44 case ConstantNode::Integer:45 {46 static const BasicType::Kind kind[2][3] = {47 { BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt },48 { BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt },49 };50 bool dec = true, Unsigned = false; // decimal, unsigned constant51 int size; // 0 => int, 1 => long, 2 => long long52 unsigned long long v; // converted integral value53 size_t last = value.length() - 1; // last character of constant54 55 if ( value[0] == '0' ) { // octal constant ?56 dec = false;57 if ( last != 0 && checkX( value[1] ) ) { // hex constant ?58 sscanf( (char *)value.c_str(), "%llx", &v );59 //printf( "%llx %llu\n", v, v );60 } else {61 sscanf( (char *)value.c_str(), "%llo", &v );62 //printf( "%llo %llu\n", v, v );63 } // if64 } else { // decimal constant ?65 sscanf( (char *)value.c_str(), "%llu", &v );66 //printf( "%llu %llu\n", v, v );67 } // if68 69 if ( v <= INT_MAX ) { // signed int70 size = 0;71 } else if ( v <= UINT_MAX && ! dec ) { // unsigned int72 size = 0;73 Unsigned = true; // unsigned74 } else if ( v <= LONG_MAX ) { // signed long int75 size = 1;76 } else if ( v <= ULONG_MAX && ( ! dec || LONG_MAX == LLONG_MAX ) ) { // signed long int77 size = 1;78 Unsigned = true; // unsigned long int79 } else if ( v <= LLONG_MAX ) { // signed long long int80 size = 2;81 } else { // unsigned long long int82 size = 2;83 Unsigned = true; // unsigned long long int84 } // if85 86 if ( checkU( value[last] ) ) { // suffix 'u' ?87 Unsigned = true;88 if ( last > 0 && checkL( value[ last - 1 ] ) ) { // suffix 'l' ?89 size = 1;90 if ( last > 1 && checkL( value[ last - 2 ] ) ) { // suffix 'll' ?91 size = 2;92 } // if93 } // if94 } else if ( checkL( value[ last ] ) ) { // suffix 'l' ?95 size = 1;96 if ( last > 0 && checkL( value[ last - 1 ] ) ) { // suffix 'll' ?97 size = 2;98 if ( last > 1 && checkU( value[ last - 2 ] ) ) { // suffix 'u' ?99 Unsigned = true;100 } // if101 } else {102 if ( last > 0 && checkU( value[ last - 1 ] ) ) { // suffix 'u' ?103 Unsigned = true;104 } // if105 } // if106 } // if107 btype = kind[Unsigned][size]; // lookup constant type108 break;109 }110 case ConstantNode::Float:111 {112 static const BasicType::Kind kind[2][3] = {113 { BasicType::Float, BasicType::Double, BasicType::LongDouble },114 { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex },115 };116 bool complx = false; // real, complex117 int size = 1; // 0 => float, 1 => double (default), 2 => long double118 // floating-point constant has minimum of 2 characters: 1. or .1119 size_t last = value.length() - 1;120 121 if ( checkI( value[last] ) ) { // imaginary ?122 complx = true;123 last -= 1; // backup one character124 } // if125 if ( checkF( value[last] ) ) { // float ?126 size = 0;127 } else if ( checkD( value[last] ) ) { // double ?128 size = 1;129 } else if ( checkL( value[last] ) ) { // long double ?130 size = 2;131 } // if132 if ( ! complx && checkI( value[last - 1] ) ) { // imaginary ?133 complx = true;134 } // if135 btype = kind[complx][size]; // lookup constant type136 break;137 }138 case ConstantNode::Character:139 btype = BasicType::Char; // default140 if ( string( "LUu" ).find( value[0] ) != string::npos ) {141 // ???142 } // if143 break;144 case ConstantNode::String:145 assert( false );146 // array of char147 if ( string( "LUu" ).find( value[0] ) != string::npos ) {148 if ( value[0] == 'u' && value[1] == '8' ) {149 // ???150 } else {151 // ???152 } // if153 } // if154 break;155 } // switch156 return btype;157 } // literalType158 159 ConstantNode *makeConstant( ConstantNode::Type type, std::string *str ) {160 ::Type::Qualifiers emptyQualifiers; // no qualifiers on constants161 return new ConstantNode( new ConstantExpr( Constant( new BasicType( emptyQualifiers, literalType( type, *str ) ), *str ), nullptr ) );162 }163 164 ConstantNode *makeConstantStr( ConstantNode::Type type, std::string *str ) {165 ::Type::Qualifiers emptyQualifiers; // no qualifiers on constants166 // string should probably be a primitive type167 ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( emptyQualifiers, BasicType::Char ),168 new ConstantExpr(169 Constant( new BasicType( emptyQualifiers, BasicType::UnsignedInt ),170 toString( str->size()+1-2 ) ) ), // +1 for '\0' and -2 for '"'171 false, false );172 return new ConstantNode( new ConstantExpr( Constant( at, *str ), nullptr ) );173 }174 175 18 176 19 // Builder -
src/Parser/ParseNode.h
re20f53c rea29e73 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 30 11:48:28201613 // Update Count : 2 5212 // Last Modified On : Mon Jun 27 23:28:10 2016 13 // Update Count : 242 14 14 // 15 15 … … 126 126 enum Type { Integer, Float, Character, String }; 127 127 128 ConstantNode( ConstantExpr* );129 ConstantNode( const ConstantNode &other ) : expr( other.expr->clone() ) {};130 ~ConstantNode() { delete expr; }128 ConstantNode( Type, std::string * ); 129 ConstantNode( const ConstantNode &other ) : type( other.type ), btype( other.btype), value( *new std::string( other.value ) ) {}; 130 ~ConstantNode() { delete &value; } 131 131 132 132 virtual ConstantNode *clone() const { return new ConstantNode( *this ); } 133 Type get_type( void ) const { return type; } 133 134 virtual void print( std::ostream &, int indent = 0) const; 134 135 virtual void printOneLine( std::ostream &, int indent = 0) const; 135 136 137 const std::string &get_value() const { return value; } 136 138 ConstantNode *appendstr( const std::string *newValue ); 137 139 138 140 Expression *build() const; 139 141 private: 140 ConstantExpr *expr; 141 }; 142 143 ConstantNode *makeConstant( ConstantNode::Type, std::string * ); 144 ConstantNode *makeConstantStr( ConstantNode::Type type, std::string *str ); 142 Type type; 143 BasicType::Kind btype; 144 std::string &value; 145 }; 145 146 146 147 class VarRefNode : public ExpressionNode { -
src/Parser/parser.cc
re20f53c rea29e73 5237 5237 /* Line 1806 of yacc.c */ 5238 5238 #line 305 "parser.yy" 5239 { (yyval.constant) = makeConstant( ConstantNode::Integer, (yyvsp[(1) - (1)].tok) ); }5239 { (yyval.constant) = new ConstantNode( ConstantNode::Integer, (yyvsp[(1) - (1)].tok) ); } 5240 5240 break; 5241 5241 … … 5244 5244 /* Line 1806 of yacc.c */ 5245 5245 #line 306 "parser.yy" 5246 { (yyval.constant) = makeConstant( ConstantNode::Float, (yyvsp[(1) - (1)].tok) ); }5246 { (yyval.constant) = new ConstantNode( ConstantNode::Float, (yyvsp[(1) - (1)].tok) ); } 5247 5247 break; 5248 5248 … … 5251 5251 /* Line 1806 of yacc.c */ 5252 5252 #line 307 "parser.yy" 5253 { (yyval.constant) = makeConstant( ConstantNode::Character, (yyvsp[(1) - (1)].tok) ); }5253 { (yyval.constant) = new ConstantNode( ConstantNode::Character, (yyvsp[(1) - (1)].tok) ); } 5254 5254 break; 5255 5255 … … 5258 5258 /* Line 1806 of yacc.c */ 5259 5259 #line 332 "parser.yy" 5260 { (yyval.constant) = makeConstantStr( ConstantNode::String, (yyvsp[(1) - (1)].tok) ); }5260 { (yyval.constant) = new ConstantNode( ConstantNode::String, (yyvsp[(1) - (1)].tok) ); } 5261 5261 break; 5262 5262 … … 5953 5953 /* Line 1806 of yacc.c */ 5954 5954 #line 684 "parser.yy" 5955 { (yyval.sn) = (new StatementNode( (yyvsp[(2) - (2)].decl) ))->set_extension( true ); }5955 { (yyval.sn) = new StatementNode( (yyvsp[(2) - (2)].decl) )/*->set_extension( true )*/; } 5956 5956 break; 5957 5957 … … 7266 7266 /* Line 1806 of yacc.c */ 7267 7267 #line 1474 "parser.yy" 7268 { (yyval.decl) = (yyvsp[(2) - (3)].decl) ->set_extension( true ); }7268 { (yyval.decl) = (yyvsp[(2) - (3)].decl)/*->set_extension( true )*/; } 7269 7269 break; 7270 7270 … … 7273 7273 /* Line 1806 of yacc.c */ 7274 7274 #line 1477 "parser.yy" 7275 { (yyval.decl) = (yyvsp[(2) - (3)].decl) ->set_extension( true ); }7275 { (yyval.decl) = (yyvsp[(2) - (3)].decl)/*->set_extension( true )*/; } 7276 7276 break; 7277 7277 … … 8057 8057 /* Line 1806 of yacc.c */ 8058 8058 #line 1993 "parser.yy" 8059 { (yyval.decl) = (yyvsp[(2) - (2)].decl) ->set_extension( true ); }8059 { (yyval.decl) = (yyvsp[(2) - (2)].decl)/*->set_extension( true )*/; } 8060 8060 break; 8061 8061 -
src/Parser/parser.yy
re20f53c rea29e73 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 30 13:26:01201613 // Update Count : 16 3912 // Last Modified On : Mon Jun 27 17:47:56 2016 13 // Update Count : 1627 14 14 // 15 15 … … 303 303 constant: 304 304 // ENUMERATIONconstant is not included here; it is treated as a variable with type "enumeration constant". 305 INTEGERconstant { $$ = makeConstant( ConstantNode::Integer, $1 ); }306 | FLOATINGconstant { $$ = makeConstant( ConstantNode::Float, $1 ); }307 | CHARACTERconstant { $$ = makeConstant( ConstantNode::Character, $1 ); }305 INTEGERconstant { $$ = new ConstantNode( ConstantNode::Integer, $1 ); } 306 | FLOATINGconstant { $$ = new ConstantNode( ConstantNode::Float, $1 ); } 307 | CHARACTERconstant { $$ = new ConstantNode( ConstantNode::Character, $1 ); } 308 308 ; 309 309 … … 330 330 331 331 string_literal_list: // juxtaposed strings are concatenated 332 STRINGliteral { $$ = makeConstantStr( ConstantNode::String, $1 ); }332 STRINGliteral { $$ = new ConstantNode( ConstantNode::String, $1 ); } 333 333 | string_literal_list STRINGliteral { $$ = $1->appendstr( $2 ); } 334 334 ; … … 682 682 { $$ = new StatementNode( $1 ); } 683 683 | EXTENSION declaration // GCC 684 { $$ = (new StatementNode( $2 ))->set_extension( true ); }684 { $$ = new StatementNode( $2 )/*->set_extension( true )*/; } 685 685 | function_definition 686 686 { $$ = new StatementNode( $1 ); } … … 1472 1472 new_field_declaring_list ';' // CFA, new style field declaration 1473 1473 | EXTENSION new_field_declaring_list ';' // GCC 1474 { $$ = $2 ->set_extension( true ); }1474 { $$ = $2/*->set_extension( true )*/; } 1475 1475 | field_declaring_list ';' 1476 1476 | EXTENSION field_declaring_list ';' // GCC 1477 { $$ = $2 ->set_extension( true ); }1477 { $$ = $2/*->set_extension( true )*/; } 1478 1478 ; 1479 1479 … … 1991 1991 } 1992 1992 | EXTENSION external_definition 1993 { $$ = $2 ->set_extension( true ); }1993 { $$ = $2/*->set_extension( true )*/; } 1994 1994 ; 1995 1995 -
src/SynTree/Constant.h
re20f53c rea29e73 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Ju n 30 13:33:17 201613 // Update Count : 612 // Last Modified On : Thu Jul 30 15:19:16 2015 13 // Update Count : 5 14 14 // 15 15 … … 29 29 Type *get_type() { return type; } 30 30 void set_type( Type *newValue ) { type = newValue; } 31 std::string &get_value() { return value; }31 std::string get_value() { return value; } 32 32 void set_value( std::string newValue ) { value = newValue; } 33 33 -
src/libcfa/stdlib
re20f53c rea29e73 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 30 15:04:18201613 // Update Count : 9 712 // Last Modified On : Wed Apr 27 22:03:29 2016 13 // Update Count : 96 14 14 // 15 15 … … 129 129 T max( const T t1, const T t2 ); 130 130 131 forall( otype T | { T min( T, T ); T max( T, T ); } )132 T clamp( const T value, const T min_val, const T max_val );133 134 131 forall( otype T ) 135 132 void swap( T * t1, T * t2 ); -
src/libcfa/stdlib.c
re20f53c rea29e73 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 30 15:04:25201613 // Update Count : 16 812 // Last Modified On : Thu Apr 28 07:54:21 2016 13 // Update Count : 166 14 14 // 15 15 … … 254 254 } // max 255 255 256 forall( otype T | { T min( T, T ); T max( T, T ); } )257 T clamp( const T value, const T min_val, const T max_val ) {258 return max( min_val, min( value, max_val ) );259 } // clamp260 261 256 forall( otype T ) 262 257 void swap( T * t1, T * t2 ) { -
src/tests/quoted_keyword.c
re20f53c rea29e73 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 30 14:03:59201613 // Update Count : 1 912 // Last Modified On : Sat Jun 25 08:02:58 2016 13 // Update Count : 16 14 14 // 15 15 … … 37 37 int main() { 38 38 int `if` = 0; 39 `catch` = 1;40 st.`otype` = 2;41 st.`struct` = 3;42 `throw` = 4;43 39 sout | `catch` + st.`otype` + st.`struct` + `throw` | endl; 44 40 }
Note:
See TracChangeset
for help on using the changeset viewer.