Ruby: CFG make in-clause post-order

This commit is contained in:
Arthur Baars
2021-12-13 19:37:11 +01:00
parent f49605569b
commit a9286e897b
2 changed files with 161 additions and 165 deletions

View File

@@ -585,50 +585,50 @@ case.rb:
#-----| -> exit case_match (normal)
# 9| value
#-----| -> in ... then ...
# 10| in ... then ...
#-----| -> 0
# 10| in ... then ...
#-----| -> case ...
# 10| 0
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> 1
# 11| in ... then ...
#-----| -> 1
#-----| -> case ...
# 11| 1
#-----| no-match -> in ... then ...
#-----| match -> 3
#-----| no-match -> 2
# 11| then ...
#-----| -> case ...
#-----| -> in ... then ...
# 11| 3
#-----| -> then ...
# 12| in ... then ...
#-----| -> 2
#-----| -> case ...
# 12| 2
#-----| no-match -> in ... then ...
#-----| match -> 4
#-----| no-match -> x
# 12| then ...
#-----| -> case ...
#-----| -> in ... then ...
# 13| 4
#-----| -> then ...
# 14| in ... then ...
#-----| -> x
#-----| -> case ...
# 14| x
#-----| match -> x
# 14| ... == ...
#-----| false -> in ... then ...
#-----| true -> 6
#-----| false -> x
# 14| x
#-----| -> 5
@@ -637,13 +637,13 @@ case.rb:
#-----| -> ... == ...
# 14| then ...
#-----| -> case ...
#-----| -> in ... then ...
# 14| 6
#-----| -> then ...
# 15| in ... then ...
#-----| -> x
#-----| -> case ...
# 15| x
#-----| match -> x
@@ -659,7 +659,7 @@ case.rb:
#-----| -> ... < ...
# 15| then ...
#-----| -> case ...
#-----| -> in ... then ...
# 15| 7
#-----| -> then ...
@@ -691,13 +691,13 @@ case.rb:
#-----| -> exit case_match_no_match (normal)
# 21| value
#-----| -> in ... then ...
# 22| in ... then ...
#-----| -> 1
# 22| in ... then ...
#-----| -> case ...
# 22| 1
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| raise -> exit case_match_no_match (abnormal)
# 26| enter case_match_raise
@@ -721,16 +721,16 @@ case.rb:
#-----| -> exit case_match_raise (normal)
# 27| value
#-----| -> in ... then ...
#-----| -> -> { ... }
# 28| in ... then ...
#-----| -> -> { ... }
#-----| -> case ...
# 28| enter -> { ... }
#-----| -> x
# 28| -> { ... }
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| raise -> exit case_match_raise (abnormal)
# 28| exit -> { ... }
@@ -771,37 +771,37 @@ case.rb:
#-----| -> exit case_match_array (normal)
# 33| value
#-----| -> in ... then ...
#-----| -> [ ..., * ]
# 34| in ... then ...
#-----| -> [ ..., * ]
#-----| -> case ...
# 34| [ ..., * ]
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| no-match -> [ ..., * ]
#-----| match -> in ... then ...
# 35| in ... then ...
#-----| -> [ ..., * ]
#-----| -> case ...
# 35| [ ..., * ]
#-----| no-match -> in ... then ...
#-----| no-match -> [ ..., * ]
#-----| match -> x
# 35| x
#-----| match -> case ...
#-----| match -> in ... then ...
# 36| in ... then ...
#-----| -> [ ..., * ]
#-----| -> case ...
# 36| [ ..., * ]
#-----| no-match -> in ... then ...
#-----| no-match -> Bar
#-----| match -> x
# 36| x
#-----| match -> case ...
#-----| match -> in ... then ...
# 37| in ... then ...
#-----| -> Bar
#-----| -> case ...
# 37| [ ..., * ]
#-----| match -> a
@@ -824,7 +824,7 @@ case.rb:
#-----| match -> e
# 37| e
#-----| match -> case ...
#-----| match -> in ... then ...
# 41| enter case_match_find
#-----| -> value
@@ -847,10 +847,10 @@ case.rb:
#-----| -> exit case_match_find (normal)
# 42| value
#-----| -> in ... then ...
#-----| -> [ *,...,* ]
# 43| in ... then ...
#-----| -> [ *,...,* ]
#-----| -> case ...
# 43| [ *,...,* ]
#-----| match -> x
@@ -868,7 +868,7 @@ case.rb:
#-----| raise -> exit case_match_find (abnormal)
# 43| y
#-----| -> case ...
#-----| -> in ... then ...
# 47| enter case_match_hash
#-----| -> value
@@ -891,49 +891,49 @@ case.rb:
#-----| -> exit case_match_hash (normal)
# 48| value
#-----| -> in ... then ...
# 49| in ... then ...
#-----| -> Foo
# 49| in ... then ...
#-----| -> case ...
# 49| { ..., ** }
#-----| no-match -> in ... then ...
#-----| match -> 1
#-----| no-match -> Bar
# 49| Foo
#-----| -> Bar
# 49| Bar
#-----| match -> { ..., ** }
#-----| no-match -> in ... then ...
#-----| no-match -> Bar
# 49| 1
#-----| no-match -> in ... then ...
#-----| no-match -> Bar
#-----| match -> rest
# 49| rest
#-----| -> case ...
#-----| -> in ... then ...
# 50| in ... then ...
#-----| -> Bar
#-----| -> case ...
# 50| { ..., ** }
#-----| no-match -> in ... then ...
#-----| match -> 1
#-----| no-match -> Bar
# 50| Bar
#-----| match -> { ..., ** }
#-----| no-match -> in ... then ...
#-----| no-match -> Bar
# 50| 1
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> Bar
# 51| in ... then ...
#-----| -> Bar
#-----| -> case ...
# 51| { ..., ** }
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| raise -> exit case_match_hash (abnormal)
# 51| Bar
@@ -958,20 +958,20 @@ case.rb:
#-----| -> exit case_match_variable (normal)
# 56| value
#-----| -> in ... then ...
# 57| in ... then ...
#-----| -> 5
# 57| in ... then ...
#-----| -> case ...
# 57| 5
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> var
# 58| in ... then ...
#-----| -> var
#-----| -> case ...
# 58| var
#-----| match -> case ...
#-----| match -> in ... then ...
# 63| enter case_match_underscore
#-----| -> value
@@ -991,20 +991,20 @@ case.rb:
#-----| -> exit case_match_underscore (normal)
# 64| value
#-----| -> in ... then ...
#-----| -> ... | ...
# 65| in ... then ...
#-----| -> ... | ...
#-----| -> case ...
# 65| ... | ...
#-----| -> 5
# 65| 5
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| no-match -> _
# 65| _
#-----| match -> case ...
#-----| match -> in ... then ...
# 69| enter case_match_various
#-----| -> value
@@ -1036,38 +1036,38 @@ case.rb:
#-----| -> exit case_match_various (normal)
# 72| value
#-----| -> in ... then ...
# 73| in ... then ...
#-----| -> 5
# 73| in ... then ...
#-----| -> case ...
# 73| 5
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> ^...
# 74| in ... then ...
#-----| -> ^...
#-----| -> case ...
# 74| ^...
#-----| -> foo
# 74| foo
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> "string"
# 75| in ... then ...
#-----| -> "string"
#-----| -> case ...
# 75| "string"
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> Array
# 76| in ... then ...
#-----| -> Array
#-----| -> case ...
# 76| call to []
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> Array
# 76| Array
#-----| -> "foo"
@@ -1079,11 +1079,11 @@ case.rb:
#-----| -> call to []
# 77| in ... then ...
#-----| -> Array
#-----| -> case ...
# 77| call to []
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> /.*abc[0-9]/
# 77| Array
#-----| -> :"foo"
@@ -1095,98 +1095,98 @@ case.rb:
#-----| -> call to []
# 78| in ... then ...
#-----| -> /.*abc[0-9]/
#-----| -> case ...
# 78| /.*abc[0-9]/
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> 5
# 79| in ... then ...
#-----| -> 5
#-----| -> case ...
# 79| 5
#-----| -> 10
# 79| _ .. _
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> 10
# 79| 10
#-----| -> _ .. _
# 80| in ... then ...
#-----| -> 10
#-----| -> case ...
# 80| _ .. _
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> 5
# 80| 10
#-----| -> _ .. _
# 81| in ... then ...
#-----| -> 5
#-----| -> case ...
# 81| 5
#-----| -> _ .. _
# 81| _ .. _
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| no-match -> ... => ...
#-----| match -> in ... then ...
# 82| in ... then ...
#-----| -> ... => ...
#-----| -> case ...
# 82| ... => ...
#-----| -> 5
# 82| 5
#-----| no-match -> in ... then ...
#-----| no-match -> ... | ...
#-----| match -> x
# 82| x
#-----| -> case ...
#-----| -> in ... then ...
# 83| in ... then ...
#-----| -> ... | ...
#-----| -> case ...
# 83| ... | ...
#-----| -> 5
# 83| 5
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| no-match -> ^...
# 83| ^...
#-----| -> foo
# 83| foo
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| no-match -> "string"
# 83| "string"
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> Foo
# 84| in ... then ...
#-----| -> Foo
#-----| -> case ...
# 84| Bar
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> -> { ... }
# 84| Foo
#-----| -> Bar
# 85| in ... then ...
#-----| -> -> { ... }
#-----| -> case ...
# 85| enter -> { ... }
#-----| -> x
# 85| -> { ... }
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> :foo
# 85| exit -> { ... }
@@ -1206,75 +1206,75 @@ case.rb:
#-----| -> ... == ...
# 86| in ... then ...
#-----| -> :foo
#-----| -> case ...
# 86| :foo
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| no-match -> :"foo bar"
#-----| match -> in ... then ...
# 87| in ... then ...
#-----| -> :"foo bar"
#-----| -> case ...
# 87| :"foo bar"
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| no-match -> ... | ...
#-----| match -> in ... then ...
# 88| in ... then ...
#-----| -> ... | ...
#-----| -> case ...
# 88| ... | ...
#-----| -> 5
# 88| - ...
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| no-match -> 10
# 88| 5
#-----| -> - ...
# 88| + ...
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| no-match -> ... | ...
#-----| match -> in ... then ...
# 88| 10
#-----| -> + ...
# 89| in ... then ...
#-----| -> ... | ...
#-----| -> case ...
# 89| ... | ...
#-----| -> nil
# 89| nil
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| no-match -> self
# 89| self
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| no-match -> true
# 89| true
#-----| match -> case ...
#-----| no-match -> false
#-----| match -> in ... then ...
# 89| false
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| no-match -> __LINE__
# 89| __LINE__
#-----| match -> case ...
#-----| no-match -> __FILE__
#-----| match -> in ... then ...
# 89| __FILE__
#-----| match -> case ...
#-----| no-match -> __ENCODING__
#-----| match -> in ... then ...
# 89| __ENCODING__
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> ( ... )
# 90| in ... then ...
#-----| -> ( ... )
#-----| -> case ...
# 90| ( ... )
#-----| -> 1
@@ -1283,11 +1283,11 @@ case.rb:
#-----| -> _ .. _
# 90| _ .. _
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> in ... then ...
#-----| no-match -> ( ... )
# 91| in ... then ...
#-----| -> ( ... )
#-----| -> case ...
# 91| ( ... )
#-----| -> ... | ...
@@ -1296,19 +1296,19 @@ case.rb:
#-----| -> 0
# 91| 0
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| no-match -> ""
# 91| ""
#-----| no-match -> [ ..., * ]
#-----| match -> case ...
#-----| match -> in ... then ...
# 91| [ ..., * ]
#-----| match -> case ...
#-----| no-match -> { ..., ** }
#-----| match -> in ... then ...
# 91| { ..., ** }
#-----| match -> case ...
#-----| match -> in ... then ...
#-----| raise -> exit case_match_various (abnormal)
# 95| enter case_match_guard_no_else
@@ -1332,10 +1332,10 @@ case.rb:
#-----| -> exit case_match_guard_no_else (normal)
# 96| value
#-----| -> in ... then ...
#-----| -> x
# 97| in ... then ...
#-----| -> x
#-----| -> case ...
# 97| x
#-----| match -> x
@@ -1351,7 +1351,7 @@ case.rb:
#-----| -> ... == ...
# 97| then ...
#-----| -> case ...
#-----| -> in ... then ...
# 97| 6
#-----| -> then ...