@@ -96,7 +96,7 @@ public static String unescapeString(String literal) {
9696 }
9797
9898 /**
99- * Return a string that is the same as the input string, but with escapable characters
99+ * Return a string that is the same as the input string, but with escapable characters
100100 * replaced by appropriate escape sequences.
101101 */
102102 public static String escapeString (String str ) {
@@ -114,15 +114,19 @@ public static String escapeString(String str) {
114114 }
115115
116116 public static String escapeName (String name ) {
117- return (name == null || name .isEmpty () || isIdentifier (name ))? name :
117+ return (name == null || name .isEmpty () || isIdentifier (name ) || isGlobalScopeSymbol ( name ) )? name :
118118 "'" + escapeString (name ) + "'" ;
119119 }
120120
121121 public static boolean isIdentifier (String name ) {
122122 return name .matches ("[a-zA-Z_]\\ w*" );
123123 }
124124
125- // Specific string used to identify a segment as a global scope qualifier
125+ // Qualified Names
126+
127+ /**
128+ * Specific string used to identify a segment as a global scope qualifier
129+ */
126130 public static final String GLOBAL_SCOPE_SYMBOL = "$" ;
127131
128132 public static boolean isGlobalScopeSymbol (String segment ) {
@@ -184,17 +188,9 @@ public static String toQualifiedNameString(List<String> segments) {
184188 return builder .toString ();
185189 }
186190 }
187-
188- /**
189- * Get documentation text for this element, as given by the body of the first documentation comment
190- * annotating the element (if any).
191- */
192- public static String getDocumentationTextFor (Element element ) {
193- return element .getDocumentation ().stream ().
194- map (Comment ::getBody ).
195- findFirst ().orElse (null );
196- }
197191
192+ // Library Elements
193+
198194 public static boolean isStandardLibraryElement (Element element ) {
199195 Namespace libraryNamespace = element .libraryNamespace ();
200196 return libraryNamespace instanceof LibraryPackage &&
@@ -251,6 +247,16 @@ public static List<MetadataFeature> getAllMetadataFeaturesOf(Element element) {
251247 return metadataFeatures ;
252248 }
253249
250+ /**
251+ * Get documentation text for this element, as given by the body of the first documentation comment
252+ * annotating the element (if any).
253+ */
254+ public static String getDocumentationTextFor (Element element ) {
255+ return element .getDocumentation ().stream ().
256+ map (Comment ::getBody ).
257+ findFirst ().orElse (null );
258+ }
259+
254260 public static String processCommentBody (String body ) {
255261 if (body != null ) {
256262 body = body .replaceFirst ("/\\ *" , "" ).replaceFirst ("^\\ s*" , "" );
0 commit comments