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
%{
%{ /* -*- coding: utf-8; -*- */
struct kwtable {const char *name; int id[2]; enum lex_state_e state;};
const struct kwtable *rb_reserved_word(const char *, unsigned int);
#ifndef RIPPER
......
when, {keyword_when, keyword_when}, EXPR_VALUE
while, {keyword_while, modifier_while}, EXPR_VALUE
yield, {keyword_yield, keyword_yield}, EXPR_ARG
λ, {keyword_lambda, keyword_lambda}, EXPR_ENDFN
%%
#endif
parse.y
keyword__LINE__
keyword__FILE__
keyword__ENCODING__
keyword_lambda
%token <id> tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR tLABEL
%token <node> tINTEGER tFLOAT tRATIONAL tIMAGINARY tSTRING_CONTENT tCHAR
......
{
$$ = $2;
}
| keyword_lambda lambda
{
$$ = $2;
}
| k_if expr_value then
compstmt
if_tail
......
return tLABEL;
}
}
if (mb == ENC_CODERANGE_7BIT && !IS_lex_state(EXPR_DOT)) {
if ((mb == ENC_CODERANGE_7BIT ||
rb_enc_to_index(parser->enc) == ENCINDEX_UTF_8) &&
!IS_lex_state(EXPR_DOT)) {
const struct kwtable *kw;
/* See if it is a reserved word. */
(3-3/3)