Exemplo n.º 1
0
def propertiesFormat(engine):
    engine.require(matcher=SyntaxEngine.generateRegexMatcher('Properties'),
                   driver=formatAnySymbol)

    def anonymous1(text, pos, context):
        context['scope'] = 'properties'
        context['breakScopeIndentLevel'] = context['indentLevel']
        return formatLeftCurlyBrace(text, pos, context)

    engine.require(matcher=SyntaxEngine.generateRegexMatcher('{'),
                   driver=anonymous1)

    while engine.context['indentLevel'] > engine.context[
            'breakScopeIndentLevel']:
        if engine.match('head_of_line'):
            continue
        if engine.match('space_char'):
            continue
        if engine.match('literal_string'):
            continue
        if engine.match('line_comment'):
            continue
        if engine.match('block_comment'):
            continue
        if engine.match('left_curly_brace'):
            continue
        if engine.match('right_curly_brace'):
            continue
        if engine.match('return_char'):
            continue
        if engine.match('any_punctuation'):
            continue
        if engine.match('any_symbol'):
            continue

    pass
Exemplo n.º 2
0
    if match:
        context['formattedText'] = context['formattedText'] + match.group()
        return match.end()


r'''
    CharXY charXXiYYY
    0
    1
    P = Plus >=1
    N = Any
    I = Indent
    E = Enter. If refactor, rename it to R
'''

matchChar01 = SyntaxEngine.generateRegexMatcher(r',')


def formatChar01(text, pos, context):
    context['formattedText'] = BasicFormater.trimSpaceFromTail(context['formattedText']) \
        + text[pos] \
        + " "

    pattern = re.compile(r"[ \t]*")
    return pattern.match(text, pos + 1).end()


matchCharP1 = SyntaxEngine.generateRegexMatcher(r'=|:')


def formatCharP1(text, pos, context):
Exemplo n.º 3
0
    match = pattern.match(text, pos)
    if match:
        context['formattedText'] = context['formattedText'] + match.group()
        return match.end()

r'''
    CharXY charXXiYYY
    0
    1
    P = Plus >=1
    N = Any
    I = Indent
    E = Enter. If refactor, rename it to R
'''

matchChar01 = SyntaxEngine.generateRegexMatcher(r',')


def formatChar01(text, pos, context):
    context['formattedText'] = SyntaxEngine.trimSpaceFromTail(context['formattedText']) \
        + text[pos] \
        + " "

    pattern = re.compile(r"[ \t]*")
    return pattern.match(text, pos+1).end()


matchCharP1 = SyntaxEngine.generateRegexMatcher(r'=|:')


def formatCharP1(text, pos, context):