update for yielding
wip
This commit is contained in:
parent
11cdb5872a
commit
bba8f787d5
@ -25,11 +25,12 @@ body
|
||||
width: 16%
|
||||
margin-left: 1%
|
||||
overflow-x: hidden
|
||||
|
||||
|
||||
.risc_view
|
||||
width: 34%
|
||||
margin-left: 1%
|
||||
|
||||
overflow-x: hidden
|
||||
|
||||
.status_view
|
||||
width: 14%
|
||||
margin-left: 1%
|
||||
|
@ -55,6 +55,7 @@ class SelectView < ElementView
|
||||
@element.at_css(".code_list") << list
|
||||
end
|
||||
|
||||
|
||||
def select( code )
|
||||
puts "selecting #{code}"
|
||||
@interpreter.set_state :stopped
|
||||
@ -64,13 +65,14 @@ class SelectView < ElementView
|
||||
@interpreter.start_program(linker)
|
||||
end
|
||||
def as_main(statements)
|
||||
"class Space ;def main(arg) ; #{statements}; end; end"
|
||||
"class Space ;def yielder; return yield ; end;def main(arg) ; #{statements}; end; end"
|
||||
end
|
||||
def get_codes
|
||||
{ while_with_calls: 'a = 0; while( 0 > a); a = 1 + a;end;return a',
|
||||
set_internal_byte: "return 'Hello'.set_internal_byte(1,75)" ,
|
||||
called_if: 'if( 10 ); return "then";else;return "else";end' ,
|
||||
plus: 'return 5 + 7' ,
|
||||
yield: "a = yielder {return 15} ; return a" ,
|
||||
return: 'return 5' ,
|
||||
hello_world: "h = 'Hello World'.putstring;return h",
|
||||
dynamic_call: "a = 150 ; return a.div10",
|
||||
|
@ -36,7 +36,7 @@ class RiscView < ListView
|
||||
|
||||
def instruction_text
|
||||
return "" unless @interpreter.instruction
|
||||
@interpreter.instruction.to_s.split("(").first
|
||||
@interpreter.instruction.to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -29,7 +29,7 @@ class VoolView < ElementView
|
||||
method = i.source.method
|
||||
end
|
||||
#TODO, give mom a source
|
||||
when Parfait::TypedMethod
|
||||
when Parfait::Callable
|
||||
method = i.source
|
||||
when String
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user