@@ -15,63 +15,108 @@ kw.iskeyword("local")) --> true
1515kw .isidentifier (" hello_world" ) -- > true
1616```
1717
18- ## Dependencies
18+ ## Functions
1919
20- Dependencies below are lazy-loaded 💤 on first access.
20+ | Function | Description |
21+ | ----------------------------------------------------- | ----------------------------------------------------------------------------------- |
22+ | [ ` iskeyword(v) ` ] ( #fn-iskeyword ) | Return ` true ` when ` v ` is a reserved Lua keyword. |
23+ | [ ` isidentifier(v) ` ] ( #fn-isidentifier ) | Return ` true ` when ` v ` is a valid non-keyword Lua identifier. |
24+ | [ ` kwlist() ` ] ( #fn-kwlist ) | Return Lua keywords as a [ ` mods.List ` ] ( https://luamod.github.io/mods/modules/list ) . |
25+ | [ ` kwset() ` ] ( #fn-kwset ) | Return Lua keywords as a [ ` mods.Set ` ] ( https://luamod.github.io/mods/modules/set ) . |
26+ | [ ` normalize_identifier(s) ` ] ( #fn-normalize-identifier ) | Normalize an input into a safe Lua identifier. |
2127
22- - [ ` mods.Set ` ] ( https://luamod.github.io/mods/modules/set )
23- - [ ` mods.List ` ] ( https://luamod.github.io/mods/modules/list )
28+ <a id =" fn-iskeyword " ></a >
2429
25- ## Functions
30+ ### ` iskeyword(v) `
31+
32+ Return ` true ` when ` v ` is a reserved Lua keyword.
33+
34+ ** Parameters** :
2635
27- | Function | Description |
28- | ----------------------------------------------- | ----------------------------------------------------------------------------------- |
29- | [ ` iskeyword ` ] ( #iskeyword ) | Return ` true ` when ` s ` is a reserved Lua keyword. |
30- | [ ` isidentifier ` ] ( #isidentifier ) | Return ` true ` when ` s ` is a valid non-keyword Lua identifier. |
31- | [ ` kwlist ` ] ( #kwlist ) | Return Lua keywords as a [ ` mods.List ` ] ( https://luamod.github.io/mods/modules/list ) . |
32- | [ ` kwset ` ] ( #kwset ) | Return Lua keywords as a [ ` mods.Set ` ] ( https://luamod.github.io/mods/modules/set ) . |
33- | [ ` normalize_identifier ` ] ( #normalize-identifier ) | Normalize an input into a safe Lua identifier. |
36+ - ` v ` (` any ` ): Value to validate.
3437
35- ### ` iskeyword `
38+ ** Return ** :
3639
37- Return ` true ` when ` s ` is a reserved Lua keyword.
40+ - ` ok ` (` boolean ` ): Whether the check succeeds.
41+
42+ ** Example** :
3843
3944``` lua
4045kw .iskeyword (" function" ) -- > true
4146kw .iskeyword (" hello" ) -- > false
4247```
4348
44- ### ` isidentifier `
49+ <a id =" fn-isidentifier " ></a >
50+
51+ ### ` isidentifier(v) `
52+
53+ Return ` true ` when ` v ` is a valid non-keyword Lua identifier.
4554
46- Return ` true ` when ` s ` is a valid non-keyword Lua identifier.
55+ ** Parameters** :
56+
57+ - ` v ` (` any ` ): Value to validate.
58+
59+ ** Return** :
60+
61+ - ` ok ` (` boolean ` ): Whether the check succeeds.
62+
63+ ** Example** :
4764
4865``` lua
4966kw .isidentifier (" hello_world" ) -- > true
5067kw .isidentifier (" local" ) -- > false
5168```
5269
53- ### ` kwlist `
70+ <a id =" fn-kwlist " ></a >
71+
72+ ### ` kwlist() `
5473
5574Return Lua keywords as a
5675[ ` mods.List ` ] ( https://luamod.github.io/mods/modules/list ) .
5776
77+ ** Return** :
78+
79+ - ` words ` (` mods.List<string> ` ): List of Lua keywords.
80+
81+ ** Example** :
82+
5883``` lua
5984kw .kwlist ():contains (" and" ) -- > true
6085```
6186
62- ### ` kwset `
87+ <a id =" fn-kwset " ></a >
88+
89+ ### ` kwset() `
6390
6491Return Lua keywords as a
6592[ ` mods.Set ` ] ( https://luamod.github.io/mods/modules/set ) .
6693
94+ ** Return** :
95+
96+ - ` words ` (` mods.Set<string> ` ): Set of Lua keywords.
97+
98+ ** Example** :
99+
67100``` lua
68101kw .kwlset ():contains (" and" ) -- > true
69102```
70103
71- ### ` normalize_identifier `
104+ <a id =" fn-normalize-identifier " ></a >
105+
106+ ### ` normalize_identifier(s) `
72107
73108Normalize an input into a safe Lua identifier.
74109
110+ ** Parameters** :
111+
112+ - ` s ` (` string ` ): Input string.
113+
114+ ** Return** :
115+
116+ - ` ident ` (` string ` ): Normalized Lua identifier.
117+
118+ ** Example** :
119+
75120``` lua
76121kw .normalize_identifier (" 2 bad-name " ) -- > "_2_bad_name"
77122```
0 commit comments