Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 5
0
Archivo: tex.py Proyecto: wbsoft/parce
 def math(cls):
     yield arg(default=r'\}'), Delimiter, -1
     yield from cls.math_common()
Ejemplo n.º 6
0
 def here(cls):
     yield arg(prefix=r"\b", suffix=r"\b"), Name, -1
     yield r"\w+", Text
Ejemplo n.º 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('}')
Ejemplo n.º 8
0
 def long_bytes_common(cls):
     yield arg(), Bytes.End, -1
     yield default_action, Bytes
Ejemplo n.º 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
Ejemplo n.º 10
0
 def long_string_common(cls):
     yield arg(), String.End, -1
     yield default_action, String
Ejemplo n.º 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()
Ejemplo n.º 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