monotone

monotone Mtn Source Tree

Root/luaext_globish.cc

1#include "base.hh"
2#include "lua.hh"
3#include "globish.hh"
4#include "sanity.hh"
5
6using std::string;
7
8LUAEXT(match, globish)
9{
10 const char *re = luaL_checkstring(L, -2);
11 const char *str = luaL_checkstring(L, -1);
12
13 bool result = false;
14 try {
15 globish g(re);
16 result = g.matches(str);
17 } catch (informative_failure & e) {
18 return luaL_error(L, e.what());
19 } catch (...) {
20 return luaL_error(L, "Unknown error.");
21 }
22 lua_pushboolean(L, result);
23 return 1;
24}
25
26// Local Variables:
27// mode: C++
28// fill-column: 76
29// c-file-style: "gnu"
30// indent-tabs-mode: nil
31// End:
32// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
33

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status