Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Kirill Smelkov
cpython
Commits
b8c68634
Commit
b8c68634
authored
Dec 12, 2000
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for generating a single module from multiple .h files.
Allow /* */ comments within function prototypes.
parent
5f884c05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
Tools/bgen/bgen/scantools.py
Tools/bgen/bgen/scantools.py
+20
-3
No files found.
Tools/bgen/bgen/scantools.py
View file @
b8c68634
...
...
@@ -251,7 +251,7 @@ if missing: raise "Missing Types"
self.asplit_pat = "
^
\
(
<
type
>
.
*
[
^
a
-
zA
-
Z0
-
9
_
]
\
)
\
(
<
name
>
[
a
-
zA
-
Z0
-
9
_
]
+
\
)
$
"
self.comment1_pat = "
\
(
<
rest
>
.
*
\
)
//
.
*
"
# note that the next pattern only removes comments that are wholly within one line
self.comment2_pat = "
\
(
<
rest
>
.
*
\
)
/
\
*
.
*
\
*/
"
self.comment2_pat = "
\
(
<
rest
1
>
.
*
\
)
/
\
*
.
*
\
*/
\
(
<
rest2
>
.
*
\
)
"
def compilepatterns(self):
for name in dir(self):
...
...
@@ -328,6 +328,16 @@ if missing: raise "Missing Types"
return file
def setinput(self, scan = sys.stdin):
if not type(scan) in (TupleType, ListType):
scan = [scan]
self.allscaninputs = scan
self._nextinput()
def _nextinput(self):
if not self.allscaninputs:
return 0
scan = self.allscaninputs[0]
self.allscaninputs = self.allscaninputs[1:]
self.closescan()
if scan:
if type(scan) == StringType:
...
...
@@ -339,6 +349,7 @@ if missing: raise "Missing Types"
self.scanfile = file
self.scanmine = mine
self.lineno = 0
return 1
def openinput(self, filename):
if not os.path.isabs(filename):
...
...
@@ -360,6 +371,8 @@ if missing: raise "Missing Types"
raise Error, "
input
file
not
set
"
self.line = self.scanfile.readline()
if not self.line:
if self._nextinput():
return self.getline()
raise EOFError
self.lineno = self.lineno + 1
return self.line
...
...
@@ -388,8 +401,8 @@ if missing: raise "Missing Types"
except
EOFError
:
break
if
self
.
comment1
.
match
(
line
)
>=
0
:
line
=
self
.
comment1
.
group
(
'rest'
)
if
self
.
comment2
.
match
(
line
)
>=
0
:
line
=
self
.
comment2
.
group
(
'rest'
)
while
self
.
comment2
.
match
(
line
)
>=
0
:
line
=
self
.
comment2
.
group
(
'rest
1'
)
+
self
.
comment2
.
group
(
'rest2
'
)
if
self
.
defsfile
and
self
.
sym
.
match
(
line
)
>=
0
:
self
.
dosymdef
()
continue
...
...
@@ -412,6 +425,10 @@ if missing: raise "Missing Types"
raw
=
self
.
line
while
self
.
tail
.
search
(
raw
)
<
0
:
line
=
self
.
getline
()
if
self
.
comment1
.
match
(
line
)
>=
0
:
line
=
self
.
comment1
.
group
(
'rest'
)
while
self
.
comment2
.
match
(
line
)
>=
0
:
line
=
self
.
comment2
.
group
(
'rest1'
)
+
self
.
comment2
.
group
(
'rest2'
)
raw
=
raw
+
line
self
.
processrawspec
(
raw
)
...
...
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