File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,35 @@ function TodoConfig:parse(input)
69
69
70
70
return TodoConfig :_new (words ), input
71
71
end
72
+
73
+ --- @param from string
74
+ --- @param to string
75
+ --- @return TodoConfigRecordBehavior
76
+ function TodoConfig :get_logging_behavior (from , to )
77
+ --- Find the from config
78
+ local from_config = self :_find_word (from )
79
+ local to_config = self :_find_word (to )
80
+
81
+ -- Ensure the described transition is valid
82
+ if from_config == nil or to_config == nil then
83
+ return false
84
+ end
85
+
86
+ return to_config .on_enter or from_config .on_leave
87
+ end
88
+
89
+ --- Finds the word config with the associated name
90
+ --- @private
91
+ --- @param name string
92
+ --- @return TodoConfigWord ?
93
+ function TodoConfig :_find_word (name )
94
+ for _ , x in ipairs (self .words ) do
95
+ if x .name == name then
96
+ return x
97
+ end
98
+ end
99
+
100
+ return nil
72
101
end
73
102
74
103
--- @param name string
You can’t perform that action at this time.
0 commit comments