Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
fa71403b
Commit
fa71403b
authored
Nov 08, 2013
by
fleuria
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nextc(): always return an '\n' at end of input
fix #1564
parent
d2451dfb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
include/mruby/compile.h
include/mruby/compile.h
+1
-0
src/parse.y
src/parse.y
+12
-6
No files found.
include/mruby/compile.h
View file @
fa71403b
...
...
@@ -113,6 +113,7 @@ struct mrb_parser_state {
char
const
*
filename
;
int
lineno
;
int
column
;
int
eof
;
enum
mrb_lex_state_enum
lstate
;
mrb_ast_node
*
lex_strterm
;
/* (type nest_level beg . end) */
...
...
src/parse.y
View file @
fa71403b
...
...
@@ -3316,14 +3316,14 @@ nextc(parser_state *p)
else {
#ifdef ENABLE_STDIO
if (p->f) {
if (feof(p->f)) goto e
nd_retry
;
if (feof(p->f)) goto e
of
;
c = fgetc(p->f);
if (c == EOF) goto e
nd_retry
;
if (c == EOF) goto e
of
;
}
else
#endif
if (!p->s || p->s >= p->send) {
goto e
nd_retry
;
goto e
of
;
}
else {
c = (unsigned char)*p->s++;
...
...
@@ -3332,14 +3332,20 @@ nextc(parser_state *p)
p->column++;
return c;
end_retry:
eof:
if (!p->eof) {
p->eof = TRUE;
return '\n';
}
if (!p->cxt) return -1;
else {
mrbc_context *cxt = p->cxt;
if (cxt->partial_hook(p) < 0) return -1;
c = '\n';
p->lineno = 1;
p->eof = FALSE;
p->cxt = NULL;
c = nextc(p);
p->cxt = cxt;
return 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