-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow match to take a table of pattern -> handlers instead, and match the earliest and longest pattern that we find in the output buffer.
- Loading branch information
Showing
6 changed files
with
119 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- Executed like `./orch -f cat-multi.orch -- cat` -- this one won't spawn | ||
-- anything itself, so it must be done on the command line. | ||
|
||
-- We get released on first match anyways, so this doesn't need to be called: | ||
-- release() | ||
|
||
write "Send One Two\r" | ||
match { | ||
One = function() | ||
write "LOL\r" | ||
|
||
debug "Matched one" | ||
match "LOL" { | ||
callback = function() | ||
debug "lol" | ||
write "Foo\r" | ||
end | ||
} | ||
-- Also valid: | ||
-- write "Foo" | ||
match "Foo" { | ||
callback = function() | ||
debug "foo matched too" | ||
end | ||
} | ||
end, | ||
Two = function() | ||
debug "Called two" | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters