Exemple #1
0
def expand(string, start, end):
    expand_stack = []

    expand_stack.append("subword")

    result = expand_to_subword.expand_to_subword(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("word")

    result = expand_to_word.expand_to_word(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("quotes")

    result = expand_to_quotes.expand_to_quotes(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("xml_node")

    result = expand_to_xml_node.expand_to_xml_node(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result
def expand(string, start, end):
    expand_stack = []

    expand_stack.append("subword")

    result = expand_to_subword.expand_to_subword(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("word")

    result = expand_to_word.expand_to_word(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("quotes")

    result = expand_to_quotes.expand_to_quotes(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("xml_node")

    result = expand_to_xml_node.expand_to_xml_node(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result
def expand_agains_line(string, start, end):
    expand_stack = []

    expand_stack.append("word")

    result = expand_to_word.expand_to_word(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("quotes")

    result = expand_to_quotes.expand_to_quotes(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("semantic_unit")

    result = expand_to_semantic_unit.expand_to_semantic_unit(
        string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("symbols")

    result = expand_to_symbols.expand_to_symbols(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result
Exemple #4
0
def expand(string, start, end):
  expand_stack = []

  expand_stack.append("word")

  result = expand_to_word.expand_to_word(string, start, end)
  if result:
    result["expand_stack"] = expand_stack
    return result

  expand_stack.append("quotes")

  result = expand_to_quotes.expand_to_quotes(string, start, end)
  if result:

    # Check if there is space in quotes
    space_in_quotes_result = expand_to_space_in_quotes.expand_to_space_in_quotes(result, string, start, end)
    if space_in_quotes_result:
      expand_stack.append("quotes_and_space")
      return space_in_quotes_result

    result["expand_stack"] = expand_stack
    return result

  expand_stack.append("xml_node")

  result = expand_to_xml_node.expand_to_xml_node(string, start, end)
  if result:
    result["expand_stack"] = expand_stack
    return result
Exemple #5
0
def expand(string, start, end):
    selection_is_in_string = expand_to_quotes.expand_to_quotes(
        string, start, end)

    if selection_is_in_string:
        string_result = expand_agains_string(
            selection_is_in_string["string"],
            start - selection_is_in_string["start"],
            end - selection_is_in_string["start"])

        if string_result:
            string_result["start"] = string_result[
                "start"] + selection_is_in_string["start"]
            string_result[
                "end"] = string_result["end"] + selection_is_in_string["start"]
            string_result[string] = string[
                string_result["start"]:string_result["end"]]
            return string_result

    if utils.selection_contain_linebreaks(string, start, end) == False:

        line = utils.get_line(string, start, end)
        line_string = string[line["start"]:line["end"]]

        line_result = expand_agains_line(line_string, start - line["start"],
                                         end - line["start"])

        if line_result:
            line_result["start"] = line_result["start"] + line["start"]
            line_result["end"] = line_result["end"] + line["start"]
            line_result[string] = string[
                line_result["start"]:line_result["end"]]
            return line_result

    expand_stack = ["semantic_unit"]

    result = expand_to_semantic_unit.expand_to_semantic_unit(
        string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("symbols")

    result = expand_to_symbols.expand_to_symbols(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    print(None)
def expand(string, start, end):
    selection_is_in_string = expand_to_quotes.expand_to_quotes(
        string, start, end)

    if selection_is_in_string:
        string_result = expand_agains_string(
            selection_is_in_string["string"],
            start - selection_is_in_string["start"],
            end - selection_is_in_string["start"])

        if string_result:
            string_result["start"] = string_result[
                "start"] + selection_is_in_string["start"]
            string_result[
                "end"] = string_result["end"] + selection_is_in_string["start"]
            string_result[string] = string[string_result["start"]:
                                           string_result["end"]]
            return string_result

    if utils.selection_contain_linebreaks(string, start, end) == False:

        line = utils.get_line(string, start, end)
        line_string = string[line["start"]:line["end"]]

        line_result = expand_agains_line(line_string, start - line["start"],
                                         end - line["start"])

        if line_result:
            line_result["start"] = line_result["start"] + line["start"]
            line_result["end"] = line_result["end"] + line["start"]
            line_result[string] = string[line_result["start"]:
                                         line_result["end"]]
            return line_result

    expand_stack = ["semantic_unit"]

    result = expand_to_semantic_unit.expand_to_semantic_unit(
        string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("symbols")

    result = expand_to_symbols.expand_to_symbols(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    print(None)
Exemple #7
0
def expand_agains_line(string, start, end):
    expand_stack = []

    expand_stack.append("subword")

    result = expand_to_subword.expand_to_subword(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("word")

    result = expand_to_word.expand_to_word(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("quotes")

    result = expand_to_quotes.expand_to_quotes(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("semantic_unit")

    result = expand_to_semantic_unit.expand_to_semantic_unit(
        string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result

    expand_stack.append("symbols")

    result = expand_to_symbols.expand_to_symbols(string, start, end)
    if result:
        result["expand_stack"] = expand_stack
        return result