opal 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +3 -0
- data/.travis.yml +0 -4
- data/README.md +6 -0
- data/Rakefile +30 -6
- data/bin/opal +6 -82
- data/corelib/{opal/array.rb → array.rb} +40 -56
- data/corelib/{opal/basic_object.rb → basic_object.rb} +2 -2
- data/corelib/{opal/boolean.rb → boolean.rb} +0 -8
- data/corelib/class.rb +47 -0
- data/corelib/{opal/comparable.rb → comparable.rb} +0 -0
- data/corelib/{opal/enumerable.rb → enumerable.rb} +208 -141
- data/corelib/{opal/enumerator.rb → enumerator.rb} +3 -3
- data/corelib/{opal/error.rb → error.rb} +1 -0
- data/corelib/{opal/hash.rb → hash.rb} +67 -56
- data/corelib/io.rb +39 -0
- data/corelib/{opal/kernel.rb → kernel.rb} +35 -31
- data/corelib/{opal/class.rb → module.rb} +29 -57
- data/corelib/native.rb +148 -0
- data/corelib/{opal/nil_class.rb → nil_class.rb} +2 -10
- data/corelib/{opal/numeric.rb → numeric.rb} +39 -14
- data/corelib/opal.rb +42 -25
- data/corelib/{opal/proc.rb → proc.rb} +3 -3
- data/corelib/{opal/range.rb → range.rb} +5 -1
- data/corelib/{opal/regexp.rb → regexp.rb} +0 -0
- data/corelib/{opal/runtime.js → runtime.js} +96 -188
- data/corelib/{opal/string.rb → string.rb} +20 -15
- data/corelib/struct.rb +139 -0
- data/corelib/{opal/time.rb → time.rb} +0 -0
- data/lib/opal.rb +4 -0
- data/lib/opal/cli.rb +79 -32
- data/lib/opal/cli_options.rb +91 -0
- data/lib/opal/erb.rb +41 -8
- data/lib/opal/grammar.rb +24 -10
- data/lib/opal/grammar.y +15 -4
- data/lib/opal/grammar_helpers.rb +4 -0
- data/lib/opal/lexer.rb +214 -143
- data/lib/opal/parser.rb +596 -562
- data/lib/opal/require_parser.rb +1 -1
- data/lib/opal/source_map.rb +15 -30
- data/lib/opal/target_scope.rb +24 -5
- data/lib/opal/version.rb +1 -1
- data/mri_spec/cli_spec.rb +18 -0
- data/mri_spec/fixtures/opal_file.rb +2 -0
- data/mri_spec/spec_helper.rb +17 -0
- data/opal.gemspec +5 -2
- data/spec/{rubyspec/filters → filters}/bugs/alias.rb +0 -0
- data/spec/{rubyspec/filters → filters}/bugs/ancestors.rb +0 -0
- data/spec/{rubyspec/filters → filters}/bugs/array.rb +0 -0
- data/spec/filters/bugs/array/combination.rb +11 -0
- data/spec/filters/bugs/array/count.rb +3 -0
- data/spec/filters/bugs/array/delete_if.rb +3 -0
- data/spec/filters/bugs/array/drop.rb +3 -0
- data/spec/filters/bugs/array/drop_while.rb +5 -0
- data/spec/filters/bugs/array/eql.rb +3 -0
- data/spec/filters/bugs/array/flatten.rb +9 -0
- data/spec/filters/bugs/array/minus.rb +5 -0
- data/spec/filters/bugs/array/multipliy.rb +9 -0
- data/spec/filters/bugs/array/new.rb +3 -0
- data/spec/filters/bugs/array/pop.rb +6 -0
- data/spec/filters/bugs/array/rassoc.rb +4 -0
- data/spec/filters/bugs/array/rindex.rb +6 -0
- data/spec/filters/bugs/array/select.rb +3 -0
- data/spec/filters/bugs/array/shift.rb +7 -0
- data/spec/filters/bugs/array/shuffle.rb +11 -0
- data/spec/filters/bugs/array/slice.rb +7 -0
- data/spec/filters/bugs/array/take.rb +3 -0
- data/spec/filters/bugs/array/to_a.rb +3 -0
- data/spec/filters/bugs/array/try_convert.rb +7 -0
- data/spec/filters/bugs/array/uniq.rb +10 -0
- data/spec/filters/bugs/array/zip.rb +4 -0
- data/spec/{rubyspec/filters → filters}/bugs/array_delete.rb +1 -0
- data/spec/{rubyspec/filters → filters}/bugs/array_fetch.rb +0 -0
- data/spec/{rubyspec/filters → filters}/bugs/array_first.rb +0 -0
- data/spec/{rubyspec/filters → filters}/bugs/array_flatten.rb +0 -0
- data/spec/{rubyspec/filters → filters}/bugs/array_intersection.rb +0 -0
- data/spec/{rubyspec/filters → filters}/bugs/array_join.rb +0 -0
- data/spec/{rubyspec/filters → filters}/bugs/break.rb +0 -0
- data/spec/filters/bugs/case.rb +4 -0
- data/spec/{rubyspec/filters → filters}/bugs/coerce_integer.rb +0 -0
- data/spec/filters/bugs/enumerable_sort_by.rb +3 -0
- data/spec/{rubyspec/filters → filters}/bugs/kernel/instance_variables.rb +0 -0
- data/spec/filters/bugs/kernel/rand.rb +4 -0
- data/spec/filters/bugs/language/array.rb +3 -0
- data/spec/filters/bugs/language/block.rb +6 -0
- data/spec/filters/bugs/language/break.rb +3 -0
- data/spec/{rubyspec/filters → filters}/bugs/language/class.rb +3 -0
- data/spec/{rubyspec/filters → filters}/bugs/language/class_variables.rb +0 -0
- data/spec/filters/bugs/language/def.rb +27 -0
- data/spec/filters/bugs/language/defined.rb +3 -0
- data/spec/filters/bugs/language/ensure.rb +4 -0
- data/spec/filters/bugs/language/execution.rb +4 -0
- data/spec/filters/bugs/language/for.rb +18 -0
- data/spec/filters/bugs/language/if.rb +13 -0
- data/spec/filters/bugs/language/loop.rb +4 -0
- data/spec/filters/bugs/language/metaclass.rb +14 -0
- data/spec/filters/bugs/language/module.rb +6 -0
- data/spec/filters/bugs/language/next.rb +3 -0
- data/spec/filters/bugs/language/or.rb +3 -0
- data/spec/filters/bugs/language/order.rb +4 -0
- data/spec/filters/bugs/language/precedence.rb +10 -0
- data/spec/filters/bugs/language/proc.rb +24 -0
- data/spec/filters/bugs/language/redo.rb +5 -0
- data/spec/filters/bugs/language/rescue.rb +9 -0
- data/spec/filters/bugs/language/retry.rb +5 -0
- data/spec/filters/bugs/language/send.rb +10 -0
- data/spec/filters/bugs/language/super.rb +9 -0
- data/spec/filters/bugs/language/until.rb +8 -0
- data/spec/filters/bugs/language/variables.rb +37 -0
- data/spec/filters/bugs/language/while.rb +6 -0
- data/spec/filters/bugs/language/yield.rb +5 -0
- data/spec/{rubyspec/filters → filters}/bugs/module/class_variables.rb +0 -0
- data/spec/filters/bugs/module/method_defined.rb +6 -0
- data/spec/filters/bugs/parser.rb +10 -0
- data/spec/{rubyspec/filters → filters}/bugs/public_methods.rb +1 -0
- data/spec/filters/bugs/return.rb +7 -0
- data/spec/filters/bugs/singleton/instance.rb +4 -0
- data/spec/filters/bugs/source_map.rb +3 -0
- data/spec/filters/bugs/string/center.rb +4 -0
- data/spec/filters/bugs/string/lines.rb +3 -0
- data/spec/{rubyspec/filters → filters}/mspec/mocks.rb +0 -0
- data/spec/{rubyspec/filters → filters}/mspec/ruby_exe.rb +0 -0
- data/spec/{rubyspec/filters → filters}/mspec/should_receive.rb +0 -0
- data/spec/{rubyspec/filters → filters}/parser/block_args.rb +0 -0
- data/spec/{rubyspec/filters → filters}/unsupported/array_subclasses.rb +1 -0
- data/spec/filters/unsupported/frozen.rb +32 -0
- data/spec/filters/unsupported/immutable_strings.rb +3 -0
- data/spec/filters/unsupported/tainted.rb +17 -0
- data/spec/filters/unsupported/trusted.rb +15 -0
- data/spec/opal/class/constants_spec.rb +7 -0
- data/spec/opal/erb/erb_spec.rb +7 -1
- data/spec/opal/erb/inline_block.opalerb +3 -0
- data/spec/opal/hash/allocate_spec.rb +16 -0
- data/spec/opal/hash/new_spec.rb +10 -0
- data/spec/opal/hash/to_s_spec.rb +9 -0
- data/spec/opal/kernel/instance_variable_defined_spec.rb +15 -0
- data/spec/opal/kernel/rand_spec.rb +5 -5
- data/spec/opal/kernel/respond_to_spec.rb +14 -1
- data/spec/opal/language/block_spec.rb +13 -0
- data/spec/opal/language/rescue_spec.rb +27 -0
- data/spec/opal/language/return_spec.rb +38 -0
- data/spec/opal/language/singleton_class_spec.rb +13 -0
- data/spec/opal/language/super_spec.rb +99 -0
- data/spec/opal/language/variables_spec.rb +20 -0
- data/spec/opal/module/attr_accessor_spec.rb +8 -0
- data/spec/opal/module/constants_spec.rb +2 -2
- data/spec/opal/native/alias_native_spec.rb +18 -0
- data/spec/opal/native/each_spec.rb +14 -0
- data/spec/opal/native/element_reference_spec.rb +14 -0
- data/spec/opal/native/method_missing_spec.rb +39 -0
- data/spec/opal/native/new_spec.rb +19 -0
- data/spec/opal/native/nil_spec.rb +14 -0
- data/spec/opal/runtime2/class_hierarchy_spec.rb +2 -2
- data/spec/opal/source_map_spec.rb +3 -7
- data/spec/ospec/main.rb.erb +2 -5
- data/spec/parser/alias_spec.rb +4 -4
- data/spec/parser/and_spec.rb +2 -2
- data/spec/parser/array_spec.rb +6 -6
- data/spec/parser/attrasgn_spec.rb +8 -8
- data/spec/parser/begin_spec.rb +11 -11
- data/spec/parser/block_spec.rb +3 -3
- data/spec/parser/break_spec.rb +4 -4
- data/spec/parser/call_spec.rb +50 -48
- data/spec/parser/class_spec.rb +2 -2
- data/spec/parser/const_spec.rb +1 -1
- data/spec/parser/cvar_spec.rb +1 -1
- data/spec/parser/def_spec.rb +5 -5
- data/spec/parser/gvar_spec.rb +2 -2
- data/spec/parser/hash_spec.rb +4 -4
- data/spec/parser/iasgn_spec.rb +3 -3
- data/spec/parser/if_spec.rb +6 -6
- data/spec/parser/iter_spec.rb +6 -6
- data/spec/parser/lambda_spec.rb +5 -5
- data/spec/parser/lasgn_spec.rb +2 -2
- data/spec/parser/line_spec.rb +2 -2
- data/spec/parser/lvar_spec.rb +5 -5
- data/spec/parser/masgn_spec.rb +1 -1
- data/spec/parser/module_spec.rb +2 -2
- data/spec/parser/not_spec.rb +4 -4
- data/spec/parser/op_asgn1_spec.rb +2 -2
- data/spec/parser/op_asgn2_spec.rb +2 -2
- data/spec/parser/or_spec.rb +2 -2
- data/spec/parser/parse_spec.rb +66 -0
- data/spec/parser/parser_spec.rb +32 -38
- data/spec/parser/regexp_spec.rb +4 -4
- data/spec/parser/return_spec.rb +4 -4
- data/spec/parser/sclass_spec.rb +4 -4
- data/spec/parser/str_spec.rb +3 -3
- data/spec/parser/super_spec.rb +6 -6
- data/spec/parser/undef_spec.rb +3 -3
- data/spec/parser/unless_spec.rb +4 -4
- data/spec/parser/while_spec.rb +3 -3
- data/spec/parser/xstr_spec.rb +3 -3
- data/spec/parser/yield_spec.rb +6 -6
- data/spec/rubyspec/core/array/drop_spec.rb +1 -1
- data/spec/rubyspec/core/array/keep_if_spec.rb +1 -3
- data/spec/rubyspec/core/array/length_spec.rb +1 -3
- data/spec/rubyspec/core/array/map_spec.rb +2 -6
- data/spec/rubyspec/core/array/minus_spec.rb +3 -3
- data/spec/rubyspec/core/array/multiply_spec.rb +14 -16
- data/spec/rubyspec/core/array/new_spec.rb +3 -5
- data/spec/rubyspec/core/array/plus_spec.rb +2 -2
- data/spec/rubyspec/core/array/pop_spec.rb +4 -4
- data/spec/rubyspec/core/array/rassoc_spec.rb +2 -2
- data/spec/rubyspec/core/array/reject_spec.rb +2 -6
- data/spec/rubyspec/core/array/replace_spec.rb +1 -3
- data/spec/rubyspec/core/array/reverse_each_spec.rb +1 -3
- data/spec/rubyspec/core/array/reverse_spec.rb +4 -4
- data/spec/rubyspec/core/array/rindex_spec.rb +1 -1
- data/spec/rubyspec/core/array/select_spec.rb +3 -7
- data/spec/rubyspec/core/array/shared/collect.rb +7 -0
- data/spec/rubyspec/core/array/shared/index.rb +1 -1
- data/spec/rubyspec/core/array/shared/keep_if.rb +3 -0
- data/spec/rubyspec/core/array/shared/length.rb +3 -0
- data/spec/rubyspec/core/array/shared/replace.rb +3 -0
- data/spec/rubyspec/core/array/shared/slice.rb +3 -0
- data/spec/rubyspec/core/array/shuffle_spec.rb +1 -1
- data/spec/rubyspec/core/array/size_spec.rb +1 -3
- data/spec/rubyspec/core/array/slice_spec.rb +4 -6
- data/spec/rubyspec/core/array/sort_spec.rb +2 -2
- data/spec/rubyspec/core/array/to_a_spec.rb +1 -1
- data/spec/rubyspec/core/array/try_convert_spec.rb +7 -7
- data/spec/rubyspec/core/array/uniq_spec.rb +7 -7
- data/spec/rubyspec/core/array/zip_spec.rb +1 -1
- data/spec/rubyspec/core/enumerable/collect_spec.rb +24 -0
- data/spec/rubyspec/core/enumerable/count_spec.rb +35 -19
- data/spec/rubyspec/core/enumerable/find_spec.rb +5 -0
- data/spec/rubyspec/core/hash/each_pair_spec.rb +7 -7
- data/spec/rubyspec/core/hash/each_spec.rb +13 -7
- data/spec/rubyspec/core/module/method_defined_spec.rb +4 -4
- data/spec/rubyspec/core/module/public_method_defined_spec.rb +19 -0
- data/spec/rubyspec/core/module/remove_const_spec.rb +23 -0
- data/spec/rubyspec/core/numeric/step_spec.rb +14 -0
- data/spec/rubyspec/core/string/center_spec.rb +43 -65
- data/spec/rubyspec/core/string/lines_spec.rb +1 -1
- data/spec/rubyspec/core/string/ljust_spec.rb +25 -9
- data/spec/rubyspec/core/string/rjust_spec.rb +26 -10
- data/spec/rubyspec/core/struct/fixtures/classes.rb +26 -0
- data/spec/rubyspec/core/struct/initialize_spec.rb +11 -0
- data/spec/rubyspec/core/struct/new_spec.rb +24 -0
- data/spec/rubyspec/fixtures/constants.rb +7 -0
- data/spec/rubyspec/language/break_spec.rb +1 -1
- data/spec/rubyspec/language/case_spec.rb +30 -30
- data/spec/rubyspec/language/def_spec.rb +34 -34
- data/spec/rubyspec/language/defined_spec.rb +2 -2
- data/spec/rubyspec/language/ensure_spec.rb +2 -2
- data/spec/rubyspec/language/execution_spec.rb +2 -2
- data/spec/rubyspec/language/for_spec.rb +17 -17
- data/spec/rubyspec/language/hash_spec.rb +3 -3
- data/spec/rubyspec/language/if_spec.rb +11 -11
- data/spec/rubyspec/language/loop_spec.rb +3 -3
- data/spec/rubyspec/language/metaclass_spec.rb +14 -14
- data/spec/rubyspec/language/module_spec.rb +6 -6
- data/spec/rubyspec/language/next_spec.rb +5 -5
- data/spec/rubyspec/language/not_spec.rb +1 -1
- data/spec/rubyspec/language/or_spec.rb +1 -1
- data/spec/rubyspec/language/order_spec.rb +3 -5
- data/spec/rubyspec/language/precedence_spec.rb +19 -19
- data/spec/rubyspec/language/proc_spec.rb +29 -29
- data/spec/rubyspec/language/redo_spec.rb +3 -5
- data/spec/rubyspec/language/rescue_spec.rb +7 -7
- data/spec/rubyspec/language/retry_spec.rb +2 -2
- data/spec/rubyspec/language/return_spec.rb +12 -12
- data/spec/rubyspec/language/send_spec.rb +9 -9
- data/spec/rubyspec/language/singleton_class_spec.rb +3 -4
- data/spec/rubyspec/language/super_spec.rb +7 -11
- data/spec/rubyspec/language/until_spec.rb +10 -10
- data/spec/rubyspec/language/variables_spec.rb +59 -67
- data/spec/rubyspec/language/versions/array_1.9.rb +1 -1
- data/spec/rubyspec/language/versions/block_1.9.rb +0 -0
- data/spec/rubyspec/language/versions/break_1.9.rb +0 -0
- data/spec/rubyspec/language/versions/literal_lambda_1.9.rb +12 -12
- data/spec/rubyspec/language/versions/send_1.9.rb +23 -23
- data/spec/rubyspec/language/versions/symbol_1.9.rb +2 -2
- data/spec/rubyspec/language/versions/variables_1.9.rb +1 -1
- data/spec/rubyspec/language/while_spec.rb +4 -4
- data/spec/rubyspec/language/yield_spec.rb +3 -3
- data/spec/rubyspec/library/erb/util/html_escape_spec.rb +10 -0
- data/spec/rubyspec/library/singleton/clone_spec.rb +8 -0
- data/spec/rubyspec/library/singleton/dup_spec.rb +8 -0
- data/spec/rubyspec/library/singleton/fixtures/classes.rb +18 -0
- data/spec/rubyspec/library/singleton/instance_spec.rb +30 -0
- data/spec/spec_helper.rb +214 -0
- data/stdlib/buffer.rb +40 -0
- data/stdlib/buffer/array.rb +66 -0
- data/stdlib/buffer/view.rb +70 -0
- data/stdlib/erb.rb +11 -20
- data/stdlib/forwardable.rb +71 -0
- data/stdlib/json.rb +78 -0
- data/stdlib/ostruct.rb +69 -0
- data/stdlib/rbconfig.rb +1 -0
- data/stdlib/singleton.rb +40 -0
- data/stdlib/stringio.rb +173 -0
- data/stdlib/template.rb +44 -0
- metadata +285 -79
- data/corelib/opal/native.rb +0 -31
- data/spec/opal/class/bridge_class_spec.rb +0 -39
- data/spec/opal/native_spec.rb +0 -209
- data/spec/ospec/runner.rb +0 -223
- data/spec/rubyspec/filters/bugs/block_args.rb +0 -3
- data/spec/rubyspec/filters/bugs/case.rb +0 -8
- data/spec/rubyspec/filters/bugs/language/module.rb +0 -3
- data/spec/rubyspec/filters/unsupported/frozen.rb +0 -4
- data/spec/rubyspec/filters/unsupported/tainted.rb +0 -7
data/lib/opal/erb.rb
CHANGED
@@ -2,16 +2,49 @@ require 'opal/parser'
|
|
2
2
|
|
3
3
|
module Opal
|
4
4
|
module ERB
|
5
|
-
def self.parse(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
def self.parse(source, file_name = '(erb)')
|
6
|
+
Compiler.new.compile source, file_name
|
7
|
+
end
|
8
|
+
|
9
|
+
class Compiler
|
10
|
+
def compile(source, file_name = '(erb)')
|
11
|
+
@source, @file_name, @result = source, file_name, source
|
12
|
+
|
13
|
+
self.fix_quotes
|
14
|
+
self.find_contents
|
15
|
+
self.find_code
|
16
|
+
self.wrap_compiled
|
17
|
+
|
18
|
+
Opal.parse @result
|
11
19
|
end
|
12
20
|
|
13
|
-
|
14
|
-
|
21
|
+
def fix_quotes
|
22
|
+
@result = @result.gsub '"', '\\"'
|
23
|
+
end
|
24
|
+
|
25
|
+
BLOCK_EXPR = /\s+(do|\{)(\s*\|[^|]*\|)?\s*\Z/
|
26
|
+
|
27
|
+
def find_contents
|
28
|
+
@result = @result.gsub(/<%=([\s\S]+?)%>/) do
|
29
|
+
inner = $1.gsub(/\\'/, "'").gsub(/\\"/, '"')
|
30
|
+
|
31
|
+
if inner =~ BLOCK_EXPR
|
32
|
+
"\")\noutput_buffer.append= #{ inner }\noutput_buffer.append(\""
|
33
|
+
else
|
34
|
+
"\")\noutput_buffer.append=(#{ inner })\noutput_buffer.append(\""
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def find_code
|
40
|
+
@result = @result.gsub(/<%([\s\S]+?)%>/) do
|
41
|
+
"\")\n#{ $1 }\noutput_buffer.append(\""
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def wrap_compiled
|
46
|
+
@result = "Template.new('#@file_name') do |output_buffer|\noutput_buffer.append(\"#@result\")\noutput_buffer.join\nend\n"
|
47
|
+
end
|
15
48
|
end
|
16
49
|
end
|
17
50
|
end
|
data/lib/opal/grammar.rb
CHANGED
@@ -1942,8 +1942,8 @@ racc_reduce_table = [
|
|
1942
1942
|
2, 175, :_reduce_68,
|
1943
1943
|
3, 175, :_reduce_69,
|
1944
1944
|
1, 177, :_reduce_70,
|
1945
|
-
4, 177, :
|
1946
|
-
3, 177, :
|
1945
|
+
4, 177, :_reduce_71,
|
1946
|
+
3, 177, :_reduce_72,
|
1947
1947
|
3, 177, :_reduce_none,
|
1948
1948
|
3, 177, :_reduce_none,
|
1949
1949
|
3, 177, :_reduce_none,
|
@@ -1954,7 +1954,7 @@ racc_reduce_table = [
|
|
1954
1954
|
3, 152, :_reduce_80,
|
1955
1955
|
3, 152, :_reduce_81,
|
1956
1956
|
3, 152, :_reduce_82,
|
1957
|
-
3, 152, :
|
1957
|
+
3, 152, :_reduce_83,
|
1958
1958
|
2, 152, :_reduce_none,
|
1959
1959
|
1, 152, :_reduce_none,
|
1960
1960
|
1, 179, :_reduce_none,
|
@@ -3168,9 +3168,19 @@ def _reduce_70(val, _values, result)
|
|
3168
3168
|
result
|
3169
3169
|
end
|
3170
3170
|
|
3171
|
-
|
3171
|
+
def _reduce_71(val, _values, result)
|
3172
|
+
args = val[2]
|
3173
|
+
args[0] = :arglist if args[0] == :array
|
3174
|
+
result = s(:attrasgn, val[0], :[]=, args)
|
3175
|
+
|
3176
|
+
result
|
3177
|
+
end
|
3172
3178
|
|
3173
|
-
|
3179
|
+
def _reduce_72(val, _values, result)
|
3180
|
+
result = new_call val[0], val[2].intern, s(:arglist)
|
3181
|
+
|
3182
|
+
result
|
3183
|
+
end
|
3174
3184
|
|
3175
3185
|
# reduce 73 omitted
|
3176
3186
|
|
@@ -3214,7 +3224,11 @@ def _reduce_82(val, _values, result)
|
|
3214
3224
|
result
|
3215
3225
|
end
|
3216
3226
|
|
3217
|
-
|
3227
|
+
def _reduce_83(val, _values, result)
|
3228
|
+
result = s(:colon2, val[0], val[2].intern)
|
3229
|
+
|
3230
|
+
result
|
3231
|
+
end
|
3218
3232
|
|
3219
3233
|
# reduce 84 omitted
|
3220
3234
|
|
@@ -3472,25 +3486,25 @@ def _reduce_179(val, _values, result)
|
|
3472
3486
|
end
|
3473
3487
|
|
3474
3488
|
def _reduce_180(val, _values, result)
|
3475
|
-
result =
|
3489
|
+
result = new_call val[0], :"+", s(:arglist, val[2])
|
3476
3490
|
|
3477
3491
|
result
|
3478
3492
|
end
|
3479
3493
|
|
3480
3494
|
def _reduce_181(val, _values, result)
|
3481
|
-
result =
|
3495
|
+
result = new_call val[0], :"-", s(:arglist, val[2])
|
3482
3496
|
|
3483
3497
|
result
|
3484
3498
|
end
|
3485
3499
|
|
3486
3500
|
def _reduce_182(val, _values, result)
|
3487
|
-
result =
|
3501
|
+
result = new_call val[0], :"*", s(:arglist, val[2])
|
3488
3502
|
|
3489
3503
|
result
|
3490
3504
|
end
|
3491
3505
|
|
3492
3506
|
def _reduce_183(val, _values, result)
|
3493
|
-
result =
|
3507
|
+
result = new_call val[0], :"/", s(:arglist, val[2])
|
3494
3508
|
|
3495
3509
|
result
|
3496
3510
|
end
|
data/lib/opal/grammar.y
CHANGED
@@ -313,7 +313,15 @@ mlhs_node:
|
|
313
313
|
result = new_assignable val[0]
|
314
314
|
}
|
315
315
|
| primary_value '[@' aref_args ']'
|
316
|
+
{
|
317
|
+
args = val[2]
|
318
|
+
args[0] = :arglist if args[0] == :array
|
319
|
+
result = s(:attrasgn, val[0], :[]=, args)
|
320
|
+
}
|
316
321
|
| primary_value '.' IDENTIFIER
|
322
|
+
{
|
323
|
+
result = new_call val[0], val[2].intern, s(:arglist)
|
324
|
+
}
|
317
325
|
| primary_value '::' IDENTIFIER
|
318
326
|
| primary_value '.' CONSTANT
|
319
327
|
| primary_value '::' CONSTANT
|
@@ -344,6 +352,9 @@ lhs:
|
|
344
352
|
result = s(:attrasgn, val[0], "#{val[2]}=".intern, s(:arglist))
|
345
353
|
}
|
346
354
|
| primary_value '::' CONSTANT
|
355
|
+
{
|
356
|
+
result = s(:colon2, val[0], val[2].intern)
|
357
|
+
}
|
347
358
|
| '::@' CONSTANT
|
348
359
|
| backref
|
349
360
|
|
@@ -450,19 +461,19 @@ arg:
|
|
450
461
|
}
|
451
462
|
| arg '+' arg
|
452
463
|
{
|
453
|
-
result =
|
464
|
+
result = new_call val[0], :"+", s(:arglist, val[2])
|
454
465
|
}
|
455
466
|
| arg '-' arg
|
456
467
|
{
|
457
|
-
result =
|
468
|
+
result = new_call val[0], :"-", s(:arglist, val[2])
|
458
469
|
}
|
459
470
|
| arg '*' arg
|
460
471
|
{
|
461
|
-
result =
|
472
|
+
result = new_call val[0], :"*", s(:arglist, val[2])
|
462
473
|
}
|
463
474
|
| arg '/' arg
|
464
475
|
{
|
465
|
-
result =
|
476
|
+
result = new_call val[0], :"/", s(:arglist, val[2])
|
466
477
|
}
|
467
478
|
| arg '%' arg
|
468
479
|
{
|
data/lib/opal/grammar_helpers.rb
CHANGED
data/lib/opal/lexer.rb
CHANGED
@@ -86,6 +86,30 @@ module Opal
|
|
86
86
|
(@cmdarg & 1) != 0
|
87
87
|
end
|
88
88
|
|
89
|
+
def arg?
|
90
|
+
[:expr_arg, :expr_cmdarg].include? @lex_state
|
91
|
+
end
|
92
|
+
|
93
|
+
def end?
|
94
|
+
[:expr_end, :expr_endarg, :expr_endfn].include? @lex_state
|
95
|
+
end
|
96
|
+
|
97
|
+
def beg?
|
98
|
+
[:expr_beg, :expr_value, :expr_mid, :expr_class].include? @lex_state
|
99
|
+
end
|
100
|
+
|
101
|
+
def after_operator?
|
102
|
+
[:expr_fname, :expr_dot].include? @lex_state
|
103
|
+
end
|
104
|
+
|
105
|
+
def spcarg?
|
106
|
+
arg? and @space_seen and !space?
|
107
|
+
end
|
108
|
+
|
109
|
+
def space?
|
110
|
+
@scanner.check(/\s/)
|
111
|
+
end
|
112
|
+
|
89
113
|
def next_string_token
|
90
114
|
# str_parse, scanner = current_string_parse, @scanner
|
91
115
|
str_parse = @string_parse
|
@@ -269,15 +293,15 @@ module Opal
|
|
269
293
|
# if we are trying to parse a string, then delegate to that
|
270
294
|
return next_string_token if @string_parse
|
271
295
|
|
272
|
-
# scanner, space_seen, cmd_start, c = @scanner, false, false, ''
|
296
|
+
# scanner, @space_seen, cmd_start, c = @scanner, false, false, ''
|
273
297
|
scanner = @scanner
|
274
|
-
space_seen = false
|
298
|
+
@space_seen = false
|
275
299
|
cmd_start = false
|
276
300
|
c = ''
|
277
301
|
|
278
302
|
while true
|
279
303
|
if scanner.scan(/\ |\t|\r/)
|
280
|
-
space_seen = true
|
304
|
+
@space_seen = true
|
281
305
|
next
|
282
306
|
|
283
307
|
elsif scanner.scan(/(\n|#)/)
|
@@ -289,6 +313,13 @@ module Opal
|
|
289
313
|
|
290
314
|
next if [:expr_beg, :expr_dot].include? @lex_state
|
291
315
|
|
316
|
+
if scanner.scan(/([\ \t\r\f\v]*)\./)
|
317
|
+
@space_seen = true unless scanner[1].empty?
|
318
|
+
scanner.pos = scanner.pos - 1
|
319
|
+
|
320
|
+
next unless scanner.check(/\.\./)
|
321
|
+
end
|
322
|
+
|
292
323
|
cmd_start = true
|
293
324
|
@lex_state = :expr_beg
|
294
325
|
return '\\n', '\\n'
|
@@ -297,6 +328,128 @@ module Opal
|
|
297
328
|
@lex_state = :expr_beg
|
298
329
|
return ';', ';'
|
299
330
|
|
331
|
+
elsif scanner.scan(/\*/)
|
332
|
+
if scanner.scan(/\*/)
|
333
|
+
if scanner.scan(/\=/)
|
334
|
+
@lex_state = :expr_beg
|
335
|
+
return :OP_ASGN, '**'
|
336
|
+
end
|
337
|
+
|
338
|
+
if @lex_state == :expr_fname or @lex_state == :expr_dot
|
339
|
+
@lex_state = :expr_arg
|
340
|
+
else
|
341
|
+
@lex_state = :expr_beg
|
342
|
+
end
|
343
|
+
|
344
|
+
return '**', '**'
|
345
|
+
|
346
|
+
else
|
347
|
+
if scanner.scan(/\=/)
|
348
|
+
@lex_state = :expr_beg
|
349
|
+
return :OP_ASGN, '*'
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
if scanner.scan(/\*\=/)
|
354
|
+
@lex_state = :expr_beg
|
355
|
+
return :OP_ASGN, '**'
|
356
|
+
end
|
357
|
+
|
358
|
+
if scanner.scan(/\*/)
|
359
|
+
if after_operator?
|
360
|
+
@lex_state = :expr_arg
|
361
|
+
else
|
362
|
+
@lex_state = :expr_beg
|
363
|
+
end
|
364
|
+
|
365
|
+
return '**', '**'
|
366
|
+
end
|
367
|
+
|
368
|
+
if scanner.scan(/\=/)
|
369
|
+
@lex_state = :expr_beg
|
370
|
+
return :OP_ASGN, '*'
|
371
|
+
else
|
372
|
+
result = '*'
|
373
|
+
if @lex_state == :expr_fname
|
374
|
+
@lex_state = :expr_end
|
375
|
+
return '*', result
|
376
|
+
elsif @space_seen && scanner.check(/\S/)
|
377
|
+
@lex_state = :expr_beg
|
378
|
+
return :SPLAT, result
|
379
|
+
elsif [:expr_beg, :expr_mid].include? @lex_state
|
380
|
+
@lex_state = :expr_beg
|
381
|
+
return :SPLAT, result
|
382
|
+
else
|
383
|
+
@lex_state = :expr_beg
|
384
|
+
return '*', result
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
elsif scanner.scan(/\!/)
|
389
|
+
c = scanner.scan(/./)
|
390
|
+
if after_operator?
|
391
|
+
@lex_state = :expr_arg
|
392
|
+
if c == "@"
|
393
|
+
return '!', '!'
|
394
|
+
end
|
395
|
+
else
|
396
|
+
@lex_state = :expr_beg
|
397
|
+
end
|
398
|
+
|
399
|
+
if c == '='
|
400
|
+
return '!=', '!='
|
401
|
+
elsif c == '~'
|
402
|
+
return '!~', '!~'
|
403
|
+
end
|
404
|
+
|
405
|
+
scanner.pos = scanner.pos - 1
|
406
|
+
return '!', '!'
|
407
|
+
|
408
|
+
elsif scanner.scan(/\=/)
|
409
|
+
if @lex_state == :expr_beg and !@space_seen
|
410
|
+
if scanner.scan(/begin/) and space?
|
411
|
+
scanner.scan(/(.*)/) # end of line
|
412
|
+
|
413
|
+
while true
|
414
|
+
if scanner.eos?
|
415
|
+
raise "embedded document meets end of file"
|
416
|
+
end
|
417
|
+
|
418
|
+
if scanner.scan(/\=end/) and space?
|
419
|
+
return next_token
|
420
|
+
end
|
421
|
+
|
422
|
+
if scanner.scan(/\n/)
|
423
|
+
next
|
424
|
+
end
|
425
|
+
|
426
|
+
scanner.scan(/(.*)/)
|
427
|
+
end
|
428
|
+
end
|
429
|
+
end
|
430
|
+
|
431
|
+
@lex_state = if after_operator?
|
432
|
+
:expr_arg
|
433
|
+
else
|
434
|
+
:expr_beg
|
435
|
+
end
|
436
|
+
|
437
|
+
if scanner.scan(/\=/)
|
438
|
+
if scanner.scan(/\=/)
|
439
|
+
return '===', '==='
|
440
|
+
end
|
441
|
+
|
442
|
+
return '==', '=='
|
443
|
+
end
|
444
|
+
|
445
|
+
if scanner.scan(/\~/)
|
446
|
+
return '=~', '=~'
|
447
|
+
elsif scanner.scan(/\>/)
|
448
|
+
return '=>', '=>'
|
449
|
+
end
|
450
|
+
|
451
|
+
return '=', '='
|
452
|
+
|
300
453
|
elsif scanner.scan(/\"/)
|
301
454
|
@string_parse = { :beg => '"', :end => '"', :interpolate => true }
|
302
455
|
return :STRING_BEG, scanner.matched
|
@@ -309,6 +462,50 @@ module Opal
|
|
309
462
|
@string_parse = { :beg => "`", :end => "`", :interpolate => true }
|
310
463
|
return :XSTRING_BEG, scanner.matched
|
311
464
|
|
465
|
+
elsif scanner.scan(/\&/)
|
466
|
+
if scanner.scan(/\&/)
|
467
|
+
@lex_state = :expr_beg
|
468
|
+
|
469
|
+
if scanner.scan(/\=/)
|
470
|
+
return :OP_ASGN, '&&'
|
471
|
+
end
|
472
|
+
|
473
|
+
return '&&', '&&'
|
474
|
+
|
475
|
+
elsif scanner.scan(/\=/)
|
476
|
+
@lex_state = :expr_beg
|
477
|
+
return :OP_ASGN, '&'
|
478
|
+
end
|
479
|
+
|
480
|
+
if spcarg?
|
481
|
+
#puts "warning: `&' interpreted as argument prefix"
|
482
|
+
result = '&@'
|
483
|
+
elsif beg?
|
484
|
+
result = '&@'
|
485
|
+
else
|
486
|
+
#puts "warn_balanced: & argument prefix"
|
487
|
+
result = '&'
|
488
|
+
end
|
489
|
+
|
490
|
+
@lex_state = after_operator? ? :expr_arg : :expr_beg
|
491
|
+
return result, '&'
|
492
|
+
|
493
|
+
elsif scanner.scan(/\|/)
|
494
|
+
if scanner.scan(/\|/)
|
495
|
+
@lex_state = :expr_beg
|
496
|
+
if scanner.scan(/\=/)
|
497
|
+
return :OP_ASGN, '||'
|
498
|
+
end
|
499
|
+
|
500
|
+
return '||', '||'
|
501
|
+
|
502
|
+
elsif scanner.scan(/\=/)
|
503
|
+
return :OP_ASGN, '|'
|
504
|
+
end
|
505
|
+
|
506
|
+
@lex_state = after_operator?() ? :expr_arg : :expr_beg
|
507
|
+
return '|', '|'
|
508
|
+
|
312
509
|
elsif scanner.scan(/\%W/)
|
313
510
|
start_word = scanner.scan(/./)
|
314
511
|
end_word = { '(' => ')', '[' => ']', '{' => '}' }[start_word] || start_word
|
@@ -352,7 +549,7 @@ module Opal
|
|
352
549
|
elsif @lex_state == :expr_fname
|
353
550
|
@lex_state = :expr_end
|
354
551
|
elsif @lex_state == :expr_cmdarg || @lex_state == :expr_arg
|
355
|
-
if !scanner.check(/\s/) && space_seen
|
552
|
+
if !scanner.check(/\s/) && @space_seen
|
356
553
|
@string_parse = { :beg => '/', :end => '/', :interpolate => true, :regexp => true }
|
357
554
|
return :REGEXP_BEG, scanner.matched
|
358
555
|
end
|
@@ -367,7 +564,7 @@ module Opal
|
|
367
564
|
@lex_state = :expr_beg
|
368
565
|
return :OP_ASGN, '%'
|
369
566
|
elsif scanner.check(/[^\s]/)
|
370
|
-
if @lex_state == :expr_beg or (@lex_state == :expr_arg && space_seen)
|
567
|
+
if @lex_state == :expr_beg or (@lex_state == :expr_arg && @space_seen)
|
371
568
|
interpolate = true
|
372
569
|
start_word = scanner.scan(/./)
|
373
570
|
end_word = { '(' => ')', '[' => ']', '{' => '}' }[start_word] || start_word
|
@@ -380,7 +577,7 @@ module Opal
|
|
380
577
|
|
381
578
|
elsif scanner.scan(/\\/)
|
382
579
|
if scanner.scan(/\r?\n/)
|
383
|
-
space_seen = true
|
580
|
+
@space_seen = true
|
384
581
|
next
|
385
582
|
end
|
386
583
|
|
@@ -390,7 +587,7 @@ module Opal
|
|
390
587
|
result = scanner.matched
|
391
588
|
if [:expr_beg, :expr_mid].include? @lex_state
|
392
589
|
result = :PAREN_BEG
|
393
|
-
elsif space_seen && [:expr_arg, :expr_cmdarg].include?(@lex_state)
|
590
|
+
elsif @space_seen && [:expr_arg, :expr_cmdarg].include?(@lex_state)
|
394
591
|
result = :tLPAREN_ARG
|
395
592
|
else
|
396
593
|
result = '('
|
@@ -420,7 +617,7 @@ module Opal
|
|
420
617
|
else
|
421
618
|
raise "Unexpected '[' token"
|
422
619
|
end
|
423
|
-
elsif [:expr_beg, :expr_mid].include?(@lex_state) || space_seen
|
620
|
+
elsif [:expr_beg, :expr_mid].include?(@lex_state) || @space_seen
|
424
621
|
@lex_state = :expr_beg
|
425
622
|
cond_push 0
|
426
623
|
cmdarg_push 0
|
@@ -457,38 +654,11 @@ module Opal
|
|
457
654
|
@lex_state = :expr_dot unless @lex_state == :expr_fname
|
458
655
|
return '.', scanner.matched
|
459
656
|
|
460
|
-
elsif scanner.scan(/\*\*\=/)
|
461
|
-
@lex_state = :expr_beg
|
462
|
-
return :OP_ASGN, '**'
|
463
|
-
|
464
|
-
elsif scanner.scan(/\*\*/)
|
465
|
-
return '**', '**'
|
466
|
-
|
467
|
-
elsif scanner.scan(/\*\=/)
|
468
|
-
@lex_state = :expr_beg
|
469
|
-
return :OP_ASGN, '*'
|
470
|
-
|
471
|
-
elsif scanner.scan(/\*/)
|
472
|
-
result = scanner.matched
|
473
|
-
if @lex_state == :expr_fname
|
474
|
-
@lex_state = :expr_end
|
475
|
-
return '*', result
|
476
|
-
elsif space_seen && scanner.check(/\S/)
|
477
|
-
@lex_state = :expr_beg
|
478
|
-
return :SPLAT, result
|
479
|
-
elsif [:expr_beg, :expr_mid].include? @lex_state
|
480
|
-
@lex_state = :expr_beg
|
481
|
-
return :SPLAT, result
|
482
|
-
else
|
483
|
-
@lex_state = :expr_beg
|
484
|
-
return '*', result
|
485
|
-
end
|
486
|
-
|
487
657
|
elsif scanner.scan(/\:\:/)
|
488
658
|
if [:expr_beg, :expr_mid, :expr_class].include? @lex_state
|
489
659
|
@lex_state = :expr_beg
|
490
660
|
return '::@', scanner.matched
|
491
|
-
elsif space_seen && @lex_state == :expr_arg
|
661
|
+
elsif @space_seen && @lex_state == :expr_arg
|
492
662
|
@lex_state = :expr_beg
|
493
663
|
return '::@', scanner.matched
|
494
664
|
end
|
@@ -516,26 +686,6 @@ module Opal
|
|
516
686
|
@lex_state = :expr_fname
|
517
687
|
return :SYMBOL_BEG, ':'
|
518
688
|
|
519
|
-
elsif scanner.check(/\|/)
|
520
|
-
if scanner.scan(/\|\|\=/)
|
521
|
-
@lex_state = :expr_beg
|
522
|
-
return :OP_ASGN, '||'
|
523
|
-
elsif scanner.scan(/\|\|/)
|
524
|
-
@lex_state = :expr_beg
|
525
|
-
return '||', '||'
|
526
|
-
elsif scanner.scan(/\|\=/)
|
527
|
-
@lex_state = :expr_beg
|
528
|
-
return :OP_ASGN, '|'
|
529
|
-
elsif scanner.scan(/\|/)
|
530
|
-
if @lex_state == :expr_fname
|
531
|
-
@lex_state = :expr_end
|
532
|
-
return '|', scanner.matched
|
533
|
-
else
|
534
|
-
@lex_state = :expr_beg
|
535
|
-
return '|', scanner.matched
|
536
|
-
end
|
537
|
-
end
|
538
|
-
|
539
689
|
elsif scanner.scan(/\^\=/)
|
540
690
|
@lex_state = :expr_beg
|
541
691
|
return :OP_ASGN, '^'
|
@@ -548,26 +698,6 @@ module Opal
|
|
548
698
|
@lex_state = :expr_beg
|
549
699
|
return '^', scanner.matched
|
550
700
|
|
551
|
-
elsif scanner.check(/\&/)
|
552
|
-
if scanner.scan(/\&\&\=/)
|
553
|
-
@lex_state = :expr_beg
|
554
|
-
return :OP_ASGN, '&&'
|
555
|
-
elsif scanner.scan(/\&\&/)
|
556
|
-
@lex_state = :expr_beg
|
557
|
-
return '&&', scanner.matched
|
558
|
-
elsif scanner.scan(/\&\=/)
|
559
|
-
@lex_state = :expr_beg
|
560
|
-
return :OP_ASGN, '&'
|
561
|
-
elsif scanner.scan(/\&/)
|
562
|
-
if space_seen && !scanner.check(/\s/) && (@lex_state == :expr_cmdarg || @lex_state == :expr_arg)
|
563
|
-
return '&@', '&'
|
564
|
-
elsif [:expr_beg, :expr_mid].include? @lex_state
|
565
|
-
return '&@', '&'
|
566
|
-
else
|
567
|
-
return '&', '&'
|
568
|
-
end
|
569
|
-
end
|
570
|
-
|
571
701
|
elsif scanner.check(/\</)
|
572
702
|
if scanner.scan(/\<\<\=/)
|
573
703
|
@lex_state = :expr_beg
|
@@ -576,7 +706,7 @@ module Opal
|
|
576
706
|
if @lex_state == :expr_fname
|
577
707
|
@lex_state = :expr_end
|
578
708
|
return '<<', '<<'
|
579
|
-
elsif ![:expr_end, :expr_dot, :expr_endarg, :expr_class].include?(@lex_state) && space_seen
|
709
|
+
elsif ![:expr_end, :expr_dot, :expr_endarg, :expr_class].include?(@lex_state) && @space_seen
|
580
710
|
if scanner.scan(/(-?)['"]?(\w+)['"]?/)
|
581
711
|
heredoc = scanner[2]
|
582
712
|
# for now just scrap rest of line + skip down one line for
|
@@ -617,6 +747,11 @@ module Opal
|
|
617
747
|
if scanner.scan(/\>\>\=/)
|
618
748
|
return :OP_ASGN, '>>'
|
619
749
|
elsif scanner.scan(/\>\>/)
|
750
|
+
if @lex_state == :expr_fname or @lex_state == :expr_dot
|
751
|
+
@lex_state = :expr_arg
|
752
|
+
else
|
753
|
+
@lex_state = :expr_beg
|
754
|
+
end
|
620
755
|
return '>>', '>>'
|
621
756
|
elsif scanner.scan(/\>\=/)
|
622
757
|
if @lex_state == :expr_fname
|
@@ -659,7 +794,7 @@ module Opal
|
|
659
794
|
end
|
660
795
|
|
661
796
|
if @lex_state == :expr_cmdarg || @lex_state == :expr_arg
|
662
|
-
if !scanner.check(/\s/) && space_seen
|
797
|
+
if !scanner.check(/\s/) && @space_seen
|
663
798
|
@lex_state = :expr_mid
|
664
799
|
return [sign, sign]
|
665
800
|
end
|
@@ -678,73 +813,9 @@ module Opal
|
|
678
813
|
@lex_state = :expr_end
|
679
814
|
return :STRING, scanner.scan(/./)
|
680
815
|
end
|
681
|
-
#if scanner.scan(/\\/)
|
682
|
-
#c = if scanner.scan(/n/)
|
683
|
-
#"\n"
|
684
|
-
#else
|
685
|
-
#scanner.scan(/./)
|
686
|
-
#scanner.matched
|
687
|
-
#end
|
688
|
-
#else
|
689
|
-
#c = scanner.scan(/./)
|
690
|
-
#end
|
691
|
-
|
692
|
-
#@lex_state = :expr_end
|
693
|
-
#return :STRING, c
|
694
|
-
@lex_state = :expr_beg
|
695
|
-
return '?', scanner.matched
|
696
816
|
|
697
|
-
elsif scanner.scan(/\=\=\=/)
|
698
|
-
if @lex_state == :expr_fname
|
699
|
-
@lex_state = :expr_end
|
700
|
-
return '===', '==='
|
701
|
-
end
|
702
|
-
@lex_state = :expr_beg
|
703
|
-
return '===', '==='
|
704
|
-
|
705
|
-
elsif scanner.scan(/\=\=/)
|
706
|
-
if @lex_state == :expr_fname
|
707
|
-
@lex_state = :expr_end
|
708
|
-
return '==', '=='
|
709
|
-
end
|
710
817
|
@lex_state = :expr_beg
|
711
|
-
return '
|
712
|
-
|
713
|
-
elsif scanner.scan(/\=\~/)
|
714
|
-
if @lex_state == :expr_fname
|
715
|
-
@lex_state = :expr_end
|
716
|
-
return '=~', '=~'
|
717
|
-
end
|
718
|
-
@lex_state = :expr_beg
|
719
|
-
return '=~', '=~'
|
720
|
-
|
721
|
-
elsif scanner.scan(/\=\>/)
|
722
|
-
@lex_state = :expr_beg
|
723
|
-
return '=>', '=>'
|
724
|
-
|
725
|
-
elsif scanner.scan(/\=/)
|
726
|
-
@lex_state = :expr_beg
|
727
|
-
return '=', '='
|
728
|
-
|
729
|
-
elsif scanner.scan(/\!\=/)
|
730
|
-
if @lex_state == :expr_fname
|
731
|
-
@lex_state == :expr_end
|
732
|
-
return '!=', '!='
|
733
|
-
end
|
734
|
-
@lex_state = :expr_beg
|
735
|
-
return '!=', '!='
|
736
|
-
|
737
|
-
elsif scanner.scan(/\!\~/)
|
738
|
-
@lex_state = :expr_beg
|
739
|
-
return '!~', '!~'
|
740
|
-
|
741
|
-
elsif scanner.scan(/\!/)
|
742
|
-
if @lex_state == :expr_fname
|
743
|
-
@lex_state = :expr_end
|
744
|
-
return '!', '!'
|
745
|
-
end
|
746
|
-
@lex_state = :expr_beg
|
747
|
-
return '!', '!'
|
818
|
+
return '?', scanner.matched
|
748
819
|
|
749
820
|
elsif scanner.scan(/\~/)
|
750
821
|
if @lex_state == :expr_fname
|