Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
ead06714
Commit
ead06714
authored
Jul 25, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adapt Lexicons.py to Py3
parent
d03783ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Cython/Plex/Lexicons.py
Cython/Plex/Lexicons.py
+3
-3
No files found.
Cython/Plex/Lexicons.py
View file @
ead06714
...
...
@@ -115,7 +115,7 @@ class Lexicon(object):
tables
=
None
# StateTableMachine
def
__init__
(
self
,
specifications
,
debug
=
None
,
debug_flags
=
7
,
timings
=
None
):
if
type
(
specifications
)
!=
types
.
ListType
:
if
not
isinstance
(
specifications
,
list
)
:
raise
Errors
.
InvalidScanner
(
"Scanner definition is not a list"
)
if
timings
:
from
.Timing
import
time
...
...
@@ -132,7 +132,7 @@ class Lexicon(object):
self
.
add_token_to_machine
(
nfa
,
user_initial_state
,
token
,
token_number
)
token_number
+=
1
elif
type
(
spec
)
==
types
.
TupleType
:
elif
isinstance
(
spec
,
tuple
)
:
self
.
add_token_to_machine
(
nfa
,
default_initial_state
,
spec
,
token_number
)
token_number
+=
1
...
...
@@ -184,7 +184,7 @@ class Lexicon(object):
raise
e
.
__class__
(
"Token number %d: %s"
%
(
token_number
,
e
))
def
parse_token_definition
(
self
,
token_spec
):
if
type
(
token_spec
)
!=
types
.
TupleType
:
if
not
isinstance
(
token_spec
,
tuple
)
:
raise
Errors
.
InvalidToken
(
"Token definition is not a tuple"
)
if
len
(
token_spec
)
!=
2
:
raise
Errors
.
InvalidToken
(
"Wrong number of items in token definition"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment