java

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package java is the Java tokenizer. lang/java registers it. Options (the switches for the intended differences from Chroma) exist only for the comparison in compat/ and are not exposed.

The token types and boundaries reproduce the rules of Chroma 2.27.0's java.xml without regular expressions. java.xml is dot_all, so . also matches a newline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lex

func Lex(src string, end int, o Options) []fh.Token

Lex splits src into tokens (with the same contract as the Lex of fasthighlight.Language). compat/ uses it to compare with Chroma, switching o.

func Prepare

func Prepare()

Prepare builds the word tables and the like (the Prepare of fasthighlight.Language).

Types

type Options

type Options struct {
	// ChromaIdent, if true, makes the name-start character [^\W\d] the same as Chroma. In regexp2,
	// the \d in [^\W\d] has no effect and it is the same as \w, so a part that starts with a digit also becomes
	// a name (a number does not get the number color). If false, it is a word character other than digits,
	// as the rule intends.
	ChromaIdent bool
}

Options holds the switches for the intended differences from Chroma. The zero value is the production setting (the one lang/java registers).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL