~mcfletch/simpleparse/pure-python

« back to all changes in this revision

Viewing changes to common/strings.py

  • Committer: Mike C. Fletcher
  • Date: 2011-09-06 20:51:03 UTC
  • Revision ID: mcfletch@vrplumber.com-20110906205103-h4h8jxu79yyed48c
Make simpleparse-pure test suite pass with no errors or warnings on Python 2.6, 2.7 and 3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
        return dispatch( self, sublist[0], buffer )
123
123
 
124
124
    def string_single_quote( self, (tag, left, right, sublist), buffer):
125
 
        return string.join(dispatchList(self, sublist, buffer), "")
 
125
        return "".join(dispatchList(self, sublist, buffer))
126
126
    string_double_quote = string_single_quote
127
127
    string_triple_single = string_single_quote
128
128
    string_triple_double = string_single_quote
132
132
    nondelimiter = char_no_quote
133
133
 
134
134
    def escaped_char( self, (tag, left, right, sublist), buffer):
135
 
        return string.join(dispatchList(self,sublist,buffer), "")
 
135
        return "".join(dispatchList(self,sublist,buffer))
136
136
    
137
137
    def octal_escaped_char(self, (tag, left, right, sublist), buffer):
138
 
        return chr(string.atoi( buffer[left:right], 8 ))
 
138
        return chr(int(buffer[left:right], 8 ))
139
139
    def hex_escaped_char( self, (tag, left, right, sublist), buffer):
140
 
        return chr(string.atoi( buffer[left:right], 16 ))
 
140
        return chr(int( buffer[left:right], 16 ))
141
141
    
142
142
    def backslash_char( self, (tag, left, right, sublist), buffer):
143
143
        return "\\"
158
158
    '"':'"',
159
159
    "'":"'",
160
160
    }
161
 
    
 
 
b'\\ No newline at end of file'
 
161