mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-23 19:11:38 +01:00
d5058b3b20
update go min version Update Vendors: * code.gitea.io/gitea-vet v0.2.0 -> v0.2.1 * code.gitea.io/sdk/gitea v0.13.0 -> v0.13.1 * github.com/AlecAivazis/survey v2.1.1 -> v2.2.2 * github.com/adrg/xdg v0.2.1 -> v0.2.2 * github.com/araddon/dateparse d820a6159ab1 -> 8aadafed4dc4 * github.com/go-git/go-git v5.1.0 -> v5.2.0 * github.com/muesli/termenv v0.7.2 -> v0.7.4 * github.com/stretchr/testify v1.5.1 -> v1.6.1 * github.com/urfave/cli v2.2.0 -> v2.3.0 Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/250 Reviewed-by: Andrew Thornton <art27@cantab.net> Reviewed-by: mrsdizzie <info@mrsdizzie.com> Co-Authored-By: 6543 <6543@noreply.gitea.io> Co-Committed-By: 6543 <6543@noreply.gitea.io>
60 lines
3.0 KiB
Go
60 lines
3.0 KiB
Go
package p
|
|
|
|
import (
|
|
. "github.com/alecthomas/chroma" // nolint
|
|
"github.com/alecthomas/chroma/lexers/internal"
|
|
)
|
|
|
|
// Pony lexer.
|
|
var Pony = internal.Register(MustNewLexer(
|
|
&Config{
|
|
Name: "Pony",
|
|
Aliases: []string{"pony"},
|
|
Filenames: []string{"*.pony"},
|
|
MimeTypes: []string{},
|
|
},
|
|
Rules{
|
|
"root": {
|
|
{`\n`, Text, nil},
|
|
{`[^\S\n]+`, Text, nil},
|
|
{`//.*\n`, CommentSingle, nil},
|
|
{`/\*`, CommentMultiline, Push("nested_comment")},
|
|
{`"""(?:.|\n)*?"""`, LiteralStringDoc, nil},
|
|
{`"`, LiteralString, Push("string")},
|
|
{`\'.*\'`, LiteralStringChar, nil},
|
|
{`=>|[]{}:().~;,|&!^?[]`, Punctuation, nil},
|
|
{Words(``, `\b`, `addressof`, `and`, `as`, `consume`, `digestof`, `is`, `isnt`, `not`, `or`), OperatorWord, nil},
|
|
{`!=|==|<<|>>|[-+/*%=<>]`, Operator, nil},
|
|
{Words(``, `\b`, `box`, `break`, `compile_error`, `compile_intrinsic`, `continue`, `do`, `else`, `elseif`, `embed`, `end`, `error`, `for`, `if`, `ifdef`, `in`, `iso`, `lambda`, `let`, `match`, `object`, `recover`, `ref`, `repeat`, `return`, `tag`, `then`, `this`, `trn`, `try`, `until`, `use`, `var`, `val`, `where`, `while`, `with`, `#any`, `#read`, `#send`, `#share`), Keyword, nil},
|
|
{`(actor|class|struct|primitive|interface|trait|type)((?:\s)+)`, ByGroups(Keyword, Text), Push("typename")},
|
|
{`(new|fun|be)((?:\s)+)`, ByGroups(Keyword, Text), Push("methodname")},
|
|
{Words(``, `\b`, `U8`, `U16`, `U32`, `U64`, `ULong`, `USize`, `U128`, `Unsigned`, `Stringable`, `String`, `StringBytes`, `StringRunes`, `InputNotify`, `InputStream`, `Stdin`, `ByteSeq`, `ByteSeqIter`, `OutStream`, `StdStream`, `SourceLoc`, `I8`, `I16`, `I32`, `I64`, `ILong`, `ISize`, `I128`, `Signed`, `Seq`, `RuntimeOptions`, `Real`, `Integer`, `SignedInteger`, `UnsignedInteger`, `FloatingPoint`, `Number`, `Int`, `ReadSeq`, `ReadElement`, `Pointer`, `Platform`, `NullablePointer`, `None`, `Iterator`, `F32`, `F64`, `Float`, `Env`, `DoNotOptimise`, `DisposableActor`, `Less`, `Equal`, `Greater`, `Compare`, `HasEq`, `Equatable`, `Comparable`, `Bool`, `AsioEventID`, `AsioEventNotify`, `AsioEvent`, `Array`, `ArrayKeys`, `ArrayValues`, `ArrayPairs`, `Any`, `AmbientAuth`), KeywordType, nil},
|
|
{`_?[A-Z]\w*`, NameClass, nil},
|
|
{`string\(\)`, NameOther, nil},
|
|
{`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+`, LiteralNumberFloat, nil},
|
|
{`0x[0-9a-fA-F]+`, LiteralNumberHex, nil},
|
|
{`\d+`, LiteralNumberInteger, nil},
|
|
{`(true|false)\b`, Keyword, nil},
|
|
{`_\d*`, Name, nil},
|
|
{`_?[a-z][\w\'_]*`, Name, nil},
|
|
},
|
|
"typename": {
|
|
{`(iso|trn|ref|val|box|tag)?((?:\s)*)(_?[A-Z]\w*)`, ByGroups(Keyword, Text, NameClass), Pop(1)},
|
|
},
|
|
"methodname": {
|
|
{`(iso|trn|ref|val|box|tag)?((?:\s)*)(_?[a-z]\w*)`, ByGroups(Keyword, Text, NameFunction), Pop(1)},
|
|
},
|
|
"nested_comment": {
|
|
{`[^*/]+`, CommentMultiline, nil},
|
|
{`/\*`, CommentMultiline, Push()},
|
|
{`\*/`, CommentMultiline, Pop(1)},
|
|
{`[*/]`, CommentMultiline, nil},
|
|
},
|
|
"string": {
|
|
{`"`, LiteralString, Pop(1)},
|
|
{`\\"`, LiteralString, nil},
|
|
{`[^\\"]+`, LiteralString, nil},
|
|
},
|
|
},
|
|
))
|