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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
17fabe5a
Commit
17fabe5a
authored
Nov 11, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make raising a KeyError not the default for parsing names.
parent
82245e93
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
20 deletions
+23
-20
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+15
-19
Cython/Compiler/Scanning.pxd
Cython/Compiler/Scanning.pxd
+4
-0
Cython/Compiler/Scanning.py
Cython/Compiler/Scanning.py
+4
-1
No files found.
Cython/Compiler/Parsing.py
View file @
17fabe5a
...
@@ -532,12 +532,8 @@ def p_atom(s):
...
@@ -532,12 +532,8 @@ def p_atom(s):
def
p_name
(
s
,
name
):
def
p_name
(
s
,
name
):
pos
=
s
.
position
()
pos
=
s
.
position
()
if
not
s
.
compile_time_expr
:
if
not
s
.
compile_time_expr
and
name
in
s
.
compile_time_env
:
try
:
value
=
s
.
compile_time_env
.
lookup_here
(
name
)
value
=
s
.
compile_time_env
.
lookup_here
(
name
)
except
KeyError
:
pass
else
:
rep
=
repr
(
value
)
rep
=
repr
(
value
)
if
isinstance
(
value
,
bool
):
if
isinstance
(
value
,
bool
):
return
ExprNodes
.
BoolNode
(
pos
,
value
=
value
)
return
ExprNodes
.
BoolNode
(
pos
,
value
=
value
)
...
...
Cython/Compiler/Scanning.pxd
View file @
17fabe5a
from
Cython.Plex.Scanners
cimport
Scanner
from
Cython.Plex.Scanners
cimport
Scanner
cdef
class
CompileTimeScope
:
cdef
public
entries
cdef
public
outer
cdef
class
PyrexScanner
(
Scanner
):
cdef
class
PyrexScanner
(
Scanner
):
cdef
public
context
cdef
public
context
cdef
public
list
included_files
cdef
public
list
included_files
...
...
Cython/Compiler/Scanning.py
View file @
17fabe5a
...
@@ -176,7 +176,7 @@ resword_dict = build_resword_dict()
...
@@ -176,7 +176,7 @@ resword_dict = build_resword_dict()
#------------------------------------------------------------------
#------------------------------------------------------------------
class
CompileTimeScope
(
object
)
:
class
CompileTimeScope
:
def
__init__
(
self
,
outer
=
None
):
def
__init__
(
self
,
outer
=
None
):
self
.
entries
=
{}
self
.
entries
=
{}
...
@@ -188,6 +188,9 @@ class CompileTimeScope(object):
...
@@ -188,6 +188,9 @@ class CompileTimeScope(object):
def
lookup_here
(
self
,
name
):
def
lookup_here
(
self
,
name
):
return
self
.
entries
[
name
]
return
self
.
entries
[
name
]
def
__contains__
(
self
,
name
):
return
name
in
self
.
entries
def
lookup
(
self
,
name
):
def
lookup
(
self
,
name
):
try
:
try
:
return
self
.
lookup_here
(
name
)
return
self
.
lookup_here
(
name
)
...
...
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