2021-12-07 16:09:17 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-11-23 13:10:03 +01:00
|
|
|
module Rpl
|
2021-12-07 15:50:58 +01:00
|
|
|
module Lang
|
|
|
|
module Core
|
|
|
|
module_function
|
2021-11-10 16:20:47 +01:00
|
|
|
|
2021-12-07 15:50:58 +01:00
|
|
|
# no operation
|
2022-02-10 14:33:09 +01:00
|
|
|
def nop; end
|
2022-02-09 16:35:54 +01:00
|
|
|
|
|
|
|
# show version
|
2022-02-10 14:33:09 +01:00
|
|
|
def version
|
|
|
|
@stack += parse( @version.to_s )
|
2022-02-09 16:35:54 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
# show complete identification string
|
2022-02-10 14:33:09 +01:00
|
|
|
def uname
|
|
|
|
@stack += parse( "\"Rpl Interpreter version #{@version}\"" )
|
2022-02-09 16:35:54 +01:00
|
|
|
end
|
|
|
|
|
2022-02-10 14:33:09 +01:00
|
|
|
def help
|
|
|
|
args = stack_extract( [%i[name]] )
|
2022-02-09 16:38:09 +01:00
|
|
|
|
2022-02-10 14:33:09 +01:00
|
|
|
word = @dictionary.words[ args[0][:value] ]
|
2022-02-09 16:38:09 +01:00
|
|
|
|
2022-02-10 14:33:09 +01:00
|
|
|
@stack << { type: :string,
|
|
|
|
value: "#{args[0][:value]}: #{word.nil? ? 'not a core word' : word[:help]}" }
|
2022-02-09 16:38:09 +01:00
|
|
|
end
|
2021-11-10 16:20:47 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|