demotape 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +9 -0
- data/Makefile +4 -2
- data/README.md +101 -10
- data/demotape.gemspec +1 -1
- data/demotape.y +224 -505
- data/demotape_new.y.backup +160 -0
- data/demotape_simple_test.y +32 -0
- data/editors/sublime-text/DemoTape.sublime-completions +4 -0
- data/editors/sublime-text/DemoTape.sublime-syntax +24 -2
- data/editors/vim/syntax/demotape.vim +16 -2
- data/editors/vscode/demotape.tmLanguage.json +31 -3
- data/lib/demo_tape/cli.rb +36 -0
- data/lib/demo_tape/command.rb +63 -103
- data/lib/demo_tape/exporter.rb +3 -0
- data/lib/demo_tape/formatter.rb +142 -0
- data/lib/demo_tape/lexer.rb +118 -34
- data/lib/demo_tape/parser/helpers.rb +363 -0
- data/lib/demo_tape/parser/rules.rb +396 -0
- data/lib/demo_tape/parser.rb +381 -592
- data/lib/demo_tape/runner.rb +82 -27
- data/lib/demo_tape/token.rb +86 -0
- data/lib/demo_tape/version.rb +1 -1
- data/lib/demo_tape.rb +5 -2
- metadata +10 -527
- data/examples/alt.mp4 +0 -0
- data/examples/alt.png +0 -0
- data/examples/alt.tape +0 -9
- data/examples/arrow.mp4 +0 -0
- data/examples/arrow.png +0 -0
- data/examples/arrow.tape +0 -7
- data/examples/backspace.mp4 +0 -0
- data/examples/backspace.png +0 -0
- data/examples/backspace.tape +0 -4
- data/examples/bash.mp4 +0 -0
- data/examples/bash.png +0 -0
- data/examples/bash.tape +0 -4
- data/examples/bg.jpg +0 -0
- data/examples/clear.mp4 +0 -0
- data/examples/clear.png +0 -0
- data/examples/clear.tape +0 -6
- data/examples/cli_ui_interactive_prompt.mp4 +0 -0
- data/examples/cli_ui_interactive_prompt.png +0 -0
- data/examples/cli_ui_interactive_prompt.tape +0 -16
- data/examples/cli_ui_nested_frames.mp4 +0 -0
- data/examples/cli_ui_nested_frames.png +0 -0
- data/examples/cli_ui_nested_frames.tape +0 -15
- data/examples/cli_ui_progress.mp4 +0 -0
- data/examples/cli_ui_progress.png +0 -0
- data/examples/cli_ui_progress.tape +0 -6
- data/examples/cli_ui_spinner.mp4 +0 -0
- data/examples/cli_ui_spinner.png +0 -0
- data/examples/cli_ui_spinner.tape +0 -6
- data/examples/cli_ui_status_widget.mp4 +0 -0
- data/examples/cli_ui_status_widget.png +0 -0
- data/examples/cli_ui_status_widget.tape +0 -6
- data/examples/cli_ui_symbols.mp4 +0 -0
- data/examples/cli_ui_symbols.png +0 -0
- data/examples/cli_ui_symbols.tape +0 -6
- data/examples/cli_ui_text_prompt.mp4 +0 -0
- data/examples/cli_ui_text_prompt.png +0 -0
- data/examples/cli_ui_text_prompt.tape +0 -10
- data/examples/clipboard.mp4 +0 -0
- data/examples/clipboard.png +0 -0
- data/examples/clipboard.tape +0 -5
- data/examples/ctrl.mp4 +0 -0
- data/examples/ctrl.png +0 -0
- data/examples/ctrl.tape +0 -5
- data/examples/ctrl_arrows.mp4 +0 -0
- data/examples/ctrl_arrows.png +0 -0
- data/examples/ctrl_arrows.tape +0 -14
- data/examples/demotape.mp4 +0 -0
- data/examples/demotape.png +0 -0
- data/examples/demotape.tape +0 -6
- data/examples/demotape.txt +0 -13
- data/examples/enter.mp4 +0 -0
- data/examples/enter.png +0 -0
- data/examples/enter.tape +0 -3
- data/examples/errors/include_itself.tape +0 -1
- data/examples/fastfetch.gif +0 -0
- data/examples/fastfetch.mp4 +0 -0
- data/examples/fastfetch.png +0 -0
- data/examples/fastfetch.tape +0 -11
- data/examples/fish.mp4 +0 -0
- data/examples/fish.png +0 -0
- data/examples/fish.tape +0 -4
- data/examples/format.mp4 +0 -0
- data/examples/format.png +0 -0
- data/examples/format.tape +0 -15
- data/examples/gh-cli.mp4 +0 -0
- data/examples/gh-cli.png +0 -0
- data/examples/gh-cli.tape +0 -13
- data/examples/gif_loop.gif +0 -0
- data/examples/gif_loop.png +0 -0
- data/examples/gif_loop.tape +0 -5
- data/examples/include.mp4 +0 -0
- data/examples/include.png +0 -0
- data/examples/include.tape +0 -1
- data/examples/include_with_set.mp4 +0 -0
- data/examples/include_with_set.png +0 -0
- data/examples/include_with_set.tape +0 -2
- data/examples/meta/cli.tape +0 -10
- data/examples/nerdfonts.mp4 +0 -0
- data/examples/nerdfonts.png +0 -0
- data/examples/nerdfonts.tape +0 -9
- data/examples/output.avi +0 -0
- data/examples/output.gif +0 -0
- data/examples/output.mov +0 -0
- data/examples/output.mp4 +0 -0
- data/examples/output.png +0 -0
- data/examples/output.tape +0 -9
- data/examples/output.webm +0 -0
- data/examples/products.json +0 -1803
- data/examples/screenshot.mp4 +0 -0
- data/examples/screenshot.png +0 -0
- data/examples/screenshot.tape +0 -9
- data/examples/script.rb +0 -3
- data/examples/set_cursor_bar.mp4 +0 -0
- data/examples/set_cursor_bar.png +0 -0
- data/examples/set_cursor_bar.tape +0 -5
- data/examples/set_cursor_blink.mp4 +0 -0
- data/examples/set_cursor_blink.png +0 -0
- data/examples/set_cursor_blink.tape +0 -4
- data/examples/set_cursor_underline.mp4 +0 -0
- data/examples/set_cursor_underline.png +0 -0
- data/examples/set_cursor_underline.tape +0 -5
- data/examples/set_dimensions.mp4 +0 -0
- data/examples/set_dimensions.png +0 -0
- data/examples/set_dimensions.tape +0 -5
- data/examples/set_font_family.mp4 +0 -0
- data/examples/set_font_family.png +0 -0
- data/examples/set_font_family.tape +0 -4
- data/examples/set_font_size.mp4 +0 -0
- data/examples/set_font_size.png +0 -0
- data/examples/set_font_size.tape +0 -4
- data/examples/set_line_height.mp4 +0 -0
- data/examples/set_line_height.png +0 -0
- data/examples/set_line_height.tape +0 -8
- data/examples/set_margin.mp4 +0 -0
- data/examples/set_margin.png +0 -0
- data/examples/set_margin.tape +0 -7
- data/examples/set_margin_with_border_radius.mp4 +0 -0
- data/examples/set_margin_with_border_radius.png +0 -0
- data/examples/set_margin_with_border_radius.tape +0 -8
- data/examples/set_margin_with_image.mp4 +0 -0
- data/examples/set_margin_with_image.png +0 -0
- data/examples/set_margin_with_image.tape +0 -7
- data/examples/set_padding.mp4 +0 -0
- data/examples/set_padding.png +0 -0
- data/examples/set_padding.tape +0 -7
- data/examples/set_theme.mp4 +0 -0
- data/examples/set_theme.png +0 -0
- data/examples/set_theme.tape +0 -9
- data/examples/set_theme_property.mp4 +0 -0
- data/examples/set_theme_property.png +0 -0
- data/examples/set_theme_property.tape +0 -10
- data/examples/set_typing_speed.mp4 +0 -0
- data/examples/set_typing_speed.png +0 -0
- data/examples/set_typing_speed.tape +0 -6
- data/examples/slides.mp4 +0 -0
- data/examples/slides.png +0 -0
- data/examples/slides.tape +0 -14
- data/examples/space.mp4 +0 -0
- data/examples/space.png +0 -0
- data/examples/space.tape +0 -3
- data/examples/stdin.mp4 +0 -0
- data/examples/stdin.png +0 -0
- data/examples/stdin.tape +0 -7
- data/examples/tab.mp4 +0 -0
- data/examples/tab.png +0 -0
- data/examples/tab.tape +0 -5
- data/examples/themes/3024_day.png +0 -0
- data/examples/themes/3024_night.png +0 -0
- data/examples/themes/aardvark_blue.png +0 -0
- data/examples/themes/abernathy.png +0 -0
- data/examples/themes/adventure.png +0 -0
- data/examples/themes/adventure_time.png +0 -0
- data/examples/themes/afterglow.png +0 -0
- data/examples/themes/alabaster.png +0 -0
- data/examples/themes/alien_blood.png +0 -0
- data/examples/themes/andromeda.png +0 -0
- data/examples/themes/apple_classic.png +0 -0
- data/examples/themes/apple_system_colors.png +0 -0
- data/examples/themes/arcoiris.png +0 -0
- data/examples/themes/argonaut.png +0 -0
- data/examples/themes/arthur.png +0 -0
- data/examples/themes/atelier_sulphurpool.png +0 -0
- data/examples/themes/atom.png +0 -0
- data/examples/themes/atom_one_light.png +0 -0
- data/examples/themes/aurora.png +0 -0
- data/examples/themes/ayu.png +0 -0
- data/examples/themes/ayu_light.png +0 -0
- data/examples/themes/ayu_mirage.png +0 -0
- data/examples/themes/banana_blueberry.png +0 -0
- data/examples/themes/batman.png +0 -0
- data/examples/themes/belafonte_day.png +0 -0
- data/examples/themes/belafonte_night.png +0 -0
- data/examples/themes/birds_of_paradise.png +0 -0
- data/examples/themes/blazer.png +0 -0
- data/examples/themes/blue_berry_pie.png +0 -0
- data/examples/themes/blue_dolphin.png +0 -0
- data/examples/themes/blue_matrix.png +0 -0
- data/examples/themes/bluloco_dark.png +0 -0
- data/examples/themes/bluloco_light.png +0 -0
- data/examples/themes/borland.png +0 -0
- data/examples/themes/breeze.png +0 -0
- data/examples/themes/bright_lights.png +0 -0
- data/examples/themes/broadcast.png +0 -0
- data/examples/themes/brogrammer.png +0 -0
- data/examples/themes/bubbles.png +0 -0
- data/examples/themes/builtin_dark.png +0 -0
- data/examples/themes/builtin_light.png +0 -0
- data/examples/themes/builtin_pastel_dark.png +0 -0
- data/examples/themes/builtin_solarized_dark.png +0 -0
- data/examples/themes/builtin_solarized_light.png +0 -0
- data/examples/themes/builtin_tango_dark.png +0 -0
- data/examples/themes/builtin_tango_light.png +0 -0
- data/examples/themes/c64.png +0 -0
- data/examples/themes/calamity.png +0 -0
- data/examples/themes/catppuccin_frappe.png +0 -0
- data/examples/themes/catppuccin_latte.png +0 -0
- data/examples/themes/catppuccin_macchiato.png +0 -0
- data/examples/themes/catppuccin_mocha.png +0 -0
- data/examples/themes/cga.png +0 -0
- data/examples/themes/chalk.png +0 -0
- data/examples/themes/chalkboard.png +0 -0
- data/examples/themes/challenger_deep.png +0 -0
- data/examples/themes/chester.png +0 -0
- data/examples/themes/ciapre.png +0 -0
- data/examples/themes/clrs.png +0 -0
- data/examples/themes/cobalt2.png +0 -0
- data/examples/themes/cobalt_neon.png +0 -0
- data/examples/themes/coffee_theme.png +0 -0
- data/examples/themes/contrast_light.png +0 -0
- data/examples/themes/coolnight.png +0 -0
- data/examples/themes/crayon_pony_fish.png +0 -0
- data/examples/themes/crystal_violet.png +0 -0
- data/examples/themes/cutie_pro.png +0 -0
- data/examples/themes/cyber_cube.png +0 -0
- data/examples/themes/cyber_punk2077.png +0 -0
- data/examples/themes/cyberdyne.png +0 -0
- data/examples/themes/cyberpunk.png +0 -0
- data/examples/themes/dark_pastel.png +0 -0
- data/examples/themes/dark_plus.png +0 -0
- data/examples/themes/darkermatrix.png +0 -0
- data/examples/themes/darkmatrix.png +0 -0
- data/examples/themes/darkside.png +0 -0
- data/examples/themes/dayfox.png +0 -0
- data/examples/themes/deep.png +0 -0
- data/examples/themes/desert.png +0 -0
- data/examples/themes/dimmed_monokai.png +0 -0
- data/examples/themes/django.png +0 -0
- data/examples/themes/django_reborn_again.png +0 -0
- data/examples/themes/django_smooth.png +0 -0
- data/examples/themes/doom_one.png +0 -0
- data/examples/themes/doom_peacock.png +0 -0
- data/examples/themes/dot_gov.png +0 -0
- data/examples/themes/dracula.png +0 -0
- data/examples/themes/dracula_plus.png +0 -0
- data/examples/themes/duckbones.png +0 -0
- data/examples/themes/duotone_dark.png +0 -0
- data/examples/themes/earthsong.png +0 -0
- data/examples/themes/elemental.png +0 -0
- data/examples/themes/elementary.png +0 -0
- data/examples/themes/encom.png +0 -0
- data/examples/themes/espresso.png +0 -0
- data/examples/themes/espresso_libre.png +0 -0
- data/examples/themes/everblush.png +0 -0
- data/examples/themes/fahrenheit.png +0 -0
- data/examples/themes/fairyfloss.png +0 -0
- data/examples/themes/farmhouse_dark.png +0 -0
- data/examples/themes/farmhouse_light.png +0 -0
- data/examples/themes/fideloper.png +0 -0
- data/examples/themes/firefly_traditional.png +0 -0
- data/examples/themes/firefox_dev.png +0 -0
- data/examples/themes/firewatch.png +0 -0
- data/examples/themes/fish_tank.png +0 -0
- data/examples/themes/flat.png +0 -0
- data/examples/themes/flatland.png +0 -0
- data/examples/themes/flexoki_dark.png +0 -0
- data/examples/themes/flexoki_light.png +0 -0
- data/examples/themes/floraverse.png +0 -0
- data/examples/themes/forest_blue.png +0 -0
- data/examples/themes/framer.png +0 -0
- data/examples/themes/front_end_delight.png +0 -0
- data/examples/themes/fun_forrest.png +0 -0
- data/examples/themes/galaxy.png +0 -0
- data/examples/themes/galizur.png +0 -0
- data/examples/themes/ganyu.png +0 -0
- data/examples/themes/git_hub_dark.png +0 -0
- data/examples/themes/github.png +0 -0
- data/examples/themes/glacier.png +0 -0
- data/examples/themes/glorious.png +0 -0
- data/examples/themes/grape.png +0 -0
- data/examples/themes/grass.png +0 -0
- data/examples/themes/grey_green.png +0 -0
- data/examples/themes/gruvbox_dark.png +0 -0
- data/examples/themes/gruvbox_dark_hard.png +0 -0
- data/examples/themes/gruvbox_light.png +0 -0
- data/examples/themes/guezwhoz.png +0 -0
- data/examples/themes/h4rithd.png +0 -0
- data/examples/themes/h4rithd_com.png +0 -0
- data/examples/themes/ha_x0_r_blue.png +0 -0
- data/examples/themes/ha_x0_r_gr33_n.png +0 -0
- data/examples/themes/ha_x0_r_r3_d.png +0 -0
- data/examples/themes/hacktober.png +0 -0
- data/examples/themes/hardcore.png +0 -0
- data/examples/themes/harper.png +0 -0
- data/examples/themes/highway.png +0 -0
- data/examples/themes/hipster_green.png +0 -0
- data/examples/themes/hivacruz.png +0 -0
- data/examples/themes/homebrew.png +0 -0
- data/examples/themes/hopscotch.png +0 -0
- data/examples/themes/hopscotch_256.png +0 -0
- data/examples/themes/horizon.png +0 -0
- data/examples/themes/hurtado.png +0 -0
- data/examples/themes/hybrid.png +0 -0
- data/examples/themes/hyper.png +0 -0
- data/examples/themes/ic_green_ppl.png +0 -0
- data/examples/themes/ic_orange_ppl.png +0 -0
- data/examples/themes/iceberg_dark.png +0 -0
- data/examples/themes/iceberg_light.png +0 -0
- data/examples/themes/idea.png +0 -0
- data/examples/themes/idle_toes.png +0 -0
- data/examples/themes/ir_black.png +0 -0
- data/examples/themes/iterm2_dark_background.png +0 -0
- data/examples/themes/iterm2_default.png +0 -0
- data/examples/themes/iterm2_light_background.png +0 -0
- data/examples/themes/iterm2_pastel_dark_background.png +0 -0
- data/examples/themes/iterm2_smoooooth.png +0 -0
- data/examples/themes/iterm2_solarized_dark.png +0 -0
- data/examples/themes/iterm2_solarized_light.png +0 -0
- data/examples/themes/iterm2_tango_dark.png +0 -0
- data/examples/themes/iterm2_tango_light.png +0 -0
- data/examples/themes/jackie_brown.png +0 -0
- data/examples/themes/japanesque.png +0 -0
- data/examples/themes/jellybeans.png +0 -0
- data/examples/themes/jet_brains_darcula.png +0 -0
- data/examples/themes/jubi.png +0 -0
- data/examples/themes/juicy_colors.png +0 -0
- data/examples/themes/kanagawa.png +0 -0
- data/examples/themes/kanagawabones.png +0 -0
- data/examples/themes/kibble.png +0 -0
- data/examples/themes/kolorit.png +0 -0
- data/examples/themes/konsolas.png +0 -0
- data/examples/themes/lab_fox.png +0 -0
- data/examples/themes/laser.png +0 -0
- data/examples/themes/later_this_evening.png +0 -0
- data/examples/themes/lavandula.png +0 -0
- data/examples/themes/liquid_carbon.png +0 -0
- data/examples/themes/liquid_carbon_transparent.png +0 -0
- data/examples/themes/liquid_carbon_transparent_inverse.png +0 -0
- data/examples/themes/lovelace.png +0 -0
- data/examples/themes/man_page.png +0 -0
- data/examples/themes/mariana.png +0 -0
- data/examples/themes/material.png +0 -0
- data/examples/themes/material_dark.png +0 -0
- data/examples/themes/material_darker.png +0 -0
- data/examples/themes/material_design_colors.png +0 -0
- data/examples/themes/material_ocean.png +0 -0
- data/examples/themes/mathias.png +0 -0
- data/examples/themes/matrix.png +0 -0
- data/examples/themes/medallion.png +0 -0
- data/examples/themes/mellifluous.png +0 -0
- data/examples/themes/midnight_in_mojave.png +0 -0
- data/examples/themes/mirage.png +0 -0
- data/examples/themes/misterioso.png +0 -0
- data/examples/themes/molokai.png +0 -0
- data/examples/themes/mona_lisa.png +0 -0
- data/examples/themes/monokai_cmder.png +0 -0
- data/examples/themes/monokai_pro.png +0 -0
- data/examples/themes/monokai_pro_filter_octagon.png +0 -0
- data/examples/themes/monokai_pro_filter_ristretto.png +0 -0
- data/examples/themes/monokai_remastered.png +0 -0
- data/examples/themes/monokai_soda.png +0 -0
- data/examples/themes/monokai_vivid.png +0 -0
- data/examples/themes/moonlight_ii.png +0 -0
- data/examples/themes/n0tch2k.png +0 -0
- data/examples/themes/neobones_dark.png +0 -0
- data/examples/themes/neobones_light.png +0 -0
- data/examples/themes/neon.png +0 -0
- data/examples/themes/neopolitan.png +0 -0
- data/examples/themes/neutron.png +0 -0
- data/examples/themes/night_city.png +0 -0
- data/examples/themes/night_lion_v1.png +0 -0
- data/examples/themes/night_lion_v2.png +0 -0
- data/examples/themes/night_owlish_light.png +0 -0
- data/examples/themes/nightfox.png +0 -0
- data/examples/themes/niji.png +0 -0
- data/examples/themes/nocturnal_winter.png +0 -0
- data/examples/themes/nord.png +0 -0
- data/examples/themes/nord_light.png +0 -0
- data/examples/themes/novel.png +0 -0
- data/examples/themes/nvim_dark.png +0 -0
- data/examples/themes/nvim_light.png +0 -0
- data/examples/themes/obsidian.png +0 -0
- data/examples/themes/ocean.png +0 -0
- data/examples/themes/oceanic_material.png +0 -0
- data/examples/themes/oceanic_next.png +0 -0
- data/examples/themes/ollie.png +0 -0
- data/examples/themes/one_dark.png +0 -0
- data/examples/themes/one_half_dark.png +0 -0
- data/examples/themes/one_half_light.png +0 -0
- data/examples/themes/one_star.png +0 -0
- data/examples/themes/operator_mono_dark.png +0 -0
- data/examples/themes/overnight_slumber.png +0 -0
- data/examples/themes/pale_night_hc.png +0 -0
- data/examples/themes/pandora.png +0 -0
- data/examples/themes/paraiso_dark.png +0 -0
- data/examples/themes/paul_millr.png +0 -0
- data/examples/themes/pencil_dark.png +0 -0
- data/examples/themes/pencil_light.png +0 -0
- data/examples/themes/peppermint.png +0 -0
- data/examples/themes/piatto_light.png +0 -0
- data/examples/themes/pnevma.png +0 -0
- data/examples/themes/popping_and_locking.png +0 -0
- data/examples/themes/primary.png +0 -0
- data/examples/themes/primer.png +0 -0
- data/examples/themes/pro.png +0 -0
- data/examples/themes/pro_light.png +0 -0
- data/examples/themes/purple_rain.png +0 -0
- data/examples/themes/purplepeter.png +0 -0
- data/examples/themes/qb64_super_dark_blue.png +0 -0
- data/examples/themes/rapture.png +0 -0
- data/examples/themes/raycast_dark.png +0 -0
- data/examples/themes/raycast_light.png +0 -0
- data/examples/themes/rebecca.png +0 -0
- data/examples/themes/red_alert.png +0 -0
- data/examples/themes/red_planet.png +0 -0
- data/examples/themes/red_sands.png +0 -0
- data/examples/themes/relaxed.png +0 -0
- data/examples/themes/retro.png +0 -0
- data/examples/themes/retrowave.png +0 -0
- data/examples/themes/rippedcasts.png +0 -0
- data/examples/themes/rose_pine.png +0 -0
- data/examples/themes/rose_pine_dawn.png +0 -0
- data/examples/themes/rose_pine_moon.png +0 -0
- data/examples/themes/rouge_2.png +0 -0
- data/examples/themes/royal.png +0 -0
- data/examples/themes/ryuuko.png +0 -0
- data/examples/themes/sakura.png +0 -0
- data/examples/themes/scarlet_protocol.png +0 -0
- data/examples/themes/sea_shells.png +0 -0
- data/examples/themes/seafoam_pastel.png +0 -0
- data/examples/themes/seoulbones_dark.png +0 -0
- data/examples/themes/seoulbones_light.png +0 -0
- data/examples/themes/serendipity_midnight.png +0 -0
- data/examples/themes/serendipity_morning.png +0 -0
- data/examples/themes/serendipity_sunset.png +0 -0
- data/examples/themes/seti.png +0 -0
- data/examples/themes/shades_of_purple.png +0 -0
- data/examples/themes/shaman.png +0 -0
- data/examples/themes/slate.png +0 -0
- data/examples/themes/sleepy_hollow.png +0 -0
- data/examples/themes/smyck.png +0 -0
- data/examples/themes/snazzy.png +0 -0
- data/examples/themes/soft_server.png +0 -0
- data/examples/themes/solarized_darcula.png +0 -0
- data/examples/themes/solarized_dark_higher_contrast.png +0 -0
- data/examples/themes/solarized_dark_patched.png +0 -0
- data/examples/themes/sonoran_gothic.png +0 -0
- data/examples/themes/sonoran_sunrise.png +0 -0
- data/examples/themes/space_gray.png +0 -0
- data/examples/themes/space_gray_eighties.png +0 -0
- data/examples/themes/space_gray_eighties_dull.png +0 -0
- data/examples/themes/spacedust.png +0 -0
- data/examples/themes/spiderman.png +0 -0
- data/examples/themes/spring.png +0 -0
- data/examples/themes/square.png +0 -0
- data/examples/themes/sublette.png +0 -0
- data/examples/themes/subliminal.png +0 -0
- data/examples/themes/sundried.png +0 -0
- data/examples/themes/symfonic.png +0 -0
- data/examples/themes/synthwave.png +0 -0
- data/examples/themes/synthwave_alpha.png +0 -0
- data/examples/themes/synthwave_everything.png +0 -0
- data/examples/themes/tango_adapted.png +0 -0
- data/examples/themes/tango_half_adapted.png +0 -0
- data/examples/themes/teerb.png +0 -0
- data/examples/themes/terafox.png +0 -0
- data/examples/themes/terminal_basic.png +0 -0
- data/examples/themes/thayer_bright.png +0 -0
- data/examples/themes/the_hulk.png +0 -0
- data/examples/themes/theme.tape +0 -13
- data/examples/themes/tinacious_design_dark.png +0 -0
- data/examples/themes/tinacious_design_light.png +0 -0
- data/examples/themes/tokyo_night.png +0 -0
- data/examples/themes/tokyo_night_light.png +0 -0
- data/examples/themes/tokyo_night_storm.png +0 -0
- data/examples/themes/tokyonight.png +0 -0
- data/examples/themes/tokyonight_day.png +0 -0
- data/examples/themes/tokyonight_storm.png +0 -0
- data/examples/themes/tomorrow.png +0 -0
- data/examples/themes/tomorrow_night.png +0 -0
- data/examples/themes/tomorrow_night_blue.png +0 -0
- data/examples/themes/tomorrow_night_bright.png +0 -0
- data/examples/themes/tomorrow_night_burns.png +0 -0
- data/examples/themes/tomorrow_night_eighties.png +0 -0
- data/examples/themes/toy_chest.png +0 -0
- data/examples/themes/treehouse.png +0 -0
- data/examples/themes/twilight.png +0 -0
- data/examples/themes/ubuntu.png +0 -0
- data/examples/themes/ultra_dark.png +0 -0
- data/examples/themes/ultra_violent.png +0 -0
- data/examples/themes/under_the_sea.png +0 -0
- data/examples/themes/unholy.png +0 -0
- data/examples/themes/unikitty.png +0 -0
- data/examples/themes/urple.png +0 -0
- data/examples/themes/vaughn.png +0 -0
- data/examples/themes/vesper.png +0 -0
- data/examples/themes/vibrant_ink.png +0 -0
- data/examples/themes/vimbones.png +0 -0
- data/examples/themes/violet_dark.png +0 -0
- data/examples/themes/violet_light.png +0 -0
- data/examples/themes/warm_neon.png +0 -0
- data/examples/themes/wez.png +0 -0
- data/examples/themes/whimsy.png +0 -0
- data/examples/themes/wild_cherry.png +0 -0
- data/examples/themes/wilmersdorf.png +0 -0
- data/examples/themes/wombat.png +0 -0
- data/examples/themes/wryan.png +0 -0
- data/examples/themes/zenbones.png +0 -0
- data/examples/themes/zenbones_dark.png +0 -0
- data/examples/themes/zenbones_light.png +0 -0
- data/examples/themes/zenburn.png +0 -0
- data/examples/themes/zenburned.png +0 -0
- data/examples/themes/zenwritten_dark.png +0 -0
- data/examples/themes/zenwritten_light.png +0 -0
- data/examples/themes/zeonica.png +0 -0
- data/examples/tmux.mp4 +0 -0
- data/examples/tmux.png +0 -0
- data/examples/tmux.tape +0 -28
- data/examples/type.mp4 +0 -0
- data/examples/type.png +0 -0
- data/examples/type.tape +0 -11
- data/examples/type_file.mp4 +0 -0
- data/examples/type_file.png +0 -0
- data/examples/type_file.tape +0 -23
- data/examples/variable_typing.mp4 +0 -0
- data/examples/variable_typing.png +0 -0
- data/examples/variable_typing.tape +0 -41
- data/examples/wait_until.mp4 +0 -0
- data/examples/wait_until.png +0 -0
- data/examples/wait_until.tape +0 -8
- data/examples/zsh.mp4 +0 -0
- data/examples/zsh.png +0 -0
- data/examples/zsh.tape +0 -4
data/lib/demo_tape/parser.rb
CHANGED
|
@@ -10,199 +10,179 @@ require 'racc/parser.rb'
|
|
|
10
10
|
module DemoTape
|
|
11
11
|
class Parser < Racc::Parser
|
|
12
12
|
|
|
13
|
-
module_eval(<<'...end demotape.y/module_eval...', 'demotape.y',
|
|
13
|
+
module_eval(<<'...end demotape.y/module_eval...', 'demotape.y', 228)
|
|
14
|
+
include Helpers
|
|
15
|
+
|
|
14
16
|
def parse(str, file: "<unknown>")
|
|
15
17
|
@file = file
|
|
16
18
|
@lexer = DemoTape::Lexer.new
|
|
17
19
|
@tokens = @lexer.tokenize(str)
|
|
18
20
|
@token_index = 0
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def next_token
|
|
23
|
-
token = @tokens.shift
|
|
24
|
-
@current_token_index = @token_index
|
|
25
|
-
@token_index += 1
|
|
26
|
-
token
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def make_token(type, value, index)
|
|
30
|
-
line_info = @lexer.line_map[index] || {}
|
|
31
|
-
token_class = case type
|
|
32
|
-
when :identifier then Token::Identifier
|
|
33
|
-
when :string then Token::String
|
|
34
|
-
when :number then Token::Number
|
|
35
|
-
when :duration then Token::Duration
|
|
36
|
-
when :regex then Token::Regex
|
|
37
|
-
when :time_unit then Token::TimeUnit
|
|
38
|
-
when :operator then Token::Operator
|
|
39
|
-
else Token::Base
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
token_class.new(
|
|
43
|
-
value,
|
|
44
|
-
line: line_info[:line],
|
|
45
|
-
column: line_info[:column],
|
|
46
|
-
raw: line_info[:raw]
|
|
47
|
-
)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def attach_location(command, duration_index: nil, speed_index: nil, timeout_index: nil)
|
|
51
|
-
line_info = @lexer.line_map[@command_start_index] || {}
|
|
52
|
-
command.line = line_info[:line]
|
|
53
|
-
command.column = line_info[:column]
|
|
54
|
-
command.line_content = line_info[:content]
|
|
55
|
-
command.file = @file
|
|
56
|
-
|
|
57
|
-
# Attach duration/speed/timeout specific columns if provided
|
|
58
|
-
if duration_index
|
|
59
|
-
duration_info = @lexer.line_map[duration_index] || {}
|
|
60
|
-
command.duration_column = duration_info[:column]
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
if speed_index
|
|
64
|
-
speed_info = @lexer.line_map[speed_index] || {}
|
|
65
|
-
command.speed_column = speed_info[:column]
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
if timeout_index
|
|
69
|
-
timeout_info = @lexer.line_map[timeout_index] || {}
|
|
70
|
-
command.timeout_column = timeout_info[:column]
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
command
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def on_error(token_id, token_value, value_stack)
|
|
77
|
-
# Get line metadata from the lexer's line map
|
|
78
|
-
line_info = @lexer.line_map[@current_token_index] || {}
|
|
79
|
-
line_num = line_info[:line] || "?"
|
|
80
|
-
col_num = line_info[:column] || 1
|
|
81
|
-
line_content = line_info[:content] || ""
|
|
82
|
-
|
|
83
|
-
token_name = token_to_str(token_id) || token_id.to_s
|
|
84
|
-
|
|
85
|
-
error_msg = "Unexpected token #{token_name.inspect} at #{@file}:#{line_num}:#{col_num}:\n"
|
|
86
|
-
error_msg += " #{line_content}\n"
|
|
87
|
-
error_msg += " #{' ' * (col_num - 1)}^"
|
|
88
|
-
|
|
89
|
-
raise DemoTape::ParseError, error_msg
|
|
21
|
+
@token_indices = {} # Map token object_id to its index
|
|
22
|
+
validate_tree!(do_parse)
|
|
90
23
|
end
|
|
91
24
|
|
|
92
25
|
...end demotape.y/module_eval...
|
|
93
26
|
##### State transition tables begin ###
|
|
94
27
|
|
|
95
28
|
racc_action_table = [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
29
|
+
5, 4, 6, 22, 17, 10, 11, 12, 13, 14,
|
|
30
|
+
15, 16, 18, 19, 20, 21, 5, 4, 6, 24,
|
|
31
|
+
17, 10, 11, 12, 13, 14, 15, 16, 18, 19,
|
|
32
|
+
20, 21, 44, 41, 42, 30, 17, 10, 11, 12,
|
|
33
|
+
13, 14, 15, 16, 18, 19, 20, 21, 44, 41,
|
|
34
|
+
42, 31, 17, 10, 11, 12, 13, 14, 15, 16,
|
|
35
|
+
18, 19, 20, 21, 44, 41, 42, 45, 17, 10,
|
|
36
|
+
11, 12, 13, 14, 15, 16, 18, 19, 20, 21,
|
|
37
|
+
44, 41, 42, 47, 17, 10, 11, 12, 13, 14,
|
|
38
|
+
15, 16, 18, 19, 20, 21, 44, 41, 42, 51,
|
|
39
|
+
17, 10, 11, 12, 13, 14, 15, 16, 18, 19,
|
|
40
|
+
20, 21, 25, 48, 49, 17, 10, 11, 12, 13,
|
|
41
|
+
14, 15, 16, 18, 19, 20, 21, 54, 56, 57,
|
|
42
|
+
17, 10, 11, 12, 13, 14, 15, 16, 18, 19,
|
|
43
|
+
20, 21, 27, 28, 17, 10, 11, 12, 13, 14,
|
|
44
|
+
15, 16, 18, 19, 20, 21, 32, 33, 17, 10,
|
|
45
|
+
11, 12, 13, 14, 15, 16, 18, 19, 20, 21,
|
|
46
|
+
52, 59, 17, 10, 11, 12, 13, 14, 15, 16,
|
|
47
|
+
18, 19, 20, 21, 61, 60, 17, 10, 11, 12,
|
|
48
|
+
13, 14, 15, 16, 18, 19, 20, 21, 34, 36,
|
|
49
|
+
35, 37, 63, 64, 68, 67, 62, 65, 66, 69,
|
|
50
|
+
70, 71, 72, 73, 74, 75, 76 ]
|
|
102
51
|
|
|
103
52
|
racc_action_check = [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
53
|
+
0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
|
|
54
|
+
0, 0, 0, 0, 0, 0, 2, 2, 2, 4,
|
|
55
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
56
|
+
2, 2, 34, 34, 34, 22, 34, 34, 34, 34,
|
|
57
|
+
34, 34, 34, 34, 34, 34, 34, 34, 36, 36,
|
|
58
|
+
36, 25, 36, 36, 36, 36, 36, 36, 36, 36,
|
|
59
|
+
36, 36, 36, 36, 39, 39, 39, 35, 39, 39,
|
|
60
|
+
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
|
|
61
|
+
45, 45, 45, 37, 45, 45, 45, 45, 45, 45,
|
|
62
|
+
45, 45, 45, 45, 45, 45, 47, 47, 47, 41,
|
|
63
|
+
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
|
|
64
|
+
47, 47, 5, 38, 38, 5, 5, 5, 5, 5,
|
|
65
|
+
5, 5, 5, 5, 5, 5, 5, 44, 46, 46,
|
|
66
|
+
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
|
67
|
+
44, 44, 8, 8, 8, 8, 8, 8, 8, 8,
|
|
68
|
+
8, 8, 8, 8, 8, 8, 26, 26, 26, 26,
|
|
69
|
+
26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
|
|
70
|
+
43, 48, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
71
|
+
43, 43, 43, 43, 53, 49, 53, 53, 53, 53,
|
|
72
|
+
53, 53, 53, 53, 53, 53, 53, 53, 28, 33,
|
|
73
|
+
28, 33, 55, 55, 58, 58, 54, 56, 57, 60,
|
|
74
|
+
63, 64, 66, 67, 68, 71, 73 ]
|
|
110
75
|
|
|
111
76
|
racc_action_pointer = [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
nil,
|
|
115
|
-
nil, nil, nil,
|
|
116
|
-
nil,
|
|
117
|
-
|
|
118
|
-
nil
|
|
77
|
+
-3, 3, 13, nil, 14, 108, nil, nil, 137, nil,
|
|
78
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
|
79
|
+
nil, nil, 35, nil, nil, 46, 151, nil, 193, nil,
|
|
80
|
+
nil, nil, nil, 194, 29, 62, 45, 78, 111, 61,
|
|
81
|
+
nil, 94, nil, 165, 123, 77, 126, 93, 166, 183,
|
|
82
|
+
nil, nil, nil, 179, 201, 200, 202, 206, 202, nil,
|
|
83
|
+
204, nil, nil, 205, 209, nil, 207, 211, 209, nil,
|
|
84
|
+
nil, 210, nil, 211, nil, nil, nil ]
|
|
119
85
|
|
|
120
86
|
racc_action_default = [
|
|
121
|
-
-2, -
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
87
|
+
-2, -42, -1, -3, -42, -42, -7, -8, -42, -28,
|
|
88
|
+
-30, -31, -32, -33, -34, -35, -36, -37, -38, -39,
|
|
89
|
+
-40, -41, -42, -4, -5, -42, -42, -9, -42, -29,
|
|
90
|
+
77, -6, -10, -42, -19, -42, -19, -42, -42, -20,
|
|
91
|
+
-21, -42, -24, -42, -42, -19, -42, -19, -42, -42,
|
|
92
|
+
-22, -23, -25, -42, -42, -42, -42, -42, -42, -11,
|
|
93
|
+
-42, -26, -27, -42, -42, -13, -42, -42, -42, -12,
|
|
94
|
+
-15, -42, -14, -42, -18, -16, -17 ]
|
|
128
95
|
|
|
129
96
|
racc_goto_table = [
|
|
130
|
-
|
|
97
|
+
29, 38, 8, 46, 8, 1, 3, 26, 23, 2,
|
|
98
|
+
50, nil, 55, nil, 58, nil, nil, nil, 29, nil,
|
|
131
99
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
|
132
|
-
nil, nil, nil, nil, nil,
|
|
100
|
+
nil, nil, nil, nil, nil, 29, nil, nil, nil, nil,
|
|
101
|
+
nil, nil, nil, nil, nil, 29, 53 ]
|
|
133
102
|
|
|
134
103
|
racc_goto_check = [
|
|
135
|
-
|
|
104
|
+
9, 6, 5, 6, 5, 1, 3, 5, 3, 2,
|
|
105
|
+
8, nil, 6, nil, 6, nil, nil, nil, 9, nil,
|
|
136
106
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
|
137
|
-
nil, nil, nil, nil, nil,
|
|
107
|
+
nil, nil, nil, nil, nil, 9, nil, nil, nil, nil,
|
|
108
|
+
nil, nil, nil, nil, nil, 9, 5 ]
|
|
138
109
|
|
|
139
110
|
racc_goto_pointer = [
|
|
140
|
-
nil,
|
|
111
|
+
nil, 5, 9, 6, nil, 2, -33, nil, -29, -8 ]
|
|
141
112
|
|
|
142
113
|
racc_goto_default = [
|
|
143
|
-
nil, nil, nil, nil,
|
|
114
|
+
nil, nil, nil, nil, 7, 43, nil, 39, 40, 9 ]
|
|
144
115
|
|
|
145
116
|
racc_reduce_table = [
|
|
146
117
|
0, 0, :racc_error,
|
|
147
|
-
1,
|
|
148
|
-
0,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
3,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
1,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
1,
|
|
183
|
-
1,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
118
|
+
1, 20, :_reduce_1,
|
|
119
|
+
0, 20, :_reduce_2,
|
|
120
|
+
1, 21, :_reduce_3,
|
|
121
|
+
2, 21, :_reduce_4,
|
|
122
|
+
2, 22, :_reduce_5,
|
|
123
|
+
3, 22, :_reduce_6,
|
|
124
|
+
1, 22, :_reduce_7,
|
|
125
|
+
1, 22, :_reduce_8,
|
|
126
|
+
2, 22, :_reduce_9,
|
|
127
|
+
3, 22, :_reduce_10,
|
|
128
|
+
6, 23, :_reduce_11,
|
|
129
|
+
7, 23, :_reduce_12,
|
|
130
|
+
7, 23, :_reduce_13,
|
|
131
|
+
8, 23, :_reduce_14,
|
|
132
|
+
7, 23, :_reduce_15,
|
|
133
|
+
8, 23, :_reduce_16,
|
|
134
|
+
9, 23, :_reduce_17,
|
|
135
|
+
8, 23, :_reduce_18,
|
|
136
|
+
0, 25, :_reduce_19,
|
|
137
|
+
1, 25, :_reduce_20,
|
|
138
|
+
1, 26, :_reduce_21,
|
|
139
|
+
2, 26, :_reduce_22,
|
|
140
|
+
2, 27, :_reduce_23,
|
|
141
|
+
1, 27, :_reduce_24,
|
|
142
|
+
2, 27, :_reduce_25,
|
|
143
|
+
3, 27, :_reduce_26,
|
|
144
|
+
3, 27, :_reduce_27,
|
|
145
|
+
1, 24, :_reduce_28,
|
|
146
|
+
2, 24, :_reduce_29,
|
|
147
|
+
1, 28, :_reduce_30,
|
|
148
|
+
1, 28, :_reduce_31,
|
|
149
|
+
1, 28, :_reduce_32,
|
|
150
|
+
1, 28, :_reduce_33,
|
|
151
|
+
1, 28, :_reduce_34,
|
|
152
|
+
1, 28, :_reduce_35,
|
|
153
|
+
1, 28, :_reduce_36,
|
|
154
|
+
1, 28, :_reduce_37,
|
|
155
|
+
1, 28, :_reduce_38,
|
|
156
|
+
1, 28, :_reduce_39,
|
|
157
|
+
1, 28, :_reduce_40,
|
|
158
|
+
1, 28, :_reduce_41 ]
|
|
159
|
+
|
|
160
|
+
racc_reduce_n = 42
|
|
161
|
+
|
|
162
|
+
racc_shift_n = 77
|
|
189
163
|
|
|
190
164
|
racc_token_table = {
|
|
191
165
|
false => 0,
|
|
192
166
|
:error => 1,
|
|
193
|
-
:
|
|
194
|
-
:
|
|
195
|
-
:
|
|
196
|
-
:
|
|
197
|
-
:
|
|
198
|
-
:
|
|
199
|
-
:
|
|
200
|
-
:
|
|
201
|
-
:
|
|
202
|
-
:
|
|
203
|
-
:
|
|
204
|
-
|
|
205
|
-
|
|
167
|
+
:END => 2,
|
|
168
|
+
:LEADING_SPACE => 3,
|
|
169
|
+
:COMMENT => 4,
|
|
170
|
+
:NEWLINE => 5,
|
|
171
|
+
:DO => 6,
|
|
172
|
+
:TRAILING_SPACE => 7,
|
|
173
|
+
:IDENTIFIER => 8,
|
|
174
|
+
:STRING => 9,
|
|
175
|
+
:MULTILINE_STRING => 10,
|
|
176
|
+
:NUMBER => 11,
|
|
177
|
+
:DURATION => 12,
|
|
178
|
+
:REGEX => 13,
|
|
179
|
+
:SPACE => 14,
|
|
180
|
+
:COMMA => 15,
|
|
181
|
+
:PLUS => 16,
|
|
182
|
+
:AT => 17,
|
|
183
|
+
:TIME_UNIT => 18 }
|
|
184
|
+
|
|
185
|
+
racc_nt_base = 19
|
|
206
186
|
|
|
207
187
|
racc_use_result_var = true
|
|
208
188
|
|
|
@@ -226,25 +206,33 @@ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
|
|
|
226
206
|
Racc_token_to_s_table = [
|
|
227
207
|
"$end",
|
|
228
208
|
"error",
|
|
209
|
+
"END",
|
|
210
|
+
"LEADING_SPACE",
|
|
211
|
+
"COMMENT",
|
|
229
212
|
"NEWLINE",
|
|
230
|
-
"
|
|
213
|
+
"DO",
|
|
214
|
+
"TRAILING_SPACE",
|
|
231
215
|
"IDENTIFIER",
|
|
232
|
-
"
|
|
216
|
+
"STRING",
|
|
217
|
+
"MULTILINE_STRING",
|
|
233
218
|
"NUMBER",
|
|
234
|
-
"
|
|
219
|
+
"DURATION",
|
|
235
220
|
"REGEX",
|
|
221
|
+
"SPACE",
|
|
236
222
|
"COMMA",
|
|
237
|
-
"
|
|
238
|
-
"
|
|
223
|
+
"PLUS",
|
|
224
|
+
"AT",
|
|
239
225
|
"TIME_UNIT",
|
|
240
226
|
"$start",
|
|
241
|
-
"
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
"
|
|
247
|
-
"
|
|
227
|
+
"document",
|
|
228
|
+
"lines",
|
|
229
|
+
"line",
|
|
230
|
+
"group",
|
|
231
|
+
"line_tokens",
|
|
232
|
+
"group_body",
|
|
233
|
+
"group_lines",
|
|
234
|
+
"group_line",
|
|
235
|
+
"line_token" ]
|
|
248
236
|
Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
|
|
249
237
|
|
|
250
238
|
Racc_debug_parser = false
|
|
@@ -253,628 +241,429 @@ Racc_debug_parser = false
|
|
|
253
241
|
|
|
254
242
|
# reduce 0 omitted
|
|
255
243
|
|
|
256
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
244
|
+
module_eval(<<'.,.,', 'demotape.y', 11)
|
|
257
245
|
def _reduce_1(val, _values, result)
|
|
258
|
-
result = val[0]
|
|
246
|
+
result = val[0].flatten.compact
|
|
259
247
|
result
|
|
260
248
|
end
|
|
261
249
|
.,.,
|
|
262
250
|
|
|
263
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
251
|
+
module_eval(<<'.,.,', 'demotape.y', 12)
|
|
264
252
|
def _reduce_2(val, _values, result)
|
|
265
253
|
result = []
|
|
266
254
|
result
|
|
267
255
|
end
|
|
268
256
|
.,.,
|
|
269
257
|
|
|
270
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
258
|
+
module_eval(<<'.,.,', 'demotape.y', 14)
|
|
271
259
|
def _reduce_3(val, _values, result)
|
|
272
|
-
result =
|
|
260
|
+
result = val[0]
|
|
273
261
|
result
|
|
274
262
|
end
|
|
275
263
|
.,.,
|
|
276
264
|
|
|
277
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
265
|
+
module_eval(<<'.,.,', 'demotape.y', 15)
|
|
278
266
|
def _reduce_4(val, _values, result)
|
|
279
|
-
result = val[0]
|
|
267
|
+
result = val[0] + val[1]
|
|
280
268
|
result
|
|
281
269
|
end
|
|
282
270
|
.,.,
|
|
283
271
|
|
|
284
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
272
|
+
module_eval(<<'.,.,', 'demotape.y', 19)
|
|
285
273
|
def _reduce_5(val, _values, result)
|
|
286
|
-
|
|
274
|
+
result = [
|
|
275
|
+
make_token(:comment, val[0], index_for_value(val[0])),
|
|
276
|
+
make_token(:newline, val[1], index_for_value(val[1]))
|
|
277
|
+
]
|
|
278
|
+
|
|
287
279
|
result
|
|
288
280
|
end
|
|
289
281
|
.,.,
|
|
290
282
|
|
|
291
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
283
|
+
module_eval(<<'.,.,', 'demotape.y', 25)
|
|
292
284
|
def _reduce_6(val, _values, result)
|
|
293
|
-
|
|
285
|
+
result = [
|
|
286
|
+
make_token(:leading_space, val[0], index_for_value(val[0])),
|
|
287
|
+
make_token(:comment, val[1], index_for_value(val[1])),
|
|
288
|
+
make_token(:newline, val[2], index_for_value(val[2]))
|
|
289
|
+
]
|
|
290
|
+
|
|
294
291
|
result
|
|
295
292
|
end
|
|
296
293
|
.,.,
|
|
297
294
|
|
|
298
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
295
|
+
module_eval(<<'.,.,', 'demotape.y', 31)
|
|
299
296
|
def _reduce_7(val, _values, result)
|
|
300
|
-
|
|
301
|
-
line_info = @lexer.line_map[space_index] || {}
|
|
302
|
-
error_msg = "Unexpected token \"SPACE\" at #{@file}:#{line_info[:line]}:#{line_info[:column]}:\n"
|
|
303
|
-
error_msg += " #{line_info[:content]}\n"
|
|
304
|
-
error_msg += " #{' ' * (line_info[:column] - 1)}^"
|
|
305
|
-
raise DemoTape::ParseError, error_msg
|
|
306
|
-
|
|
297
|
+
result = [make_token(:newline, val[0], index_for_value(val[0]))]
|
|
307
298
|
result
|
|
308
299
|
end
|
|
309
300
|
.,.,
|
|
310
301
|
|
|
311
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
302
|
+
module_eval(<<'.,.,', 'demotape.y', 32)
|
|
312
303
|
def _reduce_8(val, _values, result)
|
|
313
|
-
|
|
314
|
-
keys = val[0][:keys]
|
|
315
|
-
key_tokens = val[0][:tokens]
|
|
316
|
-
command_name = keys.shift
|
|
317
|
-
|
|
318
|
-
tokens = key_tokens + [make_token(:number, val[2], @token_index - 1)]
|
|
319
|
-
|
|
320
|
-
cmd = DemoTape::Command.new(command_name, "", keys:, count: val[2])
|
|
321
|
-
cmd.tokens = tokens
|
|
322
|
-
result = attach_location(cmd).prepare!
|
|
323
|
-
|
|
304
|
+
result = [val[0]]
|
|
324
305
|
result
|
|
325
306
|
end
|
|
326
307
|
.,.,
|
|
327
308
|
|
|
328
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
309
|
+
module_eval(<<'.,.,', 'demotape.y', 34)
|
|
329
310
|
def _reduce_9(val, _values, result)
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
cmd = DemoTape::Command.new(command_name, "", keys:)
|
|
336
|
-
cmd.tokens = key_tokens
|
|
337
|
-
result = attach_location(cmd).prepare!
|
|
311
|
+
tokens, start_idx = val[0]
|
|
312
|
+
result = [
|
|
313
|
+
{ type: :command, tokens: tokens, line: line_for_token_at(start_idx), column: column_for_token_at(start_idx) },
|
|
314
|
+
make_token(:newline, val[1], index_for_value(val[1]))
|
|
315
|
+
]
|
|
338
316
|
|
|
339
317
|
result
|
|
340
318
|
end
|
|
341
319
|
.,.,
|
|
342
320
|
|
|
343
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
321
|
+
module_eval(<<'.,.,', 'demotape.y', 41)
|
|
344
322
|
def _reduce_10(val, _values, result)
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
]
|
|
352
|
-
|
|
353
|
-
# Duration commands (Sleep, Wait) treat bare numbers as seconds
|
|
354
|
-
# Key commands treat numbers as repeat counts
|
|
355
|
-
if ["Sleep", "Wait"].include?(val[0])
|
|
356
|
-
cmd = DemoTape::Command.new(val[0], "#{val[2]}s")
|
|
357
|
-
cmd.tokens = tokens
|
|
358
|
-
result = attach_location(cmd, duration_index: duration_index).prepare!
|
|
359
|
-
else
|
|
360
|
-
cmd = DemoTape::Command.new(val[0], "", count: val[2])
|
|
361
|
-
cmd.tokens = tokens
|
|
362
|
-
result = attach_location(cmd).prepare!
|
|
363
|
-
end
|
|
323
|
+
idx_lead = index_for_value(val[0])
|
|
324
|
+
tokens, _ = val[1]
|
|
325
|
+
result = [
|
|
326
|
+
{ type: :command, tokens: [make_token(:leading_space, val[0], idx_lead)] + tokens, line: line_for_token_at(idx_lead), column: column_for_token_at(idx_lead) },
|
|
327
|
+
make_token(:newline, val[2], index_for_value(val[2]))
|
|
328
|
+
]
|
|
364
329
|
|
|
365
330
|
result
|
|
366
331
|
end
|
|
367
332
|
.,.,
|
|
368
333
|
|
|
369
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
334
|
+
module_eval(<<'.,.,', 'demotape.y', 51)
|
|
370
335
|
def _reduce_11(val, _values, result)
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
cmd.tokens = tokens
|
|
383
|
-
result = attach_location(cmd, speed_index: speed_index).prepare!
|
|
336
|
+
tokens, start_idx = val[0]
|
|
337
|
+
idx_do = index_for_value(val[1])
|
|
338
|
+
idx_nl = index_for_value(val[2])
|
|
339
|
+
idx_end = index_for_value(val[4])
|
|
340
|
+
result = {
|
|
341
|
+
type: :group,
|
|
342
|
+
tokens: tokens + [make_token(:keyword, val[1], idx_do), make_token(:keyword, val[4], idx_end)],
|
|
343
|
+
children: [make_token(:newline, val[2], idx_nl)] + val[3],
|
|
344
|
+
line: line_for_token_at(start_idx),
|
|
345
|
+
column: column_for_token_at(start_idx)
|
|
346
|
+
}
|
|
384
347
|
|
|
385
348
|
result
|
|
386
349
|
end
|
|
387
350
|
.,.,
|
|
388
351
|
|
|
389
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
352
|
+
module_eval(<<'.,.,', 'demotape.y', 64)
|
|
390
353
|
def _reduce_12(val, _values, result)
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
]
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
result = attach_location(cmd, speed_index: speed_index).prepare!
|
|
354
|
+
tokens, start_idx = val[0]
|
|
355
|
+
idx_do = index_for_value(val[1])
|
|
356
|
+
idx_nl = index_for_value(val[2])
|
|
357
|
+
idx_end = index_for_value(val[5])
|
|
358
|
+
# Discard the LEADING_SPACE before END (val[4])
|
|
359
|
+
result = {
|
|
360
|
+
type: :group,
|
|
361
|
+
tokens: tokens + [make_token(:keyword, val[1], idx_do), make_token(:keyword, val[5], idx_end)],
|
|
362
|
+
children: [make_token(:newline, val[2], idx_nl)] + val[3],
|
|
363
|
+
line: line_for_token_at(start_idx),
|
|
364
|
+
column: column_for_token_at(start_idx)
|
|
365
|
+
}
|
|
404
366
|
|
|
405
367
|
result
|
|
406
368
|
end
|
|
407
369
|
.,.,
|
|
408
370
|
|
|
409
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
371
|
+
module_eval(<<'.,.,', 'demotape.y', 78)
|
|
410
372
|
def _reduce_13(val, _values, result)
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
]
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
result = attach_location(cmd, speed_index: speed_index).prepare!
|
|
373
|
+
idx_lead = index_for_value(val[0])
|
|
374
|
+
tokens, _ = val[1]
|
|
375
|
+
idx_do = index_for_value(val[2])
|
|
376
|
+
idx_nl = index_for_value(val[3])
|
|
377
|
+
idx_end = index_for_value(val[5])
|
|
378
|
+
result = {
|
|
379
|
+
type: :group,
|
|
380
|
+
tokens: [make_token(:leading_space, val[0], idx_lead)] + tokens + [make_token(:keyword, val[2], idx_do), make_token(:keyword, val[5], idx_end)],
|
|
381
|
+
children: [make_token(:newline, val[3], idx_nl)] + val[4],
|
|
382
|
+
line: line_for_token_at(idx_lead),
|
|
383
|
+
column: column_for_token_at(idx_lead)
|
|
384
|
+
}
|
|
424
385
|
|
|
425
386
|
result
|
|
426
387
|
end
|
|
427
388
|
.,.,
|
|
428
389
|
|
|
429
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
390
|
+
module_eval(<<'.,.,', 'demotape.y', 92)
|
|
430
391
|
def _reduce_14(val, _values, result)
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
]
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
392
|
+
idx_lead = index_for_value(val[0])
|
|
393
|
+
tokens, _ = val[1]
|
|
394
|
+
idx_do = index_for_value(val[2])
|
|
395
|
+
idx_nl = index_for_value(val[3])
|
|
396
|
+
idx_end = index_for_value(val[6])
|
|
397
|
+
# Discard the LEADING_SPACE before END (val[5])
|
|
398
|
+
result = {
|
|
399
|
+
type: :group,
|
|
400
|
+
tokens: [make_token(:leading_space, val[0], idx_lead)] + tokens + [make_token(:keyword, val[2], idx_do), make_token(:keyword, val[6], idx_end)],
|
|
401
|
+
children: [make_token(:newline, val[3], idx_nl)] + val[4],
|
|
402
|
+
line: line_for_token_at(idx_lead),
|
|
403
|
+
column: column_for_token_at(idx_lead)
|
|
404
|
+
}
|
|
444
405
|
|
|
445
406
|
result
|
|
446
407
|
end
|
|
447
408
|
.,.,
|
|
448
409
|
|
|
449
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
410
|
+
module_eval(<<'.,.,', 'demotape.y', 107)
|
|
450
411
|
def _reduce_15(val, _values, result)
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
]
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
412
|
+
tokens, start_idx = val[0]
|
|
413
|
+
idx_do = index_for_value(val[1])
|
|
414
|
+
idx_trail = index_for_value(val[2])
|
|
415
|
+
idx_nl = index_for_value(val[3])
|
|
416
|
+
idx_end = index_for_value(val[5])
|
|
417
|
+
result = {
|
|
418
|
+
type: :group,
|
|
419
|
+
tokens: tokens + [make_token(:keyword, val[1], idx_do), make_token(:trailing_space, val[2], idx_trail), make_token(:keyword, val[5], idx_end)],
|
|
420
|
+
children: [make_token(:newline, val[3], idx_nl)] + val[4],
|
|
421
|
+
line: line_for_token_at(start_idx),
|
|
422
|
+
column: column_for_token_at(start_idx)
|
|
423
|
+
}
|
|
463
424
|
|
|
464
425
|
result
|
|
465
426
|
end
|
|
466
427
|
.,.,
|
|
467
428
|
|
|
468
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
429
|
+
module_eval(<<'.,.,', 'demotape.y', 121)
|
|
469
430
|
def _reduce_16(val, _values, result)
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
431
|
+
tokens, start_idx = val[0]
|
|
432
|
+
idx_do = index_for_value(val[1])
|
|
433
|
+
idx_trail = index_for_value(val[2])
|
|
434
|
+
idx_nl = index_for_value(val[3])
|
|
435
|
+
idx_end = index_for_value(val[6])
|
|
436
|
+
# Discard the LEADING_SPACE before END (val[5])
|
|
437
|
+
result = {
|
|
438
|
+
type: :group,
|
|
439
|
+
tokens: tokens + [make_token(:keyword, val[1], idx_do), make_token(:trailing_space, val[2], idx_trail), make_token(:keyword, val[6], idx_end)],
|
|
440
|
+
children: [make_token(:newline, val[3], idx_nl)] + val[4],
|
|
441
|
+
line: line_for_token_at(start_idx),
|
|
442
|
+
column: column_for_token_at(start_idx)
|
|
443
|
+
}
|
|
482
444
|
|
|
483
445
|
result
|
|
484
446
|
end
|
|
485
447
|
.,.,
|
|
486
448
|
|
|
487
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
449
|
+
module_eval(<<'.,.,', 'demotape.y', 136)
|
|
488
450
|
def _reduce_17(val, _values, result)
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
tokens = [
|
|
504
|
-
make_token(:identifier, val[0], @token_index - 6),
|
|
505
|
-
make_token(:operator, "@", @token_index - 5),
|
|
506
|
-
make_token(:duration, val[2], @token_index - 4),
|
|
507
|
-
make_token(:regex, val[4], regex_index)
|
|
508
|
-
]
|
|
509
|
-
|
|
510
|
-
cmd = DemoTape::Command.new(val[0], val[4], timeout: val[2])
|
|
511
|
-
cmd.tokens = tokens
|
|
512
|
-
result = attach_location(cmd, timeout_index: timeout_index).prepare!
|
|
451
|
+
idx_lead = index_for_value(val[0])
|
|
452
|
+
tokens, _ = val[1]
|
|
453
|
+
idx_do = index_for_value(val[2])
|
|
454
|
+
idx_trail = index_for_value(val[3])
|
|
455
|
+
idx_nl = index_for_value(val[4])
|
|
456
|
+
idx_end = index_for_value(val[7])
|
|
457
|
+
# Discard the LEADING_SPACE before END (val[6])
|
|
458
|
+
result = {
|
|
459
|
+
type: :group,
|
|
460
|
+
tokens: [make_token(:leading_space, val[0], idx_lead)] + tokens + [make_token(:keyword, val[2], idx_do), make_token(:trailing_space, val[3], idx_trail), make_token(:keyword, val[7], idx_end)],
|
|
461
|
+
children: [make_token(:newline, val[4], idx_nl)] + val[5],
|
|
462
|
+
line: line_for_token_at(idx_lead),
|
|
463
|
+
column: column_for_token_at(idx_lead)
|
|
464
|
+
}
|
|
513
465
|
|
|
514
466
|
result
|
|
515
467
|
end
|
|
516
468
|
.,.,
|
|
517
469
|
|
|
518
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
470
|
+
module_eval(<<'.,.,', 'demotape.y', 152)
|
|
519
471
|
def _reduce_18(val, _values, result)
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
tokens = [
|
|
534
|
-
make_token(:identifier, val[0], @token_index - 3),
|
|
535
|
-
make_token(:regex, val[2], regex_index)
|
|
536
|
-
]
|
|
537
|
-
|
|
538
|
-
cmd = DemoTape::Command.new(val[0], val[2])
|
|
539
|
-
cmd.tokens = tokens
|
|
540
|
-
result = attach_location(cmd).prepare!
|
|
472
|
+
idx_lead = index_for_value(val[0])
|
|
473
|
+
tokens, _ = val[1]
|
|
474
|
+
idx_do = index_for_value(val[2])
|
|
475
|
+
idx_trail = index_for_value(val[3])
|
|
476
|
+
idx_nl = index_for_value(val[4])
|
|
477
|
+
idx_end = index_for_value(val[6])
|
|
478
|
+
result = {
|
|
479
|
+
type: :group,
|
|
480
|
+
tokens: [make_token(:leading_space, val[0], idx_lead)] + tokens + [make_token(:keyword, val[2], idx_do), make_token(:trailing_space, val[3], idx_trail), make_token(:keyword, val[6], idx_end)],
|
|
481
|
+
children: [make_token(:newline, val[4], idx_nl)] + val[5],
|
|
482
|
+
line: line_for_token_at(idx_lead),
|
|
483
|
+
column: column_for_token_at(idx_lead)
|
|
484
|
+
}
|
|
541
485
|
|
|
542
486
|
result
|
|
543
487
|
end
|
|
544
488
|
.,.,
|
|
545
489
|
|
|
546
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
490
|
+
module_eval(<<'.,.,', 'demotape.y', 169)
|
|
547
491
|
def _reduce_19(val, _values, result)
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
tokens = [
|
|
551
|
-
make_token(:identifier, val[0], @token_index - 9),
|
|
552
|
-
make_token(:identifier, val[2], @token_index - 7),
|
|
553
|
-
make_token(:number, val[4], @token_index - 5),
|
|
554
|
-
make_token(:operator, ",", @token_index - 4),
|
|
555
|
-
make_token(:number, val[6], @token_index - 3),
|
|
556
|
-
make_token(:operator, ",", @token_index - 2),
|
|
557
|
-
make_token(:number, val[8], @token_index - 1),
|
|
558
|
-
make_token(:operator, ",", @token_index - 1),
|
|
559
|
-
make_token(:number, val[10], @token_index - 1)
|
|
560
|
-
]
|
|
561
|
-
|
|
562
|
-
cmd = DemoTape::Command.new(val[0], [val[4], val[6], val[8], val[10]], option: val[2])
|
|
563
|
-
cmd.tokens = tokens
|
|
564
|
-
result = attach_location(cmd).prepare!
|
|
565
|
-
|
|
492
|
+
result = []
|
|
566
493
|
result
|
|
567
494
|
end
|
|
568
495
|
.,.,
|
|
569
496
|
|
|
570
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
497
|
+
module_eval(<<'.,.,', 'demotape.y', 170)
|
|
571
498
|
def _reduce_20(val, _values, result)
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
tokens = [
|
|
575
|
-
make_token(:identifier, val[0], @token_index - 13),
|
|
576
|
-
make_token(:identifier, val[2], @token_index - 11),
|
|
577
|
-
make_token(:number, val[4], @token_index - 9),
|
|
578
|
-
make_token(:operator, ",", @token_index - 8),
|
|
579
|
-
make_token(:number, val[7], @token_index - 6),
|
|
580
|
-
make_token(:operator, ",", @token_index - 5),
|
|
581
|
-
make_token(:number, val[10], @token_index - 3),
|
|
582
|
-
make_token(:operator, ",", @token_index - 2),
|
|
583
|
-
make_token(:number, val[13], @token_index - 1)
|
|
584
|
-
]
|
|
585
|
-
|
|
586
|
-
cmd = DemoTape::Command.new(val[0], [val[4], val[7], val[10], val[13]], option: val[2])
|
|
587
|
-
cmd.tokens = tokens
|
|
588
|
-
result = attach_location(cmd).prepare!
|
|
589
|
-
|
|
499
|
+
result = val[0].flatten.compact
|
|
590
500
|
result
|
|
591
501
|
end
|
|
592
502
|
.,.,
|
|
593
503
|
|
|
594
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
504
|
+
module_eval(<<'.,.,', 'demotape.y', 172)
|
|
595
505
|
def _reduce_21(val, _values, result)
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
tokens = [
|
|
599
|
-
make_token(:identifier, val[0], @token_index - 7),
|
|
600
|
-
make_token(:identifier, val[2], @token_index - 5),
|
|
601
|
-
make_token(:number, val[4], @token_index - 3),
|
|
602
|
-
make_token(:operator, ",", @token_index - 2),
|
|
603
|
-
make_token(:number, val[6], @token_index - 1),
|
|
604
|
-
make_token(:operator, ",", @token_index - 1),
|
|
605
|
-
make_token(:number, val[8], @token_index - 1)
|
|
606
|
-
]
|
|
607
|
-
|
|
608
|
-
cmd = DemoTape::Command.new(val[0], [val[4], val[6], val[8]], option: val[2])
|
|
609
|
-
cmd.tokens = tokens
|
|
610
|
-
result = attach_location(cmd).prepare!
|
|
611
|
-
|
|
506
|
+
result = val[0]
|
|
612
507
|
result
|
|
613
508
|
end
|
|
614
509
|
.,.,
|
|
615
510
|
|
|
616
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
511
|
+
module_eval(<<'.,.,', 'demotape.y', 173)
|
|
617
512
|
def _reduce_22(val, _values, result)
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
tokens = [
|
|
621
|
-
make_token(:identifier, val[0], @token_index - 11),
|
|
622
|
-
make_token(:identifier, val[2], @token_index - 9),
|
|
623
|
-
make_token(:number, val[4], @token_index - 7),
|
|
624
|
-
make_token(:operator, ",", @token_index - 6),
|
|
625
|
-
make_token(:number, val[7], @token_index - 4),
|
|
626
|
-
make_token(:operator, ",", @token_index - 3),
|
|
627
|
-
make_token(:number, val[10], @token_index - 1)
|
|
628
|
-
]
|
|
629
|
-
|
|
630
|
-
cmd = DemoTape::Command.new(val[0], [val[4], val[7], val[10]], option: val[2])
|
|
631
|
-
cmd.tokens = tokens
|
|
632
|
-
result = attach_location(cmd).prepare!
|
|
633
|
-
|
|
513
|
+
result = val[0] + val[1]
|
|
634
514
|
result
|
|
635
515
|
end
|
|
636
516
|
.,.,
|
|
637
517
|
|
|
638
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
518
|
+
module_eval(<<'.,.,', 'demotape.y', 177)
|
|
639
519
|
def _reduce_23(val, _values, result)
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
make_token(:identifier, val[2], @token_index - 3),
|
|
645
|
-
make_token(:number, val[4], @token_index - 1),
|
|
646
|
-
make_token(:operator, ",", @token_index - 1),
|
|
647
|
-
make_token(:number, val[6], @token_index - 1)
|
|
648
|
-
]
|
|
649
|
-
|
|
650
|
-
cmd = DemoTape::Command.new(val[0], [val[4], val[6]], option: val[2])
|
|
651
|
-
cmd.tokens = tokens
|
|
652
|
-
result = attach_location(cmd).prepare!
|
|
520
|
+
result = [
|
|
521
|
+
make_token(:comment, val[0], index_for_value(val[0])),
|
|
522
|
+
make_token(:newline, val[1], index_for_value(val[1]))
|
|
523
|
+
]
|
|
653
524
|
|
|
654
525
|
result
|
|
655
526
|
end
|
|
656
527
|
.,.,
|
|
657
528
|
|
|
658
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
529
|
+
module_eval(<<'.,.,', 'demotape.y', 182)
|
|
659
530
|
def _reduce_24(val, _values, result)
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
tokens = [
|
|
663
|
-
make_token(:identifier, val[0], @token_index - 8),
|
|
664
|
-
make_token(:identifier, val[2], @token_index - 6),
|
|
665
|
-
make_token(:number, val[4], @token_index - 4),
|
|
666
|
-
make_token(:operator, ",", @token_index - 3),
|
|
667
|
-
make_token(:number, val[7], @token_index - 1)
|
|
668
|
-
]
|
|
669
|
-
|
|
670
|
-
cmd = DemoTape::Command.new(val[0], [val[4], val[7]], option: val[2])
|
|
671
|
-
cmd.tokens = tokens
|
|
672
|
-
result = attach_location(cmd).prepare!
|
|
673
|
-
|
|
531
|
+
result = [make_token(:newline, val[0], index_for_value(val[0]))]
|
|
674
532
|
result
|
|
675
533
|
end
|
|
676
534
|
.,.,
|
|
677
535
|
|
|
678
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
536
|
+
module_eval(<<'.,.,', 'demotape.y', 184)
|
|
679
537
|
def _reduce_25(val, _values, result)
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
make_token(:duration, val[4], @token_index - 2)
|
|
686
|
-
]
|
|
687
|
-
|
|
688
|
-
cmd = DemoTape::Command.new(val[0], val[4], option: val[2])
|
|
689
|
-
cmd.tokens = tokens
|
|
690
|
-
result = attach_location(cmd).prepare!
|
|
538
|
+
tokens, start_idx = val[0]
|
|
539
|
+
result = [
|
|
540
|
+
{ type: :command, tokens: tokens, line: line_for_token_at(start_idx), column: column_for_token_at(start_idx) },
|
|
541
|
+
make_token(:newline, val[1], index_for_value(val[1]))
|
|
542
|
+
]
|
|
691
543
|
|
|
692
544
|
result
|
|
693
545
|
end
|
|
694
546
|
.,.,
|
|
695
547
|
|
|
696
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
548
|
+
module_eval(<<'.,.,', 'demotape.y', 191)
|
|
697
549
|
def _reduce_26(val, _values, result)
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
]
|
|
705
|
-
|
|
706
|
-
cmd = DemoTape::Command.new(val[0], val[4].to_s, option: val[2])
|
|
707
|
-
cmd.tokens = tokens
|
|
708
|
-
result = attach_location(cmd).prepare!
|
|
550
|
+
idx_lead = index_for_value(val[0])
|
|
551
|
+
tokens, _ = val[1]
|
|
552
|
+
result = [
|
|
553
|
+
{ type: :command, tokens: [make_token(:leading_space, val[0], idx_lead)] + tokens, line: line_for_token_at(idx_lead), column: column_for_token_at(idx_lead) },
|
|
554
|
+
make_token(:newline, val[2], index_for_value(val[2]))
|
|
555
|
+
]
|
|
709
556
|
|
|
710
557
|
result
|
|
711
558
|
end
|
|
712
559
|
.,.,
|
|
713
560
|
|
|
714
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
561
|
+
module_eval(<<'.,.,', 'demotape.y', 199)
|
|
715
562
|
def _reduce_27(val, _values, result)
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
make_token(:identifier, val[4], @token_index - 1)
|
|
722
|
-
]
|
|
723
|
-
|
|
724
|
-
cmd = DemoTape::Command.new(val[0], val[4], option: val[2])
|
|
725
|
-
cmd.tokens = tokens
|
|
726
|
-
result = attach_location(cmd).prepare!
|
|
563
|
+
result = [
|
|
564
|
+
make_token(:leading_space, val[0], index_for_value(val[0])),
|
|
565
|
+
make_token(:comment, val[1], index_for_value(val[1])),
|
|
566
|
+
make_token(:newline, val[2], index_for_value(val[2]))
|
|
567
|
+
]
|
|
727
568
|
|
|
728
569
|
result
|
|
729
570
|
end
|
|
730
571
|
.,.,
|
|
731
572
|
|
|
732
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
573
|
+
module_eval(<<'.,.,', 'demotape.y', 208)
|
|
733
574
|
def _reduce_28(val, _values, result)
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
tokens = [
|
|
737
|
-
make_token(:identifier, val[0], @token_index - 5),
|
|
738
|
-
make_token(:identifier, val[2], @token_index - 3),
|
|
739
|
-
make_token(:string, val[4], @token_index - 1)
|
|
740
|
-
]
|
|
741
|
-
|
|
742
|
-
cmd = DemoTape::Command.new(val[0], val[4], option: val[2])
|
|
743
|
-
cmd.tokens = tokens
|
|
744
|
-
result = attach_location(cmd).prepare!
|
|
745
|
-
|
|
575
|
+
result = [[val[0][:token]], val[0][:index]]
|
|
746
576
|
result
|
|
747
577
|
end
|
|
748
578
|
.,.,
|
|
749
579
|
|
|
750
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
580
|
+
module_eval(<<'.,.,', 'demotape.y', 209)
|
|
751
581
|
def _reduce_29(val, _values, result)
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
tokens = [
|
|
755
|
-
make_token(:identifier, val[0], @token_index - 3),
|
|
756
|
-
make_token(:string, val[2], @token_index - 1)
|
|
757
|
-
]
|
|
758
|
-
|
|
759
|
-
cmd = DemoTape::Command.new(val[0], val[2])
|
|
760
|
-
cmd.tokens = tokens
|
|
761
|
-
result = attach_location(cmd).prepare!
|
|
762
|
-
|
|
582
|
+
result = [val[0][0] << val[1][:token], val[0][1]]
|
|
763
583
|
result
|
|
764
584
|
end
|
|
765
585
|
.,.,
|
|
766
586
|
|
|
767
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
587
|
+
module_eval(<<'.,.,', 'demotape.y', 211)
|
|
768
588
|
def _reduce_30(val, _values, result)
|
|
769
|
-
|
|
770
|
-
duration_index = @token_index - 1 # TIME_UNIT position
|
|
771
|
-
|
|
772
|
-
tokens = [
|
|
773
|
-
make_token(:identifier, val[0], @token_index - 4),
|
|
774
|
-
make_token(:duration, val[2], @token_index - 2)
|
|
775
|
-
]
|
|
776
|
-
|
|
777
|
-
cmd = DemoTape::Command.new(val[0], val[2])
|
|
778
|
-
cmd.tokens = tokens
|
|
779
|
-
result = attach_location(cmd, duration_index: duration_index).prepare!
|
|
780
|
-
|
|
589
|
+
idx = index_for_value(val[0]); result = { token: make_token(:identifier, val[0], idx), index: idx }
|
|
781
590
|
result
|
|
782
591
|
end
|
|
783
592
|
.,.,
|
|
784
593
|
|
|
785
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
594
|
+
module_eval(<<'.,.,', 'demotape.y', 212)
|
|
786
595
|
def _reduce_31(val, _values, result)
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
tokens = [make_token(:identifier, val[0], @token_index - 2)]
|
|
790
|
-
|
|
791
|
-
cmd = DemoTape::Command.new(val[0], "")
|
|
792
|
-
cmd.tokens = tokens
|
|
793
|
-
result = attach_location(cmd).prepare!
|
|
794
|
-
|
|
596
|
+
idx = index_for_value(val[0]); result = { token: make_token(:string, val[0], idx), index: idx }
|
|
795
597
|
result
|
|
796
598
|
end
|
|
797
599
|
.,.,
|
|
798
600
|
|
|
799
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
601
|
+
module_eval(<<'.,.,', 'demotape.y', 213)
|
|
800
602
|
def _reduce_32(val, _values, result)
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
tokens = [
|
|
804
|
-
make_token(:identifier, val[0], @token_index - 3),
|
|
805
|
-
make_token(:operator, "+", @token_index - 2),
|
|
806
|
-
make_token(:identifier, val[2], @token_index - 1)
|
|
807
|
-
]
|
|
808
|
-
|
|
809
|
-
result = { keys: [val[0], val[2]], tokens: tokens }
|
|
810
|
-
|
|
603
|
+
idx = index_for_value(val[0]); result = { token: make_token(:multiline_string, val[0], idx), index: idx }
|
|
811
604
|
result
|
|
812
605
|
end
|
|
813
606
|
.,.,
|
|
814
607
|
|
|
815
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
608
|
+
module_eval(<<'.,.,', 'demotape.y', 214)
|
|
816
609
|
def _reduce_33(val, _values, result)
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
tokens = [
|
|
820
|
-
make_token(:identifier, val[0], @token_index - 3),
|
|
821
|
-
make_token(:operator, "+", @token_index - 2),
|
|
822
|
-
make_token(:number, val[2], @token_index - 1)
|
|
823
|
-
]
|
|
824
|
-
|
|
825
|
-
result = { keys: [val[0], val[2].to_s], tokens: tokens }
|
|
826
|
-
|
|
610
|
+
idx = index_for_value(val[0]); result = { token: make_token(:number, val[0], idx), index: idx }
|
|
827
611
|
result
|
|
828
612
|
end
|
|
829
613
|
.,.,
|
|
830
614
|
|
|
831
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
615
|
+
module_eval(<<'.,.,', 'demotape.y', 215)
|
|
832
616
|
def _reduce_34(val, _values, result)
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
tokens = val[0][:tokens] + [
|
|
836
|
-
make_token(:operator, "+", @token_index - 2),
|
|
837
|
-
make_token(:identifier, val[2], @token_index - 1)
|
|
838
|
-
]
|
|
839
|
-
|
|
840
|
-
result = { keys: val[0][:keys] << val[2], tokens: tokens }
|
|
841
|
-
|
|
617
|
+
idx = index_for_value(val[0]); result = { token: make_token(:duration, val[0], idx), index: idx }
|
|
842
618
|
result
|
|
843
619
|
end
|
|
844
620
|
.,.,
|
|
845
621
|
|
|
846
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
622
|
+
module_eval(<<'.,.,', 'demotape.y', 216)
|
|
847
623
|
def _reduce_35(val, _values, result)
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
tokens = val[0][:tokens] + [
|
|
851
|
-
make_token(:operator, "+", @token_index - 2),
|
|
852
|
-
make_token(:number, val[2], @token_index - 1)
|
|
853
|
-
]
|
|
854
|
-
|
|
855
|
-
result = { keys: val[0][:keys] << val[2].to_s, tokens: tokens }
|
|
856
|
-
|
|
624
|
+
idx = index_for_value(val[0]); result = { token: make_token(:regex, val[0], idx), index: idx }
|
|
857
625
|
result
|
|
858
626
|
end
|
|
859
627
|
.,.,
|
|
860
628
|
|
|
861
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
629
|
+
module_eval(<<'.,.,', 'demotape.y', 217)
|
|
862
630
|
def _reduce_36(val, _values, result)
|
|
863
|
-
result = val[0]
|
|
631
|
+
idx = index_for_value(val[0]); result = { token: make_token(:space, val[0], idx), index: idx }
|
|
864
632
|
result
|
|
865
633
|
end
|
|
866
634
|
.,.,
|
|
867
635
|
|
|
868
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
636
|
+
module_eval(<<'.,.,', 'demotape.y', 218)
|
|
869
637
|
def _reduce_37(val, _values, result)
|
|
870
|
-
result = val[0]
|
|
638
|
+
idx = index_for_value(val[0]); result = { token: make_token(:trailing_space, val[0], idx), index: idx }
|
|
871
639
|
result
|
|
872
640
|
end
|
|
873
641
|
.,.,
|
|
874
642
|
|
|
875
|
-
module_eval(<<'.,.,', 'demotape.y',
|
|
643
|
+
module_eval(<<'.,.,', 'demotape.y', 219)
|
|
876
644
|
def _reduce_38(val, _values, result)
|
|
877
|
-
|
|
645
|
+
idx = index_for_value(val[0]); result = { token: make_token(:operator, ",", idx), index: idx }
|
|
646
|
+
result
|
|
647
|
+
end
|
|
648
|
+
.,.,
|
|
649
|
+
|
|
650
|
+
module_eval(<<'.,.,', 'demotape.y', 220)
|
|
651
|
+
def _reduce_39(val, _values, result)
|
|
652
|
+
idx = index_for_value(val[0]); result = { token: make_token(:operator, "+", idx), index: idx }
|
|
653
|
+
result
|
|
654
|
+
end
|
|
655
|
+
.,.,
|
|
656
|
+
|
|
657
|
+
module_eval(<<'.,.,', 'demotape.y', 221)
|
|
658
|
+
def _reduce_40(val, _values, result)
|
|
659
|
+
idx = index_for_value(val[0]); result = { token: make_token(:operator, "@", idx), index: idx }
|
|
660
|
+
result
|
|
661
|
+
end
|
|
662
|
+
.,.,
|
|
663
|
+
|
|
664
|
+
module_eval(<<'.,.,', 'demotape.y', 222)
|
|
665
|
+
def _reduce_41(val, _values, result)
|
|
666
|
+
idx = index_for_value(val[0]); result = { token: make_token(:time_unit, val[0], idx), index: idx }
|
|
878
667
|
result
|
|
879
668
|
end
|
|
880
669
|
.,.,
|