lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 3 September 2013 14:14, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> LPeg 0.12 has a constant MAXRULES, which is currently defined as 200. Just
> change that to a larger number and recompile LPeg. (And tell me how many
> rules you need.)
>
> (I thought 200 would be huge, but looking at your example 200 looks really
> humble :)
>
> -- Roberto
>

Thanks Roberto, the easiest solution here is probably to be able to
pass it in to the compiler via -D (diff below)
A limit of 250 makes this code work :)

What is the trade off here? Is it just memory allocated on the stack
in `verifygrammar` and `codegrammar`?
If so, I don't see any reason not to up the default limit to 1024 or so....

Daurn.

# Diff follows

diff -ur lpeg-0.12/lptypes.h lpeg-0.12-maxrules/lptypes.h
--- lpeg-0.12/lptypes.h 2013-04-12 12:31:19.000000000 -0400
+++ lpeg-0.12-maxrules/lptypes.h      2013-09-03 14:58:31.859831497 -0400
@@ -56,8 +56,9 @@


 /* maximum number of rules in a grammar */
+#if !defined(MAXRULES)
 #define MAXRULES        200
-
+#endif


 /* initial size for capture's list */