summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-05 06:54:57 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-05 06:54:57 +0000
commit2e2786ccab636dd82de640bd771f2cc9fc20ab31 (patch)
tree0fc0c7632c71d722058b1f6c7ca513d57611086d /parse.y
parent393f665e33782d4a91813abe599b1b28d675127d (diff)
* re.c (Init_Regexp): to_s to be alias to inspect.
* parse.y (yylex): should support 'keyword='. * ruby.c (proc_options): should not adjust argc/argv if -e option is supplied. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y47
1 files changed, 25 insertions, 22 deletions
diff --git a/parse.y b/parse.y
index 60d386b239..c39b2ca3d0 100644
--- a/parse.y
+++ b/parse.y
@@ -2897,7 +2897,6 @@ yylex()
register int c;
int space_seen = 0;
int cmd_state;
- struct kwtable *kw;
cmd_state = command_start;
command_start = Qfalse;
@@ -3714,8 +3713,33 @@ yylex()
else
result = tIVAR;
break;
+
default:
+ if (toklast() == '!' || toklast() == '?') {
+ result = tFID;
+ }
+ else {
+ if (lex_state == EXPR_FNAME) {
+ if ((c = nextc()) == '=' && !peek('~') && !peek('>') &&
+ (!peek('=') || lex_p + 1 < lex_pend && lex_p[1] == '>')) {
+ result = tIDENTIFIER;
+ tokadd(c);
+ }
+ else {
+ pushback(c);
+ }
+ }
+ if (result == 0 && ISUPPER(tok()[0])) {
+ result = tCONSTANT;
+ }
+ else {
+ result = tIDENTIFIER;
+ }
+ }
+
if (lex_state != EXPR_DOT) {
+ struct kwtable *kw;
+
/* See if it is a reserved word. */
kw = rb_reserved_word(tok(), toklen());
if (kw) {
@@ -3740,27 +3764,6 @@ yylex()
}
}
- if (toklast() == '!' || toklast() == '?') {
- result = tFID;
- }
- else {
- if (lex_state == EXPR_FNAME) {
- if ((c = nextc()) == '=' && !peek('~') && !peek('>') &&
- (!peek('=') || lex_p + 1 < lex_pend && lex_p[1] == '>')) {
- result = tIDENTIFIER;
- tokadd(c);
- }
- else {
- pushback(c);
- }
- }
- if (result == 0 && ISUPPER(tok()[0])) {
- result = tCONSTANT;
- }
- else {
- result = tIDENTIFIER;
- }
- }
if (lex_state == EXPR_BEG ||
lex_state == EXPR_DOT ||
lex_state == EXPR_ARG ||