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
588633da
Commit
588633da
authored
Dec 30, 1994
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parser/tokenizer.c (tok_nextc): zap tok->buf after freeing;
rest: abort() -> fatal(); small things
parent
66cb311f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
15 deletions
+18
-15
Parser/grammar.c
Parser/grammar.c
+10
-3
Parser/parser.c
Parser/parser.c
+2
-4
Parser/pgen.c
Parser/pgen.c
+3
-3
Parser/pgenmain.c
Parser/pgenmain.c
+0
-1
Parser/tokenizer.c
Parser/tokenizer.c
+3
-4
No files found.
Parser/grammar.c
View file @
588633da
...
...
@@ -48,6 +48,7 @@ newgrammar(start)
g
->
g_start
=
start
;
g
->
g_ll
.
ll_nlabels
=
0
;
g
->
g_ll
.
ll_label
=
NULL
;
g
->
g_accel
=
0
;
return
g
;
}
...
...
@@ -84,6 +85,10 @@ addstate(d)
s
=
&
d
->
d_state
[
d
->
d_nstates
++
];
s
->
s_narcs
=
0
;
s
->
s_arc
=
NULL
;
s
->
s_lower
=
0
;
s
->
s_upper
=
0
;
s
->
s_accel
=
NULL
;
s
->
s_accept
=
0
;
return
s
-
d
->
d_state
;
}
...
...
@@ -139,7 +144,6 @@ findlabel(ll, type, str)
char
*
str
;
{
int
i
;
label
*
lb
;
for
(
i
=
0
;
i
<
ll
->
ll_nlabels
;
i
++
)
{
if
(
ll
->
ll_label
[
i
].
lb_type
==
type
/*&&
...
...
@@ -147,7 +151,8 @@ findlabel(ll, type, str)
return
i
;
}
fprintf
(
stderr
,
"Label %d/'%s' not found
\n
"
,
type
,
str
);
abort
();
fatal
(
"grammar.c:findlabel()"
);
/*NOTREACHED*/
}
/* Forward */
...
...
@@ -158,8 +163,10 @@ translatelabels(g)
grammar
*
g
;
{
int
i
;
#ifdef DEBUG
printf
(
"Translating labels ...
\n
"
);
#endif
/* Don't translate EMPTY */
for
(
i
=
EMPTY
+
1
;
i
<
g
->
g_ll
.
ll_nlabels
;
i
++
)
translabel
(
g
,
&
g
->
g_ll
.
ll_label
[
i
]);
...
...
Parser/parser.c
View file @
588633da
...
...
@@ -86,10 +86,8 @@ static void
s_pop
(
s
)
register
stack
*
s
;
{
if
(
s_empty
(
s
))
{
fprintf
(
stderr
,
"s_pop: parser stack underflow -- FATAL
\n
"
);
abort
();
}
if
(
s_empty
(
s
))
fatal
(
"s_pop: parser stack underflow -- FATAL"
);
s
->
s_top
++
;
}
...
...
Parser/pgen.c
View file @
588633da
...
...
@@ -162,7 +162,7 @@ static char REQNFMT[] = "metacompile: less than %d children\n";
#define REQN(i, count) \
if (i < count) { \
fprintf(stderr, REQNFMT, count); \
abort(
); \
fatal("REQN"
); \
} else
#else
...
...
@@ -390,7 +390,7 @@ dumpnfa(ll, nf)
/* PART TWO -- CONSTRUCT DFA -- Algorithm 3.1 from [Aho&Ullman 77] */
static
int
static
void
addclosure
(
ss
,
nf
,
istate
)
bitset
ss
;
nfa
*
nf
;
...
...
@@ -628,7 +628,7 @@ simplify(xx_nstates, xx_state)
ss_state
*
xx_state
;
{
int
changes
;
int
i
,
j
,
k
;
int
i
,
j
;
do
{
changes
=
0
;
...
...
Parser/pgenmain.c
View file @
588633da
...
...
@@ -64,7 +64,6 @@ main(argc, argv)
char
**
argv
;
{
grammar
*
g
;
node
*
n
;
FILE
*
fp
;
char
*
filename
;
...
...
Parser/tokenizer.c
View file @
588633da
...
...
@@ -209,6 +209,7 @@ tok_nextc(tok)
tok
->
lineno
++
;
if
(
buf
==
NULL
)
{
free
(
tok
->
buf
);
tok
->
buf
=
NULL
;
free
(
new
);
tok
->
done
=
E_NOMEM
;
return
EOF
;
...
...
@@ -309,10 +310,8 @@ tok_backup(tok, c)
register
int
c
;
{
if
(
c
!=
EOF
)
{
if
(
--
tok
->
cur
<
tok
->
buf
)
{
fprintf
(
stderr
,
"tok_backup: begin of buffer
\n
"
);
abort
();
}
if
(
--
tok
->
cur
<
tok
->
buf
)
fatal
(
"tok_backup: begin of buffer"
);
if
(
*
tok
->
cur
!=
c
)
*
tok
->
cur
=
c
;
}
...
...
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