j

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: MIT Imports: 2 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

View Source
var J = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "J",
		Aliases:   []string{"j"},
		Filenames: []string{"*.ijs"},
		MimeTypes: []string{"text/x-j"},
	},
	jRules,
))

J lexer.

View Source
var JSON = internal.Register(MustNewLazyLexer(
	&Config{
		Name:         "JSON",
		Aliases:      []string{"json"},
		Filenames:    []string{"*.json"},
		MimeTypes:    []string{"application/json"},
		NotMultiline: true,
		DotAll:       true,
	},
	jsonRules,
))

JSON lexer.

View Source
var JSX = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "react",
		Aliases:   []string{"jsx", "react"},
		Filenames: []string{"*.jsx", "*.react"},
		MimeTypes: []string{"text/jsx", "text/typescript-jsx"},
		DotAll:    true,
	},
	jsxRules,
))

JSX lexer.

This was generated from https://github.com/fcurella/jsx-lexer

View Source
var Java = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "Java",
		Aliases:   []string{"java"},
		Filenames: []string{"*.java"},
		MimeTypes: []string{"text/x-java"},
		DotAll:    true,
		EnsureNL:  true,
	},
	javaRules,
))

Java lexer.

View Source
var Javascript = internal.Register(MustNewLexer(
	&Config{
		Name:      "JavaScript",
		Aliases:   []string{"js", "javascript"},
		Filenames: []string{"*.js", "*.jsm", "*.mjs"},
		MimeTypes: []string{"application/javascript", "application/x-javascript", "text/x-javascript", "text/javascript"},
		DotAll:    true,
		EnsureNL:  true,
	},
	JavascriptRules,
))

Javascript lexer.

View Source
var JavascriptRules = Rules{
	"commentsandwhitespace": {
		{`\s+`, Text, nil},
		{`<!--`, Comment, nil},
		{`//.*?\n`, CommentSingle, nil},
		{`/\*.*?\*/`, CommentMultiline, nil},
	},
	"slashstartsregex": {
		Include("commentsandwhitespace"),
		{`/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gimuy]+\b|\B)`, LiteralStringRegex, Pop(1)},
		{`(?=/)`, Text, Push("#pop", "badregex")},
		Default(Pop(1)),
	},
	"badregex": {
		{`\n`, Text, Pop(1)},
	},
	"root": {
		{`\A#! ?/.*?\n`, CommentHashbang, nil},
		{`^(?=\s|/|<!--)`, Text, Push("slashstartsregex")},
		Include("commentsandwhitespace"),
		{`\d+(\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil},
		{`0[bB][01]+`, LiteralNumberBin, nil},
		{`0[oO][0-7]+`, LiteralNumberOct, nil},
		{`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
		{`[0-9][0-9_]*`, LiteralNumberInteger, nil},
		{`\.\.\.|=>`, Punctuation, nil},
		{`\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?`, Operator, Push("slashstartsregex")},
		{`[{(\[;,]`, Punctuation, Push("slashstartsregex")},
		{`[})\].]`, Punctuation, nil},
		{`(for|in|while|do|break|return|continue|switch|case|default|if|else|throw|try|catch|finally|new|delete|typeof|instanceof|void|yield|this|of)\b`, Keyword, Push("slashstartsregex")},
		{`(var|let|with|function)\b`, KeywordDeclaration, Push("slashstartsregex")},
		{`(abstract|async|await|boolean|byte|char|class|const|debugger|double|enum|export|extends|final|float|goto|implements|import|int|interface|long|native|package|private|protected|public|short|static|super|synchronized|throws|transient|volatile)\b`, KeywordReserved, nil},
		{`(true|false|null|NaN|Infinity|undefined)\b`, KeywordConstant, nil},
		{`(Array|Boolean|Date|Error|Function|Math|netscape|Number|Object|Packages|RegExp|String|Promise|Proxy|sun|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|Error|eval|isFinite|isNaN|isSafeInteger|parseFloat|parseInt|document|this|window)\b`, NameBuiltin, nil},
		{`(?:[$_\p{L}\p{N}]|\\u[a-fA-F0-9]{4})(?:(?:[$\p{L}\p{N}]|\\u[a-fA-F0-9]{4}))*`, NameOther, nil},
		{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
		{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
		{"`", LiteralStringBacktick, Push("interp")},
	},
	"interp": {
		{"`", LiteralStringBacktick, Pop(1)},
		{`\\\\`, LiteralStringBacktick, nil},
		{"\\\\`", LiteralStringBacktick, nil},
		{"\\\\[^`\\\\]", LiteralStringBacktick, nil},
		{`\$\{`, LiteralStringInterpol, Push("interp-inside")},
		{`\$`, LiteralStringBacktick, nil},
		{"[^`\\\\$]+", LiteralStringBacktick, nil},
	},
	"interp-inside": {
		{`\}`, LiteralStringInterpol, Pop(1)},
		Include("root"),
	},
}

Javascript lexer.

View Source
var Julia = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "Julia",
		Aliases:   []string{"julia", "jl"},
		Filenames: []string{"*.jl"},
		MimeTypes: []string{"text/x-julia", "application/x-julia"},
	},
	juliaRules,
))

Julia lexer.

View Source
var Jungle = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "Jungle",
		Aliases:   []string{"jungle"},
		Filenames: []string{"*.jungle"},
		MimeTypes: []string{"text/x-jungle"},
	},
	jungleRules,
))

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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