Class JavaSourceCodeReaderLowlevel

java.lang.Object
io.github.mmm.scanner.AbstractCharStreamScanner
io.github.mmm.scanner.CharReaderScanner
io.github.mmm.code.impl.java.parser.JavaSourceCodeReaderLowlevel
All Implemented Interfaces:
io.github.mmm.base.text.TextFormatProcessor, io.github.mmm.base.text.TextPosition, io.github.mmm.scanner.CharStreamScanner, AutoCloseable
Direct Known Subclasses:
JavaSourceCodeReaderHighlevel

public abstract class JavaSourceCodeReaderLowlevel extends io.github.mmm.scanner.CharReaderScanner
Wrapper for a Reader with internal char buffer to read and parse textual data.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final List<io.github.mmm.code.api.annotation.CodeAnnotation>
    protected final List<io.github.mmm.code.api.comment.CodeComment>
    List of CodeComments collected whilst parsing.
    protected io.github.mmm.code.api.comment.CodeComment
     
    protected BaseFile
    The current BaseFile to parse.
    protected final List<String>
    List of plain JavaDoc lines collected whilst parsing.

    Fields inherited from class io.github.mmm.scanner.CharReaderScanner

    position

    Fields inherited from class io.github.mmm.scanner.AbstractCharStreamScanner

    buffer, column, limit, line, offset

    Fields inherited from interface io.github.mmm.scanner.CharStreamScanner

    EOS
  • Constructor Summary

    Constructors
    Constructor
    Description
    The constructor.
    The constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Clears all collected comments, annotations and javaDocs.
    void
    Consumes all standard text like spaces, comments, JavaDoc and annotations
    List<io.github.mmm.code.api.annotation.CodeAnnotation>
     
    List<io.github.mmm.code.api.comment.CodeComment>
     
    io.github.mmm.code.api.comment.CodeComment
     
     
    protected String
     
    protected io.github.mmm.code.api.modifier.CodeModifiers
    parseModifiers(boolean inInterface)
     
    protected String
     
    protected void
    Skips all whitespaces and parses all CodeComments.
    protected void
     

    Methods inherited from class io.github.mmm.scanner.CharReaderScanner

    close, expect, expectRestWithLookahead, fill, getBufferToParse, getPosition, isEob, isEos, isEot, peek, peekString, peekWhile, setReader, verifyLookahead

    Methods inherited from class io.github.mmm.scanner.AbstractCharStreamScanner

    addMessage, append, builder, eot, expectOne, expectOne, expectUnsafe, getAppended, getBufferParsed, getColumn, getLine, getMessages, handleChar, hasNext, next, peek, read, read, readDigit, readDouble, readFloat, readInteger, readJavaCharLiteral, readJavaNumberLiteral, readJavaStringLiteral, readLine, readLong, readNumber, readUnsignedLong, readUntil, readUntil, readUntil, readUntil, readUntil, readUntil, readWhile, require, requireMin, setOffset, skip, skipNewLine, skipOver, skipUntil, skipUntil, skipWhile, skipWhile, toString

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface io.github.mmm.scanner.CharStreamScanner

    expect, expect, expect, expect, expectOne, expectUnsafe, peekUntil, readBoolean, readBoolean, readBoolean, readDigit, readDouble, readFloat, readInteger, readJavaCharLiteral, readJavaStringLiteral, readLine, readLong, readUntil, readUntil, readUntil, readWhile, require, require, requireOne, requireOne, requireOneOrMore, skipOver, skipOver, skipWhile, skipWhileAndPeek, skipWhileAndPeek

    Methods inherited from interface io.github.mmm.base.text.TextFormatProcessor

    addError, addInfo, addMessage, addWarning
  • Field Details

    • javaDocLines

      protected final List<String> javaDocLines
      List of plain JavaDoc lines collected whilst parsing.
    • comments

      protected final List<io.github.mmm.code.api.comment.CodeComment> comments
      List of CodeComments collected whilst parsing.
    • elementComment

      protected io.github.mmm.code.api.comment.CodeComment elementComment
      See Also:
    • annotations

      protected final List<io.github.mmm.code.api.annotation.CodeAnnotation> annotations
    • file

      protected BaseFile file
      The current BaseFile to parse.
  • Constructor Details

    • JavaSourceCodeReaderLowlevel

      public JavaSourceCodeReaderLowlevel()
      The constructor.
    • JavaSourceCodeReaderLowlevel

      public JavaSourceCodeReaderLowlevel(int capacity)
      The constructor.
      Parameters:
      capacity - the buffer capacity.
  • Method Details

    • reset

      protected void reset()
      Overrides:
      reset in class io.github.mmm.scanner.CharReaderScanner
    • clearConsumeState

      protected void clearConsumeState()
      Clears all collected comments, annotations and javaDocs.
    • getComments

      public List<io.github.mmm.code.api.comment.CodeComment> getComments()
      Returns:
      the (last) comments that have been parsed by the last invocation of consume(). Will be empty for none.
      See Also:
    • getElementComment

      public io.github.mmm.code.api.comment.CodeComment getElementComment()
      Returns:
      the CodeComment for the currently parsed "element" (type, member, etc.) parsed by the last invocation of consume().
    • getJavaDocLines

      public List<String> getJavaDocLines()
      Returns:
      the plain JavaDoc lines that have been parsed by the last invocation of consume(). Will be empty for no JavaDoc.
    • getAnnotations

      public List<io.github.mmm.code.api.annotation.CodeAnnotation> getAnnotations()
      Returns:
      the List of CodeAnnotations that have been parsed by the last invocation of consume().
    • consume

      public void consume()
      Consumes all standard text like spaces, comments, JavaDoc and annotations
    • parseWhitespacesAndComments

      protected void parseWhitespacesAndComments()
      Skips all whitespaces and parses all CodeComments.
    • parseIdentifier

      protected String parseIdentifier()
      Returns:
      the current identifier or null if not pointing to such.
    • parseQName

      protected String parseQName()
      Returns:
      the current (qualified) name or null if not pointing to such.
    • parseModifiers

      protected io.github.mmm.code.api.modifier.CodeModifiers parseModifiers(boolean inInterface)
      Parameters:
      inInterface - - true if in the context of an interface (where public is the default), false otherwise.
      Returns:
      the parsed CodeModifiers.