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 Summary
Fields Modifier and Type Field Description static String
START_COMMENT_TAG_BSL
Comment tag string constant
-
Constructor Summary
Constructors Constructor Description BslCommentUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int[]
getCommentLineLocalOffsets(List<org.eclipse.xtext.nodemodel.INode> commentLines, Method method)
Gets offsets of each line in comment relatively to the total method textstatic BslDocumentationComment
getLinkPartCommentContent(LinkPart linkPart, org.eclipse.xtext.scoping.IScopeProvider scopeProvider, BslMultiLineCommentDocumentationProvider commentProvider, boolean oldFormat, org.eclipse.emf.ecore.EObject context, BmOperationContext typeComputationContext)
GetsBslDocumentationComment
from Bsl method provided byLinkPart
static List<String>
getModuleCommentsBeforeFirstSemanticElement(Module module, BslMultiLineCommentDocumentationProvider commentProvider)
Returns the list of module's comments residing before the first symantic element.static org.eclipse.emf.ecore.EObject
getObjectByLinkPart(LinkPart linkPart, org.eclipse.xtext.scoping.IScopeProvider scopeProvider, org.eclipse.emf.ecore.EObject context, BmOperationContext typeComputationContext)
GetsEObject
provided byLinkPart
static boolean
isCommentNode(org.eclipse.xtext.nodemodel.ILeafNode leafNode)
ChecksILeafNode
is comment node in Bsl grammarstatic boolean
isDeprecated(Method method)
Checks in fast way that method is deprecated.static BslDocumentationComment
parseTemplateComment(BslContextDefMethod method, boolean oldFormat)
Parses Built-In language documentation comment for theBslContextDefMethod
static BslDocumentationComment
parseTemplateComment(Method method, boolean oldFormat, BslMultiLineCommentDocumentationProvider commentProvider)
Parses Built-In language documentation comment for theMethod
static BslDocumentationComment
parseTemplateComment(List<String> templateLines, boolean oldFormat)
Parses Bsl documentation comment from text linesstatic BslDocumentationComment
parseTemplateComment(List<String> templateLines, Method method, boolean oldFormat)
Parses Bsl documentation comment from text linesstatic List<org.eclipse.xtext.util.Pair<String,Integer>>
split(String text, String symbol)
Splits text by special patternstatic List<org.eclipse.xtext.util.Pair<String,Integer>>
split(String text, String symbol, int partLimit)
Splits text by special patternstatic org.eclipse.xtext.util.Triple<String,Integer,Integer>
trim(String text)
Trims initial text
-
-
-
Field Detail
-
START_COMMENT_TAG_BSL
public static final String START_COMMENT_TAG_BSL
Comment tag string constant- See Also:
- Constant Field Values
-
-
Method Detail
-
parseTemplateComment
public static BslDocumentationComment parseTemplateComment(Method method, boolean oldFormat, BslMultiLineCommentDocumentationProvider commentProvider)
Parses Built-In language documentation comment for theMethod
- Parameters:
method
-Method
with documentation comment, cannot benull
oldFormat
-true
if parsing in old documentation comment format,false
if in new formatcommentProvider
- specialBslMultiLineCommentDocumentationProvider
for getting commentINode
, cannot benull
- Returns:
- Built-In language documentation comment for the
Method
, nevernull
, if there is no comment nodes emptyBslDocumentationComment
will be returned
-
parseTemplateComment
public static BslDocumentationComment parseTemplateComment(BslContextDefMethod method, boolean oldFormat)
Parses Built-In language documentation comment for theBslContextDefMethod
- Parameters:
method
-BslContextDefMethod
contains content of the documentation comment adn offsets of the each line in comment relatively to the total method text, cannot benull
oldFormat
-true
if parsing in old documentation comment format,false
if in new format- Returns:
- Built-In language documentation comment for the
BslContextDefMethod
, nevernull
, if there is no comment emptyBslDocumentationComment
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 benull
method
- methodMethod
with documentation comment, cannot benull
oldFormat
-true
if parsing in old documentation comment format,false
if in new format- Returns:
- Bsl documentation comment for the
Method
, nevernull
, if there is empty text linesBslDocumentationComment
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 benull
method
- methodMethod
with documentation comment, cannot benull
oldFormat
-true
if parsing in old documentation comment format,false
if in new format- Returns:
- Bsl documentation comment for the
Method
, nevernull
, if there is empty text linesBslDocumentationComment
will be returned
-
isCommentNode
public static boolean isCommentNode(org.eclipse.xtext.nodemodel.ILeafNode leafNode)
ChecksILeafNode
is comment node in Bsl grammar- Parameters:
leafNode
- checking node, cannot benull
- 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 withIBslCommentToken.DEPRECATED
orIBslCommentToken.DEPRECATED_RU
-
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 benull
symbol
- pattern for spliting, this pattern found intext
withString.indexOf(int)
, cannot benull
- Returns:
- collection of the text part devided be
symbol
and offset of the each part in the originaltext
, cannot benull
, 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 benull
symbol
- pattern for spliting, this pattern found intext
withString.indexOf(int)
, cannot benull
partLimit
- limit of max splitted parts.- Returns:
- collection of the text part devided be
symbol
and offset of the each part in the originaltext
, cannot benull
, this collection does not contains part with 0 length. Count of parts cannot be more thancountOfParts
-
trim
public static org.eclipse.xtext.util.Triple<String,Integer,Integer> trim(String text)
Trims initial text- Parameters:
text
- triming text, cannot benull
- Returns:
- initial
text
without symbols from begining and ending corresponding to theCharacter.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)
GetsBslDocumentationComment
from Bsl method provided byLinkPart
- Parameters:
linkPart
-LinkPart
links toMethod
, cannot benull
scopeProvider
- actualIScopeProvider
for getting index object, cannot benull
commentProvider
- actualBslMultiLineCommentDocumentationProvider
for getting method documentation comment content, cannot benull
oldFormat
-true
if using old format of documentation comment,false
otherwisecontext
- context object for resolving index object fromscopeProvider
, cannot benull
typeComputationContext
- Type system computation context. May not benull
- 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)
GetsEObject
provided byLinkPart
- Parameters:
linkPart
- actualLinkPart
for gettingEObject
by it, cannot benull
scopeProvider
- actualIScopeProvider
for getting index object, cannot benull
context
- context object for resolving index object fromscopeProvider
, cannot benull
typeComputationContext
- Type system computation context. May not benull
- Returns:
EObject
provided byLinkPart
can benull
ifLinkPart
not link to realEObject
-
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 toModule
, cannot benull
commentProvider
- the reference toBslMultiLineCommentDocumentationProvider
, cannot benull
- 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 benull
method
-Method
with document comment nodes, cannot benull
- Returns:
- offsets of the each line in comment relatively to the total method text, cannot be
null
-
-