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
cece0163
Commit
cece0163
authored
Feb 27, 2019
by
dearblue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Concatenate string literals
parent
6962d0dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
mrbgems/mruby-compiler/core/parse.y
mrbgems/mruby-compiler/core/parse.y
+16
-3
No files found.
mrbgems/mruby-compiler/core/parse.y
View file @
cece0163
...
...
@@ -852,6 +852,12 @@ new_dstr(parser_state *p, node *a)
return cons((node*)NODE_DSTR, a);
}
static node*
concat_string(parser_state *p, node *a, node *b)
{
return new_dstr(p, list2(a, b));
}
/* (:str . (s . len)) */
static node*
new_xstr(parser_state *p, const char *s, int len)
...
...
@@ -1200,7 +1206,7 @@ heredoc_end(parser_state *p)
%token <nd> tNTH_REF tBACK_REF
%token <num> tREGEXP_END
%type <nd> singleton string string_rep string_interp xstring regexp
%type <nd> singleton string string_
fragment string_
rep string_interp xstring regexp
%type <nd> literal numeric cpath symbol
%type <nd> top_compstmt top_stmts top_stmt
%type <nd> bodystmt compstmt stmts stmt expr arg primary command command_call method_call
...
...
@@ -2852,7 +2858,14 @@ literal : numeric
| symbols
;
string : tCHAR
string : string_fragment
| string string_fragment
{
$$ = concat_string(p, $1, $2);
}
;
string_fragment : tCHAR
| tSTRING
| tSTRING_BEG tSTRING
{
...
...
@@ -3478,7 +3491,7 @@ assoc : arg tASSOC arg
void_expr_error(p, $3);
$$ = cons(new_sym(p, $1), $3);
}
| string tLABEL_TAG arg
| string
_fragment
tLABEL_TAG arg
{
void_expr_error(p, $3);
if ($1->car == (node*)NODE_DSTR) {
...
...
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