Project

General

Profile

Feature #9099 » 0001-keywords-parse.y-keyord-lambda.patch

nobu (Nobuyoshi Nakada), 11/11/2013 05:25 PM

View differences:

defs/keywords
1
%{
1
%{ /* -*- coding: utf-8; -*- */
2 2
struct kwtable {const char *name; int id[2]; enum lex_state_e state;};
3 3
const struct kwtable *rb_reserved_word(const char *, unsigned int);
4 4
#ifndef RIPPER
......
49 49
when, {keyword_when, keyword_when}, EXPR_VALUE
50 50
while, {keyword_while, modifier_while}, EXPR_VALUE
51 51
yield, {keyword_yield, keyword_yield}, EXPR_ARG
52
λ, {keyword_lambda, keyword_lambda}, EXPR_ENDFN
52 53
%%
53 54
#endif
parse.y
754 754
	keyword__LINE__
755 755
	keyword__FILE__
756 756
	keyword__ENCODING__
757
	keyword_lambda
757 758

  
758 759
%token <id>   tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR tLABEL
759 760
%token <node> tINTEGER tFLOAT tRATIONAL tIMAGINARY tSTRING_CONTENT tCHAR
......
2747 2748
		    {
2748 2749
			$$ = $2;
2749 2750
		    }
2751
		| keyword_lambda lambda
2752
		    {
2753
			$$ = $2;
2754
		    }
2750 2755
		| k_if expr_value then
2751 2756
		  compstmt
2752 2757
		  if_tail
......
8145 8150
		    return tLABEL;
8146 8151
		}
8147 8152
	    }
8148
	    if (mb == ENC_CODERANGE_7BIT && !IS_lex_state(EXPR_DOT)) {
8153
	    if ((mb == ENC_CODERANGE_7BIT ||
8154
		 rb_enc_to_index(parser->enc) == ENCINDEX_UTF_8) &&
8155
		!IS_lex_state(EXPR_DOT)) {
8149 8156
		const struct kwtable *kw;
8150 8157

  
8151 8158
		/* See if it is a reserved word.  */
8152
-