package g
import "github.com/alecthomas/chroma/lexers/g"
Index ¶
Variables ¶
var GDScript = internal.Register(MustNewLexer( &Config{ Name: "GDScript", Aliases: []string{"gdscript", "gd"}, Filenames: []string{"*.gd"}, MimeTypes: []string{"text/x-gdscript", "application/x-gdscript"}, }, Rules{ "root": { {`\n`, Text, nil}, {`^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringAffix, LiteralStringDoc), nil}, {`^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')`, ByGroups(Text, LiteralStringAffix, LiteralStringDoc), nil}, {`[^\S\n]+`, Text, nil}, {`#.*$`, CommentSingle, nil}, {`[]{}:(),;[]`, Punctuation, nil}, {`\\\n`, Text, nil}, {`\\`, Text, nil}, {`(in|and|or|not)\b`, OperatorWord, nil}, {`!=|==|<<|>>|&&|\+=|-=|\*=|/=|%=|&=|\|=|\|\||[-~+/*%=<>&^.!|$]`, Operator, nil}, Include("keywords"), {`(def)((?:\s|\\\s)+)`, ByGroups(Keyword, Text), Push("funcname")}, {`(class)((?:\s|\\\s)+)`, ByGroups(Keyword, Text), Push("classname")}, Include("builtins"), {`([rR]|[uUbB][rR]|[rR][uUbB])(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("tdqs")}, {`([rR]|[uUbB][rR]|[rR][uUbB])(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("tsqs")}, {`([rR]|[uUbB][rR]|[rR][uUbB])(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("dqs")}, {`([rR]|[uUbB][rR]|[rR][uUbB])(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("sqs")}, {`([uUbB]?)(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("stringescape", "tdqs")}, {`([uUbB]?)(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("stringescape", "tsqs")}, {`([uUbB]?)(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("stringescape", "dqs")}, {`([uUbB]?)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("stringescape", "sqs")}, Include("name"), Include("numbers"), }, "keywords": { {Words(``, `\b`, `if`, `elif`, `else`, `for`, `do`, `while`, `switch`, `case`, `break`, `continue`, `pass`, `return`, `class`, `extends`, `tool`, `signal`, `func`, `static`, `const`, `enum`, `var`, `onready`, `export`, `setget`, `breakpoint`), Keyword, nil}, }, "builtins": { {Words(`(?<!\.)`, `\b`, `Color8`, `ColorN`, `abs`, `acos`, `asin`, `assert`, `atan`, `atan2`, `bytes2var`, `ceil`, `clamp`, `convert`, `cos`, `cosh`, `db2linear`, `decimals`, `dectime`, `deg2rad`, `dict2inst`, `ease`, `exp`, `floor`, `fmod`, `fposmod`, `funcref`, `hash`, `inst2dict`, `instance_from_id`, `is_inf`, `is_nan`, `lerp`, `linear2db`, `load`, `log`, `max`, `min`, `nearest_po2`, `pow`, `preload`, `print`, `print_stack`, `printerr`, `printraw`, `prints`, `printt`, `rad2deg`, `rand_range`, `rand_seed`, `randf`, `randi`, `randomize`, `range`, `round`, `seed`, `sign`, `sin`, `sinh`, `sqrt`, `stepify`, `str`, `str2var`, `tan`, `tanh`, `type_exist`, `typeof`, `var2bytes`, `var2str`, `weakref`, `yield`, ), NameBuiltin, nil}, {`(?<!\.)(self|false|true|PI|NAN|INF)\b`, NameBuiltinPseudo, nil}, {Words(`(?<!\.)`, `\b`, `AABB`, `AcceptDialog`, `AnimatedSprite`, `AnimatedSprite3D`, `Animation`, `AnimationPlayer`, `AnimationTreePlayer`, `Area`, `Area2D`, `Array`, `AtlasTexture`, `AudioServer`, `AudioServerSW`, `AudioStream`, `AudioStreamMPC`, `AudioStreamOGGVorbis`, `AudioStreamOpus`, `AudioStreamPlayback`, `AudioStreamSpeex`, `BackBufferCopy`, `BakedLight`, `BakedLightInstance`, `BakedLightSampler`, `BaseButton`, `BitMap`, `BoneAttachment`, `bool`, `BoxContainer`, `BoxShape`, `Button`, `ButtonArray`, `ButtonGroup`, `Camera`, `Camera2D`, `CanvasItem`, `CanvasItemMaterial`, `CanvasItemShader`, `CanvasItemShaderGraph`, `CanvasLayer`, `CanvasModulate`, `CapsuleShape`, `CapsuleShape2D`, `CenterContainer`, `CheckBox`, `CheckButton`, `CircleShape2D`, `CollisionObject`, `CollisionObject2D`, `CollisionPolygon`, `CollisionPolygon2D`, `CollisionShape`, `CollisionShape2D`, `Color`, `ColorArray`, `ColorPicker`, `ColorPickerButton`, `ColorRamp`, `ConcavePolygonShape`, `ConcavePolygonShape2D`, `ConeTwistJoint`, `ConfigFile`, `ConfirmationDialog`, `Container`, `Control`, `ConvexPolygonShape`, `ConvexPolygonShape2D`, `CubeMap`, `Curve2D`, `Curve3D`, `DampedSpringJoint2D`, `Dictionary`, `DirectionalLight`, `Directory`, `EditorFileDialog`, `EditorImportPlugin`, `EditorPlugin`, `EditorScenePostImport`, `EditorScript`, `Environment`, `EventPlayer`, `EventStream`, `EventStreamChibi`, `File`, `FileDialog`, `FixedMaterial`, `float`, `Font`, `FuncRef`, `GDFunctionState`, `GDNativeClass`, `GDScript`, `Generic6DOFJoint`, `Geometry`, `GeometryInstance`, `Globals`, `GraphEdit`, `GraphNode`, `GridContainer`, `GridMap`, `GrooveJoint2D`, `HBoxContainer`, `HButtonArray`, `HingeJoint`, `HScrollBar`, `HSeparator`, `HSlider`, `HSplitContainer`, `HTTPClient`, `Image`, `ImageTexture`, `ImmediateGeometry`, `Input`, `InputDefault`, `InputEvent`, `InputEventAction`, `InputEventJoystickButton`, `InputEventJoystickMotion`, `InputEventKey`, `InputEventMouseButton`, `InputEventMouseMotion`, `InputEventScreenDrag`, `InputEventScreenTouch`, `InputMap`, `InstancePlaceholder`, `int`, `IntArray`, `InterpolatedCamera`, `IP`, `IP_Unix`, `ItemList`, `Joint`, `Joint2D`, `KinematicBody`, `KinematicBody2D`, `Label`, `LargeTexture`, `Light`, `Light2D`, `LightOccluder2D`, `LineEdit`, `LineShape2D`, `MainLoop`, `MarginContainer`, `Marshalls`, `Material`, `MaterialShader`, `MaterialShaderGraph`, `Matrix3`, `Matrix32`, `MenuButton`, `Mesh`, `MeshDataTool`, `MeshInstance`, `MeshLibrary`, `MultiMesh`, `MultiMeshInstance`, `Mutex`, `Navigation`, `Navigation2D`, `NavigationMesh`, `NavigationMeshInstance`, `NavigationPolygon`, `NavigationPolygonInstance`, `Nil`, `Node`, `Node2D`, `NodePath`, `Object`, `OccluderPolygon2D`, `OmniLight`, `OptionButton`, `OS`, `PackedDataContainer`, `PackedDataContainerRef`, `PackedScene`, `PacketPeer`, `PacketPeerStream`, `PacketPeerUDP`, `Panel`, `PanelContainer`, `ParallaxBackground`, `ParallaxLayer`, `ParticleAttractor2D`, `Particles`, `Particles2D`, `Patch9Frame`, `Path`, `Path2D`, `PathFollow`, `PathFollow2D`, `PathRemap`, `PCKPacker`, `Performance`, `PHashTranslation`, `Physics2DDirectBodyState`, `Physics2DDirectBodyStateSW`, `Physics2DDirectSpaceState`, `Physics2DServer`, `Physics2DServerSW`, `Physics2DShapeQueryParameters`, `Physics2DShapeQueryResult`, `Physics2DTestMotionResult`, `PhysicsBody`, `PhysicsBody2D`, `PhysicsDirectBodyState`, `PhysicsDirectBodyStateSW`, `PhysicsDirectSpaceState`, `PhysicsServer`, `PhysicsServerSW`, `PhysicsShapeQueryParameters`, `PhysicsShapeQueryResult`, `PinJoint`, `PinJoint2D`, `Plane`, `PlaneShape`, `Polygon2D`, `PolygonPathFinder`, `Popup`, `PopupDialog`, `PopupMenu`, `PopupPanel`, `Portal`, `Position2D`, `Position3D`, `ProgressBar`, `ProximityGroup`, `Quad`, `Quat`, `Range`, `RawArray`, `RayCast`, `RayCast2D`, `RayShape`, `RayShape2D`, `RealArray`, `Rect2`, `RectangleShape2D`, `Reference`, `ReferenceFrame`, `RegEx`, `RemoteTransform2D`, `RenderTargetTexture`, `Resource`, `ResourceImportMetadata`, `ResourceInteractiveLoader`, `ResourceLoader`, `ResourcePreloader`, `ResourceSaver`, `RichTextLabel`, `RID`, `RigidBody`, `RigidBody2D`, `Room`, `RoomBounds`, `Sample`, `SampleLibrary`, `SamplePlayer`, `SamplePlayer2D`, `SceneState`, `SceneTree`, `Script`, `ScrollBar`, `ScrollContainer`, `SegmentShape2D`, `Semaphore`, `Separator`, `Shader`, `ShaderGraph`, `ShaderMaterial`, `Shape`, `Shape2D`, `Skeleton`, `Slider`, `SliderJoint`, `SoundPlayer2D`, `SoundRoomParams`, `Spatial`, `SpatialPlayer`, `SpatialSamplePlayer`, `SpatialSound2DServer`, `SpatialSound2DServerSW`, `SpatialSoundServer`, `SpatialSoundServerSW`, `SpatialStreamPlayer`, `SphereShape`, `SpinBox`, `SplitContainer`, `SpotLight`, `Sprite`, `Sprite3D`, `SpriteBase3D`, `SpriteFrames`, `StaticBody`, `StaticBody2D`, `StreamPeer`, `StreamPeerSSL`, `StreamPeerTCP`, `StreamPlayer`, `String`, `StringArray`, `StyleBox`, `StyleBoxEmpty`, `StyleBoxFlat`, `StyleBoxImageMask`, `StyleBoxTexture`, `SurfaceTool`, `TabContainer`, `Tabs`, `TCP_Server`, `TestCube`, `TextEdit`, `Texture`, `TextureButton`, `TextureFrame`, `TextureProgress`, `Theme`, `Thread`, `TileMap`, `TileSet`, `Timer`, `ToolButton`, `TouchScreenButton`, `Transform`, `Translation`, `TranslationServer`, `Tree`, `TreeItem`, `Tween`, `UndoRedo`, `VBoxContainer`, `VButtonArray`, `Vector2`, `Vector2Array`, `Vector3`, `Vector3Array`, `VehicleBody`, `VehicleWheel`, `VideoPlayer`, `VideoStream`, `VideoStreamTheora`, `Viewport`, `ViewportSprite`, `VisibilityEnabler`, `VisibilityEnabler2D`, `VisibilityNotifier`, `VisibilityNotifier2D`, `VisualInstance`, `VisualServer`, `VScrollBar`, `VSeparator`, `VSlider`, `VSplitContainer`, `WeakRef`, `WindowDialog`, `World`, `World2D`, `WorldEnvironment`, `XMLParser`, `YSort`), NameException, nil}, }, "numbers": { {`(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?`, LiteralNumberFloat, nil}, {`\d+[eE][+-]?[0-9]+j?`, LiteralNumberFloat, nil}, {`0[xX][a-fA-F0-9]+`, LiteralNumberHex, nil}, {`\d+j?`, LiteralNumberInteger, nil}, }, "name": { {`[a-zA-Z_]\w*`, Name, nil}, }, "funcname": { {`[a-zA-Z_]\w*`, NameFunction, Pop(1)}, Default(Pop(1)), }, "classname": { {`[a-zA-Z_]\w*`, NameClass, Pop(1)}, }, "stringescape": { {`\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})`, LiteralStringEscape, nil}, }, "strings-single": { {`%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]`, LiteralStringInterpol, nil}, {`[^\\\'"%\n]+`, LiteralStringSingle, nil}, {`[\'"\\]`, LiteralStringSingle, nil}, {`%`, LiteralStringSingle, nil}, }, "strings-double": { {`%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]`, LiteralStringInterpol, nil}, {`[^\\\'"%\n]+`, LiteralStringDouble, nil}, {`[\'"\\]`, LiteralStringDouble, nil}, {`%`, LiteralStringDouble, nil}, }, "dqs": { {`"`, LiteralStringDouble, Pop(1)}, {`\\\\|\\"|\\\n`, LiteralStringEscape, nil}, Include("strings-double"), }, "sqs": { {`'`, LiteralStringSingle, Pop(1)}, {`\\\\|\\'|\\\n`, LiteralStringEscape, nil}, Include("strings-single"), }, "tdqs": { {`"""`, LiteralStringDouble, Pop(1)}, Include("strings-double"), {`\n`, LiteralStringDouble, nil}, }, "tsqs": { {`'''`, LiteralStringSingle, Pop(1)}, Include("strings-single"), {`\n`, LiteralStringSingle, nil}, }, }, ))
GDScript lexer.
var GLSL = internal.Register(MustNewLexer( &Config{ Name: "GLSL", Aliases: []string{"glsl"}, Filenames: []string{"*.vert", "*.frag", "*.geo"}, MimeTypes: []string{"text/x-glslsrc"}, }, Rules{ "root": { {`^#.*`, CommentPreproc, nil}, {`//.*`, CommentSingle, nil}, {`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil}, {`\+|-|~|!=?|\*|/|%|<<|>>|<=?|>=?|==?|&&?|\^|\|\|?`, Operator, nil}, {`[?:]`, Operator, nil}, {`\bdefined\b`, Operator, nil}, {`[;{}(),\[\]]`, Punctuation, nil}, {`[+-]?\d*\.\d+([eE][-+]?\d+)?`, LiteralNumberFloat, nil}, {`[+-]?\d+\.\d*([eE][-+]?\d+)?`, LiteralNumberFloat, nil}, {`0[xX][0-9a-fA-F]*`, LiteralNumberHex, nil}, {`0[0-7]*`, LiteralNumberOct, nil}, {`[1-9][0-9]*`, LiteralNumberInteger, nil}, {Words(`\b`, `\b`, `attribute`, `const`, `uniform`, `varying`, `centroid`, `break`, `continue`, `do`, `for`, `while`, `if`, `else`, `in`, `out`, `inout`, `float`, `int`, `void`, `bool`, `true`, `false`, `invariant`, `discard`, `return`, `mat2`, `mat3mat4`, `mat2x2`, `mat3x2`, `mat4x2`, `mat2x3`, `mat3x3`, `mat4x3`, `mat2x4`, `mat3x4`, `mat4x4`, `vec2`, `vec3`, `vec4`, `ivec2`, `ivec3`, `ivec4`, `bvec2`, `bvec3`, `bvec4`, `sampler1D`, `sampler2D`, `sampler3DsamplerCube`, `sampler1DShadow`, `sampler2DShadow`, `struct`), Keyword, nil}, {Words(`\b`, `\b`, `asm`, `class`, `union`, `enum`, `typedef`, `template`, `this`, `packed`, `goto`, `switch`, `default`, `inline`, `noinline`, `volatile`, `public`, `static`, `extern`, `external`, `interface`, `long`, `short`, `double`, `half`, `fixed`, `unsigned`, `lowp`, `mediump`, `highp`, `precision`, `input`, `output`, `hvec2`, `hvec3`, `hvec4`, `dvec2`, `dvec3`, `dvec4`, `fvec2`, `fvec3`, `fvec4`, `sampler2DRect`, `sampler3DRect`, `sampler2DRectShadow`, `sizeof`, `cast`, `namespace`, `using`), Keyword, nil}, {`[a-zA-Z_]\w*`, Name, nil}, {`\.`, Punctuation, nil}, {`\s+`, Text, nil}, }, }, ))
GLSL lexer.
var Gas = internal.Register(MustNewLexer( &Config{ Name: "GAS", Aliases: []string{"gas", "asm"}, Filenames: []string{"*.s", "*.S"}, MimeTypes: []string{"text/x-gas"}, }, Rules{ "root": { Include("whitespace"), {`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+):`, NameLabel, nil}, {`\.(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameAttribute, Push("directive-args")}, {`lock|rep(n?z)?|data\d+`, NameAttribute, nil}, {`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameFunction, Push("instruction-args")}, {`[\r\n]+`, Text, nil}, }, "directive-args": { {`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameConstant, nil}, {`"(\\"|[^"])*"`, LiteralString, nil}, {`@(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameAttribute, nil}, {`(?:0[xX][a-zA-Z0-9]+|\d+)`, LiteralNumberInteger, nil}, {`[\r\n]+`, Text, Pop(1)}, Include("punctuation"), Include("whitespace"), }, "instruction-args": { {`([a-z0-9]+)( )(<)((?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+))(>)`, ByGroups(LiteralNumberHex, Text, Punctuation, NameConstant, Punctuation), nil}, {`([a-z0-9]+)( )(<)((?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+))([-+])((?:0[xX][a-zA-Z0-9]+|\d+))(>)`, ByGroups(LiteralNumberHex, Text, Punctuation, NameConstant, Punctuation, LiteralNumberInteger, Punctuation), nil}, {`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameConstant, nil}, {`(?:0[xX][a-zA-Z0-9]+|\d+)`, LiteralNumberInteger, nil}, {`%(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameVariable, nil}, {`$(?:0[xX][a-zA-Z0-9]+|\d+)`, LiteralNumberInteger, nil}, {`$'(.|\\')'`, LiteralStringChar, nil}, {`[\r\n]+`, Text, Pop(1)}, Include("punctuation"), Include("whitespace"), }, "whitespace": { {`\n`, Text, nil}, {`\s+`, Text, nil}, {`[;#].*?\n`, Comment, nil}, }, "punctuation": { {`[-*,.()\[\]!:]+`, Punctuation, nil}, }, }, ))
Gas lexer.
var Genshi = internal.Register(MustNewLexer( &Config{ Name: "Genshi", Aliases: []string{"genshi", "kid", "xml+genshi", "xml+kid"}, Filenames: []string{"*.kid"}, MimeTypes: []string{"application/x-genshi", "application/x-kid"}, NotMultiline: true, DotAll: true, }, genshiMarkupRules, ))
Genshi lexer.
var GenshiHTMLTemplate = internal.Register(MustNewLexer( &Config{ Name: "Genshi HTML", Aliases: []string{"html+genshi", "html+kid"}, Filenames: []string{}, MimeTypes: []string{"text/html+genshi"}, NotMultiline: true, DotAll: true, }, genshiMarkupRules, ))
Html+Genshi lexer.
var GenshiText = internal.Register(MustNewLexer( &Config{ Name: "Genshi Text", Aliases: []string{"genshitext"}, Filenames: []string{}, MimeTypes: []string{"application/x-genshi-text", "text/x-genshi"}, }, Rules{ "root": { {`[^#$\s]+`, Other, nil}, {`^(\s*)(##.*)$`, ByGroups(Text, Comment), nil}, {`^(\s*)(#)`, ByGroups(Text, CommentPreproc), Push("directive")}, Include("variable"), {`[#$\s]`, Other, nil}, }, "directive": { {`\n`, Text, Pop(1)}, {`(?:def|for|if)\s+.*`, Using(Python), Pop(1)}, {`(choose|when|with)([^\S\n]+)(.*)`, ByGroups(Keyword, Text, Using(Python)), Pop(1)}, {`(choose|otherwise)\b`, Keyword, Pop(1)}, {`(end\w*)([^\S\n]*)(.*)`, ByGroups(Keyword, Text, Comment), Pop(1)}, }, "variable": { {`(?<!\$)(\$\{)(.+?)(\})`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil}, {`(?<!\$)(\$)([a-zA-Z_][\w.]*)`, NameVariable, nil}, }, }, ))
Genshi Text lexer.
var Gnuplot = internal.Register(MustNewLexer( &Config{ Name: "Gnuplot", Aliases: []string{"gnuplot"}, Filenames: []string{"*.plot", "*.plt"}, MimeTypes: []string{"text/x-gnuplot"}, }, Rules{ "root": { Include("whitespace"), {`bind\b|bin\b|bi\b`, Keyword, Push("bind")}, {`exit\b|exi\b|ex\b|quit\b|qui\b|qu\b|q\b`, Keyword, Push("quit")}, {`fit\b|fi\b|f\b`, Keyword, Push("fit")}, {`(if)(\s*)(\()`, ByGroups(Keyword, Text, Punctuation), Push("if")}, {`else\b`, Keyword, nil}, {`pause\b|paus\b|pau\b|pa\b`, Keyword, Push("pause")}, {`plot\b|plo\b|pl\b|p\b|replot\b|replo\b|repl\b|rep\b|splot\b|splo\b|spl\b|sp\b`, Keyword, Push("plot")}, {`save\b|sav\b|sa\b`, Keyword, Push("save")}, {`set\b|se\b`, Keyword, Push("genericargs", "optionarg")}, {`show\b|sho\b|sh\b|unset\b|unse\b|uns\b`, Keyword, Push("noargs", "optionarg")}, {"" /* 446 byte string literal not displayed */, Keyword, Push("genericargs")}, {"" /* 167 byte string literal not displayed */, Keyword, Push("noargs")}, {`([a-zA-Z_]\w*)(\s*)(=)`, ByGroups(NameVariable, Text, Operator), Push("genericargs")}, {`([a-zA-Z_]\w*)(\s*\(.*?\)\s*)(=)`, ByGroups(NameFunction, Text, Operator), Push("genericargs")}, {`@[a-zA-Z_]\w*`, NameConstant, nil}, {`;`, Keyword, nil}, }, "comment": { {`[^\\\n]`, Comment, nil}, {`\\\n`, Comment, nil}, {`\\`, Comment, nil}, Default(Pop(1)), }, "whitespace": { {`#`, Comment, Push("comment")}, {`[ \t\v\f]+`, Text, nil}, }, "noargs": { Include("whitespace"), {`;`, Punctuation, Pop(1)}, {`\n`, Text, Pop(1)}, }, "dqstring": { {`"`, LiteralString, Pop(1)}, {`\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})`, LiteralStringEscape, nil}, {`[^\\"\n]+`, LiteralString, nil}, {`\\\n`, LiteralString, nil}, {`\\`, LiteralString, nil}, {`\n`, LiteralString, Pop(1)}, }, "sqstring": { {`''`, LiteralString, nil}, {`'`, LiteralString, Pop(1)}, {`[^\\'\n]+`, LiteralString, nil}, {`\\\n`, LiteralString, nil}, {`\\`, LiteralString, nil}, {`\n`, LiteralString, Pop(1)}, }, "genericargs": { Include("noargs"), {`"`, LiteralString, Push("dqstring")}, {`'`, LiteralString, Push("sqstring")}, {`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+`, LiteralNumberFloat, nil}, {`(\d+\.\d*|\.\d+)`, LiteralNumberFloat, nil}, {`-?\d+`, LiteralNumberInteger, nil}, {`[,.~!%^&*+=|?:<>/-]`, Operator, nil}, {`[{}()\[\]]`, Punctuation, nil}, {`(eq|ne)\b`, OperatorWord, nil}, {`([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(NameFunction, Text, Punctuation), nil}, {`[a-zA-Z_]\w*`, Name, nil}, {`@[a-zA-Z_]\w*`, NameConstant, nil}, {`\\\n`, Text, nil}, }, "optionarg": { Include("whitespace"), {"" /* 5359 byte string literal not displayed */, NameBuiltin, Pop(1)}, }, "bind": { {`!`, Keyword, Pop(1)}, {`allwindows\b|allwindow\b|allwindo\b|allwind\b|allwin\b|allwi\b|allw\b|all\b`, NameBuiltin, nil}, Include("genericargs"), }, "quit": { {`gnuplot\b`, Keyword, nil}, Include("noargs"), }, "fit": { {`via\b`, NameBuiltin, nil}, Include("plot"), }, "if": { {`\)`, Punctuation, Pop(1)}, Include("genericargs"), }, "pause": { {`(mouse|any|button1|button2|button3)\b`, NameBuiltin, nil}, {`keypress\b|keypres\b|keypre\b|keypr\b|keyp\b|key\b`, NameBuiltin, nil}, Include("genericargs"), }, "plot": { {"" /* 316 byte string literal not displayed */, NameBuiltin, nil}, Include("genericargs"), }, "save": { {"" /* 220 byte string literal not displayed */, NameBuiltin, nil}, Include("genericargs"), }, }, ))
Gnuplot lexer.
var Go = internal.Register(MustNewLexer( &Config{ Name: "Go", Aliases: []string{"go", "golang"}, Filenames: []string{"*.go"}, MimeTypes: []string{"text/x-gosrc"}, }, Rules{ "root": { {`\n`, Text, nil}, {`\s+`, Text, nil}, {`\\\n`, Text, nil}, {`//(.*?)\n`, CommentSingle, nil}, {`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil}, {`(import|package)\b`, KeywordNamespace, nil}, {`(var|func|struct|map|chan|type|interface|const)\b`, KeywordDeclaration, nil}, {Words(``, `\b`, `break`, `default`, `select`, `case`, `defer`, `go`, `else`, `goto`, `switch`, `fallthrough`, `if`, `range`, `continue`, `for`, `return`), Keyword, nil}, {`(true|false|iota|nil)\b`, KeywordConstant, nil}, {Words(``, `\b(\()`, `uint`, `uint8`, `uint16`, `uint32`, `uint64`, `int`, `int8`, `int16`, `int32`, `int64`, `float`, `float32`, `float64`, `complex64`, `complex128`, `byte`, `rune`, `string`, `bool`, `error`, `uintptr`, `print`, `println`, `panic`, `recover`, `close`, `complex`, `real`, `imag`, `len`, `cap`, `append`, `copy`, `delete`, `new`, `make`), ByGroups(NameBuiltin, Punctuation), nil}, {Words(``, `\b`, `uint`, `uint8`, `uint16`, `uint32`, `uint64`, `int`, `int8`, `int16`, `int32`, `int64`, `float`, `float32`, `float64`, `complex64`, `complex128`, `byte`, `rune`, `string`, `bool`, `error`, `uintptr`), KeywordType, nil}, {`\d+i`, LiteralNumber, nil}, {`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil}, {`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil}, {`\d+[Ee][-+]\d+i`, LiteralNumber, nil}, {`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil}, {`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil}, {`0[0-7]+`, LiteralNumberOct, nil}, {`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil}, {`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil}, {`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil}, {"(`)([^`]*)(`)", ByGroups(LiteralString, Using(TypeRemappingLexer(GoTextTemplate, TypeMapping{{Other, LiteralString, nil}})), LiteralString), nil}, {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, {`(<<=|>>=|<<|>>|<=|>=|&\^=|&\^|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\||<-|\+\+|--|==|!=|:=|\.\.\.|[+\-*/%&])`, Operator, nil}, {`([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(NameFunction, UsingSelf("root"), Punctuation), nil}, {`[|^<>=!()\[\]{}.,;:]`, Punctuation, nil}, {`[^\W\d]\w*`, NameOther, nil}, }, }, ).SetAnalyser(func(text string) float32 { if strings.Contains(text, "fmt.") && strings.Contains(text, "package ") { return 0.5 } if strings.Contains(text, "package ") { return 0.1 } return 0.0 }))
Go lexer.
var GoHTMLTemplate = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( &Config{ Name: "Go HTML Template", Aliases: []string{"go-html-template"}, }, goTemplateRules, )))
var GoTextTemplate = internal.Register(MustNewLexer( &Config{ Name: "Go Text Template", Aliases: []string{"go-text-template"}, }, goTemplateRules, ))
var Graphql = internal.Register(MustNewLexer( &Config{ Name: "GraphQL", Aliases: []string{"graphql", "graphqls", "gql"}, Filenames: []string{"*.graphql", "*.graphqls"}, }, Rules{ "root": { {`(query|mutation|subscription|fragment|scalar|implements|interface|union|enum|input|type)`, KeywordDeclaration, Push("type")}, {`(on|extend|schema|directive|\.\.\.)`, KeywordDeclaration, nil}, {"" /* 217 byte string literal not displayed */, KeywordConstant, nil}, {`[^\W\d]\w*`, NameProperty, nil}, {`\@\w+`, NameDecorator, nil}, {`:`, Punctuation, Push("type")}, {`[\(\)\{\}\[\],!\|=]`, Punctuation, nil}, {`\$\w+`, NameVariable, nil}, {`\d+i`, LiteralNumber, nil}, {`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil}, {`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil}, {`\d+[Ee][-+]\d+i`, LiteralNumber, nil}, {`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil}, {`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil}, {`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil}, {`"""[\x00-\x7F]*?"""`, LiteralString, nil}, {`"(\\["\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])"`, LiteralStringChar, nil}, {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, {`"(true|false|null)*"`, Literal, nil}, {`[\r\n\s]+`, Whitespace, nil}, {`#[^\r\n]*`, Comment, nil}, }, "type": { {`[^\W\d]\w*`, NameClass, Pop(1)}, Include("root"), }, }, ))
Go lexer.
var Groovy = internal.Register(MustNewLexer( &Config{ Name: "Groovy", Aliases: []string{"groovy"}, Filenames: []string{"*.groovy", "*.gradle"}, MimeTypes: []string{"text/x-groovy"}, DotAll: true, }, Rules{ "root": { {`#!(.*?)$`, CommentPreproc, Push("base")}, Default(Push("base")), }, "base": { {`^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil}, {`[^\S\n]+`, Text, nil}, {`//.*?\n`, CommentSingle, nil}, {`/\*.*?\*/`, CommentMultiline, nil}, {`@[a-zA-Z_][\w.]*`, NameDecorator, nil}, {"" /* 136 byte string literal not displayed */, Keyword, nil}, {"" /* 143 byte string literal not displayed */, KeywordDeclaration, nil}, {`(def|boolean|byte|char|double|float|int|long|short|void)\b`, KeywordType, nil}, {`(package)(\s+)`, ByGroups(KeywordNamespace, Text), nil}, {`(true|false|null)\b`, KeywordConstant, nil}, {`(class|interface)(\s+)`, ByGroups(KeywordDeclaration, Text), Push("class")}, {`(import)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")}, {`""".*?"""`, LiteralStringDouble, nil}, {`'''.*?'''`, LiteralStringSingle, nil}, {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, {`\$/((?!/\$).)*/\$`, LiteralString, nil}, {`/(\\\\|\\"|[^/])*/`, LiteralString, nil}, {`'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'`, LiteralStringChar, nil}, {`(\.)([a-zA-Z_]\w*)`, ByGroups(Operator, NameAttribute), nil}, {`[a-zA-Z_]\w*:`, NameLabel, nil}, {`[a-zA-Z_$]\w*`, Name, nil}, {`[~^*!%&\[\](){}<>|+=:;,./?-]`, Operator, nil}, {`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil}, {`0x[0-9a-fA-F]+`, LiteralNumberHex, nil}, {`[0-9]+L?`, LiteralNumberInteger, nil}, {`\n`, Text, nil}, }, "class": { {`[a-zA-Z_]\w*`, NameClass, Pop(1)}, }, "import": { {`[\w.]+\*?`, NameNamespace, Pop(1)}, }, }, ))
Groovy lexer.
Source Files ¶
gas.go gdscript.go genshi.go glsl.go gnuplot.go go.go graphql.go groovy.go
- Version
- v0.6.8
- Published
- Oct 24, 2019
- Platform
- js/wasm
- Imports
- 5 packages
- Last checked
- 8 minutes ago –
Tools for package owners.