Package: groovy.json

## [Java] Enum JsonTokenType

- groovy.json.JsonTokenType

-     public enum JsonTokenType
      extends Enum

  The original slurper and lexer use this class. This is kept around in case someone needs its exact behavior. Enum listing all the possible JSON tokens that should be recognized by the lexer.

  Since:
    1.8.0

- - ### Enum Constants Summary

    Enum constants classes
    Enum constant | Description
    --- | ---
    `CLOSE_BRACKET` |
    `CLOSE_CURLY` |
    `COLON` |
    `COMMA` |
    `FALSE` |
    `NULL` |
    `NUMBER` |
    `OPEN_BRACKET` |
    `OPEN_CURLY` |
    `STRING` | Original pattern throws the StackOverflowError for long strings with backslashes.
    `TRUE` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `doCall(String it)`
    `` | `public String` | `getLabel()`
    `` | `public Object` | `getValidator()`
    `` | `public boolean` | `matching(String input)` Tells if an input string matches a token.
    `` | `public static JsonTokenType` | `startingWith(char c)` Find which JSON value might be starting with a given character

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Enum` | `compareTo, compareTo, describeConstable, equals, getClass, getDeclaringClass, hashCode, name, notify, notifyAll, ordinal, toString, valueOf, wait, wait, wait`

- - ### Enum Constant Detail

    - #### JsonTokenType CLOSE_BRACKET

    - #### JsonTokenType CLOSE_CURLY

    - #### JsonTokenType COLON

    - #### JsonTokenType COMMA

    - #### JsonTokenType FALSE

    - #### JsonTokenType NULL

    - #### JsonTokenType NUMBER

    - #### JsonTokenType OPEN_BRACKET

    - #### JsonTokenType OPEN_CURLY

    - #### JsonTokenType STRING

      Original pattern throws the StackOverflowError for long strings with backslashes. So it is replaced by a 2-step approach inspired from json2.js sources: https://github.com/douglascrockford/JSON-js/blob/master/json2.js#L462 See JsonTokenTypeTest#testMatchingLongStringWithBackslashes() for details.

    - #### JsonTokenType TRUE

  - ### Method Detail

    - #### public boolean doCall(String it)

    - #### public String getLabel()

    - #### public Object getValidator()

    - #### public boolean matching(String input)

      Tells if an input string matches a token.

      Parameters:
        `input` - the input string to match
      Returns:
        a `Matching` enum value: `YES` if this is an exact match, `POSSIBLE` if more characters could turn the input string into a valid token, or `NO` if the string cannot possibly match the pattern even with more characters to read.

    - #### public static JsonTokenType startingWith(char c)

      Find which JSON value might be starting with a given character

      Parameters:
        `c` - the character
      Returns:
        the possible token type found