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
77017959
Commit
77017959
authored
May 19, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unterminated string detection made easy
parent
2ed31892
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
13 deletions
+8
-13
tools/mirb/mirb.c
tools/mirb/mirb.c
+8
-13
No files found.
tools/mirb/mirb.c
View file @
77017959
...
@@ -20,31 +20,26 @@ is_code_block_open(struct mrb_parser_state *parser)
...
@@ -20,31 +20,26 @@ is_code_block_open(struct mrb_parser_state *parser)
{
{
int
code_block_open
=
FALSE
;
int
code_block_open
=
FALSE
;
/* check for unterminated string */
if
(
parser
->
sterm
)
return
TRUE
;
/* check if parser error are available */
/* check if parser error are available */
if
(
0
<
parser
->
nerr
)
{
if
(
0
<
parser
->
nerr
)
{
const
char
*
unexpected_end
=
"syntax error, unexpected $end"
;
const
char
*
unexpected_end
=
"syntax error, unexpected $end"
;
const
char
*
message
=
parser
->
error_buffer
[
0
].
message
;
/* a parser error occur, we have to check if */
/* a parser error occur, we have to check if */
/* we need to read one more line or if there is */
/* we need to read one more line or if there is */
/* a different issue which we have to show to */
/* a different issue which we have to show to */
/* the user */
/* the user */
if
(
strncmp
(
parser
->
error_buffer
[
0
].
message
,
unexpected_end
,
strlen
(
unexpected_end
))
==
0
)
{
if
(
strncmp
(
message
,
unexpected_end
,
strlen
(
unexpected_end
))
==
0
)
{
code_block_open
=
TRUE
;
}
else
if
(
strcmp
(
parser
->
error_buffer
[
0
].
message
,
"syntax error, unexpected keyword_end"
)
==
0
)
{
code_block_open
=
TRUE
;
}
else
if
(
strcmp
(
parser
->
error_buffer
[
0
].
message
,
"syntax error, unexpected $end, expecting keyword_then or ';' or '
\\
n'"
)
==
0
)
{
code_block_open
=
TRUE
;
code_block_open
=
TRUE
;
}
}
else
if
(
strcmp
(
parser
->
error_buffer
[
0
].
message
,
else
if
(
strcmp
(
message
,
"syntax error, unexpected keyword_end"
)
==
0
)
{
"syntax error, unexpected tREGEXP_BEG"
)
==
0
)
{
code_block_open
=
TRUE
;
code_block_open
=
TRUE
;
}
}
else
if
(
strcmp
(
parser
->
error_buffer
[
0
].
message
,
else
if
(
strcmp
(
message
,
"syntax error, unexpected tREGEXP_BEG"
)
==
0
)
{
"unterminated string meets end of file"
)
==
0
)
{
code_block_open
=
TRUE
;
code_block_open
=
TRUE
;
}
}
}
}
...
...
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