nl_tokens: Create a function simulated class allow multiple inheritance
pl_tokens: function createClass ( ) { var mixins , definition ; switch ( arguments . length ) { case 0 : throw <mask> Error ( 'class definition required' ) ; break ; case 1 : mixins = [ ] ; definition = arguments [ 0 ] ; break ; default : mixins = arguments [ 0 ] ; definition = arguments [ 1 ] ; break ; } var newclass = definition [ 'constructor' ] ; if ( typeof newclass !== 'function' ) throw new Error ( 'constructor function required' ) ; if ( typeof newclass . name === 'string' && newclass . name . length === 0 ) throw new Error ( 'constructor name required, it will be used as new class name' ) ; newclass . prototype = definition ; newclass . prototype . instanceOf = instanceOf ; newclass . prototype . Super = superMethod ; // if no mixin given, just create a base class if ( ! mixins ) return newclass ; if ( Array . isArray ( mixins ) ) { // multi inheritance, if mixins is an array of base classes for ( var i = mixins . length - 1 ; i >= 0 ; i -- ) { newclass = mixin ( newclass , mixins [ i ] ) ; } return newclass ; } else { // single inheritance return mixin ( newclass , mixins ) ; } }