summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2018-01-16parse.y (expr_value_do): factor out COND_PUSH->expr_value->do->COND_POPmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-16parse.y: removed PARSER_ARG macronobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-16parse.y: expand tokadd_mbcharnobu
* parse.y (tokadd_mbchar): renamed and expand callers with p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-16parse.y: set location of nodes that lexer generatesmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-16parse.y: set location of string/literals in the lexer instead of actionsmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-16parse.y (new_regexp): Fix SEGV of `/#{"\u3042"}#{'い'}/` in non UTF-8mame
Mixing other encoding string literals in one Regexp caused SEGV. This bug was found by CoverityScan. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-16parse.y (symbol_append): Added to factor out `%i[]` and `%I[]`mame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15parse.y: Removes unneeded Ripper/Parser guardsmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15parse.y (new_command_qcall): Receives a block (optional)mame
There were four cases that uses new_command_qcall and then method_add_block. This change factors out the four rules. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15parse.y: Removes unreachable warningsmame
tIDENTIFIER is now always a local id (except fname). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15parse.y: Removes unneeded NULL checksmame
Nowadays, there are less rules whose return value is NULL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15parse.y: Remove unneeded NULL checkmame
There are many usages assuming that bodystmt always returns non-null. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15parse.y (last_arg_append, rest_arg_append): factor out the code clonesmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15parse.y (new_ary_op_assign): Factor out the typical code clonemame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15parse.y: Fix a bug of `obj[42, &blk] ||= foo bar`mame
Follow up of r28123 (!) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15parse.y (begin_block): Factor out BEGIN {} process.mame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15parse.y: Remove unused code comment blocksmame
The code fragments were commented out in YARV merge era. I believe that it will be never needed in near future. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14parse.y (parser_heredoc_dedent): Removedmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14parse.y: yydebugnobu
* parse.y (yydebug): define to disable a global variable and get rid of linker error when static linked ext. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14parse.y: Remove unused a macro "FIXME"mame
I don't know what it was, but seems that it has been already fixed since r12117. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14parse.y: ripper no longer uses rb_discard_nodenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14parse.y: Remove a code for old yaccmame
The current parse.y won't compile with yacc since it depends on many bison's extensions. Also, configure.ac does not have a check for yacc, so the macro OLD_YACC is no longer used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14parse.y: Remove almost all *_gen macros by passing parser_params explicitlymame
In parse.y many functions were suffixed "_gen" and had companion macros to pass struct parser_params implicitly, which made parse.c bigger and more obscure. This change expands and removes almost all "*_gen" macros. This requires explicit passing of struct parser_params, i.e., we need to write "foo(p, ..)" instead of "foo(..)". However, it is just extra three letters. I believe that this is easier to understand. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14parse.y: Expand global-like accessor macros for struct parser_paramsmame
For example, `lex_strterm` is expanded to `p->lex.strterm`. I believe that this expansion make the code straightforward. They look not so annoying because "parser" was renamed to "p". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14parse.y: Use "p" for the variable of struct parser_params consistentlymame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14parse.y: Avoid "p" as a variable namemame
Because I want to use the name "p" for struct parser_params through parse.c. This change renames "p" to "ptr", "paren", etc. depending upon the context. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-12parse.y: Remove meaningless ifndef guardsmame
Because the part of the code is already within `#ifndef RIPPER`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-12parse.y (token_info_push, token_info_pop): Refactoringmame
* remove unused argument len * factor out initialization code of token_info * make the condition of "mismatched indentations" warning easy to understand git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-12parse.y (token_info_push, token_info_pop): Use code_locationmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-12parse.y: Remove unneeded dependence on pointer representatinmame
A simple comparison is enough in this case git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-11parse.y: Remove LEXPOP hackmame
cmdarg_stack became inconsistent state due to look-ahead, and LEXPOP hack smoothed over the inconsistency. This commit fixes the inconsisitent state itself, and removes LEXPOP hack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-11Fix a typo [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-11parse.y: disentangle the lexer handling of ')', ']', and '}'mame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-11parse.y: simplify and add a comment for paren_nest and lpar_begmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-11parse.y: add a simple comment for COND_* and CMDARG_*mame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-11parse.y (local_push_gen): Rewrite the condition of "unused var" warningmame
It was unnecessarily too complex, IMO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: insane syntax too (class definition in cond)mame
This change partially reverts r61724 and take another approach: exploiting struct local_vars to backup the cond_stack state. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09Fix indent [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: insane syntaxnobu
* parse.y (primary): save/restore COND and CMDARG stacks at method definition, to distinguish do_block and do_cond properly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09Rename code_range to code_locationmame
Because the name "code_range" is ambiguous with encoding's. Abbreviations ("crange", and "cr") are also renamed to "loc". The traditional "code_location" (a pair of lineno and column) is renamed to "code_position". Abbreviations are also renamed (first_loc to beg_pos, and last_loc to end_pos). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09Allow `-> do rescue; end` as well as `proc do rescue; end`mame
https://twitter.com/takiuchi/status/950593389963051008 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: Remove redefinition of mallocmame
Because the purpose is now unsure (maybe, to support very old bison?). If an issue occurs, it should be resurrected with explicit comment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: PARSER_DEBUG is no longer usedmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: Remove meaningless ifndef guardsmame
Because the part of the code is already within `#ifndef RIPPER`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: set ID to yylval ID instead of tokennobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: Remove special handling of tOROP and tANDOPmame
The complexity is no longer considered necessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: use change_shortcut_operator_idnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: Remove duplicated nd_line setyui-knk
* parse.y: These nodes are created with `@$` locations. Start position of `@$` is same as start position of `@1`. And NEW_XXX macros set first_loc.lineno of a passed code range to nd_line. So these nd_set_line are not needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Make consistent with the terms about code ranges and locationsmame
"loc" was ambiguous; it might refer both a location and a code range. This change uses "loc" for a location, and "crange" or "cr" for a code range. A location (abbr. loc) is a point in a program and consists of line number and column number. A code range (abbr. crange and cr) is a range within a program and consists of a pair of locations which is the first and the last. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y (remove_duplicate_keys): Remove a not used argumentyui-knk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e