File: core.lua

package info (click to toggle)
lua-lpeg-patterns 0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 220 kB
  • sloc: makefile: 6
file content (30 lines) | stat: -rw-r--r-- 520 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- Core Rules
-- https://tools.ietf.org/html/rfc5234#appendix-B.1

local lpeg = require "lpeg"

local P = lpeg.P
local R = lpeg.R
local S = lpeg.S

local _M = { }

_M.ALPHA = R("AZ","az")
_M.BIT   = S"01"
_M.CHAR  = R"\1\127"
_M.CR    = P"\r"
_M.CRLF  = P"\r\n"
_M.CTL   = R"\0\31" + P"\127"
_M.DIGIT = R"09"
_M.DQUOTE= P'"'
_M.HEXDIG= _M.DIGIT + S"ABCDEFabcdef"
_M.HTAB  = P"\t"
_M.LF    = P"\n"
_M.OCTET = P(1)
_M.SP    = P" "
_M.VCHAR = R"\33\126"
_M.WSP   = S" \t"

_M.LWSP  = (_M.WSP + _M.CRLF*_M.WSP)^0

return _M