|
Go to the documentation of this file.
32 "and", "break", "do", "else", "elseif", "end", "false",
33 "for", "function", "if", "in", "local", "nil", "not", "or",
34 "repeat", "return", "then", "true", "until", "while", NULL
39 std::string::const_iterator sit=str.begin();
40 if(sit==str.end()) return false;
41 if(!(isalpha(*sit) || *sit== '_')) return false;
42 for(++sit; sit!=str.end(); ++sit)
43 if(!(isalnum(*sit) || *sit== '_')) return true;
48 static void faudes_rl_dmadd(std::list< std::string > & mlist, const std::string& prefix, const std::string& str, const std::string& suffix) {
51 for( unsigned int i=0;i<suffix.size();i++)
57 comp=prefix + str + suffix;
60 mlist.push_back(comp);
65 mlist.push_back(*mlist.begin());
66 mlist.push_back(comp);
69 std::string& match=*mlist.begin();
70 std::string::iterator mit, cit;
73 while(mit!=match.end() && cit!=comp.end()) {
79 match.erase(mit,match.end());
81 mlist.push_back(comp);
89 if(!lua_getmetatable(L, -1))
90 { lua_pop(L, 1); return 0; }
93 lua_pushstring(L, "__index");
97 if(lua_isnil(L,-1) || lua_rawequal(L, -1, -2))
98 { lua_pop(L, 1); return 0; }
107 if(!lua_getmetatable(L, -1))
108 { lua_pop(L, 1); lua_newtable(L); return; }
111 lua_pushstring(L, ".fn");
114 if(!lua_istable(L, -1))
115 { lua_pop(L, 1); lua_newtable(L); return; }
123 if(!lua_getmetatable(L, -1))
124 { lua_pop(L, 1); lua_newtable(L); return; }
127 lua_pushstring(L, ".get");
130 if(!lua_istable(L, -1))
131 { lua_pop(L, 1); lua_newtable(L); return; }
142 if(lua_istable(L,-1)) {
145 if(lua_next(L, -2)) {
169 if(lua_istable(L, -1)) {
170 lua_pushlstring(L, s, n);
172 if(!lua_isnil(L, -1))
173 {lua_replace(L, -2); return 1;}
187 std::list< std::string > mlist;
188 const char* text= word.c_str();
194 size_t i, n, dot, loop;
197 bool used_swig_get= false;
200 if (!(text[0] == '\0' || isalpha(text[0]) || text[0] == '_')) return mlist;
203 savetop = lua_gettop(L);
207 lua_pushvalue(L, LUA_GLOBALSINDEX);
208 for (n = ( size_t)(end-start), i = dot = 0, colon=-1; i < n; i++)
209 if (text[i] == '.' || text[i] == ':') {
211 { lua_settop(L, savetop); return mlist; }
213 if(text[i] == ':') colon=dot;
219 if(!strncmp(s, text, n)) faudes_rl_dmadd(mlist, "", std::string(s), " ");
224 if(lua_istable(L, -1) &&
225 (loop == 0 || !lua_rawequal(L, -1, LUA_GLOBALSINDEX)))
226 for (lua_pushnil(L); lua_next(L, -2); lua_pop(L, 1))
227 if (lua_type(L, -2) == LUA_TSTRING) {
228 s = lua_tostring(L, -2);
231 (*s != '_' || text[dot] == '_')) {
232 std::string suf = " ";
233 switch (lua_type(L, -1)) {
234 case LUA_TTABLE: suf = ":."; break;
235 case LUA_TFUNCTION: if(!used_swig_get) suf = "("; break;
237 if (lua_getmetatable(L, -1)) { lua_pop(L, 1); suf = ":."; }
244 } while (++loop < 20);
247 lua_settop(L, savetop);
static int faudes_rl_getmetaindex(lua_State *L)
static std::list< std::string > faudes_rl_complete(lua_State *L, const std::string &word)
static int faudes_rl_getfield(lua_State *L, const char *s, size_t n)
static void faudes_rl_getmetafn(lua_State *L)
static int faudes_rl_getmeta(lua_State *L, bool has_colon)
static const char *const faudes_rl_keywords[]
static void faudes_rl_dmadd(std::list< std::string > &mlist, const std::string &prefix, const std::string &str, const std::string &suffix)
static bool faudes_rl_valididentifier(const std::string &str)
static void faudes_rl_getmetaget(lua_State *L)
libFAUDES 2.32b
--- 2024.03.01
--- c++ api documentaion by doxygen
|