dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH] parse.y: pack
@ 2015-07-16 10:57 Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2015-07-16 10:57 UTC (permalink / raw)
  To: spew

---
 parse.y | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/parse.y b/parse.y
index a53a041..d6bc7be 100644
--- a/parse.y
+++ b/parse.y
@@ -229,7 +229,6 @@ struct parser_params {
     NODE *heap;
 
     YYSTYPE *parser_yylval;
-    VALUE eofp;
 
     NODE *parser_lex_strterm;
     stack_type parser_cond_stack;
@@ -237,12 +236,10 @@ struct parser_params {
     enum lex_state_e parser_lex_state;
     int parser_paren_nest;
     int parser_lpar_beg;
-    int parser_in_single;
-    int parser_in_def;
+    int parser_in_single; /* counter */
+    int parser_in_def; /* counter */
     int parser_brace_nest;
-    int parser_compile_for_eval;
     int parser_in_kwarg;
-    int parser_in_defined;
     int parser_tokidx;
     int parser_toksiz;
     int parser_tokline;
@@ -269,9 +266,12 @@ struct parser_params {
 
     int last_cr_line;
 
+    unsigned int eofp: 1;
     unsigned int parser_ruby__end__seen: 1;
     unsigned int parser_yydebug: 1;
     unsigned int has_shebang: 1;
+    unsigned int parser_in_defined: 1;
+    unsigned int parser_compile_for_eval: 1;
 
 #ifndef RIPPER
     /* Ruby core only */
@@ -4507,7 +4507,7 @@ f_arglist	: '(' f_args rparen
 		    }
 		    f_args term
 		    {
-			parser->parser_in_kwarg = $<num>1;
+			parser->parser_in_kwarg = !!$<num>1;
 			$$ = $2;
 			lex_state = EXPR_BEG;
 			command_start = TRUE;
@@ -5597,7 +5597,7 @@ parser_compile_string(volatile VALUE vparser, VALUE fname, VALUE s, int line)
     lex_gets_ptr = 0;
     lex_input = rb_str_new_frozen(s);
     lex_pbeg = lex_p = lex_pend = 0;
-    compile_for_eval = rb_parse_in_eval();
+    compile_for_eval = !!rb_parse_in_eval();
 
     node = yycompile(parser, fname, line);
     RB_GC_GUARD(vparser); /* prohibit tail call optimization */
@@ -5669,7 +5669,7 @@ rb_parser_compile_file_path(volatile VALUE vparser, VALUE fname, VALUE file, int
     lex_gets = lex_io_gets;
     lex_input = file;
     lex_pbeg = lex_p = lex_pend = 0;
-    compile_for_eval = rb_parse_in_eval();
+    compile_for_eval = !!rb_parse_in_eval();
 
     node = yycompile(parser, fname, start);
     RB_GC_GUARD(vparser); /* prohibit tail call optimization */
@@ -5734,7 +5734,7 @@ parser_nextc(struct parser_params *parser)
 		return -1;
 
 	    if (!lex_input || NIL_P(v = lex_getline(parser))) {
-		parser->eofp = Qtrue;
+		parser->eofp = 1;
 		lex_goto_eol(parser);
 		return -1;
 	    }
@@ -8500,7 +8500,7 @@ parser_yylex(struct parser_params *parser)
       case '_':
 	if (was_bol() && whole_match_p("__END__", 7, 0)) {
 	    ruby__end__seen = 1;
-	    parser->eofp = Qtrue;
+	    parser->eofp = 1;
 #ifndef RIPPER
 	    return -1;
 #else
@@ -10547,7 +10547,7 @@ internal_id_gen(struct parser_params *parser)
 static void
 parser_initialize(struct parser_params *parser)
 {
-    parser->eofp = Qfalse;
+    parser->eofp = 0;
 
     parser->parser_lex_strterm = 0;
     parser->parser_cond_stack = 0;
@@ -10557,7 +10557,6 @@ parser_initialize(struct parser_params *parser)
     parser->parser_brace_nest = 0;
     parser->parser_in_single = 0;
     parser->parser_in_def = 0;
-    parser->parser_in_defined = 0;
     parser->parser_in_kwarg = 0;
     parser->parser_compile_for_eval = 0;
     parser->parser_tokenbuf = NULL;
-- 
EW


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] parse.y: pack
@ 2015-07-16 20:37 Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2015-07-16 20:37 UTC (permalink / raw)
  To: spew

---
 parse.y | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/parse.y b/parse.y
index 6751404..ad69b05 100644
--- a/parse.y
+++ b/parse.y
@@ -229,7 +229,6 @@ struct parser_params {
     NODE *heap;
 
     YYSTYPE *parser_yylval;
-    VALUE eofp;
 
     NODE *parser_lex_strterm;
     stack_type parser_cond_stack;
@@ -237,15 +236,13 @@ struct parser_params {
     enum lex_state_e parser_lex_state;
     int parser_paren_nest;
     int parser_lpar_beg;
-    int parser_in_single;
-    int parser_in_def;
+    int parser_in_single; /* counter */
+    int parser_in_def; /* counter */
     int parser_brace_nest;
-    int parser_compile_for_eval;
-    int parser_in_kwarg;
-    int parser_in_defined;
     int parser_tokidx;
     int parser_toksiz;
     int parser_tokline;
+    int parser_heredoc_end;
     char *parser_tokenbuf;
     VALUE parser_lex_input;
     VALUE parser_lex_lastline;
@@ -253,8 +250,6 @@ struct parser_params {
     const char *parser_lex_pbeg;
     const char *parser_lex_p;
     const char *parser_lex_pend;
-    int parser_heredoc_end;
-    int parser_command_start;
     NODE *parser_deferred_nodes;
     long parser_lex_gets_ptr;
     VALUE (*parser_lex_gets)(struct parser_params*,VALUE);
@@ -269,9 +264,14 @@ struct parser_params {
 
     int last_cr_line;
 
+    unsigned int parser_command_start:1;
+    unsigned int eofp: 1;
     unsigned int parser_ruby__end__seen: 1;
     unsigned int parser_yydebug: 1;
     unsigned int has_shebang: 1;
+    unsigned int parser_in_defined: 1;
+    unsigned int parser_compile_for_eval: 1;
+    unsigned int parser_in_kwarg: 1;
 
 #ifndef RIPPER
     /* Ruby core only */
@@ -4507,7 +4507,7 @@ f_arglist	: '(' f_args rparen
 		    }
 		    f_args term
 		    {
-			parser->parser_in_kwarg = $<num>1;
+			parser->parser_in_kwarg = !!$<num>1;
 			$$ = $2;
 			lex_state = EXPR_BEG;
 			command_start = TRUE;
@@ -5597,7 +5597,7 @@ parser_compile_string(volatile VALUE vparser, VALUE fname, VALUE s, int line)
     lex_gets_ptr = 0;
     lex_input = rb_str_new_frozen(s);
     lex_pbeg = lex_p = lex_pend = 0;
-    compile_for_eval = rb_parse_in_eval();
+    compile_for_eval = !!rb_parse_in_eval();
 
     node = yycompile(parser, fname, line);
     RB_GC_GUARD(vparser); /* prohibit tail call optimization */
@@ -5669,7 +5669,7 @@ rb_parser_compile_file_path(volatile VALUE vparser, VALUE fname, VALUE file, int
     lex_gets = lex_io_gets;
     lex_input = file;
     lex_pbeg = lex_p = lex_pend = 0;
-    compile_for_eval = rb_parse_in_eval();
+    compile_for_eval = !!rb_parse_in_eval();
 
     node = yycompile(parser, fname, start);
     RB_GC_GUARD(vparser); /* prohibit tail call optimization */
@@ -5734,7 +5734,7 @@ parser_nextc(struct parser_params *parser)
 		return -1;
 
 	    if (!lex_input || NIL_P(v = lex_getline(parser))) {
-		parser->eofp = Qtrue;
+		parser->eofp = 1;
 		lex_goto_eol(parser);
 		return -1;
 	    }
@@ -8500,7 +8500,7 @@ parser_yylex(struct parser_params *parser)
       case '_':
 	if (was_bol() && whole_match_p("__END__", 7, 0)) {
 	    ruby__end__seen = 1;
-	    parser->eofp = Qtrue;
+	    parser->eofp = 1;
 #ifndef RIPPER
 	    return -1;
 #else
@@ -10547,7 +10547,7 @@ internal_id_gen(struct parser_params *parser)
 static void
 parser_initialize(struct parser_params *parser)
 {
-    parser->eofp = Qfalse;
+    parser->eofp = 0;
 
     parser->parser_lex_strterm = 0;
     parser->parser_cond_stack = 0;
@@ -10557,7 +10557,6 @@ parser_initialize(struct parser_params *parser)
     parser->parser_brace_nest = 0;
     parser->parser_in_single = 0;
     parser->parser_in_def = 0;
-    parser->parser_in_defined = 0;
     parser->parser_in_kwarg = 0;
     parser->parser_compile_for_eval = 0;
     parser->parser_tokenbuf = NULL;
-- 
EW


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-16 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-16 10:57 [PATCH] parse.y: pack Eric Wong
  -- strict thread matches above, loose matches on Subject: below --
2015-07-16 20:37 Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).