Last active
December 16, 2015 18:49
-
-
Save tokiwoousaka/5480615 to your computer and use it in GitHub Desktop.
egisonのmatcherの定義。
見様見真似で書いてみたけどどうしてこーなるのか解らんw
This file contains hidden or 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
(define $hoge | |
(matcher { | |
;; <primitive-pp> | |
[,$val [] {[$tgt | |
(match [val tgt] [hoge hoge] { | |
[[<aaa> <aaa>] {[]}] | |
[[<bbb> <bbb>] {[]}] | |
[[<ccc> <ccc>] {[]}] | |
[_ {}]})]}] | |
;; <primitive-dp> | |
[<aaa> [] {[<AAA> {[]}] [_ {}]}] | |
[<bbb> [] {[<BBB> {[]}] [_ {}]}] | |
[<ccc> [] {[<CCC> {[]}] [_ {}]}]})) | |
;; <OK> patterns | |
(test "------------") | |
(test (match <AAA> hoge {[<aaa> <OK>] [_ <KO>]})) | |
(test (match <AAA> hoge {[,<AAA> <OK>] [_ <KO>]})) | |
(test (match <BBB> hoge {[<bbb> <OK>] [_ <KO>]})) | |
(test (match <BBB> hoge {[,<BBB> <OK>] [_ <KO>]})) | |
(test (match <CCC> hoge {[<ccc> <OK>] [_ <KO>]})) | |
(test (match <CCC> hoge {[,<CCC> <OK>] [_ <KO>]})) | |
;; <KO> patterns | |
(test "------------") | |
(test (match <AAA> hoge {[<bbb> <OK>] [_ <KO>]})) | |
(test (match <AAA> hoge {[,<BBB> <OK>] [_ <KO>]})) | |
(test (match <AAA> hoge {[<ccc> <OK>] [_ <KO>]})) | |
(test (match <AAA> hoge {[,<CCC> <OK>] [_ <KO>]})) | |
(test (match <BBB> hoge {[<aaa> <OK>] [_ <KO>]})) | |
(test (match <BBB> hoge {[,<AAA> <OK>] [_ <KO>]})) | |
(test (match <BBB> hoge {[<ccc> <OK>] [_ <KO>]})) | |
(test (match <BBB> hoge {[,<CCC> <OK>] [_ <KO>]})) | |
(test (match <CCC> hoge {[<aaa> <OK>] [_ <KO>]})) | |
(test (match <CCC> hoge {[,<AAA> <OK>] [_ <KO>]})) | |
(test (match <CCC> hoge {[<bbb> <OK>] [_ <KO>]})) | |
(test (match <CCC> hoge {[,<BBB> <OK>] [_ <KO>]})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment