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

public Class BibTeXSyntaxHighlighter

extends AbstractSyntaxHighlighter
Class Inheritance
Imports
io.github.kusoroadeolu.clique.Clique, io.github.kusoroadeolu.clique.style.StyleBuilder, io.github.kusoroadeolu.veneer.theme.SyntaxTheme, io.github.kusoroadeolu.veneer.utils.Constants, .Utils, org.antlr.v4.runtime.BufferedTokenStream, .CharStreams, .Token, java.util.ArrayList, .List

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record
public static enum

Field Summary

Inherited from io.github.kusoroadeolu.veneer.AbstractSyntaxHighlighter:
showLineNumberstheme

Constructor Summary

AccessConstructor and Description
public
public
BibTeXSyntaxHighlighter(boolean showLineNumbers)

public
public
BibTeXSyntaxHighlighter(SyntaxTheme theme, boolean showLineNumbers)

Method Summary

Modifier and TypeMethod and Description
private void
private void
private void
applyStyles(Token token, StyleBuilder sb, List<Token> tokens, int index)

private void
private void
private BibTeXSyntaxHighlighter.BibTeXTokenCategory
classify(Token token, List<Token> tokens, int index)

public List<BibTeXSyntaxHighlighter.BibTeXHighlightRegion>

Returns:

a list of non-overlapping highlight regions covering the source, ordered by their start offset
computeHighlightRegions
(String
the BibTeX source to analyze
s
)

Computes highlight regions (start/end offsets + category) without producing ANSI-styled output.

public String
highlight(String s)

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

Highlights the given Java source string.

pack-priv boolean
pack-priv boolean
isCiteKey(Token token, List<Token> tokens, int index)

pack-priv boolean
pack-priv boolean
isFieldName(Token token, List<Token> tokens, int index)

pack-priv boolean
pack-priv boolean
pack-priv boolean
isName(Token token)

pack-priv boolean
isNumber(Token token)

pack-priv boolean
isString(Token token)

private Token
nextDefaultToken(List<Token> tokens, int index)

private Token
previousDefaultToken(List<Token> tokens, int index)

Constructor Detail

BibTeXSyntaxHighlighterback to summary
public BibTeXSyntaxHighlighter()
BibTeXSyntaxHighlighterback to summary
public BibTeXSyntaxHighlighter(boolean showLineNumbers)
BibTeXSyntaxHighlighterback to summary
public BibTeXSyntaxHighlighter(SyntaxTheme theme)
BibTeXSyntaxHighlighterback to summary
public BibTeXSyntaxHighlighter(SyntaxTheme theme, boolean showLineNumbers)

Method Detail

appendBraceStringback to summary
private void appendBraceString(String text, StyleBuilder sb)
appendCiteKeyback to summary
private void appendCiteKey(String text, StyleBuilder sb)
applyStylesback to summary
private void applyStyles(Token token, StyleBuilder sb, List<Token> tokens, int index)
applyWithLinesback to summary
private void applyWithLines(StyleBuilder sb, BufferedTokenStream tokenStream)
applyWithoutLinesback to summary
private void applyWithoutLines(StyleBuilder sb, BufferedTokenStream tokenStream)
classifyback to summary
private BibTeXSyntaxHighlighter.BibTeXTokenCategory classify(Token token, List<Token> tokens, int index)
computeHighlightRegionsback to summary
public List<BibTeXSyntaxHighlighter.BibTeXHighlightRegion> computeHighlightRegions(String s)

Computes highlight regions (start/end offsets + category) without producing ANSI-styled output. Useful for consumers (e.g. GUI text editors) that need to apply their own styling mechanism (CSS classes, text attributes, etc.) instead of ANSI escape codes.

Parameters
s:String

the BibTeX source to analyze

Returns:List<BibTeXSyntaxHighlighter.BibTeXHighlightRegion>

a list of non-overlapping highlight regions covering the source, ordered by their start offset

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
isBraceStringback to summary
pack-priv boolean isBraceString(Token token)
isCiteKeyback to summary
pack-priv boolean isCiteKey(Token token, List<Token> tokens, int index)
isCommentback to summary
pack-priv boolean isComment(Token token)
isFieldNameback to summary
pack-priv boolean isFieldName(Token token, List<Token> tokens, int index)
isKeywordback to summary
pack-priv boolean isKeyword(Token token)
isMultiLineTokenback to summary
pack-priv boolean isMultiLineToken(Token token)
isNameback to summary
pack-priv boolean isName(Token token)
isNumberback to summary
pack-priv boolean isNumber(Token token)
isStringback to summary
pack-priv boolean isString(Token token)
nextDefaultTokenback to summary
private Token nextDefaultToken(List<Token> tokens, int index)
previousDefaultTokenback to summary
private Token previousDefaultToken(List<Token> tokens, int index)
io.github.kusoroadeolu.veneer back to summary

public final Record BibTeXSyntaxHighlighter.BibTeXHighlightRegion

extends Record
Class Inheritance
Record Components
start:int 
end:int 
category:BibTeXSyntaxHighlighter.BibTeXTokenCategory 

Field Summary

Modifier and TypeField and Description
private final BibTeXSyntaxHighlighter.BibTeXTokenCategory
category

Record Component accessed by category().

private final int
end

Record Component accessed by end().

private final int
start

Record Component accessed by start().

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public BibTeXSyntaxHighlighter.BibTeXTokenCategory
category()

Record Component getter of category.

public int
end()

Record Component getter of end.

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 int
start()

Record Component getter of start.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

categoryback to summary
private final BibTeXSyntaxHighlighter.BibTeXTokenCategory category

Record Component accessed by category().

endback to summary
private final int end

Record Component accessed by end().

startback to summary
private final int start

Record Component accessed by start().

Constructor Detail

BibTeXHighlightRegionback to summary
public BibTeXHighlightRegion(int start, int end, BibTeXSyntaxHighlighter.BibTeXTokenCategory category)

Method Detail

categoryback to summary
public BibTeXSyntaxHighlighter.BibTeXTokenCategory category()

Record Component getter of category.

endback to summary
public int end()

Record Component getter of end.

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.

startback to summary
public int start()

Record Component getter of start.

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.

io.github.kusoroadeolu.veneer back to summary

public final Enum BibTeXSyntaxHighlighter.BibTeXTokenCategory

extends Enum<BibTeXSyntaxHighlighter.BibTeXTokenCategory>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static BibTeXSyntaxHighlighter.BibTeXTokenCategory
public static BibTeXSyntaxHighlighter.BibTeXTokenCategory[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CITE_KEYback to summary
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory CITE_KEY
COMMENTback to summary
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory COMMENT
DEFAULTback to summary
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory DEFAULT
FIELD_NAMEback to summary
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory FIELD_NAME
KEYWORDback to summary
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory KEYWORD
MACROback to summary
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory MACRO
NUMBERback to summary
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory NUMBER
STRINGback to summary
public static final BibTeXSyntaxHighlighter.BibTeXTokenCategory STRING

Constructor Detail

BibTeXTokenCategoryback to summary
private BibTeXTokenCategory()

Method Detail

valueOfback to summary
public static BibTeXSyntaxHighlighter.BibTeXTokenCategory valueOf(String name)
valuesback to summary
public static BibTeXSyntaxHighlighter.BibTeXTokenCategory[] values()