import os
import re
import sys
-from types import ListType, TupleType
from Cython.Compiler.Scanning import PyrexScanner, FileSourceDescriptor
import Nodes
import ExprNodes
if key:
f.write("%s: " % key)
t = type(node)
- if t == TupleType:
+ if t is tuple:
f.write("(%s @ %s\n" % (node[0], node[1]))
for i in xrange(2, len(node)):
print_parse_tree(f, node[i], level+1)
if name != 'tag' and name != 'pos':
print_parse_tree(f, value, level+1, name)
return
- elif t == ListType:
+ elif t is list:
f.write("[\n")
for i in xrange(len(node)):
print_parse_tree(f, node[i], level+1)
#
#=======================================================================
-import exceptions
-
-class PlexError(exceptions.Exception):
+class PlexError(Exception):
message = ""
class PlexTypeError(PlexError, TypeError):
import sys
from sys import maxint
-from types import TupleType
from Transitions import TransitionMap
self.initial_states[name] = state
def add_transitions(self, state, event, new_state):
- if type(event) == TupleType:
+ if type(event) is tuple:
code0, code1 = event
if code0 == -maxint:
state['else'] = new_state
import array
import types
-from sys import maxint
+from sys import maxint as maxint
import Errors
#
from copy import copy
-from sys import maxint
-from types import TupleType
+from sys import maxint as maxint
class TransitionMap(object):
"""
#self.check() ###
def add(self, event, new_state,
- TupleType = TupleType):
+ TupleType = tuple):
"""
Add transition to |new_state| on |event|.
"""
- if type(event) == TupleType:
+ if type(event) is TupleType:
code0, code1 = event
i = self.split(code0)
j = self.split(code1)
self.get_special(event)[new_state] = 1
def add_set(self, event, new_set,
- TupleType = TupleType):
+ TupleType = tuple):
"""
Add transitions to the states in |new_set| on |event|.
"""
- if type(event) == TupleType:
+ if type(event) is TupleType:
code0, code1 = event
i = self.split(code0)
j = self.split(code1)