Class BslCommentUtils

java.lang.Object
com._1c.g5.v8.dt.bsl.documentation.comment.BslCommentUtils

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

  • Constructor Details

    • BslCommentUtils

      public BslCommentUtils()
  • Method Details

    • parseTemplateComment

      public static BslDocumentationComment parseTemplateComment(Method method, boolean oldFormat, BslMultiLineCommentDocumentationProvider commentProvider)
      Parses Built-In language documentation comment for the Method
      Parameters:
      method - Method with documentation comment, cannot be null
      oldFormat - true if parsing in old documentation comment format, false if in new format
      commentProvider - special BslMultiLineCommentDocumentationProvider for getting comment INode, cannot be null
      Returns:
      Built-In language documentation comment for the Method, never null, if there is no comment nodes empty BslDocumentationComment will be returned
    • 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
    • isDeprecated

      public static boolean isDeprecated(Method method)
      Checks in fast way that method is deprecated. Method is deprecated when the first its comment line starts with IBslCommentToken.DEPRECATED or IBslCommentToken.DEPRECATED_RU
      Parameters:
      method - checking Method, cannot be null
      Returns:
      true if Method is deprecated, 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, IV8ProjectManager v8ProjectManager, 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
      v8ProjectManager - IV8ProjectManager for getting IV8Project by EObject, 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, IV8ProjectManager v8ProjectManager, 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
      v8ProjectManager - IV8ProjectManager for getting IV8Project by EObject, 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
    • getModuleCommentsBeforeFirstSemanticElement

      public static List<String> getModuleCommentsBeforeFirstSemanticElement(Module module, BslMultiLineCommentDocumentationProvider commentProvider)
      Returns the list of module's comments residing before the first symantic element.
      Parameters:
      module - the reference to Module, cannot be null
      commentProvider - the reference to BslMultiLineCommentDocumentationProvider, cannot be null
      Returns:
      the list of comments or empty list, never null
    • 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