processor

package
v0.0.0-...-11c9596 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2014 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Main controller package for syntax highlighting

Index

Constants

View Source
const (
	MAJOR_RAW TypeMajor = iota
	MAJOR_COMMENT
	MAJOR_STRING
	MAJOR_ERROR
	MAJOR_GENERIC
	MAJOR_KEYWORD
	MAJOR_NAME
	MAJOR_NUMBER
	MAJOR_VARIABLE
	MAJOR_OPERATOR
	MINOR_RAW TypeMinor = iota
	MINOR_NAME_TAG
	MINOR_NAME_ATTRIBUTE
)

These are the allowed token types

Variables

This section is empty.

Functions

func Highlight

func Highlight(inputfilter, outputfilter string, source []byte) (string, error)

Run the given input and output filters on the source and return a string of the highlighted input source and nil or, if there is an error, a perhaps empty string and an error.

func InputFilters

func InputFilters() []string

Return a list of available input filters.

func OutputFilters

func OutputFilters() []string

Return a list of available output filters.

func RegisterInputFilter

func RegisterInputFilter(name string, f HighlightFunc)

All lexers are required to call this function exactly once.

func RegisterOutputFilter

func RegisterOutputFilter(name string, f RenderFunc)

All output filters are required to call this function exactly once.

func RegisterSanitizer

func RegisterSanitizer(name string, f FilterFunc)

Types

type FilterFunc

type FilterFunc func(chan Token, chan Token)

type HighlightFunc

type HighlightFunc func([]byte, chan Token)

type RenderFunc

type RenderFunc func(chan Token, chan string)

type Token

type Token struct {
	Major TypeMajor
	Minor TypeMinor
	Value string
}

This is the basic data structure in the intermediate format between the input filter and output filter.

type TypeMajor

type TypeMajor int

type TypeMinor

type TypeMinor int

Jump to

Keyboard shortcuts

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