Class BslCommentUtils


  • public final class BslCommentUtils
    extends Object
    Parser for Bsl format comments
    • Field Detail

    • Constructor Detail

      • BslCommentUtils

        public BslCommentUtils()
    • Method Detail

      • parseTemplateComment

        public static BslDocumentationComment parseTemplateComment​(List<String> templateLines,
                                                                   Method method,
                                                                   boolean oldFormat)
        Parses Bsl documentation comment from text lines
        Parameters:
        templateLines - text lines with comment information, cannnot be null
        method - method Method with documentation comment, cannot be null
        oldFormat - true if parsing in old documentation comment format, false if in new format
        Returns:
        Bsl documentation comment for the Method, never null, if there is empty text lines BslDocumentationComment will be returned
      • parseTemplateComment

        public static BslDocumentationComment parseTemplateComment​(List<String> templateLines,
                                                                   boolean oldFormat)
        Parses Bsl documentation comment from text lines
        Parameters:
        templateLines - text lines with comment information, cannnot be null
        method - method Method with documentation comment, cannot be null
        oldFormat - true if parsing in old documentation comment format, false if in new format
        Returns:
        Bsl documentation comment for the Method, never null, if there is empty text lines BslDocumentationComment will be returned
      • isCommentNode

        public static boolean isCommentNode​(org.eclipse.xtext.nodemodel.ILeafNode leafNode)
        Checks ILeafNode is comment node in Bsl grammar
        Parameters:
        leafNode - checking node, cannot be null
        Returns:
        true if node is Bsl comment node, false otherwise
      • split

        public static List<org.eclipse.xtext.util.Pair<String,​Integer>> split​(String text,
                                                                                    String symbol)
        Splits text by special pattern
        Parameters:
        text - splitting text, cannot be null
        symbol - pattern for spliting, this pattern found in text with String.indexOf(int), cannot be null
        Returns:
        collection of the text part devided be symbol and offset of the each part in the original text, cannot be null, this collection doesnnot contains part with 0 length
      • split

        public static List<org.eclipse.xtext.util.Pair<String,​Integer>> split​(String text,
                                                                                    String symbol,
                                                                                    int partLimit)
        Splits text by special pattern
        Parameters:
        text - splitting text, cannot be null
        symbol - pattern for spliting, this pattern found in text with String.indexOf(int), cannot be null
        partLimit - limit of max splitted parts.
        Returns:
        collection of the text part devided be symbol and offset of the each part in the original text, cannot be null, this collection does not contains part with 0 length. Count of parts cannot be more than countOfParts
      • trim

        public static org.eclipse.xtext.util.Triple<String,​Integer,​Integer> trim​(String text)
        Trims initial text
        Parameters:
        text - triming text, cannot be null
        Returns:
        initial text without symbols from begining and ending corresponding to the Character.isWhitespace(char), and length of the trimming substrings from begining and ending
      • getLinkPartCommentContent

        public static BslDocumentationComment getLinkPartCommentContent​(LinkPart linkPart,
                                                                        org.eclipse.xtext.scoping.IScopeProvider scopeProvider,
                                                                        BslMultiLineCommentDocumentationProvider commentProvider,
                                                                        boolean oldFormat,
                                                                        org.eclipse.emf.ecore.EObject context)
        Gets BslDocumentationComment from Bsl method provided by LinkPart
        Parameters:
        linkPart - LinkPart links to Method, cannot be null
        scopeProvider - actual IScopeProvider for getting index object, cannot be null
        commentProvider - actual BslMultiLineCommentDocumentationProvider for getting method documentation comment content, cannot be null
        oldFormat - true if using old format of documentation comment, false otherwise
        context - context object for resolving index object from scopeProvider, cannot be null
        Returns:
      • getObjectByLinkPart

        public static org.eclipse.emf.ecore.EObject getObjectByLinkPart​(LinkPart linkPart,
                                                                        org.eclipse.xtext.scoping.IScopeProvider scopeProvider,
                                                                        org.eclipse.emf.ecore.EObject context)
        Gets EObject provided by LinkPart
        Parameters:
        linkPart - actual LinkPart for getting EObject by it, cannot be null
        scopeProvider - actual IScopeProvider for getting index object, cannot be null
        context - context object for resolving index object from scopeProvider, cannot be null
        Returns:
        EObject provided by LinkPart can be null if LinkPart not link to real EObject