Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function prepareParsing( mt )
- // ... rip uniteresting code...
- // we get the sw code, that is our Switch syntactic tree.
- sw = self.prepareSwitch( self.nilStates, "state" )
- // we create a parametric syntree using the {() ...} expression, that
- // is similar to {[] ... } but for the fact that it wraps the code in
- // a prefix that will assign the symbols during the evaluation.
- // The switch here is placed by unescape; that means, it is inserted
- // in the below code with the value it has NOW in this function.
- // however, it's still a VALUE;
- // There are two ways to make it being executed in the following code,
- // 1) add each step in sw tree into func
- // 2) more simply, evaluate the switch code via () evaluation.
- // in short, the switch on the "state" symbol we created via prepareSwitch
- // and that references a "text" symbol in some part, will be evaluated in
- // the context of the following parametric code, when someone will invoke
- // func('something'), or better, mt.onText( 'something' )
- func = {(text) state = ^~self.currentState(); tree = nil; ^~sw() }
- mt.onText = func
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement