Subversion Repositories programming

Rev

Rev 165 | Rev 167 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 165 Rev 166
Line 8... Line 8...
8
#
8
#
9
# 2005-11-18
9
# 2005-11-18
10
# * Just getting the basics in place, since we haven't been given
10
# * Just getting the basics in place, since we haven't been given
11
#   the whole description of the project yet.
11
#   the whole description of the project yet.
12
#
12
#
-
 
13
# 2005-11-26
-
 
14
# * Got the whole class working, now to implement pretty-printing
-
 
15
#
13
 
16
 
14
# Check for <Python-2.3 compatibility (boolean values)
17
# Check for <Python-2.3 compatibility (boolean values)
15
try:
18
try:
16
  True, False
19
  True, False
17
except NameError:
20
except NameError:
Line 44... Line 47...
44
        self.__clear()
47
        self.__clear()
45
 
48
 
46
    def __clear(self):
49
    def __clear(self):
47
        self.str = ""   # the string of input to test
50
        self.str = ""   # the string of input to test
48
        self.strpos = 0 # the current position in str
51
        self.strpos = 0 # the current position in str
-
 
52
        self.derivation = ""
-
 
53
 
-
 
54
    def __replace_sym(self, to_repl, with_this):
-
 
55
        """Replace a string in the derivation with another string"""
-
 
56
 
-
 
57
        pos = s.find(to_repl)
-
 
58
    
-
 
59
        if pos == -1:
-
 
60
            raise ValueError
-
 
61
    
-
 
62
        self.derivation = s[:pos] + str(with_this) + s[pos+len(to_repl):]
49
 
63
 
50
    def __input_test_str(self):
64
    def __input_test_str(self):
51
        self.str = raw_input("input str: ")
65
        self.str = raw_input("input str: ")
52
 
66
 
53
    def main_menu(self):
67
    def main_menu(self):