Tweaking out the machine voodoo.

This commit is contained in:
Paul R. Tagliamonte 2013-03-13 21:30:17 -04:00
parent 1a9e2f66d8
commit 36bc16211e
3 changed files with 13 additions and 6 deletions

View File

@ -87,12 +87,13 @@ class Machine(object):
if self.submachine:
self.submachine.process([char])
if type(self.submachine.state) == Idle:
if len(self.submachine.nodes) != 1:
if len(self.submachine.nodes) > 1:
raise LexException("Funky Submachine stuff")
nodes = self.submachine.nodes
self.submachine = None
self.state.nodes.append(nodes[0])
if nodes != []:
self.state.nodes.append(nodes[0])
continue
new = self.state.process(char)

View File

@ -153,6 +153,11 @@ class ListeyThing(State):
self.machine.sub(String)
return
if char == ";":
self.commit()
self.machine.sub(Comment)
return
if char == self.end_char:
return Idle

View File

@ -26,7 +26,8 @@
(route "/" [] (render-template "repl.html"))
(post-route "/hy2py" []
(try (hy-to-py (get request.form "code"))
(catch LexException (err "Incomplete Code."))
(catch HyError (err "Generic error during processing."))
(catch Exception (err "Erm, you broke something."))))
(try
(hy-to-py (get request.form "code"))
(catch LexException (err "Incomplete Code."))
(catch HyError (err "Generic error during processing."))
(catch Exception (err "Erm, you broke something."))))