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​(BslContextDefMethod method,
                                                                   boolean oldFormat)
        Parses Built-In language documentation comment for the BslContextDefMethod
        Parameters:
        method - BslContextDefMethod contains content of the documentation comment adn offsets of the each line in comment relatively to the total method text, cannot be null
        oldFormat - true if parsing in old documentation comment format, false if in new format
        Returns:
        Built-In language documentation comment for the BslContextDefMethod, never null, if there is no comment empty BslDocumentationComment will be returned
      • 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,
                                                                        BmOperationContext typeComputationContext)
        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
        typeComputationContext - Type system computation context. May not 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,
                                                                        BmOperationContext typeComputationContext)
        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
        typeComputationContext - Type system computation context. May not be null
        Returns:
        EObject provided by LinkPart can be null if LinkPart not link to real EObject
      • getCommentLineLocalOffsets

        public static int[] getCommentLineLocalOffsets​(List<org.eclipse.xtext.nodemodel.INode> commentLines,
                                                       Method method)
        Gets offsets of each line in comment relatively to the total method text
        Parameters:
        commentLines - INode of document comment lines, cannot be null
        method - Method with document comment nodes, cannot be null
        Returns:
        offsets of the each line in comment relatively to the total method text, cannot be null