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
ff152fe9
Commit
ff152fe9
authored
Oct 08, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better NULL parsing, touchup pure test
parent
88c3bd04
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
13 deletions
+45
-13
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+2
-3
Cython/Compiler/Scanning.py
Cython/Compiler/Scanning.py
+1
-1
tests/run/pure.pyx
tests/run/pure.pyx
+42
-9
No files found.
Cython/Compiler/Parsing.py
View file @
ff152fe9
...
...
@@ -518,11 +518,10 @@ def p_atom(s):
return
ExprNodes
.
BoolNode
(
pos
,
value
=
True
)
elif
name
==
"False"
:
return
ExprNodes
.
BoolNode
(
pos
,
value
=
False
)
elif
name
==
"NULL"
:
return
ExprNodes
.
NullNode
(
pos
)
else
:
return
p_name
(
s
,
name
)
elif
sy
==
'NULL'
:
s
.
next
()
return
ExprNodes
.
NullNode
(
pos
)
else
:
s
.
error
(
"Expected an identifier or literal"
)
...
...
Cython/Compiler/Scanning.py
View file @
ff152fe9
...
...
@@ -145,7 +145,7 @@ reserved_words = [
"raise"
,
"import"
,
"exec"
,
"try"
,
"except"
,
"finally"
,
"while"
,
"if"
,
"elif"
,
"else"
,
"for"
,
"in"
,
"assert"
,
"and"
,
"or"
,
"not"
,
"is"
,
"in"
,
"lambda"
,
"from"
,
"
NULL"
,
"
cimport"
,
"by"
,
"with"
,
"cpdef"
,
"DEF"
,
"IF"
,
"ELIF"
,
"ELSE"
"cimport"
,
"by"
,
"with"
,
"cpdef"
,
"DEF"
,
"IF"
,
"ELIF"
,
"ELSE"
]
class
Method
:
...
...
tests/run/pure.pyx
View file @
ff152fe9
import
sys
,
os
sys
.
path
.
insert
(
0
,
".."
)
__doc__
=
"""
>>> test_sizeof()
True
True
True
True
True
import
cython
>>> test_declare(100)
(100, 100)
>>> test_declare(100.5)
(100, 100)
>>> test_declare(None)
Traceback (most recent call last):
...
TypeError: an integer is required
>>> test_cast(1.5)
1
>>> test_cast(None)
Traceback (most recent call last):
...
TypeError: a float is required
>>> test_address(39)
39
>>> test_locals(5)
True
>>> test_struct(389, 1.64493)
(389, 1.64493)
>>> test_imports()
True
"""
import
cython
def
test_sizeof
():
x
=
cython
.
declare
(
cython
.
bint
)
...
...
@@ -52,15 +85,15 @@ def test_struct(n, x):
import
cython
as
cy
from
cython
import
declare
,
cast
,
locals
,
address
,
typedef
,
p_void
,
compiled
from
cython
import
declare
as
my_declare
,
locals
as
my_locals
,
p_void
as
my_void_star
,
typedef
as
my_typedef
,
my_compiled
from
cython
import
declare
as
my_declare
,
locals
as
my_locals
,
p_void
as
my_void_star
,
typedef
as
my_typedef
,
compiled
as
my_compiled
@
my_locals
(
a
=
cython
.
p_void
)
def
test_imports
():
a
=
NULL
b
=
declare
(
p_void
,
NULL
)
c
=
my_declare
(
my_void_star
,
NULL
)
d
=
cy
.
declare
(
cy
.
p_void
,
NULL
)
compiled
and
my_compiled
a
=
cython
.
NULL
b
=
declare
(
p_void
,
cython
.
NULL
)
c
=
my_declare
(
my_void_star
,
cython
.
NULL
)
d
=
cy
.
declare
(
cy
.
p_void
,
cython
.
NULL
)
return
a
==
d
and
compiled
and
my_compiled
MyStruct3
=
typedef
(
MyStruct
[
3
])
MyStruct4
=
my_typedef
(
MyStruct
[
4
])
...
...
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