Top Inners Fields Constructors Methods
io.github.kusoroadeolu.veneer

public Class JavaSyntaxHighlighter

extends AbstractSyntaxHighlighter
Class Inheritance
Imports
com.github.javaparser.*, com.github.javaparser.ast.CompilationUnit, com.github.javaparser.ast.body.ConstructorDeclaration, .EnumConstantDeclaration, .FieldDeclaration, .MethodDeclaration, com.github.javaparser.ast.expr.FieldAccessExpr, .MethodCallExpr, com.github.javaparser.ast.type.ClassOrInterfaceType, io.github.kusoroadeolu.clique.Clique, io.github.kusoroadeolu.clique.style.StyleBuilder, io.github.kusoroadeolu.veneer.utils.FragmentJavaToken, .PositionalJavaToken, io.github.kusoroadeolu.veneer.theme.SyntaxTheme, .SyntaxThemes, java.util.*

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record

Field Summary

Modifier and TypeField and Description
private final JavaParser
private final boolean
private final SyntaxTheme
private static final String

Constructor Summary

AccessConstructor and Description
public
public
public
JavaSyntaxHighlighter(boolean showLineNumbers)

public
JavaSyntaxHighlighter(SyntaxTheme theme, boolean showLineNumbers)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
appendLineNo(int lineNo, StyleBuilder sb)

pack-priv void
pack-priv String
pack-priv Set<PositionalJavaToken>
pack-priv Set<PositionalJavaToken>
pack-priv Set<PositionalJavaToken>
public String
highlight(String s)

Implements io.github.kusoroadeolu.veneer.SyntaxHighlighter.highlight.

Highlights the given Java source string.

pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv void
pack-priv void
pack-priv void
pack-priv boolean

Field Detail

parserback to summary
private final JavaParser parser
showLineNumbersback to summary
private final boolean showLineNumbers

Hides io.github.kusoroadeolu.veneer.AbstractSyntaxHighlighter.showLineNumbers.

themeback to summary
private final SyntaxTheme theme

Hides io.github.kusoroadeolu.veneer.AbstractSyntaxHighlighter.theme.

VARback to summary
private static final String VAR

Constructor Detail

JavaSyntaxHighlighterback to summary
public JavaSyntaxHighlighter()
JavaSyntaxHighlighterback to summary
public JavaSyntaxHighlighter(SyntaxTheme theme)
JavaSyntaxHighlighterback to summary
public JavaSyntaxHighlighter(boolean showLineNumbers)
JavaSyntaxHighlighterback to summary
public JavaSyntaxHighlighter(SyntaxTheme theme, boolean showLineNumbers)

Method Detail

appendLineNoback to summary
pack-priv void appendLineNo(int lineNo, StyleBuilder sb)
applyStyleback to summary
pack-priv void applyStyle(JavaToken token, StyleBuilder sb, JavaSyntaxHighlighter.AstBundle astBundle)
doHighlightback to summary
pack-priv String doHighlight(CompilationUnit unit, TokenRange tokenRange)
findConstantDefinitionsback to summary
pack-priv Set<PositionalJavaToken> findConstantDefinitions(CompilationUnit unit)
findMethodAndConstructorIdentifiersback to summary
pack-priv Set<PositionalJavaToken> findMethodAndConstructorIdentifiers(CompilationUnit unit)
findTypeDefinitionsback to summary
pack-priv Set<PositionalJavaToken> findTypeDefinitions(CompilationUnit unit)
highlightback to summary
public String highlight(String s)

Implements io.github.kusoroadeolu.veneer.SyntaxHighlighter.highlight.

Doc from io.github.kusoroadeolu.veneer.SyntaxHighlighter.highlight.

Highlights the given Java source string.

Annotations
@Override
isAnnotationback to summary
pack-priv boolean isAnnotation(JavaToken token)
isCommentback to summary
pack-priv boolean isComment(JavaToken token)
isConstantback to summary
pack-priv boolean isConstant(JavaToken token, Set<PositionalJavaToken> constants)
isEOLback to summary
pack-priv boolean isEOL(JavaToken token)
isKeywordback to summary
pack-priv boolean isKeyword(JavaToken token)
isMethodOrConstructorIdentifierback to summary
pack-priv boolean isMethodOrConstructorIdentifier(JavaToken token, Set<PositionalJavaToken> methodTokens)
isMultiLineTokenback to summary
pack-priv boolean isMultiLineToken(JavaToken token)
isNumberLiteralback to summary
pack-priv boolean isNumberLiteral(JavaToken token)
isStringOrJavadocback to summary
pack-priv boolean isStringOrJavadoc(JavaToken token)
isTypeTokenback to summary
pack-priv boolean isTypeToken(JavaToken token, Set<PositionalJavaToken> typeTokens)
isUnicodeEscapeback to summary
pack-priv boolean isUnicodeEscape(JavaToken token)
startsOnNewLineback to summary
pack-priv boolean startsOnNewLine(JavaToken token)
styleMultiLineContentback to summary
pack-priv void styleMultiLineContent(JavaToken token, int[] lineNo, StyleBuilder sb, JavaSyntaxHighlighter.AstBundle astBundle)
styleWithLinesback to summary
pack-priv void styleWithLines(StyleBuilder sb, TokenRange tokenRange, JavaSyntaxHighlighter.AstBundle astBundle)
styleWithoutLinesback to summary
pack-priv void styleWithoutLines(StyleBuilder sb, TokenRange tokenRange, JavaSyntaxHighlighter.AstBundle astBundle)
tokenAndRangeEqualback to summary
pack-priv boolean tokenAndRangeEqual(JavaToken token, Set<PositionalJavaToken> tokens)
io.github.kusoroadeolu.veneer back to summary

private final Record JavaSyntaxHighlighter.AstBundle

extends Record
Class Inheritance
Record Components
methodNames:Set<PositionalJavaToken> 
typeTokens:Set<PositionalJavaToken> 
constants:Set<PositionalJavaToken> 

Field Summary

Modifier and TypeField and Description
private final Set<PositionalJavaToken>
constants

Record Component accessed by constants().

private final Set<PositionalJavaToken>
methodNames

Record Component accessed by methodNames().

private final Set<PositionalJavaToken>
typeTokens

Record Component accessed by typeTokens().

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Set<PositionalJavaToken>
constants()

Record Component getter of constants.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public Set<PositionalJavaToken>
methodNames()

Record Component getter of methodNames.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public Set<PositionalJavaToken>
typeTokens()

Record Component getter of typeTokens.

Field Detail

constantsback to summary
private final Set<PositionalJavaToken> constants

Record Component accessed by constants().

methodNamesback to summary
private final Set<PositionalJavaToken> methodNames

Record Component accessed by methodNames().

typeTokensback to summary
private final Set<PositionalJavaToken> typeTokens

Record Component accessed by typeTokens().

Constructor Detail

AstBundleback to summary
private AstBundle(Set<PositionalJavaToken> methodNames, Set<PositionalJavaToken> typeTokens, Set<PositionalJavaToken> constants)

Method Detail

constantsback to summary
public Set<PositionalJavaToken> constants()

Record Component getter of constants.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

methodNamesback to summary
public Set<PositionalJavaToken> methodNames()

Record Component getter of methodNames.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

typeTokensback to summary
public Set<PositionalJavaToken> typeTokens()

Record Component getter of typeTokens.