Skip to content

Commit 194a585

Browse files
committed
Added lpeg.h
1 parent 6d15089 commit 194a585

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

scripting/lpeg.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
** $Id: lpeg.h,v 1.1 2009/12/23 16:15:36 roberto Exp $
3+
** LPeg - PEG pattern matching for Lua
4+
** Copyright 2009, Lua.org & PUC-Rio (see 'lpeg.html' for license)
5+
** written by Roberto Ierusalimschy
6+
*/
7+
8+
#ifndef lpeg_h
9+
#define lpeg_h
10+
11+
#include "..\lua.h"
12+
13+
14+
#define KEYNEWPATT "lpeg.newpf"
15+
16+
17+
/*
18+
** type of extension functions that define new "patterns" for LPEG
19+
** It should return the new current position or NULL if match fails
20+
*/
21+
typedef const char *(*PattFunc) (const char *s, /* current position */
22+
const char *e, /* string end */
23+
const char *o, /* string start */
24+
const void *ud); /* user data */
25+
26+
/*
27+
** function to create new patterns based on 'PattFunc' functions.
28+
** This function is available at *registry[KEYNEWPATT]. (Notice
29+
** the extra indirection; the userdata at the registry points to
30+
** a variable that points to the function. In ANSI C a void* cannot
31+
** point to a function.)
32+
*/
33+
typedef void (*Newpf) (lua_State *L,
34+
PattFunc f, /* pattern */
35+
const void *ud, /* (user) data to be passed to 'f' */
36+
size_t l); /* size of data to be passed to 'f' */
37+
38+
#endif

0 commit comments

Comments
 (0)