github.com/mmatczuk/gohan@v0.0.0-20170206152520-30e45d9bdb69/extension/gohanscript/autogen/lib_string.go (about)

     1  package autogen
     2  
     3  // AUTO GENERATED CODE DO NOT MODIFY MANUALLY
     4  import (
     5  	"github.com/cloudwan/gohan/extension/gohanscript"
     6  	"github.com/cloudwan/gohan/extension/gohanscript/lib"
     7  )
     8  
     9  func init() {
    10  
    11  	gohanscript.RegisterStmtParser("split",
    12  		func(stmt *gohanscript.Stmt) (func(*gohanscript.Context) (interface{}, error), error) {
    13  			return func(context *gohanscript.Context) (interface{}, error) {
    14  
    15  				var value string
    16  				ivalue := stmt.Arg("value", context)
    17  				if ivalue != nil {
    18  					value = ivalue.(string)
    19  				}
    20  				var sep string
    21  				isep := stmt.Arg("sep", context)
    22  				if isep != nil {
    23  					sep = isep.(string)
    24  				}
    25  
    26  				result1,
    27  					err :=
    28  					lib.Split(
    29  						value, sep)
    30  
    31  				return result1, err
    32  
    33  			}, nil
    34  		})
    35  	gohanscript.RegisterMiniGoFunc("Split",
    36  		func(vm *gohanscript.VM, args []interface{}) []interface{} {
    37  
    38  			value, _ := args[0].(string)
    39  			sep, _ := args[1].(string)
    40  
    41  			result1,
    42  				err :=
    43  				lib.Split(
    44  					value, sep)
    45  			return []interface{}{
    46  				result1,
    47  				err}
    48  
    49  		})
    50  
    51  	gohanscript.RegisterStmtParser("join",
    52  		func(stmt *gohanscript.Stmt) (func(*gohanscript.Context) (interface{}, error), error) {
    53  			return func(context *gohanscript.Context) (interface{}, error) {
    54  
    55  				var value []interface{}
    56  				ivalue := stmt.Arg("value", context)
    57  				if ivalue != nil {
    58  					value = ivalue.([]interface{})
    59  				}
    60  				var sep string
    61  				isep := stmt.Arg("sep", context)
    62  				if isep != nil {
    63  					sep = isep.(string)
    64  				}
    65  
    66  				result1,
    67  					err :=
    68  					lib.Join(
    69  						value, sep)
    70  
    71  				return result1, err
    72  
    73  			}, nil
    74  		})
    75  	gohanscript.RegisterMiniGoFunc("Join",
    76  		func(vm *gohanscript.VM, args []interface{}) []interface{} {
    77  
    78  			value, _ := args[0].([]interface{})
    79  			sep, _ := args[0].(string)
    80  
    81  			result1,
    82  				err :=
    83  				lib.Join(
    84  					value, sep)
    85  			return []interface{}{
    86  				result1,
    87  				err}
    88  
    89  		})
    90  
    91  }