(tree *[]functions.FunctionT, parent *Process)
| 19 | const ExpressionFunctionName = "expr" |
| 20 | |
| 21 | func compile(tree *[]functions.FunctionT, parent *Process) (*[]Process, int) { |
| 22 | if parent == nil { |
| 23 | panic("nil parent") |
| 24 | } |
| 25 | |
| 26 | if tree == nil { |
| 27 | panic("nil tree") |
| 28 | } |
| 29 | |
| 30 | rm := parent.RunMode |
| 31 | if len(*tree) > 0 && (string((*tree)[0].Command) == "runmode" || |
| 32 | string((*tree)[0].Command) == "runmode:") { |
| 33 | _, params, err := ParseStatementParameters((*tree)[0].Raw, parent) |
| 34 | if err != nil { |
| 35 | return nil, ErrUnableToParseParametersInRunmode |
| 36 | } |
| 37 | |
| 38 | switch strings.Join(params, " ") { |
| 39 | |
| 40 | // function wide scopes |
| 41 | |
| 42 | case "unsafe function": |
| 43 | rm = runmode.FunctionUnsafe |
| 44 | |
| 45 | case "try function": |
| 46 | rm = runmode.FunctionTry |
| 47 | |
| 48 | case "trypipe function": |
| 49 | rm = runmode.FunctionTryPipe |
| 50 | |
| 51 | case "tryerr function": |
| 52 | rm = runmode.FunctionTryErr |
| 53 | |
| 54 | case "trypipeerr function": |
| 55 | rm = runmode.FunctionTryPipeErr |
| 56 | |
| 57 | // module wide scopes |
| 58 | |
| 59 | case "unsafe module": |
| 60 | rm = runmode.ModuleUnsafe |
| 61 | ModuleRunModes[parent.FileRef.Source.Module] = rm |
| 62 | |
| 63 | case "try module": |
| 64 | rm = runmode.ModuleTry |
| 65 | ModuleRunModes[parent.FileRef.Source.Module] = rm |
| 66 | |
| 67 | case "trypipe module": |
| 68 | rm = runmode.ModuleTryPipe |
| 69 | ModuleRunModes[parent.FileRef.Source.Module] = rm |
| 70 | |
| 71 | case "tryerr module": |
| 72 | rm = runmode.ModuleTryErr |
| 73 | ModuleRunModes[parent.FileRef.Source.Module] = rm |
| 74 | |
| 75 | case "trypipeerr module": |
| 76 | rm = runmode.ModuleTryPipeErr |
| 77 | ModuleRunModes[parent.FileRef.Source.Module] = rm |
| 78 |
no test coverage detected