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
dec6751d
Commit
dec6751d
authored
Aug 18, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove BEGIN/END from syntax
parent
e5dde46c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
26 deletions
+7
-26
include/mruby/compile.h
include/mruby/compile.h
+1
-1
src/parse.y
src/parse.y
+6
-25
No files found.
include/mruby/compile.h
View file @
dec6751d
...
@@ -89,7 +89,7 @@ struct mrb_parser_state {
...
@@ -89,7 +89,7 @@ struct mrb_parser_state {
int
nerr
;
int
nerr
;
int
nwarn
;
int
nwarn
;
mrb_ast_node
*
tree
,
*
begin_tree
;
mrb_ast_node
*
tree
;
int
capture_errors
;
int
capture_errors
;
struct
mrb_parser_message
error_buffer
[
10
];
struct
mrb_parser_message
error_buffer
[
10
];
...
...
src/parse.y
View file @
dec6751d
...
@@ -1026,14 +1026,11 @@ top_stmts : none
...
@@ -1026,14 +1026,11 @@ top_stmts : none
top_stmt : stmt
top_stmt : stmt
| keyword_BEGIN
| keyword_BEGIN
{
{
if (p->in_def || p->in_single) {
yyerror(p, "BEGIN in method");
}
$<nd>$ = local_switch(p);
$<nd>$ = local_switch(p);
}
}
'{' top_compstmt '}'
'{' top_compstmt '}'
{
{
p->begin_tree = push(p->begin_tree, $4
);
yyerror(p, "BEGIN not supported"
);
local_resume(p, $<nd>2);
local_resume(p, $<nd>2);
$$ = 0;
$$ = 0;
}
}
...
@@ -1119,9 +1116,7 @@ stmt : keyword_alias fsym {p->lstate = EXPR_FNAME;} fsym
...
@@ -1119,9 +1116,7 @@ stmt : keyword_alias fsym {p->lstate = EXPR_FNAME;} fsym
}
}
| keyword_END '{' compstmt '}'
| keyword_END '{' compstmt '}'
{
{
if (p->in_def || p->in_single) {
yyerror(p, "END not suported");
yywarn(p, "END in method; use at_exit");
}
$$ = new_postexe(p, $3);
$$ = new_postexe(p, $3);
}
}
| command_asgn
| command_asgn
...
@@ -4714,12 +4709,10 @@ void parser_dump(mrb_state *mrb, node *tree, int offset);
...
@@ -4714,12 +4709,10 @@ void parser_dump(mrb_state *mrb, node *tree, int offset);
void
void
mrb_parser_parse(parser_state *p, mrbc_context *c)
mrb_parser_parse(parser_state *p, mrbc_context *c)
{
{
node *tree;
if (setjmp(p->jmp) != 0) {
if (setjmp(p->jmp) != 0) {
yyerror(p, "memory allocation error");
yyerror(p, "memory allocation error");
p->nerr++;
p->nerr++;
p->tree =
p->begin_tree =
0;
p->tree = 0;
return;
return;
}
}
...
@@ -4730,22 +4723,10 @@ mrb_parser_parse(parser_state *p, mrbc_context *c)
...
@@ -4730,22 +4723,10 @@ mrb_parser_parse(parser_state *p, mrbc_context *c)
parser_init_cxt(p, c);
parser_init_cxt(p, c);
yyparse(p);
yyparse(p);
tree = p->tree;
if (!p->tree) {
if (!tree) {
p->tree = new_nil(p);
if (p->begin_tree) {
tree = p->begin_tree;
}
else {
tree = new_nil(p);
}
}
else {
parser_update_cxt(p, c);
if (p->begin_tree) {
tree = new_begin(p, p->begin_tree);
append(tree, p->tree);
}
}
}
parser_update_cxt(p, c);
if (c && c->dump_result) {
if (c && c->dump_result) {
parser_dump(p->mrb, p->tree, 0);
parser_dump(p->mrb, p->tree, 0);
}
}
...
...
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