From: Sonja Elen Kisa Date: 2009-12-18T12:21:49+09:00 Subject: Re: how to alias keywords? From #ruby-lang on Freenode IRC tonight: [21:44] Sonja: http://github.com/shyouhei/ruby/blob/trunk/parse.y#L10106-10154 [21:44] right. you either get "if" or you get "somethingelse", but not both [21:45] if you want both, you'll have to declare both english and otherlanguage as keywords and then modify the grammar productions to accept both [21:46] yea, that. [21:46] which is not quite as easy [21:46] essentially: if expr then? expr => (if|fi) expr (then|neht)? [21:46] just a bit tedious considering how f'd up the yacc file is [21:47] but start with something that isn't replicated in C like class or module [21:47] experiment with that one change [21:47] and then expand [21:48] should all just be algebraic changes, substitute A|B for all A [21:50] looks like the 1.9 (trunk) version is very cleaned up... keyword_elsif... very easy to track down all versions then [21:51] yacc kinda sucks... but we're stuck with it (*cough*for now*cough*) [21:52] my algebraic statement above isn't quite that easy since yacc doesn't support EBNF productions cleanly... but you'll get it [22:06] Sonja this is about as good as it gets without messing with parse.y http://gist.github.com/259256 -- Posted via http://www.ruby-forum.com/.