lexers

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: MIT Imports: 27 Imported by: 400

README

Lexer tests

The tests in this directory feed a known input testdata/<name>.actual into the parser for <name> and check that its output matches <name>.exported.

Running the tests

Run the tests as normal:

go test ./lexers

Updating the existing tests

You can regenerate all the test outputs

RECORD=true go test ./lexers

Documentation

Overview

Package lexers contains the registry of all lexers.

Sub-packages contain lexer implementations.

Index

Constants

This section is empty.

Variables

View Source
var Fallback = internal.Fallback

Fallback lexer if no other is found.

View Source
var Registry = internal.Registry

Registry of Lexers.

Functions

func Analyse

func Analyse(text string) chroma.Lexer

Analyse text content and return the "best" lexer..

func Get

func Get(name string) chroma.Lexer

Get a Lexer by name, alias or file extension.

func Match

func Match(filename string) chroma.Lexer

Match returns the first lexer matching filename.

func MatchMimeType

func MatchMimeType(mimeType string) chroma.Lexer

MatchMimeType attempts to find a lexer for the given MIME type.

func Names

func Names(withAliases bool) []string

Names of all lexers, optionally including aliases.

func Register

func Register(lexer chroma.Lexer) chroma.Lexer

Register a Lexer with the global registry.

Types

This section is empty.

Directories

Path Synopsis
a
b
c
Package circular exists to break circular dependencies between lexers.
Package circular exists to break circular dependencies between lexers.
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
v
w
x
y

Jump to

Keyboard shortcuts

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