Skip to content

Commit

Permalink
Merge pull request #1 from cloudwu/master
Browse files Browse the repository at this point in the history
update skynet
  • Loading branch information
great90 committed Oct 23, 2015
2 parents 6394249 + 26cbebf commit 716eccc
Show file tree
Hide file tree
Showing 30 changed files with 549 additions and 343 deletions.
2 changes: 1 addition & 1 deletion 3rd/jemalloc
Submodule jemalloc updated 129 files
8 changes: 7 additions & 1 deletion 3rd/lpeg/HISTORY
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
HISTORY for LPeg 0.12
HISTORY for LPeg 1.0

* Changes from version 0.12 to 1.0
---------------------------------
+ group "names" can be any Lua value
+ some bugs fixed
+ other small improvements

* Changes from version 0.11 to 0.12
---------------------------------
Expand Down
4 changes: 2 additions & 2 deletions 3rd/lpeg/lpcap.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** $Id: lpcap.c,v 1.5 2014/12/12 16:58:47 roberto Exp $
** $Id: lpcap.c,v 1.6 2015/06/15 16:09:57 roberto Exp $
** Copyright 2007, Lua.org & PUC-Rio (see 'lpeg.html' for license)
*/

Expand Down Expand Up @@ -126,7 +126,7 @@ static Capture *findback (CapState *cs, Capture *cap) {
continue; /* opening an enclosing capture: skip and get previous */
if (captype(cap) == Cgroup) {
getfromktable(cs, cap->idx); /* get group name */
if (lua_equal(L, -2, -1)) { /* right group? */
if (lp_equal(L, -2, -1)) { /* right group? */
lua_pop(L, 2); /* remove reference name and group name */
return cap;
}
Expand Down
4 changes: 2 additions & 2 deletions 3rd/lpeg/lpcap.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** $Id: lpcap.h,v 1.1 2013/03/21 20:25:12 roberto Exp $
** $Id: lpcap.h,v 1.2 2015/02/27 17:13:17 roberto Exp $
*/

#if !defined(lpcap_h)
Expand All @@ -18,7 +18,7 @@ typedef enum CapKind {

typedef struct Capture {
const char *s; /* subject position */
short idx; /* extra info about capture (group name, arg index, etc.) */
unsigned short idx; /* extra info (group name, arg index, etc.) */
byte kind; /* kind of capture */
byte siz; /* size of full capture + 1 (0 = not a full capture) */
} Capture;
Expand Down
22 changes: 11 additions & 11 deletions 3rd/lpeg/lpcode.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** $Id: lpcode.c,v 1.21 2014/12/12 17:01:29 roberto Exp $
** $Id: lpcode.c,v 1.23 2015/06/12 18:36:47 roberto Exp $
** Copyright 2007, Lua.org & PUC-Rio (see 'lpeg.html' for license)
*/

Expand Down Expand Up @@ -431,11 +431,11 @@ typedef struct CompileState {


/*
** code generation is recursive; 'opt' indicates that the code is
** being generated under a 'IChoice' operator jumping to its end
** (that is, the match is "optional").
** 'tt' points to a previous test protecting this code. 'fl' is
** the follow set of the pattern.
** code generation is recursive; 'opt' indicates that the code is being
** generated as the last thing inside an optional pattern (so, if that
** code is optional too, it can reuse the 'IChoice' already in place for
** the outer pattern). 'tt' points to a previous test protecting this
** code (or NOINST). 'fl' is the follow set of the pattern.
*/
static void codegen (CompileState *compst, TTree *tree, int opt, int tt,
const Charset *fl);
Expand Down Expand Up @@ -638,13 +638,13 @@ static void codebehind (CompileState *compst, TTree *tree) {

/*
** Choice; optimizations:
** - when p1 is headfail
** - when first(p1) and first(p2) are disjoint; than
** - when p1 is headfail or
** when first(p1) and first(p2) are disjoint, than
** a character not in first(p1) cannot go to p1, and a character
** in first(p1) cannot go to p2 (at it is not in first(p2)).
** (The optimization is not valid if p1 accepts the empty string,
** as then there is no character at all...)
** - when p2 is empty and opt is true; a IPartialCommit can resuse
** - when p2 is empty and opt is true; a IPartialCommit can reuse
** the Choice already active in the stack.
*/
static void codechoice (CompileState *compst, TTree *p1, TTree *p2, int opt,
Expand All @@ -671,7 +671,7 @@ static void codechoice (CompileState *compst, TTree *p1, TTree *p2, int opt,
}
else {
/* <p1 / p2> ==
test(fail(p1)) -> L1; choice L1; <p1>; commit L2; L1: <p2>; L2: */
test(first(p1)) -> L1; choice L1; <p1>; commit L2; L1: <p2>; L2: */
int pcommit;
int test = codetestset(compst, &cs1, e1);
int pchoice = addoffsetinst(compst, IChoice);
Expand Down Expand Up @@ -759,7 +759,7 @@ static void coderep (CompileState *compst, TTree *tree, int opt,
/* L1: test (fail(p1)) -> L2; <p>; jmp L1; L2: */
int jmp;
int test = codetestset(compst, &st, 0);
codegen(compst, tree, opt, test, fullset);
codegen(compst, tree, 0, test, fullset);
jmp = addoffsetinst(compst, IJmp);
jumptohere(compst, test);
jumptothere(compst, jmp, test);
Expand Down
10 changes: 9 additions & 1 deletion 3rd/lpeg/lpcode.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** $Id: lpcode.h,v 1.6 2013/11/28 14:56:02 roberto Exp $
** $Id: lpcode.h,v 1.7 2015/06/12 18:24:45 roberto Exp $
*/

#if !defined(lpcode_h)
Expand All @@ -24,7 +24,15 @@ int sizei (const Instruction *i);
#define PEnullable 0
#define PEnofail 1

/*
** nofail(t) implies that 't' cannot fail with any input
*/
#define nofail(t) checkaux(t, PEnofail)

/*
** (not nullable(t)) implies 't' cannot match without consuming
** something
*/
#define nullable(t) checkaux(t, PEnullable)

#define fixedlen(t) fixedlenx(t, 0, 0)
Expand Down
27 changes: 16 additions & 11 deletions 3rd/lpeg/lpeg.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</head>
<body>

<!-- $Id: lpeg.html,v 1.72 2014/12/12 17:11:35 roberto Exp $ -->
<!-- $Id: lpeg.html,v 1.75 2015/09/28 17:17:41 roberto Exp $ -->

<div id="container">

Expand All @@ -22,7 +22,7 @@
</div>
<div id="product_name"><big><strong>LPeg</strong></big></div>
<div id="product_description">
Parsing Expression Grammars For Lua, version 0.12
Parsing Expression Grammars For Lua, version 1.0
</div>
</div> <!-- id="product" -->

Expand Down Expand Up @@ -195,13 +195,16 @@ <h3><a name="f-version"></a><code>lpeg.version ()</code></h3>

<h3><a name="f-setstack"></a><code>lpeg.setmaxstack (max)</code></h3>
<p>
Sets the maximum size for the backtrack stack used by LPeg to
Sets a limit for the size of the backtrack stack used by LPeg to
track calls and choices.
(The default limit is 400.)
Most well-written patterns need little backtrack levels and
therefore you seldom need to change this maximum;
but a few useful patterns may need more space.
Before changing this maximum you should try to rewrite your
therefore you seldom need to change this limit;
before changing it you should try to rewrite your
pattern to avoid the need for extra space.
Nevertheless, a few useful patterns may overflow.
Also, with recursive grammars,
subjects with deep recursion may also need larger limits.
</p>


Expand Down Expand Up @@ -682,7 +685,8 @@ <h3><a name="cap-b"></a><code>lpeg.Cb (name)</code></h3>
Creates a <em>back capture</em>.
This pattern matches the empty string and
produces the values produced by the <em>most recent</em>
<a href="#cap-g">group capture</a> named <code>name</code>.
<a href="#cap-g">group capture</a> named <code>name</code>
(where <code>name</code> can be any Lua value).
</p>

<p>
Expand Down Expand Up @@ -762,7 +766,8 @@ <h3><a name="cap-g"></a><code>lpeg.Cg (patt [, name])</code></h3>
It groups all values returned by <code>patt</code>
into a single capture.
The group may be anonymous (if no name is given)
or named with the given name.
or named with the given name
(which can be any non-nil Lua value).
</p>

<p>
Expand Down Expand Up @@ -1375,13 +1380,13 @@ <h3>Arithmetic expressions</h3>
<h2><a name="download"></a>Download</h2>

<p>LPeg
<a href="http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-0.12.1.tar.gz">source code</a>.</p>
<a href="http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-1.0.0.tar.gz">source code</a>.</p>


<h2><a name="license">License</a></h2>

<p>
Copyright &copy; 2014 Lua.org, PUC-Rio.
Copyright &copy; 2007-2015 Lua.org, PUC-Rio.
</p>
<p>
Permission is hereby granted, free of charge,
Expand Down Expand Up @@ -1419,7 +1424,7 @@ <h2><a name="license">License</a></h2>

<div id="about">
<p><small>
$Id: lpeg.html,v 1.72 2014/12/12 17:11:35 roberto Exp $
$Id: lpeg.html,v 1.75 2015/09/28 17:17:41 roberto Exp $
</small></p>
</div> <!-- id="about" -->

Expand Down
8 changes: 4 additions & 4 deletions 3rd/lpeg/lpprint.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** $Id: lpprint.c,v 1.7 2013/04/12 16:29:49 roberto Exp $
** $Id: lpprint.c,v 1.9 2015/06/15 16:09:57 roberto Exp $
** Copyright 2007, Lua.org & PUC-Rio (see 'lpeg.html' for license)
*/

Expand Down Expand Up @@ -52,7 +52,7 @@ static void printjmp (const Instruction *op, const Instruction *p) {
}


static void printinst (const Instruction *op, const Instruction *p) {
void printinst (const Instruction *op, const Instruction *p) {
const char *const names[] = {
"any", "char", "set",
"testany", "testchar", "testset",
Expand Down Expand Up @@ -221,10 +221,10 @@ void printtree (TTree *tree, int ident) {

void printktable (lua_State *L, int idx) {
int n, i;
lua_getfenv(L, idx);
lua_getuservalue(L, idx);
if (lua_isnil(L, -1)) /* no ktable? */
return;
n = lua_objlen(L, -1);
n = lua_rawlen(L, -1);
printf("[");
for (i = 1; i <= n; i++) {
printf("%d = ", i);
Expand Down
3 changes: 2 additions & 1 deletion 3rd/lpeg/lpprint.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** $Id: lpprint.h,v 1.1 2013/03/21 20:25:12 roberto Exp $
** $Id: lpprint.h,v 1.2 2015/06/12 18:18:08 roberto Exp $
*/


Expand All @@ -18,6 +18,7 @@ void printtree (TTree *tree, int ident);
void printktable (lua_State *L, int idx);
void printcharset (const byte *st);
void printcaplist (Capture *cap, Capture *limit);
void printinst (const Instruction *op, const Instruction *p);

#else

Expand Down
Loading

0 comments on commit 716eccc

Please sign in to comment.