Bump dependencies
- chroma/v2: v2.20.0 → v2.21.1 - go-pkgz/auth/v2: v2.1.0 → v2.1.1 - go-pkgz/rest: v1.20.4 → v1.20.6 - golang.org/x/* packages to latest Also exclude "meaningless package names" revive warning in linter config.
This commit is contained in:
@@ -48,6 +48,9 @@ linters:
|
||||
- linters:
|
||||
- revive
|
||||
text: 'package-comments: should have a package comment'
|
||||
- linters:
|
||||
- revive
|
||||
text: 'var-naming: avoid meaningless package names'
|
||||
- linters:
|
||||
- dupl
|
||||
- gosec
|
||||
|
||||
@@ -13,12 +13,12 @@ require (
|
||||
require (
|
||||
github.com/Depado/bfchroma/v2 v2.0.0 // indirect
|
||||
github.com/PuerkitoBio/goquery v1.11.0 // indirect
|
||||
github.com/alecthomas/chroma/v2 v2.20.0 // indirect
|
||||
github.com/alecthomas/chroma/v2 v2.21.1 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.3 // indirect
|
||||
github.com/aymerick/douceur v0.2.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dlclark/regexp2 v1.11.5 // indirect
|
||||
github.com/go-pkgz/rest v1.20.4 // indirect
|
||||
github.com/go-pkgz/rest v1.20.6 // indirect
|
||||
github.com/go-pkgz/routegroup v1.6.0 // indirect
|
||||
github.com/gorilla/css v1.0.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
@@ -30,10 +30,10 @@ require (
|
||||
github.com/rs/xid v1.6.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
go.etcd.io/bbolt v1.4.3 // indirect
|
||||
golang.org/x/crypto v0.45.0 // indirect
|
||||
golang.org/x/image v0.33.0 // indirect
|
||||
golang.org/x/net v0.47.0 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
golang.org/x/crypto v0.46.0 // indirect
|
||||
golang.org/x/image v0.34.0 // indirect
|
||||
golang.org/x/net v0.48.0 // indirect
|
||||
golang.org/x/sys v0.39.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ github.com/PuerkitoBio/goquery v1.11.0 h1:jZ7pwMQXIITcUXNH83LLk+txlaEy6NVOfTuP43
|
||||
github.com/PuerkitoBio/goquery v1.11.0/go.mod h1:wQHgxUOU3JGuj3oD/QFfxUdlzW6xPHfqyHre6VMY4DQ=
|
||||
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
|
||||
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
|
||||
github.com/alecthomas/chroma/v2 v2.20.0 h1:sfIHpxPyR07/Oylvmcai3X/exDlE8+FA820NTz+9sGw=
|
||||
github.com/alecthomas/chroma/v2 v2.20.0/go.mod h1:e7tViK0xh/Nf4BYHl00ycY6rV7b8iXBksI9E359yNmA=
|
||||
github.com/alecthomas/repr v0.5.1 h1:E3G4t2QbHTSNpPKBgMTln5KLkZHLOcU7r37J4pXBuIg=
|
||||
github.com/alecthomas/repr v0.5.1/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
|
||||
github.com/alecthomas/chroma/v2 v2.21.1 h1:FaSDrp6N+3pphkNKU6HPCiYLgm8dbe5UXIXcoBhZSWA=
|
||||
github.com/alecthomas/chroma/v2 v2.21.1/go.mod h1:NqVhfBR0lte5Ouh3DcthuUCTUpDC9cxBOfyMbMQPs3o=
|
||||
github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs=
|
||||
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
|
||||
github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM=
|
||||
github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA=
|
||||
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
|
||||
@@ -21,8 +21,8 @@ github.com/go-pkgz/jrpc v0.4.0 h1:oD7xiGrzDkndkuCjeHGugQXxbggLSV7O1QmHhoc5pYY=
|
||||
github.com/go-pkgz/jrpc v0.4.0/go.mod h1:JFoY3bRjRyx4M3CbEVDFQStMB1m2gmQ7OjqFK7q3kOo=
|
||||
github.com/go-pkgz/lgr v0.12.1 h1:8GVfG2rSARq3Eaj5PP158rtBR2LHVGkwioIkQBGbvKg=
|
||||
github.com/go-pkgz/lgr v0.12.1/go.mod h1:A4AxjOthFVFK6jRnVYMeusno5SeDAxcLVHd0kI/lN/Y=
|
||||
github.com/go-pkgz/rest v1.20.4 h1:8ufcP1IqoDhCvIFdXPtvyX4HSS16SM6THBe2a6L0/kg=
|
||||
github.com/go-pkgz/rest v1.20.4/go.mod h1:2/LEZGndSxpVvExsMn48AjUgiTn6kILqjpoaRnl62JU=
|
||||
github.com/go-pkgz/rest v1.20.6 h1:O/IhQ3I2cS4bJYvL1TLcy63w2OcXZTTBG3R+wTIqPS4=
|
||||
github.com/go-pkgz/rest v1.20.6/go.mod h1:NY+MX1is2kJckJt+nHDNovS/5j9jmF4yQuSno4qg7XU=
|
||||
github.com/go-pkgz/routegroup v1.6.0 h1:44XHZgF6JIIldRlv+zjg6SygULASmjifnfIQjwCT0e4=
|
||||
github.com/go-pkgz/routegroup v1.6.0/go.mod h1:Pmu04fhgWhRtBMIJ8HXppnnzOPjnL/IEPBIdO2zmeqg=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
@@ -62,10 +62,10 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
|
||||
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
|
||||
golang.org/x/image v0.33.0 h1:LXRZRnv1+zGd5XBUVRFmYEphyyKJjQjCRiOuAP3sZfQ=
|
||||
golang.org/x/image v0.33.0/go.mod h1:DD3OsTYT9chzuzTQt+zMcOlBHgfoKQb1gry8p76Y1sc=
|
||||
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
|
||||
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
|
||||
golang.org/x/image v0.34.0 h1:33gCkyw9hmwbZJeZkct8XyR11yH889EQt/QH4VmXMn8=
|
||||
golang.org/x/image v0.34.0/go.mod h1:2RNFBZRB+vnwwFil8GkMdRvrJOFd1AzdZI6vOY+eJVU=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
@@ -80,8 +80,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
|
||||
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
|
||||
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
|
||||
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -89,8 +89,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
|
||||
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@@ -102,8 +102,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
|
||||
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
|
||||
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
|
||||
+10
-10
@@ -5,17 +5,17 @@ go 1.25
|
||||
require (
|
||||
github.com/Depado/bfchroma/v2 v2.0.0
|
||||
github.com/PuerkitoBio/goquery v1.11.0
|
||||
github.com/alecthomas/chroma/v2 v2.20.0
|
||||
github.com/alecthomas/chroma/v2 v2.21.1
|
||||
github.com/didip/tollbooth/v8 v8.0.1
|
||||
github.com/go-chi/chi/v5 v5.2.3
|
||||
github.com/go-chi/cors v1.2.2
|
||||
github.com/go-pkgz/auth/v2 v2.1.0
|
||||
github.com/go-pkgz/auth/v2 v2.1.1
|
||||
github.com/go-pkgz/jrpc v0.4.0
|
||||
github.com/go-pkgz/lcw/v2 v2.0.0
|
||||
github.com/go-pkgz/lgr v0.12.1
|
||||
github.com/go-pkgz/notify v1.3.0
|
||||
github.com/go-pkgz/repeater/v2 v2.2.0
|
||||
github.com/go-pkgz/rest v1.20.4
|
||||
github.com/go-pkgz/rest v1.20.6
|
||||
github.com/go-pkgz/syncs v1.3.2
|
||||
github.com/golang-jwt/jwt/v5 v5.3.0
|
||||
github.com/google/uuid v1.6.0
|
||||
@@ -30,9 +30,9 @@ require (
|
||||
github.com/stretchr/testify v1.11.1
|
||||
go.etcd.io/bbolt v1.4.3
|
||||
go.uber.org/goleak v1.3.0
|
||||
golang.org/x/crypto v0.45.0
|
||||
golang.org/x/image v0.33.0
|
||||
golang.org/x/net v0.47.0
|
||||
golang.org/x/crypto v0.46.0
|
||||
golang.org/x/image v0.34.0
|
||||
golang.org/x/net v0.48.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -65,9 +65,9 @@ require (
|
||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
|
||||
go.mongodb.org/mongo-driver v1.17.6 // indirect
|
||||
golang.org/x/oauth2 v0.33.0 // indirect
|
||||
golang.org/x/sync v0.18.0 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
golang.org/x/text v0.31.0 // indirect
|
||||
golang.org/x/oauth2 v0.34.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/sys v0.39.0 // indirect
|
||||
golang.org/x/text v0.32.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
+22
-22
@@ -8,10 +8,10 @@ github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
|
||||
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
|
||||
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
|
||||
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
|
||||
github.com/alecthomas/chroma/v2 v2.20.0 h1:sfIHpxPyR07/Oylvmcai3X/exDlE8+FA820NTz+9sGw=
|
||||
github.com/alecthomas/chroma/v2 v2.20.0/go.mod h1:e7tViK0xh/Nf4BYHl00ycY6rV7b8iXBksI9E359yNmA=
|
||||
github.com/alecthomas/repr v0.5.1 h1:E3G4t2QbHTSNpPKBgMTln5KLkZHLOcU7r37J4pXBuIg=
|
||||
github.com/alecthomas/repr v0.5.1/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
|
||||
github.com/alecthomas/chroma/v2 v2.21.1 h1:FaSDrp6N+3pphkNKU6HPCiYLgm8dbe5UXIXcoBhZSWA=
|
||||
github.com/alecthomas/chroma/v2 v2.21.1/go.mod h1:NqVhfBR0lte5Ouh3DcthuUCTUpDC9cxBOfyMbMQPs3o=
|
||||
github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs=
|
||||
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
|
||||
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 h1:uvdUDbHQHO85qeSydJtItA4T55Pw6BtAejd0APRJOCE=
|
||||
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
|
||||
github.com/alicebob/miniredis/v2 v2.31.1 h1:7XAt0uUg3DtwEKW5ZAGa+K7FZV2DdKQo5K/6TTnfX8Y=
|
||||
@@ -48,8 +48,8 @@ github.com/go-chi/cors v1.2.2 h1:Jmey33TE+b+rB7fT8MUy1u0I4L+NARQlK6LhzKPSyQE=
|
||||
github.com/go-chi/cors v1.2.2/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
||||
github.com/go-oauth2/oauth2/v4 v4.5.4 h1:YjI0tmGW8oxVhn9QSBIxlr641QugWrJY5UWa6XmLcW0=
|
||||
github.com/go-oauth2/oauth2/v4 v4.5.4/go.mod h1:BXiOY+QZtZy2ewbsGk2B5P8TWmtz/Rf7ES5ZttQFxfQ=
|
||||
github.com/go-pkgz/auth/v2 v2.1.0 h1:ECUVtCWzJG9yDNMVWh1tX/qoDXaUpwSROyZ4VzmoAhI=
|
||||
github.com/go-pkgz/auth/v2 v2.1.0/go.mod h1:adiVuMWvZ07wgLLWg1xjG+GQIn8wLty8UEXkjEOsZmw=
|
||||
github.com/go-pkgz/auth/v2 v2.1.1 h1:CBH3Z6ovLT51Nx9TkBcu2L8Dd/xwL6CgJcgqUnC2isQ=
|
||||
github.com/go-pkgz/auth/v2 v2.1.1/go.mod h1:9LwzESczjMavmXNZo1XhYpfYdKWtoCbXt/ZIi0GTvF0=
|
||||
github.com/go-pkgz/email v0.6.0 h1:snZnXldjeF4PgKSjnx9Fa25mtOgFpAOEeWvnQvrxjLE=
|
||||
github.com/go-pkgz/email v0.6.0/go.mod h1:+wgi4x7S33IuCzfcCM5euN0GwQG6XvO/PBLxrNffYLI=
|
||||
github.com/go-pkgz/expirable-cache/v3 v3.1.0 h1:s05P851/O6QJ6Mc+7o2bh9aGtD3romB1SxDTXifdoqc=
|
||||
@@ -66,8 +66,8 @@ github.com/go-pkgz/repeater v1.2.0 h1:oJFvjyKdTDd5RCzpzxlzYIZFFj6Zfl17rE1aUfu6Uj
|
||||
github.com/go-pkgz/repeater v1.2.0/go.mod h1:vypP6xamA53MFmafnGUucqOmALKk36xgKu2hSG73LHM=
|
||||
github.com/go-pkgz/repeater/v2 v2.2.0 h1:8nZR/NaknmLfx2YMHbr78u9OL4Xj+8+romm9dz4FpMg=
|
||||
github.com/go-pkgz/repeater/v2 v2.2.0/go.mod h1:RgX5vUbLKq7PV82QUDP5pFbQS1os4Z+U9XzKymK23A8=
|
||||
github.com/go-pkgz/rest v1.20.4 h1:8ufcP1IqoDhCvIFdXPtvyX4HSS16SM6THBe2a6L0/kg=
|
||||
github.com/go-pkgz/rest v1.20.4/go.mod h1:2/LEZGndSxpVvExsMn48AjUgiTn6kILqjpoaRnl62JU=
|
||||
github.com/go-pkgz/rest v1.20.6 h1:O/IhQ3I2cS4bJYvL1TLcy63w2OcXZTTBG3R+wTIqPS4=
|
||||
github.com/go-pkgz/rest v1.20.6/go.mod h1:NY+MX1is2kJckJt+nHDNovS/5j9jmF4yQuSno4qg7XU=
|
||||
github.com/go-pkgz/routegroup v1.6.0 h1:44XHZgF6JIIldRlv+zjg6SygULASmjifnfIQjwCT0e4=
|
||||
github.com/go-pkgz/routegroup v1.6.0/go.mod h1:Pmu04fhgWhRtBMIJ8HXppnnzOPjnL/IEPBIdO2zmeqg=
|
||||
github.com/go-pkgz/syncs v1.3.2 h1:gmioASlJNy3gNosPlgvWOM2QP0Hdjzn2u+/sUShgd8E=
|
||||
@@ -201,10 +201,10 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
|
||||
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
|
||||
golang.org/x/image v0.33.0 h1:LXRZRnv1+zGd5XBUVRFmYEphyyKJjQjCRiOuAP3sZfQ=
|
||||
golang.org/x/image v0.33.0/go.mod h1:DD3OsTYT9chzuzTQt+zMcOlBHgfoKQb1gry8p76Y1sc=
|
||||
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
|
||||
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
|
||||
golang.org/x/image v0.34.0 h1:33gCkyw9hmwbZJeZkct8XyR11yH889EQt/QH4VmXMn8=
|
||||
golang.org/x/image v0.34.0/go.mod h1:2RNFBZRB+vnwwFil8GkMdRvrJOFd1AzdZI6vOY+eJVU=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
@@ -219,10 +219,10 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
|
||||
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
|
||||
golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo=
|
||||
golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
|
||||
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
|
||||
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
|
||||
golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw=
|
||||
golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -230,8 +230,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
|
||||
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@@ -243,8 +243,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
|
||||
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
|
||||
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
@@ -264,8 +264,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
|
||||
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
|
||||
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
|
||||
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ ENV GOARCH=amd64
|
||||
RUN make build/chromad
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:3.22 AS runtime
|
||||
FROM alpine:3.23 AS runtime
|
||||
|
||||
# Install ca-certificates for HTTPS requests
|
||||
RUN apk --no-cache add ca-certificates curl
|
||||
|
||||
+9
-9
@@ -35,10 +35,10 @@ translators for Pygments lexers and styles.
|
||||
## Supported languages
|
||||
|
||||
| Prefix | Language
|
||||
| :----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
| :----: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
| A | ABAP, ABNF, ActionScript, ActionScript 3, Ada, Agda, AL, Alloy, Angular2, ANTLR, ApacheConf, APL, AppleScript, ArangoDB AQL, Arduino, ArmAsm, ATL, AutoHotkey, AutoIt, Awk
|
||||
| B | Ballerina, Bash, Bash Session, Batchfile, Beef, BibTeX, Bicep, BlitzBasic, BNF, BQN, Brainfuck
|
||||
| C | C, C#, C++, Caddyfile, Caddyfile Directives, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Chapel, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Core, Crystal, CSS, CSV, CUE, Cython
|
||||
| C | C, C#, C++, C3, Caddyfile, Caddyfile Directives, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Chapel, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Core, Crystal, CSS, CSV, CUE, Cython
|
||||
| D | D, Dart, Dax, Desktop file, Diff, Django/Jinja, dns, Docker, DTD, Dylan
|
||||
| E | EBNF, Elixir, Elm, EmacsLisp, Erlang
|
||||
| F | Factor, Fennel, Fish, Forth, Fortran, FortranFixed, FSharp
|
||||
@@ -46,19 +46,19 @@ translators for Pygments lexers and styles.
|
||||
| H | Handlebars, Hare, Haskell, Haxe, HCL, Hexdump, HLB, HLSL, HolyC, HTML, HTTP, Hy
|
||||
| I | Idris, Igor, INI, Io, ISCdhcpd
|
||||
| J | J, Janet, Java, JavaScript, JSON, JSONata, Jsonnet, Julia, Jungle
|
||||
| K | Kotlin
|
||||
| K | Kakoune, Kotlin
|
||||
| L | Lean4, Lighttpd configuration file, LLVM, lox, Lua
|
||||
| M | Makefile, Mako, markdown, Mason, Materialize SQL dialect, Mathematica, Matlab, MCFunction, Meson, Metal, MiniZinc, MLIR, Modula-2, Mojo, MonkeyC, MoonScript, MorrowindScript, Myghty, MySQL
|
||||
| M | Makefile, Mako, markdown, Mason, Materialize SQL dialect, Mathematica, Matlab, MCFunction, Meson, Metal, MiniZinc, MLIR, Modelica, Modula-2, Mojo, MonkeyC, MoonScript, MorrowindScript, Myghty, MySQL
|
||||
| N | NASM, Natural, NDISASM, Newspeak, Nginx configuration file, Nim, Nix, NSIS, Nu
|
||||
| O | Objective-C, ObjectPascal, OCaml, Octave, Odin, OnesEnterprise, OpenEdge ABL, OpenSCAD, Org Mode
|
||||
| P | PacmanConf, Perl, PHP, PHTML, Pig, PkgConfig, PL/pgSQL, plaintext, Plutus Core, Pony, PostgreSQL SQL dialect, PostScript, POVRay, PowerQuery, PowerShell, Prolog, Promela, PromQL, properties, Protocol Buffer, PRQL, PSL, Puppet, Python, Python 2
|
||||
| P | PacmanConf, Perl, PHP, PHTML, Pig, PkgConfig, PL/pgSQL, plaintext, Plutus Core, Pony, PostgreSQL SQL dialect, PostScript, POVRay, PowerQuery, PowerShell, Prolog, Promela, PromQL, properties, Protocol Buffer, Protocol Buffer Text Format, PRQL, PSL, Puppet, Python, Python 2
|
||||
| Q | QBasic, QML
|
||||
| R | R, Racket, Ragel, Raku, react, ReasonML, reg, Rego, reStructuredText, Rexx, RPGLE, RPMSpec, Ruby, Rust
|
||||
| R | R, Racket, Ragel, Raku, react, ReasonML, reg, Rego, reStructuredText, Rexx, RGBDS Assembly, Ring, RPGLE, RPMSpec, Ruby, Rust
|
||||
| S | SAS, Sass, Scala, Scheme, Scilab, SCSS, Sed, Sieve, Smali, Smalltalk, Smarty, SNBT, Snobol, Solidity, SourcePawn, SPARQL, SQL, SquidConf, Standard ML, stas, Stylus, Svelte, Swift, SYSTEMD, systemverilog
|
||||
| T | TableGen, Tal, TASM, Tcl, Tcsh, Termcap, Terminfo, Terraform, TeX, Thrift, TOML, TradingView, Transact-SQL, Turing, Turtle, Twig, TypeScript, TypoScript, TypoScriptCssData, TypoScriptHtmlData, Typst
|
||||
| U | ucode
|
||||
| V | V, V shell, Vala, VB.net, verilog, VHDL, VHS, VimL, vue
|
||||
| W | WDTE, WebGPU Shading Language, WebVTT, Whiley
|
||||
| W | WDTE, WebAssembly Text Format, WebGPU Shading Language, WebVTT, Whiley
|
||||
| X | XML, Xorg
|
||||
| Y | YAML, YANG
|
||||
| Z | Z80 Assembly, Zed, Zig
|
||||
@@ -209,7 +209,7 @@ using the included Python 3 script `pygments2chroma_xml.py`. I use something lik
|
||||
the following:
|
||||
|
||||
```sh
|
||||
python3 _tools/pygments2chroma_xml.py \
|
||||
uv run --script _tools/pygments2chroma_xml.py \
|
||||
pygments.lexers.jvm.KotlinLexer \
|
||||
> lexers/embedded/kotlin.xml
|
||||
```
|
||||
@@ -272,7 +272,7 @@ for that setup the `chroma` executable can be just symlinked to `~/.lessfilter`.
|
||||
|
||||
## Projects using Chroma
|
||||
|
||||
* [`moar`](https://github.com/walles/moar) is a full-blown pager that colorizes
|
||||
* [`moor`](https://github.com/walles/moor) is a full-blown pager that colorizes
|
||||
its input using Chroma
|
||||
* [Hugo](https://gohugo.io/) is a static site generator that [uses Chroma for syntax
|
||||
highlighting code examples](https://gohugo.io/content-management/syntax-highlighting/)
|
||||
|
||||
+7
-1
@@ -58,6 +58,7 @@ func Literator(tokens ...Token) Iterator {
|
||||
// SplitTokensIntoLines splits tokens containing newlines in two.
|
||||
func SplitTokensIntoLines(tokens []Token) (out [][]Token) {
|
||||
var line []Token // nolint: prealloc
|
||||
tokenLoop:
|
||||
for _, token := range tokens {
|
||||
for strings.Contains(token.Value, "\n") {
|
||||
parts := strings.SplitAfterN(token.Value, "\n", 2)
|
||||
@@ -70,6 +71,11 @@ func SplitTokensIntoLines(tokens []Token) (out [][]Token) {
|
||||
line = append(line, clone)
|
||||
out = append(out, line)
|
||||
line = nil
|
||||
|
||||
// If the tail token is empty, don't emit it.
|
||||
if len(token.Value) == 0 {
|
||||
continue tokenLoop
|
||||
}
|
||||
}
|
||||
line = append(line, token)
|
||||
}
|
||||
@@ -83,5 +89,5 @@ func SplitTokensIntoLines(tokens []Token) (out [][]Token) {
|
||||
out = out[:len(out)-1]
|
||||
}
|
||||
}
|
||||
return
|
||||
return out
|
||||
}
|
||||
|
||||
+374
@@ -0,0 +1,374 @@
|
||||
<lexer>
|
||||
<config>
|
||||
<name>C3</name>
|
||||
<alias>c3</alias>
|
||||
<filename>*.c3</filename>
|
||||
<filename>*.c3i</filename>
|
||||
<filename>*.c3t</filename>
|
||||
<dot_all>true</dot_all>
|
||||
</config>
|
||||
<rules>
|
||||
<state name="vector">
|
||||
<rule pattern=">\]">
|
||||
<token type="Punctuation" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule pattern=""(\\\\|\\"|[^"])*"">
|
||||
<token type="LiteralStringDouble" />
|
||||
</rule>
|
||||
<rule pattern="'(\\\\|\\'|[^'])*'">
|
||||
<token type="LiteralStringChar" />
|
||||
</rule>
|
||||
<rule pattern="`(\\\\|\\`|[^`])*`">
|
||||
<token type="LiteralStringDouble" />
|
||||
</rule>
|
||||
<rule pattern="[+-]?(?:0(?:[xX][0-9a-fA-F](?:_*[0-9a-fA-F])*|[oO][0-7](?:_*[0-7])*|[bB][10](?:_*[10])*)|[0-9](?:_*[0-9])*(?:_*[eE][+-]?[0-9]+)?)(?:[iIuU](?:8|16|32|64|128)?|[fF](?:32|64)?|[uU][lL])?">
|
||||
<token type="LiteralNumber" />
|
||||
</rule>
|
||||
<rule pattern="\*">
|
||||
<token type="LiteralNumber" />
|
||||
</rule>
|
||||
<rule pattern="[$]{2}(C_INT_SIZE|C_SHORT_SIZE|C_LONG_SIZE|C_LONG_LONG_SIZE|C_CHAR_IS_SIGNED|JMP_BUF_SIZE|BUILD_HASH|BUILD_DATE|OS_TYPE|ARCH_TYPE|MAX_VECTOR_SIZE|REGISTER_SIZE |REGISTER_SIZE |COMPILER_LIBC_AVAILABLE|COMPILER_LIBC_AVAILABLE|COMPILER_OPT_LEVEL|PLATFORM_BIG_ENDIAN|PLATFORM_I128_SUPPORTED|PLATFORM_F16_SUPPORTED|PLATFORM_F128_SUPPORTED|REGISTER_SIZE|COMPILER_SAFE_MODE|DEBUG_SYMBOLS|BACKTRACE|LLVM_VERSION|BENCHMARKING|TESTING|PANIC_MSG|MEMORY_ENVIRONMENT|ADDRESS_SANITIZER|MEMORY_SANITIZER|THREAD_SANITIZER|LANGUAGE_DEV_VERSION|AUTHORS|AUTHOR_EMAILS|PROJECT_VERSION)">
|
||||
<token type="NameBuiltin" />
|
||||
</rule>
|
||||
<rule pattern="(\$alignof|\$assert|\$assignable|\$case|\$default|\$defined|\$echo|\$else|\$embed|\$endforeach|\$endfor|\$endif|\$endswitch|\$eval|\$evaltype|\$error|\$exec|\$extnameof|\$feature|\$foreach|\$for|\$if|\$include|\$is_const|\$nameof|\$offsetof|\$qnameof|\$sizeof|\$stringify|\$switch|\$typefrom|\$typeof|\$vacount|\$vatype|\$vaconst|\$vaarg|\$vaexpr|\$vasplat|alias|assert|asm|attrdef|bitstruct|break|case|catch|continue|default|defer|do|else|enum|extern|false|faultdef|foreach_r|foreach|for|fn|tlocal|if|inline|import|macro|module|nextcase|null|interface|return|static|struct|switch|true|try|typedef|union|while)(?!\w)">
|
||||
<token type="Keyword" />
|
||||
</rule>
|
||||
<rule pattern="[$#@]*[_a-z][a-z0-9A-Z_]*">
|
||||
<token type="NameOther" />
|
||||
</rule>
|
||||
<rule pattern="([$@]?(?:_)?[A-Z][a-z0-9A-Z_]*)(\s*)(\?)?">
|
||||
<bygroups>
|
||||
<token type="NameClass" />
|
||||
<token type="Text" />
|
||||
<token type="NameClass" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="[$]?(_)?[A-Z][0-9A-Z_]*">
|
||||
<token type="NameConstant" />
|
||||
</rule>
|
||||
<rule pattern="\[<">
|
||||
<token type="Punctuation" />
|
||||
<push state="vector" />
|
||||
</rule>
|
||||
<rule pattern="\[">
|
||||
<token type="Punctuation" />
|
||||
<push state="index" />
|
||||
</rule>
|
||||
<rule pattern="(--|=>|>=|<=|(\||&|\+){1,3}|\?:|\?\?|\.\.)|[:?=<>%/\-\^!~]">
|
||||
<token type="Operator" />
|
||||
</rule>
|
||||
<rule pattern="[(){},;.!]">
|
||||
<token type="Punctuation" />
|
||||
</rule>
|
||||
<rule pattern="\s+">
|
||||
<token type="Text" />
|
||||
</rule>
|
||||
</state>
|
||||
<state name="index">
|
||||
<rule pattern="\]">
|
||||
<token type="Punctuation" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule pattern=""(\\\\|\\"|[^"])*"">
|
||||
<token type="LiteralStringDouble" />
|
||||
</rule>
|
||||
<rule pattern="'(\\\\|\\'|[^'])*'">
|
||||
<token type="LiteralStringChar" />
|
||||
</rule>
|
||||
<rule pattern="`(\\\\|\\`|[^`])*`">
|
||||
<token type="LiteralStringDouble" />
|
||||
</rule>
|
||||
<rule pattern="[+-]?(?:0(?:[xX][0-9a-fA-F](?:_*[0-9a-fA-F])*|[oO][0-7](?:_*[0-7])*|[bB][10](?:_*[10])*)|[0-9](?:_*[0-9])*(?:_*[eE][+-]?[0-9]+)?)(?:[iIuU](?:8|16|32|64|128)?|[fF](?:32|64)?|[uU][lL])?">
|
||||
<token type="LiteralNumber" />
|
||||
</rule>
|
||||
<rule pattern="\*">
|
||||
<token type="LiteralNumber" />
|
||||
</rule>
|
||||
<rule pattern="[$]{2}(C_INT_SIZE|C_SHORT_SIZE|C_LONG_SIZE|C_LONG_LONG_SIZE|C_CHAR_IS_SIGNED|JMP_BUF_SIZE|BUILD_HASH|BUILD_DATE|OS_TYPE|ARCH_TYPE|MAX_VECTOR_SIZE|REGISTER_SIZE |REGISTER_SIZE |COMPILER_LIBC_AVAILABLE|COMPILER_LIBC_AVAILABLE|COMPILER_OPT_LEVEL|PLATFORM_BIG_ENDIAN|PLATFORM_I128_SUPPORTED|PLATFORM_F16_SUPPORTED|PLATFORM_F128_SUPPORTED|REGISTER_SIZE|COMPILER_SAFE_MODE|DEBUG_SYMBOLS|BACKTRACE|LLVM_VERSION|BENCHMARKING|TESTING|PANIC_MSG|MEMORY_ENVIRONMENT|ADDRESS_SANITIZER|MEMORY_SANITIZER|THREAD_SANITIZER|LANGUAGE_DEV_VERSION|AUTHORS|AUTHOR_EMAILS|PROJECT_VERSION)">
|
||||
<token type="NameBuiltin" />
|
||||
</rule>
|
||||
<rule pattern="(\$alignof|\$assert|\$assignable|\$case|\$default|\$defined|\$echo|\$else|\$embed|\$endforeach|\$endfor|\$endif|\$endswitch|\$eval|\$evaltype|\$error|\$exec|\$extnameof|\$feature|\$foreach|\$for|\$if|\$include|\$is_const|\$nameof|\$offsetof|\$qnameof|\$sizeof|\$stringify|\$switch|\$typefrom|\$typeof|\$vacount|\$vatype|\$vaconst|\$vaarg|\$vaexpr|\$vasplat|alias|assert|asm|attrdef|bitstruct|break|case|catch|continue|default|defer|do|else|enum|extern|false|faultdef|foreach_r|foreach|for|fn|tlocal|if|inline|import|macro|module|nextcase|null|interface|return|static|struct|switch|true|try|typedef|union|while)(?!\w)">
|
||||
<token type="Keyword" />
|
||||
</rule>
|
||||
<rule pattern="[$#@]*[_a-z][a-z0-9A-Z_]*">
|
||||
<token type="NameOther" />
|
||||
</rule>
|
||||
<rule pattern="([$@]?(?:_)?[A-Z][a-z0-9A-Z_]*)(\s*)(\?)?">
|
||||
<bygroups>
|
||||
<token type="NameClass" />
|
||||
<token type="Text" />
|
||||
<token type="NameClass" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="[$]?(_)?[A-Z][0-9A-Z_]*">
|
||||
<token type="NameConstant" />
|
||||
</rule>
|
||||
<rule pattern="\[<">
|
||||
<token type="Punctuation" />
|
||||
<push state="vector" />
|
||||
</rule>
|
||||
<rule pattern="\[">
|
||||
<token type="Punctuation" />
|
||||
<push state="index" />
|
||||
</rule>
|
||||
<rule pattern="(--|=>|>=|<=|(\||&|\+){1,3}|\?:|\?\?|\.\.)|[:?=<>%/\-\^!~]">
|
||||
<token type="Operator" />
|
||||
</rule>
|
||||
<rule pattern="[(){},;.!]">
|
||||
<token type="Punctuation" />
|
||||
</rule>
|
||||
<rule pattern="\s+">
|
||||
<token type="Text" />
|
||||
</rule>
|
||||
</state>
|
||||
<state name="function_type">
|
||||
<rule pattern="void|bool|char|double|float|float16|bfloat|int128|ichar|int|iptr|isz|long|short|uint128|uint|ulong|uptr|ushort|usz|float128|any|fault|typeid">
|
||||
<token type="NameBuiltin" />
|
||||
</rule>
|
||||
<rule pattern="\[<">
|
||||
<token type="Punctuation" />
|
||||
<push state="vector" />
|
||||
</rule>
|
||||
<rule pattern="\[">
|
||||
<token type="Punctuation" />
|
||||
<push state="index" />
|
||||
</rule>
|
||||
<rule pattern="\s*\(">
|
||||
<token type="Punctuation" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule pattern="\.">
|
||||
<token type="Punctuation" />
|
||||
</rule>
|
||||
<rule pattern="\s*(\*)">
|
||||
<token type="Operator" />
|
||||
</rule>
|
||||
<rule pattern="[$@]?(_)?[A-Z][a-zA-Z_0-9]*">
|
||||
<token type="NameClass" />
|
||||
</rule>
|
||||
<rule pattern="\s*\?">
|
||||
<token type="NameClass" />
|
||||
</rule>
|
||||
<rule pattern="\s+">
|
||||
<token type="Text" />
|
||||
<push state="function_name" />
|
||||
</rule>
|
||||
<rule pattern="[@]?[_a-z][a-zA-Z_0-9]*">
|
||||
<token type="NameFunction" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule pattern="[$]?[_a-z][a-zA-Z_0-9]*">
|
||||
<token type="Keyword" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
</state>
|
||||
<state name="function_name">
|
||||
<rule pattern="(void|bool|char|double|float|float16|bfloat|int128|ichar|int|iptr|isz|long|short|uint128|uint|ulong|uptr|ushort|usz|float128|any|fault|typeid)(?![a-zA-Z_0-9])">
|
||||
<token type="NameBuiltin" />
|
||||
</rule>
|
||||
<rule pattern="[@]?[_a-z][a-zA-Z_0-9]*">
|
||||
<token type="NameFunction" />
|
||||
<pop depth="2" />
|
||||
</rule>
|
||||
<rule pattern="([$@]?(?:_)?[A-Z][a-zA-Z_0-9]*)">
|
||||
<token type="NameClass" />
|
||||
</rule>
|
||||
<rule pattern="\.|\s*(\*)">
|
||||
<token type="Punctuation" />
|
||||
</rule>
|
||||
<rule pattern="\[<">
|
||||
<token type="Punctuation" />
|
||||
<push state="vector" />
|
||||
</rule>
|
||||
<rule pattern="\[">
|
||||
<token type="Punctuation" />
|
||||
<push state="index" />
|
||||
</rule>
|
||||
<rule pattern="\(">
|
||||
<token type="Punctuation" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
</state>
|
||||
<state name="path_segment">
|
||||
<rule pattern="[_a-z][a-z0-9_]*">
|
||||
<token type="NameNamespace" />
|
||||
</rule>
|
||||
<rule pattern="(::|,)">
|
||||
<token type="Punctuation" />
|
||||
</rule>
|
||||
<rule pattern=""(\\\\|\\"|[^"])*"">
|
||||
<token type="LiteralStringDouble" />
|
||||
</rule>
|
||||
<rule pattern="'(\\\\|\\'|[^'])*'">
|
||||
<token type="LiteralStringChar" />
|
||||
</rule>
|
||||
<rule pattern="`(\\\\|\\`|[^`])*`">
|
||||
<token type="LiteralStringDouble" />
|
||||
</rule>
|
||||
<rule pattern="(\s*)(\{)(\s*)([$@]?(?:_)?[A-Z][a-zA-Z_0-9]*)(?:(\s*)(,)(\s*)([$@]?(?:_)?[A-Z][a-zA-Z_0-9]*))*(\s*)(\})">
|
||||
<bygroups>
|
||||
<token type="Text" />
|
||||
<token type="Punctuation" />
|
||||
<token type="Text" />
|
||||
<token type="NameClass" />
|
||||
<token type="Text" />
|
||||
<token type="Punctuation" />
|
||||
<token type="Text" />
|
||||
<token type="NameClass" />
|
||||
<token type="Text" />
|
||||
<token type="Punctuation" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="@align|@benchmark|@bigendian|@builtin|@callconv|@compact|@const|@deprecated|@dynamic|@export|@extern|@finalizer|@format|@if|@inline|@init|@link|@littleendian|@local|@maydiscard|@naked|@noalias|@nodiscard|@noinit|@noinline|@nopadding|@norecurse|@noreturn|@nosanitize|@nostrip|@obfuscate|@operator|@operator_r|@operator_s|@optional|@overlap|@packed|@private|@public|@pure|@reflect|@safemacro|@section|@tag|@test|@unused|@used|@wasm|@weak|@winmain">
|
||||
<token type="NameAttribute" />
|
||||
</rule>
|
||||
<rule pattern="(([\^&|+\-*/%=!]|(<|>){2})=|--|=>|>=|<=|(\||&|\+){1,3}|\?:|\?\?)|[?=<>%/\-\^*!~]">
|
||||
<token type="Operator" />
|
||||
</rule>
|
||||
<rule pattern="[(){}[\],*:.!]">
|
||||
<token type="Punctuation" />
|
||||
</rule>
|
||||
<rule pattern="(\$alignof|\$assert|\$assignable|\$case|\$default|\$defined|\$echo|\$else|\$embed|\$endforeach|\$endfor|\$endif|\$endswitch|\$eval|\$evaltype|\$error|\$exec|\$extnameof|\$feature|\$foreach|\$for|\$if|\$include|\$is_const|\$nameof|\$offsetof|\$qnameof|\$sizeof|\$stringify|\$switch|\$typefrom|\$typeof|\$vacount|\$vatype|\$vaconst|\$vaarg|\$vaexpr|\$vasplat|alias|assert|asm|attrdef|bitstruct|break|case|catch|continue|default|defer|do|else|enum|extern|false|faultdef|foreach_r|foreach|for|fn|tlocal|if|inline|import|macro|module|nextcase|null|interface|return|static|struct|switch|true|try|typedef|union|while)(?!\w)">
|
||||
<token type="Keyword" />
|
||||
</rule>
|
||||
<rule pattern="([$#@]*[_a-z][a-z0-9A-Z_]*)(\s*)(\()">
|
||||
<bygroups>
|
||||
<token type="NameFunction" />
|
||||
<token type="Text" />
|
||||
<token type="Punctuation" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="[$#@]*[_a-z][a-z0-9A-Z_]*">
|
||||
<token type="NameOther" />
|
||||
</rule>
|
||||
<rule pattern="([$@]?(?:_)?[A-Z][a-z0-9A-Z_]*)(\s*)(\?)?">
|
||||
<bygroups>
|
||||
<token type="NameClass" />
|
||||
<token type="Text" />
|
||||
<token type="NameClass" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="[$]?(_)?[A-Z][0-9A-Z_]*">
|
||||
<token type="NameConstant" />
|
||||
</rule>
|
||||
<rule pattern="\[<">
|
||||
<token type="Punctuation" />
|
||||
<push state="vector" />
|
||||
</rule>
|
||||
<rule pattern="[;]">
|
||||
<token type="Punctuation" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule pattern="\s+">
|
||||
<token type="Text" />
|
||||
</rule>
|
||||
</state>
|
||||
<state name="root">
|
||||
<rule pattern="//.*?\n">
|
||||
<token type="CommentSingle"/>
|
||||
</rule>
|
||||
<rule pattern="/\*.*?\*/">
|
||||
<token type="CommentMultiline"/>
|
||||
</rule>
|
||||
<rule pattern="<\*.*?\*>">
|
||||
<token type="CommentMultiline"/>
|
||||
</rule>
|
||||
<rule pattern="(module|import)(\s+)">
|
||||
<bygroups>
|
||||
<token type="Keyword" />
|
||||
<token type="Text" />
|
||||
</bygroups>
|
||||
<push state="path_segment" />
|
||||
</rule>
|
||||
<rule pattern="(extern)?(fn|macro)(\s+)">
|
||||
<bygroups>
|
||||
<token type="Keyword" />
|
||||
<token type="Keyword" />
|
||||
<token type="Text" />
|
||||
</bygroups>
|
||||
<push state="function_type" />
|
||||
</rule>
|
||||
<rule pattern="[$]{2}(C_INT_SIZE|C_SHORT_SIZE|C_LONG_SIZE|C_LONG_LONG_SIZE|C_CHAR_IS_SIGNED|JMP_BUF_SIZE|BUILD_HASH|BUILD_DATE|OS_TYPE|ARCH_TYPE|MAX_VECTOR_SIZE|REGISTER_SIZE |REGISTER_SIZE |COMPILER_LIBC_AVAILABLE|COMPILER_LIBC_AVAILABLE|COMPILER_OPT_LEVEL|PLATFORM_BIG_ENDIAN|PLATFORM_I128_SUPPORTED|PLATFORM_F16_SUPPORTED|PLATFORM_F128_SUPPORTED|REGISTER_SIZE|COMPILER_SAFE_MODE|DEBUG_SYMBOLS|BACKTRACE|LLVM_VERSION|BENCHMARKING|TESTING|PANIC_MSG|MEMORY_ENVIRONMENT|ADDRESS_SANITIZER|MEMORY_SANITIZER|THREAD_SANITIZER|LANGUAGE_DEV_VERSION|AUTHORS|AUTHOR_EMAILS|PROJECT_VERSION)">
|
||||
<token type="NameBuiltin" />
|
||||
</rule>
|
||||
<rule pattern="(void|bool|char|double|float|float16|bfloat|int128|ichar|int|iptr|isz|long|short|uint128|uint|ulong|uptr|ushort|usz|float128|any|fault|typeid)(\s*)(\?)?">
|
||||
<bygroups>
|
||||
<token type="NameBuiltin" />
|
||||
<token type="Text" />
|
||||
<token type="NameClass" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="(\$alignof|\$assert|\$assignable|\$case|\$default|\$defined|\$echo|\$else|\$embed|\$endforeach|\$endfor|\$endif|\$endswitch|\$eval|\$evaltype|\$error|\$exec|\$extnameof|\$feature|\$foreach|\$for|\$if|\$include|\$is_const|\$nameof|\$offsetof|\$qnameof|\$sizeof|\$stringify|\$switch|\$typefrom|\$typeof|\$vacount|\$vatype|\$vaconst|\$vaarg|\$vaexpr|\$vasplat|alias|assert|asm|attrdef|bitstruct|break|case|catch|continue|default|defer|do|else|enum|extern|false|faultdef|foreach_r|foreach|for|fn|tlocal|if|inline|import|macro|module|nextcase|null|interface|return|static|struct|switch|true|try|typedef|union|while)(?!\w)">
|
||||
<token type="Keyword" />
|
||||
</rule>
|
||||
<rule pattern="var|const">
|
||||
<token type="KeywordDeclaration" />
|
||||
</rule>
|
||||
<rule pattern="\A#! ?/.*?\n">
|
||||
<token type="CommentHashbang" />
|
||||
</rule>
|
||||
<rule pattern=""(\\\\|\\"|[^"])*"">
|
||||
<token type="LiteralStringDouble" />
|
||||
</rule>
|
||||
<rule pattern="'(\\\\|\\'|[^'])*'">
|
||||
<token type="LiteralStringChar" />
|
||||
</rule>
|
||||
<rule pattern="`(\\\\|\\`|[^`])*`">
|
||||
<token type="LiteralStringDouble" />
|
||||
</rule>
|
||||
<rule pattern="([_a-z][a-z0-9_]*)(::)">
|
||||
<bygroups>
|
||||
<token type="NameNamespace" />
|
||||
<token type="Punctuation" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="[+-]?(?:0(?:[xX][0-9a-fA-F](?:_*[0-9a-fA-F])*|[oO][0-7](?:_*[0-7])*|[bB][10](?:_*[10])*)|[0-9](?:_*[0-9])*(?:_*[eE][+-]?[0-9]+)?)(?:[iIuU](?:8|16|32|64|128)?|[fF](?:32|64)?|[uU][lL])?">
|
||||
<token type="LiteralNumber" />
|
||||
</rule>
|
||||
<rule pattern="@align|@benchmark|@bigendian|@builtin|@callconv|@compact|@const|@deprecated|@dynamic|@export|@extern|@finalizer|@format|@if|@inline|@init|@link|@littleendian|@local|@maydiscard|@naked|@noalias|@nodiscard|@noinit|@noinline|@nopadding|@norecurse|@noreturn|@nosanitize|@nostrip|@obfuscate|@operator|@operator_r|@operator_s|@optional|@overlap|@packed|@private|@public|@pure|@reflect|@safemacro|@section|@tag|@test|@unused|@used|@wasm|@weak|@winmain">
|
||||
<token type="NameAttribute" />
|
||||
</rule>
|
||||
<rule pattern="\$\$abs|\$\$any_make|\$\$atomic_load|\$\$atomic_store|\$\$atomic_fetch_exchange|\$\$atomic_fetch_add|\$\$atomic_fetch_sub|\$\$atomic_fetch_and|\$\$atomic_fetch_nand|\$\$atomic_fetch_or|\$\$atomic_fetch_xor|\$\$atomic_fetch_max|\$\$atomic_fetch_min|\$\$atomic_fetch_inc_wrap|\$\$atomic_fetch_dec_wrap|\$\$bitreverse|\$\$breakpoint|\$\$bswap|\$\$ceil|\$\$compare_exchange|\$\$copysign|\$\$cos|\$\$clz|\$\$ctz|\$\$add|\$\$div|\$\$mod|\$\$mul|\$\$neg|\$\$sub|\$\$exp|\$\$exp2|\$\$expect|\$\$expect_with_probability|\$\$floor|\$\$fma|\$\$fmuladd|\$\$frameaddress|\$\$fshl|\$\$fshr|\$\$gather|\$\$get_rounding_mode|\$\$log|\$\$log10|\$\$log2|\$\$masked_load|\$\$masked_store|\$\$max|\$\$memcpy|\$\$memcpy_inline|\$\$memmove|\$\$memset|\$\$memset_inline|\$\$min|\$\$nearbyint|\$\$overflow_add|\$\$overflow_mul|\$\$overflow_sub|\$\$popcount|\$\$pow|\$\$pow_int|\$\$prefetch|\$\$reduce_add|\$\$reduce_and|\$\$reduce_fadd|\$\$reduce_fmul|\$\$reduce_max|\$\$reduce_min|\$\$reduce_mul|\$\$reduce_or|\$\$reduce_xor|\$\$reverse|\$\$returnaddress|\$\$rint|\$\$round|\$\$roundeven|\$\$sat_add|\$\$sat_shl|\$\$sat_sub|\$\$scatter|\$\$select|\$\$set_rounding_mode|\$\$str_hash|\$\$str_upper|\$\$str_lower|\$\$str_find|\$\$swizzle|\$\$swizzle2|\$\$sin|\$\$sqrt|\$\$syscall|\$\$sysclock|\$\$trap|\$\$trunc|\$\$unaligned_load|\$\$unaligned_store|\$\$unreachable|\$\$veccomplt|\$\$veccomple|\$\$veccompgt|\$\$veccompge|\$\$veccompeq|\$\$veccompne|\$\$volatile_load|\$\$volatile_store|\$\$wasm_memory_size|\$\$wasm_memory_grow|\$\$wstr16|\$\$wstr32|\$\$DATE|\$\$FILE|\$\$FILEPATH|\$\$FUNC|\$\$FUNCTION|\$\$LINE|\$\$LINE_RAW|\$\$MODULE|\$\$BENCHMARK_NAMES|\$\$BENCHMARK_FNS|\$\$TEST_NAMES|\$\$TEST_FNS|\$\$TIME">
|
||||
<token type="NameBuiltin" />
|
||||
</rule>
|
||||
<rule pattern="([$#@]*[_a-z][a-z0-9A-Z_]*)(\s*)(\()">
|
||||
<bygroups>
|
||||
<token type="NameFunction" />
|
||||
<token type="Text" />
|
||||
<token type="Punctuation" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="[$#@]*[_a-z][a-z0-9A-Z_]*">
|
||||
<token type="NameOther" />
|
||||
</rule>
|
||||
<rule pattern="([$@]?(?:_)?[A-Z][a-z0-9A-Z_]*)(\s*)(\?)?">
|
||||
<bygroups>
|
||||
<token type="NameClass" />
|
||||
<token type="Text" />
|
||||
<token type="NameClass" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="[$]?(_)?[A-Z][0-9A-Z_]*">
|
||||
<token type="NameConstant" />
|
||||
</rule>
|
||||
<rule pattern="\[<">
|
||||
<token type="Punctuation" />
|
||||
<push state="vector" />
|
||||
</rule>
|
||||
<rule pattern="\[">
|
||||
<token type="Punctuation" />
|
||||
<push state="index" />
|
||||
</rule>
|
||||
<rule pattern="(([\^&|+\-*/%=!]|(<|>){2})=|--|=>|>=|<=|(\||&|\+){1,3}|\?:|\?\?)|[?=<>%/\-\^*!~]">
|
||||
<token type="Operator" />
|
||||
</rule>
|
||||
<rule pattern="[(){},;*:.!]">
|
||||
<token type="Punctuation" />
|
||||
</rule>
|
||||
<rule pattern="\s+">
|
||||
<token type="Text" />
|
||||
</rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
+2
-2
@@ -13,13 +13,13 @@
|
||||
<rule pattern="//(.*?)\n">
|
||||
<token type="CommentSingle"/>
|
||||
</rule>
|
||||
<rule pattern="(const|class|value|union|enum|trait|impl|annotation)\b">
|
||||
<rule pattern="(class|value|union|trait|impl|annotation)\b">
|
||||
<token type="KeywordDeclaration"/>
|
||||
</rule>
|
||||
<rule pattern="(fun|let|var)\b">
|
||||
<token type="KeywordDeclaration"/>
|
||||
</rule>
|
||||
<rule pattern="(mod|use)\b">
|
||||
<rule pattern="(mod|import)\b">
|
||||
<token type="KeywordNamespace"/>
|
||||
</rule>
|
||||
<rule pattern="(if|else|is|for|in|while|return)\b">
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+3
-3
@@ -15,10 +15,10 @@
|
||||
<rule pattern="//.*?\n">
|
||||
<token type="CommentSingle"/>
|
||||
</rule>
|
||||
<rule pattern="/\*.*?\*/">
|
||||
<rule pattern="/\*[\s\S]*?\*/">
|
||||
<token type="CommentMultiline"/>
|
||||
</rule>
|
||||
<rule pattern="/\+.*?\+/">
|
||||
<rule pattern="/\+[\s\S]*?\+/">
|
||||
<token type="CommentMultiline"/>
|
||||
</rule>
|
||||
<rule pattern="(asm|assert|body|break|case|cast|catch|continue|default|debug|delete|do|else|finally|for|foreach|foreach_reverse|goto|if|in|invariant|is|macro|mixin|new|out|pragma|return|super|switch|this|throw|try|typeid|typeof|version|while|with)\b">
|
||||
@@ -130,4 +130,4 @@
|
||||
</rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
</lexer>
|
||||
|
||||
+251
@@ -0,0 +1,251 @@
|
||||
<lexer>
|
||||
<config>
|
||||
<name>Devicetree</name>
|
||||
<alias>devicetree</alias>
|
||||
<alias>dts</alias>
|
||||
<filename>*.dts</filename>
|
||||
<filename>*.dtsi</filename>
|
||||
<mime_type>text/x-devicetree</mime_type>
|
||||
</config>
|
||||
<rules>
|
||||
<state name="whitespace">
|
||||
<rule pattern="\n">
|
||||
<token type="TextWhitespace" />
|
||||
</rule>
|
||||
<rule pattern="\s+">
|
||||
<token type="TextWhitespace" />
|
||||
</rule>
|
||||
<rule pattern="\\\n">
|
||||
<token type="Text" />
|
||||
</rule>
|
||||
<rule pattern="//(\n|[\w\W]*?[^\\]\n)">
|
||||
<token type="CommentSingle" />
|
||||
</rule>
|
||||
<rule pattern="/(\\\n)?[*][\w\W]*?[*](\\\n)?/">
|
||||
<token type="CommentMultiline" />
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="macro">
|
||||
<rule pattern="(#include)(\s*(?:/[*][^*/]*?[*]/\s*)*)([^\n]+)">
|
||||
<bygroups>
|
||||
<token type="CommentPreproc" />
|
||||
<token type="CommentMultiline" />
|
||||
<token type="CommentPreprocFile" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="(#define)(\s*(?:/[*][^*/]*?[*]/\s*)*)([^\n]+)">
|
||||
<bygroups>
|
||||
<token type="CommentPreproc" />
|
||||
<token type="CommentMultiline" />
|
||||
<token type="CommentPreproc" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="/dts-v1/">
|
||||
<token type="CommentPreproc" />
|
||||
</rule>
|
||||
<rule pattern="/memreserve/">
|
||||
<token type="CommentPreproc" />
|
||||
</rule>
|
||||
<rule pattern="/delete-node/">
|
||||
<token type="CommentPreproc" />
|
||||
</rule>
|
||||
<rule pattern="/delete-property/">
|
||||
<token type="CommentPreproc" />
|
||||
</rule>
|
||||
<rule pattern="(/include/)(\s*(?:/[*][^*/]*?[*]/\s*)*)("[^\n]+")">
|
||||
<bygroups>
|
||||
<token type="CommentPreproc" />
|
||||
<token type="CommentMultiline" />
|
||||
<token type="CommentPreprocFile" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="basic_statements">
|
||||
<rule pattern="&[a-zA-Z0-9_]+">
|
||||
<token type="NameLabel" />
|
||||
</rule>
|
||||
|
||||
<rule pattern="[a-zA-Z0-9_]+:">
|
||||
<token type="NameLabel" />
|
||||
</rule>
|
||||
|
||||
<rule pattern="(L?)(")">
|
||||
<bygroups>
|
||||
<token type="LiteralStringAffix" />
|
||||
<token type="LiteralString" />
|
||||
</bygroups>
|
||||
<push state="string" />
|
||||
</rule>
|
||||
<rule pattern="0x[0-9a-fA-F]+">
|
||||
<token type="LiteralNumberHex" />
|
||||
</rule>
|
||||
<rule pattern="\d+">
|
||||
<token type="LiteralNumberInteger" />
|
||||
</rule>
|
||||
|
||||
<rule pattern="status\b">
|
||||
<token type="KeywordReserved" />
|
||||
<push state="status_property" />
|
||||
</rule>
|
||||
|
||||
<rule pattern="([~!%^&*+=|?:<>/#-])">
|
||||
<token type="Operator" />
|
||||
</rule>
|
||||
<rule pattern="[()\[\]{},.]">
|
||||
<token type="Punctuation" />
|
||||
</rule>
|
||||
|
||||
<rule
|
||||
pattern="[a-zA-Z_][\w-]*(?=(?:\s*,\s*[a-zA-Z_][\w-]*|(?:\s*(?:/[*][^*/]*?[*]/\s*)*))*\s*[=;])">
|
||||
<token type="NameAttribute" />
|
||||
</rule>
|
||||
<rule pattern="[a-zA-Z_][\w-]*">
|
||||
<token type="Name" />
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="status_property">
|
||||
<rule>
|
||||
<include state="whitespace" />
|
||||
</rule>
|
||||
<rule pattern="=">
|
||||
<token type="Operator" />
|
||||
</rule>
|
||||
|
||||
<rule pattern=""okay"">
|
||||
<token type="LiteralString" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule pattern=""disabled"">
|
||||
<token type="KeywordType" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule pattern=""reserved"">
|
||||
<token type="NameDecorator" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule pattern=""fail"">
|
||||
<token type="GenericError" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule pattern=""fail-[^\"]+"">
|
||||
<token type="GenericTraceback" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule pattern=""">
|
||||
<token type="LiteralString" />
|
||||
<push state="string" />
|
||||
</rule>
|
||||
|
||||
<rule pattern=";">
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="root">
|
||||
<rule>
|
||||
<include state="whitespace" />
|
||||
</rule>
|
||||
<rule>
|
||||
<include state="macro" />
|
||||
</rule>
|
||||
|
||||
<rule pattern="([^/*@\s&]+|/)(@?)((?:0x)?[0-9a-fA-F,]*)(\s*(?:/[*][^*/]*?[*]/\s*)*)(\{)">
|
||||
<bygroups>
|
||||
<token type="NameFunction" />
|
||||
<token type="Operator" />
|
||||
<token type="LiteralNumberInteger" />
|
||||
<token type="CommentMultiline" />
|
||||
<token type="Punctuation" />
|
||||
</bygroups>
|
||||
<push state="node" />
|
||||
</rule>
|
||||
|
||||
<rule>
|
||||
<push state="statement" />
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="node">
|
||||
<rule>
|
||||
<include state="whitespace" />
|
||||
</rule>
|
||||
<rule>
|
||||
<include state="macro" />
|
||||
</rule>
|
||||
|
||||
<rule pattern="([^/*@\s&]+|/)(@?)((?:0x)?[0-9a-fA-F,]*)(\s*(?:/[*][^*/]*?[*]/\s*)*)(\{)">
|
||||
<bygroups>
|
||||
<token type="NameFunction" />
|
||||
<token type="Operator" />
|
||||
<token type="LiteralNumberInteger" />
|
||||
<token type="CommentMultiline" />
|
||||
<token type="Punctuation" />
|
||||
</bygroups>
|
||||
<push />
|
||||
</rule>
|
||||
|
||||
<rule pattern="([a-zA-Z0-9_]+)(\s*)(:)">
|
||||
<bygroups>
|
||||
<token type="NameLabel" />
|
||||
<token type="Text" />
|
||||
<token type="Punctuation" />
|
||||
</bygroups>
|
||||
</rule>
|
||||
|
||||
<rule pattern="\}">
|
||||
<token type="Punctuation" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule>
|
||||
<include state="basic_statements" />
|
||||
</rule>
|
||||
<rule pattern=";">
|
||||
<token type="Punctuation" />
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="statement">
|
||||
<rule>
|
||||
<include state="whitespace" />
|
||||
</rule>
|
||||
<rule pattern="([a-zA-Z0-9_]+)(\s*)(:)">
|
||||
<bygroups>
|
||||
<token type="NameLabel" />
|
||||
<token type="Text" />
|
||||
<token type="Punctuation" />
|
||||
</bygroups>
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule>
|
||||
<include state="basic_statements" />
|
||||
</rule>
|
||||
<rule pattern=";">
|
||||
<token type="Punctuation" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="string">
|
||||
<rule pattern=""">
|
||||
<token type="LiteralString" />
|
||||
<pop depth="1" />
|
||||
</rule>
|
||||
<rule
|
||||
pattern="\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})">
|
||||
<token type="LiteralStringEscape" />
|
||||
</rule>
|
||||
<rule pattern="[^\\"\n]+">
|
||||
<token type="LiteralString" />
|
||||
</rule>
|
||||
<rule pattern="\\\n">
|
||||
<token type="LiteralString" />
|
||||
</rule>
|
||||
<rule pattern="\\">
|
||||
<token type="LiteralString" />
|
||||
</rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
+8
-1
@@ -9,6 +9,13 @@
|
||||
<filename>*.inf</filename>
|
||||
<filename>*.service</filename>
|
||||
<filename>*.socket</filename>
|
||||
<filename>*.container</filename>
|
||||
<filename>*.network</filename>
|
||||
<filename>*.build</filename>
|
||||
<filename>*.pod</filename>
|
||||
<filename>*.kube</filename>
|
||||
<filename>*.volume</filename>
|
||||
<filename>*.image</filename>
|
||||
<filename>.gitconfig</filename>
|
||||
<filename>.editorconfig</filename>
|
||||
<filename>pylintrc</filename>
|
||||
@@ -42,4 +49,4 @@
|
||||
</rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
</lexer>
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
|
||||
<lexer>
|
||||
<config>
|
||||
<name>Kakoune</name>
|
||||
<alias>kak</alias>
|
||||
<alias>kakoune</alias>
|
||||
<alias>kakrc</alias>
|
||||
<alias>kakscript</alias>
|
||||
<filename>*.kak</filename>
|
||||
<filename>kakrc</filename>
|
||||
<mime_type>application/x-sh</mime_type>
|
||||
<mime_type>application/x-shellscript</mime_type>
|
||||
<mime_type>text/x-shellscript</mime_type>
|
||||
</config>
|
||||
<rules>
|
||||
<state name="root">
|
||||
<rule pattern="\b(add\-highlighter|alias|arrange\-buffers|buffer|buffer\-next|buffer\-previous|catch|change\-directory|colorscheme|debug|declare\-option|declare\-user\-mode|define\-command|complete\-command|delete\-buffer|delete\-buffer!|echo|edit|edit!|enter\-user\-mode|evaluate\-commands|execute\-keys|fail|hook|info|kill|kill!|map|nop|on\-key|prompt|provide\-module|quit|quit!|remove\-highlighter|remove\-hooks|rename\-buffer|rename\-client|rename\-session|require\-module|select|set\-face|set\-option|set\-register|source|trigger\-user\-hook|try|unalias|unmap|unset\-face|unset\-option|update\-option|write|write!|write\-all|write\-all\-quit|write\-quit|write\-quit!)\b"><token type="Keyword"/></rule>
|
||||
<rule pattern="\b(global|buffer|window|current|normal|insert|prompt|goto|view|user|object|number\-lines|show\-matching|show\-whitespaces|fill|regex|dynregex|group|flag\-lines|ranges|line|column|wrap|ref|regions|region|default\-region|replace\-ranges)\b"><token type="NameAttribute"/></rule>
|
||||
<rule pattern="\b(int|bool|str|regex|int\-list|str\-list|completions|line\-specs|range\-specs|str\-to\-str\-map)\b"><token type="NameClass"/></rule>
|
||||
<rule pattern="\b(default|black|red|green|yellow|blue|magenta|cyan|white|yes|no|false|true)\b"><token type="Literal"/></rule>
|
||||
<rule pattern="\brgba?:[0-9a-fA-F]{6,8}\b"><token type="LiteralNumberHex"/></rule>
|
||||
<rule pattern="(-params )(\b\d+)(\.\.)(\d+\b)"><bygroups><token type="Text"/><token type="LiteralNumber"/><token type="Text"/><token type="LiteralNumber"/></bygroups></rule>
|
||||
<rule pattern=""(""|[^"])*""><token type="LiteralString"/></rule>
|
||||
<rule pattern="'(''|[^'])*'"><token type="LiteralString"/></rule>
|
||||
<rule><include state="basic"/></rule>
|
||||
<rule pattern="`"><token type="LiteralStringBacktick"/><push state="backticks"/></rule>
|
||||
<rule><include state="data"/></rule>
|
||||
<rule><include state="interp"/></rule>
|
||||
</state>
|
||||
<state name="interp">
|
||||
<rule pattern="\$\(\("><token type="Keyword"/><push state="math"/></rule>
|
||||
<rule pattern="\$\("><token type="Keyword"/><push state="paren"/></rule>
|
||||
<rule pattern="\$\{#?"><token type="LiteralStringInterpol"/><push state="curly"/></rule>
|
||||
<rule pattern="\$[a-zA-Z_]\w*"><token type="NameVariable"/></rule>
|
||||
<rule pattern="\$(?:\d+|[#$?!_*@-])"><token type="NameVariable"/></rule>
|
||||
<rule pattern="\$"><token type="Text"/></rule>
|
||||
</state>
|
||||
<state name="basic">
|
||||
<rule pattern="\b(if|fi|else|while|in|do|done|for|then|return|function|case|select|break|continue|until|esac|elif)(\s*)\b"><bygroups><token type="Keyword"/><token type="TextWhitespace"/></bygroups></rule>
|
||||
<rule pattern="\b(alias|bg|bind|builtin|caller|cd|command|compgen|complete|declare|dirs|disown|echo|enable|eval|exec|exit|export|false|fc|fg|getopts|hash|help|history|jobs|kill|let|local|logout|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|time|times|trap|true|type|typeset|ulimit|umask|unalias|unset|wait)(?=[\s)`])"><token type="NameBuiltin"/></rule>
|
||||
<rule pattern="\A#!.+\n"><token type="CommentHashbang"/></rule>
|
||||
<rule pattern="#.*\n"><token type="CommentSingle"/></rule>
|
||||
<rule pattern="\\[\w\W]"><token type="LiteralStringEscape"/></rule>
|
||||
<rule pattern="(\b\w+)(\s*)(\+?=)"><bygroups><token type="NameVariable"/><token type="TextWhitespace"/><token type="Operator"/></bygroups></rule>
|
||||
<rule pattern="[\[\]{}()=]"><token type="Operator"/></rule>
|
||||
<rule pattern="<<<"><token type="Operator"/></rule>
|
||||
<rule pattern="<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2"><token type="LiteralString"/></rule>
|
||||
<rule pattern="&&|\|\|"><token type="Operator"/></rule>
|
||||
</state>
|
||||
<state name="data">
|
||||
<rule pattern="(?s)\$?"(\\.|[^"\\$])*""><token type="LiteralStringDouble"/></rule>
|
||||
<rule pattern="""><token type="LiteralStringDouble"/><push state="string"/></rule>
|
||||
<rule pattern="(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'"><token type="LiteralStringSingle"/></rule>
|
||||
<rule pattern="(?s)'.*?'"><token type="LiteralStringSingle"/></rule>
|
||||
<rule pattern=";"><token type="Punctuation"/></rule>
|
||||
<rule pattern="&"><token type="Punctuation"/></rule>
|
||||
<rule pattern="\|"><token type="Punctuation"/></rule>
|
||||
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
|
||||
<rule pattern="\d+\b"><token type="LiteralNumber"/></rule>
|
||||
<rule pattern="[^=\s\[\]{}()$"\'`\\<&|;]+"><token type="Text"/></rule>
|
||||
<rule pattern="<"><token type="Text"/></rule>
|
||||
</state>
|
||||
<state name="string">
|
||||
<rule pattern="""><token type="LiteralStringDouble"/><pop depth="1"/></rule>
|
||||
<rule pattern="(?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+"><token type="LiteralStringDouble"/></rule>
|
||||
<rule><include state="interp"/></rule>
|
||||
</state>
|
||||
<state name="curly">
|
||||
<rule pattern="\}"><token type="LiteralStringInterpol"/><pop depth="1"/></rule>
|
||||
<rule pattern=":-"><token type="Keyword"/></rule>
|
||||
<rule pattern="\w+"><token type="NameVariable"/></rule>
|
||||
<rule pattern="[^}:"\'`$\\]+"><token type="Punctuation"/></rule>
|
||||
<rule pattern=":"><token type="Punctuation"/></rule>
|
||||
<rule><include state="root"/></rule>
|
||||
</state>
|
||||
<state name="paren">
|
||||
<rule pattern="\)"><token type="Keyword"/><pop depth="1"/></rule>
|
||||
<rule><include state="root"/></rule>
|
||||
</state>
|
||||
<state name="math">
|
||||
<rule pattern="\)\)"><token type="Keyword"/><pop depth="1"/></rule>
|
||||
<rule pattern="\*\*|\|\||<<|>>|[-+*/%^|&<>]"><token type="Operator"/></rule>
|
||||
<rule pattern="\d+#[\da-zA-Z]+"><token type="LiteralNumber"/></rule>
|
||||
<rule pattern="\d+#(?! )"><token type="LiteralNumber"/></rule>
|
||||
<rule pattern="0[xX][\da-fA-F]+"><token type="LiteralNumber"/></rule>
|
||||
<rule pattern="\d+"><token type="LiteralNumber"/></rule>
|
||||
<rule pattern="[a-zA-Z_]\w*"><token type="NameVariable"/></rule>
|
||||
<rule><include state="root"/></rule>
|
||||
</state>
|
||||
<state name="backticks">
|
||||
<rule pattern="`"><token type="LiteralStringBacktick"/><pop depth="1"/></rule>
|
||||
<rule><include state="root"/></rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
|
||||
+15
-5
@@ -113,9 +113,7 @@
|
||||
<rule pattern="%=|&&|\*=|\+\+|\+=|--|-=|->|\.\.|\/=|::|<=|==|>=|!!|!=|\|\||\?[:.]">
|
||||
<token type="Operator"/>
|
||||
</rule>
|
||||
<rule pattern="[~!%^&*()+=|\[\]:;,.<>\/?-]">
|
||||
<token type="Punctuation"/>
|
||||
</rule>
|
||||
|
||||
<rule pattern="[{}]">
|
||||
<token type="Punctuation"/>
|
||||
</rule>
|
||||
@@ -137,8 +135,20 @@
|
||||
<rule pattern="'\\.'|'[^\\]'">
|
||||
<token type="LiteralStringChar"/>
|
||||
</rule>
|
||||
<rule pattern="0[xX][0-9a-fA-F]+[Uu]?[Ll]?|[0-9]+(\.[0-9]*)?([eE][+-][0-9]+)?[fF]?[Uu]?[Ll]?">
|
||||
<token type="LiteralNumber"/>
|
||||
<rule pattern="0[xX][0-9a-fA-F]+(_+[0-9a-fA-F]+)*[uU]?L?">
|
||||
<token type="LiteralNumberHex"/>
|
||||
</rule>
|
||||
<rule pattern="0[bB][01]+(_+[01]+)*[uU]?L?">
|
||||
<token type="LiteralNumberBin"/>
|
||||
</rule>
|
||||
<rule pattern="[0-9]+(_+[0-9]+)*\.[0-9]+(_+[0-9]+)*([eE][+-]?[0-9]+(_+[0-9]+)*)?[fF]?|\.[0-9]+(_+[0-9]+)*([eE][+-]?[0-9]+(_+[0-9]+)*)?[fF]?|[0-9]+(_+[0-9]+)*[eE][+-]?[0-9]+(_+[0-9]+)*[fF]?|[0-9]+(_+[0-9]+)*[fF]">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
<rule pattern="[0-9]+(_+[0-9]+)*[uU]?L?">
|
||||
<token type="LiteralNumberInteger"/>
|
||||
</rule>
|
||||
<rule pattern="[~!%^&*()+=|\[\]:;,.<>\/?-]">
|
||||
<token type="Punctuation"/>
|
||||
</rule>
|
||||
<rule pattern="(companion)(\s+)(object)">
|
||||
<bygroups>
|
||||
|
||||
+27
-32
@@ -6,24 +6,6 @@
|
||||
<ensure_nl>true</ensure_nl>
|
||||
</config>
|
||||
<rules>
|
||||
<state name="classname">
|
||||
<rule pattern="[a-zA-Z_]\w*">
|
||||
<token type="NameClass"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
</state>
|
||||
<state name="funname">
|
||||
<rule pattern="[a-zA-Z_]\w*">
|
||||
<token type="NameFunction"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
</state>
|
||||
<state name="varname">
|
||||
<rule pattern="[a-zA-Z_]\w*">
|
||||
<token type="NameVariable"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
</state>
|
||||
<state name="whitespace">
|
||||
<rule pattern="\n">
|
||||
<token type="Text"/>
|
||||
@@ -39,23 +21,39 @@
|
||||
<rule pattern="//.*?\n">
|
||||
<token type="CommentSingle"/>
|
||||
</rule>
|
||||
<rule pattern="(and|else|for|if|or|print|return|super|this|while)\b">
|
||||
<rule pattern="(and|break|case|continue|default|else|for|if|or|print|return|super|switch|this|while)\b">
|
||||
<token type="Keyword"/>
|
||||
</rule>
|
||||
<rule pattern="(false|nil|true)\b">
|
||||
<token type="KeywordConstant"/>
|
||||
</rule>
|
||||
<rule pattern="(class)(\s*)">
|
||||
<token type="KeywordDeclaration"/>
|
||||
<push state="classname"/>
|
||||
<rule pattern="(class)(\s+)([a-zA-Z_]\w*)">
|
||||
<bygroups>
|
||||
<token type="KeywordDeclaration"/>
|
||||
<token type="Text"/>
|
||||
<token type="NameClass"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="(fun)(\s*)">
|
||||
<token type="KeywordDeclaration"/>
|
||||
<push state="funname"/>
|
||||
<rule pattern="(fun)(\s+)([a-zA-Z_]\w*)">
|
||||
<bygroups>
|
||||
<token type="KeywordDeclaration"/>
|
||||
<token type="Text"/>
|
||||
<token type="NameFunction"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="(var)(\s*)">
|
||||
<token type="KeywordDeclaration"/>
|
||||
<push state="varname"/>
|
||||
<rule pattern="(const)(\s+)([a-zA-Z_]\w*)">
|
||||
<bygroups>
|
||||
<token type="KeywordDeclaration"/>
|
||||
<token type="Text"/>
|
||||
<token type="NameConstant"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="(var)(\s+)([a-zA-Z_]\w*)">
|
||||
<bygroups>
|
||||
<token type="KeywordDeclaration"/>
|
||||
<token type="Text"/>
|
||||
<token type="NameVariable"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="\d+(\.\d*|[eE][+\-]?\d+)">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
@@ -69,10 +67,7 @@
|
||||
<rule pattern="!|\+|-|\*|/|<|>|=">
|
||||
<token type="Operator"/>
|
||||
</rule>
|
||||
<rule pattern="[{(;,]">
|
||||
<token type="Punctuation"/>
|
||||
</rule>
|
||||
<rule pattern="[}).]">
|
||||
<rule pattern="[{}():;.,]">
|
||||
<token type="Punctuation"/>
|
||||
</rule>
|
||||
<rule pattern="[a-zA-Z_]\w*">
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
<lexer>
|
||||
<config>
|
||||
<name>Modelica</name>
|
||||
<alias>modelica</alias>
|
||||
<filename>*.mo</filename>
|
||||
<mime_type>text/x-modelica</mime_type>
|
||||
<dot_all>true</dot_all>
|
||||
<ensure_nl>true</ensure_nl>
|
||||
</config>
|
||||
<rules>
|
||||
<state name="root">
|
||||
<!-- Comments -->
|
||||
<rule pattern="//[^\n\r]*">
|
||||
<token type="CommentSingle"/>
|
||||
</rule>
|
||||
<rule pattern="/[*].*?[*]/">
|
||||
<token type="CommentMultiline"/>
|
||||
</rule>
|
||||
|
||||
<!-- Whitespace and newlines -->
|
||||
<rule pattern="\s+">
|
||||
<token type="Text"/>
|
||||
</rule>
|
||||
<rule pattern="\n">
|
||||
<token type="Text"/>
|
||||
</rule>
|
||||
|
||||
<!-- Keywords (Modelica specific) -->
|
||||
<rule pattern="\b(model|equation|end|extends|function|type|record|connector|parameter|constant|if|then|else|for|in|when|assert|outer|algorithm|flow|discrete|input|output|loop|elseif|return|public|protected|external|real|integer|boolean|string|array|complex|union|tuple|class|der|time|tstart|tstop)\b">
|
||||
<token type="Keyword"/>
|
||||
</rule>
|
||||
|
||||
<!-- Type definitions -->
|
||||
<rule pattern="\b(boolean|integer|real|string|array|record|complex|union|tuple)\b">
|
||||
<token type="KeywordType"/>
|
||||
</rule>
|
||||
|
||||
<!-- Preprocessor directives -->
|
||||
<rule pattern="#[ \t]*(if|else|endif|define|include|error)\b">
|
||||
<token type="CommentPreproc"/>
|
||||
</rule>
|
||||
|
||||
<!-- Literals -->
|
||||
<rule pattern="\\"[^"\n]*\\"">
|
||||
<token type="LiteralString"/>
|
||||
</rule>
|
||||
<rule pattern="'[^'\n]'">
|
||||
<token type="LiteralStringChar"/>
|
||||
</rule>
|
||||
<rule pattern="\d+(\.\d+)?([eE][+-]?\d+)?">
|
||||
<token type="LiteralNumber"/>
|
||||
</rule>
|
||||
|
||||
<!-- Identifiers and names -->
|
||||
<rule pattern="@[A-Za-z_]\w*">
|
||||
<token type="Name"/>
|
||||
</rule>
|
||||
<rule pattern="[A-Za-z_]\w*">
|
||||
<token type="Name"/>
|
||||
</rule>
|
||||
|
||||
<!-- Punctuation -->
|
||||
<rule pattern="[{}(),;=.+\-*/&|!<>^%]">
|
||||
<token type="Punctuation"/>
|
||||
</rule>
|
||||
|
||||
<!-- Operators -->
|
||||
<rule pattern="(\+|\-|\*|\/|\^|\&|\||\<|\>|\%|\=|\!=|\<\=|\>\=)">
|
||||
<token type="Operator"/>
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="function">
|
||||
<!-- Function name -->
|
||||
<rule pattern="[A-Za-z_]\w*">
|
||||
<token type="NameFunction"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
<rule>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="type">
|
||||
<!-- Type definition -->
|
||||
<rule pattern="[A-Za-z_]\w*">
|
||||
<token type="NameClass"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
<rule>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="record">
|
||||
<!-- Record definition -->
|
||||
<rule pattern="[A-Za-z_]\w*">
|
||||
<token type="NameClass"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
<rule>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
+2
@@ -6,6 +6,7 @@
|
||||
<alias>sage</alias>
|
||||
<alias>python3</alias>
|
||||
<alias>py3</alias>
|
||||
<alias>starlark</alias>
|
||||
<filename>*.py</filename>
|
||||
<filename>*.pyi</filename>
|
||||
<filename>*.pyw</filename>
|
||||
@@ -23,6 +24,7 @@
|
||||
<filename>WORKSPACE.bazel</filename>
|
||||
<filename>MODULE.bazel</filename>
|
||||
<filename>REPO.bazel</filename>
|
||||
<filename>*.star</filename>
|
||||
<filename>*.tac</filename>
|
||||
<mime_type>text/x-python</mime_type>
|
||||
<mime_type>application/x-python</mime_type>
|
||||
|
||||
+239
@@ -0,0 +1,239 @@
|
||||
<lexer>
|
||||
<config>
|
||||
<name>RGBDS Assembly</name>
|
||||
<alias>rgbasm</alias>
|
||||
<filename>*.asm</filename>
|
||||
<priority>0.5</priority>
|
||||
<case_insensitive>true</case_insensitive>
|
||||
</config>
|
||||
<rules>
|
||||
<!-- Symbol state for parsing anything between curly brackets -->
|
||||
<state name="symbol">
|
||||
<rule pattern="[^{}]+">
|
||||
<token type="NameVariable"/>
|
||||
</rule>
|
||||
<rule pattern="{">
|
||||
<token type="Punctuation"/>
|
||||
<push state="symbol"/>
|
||||
</rule>
|
||||
<rule pattern="}">
|
||||
<token type="Punctuation"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
</state>
|
||||
<!-- String states for parsing quote-delimited text that may contain symbols -->
|
||||
<state name="string">
|
||||
<rule pattern="[^{"\n\\]+">
|
||||
<token type="LiteralString"/>
|
||||
</rule>
|
||||
<rule pattern="\\.">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="{">
|
||||
<token type="Punctuation"/>
|
||||
<push state="symbol"/>
|
||||
</rule>
|
||||
<rule pattern="("|\n)">
|
||||
<token type="LiteralString"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
</state>
|
||||
<state name="stringmultiline">
|
||||
<rule pattern=""{3}">
|
||||
<token type="LiteralString"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
<rule pattern="[^{\\]+?">
|
||||
<token type="LiteralString"/>
|
||||
</rule>
|
||||
<rule pattern="\\.">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="{">
|
||||
<token type="Punctuation"/>
|
||||
<push state="symbol"/>
|
||||
</rule>
|
||||
</state>
|
||||
<!-- Root state -->
|
||||
<state name="root">
|
||||
<!-- Comments -->
|
||||
<rule pattern=";.*?$">
|
||||
<token type="CommentSingle"/>
|
||||
</rule>
|
||||
<rule pattern="/[*](.|\n)*?[*]/">
|
||||
<token type="CommentMultiline"/>
|
||||
</rule>
|
||||
<!-- Local label -->
|
||||
<rule pattern="^(\.)(\w+)(:?)">
|
||||
<bygroups>
|
||||
<token type="Punctuation"/>
|
||||
<token type="NameLabel"/>
|
||||
<token type="Punctuation"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<!-- Global label (with optional local) -->
|
||||
<rule pattern="(^\w+)(?:(\.)(\w+))?(::?)">
|
||||
<bygroups>
|
||||
<token type="NameLabel"/>
|
||||
<token type="Punctuation"/>
|
||||
<token type="NameLabel"/>
|
||||
<token type="Punctuation"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<!-- Symbols delimited by curly brackets -->
|
||||
<rule pattern="{">
|
||||
<token type="Punctuation"/>
|
||||
<push state="symbol"/>
|
||||
</rule>
|
||||
<!-- Numeric types (can contain '_' except at the beginning) -->
|
||||
<rule pattern="(0x|\$)[0-9a-fA-F][0-9a-fA-F_]*">
|
||||
<token type="LiteralNumberHex"/>
|
||||
</rule>
|
||||
<rule pattern="[0-9a-fA-F][0-9a-fA-F_]*h\b">
|
||||
<token type="LiteralNumberHex"/>
|
||||
</rule>
|
||||
<rule pattern="(0o|&)[0-7][0-7_]*">
|
||||
<token type="LiteralNumberOct"/>
|
||||
</rule>
|
||||
<rule pattern="(0b|%)[01][01_]*">
|
||||
<token type="LiteralNumberBin"/>
|
||||
</rule>
|
||||
<rule pattern="-?[0-9][0-9_]*\.[0-9_]+(q[0-9]+)?">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
<rule pattern="-?[0-9][0-9_]*">
|
||||
<token type="LiteralNumberInteger"/>
|
||||
</rule>
|
||||
<!-- "Game Boy graphics" format, which can be made of user-defined symbols -->
|
||||
<rule pattern="`[^\s]+">
|
||||
<token type="LiteralNumberInteger"/>
|
||||
</rule>
|
||||
<!-- #-prefixed raw string (multiline) -->
|
||||
<rule pattern="(#)("{3}(?:.|\n)*?"{3})">
|
||||
<bygroups>
|
||||
<token type="LiteralStringAffix"/>
|
||||
<token type="LiteralString"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<!-- #-prefixed raw string -->
|
||||
<rule pattern="(#)(".*?")">
|
||||
<bygroups>
|
||||
<token type="LiteralStringAffix"/>
|
||||
<token type="LiteralString"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<!-- Start of quote-delimited (non-raw) strings -->
|
||||
<rule pattern=""{3}">
|
||||
<token type="LiteralString"/>
|
||||
<push state="stringmultiline"/>
|
||||
</rule>
|
||||
<rule pattern=""">
|
||||
<token type="LiteralString"/>
|
||||
<push state="string"/>
|
||||
</rule>
|
||||
<!-- Macro arguments (single character) -->
|
||||
<rule pattern="\\[1-9@#]">
|
||||
<token type="NameVariableMagic"/>
|
||||
</rule>
|
||||
<!-- Macro arguments (bracketed) -->
|
||||
<rule pattern="(\\<)([^>]+)(>)">
|
||||
<bygroups>
|
||||
<token type="NameVariableMagic"/>
|
||||
<usingself state="root"/>
|
||||
<token type="NameVariableMagic"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<!-- LDI/LDD alternate formats -->
|
||||
<rule pattern="(\[)(hl\+|hl-|hli|hld)(\])">
|
||||
<bygroups>
|
||||
<token type="Punctuation"/>
|
||||
<token type="Keyword"/>
|
||||
<token type="Punctuation"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<!-- Punctuation (excluding period which is used in predeclared symbols) -->
|
||||
<rule pattern="[\[\],()\\:]">
|
||||
<token type="Punctuation"/>
|
||||
</rule>
|
||||
<!-- Variable definitions that can contain RL, which is also an opcode -->
|
||||
<rule pattern="((?:re)?def)([\t ]+)([\w{}:]+)([\t ]+)(rb|rw|rl|equs|equ)?">
|
||||
<bygroups>
|
||||
<token type="NameBuiltin"/>
|
||||
<token type="TextWhitespace"/>
|
||||
<usingself state="root"/>
|
||||
<token type="TextWhitespace"/>
|
||||
<token type="NameBuiltin"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<!-- Specific rule for some names that are both built-ins and functions -->
|
||||
<rule pattern="\b(bank|section)(\()\b">
|
||||
<bygroups>
|
||||
<token type="NameFunction"/>
|
||||
<token type="Punctuation"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<!-- Specific rule for options redefinitions -->
|
||||
<rule pattern="\b(opt|pusho)([\t ]+)([^,\s]+)(?:(,)([\t ]*)([^,\s]+))*">
|
||||
<bygroups>
|
||||
<token type="NameBuiltin"/>
|
||||
<token type="TextWhitespace"/>
|
||||
<token type="Literal"/>
|
||||
<token type="Punctuation"/>
|
||||
<token type="TextWhitespace"/>
|
||||
<token type="Literal"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<!-- Predeclared symbols -->
|
||||
<rule pattern="\b(_rs|_narg|__date__|__time__|__iso_8601_local__|__iso_8601_utc__|__utc_year__|__utc_month__|__utc_day__|__utc_hour__|__utc_minute__|__utc_second__|__rgbds_major__|__rgbds_minor__|__rgbds_patch__|__rgbds_rc__|__rgbds_version__)\b">
|
||||
<token type="NameVariableMagic"/>
|
||||
</rule>
|
||||
<!-- Built-in statements -->
|
||||
<rule pattern="\b(align|assert|bank|break|charmap|db|dl|ds|dw|elif|else|endc|endl|endm|endr|endsection|endu|export|fail|fatal|for|fragment|hram|if|incbin|include|load|macro|newcharmap|nextu|oam|popc|popo|pops|println|print|purge|pushc|pusho|pushs|redef|rept|rom0|romx|rsreset|rsset|section|setcharmap|shift|sram|static_assert|union|vram|warn|wram0|wramx)">
|
||||
<token type="NameBuiltin"/>
|
||||
</rule>
|
||||
<!-- Integer functions -->
|
||||
<rule pattern="\b(high|low|bitwidth|tzcount)\b">
|
||||
<token type="NameFunction"/>
|
||||
</rule>
|
||||
<!-- Fixed-point functions -->
|
||||
<rule pattern="\b(div|mul|fmod|pow|log|round|ceil|floor|sin|cos|tan|asin|acos|atan|atan2)\b">
|
||||
<token type="NameFunction"/>
|
||||
</rule>
|
||||
<!-- String functions -->
|
||||
<rule pattern="\b(strcat|strupr|strlwr|strslice|strrpl|strfmt|strchar|revchar|strlen|strcmp|strfind|strrfind|incharmap|charlen|charcmp|charsize|strsub|strin|strrin|charsub)\b">
|
||||
<token type="NameFunction"/>
|
||||
</rule>
|
||||
<!-- Other functions, excluding some that are the same as built-ins (BANK and SECTION) -->
|
||||
<rule pattern="\b(def|isconst|sizeof|startof)">
|
||||
<token type="NameFunction"/>
|
||||
</rule>
|
||||
<!-- Opcodes -->
|
||||
<rule pattern="\b(adc|add|and|bit|call|ccf|cp|cpl|daa|dec|di|ei|halt|inc|jp|jr|ld|ldd|ldh|ldi|nop|or|pop|push|res|ret|reti|rlca|rla|rlc|rl|rr|rra|rrc|rrca|rst|sbc|scf|set|sla|sra|srl|stop|sub|swap|xor)\b">
|
||||
<token type="Keyword"/>
|
||||
</rule>
|
||||
<!-- Registers and flags -->
|
||||
<rule pattern="\b(a|f|b|c|d|e|h|l|af|bc|de|hl|sp|pc|z|nz|nc)\b">
|
||||
<token type="Keyword"/>
|
||||
</rule>
|
||||
<!-- Operators -->
|
||||
<rule pattern="[-%!+/*~\^&|=<>]">
|
||||
<token type="Operator"/>
|
||||
</rule>
|
||||
<!-- Reference to label -->
|
||||
<rule pattern="(\.)?(\w+)">
|
||||
<bygroups>
|
||||
<token type="Punctuation"/>
|
||||
<token type="Name"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<!-- Predeclared symbols (non-words) -->
|
||||
<rule pattern="(@|\.|\.\.)">
|
||||
<token type="NameVariableMagic"/>
|
||||
</rule>
|
||||
<!-- Default text -->
|
||||
<rule pattern="\s+">
|
||||
<token type="TextWhitespace"/>
|
||||
</rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
<lexer>
|
||||
<config>
|
||||
<name>Ring</name>
|
||||
<alias>ring</alias>
|
||||
<filename>*.ring</filename>
|
||||
<filename>*.rh</filename>
|
||||
<filename>*.rform</filename>
|
||||
<mime_type>text/x-ring</mime_type>
|
||||
<case_insensitive>true</case_insensitive>
|
||||
</config>
|
||||
<rules>
|
||||
<state name="root">
|
||||
<rule pattern="\s+"><token type="Text"/></rule>
|
||||
<rule pattern="//.*?\n"><token type="CommentSingle"/></rule>
|
||||
<rule pattern="#.*?\n"><token type="CommentSingle"/></rule>
|
||||
<rule pattern="/\*"><token type="CommentMultiline"/><push state="comment"/></rule>
|
||||
<rule pattern="^\s*(changeringkeyword|changeringoperator|disablehashcomments|enablehashcomments|loadsyntax)\b"><token type="CommentPreproc"/></rule>
|
||||
<rule pattern=":[a-zA-Z_@$][\w@$]*"><token type="LiteralStringSymbol"/></rule>
|
||||
<rule pattern="""><token type="LiteralStringDouble"/><push state="string-double"/></rule>
|
||||
<rule pattern="'"><token type="LiteralStringSingle"/><push state="string-single"/></rule>
|
||||
<rule pattern="`"><token type="LiteralStringBacktick"/><push state="string-backtick"/></rule>
|
||||
<rule pattern="(\bclass)(\s+)(\w+)"><bygroups><token type="KeywordDeclaration"/><token type="Text"/><token type="NameClass"/></bygroups></rule>
|
||||
<rule pattern="(\bfrom)(\s+)(\w+)"><bygroups><token type="KeywordDeclaration"/><token type="Text"/><token type="NameClass"/></bygroups></rule>
|
||||
<rule pattern="(\bfunc|def|function)(\s+)(\w+)"><bygroups><token type="KeywordDeclaration"/><token type="Text"/><token type="NameFunction"/></bygroups></rule>
|
||||
<rule pattern="(\bpackage|import)(\s+)([a-zA-Z_@$][\w@$.]*)"><bygroups><token type="KeywordNamespace"/><token type="Text"/><token type="NameNamespace"/></bygroups></rule>
|
||||
<rule pattern="(\bnew)(\s+)(\w+)"><bygroups><token type="KeywordPseudo"/><token type="Text"/><token type="NameClass"/></bygroups></rule>
|
||||
<rule pattern="\b(if|but|elseif|else|other|ok|endif|end|switch|on|case|off|endswitch|for|in|to|step|next|endfor|foreach|while|endwhile|do|again|return|bye|exit|break|loop|continue|call)\b"><token type="Keyword"/></rule>
|
||||
<rule pattern="\b(try|catch|done|endtry)\b"><token type="Keyword"/></rule>
|
||||
<rule pattern="\b(class|endclass|from|func|def|function|endfunc|endfunction|package|endpackage|private)\b"><token type="KeywordDeclaration"/></rule>
|
||||
<rule pattern="\b(load|import)\b"><token type="KeywordNamespace"/></rule>
|
||||
<rule pattern="\b(new|self|this|super)\b"><token type="KeywordPseudo"/></rule>
|
||||
<rule pattern="\b(see|put|give|get)\b"><token type="Keyword"/></rule>
|
||||
<rule pattern="\b(true|false|nl|null|tab|cr|sysargv|ccatcherror|ringoptionalfunctions)\b"><token type="NameBuiltinPseudo"/></rule>
|
||||
<rule pattern="\b(and|or|not)\b"><token type="OperatorWord"/></rule>
|
||||
<rule pattern="\b(acos|add|addattribute|adddays|addmethod|ascii|asin|assert|atan|atan2|attributes|binarysearch|bytes2double|bytes2float|bytes2int|callgarbagecollector|callgc|ceil|cfunctions|char|chdir|checkoverflow|classes|classname|clearerr|clock|clockspersecond|closelib|copy|cos|cosh|currentdir|date|dec|decimals|del|diffdays|dir|direxists|double2bytes|eval|exefilename|exefolder|exp|fabs|fclose|feof|ferror|fexists|fflush|fgetc|fgetpos|fgets|filename|find|float2bytes|floor|fopen|fputc|fputs|fread|freopen|fseek|fsetpos|ftell|functions|fwrite|getarch|getattribute|getchar|getfilesize|getnumber|getpathtype|getpointer|getptr|getstring|globals|hex|hex2str|importpackage|input|insert|int2bytes|intvalue|isalnum|isalpha|isandroid|isattribute|iscfunction|isclass|iscntrl|isdigit|isfreebsd|isfunction|isglobal|isgraph|islinux|islist|islocal|islower|ismacosx|ismethod|ismsdos|isnull|isnumber|isobject|ispackage|ispackageclass|ispointer|isprint|isprivateattribute|isprivatemethod|ispunct|isspace|isstring|isunix|isupper|iswindows|iswindows64|isxdigit|left|len|lines|list|list2str|loadlib|locals|log|log10|lower|max|memcpy|memorycopy|mergemethods|methods|min|murmur3hash|newlist|nofprocessors|nothing|nullpointer|nullptr|number|obj2ptr|object2pointer|objectid|optionalfunc|packageclasses|packagename|packages|parentclassname|perror|pointer2object|pointer2string|pointercompare|pow|prevfilename|print|print2str|ptr2obj|ptr2str|ptrcmp|puts|raise|random|randomize|read|ref|reference|refcount|remove|rename|reverse|rewind|right|ring_give|ring_see|ring_state_delete|ring_state_filetokens|ring_state_findvar|ring_state_init|ring_state_main|ring_state_mainfile|ring_state_new|ring_state_newvar|ring_state_resume|ring_state_runcode|ring_state_runcodeatins|ring_state_runfile|ring_state_runobjectfile|ring_state_scannererror|ring_state_setvar|ring_state_stringtokens|ringvm_callfunc|ringvm_calllist|ringvm_cfunctionslist|ringvm_classeslist|ringvm_codelist|ringvm_evalinscope|ringvm_fileslist|ringvm_functionslist|ringvm_genarray|ringvm_give|ringvm_hideerrormsg|ringvm_info|ringvm_ismempool|ringvm_memorylist|ringvm_packageslist|ringvm_passerror|ringvm_runcode|ringvm_scopescount|ringvm_see|ringvm_settrace|ringvm_tracedata|ringvm_traceevent|ringvm_tracefunc|setattribute|setpointer|setptr|shutdown|sin|sinh|sort|space|sqrt|srandom|str2hex|str2hexcstyle|str2list|strcmp|string|substr|swap|sysget|sysset|syssleep|system|sysunset|tan|tanh|tempfile|tempname|time|timelist|trim|type|ungetc|unsigned|upper|uptime|variablepointer|varptr|version|windowsnl|write)\b(?=\s*\()"><token type="NameBuiltin"/></rule>
|
||||
<rule pattern="0x[a-f0-9_]+"><token type="LiteralNumberHex"/></rule>
|
||||
<rule pattern="0b[01_]+"><token type="LiteralNumberBin"/></rule>
|
||||
<rule pattern="0o[0-7_]+"><token type="LiteralNumberOct"/></rule>
|
||||
<rule pattern="[0-9]+(?:_[0-9]+)*\.[0-9]*(?:_[0-9]+)*([eE][-+]?[0-9]+)?"><token type="LiteralNumberFloat"/></rule>
|
||||
<rule pattern="[0-9]+(?:_[0-9]+)*"><token type="LiteralNumberInteger"/></rule>
|
||||
<rule pattern="(\+\+|\-\-|\*\*|\^\^|!=|<=|>=|<<|>>|&&|\|\|)"><token type="Operator"/></rule>
|
||||
<rule pattern="(\+=|-=|\*=|/=|%=|<<=|>>=|&=|\|=|\^=)"><token type="Operator"/></rule>
|
||||
<rule pattern="[-+/*%=<>&|!~.:^?]"><token type="Operator"/></rule>
|
||||
<rule pattern="[\[\](){},;]"><token type="Punctuation"/></rule>
|
||||
<rule pattern="[a-zA-Z_@$][\w@$]*"><token type="Name"/></rule>
|
||||
</state>
|
||||
<state name="comment">
|
||||
<rule pattern="[^*/]+"><token type="CommentMultiline"/></rule>
|
||||
<rule pattern="/\*"><token type="CommentMultiline"/><push/></rule>
|
||||
<rule pattern="\*/"><token type="CommentMultiline"/><pop depth="1"/></rule>
|
||||
<rule pattern="[*/]"><token type="CommentMultiline"/></rule>
|
||||
</state>
|
||||
<state name="string-double">
|
||||
<rule pattern="[^"#]+"><token type="LiteralStringDouble"/></rule>
|
||||
<rule pattern="#\{"><token type="LiteralStringInterpol"/><push state="interpolation"/></rule>
|
||||
<rule pattern="""><token type="LiteralStringDouble"/><pop depth="1"/></rule>
|
||||
</state>
|
||||
<state name="string-single">
|
||||
<rule pattern="[^'#]+"><token type="LiteralStringSingle"/></rule>
|
||||
<rule pattern="#\{"><token type="LiteralStringInterpol"/><push state="interpolation"/></rule>
|
||||
<rule pattern="'"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
|
||||
</state>
|
||||
<state name="string-backtick">
|
||||
<rule pattern="[^`#]+"><token type="LiteralStringBacktick"/></rule>
|
||||
<rule pattern="#\{"><token type="LiteralStringInterpol"/><push state="interpolation"/></rule>
|
||||
<rule pattern="`"><token type="LiteralStringBacktick"/><pop depth="1"/></rule>
|
||||
</state>
|
||||
<state name="interpolation">
|
||||
<rule pattern="\}"><token type="LiteralStringInterpol"/><pop depth="1"/></rule>
|
||||
<rule><include state="root"/></rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
<mime_type>text/x-sqlrpgle</mime_type>
|
||||
<case_insensitive>true</case_insensitive>
|
||||
<analyse>
|
||||
<regex pattern="^\*\*free$" score="0.9"/>
|
||||
<regex pattern="\*\*free" score="0.9"/>
|
||||
<regex pattern="ctl-opt" score="0.9"/>
|
||||
<regex pattern="dcl-(ds|s|f|proc|pr|pi)" score="0.9"/>
|
||||
<regex pattern="\*in[0-9][0-9]" score="0.5"/>
|
||||
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
<lexer>
|
||||
<config>
|
||||
<name>Protocol Buffer Text Format</name>
|
||||
<alias>txtpb</alias>
|
||||
<filename>*.txtpb</filename>
|
||||
<filename>*.textproto</filename>
|
||||
<filename>*.textpb</filename>
|
||||
<filename>*.pbtxt</filename>
|
||||
<mime_type>application/x-protobuf-text</mime_type>
|
||||
<case_insensitive>false</case_insensitive>
|
||||
<dot_all>false</dot_all>
|
||||
<ensure_nl>true</ensure_nl>
|
||||
</config>
|
||||
<rules>
|
||||
<state name="double-quote">
|
||||
<rule pattern="\\[abfnrtv\\\?'"]">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\[0-7]{1,3}">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\x[0-9a-fA-F]{1,2}">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\u[0-9a-fA-F]{4}">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\U000[0-9a-fA-F]{5}">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\U0010[0-9a-fA-F]{4}">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="[^"\\]+">
|
||||
<token type="LiteralStringDouble"/>
|
||||
</rule>
|
||||
<rule pattern=""">
|
||||
<token type="LiteralStringDouble"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="single-quote">
|
||||
<rule pattern="\\[abfnrtv\\\?'"]">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\[0-7]{1,3}">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\x[0-9a-fA-F]{1,2}">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\u[0-9a-fA-F]{4}">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\U000[0-9a-fA-F]{5}">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\U0010[0-9a-fA-F]{4}">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="[^'\\]+">
|
||||
<token type="LiteralStringSingle"/>
|
||||
</rule>
|
||||
<rule pattern="'">
|
||||
<token type="LiteralStringSingle"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
</state>
|
||||
|
||||
<state name="root">
|
||||
<!-- Comments -->
|
||||
<rule pattern="#.*\n">
|
||||
<token type="CommentSingle"/>
|
||||
</rule>
|
||||
|
||||
<!-- Whitespace -->
|
||||
<rule pattern="[ \n\t\v\f\r]+">
|
||||
<token type="Text"/>
|
||||
</rule>
|
||||
|
||||
<!-- Operators -->
|
||||
<rule pattern="-">
|
||||
<token type="Operator" />
|
||||
</rule>
|
||||
|
||||
<!-- Special float literals -->
|
||||
<rule pattern="(?i)(?:inf|infinity)\b">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
<rule pattern="(?i)nan\b">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
|
||||
<!-- Float literals with suffix (must come before decimal integers) -->
|
||||
<rule pattern="(?:0|[1-9][0-9]*)[fF]">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
|
||||
<!-- Float literals -->
|
||||
<rule pattern="\.[0-9]+(?:[eE][+-]?[0-9]+)?[fF]?">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
<rule pattern="(?:0|[1-9][0-9]*)\.[0-9]*(?:[eE][+-]?[0-9]+)?[fF]?">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
<rule pattern="(?:0|[1-9][0-9]*)[eE][+-]?[0-9]+[fF]?">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
|
||||
<!-- Hexadecimal integers -->
|
||||
<rule pattern="0[xX][0-9a-fA-F]+">
|
||||
<token type="LiteralNumberHex"/>
|
||||
</rule>
|
||||
|
||||
<!-- Octal integers -->
|
||||
<rule pattern="0[0-7]+">
|
||||
<token type="LiteralNumberOct"/>
|
||||
</rule>
|
||||
|
||||
<!-- Decimal integers -->
|
||||
<rule pattern="(?:0|[1-9][0-9]*)">
|
||||
<token type="LiteralNumberInteger"/>
|
||||
</rule>
|
||||
|
||||
<!-- Boolean keywords -->
|
||||
<rule pattern="\b(?:[Tt]rue|[Ff]alse|t|f)\b">
|
||||
<token type="KeywordConstant"/>
|
||||
</rule>
|
||||
|
||||
<!-- Strings -->
|
||||
<rule pattern=""">
|
||||
<token type="LiteralStringDouble"/>
|
||||
<push state="double-quote"/>
|
||||
</rule>
|
||||
<rule pattern="'">
|
||||
<token type="LiteralStringSingle"/>
|
||||
<push state="single-quote"/>
|
||||
</rule>
|
||||
|
||||
<!-- Qualified names (with dots) for field paths and type URLs -->
|
||||
<rule pattern="[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)+">
|
||||
<token type="NameNamespace"/>
|
||||
</rule>
|
||||
|
||||
<!-- Field names and identifiers (including enum values) -->
|
||||
<rule pattern="[a-zA-Z_][a-zA-Z0-9_]*">
|
||||
<token type="Name"/>
|
||||
</rule>
|
||||
|
||||
<!-- URL paths in type URLs for Any expansion -->
|
||||
<rule pattern="/[a-zA-Z_][a-zA-Z0-9_/.]*">
|
||||
<token type="NameNamespace"/>
|
||||
</rule>
|
||||
|
||||
<!-- Punctuation -->
|
||||
<rule pattern="[:;,<>\[\]{}]">
|
||||
<token type="Punctuation"/>
|
||||
</rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
<lexer>
|
||||
<config>
|
||||
<name>WebAssembly Text Format</name>
|
||||
<alias>wast</alias>
|
||||
<alias>wat</alias>
|
||||
<filename>*.wat</filename>
|
||||
<filename>*.wast</filename>
|
||||
</config>
|
||||
<rules>
|
||||
<state name="root">
|
||||
<rule pattern="(module|import|func|funcref|start|param|local|type|result|export|memory|global|mut|data|table|elem|if|then|else|end|block|loop)(?=[^a-z_\.])">
|
||||
<token type="Keyword"/>
|
||||
</rule>
|
||||
<rule pattern="(unreachable|nop|block|loop|if|else|end|br(?:_if|_table)?|return|call(?:_indirect)?|drop|select|local\.get|local\.set|local\.tee|global\.get|global\.set|i32\.load(?:(?:8|16)_(?:u|s))?|i64\.load(?:(?:8|16|32)_(?:u|s))?|f32\.load|f64\.load|i32\.store(?:8|16)?|i64\.store(:?8|16|32)?|f32\.store|f64\.store|memory\.size|memory\.grow|memory\.fill|memory\.copy|memory\.init|i32\.const|i64\.const|f32\.const|f64\.const|i32\.eqz|i32\.eq|i32\.ne|i32\.lt_s|i32\.lt_u|i32\.gt_s|i32\.gt_u|i32\.le_s|i32\.le_u|i32\.ge_s|i32\.ge_u|i64\.eqz|i64\.eq|i64\.ne|i64\.lt_s|i64\.lt_u|i64\.gt_s|i64\.gt_u|i64\.le_s|i64\.le_u|i64\.ge_s|i64\.ge_u|f32\.eq|f32\.neg?|f32\.lt|f32\.gt|f32\.le|f32\.ge|f64\.eq|f64\.neg?|f64\.lt|f64\.gt|f64\.le|f64\.ge|i32\.clz|i32\.ctz|i32\.popcnt|i32\.add|i32\.sub|i32\.mul|i32\.div_s|i32\.div_u|i32\.rem_s|i32\.rem_u|i32\.and|i32\.or|i32\.xor|i32\.shl|i32\.shr_s|i32\.shr_u|i32\.rotl|i32\.rotr|i64\.clz|i64\.ctz|i64\.popcnt|i64\.add|i64\.sub|i64\.mul|i64\.div_s|i64\.div_u|i64\.rem_s|i64\.rem_u|i64\.and|i64\.or|i64\.xor|i64\.shl|i64\.shr_s|i64\.shr_u|i64\.rotl|i64\.rotr|f32\.abs|f32\.ceil|f32\.floor|f32\.trunc|f32\.nearest|f32\.sqrt|f32\.add|f32\.sub|f32\.mul|f32\.div|f32\.min|f32\.max|f32\.copysign|f64\.abs|f64\.ceil|f64\.floor|f64\.trunc|f64\.nearest|f64\.sqrt|f64\.add|f64\.sub|f64\.mul|f64\.div|f64\.min|f64\.max|f64\.copysign|i32\.wrap_i64|i32\.trunc_f32_s|i32\.trunc_f32_u|i32\.trunc_f64_s|i32\.trunc_f64_u|i64\.extend(?:(?:8|16|32)_s|_i(?:32|64)_(?:u|s))|i32\.extend(?:8|16)_s|(?:i32|i64)\.trunc(?:_sat)?_f(?:32|64)_(?:s|u)|f32\.convert_i32_s|f32\.convert_i32_u|f32\.convert_i64_s|f32\.convert_i64_u|f32\.demote_f64|f64\.convert_i32_s|f64\.convert_i32_u|f64\.convert_i64_s|f64\.convert_i64_u|f64\.promote_f32|i32\.reinterpret_f32|i64\.reinterpret_f64|f32\.reinterpret_i32|f64\.reinterpret_i64)">
|
||||
<token type="NameBuiltin"/>
|
||||
<push state="arguments"/>
|
||||
</rule>
|
||||
<rule pattern="(i32|i64|f32|f64)">
|
||||
<token type="KeywordType"/>
|
||||
</rule>
|
||||
<rule pattern="\$[A-Za-z0-9!#$%&\'*+./:<=>?@\\^_`|~-]+">
|
||||
<token type="NameVariable"/>
|
||||
</rule>
|
||||
<rule pattern=";;.*?$">
|
||||
<token type="CommentSingle"/>
|
||||
</rule>
|
||||
<rule pattern="\(;">
|
||||
<token type="CommentMultiline"/>
|
||||
<push state="nesting_comment"/>
|
||||
</rule>
|
||||
<rule pattern="[+-]?0x[\dA-Fa-f](_?[\dA-Fa-f])*(.([\dA-Fa-f](_?[\dA-Fa-f])*)?)?([pP][+-]?[\dA-Fa-f](_?[\dA-Fa-f])*)?">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
<rule pattern="[+-]?\d.\d(_?\d)*[eE][+-]?\d(_?\d)*">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
<rule pattern="[+-]?\d.\d(_?\d)*">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
<rule pattern="[+-]?\d.[eE][+-]?\d(_?\d)*">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
<rule pattern="[+-]?(inf|nan:0x[\dA-Fa-f](_?[\dA-Fa-f])*|nan)">
|
||||
<token type="LiteralNumberFloat"/>
|
||||
</rule>
|
||||
<rule pattern="[+-]?0x[\dA-Fa-f](_?[\dA-Fa-f])*">
|
||||
<token type="LiteralNumberHex"/>
|
||||
</rule>
|
||||
<rule pattern="[+-]?\d(_?\d)*">
|
||||
<token type="LiteralNumberInteger"/>
|
||||
</rule>
|
||||
<rule pattern="[\(\)]">
|
||||
<token type="Punctuation"/>
|
||||
</rule>
|
||||
<rule pattern=""">
|
||||
<token type="LiteralStringDouble"/>
|
||||
<push state="string"/>
|
||||
</rule>
|
||||
<rule pattern="\s+">
|
||||
<token type="Text"/>
|
||||
</rule>
|
||||
</state>
|
||||
<state name="nesting_comment">
|
||||
<rule pattern="\(;">
|
||||
<token type="CommentMultiline"/>
|
||||
<push/>
|
||||
</rule>
|
||||
<rule pattern=";\)">
|
||||
<token type="CommentMultiline"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
<rule pattern="[^;(]+">
|
||||
<token type="CommentMultiline"/>
|
||||
</rule>
|
||||
<rule pattern="[;(]">
|
||||
<token type="CommentMultiline"/>
|
||||
</rule>
|
||||
</state>
|
||||
<state name="string">
|
||||
<rule pattern="\\[\dA-Fa-f][\dA-Fa-f]">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\t">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\n">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\r">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\"">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\'">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\u\{[\dA-Fa-f](_?[\dA-Fa-f])*\}">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern="\\\\">
|
||||
<token type="LiteralStringEscape"/>
|
||||
</rule>
|
||||
<rule pattern=""">
|
||||
<token type="LiteralStringDouble"/>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
<rule pattern="[^"\\]+">
|
||||
<token type="LiteralStringDouble"/>
|
||||
</rule>
|
||||
</state>
|
||||
<state name="arguments">
|
||||
<rule pattern="\s+">
|
||||
<token type="Text"/>
|
||||
</rule>
|
||||
<rule pattern="(offset)(=)(0x[\dA-Fa-f](?:_?[\dA-Fa-f])*)">
|
||||
<bygroups>
|
||||
<token type="Keyword"/>
|
||||
<token type="Operator"/>
|
||||
<token type="LiteralNumberHex"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="(offset)(=)(\d(?:_?\d)*)">
|
||||
<bygroups>
|
||||
<token type="Keyword"/>
|
||||
<token type="Operator"/>
|
||||
<token type="LiteralNumberInteger"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="(align)(=)(0x[\dA-Fa-f](?:_?[\dA-Fa-f])*)">
|
||||
<bygroups>
|
||||
<token type="Keyword"/>
|
||||
<token type="Operator"/>
|
||||
<token type="LiteralNumberHex"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule pattern="(align)(=)(\d(?:_?\d)*)">
|
||||
<bygroups>
|
||||
<token type="Keyword"/>
|
||||
<token type="Operator"/>
|
||||
<token type="LiteralNumberInteger"/>
|
||||
</bygroups>
|
||||
</rule>
|
||||
<rule>
|
||||
<pop depth="1"/>
|
||||
</rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
+5
-1
@@ -150,8 +150,12 @@ func NewXMLLexer(from fs.FS, path string) (*RegexLexer, error) {
|
||||
|
||||
regexAnalysers := make([]regexAnalyse, 0, len(config.Analyse.Regexes))
|
||||
|
||||
regexFlags := regexp2.None
|
||||
if config.CaseInsensitive {
|
||||
regexFlags = regexp2.IgnoreCase
|
||||
}
|
||||
for _, ra := range config.Analyse.Regexes {
|
||||
re, err := regexp2.Compile(ra.Pattern, regexp2.None)
|
||||
re, err := regexp2.Compile(ra.Pattern, regexFlags)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %q is not a valid analyser regex: %w", config.Name, ra.Pattern, err)
|
||||
}
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
<style name="ashen">
|
||||
<entry type="Background" style="#b4b4b4 bg:#121212"/>
|
||||
<entry type="Comment" style="#737373 italic"/>
|
||||
<entry type="Error" style="#C53030"/>
|
||||
<entry type="Generic" style="#b4b4b4"/>
|
||||
<entry type="GenericDeleted" style="#C53030"/>
|
||||
<entry type="GenericEmph" style="#b4b4b4 underline"/>
|
||||
<entry type="GenericError" style="#C53030"/>
|
||||
<entry type="GenericHeading" style="#DF6464 bold"/>
|
||||
<entry type="GenericInserted" style="#b4b4b4 bold"/>
|
||||
<entry type="GenericOutput" style="#949494"/>
|
||||
<entry type="GenericPrompt" style="#D87C4A"/>
|
||||
<entry type="GenericStrong" style="#b4b4b4 bold"/>
|
||||
<entry type="GenericSubheading" style="#DF6464 bold"/>
|
||||
<entry type="GenericTraceback" style="#b4b4b4"/>
|
||||
<entry type="Keyword" style="#B14242"/>
|
||||
<entry type="KeywordConstant" style="#4A8B8B"/>
|
||||
<entry type="KeywordDeclaration" style="#B14242 italic"/>
|
||||
<entry type="KeywordNamespace" style="#B14242"/>
|
||||
<entry type="KeywordPseudo" style="#B14242"/>
|
||||
<entry type="KeywordReserved" style="#B14242"/>
|
||||
<entry type="KeywordType" style="#4A8B8B"/>
|
||||
<entry type="Literal" style="#b4b4b4"/>
|
||||
<entry type="LiteralDate" style="#b4b4b4"/>
|
||||
<entry type="LiteralNumber" style="#4A8B8B"/>
|
||||
<entry type="LiteralNumberBin" style="#4A8B8B"/>
|
||||
<entry type="LiteralNumberFloat" style="#4A8B8B"/>
|
||||
<entry type="LiteralNumberHex" style="#4A8B8B"/>
|
||||
<entry type="LiteralNumberInteger" style="#4A8B8B"/>
|
||||
<entry type="LiteralNumberIntegerLong" style="#4A8B8B"/>
|
||||
<entry type="LiteralNumberOct" style="#4A8B8B"/>
|
||||
<entry type="LiteralString" style="#DF6464"/>
|
||||
<entry type="LiteralStringBacktick" style="#DF6464"/>
|
||||
<entry type="LiteralStringChar" style="#DF6464"/>
|
||||
<entry type="LiteralStringDoc" style="#DF6464"/>
|
||||
<entry type="LiteralStringDouble" style="#DF6464"/>
|
||||
<entry type="LiteralStringEscape" style="#d5d5d5"/>
|
||||
<entry type="LiteralStringHeredoc" style="#DF6464"/>
|
||||
<entry type="LiteralStringInterpol" style="#DF6464"/>
|
||||
<entry type="LiteralStringOther" style="#DF6464"/>
|
||||
<entry type="LiteralStringRegex" style="#D87C4A"/>
|
||||
<entry type="LiteralStringSingle" style="#DF6464"/>
|
||||
<entry type="LiteralStringSymbol" style="#DF6464"/>
|
||||
<entry type="Name" style="#b4b4b4"/>
|
||||
<entry type="NameAttribute" style="#a7a7a7"/>
|
||||
<entry type="NameBuiltin" style="#4A8B8B"/>
|
||||
<entry type="NameBuiltinPseudo" style="#B14242"/>
|
||||
<entry type="NameClass" style="#4A8B8B"/>
|
||||
<entry type="NameConstant" style="#4A8B8B"/>
|
||||
<entry type="NameDecorator" style="#b4b4b4 italic bold"/>
|
||||
<entry type="NameEntity" style="#4A8B8B"/>
|
||||
<entry type="NameException" style="#4A8B8B"/>
|
||||
<entry type="NameFunction" style="#b4b4b4"/>
|
||||
<entry type="NameLabel" style="#b4b4b4"/>
|
||||
<entry type="NameNamespace" style="#D87C4A bold"/>
|
||||
<entry type="NameOther" style="#d5d5d5"/>
|
||||
<entry type="NameTag" style="#D87C4A italic"/>
|
||||
<entry type="NameVariable" style="#b4b4b4"/>
|
||||
<entry type="NameVariableClass" style="#b4b4b4"/>
|
||||
<entry type="NameVariableGlobal" style="#b4b4b4"/>
|
||||
<entry type="NameVariableInstance" style="#b4b4b4"/>
|
||||
<entry type="Operator" style="#D87C4A"/>
|
||||
<entry type="OperatorWord" style="#D87C4A"/>
|
||||
<entry type="Other" style="#b4b4b4"/>
|
||||
<entry type="Punctuation" style="#d5d5d5"/>
|
||||
<entry type="Text" style="#b4b4b4"/>
|
||||
<entry type="TextWhitespace" style="#b4b4b4"/>
|
||||
</style>
|
||||
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
<!--
|
||||
# Aura Theme Dark Soft > Color scheme for Chroma syntax highlighter
|
||||
# Repository: https://github.com/daltonmenezes/aura-theme
|
||||
# Theme version: 1.0.1
|
||||
-->
|
||||
|
||||
<style name="aura-theme-dark-soft">
|
||||
<!-- Base -->
|
||||
<entry type="Background" style="bg:#15141b #bdbdbd"/>
|
||||
<entry type="CodeLine" style="#bdbdbd"/>
|
||||
<entry type="Error" style="#c55858"/>
|
||||
<entry type="Other" style="#bdbdbd"/>
|
||||
<entry type="LineTableTD" style=""/>
|
||||
<entry type="LineTable" style=""/>
|
||||
<entry type="LineHighlight" style="bg:#29263c"/>
|
||||
<entry type="LineNumbersTable" style="#6d6d6d"/>
|
||||
<entry type="LineNumbers" style="#6d6d6d"/>
|
||||
|
||||
<!-- Keywords -->
|
||||
<entry type="Keyword" style="#8464c6"/>
|
||||
<entry type="KeywordReserved" style="#8464c6"/>
|
||||
<entry type="KeywordPseudo" style="#8464c6"/>
|
||||
<entry type="KeywordConstant" style="#54c59f"/>
|
||||
<entry type="KeywordDeclaration" style="#8464c6"/>
|
||||
<entry type="KeywordNamespace" style="#8464c6"/>
|
||||
<entry type="KeywordType" style="#6cb2c7"/>
|
||||
|
||||
<!-- Names -->
|
||||
<entry type="Name" style="#bdbdbd"/>
|
||||
<entry type="NameClass" style="#6cb2c7"/>
|
||||
<entry type="NameConstant" style="#54c59f"/>
|
||||
<entry type="NameDecorator" style="#c17ac8"/>
|
||||
<entry type="NameEntity" style="#c7a06f"/>
|
||||
<entry type="NameException" style="#c55858"/>
|
||||
<entry type="NameFunction" style="#c7a06f"/>
|
||||
<entry type="NameFunctionMagic" style="#c7a06f"/>
|
||||
<entry type="NameLabel" style="#c17ac8"/>
|
||||
<entry type="NameNamespace" style="#bdbdbd"/>
|
||||
<entry type="NameProperty" style="#c17ac8"/>
|
||||
<entry type="NameTag" style="#8464c6"/>
|
||||
<entry type="NameVariable" style="#bdbdbd"/>
|
||||
<entry type="NameVariableClass" style="#bdbdbd"/>
|
||||
<entry type="NameVariableGlobal" style="#bdbdbd"/>
|
||||
<entry type="NameVariableInstance" style="#bdbdbd"/>
|
||||
<entry type="NameVariableMagic" style="#bdbdbd"/>
|
||||
<entry type="NameAttribute" style="#c17ac8"/>
|
||||
<entry type="NameBuiltin" style="#6cb2c7"/>
|
||||
<entry type="NameBuiltinPseudo" style="#6cb2c7"/>
|
||||
<entry type="NameOther" style="#bdbdbd"/>
|
||||
|
||||
<!-- Literals -->
|
||||
<entry type="Literal" style="#54c59f"/>
|
||||
<entry type="LiteralDate" style="#54c59f"/>
|
||||
<entry type="LiteralString" style="#54c59f"/>
|
||||
<entry type="LiteralStringChar" style="#54c59f"/>
|
||||
<entry type="LiteralStringSingle" style="#54c59f"/>
|
||||
<entry type="LiteralStringDouble" style="#54c59f"/>
|
||||
<entry type="LiteralStringBacktick" style="#54c59f"/>
|
||||
<entry type="LiteralStringOther" style="#54c59f"/>
|
||||
<entry type="LiteralStringSymbol" style="#54c59f"/>
|
||||
<entry type="LiteralStringInterpol" style="#54c59f"/>
|
||||
<entry type="LiteralStringAffix" style="#8464c6"/>
|
||||
<entry type="LiteralStringDelimiter" style="#54c59f"/>
|
||||
<entry type="LiteralStringEscape" style="#8464c6"/>
|
||||
<entry type="LiteralStringRegex" style="#54c59f"/>
|
||||
<entry type="LiteralStringDoc" style="#6d6d6d"/>
|
||||
<entry type="LiteralStringHeredoc" style="#6d6d6d"/>
|
||||
<entry type="LiteralNumber" style="#54c59f"/>
|
||||
<entry type="LiteralNumberBin" style="#54c59f"/>
|
||||
<entry type="LiteralNumberHex" style="#54c59f"/>
|
||||
<entry type="LiteralNumberInteger" style="#54c59f"/>
|
||||
<entry type="LiteralNumberFloat" style="#54c59f"/>
|
||||
<entry type="LiteralNumberIntegerLong" style="#54c59f"/>
|
||||
<entry type="LiteralNumberOct" style="#54c59f"/>
|
||||
|
||||
<!-- Operators -->
|
||||
<entry type="Operator" style="#8464c6"/>
|
||||
<entry type="OperatorWord" style="#8464c6"/>
|
||||
|
||||
<!-- Comments (italic) -->
|
||||
<entry type="Comment" style="italic #6d6d6d"/>
|
||||
<entry type="CommentSingle" style="italic #6d6d6d"/>
|
||||
<entry type="CommentMultiline" style="italic #6d6d6d"/>
|
||||
<entry type="CommentSpecial" style="italic #6d6d6d"/>
|
||||
<entry type="CommentHashbang" style="italic #6d6d6d"/>
|
||||
<entry type="CommentPreproc" style="italic #6d6d6d"/>
|
||||
<entry type="CommentPreprocFile" style="italic #6d6d6d"/>
|
||||
|
||||
<!-- Generic -->
|
||||
<entry type="Generic" style="#bdbdbd"/>
|
||||
<entry type="GenericInserted" style="bg:#15141b #54c59f"/>
|
||||
<entry type="GenericDeleted" style="bg:#15141b #c55858"/>
|
||||
<entry type="GenericEmph" style="italic #bdbdbd"/>
|
||||
<entry type="GenericStrong" style="bold #bdbdbd"/>
|
||||
<entry type="GenericUnderline" style="underline #bdbdbd"/>
|
||||
<entry type="GenericHeading" style="bold #8464c6"/>
|
||||
<entry type="GenericSubheading" style="bold #8464c6"/>
|
||||
<entry type="GenericOutput" style="#bdbdbd"/>
|
||||
<entry type="GenericPrompt" style="#bdbdbd"/>
|
||||
<entry type="GenericError" style="#c55858"/>
|
||||
<entry type="GenericTraceback" style="#c55858"/>
|
||||
|
||||
<!-- Punctuation -->
|
||||
<entry type="Punctuation" style="#bdbdbd"/>
|
||||
<entry type="Text" style="#bdbdbd"/>
|
||||
<entry type="TextWhitespace" style="#bdbdbd"/>
|
||||
</style>
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
<!--
|
||||
# Aura Theme Dark > Color scheme for Chroma syntax highlighter
|
||||
# Repository: https://github.com/daltonmenezes/aura-theme
|
||||
# Theme version: 1.0.1
|
||||
-->
|
||||
|
||||
<style name="aura-theme-dark">
|
||||
<!-- Base -->
|
||||
<entry type="Background" style="bg:#15141b #edecee"/>
|
||||
<entry type="CodeLine" style="#edecee"/>
|
||||
<entry type="Error" style="#ff6767"/>
|
||||
<entry type="Other" style="#edecee"/>
|
||||
<entry type="LineTableTD" style=""/>
|
||||
<entry type="LineTable" style=""/>
|
||||
<entry type="LineHighlight" style="bg:#29263c"/>
|
||||
<entry type="LineNumbersTable" style="#6d6d6d"/>
|
||||
<entry type="LineNumbers" style="#6d6d6d"/>
|
||||
|
||||
<!-- Keywords -->
|
||||
<entry type="Keyword" style="#a277ff"/>
|
||||
<entry type="KeywordReserved" style="#a277ff"/>
|
||||
<entry type="KeywordPseudo" style="#a277ff"/>
|
||||
<entry type="KeywordConstant" style="#61ffca"/>
|
||||
<entry type="KeywordDeclaration" style="#a277ff"/>
|
||||
<entry type="KeywordNamespace" style="#a277ff"/>
|
||||
<entry type="KeywordType" style="#82e2ff"/>
|
||||
|
||||
<!-- Names -->
|
||||
<entry type="Name" style="#edecee"/>
|
||||
<entry type="NameClass" style="#82e2ff"/>
|
||||
<entry type="NameConstant" style="#61ffca"/>
|
||||
<entry type="NameDecorator" style="#f694ff"/>
|
||||
<entry type="NameEntity" style="#ffca85"/>
|
||||
<entry type="NameException" style="#ff6767"/>
|
||||
<entry type="NameFunction" style="#ffca85"/>
|
||||
<entry type="NameFunctionMagic" style="#ffca85"/>
|
||||
<entry type="NameLabel" style="#f694ff"/>
|
||||
<entry type="NameNamespace" style="#edecee"/>
|
||||
<entry type="NameProperty" style="#f694ff"/>
|
||||
<entry type="NameTag" style="#a277ff"/>
|
||||
<entry type="NameVariable" style="#edecee"/>
|
||||
<entry type="NameVariableClass" style="#edecee"/>
|
||||
<entry type="NameVariableGlobal" style="#edecee"/>
|
||||
<entry type="NameVariableInstance" style="#edecee"/>
|
||||
<entry type="NameVariableMagic" style="#edecee"/>
|
||||
<entry type="NameAttribute" style="#f694ff"/>
|
||||
<entry type="NameBuiltin" style="#82e2ff"/>
|
||||
<entry type="NameBuiltinPseudo" style="#82e2ff"/>
|
||||
<entry type="NameOther" style="#edecee"/>
|
||||
|
||||
<!-- Literals -->
|
||||
<entry type="Literal" style="#61ffca"/>
|
||||
<entry type="LiteralDate" style="#61ffca"/>
|
||||
<entry type="LiteralString" style="#61ffca"/>
|
||||
<entry type="LiteralStringChar" style="#61ffca"/>
|
||||
<entry type="LiteralStringSingle" style="#61ffca"/>
|
||||
<entry type="LiteralStringDouble" style="#61ffca"/>
|
||||
<entry type="LiteralStringBacktick" style="#61ffca"/>
|
||||
<entry type="LiteralStringOther" style="#61ffca"/>
|
||||
<entry type="LiteralStringSymbol" style="#61ffca"/>
|
||||
<entry type="LiteralStringInterpol" style="#61ffca"/>
|
||||
<entry type="LiteralStringAffix" style="#a277ff"/>
|
||||
<entry type="LiteralStringDelimiter" style="#61ffca"/>
|
||||
<entry type="LiteralStringEscape" style="#a277ff"/>
|
||||
<entry type="LiteralStringRegex" style="#61ffca"/>
|
||||
<entry type="LiteralStringDoc" style="#6d6d6d"/>
|
||||
<entry type="LiteralStringHeredoc" style="#6d6d6d"/>
|
||||
<entry type="LiteralNumber" style="#61ffca"/>
|
||||
<entry type="LiteralNumberBin" style="#61ffca"/>
|
||||
<entry type="LiteralNumberHex" style="#61ffca"/>
|
||||
<entry type="LiteralNumberInteger" style="#61ffca"/>
|
||||
<entry type="LiteralNumberFloat" style="#61ffca"/>
|
||||
<entry type="LiteralNumberIntegerLong" style="#61ffca"/>
|
||||
<entry type="LiteralNumberOct" style="#61ffca"/>
|
||||
|
||||
<!-- Operators -->
|
||||
<entry type="Operator" style="#a277ff"/>
|
||||
<entry type="OperatorWord" style="#a277ff"/>
|
||||
|
||||
<!-- Comments (italic) -->
|
||||
<entry type="Comment" style="italic #6d6d6d"/>
|
||||
<entry type="CommentSingle" style="italic #6d6d6d"/>
|
||||
<entry type="CommentMultiline" style="italic #6d6d6d"/>
|
||||
<entry type="CommentSpecial" style="italic #6d6d6d"/>
|
||||
<entry type="CommentHashbang" style="italic #6d6d6d"/>
|
||||
<entry type="CommentPreproc" style="italic #6d6d6d"/>
|
||||
<entry type="CommentPreprocFile" style="italic #6d6d6d"/>
|
||||
|
||||
<!-- Generic -->
|
||||
<entry type="Generic" style="#edecee"/>
|
||||
<entry type="GenericInserted" style="bg:#15141b #61ffca"/>
|
||||
<entry type="GenericDeleted" style="bg:#15141b #ff6767"/>
|
||||
<entry type="GenericEmph" style="italic #edecee"/>
|
||||
<entry type="GenericStrong" style="bold #edecee"/>
|
||||
<entry type="GenericUnderline" style="underline #edecee"/>
|
||||
<entry type="GenericHeading" style="bold #a277ff"/>
|
||||
<entry type="GenericSubheading" style="bold #a277ff"/>
|
||||
<entry type="GenericOutput" style="#edecee"/>
|
||||
<entry type="GenericPrompt" style="#edecee"/>
|
||||
<entry type="GenericError" style="#ff6767"/>
|
||||
<entry type="GenericTraceback" style="#ff6767"/>
|
||||
|
||||
<!-- Punctuation -->
|
||||
<entry type="Punctuation" style="#edecee"/>
|
||||
<entry type="Text" style="#edecee"/>
|
||||
<entry type="TextWhitespace" style="#edecee"/>
|
||||
</style>
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<style name="github">
|
||||
<entry type="Error" style="#f6f8fa bg:#82071e"/>
|
||||
<entry type="Background" style="bg:#ffffff"/>
|
||||
<entry type="Background" style="bg:#f7f7f7"/>
|
||||
<entry type="Keyword" style="#cf222e"/>
|
||||
<entry type="KeywordType" style="#cf222e"/>
|
||||
<entry type="NameAttribute" style="#1f2328"/>
|
||||
|
||||
+2
-2
@@ -68,5 +68,5 @@
|
||||
<entry type="GenericSubheading" style="bold #800080"/>
|
||||
<entry type="GenericTraceback" style="bold #a40000"/>
|
||||
<entry type="GenericUnderline" style="underline"/>
|
||||
<entry type="TextWhitespace" style="underline #f8f8f8"/>
|
||||
</style>
|
||||
<entry type="TextWhitespace" style="#f8f8f8"/>
|
||||
</style>
|
||||
|
||||
+4
-7
@@ -172,8 +172,7 @@ func (s *Service) Handlers() (authHandler, avatarHandler http.Handler) {
|
||||
// allow logout without specifying provider
|
||||
if elems[len(elems)-1] == "logout" {
|
||||
if len(s.providers) == 0 {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
rest.RenderJSON(w, rest.JSON{"error": "providers not defined"})
|
||||
_ = rest.EncodeJSON(w, http.StatusBadRequest, rest.JSON{"error": "providers not defined"})
|
||||
return
|
||||
}
|
||||
s.providers[0].Handler(w, r)
|
||||
@@ -184,12 +183,11 @@ func (s *Service) Handlers() (authHandler, avatarHandler http.Handler) {
|
||||
if elems[len(elems)-1] == "user" {
|
||||
claims, _, err := s.jwtService.Get(r)
|
||||
if err != nil || claims.User == nil {
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
msg := "user is nil"
|
||||
if err != nil {
|
||||
msg = err.Error()
|
||||
}
|
||||
rest.RenderJSON(w, rest.JSON{"error": msg})
|
||||
_ = rest.EncodeJSON(w, http.StatusUnauthorized, rest.JSON{"error": msg})
|
||||
return
|
||||
}
|
||||
rest.RenderJSON(w, claims.User)
|
||||
@@ -211,8 +209,7 @@ func (s *Service) Handlers() (authHandler, avatarHandler http.Handler) {
|
||||
provName := elems[len(elems)-2]
|
||||
p, err := s.Provider(provName)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
rest.RenderJSON(w, rest.JSON{"error": fmt.Sprintf("provider %s not supported", provName)})
|
||||
_ = rest.EncodeJSON(w, http.StatusBadRequest, rest.JSON{"error": fmt.Sprintf("provider %s not supported", provName)})
|
||||
return
|
||||
}
|
||||
p.Handler(w, r)
|
||||
@@ -347,7 +344,7 @@ func (s *Service) AddAppleProvider(appleConfig provider.AppleConfig, privKeyLoad
|
||||
L: s.logger,
|
||||
}
|
||||
|
||||
// Error checking at create need for catch one when apple private key init
|
||||
// error checking at create need for catch one when apple private key init
|
||||
appleProvider, err := provider.NewApple(p, appleConfig, privKeyLoader)
|
||||
if err != nil {
|
||||
return fmt.Errorf("an AppleProvider creating failed: %w", err)
|
||||
|
||||
+1
-1
@@ -194,7 +194,7 @@ func (p *Proxy) resize(reader io.Reader, limit int) io.Reader {
|
||||
newW, newH = limit, h*limit/w
|
||||
}
|
||||
m := image.NewRGBA(image.Rect(0, 0, newW, newH))
|
||||
// Slower than `draw.ApproxBiLinear.Scale()` but better quality.
|
||||
// slower than `draw.ApproxBiLinear.Scale()` but better quality.
|
||||
draw.BiLinear.Scale(m, m.Bounds(), src, src.Bounds(), draw.Src, nil)
|
||||
|
||||
var out bytes.Buffer
|
||||
|
||||
+1
-1
@@ -189,7 +189,7 @@ func (a *Authenticator) refreshExpiredToken(w http.ResponseWriter, claims token.
|
||||
}
|
||||
|
||||
claims.ExpiresAt = nil // this will cause now+duration for refreshed token
|
||||
c, err := a.JWTService.Set(w, claims) // Set changes token
|
||||
c, err := a.JWTService.Set(w, claims) // set changes token
|
||||
if err != nil {
|
||||
return token.Claims{}, err
|
||||
}
|
||||
|
||||
+11
-11
@@ -49,22 +49,22 @@ const (
|
||||
|
||||
// appleVerificationResponse is based on https://developer.apple.com/documentation/signinwithapplerestapi/tokenresponse
|
||||
type appleVerificationResponse struct {
|
||||
// A token used to access allowed user data, but now not implemented public interface for it.
|
||||
// a token used to access allowed user data, but now not implemented public interface for it.
|
||||
AccessToken string `json:"access_token"`
|
||||
|
||||
// Access token type, always equal the "bearer".
|
||||
// access token type, always equal the "bearer".
|
||||
TokenType string `json:"token_type"`
|
||||
|
||||
// Access token expires time in seconds. Always equal 3600 seconds (1 hour)
|
||||
// access token expires time in seconds. Always equal 3600 seconds (1 hour)
|
||||
ExpiresIn int `json:"expires_in"`
|
||||
|
||||
// The refresh token used to regenerate new access tokens.
|
||||
// the refresh token used to regenerate new access tokens.
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
|
||||
// Main JSON Web Token that contains the user’s identity information.
|
||||
// main JSON Web Token that contains the user’s identity information.
|
||||
IDToken string `json:"id_token"`
|
||||
|
||||
// Used to capture any error returned in response. Always check error for empty
|
||||
// used to capture any error returned in response. Always check error for empty
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ func (ah *AppleHandler) exchange(ctx context.Context, code, redirectURI string,
|
||||
return err
|
||||
}
|
||||
|
||||
// Trying to decode (unmarshal json) data of response
|
||||
// trying to decode (unmarshal json) data of response
|
||||
err = json.NewDecoder(res.Body).Decode(result)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshalling data from apple service response failed: %w", err)
|
||||
@@ -455,8 +455,8 @@ func (ah *AppleHandler) exchange(ctx context.Context, code, redirectURI string,
|
||||
}
|
||||
}()
|
||||
|
||||
// If above operation done successfully checking a response code and error descriptions, if one exist.
|
||||
// Apple service will response either 200 (OK) or 400 (any error).
|
||||
// if above operation done successfully checking a response code and error descriptions, if one exist.
|
||||
// apple service will response either 200 (OK) or 400 (any error).
|
||||
if res.StatusCode != http.StatusOK || result.Error != "" {
|
||||
return fmt.Errorf("apple token service error: %s", result.Error)
|
||||
}
|
||||
@@ -471,7 +471,7 @@ func (ah *AppleHandler) createClientSecret() (string, error) {
|
||||
if ah.conf.privateKey == nil {
|
||||
return "", fmt.Errorf("private key can't be empty")
|
||||
}
|
||||
// Create a claims
|
||||
// create a claims
|
||||
now := time.Now()
|
||||
exp := now.Add(time.Minute * 30) // default value
|
||||
|
||||
@@ -502,7 +502,7 @@ func (ah *AppleHandler) parseUserData(user *token.User, jUser string) {
|
||||
|
||||
var userData UserData
|
||||
|
||||
// Catch error for log only. No need break flow if user name doesn't exist
|
||||
// catch error for log only. No need break flow if user name doesn't exist
|
||||
if err := json.Unmarshal([]byte(jUser), &userData); err != nil {
|
||||
ah.Logf("[DEBUG] failed to parse user data %s: %v", user, err)
|
||||
user.Name = "noname_" + user.ID[6:12] // paste noname if user name failed to parse
|
||||
|
||||
+6
-6
@@ -20,14 +20,14 @@ type Email struct {
|
||||
type EmailParams struct {
|
||||
Host string // SMTP host
|
||||
Port int // SMTP port
|
||||
From string // From email field
|
||||
Subject string // Email subject
|
||||
ContentType string // Content type
|
||||
From string // from email field
|
||||
Subject string // email subject
|
||||
ContentType string // content type
|
||||
|
||||
TLS bool // TLS auth
|
||||
StartTLS bool // StartTLS auth
|
||||
InsecureSkipVerify bool // Skip certificate verification
|
||||
Charset string // Character set
|
||||
StartTLS bool // startTLS auth
|
||||
InsecureSkipVerify bool // skip certificate verification
|
||||
Charset string // character set
|
||||
LoginAuth bool // LOGIN auth method instead of default PLAIN, needed for Office 365 and outlook.com
|
||||
SMTPUserName string // username
|
||||
SMTPPassword string // password
|
||||
|
||||
+11
-11
@@ -15,7 +15,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/go-pkgz/repeater"
|
||||
"github.com/go-pkgz/repeater/v2"
|
||||
"github.com/go-pkgz/rest"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
|
||||
@@ -63,7 +63,7 @@ var expiredCleanupInterval = time.Minute * 5 // interval to check and clean up e
|
||||
// Run starts processing login requests sent in Telegram
|
||||
// Blocks caller
|
||||
func (th *TelegramHandler) Run(ctx context.Context) error {
|
||||
// Initialization
|
||||
// initialization
|
||||
atomic.AddInt32(&th.run, 1)
|
||||
info, err := th.Telegram.BotInfo(ctx)
|
||||
if err != nil {
|
||||
@@ -168,7 +168,7 @@ func (th *TelegramHandler) processUpdates(ctx context.Context, updates *telegram
|
||||
|
||||
th.requests.RLock()
|
||||
authRequest, ok := th.requests.data[token]
|
||||
if !ok { // No such token
|
||||
if !ok { // no such token
|
||||
th.requests.RUnlock()
|
||||
err := th.Telegram.Send(ctx, update.Message.Chat.ID, th.ErrorMsg)
|
||||
if err != nil {
|
||||
@@ -256,7 +256,7 @@ func (th *TelegramHandler) LoginHandler(w http.ResponseWriter, r *http.Request)
|
||||
queryToken := r.URL.Query().Get("token")
|
||||
if queryToken == "" {
|
||||
// GET /login (No token supplied)
|
||||
// Generate and send token
|
||||
// generate and send token
|
||||
token, err := randToken()
|
||||
if err != nil {
|
||||
rest.SendErrorJSON(w, r, th.L, http.StatusInternalServerError, err, "failed to generate code")
|
||||
@@ -322,7 +322,7 @@ func (th *TelegramHandler) LoginHandler(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
rest.RenderJSON(w, claims.User)
|
||||
|
||||
// Delete request
|
||||
// delete request
|
||||
th.requests.Lock()
|
||||
defer th.requests.Unlock()
|
||||
delete(th.requests.data, queryToken)
|
||||
@@ -342,8 +342,8 @@ type tgAPI struct {
|
||||
token string
|
||||
client *http.Client
|
||||
|
||||
// Identifier of the first update to be requested.
|
||||
// Should be equal to LastSeenUpdateID + 1
|
||||
// identifier of the first update to be requested.
|
||||
// should be equal to LastSeenUpdateID + 1
|
||||
// See https://core.telegram.org/bots/api#getupdates
|
||||
updateOffset int
|
||||
}
|
||||
@@ -387,7 +387,7 @@ func (tg *tgAPI) Send(ctx context.Context, id int, msg string) error {
|
||||
|
||||
// Avatar returns URL to user avatar
|
||||
func (tg *tgAPI) Avatar(ctx context.Context, id int) (string, error) {
|
||||
// Get profile pictures
|
||||
// get profile pictures
|
||||
url := fmt.Sprintf(`getUserProfilePhotos?user_id=%d`, id)
|
||||
|
||||
var profilePhotos = struct {
|
||||
@@ -402,12 +402,12 @@ func (tg *tgAPI) Avatar(ctx context.Context, id int) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// User does not have profile picture set or it is hidden in privacy settings
|
||||
// user does not have profile picture set or it is hidden in privacy settings
|
||||
if len(profilePhotos.Result.Photos) == 0 || len(profilePhotos.Result.Photos[0]) == 0 {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// Get max possible picture size
|
||||
// get max possible picture size
|
||||
last := len(profilePhotos.Result.Photos[0]) - 1
|
||||
fileID := profilePhotos.Result.Photos[0][last].ID
|
||||
url = fmt.Sprintf(`getFile?file_id=%s`, fileID)
|
||||
@@ -450,7 +450,7 @@ func (tg *tgAPI) BotInfo(ctx context.Context) (*botInfo, error) {
|
||||
}
|
||||
|
||||
func (tg *tgAPI) request(ctx context.Context, method string, data interface{}) error {
|
||||
return repeater.NewDefault(3, time.Millisecond*50).Do(ctx, func() error {
|
||||
return repeater.NewFixed(3, time.Millisecond*50).Do(ctx, func() error {
|
||||
url := fmt.Sprintf("https://api.telegram.org/bot%s/%s", tg.token, method)
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", url, http.NoBody)
|
||||
|
||||
+3
-2
@@ -231,7 +231,7 @@ func (j *Service) validate(claims *Claims) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Ignore "ErrTokenExpired" if it is the only error.
|
||||
// ignore "ErrTokenExpired" if it is the only error.
|
||||
if errors.Is(err, jwt.ErrTokenExpired) {
|
||||
if uw, ok := err.(interface{ Unwrap() []error }); ok && len(uw.Unwrap()) == 1 {
|
||||
return nil
|
||||
@@ -266,7 +266,8 @@ func (j *Service) Set(w http.ResponseWriter, claims Claims) (Claims, error) {
|
||||
|
||||
if j.SendJWTHeader {
|
||||
w.Header().Set(j.JWTHeaderKey, tokenString)
|
||||
return claims, nil
|
||||
// don't return here - fall through to also set cookies
|
||||
// cookies are needed for OAuth redirect flows where headers don't survive redirects
|
||||
}
|
||||
|
||||
cookieExpiration := 0 // session cookie
|
||||
|
||||
+52
-55
@@ -1,66 +1,63 @@
|
||||
version: "2"
|
||||
run:
|
||||
timeout: 5m
|
||||
tests: false
|
||||
|
||||
linters-settings:
|
||||
govet:
|
||||
enable:
|
||||
- shadow
|
||||
goconst:
|
||||
min-len: 2
|
||||
min-occurrences: 2
|
||||
misspell:
|
||||
locale: US
|
||||
lll:
|
||||
line-length: 140
|
||||
gocritic:
|
||||
enabled-tags:
|
||||
- performance
|
||||
- style
|
||||
- experimental
|
||||
disabled-checks:
|
||||
- wrapperFunc
|
||||
- hugeParam
|
||||
- rangeValCopy
|
||||
- singleCaseSwitch
|
||||
- ifElseChain
|
||||
|
||||
concurrency: 4
|
||||
linters:
|
||||
default: none
|
||||
enable:
|
||||
- revive
|
||||
- govet
|
||||
- unconvert
|
||||
- staticcheck
|
||||
- unused
|
||||
- gosec
|
||||
- dupl
|
||||
- misspell
|
||||
- unparam
|
||||
- typecheck
|
||||
- ineffassign
|
||||
- stylecheck
|
||||
- gochecknoinits
|
||||
- copyloopvar
|
||||
- gocritic
|
||||
- govet
|
||||
- ineffassign
|
||||
- misspell
|
||||
- nakedret
|
||||
- gosimple
|
||||
- prealloc
|
||||
fast: false
|
||||
disable-all: true
|
||||
|
||||
issues:
|
||||
exclude-dirs:
|
||||
- vendor
|
||||
exclude-rules:
|
||||
- text: "at least one file in a package should have a package comment"
|
||||
linters:
|
||||
- stylecheck
|
||||
- text: "should have a package comment"
|
||||
linters:
|
||||
- revive
|
||||
- path: _test\.go
|
||||
linters:
|
||||
- gosec
|
||||
- dupl
|
||||
exclude-use-default: false
|
||||
- revive
|
||||
- staticcheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- unused
|
||||
settings:
|
||||
goconst:
|
||||
min-len: 2
|
||||
min-occurrences: 2
|
||||
gocritic:
|
||||
disabled-checks:
|
||||
- wrapperFunc
|
||||
- hugeParam
|
||||
- rangeValCopy
|
||||
- singleCaseSwitch
|
||||
- ifElseChain
|
||||
enabled-tags:
|
||||
- performance
|
||||
- style
|
||||
- experimental
|
||||
govet:
|
||||
enable-all: true
|
||||
disable:
|
||||
- fieldalignment
|
||||
lll:
|
||||
line-length: 140
|
||||
misspell:
|
||||
locale: US
|
||||
|
||||
exclusions:
|
||||
generated: lax
|
||||
rules:
|
||||
- linters:
|
||||
- staticcheck
|
||||
text: "at least one file in a package should have a package comment"
|
||||
- linters:
|
||||
- revive
|
||||
text: "should have a package comment"
|
||||
- linters:
|
||||
- gosec
|
||||
- dupl
|
||||
path: _test\.go
|
||||
paths:
|
||||
- vendor
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
|
||||
+8
-1
@@ -157,7 +157,14 @@ Compresses response with gzip.
|
||||
|
||||
### RealIP middleware
|
||||
|
||||
RealIP is a middleware that sets a http.Request's RemoteAddr to the results of parsing either the X-Forwarded-For or X-Real-IP headers.
|
||||
RealIP is a middleware that sets a http.Request's RemoteAddr to the results of parsing various headers that contain the client's real IP address. It checks headers in the following priority order:
|
||||
|
||||
1. `X-Real-IP` - trusted proxy (nginx/reproxy) sets this to actual client
|
||||
2. `CF-Connecting-IP` - Cloudflare's header for original client
|
||||
3. `X-Forwarded-For` - leftmost public IP (original client in CDN/proxy chain)
|
||||
4. `RemoteAddr` - fallback for direct connections
|
||||
|
||||
Only public IPs are accepted from headers; private/loopback/link-local IPs are skipped. This makes the middleware compatible with CDN setups like Cloudflare where the leftmost IP in `X-Forwarded-For` is the actual client.
|
||||
|
||||
### Maybe middleware
|
||||
|
||||
|
||||
+1
-2
@@ -20,8 +20,7 @@ func BlackWords(words ...string) func(http.Handler) http.Handler {
|
||||
if body != "" {
|
||||
for _, word := range words {
|
||||
if strings.Contains(body, strings.ToLower(word)) {
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
RenderJSON(w, JSON{"error": "one of blacklisted words detected"})
|
||||
_ = EncodeJSON(w, http.StatusForbidden, JSON{"error": "one of blacklisted words detected"})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -68,12 +68,14 @@ func NewFileServer(public, local string, options ...FsOpt) (*FS, error) {
|
||||
}
|
||||
|
||||
// FileServer is a shortcut for making FS with listing disabled and the custom noFound reader (can be nil).
|
||||
//
|
||||
// Deprecated: the method is for back-compatibility only and user should use the universal NewFileServer instead
|
||||
func FileServer(public, local string, notFound io.Reader) (http.Handler, error) {
|
||||
return NewFileServer(public, local, FsOptCustom404(notFound))
|
||||
}
|
||||
|
||||
// FileServerSPA is a shortcut for making FS with SPA-friendly handling of 404, listing disabled and the custom noFound reader (can be nil).
|
||||
//
|
||||
// Deprecated: the method is for back-compatibility only and user should use the universal NewFileServer instead
|
||||
func FileServerSPA(public, local string, notFound io.Reader) (http.Handler, error) {
|
||||
return NewFileServer(public, local, FsOptCustom404(notFound), FsOptSPA)
|
||||
|
||||
+3
-3
@@ -220,8 +220,8 @@ func (l *Middleware) getBody(r *http.Request) string {
|
||||
|
||||
// "The Server will close the request body. The ServeHTTP Handler does not need to."
|
||||
// https://golang.org/pkg/net/http/#Request
|
||||
// So we can use ioutil.NopCloser() to make io.ReadCloser.
|
||||
// Note that below assignment is not approved by the docs:
|
||||
// so we can use ioutil.NopCloser() to make io.ReadCloser.
|
||||
// note that below assignment is not approved by the docs:
|
||||
// "Except for reading the body, handlers should not modify the provided Request."
|
||||
// https://golang.org/pkg/net/http/#Handler
|
||||
r.Body = io.NopCloser(reader)
|
||||
@@ -355,5 +355,5 @@ func (c *customResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
||||
if hj, ok := c.ResponseWriter.(http.Hijacker); ok {
|
||||
return hj.Hijack()
|
||||
}
|
||||
return nil, nil, fmt.Errorf("ResponseWriter does not implement the Hijacker interface") //nolint:golint //capital letter is OK here
|
||||
return nil, nil, fmt.Errorf("ResponseWriter does not implement the Hijacker interface")
|
||||
}
|
||||
|
||||
+1
-2
@@ -13,8 +13,7 @@ func Metrics(onlyIps ...string) func(http.Handler) http.Handler {
|
||||
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == "GET" && strings.HasSuffix(strings.ToLower(r.URL.Path), "/metrics") {
|
||||
if matched, ip, err := matchSourceIP(r, onlyIps); !matched || err != nil {
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
RenderJSON(w, JSON{"error": fmt.Sprintf("ip %s rejected", ip)})
|
||||
_ = EncodeJSON(w, http.StatusForbidden, JSON{"error": fmt.Sprintf("ip %s rejected", ip)})
|
||||
return
|
||||
}
|
||||
expvar.Handler().ServeHTTP(w, r)
|
||||
|
||||
+12
-8
@@ -19,7 +19,6 @@ func Wrap(handler http.Handler, mws ...func(http.Handler) http.Handler) http.Han
|
||||
return handler
|
||||
}
|
||||
|
||||
|
||||
// AppInfo adds custom app-info to the response header
|
||||
func AppInfo(app, author, version string) func(http.Handler) http.Handler {
|
||||
f := func(h http.Handler) http.Handler {
|
||||
@@ -82,12 +81,11 @@ func Health(path string, checkers ...func(ctx context.Context) (name string, err
|
||||
}
|
||||
resp = append(resp, hh)
|
||||
}
|
||||
status := http.StatusOK
|
||||
if anyError {
|
||||
w.WriteHeader(http.StatusServiceUnavailable)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
status = http.StatusServiceUnavailable
|
||||
}
|
||||
RenderJSON(w, resp)
|
||||
_ = EncodeJSON(w, status, resp)
|
||||
}
|
||||
return http.HandlerFunc(fn)
|
||||
}
|
||||
@@ -147,13 +145,19 @@ func Maybe(mw func(http.Handler) http.Handler, maybeFn func(r *http.Request) boo
|
||||
}
|
||||
}
|
||||
|
||||
// RealIP is a middleware that sets a http.Request's RemoteAddr to the results
|
||||
// of parsing either the X-Forwarded-For or X-Real-IP headers.
|
||||
// RealIP is a middleware that sets a http.Request's RemoteAddr to the client's real IP.
|
||||
// It checks headers in the following priority order:
|
||||
// 1. X-Real-IP - trusted proxy (nginx/reproxy) sets this to actual client
|
||||
// 2. CF-Connecting-IP - Cloudflare's header for original client
|
||||
// 3. X-Forwarded-For - leftmost public IP (original client in CDN/proxy chain)
|
||||
// 4. RemoteAddr - fallback for direct connections
|
||||
//
|
||||
// Only public IPs are accepted from headers; private/loopback/link-local IPs are skipped.
|
||||
//
|
||||
// This middleware should only be used if user can trust the headers sent with request.
|
||||
// If reverse proxies are configured to pass along arbitrary header values from the client,
|
||||
// or if this middleware used without a reverse proxy, malicious clients could set anything
|
||||
// as X-Forwarded-For header and attack the server in various ways.
|
||||
// as these headers and spoof their IP address.
|
||||
func RealIP(h http.Handler) http.Handler {
|
||||
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||
if rip, err := realip.Get(r); err == nil {
|
||||
|
||||
+7
-6
@@ -29,21 +29,22 @@ var etagHeaders = []string{
|
||||
// a router (or subrouter) from being cached by an upstream proxy and/or client.
|
||||
//
|
||||
// As per http://wiki.nginx.org/HttpProxyModule - NoCache sets:
|
||||
// Expires: Thu, 01 Jan 1970 00:00:00 UTC
|
||||
// Cache-Control: no-cache, private, max-age=0
|
||||
// X-Accel-Expires: 0
|
||||
// Pragma: no-cache (for HTTP/1.0 proxies/clients)
|
||||
//
|
||||
// Expires: Thu, 01 Jan 1970 00:00:00 UTC
|
||||
// Cache-Control: no-cache, private, max-age=0
|
||||
// X-Accel-Expires: 0
|
||||
// Pragma: no-cache (for HTTP/1.0 proxies/clients)
|
||||
func NoCache(h http.Handler) http.Handler {
|
||||
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Delete any ETag headers that may have been set
|
||||
// delete any ETag headers that may have been set
|
||||
for _, v := range etagHeaders {
|
||||
if r.Header.Get(v) != "" {
|
||||
r.Header.Del(v)
|
||||
}
|
||||
}
|
||||
|
||||
// Set our NoCache headers
|
||||
// set our NoCache headers
|
||||
for k, v := range noCacheHeaders {
|
||||
w.Header().Set(k, v)
|
||||
}
|
||||
|
||||
+2
-4
@@ -21,8 +21,7 @@ func OnlyFrom(onlyIps ...string) func(http.Handler) http.Handler {
|
||||
}
|
||||
matched, ip, err := matchSourceIP(r, onlyIps)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
RenderJSON(w, JSON{"error": fmt.Sprintf("can't get realip: %s", err)})
|
||||
_ = EncodeJSON(w, http.StatusInternalServerError, JSON{"error": fmt.Sprintf("can't get realip: %s", err)})
|
||||
return
|
||||
}
|
||||
if matched {
|
||||
@@ -31,8 +30,7 @@ func OnlyFrom(onlyIps ...string) func(http.Handler) http.Handler {
|
||||
return
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
RenderJSON(w, JSON{"error": fmt.Sprintf("ip %q rejected", ip)})
|
||||
_ = EncodeJSON(w, http.StatusForbidden, JSON{"error": fmt.Sprintf("ip %q rejected", ip)})
|
||||
}
|
||||
return http.HandlerFunc(fn)
|
||||
}
|
||||
|
||||
+54
-30
@@ -33,49 +33,73 @@ var privateRanges = []ipRange{
|
||||
{start: net.ParseIP("fe80::"), end: net.ParseIP("febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff")},
|
||||
}
|
||||
|
||||
// Get returns real ip from the given request
|
||||
// Prioritize public IPs over private IPs
|
||||
// Get returns real IP from the given request.
|
||||
// It checks headers in the following priority order:
|
||||
// 1. X-Real-IP - trusted proxy (nginx/reproxy) sets this to actual client
|
||||
// 2. CF-Connecting-IP - Cloudflare's header for original client
|
||||
// 3. X-Forwarded-For - leftmost public IP (original client in CDN chain)
|
||||
// 4. RemoteAddr - fallback for direct connections
|
||||
//
|
||||
// Only public IPs are accepted from headers; private/loopback/link-local IPs are skipped.
|
||||
func Get(r *http.Request) (string, error) {
|
||||
var firstIP string
|
||||
for _, h := range []string{"X-Forwarded-For", "X-Real-Ip"} {
|
||||
addresses := strings.Split(r.Header.Get(h), ",")
|
||||
for i := len(addresses) - 1; i >= 0; i-- {
|
||||
ip := strings.TrimSpace(addresses[i])
|
||||
realIP := net.ParseIP(ip)
|
||||
if firstIP == "" && realIP != nil {
|
||||
firstIP = ip
|
||||
}
|
||||
// Guard against nil realIP
|
||||
if realIP == nil || !realIP.IsGlobalUnicast() || isPrivateSubnet(realIP) {
|
||||
continue
|
||||
}
|
||||
return ip, nil
|
||||
// check X-Real-IP first (single value, set by trusted proxy)
|
||||
if xRealIP := strings.TrimSpace(r.Header.Get("X-Real-IP")); xRealIP != "" {
|
||||
if ip := net.ParseIP(xRealIP); isPublicIP(ip) {
|
||||
return xRealIP, nil
|
||||
}
|
||||
}
|
||||
|
||||
if firstIP != "" {
|
||||
return firstIP, nil
|
||||
// check CF-Connecting-IP (Cloudflare's header)
|
||||
if cfIP := strings.TrimSpace(r.Header.Get("CF-Connecting-IP")); cfIP != "" {
|
||||
if ip := net.ParseIP(cfIP); isPublicIP(ip) {
|
||||
return cfIP, nil
|
||||
}
|
||||
}
|
||||
|
||||
// handle RemoteAddr which may be just an IP or IP:port
|
||||
remoteIP := r.RemoteAddr
|
||||
// check X-Forwarded-For, find leftmost public IP
|
||||
if xff := r.Header.Get("X-Forwarded-For"); xff != "" {
|
||||
addresses := strings.Split(xff, ",")
|
||||
for _, addr := range addresses {
|
||||
ip := strings.TrimSpace(addr)
|
||||
if parsedIP := net.ParseIP(ip); isPublicIP(parsedIP) {
|
||||
return ip, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fall back to RemoteAddr
|
||||
return parseRemoteAddr(r.RemoteAddr)
|
||||
}
|
||||
|
||||
// isPublicIP checks if the IP is a valid public (globally routable) IP address.
|
||||
func isPublicIP(ip net.IP) bool {
|
||||
if ip == nil {
|
||||
return false
|
||||
}
|
||||
if !ip.IsGlobalUnicast() {
|
||||
return false
|
||||
}
|
||||
return !isPrivateSubnet(ip)
|
||||
}
|
||||
|
||||
// parseRemoteAddr extracts and validates IP from RemoteAddr (handles both "ip" and "ip:port" formats).
|
||||
func parseRemoteAddr(remoteAddr string) (string, error) {
|
||||
if remoteAddr == "" {
|
||||
return "", fmt.Errorf("empty remote address")
|
||||
}
|
||||
|
||||
// try to extract host from host:port format
|
||||
host, _, err := net.SplitHostPort(remoteIP)
|
||||
host, _, err := net.SplitHostPort(remoteAddr)
|
||||
if err == nil {
|
||||
remoteIP = host
|
||||
remoteAddr = host
|
||||
}
|
||||
|
||||
// at this point remoteIP could be either:
|
||||
// 1. the host part extracted from host:port
|
||||
// 2. yhe original RemoteAddr if it doesn't contain a port
|
||||
|
||||
// try to parse it as a valid IP address
|
||||
if netIP := net.ParseIP(remoteIP); netIP == nil {
|
||||
return "", fmt.Errorf("no valid ip found in %q", r.RemoteAddr)
|
||||
// validate it's a proper IP address
|
||||
if netIP := net.ParseIP(remoteAddr); netIP == nil {
|
||||
return "", fmt.Errorf("no valid ip found in %q", remoteAddr)
|
||||
}
|
||||
|
||||
return remoteIP, nil
|
||||
return remoteAddr, nil
|
||||
}
|
||||
|
||||
// isPrivateSubnet - check to see if this ip is in a private subnet
|
||||
|
||||
+2
-2
@@ -144,8 +144,8 @@ func (g *Group) SetLimit(n int) {
|
||||
g.sem = nil
|
||||
return
|
||||
}
|
||||
if len(g.sem) != 0 {
|
||||
panic(fmt.Errorf("errgroup: modify limit while %v goroutines in the group are still active", len(g.sem)))
|
||||
if active := len(g.sem); active != 0 {
|
||||
panic(fmt.Errorf("errgroup: modify limit while %v goroutines in the group are still active", active))
|
||||
}
|
||||
g.sem = make(chan token, n)
|
||||
}
|
||||
|
||||
-3
@@ -92,9 +92,6 @@ var ARM64 struct {
|
||||
HasSHA2 bool // SHA2 hardware implementation
|
||||
HasCRC32 bool // CRC32 hardware implementation
|
||||
HasATOMICS bool // Atomic memory operation instruction set
|
||||
HasHPDS bool // Hierarchical permission disables in translations tables
|
||||
HasLOR bool // Limited ordering regions
|
||||
HasPAN bool // Privileged access never
|
||||
HasFPHP bool // Half precision floating-point instruction set
|
||||
HasASIMDHP bool // Advanced SIMD half precision instruction set
|
||||
HasCPUID bool // CPUID identification scheme registers
|
||||
|
||||
+2
-18
@@ -65,10 +65,10 @@ func setMinimalFeatures() {
|
||||
func readARM64Registers() {
|
||||
Initialized = true
|
||||
|
||||
parseARM64SystemRegisters(getisar0(), getisar1(), getmmfr1(), getpfr0())
|
||||
parseARM64SystemRegisters(getisar0(), getisar1(), getpfr0())
|
||||
}
|
||||
|
||||
func parseARM64SystemRegisters(isar0, isar1, mmfr1, pfr0 uint64) {
|
||||
func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) {
|
||||
// ID_AA64ISAR0_EL1
|
||||
switch extractBits(isar0, 4, 7) {
|
||||
case 1:
|
||||
@@ -152,22 +152,6 @@ func parseARM64SystemRegisters(isar0, isar1, mmfr1, pfr0 uint64) {
|
||||
ARM64.HasI8MM = true
|
||||
}
|
||||
|
||||
// ID_AA64MMFR1_EL1
|
||||
switch extractBits(mmfr1, 12, 15) {
|
||||
case 1, 2:
|
||||
ARM64.HasHPDS = true
|
||||
}
|
||||
|
||||
switch extractBits(mmfr1, 16, 19) {
|
||||
case 1:
|
||||
ARM64.HasLOR = true
|
||||
}
|
||||
|
||||
switch extractBits(mmfr1, 20, 23) {
|
||||
case 1, 2, 3:
|
||||
ARM64.HasPAN = true
|
||||
}
|
||||
|
||||
// ID_AA64PFR0_EL1
|
||||
switch extractBits(pfr0, 16, 19) {
|
||||
case 0:
|
||||
|
||||
-7
@@ -20,13 +20,6 @@ TEXT ·getisar1(SB),NOSPLIT,$0-8
|
||||
MOVD R0, ret+0(FP)
|
||||
RET
|
||||
|
||||
// func getmmfr1() uint64
|
||||
TEXT ·getmmfr1(SB),NOSPLIT,$0-8
|
||||
// get Memory Model Feature Register 1 into x0
|
||||
MRS ID_AA64MMFR1_EL1, R0
|
||||
MOVD R0, ret+0(FP)
|
||||
RET
|
||||
|
||||
// func getpfr0() uint64
|
||||
TEXT ·getpfr0(SB),NOSPLIT,$0-8
|
||||
// get Processor Feature Register 0 into x0
|
||||
|
||||
-1
@@ -8,6 +8,5 @@ package cpu
|
||||
|
||||
func getisar0() uint64
|
||||
func getisar1() uint64
|
||||
func getmmfr1() uint64
|
||||
func getpfr0() uint64
|
||||
func getzfr0() uint64
|
||||
|
||||
-1
@@ -8,5 +8,4 @@ package cpu
|
||||
|
||||
func getisar0() uint64 { return 0 }
|
||||
func getisar1() uint64 { return 0 }
|
||||
func getmmfr1() uint64 { return 0 }
|
||||
func getpfr0() uint64 { return 0 }
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ func doinit() {
|
||||
setMinimalFeatures()
|
||||
return
|
||||
}
|
||||
parseARM64SystemRegisters(cpuid.aa64isar0, cpuid.aa64isar1, cpuid.aa64mmfr1, cpuid.aa64pfr0)
|
||||
parseARM64SystemRegisters(cpuid.aa64isar0, cpuid.aa64isar1, cpuid.aa64pfr0)
|
||||
|
||||
Initialized = true
|
||||
}
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ func doinit() {
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
parseARM64SystemRegisters(isar0, isar1, 0, 0)
|
||||
parseARM64SystemRegisters(isar0, isar1, 0)
|
||||
|
||||
Initialized = true
|
||||
}
|
||||
|
||||
+2
-1
@@ -256,6 +256,7 @@ struct ltchars {
|
||||
#include <linux/loop.h>
|
||||
#include <linux/lwtunnel.h>
|
||||
#include <linux/magic.h>
|
||||
#include <linux/mei.h>
|
||||
#include <linux/memfd.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mount.h>
|
||||
@@ -613,7 +614,7 @@ ccflags="$@"
|
||||
$2 !~ /IOC_MAGIC/ &&
|
||||
$2 ~ /^[A-Z][A-Z0-9_]+_MAGIC2?$/ ||
|
||||
$2 ~ /^(VM|VMADDR)_/ ||
|
||||
$2 ~ /^IOCTL_VM_SOCKETS_/ ||
|
||||
$2 ~ /^(IOCTL_VM_SOCKETS_|IOCTL_MEI_)/ ||
|
||||
$2 ~ /^(TASKSTATS|TS)_/ ||
|
||||
$2 ~ /^CGROUPSTATS_/ ||
|
||||
$2 ~ /^GENL_/ ||
|
||||
|
||||
+2
@@ -1615,6 +1615,8 @@ const (
|
||||
IN_OPEN = 0x20
|
||||
IN_Q_OVERFLOW = 0x4000
|
||||
IN_UNMOUNT = 0x2000
|
||||
IOCTL_MEI_CONNECT_CLIENT = 0xc0104801
|
||||
IOCTL_MEI_CONNECT_CLIENT_VTAG = 0xc0144804
|
||||
IPPROTO_AH = 0x33
|
||||
IPPROTO_BEETPH = 0x5e
|
||||
IPPROTO_COMP = 0x6c
|
||||
|
||||
+2
@@ -116,6 +116,8 @@ const (
|
||||
IEXTEN = 0x8000
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_MEI_NOTIFY_GET = 0x80044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x40044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
|
||||
+2
@@ -116,6 +116,8 @@ const (
|
||||
IEXTEN = 0x8000
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_MEI_NOTIFY_GET = 0x80044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x40044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
|
||||
+2
@@ -115,6 +115,8 @@ const (
|
||||
IEXTEN = 0x8000
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_MEI_NOTIFY_GET = 0x80044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x40044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
|
||||
+2
@@ -120,6 +120,8 @@ const (
|
||||
IEXTEN = 0x8000
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_MEI_NOTIFY_GET = 0x80044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x40044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
|
||||
+2
@@ -116,6 +116,8 @@ const (
|
||||
IEXTEN = 0x8000
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_MEI_NOTIFY_GET = 0x80044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x40044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
|
||||
+2
@@ -115,6 +115,8 @@ const (
|
||||
IEXTEN = 0x100
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x80
|
||||
IOCTL_MEI_NOTIFY_GET = 0x40044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x80044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
|
||||
IPV6_FLOWINFO_MASK = 0xfffffff
|
||||
IPV6_FLOWLABEL_MASK = 0xfffff
|
||||
|
||||
+2
@@ -115,6 +115,8 @@ const (
|
||||
IEXTEN = 0x100
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x80
|
||||
IOCTL_MEI_NOTIFY_GET = 0x40044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x80044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
|
||||
IPV6_FLOWINFO_MASK = 0xfffffff
|
||||
IPV6_FLOWLABEL_MASK = 0xfffff
|
||||
|
||||
+2
@@ -115,6 +115,8 @@ const (
|
||||
IEXTEN = 0x100
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x80
|
||||
IOCTL_MEI_NOTIFY_GET = 0x40044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x80044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
|
||||
+2
@@ -115,6 +115,8 @@ const (
|
||||
IEXTEN = 0x100
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x80
|
||||
IOCTL_MEI_NOTIFY_GET = 0x40044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x80044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
|
||||
+2
@@ -115,6 +115,8 @@ const (
|
||||
IEXTEN = 0x400
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_MEI_NOTIFY_GET = 0x40044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x80044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
|
||||
IPV6_FLOWINFO_MASK = 0xfffffff
|
||||
IPV6_FLOWLABEL_MASK = 0xfffff
|
||||
|
||||
+2
@@ -115,6 +115,8 @@ const (
|
||||
IEXTEN = 0x400
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_MEI_NOTIFY_GET = 0x40044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x80044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
|
||||
IPV6_FLOWINFO_MASK = 0xfffffff
|
||||
IPV6_FLOWLABEL_MASK = 0xfffff
|
||||
|
||||
+2
@@ -115,6 +115,8 @@ const (
|
||||
IEXTEN = 0x400
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_MEI_NOTIFY_GET = 0x40044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x80044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
|
||||
+2
@@ -115,6 +115,8 @@ const (
|
||||
IEXTEN = 0x8000
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_MEI_NOTIFY_GET = 0x80044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x40044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
|
||||
+2
@@ -115,6 +115,8 @@ const (
|
||||
IEXTEN = 0x8000
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_MEI_NOTIFY_GET = 0x80044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x40044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
|
||||
IPV6_FLOWINFO_MASK = 0xfffffff
|
||||
IPV6_FLOWLABEL_MASK = 0xfffff
|
||||
|
||||
+2
@@ -119,6 +119,8 @@ const (
|
||||
IEXTEN = 0x8000
|
||||
IN_CLOEXEC = 0x400000
|
||||
IN_NONBLOCK = 0x4000
|
||||
IOCTL_MEI_NOTIFY_GET = 0x40044803
|
||||
IOCTL_MEI_NOTIFY_SET = 0x80044802
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
|
||||
IPV6_FLOWINFO_MASK = 0xfffffff
|
||||
IPV6_FLOWLABEL_MASK = 0xfffff
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ type Statvfs_t struct {
|
||||
Fsid uint32
|
||||
Namemax uint32
|
||||
Owner uint32
|
||||
Spare [4]uint32
|
||||
Spare [4]uint64
|
||||
Fstypename [32]byte
|
||||
Mntonname [1024]byte
|
||||
Mntfromname [1024]byte
|
||||
|
||||
Vendored
+11
-11
@@ -7,7 +7,7 @@ github.com/Depado/bfchroma/v2
|
||||
# github.com/PuerkitoBio/goquery v1.11.0
|
||||
## explicit; go 1.24.0
|
||||
github.com/PuerkitoBio/goquery
|
||||
# github.com/alecthomas/chroma/v2 v2.20.0
|
||||
# github.com/alecthomas/chroma/v2 v2.21.1
|
||||
## explicit; go 1.22
|
||||
github.com/alecthomas/chroma/v2
|
||||
github.com/alecthomas/chroma/v2/formatters/html
|
||||
@@ -56,7 +56,7 @@ github.com/go-chi/cors
|
||||
github.com/go-oauth2/oauth2/v4
|
||||
github.com/go-oauth2/oauth2/v4/errors
|
||||
github.com/go-oauth2/oauth2/v4/server
|
||||
# github.com/go-pkgz/auth/v2 v2.1.0
|
||||
# github.com/go-pkgz/auth/v2 v2.1.1
|
||||
## explicit; go 1.24.0
|
||||
github.com/go-pkgz/auth/v2
|
||||
github.com/go-pkgz/auth/v2/avatar
|
||||
@@ -91,8 +91,8 @@ github.com/go-pkgz/repeater/strategy
|
||||
# github.com/go-pkgz/repeater/v2 v2.2.0
|
||||
## explicit; go 1.23
|
||||
github.com/go-pkgz/repeater/v2
|
||||
# github.com/go-pkgz/rest v1.20.4
|
||||
## explicit; go 1.23.0
|
||||
# github.com/go-pkgz/rest v1.20.6
|
||||
## explicit; go 1.24.0
|
||||
github.com/go-pkgz/rest
|
||||
github.com/go-pkgz/rest/logger
|
||||
github.com/go-pkgz/rest/realip
|
||||
@@ -272,7 +272,7 @@ go.mongodb.org/mongo-driver/x/mongo/driver/wiremessage
|
||||
## explicit; go 1.20
|
||||
go.uber.org/goleak
|
||||
go.uber.org/goleak/internal/stack
|
||||
# golang.org/x/crypto v0.45.0
|
||||
# golang.org/x/crypto v0.46.0
|
||||
## explicit; go 1.24.0
|
||||
golang.org/x/crypto/acme
|
||||
golang.org/x/crypto/acme/autocert
|
||||
@@ -283,16 +283,16 @@ golang.org/x/crypto/blowfish
|
||||
golang.org/x/crypto/ocsp
|
||||
golang.org/x/crypto/pbkdf2
|
||||
golang.org/x/crypto/scrypt
|
||||
# golang.org/x/image v0.33.0
|
||||
# golang.org/x/image v0.34.0
|
||||
## explicit; go 1.24.0
|
||||
golang.org/x/image/draw
|
||||
golang.org/x/image/math/f64
|
||||
# golang.org/x/net v0.47.0
|
||||
# golang.org/x/net v0.48.0
|
||||
## explicit; go 1.24.0
|
||||
golang.org/x/net/html
|
||||
golang.org/x/net/html/atom
|
||||
golang.org/x/net/idna
|
||||
# golang.org/x/oauth2 v0.33.0
|
||||
# golang.org/x/oauth2 v0.34.0
|
||||
## explicit; go 1.24.0
|
||||
golang.org/x/oauth2
|
||||
golang.org/x/oauth2/authhandler
|
||||
@@ -309,17 +309,17 @@ golang.org/x/oauth2/jws
|
||||
golang.org/x/oauth2/jwt
|
||||
golang.org/x/oauth2/microsoft
|
||||
golang.org/x/oauth2/yandex
|
||||
# golang.org/x/sync v0.18.0
|
||||
# golang.org/x/sync v0.19.0
|
||||
## explicit; go 1.24.0
|
||||
golang.org/x/sync/errgroup
|
||||
golang.org/x/sync/singleflight
|
||||
# golang.org/x/sys v0.38.0
|
||||
# golang.org/x/sys v0.39.0
|
||||
## explicit; go 1.24.0
|
||||
golang.org/x/sys/cpu
|
||||
golang.org/x/sys/unix
|
||||
golang.org/x/sys/windows
|
||||
golang.org/x/sys/windows/registry
|
||||
# golang.org/x/text v0.31.0
|
||||
# golang.org/x/text v0.32.0
|
||||
## explicit; go 1.24.0
|
||||
golang.org/x/text/secure/bidirule
|
||||
golang.org/x/text/transform
|
||||
|
||||
Reference in New Issue
Block a user