mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: debugging stuff
* parse.y (lex_state_name): returns name for lex_state_e, for debug use. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2924c95347
commit
ae32e9a225
2 changed files with 37 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu May 10 10:18:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (lex_state_name): returns name for lex_state_e, for debug
|
||||
use.
|
||||
|
||||
Wed May 9 16:36:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/mkmf.rb (MakeMakefile#pkg_config): check if libs resulted from
|
||||
|
|
32
parse.y
32
parse.y
|
@ -11,6 +11,9 @@
|
|||
|
||||
%{
|
||||
|
||||
#ifndef PARSER_DEBUG
|
||||
#define PARSER_DEBUG 0
|
||||
#endif
|
||||
#define YYDEBUG 1
|
||||
#define YYERROR_VERBOSE 1
|
||||
#define YYSTACK_USE_ALLOCA 0
|
||||
|
@ -74,6 +77,10 @@ enum lex_state_e {
|
|||
EXPR_MAX_STATE
|
||||
};
|
||||
|
||||
#if PARSER_DEBUG
|
||||
static const char *lex_state_name(enum lex_state_e state);
|
||||
#endif
|
||||
|
||||
typedef VALUE stack_type;
|
||||
|
||||
# define BITSTACK_PUSH(stack, n) ((stack) = ((stack)<<1)|((n)&1))
|
||||
|
@ -8479,6 +8486,28 @@ id_is_var_gen(struct parser_params *parser, ID id)
|
|||
}
|
||||
#endif /* !RIPPER */
|
||||
|
||||
#if PARSER_DEBUG
|
||||
static const char *
|
||||
lex_state_name(enum lex_state_e state)
|
||||
{
|
||||
switch (state) {
|
||||
case EXPR_BEG: return "EXPR_BEG";
|
||||
case EXPR_END: return "EXPR_END";
|
||||
case EXPR_ENDARG: return "EXPR_ENDARG";
|
||||
case EXPR_ENDFN: return "EXPR_ENDFN";
|
||||
case EXPR_ARG: return "EXPR_ARG";
|
||||
case EXPR_CMDARG: return "EXPR_CMDARG";
|
||||
case EXPR_MID: return "EXPR_MID";
|
||||
case EXPR_FNAME: return "EXPR_FNAME";
|
||||
case EXPR_DOT: return "EXPR_DOT";
|
||||
case EXPR_CLASS: return "EXPR_CLASS";
|
||||
case EXPR_VALUE: return "EXPR_VALUE";
|
||||
case EXPR_MAX_STATE: break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RIPPER
|
||||
static VALUE
|
||||
assignable_gen(struct parser_params *parser, VALUE lhs)
|
||||
|
@ -9807,6 +9836,9 @@ Init_sym(void)
|
|||
|
||||
(void)nodetype;
|
||||
(void)nodeline;
|
||||
#if PARSER_DEBUG
|
||||
(void)lex_state_name(-1);
|
||||
#endif
|
||||
|
||||
Init_id();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue