Class GeneratedJavaParserBase

java.lang.Object
com.github.javaparser.GeneratedJavaParserBase
Direct Known Subclasses:
GeneratedJavaParser

abstract class GeneratedJavaParserBase extends Object
Base class for GeneratedJavaParser
  • Field Details

    • problems

      List<Problem> problems
    • storeTokens

      boolean storeTokens
  • Constructor Details

    • GeneratedJavaParserBase

      GeneratedJavaParserBase()
  • Method Details

    • getTokenSource

      abstract GeneratedJavaParserTokenManager getTokenSource()
    • ReInit

      abstract void ReInit(Provider provider)
    • token

      abstract JavaToken token()
    • getNextToken

      abstract Token getNextToken()
    • getToken

      abstract Token getToken(int index)
    • reset

      void reset(Provider provider)
    • getTokens

      public List<JavaToken> getTokens()
      Return the list of JavaParser specific tokens that have been encountered while parsing code using this parser.
      Returns:
      a list of tokens
    • getCommentsCollection

      CommentsCollection getCommentsCollection()
    • addProblem

      void addProblem(String message)
    • tokenRange

      TokenRange tokenRange()
    • range

      TokenRange range(JavaToken begin, JavaToken end)
      Return a TokenRange spanning from begin to end
    • range

      TokenRange range(Node begin, JavaToken end)
      Return a TokenRange spanning from begin to end
    • range

      TokenRange range(JavaToken begin, Node end)
      Return a TokenRange spanning from begin to end
    • range

      TokenRange range(Node begin, Node end)
      Return a TokenRange spanning from begin to end
    • orIfInvalid

      JavaToken orIfInvalid(JavaToken firstChoice, JavaToken secondChoice)
      Returns:
      secondChoice if firstChoice is JavaToken.UNKNOWN, otherwise firstChoice
    • orIfInvalid

      JavaToken orIfInvalid(JavaToken firstChoice, Node secondChoice)
      Returns:
      the begin-token secondChoice if firstChoice is JavaToken.UNKNOWN, otherwise firstChoice
    • nodeListBegin

      JavaToken nodeListBegin(NodeList<?> l)
      Get the token that starts the NodeList l
    • setTokenKind

      void setTokenKind(int newKind)
    • setStoreTokens

      void setStoreTokens(boolean storeTokens)
    • recover

      TokenRange recover(int recoveryTokenType, ParseException p)
    • recoverStatement

      TokenRange recoverStatement(int recoveryTokenType, int lBraceType, int rBraceType, ParseException p)
    • emptyNodeList

      <T extends Node> NodeList<T> emptyNodeList()
      Quickly create a new, empty, NodeList
    • add

      <T extends Node> NodeList<T> add(NodeList<T> list, T obj)
      Add obj to list and return it. Create a new list if list is null
    • addWhenNotNull

      <T extends Node> NodeList<T> addWhenNotNull(NodeList<T> list, T obj)
      Add obj to list only when list is not null
    • prepend

      <T extends Node> NodeList<T> prepend(NodeList<T> list, T obj)
      Add obj to list at position pos
    • add

      <T> List<T> add(List<T> list, T obj)
      Add obj to list
    • propagateRangeGrowthOnRight

      private void propagateRangeGrowthOnRight(Node node, Node endNode)
      Propagate expansion of the range on the right to the parent. This is necessary when the right border of the child is determining the right border of the parent (i.e., the child is the last element of the parent). In this case when we "enlarge" the child we should enlarge also the parent.
    • generateLambda

      Expression generateLambda(Expression ret, Statement lambdaBody)
      Workaround for rather complex ambiguity that lambda's create
    • juggleArrayCreation

      ArrayCreationExpr juggleArrayCreation(TokenRange range, List<TokenRange> levelRanges, Type type, NodeList<Expression> dimensions, List<NodeList<AnnotationExpr>> arrayAnnotations, ArrayInitializerExpr arrayInitializerExpr)
      Throws together an ArrayCreationExpr from a lot of pieces
    • juggleArrayType

      Type juggleArrayType(Type partialType, List<ArrayType.ArrayBracketPair> additionalBrackets)
      Throws together a Type, taking care of all the array brackets
    • makeMessageForParseException

      private String makeMessageForParseException(ParseException exception)
      This is the code from ParseException.initialise, modified to be more horizontal.
    • scopeToName

      Name scopeToName(Expression scope)
      Converts a NameExpr or a FieldAccessExpr scope to a Name.
    • unquote

      String unquote(String s)
    • unTripleQuote

      String unTripleQuote(String s)
    • setYieldSupported

      void setYieldSupported()