debase-ruby_core_source 3.3.6 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +6 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/builtin.h +7 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/darray.h +1 -3
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/id.h +5 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/insns.inc +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/insns_info.inc +310 -175
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/basic_operators.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/bits.h +82 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/encoding.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/error.h +26 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/fixnum.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/gc.h +14 -6
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/imemo.h +6 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/io.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/parse.h +2 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/proc.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/ractor.h +4 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/sanitizers.h +31 -39
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/string.h +22 -10
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/thread.h +23 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/vm.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/method.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/optunifs.inc +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/parse.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/ast.h +427 -3
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/defines.h +8 -7
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/diagnostic.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/extension.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/prism/prism.h +47 -11
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/version.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism_compile.h +5 -5
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/ractor_core.h +6 -6
- data/lib/debase/ruby_core_source/ruby-3.4.0/revision.h +5 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/rubyparser.h +3 -2
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/thread_pthread.h +0 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/version.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/vm.inc +151 -88
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/vm_core.h +40 -12
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/vm_sync.h +3 -3
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/vmtc.inc +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/yjit.h +1 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +147 -293
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/darray.h +0 -191
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/debug_counter.h +0 -423
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/dln.h +0 -34
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/id.h +0 -343
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/insns.inc +0 -259
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/insns_info.inc +0 -9530
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/array.h +0 -151
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/basic_operators.h +0 -63
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/bits.h +0 -568
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/class.h +0 -283
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/error.h +0 -216
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/fixnum.h +0 -184
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/gc.h +0 -334
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/hash.h +0 -191
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/imemo.h +0 -260
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/io.h +0 -140
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/parse.h +0 -117
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/ractor.h +0 -6
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/sanitizers.h +0 -297
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/string.h +0 -182
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/thread.h +0 -79
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/vm.h +0 -137
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/known_errors.inc +0 -1419
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/method.h +0 -255
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/optunifs.inc +0 -43
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/parse.h +0 -243
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/ast.h +0 -6245
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/defines.h +0 -206
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/diagnostic.h +0 -433
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/extension.h +0 -19
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/node.h +0 -150
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/options.h +0 -305
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/parser.h +0 -891
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/regexp.h +0 -33
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/static_literals.h +0 -120
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_char.h +0 -205
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_constant_pool.h +0 -226
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_integer.h +0 -119
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_newline_list.h +0 -102
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_string.h +0 -174
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_string_list.h +0 -44
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/version.h +0 -29
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism_compile.h +0 -88
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/ractor_core.h +0 -393
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/regint.h +0 -1010
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/revision.h +0 -5
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/rubyparser.h +0 -1430
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/shape.h +0 -233
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/symbol.h +0 -118
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/thread_pthread.h +0 -166
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/version.h +0 -69
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm.inc +0 -5643
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_callinfo.h +0 -605
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_core.h +0 -2236
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_insnhelper.h +0 -272
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_sync.h +0 -137
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vmtc.inc +0 -253
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/addr2line.h +0 -22
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/builtin.h +0 -119
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ccan/build_assert/build_assert.h +0 -40
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ccan/check_type/check_type.h +0 -63
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ccan/container_of/container_of.h +0 -142
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ccan/list/list.h +0 -791
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ccan/str/str.h +0 -17
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/constant.h +0 -53
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/encindex.h +0 -70
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/eval_intern.h +0 -324
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/hrtime.h +0 -237
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/id_table.h +0 -39
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/bignum.h +0 -244
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/cmdlineopt.h +0 -65
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/compar.h +0 -29
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/compile.h +0 -34
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/compilers.h +0 -107
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/complex.h +0 -29
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/cont.h +0 -35
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/dir.h +0 -16
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/enc.h +0 -19
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/encoding.h +0 -36
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/enum.h +0 -18
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/enumerator.h +0 -21
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/eval.h +0 -33
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/file.h +0 -38
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/inits.h +0 -47
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/load.h +0 -18
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/loadpath.h +0 -16
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/math.h +0 -23
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/missing.h +0 -19
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/numeric.h +0 -274
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/object.h +0 -63
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/proc.h +0 -30
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/process.h +0 -124
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/random.h +0 -17
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/range.h +0 -40
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/rational.h +0 -71
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/re.h +0 -28
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/ruby_parser.h +0 -102
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/serial.h +0 -23
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/signal.h +0 -24
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/st.h +0 -11
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/static_assert.h +0 -16
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/struct.h +0 -127
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/symbol.h +0 -45
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/time.h +0 -34
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/transcode.h +0 -23
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/util.h +0 -27
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/variable.h +0 -72
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/warnings.h +0 -16
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal.h +0 -108
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/iseq.h +0 -340
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/node.h +0 -111
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/node_name.inc +0 -224
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/optinsn.inc +0 -128
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/parser_bits.h +0 -564
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/parser_node.h +0 -32
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/parser_st.h +0 -162
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/parser_value.h +0 -106
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/encoding.h +0 -283
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/pack.h +0 -163
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/prettyprint.h +0 -34
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/prism.h +0 -336
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_buffer.h +0 -218
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_list.h +0 -97
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_memchr.h +0 -29
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_strncasecmp.h +0 -32
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_strpbrk.h +0 -46
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/probes_helper.h +0 -42
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/regenc.h +0 -254
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/regparse.h +0 -371
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/revision.h +0 -5
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/rjit.h +0 -101
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/rjit_c.h +0 -165
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ruby_assert.h +0 -14
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ruby_atomic.h +0 -23
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/siphash.h +0 -48
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/thread_none.h +0 -21
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/thread_win32.h +0 -58
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/timev.h +0 -58
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/transcode_data.h +0 -138
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/variable.h +0 -39
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_call_iseq_optimized.inc +0 -244
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_debug.h +0 -124
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_exec.h +0 -199
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_opts.h +0 -67
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/yjit.h +0 -79
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/addr2line.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/ccan/build_assert/build_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/ccan/check_type/check_type.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/ccan/container_of/container_of.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/ccan/list/list.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/ccan/str/str.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/constant.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/debug_counter.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/dln.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/encindex.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/eval_intern.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/hrtime.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/id_table.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/array.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/bignum.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/class.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/cmdlineopt.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/compar.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/compile.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/compilers.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/complex.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/cont.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/dir.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/enc.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/enum.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/enumerator.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/eval.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/file.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/internal/hash.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/inits.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/load.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/loadpath.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/math.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/missing.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/numeric.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/object.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/process.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/random.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/range.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/rational.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/re.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/ruby_parser.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/serial.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/signal.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/st.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/static_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/struct.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/symbol.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/time.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/transcode.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/util.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/variable.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal/warnings.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/internal.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/iseq.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/known_errors.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/node.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/node_name.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/optinsn.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/parser_bits.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/parser_node.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/parser_st.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/parser_value.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/prism/encoding.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/node.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/options.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/prism/pack.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/parser.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/prism/prettyprint.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/regexp.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/static_literals.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/prism/util/pm_buffer.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/util/pm_char.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/util/pm_constant_pool.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/util/pm_integer.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/prism/util/pm_list.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/prism/util/pm_memchr.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/util/pm_newline_list.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/prism/util/pm_string.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/prism/util/pm_strncasecmp.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/prism/util/pm_strpbrk.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/probes_helper.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/regenc.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/regint.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/regparse.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/rjit.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/rjit_c.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/ruby_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/ruby_atomic.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/shape.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/siphash.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/symbol.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/thread_none.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/thread_win32.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/timev.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/transcode_data.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/variable.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/vm_call_iseq_optimized.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/vm_callinfo.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/vm_debug.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/vm_exec.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview2 → ruby-3.4.0}/vm_insnhelper.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0}/vm_opts.h +0 -0
@@ -1,891 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @file parser.h
|
3
|
-
*
|
4
|
-
* The parser used to parse Ruby source.
|
5
|
-
*/
|
6
|
-
#ifndef PRISM_PARSER_H
|
7
|
-
#define PRISM_PARSER_H
|
8
|
-
|
9
|
-
#include "prism/defines.h"
|
10
|
-
#include "prism/ast.h"
|
11
|
-
#include "prism/encoding.h"
|
12
|
-
#include "prism/options.h"
|
13
|
-
#include "prism/static_literals.h"
|
14
|
-
#include "prism/util/pm_constant_pool.h"
|
15
|
-
#include "prism/util/pm_list.h"
|
16
|
-
#include "prism/util/pm_newline_list.h"
|
17
|
-
#include "prism/util/pm_string.h"
|
18
|
-
|
19
|
-
#include <stdbool.h>
|
20
|
-
|
21
|
-
/**
|
22
|
-
* This enum provides various bits that represent different kinds of states that
|
23
|
-
* the lexer can track. This is used to determine which kind of token to return
|
24
|
-
* based on the context of the parser.
|
25
|
-
*/
|
26
|
-
typedef enum {
|
27
|
-
PM_LEX_STATE_BIT_BEG,
|
28
|
-
PM_LEX_STATE_BIT_END,
|
29
|
-
PM_LEX_STATE_BIT_ENDARG,
|
30
|
-
PM_LEX_STATE_BIT_ENDFN,
|
31
|
-
PM_LEX_STATE_BIT_ARG,
|
32
|
-
PM_LEX_STATE_BIT_CMDARG,
|
33
|
-
PM_LEX_STATE_BIT_MID,
|
34
|
-
PM_LEX_STATE_BIT_FNAME,
|
35
|
-
PM_LEX_STATE_BIT_DOT,
|
36
|
-
PM_LEX_STATE_BIT_CLASS,
|
37
|
-
PM_LEX_STATE_BIT_LABEL,
|
38
|
-
PM_LEX_STATE_BIT_LABELED,
|
39
|
-
PM_LEX_STATE_BIT_FITEM
|
40
|
-
} pm_lex_state_bit_t;
|
41
|
-
|
42
|
-
/**
|
43
|
-
* This enum combines the various bits from the above enum into individual
|
44
|
-
* values that represent the various states of the lexer.
|
45
|
-
*/
|
46
|
-
typedef enum {
|
47
|
-
PM_LEX_STATE_NONE = 0,
|
48
|
-
PM_LEX_STATE_BEG = (1 << PM_LEX_STATE_BIT_BEG),
|
49
|
-
PM_LEX_STATE_END = (1 << PM_LEX_STATE_BIT_END),
|
50
|
-
PM_LEX_STATE_ENDARG = (1 << PM_LEX_STATE_BIT_ENDARG),
|
51
|
-
PM_LEX_STATE_ENDFN = (1 << PM_LEX_STATE_BIT_ENDFN),
|
52
|
-
PM_LEX_STATE_ARG = (1 << PM_LEX_STATE_BIT_ARG),
|
53
|
-
PM_LEX_STATE_CMDARG = (1 << PM_LEX_STATE_BIT_CMDARG),
|
54
|
-
PM_LEX_STATE_MID = (1 << PM_LEX_STATE_BIT_MID),
|
55
|
-
PM_LEX_STATE_FNAME = (1 << PM_LEX_STATE_BIT_FNAME),
|
56
|
-
PM_LEX_STATE_DOT = (1 << PM_LEX_STATE_BIT_DOT),
|
57
|
-
PM_LEX_STATE_CLASS = (1 << PM_LEX_STATE_BIT_CLASS),
|
58
|
-
PM_LEX_STATE_LABEL = (1 << PM_LEX_STATE_BIT_LABEL),
|
59
|
-
PM_LEX_STATE_LABELED = (1 << PM_LEX_STATE_BIT_LABELED),
|
60
|
-
PM_LEX_STATE_FITEM = (1 << PM_LEX_STATE_BIT_FITEM),
|
61
|
-
PM_LEX_STATE_BEG_ANY = PM_LEX_STATE_BEG | PM_LEX_STATE_MID | PM_LEX_STATE_CLASS,
|
62
|
-
PM_LEX_STATE_ARG_ANY = PM_LEX_STATE_ARG | PM_LEX_STATE_CMDARG,
|
63
|
-
PM_LEX_STATE_END_ANY = PM_LEX_STATE_END | PM_LEX_STATE_ENDARG | PM_LEX_STATE_ENDFN
|
64
|
-
} pm_lex_state_t;
|
65
|
-
|
66
|
-
/**
|
67
|
-
* The type of quote that a heredoc uses.
|
68
|
-
*/
|
69
|
-
typedef enum {
|
70
|
-
PM_HEREDOC_QUOTE_NONE,
|
71
|
-
PM_HEREDOC_QUOTE_SINGLE = '\'',
|
72
|
-
PM_HEREDOC_QUOTE_DOUBLE = '"',
|
73
|
-
PM_HEREDOC_QUOTE_BACKTICK = '`',
|
74
|
-
} pm_heredoc_quote_t;
|
75
|
-
|
76
|
-
/**
|
77
|
-
* The type of indentation that a heredoc uses.
|
78
|
-
*/
|
79
|
-
typedef enum {
|
80
|
-
PM_HEREDOC_INDENT_NONE,
|
81
|
-
PM_HEREDOC_INDENT_DASH,
|
82
|
-
PM_HEREDOC_INDENT_TILDE,
|
83
|
-
} pm_heredoc_indent_t;
|
84
|
-
|
85
|
-
/**
|
86
|
-
* When lexing Ruby source, the lexer has a small amount of state to tell which
|
87
|
-
* kind of token it is currently lexing. For example, when we find the start of
|
88
|
-
* a string, the first token that we return is a TOKEN_STRING_BEGIN token. After
|
89
|
-
* that the lexer is now in the PM_LEX_STRING mode, and will return tokens that
|
90
|
-
* are found as part of a string.
|
91
|
-
*/
|
92
|
-
typedef struct pm_lex_mode {
|
93
|
-
/** The type of this lex mode. */
|
94
|
-
enum {
|
95
|
-
/** This state is used when any given token is being lexed. */
|
96
|
-
PM_LEX_DEFAULT,
|
97
|
-
|
98
|
-
/**
|
99
|
-
* This state is used when we're lexing as normal but inside an embedded
|
100
|
-
* expression of a string.
|
101
|
-
*/
|
102
|
-
PM_LEX_EMBEXPR,
|
103
|
-
|
104
|
-
/**
|
105
|
-
* This state is used when we're lexing a variable that is embedded
|
106
|
-
* directly inside of a string with the # shorthand.
|
107
|
-
*/
|
108
|
-
PM_LEX_EMBVAR,
|
109
|
-
|
110
|
-
/** This state is used when you are inside the content of a heredoc. */
|
111
|
-
PM_LEX_HEREDOC,
|
112
|
-
|
113
|
-
/**
|
114
|
-
* This state is used when we are lexing a list of tokens, as in a %w
|
115
|
-
* word list literal or a %i symbol list literal.
|
116
|
-
*/
|
117
|
-
PM_LEX_LIST,
|
118
|
-
|
119
|
-
/**
|
120
|
-
* This state is used when a regular expression has been begun and we
|
121
|
-
* are looking for the terminator.
|
122
|
-
*/
|
123
|
-
PM_LEX_REGEXP,
|
124
|
-
|
125
|
-
/**
|
126
|
-
* This state is used when we are lexing a string or a string-like
|
127
|
-
* token, as in string content with either quote or an xstring.
|
128
|
-
*/
|
129
|
-
PM_LEX_STRING
|
130
|
-
} mode;
|
131
|
-
|
132
|
-
/** The data associated with this type of lex mode. */
|
133
|
-
union {
|
134
|
-
struct {
|
135
|
-
/** This keeps track of the nesting level of the list. */
|
136
|
-
size_t nesting;
|
137
|
-
|
138
|
-
/** Whether or not interpolation is allowed in this list. */
|
139
|
-
bool interpolation;
|
140
|
-
|
141
|
-
/**
|
142
|
-
* When lexing a list, it takes into account balancing the
|
143
|
-
* terminator if the terminator is one of (), [], {}, or <>.
|
144
|
-
*/
|
145
|
-
uint8_t incrementor;
|
146
|
-
|
147
|
-
/** This is the terminator of the list literal. */
|
148
|
-
uint8_t terminator;
|
149
|
-
|
150
|
-
/**
|
151
|
-
* This is the character set that should be used to delimit the
|
152
|
-
* tokens within the list.
|
153
|
-
*/
|
154
|
-
uint8_t breakpoints[11];
|
155
|
-
} list;
|
156
|
-
|
157
|
-
struct {
|
158
|
-
/**
|
159
|
-
* This keeps track of the nesting level of the regular expression.
|
160
|
-
*/
|
161
|
-
size_t nesting;
|
162
|
-
|
163
|
-
/**
|
164
|
-
* When lexing a regular expression, it takes into account balancing
|
165
|
-
* the terminator if the terminator is one of (), [], {}, or <>.
|
166
|
-
*/
|
167
|
-
uint8_t incrementor;
|
168
|
-
|
169
|
-
/** This is the terminator of the regular expression. */
|
170
|
-
uint8_t terminator;
|
171
|
-
|
172
|
-
/**
|
173
|
-
* This is the character set that should be used to delimit the
|
174
|
-
* tokens within the regular expression.
|
175
|
-
*/
|
176
|
-
uint8_t breakpoints[7];
|
177
|
-
} regexp;
|
178
|
-
|
179
|
-
struct {
|
180
|
-
/** This keeps track of the nesting level of the string. */
|
181
|
-
size_t nesting;
|
182
|
-
|
183
|
-
/** Whether or not interpolation is allowed in this string. */
|
184
|
-
bool interpolation;
|
185
|
-
|
186
|
-
/**
|
187
|
-
* Whether or not at the end of the string we should allow a :,
|
188
|
-
* which would indicate this was a dynamic symbol instead of a
|
189
|
-
* string.
|
190
|
-
*/
|
191
|
-
bool label_allowed;
|
192
|
-
|
193
|
-
/**
|
194
|
-
* When lexing a string, it takes into account balancing the
|
195
|
-
* terminator if the terminator is one of (), [], {}, or <>.
|
196
|
-
*/
|
197
|
-
uint8_t incrementor;
|
198
|
-
|
199
|
-
/**
|
200
|
-
* This is the terminator of the string. It is typically either a
|
201
|
-
* single or double quote.
|
202
|
-
*/
|
203
|
-
uint8_t terminator;
|
204
|
-
|
205
|
-
/**
|
206
|
-
* This is the character set that should be used to delimit the
|
207
|
-
* tokens within the string.
|
208
|
-
*/
|
209
|
-
uint8_t breakpoints[7];
|
210
|
-
} string;
|
211
|
-
|
212
|
-
struct {
|
213
|
-
/** A pointer to the start of the heredoc identifier. */
|
214
|
-
const uint8_t *ident_start;
|
215
|
-
|
216
|
-
/** The length of the heredoc identifier. */
|
217
|
-
size_t ident_length;
|
218
|
-
|
219
|
-
/** The type of quote that the heredoc uses. */
|
220
|
-
pm_heredoc_quote_t quote;
|
221
|
-
|
222
|
-
/** The type of indentation that the heredoc uses. */
|
223
|
-
pm_heredoc_indent_t indent;
|
224
|
-
|
225
|
-
/**
|
226
|
-
* This is the pointer to the character where lexing should resume
|
227
|
-
* once the heredoc has been completely processed.
|
228
|
-
*/
|
229
|
-
const uint8_t *next_start;
|
230
|
-
|
231
|
-
/**
|
232
|
-
* This is used to track the amount of common whitespace on each
|
233
|
-
* line so that we know how much to dedent each line in the case of
|
234
|
-
* a tilde heredoc.
|
235
|
-
*/
|
236
|
-
size_t common_whitespace;
|
237
|
-
|
238
|
-
/** True if the previous token ended with a line continuation. */
|
239
|
-
bool line_continuation;
|
240
|
-
} heredoc;
|
241
|
-
} as;
|
242
|
-
|
243
|
-
/** The previous lex state so that it knows how to pop. */
|
244
|
-
struct pm_lex_mode *prev;
|
245
|
-
} pm_lex_mode_t;
|
246
|
-
|
247
|
-
/**
|
248
|
-
* We pre-allocate a certain number of lex states in order to avoid having to
|
249
|
-
* call malloc too many times while parsing. You really shouldn't need more than
|
250
|
-
* this because you only really nest deeply when doing string interpolation.
|
251
|
-
*/
|
252
|
-
#define PM_LEX_STACK_SIZE 4
|
253
|
-
|
254
|
-
/**
|
255
|
-
* The parser used to parse Ruby source.
|
256
|
-
*/
|
257
|
-
typedef struct pm_parser pm_parser_t;
|
258
|
-
|
259
|
-
/**
|
260
|
-
* While parsing, we keep track of a stack of contexts. This is helpful for
|
261
|
-
* error recovery so that we can pop back to a previous context when we hit a
|
262
|
-
* token that is understood by a parent context but not by the current context.
|
263
|
-
*/
|
264
|
-
typedef enum {
|
265
|
-
/** a null context, used for returning a value from a function */
|
266
|
-
PM_CONTEXT_NONE = 0,
|
267
|
-
|
268
|
-
/** a begin statement */
|
269
|
-
PM_CONTEXT_BEGIN,
|
270
|
-
|
271
|
-
/** an ensure statement with an explicit begin */
|
272
|
-
PM_CONTEXT_BEGIN_ENSURE,
|
273
|
-
|
274
|
-
/** a rescue else statement with an explicit begin */
|
275
|
-
PM_CONTEXT_BEGIN_ELSE,
|
276
|
-
|
277
|
-
/** a rescue statement with an explicit begin */
|
278
|
-
PM_CONTEXT_BEGIN_RESCUE,
|
279
|
-
|
280
|
-
/** expressions in block arguments using braces */
|
281
|
-
PM_CONTEXT_BLOCK_BRACES,
|
282
|
-
|
283
|
-
/** expressions in block arguments using do..end */
|
284
|
-
PM_CONTEXT_BLOCK_KEYWORDS,
|
285
|
-
|
286
|
-
/** an ensure statement within a do..end block */
|
287
|
-
PM_CONTEXT_BLOCK_ENSURE,
|
288
|
-
|
289
|
-
/** a rescue else statement within a do..end block */
|
290
|
-
PM_CONTEXT_BLOCK_ELSE,
|
291
|
-
|
292
|
-
/** a rescue statement within a do..end block */
|
293
|
-
PM_CONTEXT_BLOCK_RESCUE,
|
294
|
-
|
295
|
-
/** a case when statements */
|
296
|
-
PM_CONTEXT_CASE_WHEN,
|
297
|
-
|
298
|
-
/** a case in statements */
|
299
|
-
PM_CONTEXT_CASE_IN,
|
300
|
-
|
301
|
-
/** a class declaration */
|
302
|
-
PM_CONTEXT_CLASS,
|
303
|
-
|
304
|
-
/** an ensure statement within a class statement */
|
305
|
-
PM_CONTEXT_CLASS_ENSURE,
|
306
|
-
|
307
|
-
/** a rescue else statement within a class statement */
|
308
|
-
PM_CONTEXT_CLASS_ELSE,
|
309
|
-
|
310
|
-
/** a rescue statement within a class statement */
|
311
|
-
PM_CONTEXT_CLASS_RESCUE,
|
312
|
-
|
313
|
-
/** a method definition */
|
314
|
-
PM_CONTEXT_DEF,
|
315
|
-
|
316
|
-
/** an ensure statement within a method definition */
|
317
|
-
PM_CONTEXT_DEF_ENSURE,
|
318
|
-
|
319
|
-
/** a rescue else statement within a method definition */
|
320
|
-
PM_CONTEXT_DEF_ELSE,
|
321
|
-
|
322
|
-
/** a rescue statement within a method definition */
|
323
|
-
PM_CONTEXT_DEF_RESCUE,
|
324
|
-
|
325
|
-
/** a method definition's parameters */
|
326
|
-
PM_CONTEXT_DEF_PARAMS,
|
327
|
-
|
328
|
-
/** a defined? expression */
|
329
|
-
PM_CONTEXT_DEFINED,
|
330
|
-
|
331
|
-
/** a method definition's default parameter */
|
332
|
-
PM_CONTEXT_DEFAULT_PARAMS,
|
333
|
-
|
334
|
-
/** an else clause */
|
335
|
-
PM_CONTEXT_ELSE,
|
336
|
-
|
337
|
-
/** an elsif clause */
|
338
|
-
PM_CONTEXT_ELSIF,
|
339
|
-
|
340
|
-
/** an interpolated expression */
|
341
|
-
PM_CONTEXT_EMBEXPR,
|
342
|
-
|
343
|
-
/** a for loop */
|
344
|
-
PM_CONTEXT_FOR,
|
345
|
-
|
346
|
-
/** a for loop's index */
|
347
|
-
PM_CONTEXT_FOR_INDEX,
|
348
|
-
|
349
|
-
/** an if statement */
|
350
|
-
PM_CONTEXT_IF,
|
351
|
-
|
352
|
-
/** a lambda expression with braces */
|
353
|
-
PM_CONTEXT_LAMBDA_BRACES,
|
354
|
-
|
355
|
-
/** a lambda expression with do..end */
|
356
|
-
PM_CONTEXT_LAMBDA_DO_END,
|
357
|
-
|
358
|
-
/** an ensure statement within a lambda expression */
|
359
|
-
PM_CONTEXT_LAMBDA_ENSURE,
|
360
|
-
|
361
|
-
/** a rescue else statement within a lambda expression */
|
362
|
-
PM_CONTEXT_LAMBDA_ELSE,
|
363
|
-
|
364
|
-
/** a rescue statement within a lambda expression */
|
365
|
-
PM_CONTEXT_LAMBDA_RESCUE,
|
366
|
-
|
367
|
-
/** the top level context */
|
368
|
-
PM_CONTEXT_MAIN,
|
369
|
-
|
370
|
-
/** a module declaration */
|
371
|
-
PM_CONTEXT_MODULE,
|
372
|
-
|
373
|
-
/** an ensure statement within a module statement */
|
374
|
-
PM_CONTEXT_MODULE_ENSURE,
|
375
|
-
|
376
|
-
/** a rescue else statement within a module statement */
|
377
|
-
PM_CONTEXT_MODULE_ELSE,
|
378
|
-
|
379
|
-
/** a rescue statement within a module statement */
|
380
|
-
PM_CONTEXT_MODULE_RESCUE,
|
381
|
-
|
382
|
-
/** a parenthesized expression */
|
383
|
-
PM_CONTEXT_PARENS,
|
384
|
-
|
385
|
-
/** an END block */
|
386
|
-
PM_CONTEXT_POSTEXE,
|
387
|
-
|
388
|
-
/** a predicate inside an if/elsif/unless statement */
|
389
|
-
PM_CONTEXT_PREDICATE,
|
390
|
-
|
391
|
-
/** a BEGIN block */
|
392
|
-
PM_CONTEXT_PREEXE,
|
393
|
-
|
394
|
-
/** a modifier rescue clause */
|
395
|
-
PM_CONTEXT_RESCUE_MODIFIER,
|
396
|
-
|
397
|
-
/** a singleton class definition */
|
398
|
-
PM_CONTEXT_SCLASS,
|
399
|
-
|
400
|
-
/** an ensure statement with a singleton class */
|
401
|
-
PM_CONTEXT_SCLASS_ENSURE,
|
402
|
-
|
403
|
-
/** a rescue else statement with a singleton class */
|
404
|
-
PM_CONTEXT_SCLASS_ELSE,
|
405
|
-
|
406
|
-
/** a rescue statement with a singleton class */
|
407
|
-
PM_CONTEXT_SCLASS_RESCUE,
|
408
|
-
|
409
|
-
/** a ternary expression */
|
410
|
-
PM_CONTEXT_TERNARY,
|
411
|
-
|
412
|
-
/** an unless statement */
|
413
|
-
PM_CONTEXT_UNLESS,
|
414
|
-
|
415
|
-
/** an until statement */
|
416
|
-
PM_CONTEXT_UNTIL,
|
417
|
-
|
418
|
-
/** a while statement */
|
419
|
-
PM_CONTEXT_WHILE,
|
420
|
-
} pm_context_t;
|
421
|
-
|
422
|
-
/** This is a node in a linked list of contexts. */
|
423
|
-
typedef struct pm_context_node {
|
424
|
-
/** The context that this node represents. */
|
425
|
-
pm_context_t context;
|
426
|
-
|
427
|
-
/** A pointer to the previous context in the linked list. */
|
428
|
-
struct pm_context_node *prev;
|
429
|
-
} pm_context_node_t;
|
430
|
-
|
431
|
-
/** This is the type of a comment that we've found while parsing. */
|
432
|
-
typedef enum {
|
433
|
-
PM_COMMENT_INLINE,
|
434
|
-
PM_COMMENT_EMBDOC
|
435
|
-
} pm_comment_type_t;
|
436
|
-
|
437
|
-
/**
|
438
|
-
* This is a node in the linked list of comments that we've found while parsing.
|
439
|
-
*
|
440
|
-
* @extends pm_list_node_t
|
441
|
-
*/
|
442
|
-
typedef struct pm_comment {
|
443
|
-
/** The embedded base node. */
|
444
|
-
pm_list_node_t node;
|
445
|
-
|
446
|
-
/** The location of the comment in the source. */
|
447
|
-
pm_location_t location;
|
448
|
-
|
449
|
-
/** The type of comment that we've found. */
|
450
|
-
pm_comment_type_t type;
|
451
|
-
} pm_comment_t;
|
452
|
-
|
453
|
-
/**
|
454
|
-
* This is a node in the linked list of magic comments that we've found while
|
455
|
-
* parsing.
|
456
|
-
*
|
457
|
-
* @extends pm_list_node_t
|
458
|
-
*/
|
459
|
-
typedef struct {
|
460
|
-
/** The embedded base node. */
|
461
|
-
pm_list_node_t node;
|
462
|
-
|
463
|
-
/** A pointer to the start of the key in the source. */
|
464
|
-
const uint8_t *key_start;
|
465
|
-
|
466
|
-
/** A pointer to the start of the value in the source. */
|
467
|
-
const uint8_t *value_start;
|
468
|
-
|
469
|
-
/** The length of the key in the source. */
|
470
|
-
uint32_t key_length;
|
471
|
-
|
472
|
-
/** The length of the value in the source. */
|
473
|
-
uint32_t value_length;
|
474
|
-
} pm_magic_comment_t;
|
475
|
-
|
476
|
-
/**
|
477
|
-
* When the encoding that is being used to parse the source is changed by prism,
|
478
|
-
* we provide the ability here to call out to a user-defined function.
|
479
|
-
*/
|
480
|
-
typedef void (*pm_encoding_changed_callback_t)(pm_parser_t *parser);
|
481
|
-
|
482
|
-
/**
|
483
|
-
* When you are lexing through a file, the lexer needs all of the information
|
484
|
-
* that the parser additionally provides (for example, the local table). So if
|
485
|
-
* you want to properly lex Ruby, you need to actually lex it in the context of
|
486
|
-
* the parser. In order to provide this functionality, we optionally allow a
|
487
|
-
* struct to be attached to the parser that calls back out to a user-provided
|
488
|
-
* callback when each token is lexed.
|
489
|
-
*/
|
490
|
-
typedef struct {
|
491
|
-
/**
|
492
|
-
* This opaque pointer is used to provide whatever information the user
|
493
|
-
* deemed necessary to the callback. In our case we use it to pass the array
|
494
|
-
* that the tokens get appended into.
|
495
|
-
*/
|
496
|
-
void *data;
|
497
|
-
|
498
|
-
/**
|
499
|
-
* This is the callback that is called when a token is lexed. It is passed
|
500
|
-
* the opaque data pointer, the parser, and the token that was lexed.
|
501
|
-
*/
|
502
|
-
void (*callback)(void *data, pm_parser_t *parser, pm_token_t *token);
|
503
|
-
} pm_lex_callback_t;
|
504
|
-
|
505
|
-
/** The type of shareable constant value that can be set. */
|
506
|
-
typedef uint8_t pm_shareable_constant_value_t;
|
507
|
-
static const pm_shareable_constant_value_t PM_SCOPE_SHAREABLE_CONSTANT_NONE = 0x0;
|
508
|
-
static const pm_shareable_constant_value_t PM_SCOPE_SHAREABLE_CONSTANT_LITERAL = 0x1;
|
509
|
-
static const pm_shareable_constant_value_t PM_SCOPE_SHAREABLE_CONSTANT_EXPERIMENTAL_EVERYTHING = 0x2;
|
510
|
-
static const pm_shareable_constant_value_t PM_SCOPE_SHAREABLE_CONSTANT_EXPERIMENTAL_COPY = 0x4;
|
511
|
-
|
512
|
-
/**
|
513
|
-
* This tracks an individual local variable in a certain lexical context, as
|
514
|
-
* well as the number of times is it read.
|
515
|
-
*/
|
516
|
-
typedef struct {
|
517
|
-
/** The name of the local variable. */
|
518
|
-
pm_constant_id_t name;
|
519
|
-
|
520
|
-
/** The location of the local variable in the source. */
|
521
|
-
pm_location_t location;
|
522
|
-
|
523
|
-
/** The index of the local variable in the local table. */
|
524
|
-
uint32_t index;
|
525
|
-
|
526
|
-
/** The number of times the local variable is read. */
|
527
|
-
uint32_t reads;
|
528
|
-
|
529
|
-
/** The hash of the local variable. */
|
530
|
-
uint32_t hash;
|
531
|
-
} pm_local_t;
|
532
|
-
|
533
|
-
/**
|
534
|
-
* This is a set of local variables in a certain lexical context (method, class,
|
535
|
-
* module, etc.). We need to track how many times these variables are read in
|
536
|
-
* order to warn if they only get written.
|
537
|
-
*/
|
538
|
-
typedef struct pm_locals {
|
539
|
-
/** The number of local variables in the set. */
|
540
|
-
uint32_t size;
|
541
|
-
|
542
|
-
/** The capacity of the local variables set. */
|
543
|
-
uint32_t capacity;
|
544
|
-
|
545
|
-
/** The nullable allocated memory for the local variables in the set. */
|
546
|
-
pm_local_t *locals;
|
547
|
-
} pm_locals_t;
|
548
|
-
|
549
|
-
/**
|
550
|
-
* This struct represents a node in a linked list of scopes. Some scopes can see
|
551
|
-
* into their parent scopes, while others cannot.
|
552
|
-
*/
|
553
|
-
typedef struct pm_scope {
|
554
|
-
/** A pointer to the previous scope in the linked list. */
|
555
|
-
struct pm_scope *previous;
|
556
|
-
|
557
|
-
/** The IDs of the locals in the given scope. */
|
558
|
-
pm_locals_t locals;
|
559
|
-
|
560
|
-
/**
|
561
|
-
* This is a bitfield that indicates the parameters that are being used in
|
562
|
-
* this scope. It is a combination of the PM_SCOPE_PARAMS_* constants. There
|
563
|
-
* are three different kinds of parameters that can be used in a scope:
|
564
|
-
*
|
565
|
-
* - Ordinary parameters (e.g., def foo(bar); end)
|
566
|
-
* - Numbered parameters (e.g., def foo; _1; end)
|
567
|
-
* - The it parameter (e.g., def foo; it; end)
|
568
|
-
*
|
569
|
-
* If ordinary parameters are being used, then certain parameters can be
|
570
|
-
* forwarded to another method/structure. Those are indicated by four
|
571
|
-
* additional bits in the params field. For example, some combinations of:
|
572
|
-
*
|
573
|
-
* - def foo(*); end
|
574
|
-
* - def foo(**); end
|
575
|
-
* - def foo(&); end
|
576
|
-
* - def foo(...); end
|
577
|
-
*/
|
578
|
-
uint8_t parameters;
|
579
|
-
|
580
|
-
/**
|
581
|
-
* An integer indicating the number of numbered parameters on this scope.
|
582
|
-
* This is necessary to determine if child blocks are allowed to use
|
583
|
-
* numbered parameters, and to pass information to consumers of the AST
|
584
|
-
* about how many numbered parameters exist.
|
585
|
-
*/
|
586
|
-
int8_t numbered_parameters;
|
587
|
-
|
588
|
-
/**
|
589
|
-
* The current state of constant shareability for this scope. This is
|
590
|
-
* changed by magic shareable_constant_value comments.
|
591
|
-
*/
|
592
|
-
pm_shareable_constant_value_t shareable_constant;
|
593
|
-
|
594
|
-
/**
|
595
|
-
* A boolean indicating whether or not this scope can see into its parent.
|
596
|
-
* If closed is true, then the scope cannot see into its parent.
|
597
|
-
*/
|
598
|
-
bool closed;
|
599
|
-
} pm_scope_t;
|
600
|
-
|
601
|
-
static const uint8_t PM_SCOPE_PARAMETERS_NONE = 0x0;
|
602
|
-
static const uint8_t PM_SCOPE_PARAMETERS_ORDINARY = 0x1;
|
603
|
-
static const uint8_t PM_SCOPE_PARAMETERS_NUMBERED = 0x2;
|
604
|
-
static const uint8_t PM_SCOPE_PARAMETERS_IT = 0x4;
|
605
|
-
static const uint8_t PM_SCOPE_PARAMETERS_TYPE_MASK = 0x7;
|
606
|
-
|
607
|
-
static const uint8_t PM_SCOPE_PARAMETERS_FORWARDING_POSITIONALS = 0x8;
|
608
|
-
static const uint8_t PM_SCOPE_PARAMETERS_FORWARDING_KEYWORDS = 0x10;
|
609
|
-
static const uint8_t PM_SCOPE_PARAMETERS_FORWARDING_BLOCK = 0x20;
|
610
|
-
static const uint8_t PM_SCOPE_PARAMETERS_FORWARDING_ALL = 0x40;
|
611
|
-
|
612
|
-
static const int8_t PM_SCOPE_NUMBERED_PARAMETERS_DISALLOWED = -1;
|
613
|
-
static const int8_t PM_SCOPE_NUMBERED_PARAMETERS_NONE = 0;
|
614
|
-
|
615
|
-
/**
|
616
|
-
* A struct that represents a stack of boolean values.
|
617
|
-
*/
|
618
|
-
typedef uint32_t pm_state_stack_t;
|
619
|
-
|
620
|
-
/**
|
621
|
-
* This struct represents the overall parser. It contains a reference to the
|
622
|
-
* source file, as well as pointers that indicate where in the source it's
|
623
|
-
* currently parsing. It also contains the most recent and current token that
|
624
|
-
* it's considering.
|
625
|
-
*/
|
626
|
-
struct pm_parser {
|
627
|
-
/** The current state of the lexer. */
|
628
|
-
pm_lex_state_t lex_state;
|
629
|
-
|
630
|
-
/** Tracks the current nesting of (), [], and {}. */
|
631
|
-
int enclosure_nesting;
|
632
|
-
|
633
|
-
/**
|
634
|
-
* Used to temporarily track the nesting of enclosures to determine if a {
|
635
|
-
* is the beginning of a lambda following the parameters of a lambda.
|
636
|
-
*/
|
637
|
-
int lambda_enclosure_nesting;
|
638
|
-
|
639
|
-
/**
|
640
|
-
* Used to track the nesting of braces to ensure we get the correct value
|
641
|
-
* when we are interpolating blocks with braces.
|
642
|
-
*/
|
643
|
-
int brace_nesting;
|
644
|
-
|
645
|
-
/**
|
646
|
-
* The stack used to determine if a do keyword belongs to the predicate of a
|
647
|
-
* while, until, or for loop.
|
648
|
-
*/
|
649
|
-
pm_state_stack_t do_loop_stack;
|
650
|
-
|
651
|
-
/**
|
652
|
-
* The stack used to determine if a do keyword belongs to the beginning of a
|
653
|
-
* block.
|
654
|
-
*/
|
655
|
-
pm_state_stack_t accepts_block_stack;
|
656
|
-
|
657
|
-
/** A stack of lex modes. */
|
658
|
-
struct {
|
659
|
-
/** The current mode of the lexer. */
|
660
|
-
pm_lex_mode_t *current;
|
661
|
-
|
662
|
-
/** The stack of lexer modes. */
|
663
|
-
pm_lex_mode_t stack[PM_LEX_STACK_SIZE];
|
664
|
-
|
665
|
-
/** The current index into the lexer mode stack. */
|
666
|
-
size_t index;
|
667
|
-
} lex_modes;
|
668
|
-
|
669
|
-
/** The pointer to the start of the source. */
|
670
|
-
const uint8_t *start;
|
671
|
-
|
672
|
-
/** The pointer to the end of the source. */
|
673
|
-
const uint8_t *end;
|
674
|
-
|
675
|
-
/** The previous token we were considering. */
|
676
|
-
pm_token_t previous;
|
677
|
-
|
678
|
-
/** The current token we're considering. */
|
679
|
-
pm_token_t current;
|
680
|
-
|
681
|
-
/**
|
682
|
-
* This is a special field set on the parser when we need the parser to jump
|
683
|
-
* to a specific location when lexing the next token, as opposed to just
|
684
|
-
* using the end of the previous token. Normally this is NULL.
|
685
|
-
*/
|
686
|
-
const uint8_t *next_start;
|
687
|
-
|
688
|
-
/**
|
689
|
-
* This field indicates the end of a heredoc whose identifier was found on
|
690
|
-
* the current line. If another heredoc is found on the same line, then this
|
691
|
-
* will be moved forward to the end of that heredoc. If no heredocs are
|
692
|
-
* found on a line then this is NULL.
|
693
|
-
*/
|
694
|
-
const uint8_t *heredoc_end;
|
695
|
-
|
696
|
-
/** The list of comments that have been found while parsing. */
|
697
|
-
pm_list_t comment_list;
|
698
|
-
|
699
|
-
/** The list of magic comments that have been found while parsing. */
|
700
|
-
pm_list_t magic_comment_list;
|
701
|
-
|
702
|
-
/**
|
703
|
-
* An optional location that represents the location of the __END__ marker
|
704
|
-
* and the rest of the content of the file. This content is loaded into the
|
705
|
-
* DATA constant when the file being parsed is the main file being executed.
|
706
|
-
*/
|
707
|
-
pm_location_t data_loc;
|
708
|
-
|
709
|
-
/** The list of warnings that have been found while parsing. */
|
710
|
-
pm_list_t warning_list;
|
711
|
-
|
712
|
-
/** The list of errors that have been found while parsing. */
|
713
|
-
pm_list_t error_list;
|
714
|
-
|
715
|
-
/** The current local scope. */
|
716
|
-
pm_scope_t *current_scope;
|
717
|
-
|
718
|
-
/** The current parsing context. */
|
719
|
-
pm_context_node_t *current_context;
|
720
|
-
|
721
|
-
/**
|
722
|
-
* The hash keys for the hash that is currently being parsed. This is not
|
723
|
-
* usually necessary because it can pass it down the various call chains,
|
724
|
-
* but in the event that you're parsing a hash that is being directly
|
725
|
-
* pushed into another hash with **, we need to share the hash keys so that
|
726
|
-
* we can warn for the nested hash as well.
|
727
|
-
*/
|
728
|
-
pm_static_literals_t *current_hash_keys;
|
729
|
-
|
730
|
-
/**
|
731
|
-
* The encoding functions for the current file is attached to the parser as
|
732
|
-
* it's parsing so that it can change with a magic comment.
|
733
|
-
*/
|
734
|
-
const pm_encoding_t *encoding;
|
735
|
-
|
736
|
-
/**
|
737
|
-
* When the encoding that is being used to parse the source is changed by
|
738
|
-
* prism, we provide the ability here to call out to a user-defined
|
739
|
-
* function.
|
740
|
-
*/
|
741
|
-
pm_encoding_changed_callback_t encoding_changed_callback;
|
742
|
-
|
743
|
-
/**
|
744
|
-
* This pointer indicates where a comment must start if it is to be
|
745
|
-
* considered an encoding comment.
|
746
|
-
*/
|
747
|
-
const uint8_t *encoding_comment_start;
|
748
|
-
|
749
|
-
/**
|
750
|
-
* This is an optional callback that can be attached to the parser that will
|
751
|
-
* be called whenever a new token is lexed by the parser.
|
752
|
-
*/
|
753
|
-
pm_lex_callback_t *lex_callback;
|
754
|
-
|
755
|
-
/**
|
756
|
-
* This is the path of the file being parsed. We use the filepath when
|
757
|
-
* constructing SourceFileNodes.
|
758
|
-
*/
|
759
|
-
pm_string_t filepath;
|
760
|
-
|
761
|
-
/**
|
762
|
-
* This constant pool keeps all of the constants defined throughout the file
|
763
|
-
* so that we can reference them later.
|
764
|
-
*/
|
765
|
-
pm_constant_pool_t constant_pool;
|
766
|
-
|
767
|
-
/** This is the list of newline offsets in the source file. */
|
768
|
-
pm_newline_list_t newline_list;
|
769
|
-
|
770
|
-
/**
|
771
|
-
* We want to add a flag to integer nodes that indicates their base. We only
|
772
|
-
* want to parse these once, but we don't have space on the token itself to
|
773
|
-
* communicate this information. So we store it here and pass it through
|
774
|
-
* when we find tokens that we need it for.
|
775
|
-
*/
|
776
|
-
pm_node_flags_t integer_base;
|
777
|
-
|
778
|
-
/**
|
779
|
-
* This string is used to pass information from the lexer to the parser. It
|
780
|
-
* is particularly necessary because of escape sequences.
|
781
|
-
*/
|
782
|
-
pm_string_t current_string;
|
783
|
-
|
784
|
-
/**
|
785
|
-
* The line number at the start of the parse. This will be used to offset
|
786
|
-
* the line numbers of all of the locations.
|
787
|
-
*/
|
788
|
-
int32_t start_line;
|
789
|
-
|
790
|
-
/**
|
791
|
-
* When a string-like expression is being lexed, any byte or escape sequence
|
792
|
-
* that resolves to a value whose top bit is set (i.e., >= 0x80) will
|
793
|
-
* explicitly set the encoding to the same encoding as the source.
|
794
|
-
* Alternatively, if a unicode escape sequence is used (e.g., \\u{80}) that
|
795
|
-
* resolves to a value whose top bit is set, then the encoding will be
|
796
|
-
* explicitly set to UTF-8.
|
797
|
-
*
|
798
|
-
* The _next_ time this happens, if the encoding that is about to become the
|
799
|
-
* explicitly set encoding does not match the previously set explicit
|
800
|
-
* encoding, a mixed encoding error will be emitted.
|
801
|
-
*
|
802
|
-
* When the expression is finished being lexed, the explicit encoding
|
803
|
-
* controls the encoding of the expression. For the most part this means
|
804
|
-
* that the expression will either be encoded in the source encoding or
|
805
|
-
* UTF-8. This holds for all encodings except US-ASCII. If the source is
|
806
|
-
* US-ASCII and an explicit encoding was set that was _not_ UTF-8, then the
|
807
|
-
* expression will be encoded as ASCII-8BIT.
|
808
|
-
*
|
809
|
-
* Note that if the expression is a list, different elements within the same
|
810
|
-
* list can have different encodings, so this will get reset between each
|
811
|
-
* element. Furthermore all of this only applies to lists that support
|
812
|
-
* interpolation, because otherwise escapes that could change the encoding
|
813
|
-
* are ignored.
|
814
|
-
*
|
815
|
-
* At first glance, it may make more sense for this to live on the lexer
|
816
|
-
* mode, but we need it here to communicate back to the parser for character
|
817
|
-
* literals that do not push a new lexer mode.
|
818
|
-
*/
|
819
|
-
const pm_encoding_t *explicit_encoding;
|
820
|
-
|
821
|
-
/**
|
822
|
-
* When parsing block exits (e.g., break, next, redo), we need to validate
|
823
|
-
* that they are in correct contexts. For the most part we can do this by
|
824
|
-
* looking at our parent contexts. However, modifier while and until
|
825
|
-
* expressions can change that context to make block exits valid. In these
|
826
|
-
* cases, we need to keep track of the block exits and then validate them
|
827
|
-
* after the expression has been parsed.
|
828
|
-
*
|
829
|
-
* We use a pointer here because we don't want to keep a whole list attached
|
830
|
-
* since this will only be used in the context of begin/end expressions.
|
831
|
-
*/
|
832
|
-
pm_node_list_t *current_block_exits;
|
833
|
-
|
834
|
-
/** The version of prism that we should use to parse. */
|
835
|
-
pm_options_version_t version;
|
836
|
-
|
837
|
-
/** The command line flags given from the options. */
|
838
|
-
uint8_t command_line;
|
839
|
-
|
840
|
-
/**
|
841
|
-
* Whether or not we have found a frozen_string_literal magic comment with
|
842
|
-
* a true or false value.
|
843
|
-
* May be:
|
844
|
-
* - PM_OPTIONS_FROZEN_STRING_LITERAL_DISABLED
|
845
|
-
* - PM_OPTIONS_FROZEN_STRING_LITERAL_ENABLED
|
846
|
-
* - PM_OPTIONS_FROZEN_STRING_LITERAL_UNSET
|
847
|
-
*/
|
848
|
-
int8_t frozen_string_literal;
|
849
|
-
|
850
|
-
/**
|
851
|
-
* Whether or not we are parsing an eval string. This impacts whether or not
|
852
|
-
* we should evaluate if block exits/yields are valid.
|
853
|
-
*/
|
854
|
-
bool parsing_eval;
|
855
|
-
|
856
|
-
/** Whether or not we're at the beginning of a command. */
|
857
|
-
bool command_start;
|
858
|
-
|
859
|
-
/** Whether or not we're currently recovering from a syntax error. */
|
860
|
-
bool recovering;
|
861
|
-
|
862
|
-
/**
|
863
|
-
* Whether or not the encoding has been changed by a magic comment. We use
|
864
|
-
* this to provide a fast path for the lexer instead of going through the
|
865
|
-
* function pointer.
|
866
|
-
*/
|
867
|
-
bool encoding_changed;
|
868
|
-
|
869
|
-
/**
|
870
|
-
* This flag indicates that we are currently parsing a pattern matching
|
871
|
-
* expression and impacts that calculation of newlines.
|
872
|
-
*/
|
873
|
-
bool pattern_matching_newlines;
|
874
|
-
|
875
|
-
/** This flag indicates that we are currently parsing a keyword argument. */
|
876
|
-
bool in_keyword_arg;
|
877
|
-
|
878
|
-
/**
|
879
|
-
* Whether or not the parser has seen a token that has semantic meaning
|
880
|
-
* (i.e., a token that is not a comment or whitespace).
|
881
|
-
*/
|
882
|
-
bool semantic_token_seen;
|
883
|
-
|
884
|
-
/**
|
885
|
-
* True if the current regular expression being lexed contains only ASCII
|
886
|
-
* characters.
|
887
|
-
*/
|
888
|
-
bool current_regular_expression_ascii_only;
|
889
|
-
};
|
890
|
-
|
891
|
-
#endif
|