mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 09:34:05 +08:00
opt some
This commit is contained in:
parent
45ceab38a6
commit
87c3467930
@ -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)
|
||||||
|
@ -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]))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user