Package org.openjdk.asmtools.jasm

## Class Scanner

- java.lang.Object
- - org.openjdk.asmtools.jasm.ParseBase
  - - org.openjdk.asmtools.jasm.Scanner

-     public class Scanner
      extends ParseBase

  A Scanner for Jasm tokens. Errors are reported to the environment object.

  The scanner keeps track of the current token, the value of the current token (if any), and the start position of the current token.

  The scan() method advances the scanner to the next token in the input.

  The match() method is used to quickly match opening brackets (ie: '(', '{', or '[') with their closing counter part. This is useful during error recovery.

  The compiler treats either "\n", "\r" or "\r\n" as the end of a line.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `protected static class` | `Scanner.SyntaxError` | SyntaxError is the generic error thrown for parsing problems.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected int` | `ch` | The current character
    `protected char` | `charValue` |
    `protected java.lang.String` | `docComment` |
    `protected double` | `doubleValue` |
    `protected float` | `floatValue` |
    `protected java.lang.String` | `idValue` |
    `protected Environment` | `in` | Input stream
    `protected boolean` | `inBits` |
    `protected int` | `intValue` |
    `protected long` | `longValue` |
    `protected int` | `pos` | The position of the current token
    `protected int` | `prevPos` | The position of the previous token
    `protected int` | `radix` |
    `protected int` | `sign` |
    `protected java.lang.String` | `stringValue` |
    `protected JasmTokens.Token` | `token` | Current token

    - ### Fields inherited from class org.openjdk.asmtools.jasm.ParseBase

      `debugFlag, env, parser, scanner`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `Scanner​(Environment env)` | main constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `check​(JasmTokens.Token t)` | Checks a token, throws an exception if not the same
    `protected boolean` | `checkTokenIdent()` | Check the token may be identifier
    `protected void` | `debugScan​(java.lang.String dbstr)` |
    `protected void` | `expect​(JasmTokens.Token t)` | Expects a token, scans the next token or throws an exception.
    `static boolean` | `isUCDigit​(int ch)` | Returns true if the character is a unicode digit.
    `static boolean` | `isUCLetter​(int ch)` | Returns true if the character is a Unicode letter.
    `protected void` | `scan()` | scan Scan the next token.
    `protected void` | `scanModuleStatement()` |
    `protected void` | `xscan()` |

    - ### Methods inherited from class org.openjdk.asmtools.jasm.ParseBase

      `debugStr, enableDebug, init`

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

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

- - ### Field Detail

    - #### in

          protected Environment in

      Input stream

    - #### ch

          protected int ch

      The current character

    - #### token

          protected JasmTokens.Token token

      Current token

    - #### pos

          protected int pos

      The position of the current token

    - #### charValue

          protected char charValue

    - #### intValue

          protected int intValue

    - #### longValue

          protected long longValue

    - #### floatValue

          protected float floatValue

    - #### doubleValue

          protected double doubleValue

    - #### stringValue

          protected java.lang.String stringValue

    - #### idValue

          protected java.lang.String idValue

    - #### radix

          protected int radix

    - #### docComment

          protected java.lang.String docComment

    - #### prevPos

          protected int prevPos

      The position of the previous token

    - #### sign

          protected int sign

    - #### inBits

          protected boolean inBits

  - ### Constructor Detail

    - #### Scanner

          protected Scanner​(Environment env)
                     throws java.io.IOException

      main constructor. Create a scanner to scan an input stream.
      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### scanModuleStatement

          protected void scanModuleStatement()
                                      throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### scan

          protected void scan()
                       throws java.io.IOException

      scan Scan the next token.
      Throws:
        `java.io.IOException`

    - #### checkTokenIdent

          protected final boolean checkTokenIdent()

      Check the token may be identifier

    - #### expect

          protected final void expect​(JasmTokens.Token t)
                               throws Scanner.SyntaxError,
                                      java.io.IOException

      Expects a token, scans the next token or throws an exception.
      Throws:
        `Scanner.SyntaxError`
        `java.io.IOException`

    - #### check

          protected final void check​(JasmTokens.Token t)
                              throws Scanner.SyntaxError,
                                     java.io.IOException

      Checks a token, throws an exception if not the same
      Throws:
        `Scanner.SyntaxError`
        `java.io.IOException`

    - #### isUCDigit

          public static boolean isUCDigit​(int ch)

      Returns true if the character is a unicode digit.
      Parameters:
        `ch` - the character to be checked

    - #### isUCLetter

          public static boolean isUCLetter​(int ch)

      Returns true if the character is a Unicode letter.
      Parameters:
        `ch` - the character to be checked

    - #### xscan

          protected final void xscan()
                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### debugScan

          protected void debugScan​(java.lang.String dbstr)

      Overrides:
        `debugScan` in class `ParseBase`