~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/cmdline.py

  • Committer: Vincent Ladeuil
  • Date: 2010-03-01 09:02:18 UTC
  • mto: (5064.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5065.
  • Revision ID: v.ladeuil+lp@free.fr-20100301090218-pq3ib5y07dx3wbp6
Delete spurious spaces.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    def __init__(self, orig):
27
27
        self._iter = iter(orig)
28
28
        self._pushback_buffer = []
29
 
        
 
29
 
30
30
    def next(self):
31
31
        if len(self._pushback_buffer) > 0:
32
32
            return self._pushback_buffer.pop()
33
33
        else:
34
34
            return self._iter.next()
35
 
    
 
35
 
36
36
    def pushback(self, char):
37
37
        self._pushback_buffer.append(char)
38
 
        
 
38
 
39
39
    def __iter__(self):
40
40
        return self
41
41
 
77
77
    def __init__(self, exit_state):
78
78
        self.exit_state = exit_state
79
79
        self.count = 1
80
 
        
 
80
 
81
81
    def process(self, next_char, context):
82
82
        if next_char == u'\\':
83
83
            self.count += 1
104
104
            # let exit_state handle next_char
105
105
            context.seq.pushback(next_char)
106
106
            return self.exit_state
107
 
    
 
107
 
108
108
    def finish(self, context):
109
109
        if self.count > 0:
110
110
            context.token.append(u'\\' * self.count)
129
129
        self.allowed_quote_chars = u'"'
130
130
        if single_quotes_allowed:
131
131
            self.allowed_quote_chars += u"'"
132
 
    
 
132
 
133
133
    def __iter__(self):
134
134
        return self
135
 
    
 
135
 
136
136
    def next(self):
137
137
        quoted, token = self._get_token()
138
138
        if token is None:
139
139
            raise StopIteration
140
140
        return quoted, token
141
 
    
 
141
 
142
142
    def _get_token(self):
143
143
        self.quoted = False
144
144
        self.token = []