org.eclipse.wst.jsdt.chromium.debug.ui.editors

## Class JavascriptUtil

- java.lang.Object
- - org.eclipse.wst.jsdt.chromium.debug.ui.editors.JavascriptUtil

    public class JavascriptUtil
    extends java.lang.Object

A utility for handling JavaScript-related data.

### Field Summary

Fields
`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.

### Method Summary

All Methods Static Methods Concrete Methods
`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)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### ID_PATTERN

    public static final java.util.regex.Pattern ID_PATTERN

Contains chars acceptable as part of expression to inspect to the right of the cursor.

#### QUALIFIED_ID_PATTERN

    public static final java.util.regex.Pattern QUALIFIED_ID_PATTERN

Contains chars acceptable as part of expression to inspect to the left of the cursor.

### Method Detail

#### isJsIdentifierCharacter

    public static boolean isJsIdentifierCharacter(char ch,
                                                  boolean qualified)

#### extractSurroundingJsIdentifier

    public static java.lang.String extractSurroundingJsIdentifier(IDocument document,
                                                                  int offset)

Returns a JavaScript qualified identifier surrounding the character at `offset` position in the given `document`.

Parameters:
  `document` - to extract an identifier from
  `offset` - of the pivot character (before, in, or after the identifier)
Returns:
  JavaScript identifier, or `null` if none found

#### getSurroundingIdentifierRegion

    public static IRegion getSurroundingIdentifierRegion(IDocument doc,
                                                         int offset,
                                                         boolean qualified)

Returns a region enclosing a JavaScript identifier found in `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.

Parameters:
  `doc` - the document to extract an identifier region from
  `offset` - of the pivot character (before, in, or after the identifier)
  `qualified` - whether to read qualified identifiers rather than simple ones
Returns:
  an IRegion corresponding to the JavaScript identifier overlapping offset, or null if none