Half-done huge refactoring aimed to unify support of various types of docstrings

* Introduce new entities: DocStringBuilder, DocStringProvider and DocStringUpdater
* StructuredDocString serves only as dumb parser and operates only on
the level of Substrings to preserve offsets
This commit is contained in:
Mikhail Golubev
2015-09-02 14:34:41 +03:00
parent a247efdd5c
commit 710c84c566
18 changed files with 741 additions and 93 deletions
@@ -0,0 +1,42 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.python.toolbox;
import org.jetbrains.annotations.NotNull;
/**
* @author Mikhail Golubev
*/
public class PyIndentUtil {
private PyIndentUtil() {
}
public static int getLineIndentSize(@NotNull CharSequence line) {
return getLineIndent(line).length();
}
@NotNull
public static CharSequence getLineIndent(@NotNull CharSequence line) {
int stop;
for (stop = 0; stop < line.length(); stop++) {
final char c = line.charAt(stop);
if (c == ' ' || c == '\t') {
break;
}
}
return line.subSequence(0, stop);
}
}