Example #1
0
 def short_string_raw_common(cls):
     yield arg(), String.End, -1
     yield r'\\\\', String
     yield pattern(
         ifeq(ARG, "'", fr"([^\\']*?|\\'{_S_}*)$",
              fr'([^\\"]*?|\\"{_S_}*)$')), String.Invalid, -1
     yield arg(prefix=r'\\'), String  # escape quote, but the \ remains
     yield default_action, String
Example #2
0
 def string(cls):
     yield arg(), String.End, -1
     yield (r'''\\(?:[0"'\\nrvtbf]'''
         r'|x[a-fA-F0-9]{2}'
         r'|u[a-fA-F0-9]{4}'
         r'|u\{[a-fA-F0-9]{1,6}\})'), String.Escape
     yield default_action, String
Example #3
0
 def short_bytes_raw_common(cls):
     yield r'\\\\', Bytes
     yield pattern(
         ifeq(ARG, "'", fr"([^\\']*?|\\'{_S_}*)$",
              fr'([^\\"]*?|\\"{_S_}*)$')), Bytes.Invalid, -1
     yield arg(prefix=r'\\'), Bytes  # escape quote, but the \ remains
     yield from cls.long_bytes_common()
Example #4
0
    def musiclist(cls):
        """A ``{`` ... ``}`` or ``<<`` ... ``>>`` musical construct.

        Derive with the end arg (``}`` or ``>>``).

        """
        yield arg(), Bracket.End, -1
        yield from cls.music()
        yield from cls.common()
        yield from cls.commands()
Example #5
0
File: tex.py Project: wbsoft/parce
 def math(cls):
     yield arg(default=r'\}'), Delimiter, -1
     yield from cls.math_common()
Example #6
0
 def here(cls):
     yield arg(prefix=r"\b", suffix=r"\b"), Name, -1
     yield r"\w+", Text
Example #7
0
 def inputmode_list(cls, lexicon):
     """Yield boilerplate rules for the contents of an input mode."""
     yield arg(), Bracket.End, -1
     yield r"<<", Bracket.Start, lexicon('>>')
     yield r"\{", Bracket.Start, lexicon('}')
Example #8
0
 def long_bytes_common(cls):
     yield arg(), Bytes.End, -1
     yield default_action, Bytes
Example #9
0
 def short_bytes_common(cls):
     yield arg(), Bytes.End, -1
     yield pattern(ifeq(ARG, "'", r"[^']*?$",
                        r'[^"]*?$')), Bytes.Invalid, -1
     yield default_action, Bytes
Example #10
0
 def long_string_common(cls):
     yield arg(), String.End, -1
     yield default_action, String
Example #11
0
 def long_string_raw_format(cls):
     yield arg(prefix=r'\\'), String  # escape quote, but the \ remains
     yield from cls.string_formatstring()
     yield from cls.long_string_common()
Example #12
0
 def short_string_common(cls):
     yield arg(), String.End, -1
     yield pattern(ifeq(ARG, "'", r"[^']*?$",
                        r'[^"]*?$')), String.Invalid, -1
     yield default_action, String