Changeset 1569
- Timestamp:
- 08/06/08 02:23:08 (4 months ago)
- Location:
- cobra/trunk
- Files:
-
- 1 added
- 3 modified
-
Developer/IntermediateReleaseNotes.text (modified) (1 diff)
-
Source/CobraParser.cobra (modified) (2 diffs)
-
Source/Compiler.cobra (modified) (1 diff)
-
Tests/200-misc/300-number-type/200-number-directive.cobra (added)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Developer/IntermediateReleaseNotes.text
r1566 r1569 1 1 Post 0.8 2 2 3 * Added support for a Cobra compiler directive to specify the type for `number` 4 type of number and integer literals same as command line -number option 5 %% number 'decimal' | 'float' | 'float32' | 'float64' 6 3 7 * Added a new built-in doc tool accessible via "cobra -doc ...". The documentation is generated to local HTML files using your declarations, doc strings, contracts, etc. 4 8 -
cobra/trunk/Source/CobraParser.cobra
r1564 r1569 522 522 isGood = false 523 523 if not isGood 524 sugg = Compiler.suggestionFor(tok.text)524 sugg = if(tok.text.length, Compiler.suggestionFor(tok.text), nil) 525 525 sugg = if(sugg, ' Try "[sugg]".', '') 526 526 .throwError('Expecting use, assembly, namespace, class, interface or enum, but got [tok].[sugg]') … … 543 543 # TODO: throw AssertException(SourceSite sourceSite, object[] expressions, object thiss, object info) 544 544 assert false, IdentifierExpr(token, 'throw') 545 on 'number' 546 # number 'decimal' | 'float' | 'float32' | 'float64' 547 typeName = .grab 548 if typeName.text not in ['decimal', 'float', 'float32', 'float64'] 549 .throwError('Compiler directive "number": unrecognized type "[typeName.text]". Must be one of "decimal", "float", "float32" or "float64".') 550 .expect('EOL') 551 comp = .typeProvider to Compiler? 552 if comp, comp.numberTypeName = typeName.text 545 553 else 546 554 .throwError('Unknown compiler directive.') -
cobra/trunk/Source/Compiler.cobra
r1542 r1569 516 516 else, throw FallThroughException(.options['number']) 517 517 return _numberType to ! 518 518 519 set numberTypeName as String 520 """ 521 Set `number` type from a string/name. 522 """ 523 require value in ['decimal', 'float', 'float32', 'float64'] 524 branch value 525 on 'decimal', _numberType = .decimalType 526 on 'float', _numberType = .floatType 527 on 'float32', _numberType = .floatType(32) 528 on 'float64', _numberType = .floatType(64) 529 else, throw FallThroughException(value) 530 519 531 get passThroughType as PassThroughType 520 532 if _passThroughType is nil
