package j

import "github.com/alecthomas/chroma/lexers/j"

Index

Variables

var J = internal.Register(MustNewLexer(
	&Config{
		Name:      "J",
		Aliases:   []string{"j"},
		Filenames: []string{"*.ijs"},
		MimeTypes: []string{"text/x-j"},
	},
	Rules{
		"root": {
			{`#!.*$`, CommentPreproc, nil},
			{`NB\..*`, CommentSingle, nil},
			{`\n+\s*Note`, CommentMultiline, Push("comment")},
			{`\s*Note.*`, CommentSingle, nil},
			{`\s+`, Text, nil},
			{`'`, LiteralString, Push("singlequote")},
			{`0\s+:\s*0|noun\s+define\s*$`, NameEntity, Push("nounDefinition")},
			{`(([1-4]|13)\s+:\s*0|(adverb|conjunction|dyad|monad|verb)\s+define)\b`, NameFunction, Push("explicitDefinition")},
			{Words(``, `\b[a-zA-Z]\w*\.`, `for_`, `goto_`, `label_`), NameLabel, nil},
			{Words(``, `\.`, `assert`, `break`, `case`, `catch`, `catchd`, `catcht`, `continue`, `do`, `else`, `elseif`, `end`, `fcase`, `for`, `if`, `return`, `select`, `throw`, `try`, `while`, `whilst`), NameLabel, nil},
			{`\b[a-zA-Z]\w*`, NameVariable, nil},
			{Words(``, ``, `ARGV`, `CR`, `CRLF`, `DEL`, `Debug`, `EAV`, `EMPTY`, `FF`, `JVERSION`, `LF`, `LF2`, `Note`, `TAB`, `alpha17`, `alpha27`, `apply`, `bind`, `boxopen`, `boxxopen`, `bx`, `clear`, `cutLF`, `cutopen`, `datatype`, `def`, `dfh`, `drop`, `each`, `echo`, `empty`, `erase`, `every`, `evtloop`, `exit`, `expand`, `fetch`, `file2url`, `fixdotdot`, `fliprgb`, `getargs`, `getenv`, `hfd`, `inv`, `inverse`, `iospath`, `isatty`, `isutf8`, `items`, `leaf`, `list`, `nameclass`, `namelist`, `names`, `nc`, `nl`, `on`, `pick`, `rows`, `script`, `scriptd`, `sign`, `sminfo`, `smoutput`, `sort`, `split`, `stderr`, `stdin`, `stdout`, `table`, `take`, `timespacex`, `timex`, `tmoutput`, `toCRLF`, `toHOST`, `toJ`, `tolower`, `toupper`, `type`, `ucp`, `ucpcount`, `usleep`, `utf8`, `uucp`), NameFunction, nil},
			{`=[.:]`, Operator, nil},
			{"[-=+*#$%@!~`^&\";:.,<>{}\\[\\]\\\\|/]", Operator, nil},
			{`[abCdDeEfHiIjLMoprtT]\.`, KeywordReserved, nil},
			{`[aDiLpqsStux]\:`, KeywordReserved, nil},
			{`(_[0-9])\:`, KeywordConstant, nil},
			{`\(`, Punctuation, Push("parentheses")},
			Include("numbers"),
		},
		"comment": {
			{`[^)]`, CommentMultiline, nil},
			{`^\)`, CommentMultiline, Pop(1)},
			{`[)]`, CommentMultiline, nil},
		},
		"explicitDefinition": {
			{`\b[nmuvxy]\b`, NameDecorator, nil},
			Include("root"),
			{`[^)]`, Name, nil},
			{`^\)`, NameLabel, Pop(1)},
			{`[)]`, Name, nil},
		},
		"numbers": {
			{`\b_{1,2}\b`, LiteralNumber, nil},
			{`_?\d+(\.\d+)?(\s*[ejr]\s*)_?\d+(\.?=\d+)?`, LiteralNumber, nil},
			{`_?\d+\.(?=\d+)`, LiteralNumberFloat, nil},
			{`_?\d+x`, LiteralNumberIntegerLong, nil},
			{`_?\d+`, LiteralNumberInteger, nil},
		},
		"nounDefinition": {
			{`[^)]`, LiteralString, nil},
			{`^\)`, NameLabel, Pop(1)},
			{`[)]`, LiteralString, nil},
		},
		"parentheses": {
			{`\)`, Punctuation, Pop(1)},
			Include("explicitDefinition"),
			Include("root"),
		},
		"singlequote": {
			{`[^']`, LiteralString, nil},
			{`''`, LiteralString, nil},
			{`'`, LiteralString, Pop(1)},
		},
	},
))

J lexer.

var JSON = internal.Register(MustNewLexer(
	&Config{
		Name:         "JSON",
		Aliases:      []string{"json"},
		Filenames:    []string{"*.json"},
		MimeTypes:    []string{"application/json"},
		NotMultiline: true,
		DotAll:       true,
	},
	Rules{
		"whitespace": {
			{`\s+`, Text, nil},
		},
		"simplevalue": {
			{`(true|false|null)\b`, KeywordConstant, nil},
			{`-?(0|[1-9]\d*)(\.\d+[eE](\+|-)?\d+|[eE](\+|-)?\d+|\.\d+)`, LiteralNumberFloat, nil},
			{`-?(0|[1-9]\d*)`, LiteralNumberInteger, nil},
			{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
		},
		"objectattribute": {
			Include("value"),
			{`:`, Punctuation, nil},
			{`,`, Punctuation, Pop(1)},
			{`\}`, Punctuation, Pop(2)},
		},
		"objectvalue": {
			Include("whitespace"),
			{`"(\\\\|\\"|[^"])*"`, NameTag, Push("objectattribute")},
			{`\}`, Punctuation, Pop(1)},
		},
		"arrayvalue": {
			Include("whitespace"),
			Include("value"),
			{`,`, Punctuation, nil},
			{`\]`, Punctuation, Pop(1)},
		},
		"value": {
			Include("whitespace"),
			Include("simplevalue"),
			{`\{`, Punctuation, Push("objectvalue")},
			{`\[`, Punctuation, Push("arrayvalue")},
		},
		"root": {
			Include("value"),
		},
	},
))

JSON lexer.

var JSX = internal.Register(MustNewLexer(
	&Config{
		Name:      "react",
		Aliases:   []string{"jsx", "react"},
		Filenames: []string{"*.jsx", "*.react"},
		MimeTypes: []string{"text/jsx", "text/typescript-jsx"},
		DotAll:    true,
	},
	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": {
			Include("jsx"),
			{`\A#! ?/.*?\n`, CommentHashbang, nil},
			{`^(?=\s|/|<!--)`, Text, Push("slashstartsregex")},
			Include("commentsandwhitespace"),
			{`(\.\d+|[0-9]+\.[0-9]*)([eE][-+]?[0-9]+)?`, LiteralNumberFloat, nil},
			{`0[bB][01]+`, LiteralNumberBin, nil},
			{`0[oO][0-7]+`, LiteralNumberOct, nil},
			{`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
			{`[0-9]+`, LiteralNumberInteger, nil},
			{`\.\.\.|=>`, Punctuation, nil},
			{`\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?`, Operator, Push("slashstartsregex")},
			{`[{(\[;,]`, Punctuation, Push("slashstartsregex")},
			{`[})\].]`, Punctuation, nil},
			{"" /* 143 byte string literal not displayed */, Keyword, Push("slashstartsregex")},
			{`(var|let|with|function)\b`, KeywordDeclaration, Push("slashstartsregex")},
			{"" /* 232 byte string literal not displayed */, KeywordReserved, nil},
			{`(true|false|null|NaN|Infinity|undefined)\b`, KeywordConstant, nil},
			{"" /* 247 byte string literal not displayed */, NameBuiltin, nil},
			{"" /* 18803 byte string literal not displayed */, NameOther, nil},
			{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
			{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
			{"`", LiteralStringBacktick, Push("interp")},
		},
		"interp": {
			{"`", LiteralStringBacktick, Pop(1)},
			{`\\\\`, LiteralStringBacktick, nil},
			{"\\\\`", LiteralStringBacktick, nil},
			{`\$\{`, LiteralStringInterpol, Push("interp-inside")},
			{`\$`, LiteralStringBacktick, nil},
			{"[^`\\\\$]+", LiteralStringBacktick, nil},
		},
		"interp-inside": {
			{`\}`, LiteralStringInterpol, Pop(1)},
			Include("root"),
		},
		"jsx": {
			{`(<)([\w]+)`, ByGroups(Punctuation, NameTag), Push("tag")},
			{`(<)(/)([\w]+)(>)`, ByGroups(Punctuation, Punctuation, NameTag, Punctuation), nil},
		},
		"tag": {
			{`\s+`, Text, nil},
			{`([\w]+\s*)(=)(\s*)`, ByGroups(NameAttribute, Operator, Text), Push("attr")},
			{`[{}]+`, Punctuation, nil},
			{`[\w\.]+`, NameAttribute, nil},
			{`(/?)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation), Pop(1)},
		},
		"attr": {
			{`{`, Punctuation, Push("expression")},
			{`".*?"`, LiteralString, Pop(1)},
			{`'.*?'`, LiteralString, Pop(1)},
			Default(Pop(1)),
		},
		"expression": {
			{`{`, Punctuation, Push()},
			{`}`, Punctuation, Pop(1)},
			Include("root"),
		},
	},
))

JSX lexer.

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

var Java = internal.Register(MustNewLexer(
	&Config{
		Name:      "Java",
		Aliases:   []string{"java"},
		Filenames: []string{"*.java"},
		MimeTypes: []string{"text/x-java"},
		DotAll:    true,
	},
	Rules{
		"root": {
			{`[^\S\n]+`, Text, nil},
			{`//.*?\n`, CommentSingle, nil},
			{`/\*.*?\*/`, CommentMultiline, nil},
			{`(assert|break|case|catch|continue|default|do|else|finally|for|if|goto|instanceof|new|return|switch|this|throw|try|while)\b`, Keyword, nil},
			{`((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)((?:[^\W\d]|\$)[\w$]*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil},
			{`@[^\W\d][\w.]*`, NameDecorator, nil},
			{"" /* 143 byte string literal not displayed */, KeywordDeclaration, nil},
			{`(boolean|byte|char|double|float|int|long|short|void)\b`, KeywordType, nil},
			{`(package)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")},
			{`(true|false|null)\b`, KeywordConstant, nil},
			{`(class|interface)(\s+)`, ByGroups(KeywordDeclaration, Text), Push("class")},
			{`(import(?:\s+static)?)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")},
			{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
			{`'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'`, LiteralStringChar, nil},
			{`(\.)((?:[^\W\d]|\$)[\w$]*)`, ByGroups(Operator, NameAttribute), nil},
			{`^\s*([^\W\d]|\$)[\w$]*:`, NameLabel, nil},
			{`([^\W\d]|\$)[\w$]*`, Name, nil},
			{"" /* 270 byte string literal not displayed */, LiteralNumberFloat, nil},
			{`0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?`, LiteralNumberHex, nil},
			{`0[bB][01][01_]*[lL]?`, LiteralNumberBin, nil},
			{`0[0-7_]+[lL]?`, LiteralNumberOct, nil},
			{`0|[1-9][0-9_]*[lL]?`, LiteralNumberInteger, nil},
			{`[~^*!%&\[\](){}<>|+=:;,./?-]`, Operator, nil},
			{`\n`, Text, nil},
		},
		"class": {
			{`([^\W\d]|\$)[\w$]*`, NameClass, Pop(1)},
		},
		"import": {
			{`[\w.]+\*?`, NameNamespace, Pop(1)},
		},
	},
))

Java lexer.

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

Javascript lexer.

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+|[0-9]+\.[0-9]*)([eE][-+]?[0-9]+)?`, LiteralNumberFloat, nil},
		{`0[bB][01]+`, LiteralNumberBin, nil},
		{`0[oO][0-7]+`, LiteralNumberOct, nil},
		{`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
		{`[0-9]+`, LiteralNumberInteger, nil},
		{`\.\.\.|=>`, Punctuation, nil},
		{`\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?`, Operator, Push("slashstartsregex")},
		{`[{(\[;,]`, Punctuation, Push("slashstartsregex")},
		{`[})\].]`, Punctuation, nil},
		{"" /* 143 byte string literal not displayed */, Keyword, Push("slashstartsregex")},
		{`(var|let|with|function)\b`, KeywordDeclaration, Push("slashstartsregex")},
		{"" /* 232 byte string literal not displayed */, KeywordReserved, nil},
		{`(true|false|null|NaN|Infinity|undefined)\b`, KeywordConstant, nil},
		{"" /* 247 byte string literal not displayed */, NameBuiltin, nil},
		{"" /* 18803 byte string literal not displayed */, NameOther, nil},
		{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
		{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
		{"`", LiteralStringBacktick, Push("interp")},
	},
	"interp": {
		{"`", LiteralStringBacktick, Pop(1)},
		{`\\\\`, LiteralStringBacktick, nil},
		{"\\\\`", LiteralStringBacktick, nil},
		{`\$\{`, LiteralStringInterpol, Push("interp-inside")},
		{`\$`, LiteralStringBacktick, nil},
		{"[^`\\\\$]+", LiteralStringBacktick, nil},
	},
	"interp-inside": {
		{`\}`, LiteralStringInterpol, Pop(1)},
		Include("root"),
	},
}

Javascript lexer.

var Julia = internal.Register(MustNewLexer(
	&Config{
		Name:      "Julia",
		Aliases:   []string{"julia", "jl"},
		Filenames: []string{"*.jl"},
		MimeTypes: []string{"text/x-julia", "application/x-julia"},
	},
	Rules{
		"root": {
			{`\n`, Text, nil},
			{`[^\S\n]+`, Text, nil},
			{`#=`, CommentMultiline, Push("blockcomment")},
			{`#.*$`, Comment, nil},
			{`[\[\]{}(),;]`, Punctuation, nil},
			{`in\b`, KeywordPseudo, nil},
			{`isa\b`, KeywordPseudo, nil},
			{`(true|false)\b`, KeywordConstant, nil},
			{`(local|global|const)\b`, KeywordDeclaration, nil},
			{Words(``, `\b`, `function`, `abstract type`, `primitive type`, `baremodule`, `begin`, `bitstype`, `break`, `catch`, `ccall`, `continue`, `do`, `else`, `elseif`, `end`, `export`, `finally`, `for`, `if`, `import`, `let`, `macro`, `module`, `mutable`, `quote`, `return`, `struct`, `try`, `using`, `while`), Keyword, nil},
			{Words(``, `\b`, `ASCIIString`, `AbstractArray`, `AbstractChannel`, `AbstractDict`, `AbstractFloat`, `AbstractMatrix`, `AbstractRNG`, `AbstractSparseArray`, `AbstractSparseMatrix`, `AbstractSparseVector`, `AbstractString`, `AbstractVecOrMat`, `AbstractVector`, `Any`, `ArgumentError`, `Array`, `AssertionError`, `Base64DecodePipe`, `Base64EncodePipe`, `Bidiagonal`, `BigFloat`, `BigInt`, `BitArray`, `BitMatrix`, `BitVector`, `Bool`, `BoundsError`, `Box`, `BufferStream`, `CapturedException`, `CartesianIndex`, `CartesianRange`, `Cchar`, `Cdouble`, `Cfloat`, `Channel`, `Char`, `Cint`, `Cintmax_t`, `Clong`, `Clonglong`, `ClusterManager`, `Cmd`, `Coff_t`, `Colon`, `Complex`, `Complex128`, `Complex32`, `Complex64`, `CompositeException`, `Condition`, `Cptrdiff_t`, `Cshort`, `Csize_t`, `Cssize_t`, `Cstring`, `Cuchar`, `Cuint`, `Cuintmax_t`, `Culong`, `Culonglong`, `Cushort`, `Cwchar_t`, `Cwstring`, `DataType`, `Date`, `DateTime`, `DenseArray`, `DenseMatrix`, `DenseVecOrMat`, `DenseVector`, `Diagonal`, `Dict`, `DimensionMismatch`, `Dims`, `DirectIndexString`, `Display`, `DivideError`, `DomainError`, `EOFError`, `EachLine`, `Enum`, `Enumerate`, `ErrorException`, `Exception`, `Expr`, `Factorization`, `FileMonitor`, `FileOffset`, `Filter`, `Float16`, `Float32`, `Float64`, `FloatRange`, `Function`, `GenSym`, `GlobalRef`, `GotoNode`, `HTML`, `Hermitian`, `IO`, `IOBuffer`, `IOStream`, `IPv4`, `IPv6`, `InexactError`, `InitError`, `Int`, `Int128`, `Int16`, `Int32`, `Int64`, `Int8`, `IntSet`, `Integer`, `InterruptException`, `IntrinsicFunction`, `InvalidStateException`, `Irrational`, `KeyError`, `LabelNode`, `LambdaStaticData`, `LinSpace`, `LineNumberNode`, `LoadError`, `LocalProcess`, `LowerTriangular`, `MIME`, `Matrix`, `MersenneTwister`, `Method`, `MethodError`, `MethodTable`, `Module`, `NTuple`, `NewvarNode`, `NullException`, `Nullable`, `Number`, `ObjectIdDict`, `OrdinalRange`, `OutOfMemoryError`, `OverflowError`, `Pair`, `ParseError`, `PartialQuickSort`, `Pipe`, `PollingFileWatcher`, `ProcessExitedException`, `ProcessGroup`, `Ptr`, `QuoteNode`, `RandomDevice`, `Range`, `Rational`, `RawFD`, `ReadOnlyMemoryError`, `Real`, `ReentrantLock`, `Ref`, `Regex`, `RegexMatch`, `RemoteException`, `RemoteRef`, `RepString`, `RevString`, `RopeString`, `RoundingMode`, `SegmentationFault`, `SerializationState`, `Set`, `SharedArray`, `SharedMatrix`, `SharedVector`, `Signed`, `SimpleVector`, `SparseMatrixCSC`, `StackOverflowError`, `StatStruct`, `StepRange`, `StridedArray`, `StridedMatrix`, `StridedVecOrMat`, `StridedVector`, `SubArray`, `SubString`, `SymTridiagonal`, `Symbol`, `SymbolNode`, `Symmetric`, `SystemError`, `TCPSocket`, `Task`, `Text`, `TextDisplay`, `Timer`, `TopNode`, `Tridiagonal`, `Tuple`, `Type`, `TypeConstructor`, `TypeError`, `TypeName`, `TypeVar`, `UDPSocket`, `UInt`, `UInt128`, `UInt16`, `UInt32`, `UInt64`, `UInt8`, `UTF16String`, `UTF32String`, `UTF8String`, `UndefRefError`, `UndefVarError`, `UnicodeError`, `UniformScaling`, `Union`, `UnitRange`, `Unsigned`, `UpperTriangular`, `Val`, `Vararg`, `VecOrMat`, `Vector`, `VersionNumber`, `Void`, `WString`, `WeakKeyDict`, `WeakRef`, `WorkerConfig`, `Zip`), KeywordType, nil},
			{Words(``, `\b`, `ARGS`, `CPU_CORES`, `C_NULL`, `DevNull`, `ENDIAN_BOM`, `ENV`, `I`, `Inf`, `Inf16`, `Inf32`, `Inf64`, `InsertionSort`, `JULIA_HOME`, `LOAD_PATH`, `MergeSort`, `NaN`, `NaN16`, `NaN32`, `NaN64`, `OS_NAME`, `QuickSort`, `RoundDown`, `RoundFromZero`, `RoundNearest`, `RoundNearestTiesAway`, `RoundNearestTiesUp`, `RoundToZero`, `RoundUp`, `STDERR`, `STDIN`, `STDOUT`, `VERSION`, `WORD_SIZE`, `catalan`, `e`, `eu`, `eulergamma`, `golden`, `im`, `nothing`, `pi`, `γ`, `π`, `φ`), NameBuiltin, nil},
			{Words(``, ``, `=`, `:=`, `+=`, `-=`, `*=`, `/=`, `//=`, `.//=`, `.*=`, `./=`, `\=`, `.\=`, `^=`, `.^=`, `÷=`, `.÷=`, `%=`, `.%=`, `|=`, `&=`, `$=`, `=>`, `<<=`, `>>=`, `>>>=`, `~`, `.+=`, `.-=`, `?`, `--`, `-->`, `||`, `&&`, `>`, `<`, `>=`, `≥`, `<=`, `≤`, `==`, `===`, `≡`, `!=`, `≠`, `!==`, `≢`, `.>`, `.<`, `.>=`, `.≥`, `.<=`, `.≤`, `.==`, `.!=`, `.≠`, `.=`, `.!`, `<:`, `>:`, `∈`, `∉`, `∋`, `∌`, `⊆`, `⊈`, `⊂`, `⊄`, `⊊`, `|>`, `<|`, `:`, `+`, `-`, `.+`, `.-`, `|`, `∪`, `$`, `<<`, `>>`, `>>>`, `.<<`, `.>>`, `.>>>`, `*`, `/`, `./`, `÷`, `.÷`, `%`, `⋅`, `.%`, `.*`, `\`, `.\`, `&`, `∩`, `//`, `.//`, `^`, `.^`, `::`, `.`, `+`, `-`, `!`, `√`, `∛`, `∜`), Operator, nil},
			{`'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'`, LiteralStringChar, nil},
			{`(?<=[.\w)\]])\'+`, Operator, nil},
			{`"""`, LiteralString, Push("tqstring")},
			{`"`, LiteralString, Push("string")},
			{`r"""`, LiteralStringRegex, Push("tqregex")},
			{`r"`, LiteralStringRegex, Push("regex")},
			{"`", LiteralStringBacktick, Push("command")},
			{`((?:[a-zA-Z_¡-￿]|[𐀀-􏿿])(?:[a-zA-Z_0-9¡-￿]|[𐀀-􏿿])*!*)(')?`, ByGroups(Name, Operator), nil},
			{`(@(?:[a-zA-Z_¡-￿]|[𐀀-􏿿])(?:[a-zA-Z_0-9¡-￿]|[𐀀-􏿿])*!*)(')?`, ByGroups(NameDecorator, Operator), nil},
			{`(\d+(_\d+)+\.\d*|\d*\.\d+(_\d+)+)([eEf][+-]?[0-9]+)?`, LiteralNumberFloat, nil},
			{`(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?`, LiteralNumberFloat, nil},
			{`\d+(_\d+)+[eEf][+-]?[0-9]+`, LiteralNumberFloat, nil},
			{`\d+[eEf][+-]?[0-9]+`, LiteralNumberFloat, nil},
			{`0b[01]+(_[01]+)+`, LiteralNumberBin, nil},
			{`0b[01]+`, LiteralNumberBin, nil},
			{`0o[0-7]+(_[0-7]+)+`, LiteralNumberOct, nil},
			{`0o[0-7]+`, LiteralNumberOct, nil},
			{`0x[a-fA-F0-9]+(_[a-fA-F0-9]+)+`, LiteralNumberHex, nil},
			{`0x[a-fA-F0-9]+`, LiteralNumberHex, nil},
			{`\d+(_\d+)+`, LiteralNumberInteger, nil},
			{`\d+`, LiteralNumberInteger, nil},
		},
		"blockcomment": {
			{`[^=#]`, CommentMultiline, nil},
			{`#=`, CommentMultiline, Push()},
			{`=#`, CommentMultiline, Pop(1)},
			{`[=#]`, CommentMultiline, nil},
		},
		"string": {
			{`"`, LiteralString, Pop(1)},
			{`\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)`, LiteralStringEscape, nil},
			{`\$(?:[a-zA-Z_¡-￿]|[𐀀-􏿿])(?:[a-zA-Z_0-9¡-￿]|[𐀀-􏿿])*!*`, LiteralStringInterpol, nil},
			{`(\$)(\()`, ByGroups(LiteralStringInterpol, Punctuation), Push("in-intp")},
			{`%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]`, LiteralStringInterpol, nil},
			{`.|\s`, LiteralString, nil},
		},
		"tqstring": {
			{`"""`, LiteralString, Pop(1)},
			{`\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)`, LiteralStringEscape, nil},
			{`\$(?:[a-zA-Z_¡-￿]|[𐀀-􏿿])(?:[a-zA-Z_0-9¡-￿]|[𐀀-􏿿])*!*`, LiteralStringInterpol, nil},
			{`(\$)(\()`, ByGroups(LiteralStringInterpol, Punctuation), Push("in-intp")},
			{`.|\s`, LiteralString, nil},
		},
		"regex": {
			{`"`, LiteralStringRegex, Pop(1)},
			{`\\"`, LiteralStringRegex, nil},
			{`.|\s`, LiteralStringRegex, nil},
		},
		"tqregex": {
			{`"""`, LiteralStringRegex, Pop(1)},
			{`.|\s`, LiteralStringRegex, nil},
		},
		"command": {
			{"`", LiteralStringBacktick, Pop(1)},
			{`\$(?:[a-zA-Z_¡-￿]|[𐀀-􏿿])(?:[a-zA-Z_0-9¡-￿]|[𐀀-􏿿])*!*`, LiteralStringInterpol, nil},
			{`(\$)(\()`, ByGroups(LiteralStringInterpol, Punctuation), Push("in-intp")},
			{`.|\s`, LiteralStringBacktick, nil},
		},
		"in-intp": {
			{`\(`, Punctuation, Push()},
			{`\)`, Punctuation, Pop(1)},
			Include("root"),
		},
	},
))

Julia lexer.

var Jungle = internal.Register(MustNewLexer(
	&Config{
		Name:      "Jungle",
		Aliases:   []string{"jungle"},
		Filenames: []string{"*.jungle"},
		MimeTypes: []string{"text/x-jungle"},
	},
	Rules{
		"root": {
			{`[^\S\n]+`, Text, nil},
			{`\n`, Text, nil},
			{`#(\n|[\w\W]*?[^#]\n)`, CommentSingle, nil},
			{`^(?=\S)`, None, Push("instruction")},
			{`[\.;\[\]\(\)\$]`, Punctuation, nil},
			{`[a-zA-Z_]\w*`, Name, nil},
		},
		"instruction": {
			{`[^\S\n]+`, Text, nil},
			{`=`, Operator, Push("value")},
			{`(?=\S)`, None, Push("var")},
			Default(Pop(1)),
		},
		"value": {
			{`[^\S\n]+`, Text, nil},
			{`\$\(`, Punctuation, Push("var")},
			{`[;\[\]\(\)\$]`, Punctuation, nil},
			{`#(\n|[\w\W]*?[^#]\n)`, CommentSingle, nil},
			{`[\w_\-\.\/\\]+`, Text, nil},
			Default(Pop(1)),
		},
		"var": {
			{`[^\S\n]+`, Text, nil},
			{`\b(((re)?source|barrel)Path|excludeAnnotations|annotations|lang)\b`, NameBuiltin, nil},
			{`\bbase\b`, NameConstant, nil},
			{`\b(ind|zsm|hrv|ces|dan|dut|eng|fin|fre|deu|gre|hun|ita|nob|po[lr]|rus|sl[ov]|spa|swe|ara|heb|zh[st]|jpn|kor|tha|vie|bul|tur)`, NameConstant, nil},
			{`\b((semi)?round|rectangle)(-\d+x\d+)?\b`, NameConstant, nil},
			{`[\.;\[\]\(\$]`, Punctuation, nil},
			{`\)`, Punctuation, Pop(1)},
			{`[a-zA-Z_]\w*`, Name, nil},
			Default(Pop(1)),
		},
	},
))

Source Files

j.go java.go javascript.go json.go jsx.go julia.go jungle.go

Version
v0.7.1
Published
Jan 2, 2020
Platform
js/wasm
Imports
2 packages
Last checked
3 minutes ago

Tools for package owners.