org.modeshape.jcr

## Class CndTokenizer

- java.lang.Object
- - org.modeshape.jcr.CndTokenizer

- All Implemented Interfaces:
    TokenStream.Tokenizer

      public class CndTokenizer
      extends Object
      implements TokenStream.Tokenizer

  A `TokenStream.Tokenizer` implementation that adheres to the CND format by ignoring whitespace while including tokens for individual symbols, the period ('.'), single-quoted strings, double-quoted strings, whitespace-delimited words, and optionally comments. This tokenizer optionally includes comments and vendor extensions.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `COMMENT` The token type for tokens that consist of all the characters between "/*" and "*/" or between "//" and the next line terminator (e.g., '\n', '\r' or "\r\n").
    `static int` | `DECIMAL` The token type for tokens that consist of an individual '.' character.
    `static int` | `DOUBLE_QUOTED_STRING` The token type for tokens that consist of all the characters within double-quotes.
    `static int` | `SINGLE_QUOTED_STRING` The token type for tokens that consist of all the characters within single-quotes.
    `static int` | `SYMBOL` The token type for tokens that consist of an individual "symbol" character.
    `static int` | `VENDOR_EXTENSION` The token type for the token containing a vendor extension block.
    `static int` | `WORD` The token type for tokens that represent an unquoted string containing a character sequence made up of non-whitespace and non-symbol characters.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CndTokenizer(boolean useComments, boolean useVendorExtensions)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `tokenize(TokenStream.CharacterStream input, TokenStream.Tokens tokens)` Process the supplied characters and construct the appropriate `TokenStream.Token` objects.

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

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

- - ### Field Detail

    - #### WORD

          public static final int WORD

      The token type for tokens that represent an unquoted string containing a character sequence made up of non-whitespace and non-symbol characters.
      See Also:
        Constant Field Values

    - #### SYMBOL

          public static final int SYMBOL

      The token type for tokens that consist of an individual "symbol" character. The set of characters includes: `[]<>=-+(),`
      See Also:
        Constant Field Values

    - #### DECIMAL

          public static final int DECIMAL

      The token type for tokens that consist of an individual '.' character.
      See Also:
        Constant Field Values

    - #### SINGLE_QUOTED_STRING

          public static final int SINGLE_QUOTED_STRING

      The token type for tokens that consist of all the characters within single-quotes. Single quote characters are included if they are preceded (escaped) by a '\' character.
      See Also:
        Constant Field Values

    - #### DOUBLE_QUOTED_STRING

          public static final int DOUBLE_QUOTED_STRING

      The token type for tokens that consist of all the characters within double-quotes. Double quote characters are included if they are preceded (escaped) by a '\' character.
      See Also:
        Constant Field Values

    - #### COMMENT

          public static final int COMMENT

      The token type for tokens that consist of all the characters between "/*" and "*/" or between "//" and the next line terminator (e.g., '\n', '\r' or "\r\n").
      See Also:
        Constant Field Values

    - #### VENDOR_EXTENSION

          public static final int VENDOR_EXTENSION

      The token type for the token containing a vendor extension block.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CndTokenizer

          public CndTokenizer(boolean useComments,
                      boolean useVendorExtensions)

  - ### Method Detail

    - #### tokenize

          public void tokenize(TokenStream.CharacterStream input,
                      TokenStream.Tokens tokens)
                        throws ParsingException

      Process the supplied characters and construct the appropriate `TokenStream.Token` objects.
      Specified by:
        `tokenize` in interface `TokenStream.Tokenizer`
      Parameters:
        `input` - the character input stream; never null
        `tokens` - the factory for `TokenStream.Token` objects, which records the order in which the tokens are created
      Throws:
        `ParsingException` - if there is an error while processing the character stream (e.g., a quote is not closed, etc.)
      See Also:
        `org.modeshape.common.text.TokenStream.Tokenizer#tokenize(CharacterStream, Tokens)`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.