示例#1
0
文件: python.py 项目: wbsoft/parce
 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
示例#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
示例#3
0
文件: python.py 项目: wbsoft/parce
 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()
示例#4
0
文件: lilypond.py 项目: wbsoft/parce
    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()
示例#5
0
文件: tex.py 项目: wbsoft/parce
 def math(cls):
     yield arg(default=r'\}'), Delimiter, -1
     yield from cls.math_common()
示例#6
0
 def here(cls):
     yield arg(prefix=r"\b", suffix=r"\b"), Name, -1
     yield r"\w+", Text
示例#7
0
文件: lilypond.py 项目: wbsoft/parce
 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('}')
示例#8
0
文件: python.py 项目: wbsoft/parce
 def long_bytes_common(cls):
     yield arg(), Bytes.End, -1
     yield default_action, Bytes
示例#9
0
文件: python.py 项目: wbsoft/parce
 def short_bytes_common(cls):
     yield arg(), Bytes.End, -1
     yield pattern(ifeq(ARG, "'", r"[^']*?$",
                        r'[^"]*?$')), Bytes.Invalid, -1
     yield default_action, Bytes
示例#10
0
文件: python.py 项目: wbsoft/parce
 def long_string_common(cls):
     yield arg(), String.End, -1
     yield default_action, String
示例#11
0
文件: python.py 项目: wbsoft/parce
 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()
示例#12
0
文件: python.py 项目: wbsoft/parce
 def short_string_common(cls):
     yield arg(), String.End, -1
     yield pattern(ifeq(ARG, "'", r"[^']*?$",
                        r'[^"]*?$')), String.Invalid, -1
     yield default_action, String