ruby_parser 3.4.1 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -2
- data.tar.gz.sig +0 -0
- data/.autotest +2 -2
- data/History.txt +20 -0
- data/Manifest.txt +2 -0
- data/Rakefile +24 -81
- data/lib/ruby20_parser.rb +2 -1
- data/lib/ruby20_parser.y +2 -1
- data/lib/ruby21_parser.rb +6726 -0
- data/lib/ruby21_parser.y +2339 -0
- data/lib/ruby_lexer.rb +8 -22
- data/lib/ruby_lexer.rex +83 -95
- data/lib/ruby_lexer.rex.rb +174 -121
- data/lib/ruby_parser.rb +1 -0
- data/lib/ruby_parser_extras.rb +28 -9
- data/test/test_ruby_lexer.rb +23 -0
- data/test/test_ruby_parser.rb +128 -58
- metadata +9 -7
- metadata.gz.sig +3 -3
data/lib/ruby_lexer.rb
CHANGED
@@ -132,6 +132,14 @@ class RubyLexer
|
|
132
132
|
ss.eos?
|
133
133
|
end
|
134
134
|
|
135
|
+
def expr_dot?
|
136
|
+
lex_state == :expr_dot
|
137
|
+
end
|
138
|
+
|
139
|
+
def expr_fname?
|
140
|
+
lex_state == :expr_fname
|
141
|
+
end
|
142
|
+
|
135
143
|
def expr_result token, text
|
136
144
|
cond.push false
|
137
145
|
cmdarg.push false
|
@@ -304,28 +312,6 @@ class RubyLexer
|
|
304
312
|
result :expr_end, :tBACK_REF, token
|
305
313
|
end
|
306
314
|
|
307
|
-
def process_backtick text
|
308
|
-
case lex_state
|
309
|
-
when :expr_fname then
|
310
|
-
result :expr_end, :tBACK_REF2, "`"
|
311
|
-
when :expr_dot then
|
312
|
-
result((command_state ? :expr_cmdarg : :expr_arg), :tBACK_REF2, "`")
|
313
|
-
else
|
314
|
-
string STR_XQUOTE
|
315
|
-
result nil, :tXSTRING_BEG, "`"
|
316
|
-
end
|
317
|
-
end
|
318
|
-
|
319
|
-
def process_bang text
|
320
|
-
if in_arg_state? then
|
321
|
-
return result(:expr_arg, :tUBANG, "!@") if scan(/@/)
|
322
|
-
end
|
323
|
-
|
324
|
-
text = scan(/[=~]/) ? "!#{matched}" : "!"
|
325
|
-
|
326
|
-
return result(arg_state, TOKENS[text], text)
|
327
|
-
end
|
328
|
-
|
329
315
|
def process_begin text
|
330
316
|
@comments << matched
|
331
317
|
|
data/lib/ruby_lexer.rex
CHANGED
@@ -44,139 +44,127 @@ rule
|
|
44
44
|
/\n|\#/ process_newline_or_comment
|
45
45
|
|
46
46
|
/[\]\)\}]/ process_bracing
|
47
|
-
/\!/ process_bang
|
48
47
|
|
49
|
-
|
48
|
+
: /\!/
|
49
|
+
| in_arg_state? /\!\@/ { result :expr_arg, :tUBANG, "!@" }
|
50
|
+
| /\![=~]?/ { result :arg_state, TOKENS[text], text }
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
: /\./
|
53
|
+
| /\.\.\.?/ { result :expr_beg, TOKENS[text], text }
|
54
|
+
| /\.\d/ { rb_compile_error "no .<digit> floating literal anymore put 0 before dot" }
|
55
|
+
| /\./ { result :expr_dot, :tDOT, "." }
|
54
56
|
|
55
57
|
/\(/ process_paren
|
56
58
|
|
57
|
-
|
59
|
+
/\,/ { result :expr_beg, TOKENS[text], text }
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
+
: /=/
|
62
|
+
| /\=\=\=|\=\=|\=~|\=>|\=(?!begin\b)/ { result arg_state, TOKENS[text], text }
|
63
|
+
| bol? /\=begin(?=\s)/ process_begin
|
64
|
+
| /\=(?=begin\b)/ { result arg_state, TOKENS[text], text }
|
61
65
|
|
62
66
|
/\"(#{SIMPLE_STRING})\"/o { result :expr_end, :tSTRING, text[1..-2].gsub(ESC) { unescape $1 } }
|
63
67
|
/\"/ { string STR_DQUOTE; result nil, :tSTRING_BEG, text }
|
64
68
|
|
65
|
-
/\@\@?\d/
|
69
|
+
/\@\@?\d/ { rb_compile_error "`#{text}` is not allowed as a variable name" }
|
66
70
|
/\@\@?#{IDENT_CHAR}+/o process_ivar
|
67
71
|
|
68
|
-
|
69
|
-
#
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
not_end? /:([a-zA-Z_]#{IDENT_CHAR}*(?:[?]|[!](?!=)|=(?==>)|=(?![=>]))?)/o process_symbol
|
75
|
-
not_end? /\:\"(#{SIMPLE_STRING})\"/o process_symbol
|
76
|
-
not_end? /\:\'(#{SSTRING})\'/o process_symbol
|
77
|
-
|
78
|
-
/\:\:/ process_colon2
|
79
|
-
/\:/ process_colon1
|
80
|
-
|
81
|
-
# numbers:
|
82
|
-
|
83
|
-
# : /\d/
|
84
|
-
# | /#{NUM_BAD}/o { rb_compile_error "Invalid numeric format" }
|
85
|
-
# | /#{INT_DEC}/o { int_with_base 10 }
|
86
|
-
# | /#{INT_HEX}/o { int_with_base 16 }
|
87
|
-
# | /#{INT_BIN}/o { int_with_base 2 }
|
88
|
-
# | /#{INT_OCT_BAD}/o { rb_compile_error "Illegal octal digit." }
|
89
|
-
# | /#{INT_OCT}/o { int_with_base 8 }
|
90
|
-
# | /#{FLOAT_BAD}/o { rb_compile_error "Trailing '_' in number." }
|
91
|
-
# | /#{FLOAT}/o process_float
|
92
|
-
# | /#{INT_DEC2}/o { int_with_base 10 }
|
72
|
+
: /:/
|
73
|
+
| not_end? /:([a-zA-Z_]#{IDENT_CHAR}*(?:[?]|[!](?!=)|=(?==>)|=(?![=>]))?)/o process_symbol
|
74
|
+
| not_end? /\:\"(#{SIMPLE_STRING})\"/o process_symbol
|
75
|
+
| not_end? /\:\'(#{SSTRING})\'/o process_symbol
|
76
|
+
| /\:\:/ process_colon2
|
77
|
+
| /\:/ process_colon1
|
93
78
|
|
94
79
|
/->/ { result :expr_endfn, :tLAMBDA, nil }
|
95
80
|
|
96
81
|
/[+-]/ process_plus_minus
|
97
82
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
83
|
+
: /[+\d]/
|
84
|
+
| /#{NUM_BAD}/o { rb_compile_error "Invalid numeric format" }
|
85
|
+
| /#{INT_DEC}/o { int_with_base 10 }
|
86
|
+
| /#{INT_HEX}/o { int_with_base 16 }
|
87
|
+
| /#{INT_BIN}/o { int_with_base 2 }
|
88
|
+
| /#{INT_OCT_BAD}/o { rb_compile_error "Illegal octal digit." }
|
89
|
+
| /#{INT_OCT}/o { int_with_base 8 }
|
90
|
+
| /#{FLOAT_BAD}/o { rb_compile_error "Trailing '_' in number." }
|
91
|
+
| /#{FLOAT}/o process_float
|
92
|
+
| /#{INT_DEC2}/o { int_with_base 10 }
|
93
|
+
| /[0-9]/ { rb_compile_error "Bad number format" }
|
108
94
|
|
109
95
|
/\[/ process_square_bracket
|
110
96
|
|
111
97
|
/\'#{SSTRING}\'/o { result :expr_end, :tSTRING, matched[1..-2].gsub(/\\\\/, "\\").gsub(/\\'/, "'") } # " stupid emacs
|
112
98
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
99
|
+
: /\|/
|
100
|
+
| /\|\|\=/ { result :expr_beg, :tOP_ASGN, "||" }
|
101
|
+
| /\|\|/ { result :expr_beg, :tOROP, "||" }
|
102
|
+
| /\|\=/ { result :expr_beg, :tOP_ASGN, "|" }
|
103
|
+
| /\|/ { result :arg_state, :tPIPE, "|" }
|
117
104
|
|
118
105
|
/\{/ process_curly_brace
|
119
106
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
# /\`/ : expr_fname? { result(:expr_end, :tBACK_REF2, "`") }
|
145
|
-
# | expr_dot? { result((command_state ? :expr_cmdarg : :expr_arg), :tBACK_REF2, "`")
|
146
|
-
# | { string STR_XQUOTE, '`'; result(nil, :tXSTRING_BEG, "`") }
|
107
|
+
: /\*/
|
108
|
+
| /\*\*=/ { result :expr_beg, :tOP_ASGN, "**" }
|
109
|
+
| /\*\*/ { result(:arg_state, space_vs_beginning(:tDSTAR, :tDSTAR, :tPOW), "**") }
|
110
|
+
| /\*\=/ { result(:expr_beg, :tOP_ASGN, "*") }
|
111
|
+
| /\*/ { result(:arg_state, space_vs_beginning(:tSTAR, :tSTAR, :tSTAR2), "*") }
|
112
|
+
|
113
|
+
: /</
|
114
|
+
| /\<\=\>/ { result :arg_state, :tCMP, "<=>" }
|
115
|
+
| /\<\=/ { result :arg_state, :tLEQ, "<=" }
|
116
|
+
| /\<\<\=/ { result :arg_state, :tOP_ASGN, "<<" }
|
117
|
+
| /\<\</ process_lchevron
|
118
|
+
| /\</ { result :arg_state, :tLT, "<" }
|
119
|
+
|
120
|
+
: />/
|
121
|
+
| /\>\=/ { result :arg_state, :tGEQ, ">=" }
|
122
|
+
| /\>\>=/ { result :arg_state, :tOP_ASGN, ">>" }
|
123
|
+
| /\>\>/ { result :arg_state, :tRSHFT, ">>" }
|
124
|
+
| /\>/ { result :arg_state, :tGT, ">" }
|
125
|
+
|
126
|
+
: /`/
|
127
|
+
| expr_fname? /\`/ { result(:expr_end, :tBACK_REF2, "`") }
|
128
|
+
| expr_dot? /\`/ { result((command_state ? :expr_cmdarg : :expr_arg), :tBACK_REF2, "`") }
|
129
|
+
| /\`/ { string STR_XQUOTE, '`'; result(nil, :tXSTRING_BEG, "`") }
|
147
130
|
|
148
131
|
/\?/ process_questionmark
|
149
132
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
133
|
+
: /&/
|
134
|
+
| /\&\&\=/ { result(:expr_beg, :tOP_ASGN, "&&") }
|
135
|
+
| /\&\&/ { result(:expr_beg, :tANDOP, "&&") }
|
136
|
+
| /\&\=/ { result(:expr_beg, :tOP_ASGN, "&" ) }
|
137
|
+
| /\&/ process_amper
|
154
138
|
|
155
139
|
/\// process_slash
|
156
140
|
|
157
|
-
|
158
|
-
|
141
|
+
: /\^/
|
142
|
+
| /\^=/ { result(:expr_beg, :tOP_ASGN, "^") }
|
143
|
+
| /\^/ { result(:arg_state, :tCARET, "^") }
|
159
144
|
|
160
145
|
/\;/ { self.command_start = true; result(:expr_beg, :tSEMI, ";") }
|
161
146
|
|
162
|
-
|
163
|
-
|
147
|
+
: /~/
|
148
|
+
| in_arg_state? /\~@/ { result(:arg_state, :tTILDE, "~") }
|
149
|
+
| /\~/ { result(:arg_state, :tTILDE, "~") }
|
164
150
|
|
165
|
-
|
166
|
-
|
151
|
+
: /\\/
|
152
|
+
| /\\\r?\n/ { self.lineno += 1; self.space_seen = true; next }
|
153
|
+
| /\\/ { rb_compile_error "bare backslash only allowed before newline" }
|
167
154
|
|
168
155
|
/\%/ process_percent
|
169
156
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
157
|
+
: /\$/
|
158
|
+
| /\$_\w+/ process_gvar
|
159
|
+
| /\$_/ process_gvar
|
160
|
+
| /\$[~*$?!@\/\\;,.=:<>\"]|\$-\w?/ process_gvar
|
161
|
+
| in_fname? /\$([\&\`\'\+])/ process_gvar
|
162
|
+
| /\$([\&\`\'\+])/ process_backref
|
163
|
+
| in_fname? /\$([1-9]\d*)/ process_gvar
|
164
|
+
| /\$([1-9]\d*)/ process_nthref
|
165
|
+
| /\$0/ process_gvar
|
166
|
+
| /\$\W|\$\z/ process_gvar_oddity
|
167
|
+
| /\$\w+/ process_gvar
|
180
168
|
|
181
169
|
/\_/ process_underscore
|
182
170
|
|
data/lib/ruby_lexer.rex.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# This file is automatically generated. Do not modify it.
|
3
|
-
# Generated by: oedipus_lex version 2.
|
3
|
+
# Generated by: oedipus_lex version 2.2.0.
|
4
4
|
# Source: lib/ruby_lexer.rex
|
5
5
|
#++
|
6
6
|
|
@@ -85,22 +85,35 @@ class RubyLexer
|
|
85
85
|
process_newline_or_comment text
|
86
86
|
when text = ss.scan(/[\]\)\}]/) then
|
87
87
|
process_bracing text
|
88
|
-
when
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
88
|
+
when ss.check(/\!/) then
|
89
|
+
case
|
90
|
+
when in_arg_state? && (text = ss.scan(/\!\@/)) then
|
91
|
+
action { result :expr_arg, :tUBANG, "!@" }
|
92
|
+
when text = ss.scan(/\![=~]?/) then
|
93
|
+
action { result :arg_state, TOKENS[text], text }
|
94
|
+
end # group /\!/
|
95
|
+
when ss.check(/\./) then
|
96
|
+
case
|
97
|
+
when text = ss.scan(/\.\.\.?/) then
|
98
|
+
action { result :expr_beg, TOKENS[text], text }
|
99
|
+
when text = ss.scan(/\.\d/) then
|
100
|
+
action { rb_compile_error "no .<digit> floating literal anymore put 0 before dot" }
|
101
|
+
when text = ss.scan(/\./) then
|
102
|
+
action { result :expr_dot, :tDOT, "." }
|
103
|
+
end # group /\./
|
96
104
|
when text = ss.scan(/\(/) then
|
97
105
|
process_paren text
|
98
|
-
when text = ss.scan(
|
99
|
-
action { result
|
100
|
-
when
|
101
|
-
|
102
|
-
|
103
|
-
|
106
|
+
when text = ss.scan(/\,/) then
|
107
|
+
action { result :expr_beg, TOKENS[text], text }
|
108
|
+
when ss.check(/=/) then
|
109
|
+
case
|
110
|
+
when text = ss.scan(/\=\=\=|\=\=|\=~|\=>|\=(?!begin\b)/) then
|
111
|
+
action { result arg_state, TOKENS[text], text }
|
112
|
+
when bol? && (text = ss.scan(/\=begin(?=\s)/)) then
|
113
|
+
process_begin text
|
114
|
+
when text = ss.scan(/\=(?=begin\b)/) then
|
115
|
+
action { result arg_state, TOKENS[text], text }
|
116
|
+
end # group /=/
|
104
117
|
when text = ss.scan(/\"(#{SIMPLE_STRING})\"/o) then
|
105
118
|
action { result :expr_end, :tSTRING, text[1..-2].gsub(ESC) { unescape $1 } }
|
106
119
|
when text = ss.scan(/\"/) then
|
@@ -109,130 +122,170 @@ class RubyLexer
|
|
109
122
|
action { rb_compile_error "`#{text}` is not allowed as a variable name" }
|
110
123
|
when text = ss.scan(/\@\@?#{IDENT_CHAR}+/o) then
|
111
124
|
process_ivar text
|
112
|
-
when
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
125
|
+
when ss.check(/:/) then
|
126
|
+
case
|
127
|
+
when not_end? && (text = ss.scan(/:([a-zA-Z_]#{IDENT_CHAR}*(?:[?]|[!](?!=)|=(?==>)|=(?![=>]))?)/o)) then
|
128
|
+
process_symbol text
|
129
|
+
when not_end? && (text = ss.scan(/\:\"(#{SIMPLE_STRING})\"/o)) then
|
130
|
+
process_symbol text
|
131
|
+
when not_end? && (text = ss.scan(/\:\'(#{SSTRING})\'/o)) then
|
132
|
+
process_symbol text
|
133
|
+
when text = ss.scan(/\:\:/) then
|
134
|
+
process_colon2 text
|
135
|
+
when text = ss.scan(/\:/) then
|
136
|
+
process_colon1 text
|
137
|
+
end # group /:/
|
122
138
|
when text = ss.scan(/->/) then
|
123
139
|
action { result :expr_endfn, :tLAMBDA, nil }
|
124
140
|
when text = ss.scan(/[+-]/) then
|
125
141
|
process_plus_minus text
|
126
|
-
when
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
when ss.check(/[+\d]/) then
|
143
|
+
case
|
144
|
+
when text = ss.scan(/#{NUM_BAD}/o) then
|
145
|
+
action { rb_compile_error "Invalid numeric format" }
|
146
|
+
when text = ss.scan(/#{INT_DEC}/o) then
|
147
|
+
action { int_with_base 10 }
|
148
|
+
when text = ss.scan(/#{INT_HEX}/o) then
|
149
|
+
action { int_with_base 16 }
|
150
|
+
when text = ss.scan(/#{INT_BIN}/o) then
|
151
|
+
action { int_with_base 2 }
|
152
|
+
when text = ss.scan(/#{INT_OCT_BAD}/o) then
|
153
|
+
action { rb_compile_error "Illegal octal digit." }
|
154
|
+
when text = ss.scan(/#{INT_OCT}/o) then
|
155
|
+
action { int_with_base 8 }
|
156
|
+
when text = ss.scan(/#{FLOAT_BAD}/o) then
|
157
|
+
action { rb_compile_error "Trailing '_' in number." }
|
158
|
+
when text = ss.scan(/#{FLOAT}/o) then
|
159
|
+
process_float text
|
160
|
+
when text = ss.scan(/#{INT_DEC2}/o) then
|
161
|
+
action { int_with_base 10 }
|
162
|
+
when text = ss.scan(/[0-9]/) then
|
163
|
+
action { rb_compile_error "Bad number format" }
|
164
|
+
end # group /[+\d]/
|
146
165
|
when text = ss.scan(/\[/) then
|
147
166
|
process_square_bracket text
|
148
167
|
when text = ss.scan(/\'#{SSTRING}\'/o) then
|
149
168
|
action { result :expr_end, :tSTRING, matched[1..-2].gsub(/\\\\/, "\\").gsub(/\\'/, "'") } # " stupid emacs
|
150
|
-
when
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
169
|
+
when ss.check(/\|/) then
|
170
|
+
case
|
171
|
+
when text = ss.scan(/\|\|\=/) then
|
172
|
+
action { result :expr_beg, :tOP_ASGN, "||" }
|
173
|
+
when text = ss.scan(/\|\|/) then
|
174
|
+
action { result :expr_beg, :tOROP, "||" }
|
175
|
+
when text = ss.scan(/\|\=/) then
|
176
|
+
action { result :expr_beg, :tOP_ASGN, "|" }
|
177
|
+
when text = ss.scan(/\|/) then
|
178
|
+
action { result :arg_state, :tPIPE, "|" }
|
179
|
+
end # group /\|/
|
158
180
|
when text = ss.scan(/\{/) then
|
159
181
|
process_curly_brace text
|
160
|
-
when
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
when
|
185
|
-
|
186
|
-
|
187
|
-
|
182
|
+
when ss.check(/\*/) then
|
183
|
+
case
|
184
|
+
when text = ss.scan(/\*\*=/) then
|
185
|
+
action { result :expr_beg, :tOP_ASGN, "**" }
|
186
|
+
when text = ss.scan(/\*\*/) then
|
187
|
+
action { result(:arg_state, space_vs_beginning(:tDSTAR, :tDSTAR, :tPOW), "**") }
|
188
|
+
when text = ss.scan(/\*\=/) then
|
189
|
+
action { result(:expr_beg, :tOP_ASGN, "*") }
|
190
|
+
when text = ss.scan(/\*/) then
|
191
|
+
action { result(:arg_state, space_vs_beginning(:tSTAR, :tSTAR, :tSTAR2), "*") }
|
192
|
+
end # group /\*/
|
193
|
+
when ss.check(/</) then
|
194
|
+
case
|
195
|
+
when text = ss.scan(/\<\=\>/) then
|
196
|
+
action { result :arg_state, :tCMP, "<=>" }
|
197
|
+
when text = ss.scan(/\<\=/) then
|
198
|
+
action { result :arg_state, :tLEQ, "<=" }
|
199
|
+
when text = ss.scan(/\<\<\=/) then
|
200
|
+
action { result :arg_state, :tOP_ASGN, "<<" }
|
201
|
+
when text = ss.scan(/\<\</) then
|
202
|
+
process_lchevron text
|
203
|
+
when text = ss.scan(/\</) then
|
204
|
+
action { result :arg_state, :tLT, "<" }
|
205
|
+
end # group /</
|
206
|
+
when ss.check(/>/) then
|
207
|
+
case
|
208
|
+
when text = ss.scan(/\>\=/) then
|
209
|
+
action { result :arg_state, :tGEQ, ">=" }
|
210
|
+
when text = ss.scan(/\>\>=/) then
|
211
|
+
action { result :arg_state, :tOP_ASGN, ">>" }
|
212
|
+
when text = ss.scan(/\>\>/) then
|
213
|
+
action { result :arg_state, :tRSHFT, ">>" }
|
214
|
+
when text = ss.scan(/\>/) then
|
215
|
+
action { result :arg_state, :tGT, ">" }
|
216
|
+
end # group />/
|
217
|
+
when ss.check(/`/) then
|
218
|
+
case
|
219
|
+
when expr_fname? && (text = ss.scan(/\`/)) then
|
220
|
+
action { result(:expr_end, :tBACK_REF2, "`") }
|
221
|
+
when expr_dot? && (text = ss.scan(/\`/)) then
|
222
|
+
action { result((command_state ? :expr_cmdarg : :expr_arg), :tBACK_REF2, "`") }
|
223
|
+
when text = ss.scan(/\`/) then
|
224
|
+
action { string STR_XQUOTE, '`'; result(nil, :tXSTRING_BEG, "`") }
|
225
|
+
end # group /`/
|
188
226
|
when text = ss.scan(/\?/) then
|
189
227
|
process_questionmark text
|
190
|
-
when
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
228
|
+
when ss.check(/&/) then
|
229
|
+
case
|
230
|
+
when text = ss.scan(/\&\&\=/) then
|
231
|
+
action { result(:expr_beg, :tOP_ASGN, "&&") }
|
232
|
+
when text = ss.scan(/\&\&/) then
|
233
|
+
action { result(:expr_beg, :tANDOP, "&&") }
|
234
|
+
when text = ss.scan(/\&\=/) then
|
235
|
+
action { result(:expr_beg, :tOP_ASGN, "&" ) }
|
236
|
+
when text = ss.scan(/\&/) then
|
237
|
+
process_amper text
|
238
|
+
end # group /&/
|
198
239
|
when text = ss.scan(/\//) then
|
199
240
|
process_slash text
|
200
|
-
when
|
201
|
-
|
202
|
-
|
203
|
-
|
241
|
+
when ss.check(/\^/) then
|
242
|
+
case
|
243
|
+
when text = ss.scan(/\^=/) then
|
244
|
+
action { result(:expr_beg, :tOP_ASGN, "^") }
|
245
|
+
when text = ss.scan(/\^/) then
|
246
|
+
action { result(:arg_state, :tCARET, "^") }
|
247
|
+
end # group /\^/
|
204
248
|
when text = ss.scan(/\;/) then
|
205
249
|
action { self.command_start = true; result(:expr_beg, :tSEMI, ";") }
|
206
|
-
when
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
250
|
+
when ss.check(/~/) then
|
251
|
+
case
|
252
|
+
when in_arg_state? && (text = ss.scan(/\~@/)) then
|
253
|
+
action { result(:arg_state, :tTILDE, "~") }
|
254
|
+
when text = ss.scan(/\~/) then
|
255
|
+
action { result(:arg_state, :tTILDE, "~") }
|
256
|
+
end # group /~/
|
257
|
+
when ss.check(/\\/) then
|
258
|
+
case
|
259
|
+
when text = ss.scan(/\\\r?\n/) then
|
260
|
+
action { self.lineno += 1; self.space_seen = true; next }
|
261
|
+
when text = ss.scan(/\\/) then
|
262
|
+
action { rb_compile_error "bare backslash only allowed before newline" }
|
263
|
+
end # group /\\/
|
214
264
|
when text = ss.scan(/\%/) then
|
215
265
|
process_percent text
|
216
|
-
when
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
266
|
+
when ss.check(/\$/) then
|
267
|
+
case
|
268
|
+
when text = ss.scan(/\$_\w+/) then
|
269
|
+
process_gvar text
|
270
|
+
when text = ss.scan(/\$_/) then
|
271
|
+
process_gvar text
|
272
|
+
when text = ss.scan(/\$[~*$?!@\/\\;,.=:<>\"]|\$-\w?/) then
|
273
|
+
process_gvar text
|
274
|
+
when in_fname? && (text = ss.scan(/\$([\&\`\'\+])/)) then
|
275
|
+
process_gvar text
|
276
|
+
when text = ss.scan(/\$([\&\`\'\+])/) then
|
277
|
+
process_backref text
|
278
|
+
when in_fname? && (text = ss.scan(/\$([1-9]\d*)/)) then
|
279
|
+
process_gvar text
|
280
|
+
when text = ss.scan(/\$([1-9]\d*)/) then
|
281
|
+
process_nthref text
|
282
|
+
when text = ss.scan(/\$0/) then
|
283
|
+
process_gvar text
|
284
|
+
when text = ss.scan(/\$\W|\$\z/) then
|
285
|
+
process_gvar_oddity text
|
286
|
+
when text = ss.scan(/\$\w+/) then
|
287
|
+
process_gvar text
|
288
|
+
end # group /\$/
|
236
289
|
when text = ss.scan(/\_/) then
|
237
290
|
process_underscore text
|
238
291
|
when text = ss.scan(/#{IDENT}/o) then
|