diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-05 04:04:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-05 04:04:00 +0000 |
commit | 258552e6e5e6340baeb94d84826708038fc336c2 (patch) | |
tree | 618b9df3d58a48193bba18ccbc56819b41c900b4 /defs/id.def | |
parent | 20d94b47b9591069ad8d12319bffa594b9b8d5b7 (diff) | |
download | ruby-258552e6e5e6340baeb94d84826708038fc336c2.tar.gz |
id.def: token_ops
* defs/id.def (token_ops): gather associations between IDs,
operators, and parser tokens.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'defs/id.def')
-rw-r--r-- | defs/id.def | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/defs/id.def b/defs/id.def index f79e5ef4cf..d871200cf9 100644 --- a/defs/id.def +++ b/defs/id.def @@ -65,6 +65,42 @@ firstline, predefined = __LINE__+1, %[\ - debug#created_line ] +# VM ID OP Parser Token +token_ops = %[\ + Dot2 .. DOT2 + Dot3 ... DOT3 + UPlus +@ UPLUS + UMinus -@ UMINUS + Pow ** POW + DSTAR ** + Cmp <=> CMP + PLUS + + MINUS - + MULT * + DIV / + MOD % + LTLT << LSHFT + GTGT >> RSHFT + LT < + LE <= LEQ + GT > + GE >= GEQ + Eq == EQ + Eqq === EQQ + Neq != NEQ + Not ! + Backquote ` + EqTilde =~ MATCH + NeqTilde !~ NMATCH + AREF [] + ASET []= + COLON2 :: + COLON3 :: + ANDOP && + OROP || + DOTQ .? +] + class KeywordError < RuntimeError def self.raise(mesg, line) super(self, mesg, ["#{__FILE__}:#{line}", *caller]) @@ -79,6 +115,7 @@ global_ids = [] const_ids = [] class_ids = [] attrset_ids = [] +token_op_ids = [] names = {} predefined.split(/^/).each_with_index do |line, num| next if /^#/ =~ line @@ -117,6 +154,14 @@ predefined.split(/^/).each_with_index do |line, num| end << token predefined_ids[token] = name end +token_ops.split(/^/).each do |line| + next if /^#/ =~ line + line.sub!(/\s+#.*/, '') + id, op, token = line.split + next unless id and op + token ||= (id unless /\A\W\z/ =~ op) + token_op_ids << [id, op, token] +end { "LOCAL" => local_ids, "INSTANCE" => instance_ids, @@ -126,4 +171,5 @@ end "ATTRSET" => attrset_ids, :preserved => preserved_ids, :predefined => predefined_ids, + :token_op => token_op_ids, } |