o aV@sdZddlZddlmZmZmZmZmZmZddl m Z m Z m Z m Z mZmZmZmZmZmZgdZGdddeZGdd d eZGd d d eZGd d d eZdS)z pygments.lexers.grammar_notation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lexers for grammar notations like BNF. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. N) RegexLexerbygroupsincludethisusingwords) CommentKeywordLiteralNameNumberOperator PunctuationStringText Whitespace)BnfLexer AbnfLexer JsgfLexerPegLexerc@sPeZdZdZdZdgZdgZdgZddee e j e fde fd e fd e fgiZd S) ra> This lexer is for grammar notations which are similar to original BNF. In order to maximize a number of targets of this lexer, let's decide some designs: * We don't distinguish `Terminal Symbol`. * We do assume that `NonTerminal Symbol` are always enclosed with arrow brackets. * We do assume that `NonTerminal Symbol` may include any printable characters except arrow brackets and ASCII 0x20. This assumption is for `RBNF `_. * We do assume that target notation doesn't support comment. * We don't distinguish any operators and punctuation except `::=`. Though these desision making might cause too minimal highlighting and you might be disappointed, but it is reasonable for us. .. versionadded:: 2.1 BNFbnfz*.bnfz text/x-bnfrootz(<)([ -;=?-~]+)(>)z::=z[^<>:]+.N)__name__ __module__ __qualname____doc__namealiases filenames mimetypesrrr Classr rtokensr$r$B/usr/lib/python3/dist-packages/pygments/lexers/grammar_notation.pyrs rc@seZdZdZdZdgZdgZdgZdZdde j fd e fd e fd e fd e fd e fde fde fde fde fde fde fe eddefdejfde fdefdefdefgiZdS)rz Lexer for `IETF 7405 ABNF `_ (Updates `5234 `_) grammars. .. versionadded:: 2.1 ABNFabnfz*.abnfz text/x-abnf)ALPHABITCHARCRCRLFCTLDIGITDQUOTEHEXDIGHTABLFLWSPOCTETSPVCHARWSPrz;.*$z(%[si])?"[^"]*"z%b[01]+\-[01]+\bz%b[01]+(\.[01]+)*\bz%d[0-9]+\-[0-9]+\bz%d[0-9]+(\.[0-9]+)*\bz%x[0-9a-fA-F]+\-[0-9a-fA-F]+\bz!%x[0-9a-fA-F]+(\.[0-9a-fA-F]+)*\bz\b[0-9]+\*[0-9]+z \b[0-9]+\*z\b[0-9]+\*\bsuffixz[a-zA-Z][a-zA-Z0-9-]*\bz(=/|=|/)z[\[\]()]\s+rN)rrrrrrr r! _core_rulesrSingler r rr r r"rrrr#r$r$r$r%rDs8 rc@seZdZdZdZdgZdgZgdZej ej BZ e de dgde jd fd e jfd e jfgd e jfd efdefdefdejfdejdfdejdfedddejfdejdfdeeejefdedfdefg dejdfdej fd ejfgd!ejdfdej fd"ejfgdedfd efd#efd$ej!fgd%edfd&efd efd'eej!eefd(ej"fgd)e jdfd*eee jee j#ee$e%d+d,fd-ee je j#fd.e jfgd/eee jfe dd0e jfgd1 Z&d2S)3rzn For `JSpeech Grammar Format `_ grammars. .. versionadded:: 2.2 JSGFjsgfz*.jsgf)zapplication/jsgfzapplication/x-jsgfz text/jsgfcomments non-commentsz /\*\*(?!/)documentation commentz/\*[\w\W]*?\*/z//.*$z \A#JSGF[^;]*r<;z [=|()\[\]*+]z/[^/]+/"stringz\{tag)importpublicr9r:z grammar\b grammar namez(<)(NULL|VOID)(>)<rulenamez\w+|[^\s;=|()\[\]*+/"{<\w]+z#popz\\.z[^\\"]+z\}z[^\\}]+\.z[^;\s.]+>r8z([^.>]+)(\s*)(\.)z[^.>]+z\*/zH^(\s*)(\*?)(\s*)(@(?:example|see))(\s+)([\w\W]*?(?=(?:^\s*\*?\s*@|\*/)))example)statez(^\s*\*?\s*)(@\S*)z[^*\n@]+|\w|\Wz (\n\s*)(\*)r) rrArBrFrGrJrLrCrON)'rrrrrrr r!re MULTILINEUNICODEflagsrr Multiliner>Preprocrrr r FloatrDoubleOtherrr Reservedrr BuiltinrEscape NamespaceConstantSpecialrrr#r$r$r$r%rs             rc @steZdZdZdZdgZdgZdgZddej fde fd e fd e fd e e ee fd ejfd ej fdejfdefg iZdS)ruZ This lexer is for `Parsing Expression Grammars `_ (PEG). Various implementations of PEG have made different decisions regarding the syntax, so let's try to be accommodating: * `<-`, `←`, `:`, and `=` are all accepted as rule operators. * Both `|` and `/` are choice operators. * `^`, `↑`, and `~` are cut operators. * A single `a-z` character immediately before a string, or multiple `a-z` characters following a string, are part of the string (e.g., `r"..."` or `"..."ilmsuxa`). .. versionadded:: 2.6 PEGpegz*.pegz text/x-pegrz#.*$u<-|[←:=/|&!?*+^↑~]z[()]rMz (\[)([^\]]*(?:\\.[^\]\\]*)*)(\])z$[a-z]?"[^"\\]*(?:\\.[^"\\]*)*"[a-z]*z$[a-z]?'[^'\\]*(?:\\.[^'\\]*)*'[a-z]*u#[^\s<←:=/|&!?*+\^↑~()\[\]"\'#]+rN)rrrrrrr r!rr>r rr rrrXr r"rr#r$r$r$r%rs( r)rrQpygments.lexerrrrrrrpygments.tokenrr r r r r rrrr__all__rrrrr$r$r$r%s 00CP