## org.eclipse.datatools.sqltools.sqleditor.internal.sql
Class SQLPartitionScanner

    java.lang.Object
      org.eclipse.jface.text.rules.RuleBasedScanner
          org.eclipse.jface.text.rules.BufferedRuleBasedScanner
              org.eclipse.jface.text.rules.RuleBasedPartitionScanner
                  org.eclipse.datatools.sqltools.sqleditor.internal.sql.SQLPartitionScanner

All Implemented Interfaces:
  ISQLPartitions, org.eclipse.jface.text.rules.ICharacterScanner, org.eclipse.jface.text.rules.IPartitionTokenScanner, org.eclipse.jface.text.rules.ITokenScanner

    public class SQLPartitionScanner

extends org.eclipse.jface.text.rules.RuleBasedPartitionScanner
implements ISQLPartitions

The SQLPartitionScanner is a RulesBasedPartitionScanner. The SQL document partitions are computed dynamically as events signal that the document has changed. The document partitions are based on tokens that represent comments and SQL code sections.

Field Summary
`static java.lang.String` `SQL_ALTER`
`static java.lang.String` `SQL_CATALOG`
`static java.lang.String` `SQL_COMMENT_ON`
`static java.lang.String` `SQL_COMMIT`
`static java.lang.String` `SQL_CONNECT`
`static java.lang.String` `SQL_CREATE`
`static java.lang.String` `SQL_DELETE`
`static java.lang.String` `SQL_DISCONNECT`
`static java.lang.String` `SQL_DROP`
`static java.lang.String` `SQL_GRANT`
`static java.lang.String` `SQL_INSERT`
`static java.lang.String` `SQL_MERGE`
`static java.lang.String[]` `SQL_PARTITION_TYPES`
`static java.lang.String` `SQL_REVOKE`
`static java.lang.String` `SQL_ROLLBACK`
`static java.lang.String` `SQL_SELECT`
`static java.lang.String` `SQL_SET`
`static java.lang.String` `SQL_SIGNAL`
`static java.lang.String` `SQL_TERMINATE`
`static java.lang.String` `SQL_UNCATALOG`
`static java.lang.String` `SQL_UNKNOWNSQL`
`static java.lang.String` `SQL_UPDATE`

Fields inherited from interface org.eclipse.datatools.sqltools.sqleditor.internal.sql.ISQLPartitions
`SQL_CODE, SQL_COMMENT, SQL_DOUBLE_QUOTES_IDENTIFIER, SQL_MULTILINE_COMMENT, SQL_PARTITIONING, SQL_STRING`

Fields inherited from interface org.eclipse.jface.text.rules.ICharacterScanner
`EOF`

Constructor Summary
`SQLPartitionScanner()` Constructor for SQLPartitionScanner.
`SQLPartitionScanner(ISQLSyntax sqlSyntax)` Constructs an instance of this class using an instance of ISQLSyntax.

Method Summary
`static org.eclipse.jface.text.ITypedRegion[]` `getDocumentRegions(org.eclipse.jface.text.IDocument doc)` Gets the partitions of the given document as an array of `ITypedRegion` objects.
`java.lang.String` `getScannedPartitionString()` Return the String ranging from the start of the current partition to the current scanning position.

Methods inherited from class org.eclipse.jface.text.rules.RuleBasedPartitionScanner
`nextToken, setPartialRange, setPredicateRules, setRange, setRules`

Methods inherited from class org.eclipse.jface.text.rules.BufferedRuleBasedScanner
`read, unread`

Methods inherited from class org.eclipse.jface.text.rules.RuleBasedScanner
`getColumn, getLegalLineDelimiters, getTokenLength, getTokenOffset, setDefaultReturnToken`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.eclipse.jface.text.rules.ITokenScanner
`getTokenLength, getTokenOffset`

Field Detail

### SQL_SELECT

    public static final java.lang.String SQL_SELECT

See Also:
  Constant Field Values

### SQL_INSERT

    public static final java.lang.String SQL_INSERT

See Also:
  Constant Field Values

### SQL_UPDATE

    public static final java.lang.String SQL_UPDATE

See Also:
  Constant Field Values

### SQL_DELETE

    public static final java.lang.String SQL_DELETE

See Also:
  Constant Field Values

### SQL_MERGE

    public static final java.lang.String SQL_MERGE

See Also:
  Constant Field Values

### SQL_CREATE

    public static final java.lang.String SQL_CREATE

See Also:
  Constant Field Values

### SQL_DROP

    public static final java.lang.String SQL_DROP

See Also:
  Constant Field Values

### SQL_ALTER

    public static final java.lang.String SQL_ALTER

See Also:
  Constant Field Values

### SQL_GRANT

    public static final java.lang.String SQL_GRANT

See Also:
  Constant Field Values

### SQL_REVOKE

    public static final java.lang.String SQL_REVOKE

See Also:
  Constant Field Values

### SQL_COMMIT

    public static final java.lang.String SQL_COMMIT

See Also:
  Constant Field Values

### SQL_ROLLBACK

    public static final java.lang.String SQL_ROLLBACK

See Also:
  Constant Field Values

### SQL_SET

    public static final java.lang.String SQL_SET

See Also:
  Constant Field Values

### SQL_CONNECT

    public static final java.lang.String SQL_CONNECT

See Also:
  Constant Field Values

### SQL_DISCONNECT

    public static final java.lang.String SQL_DISCONNECT

See Also:
  Constant Field Values

### SQL_COMMENT_ON

    public static final java.lang.String SQL_COMMENT_ON

See Also:
  Constant Field Values

### SQL_TERMINATE

    public static final java.lang.String SQL_TERMINATE

See Also:
  Constant Field Values

### SQL_CATALOG

    public static final java.lang.String SQL_CATALOG

See Also:
  Constant Field Values

### SQL_UNCATALOG

    public static final java.lang.String SQL_UNCATALOG

See Also:
  Constant Field Values

### SQL_SIGNAL

    public static final java.lang.String SQL_SIGNAL

See Also:
  Constant Field Values

### SQL_UNKNOWNSQL

    public static final java.lang.String SQL_UNKNOWNSQL

See Also:
  Constant Field Values

### SQL_PARTITION_TYPES

    public static final java.lang.String[] SQL_PARTITION_TYPES

Constructor Detail

### SQLPartitionScanner

    public SQLPartitionScanner()

  Constructor for SQLPartitionScanner. Creates rules to parse comment partitions in an SQL document. In the constructor, is defined the entire set of rules used to parse the SQL document, in an instance of an IPredicateRule. The coonstructor calls setPredicateRules method which associates the rules to the scanner and makes the document ready for parsing.

### SQLPartitionScanner

    public SQLPartitionScanner(ISQLSyntax sqlSyntax)

  Constructs an instance of this class using an instance of ISQLSyntax. Creates rules based on the ISQLSyntax object to parse comment partitions in an SQL document.

Method Detail

### getScannedPartitionString

    public java.lang.String getScannedPartitionString()

  Return the String ranging from the start of the current partition to the current scanning position. Some rules (@see NestedMultiLineRule) need this information to calculate the comment nesting depth.

### getDocumentRegions

    public static org.eclipse.jface.text.ITypedRegion[] getDocumentRegions(org.eclipse.jface.text.IDocument doc)

  Gets the partitions of the given document as an array of `ITypedRegion` objects. There is a distinct non-overlapping partition for each comment line, string literal, delimited identifier, and "everything else" (that is, SQL code other than a string literal or delimited identifier).

  Parameters:
    `doc` - the document to parse into partitions
  Returns:
    an array containing the document partion regions