Wiki

Ticket #42: stringTermin1.patch

File stringTermin1.patch, 1.7 KB (added by hopscc, 16 years ago)
  • Source/CobraTokenizer.cobra

     
    767767                    branch c 
    768768                        # TODO: any other codes? 
    769769                        on c'n', next = c'\n' 
     770                        #   chars.append(Environment.newLine) # alternative \n-> Env.nl 
    770771                        on c'r', next = c'\r' 
    771772                        on c't', next = c'\t' 
    772773                        on c'0', next = c'\0' 
     774                        on c'N'     # platfrom indep line termin 
     775                            chars.append(Environment.newLine) 
     776                        #   next = c'\n' # alternative \N-> nl 
    773777                        on c'\\' 
    774778                            chars.append(c'\\') 
    775779                            # cannot have `last` being a backslash anymore--it's considered consumed now 
  • Tests/100-basics/068-string-termin.cobra

     
     1# Test for platform independent line terminator in strings 
     2class Test 
     3    def main is shared 
     4        assert "\N" == Environment.newLine 
     5        assert '\N' == Environment.newLine 
     6        s = "\\N" 
     7        assert not s == Environment.newLine 
     8        assert s.length == 2 
     9        assert s == r'\N' 
     10        assert not r'\N' == Environment.newLine 
  • Developer/IntermediateReleaseNotes.text

     
    11Post 0.8 
     2* Add \N metacharacter in strings for platform line terminator 
    23 
    34* Added support for "extended initializers" which allow you to set properties of the object in the same call being used to create the object: 
    45.code