diff options
Diffstat (limited to 'src/flint.cr')
| -rw-r--r-- | src/flint.cr | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/flint.cr b/src/flint.cr index 6d68305..02fdd85 100644 --- a/src/flint.cr +++ b/src/flint.cr @@ -4,6 +4,7 @@ require "option_parser" require "./util.cr" require "./program.cr" +require "./among_us/*" require "./brainfuck/*" require "./thue/*" @@ -11,6 +12,7 @@ module Flint VERSION = "0.1.1" enum Language + AmongUs Brainfuck Thue end @@ -71,10 +73,9 @@ module Flint crash("ERROR: No language chosen", parser) if _args.size == 0 crash("ERROR: No source file chosen", parser) if _args.size == 1 && !read_stdin source_file = _args[1] unless read_stdin - language = case _args[0].downcase - when "brainfuck" then Language::Brainfuck - when "thue" then Language::Thue - else crash("ERROR: Unknown language specified: '#{_args[0]}'\nUser the '--supported-languages' flag to see whatlanguages are valid.", parser) + language = Language.parse?(_args[0]) + if language.nil? + crash("ERROR: Unknown language specified: '#{_args[0]}'\nUser the '--supported-languages' flag to see whatlanguages are valid.", parser) end end end @@ -90,6 +91,8 @@ module Flint end program = case language.not_nil! + in Language::AmongUs + AmongUs::Program.new(source_io) in Language::Brainfuck begin m_str = language_options[:memory_size]? |
