add a task to do the parsing on the server
This commit is contained in:
parent
9822f3d770
commit
1ebdf7f43c
@ -1,4 +1,5 @@
|
||||
# By default Volt generates this controller for your Main component
|
||||
require "salama"
|
||||
|
||||
if RUBY_PLATFORM == 'opal'
|
||||
require "main/lib/main_view"
|
||||
@ -12,7 +13,11 @@ module Main
|
||||
end
|
||||
|
||||
def about
|
||||
# Add code for when the about view is loaded
|
||||
promise = ParseTask.parse(1).then do |result|
|
||||
puts result
|
||||
end.fail do |error|
|
||||
puts "Error: #{error}"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
11
app/main/tasks/parse_task.rb
Normal file
11
app/main/tasks/parse_task.rb
Normal file
@ -0,0 +1,11 @@
|
||||
require "salama-reader"
|
||||
|
||||
class ParseTask < Volt::Task
|
||||
def parse(num)
|
||||
string_input = '"Hello again".putstring()'
|
||||
parser = Parser::Salama.new
|
||||
out = parser.parse(string_input)
|
||||
parts = Parser::Transform.new.apply(out)
|
||||
Sof.write parts
|
||||
end
|
||||
end
|
3
config/initializers/boot_salama.rb
Normal file
3
config/initializers/boot_salama.rb
Normal file
@ -0,0 +1,3 @@
|
||||
#require "salama"
|
||||
|
||||
Virtual::Machine.boot
|
Loading…
x
Reference in New Issue
Block a user