コード例 #1
0
ファイル: pyski.py プロジェクト: asmodehn/adam
 def emptyline(self):
     """
     Called when the input line is empty
     This executes one computation on the existing stack
     :return:
     """
     stkline = " ".join(stk_get())
     if stkline:
         self.onecmd(stkline)
コード例 #2
0
ファイル: pyski.py プロジェクト: asmodehn/adam
 def default(self, line):
     """Called on an input line when the command prefix is not recognized.
     This method automatically adds the command as undefined word, and recurse on argument (until one known command is found).
     """
     # lets extract the command
     cmd, arg, line = self.parseline(line)
     if cmd:  # checking for ''
         # an add it to the stack (PUSH)
         stk_set(cmd, *stk_get())
コード例 #3
0
ファイル: pyski.py プロジェクト: asmodehn/adam
 def do_rot(self, arg):
     stk_set(*rot(*stk_get()))
コード例 #4
0
ファイル: pyski.py プロジェクト: asmodehn/adam
 def do_over(self, arg):
     stk_set(*over(*stk_get()))
コード例 #5
0
ファイル: pyski.py プロジェクト: asmodehn/adam
 def do_swap(self, arg):
     stk_set(*swap(*stk_get()))
コード例 #6
0
ファイル: pyski.py プロジェクト: asmodehn/adam
 def do_drop(self, arg):
     stk_set(*drop(*stk_get()))
コード例 #7
0
ファイル: pyski.py プロジェクト: asmodehn/adam
 def do_dup(self, arg):
     """duplicates its argument and push it up to the stack.
     Extra arguments are treated before, following stack semantics.
     This might seem a bit confusing and might be improved by switching prefix/postfix input semantics and repl design...
     """
     stk_set(*dup(*stk_get()))
コード例 #8
0
ファイル: pyski.py プロジェクト: asmodehn/adam
 def prompt_refresh(self):
     # note : we need the reversed stack for a left prompt
     self.prompt = " ".join(reversed(tuple(stk_get()))) + ' '