Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
2a66d281
Commit
2a66d281
authored
Aug 21, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sweet, we have some basic regex support
parent
4cf93f94
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
1 deletion
+26
-1
src/Makefile
src/Makefile
+5
-1
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+7
-0
test/tests/sre_compile_test.py
test/tests/sre_compile_test.py
+9
-0
test/tests/tuples.py
test/tests/tuples.py
+5
-0
No files found.
src/Makefile
View file @
2a66d281
...
...
@@ -765,12 +765,16 @@ endif
.PHONY
:
perf$1_%
perf$1_%
:
%.py pyston$1
perf record
-g
--
./pyston
$1
-q
-p
$
$(ARGS)
$$
<
perf report
-v
-n
-g
flat,1000 | bash
$
$(TOOLS_DIR)
/cumulate.sh | less
-S
@
$(MAKE)
perf_report
$$(call
make_search,perf$1_%)
)
endef
.PHONY
:
perf_report
perf_report
:
perf report
-v
-n
-g
flat,1000 | bash
$(TOOLS_DIR)
/cumulate.sh | less
-S
.PHONY
:
run run_% dbg_% debug_% perf_%
run
:
run_dbg
run_%
:
run_dbg_%
...
...
src/runtime/tuple.cpp
View file @
2a66d281
...
...
@@ -237,6 +237,11 @@ Box* tupleNe(BoxedTuple* self, Box* rhs) {
return
_tupleCmp
(
self
,
static_cast
<
BoxedTuple
*>
(
rhs
),
AST_TYPE
::
NotEq
);
}
Box
*
tupleNonzero
(
BoxedTuple
*
self
)
{
RELEASE_ASSERT
(
self
->
cls
==
tuple_cls
,
""
);
return
boxBool
(
self
->
elts
.
size
()
!=
0
);
}
Box
*
tupleContains
(
BoxedTuple
*
self
,
Box
*
elt
)
{
int
size
=
self
->
elts
.
size
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
...
...
@@ -373,6 +378,8 @@ void setupTuple() {
tuple_cls
->
giveAttr
(
"__eq__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleEq
,
UNKNOWN
,
2
)));
tuple_cls
->
giveAttr
(
"__ne__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleNe
,
UNKNOWN
,
2
)));
tuple_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleNonzero
,
BOXED_BOOL
,
1
)));
tuple_cls
->
giveAttr
(
"__hash__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleHash
,
BOXED_INT
,
1
)));
tuple_cls
->
giveAttr
(
"__len__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleLen
,
BOXED_INT
,
1
)));
tuple_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleRepr
,
STR
,
1
)));
...
...
test/tests/sre_compile_test.py
0 → 100644
View file @
2a66d281
# skip-if: True
# This test works but 1) is very slow [the importing is, not the regex itself], and 2) throws warnings
import
sre_compile
r
=
sre_compile
.
compile
(
"a(b+)c"
,
0
)
print
r
.
match
(
""
)
print
r
.
match
(
"ac"
)
print
r
.
match
(
"abc"
).
groups
()
print
r
.
match
(
"abbc"
).
groups
()
test/tests/tuples.py
View file @
2a66d281
...
...
@@ -168,3 +168,8 @@ try:
t
[
3
]
except
IndexError
as
e
:
print
e
print
bool
(())
print
bool
((
1
,))
print
bool
((
0
,))
print
bool
((
0
,
0
))
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