public class JavascriptUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
ID_PATTERN
Contains chars acceptable as part of expression to inspect to the right of
the cursor.
|
static java.util.regex.Pattern |
QUALIFIED_ID_PATTERN
Contains chars acceptable as part of expression to inspect to the left of
the cursor.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
extractSurroundingJsIdentifier(IDocument document,
int offset)
Returns a JavaScript qualified identifier surrounding the character at
offset position in the given document . |
static IRegion |
getSurroundingIdentifierRegion(IDocument doc,
int offset,
boolean qualified)
Returns a region enclosing a JavaScript identifier found in
doc at
the offset position. |
static boolean |
isJsIdentifierCharacter(char ch,
boolean qualified) |
public static final java.util.regex.Pattern ID_PATTERN
public static final java.util.regex.Pattern QUALIFIED_ID_PATTERN
public static boolean isJsIdentifierCharacter(char ch, boolean qualified)
public static java.lang.String extractSurroundingJsIdentifier(IDocument document, int offset)
offset
position in the given document
.document
- to extract an identifier fromoffset
- of the pivot character (before, in, or after the identifier)null
if none foundpublic static IRegion getSurroundingIdentifierRegion(IDocument doc, int offset, boolean qualified)
doc
at
the offset
position. If qualified == true
, all leading
qualifying names will be included into the region, otherwise the member
operator (".") will be considered as an identifier terminator.doc
- the document to extract an identifier region fromoffset
- of the pivot character (before, in, or after the identifier)qualified
- whether to read qualified identifiers rather than simple
onesCopyright (c) IBM Corp. and others 2000, 2016. All Rights Reserved.