Advertisement
Guest User

Untitled

a guest
May 4th, 2014
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Falcon 1.21 KB | None | 0 0
  1.    function prepareParsing( mt )    
  2.       // ... rip uniteresting code...      
  3.  
  4.       // we get the sw code, that is our Switch syntactic tree.
  5.       sw = self.prepareSwitch( self.nilStates, "state" )
  6.  
  7.       // we create a parametric syntree using the {() ...} expression, that
  8.       // is similar to {[] ... } but for the fact that it wraps the code in
  9.       // a prefix that will assign the symbols during the evaluation.
  10.       // The switch here is placed by unescape; that means, it is inserted
  11.       // in the below code with the value it has NOW in this function.
  12.       // however, it's still a VALUE;
  13.       // There are two ways to make it being executed in the following code,
  14.       // 1) add each step in sw tree into func
  15.       // 2) more simply, evaluate the switch code via () evaluation.
  16.       // in short, the switch on the "state" symbol we created via prepareSwitch
  17.       // and that references a "text" symbol in some part, will be evaluated in
  18.       // the context of the following parametric code, when someone will invoke
  19.       // func('something'), or better, mt.onText( 'something' )
  20.       func = {(text) state = ^~self.currentState(); tree = nil; ^~sw() }
  21.       mt.onText = func
  22.      
  23.    end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement