1
0
mirror of https://gitea.com/gitea/tea.git synced 2024-12-04 14:46:40 -05:00
tea/vendor/github.com/alecthomas/chroma/lexers/o/openscad.go
6543 89e93d90b3 Use glamour and termev to render/colorize content (#181)
Merge branch 'master' into use-glamour

select Glamour Theme based on BackgroundColor

Merge branch 'master' into use-glamour

Merge branch 'master' into use-glamour

update termev

update go.mod

label color colorate

use glamour for issue content

Vendor: Add glamour

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/181
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-09-19 16:00:50 +00:00

44 lines
1.9 KiB
Go

package o
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
var OpenSCAD = internal.Register(MustNewLexer(
&Config{
Name: "OpenSCAD",
Aliases: []string{"openscad"},
Filenames: []string{"*.scad"},
MimeTypes: []string{"text/x-scad"},
},
Rules{
"root": {
{`[^\S\n]+`, Text, nil},
{`\n`, Text, nil},
{`//(\n|[\w\W]*?[^\\]\n)`, CommentSingle, nil},
{`/(\\\n)?[*][\w\W]*?[*](\\\n)?/`, CommentMultiline, nil},
{`/(\\\n)?[*][\w\W]*`, CommentMultiline, nil},
{`[{}\[\]\(\),;:]`, Punctuation, nil},
{`[*!#%\-+=?/]`, Operator, nil},
{`<|<=|==|!=|>=|>|&&|\|\|`, Operator, nil},
{`\$(f[asn]|t|vp[rtd]|children)`, NameVariableMagic, nil},
{Words(``, `\b`, `PI`, `undef`), KeywordConstant, nil},
{`(use|include)((?:\s|\\\\s)+)`, ByGroups(KeywordNamespace, Text), Push("includes")},
{`(module)(\s*)([^\s\(]+)`, ByGroups(KeywordNamespace, Text, NameNamespace), nil},
{`(function)(\s*)([^\s\(]+)`, ByGroups(KeywordDeclaration, Text, NameFunction), nil},
{`\b(true|false)\b`, Literal, nil},
{`\b(function|module|include|use|for|intersection_for|if|else|return)\b`, Keyword, nil},
{`\b(circle|square|polygon|text|sphere|cube|cylinder|polyhedron|translate|rotate|scale|resize|mirror|multmatrix|color|offset|hull|minkowski|union|difference|intersection|abs|sign|sin|cos|tan|acos|asin|atan|atan2|floor|round|ceil|ln|log|pow|sqrt|exp|rands|min|max|concat|lookup|str|chr|search|version|version_num|norm|cross|parent_module|echo|import|import_dxf|dxf_linear_extrude|linear_extrude|rotate_extrude|surface|projection|render|dxf_cross|dxf_dim|let|assign|len)\b`, NameBuiltin, nil},
{`\bchildren\b`, NameBuiltinPseudo, nil},
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
{`-?\d+(\.\d+)?(e[+-]?\d+)?`, Number, nil},
{`[a-zA-Z_]\w*`, Name, nil},
},
"includes": {
{"(<)([^>]*)(>)", ByGroups(Punctuation, CommentPreprocFile, Punctuation), nil},
Default(Pop(1)),
},
},
))