Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pybison
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
pybison
Commits
9c01c2ce
Commit
9c01c2ce
authored
Nov 18, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added buildDirectory and started to fix segfaults.
parent
a0e01183
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
153 additions
and
93 deletions
+153
-93
examples/calc/run.py
examples/calc/run.py
+3
-0
src/pyrex/bison_.pyx
src/pyrex/bison_.pyx
+132
-84
src/python/bison.py
src/python/bison.py
+18
-9
No files found.
examples/calc/run.py
View file @
9c01c2ce
#!/usr/bin/env python
import
readline
import
sys
sys
.
path
.
insert
(
0
,
'../../build/lib.linux-x86_64-2.7/'
)
import
calc
...
...
src/pyrex/bison_.pyx
View file @
9c01c2ce
This diff is collapsed.
Click to expand it.
src/python/bison.py
View file @
9c01c2ce
...
...
@@ -243,7 +243,10 @@ class BisonParser(object):
flexCFile1
=
"tmp.lex.c"
# c output file from lex gets renamed to this
cflags_pre
=
[
'-fPIC'
]
# = CFLAGS added before all arguments.
cflags_post
=
[
'-O3'
,
'-g'
]
# = CFLAGS added after all arguments.
cflags_post
=
[
'-O0'
,
'-g'
]
# = CFLAGS added after all arguments.
buildDirectory
=
'./'
# Directory used to store the generated / compiled files.
debugSymbols
=
1
# Add debugging symbols to the binary files.
verbose
=
0
...
...
@@ -324,17 +327,23 @@ class BisonParser(object):
Tries to dispatch to on_TargetName() methods if they exist,
otherwise wraps the target in a BisonNode object
"""
handler
=
getattr
(
self
,
"on_"
+
targetname
,
None
)
handler
=
getattr
(
self
,
'on_'
+
targetname
,
None
)
if
handler
:
if
self
.
verbose
:
try
:
hdlrline
=
handler
.
func_code
.
co_firstlineno
except
:
hdlrline
=
handler
.
__init__
.
func_code
.
co_firstlineno
print
"invoking handler at line %s for %s"
%
(
hdlrline
,
targetname
)
self
.
last
=
handler
(
target
=
targetname
,
option
=
option
,
names
=
names
,
values
=
values
)
if
self
.
verbose
:
print
"handler for %s returned %s"
%
(
targetname
,
repr
(
self
.
last
))
print
'_handle: invoking handler at line %s for "%s"'
\
%
(
hdlrline
,
targetname
)
print
handler
self
.
last
=
handler
(
target
=
targetname
,
option
=
option
,
names
=
names
,
values
=
values
)
#if self.verbose:
# print 'handler for %s returned %s' \
# % (targetname, repr(self.last))
else
:
if
self
.
verbose
:
print
"no handler for %s, using default"
%
targetname
...
...
@@ -607,8 +616,8 @@ def bisonToPython(bisonfileName, lexfileName, pyfileName, generateClasses=0):
prologue
,
rulesRaw
,
epilogue
=
rawBison
.
split
(
"
\
n
%%
\
n
"
)
except
:
raise
Exception
(
"File
"
+
bisonfileName
+
" is not a properly formatted bison file"
+
\
" (needs 3 sections separated by %%%%"
"File
%s is not a properly formatted bison file"
" (needs 3 sections separated by %%%%"
%
(
bisonfileName
)
)
# --------------------------------------
...
...
@@ -791,7 +800,7 @@ def bisonToPython(bisonfileName, lexfileName, pyfileName, generateClasses=0):
' # --------------------------------------------',
' # basename of binary parser engine dynamic lib',
' # --------------------------------------------',
' bisonEngineLibName = "
%
s
"' %
libfileName
,
' bisonEngineLibName = "
%
s
"' %
(parser.buildDirectory + libfileName)
,
'
\
n
',
]))
...
...
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