codekingpro/portable-devtools
114k
1# Skip text characters for text token, place those to pending buffer2# and increment current pos3from .state_inline import StateInline4 5# Rule to skip pure text6# '{}$%@~+=:' reserved for extensions7 8# !!!! Don't confuse with "Markdown ASCII Punctuation" chars9# http://spec.commonmark.org/0.15/#ascii-punctuation-character10 11 12_TerminatorChars = {13 "\n",14 "!",15 "#",16 "$",17 "%",18 "&",19 "*",20 "+",21 "-",22 ":",23 "<",24 "=",25 ">",26 "@",27 "[",28 "\\",29 "]",30 "^",31 "_",32 "`",33 "{",34 "}",35 "~",36}37 38 39def text(state: StateInline, silent: bool) -> bool:40 pos = state.pos41 posMax = state.posMax42 while (pos < posMax) and state.src[pos] not in _TerminatorChars:43 pos += 144 45 if pos == state.pos:46 return False47 48 if not silent:49 state.pending += state.src[state.pos : pos]50 51 state.pos = pos52 53 return True54 