;******************************************************************** ; APG - an ABNF Parser Generator ; Copyright (C) 2011 Lowell D. Thomas, all rights reserved ; ; author: Lowell D. Thomas ; lowell@coasttocoastresearch.com ; http://www.coasttocoastresearch.com ; ; purpose: ABNF for SABNF ; ;********************************************************************* ; symbol alphabet is ASCII ; code points: 9, 10, 13, 32-126 ; File = *(BlankLine/Rule/RuleError) BlankLine = *sp LineEnd Rule = NameDef owsp (IncAlt/DefinedAs) owsp Alternation owsp LineEnd RuleError = *fsp LineEnd Alternation = Concatenation *(AltOp Concatenation) Concatenation = owsp Repetition *(CatOp Repetition) Repetition = Repeat / Predicate / Element Repeat = Rep Element Predicate = (AndOp / NotOp) Element ;(&/!) Rep = (rep-min StarOp rep-max) / ;->3*4 (rep-min StarOp) / ;->5* (StarOp rep-max) / ;->*7 StarOp / ;->* rep-min-max Element = TrgOp / ;->%d03-78 TbsOp / ;->%093.56 TlsOp / ;-> "" TcsOp / ;-> '' UdtOp / ;u_/e_ RnmOp / ;alphanum Group / ;() Option / ;[] ProsVal ;<> Group = %d40 owsp Alternation owsp %d41 ;() Option = %d91 owsp Alternation owsp %d93 ;[] ProsVal = %d60 *(%d32-61/%d63-127/%d9) %d62 ;<> NameDef = alphanum DefinedAs = %d61 ;= IncAlt = %d61.47 ;=/ RnmOp = alphanum UdtOp = (%d117.95/%d101.95) alphanum ;u_/e_ AltOp = owsp %d47 ;something like space, add / CatOp = wsp StarOp = %d42 ;* AndOp = %d38 ;& NotOp = %d33 ;! TrgOp = %d37 TrgRange ;->%d03-78 TbsOp = %d37 TbsString ;->%093.56 TlsOp = %d34 *(%d32-33/%d35-127/%d9/%x4e00-9fbf) %d34 ;" * remove 34 -> "" TcsOp = %d39 *(%d32-38/%d40-127/%d9/%x4e00-9fbf) %d39 ;' * remove 39 -> '' rep-min = 1*(%d48-57) ;48-57 represent digit 0-9 rep-min-max = 1*(%d48-57) ;0-9 rep-max = 1*(%d48-57) ;0-9 TrgRange = (Dec dnum %d45 dnum) / (Hex xnum %d45 xnum) / (Bin bnum %d45 bnum) ;- TbsString = (Dec dnum *(%d46 dnum)) / (Hex xnum *(%d46 xnum)) / (Bin bnum *(%d46 bnum)) ;. Dec = (%d68/%d100) ;D/d Hex = (%d88/%d120) ;X/x Bin = (%d66/%d98) ;B/b dnum = 1*(%d48-57) ;0-9 bnum = 1*%d48-49 ;0-1 xnum = 1*(%d48-57 / %d65-70 / %d97-102) ;0-9/A-F/a-f ; Basics alphanum = (%d97-122/%d65-90) *(%d97-122/%d65-90/%d48-57/%d45) ;(a-z/A-Z) *(a-z/A-Z/0-9/-) sp = %d32 / ;space %d9 / ;tab comment fsp = %d32 / ;new line %d9 / ;tab comment / LineContinue owsp = *fsp wsp = 1*fsp comment = %d59 *(%d32-127 / %d9) ; ;*(all/tab) LineEnd = %d13.10 / %d10 /%d13 ;enter.newline LineContinue = LineEnd (%d32/%d9)
sabnf文件注释
最新推荐文章于 2024-03-02 19:22:32 发布