From 87c3467930e97bb7c00b0f355ff4eeba82ab8a90 Mon Sep 17 00:00:00 2001 From: shylinux Date: Wed, 29 Mar 2023 14:05:08 +0800 Subject: [PATCH] opt some --- base/yac/stack.go | 7 ++++--- core/code/shy.go | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/base/yac/stack.go b/base/yac/stack.go index 05ca28df..9e98b268 100644 --- a/base/yac/stack.go +++ b/base/yac/stack.go @@ -77,7 +77,7 @@ func (s *Stack) parse(m *ice.Message, p string) *Stack { if text = s.list[s.line]; text == "" || strings.HasPrefix(text, "#") { continue } - for s.rest = kit.Split(text, "\t ", "+-*/;"); len(s.rest) > 0; { + for s.rest = kit.Split(text, "\t ", OPS); len(s.rest) > 0; { ls, rest := _parse_rest(BEGIN, s.rest...) if ls[0] == END { if f := s.peekf(); f.pop == nil { @@ -136,12 +136,13 @@ func _parse_rest(split string, arg ...string) ([]string, []string) { } const ( - PWD = "pwd" + OPS = "+-*/;" EXPR = "expr" BEGIN = "{" END = "}" DISABLE = -1 + PWD = "pwd" CMD = "cmd" LET = "let" IF = "if" @@ -157,7 +158,7 @@ func init() { Index.MergeCommands(ice.Commands{ CMD: {Name: "cmd", Hand: func(m *ice.Message, arg ...string) { s := _parse_stack(m) - kit.If(s.runable(), func() { m.Cmdy(arg).Echo(ice.NL) }) + kit.If(s.runable(), func() { m.Cmdy(arg) }) }}, LET: {Name: "let a = 1", Hand: func(m *ice.Message, arg ...string) { s := _parse_stack(m) diff --git a/core/code/shy.go b/core/code/shy.go index 72dd5225..cfcdc5d4 100644 --- a/core/code/shy.go +++ b/core/code/shy.go @@ -19,7 +19,8 @@ func init() { Index.MergeCommands(ice.Commands{ SHY: {Name: "shy path auto", Help: "笔记", Actions: ice.MergeActions(ice.Actions{ mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { - ctx.ProcessCommand(m, web.WIKI_WORD, kit.Simple(path.Join(arg[2], arg[1]))) + // ctx.ProcessCommand(m, web.WIKI_WORD, kit.Simple(path.Join(arg[2], arg[1]))) + ctx.ProcessCommand(m, yac.STACK, kit.Simple(arg[1])) }}, mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { ctx.ProcessCommand(m, yac.STACK, kit.Simple(arg[1]))