add a task to do the parsing on the server

This commit is contained in:
Torsten Ruger 2015-07-11 21:41:38 +03:00
parent 9822f3d770
commit 1ebdf7f43c
3 changed files with 20 additions and 1 deletions

View File

@ -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

View 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

View File

@ -0,0 +1,3 @@
#require "salama"
Virtual::Machine.boot