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