[前][次][番号順一覧][スレッド一覧]

ruby-changes:28582

From: nobu <ko1@a...>
Date: Fri, 10 May 2013 23:56:49 +0900 (JST)
Subject: [ruby-changes:28582] nobu:r40634 (trunk): parse.y: lex_state macros

nobu	2013-05-10 23:56:37 +0900 (Fri, 10 May 2013)

  New Revision: 40634

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40634

  Log:
    parse.y: lex_state macros
    
    * parse.y (parser_yylex): use IS_lex_state() and IS_lex_state_for()
      instead of direct comparison.

  Modified files:
    trunk/parse.y

Index: parse.y
===================================================================
--- parse.y	(revision 40633)
+++ parse.y	(revision 40634)
@@ -8006,11 +8006,11 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L8006
 		if (kw) {
 		    enum lex_state_e state = lex_state;
 		    lex_state = kw->state;
-		    if (state == EXPR_FNAME) {
+		    if (IS_lex_state_for(state, EXPR_FNAME)) {
 			set_yylval_name(rb_intern(kw->name));
 			return kw->id[0];
 		    }
-		    if (lex_state == EXPR_BEG) {
+		    if (IS_lex_state(EXPR_BEG)) {
 			command_start = TRUE;
 		    }
 		    if (kw->id[0] == keyword_do) {
@@ -8020,13 +8020,13 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L8020
 			    return keyword_do_LAMBDA;
 			}
 			if (COND_P()) return keyword_do_cond;
-			if (CMDARG_P() && state != EXPR_CMDARG)
+			if (CMDARG_P() && !IS_lex_state_for(state, EXPR_CMDARG))
 			    return keyword_do_block;
-			if (state & (EXPR_BEG | EXPR_ENDARG))
+			if (IS_lex_state_for(state, (EXPR_BEG | EXPR_ENDARG)))
 			    return keyword_do_block;
 			return keyword_do;
 		    }
-		    if (state & (EXPR_BEG | EXPR_VALUE))
+		    if (IS_lex_state_for(state, (EXPR_BEG | EXPR_VALUE)))
 			return kw->id[0];
 		    else {
 			if (kw->id[0] != kw->id[1])

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]