Ticket #43: oneLineDocStr.patch
File oneLineDocStr.patch, 2.4 KB (added by hopscc, 16 years ago) |
---|
-
Source/CobraTokenizer.cobra
119 119 120 120 # doc strings 121 121 r'DOC_STRING_START """[ \t]*\n', 122 r'DOC_STRING_LINE """.*"""[ \t]*\n', 122 123 123 124 # sharp strings 124 125 r"SHARP_SINGLE sharp'[^'\n]*'", … … 879 880 assert _inDocString, tok 880 881 return tok 881 882 883 def onDOC_STRING_LINE(tok as IToken) as IToken 884 tok_start = Token(_fileName, _lineNum, tok.colNum, tok.charNum, 885 'DOC_STRING_START', '"""', '"""') 886 ei = tok.text.lastIndexOf('"""') 887 s = tok.text[3:ei] 888 tok_doc = Token(_fileName, _lineNum, tok.colNum+3, tok.charNum+3, 889 'DOC_STRING_BODY_TEXT', s, s) 890 l = tok.length - 3 891 tok_stop = Token(_fileName, _lineNum, tok.colNum+l, tok.charNum+l, 892 'DOC_STRING_STOP', '"""', '"""') 893 tok_start.nextToken = tok_doc 894 tok_doc.nextToken = tok_stop 895 return tok_start 882 896 883 897 ## 884 898 ## Simple string literals -
Tests/120-classes/909-doc-strings.cobra
1 # test one line docstrings 2 """ OneLine File DocString """ 3 class Test 4 """ class 1 liner -trail spc""" 5 6 enum Color 7 """ Enum docs.""" 8 Red 9 Green 10 Blue 11 12 var _x as int 13 """ Variable docs. - trail spc""" 14 15 def init 16 """ Construct docs. -trail spc/tab""" 17 pass 18 19 def main is shared 20 """ Method docs """ 21 pass 22 23 pro count as int 24 """ Property docs. """ 25 get 26 return 0 27 28 get x as int 29 """ Read-only property. """ 30 return 0 31 32 set y as int 33 """ Write-only property.""" 34 pass -
Developer/IntermediateReleaseNotes.text
1 1 Post 0.8 2 2 3 * Support one line docstrings 4 .code 5 """ This is a one line docStr""" 6 7 3 8 * Added support for "extended initializers" which allow you to set properties of the object in the same call being used to create the object: 4 9 .code 5 10 r = Rectangle(p1=Point(x=0, y=1), p2=Point(x=2, y=3))