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
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DemoTape
|
|
4
|
+
class Parser < Racc::Parser
|
|
5
|
+
class Rules
|
|
6
|
+
module Helpers
|
|
7
|
+
def raise_error(token:, file:, content:, message:)
|
|
8
|
+
line = token.line
|
|
9
|
+
column = token.column
|
|
10
|
+
leading_spaces = content[/^\s*/].size
|
|
11
|
+
|
|
12
|
+
error_message = [
|
|
13
|
+
"#{message} at #{file}:#{line}:#{column}:",
|
|
14
|
+
" #{content}",
|
|
15
|
+
" #{' ' * (column - 1 + leading_spaces)}^"
|
|
16
|
+
].join("\n")
|
|
17
|
+
|
|
18
|
+
raise DemoTape::ParseError, error_message
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class Identifier
|
|
23
|
+
attr_reader :names, :expectations
|
|
24
|
+
|
|
25
|
+
def initialize(*names)
|
|
26
|
+
@names = names
|
|
27
|
+
@expectations = [self]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def valid?(other, *)
|
|
31
|
+
return false unless other.identifier?
|
|
32
|
+
|
|
33
|
+
results = names.map do |name|
|
|
34
|
+
case name
|
|
35
|
+
when String
|
|
36
|
+
other.value == name
|
|
37
|
+
when Regexp
|
|
38
|
+
other.value.match?(name)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
results.any?
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def +(other)
|
|
46
|
+
expectations << other
|
|
47
|
+
self
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class Duration
|
|
52
|
+
include Helpers
|
|
53
|
+
|
|
54
|
+
def valid?(other, file, content)
|
|
55
|
+
return false unless other.duration?
|
|
56
|
+
|
|
57
|
+
unit = other.value[:unit]
|
|
58
|
+
return true if %w[ms s m h].include?(unit)
|
|
59
|
+
|
|
60
|
+
raise_error token: other,
|
|
61
|
+
file:,
|
|
62
|
+
content:,
|
|
63
|
+
message: "Invalid unit #{unit.inspect} in duration"
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
class Number
|
|
68
|
+
def valid?(other, *)
|
|
69
|
+
other.number?
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
class Operator
|
|
74
|
+
def initialize(*operators)
|
|
75
|
+
@operators = operators
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def valid?(other, *)
|
|
79
|
+
other.operator? && @operators.include?(other.value)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
class Boolean
|
|
84
|
+
def valid?(other, *)
|
|
85
|
+
other.identifier? && %w[true false].include?(other.value)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
class Regex
|
|
90
|
+
include Helpers
|
|
91
|
+
|
|
92
|
+
def valid?(other, file, content)
|
|
93
|
+
return false unless other.regex?
|
|
94
|
+
|
|
95
|
+
error = other.value[:error]
|
|
96
|
+
|
|
97
|
+
return true unless error
|
|
98
|
+
|
|
99
|
+
raise_error(
|
|
100
|
+
token: other,
|
|
101
|
+
file:,
|
|
102
|
+
content:,
|
|
103
|
+
message: "Invalid regular expression (#{error})"
|
|
104
|
+
)
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
class StringToken
|
|
109
|
+
def initialize(enum)
|
|
110
|
+
@enum = enum
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def valid?(other, *)
|
|
114
|
+
(other.string? || other.multiline_string?) &&
|
|
115
|
+
(@enum.empty? || @enum.include?(other.value))
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
module ClassMethods
|
|
120
|
+
include Helpers
|
|
121
|
+
|
|
122
|
+
def validate_key_combos!(tokens, file, content)
|
|
123
|
+
return unless tokens.any?(&:plus_operator?)
|
|
124
|
+
|
|
125
|
+
operator_indices = tokens.each_index
|
|
126
|
+
.select {|i| tokens[i].plus_operator? }
|
|
127
|
+
|
|
128
|
+
operator_indices.each do |index|
|
|
129
|
+
before = tokens[index - 1]
|
|
130
|
+
after = tokens[index + 1]
|
|
131
|
+
|
|
132
|
+
next unless before.any_space? || after.any_space?
|
|
133
|
+
|
|
134
|
+
# Invalid spacing around '+'
|
|
135
|
+
raise_error token: tokens[index],
|
|
136
|
+
file:,
|
|
137
|
+
content:,
|
|
138
|
+
message: "Invalid spacing around '+' in key combo"
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def validate_group!(file, group)
|
|
143
|
+
validate_token_supports_block!(file, group)
|
|
144
|
+
|
|
145
|
+
commands = group[:children].select { it.is_a?(Hash) }
|
|
146
|
+
commands.each { validate_command!(file, it[:tokens]) }
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def validate_token_supports_block!(file, group)
|
|
150
|
+
tokens = group[:tokens].reject(&:any_space?)
|
|
151
|
+
token = tokens.find(&:identifier?)
|
|
152
|
+
|
|
153
|
+
return if token.supports_block?
|
|
154
|
+
|
|
155
|
+
do_token = tokens.find { it.keyword?("do") }
|
|
156
|
+
|
|
157
|
+
raise_error file:,
|
|
158
|
+
content: group[:tokens][0..-2].map(&:raw).join,
|
|
159
|
+
token: do_token,
|
|
160
|
+
message: "Command #{token.value.inspect} " \
|
|
161
|
+
"doesn't support blocks"
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def validate_command!(file, tokens)
|
|
165
|
+
content = tokens.map(&:raw).join
|
|
166
|
+
actionable_tokens = tokens.reject(&:any_space?).reject(&:comment?)
|
|
167
|
+
|
|
168
|
+
return if actionable_tokens.empty?
|
|
169
|
+
|
|
170
|
+
validate_key_combos!(tokens, file, content)
|
|
171
|
+
|
|
172
|
+
results = rules.map do |rule|
|
|
173
|
+
matches = []
|
|
174
|
+
expectations = rule.expectations
|
|
175
|
+
|
|
176
|
+
all_valid =
|
|
177
|
+
actionable_tokens.zip(expectations).all? do |token, expectation|
|
|
178
|
+
valid = expectation&.valid?(token, file, content)
|
|
179
|
+
matches << token if valid
|
|
180
|
+
valid
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
[all_valid, matches]
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
return if results.any?(&:first)
|
|
187
|
+
|
|
188
|
+
closest_match = results.reject { it[1].nil? }.max_by { it[1].size }
|
|
189
|
+
invalid_token = actionable_tokens[closest_match[1].size]
|
|
190
|
+
|
|
191
|
+
raise_error token: invalid_token,
|
|
192
|
+
file:,
|
|
193
|
+
content:,
|
|
194
|
+
message: "Unexpected token #{invalid_token.raw.inspect}"
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def rules
|
|
198
|
+
@rules ||= []
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def identifier(*names)
|
|
202
|
+
Identifier.new(*names)
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def duration
|
|
206
|
+
Duration.new
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def number
|
|
210
|
+
Number.new
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def boolean
|
|
214
|
+
Boolean.new
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def string(*enum)
|
|
218
|
+
StringToken.new(enum)
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def operator(*operators)
|
|
222
|
+
Operator.new(*operators)
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
def regex
|
|
226
|
+
Regex.new
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
extend ClassMethods
|
|
231
|
+
|
|
232
|
+
# Group invocations
|
|
233
|
+
rules.push identifier(/^[a-z0-9_]+$/)
|
|
234
|
+
|
|
235
|
+
# KEY+KEY
|
|
236
|
+
rules.push identifier(*Command::KEY_MAPPING.keys) +
|
|
237
|
+
operator("+") +
|
|
238
|
+
identifier(*Command::VALID_KEYS)
|
|
239
|
+
|
|
240
|
+
# KEY+KEY+KEY
|
|
241
|
+
rules.push identifier(*Command::KEY_MAPPING.keys) +
|
|
242
|
+
operator("+") +
|
|
243
|
+
identifier(*Command::VALID_KEYS) +
|
|
244
|
+
operator("+") +
|
|
245
|
+
identifier(*Command::VALID_KEYS)
|
|
246
|
+
|
|
247
|
+
# KEY+KEY+KEY+KEY
|
|
248
|
+
rules.push identifier(*Command::KEY_MAPPING.keys) +
|
|
249
|
+
operator("+") +
|
|
250
|
+
identifier(*Command::VALID_KEYS) +
|
|
251
|
+
operator("+") +
|
|
252
|
+
identifier(*Command::VALID_KEYS) +
|
|
253
|
+
operator("+") +
|
|
254
|
+
identifier(*Command::VALID_KEYS)
|
|
255
|
+
|
|
256
|
+
# KEY+KEY COUNT
|
|
257
|
+
rules.push identifier(*Command::KEY_MAPPING.keys) +
|
|
258
|
+
operator("+") +
|
|
259
|
+
identifier(*Command::VALID_KEYS) +
|
|
260
|
+
number
|
|
261
|
+
|
|
262
|
+
# KEY+KEY+KEY COUNT
|
|
263
|
+
rules.push identifier(*Command::KEY_MAPPING.keys) +
|
|
264
|
+
operator("+") +
|
|
265
|
+
identifier(*Command::VALID_KEYS) +
|
|
266
|
+
operator("+") +
|
|
267
|
+
identifier(*Command::VALID_KEYS) +
|
|
268
|
+
number
|
|
269
|
+
|
|
270
|
+
# KEY+KEY+KEY+KEY COUNT
|
|
271
|
+
rules.push identifier(*Command::KEY_MAPPING.keys) +
|
|
272
|
+
operator("+") +
|
|
273
|
+
identifier(*Command::VALID_KEYS) +
|
|
274
|
+
operator("+") +
|
|
275
|
+
identifier(*Command::VALID_KEYS) +
|
|
276
|
+
operator("+") +
|
|
277
|
+
identifier(*Command::VALID_KEYS) +
|
|
278
|
+
number
|
|
279
|
+
|
|
280
|
+
# COMMAND
|
|
281
|
+
rules.push identifier(
|
|
282
|
+
*Command::KEY_MAPPING.keys,
|
|
283
|
+
"Screenshot", "Paste", "Clear", "Pause", "Resume"
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
# KEY@DURATION COUNT
|
|
287
|
+
rules.push identifier(*Command::KEY_MAPPING.keys) +
|
|
288
|
+
operator("@") +
|
|
289
|
+
duration +
|
|
290
|
+
number
|
|
291
|
+
|
|
292
|
+
# KEY COUNT
|
|
293
|
+
rules.push identifier(*Command::KEY_MAPPING.keys) +
|
|
294
|
+
number
|
|
295
|
+
|
|
296
|
+
# KEY@NUMBER COUNT
|
|
297
|
+
rules.push identifier(*Command::KEY_MAPPING.keys) +
|
|
298
|
+
operator("@") +
|
|
299
|
+
number +
|
|
300
|
+
number
|
|
301
|
+
|
|
302
|
+
# KEY@DURATION
|
|
303
|
+
rules.push identifier(*Command::KEY_MAPPING.keys) +
|
|
304
|
+
operator("@") +
|
|
305
|
+
duration
|
|
306
|
+
|
|
307
|
+
# KEY@NUMBER
|
|
308
|
+
rules.push identifier(*Command::KEY_MAPPING.keys) +
|
|
309
|
+
operator("@") +
|
|
310
|
+
number
|
|
311
|
+
|
|
312
|
+
# COMMAND STRING
|
|
313
|
+
rules.push identifier("Type", "TypeFile", "Send", "Copy", "Screenshot",
|
|
314
|
+
"Run", "Require", "Output", "Include") +
|
|
315
|
+
string
|
|
316
|
+
|
|
317
|
+
# COMMAND DURATION
|
|
318
|
+
rules.push identifier("Sleep", "Wait") +
|
|
319
|
+
duration
|
|
320
|
+
|
|
321
|
+
# COMMAND NUMBER
|
|
322
|
+
rules.push identifier("Sleep", "Wait") +
|
|
323
|
+
number
|
|
324
|
+
|
|
325
|
+
# COMMAND@DURATION STRING
|
|
326
|
+
rules.push identifier("Run", "Type") +
|
|
327
|
+
operator("@") +
|
|
328
|
+
duration +
|
|
329
|
+
string
|
|
330
|
+
|
|
331
|
+
# WaitUntil
|
|
332
|
+
rules.push identifier("WaitUntil") + regex
|
|
333
|
+
rules.push identifier("WaitUntil") + operator("@") + duration + regex
|
|
334
|
+
rules.push identifier("WaitUntil") + operator("@") + number + regex
|
|
335
|
+
|
|
336
|
+
# Set attribute DURATION
|
|
337
|
+
rules.push identifier("Set") +
|
|
338
|
+
identifier("loop_delay", "run_sleep", "run_enter_delay") +
|
|
339
|
+
duration
|
|
340
|
+
|
|
341
|
+
# Set attribute BOOLEAN
|
|
342
|
+
rules.push identifier("Set") +
|
|
343
|
+
identifier("loop", "cursor_blink") +
|
|
344
|
+
boolean
|
|
345
|
+
|
|
346
|
+
# Set attribute NUMBER
|
|
347
|
+
rules.push identifier("Set") +
|
|
348
|
+
identifier("width", "height", "cursor_width", "font_size",
|
|
349
|
+
"padding", "margin", "loop_delay", "line_height",
|
|
350
|
+
"border_radius") +
|
|
351
|
+
number
|
|
352
|
+
|
|
353
|
+
# Set attribute STRING
|
|
354
|
+
rules.push identifier("Set") +
|
|
355
|
+
identifier("theme", "font_family", "margin_fill") +
|
|
356
|
+
string
|
|
357
|
+
|
|
358
|
+
# Set cursor_style STRING
|
|
359
|
+
rules.push identifier("Set") +
|
|
360
|
+
identifier("cursor_style") +
|
|
361
|
+
string("block", "underline", "bar")
|
|
362
|
+
|
|
363
|
+
# Set theme.property STRING
|
|
364
|
+
rules.push identifier("Set") +
|
|
365
|
+
identifier(/^theme\.[a-z0-9_]+$/) +
|
|
366
|
+
string
|
|
367
|
+
|
|
368
|
+
# Set attribute NUMBER COMMA NUMBER
|
|
369
|
+
rules.push identifier("Set") +
|
|
370
|
+
identifier("padding", "margin") +
|
|
371
|
+
number +
|
|
372
|
+
operator(",") +
|
|
373
|
+
number
|
|
374
|
+
|
|
375
|
+
# Set attribute NUMBER COMMA NUMBER COMMA NUMBER
|
|
376
|
+
rules.push identifier("Set") +
|
|
377
|
+
identifier("padding", "margin") +
|
|
378
|
+
number +
|
|
379
|
+
operator(",") +
|
|
380
|
+
number +
|
|
381
|
+
operator(",") +
|
|
382
|
+
number
|
|
383
|
+
|
|
384
|
+
# Set attribute NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER
|
|
385
|
+
rules.push identifier("Set") +
|
|
386
|
+
identifier("padding", "margin") +
|
|
387
|
+
number +
|
|
388
|
+
operator(",") +
|
|
389
|
+
number +
|
|
390
|
+
operator(",") +
|
|
391
|
+
number +
|
|
392
|
+
operator(",") +
|
|
393
|
+
number
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
end
|