Changeset 1572
- Timestamp:
- 08/11/08 06:44:56 (3 months ago)
- Location:
- cobra/trunk
- Files:
-
- 2 added
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Developer/IntermediateReleaseNotes.text
r1571 r1572 1 1 Post 0.8 2 2 3 * Add support for commenting full blocks of lines using /# and #/. Block comments can be nested. 4 '/#' block comment start and '#/' block comment end as initial chars on line 3 * Added new comment markers /# ... #/ which can be used for block comments and inline comments. Block comments must start at the beginning of a line and can be used to comment out multiple lines of source. They can be nested. Inline comments also start with /# and end with #/, but within the same line. They can be used to comment out a portion of a line. Regular end of line comments are still available and still the norm. 4 .code 5 class Example 6 7 def main is shared 8 # an end-of-line comment 9 t = [1, 2, 3] # a list of numbers 10 11 # an inline comment 12 print t, /#t[0],#/ t.count 13 14 # a block comment 15 /# 16 def foo 17 print 'bar' 18 #/ 5 19 6 20 * Added support for a Cobra compiler directive to specify the type for `number` -
cobra/trunk/Source/CobraTokenizer.cobra
r1571 r1572 86 86 r'NO_INDENT ^(?=[^\t\n#\/])', 87 87 r'EOL \n', 88 r'INLINE_COMMENT \/\#.*\#/', 88 89 r'COMMENT_BLOCK_START ^\/\#.*$', 89 90 r'SINGLE_LINE_COMMENT \#.*', 91 r'AMBIGUOUS_COMMENT \/\#.*', 90 92 r'SPACE [ \t]+', 91 93 … … 509 511 return nil 510 512 513 def onINLINE_COMMENT(tok as IToken) as IToken? 514 # eat these 515 return nil 516 517 def onAMBIGUOUS_COMMENT(tok as IToken) as IToken? 518 .throwError('Ambiguous comment at /#. For an end-of-line comment, put a space between / and #. For an inline comment, end it with #/. For a block comment, put /# at the beginning of a line.') 519 return nil 520 511 521 def onSPACE(tok as IToken) as IToken? 512 522 # eat these
