1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 09:34:05 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-03-29 14:05:08 +08:00
parent 45ceab38a6
commit 87c3467930
2 changed files with 6 additions and 4 deletions

View File

@ -77,7 +77,7 @@ func (s *Stack) parse(m *ice.Message, p string) *Stack {
if text = s.list[s.line]; text == "" || strings.HasPrefix(text, "#") { if text = s.list[s.line]; text == "" || strings.HasPrefix(text, "#") {
continue 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...) ls, rest := _parse_rest(BEGIN, s.rest...)
if ls[0] == END { if ls[0] == END {
if f := s.peekf(); f.pop == nil { if f := s.peekf(); f.pop == nil {
@ -136,12 +136,13 @@ func _parse_rest(split string, arg ...string) ([]string, []string) {
} }
const ( const (
PWD = "pwd" OPS = "<!=>+-*/;"
EXPR = "expr" EXPR = "expr"
BEGIN = "{" BEGIN = "{"
END = "}" END = "}"
DISABLE = -1 DISABLE = -1
PWD = "pwd"
CMD = "cmd" CMD = "cmd"
LET = "let" LET = "let"
IF = "if" IF = "if"
@ -157,7 +158,7 @@ func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
CMD: {Name: "cmd", Hand: func(m *ice.Message, arg ...string) { CMD: {Name: "cmd", Hand: func(m *ice.Message, arg ...string) {
s := _parse_stack(m) 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) { LET: {Name: "let a = 1", Hand: func(m *ice.Message, arg ...string) {
s := _parse_stack(m) s := _parse_stack(m)

View File

@ -19,7 +19,8 @@ func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
SHY: {Name: "shy path auto", Help: "笔记", Actions: ice.MergeActions(ice.Actions{ SHY: {Name: "shy path auto", Help: "笔记", Actions: ice.MergeActions(ice.Actions{
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { 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) { mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
ctx.ProcessCommand(m, yac.STACK, kit.Simple(arg[1])) ctx.ProcessCommand(m, yac.STACK, kit.Simple(arg[1]))