Class TypeUtil
- java.lang.Object
-
- com._1c.g5.v8.dt.bsl.stringliteral.contenttypes.TypeUtil
-
public final class TypeUtil extends Object
The utility class for common functions forStringLiteral
content type processing.
-
-
Field Summary
Fields Modifier and Type Field Description static String
COMMENT_START_TAG_BSL
The starting comment symbolsstatic boolean
DEFAULT_STRING_LITERAL_CONTENT_TYPE_ENABLED
The default settings of string literal content type computing.static Pattern
HEADER_ANNOTATION_PATTERN
static Pattern
INLINE_ANNOTATION_PATTERN
static String
KEY_STRING_LITERAL_CONTENT_TYPE_ENABLED
The key of settings of string literal content type computing.static String
NODE_STRING_LITERAL_CONTENT_TYPE_ENABLED
The node of string literal content type computing.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.emf.ecore.EObject
getActualSemanticObjectForLine(org.eclipse.emf.ecore.EObject object)
Gets the actual semantic object for line.static org.eclipse.xtext.util.Pair<Integer,Integer>
getAnnotationOffsetAndLength(LiteralType type, org.eclipse.xtext.nodemodel.ICompositeNode literalNode, int indexOnLastLine, org.eclipse.xtext.nodemodel.INode annotationNode)
Gets the annotation offset and length by annotation type description.static List<org.eclipse.xtext.nodemodel.INode>
getCommentLinesFromRight(org.eclipse.emf.ecore.EObject object)
Gets the comment lines from right of the object.static List<StringLiteral>
getStringLiteralsInLine(StringLiteral object)
Gets the string literals in same line as given literal.static List<StringLiteral>
getStringLiteralsInLine(org.eclipse.xtext.nodemodel.INode node, int currentLine)
Gets the string literals in line.static boolean
isStringLiteralContentTypesEnabled()
Checks if string literal content types computing is enabled.static List<org.eclipse.xtext.util.Triple<String,Integer,String>>
parseHeaderAnnotations(String comment)
Parses the header annotations.static org.eclipse.xtext.util.Pair<List<org.eclipse.xtext.util.Pair<String,Integer>>,String>
parseInLineAnnotations(String comment)
Parses the in-line annotations from comment string.static void
setStringLiteralContentTypesEnabled(boolean enable)
Sets the string literal content types computing enable status.
-
-
-
Field Detail
-
COMMENT_START_TAG_BSL
public static final String COMMENT_START_TAG_BSL
The starting comment symbols- See Also:
- Constant Field Values
-
HEADER_ANNOTATION_PATTERN
public static final Pattern HEADER_ANNOTATION_PATTERN
-
INLINE_ANNOTATION_PATTERN
public static final Pattern INLINE_ANNOTATION_PATTERN
-
DEFAULT_STRING_LITERAL_CONTENT_TYPE_ENABLED
public static boolean DEFAULT_STRING_LITERAL_CONTENT_TYPE_ENABLED
The default settings of string literal content type computing.
-
KEY_STRING_LITERAL_CONTENT_TYPE_ENABLED
public static String KEY_STRING_LITERAL_CONTENT_TYPE_ENABLED
The key of settings of string literal content type computing.
-
NODE_STRING_LITERAL_CONTENT_TYPE_ENABLED
public static String NODE_STRING_LITERAL_CONTENT_TYPE_ENABLED
The node of string literal content type computing.
-
-
Method Detail
-
isStringLiteralContentTypesEnabled
public static boolean isStringLiteralContentTypesEnabled()
Checks if string literal content types computing is enabled.- Returns:
- true, if string literal content types computing is enabled
-
setStringLiteralContentTypesEnabled
public static void setStringLiteralContentTypesEnabled(boolean enable)
Sets the string literal content types computing enable status.- Parameters:
enable
- the new enable status of computing string literal content types
-
getActualSemanticObjectForLine
public static org.eclipse.emf.ecore.EObject getActualSemanticObjectForLine(org.eclipse.emf.ecore.EObject object)
Gets the actual semantic object for line.- Parameters:
object
- the object to get the line from, cannot benull
.- Returns:
- the actual semantic object for line or may be the same object from parameter, cannot return
null
.
-
getCommentLinesFromRight
public static List<org.eclipse.xtext.nodemodel.INode> getCommentLinesFromRight(org.eclipse.emf.ecore.EObject object)
Gets the comment lines from right of the object.- Parameters:
object
- the object, cannot benull
.- Returns:
- the comment lines from right, cannot return
null
.
-
getStringLiteralsInLine
public static List<StringLiteral> getStringLiteralsInLine(StringLiteral object)
Gets the string literals in same line as given literal.- Parameters:
object
- the object, cannot benull
.- Returns:
- the string literals in line, cannot return
null
.
-
getStringLiteralsInLine
public static List<StringLiteral> getStringLiteralsInLine(org.eclipse.xtext.nodemodel.INode node, int currentLine)
Gets the string literals in line.- Parameters:
node
- the node, cannot benull
.currentLine
- the current line, cannot benull
.- Returns:
- the sting literals in line, cannot return
null
.
-
parseHeaderAnnotations
public static List<org.eclipse.xtext.util.Triple<String,Integer,String>> parseHeaderAnnotations(String comment)
Parses the header annotations.- Parameters:
comment
- the comment, cannot benull
.- Returns:
- the list of annotations, position and description of annotation in string, cannot return
null
.
-
parseInLineAnnotations
public static org.eclipse.xtext.util.Pair<List<org.eclipse.xtext.util.Pair<String,Integer>>,String> parseInLineAnnotations(String comment)
Parses the in-line annotations from comment string.- Parameters:
comment
- the comment, cannot benull
.- Returns:
- the pair of list of annotations and position, and common description for all annotations in the line,
cannot return
null
.
-
getAnnotationOffsetAndLength
public static org.eclipse.xtext.util.Pair<Integer,Integer> getAnnotationOffsetAndLength(LiteralType type, org.eclipse.xtext.nodemodel.ICompositeNode literalNode, int indexOnLastLine, org.eclipse.xtext.nodemodel.INode annotationNode)
Gets the annotation offset and length by annotation type description.- Parameters:
type
- the literal type description to find it's position, cannot benull
.literalNode
- the literal node, cannot benull
.indexOnLastLine
- the index on last line, cannot benull
.annotationNode
- the annotation node, cannot benull
.- Returns:
- the annotation offset and length, cannot be
null
.
-
-