Last active
August 29, 2015 14:21
-
-
Save matschaffer/789dbb6f1607c4965392 to your computer and use it in GitHub Desktop.
stumped by lpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
info: type=query, sql=update `Transactions` set `confirmedAt` = ? where `id` = ? | |
error: unhandled error type name=NetworkError, stack=NetworkError: noNetwork |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local l = require 'lpeg' | |
l.locale(l) | |
local space = l.space^0 | |
local level = l.Ct(l.Cg(l.C(l.alpha^1), "level")) | |
local name = l.C(l.alpha^1) * space | |
local sep = l.S(",") * space | |
local pair = lpeg.Cg(name * ":" * space * name) * sep^-1 | |
grammar = lpeg.Cf(level * l.Ct(l.Cg(l.C(l.P":"), "colon")) * space, rawset) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{"level": "info", | |
"type": "query", | |
"sql": "update `Transactions` set `confirmedAt` = ? where `id` = ?" | |
}, | |
{ | |
"level": "error", | |
"unhandled error type name": "NetworkError", | |
"stack": "NetworkError: noNetwork" | |
}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment