Package com.e1c.langtool.v8.dt.bsl
Class BslUtils
java.lang.Object
com.e1c.langtool.v8.dt.bsl.BslUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncollectMultilineCommentAfterObject(org.eclipse.emf.ecore.EObject expressionBeforeComment, org.eclipse.xtext.nodemodel.INode blockNode) Collect multiline comment after object.static StringformatAndQuoteForStringLiteral(String content, String prefixLine) Format and quote for string literal.formatAndQuoteForStringLiteral(List<String> lines, String prefixLine) Format and quote for string literal.static StringformatForStringLiteral(String content, String prefixLine) Transform text to theStringLiteralcontent in Bsl modulestatic StringformatNStrEntry(String languageCode, String value) Format single NStr entry to string with pattern"langCode = 'value'".static StringformatNStrStringLiteral(Map<String, String> map, String[] indentation) Generate double-quoted string representation ofmapcontaining localized messages for zero or more languages.getCommentLines(List<org.eclipse.xtext.nodemodel.INode> nodes) Gets string content of the comment lines.static VariablegetCommentNodeVariable(org.eclipse.xtext.nodemodel.ILeafNode node) Gets the comment node variable.static StringGets the featrue key preffix.getInlineCommentAfterObject(org.eclipse.emf.ecore.EObject expressionBeforeComment, org.eclipse.xtext.nodemodel.INode blockNode, boolean oldFormatComment) Provides theListof inlined comments for semantic element.static StringgetLastLineIdentation(StringLiteral literal, int lengthDiff) Gets the last line identation.getNlsLocalStrings(StringLiteral object) Gets the nls local strings as a map of language code and value.static StringgetNodeIdentation(org.eclipse.xtext.nodemodel.INode node, int lengthDiff) Gets the node identation.static org.eclipse.emf.ecore.EObjectgetOwnerDocNode(List<org.eclipse.xtext.nodemodel.INode> lines) Gets the owner doc node.static org.eclipse.emf.ecore.EObjectgetOwnerNode(List<org.eclipse.xtext.nodemodel.INode> lines) Gets the owner node.static StringgetQueryText(StringLiteral literal) Gets the query text from the string literal lines with removing query package separator or query union keyword.static StringgetString(StringLiteral literal) Gets the content of theStringLiteralwithout "|" and without start-end quotesstatic StringgetTextWithoutSplashes(String text) static List<org.eclipse.xtext.nodemodel.INode>getUpAndDownCommentNodes(org.eclipse.xtext.nodemodel.INode node) Collects all comment lines that are not separated from the incoming comment by a non-comment line.static booleanisEmptySource(List<FeatureEntry> features) Checks if the some object's list of features is empty source.static booleanisInlineDocCommentNode(org.eclipse.xtext.nodemodel.ILeafNode node) Checks if is inline doc comment node.static booleanisNStr(StringLiteral stringLiteral, IStringLiteralTypeComputer typeComputer) Checks if the string literal is nstr, using light-weght computing.static String[]splitStringKeys(StringLiteral literal) Deprecated.static String[]splitStringKeys(String lines) Deprecated.
-
Field Details
-
KEY_SPLIT_REGEX
- See Also:
-
STRING_LINE_SEPARATOR
- See Also:
-
SYSTEM_LINE_SEPARATOR
-
QUOTE
- See Also:
-
DOUBLE_QUOTE_PATTERN
-
COMMENT_START_TAG_BSL
- See Also:
-
-
Method Details
-
splitStringKeys
Deprecated.Split string into valid keys.- Parameters:
lines- the lines- Returns:
- the string[], never
null.
-
splitStringKeys
Deprecated.Split string literal lines into valid keys.- Parameters:
literal- the literal- Returns:
- the string[], never
null.
-
getNlsLocalStrings
Gets the nls local strings as a map of language code and value.- Parameters:
object- the object- Returns:
- the nls local strings, cannot return
null
-
getString
Gets the content of theStringLiteralwithout "|" and without start-end quotes- Parameters:
literal- the literal, can't benull- Returns:
- content of the
StringLiteralwithout "|", nevernull
-
getQueryText
Gets the query text from the string literal lines with removing query package separator or query union keyword. Lines of query text will be joined withSTRING_LINE_SEPARATORregardless current system line separator.- Parameters:
literal- the literal with one of query types, cannot benull.- Returns:
- the query text, cannot return
null.
-
formatForStringLiteral
Transform text to theStringLiteralcontent in Bsl module- Parameters:
content- transforming content, can't benull. Content lines must be speparated withLFor"\n"symbol orSTRING_LINE_SEPARATORprefixLine- the prefix line inserted before service symbol "|", can't benull- Returns:
- text of the
StringLiteralwith service symbols "|", nevernull. Returning line joined with system line separatorSystem.lineSeparator()can beCR+LForLF
-
formatAndQuoteForStringLiteral
Format and quote for string literal.- Parameters:
content- the contentprefixLine- the prefix line- Returns:
- the string
-
formatAndQuoteForStringLiteral
Format and quote for string literal.- Parameters:
lines- the linesprefixLine- the prefix line- Returns:
- the list
-
formatNStrStringLiteral
Generate double-quoted string representation ofmapcontaining localized messages for zero or more languages. Second and following lines are indented with indentation lines, passed inindentationparameter. If resulting string lines count is greater thanindentation.lengthvalue ofindentation[indentation.length - 1]will be used for all exceeding lines. Resulting string is safe to be used as an parameter ofNStrfunction in BSL file text.- Parameters:
map- Mapping from language code to localized message in that language.indentation- Array of strings to be used as an indentation prefixes.- Returns:
- Double-quoted string with all entries from passed
mapindented with entries ofindentationarray.
-
formatNStrEntry
Format single NStr entry to string with pattern"langCode = 'value'". Note that NStr-formatted pattern does NOT contains semicolon at the end of formated string;- Parameters:
languageCode- the language codevalue- the value of NStr for the language code- Returns:
- the formatted string without semicolon at the end.
-
getLastLineIdentation
Gets the last line identation.- Parameters:
literal- the literallengthDiff- the length diff- Returns:
- the last line identation
-
getNodeIdentation
Gets the node identation.- Parameters:
node- the nodelengthDiff- the length diff- Returns:
- the node identation
-
isEmptySource
Checks if the some object's list of features is empty source.- Parameters:
features- the features of the object- Returns:
- true, if it is empty source
-
isInlineDocCommentNode
public static boolean isInlineDocCommentNode(org.eclipse.xtext.nodemodel.ILeafNode node) Checks if is inline doc comment node.- Parameters:
node- the node- Returns:
- true, if is inline doc comment node
-
getCommentNodeVariable
Gets the comment node variable.- Parameters:
node- the node- Returns:
- the comment node variable
-
getFeatrueKeyPreffix
Gets the featrue key preffix.- Parameters:
model- the model- Returns:
- the featrue key preffix
-
getUpAndDownCommentNodes
public static List<org.eclipse.xtext.nodemodel.INode> getUpAndDownCommentNodes(org.eclipse.xtext.nodemodel.INode node) Collects all comment lines that are not separated from the incoming comment by a non-comment line.- Parameters:
node- the node of an incoming comment that is part of an entire block of comments. It can be the first line of the comment, the last, or any line between the first and the last.- Returns:
- the nodes of all comment lines that are not separated from the incoming comment by a non-comment line.
-
getCommentLines
Gets string content of the comment lines.- Parameters:
nodes- the adjacent nodes- Returns:
- the comment lines
-
getOwnerNode
public static org.eclipse.emf.ecore.EObject getOwnerNode(List<org.eclipse.xtext.nodemodel.INode> lines) Gets the owner node.- Parameters:
lines- the lines- Returns:
- the owner node
-
getOwnerDocNode
public static org.eclipse.emf.ecore.EObject getOwnerDocNode(List<org.eclipse.xtext.nodemodel.INode> lines) Gets the owner doc node.- Parameters:
lines- the lines- Returns:
- the owner doc node
-
getInlineCommentAfterObject
public static List<String> getInlineCommentAfterObject(org.eclipse.emf.ecore.EObject expressionBeforeComment, org.eclipse.xtext.nodemodel.INode blockNode, boolean oldFormatComment) Provides theListof inlined comments for semantic element.- Parameters:
expressionBeforeComment- the element for which the inlined comment is being taken, cannot benullblockNode- the parent node for element, cannot benulloldFormatComment-trueif comment in old format,falsein new format- Returns:
- the
Listof inlined comments, cannot benull
-
collectMultilineCommentAfterObject
public static List<String> collectMultilineCommentAfterObject(org.eclipse.emf.ecore.EObject expressionBeforeComment, org.eclipse.xtext.nodemodel.INode blockNode) Collect multiline comment after object.- Parameters:
expressionBeforeComment- the expression before comment, cannot benullblockNode- the block node, cannot benull- Returns:
- the list of comment lines
-
getTextWithoutSplashes
-
isNStr
Checks if the string literal is nstr, using light-weght computing.- Parameters:
stringLiteral- the string literal, cannot benulltypeComputer- the type computer, cannot benull- Returns:
true, if it is nstr
-