@@ -32,30 +32,94 @@ regex.tips = {
3232 end
3333 end ,
3434
35+
3536 quantifier_count = function (_ , item )
36- if string.match (item .text , " ^%d+$" ) then
37- return string.format (" Matches a pattern exactly %s times." , item .text );
38- elseif string.match (item .text , " ^%d+,$" ) then
37+ --- | fS
38+
39+ local is_lazy = string.match (item .text , " %?$" ) ~= nil ;
40+ local desc ;
41+
42+ if is_lazy then
43+ desc = " This will match as few times as possible(that successfully matches)."
44+ else
45+ desc = " This will match as many times as possible."
46+ end
47+
48+ if string.match (item .text , " %{(%d+)%}" ) then
49+ return string.format (
50+ " Matches a pattern exactly %s times." ,
51+ string.match (item .text , " ^%{(%d+)%}" )
52+ );
53+ elseif string.match (item .text , " ^%{(%d+),%}" ) then
3954 return string.format (
40- " Matches a pattern at least %s times.\n \n This will match the highest number of occurrences. " ,
41- string.match (item .text , " ^(%d+)" )
55+ " Matches a pattern at least %s times. \n \n " .. desc ,
56+ string.match (item .text , " ^%{ (%d+),%} " )
4257 );
43- elseif string.match (item .text , " ^, %d+$ " ) then
58+ elseif string.match (item .text , " ^%{,( %d+)%} " ) then
4459 return string.format (
45- " Matches a pattern at most %s times.\n \n This will match the highest number of occurrences. " ,
46- string.match (item .text , " ^,(%d+)$ " )
60+ " Matches a pattern at most %s times. \n \n " .. desc ,
61+ string.match (item .text , " ^%{ ,(%d+)%} " )
4762 );
4863 else
4964 return string.format (
50- " Matches a pattern between %s & %s times.\n \n This will match the highest number of occurrences. " ,
51- string.match (item .text , " ^(%d+)," ),
52- string.match (item .text , " ^%d+,(%d+)$ " )
65+ " Matches a pattern between %s & %s times. \n \n " .. desc ,
66+ string.match (item .text , " ^%{ (%d+),%d+%} " ),
67+ string.match (item .text , " ^%{% d+,(%d+)%} " )
5368 );
5469 end
70+
71+ --- | fE
72+ end ,
73+ quantifier_optional = function (_ , item )
74+ --- | fS
75+
76+ local is_lazy = string.match (item .text , " %?$" ) ~= nil ;
77+ local desc ;
78+
79+ if is_lazy then
80+ desc = " This will match as few times as possible(that successfully matches)."
81+ else
82+ desc = " This will match as many times as possible."
83+ end
84+
85+ return " Matches a pattern zero or one time. \n \n " .. desc ;
86+
87+ --- | fE
5588 end ,
56- quantifier_optional = " Matches a pattern zero or one time." ,
57- quantifier_plus = " Matches a pattern one or more times.\n \n This will match the highest number of occurrences." ,
58- quantifier_star = " Matches a pattern zero or more times.\n \n This will match the highest number of occurrences." ,
89+ quantifier_plus = function (_ , item )
90+ --- | fS
91+
92+ local is_lazy = string.match (item .text , " %?$" ) ~= nil ;
93+ local desc ;
94+
95+ if is_lazy then
96+ desc = " This will match as few times as possible(that successfully matches)."
97+ else
98+ desc = " This will match as many times as possible."
99+ end
100+
101+ return " Matches a pattern one or more times.\n \n " .. desc ;
102+
103+ --- | fE
104+ end ,
105+ quantifier_star = function (_ , item )
106+ --- | fS
107+
108+ local is_lazy = string.match (item .text , " %?$" ) ~= nil ;
109+ local desc ;
110+
111+ if is_lazy then
112+ desc = " This will match as few times as possible(that successfully matches)."
113+ else
114+ desc = " This will match as many times as possible."
115+ end
116+
117+ return " Matches a pattern zero or more times.\n \n " .. desc ;
118+
119+ --- | fE
120+ end ,
121+
122+ lazy = " Makes the quantifier lazy(non-greedy)." ,
59123
60124
61125 pattern_character = function (_ , item )
@@ -237,7 +301,7 @@ regex.__generic = function (buffer, item)
237301 local win_w = vim .api .nvim_win_get_width (utils .win_findbuf (buffer ));
238302 local tip = spec .get ({ item .kind }, {
239303 source = regex .tips ,
240- eval_args = { buffer , item }
304+ args = { buffer , item },
241305 });
242306
243307 if tip and config .show_tip ~= false then
@@ -322,7 +386,7 @@ regex.render = function (buffer, content)
322386 local can_render , data = pcall (regex .__generic , buffer , entry );
323387
324388 if can_render == false then
325- vim .print (data );
389+ -- vim.print(data);
326390 elseif entry .current then
327391 current_line = data ;
328392 end
0 commit comments