Class: Opal::Parser

Inherits:
Racc::Parser
  • Object
show all
Defined in:
opal/lib/opal/parser.rb,
opal/lib/opal/parser/grammar.rb

Overview

Parser is used to parse a string of ruby code into a tree of Sexp to represent the given ruby source code. The Compiler used this tree of sexp expressions, and turns them into the resulting javascript code.

Usually, you would want to use Compiler directly, but this class can be useful for debugging the compiler, as well as building tools around the opal compiler to view the code structure.

Invalid ruby code will raise an exception.

Opal::Parser.new.parse "ruby code"
# => sexp tree

Constant Summary

Racc_arg =
[
racc_action_table,
racc_action_check,
racc_action_default,
racc_action_pointer,
racc_goto_table,
racc_goto_check,
racc_goto_default,
racc_goto_pointer,
racc_nt_base,
racc_reduce_table,
racc_token_table,
racc_shift_n,
racc_reduce_n,
racc_use_result_var ]
Racc_token_to_s_table =
[
"$end",
"error",
"kCLASS",
"kMODULE",
"kDEF",
"kUNDEF",
"kBEGIN",
"kRESCUE",
"kENSURE",
"kEND",
"kIF",
"kUNLESS",
"kTHEN",
"kELSIF",
"kELSE",
"kCASE",
"kWHEN",
"kWHILE",
"kUNTIL",
"kFOR",
"kBREAK",
"kNEXT",
"kREDO",
"kRETRY",
"kIN",
"kDO",
"kDO_COND",
"kDO_BLOCK",
"kDO_LAMBDA",
"kRETURN",
"kYIELD",
"kSUPER",
"kSELF",
"kNIL",
"kTRUE",
"kFALSE",
"kAND",
"kOR",
"kNOT",
"kIF_MOD",
"kUNLESS_MOD",
"kWHILE_MOD",
"kUNTIL_MOD",
"kRESCUE_MOD",
"kALIAS",
"kDEFINED",
"klBEGIN",
"klEND",
"k__LINE__",
"k__FILE__",
"tIDENTIFIER",
"tFID",
"tGVAR",
"tIVAR",
"tCONSTANT",
"tLABEL",
"tCVAR",
"tNTH_REF",
"tBACK_REF",
"tSTRING_CONTENT",
"tINTEGER",
"tFLOAT",
"tREGEXP_END",
"tUPLUS",
"tUMINUS",
"tPOW",
"tCMP",
"tEQ",
"tEQQ",
"tNEQ",
"tGEQ",
"tLEQ",
"tANDOP",
"tOROP",
"tMATCH",
"tNMATCH",
"tJSDOT",
"tDOT",
"tDOT2",
"tDOT3",
"tAREF",
"tASET",
"tLSHFT",
"tRSHFT",
"tCOLON2",
"tCOLON3",
"tOP_ASGN",
"tASSOC",
"tLPAREN",
"tLPAREN2",
"tRPAREN",
"tLPAREN_ARG",
"tRBRACK",
"tLBRACE",
"tLBRACE_ARG",
"tSTAR",
"tSTAR2",
"tAMPER",
"tAMPER2",
"tTILDE",
"tPERCENT",
"tDIVIDE",
"tPLUS",
"tMINUS",
"tLT",
"tGT",
"tPIPE",
"tBANG",
"tCARET",
"tLCURLY",
"tRCURLY",
"tBACK_REF2",
"tSYMBEG",
"tSTRING_BEG",
"tXSTRING_BEG",
"tREGEXP_BEG",
"tWORDS_BEG",
"tAWORDS_BEG",
"tSTRING_DBEG",
"tSTRING_DVAR",
"tSTRING_END",
"tSTRING",
"tSYMBOL",
"tNL",
"tEH",
"tCOLON",
"tCOMMA",
"tSPACE",
"tSEMI",
"tLAMBDA",
"tLAMBEG",
"tLBRACK2",
"tLBRACK",
"tJSLBRACK",
"tDSTAR",
"tLABEL_END",
"tEQL",
"tLOWEST",
"\"[email protected]\"",
"\"[email protected]\"",
"$start",
"program",
"top_compstmt",
"top_stmts",
"opt_terms",
"top_stmt",
"terms",
"stmt",
"bodystmt",
"compstmt",
"opt_rescue",
"opt_else",
"opt_ensure",
"stmts",
"fitem",
"undef_list",
"expr_value",
"command_asgn",
"mlhs",
"command_call",
"var_lhs",
"primary_value",
"aref_args",
"backref",
"lhs",
"mrhs",
"arg_value",
"expr",
"@1",
"arg",
"command",
"block_command",
"block_call",
"operation2",
"command_args",
"cmd_brace_block",
"opt_block_var",
"operation",
"call_args",
"mlhs_basic",
"mlhs_entry",
"mlhs_head",
"mlhs_item",
"mlhs_node",
"mlhs_post",
"variable",
"cname",
"cpath",
"fname",
"op",
"reswords",
"symbol",
"opt_nl",
"primary",
"@2",
"@3",
"none",
"args",
"trailer",
"assocs",
"block_arg",
"paren_args",
"opt_call_args",
"rparen",
"opt_paren_args",
"opt_block_arg",
"@4",
"literal",
"strings",
"xstring",
"regexp",
"words",
"awords",
"var_ref",
"assoc_list",
"brace_block",
"method_call",
"lambda",
"then",
"if_tail",
"do",
"case_body",
"for_var",
"superclass",
"term",
"f_arglist",
"singleton",
"dot_or_colon",
"@5",
"@6",
"@7",
"@8",
"@9",
"@10",
"@11",
"@12",
"@13",
"@14",
"@15",
"@16",
"@17",
"@18",
"@19",
"@20",
"@21",
"opt_bv_decl",
"bv_decls",
"bvar",
"f_bad_arg",
"f_larglist",
"lambda_body",
"block_param",
"f_block_optarg",
"f_block_opt",
"block_args_tail",
"f_block_kwarg",
"f_kwrest",
"opt_f_block_arg",
"f_block_arg",
"opt_block_args_tail",
"f_arg",
"f_rest_arg",
"do_block",
"@22",
"operation3",
"@23",
"@24",
"cases",
"@25",
"exc_list",
"exc_var",
"numeric",
"dsym",
"string",
"string1",
"string_contents",
"xstring_contents",
"word_list",
"word",
"string_content",
"qword_list",
"string_dvar",
"@26",
"@27",
"sym",
"f_args",
"kwrest_mark",
"f_label",
"f_kw",
"f_block_kw",
"f_kwarg",
"args_tail",
"opt_args_tail",
"f_optarg",
"f_norm_arg",
"f_arg_item",
"f_margs",
"f_marg",
"f_marg_list",
"f_opt",
"restarg_mark",
"blkarg_mark",
"assoc" ]
Racc_debug_parser =
false

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file


22
23
24
# File 'opal/lib/opal/parser.rb', line 22

def file
  @file
end

#lexerObject (readonly)

Returns the value of attribute lexer


22
23
24
# File 'opal/lib/opal/parser.rb', line 22

def lexer
  @lexer
end

#scopeObject (readonly)

Returns the value of attribute scope


22
23
24
# File 'opal/lib/opal/parser.rb', line 22

def scope
  @scope
end

Instance Method Details

#_reduce_10(val, _values, result) ⇒ Object


3316
3317
3318
3319
3320
# File 'opal/lib/opal/parser/grammar.rb', line 3316

def _reduce_10(val, _values, result)
                      result = new_block
                    
    result
end

#_reduce_100(val, _values, result) ⇒ Object


3766
3767
3768
3769
3770
# File 'opal/lib/opal/parser/grammar.rb', line 3766

def _reduce_100(val, _values, result)
                      result = new_attrasgn(val[0], op_to_setter(val[2]))
                    
    result
end

#_reduce_101(val, _values, result) ⇒ Object


3772
3773
3774
3775
3776
# File 'opal/lib/opal/parser/grammar.rb', line 3772

def _reduce_101(val, _values, result)
                      result = new_colon2(val[0], val[1], val[2])
                    
    result
end

#_reduce_102(val, _values, result) ⇒ Object


3778
3779
3780
3781
3782
# File 'opal/lib/opal/parser/grammar.rb', line 3778

def _reduce_102(val, _values, result)
                      result = new_colon3(val[0], val[1])
                    
    result
end

#_reduce_105(val, _values, result) ⇒ Object

reduce 104 omitted


3788
3789
3790
3791
3792
# File 'opal/lib/opal/parser/grammar.rb', line 3788

def _reduce_105(val, _values, result)
                      result = new_colon3(val[0], val[1])
                    
    result
end

#_reduce_106(val, _values, result) ⇒ Object


3794
3795
3796
3797
3798
# File 'opal/lib/opal/parser/grammar.rb', line 3794

def _reduce_106(val, _values, result)
                      result = new_const(val[0])
                    
    result
end

#_reduce_107(val, _values, result) ⇒ Object


3800
3801
3802
3803
3804
# File 'opal/lib/opal/parser/grammar.rb', line 3800

def _reduce_107(val, _values, result)
                      result = new_colon2(val[0], val[1], val[2])
                    
    result
end

#_reduce_11(val, _values, result) ⇒ Object


3322
3323
3324
3325
3326
# File 'opal/lib/opal/parser/grammar.rb', line 3322

def _reduce_11(val, _values, result)
                      result = new_block val[0]
                    
    result
end

#_reduce_111(val, _values, result) ⇒ Object

reduce 110 omitted


3812
3813
3814
3815
3816
3817
# File 'opal/lib/opal/parser/grammar.rb', line 3812

def _reduce_111(val, _values, result)
                      lexer.lex_state = :expr_end
                      result = val[0]
                    
    result
end

#_reduce_112(val, _values, result) ⇒ Object


3819
3820
3821
3822
3823
3824
# File 'opal/lib/opal/parser/grammar.rb', line 3819

def _reduce_112(val, _values, result)
                      lexer.lex_state = :expr_end
                      result = val[0]
                    
    result
end

#_reduce_113(val, _values, result) ⇒ Object


3826
3827
3828
3829
3830
# File 'opal/lib/opal/parser/grammar.rb', line 3826

def _reduce_113(val, _values, result)
                      result = new_sym(val[0])
                    
    result
end

#_reduce_115(val, _values, result) ⇒ Object

reduce 114 omitted


3834
3835
3836
3837
3838
# File 'opal/lib/opal/parser/grammar.rb', line 3834

def _reduce_115(val, _values, result)
                      result = s(:undef, val[0])
                    
    result
end

#_reduce_116(val, _values, result) ⇒ Object


3840
3841
3842
3843
3844
# File 'opal/lib/opal/parser/grammar.rb', line 3840

def _reduce_116(val, _values, result)
                      result = val[0] << val[2]
                    
    result
end

#_reduce_12(val, _values, result) ⇒ Object


3328
3329
3330
3331
3332
3333
# File 'opal/lib/opal/parser/grammar.rb', line 3328

def _reduce_12(val, _values, result)
                      val[0] << val[2]
                      result = val[0]
                    
    result
end

#_reduce_13(val, _values, result) ⇒ Object


3335
3336
3337
3338
3339
# File 'opal/lib/opal/parser/grammar.rb', line 3335

def _reduce_13(val, _values, result)
                      lexer.lex_state = :expr_fname
                    
    result
end

#_reduce_14(val, _values, result) ⇒ Object


3341
3342
3343
3344
3345
# File 'opal/lib/opal/parser/grammar.rb', line 3341

def _reduce_14(val, _values, result)
                      result = new_alias(val[0], val[1], val[3])
                    
    result
end

#_reduce_15(val, _values, result) ⇒ Object


3347
3348
3349
3350
3351
# File 'opal/lib/opal/parser/grammar.rb', line 3347

def _reduce_15(val, _values, result)
                      result = s(:valias, value(val[1]).to_sym, value(val[2]).to_sym)
                    
    result
end

#_reduce_17(val, _values, result) ⇒ Object

reduce 16 omitted


3355
3356
3357
3358
3359
# File 'opal/lib/opal/parser/grammar.rb', line 3355

def _reduce_17(val, _values, result)
                      result = s(:valias, value(val[1]).to_sym, value(val[2]).to_sym)
                    
    result
end

#_reduce_18(val, _values, result) ⇒ Object


3361
3362
3363
3364
3365
# File 'opal/lib/opal/parser/grammar.rb', line 3361

def _reduce_18(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_19(val, _values, result) ⇒ Object


3367
3368
3369
3370
3371
# File 'opal/lib/opal/parser/grammar.rb', line 3367

def _reduce_19(val, _values, result)
                      result = new_if(val[1], val[2], val[0], nil)
                    
    result
end

#_reduce_191(val, _values, result) ⇒ Object

reduce 190 omitted


3994
3995
3996
3997
3998
# File 'opal/lib/opal/parser/grammar.rb', line 3994

def _reduce_191(val, _values, result)
                      result = new_assign(val[0], val[1], val[2])
                    
    result
end

#_reduce_192(val, _values, result) ⇒ Object


4000
4001
4002
4003
4004
# File 'opal/lib/opal/parser/grammar.rb', line 4000

def _reduce_192(val, _values, result)
                      result = new_assign val[0], val[1], s(:rescue_mod, val[2], val[4])
                    
    result
end

#_reduce_193(val, _values, result) ⇒ Object


4006
4007
4008
4009
4010
# File 'opal/lib/opal/parser/grammar.rb', line 4006

def _reduce_193(val, _values, result)
                      result = new_op_asgn val[1], val[0], val[2]
                    
    result
end

#_reduce_194(val, _values, result) ⇒ Object


4012
4013
4014
4015
4016
# File 'opal/lib/opal/parser/grammar.rb', line 4012

def _reduce_194(val, _values, result)
                      result = new_op_asgn1(val[0], val[2], val[4], val[5])
                    
    result
end

#_reduce_195(val, _values, result) ⇒ Object


4018
4019
4020
4021
4022
# File 'opal/lib/opal/parser/grammar.rb', line 4018

def _reduce_195(val, _values, result)
                      raise ".JS[...] #{val[4]} is not supported"
                    
    result
end

#_reduce_196(val, _values, result) ⇒ Object


4024
4025
4026
4027
4028
# File 'opal/lib/opal/parser/grammar.rb', line 4024

def _reduce_196(val, _values, result)
                      result = s(:op_asgn2, val[0], op_to_setter(val[2]), value(val[3]).to_sym, val[4])
                    
    result
end

#_reduce_2(val, _values, result) ⇒ Object

reduce 1 omitted


3271
3272
3273
3274
3275
# File 'opal/lib/opal/parser/grammar.rb', line 3271

def _reduce_2(val, _values, result)
                      result = new_compstmt val[0]
                    
    result
end

#_reduce_20(val, _values, result) ⇒ Object


3373
3374
3375
3376
3377
# File 'opal/lib/opal/parser/grammar.rb', line 3373

def _reduce_20(val, _values, result)
                      result = new_if(val[1], val[2], nil, val[0])
                    
    result
end

#_reduce_202(val, _values, result) ⇒ Object

reduce 201 omitted


4040
4041
4042
4043
4044
# File 'opal/lib/opal/parser/grammar.rb', line 4040

def _reduce_202(val, _values, result)
                      result = new_irange(val[0], val[1], val[2])
                    
    result
end

#_reduce_203(val, _values, result) ⇒ Object


4046
4047
4048
4049
4050
# File 'opal/lib/opal/parser/grammar.rb', line 4046

def _reduce_203(val, _values, result)
                      result = new_erange(val[0], val[1], val[2])
                    
    result
end

#_reduce_204(val, _values, result) ⇒ Object


4052
4053
4054
4055
4056
# File 'opal/lib/opal/parser/grammar.rb', line 4052

def _reduce_204(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_205(val, _values, result) ⇒ Object


4058
4059
4060
4061
4062
# File 'opal/lib/opal/parser/grammar.rb', line 4058

def _reduce_205(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_206(val, _values, result) ⇒ Object


4064
4065
4066
4067
4068
# File 'opal/lib/opal/parser/grammar.rb', line 4064

def _reduce_206(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_207(val, _values, result) ⇒ Object


4070
4071
4072
4073
4074
# File 'opal/lib/opal/parser/grammar.rb', line 4070

def _reduce_207(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_208(val, _values, result) ⇒ Object


4076
4077
4078
4079
4080
# File 'opal/lib/opal/parser/grammar.rb', line 4076

def _reduce_208(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_209(val, _values, result) ⇒ Object


4082
4083
4084
4085
4086
# File 'opal/lib/opal/parser/grammar.rb', line 4082

def _reduce_209(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_21(val, _values, result) ⇒ Object


3379
3380
3381
3382
3383
# File 'opal/lib/opal/parser/grammar.rb', line 3379

def _reduce_21(val, _values, result)
                      result = new_while(val[1], val[2], val[0])
                    
    result
end

#_reduce_210(val, _values, result) ⇒ Object


4088
4089
4090
4091
4092
# File 'opal/lib/opal/parser/grammar.rb', line 4088

def _reduce_210(val, _values, result)
                      result = new_call new_binary_call(new_int(val[1]), val[2], val[3]), [:[email protected]", []], []
                    
    result
end

#_reduce_211(val, _values, result) ⇒ Object


4094
4095
4096
4097
4098
# File 'opal/lib/opal/parser/grammar.rb', line 4094

def _reduce_211(val, _values, result)
                      result = new_call new_binary_call(new_float(val[1]), val[2], val[3]), [:[email protected]", []], []
                    
    result
end

#_reduce_212(val, _values, result) ⇒ Object


4100
4101
4102
4103
4104
4105
4106
4107
# File 'opal/lib/opal/parser/grammar.rb', line 4100

def _reduce_212(val, _values, result)
                      result = new_call val[1], [:[email protected]", []], []
                      if [:int, :float].include? val[1].type
                        result = val[1]
                      end
                    
    result
end

#_reduce_213(val, _values, result) ⇒ Object


4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
# File 'opal/lib/opal/parser/grammar.rb', line 4109

def _reduce_213(val, _values, result)
                      result = new_call val[1], [:[email protected]", []], []
                      if val[1].type == :int
                        val[1][1] = -val[1][1]
                        result = val[1]
                      elsif val[1].type == :float
                        val[1][1] = -val[1][1].to_f
                        result = val[1]
                      end
                    
    result
end

#_reduce_214(val, _values, result) ⇒ Object


4122
4123
4124
4125
4126
# File 'opal/lib/opal/parser/grammar.rb', line 4122

def _reduce_214(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_215(val, _values, result) ⇒ Object


4128
4129
4130
4131
4132
# File 'opal/lib/opal/parser/grammar.rb', line 4128

def _reduce_215(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_216(val, _values, result) ⇒ Object


4134
4135
4136
4137
4138
# File 'opal/lib/opal/parser/grammar.rb', line 4134

def _reduce_216(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_217(val, _values, result) ⇒ Object


4140
4141
4142
4143
4144
# File 'opal/lib/opal/parser/grammar.rb', line 4140

def _reduce_217(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_218(val, _values, result) ⇒ Object


4146
4147
4148
4149
4150
# File 'opal/lib/opal/parser/grammar.rb', line 4146

def _reduce_218(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_219(val, _values, result) ⇒ Object


4152
4153
4154
4155
4156
# File 'opal/lib/opal/parser/grammar.rb', line 4152

def _reduce_219(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_22(val, _values, result) ⇒ Object


3385
3386
3387
3388
3389
# File 'opal/lib/opal/parser/grammar.rb', line 3385

def _reduce_22(val, _values, result)
                      result = new_until(val[1], val[2], val[0])
                    
    result
end

#_reduce_220(val, _values, result) ⇒ Object


4158
4159
4160
4161
4162
# File 'opal/lib/opal/parser/grammar.rb', line 4158

def _reduce_220(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_221(val, _values, result) ⇒ Object


4164
4165
4166
4167
4168
# File 'opal/lib/opal/parser/grammar.rb', line 4164

def _reduce_221(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_222(val, _values, result) ⇒ Object


4170
4171
4172
4173
4174
# File 'opal/lib/opal/parser/grammar.rb', line 4170

def _reduce_222(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_223(val, _values, result) ⇒ Object


4176
4177
4178
4179
4180
# File 'opal/lib/opal/parser/grammar.rb', line 4176

def _reduce_223(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_224(val, _values, result) ⇒ Object


4182
4183
4184
4185
4186
# File 'opal/lib/opal/parser/grammar.rb', line 4182

def _reduce_224(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_225(val, _values, result) ⇒ Object


4188
4189
4190
4191
4192
# File 'opal/lib/opal/parser/grammar.rb', line 4188

def _reduce_225(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_226(val, _values, result) ⇒ Object


4194
4195
4196
4197
4198
# File 'opal/lib/opal/parser/grammar.rb', line 4194

def _reduce_226(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_227(val, _values, result) ⇒ Object


4200
4201
4202
4203
4204
# File 'opal/lib/opal/parser/grammar.rb', line 4200

def _reduce_227(val, _values, result)
                      result = new_unary_call(val[0], val[1])
                    
    result
end

#_reduce_228(val, _values, result) ⇒ Object


4206
4207
4208
4209
4210
# File 'opal/lib/opal/parser/grammar.rb', line 4206

def _reduce_228(val, _values, result)
                      result = new_unary_call(val[0], val[1])
                    
    result
end

#_reduce_229(val, _values, result) ⇒ Object


4212
4213
4214
4215
4216
# File 'opal/lib/opal/parser/grammar.rb', line 4212

def _reduce_229(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_23(val, _values, result) ⇒ Object


3391
3392
3393
3394
3395
# File 'opal/lib/opal/parser/grammar.rb', line 3391

def _reduce_23(val, _values, result)
                      result = new_rescue_mod(val[1], val[0], val[2])
                    
    result
end

#_reduce_230(val, _values, result) ⇒ Object


4218
4219
4220
4221
4222
# File 'opal/lib/opal/parser/grammar.rb', line 4218

def _reduce_230(val, _values, result)
                      result = new_binary_call(val[0], val[1], val[2])
                    
    result
end

#_reduce_231(val, _values, result) ⇒ Object


4224
4225
4226
4227
4228
# File 'opal/lib/opal/parser/grammar.rb', line 4224

def _reduce_231(val, _values, result)
                      result = new_and(val[0], val[1], val[2])
                    
    result
end

#_reduce_232(val, _values, result) ⇒ Object


4230
4231
4232
4233
4234
# File 'opal/lib/opal/parser/grammar.rb', line 4230

def _reduce_232(val, _values, result)
                      result = new_or(val[0], val[1], val[2])
                    
    result
end

#_reduce_233(val, _values, result) ⇒ Object


4236
4237
4238
4239
4240
# File 'opal/lib/opal/parser/grammar.rb', line 4236

def _reduce_233(val, _values, result)
                      result = s(:defined, val[2])
                    
    result
end

#_reduce_234(val, _values, result) ⇒ Object


4242
4243
4244
4245
# File 'opal/lib/opal/parser/grammar.rb', line 4242

def _reduce_234(val, _values, result)
 lexer.cond_push 1 
    result
end

#_reduce_235(val, _values, result) ⇒ Object


4247
4248
4249
4250
# File 'opal/lib/opal/parser/grammar.rb', line 4247

def _reduce_235(val, _values, result)
 lexer.cond_pop 
    result
end

#_reduce_236(val, _values, result) ⇒ Object


4252
4253
4254
4255
4256
# File 'opal/lib/opal/parser/grammar.rb', line 4252

def _reduce_236(val, _values, result)
                      result = new_if(val[1], val[0], val[3], val[6])
                    
    result
end

#_reduce_239(val, _values, result) ⇒ Object

reduce 238 omitted


4262
4263
4264
4265
4266
# File 'opal/lib/opal/parser/grammar.rb', line 4262

def _reduce_239(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_240(val, _values, result) ⇒ Object


4268
4269
4270
4271
4272
# File 'opal/lib/opal/parser/grammar.rb', line 4268

def _reduce_240(val, _values, result)
                      result = [val[0]]
                    
    result
end

#_reduce_241(val, _values, result) ⇒ Object


4274
4275
4276
4277
4278
# File 'opal/lib/opal/parser/grammar.rb', line 4274

def _reduce_241(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_242(val, _values, result) ⇒ Object


4280
4281
4282
4283
4284
4285
# File 'opal/lib/opal/parser/grammar.rb', line 4280

def _reduce_242(val, _values, result)
                      val[0] << s(:hash, *val[2])
                      result = val[0]
                    
    result
end

#_reduce_243(val, _values, result) ⇒ Object


4287
4288
4289
4290
4291
# File 'opal/lib/opal/parser/grammar.rb', line 4287

def _reduce_243(val, _values, result)
                      result = [s(:hash, *val[0])]
                    
    result
end

#_reduce_244(val, _values, result) ⇒ Object


4293
4294
4295
4296
4297
# File 'opal/lib/opal/parser/grammar.rb', line 4293

def _reduce_244(val, _values, result)
                      result = val[0] << val[2]
                    
    result
end

#_reduce_245(val, _values, result) ⇒ Object


4299
4300
4301
4302
4303
# File 'opal/lib/opal/parser/grammar.rb', line 4299

def _reduce_245(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_247(val, _values, result) ⇒ Object

reduce 246 omitted


4307
4308
4309
4310
4311
# File 'opal/lib/opal/parser/grammar.rb', line 4307

def _reduce_247(val, _values, result)
                      result = []
                    
    result
end

#_reduce_249(val, _values, result) ⇒ Object

reduce 248 omitted


4315
4316
4317
4318
4319
# File 'opal/lib/opal/parser/grammar.rb', line 4315

def _reduce_249(val, _values, result)
                      result = []
                    
    result
end

#_reduce_251(val, _values, result) ⇒ Object

reduce 250 omitted


4323
4324
4325
4326
4327
# File 'opal/lib/opal/parser/grammar.rb', line 4323

def _reduce_251(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_252(val, _values, result) ⇒ Object


4329
4330
4331
4332
4333
4334
# File 'opal/lib/opal/parser/grammar.rb', line 4329

def _reduce_252(val, _values, result)
                      result = val[0]
                      result << new_hash(nil, val[2], nil)
                    
    result
end

#_reduce_253(val, _values, result) ⇒ Object


4336
4337
4338
4339
4340
# File 'opal/lib/opal/parser/grammar.rb', line 4336

def _reduce_253(val, _values, result)
                      result = [new_hash(nil, val[0], nil)]
                    
    result
end

#_reduce_254(val, _values, result) ⇒ Object


4342
4343
4344
4345
4346
# File 'opal/lib/opal/parser/grammar.rb', line 4342

def _reduce_254(val, _values, result)
                      result = [val[0]]
                    
    result
end

#_reduce_255(val, _values, result) ⇒ Object


4348
4349
4350
4351
4352
4353
# File 'opal/lib/opal/parser/grammar.rb', line 4348

def _reduce_255(val, _values, result)
                      result = val[0]
                      add_block_pass val[0], val[1]
                    
    result
end

#_reduce_256(val, _values, result) ⇒ Object


4355
4356
4357
4358
4359
4360
# File 'opal/lib/opal/parser/grammar.rb', line 4355

def _reduce_256(val, _values, result)
                      result = [new_hash(nil, val[0], nil)]
                      add_block_pass result, val[1]
                    
    result
end

#_reduce_257(val, _values, result) ⇒ Object


4362
4363
4364
4365
4366
4367
4368
# File 'opal/lib/opal/parser/grammar.rb', line 4362

def _reduce_257(val, _values, result)
                      result = val[0]
                      result << new_hash(nil, val[2], nil)
                      result << val[3] if val[3]
                    
    result
end

#_reduce_258(val, _values, result) ⇒ Object


4370
4371
4372
4373
4374
4375
# File 'opal/lib/opal/parser/grammar.rb', line 4370

def _reduce_258(val, _values, result)
                      result = []
                      add_block_pass result, val[0]
                    
    result
end

#_reduce_259(val, _values, result) ⇒ Object


4377
4378
4379
4380
4381
# File 'opal/lib/opal/parser/grammar.rb', line 4377

def _reduce_259(val, _values, result)
                      lexer.cmdarg_push 1
                    
    result
end

#_reduce_26(val, _values, result) ⇒ Object

reduce 25 omitted


3401
3402
3403
3404
3405
# File 'opal/lib/opal/parser/grammar.rb', line 3401

def _reduce_26(val, _values, result)
                      result = s(:masgn, val[0], s(:to_ary, val[2]))
                    
    result
end

#_reduce_260(val, _values, result) ⇒ Object


4383
4384
4385
4386
4387
4388
# File 'opal/lib/opal/parser/grammar.rb', line 4383

def _reduce_260(val, _values, result)
                      lexer.cmdarg_pop
                      result = val[1]
                    
    result
end

#_reduce_261(val, _values, result) ⇒ Object


4390
4391
4392
4393
4394
# File 'opal/lib/opal/parser/grammar.rb', line 4390

def _reduce_261(val, _values, result)
                      result = new_block_pass(val[0], val[1])
                    
    result
end

#_reduce_262(val, _values, result) ⇒ Object


4396
4397
4398
4399
4400
# File 'opal/lib/opal/parser/grammar.rb', line 4396

def _reduce_262(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_263(val, _values, result) ⇒ Object


4402
4403
4404
4405
4406
# File 'opal/lib/opal/parser/grammar.rb', line 4402

def _reduce_263(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_264(val, _values, result) ⇒ Object


4408
4409
4410
4411
4412
# File 'opal/lib/opal/parser/grammar.rb', line 4408

def _reduce_264(val, _values, result)
                      result = [val[0]]
                    
    result
end

#_reduce_265(val, _values, result) ⇒ Object


4414
4415
4416
4417
4418
# File 'opal/lib/opal/parser/grammar.rb', line 4414

def _reduce_265(val, _values, result)
                      result = [new_splat(val[0], val[1])]
                    
    result
end

#_reduce_266(val, _values, result) ⇒ Object


4420
4421
4422
4423
4424
# File 'opal/lib/opal/parser/grammar.rb', line 4420

def _reduce_266(val, _values, result)
                      result = val[0] << val[2]
                    
    result
end

#_reduce_267(val, _values, result) ⇒ Object


4426
4427
4428
4429
4430
# File 'opal/lib/opal/parser/grammar.rb', line 4426

def _reduce_267(val, _values, result)
                      result  = val[0] << new_splat(val[2], val[3])
                    
    result
end

#_reduce_268(val, _values, result) ⇒ Object


4432
4433
4434
4435
4436
4437
# File 'opal/lib/opal/parser/grammar.rb', line 4432

def _reduce_268(val, _values, result)
                      val[0] << val[2]
                      result = s(:array, *val[0])
                    
    result
end

#_reduce_269(val, _values, result) ⇒ Object


4439
4440
4441
4442
4443
4444
# File 'opal/lib/opal/parser/grammar.rb', line 4439

def _reduce_269(val, _values, result)
                      val[0] << s(:splat, val[3])
                      result = s(:array, *val[0])
                    
    result
end

#_reduce_27(val, _values, result) ⇒ Object


3407
3408
3409
3410
3411
# File 'opal/lib/opal/parser/grammar.rb', line 3407

def _reduce_27(val, _values, result)
                      result = new_op_asgn val[1], val[0], val[2]
                    
    result
end

#_reduce_270(val, _values, result) ⇒ Object


4446
4447
4448
4449
4450
# File 'opal/lib/opal/parser/grammar.rb', line 4446

def _reduce_270(val, _values, result)
                      result = s(:splat, val[1])
                    
    result
end

#_reduce_280(val, _values, result) ⇒ Object

reduce 279 omitted


4470
4471
4472
4473
4474
# File 'opal/lib/opal/parser/grammar.rb', line 4470

def _reduce_280(val, _values, result)
                      result = lexer.line
                    
    result
end

#_reduce_281(val, _values, result) ⇒ Object


4476
4477
4478
4479
4480
# File 'opal/lib/opal/parser/grammar.rb', line 4476

def _reduce_281(val, _values, result)
                      result = s(:begin, val[2])
                    
    result
end

#_reduce_282(val, _values, result) ⇒ Object


4482
4483
4484
4485
4486
# File 'opal/lib/opal/parser/grammar.rb', line 4482

def _reduce_282(val, _values, result)
                      lexer.lex_state = :expr_endarg
                    
    result
end

#_reduce_283(val, _values, result) ⇒ Object


4488
4489
4490
4491
4492
# File 'opal/lib/opal/parser/grammar.rb', line 4488

def _reduce_283(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_284(val, _values, result) ⇒ Object


4494
4495
4496
4497
4498
# File 'opal/lib/opal/parser/grammar.rb', line 4494

def _reduce_284(val, _values, result)
                      lexer.lex_state = :expr_endarg
                    
    result
end

#_reduce_285(val, _values, result) ⇒ Object


4500
4501
4502
4503
4504
# File 'opal/lib/opal/parser/grammar.rb', line 4500

def _reduce_285(val, _values, result)
                      result = new_nil(val[0])
                    
    result
end

#_reduce_286(val, _values, result) ⇒ Object


4506
4507
4508
4509
4510
# File 'opal/lib/opal/parser/grammar.rb', line 4506

def _reduce_286(val, _values, result)
                      result = new_paren(val[0], val[1], val[2])
                    
    result
end

#_reduce_287(val, _values, result) ⇒ Object


4512
4513
4514
4515
4516
# File 'opal/lib/opal/parser/grammar.rb', line 4512

def _reduce_287(val, _values, result)
                      result = new_colon2(val[0], val[1], val[2])
                    
    result
end

#_reduce_288(val, _values, result) ⇒ Object


4518
4519
4520
4521
4522
# File 'opal/lib/opal/parser/grammar.rb', line 4518

def _reduce_288(val, _values, result)
                      result = new_colon3(val[0], val[1])
                    
    result
end

#_reduce_289(val, _values, result) ⇒ Object


4524
4525
4526
4527
4528
# File 'opal/lib/opal/parser/grammar.rb', line 4524

def _reduce_289(val, _values, result)
                      result = new_call val[0], [:[], []], val[2]
                    
    result
end

#_reduce_290(val, _values, result) ⇒ Object


4530
4531
4532
4533
4534
# File 'opal/lib/opal/parser/grammar.rb', line 4530

def _reduce_290(val, _values, result)
                      result = new_js_call val[0], [:[], []], val[2]
                    
    result
end

#_reduce_291(val, _values, result) ⇒ Object


4536
4537
4538
4539
4540
# File 'opal/lib/opal/parser/grammar.rb', line 4536

def _reduce_291(val, _values, result)
                      result = new_array(val[0], val[1], val[2])
                    
    result
end

#_reduce_292(val, _values, result) ⇒ Object


4542
4543
4544
4545
4546
# File 'opal/lib/opal/parser/grammar.rb', line 4542

def _reduce_292(val, _values, result)
                      result = new_hash(val[0], val[1], val[2])
                    
    result
end

#_reduce_293(val, _values, result) ⇒ Object


4548
4549
4550
4551
4552
# File 'opal/lib/opal/parser/grammar.rb', line 4548

def _reduce_293(val, _values, result)
                      result = new_return(val[0])
                    
    result
end

#_reduce_294(val, _values, result) ⇒ Object


4554
4555
4556
4557
4558
# File 'opal/lib/opal/parser/grammar.rb', line 4554

def _reduce_294(val, _values, result)
                      result = new_yield val[2]
                    
    result
end

#_reduce_295(val, _values, result) ⇒ Object


4560
4561
4562
4563
4564
# File 'opal/lib/opal/parser/grammar.rb', line 4560

def _reduce_295(val, _values, result)
                      result = s(:yield)
                    
    result
end

#_reduce_296(val, _values, result) ⇒ Object


4566
4567
4568
4569
4570
# File 'opal/lib/opal/parser/grammar.rb', line 4566

def _reduce_296(val, _values, result)
                      result = s(:yield)
                    
    result
end

#_reduce_297(val, _values, result) ⇒ Object


4572
4573
4574
4575
4576
# File 'opal/lib/opal/parser/grammar.rb', line 4572

def _reduce_297(val, _values, result)
                      result = s(:defined, val[3])
                    
    result
end

#_reduce_298(val, _values, result) ⇒ Object


4578
4579
4580
4581
4582
# File 'opal/lib/opal/parser/grammar.rb', line 4578

def _reduce_298(val, _values, result)
                      result = new_unary_call(['!', []], val[2])
                    
    result
end

#_reduce_299(val, _values, result) ⇒ Object


4584
4585
4586
4587
4588
# File 'opal/lib/opal/parser/grammar.rb', line 4584

def _reduce_299(val, _values, result)
                      result = new_unary_call(['!', []], new_nil(val[0]))
                    
    result
end

#_reduce_3(val, _values, result) ⇒ Object


3277
3278
3279
3280
3281
# File 'opal/lib/opal/parser/grammar.rb', line 3277

def _reduce_3(val, _values, result)
                      result = new_block
                    
    result
end

#_reduce_30(val, _values, result) ⇒ Object

reduce 29 omitted


3417
3418
3419
3420
3421
# File 'opal/lib/opal/parser/grammar.rb', line 3417

def _reduce_30(val, _values, result)
                      result = s(:op_asgn2, val[0], op_to_setter(val[2]), value(val[3]).to_sym, val[4])
                    
    result
end

#_reduce_300(val, _values, result) ⇒ Object


4590
4591
4592
4593
4594
4595
# File 'opal/lib/opal/parser/grammar.rb', line 4590

def _reduce_300(val, _values, result)
                      result = new_call(nil, val[0], [])
                      result << val[1]
                    
    result
end

#_reduce_302(val, _values, result) ⇒ Object

reduce 301 omitted


4599
4600
4601
4602
4603
# File 'opal/lib/opal/parser/grammar.rb', line 4599

def _reduce_302(val, _values, result)
                      result = new_method_call_with_block(val[0], val[1])
                    
    result
end

#_reduce_303(val, _values, result) ⇒ Object


4605
4606
4607
4608
4609
# File 'opal/lib/opal/parser/grammar.rb', line 4605

def _reduce_303(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_304(val, _values, result) ⇒ Object


4611
4612
4613
4614
4615
# File 'opal/lib/opal/parser/grammar.rb', line 4611

def _reduce_304(val, _values, result)
                      result = new_if(val[0], val[1], val[3], val[4])
                    
    result
end

#_reduce_305(val, _values, result) ⇒ Object


4617
4618
4619
4620
4621
# File 'opal/lib/opal/parser/grammar.rb', line 4617

def _reduce_305(val, _values, result)
                      result = new_if(val[0], val[1], val[4], val[3])
                    
    result
end

#_reduce_306(val, _values, result) ⇒ Object


4623
4624
4625
4626
4627
4628
# File 'opal/lib/opal/parser/grammar.rb', line 4623

def _reduce_306(val, _values, result)
                      lexer.cond_push 1
                      result = lexer.line
                    
    result
end

#_reduce_307(val, _values, result) ⇒ Object


4630
4631
4632
4633
4634
# File 'opal/lib/opal/parser/grammar.rb', line 4630

def _reduce_307(val, _values, result)
                      lexer.cond_pop
                    
    result
end

#_reduce_308(val, _values, result) ⇒ Object


4636
4637
4638
4639
4640
# File 'opal/lib/opal/parser/grammar.rb', line 4636

def _reduce_308(val, _values, result)
                      result = s(:while, val[2], val[5])
                    
    result
end

#_reduce_309(val, _values, result) ⇒ Object


4642
4643
4644
4645
4646
4647
# File 'opal/lib/opal/parser/grammar.rb', line 4642

def _reduce_309(val, _values, result)
                      lexer.cond_push 1
                      result = lexer.line
                    
    result
end

#_reduce_310(val, _values, result) ⇒ Object


4649
4650
4651
4652
4653
# File 'opal/lib/opal/parser/grammar.rb', line 4649

def _reduce_310(val, _values, result)
                      lexer.cond_pop
                    
    result
end

#_reduce_311(val, _values, result) ⇒ Object


4655
4656
4657
4658
4659
# File 'opal/lib/opal/parser/grammar.rb', line 4655

def _reduce_311(val, _values, result)
                      result = s(:until, val[2], val[5])
                    
    result
end

#_reduce_312(val, _values, result) ⇒ Object


4661
4662
4663
4664
4665
# File 'opal/lib/opal/parser/grammar.rb', line 4661

def _reduce_312(val, _values, result)
                      result = s(:case, val[1], *val[3])
                    
    result
end

#_reduce_313(val, _values, result) ⇒ Object


4667
4668
4669
4670
4671
# File 'opal/lib/opal/parser/grammar.rb', line 4667

def _reduce_313(val, _values, result)
                      result = s(:case, nil, *val[2])
                    
    result
end

#_reduce_314(val, _values, result) ⇒ Object


4673
4674
4675
4676
4677
# File 'opal/lib/opal/parser/grammar.rb', line 4673

def _reduce_314(val, _values, result)
                      result = s(:case, nil, val[3])
                    
    result
end

#_reduce_315(val, _values, result) ⇒ Object


4679
4680
4681
4682
4683
4684
# File 'opal/lib/opal/parser/grammar.rb', line 4679

def _reduce_315(val, _values, result)
                      lexer.cond_push 1
                      result = lexer.line
                    
    result
end

#_reduce_316(val, _values, result) ⇒ Object


4686
4687
4688
4689
4690
# File 'opal/lib/opal/parser/grammar.rb', line 4686

def _reduce_316(val, _values, result)
                      lexer.cond_pop
                    
    result
end

#_reduce_317(val, _values, result) ⇒ Object


4692
4693
4694
4695
4696
# File 'opal/lib/opal/parser/grammar.rb', line 4692

def _reduce_317(val, _values, result)
                      result = s(:for, val[4], val[1], val[7])
                    
    result
end

#_reduce_318(val, _values, result) ⇒ Object


4698
4699
4700
4701
4702
# File 'opal/lib/opal/parser/grammar.rb', line 4698

def _reduce_318(val, _values, result)
                      # ...
                    
    result
end

#_reduce_319(val, _values, result) ⇒ Object


4704
4705
4706
4707
4708
# File 'opal/lib/opal/parser/grammar.rb', line 4704

def _reduce_319(val, _values, result)
                      result = new_class val[0], val[1], val[2], val[4], val[5]
                    
    result
end

#_reduce_320(val, _values, result) ⇒ Object


4710
4711
4712
4713
4714
# File 'opal/lib/opal/parser/grammar.rb', line 4710

def _reduce_320(val, _values, result)
                      result = lexer.line
                    
    result
end

#_reduce_321(val, _values, result) ⇒ Object


4716
4717
4718
4719
4720
# File 'opal/lib/opal/parser/grammar.rb', line 4716

def _reduce_321(val, _values, result)
                      # ...
                    
    result
end

#_reduce_322(val, _values, result) ⇒ Object


4722
4723
4724
4725
4726
# File 'opal/lib/opal/parser/grammar.rb', line 4722

def _reduce_322(val, _values, result)
                      result = new_sclass(val[0], val[3], val[6], val[7])
                    
    result
end

#_reduce_323(val, _values, result) ⇒ Object


4728
4729
4730
4731
4732
# File 'opal/lib/opal/parser/grammar.rb', line 4728

def _reduce_323(val, _values, result)
                      result = lexer.line
                    
    result
end

#_reduce_324(val, _values, result) ⇒ Object


4734
4735
4736
4737
4738
# File 'opal/lib/opal/parser/grammar.rb', line 4734

def _reduce_324(val, _values, result)
                      # ...
                    
    result
end

#_reduce_325(val, _values, result) ⇒ Object


4740
4741
4742
4743
4744
# File 'opal/lib/opal/parser/grammar.rb', line 4740

def _reduce_325(val, _values, result)
                      result = new_module(val[0], val[2], val[4], val[5])
                    
    result
end

#_reduce_326(val, _values, result) ⇒ Object


4746
4747
4748
4749
4750
# File 'opal/lib/opal/parser/grammar.rb', line 4746

def _reduce_326(val, _values, result)
                      push_scope
                    
    result
end

#_reduce_327(val, _values, result) ⇒ Object


4752
4753
4754
4755
4756
4757
# File 'opal/lib/opal/parser/grammar.rb', line 4752

def _reduce_327(val, _values, result)
                      result = new_def(val[0], nil, val[1], val[3], val[4], val[5])
                      pop_scope
                    
    result
end

#_reduce_328(val, _values, result) ⇒ Object


4759
4760
4761
4762
4763
# File 'opal/lib/opal/parser/grammar.rb', line 4759

def _reduce_328(val, _values, result)
                       lexer.lex_state = :expr_fname
                    
    result
end

#_reduce_329(val, _values, result) ⇒ Object


4765
4766
4767
4768
4769
4770
# File 'opal/lib/opal/parser/grammar.rb', line 4765

def _reduce_329(val, _values, result)
                      push_scope
                      lexer.lex_state = :expr_endfn
                    
    result
end

#_reduce_330(val, _values, result) ⇒ Object


4772
4773
4774
4775
4776
4777
# File 'opal/lib/opal/parser/grammar.rb', line 4772

def _reduce_330(val, _values, result)
                      result = new_def(val[0], val[1], val[4], val[6], val[7], val[8])
                      pop_scope
                    
    result
end

#_reduce_331(val, _values, result) ⇒ Object


4779
4780
4781
4782
4783
# File 'opal/lib/opal/parser/grammar.rb', line 4779

def _reduce_331(val, _values, result)
                      result = new_break(val[0])
                    
    result
end

#_reduce_332(val, _values, result) ⇒ Object


4785
4786
4787
4788
4789
# File 'opal/lib/opal/parser/grammar.rb', line 4785

def _reduce_332(val, _values, result)
                      result = s(:next)
                    
    result
end

#_reduce_333(val, _values, result) ⇒ Object


4791
4792
4793
4794
4795
# File 'opal/lib/opal/parser/grammar.rb', line 4791

def _reduce_333(val, _values, result)
                      result = s(:redo)
                    
    result
end

#_reduce_34(val, _values, result) ⇒ Object

reduce 33 omitted


3429
3430
3431
3432
3433
# File 'opal/lib/opal/parser/grammar.rb', line 3429

def _reduce_34(val, _values, result)
                      result = new_assign val[0], val[1], s(:svalue, val[2])
                    
    result
end

#_reduce_343(val, _values, result) ⇒ Object

reduce 342 omitted


4815
4816
4817
4818
4819
# File 'opal/lib/opal/parser/grammar.rb', line 4815

def _reduce_343(val, _values, result)
                      result = []
                    
    result
end

#_reduce_344(val, _values, result) ⇒ Object


4821
4822
4823
4824
4825
# File 'opal/lib/opal/parser/grammar.rb', line 4821

def _reduce_344(val, _values, result)
                      result = val[2]
                    
    result
end

#_reduce_345(val, _values, result) ⇒ Object


4827
4828
4829
4830
4831
# File 'opal/lib/opal/parser/grammar.rb', line 4827

def _reduce_345(val, _values, result)
                      result = [ val[0] ]
                    
    result
end

#_reduce_346(val, _values, result) ⇒ Object


4833
4834
4835
4836
4837
# File 'opal/lib/opal/parser/grammar.rb', line 4833

def _reduce_346(val, _values, result)
                      result = val[0] << val[2]
                    
    result
end

#_reduce_347(val, _values, result) ⇒ Object


4839
4840
4841
4842
4843
# File 'opal/lib/opal/parser/grammar.rb', line 4839

def _reduce_347(val, _values, result)
                      result = new_shadowarg(val[0])
                    
    result
end

#_reduce_349(val, _values, result) ⇒ Object

reduce 348 omitted


4847
4848
4849
4850
4851
4852
# File 'opal/lib/opal/parser/grammar.rb', line 4847

def _reduce_349(val, _values, result)
                      result = new_call nil, [:lambda, []], []
                      result << new_iter(val[0], val[1])
                    
    result
end

#_reduce_35(val, _values, result) ⇒ Object


3435
3436
3437
3438
3439
# File 'opal/lib/opal/parser/grammar.rb', line 3435

def _reduce_35(val, _values, result)
                      result = s(:masgn, val[0], s(:to_ary, val[2]))
                    
    result
end

#_reduce_350(val, _values, result) ⇒ Object


4854
4855
4856
4857
4858
# File 'opal/lib/opal/parser/grammar.rb', line 4854

def _reduce_350(val, _values, result)
                      result = new_block_args(*val[1])
                    
    result
end

#_reduce_351(val, _values, result) ⇒ Object


4860
4861
4862
4863
4864
# File 'opal/lib/opal/parser/grammar.rb', line 4860

def _reduce_351(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_352(val, _values, result) ⇒ Object


4866
4867
4868
4869
4870
# File 'opal/lib/opal/parser/grammar.rb', line 4866

def _reduce_352(val, _values, result)
                      result = new_block_args(*val[0])
                    
    result
end

#_reduce_354(val, _values, result) ⇒ Object

reduce 353 omitted


4874
4875
4876
4877
4878
# File 'opal/lib/opal/parser/grammar.rb', line 4874

def _reduce_354(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_355(val, _values, result) ⇒ Object


4880
4881
4882
4883
4884
# File 'opal/lib/opal/parser/grammar.rb', line 4880

def _reduce_355(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_356(val, _values, result) ⇒ Object


4886
4887
4888
4889
4890
# File 'opal/lib/opal/parser/grammar.rb', line 4886

def _reduce_356(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_357(val, _values, result) ⇒ Object


4892
4893
4894
4895
4896
# File 'opal/lib/opal/parser/grammar.rb', line 4892

def _reduce_357(val, _values, result)
                      result = new_if(val[0], val[1], val[3], val[4])
                    
    result
end

#_reduce_359(val, _values, result) ⇒ Object

reduce 358 omitted


4900
4901
4902
4903
4904
# File 'opal/lib/opal/parser/grammar.rb', line 4900

def _reduce_359(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_36(val, _values, result) ⇒ Object


3441
3442
3443
3444
3445
# File 'opal/lib/opal/parser/grammar.rb', line 3441

def _reduce_36(val, _values, result)
                      result = s(:masgn, val[0], val[2])
                    
    result
end

#_reduce_360(val, _values, result) ⇒ Object


4906
4907
4908
4909
4910
# File 'opal/lib/opal/parser/grammar.rb', line 4906

def _reduce_360(val, _values, result)
                      result = s(:block, val[0])
                    
    result
end

#_reduce_361(val, _values, result) ⇒ Object


4912
4913
4914
4915
4916
4917
# File 'opal/lib/opal/parser/grammar.rb', line 4912

def _reduce_361(val, _values, result)
                      val[0] << val[2]
                      result = val[0]
                    
    result
end

#_reduce_362(val, _values, result) ⇒ Object


4919
4920
4921
4922
4923
4924
# File 'opal/lib/opal/parser/grammar.rb', line 4919

def _reduce_362(val, _values, result)
                      result = new_assign(new_assignable(new_ident(
                                  val[0])), val[1], val[2])
                    
    result
end

#_reduce_364(val, _values, result) ⇒ Object

reduce 363 omitted


4928
4929
4930
4931
4932
# File 'opal/lib/opal/parser/grammar.rb', line 4928

def _reduce_364(val, _values, result)
                      result = new_block_args(nil, [val[1]])
                    
    result
end

#_reduce_365(val, _values, result) ⇒ Object


4934
4935
4936
4937
4938
# File 'opal/lib/opal/parser/grammar.rb', line 4934

def _reduce_365(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_366(val, _values, result) ⇒ Object


4940
4941
4942
4943
4944
4945
# File 'opal/lib/opal/parser/grammar.rb', line 4940

def _reduce_366(val, _values, result)
                      val[1] << val[2]
                      result = new_block_args(*val[1])
                    
    result
end

#_reduce_367(val, _values, result) ⇒ Object


4947
4948
4949
4950
4951
# File 'opal/lib/opal/parser/grammar.rb', line 4947

def _reduce_367(val, _values, result)
                      result = [val[0], val[2], val[3]]
                    
    result
end

#_reduce_368(val, _values, result) ⇒ Object


4953
4954
4955
4956
4957
# File 'opal/lib/opal/parser/grammar.rb', line 4953

def _reduce_368(val, _values, result)
                      result = [val[0], nil, val[1]]
                    
    result
end

#_reduce_369(val, _values, result) ⇒ Object


4959
4960
4961
4962
4963
# File 'opal/lib/opal/parser/grammar.rb', line 4959

def _reduce_369(val, _values, result)
                      result = [nil, val[0], val[1]]
                    
    result
end

#_reduce_370(val, _values, result) ⇒ Object


4965
4966
4967
4968
4969
# File 'opal/lib/opal/parser/grammar.rb', line 4965

def _reduce_370(val, _values, result)
                      result = [nil, nil, val[0]]
                    
    result
end

#_reduce_371(val, _values, result) ⇒ Object


4971
4972
4973
4974
4975
# File 'opal/lib/opal/parser/grammar.rb', line 4971

def _reduce_371(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_372(val, _values, result) ⇒ Object


4977
4978
4979
4980
4981
# File 'opal/lib/opal/parser/grammar.rb', line 4977

def _reduce_372(val, _values, result)
                      nil
                    
    result
end

#_reduce_373(val, _values, result) ⇒ Object


4983
4984
4985
4986
4987
4988
4989
# File 'opal/lib/opal/parser/grammar.rb', line 4983

def _reduce_373(val, _values, result)
                      optarg = new_optarg(val[2])
                      restarg = new_restarg(val[4])
                      result = [val[0] + optarg + restarg, val[5]]
                    
    result
end

#_reduce_374(val, _values, result) ⇒ Object


4991
4992
4993
4994
4995
4996
4997
# File 'opal/lib/opal/parser/grammar.rb', line 4991

def _reduce_374(val, _values, result)
                      optarg = new_optarg(val[2])
                      restarg = new_restarg(val[4])
                      result = [val[0] + optarg + restarg + val[6], val[7]]
                    
    result
end

#_reduce_375(val, _values, result) ⇒ Object


4999
5000
5001
5002
5003
5004
# File 'opal/lib/opal/parser/grammar.rb', line 4999

def _reduce_375(val, _values, result)
                      optarg = new_optarg(val[2])
                      result = [val[0] + optarg, val[3]]
                    
    result
end

#_reduce_376(val, _values, result) ⇒ Object


5006
5007
5008
5009
5010
5011
# File 'opal/lib/opal/parser/grammar.rb', line 5006

def _reduce_376(val, _values, result)
                      optarg = new_optarg(val[2])
                      result = [val[0] + optarg + val[4], val[5]]
                    
    result
end

#_reduce_377(val, _values, result) ⇒ Object


5013
5014
5015
5016
5017
5018
# File 'opal/lib/opal/parser/grammar.rb', line 5013

def _reduce_377(val, _values, result)
                      restarg = new_restarg(val[2])
                      result = [val[0] + restarg, val[3]]
                    
    result
end

#_reduce_378(val, _values, result) ⇒ Object


5020
5021
5022
5023
5024
5025
# File 'opal/lib/opal/parser/grammar.rb', line 5020

def _reduce_378(val, _values, result)
                      val[0] << nil
                      result = [val[0], nil]
                    
    result
end

#_reduce_379(val, _values, result) ⇒ Object


5027
5028
5029
5030
5031
5032
# File 'opal/lib/opal/parser/grammar.rb', line 5027

def _reduce_379(val, _values, result)
                      restarg = new_restarg(val[2])
                      result = [val[0] + restarg + val[4], val[5]]
                    
    result
end

#_reduce_38(val, _values, result) ⇒ Object

reduce 37 omitted


3449
3450
3451
3452
3453
# File 'opal/lib/opal/parser/grammar.rb', line 3449

def _reduce_38(val, _values, result)
                      result = new_assign(val[0], val[1], val[2])
                    
    result
end

#_reduce_380(val, _values, result) ⇒ Object


5034
5035
5036
5037
5038
# File 'opal/lib/opal/parser/grammar.rb', line 5034

def _reduce_380(val, _values, result)
                      result = [val[0], val[1]]
                    
    result
end

#_reduce_381(val, _values, result) ⇒ Object


5040
5041
5042
5043
5044
5045
5046
# File 'opal/lib/opal/parser/grammar.rb', line 5040

def _reduce_381(val, _values, result)
                      optarg = new_optarg(val[0])
                      restarg = new_restarg(val[2])
                      result = [optarg + restarg, val[3]]
                    
    result
end

#_reduce_382(val, _values, result) ⇒ Object


5048
5049
5050
5051
5052
5053
5054
# File 'opal/lib/opal/parser/grammar.rb', line 5048

def _reduce_382(val, _values, result)
                      optarg = new_optarg(val[0])
                      restarg = new_restarg(val[2])
                      result = [optarg + restarg + val[4], val[5]]
                    
    result
end

#_reduce_383(val, _values, result) ⇒ Object


5056
5057
5058
5059
5060
5061
# File 'opal/lib/opal/parser/grammar.rb', line 5056

def _reduce_383(val, _values, result)
                      optarg= new_optarg(val[0])
                      result = [optarg, val[1]]
                    
    result
end

#_reduce_384(val, _values, result) ⇒ Object


5063
5064
5065
5066
5067
5068
# File 'opal/lib/opal/parser/grammar.rb', line 5063

def _reduce_384(val, _values, result)
                      optarg = new_optarg(val[0])
                      result = [optarg + val[2], val[3]]
                    
    result
end

#_reduce_385(val, _values, result) ⇒ Object


5070
5071
5072
5073
5074
5075
# File 'opal/lib/opal/parser/grammar.rb', line 5070

def _reduce_385(val, _values, result)
                      restarg = new_restarg(val[0])
                      result = [restarg, val[1]]
                    
    result
end

#_reduce_386(val, _values, result) ⇒ Object


5077
5078
5079
5080
5081
5082
# File 'opal/lib/opal/parser/grammar.rb', line 5077

def _reduce_386(val, _values, result)
                      restarg = new_restarg(val[0])
                      result = [restarg + val[2], val[3]]
                    
    result
end

#_reduce_387(val, _values, result) ⇒ Object


5084
5085
5086
5087
5088
# File 'opal/lib/opal/parser/grammar.rb', line 5084

def _reduce_387(val, _values, result)
                      result = [nil, val[0]]
                    
    result
end

#_reduce_388(val, _values, result) ⇒ Object


5090
5091
5092
5093
5094
5095
# File 'opal/lib/opal/parser/grammar.rb', line 5090

def _reduce_388(val, _values, result)
                      push_scope :block
                      result = lexer.line
                    
    result
end

#_reduce_389(val, _values, result) ⇒ Object


5097
5098
5099
5100
5101
5102
# File 'opal/lib/opal/parser/grammar.rb', line 5097

def _reduce_389(val, _values, result)
                      result = new_iter val[2], val[3]
                      pop_scope
                    
    result
end

#_reduce_39(val, _values, result) ⇒ Object


3455
3456
3457
3458
3459
# File 'opal/lib/opal/parser/grammar.rb', line 3455

def _reduce_39(val, _values, result)
                      result = new_assign(val[0], val[1], val[2])
                    
    result
end

#_reduce_390(val, _values, result) ⇒ Object


5104
5105
5106
5107
5108
5109
# File 'opal/lib/opal/parser/grammar.rb', line 5104

def _reduce_390(val, _values, result)
                      val[0] << val[1]
                      result = val[0]
                    
    result
end

#_reduce_394(val, _values, result) ⇒ Object

reduce 393 omitted


5117
5118
5119
5120
5121
# File 'opal/lib/opal/parser/grammar.rb', line 5117

def _reduce_394(val, _values, result)
                      result = new_call(nil, val[0], val[1])
                    
    result
end

#_reduce_395(val, _values, result) ⇒ Object


5123
5124
5125
5126
5127
# File 'opal/lib/opal/parser/grammar.rb', line 5123

def _reduce_395(val, _values, result)
                      result = new_call(val[0], val[2], val[3])
                    
    result
end

#_reduce_396(val, _values, result) ⇒ Object


5129
5130
5131
5132
5133
# File 'opal/lib/opal/parser/grammar.rb', line 5129

def _reduce_396(val, _values, result)
                      result = new_js_call(val[0], val[2], val[3])
                    
    result
end

#_reduce_397(val, _values, result) ⇒ Object


5135
5136
5137
5138
5139
# File 'opal/lib/opal/parser/grammar.rb', line 5135

def _reduce_397(val, _values, result)
                      result = new_call(val[0], [:call, []], val[2])
                    
    result
end

#_reduce_398(val, _values, result) ⇒ Object


5141
5142
5143
5144
5145
# File 'opal/lib/opal/parser/grammar.rb', line 5141

def _reduce_398(val, _values, result)
                      result = new_call(val[0], val[2], val[3])
                    
    result
end

#_reduce_399(val, _values, result) ⇒ Object


5147
5148
5149
5150
5151
# File 'opal/lib/opal/parser/grammar.rb', line 5147

def _reduce_399(val, _values, result)
                      result = new_call(val[0], val[2])
                    
    result
end

#_reduce_4(val, _values, result) ⇒ Object


3283
3284
3285
3286
3287
# File 'opal/lib/opal/parser/grammar.rb', line 3283

def _reduce_4(val, _values, result)
                      result = new_block val[0]
                    
    result
end

#_reduce_400(val, _values, result) ⇒ Object


5153
5154
5155
5156
5157
# File 'opal/lib/opal/parser/grammar.rb', line 5153

def _reduce_400(val, _values, result)
                      result = new_super(val[0], val[1])
                    
    result
end

#_reduce_401(val, _values, result) ⇒ Object


5159
5160
5161
5162
5163
# File 'opal/lib/opal/parser/grammar.rb', line 5159

def _reduce_401(val, _values, result)
                      result = new_super(val[0], nil)
                    
    result
end

#_reduce_402(val, _values, result) ⇒ Object


5165
5166
5167
5168
5169
5170
# File 'opal/lib/opal/parser/grammar.rb', line 5165

def _reduce_402(val, _values, result)
                      push_scope :block
                      result = lexer.line
                    
    result
end

#_reduce_403(val, _values, result) ⇒ Object


5172
5173
5174
5175
5176
5177
# File 'opal/lib/opal/parser/grammar.rb', line 5172

def _reduce_403(val, _values, result)
                      result = new_iter val[2], val[3]
                      pop_scope
                    
    result
end

#_reduce_404(val, _values, result) ⇒ Object


5179
5180
5181
5182
5183
5184
# File 'opal/lib/opal/parser/grammar.rb', line 5179

def _reduce_404(val, _values, result)
                      push_scope :block
                      result = lexer.line
                    
    result
end

#_reduce_405(val, _values, result) ⇒ Object


5186
5187
5188
5189
5190
5191
# File 'opal/lib/opal/parser/grammar.rb', line 5186

def _reduce_405(val, _values, result)
                      result = new_iter val[2], val[3]
                      pop_scope
                    
    result
end

#_reduce_406(val, _values, result) ⇒ Object


5193
5194
5195
5196
5197
# File 'opal/lib/opal/parser/grammar.rb', line 5193

def _reduce_406(val, _values, result)
                      result = lexer.line
                    
    result
end

#_reduce_407(val, _values, result) ⇒ Object


5199
5200
5201
5202
5203
5204
5205
# File 'opal/lib/opal/parser/grammar.rb', line 5199

def _reduce_407(val, _values, result)
                      part = s(:when, s(:array, *val[2]), val[4])
                      result = [part]
                      result.push(*val[5]) if val[5]
                    
    result
end

#_reduce_408(val, _values, result) ⇒ Object


5207
5208
5209
5210
5211
# File 'opal/lib/opal/parser/grammar.rb', line 5207

def _reduce_408(val, _values, result)
                      result = [val[0]]
                    
    result
end

#_reduce_41(val, _values, result) ⇒ Object

reduce 40 omitted


3463
3464
3465
3466
3467
# File 'opal/lib/opal/parser/grammar.rb', line 3463

def _reduce_41(val, _values, result)
                      result = s(:and, val[0], val[2])
                    
    result
end

#_reduce_410(val, _values, result) ⇒ Object

reduce 409 omitted


5215
5216
5217
5218
5219
5220
5221
5222
# File 'opal/lib/opal/parser/grammar.rb', line 5215

def _reduce_410(val, _values, result)
                      exc = val[1] || s(:array)
                      exc << new_assign(val[2], val[2], s(:gvar, '$!'.intern)) if val[2]
                      result = [s(:resbody, exc, val[4])]
                      result.concat val[5] if val[5]
                    
    result
end

#_reduce_411(val, _values, result) ⇒ Object


5224
5225
5226
5227
5228
# File 'opal/lib/opal/parser/grammar.rb', line 5224

def _reduce_411(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_412(val, _values, result) ⇒ Object


5230
5231
5232
5233
5234
# File 'opal/lib/opal/parser/grammar.rb', line 5230

def _reduce_412(val, _values, result)
                      result = s(:array, val[0])
                    
    result
end

#_reduce_415(val, _values, result) ⇒ Object

reduce 414 omitted


5240
5241
5242
5243
5244
# File 'opal/lib/opal/parser/grammar.rb', line 5240

def _reduce_415(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_416(val, _values, result) ⇒ Object


5246
5247
5248
5249
5250
# File 'opal/lib/opal/parser/grammar.rb', line 5246

def _reduce_416(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_417(val, _values, result) ⇒ Object


5252
5253
5254
5255
5256
# File 'opal/lib/opal/parser/grammar.rb', line 5252

def _reduce_417(val, _values, result)
                      result = val[1].nil? ? s(:nil) : val[1]
                    
    result
end

#_reduce_42(val, _values, result) ⇒ Object


3469
3470
3471
3472
3473
# File 'opal/lib/opal/parser/grammar.rb', line 3469

def _reduce_42(val, _values, result)
                      result = s(:or, val[0], val[2])
                    
    result
end

#_reduce_422(val, _values, result) ⇒ Object

reduce 421 omitted


5266
5267
5268
5269
5270
# File 'opal/lib/opal/parser/grammar.rb', line 5266

def _reduce_422(val, _values, result)
                      result = new_str val[0]
                    
    result
end

#_reduce_424(val, _values, result) ⇒ Object

reduce 423 omitted


5274
5275
5276
5277
5278
# File 'opal/lib/opal/parser/grammar.rb', line 5274

def _reduce_424(val, _values, result)
                    result = str_append val[0], val[1]
                  
    result
end

#_reduce_425(val, _values, result) ⇒ Object


5280
5281
5282
5283
5284
# File 'opal/lib/opal/parser/grammar.rb', line 5280

def _reduce_425(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_426(val, _values, result) ⇒ Object


5286
5287
5288
5289
5290
# File 'opal/lib/opal/parser/grammar.rb', line 5286

def _reduce_426(val, _values, result)
                      result = s(:str, value(val[0]))
                    
    result
end

#_reduce_427(val, _values, result) ⇒ Object


5292
5293
5294
5295
5296
# File 'opal/lib/opal/parser/grammar.rb', line 5292

def _reduce_427(val, _values, result)
                      result = new_xstr(val[0], val[1], val[2])
                    
    result
end

#_reduce_428(val, _values, result) ⇒ Object


5298
5299
5300
5301
5302
# File 'opal/lib/opal/parser/grammar.rb', line 5298

def _reduce_428(val, _values, result)
                      result = new_regexp val[1], val[2]
                    
    result
end

#_reduce_429(val, _values, result) ⇒ Object


5304
5305
5306
5307
5308
# File 'opal/lib/opal/parser/grammar.rb', line 5304

def _reduce_429(val, _values, result)
                      result = s(:array)
                    
    result
end

#_reduce_43(val, _values, result) ⇒ Object


3475
3476
3477
3478
3479
# File 'opal/lib/opal/parser/grammar.rb', line 3475

def _reduce_43(val, _values, result)
                      result = new_unary_call(['!', []], val[1])
                    
    result
end

#_reduce_430(val, _values, result) ⇒ Object


5310
5311
5312
5313
5314
# File 'opal/lib/opal/parser/grammar.rb', line 5310

def _reduce_430(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_431(val, _values, result) ⇒ Object


5316
5317
5318
5319
5320
# File 'opal/lib/opal/parser/grammar.rb', line 5316

def _reduce_431(val, _values, result)
                      result = s(:array)
                    
    result
end

#_reduce_432(val, _values, result) ⇒ Object


5322
5323
5324
5325
5326
5327
5328
# File 'opal/lib/opal/parser/grammar.rb', line 5322

def _reduce_432(val, _values, result)
                      part = val[1]
                      part = s(:dstr, "", val[1]) if part.type == :evstr
                      result = val[0] << part
                    
    result
end

#_reduce_433(val, _values, result) ⇒ Object


5330
5331
5332
5333
5334
# File 'opal/lib/opal/parser/grammar.rb', line 5330

def _reduce_433(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_434(val, _values, result) ⇒ Object


5336
5337
5338
5339
5340
# File 'opal/lib/opal/parser/grammar.rb', line 5336

def _reduce_434(val, _values, result)
                      result = val[0].concat([val[1]])
                    
    result
end

#_reduce_435(val, _values, result) ⇒ Object


5342
5343
5344
5345
5346
# File 'opal/lib/opal/parser/grammar.rb', line 5342

def _reduce_435(val, _values, result)
                      result = s(:array)
                    
    result
end

#_reduce_436(val, _values, result) ⇒ Object


5348
5349
5350
5351
5352
# File 'opal/lib/opal/parser/grammar.rb', line 5348

def _reduce_436(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_437(val, _values, result) ⇒ Object


5354
5355
5356
5357
5358
# File 'opal/lib/opal/parser/grammar.rb', line 5354

def _reduce_437(val, _values, result)
                      result = s(:array)
                    
    result
end

#_reduce_438(val, _values, result) ⇒ Object


5360
5361
5362
5363
5364
# File 'opal/lib/opal/parser/grammar.rb', line 5360

def _reduce_438(val, _values, result)
                      result = val[0] << s(:str, value(val[1]))
                    
    result
end

#_reduce_439(val, _values, result) ⇒ Object


5366
5367
5368
5369
5370
# File 'opal/lib/opal/parser/grammar.rb', line 5366

def _reduce_439(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_44(val, _values, result) ⇒ Object


3481
3482
3483
3484
3485
# File 'opal/lib/opal/parser/grammar.rb', line 3481

def _reduce_44(val, _values, result)
                      result = new_unary_call(val[0], val[1])
                    
    result
end

#_reduce_440(val, _values, result) ⇒ Object


5372
5373
5374
5375
5376
# File 'opal/lib/opal/parser/grammar.rb', line 5372

def _reduce_440(val, _values, result)
                      result = str_append val[0], val[1]
                    
    result
end

#_reduce_441(val, _values, result) ⇒ Object


5378
5379
5380
5381
5382
# File 'opal/lib/opal/parser/grammar.rb', line 5378

def _reduce_441(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_442(val, _values, result) ⇒ Object


5384
5385
5386
5387
5388
# File 'opal/lib/opal/parser/grammar.rb', line 5384

def _reduce_442(val, _values, result)
                      result = str_append val[0], val[1]
                    
    result
end

#_reduce_443(val, _values, result) ⇒ Object


5390
5391
5392
5393
5394
# File 'opal/lib/opal/parser/grammar.rb', line 5390

def _reduce_443(val, _values, result)
                      result = new_str_content(val[0])
                    
    result
end

#_reduce_444(val, _values, result) ⇒ Object


5396
5397
5398
5399
5400
5401
# File 'opal/lib/opal/parser/grammar.rb', line 5396

def _reduce_444(val, _values, result)
                      result = lexer.strterm
                      lexer.strterm = nil
                    
    result
end

#_reduce_445(val, _values, result) ⇒ Object


5403
5404
5405
5406
5407
5408
# File 'opal/lib/opal/parser/grammar.rb', line 5403

def _reduce_445(val, _values, result)
                      lexer.strterm = val[1]
                      result = new_evstr(val[2])
                    
    result
end

#_reduce_446(val, _values, result) ⇒ Object


5410
5411
5412
5413
5414
5415
5416
5417
5418
# File 'opal/lib/opal/parser/grammar.rb', line 5410

def _reduce_446(val, _values, result)
                      lexer.cond_push 0
                      lexer.cmdarg_push 0
                      result = lexer.strterm
                      lexer.strterm = nil
                      lexer.lex_state = :expr_beg
                    
    result
end

#_reduce_447(val, _values, result) ⇒ Object


5420
5421
5422
5423
5424
5425
5426
5427
# File 'opal/lib/opal/parser/grammar.rb', line 5420

def _reduce_447(val, _values, result)
                      lexer.strterm = val[1]
                      lexer.cond_lexpop
                      lexer.cmdarg_lexpop
                      result = new_evstr(val[2])
                    
    result
end

#_reduce_448(val, _values, result) ⇒ Object


5429
5430
5431
5432
5433
# File 'opal/lib/opal/parser/grammar.rb', line 5429

def _reduce_448(val, _values, result)
                      result = new_gvar(val[0])
                    
    result
end

#_reduce_449(val, _values, result) ⇒ Object


5435
5436
5437
5438
5439
# File 'opal/lib/opal/parser/grammar.rb', line 5435

def _reduce_449(val, _values, result)
                      result = new_ivar(val[0])
                    
    result
end

#_reduce_450(val, _values, result) ⇒ Object


5441
5442
5443
5444
5445
# File 'opal/lib/opal/parser/grammar.rb', line 5441

def _reduce_450(val, _values, result)
                      result = new_cvar(val[0])
                    
    result
end

#_reduce_452(val, _values, result) ⇒ Object

reduce 451 omitted


5449
5450
5451
5452
5453
5454
# File 'opal/lib/opal/parser/grammar.rb', line 5449

def _reduce_452(val, _values, result)
                      result = new_sym(val[1])
                      lexer.lex_state = :expr_end
                    
    result
end

#_reduce_453(val, _values, result) ⇒ Object


5456
5457
5458
5459
5460
# File 'opal/lib/opal/parser/grammar.rb', line 5456

def _reduce_453(val, _values, result)
                      result = new_sym(val[0])
                    
    result
end

#_reduce_458(val, _values, result) ⇒ Object

reduce 457 omitted


5470
5471
5472
5473
5474
# File 'opal/lib/opal/parser/grammar.rb', line 5470

def _reduce_458(val, _values, result)
                      result = new_dsym val[1]
                    
    result
end

#_reduce_459(val, _values, result) ⇒ Object


5476
5477
5478
5479
5480
# File 'opal/lib/opal/parser/grammar.rb', line 5476

def _reduce_459(val, _values, result)
                      result = new_int(val[0])
                    
    result
end

#_reduce_460(val, _values, result) ⇒ Object


5482
5483
5484
5485
5486
# File 'opal/lib/opal/parser/grammar.rb', line 5482

def _reduce_460(val, _values, result)
                      result = new_float(val[0])
                    
    result
end

#_reduce_461(val, _values, result) ⇒ Object


5488
5489
5490
5491
5492
# File 'opal/lib/opal/parser/grammar.rb', line 5488

def _reduce_461(val, _values, result)
                    result = negate_num(new_int(val[1]))
                  
    result
end

#_reduce_462(val, _values, result) ⇒ Object


5494
5495
5496
5497
5498
# File 'opal/lib/opal/parser/grammar.rb', line 5494

def _reduce_462(val, _values, result)
                    result = negate_num(new_float(val[1]))
                  
    result
end

#_reduce_463(val, _values, result) ⇒ Object


5500
5501
5502
5503
5504
# File 'opal/lib/opal/parser/grammar.rb', line 5500

def _reduce_463(val, _values, result)
                    result = new_int(val[1])
                  
    result
end

#_reduce_464(val, _values, result) ⇒ Object


5506
5507
5508
5509
5510
# File 'opal/lib/opal/parser/grammar.rb', line 5506

def _reduce_464(val, _values, result)
                    result = new_float(val[1])
                  
    result
end

#_reduce_465(val, _values, result) ⇒ Object


5512
5513
5514
5515
5516
# File 'opal/lib/opal/parser/grammar.rb', line 5512

def _reduce_465(val, _values, result)
                      result = new_ident(val[0])
                    
    result
end

#_reduce_466(val, _values, result) ⇒ Object


5518
5519
5520
5521
5522
# File 'opal/lib/opal/parser/grammar.rb', line 5518

def _reduce_466(val, _values, result)
                      result = new_ivar(val[0])
                    
    result
end

#_reduce_467(val, _values, result) ⇒ Object


5524
5525
5526
5527
5528
# File 'opal/lib/opal/parser/grammar.rb', line 5524

def _reduce_467(val, _values, result)
                      result = new_gvar(val[0])
                    
    result
end

#_reduce_468(val, _values, result) ⇒ Object


5530
5531
5532
5533
5534
# File 'opal/lib/opal/parser/grammar.rb', line 5530

def _reduce_468(val, _values, result)
                      result = new_const(val[0])
                    
    result
end

#_reduce_469(val, _values, result) ⇒ Object


5536
5537
5538
5539
5540
# File 'opal/lib/opal/parser/grammar.rb', line 5536

def _reduce_469(val, _values, result)
                      result = new_cvar(val[0])
                    
    result
end

#_reduce_470(val, _values, result) ⇒ Object


5542
5543
5544
5545
5546
# File 'opal/lib/opal/parser/grammar.rb', line 5542

def _reduce_470(val, _values, result)
                      result = new_nil(val[0])
                    
    result
end

#_reduce_471(val, _values, result) ⇒ Object


5548
5549
5550
5551
5552
# File 'opal/lib/opal/parser/grammar.rb', line 5548

def _reduce_471(val, _values, result)
                      result = new_self(val[0])
                    
    result
end

#_reduce_472(val, _values, result) ⇒ Object


5554
5555
5556
5557
5558
# File 'opal/lib/opal/parser/grammar.rb', line 5554

def _reduce_472(val, _values, result)
                      result = new_true(val[0])
                    
    result
end

#_reduce_473(val, _values, result) ⇒ Object


5560
5561
5562
5563
5564
# File 'opal/lib/opal/parser/grammar.rb', line 5560

def _reduce_473(val, _values, result)
                      result = new_false(val[0])
                    
    result
end

#_reduce_474(val, _values, result) ⇒ Object


5566
5567
5568
5569
5570
# File 'opal/lib/opal/parser/grammar.rb', line 5566

def _reduce_474(val, _values, result)
                      result = new___FILE__(val[0])
                    
    result
end

#_reduce_475(val, _values, result) ⇒ Object


5572
5573
5574
5575
5576
# File 'opal/lib/opal/parser/grammar.rb', line 5572

def _reduce_475(val, _values, result)
                      result = new___LINE__(val[0])
                    
    result
end

#_reduce_476(val, _values, result) ⇒ Object


5578
5579
5580
5581
5582
# File 'opal/lib/opal/parser/grammar.rb', line 5578

def _reduce_476(val, _values, result)
                      result = new_var_ref(val[0])
                    
    result
end

#_reduce_477(val, _values, result) ⇒ Object


5584
5585
5586
5587
5588
# File 'opal/lib/opal/parser/grammar.rb', line 5584

def _reduce_477(val, _values, result)
                      result = new_assignable val[0]
                    
    result
end

#_reduce_478(val, _values, result) ⇒ Object


5590
5591
5592
5593
5594
# File 'opal/lib/opal/parser/grammar.rb', line 5590

def _reduce_478(val, _values, result)
                      result = s(:nth_ref, value(val[0]))
                    
    result
end

#_reduce_480(val, _values, result) ⇒ Object

reduce 479 omitted


5598
5599
5600
5601
5602
# File 'opal/lib/opal/parser/grammar.rb', line 5598

def _reduce_480(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_481(val, _values, result) ⇒ Object


5604
5605
5606
5607
5608
# File 'opal/lib/opal/parser/grammar.rb', line 5604

def _reduce_481(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_482(val, _values, result) ⇒ Object


5610
5611
5612
5613
5614
# File 'opal/lib/opal/parser/grammar.rb', line 5610

def _reduce_482(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_483(val, _values, result) ⇒ Object


5616
5617
5618
5619
5620
5621
# File 'opal/lib/opal/parser/grammar.rb', line 5616

def _reduce_483(val, _values, result)
                      result = val[1]
                      lexer.lex_state = :expr_beg
                    
    result
end

#_reduce_484(val, _values, result) ⇒ Object


5623
5624
5625
5626
5627
5628
# File 'opal/lib/opal/parser/grammar.rb', line 5623

def _reduce_484(val, _values, result)
                      result = val[0]
                      lexer.lex_state = :expr_beg
                    
    result
end

#_reduce_487(val, _values, result) ⇒ Object

reduce 486 omitted


5634
5635
5636
5637
5638
# File 'opal/lib/opal/parser/grammar.rb', line 5634

def _reduce_487(val, _values, result)
                      result = new_kwrestarg(val[1])
                    
    result
end

#_reduce_488(val, _values, result) ⇒ Object


5640
5641
5642
5643
5644
# File 'opal/lib/opal/parser/grammar.rb', line 5640

def _reduce_488(val, _values, result)
                      result = new_kwrestarg()
                    
    result
end

#_reduce_489(val, _values, result) ⇒ Object


5646
5647
5648
5649
5650
# File 'opal/lib/opal/parser/grammar.rb', line 5646

def _reduce_489(val, _values, result)
                      result = new_sym(val[0])
                    
    result
end

#_reduce_490(val, _values, result) ⇒ Object


5652
5653
5654
5655
5656
# File 'opal/lib/opal/parser/grammar.rb', line 5652

def _reduce_490(val, _values, result)
                      result = new_kwoptarg(val[0], val[1])
                    
    result
end

#_reduce_491(val, _values, result) ⇒ Object


5658
5659
5660
5661
5662
# File 'opal/lib/opal/parser/grammar.rb', line 5658

def _reduce_491(val, _values, result)
                      result = new_kwarg(val[0])
                    
    result
end

#_reduce_492(val, _values, result) ⇒ Object


5664
5665
5666
5667
5668
# File 'opal/lib/opal/parser/grammar.rb', line 5664

def _reduce_492(val, _values, result)
                      result = new_kwoptarg(val[0], val[1])
                    
    result
end

#_reduce_493(val, _values, result) ⇒ Object


5670
5671
5672
5673
5674
# File 'opal/lib/opal/parser/grammar.rb', line 5670

def _reduce_493(val, _values, result)
                      result = new_kwarg(val[0])
                    
    result
end

#_reduce_494(val, _values, result) ⇒ Object


5676
5677
5678
5679
5680
# File 'opal/lib/opal/parser/grammar.rb', line 5676

def _reduce_494(val, _values, result)
                      result = [val[0]]
                    
    result
end

#_reduce_495(val, _values, result) ⇒ Object


5682
5683
5684
5685
5686
5687
# File 'opal/lib/opal/parser/grammar.rb', line 5682

def _reduce_495(val, _values, result)
                      result = val[0]
                      result << val[2]
                    
    result
end

#_reduce_496(val, _values, result) ⇒ Object


5689
5690
5691
5692
5693
# File 'opal/lib/opal/parser/grammar.rb', line 5689

def _reduce_496(val, _values, result)
                      result = [val[0]]
                    
    result
end

#_reduce_497(val, _values, result) ⇒ Object


5695
5696
5697
5698
5699
5700
# File 'opal/lib/opal/parser/grammar.rb', line 5695

def _reduce_497(val, _values, result)
                      result = val[0]
                      result << val[2]
                    
    result
end

#_reduce_498(val, _values, result) ⇒ Object


5702
5703
5704
5705
5706
# File 'opal/lib/opal/parser/grammar.rb', line 5702

def _reduce_498(val, _values, result)
                      result = new_args_tail(val[0], val[2], val[3])
                    
    result
end

#_reduce_499(val, _values, result) ⇒ Object


5708
5709
5710
5711
5712
# File 'opal/lib/opal/parser/grammar.rb', line 5708

def _reduce_499(val, _values, result)
                      result = new_args_tail(val[0], nil, val[1])
                    
    result
end

#_reduce_5(val, _values, result) ⇒ Object


3289
3290
3291
3292
3293
3294
# File 'opal/lib/opal/parser/grammar.rb', line 3289

def _reduce_5(val, _values, result)
                      val[0] << val[2]
                      result = val[0]
                    
    result
end

#_reduce_500(val, _values, result) ⇒ Object


5714
5715
5716
5717
5718
# File 'opal/lib/opal/parser/grammar.rb', line 5714

def _reduce_500(val, _values, result)
                      result = new_args_tail(nil, val[0], val[1])
                    
    result
end

#_reduce_501(val, _values, result) ⇒ Object


5720
5721
5722
5723
5724
# File 'opal/lib/opal/parser/grammar.rb', line 5720

def _reduce_501(val, _values, result)
                      result = new_args_tail(nil, nil, val[0])
                    
    result
end

#_reduce_502(val, _values, result) ⇒ Object


5726
5727
5728
5729
5730
# File 'opal/lib/opal/parser/grammar.rb', line 5726

def _reduce_502(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_503(val, _values, result) ⇒ Object


5732
5733
5734
5735
5736
# File 'opal/lib/opal/parser/grammar.rb', line 5732

def _reduce_503(val, _values, result)
                      result = new_args_tail(nil, nil, nil)
                    
    result
end

#_reduce_504(val, _values, result) ⇒ Object


5738
5739
5740
5741
5742
5743
5744
# File 'opal/lib/opal/parser/grammar.rb', line 5738

def _reduce_504(val, _values, result)
                      optarg = new_optarg(val[2])
                      restarg = new_restarg(val[4])
                      result = new_args(val[0] + optarg + restarg, val[5])
                    
    result
end

#_reduce_505(val, _values, result) ⇒ Object


5746
5747
5748
5749
5750
5751
5752
# File 'opal/lib/opal/parser/grammar.rb', line 5746

def _reduce_505(val, _values, result)
                      optarg = new_optarg(val[2])
                      restarg = new_restarg(val[4])
                      result = new_args(val[0] + optarg + restarg + val[6], val[7])
                    
    result
end

#_reduce_506(val, _values, result) ⇒ Object


5754
5755
5756
5757
5758
5759
# File 'opal/lib/opal/parser/grammar.rb', line 5754

def _reduce_506(val, _values, result)
                      optarg = new_optarg(val[2])
                      result = new_args(val[0] + optarg, val[3])
                    
    result
end

#_reduce_507(val, _values, result) ⇒ Object


5761
5762
5763
5764
5765
5766
# File 'opal/lib/opal/parser/grammar.rb', line 5761

def _reduce_507(val, _values, result)
                      optarg = new_optarg(val[2])
                      result = new_args(val[0] + optarg + val[4], val[5])
                    
    result
end

#_reduce_508(val, _values, result) ⇒ Object


5768
5769
5770
5771
5772
5773
# File 'opal/lib/opal/parser/grammar.rb', line 5768

def _reduce_508(val, _values, result)
                      restarg = new_restarg(val[2])
                      result = new_args(val[0] + restarg, val[3])
                    
    result
end

#_reduce_509(val, _values, result) ⇒ Object


5775
5776
5777
5778
5779
5780
# File 'opal/lib/opal/parser/grammar.rb', line 5775

def _reduce_509(val, _values, result)
                      restarg = new_restarg(val[2])
                      result = new_args(val[0] + restarg + val[4], val[5])
                    
    result
end

#_reduce_510(val, _values, result) ⇒ Object


5782
5783
5784
5785
5786
# File 'opal/lib/opal/parser/grammar.rb', line 5782

def _reduce_510(val, _values, result)
                      result = new_args(val[0], val[1])
                    
    result
end

#_reduce_511(val, _values, result) ⇒ Object


5788
5789
5790
5791
5792
5793
5794
# File 'opal/lib/opal/parser/grammar.rb', line 5788

def _reduce_511(val, _values, result)
                      optarg = new_optarg(val[0])
                      restarg = new_restarg(val[2])
                      result = new_args(optarg + restarg, val[3])
                    
    result
end

#_reduce_512(val, _values, result) ⇒ Object


5796
5797
5798
5799
5800
5801
5802
# File 'opal/lib/opal/parser/grammar.rb', line 5796

def _reduce_512(val, _values, result)
                      optarg = new_optarg(val[0])
                      restarg = new_restarg(val[2])
                      result = new_args(optarg + restarg + val[4], val[5])
                    
    result
end

#_reduce_513(val, _values, result) ⇒ Object


5804
5805
5806
5807
5808
5809
# File 'opal/lib/opal/parser/grammar.rb', line 5804

def _reduce_513(val, _values, result)
                      optarg = new_optarg(val[0])
                      result = new_args(optarg, val[1])
                    
    result
end

#_reduce_514(val, _values, result) ⇒ Object


5811
5812
5813
5814
5815
5816
# File 'opal/lib/opal/parser/grammar.rb', line 5811

def _reduce_514(val, _values, result)
                      optarg = new_optarg(val[0])
                      result = new_args(optarg + val[2], val[3])
                    
    result
end

#_reduce_515(val, _values, result) ⇒ Object


5818
5819
5820
5821
5822
5823
# File 'opal/lib/opal/parser/grammar.rb', line 5818

def _reduce_515(val, _values, result)
                      optarg = new_restarg(val[0])
                      result = new_args(optarg, val[1])
                    
    result
end

#_reduce_516(val, _values, result) ⇒ Object


5825
5826
5827
5828
5829
5830
# File 'opal/lib/opal/parser/grammar.rb', line 5825

def _reduce_516(val, _values, result)
                      restarg = new_restarg(val[0])
                      result = new_args(restarg + val[2], val[3])
                    
    result
end

#_reduce_517(val, _values, result) ⇒ Object


5832
5833
5834
5835
5836
# File 'opal/lib/opal/parser/grammar.rb', line 5832

def _reduce_517(val, _values, result)
                      result = new_args(nil, val[0])
                    
    result
end

#_reduce_518(val, _values, result) ⇒ Object


5838
5839
5840
5841
5842
# File 'opal/lib/opal/parser/grammar.rb', line 5838

def _reduce_518(val, _values, result)
                      result = new_args(nil, nil)
                    
    result
end

#_reduce_520(val, _values, result) ⇒ Object

reduce 519 omitted


5846
5847
5848
5849
5850
5851
# File 'opal/lib/opal/parser/grammar.rb', line 5846

def _reduce_520(val, _values, result)
                      result = value(val[0]).to_sym
                      scope.add_local result
                    
    result
end

#_reduce_521(val, _values, result) ⇒ Object


5853
5854
5855
5856
5857
# File 'opal/lib/opal/parser/grammar.rb', line 5853

def _reduce_521(val, _values, result)
                      raise 'formal argument cannot be a constant'
                    
    result
end

#_reduce_522(val, _values, result) ⇒ Object


5859
5860
5861
5862
5863
# File 'opal/lib/opal/parser/grammar.rb', line 5859

def _reduce_522(val, _values, result)
                      raise 'formal argument cannot be an instance variable'
                    
    result
end

#_reduce_523(val, _values, result) ⇒ Object


5865
5866
5867
5868
5869
# File 'opal/lib/opal/parser/grammar.rb', line 5865

def _reduce_523(val, _values, result)
                      raise 'formal argument cannot be a class variable'
                    
    result
end

#_reduce_524(val, _values, result) ⇒ Object


5871
5872
5873
5874
5875
# File 'opal/lib/opal/parser/grammar.rb', line 5871

def _reduce_524(val, _values, result)
                      raise 'formal argument cannot be a global variable'
                    
    result
end

#_reduce_525(val, _values, result) ⇒ Object


5877
5878
5879
5880
5881
# File 'opal/lib/opal/parser/grammar.rb', line 5877

def _reduce_525(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_526(val, _values, result) ⇒ Object


5883
5884
5885
5886
5887
# File 'opal/lib/opal/parser/grammar.rb', line 5883

def _reduce_526(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_529(val, _values, result) ⇒ Object

reduce 528 omitted


5893
5894
5895
5896
5897
# File 'opal/lib/opal/parser/grammar.rb', line 5893

def _reduce_529(val, _values, result)
                      result = s(:arg, val[0])
                    
    result
end

#_reduce_53(val, _values, result) ⇒ Object

reduce 52 omitted


3503
3504
3505
3506
3507
# File 'opal/lib/opal/parser/grammar.rb', line 3503

def _reduce_53(val, _values, result)
                      result = new_iter(val[1], val[2])
                    
    result
end

#_reduce_530(val, _values, result) ⇒ Object


5899
5900
5901
5902
5903
# File 'opal/lib/opal/parser/grammar.rb', line 5899

def _reduce_530(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_531(val, _values, result) ⇒ Object


5905
5906
5907
5908
5909
# File 'opal/lib/opal/parser/grammar.rb', line 5905

def _reduce_531(val, _values, result)
                      result = s(:mlhs, val[0])
                    
    result
end

#_reduce_532(val, _values, result) ⇒ Object


5911
5912
5913
5914
5915
5916
# File 'opal/lib/opal/parser/grammar.rb', line 5911

def _reduce_532(val, _values, result)
                      val[0] << val[2]
                      result = val[0]
                    
    result
end

#_reduce_534(val, _values, result) ⇒ Object

reduce 533 omitted


5920
5921
5922
5923
5924
# File 'opal/lib/opal/parser/grammar.rb', line 5920

def _reduce_534(val, _values, result)
                      result = val[0].push(s(:restarg, val[3]))
                    
    result
end

#_reduce_535(val, _values, result) ⇒ Object


5926
5927
5928
5929
5930
# File 'opal/lib/opal/parser/grammar.rb', line 5926

def _reduce_535(val, _values, result)
                      result = val[0].push(s(:restarg, val[3])).concat(val[5][1..-1])
                    
    result
end

#_reduce_536(val, _values, result) ⇒ Object


5932
5933
5934
5935
5936
# File 'opal/lib/opal/parser/grammar.rb', line 5932

def _reduce_536(val, _values, result)
                      result = val[0].push(s(:restarg))
                    
    result
end

#_reduce_537(val, _values, result) ⇒ Object


5938
5939
5940
5941
5942
# File 'opal/lib/opal/parser/grammar.rb', line 5938

def _reduce_537(val, _values, result)
                      result = val[0].push(s(:restarg)).concat(val[4][1..-1])
                    
    result
end

#_reduce_538(val, _values, result) ⇒ Object


5944
5945
5946
5947
5948
# File 'opal/lib/opal/parser/grammar.rb', line 5944

def _reduce_538(val, _values, result)
                      result = s(:mlhs, s(:restarg, val[1]))
                    
    result
end

#_reduce_539(val, _values, result) ⇒ Object


5950
5951
5952
5953
5954
5955
# File 'opal/lib/opal/parser/grammar.rb', line 5950

def _reduce_539(val, _values, result)
                      val[3].insert(1, s(:restarg, val[1]))
                      result = val[3]
                    
    result
end

#_reduce_54(val, _values, result) ⇒ Object


3509
3510
3511
3512
3513
# File 'opal/lib/opal/parser/grammar.rb', line 3509

def _reduce_54(val, _values, result)
                      result = new_call(nil, val[0], val[1])
                    
    result
end

#_reduce_540(val, _values, result) ⇒ Object


5957
5958
5959
5960
5961
# File 'opal/lib/opal/parser/grammar.rb', line 5957

def _reduce_540(val, _values, result)
                      result = s(:mlhs, s(:restarg))
                    
    result
end

#_reduce_541(val, _values, result) ⇒ Object


5963
5964
5965
5966
5967
5968
# File 'opal/lib/opal/parser/grammar.rb', line 5963

def _reduce_541(val, _values, result)
                      val[2].insert(1, s(:restarg))
                      result = val[2]
                    
    result
end

#_reduce_542(val, _values, result) ⇒ Object


5970
5971
5972
5973
5974
# File 'opal/lib/opal/parser/grammar.rb', line 5970

def _reduce_542(val, _values, result)
                      result = [val[0]]
                    
    result
end

#_reduce_543(val, _values, result) ⇒ Object


5976
5977
5978
5979
5980
5981
# File 'opal/lib/opal/parser/grammar.rb', line 5976

def _reduce_543(val, _values, result)
                      val[0] << val[2]
                      result = val[0]
                    
    result
end

#_reduce_544(val, _values, result) ⇒ Object


5983
5984
5985
5986
5987
# File 'opal/lib/opal/parser/grammar.rb', line 5983

def _reduce_544(val, _values, result)
                      result = new_assign(new_assignable(new_ident(val[0])), val[1], val[2])
                    
    result
end

#_reduce_545(val, _values, result) ⇒ Object


5989
5990
5991
5992
5993
# File 'opal/lib/opal/parser/grammar.rb', line 5989

def _reduce_545(val, _values, result)
                      result = s(:block, val[0])
                    
    result
end

#_reduce_546(val, _values, result) ⇒ Object


5995
5996
5997
5998
5999
6000
# File 'opal/lib/opal/parser/grammar.rb', line 5995

def _reduce_546(val, _values, result)
                      result = val[0]
                      val[0] << val[2]
                    
    result
end

#_reduce_549(val, _values, result) ⇒ Object

reduce 548 omitted


6006
6007
6008
6009
6010
# File 'opal/lib/opal/parser/grammar.rb', line 6006

def _reduce_549(val, _values, result)
                      result = "*#{value(val[1])}".to_sym
                    
    result
end

#_reduce_55(val, _values, result) ⇒ Object


3515
3516
3517
3518
3519
# File 'opal/lib/opal/parser/grammar.rb', line 3515

def _reduce_55(val, _values, result)
                      result = new_call(nil, val[0], val[1]) << val[2]
                    
    result
end

#_reduce_550(val, _values, result) ⇒ Object


6012
6013
6014
6015
6016
# File 'opal/lib/opal/parser/grammar.rb', line 6012

def _reduce_550(val, _values, result)
                      result = :*"
                    
    result
end

#_reduce_553(val, _values, result) ⇒ Object

reduce 552 omitted


6022
6023
6024
6025
6026
# File 'opal/lib/opal/parser/grammar.rb', line 6022

def _reduce_553(val, _values, result)
                      result = "&#{value(val[1])}".to_sym
                    
    result
end

#_reduce_554(val, _values, result) ⇒ Object


6028
6029
6030
6031
6032
# File 'opal/lib/opal/parser/grammar.rb', line 6028

def _reduce_554(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_555(val, _values, result) ⇒ Object


6034
6035
6036
6037
6038
# File 'opal/lib/opal/parser/grammar.rb', line 6034

def _reduce_555(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_556(val, _values, result) ⇒ Object


6040
6041
6042
6043
6044
# File 'opal/lib/opal/parser/grammar.rb', line 6040

def _reduce_556(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_557(val, _values, result) ⇒ Object


6046
6047
6048
6049
6050
# File 'opal/lib/opal/parser/grammar.rb', line 6046

def _reduce_557(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_558(val, _values, result) ⇒ Object


6052
6053
6054
6055
6056
# File 'opal/lib/opal/parser/grammar.rb', line 6052

def _reduce_558(val, _values, result)
                      result = []
                    
    result
end

#_reduce_559(val, _values, result) ⇒ Object


6058
6059
6060
6061
6062
# File 'opal/lib/opal/parser/grammar.rb', line 6058

def _reduce_559(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_56(val, _values, result) ⇒ Object


3521
3522
3523
3524
3525
# File 'opal/lib/opal/parser/grammar.rb', line 3521

def _reduce_56(val, _values, result)
                      result = new_js_call(val[0], val[2], val[3])
                    
    result
end

#_reduce_560(val, _values, result) ⇒ Object


6064
6065
6066
6067
6068
# File 'opal/lib/opal/parser/grammar.rb', line 6064

def _reduce_560(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_561(val, _values, result) ⇒ Object


6070
6071
6072
6073
6074
# File 'opal/lib/opal/parser/grammar.rb', line 6070

def _reduce_561(val, _values, result)
                      result = val[0].concat(val[2])
                    
    result
end

#_reduce_562(val, _values, result) ⇒ Object


6076
6077
6078
6079
6080
# File 'opal/lib/opal/parser/grammar.rb', line 6076

def _reduce_562(val, _values, result)
                      result = [val[0], val[2]]
                    
    result
end

#_reduce_563(val, _values, result) ⇒ Object


6082
6083
6084
6085
6086
# File 'opal/lib/opal/parser/grammar.rb', line 6082

def _reduce_563(val, _values, result)
                      result = [new_sym(val[0]), val[1]]
                    
    result
end

#_reduce_564(val, _values, result) ⇒ Object


6088
6089
6090
6091
6092
# File 'opal/lib/opal/parser/grammar.rb', line 6088

def _reduce_564(val, _values, result)
                      result = [s(:sym, source(val[1]).to_sym), val[3]]
                    
    result
end

#_reduce_565(val, _values, result) ⇒ Object


6094
6095
6096
6097
6098
# File 'opal/lib/opal/parser/grammar.rb', line 6094

def _reduce_565(val, _values, result)
                      result = [new_kwsplat(val[1])]
                    
    result
end

#_reduce_57(val, _values, result) ⇒ Object


3527
3528
3529
3530
3531
# File 'opal/lib/opal/parser/grammar.rb', line 3527

def _reduce_57(val, _values, result)
                      result = new_js_call(val[0], val[2], val[3]) << val[4]
                    
    result
end

#_reduce_58(val, _values, result) ⇒ Object


3533
3534
3535
3536
3537
# File 'opal/lib/opal/parser/grammar.rb', line 3533

def _reduce_58(val, _values, result)
                      result = new_call(val[0], val[2], val[3])
                    
    result
end

#_reduce_589(val, _values, result) ⇒ Object

reduce 588 omitted


6146
6147
6148
6149
6150
# File 'opal/lib/opal/parser/grammar.rb', line 6146

def _reduce_589(val, _values, result)
                      result = nil
                    
    result
end

#_reduce_59(val, _values, result) ⇒ Object


3539
3540
3541
3542
3543
# File 'opal/lib/opal/parser/grammar.rb', line 3539

def _reduce_59(val, _values, result)
                      result = new_call(val[0], val[2], val[3]) << val[4]
                    
    result
end

#_reduce_60(val, _values, result) ⇒ Object


3545
3546
3547
3548
3549
# File 'opal/lib/opal/parser/grammar.rb', line 3545

def _reduce_60(val, _values, result)
                      result = new_call(val[0], val[2], val[3])
                    
    result
end

#_reduce_61(val, _values, result) ⇒ Object


3551
3552
3553
3554
3555
# File 'opal/lib/opal/parser/grammar.rb', line 3551

def _reduce_61(val, _values, result)
                      result = new_call(val[0], val[2], val[3]) << val[4]
                    
    result
end

#_reduce_62(val, _values, result) ⇒ Object


3557
3558
3559
3560
3561
# File 'opal/lib/opal/parser/grammar.rb', line 3557

def _reduce_62(val, _values, result)
                      result = new_super(val[0], val[1])
                    
    result
end

#_reduce_63(val, _values, result) ⇒ Object


3563
3564
3565
3566
3567
# File 'opal/lib/opal/parser/grammar.rb', line 3563

def _reduce_63(val, _values, result)
                      result = new_yield val[1]
                    
    result
end

#_reduce_64(val, _values, result) ⇒ Object


3569
3570
3571
3572
3573
# File 'opal/lib/opal/parser/grammar.rb', line 3569

def _reduce_64(val, _values, result)
                      result = new_return(val[0], val[1])
                    
    result
end

#_reduce_65(val, _values, result) ⇒ Object


3575
3576
3577
3578
3579
# File 'opal/lib/opal/parser/grammar.rb', line 3575

def _reduce_65(val, _values, result)
                      result = new_break(val[0], val[1])
                    
    result
end

#_reduce_66(val, _values, result) ⇒ Object


3581
3582
3583
3584
3585
# File 'opal/lib/opal/parser/grammar.rb', line 3581

def _reduce_66(val, _values, result)
                      result = new_next(val[0], val[1])
                    
    result
end

#_reduce_67(val, _values, result) ⇒ Object


3587
3588
3589
3590
3591
# File 'opal/lib/opal/parser/grammar.rb', line 3587

def _reduce_67(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_68(val, _values, result) ⇒ Object


3593
3594
3595
3596
3597
# File 'opal/lib/opal/parser/grammar.rb', line 3593

def _reduce_68(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_69(val, _values, result) ⇒ Object


3599
3600
3601
3602
3603
# File 'opal/lib/opal/parser/grammar.rb', line 3599

def _reduce_69(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_7(val, _values, result) ⇒ Object

reduce 6 omitted


3298
3299
3300
3301
3302
# File 'opal/lib/opal/parser/grammar.rb', line 3298

def _reduce_7(val, _values, result)
                      result = val[2]
                    
    result
end

#_reduce_70(val, _values, result) ⇒ Object


3605
3606
3607
3608
3609
# File 'opal/lib/opal/parser/grammar.rb', line 3605

def _reduce_70(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_71(val, _values, result) ⇒ Object


3611
3612
3613
3614
3615
# File 'opal/lib/opal/parser/grammar.rb', line 3611

def _reduce_71(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_72(val, _values, result) ⇒ Object


3617
3618
3619
3620
3621
# File 'opal/lib/opal/parser/grammar.rb', line 3617

def _reduce_72(val, _values, result)
                      result = val[0] << val[1]
                    
    result
end

#_reduce_73(val, _values, result) ⇒ Object


3623
3624
3625
3626
3627
# File 'opal/lib/opal/parser/grammar.rb', line 3623

def _reduce_73(val, _values, result)
                      result = val[0] << s(:splat, val[2])
                    
    result
end

#_reduce_74(val, _values, result) ⇒ Object


3629
3630
3631
3632
3633
# File 'opal/lib/opal/parser/grammar.rb', line 3629

def _reduce_74(val, _values, result)
                     result = (val[0] << s(:splat, val[2])).concat(val[4].children)
                   
    result
end

#_reduce_75(val, _values, result) ⇒ Object


3635
3636
3637
3638
3639
# File 'opal/lib/opal/parser/grammar.rb', line 3635

def _reduce_75(val, _values, result)
                      result = val[0] << s(:splat)
                    
    result
end

#_reduce_76(val, _values, result) ⇒ Object


3641
3642
3643
3644
3645
# File 'opal/lib/opal/parser/grammar.rb', line 3641

def _reduce_76(val, _values, result)
                      result = (val[0] << s(:splat)).concat(val[3].children)
                    
    result
end

#_reduce_77(val, _values, result) ⇒ Object


3647
3648
3649
3650
3651
# File 'opal/lib/opal/parser/grammar.rb', line 3647

def _reduce_77(val, _values, result)
                      result = s(:array, s(:splat, val[1]))
                    
    result
end

#_reduce_78(val, _values, result) ⇒ Object


3653
3654
3655
3656
3657
# File 'opal/lib/opal/parser/grammar.rb', line 3653

def _reduce_78(val, _values, result)
                      result = s(:array, s(:splat, val[1])).concat(val[3].children)
                    
    result
end

#_reduce_79(val, _values, result) ⇒ Object


3659
3660
3661
3662
3663
# File 'opal/lib/opal/parser/grammar.rb', line 3659

def _reduce_79(val, _values, result)
                      result = s(:array, s(:splat))
                    
    result
end

#_reduce_8(val, _values, result) ⇒ Object


3304
3305
3306
3307
3308
# File 'opal/lib/opal/parser/grammar.rb', line 3304

def _reduce_8(val, _values, result)
                      result = new_body(val[0], val[1], val[2], val[3])
                    
    result
end

#_reduce_80(val, _values, result) ⇒ Object


3665
3666
3667
3668
3669
# File 'opal/lib/opal/parser/grammar.rb', line 3665

def _reduce_80(val, _values, result)
                      result = s(:array, s(:splat)).concat(val[2].children)
                    
    result
end

#_reduce_81(val, _values, result) ⇒ Object


3671
3672
3673
3674
3675
# File 'opal/lib/opal/parser/grammar.rb', line 3671

def _reduce_81(val, _values, result)
                      result = val[0]
                    
    result
end

#_reduce_82(val, _values, result) ⇒ Object


3677
3678
3679
3680
3681
# File 'opal/lib/opal/parser/grammar.rb', line 3677

def _reduce_82(val, _values, result)
                      result = val[1]
                    
    result
end

#_reduce_83(val, _values, result) ⇒ Object


3683
3684
3685
3686
3687
# File 'opal/lib/opal/parser/grammar.rb', line 3683

def _reduce_83(val, _values, result)
                      result = s(:array, val[0])
                    
    result
end

#_reduce_84(val, _values, result) ⇒ Object


3689
3690
3691
3692
3693
# File 'opal/lib/opal/parser/grammar.rb', line 3689

def _reduce_84(val, _values, result)
                      result = val[0] << val[1]
                    
    result
end

#_reduce_85(val, _values, result) ⇒ Object


3695
3696
3697
3698
3699
# File 'opal/lib/opal/parser/grammar.rb', line 3695

def _reduce_85(val, _values, result)
                      result = s(:array, val[0])
                    
    result
end

#_reduce_86(val, _values, result) ⇒ Object


3701
3702
3703
3704
3705
# File 'opal/lib/opal/parser/grammar.rb', line 3701

def _reduce_86(val, _values, result)
                      result = val[0] << val[2]
                    
    result
end

#_reduce_87(val, _values, result) ⇒ Object


3707
3708
3709
3710
3711
# File 'opal/lib/opal/parser/grammar.rb', line 3707

def _reduce_87(val, _values, result)
                      result = new_assignable val[0]
                    
    result
end

#_reduce_88(val, _values, result) ⇒ Object


3713
3714
3715
3716
3717
3718
# File 'opal/lib/opal/parser/grammar.rb', line 3713

def _reduce_88(val, _values, result)
                      args = val[2] ? val[2] : []
                      result = s(:attrasgn, val[0], :[]=, s(:arglist, *args))
                    
    result
end

#_reduce_89(val, _values, result) ⇒ Object


3720
3721
3722
3723
3724
# File 'opal/lib/opal/parser/grammar.rb', line 3720

def _reduce_89(val, _values, result)
                      result = new_call val[0], val[2], []
                    
    result
end

#_reduce_9(val, _values, result) ⇒ Object


3310
3311
3312
3313
3314
# File 'opal/lib/opal/parser/grammar.rb', line 3310

def _reduce_9(val, _values, result)
                      result = new_compstmt val[0]
                    
    result
end

#_reduce_95(val, _values, result) ⇒ Object

reduce 94 omitted


3736
3737
3738
3739
3740
# File 'opal/lib/opal/parser/grammar.rb', line 3736

def _reduce_95(val, _values, result)
                      result = new_assignable val[0]
                    
    result
end

#_reduce_96(val, _values, result) ⇒ Object


3742
3743
3744
3745
3746
# File 'opal/lib/opal/parser/grammar.rb', line 3742

def _reduce_96(val, _values, result)
                      result = new_js_attrasgn(val[0], val[2])
                    
    result
end

#_reduce_97(val, _values, result) ⇒ Object


3748
3749
3750
3751
3752
# File 'opal/lib/opal/parser/grammar.rb', line 3748

def _reduce_97(val, _values, result)
                      result = new_attrasgn(val[0], :[]=, val[2])
                    
    result
end

#_reduce_98(val, _values, result) ⇒ Object


3754
3755
3756
3757
3758
# File 'opal/lib/opal/parser/grammar.rb', line 3754

def _reduce_98(val, _values, result)
                      result = new_attrasgn(val[0], op_to_setter(val[2]))
                    
    result
end

#_reduce_99(val, _values, result) ⇒ Object


3760
3761
3762
3763
3764
# File 'opal/lib/opal/parser/grammar.rb', line 3760

def _reduce_99(val, _values, result)
                      result = new_attrasgn(val[0], op_to_setter(val[2]))
                    
    result
end

#_reduce_none(val, _values, result) ⇒ Object


6152
6153
6154
# File 'opal/lib/opal/parser/grammar.rb', line 6152

def _reduce_none(val, _values, result)
  val[0]
end

#add_block_pass(arglist, block) ⇒ Object


547
548
549
550
# File 'opal/lib/opal/parser.rb', line 547

def add_block_pass(arglist, block)
  arglist << block if block
  arglist
end

#negate_num(sexp) ⇒ Object


542
543
544
545
# File 'opal/lib/opal/parser.rb', line 542

def negate_num(sexp)
  sexp.array[1] = -sexp.array[1]
  sexp
end

#new___FILE__(tok) ⇒ Object


121
122
123
# File 'opal/lib/opal/parser.rb', line 121

def new___FILE__(tok)
  s1(:str, self.file, source(tok))
end

#new___LINE__(tok) ⇒ Object


125
126
127
# File 'opal/lib/opal/parser.rb', line 125

def new___LINE__(tok)
  s1(:int, lexer.line, source(tok))
end

#new_alias(kw, new, old) ⇒ Object


171
172
173
174
175
# File 'opal/lib/opal/parser.rb', line 171

def new_alias(kw, new, old)
  sexp = s(:alias, new, old)
  sexp.source = source(kw)
  sexp
end

#new_and(lhs, tok, rhs) ⇒ Object


518
519
520
521
522
# File 'opal/lib/opal/parser.rb', line 518

def new_and(lhs, tok, rhs)
  sexp = s(:and, lhs, rhs)
  sexp.source = source(tok)
  sexp
end

#new_args(norm, tail) ⇒ Object


361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'opal/lib/opal/parser.rb', line 361

def new_args(norm, tail)
  res = s(:args)

  if norm
    norm.each do |arg|
      if arg.is_a?(Sexp)
        # restarg (a, *b, c)
        # optarg (a = 1, *b, c)
        # (order matters)
        res << arg
      else
        # simple arg
        scope.add_local arg
        res << s(:arg, arg)
      end
    end
  end

  # kwarg
  if tail and tail[0]
    tail[0].each do |kwarg|
      res << kwarg
    end
  end

  # kwrestarg
  if tail and tail[1]
    res << tail[1]
  end

  # block
  if tail and tail[2]
    blockname = tail[2].to_s[1..-1].to_sym
    scope.add_local blockname
    res << s(:blockarg, blockname)
  end

  res
end

#new_args_tail(kwarg, kwrest, block) ⇒ Object


330
331
332
# File 'opal/lib/opal/parser.rb', line 330

def new_args_tail(kwarg, kwrest, block)
  [kwarg, kwrest, block]
end

#new_array(start, args, finish) ⇒ Object


305
306
307
308
309
310
# File 'opal/lib/opal/parser.rb', line 305

def new_array(start, args, finish)
  args ||= []
  sexp = s(:array, *args)
  sexp.source = source(start)
  sexp
end

#new_assign(lhs, tok, rhs) ⇒ Object


600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
# File 'opal/lib/opal/parser.rb', line 600

def new_assign(lhs, tok, rhs)
  case lhs.type
  when :iasgn, :cdecl, :lasgn, :gasgn, :cvdecl, :nth_ref
    lhs << rhs
    lhs
  when :call, :attrasgn, :jsattrasgn
    lhs.last << rhs
    lhs
  when :colon2
    lhs << rhs
    lhs.type = :casgn
    lhs
  when :colon3
    lhs << rhs
    lhs.type = :casgn3
    lhs
  else
    raise "Bad lhs for new_assign: #{lhs.type}"
  end
end

#new_assignable(ref) ⇒ Object


621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
# File 'opal/lib/opal/parser.rb', line 621

def new_assignable(ref)
  case ref.type
  when :ivar
    ref.type = :iasgn
  when :const
    ref.type = :cdecl
  when :identifier
    scope.add_local ref[1] unless scope.has_local? ref[1]
    ref.type = :lasgn
  when :gvar
    ref.type = :gasgn
  when :cvar
    ref.type = :cvdecl
  else
    raise SyntaxError, "Bad new_assignable type: #{ref.type}"
  end

  ref
end

#new_attrasgn(recv, op, args = []) ⇒ Object


588
589
590
591
592
# File 'opal/lib/opal/parser.rb', line 588

def new_attrasgn(recv, op, args=[])
  arglist = s(:arglist, *args)
  sexp = s(:attrasgn, recv, op, arglist)
  sexp
end

#new_binary_call(recv, meth, arg) ⇒ Object


510
511
512
# File 'opal/lib/opal/parser.rb', line 510

def new_binary_call(recv, meth, arg)
  new_call(recv, meth, [arg])
end

#new_block(stmt = nil) ⇒ Object


211
212
213
214
215
# File 'opal/lib/opal/parser.rb', line 211

def new_block(stmt = nil)
  sexp = s(:block)
  sexp << stmt if stmt
  sexp
end

#new_block_arg_splat(rest) ⇒ Object


440
441
442
443
444
445
446
# File 'opal/lib/opal/parser.rb', line 440

def new_block_arg_splat(rest)
  if rest
    r = rest.to_s[1..-1].to_sym
    scope.add_local r
    new_splat(nil, s(:lasgn, r))
  end
end

#new_block_args(norm, tail, shadow_args = nil) ⇒ Object


448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
# File 'opal/lib/opal/parser.rb', line 448

def new_block_args(norm, tail, shadow_args=nil)
  res = s(:args)

  if norm
    norm.each do |arg|
      if arg.is_a? Symbol
        scope.add_local arg
        res << s(:arg, arg)
      elsif arg.is_a?(Sexp)
        res << arg
      elsif arg.nil?
        res.meta[:has_trailing_comma] = true
      end
    end
  end

  # kwargs
  if tail && tail[0]
    tail[0].each do |kwarg|
      res << kwarg
    end
  end

  # kwrestarg
  if tail && tail[1]
    res << tail[1]
  end

  # block
  if tail && tail[2]
    block = tail[2].to_s[1..-1].to_sym
    res << s(:block_pass, s(:lasgn, block))
    scope.add_local block
  end

  # shadow args (m{|;a|})
  if shadow_args
    res.concat(shadow_args)
  end

  s(:masgn, res)
end

#new_block_pass(amper_tok, val) ⇒ Object


552
553
554
# File 'opal/lib/opal/parser.rb', line 552

def new_block_pass(amper_tok, val)
  s1(:block_pass, val, source(amper_tok))
end

#new_body(compstmt, res, els, ens) ⇒ Object


235
236
237
238
239
240
241
242
243
244
245
# File 'opal/lib/opal/parser.rb', line 235

def new_body(compstmt, res, els, ens)
  s = compstmt || s(:block)

  if res
    s = s(:rescue, s)
    res.each { |r| s << r }
    s << els if els
  end

  ens ? s(:ensure, s, ens) : s
end

#new_break(kw, args = nil) ⇒ Object


177
178
179
180
181
182
183
184
185
186
187
# File 'opal/lib/opal/parser.rb', line 177

def new_break(kw, args=nil)
  if args.nil?
    sexp = s(:break)
  elsif args.length == 1
    sexp = s(:break, args[0])
  else
    sexp = s(:break, s(:array, *args))
  end

  sexp
end

#new_call(recv, meth, args = nil) ⇒ Object


491
492
493
494
495
496
# File 'opal/lib/opal/parser.rb', line 491

def new_call(recv, meth, args = nil)
  args ||= []
  sexp = s(:call, recv, value(meth).to_sym, s(:arglist, *args))
  sexp.source = source(meth)
  sexp
end

#new_class(start, path, sup, body, endt) ⇒ Object


256
257
258
259
260
# File 'opal/lib/opal/parser.rb', line 256

def new_class(start, path, sup, body, endt)
  sexp = s(:class, path, sup, body)
  sexp.source = source(start)
  sexp
end

#new_colon2(lhs, tok, name) ⇒ Object


157
158
159
160
161
# File 'opal/lib/opal/parser.rb', line 157

def new_colon2(lhs, tok, name)
  sexp = s(:colon2, lhs, value(name).to_sym)
  sexp.source = source(tok)
  sexp
end

#new_colon3(tok, name) ⇒ Object


163
164
165
# File 'opal/lib/opal/parser.rb', line 163

def new_colon3(tok, name)
  s1(:colon3, value(name).to_sym, source(name))
end

#new_compstmt(block) ⇒ Object


217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'opal/lib/opal/parser.rb', line 217

def new_compstmt(block)
  comp = if block.size == 1
          nil
        elsif block.size == 2
          block[1]
        else
          block
        end

  if comp && comp.type == :begin && comp.size == 2
    result = comp[1]
  else
    result = comp
  end

  result
end

#new_const(tok) ⇒ Object


153
154
155
# File 'opal/lib/opal/parser.rb', line 153

def new_const(tok)
  s1(:const, value(tok).to_sym, source(tok))
end

#new_cvar(tok) ⇒ Object


149
150
151
# File 'opal/lib/opal/parser.rb', line 149

def new_cvar(tok)
  s1(:cvar, value(tok).to_sym, source(tok))
end

#new_def(kw, recv, name, args, body, end_tok) ⇒ Object


247
248
249
250
251
252
253
254
# File 'opal/lib/opal/parser.rb', line 247

def new_def(kw, recv, name, args, body, end_tok)
  body = s(:block, body) if body.type != :block
  body << s(:nil) if body.size == 1

  sexp = s(:def, recv, value(name).to_sym, args, body)
  sexp.source = source(kw)
  sexp
end

#new_dsym(str) ⇒ Object


718
719
720
721
722
723
724
725
726
727
728
729
730
731
# File 'opal/lib/opal/parser.rb', line 718

def new_dsym(str)
  return s(:sym, :") unless str
  case str.type
  when :str
    str.type = :sym
    str[1] = str[1].to_sym
  when :dstr
    str.type = :dsym
  when :evstr
    str = s(:dsym, str)
  end

  str
end

#new_erange(beg, op, finish) ⇒ Object


536
537
538
539
540
# File 'opal/lib/opal/parser.rb', line 536

def new_erange(beg, op, finish)
  sexp = s(:erange, beg, finish)
  sexp.source = source(op)
  sexp
end

#new_evstr(str) ⇒ Object


733
734
735
# File 'opal/lib/opal/parser.rb', line 733

def new_evstr(str)
  s(:evstr, str)
end

#new_false(tok) ⇒ Object


117
118
119
# File 'opal/lib/opal/parser.rb', line 117

def new_false(tok)
  s0(:false, source(tok))
end

#new_float(tok) ⇒ Object


137
138
139
# File 'opal/lib/opal/parser.rb', line 137

def new_float(tok)
  s1(:float, value(tok), source(tok))
end

#new_gettable(ref) ⇒ Object


641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
# File 'opal/lib/opal/parser.rb', line 641

def new_gettable(ref)
  res = case ref.type
        when :lasgn
          s(:lvar, ref[1])
        when :iasgn
          s(:ivar, ref[1])
        when :gasgn
          s(:gvar, ref[1])
        when :cvdecl
          s(:cvar, ref[1])
        when :cdecl
          s(:const, ref[1])
        else
          raise "Bad new_gettable ref: #{ref.type}"
        end

  res.source = ref.source
  res
end

#new_gvar(tok) ⇒ Object


145
146
147
# File 'opal/lib/opal/parser.rb', line 145

def new_gvar(tok)
  s1(:gvar, value(tok).to_sym, source(tok))
end

#new_hash(open, assocs, close) ⇒ Object


312
313
314
315
316
# File 'opal/lib/opal/parser.rb', line 312

def new_hash(open, assocs, close)
  sexp = s(:hash, *assocs)
  sexp.source = source(open)
  sexp
end

#new_ident(tok) ⇒ Object


129
130
131
# File 'opal/lib/opal/parser.rb', line 129

def new_ident(tok)
  s1(:identifier, value(tok).to_sym, source(tok))
end

#new_if(if_tok, expr, stmt, tail) ⇒ Object


281
282
283
284
285
# File 'opal/lib/opal/parser.rb', line 281

def new_if(if_tok, expr, stmt, tail)
  sexp = s(:if, expr, stmt, tail)
  sexp.source = source(if_tok)
  sexp
end

#new_int(tok) ⇒ Object


133
134
135
# File 'opal/lib/opal/parser.rb', line 133

def new_int(tok)
  s1(:int, value(tok), source(tok))
end

#new_irange(beg, op, finish) ⇒ Object


530
531
532
533
534
# File 'opal/lib/opal/parser.rb', line 530

def new_irange(beg, op, finish)
  sexp = s(:irange, beg, finish)
  sexp.source = source(op)
  sexp
end

#new_iter(args, body) ⇒ Object


274
275
276
277
278
279
# File 'opal/lib/opal/parser.rb', line 274

def new_iter(args, body)
  args ||= nil
  s = s(:iter, args)
  s << body if body
  s
end

#new_ivar(tok) ⇒ Object


141
142
143
# File 'opal/lib/opal/parser.rb', line 141

def new_ivar(tok)
  s1(:ivar, value(tok).to_sym, source(tok))
end

#new_js_attrasgn(recv, args) ⇒ Object


594
595
596
597
598
# File 'opal/lib/opal/parser.rb', line 594

def new_js_attrasgn(recv, args)
  arglist = s(:arglist, *args)
  sexp = s(:jsattrasgn, recv, nil, arglist)
  sexp
end

#new_js_call(recv, meth, args = nil) ⇒ Object


498
499
500
501
502
503
504
505
506
507
508
# File 'opal/lib/opal/parser.rb', line 498

def new_js_call(recv, meth, args = nil)
  if args
    sexp = s(:jscall, recv, value(meth).to_sym, s(:arglist, *args))
    sexp.source = source(meth)
  else
    sexp = s(:jscall, recv, value(meth).to_sym, nil)
    sexp.source = source(meth)
  end

  sexp
end

#new_kwarg(name) ⇒ Object


401
402
403
404
# File 'opal/lib/opal/parser.rb', line 401

def new_kwarg(name)
  scope.add_local name[1]
  s(:kwarg, name[1])
end

#new_kwoptarg(name, val) ⇒ Object


406
407
408
409
# File 'opal/lib/opal/parser.rb', line 406

def new_kwoptarg(name, val)
  scope.add_local name[1]
  s(:kwoptarg, name[1], val)
end

#new_kwrestarg(name = nil) ⇒ Object


411
412
413
414
415
416
417
418
419
420
# File 'opal/lib/opal/parser.rb', line 411

def new_kwrestarg(name = nil)
  result = s(:kwrestarg)

  if name
    scope.add_local name[0].to_sym
    result << name[0].to_sym
  end

  result
end

#new_kwsplat(hash) ⇒ Object


422
423
424
# File 'opal/lib/opal/parser.rb', line 422

def new_kwsplat(hash)
  s(:kwsplat, hash)
end

#new_method_call_with_block(method_call, block_arg) ⇒ Object


426
427
428
429
430
431
432
433
434
435
436
437
438
# File 'opal/lib/opal/parser.rb', line 426

def new_method_call_with_block(method_call, block_arg)
  receiver, method_name, call_args = *method_call.children

  if call_args && block_arg
    last_arg = call_args.last

    if Sexp === last_arg && last_arg.type == :block_pass
      raise 'both block argument and literal block are passed'
    end
  end

  method_call << block_arg
end

#new_module(kw, path, body, end_tok) ⇒ Object


268
269
270
271
272
# File 'opal/lib/opal/parser.rb', line 268

def new_module(kw, path, body, end_tok)
  sexp = s(:module, path, body)
  sexp.source = source(kw)
  sexp
end

#new_next(kw, args = []) ⇒ Object


201
202
203
204
205
206
207
208
209
# File 'opal/lib/opal/parser.rb', line 201

def new_next(kw, args=[])
  if args.length == 1
    sexp = s(:next, args[0])
  else
    sexp = s(:next, s(:array, *args))
  end

  sexp
end

#new_nil(tok) ⇒ Object


105
106
107
# File 'opal/lib/opal/parser.rb', line 105

def new_nil(tok)
  s0(:nil, source(tok))
end

#new_not(kw, expr) ⇒ Object


318
319
320
# File 'opal/lib/opal/parser.rb', line 318

def new_not(kw, expr)
  s1(:not, expr, source(kw))
end

#new_op_asgn(op, lhs, rhs) ⇒ Object


560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'opal/lib/opal/parser.rb', line 560

def new_op_asgn(op, lhs, rhs)
  case value(op).to_sym
  when :||"
    result = s(:op_asgn_or, new_gettable(lhs))
    result << (lhs << rhs)
  when :&&"
    result = s(:op_asgn_and, new_gettable(lhs))
    result << (lhs << rhs)
  else
    result = lhs
    result << new_call(new_gettable(lhs), op, [rhs])

  end

  result
end

#new_op_asgn1(lhs, args, op, rhs) ⇒ Object


577
578
579
580
581
582
# File 'opal/lib/opal/parser.rb', line 577

def new_op_asgn1(lhs, args, op, rhs)
  arglist = s(:arglist, *args)
  sexp = s(:op_asgn1, lhs, arglist, value(op), rhs)
  sexp.source = source(op)
  sexp
end

#new_optarg(opt) ⇒ Object


345
346
347
348
349
350
351
# File 'opal/lib/opal/parser.rb', line 345

def new_optarg(opt)
  if opt
    opt[1..-1].map do |_opt|
      s(:optarg, _opt[1], _opt[2])
    end
  end
end

#new_or(lhs, tok, rhs) ⇒ Object


524
525
526
527
528
# File 'opal/lib/opal/parser.rb', line 524

def new_or(lhs, tok, rhs)
  sexp = s(:or, lhs, rhs)
  sexp.source = source(tok)
  sexp
end

#new_paren(open, expr, close) ⇒ Object


322
323
324
325
326
327
328
# File 'opal/lib/opal/parser.rb', line 322

def new_paren(open, expr, close)
  if expr.nil? or expr == [:block]
    s1(:paren, s0(:nil, source(open)), source(open))
  else
    s1(:paren, expr, source(open))
  end
end

#new_regexp(reg, ending) ⇒ Object


755
756
757
758
759
760
761
762
763
764
765
766
# File 'opal/lib/opal/parser.rb', line 755

def new_regexp(reg, ending)
  return s(:regexp, '') unless reg
  case reg.type
  when :str
    s(:regexp, reg[1], value(ending))
  when :evstr
    s(:dregx, "", reg)
  when :dstr
    reg.type = :dregx
    reg
  end
end

#new_rescue_mod(kw, expr, resc) ⇒ Object


299
300
301
302
303
# File 'opal/lib/opal/parser.rb', line 299

def new_rescue_mod(kw, expr, resc)
  sexp = s(:rescue_mod, expr, resc)
  sexp.source = source(kw)
  sexp
end

#new_restarg(rest) ⇒ Object


334
335
336
337
338
339
340
341
342
343
# File 'opal/lib/opal/parser.rb', line 334

def new_restarg(rest)
  restname = rest[1..-1]

  if restname.empty?
    [s(:restarg)]
  else
    scope.add_local restname.to_sym
    [s(:restarg, restname.to_sym)]
  end
end

#new_return(kw, args = nil) ⇒ Object


189
190
191
192
193
194
195
196
197
198
199
# File 'opal/lib/opal/parser.rb', line 189

def new_return(kw, args=nil)
  if args.nil?
    sexp = s(:return)
  elsif args.length == 1
    sexp = s(:return, args[0])
  else
    sexp = s(:return, s(:array, *args))
  end

  sexp
end

#new_sclass(kw, expr, body, end_tok) ⇒ Object


262
263
264
265
266
# File 'opal/lib/opal/parser.rb', line 262

def new_sclass(kw, expr, body, end_tok)
  sexp = s(:sclass, expr, body)
  sexp.source = source(kw)
  sexp
end

#new_self(tok) ⇒ Object


109
110
111
# File 'opal/lib/opal/parser.rb', line 109

def new_self(tok)
  s0(:self, source(tok))
end

#new_shadowarg(shadowarg) ⇒ Object


353
354
355
356
357
358
359
# File 'opal/lib/opal/parser.rb', line 353

def new_shadowarg(shadowarg)
  if shadowarg
    shadowname = value(shadowarg).to_sym
    scope.add_local shadowname
    s(:shadowarg, shadowname)
  end
end

#new_splat(tok, value) ⇒ Object


556
557
558
# File 'opal/lib/opal/parser.rb', line 556

def new_splat(tok, value)
  s1(:splat, value, source(tok))
end

#new_str(str) ⇒ Object


737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
# File 'opal/lib/opal/parser.rb', line 737

def new_str(str)
  # cover empty strings
  return s(:str, "") unless str
  # catch s(:str, "", other_str)
  if str.size == 3 and str[1] == "" and str.type == :str
    return str[2]
  # catch s(:str, "content", more_content)
  elsif str.type == :str && str.size > 3
    str.type = :dstr
    str
  # top level evstr should be a dstr
  elsif str.type == :evstr
    s(:dstr, "", str)
  else
    str
  end
end

#new_str_content(tok) ⇒ Object


783
784
785
# File 'opal/lib/opal/parser.rb', line 783

def new_str_content(tok)
  s1(:str, value(tok), source(tok))
end

#new_super(kw, args) ⇒ Object


689
690
691
692
693
694
695
696
697
698
# File 'opal/lib/opal/parser.rb', line 689

def new_super(kw, args)
  if args.nil?
    sexp = s(:super, nil)
  else
    sexp = s(:super, s(:arglist, *args))
  end

  sexp.source = source(kw)
  sexp
end

#new_sym(tok) ⇒ Object


167
168
169
# File 'opal/lib/opal/parser.rb', line 167

def new_sym(tok)
  s1(:sym, value(tok).to_sym, source(tok))
end

#new_true(tok) ⇒ Object


113
114
115
# File 'opal/lib/opal/parser.rb', line 113

def new_true(tok)
  s0(:true, source(tok))
end

#new_unary_call(op, recv) ⇒ Object


514
515
516
# File 'opal/lib/opal/parser.rb', line 514

def new_unary_call(op, recv)
  new_call(recv, op, [])
end

#new_until(kw, test, body) ⇒ Object


293
294
295
296
297
# File 'opal/lib/opal/parser.rb', line 293

def new_until(kw, test, body)
  sexp = s(:until, test, body)
  sexp.source = source(kw)
  sexp
end

#new_var_ref(ref) ⇒ Object


661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
# File 'opal/lib/opal/parser.rb', line 661

def new_var_ref(ref)
  case ref.type
  when :self, :nil, :true, :false, :line, :file
    ref
  when :const
    ref
  when :ivar, :gvar, :cvar
    ref
  when :int
    # this is when we passed __LINE__ which is converted into :int
    ref
  when :str
    # returns for __FILE__ as it is converted into str
    ref
  when :identifier
    result = if scope.has_local? ref[1]
              s(:lvar, ref[1])
            else
              s(:call, nil, ref[1], s(:arglist))
            end

    result.source = ref.source
    result
  else
    raise "Bad var_ref type: #{ref.type}"
  end
end

#new_while(kw, test, body) ⇒ Object


287
288
289
290
291
# File 'opal/lib/opal/parser.rb', line 287

def new_while(kw, test, body)
  sexp = s(:while, test, body)
  sexp.source = source(kw)
  sexp
end

#new_xstr(start_t, str, end_t) ⇒ Object


705
706
707
708
709
710
711
712
713
714
715
716
# File 'opal/lib/opal/parser.rb', line 705

def new_xstr(start_t, str, end_t)
  return s(:xstr, '') unless str
  case str.type
  when :str   then str.type = :xstr
  when :dstr  then str.type = :dxstr
  when :evstr then str = s(:dxstr, '', str)
  end

  str.source = source(start_t)

  str
end

#new_yield(args) ⇒ Object


700
701
702
703
# File 'opal/lib/opal/parser.rb', line 700

def new_yield(args)
  args ||= []
  s(:yield, *args)
end

#next_tokenObject


60
61
62
# File 'opal/lib/opal/parser.rb', line 60

def next_token
  @lexer.next_token
end

#on_error(t, val, vstack) ⇒ Object


81
82
83
# File 'opal/lib/opal/parser.rb', line 81

def on_error(t, val, vstack)
  raise "parse error on value #{value(val).inspect} (#{token_to_str(t) || '?'}) :#{@file}:#{lexer.line}"
end

#op_to_setter(op) ⇒ Object


584
585
586
# File 'opal/lib/opal/parser.rb', line 584

def op_to_setter(op)
  "#{value(op)}=".to_sym
end

#parse(source, file = '(string)') ⇒ Opal::Sexp

Parse the given ruby source. An optional file can be given which is used for file context for some ruby expressions (e.g. __FILE__).

If the given ruby code is not valid ruby, then an error will be raised.

Parameters:

  • source (String)

    ruby source code

  • file (String) (defaults to: '(string)')

    filename for context of ruby code

Returns:

  • (Opal::Sexp)

    sexp expression tree representing ruby code


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'opal/lib/opal/parser.rb', line 32

def parse(source, file = '(string)')
  @yydebug = true if !!ENV['RACC_DEBUG']
  @file = file
  @scopes = []
  @lexer = Lexer.new(source, file)
  @lexer.parser = self

  self.parse_to_sexp
rescue => error
  message = [
    nil,
    error.message,
    "Source: #{@file}:#{lexer.line}:#{lexer.column}",
    source.split("\n")[lexer.line-1],
    '~'*(lexer.column-1 > 0 ? lexer.column-1 : 0) + '^',
  ].join("\n")

  raise error.class, message, error.backtrace
end

#parse_to_sexpObject


52
53
54
55
56
57
58
# File 'opal/lib/opal/parser.rb', line 52

def parse_to_sexp
  push_scope
  result = do_parse
  pop_scope

  result
end

#pop_scopeObject


76
77
78
79
# File 'opal/lib/opal/parser.rb', line 76

def pop_scope
  @scopes.pop
  @scope = @scopes.last
end

#push_scope(type = nil) ⇒ Object


68
69
70
71
72
73
74
# File 'opal/lib/opal/parser.rb', line 68

def push_scope(type = nil)
  top = @scopes.last
  scope = ParserScope.new type
  scope.parent = top
  @scopes << scope
  @scope = scope
end

#s(*parts) ⇒ Object


64
65
66
# File 'opal/lib/opal/parser.rb', line 64

def s(*parts)
  Sexp.new(parts)
end

#s0(type, source) ⇒ Object


93
94
95
96
97
# File 'opal/lib/opal/parser.rb', line 93

def s0(type, source)
  sexp = s(type)
  sexp.source = source
  sexp
end

#s1(type, first, source) ⇒ Object


99
100
101
102
103
# File 'opal/lib/opal/parser.rb', line 99

def s1(type, first, source)
  sexp = s(type, first)
  sexp.source = source
  sexp
end

#source(tok) ⇒ Object


89
90
91
# File 'opal/lib/opal/parser.rb', line 89

def source(tok)
  tok ? tok[1] : nil
end

#str_append(str, str2) ⇒ Object


768
769
770
771
772
773
774
775
776
777
778
779
780
781
# File 'opal/lib/opal/parser.rb', line 768

def str_append(str, str2)
  return str2 unless str
  return str unless str2

  if str.type == :evstr
    str = s(:dstr, "", str)
  elsif str.type == :str
    str = s(:dstr, str[1])
  else
    #puts str.type
  end
  str << str2
  str
end

#value(tok) ⇒ Object


85
86
87
# File 'opal/lib/opal/parser.rb', line 85

def value(tok)
  tok[0]
end