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
1a817c09
Commit
1a817c09
authored
Sep 19, 1994
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Parser/tokenizer.c (tok_nextc): count line numbers when parsing
strings
parent
df1c4ee5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
Parser/tokenizer.c
Parser/tokenizer.c
+21
-7
No files found.
Parser/tokenizer.c
View file @
1a817c09
...
...
@@ -122,8 +122,7 @@ tok_setups(str)
struct
tok_state
*
tok
=
tok_new
();
if
(
tok
==
NULL
)
return
NULL
;
tok
->
buf
=
tok
->
cur
=
str
;
tok
->
end
=
tok
->
inp
=
strchr
(
str
,
'\0'
);
tok
->
buf
=
tok
->
cur
=
tok
->
end
=
tok
->
inp
=
str
;
return
tok
;
}
...
...
@@ -170,13 +169,27 @@ tok_nextc(tok)
register
struct
tok_state
*
tok
;
{
for
(;;)
{
if
(
tok
->
cur
!=
tok
->
inp
)
if
(
tok
->
cur
!=
tok
->
inp
)
{
return
*
tok
->
cur
++
;
/* Fast path */
}
if
(
tok
->
done
!=
E_OK
)
return
EOF
;
if
(
tok
->
fp
==
NULL
)
{
tok
->
done
=
E_EOF
;
return
EOF
;
char
*
end
=
strchr
(
tok
->
inp
,
'\n'
);
if
(
end
!=
NULL
)
end
++
;
else
{
end
=
strchr
(
tok
->
inp
,
'\0'
);
if
(
end
==
tok
->
inp
)
{
tok
->
done
=
E_EOF
;
return
EOF
;
}
}
if
(
tok
->
start
==
NULL
)
tok
->
buf
=
tok
->
cur
;
tok
->
lineno
++
;
tok
->
inp
=
end
;
return
*
tok
->
cur
++
;
}
if
(
tok
->
prompt
!=
NULL
)
{
char
*
new
=
my_readline
(
tok
->
prompt
);
...
...
@@ -478,9 +491,10 @@ tok_get(tok, p_start, p_end)
This is also recognized by vi, when it occurs near the
beginning or end of the file. (Will vi never die...?)
For Python it must be at the beginning of the file! */
/* XXX The real vi syntax is actually different :-( */
/* XXX Should recognize Emacs syntax, too */
int
x
;
/* XXX The cast to (unsigned char *) is needed by THINK C 3.0 */
if
(
sscanf
(
/*(unsigned char *)*/
tok
->
cur
,
if
(
sscanf
(
tok
->
cur
,
" vi:set tabsize=%d:"
,
&
x
)
==
1
&&
x
>=
1
&&
x
<=
40
)
{
/* fprintf(stderr, "# vi:set tabsize=%d:\n", x); */
...
...
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