diff --git a/api/alerts_comment.go b/api/alerts_comment.go index 5e5e7091a..ece526ad7 100644 --- a/api/alerts_comment.go +++ b/api/alerts_comment.go @@ -24,8 +24,37 @@ import ( "github.com/pkg/errors" ) +type alertCommentFormat int + +const ( + AlertCommentFormatPlaintext alertCommentFormat = iota + AlertCommentFormatMarkdown +) + +// String returns the string representation of an Alert comment format +func (i alertCommentFormat) String() string { + return AlertCommentFormats[i] +} + +type alertCommentFormats map[alertCommentFormat]string + +// AlertCommentFormats is the list of available Alert comment formats +var AlertCommentFormats = alertCommentFormats{ + AlertCommentFormatPlaintext: "Plaintext", + AlertCommentFormatMarkdown: "Markdown", +} + +func (acf alertCommentFormats) GetOrderedFormatStrings() []string { + formats := []string{} + for i := 0; i < len(acf); i++ { + formats = append(formats, acf[alertCommentFormat(i)]) + } + return formats +} + type AlertsCommentRequest struct { Comment string `json:"comment"` + Format string `json:"format"` } type AlertsCommentResponse struct { @@ -48,3 +77,20 @@ func (svc *AlertsService) Comment(id int, comment string) ( ) return } + +func (svc *AlertsService) CommentFromRequest(id int, request AlertsCommentRequest) ( + response AlertsCommentResponse, + err error, +) { + if request.Comment == "" { + err = errors.New("alert comment must be provided") + return + } + err = svc.client.RequestEncoderDecoder( + "POST", + fmt.Sprintf(apiV2AlertsComment, id), + request, + &response, + ) + return +} diff --git a/cli/cmd/alert.go b/cli/cmd/alert.go index 9ec915001..638fcd352 100644 --- a/cli/cmd/alert.go +++ b/cli/cmd/alert.go @@ -40,6 +40,7 @@ type alertCmdStateType struct { Status string Start string Type string + Format string } // hasFilters returns true if certain filters are present diff --git a/cli/cmd/alert_comment.go b/cli/cmd/alert_comment.go index c4323d897..7cb30be03 100644 --- a/cli/cmd/alert_comment.go +++ b/cli/cmd/alert_comment.go @@ -22,6 +22,8 @@ import ( "fmt" "strconv" + "github.com/AlecAivazis/survey/v2" + "github.com/lacework/go-sdk/api" "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -34,6 +36,12 @@ var ( Long: `Post a user comment on an alert's timeline . Comments may be provided inline or via editor. + +The following comment formats are allowed: + * Plaintext + * Markdown + +Note: only markdown comments will be rendered using markdown. `, Args: cobra.ExactArgs(1), RunE: commentAlert, @@ -49,6 +57,28 @@ func init() { "comment", "c", "", "a comment to add to the alert", ) + + // format flag + alertCommentCmd.Flags().StringVarP( + &alertCmdState.Format, + "format", "f", "", + "the format of the comment (default Plaintext)", + ) +} + +func inputFormat() (format string, err error) { + if alertCmdState.Format != "" { + format = alertCmdState.Format + return + } + + prompt := &survey.Select{ + Message: "Format:", + Options: api.AlertCommentFormats.GetOrderedFormatStrings(), + } + err = survey.AskOne(prompt, &format) + + return } func commentAlert(_ *cobra.Command, args []string) error { @@ -74,8 +104,14 @@ func commentAlert(_ *cobra.Command, args []string) error { return errors.Wrap(err, "unable to process alert comment") } + format, err := inputFormat() + if err != nil { + return errors.Wrap(err, "unable to process alert comment format") + } + cli.StartProgress(" Adding alert comment...") - commentResponse, err := cli.LwApi.V2.Alerts.Comment(id, comment) + commentResponse, err := cli.LwApi.V2.Alerts.CommentFromRequest(id, + api.AlertsCommentRequest{Comment: comment, Format: format}) cli.StopProgress() if err != nil { return errors.Wrap(err, "unable to add alert comment") diff --git a/cli/cmd/alert_comment_test.go b/cli/cmd/alert_comment_test.go new file mode 100644 index 000000000..994116f97 --- /dev/null +++ b/cli/cmd/alert_comment_test.go @@ -0,0 +1,59 @@ +package cmd + +import ( + "fmt" + "net/http" + "strconv" + "testing" + + "github.com/lacework/go-sdk/api" + "github.com/lacework/go-sdk/internal/lacework" + "github.com/stretchr/testify/assert" +) + +func TestAlertComment(t *testing.T) { + tests := []struct { + name string + args []string + commentFlag string + formatFlag string + }{ + { + name: "Valid Comment with Markdown Format", + args: []string{"12345"}, + commentFlag: "This is a **markdown** comment.", + formatFlag: "Markdown", + }, + { + name: "Valid Comment with Plain Text Format", + args: []string{"12344"}, + commentFlag: "This is a plain text comment.", + formatFlag: "Plaintext", + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + id, _ := strconv.Atoi(test.args[0]) + fakeServer := lacework.MockServer() + fakeServer.MockAPI( + fmt.Sprintf("Alerts/%d/comment", id), + func(w http.ResponseWriter, r *http.Request) { + assert.Equal(t, "POST", r.Method, "should be a POST method") + fmt.Fprint(w, "{}") + }, + ) + defer fakeServer.Close() + + c, err := api.NewClient("test", + api.WithToken("TOKEN"), + api.WithURL(fakeServer.URL()), + ) + assert.Nil(t, err) + + _, err = c.V2.Alerts.CommentFromRequest(id, + api.AlertsCommentRequest{Comment: test.commentFlag, Format: test.formatFlag}) + assert.Nil(t, err) + }) + } +} diff --git a/cli/cmd/alert_show_timeline.go b/cli/cmd/alert_show_timeline.go index 71b16ce09..896f72098 100644 --- a/cli/cmd/alert_show_timeline.go +++ b/cli/cmd/alert_show_timeline.go @@ -1,11 +1,18 @@ package cmd import ( + "bytes" + "runtime" "strconv" + "strings" - "github.com/lacework/go-sdk/api" "github.com/olekukonko/tablewriter" + + "github.com/lacework/go-sdk/api" "github.com/pkg/errors" + + "github.com/Delta456/box-cli-maker/v2" + markdown "github.com/MichaelMure/go-term-markdown" ) func alertTimelineTable(timelines []api.AlertTimeline) (out [][]string) { @@ -35,6 +42,42 @@ func renderAlertTimelineTable(timelines []api.AlertTimeline) { ) } +func renderAlertTimelineBox(b box.Box, timeline api.AlertTimeline) { + if timeline.Message.Value == "" { + return + } + value := []byte(timeline.Message.Value) + if strings.HasPrefix(timeline.Message.Format, api.AlertCommentFormatMarkdown.String()) { + // Replace CR LF \r\n (Windows) with LF \n (Unix) + value = bytes.Replace(value, []byte{13, 10}, []byte{10}, -1) + // Replace CF \r (Mac) with LF \n (Unix) + value = bytes.Replace(value, []byte{13}, []byte{10}, -1) + renderedValue := markdown.Render(string(value), 80, 0) + value = []byte(renderedValue) + } + title := timeline.User.Name + // we need to avoid a box panic when the comment is shorter than the title; specifically + // panic: Title must be shorter than the Top & Bottom Bars + // to do this, we will set horizontal padding to 1 instead of 2...and + // add our own space-based padding as a prefix + customPadding := []byte(strings.Repeat(" ", len(title)) + "\n") + value = append(customPadding, value...) + // we will also make sure that the value trails with a newline... + // such that we have consistent horizontal bottom padding + if !strings.HasSuffix(string(value), "\n") { + value = append(value, []byte("\n")...) + } + b.Println(title, string(value)) +} + +func renderAlertTimelineBoxes(timelines []api.AlertTimeline) { + timelineBox := box.New(box.Config{Px: 2, Py: 2, Type: "Single", Color: "Cyan", TitlePos: "Top"}) + + for _, t := range timelines { + renderAlertTimelineBox(timelineBox, t) + } +} + func showAlertTimeline(id int) error { cli.StartProgress(" Fetching alert timeline...") timelineResponse, err := cli.LwApi.V2.Alerts.GetTimeline(id) @@ -52,6 +95,11 @@ func showAlertTimeline(id int) error { return nil } - renderAlertTimelineTable(timelineResponse.Data) + if runtime.GOOS == "windows" { + renderAlertTimelineTable(timelineResponse.Data) + } else { + renderAlertTimelineBoxes(timelineResponse.Data) + } + return nil } diff --git a/cli/docs/lacework_alert_comment.md b/cli/docs/lacework_alert_comment.md index bc092f974..08eee4482 100644 --- a/cli/docs/lacework_alert_comment.md +++ b/cli/docs/lacework_alert_comment.md @@ -14,6 +14,11 @@ Post a user comment on an alert's timeline . Comments may be provided inline or via editor. +The following comment formats are allowed: + * Plaintext + * Markdown + +Note: only markdown comments will be rendered using markdown. ``` lacework alert comment [flags] @@ -23,6 +28,7 @@ lacework alert comment [flags] ``` -c, --comment string a comment to add to the alert + -f, --format string the format of the comment (default Plaintext) -h, --help help for comment ``` diff --git a/go.mod b/go.mod index c69754285..988a0f9a3 100644 --- a/go.mod +++ b/go.mod @@ -53,6 +53,8 @@ require ( ) require ( + github.com/Delta456/box-cli-maker/v2 v2.3.0 + github.com/MichaelMure/go-term-markdown v0.1.4 github.com/aws/aws-sdk-go-v2/service/iam v1.18.23 github.com/aws/aws-sdk-go-v2/service/ssm v1.33.1 github.com/aws/smithy-go v1.13.5 @@ -71,10 +73,12 @@ require ( require ( cloud.google.com/go v0.105.0 // indirect cloud.google.com/go/longrunning v0.3.0 // indirect + github.com/MichaelMure/go-term-text v0.3.1 // indirect github.com/Microsoft/go-winio v0.6.0 // indirect github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 // indirect github.com/acomagu/bufpipe v1.0.3 // indirect github.com/agext/levenshtein v1.2.1 // indirect + github.com/alecthomas/chroma v0.7.1 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/aws/aws-sdk-go-v2/credentials v1.13.8 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 // indirect @@ -87,7 +91,11 @@ require ( github.com/aws/aws-sdk-go-v2/service/sts v1.18.0 // indirect github.com/cloudflare/circl v1.1.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/disintegration/imaging v1.6.2 // indirect + github.com/dlclark/regexp2 v1.1.6 // indirect + github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect github.com/facebookgo/limitgroup v0.0.0-20150612190941-6abd8d71ec01 // indirect @@ -98,12 +106,15 @@ require ( github.com/go-git/go-billy/v5 v5.4.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect + github.com/gomarkdown/markdown v0.0.0-20191123064959-2c17d62f5098 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect github.com/googleapis/gax-go/v2 v2.7.0 // indirect + github.com/gookit/color v1.5.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/huandu/xstrings v1.3.2 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect @@ -111,14 +122,17 @@ require ( github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/klauspost/compress v1.15.9 // indirect github.com/kr/pty v1.1.8 // indirect + github.com/lucasb-eyer/go-colorful v1.0.3 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect + github.com/muesli/reflow v0.3.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pjbgf/sha1cd v0.2.3 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/skeema/knownhosts v1.1.0 // indirect @@ -128,9 +142,11 @@ require ( github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect + github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect + golang.org/x/image v0.0.0-20191206065243-da761ea9ff43 // indirect golang.org/x/mod v0.8.0 // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sys v0.6.0 // indirect diff --git a/go.sum b/go.sum index 36b34d44c..a085b116b 100644 --- a/go.sum +++ b/go.sum @@ -58,8 +58,14 @@ github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/Delta456/box-cli-maker/v2 v2.3.0 h1:rGdoK/Qt3shdT1uqRMGgPqrhtisGD7PamTW8vY5MyCA= +github.com/Delta456/box-cli-maker/v2 v2.3.0/go.mod h1:Uv/kSX95LuNQn3C8wWazEIETE6MunPuYN+/knckbPQc= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/MichaelMure/go-term-markdown v0.1.4 h1:Ir3kBXDUtOX7dEv0EaQV8CNPpH+T7AfTh0eniMOtNcs= +github.com/MichaelMure/go-term-markdown v0.1.4/go.mod h1:EhcA3+pKYnlUsxYKBJ5Sn1cTQmmBMjeNlpV8nRb+JxA= +github.com/MichaelMure/go-term-text v0.3.1 h1:Kw9kZanyZWiCHOYu9v/8pWEgDQ6UVN9/ix2Vd2zzWf0= +github.com/MichaelMure/go-term-text v0.3.1/go.mod h1:QgVjAEDUnRMlzpS6ky5CGblux7ebeiLnuy9dAaFZu8o= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= @@ -77,6 +83,15 @@ github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= +github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= +github.com/alecthomas/chroma v0.7.1 h1:G1i02OhUbRi2nJxcNkwJaY/J1gHXj9tt72qN6ZouLFQ= +github.com/alecthomas/chroma v0.7.1/go.mod h1:gHw09mkX1Qp80JlYbmN9L3+4R5o6DJJ3GRShh+AICNc= +github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo= +github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= +github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI= +github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY= +github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= @@ -143,9 +158,17 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= +github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= +github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= +github.com/dlclark/regexp2 v1.1.6 h1:CqB4MjHw0MFCDj+PHHjiESmHX+N7t0tJzKvC6M97BRg= +github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 h1:vbix8DDQ/rfatfFr/8cf/sJfIL69i4BcZfjrVOxsMqk= +github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75/go.mod h1:0gZuvTO1ikSA5LtTI6E13LEOdWQNjIo5MTQOvrV0eFg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= @@ -168,6 +191,7 @@ github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqL github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= @@ -232,6 +256,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/gomarkdown/markdown v0.0.0-20191123064959-2c17d62f5098 h1:Qxs3bNRWe8GTcKMxYOSXm0jx6j0de8XUtb/fsP3GZ0I= +github.com/gomarkdown/markdown v0.0.0-20191123064959-2c17d62f5098/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= @@ -274,6 +300,8 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ= github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= +github.com/gookit/color v1.5.2 h1:uLnfXcaFjlrDnQDT+NCBcfhrXqYTx/rcCa6xn01Y8yI= +github.com/gookit/color v1.5.2/go.mod h1:w8h4bGiHeeBpvQVePTutdbERIUf3oJE5lZ8HM0UgXyg= github.com/hashicorp/consul/sdk v0.13.1 h1:EygWVWWMczTzXGpO93awkHFzfUka6hLYJ0qhETd+6lY= github.com/hashicorp/consul/sdk v0.13.1/go.mod h1:SW/mM4LbKfqmMvcFu8v+eiQQ7oitXEFeiBe9StxERb0= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -305,6 +333,8 @@ github.com/hokaccha/go-prettyjson v0.0.0-20190818114111-108c894c2c0e h1:0aewS5NT github.com/hokaccha/go-prettyjson v0.0.0-20190818114111-108c894c2c0e/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI= github.com/honeycombio/libhoney-go v1.18.0 h1:OYHOP381r3Ea76BhUYeza8PUTMDp8MByoOxDn3qtEq8= github.com/honeycombio/libhoney-go v1.18.0/go.mod h1:KwbcXkqUbH20x3MpfSt/kdvlog3FFdEnouqYD3XKXLY= +github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= +github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= @@ -340,24 +370,33 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/kyokomi/emoji/v2 v2.2.8/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= github.com/kyokomi/emoji/v2 v2.2.12 h1:sSVA5nH9ebR3Zji1o31wu3yOwD1zKXQA2z0zUyeit60= github.com/kyokomi/emoji/v2 v2.2.12/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= +github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= +github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= +github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= +github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= @@ -367,9 +406,12 @@ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzC github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4= github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= +github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= @@ -388,12 +430,16 @@ github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qR github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= @@ -440,6 +486,9 @@ github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= +github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -466,6 +515,7 @@ go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +golang.org/dl v0.0.0-20190829154251-82a15e2f2ead/go.mod h1:IUMfjQLJQd4UTqG1Z90tenwKoCX93Gn3MAQJMOSBsDQ= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -495,10 +545,14 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= golang.org/x/exp v0.0.0-20221208152030-732eee02a75a h1:4iLhBPcpqFmylhnkbY3W0ONLUYYkDAW9xMFLfxgsvCw= golang.org/x/exp v0.0.0-20221208152030-732eee02a75a/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20191206065243-da761ea9ff43 h1:gQ6GUSD102fPgli+Yb4cR/cGaHF7tNBt+GYoRCpGC7s= +golang.org/x/image v0.0.0-20191206065243-da761ea9ff43/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -536,6 +590,7 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -589,6 +644,7 @@ golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -628,6 +684,7 @@ golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -641,6 +698,7 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= @@ -650,6 +708,7 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20221017184919-83659145692c/go.mod h1:VTIZ7TEbF0BS9Sv9lPTvGbtW8i4z6GGbJBCM37uMCzY= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= diff --git a/integration/alert_comment_test.go b/integration/alert_comment_test.go index 081f7f649..f2b6fca13 100644 --- a/integration/alert_comment_test.go +++ b/integration/alert_comment_test.go @@ -26,9 +26,19 @@ import ( "github.com/stretchr/testify/assert" ) -func makeComment(id string) (bytes.Buffer, bytes.Buffer, int) { +func makePlaintextComment(id string) (bytes.Buffer, bytes.Buffer, int) { return LaceworkCLIWithTOMLConfig( - "alert", "comment", id, "-c", "everything is awesome...cause go-sdk is here") + "alert", "comment", id, "-c", "everything is awesome...cause go-sdk is here", "-f", "Plaintext") +} + +func makeShortPlaintextComment(id string) (bytes.Buffer, bytes.Buffer, int) { + return LaceworkCLIWithTOMLConfig( + "alert", "comment", id, "-c", "a", "-f", "Plaintext") +} + +func makeMarkdownComment(id string) (bytes.Buffer, bytes.Buffer, int) { + return LaceworkCLIWithTOMLConfig( + "alert", "comment", id, "-c", "# Heading", "-f", "Markdown") } func TestAlertCommentMissingArg(t *testing.T) { @@ -63,7 +73,31 @@ func TestAlertCommentInline(t *testing.T) { assert.FailNow(t, err.Error()) } - out, stderr, exitcode := makeComment(id) + out, stderr, exitcode := makePlaintextComment(id) + assert.Contains(t, out.String(), "Comment added successfully") + assert.Empty(t, stderr.String(), "STDERR should be empty") + assert.Equal(t, 0, exitcode, "EXITCODE is not the expected one") +} + +func TestAlertShortCommentInline(t *testing.T) { + id, err := popAlert() + if err != nil { + assert.FailNow(t, err.Error()) + } + + out, stderr, exitcode := makeShortPlaintextComment(id) + assert.Contains(t, out.String(), "Comment added successfully") + assert.Empty(t, stderr.String(), "STDERR should be empty") + assert.Equal(t, 0, exitcode, "EXITCODE is not the expected one") +} + +func TestAlertMarkdownCommentInline(t *testing.T) { + id, err := popAlert() + if err != nil { + assert.FailNow(t, err.Error()) + } + + out, stderr, exitcode := makeMarkdownComment(id) assert.Contains(t, out.String(), "Comment added successfully") assert.Empty(t, stderr.String(), "STDERR should be empty") assert.Equal(t, 0, exitcode, "EXITCODE is not the expected one") diff --git a/integration/alert_show_test.go b/integration/alert_show_test.go index 064bce21e..391753659 100644 --- a/integration/alert_show_test.go +++ b/integration/alert_show_test.go @@ -147,11 +147,10 @@ func TestAlertShowIntegrations(t *testing.T) { } func TestAlertShowTimeline(t *testing.T) { - makeComment(alertShowID) + makePlaintextComment(alertShowID) out, err, exitcode := LaceworkCLIWithTOMLConfig("alert", "show", alertShowID, "--scope", "Timeline") - assert.Contains(t, out.String(), "AUTHOR") - assert.Contains(t, out.String(), "For further investigation") + assert.Contains(t, out.String(), "@") assert.Empty(t, err.String(), "STDERR should be empty") assert.Equal(t, 0, exitcode, "EXITCODE is not the expected one") diff --git a/integration/test_resources/help/alert_comment b/integration/test_resources/help/alert_comment index 8cec653ce..c951dcd39 100644 --- a/integration/test_resources/help/alert_comment +++ b/integration/test_resources/help/alert_comment @@ -2,11 +2,18 @@ Post a user comment on an alert's timeline . Comments may be provided inline or via editor. +The following comment formats are allowed: + * Plaintext + * Markdown + +Note: only markdown comments will be rendered using markdown. + Usage: lacework alert comment [flags] Flags: -c, --comment string a comment to add to the alert + -f, --format string the format of the comment (default Plaintext) -h, --help help for comment Global Flags: diff --git a/vendor/github.com/Delta456/box-cli-maker/v2/.gitignore b/vendor/github.com/Delta456/box-cli-maker/v2/.gitignore new file mode 100644 index 000000000..9b0d83c2f --- /dev/null +++ b/vendor/github.com/Delta456/box-cli-maker/v2/.gitignore @@ -0,0 +1,15 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ diff --git a/vendor/github.com/Delta456/box-cli-maker/v2/.golangci.yml b/vendor/github.com/Delta456/box-cli-maker/v2/.golangci.yml new file mode 100644 index 000000000..df634944a --- /dev/null +++ b/vendor/github.com/Delta456/box-cli-maker/v2/.golangci.yml @@ -0,0 +1,55 @@ +run: + deadline: 1m + tests: false + skip-files: + - "testing.go" + - ".*\\.pb\\.go" + - ".*\\.gen\\.go" + +linters-settings: + golint: + min-confidence: 0 + maligned: + suggest-new: true + goconst: + min-len: 5 + min-occurrences: 4 + misspell: + locale: US + +linters: + disable-all: true + enable: + - bodyclose + - deadcode + - depguard + - dogsled + - dupl + - errcheck + - funlen + - gochecknoinits + #- gocognit + - goconst + - gocritic + - gocyclo + - gofmt + - goimports + - golint + - gosimple + - govet + - ineffassign + - interfacer + - maligned + - misspell + - nakedret + - prealloc + - scopelint + - staticcheck + - structcheck + #- stylecheck + - typecheck + - unconvert + - unparam + - unused + - varcheck + - whitespace diff --git a/vendor/github.com/Delta456/box-cli-maker/v2/LICENSE b/vendor/github.com/Delta456/box-cli-maker/v2/LICENSE new file mode 100644 index 000000000..b0c9bf2b2 --- /dev/null +++ b/vendor/github.com/Delta456/box-cli-maker/v2/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Swastik Baranwal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/Delta456/box-cli-maker/v2/README.md b/vendor/github.com/Delta456/box-cli-maker/v2/README.md new file mode 100644 index 000000000..7b1b00f95 --- /dev/null +++ b/vendor/github.com/Delta456/box-cli-maker/v2/README.md @@ -0,0 +1,296 @@ +
+
+logo +
+
+
+
+ +[![Go Reference](https://pkg.go.dev/badge/github.com/Delta456/box-cli-maker/v2.svg)](https://pkg.go.dev/github.com/Delta456/box-cli-maker/v2) +[![godocs.io](http://godocs.io/github.com/Delta456/box-cli-maker?status.svg)](https://godocs.io/github.com/Delta456/box-cli-maker/v2) +[![CI](https://github.com/Delta456/box-cli-maker/workflows/Box%20CLI%20Maker/badge.svg)](https://github.com/Delta456/box-cli-maker/actions?query=workflow%3A"Box+CLI+Maker") +[![Go Report Card](https://goreportcard.com/badge/github.com/Delta456/box-cli-maker)](https://goreportcard.com/report/github.com/Delta456/box-cli-maker) +[![GolangCI](https://golangci.com/badges/github.com/moul/golang-repo-template.svg)](https://golangci.com/r/github.com/Delta456/box-cli-maker) +[![GitHub release](https://img.shields.io/github/release/Delta456/box-cli-maker.svg)](https://github.com/Delta456/box-cli-maker/releases) +[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) + +
+ +## Features + +- Make a Terminal Box in 8️⃣ inbuilt different styles +- 16 Inbuilt Colors and True Color Support 🎨 +- Custom Title Positions 📏 +- Make your Terminal Box style 📦 +- Support for ANSI, Tabbed, Multi-line and Line Wrapping boxes 📑 +- Align the text according to your needs 📐 +- Unicode, Emoji and [Windows Console](https://en.wikipedia.org/wiki/Windows_Console) Support 😋 +- Written in 🇬 🇴 + +## Installation + +```terminal + go get github.com/Delta456/box-cli-maker/v2 +``` + +## Usage + +In `main.go` + +```go +package main + +import "github.com/Delta456/box-cli-maker/v2" + +func main() { + Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: "Cyan"}) + Box.Print("Box CLI Maker", "Highly Customized Terminal Box Maker") +} +``` + +`box.New(config Config)` takes Box `Config` and returns a `Box` from the given `Config`. + +- Parameters + - `Px` : Horizontal Padding + - `Py` : Vertical Padding + - `ContentAlign` : Content Alignment inside Box i.e. `Center`, `Left` and `Right` + - `Type`: Box Type + - `TitlePos` : Title Position of Box i.e. `Inside`, `Top` and `Bottom` + - `Color` : Box Color + - `TitleColor` : Title Color + - `ContentColor` : Content Color + - `AllowWrapping`: Flag to allow custom `Content` wrapping + - `WrappingLimit`: Wrap the `Content` up to the Limit + +### `Box` Methods + +`Box.Print(title, lines string)` prints Box from the specified arguments. + +- Parameters + - `title` : Box Title + - `lines` : Box Content + +`Box.Println(title, lines string)` prints Box in a newline from the specified arguments. + +- Parameters + - `title` : Box Title + - `lines` : Box Content + +`Box.String(title, lines string) string` returns `string` representation of Box. + +- Parameters + - `title` : Box Title + - `lines` : Box Content + +### Box Types + +- `Single` + +

+single +

+ +- `Single Double` + +

+single_double +

+ +- `Double` + +

+double +

+ +- `Double Single` +

+double_single +

+ +- `Bold` + +

+bold +

+ +- `Round` + +

+round +

+ +- `Hidden` + +

+hidden +

+ +- `Classic` + +

+classic +

+ +### Title Positions + +- `Inside` + +

+single +

+ +- `Top` + +

+top +

+ +- `Bottom` + +

+bottom +

+ +### Custom Box + +A Custom Box can be created by using the built-in Box struct provided by the module. + +```go +type Box struct { + TopRight string // TopRight Corner Symbols + TopLeft string // TopLeft Corner Symbols + Vertical string // Vertical Bar Symbols + BottomRight string // BottomRight Corner Symbols + BottomLeft string // BottomLeft Corner Symbols + Horizontal string // Horizontal Bar Symbols + Config // Box Config +} +``` + +#### Usage + +In `main.go`: + +```go +package main + +import "github.com/Delta456/box-cli-maker/v2" + +func main() { + config := box.Config{Px: 2, Py: 3, Type: "", TitlePos: "Inside"} + boxNew := box.Box{TopRight: "*", TopLeft: "*", BottomRight: "*", BottomLeft: "*", Horizontal: "-", Vertical: "|", Config: config} + boxNew.Println("Box CLI Maker", "Make Highly Customized Terminal Boxes") +} +``` + +

+custom +

+ +More examples can be found in the `examples/` folder. + +### Color Types + +Color support is provided by the [gookit/color](https://github.com/gookit/color) module from which it uses `FgColor` and `FgHiColor`. `Color` is a key for the following maps: + +```go + fgColors map[string]color.Color = { + "Black": color.FgBlack, + "Blue": color.FgBlue, + "Red": color.FgRed, + "Green": color.FgGreen, + "Yellow": color.FgYellow, + "Cyan": color.FgCyan, + "Magenta": color.FgMagenta, + "White": color.FgWhite, +} + + fgHiColors map[string]color.Color = { + "HiBlack": color.FgDarkGray, + "HiBlue": color.FgLightBlue, + "HiRed": color.FgLightRed, + "HiGreen": color.FgLightGreen, + "HiYellow": color.FgLightYellow, + "HiCyan": color.FgLightCyan, + "HiMagenta": color.FgLightMagenta, + "HiWhite": color.FgLightWhite, +} +``` + +If you want High-Intensity Colors then the Color name must start with `Hi`. If the Color option is empty or invalid then no colour is applied. + +1. True Color is also possible though you need to provide it either as `uint` or `[3]uint`. + +2. `[3]uint`'s elements all must be in a range of `[0, 0xFF]` and `uint` in range of `[0x000000, 0xFFFFFF]`. + +As a convenience, if the terminal doesn't support True Color then it will round off according to the terminal's max supported colours which makes it easier for the users not to worry about other terminals in most cases. + +Here's a list of 24-bit [supported terminals](https://gist.github.com/XVilka/8346728) and 8 bit [supported terminals](https://fedoraproject.org/wiki/Features/256_Color_Terminals). + +This module also enables **True Color** and **256 Colors** support on Windows Console through [Virtual Terminal Processing](https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences) but you need to have at least [Windows 10 Version 1511](https://en.wikipedia.org/wiki/Windows_10_version_history_(version_1511)) for 256 colors or [Windows 10 Version 1607](https://en.wikipedia.org/wiki/Windows_10_version_history_(version_1607)) for True Color Support. + +4-bit Colors are now standardized so they should be supported by all Terminals now. + +If `ConEmu` or `ANSICON` is installed for Windows systems then it will also be detected. It is highly recommended to use the latest versions of both of them to have the best experience. + +### Content Wrapping + +This library allows the usage of custom wrapping of `Content` so that the Box formed will be created according to your own needs. + +To enable this `Config.AllowWrapping` must be set to `true` plus you can also provide your own wrapping limit via `Config.WrappingLimit` which has a default value of `2*TermWidth/3` where `TermWidth` is the current terminal's width. + +### Note + +#### 1. Vertical Alignment + +As different terminals have different fonts by default, the right vertical alignment may not be aligned well. You will have to change your font accordingly to make it work. + +#### 2. Limitations of Unicode and Emoji + +It uses [mattn/go-runewidth](https://github.com/mattn/go-runewidth) for Unicode and Emoji support though there are some limitations: + +- `Windows Terminal`, `ConEmu` and `Mintty` are the only known terminal emulators which can render Unicode and Emojis properly on Windows. +- Indic Text only works on very few Terminals. +- It is recommended not to use this for Online Playgrounds like [`Go Playground`](https://play.golang.org/) and [`Repl.it`](https://repl.it), `CI/CDs` etc. because they use a font that only has ASCII support and other Character Sets are used, which becomes problematic for finding the length as the font changes at runtime. +- Some changes may be needed to your font which supports Unicode and Emojis else the right vertical alignment may likely break. + +#### 3. Terminal Color Detection + +It is possible to round off True Color provided to 8-bit or 4-bit according to your terminal's maximum capacity. + +There is no **standardized way** of detecting the terminal's maximum color capacity so the way of detecting your terminal might not work for you. If you have a fix for your terminal then you can always make a PR. + +The following two points are only applicable for **Unix** systems: + +- If the module can't detect the True Color of the terminal then your environment variable `COLORTERM` must be changed to `truecolor` or `24bit` for True Color support. + +- If Targetting 8-bit color-based terminals and the module couldn't detect it, then the environment variable `TERM` must be set to the name of the terminal emulator with `256color` as a suffix like `xterm-256color`. + +There might be no color effect for very old terminals like [`Windows Console (Legacy Mode)`](https://docs.microsoft.com/en-us/windows/console/legacymode) or `TERM` environment variable which gives `DUMB` so the module will output some garbage value or a warning if used. + +It is **not** recommended to use this module with color effect in `Online Playgrounds`, `CI/CD`, `Browsers` etc, as few may support color and this is hard to detect in general. If there is a possible way, then open an issue and address the solution! + +#### 4. Tabs + +This library supports the usage of tabs but their use should be limited. + +### Projects using Box CLI Maker + +- kubernetes logo [kubernetes/minikube](https://github.com/kubernetes/minikube): Run Kubernetes locally. +- +[Many More](https://pkg.go.dev/github.com/Delta456/box-cli-maker/v2?tab=importedby)! + +### Acknowledgements + +I thank the following people and their packages whom I have studied and was able to port to Go accordingly. + +- [thecodrr/boxx](https://github.com/thecodrr/boxx) +- [Atrox/box](https://github.com/Atrox/box) +- [sindreorhus-cli-boxes](https://github.com/sindresorhus/cli-boxes) + +Also special thanks to [@elimsteve](https://github.com/elimisteve) who helped me to optimize the code and told me the best possible ways to fix my problems, [@JalonSolov](https://github.com/JalonSolov) for tab lines support and [Kunal Raghav](https://github.com/KunalRaghav) for making the library's logo. + +Kudos to [moul/golang-repo-template](https://github.com/moul/golang-repo-template) for their Go template. + +### License + +Licensed under [MIT](LICENSE) diff --git a/vendor/github.com/Delta456/box-cli-maker/v2/box.go b/vendor/github.com/Delta456/box-cli-maker/v2/box.go new file mode 100644 index 000000000..929f0c341 --- /dev/null +++ b/vendor/github.com/Delta456/box-cli-maker/v2/box.go @@ -0,0 +1,424 @@ +package box + +import ( + "fmt" + "log" + "os" + "strings" + + "github.com/gookit/color" + "github.com/huandu/xstrings" + "github.com/mattn/go-runewidth" + "github.com/muesli/reflow/wrap" + "golang.org/x/term" +) + +const ( + n1 = "\n" + inside = "Inside" + + // 1 = separator, 2 = spacing, 3 = line; 4 = oddSpace; 5 = space; 6 = sideMargin + centerAlign = "%[1]s%[2]s%[3]s%[4]s%[2]s%[1]s" + leftAlign = "%[1]s%[6]s%[3]s%[4]s%[2]s%[5]s%[1]s" + rightAlign = "%[1]s%[2]s%[4]s%[5]s%[3]s%[6]s%[1]s" +) + +// Box defines the design +type Box struct { + TopRight string // TopRight Corner Symbols + TopLeft string // TopLeft Corner Symbols + Vertical string // Vertical Bar Symbols + BottomRight string // BottomRight Corner Symbols + BottomLeft string // BottomLeft Corner Symbols + Horizontal string // Horizontal Bars Symbols + Config // Box Config +} + +// Config is the configuration needed for the Box to be designed +type Config struct { + Py int // Horizontal Padding + Px int // Vertical Padding + ContentAlign string // Content Alignment inside Box + Type string // Box Type + TitlePos string // Title Position + TitleColor interface{} // Title Color + ContentColor interface{} // Content Color + Color interface{} // Box Color + AllowWrapping bool // Flag to allow custom Content Wrapping + WrappingLimit int // Wrap the Content upto the Limit +} + +// New takes Box Config and returns a Box from the given Config +func New(config Config) Box { + // Default Box Type is Single + if config.Type == "" { + boxNew := boxes["Single"] + boxNew.Config = config + return boxNew + // Check if the Box Type provided is valid else panic + } else if _, ok := boxes[config.Type]; ok { + boxNew := boxes[config.Type] + boxNew.Config = config + return boxNew + } + panic("Invalid Box Type provided") +} + +// String returns the string representation of Box +func (b Box) String(title, lines string) string { + var lines2 []string + + // Allow Wrapping according to the user + if b.AllowWrapping { + // If limit not provided then use 2*TermWidth/3 as limit else + // use the one provided + if b.WrappingLimit != 0 { + lines = wrap.String(lines, b.WrappingLimit) + } else { + width, _, err := term.GetSize(int(os.Stdout.Fd())) + if err != nil { + log.Fatal(err) + } + lines = wrap.String(lines, 2*width/3) + } + } + + // Obtain Title and Content color + title = b.obtainTitleColor(title) + lines = b.obtainContentColor(lines) + + // Default Position is Inside, no warning for invalid TitlePos as it is done + // in toString() method + if b.TitlePos == "" { + b.TitlePos = inside + } + // if Title is empty then TitlePos should be Inside + if title != "" { + if b.TitlePos != inside && strings.Contains(title, "\n") { + panic("Multilines are only supported inside only") + } + if b.TitlePos == inside { + lines2 = append(lines2, strings.Split(title, n1)...) + lines2 = append(lines2, []string{""}...) // for empty line between title and content + } + } + lines2 = append(lines2, strings.Split(lines, n1)...) + return b.toString(title, lines2) +} + +// toString is an internal method and same as String method except that the main Box generation is done here +func (b Box) toString(title string, lines []string) string { + titleLen := len(strings.Split(color.ClearCode(title), n1)) + sideMargin := strings.Repeat(" ", b.Px) + _longestLine, lines2 := longestLine(lines) + + // Get padding on one side + paddingCount := b.Px + + n := _longestLine + (paddingCount * 2) + 2 + + if b.TitlePos != inside && runewidth.StringWidth(color.ClearCode(title)) > n-2 { + panic("Title must be shorter than the Top & Bottom Bars") + } + + // Create Top and Bottom Bars + Bar := strings.Repeat(b.Horizontal, n-2) + TopBar := b.TopLeft + Bar + b.TopRight + BottomBar := b.BottomLeft + Bar + b.BottomRight + + var TitleBar string + // If title has tabs then expand them accordingly. + if strings.Contains(title, "\t") { + TitleBar = repeatWithString(b.Horizontal, n-2, xstrings.ExpandTabs(title, 4)) + } else { + TitleBar = repeatWithString(b.Horizontal, n-2, title) + } + + // Check b.TitlePos if it is not Inside + if b.TitlePos != inside { + switch b.TitlePos { + case "Top": + TopBar = b.TopLeft + TitleBar + b.TopRight + //fmt.Println(TopBar) + case "Bottom": + BottomBar = b.BottomLeft + TitleBar + b.BottomRight + default: + // Duplicate warning done here if the String() method is used + // instead of using Print() and Println() methods + errorMsg("[warning]: invalid value provided for TitlePos, using default") + // Using goto here to inorder to exit the current if branch + goto inside + } + } +inside: + // Check type of b.Color then assign the Colors to TopBar and BottomBar accordingly + // If title has tabs then expand them accordingly. + if strings.Contains(title, "\t") { + TopBar, BottomBar = b.checkColorType(TopBar, BottomBar, xstrings.ExpandTabs(title, 4)) + } else { + TopBar, BottomBar = b.checkColorType(TopBar, BottomBar, title) + } + + if b.TitlePos == inside && runewidth.StringWidth(TopBar) != runewidth.StringWidth(BottomBar) { + panic("cannot create a Box with different sizes of Top and Bottom Bars") + } + + // Create lines to print + texts := b.addVertPadding(n) + texts = b.formatLine(lines2, _longestLine, titleLen, sideMargin, title, texts) + vertpadding := b.addVertPadding(n) + texts = append(texts, vertpadding...) + + // Using strings.Builder is more efficient and faster + // than concatenating 6 times + var sb strings.Builder + + sb.WriteString(TopBar) + sb.WriteString(n1) + sb.WriteString(strings.Join(texts, n1)) + sb.WriteString(n1) + sb.WriteString(BottomBar) + sb.WriteString(n1) + + return sb.String() +} + +// obtainTitleColor obtains TitleColor from types string, uint and [3]uint respectively +func (b Box) obtainTitleColor(title string) string { + if b.TitleColor == nil { // if nil then just return the string + return title + } + // Check if type of b.TitleColor is string + if str, ok := b.TitleColor.(string); ok { + // Hi Intensity Color + if strings.HasPrefix(str, "Hi") { + if _, ok := fgHiColors[str]; ok { + // If title has newlines in it then splitting would be needed + // as color won't be applied on all + if strings.Contains(title, "\n") { + return b.applyColorToAll(title, str, color.RGBColor{}, false) + } + return addStylePreservingOriginalFormat(title, fgHiColors[str].Sprint) + } + } else if _, ok := fgColors[str]; ok { + // If title has newlines in it then splitting would be needed + // as color won't be applied on all + if strings.Contains(title, "\n") { + return b.applyColorToAll(title, str, color.RGBColor{}, false) + } + return addStylePreservingOriginalFormat(title, fgColors[str].Sprint) + } + // Return a warning as TitleColor provided as a string is unknown and + // return without the color effect + errorMsg("[warning]: invalid value provided to Color, using default") + return title + + // Check if type of b.TitleColor is uint + } else if hex, ok := b.TitleColor.(uint); ok { + // Break down the hex into R, G and B respectively + hexArray := [3]uint{hex >> 16, hex >> 8 & 0xff, hex & 0xff} + col := color.RGB(uint8(hexArray[0]), uint8(hexArray[1]), uint8(hexArray[2])) + + // If title has newlines in it then splitting would be needed + // as color won't be applied on all + if strings.Contains(title, "\n") { + return b.applyColorToAll(title, "", col, true) + } + return addStylePreservingOriginalFormat(title, col.Sprint) + + // Check if type of b.TitleColor is [3]uint + } else if rgb, ok := b.TitleColor.([3]uint); ok { + col := color.RGB(uint8(rgb[0]), uint8(rgb[1]), uint8(rgb[2])) + + // If title has newlines in it then splitting would be needed + // as color won't be applied on all + if strings.Contains(title, "\n") { + return b.applyColorToAll(title, "", col, true) + } + return b.roundOffTitleColor(col, addStylePreservingOriginalFormat(title, col.Sprint)) + } + // Panic if b.TitleColor is an unexpected type + panic(fmt.Sprintf("expected string, [3]uint or uint not %T", b.TitleColor)) +} + +// obtainContentColor obtains ContentColor from types string, uint and [3]uint respectively +func (b Box) obtainContentColor(content string) string { + if b.ContentColor == nil { // if nil then just return the string + return content + } + // Check if type of b.ContentColor is string + if str, ok := b.ContentColor.(string); ok { + // Hi Intensity Color + if strings.HasPrefix(str, "Hi") { + if _, ok := fgHiColors[str]; ok { + // If Content has newlines in it then splitting would be needed + // as color won't be applied on all + if strings.Contains(content, "\n") { + return b.applyColorToAll(content, str, color.RGBColor{}, false) + } + return addStylePreservingOriginalFormat(content, fgHiColors[str].Sprint) + } + } else if _, ok := fgColors[str]; ok { + // If Content has newlines in it then splitting would be needed + // as color won't be applied on all + if strings.Contains(content, "\n") { + return b.applyColorToAll(content, str, color.RGBColor{}, false) + } + return addStylePreservingOriginalFormat(content, fgColors[str].Sprint) + } + // Return a warning as ContentColor provided as a string is unknown and + // return without the color effect + errorMsg("[warning]: invalid value provided to Color, using default") + return content + + // Check if type of b.ContentColor is uint + } else if hex, ok := b.ContentColor.(uint); ok { + // Break down the hex into R, G and B respectively + hexArray := [3]uint{hex >> 16, hex >> 8 & 0xff, hex & 0xff} + col := color.RGB(uint8(hexArray[0]), uint8(hexArray[1]), uint8(hexArray[2])) + + // If content has newlines in it then splitting would be needed + // as color won't be applied on all + if strings.Contains(content, "\n") { + return b.applyColorToAll(content, "", col, true) + } + return b.roundOffTitleColor(col, content) + + // Check if type of b.ContentColor is [3]uint + } else if rgb, ok := b.ContentColor.([3]uint); ok { + col := color.RGB(uint8(rgb[0]), uint8(rgb[1]), uint8(rgb[2])) + + // If content has newlines in it then splitting would be needed + // as color won't be applied on all + if strings.Contains(content, "\n") { + return b.applyColorToAll(content, "", col, true) + } + return b.roundOffTitleColor(col, content) + } + // Panic if b.ContentColor is an unexpected type + panic(fmt.Sprintf("expected string, [3]uint or uint not %T", b.ContentColor)) +} + +// obtainColor obtains BoxColor from types string, uint and [3]uint respectively +func (b Box) obtainBoxColor() string { + if b.Color == nil { // if nil then just return the string + return b.Vertical + } + // Check if type of b.Color is string + if str, ok := b.Color.(string); ok { + // Hi Intensity Color + if strings.HasPrefix(str, "Hi") { + if _, ok := fgHiColors[str]; ok { + return fgHiColors[str].Sprintf(b.Vertical) + } + } else if _, ok := fgColors[str]; ok { + return fgColors[str].Sprintf(b.Vertical) + } + errorMsg("[warning]: invalid value provided to Color, using default") + // Return a warning as Color provided as a string is unknown and + // return without the color effect + return b.Vertical + // Check if type of b.Color is uint + } else if hex, ok := b.Color.(uint); ok { + // Break down the hex into r, g and b respectively + hexArray := [3]uint{hex >> 16, hex >> 8 & 0xff, hex & 0xff} + col := color.RGB(uint8(hexArray[0]), uint8(hexArray[1]), uint8(hexArray[2])) + return b.roundOffColorVertical(col) + // Check if type of b.Color is [3]uint + } else if rgb, ok := b.Color.([3]uint); ok { + col := color.RGB(uint8(rgb[0]), uint8(rgb[1]), uint8(rgb[2])) + return b.roundOffColorVertical(col) + } + // Panic if b.Color is an unexpected type + panic(fmt.Sprintf("expected string, [3]uint or uint not %T", b.Color)) +} + +// Print prints the Box +func (b Box) Print(title, lines string) { + var lines2 []string + + // Allow Wrapping according to the user + if b.AllowWrapping { + // If limit not provided then use 2*TermWidth/3 as limit else + // use the one provided + if b.WrappingLimit != 0 { + lines = wrap.String(lines, b.WrappingLimit) + } else { + width, _, err := term.GetSize(int(os.Stdout.Fd())) + if err != nil { + log.Fatal(err) + } + lines = wrap.String(lines, 2*width/3) + } + } + + // Obtain Title and Content color + title = b.obtainTitleColor(title) + lines = b.obtainContentColor(lines) + + // Default Position is Inside, if invalid position is given then just raise a warning + // then use Default Position which is Inside + if b.TitlePos == "" { + b.TitlePos = inside + } else if b.TitlePos != inside && b.TitlePos != "Bottom" && b.TitlePos != "Top" { + errorMsg("[warning]: invalid value provided for TitlePos, using default") + b.TitlePos = inside + } + // if Title is empty then TitlePos should be Inside + if title != "" { + if b.TitlePos != inside && strings.Contains(title, "\n") { + panic("Multilines are only supported inside only") + } + if b.TitlePos == inside { + lines2 = append(lines2, strings.Split(title, n1)...) + lines2 = append(lines2, []string{""}...) // for empty line between title and content + } + } + lines2 = append(lines2, strings.Split(lines, n1)...) + color.Print(b.toString(title, lines2)) +} + +// Println adds a newline before and after printing the Box +func (b Box) Println(title, lines string) { + var lines2 []string + + // Allow Wrapping according to the user + if b.AllowWrapping { + // If limit not provided then use 2*TermWidth/3 as limit else + // use the one provided + if b.WrappingLimit != 0 { + lines = wrap.String(lines, b.WrappingLimit) + } else { + width, _, err := term.GetSize(int(os.Stdout.Fd())) + if err != nil { + log.Fatal(err) + } + lines = wrap.String(lines, 2*width/3) + } + } + + // Obtain Title and Content color + title = b.obtainTitleColor(title) + lines = b.obtainContentColor(lines) + + // Default Position is Inside, if invalid position is given then just raise a warning + // then use Default Position which is Inside + if b.TitlePos == "" { + b.TitlePos = inside + } else if b.TitlePos != inside && b.TitlePos != "Bottom" && b.TitlePos != "Top" { + errorMsg("[warning]: invalid value provided for TitlePos, using default") + b.TitlePos = inside + } + // if Title is empty then TitlePos should be Inside + if title != "" { + if b.TitlePos != inside && strings.Contains(title, "\n") { + panic("Multilines are only supported inside only") + } + if b.TitlePos == inside { + lines2 = append(lines2, strings.Split(title, n1)...) + lines2 = append(lines2, []string{""}...) // for empty line between title and content + } + } + lines2 = append(lines2, strings.Split(lines, n1)...) + color.Printf("\n%s\n", b.toString(title, lines2)) +} diff --git a/vendor/github.com/Delta456/box-cli-maker/v2/detect_unix.go b/vendor/github.com/Delta456/box-cli-maker/v2/detect_unix.go new file mode 100644 index 000000000..5e725743b --- /dev/null +++ b/vendor/github.com/Delta456/box-cli-maker/v2/detect_unix.go @@ -0,0 +1,123 @@ +//go:build !windows +// +build !windows + +package box + +import ( + "errors" + "fmt" + "io/ioutil" + "log" + "os" + "strings" + + "github.com/gookit/color" + "github.com/xo/terminfo" +) + +// errorMsg prints msg to os.Stderr and uses Red ANSI Color too if supported +func errorMsg(msg string) { + // If the terminal doesn't supports the basic 4 bit + if detectTerminalColor() == terminfo.ColorLevelNone { + fmt.Fprintln(os.Stderr, msg) + } else { + fmt.Fprintln(os.Stderr, color.Red.Sprint(msg)) + } +} + +// detectTerminalColor detects Color Level Supported +func detectTerminalColor() terminfo.ColorLevel { + // Detect WSL as it has True Color support + wsl, err := ioutil.ReadFile("/proc/sys/kernel/osrelease") + // Additional check needed for Mac Os as it doesn't have "/proc/" folder + if err != nil && !errors.Is(err, os.ErrNotExist) { + log.Fatal(err) + } + // Lowercasing every content inside "/proc/sys/kernal/osrelease" + // because it gives "Microsoft" for WSL and "microsoft" for WSL 2 + // so no need of checking twice + if string(wsl) != "" { + wslLower := strings.ToLower(string(wsl)) + if strings.Contains(wslLower, "microsoft") { + return terminfo.ColorLevelMillions + } + } + level, err := terminfo.ColorLevelFromEnv() + if err != nil { + log.Fatal(err) + } + return level +} + +// roundOffColorVertical rounds off 24 bit Color to the terminals maximum color capacity for Vertical. +func (b Box) roundOffColorVertical(col color.RGBColor) string { + switch detectTerminalColor() { + // Check if the terminal supports 256 Colors only + case terminfo.ColorLevelHundreds: + return col.C256().Sprint(b.Vertical) + + // Check if the terminal supports 16 Colors only + case terminfo.ColorLevelBasic: + return col.C16().Sprint(b.Vertical) + + // Check if the terminal supports True Color + case terminfo.ColorLevelMillions: + return col.Sprint(b.Vertical) + + default: + // Return with a warning as the terminal supports no Color + errorMsg("[warning]: terminal does not support colors, using no effect") + return b.Vertical + } +} + +// roundOffTitleColor rounds off 24 bit Color to the terminals maximum color capacity for Title. +func (b Box) roundOffTitleColor(col color.RGBColor, title string) string { + switch detectTerminalColor() { + // Check if the terminal supports 256 Colors only + case terminfo.ColorLevelHundreds: + return col.C256().Sprint(title) + + // Check if the terminal supports 16 Colors only + case terminfo.ColorLevelBasic: + return col.C16().Sprint(title) + + // Check if the terminal supports True Color + case terminfo.ColorLevelMillions: + return col.Sprint(title) + + default: + // Return with a warning as the terminal supports no Color + errorMsg("[warning]: terminal does not support colors, using no effect") + return title + } +} + +// roundOffColor checks terminlal color level then rounds off 24 bit color to the level supported +// for TopBar and BottomBar +func roundOffColor(col color.RGBColor, topBar, bottomBar string) (string, string) { + switch detectTerminalColor() { + // Check if the terminal supports 256 Colors only + case terminfo.ColorLevelHundreds: + TopBar := addStylePreservingOriginalFormat(topBar, col.C256().Sprint) + BottomBar := addStylePreservingOriginalFormat(bottomBar, col.C256().Sprint) + return TopBar, BottomBar + + // Check if the terminal supports 16 Colors only + case terminfo.ColorLevelBasic: + TopBar := addStylePreservingOriginalFormat(bottomBar, col.C16().Sprint) + BottomBar := addStylePreservingOriginalFormat(bottomBar, col.C16().Sprint) + return TopBar, BottomBar + + // Check if the terminal supports True Color + case terminfo.ColorLevelMillions: + TopBar := addStylePreservingOriginalFormat(topBar, col.Sprint) + BottomBar := addStylePreservingOriginalFormat(bottomBar, col.Sprint) + return TopBar, BottomBar + + default: + // Return with a warning as the terminal supports no Color + errorMsg("[warning]: terminal does not support colors, using no effect") + return topBar, bottomBar + } +} diff --git a/vendor/github.com/Delta456/box-cli-maker/v2/detect_windows.go b/vendor/github.com/Delta456/box-cli-maker/v2/detect_windows.go new file mode 100644 index 000000000..d72b2cb66 --- /dev/null +++ b/vendor/github.com/Delta456/box-cli-maker/v2/detect_windows.go @@ -0,0 +1,101 @@ +//go:build windows +// +build windows + +package box + +import ( + "fmt" + "os" + "strconv" + + "github.com/gookit/color" + "github.com/xo/terminfo" + "golang.org/x/sys/windows" +) + +// Get the Windows Version and Build Number +var ( + winVersion, _, buildNumber = windows.RtlGetNtVersionNumbers() +) + +// errorMsg prints msg to os.Stderr and uses Red ANSI Color too if supported +func errorMsg(msg string) { + // If the terminal doesn't supports the basic 4 bit + if detectTerminalColor() == terminfo.ColorLevelNone { + fmt.Fprintln(os.Stderr, msg) + } else { + fmt.Fprintln(os.Stderr, color.Red.Sprint(msg)) + } +} + +// detectTerminalColor detects Color Level Supported +func detectTerminalColor() terminfo.ColorLevel { + if os.Getenv("ConEmuANSI") == "ON" { + // ConEmuANSI is "ON" for generic ANSI support + // but True Color option is enabled by default + // Just assuming that people wouldn't have disabled it + // Even if it is not enabled then ConEmu will auto round off + // accordingly + return terminfo.ColorLevelMillions + } + // Before Windows 10 Build Number 10586, Windows Console never supported ANSI Colors natively + if buildNumber < 10586 || winVersion < 10 { + // Detect if using ANSICON on older systems + if os.Getenv("ANSICON") != "" { + conVersion := os.Getenv("ANSICON_VER") + cv, err := strconv.ParseInt(conVersion, 10, 64) + + // 8 bit Colors were only supported after v1.81 release + if err != nil || cv < 181 { + return terminfo.ColorLevelBasic + } + return terminfo.ColorLevelHundreds + } + return terminfo.ColorLevelNone + } + if buildNumber < 14931 { + // True Color is not available before build 14931 so fallback to 8 bit color. + return terminfo.ColorLevelHundreds + } + return terminfo.ColorLevelMillions +} + +// roundOffColorVertical rounds off 24 bit Color to the terminals maximum color capacity for Vertical. +func (b Box) roundOffColorVertical(col color.RGBColor) string { + switch detectTerminalColor() { + case terminfo.ColorLevelNone: + errorMsg("[warning]: terminal does not support colors, using no effects") + return b.Vertical + case terminfo.ColorLevelMillions: + return col.Sprint(b.Vertical) + default: + return col.C256().Sprint(b.Vertical) + } +} + +// roundOffTitleColor rounds off 24 bit Color to the terminals maximum color capacity for Title. +func (b Box) roundOffTitleColor(col color.RGBColor, title string) string { + switch detectTerminalColor() { + case terminfo.ColorLevelNone: + errorMsg("[warning]: terminal does not support colors, using no effects") + return title + case terminfo.ColorLevelMillions: + return col.Sprint(title) + default: + return col.C256().Sprint(title) + } +} + +// roundOffColor checks terminlal color level then rounds off the 24 bit color to the level supported +// for TopBar and BottomBar +func roundOffColor(col color.RGBColor, topBar, bottomBar string) (string, string) { + switch detectTerminalColor() { + case terminfo.ColorLevelNone: + errorMsg("[warning]: terminal does not support colors, using no effects") + return topBar, bottomBar + case terminfo.ColorLevelMillions: + return addStylePreservingOriginalFormat(topBar, col.Sprint), addStylePreservingOriginalFormat(bottomBar, col.Sprint) + default: + return addStylePreservingOriginalFormat(topBar, col.C256().Sprint), addStylePreservingOriginalFormat(bottomBar, col.C256().Sprint) + } +} diff --git a/vendor/github.com/Delta456/box-cli-maker/v2/doc.go b/vendor/github.com/Delta456/box-cli-maker/v2/doc.go new file mode 100644 index 000000000..135d4eb11 --- /dev/null +++ b/vendor/github.com/Delta456/box-cli-maker/v2/doc.go @@ -0,0 +1,88 @@ +// Package box a.k.a Box CLI Maker is a Highly Customized Terminal Box Creator written in Go. +// +// It provides many styles and options to make Boxes. There are 8 inbuilt styles and has Color support via RGB uint, RGB Array of [3]uint and string (Given). +// +// Inbuilt Box Styles: +// Single, +// Double, +// Bold, +// Single Double, +// Double Single, +// Round, +// Hidden and +// Classic +// +// Inbuilt Colors: +// Black, +// Blue, +// Red, +// Yellow, +// Green, +// Cyan, +// Magenta, +// White, +// HiBlack, +// HiBlue, +// HiRed, +// HiYellow, +// HiGreen, +// HiCyan, +// HiMagenta and +// HiWhite +// +// It also has Unicode and Emoji support which works across almost all terminals. Unlike other CLI Makers, Box CLI Maker also supports tab, multi-line strings and string wrapping. +// +// Disclaimer: As different terminals have different fonts by default so the right vertical alignment may not be aligned well. +// You will have to change your font accordingly to make it work. +// +// Basic Example: +// +// Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: "Cyan"}) +// Box.Print("Box CLI Maker", "Highly Customized Terminal Box Maker") +// +// You can specify and change the options by changing the below Config struct. +// +// Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", TitlePos: "Top", ContentAlign: "Left"}) +// +// TitlePos can be changed to Inside, Top, Bottom and ContentAlign to be Left, Right and Center. +// By default TitlePos is Inside, ContentAlign is Left and Style is Single. +// +// Manual string wrapping is also allowed via a flag Config.AllowWrapping, by the default padding, is +// 2*TermWidth/3. +// +// String() method can be for the string representation of the Box. +// +// Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: "Cyan"}) +// boxStr := Box.String("Box CLI Maker", "Highly Customized Terminal Box Maker") +// +// True Color is also supported and it can be by providing an array of [3]uint or uint. +// +// There might be some terminals not supporting True Color so in this case, it will detect the terminal's max color capacity +// then will round off True Color to either 4-bit or 8-bit respectively. +// +// Title and Content can also be colored by passing the colors needed to the fields box.TitleColor and box.ContentColor respectively. +// +// This module also enables True Color and 256 Colors support on Windows Console but you need have at least Windows 10 Version 1511 +// for 256 colors or Windows 10 Version 1607 for True Color Support. +// +// Example of True Color via uint: +// +// Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: uint(0x34562f)}) +// Box.Println("Box CLI Maker", "Highly Customized Terminal Box Maker") +// +// Note: uint must be in a range of [0x000000, 0xFFFFFF]. +// +// Example of True Color via [3]uint: +// +// Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: [3]uint{23, 56, 78}}) +// Box.Println("Box CLI Maker", "Highly Customized Terminal Box Maker") +// +// Note: [3]uint array elements must be in a range of [0x0, 0xFF]. +// +// Custom Box Style can also be by using box.Box: +// +// config := box.Config{Px: 2, Py: 3, Type: "", TitlePos: "Inside"} +// boxNew := box.Box{TopRight: "*", TopLeft: "*", BottomRight: "*", BottomLeft: "*", Horizontal: "-", Vertical: "|", Config: config} +// +// More info and examples can be found in README.md and examples/ folder +package box diff --git a/vendor/github.com/Delta456/box-cli-maker/v2/types.go b/vendor/github.com/Delta456/box-cli-maker/v2/types.go new file mode 100644 index 000000000..f244aa62d --- /dev/null +++ b/vendor/github.com/Delta456/box-cli-maker/v2/types.go @@ -0,0 +1,97 @@ +package box + +import ( + "github.com/gookit/color" +) + +var ( + // boxes are inbuilt Box styles provided by the module + boxes map[string]Box = map[string]Box{ + "Single": { + TopRight: "┐", + TopLeft: "┌", + BottomRight: "┘", + BottomLeft: "└", + Horizontal: "─", + Vertical: "│", + }, + "Double": { + TopRight: "╗", + TopLeft: "╔", + BottomRight: "╝", + BottomLeft: "╚", + Horizontal: "═", + Vertical: "║", + }, + "Round": { + TopRight: "╮", + TopLeft: "╭", + BottomRight: "╯", + BottomLeft: "╰", + Horizontal: "─", + Vertical: "│", + }, + "Bold": { + TopRight: "┓", + TopLeft: "┏", + BottomRight: "┛", + BottomLeft: "┗", + Horizontal: "━", + Vertical: "┃", + }, + "Single Double": { + TopRight: "╖", + TopLeft: "╓", + BottomRight: "╜", + BottomLeft: "╙", + Horizontal: "─", + Vertical: "║", + }, + "Double Single": { + TopRight: "╕", + TopLeft: "╒", + BottomRight: "╛", + BottomLeft: "╘", + Horizontal: "═", + Vertical: "│", + }, + "Classic": { + TopRight: "+", + TopLeft: "+", + BottomRight: "+", + BottomLeft: "+", + Horizontal: "-", + Vertical: "|", + }, + "Hidden": { + TopRight: "+", + TopLeft: "+", + BottomRight: "+", + BottomLeft: "+", + Horizontal: " ", + Vertical: " ", + }, + } + // fgColors are inbuilt Foreground Colors provided by the module + fgColors map[string]color.Color = map[string]color.Color{ + "Black": color.FgBlack, + "Blue": color.FgBlue, + "Red": color.FgRed, + "Green": color.FgGreen, + "Yellow": color.FgYellow, + "Cyan": color.FgCyan, + "Magenta": color.FgMagenta, + "White": color.FgWhite, + } + // fgHiColors are inbuilt Hi-intensity Foreground Colors provided by the module + fgHiColors map[string]color.Color = map[string]color.Color{ + "HiBlack": color.FgDarkGray, + "HiBlue": color.FgLightBlue, + "HiRed": color.FgLightRed, + "HiGreen": color.FgLightGreen, + "HiYellow": color.FgLightYellow, + "HiCyan": color.FgLightCyan, + "HiMagenta": color.FgLightMagenta, + "HiWhite": color.FgLightWhite, + } +) diff --git a/vendor/github.com/Delta456/box-cli-maker/v2/util.go b/vendor/github.com/Delta456/box-cli-maker/v2/util.go new file mode 100644 index 000000000..c06007ba5 --- /dev/null +++ b/vendor/github.com/Delta456/box-cli-maker/v2/util.go @@ -0,0 +1,237 @@ +package box + +import ( + "fmt" + + "strings" + + "github.com/gookit/color" + "github.com/mattn/go-runewidth" +) + +// expandedLine stores a tab-expanded line, and its visible length. +type expandedLine struct { + line string // tab-expanded line + len int // line's visible length +} + +// addVertPadding adds Vertical Padding +func (b Box) addVertPadding(len int) []string { + padding := strings.Repeat(" ", len-2) + vertical := b.obtainBoxColor() + + var texts = make([]string, 0, b.Py) + for i := 0; i < b.Py; i++ { + texts = append(texts, (vertical + padding + vertical)) + } + return texts +} + +// findAlign checks current Box.ContentAlign and returns Alignment +func (b Box) findAlign() string { + switch b.ContentAlign { + case "Center": + return centerAlign + case "Right": + return rightAlign + case "Left": + case "": + // If ContentAlign isn't provided then by default Alignment is Left + return leftAlign + default: + // Raise a warning if the ContentAlign isn't invalid + errorMsg("[warning]: invalid value provided to Alignment, using default") + return leftAlign + } + return leftAlign +} + +// longestLine expands tabs in lines and determines longest visible +// return longest length and array of expanded lines +func longestLine(lines []string) (int, []expandedLine) { + longest := 0 + var expandedLines []expandedLine + var tmpLine strings.Builder + var lineLen int + + for _, line := range lines { + tmpLine.Reset() + for _, c := range line { + lineLen = runewidth.StringWidth(tmpLine.String()) + + if c == '\t' { + tmpLine.WriteString(strings.Repeat(" ", 8-(lineLen&7))) + } else { + tmpLine.WriteRune(c) + } + } + lineLen = runewidth.StringWidth(tmpLine.String()) + expandedLines = append(expandedLines, expandedLine{tmpLine.String(), lineLen}) + + // Check if each line has ANSI Color Code then decrease the length accordingly + if runewidth.StringWidth(color.ClearCode(tmpLine.String())) < runewidth.StringWidth(tmpLine.String()) { + lineLen = runewidth.StringWidth(color.ClearCode(tmpLine.String())) + } + + if lineLen > longest { + longest = lineLen + } + } + return longest, expandedLines +} + +func repeatWithString(c string, n int, str string) string { + cstr := color.ClearCode(str) + count := n - runewidth.StringWidth(cstr) - 2 + bar := strings.Repeat(c, count) + strNew := fmt.Sprintf(" %s %s", str, bar) + return strNew +} + +// checkColorType checks type of b.Color then from the preferences and options +func (b Box) checkColorType(topBar, bottomBar, title string) (string, string) { + var col color.RGBColor + if b.Color != nil { + // Check if type of b.Color is string + if str, ok := b.Color.(string); ok { + Style := fgHiColors[str].Sprint + // Hi Intensity Colors + if strings.HasPrefix(str, "Hi") { + if _, ok := fgHiColors[str]; ok { + Style = fgHiColors[str].Sprint + topBar = addStylePreservingOriginalFormat(topBar, Style) + bottomBar = addStylePreservingOriginalFormat(bottomBar, Style) + } + } else if _, ok := fgColors[str]; ok { + Style = fgColors[str].Sprint + topBar = addStylePreservingOriginalFormat(topBar, Style) + bottomBar = addStylePreservingOriginalFormat(bottomBar, Style) + } else { + // Return TopBar and BottomBar with a warning as Color provided as a string is unknown + errorMsg("[warning]: invalid value provided to Color, using default") + return topBar, bottomBar + } + + // If TitlePos isn't Inside and TitleColor isn't nil then clear Color Code and then split out Title from Top/Bottom Bars + // then concatenate them again with the colors provided. This is done so that the color of Vertical after Title + // won't be in effect. + // TLDR: color.Red("Hello") + color.Yellow("World") + color.Red("!") != color.Red("Hello" + color.Yellow("World") + "!") + if b.TitleColor != nil { + if b.TitlePos == "Top" { + bar := strings.Split(color.ClearCode(topBar), color.ClearCode(title)) + topBar = Style(bar[0]) + b.obtainTitleColor(title) + Style(bar[1]) + } else if b.TitlePos == "Bottom" { + bar := strings.Split(color.ClearCode(bottomBar), color.ClearCode(title)) + bottomBar = Style(bar[0]) + b.obtainTitleColor(title) + Style(bar[1]) + } + } + return topBar, bottomBar + + // Check if type of b.Color is uint + } else if hex, ok := b.Color.(uint); ok { + // Break down the hex into r, g and b respectively + hexArray := [3]uint{hex >> 16, hex >> 8 & 0xff, hex & 0xff} + col = color.RGB(uint8(hexArray[0]), uint8(hexArray[1]), uint8(hexArray[2])) + topBar, bottomBar = roundOffColor(col, topBar, bottomBar) + // Check if type of b.Color is uint + } else if rgb, ok := b.Color.([3]uint); ok { + col = color.RGB(uint8(rgb[0]), uint8(rgb[1]), uint8(rgb[2])) + topBar, bottomBar = roundOffColor(col, topBar, bottomBar) + } else { + // Panic if b.Color is an unexpected type + panic(fmt.Sprintf("expected string, [3]uint or uint not %T", b.Color)) + } + // Same purpose as written in L114-L117 + if b.TitleColor != nil { + if b.TitlePos == "Top" { + bar := strings.Split(color.ClearCode(topBar), color.ClearCode(title)) + topBar = b.roundOffTitleColor(col, bar[0]) + b.obtainTitleColor(title) + b.roundOffTitleColor(col, bar[1]) + } else if b.TitlePos == "Bottom" { + bar := strings.Split(color.ClearCode(bottomBar), color.ClearCode(title)) + bottomBar = b.roundOffTitleColor(col, bar[0]) + b.obtainTitleColor(title) + b.roundOffTitleColor(col, bar[1]) + } + } + return topBar, bottomBar + } + // As b.Color is nil then apply no color effect and return + return topBar, bottomBar +} + +// addStylePreservingOriginalFormat allows to add style around the orginal formating +func addStylePreservingOriginalFormat(s string, f func(a ...interface{}) string) string { + bars := strings.Split(s, "\033[0m") // split by the exit tag code + var tmpBar string + for _, t := range bars { + tmpBar += f(t) // add the style after each exit code to restart the style around the initial formating + } + return tmpBar +} + +// formatLine formats the line according to the information passed +func (b Box) formatLine(lines2 []expandedLine, longestLine, titleLen int, sideMargin, title string, texts []string) []string { + for i, line := range lines2 { + length := line.len + + // Use later + var space, oddSpace string + + // Check if line.line has ANSI Color Code then decrease length accordingly + if runewidth.StringWidth(color.ClearCode(line.line)) < runewidth.StringWidth(line.line) { + length = runewidth.StringWidth(color.ClearCode(line.line)) + } + + // If current text is shorter than the longest one + // center the text, so it looks better + if length < longestLine { + // Difference between longest and current one + diff := longestLine - length + + // the spaces to add on each side + toAdd := diff / 2 + space = strings.Repeat(" ", toAdd) + + // If difference between the longest and current one + // is odd, we have to add one additional space before the last vertical separator + if diff%2 != 0 { + oddSpace = " " + } + } + + spacing := space + sideMargin + var format string + + if i < titleLen && title != "" && b.TitlePos == inside { + format = centerAlign + } else { + format = b.findAlign() + } + + // Obtain color + sep := b.obtainBoxColor() + + formatted := fmt.Sprintf(format, sep, spacing, line.line, oddSpace, space, sideMargin) + texts = append(texts, formatted) + } + return texts +} + +// applyColorToAll applies Color to lines even if they have newlines in it +func (b Box) applyColorToAll(lines, color string, col color.RGBColor, isCustom bool) string { + // Check if Color provided is Custom i.e. [3]uint or uint type + if isCustom { + contents := strings.Split(lines, "\n") + var line []string + for _, str1 := range contents { + styleLine := addStylePreservingOriginalFormat(str1, col.Sprint) + line = append(line, b.roundOffTitleColor(col, styleLine)) + } + return strings.Join(line, "\n") + } + contents := strings.Split(lines, "\n") + var line []string + for _, str1 := range contents { + styleLine := addStylePreservingOriginalFormat(str1, fgColors[color].Sprint) + line = append(line, styleLine) + } + return strings.Join(line, "\n") +} diff --git a/vendor/github.com/MichaelMure/go-term-markdown/.gitignore b/vendor/github.com/MichaelMure/go-term-markdown/.gitignore new file mode 100644 index 000000000..9f11b755a --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/vendor/github.com/MichaelMure/go-term-markdown/.travis.yml b/vendor/github.com/MichaelMure/go-term-markdown/.travis.yml new file mode 100644 index 000000000..bd3e35562 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/.travis.yml @@ -0,0 +1,15 @@ +language: go + +go: + - 1.12.x + - 1.13.x + +env: + - GO111MODULE=on + +script: + - go build + - go test -v -bench=. -race -coverprofile=coverage.txt -covermode=atomic ./... + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/MichaelMure/go-term-markdown/LICENSE b/vendor/github.com/MichaelMure/go-term-markdown/LICENSE new file mode 100644 index 000000000..5ba12bf4c --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Michael Muré + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/MichaelMure/go-term-markdown/Readme.md b/vendor/github.com/MichaelMure/go-term-markdown/Readme.md new file mode 100644 index 000000000..942f06553 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/Readme.md @@ -0,0 +1,67 @@ +# go-term-markdown + +[![Build Status](https://travis-ci.com/MichaelMure/go-term-markdown.svg?branch=master)](https://travis-ci.com/MichaelMure/go-term-markdown) +[![GoDoc](https://godoc.org/github.com/MichaelMure/go-term-markdown?status.svg)](https://godoc.org/github.com/MichaelMure/go-term-markdown) +[![Go Report Card](https://goreportcard.com/badge/github.com/MichaelMure/go-term-markdown)](https://goreportcard.com/report/github.com/MichaelMure/go-term-markdown) +[![codecov](https://codecov.io/gh/MichaelMure/go-term-markdown/branch/master/graph/badge.svg)](https://codecov.io/gh/MichaelMure/go-term-markdown) +[![GitHub license](https://img.shields.io/github/license/MichaelMure/go-term-markdown.svg)](https://github.com/MichaelMure/go-term-markdown/blob/master/LICENSE) +[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/the-git-bug/Lobby) + +`go-term-markdown` is a go package implementing a Markdown renderer for the terminal. + +Note: Markdown being originally designed to render as HTML, rendering in a terminal is occasionally challenging and some adaptation had to be made. + +Features: +- formatting +- lists +- tables +- images +- code blocks with syntax highlighting +- basic HTML support + +Note: this renderer is packaged as a standalone terminal viewer at https://github.com/MichaelMure/mdr/ + +## Usage + +```go +import ( + "fmt" + "io/ioutil" + + markdown "github.com/MichaelMure/go-term-markdown" +) + +func main() { + path := "Readme.md" + source, err := ioutil.ReadFile(path) + if err != nil { + panic(err) + } + + result := markdown.Render(string(source), 80, 6) + + fmt.Println(result) +} +``` + +## Example + +Here is the [Readme](https://github.com/MichaelMure/go-term-text/blob/v0.2.4/Readme.md) of `go-term-text` rendered with `go-term-markdown`: + +![rendering example](misc/result.png) + +Here is an example of table rendering: + +![table rendering](misc/table.png) + +## Origin + +This package has been extracted from the [git-bug](https://github.com/MichaelMure/git-bug) project. As such, its aim is to support this project and not to provide an all-in-one solution. Contributions or full-on takeover as welcome though. + +## Contribute + +PRs accepted. + +## License + +MIT diff --git a/vendor/github.com/MichaelMure/go-term-markdown/colors.go b/vendor/github.com/MichaelMure/go-term-markdown/colors.go new file mode 100644 index 000000000..de1339cd0 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/colors.go @@ -0,0 +1,24 @@ +package markdown + +import "github.com/fatih/color" + +var ( + // we need a bunch of escape code for manual formatting + boldOn = "\x1b[1m" + // boldOff = "\x1b[21m" --> use resetAll + snapshot with bold off instead + italicOn = "\x1b[3m" + italicOff = "\x1b[23m" + crossedOutOn = "\x1b[9m" + crossedOutOff = "\x1b[29m" + greenOn = "\x1b[32m" + + resetAll = "\x1b[0m" + colorOff = "\x1b[39m" + + Green = color.New(color.FgGreen).SprintFunc() + HiGreen = color.New(color.FgHiGreen).SprintFunc() + GreenBold = color.New(color.FgGreen, color.Bold).SprintFunc() + Blue = color.New(color.FgBlue).SprintFunc() + BlueBgItalic = color.New(color.BgBlue, color.Italic).SprintFunc() + Red = color.New(color.FgRed).SprintFunc() +) diff --git a/vendor/github.com/MichaelMure/go-term-markdown/html/html.go b/vendor/github.com/MichaelMure/go-term-markdown/html/html.go new file mode 100644 index 000000000..9245192e6 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/html/html.go @@ -0,0 +1,78 @@ +package html + +import . "golang.org/x/net/html" + +// WalkStatus allows NodeVisitor to have some control over the tree traversal. +// It is returned from NodeVisitor and different values allow Node.Walk to +// decide which node to go to next. +type WalkStatus int + +const ( + // GoToNext is the default traversal of every node. + GoToNext WalkStatus = iota + // SkipChildren tells walker to skip all children of current node. + SkipChildren + // Terminate tells walker to terminate the traversal. + Terminate +) + +// NodeVisitor is a callback to be called when traversing the syntax tree. +// Called twice for every node: once with entering=true when the branch is +// first visited, then with entering=false after all the children are done. +type NodeVisitor interface { + Visit(node *Node, entering bool) WalkStatus +} + +func Walk(n *Node, visitor NodeVisitor) WalkStatus { + isContainer := n.FirstChild != nil + + // some special case that are container but can be self closing + if n.Type == ElementNode { + switch n.Data { + case "td": + isContainer = true + } + } + + status := visitor.Visit(n, true) + + if status == Terminate { + // even if terminating, close container node + if isContainer { + visitor.Visit(n, false) + } + } + + if isContainer && status != SkipChildren { + child := n.FirstChild + for child != nil { + status = Walk(child, visitor) + if status == Terminate { + return status + } + child = child.NextSibling + } + } + + if isContainer { + status = visitor.Visit(n, false) + if status == Terminate { + return status + } + } + + return GoToNext +} + +// NodeVisitorFunc casts a function to match NodeVisitor interface +type NodeVisitorFunc func(node *Node, entering bool) WalkStatus + +// Visit calls visitor function +func (f NodeVisitorFunc) Visit(node *Node, entering bool) WalkStatus { + return f(node, entering) +} + +// WalkFunc is like Walk but accepts just a callback function +func WalkFunc(n *Node, f NodeVisitorFunc) { + Walk(n, f) +} diff --git a/vendor/github.com/MichaelMure/go-term-markdown/markdown.go b/vendor/github.com/MichaelMure/go-term-markdown/markdown.go new file mode 100644 index 000000000..0a3f771d7 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/markdown.go @@ -0,0 +1,33 @@ +package markdown + +import ( + md "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/parser" +) + +// Extensions returns the bitmask of extensions supported by this renderer. +// The output of this function can be used to instantiate a new markdown +// parser using the `NewWithExtensions` function. +func Extensions() parser.Extensions { + extensions := parser.NoIntraEmphasis // Ignore emphasis markers inside words + extensions |= parser.Tables // Parse tables + extensions |= parser.FencedCode // Parse fenced code blocks + extensions |= parser.Autolink // Detect embedded URLs that are not explicitly marked + extensions |= parser.Strikethrough // Strikethrough text using ~~test~~ + extensions |= parser.SpaceHeadings // Be strict about prefix heading rules + extensions |= parser.HeadingIDs // specify heading IDs with {#id} + extensions |= parser.BackslashLineBreak // Translate trailing backslashes into line breaks + extensions |= parser.DefinitionLists // Parse definition lists + extensions |= parser.LaxHTMLBlocks // more in HTMLBlock, less in HTMLSpan + extensions |= parser.NoEmptyLineBeforeBlock // no need for new line before a list + + return extensions +} + +func Render(source string, lineWidth int, leftPad int, opts ...Options) []byte { + p := parser.NewWithExtensions(Extensions()) + nodes := md.Parse([]byte(source), p) + renderer := NewRenderer(lineWidth, leftPad, opts...) + + return md.Render(nodes, renderer) +} diff --git a/vendor/github.com/MichaelMure/go-term-markdown/numbering.go b/vendor/github.com/MichaelMure/go-term-markdown/numbering.go new file mode 100644 index 000000000..94e4ba876 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/numbering.go @@ -0,0 +1,47 @@ +package markdown + +import "strconv" + +type headingNumbering struct { + levels [6]int +} + +// Observe register the event of a new level with the given depth and +// adjust the numbering accordingly +func (hn *headingNumbering) Observe(level int) { + if level <= 0 { + panic("level start at 1, ask blackfriday why") + } + if level > 6 { + panic("Markdown is limited to 6 levels of heading") + } + + hn.levels[level-1]++ + for i := level; i < 6; i++ { + hn.levels[i] = 0 + } +} + +// Render render the current headings numbering. +func (hn *headingNumbering) Render() string { + slice := hn.levels[:] + + // pop the last zero levels + for i := 5; i >= 0; i-- { + if hn.levels[i] != 0 { + break + } + slice = slice[:len(slice)-1] + } + + var result string + + for i := range slice { + if i > 0 { + result += "." + } + result += strconv.Itoa(slice[i]) + } + + return result +} diff --git a/vendor/github.com/MichaelMure/go-term-markdown/options.go b/vendor/github.com/MichaelMure/go-term-markdown/options.go new file mode 100644 index 000000000..9edd1580f --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/options.go @@ -0,0 +1,37 @@ +package markdown + +import "github.com/eliukblau/pixterm/pkg/ansimage" + +type Options func(r *renderer) + +// DitheringMode type is used for image scale dithering mode constants. +type DitheringMode uint8 + +const ( + NoDithering = DitheringMode(iota) + DitheringWithBlocks + DitheringWithChars +) + +// Dithering mode for ansimage +// Default is fine directly through a terminal +// DitheringWithBlocks is recommended if a terminal UI library is used +func WithImageDithering(mode DitheringMode) Options { + return func(r *renderer) { + r.imageDithering = ansimage.DitheringMode(mode) + } +} + +// Use a custom collection of ANSI colors for the headings +func WithHeadingShades(shades []shadeFmt) Options { + return func(r *renderer) { + r.headingShade = shade(shades) + } +} + +// Use a custom collection of ANSI colors for the blockquotes +func WithBlockquoteShades(shades []shadeFmt) Options { + return func(r *renderer) { + r.blockQuoteShade = shade(shades) + } +} diff --git a/vendor/github.com/MichaelMure/go-term-markdown/renderer.go b/vendor/github.com/MichaelMure/go-term-markdown/renderer.go new file mode 100644 index 000000000..719063a62 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/renderer.go @@ -0,0 +1,975 @@ +package markdown + +import ( + "bytes" + "fmt" + stdcolor "image/color" + "io" + "math" + "net/http" + "os" + "strings" + "time" + "unicode" + + "github.com/MichaelMure/go-term-text" + "github.com/alecthomas/chroma" + "github.com/alecthomas/chroma/formatters" + "github.com/alecthomas/chroma/lexers" + "github.com/alecthomas/chroma/styles" + "github.com/eliukblau/pixterm/pkg/ansimage" + "github.com/fatih/color" + md "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/ast" + "github.com/kyokomi/emoji/v2" + "golang.org/x/net/html" + + htmlWalker "github.com/MichaelMure/go-term-markdown/html" +) + +/* + +Here are the possible cases for the AST. You can render it using PlantUML. + +@startuml + +(*) --> Document +BlockQuote --> BlockQuote +BlockQuote --> CodeBlock +BlockQuote --> List +BlockQuote --> Paragraph +Del --> Emph +Del --> Strong +Del --> Text +Document --> BlockQuote +Document --> CodeBlock +Document --> Heading +Document --> HorizontalRule +Document --> HTMLBlock +Document --> List +Document --> Paragraph +Document --> Table +Emph --> Text +Heading --> Code +Heading --> Del +Heading --> Emph +Heading --> HTMLSpan +Heading --> Image +Heading --> Link +Heading --> Strong +Heading --> Text +Image --> Text +Link --> Image +Link --> Text +ListItem --> List +ListItem --> Paragraph +List --> ListItem +Paragraph --> Code +Paragraph --> Del +Paragraph --> Emph +Paragraph --> Hardbreak +Paragraph --> HTMLSpan +Paragraph --> Image +Paragraph --> Link +Paragraph --> Strong +Paragraph --> Text +Strong --> Emph +Strong --> Text +TableBody --> TableRow +TableCell --> Code +TableCell --> Del +TableCell --> Emph +TableCell --> HTMLSpan +TableCell --> Image +TableCell --> Link +TableCell --> Strong +TableCell --> Text +TableHeader --> TableRow +TableRow --> TableCell +Table --> TableBody +Table --> TableHeader + +@enduml + +*/ + +var _ md.Renderer = &renderer{} + +type renderer struct { + // maximum line width allowed + lineWidth int + // constant left padding to apply + leftPad int + + // Dithering mode for ansimage + // Default is fine directly through a terminal + // DitheringWithBlocks is recommended if a terminal UI library is used + imageDithering ansimage.DitheringMode + + // all the custom left paddings, without the fixed space from leftPad + padAccumulator []string + + // one-shot indent for the first line of the inline content + indent string + + // for Heading, Paragraph, HTMLBlock and TableCell, accumulate the content of + // the child nodes (Link, Text, Image, formatting ...). The result + // is then rendered appropriately when exiting the node. + inlineAccumulator strings.Builder + + // record and render the heading numbering + headingNumbering headingNumbering + headingShade levelShadeFmt + + blockQuoteLevel int + blockQuoteShade levelShadeFmt + + table *tableRenderer +} + +/// NewRenderer creates a new instance of the console renderer +func NewRenderer(lineWidth int, leftPad int, opts ...Options) *renderer { + r := &renderer{ + lineWidth: lineWidth, + leftPad: leftPad, + padAccumulator: make([]string, 0, 10), + headingShade: shade(defaultHeadingShades), + blockQuoteShade: shade(defaultQuoteShades), + } + for _, opt := range opts { + opt(r) + } + return r +} + +func (r *renderer) pad() string { + return strings.Repeat(" ", r.leftPad) + strings.Join(r.padAccumulator, "") +} + +func (r *renderer) addPad(pad string) { + r.padAccumulator = append(r.padAccumulator, pad) +} + +func (r *renderer) popPad() { + r.padAccumulator = r.padAccumulator[:len(r.padAccumulator)-1] +} + +func (r *renderer) RenderNode(w io.Writer, node ast.Node, entering bool) ast.WalkStatus { + // TODO: remove + // if node.AsLeaf() != nil { + // fmt.Printf("%T, %v (%s)\n", node, entering, string(node.AsLeaf().Literal)) + // } else { + // fmt.Printf("%T, %v\n", node, entering) + // } + + switch node := node.(type) { + case *ast.Document: + // Nothing to do + + case *ast.BlockQuote: + // set and remove a colored bar on the left + if entering { + r.blockQuoteLevel++ + r.addPad(r.blockQuoteShade(r.blockQuoteLevel)("┃ ")) + } else { + r.blockQuoteLevel-- + r.popPad() + } + + case *ast.List: + // extra new line at the end of a list *if* next is not a list + if next := ast.GetNextNode(node); !entering && next != nil { + _, parentIsListItem := node.GetParent().(*ast.ListItem) + _, nextIsList := next.(*ast.List) + if !nextIsList && !parentIsListItem { + _, _ = fmt.Fprintln(w) + } + } + + case *ast.ListItem: + // write the prefix, add a padding if needed, and let Paragraph handle the rest + if entering { + switch { + // numbered list + case node.ListFlags&ast.ListTypeOrdered != 0: + itemNumber := 1 + siblings := node.GetParent().GetChildren() + for _, sibling := range siblings { + if sibling == node { + break + } + itemNumber++ + } + prefix := fmt.Sprintf("%d. ", itemNumber) + r.indent = r.pad() + Green(prefix) + r.addPad(strings.Repeat(" ", text.Len(prefix))) + + // header of a definition + case node.ListFlags&ast.ListTypeTerm != 0: + r.inlineAccumulator.WriteString(greenOn) + + // content of a definition + case node.ListFlags&ast.ListTypeDefinition != 0: + r.addPad(" ") + + // no flags means it's the normal bullet point list + default: + r.indent = r.pad() + Green("• ") + r.addPad(" ") + } + } else { + switch { + // numbered list + case node.ListFlags&ast.ListTypeOrdered != 0: + r.popPad() + + // header of a definition + case node.ListFlags&ast.ListTypeTerm != 0: + r.inlineAccumulator.WriteString(colorOff) + + // content of a definition + case node.ListFlags&ast.ListTypeDefinition != 0: + r.popPad() + _, _ = fmt.Fprintln(w) + + // no flags means it's the normal bullet point list + default: + r.popPad() + } + } + + case *ast.Paragraph: + // on exiting, collect and format the accumulated content + if !entering { + content := r.inlineAccumulator.String() + r.inlineAccumulator.Reset() + + var out string + if r.indent != "" { + out, _ = text.WrapWithPadIndent(content, r.lineWidth, r.indent, r.pad()) + r.indent = "" + } else { + out, _ = text.WrapWithPad(content, r.lineWidth, r.pad()) + } + _, _ = fmt.Fprint(w, out, "\n") + + // extra line break in some cases + if next := ast.GetNextNode(node); next != nil { + switch next.(type) { + case *ast.Paragraph, *ast.Heading, *ast.HorizontalRule, + *ast.CodeBlock, *ast.HTMLBlock: + _, _ = fmt.Fprintln(w) + } + } + } + + case *ast.Heading: + if !entering { + r.renderHeading(w, node.Level) + } + + case *ast.HorizontalRule: + r.renderHorizontalRule(w) + + case *ast.Emph: + if entering { + r.inlineAccumulator.WriteString(italicOn) + } else { + r.inlineAccumulator.WriteString(italicOff) + } + + case *ast.Strong: + if entering { + r.inlineAccumulator.WriteString(boldOn) + } else { + // This is super silly but some terminals, instead of having + // the ANSI code SGR 21 do "bold off" like the logic would guide, + // do "double underline" instead. This is madness. + + // To resolve that problem, we take a snapshot of the escape state, + // remove the bold, then output "reset all" + snapshot + es := text.EscapeState{} + es.Witness(r.inlineAccumulator.String()) + es.Bold = false + r.inlineAccumulator.WriteString(resetAll) + r.inlineAccumulator.WriteString(es.FormatString()) + } + + case *ast.Del: + if entering { + r.inlineAccumulator.WriteString(crossedOutOn) + } else { + r.inlineAccumulator.WriteString(crossedOutOff) + } + + case *ast.Link: + if entering { + r.inlineAccumulator.WriteString("[") + r.inlineAccumulator.WriteString(string(ast.GetFirstChild(node).AsLeaf().Literal)) + r.inlineAccumulator.WriteString("](") + r.inlineAccumulator.WriteString(Blue(string(node.Destination))) + if len(node.Title) > 0 { + r.inlineAccumulator.WriteString(" ") + r.inlineAccumulator.WriteString(string(node.Title)) + } + r.inlineAccumulator.WriteString(")") + return ast.SkipChildren + } + + case *ast.Image: + if entering { + // the alt text/title is weirdly parsed and is actually + // a child text of this node + var title string + if len(node.Children) == 1 { + if t, ok := node.Children[0].(*ast.Text); ok { + title = string(t.Literal) + } + } + + str, rendered := r.renderImage( + string(node.Destination), title, + r.lineWidth-r.leftPad, + ) + + if rendered { + r.inlineAccumulator.WriteString("\n") + r.inlineAccumulator.WriteString(str) + r.inlineAccumulator.WriteString("\n\n") + } else { + r.inlineAccumulator.WriteString(str) + r.inlineAccumulator.WriteString("\n") + } + + return ast.SkipChildren + } + + case *ast.Text: + if string(node.Literal) == "\n" { + break + } + content := string(node.Literal) + if shouldCleanText(node) { + content = removeLineBreak(content) + } + // emoji support ! + emojed := emoji.Sprint(content) + r.inlineAccumulator.WriteString(emojed) + + case *ast.HTMLBlock: + r.renderHTMLBlock(w, node) + + case *ast.CodeBlock: + r.renderCodeBlock(w, node) + + case *ast.Softbreak: + // not actually implemented in gomarkdown + r.inlineAccumulator.WriteString("\n") + + case *ast.Hardbreak: + r.inlineAccumulator.WriteString("\n") + + case *ast.Code: + r.inlineAccumulator.WriteString(BlueBgItalic(string(node.Literal))) + + case *ast.HTMLSpan: + r.inlineAccumulator.WriteString(Red(string(node.Literal))) + + case *ast.Table: + if entering { + r.table = newTableRenderer() + } else { + r.table.Render(w, r.leftPad, r.lineWidth) + r.table = nil + } + + case *ast.TableCell: + if !entering { + content := r.inlineAccumulator.String() + r.inlineAccumulator.Reset() + + align := CellAlignLeft + switch node.Align { + case ast.TableAlignmentRight: + align = CellAlignRight + case ast.TableAlignmentCenter: + align = CellAlignCenter + } + + if node.IsHeader { + r.table.AddHeaderCell(content, align) + } else { + r.table.AddBodyCell(content, CellAlignCopyHeader) + } + } + + case *ast.TableHeader, *ast.TableBody, *ast.TableFooter: + // nothing to do + + case *ast.TableRow: + if _, ok := node.Parent.(*ast.TableBody); ok && entering { + r.table.NextBodyRow() + } + if _, ok := node.Parent.(*ast.TableFooter); ok && entering { + r.table.NextBodyRow() + } + + default: + panic(fmt.Sprintf("Unknown node type %T", node)) + } + + return ast.GoToNext +} + +func (*renderer) RenderHeader(w io.Writer, node ast.Node) {} + +func (*renderer) RenderFooter(w io.Writer, node ast.Node) {} + +func (r *renderer) renderHorizontalRule(w io.Writer) { + _, _ = fmt.Fprintf(w, "%s%s\n\n", r.pad(), strings.Repeat("─", r.lineWidth-r.leftPad)) +} + +func (r *renderer) renderHeading(w io.Writer, level int) { + content := r.inlineAccumulator.String() + r.inlineAccumulator.Reset() + + // render the full line with the headingNumbering + r.headingNumbering.Observe(level) + content = fmt.Sprintf("%s %s", r.headingNumbering.Render(), content) + content = r.headingShade(level)(content) + + // wrap if needed + wrapped, _ := text.WrapWithPad(content, r.lineWidth, r.pad()) + _, _ = fmt.Fprintln(w, wrapped) + + // render the underline, if any + if level == 1 { + _, _ = fmt.Fprintf(w, "%s%s\n", r.pad(), strings.Repeat("─", r.lineWidth-r.leftPad)) + } + + _, _ = fmt.Fprintln(w) +} + +func (r *renderer) renderCodeBlock(w io.Writer, node *ast.CodeBlock) { + code := string(node.Literal) + var lexer chroma.Lexer + // try to get the lexer from the language tag if any + if len(node.Info) > 0 { + lexer = lexers.Get(string(node.Info)) + } + // fallback on detection + if lexer == nil { + lexer = lexers.Analyse(code) + } + // all failed :-( + if lexer == nil { + lexer = lexers.Fallback + } + // simplify the lexer output + lexer = chroma.Coalesce(lexer) + + var formatter chroma.Formatter + if color.NoColor { + formatter = formatters.Fallback + } else { + formatter = formatters.TTY8 + } + + iterator, err := lexer.Tokenise(nil, code) + if err != nil { + // Something failed, falling back to no highlight render + r.renderFormattedCodeBlock(w, code) + return + } + + buf := &bytes.Buffer{} + + err = formatter.Format(buf, styles.Pygments, iterator) + if err != nil { + // Something failed, falling back to no highlight render + r.renderFormattedCodeBlock(w, code) + return + } + + r.renderFormattedCodeBlock(w, buf.String()) +} + +func (r *renderer) renderFormattedCodeBlock(w io.Writer, code string) { + // remove the trailing line break + code = strings.TrimRight(code, "\n") + + r.addPad(GreenBold("┃ ")) + output, _ := text.WrapWithPad(code, r.lineWidth, r.pad()) + r.popPad() + + _, _ = fmt.Fprint(w, output) + + _, _ = fmt.Fprintf(w, "\n\n") +} + +func (r *renderer) renderHTMLBlock(w io.Writer, node *ast.HTMLBlock) { + var buf bytes.Buffer + + flushInline := func() { + if r.inlineAccumulator.Len() <= 0 { + return + } + content := r.inlineAccumulator.String() + r.inlineAccumulator.Reset() + out, _ := text.WrapWithPad(content, r.lineWidth, r.pad()) + _, _ = fmt.Fprint(&buf, out, "\n\n") + } + + doc, err := html.Parse(bytes.NewReader(node.Literal)) + if err != nil { + // if there is a parsing error, fallback to a simple render + r.inlineAccumulator.Reset() + content := Red(string(node.Literal)) + out, _ := text.WrapWithPad(content, r.lineWidth, r.pad()) + _, _ = fmt.Fprint(w, out, "\n\n") + return + } + + htmlWalker.WalkFunc(doc, func(node *html.Node, entering bool) htmlWalker.WalkStatus { + // if node.Type != html.TextNode { + // fmt.Println(node.Type, "(", node.Data, ")", entering) + // } + + switch node.Type { + case html.CommentNode, html.DoctypeNode: + // Not rendered + + case html.DocumentNode: + + case html.ElementNode: + switch node.Data { + case "html", "body": + return htmlWalker.GoToNext + + case "head": + return htmlWalker.SkipChildren + + case "div", "p": + if entering { + flushInline() + } else { + content := r.inlineAccumulator.String() + r.inlineAccumulator.Reset() + if len(content) == 0 { + return htmlWalker.GoToNext + } + // remove all line breaks, those are fully managed in HTML + content = strings.Replace(content, "\n", "", -1) + align := getDivHTMLAttr(node.Attr) + content, _ = text.WrapWithPadAlign(content, r.lineWidth, r.pad(), align) + _, _ = fmt.Fprint(&buf, content, "\n\n") + } + + case "h1": + if !entering { + r.renderHeading(&buf, 1) + } + case "h2": + if !entering { + r.renderHeading(&buf, 2) + } + case "h3": + if !entering { + r.renderHeading(&buf, 3) + } + case "h4": + if !entering { + r.renderHeading(&buf, 4) + } + case "h5": + if !entering { + r.renderHeading(&buf, 5) + } + case "h6": + if !entering { + r.renderHeading(&buf, 6) + } + + case "img": + flushInline() + src, title := getImgHTMLAttr(node.Attr) + str, _ := r.renderImage(src, title, r.lineWidth-len(r.pad())) + r.inlineAccumulator.WriteString(str) + + case "hr": + flushInline() + r.renderHorizontalRule(&buf) + + case "ul", "ol": + if !entering { + if node.NextSibling == nil { + _, _ = fmt.Fprint(&buf, "\n") + return htmlWalker.GoToNext + } + switch node.NextSibling.Data { + case "ul", "ol": + default: + _, _ = fmt.Fprint(&buf, "\n") + } + } + + case "li": + if entering { + switch node.Parent.Data { + case "ul": + r.indent = r.pad() + Green("• ") + r.addPad(" ") + + case "ol": + itemNumber := 1 + previous := node.PrevSibling + for previous != nil { + itemNumber++ + previous = previous.PrevSibling + } + prefix := fmt.Sprintf("%d. ", itemNumber) + r.indent = r.pad() + Green(prefix) + r.addPad(strings.Repeat(" ", text.Len(prefix))) + + default: + r.inlineAccumulator.WriteString(Red(renderRawHtml(node))) + return htmlWalker.SkipChildren + } + } else { + switch node.Parent.Data { + case "ul", "ol": + content := r.inlineAccumulator.String() + r.inlineAccumulator.Reset() + out, _ := text.WrapWithPadIndent(content, r.lineWidth, r.indent, r.pad()) + r.indent = "" + _, _ = fmt.Fprint(&buf, out, "\n") + r.popPad() + } + } + + case "a": + if entering { + r.inlineAccumulator.WriteString("[") + } else { + href, alt := getAHTMLAttr(node.Attr) + r.inlineAccumulator.WriteString("](") + r.inlineAccumulator.WriteString(Blue(href)) + if len(alt) > 0 { + r.inlineAccumulator.WriteString(" ") + r.inlineAccumulator.WriteString(alt) + } + r.inlineAccumulator.WriteString(")") + } + + case "br": + if entering { + r.inlineAccumulator.WriteString("\n") + } + + case "table": + if entering { + flushInline() + r.table = newTableRenderer() + } else { + r.table.Render(&buf, r.leftPad, r.lineWidth) + r.table = nil + } + + case "thead", "tbody": + // nothing to do + + case "tr": + if entering && node.Parent.Data != "thead" { + r.table.NextBodyRow() + } + + case "th": + if !entering { + content := r.inlineAccumulator.String() + r.inlineAccumulator.Reset() + + align := getTdHTMLAttr(node.Attr) + r.table.AddHeaderCell(content, align) + } + + case "td": + if !entering { + content := r.inlineAccumulator.String() + r.inlineAccumulator.Reset() + + align := getTdHTMLAttr(node.Attr) + r.table.AddBodyCell(content, align) + } + + case "strong", "b": + if entering { + r.inlineAccumulator.WriteString(boldOn) + } else { + // This is super silly but some terminals, instead of having + // the ANSI code SGR 21 do "bold off" like the logic would guide, + // do "double underline" instead. This is madness. + + // To resolve that problem, we take a snapshot of the escape state, + // remove the bold, then output "reset all" + snapshot + es := text.EscapeState{} + es.Witness(r.inlineAccumulator.String()) + es.Bold = false + r.inlineAccumulator.WriteString(resetAll) + r.inlineAccumulator.WriteString(es.FormatString()) + } + + case "i", "em": + if entering { + r.inlineAccumulator.WriteString(italicOn) + } else { + r.inlineAccumulator.WriteString(italicOff) + } + + case "s": + if entering { + r.inlineAccumulator.WriteString(crossedOutOn) + } else { + r.inlineAccumulator.WriteString(crossedOutOff) + } + + default: + r.inlineAccumulator.WriteString(Red(renderRawHtml(node))) + } + + case html.TextNode: + t := strings.TrimSpace(node.Data) + t = strings.ReplaceAll(t, "\n", "") + r.inlineAccumulator.WriteString(t) + + default: + panic("unhandled case") + } + + return htmlWalker.GoToNext + }) + + flushInline() + _, _ = fmt.Fprint(w, buf.String()) + r.inlineAccumulator.Reset() + + // // dl + (dt+dd) + // + // // details + // // summary + // +} + +func getDivHTMLAttr(attrs []html.Attribute) text.Alignment { + for _, attr := range attrs { + switch attr.Key { + case "align": + switch attr.Val { + case "left": + return text.AlignLeft + case "center": + return text.AlignCenter + case "right": + return text.AlignRight + } + } + } + return text.AlignLeft +} + +func getImgHTMLAttr(attrs []html.Attribute) (src, title string) { + for _, attr := range attrs { + switch attr.Key { + case "src": + src = attr.Val + case "alt": + title = attr.Val + } + } + return +} + +func getAHTMLAttr(attrs []html.Attribute) (href, alt string) { + for _, attr := range attrs { + switch attr.Key { + case "href": + href = attr.Val + case "alt": + alt = attr.Val + } + } + return +} + +func getTdHTMLAttr(attrs []html.Attribute) CellAlign { + for _, attr := range attrs { + switch attr.Key { + case "align": + switch attr.Val { + case "right": + return CellAlignRight + case "left": + return CellAlignLeft + case "center": + return CellAlignCenter + } + + case "style": + for _, pair := range strings.Split(attr.Val, " ") { + split := strings.Split(pair, ":") + if split[0] != "text-align" || len(split) != 2 { + continue + } + switch split[1] { + case "right": + return CellAlignRight + case "left": + return CellAlignLeft + case "center": + return CellAlignCenter + } + } + } + } + return CellAlignLeft +} + +func renderRawHtml(node *html.Node) string { + var result strings.Builder + openContent := make([]string, 0, 8) + + openContent = append(openContent, node.Data) + for _, attr := range node.Attr { + openContent = append(openContent, fmt.Sprintf("%s=\"%s\"", attr.Key, attr.Val)) + } + + result.WriteString("<") + result.WriteString(strings.Join(openContent, " ")) + + if node.FirstChild == nil { + result.WriteString("/>") + return result.String() + } + + result.WriteString(">") + + child := node.FirstChild + for child != nil { + if child.Type == html.TextNode { + t := strings.TrimSpace(child.Data) + result.WriteString(t) + child = child.NextSibling + continue + } + + switch node.Data { + case "ul", "p": + result.WriteString("\n ") + } + + result.WriteString(renderRawHtml(child)) + child = child.NextSibling + } + + switch node.Data { + case "ul", "p": + result.WriteString("\n") + } + + result.WriteString("") + + return result.String() +} + +func (r *renderer) renderImage(dest string, title string, lineWidth int) (result string, rendered bool) { + title = strings.ReplaceAll(title, "\n", "") + title = strings.TrimSpace(title) + dest = strings.ReplaceAll(dest, "\n", "") + dest = strings.TrimSpace(dest) + + fallback := func() (string, bool) { + return fmt.Sprintf("![%s](%s)", title, Blue(dest)), false + } + + reader, err := imageFromDestination(dest) + if err != nil { + return fallback() + } + + x := lineWidth + + if r.imageDithering == ansimage.DitheringWithChars || r.imageDithering == ansimage.DitheringWithBlocks { + // not sure why this is needed by ansimage + // x *= 4 + } + + img, err := ansimage.NewScaledFromReader(reader, math.MaxInt32, x, + stdcolor.Black, ansimage.ScaleModeFit, r.imageDithering) + + if err != nil { + return fallback() + } + + if title != "" { + return fmt.Sprintf("%s%s: %s", img.Render(), title, Blue(dest)), true + } + return fmt.Sprintf("%s%s", img.Render(), Blue(dest)), true +} + +func imageFromDestination(dest string) (io.ReadCloser, error) { + client := http.Client{ + Timeout: 5 * time.Second, + } + + if strings.HasPrefix(dest, "http://") || strings.HasPrefix(dest, "https://") { + res, err := client.Get(dest) + if err != nil { + return nil, err + } + if res.StatusCode != http.StatusOK { + return nil, fmt.Errorf("http: %v", http.StatusText(res.StatusCode)) + } + + return res.Body, nil + } + + return os.Open(dest) +} + +func removeLineBreak(text string) string { + lines := strings.Split(text, "\n") + + if len(lines) <= 1 { + return text + } + + for i, l := range lines { + switch i { + case 0: + lines[i] = strings.TrimRightFunc(l, unicode.IsSpace) + case len(lines) - 1: + lines[i] = strings.TrimLeftFunc(l, unicode.IsSpace) + default: + lines[i] = strings.TrimFunc(l, unicode.IsSpace) + } + } + return strings.Join(lines, " ") +} + +func shouldCleanText(node ast.Node) bool { + for node != nil { + switch node.(type) { + case *ast.BlockQuote: + return false + + case *ast.Heading, *ast.Image, *ast.Link, + *ast.TableCell, *ast.Document, *ast.ListItem: + return true + } + + node = node.GetParent() + } + + panic("bad markdown document or missing case") +} diff --git a/vendor/github.com/MichaelMure/go-term-markdown/shades.go b/vendor/github.com/MichaelMure/go-term-markdown/shades.go new file mode 100644 index 000000000..b91f00c69 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/shades.go @@ -0,0 +1,33 @@ +package markdown + +var defaultHeadingShades = []shadeFmt{ + GreenBold, + GreenBold, + HiGreen, + Green, +} + +var defaultQuoteShades = []shadeFmt{ + GreenBold, + GreenBold, + HiGreen, + Green, +} + +type shadeFmt func(a ...interface{}) string + +type levelShadeFmt func(level int) shadeFmt + +// Return a function giving the color function corresponding to the level. +// Beware, level start counting from 1. +func shade(shades []shadeFmt) levelShadeFmt { + return func(level int) shadeFmt { + if level < 1 { + level = 1 + } + if level > len(shades) { + level = len(shades) + } + return shades[level-1] + } +} diff --git a/vendor/github.com/MichaelMure/go-term-markdown/tables.go b/vendor/github.com/MichaelMure/go-term-markdown/tables.go new file mode 100644 index 000000000..f9c1ad689 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-markdown/tables.go @@ -0,0 +1,350 @@ +package markdown + +import ( + "io" + "strings" + + "github.com/MichaelMure/go-term-text" +) + +const minColumnCompactedWidth = 5 + +type CellAlign int + +const ( + CellAlignLeft CellAlign = iota + CellAlignRight + CellAlignCenter + CellAlignCopyHeader +) + +type tableCell struct { + content string + alignment CellAlign +} + +type tableRenderer struct { + header []tableCell + body [][]tableCell +} + +func newTableRenderer() *tableRenderer { + return &tableRenderer{} +} + +func (tr *tableRenderer) AddHeaderCell(content string, alignment CellAlign) { + tr.header = append(tr.header, tableCell{ + content: content, + alignment: alignment, + }) +} + +func (tr *tableRenderer) NextBodyRow() { + tr.body = append(tr.body, nil) +} + +func (tr *tableRenderer) AddBodyCell(content string, alignement CellAlign) { + row := tr.body[len(tr.body)-1] + row = append(row, tableCell{ + content: content, + alignment: alignement, + }) + tr.body[len(tr.body)-1] = row +} + +// normalize ensure that the table has the same number of cells +// in each rows, header or not. +func (tr *tableRenderer) normalize() { + width := len(tr.header) + for _, row := range tr.body { + width = max(width, len(row)) + } + + // grow the header if needed + for len(tr.header) < width { + tr.header = append(tr.header, tableCell{}) + } + + // grow lines if needed + for i := range tr.body { + for len(tr.body[i]) < width { + tr.body[i] = append(tr.body[i], tableCell{}) + } + } +} + +func (tr *tableRenderer) copyAlign() { + for i, row := range tr.body { + for j, cell := range row { + if cell.alignment == CellAlignCopyHeader { + tr.body[i][j].alignment = tr.header[j].alignment + } + } + } +} + +func (tr *tableRenderer) Render(w io.Writer, leftPad int, lineWidth int) { + tr.normalize() + tr.copyAlign() + + columnWidths, truncated := tr.columnWidths(lineWidth - leftPad) + pad := strings.Repeat(" ", leftPad) + + drawTopLine(w, pad, columnWidths, truncated) + + drawRow(w, pad, tr.header, columnWidths, truncated) + + drawHeaderUnderline(w, pad, columnWidths, truncated) + + for i, row := range tr.body { + drawRow(w, pad, row, columnWidths, truncated) + if i != len(tr.body)-1 { + drawRowLine(w, pad, columnWidths, truncated) + } + } + + drawBottomLine(w, pad, columnWidths, truncated) +} + +func (tr *tableRenderer) columnWidths(lineWidth int) (widths []int, truncated bool) { + l := len(tr.header) + if len(tr.body) > 0 { + l = max(l, len(tr.body[0])) + } + + maxWidth := make([]int, l) + + for i, cell := range tr.header { + maxWidth[i] = max(maxWidth[i], text.MaxLineLen(cell.content)) + } + + for _, row := range tr.body { + for i, cell := range row { + maxWidth[i] = max(maxWidth[i], text.MaxLineLen(cell.content)) + } + } + + sumWidth := 1 + minWidth := 1 + for _, width := range maxWidth { + sumWidth += width + 1 + minWidth += min(width, minColumnCompactedWidth) + 1 + } + + // Strategy 1: the easy case, content is not large enough to overflow + if sumWidth <= lineWidth { + return maxWidth, false + } + + // Strategy 2: overflow, but still enough room + if minWidth < lineWidth { + return tr.overflowColumnWidths(lineWidth, maxWidth), false + } + + // Strategy 3: too much columns, we need to truncate + return tr.truncateColumnWidths(lineWidth, maxWidth), true +} + +func (tr *tableRenderer) overflowColumnWidths(lineWidth int, maxWidth []int) []int { + // We have an overflow. First, we take as is the columns that are thinner + // than the space equally divided. + // Integer division, rounded lower. + available := lineWidth - len(tr.header) - 1 + fairSpace := available / len(tr.header) + + result := make([]int, len(tr.header)) + remainingColumn := len(tr.header) + + for i, width := range maxWidth { + if width <= fairSpace { + result[i] = width + available -= width + remainingColumn-- + } else { + // Mark the column as non-allocated yet + result[i] = -1 + } + } + + // Now we allocate evenly the remaining space to the remaining columns + for i, width := range result { + if width == -1 { + width = available / remainingColumn + result[i] = width + available -= width + remainingColumn-- + } + } + + return result +} + +func (tr *tableRenderer) truncateColumnWidths(lineWidth int, maxWidth []int) []int { + var result []int + used := 1 + + // Pack as much column as possible without compacting them too much + for _, width := range maxWidth { + w := min(width, minColumnCompactedWidth) + + if used+w+1 > lineWidth { + return result + } + + result = append(result, w) + used += w + 1 + } + + return result +} + +func drawTopLine(w io.Writer, pad string, columnWidths []int, truncated bool) { + _, _ = w.Write([]byte(pad)) + _, _ = w.Write([]byte("┌")) + for i, width := range columnWidths { + _, _ = w.Write([]byte(strings.Repeat("─", width))) + if i != len(columnWidths)-1 { + _, _ = w.Write([]byte("┬")) + } + } + _, _ = w.Write([]byte("┐")) + if truncated { + _, _ = w.Write([]byte("…")) + } + _, _ = w.Write([]byte("\n")) +} + +func drawHeaderUnderline(w io.Writer, pad string, columnWidths []int, truncated bool) { + _, _ = w.Write([]byte(pad)) + _, _ = w.Write([]byte("╞")) + for i, width := range columnWidths { + _, _ = w.Write([]byte(strings.Repeat("═", width))) + if i != len(columnWidths)-1 { + _, _ = w.Write([]byte("╪")) + } + } + _, _ = w.Write([]byte("╡")) + if truncated { + _, _ = w.Write([]byte("…")) + } + _, _ = w.Write([]byte("\n")) +} + +func drawBottomLine(w io.Writer, pad string, columnWidths []int, truncated bool) { + _, _ = w.Write([]byte(pad)) + _, _ = w.Write([]byte("└")) + for i, width := range columnWidths { + _, _ = w.Write([]byte(strings.Repeat("─", width))) + if i != len(columnWidths)-1 { + _, _ = w.Write([]byte("┴")) + } + } + _, _ = w.Write([]byte("┘")) + if truncated { + _, _ = w.Write([]byte("…")) + } + _, _ = w.Write([]byte("\n")) +} + +func drawRowLine(w io.Writer, pad string, columnWidths []int, truncated bool) { + _, _ = w.Write([]byte(pad)) + _, _ = w.Write([]byte("├")) + for i, width := range columnWidths { + _, _ = w.Write([]byte(strings.Repeat("─", width))) + if i != len(columnWidths)-1 { + _, _ = w.Write([]byte("┼")) + } + } + _, _ = w.Write([]byte("┤")) + if truncated { + _, _ = w.Write([]byte("…")) + } + _, _ = w.Write([]byte("\n")) +} + +func drawRow(w io.Writer, pad string, cells []tableCell, columnWidths []int, truncated bool) { + contents := make([][]string, len(cells)) + + // As we draw the row line by line, we need a way to reset and recover + // the formatting when we alternate between cells. To do that, we witness + // the ongoing series of ANSI escape sequence for each cell into a EscapeState. + // This component will be able to merge them and to give us a snapshot sequence + // that we can use when we start the cell again + formatting := make([]text.EscapeState, len(columnWidths)) + + maxHeight := 0 + + // Wrap each cell content into multiple lines, depending on + // how wide each cell is. + for i, cell := range cells[:len(columnWidths)] { + if columnWidths[i] == 0 { + continue + } + wrapped, lines := text.Wrap(cell.content, columnWidths[i]) + contents[i] = strings.Split(wrapped, "\n") + maxHeight = max(maxHeight, lines) + } + + // Draw the row line by line + for i := 0; i < maxHeight; i++ { + _, _ = w.Write([]byte(pad)) + _, _ = w.Write([]byte("│")) + for j, width := range columnWidths { + content := "" + if len(contents[j]) > i { + content = contents[j][i] + trimmed := text.TrimSpace(content) + + switch cells[j].alignment { + case CellAlignLeft: + _, _ = w.Write([]byte(formatting[j].FormatString())) + // accumulate the formatting + formatting[j].Witness(trimmed) + _, _ = w.Write([]byte(trimmed)) + _, _ = w.Write([]byte(formatting[j].ResetString())) + _, _ = w.Write([]byte(strings.Repeat(" ", width-text.Len(trimmed)))) + + case CellAlignCenter: + spaces := width - text.Len(trimmed) + _, _ = w.Write([]byte(strings.Repeat(" ", spaces/2))) + _, _ = w.Write([]byte(formatting[j].FormatString())) + // accumulate the formatting + formatting[j].Witness(trimmed) + _, _ = w.Write([]byte(trimmed)) + _, _ = w.Write([]byte(formatting[j].ResetString())) + _, _ = w.Write([]byte(strings.Repeat(" ", spaces-(spaces/2)))) + + case CellAlignRight: + _, _ = w.Write([]byte(strings.Repeat(" ", width-text.Len(trimmed)))) + _, _ = w.Write([]byte(formatting[j].FormatString())) + // accumulate the formatting + formatting[j].Witness(trimmed) + _, _ = w.Write([]byte(trimmed)) + _, _ = w.Write([]byte(formatting[j].ResetString())) + } + } else { + padding := strings.Repeat(" ", width-text.Len(content)) + _, _ = w.Write([]byte(padding)) + } + _, _ = w.Write([]byte("│")) + } + if truncated { + _, _ = w.Write([]byte("…")) + } + _, _ = w.Write([]byte("\n")) + } +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} diff --git a/vendor/github.com/MichaelMure/go-term-text/.gitignore b/vendor/github.com/MichaelMure/go-term-text/.gitignore new file mode 100644 index 000000000..9f11b755a --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/vendor/github.com/MichaelMure/go-term-text/LICENSE b/vendor/github.com/MichaelMure/go-term-text/LICENSE new file mode 100644 index 000000000..5ba12bf4c --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Michael Muré + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/MichaelMure/go-term-text/Readme.md b/vendor/github.com/MichaelMure/go-term-text/Readme.md new file mode 100644 index 000000000..03acfba94 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/Readme.md @@ -0,0 +1,74 @@ +# go-term-text + +![Build Status](https://github.com/MichaelMure/go-term-text/workflows/Go%20build%20and%20test/badge.svg) +[![GoDoc](https://godoc.org/github.com/MichaelMure/go-term-text?status.svg)](https://godoc.org/github.com/MichaelMure/go-term-text) +[![Go Report Card](https://goreportcard.com/badge/github.com/MichaelMure/go-term-text)](https://goreportcard.com/report/github.com/MichaelMure/go-term-text) +[![codecov](https://codecov.io/gh/MichaelMure/go-term-text/branch/master/graph/badge.svg)](https://codecov.io/gh/MichaelMure/go-term-text) +[![GitHub license](https://img.shields.io/github/license/MichaelMure/go-term-text.svg)](https://github.com/MichaelMure/go-term-text/blob/master/LICENSE) +[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/the-git-bug/Lobby) + +`go-term-text` is a go package implementing a collection of algorithms to help format and manipulate text for the terminal. + +In particular, `go-term-text`: +- support wide characters (chinese, japanese ...) and emoji +- handle properly ANSI escape sequences + +Included algorithms cover: +- wrapping with padding and indentation +- padding +- text length +- trimming +- alignment +- escape sequence extraction and reapplication +- escape sequence snapshot and simplification +- truncation + +## Example + +```go +package main + +import ( + "fmt" + "strings" + + "github.com/MichaelMure/go-term-text" +) + +func main() { + input := "The \x1b[1mLorem ipsum\x1b[0m text is typically composed of " + + "pseudo-Latin words. It is commonly used as \x1b[3mplaceholder\x1b[0m" + + " text to examine or demonstrate the \x1b[9mvisual effects\x1b[0m of " + + "various graphic design. 一只 A Quick \x1b[31m敏捷的狐 Fox " + + "狸跳过了\x1b[0mDog一只懒狗。" + + output, n := text.Wrap(input, 60, + text.WrapIndent("\x1b[34m<-indent-> \x1b[0m"), + text.WrapPad("\x1b[33m<-pad-> \x1b[0m"), + ) + + fmt.Printf("output has %d lines\n\n", n) + + fmt.Println("|" + strings.Repeat("-", 58) + "|") + fmt.Println(output) + fmt.Println("|" + strings.Repeat("-", 58) + "|") +} +``` + +This will print: + +![example output](/img/example.png) + +For more details, have a look at the [GoDoc](https://godoc.org/github.com/MichaelMure/go-term-text). + +## Origin + +This package has been extracted from the [git-bug](https://github.com/MichaelMure/git-bug) project. As such, its aim is to support this project and not to provide an all-in-one solution. Contributions as welcome though. + +## Contribute + +PRs accepted. + +## License + +MIT diff --git a/vendor/github.com/MichaelMure/go-term-text/align.go b/vendor/github.com/MichaelMure/go-term-text/align.go new file mode 100644 index 000000000..8262a4de5 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/align.go @@ -0,0 +1,67 @@ +package text + +import ( + "strings" +) + +type Alignment int + +const ( + NoAlign Alignment = iota + AlignLeft + AlignCenter + AlignRight +) + +// LineAlign align the given line as asked and apply the needed padding to match the given +// lineWidth, while ignoring the terminal escape sequences. +// If the given lineWidth is too small to fit the given line, it's returned without +// padding, overflowing lineWidth. +func LineAlign(line string, lineWidth int, align Alignment) string { + switch align { + case NoAlign: + return line + case AlignLeft: + return LineAlignLeft(line, lineWidth) + case AlignCenter: + return LineAlignCenter(line, lineWidth) + case AlignRight: + return LineAlignRight(line, lineWidth) + } + panic("unknown alignment") +} + +// LineAlignLeft align the given line on the left while ignoring the terminal escape sequences. +// If the given lineWidth is too small to fit the given line, it's returned without +// padding, overflowing lineWidth. +func LineAlignLeft(line string, lineWidth int) string { + return TrimSpace(line) +} + +// LineAlignCenter align the given line on the center and apply the needed left +// padding, while ignoring the terminal escape sequences. +// If the given lineWidth is too small to fit the given line, it's returned without +// padding, overflowing lineWidth. +func LineAlignCenter(line string, lineWidth int) string { + trimmed := TrimSpace(line) + totalPadLen := lineWidth - Len(trimmed) + if totalPadLen < 0 { + totalPadLen = 0 + } + pad := strings.Repeat(" ", totalPadLen/2) + return pad + trimmed +} + +// LineAlignRight align the given line on the right and apply the needed left +// padding to match the given lineWidth, while ignoring the terminal escape sequences. +// If the given lineWidth is too small to fit the given line, it's returned without +// padding, overflowing lineWidth. +func LineAlignRight(line string, lineWidth int) string { + trimmed := TrimSpace(line) + padLen := lineWidth - Len(trimmed) + if padLen < 0 { + padLen = 0 + } + pad := strings.Repeat(" ", padLen) + return pad + trimmed +} diff --git a/vendor/github.com/MichaelMure/go-term-text/escape_state.go b/vendor/github.com/MichaelMure/go-term-text/escape_state.go new file mode 100644 index 000000000..c4bd60e84 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/escape_state.go @@ -0,0 +1,288 @@ +package text + +import ( + "fmt" + "strconv" + "strings" +) + +const Escape = '\x1b' + +type EscapeState struct { + Bold bool + Dim bool + Italic bool + Underlined bool + Blink bool + Reverse bool + Hidden bool + CrossedOut bool + + FgColor Color + BgColor Color +} + +type Color interface { + Codes() []string +} + +func (es *EscapeState) Witness(s string) { + inEscape := false + var start int + + runes := []rune(s) + + for i, r := range runes { + if r == Escape { + inEscape = true + start = i + continue + } + if inEscape { + if r == 'm' { + inEscape = false + es.witnessCode(string(runes[start+1 : i])) + } + continue + } + } +} + +func (es *EscapeState) witnessCode(s string) { + if s == "" { + return + } + if s == "[" { + es.reset() + return + } + if len(s) < 2 { + return + } + if s[0] != '[' { + return + } + + s = s[1:] + split := strings.Split(s, ";") + + dequeue := func() { + split = split[1:] + } + + color := func(ground int) Color { + if len(split) < 1 { + // the whole sequence is broken, ignoring the rest + return nil + } + + subCode := split[0] + dequeue() + + switch subCode { + case "2": + if len(split) < 3 { + return nil + } + r, err := strconv.Atoi(split[0]) + dequeue() + if err != nil { + return nil + } + g, err := strconv.Atoi(split[0]) + dequeue() + if err != nil { + return nil + } + b, err := strconv.Atoi(split[0]) + dequeue() + if err != nil { + return nil + } + return &ColorRGB{ground: ground, R: r, G: g, B: b} + + case "5": + if len(split) < 1 { + return nil + } + index, err := strconv.Atoi(split[0]) + dequeue() + if err != nil { + return nil + } + return &Color256{ground: ground, Index: index} + + } + return nil + } + + for len(split) > 0 { + code, err := strconv.Atoi(split[0]) + if err != nil { + return + } + dequeue() + + switch { + case code == 0: + es.reset() + + case code == 1: + es.Bold = true + case code == 2: + es.Dim = true + case code == 3: + es.Italic = true + case code == 4: + es.Underlined = true + case code == 5: + es.Blink = true + // case code == 6: + case code == 7: + es.Reverse = true + case code == 8: + es.Hidden = true + case code == 9: + es.CrossedOut = true + + case code == 21: + es.Bold = false + case code == 22: + es.Dim = false + case code == 23: + es.Italic = false + case code == 24: + es.Underlined = false + case code == 25: + es.Blink = false + // case code == 26: + case code == 27: + es.Reverse = false + case code == 28: + es.Hidden = false + case code == 29: + es.CrossedOut = false + + case (code >= 30 && code <= 37) || code == 39 || (code >= 90 && code <= 97): + es.FgColor = ColorIndex(code) + + case (code >= 40 && code <= 47) || code == 49 || (code >= 100 && code <= 107): + es.BgColor = ColorIndex(code) + + case code == 38: + es.FgColor = color(code) + if es.FgColor == nil { + return + } + + case code == 48: + es.BgColor = color(code) + if es.BgColor == nil { + return + } + } + } +} + +func (es *EscapeState) reset() { + *es = EscapeState{} +} + +// FormatString return the escape codes to enable that formatting. +func (es *EscapeState) FormatString() string { + var codes []string + + if es.Bold { + codes = append(codes, strconv.Itoa(1)) + } + if es.Dim { + codes = append(codes, strconv.Itoa(2)) + } + if es.Italic { + codes = append(codes, strconv.Itoa(3)) + } + if es.Underlined { + codes = append(codes, strconv.Itoa(4)) + } + if es.Blink { + codes = append(codes, strconv.Itoa(5)) + } + if es.Reverse { + codes = append(codes, strconv.Itoa(7)) + } + if es.Hidden { + codes = append(codes, strconv.Itoa(8)) + } + if es.CrossedOut { + codes = append(codes, strconv.Itoa(9)) + } + + if es.FgColor != nil { + codes = append(codes, es.FgColor.Codes()...) + } + if es.BgColor != nil { + codes = append(codes, es.BgColor.Codes()...) + } + + if len(codes) == 0 { + return "" + } + + return fmt.Sprintf("\x1b[%sm", strings.Join(codes, ";")) +} + +// ResetString return either the global reset code or nothing, depending on if +// this state has something to reset or not. +func (es *EscapeState) ResetString() string { + if es.IsZero() { + return "" + } + return "\x1b[0m" +} + +func (es *EscapeState) IsZero() bool { + return !es.Bold && + !es.Dim && + !es.Italic && + !es.Underlined && + !es.Blink && + !es.Reverse && + !es.Hidden && + !es.CrossedOut && + es.FgColor == nil && + es.BgColor == nil +} + +type ColorIndex int + +func (cInd ColorIndex) Codes() []string { + return []string{strconv.Itoa(int(cInd))} +} + +type Color256 struct { + ground int + Index int +} + +func (c256 Color256) Codes() []string { + return []string{ + strconv.Itoa(c256.ground), + "5", + strconv.Itoa(c256.Index), + } +} + +type ColorRGB struct { + ground int + R, G, B int +} + +func (cRGB ColorRGB) Codes() []string { + return []string{ + strconv.Itoa(cRGB.ground), + "2", + strconv.Itoa(cRGB.R), + strconv.Itoa(cRGB.G), + strconv.Itoa(cRGB.B), + } +} diff --git a/vendor/github.com/MichaelMure/go-term-text/escapes.go b/vendor/github.com/MichaelMure/go-term-text/escapes.go new file mode 100644 index 000000000..19f78c926 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/escapes.go @@ -0,0 +1,95 @@ +package text + +import ( + "strings" + "unicode/utf8" +) + +// EscapeItem hold the description of terminal escapes in a line. +// 'item' is the actual escape command +// 'pos' is the index in the rune array where the 'item' shall be inserted back. +// For example, the escape item in "F\x1b33mox" is {"\x1b33m", 1}. +type EscapeItem struct { + Item string + Pos int +} + +// ExtractTermEscapes extract terminal escapes out of a line and returns a new +// line without terminal escapes and a slice of escape items. The terminal escapes +// can be inserted back into the new line at rune index 'item.pos' to recover the +// original line. +// +// Required: The line shall not contain "\n" +func ExtractTermEscapes(line string) (string, []EscapeItem) { + var termEscapes []EscapeItem + var line1 strings.Builder + + pos := 0 + item := "" + occupiedRuneCount := 0 + inEscape := false + for i, r := range []rune(line) { + if r == '\x1b' { + pos = i + item = string(r) + inEscape = true + continue + } + if inEscape { + item += string(r) + if r == 'm' { + termEscapes = append(termEscapes, EscapeItem{item, pos - occupiedRuneCount}) + occupiedRuneCount += utf8.RuneCountInString(item) + inEscape = false + } + continue + } + line1.WriteRune(r) + } + + return line1.String(), termEscapes +} + +// ApplyTermEscapes apply the extracted terminal escapes to the edited line. +// Escape sequences need to be ordered by their position. +// If the position is < 0, the escape is applied at the beginning of the line. +// If the position is > len(line), the escape is applied at the end of the line. +func ApplyTermEscapes(line string, escapes []EscapeItem) string { + if len(escapes) == 0 { + return line + } + + var out strings.Builder + + currPos := 0 + currItem := 0 + for _, r := range line { + for currItem < len(escapes) && currPos >= escapes[currItem].Pos { + out.WriteString(escapes[currItem].Item) + currItem++ + } + out.WriteRune(r) + currPos++ + } + + // Don't forget the trailing escapes, if any. + for currItem < len(escapes) { + out.WriteString(escapes[currItem].Item) + currItem++ + } + + return out.String() +} + +// OffsetEscapes is a utility function to offset the position of a +// collection of EscapeItem. +func OffsetEscapes(escapes []EscapeItem, offset int) []EscapeItem { + result := make([]EscapeItem, len(escapes)) + for i, e := range escapes { + result[i] = EscapeItem{ + Item: e.Item, + Pos: e.Pos + offset, + } + } + return result +} diff --git a/vendor/github.com/MichaelMure/go-term-text/left_pad.go b/vendor/github.com/MichaelMure/go-term-text/left_pad.go new file mode 100644 index 000000000..a63fedb9b --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/left_pad.go @@ -0,0 +1,50 @@ +package text + +import ( + "bytes" + "strings" + + "github.com/mattn/go-runewidth" +) + +// LeftPadMaxLine pads a line on the left by a specified amount and pads the +// string on the right to fill the maxLength. +// If the given string is too long, it is truncated with an ellipsis. +// Handle properly terminal color escape code +func LeftPadMaxLine(line string, length, leftPad int) string { + cleaned, escapes := ExtractTermEscapes(line) + + scrWidth := runewidth.StringWidth(cleaned) + // truncate and ellipse if needed + if scrWidth+leftPad > length { + cleaned = runewidth.Truncate(cleaned, length-leftPad, "…") + } else if scrWidth+leftPad < length { + cleaned = runewidth.FillRight(cleaned, length-leftPad) + } + + rightPart := ApplyTermEscapes(cleaned, escapes) + pad := strings.Repeat(" ", leftPad) + + return pad + rightPart +} + +// LeftPad left pad each line of the given text +func LeftPadLines(text string, leftPad int) string { + var result bytes.Buffer + + pad := strings.Repeat(" ", leftPad) + + lines := strings.Split(text, "\n") + + for i, line := range lines { + result.WriteString(pad) + result.WriteString(line) + + // no additional line break at the end + if i < len(lines)-1 { + result.WriteString("\n") + } + } + + return result.String() +} diff --git a/vendor/github.com/MichaelMure/go-term-text/len.go b/vendor/github.com/MichaelMure/go-term-text/len.go new file mode 100644 index 000000000..c6bcaeaca --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/len.go @@ -0,0 +1,45 @@ +package text + +import ( + "strings" + + "github.com/mattn/go-runewidth" +) + +// Len return the length of a string in a terminal, while ignoring the terminal +// escape sequences. +func Len(text string) int { + length := 0 + escape := false + + for _, char := range text { + if char == '\x1b' { + escape = true + } + if !escape { + length += runewidth.RuneWidth(char) + } + if char == 'm' { + escape = false + } + } + + return length +} + +// MaxLineLen return the length in a terminal of the longest line, while +// ignoring the terminal escape sequences. +func MaxLineLen(text string) int { + lines := strings.Split(text, "\n") + + max := 0 + + for _, line := range lines { + length := Len(line) + if length > max { + max = length + } + } + + return max +} diff --git a/vendor/github.com/MichaelMure/go-term-text/trim.go b/vendor/github.com/MichaelMure/go-term-text/trim.go new file mode 100644 index 000000000..eaf2ca0c0 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/trim.go @@ -0,0 +1,28 @@ +package text + +import ( + "strings" + "unicode" +) + +// TrimSpace remove the leading and trailing whitespace while ignoring the +// terminal escape sequences. +// Returns the number of trimmed space on both side. +func TrimSpace(line string) string { + cleaned, escapes := ExtractTermEscapes(line) + + // trim left while counting + left := 0 + trimmed := strings.TrimLeftFunc(cleaned, func(r rune) bool { + if unicode.IsSpace(r) { + left++ + return true + } + return false + }) + + trimmed = strings.TrimRightFunc(trimmed, unicode.IsSpace) + + escapes = OffsetEscapes(escapes, -left) + return ApplyTermEscapes(trimmed, escapes) +} diff --git a/vendor/github.com/MichaelMure/go-term-text/truncate.go b/vendor/github.com/MichaelMure/go-term-text/truncate.go new file mode 100644 index 000000000..b51bb39e3 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/truncate.go @@ -0,0 +1,24 @@ +package text + +import "github.com/mattn/go-runewidth" + +// TruncateMax truncate a line if its length is greater +// than the given length. Otherwise, the line is returned +// as is. If truncating occur, an ellipsis is inserted at +// the end. +// Handle properly terminal color escape code +func TruncateMax(line string, length int) string { + if length <= 0 { + return "…" + } + + l := Len(line) + if l <= length || l == 0 { + return line + } + + cleaned, escapes := ExtractTermEscapes(line) + truncated := runewidth.Truncate(cleaned, length-1, "") + + return ApplyTermEscapes(truncated, escapes) + "…" +} diff --git a/vendor/github.com/MichaelMure/go-term-text/wrap.go b/vendor/github.com/MichaelMure/go-term-text/wrap.go new file mode 100644 index 000000000..f63ee84fc --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/wrap.go @@ -0,0 +1,419 @@ +package text + +import ( + "strings" + + "github.com/mattn/go-runewidth" +) + +type wrapOpts struct { + indent string + pad string + align Alignment +} + +// WrapOption is a functional option for the Wrap() function +type WrapOption func(opts *wrapOpts) + +// WrapPad configure the padding with a string for Wrap() +func WrapPad(pad string) WrapOption { + return func(opts *wrapOpts) { + opts.pad = pad + } +} + +// WrapPadded configure the padding with a number of space characters for Wrap() +func WrapPadded(padLen int) WrapOption { + return func(opts *wrapOpts) { + opts.pad = strings.Repeat(" ", padLen) + } +} + +// WrapPad configure the indentation on the first line for Wrap() +func WrapIndent(indent string) WrapOption { + return func(opts *wrapOpts) { + opts.indent = indent + } +} + +// WrapAlign configure the text alignment for Wrap() +func WrapAlign(align Alignment) WrapOption { + return func(opts *wrapOpts) { + opts.align = align + } +} + +// allWrapOpts compile the set of WrapOption into a final wrapOpts +// from the default values. +func allWrapOpts(opts []WrapOption) *wrapOpts { + wrapOpts := &wrapOpts{ + indent: "", + pad: "", + align: NoAlign, + } + for _, opt := range opts { + opt(wrapOpts) + } + if wrapOpts.indent == "" { + wrapOpts.indent = wrapOpts.pad + } + return wrapOpts +} + +// Wrap a text for a given line size. +// Handle properly terminal color escape code +// Options are accepted to configure things like indent, padding or alignment. +// Return the wrapped text and the number of lines +func Wrap(text string, lineWidth int, opts ...WrapOption) (string, int) { + wrapOpts := allWrapOpts(opts) + + if lineWidth <= 0 { + return "", 1 + } + + var result strings.Builder + var state EscapeState + nbLine := 0 + + // output function to: + // - set the endlines (same as strings.Join()) + // - reset and set again the escape state around the padding/indent + output := func(padding string, content string) { + zeroState := state.IsZero() + if !zeroState && len(padding) > 0 { + result.WriteString("\x1b[0m") + } + if nbLine > 0 { + result.WriteString("\n") + } + result.WriteString(padding) + if !zeroState && len(padding) > 0 { + result.WriteString(state.FormatString()) + } + result.WriteString(content) + nbLine++ + state.Witness(content) + } + + if Len(wrapOpts.indent) >= lineWidth { + // indent is too wide, fallback rendering + output(strings.Repeat("⭬", lineWidth), "") + wrapOpts.indent = wrapOpts.pad + } + if Len(wrapOpts.pad) >= lineWidth { + // padding is too wide, fallback rendering + line := strings.Repeat("⭬", lineWidth) + return strings.Repeat(line+"\n", 5), 6 + } + + // Start with the indent + padStr := wrapOpts.indent + padLen := Len(wrapOpts.indent) + + // tabs are formatted as 4 spaces + text = strings.Replace(text, "\t", " ", -1) + + // NOTE: text is first segmented into lines so that softwrapLine can handle individually + for i, line := range strings.Split(text, "\n") { + // on the second line, switch to use the padding instead + if i == 1 { + padStr = wrapOpts.pad + padLen = Len(wrapOpts.pad) + } + + if line == "" || strings.TrimSpace(line) == "" { + // nothing in the line, we just add the non-empty part of the padding + output(strings.TrimRight(padStr, " "), "") + continue + } + + wrapped := softwrapLine(line, lineWidth-padLen) + split := strings.Split(wrapped, "\n") + + if i == 0 && len(split) > 1 { + // the very first line got wrapped. + // that means we need to use the indent, use the first wrapped line, discard the rest + // switch to the normal padding, do the softwrap again with the remainder, + // and fallback to the normal wrapping flow + + content := LineAlign(strings.TrimRight(split[0], " "), lineWidth-padLen, wrapOpts.align) + output(padStr, content) + + line = strings.TrimPrefix(line, split[0]) + line = strings.TrimLeft(line, " ") + + padStr = wrapOpts.pad + padLen = Len(wrapOpts.pad) + + wrapped = softwrapLine(line, lineWidth-padLen) + split = strings.Split(wrapped, "\n") + } + + for j, seg := range split { + if j == 0 { + // keep the left padding of the wrapped line + content := LineAlign(strings.TrimRight(seg, " "), lineWidth-padLen, wrapOpts.align) + output(padStr, content) + } else { + content := LineAlign(strings.TrimSpace(seg), lineWidth-padLen, wrapOpts.align) + output(padStr, content) + } + } + } + + return result.String(), nbLine +} + +// WrapLeftPadded wrap a text for a given line size with a left padding. +// Handle properly terminal color escape code +func WrapLeftPadded(text string, lineWidth int, leftPad int) (string, int) { + return Wrap(text, lineWidth, WrapPadded(leftPad)) +} + +// WrapWithPad wrap a text for a given line size with a custom left padding +// Handle properly terminal color escape code +func WrapWithPad(text string, lineWidth int, pad string) (string, int) { + return Wrap(text, lineWidth, WrapPad(pad)) +} + +// WrapWithPad wrap a text for a given line size with a custom left padding +// This function also align the result depending on the requested alignment. +// Handle properly terminal color escape code +func WrapWithPadAlign(text string, lineWidth int, pad string, align Alignment) (string, int) { + return Wrap(text, lineWidth, WrapPad(pad), WrapAlign(align)) +} + +// WrapWithPadIndent wrap a text for a given line size with a custom left padding +// and a first line indent. The padding is not effective on the first line, indent +// is used instead, which allow to implement indents and outdents. +// Handle properly terminal color escape code +func WrapWithPadIndent(text string, lineWidth int, indent string, pad string) (string, int) { + return Wrap(text, lineWidth, WrapIndent(indent), WrapPad(pad)) +} + +// WrapWithPadIndentAlign wrap a text for a given line size with a custom left padding +// and a first line indent. The padding is not effective on the first line, indent +// is used instead, which allow to implement indents and outdents. +// This function also align the result depending on the requested alignment. +// Handle properly terminal color escape code +func WrapWithPadIndentAlign(text string, lineWidth int, indent string, pad string, align Alignment) (string, int) { + return Wrap(text, lineWidth, WrapIndent(indent), WrapPad(pad), WrapAlign(align)) +} + +// Break a line into several lines so that each line consumes at most +// 'lineWidth' cells. Lines break at groups of white spaces and multicell +// chars. Nothing is removed from the original text so that it behaves like a +// softwrap. +// +// Required: The line shall not contain '\n' +// +// WRAPPING ALGORITHM: The line is broken into non-breakable chunks, then line +// breaks ("\n") are inserted between these groups so that the total length +// between breaks does not exceed the required width. Words that are longer than +// the textWidth are broken into pieces no longer than textWidth. +func softwrapLine(line string, lineWidth int) string { + escaped, escapes := ExtractTermEscapes(line) + + chunks := segmentLine(escaped) + // Reverse the chunk array so we can use it as a stack. + for i, j := 0, len(chunks)-1; i < j; i, j = i+1, j-1 { + chunks[i], chunks[j] = chunks[j], chunks[i] + } + + // for readability, minimal implementation of a stack: + + pop := func() string { + result := chunks[len(chunks)-1] + chunks = chunks[:len(chunks)-1] + return result + } + + push := func(chunk string) { + chunks = append(chunks, chunk) + } + + peek := func() string { + return chunks[len(chunks)-1] + } + + empty := func() bool { + return len(chunks) == 0 + } + + var out strings.Builder + + // helper to write in the output while interleaving the escape + // sequence at the correct places. + // note: the final algorithm will add additional line break in the original + // text. Those line break are *not* fed to this helper so the positions don't + // need to be offset, which make the whole thing much easier. + currPos := 0 + currItem := 0 + outputString := func(s string) { + for _, r := range s { + for currItem < len(escapes) && currPos == escapes[currItem].Pos { + out.WriteString(escapes[currItem].Item) + currItem++ + } + out.WriteRune(r) + currPos++ + } + } + + width := 0 + + for !empty() { + wl := Len(peek()) + + if width+wl <= lineWidth { + // the chunk fit in the available space + outputString(pop()) + width += wl + if width == lineWidth && !empty() { + // only add line break when there is more chunk to come + out.WriteRune('\n') + width = 0 + } + } else if wl > lineWidth { + // words too long for a full line are split to fill the remaining space. + // But if the long words is the first non-space word in the middle of the + // line, preceding spaces shall not be counted in word splitting. + splitWidth := lineWidth - width + if strings.HasSuffix(out.String(), "\n"+strings.Repeat(" ", width)) { + splitWidth += width + } + left, right := splitWord(pop(), splitWidth) + // remainder is pushed back to the stack for next round + push(right) + outputString(left) + out.WriteRune('\n') + width = 0 + } else { + // normal line overflow, we add a line break and try again + out.WriteRune('\n') + width = 0 + } + } + + // Don't forget the trailing escapes, if any. + for currItem < len(escapes) && currPos >= escapes[currItem].Pos { + out.WriteString(escapes[currItem].Item) + currItem++ + } + + return out.String() +} + +// Segment a line into chunks, where each chunk consists of chars with the same +// type and is not breakable. +func segmentLine(s string) []string { + var chunks []string + + var word string + wordType := none + flushWord := func() { + chunks = append(chunks, word) + word = "" + wordType = none + } + + for _, r := range s { + // A WIDE_CHAR itself constitutes a chunk. + thisType := runeType(r) + if thisType == wideChar { + if wordType != none { + flushWord() + } + chunks = append(chunks, string(r)) + continue + } + // Other type of chunks starts with a char of that type, and ends with a + // char with different type or end of string. + if thisType != wordType { + if wordType != none { + flushWord() + } + word = string(r) + wordType = thisType + } else { + word += string(r) + } + } + if word != "" { + flushWord() + } + + return chunks +} + +type RuneType int + +// Rune categories +// +// These categories are so defined that each category forms a non-breakable +// chunk. It IS NOT the same as unicode code point categories. +const ( + none RuneType = iota + wideChar + invisible + shortUnicode + space + visibleAscii +) + +// Determine the category of a rune. +func runeType(r rune) RuneType { + rw := runewidth.RuneWidth(r) + if rw > 1 { + return wideChar + } else if rw == 0 { + return invisible + } else if r > 127 { + return shortUnicode + } else if r == ' ' { + return space + } else { + return visibleAscii + } +} + +// splitWord split a word at the given length, while ignoring the terminal escape sequences +func splitWord(word string, length int) (string, string) { + runes := []rune(word) + var result []rune + added := 0 + escape := false + + if length == 0 { + return "", word + } + + for _, r := range runes { + if r == '\x1b' { + escape = true + } + + width := runewidth.RuneWidth(r) + if width+added > length { + // wide character made the length overflow + break + } + + result = append(result, r) + + if !escape { + added += width + if added >= length { + break + } + } + + if r == 'm' { + escape = false + } + } + + leftover := runes[len(result):] + + return string(result), string(leftover) +} diff --git a/vendor/github.com/alecthomas/chroma/.gitignore b/vendor/github.com/alecthomas/chroma/.gitignore new file mode 100644 index 000000000..ccacd12e9 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/.gitignore @@ -0,0 +1,19 @@ +# Binaries for programs and plugins +*.exe +*.dll +*.so +*.dylib +/cmd/chroma/chroma + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 +.glide/ + +_models/ + +_examples/ diff --git a/vendor/github.com/alecthomas/chroma/.golangci.yml b/vendor/github.com/alecthomas/chroma/.golangci.yml new file mode 100644 index 000000000..b1e51f393 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/.golangci.yml @@ -0,0 +1,55 @@ +run: + tests: true + skip-dirs: + - _examples + +output: + print-issued-lines: false + +linters: + enable-all: true + disable: + - maligned + - megacheck + - lll + - gocyclo + - dupl + - gochecknoglobals + - funlen + - godox + - wsl + - gomnd + - gocognit + +linters-settings: + govet: + check-shadowing: true + gocyclo: + min-complexity: 10 + dupl: + threshold: 100 + goconst: + min-len: 8 + min-occurrences: 3 + +issues: + max-per-linter: 0 + max-same: 0 + exclude-use-default: false + exclude: + # Captured by errcheck. + - '^(G104|G204):' + # Very commonly not checked. + - 'Error return value of .(.*\.Help|.*\.MarkFlagRequired|(os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked' + - 'exported method (.*\.MarshalJSON|.*\.UnmarshalJSON|.*\.EntityURN|.*\.GoString|.*\.Pos) should have comment or be unexported' + - 'composite literal uses unkeyed fields' + - 'declaration of "err" shadows declaration' + - 'should not use dot imports' + - 'Potential file inclusion via variable' + - 'should have comment or be unexported' + - 'comment on exported var .* should be of the form' + - 'at least one file in a package should have a package comment' + - 'string literal contains the Unicode' + - 'methods on the same type should have the same receiver name' + - '_TokenType_name should be _TokenTypeName' + - '`_TokenType_map` should be `_TokenTypeMap`' diff --git a/vendor/github.com/alecthomas/chroma/.goreleaser.yml b/vendor/github.com/alecthomas/chroma/.goreleaser.yml new file mode 100644 index 000000000..e90c51131 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/.goreleaser.yml @@ -0,0 +1,31 @@ +project_name: chroma +release: + github: + owner: alecthomas + name: chroma +brew: + install: bin.install "chroma" +builds: +- goos: + - linux + - darwin + - windows + goarch: + - amd64 + - "386" + goarm: + - "6" + main: ./cmd/chroma/main.go + ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} + binary: chroma +archive: + format: tar.gz + name_template: '{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ + .Arm }}{{ end }}' + files: + - COPYING + - README* +snapshot: + name_template: SNAPSHOT-{{ .Commit }} +checksum: + name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt' diff --git a/vendor/github.com/alecthomas/chroma/.travis.yml b/vendor/github.com/alecthomas/chroma/.travis.yml new file mode 100644 index 000000000..9216ec974 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/.travis.yml @@ -0,0 +1,12 @@ +sudo: false +language: go +go: + - "1.13.x" +script: + - go test -v ./... + - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.22.2 + - ./bin/golangci-lint run + - git clean -fdx . +after_success: + curl -sL https://git.io/goreleaser | bash && goreleaser + diff --git a/vendor/github.com/alecthomas/chroma/COPYING b/vendor/github.com/alecthomas/chroma/COPYING new file mode 100644 index 000000000..92dc39f70 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/COPYING @@ -0,0 +1,19 @@ +Copyright (C) 2017 Alec Thomas + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/alecthomas/chroma/Makefile b/vendor/github.com/alecthomas/chroma/Makefile new file mode 100644 index 000000000..1b8320a58 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/Makefile @@ -0,0 +1,19 @@ +.PHONY: chromad upload all + +all: README.md tokentype_string.go + +README.md: lexers/*/*.go + ./table.py + +tokentype_string.go: types.go + go generate + +chromad: + (cd ./cmd/chromad && go get github.com/GeertJohan/go.rice/rice@master && go install github.com/GeertJohan/go.rice/rice) + rm -f chromad + (export CGOENABLED=0 GOOS=linux ; cd ./cmd/chromad && go build -o ../../chromad .) + rice append -i ./cmd/chromad --exec=./chromad + +upload: chromad + scp chromad root@swapoff.org: && \ + ssh root@swapoff.org 'install -m755 ./chromad /srv/http/swapoff.org/bin && service chromad restart' diff --git a/vendor/github.com/alecthomas/chroma/README.md b/vendor/github.com/alecthomas/chroma/README.md new file mode 100644 index 000000000..490adeaca --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/README.md @@ -0,0 +1,267 @@ +# Chroma — A general purpose syntax highlighter in pure Go [![Golang Documentation](https://godoc.org/github.com/alecthomas/chroma?status.svg)](https://godoc.org/github.com/alecthomas/chroma) [![Build Status](https://travis-ci.org/alecthomas/chroma.svg)](https://travis-ci.org/alecthomas/chroma) [![Gitter chat](https://badges.gitter.im/alecthomas.svg)](https://gitter.im/alecthomas/Lobby) + +> **NOTE:** As Chroma has just been released, its API is still in flux. That said, the high-level interface should not change significantly. + +Chroma takes source code and other structured text and converts it into syntax +highlighted HTML, ANSI-coloured text, etc. + +Chroma is based heavily on [Pygments](http://pygments.org/), and includes +translators for Pygments lexers and styles. + + +## Table of Contents + + + +1. [Table of Contents](#table-of-contents) +2. [Supported languages](#supported-languages) +3. [Try it](#try-it) +4. [Using the library](#using-the-library) + 1. [Quick start](#quick-start) + 2. [Identifying the language](#identifying-the-language) + 3. [Formatting the output](#formatting-the-output) + 4. [The HTML formatter](#the-html-formatter) +5. [More detail](#more-detail) + 1. [Lexers](#lexers) + 2. [Formatters](#formatters) + 3. [Styles](#styles) +6. [Command-line interface](#command-line-interface) +7. [What's missing compared to Pygments?](#whats-missing-compared-to-pygments) + + + + +## Supported languages + +Prefix | Language +:----: | -------- +A | ABAP, ABNF, ActionScript, ActionScript 3, Ada, Angular2, ANTLR, ApacheConf, APL, AppleScript, Arduino, Awk +B | Ballerina, Base Makefile, Bash, Batchfile, BlitzBasic, BNF, Brainfuck +C | C, C#, C++, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Crystal, CSS, Cython +D | D, Dart, Diff, Django/Jinja, Docker, DTD +E | EBNF, Elixir, Elm, EmacsLisp, Erlang +F | Factor, Fish, Forth, Fortran, FSharp +G | GAS, GDScript, Genshi, Genshi HTML, Genshi Text, GLSL, Gnuplot, Go, Go HTML Template, Go Text Template, GraphQL, Groovy +H | Handlebars, Haskell, Haxe, HCL, Hexdump, HTML, HTTP, Hy +I | Idris, INI, Io +J | J, Java, JavaScript, JSON, Julia, Jungle +K | Kotlin +L | Lighttpd configuration file, LLVM, Lua +M | Mako, markdown, Mason, Mathematica, Matlab, MiniZinc, MLIR, Modula-2, MonkeyC, MorrowindScript, Myghty, MySQL +N | NASM, Newspeak, Nginx configuration file, Nim, Nix +O | Objective-C, OCaml, Octave, OpenSCAD, Org Mode +P | PacmanConf, Perl, PHP, Pig, PkgConfig, PL/pgSQL, plaintext, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, Protocol Buffer, Puppet, Python, Python 3 +Q | QBasic +R | R, Racket, Ragel, react, reg, reStructuredText, Rexx, Ruby, Rust +S | Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, SML, Snobol, Solidity, SPARQL, SQL, SquidConf, Swift, SYSTEMD, systemverilog +T | TableGen, TASM, Tcl, Tcsh, Termcap, Terminfo, Terraform, TeX, Thrift, TOML, TradingView, Transact-SQL, Turing, Turtle, Twig, TypeScript, TypoScript, TypoScriptCssData, TypoScriptHtmlData +V | VB.net, verilog, VHDL, VimL, vue +W | WDTE +X | XML, Xorg +Y | YAML + + +_I will attempt to keep this section up to date, but an authoritative list can be +displayed with `chroma --list`._ + + +## Try it + +Try out various languages and styles on the [Chroma Playground](https://swapoff.org/chroma/playground/). + + +## Using the library + +Chroma, like Pygments, has the concepts of +[lexers](https://github.com/alecthomas/chroma/tree/master/lexers), +[formatters](https://github.com/alecthomas/chroma/tree/master/formatters) and +[styles](https://github.com/alecthomas/chroma/tree/master/styles). + +Lexers convert source text into a stream of tokens, styles specify how token +types are mapped to colours, and formatters convert tokens and styles into +formatted output. + +A package exists for each of these, containing a global `Registry` variable +with all of the registered implementations. There are also helper functions +for using the registry in each package, such as looking up lexers by name or +matching filenames, etc. + +In all cases, if a lexer, formatter or style can not be determined, `nil` will +be returned. In this situation you may want to default to the `Fallback` +value in each respective package, which provides sane defaults. + + +### Quick start + +A convenience function exists that can be used to simply format some source +text, without any effort: + +```go +err := quick.Highlight(os.Stdout, someSourceCode, "go", "html", "monokai") +``` + + +### Identifying the language + +To highlight code, you'll first have to identify what language the code is +written in. There are three primary ways to do that: + +1. Detect the language from its filename. + + ```go + lexer := lexers.Match("foo.go") + ``` + +3. Explicitly specify the language by its Chroma syntax ID (a full list is available from `lexers.Names()`). + + ```go + lexer := lexers.Get("go") + ``` + +3. Detect the language from its content. + + ```go + lexer := lexers.Analyse("package main\n\nfunc main()\n{\n}\n") + ``` + +In all cases, `nil` will be returned if the language can not be identified. + +```go +if lexer == nil { + lexer = lexers.Fallback +} +``` + +At this point, it should be noted that some lexers can be extremely chatty. To +mitigate this, you can use the coalescing lexer to coalesce runs of identical +token types into a single token: + +```go +lexer = chroma.Coalesce(lexer) +``` + + +### Formatting the output + +Once a language is identified you will need to pick a formatter and a style (theme). + +```go +style := styles.Get("swapoff") +if style == nil { + style = styles.Fallback +} +formatter := formatters.Get("html") +if formatter == nil { + formatter = formatters.Fallback +} +``` + +Then obtain an iterator over the tokens: + +```go +contents, err := ioutil.ReadAll(r) +iterator, err := lexer.Tokenise(nil, string(contents)) +``` + +And finally, format the tokens from the iterator: + +```go +err := formatter.Format(w, style, iterator) +``` + + +### The HTML formatter + +By default the `html` registered formatter generates standalone HTML with +embedded CSS. More flexibility is available through the `formatters/html` package. + +Firstly, the output generated by the formatter can be customised with the +following constructor options: + +- `Standalone()` - generate standalone HTML with embedded CSS. +- `WithClasses()` - use classes rather than inlined style attributes. +- `ClassPrefix(prefix)` - prefix each generated CSS class. +- `TabWidth(width)` - Set the rendered tab width, in characters. +- `WithLineNumbers()` - Render line numbers (style with `LineNumbers`). +- `LinkableLineNumbers()` - Make the line numbers linkable. +- `HighlightLines(ranges)` - Highlight lines in these ranges (style with `LineHighlight`). +- `LineNumbersInTable()` - Use a table for formatting line numbers and code, rather than spans. + +If `WithClasses()` is used, the corresponding CSS can be obtained from the formatter with: + +```go +formatter := html.New(html.WithClasses()) +err := formatter.WriteCSS(w, style) +``` + + +## More detail + + +### Lexers + +See the [Pygments documentation](http://pygments.org/docs/lexerdevelopment/) +for details on implementing lexers. Most concepts apply directly to Chroma, +but see existing lexer implementations for real examples. + +In many cases lexers can be automatically converted directly from Pygments by +using the included Python 3 script `pygments2chroma.py`. I use something like +the following: + +```sh +python3 ~/Projects/chroma/_tools/pygments2chroma.py \ + pygments.lexers.jvm.KotlinLexer \ + > ~/Projects/chroma/lexers/kotlin.go \ + && gofmt -s -w ~/Projects/chroma/lexers/*.go +``` + +See notes in [pygments-lexers.go](https://github.com/alecthomas/chroma/blob/master/pygments-lexers.txt) +for a list of lexers, and notes on some of the issues importing them. + + +### Formatters + +Chroma supports HTML output, as well as terminal output in 8 colour, 256 colour, and true-colour. + +A `noop` formatter is included that outputs the token text only, and a `tokens` +formatter outputs raw tokens. The latter is useful for debugging lexers. + + +### Styles + +Chroma styles use the [same syntax](http://pygments.org/docs/styles/) as Pygments. + +All Pygments styles have been converted to Chroma using the `_tools/style.py` script. + +When you work with one of [Chroma's styles](https://github.com/alecthomas/chroma/tree/master/styles), know that the `chroma.Background` token type provides the default style for tokens. It does so by defining a foreground color and background color. + +For example, this gives each token name not defined in the style a default color of `#f8f8f8` and uses `#000000` for the highlighted code block's background: + +~~~go +chroma.Background: "#f8f8f2 bg:#000000", +~~~ + +Also, token types in a style file are hierarchical. For instance, when `CommentSpecial` is not defined, Chroma uses the token style from `Comment`. So when several comment tokens use the same color, you'll only need to define `Comment` and override the one that has a different color. + +For a quick overview of the available styles and how they look, check out the [Chroma Style Gallery](https://xyproto.github.io/splash/docs/). + + +## Command-line interface + +A command-line interface to Chroma is included. It can be installed with: + +```sh +go get -u github.com/alecthomas/chroma/cmd/chroma +``` + + +## What's missing compared to Pygments? + +- Quite a few lexers, for various reasons (pull-requests welcome): + - Pygments lexers for complex languages often include custom code to + handle certain aspects, such as Perl6's ability to nest code inside + regular expressions. These require time and effort to convert. + - I mostly only converted languages I had heard of, to reduce the porting cost. +- Some more esoteric features of Pygments are omitted for simplicity. +- Though the Chroma API supports content detection, very few languages support them. + I have plans to implement a statistical analyser at some point, but not enough time. diff --git a/vendor/github.com/alecthomas/chroma/coalesce.go b/vendor/github.com/alecthomas/chroma/coalesce.go new file mode 100644 index 000000000..f5048951a --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/coalesce.go @@ -0,0 +1,35 @@ +package chroma + +// Coalesce is a Lexer interceptor that collapses runs of common types into a single token. +func Coalesce(lexer Lexer) Lexer { return &coalescer{lexer} } + +type coalescer struct{ Lexer } + +func (d *coalescer) Tokenise(options *TokeniseOptions, text string) (Iterator, error) { + var prev Token + it, err := d.Lexer.Tokenise(options, text) + if err != nil { + return nil, err + } + return func() Token { + for token := it(); token != (EOF); token = it() { + if len(token.Value) == 0 { + continue + } + if prev == EOF { + prev = token + } else { + if prev.Type == token.Type && len(prev.Value) < 8192 { + prev.Value += token.Value + } else { + out := prev + prev = token + return out + } + } + } + out := prev + prev = EOF + return out + }, nil +} diff --git a/vendor/github.com/alecthomas/chroma/colour.go b/vendor/github.com/alecthomas/chroma/colour.go new file mode 100644 index 000000000..15d794ce2 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/colour.go @@ -0,0 +1,164 @@ +package chroma + +import ( + "fmt" + "math" + "strconv" + "strings" +) + +// ANSI2RGB maps ANSI colour names, as supported by Chroma, to hex RGB values. +var ANSI2RGB = map[string]string{ + "#ansiblack": "000000", + "#ansidarkred": "7f0000", + "#ansidarkgreen": "007f00", + "#ansibrown": "7f7fe0", + "#ansidarkblue": "00007f", + "#ansipurple": "7f007f", + "#ansiteal": "007f7f", + "#ansilightgray": "e5e5e5", + // Normal + "#ansidarkgray": "555555", + "#ansired": "ff0000", + "#ansigreen": "00ff00", + "#ansiyellow": "ffff00", + "#ansiblue": "0000ff", + "#ansifuchsia": "ff00ff", + "#ansiturquoise": "00ffff", + "#ansiwhite": "ffffff", + + // Aliases without the "ansi" prefix, because...why? + "#black": "000000", + "#darkred": "7f0000", + "#darkgreen": "007f00", + "#brown": "7f7fe0", + "#darkblue": "00007f", + "#purple": "7f007f", + "#teal": "007f7f", + "#lightgray": "e5e5e5", + // Normal + "#darkgray": "555555", + "#red": "ff0000", + "#green": "00ff00", + "#yellow": "ffff00", + "#blue": "0000ff", + "#fuchsia": "ff00ff", + "#turquoise": "00ffff", + "#white": "ffffff", +} + +// Colour represents an RGB colour. +type Colour int32 + +// NewColour creates a Colour directly from RGB values. +func NewColour(r, g, b uint8) Colour { + return ParseColour(fmt.Sprintf("%02x%02x%02x", r, g, b)) +} + +// Distance between this colour and another. +// +// This uses the approach described here (https://www.compuphase.com/cmetric.htm). +// This is not as accurate as LAB, et. al. but is *vastly* simpler and sufficient for our needs. +func (c Colour) Distance(e2 Colour) float64 { + ar, ag, ab := int64(c.Red()), int64(c.Green()), int64(c.Blue()) + br, bg, bb := int64(e2.Red()), int64(e2.Green()), int64(e2.Blue()) + rmean := (ar + br) / 2 + r := ar - br + g := ag - bg + b := ab - bb + return math.Sqrt(float64((((512 + rmean) * r * r) >> 8) + 4*g*g + (((767 - rmean) * b * b) >> 8))) +} + +// Brighten returns a copy of this colour with its brightness adjusted. +// +// If factor is negative, the colour is darkened. +// +// Uses approach described here (http://www.pvladov.com/2012/09/make-color-lighter-or-darker.html). +func (c Colour) Brighten(factor float64) Colour { + r := float64(c.Red()) + g := float64(c.Green()) + b := float64(c.Blue()) + + if factor < 0 { + factor++ + r *= factor + g *= factor + b *= factor + } else { + r = (255-r)*factor + r + g = (255-g)*factor + g + b = (255-b)*factor + b + } + return NewColour(uint8(r), uint8(g), uint8(b)) +} + +// BrightenOrDarken brightens a colour if it is < 0.5 brighteness or darkens if > 0.5 brightness. +func (c Colour) BrightenOrDarken(factor float64) Colour { + if c.Brightness() < 0.5 { + return c.Brighten(factor) + } + return c.Brighten(-factor) +} + +// Brightness of the colour (roughly) in the range 0.0 to 1.0 +func (c Colour) Brightness() float64 { + return (float64(c.Red()) + float64(c.Green()) + float64(c.Blue())) / 255.0 / 3.0 +} + +// ParseColour in the forms #rgb, #rrggbb, #ansi, or #. +// Will return an "unset" colour if invalid. +func ParseColour(colour string) Colour { + colour = normaliseColour(colour) + n, err := strconv.ParseUint(colour, 16, 32) + if err != nil { + return 0 + } + return Colour(n + 1) +} + +// MustParseColour is like ParseColour except it panics if the colour is invalid. +// +// Will panic if colour is in an invalid format. +func MustParseColour(colour string) Colour { + parsed := ParseColour(colour) + if !parsed.IsSet() { + panic(fmt.Errorf("invalid colour %q", colour)) + } + return parsed +} + +// IsSet returns true if the colour is set. +func (c Colour) IsSet() bool { return c != 0 } + +func (c Colour) String() string { return fmt.Sprintf("#%06x", int(c-1)) } +func (c Colour) GoString() string { return fmt.Sprintf("Colour(0x%06x)", int(c-1)) } + +// Red component of colour. +func (c Colour) Red() uint8 { return uint8(((c - 1) >> 16) & 0xff) } + +// Green component of colour. +func (c Colour) Green() uint8 { return uint8(((c - 1) >> 8) & 0xff) } + +// Blue component of colour. +func (c Colour) Blue() uint8 { return uint8((c - 1) & 0xff) } + +// Colours is an orderable set of colours. +type Colours []Colour + +func (c Colours) Len() int { return len(c) } +func (c Colours) Swap(i, j int) { c[i], c[j] = c[j], c[i] } +func (c Colours) Less(i, j int) bool { return c[i] < c[j] } + +// Convert colours to #rrggbb. +func normaliseColour(colour string) string { + if ansi, ok := ANSI2RGB[colour]; ok { + return ansi + } + if strings.HasPrefix(colour, "#") { + colour = colour[1:] + if len(colour) == 3 { + return colour[0:1] + colour[0:1] + colour[1:2] + colour[1:2] + colour[2:3] + colour[2:3] + } + } + return colour +} diff --git a/vendor/github.com/alecthomas/chroma/delegate.go b/vendor/github.com/alecthomas/chroma/delegate.go new file mode 100644 index 000000000..5cef01bd7 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/delegate.go @@ -0,0 +1,137 @@ +package chroma + +import ( + "bytes" +) + +type delegatingLexer struct { + root Lexer + language Lexer +} + +// DelegatingLexer combines two lexers to handle the common case of a language embedded inside another, such as PHP +// inside HTML or PHP inside plain text. +// +// It takes two lexer as arguments: a root lexer and a language lexer. First everything is scanned using the language +// lexer, which must return "Other" for unrecognised tokens. Then all "Other" tokens are lexed using the root lexer. +// Finally, these two sets of tokens are merged. +// +// The lexers from the template lexer package use this base lexer. +func DelegatingLexer(root Lexer, language Lexer) Lexer { + return &delegatingLexer{ + root: root, + language: language, + } +} + +func (d *delegatingLexer) Config() *Config { + return d.language.Config() +} + +// An insertion is the character range where language tokens should be inserted. +type insertion struct { + start, end int + tokens []Token +} + +func (d *delegatingLexer) Tokenise(options *TokeniseOptions, text string) (Iterator, error) { // nolint: gocognit + tokens, err := Tokenise(Coalesce(d.language), options, text) + if err != nil { + return nil, err + } + // Compute insertions and gather "Other" tokens. + others := &bytes.Buffer{} + insertions := []*insertion{} + var insert *insertion + offset := 0 + var last Token + for _, t := range tokens { + if t.Type == Other { + if last != EOF && insert != nil && last.Type != Other { + insert.end = offset + } + others.WriteString(t.Value) + } else { + if last == EOF || last.Type == Other { + insert = &insertion{start: offset} + insertions = append(insertions, insert) + } + insert.tokens = append(insert.tokens, t) + } + last = t + offset += len(t.Value) + } + + if len(insertions) == 0 { + return d.root.Tokenise(options, text) + } + + // Lex the other tokens. + rootTokens, err := Tokenise(Coalesce(d.root), options, others.String()) + if err != nil { + return nil, err + } + + // Interleave the two sets of tokens. + var out []Token + offset = 0 // Offset into text. + tokenIndex := 0 + nextToken := func() Token { + if tokenIndex >= len(rootTokens) { + return EOF + } + t := rootTokens[tokenIndex] + tokenIndex++ + return t + } + insertionIndex := 0 + nextInsertion := func() *insertion { + if insertionIndex >= len(insertions) { + return nil + } + i := insertions[insertionIndex] + insertionIndex++ + return i + } + t := nextToken() + i := nextInsertion() + for t != EOF || i != nil { + // fmt.Printf("%d->%d:%q %d->%d:%q\n", offset, offset+len(t.Value), t.Value, i.start, i.end, Stringify(i.tokens...)) + if t == EOF || (i != nil && i.start < offset+len(t.Value)) { + var l Token + l, t = splitToken(t, i.start-offset) + if l != EOF { + out = append(out, l) + offset += len(l.Value) + } + out = append(out, i.tokens...) + offset += i.end - i.start + if t == EOF { + t = nextToken() + } + i = nextInsertion() + } else { + out = append(out, t) + offset += len(t.Value) + t = nextToken() + } + } + return Literator(out...), nil +} + +func splitToken(t Token, offset int) (l Token, r Token) { + if t == EOF { + return EOF, EOF + } + if offset == 0 { + return EOF, t + } + if offset == len(t.Value) { + return t, EOF + } + l = t.Clone() + r = t.Clone() + l.Value = l.Value[:offset] + r.Value = r.Value[offset:] + return +} diff --git a/vendor/github.com/alecthomas/chroma/doc.go b/vendor/github.com/alecthomas/chroma/doc.go new file mode 100644 index 000000000..4dde77c81 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/doc.go @@ -0,0 +1,7 @@ +// Package chroma takes source code and other structured text and converts it into syntax highlighted HTML, ANSI- +// coloured text, etc. +// +// Chroma is based heavily on Pygments, and includes translators for Pygments lexers and styles. +// +// For more information, go here: https://github.com/alecthomas/chroma +package chroma diff --git a/vendor/github.com/alecthomas/chroma/formatter.go b/vendor/github.com/alecthomas/chroma/formatter.go new file mode 100644 index 000000000..00dd5d8df --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/formatter.go @@ -0,0 +1,43 @@ +package chroma + +import ( + "io" +) + +// A Formatter for Chroma lexers. +type Formatter interface { + // Format returns a formatting function for tokens. + // + // If the iterator panics, the Formatter should recover. + Format(w io.Writer, style *Style, iterator Iterator) error +} + +// A FormatterFunc is a Formatter implemented as a function. +// +// Guards against iterator panics. +type FormatterFunc func(w io.Writer, style *Style, iterator Iterator) error + +func (f FormatterFunc) Format(w io.Writer, s *Style, it Iterator) (err error) { // nolint + defer func() { + if perr := recover(); perr != nil { + err = perr.(error) + } + }() + return f(w, s, it) +} + +type recoveringFormatter struct { + Formatter +} + +func (r recoveringFormatter) Format(w io.Writer, s *Style, it Iterator) (err error) { + defer func() { + if perr := recover(); perr != nil { + err = perr.(error) + } + }() + return r.Formatter.Format(w, s, it) +} + +// RecoveringFormatter wraps a formatter with panic recovery. +func RecoveringFormatter(formatter Formatter) Formatter { return recoveringFormatter{formatter} } diff --git a/vendor/github.com/alecthomas/chroma/formatters/api.go b/vendor/github.com/alecthomas/chroma/formatters/api.go new file mode 100644 index 000000000..6da0a24cc --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/formatters/api.go @@ -0,0 +1,57 @@ +package formatters + +import ( + "io" + "sort" + + "github.com/alecthomas/chroma" + "github.com/alecthomas/chroma/formatters/html" + "github.com/alecthomas/chroma/formatters/svg" +) + +var ( + // NoOp formatter. + NoOp = Register("noop", chroma.FormatterFunc(func(w io.Writer, s *chroma.Style, iterator chroma.Iterator) error { + for t := iterator(); t != chroma.EOF; t = iterator() { + if _, err := io.WriteString(w, t.Value); err != nil { + return err + } + } + return nil + })) + // Default HTML formatter outputs self-contained HTML. + htmlFull = Register("html", html.New(html.Standalone(true), html.WithClasses(true))) // nolint + SVG = Register("svg", svg.New(svg.EmbedFont("Liberation Mono", svg.FontLiberationMono, svg.WOFF))) +) + +// Fallback formatter. +var Fallback = NoOp + +// Registry of Formatters. +var Registry = map[string]chroma.Formatter{} + +// Names of registered formatters. +func Names() []string { + out := []string{} + for name := range Registry { + out = append(out, name) + } + sort.Strings(out) + return out +} + +// Get formatter by name. +// +// If the given formatter is not found, the Fallback formatter will be returned. +func Get(name string) chroma.Formatter { + if f, ok := Registry[name]; ok { + return f + } + return Fallback +} + +// Register a named formatter. +func Register(name string, formatter chroma.Formatter) chroma.Formatter { + Registry[name] = formatter + return formatter +} diff --git a/vendor/github.com/alecthomas/chroma/formatters/html/html.go b/vendor/github.com/alecthomas/chroma/formatters/html/html.go new file mode 100644 index 000000000..d3fef2edf --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/formatters/html/html.go @@ -0,0 +1,435 @@ +package html + +import ( + "fmt" + "html" + "io" + "sort" + "strings" + + "github.com/alecthomas/chroma" +) + +// Option sets an option of the HTML formatter. +type Option func(f *Formatter) + +// Standalone configures the HTML formatter for generating a standalone HTML document. +func Standalone(b bool) Option { return func(f *Formatter) { f.standalone = b } } + +// ClassPrefix sets the CSS class prefix. +func ClassPrefix(prefix string) Option { return func(f *Formatter) { f.prefix = prefix } } + +// WithClasses emits HTML using CSS classes, rather than inline styles. +func WithClasses(b bool) Option { return func(f *Formatter) { f.Classes = b } } + +// TabWidth sets the number of characters for a tab. Defaults to 8. +func TabWidth(width int) Option { return func(f *Formatter) { f.tabWidth = width } } + +// PreventSurroundingPre prevents the surrounding pre tags around the generated code. +func PreventSurroundingPre(b bool) Option { + return func(f *Formatter) { + if b { + f.preWrapper = nopPreWrapper + } else { + f.preWrapper = defaultPreWrapper + } + } +} + +// WithPreWrapper allows control of the surrounding pre tags. +func WithPreWrapper(wrapper PreWrapper) Option { + return func(f *Formatter) { + f.preWrapper = wrapper + } +} + +// WithLineNumbers formats output with line numbers. +func WithLineNumbers(b bool) Option { + return func(f *Formatter) { + f.lineNumbers = b + } +} + +// LineNumbersInTable will, when combined with WithLineNumbers, separate the line numbers +// and code in table td's, which make them copy-and-paste friendly. +func LineNumbersInTable(b bool) Option { + return func(f *Formatter) { + f.lineNumbersInTable = b + } +} + +// LinkableLineNumbers decorates the line numbers HTML elements with an "id" +// attribute so they can be linked. +func LinkableLineNumbers(b bool, prefix string) Option { + return func(f *Formatter) { + f.linkableLineNumbers = b + f.lineNumbersIDPrefix = prefix + } +} + +// HighlightLines higlights the given line ranges with the Highlight style. +// +// A range is the beginning and ending of a range as 1-based line numbers, inclusive. +func HighlightLines(ranges [][2]int) Option { + return func(f *Formatter) { + f.highlightRanges = ranges + sort.Sort(f.highlightRanges) + } +} + +// BaseLineNumber sets the initial number to start line numbering at. Defaults to 1. +func BaseLineNumber(n int) Option { + return func(f *Formatter) { + f.baseLineNumber = n + } +} + +// New HTML formatter. +func New(options ...Option) *Formatter { + f := &Formatter{ + baseLineNumber: 1, + preWrapper: defaultPreWrapper, + } + for _, option := range options { + option(f) + } + return f +} + +// PreWrapper defines the operations supported in WithPreWrapper. +type PreWrapper interface { + // Start is called to write a start
 element.
+	// The code flag tells whether this block surrounds
+	// highlighted code. This will be false when surrounding
+	// line numbers.
+	Start(code bool, styleAttr string) string
+
+	// End is called to write the end 
element. + End(code bool) string +} + +type preWrapper struct { + start func(code bool, styleAttr string) string + end func(code bool) string +} + +func (p preWrapper) Start(code bool, styleAttr string) string { + return p.start(code, styleAttr) +} + +func (p preWrapper) End(code bool) string { + return p.end(code) +} + +var ( + nopPreWrapper = preWrapper{ + start: func(code bool, styleAttr string) string { return "" }, + end: func(code bool) string { return "" }, + } + defaultPreWrapper = preWrapper{ + start: func(code bool, styleAttr string) string { + return fmt.Sprintf("", styleAttr) + }, + end: func(code bool) string { + return "" + }, + } +) + +// Formatter that generates HTML. +type Formatter struct { + standalone bool + prefix string + Classes bool // Exported field to detect when classes are being used + preWrapper PreWrapper + tabWidth int + lineNumbers bool + lineNumbersInTable bool + linkableLineNumbers bool + lineNumbersIDPrefix string + highlightRanges highlightRanges + baseLineNumber int +} + +type highlightRanges [][2]int + +func (h highlightRanges) Len() int { return len(h) } +func (h highlightRanges) Swap(i, j int) { h[i], h[j] = h[j], h[i] } +func (h highlightRanges) Less(i, j int) bool { return h[i][0] < h[j][0] } + +func (f *Formatter) Format(w io.Writer, style *chroma.Style, iterator chroma.Iterator) (err error) { + return f.writeHTML(w, style, iterator.Tokens()) +} + +// We deliberately don't use html/template here because it is two orders of magnitude slower (benchmarked). +// +// OTOH we need to be super careful about correct escaping... +func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.Token) (err error) { // nolint: gocyclo + css := f.styleToCSS(style) + if !f.Classes { + for t, style := range css { + css[t] = compressStyle(style) + } + } + if f.standalone { + fmt.Fprint(w, "\n") + if f.Classes { + fmt.Fprint(w, "") + } + fmt.Fprintf(w, "\n", f.styleAttr(css, chroma.Background)) + } + + wrapInTable := f.lineNumbers && f.lineNumbersInTable + + lines := chroma.SplitTokensIntoLines(tokens) + lineDigits := len(fmt.Sprintf("%d", len(lines))) + highlightIndex := 0 + + if wrapInTable { + // List line numbers in its own + fmt.Fprintf(w, "\n", f.styleAttr(css, chroma.Background)) + fmt.Fprintf(w, "", f.styleAttr(css, chroma.LineTable)) + fmt.Fprintf(w, "\n", f.styleAttr(css, chroma.LineTableTD)) + fmt.Fprintf(w, f.preWrapper.Start(false, f.styleAttr(css, chroma.Background))) + for index := range lines { + line := f.baseLineNumber + index + highlight, next := f.shouldHighlight(highlightIndex, line) + if next { + highlightIndex++ + } + if highlight { + fmt.Fprintf(w, "", f.styleAttr(css, chroma.LineHighlight)) + } + + fmt.Fprintf(w, "%*d\n", f.styleAttr(css, chroma.LineNumbersTable), f.lineIDAttribute(line), lineDigits, line) + + if highlight { + fmt.Fprintf(w, "") + } + } + fmt.Fprint(w, f.preWrapper.End(false)) + fmt.Fprint(w, "\n") + fmt.Fprintf(w, "\n", f.styleAttr(css, chroma.LineTableTD, "width:100%")) + } + + fmt.Fprintf(w, f.preWrapper.Start(true, f.styleAttr(css, chroma.Background))) + + highlightIndex = 0 + for index, tokens := range lines { + // 1-based line number. + line := f.baseLineNumber + index + highlight, next := f.shouldHighlight(highlightIndex, line) + if next { + highlightIndex++ + } + if highlight { + fmt.Fprintf(w, "", f.styleAttr(css, chroma.LineHighlight)) + } + + if f.lineNumbers && !wrapInTable { + fmt.Fprintf(w, "%*d", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), lineDigits, line) + } + + for _, token := range tokens { + html := html.EscapeString(token.String()) + attr := f.styleAttr(css, token.Type) + if attr != "" { + html = fmt.Sprintf("%s", attr, html) + } + fmt.Fprint(w, html) + } + if highlight { + fmt.Fprintf(w, "") + } + } + + fmt.Fprintf(w, f.preWrapper.End(true)) + + if wrapInTable { + fmt.Fprint(w, "\n") + fmt.Fprint(w, "\n") + } + + if f.standalone { + fmt.Fprint(w, "\n\n") + fmt.Fprint(w, "\n") + } + + return nil +} + +func (f *Formatter) lineIDAttribute(line int) string { + if !f.linkableLineNumbers { + return "" + } + return fmt.Sprintf(" id=\"%s%d\"", f.lineNumbersIDPrefix, line) +} + +func (f *Formatter) shouldHighlight(highlightIndex, line int) (bool, bool) { + next := false + for highlightIndex < len(f.highlightRanges) && line > f.highlightRanges[highlightIndex][1] { + highlightIndex++ + next = true + } + if highlightIndex < len(f.highlightRanges) { + hrange := f.highlightRanges[highlightIndex] + if line >= hrange[0] && line <= hrange[1] { + return true, next + } + } + return false, next +} + +func (f *Formatter) class(t chroma.TokenType) string { + for t != 0 { + if cls, ok := chroma.StandardTypes[t]; ok { + if cls != "" { + return f.prefix + cls + } + return "" + } + t = t.Parent() + } + if cls := chroma.StandardTypes[t]; cls != "" { + return f.prefix + cls + } + return "" +} + +func (f *Formatter) styleAttr(styles map[chroma.TokenType]string, tt chroma.TokenType, extraCSS ...string) string { + if f.Classes { + cls := f.class(tt) + if cls == "" { + return "" + } + return fmt.Sprintf(` class="%s"`, cls) + } + if _, ok := styles[tt]; !ok { + tt = tt.SubCategory() + if _, ok := styles[tt]; !ok { + tt = tt.Category() + if _, ok := styles[tt]; !ok { + return "" + } + } + } + css := []string{styles[tt]} + css = append(css, extraCSS...) + return fmt.Sprintf(` style="%s"`, strings.Join(css, ";")) +} + +func (f *Formatter) tabWidthStyle() string { + if f.tabWidth != 0 && f.tabWidth != 8 { + return fmt.Sprintf("; -moz-tab-size: %[1]d; -o-tab-size: %[1]d; tab-size: %[1]d", f.tabWidth) + } + return "" +} + +// WriteCSS writes CSS style definitions (without any surrounding HTML). +func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error { + css := f.styleToCSS(style) + // Special-case background as it is mapped to the outer ".chroma" class. + if _, err := fmt.Fprintf(w, "/* %s */ .%schroma { %s }\n", chroma.Background, f.prefix, css[chroma.Background]); err != nil { + return err + } + // Special-case code column of table to expand width. + if f.lineNumbers && f.lineNumbersInTable { + if _, err := fmt.Fprintf(w, "/* %s */ .%schroma .%s:last-child { width: 100%%; }", + chroma.LineTableTD, f.prefix, f.class(chroma.LineTableTD)); err != nil { + return err + } + } + // Special-case line number highlighting when targeted. + if f.lineNumbers || f.lineNumbersInTable { + targetedLineCSS := StyleEntryToCSS(style.Get(chroma.LineHighlight)) + for _, tt := range []chroma.TokenType{chroma.LineNumbers, chroma.LineNumbersTable} { + fmt.Fprintf(w, "/* %s targeted by URL anchor */ .%schroma .%s:target { %s }\n", tt, f.prefix, f.class(tt), targetedLineCSS) + } + } + tts := []int{} + for tt := range css { + tts = append(tts, int(tt)) + } + sort.Ints(tts) + for _, ti := range tts { + tt := chroma.TokenType(ti) + if tt == chroma.Background { + continue + } + styles := css[tt] + if _, err := fmt.Fprintf(w, "/* %s */ .%schroma .%s { %s }\n", tt, f.prefix, f.class(tt), styles); err != nil { + return err + } + } + return nil +} + +func (f *Formatter) styleToCSS(style *chroma.Style) map[chroma.TokenType]string { + classes := map[chroma.TokenType]string{} + bg := style.Get(chroma.Background) + // Convert the style. + for t := range chroma.StandardTypes { + entry := style.Get(t) + if t != chroma.Background { + entry = entry.Sub(bg) + } + if entry.IsZero() { + continue + } + classes[t] = StyleEntryToCSS(entry) + } + classes[chroma.Background] += f.tabWidthStyle() + lineNumbersStyle := "margin-right: 0.4em; padding: 0 0.4em 0 0.4em;" + // All rules begin with default rules followed by user provided rules + classes[chroma.LineNumbers] = lineNumbersStyle + classes[chroma.LineNumbers] + classes[chroma.LineNumbersTable] = lineNumbersStyle + classes[chroma.LineNumbersTable] + classes[chroma.LineHighlight] = "display: block; width: 100%;" + classes[chroma.LineHighlight] + classes[chroma.LineTable] = "border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block;" + classes[chroma.LineTable] + classes[chroma.LineTableTD] = "vertical-align: top; padding: 0; margin: 0; border: 0;" + classes[chroma.LineTableTD] + return classes +} + +// StyleEntryToCSS converts a chroma.StyleEntry to CSS attributes. +func StyleEntryToCSS(e chroma.StyleEntry) string { + styles := []string{} + if e.Colour.IsSet() { + styles = append(styles, "color: "+e.Colour.String()) + } + if e.Background.IsSet() { + styles = append(styles, "background-color: "+e.Background.String()) + } + if e.Bold == chroma.Yes { + styles = append(styles, "font-weight: bold") + } + if e.Italic == chroma.Yes { + styles = append(styles, "font-style: italic") + } + if e.Underline == chroma.Yes { + styles = append(styles, "text-decoration: underline") + } + return strings.Join(styles, "; ") +} + +// Compress CSS attributes - remove spaces, transform 6-digit colours to 3. +func compressStyle(s string) string { + parts := strings.Split(s, ";") + out := []string{} + for _, p := range parts { + p = strings.Join(strings.Fields(p), " ") + p = strings.Replace(p, ": ", ":", 1) + if strings.Contains(p, "#") { + c := p[len(p)-6:] + if c[0] == c[1] && c[2] == c[3] && c[4] == c[5] { + p = p[:len(p)-6] + c[0:1] + c[2:3] + c[4:5] + } + } + out = append(out, p) + } + return strings.Join(out, ";") +} diff --git a/vendor/github.com/alecthomas/chroma/formatters/json.go b/vendor/github.com/alecthomas/chroma/formatters/json.go new file mode 100644 index 000000000..95df4bb67 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/formatters/json.go @@ -0,0 +1,31 @@ +package formatters + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/alecthomas/chroma" +) + +// JSON formatter outputs the raw token structures as JSON. +var JSON = Register("json", chroma.FormatterFunc(func(w io.Writer, s *chroma.Style, it chroma.Iterator) error { + fmt.Fprintln(w, "[") + i := 0 + for t := it(); t != chroma.EOF; t = it() { + if i > 0 { + fmt.Fprintln(w, ",") + } + i++ + bytes, err := json.Marshal(t) + if err != nil { + return err + } + if _, err := fmt.Fprint(w, " "+string(bytes)); err != nil { + return err + } + } + fmt.Fprintln(w) + fmt.Fprintln(w, "]") + return nil +})) diff --git a/vendor/github.com/alecthomas/chroma/formatters/svg/font_liberation_mono.go b/vendor/github.com/alecthomas/chroma/formatters/svg/font_liberation_mono.go new file mode 100644 index 000000000..70d692ec4 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/formatters/svg/font_liberation_mono.go @@ -0,0 +1,51 @@ +// Digitized data copyright (c) 2010 Google Corporation +// with Reserved Font Arimo, Tinos and Cousine. +// Copyright (c) 2012 Red Hat, Inc. +// with Reserved Font Name Liberation. +// +// This Font Software is licensed under the SIL Open Font License, Version 1.1. +// This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL +// +// ----------------------------------------------------------- +// SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +// ----------------------------------------------------------- +// +// PREAMBLE +// The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. +// +// The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. +// +// DEFINITIONS +// "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. +// +// "Reserved Font Name" refers to any names specified as such after the copyright statement(s). +// +// "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). +// +// "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. +// +// "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. +// +// PERMISSION & CONDITIONS +// Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: +// +// 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. +// +// 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. +// +// 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. +// +// 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. +// +// 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. +// +// TERMINATION +// This license becomes null and void if any of the above conditions are not met. +// +// DISCLAIMER +// THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. + +package svg + +// Liberation Mono as base64 encoded woff (SIL Open Font License)[https://en.wikipedia.org/wiki/Liberation_fonts] +var FontLiberationMono = `d09GRgABAAAAAqtYABIAAAAEycAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAKrPAAAABwAAAAcdooU5UdERUYAAp6sAAAAcAAAAIZxBHoIR1BPUwACoNwAAApfAAAzLnW/WuJHU1VCAAKfHAAAAb4AAALi0BntuE9TLzIAAAIQAAAAYAAAAGAAbrqGY21hcAAADmgAAARSAAAGPmw6RjVjdnQgAAAbpAAAAZ8AAAKuZwZtV2ZwZ20AABK8AAAEqQAAB7R+YbYRZ2FzcAACnpwAAAAQAAAAEAAYAAlnbHlmAAA0mAACOjQAA8hUF/4NBGhlYWQAAAGUAAAANgAAADYELjhMaGhlYQAAAcwAAAAhAAAAJAjCBstobXR4AAACcAAAC/UAACV4+gaVVWxvY2EAAB1EAAAXVAAAJXwSZmZ8bWF4cAAAAfAAAAAgAAAAIA3VBMBuYW1lAAJuzAAABTkAAAumb4o3f3Bvc3QAAnQIAAAqlAAAW+Bx9Ia5cHJlcAAAF2gAAAQ8AAAFesjzjI8AAQAAAAIAABUZ4O5fDzz1Ah8IAAAAAADIQ3qnAAAAANiiczX8Jf2ZBfEH2QAAAAgAAAABAAAAAHjaY2BkYGBb+XcmAwNr5B/VX1WsHxmAIsiAMw4AmuUGmAAAAAABAAAJXgEiAEgAWwAGAAIAEAAvAFwAAAO5AxEAAwABAAME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u8NXMF21cya8F8Do38v6uOsETOc/+DQX8HTuq5zpNhZ5/0b9HXxHAAAAAABAAAAANWkJwgAAAAAyEN6pwAAAADYonM1` diff --git a/vendor/github.com/alecthomas/chroma/formatters/svg/svg.go b/vendor/github.com/alecthomas/chroma/formatters/svg/svg.go new file mode 100644 index 000000000..631fa1484 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/formatters/svg/svg.go @@ -0,0 +1,222 @@ +// Package svg contains an SVG formatter. +package svg + +import ( + "encoding/base64" + "errors" + "fmt" + "io" + "io/ioutil" + "path" + "strings" + + "github.com/alecthomas/chroma" +) + +// Option sets an option of the SVG formatter. +type Option func(f *Formatter) + +// FontFamily sets the font-family. +func FontFamily(fontFamily string) Option { return func(f *Formatter) { f.fontFamily = fontFamily } } + +// EmbedFontFile embeds given font file +func EmbedFontFile(fontFamily string, fileName string) (option Option, err error) { + var format FontFormat + switch path.Ext(fileName) { + case ".woff": + format = WOFF + case ".woff2": + format = WOFF2 + case ".ttf": + format = TRUETYPE + default: + return nil, errors.New("unexpected font file suffix") + } + + var content []byte + if content, err = ioutil.ReadFile(fileName); err == nil { + option = EmbedFont(fontFamily, base64.StdEncoding.EncodeToString(content), format) + } + return +} + +// EmbedFont embeds given base64 encoded font +func EmbedFont(fontFamily string, font string, format FontFormat) Option { + return func(f *Formatter) { f.fontFamily = fontFamily; f.embeddedFont = font; f.fontFormat = format } +} + +// New SVG formatter. +func New(options ...Option) *Formatter { + f := &Formatter{fontFamily: "Consolas, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace"} + for _, option := range options { + option(f) + } + return f +} + +// Formatter that generates SVG. +type Formatter struct { + fontFamily string + embeddedFont string + fontFormat FontFormat +} + +func (f *Formatter) Format(w io.Writer, style *chroma.Style, iterator chroma.Iterator) (err error) { + f.writeSVG(w, style, iterator.Tokens()) + return err +} + +var svgEscaper = strings.NewReplacer( + `&`, "&", + `<`, "<", + `>`, ">", + `"`, """, + ` `, " ", + ` `, "    ", +) + +// EscapeString escapes special characters. +func escapeString(s string) string { + return svgEscaper.Replace(s) +} + +func (f *Formatter) writeSVG(w io.Writer, style *chroma.Style, tokens []chroma.Token) { // nolint: gocyclo + svgStyles := f.styleToSVG(style) + lines := chroma.SplitTokensIntoLines(tokens) + + fmt.Fprint(w, "\n") + fmt.Fprint(w, "\n") + fmt.Fprintf(w, "\n", 8*maxLineWidth(lines), 10+int(16.8*float64(len(lines)+1))) + + if f.embeddedFont != "" { + f.writeFontStyle(w) + } + + fmt.Fprintf(w, "\n", style.Get(chroma.Background).Background.String()) + fmt.Fprintf(w, "\n", f.fontFamily, style.Get(chroma.Text).Colour.String()) + + f.writeTokenBackgrounds(w, lines, style) + + for index, tokens := range lines { + fmt.Fprintf(w, "", 1.2*float64(index+1)) + + for _, token := range tokens { + text := escapeString(token.String()) + attr := f.styleAttr(svgStyles, token.Type) + if attr != "" { + text = fmt.Sprintf("%s", attr, text) + } + fmt.Fprint(w, text) + } + fmt.Fprint(w, "") + } + + fmt.Fprint(w, "\n\n") + fmt.Fprint(w, "\n") +} + +func maxLineWidth(lines [][]chroma.Token) int { + maxWidth := 0 + for _, tokens := range lines { + length := 0 + for _, token := range tokens { + length += len(strings.Replace(token.String(), ` `, " ", -1)) + } + if length > maxWidth { + maxWidth = length + } + } + return maxWidth +} + +// There is no background attribute for text in SVG so simply calculate the position and text +// of tokens with a background color that differs from the default and add a rectangle for each before +// adding the token. +func (f *Formatter) writeTokenBackgrounds(w io.Writer, lines [][]chroma.Token, style *chroma.Style) { + for index, tokens := range lines { + lineLength := 0 + for _, token := range tokens { + length := len(strings.Replace(token.String(), ` `, " ", -1)) + tokenBackground := style.Get(token.Type).Background + if tokenBackground.IsSet() && tokenBackground != style.Get(chroma.Background).Background { + fmt.Fprintf(w, "\n", escapeString(token.String()), lineLength, 1.2*float64(index)+0.25, length, style.Get(token.Type).Background.String()) + } + lineLength += length + } + } +} + +type FontFormat int + +// https://transfonter.org/formats +const ( + WOFF FontFormat = iota + WOFF2 + TRUETYPE +) + +var fontFormats = [...]string{ + "woff", + "woff2", + "truetype", +} + +func (f *Formatter) writeFontStyle(w io.Writer) { + fmt.Fprintf(w, ``, f.fontFamily, fontFormats[f.fontFormat], f.embeddedFont, fontFormats[f.fontFormat]) +} + +func (f *Formatter) styleAttr(styles map[chroma.TokenType]string, tt chroma.TokenType) string { + if _, ok := styles[tt]; !ok { + tt = tt.SubCategory() + if _, ok := styles[tt]; !ok { + tt = tt.Category() + if _, ok := styles[tt]; !ok { + return "" + } + } + } + return styles[tt] +} + +func (f *Formatter) styleToSVG(style *chroma.Style) map[chroma.TokenType]string { + converted := map[chroma.TokenType]string{} + bg := style.Get(chroma.Background) + // Convert the style. + for t := range chroma.StandardTypes { + entry := style.Get(t) + if t != chroma.Background { + entry = entry.Sub(bg) + } + if entry.IsZero() { + continue + } + converted[t] = StyleEntryToSVG(entry) + } + return converted +} + +// StyleEntryToSVG converts a chroma.StyleEntry to SVG attributes. +func StyleEntryToSVG(e chroma.StyleEntry) string { + var styles []string + + if e.Colour.IsSet() { + styles = append(styles, "fill=\""+e.Colour.String()+"\"") + } + if e.Bold == chroma.Yes { + styles = append(styles, "font-weight=\"bold\"") + } + if e.Italic == chroma.Yes { + styles = append(styles, "font-style=\"italic\"") + } + if e.Underline == chroma.Yes { + styles = append(styles, "text-decoration=\"underline\"") + } + return strings.Join(styles, " ") +} diff --git a/vendor/github.com/alecthomas/chroma/formatters/tokens.go b/vendor/github.com/alecthomas/chroma/formatters/tokens.go new file mode 100644 index 000000000..91d80d146 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/formatters/tokens.go @@ -0,0 +1,18 @@ +package formatters + +import ( + "fmt" + "io" + + "github.com/alecthomas/chroma" +) + +// Tokens formatter outputs the raw token structures. +var Tokens = Register("tokens", chroma.FormatterFunc(func(w io.Writer, s *chroma.Style, it chroma.Iterator) error { + for t := it(); t != chroma.EOF; t = it() { + if _, err := fmt.Fprintln(w, t.GoString()); err != nil { + return err + } + } + return nil +})) diff --git a/vendor/github.com/alecthomas/chroma/formatters/tty_indexed.go b/vendor/github.com/alecthomas/chroma/formatters/tty_indexed.go new file mode 100644 index 000000000..eb90ea7c0 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/formatters/tty_indexed.go @@ -0,0 +1,260 @@ +package formatters + +import ( + "fmt" + "io" + "math" + + "github.com/alecthomas/chroma" +) + +type ttyTable struct { + foreground map[chroma.Colour]string + background map[chroma.Colour]string +} + +var c = chroma.MustParseColour + +var ttyTables = map[int]*ttyTable{ + 8: { + foreground: map[chroma.Colour]string{ + c("#000000"): "\033[30m", c("#7f0000"): "\033[31m", c("#007f00"): "\033[32m", c("#7f7fe0"): "\033[33m", + c("#00007f"): "\033[34m", c("#7f007f"): "\033[35m", c("#007f7f"): "\033[36m", c("#e5e5e5"): "\033[37m", + c("#555555"): "\033[90m", c("#ff0000"): "\033[91m", c("#00ff00"): "\033[92m", c("#ffff00"): "\033[93m", + c("#0000ff"): "\033[94m", c("#ff00ff"): "\033[95m", c("#00ffff"): "\033[96m", c("#ffffff"): "\033[97m", + }, + background: map[chroma.Colour]string{ + c("#000000"): "\033[40m", c("#7f0000"): "\033[41m", c("#007f00"): "\033[42m", c("#7f7fe0"): "\033[43m", + c("#00007f"): "\033[44m", c("#7f007f"): "\033[45m", c("#007f7f"): "\033[46m", c("#e5e5e5"): "\033[47m", + c("#555555"): "\033[100m", c("#ff0000"): "\033[101m", c("#00ff00"): "\033[102m", c("#ffff00"): "\033[103m", + c("#0000ff"): "\033[104m", c("#ff00ff"): "\033[105m", c("#00ffff"): "\033[106m", c("#ffffff"): "\033[107m", + }, + }, + 256: { + foreground: map[chroma.Colour]string{ + c("#000000"): "\033[38;5;0m", c("#800000"): "\033[38;5;1m", c("#008000"): "\033[38;5;2m", c("#808000"): "\033[38;5;3m", + c("#000080"): "\033[38;5;4m", c("#800080"): "\033[38;5;5m", c("#008080"): "\033[38;5;6m", c("#c0c0c0"): "\033[38;5;7m", + c("#808080"): "\033[38;5;8m", c("#ff0000"): "\033[38;5;9m", c("#00ff00"): "\033[38;5;10m", c("#ffff00"): "\033[38;5;11m", + c("#0000ff"): "\033[38;5;12m", c("#ff00ff"): "\033[38;5;13m", c("#00ffff"): "\033[38;5;14m", c("#ffffff"): "\033[38;5;15m", + c("#000000"): "\033[38;5;16m", c("#00005f"): "\033[38;5;17m", c("#000087"): "\033[38;5;18m", c("#0000af"): "\033[38;5;19m", + c("#0000d7"): "\033[38;5;20m", c("#0000ff"): "\033[38;5;21m", c("#005f00"): "\033[38;5;22m", c("#005f5f"): "\033[38;5;23m", + c("#005f87"): "\033[38;5;24m", c("#005faf"): "\033[38;5;25m", c("#005fd7"): "\033[38;5;26m", c("#005fff"): "\033[38;5;27m", + c("#008700"): "\033[38;5;28m", c("#00875f"): "\033[38;5;29m", c("#008787"): "\033[38;5;30m", c("#0087af"): "\033[38;5;31m", + c("#0087d7"): "\033[38;5;32m", c("#0087ff"): "\033[38;5;33m", c("#00af00"): "\033[38;5;34m", c("#00af5f"): "\033[38;5;35m", + c("#00af87"): "\033[38;5;36m", c("#00afaf"): "\033[38;5;37m", c("#00afd7"): "\033[38;5;38m", c("#00afff"): "\033[38;5;39m", + c("#00d700"): "\033[38;5;40m", c("#00d75f"): "\033[38;5;41m", c("#00d787"): "\033[38;5;42m", c("#00d7af"): "\033[38;5;43m", + c("#00d7d7"): "\033[38;5;44m", c("#00d7ff"): "\033[38;5;45m", c("#00ff00"): "\033[38;5;46m", c("#00ff5f"): "\033[38;5;47m", + c("#00ff87"): "\033[38;5;48m", c("#00ffaf"): "\033[38;5;49m", c("#00ffd7"): "\033[38;5;50m", c("#00ffff"): "\033[38;5;51m", + c("#5f0000"): "\033[38;5;52m", c("#5f005f"): "\033[38;5;53m", c("#5f0087"): "\033[38;5;54m", c("#5f00af"): "\033[38;5;55m", + c("#5f00d7"): "\033[38;5;56m", c("#5f00ff"): "\033[38;5;57m", c("#5f5f00"): "\033[38;5;58m", c("#5f5f5f"): "\033[38;5;59m", + c("#5f5f87"): "\033[38;5;60m", c("#5f5faf"): "\033[38;5;61m", c("#5f5fd7"): "\033[38;5;62m", c("#5f5fff"): "\033[38;5;63m", + c("#5f8700"): "\033[38;5;64m", c("#5f875f"): "\033[38;5;65m", c("#5f8787"): "\033[38;5;66m", c("#5f87af"): "\033[38;5;67m", + c("#5f87d7"): "\033[38;5;68m", c("#5f87ff"): "\033[38;5;69m", c("#5faf00"): "\033[38;5;70m", c("#5faf5f"): "\033[38;5;71m", + c("#5faf87"): "\033[38;5;72m", c("#5fafaf"): "\033[38;5;73m", c("#5fafd7"): "\033[38;5;74m", c("#5fafff"): "\033[38;5;75m", + c("#5fd700"): "\033[38;5;76m", c("#5fd75f"): "\033[38;5;77m", c("#5fd787"): "\033[38;5;78m", c("#5fd7af"): "\033[38;5;79m", + c("#5fd7d7"): "\033[38;5;80m", c("#5fd7ff"): "\033[38;5;81m", c("#5fff00"): "\033[38;5;82m", c("#5fff5f"): "\033[38;5;83m", + c("#5fff87"): "\033[38;5;84m", c("#5fffaf"): "\033[38;5;85m", c("#5fffd7"): "\033[38;5;86m", c("#5fffff"): "\033[38;5;87m", + c("#870000"): "\033[38;5;88m", c("#87005f"): "\033[38;5;89m", c("#870087"): "\033[38;5;90m", c("#8700af"): "\033[38;5;91m", + c("#8700d7"): "\033[38;5;92m", c("#8700ff"): "\033[38;5;93m", c("#875f00"): "\033[38;5;94m", c("#875f5f"): "\033[38;5;95m", + c("#875f87"): "\033[38;5;96m", c("#875faf"): "\033[38;5;97m", c("#875fd7"): "\033[38;5;98m", c("#875fff"): "\033[38;5;99m", + c("#878700"): "\033[38;5;100m", c("#87875f"): "\033[38;5;101m", c("#878787"): "\033[38;5;102m", c("#8787af"): "\033[38;5;103m", + c("#8787d7"): "\033[38;5;104m", c("#8787ff"): "\033[38;5;105m", c("#87af00"): "\033[38;5;106m", c("#87af5f"): "\033[38;5;107m", + c("#87af87"): "\033[38;5;108m", c("#87afaf"): "\033[38;5;109m", c("#87afd7"): "\033[38;5;110m", c("#87afff"): "\033[38;5;111m", + c("#87d700"): "\033[38;5;112m", c("#87d75f"): "\033[38;5;113m", c("#87d787"): "\033[38;5;114m", c("#87d7af"): "\033[38;5;115m", + c("#87d7d7"): "\033[38;5;116m", c("#87d7ff"): "\033[38;5;117m", c("#87ff00"): "\033[38;5;118m", c("#87ff5f"): "\033[38;5;119m", + c("#87ff87"): "\033[38;5;120m", c("#87ffaf"): "\033[38;5;121m", c("#87ffd7"): "\033[38;5;122m", c("#87ffff"): "\033[38;5;123m", + c("#af0000"): "\033[38;5;124m", c("#af005f"): "\033[38;5;125m", c("#af0087"): "\033[38;5;126m", c("#af00af"): "\033[38;5;127m", + c("#af00d7"): "\033[38;5;128m", c("#af00ff"): "\033[38;5;129m", c("#af5f00"): "\033[38;5;130m", c("#af5f5f"): "\033[38;5;131m", + c("#af5f87"): "\033[38;5;132m", c("#af5faf"): "\033[38;5;133m", c("#af5fd7"): "\033[38;5;134m", c("#af5fff"): "\033[38;5;135m", + c("#af8700"): "\033[38;5;136m", c("#af875f"): "\033[38;5;137m", c("#af8787"): "\033[38;5;138m", c("#af87af"): "\033[38;5;139m", + c("#af87d7"): "\033[38;5;140m", c("#af87ff"): "\033[38;5;141m", c("#afaf00"): "\033[38;5;142m", c("#afaf5f"): "\033[38;5;143m", + c("#afaf87"): "\033[38;5;144m", c("#afafaf"): "\033[38;5;145m", c("#afafd7"): "\033[38;5;146m", c("#afafff"): "\033[38;5;147m", + c("#afd700"): "\033[38;5;148m", c("#afd75f"): "\033[38;5;149m", c("#afd787"): "\033[38;5;150m", c("#afd7af"): "\033[38;5;151m", + c("#afd7d7"): "\033[38;5;152m", c("#afd7ff"): "\033[38;5;153m", c("#afff00"): "\033[38;5;154m", c("#afff5f"): "\033[38;5;155m", + c("#afff87"): "\033[38;5;156m", c("#afffaf"): "\033[38;5;157m", c("#afffd7"): "\033[38;5;158m", c("#afffff"): "\033[38;5;159m", + c("#d70000"): "\033[38;5;160m", c("#d7005f"): "\033[38;5;161m", c("#d70087"): "\033[38;5;162m", c("#d700af"): "\033[38;5;163m", + c("#d700d7"): "\033[38;5;164m", c("#d700ff"): "\033[38;5;165m", c("#d75f00"): "\033[38;5;166m", c("#d75f5f"): "\033[38;5;167m", + c("#d75f87"): "\033[38;5;168m", c("#d75faf"): "\033[38;5;169m", c("#d75fd7"): "\033[38;5;170m", c("#d75fff"): "\033[38;5;171m", + c("#d78700"): "\033[38;5;172m", c("#d7875f"): "\033[38;5;173m", c("#d78787"): "\033[38;5;174m", c("#d787af"): "\033[38;5;175m", + c("#d787d7"): "\033[38;5;176m", c("#d787ff"): "\033[38;5;177m", c("#d7af00"): "\033[38;5;178m", c("#d7af5f"): "\033[38;5;179m", + c("#d7af87"): "\033[38;5;180m", c("#d7afaf"): "\033[38;5;181m", c("#d7afd7"): "\033[38;5;182m", c("#d7afff"): "\033[38;5;183m", + c("#d7d700"): "\033[38;5;184m", c("#d7d75f"): "\033[38;5;185m", c("#d7d787"): "\033[38;5;186m", c("#d7d7af"): "\033[38;5;187m", + c("#d7d7d7"): "\033[38;5;188m", c("#d7d7ff"): "\033[38;5;189m", c("#d7ff00"): "\033[38;5;190m", c("#d7ff5f"): "\033[38;5;191m", + c("#d7ff87"): "\033[38;5;192m", c("#d7ffaf"): "\033[38;5;193m", c("#d7ffd7"): "\033[38;5;194m", c("#d7ffff"): "\033[38;5;195m", + c("#ff0000"): "\033[38;5;196m", c("#ff005f"): "\033[38;5;197m", c("#ff0087"): "\033[38;5;198m", c("#ff00af"): "\033[38;5;199m", + c("#ff00d7"): "\033[38;5;200m", c("#ff00ff"): "\033[38;5;201m", c("#ff5f00"): "\033[38;5;202m", c("#ff5f5f"): "\033[38;5;203m", + c("#ff5f87"): "\033[38;5;204m", c("#ff5faf"): "\033[38;5;205m", c("#ff5fd7"): "\033[38;5;206m", c("#ff5fff"): "\033[38;5;207m", + c("#ff8700"): "\033[38;5;208m", c("#ff875f"): "\033[38;5;209m", c("#ff8787"): "\033[38;5;210m", c("#ff87af"): "\033[38;5;211m", + c("#ff87d7"): "\033[38;5;212m", c("#ff87ff"): "\033[38;5;213m", c("#ffaf00"): "\033[38;5;214m", c("#ffaf5f"): "\033[38;5;215m", + c("#ffaf87"): "\033[38;5;216m", c("#ffafaf"): "\033[38;5;217m", c("#ffafd7"): "\033[38;5;218m", c("#ffafff"): "\033[38;5;219m", + c("#ffd700"): "\033[38;5;220m", c("#ffd75f"): "\033[38;5;221m", c("#ffd787"): "\033[38;5;222m", c("#ffd7af"): "\033[38;5;223m", + c("#ffd7d7"): "\033[38;5;224m", c("#ffd7ff"): "\033[38;5;225m", c("#ffff00"): "\033[38;5;226m", c("#ffff5f"): "\033[38;5;227m", + c("#ffff87"): "\033[38;5;228m", c("#ffffaf"): "\033[38;5;229m", c("#ffffd7"): "\033[38;5;230m", c("#ffffff"): "\033[38;5;231m", + c("#080808"): "\033[38;5;232m", c("#121212"): "\033[38;5;233m", c("#1c1c1c"): "\033[38;5;234m", c("#262626"): "\033[38;5;235m", + c("#303030"): "\033[38;5;236m", c("#3a3a3a"): "\033[38;5;237m", c("#444444"): "\033[38;5;238m", c("#4e4e4e"): "\033[38;5;239m", + c("#585858"): "\033[38;5;240m", c("#626262"): "\033[38;5;241m", c("#6c6c6c"): "\033[38;5;242m", c("#767676"): "\033[38;5;243m", + c("#808080"): "\033[38;5;244m", c("#8a8a8a"): "\033[38;5;245m", c("#949494"): "\033[38;5;246m", c("#9e9e9e"): "\033[38;5;247m", + c("#a8a8a8"): "\033[38;5;248m", c("#b2b2b2"): "\033[38;5;249m", c("#bcbcbc"): "\033[38;5;250m", c("#c6c6c6"): "\033[38;5;251m", + c("#d0d0d0"): "\033[38;5;252m", c("#dadada"): "\033[38;5;253m", c("#e4e4e4"): "\033[38;5;254m", c("#eeeeee"): "\033[38;5;255m", + }, + background: map[chroma.Colour]string{ + c("#000000"): "\033[48;5;0m", c("#800000"): "\033[48;5;1m", c("#008000"): "\033[48;5;2m", c("#808000"): "\033[48;5;3m", + c("#000080"): "\033[48;5;4m", c("#800080"): "\033[48;5;5m", c("#008080"): "\033[48;5;6m", c("#c0c0c0"): "\033[48;5;7m", + c("#808080"): "\033[48;5;8m", c("#ff0000"): "\033[48;5;9m", c("#00ff00"): "\033[48;5;10m", c("#ffff00"): "\033[48;5;11m", + c("#0000ff"): "\033[48;5;12m", c("#ff00ff"): "\033[48;5;13m", c("#00ffff"): "\033[48;5;14m", c("#ffffff"): "\033[48;5;15m", + c("#000000"): "\033[48;5;16m", c("#00005f"): "\033[48;5;17m", c("#000087"): "\033[48;5;18m", c("#0000af"): "\033[48;5;19m", + c("#0000d7"): "\033[48;5;20m", c("#0000ff"): "\033[48;5;21m", c("#005f00"): "\033[48;5;22m", c("#005f5f"): "\033[48;5;23m", + c("#005f87"): "\033[48;5;24m", c("#005faf"): "\033[48;5;25m", c("#005fd7"): "\033[48;5;26m", c("#005fff"): "\033[48;5;27m", + c("#008700"): "\033[48;5;28m", c("#00875f"): "\033[48;5;29m", c("#008787"): "\033[48;5;30m", c("#0087af"): "\033[48;5;31m", + c("#0087d7"): "\033[48;5;32m", c("#0087ff"): "\033[48;5;33m", c("#00af00"): "\033[48;5;34m", c("#00af5f"): "\033[48;5;35m", + c("#00af87"): "\033[48;5;36m", c("#00afaf"): "\033[48;5;37m", c("#00afd7"): "\033[48;5;38m", c("#00afff"): "\033[48;5;39m", + c("#00d700"): "\033[48;5;40m", c("#00d75f"): "\033[48;5;41m", c("#00d787"): "\033[48;5;42m", c("#00d7af"): "\033[48;5;43m", + c("#00d7d7"): "\033[48;5;44m", c("#00d7ff"): "\033[48;5;45m", c("#00ff00"): "\033[48;5;46m", c("#00ff5f"): "\033[48;5;47m", + c("#00ff87"): "\033[48;5;48m", c("#00ffaf"): "\033[48;5;49m", c("#00ffd7"): "\033[48;5;50m", c("#00ffff"): "\033[48;5;51m", + c("#5f0000"): "\033[48;5;52m", c("#5f005f"): "\033[48;5;53m", c("#5f0087"): "\033[48;5;54m", c("#5f00af"): "\033[48;5;55m", + c("#5f00d7"): "\033[48;5;56m", c("#5f00ff"): "\033[48;5;57m", c("#5f5f00"): "\033[48;5;58m", c("#5f5f5f"): "\033[48;5;59m", + c("#5f5f87"): "\033[48;5;60m", c("#5f5faf"): "\033[48;5;61m", c("#5f5fd7"): "\033[48;5;62m", c("#5f5fff"): "\033[48;5;63m", + c("#5f8700"): "\033[48;5;64m", c("#5f875f"): "\033[48;5;65m", c("#5f8787"): "\033[48;5;66m", c("#5f87af"): "\033[48;5;67m", + c("#5f87d7"): "\033[48;5;68m", c("#5f87ff"): "\033[48;5;69m", c("#5faf00"): "\033[48;5;70m", c("#5faf5f"): "\033[48;5;71m", + c("#5faf87"): "\033[48;5;72m", c("#5fafaf"): "\033[48;5;73m", c("#5fafd7"): "\033[48;5;74m", c("#5fafff"): "\033[48;5;75m", + c("#5fd700"): "\033[48;5;76m", c("#5fd75f"): "\033[48;5;77m", c("#5fd787"): "\033[48;5;78m", c("#5fd7af"): "\033[48;5;79m", + c("#5fd7d7"): "\033[48;5;80m", c("#5fd7ff"): "\033[48;5;81m", c("#5fff00"): "\033[48;5;82m", c("#5fff5f"): "\033[48;5;83m", + c("#5fff87"): "\033[48;5;84m", c("#5fffaf"): "\033[48;5;85m", c("#5fffd7"): "\033[48;5;86m", c("#5fffff"): "\033[48;5;87m", + c("#870000"): "\033[48;5;88m", c("#87005f"): "\033[48;5;89m", c("#870087"): "\033[48;5;90m", c("#8700af"): "\033[48;5;91m", + c("#8700d7"): "\033[48;5;92m", c("#8700ff"): "\033[48;5;93m", c("#875f00"): "\033[48;5;94m", c("#875f5f"): "\033[48;5;95m", + c("#875f87"): "\033[48;5;96m", c("#875faf"): "\033[48;5;97m", c("#875fd7"): "\033[48;5;98m", c("#875fff"): "\033[48;5;99m", + c("#878700"): "\033[48;5;100m", c("#87875f"): "\033[48;5;101m", c("#878787"): "\033[48;5;102m", c("#8787af"): "\033[48;5;103m", + c("#8787d7"): "\033[48;5;104m", c("#8787ff"): "\033[48;5;105m", c("#87af00"): "\033[48;5;106m", c("#87af5f"): "\033[48;5;107m", + c("#87af87"): "\033[48;5;108m", c("#87afaf"): "\033[48;5;109m", c("#87afd7"): "\033[48;5;110m", c("#87afff"): "\033[48;5;111m", + c("#87d700"): "\033[48;5;112m", c("#87d75f"): "\033[48;5;113m", c("#87d787"): "\033[48;5;114m", c("#87d7af"): "\033[48;5;115m", + c("#87d7d7"): "\033[48;5;116m", c("#87d7ff"): "\033[48;5;117m", c("#87ff00"): "\033[48;5;118m", c("#87ff5f"): "\033[48;5;119m", + c("#87ff87"): "\033[48;5;120m", c("#87ffaf"): "\033[48;5;121m", c("#87ffd7"): "\033[48;5;122m", c("#87ffff"): "\033[48;5;123m", + c("#af0000"): "\033[48;5;124m", c("#af005f"): "\033[48;5;125m", c("#af0087"): "\033[48;5;126m", c("#af00af"): "\033[48;5;127m", + c("#af00d7"): "\033[48;5;128m", c("#af00ff"): "\033[48;5;129m", c("#af5f00"): "\033[48;5;130m", c("#af5f5f"): "\033[48;5;131m", + c("#af5f87"): "\033[48;5;132m", c("#af5faf"): "\033[48;5;133m", c("#af5fd7"): "\033[48;5;134m", c("#af5fff"): "\033[48;5;135m", + c("#af8700"): "\033[48;5;136m", c("#af875f"): "\033[48;5;137m", c("#af8787"): "\033[48;5;138m", c("#af87af"): "\033[48;5;139m", + c("#af87d7"): "\033[48;5;140m", c("#af87ff"): "\033[48;5;141m", c("#afaf00"): "\033[48;5;142m", c("#afaf5f"): "\033[48;5;143m", + c("#afaf87"): "\033[48;5;144m", c("#afafaf"): "\033[48;5;145m", c("#afafd7"): "\033[48;5;146m", c("#afafff"): "\033[48;5;147m", + c("#afd700"): "\033[48;5;148m", c("#afd75f"): "\033[48;5;149m", c("#afd787"): "\033[48;5;150m", c("#afd7af"): "\033[48;5;151m", + c("#afd7d7"): "\033[48;5;152m", c("#afd7ff"): "\033[48;5;153m", c("#afff00"): "\033[48;5;154m", c("#afff5f"): "\033[48;5;155m", + c("#afff87"): "\033[48;5;156m", c("#afffaf"): "\033[48;5;157m", c("#afffd7"): "\033[48;5;158m", c("#afffff"): "\033[48;5;159m", + c("#d70000"): "\033[48;5;160m", c("#d7005f"): "\033[48;5;161m", c("#d70087"): "\033[48;5;162m", c("#d700af"): "\033[48;5;163m", + c("#d700d7"): "\033[48;5;164m", c("#d700ff"): "\033[48;5;165m", c("#d75f00"): "\033[48;5;166m", c("#d75f5f"): "\033[48;5;167m", + c("#d75f87"): "\033[48;5;168m", c("#d75faf"): "\033[48;5;169m", c("#d75fd7"): "\033[48;5;170m", c("#d75fff"): "\033[48;5;171m", + c("#d78700"): "\033[48;5;172m", c("#d7875f"): "\033[48;5;173m", c("#d78787"): "\033[48;5;174m", c("#d787af"): "\033[48;5;175m", + c("#d787d7"): "\033[48;5;176m", c("#d787ff"): "\033[48;5;177m", c("#d7af00"): "\033[48;5;178m", c("#d7af5f"): "\033[48;5;179m", + c("#d7af87"): "\033[48;5;180m", c("#d7afaf"): "\033[48;5;181m", c("#d7afd7"): "\033[48;5;182m", c("#d7afff"): "\033[48;5;183m", + c("#d7d700"): "\033[48;5;184m", c("#d7d75f"): "\033[48;5;185m", c("#d7d787"): "\033[48;5;186m", c("#d7d7af"): "\033[48;5;187m", + c("#d7d7d7"): "\033[48;5;188m", c("#d7d7ff"): "\033[48;5;189m", c("#d7ff00"): "\033[48;5;190m", c("#d7ff5f"): "\033[48;5;191m", + c("#d7ff87"): "\033[48;5;192m", c("#d7ffaf"): "\033[48;5;193m", c("#d7ffd7"): "\033[48;5;194m", c("#d7ffff"): "\033[48;5;195m", + c("#ff0000"): "\033[48;5;196m", c("#ff005f"): "\033[48;5;197m", c("#ff0087"): "\033[48;5;198m", c("#ff00af"): "\033[48;5;199m", + c("#ff00d7"): "\033[48;5;200m", c("#ff00ff"): "\033[48;5;201m", c("#ff5f00"): "\033[48;5;202m", c("#ff5f5f"): "\033[48;5;203m", + c("#ff5f87"): "\033[48;5;204m", c("#ff5faf"): "\033[48;5;205m", c("#ff5fd7"): "\033[48;5;206m", c("#ff5fff"): "\033[48;5;207m", + c("#ff8700"): "\033[48;5;208m", c("#ff875f"): "\033[48;5;209m", c("#ff8787"): "\033[48;5;210m", c("#ff87af"): "\033[48;5;211m", + c("#ff87d7"): "\033[48;5;212m", c("#ff87ff"): "\033[48;5;213m", c("#ffaf00"): "\033[48;5;214m", c("#ffaf5f"): "\033[48;5;215m", + c("#ffaf87"): "\033[48;5;216m", c("#ffafaf"): "\033[48;5;217m", c("#ffafd7"): "\033[48;5;218m", c("#ffafff"): "\033[48;5;219m", + c("#ffd700"): "\033[48;5;220m", c("#ffd75f"): "\033[48;5;221m", c("#ffd787"): "\033[48;5;222m", c("#ffd7af"): "\033[48;5;223m", + c("#ffd7d7"): "\033[48;5;224m", c("#ffd7ff"): "\033[48;5;225m", c("#ffff00"): "\033[48;5;226m", c("#ffff5f"): "\033[48;5;227m", + c("#ffff87"): "\033[48;5;228m", c("#ffffaf"): "\033[48;5;229m", c("#ffffd7"): "\033[48;5;230m", c("#ffffff"): "\033[48;5;231m", + c("#080808"): "\033[48;5;232m", c("#121212"): "\033[48;5;233m", c("#1c1c1c"): "\033[48;5;234m", c("#262626"): "\033[48;5;235m", + c("#303030"): "\033[48;5;236m", c("#3a3a3a"): "\033[48;5;237m", c("#444444"): "\033[48;5;238m", c("#4e4e4e"): "\033[48;5;239m", + c("#585858"): "\033[48;5;240m", c("#626262"): "\033[48;5;241m", c("#6c6c6c"): "\033[48;5;242m", c("#767676"): "\033[48;5;243m", + c("#808080"): "\033[48;5;244m", c("#8a8a8a"): "\033[48;5;245m", c("#949494"): "\033[48;5;246m", c("#9e9e9e"): "\033[48;5;247m", + c("#a8a8a8"): "\033[48;5;248m", c("#b2b2b2"): "\033[48;5;249m", c("#bcbcbc"): "\033[48;5;250m", c("#c6c6c6"): "\033[48;5;251m", + c("#d0d0d0"): "\033[48;5;252m", c("#dadada"): "\033[48;5;253m", c("#e4e4e4"): "\033[48;5;254m", c("#eeeeee"): "\033[48;5;255m", + }, + }, +} + +func entryToEscapeSequence(table *ttyTable, entry chroma.StyleEntry) string { + out := "" + if entry.Bold == chroma.Yes { + out += "\033[1m" + } + if entry.Underline == chroma.Yes { + out += "\033[4m" + } + if entry.Italic == chroma.Yes { + out += "\033[3m" + } + if entry.Colour.IsSet() { + out += table.foreground[findClosest(table, entry.Colour)] + } + if entry.Background.IsSet() { + out += table.background[findClosest(table, entry.Background)] + } + return out +} + +func findClosest(table *ttyTable, seeking chroma.Colour) chroma.Colour { + closestColour := chroma.Colour(0) + closest := float64(math.MaxFloat64) + for colour := range table.foreground { + distance := colour.Distance(seeking) + if distance < closest { + closest = distance + closestColour = colour + } + } + return closestColour +} + +func styleToEscapeSequence(table *ttyTable, style *chroma.Style) map[chroma.TokenType]string { + style = clearBackground(style) + out := map[chroma.TokenType]string{} + for _, ttype := range style.Types() { + entry := style.Get(ttype) + out[ttype] = entryToEscapeSequence(table, entry) + } + return out +} + +// Clear the background colour. +func clearBackground(style *chroma.Style) *chroma.Style { + builder := style.Builder() + bg := builder.Get(chroma.Background) + bg.Background = 0 + bg.NoInherit = true + builder.AddEntry(chroma.Background, bg) + style, _ = builder.Build() + return style +} + +type indexedTTYFormatter struct { + table *ttyTable +} + +func (c *indexedTTYFormatter) Format(w io.Writer, style *chroma.Style, it chroma.Iterator) (err error) { + theme := styleToEscapeSequence(c.table, style) + for token := it(); token != chroma.EOF; token = it() { + // TODO: Cache token lookups? + clr, ok := theme[token.Type] + if !ok { + clr, ok = theme[token.Type.SubCategory()] + if !ok { + clr = theme[token.Type.Category()] + // if !ok { + // clr = theme[chroma.InheritStyle] + // } + } + } + if clr != "" { + fmt.Fprint(w, clr) + } + fmt.Fprint(w, token.Value) + if clr != "" { + fmt.Fprintf(w, "\033[0m") + } + } + return nil +} + +// TTY8 is an 8-colour terminal formatter. +// +// The Lab colour space is used to map RGB values to the most appropriate index colour. +var TTY8 = Register("terminal", &indexedTTYFormatter{ttyTables[8]}) + +// TTY256 is a 256-colour terminal formatter. +// +// The Lab colour space is used to map RGB values to the most appropriate index colour. +var TTY256 = Register("terminal256", &indexedTTYFormatter{ttyTables[256]}) diff --git a/vendor/github.com/alecthomas/chroma/formatters/tty_truecolour.go b/vendor/github.com/alecthomas/chroma/formatters/tty_truecolour.go new file mode 100644 index 000000000..b02e6360e --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/formatters/tty_truecolour.go @@ -0,0 +1,42 @@ +package formatters + +import ( + "fmt" + "io" + + "github.com/alecthomas/chroma" +) + +// TTY16m is a true-colour terminal formatter. +var TTY16m = Register("terminal16m", chroma.FormatterFunc(trueColourFormatter)) + +func trueColourFormatter(w io.Writer, style *chroma.Style, it chroma.Iterator) error { + style = clearBackground(style) + for token := it(); token != chroma.EOF; token = it() { + entry := style.Get(token.Type) + if !entry.IsZero() { + out := "" + if entry.Bold == chroma.Yes { + out += "\033[1m" + } + if entry.Underline == chroma.Yes { + out += "\033[4m" + } + if entry.Italic == chroma.Yes { + out += "\033[3m" + } + if entry.Colour.IsSet() { + out += fmt.Sprintf("\033[38;2;%d;%d;%dm", entry.Colour.Red(), entry.Colour.Green(), entry.Colour.Blue()) + } + if entry.Background.IsSet() { + out += fmt.Sprintf("\033[48;2;%d;%d;%dm", entry.Background.Red(), entry.Background.Green(), entry.Background.Blue()) + } + fmt.Fprint(w, out) + } + fmt.Fprint(w, token.Value) + if !entry.IsZero() { + fmt.Fprint(w, "\033[0m") + } + } + return nil +} diff --git a/vendor/github.com/alecthomas/chroma/iterator.go b/vendor/github.com/alecthomas/chroma/iterator.go new file mode 100644 index 000000000..c8845a1f5 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/iterator.go @@ -0,0 +1,76 @@ +package chroma + +import "strings" + +// An Iterator across tokens. +// +// nil will be returned at the end of the Token stream. +// +// If an error occurs within an Iterator, it may propagate this in a panic. Formatters should recover. +type Iterator func() Token + +// Tokens consumes all tokens from the iterator and returns them as a slice. +func (i Iterator) Tokens() []Token { + var out []Token + for t := i(); t != EOF; t = i() { + out = append(out, t) + } + return out +} + +// Concaterator concatenates tokens from a series of iterators. +func Concaterator(iterators ...Iterator) Iterator { + return func() Token { + for len(iterators) > 0 { + t := iterators[0]() + if t != EOF { + return t + } + iterators = iterators[1:] + } + return EOF + } +} + +// Literator converts a sequence of literal Tokens into an Iterator. +func Literator(tokens ...Token) Iterator { + return func() Token { + if len(tokens) == 0 { + return EOF + } + token := tokens[0] + tokens = tokens[1:] + return token + } +} + +// SplitTokensIntoLines splits tokens containing newlines in two. +func SplitTokensIntoLines(tokens []Token) (out [][]Token) { + var line []Token // nolint: prealloc + for _, token := range tokens { + for strings.Contains(token.Value, "\n") { + parts := strings.SplitAfterN(token.Value, "\n", 2) + // Token becomes the tail. + token.Value = parts[1] + + // Append the head to the line and flush the line. + clone := token.Clone() + clone.Value = parts[0] + line = append(line, clone) + out = append(out, line) + line = nil + } + line = append(line, token) + } + if len(line) > 0 { + out = append(out, line) + } + // Strip empty trailing token line. + if len(out) > 0 { + last := out[len(out)-1] + if len(last) == 1 && last[0].Value == "" { + out = out[:len(out)-1] + } + } + return +} diff --git a/vendor/github.com/alecthomas/chroma/lexer.go b/vendor/github.com/alecthomas/chroma/lexer.go new file mode 100644 index 000000000..a6ae84b2b --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexer.go @@ -0,0 +1,120 @@ +package chroma + +import ( + "fmt" +) + +var ( + defaultOptions = &TokeniseOptions{ + State: "root", + } +) + +// Config for a lexer. +type Config struct { + // Name of the lexer. + Name string + + // Shortcuts for the lexer + Aliases []string + + // File name globs + Filenames []string + + // Secondary file name globs + AliasFilenames []string + + // MIME types + MimeTypes []string + + // Regex matching is case-insensitive. + CaseInsensitive bool + + // Regex matches all characters. + DotAll bool + + // Regex does not match across lines ($ matches EOL). + // + // Defaults to multiline. + NotMultiline bool + + // Don't strip leading and trailing newlines from the input. + // DontStripNL bool + + // Strip all leading and trailing whitespace from the input + // StripAll bool + + // Make sure that the input ends with a newline. This + // is required for some lexers that consume input linewise. + EnsureNL bool + + // If given and greater than 0, expand tabs in the input. + // TabSize int + + // Priority of lexer. + // + // If this is 0 it will be treated as a default of 1. + Priority float32 +} + +// Token output to formatter. +type Token struct { + Type TokenType `json:"type"` + Value string `json:"value"` +} + +func (t *Token) String() string { return t.Value } +func (t *Token) GoString() string { return fmt.Sprintf("&Token{%s, %q}", t.Type, t.Value) } + +// Clone returns a clone of the Token. +func (t *Token) Clone() Token { + return *t +} + +// EOF is returned by lexers at the end of input. +var EOF Token + +// TokeniseOptions contains options for tokenisers. +type TokeniseOptions struct { + // State to start tokenisation in. Defaults to "root". + State string + // Nested tokenisation. + Nested bool +} + +// A Lexer for tokenising source code. +type Lexer interface { + // Config describing the features of the Lexer. + Config() *Config + // Tokenise returns an Iterator over tokens in text. + Tokenise(options *TokeniseOptions, text string) (Iterator, error) +} + +// Lexers is a slice of lexers sortable by name. +type Lexers []Lexer + +func (l Lexers) Len() int { return len(l) } +func (l Lexers) Swap(i, j int) { l[i], l[j] = l[j], l[i] } +func (l Lexers) Less(i, j int) bool { return l[i].Config().Name < l[j].Config().Name } + +// PrioritisedLexers is a slice of lexers sortable by priority. +type PrioritisedLexers []Lexer + +func (l PrioritisedLexers) Len() int { return len(l) } +func (l PrioritisedLexers) Swap(i, j int) { l[i], l[j] = l[j], l[i] } +func (l PrioritisedLexers) Less(i, j int) bool { + ip := l[i].Config().Priority + if ip == 0 { + ip = 1 + } + jp := l[j].Config().Priority + if jp == 0 { + jp = 1 + } + return ip > jp +} + +// Analyser determines how appropriate this lexer is for the given text. +type Analyser interface { + AnalyseText(text string) float32 +} diff --git a/vendor/github.com/alecthomas/chroma/lexers/README.md b/vendor/github.com/alecthomas/chroma/lexers/README.md new file mode 100644 index 000000000..2421710ef --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/README.md @@ -0,0 +1,37 @@ +# Lexer tests + +The tests in this directory feed a known input `testdata/.actual` into the parser for `` and check +that its output matches `.exported`. + +## Running the tests + +Run the tests as normal: +```go +go test ./lexers +``` + +## Update existing tests +When you add a new test data file (`*.actual`), you need to regenerate all tests. That's how Chroma creates the `*.expected` test file based on the corresponding lexer. + +To regenerate all tests, type in your terminal: + +```go +RECORD=true go test ./lexers +``` + +This first sets the `RECORD` environment variable to `true`. Then it runs `go test` on the `./lexers` directory of the Chroma project. + +(That environment variable tells Chroma it needs to output test data. After running `go test ./lexers` you can remove or reset that variable.) + +### Windows users +Windows users will find that the `RECORD=true go test ./lexers` command fails in both the standard command prompt terminal and in PowerShell. + +Instead we have to perform both steps separately: + +- Set the `RECORD` environment variable to `true`. + + In the regular command prompt window, the `set` command sets an environment variable for the current session: `set RECORD=true`. See [this page](https://superuser.com/questions/212150/how-to-set-env-variable-in-windows-cmd-line) for more. + + In PowerShell, you can use the `$env:RECORD = 'true'` command for that. See [this article](https://mcpmag.com/articles/2019/03/28/environment-variables-in-powershell.aspx) for more. + + You can also make a persistent environment variable by hand in the Windows computer settings. See [this article](https://www.computerhope.com/issues/ch000549.htm) for how. +- When the environment variable is set, run `go tests ./lexers`. + +Chroma will now regenerate the test files and print its results to the console window. diff --git a/vendor/github.com/alecthomas/chroma/lexers/a/abap.go b/vendor/github.com/alecthomas/chroma/lexers/a/abap.go new file mode 100644 index 000000000..61c294e04 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/a/abap.go @@ -0,0 +1,56 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// ABAP lexer. +var Abap = internal.Register(MustNewLexer( + &Config{ + Name: "ABAP", + Aliases: []string{"abap"}, + Filenames: []string{"*.abap", "*.ABAP"}, + MimeTypes: []string{"text/x-abap"}, + CaseInsensitive: true, + }, + Rules{ + "common": { + {`\s+`, Text, nil}, + {`^\*.*$`, CommentSingle, nil}, + {`\".*?\n`, CommentSingle, nil}, + {`##\w+`, CommentSpecial, nil}, + }, + "variable-names": { + {`<\S+>`, NameVariable, nil}, + {`\w[\w~]*(?:(\[\])|->\*)?`, NameVariable, nil}, + }, + "root": { + Include("common"), + {`CALL\s+(?:BADI|CUSTOMER-FUNCTION|FUNCTION)`, Keyword, nil}, + {`(CALL\s+(?:DIALOG|SCREEN|SUBSCREEN|SELECTION-SCREEN|TRANSACTION|TRANSFORMATION))\b`, Keyword, nil}, + {`(FORM|PERFORM)(\s+)(\w+)`, ByGroups(Keyword, Text, NameFunction), nil}, + {`(PERFORM)(\s+)(\()(\w+)(\))`, ByGroups(Keyword, Text, Punctuation, NameVariable, Punctuation), nil}, + {`(MODULE)(\s+)(\S+)(\s+)(INPUT|OUTPUT)`, ByGroups(Keyword, Text, NameFunction, Text, Keyword), nil}, + {`(METHOD)(\s+)([\w~]+)`, ByGroups(Keyword, Text, NameFunction), nil}, + {`(\s+)([\w\-]+)([=\-]>)([\w\-~]+)`, ByGroups(Text, NameVariable, Operator, NameFunction), nil}, + {`(?<=(=|-)>)([\w\-~]+)(?=\()`, NameFunction, nil}, + {`(TEXT)(-)(\d{3})`, ByGroups(Keyword, Punctuation, LiteralNumberInteger), nil}, + {`(TEXT)(-)(\w{3})`, ByGroups(Keyword, Punctuation, NameVariable), nil}, + {`(ADD-CORRESPONDING|AUTHORITY-CHECK|CLASS-DATA|CLASS-EVENTS|CLASS-METHODS|CLASS-POOL|DELETE-ADJACENT|DIVIDE-CORRESPONDING|EDITOR-CALL|ENHANCEMENT-POINT|ENHANCEMENT-SECTION|EXIT-COMMAND|FIELD-GROUPS|FIELD-SYMBOLS|FUNCTION-POOL|INTERFACE-POOL|INVERTED-DATE|LOAD-OF-PROGRAM|LOG-POINT|MESSAGE-ID|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|NEW-LINE|NEW-PAGE|NEW-SECTION|NO-EXTENSION|OUTPUT-LENGTH|PRINT-CONTROL|SELECT-OPTIONS|START-OF-SELECTION|SUBTRACT-CORRESPONDING|SYNTAX-CHECK|SYSTEM-EXCEPTIONS|TYPE-POOL|TYPE-POOLS|NO-DISPLAY)\b`, Keyword, nil}, + {`(?])(CREATE\s+(PUBLIC|PRIVATE|DATA|OBJECT)|(PUBLIC|PRIVATE|PROTECTED)\s+SECTION|(TYPE|LIKE)\s+((LINE\s+OF|REF\s+TO|(SORTED|STANDARD|HASHED)\s+TABLE\s+OF))?|FROM\s+(DATABASE|MEMORY)|CALL\s+METHOD|(GROUP|ORDER) BY|HAVING|SEPARATED BY|GET\s+(BADI|BIT|CURSOR|DATASET|LOCALE|PARAMETER|PF-STATUS|(PROPERTY|REFERENCE)\s+OF|RUN\s+TIME|TIME\s+(STAMP)?)?|SET\s+(BIT|BLANK\s+LINES|COUNTRY|CURSOR|DATASET|EXTENDED\s+CHECK|HANDLER|HOLD\s+DATA|LANGUAGE|LEFT\s+SCROLL-BOUNDARY|LOCALE|MARGIN|PARAMETER|PF-STATUS|PROPERTY\s+OF|RUN\s+TIME\s+(ANALYZER|CLOCK\s+RESOLUTION)|SCREEN|TITLEBAR|UPADTE\s+TASK\s+LOCAL|USER-COMMAND)|CONVERT\s+((INVERTED-)?DATE|TIME|TIME\s+STAMP|TEXT)|(CLOSE|OPEN)\s+(DATASET|CURSOR)|(TO|FROM)\s+(DATA BUFFER|INTERNAL TABLE|MEMORY ID|DATABASE|SHARED\s+(MEMORY|BUFFER))|DESCRIBE\s+(DISTANCE\s+BETWEEN|FIELD|LIST|TABLE)|FREE\s(MEMORY|OBJECT)?|PROCESS\s+(BEFORE\s+OUTPUT|AFTER\s+INPUT|ON\s+(VALUE-REQUEST|HELP-REQUEST))|AT\s+(LINE-SELECTION|USER-COMMAND|END\s+OF|NEW)|AT\s+SELECTION-SCREEN(\s+(ON(\s+(BLOCK|(HELP|VALUE)-REQUEST\s+FOR|END\s+OF|RADIOBUTTON\s+GROUP))?|OUTPUT))?|SELECTION-SCREEN:?\s+((BEGIN|END)\s+OF\s+((TABBED\s+)?BLOCK|LINE|SCREEN)|COMMENT|FUNCTION\s+KEY|INCLUDE\s+BLOCKS|POSITION|PUSHBUTTON|SKIP|ULINE)|LEAVE\s+(LIST-PROCESSING|PROGRAM|SCREEN|TO LIST-PROCESSING|TO TRANSACTION)(ENDING|STARTING)\s+AT|FORMAT\s+(COLOR|INTENSIFIED|INVERSE|HOTSPOT|INPUT|FRAMES|RESET)|AS\s+(CHECKBOX|SUBSCREEN|WINDOW)|WITH\s+(((NON-)?UNIQUE)?\s+KEY|FRAME)|(BEGIN|END)\s+OF|DELETE(\s+ADJACENT\s+DUPLICATES\sFROM)?|COMPARING(\s+ALL\s+FIELDS)?|(INSERT|APPEND)(\s+INITIAL\s+LINE\s+(IN)?TO|\s+LINES\s+OF)?|IN\s+((BYTE|CHARACTER)\s+MODE|PROGRAM)|END-OF-(DEFINITION|PAGE|SELECTION)|WITH\s+FRAME(\s+TITLE)|(REPLACE|FIND)\s+((FIRST|ALL)\s+OCCURRENCES?\s+OF\s+)?(SUBSTRING|REGEX)?|MATCH\s+(LENGTH|COUNT|LINE|OFFSET)|(RESPECTING|IGNORING)\s+CASE|IN\s+UPDATE\s+TASK|(SOURCE|RESULT)\s+(XML)?|REFERENCE\s+INTO|AND\s+(MARK|RETURN)|CLIENT\s+SPECIFIED|CORRESPONDING\s+FIELDS\s+OF|IF\s+FOUND|FOR\s+EVENT|INHERITING\s+FROM|LEAVE\s+TO\s+SCREEN|LOOP\s+AT\s+(SCREEN)?|LOWER\s+CASE|MATCHCODE\s+OBJECT|MODIF\s+ID|MODIFY\s+SCREEN|NESTING\s+LEVEL|NO\s+INTERVALS|OF\s+STRUCTURE|RADIOBUTTON\s+GROUP|RANGE\s+OF|REF\s+TO|SUPPRESS DIALOG|TABLE\s+OF|UPPER\s+CASE|TRANSPORTING\s+NO\s+FIELDS|VALUE\s+CHECK|VISIBLE\s+LENGTH|HEADER\s+LINE|COMMON\s+PART)\b`, Keyword, nil}, + {`(^|(?<=(\s|\.)))(ABBREVIATED|ABSTRACT|ADD|ALIASES|ALIGN|ALPHA|ASSERT|AS|ASSIGN(ING)?|AT(\s+FIRST)?|BACK|BLOCK|BREAK-POINT|CASE|CATCH|CHANGING|CHECK|CLASS|CLEAR|COLLECT|COLOR|COMMIT|CREATE|COMMUNICATION|COMPONENTS?|COMPUTE|CONCATENATE|CONDENSE|CONSTANTS|CONTEXTS|CONTINUE|CONTROLS|COUNTRY|CURRENCY|DATA|DATE|DECIMALS|DEFAULT|DEFINE|DEFINITION|DEFERRED|DEMAND|DETAIL|DIRECTORY|DIVIDE|DO|DUMMY|ELSE(IF)?|ENDAT|ENDCASE|ENDCATCH|ENDCLASS|ENDDO|ENDFORM|ENDFUNCTION|ENDIF|ENDINTERFACE|ENDLOOP|ENDMETHOD|ENDMODULE|ENDSELECT|ENDTRY|ENDWHILE|ENHANCEMENT|EVENTS|EXACT|EXCEPTIONS?|EXIT|EXPONENT|EXPORT|EXPORTING|EXTRACT|FETCH|FIELDS?|FOR|FORM|FORMAT|FREE|FROM|FUNCTION|HIDE|ID|IF|IMPORT|IMPLEMENTATION|IMPORTING|IN|INCLUDE|INCLUDING|INDEX|INFOTYPES|INITIALIZATION|INTERFACE|INTERFACES|INTO|LANGUAGE|LEAVE|LENGTH|LINES|LOAD|LOCAL|JOIN|KEY|NEXT|MAXIMUM|MESSAGE|METHOD[S]?|MINIMUM|MODULE|MODIFIER|MODIFY|MOVE|MULTIPLY|NODES|NUMBER|OBLIGATORY|OBJECT|OF|OFF|ON|OTHERS|OVERLAY|PACK|PAD|PARAMETERS|PERCENTAGE|POSITION|PROGRAM|PROVIDE|PUBLIC|PUT|PF\d\d|RAISE|RAISING|RANGES?|READ|RECEIVE|REDEFINITION|REFRESH|REJECT|REPORT|RESERVE|RESUME|RETRY|RETURN|RETURNING|RIGHT|ROLLBACK|REPLACE|SCROLL|SEARCH|SELECT|SHIFT|SIGN|SINGLE|SIZE|SKIP|SORT|SPLIT|STATICS|STOP|STYLE|SUBMATCHES|SUBMIT|SUBTRACT|SUM(?!\()|SUMMARY|SUMMING|SUPPLY|TABLE|TABLES|TIMESTAMP|TIMES?|TIMEZONE|TITLE|\??TO|TOP-OF-PAGE|TRANSFER|TRANSLATE|TRY|TYPES|ULINE|UNDER|UNPACK|UPDATE|USING|VALUE|VALUES|VIA|VARYING|VARY|WAIT|WHEN|WHERE|WIDTH|WHILE|WITH|WINDOW|WRITE|XSD|ZERO)\b`, Keyword, nil}, + {`(abs|acos|asin|atan|boolc|boolx|bit_set|char_off|charlen|ceil|cmax|cmin|condense|contains|contains_any_of|contains_any_not_of|concat_lines_of|cos|cosh|count|count_any_of|count_any_not_of|dbmaxlen|distance|escape|exp|find|find_end|find_any_of|find_any_not_of|floor|frac|from_mixed|insert|lines|log|log10|match|matches|nmax|nmin|numofchar|repeat|replace|rescale|reverse|round|segment|shift_left|shift_right|sign|sin|sinh|sqrt|strlen|substring|substring_after|substring_from|substring_before|substring_to|tan|tanh|to_upper|to_lower|to_mixed|translate|trunc|xstrlen)(\()\b`, ByGroups(NameBuiltin, Punctuation), nil}, + {`&[0-9]`, Name, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`(?<=(\s|.))(AND|OR|EQ|NE|GT|LT|GE|LE|CO|CN|CA|NA|CS|NOT|NS|CP|NP|BYTE-CO|BYTE-CN|BYTE-CA|BYTE-NA|BYTE-CS|BYTE-NS|IS\s+(NOT\s+)?(INITIAL|ASSIGNED|REQUESTED|BOUND))\b`, OperatorWord, nil}, + Include("variable-names"), + {`[?*<>=\-+&]`, Operator, nil}, + {`'(''|[^'])*'`, LiteralStringSingle, nil}, + {"`([^`])*`", LiteralStringSingle, nil}, + {`([|}])([^{}|]*?)([|{])`, ByGroups(Punctuation, LiteralStringSingle, Punctuation), nil}, + {`[/;:()\[\],.]`, Punctuation, nil}, + {`(!)(\w+)`, ByGroups(Operator, Name), nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/a/abnf.go b/vendor/github.com/alecthomas/chroma/lexers/a/abnf.go new file mode 100644 index 000000000..ff29aed24 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/a/abnf.go @@ -0,0 +1,38 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Abnf lexer. +var Abnf = internal.Register(MustNewLexer( + &Config{ + Name: "ABNF", + Aliases: []string{"abnf"}, + Filenames: []string{"*.abnf"}, + MimeTypes: []string{"text/x-abnf"}, + }, + Rules{ + "root": { + {`;.*$`, CommentSingle, nil}, + {`(%[si])?"[^"]*"`, Literal, nil}, + {`%b[01]+\-[01]+\b`, Literal, nil}, + {`%b[01]+(\.[01]+)*\b`, Literal, nil}, + {`%d[0-9]+\-[0-9]+\b`, Literal, nil}, + {`%d[0-9]+(\.[0-9]+)*\b`, Literal, nil}, + {`%x[0-9a-fA-F]+\-[0-9a-fA-F]+\b`, Literal, nil}, + {`%x[0-9a-fA-F]+(\.[0-9a-fA-F]+)*\b`, Literal, nil}, + {`\b[0-9]+\*[0-9]+`, Operator, nil}, + {`\b[0-9]+\*`, Operator, nil}, + {`\b[0-9]+`, Operator, nil}, + {`\*`, Operator, nil}, + {Words(``, `\b`, `ALPHA`, `BIT`, `CHAR`, `CR`, `CRLF`, `CTL`, `DIGIT`, `DQUOTE`, `HEXDIG`, `HTAB`, `LF`, `LWSP`, `OCTET`, `SP`, `VCHAR`, `WSP`), Keyword, nil}, + {`[a-zA-Z][a-zA-Z0-9-]+\b`, NameClass, nil}, + {`(=/|=|/)`, Operator, nil}, + {`[\[\]()]`, Punctuation, nil}, + {`\s+`, Text, nil}, + {`.`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/a/actionscript.go b/vendor/github.com/alecthomas/chroma/lexers/a/actionscript.go new file mode 100644 index 000000000..43d38521e --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/a/actionscript.go @@ -0,0 +1,39 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Actionscript lexer. +var Actionscript = internal.Register(MustNewLexer( + &Config{ + Name: "ActionScript", + Aliases: []string{"as", "actionscript"}, + Filenames: []string{"*.as"}, + MimeTypes: []string{"application/x-actionscript", "text/x-actionscript", "text/actionscript"}, + NotMultiline: true, + DotAll: true, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/\*.*?\*/`, CommentMultiline, nil}, + {`/(\\\\|\\/|[^/\n])*/[gim]*`, LiteralStringRegex, nil}, + {`[~^*!%&<>|+=:;,/?\\-]+`, Operator, nil}, + {`[{}\[\]();.]+`, Punctuation, nil}, + {Words(``, `\b`, `case`, `default`, `for`, `each`, `in`, `while`, `do`, `break`, `return`, `continue`, `if`, `else`, `throw`, `try`, `catch`, `var`, `with`, `new`, `typeof`, `arguments`, `instanceof`, `this`, `switch`), Keyword, nil}, + {Words(``, `\b`, `class`, `public`, `final`, `internal`, `native`, `override`, `private`, `protected`, `static`, `import`, `extends`, `implements`, `interface`, `intrinsic`, `return`, `super`, `dynamic`, `function`, `const`, `get`, `namespace`, `package`, `set`), KeywordDeclaration, nil}, + {`(true|false|null|NaN|Infinity|-Infinity|undefined|Void)\b`, KeywordConstant, nil}, + {Words(``, `\b`, `Accessibility`, `AccessibilityProperties`, `ActionScriptVersion`, `ActivityEvent`, `AntiAliasType`, `ApplicationDomain`, `AsBroadcaster`, `Array`, `AsyncErrorEvent`, `AVM1Movie`, `BevelFilter`, `Bitmap`, `BitmapData`, `BitmapDataChannel`, `BitmapFilter`, `BitmapFilterQuality`, `BitmapFilterType`, `BlendMode`, `BlurFilter`, `Boolean`, `ByteArray`, `Camera`, `Capabilities`, `CapsStyle`, `Class`, `Color`, `ColorMatrixFilter`, `ColorTransform`, `ContextMenu`, `ContextMenuBuiltInItems`, `ContextMenuEvent`, `ContextMenuItem`, `ConvultionFilter`, `CSMSettings`, `DataEvent`, `Date`, `DefinitionError`, `DeleteObjectSample`, `Dictionary`, `DisplacmentMapFilter`, `DisplayObject`, `DisplacmentMapFilterMode`, `DisplayObjectContainer`, `DropShadowFilter`, `Endian`, `EOFError`, `Error`, `ErrorEvent`, `EvalError`, `Event`, `EventDispatcher`, `EventPhase`, `ExternalInterface`, `FileFilter`, `FileReference`, `FileReferenceList`, `FocusDirection`, `FocusEvent`, `Font`, `FontStyle`, `FontType`, `FrameLabel`, `FullScreenEvent`, `Function`, `GlowFilter`, `GradientBevelFilter`, `GradientGlowFilter`, `GradientType`, `Graphics`, `GridFitType`, `HTTPStatusEvent`, `IBitmapDrawable`, `ID3Info`, `IDataInput`, `IDataOutput`, `IDynamicPropertyOutputIDynamicPropertyWriter`, `IEventDispatcher`, `IExternalizable`, `IllegalOperationError`, `IME`, `IMEConversionMode`, `IMEEvent`, `int`, `InteractiveObject`, `InterpolationMethod`, `InvalidSWFError`, `InvokeEvent`, `IOError`, `IOErrorEvent`, `JointStyle`, `Key`, `Keyboard`, `KeyboardEvent`, `KeyLocation`, `LineScaleMode`, `Loader`, `LoaderContext`, `LoaderInfo`, `LoadVars`, `LocalConnection`, `Locale`, `Math`, `Matrix`, `MemoryError`, `Microphone`, `MorphShape`, `Mouse`, `MouseEvent`, `MovieClip`, `MovieClipLoader`, `Namespace`, `NetConnection`, `NetStatusEvent`, `NetStream`, `NewObjectSample`, `Number`, `Object`, `ObjectEncoding`, `PixelSnapping`, `Point`, `PrintJob`, `PrintJobOptions`, `PrintJobOrientation`, `ProgressEvent`, `Proxy`, `QName`, `RangeError`, `Rectangle`, `ReferenceError`, `RegExp`, `Responder`, `Sample`, `Scene`, `ScriptTimeoutError`, `Security`, `SecurityDomain`, `SecurityError`, `SecurityErrorEvent`, `SecurityPanel`, `Selection`, `Shape`, `SharedObject`, `SharedObjectFlushStatus`, `SimpleButton`, `Socket`, `Sound`, `SoundChannel`, `SoundLoaderContext`, `SoundMixer`, `SoundTransform`, `SpreadMethod`, `Sprite`, `StackFrame`, `StackOverflowError`, `Stage`, `StageAlign`, `StageDisplayState`, `StageQuality`, `StageScaleMode`, `StaticText`, `StatusEvent`, `String`, `StyleSheet`, `SWFVersion`, `SyncEvent`, `SyntaxError`, `System`, `TextColorType`, `TextField`, `TextFieldAutoSize`, `TextFieldType`, `TextFormat`, `TextFormatAlign`, `TextLineMetrics`, `TextRenderer`, `TextSnapshot`, `Timer`, `TimerEvent`, `Transform`, `TypeError`, `uint`, `URIError`, `URLLoader`, `URLLoaderDataFormat`, `URLRequest`, `URLRequestHeader`, `URLRequestMethod`, `URLStream`, `URLVariabeles`, `VerifyError`, `Video`, `XML`, `XMLDocument`, `XMLList`, `XMLNode`, `XMLNodeType`, `XMLSocket`, `XMLUI`), NameBuiltin, nil}, + {Words(``, `\b`, `decodeURI`, `decodeURIComponent`, `encodeURI`, `escape`, `eval`, `isFinite`, `isNaN`, `isXMLName`, `clearInterval`, `fscommand`, `getTimer`, `getURL`, `getVersion`, `parseFloat`, `parseInt`, `setInterval`, `trace`, `updateAfterEvent`, `unescape`), NameFunction, nil}, + {`[$a-zA-Z_]\w*`, NameOther, nil}, + {`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil}, + {`0x[0-9a-f]+`, LiteralNumberHex, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/a/actionscript3.go b/vendor/github.com/alecthomas/chroma/lexers/a/actionscript3.go new file mode 100644 index 000000000..3404bd555 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/a/actionscript3.go @@ -0,0 +1,56 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Actionscript 3 lexer. +var Actionscript3 = internal.Register(MustNewLexer( + &Config{ + Name: "ActionScript 3", + Aliases: []string{"as3", "actionscript3"}, + Filenames: []string{"*.as"}, + MimeTypes: []string{"application/x-actionscript3", "text/x-actionscript3", "text/actionscript3"}, + DotAll: true, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`(function\s+)([$a-zA-Z_]\w*)(\s*)(\()`, ByGroups(KeywordDeclaration, NameFunction, Text, Operator), Push("funcparams")}, + {`(var|const)(\s+)([$a-zA-Z_]\w*)(\s*)(:)(\s*)([$a-zA-Z_]\w*(?:\.<\w+>)?)`, ByGroups(KeywordDeclaration, Text, Name, Text, Punctuation, Text, KeywordType), nil}, + {`(import|package)(\s+)((?:[$a-zA-Z_]\w*|\.)+)(\s*)`, ByGroups(Keyword, Text, NameNamespace, Text), nil}, + {`(new)(\s+)([$a-zA-Z_]\w*(?:\.<\w+>)?)(\s*)(\()`, ByGroups(Keyword, Text, KeywordType, Text, Operator), nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/\*.*?\*/`, CommentMultiline, nil}, + {`/(\\\\|\\/|[^\n])*/[gisx]*`, LiteralStringRegex, nil}, + {`(\.)([$a-zA-Z_]\w*)`, ByGroups(Operator, NameAttribute), nil}, + {`(case|default|for|each|in|while|do|break|return|continue|if|else|throw|try|catch|with|new|typeof|arguments|instanceof|this|switch|import|include|as|is)\b`, Keyword, nil}, + {`(class|public|final|internal|native|override|private|protected|static|import|extends|implements|interface|intrinsic|return|super|dynamic|function|const|get|namespace|package|set)\b`, KeywordDeclaration, nil}, + {`(true|false|null|NaN|Infinity|-Infinity|undefined|void)\b`, KeywordConstant, nil}, + {`(decodeURI|decodeURIComponent|encodeURI|escape|eval|isFinite|isNaN|isXMLName|clearInterval|fscommand|getTimer|getURL|getVersion|isFinite|parseFloat|parseInt|setInterval|trace|updateAfterEvent|unescape)\b`, NameFunction, nil}, + {`[$a-zA-Z_]\w*`, Name, nil}, + {`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil}, + {`0x[0-9a-f]+`, LiteralNumberHex, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`[~^*!%&<>|+=:;,/?\\{}\[\]().-]+`, Operator, nil}, + }, + "funcparams": { + {`\s+`, Text, nil}, + {`(\s*)(\.\.\.)?([$a-zA-Z_]\w*)(\s*)(:)(\s*)([$a-zA-Z_]\w*(?:\.<\w+>)?|\*)(\s*)`, ByGroups(Text, Punctuation, Name, Text, Operator, Text, KeywordType, Text), Push("defval")}, + {`\)`, Operator, Push("type")}, + }, + "type": { + {`(\s*)(:)(\s*)([$a-zA-Z_]\w*(?:\.<\w+>)?|\*)`, ByGroups(Text, Operator, Text, KeywordType), Pop(2)}, + {`\s+`, Text, Pop(2)}, + Default(Pop(2)), + }, + "defval": { + {`(=)(\s*)([^(),]+)(\s*)(,?)`, ByGroups(Operator, Text, UsingSelf("root"), Text, Operator), Pop(1)}, + {`,`, Operator, Pop(1)}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/a/ada.go b/vendor/github.com/alecthomas/chroma/lexers/a/ada.go new file mode 100644 index 000000000..d9b34e3ca --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/a/ada.go @@ -0,0 +1,114 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Ada lexer. +var Ada = internal.Register(MustNewLexer( + &Config{ + Name: "Ada", + Aliases: []string{"ada", "ada95", "ada2005"}, + Filenames: []string{"*.adb", "*.ads", "*.ada"}, + MimeTypes: []string{"text/x-ada"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`[^\S\n]+`, Text, nil}, + {`--.*?\n`, CommentSingle, nil}, + {`[^\S\n]+`, Text, nil}, + {`function|procedure|entry`, KeywordDeclaration, Push("subprogram")}, + {`(subtype|type)(\s+)(\w+)`, ByGroups(KeywordDeclaration, Text, KeywordType), Push("type_def")}, + {`task|protected`, KeywordDeclaration, nil}, + {`(subtype)(\s+)`, ByGroups(KeywordDeclaration, Text), nil}, + {`(end)(\s+)`, ByGroups(KeywordReserved, Text), Push("end")}, + {`(pragma)(\s+)(\w+)`, ByGroups(KeywordReserved, Text, CommentPreproc), nil}, + {`(true|false|null)\b`, KeywordConstant, nil}, + {Words(``, `\b`, `Address`, `Byte`, `Boolean`, `Character`, `Controlled`, `Count`, `Cursor`, `Duration`, `File_Mode`, `File_Type`, `Float`, `Generator`, `Integer`, `Long_Float`, `Long_Integer`, `Long_Long_Float`, `Long_Long_Integer`, `Natural`, `Positive`, `Reference_Type`, `Short_Float`, `Short_Integer`, `Short_Short_Float`, `Short_Short_Integer`, `String`, `Wide_Character`, `Wide_String`), KeywordType, nil}, + {`(and(\s+then)?|in|mod|not|or(\s+else)|rem)\b`, OperatorWord, nil}, + {`generic|private`, KeywordDeclaration, nil}, + {`package`, KeywordDeclaration, Push("package")}, + {`array\b`, KeywordReserved, Push("array_def")}, + {`(with|use)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")}, + {`(\w+)(\s*)(:)(\s*)(constant)`, ByGroups(NameConstant, Text, Punctuation, Text, KeywordReserved), nil}, + {`<<\w+>>`, NameLabel, nil}, + {`(\w+)(\s*)(:)(\s*)(declare|begin|loop|for|while)`, ByGroups(NameLabel, Text, Punctuation, Text, KeywordReserved), nil}, + {Words(`\b`, `\b`, `abort`, `abs`, `abstract`, `accept`, `access`, `aliased`, `all`, `array`, `at`, `begin`, `body`, `case`, `constant`, `declare`, `delay`, `delta`, `digits`, `do`, `else`, `elsif`, `end`, `entry`, `exception`, `exit`, `interface`, `for`, `goto`, `if`, `is`, `limited`, `loop`, `new`, `null`, `of`, `or`, `others`, `out`, `overriding`, `pragma`, `protected`, `raise`, `range`, `record`, `renames`, `requeue`, `return`, `reverse`, `select`, `separate`, `subtype`, `synchronized`, `task`, `tagged`, `terminate`, `then`, `type`, `until`, `when`, `while`, `xor`), KeywordReserved, nil}, + {`"[^"]*"`, LiteralString, nil}, + Include("attribute"), + Include("numbers"), + {`'[^']'`, LiteralStringChar, nil}, + {`(\w+)(\s*|[(,])`, ByGroups(Name, UsingSelf("root")), nil}, + {`(<>|=>|:=|[()|:;,.'])`, Punctuation, nil}, + {`[*<>+=/&-]`, Operator, nil}, + {`\n+`, Text, nil}, + }, + "numbers": { + {`[0-9_]+#[0-9a-f]+#`, LiteralNumberHex, nil}, + {`[0-9_]+\.[0-9_]*`, LiteralNumberFloat, nil}, + {`[0-9_]+`, LiteralNumberInteger, nil}, + }, + "attribute": { + {`(')(\w+)`, ByGroups(Punctuation, NameAttribute), nil}, + }, + "subprogram": { + {`\(`, Punctuation, Push("#pop", "formal_part")}, + {`;`, Punctuation, Pop(1)}, + {`is\b`, KeywordReserved, Pop(1)}, + {`"[^"]+"|\w+`, NameFunction, nil}, + Include("root"), + }, + "end": { + {`(if|case|record|loop|select)`, KeywordReserved, nil}, + {`"[^"]+"|[\w.]+`, NameFunction, nil}, + {`\s+`, Text, nil}, + {`;`, Punctuation, Pop(1)}, + }, + "type_def": { + {`;`, Punctuation, Pop(1)}, + {`\(`, Punctuation, Push("formal_part")}, + {`with|and|use`, KeywordReserved, nil}, + {`array\b`, KeywordReserved, Push("#pop", "array_def")}, + {`record\b`, KeywordReserved, Push("record_def")}, + {`(null record)(;)`, ByGroups(KeywordReserved, Punctuation), Pop(1)}, + Include("root"), + }, + "array_def": { + {`;`, Punctuation, Pop(1)}, + {`(\w+)(\s+)(range)`, ByGroups(KeywordType, Text, KeywordReserved), nil}, + Include("root"), + }, + "record_def": { + {`end record`, KeywordReserved, Pop(1)}, + Include("root"), + }, + "import": { + {`[\w.]+`, NameNamespace, Pop(1)}, + Default(Pop(1)), + }, + "formal_part": { + {`\)`, Punctuation, Pop(1)}, + {`\w+`, NameVariable, nil}, + {`,|:[^=]`, Punctuation, nil}, + {`(in|not|null|out|access)\b`, KeywordReserved, nil}, + Include("root"), + }, + "package": { + {`body`, KeywordDeclaration, nil}, + {`is\s+new|renames`, KeywordReserved, nil}, + {`is`, KeywordReserved, Pop(1)}, + {`;`, Punctuation, Pop(1)}, + {`\(`, Punctuation, Push("package_instantiation")}, + {`([\w.]+)`, NameClass, nil}, + Include("root"), + }, + "package_instantiation": { + {`("[^"]+"|\w+)(\s+)(=>)`, ByGroups(NameVariable, Text, Punctuation), nil}, + {`[\w.\'"]`, Text, nil}, + {`\)`, Punctuation, Pop(1)}, + Include("root"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/a/angular2.go b/vendor/github.com/alecthomas/chroma/lexers/a/angular2.go new file mode 100644 index 000000000..5258c928b --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/a/angular2.go @@ -0,0 +1,42 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Angular2 lexer. +var Angular2 = internal.Register(MustNewLexer( + &Config{ + Name: "Angular2", + Aliases: []string{"ng2"}, + Filenames: []string{}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`[^{([*#]+`, Other, nil}, + {`(\{\{)(\s*)`, ByGroups(CommentPreproc, Text), Push("ngExpression")}, + {`([([]+)([\w:.-]+)([\])]+)(\s*)(=)(\s*)`, ByGroups(Punctuation, NameAttribute, Punctuation, Text, Operator, Text), Push("attr")}, + {`([([]+)([\w:.-]+)([\])]+)(\s*)`, ByGroups(Punctuation, NameAttribute, Punctuation, Text), nil}, + {`([*#])([\w:.-]+)(\s*)(=)(\s*)`, ByGroups(Punctuation, NameAttribute, Punctuation, Operator), Push("attr")}, + {`([*#])([\w:.-]+)(\s*)`, ByGroups(Punctuation, NameAttribute, Punctuation), nil}, + }, + "ngExpression": { + {`\s+(\|\s+)?`, Text, nil}, + {`\}\}`, CommentPreproc, Pop(1)}, + {`:?(true|false)`, LiteralStringBoolean, nil}, + {`:?"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`:?'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil}, + {`[a-zA-Z][\w-]*(\(.*\))?`, NameVariable, nil}, + {`\.[\w-]+(\(.*\))?`, NameVariable, nil}, + {`(\?)(\s*)([^}\s]+)(\s*)(:)(\s*)([^}\s]+)(\s*)`, ByGroups(Operator, Text, LiteralString, Text, Operator, Text, LiteralString, Text), nil}, + }, + "attr": { + {`".*?"`, LiteralString, Pop(1)}, + {`'.*?'`, LiteralString, Pop(1)}, + {`[^\s>]+`, LiteralString, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/a/antlr.go b/vendor/github.com/alecthomas/chroma/lexers/a/antlr.go new file mode 100644 index 000000000..d7649d4a4 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/a/antlr.go @@ -0,0 +1,101 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// ANTLR lexer. +var ANTLR = internal.Register(MustNewLexer( + &Config{ + Name: "ANTLR", + Aliases: []string{"antlr"}, + Filenames: []string{}, + MimeTypes: []string{}, + }, + Rules{ + "whitespace": { + {`\s+`, TextWhitespace, nil}, + }, + "comments": { + {`//.*$`, Comment, nil}, + {`/\*(.|\n)*?\*/`, Comment, nil}, + }, + "root": { + Include("whitespace"), + Include("comments"), + {`(lexer|parser|tree)?(\s*)(grammar\b)(\s*)([A-Za-z]\w*)(;)`, ByGroups(Keyword, TextWhitespace, Keyword, TextWhitespace, NameClass, Punctuation), nil}, + {`options\b`, Keyword, Push("options")}, + {`tokens\b`, Keyword, Push("tokens")}, + {`(scope)(\s*)([A-Za-z]\w*)(\s*)(\{)`, ByGroups(Keyword, TextWhitespace, NameVariable, TextWhitespace, Punctuation), Push("action")}, + {`(catch|finally)\b`, Keyword, Push("exception")}, + {`(@[A-Za-z]\w*)(\s*)(::)?(\s*)([A-Za-z]\w*)(\s*)(\{)`, ByGroups(NameLabel, TextWhitespace, Punctuation, TextWhitespace, NameLabel, TextWhitespace, Punctuation), Push("action")}, + {`((?:protected|private|public|fragment)\b)?(\s*)([A-Za-z]\w*)(!)?`, ByGroups(Keyword, TextWhitespace, NameLabel, Punctuation), Push("rule-alts", "rule-prelims")}, + }, + "exception": { + {`\n`, TextWhitespace, Pop(1)}, + {`\s`, TextWhitespace, nil}, + Include("comments"), + {`\[`, Punctuation, Push("nested-arg-action")}, + {`\{`, Punctuation, Push("action")}, + }, + "rule-prelims": { + Include("whitespace"), + Include("comments"), + {`returns\b`, Keyword, nil}, + {`\[`, Punctuation, Push("nested-arg-action")}, + {`\{`, Punctuation, Push("action")}, + {`(throws)(\s+)([A-Za-z]\w*)`, ByGroups(Keyword, TextWhitespace, NameLabel), nil}, + {`(,)(\s*)([A-Za-z]\w*)`, ByGroups(Punctuation, TextWhitespace, NameLabel), nil}, + {`options\b`, Keyword, Push("options")}, + {`(scope)(\s+)(\{)`, ByGroups(Keyword, TextWhitespace, Punctuation), Push("action")}, + {`(scope)(\s+)([A-Za-z]\w*)(\s*)(;)`, ByGroups(Keyword, TextWhitespace, NameLabel, TextWhitespace, Punctuation), nil}, + {`(@[A-Za-z]\w*)(\s*)(\{)`, ByGroups(NameLabel, TextWhitespace, Punctuation), Push("action")}, + {`:`, Punctuation, Pop(1)}, + }, + "rule-alts": { + Include("whitespace"), + Include("comments"), + {`options\b`, Keyword, Push("options")}, + {`:`, Punctuation, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralString, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`<<([^>]|>[^>])>>`, LiteralString, nil}, + {`\$?[A-Z_]\w*`, NameConstant, nil}, + {`\$?[a-z_]\w*`, NameVariable, nil}, + {`(\+|\||->|=>|=|\(|\)|\.\.|\.|\?|\*|\^|!|\#|~)`, Operator, nil}, + {`,`, Punctuation, nil}, + {`\[`, Punctuation, Push("nested-arg-action")}, + {`\{`, Punctuation, Push("action")}, + {`;`, Punctuation, Pop(1)}, + }, + "tokens": { + Include("whitespace"), + Include("comments"), + {`\{`, Punctuation, nil}, + {`([A-Z]\w*)(\s*)(=)?(\s*)(\'(?:\\\\|\\\'|[^\']*)\')?(\s*)(;)`, ByGroups(NameLabel, TextWhitespace, Punctuation, TextWhitespace, LiteralString, TextWhitespace, Punctuation), nil}, + {`\}`, Punctuation, Pop(1)}, + }, + "options": { + Include("whitespace"), + Include("comments"), + {`\{`, Punctuation, nil}, + {`([A-Za-z]\w*)(\s*)(=)(\s*)([A-Za-z]\w*|\'(?:\\\\|\\\'|[^\']*)\'|[0-9]+|\*)(\s*)(;)`, ByGroups(NameVariable, TextWhitespace, Punctuation, TextWhitespace, Text, TextWhitespace, Punctuation), nil}, + {`\}`, Punctuation, Pop(1)}, + }, + "action": { + {`([^${}\'"/\\]+|"(\\\\|\\"|[^"])*"|'(\\\\|\\'|[^'])*'|//.*$\n?|/\*(.|\n)*?\*/|/(?!\*)(\\\\|\\/|[^/])*/|\\(?!%)|/)+`, Other, nil}, + {`(\\)(%)`, ByGroups(Punctuation, Other), nil}, + {`(\$[a-zA-Z]+)(\.?)(text|value)?`, ByGroups(NameVariable, Punctuation, NameProperty), nil}, + {`\{`, Punctuation, Push()}, + {`\}`, Punctuation, Pop(1)}, + }, + "nested-arg-action": { + {`([^$\[\]\'"/]+|"(\\\\|\\"|[^"])*"|'(\\\\|\\'|[^'])*'|//.*$\n?|/\*(.|\n)*?\*/|/(?!\*)(\\\\|\\/|[^/])*/|/)+`, Other, nil}, + {`\[`, Punctuation, Push()}, + {`\]`, Punctuation, Pop(1)}, + {`(\$[a-zA-Z]+)(\.?)(text|value)?`, ByGroups(NameVariable, Punctuation, NameProperty), nil}, + {`(\\\\|\\\]|\\\[|[^\[\]])+`, Other, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/a/apache.go b/vendor/github.com/alecthomas/chroma/lexers/a/apache.go new file mode 100644 index 000000000..6c56a1db8 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/a/apache.go @@ -0,0 +1,38 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Apacheconf lexer. +var Apacheconf = internal.Register(MustNewLexer( + &Config{ + Name: "ApacheConf", + Aliases: []string{"apacheconf", "aconf", "apache"}, + Filenames: []string{".htaccess", "apache.conf", "apache2.conf"}, + MimeTypes: []string{"text/x-apacheconf"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`(#.*?)$`, Comment, nil}, + {`(<[^\s>]+)(?:(\s+)(.*?))?(>)`, ByGroups(NameTag, Text, LiteralString, NameTag), nil}, + {`([a-z]\w*)(\s+)`, ByGroups(NameBuiltin, Text), Push("value")}, + {`\.+`, Text, nil}, + }, + "value": { + {`\\\n`, Text, nil}, + {`$`, Text, Pop(1)}, + {`\\`, Text, nil}, + {`[^\S\n]+`, Text, nil}, + {`\d+\.\d+\.\d+\.\d+(?:/\d+)?`, LiteralNumber, nil}, + {`\d+`, LiteralNumber, nil}, + {`/([a-z0-9][\w./-]+)`, LiteralStringOther, nil}, + {`(on|off|none|any|all|double|email|dns|min|minimal|os|productonly|full|emerg|alert|crit|error|warn|notice|info|debug|registry|script|inetd|standalone|user|group)\b`, Keyword, nil}, + {`"([^"\\]*(?:\\.[^"\\]*)*)"`, LiteralStringDouble, nil}, + {`[^\s"\\]+`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/a/apl.go b/vendor/github.com/alecthomas/chroma/lexers/a/apl.go new file mode 100644 index 000000000..820e13b6c --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/a/apl.go @@ -0,0 +1,36 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Apl lexer. +var Apl = internal.Register(MustNewLexer( + &Config{ + Name: "APL", + Aliases: []string{"apl"}, + Filenames: []string{"*.apl"}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`[⍝#].*$`, CommentSingle, nil}, + {`\'((\'\')|[^\'])*\'`, LiteralStringSingle, nil}, + {`"(("")|[^"])*"`, LiteralStringDouble, nil}, + {`[⋄◇()]`, Punctuation, nil}, + {`[\[\];]`, LiteralStringRegex, nil}, + {`⎕[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*`, NameFunction, nil}, + {`[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*`, NameVariable, nil}, + {`¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞)([Jj]¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞))?`, LiteralNumber, nil}, + {`[\.\\/⌿⍀¨⍣⍨⍠⍤∘]`, NameAttribute, nil}, + {`[+\-×÷⌈⌊∣|⍳?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⌸⍯↗]`, Operator, nil}, + {`⍬`, NameConstant, nil}, + {`[⎕⍞]`, NameVariableGlobal, nil}, + {`[←→]`, KeywordDeclaration, nil}, + {`[⍺⍵⍶⍹∇:]`, NameBuiltinPseudo, nil}, + {`[{}]`, KeywordType, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/a/applescript.go b/vendor/github.com/alecthomas/chroma/lexers/a/applescript.go new file mode 100644 index 000000000..db83ed0e0 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/a/applescript.go @@ -0,0 +1,55 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Applescript lexer. +var Applescript = internal.Register(MustNewLexer( + &Config{ + Name: "AppleScript", + Aliases: []string{"applescript"}, + Filenames: []string{"*.applescript"}, + MimeTypes: []string{}, + DotAll: true, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`¬\n`, LiteralStringEscape, nil}, + {`'s\s+`, Text, nil}, + {`(--|#).*?$`, Comment, nil}, + {`\(\*`, CommentMultiline, Push("comment")}, + {`[(){}!,.:]`, Punctuation, nil}, + {`(«)([^»]+)(»)`, ByGroups(Text, NameBuiltin, Text), nil}, + {`\b((?:considering|ignoring)\s*)(application responses|case|diacriticals|hyphens|numeric strings|punctuation|white space)`, ByGroups(Keyword, NameBuiltin), nil}, + {`(-|\*|\+|&|≠|>=?|<=?|=|≥|≤|/|÷|\^)`, Operator, nil}, + {`\b(and|or|is equal|equals|(is )?equal to|is not|isn't|isn't equal( to)?|is not equal( to)?|doesn't equal|does not equal|(is )?greater than|comes after|is not less than or equal( to)?|isn't less than or equal( to)?|(is )?less than|comes before|is not greater than or equal( to)?|isn't greater than or equal( to)?|(is )?greater than or equal( to)?|is not less than|isn't less than|does not come before|doesn't come before|(is )?less than or equal( to)?|is not greater than|isn't greater than|does not come after|doesn't come after|starts? with|begins? with|ends? with|contains?|does not contain|doesn't contain|is in|is contained by|is not in|is not contained by|isn't contained by|div|mod|not|(a )?(ref( to)?|reference to)|is|does)\b`, OperatorWord, nil}, + {`^(\s*(?:on|end)\s+)(zoomed|write to file|will zoom|will show|will select tab view item|will resize( sub views)?|will resign active|will quit|will pop up|will open|will move|will miniaturize|will hide|will finish launching|will display outline cell|will display item cell|will display cell|will display browser cell|will dismiss|will close|will become active|was miniaturized|was hidden|update toolbar item|update parameters|update menu item|shown|should zoom|should selection change|should select tab view item|should select row|should select item|should select column|should quit( after last window closed)?|should open( untitled)?|should expand item|should end editing|should collapse item|should close|should begin editing|selection changing|selection changed|selected tab view item|scroll wheel|rows changed|right mouse up|right mouse dragged|right mouse down|resized( sub views)?|resigned main|resigned key|resigned active|read from file|prepare table drop|prepare table drag|prepare outline drop|prepare outline drag|prepare drop|plugin loaded|parameters updated|panel ended|opened|open untitled|number of rows|number of items|number of browser rows|moved|mouse up|mouse moved|mouse exited|mouse entered|mouse dragged|mouse down|miniaturized|load data representation|launched|keyboard up|keyboard down|items changed|item value changed|item value|item expandable|idle|exposed|end editing|drop|drag( (entered|exited|updated))?|double clicked|document nib name|dialog ended|deminiaturized|data representation|conclude drop|column resized|column moved|column clicked|closed|clicked toolbar item|clicked|choose menu item|child of item|changed|change item value|change cell value|cell value changed|cell value|bounds changed|begin editing|became main|became key|awake from nib|alert ended|activated|action|accept table drop|accept outline drop)`, ByGroups(Keyword, NameFunction), nil}, + {`^(\s*)(in|on|script|to)(\s+)`, ByGroups(Text, Keyword, Text), nil}, + {`\b(as )(alias |application |boolean |class |constant |date |file |integer |list |number |POSIX file |real |record |reference |RGB color |script |text |unit types|(?:Unicode )?text|string)\b`, ByGroups(Keyword, NameClass), nil}, + {`\b(AppleScript|current application|false|linefeed|missing value|pi|quote|result|return|space|tab|text item delimiters|true|version)\b`, NameConstant, nil}, + {`\b(ASCII (character|number)|activate|beep|choose URL|choose application|choose color|choose file( name)?|choose folder|choose from list|choose remote application|clipboard info|close( access)?|copy|count|current date|delay|delete|display (alert|dialog)|do shell script|duplicate|exists|get eof|get volume settings|info for|launch|list (disks|folder)|load script|log|make|mount volume|new|offset|open( (for access|location))?|path to|print|quit|random number|read|round|run( script)?|say|scripting components|set (eof|the clipboard to|volume)|store script|summarize|system attribute|system info|the clipboard|time to GMT|write|quoted form)\b`, NameBuiltin, nil}, + {`\b(considering|else|error|exit|from|if|ignoring|in|repeat|tell|then|times|to|try|until|using terms from|while|with|with timeout( of)?|with transaction|by|continue|end|its?|me|my|return|of|as)\b`, Keyword, nil}, + {`\b(global|local|prop(erty)?|set|get)\b`, Keyword, nil}, + {`\b(but|put|returning|the)\b`, NameBuiltin, nil}, + {`\b(attachment|attribute run|character|day|month|paragraph|word|year)s?\b`, NameBuiltin, nil}, + {`\b(about|above|against|apart from|around|aside from|at|below|beneath|beside|between|for|given|instead of|on|onto|out of|over|since)\b`, NameBuiltin, nil}, + {`\b(accepts arrow key|action method|active|alignment|allowed identifiers|allows branch selection|allows column reordering|allows column resizing|allows column selection|allows customization|allows editing text attributes|allows empty selection|allows mixed state|allows multiple selection|allows reordering|allows undo|alpha( value)?|alternate image|alternate increment value|alternate title|animation delay|associated file name|associated object|auto completes|auto display|auto enables items|auto repeat|auto resizes( outline column)?|auto save expanded items|auto save name|auto save table columns|auto saves configuration|auto scroll|auto sizes all columns to fit|auto sizes cells|background color|bezel state|bezel style|bezeled|border rect|border type|bordered|bounds( rotation)?|box type|button returned|button type|can choose directories|can choose files|can draw|can hide|cell( (background color|size|type))?|characters|class|click count|clicked( data)? column|clicked data item|clicked( data)? row|closeable|collating|color( (mode|panel))|command key down|configuration|content(s| (size|view( margins)?))?|context|continuous|control key down|control size|control tint|control view|controller visible|coordinate system|copies( on scroll)?|corner view|current cell|current column|current( field)? editor|current( menu)? item|current row|current tab view item|data source|default identifiers|delta (x|y|z)|destination window|directory|display mode|displayed cell|document( (edited|rect|view))?|double value|dragged column|dragged distance|dragged items|draws( cell)? background|draws grid|dynamically scrolls|echos bullets|edge|editable|edited( data)? column|edited data item|edited( data)? row|enabled|enclosing scroll view|ending page|error handling|event number|event type|excluded from windows menu|executable path|expanded|fax number|field editor|file kind|file name|file type|first responder|first visible column|flipped|floating|font( panel)?|formatter|frameworks path|frontmost|gave up|grid color|has data items|has horizontal ruler|has horizontal scroller|has parent data item|has resize indicator|has shadow|has sub menu|has vertical ruler|has vertical scroller|header cell|header view|hidden|hides when deactivated|highlights by|horizontal line scroll|horizontal page scroll|horizontal ruler view|horizontally resizable|icon image|id|identifier|ignores multiple clicks|image( (alignment|dims when disabled|frame style|scaling))?|imports graphics|increment value|indentation per level|indeterminate|index|integer value|intercell spacing|item height|key( (code|equivalent( modifier)?|window))?|knob thickness|label|last( visible)? column|leading offset|leaf|level|line scroll|loaded|localized sort|location|loop mode|main( (bunde|menu|window))?|marker follows cell|matrix mode|maximum( content)? size|maximum visible columns|menu( form representation)?|miniaturizable|miniaturized|minimized image|minimized title|minimum column width|minimum( content)? size|modal|modified|mouse down state|movie( (controller|file|rect))?|muted|name|needs display|next state|next text|number of tick marks|only tick mark values|opaque|open panel|option key down|outline table column|page scroll|pages across|pages down|palette label|pane splitter|parent data item|parent window|pasteboard|path( (names|separator))?|playing|plays every frame|plays selection only|position|preferred edge|preferred type|pressure|previous text|prompt|properties|prototype cell|pulls down|rate|released when closed|repeated|requested print time|required file type|resizable|resized column|resource path|returns records|reuses columns|rich text|roll over|row height|rulers visible|save panel|scripts path|scrollable|selectable( identifiers)?|selected cell|selected( data)? columns?|selected data items?|selected( data)? rows?|selected item identifier|selection by rect|send action on arrow key|sends action when done editing|separates columns|separator item|sequence number|services menu|shared frameworks path|shared support path|sheet|shift key down|shows alpha|shows state by|size( mode)?|smart insert delete enabled|sort case sensitivity|sort column|sort order|sort type|sorted( data rows)?|sound|source( mask)?|spell checking enabled|starting page|state|string value|sub menu|super menu|super view|tab key traverses cells|tab state|tab type|tab view|table view|tag|target( printer)?|text color|text container insert|text container origin|text returned|tick mark position|time stamp|title(d| (cell|font|height|position|rect))?|tool tip|toolbar|trailing offset|transparent|treat packages as directories|truncated labels|types|unmodified characters|update views|use sort indicator|user defaults|uses data source|uses ruler|uses threaded animation|uses title from previous column|value wraps|version|vertical( (line scroll|page scroll|ruler view))?|vertically resizable|view|visible( document rect)?|volume|width|window|windows menu|wraps|zoomable|zoomed)\b`, NameAttribute, nil}, + {`\b(action cell|alert reply|application|box|browser( cell)?|bundle|button( cell)?|cell|clip view|color well|color-panel|combo box( item)?|control|data( (cell|column|item|row|source))?|default entry|dialog reply|document|drag info|drawer|event|font(-panel)?|formatter|image( (cell|view))?|matrix|menu( item)?|item|movie( view)?|open-panel|outline view|panel|pasteboard|plugin|popup button|progress indicator|responder|save-panel|scroll view|secure text field( cell)?|slider|sound|split view|stepper|tab view( item)?|table( (column|header cell|header view|view))|text( (field( cell)?|view))?|toolbar( item)?|user-defaults|view|window)s?\b`, NameBuiltin, nil}, + {`\b(animate|append|call method|center|close drawer|close panel|display|display alert|display dialog|display panel|go|hide|highlight|increment|item for|load image|load movie|load nib|load panel|load sound|localized string|lock focus|log|open drawer|path for|pause|perform action|play|register|resume|scroll|select( all)?|show|size to fit|start|step back|step forward|stop|synchronize|unlock focus|update)\b`, NameBuiltin, nil}, + {`\b((in )?back of|(in )?front of|[0-9]+(st|nd|rd|th)|first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|after|back|before|behind|every|front|index|last|middle|some|that|through|thru|where|whose)\b`, NameBuiltin, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`\b([a-zA-Z]\w*)\b`, NameVariable, nil}, + {`[-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?`, LiteralNumberFloat, nil}, + {`[-+]?\d+`, LiteralNumberInteger, nil}, + }, + "comment": { + {`\(\*`, CommentMultiline, Push()}, + {`\*\)`, CommentMultiline, Pop(1)}, + {`[^*(]+`, CommentMultiline, nil}, + {`[*(]`, CommentMultiline, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/a/arduino.go b/vendor/github.com/alecthomas/chroma/lexers/a/arduino.go new file mode 100644 index 000000000..b0cd8c95d --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/a/arduino.go @@ -0,0 +1,110 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Arduino lexer. +var Arduino = internal.Register(MustNewLexer( + &Config{ + Name: "Arduino", + Aliases: []string{"arduino"}, + Filenames: []string{"*.ino"}, + MimeTypes: []string{"text/x-arduino"}, + EnsureNL: true, + }, + Rules{ + "statements": { + {Words(``, `\b`, `catch`, `const_cast`, `delete`, `dynamic_cast`, `explicit`, `export`, `friend`, `mutable`, `namespace`, `new`, `operator`, `private`, `protected`, `public`, `reinterpret_cast`, `restrict`, `static_cast`, `template`, `this`, `throw`, `throws`, `try`, `typeid`, `typename`, `using`, `virtual`, `constexpr`, `nullptr`, `decltype`, `thread_local`, `alignas`, `alignof`, `static_assert`, `noexcept`, `override`, `final`), Keyword, nil}, + {`char(16_t|32_t)\b`, KeywordType, nil}, + {`(class)\b`, ByGroups(Keyword, Text), Push("classname")}, + {`(R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)(")`, ByGroups(LiteralStringAffix, LiteralString, LiteralStringDelimiter, LiteralStringDelimiter, LiteralString, LiteralStringDelimiter, LiteralString), nil}, + {`(u8|u|U)(")`, ByGroups(LiteralStringAffix, LiteralString), Push("string")}, + {`(L?)(")`, ByGroups(LiteralStringAffix, LiteralString), Push("string")}, + {`(L?)(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')`, ByGroups(LiteralStringAffix, LiteralStringChar, LiteralStringChar, LiteralStringChar), nil}, + {`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*`, LiteralNumberFloat, nil}, + {`(\d+\.\d*|\.\d+|\d+[fF])[fF]?`, LiteralNumberFloat, nil}, + {`0x[0-9a-fA-F]+[LlUu]*`, LiteralNumberHex, nil}, + {`0[0-7]+[LlUu]*`, LiteralNumberOct, nil}, + {`\d+[LlUu]*`, LiteralNumberInteger, nil}, + {`\*/`, Error, nil}, + {`[~!%^&*+=|?:<>/-]`, Operator, nil}, + {`[()\[\],.]`, Punctuation, nil}, + {Words(``, `\b`, `asm`, `auto`, `break`, `case`, `const`, `continue`, `default`, `do`, `else`, `enum`, `extern`, `for`, `goto`, `if`, `register`, `restricted`, `return`, `sizeof`, `static`, `struct`, `switch`, `typedef`, `union`, `volatile`, `while`), Keyword, nil}, + {`(_Bool|_Complex|_Imaginary|array|atomic_bool|atomic_char|atomic_int|atomic_llong|atomic_long|atomic_schar|atomic_short|atomic_uchar|atomic_uint|atomic_ullong|atomic_ulong|atomic_ushort|auto|bool|boolean|BooleanVariables|Byte|byte|Char|char|char16_t|char32_t|class|complex|Const|const|const_cast|delete|double|dynamic_cast|enum|explicit|extern|Float|float|friend|inline|Int|int|int16_t|int32_t|int64_t|int8_t|Long|long|new|NULL|null|operator|private|PROGMEM|protected|public|register|reinterpret_cast|short|signed|sizeof|Static|static|static_cast|String|struct|typedef|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|virtual|Void|void|Volatile|volatile|word)\b`, KeywordType, nil}, + // Start of: Arduino-specific syntax + {`(and|final|If|Loop|loop|not|or|override|setup|Setup|throw|try|xor)\b`, Keyword, nil}, // Addition to keywords already defined by C++ + {`(ANALOG_MESSAGE|BIN|CHANGE|DEC|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FALLING|FIRMATA_STRING|HALF_PI|HEX|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL1V1|INTERNAL2V56|INTERNAL2V56|LED_BUILTIN|LED_BUILTIN_RX|LED_BUILTIN_TX|LOW|LSBFIRST|MSBFIRST|OCT|OUTPUT|PI|REPORT_ANALOG|REPORT_DIGITAL|RISING|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET|TWO_PI)\b`, KeywordConstant, nil}, + {`(boolean|const|byte|word|string|String|array)\b`, NameVariable, nil}, + {`(Keyboard|KeyboardController|MouseController|SoftwareSerial|EthernetServer|EthernetClient|LiquidCrystal|RobotControl|GSMVoiceCall|EthernetUDP|EsploraTFT|HttpClient|RobotMotor|WiFiClient|GSMScanner|FileSystem|Scheduler|GSMServer|YunClient|YunServer|IPAddress|GSMClient|GSMModem|Keyboard|Ethernet|Console|GSMBand|Esplora|Stepper|Process|WiFiUDP|GSM_SMS|Mailbox|USBHost|Firmata|PImage|Client|Server|GSMPIN|FileIO|Bridge|Serial|EEPROM|Stream|Mouse|Audio|Servo|File|Task|GPRS|WiFi|Wire|TFT|GSM|SPI|SD)\b`, NameClass, nil}, + {`(abs|Abs|accept|ACos|acos|acosf|addParameter|analogRead|AnalogRead|analogReadResolution|AnalogReadResolution|analogReference|AnalogReference|analogWrite|AnalogWrite|analogWriteResolution|AnalogWriteResolution|answerCall|asin|ASin|asinf|atan|ATan|atan2|ATan2|atan2f|atanf|attach|attached|attachGPRS|attachInterrupt|AttachInterrupt|autoscroll|available|availableForWrite|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|Bit|BitClear|bitClear|bitRead|BitRead|bitSet|BitSet|BitWrite|bitWrite|blink|blinkVersion|BSSID|buffer|byte|cbrt|cbrtf|Ceil|ceil|ceilf|changePIN|char|charAt|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compareTo|compassRead|concat|config|connect|connected|constrain|Constrain|copysign|copysignf|cos|Cos|cosf|cosh|coshf|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|degrees|Delay|delay|DelayMicroseconds|delayMicroseconds|detach|DetachInterrupt|detachInterrupt|DigitalPinToInterrupt|digitalPinToInterrupt|DigitalRead|digitalRead|DigitalWrite|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endsWith|endTransmission|endWrite|equals|equalsIgnoreCase|exists|exitValue|Exp|exp|expf|fabs|fabsf|fdim|fdimf|fill|find|findUntil|float|floor|Floor|floorf|flush|fma|fmaf|fmax|fmaxf|fmin|fminf|fmod|fmodf|gatewayIP|get|getAsynchronously|getBand|getButton|getBytes|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|HighByte|home|hypot|hypotf|image|indexOf|int|interrupts|IPAddress|IRread|isActionDone|isAlpha|isAlphaNumeric|isAscii|isControl|isDigit|isDirectory|isfinite|isGraph|isHexadecimalDigit|isinf|isListening|isLowerCase|isnan|isPIN|isPressed|isPrintable|isPunct|isSpace|isUpperCase|isValid|isWhitespace|keyboardRead|keyPressed|keyReleased|knobRead|lastIndexOf|ldexp|ldexpf|leftToRight|length|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|log|Log|log10|log10f|logf|long|lowByte|LowByte|lrint|lrintf|lround|lroundf|macAddress|maintain|map|Map|Max|max|messageAvailable|Micros|micros|millis|Millis|Min|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|NoInterrupts|noListenOnLocalhost|noStroke|noTone|NoTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|PinMode|pinMode|playFile|playMelody|point|pointTo|position|Pow|pow|powf|prepare|press|print|printFirmwareVersion|println|printVersion|process|processInput|PulseIn|pulseIn|pulseInLong|PulseInLong|put|radians|random|Random|randomSeed|RandomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|replace|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|round|roundf|RSSI|run|runAsynchronously|running|runShellCommand|runShellCommandAsynchronously|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|Serial_Available|Serial_Begin|Serial_End|Serial_Flush|Serial_Peek|Serial_Print|Serial_Println|Serial_Read|serialEvent|setBand|setBitOrder|setCharAt|setClockDivider|setCursor|setDataMode|setDNS|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|ShiftIn|shiftIn|ShiftOut|shiftOut|shutdown|signbit|sin|Sin|sinf|sinh|sinhf|size|sizeof|Sq|sq|Sqrt|sqrt|sqrtf|SSID|startLoop|startsWith|step|stop|stroke|subnetMask|substring|switchPIN|tan|Tan|tanf|tanh|tanhf|tempoWrite|text|toCharArray|toInt|toLowerCase|tone|Tone|toUpperCase|transfer|trim|trunc|truncf|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|WiFiServer|word|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRed|writeRGB|yield|Yield)\b`, NameFunction, nil}, + // End of: Arduino-specific syntax + {Words(``, `\b`, `inline`, `_inline`, `__inline`, `naked`, `restrict`, `thread`, `typename`), KeywordReserved, nil}, + {`(__m(128i|128d|128|64))\b`, KeywordReserved, nil}, + {Words(`__`, `\b`, `asm`, `int8`, `based`, `except`, `int16`, `stdcall`, `cdecl`, `fastcall`, `int32`, `declspec`, `finally`, `int64`, `try`, `leave`, `wchar_t`, `w64`, `unaligned`, `raise`, `noop`, `identifier`, `forceinline`, `assume`), KeywordReserved, nil}, + {`(true|false|NULL)\b`, NameBuiltin, nil}, + {`([a-zA-Z_]\w*)(\s*)(:)(?!:)`, ByGroups(NameLabel, Text, Punctuation), nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + }, + "root": { + Include("whitespace"), + {`((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;{]*)(\{)`, ByGroups(UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), Push("function")}, + {`((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;]*)(;)`, ByGroups(UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), nil}, + Default(Push("statement")), + {Words(`__`, `\b`, `virtual_inheritance`, `uuidof`, `super`, `single_inheritance`, `multiple_inheritance`, `interface`, `event`), KeywordReserved, nil}, + {`__(offload|blockingoffload|outer)\b`, KeywordPseudo, nil}, + }, + "classname": { + {`[a-zA-Z_]\w*`, NameClass, Pop(1)}, + {`\s*(?=>)`, Text, Pop(1)}, + }, + "whitespace": { + {`^#if\s+0`, CommentPreproc, Push("if0")}, + {`^#`, CommentPreproc, Push("macro")}, + {`^(\s*(?:/[*].*?[*]/\s*)?)(#if\s+0)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("if0")}, + {`^(\s*(?:/[*].*?[*]/\s*)?)(#)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("macro")}, + {`\n`, Text, nil}, + {`\s+`, Text, nil}, + {`\\\n`, Text, nil}, + {`//(\n|[\w\W]*?[^\\]\n)`, CommentSingle, nil}, + {`/(\\\n)?[*][\w\W]*?[*](\\\n)?/`, CommentMultiline, nil}, + {`/(\\\n)?[*][\w\W]*`, CommentMultiline, nil}, + }, + "statement": { + Include("whitespace"), + Include("statements"), + {`[{}]`, Punctuation, nil}, + {`;`, Punctuation, Pop(1)}, + }, + "function": { + Include("whitespace"), + Include("statements"), + {`;`, Punctuation, nil}, + {`\{`, Punctuation, Push()}, + {`\}`, Punctuation, Pop(1)}, + }, + "string": { + {`"`, LiteralString, Pop(1)}, + {`\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})`, LiteralStringEscape, nil}, + {`[^\\"\n]+`, LiteralString, nil}, + {`\\\n`, LiteralString, nil}, + {`\\`, LiteralString, nil}, + }, + "macro": { + {`(include)(\s*(?:/[*].*?[*]/\s*)?)([^\n]+)`, ByGroups(CommentPreproc, Text, CommentPreprocFile), nil}, + {`[^/\n]+`, CommentPreproc, nil}, + {`/[*](.|\n)*?[*]/`, CommentMultiline, nil}, + {`//.*?\n`, CommentSingle, Pop(1)}, + {`/`, CommentPreproc, nil}, + {`(?<=\\)\n`, CommentPreproc, nil}, + {`\n`, CommentPreproc, Pop(1)}, + }, + "if0": { + {`^\s*#if.*?(?+*%\^/!=|])=?`, Operator, Push("slashstartsregex")}, + {`[{(\[;,]`, Punctuation, Push("slashstartsregex")}, + {`[})\].]`, Punctuation, nil}, + {`(break|continue|do|while|exit|for|if|else|return)\b`, Keyword, Push("slashstartsregex")}, + {`function\b`, KeywordDeclaration, Push("slashstartsregex")}, + {`(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gensub|gsub|index|length|match|split|sprintf|sub|substr|tolower|toupper|close|fflush|getline|next|nextfile|print|printf|strftime|systime|delete|system)\b`, KeywordReserved, nil}, + {`(ARGC|ARGIND|ARGV|BEGIN|CONVFMT|ENVIRON|END|ERRNO|FIELDWIDTHS|FILENAME|FNR|FS|IGNORECASE|NF|NR|OFMT|OFS|ORFS|RLENGTH|RS|RSTART|RT|SUBSEP)\b`, NameBuiltin, nil}, + {`[$a-zA-Z_]\w*`, NameOther, nil}, + {`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil}, + {`0x[0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/b/ballerina.go b/vendor/github.com/alecthomas/chroma/lexers/b/ballerina.go new file mode 100644 index 000000000..91dc90179 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/b/ballerina.go @@ -0,0 +1,46 @@ +package b + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Ballerina lexer. +var Ballerina = internal.Register(MustNewLexer( + &Config{ + Name: "Ballerina", + Aliases: []string{"ballerina"}, + Filenames: []string{"*.bal"}, + MimeTypes: []string{"text/x-ballerina"}, + DotAll: true, + }, + Rules{ + "root": { + {`[^\S\n]+`, Text, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/\*.*?\*/`, CommentMultiline, nil}, + {`(break|catch|continue|done|else|finally|foreach|forever|fork|if|lock|match|return|throw|transaction|try|while)\b`, Keyword, nil}, + {`((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)((?:[^\W\d]|\$)[\w$]*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil}, + {`@[^\W\d][\w.]*`, NameDecorator, nil}, + {`(annotation|bind|but|endpoint|error|function|object|private|public|returns|service|type|var|with|worker)\b`, KeywordDeclaration, nil}, + {`(boolean|byte|decimal|float|int|json|map|nil|record|string|table|xml)\b`, KeywordType, nil}, + {`(true|false|null)\b`, KeywordConstant, nil}, + {`(import)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'`, LiteralStringChar, nil}, + {`(\.)((?:[^\W\d]|\$)[\w$]*)`, ByGroups(Operator, NameAttribute), nil}, + {`^\s*([^\W\d]|\$)[\w$]*:`, NameLabel, nil}, + {`([^\W\d]|\$)[\w$]*`, Name, nil}, + {`([0-9][0-9_]*\.([0-9][0-9_]*)?|\.[0-9][0-9_]*)([eE][+\-]?[0-9][0-9_]*)?[fFdD]?|[0-9][eE][+\-]?[0-9][0-9_]*[fFdD]?|[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFdD]|0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)[pP][+\-]?[0-9][0-9_]*[fFdD]?`, LiteralNumberFloat, nil}, + {`0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?`, LiteralNumberHex, nil}, + {`0[bB][01][01_]*[lL]?`, LiteralNumberBin, nil}, + {`0[0-7_]+[lL]?`, LiteralNumberOct, nil}, + {`0|[1-9][0-9_]*[lL]?`, LiteralNumberInteger, nil}, + {`[~^*!%&\[\](){}<>|+=:;,./?-]`, Operator, nil}, + {`\n`, Text, nil}, + }, + "import": { + {`[\w.]+`, NameNamespace, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/b/bash.go b/vendor/github.com/alecthomas/chroma/lexers/b/bash.go new file mode 100644 index 000000000..38b3f2249 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/b/bash.go @@ -0,0 +1,95 @@ +package b + +import ( + "regexp" + + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +var bashAnalyserRe = regexp.MustCompile(`(?m)^#!.*/bin/(?:env |)(?:bash|zsh|sh|ksh)`) + +// Bash lexer. +var Bash = internal.Register(MustNewLexer( + &Config{ + Name: "Bash", + Aliases: []string{"bash", "sh", "ksh", "zsh", "shell"}, + Filenames: []string{"*.sh", "*.ksh", "*.bash", "*.ebuild", "*.eclass", "*.exheres-0", "*.exlib", "*.zsh", "*.zshrc", ".bashrc", "bashrc", ".bash_*", "bash_*", "zshrc", ".zshrc", "PKGBUILD"}, + MimeTypes: []string{"application/x-sh", "application/x-shellscript"}, + }, + Rules{ + "root": { + Include("basic"), + {"`", LiteralStringBacktick, Push("backticks")}, + Include("data"), + Include("interp"), + }, + "interp": { + {`\$\(\(`, Keyword, Push("math")}, + {`\$\(`, Keyword, Push("paren")}, + {`\$\{#?`, LiteralStringInterpol, Push("curly")}, + {`\$[a-zA-Z_]\w*`, NameVariable, nil}, + {`\$(?:\d+|[#$?!_*@-])`, NameVariable, nil}, + {`\$`, Text, nil}, + }, + "basic": { + {`\b(if|fi|else|while|do|done|for|then|return|function|case|select|continue|until|esac|elif)(\s*)\b`, ByGroups(Keyword, Text), nil}, + {"\\b(alias|bg|bind|break|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)`])", NameBuiltin, nil}, + {`\A#!.+\n`, CommentPreproc, nil}, + {`#.*\S`, CommentSingle, nil}, + {`\\[\w\W]`, LiteralStringEscape, nil}, + {`(\b\w+)(\s*)(\+?=)`, ByGroups(NameVariable, Text, Operator), nil}, + {`[\[\]{}()=]`, Operator, nil}, + {`<<<`, Operator, nil}, + {`<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2`, LiteralString, nil}, + {`&&|\|\|`, Operator, nil}, + }, + "data": { + {`(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Push("string")}, + {`(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'`, LiteralStringSingle, nil}, + {`(?s)'.*?'`, LiteralStringSingle, nil}, + {`;`, Punctuation, nil}, + {`&`, Punctuation, nil}, + {`\|`, Punctuation, nil}, + {`\s+`, Text, nil}, + {`\d+(?= |$)`, LiteralNumber, nil}, + {"[^=\\s\\[\\]{}()$\"\\'`\\\\<&|;]+", Text, nil}, + {`<`, Text, nil}, + }, + "string": { + {`"`, LiteralStringDouble, Pop(1)}, + {`(?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+`, LiteralStringDouble, nil}, + Include("interp"), + }, + "curly": { + {`\}`, LiteralStringInterpol, Pop(1)}, + {`:-`, Keyword, nil}, + {`\w+`, NameVariable, nil}, + {"[^}:\"\\'`$\\\\]+", Punctuation, nil}, + {`:`, Punctuation, nil}, + Include("root"), + }, + "paren": { + {`\)`, Keyword, Pop(1)}, + Include("root"), + }, + "math": { + {`\)\)`, Keyword, Pop(1)}, + {`[-+*/%^|&]|\*\*|\|\|`, Operator, nil}, + {`\d+#\d+`, LiteralNumber, nil}, + {`\d+#(?! )`, LiteralNumber, nil}, + {`\d+`, LiteralNumber, nil}, + Include("root"), + }, + "backticks": { + {"`", LiteralStringBacktick, Pop(1)}, + Include("root"), + }, + }, +).SetAnalyser(func(text string) float32 { + if bashAnalyserRe.FindString(text) != "" { + return 1.0 + } + return 0.0 +})) diff --git a/vendor/github.com/alecthomas/chroma/lexers/b/batch.go b/vendor/github.com/alecthomas/chroma/lexers/b/batch.go new file mode 100644 index 000000000..dc6ce524d --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/b/batch.go @@ -0,0 +1,194 @@ +package b + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Batchfile lexer. +var Batchfile = internal.Register(MustNewLexer( + &Config{ + Name: "Batchfile", + Aliases: []string{"bat", "batch", "dosbatch", "winbatch"}, + Filenames: []string{"*.bat", "*.cmd"}, + MimeTypes: []string{"application/x-dos-batch"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\)((?=\()|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))(?:(?:[^\n\x1a^]|\^[\n\x1a]?[\w\W])*)`, CommentSingle, nil}, + {`(?=((?:(?<=^[^:])|^[^:]?)[\t\v\f\r ,;=\xa0]*)(:))`, Text, Push("follow")}, + {`(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)`, UsingSelf("text"), nil}, + Include("redirect"), + {`[\n\x1a]+`, Text, nil}, + {`\(`, Punctuation, Push("root/compound")}, + {`@+`, Punctuation, nil}, + {`((?:for|if|rem)(?:(?=(?:\^[\n\x1a]?)?/)|(?:(?!\^)|(?<=m))(?:(?=\()|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|\t\v\f\r ,;=\xa0])+)?(?:\^[\n\x1a]?)?/(?:\^[\n\x1a]?)?\?)`, ByGroups(Keyword, UsingSelf("text")), Push("follow")}, + {`(goto(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(]))((?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[^"%\n\x1a&<>|])*(?:\^[\n\x1a]?)?/(?:\^[\n\x1a]?)?\?(?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[^"%\n\x1a&<>|])*)`, ByGroups(Keyword, UsingSelf("text")), Push("follow")}, + {Words(``, `(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(])`, `assoc`, `break`, `cd`, `chdir`, `cls`, `color`, `copy`, `date`, `del`, `dir`, `dpath`, `echo`, `endlocal`, `erase`, `exit`, `ftype`, `keys`, `md`, `mkdir`, `mklink`, `move`, `path`, `pause`, `popd`, `prompt`, `pushd`, `rd`, `ren`, `rename`, `rmdir`, `setlocal`, `shift`, `start`, `time`, `title`, `type`, `ver`, `verify`, `vol`), Keyword, Push("follow")}, + {`(call)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)(:)`, ByGroups(Keyword, UsingSelf("text"), Punctuation), Push("call")}, + {`call(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(])`, Keyword, nil}, + {`(for(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(/f(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))`, ByGroups(Keyword, UsingSelf("text"), Keyword), Push("for/f", "for")}, + {`(for(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(/l(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))`, ByGroups(Keyword, UsingSelf("text"), Keyword), Push("for/l", "for")}, + {`for(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])(?!\^)`, Keyword, Push("for2", "for")}, + {`(goto(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(]))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)(:?)`, ByGroups(Keyword, UsingSelf("text"), Punctuation), Push("label")}, + {`(if(?:(?=\()|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)((?:/i(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))?)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)((?:not(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))?)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)`, ByGroups(Keyword, UsingSelf("text"), Keyword, UsingSelf("text"), Keyword, UsingSelf("text")), Push("(?", "if")}, + {`rem(((?=\()|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:[&<>|]+|(?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|\t\v\f\r ,;=\xa0])+))+)?.*|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(])(?:(?:[^\n\x1a^]|\^[\n\x1a]?[\w\W])*))`, CommentSingle, Push("follow")}, + {`(set(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(]))((?:(?:\^[\n\x1a]?)?[^\S\n])*)(/a)`, ByGroups(Keyword, UsingSelf("text"), Keyword), Push("arithmetic")}, + {`(set(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(]))((?:(?:\^[\n\x1a]?)?[^\S\n])*)((?:/p)?)((?:(?:\^[\n\x1a]?)?[^\S\n])*)((?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|^=]|\^[\n\x1a]?[^"=])+)?)((?:(?:\^[\n\x1a]?)?=)?)`, ByGroups(Keyword, UsingSelf("text"), Keyword, UsingSelf("text"), UsingSelf("variable"), Punctuation), Push("follow")}, + Default(Push("follow")), + }, + "follow": { + {`((?:(?<=^[^:])|^[^:]?)[\t\v\f\r ,;=\xa0]*)(:)([\t\v\f\r ,;=\xa0]*)((?:(?:[^\n\x1a&<>|\t\v\f\r ,;=\xa0+:^]|\^[\n\x1a]?[\w\W])*))(.*)`, ByGroups(Text, Punctuation, Text, NameLabel, CommentSingle), nil}, + Include("redirect"), + {`(?=[\n\x1a])`, Text, Pop(1)}, + {`\|\|?|&&?`, Punctuation, Pop(1)}, + Include("text"), + }, + "arithmetic": { + {`0[0-7]+`, LiteralNumberOct, nil}, + {`0x[\da-f]+`, LiteralNumberHex, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`[(),]+`, Punctuation, nil}, + {`([=+\-*/!~]|%|\^\^)+`, Operator, nil}, + {`((?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(\^[\n\x1a]?)?[^()=+\-*/!~%^"\n\x1a&<>|\t\v\f\r ,;=\xa0]|\^[\n\x1a\t\v\f\r ,;=\xa0]?[\w\W])+`, UsingSelf("variable"), nil}, + {`(?=[\x00|&])`, Text, Pop(1)}, + Include("follow"), + }, + "call": { + {`(:?)((?:(?:[^\n\x1a&<>|\t\v\f\r ,;=\xa0+:^]|\^[\n\x1a]?[\w\W])*))`, ByGroups(Punctuation, NameLabel), Pop(1)}, + }, + "label": { + {`((?:(?:[^\n\x1a&<>|\t\v\f\r ,;=\xa0+:^]|\^[\n\x1a]?[\w\W])*)?)((?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|\^[\n\x1a]?[\w\W]|[^"%^\n\x1a&<>|])*)`, ByGroups(NameLabel, CommentSingle), Pop(1)}, + }, + "redirect": { + {`((?:(?<=[\n\x1a\t\v\f\r ,;=\xa0])\d)?)(>>?&|<&)([\n\x1a\t\v\f\r ,;=\xa0]*)(\d)`, ByGroups(LiteralNumberInteger, Punctuation, Text, LiteralNumberInteger), nil}, + {`((?:(?<=[\n\x1a\t\v\f\r ,;=\xa0])(?>?|<)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:[&<>|]+|(?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|\t\v\f\r ,;=\xa0])+))+))`, ByGroups(LiteralNumberInteger, Punctuation, UsingSelf("text")), nil}, + }, + "root/compound": { + {`\)`, Punctuation, Pop(1)}, + {`(?=((?:(?<=^[^:])|^[^:]?)[\t\v\f\r ,;=\xa0]*)(:))`, Text, Push("follow/compound")}, + {`(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)`, UsingSelf("text"), nil}, + Include("redirect/compound"), + {`[\n\x1a]+`, Text, nil}, + {`\(`, Punctuation, Push("root/compound")}, + {`@+`, Punctuation, nil}, + {`((?:for|if|rem)(?:(?=(?:\^[\n\x1a]?)?/)|(?:(?!\^)|(?<=m))(?:(?=\()|(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])))))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|\t\v\f\r ,;=\xa0)])+)?(?:\^[\n\x1a]?)?/(?:\^[\n\x1a]?)?\?)`, ByGroups(Keyword, UsingSelf("text")), Push("follow/compound")}, + {`(goto(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(])))((?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[^"%\n\x1a&<>|)])*(?:\^[\n\x1a]?)?/(?:\^[\n\x1a]?)?\?(?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[^"%\n\x1a&<>|)])*)`, ByGroups(Keyword, UsingSelf("text")), Push("follow/compound")}, + {Words(``, `(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(]))`, `assoc`, `break`, `cd`, `chdir`, `cls`, `color`, `copy`, `date`, `del`, `dir`, `dpath`, `echo`, `endlocal`, `erase`, `exit`, `ftype`, `keys`, `md`, `mkdir`, `mklink`, `move`, `path`, `pause`, `popd`, `prompt`, `pushd`, `rd`, `ren`, `rename`, `rmdir`, `setlocal`, `shift`, `start`, `time`, `title`, `type`, `ver`, `verify`, `vol`), Keyword, Push("follow/compound")}, + {`(call)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)(:)`, ByGroups(Keyword, UsingSelf("text"), Punctuation), Push("call/compound")}, + {`call(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(]))`, Keyword, nil}, + {`(for(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(/f(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])))`, ByGroups(Keyword, UsingSelf("text"), Keyword), Push("for/f", "for")}, + {`(for(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(/l(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])))`, ByGroups(Keyword, UsingSelf("text"), Keyword), Push("for/l", "for")}, + {`for(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))(?!\^)`, Keyword, Push("for2", "for")}, + {`(goto(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(])))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)(:?)`, ByGroups(Keyword, UsingSelf("text"), Punctuation), Push("label/compound")}, + {`(if(?:(?=\()|(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])))(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)((?:/i(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])))?)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)((?:not(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])))?)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)`, ByGroups(Keyword, UsingSelf("text"), Keyword, UsingSelf("text"), Keyword, UsingSelf("text")), Push("(?", "if")}, + {`rem(((?=\()|(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])))(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:[&<>|]+|(?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|\t\v\f\r ,;=\xa0])+))+)?.*|(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(]))(?:(?:[^\n\x1a^)]|\^[\n\x1a]?[^)])*))`, CommentSingle, Push("follow/compound")}, + {`(set(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(])))((?:(?:\^[\n\x1a]?)?[^\S\n])*)(/a)`, ByGroups(Keyword, UsingSelf("text"), Keyword), Push("arithmetic/compound")}, + {`(set(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&<>|(])))((?:(?:\^[\n\x1a]?)?[^\S\n])*)((?:/p)?)((?:(?:\^[\n\x1a]?)?[^\S\n])*)((?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|^=)]|\^[\n\x1a]?[^"=])+)?)((?:(?:\^[\n\x1a]?)?=)?)`, ByGroups(Keyword, UsingSelf("text"), Keyword, UsingSelf("text"), UsingSelf("variable"), Punctuation), Push("follow/compound")}, + Default(Push("follow/compound")), + }, + "follow/compound": { + {`(?=\))`, Text, Pop(1)}, + {`((?:(?<=^[^:])|^[^:]?)[\t\v\f\r ,;=\xa0]*)(:)([\t\v\f\r ,;=\xa0]*)((?:(?:[^\n\x1a&<>|\t\v\f\r ,;=\xa0+:^)]|\^[\n\x1a]?[^)])*))(.*)`, ByGroups(Text, Punctuation, Text, NameLabel, CommentSingle), nil}, + Include("redirect/compound"), + {`(?=[\n\x1a])`, Text, Pop(1)}, + {`\|\|?|&&?`, Punctuation, Pop(1)}, + Include("text"), + }, + "arithmetic/compound": { + {`(?=\))`, Text, Pop(1)}, + {`0[0-7]+`, LiteralNumberOct, nil}, + {`0x[\da-f]+`, LiteralNumberHex, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`[(),]+`, Punctuation, nil}, + {`([=+\-*/!~]|%|\^\^)+`, Operator, nil}, + {`((?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(\^[\n\x1a]?)?[^()=+\-*/!~%^"\n\x1a&<>|\t\v\f\r ,;=\xa0]|\^[\n\x1a\t\v\f\r ,;=\xa0]?[^)])+`, UsingSelf("variable"), nil}, + {`(?=[\x00|&])`, Text, Pop(1)}, + Include("follow"), + }, + "call/compound": { + {`(?=\))`, Text, Pop(1)}, + {`(:?)((?:(?:[^\n\x1a&<>|\t\v\f\r ,;=\xa0+:^)]|\^[\n\x1a]?[^)])*))`, ByGroups(Punctuation, NameLabel), Pop(1)}, + }, + "label/compound": { + {`(?=\))`, Text, Pop(1)}, + {`((?:(?:[^\n\x1a&<>|\t\v\f\r ,;=\xa0+:^)]|\^[\n\x1a]?[^)])*)?)((?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|\^[\n\x1a]?[^)]|[^"%^\n\x1a&<>|)])*)`, ByGroups(NameLabel, CommentSingle), Pop(1)}, + }, + "redirect/compound": { + {`((?:(?<=[\n\x1a\t\v\f\r ,;=\xa0])\d)?)(>>?&|<&)([\n\x1a\t\v\f\r ,;=\xa0]*)(\d)`, ByGroups(LiteralNumberInteger, Punctuation, Text, LiteralNumberInteger), nil}, + {`((?:(?<=[\n\x1a\t\v\f\r ,;=\xa0])(?>?|<)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:[&<>|]+|(?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|\t\v\f\r ,;=\xa0)])+))+))`, ByGroups(LiteralNumberInteger, Punctuation, UsingSelf("text")), nil}, + }, + "variable-or-escape": { + {`(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))`, NameVariable, nil}, + {`%%|\^[\n\x1a]?(\^!|[\w\W])`, LiteralStringEscape, nil}, + }, + "string": { + {`"`, LiteralStringDouble, Pop(1)}, + {`(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))`, NameVariable, nil}, + {`\^!|%%`, LiteralStringEscape, nil}, + {`[^"%^\n\x1a]+|[%^]`, LiteralStringDouble, nil}, + Default(Pop(1)), + }, + "sqstring": { + Include("variable-or-escape"), + {`[^%]+|%`, LiteralStringSingle, nil}, + }, + "bqstring": { + Include("variable-or-escape"), + {`[^%]+|%`, LiteralStringBacktick, nil}, + }, + "text": { + {`"`, LiteralStringDouble, Push("string")}, + Include("variable-or-escape"), + {`[^"%^\n\x1a&<>|\t\v\f\r ,;=\xa0\d)]+|.`, Text, nil}, + }, + "variable": { + {`"`, LiteralStringDouble, Push("string")}, + Include("variable-or-escape"), + {`[^"%^\n\x1a]+|.`, NameVariable, nil}, + }, + "for": { + {`((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(in)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(\()`, ByGroups(UsingSelf("text"), Keyword, UsingSelf("text"), Punctuation), Pop(1)}, + Include("follow"), + }, + "for2": { + {`\)`, Punctuation, nil}, + {`((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(do(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))`, ByGroups(UsingSelf("text"), Keyword), Pop(1)}, + {`[\n\x1a]+`, Text, nil}, + Include("follow"), + }, + "for/f": { + {`(")((?:(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[^"])*?")([\n\x1a\t\v\f\r ,;=\xa0]*)(\))`, ByGroups(LiteralStringDouble, UsingSelf("string"), Text, Punctuation), nil}, + {`"`, LiteralStringDouble, Push("#pop", "for2", "string")}, + {`('(?:%%|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[\w\W])*?')([\n\x1a\t\v\f\r ,;=\xa0]*)(\))`, ByGroups(UsingSelf("sqstring"), Text, Punctuation), nil}, + {"(`(?:%%|(?:(?:%(?:\\*|(?:~[a-z]*(?:\\$[^:]+:)?)?\\d|[^%:\\n\\x1a]+(?::(?:~(?:-?\\d+)?(?:,(?:-?\\d+)?)?|(?:[^%\\n\\x1a^]|\\^[^%\\n\\x1a])[^=\\n\\x1a]*=(?:[^%\\n\\x1a^]|\\^[^%\\n\\x1a])*)?)?%))|(?:\\^?![^!:\\n\\x1a]+(?::(?:~(?:-?\\d+)?(?:,(?:-?\\d+)?)?|(?:[^!\\n\\x1a^]|\\^[^!\\n\\x1a])[^=\\n\\x1a]*=(?:[^!\\n\\x1a^]|\\^[^!\\n\\x1a])*)?)?\\^?!))|[\\w\\W])*?`)([\\n\\x1a\\t\\v\\f\\r ,;=\\xa0]*)(\\))", ByGroups(UsingSelf("bqstring"), Text, Punctuation), nil}, + Include("for2"), + }, + "for/l": { + {`-?\d+`, LiteralNumberInteger, nil}, + Include("for2"), + }, + "if": { + {`((?:cmdextversion|errorlevel)(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(\d+)`, ByGroups(Keyword, UsingSelf("text"), LiteralNumberInteger), Pop(1)}, + {`(defined(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))((?:[&<>|]+|(?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|\t\v\f\r ,;=\xa0])+))+))`, ByGroups(Keyword, UsingSelf("text"), UsingSelf("variable")), Pop(1)}, + {`(exist(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)(?:[&<>|]+|(?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|\t\v\f\r ,;=\xa0])+))+))`, ByGroups(Keyword, UsingSelf("text")), Pop(1)}, + {`((?:-?(?:0[0-7]+|0x[\da-f]+|\d+)(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))((?:equ|geq|gtr|leq|lss|neq))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)(?:-?(?:0[0-7]+|0x[\da-f]+|\d+)(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])))`, ByGroups(UsingSelf("arithmetic"), OperatorWord, UsingSelf("arithmetic")), Pop(1)}, + {`(?:[&<>|]+|(?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|\t\v\f\r ,;=\xa0])+))+)`, UsingSelf("text"), Push("#pop", "if2")}, + }, + "if2": { + {`((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)(==)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:[&<>|]+|(?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|\t\v\f\r ,;=\xa0])+))+))`, ByGroups(UsingSelf("text"), Operator, UsingSelf("text")), Pop(1)}, + {`((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))((?:equ|geq|gtr|leq|lss|neq))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)(?:[&<>|]+|(?:(?:"[^\n\x1a"]*(?:"|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^"\n\x1a&<>|\t\v\f\r ,;=\xa0])+))+))`, ByGroups(UsingSelf("text"), OperatorWord, UsingSelf("text")), Pop(1)}, + }, + "(?": { + {`(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)`, UsingSelf("text"), nil}, + {`\(`, Punctuation, Push("#pop", "else?", "root/compound")}, + Default(Pop(1)), + }, + "else?": { + {`(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)`, UsingSelf("text"), nil}, + {`else(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])`, Keyword, Pop(1)}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/b/bibtex.go b/vendor/github.com/alecthomas/chroma/lexers/b/bibtex.go new file mode 100644 index 000000000..1d76b1d80 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/b/bibtex.go @@ -0,0 +1,76 @@ +package b + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Bibtex lexer. +var Bibtex = internal.Register(MustNewLexer( + &Config{ + Name: "BibTeX", + Aliases: []string{"bib", "bibtex"}, + Filenames: []string{"*.bib"}, + MimeTypes: []string{"text/x-bibtex"}, + NotMultiline: true, + CaseInsensitive: true, + }, + Rules{ + "root": { + Include("whitespace"), + {`@comment`, Comment, nil}, + {`@preamble`, NameClass, Push("closing-brace", "value", "opening-brace")}, + {`@string`, NameClass, Push("closing-brace", "field", "opening-brace")}, + {"@[a-z_@!$&*+\\-./:;<>?\\[\\\\\\]^`|~][\\w@!$&*+\\-./:;<>?\\[\\\\\\]^`|~]*", NameClass, Push("closing-brace", "command-body", "opening-brace")}, + {`.+`, Comment, nil}, + }, + "opening-brace": { + Include("whitespace"), + {`[{(]`, Punctuation, Pop(1)}, + }, + "closing-brace": { + Include("whitespace"), + {`[})]`, Punctuation, Pop(1)}, + }, + "command-body": { + Include("whitespace"), + {`[^\s\,\}]+`, NameLabel, Push("#pop", "fields")}, + }, + "fields": { + Include("whitespace"), + {`,`, Punctuation, Push("field")}, + Default(Pop(1)), + }, + "field": { + Include("whitespace"), + {"[a-z_@!$&*+\\-./:;<>?\\[\\\\\\]^`|~][\\w@!$&*+\\-./:;<>?\\[\\\\\\]^`|~]*", NameAttribute, Push("value", "=")}, + Default(Pop(1)), + }, + "=": { + Include("whitespace"), + {`=`, Punctuation, Pop(1)}, + }, + "value": { + Include("whitespace"), + {"[a-z_@!$&*+\\-./:;<>?\\[\\\\\\]^`|~][\\w@!$&*+\\-./:;<>?\\[\\\\\\]^`|~]*", NameVariable, nil}, + {`"`, LiteralString, Push("quoted-string")}, + {`\{`, LiteralString, Push("braced-string")}, + {`[\d]+`, LiteralNumber, nil}, + {`#`, Punctuation, nil}, + Default(Pop(1)), + }, + "quoted-string": { + {`\{`, LiteralString, Push("braced-string")}, + {`"`, LiteralString, Pop(1)}, + {`[^\{\"]+`, LiteralString, nil}, + }, + "braced-string": { + {`\{`, LiteralString, Push()}, + {`\}`, LiteralString, Pop(1)}, + {`[^\{\}]+`, LiteralString, nil}, + }, + "whitespace": { + {`\s+`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/b/blitz.go b/vendor/github.com/alecthomas/chroma/lexers/b/blitz.go new file mode 100644 index 000000000..5d5ffc852 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/b/blitz.go @@ -0,0 +1,48 @@ +package b + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Blitzbasic lexer. +var Blitzbasic = internal.Register(MustNewLexer( + &Config{ + Name: "BlitzBasic", + Aliases: []string{"blitzbasic", "b3d", "bplus"}, + Filenames: []string{"*.bb", "*.decls"}, + MimeTypes: []string{"text/x-bb"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`[ \t]+`, Text, nil}, + {`;.*?\n`, CommentSingle, nil}, + {`"`, LiteralStringDouble, Push("string")}, + {`[0-9]+\.[0-9]*(?!\.)`, LiteralNumberFloat, nil}, + {`\.[0-9]+(?!\.)`, LiteralNumberFloat, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`\$[0-9a-f]+`, LiteralNumberHex, nil}, + {`\%[10]+`, LiteralNumberBin, nil}, + {Words(`\b`, `\b`, `Shl`, `Shr`, `Sar`, `Mod`, `Or`, `And`, `Not`, `Abs`, `Sgn`, `Handle`, `Int`, `Float`, `Str`, `First`, `Last`, `Before`, `After`), Operator, nil}, + {`([+\-*/~=<>^])`, Operator, nil}, + {`[(),:\[\]\\]`, Punctuation, nil}, + {`\.([ \t]*)([a-z]\w*)`, NameLabel, nil}, + {`\b(New)\b([ \t]+)([a-z]\w*)`, ByGroups(KeywordReserved, Text, NameClass), nil}, + {`\b(Gosub|Goto)\b([ \t]+)([a-z]\w*)`, ByGroups(KeywordReserved, Text, NameLabel), nil}, + {`\b(Object)\b([ \t]*)([.])([ \t]*)([a-z]\w*)\b`, ByGroups(Operator, Text, Punctuation, Text, NameClass), nil}, + {`\b([a-z]\w*)(?:([ \t]*)(@{1,2}|[#$%])|([ \t]*)([.])([ \t]*)(?:([a-z]\w*)))?\b([ \t]*)(\()`, ByGroups(NameFunction, Text, KeywordType, Text, Punctuation, Text, NameClass, Text, Punctuation), nil}, + {`\b(Function)\b([ \t]+)([a-z]\w*)(?:([ \t]*)(@{1,2}|[#$%])|([ \t]*)([.])([ \t]*)(?:([a-z]\w*)))?`, ByGroups(KeywordReserved, Text, NameFunction, Text, KeywordType, Text, Punctuation, Text, NameClass), nil}, + {`\b(Type)([ \t]+)([a-z]\w*)`, ByGroups(KeywordReserved, Text, NameClass), nil}, + {`\b(Pi|True|False|Null)\b`, KeywordConstant, nil}, + {`\b(Local|Global|Const|Field|Dim)\b`, KeywordDeclaration, nil}, + {Words(`\b`, `\b`, `End`, `Return`, `Exit`, `Chr`, `Len`, `Asc`, `New`, `Delete`, `Insert`, `Include`, `Function`, `Type`, `If`, `Then`, `Else`, `ElseIf`, `EndIf`, `For`, `To`, `Next`, `Step`, `Each`, `While`, `Wend`, `Repeat`, `Until`, `Forever`, `Select`, `Case`, `Default`, `Goto`, `Gosub`, `Data`, `Read`, `Restore`), KeywordReserved, nil}, + {`([a-z]\w*)(?:([ \t]*)(@{1,2}|[#$%])|([ \t]*)([.])([ \t]*)(?:([a-z]\w*)))?`, ByGroups(NameVariable, Text, KeywordType, Text, Punctuation, Text, NameClass), nil}, + }, + "string": { + {`""`, LiteralStringDouble, nil}, + {`"C?`, LiteralStringDouble, Pop(1)}, + {`[^"]+`, LiteralStringDouble, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/b/bnf.go b/vendor/github.com/alecthomas/chroma/lexers/b/bnf.go new file mode 100644 index 000000000..5123a45aa --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/b/bnf.go @@ -0,0 +1,24 @@ +package b + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Bnf lexer. +var Bnf = internal.Register(MustNewLexer( + &Config{ + Name: "BNF", + Aliases: []string{"bnf"}, + Filenames: []string{"*.bnf"}, + MimeTypes: []string{"text/x-bnf"}, + }, + Rules{ + "root": { + {`(<)([ -;=?-~]+)(>)`, ByGroups(Punctuation, NameClass, Punctuation), nil}, + {`::=`, Operator, nil}, + {`[^<>:]+`, Text, nil}, + {`.`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/b/brainfuck.go b/vendor/github.com/alecthomas/chroma/lexers/b/brainfuck.go new file mode 100644 index 000000000..6fac5f5e8 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/b/brainfuck.go @@ -0,0 +1,34 @@ +package b + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Brainfuck lexer. +var Brainfuck = internal.Register(MustNewLexer( + &Config{ + Name: "Brainfuck", + Aliases: []string{"brainfuck", "bf"}, + Filenames: []string{"*.bf", "*.b"}, + MimeTypes: []string{"application/x-brainfuck"}, + }, + Rules{ + "common": { + {`[.,]+`, NameTag, nil}, + {`[+-]+`, NameBuiltin, nil}, + {`[<>]+`, NameVariable, nil}, + {`[^.,+\-<>\[\]]+`, Comment, nil}, + }, + "root": { + {`\[`, Keyword, Push("loop")}, + {`\]`, Error, nil}, + Include("common"), + }, + "loop": { + {`\[`, Keyword, Push()}, + {`\]`, Keyword, Pop(1)}, + Include("common"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/c.go b/vendor/github.com/alecthomas/chroma/lexers/c/c.go new file mode 100644 index 000000000..df2c0faac --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/c.go @@ -0,0 +1,91 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// C lexer. +var C = internal.Register(MustNewLexer( + &Config{ + Name: "C", + Aliases: []string{"c"}, + Filenames: []string{"*.c", "*.h", "*.idc"}, + MimeTypes: []string{"text/x-chdr", "text/x-csrc"}, + }, + Rules{ + "whitespace": { + {`^#if\s+0`, CommentPreproc, Push("if0")}, + {`^#`, CommentPreproc, Push("macro")}, + {`^(\s*(?:/[*].*?[*]/\s*)?)(#if\s+0)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("if0")}, + {`^(\s*(?:/[*].*?[*]/\s*)?)(#)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("macro")}, + {`\n`, Text, nil}, + {`\s+`, Text, nil}, + {`\\\n`, Text, nil}, + {`//(\n|[\w\W]*?[^\\]\n)`, CommentSingle, nil}, + {`/(\\\n)?[*][\w\W]*?[*](\\\n)?/`, CommentMultiline, nil}, + {`/(\\\n)?[*][\w\W]*`, CommentMultiline, nil}, + }, + "statements": { + {`(L?)(")`, ByGroups(LiteralStringAffix, LiteralString), Push("string")}, + {`(L?)(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')`, ByGroups(LiteralStringAffix, LiteralStringChar, LiteralStringChar, LiteralStringChar), nil}, + {`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*`, LiteralNumberFloat, nil}, + {`(\d+\.\d*|\.\d+|\d+[fF])[fF]?`, LiteralNumberFloat, nil}, + {`0x[0-9a-fA-F]+[LlUu]*`, LiteralNumberHex, nil}, + {`0[0-7]+[LlUu]*`, LiteralNumberOct, nil}, + {`\d+[LlUu]*`, LiteralNumberInteger, nil}, + {`\*/`, Error, nil}, + {`[~!%^&*+=|?:<>/-]`, Operator, nil}, + {`[()\[\],.]`, Punctuation, nil}, + {Words(``, `\b`, `asm`, `auto`, `break`, `case`, `const`, `continue`, `default`, `do`, `else`, `enum`, `extern`, `for`, `goto`, `if`, `register`, `restricted`, `return`, `sizeof`, `static`, `struct`, `switch`, `typedef`, `union`, `volatile`, `while`), Keyword, nil}, + {`(bool|int|long|float|short|double|char|unsigned|signed|void)\b`, KeywordType, nil}, + {Words(``, `\b`, `inline`, `_inline`, `__inline`, `naked`, `restrict`, `thread`, `typename`), KeywordReserved, nil}, + {`(__m(128i|128d|128|64))\b`, KeywordReserved, nil}, + {Words(`__`, `\b`, `asm`, `int8`, `based`, `except`, `int16`, `stdcall`, `cdecl`, `fastcall`, `int32`, `declspec`, `finally`, `int64`, `try`, `leave`, `wchar_t`, `w64`, `unaligned`, `raise`, `noop`, `identifier`, `forceinline`, `assume`), KeywordReserved, nil}, + {`(true|false|NULL)\b`, NameBuiltin, nil}, + {`([a-zA-Z_]\w*)(\s*)(:)(?!:)`, ByGroups(NameLabel, Text, Punctuation), nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + }, + "root": { + Include("whitespace"), + {`((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;{]*)(\{)`, ByGroups(UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), Push("function")}, + {`((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;]*)(;)`, ByGroups(UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), nil}, + Default(Push("statement")), + }, + "statement": { + Include("whitespace"), + Include("statements"), + {`[{}]`, Punctuation, nil}, + {`;`, Punctuation, Pop(1)}, + }, + "function": { + Include("whitespace"), + Include("statements"), + {`;`, Punctuation, nil}, + {`\{`, Punctuation, Push()}, + {`\}`, Punctuation, Pop(1)}, + }, + "string": { + {`"`, LiteralString, Pop(1)}, + {`\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})`, LiteralStringEscape, nil}, + {`[^\\"\n]+`, LiteralString, nil}, + {`\\\n`, LiteralString, nil}, + {`\\`, LiteralString, nil}, + }, + "macro": { + {`(include)(\s*(?:/[*].*?[*]/\s*)?)([^\n]+)`, ByGroups(CommentPreproc, Text, CommentPreprocFile), nil}, + {`[^/\n]+`, CommentPreproc, nil}, + {`/[*](.|\n)*?[*]/`, CommentMultiline, nil}, + {`//.*?\n`, CommentSingle, Pop(1)}, + {`/`, CommentPreproc, nil}, + {`(?<=\\)\n`, CommentPreproc, nil}, + {`\n`, CommentPreproc, Pop(1)}, + }, + "if0": { + {`^\s*#if.*?(?|+=:;,./?-]`, Operator, nil}, + {`\d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?`, LiteralNumberFloat, nil}, + {`\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?`, LiteralNumberFloat, nil}, + {`[0-9][0-9]*\.\d{1,3}(_\d{3})+[kMGTPmunpf]?`, LiteralNumberFloat, nil}, + {`[0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?`, LiteralNumberFloat, nil}, + {`#([0-9a-fA-F]{4})(_[0-9a-fA-F]{4})+`, LiteralNumberHex, nil}, + {`#[0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`\$([01]{4})(_[01]{4})+`, LiteralNumberBin, nil}, + {`\$[01]+`, LiteralNumberBin, nil}, + {`\d{1,3}(_\d{3})+[kMGTP]?`, LiteralNumberInteger, nil}, + {`[0-9]+[kMGTP]?`, LiteralNumberInteger, nil}, + {`\n`, Text, nil}, + }, + "class": { + {`[A-Za-z_]\w*`, NameClass, Pop(1)}, + }, + "import": { + {`[a-z][\w.]*`, NameNamespace, Pop(1)}, + }, + "comment": { + {`[^*/]`, CommentMultiline, nil}, + {`/\*`, CommentMultiline, Push()}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[*/]`, CommentMultiline, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go b/vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go new file mode 100644 index 000000000..f96252fa4 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go @@ -0,0 +1,56 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Cfengine3 lexer. +var Cfengine3 = internal.Register(MustNewLexer( + &Config{ + Name: "CFEngine3", + Aliases: []string{"cfengine3", "cf3"}, + Filenames: []string{"*.cf"}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`#.*?\n`, Comment, nil}, + {`(body)(\s+)(\S+)(\s+)(control)`, ByGroups(Keyword, Text, Keyword, Text, Keyword), nil}, + {`(body|bundle)(\s+)(\S+)(\s+)(\w+)(\()`, ByGroups(Keyword, Text, Keyword, Text, NameFunction, Punctuation), Push("arglist")}, + {`(body|bundle)(\s+)(\S+)(\s+)(\w+)`, ByGroups(Keyword, Text, Keyword, Text, NameFunction), nil}, + {`(")([^"]+)(")(\s+)(string|slist|int|real)(\s*)(=>)(\s*)`, ByGroups(Punctuation, NameVariable, Punctuation, Text, KeywordType, Text, Operator, Text), nil}, + {`(\S+)(\s*)(=>)(\s*)`, ByGroups(KeywordReserved, Text, Operator, Text), nil}, + {`"`, LiteralString, Push("string")}, + {`(\w+)(\()`, ByGroups(NameFunction, Punctuation), nil}, + {`([\w.!&|()]+)(::)`, ByGroups(NameClass, Punctuation), nil}, + {`(\w+)(:)`, ByGroups(KeywordDeclaration, Punctuation), nil}, + {`@[{(][^)}]+[})]`, NameVariable, nil}, + {`[(){},;]`, Punctuation, nil}, + {`=>`, Operator, nil}, + {`->`, Operator, nil}, + {`\d+\.\d+`, LiteralNumberFloat, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`\w+`, NameFunction, nil}, + {`\s+`, Text, nil}, + }, + "string": { + {`\$[{(]`, LiteralStringInterpol, Push("interpol")}, + {`\\.`, LiteralStringEscape, nil}, + {`"`, LiteralString, Pop(1)}, + {`\n`, LiteralString, nil}, + {`.`, LiteralString, nil}, + }, + "interpol": { + {`\$[{(]`, LiteralStringInterpol, Push()}, + {`[})]`, LiteralStringInterpol, Pop(1)}, + {`[^${()}]+`, LiteralStringInterpol, nil}, + }, + "arglist": { + {`\)`, Punctuation, Pop(1)}, + {`,`, Punctuation, nil}, + {`\w+`, NameVariable, nil}, + {`\s+`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go b/vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go new file mode 100644 index 000000000..d2aa50db6 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go @@ -0,0 +1,63 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Chaiscript lexer. +var Chaiscript = internal.Register(MustNewLexer( + &Config{ + Name: "ChaiScript", + Aliases: []string{"chai", "chaiscript"}, + Filenames: []string{"*.chai"}, + MimeTypes: []string{"text/x-chaiscript", "application/x-chaiscript"}, + DotAll: true, + }, + Rules{ + "commentsandwhitespace": { + {`\s+`, Text, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/\*.*?\*/`, CommentMultiline, nil}, + {`^\#.*?\n`, CommentSingle, nil}, + }, + "slashstartsregex": { + Include("commentsandwhitespace"), + {`/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)`, LiteralStringRegex, Pop(1)}, + {`(?=/)`, Text, Push("#pop", "badregex")}, + Default(Pop(1)), + }, + "badregex": { + {`\n`, Text, Pop(1)}, + }, + "root": { + Include("commentsandwhitespace"), + {`\n`, Text, nil}, + {`[^\S\n]+`, Text, nil}, + {`\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|\.\.(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?`, Operator, Push("slashstartsregex")}, + {`[{(\[;,]`, Punctuation, Push("slashstartsregex")}, + {`[})\].]`, Punctuation, nil}, + {`[=+\-*/]`, Operator, nil}, + {`(for|in|while|do|break|return|continue|if|else|throw|try|catch)\b`, Keyword, Push("slashstartsregex")}, + {`(var)\b`, KeywordDeclaration, Push("slashstartsregex")}, + {`(attr|def|fun)\b`, KeywordReserved, nil}, + {`(true|false)\b`, KeywordConstant, nil}, + {`(eval|throw)\b`, NameBuiltin, nil}, + {"`\\S+`", NameBuiltin, nil}, + {`[$a-zA-Z_]\w*`, NameOther, nil}, + {`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil}, + {`0x[0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`"`, LiteralStringDouble, Push("dqstring")}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + }, + "dqstring": { + {`\$\{[^"}]+?\}`, LiteralStringInterpol, nil}, + {`\$`, LiteralStringDouble, nil}, + {`\\\\`, LiteralStringDouble, nil}, + {`\\"`, LiteralStringDouble, nil}, + {`[^\\"$]+`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go b/vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go new file mode 100644 index 000000000..b2cb9c406 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go @@ -0,0 +1,37 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" + . "github.com/alecthomas/chroma/lexers/p" // nolint +) + +// Cheetah lexer. +var Cheetah = internal.Register(MustNewLexer( + &Config{ + Name: "Cheetah", + Aliases: []string{"cheetah", "spitfire"}, + Filenames: []string{"*.tmpl", "*.spt"}, + MimeTypes: []string{"application/x-cheetah", "application/x-spitfire"}, + }, + Rules{ + "root": { + {`(##[^\n]*)$`, ByGroups(Comment), nil}, + {`#[*](.|\n)*?[*]#`, Comment, nil}, + {`#end[^#\n]*(?:#|$)`, CommentPreproc, nil}, + {`#slurp$`, CommentPreproc, nil}, + {`(#[a-zA-Z]+)([^#\n]*)(#|$)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil}, + {`(\$)([a-zA-Z_][\w.]*\w)`, ByGroups(CommentPreproc, Using(Python)), nil}, + {`(\$\{!?)(.*?)(\})(?s)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil}, + {`(?sx) + (.+?) # anything, followed by: + (?: + (?=\#[#a-zA-Z]*) | # an eval comment + (?=\$[a-zA-Z_{]) | # a substitution + \Z # end of string + ) + `, Other, nil}, + {`\s+`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/cl.go b/vendor/github.com/alecthomas/chroma/lexers/c/cl.go new file mode 100644 index 000000000..fdc972976 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/cl.go @@ -0,0 +1,306 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +var ( + clBuiltinFunctions = []string{ + "<", "<=", "=", ">", ">=", "-", "/", "/=", "*", "+", "1-", "1+", + "abort", "abs", "acons", "acos", "acosh", "add-method", "adjoin", + "adjustable-array-p", "adjust-array", "allocate-instance", + "alpha-char-p", "alphanumericp", "append", "apply", "apropos", + "apropos-list", "aref", "arithmetic-error-operands", + "arithmetic-error-operation", "array-dimension", "array-dimensions", + "array-displacement", "array-element-type", "array-has-fill-pointer-p", + "array-in-bounds-p", "arrayp", "array-rank", "array-row-major-index", + "array-total-size", "ash", "asin", "asinh", "assoc", "assoc-if", + "assoc-if-not", "atan", "atanh", "atom", "bit", "bit-and", "bit-andc1", + "bit-andc2", "bit-eqv", "bit-ior", "bit-nand", "bit-nor", "bit-not", + "bit-orc1", "bit-orc2", "bit-vector-p", "bit-xor", "boole", + "both-case-p", "boundp", "break", "broadcast-stream-streams", + "butlast", "byte", "byte-position", "byte-size", "caaaar", "caaadr", + "caaar", "caadar", "caaddr", "caadr", "caar", "cadaar", "cadadr", + "cadar", "caddar", "cadddr", "caddr", "cadr", "call-next-method", "car", + "cdaaar", "cdaadr", "cdaar", "cdadar", "cdaddr", "cdadr", "cdar", + "cddaar", "cddadr", "cddar", "cdddar", "cddddr", "cdddr", "cddr", "cdr", + "ceiling", "cell-error-name", "cerror", "change-class", "char", "char<", + "char<=", "char=", "char>", "char>=", "char/=", "character", + "characterp", "char-code", "char-downcase", "char-equal", + "char-greaterp", "char-int", "char-lessp", "char-name", + "char-not-equal", "char-not-greaterp", "char-not-lessp", "char-upcase", + "cis", "class-name", "class-of", "clear-input", "clear-output", + "close", "clrhash", "code-char", "coerce", "compile", + "compiled-function-p", "compile-file", "compile-file-pathname", + "compiler-macro-function", "complement", "complex", "complexp", + "compute-applicable-methods", "compute-restarts", "concatenate", + "concatenated-stream-streams", "conjugate", "cons", "consp", + "constantly", "constantp", "continue", "copy-alist", "copy-list", + "copy-pprint-dispatch", "copy-readtable", "copy-seq", "copy-structure", + "copy-symbol", "copy-tree", "cos", "cosh", "count", "count-if", + "count-if-not", "decode-float", "decode-universal-time", "delete", + "delete-duplicates", "delete-file", "delete-if", "delete-if-not", + "delete-package", "denominator", "deposit-field", "describe", + "describe-object", "digit-char", "digit-char-p", "directory", + "directory-namestring", "disassemble", "documentation", "dpb", + "dribble", "echo-stream-input-stream", "echo-stream-output-stream", + "ed", "eighth", "elt", "encode-universal-time", "endp", + "enough-namestring", "ensure-directories-exist", + "ensure-generic-function", "eq", "eql", "equal", "equalp", "error", + "eval", "evenp", "every", "exp", "export", "expt", "fboundp", + "fceiling", "fdefinition", "ffloor", "fifth", "file-author", + "file-error-pathname", "file-length", "file-namestring", + "file-position", "file-string-length", "file-write-date", + "fill", "fill-pointer", "find", "find-all-symbols", "find-class", + "find-if", "find-if-not", "find-method", "find-package", "find-restart", + "find-symbol", "finish-output", "first", "float", "float-digits", + "floatp", "float-precision", "float-radix", "float-sign", "floor", + "fmakunbound", "force-output", "format", "fourth", "fresh-line", + "fround", "ftruncate", "funcall", "function-keywords", + "function-lambda-expression", "functionp", "gcd", "gensym", "gentemp", + "get", "get-decoded-time", "get-dispatch-macro-character", "getf", + "gethash", "get-internal-real-time", "get-internal-run-time", + "get-macro-character", "get-output-stream-string", "get-properties", + "get-setf-expansion", "get-universal-time", "graphic-char-p", + "hash-table-count", "hash-table-p", "hash-table-rehash-size", + "hash-table-rehash-threshold", "hash-table-size", "hash-table-test", + "host-namestring", "identity", "imagpart", "import", + "initialize-instance", "input-stream-p", "inspect", + "integer-decode-float", "integer-length", "integerp", + "interactive-stream-p", "intern", "intersection", + "invalid-method-error", "invoke-debugger", "invoke-restart", + "invoke-restart-interactively", "isqrt", "keywordp", "last", "lcm", + "ldb", "ldb-test", "ldiff", "length", "lisp-implementation-type", + "lisp-implementation-version", "list", "list*", "list-all-packages", + "listen", "list-length", "listp", "load", + "load-logical-pathname-translations", "log", "logand", "logandc1", + "logandc2", "logbitp", "logcount", "logeqv", "logical-pathname", + "logical-pathname-translations", "logior", "lognand", "lognor", + "lognot", "logorc1", "logorc2", "logtest", "logxor", "long-site-name", + "lower-case-p", "machine-instance", "machine-type", "machine-version", + "macroexpand", "macroexpand-1", "macro-function", "make-array", + "make-broadcast-stream", "make-concatenated-stream", "make-condition", + "make-dispatch-macro-character", "make-echo-stream", "make-hash-table", + "make-instance", "make-instances-obsolete", "make-list", + "make-load-form", "make-load-form-saving-slots", "make-package", + "make-pathname", "make-random-state", "make-sequence", "make-string", + "make-string-input-stream", "make-string-output-stream", "make-symbol", + "make-synonym-stream", "make-two-way-stream", "makunbound", "map", + "mapc", "mapcan", "mapcar", "mapcon", "maphash", "map-into", "mapl", + "maplist", "mask-field", "max", "member", "member-if", "member-if-not", + "merge", "merge-pathnames", "method-combination-error", + "method-qualifiers", "min", "minusp", "mismatch", "mod", + "muffle-warning", "name-char", "namestring", "nbutlast", "nconc", + "next-method-p", "nintersection", "ninth", "no-applicable-method", + "no-next-method", "not", "notany", "notevery", "nreconc", "nreverse", + "nset-difference", "nset-exclusive-or", "nstring-capitalize", + "nstring-downcase", "nstring-upcase", "nsublis", "nsubst", "nsubst-if", + "nsubst-if-not", "nsubstitute", "nsubstitute-if", "nsubstitute-if-not", + "nth", "nthcdr", "null", "numberp", "numerator", "nunion", "oddp", + "open", "open-stream-p", "output-stream-p", "package-error-package", + "package-name", "package-nicknames", "packagep", + "package-shadowing-symbols", "package-used-by-list", "package-use-list", + "pairlis", "parse-integer", "parse-namestring", "pathname", + "pathname-device", "pathname-directory", "pathname-host", + "pathname-match-p", "pathname-name", "pathnamep", "pathname-type", + "pathname-version", "peek-char", "phase", "plusp", "position", + "position-if", "position-if-not", "pprint", "pprint-dispatch", + "pprint-fill", "pprint-indent", "pprint-linear", "pprint-newline", + "pprint-tab", "pprint-tabular", "prin1", "prin1-to-string", "princ", + "princ-to-string", "print", "print-object", "probe-file", "proclaim", + "provide", "random", "random-state-p", "rassoc", "rassoc-if", + "rassoc-if-not", "rational", "rationalize", "rationalp", "read", + "read-byte", "read-char", "read-char-no-hang", "read-delimited-list", + "read-from-string", "read-line", "read-preserving-whitespace", + "read-sequence", "readtable-case", "readtablep", "realp", "realpart", + "reduce", "reinitialize-instance", "rem", "remhash", "remove", + "remove-duplicates", "remove-if", "remove-if-not", "remove-method", + "remprop", "rename-file", "rename-package", "replace", "require", + "rest", "restart-name", "revappend", "reverse", "room", "round", + "row-major-aref", "rplaca", "rplacd", "sbit", "scale-float", "schar", + "search", "second", "set", "set-difference", + "set-dispatch-macro-character", "set-exclusive-or", + "set-macro-character", "set-pprint-dispatch", "set-syntax-from-char", + "seventh", "shadow", "shadowing-import", "shared-initialize", + "short-site-name", "signal", "signum", "simple-bit-vector-p", + "simple-condition-format-arguments", "simple-condition-format-control", + "simple-string-p", "simple-vector-p", "sin", "sinh", "sixth", "sleep", + "slot-boundp", "slot-exists-p", "slot-makunbound", "slot-missing", + "slot-unbound", "slot-value", "software-type", "software-version", + "some", "sort", "special-operator-p", "sqrt", "stable-sort", + "standard-char-p", "store-value", "stream-element-type", + "stream-error-stream", "stream-external-format", "streamp", "string", + "string<", "string<=", "string=", "string>", "string>=", "string/=", + "string-capitalize", "string-downcase", "string-equal", + "string-greaterp", "string-left-trim", "string-lessp", + "string-not-equal", "string-not-greaterp", "string-not-lessp", + "stringp", "string-right-trim", "string-trim", "string-upcase", + "sublis", "subseq", "subsetp", "subst", "subst-if", "subst-if-not", + "substitute", "substitute-if", "substitute-if-not", "subtypep", "svref", + "sxhash", "symbol-function", "symbol-name", "symbolp", "symbol-package", + "symbol-plist", "symbol-value", "synonym-stream-symbol", "syntax:", + "tailp", "tan", "tanh", "tenth", "terpri", "third", + "translate-logical-pathname", "translate-pathname", "tree-equal", + "truename", "truncate", "two-way-stream-input-stream", + "two-way-stream-output-stream", "type-error-datum", + "type-error-expected-type", "type-of", "typep", "unbound-slot-instance", + "unexport", "unintern", "union", "unread-char", "unuse-package", + "update-instance-for-different-class", + "update-instance-for-redefined-class", "upgraded-array-element-type", + "upgraded-complex-part-type", "upper-case-p", "use-package", + "user-homedir-pathname", "use-value", "values", "values-list", "vector", + "vectorp", "vector-pop", "vector-push", "vector-push-extend", "warn", + "wild-pathname-p", "write", "write-byte", "write-char", "write-line", + "write-sequence", "write-string", "write-to-string", "yes-or-no-p", + "y-or-n-p", "zerop", + } + + clSpecialForms = []string{ + "block", "catch", "declare", "eval-when", "flet", "function", "go", "if", + "labels", "lambda", "let", "let*", "load-time-value", "locally", "macrolet", + "multiple-value-call", "multiple-value-prog1", "progn", "progv", "quote", + "return-from", "setq", "symbol-macrolet", "tagbody", "the", "throw", + "unwind-protect", + } + + clMacros = []string{ + "and", "assert", "call-method", "case", "ccase", "check-type", "cond", + "ctypecase", "decf", "declaim", "defclass", "defconstant", "defgeneric", + "define-compiler-macro", "define-condition", "define-method-combination", + "define-modify-macro", "define-setf-expander", "define-symbol-macro", + "defmacro", "defmethod", "defpackage", "defparameter", "defsetf", + "defstruct", "deftype", "defun", "defvar", "destructuring-bind", "do", + "do*", "do-all-symbols", "do-external-symbols", "dolist", "do-symbols", + "dotimes", "ecase", "etypecase", "formatter", "handler-bind", + "handler-case", "ignore-errors", "incf", "in-package", "lambda", "loop", + "loop-finish", "make-method", "multiple-value-bind", "multiple-value-list", + "multiple-value-setq", "nth-value", "or", "pop", + "pprint-exit-if-list-exhausted", "pprint-logical-block", "pprint-pop", + "print-unreadable-object", "prog", "prog*", "prog1", "prog2", "psetf", + "psetq", "push", "pushnew", "remf", "restart-bind", "restart-case", + "return", "rotatef", "setf", "shiftf", "step", "time", "trace", "typecase", + "unless", "untrace", "when", "with-accessors", "with-compilation-unit", + "with-condition-restarts", "with-hash-table-iterator", + "with-input-from-string", "with-open-file", "with-open-stream", + "with-output-to-string", "with-package-iterator", "with-simple-restart", + "with-slots", "with-standard-io-syntax", + } + + clLambdaListKeywords = []string{ + "&allow-other-keys", "&aux", "&body", "&environment", "&key", "&optional", + "&rest", "&whole", + } + + clDeclarations = []string{ + "dynamic-extent", "ignore", "optimize", "ftype", "inline", "special", + "ignorable", "notinline", "type", + } + + clBuiltinTypes = []string{ + "atom", "boolean", "base-char", "base-string", "bignum", "bit", + "compiled-function", "extended-char", "fixnum", "keyword", "nil", + "signed-byte", "short-float", "single-float", "double-float", "long-float", + "simple-array", "simple-base-string", "simple-bit-vector", "simple-string", + "simple-vector", "standard-char", "unsigned-byte", + + // Condition Types + "arithmetic-error", "cell-error", "condition", "control-error", + "division-by-zero", "end-of-file", "error", "file-error", + "floating-point-inexact", "floating-point-overflow", + "floating-point-underflow", "floating-point-invalid-operation", + "parse-error", "package-error", "print-not-readable", "program-error", + "reader-error", "serious-condition", "simple-condition", "simple-error", + "simple-type-error", "simple-warning", "stream-error", "storage-condition", + "style-warning", "type-error", "unbound-variable", "unbound-slot", + "undefined-function", "warning", + } + + clBuiltinClasses = []string{ + "array", "broadcast-stream", "bit-vector", "built-in-class", "character", + "class", "complex", "concatenated-stream", "cons", "echo-stream", + "file-stream", "float", "function", "generic-function", "hash-table", + "integer", "list", "logical-pathname", "method-combination", "method", + "null", "number", "package", "pathname", "ratio", "rational", "readtable", + "real", "random-state", "restart", "sequence", "standard-class", + "standard-generic-function", "standard-method", "standard-object", + "string-stream", "stream", "string", "structure-class", "structure-object", + "symbol", "synonym-stream", "t", "two-way-stream", "vector", + } +) + +// Common Lisp lexer. +var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLexer( + &Config{ + Name: "Common Lisp", + Aliases: []string{"common-lisp", "cl", "lisp"}, + Filenames: []string{"*.cl", "*.lisp"}, + MimeTypes: []string{"text/x-common-lisp"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + Default(Push("body")), + }, + "multiline-comment": { + {`#\|`, CommentMultiline, Push()}, + {`\|#`, CommentMultiline, Pop(1)}, + {`[^|#]+`, CommentMultiline, nil}, + {`[|#]`, CommentMultiline, nil}, + }, + "commented-form": { + {`\(`, CommentPreproc, Push()}, + {`\)`, CommentPreproc, Pop(1)}, + {`[^()]+`, CommentPreproc, nil}, + }, + "body": { + {`\s+`, Text, nil}, + {`;.*$`, CommentSingle, nil}, + {`#\|`, CommentMultiline, Push("multiline-comment")}, + {`#\d*Y.*$`, CommentSpecial, nil}, + {`"(\\.|\\\n|[^"\\])*"`, LiteralString, nil}, + {`:(\|[^|]+\||(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~])(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~]|[#.:])*)`, LiteralStringSymbol, nil}, + {`::(\|[^|]+\||(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~])(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~]|[#.:])*)`, LiteralStringSymbol, nil}, + {`:#(\|[^|]+\||(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~])(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~]|[#.:])*)`, LiteralStringSymbol, nil}, + {`'(\|[^|]+\||(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~])(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~]|[#.:])*)`, LiteralStringSymbol, nil}, + {`'`, Operator, nil}, + {"`", Operator, nil}, + {"[-+]?\\d+\\.?(?=[ \"()\\'\\n,;`])", LiteralNumberInteger, nil}, + {"[-+]?\\d+/\\d+(?=[ \"()\\'\\n,;`])", LiteralNumber, nil}, + {"[-+]?(\\d*\\.\\d+([defls][-+]?\\d+)?|\\d+(\\.\\d*)?[defls][-+]?\\d+)(?=[ \"()\\'\\n,;`])", LiteralNumberFloat, nil}, + {"#\\\\.(?=[ \"()\\'\\n,;`])", LiteralStringChar, nil}, + {`#\\(\|[^|]+\||(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~])(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~]|[#.:])*)`, LiteralStringChar, nil}, + {`#\(`, Operator, Push("body")}, + {`#\d*\*[01]*`, LiteralOther, nil}, + {`#:(\|[^|]+\||(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~])(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~]|[#.:])*)`, LiteralStringSymbol, nil}, + {`#[.,]`, Operator, nil}, + {`#\'`, NameFunction, nil}, + {`#b[+-]?[01]+(/[01]+)?`, LiteralNumberBin, nil}, + {`#o[+-]?[0-7]+(/[0-7]+)?`, LiteralNumberOct, nil}, + {`#x[+-]?[0-9a-f]+(/[0-9a-f]+)?`, LiteralNumberHex, nil}, + {`#\d+r[+-]?[0-9a-z]+(/[0-9a-z]+)?`, LiteralNumber, nil}, + {`(#c)(\()`, ByGroups(LiteralNumber, Punctuation), Push("body")}, + {`(#\d+a)(\()`, ByGroups(LiteralOther, Punctuation), Push("body")}, + {`(#s)(\()`, ByGroups(LiteralOther, Punctuation), Push("body")}, + {`#p?"(\\.|[^"])*"`, LiteralOther, nil}, + {`#\d+=`, Operator, nil}, + {`#\d+#`, Operator, nil}, + {"#+nil(?=[ \"()\\'\\n,;`])\\s*\\(", CommentPreproc, Push("commented-form")}, + {`#[+-]`, Operator, nil}, + {`(,@|,|\.)`, Operator, nil}, + {"(t|nil)(?=[ \"()\\'\\n,;`])", NameConstant, nil}, + {`\*(\|[^|]+\||(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~])(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~]|[#.:])*)\*`, NameVariableGlobal, nil}, + {`(\|[^|]+\||(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~])(?:\\.|[\w!$%&*+-/<=>?@\[\]^{}~]|[#.:])*)`, NameVariable, nil}, + {`\(`, Punctuation, Push("body")}, + {`\)`, Punctuation, Pop(1)}, + }, + }, +), TypeMapping{ + {NameVariable, NameFunction, clBuiltinFunctions}, + {NameVariable, Keyword, clSpecialForms}, + {NameVariable, NameBuiltin, clMacros}, + {NameVariable, Keyword, clLambdaListKeywords}, + {NameVariable, Keyword, clDeclarations}, + {NameVariable, KeywordType, clBuiltinTypes}, + {NameVariable, NameClass, clBuiltinClasses}, +})) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/clojure.go b/vendor/github.com/alecthomas/chroma/lexers/c/clojure.go new file mode 100644 index 000000000..e63752a5d --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/clojure.go @@ -0,0 +1,38 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Clojure lexer. +var Clojure = internal.Register(MustNewLexer( + &Config{ + Name: "Clojure", + Aliases: []string{"clojure", "clj"}, + Filenames: []string{"*.clj"}, + MimeTypes: []string{"text/x-clojure", "application/x-clojure"}, + }, + Rules{ + "root": { + {`;.*$`, CommentSingle, nil}, + {`[,\s]+`, Text, nil}, + {`-?\d+\.\d+`, LiteralNumberFloat, nil}, + {`-?\d+`, LiteralNumberInteger, nil}, + {`0x-?[abcdef\d]+`, LiteralNumberHex, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`'(?!#)[\w!$%*+<=>?/.#-]+`, LiteralStringSymbol, nil}, + {`\\(.|[a-z]+)`, LiteralStringChar, nil}, + {`::?#?(?!#)[\w!$%*+<=>?/.#-]+`, LiteralStringSymbol, nil}, + {"~@|[`\\'#^~&@]", Operator, nil}, + {Words(``, ` `, `.`, `def`, `do`, `fn`, `if`, `let`, `new`, `quote`, `var`, `loop`), Keyword, nil}, + {Words(``, ` `, `def-`, `defn`, `defn-`, `defmacro`, `defmulti`, `defmethod`, `defstruct`, `defonce`, `declare`, `definline`, `definterface`, `defprotocol`, `defrecord`, `deftype`, `defproject`, `ns`), KeywordDeclaration, nil}, + {Words(``, ` `, `*`, `+`, `-`, `->`, `/`, `<`, `<=`, `=`, `==`, `>`, `>=`, `..`, `accessor`, `agent`, `agent-errors`, `aget`, `alength`, `all-ns`, `alter`, `and`, `append-child`, `apply`, `array-map`, `aset`, `aset-boolean`, `aset-byte`, `aset-char`, `aset-double`, `aset-float`, `aset-int`, `aset-long`, `aset-short`, `assert`, `assoc`, `await`, `await-for`, `bean`, `binding`, `bit-and`, `bit-not`, `bit-or`, `bit-shift-left`, `bit-shift-right`, `bit-xor`, `boolean`, `branch?`, `butlast`, `byte`, `cast`, `char`, `children`, `class`, `clear-agent-errors`, `comment`, `commute`, `comp`, `comparator`, `complement`, `concat`, `conj`, `cons`, `constantly`, `cond`, `if-not`, `construct-proxy`, `contains?`, `count`, `create-ns`, `create-struct`, `cycle`, `dec`, `deref`, `difference`, `disj`, `dissoc`, `distinct`, `doall`, `doc`, `dorun`, `doseq`, `dosync`, `dotimes`, `doto`, `double`, `down`, `drop`, `drop-while`, `edit`, `end?`, `ensure`, `eval`, `every?`, `false?`, `ffirst`, `file-seq`, `filter`, `find`, `find-doc`, `find-ns`, `find-var`, `first`, `float`, `flush`, `for`, `fnseq`, `frest`, `gensym`, `get-proxy-class`, `get`, `hash-map`, `hash-set`, `identical?`, `identity`, `if-let`, `import`, `in-ns`, `inc`, `index`, `insert-child`, `insert-left`, `insert-right`, `inspect-table`, `inspect-tree`, `instance?`, `int`, `interleave`, `intersection`, `into`, `into-array`, `iterate`, `join`, `key`, `keys`, `keyword`, `keyword?`, `last`, `lazy-cat`, `lazy-cons`, `left`, `lefts`, `line-seq`, `list*`, `list`, `load`, `load-file`, `locking`, `long`, `loop`, `macroexpand`, `macroexpand-1`, `make-array`, `make-node`, `map`, `map-invert`, `map?`, `mapcat`, `max`, `max-key`, `memfn`, `merge`, `merge-with`, `meta`, `min`, `min-key`, `name`, `namespace`, `neg?`, `new`, `newline`, `next`, `nil?`, `node`, `not`, `not-any?`, `not-every?`, `not=`, `ns-imports`, `ns-interns`, `ns-map`, `ns-name`, `ns-publics`, `ns-refers`, `ns-resolve`, `ns-unmap`, `nth`, `nthrest`, `or`, `parse`, `partial`, `path`, `peek`, `pop`, `pos?`, `pr`, `pr-str`, `print`, `print-str`, `println`, `println-str`, `prn`, `prn-str`, `project`, `proxy`, `proxy-mappings`, `quot`, `rand`, `rand-int`, `range`, `re-find`, `re-groups`, `re-matcher`, `re-matches`, `re-pattern`, `re-seq`, `read`, `read-line`, `reduce`, `ref`, `ref-set`, `refer`, `rem`, `remove`, `remove-method`, `remove-ns`, `rename`, `rename-keys`, `repeat`, `replace`, `replicate`, `resolve`, `rest`, `resultset-seq`, `reverse`, `rfirst`, `right`, `rights`, `root`, `rrest`, `rseq`, `second`, `select`, `select-keys`, `send`, `send-off`, `seq`, `seq-zip`, `seq?`, `set`, `short`, `slurp`, `some`, `sort`, `sort-by`, `sorted-map`, `sorted-map-by`, `sorted-set`, `special-symbol?`, `split-at`, `split-with`, `str`, `string?`, `struct`, `struct-map`, `subs`, `subvec`, `symbol`, `symbol?`, `sync`, `take`, `take-nth`, `take-while`, `test`, `time`, `to-array`, `to-array-2d`, `tree-seq`, `true?`, `union`, `up`, `update-proxy`, `val`, `vals`, `var-get`, `var-set`, `var?`, `vector`, `vector-zip`, `vector?`, `when`, `when-first`, `when-let`, `when-not`, `with-local-vars`, `with-meta`, `with-open`, `with-out-str`, `xml-seq`, `xml-zip`, `zero?`, `zipmap`, `zipper`), NameBuiltin, nil}, + {`(?<=\()(?!#)[\w!$%*+<=>?/.#-]+`, NameFunction, nil}, + {`(?!#)[\w!$%*+<=>?/.#-]+`, NameVariable, nil}, + {`(\[|\])`, Punctuation, nil}, + {`(\{|\})`, Punctuation, nil}, + {`(\(|\))`, Punctuation, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/cmake.go b/vendor/github.com/alecthomas/chroma/lexers/c/cmake.go new file mode 100644 index 000000000..163f17d9a --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/cmake.go @@ -0,0 +1,44 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Cmake lexer. +var Cmake = internal.Register(MustNewLexer( + &Config{ + Name: "CMake", + Aliases: []string{"cmake"}, + Filenames: []string{"*.cmake", "CMakeLists.txt"}, + MimeTypes: []string{"text/x-cmake"}, + }, + Rules{ + "root": { + {`\b(\w+)([ \t]*)(\()`, ByGroups(NameBuiltin, Text, Punctuation), Push("args")}, + Include("keywords"), + Include("ws"), + }, + "args": { + {`\(`, Punctuation, Push()}, + {`\)`, Punctuation, Pop(1)}, + {`(\$\{)(.+?)(\})`, ByGroups(Operator, NameVariable, Operator), nil}, + {`(\$ENV\{)(.+?)(\})`, ByGroups(Operator, NameVariable, Operator), nil}, + {`(\$<)(.+?)(>)`, ByGroups(Operator, NameVariable, Operator), nil}, + {`(?s)".*?"`, LiteralStringDouble, nil}, + {`\\\S+`, LiteralString, nil}, + {`[^)$"# \t\n]+`, LiteralString, nil}, + {`\n`, Text, nil}, + Include("keywords"), + Include("ws"), + }, + "string": {}, + "keywords": { + {`\b(WIN32|UNIX|APPLE|CYGWIN|BORLAND|MINGW|MSVC|MSVC_IDE|MSVC60|MSVC70|MSVC71|MSVC80|MSVC90)\b`, Keyword, nil}, + }, + "ws": { + {`[ \t]+`, Text, nil}, + {`#.*\n`, Comment, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/cobol.go b/vendor/github.com/alecthomas/chroma/lexers/c/cobol.go new file mode 100644 index 000000000..e9ae0bb7f --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/cobol.go @@ -0,0 +1,51 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Cobol lexer. +var Cobol = internal.Register(MustNewLexer( + &Config{ + Name: "COBOL", + Aliases: []string{"cobol"}, + Filenames: []string{"*.cob", "*.COB", "*.cpy", "*.CPY"}, + MimeTypes: []string{"text/x-cobol"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + Include("comment"), + Include("strings"), + Include("core"), + Include("nums"), + {`[a-z0-9]([\w\-]*[a-z0-9]+)?`, NameVariable, nil}, + {`[ \t]+`, Text, nil}, + }, + "comment": { + {`(^.{6}[*/].*\n|^.{6}|\*>.*\n)`, Comment, nil}, + }, + "core": { + {`(^|(?<=[^\w\-]))(ALL\s+)?((ZEROES)|(HIGH-VALUE|LOW-VALUE|QUOTE|SPACE|ZERO)(S)?)\s*($|(?=[^\w\-]))`, NameConstant, nil}, + {Words(`(^|(?<=[^\w\-]))`, `\s*($|(?=[^\w\-]))`, `ACCEPT`, `ADD`, `ALLOCATE`, `CALL`, `CANCEL`, `CLOSE`, `COMPUTE`, `CONFIGURATION`, `CONTINUE`, `DATA`, `DELETE`, `DISPLAY`, `DIVIDE`, `DIVISION`, `ELSE`, `END`, `END-ACCEPT`, `END-ADD`, `END-CALL`, `END-COMPUTE`, `END-DELETE`, `END-DISPLAY`, `END-DIVIDE`, `END-EVALUATE`, `END-IF`, `END-MULTIPLY`, `END-OF-PAGE`, `END-PERFORM`, `END-READ`, `END-RETURN`, `END-REWRITE`, `END-SEARCH`, `END-START`, `END-STRING`, `END-SUBTRACT`, `END-UNSTRING`, `END-WRITE`, `ENVIRONMENT`, `EVALUATE`, `EXIT`, `FD`, `FILE`, `FILE-CONTROL`, `FOREVER`, `FREE`, `GENERATE`, `GO`, `GOBACK`, `IDENTIFICATION`, `IF`, `INITIALIZE`, `INITIATE`, `INPUT-OUTPUT`, `INSPECT`, `INVOKE`, `I-O-CONTROL`, `LINKAGE`, `LOCAL-STORAGE`, `MERGE`, `MOVE`, `MULTIPLY`, `OPEN`, `PERFORM`, `PROCEDURE`, `PROGRAM-ID`, `RAISE`, `READ`, `RELEASE`, `RESUME`, `RETURN`, `REWRITE`, `SCREEN`, `SD`, `SEARCH`, `SECTION`, `SET`, `SORT`, `START`, `STOP`, `STRING`, `SUBTRACT`, `SUPPRESS`, `TERMINATE`, `THEN`, `UNLOCK`, `UNSTRING`, `USE`, `VALIDATE`, `WORKING-STORAGE`, `WRITE`), KeywordReserved, nil}, + {Words(`(^|(?<=[^\w\-]))`, `\s*($|(?=[^\w\-]))`, `ACCESS`, `ADDRESS`, `ADVANCING`, `AFTER`, `ALL`, `ALPHABET`, `ALPHABETIC`, `ALPHABETIC-LOWER`, `ALPHABETIC-UPPER`, `ALPHANUMERIC`, `ALPHANUMERIC-EDITED`, `ALSO`, `ALTER`, `ALTERNATEANY`, `ARE`, `AREA`, `AREAS`, `ARGUMENT-NUMBER`, `ARGUMENT-VALUE`, `AS`, `ASCENDING`, `ASSIGN`, `AT`, `AUTO`, `AUTO-SKIP`, `AUTOMATIC`, `AUTOTERMINATE`, `BACKGROUND-COLOR`, `BASED`, `BEEP`, `BEFORE`, `BELL`, `BLANK`, `BLINK`, `BLOCK`, `BOTTOM`, `BY`, `BYTE-LENGTH`, `CHAINING`, `CHARACTER`, `CHARACTERS`, `CLASS`, `CODE`, `CODE-SET`, `COL`, `COLLATING`, `COLS`, `COLUMN`, `COLUMNS`, `COMMA`, `COMMAND-LINE`, `COMMIT`, `COMMON`, `CONSTANT`, `CONTAINS`, `CONTENT`, `CONTROL`, `CONTROLS`, `CONVERTING`, `COPY`, `CORR`, `CORRESPONDING`, `COUNT`, `CRT`, `CURRENCY`, `CURSOR`, `CYCLE`, `DATE`, `DAY`, `DAY-OF-WEEK`, `DE`, `DEBUGGING`, `DECIMAL-POINT`, `DECLARATIVES`, `DEFAULT`, `DELIMITED`, `DELIMITER`, `DEPENDING`, `DESCENDING`, `DETAIL`, `DISK`, `DOWN`, `DUPLICATES`, `DYNAMIC`, `EBCDIC`, `ENTRY`, `ENVIRONMENT-NAME`, `ENVIRONMENT-VALUE`, `EOL`, `EOP`, `EOS`, `ERASE`, `ERROR`, `ESCAPE`, `EXCEPTION`, `EXCLUSIVE`, `EXTEND`, `EXTERNAL`, `FILE-ID`, `FILLER`, `FINAL`, `FIRST`, `FIXED`, `FLOAT-LONG`, `FLOAT-SHORT`, `FOOTING`, `FOR`, `FOREGROUND-COLOR`, `FORMAT`, `FROM`, `FULL`, `FUNCTION`, `FUNCTION-ID`, `GIVING`, `GLOBAL`, `GROUP`, `HEADING`, `HIGHLIGHT`, `I-O`, `ID`, `IGNORE`, `IGNORING`, `IN`, `INDEX`, `INDEXED`, `INDICATE`, `INITIAL`, `INITIALIZED`, `INPUT`, `INTO`, `INTRINSIC`, `INVALID`, `IS`, `JUST`, `JUSTIFIED`, `KEY`, `LABEL`, `LAST`, `LEADING`, `LEFT`, `LENGTH`, `LIMIT`, `LIMITS`, `LINAGE`, `LINAGE-COUNTER`, `LINE`, `LINES`, `LOCALE`, `LOCK`, `LOWLIGHT`, `MANUAL`, `MEMORY`, `MINUS`, `MODE`, `MULTIPLE`, `NATIONAL`, `NATIONAL-EDITED`, `NATIVE`, `NEGATIVE`, `NEXT`, `NO`, `NULL`, `NULLS`, `NUMBER`, `NUMBERS`, `NUMERIC`, `NUMERIC-EDITED`, `OBJECT-COMPUTER`, `OCCURS`, `OF`, `OFF`, `OMITTED`, `ON`, `ONLY`, `OPTIONAL`, `ORDER`, `ORGANIZATION`, `OTHER`, `OUTPUT`, `OVERFLOW`, `OVERLINE`, `PACKED-DECIMAL`, `PADDING`, `PAGE`, `PARAGRAPH`, `PLUS`, `POINTER`, `POSITION`, `POSITIVE`, `PRESENT`, `PREVIOUS`, `PRINTER`, `PRINTING`, `PROCEDURE-POINTER`, `PROCEDURES`, `PROCEED`, `PROGRAM`, `PROGRAM-POINTER`, `PROMPT`, `QUOTE`, `QUOTES`, `RANDOM`, `RD`, `RECORD`, `RECORDING`, `RECORDS`, `RECURSIVE`, `REDEFINES`, `REEL`, `REFERENCE`, `RELATIVE`, `REMAINDER`, `REMOVAL`, `RENAMES`, `REPLACING`, `REPORT`, `REPORTING`, `REPORTS`, `REPOSITORY`, `REQUIRED`, `RESERVE`, `RETURNING`, `REVERSE-VIDEO`, `REWIND`, `RIGHT`, `ROLLBACK`, `ROUNDED`, `RUN`, `SAME`, `SCROLL`, `SECURE`, `SEGMENT-LIMIT`, `SELECT`, `SENTENCE`, `SEPARATE`, `SEQUENCE`, `SEQUENTIAL`, `SHARING`, `SIGN`, `SIGNED`, `SIGNED-INT`, `SIGNED-LONG`, `SIGNED-SHORT`, `SIZE`, `SORT-MERGE`, `SOURCE`, `SOURCE-COMPUTER`, `SPECIAL-NAMES`, `STANDARD`, `STANDARD-1`, `STANDARD-2`, `STATUS`, `SUM`, `SYMBOLIC`, `SYNC`, `SYNCHRONIZED`, `TALLYING`, `TAPE`, `TEST`, `THROUGH`, `THRU`, `TIME`, `TIMES`, `TO`, `TOP`, `TRAILING`, `TRANSFORM`, `TYPE`, `UNDERLINE`, `UNIT`, `UNSIGNED`, `UNSIGNED-INT`, `UNSIGNED-LONG`, `UNSIGNED-SHORT`, `UNTIL`, `UP`, `UPDATE`, `UPON`, `USAGE`, `USING`, `VALUE`, `VALUES`, `VARYING`, `WAIT`, `WHEN`, `WITH`, `WORDS`, `YYYYDDD`, `YYYYMMDD`), KeywordPseudo, nil}, + {Words(`(^|(?<=[^\w\-]))`, `\s*($|(?=[^\w\-]))`, `ACTIVE-CLASS`, `ALIGNED`, `ANYCASE`, `ARITHMETIC`, `ATTRIBUTE`, `B-AND`, `B-NOT`, `B-OR`, `B-XOR`, `BIT`, `BOOLEAN`, `CD`, `CENTER`, `CF`, `CH`, `CHAIN`, `CLASS-ID`, `CLASSIFICATION`, `COMMUNICATION`, `CONDITION`, `DATA-POINTER`, `DESTINATION`, `DISABLE`, `EC`, `EGI`, `EMI`, `ENABLE`, `END-RECEIVE`, `ENTRY-CONVENTION`, `EO`, `ESI`, `EXCEPTION-OBJECT`, `EXPANDS`, `FACTORY`, `FLOAT-BINARY-16`, `FLOAT-BINARY-34`, `FLOAT-BINARY-7`, `FLOAT-DECIMAL-16`, `FLOAT-DECIMAL-34`, `FLOAT-EXTENDED`, `FORMAT`, `FUNCTION-POINTER`, `GET`, `GROUP-USAGE`, `IMPLEMENTS`, `INFINITY`, `INHERITS`, `INTERFACE`, `INTERFACE-ID`, `INVOKE`, `LC_ALL`, `LC_COLLATE`, `LC_CTYPE`, `LC_MESSAGES`, `LC_MONETARY`, `LC_NUMERIC`, `LC_TIME`, `LINE-COUNTER`, `MESSAGE`, `METHOD`, `METHOD-ID`, `NESTED`, `NONE`, `NORMAL`, `OBJECT`, `OBJECT-REFERENCE`, `OPTIONS`, `OVERRIDE`, `PAGE-COUNTER`, `PF`, `PH`, `PROPERTY`, `PROTOTYPE`, `PURGE`, `QUEUE`, `RAISE`, `RAISING`, `RECEIVE`, `RELATION`, `REPLACE`, `REPRESENTS-NOT-A-NUMBER`, `RESET`, `RESUME`, `RETRY`, `RF`, `RH`, `SECONDS`, `SEGMENT`, `SELF`, `SEND`, `SOURCES`, `STATEMENT`, `STEP`, `STRONG`, `SUB-QUEUE-1`, `SUB-QUEUE-2`, `SUB-QUEUE-3`, `SUPER`, `SYMBOL`, `SYSTEM-DEFAULT`, `TABLE`, `TERMINAL`, `TEXT`, `TYPEDEF`, `UCS-4`, `UNIVERSAL`, `USER-DEFAULT`, `UTF-16`, `UTF-8`, `VAL-STATUS`, `VALID`, `VALIDATE`, `VALIDATE-STATUS`), Error, nil}, + {`(^|(?<=[^\w\-]))(PIC\s+.+?(?=(\s|\.\s))|PICTURE\s+.+?(?=(\s|\.\s))|(COMPUTATIONAL)(-[1-5X])?|(COMP)(-[1-5X])?|BINARY-C-LONG|BINARY-CHAR|BINARY-DOUBLE|BINARY-LONG|BINARY-SHORT|BINARY)\s*($|(?=[^\w\-]))`, KeywordType, nil}, + {`(\*\*|\*|\+|-|/|<=|>=|<|>|==|/=|=)`, Operator, nil}, + {`([(),;:&%.])`, Punctuation, nil}, + {`(^|(?<=[^\w\-]))(ABS|ACOS|ANNUITY|ASIN|ATAN|BYTE-LENGTH|CHAR|COMBINED-DATETIME|CONCATENATE|COS|CURRENT-DATE|DATE-OF-INTEGER|DATE-TO-YYYYMMDD|DAY-OF-INTEGER|DAY-TO-YYYYDDD|EXCEPTION-(?:FILE|LOCATION|STATEMENT|STATUS)|EXP10|EXP|E|FACTORIAL|FRACTION-PART|INTEGER-OF-(?:DATE|DAY|PART)|INTEGER|LENGTH|LOCALE-(?:DATE|TIME(?:-FROM-SECONDS)?)|LOG(?:10)?|LOWER-CASE|MAX|MEAN|MEDIAN|MIDRANGE|MIN|MOD|NUMVAL(?:-C)?|ORD(?:-MAX|-MIN)?|PI|PRESENT-VALUE|RANDOM|RANGE|REM|REVERSE|SECONDS-FROM-FORMATTED-TIME|SECONDS-PAST-MIDNIGHT|SIGN|SIN|SQRT|STANDARD-DEVIATION|STORED-CHAR-LENGTH|SUBSTITUTE(?:-CASE)?|SUM|TAN|TEST-DATE-YYYYMMDD|TEST-DAY-YYYYDDD|TRIM|UPPER-CASE|VARIANCE|WHEN-COMPILED|YEAR-TO-YYYY)\s*($|(?=[^\w\-]))`, NameFunction, nil}, + {`(^|(?<=[^\w\-]))(true|false)\s*($|(?=[^\w\-]))`, NameBuiltin, nil}, + {`(^|(?<=[^\w\-]))(equal|equals|ne|lt|le|gt|ge|greater|less|than|not|and|or)\s*($|(?=[^\w\-]))`, OperatorWord, nil}, + }, + "strings": { + {`"[^"\n]*("|\n)`, LiteralStringDouble, nil}, + {`'[^'\n]*('|\n)`, LiteralStringSingle, nil}, + }, + "nums": { + {`\d+(\s*|\.$|$)`, LiteralNumberInteger, nil}, + {`[+-]?\d*\.\d+(E[-+]?\d+)?`, LiteralNumberFloat, nil}, + {`[+-]?\d+\.\d*(E[-+]?\d+)?`, LiteralNumberFloat, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/coffee.go b/vendor/github.com/alecthomas/chroma/lexers/c/coffee.go new file mode 100644 index 000000000..e402b8f2a --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/coffee.go @@ -0,0 +1,91 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Coffeescript lexer. +var Coffeescript = internal.Register(MustNewLexer( + &Config{ + Name: "CoffeeScript", + Aliases: []string{"coffee-script", "coffeescript", "coffee"}, + Filenames: []string{"*.coffee"}, + MimeTypes: []string{"text/coffeescript"}, + NotMultiline: true, + DotAll: true, + }, + Rules{ + "commentsandwhitespace": { + {`\s+`, Text, nil}, + {`###[^#].*?###`, CommentMultiline, nil}, + {`#(?!##[^#]).*?\n`, CommentSingle, nil}, + }, + "multilineregex": { + {`[^/#]+`, LiteralStringRegex, nil}, + {`///([gim]+\b|\B)`, LiteralStringRegex, Pop(1)}, + {`#\{`, LiteralStringInterpol, Push("interpoling_string")}, + {`[/#]`, LiteralStringRegex, nil}, + }, + "slashstartsregex": { + Include("commentsandwhitespace"), + {`///`, LiteralStringRegex, Push("#pop", "multilineregex")}, + {`/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)`, LiteralStringRegex, Pop(1)}, + {`/`, Operator, nil}, + Default(Pop(1)), + }, + "root": { + Include("commentsandwhitespace"), + {`^(?=\s|/)`, Text, Push("slashstartsregex")}, + {"\\+\\+|~|&&|\\band\\b|\\bor\\b|\\bis\\b|\\bisnt\\b|\\bnot\\b|\\?|:|\\|\\||\\\\(?=\\n)|(<<|>>>?|==?(?!>)|!=?|=(?!>)|-(?!>)|[<>+*`%&\\|\\^/])=?", Operator, Push("slashstartsregex")}, + {`(?:\([^()]*\))?\s*[=-]>`, NameFunction, Push("slashstartsregex")}, + {`[{(\[;,]`, Punctuation, Push("slashstartsregex")}, + {`[})\].]`, Punctuation, nil}, + {`(?=|<|>|==`, Operator, nil}, + {`mod\b`, Operator, nil}, + {`(eq|lt|gt|lte|gte|not|is|and|or)\b`, Operator, nil}, + {`\|\||&&`, Operator, nil}, + {`\?`, Operator, nil}, + {`"`, LiteralStringDouble, Push("string")}, + {`'.*?'`, LiteralStringSingle, nil}, + {`\d+`, LiteralNumber, nil}, + {`(if|else|len|var|xml|default|break|switch|component|property|function|do|try|catch|in|continue|for|return|while|required|any|array|binary|boolean|component|date|guid|numeric|query|string|struct|uuid|case)\b`, Keyword, nil}, + {`(true|false|null)\b`, KeywordConstant, nil}, + {`(application|session|client|cookie|super|this|variables|arguments)\b`, NameConstant, nil}, + {`([a-z_$][\w.]*)(\s*)(\()`, ByGroups(NameFunction, Text, Punctuation), nil}, + {`[a-z_$][\w.]*`, NameVariable, nil}, + {`[()\[\]{};:,.\\]`, Punctuation, nil}, + {`\s+`, Text, nil}, + }, + "string": { + {`""`, LiteralStringDouble, nil}, + {`#.+?#`, LiteralStringInterpol, nil}, + {`[^"#]+`, LiteralStringDouble, nil}, + {`#`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/coq.go b/vendor/github.com/alecthomas/chroma/lexers/c/coq.go new file mode 100644 index 000000000..e69a5c16c --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/coq.go @@ -0,0 +1,63 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Coq lexer. +var Coq = internal.Register(MustNewLexer( + &Config{ + Name: "Coq", + Aliases: []string{"coq"}, + Filenames: []string{"*.v"}, + MimeTypes: []string{"text/x-coq"}, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`false|true|\(\)|\[\]`, NameBuiltinPseudo, nil}, + {`\(\*`, Comment, Push("comment")}, + {Words(`\b`, `\b`, `Section`, `Module`, `End`, `Require`, `Import`, `Export`, `Variable`, `Variables`, `Parameter`, `Parameters`, `Axiom`, `Hypothesis`, `Hypotheses`, `Notation`, `Local`, `Tactic`, `Reserved`, `Scope`, `Open`, `Close`, `Bind`, `Delimit`, `Definition`, `Let`, `Ltac`, `Fixpoint`, `CoFixpoint`, `Morphism`, `Relation`, `Implicit`, `Arguments`, `Set`, `Unset`, `Contextual`, `Strict`, `Prenex`, `Implicits`, `Inductive`, `CoInductive`, `Record`, `Structure`, `Canonical`, `Coercion`, `Theorem`, `Lemma`, `Corollary`, `Proposition`, `Fact`, `Remark`, `Example`, `Proof`, `Goal`, `Save`, `Qed`, `Defined`, `Hint`, `Resolve`, `Rewrite`, `View`, `Search`, `Show`, `Print`, `Printing`, `All`, `Graph`, `Projections`, `inside`, `outside`, `Check`, `Global`, `Instance`, `Class`, `Existing`, `Universe`, `Polymorphic`, `Monomorphic`, `Context`), KeywordNamespace, nil}, + {Words(`\b`, `\b`, `forall`, `exists`, `exists2`, `fun`, `fix`, `cofix`, `struct`, `match`, `end`, `in`, `return`, `let`, `if`, `is`, `then`, `else`, `for`, `of`, `nosimpl`, `with`, `as`), Keyword, nil}, + {Words(`\b`, `\b`, `Type`, `Prop`), KeywordType, nil}, + {Words(`\b`, `\b`, `pose`, `set`, `move`, `case`, `elim`, `apply`, `clear`, `hnf`, `intro`, `intros`, `generalize`, `rename`, `pattern`, `after`, `destruct`, `induction`, `using`, `refine`, `inversion`, `injection`, `rewrite`, `congr`, `unlock`, `compute`, `ring`, `field`, `replace`, `fold`, `unfold`, `change`, `cutrewrite`, `simpl`, `have`, `suff`, `wlog`, `suffices`, `without`, `loss`, `nat_norm`, `assert`, `cut`, `trivial`, `revert`, `bool_congr`, `nat_congr`, `symmetry`, `transitivity`, `auto`, `split`, `left`, `right`, `autorewrite`, `tauto`, `setoid_rewrite`, `intuition`, `eauto`, `eapply`, `econstructor`, `etransitivity`, `constructor`, `erewrite`, `red`, `cbv`, `lazy`, `vm_compute`, `native_compute`, `subst`), Keyword, nil}, + {Words(`\b`, `\b`, `by`, `done`, `exact`, `reflexivity`, `tauto`, `romega`, `omega`, `assumption`, `solve`, `contradiction`, `discriminate`, `congruence`), KeywordPseudo, nil}, + {Words(`\b`, `\b`, `do`, `last`, `first`, `try`, `idtac`, `repeat`), KeywordReserved, nil}, + {`\b([A-Z][\w\']*)`, Name, nil}, + {"(\u03bb|\u03a0|\\|\\}|\\{\\||\\\\/|/\\\\|=>|~|\\}|\\|]|\\||\\{<|\\{|`|_|]|\\[\\||\\[>|\\[<|\\[|\\?\\?|\\?|>\\}|>]|>|=|<->|<-|<|;;|;|:>|:=|::|:|\\.\\.|\\.|->|-\\.|-|,|\\+|\\*|\\)|\\(|&&|&|#|!=)", Operator, nil}, + {`([=<>@^|&+\*/$%-]|[!?~])?[!$%&*+\./:<=>?@^|~-]`, Operator, nil}, + {`\b(unit|nat|bool|string|ascii|list)\b`, KeywordType, nil}, + {`[^\W\d][\w']*`, Name, nil}, + {`\d[\d_]*`, LiteralNumberInteger, nil}, + {`0[xX][\da-fA-F][\da-fA-F_]*`, LiteralNumberHex, nil}, + {`0[oO][0-7][0-7_]*`, LiteralNumberOct, nil}, + {`0[bB][01][01_]*`, LiteralNumberBin, nil}, + {`-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)`, LiteralNumberFloat, nil}, + {`'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'`, LiteralStringChar, nil}, + {`'.'`, LiteralStringChar, nil}, + {`'`, Keyword, nil}, + {`"`, LiteralStringDouble, Push("string")}, + {`[~?][a-z][\w\']*:`, Name, nil}, + }, + "comment": { + {`[^(*)]+`, Comment, nil}, + {`\(\*`, Comment, Push()}, + {`\*\)`, Comment, Pop(1)}, + {`[(*)]`, Comment, nil}, + }, + "string": { + {`[^"]+`, LiteralStringDouble, nil}, + {`""`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + "dotted": { + {`\s+`, Text, nil}, + {`\.`, Punctuation, nil}, + {`[A-Z][\w\']*(?=\s*\.)`, NameNamespace, nil}, + {`[A-Z][\w\']*`, NameClass, Pop(1)}, + {`[a-z][a-z0-9_\']*`, Name, Pop(1)}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/cpp.go b/vendor/github.com/alecthomas/chroma/lexers/c/cpp.go new file mode 100644 index 000000000..104be2409 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/cpp.go @@ -0,0 +1,106 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// CPP lexer. +var CPP = internal.Register(MustNewLexer( + &Config{ + Name: "C++", + Aliases: []string{"cpp", "c++"}, + Filenames: []string{"*.cpp", "*.hpp", "*.c++", "*.h++", "*.cc", "*.hh", "*.cxx", "*.hxx", "*.C", "*.H", "*.cp", "*.CPP"}, + MimeTypes: []string{"text/x-c++hdr", "text/x-c++src"}, + EnsureNL: true, + }, + Rules{ + "statements": { + {Words(``, `\b`, `catch`, `const_cast`, `delete`, `dynamic_cast`, `explicit`, `export`, `friend`, `mutable`, `namespace`, `new`, `operator`, `private`, `protected`, `public`, `reinterpret_cast`, `restrict`, `static_cast`, `template`, `this`, `throw`, `throws`, `try`, `typeid`, `typename`, `using`, `virtual`, `constexpr`, `nullptr`, `decltype`, `thread_local`, `alignas`, `alignof`, `static_assert`, `noexcept`, `override`, `final`, `concept`, `requires`, `consteval`, `co_await`, `co_return`, `co_yield`), Keyword, nil}, + {`(enum)\b(\s+)(class)\b(\s*)`, ByGroups(Keyword, Text, Keyword, Text), Push("classname")}, + {`(class|struct|enum|union)\b(\s*)`, ByGroups(Keyword, Text), Push("classname")}, + {`\[\[.+\]\]`, NameAttribute, nil}, + {`(R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)(")`, ByGroups(LiteralStringAffix, LiteralString, LiteralStringDelimiter, LiteralStringDelimiter, LiteralString, LiteralStringDelimiter, LiteralString), nil}, + {`(u8|u|U)(")`, ByGroups(LiteralStringAffix, LiteralString), Push("string")}, + {`(L?)(")`, ByGroups(LiteralStringAffix, LiteralString), Push("string")}, + {`(L?)(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')`, ByGroups(LiteralStringAffix, LiteralStringChar, LiteralStringChar, LiteralStringChar), nil}, + {`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*`, LiteralNumberFloat, nil}, + {`(\d+\.\d*|\.\d+|\d+[fF])[fF]?`, LiteralNumberFloat, nil}, + {`0[xX]([0-9A-Fa-f]('?[0-9A-Fa-f]+)*)[LlUu]*`, LiteralNumberHex, nil}, + {`0('?[0-7]+)+[LlUu]*`, LiteralNumberOct, nil}, + {`0[Bb][01]('?[01]+)*[LlUu]*`, LiteralNumberBin, nil}, + {`[0-9]('?[0-9]+)*[LlUu]*`, LiteralNumberInteger, nil}, + {`\*/`, Error, nil}, + {`[~!%^&*+=|?:<>/-]`, Operator, nil}, + {`[()\[\],.]`, Punctuation, nil}, + {Words(``, `\b`, `asm`, `auto`, `break`, `case`, `const`, `continue`, `default`, `do`, `else`, `enum`, `extern`, `for`, `goto`, `if`, `register`, `restricted`, `return`, `sizeof`, `static`, `struct`, `switch`, `typedef`, `union`, `volatile`, `while`), Keyword, nil}, + {`(bool|int|long|float|short|double|char((8|16|32)_t)?|wchar_t|unsigned|signed|void|u?int(_fast|_least|)(8|16|32|64)_t)\b`, KeywordType, nil}, + {Words(``, `\b`, `inline`, `_inline`, `__inline`, `naked`, `restrict`, `thread`, `typename`), KeywordReserved, nil}, + {`(__m(128i|128d|128|64))\b`, KeywordReserved, nil}, + {Words(`__`, `\b`, `asm`, `int8`, `based`, `except`, `int16`, `stdcall`, `cdecl`, `fastcall`, `int32`, `declspec`, `finally`, `int64`, `try`, `leave`, `w64`, `unaligned`, `raise`, `noop`, `identifier`, `forceinline`, `assume`), KeywordReserved, nil}, + {`(true|false|NULL)\b`, NameBuiltin, nil}, + {`([a-zA-Z_]\w*)(\s*)(:)(?!:)`, ByGroups(NameLabel, Text, Punctuation), nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + }, + "root": { + Include("whitespace"), + {`((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;{]*)(\{)`, ByGroups(UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), Push("function")}, + {`((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;]*)(;)`, ByGroups(UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), nil}, + Default(Push("statement")), + {Words(`__`, `\b`, `virtual_inheritance`, `uuidof`, `super`, `single_inheritance`, `multiple_inheritance`, `interface`, `event`), KeywordReserved, nil}, + {`__(offload|blockingoffload|outer)\b`, KeywordPseudo, nil}, + }, + "classname": { + {`(\[\[.+\]\])(\s*)`, ByGroups(NameAttribute, Text), nil}, + {`[a-zA-Z_]\w*`, NameClass, Pop(1)}, + {`\s*(?=[>{])`, Text, Pop(1)}, + }, + "whitespace": { + {`^#if\s+0`, CommentPreproc, Push("if0")}, + {`^#`, CommentPreproc, Push("macro")}, + {`^(\s*(?:/[*].*?[*]/\s*)?)(#if\s+0)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("if0")}, + {`^(\s*(?:/[*].*?[*]/\s*)?)(#)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("macro")}, + {`\n`, Text, nil}, + {`\s+`, Text, nil}, + {`\\\n`, Text, nil}, + {`//(\n|[\w\W]*?[^\\]\n)`, CommentSingle, nil}, + {`/(\\\n)?[*][\w\W]*?[*](\\\n)?/`, CommentMultiline, nil}, + {`/(\\\n)?[*][\w\W]*`, CommentMultiline, nil}, + }, + "statement": { + Include("whitespace"), + Include("statements"), + {`[{]`, Punctuation, Push("root")}, + {`[;}]`, Punctuation, Pop(1)}, + }, + "function": { + Include("whitespace"), + Include("statements"), + {`;`, Punctuation, nil}, + {`\{`, Punctuation, Push()}, + {`\}`, Punctuation, Pop(1)}, + }, + "string": { + {`"`, LiteralString, Pop(1)}, + {`\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})`, LiteralStringEscape, nil}, + {`[^\\"\n]+`, LiteralString, nil}, + {`\\\n`, LiteralString, nil}, + {`\\`, LiteralString, nil}, + }, + "macro": { + {`(include)(\s*(?:/[*].*?[*]/\s*)?)([^\n]+)`, ByGroups(CommentPreproc, Text, CommentPreprocFile), nil}, + {`[^/\n]+`, CommentPreproc, nil}, + {`/[*](.|\n)*?[*]/`, CommentMultiline, nil}, + {`//.*?\n`, CommentSingle, Pop(1)}, + {`/`, CommentPreproc, nil}, + {`(?<=\\)\n`, CommentPreproc, nil}, + {`\n`, CommentPreproc, Pop(1)}, + }, + "if0": { + {`^\s*#if.*?(?=~!@#%^&|`?-]+", Operator, nil}, + {`(?s)(java|javascript)(\s+)(AS)(\s+)('|\$\$)(.*?)(\5)`, + UsingByGroup( + internal.Get, + 1, 6, + NameBuiltin, TextWhitespace, Keyword, TextWhitespace, + LiteralStringHeredoc, LiteralStringHeredoc, LiteralStringHeredoc, + ), + nil, + }, + {`(true|false|null)\b`, KeywordConstant, nil}, + {`0x[0-9a-f]+`, LiteralNumberHex, nil}, + {`[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`, LiteralNumberHex, nil}, + {`\.[0-9]+(e[+-]?[0-9]+)?`, Error, nil}, + {`-?[0-9]+(\.[0-9])?(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`'`, LiteralStringSingle, Push("string")}, + {`"`, LiteralStringName, Push("quoted-ident")}, + {`\$\$`, LiteralStringHeredoc, Push("dollar-string")}, + {`[a-z_]\w*`, Name, nil}, + {`:(['"]?)[a-z]\w*\b\1`, NameVariable, nil}, + {`[;:()\[\]\{\},.]`, Punctuation, nil}, + }, + "multiline-comments": { + {`/\*`, CommentMultiline, Push("multiline-comments")}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[^/*]+`, CommentMultiline, nil}, + {`[/*]`, CommentMultiline, nil}, + }, + "string": { + {`[^']+`, LiteralStringSingle, nil}, + {`''`, LiteralStringSingle, nil}, + {`'`, LiteralStringSingle, Pop(1)}, + }, + "quoted-ident": { + {`[^"]+`, LiteralStringName, nil}, + {`""`, LiteralStringName, nil}, + {`"`, LiteralStringName, Pop(1)}, + }, + "dollar-string": { + {`[^\$]+`, LiteralStringHeredoc, nil}, + {`\$\$`, LiteralStringHeredoc, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/crystal.go b/vendor/github.com/alecthomas/chroma/lexers/c/crystal.go new file mode 100644 index 000000000..69e053c73 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/crystal.go @@ -0,0 +1,262 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Crystal lexer. +var Crystal = internal.Register(MustNewLexer( + &Config{ + Name: "Crystal", + Aliases: []string{"cr", "crystal"}, + Filenames: []string{"*.cr"}, + MimeTypes: []string{"text/x-crystal"}, + DotAll: true, + }, + Rules{ + "root": { + {`#.*?$`, CommentSingle, nil}, + {Words(``, `\b`, `abstract`, `asm`, `as`, `begin`, `break`, `case`, `do`, `else`, `elsif`, `end`, `ensure`, `extend`, `ifdef`, `if`, `include`, `instance_sizeof`, `next`, `of`, `pointerof`, `private`, `protected`, `rescue`, `return`, `require`, `sizeof`, `super`, `then`, `typeof`, `unless`, `until`, `when`, `while`, `with`, `yield`), Keyword, nil}, + {Words(``, `\b`, `true`, `false`, `nil`), KeywordConstant, nil}, + {`(module|lib)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)`, ByGroups(Keyword, Text, NameNamespace), nil}, + {`(def|fun|macro)(\s+)((?:[a-zA-Z_]\w*::)*)`, ByGroups(Keyword, Text, NameNamespace), Push("funcname")}, + {"def(?=[*%&^`~+-/\\[<>=])", Keyword, Push("funcname")}, + {`(class|struct|union|type|alias|enum)(\s+)((?:[a-zA-Z_]\w*::)*)`, ByGroups(Keyword, Text, NameNamespace), Push("classname")}, + {`(self|out|uninitialized)\b|(is_a|responds_to)\?`, KeywordPseudo, nil}, + {Words(``, `\b`, `debugger`, `record`, `pp`, `assert_responds_to`, `spawn`, `parallel`, `getter`, `setter`, `property`, `delegate`, `def_hash`, `def_equals`, `def_equals_and_hash`, `forward_missing_to`), NameBuiltinPseudo, nil}, + {`getter[!?]|property[!?]|__(DIR|FILE|LINE)__\b`, NameBuiltinPseudo, nil}, + {Words(`(?~!:])|(?<=(?:\s|;)when\s)|(?<=(?:\s|;)or\s)|(?<=(?:\s|;)and\s)|(?<=\.index\s)|(?<=\.scan\s)|(?<=\.sub\s)|(?<=\.sub!\s)|(?<=\.gsub\s)|(?<=\.gsub!\s)|(?<=\.match\s)|(?<=(?:\s|;)if\s)|(?<=(?:\s|;)elsif\s)|(?<=^when\s)|(?<=^index\s)|(?<=^scan\s)|(?<=^sub\s)|(?<=^gsub\s)|(?<=^sub!\s)|(?<=^gsub!\s)|(?<=^match\s)|(?<=^if\s)|(?<=^elsif\s))(\s*)(/)`, ByGroups(Text, LiteralStringRegex), Push("multiline-regex")}, + {`(?<=\(|,|\[)/`, LiteralStringRegex, Push("multiline-regex")}, + {`(\s+)(/)(?![\s=])`, ByGroups(Text, LiteralStringRegex), Push("multiline-regex")}, + {`(0o[0-7]+(?:_[0-7]+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?`, ByGroups(LiteralNumberOct, Text, Operator), nil}, + {`(0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?`, ByGroups(LiteralNumberHex, Text, Operator), nil}, + {`(0b[01]+(?:_[01]+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?`, ByGroups(LiteralNumberBin, Text, Operator), nil}, + {`((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)(?:e[+-]?[0-9]+)?(?:_?f[0-9]+)?)(\s*)([/?])?`, ByGroups(LiteralNumberFloat, Text, Operator), nil}, + {`((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)?(?:e[+-]?[0-9]+)(?:_?f[0-9]+)?)(\s*)([/?])?`, ByGroups(LiteralNumberFloat, Text, Operator), nil}, + {`((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)?(?:e[+-]?[0-9]+)?(?:_?f[0-9]+))(\s*)([/?])?`, ByGroups(LiteralNumberFloat, Text, Operator), nil}, + {`(0\b|[1-9][\d]*(?:_\d+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?`, ByGroups(LiteralNumberInteger, Text, Operator), nil}, + {`@@[a-zA-Z_]\w*`, NameVariableClass, nil}, + {`@[a-zA-Z_]\w*`, NameVariableInstance, nil}, + {`\$\w+`, NameVariableGlobal, nil}, + {"\\$[!@&`\\'+~=/\\\\,;.<>_*$?:\"^-]", NameVariableGlobal, nil}, + {`\$-[0adFiIlpvw]`, NameVariableGlobal, nil}, + {`::`, Operator, nil}, + Include("strings"), + {`\?(\\[MC]-)*(\\([\\befnrtv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})|\S)(?!\w)`, LiteralStringChar, nil}, + {`[A-Z][A-Z_]+\b`, NameConstant, nil}, + {`\{%`, LiteralStringInterpol, Push("in-macro-control")}, + {`\{\{`, LiteralStringInterpol, Push("in-macro-expr")}, + {`(@\[)(\s*)([A-Z]\w*)`, ByGroups(Operator, Text, NameDecorator), Push("in-attr")}, + {Words(`(\.|::)`, ``, `!=`, `!~`, `!`, `%`, `&&`, `&`, `**`, `*`, `+`, `-`, `/`, `<=>`, `<<`, `<=`, `<`, `===`, `==`, `=~`, `=`, `>=`, `>>`, `>`, `[]=`, `[]?`, `[]`, `^`, `||`, `|`, `~`), ByGroups(Operator, NameOperator), nil}, + {"(\\.|::)([a-zA-Z_]\\w*[!?]?|[*%&^`~+\\-/\\[<>=])", ByGroups(Operator, Name), nil}, + {`[a-zA-Z_]\w*(?:[!?](?!=))?`, Name, nil}, + {`(\[|\]\??|\*\*|<=>?|>=|<>?|=~|===|!~|&&?|\|\||\.{1,3})`, Operator, nil}, + {`[-+/*%=<>&!^|~]=?`, Operator, nil}, + {`[(){};,/?:\\]`, Punctuation, nil}, + {`\s+`, Text, nil}, + }, + "funcname": { + {"(?:([a-zA-Z_]\\w*)(\\.))?([a-zA-Z_]\\w*[!?]?|\\*\\*?|[-+]@?|[/%&|^`~]|\\[\\]=?|<<|>>|<=?>|>=?|===?)", ByGroups(NameClass, Operator, NameFunction), Pop(1)}, + Default(Pop(1)), + }, + "classname": { + {`[A-Z_]\w*`, NameClass, nil}, + {`(\()(\s*)([A-Z_]\w*)(\s*)(\))`, ByGroups(Punctuation, Text, NameClass, Text, Punctuation), nil}, + Default(Pop(1)), + }, + "in-intp": { + {`\{`, LiteralStringInterpol, Push()}, + {`\}`, LiteralStringInterpol, Pop(1)}, + Include("root"), + }, + "string-intp": { + {`#\{`, LiteralStringInterpol, Push("in-intp")}, + }, + "string-escaped": { + {`\\([\\befnstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})`, LiteralStringEscape, nil}, + }, + "string-intp-escaped": { + Include("string-intp"), + Include("string-escaped"), + }, + "interpolated-regex": { + Include("string-intp"), + {`[\\#]`, LiteralStringRegex, nil}, + {`[^\\#]+`, LiteralStringRegex, nil}, + }, + "interpolated-string": { + Include("string-intp"), + {`[\\#]`, LiteralStringOther, nil}, + {`[^\\#]+`, LiteralStringOther, nil}, + }, + "multiline-regex": { + Include("string-intp"), + {`\\\\`, LiteralStringRegex, nil}, + {`\\/`, LiteralStringRegex, nil}, + {`[\\#]`, LiteralStringRegex, nil}, + {`[^\\/#]+`, LiteralStringRegex, nil}, + {`/[imsx]*`, LiteralStringRegex, Pop(1)}, + }, + "end-part": { + {`.+`, CommentPreproc, Pop(1)}, + }, + "in-macro-control": { + {`\{%`, LiteralStringInterpol, Push()}, + {`%\}`, LiteralStringInterpol, Pop(1)}, + {`for\b|in\b`, Keyword, nil}, + Include("root"), + }, + "in-macro-expr": { + {`\{\{`, LiteralStringInterpol, Push()}, + {`\}\}`, LiteralStringInterpol, Pop(1)}, + Include("root"), + }, + "in-attr": { + {`\[`, Operator, Push()}, + {`\]`, Operator, Pop(1)}, + Include("root"), + }, + "strings": { + {`\:@{0,2}[a-zA-Z_]\w*[!?]?`, LiteralStringSymbol, nil}, + {Words(`\:@{0,2}`, ``, `!=`, `!~`, `!`, `%`, `&&`, `&`, `**`, `*`, `+`, `-`, `/`, `<=>`, `<<`, `<=`, `<`, `===`, `==`, `=~`, `=`, `>=`, `>>`, `>`, `[]=`, `[]?`, `[]`, `^`, `||`, `|`, `~`), LiteralStringSymbol, nil}, + {`:'(\\\\|\\'|[^'])*'`, LiteralStringSymbol, nil}, + {`'(\\\\|\\'|[^']|\\[^'\\]+)'`, LiteralStringChar, nil}, + {`:"`, LiteralStringSymbol, Push("simple-sym")}, + {`([a-zA-Z_]\w*)(:)(?!:)`, ByGroups(LiteralStringSymbol, Punctuation), nil}, + {`"`, LiteralStringDouble, Push("simple-string")}, + {"(?&!^|~,(])(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)`, ByGroups(Text, LiteralStringOther, None), nil}, + {`^(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)`, ByGroups(Text, LiteralStringOther, None), nil}, + {`(%([\[{(<]))((?:\\\2|(?!\2).)*)(\2)`, String, nil}, + }, + "simple-string": { + Include("string-intp-escaped"), + {`[^\\"#]+`, LiteralStringDouble, nil}, + {`[\\#]`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + "simple-sym": { + Include("string-escaped"), + {`[^\\"#]+`, LiteralStringSymbol, nil}, + {`[\\#]`, LiteralStringSymbol, nil}, + {`"`, LiteralStringSymbol, Pop(1)}, + }, + "simple-backtick": { + Include("string-intp-escaped"), + {"[^\\\\`#]+", LiteralStringBacktick, nil}, + {`[\\#]`, LiteralStringBacktick, nil}, + {"`", LiteralStringBacktick, Pop(1)}, + }, + "cb-intp-string": { + {`\\[\{]`, LiteralStringOther, nil}, + {`\{`, LiteralStringOther, Push()}, + {`\}`, LiteralStringOther, Pop(1)}, + Include("string-intp-escaped"), + {`[\\#{}]`, LiteralStringOther, nil}, + {`[^\\#{}]+`, LiteralStringOther, nil}, + }, + "cb-string": { + {`\\[\\{}]`, LiteralStringOther, nil}, + {`\{`, LiteralStringOther, Push()}, + {`\}`, LiteralStringOther, Pop(1)}, + {`[\\#{}]`, LiteralStringOther, nil}, + {`[^\\#{}]+`, LiteralStringOther, nil}, + }, + "cb-regex": { + {`\\[\\{}]`, LiteralStringRegex, nil}, + {`\{`, LiteralStringRegex, Push()}, + {`\}[imsx]*`, LiteralStringRegex, Pop(1)}, + Include("string-intp"), + {`[\\#{}]`, LiteralStringRegex, nil}, + {`[^\\#{}]+`, LiteralStringRegex, nil}, + }, + "sb-intp-string": { + {`\\[\[]`, LiteralStringOther, nil}, + {`\[`, LiteralStringOther, Push()}, + {`\]`, LiteralStringOther, Pop(1)}, + Include("string-intp-escaped"), + {`[\\#\[\]]`, LiteralStringOther, nil}, + {`[^\\#\[\]]+`, LiteralStringOther, nil}, + }, + "sb-string": { + {`\\[\\\[\]]`, LiteralStringOther, nil}, + {`\[`, LiteralStringOther, Push()}, + {`\]`, LiteralStringOther, Pop(1)}, + {`[\\#\[\]]`, LiteralStringOther, nil}, + {`[^\\#\[\]]+`, LiteralStringOther, nil}, + }, + "sb-regex": { + {`\\[\\\[\]]`, LiteralStringRegex, nil}, + {`\[`, LiteralStringRegex, Push()}, + {`\][imsx]*`, LiteralStringRegex, Pop(1)}, + Include("string-intp"), + {`[\\#\[\]]`, LiteralStringRegex, nil}, + {`[^\\#\[\]]+`, LiteralStringRegex, nil}, + }, + "pa-intp-string": { + {`\\[\(]`, LiteralStringOther, nil}, + {`\(`, LiteralStringOther, Push()}, + {`\)`, LiteralStringOther, Pop(1)}, + Include("string-intp-escaped"), + {`[\\#()]`, LiteralStringOther, nil}, + {`[^\\#()]+`, LiteralStringOther, nil}, + }, + "pa-string": { + {`\\[\\()]`, LiteralStringOther, nil}, + {`\(`, LiteralStringOther, Push()}, + {`\)`, LiteralStringOther, Pop(1)}, + {`[\\#()]`, LiteralStringOther, nil}, + {`[^\\#()]+`, LiteralStringOther, nil}, + }, + "pa-regex": { + {`\\[\\()]`, LiteralStringRegex, nil}, + {`\(`, LiteralStringRegex, Push()}, + {`\)[imsx]*`, LiteralStringRegex, Pop(1)}, + Include("string-intp"), + {`[\\#()]`, LiteralStringRegex, nil}, + {`[^\\#()]+`, LiteralStringRegex, nil}, + }, + "ab-intp-string": { + {`\\[<]`, LiteralStringOther, nil}, + {`<`, LiteralStringOther, Push()}, + {`>`, LiteralStringOther, Pop(1)}, + Include("string-intp-escaped"), + {`[\\#<>]`, LiteralStringOther, nil}, + {`[^\\#<>]+`, LiteralStringOther, nil}, + }, + "ab-string": { + {`\\[\\<>]`, LiteralStringOther, nil}, + {`<`, LiteralStringOther, Push()}, + {`>`, LiteralStringOther, Pop(1)}, + {`[\\#<>]`, LiteralStringOther, nil}, + {`[^\\#<>]+`, LiteralStringOther, nil}, + }, + "ab-regex": { + {`\\[\\<>]`, LiteralStringRegex, nil}, + {`<`, LiteralStringRegex, Push()}, + {`>[imsx]*`, LiteralStringRegex, Pop(1)}, + Include("string-intp"), + {`[\\#<>]`, LiteralStringRegex, nil}, + {`[^\\#<>]+`, LiteralStringRegex, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/csharp.go b/vendor/github.com/alecthomas/chroma/lexers/c/csharp.go new file mode 100644 index 000000000..c6a5f468a --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/csharp.go @@ -0,0 +1,51 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// CSharp lexer. +var CSharp = internal.Register(MustNewLexer( + &Config{ + Name: "C#", + Aliases: []string{"csharp", "c#"}, + Filenames: []string{"*.cs"}, + MimeTypes: []string{"text/x-csharp"}, + DotAll: true, + EnsureNL: true, + }, + Rules{ + "root": { + {`^\s*\[.*?\]`, NameAttribute, nil}, + {`[^\S\n]+`, Text, nil}, + {`\\\n`, Text, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/[*].*?[*]/`, CommentMultiline, nil}, + {`\n`, Text, nil}, + {`[~!%^&*()+=|\[\]:;,.<>/?-]`, Punctuation, nil}, + {`[{}]`, Punctuation, nil}, + {`@"(""|[^"])*"`, LiteralString, nil}, + {`\$@?"(""|[^"])*"`, LiteralString, nil}, + {`"(\\\\|\\"|[^"\n])*["\n]`, LiteralString, nil}, + {`'\\.'|'[^\\]'`, LiteralStringChar, nil}, + {`[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil}, + {`#[ \t]*(if|endif|else|elif|define|undef|line|error|warning|region|endregion|pragma)\b.*?\n`, CommentPreproc, nil}, + {`\b(extern)(\s+)(alias)\b`, ByGroups(Keyword, Text, Keyword), nil}, + {`(abstract|as|async|await|base|break|by|case|catch|checked|const|continue|default|delegate|do|else|enum|event|explicit|extern|false|finally|fixed|for|foreach|goto|if|implicit|in|interface|internal|is|let|lock|new|null|on|operator|out|override|params|private|protected|public|readonly|ref|return|sealed|sizeof|stackalloc|static|switch|this|throw|true|try|typeof|unchecked|unsafe|virtual|void|while|get|set|new|partial|yield|add|remove|value|alias|ascending|descending|from|group|into|orderby|select|thenby|where|join|equals)\b`, Keyword, nil}, + {`(global)(::)`, ByGroups(Keyword, Punctuation), nil}, + {`(bool|byte|char|decimal|double|dynamic|float|int|long|object|sbyte|short|string|uint|ulong|ushort|var)\b\??`, KeywordType, nil}, + {`(class|struct)(\s+)`, ByGroups(Keyword, Text), Push("class")}, + {`(namespace|using)(\s+)`, ByGroups(Keyword, Text), Push("namespace")}, + {`@?[_a-zA-Z]\w*`, Name, nil}, + }, + "class": { + {`@?[_a-zA-Z]\w*`, NameClass, Pop(1)}, + Default(Pop(1)), + }, + "namespace": { + {`(?=\()`, Text, Pop(1)}, + {`(@?[_a-zA-Z]\w*|\.)+`, NameNamespace, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/css.go b/vendor/github.com/alecthomas/chroma/lexers/c/css.go new file mode 100644 index 000000000..fedc809bf --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/css.go @@ -0,0 +1,104 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// CSS lexer. +var CSS = internal.Register(MustNewLexer( + &Config{ + Name: "CSS", + Aliases: []string{"css"}, + Filenames: []string{"*.css"}, + MimeTypes: []string{"text/css"}, + }, + Rules{ + "root": { + Include("basics"), + }, + "basics": { + {`\s+`, Text, nil}, + {`/\*(?:.|\n)*?\*/`, Comment, nil}, + {`\{`, Punctuation, Push("content")}, + {`(\:{1,2})([\w-]+)`, ByGroups(Punctuation, NameDecorator), nil}, + {`(\.)([\w-]+)`, ByGroups(Punctuation, NameClass), nil}, + {`(\#)([\w-]+)`, ByGroups(Punctuation, NameNamespace), nil}, + {`(@)([\w-]+)`, ByGroups(Punctuation, Keyword), Push("atrule")}, + {`[\w-]+`, NameTag, nil}, + {`[~^*!%&$\[\]()<>|+=@:;,./?-]`, Operator, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + }, + "atrule": { + {`\{`, Punctuation, Push("atcontent")}, + {`;`, Punctuation, Pop(1)}, + Include("basics"), + }, + "atcontent": { + Include("basics"), + {`\}`, Punctuation, Pop(2)}, + }, + "content": { + {`\s+`, Text, nil}, + {`\}`, Punctuation, Pop(1)}, + {`;`, Punctuation, nil}, + {`^@.*?$`, CommentPreproc, nil}, + {Words(``, ``, `-ms-`, `mso-`, `-moz-`, `-o-`, `-xv-`, `-atsc-`, `-wap-`, `-khtml-`, `-webkit-`, `prince-`, `-ah-`, `-hp-`, `-ro-`, `-rim-`, `-tc-`), KeywordPseudo, nil}, + {`(align-content|align-items|align-self|alignment-baseline|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|appearance|azimuth|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|baseline-shift|bookmark-label|bookmark-level|bookmark-state|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-boundary|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-decoration-break|box-shadow|box-sizing|box-snap|box-suppress|break-after|break-before|break-inside|caption-side|caret|caret-animation|caret-color|caret-shape|chains|clear|clip|clip-path|clip-rule|color|color-interpolation-filters|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|counter-set|crop|cue|cue-after|cue-before|cursor|direction|display|dominant-baseline|elevation|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|float-defer|float-offset|float-reference|flood-color|flood-opacity|flow|flow-from|flow-into|font|font-family|font-feature-settings|font-kerning|font-language-override|font-size|font-size-adjust|font-stretch|font-style|font-synthesis|font-variant|font-variant-alternates|font-variant-caps|font-variant-east-asian|font-variant-ligatures|font-variant-numeric|font-variant-position|font-weight|footnote-display|footnote-policy|glyph-orientation-vertical|grid|grid-area|grid-auto-columns|grid-auto-flow|grid-auto-rows|grid-column|grid-column-end|grid-column-gap|grid-column-start|grid-gap|grid-row|grid-row-end|grid-row-gap|grid-row-start|grid-template|grid-template-areas|grid-template-columns|grid-template-rows|hanging-punctuation|height|hyphenate-character|hyphenate-limit-chars|hyphenate-limit-last|hyphenate-limit-lines|hyphenate-limit-zone|hyphens|image-orientation|image-resolution|initial-letter|initial-letter-align|initial-letter-wrap|isolation|justify-content|justify-items|justify-self|left|letter-spacing|lighting-color|line-break|line-grid|line-height|line-snap|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|marker-side|marquee-direction|marquee-loop|marquee-speed|marquee-style|mask|mask-border|mask-border-mode|mask-border-outset|mask-border-repeat|mask-border-slice|mask-border-source|mask-border-width|mask-clip|mask-composite|mask-image|mask-mode|mask-origin|mask-position|mask-repeat|mask-size|mask-type|max-height|max-lines|max-width|min-height|min-width|mix-blend-mode|motion|motion-offset|motion-path|motion-rotation|move-to|nav-down|nav-left|nav-right|nav-up|object-fit|object-position|offset-after|offset-before|offset-end|offset-start|opacity|order|orphans|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-style|overflow-wrap|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page|page-break-after|page-break-before|page-break-inside|page-policy|pause|pause-after|pause-before|perspective|perspective-origin|pitch|pitch-range|play-during|polar-angle|polar-distance|position|presentation-level|quotes|region-fragment|resize|rest|rest-after|rest-before|richness|right|rotation|rotation-point|ruby-align|ruby-merge|ruby-position|running|scroll-snap-coordinate|scroll-snap-destination|scroll-snap-points-x|scroll-snap-points-y|scroll-snap-type|shape-image-threshold|shape-inside|shape-margin|shape-outside|size|speak|speak-as|speak-header|speak-numeral|speak-punctuation|speech-rate|stress|string-set|tab-size|table-layout|text-align|text-align-last|text-combine-upright|text-decoration|text-decoration-color|text-decoration-line|text-decoration-skip|text-decoration-style|text-emphasis|text-emphasis-color|text-emphasis-position|text-emphasis-style|text-indent|text-justify|text-orientation|text-overflow|text-shadow|text-space-collapse|text-space-trim|text-spacing|text-transform|text-underline-position|text-wrap|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch|voice-range|voice-rate|voice-stress|voice-volume|volume|white-space|widows|width|will-change|word-break|word-spacing|word-wrap|wrap-after|wrap-before|wrap-flow|wrap-inside|wrap-through|writing-mode|z-index)(\s*)(\:)`, ByGroups(Keyword, Text, Punctuation), Push("value-start")}, + {`(--[a-zA-Z_][\w-]*)(\s*)(\:)`, ByGroups(NameVariable, Text, Punctuation), Push("value-start")}, + {`([a-zA-Z_][\w-]*)(\s*)(\:)`, ByGroups(Name, Text, Punctuation), Push("value-start")}, + {`/\*(?:.|\n)*?\*/`, Comment, nil}, + }, + "value-start": { + Include("common-values"), + {Words(``, `\b`, `align-content`, `align-items`, `align-self`, `alignment-baseline`, `all`, `animation`, `animation-delay`, `animation-direction`, `animation-duration`, `animation-fill-mode`, `animation-iteration-count`, `animation-name`, `animation-play-state`, `animation-timing-function`, `appearance`, `azimuth`, `backface-visibility`, `background`, `background-attachment`, `background-blend-mode`, `background-clip`, `background-color`, `background-image`, `background-origin`, `background-position`, `background-repeat`, `background-size`, `baseline-shift`, `bookmark-label`, `bookmark-level`, `bookmark-state`, `border`, `border-bottom`, `border-bottom-color`, `border-bottom-left-radius`, `border-bottom-right-radius`, `border-bottom-style`, `border-bottom-width`, `border-boundary`, `border-collapse`, `border-color`, `border-image`, `border-image-outset`, `border-image-repeat`, `border-image-slice`, `border-image-source`, `border-image-width`, `border-left`, `border-left-color`, `border-left-style`, `border-left-width`, `border-radius`, `border-right`, `border-right-color`, `border-right-style`, `border-right-width`, `border-spacing`, `border-style`, `border-top`, `border-top-color`, `border-top-left-radius`, `border-top-right-radius`, `border-top-style`, `border-top-width`, `border-width`, `bottom`, `box-decoration-break`, `box-shadow`, `box-sizing`, `box-snap`, `box-suppress`, `break-after`, `break-before`, `break-inside`, `caption-side`, `caret`, `caret-animation`, `caret-color`, `caret-shape`, `chains`, `clear`, `clip`, `clip-path`, `clip-rule`, `color`, `color-interpolation-filters`, `column-count`, `column-fill`, `column-gap`, `column-rule`, `column-rule-color`, `column-rule-style`, `column-rule-width`, `column-span`, `column-width`, `columns`, `content`, `counter-increment`, `counter-reset`, `counter-set`, `crop`, `cue`, `cue-after`, `cue-before`, `cursor`, `direction`, `display`, `dominant-baseline`, `elevation`, `empty-cells`, `filter`, `flex`, `flex-basis`, `flex-direction`, `flex-flow`, `flex-grow`, `flex-shrink`, `flex-wrap`, `float`, `float-defer`, `float-offset`, `float-reference`, `flood-color`, `flood-opacity`, `flow`, `flow-from`, `flow-into`, `font`, `font-family`, `font-feature-settings`, `font-kerning`, `font-language-override`, `font-size`, `font-size-adjust`, `font-stretch`, `font-style`, `font-synthesis`, `font-variant`, `font-variant-alternates`, `font-variant-caps`, `font-variant-east-asian`, `font-variant-ligatures`, `font-variant-numeric`, `font-variant-position`, `font-weight`, `footnote-display`, `footnote-policy`, `glyph-orientation-vertical`, `grid`, `grid-area`, `grid-auto-columns`, `grid-auto-flow`, `grid-auto-rows`, `grid-column`, `grid-column-end`, `grid-column-gap`, `grid-column-start`, `grid-gap`, `grid-row`, `grid-row-end`, `grid-row-gap`, `grid-row-start`, `grid-template`, `grid-template-areas`, `grid-template-columns`, `grid-template-rows`, `hanging-punctuation`, `height`, `hyphenate-character`, `hyphenate-limit-chars`, `hyphenate-limit-last`, `hyphenate-limit-lines`, `hyphenate-limit-zone`, `hyphens`, `image-orientation`, `image-resolution`, `initial-letter`, `initial-letter-align`, `initial-letter-wrap`, `isolation`, `justify-content`, `justify-items`, `justify-self`, `left`, `letter-spacing`, `lighting-color`, `line-break`, `line-grid`, `line-height`, `line-snap`, `list-style`, `list-style-image`, `list-style-position`, `list-style-type`, `margin`, `margin-bottom`, `margin-left`, `margin-right`, `margin-top`, `marker-side`, `marquee-direction`, `marquee-loop`, `marquee-speed`, `marquee-style`, `mask`, `mask-border`, `mask-border-mode`, `mask-border-outset`, `mask-border-repeat`, `mask-border-slice`, `mask-border-source`, `mask-border-width`, `mask-clip`, `mask-composite`, `mask-image`, `mask-mode`, `mask-origin`, `mask-position`, `mask-repeat`, `mask-size`, `mask-type`, `max-height`, `max-lines`, `max-width`, `min-height`, `min-width`, `mix-blend-mode`, `motion`, `motion-offset`, `motion-path`, `motion-rotation`, `move-to`, `nav-down`, `nav-left`, `nav-right`, `nav-up`, `object-fit`, `object-position`, `offset-after`, `offset-before`, `offset-end`, `offset-start`, `opacity`, `order`, `orphans`, `outline`, `outline-color`, `outline-offset`, `outline-style`, `outline-width`, `overflow`, `overflow-style`, `overflow-wrap`, `overflow-x`, `overflow-y`, `padding`, `padding-bottom`, `padding-left`, `padding-right`, `padding-top`, `page`, `page-break-after`, `page-break-before`, `page-break-inside`, `page-policy`, `pause`, `pause-after`, `pause-before`, `perspective`, `perspective-origin`, `pitch`, `pitch-range`, `play-during`, `polar-angle`, `polar-distance`, `position`, `presentation-level`, `quotes`, `region-fragment`, `resize`, `rest`, `rest-after`, `rest-before`, `richness`, `right`, `rotation`, `rotation-point`, `ruby-align`, `ruby-merge`, `ruby-position`, `running`, `scroll-snap-coordinate`, `scroll-snap-destination`, `scroll-snap-points-x`, `scroll-snap-points-y`, `scroll-snap-type`, `shape-image-threshold`, `shape-inside`, `shape-margin`, `shape-outside`, `size`, `speak`, `speak-as`, `speak-header`, `speak-numeral`, `speak-punctuation`, `speech-rate`, `stress`, `string-set`, `tab-size`, `table-layout`, `text-align`, `text-align-last`, `text-combine-upright`, `text-decoration`, `text-decoration-color`, `text-decoration-line`, `text-decoration-skip`, `text-decoration-style`, `text-emphasis`, `text-emphasis-color`, `text-emphasis-position`, `text-emphasis-style`, `text-indent`, `text-justify`, `text-orientation`, `text-overflow`, `text-shadow`, `text-space-collapse`, `text-space-trim`, `text-spacing`, `text-transform`, `text-underline-position`, `text-wrap`, `top`, `transform`, `transform-origin`, `transform-style`, `transition`, `transition-delay`, `transition-duration`, `transition-property`, `transition-timing-function`, `unicode-bidi`, `user-select`, `vertical-align`, `visibility`, `voice-balance`, `voice-duration`, `voice-family`, `voice-pitch`, `voice-range`, `voice-rate`, `voice-stress`, `voice-volume`, `volume`, `white-space`, `widows`, `width`, `will-change`, `word-break`, `word-spacing`, `word-wrap`, `wrap-after`, `wrap-before`, `wrap-flow`, `wrap-inside`, `wrap-through`, `writing-mode`, `z-index`), Keyword, nil}, + {`\!important`, CommentPreproc, nil}, + {`/\*(?:.|\n)*?\*/`, Comment, nil}, + Include("numeric-values"), + {`[~^*!%&<>|+=@:./?-]+`, Operator, nil}, + {`[\[\](),]+`, Punctuation, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`[a-zA-Z_][\w-]*`, Name, nil}, + {`;`, Punctuation, Pop(1)}, + {`\}`, Punctuation, Pop(2)}, + }, + "function-start": { + Include("common-values"), + {`/\*(?:.|\n)*?\*/`, Comment, nil}, + Include("numeric-values"), + {`[*+/-]`, Operator, nil}, + {`[,]`, Punctuation, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`[a-zA-Z_-]\w*`, Name, nil}, + {`\)`, Punctuation, Pop(1)}, + }, + "common-values": { + {`\s+`, Text, nil}, + {Words(``, ``, `-ms-`, `mso-`, `-moz-`, `-o-`, `-xv-`, `-atsc-`, `-wap-`, `-khtml-`, `-webkit-`, `prince-`, `-ah-`, `-hp-`, `-ro-`, `-rim-`, `-tc-`), KeywordPseudo, nil}, + Include("urls"), + {`(attr|blackness|blend|blenda|blur|brightness|calc|circle|color-mod|contrast|counter|cubic-bezier|device-cmyk|drop-shadow|ellipse|gray|grayscale|hsl|hsla|hue|hue-rotate|hwb|image|inset|invert|lightness|linear-gradient|matrix|matrix3d|opacity|perspective|polygon|radial-gradient|rect|repeating-linear-gradient|repeating-radial-gradient|rgb|rgba|rotate|rotate3d|rotateX|rotateY|rotateZ|saturate|saturation|scale|scale3d|scaleX|scaleY|scaleZ|sepia|shade|skewX|skewY|steps|tint|toggle|translate|translate3d|translateX|translateY|translateZ|whiteness)(\()`, ByGroups(NameBuiltin, Punctuation), Push("function-start")}, + {`([a-zA-Z_][\w-]+)(\()`, ByGroups(NameFunction, Punctuation), Push("function-start")}, + {Words(``, `\b`, `absolute`, `alias`, `all`, `all-petite-caps`, `all-scroll`, `all-small-caps`, `allow-end`, `alpha`, `alternate`, `alternate-reverse`, `always`, `armenian`, `auto`, `avoid`, `avoid-column`, `avoid-page`, `backwards`, `balance`, `baseline`, `below`, `blink`, `block`, `bold`, `bolder`, `border-box`, `both`, `bottom`, `box-decoration`, `break-word`, `capitalize`, `cell`, `center`, `circle`, `clip`, `clone`, `close-quote`, `col-resize`, `collapse`, `color`, `color-burn`, `color-dodge`, `column`, `column-reverse`, `compact`, `condensed`, `contain`, `container`, `content-box`, `context-menu`, `copy`, `cover`, `crisp-edges`, `crosshair`, `currentColor`, `cursive`, `darken`, `dashed`, `decimal`, `decimal-leading-zero`, `default`, `descendants`, `difference`, `digits`, `disc`, `distribute`, `dot`, `dotted`, `double`, `double-circle`, `e-resize`, `each-line`, `ease`, `ease-in`, `ease-in-out`, `ease-out`, `edges`, `ellipsis`, `end`, `ew-resize`, `exclusion`, `expanded`, `extra-condensed`, `extra-expanded`, `fantasy`, `fill`, `fill-box`, `filled`, `first`, `fixed`, `flat`, `flex`, `flex-end`, `flex-start`, `flip`, `force-end`, `forwards`, `from-image`, `full-width`, `geometricPrecision`, `georgian`, `groove`, `hanging`, `hard-light`, `help`, `hidden`, `hide`, `horizontal`, `hue`, `icon`, `infinite`, `inherit`, `initial`, `ink`, `inline`, `inline-block`, `inline-flex`, `inline-table`, `inset`, `inside`, `inter-word`, `invert`, `isolate`, `italic`, `justify`, `large`, `larger`, `last`, `left`, `lighten`, `lighter`, `line-through`, `linear`, `list-item`, `local`, `loose`, `lower-alpha`, `lower-greek`, `lower-latin`, `lower-roman`, `lowercase`, `ltr`, `luminance`, `luminosity`, `mandatory`, `manipulation`, `manual`, `margin-box`, `match-parent`, `medium`, `mixed`, `monospace`, `move`, `multiply`, `n-resize`, `ne-resize`, `nesw-resize`, `no-close-quote`, `no-drop`, `no-open-quote`, `no-repeat`, `none`, `normal`, `not-allowed`, `nowrap`, `ns-resize`, `nw-resize`, `nwse-resize`, `objects`, `oblique`, `off`, `on`, `open`, `open-quote`, `optimizeLegibility`, `optimizeSpeed`, `outset`, `outside`, `over`, `overlay`, `overline`, `padding-box`, `page`, `pan-down`, `pan-left`, `pan-right`, `pan-up`, `pan-x`, `pan-y`, `paused`, `petite-caps`, `pixelated`, `pointer`, `preserve-3d`, `progress`, `proximity`, `relative`, `repeat`, `repeat no-repeat`, `repeat-x`, `repeat-y`, `reverse`, `ridge`, `right`, `round`, `row`, `row-resize`, `row-reverse`, `rtl`, `ruby`, `ruby-base`, `ruby-base-container`, `ruby-text`, `ruby-text-container`, `run-in`, `running`, `s-resize`, `sans-serif`, `saturation`, `scale-down`, `screen`, `scroll`, `se-resize`, `semi-condensed`, `semi-expanded`, `separate`, `serif`, `sesame`, `show`, `sideways`, `sideways-left`, `sideways-right`, `slice`, `small`, `small-caps`, `smaller`, `smooth`, `snap`, `soft-light`, `solid`, `space`, `space-around`, `space-between`, `spaces`, `square`, `start`, `static`, `step-end`, `step-start`, `sticky`, `stretch`, `strict`, `stroke-box`, `style`, `sw-resize`, `table`, `table-caption`, `table-cell`, `table-column`, `table-column-group`, `table-footer-group`, `table-header-group`, `table-row`, `table-row-group`, `text`, `thick`, `thin`, `titling-caps`, `to`, `top`, `triangle`, `ultra-condensed`, `ultra-expanded`, `under`, `underline`, `unicase`, `unset`, `upper-alpha`, `upper-latin`, `upper-roman`, `uppercase`, `upright`, `use-glyph-orientation`, `vertical`, `vertical-text`, `view-box`, `visible`, `w-resize`, `wait`, `wavy`, `weight`, `weight style`, `wrap`, `wrap-reverse`, `x-large`, `x-small`, `xx-large`, `xx-small`, `zoom-in`, `zoom-out`), KeywordConstant, nil}, + {Words(``, `\b`, `above`, `aural`, `behind`, `bidi-override`, `center-left`, `center-right`, `cjk-ideographic`, `continuous`, `crop`, `cross`, `embed`, `far-left`, `far-right`, `fast`, `faster`, `hebrew`, `high`, `higher`, `hiragana`, `hiragana-iroha`, `katakana`, `katakana-iroha`, `landscape`, `left-side`, `leftwards`, `level`, `loud`, `low`, `lower`, `message-box`, `middle`, `mix`, `narrower`, `once`, `portrait`, `right-side`, `rightwards`, `silent`, `slow`, `slower`, `small-caption`, `soft`, `spell-out`, `status-bar`, `super`, `text-bottom`, `text-top`, `wider`, `x-fast`, `x-high`, `x-loud`, `x-low`, `x-soft`, `yes`, `pre`, `pre-wrap`, `pre-line`), KeywordConstant, nil}, + {Words(``, `\b`, `aliceblue`, `antiquewhite`, `aqua`, `aquamarine`, `azure`, `beige`, `bisque`, `black`, `blanchedalmond`, `blue`, `blueviolet`, `brown`, `burlywood`, `cadetblue`, `chartreuse`, `chocolate`, `coral`, `cornflowerblue`, `cornsilk`, `crimson`, `cyan`, `darkblue`, `darkcyan`, `darkgoldenrod`, `darkgray`, `darkgreen`, `darkgrey`, `darkkhaki`, `darkmagenta`, `darkolivegreen`, `darkorange`, `darkorchid`, `darkred`, `darksalmon`, `darkseagreen`, `darkslateblue`, `darkslategray`, `darkslategrey`, `darkturquoise`, `darkviolet`, `deeppink`, `deepskyblue`, `dimgray`, `dimgrey`, `dodgerblue`, `firebrick`, `floralwhite`, `forestgreen`, `fuchsia`, `gainsboro`, `ghostwhite`, `gold`, `goldenrod`, `gray`, `green`, `greenyellow`, `grey`, `honeydew`, `hotpink`, `indianred`, `indigo`, `ivory`, `khaki`, `lavender`, `lavenderblush`, `lawngreen`, `lemonchiffon`, `lightblue`, `lightcoral`, `lightcyan`, `lightgoldenrodyellow`, `lightgray`, `lightgreen`, `lightgrey`, `lightpink`, `lightsalmon`, `lightseagreen`, `lightskyblue`, `lightslategray`, `lightslategrey`, `lightsteelblue`, `lightyellow`, `lime`, `limegreen`, `linen`, `magenta`, `maroon`, `mediumaquamarine`, `mediumblue`, `mediumorchid`, `mediumpurple`, `mediumseagreen`, `mediumslateblue`, `mediumspringgreen`, `mediumturquoise`, `mediumvioletred`, `midnightblue`, `mintcream`, `mistyrose`, `moccasin`, `navajowhite`, `navy`, `oldlace`, `olive`, `olivedrab`, `orange`, `orangered`, `orchid`, `palegoldenrod`, `palegreen`, `paleturquoise`, `palevioletred`, `papayawhip`, `peachpuff`, `peru`, `pink`, `plum`, `powderblue`, `purple`, `rebeccapurple`, `red`, `rosybrown`, `royalblue`, `saddlebrown`, `salmon`, `sandybrown`, `seagreen`, `seashell`, `sienna`, `silver`, `skyblue`, `slateblue`, `slategray`, `slategrey`, `snow`, `springgreen`, `steelblue`, `tan`, `teal`, `thistle`, `tomato`, `turquoise`, `violet`, `wheat`, `white`, `whitesmoke`, `yellow`, `yellowgreen`, `transparent`), KeywordConstant, nil}, + }, + "urls": { + {`(url)(\()(".*?")(\))`, ByGroups(NameBuiltin, Punctuation, LiteralStringDouble, Punctuation), nil}, + {`(url)(\()('.*?')(\))`, ByGroups(NameBuiltin, Punctuation, LiteralStringSingle, Punctuation), nil}, + {`(url)(\()(.*?)(\))`, ByGroups(NameBuiltin, Punctuation, LiteralStringOther, Punctuation), nil}, + }, + "numeric-values": { + {`\#[a-zA-Z0-9]{1,6}`, LiteralNumberHex, nil}, + {`[+\-]?[0-9]*[.][0-9]+`, LiteralNumberFloat, Push("numeric-end")}, + {`[+\-]?[0-9]+`, LiteralNumberInteger, Push("numeric-end")}, + }, + "numeric-end": { + {Words(``, `\b`, `deg`, `grad`, `rad`, `turn`, `Hz`, `kHz`, `em`, `ex`, `ch`, `rem`, `vh`, `vw`, `vmin`, `vmax`, `px`, `mm`, `cm`, `in`, `pt`, `pc`, `q`, `dpi`, `dpcm`, `dppx`, `s`, `ms`), KeywordType, nil}, + {`%`, KeywordType, nil}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/cython.go b/vendor/github.com/alecthomas/chroma/lexers/c/cython.go new file mode 100644 index 000000000..701e2b791 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/c/cython.go @@ -0,0 +1,135 @@ +package c + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Cython lexer. +var Cython = internal.Register(MustNewLexer( + &Config{ + Name: "Cython", + Aliases: []string{"cython", "pyx", "pyrex"}, + Filenames: []string{"*.pyx", "*.pxd", "*.pxi"}, + MimeTypes: []string{"text/x-cython", "application/x-cython"}, + }, + Rules{ + "root": { + {`\n`, Text, nil}, + {`^(\s*)("""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringDoc), nil}, + {`^(\s*)('''(?:.|\n)*?''')`, ByGroups(Text, LiteralStringDoc), nil}, + {`[^\S\n]+`, Text, nil}, + {`#.*$`, Comment, nil}, + {`[]{}:(),;[]`, Punctuation, nil}, + {`\\\n`, Text, nil}, + {`\\`, Text, nil}, + {`(in|is|and|or|not)\b`, OperatorWord, nil}, + {`(<)([a-zA-Z0-9.?]+)(>)`, ByGroups(Punctuation, KeywordType, Punctuation), nil}, + {`!=|==|<<|>>|[-~+/*%=<>&^|.?]`, Operator, nil}, + {`(from)(\d+)(<=)(\s+)(<)(\d+)(:)`, ByGroups(Keyword, LiteralNumberInteger, Operator, Name, Operator, Name, Punctuation), nil}, + Include("keywords"), + {`(def|property)(\s+)`, ByGroups(Keyword, Text), Push("funcname")}, + {`(cp?def)(\s+)`, ByGroups(Keyword, Text), Push("cdef")}, + {`(cdef)(:)`, ByGroups(Keyword, Punctuation), nil}, + {`(class|struct)(\s+)`, ByGroups(Keyword, Text), Push("classname")}, + {`(from)(\s+)`, ByGroups(Keyword, Text), Push("fromimport")}, + {`(c?import)(\s+)`, ByGroups(Keyword, Text), Push("import")}, + Include("builtins"), + Include("backtick"), + {`(?:[rR]|[uU][rR]|[rR][uU])"""`, LiteralString, Push("tdqs")}, + {`(?:[rR]|[uU][rR]|[rR][uU])'''`, LiteralString, Push("tsqs")}, + {`(?:[rR]|[uU][rR]|[rR][uU])"`, LiteralString, Push("dqs")}, + {`(?:[rR]|[uU][rR]|[rR][uU])'`, LiteralString, Push("sqs")}, + {`[uU]?"""`, LiteralString, Combined("stringescape", "tdqs")}, + {`[uU]?'''`, LiteralString, Combined("stringescape", "tsqs")}, + {`[uU]?"`, LiteralString, Combined("stringescape", "dqs")}, + {`[uU]?'`, LiteralString, Combined("stringescape", "sqs")}, + Include("name"), + Include("numbers"), + }, + "keywords": { + {Words(``, `\b`, `assert`, `break`, `by`, `continue`, `ctypedef`, `del`, `elif`, `else`, `except`, `except?`, `exec`, `finally`, `for`, `fused`, `gil`, `global`, `if`, `include`, `lambda`, `nogil`, `pass`, `print`, `raise`, `return`, `try`, `while`, `yield`, `as`, `with`), Keyword, nil}, + {`(DEF|IF|ELIF|ELSE)\b`, CommentPreproc, nil}, + }, + "builtins": { + {Words(`(?`, CommentPreproc, Pop(1)}, + {`(<<<)([\'"]?)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)(\2\n.*?\n\s*)(\3)(;?)(\n)`, ByGroups(LiteralString, LiteralString, LiteralStringDelimiter, LiteralString, LiteralStringDelimiter, Punctuation, Text), nil}, + {`\s+`, Text, nil}, + {`#.*?\n`, CommentSingle, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/\*\*/`, CommentMultiline, nil}, + {`/\*\*.*?\*/`, LiteralStringDoc, nil}, + {`/\*.*?\*/`, CommentMultiline, nil}, + {`(->|::)(\s*)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)`, ByGroups(Operator, Text, NameAttribute), nil}, + {`[~!%^&*+=|:.<>/@-]+`, Operator, nil}, + {`\?`, Operator, nil}, + {`[\[\]{}();,]+`, Punctuation, nil}, + {`(class)(\s+)`, ByGroups(Keyword, Text), Push("classname")}, + {`(function)(\s*)(?=\()`, ByGroups(Keyword, Text), nil}, + {`(function)(\s+)(&?)(\s*)`, ByGroups(Keyword, Text, Operator, Text), Push("functionname")}, + {`(const)(\s+)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)`, ByGroups(Keyword, Text, NameConstant), nil}, + {`(and|E_PARSE|old_function|E_ERROR|or|as|E_WARNING|parent|eval|PHP_OS|break|exit|case|extends|PHP_VERSION|cfunction|FALSE|print|for|require|continue|foreach|require_once|declare|return|default|static|do|switch|die|stdClass|echo|else|TRUE|elseif|var|empty|if|xor|enddeclare|include|virtual|endfor|include_once|while|endforeach|global|endif|list|endswitch|new|endwhile|not|array|E_ALL|NULL|final|php_user_filter|interface|implements|public|private|protected|abstract|clone|try|catch|throw|this|use|namespace|trait|yield|finally)\b`, Keyword, nil}, + {`(true|false|null)\b`, KeywordConstant, nil}, + Include("magicconstants"), + {`\$\{\$+(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*\}`, NameVariable, nil}, + {`\$+(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameVariable, nil}, + {`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameOther, nil}, + {`(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`\d+e[+-]?[0-9]+`, LiteralNumberFloat, nil}, + {`0[0-7]+`, LiteralNumberOct, nil}, + {`0x[a-f0-9]+`, LiteralNumberHex, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`0b[01]+`, LiteralNumberBin, nil}, + {`'([^'\\]*(?:\\.[^'\\]*)*)'`, LiteralStringSingle, nil}, + {"`([^`\\\\]*(?:\\\\.[^`\\\\]*)*)`", LiteralStringBacktick, nil}, + {`"`, LiteralStringDouble, Push("string")}, + }, + "magicfuncs": { + {Words(``, `\b`, `__construct`, `__destruct`, `__call`, `__callStatic`, `__get`, `__set`, `__isset`, `__unset`, `__sleep`, `__wakeup`, `__toString`, `__invoke`, `__set_state`, `__clone`, `__debugInfo`), NameFunctionMagic, nil}, + }, + "magicconstants": { + {Words(``, `\b`, `__LINE__`, `__FILE__`, `__DIR__`, `__FUNCTION__`, `__CLASS__`, `__TRAIT__`, `__METHOD__`, `__NAMESPACE__`), NameConstant, nil}, + }, + "classname": { + {`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameClass, Pop(1)}, + }, + "functionname": { + Include("magicfuncs"), + {`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameFunction, Pop(1)}, + Default(Pop(1)), + }, + "string": { + {`"`, LiteralStringDouble, Pop(1)}, + {`[^{$"\\]+`, LiteralStringDouble, nil}, + {`\\([nrt"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})`, LiteralStringEscape, nil}, + {`\$(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*(\[\S+?\]|->(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)?`, LiteralStringInterpol, nil}, + {`(\{\$\{)(.*?)(\}\})`, ByGroups(LiteralStringInterpol, UsingSelf("root"), LiteralStringInterpol), nil}, + {`(\{)(\$.*?)(\})`, ByGroups(LiteralStringInterpol, UsingSelf("root"), LiteralStringInterpol), nil}, + {`(\$\{)(\S+)(\})`, ByGroups(LiteralStringInterpol, NameVariable, LiteralStringInterpol), nil}, + {`[${\\]`, LiteralStringDouble, nil}, + }, + }, +).SetAnalyser(func(text string) float32 { + if strings.Contains(text, "]*\s+)+?)((?:[^\W\d]|\$)[\w$]*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil}, + + // https://dlang.org/spec/attribute.html#uda + {`@[\w.]*`, NameDecorator, nil}, + {`(abstract|auto|alias|align|const|delegate|enum|export|final|function|inout|lazy|nothrow|override|package|private|protected|public|pure|static|synchronized|template|volatile|__gshared)\b`, KeywordDeclaration, nil}, + + // https://dlang.org/spec/type.html#basic-data-types + {`(void|bool|byte|ubyte|short|ushort|int|uint|long|ulong|cent|ucent|float|double|real|ifloat|idouble|ireal|cfloat|cdouble|creal|char|wchar|dchar|string|wstring|dstring)\b`, KeywordType, nil}, + {`(module)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")}, + {`(true|false|null)\b`, KeywordConstant, nil}, + {`(class|interface|struct|template|union)(\s+)`, ByGroups(KeywordDeclaration, Text), Push("class")}, + {`(import)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")}, + + // https://dlang.org/spec/lex.html#string_literals + // TODO support delimited strings + {`[qr]?"(\\\\|\\"|[^"])*"[cwd]?`, LiteralString, nil}, + {"(`)([^`]*)(`)[cwd]?", LiteralString, nil}, + {`'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'`, LiteralStringChar, nil}, + {`(\.)((?:[^\W\d]|\$)[\w$]*)`, ByGroups(Operator, NameAttribute), nil}, + {`^\s*([^\W\d]|\$)[\w$]*:`, NameLabel, nil}, + + // https://dlang.org/spec/lex.html#floatliteral + {`([0-9][0-9_]*\.([0-9][0-9_]*)?|\.[0-9][0-9_]*)([eE][+\-]?[0-9][0-9_]*)?[fFL]?i?|[0-9][eE][+\-]?[0-9][0-9_]*[fFL]?|[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFL]|0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)[pP][+\-]?[0-9][0-9_]*[fFL]?`, LiteralNumberFloat, nil}, + // https://dlang.org/spec/lex.html#integerliteral + {`0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?`, LiteralNumberHex, nil}, + {`0[bB][01][01_]*[lL]?`, LiteralNumberBin, nil}, + {`0[0-7_]+[lL]?`, LiteralNumberOct, nil}, + {`0|[1-9][0-9_]*[lL]?`, LiteralNumberInteger, nil}, + {`([~^*!%&\[\](){}<>|+=:;,./?-]|q{)`, Operator, nil}, + {`([^\W\d]|\$)[\w$]*`, Name, nil}, + {`\n`, Text, nil}, + }, + "class": { + {`([^\W\d]|\$)[\w$]*`, NameClass, Pop(1)}, + }, + "import": { + {`[\w.]+\*?`, NameNamespace, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/d/dart.go b/vendor/github.com/alecthomas/chroma/lexers/d/dart.go new file mode 100644 index 000000000..6dab3b420 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/d/dart.go @@ -0,0 +1,91 @@ +package d + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Dart lexer. +var Dart = internal.Register(MustNewLexer( + &Config{ + Name: "Dart", + Aliases: []string{"dart"}, + Filenames: []string{"*.dart"}, + MimeTypes: []string{"text/x-dart"}, + DotAll: true, + }, + Rules{ + "root": { + Include("string_literal"), + {`#!(.*?)$`, CommentPreproc, nil}, + {`\b(import|export)\b`, Keyword, Push("import_decl")}, + {`\b(library|source|part of|part)\b`, Keyword, nil}, + {`[^\S\n]+`, Text, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/\*.*?\*/`, CommentMultiline, nil}, + {`\b(class)\b(\s+)`, ByGroups(KeywordDeclaration, Text), Push("class")}, + {`\b(assert|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|this|throw|try|while)\b`, Keyword, nil}, + {`\b(abstract|async|await|const|extends|factory|final|get|implements|native|operator|set|static|sync|typedef|var|with|yield)\b`, KeywordDeclaration, nil}, + {`\b(bool|double|dynamic|int|num|Object|String|void)\b`, KeywordType, nil}, + {`\b(false|null|true)\b`, KeywordConstant, nil}, + {`[~!%^&*+=|?:<>/-]|as\b`, Operator, nil}, + {`[a-zA-Z_$]\w*:`, NameLabel, nil}, + {`[a-zA-Z_$]\w*`, Name, nil}, + {`[(){}\[\],.;]`, Punctuation, nil}, + {`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`\d+(\.\d*)?([eE][+-]?\d+)?`, LiteralNumber, nil}, + {`\.\d+([eE][+-]?\d+)?`, LiteralNumber, nil}, + {`\n`, Text, nil}, + }, + "class": { + {`[a-zA-Z_$]\w*`, NameClass, Pop(1)}, + }, + "import_decl": { + Include("string_literal"), + {`\s+`, Text, nil}, + {`\b(as|show|hide)\b`, Keyword, nil}, + {`[a-zA-Z_$]\w*`, Name, nil}, + {`\,`, Punctuation, nil}, + {`\;`, Punctuation, Pop(1)}, + }, + "string_literal": { + {`r"""([\w\W]*?)"""`, LiteralStringDouble, nil}, + {`r'''([\w\W]*?)'''`, LiteralStringSingle, nil}, + {`r"(.*?)"`, LiteralStringDouble, nil}, + {`r'(.*?)'`, LiteralStringSingle, nil}, + {`"""`, LiteralStringDouble, Push("string_double_multiline")}, + {`'''`, LiteralStringSingle, Push("string_single_multiline")}, + {`"`, LiteralStringDouble, Push("string_double")}, + {`'`, LiteralStringSingle, Push("string_single")}, + }, + "string_common": { + {`\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]*\}|[a-z'\"$\\])`, LiteralStringEscape, nil}, + {`(\$)([a-zA-Z_]\w*)`, ByGroups(LiteralStringInterpol, Name), nil}, + {`(\$\{)(.*?)(\})`, ByGroups(LiteralStringInterpol, UsingSelf("root"), LiteralStringInterpol), nil}, + }, + "string_double": { + {`"`, LiteralStringDouble, Pop(1)}, + {`[^"$\\\n]+`, LiteralStringDouble, nil}, + Include("string_common"), + {`\$+`, LiteralStringDouble, nil}, + }, + "string_double_multiline": { + {`"""`, LiteralStringDouble, Pop(1)}, + {`[^"$\\]+`, LiteralStringDouble, nil}, + Include("string_common"), + {`(\$|\")+`, LiteralStringDouble, nil}, + }, + "string_single": { + {`'`, LiteralStringSingle, Pop(1)}, + {`[^'$\\\n]+`, LiteralStringSingle, nil}, + Include("string_common"), + {`\$+`, LiteralStringSingle, nil}, + }, + "string_single_multiline": { + {`'''`, LiteralStringSingle, Pop(1)}, + {`[^\'$\\]+`, LiteralStringSingle, nil}, + Include("string_common"), + {`(\$|\')+`, LiteralStringSingle, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/d/diff.go b/vendor/github.com/alecthomas/chroma/lexers/d/diff.go new file mode 100644 index 000000000..264ed45ce --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/d/diff.go @@ -0,0 +1,29 @@ +package d + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Diff lexer. +var Diff = internal.Register(MustNewLexer( + &Config{ + Name: "Diff", + Aliases: []string{"diff", "udiff"}, + EnsureNL: true, + Filenames: []string{"*.diff", "*.patch"}, + MimeTypes: []string{"text/x-diff", "text/x-patch"}, + }, + Rules{ + "root": { + {` .*\n`, Text, nil}, + {`\+.*\n`, GenericInserted, nil}, + {`-.*\n`, GenericDeleted, nil}, + {`!.*\n`, GenericStrong, nil}, + {`@.*\n`, GenericSubheading, nil}, + {`([Ii]ndex|diff).*\n`, GenericHeading, nil}, + {`=.*\n`, GenericHeading, nil}, + {`.*\n`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/d/django.go b/vendor/github.com/alecthomas/chroma/lexers/d/django.go new file mode 100644 index 000000000..d72d99a32 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/d/django.go @@ -0,0 +1,53 @@ +package d + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Django/Jinja lexer. +var DjangoJinja = internal.Register(MustNewLexer( + &Config{ + Name: "Django/Jinja", + Aliases: []string{"django", "jinja"}, + Filenames: []string{}, + MimeTypes: []string{"application/x-django-templating", "application/x-jinja"}, + DotAll: true, + }, + Rules{ + "root": { + {`[^{]+`, Other, nil}, + {`\{\{`, CommentPreproc, Push("var")}, + {`\{[*#].*?[*#]\}`, Comment, nil}, + {`(\{%)(-?\s*)(comment)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endcomment)(\s*-?)(%\})`, ByGroups(CommentPreproc, Text, Keyword, Text, CommentPreproc, Comment, CommentPreproc, Text, Keyword, Text, CommentPreproc), nil}, + {`(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endraw)(\s*-?)(%\})`, ByGroups(CommentPreproc, Text, Keyword, Text, CommentPreproc, Text, CommentPreproc, Text, Keyword, Text, CommentPreproc), nil}, + {`(\{%)(-?\s*)(filter)(\s+)([a-zA-Z_]\w*)`, ByGroups(CommentPreproc, Text, Keyword, Text, NameFunction), Push("block")}, + {`(\{%)(-?\s*)([a-zA-Z_]\w*)`, ByGroups(CommentPreproc, Text, Keyword), Push("block")}, + {`\{`, Other, nil}, + }, + "varnames": { + {`(\|)(\s*)([a-zA-Z_]\w*)`, ByGroups(Operator, Text, NameFunction), nil}, + {`(is)(\s+)(not)?(\s+)?([a-zA-Z_]\w*)`, ByGroups(Keyword, Text, Keyword, Text, NameFunction), nil}, + {`(_|true|false|none|True|False|None)\b`, KeywordPseudo, nil}, + {`(in|as|reversed|recursive|not|and|or|is|if|else|import|with(?:(?:out)?\s*context)?|scoped|ignore\s+missing)\b`, Keyword, nil}, + {`(loop|block|super|forloop)\b`, NameBuiltin, nil}, + {`[a-zA-Z_][\w-]*`, NameVariable, nil}, + {`\.\w+`, NameVariable, nil}, + {`:?"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`:?'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`([{}()\[\]+\-*/,:~]|[><=]=?)`, Operator, nil}, + {`[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil}, + }, + "var": { + {`\s+`, Text, nil}, + {`(-?)(\}\})`, ByGroups(Text, CommentPreproc), Pop(1)}, + Include("varnames"), + }, + "block": { + {`\s+`, Text, nil}, + {`(-?)(%\})`, ByGroups(Text, CommentPreproc), Pop(1)}, + Include("varnames"), + {`.`, Punctuation, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/d/docker.go b/vendor/github.com/alecthomas/chroma/lexers/d/docker.go new file mode 100644 index 000000000..a650eba5f --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/d/docker.go @@ -0,0 +1,31 @@ +package d + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/b" + "github.com/alecthomas/chroma/lexers/internal" + "github.com/alecthomas/chroma/lexers/j" +) + +// Docker lexer. +var Docker = internal.Register(MustNewLexer( + &Config{ + Name: "Docker", + Aliases: []string{"docker", "dockerfile"}, + Filenames: []string{"Dockerfile", "*.docker"}, + MimeTypes: []string{"text/x-dockerfile-config"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`#.*`, Comment, nil}, + {`(ONBUILD)((?:\s*\\?\s*))`, ByGroups(Keyword, Using(b.Bash)), nil}, + {`(HEALTHCHECK)(((?:\s*\\?\s*)--\w+=\w+(?:\s*\\?\s*))*)`, ByGroups(Keyword, Using(b.Bash)), nil}, + {`(VOLUME|ENTRYPOINT|CMD|SHELL)((?:\s*\\?\s*))(\[.*?\])`, ByGroups(Keyword, Using(b.Bash), Using(j.JSON)), nil}, + {`(LABEL|ENV|ARG)((?:(?:\s*\\?\s*)\w+=\w+(?:\s*\\?\s*))*)`, ByGroups(Keyword, Using(b.Bash)), nil}, + {`((?:FROM|MAINTAINER|EXPOSE|WORKDIR|USER|STOPSIGNAL)|VOLUME)\b(.*)`, ByGroups(Keyword, LiteralString), nil}, + {`((?:RUN|CMD|ENTRYPOINT|ENV|ARG|LABEL|ADD|COPY))`, Keyword, nil}, + {`(.*\\\n)*.+`, Using(b.Bash), nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/d/dtd.go b/vendor/github.com/alecthomas/chroma/lexers/d/dtd.go new file mode 100644 index 000000000..99bf5d374 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/d/dtd.go @@ -0,0 +1,69 @@ +package d + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Dtd lexer. +var Dtd = internal.Register(MustNewLexer( + &Config{ + Name: "DTD", + Aliases: []string{"dtd"}, + Filenames: []string{"*.dtd"}, + MimeTypes: []string{"application/xml-dtd"}, + DotAll: true, + }, + Rules{ + "root": { + Include("common"), + {`(\s]+)`, ByGroups(Keyword, Text, NameTag), nil}, + {`PUBLIC|SYSTEM`, KeywordConstant, nil}, + {`[\[\]>]`, Keyword, nil}, + }, + "common": { + {`\s+`, Text, nil}, + {`(%|&)[^;]*;`, NameEntity, nil}, + {``, Comment, Pop(1)}, + {`-`, Comment, nil}, + }, + "element": { + Include("common"), + {`EMPTY|ANY|#PCDATA`, KeywordConstant, nil}, + {`[^>\s|()?+*,]+`, NameTag, nil}, + {`>`, Keyword, Pop(1)}, + }, + "attlist": { + Include("common"), + {`CDATA|IDREFS|IDREF|ID|NMTOKENS|NMTOKEN|ENTITIES|ENTITY|NOTATION`, KeywordConstant, nil}, + {`#REQUIRED|#IMPLIED|#FIXED`, KeywordConstant, nil}, + {`xml:space|xml:lang`, KeywordReserved, nil}, + {`[^>\s|()?+*,]+`, NameAttribute, nil}, + {`>`, Keyword, Pop(1)}, + }, + "entity": { + Include("common"), + {`SYSTEM|PUBLIC|NDATA`, KeywordConstant, nil}, + {`[^>\s|()?+*,]+`, NameEntity, nil}, + {`>`, Keyword, Pop(1)}, + }, + "notation": { + Include("common"), + {`SYSTEM|PUBLIC`, KeywordConstant, nil}, + {`[^>\s|()?+*,]+`, NameAttribute, nil}, + {`>`, Keyword, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/e/ebnf.go b/vendor/github.com/alecthomas/chroma/lexers/e/ebnf.go new file mode 100644 index 000000000..42a3a3793 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/e/ebnf.go @@ -0,0 +1,51 @@ +package e + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Ebnf lexer. +var Ebnf = internal.Register(MustNewLexer( + &Config{ + Name: "EBNF", + Aliases: []string{"ebnf"}, + Filenames: []string{"*.ebnf"}, + MimeTypes: []string{"text/x-ebnf"}, + }, + Rules{ + "root": { + Include("whitespace"), + Include("comment_start"), + Include("identifier"), + {`=`, Operator, Push("production")}, + }, + "production": { + Include("whitespace"), + Include("comment_start"), + Include("identifier"), + {`"[^"]*"`, LiteralStringDouble, nil}, + {`'[^']*'`, LiteralStringSingle, nil}, + {`(\?[^?]*\?)`, NameEntity, nil}, + {`[\[\]{}(),|]`, Punctuation, nil}, + {`-`, Operator, nil}, + {`;`, Punctuation, Pop(1)}, + {`\.`, Punctuation, Pop(1)}, + }, + "whitespace": { + {`\s+`, Text, nil}, + }, + "comment_start": { + {`\(\*`, CommentMultiline, Push("comment")}, + }, + "comment": { + {`[^*)]`, CommentMultiline, nil}, + Include("comment_start"), + {`\*\)`, CommentMultiline, Pop(1)}, + {`[*)]`, CommentMultiline, nil}, + }, + "identifier": { + {`([a-zA-Z][\w \-]*)`, Keyword, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/e/elixir.go b/vendor/github.com/alecthomas/chroma/lexers/e/elixir.go new file mode 100644 index 000000000..40730290b --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/e/elixir.go @@ -0,0 +1,270 @@ +package e + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Elixir lexer. +var Elixir = internal.Register(MustNewLexer( + &Config{ + Name: "Elixir", + Aliases: []string{"elixir", "ex", "exs"}, + Filenames: []string{"*.ex", "*.exs"}, + MimeTypes: []string{"text/x-elixir"}, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`#.*$`, CommentSingle, nil}, + {`(\?)(\\x\{)([\da-fA-F]+)(\})`, ByGroups(LiteralStringChar, LiteralStringEscape, LiteralNumberHex, LiteralStringEscape), nil}, + {`(\?)(\\x[\da-fA-F]{1,2})`, ByGroups(LiteralStringChar, LiteralStringEscape), nil}, + {`(\?)(\\[abdefnrstv])`, ByGroups(LiteralStringChar, LiteralStringEscape), nil}, + {`\?\\?.`, LiteralStringChar, nil}, + {`:::`, LiteralStringSymbol, nil}, + {`::`, Operator, nil}, + {`:(?:\.\.\.|<<>>|%\{\}|%|\{\})`, LiteralStringSymbol, nil}, + {`:(?:(?:\.\.\.|[a-z_]\w*[!?]?)|[A-Z]\w*(?:\.[A-Z]\w*)*|(?:\<\<\<|\>\>\>|\|\|\||\&\&\&|\^\^\^|\~\~\~|\=\=\=|\!\=\=|\~\>\>|\<\~\>|\|\~\>|\<\|\>|\=\=|\!\=|\<\=|\>\=|\&\&|\|\||\<\>|\+\+|\-\-|\|\>|\=\~|\-\>|\<\-|\||\.|\=|\~\>|\<\~|\<|\>|\+|\-|\*|\/|\!|\^|\&))`, LiteralStringSymbol, nil}, + {`:"`, LiteralStringSymbol, Push("string_double_atom")}, + {`:'`, LiteralStringSymbol, Push("string_single_atom")}, + {`((?:\.\.\.|<<>>|%\{\}|%|\{\})|(?:(?:\.\.\.|[a-z_]\w*[!?]?)|[A-Z]\w*(?:\.[A-Z]\w*)*|(?:\<\<\<|\>\>\>|\|\|\||\&\&\&|\^\^\^|\~\~\~|\=\=\=|\!\=\=|\~\>\>|\<\~\>|\|\~\>|\<\|\>|\=\=|\!\=|\<\=|\>\=|\&\&|\|\||\<\>|\+\+|\-\-|\|\>|\=\~|\-\>|\<\-|\||\.|\=|\~\>|\<\~|\<|\>|\+|\-|\*|\/|\!|\^|\&)))(:)(?=\s|\n)`, ByGroups(LiteralStringSymbol, Punctuation), nil}, + {`@(?:\.\.\.|[a-z_]\w*[!?]?)`, NameAttribute, nil}, + {`(?:\.\.\.|[a-z_]\w*[!?]?)`, Name, nil}, + {`(%?)([A-Z]\w*(?:\.[A-Z]\w*)*)`, ByGroups(Punctuation, NameClass), nil}, + {`\<\<\<|\>\>\>|\|\|\||\&\&\&|\^\^\^|\~\~\~|\=\=\=|\!\=\=|\~\>\>|\<\~\>|\|\~\>|\<\|\>`, Operator, nil}, + {`\=\=|\!\=|\<\=|\>\=|\&\&|\|\||\<\>|\+\+|\-\-|\|\>|\=\~|\-\>|\<\-|\||\.|\=|\~\>|\<\~`, Operator, nil}, + {`\\\\|\<\<|\>\>|\=\>|\(|\)|\:|\;|\,|\[|\]`, Punctuation, nil}, + {`&\d`, NameEntity, nil}, + {`\<|\>|\+|\-|\*|\/|\!|\^|\&`, Operator, nil}, + {`0b[01](_?[01])*`, LiteralNumberBin, nil}, + {`0o[0-7](_?[0-7])*`, LiteralNumberOct, nil}, + {`0x[\da-fA-F](_?[\dA-Fa-f])*`, LiteralNumberHex, nil}, + {`\d(_?\d)*\.\d(_?\d)*([eE][-+]?\d(_?\d)*)?`, LiteralNumberFloat, nil}, + {`\d(_?\d)*`, LiteralNumberInteger, nil}, + {`"""\s*`, LiteralStringHeredoc, Push("heredoc_double")}, + {`'''\s*$`, LiteralStringHeredoc, Push("heredoc_single")}, + {`"`, LiteralStringDouble, Push("string_double")}, + {`'`, LiteralStringSingle, Push("string_single")}, + Include("sigils"), + {`%\{`, Punctuation, Push("map_key")}, + {`\{`, Punctuation, Push("tuple")}, + }, + "heredoc_double": { + {`^\s*"""`, LiteralStringHeredoc, Pop(1)}, + Include("heredoc_interpol"), + }, + "heredoc_single": { + {`^\s*'''`, LiteralStringHeredoc, Pop(1)}, + Include("heredoc_interpol"), + }, + "heredoc_interpol": { + {`[^#\\\n]+`, LiteralStringHeredoc, nil}, + Include("escapes"), + {`\\.`, LiteralStringHeredoc, nil}, + {`\n+`, LiteralStringHeredoc, nil}, + Include("interpol"), + }, + "heredoc_no_interpol": { + {`[^\\\n]+`, LiteralStringHeredoc, nil}, + {`\\.`, LiteralStringHeredoc, nil}, + {`\n+`, LiteralStringHeredoc, nil}, + }, + "escapes": { + {`(\\x\{)([\da-fA-F]+)(\})`, ByGroups(LiteralStringEscape, LiteralNumberHex, LiteralStringEscape), nil}, + {`(\\x[\da-fA-F]{1,2})`, LiteralStringEscape, nil}, + {`(\\[abdefnrstv])`, LiteralStringEscape, nil}, + }, + "interpol": { + {`#\{`, LiteralStringInterpol, Push("interpol_string")}, + }, + "interpol_string": { + {`\}`, LiteralStringInterpol, Pop(1)}, + Include("root"), + }, + "map_key": { + Include("root"), + {`:`, Punctuation, Push("map_val")}, + {`=>`, Punctuation, Push("map_val")}, + {`\}`, Punctuation, Pop(1)}, + }, + "map_val": { + Include("root"), + {`,`, Punctuation, Pop(1)}, + {`(?=\})`, Punctuation, Pop(1)}, + }, + "tuple": { + Include("root"), + {`\}`, Punctuation, Pop(1)}, + }, + "string_double": { + {`[^#"\\]+`, LiteralStringDouble, nil}, + Include("escapes"), + {`\\.`, LiteralStringDouble, nil}, + {`(")`, ByGroups(LiteralStringDouble), Pop(1)}, + Include("interpol"), + }, + "string_single": { + {`[^#'\\]+`, LiteralStringSingle, nil}, + Include("escapes"), + {`\\.`, LiteralStringSingle, nil}, + {`(')`, ByGroups(LiteralStringSingle), Pop(1)}, + Include("interpol"), + }, + "string_double_atom": { + {`[^#"\\]+`, LiteralStringSymbol, nil}, + Include("escapes"), + {`\\.`, LiteralStringSymbol, nil}, + {`(")`, ByGroups(LiteralStringSymbol), Pop(1)}, + Include("interpol"), + }, + "string_single_atom": { + {`[^#'\\]+`, LiteralStringSymbol, nil}, + Include("escapes"), + {`\\.`, LiteralStringSymbol, nil}, + {`(')`, ByGroups(LiteralStringSymbol), Pop(1)}, + Include("interpol"), + }, + "sigils": { + {`(~[a-z])(""")`, ByGroups(LiteralStringOther, LiteralStringHeredoc), Push("triquot-end", "triquot-intp")}, + {`(~[A-Z])(""")`, ByGroups(LiteralStringOther, LiteralStringHeredoc), Push("triquot-end", "triquot-no-intp")}, + {`(~[a-z])(''')`, ByGroups(LiteralStringOther, LiteralStringHeredoc), Push("triapos-end", "triapos-intp")}, + {`(~[A-Z])(''')`, ByGroups(LiteralStringOther, LiteralStringHeredoc), Push("triapos-end", "triapos-no-intp")}, + {`~[a-z]\{`, LiteralStringOther, Push("cb-intp")}, + {`~[A-Z]\{`, LiteralStringOther, Push("cb-no-intp")}, + {`~[a-z]\[`, LiteralStringOther, Push("sb-intp")}, + {`~[A-Z]\[`, LiteralStringOther, Push("sb-no-intp")}, + {`~[a-z]\(`, LiteralStringOther, Push("pa-intp")}, + {`~[A-Z]\(`, LiteralStringOther, Push("pa-no-intp")}, + {`~[a-z]<`, LiteralStringOther, Push("ab-intp")}, + {`~[A-Z]<`, LiteralStringOther, Push("ab-no-intp")}, + {`~[a-z]/`, LiteralStringOther, Push("slas-intp")}, + {`~[A-Z]/`, LiteralStringOther, Push("slas-no-intp")}, + {`~[a-z]\|`, LiteralStringOther, Push("pipe-intp")}, + {`~[A-Z]\|`, LiteralStringOther, Push("pipe-no-intp")}, + {`~[a-z]"`, LiteralStringOther, Push("quot-intp")}, + {`~[A-Z]"`, LiteralStringOther, Push("quot-no-intp")}, + {`~[a-z]'`, LiteralStringOther, Push("apos-intp")}, + {`~[A-Z]'`, LiteralStringOther, Push("apos-no-intp")}, + }, + "triquot-end": { + {`[a-zA-Z]+`, LiteralStringOther, Pop(1)}, + Default(Pop(1)), + }, + "triquot-intp": { + {`^\s*"""`, LiteralStringHeredoc, Pop(1)}, + Include("heredoc_interpol"), + }, + "triquot-no-intp": { + {`^\s*"""`, LiteralStringHeredoc, Pop(1)}, + Include("heredoc_no_interpol"), + }, + "triapos-end": { + {`[a-zA-Z]+`, LiteralStringOther, Pop(1)}, + Default(Pop(1)), + }, + "triapos-intp": { + {`^\s*'''`, LiteralStringHeredoc, Pop(1)}, + Include("heredoc_interpol"), + }, + "triapos-no-intp": { + {`^\s*'''`, LiteralStringHeredoc, Pop(1)}, + Include("heredoc_no_interpol"), + }, + "cb-intp": { + {`[^#\}\\]+`, LiteralStringOther, nil}, + Include("escapes"), + {`\\.`, LiteralStringOther, nil}, + {`\}[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + Include("interpol"), + }, + "cb-no-intp": { + {`[^\}\\]+`, LiteralStringOther, nil}, + {`\\.`, LiteralStringOther, nil}, + {`\}[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + }, + "sb-intp": { + {`[^#\]\\]+`, LiteralStringOther, nil}, + Include("escapes"), + {`\\.`, LiteralStringOther, nil}, + {`\][a-zA-Z]*`, LiteralStringOther, Pop(1)}, + Include("interpol"), + }, + "sb-no-intp": { + {`[^\]\\]+`, LiteralStringOther, nil}, + {`\\.`, LiteralStringOther, nil}, + {`\][a-zA-Z]*`, LiteralStringOther, Pop(1)}, + }, + "pa-intp": { + {`[^#\)\\]+`, LiteralStringOther, nil}, + Include("escapes"), + {`\\.`, LiteralStringOther, nil}, + {`\)[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + Include("interpol"), + }, + "pa-no-intp": { + {`[^\)\\]+`, LiteralStringOther, nil}, + {`\\.`, LiteralStringOther, nil}, + {`\)[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + }, + "ab-intp": { + {`[^#>\\]+`, LiteralStringOther, nil}, + Include("escapes"), + {`\\.`, LiteralStringOther, nil}, + {`>[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + Include("interpol"), + }, + "ab-no-intp": { + {`[^>\\]+`, LiteralStringOther, nil}, + {`\\.`, LiteralStringOther, nil}, + {`>[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + }, + "slas-intp": { + {`[^#/\\]+`, LiteralStringOther, nil}, + Include("escapes"), + {`\\.`, LiteralStringOther, nil}, + {`/[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + Include("interpol"), + }, + "slas-no-intp": { + {`[^/\\]+`, LiteralStringOther, nil}, + {`\\.`, LiteralStringOther, nil}, + {`/[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + }, + "pipe-intp": { + {`[^#\|\\]+`, LiteralStringOther, nil}, + Include("escapes"), + {`\\.`, LiteralStringOther, nil}, + {`\|[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + Include("interpol"), + }, + "pipe-no-intp": { + {`[^\|\\]+`, LiteralStringOther, nil}, + {`\\.`, LiteralStringOther, nil}, + {`\|[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + }, + "quot-intp": { + {`[^#"\\]+`, LiteralStringOther, nil}, + Include("escapes"), + {`\\.`, LiteralStringOther, nil}, + {`"[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + Include("interpol"), + }, + "quot-no-intp": { + {`[^"\\]+`, LiteralStringOther, nil}, + {`\\.`, LiteralStringOther, nil}, + {`"[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + }, + "apos-intp": { + {`[^#'\\]+`, LiteralStringOther, nil}, + Include("escapes"), + {`\\.`, LiteralStringOther, nil}, + {`'[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + Include("interpol"), + }, + "apos-no-intp": { + {`[^'\\]+`, LiteralStringOther, nil}, + {`\\.`, LiteralStringOther, nil}, + {`'[a-zA-Z]*`, LiteralStringOther, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/e/elm.go b/vendor/github.com/alecthomas/chroma/lexers/e/elm.go new file mode 100644 index 000000000..a71c6270e --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/e/elm.go @@ -0,0 +1,59 @@ +package e + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Elm lexer. +var Elm = internal.Register(MustNewLexer( + &Config{ + Name: "Elm", + Aliases: []string{"elm"}, + Filenames: []string{"*.elm"}, + MimeTypes: []string{"text/x-elm"}, + }, + Rules{ + "root": { + {`\{-`, CommentMultiline, Push("comment")}, + {`--.*`, CommentSingle, nil}, + {`\s+`, Text, nil}, + {`"`, LiteralString, Push("doublequote")}, + {`^\s*module\s*`, KeywordNamespace, Push("imports")}, + {`^\s*import\s*`, KeywordNamespace, Push("imports")}, + {`\[glsl\|.*`, NameEntity, Push("shader")}, + {Words(``, `\b`, `alias`, `as`, `case`, `else`, `if`, `import`, `in`, `let`, `module`, `of`, `port`, `then`, `type`, `where`), KeywordReserved, nil}, + {`[A-Z]\w*`, KeywordType, nil}, + {`^main `, KeywordReserved, nil}, + {Words(`\(`, `\)`, `~`, `||`, `|>`, `|`, "`", `^`, `\`, `'`, `>>`, `>=`, `>`, `==`, `=`, `<~`, `<|`, `<=`, `<<`, `<-`, `<`, `::`, `:`, `/=`, `//`, `/`, `..`, `.`, `->`, `-`, `++`, `+`, `*`, `&&`, `%`), NameFunction, nil}, + {Words(``, ``, `~`, `||`, `|>`, `|`, "`", `^`, `\`, `'`, `>>`, `>=`, `>`, `==`, `=`, `<~`, `<|`, `<=`, `<<`, `<-`, `<`, `::`, `:`, `/=`, `//`, `/`, `..`, `.`, `->`, `-`, `++`, `+`, `*`, `&&`, `%`), NameFunction, nil}, + Include("numbers"), + {`[a-z_][a-zA-Z_\']*`, NameVariable, nil}, + {`[,()\[\]{}]`, Punctuation, nil}, + }, + "comment": { + {`-(?!\})`, CommentMultiline, nil}, + {`\{-`, CommentMultiline, Push("comment")}, + {`[^-}]`, CommentMultiline, nil}, + {`-\}`, CommentMultiline, Pop(1)}, + }, + "doublequote": { + {`\\u[0-9a-fA-F]{4}`, LiteralStringEscape, nil}, + {`\\[nrfvb\\"]`, LiteralStringEscape, nil}, + {`[^"]`, LiteralString, nil}, + {`"`, LiteralString, Pop(1)}, + }, + "imports": { + {`\w+(\.\w+)*`, NameClass, Pop(1)}, + }, + "numbers": { + {`_?\d+\.(?=\d+)`, LiteralNumberFloat, nil}, + {`_?\d+`, LiteralNumberInteger, nil}, + }, + "shader": { + {`\|(?!\])`, NameEntity, nil}, + {`\|\]`, NameEntity, Pop(1)}, + {`.*\n`, NameEntity, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/e/emacs.go b/vendor/github.com/alecthomas/chroma/lexers/e/emacs.go new file mode 100644 index 000000000..78ffda122 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/e/emacs.go @@ -0,0 +1,582 @@ +package e + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +var ( + emacsMacros = []string{ + "atomic-change-group", "case", "block", "cl-block", "cl-callf", "cl-callf2", + "cl-case", "cl-decf", "cl-declaim", "cl-declare", + "cl-define-compiler-macro", "cl-defmacro", "cl-defstruct", + "cl-defsubst", "cl-deftype", "cl-defun", "cl-destructuring-bind", + "cl-do", "cl-do*", "cl-do-all-symbols", "cl-do-symbols", "cl-dolist", + "cl-dotimes", "cl-ecase", "cl-etypecase", "eval-when", "cl-eval-when", "cl-flet", + "cl-flet*", "cl-function", "cl-incf", "cl-labels", "cl-letf", + "cl-letf*", "cl-load-time-value", "cl-locally", "cl-loop", + "cl-macrolet", "cl-multiple-value-bind", "cl-multiple-value-setq", + "cl-progv", "cl-psetf", "cl-psetq", "cl-pushnew", "cl-remf", + "cl-return", "cl-return-from", "cl-rotatef", "cl-shiftf", + "cl-symbol-macrolet", "cl-tagbody", "cl-the", "cl-typecase", + "combine-after-change-calls", "condition-case-unless-debug", "decf", + "declaim", "declare", "declare-function", "def-edebug-spec", + "defadvice", "defclass", "defcustom", "defface", "defgeneric", + "defgroup", "define-advice", "define-alternatives", + "define-compiler-macro", "define-derived-mode", "define-generic-mode", + "define-global-minor-mode", "define-globalized-minor-mode", + "define-minor-mode", "define-modify-macro", + "define-obsolete-face-alias", "define-obsolete-function-alias", + "define-obsolete-variable-alias", "define-setf-expander", + "define-skeleton", "defmacro", "defmethod", "defsetf", "defstruct", + "defsubst", "deftheme", "deftype", "defun", "defvar-local", + "delay-mode-hooks", "destructuring-bind", "do", "do*", + "do-all-symbols", "do-symbols", "dolist", "dont-compile", "dotimes", + "dotimes-with-progress-reporter", "ecase", "ert-deftest", "etypecase", + "eval-and-compile", "eval-when-compile", "flet", "ignore-errors", + "incf", "labels", "lambda", "letrec", "lexical-let", "lexical-let*", + "loop", "multiple-value-bind", "multiple-value-setq", "noreturn", + "oref", "oref-default", "oset", "oset-default", "pcase", + "pcase-defmacro", "pcase-dolist", "pcase-exhaustive", "pcase-let", + "pcase-let*", "pop", "psetf", "psetq", "push", "pushnew", "remf", + "return", "rotatef", "rx", "save-match-data", "save-selected-window", + "save-window-excursion", "setf", "setq-local", "shiftf", + "track-mouse", "typecase", "unless", "use-package", "when", + "while-no-input", "with-case-table", "with-category-table", + "with-coding-priority", "with-current-buffer", "with-demoted-errors", + "with-eval-after-load", "with-file-modes", "with-local-quit", + "with-output-to-string", "with-output-to-temp-buffer", + "with-parsed-tramp-file-name", "with-selected-frame", + "with-selected-window", "with-silent-modifications", "with-slots", + "with-syntax-table", "with-temp-buffer", "with-temp-file", + "with-temp-message", "with-timeout", "with-tramp-connection-property", + "with-tramp-file-property", "with-tramp-progress-reporter", + "with-wrapper-hook", "load-time-value", "locally", "macrolet", "progv", + "return-from", + } + + emacsSpecialForms = []string{ + "and", "catch", "cond", "condition-case", "defconst", "defvar", + "function", "if", "interactive", "let", "let*", "or", "prog1", + "prog2", "progn", "quote", "save-current-buffer", "save-excursion", + "save-restriction", "setq", "setq-default", "subr-arity", + "unwind-protect", "while", + } + + emacsBuiltinFunction = []string{ + "%", "*", "+", "-", "/", "/=", "1+", "1-", "<", "<=", "=", ">", ">=", + "Snarf-documentation", "abort-recursive-edit", "abs", + "accept-process-output", "access-file", "accessible-keymaps", "acos", + "active-minibuffer-window", "add-face-text-property", + "add-name-to-file", "add-text-properties", "all-completions", + "append", "apply", "apropos-internal", "aref", "arrayp", "aset", + "ash", "asin", "assoc", "assoc-string", "assq", "atan", "atom", + "autoload", "autoload-do-load", "backtrace", "backtrace--locals", + "backtrace-debug", "backtrace-eval", "backtrace-frame", + "backward-char", "backward-prefix-chars", "barf-if-buffer-read-only", + "base64-decode-region", "base64-decode-string", + "base64-encode-region", "base64-encode-string", "beginning-of-line", + "bidi-find-overridden-directionality", "bidi-resolved-levels", + "bitmap-spec-p", "bobp", "bolp", "bool-vector", + "bool-vector-count-consecutive", "bool-vector-count-population", + "bool-vector-exclusive-or", "bool-vector-intersection", + "bool-vector-not", "bool-vector-p", "bool-vector-set-difference", + "bool-vector-subsetp", "bool-vector-union", "boundp", + "buffer-base-buffer", "buffer-chars-modified-tick", + "buffer-enable-undo", "buffer-file-name", "buffer-has-markers-at", + "buffer-list", "buffer-live-p", "buffer-local-value", + "buffer-local-variables", "buffer-modified-p", "buffer-modified-tick", + "buffer-name", "buffer-size", "buffer-string", "buffer-substring", + "buffer-substring-no-properties", "buffer-swap-text", "bufferp", + "bury-buffer-internal", "byte-code", "byte-code-function-p", + "byte-to-position", "byte-to-string", "byteorder", + "call-interactively", "call-last-kbd-macro", "call-process", + "call-process-region", "cancel-kbd-macro-events", "capitalize", + "capitalize-region", "capitalize-word", "car", "car-less-than-car", + "car-safe", "case-table-p", "category-docstring", + "category-set-mnemonics", "category-table", "category-table-p", + "ccl-execute", "ccl-execute-on-string", "ccl-program-p", "cdr", + "cdr-safe", "ceiling", "char-after", "char-before", + "char-category-set", "char-charset", "char-equal", "char-or-string-p", + "char-resolve-modifiers", "char-syntax", "char-table-extra-slot", + "char-table-p", "char-table-parent", "char-table-range", + "char-table-subtype", "char-to-string", "char-width", "characterp", + "charset-after", "charset-id-internal", "charset-plist", + "charset-priority-list", "charsetp", "check-coding-system", + "check-coding-systems-region", "clear-buffer-auto-save-failure", + "clear-charset-maps", "clear-face-cache", "clear-font-cache", + "clear-image-cache", "clear-string", "clear-this-command-keys", + "close-font", "clrhash", "coding-system-aliases", + "coding-system-base", "coding-system-eol-type", "coding-system-p", + "coding-system-plist", "coding-system-priority-list", + "coding-system-put", "color-distance", "color-gray-p", + "color-supported-p", "combine-after-change-execute", + "command-error-default-function", "command-remapping", "commandp", + "compare-buffer-substrings", "compare-strings", + "compare-window-configurations", "completing-read", + "compose-region-internal", "compose-string-internal", + "composition-get-gstring", "compute-motion", "concat", "cons", + "consp", "constrain-to-field", "continue-process", + "controlling-tty-p", "coordinates-in-window-p", "copy-alist", + "copy-category-table", "copy-file", "copy-hash-table", "copy-keymap", + "copy-marker", "copy-sequence", "copy-syntax-table", "copysign", + "cos", "current-active-maps", "current-bidi-paragraph-direction", + "current-buffer", "current-case-table", "current-column", + "current-global-map", "current-idle-time", "current-indentation", + "current-input-mode", "current-local-map", "current-message", + "current-minor-mode-maps", "current-time", "current-time-string", + "current-time-zone", "current-window-configuration", + "cygwin-convert-file-name-from-windows", + "cygwin-convert-file-name-to-windows", "daemon-initialized", + "daemonp", "dbus--init-bus", "dbus-get-unique-name", + "dbus-message-internal", "debug-timer-check", "declare-equiv-charset", + "decode-big5-char", "decode-char", "decode-coding-region", + "decode-coding-string", "decode-sjis-char", "decode-time", + "default-boundp", "default-file-modes", "default-printer-name", + "default-toplevel-value", "default-value", "define-category", + "define-charset-alias", "define-charset-internal", + "define-coding-system-alias", "define-coding-system-internal", + "define-fringe-bitmap", "define-hash-table-test", "define-key", + "define-prefix-command", "delete", + "delete-all-overlays", "delete-and-extract-region", "delete-char", + "delete-directory-internal", "delete-field", "delete-file", + "delete-frame", "delete-other-windows-internal", "delete-overlay", + "delete-process", "delete-region", "delete-terminal", + "delete-window-internal", "delq", "describe-buffer-bindings", + "describe-vector", "destroy-fringe-bitmap", "detect-coding-region", + "detect-coding-string", "ding", "directory-file-name", + "directory-files", "directory-files-and-attributes", "discard-input", + "display-supports-face-attributes-p", "do-auto-save", "documentation", + "documentation-property", "downcase", "downcase-region", + "downcase-word", "draw-string", "dump-colors", "dump-emacs", + "dump-face", "dump-frame-glyph-matrix", "dump-glyph-matrix", + "dump-glyph-row", "dump-redisplay-history", "dump-tool-bar-row", + "elt", "emacs-pid", "encode-big5-char", "encode-char", + "encode-coding-region", "encode-coding-string", "encode-sjis-char", + "encode-time", "end-kbd-macro", "end-of-line", "eobp", "eolp", "eq", + "eql", "equal", "equal-including-properties", "erase-buffer", + "error-message-string", "eval", "eval-buffer", "eval-region", + "event-convert-list", "execute-kbd-macro", "exit-recursive-edit", + "exp", "expand-file-name", "expt", "external-debugging-output", + "face-attribute-relative-p", "face-attributes-as-vector", "face-font", + "fboundp", "fceiling", "fetch-bytecode", "ffloor", + "field-beginning", "field-end", "field-string", + "field-string-no-properties", "file-accessible-directory-p", + "file-acl", "file-attributes", "file-attributes-lessp", + "file-directory-p", "file-executable-p", "file-exists-p", + "file-locked-p", "file-modes", "file-name-absolute-p", + "file-name-all-completions", "file-name-as-directory", + "file-name-completion", "file-name-directory", + "file-name-nondirectory", "file-newer-than-file-p", "file-readable-p", + "file-regular-p", "file-selinux-context", "file-symlink-p", + "file-system-info", "file-system-info", "file-writable-p", + "fillarray", "find-charset-region", "find-charset-string", + "find-coding-systems-region-internal", "find-composition-internal", + "find-file-name-handler", "find-font", "find-operation-coding-system", + "float", "float-time", "floatp", "floor", "fmakunbound", + "following-char", "font-at", "font-drive-otf", "font-face-attributes", + "font-family-list", "font-get", "font-get-glyphs", + "font-get-system-font", "font-get-system-normal-font", "font-info", + "font-match-p", "font-otf-alternates", "font-put", + "font-shape-gstring", "font-spec", "font-variation-glyphs", + "font-xlfd-name", "fontp", "fontset-font", "fontset-info", + "fontset-list", "fontset-list-all", "force-mode-line-update", + "force-window-update", "format", "format-mode-line", + "format-network-address", "format-time-string", "forward-char", + "forward-comment", "forward-line", "forward-word", + "frame-border-width", "frame-bottom-divider-width", + "frame-can-run-window-configuration-change-hook", "frame-char-height", + "frame-char-width", "frame-face-alist", "frame-first-window", + "frame-focus", "frame-font-cache", "frame-fringe-width", "frame-list", + "frame-live-p", "frame-or-buffer-changed-p", "frame-parameter", + "frame-parameters", "frame-pixel-height", "frame-pixel-width", + "frame-pointer-visible-p", "frame-right-divider-width", + "frame-root-window", "frame-scroll-bar-height", + "frame-scroll-bar-width", "frame-selected-window", "frame-terminal", + "frame-text-cols", "frame-text-height", "frame-text-lines", + "frame-text-width", "frame-total-cols", "frame-total-lines", + "frame-visible-p", "framep", "frexp", "fringe-bitmaps-at-pos", + "fround", "fset", "ftruncate", "funcall", "funcall-interactively", + "function-equal", "functionp", "gap-position", "gap-size", + "garbage-collect", "gc-status", "generate-new-buffer-name", "get", + "get-buffer", "get-buffer-create", "get-buffer-process", + "get-buffer-window", "get-byte", "get-char-property", + "get-char-property-and-overlay", "get-file-buffer", "get-file-char", + "get-internal-run-time", "get-load-suffixes", "get-pos-property", + "get-process", "get-screen-color", "get-text-property", + "get-unicode-property-internal", "get-unused-category", + "get-unused-iso-final-char", "getenv-internal", "gethash", + "gfile-add-watch", "gfile-rm-watch", "global-key-binding", + "gnutls-available-p", "gnutls-boot", "gnutls-bye", "gnutls-deinit", + "gnutls-error-fatalp", "gnutls-error-string", "gnutls-errorp", + "gnutls-get-initstage", "gnutls-peer-status", + "gnutls-peer-status-warning-describe", "goto-char", "gpm-mouse-start", + "gpm-mouse-stop", "group-gid", "group-real-gid", + "handle-save-session", "handle-switch-frame", "hash-table-count", + "hash-table-p", "hash-table-rehash-size", + "hash-table-rehash-threshold", "hash-table-size", "hash-table-test", + "hash-table-weakness", "iconify-frame", "identity", "image-flush", + "image-mask-p", "image-metadata", "image-size", "imagemagick-types", + "imagep", "indent-to", "indirect-function", "indirect-variable", + "init-image-library", "inotify-add-watch", "inotify-rm-watch", + "input-pending-p", "insert", "insert-and-inherit", + "insert-before-markers", "insert-before-markers-and-inherit", + "insert-buffer-substring", "insert-byte", "insert-char", + "insert-file-contents", "insert-startup-screen", "int86", + "integer-or-marker-p", "integerp", "interactive-form", "intern", + "intern-soft", "internal--track-mouse", "internal-char-font", + "internal-complete-buffer", "internal-copy-lisp-face", + "internal-default-process-filter", + "internal-default-process-sentinel", "internal-describe-syntax-value", + "internal-event-symbol-parse-modifiers", + "internal-face-x-get-resource", "internal-get-lisp-face-attribute", + "internal-lisp-face-attribute-values", "internal-lisp-face-empty-p", + "internal-lisp-face-equal-p", "internal-lisp-face-p", + "internal-make-lisp-face", "internal-make-var-non-special", + "internal-merge-in-global-face", + "internal-set-alternative-font-family-alist", + "internal-set-alternative-font-registry-alist", + "internal-set-font-selection-order", + "internal-set-lisp-face-attribute", + "internal-set-lisp-face-attribute-from-resource", + "internal-show-cursor", "internal-show-cursor-p", "interrupt-process", + "invisible-p", "invocation-directory", "invocation-name", "isnan", + "iso-charset", "key-binding", "key-description", + "keyboard-coding-system", "keymap-parent", "keymap-prompt", "keymapp", + "keywordp", "kill-all-local-variables", "kill-buffer", "kill-emacs", + "kill-local-variable", "kill-process", "last-nonminibuffer-frame", + "lax-plist-get", "lax-plist-put", "ldexp", "length", + "libxml-parse-html-region", "libxml-parse-xml-region", + "line-beginning-position", "line-end-position", "line-pixel-height", + "list", "list-fonts", "list-system-processes", "listp", "load", + "load-average", "local-key-binding", "local-variable-if-set-p", + "local-variable-p", "locale-info", "locate-file-internal", + "lock-buffer", "log", "logand", "logb", "logior", "lognot", "logxor", + "looking-at", "lookup-image", "lookup-image-map", "lookup-key", + "lower-frame", "lsh", "macroexpand", "make-bool-vector", + "make-byte-code", "make-category-set", "make-category-table", + "make-char", "make-char-table", "make-directory-internal", + "make-frame-invisible", "make-frame-visible", "make-hash-table", + "make-indirect-buffer", "make-keymap", "make-list", + "make-local-variable", "make-marker", "make-network-process", + "make-overlay", "make-serial-process", "make-sparse-keymap", + "make-string", "make-symbol", "make-symbolic-link", "make-temp-name", + "make-terminal-frame", "make-variable-buffer-local", + "make-variable-frame-local", "make-vector", "makunbound", + "map-char-table", "map-charset-chars", "map-keymap", + "map-keymap-internal", "mapatoms", "mapc", "mapcar", "mapconcat", + "maphash", "mark-marker", "marker-buffer", "marker-insertion-type", + "marker-position", "markerp", "match-beginning", "match-data", + "match-end", "matching-paren", "max", "max-char", "md5", "member", + "memory-info", "memory-limit", "memory-use-counts", "memq", "memql", + "menu-bar-menu-at-x-y", "menu-or-popup-active-p", + "menu-or-popup-active-p", "merge-face-attribute", "message", + "message-box", "message-or-box", "min", + "minibuffer-completion-contents", "minibuffer-contents", + "minibuffer-contents-no-properties", "minibuffer-depth", + "minibuffer-prompt", "minibuffer-prompt-end", + "minibuffer-selected-window", "minibuffer-window", "minibufferp", + "minor-mode-key-binding", "mod", "modify-category-entry", + "modify-frame-parameters", "modify-syntax-entry", + "mouse-pixel-position", "mouse-position", "move-overlay", + "move-point-visually", "move-to-column", "move-to-window-line", + "msdos-downcase-filename", "msdos-long-file-names", "msdos-memget", + "msdos-memput", "msdos-mouse-disable", "msdos-mouse-enable", + "msdos-mouse-init", "msdos-mouse-p", "msdos-remember-default-colors", + "msdos-set-keyboard", "msdos-set-mouse-buttons", + "multibyte-char-to-unibyte", "multibyte-string-p", "narrow-to-region", + "natnump", "nconc", "network-interface-info", + "network-interface-list", "new-fontset", "newline-cache-check", + "next-char-property-change", "next-frame", "next-overlay-change", + "next-property-change", "next-read-file-uses-dialog-p", + "next-single-char-property-change", "next-single-property-change", + "next-window", "nlistp", "nreverse", "nth", "nthcdr", "null", + "number-or-marker-p", "number-to-string", "numberp", + "open-dribble-file", "open-font", "open-termscript", + "optimize-char-table", "other-buffer", "other-window-for-scrolling", + "overlay-buffer", "overlay-end", "overlay-get", "overlay-lists", + "overlay-properties", "overlay-put", "overlay-recenter", + "overlay-start", "overlayp", "overlays-at", "overlays-in", + "parse-partial-sexp", "play-sound-internal", "plist-get", + "plist-member", "plist-put", "point", "point-marker", "point-max", + "point-max-marker", "point-min", "point-min-marker", + "pos-visible-in-window-p", "position-bytes", "posix-looking-at", + "posix-search-backward", "posix-search-forward", "posix-string-match", + "posn-at-point", "posn-at-x-y", "preceding-char", + "prefix-numeric-value", "previous-char-property-change", + "previous-frame", "previous-overlay-change", + "previous-property-change", "previous-single-char-property-change", + "previous-single-property-change", "previous-window", "prin1", + "prin1-to-string", "princ", "print", "process-attributes", + "process-buffer", "process-coding-system", "process-command", + "process-connection", "process-contact", "process-datagram-address", + "process-exit-status", "process-filter", "process-filter-multibyte-p", + "process-id", "process-inherit-coding-system-flag", "process-list", + "process-mark", "process-name", "process-plist", + "process-query-on-exit-flag", "process-running-child-p", + "process-send-eof", "process-send-region", "process-send-string", + "process-sentinel", "process-status", "process-tty-name", + "process-type", "processp", "profiler-cpu-log", + "profiler-cpu-running-p", "profiler-cpu-start", "profiler-cpu-stop", + "profiler-memory-log", "profiler-memory-running-p", + "profiler-memory-start", "profiler-memory-stop", "propertize", + "purecopy", "put", "put-text-property", + "put-unicode-property-internal", "puthash", "query-font", + "query-fontset", "quit-process", "raise-frame", "random", "rassoc", + "rassq", "re-search-backward", "re-search-forward", "read", + "read-buffer", "read-char", "read-char-exclusive", + "read-coding-system", "read-command", "read-event", + "read-from-minibuffer", "read-from-string", "read-function", + "read-key-sequence", "read-key-sequence-vector", + "read-no-blanks-input", "read-non-nil-coding-system", "read-string", + "read-variable", "recent-auto-save-p", "recent-doskeys", + "recent-keys", "recenter", "recursion-depth", "recursive-edit", + "redirect-debugging-output", "redirect-frame-focus", "redisplay", + "redraw-display", "redraw-frame", "regexp-quote", "region-beginning", + "region-end", "register-ccl-program", "register-code-conversion-map", + "remhash", "remove-list-of-text-properties", "remove-text-properties", + "rename-buffer", "rename-file", "replace-match", + "reset-this-command-lengths", "resize-mini-window-internal", + "restore-buffer-modified-p", "resume-tty", "reverse", "round", + "run-hook-with-args", "run-hook-with-args-until-failure", + "run-hook-with-args-until-success", "run-hook-wrapped", "run-hooks", + "run-window-configuration-change-hook", "run-window-scroll-functions", + "safe-length", "scan-lists", "scan-sexps", "scroll-down", + "scroll-left", "scroll-other-window", "scroll-right", "scroll-up", + "search-backward", "search-forward", "secure-hash", "select-frame", + "select-window", "selected-frame", "selected-window", + "self-insert-command", "send-string-to-terminal", "sequencep", + "serial-process-configure", "set", "set-buffer", + "set-buffer-auto-saved", "set-buffer-major-mode", + "set-buffer-modified-p", "set-buffer-multibyte", "set-case-table", + "set-category-table", "set-char-table-extra-slot", + "set-char-table-parent", "set-char-table-range", "set-charset-plist", + "set-charset-priority", "set-coding-system-priority", + "set-cursor-size", "set-default", "set-default-file-modes", + "set-default-toplevel-value", "set-file-acl", "set-file-modes", + "set-file-selinux-context", "set-file-times", "set-fontset-font", + "set-frame-height", "set-frame-position", "set-frame-selected-window", + "set-frame-size", "set-frame-width", "set-fringe-bitmap-face", + "set-input-interrupt-mode", "set-input-meta-mode", "set-input-mode", + "set-keyboard-coding-system-internal", "set-keymap-parent", + "set-marker", "set-marker-insertion-type", "set-match-data", + "set-message-beep", "set-minibuffer-window", + "set-mouse-pixel-position", "set-mouse-position", + "set-network-process-option", "set-output-flow-control", + "set-process-buffer", "set-process-coding-system", + "set-process-datagram-address", "set-process-filter", + "set-process-filter-multibyte", + "set-process-inherit-coding-system-flag", "set-process-plist", + "set-process-query-on-exit-flag", "set-process-sentinel", + "set-process-window-size", "set-quit-char", + "set-safe-terminal-coding-system-internal", "set-screen-color", + "set-standard-case-table", "set-syntax-table", + "set-terminal-coding-system-internal", "set-terminal-local-value", + "set-terminal-parameter", "set-text-properties", "set-time-zone-rule", + "set-visited-file-modtime", "set-window-buffer", + "set-window-combination-limit", "set-window-configuration", + "set-window-dedicated-p", "set-window-display-table", + "set-window-fringes", "set-window-hscroll", "set-window-margins", + "set-window-new-normal", "set-window-new-pixel", + "set-window-new-total", "set-window-next-buffers", + "set-window-parameter", "set-window-point", "set-window-prev-buffers", + "set-window-redisplay-end-trigger", "set-window-scroll-bars", + "set-window-start", "set-window-vscroll", "setcar", "setcdr", + "setplist", "show-face-resources", "signal", "signal-process", "sin", + "single-key-description", "skip-chars-backward", "skip-chars-forward", + "skip-syntax-backward", "skip-syntax-forward", "sleep-for", "sort", + "sort-charsets", "special-variable-p", "split-char", + "split-window-internal", "sqrt", "standard-case-table", + "standard-category-table", "standard-syntax-table", "start-kbd-macro", + "start-process", "stop-process", "store-kbd-macro-event", "string", + "string-as-multibyte", "string-as-unibyte", "string-bytes", + "string-collate-equalp", "string-collate-lessp", "string-equal", + "string-lessp", "string-make-multibyte", "string-make-unibyte", + "string-match", "string-to-char", "string-to-multibyte", + "string-to-number", "string-to-syntax", "string-to-unibyte", + "string-width", "stringp", "subr-name", "subrp", + "subst-char-in-region", "substitute-command-keys", + "substitute-in-file-name", "substring", "substring-no-properties", + "suspend-emacs", "suspend-tty", "suspicious-object", "sxhash", + "symbol-function", "symbol-name", "symbol-plist", "symbol-value", + "symbolp", "syntax-table", "syntax-table-p", "system-groups", + "system-move-file-to-trash", "system-name", "system-users", "tan", + "terminal-coding-system", "terminal-list", "terminal-live-p", + "terminal-local-value", "terminal-name", "terminal-parameter", + "terminal-parameters", "terpri", "test-completion", + "text-char-description", "text-properties-at", "text-property-any", + "text-property-not-all", "this-command-keys", + "this-command-keys-vector", "this-single-command-keys", + "this-single-command-raw-keys", "time-add", "time-less-p", + "time-subtract", "tool-bar-get-system-style", "tool-bar-height", + "tool-bar-pixel-width", "top-level", "trace-redisplay", + "trace-to-stderr", "translate-region-internal", "transpose-regions", + "truncate", "try-completion", "tty-display-color-cells", + "tty-display-color-p", "tty-no-underline", + "tty-suppress-bold-inverse-default-colors", "tty-top-frame", + "tty-type", "type-of", "undo-boundary", "unencodable-char-position", + "unhandled-file-name-directory", "unibyte-char-to-multibyte", + "unibyte-string", "unicode-property-table-internal", "unify-charset", + "unintern", "unix-sync", "unlock-buffer", "upcase", "upcase-initials", + "upcase-initials-region", "upcase-region", "upcase-word", + "use-global-map", "use-local-map", "user-full-name", + "user-login-name", "user-real-login-name", "user-real-uid", + "user-uid", "variable-binding-locus", "vconcat", "vector", + "vector-or-char-table-p", "vectorp", "verify-visited-file-modtime", + "vertical-motion", "visible-frame-list", "visited-file-modtime", + "w16-get-clipboard-data", "w16-selection-exists-p", + "w16-set-clipboard-data", "w32-battery-status", + "w32-default-color-map", "w32-define-rgb-color", + "w32-display-monitor-attributes-list", "w32-frame-menu-bar-size", + "w32-frame-rect", "w32-get-clipboard-data", + "w32-get-codepage-charset", "w32-get-console-codepage", + "w32-get-console-output-codepage", "w32-get-current-locale-id", + "w32-get-default-locale-id", "w32-get-keyboard-layout", + "w32-get-locale-info", "w32-get-valid-codepages", + "w32-get-valid-keyboard-layouts", "w32-get-valid-locale-ids", + "w32-has-winsock", "w32-long-file-name", "w32-reconstruct-hot-key", + "w32-register-hot-key", "w32-registered-hot-keys", + "w32-selection-exists-p", "w32-send-sys-command", + "w32-set-clipboard-data", "w32-set-console-codepage", + "w32-set-console-output-codepage", "w32-set-current-locale", + "w32-set-keyboard-layout", "w32-set-process-priority", + "w32-shell-execute", "w32-short-file-name", "w32-toggle-lock-key", + "w32-unload-winsock", "w32-unregister-hot-key", "w32-window-exists-p", + "w32notify-add-watch", "w32notify-rm-watch", + "waiting-for-user-input-p", "where-is-internal", "widen", + "widget-apply", "widget-get", "widget-put", + "window-absolute-pixel-edges", "window-at", "window-body-height", + "window-body-width", "window-bottom-divider-width", "window-buffer", + "window-combination-limit", "window-configuration-frame", + "window-configuration-p", "window-dedicated-p", + "window-display-table", "window-edges", "window-end", "window-frame", + "window-fringes", "window-header-line-height", "window-hscroll", + "window-inside-absolute-pixel-edges", "window-inside-edges", + "window-inside-pixel-edges", "window-left-child", + "window-left-column", "window-line-height", "window-list", + "window-list-1", "window-live-p", "window-margins", + "window-minibuffer-p", "window-mode-line-height", "window-new-normal", + "window-new-pixel", "window-new-total", "window-next-buffers", + "window-next-sibling", "window-normal-size", "window-old-point", + "window-parameter", "window-parameters", "window-parent", + "window-pixel-edges", "window-pixel-height", "window-pixel-left", + "window-pixel-top", "window-pixel-width", "window-point", + "window-prev-buffers", "window-prev-sibling", + "window-redisplay-end-trigger", "window-resize-apply", + "window-resize-apply-total", "window-right-divider-width", + "window-scroll-bar-height", "window-scroll-bar-width", + "window-scroll-bars", "window-start", "window-system", + "window-text-height", "window-text-pixel-size", "window-text-width", + "window-top-child", "window-top-line", "window-total-height", + "window-total-width", "window-use-time", "window-valid-p", + "window-vscroll", "windowp", "write-char", "write-region", + "x-backspace-delete-keys-p", "x-change-window-property", + "x-change-window-property", "x-close-connection", + "x-close-connection", "x-create-frame", "x-create-frame", + "x-delete-window-property", "x-delete-window-property", + "x-disown-selection-internal", "x-display-backing-store", + "x-display-backing-store", "x-display-color-cells", + "x-display-color-cells", "x-display-grayscale-p", + "x-display-grayscale-p", "x-display-list", "x-display-list", + "x-display-mm-height", "x-display-mm-height", "x-display-mm-width", + "x-display-mm-width", "x-display-monitor-attributes-list", + "x-display-pixel-height", "x-display-pixel-height", + "x-display-pixel-width", "x-display-pixel-width", "x-display-planes", + "x-display-planes", "x-display-save-under", "x-display-save-under", + "x-display-screens", "x-display-screens", "x-display-visual-class", + "x-display-visual-class", "x-family-fonts", "x-file-dialog", + "x-file-dialog", "x-file-dialog", "x-focus-frame", "x-frame-geometry", + "x-frame-geometry", "x-get-atom-name", "x-get-resource", + "x-get-selection-internal", "x-hide-tip", "x-hide-tip", + "x-list-fonts", "x-load-color-file", "x-menu-bar-open-internal", + "x-menu-bar-open-internal", "x-open-connection", "x-open-connection", + "x-own-selection-internal", "x-parse-geometry", "x-popup-dialog", + "x-popup-menu", "x-register-dnd-atom", "x-select-font", + "x-select-font", "x-selection-exists-p", "x-selection-owner-p", + "x-send-client-message", "x-server-max-request-size", + "x-server-max-request-size", "x-server-vendor", "x-server-vendor", + "x-server-version", "x-server-version", "x-show-tip", "x-show-tip", + "x-synchronize", "x-synchronize", "x-uses-old-gtk-dialog", + "x-window-property", "x-window-property", "x-wm-set-size-hint", + "xw-color-defined-p", "xw-color-defined-p", "xw-color-values", + "xw-color-values", "xw-display-color-p", "xw-display-color-p", + "yes-or-no-p", "zlib-available-p", "zlib-decompress-region", + "forward-point", + } + + emacsBuiltinFunctionHighlighted = []string{ + "defvaralias", "provide", "require", + "with-no-warnings", "define-widget", "with-electric-help", + "throw", "defalias", "featurep", + } + + emacsLambdaListKeywords = []string{ + "&allow-other-keys", "&aux", "&body", "&environment", "&key", "&optional", + "&rest", "&whole", + } + + emacsErrorKeywords = []string{ + "cl-assert", "cl-check-type", "error", "signal", + "user-error", "warn", + } +) + +// EmacsLisp lexer. +var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLexer( + &Config{ + Name: "EmacsLisp", + Aliases: []string{"emacs", "elisp", "emacs-lisp"}, + Filenames: []string{"*.el"}, + MimeTypes: []string{"text/x-elisp", "application/x-elisp"}, + }, + Rules{ + "root": { + Default(Push("body")), + }, + "body": { + {`\s+`, Text, nil}, + {`;.*$`, CommentSingle, nil}, + {`"`, LiteralString, Push("string")}, + {`\?([^\\]|\\.)`, LiteralStringChar, nil}, + {`:((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)`, NameBuiltin, nil}, + {`::((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)`, LiteralStringSymbol, nil}, + {`'((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)`, LiteralStringSymbol, nil}, + {`'`, Operator, nil}, + {"`", Operator, nil}, + {"[-+]?\\d+\\.?(?=[ \"()\\]\\'\\n,;`])", LiteralNumberInteger, nil}, + {"[-+]?\\d+/\\d+(?=[ \"()\\]\\'\\n,;`])", LiteralNumber, nil}, + {"[-+]?(\\d*\\.\\d+([defls][-+]?\\d+)?|\\d+(\\.\\d*)?[defls][-+]?\\d+)(?=[ \"()\\]\\'\\n,;`])", LiteralNumberFloat, nil}, + {`\[|\]`, Punctuation, nil}, + {`#:((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)`, LiteralStringSymbol, nil}, + {`#\^\^?`, Operator, nil}, + {`#\'`, NameFunction, nil}, + {`#[bB][+-]?[01]+(/[01]+)?`, LiteralNumberBin, nil}, + {`#[oO][+-]?[0-7]+(/[0-7]+)?`, LiteralNumberOct, nil}, + {`#[xX][+-]?[0-9a-fA-F]+(/[0-9a-fA-F]+)?`, LiteralNumberHex, nil}, + {`#\d+r[+-]?[0-9a-zA-Z]+(/[0-9a-zA-Z]+)?`, LiteralNumber, nil}, + {`#\d+=`, Operator, nil}, + {`#\d+#`, Operator, nil}, + {`(,@|,|\.|:)`, Operator, nil}, + {"(t|nil)(?=[ \"()\\]\\'\\n,;`])", NameConstant, nil}, + {`\*((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)\*`, NameVariableGlobal, nil}, + {`((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)`, NameVariable, nil}, + {`#\(`, Operator, Push("body")}, + {`\(`, Punctuation, Push("body")}, + {`\)`, Punctuation, Pop(1)}, + }, + "string": { + {"[^\"\\\\`]+", LiteralString, nil}, + {"`((?:\\\\.|[\\w!$%&*+-/<=>?@^{}~|])(?:\\\\.|[\\w!$%&*+-/<=>?@^{}~|]|[#.:])*)\\'", LiteralStringSymbol, nil}, + {"`", LiteralString, nil}, + {`\\.`, LiteralString, nil}, + {`\\\n`, LiteralString, nil}, + {`"`, LiteralString, Pop(1)}, + }, + }, +), TypeMapping{ + {NameVariable, NameFunction, emacsBuiltinFunction}, + {NameVariable, NameBuiltin, emacsSpecialForms}, + {NameVariable, NameException, emacsErrorKeywords}, + {NameVariable, NameBuiltin, append(emacsBuiltinFunctionHighlighted, emacsMacros...)}, + {NameVariable, KeywordPseudo, emacsLambdaListKeywords}, +})) diff --git a/vendor/github.com/alecthomas/chroma/lexers/e/erlang.go b/vendor/github.com/alecthomas/chroma/lexers/e/erlang.go new file mode 100644 index 000000000..63cd59a41 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/e/erlang.go @@ -0,0 +1,66 @@ +package e + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Erlang lexer. +var Erlang = internal.Register(MustNewLexer( + &Config{ + Name: "Erlang", + Aliases: []string{"erlang"}, + Filenames: []string{"*.erl", "*.hrl", "*.es", "*.escript"}, + MimeTypes: []string{"text/x-erlang"}, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`%.*\n`, Comment, nil}, + {Words(``, `\b`, `after`, `begin`, `case`, `catch`, `cond`, `end`, `fun`, `if`, `let`, `of`, `query`, `receive`, `try`, `when`), Keyword, nil}, + {Words(``, `\b`, `abs`, `append_element`, `apply`, `atom_to_list`, `binary_to_list`, `bitstring_to_list`, `binary_to_term`, `bit_size`, `bump_reductions`, `byte_size`, `cancel_timer`, `check_process_code`, `delete_module`, `demonitor`, `disconnect_node`, `display`, `element`, `erase`, `exit`, `float`, `float_to_list`, `fun_info`, `fun_to_list`, `function_exported`, `garbage_collect`, `get`, `get_keys`, `group_leader`, `hash`, `hd`, `integer_to_list`, `iolist_to_binary`, `iolist_size`, `is_atom`, `is_binary`, `is_bitstring`, `is_boolean`, `is_builtin`, `is_float`, `is_function`, `is_integer`, `is_list`, `is_number`, `is_pid`, `is_port`, `is_process_alive`, `is_record`, `is_reference`, `is_tuple`, `length`, `link`, `list_to_atom`, `list_to_binary`, `list_to_bitstring`, `list_to_existing_atom`, `list_to_float`, `list_to_integer`, `list_to_pid`, `list_to_tuple`, `load_module`, `localtime_to_universaltime`, `make_tuple`, `md5`, `md5_final`, `md5_update`, `memory`, `module_loaded`, `monitor`, `monitor_node`, `node`, `nodes`, `open_port`, `phash`, `phash2`, `pid_to_list`, `port_close`, `port_command`, `port_connect`, `port_control`, `port_call`, `port_info`, `port_to_list`, `process_display`, `process_flag`, `process_info`, `purge_module`, `put`, `read_timer`, `ref_to_list`, `register`, `resume_process`, `round`, `send`, `send_after`, `send_nosuspend`, `set_cookie`, `setelement`, `size`, `spawn`, `spawn_link`, `spawn_monitor`, `spawn_opt`, `split_binary`, `start_timer`, `statistics`, `suspend_process`, `system_flag`, `system_info`, `system_monitor`, `system_profile`, `term_to_binary`, `tl`, `trace`, `trace_delivered`, `trace_info`, `trace_pattern`, `trunc`, `tuple_size`, `tuple_to_list`, `universaltime_to_localtime`, `unlink`, `unregister`, `whereis`), NameBuiltin, nil}, + {Words(``, `\b`, `and`, `andalso`, `band`, `bnot`, `bor`, `bsl`, `bsr`, `bxor`, `div`, `not`, `or`, `orelse`, `rem`, `xor`), OperatorWord, nil}, + {`^-`, Punctuation, Push("directive")}, + {`(\+\+?|--?|\*|/|<|>|/=|=:=|=/=|=<|>=|==?|<-|!|\?)`, Operator, nil}, + {`"`, LiteralString, Push("string")}, + {`<<`, NameLabel, nil}, + {`>>`, NameLabel, nil}, + {`((?:[a-z]\w*|'[^\n']*[^\\]'))(:)`, ByGroups(NameNamespace, Punctuation), nil}, + {`(?:^|(?<=:))((?:[a-z]\w*|'[^\n']*[^\\]'))(\s*)(\()`, ByGroups(NameFunction, Text, Punctuation), nil}, + {`[+-]?(?:[2-9]|[12][0-9]|3[0-6])#[0-9a-zA-Z]+`, LiteralNumberInteger, nil}, + {`[+-]?\d+`, LiteralNumberInteger, nil}, + {`[+-]?\d+.\d+`, LiteralNumberFloat, nil}, + {`[]\[:_@\".{}()|;,]`, Punctuation, nil}, + {`(?:[A-Z_]\w*)`, NameVariable, nil}, + {`(?:[a-z]\w*|'[^\n']*[^\\]')`, Name, nil}, + {`\?(?:(?:[A-Z_]\w*)|(?:[a-z]\w*|'[^\n']*[^\\]'))`, NameConstant, nil}, + {`\$(?:(?:\\(?:[bdefnrstv\'"\\]|[0-7][0-7]?[0-7]?|(?:x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\})|\^[a-zA-Z]))|\\[ %]|[^\\])`, LiteralStringChar, nil}, + {`#(?:[a-z]\w*|'[^\n']*[^\\]')(:?\.(?:[a-z]\w*|'[^\n']*[^\\]'))?`, NameLabel, nil}, + {`\A#!.+\n`, CommentHashbang, nil}, + {`#\{`, Punctuation, Push("map_key")}, + }, + "string": { + {`(?:\\(?:[bdefnrstv\'"\\]|[0-7][0-7]?[0-7]?|(?:x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\})|\^[a-zA-Z]))`, LiteralStringEscape, nil}, + {`"`, LiteralString, Pop(1)}, + {`~[0-9.*]*[~#+BPWXb-ginpswx]`, LiteralStringInterpol, nil}, + {`[^"\\~]+`, LiteralString, nil}, + {`~`, LiteralString, nil}, + }, + "directive": { + {`(define)(\s*)(\()((?:(?:[A-Z_]\w*)|(?:[a-z]\w*|'[^\n']*[^\\]')))`, ByGroups(NameEntity, Text, Punctuation, NameConstant), Pop(1)}, + {`(record)(\s*)(\()((?:(?:[A-Z_]\w*)|(?:[a-z]\w*|'[^\n']*[^\\]')))`, ByGroups(NameEntity, Text, Punctuation, NameLabel), Pop(1)}, + {`(?:[a-z]\w*|'[^\n']*[^\\]')`, NameEntity, Pop(1)}, + }, + "map_key": { + Include("root"), + {`=>`, Punctuation, Push("map_val")}, + {`:=`, Punctuation, Push("map_val")}, + {`\}`, Punctuation, Pop(1)}, + }, + "map_val": { + Include("root"), + {`,`, Punctuation, Pop(1)}, + {`(?=\})`, Punctuation, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/f/factor.go b/vendor/github.com/alecthomas/chroma/lexers/f/factor.go new file mode 100644 index 000000000..26c0d5624 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/f/factor.go @@ -0,0 +1,115 @@ +package f + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Factor lexer. +var Factor = internal.Register(MustNewLexer( + &Config{ + Name: "Factor", + Aliases: []string{"factor"}, + Filenames: []string{"*.factor"}, + MimeTypes: []string{"text/x-factor"}, + }, + Rules{ + "root": { + {`#!.*$`, CommentPreproc, nil}, + Default(Push("base")), + }, + "base": { + {`\s+`, Text, nil}, + {`((?:MACRO|MEMO|TYPED)?:[:]?)(\s+)(\S+)`, ByGroups(Keyword, Text, NameFunction), nil}, + {`(M:[:]?)(\s+)(\S+)(\s+)(\S+)`, ByGroups(Keyword, Text, NameClass, Text, NameFunction), nil}, + {`(C:)(\s+)(\S+)(\s+)(\S+)`, ByGroups(Keyword, Text, NameFunction, Text, NameClass), nil}, + {`(GENERIC:)(\s+)(\S+)`, ByGroups(Keyword, Text, NameFunction), nil}, + {`(HOOK:|GENERIC#)(\s+)(\S+)(\s+)(\S+)`, ByGroups(Keyword, Text, NameFunction, Text, NameFunction), nil}, + {`\(\s`, NameFunction, Push("stackeffect")}, + {`;\s`, Keyword, nil}, + {`(USING:)(\s+)`, ByGroups(KeywordNamespace, Text), Push("vocabs")}, + {`(USE:|UNUSE:|IN:|QUALIFIED:)(\s+)(\S+)`, ByGroups(KeywordNamespace, Text, NameNamespace), nil}, + {`(QUALIFIED-WITH:)(\s+)(\S+)(\s+)(\S+)`, ByGroups(KeywordNamespace, Text, NameNamespace, Text, NameNamespace), nil}, + {`(FROM:|EXCLUDE:)(\s+)(\S+)(\s+=>\s)`, ByGroups(KeywordNamespace, Text, NameNamespace, Text), Push("words")}, + {`(RENAME:)(\s+)(\S+)(\s+)(\S+)(\s+=>\s+)(\S+)`, ByGroups(KeywordNamespace, Text, NameFunction, Text, NameNamespace, Text, NameFunction), nil}, + {`(ALIAS:|TYPEDEF:)(\s+)(\S+)(\s+)(\S+)`, ByGroups(KeywordNamespace, Text, NameFunction, Text, NameFunction), nil}, + {`(DEFER:|FORGET:|POSTPONE:)(\s+)(\S+)`, ByGroups(KeywordNamespace, Text, NameFunction), nil}, + {`(TUPLE:|ERROR:)(\s+)(\S+)(\s+<\s+)(\S+)`, ByGroups(Keyword, Text, NameClass, Text, NameClass), Push("slots")}, + {`(TUPLE:|ERROR:|BUILTIN:)(\s+)(\S+)`, ByGroups(Keyword, Text, NameClass), Push("slots")}, + {`(MIXIN:|UNION:|INTERSECTION:)(\s+)(\S+)`, ByGroups(Keyword, Text, NameClass), nil}, + {`(PREDICATE:)(\s+)(\S+)(\s+<\s+)(\S+)`, ByGroups(Keyword, Text, NameClass, Text, NameClass), nil}, + {`(C:)(\s+)(\S+)(\s+)(\S+)`, ByGroups(Keyword, Text, NameFunction, Text, NameClass), nil}, + {`(INSTANCE:)(\s+)(\S+)(\s+)(\S+)`, ByGroups(Keyword, Text, NameClass, Text, NameClass), nil}, + {`(SLOT:)(\s+)(\S+)`, ByGroups(Keyword, Text, NameFunction), nil}, + {`(SINGLETON:)(\s+)(\S+)`, ByGroups(Keyword, Text, NameClass), nil}, + {`SINGLETONS:`, Keyword, Push("classes")}, + {`(CONSTANT:|SYMBOL:|MAIN:|HELP:)(\s+)(\S+)`, ByGroups(Keyword, Text, NameFunction), nil}, + {`SYMBOLS:\s`, Keyword, Push("words")}, + {`SYNTAX:\s`, Keyword, nil}, + {`ALIEN:\s`, Keyword, nil}, + {`(STRUCT:)(\s+)(\S+)`, ByGroups(Keyword, Text, NameClass), nil}, + {`(FUNCTION:)(\s+\S+\s+)(\S+)(\s+\(\s+[^)]+\)\s)`, ByGroups(KeywordNamespace, Text, NameFunction, Text), nil}, + {`(FUNCTION-ALIAS:)(\s+)(\S+)(\s+\S+\s+)(\S+)(\s+\(\s+[^)]+\)\s)`, ByGroups(KeywordNamespace, Text, NameFunction, Text, NameFunction, Text), nil}, + {`(?:)\s`, KeywordNamespace, nil}, + {`"""\s+(?:.|\n)*?\s+"""`, LiteralString, nil}, + {`"(?:\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`\S+"\s+(?:\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`CHAR:\s+(?:\\[\\abfnrstv]|[^\\]\S*)\s`, LiteralStringChar, nil}, + {`!\s+.*$`, Comment, nil}, + {`#!\s+.*$`, Comment, nil}, + {`/\*\s+(?:.|\n)*?\s\*/\s`, Comment, nil}, + {`[tf]\s`, NameConstant, nil}, + {`[\\$]\s+\S+`, NameConstant, nil}, + {`M\\\s+\S+\s+\S+`, NameConstant, nil}, + {`[+-]?(?:[\d,]*\d)?\.(?:\d([\d,]*\d)?)?(?:[eE][+-]?\d+)?\s`, LiteralNumber, nil}, + {`[+-]?\d(?:[\d,]*\d)?(?:[eE][+-]?\d+)?\s`, LiteralNumber, nil}, + {`0x[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s`, LiteralNumber, nil}, + {`NAN:\s+[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s`, LiteralNumber, nil}, + {`0b[01]+\s`, LiteralNumberBin, nil}, + {`0o[0-7]+\s`, LiteralNumberOct, nil}, + {`(?:\d([\d,]*\d)?)?\+\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s`, LiteralNumber, nil}, + {`(?:\-\d([\d,]*\d)?)?\-\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s`, LiteralNumber, nil}, + {`(?:deprecated|final|foldable|flushable|inline|recursive)\s`, Keyword, nil}, + {Words(``, `\s`, `-rot`, `2bi`, `2bi@`, `2bi*`, `2curry`, `2dip`, `2drop`, `2dup`, `2keep`, `2nip`, `2over`, `2tri`, `2tri@`, `2tri*`, `3bi`, `3curry`, `3dip`, `3drop`, `3dup`, `3keep`, `3tri`, `4dip`, `4drop`, `4dup`, `4keep`, ``, `=`, `>boolean`, `clone`, `?`, `?execute`, `?if`, `and`, `assert`, `assert=`, `assert?`, `bi`, `bi-curry`, `bi-curry@`, `bi-curry*`, `bi@`, `bi*`, `boa`, `boolean`, `boolean?`, `both?`, `build`, `call`, `callstack`, `callstack>array`, `callstack?`, `clear`, `(clone)`, `compose`, `compose?`, `curry`, `curry?`, `datastack`, `die`, `dip`, `do`, `drop`, `dup`, `dupd`, `either?`, `eq?`, `equal?`, `execute`, `hashcode`, `hashcode*`, `identity-hashcode`, `identity-tuple`, `identity-tuple?`, `if`, `if*`, `keep`, `loop`, `most`, `new`, `nip`, `not`, `null`, `object`, `or`, `over`, `pick`, `prepose`, `retainstack`, `rot`, `same?`, `swap`, `swapd`, `throw`, `tri`, `tri-curry`, `tri-curry@`, `tri-curry*`, `tri@`, `tri*`, `tuple`, `tuple?`, `unless`, `unless*`, `until`, `when`, `when*`, `while`, `with`, `wrapper`, `wrapper?`, `xor`), NameBuiltin, nil}, + {Words(``, `\s`, `2cache`, ``, `>alist`, `?at`, `?of`, `assoc`, `assoc-all?`, `assoc-any?`, `assoc-clone-like`, `assoc-combine`, `assoc-diff`, `assoc-diff!`, `assoc-differ`, `assoc-each`, `assoc-empty?`, `assoc-filter`, `assoc-filter!`, `assoc-filter-as`, `assoc-find`, `assoc-hashcode`, `assoc-intersect`, `assoc-like`, `assoc-map`, `assoc-map-as`, `assoc-partition`, `assoc-refine`, `assoc-size`, `assoc-stack`, `assoc-subset?`, `assoc-union`, `assoc-union!`, `assoc=`, `assoc>map`, `assoc?`, `at`, `at+`, `at*`, `cache`, `change-at`, `clear-assoc`, `delete-at`, `delete-at*`, `enum`, `enum?`, `extract-keys`, `inc-at`, `key?`, `keys`, `map>assoc`, `maybe-set-at`, `new-assoc`, `of`, `push-at`, `rename-at`, `set-at`, `sift-keys`, `sift-values`, `substitute`, `unzip`, `value-at`, `value-at*`, `value?`, `values`, `zip`), NameBuiltin, nil}, + {Words(``, `\s`, `2cleave`, `2cleave>quot`, `3cleave`, `3cleave>quot`, `4cleave`, `4cleave>quot`, `alist>quot`, `call-effect`, `case`, `case-find`, `case>quot`, `cleave`, `cleave>quot`, `cond`, `cond>quot`, `deep-spread>quot`, `execute-effect`, `linear-case-quot`, `no-case`, `no-case?`, `no-cond`, `no-cond?`, `recursive-hashcode`, `shallow-spread>quot`, `spread`, `to-fixed-point`, `wrong-values`, `wrong-values?`), NameBuiltin, nil}, + {Words(``, `\s`, `-`, `/`, `/f`, `/i`, `/mod`, `2/`, `2^`, `<`, `<=`, ``, `>`, `>=`, `>bignum`, `>fixnum`, `>float`, `>integer`, `(all-integers?)`, `(each-integer)`, `(find-integer)`, `*`, `+`, `?1+`, `abs`, `align`, `all-integers?`, `bignum`, `bignum?`, `bit?`, `bitand`, `bitnot`, `bitor`, `bits>double`, `bits>float`, `bitxor`, `complex`, `complex?`, `denominator`, `double>bits`, `each-integer`, `even?`, `find-integer`, `find-last-integer`, `fixnum`, `fixnum?`, `float`, `float>bits`, `float?`, `fp-bitwise=`, `fp-infinity?`, `fp-nan-payload`, `fp-nan?`, `fp-qnan?`, `fp-sign`, `fp-snan?`, `fp-special?`, `if-zero`, `imaginary-part`, `integer`, `integer>fixnum`, `integer>fixnum-strict`, `integer?`, `log2`, `log2-expects-positive`, `log2-expects-positive?`, `mod`, `neg`, `neg?`, `next-float`, `next-power-of-2`, `number`, `number=`, `number?`, `numerator`, `odd?`, `out-of-fixnum-range`, `out-of-fixnum-range?`, `power-of-2?`, `prev-float`, `ratio`, `ratio?`, `rational`, `rational?`, `real`, `real-part`, `real?`, `recip`, `rem`, `sgn`, `shift`, `sq`, `times`, `u<`, `u<=`, `u>`, `u>=`, `unless-zero`, `unordered?`, `when-zero`, `zero?`), NameBuiltin, nil}, + {Words(``, `\s`, `1sequence`, `2all?`, `2each`, `2map`, `2map-as`, `2map-reduce`, `2reduce`, `2selector`, `2sequence`, `3append`, `3append-as`, `3each`, `3map`, `3map-as`, `3sequence`, `4sequence`, ``, ``, ``, `?first`, `?last`, `?nth`, `?second`, `?set-nth`, `accumulate`, `accumulate!`, `accumulate-as`, `all?`, `any?`, `append`, `append!`, `append-as`, `assert-sequence`, `assert-sequence=`, `assert-sequence?`, `binary-reduce`, `bounds-check`, `bounds-check?`, `bounds-error`, `bounds-error?`, `but-last`, `but-last-slice`, `cartesian-each`, `cartesian-map`, `cartesian-product`, `change-nth`, `check-slice`, `check-slice-error`, `clone-like`, `collapse-slice`, `collector`, `collector-for`, `concat`, `concat-as`, `copy`, `count`, `cut`, `cut-slice`, `cut*`, `delete-all`, `delete-slice`, `drop-prefix`, `each`, `each-from`, `each-index`, `empty?`, `exchange`, `filter`, `filter!`, `filter-as`, `find`, `find-from`, `find-index`, `find-index-from`, `find-last`, `find-last-from`, `first`, `first2`, `first3`, `first4`, `flip`, `follow`, `fourth`, `glue`, `halves`, `harvest`, `head`, `head-slice`, `head-slice*`, `head*`, `head?`, `if-empty`, `immutable`, `immutable-sequence`, `immutable-sequence?`, `immutable?`, `index`, `index-from`, `indices`, `infimum`, `infimum-by`, `insert-nth`, `interleave`, `iota`, `iota-tuple`, `iota-tuple?`, `join`, `join-as`, `last`, `last-index`, `last-index-from`, `length`, `lengthen`, `like`, `longer`, `longer?`, `longest`, `map`, `map!`, `map-as`, `map-find`, `map-find-last`, `map-index`, `map-integers`, `map-reduce`, `map-sum`, `max-length`, `member-eq?`, `member?`, `midpoint@`, `min-length`, `mismatch`, `move`, `new-like`, `new-resizable`, `new-sequence`, `non-negative-integer-expected`, `non-negative-integer-expected?`, `nth`, `nths`, `pad-head`, `pad-tail`, `padding`, `partition`, `pop`, `pop*`, `prefix`, `prepend`, `prepend-as`, `produce`, `produce-as`, `product`, `push`, `push-all`, `push-either`, `push-if`, `reduce`, `reduce-index`, `remove`, `remove!`, `remove-eq`, `remove-eq!`, `remove-nth`, `remove-nth!`, `repetition`, `repetition?`, `replace-slice`, `replicate`, `replicate-as`, `rest`, `rest-slice`, `reverse`, `reverse!`, `reversed`, `reversed?`, `second`, `selector`, `selector-for`, `sequence`, `sequence-hashcode`, `sequence=`, `sequence?`, `set-first`, `set-fourth`, `set-last`, `set-length`, `set-nth`, `set-second`, `set-third`, `short`, `shorten`, `shorter`, `shorter?`, `shortest`, `sift`, `slice`, `slice-error`, `slice-error?`, `slice?`, `snip`, `snip-slice`, `start`, `start*`, `subseq`, `subseq?`, `suffix`, `suffix!`, `sum`, `sum-lengths`, `supremum`, `supremum-by`, `surround`, `tail`, `tail-slice`, `tail-slice*`, `tail*`, `tail?`, `third`, `trim`, `trim-head`, `trim-head-slice`, `trim-slice`, `trim-tail`, `trim-tail-slice`, `unclip`, `unclip-last`, `unclip-last-slice`, `unclip-slice`, `unless-empty`, `virtual-exemplar`, `virtual-sequence`, `virtual-sequence?`, `virtual@`, `when-empty`), NameBuiltin, nil}, + {Words(``, `\s`, `+@`, `change`, `change-global`, `counter`, `dec`, `get`, `get-global`, `global`, `inc`, `init-namespaces`, `initialize`, `is-global`, `make-assoc`, `namespace`, `namestack`, `off`, `on`, `set`, `set-global`, `set-namestack`, `toggle`, `with-global`, `with-scope`, `with-variable`, `with-variables`), NameBuiltin, nil}, + {Words(``, `\s`, `1array`, `2array`, `3array`, `4array`, ``, `>array`, `array`, `array?`, `pair`, `pair?`, `resize-array`), NameBuiltin, nil}, + {Words(``, `\s`, `(each-stream-block-slice)`, `(each-stream-block)`, `(stream-contents-by-block)`, `(stream-contents-by-element)`, `(stream-contents-by-length-or-block)`, `(stream-contents-by-length)`, `+byte+`, `+character+`, `bad-seek-type`, `bad-seek-type?`, `bl`, `contents`, `each-block`, `each-block-size`, `each-block-slice`, `each-line`, `each-morsel`, `each-stream-block`, `each-stream-block-slice`, `each-stream-line`, `error-stream`, `flush`, `input-stream`, `input-stream?`, `invalid-read-buffer`, `invalid-read-buffer?`, `lines`, `nl`, `output-stream`, `output-stream?`, `print`, `read`, `read-into`, `read-partial`, `read-partial-into`, `read-until`, `read1`, `readln`, `seek-absolute`, `seek-absolute?`, `seek-end`, `seek-end?`, `seek-input`, `seek-output`, `seek-relative`, `seek-relative?`, `stream-bl`, `stream-contents`, `stream-contents*`, `stream-copy`, `stream-copy*`, `stream-element-type`, `stream-flush`, `stream-length`, `stream-lines`, `stream-nl`, `stream-print`, `stream-read`, `stream-read-into`, `stream-read-partial`, `stream-read-partial-into`, `stream-read-partial-unsafe`, `stream-read-unsafe`, `stream-read-until`, `stream-read1`, `stream-readln`, `stream-seek`, `stream-seekable?`, `stream-tell`, `stream-write`, `stream-write1`, `tell-input`, `tell-output`, `with-error-stream`, `with-error-stream*`, `with-error>output`, `with-input-output+error-streams`, `with-input-output+error-streams*`, `with-input-stream`, `with-input-stream*`, `with-output-stream`, `with-output-stream*`, `with-output>error`, `with-output+error-stream`, `with-output+error-stream*`, `with-streams`, `with-streams*`, `write`, `write1`), NameBuiltin, nil}, + {Words(``, `\s`, `1string`, ``, `>string`, `resize-string`, `string`, `string?`), NameBuiltin, nil}, + {Words(``, `\s`, `1vector`, ``, `>vector`, `?push`, `vector`, `vector?`), NameBuiltin, nil}, + {Words(``, `\s`, ``, ``, ``, `attempt-all`, `attempt-all-error`, `attempt-all-error?`, `callback-error-hook`, `callcc0`, `callcc1`, `cleanup`, `compute-restarts`, `condition`, `condition?`, `continuation`, `continuation?`, `continue`, `continue-restart`, `continue-with`, `current-continuation`, `error`, `error-continuation`, `error-in-thread`, `error-thread`, `ifcc`, `ignore-errors`, `in-callback?`, `original-error`, `recover`, `restart`, `restart?`, `restarts`, `rethrow`, `rethrow-restarts`, `return`, `return-continuation`, `thread-error-hook`, `throw-continue`, `throw-restarts`, `with-datastack`, `with-return`), NameBuiltin, nil}, + {`\S+`, Text, nil}, + }, + "stackeffect": { + {`\s+`, Text, nil}, + {`\(\s+`, NameFunction, Push("stackeffect")}, + {`\)\s`, NameFunction, Pop(1)}, + {`--\s`, NameFunction, nil}, + {`\S+`, NameVariable, nil}, + }, + "slots": { + {`\s+`, Text, nil}, + {`;\s`, Keyword, Pop(1)}, + {`(\{\s+)(\S+)(\s+[^}]+\s+\}\s)`, ByGroups(Text, NameVariable, Text), nil}, + {`\S+`, NameVariable, nil}, + }, + "vocabs": { + {`\s+`, Text, nil}, + {`;\s`, Keyword, Pop(1)}, + {`\S+`, NameNamespace, nil}, + }, + "classes": { + {`\s+`, Text, nil}, + {`;\s`, Keyword, Pop(1)}, + {`\S+`, NameClass, nil}, + }, + "words": { + {`\s+`, Text, nil}, + {`;\s`, Keyword, Pop(1)}, + {`\S+`, NameFunction, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/f/fish.go b/vendor/github.com/alecthomas/chroma/lexers/f/fish.go new file mode 100644 index 000000000..185fc92b5 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/f/fish.go @@ -0,0 +1,65 @@ +package f + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Fish lexer. +var Fish = internal.Register(MustNewLexer( + &Config{ + Name: "Fish", + Aliases: []string{"fish", "fishshell"}, + Filenames: []string{"*.fish", "*.load"}, + MimeTypes: []string{"application/x-fish"}, + }, + Rules{ + "root": { + Include("basic"), + Include("data"), + Include("interp"), + }, + "interp": { + {`\$\(\(`, Keyword, Push("math")}, + {`\(`, Keyword, Push("paren")}, + {`\$#?(\w+|.)`, NameVariable, nil}, + }, + "basic": { + {`\b(begin|end|if|else|while|break|for|in|return|function|block|case|continue|switch|not|and|or|set|echo|exit|pwd|true|false|cd|count|test)(\s*)\b`, ByGroups(Keyword, Text), nil}, + {`\b(alias|bg|bind|breakpoint|builtin|command|commandline|complete|contains|dirh|dirs|emit|eval|exec|fg|fish|fish_config|fish_indent|fish_pager|fish_prompt|fish_right_prompt|fish_update_completions|fishd|funced|funcsave|functions|help|history|isatty|jobs|math|mimedb|nextd|open|popd|prevd|psub|pushd|random|read|set_color|source|status|trap|type|ulimit|umask|vared|fc|getopts|hash|kill|printf|time|wait)\s*\b(?!\.)`, NameBuiltin, nil}, + {`#.*\n`, Comment, nil}, + {`\\[\w\W]`, LiteralStringEscape, nil}, + {`(\b\w+)(\s*)(=)`, ByGroups(NameVariable, Text, Operator), nil}, + {`[\[\]()=]`, Operator, nil}, + {`<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2`, LiteralString, nil}, + }, + "data": { + {`(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Push("string")}, + {`(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'`, LiteralStringSingle, nil}, + {`(?s)'.*?'`, LiteralStringSingle, nil}, + {`;`, Punctuation, nil}, + {`&|\||\^|<|>`, Operator, nil}, + {`\s+`, Text, nil}, + {`\d+(?= |\Z)`, LiteralNumber, nil}, + {"[^=\\s\\[\\]{}()$\"\\'`\\\\<&|;]+", Text, nil}, + }, + "string": { + {`"`, LiteralStringDouble, Pop(1)}, + {`(?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+`, LiteralStringDouble, nil}, + Include("interp"), + }, + "paren": { + {`\)`, Keyword, Pop(1)}, + Include("root"), + }, + "math": { + {`\)\)`, Keyword, Pop(1)}, + {`[-+*/%^|&]|\*\*|\|\|`, Operator, nil}, + {`\d+#\d+`, LiteralNumber, nil}, + {`\d+#(?! )`, LiteralNumber, nil}, + {`\d+`, LiteralNumber, nil}, + Include("root"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/f/forth.go b/vendor/github.com/alecthomas/chroma/lexers/f/forth.go new file mode 100644 index 000000000..47de6365f --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/f/forth.go @@ -0,0 +1,40 @@ +package f + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Forth lexer. +var Forth = internal.Register(MustNewLexer( + &Config{ + Name: "Forth", + Aliases: []string{"forth"}, + Filenames: []string{"*.frt", "*.fth", "*.fs"}, + MimeTypes: []string{"application/x-forth"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`\\.*?\n`, CommentSingle, nil}, + {`\([\s].*?\)`, CommentSingle, nil}, + {`(:|variable|constant|value|buffer:)(\s+)`, ByGroups(KeywordNamespace, Text), Push("worddef")}, + {`([.sc]")(\s+?)`, ByGroups(LiteralString, Text), Push("stringdef")}, + {`(blk|block|buffer|evaluate|flush|load|save-buffers|update|empty-buffers|list|refill|scr|thru|\#s|\*\/mod|\+loop|\/mod|0<|0=|1\+|1-|2!|2\*|2\/|2@|2drop|2dup|2over|2swap|>body|>in|>number|>r|\?dup|abort|abort\"|abs|accept|align|aligned|allot|and|base|begin|bl|c!|c,|c@|cell\+|cells|char|char\+|chars|constant|count|cr|create|decimal|depth|do|does>|drop|dup|else|emit|environment\?|evaluate|execute|exit|fill|find|fm\/mod|here|hold|i|if|immediate|invert|j|key|leave|literal|loop|lshift|m\*|max|min|mod|move|negate|or|over|postpone|quit|r>|r@|recurse|repeat|rot|rshift|s\"|s>d|sign|sm\/rem|source|space|spaces|state|swap|then|type|u\.|u\<|um\*|um\/mod|unloop|until|variable|while|word|xor|\[char\]|\[\'\]|@|!|\#|<\#|\#>|:|;|\+|-|\*|\/|,|<|>|\|1\+|1-|\.|\.r|0<>|0>|2>r|2r>|2r@|:noname|\?do|again|c\"|case|compile,|endcase|endof|erase|false|hex|marker|nip|of|pad|parse|pick|refill|restore-input|roll|save-input|source-id|to|true|tuck|u\.r|u>|unused|value|within|\[compile\]|\#tib|convert|expect|query|span|tib|2constant|2literal|2variable|d\+|d-|d\.|d\.r|d0<|d0=|d2\*|d2\/|d<|d=|d>s|dabs|dmax|dmin|dnegate|m\*\/|m\+|2rot|du<|catch|throw|abort|abort\"|at-xy|key\?|page|ekey|ekey>char|ekey\?|emit\?|ms|time&date|BIN|CLOSE-FILE|CREATE-FILE|DELETE-FILE|FILE-POSITION|FILE-SIZE|INCLUDE-FILE|INCLUDED|OPEN-FILE|R\/O|R\/W|READ-FILE|READ-LINE|REPOSITION-FILE|RESIZE-FILE|S\"|SOURCE-ID|W/O|WRITE-FILE|WRITE-LINE|FILE-STATUS|FLUSH-FILE|REFILL|RENAME-FILE|>float|d>f|f!|f\*|f\+|f-|f\/|f0<|f0=|f<|f>d|f@|falign|faligned|fconstant|fdepth|fdrop|fdup|fliteral|float\+|floats|floor|fmax|fmin|fnegate|fover|frot|fround|fswap|fvariable|represent|df!|df@|dfalign|dfaligned|dfloat\+|dfloats|f\*\*|f\.|fabs|facos|facosh|falog|fasin|fasinh|fatan|fatan2|fatanh|fcos|fcosh|fe\.|fexp|fexpm1|fln|flnp1|flog|fs\.|fsin|fsincos|fsinh|fsqrt|ftan|ftanh|f~|precision|set-precision|sf!|sf@|sfalign|sfaligned|sfloat\+|sfloats|\(local\)|to|locals\||allocate|free|resize|definitions|find|forth-wordlist|get-current|get-order|search-wordlist|set-current|set-order|wordlist|also|forth|only|order|previous|-trailing|\/string|blank|cmove|cmove>|compare|search|sliteral|.s|dump|see|words|;code|ahead|assembler|bye|code|cs-pick|cs-roll|editor|state|\[else\]|\[if\]|\[then\]|forget|defer|defer@|defer!|action-of|begin-structure|field:|buffer:|parse-name|buffer:|traverse-wordlist|n>r|nr>|2value|fvalue|name>interpret|name>compile|name>string|cfield:|end-structure)\s`, Keyword, nil}, + {`(\$[0-9A-F]+)`, LiteralNumberHex, nil}, + {`(\#|%|&|\-|\+)?[0-9]+`, LiteralNumberInteger, nil}, + {`(\#|%|&|\-|\+)?[0-9.]+`, KeywordType, nil}, + {`(@i|!i|@e|!e|pause|noop|turnkey|sleep|itype|icompare|sp@|sp!|rp@|rp!|up@|up!|>a|a>|a@|a!|a@+|a@-|>b|b>|b@|b!|b@+|b@-|find-name|1ms|sp0|rp0|\(evaluate\)|int-trap|int!)\s`, NameConstant, nil}, + {`(do-recognizer|r:fail|recognizer:|get-recognizers|set-recognizers|r:float|r>comp|r>int|r>post|r:name|r:word|r:dnum|r:num|recognizer|forth-recognizer|rec:num|rec:float|rec:word)\s`, NameDecorator, nil}, + {`(Evalue|Rvalue|Uvalue|Edefer|Rdefer|Udefer)(\s+)`, ByGroups(KeywordNamespace, Text), Push("worddef")}, + {`[^\s]+(?=[\s])`, NameFunction, nil}, + }, + "worddef": { + {`\S+`, NameClass, Pop(1)}, + }, + "stringdef": { + {`[^"]+`, LiteralString, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/f/fortran.go b/vendor/github.com/alecthomas/chroma/lexers/f/fortran.go new file mode 100644 index 000000000..6c57afa6e --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/f/fortran.go @@ -0,0 +1,47 @@ +package f + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Fortran lexer. +var Fortran = internal.Register(MustNewLexer( + &Config{ + Name: "Fortran", + Aliases: []string{"fortran"}, + Filenames: []string{"*.f03", "*.f90", "*.F03", "*.F90"}, + MimeTypes: []string{"text/x-fortran"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`^#.*\n`, CommentPreproc, nil}, + {`!.*\n`, Comment, nil}, + Include("strings"), + Include("core"), + {`[a-z][\w$]*`, Name, nil}, + Include("nums"), + {`[\s]+`, Text, nil}, + }, + "core": { + {Words(`\b`, `\s*\b`, `ABSTRACT`, `ACCEPT`, `ALL`, `ALLSTOP`, `ALLOCATABLE`, `ALLOCATE`, `ARRAY`, `ASSIGN`, `ASSOCIATE`, `ASYNCHRONOUS`, `BACKSPACE`, `BIND`, `BLOCK`, `BLOCKDATA`, `BYTE`, `CALL`, `CASE`, `CLASS`, `CLOSE`, `CODIMENSION`, `COMMON`, `CONCURRRENT`, `CONTIGUOUS`, `CONTAINS`, `CONTINUE`, `CRITICAL`, `CYCLE`, `DATA`, `DEALLOCATE`, `DECODE`, `DEFERRED`, `DIMENSION`, `DO`, `ELEMENTAL`, `ELSE`, `ENCODE`, `END`, `ENTRY`, `ENUM`, `ENUMERATOR`, `EQUIVALENCE`, `EXIT`, `EXTENDS`, `EXTERNAL`, `EXTRINSIC`, `FILE`, `FINAL`, `FORALL`, `FORMAT`, `FUNCTION`, `GENERIC`, `GOTO`, `IF`, `IMAGES`, `IMPLICIT`, `IMPORT`, `IMPURE`, `INCLUDE`, `INQUIRE`, `INTENT`, `INTERFACE`, `INTRINSIC`, `IS`, `LOCK`, `MEMORY`, `MODULE`, `NAMELIST`, `NULLIFY`, `NONE`, `NON_INTRINSIC`, `NON_OVERRIDABLE`, `NOPASS`, `OPEN`, `OPTIONAL`, `OPTIONS`, `PARAMETER`, `PASS`, `PAUSE`, `POINTER`, `PRINT`, `PRIVATE`, `PROGRAM`, `PROCEDURE`, `PROTECTED`, `PUBLIC`, `PURE`, `READ`, `RECURSIVE`, `RESULT`, `RETURN`, `REWIND`, `SAVE`, `SELECT`, `SEQUENCE`, `STOP`, `SUBMODULE`, `SUBROUTINE`, `SYNC`, `SYNCALL`, `SYNCIMAGES`, `SYNCMEMORY`, `TARGET`, `THEN`, `TYPE`, `UNLOCK`, `USE`, `VALUE`, `VOLATILE`, `WHERE`, `WRITE`, `WHILE`), Keyword, nil}, + {Words(`\b`, `\s*\b`, `CHARACTER`, `COMPLEX`, `DOUBLE PRECISION`, `DOUBLE COMPLEX`, `INTEGER`, `LOGICAL`, `REAL`, `C_INT`, `C_SHORT`, `C_LONG`, `C_LONG_LONG`, `C_SIGNED_CHAR`, `C_SIZE_T`, `C_INT8_T`, `C_INT16_T`, `C_INT32_T`, `C_INT64_T`, `C_INT_LEAST8_T`, `C_INT_LEAST16_T`, `C_INT_LEAST32_T`, `C_INT_LEAST64_T`, `C_INT_FAST8_T`, `C_INT_FAST16_T`, `C_INT_FAST32_T`, `C_INT_FAST64_T`, `C_INTMAX_T`, `C_INTPTR_T`, `C_FLOAT`, `C_DOUBLE`, `C_LONG_DOUBLE`, `C_FLOAT_COMPLEX`, `C_DOUBLE_COMPLEX`, `C_LONG_DOUBLE_COMPLEX`, `C_BOOL`, `C_CHAR`, `C_PTR`, `C_FUNPTR`), KeywordType, nil}, + {`(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)`, Operator, nil}, + {`(::)`, KeywordDeclaration, nil}, + {`[()\[\],:&%;.]`, Punctuation, nil}, + {Words(`\b`, `\s*\b`, `Abort`, `Abs`, `Access`, `AChar`, `ACos`, `ACosH`, `AdjustL`, `AdjustR`, `AImag`, `AInt`, `Alarm`, `All`, `Allocated`, `ALog`, `AMax`, `AMin`, `AMod`, `And`, `ANInt`, `Any`, `ASin`, `ASinH`, `Associated`, `ATan`, `ATanH`, `Atomic_Define`, `Atomic_Ref`, `BesJ`, `BesJN`, `Bessel_J0`, `Bessel_J1`, `Bessel_JN`, `Bessel_Y0`, `Bessel_Y1`, `Bessel_YN`, `BesY`, `BesYN`, `BGE`, `BGT`, `BLE`, `BLT`, `Bit_Size`, `BTest`, `CAbs`, `CCos`, `Ceiling`, `CExp`, `Char`, `ChDir`, `ChMod`, `CLog`, `Cmplx`, `Command_Argument_Count`, `Complex`, `Conjg`, `Cos`, `CosH`, `Count`, `CPU_Time`, `CShift`, `CSin`, `CSqRt`, `CTime`, `C_Loc`, `C_Associated`, `C_Null_Ptr`, `C_Null_Funptr`, `C_F_Pointer`, `C_F_ProcPointer`, `C_Null_Char`, `C_Alert`, `C_Backspace`, `C_Form_Feed`, `C_FunLoc`, `C_Sizeof`, `C_New_Line`, `C_Carriage_Return`, `C_Horizontal_Tab`, `C_Vertical_Tab`, `DAbs`, `DACos`, `DASin`, `DATan`, `Date_and_Time`, `DbesJ`, `DbesJN`, `DbesY`, `DbesYN`, `Dble`, `DCos`, `DCosH`, `DDiM`, `DErF`, `DErFC`, `DExp`, `Digits`, `DiM`, `DInt`, `DLog`, `DMax`, `DMin`, `DMod`, `DNInt`, `Dot_Product`, `DProd`, `DSign`, `DSinH`, `DShiftL`, `DShiftR`, `DSin`, `DSqRt`, `DTanH`, `DTan`, `DTime`, `EOShift`, `Epsilon`, `ErF`, `ErFC`, `ErFC_Scaled`, `ETime`, `Execute_Command_Line`, `Exit`, `Exp`, `Exponent`, `Extends_Type_Of`, `FDate`, `FGet`, `FGetC`, `FindLoc`, `Float`, `Floor`, `Flush`, `FNum`, `FPutC`, `FPut`, `Fraction`, `FSeek`, `FStat`, `FTell`, `Gamma`, `GError`, `GetArg`, `Get_Command`, `Get_Command_Argument`, `Get_Environment_Variable`, `GetCWD`, `GetEnv`, `GetGId`, `GetLog`, `GetPId`, `GetUId`, `GMTime`, `HostNm`, `Huge`, `Hypot`, `IAbs`, `IAChar`, `IAll`, `IAnd`, `IAny`, `IArgC`, `IBClr`, `IBits`, `IBSet`, `IChar`, `IDate`, `IDiM`, `IDInt`, `IDNInt`, `IEOr`, `IErrNo`, `IFix`, `Imag`, `ImagPart`, `Image_Index`, `Index`, `Int`, `IOr`, `IParity`, `IRand`, `IsaTty`, `IShft`, `IShftC`, `ISign`, `Iso_C_Binding`, `Is_Contiguous`, `Is_Iostat_End`, `Is_Iostat_Eor`, `ITime`, `Kill`, `Kind`, `LBound`, `LCoBound`, `Len`, `Len_Trim`, `LGe`, `LGt`, `Link`, `LLe`, `LLt`, `LnBlnk`, `Loc`, `Log`, `Log_Gamma`, `Logical`, `Long`, `LShift`, `LStat`, `LTime`, `MaskL`, `MaskR`, `MatMul`, `Max`, `MaxExponent`, `MaxLoc`, `MaxVal`, `MClock`, `Merge`, `Merge_Bits`, `Move_Alloc`, `Min`, `MinExponent`, `MinLoc`, `MinVal`, `Mod`, `Modulo`, `MvBits`, `Nearest`, `New_Line`, `NInt`, `Norm2`, `Not`, `Null`, `Num_Images`, `Or`, `Pack`, `Parity`, `PError`, `Precision`, `Present`, `Product`, `Radix`, `Rand`, `Random_Number`, `Random_Seed`, `Range`, `Real`, `RealPart`, `Rename`, `Repeat`, `Reshape`, `RRSpacing`, `RShift`, `Same_Type_As`, `Scale`, `Scan`, `Second`, `Selected_Char_Kind`, `Selected_Int_Kind`, `Selected_Real_Kind`, `Set_Exponent`, `Shape`, `ShiftA`, `ShiftL`, `ShiftR`, `Short`, `Sign`, `Signal`, `SinH`, `Sin`, `Sleep`, `Sngl`, `Spacing`, `Spread`, `SqRt`, `SRand`, `Stat`, `Storage_Size`, `Sum`, `SymLnk`, `System`, `System_Clock`, `Tan`, `TanH`, `Time`, `This_Image`, `Tiny`, `TrailZ`, `Transfer`, `Transpose`, `Trim`, `TtyNam`, `UBound`, `UCoBound`, `UMask`, `Unlink`, `Unpack`, `Verify`, `XOr`, `ZAbs`, `ZCos`, `ZExp`, `ZLog`, `ZSin`, `ZSqRt`), NameBuiltin, nil}, + {`\.(true|false)\.`, NameBuiltin, nil}, + {`\.(eq|ne|lt|le|gt|ge|not|and|or|eqv|neqv)\.`, OperatorWord, nil}, + }, + "strings": { + {`(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"`, LiteralStringDouble, nil}, + {`(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'`, LiteralStringSingle, nil}, + }, + "nums": { + {`\d+(?![.e])(_[a-z]\w+)?`, LiteralNumberInteger, nil}, + {`[+-]?\d*\.\d+([ed][-+]?\d+)?(_[a-z]\w+)?`, LiteralNumberFloat, nil}, + {`[+-]?\d+\.\d*([ed][-+]?\d+)?(_[a-z]\w+)?`, LiteralNumberFloat, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/f/fsharp.go b/vendor/github.com/alecthomas/chroma/lexers/f/fsharp.go new file mode 100644 index 000000000..d00f63dd7 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/f/fsharp.go @@ -0,0 +1,94 @@ +package f + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Fsharp lexer. +var Fsharp = internal.Register(MustNewLexer( + &Config{ + Name: "FSharp", + Aliases: []string{"fsharp"}, + Filenames: []string{"*.fs", "*.fsi"}, + MimeTypes: []string{"text/x-fsharp"}, + }, + Rules{ + "escape-sequence": { + {`\\[\\"\'ntbrafv]`, LiteralStringEscape, nil}, + {`\\[0-9]{3}`, LiteralStringEscape, nil}, + {`\\u[0-9a-fA-F]{4}`, LiteralStringEscape, nil}, + {`\\U[0-9a-fA-F]{8}`, LiteralStringEscape, nil}, + }, + "root": { + {`\s+`, Text, nil}, + {`\(\)|\[\]`, NameBuiltinPseudo, nil}, + {`\b(?|-|\\.\\.|\\.|::|:=|:>|:|;;|;|<-|<\\]|<|>\\]|>|\\?\\?|\\?|\\[<|\\[\\||\\[|\\]|_|`|\\{|\\|\\]|\\||\\}|~|<@@|<@|=|@>|@@>)", Operator, nil}, + {`([=<>@^|&+\*/$%-]|[!?~])?[!$%&*+\./:<=>?@^|~-]`, Operator, nil}, + {`\b(and|or|not)\b`, OperatorWord, nil}, + {`\b(sbyte|byte|char|nativeint|unativeint|float32|single|float|double|int8|uint8|int16|uint16|int32|uint32|int64|uint64|decimal|unit|bool|string|list|exn|obj|enum)\b`, KeywordType, nil}, + {`#[ \t]*(if|endif|else|line|nowarn|light|\d+)\b.*?\n`, CommentPreproc, nil}, + {`[^\W\d][\w']*`, Name, nil}, + {`\d[\d_]*[uU]?[yslLnQRZINGmM]?`, LiteralNumberInteger, nil}, + {`0[xX][\da-fA-F][\da-fA-F_]*[uU]?[yslLn]?[fF]?`, LiteralNumberHex, nil}, + {`0[oO][0-7][0-7_]*[uU]?[yslLn]?`, LiteralNumberOct, nil}, + {`0[bB][01][01_]*[uU]?[yslLn]?`, LiteralNumberBin, nil}, + {`-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)[fFmM]?`, LiteralNumberFloat, nil}, + {`'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'B?`, LiteralStringChar, nil}, + {`'.'`, LiteralStringChar, nil}, + {`'`, Keyword, nil}, + {`@?"`, LiteralStringDouble, Push("string")}, + {`[~?][a-z][\w\']*:`, NameVariable, nil}, + }, + "dotted": { + {`\s+`, Text, nil}, + {`\.`, Punctuation, nil}, + {`[A-Z][\w\']*(?=\s*\.)`, NameNamespace, nil}, + {`[A-Z][\w\']*`, Name, Pop(1)}, + {`[a-z_][\w\']*`, Name, Pop(1)}, + Default(Pop(1)), + }, + "comment": { + {`[^(*)@"]+`, Comment, nil}, + {`\(\*`, Comment, Push()}, + {`\*\)`, Comment, Pop(1)}, + {`@"`, LiteralString, Push("lstring")}, + {`"""`, LiteralString, Push("tqs")}, + {`"`, LiteralString, Push("string")}, + {`[(*)@]`, Comment, nil}, + }, + "string": { + {`[^\\"]+`, LiteralString, nil}, + Include("escape-sequence"), + {`\\\n`, LiteralString, nil}, + {`\n`, LiteralString, nil}, + {`"B?`, LiteralString, Pop(1)}, + }, + "lstring": { + {`[^"]+`, LiteralString, nil}, + {`\n`, LiteralString, nil}, + {`""`, LiteralString, nil}, + {`"B?`, LiteralString, Pop(1)}, + }, + "tqs": { + {`[^"]+`, LiteralString, nil}, + {`\n`, LiteralString, nil}, + {`"""B?`, LiteralString, Pop(1)}, + {`"`, LiteralString, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/g/gas.go b/vendor/github.com/alecthomas/chroma/lexers/g/gas.go new file mode 100644 index 000000000..a92280685 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/g/gas.go @@ -0,0 +1,55 @@ +package g + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Gas lexer. +var Gas = internal.Register(MustNewLexer( + &Config{ + Name: "GAS", + Aliases: []string{"gas", "asm"}, + Filenames: []string{"*.s", "*.S"}, + MimeTypes: []string{"text/x-gas"}, + }, + Rules{ + "root": { + Include("whitespace"), + {`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+):`, NameLabel, nil}, + {`\.(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameAttribute, Push("directive-args")}, + {`lock|rep(n?z)?|data\d+`, NameAttribute, nil}, + {`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameFunction, Push("instruction-args")}, + {`[\r\n]+`, Text, nil}, + }, + "directive-args": { + {`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameConstant, nil}, + {`"(\\"|[^"])*"`, LiteralString, nil}, + {`@(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameAttribute, nil}, + {`(?:0[xX][a-zA-Z0-9]+|\d+)`, LiteralNumberInteger, nil}, + {`[\r\n]+`, Text, Pop(1)}, + Include("punctuation"), + Include("whitespace"), + }, + "instruction-args": { + {`([a-z0-9]+)( )(<)((?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+))(>)`, ByGroups(LiteralNumberHex, Text, Punctuation, NameConstant, Punctuation), nil}, + {`([a-z0-9]+)( )(<)((?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+))([-+])((?:0[xX][a-zA-Z0-9]+|\d+))(>)`, ByGroups(LiteralNumberHex, Text, Punctuation, NameConstant, Punctuation, LiteralNumberInteger, Punctuation), nil}, + {`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameConstant, nil}, + {`(?:0[xX][a-zA-Z0-9]+|\d+)`, LiteralNumberInteger, nil}, + {`%(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameVariable, nil}, + {`$(?:0[xX][a-zA-Z0-9]+|\d+)`, LiteralNumberInteger, nil}, + {`$'(.|\\')'`, LiteralStringChar, nil}, + {`[\r\n]+`, Text, Pop(1)}, + Include("punctuation"), + Include("whitespace"), + }, + "whitespace": { + {`\n`, Text, nil}, + {`\s+`, Text, nil}, + {`[;#].*?\n`, Comment, nil}, + }, + "punctuation": { + {`[-*,.()\[\]!:]+`, Punctuation, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/g/gdscript.go b/vendor/github.com/alecthomas/chroma/lexers/g/gdscript.go new file mode 100644 index 000000000..bfe30637c --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/g/gdscript.go @@ -0,0 +1,124 @@ +package g + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// GDScript lexer. +var GDScript = internal.Register(MustNewLexer( + &Config{ + Name: "GDScript", + Aliases: []string{"gdscript", "gd"}, + Filenames: []string{"*.gd"}, + MimeTypes: []string{"text/x-gdscript", "application/x-gdscript"}, + }, + Rules{ + "root": { + {`\n`, Text, nil}, + {`^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringAffix, LiteralStringDoc), nil}, + {`^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')`, ByGroups(Text, LiteralStringAffix, LiteralStringDoc), nil}, + {`[^\S\n]+`, Text, nil}, + {`#.*$`, CommentSingle, nil}, + {`[]{}:(),;[]`, Punctuation, nil}, + {`\\\n`, Text, nil}, + {`\\`, Text, nil}, + {`(in|and|or|not)\b`, OperatorWord, nil}, + {`!=|==|<<|>>|&&|\+=|-=|\*=|/=|%=|&=|\|=|\|\||[-~+/*%=<>&^.!|$]`, Operator, nil}, + Include("keywords"), + {`(def)((?:\s|\\\s)+)`, ByGroups(Keyword, Text), Push("funcname")}, + {`(class)((?:\s|\\\s)+)`, ByGroups(Keyword, Text), Push("classname")}, + Include("builtins"), + {`([rR]|[uUbB][rR]|[rR][uUbB])(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("tdqs")}, + {`([rR]|[uUbB][rR]|[rR][uUbB])(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("tsqs")}, + {`([rR]|[uUbB][rR]|[rR][uUbB])(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("dqs")}, + {`([rR]|[uUbB][rR]|[rR][uUbB])(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("sqs")}, + {`([uUbB]?)(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("stringescape", "tdqs")}, + {`([uUbB]?)(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("stringescape", "tsqs")}, + {`([uUbB]?)(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("stringescape", "dqs")}, + {`([uUbB]?)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("stringescape", "sqs")}, + Include("name"), + Include("numbers"), + }, + "keywords": { + {Words(``, `\b`, + `if`, `elif`, `else`, `for`, `do`, + `while`, `switch`, `case`, `break`, `continue`, + `pass`, `return`, `class`, `extends`, `tool`, + `signal`, `func`, `static`, `const`, `enum`, + `var`, `onready`, `export`, `setget`, `breakpoint`), Keyword, nil}, + }, + "builtins": { + {Words(`(?)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil}, + {`<\s*(script|style)\s*.*?>.*?<\s*/\1\s*>`, Other, nil}, + {`<\s*py:[a-zA-Z0-9]+`, NameTag, Push("pytag")}, + {`<\s*[a-zA-Z0-9:.]+`, NameTag, Push("tag")}, + Include("variable"), + {`[<$]`, Other, nil}, + }, + "pytag": { + {`\s+`, Text, nil}, + {`[\w:-]+\s*=`, NameAttribute, Push("pyattr")}, + {`/?\s*>`, NameTag, Pop(1)}, + }, + "pyattr": { + {`(")(.*?)(")`, ByGroups(LiteralString, Using(Python), LiteralString), Pop(1)}, + {`(')(.*?)(')`, ByGroups(LiteralString, Using(Python), LiteralString), Pop(1)}, + {`[^\s>]+`, LiteralString, Pop(1)}, + }, + "tag": { + {`\s+`, Text, nil}, + {`py:[\w-]+\s*=`, NameAttribute, Push("pyattr")}, + {`[\w:-]+\s*=`, NameAttribute, Push("attr")}, + {`/?\s*>`, NameTag, Pop(1)}, + }, + "attr": { + {`"`, LiteralString, Push("attr-dstring")}, + {`'`, LiteralString, Push("attr-sstring")}, + {`[^\s>]*`, LiteralString, Pop(1)}, + }, + "attr-dstring": { + {`"`, LiteralString, Pop(1)}, + Include("strings"), + {`'`, LiteralString, nil}, + }, + "attr-sstring": { + {`'`, LiteralString, Pop(1)}, + Include("strings"), + {`'`, LiteralString, nil}, + }, + "strings": { + {`[^"'$]+`, LiteralString, nil}, + Include("variable"), + }, + "variable": { + {`(?>|<=?|>=?|==?|&&?|\^|\|\|?`, Operator, nil}, + {`[?:]`, Operator, nil}, + {`\bdefined\b`, Operator, nil}, + {`[;{}(),\[\]]`, Punctuation, nil}, + {`[+-]?\d*\.\d+([eE][-+]?\d+)?`, LiteralNumberFloat, nil}, + {`[+-]?\d+\.\d*([eE][-+]?\d+)?`, LiteralNumberFloat, nil}, + {`0[xX][0-9a-fA-F]*`, LiteralNumberHex, nil}, + {`0[0-7]*`, LiteralNumberOct, nil}, + {`[1-9][0-9]*`, LiteralNumberInteger, nil}, + {Words(`\b`, `\b`, `attribute`, `const`, `uniform`, `varying`, `centroid`, `break`, `continue`, `do`, `for`, `while`, `if`, `else`, `in`, `out`, `inout`, `float`, `int`, `void`, `bool`, `true`, `false`, `invariant`, `discard`, `return`, `mat2`, `mat3mat4`, `mat2x2`, `mat3x2`, `mat4x2`, `mat2x3`, `mat3x3`, `mat4x3`, `mat2x4`, `mat3x4`, `mat4x4`, `vec2`, `vec3`, `vec4`, `ivec2`, `ivec3`, `ivec4`, `bvec2`, `bvec3`, `bvec4`, `sampler1D`, `sampler2D`, `sampler3DsamplerCube`, `sampler1DShadow`, `sampler2DShadow`, `struct`), Keyword, nil}, + {Words(`\b`, `\b`, `asm`, `class`, `union`, `enum`, `typedef`, `template`, `this`, `packed`, `goto`, `switch`, `default`, `inline`, `noinline`, `volatile`, `public`, `static`, `extern`, `external`, `interface`, `long`, `short`, `double`, `half`, `fixed`, `unsigned`, `lowp`, `mediump`, `highp`, `precision`, `input`, `output`, `hvec2`, `hvec3`, `hvec4`, `dvec2`, `dvec3`, `dvec4`, `fvec2`, `fvec3`, `fvec4`, `sampler2DRect`, `sampler3DRect`, `sampler2DRectShadow`, `sizeof`, `cast`, `namespace`, `using`), Keyword, nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + {`\.`, Punctuation, nil}, + {`\s+`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/g/gnuplot.go b/vendor/github.com/alecthomas/chroma/lexers/g/gnuplot.go new file mode 100644 index 000000000..77c6363c5 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/g/gnuplot.go @@ -0,0 +1,117 @@ +package g + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Gnuplot lexer. +var Gnuplot = internal.Register(MustNewLexer( + &Config{ + Name: "Gnuplot", + Aliases: []string{"gnuplot"}, + Filenames: []string{"*.plot", "*.plt"}, + MimeTypes: []string{"text/x-gnuplot"}, + }, + Rules{ + "root": { + Include("whitespace"), + {`bind\b|bin\b|bi\b`, Keyword, Push("bind")}, + {`exit\b|exi\b|ex\b|quit\b|qui\b|qu\b|q\b`, Keyword, Push("quit")}, + {`fit\b|fi\b|f\b`, Keyword, Push("fit")}, + {`(if)(\s*)(\()`, ByGroups(Keyword, Text, Punctuation), Push("if")}, + {`else\b`, Keyword, nil}, + {`pause\b|paus\b|pau\b|pa\b`, Keyword, Push("pause")}, + {`plot\b|plo\b|pl\b|p\b|replot\b|replo\b|repl\b|rep\b|splot\b|splo\b|spl\b|sp\b`, Keyword, Push("plot")}, + {`save\b|sav\b|sa\b`, Keyword, Push("save")}, + {`set\b|se\b`, Keyword, Push("genericargs", "optionarg")}, + {`show\b|sho\b|sh\b|unset\b|unse\b|uns\b`, Keyword, Push("noargs", "optionarg")}, + {`lower\b|lowe\b|low\b|raise\b|rais\b|rai\b|ra\b|call\b|cal\b|ca\b|cd\b|clear\b|clea\b|cle\b|cl\b|help\b|hel\b|he\b|h\b|\?\b|history\b|histor\b|histo\b|hist\b|his\b|hi\b|load\b|loa\b|lo\b|l\b|print\b|prin\b|pri\b|pr\b|pwd\b|reread\b|rerea\b|rere\b|rer\b|re\b|reset\b|rese\b|res\b|screendump\b|screendum\b|screendu\b|screend\b|screen\b|scree\b|scre\b|scr\b|shell\b|shel\b|she\b|system\b|syste\b|syst\b|sys\b|sy\b|update\b|updat\b|upda\b|upd\b|up\b`, Keyword, Push("genericargs")}, + {`pwd\b|reread\b|rerea\b|rere\b|rer\b|re\b|reset\b|rese\b|res\b|screendump\b|screendum\b|screendu\b|screend\b|screen\b|scree\b|scre\b|scr\b|shell\b|shel\b|she\b|test\b`, Keyword, Push("noargs")}, + {`([a-zA-Z_]\w*)(\s*)(=)`, ByGroups(NameVariable, Text, Operator), Push("genericargs")}, + {`([a-zA-Z_]\w*)(\s*\(.*?\)\s*)(=)`, ByGroups(NameFunction, Text, Operator), Push("genericargs")}, + {`@[a-zA-Z_]\w*`, NameConstant, nil}, + {`;`, Keyword, nil}, + }, + "comment": { + {`[^\\\n]`, Comment, nil}, + {`\\\n`, Comment, nil}, + {`\\`, Comment, nil}, + Default(Pop(1)), + }, + "whitespace": { + {`#`, Comment, Push("comment")}, + {`[ \t\v\f]+`, Text, nil}, + }, + "noargs": { + Include("whitespace"), + {`;`, Punctuation, Pop(1)}, + {`\n`, Text, Pop(1)}, + }, + "dqstring": { + {`"`, LiteralString, Pop(1)}, + {`\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})`, LiteralStringEscape, nil}, + {`[^\\"\n]+`, LiteralString, nil}, + {`\\\n`, LiteralString, nil}, + {`\\`, LiteralString, nil}, + {`\n`, LiteralString, Pop(1)}, + }, + "sqstring": { + {`''`, LiteralString, nil}, + {`'`, LiteralString, Pop(1)}, + {`[^\\'\n]+`, LiteralString, nil}, + {`\\\n`, LiteralString, nil}, + {`\\`, LiteralString, nil}, + {`\n`, LiteralString, Pop(1)}, + }, + "genericargs": { + Include("noargs"), + {`"`, LiteralString, Push("dqstring")}, + {`'`, LiteralString, Push("sqstring")}, + {`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+`, LiteralNumberFloat, nil}, + {`(\d+\.\d*|\.\d+)`, LiteralNumberFloat, nil}, + {`-?\d+`, LiteralNumberInteger, nil}, + {`[,.~!%^&*+=|?:<>/-]`, Operator, nil}, + {`[{}()\[\]]`, Punctuation, nil}, + {`(eq|ne)\b`, OperatorWord, nil}, + {`([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(NameFunction, Text, Punctuation), nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + {`@[a-zA-Z_]\w*`, NameConstant, nil}, + {`\\\n`, Text, nil}, + }, + "optionarg": { + Include("whitespace"), + {`all\b|al\b|a\b|angles\b|angle\b|angl\b|ang\b|an\b|arrow\b|arro\b|arr\b|ar\b|autoscale\b|autoscal\b|autosca\b|autosc\b|autos\b|auto\b|aut\b|au\b|bars\b|bar\b|ba\b|b\b|border\b|borde\b|bord\b|bor\b|boxwidth\b|boxwidt\b|boxwid\b|boxwi\b|boxw\b|box\b|clabel\b|clabe\b|clab\b|cla\b|cl\b|clip\b|cli\b|cl\b|c\b|cntrparam\b|cntrpara\b|cntrpar\b|cntrpa\b|cntrp\b|cntr\b|cnt\b|cn\b|contour\b|contou\b|conto\b|cont\b|con\b|co\b|data\b|dat\b|da\b|datafile\b|datafil\b|datafi\b|dataf\b|data\b|dgrid3d\b|dgrid3\b|dgrid\b|dgri\b|dgr\b|dg\b|dummy\b|dumm\b|dum\b|du\b|encoding\b|encodin\b|encodi\b|encod\b|enco\b|enc\b|decimalsign\b|decimalsig\b|decimalsi\b|decimals\b|decimal\b|decima\b|decim\b|deci\b|dec\b|fit\b|fontpath\b|fontpat\b|fontpa\b|fontp\b|font\b|format\b|forma\b|form\b|for\b|fo\b|function\b|functio\b|functi\b|funct\b|func\b|fun\b|fu\b|functions\b|function\b|functio\b|functi\b|funct\b|func\b|fun\b|fu\b|grid\b|gri\b|gr\b|g\b|hidden3d\b|hidden3\b|hidden\b|hidde\b|hidd\b|hid\b|historysize\b|historysiz\b|historysi\b|historys\b|history\b|histor\b|histo\b|hist\b|his\b|isosamples\b|isosample\b|isosampl\b|isosamp\b|isosam\b|isosa\b|isos\b|iso\b|is\b|key\b|ke\b|k\b|keytitle\b|keytitl\b|keytit\b|keyti\b|keyt\b|label\b|labe\b|lab\b|la\b|linestyle\b|linestyl\b|linesty\b|linest\b|lines\b|line\b|lin\b|li\b|ls\b|loadpath\b|loadpat\b|loadpa\b|loadp\b|load\b|loa\b|locale\b|local\b|loca\b|loc\b|logscale\b|logscal\b|logsca\b|logsc\b|logs\b|log\b|macros\b|macro\b|macr\b|mac\b|mapping\b|mappin\b|mappi\b|mapp\b|map\b|mapping3d\b|mapping3\b|mapping\b|mappin\b|mappi\b|mapp\b|map\b|margin\b|margi\b|marg\b|mar\b|lmargin\b|lmargi\b|lmarg\b|lmar\b|rmargin\b|rmargi\b|rmarg\b|rmar\b|tmargin\b|tmargi\b|tmarg\b|tmar\b|bmargin\b|bmargi\b|bmarg\b|bmar\b|mouse\b|mous\b|mou\b|mo\b|multiplot\b|multiplo\b|multipl\b|multip\b|multi\b|mxtics\b|mxtic\b|mxti\b|mxt\b|nomxtics\b|nomxtic\b|nomxti\b|nomxt\b|mx2tics\b|mx2tic\b|mx2ti\b|mx2t\b|nomx2tics\b|nomx2tic\b|nomx2ti\b|nomx2t\b|mytics\b|mytic\b|myti\b|myt\b|nomytics\b|nomytic\b|nomyti\b|nomyt\b|my2tics\b|my2tic\b|my2ti\b|my2t\b|nomy2tics\b|nomy2tic\b|nomy2ti\b|nomy2t\b|mztics\b|mztic\b|mzti\b|mzt\b|nomztics\b|nomztic\b|nomzti\b|nomzt\b|mcbtics\b|mcbtic\b|mcbti\b|mcbt\b|nomcbtics\b|nomcbtic\b|nomcbti\b|nomcbt\b|offsets\b|offset\b|offse\b|offs\b|off\b|of\b|origin\b|origi\b|orig\b|ori\b|or\b|output\b|outpu\b|outp\b|out\b|ou\b|o\b|parametric\b|parametri\b|parametr\b|paramet\b|parame\b|param\b|para\b|par\b|pa\b|pm3d\b|pm3\b|pm\b|palette\b|palett\b|palet\b|pale\b|pal\b|colorbox\b|colorbo\b|colorb\b|plot\b|plo\b|pl\b|p\b|pointsize\b|pointsiz\b|pointsi\b|points\b|point\b|poin\b|poi\b|polar\b|pola\b|pol\b|print\b|prin\b|pri\b|pr\b|object\b|objec\b|obje\b|obj\b|samples\b|sample\b|sampl\b|samp\b|sam\b|sa\b|size\b|siz\b|si\b|style\b|styl\b|sty\b|st\b|surface\b|surfac\b|surfa\b|surf\b|sur\b|su\b|table\b|terminal\b|termina\b|termin\b|termi\b|term\b|ter\b|te\b|t\b|termoptions\b|termoption\b|termoptio\b|termopti\b|termopt\b|termop\b|termo\b|tics\b|tic\b|ti\b|ticscale\b|ticscal\b|ticsca\b|ticsc\b|ticslevel\b|ticsleve\b|ticslev\b|ticsle\b|ticsl\b|timefmt\b|timefm\b|timef\b|timestamp\b|timestam\b|timesta\b|timest\b|times\b|time\b|tim\b|title\b|titl\b|tit\b|variables\b|variable\b|variabl\b|variab\b|varia\b|vari\b|var\b|va\b|v\b|version\b|versio\b|versi\b|vers\b|ver\b|ve\b|view\b|vie\b|vi\b|xyplane\b|xyplan\b|xypla\b|xypl\b|xyp\b|xdata\b|xdat\b|xda\b|x2data\b|x2dat\b|x2da\b|ydata\b|ydat\b|yda\b|y2data\b|y2dat\b|y2da\b|zdata\b|zdat\b|zda\b|cbdata\b|cbdat\b|cbda\b|xlabel\b|xlabe\b|xlab\b|xla\b|xl\b|x2label\b|x2labe\b|x2lab\b|x2la\b|x2l\b|ylabel\b|ylabe\b|ylab\b|yla\b|yl\b|y2label\b|y2labe\b|y2lab\b|y2la\b|y2l\b|zlabel\b|zlabe\b|zlab\b|zla\b|zl\b|cblabel\b|cblabe\b|cblab\b|cbla\b|cbl\b|xtics\b|xtic\b|xti\b|noxtics\b|noxtic\b|noxti\b|x2tics\b|x2tic\b|x2ti\b|nox2tics\b|nox2tic\b|nox2ti\b|ytics\b|ytic\b|yti\b|noytics\b|noytic\b|noyti\b|y2tics\b|y2tic\b|y2ti\b|noy2tics\b|noy2tic\b|noy2ti\b|ztics\b|ztic\b|zti\b|noztics\b|noztic\b|nozti\b|cbtics\b|cbtic\b|cbti\b|nocbtics\b|nocbtic\b|nocbti\b|xdtics\b|xdtic\b|xdti\b|noxdtics\b|noxdtic\b|noxdti\b|x2dtics\b|x2dtic\b|x2dti\b|nox2dtics\b|nox2dtic\b|nox2dti\b|ydtics\b|ydtic\b|ydti\b|noydtics\b|noydtic\b|noydti\b|y2dtics\b|y2dtic\b|y2dti\b|noy2dtics\b|noy2dtic\b|noy2dti\b|zdtics\b|zdtic\b|zdti\b|nozdtics\b|nozdtic\b|nozdti\b|cbdtics\b|cbdtic\b|cbdti\b|nocbdtics\b|nocbdtic\b|nocbdti\b|xmtics\b|xmtic\b|xmti\b|noxmtics\b|noxmtic\b|noxmti\b|x2mtics\b|x2mtic\b|x2mti\b|nox2mtics\b|nox2mtic\b|nox2mti\b|ymtics\b|ymtic\b|ymti\b|noymtics\b|noymtic\b|noymti\b|y2mtics\b|y2mtic\b|y2mti\b|noy2mtics\b|noy2mtic\b|noy2mti\b|zmtics\b|zmtic\b|zmti\b|nozmtics\b|nozmtic\b|nozmti\b|cbmtics\b|cbmtic\b|cbmti\b|nocbmtics\b|nocbmtic\b|nocbmti\b|xrange\b|xrang\b|xran\b|xra\b|xr\b|x2range\b|x2rang\b|x2ran\b|x2ra\b|x2r\b|yrange\b|yrang\b|yran\b|yra\b|yr\b|y2range\b|y2rang\b|y2ran\b|y2ra\b|y2r\b|zrange\b|zrang\b|zran\b|zra\b|zr\b|cbrange\b|cbrang\b|cbran\b|cbra\b|cbr\b|rrange\b|rrang\b|rran\b|rra\b|rr\b|trange\b|trang\b|tran\b|tra\b|tr\b|urange\b|urang\b|uran\b|ura\b|ur\b|vrange\b|vrang\b|vran\b|vra\b|vr\b|xzeroaxis\b|xzeroaxi\b|xzeroax\b|xzeroa\b|x2zeroaxis\b|x2zeroaxi\b|x2zeroax\b|x2zeroa\b|yzeroaxis\b|yzeroaxi\b|yzeroax\b|yzeroa\b|y2zeroaxis\b|y2zeroaxi\b|y2zeroax\b|y2zeroa\b|zzeroaxis\b|zzeroaxi\b|zzeroax\b|zzeroa\b|zeroaxis\b|zeroaxi\b|zeroax\b|zeroa\b|zero\b|zer\b|ze\b|z\b`, NameBuiltin, Pop(1)}, + }, + "bind": { + {`!`, Keyword, Pop(1)}, + {`allwindows\b|allwindow\b|allwindo\b|allwind\b|allwin\b|allwi\b|allw\b|all\b`, NameBuiltin, nil}, + Include("genericargs"), + }, + "quit": { + {`gnuplot\b`, Keyword, nil}, + Include("noargs"), + }, + "fit": { + {`via\b`, NameBuiltin, nil}, + Include("plot"), + }, + "if": { + {`\)`, Punctuation, Pop(1)}, + Include("genericargs"), + }, + "pause": { + {`(mouse|any|button1|button2|button3)\b`, NameBuiltin, nil}, + {`keypress\b|keypres\b|keypre\b|keypr\b|keyp\b|key\b`, NameBuiltin, nil}, + Include("genericargs"), + }, + "plot": { + {`axes\b|axe\b|ax\b|axis\b|axi\b|binary\b|binar\b|bina\b|bin\b|every\b|ever\b|eve\b|ev\b|index\b|inde\b|ind\b|in\b|i\b|matrix\b|matri\b|matr\b|mat\b|smooth\b|smoot\b|smoo\b|smo\b|sm\b|s\b|thru\b|title\b|titl\b|tit\b|ti\b|t\b|notitle\b|notitl\b|notit\b|noti\b|not\b|using\b|usin\b|usi\b|us\b|u\b|with\b|wit\b|wi\b|w\b`, NameBuiltin, nil}, + Include("genericargs"), + }, + "save": { + {`functions\b|function\b|functio\b|functi\b|funct\b|func\b|fun\b|fu\b|f\b|set\b|se\b|s\b|terminal\b|termina\b|termin\b|termi\b|term\b|ter\b|te\b|t\b|variables\b|variable\b|variabl\b|variab\b|varia\b|vari\b|var\b|va\b|v\b`, NameBuiltin, nil}, + Include("genericargs"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/g/go.go b/vendor/github.com/alecthomas/chroma/lexers/g/go.go new file mode 100644 index 000000000..a93fa8bbb --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/g/go.go @@ -0,0 +1,114 @@ +package g + +import ( + "strings" + + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/h" + "github.com/alecthomas/chroma/lexers/internal" +) + +// Go lexer. +var Go = internal.Register(MustNewLexer( + &Config{ + Name: "Go", + Aliases: []string{"go", "golang"}, + Filenames: []string{"*.go"}, + MimeTypes: []string{"text/x-gosrc"}, + }, + Rules{ + "root": { + {`\n`, Text, nil}, + {`\s+`, Text, nil}, + {`\\\n`, Text, nil}, + {`//(.*?)\n`, CommentSingle, nil}, + {`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil}, + {`(import|package)\b`, KeywordNamespace, nil}, + {`(var|func|struct|map|chan|type|interface|const)\b`, KeywordDeclaration, nil}, + {Words(``, `\b`, `break`, `default`, `select`, `case`, `defer`, `go`, `else`, `goto`, `switch`, `fallthrough`, `if`, `range`, `continue`, `for`, `return`), Keyword, nil}, + {`(true|false|iota|nil)\b`, KeywordConstant, nil}, + {Words(``, `\b(\()`, `uint`, `uint8`, `uint16`, `uint32`, `uint64`, `int`, `int8`, `int16`, `int32`, `int64`, `float`, `float32`, `float64`, `complex64`, `complex128`, `byte`, `rune`, `string`, `bool`, `error`, `uintptr`, `print`, `println`, `panic`, `recover`, `close`, `complex`, `real`, `imag`, `len`, `cap`, `append`, `copy`, `delete`, `new`, `make`), ByGroups(NameBuiltin, Punctuation), nil}, + {Words(``, `\b`, `uint`, `uint8`, `uint16`, `uint32`, `uint64`, `int`, `int8`, `int16`, `int32`, `int64`, `float`, `float32`, `float64`, `complex64`, `complex128`, `byte`, `rune`, `string`, `bool`, `error`, `uintptr`), KeywordType, nil}, + {`\d+i`, LiteralNumber, nil}, + {`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil}, + {`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil}, + {`\d+[Ee][-+]\d+i`, LiteralNumber, nil}, + {`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil}, + {`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil}, + {`0[0-7]+`, LiteralNumberOct, nil}, + {`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil}, + {`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil}, + {"(`)([^`]*)(`)", ByGroups(LiteralString, Using(TypeRemappingLexer(GoTextTemplate, TypeMapping{{Other, LiteralString, nil}})), LiteralString), nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`(<<=|>>=|<<|>>|<=|>=|&\^=|&\^|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\||<-|\+\+|--|==|!=|:=|\.\.\.|[+\-*/%&])`, Operator, nil}, + {`([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(NameFunction, UsingSelf("root"), Punctuation), nil}, + {`[|^<>=!()\[\]{}.,;:]`, Punctuation, nil}, + {`[^\W\d]\w*`, NameOther, nil}, + }, + }, +).SetAnalyser(func(text string) float32 { + if strings.Contains(text, "fmt.") && strings.Contains(text, "package ") { + return 0.5 + } + if strings.Contains(text, "package ") { + return 0.1 + } + return 0.0 +})) + +var goTemplateRules = Rules{ + "root": { + {`{{[-]?`, CommentPreproc, Push("template")}, + {`[^{]+`, Other, nil}, + {`{`, Other, nil}, + }, + "template": { + {`[-]?}}`, CommentPreproc, Pop(1)}, + {`/\*.*?\*/`, Comment, nil}, + {`(?=}})`, CommentPreproc, Pop(1)}, // Terminate the pipeline + {`\(`, Operator, Push("subexpression")}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + Include("expression"), + }, + "subexpression": { + {`\)`, Operator, Pop(1)}, + Include("expression"), + }, + "expression": { + {`\s+`, Whitespace, nil}, + {`\(`, Operator, Push("subexpression")}, + {`(range|if|else|while|with|template|end|true|false|nil|and|call|html|index|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|le|gt|ge)\b`, Keyword, nil}, + {`\||:=`, Operator, nil}, + {`[$]?[^\W\d]\w*`, NameOther, nil}, + {`[$]?\.(?:[^\W\d]\w*)?`, NameAttribute, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`\d+i`, LiteralNumber, nil}, + {`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil}, + {`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil}, + {`\d+[Ee][-+]\d+i`, LiteralNumber, nil}, + {`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil}, + {`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil}, + {`0[0-7]+`, LiteralNumberOct, nil}, + {`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil}, + {`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil}, + {"`[^`]*`", LiteralString, nil}, + }, +} + +var GoHTMLTemplate = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( + &Config{ + Name: "Go HTML Template", + Aliases: []string{"go-html-template"}, + }, + goTemplateRules, +))) + +var GoTextTemplate = internal.Register(MustNewLexer( + &Config{ + Name: "Go Text Template", + Aliases: []string{"go-text-template"}, + }, + goTemplateRules, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/g/graphql.go b/vendor/github.com/alecthomas/chroma/lexers/g/graphql.go new file mode 100644 index 000000000..a57e693ab --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/g/graphql.go @@ -0,0 +1,45 @@ +package g + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Go lexer. +var Graphql = internal.Register(MustNewLexer( + &Config{ + Name: "GraphQL", + Aliases: []string{"graphql", "graphqls", "gql"}, + Filenames: []string{"*.graphql", "*.graphqls"}, + }, + Rules{ + "root": { + {`(query|mutation|subscription|fragment|scalar|implements|interface|union|enum|input|type)`, KeywordDeclaration, Push("type")}, + {`(on|extend|schema|directive|\.\.\.)`, KeywordDeclaration, nil}, + {`(QUERY|MUTATION|SUBSCRIPTION|FIELD|FRAGMENT_DEFINITION|FRAGMENT_SPREAD|INLINE_FRAGMENT|SCHEMA|SCALAR|OBJECT|FIELD_DEFINITION|ARGUMENT_DEFINITION|INTERFACE|UNION|ENUM|ENUM_VALUE|INPUT_OBJECT|INPUT_FIELD_DEFINITION)\b`, KeywordConstant, nil}, + {`[^\W\d]\w*`, NameProperty, nil}, + {`\@\w+`, NameDecorator, nil}, + {`:`, Punctuation, Push("type")}, + {`[\(\)\{\}\[\],!\|=]`, Punctuation, nil}, + {`\$\w+`, NameVariable, nil}, + {`\d+i`, LiteralNumber, nil}, + {`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil}, + {`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil}, + {`\d+[Ee][-+]\d+i`, LiteralNumber, nil}, + {`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil}, + {`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil}, + {`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil}, + {`"""[\x00-\x7F]*?"""`, LiteralString, nil}, + {`"(\\["\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])"`, LiteralStringChar, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`"(true|false|null)*"`, Literal, nil}, + {`[\r\n\s]+`, Whitespace, nil}, + {`#[^\r\n]*`, Comment, nil}, + }, + // Treats the next word as a class, default rules it would be a property + "type": { + {`[^\W\d]\w*`, NameClass, Pop(1)}, + Include("root"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/g/groovy.go b/vendor/github.com/alecthomas/chroma/lexers/g/groovy.go new file mode 100644 index 000000000..a395415a9 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/g/groovy.go @@ -0,0 +1,58 @@ +package g + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Groovy lexer. +var Groovy = internal.Register(MustNewLexer( + &Config{ + Name: "Groovy", + Aliases: []string{"groovy"}, + Filenames: []string{"*.groovy", "*.gradle"}, + MimeTypes: []string{"text/x-groovy"}, + DotAll: true, + }, + Rules{ + "root": { + {`#!(.*?)$`, CommentPreproc, Push("base")}, + Default(Push("base")), + }, + "base": { + {`^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil}, + {`[^\S\n]+`, Text, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/\*.*?\*/`, CommentMultiline, nil}, + {`@[a-zA-Z_][\w.]*`, NameDecorator, nil}, + {`(as|assert|break|case|catch|continue|default|do|else|finally|for|if|in|goto|instanceof|new|return|switch|this|throw|try|while|in|as)\b`, Keyword, nil}, + {`(abstract|const|enum|extends|final|implements|native|private|protected|public|static|strictfp|super|synchronized|throws|transient|volatile)\b`, KeywordDeclaration, nil}, + {`(def|boolean|byte|char|double|float|int|long|short|void)\b`, KeywordType, nil}, + {`(package)(\s+)`, ByGroups(KeywordNamespace, Text), nil}, + {`(true|false|null)\b`, KeywordConstant, nil}, + {`(class|interface)(\s+)`, ByGroups(KeywordDeclaration, Text), Push("class")}, + {`(import)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")}, + {`""".*?"""`, LiteralStringDouble, nil}, + {`'''.*?'''`, LiteralStringSingle, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`\$/((?!/\$).)*/\$`, LiteralString, nil}, + {`/(\\\\|\\"|[^/])*/`, LiteralString, nil}, + {`'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'`, LiteralStringChar, nil}, + {`(\.)([a-zA-Z_]\w*)`, ByGroups(Operator, NameAttribute), nil}, + {`[a-zA-Z_]\w*:`, NameLabel, nil}, + {`[a-zA-Z_$]\w*`, Name, nil}, + {`[~^*!%&\[\](){}<>|+=:;,./?-]`, Operator, nil}, + {`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil}, + {`0x[0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`[0-9]+L?`, LiteralNumberInteger, nil}, + {`\n`, Text, nil}, + }, + "class": { + {`[a-zA-Z_]\w*`, NameClass, Pop(1)}, + }, + "import": { + {`[\w.]+\*?`, NameNamespace, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/h/handlebars.go b/vendor/github.com/alecthomas/chroma/lexers/h/handlebars.go new file mode 100644 index 000000000..07072da58 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/h/handlebars.go @@ -0,0 +1,56 @@ +package h + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Handlebars lexer. +var Handlebars = internal.Register(MustNewLexer( + &Config{ + Name: "Handlebars", + Aliases: []string{"handlebars"}, + Filenames: []string{"*.handlebars"}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`[^{]+`, Other, nil}, + {`\{\{!.*\}\}`, Comment, nil}, + {`(\{\{\{)(\s*)`, ByGroups(CommentSpecial, Text), Push("tag")}, + {`(\{\{)(\s*)`, ByGroups(CommentPreproc, Text), Push("tag")}, + }, + "tag": { + {`\s+`, Text, nil}, + {`\}\}\}`, CommentSpecial, Pop(1)}, + {`\}\}`, CommentPreproc, Pop(1)}, + {`([#/]*)(each|if|unless|else|with|log|in(?:line)?)`, ByGroups(Keyword, Keyword), nil}, + {`#\*inline`, Keyword, nil}, + {`([#/])([\w-]+)`, ByGroups(NameFunction, NameFunction), nil}, + {`([\w-]+)(=)`, ByGroups(NameAttribute, Operator), nil}, + {`(>)(\s*)(@partial-block)`, ByGroups(Keyword, Text, Keyword), nil}, + {`(#?>)(\s*)([\w-]+)`, ByGroups(Keyword, Text, NameVariable), nil}, + {`(>)(\s*)(\()`, ByGroups(Keyword, Text, Punctuation), Push("dynamic-partial")}, + Include("generic"), + }, + "dynamic-partial": { + {`\s+`, Text, nil}, + {`\)`, Punctuation, Pop(1)}, + {`(lookup)(\s+)(\.|this)(\s+)`, ByGroups(Keyword, Text, NameVariable, Text), nil}, + {`(lookup)(\s+)(\S+)`, ByGroups(Keyword, Text, UsingSelf("variable")), nil}, + {`[\w-]+`, NameFunction, nil}, + Include("generic"), + }, + "variable": { + {`[a-zA-Z][\w-]*`, NameVariable, nil}, + {`\.[\w-]+`, NameVariable, nil}, + {`(this\/|\.\/|(\.\.\/)+)[\w-]+`, NameVariable, nil}, + }, + "generic": { + Include("variable"), + {`:?"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`:?'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/h/haskell.go b/vendor/github.com/alecthomas/chroma/lexers/h/haskell.go new file mode 100644 index 000000000..b018eab48 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/h/haskell.go @@ -0,0 +1,99 @@ +package h + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Haskell lexer. +var Haskell = internal.Register(MustNewLexer( + &Config{ + Name: "Haskell", + Aliases: []string{"haskell", "hs"}, + Filenames: []string{"*.hs"}, + MimeTypes: []string{"text/x-haskell"}, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`--(?![!#$%&*+./<=>?@^|_~:\\]).*?$`, CommentSingle, nil}, + {`\{-`, CommentMultiline, Push("comment")}, + {`\bimport\b`, KeywordReserved, Push("import")}, + {`\bmodule\b`, KeywordReserved, Push("module")}, + {`\berror\b`, NameException, nil}, + {`\b(case|class|data|default|deriving|do|else|family|if|in|infix[lr]?|instance|let|newtype|of|then|type|where|_)(?!\')\b`, KeywordReserved, nil}, + {`'[^\\]'`, LiteralStringChar, nil}, + {`^[_a-zµß-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıijĵķ-ĸĺļľŀłńņň-ʼnŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźżž-ƀƃƅƈƌ-ƍƒƕƙ-ƛƞơƣƥƨƪ-ƫƭưƴƶƹ-ƺƽ-ƿdžljnjǎǐǒǔǖǘǚǜ-ǝǟǡǣǥǧǩǫǭǯ-ǰdzǵǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟȡȣȥȧȩȫȭȯȱȳ-ȹȼȿ-ɀɂɇɉɋɍɏ-ʓʕ-ʯͱͳͷͻ-ͽΐά-ώϐ-ϑϕ-ϗϙϛϝϟϡϣϥϧϩϫϭϯ-ϳϵϸϻ-ϼа-џѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎ-ӏӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃԅԇԉԋԍԏԑԓԕԗԙԛԝԟԡԣԥԧա-ևᴀ-ᴫᵫ-ᵷᵹ-ᶚḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕ-ẝẟạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶ-ᾷιῂ-ῄῆ-ῇῐ-ΐῖ-ῗῠ-ῧῲ-ῴῶ-ῷℊℎ-ℏℓℯℴℹℼ-ℽⅆ-ⅉⅎↄⰰ-ⱞⱡⱥ-ⱦⱨⱪⱬⱱⱳ-ⱴⱶ-ⱻⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣ-ⳤⳬⳮⳳⴀ-ⴥⴧⴭꙁꙃꙅꙇꙉꙋꙍꙏꙑꙓꙕꙗꙙꙛꙝꙟꙡꙣꙥꙧꙩꙫꙭꚁꚃꚅꚇꚉꚋꚍꚏꚑꚓꚕꚗꜣꜥꜧꜩꜫꜭꜯ-ꜱꜳꜵꜷꜹꜻꜽꜿꝁꝃꝅꝇꝉꝋꝍꝏꝑꝓꝕꝗꝙꝛꝝꝟꝡꝣꝥꝧꝩꝫꝭꝯꝱ-ꝸꝺꝼꝿꞁꞃꞅꞇꞌꞎꞑꞓꞡꞣꞥꞧꞩꟺff-stﬓ-ﬗa-z𐐨-𐑏𝐚-𝐳𝑎-𝑔𝑖-𝑧𝒂-𝒛𝒶-𝒹𝒻𝒽-𝓃𝓅-𝓏𝓪-𝔃𝔞-𝔷𝕒-𝕫𝖆-𝖟𝖺-𝗓𝗮-𝘇𝘢-𝘻𝙖-𝙯𝚊-𝚥𝛂-𝛚𝛜-𝛡𝛼-𝜔𝜖-𝜛𝜶-𝝎𝝐-𝝕𝝰-𝞈𝞊-𝞏𝞪-𝟂𝟄-𝟉𝟋][\w\']*`, NameFunction, nil}, + {`'?[_a-zµß-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıijĵķ-ĸĺļľŀłńņň-ʼnŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźżž-ƀƃƅƈƌ-ƍƒƕƙ-ƛƞơƣƥƨƪ-ƫƭưƴƶƹ-ƺƽ-ƿdžljnjǎǐǒǔǖǘǚǜ-ǝǟǡǣǥǧǩǫǭǯ-ǰdzǵǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟȡȣȥȧȩȫȭȯȱȳ-ȹȼȿ-ɀɂɇɉɋɍɏ-ʓʕ-ʯͱͳͷͻ-ͽΐά-ώϐ-ϑϕ-ϗϙϛϝϟϡϣϥϧϩϫϭϯ-ϳϵϸϻ-ϼа-џѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎ-ӏӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃԅԇԉԋԍԏԑԓԕԗԙԛԝԟԡԣԥԧա-ևᴀ-ᴫᵫ-ᵷᵹ-ᶚḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕ-ẝẟạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶ-ᾷιῂ-ῄῆ-ῇῐ-ΐῖ-ῗῠ-ῧῲ-ῴῶ-ῷℊℎ-ℏℓℯℴℹℼ-ℽⅆ-ⅉⅎↄⰰ-ⱞⱡⱥ-ⱦⱨⱪⱬⱱⱳ-ⱴⱶ-ⱻⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣ-ⳤⳬⳮⳳⴀ-ⴥⴧⴭꙁꙃꙅꙇꙉꙋꙍꙏꙑꙓꙕꙗꙙꙛꙝꙟꙡꙣꙥꙧꙩꙫꙭꚁꚃꚅꚇꚉꚋꚍꚏꚑꚓꚕꚗꜣꜥꜧꜩꜫꜭꜯ-ꜱꜳꜵꜷꜹꜻꜽꜿꝁꝃꝅꝇꝉꝋꝍꝏꝑꝓꝕꝗꝙꝛꝝꝟꝡꝣꝥꝧꝩꝫꝭꝯꝱ-ꝸꝺꝼꝿꞁꞃꞅꞇꞌꞎꞑꞓꞡꞣꞥꞧꞩꟺff-stﬓ-ﬗa-z𐐨-𐑏𝐚-𝐳𝑎-𝑔𝑖-𝑧𝒂-𝒛𝒶-𝒹𝒻𝒽-𝓃𝓅-𝓏𝓪-𝔃𝔞-𝔷𝕒-𝕫𝖆-𝖟𝖺-𝗓𝗮-𝘇𝘢-𝘻𝙖-𝙯𝚊-𝚥𝛂-𝛚𝛜-𝛡𝛼-𝜔𝜖-𝜛𝜶-𝝎𝝐-𝝕𝝰-𝞈𝞊-𝞏𝞪-𝟂𝟄-𝟉𝟋][\w']*`, Name, nil}, + {`('')?[A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w\']*`, KeywordType, nil}, + {`(')[A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w\']*`, KeywordType, nil}, + {`(')\[[^\]]*\]`, KeywordType, nil}, + {`(')\([^)]*\)`, KeywordType, nil}, + {`\\(?![:!#$%&*+.\\/<=>?@^|~-]+)`, NameFunction, nil}, + {`(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)`, OperatorWord, nil}, + {`:[:!#$%&*+.\\/<=>?@^|~-]*`, KeywordType, nil}, + {`[:!#$%&*+.\\/<=>?@^|~-]+`, Operator, nil}, + {`\d+[eE][+-]?\d+`, LiteralNumberFloat, nil}, + {`\d+\.\d+([eE][+-]?\d+)?`, LiteralNumberFloat, nil}, + {`0[oO][0-7]+`, LiteralNumberOct, nil}, + {`0[xX][\da-fA-F]+`, LiteralNumberHex, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`'`, LiteralStringChar, Push("character")}, + {`"`, LiteralString, Push("string")}, + {`\[\]`, KeywordType, nil}, + {`\(\)`, NameBuiltin, nil}, + {"[][(),;`{}]", Punctuation, nil}, + }, + "import": { + {`\s+`, Text, nil}, + {`"`, LiteralString, Push("string")}, + {`\)`, Punctuation, Pop(1)}, + {`qualified\b`, Keyword, nil}, + {`([A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*)(\s+)(as)(\s+)([A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*)`, ByGroups(NameNamespace, Text, Keyword, Text, Name), Pop(1)}, + {`([A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*)(\s+)(hiding)(\s+)(\()`, ByGroups(NameNamespace, Text, Keyword, Text, Punctuation), Push("funclist")}, + {`([A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*)(\s+)(\()`, ByGroups(NameNamespace, Text, Punctuation), Push("funclist")}, + {`[\w.]+`, NameNamespace, Pop(1)}, + }, + "module": { + {`\s+`, Text, nil}, + {`([A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*)(\s+)(\()`, ByGroups(NameNamespace, Text, Punctuation), Push("funclist")}, + {`[A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*`, NameNamespace, Pop(1)}, + }, + "funclist": { + {`\s+`, Text, nil}, + {`[A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊]\w*`, KeywordType, nil}, + {`(_[\w\']+|[a-zµß-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıijĵķ-ĸĺļľŀłńņň-ʼnŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźżž-ƀƃƅƈƌ-ƍƒƕƙ-ƛƞơƣƥƨƪ-ƫƭưƴƶƹ-ƺƽ-ƿdžljnjǎǐǒǔǖǘǚǜ-ǝǟǡǣǥǧǩǫǭǯ-ǰdzǵǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟȡȣȥȧȩȫȭȯȱȳ-ȹȼȿ-ɀɂɇɉɋɍɏ-ʓʕ-ʯͱͳͷͻ-ͽΐά-ώϐ-ϑϕ-ϗϙϛϝϟϡϣϥϧϩϫϭϯ-ϳϵϸϻ-ϼа-џѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎ-ӏӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃԅԇԉԋԍԏԑԓԕԗԙԛԝԟԡԣԥԧա-ևᴀ-ᴫᵫ-ᵷᵹ-ᶚḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕ-ẝẟạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶ-ᾷιῂ-ῄῆ-ῇῐ-ΐῖ-ῗῠ-ῧῲ-ῴῶ-ῷℊℎ-ℏℓℯℴℹℼ-ℽⅆ-ⅉⅎↄⰰ-ⱞⱡⱥ-ⱦⱨⱪⱬⱱⱳ-ⱴⱶ-ⱻⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣ-ⳤⳬⳮⳳⴀ-ⴥⴧⴭꙁꙃꙅꙇꙉꙋꙍꙏꙑꙓꙕꙗꙙꙛꙝꙟꙡꙣꙥꙧꙩꙫꙭꚁꚃꚅꚇꚉꚋꚍꚏꚑꚓꚕꚗꜣꜥꜧꜩꜫꜭꜯ-ꜱꜳꜵꜷꜹꜻꜽꜿꝁꝃꝅꝇꝉꝋꝍꝏꝑꝓꝕꝗꝙꝛꝝꝟꝡꝣꝥꝧꝩꝫꝭꝯꝱ-ꝸꝺꝼꝿꞁꞃꞅꞇꞌꞎꞑꞓꞡꞣꞥꞧꞩꟺff-stﬓ-ﬗa-z𐐨-𐑏𝐚-𝐳𝑎-𝑔𝑖-𝑧𝒂-𝒛𝒶-𝒹𝒻𝒽-𝓃𝓅-𝓏𝓪-𝔃𝔞-𝔷𝕒-𝕫𝖆-𝖟𝖺-𝗓𝗮-𝘇𝘢-𝘻𝙖-𝙯𝚊-𝚥𝛂-𝛚𝛜-𝛡𝛼-𝜔𝜖-𝜛𝜶-𝝎𝝐-𝝕𝝰-𝞈𝞊-𝞏𝞪-𝟂𝟄-𝟉𝟋][\w\']*)`, NameFunction, nil}, + {`--(?![!#$%&*+./<=>?@^|_~:\\]).*?$`, CommentSingle, nil}, + {`\{-`, CommentMultiline, Push("comment")}, + {`,`, Punctuation, nil}, + {`[:!#$%&*+.\\/<=>?@^|~-]+`, Operator, nil}, + {`\(`, Punctuation, Push("funclist", "funclist")}, + {`\)`, Punctuation, Pop(2)}, + }, + "comment": { + {`[^-{}]+`, CommentMultiline, nil}, + {`\{-`, CommentMultiline, Push()}, + {`-\}`, CommentMultiline, Pop(1)}, + {`[-{}]`, CommentMultiline, nil}, + }, + "character": { + {`[^\\']'`, LiteralStringChar, Pop(1)}, + {`\\`, LiteralStringEscape, Push("escape")}, + {`'`, LiteralStringChar, Pop(1)}, + }, + "string": { + {`[^\\"]+`, LiteralString, nil}, + {`\\`, LiteralStringEscape, Push("escape")}, + {`"`, LiteralString, Pop(1)}, + }, + "escape": { + {`[abfnrtv"\'&\\]`, LiteralStringEscape, Pop(1)}, + {`\^[][A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊@^_]`, LiteralStringEscape, Pop(1)}, + {`NUL|SOH|[SE]TX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|S[OI]|DLE|DC[1-4]|NAK|SYN|ETB|CAN|EM|SUB|ESC|[FGRU]S|SP|DEL`, LiteralStringEscape, Pop(1)}, + {`o[0-7]+`, LiteralStringEscape, Pop(1)}, + {`x[\da-fA-F]+`, LiteralStringEscape, Pop(1)}, + {`\d+`, LiteralStringEscape, Pop(1)}, + {`\s+\\`, LiteralStringEscape, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/h/haxe.go b/vendor/github.com/alecthomas/chroma/lexers/h/haxe.go new file mode 100644 index 000000000..595854319 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/h/haxe.go @@ -0,0 +1,642 @@ +package h + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Haxe lexer. +var Haxe = internal.Register(MustNewLexer( + &Config{ + Name: "Haxe", + Aliases: []string{"hx", "haxe", "hxsl"}, + Filenames: []string{"*.hx", "*.hxsl"}, + MimeTypes: []string{"text/haxe", "text/x-haxe", "text/x-hx"}, + DotAll: true, + }, + Rules{ + "root": { + Include("spaces"), + Include("meta"), + {`(?:package)\b`, KeywordNamespace, Push("semicolon", "package")}, + {`(?:import)\b`, KeywordNamespace, Push("semicolon", "import")}, + {`(?:using)\b`, KeywordNamespace, Push("semicolon", "using")}, + {`(?:extern|private)\b`, KeywordDeclaration, nil}, + {`(?:abstract)\b`, KeywordDeclaration, Push("abstract")}, + {`(?:class|interface)\b`, KeywordDeclaration, Push("class")}, + {`(?:enum)\b`, KeywordDeclaration, Push("enum")}, + {`(?:typedef)\b`, KeywordDeclaration, Push("typedef")}, + {`(?=.)`, Text, Push("expr-statement")}, + }, + "spaces": { + {`\s+`, Text, nil}, + {`//[^\n\r]*`, CommentSingle, nil}, + {`/\*.*?\*/`, CommentMultiline, nil}, + {`(#)(if|elseif|else|end|error)\b`, CommentPreproc, MutatorFunc(haxePreProcMutator)}, + }, + "string-single-interpol": { + {`\$\{`, LiteralStringInterpol, Push("string-interpol-close", "expr")}, + {`\$\$`, LiteralStringEscape, nil}, + {`\$(?=(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+))`, LiteralStringInterpol, Push("ident")}, + Include("string-single"), + }, + "string-single": { + {`'`, LiteralStringSingle, Pop(1)}, + {`\\.`, LiteralStringEscape, nil}, + {`.`, LiteralStringSingle, nil}, + }, + "string-double": { + {`"`, LiteralStringDouble, Pop(1)}, + {`\\.`, LiteralStringEscape, nil}, + {`.`, LiteralStringDouble, nil}, + }, + "string-interpol-close": { + {`\$(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, LiteralStringInterpol, nil}, + {`\}`, LiteralStringInterpol, Pop(1)}, + }, + "package": { + Include("spaces"), + {`(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, NameNamespace, nil}, + {`\.`, Punctuation, Push("import-ident")}, + Default(Pop(1)), + }, + "import": { + Include("spaces"), + {`(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, NameNamespace, nil}, + {`\*`, Keyword, nil}, + {`\.`, Punctuation, Push("import-ident")}, + {`in`, KeywordNamespace, Push("ident")}, + Default(Pop(1)), + }, + "import-ident": { + Include("spaces"), + {`\*`, Keyword, Pop(1)}, + {`(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, NameNamespace, Pop(1)}, + }, + "using": { + Include("spaces"), + {`(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, NameNamespace, nil}, + {`\.`, Punctuation, Push("import-ident")}, + Default(Pop(1)), + }, + "preproc-error": { + {`\s+`, CommentPreproc, nil}, + {`'`, LiteralStringSingle, Push("#pop", "string-single")}, + {`"`, LiteralStringDouble, Push("#pop", "string-double")}, + Default(Pop(1)), + }, + "preproc-expr": { + {`\s+`, CommentPreproc, nil}, + {`\!`, CommentPreproc, nil}, + {`\(`, CommentPreproc, Push("#pop", "preproc-parenthesis")}, + {`(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, CommentPreproc, Pop(1)}, + {`\.[0-9]+`, LiteralNumberFloat, nil}, + {`[0-9]+[eE][+\-]?[0-9]+`, LiteralNumberFloat, nil}, + {`[0-9]+\.[0-9]*[eE][+\-]?[0-9]+`, LiteralNumberFloat, nil}, + {`[0-9]+\.[0-9]+`, LiteralNumberFloat, nil}, + {`[0-9]+\.(?!(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)|\.\.)`, LiteralNumberFloat, nil}, + {`0x[0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`'`, LiteralStringSingle, Push("#pop", "string-single")}, + {`"`, LiteralStringDouble, Push("#pop", "string-double")}, + }, + "preproc-parenthesis": { + {`\s+`, CommentPreproc, nil}, + {`\)`, CommentPreproc, Pop(1)}, + Default(Push("preproc-expr-in-parenthesis")), + }, + "preproc-expr-chain": { + {`\s+`, CommentPreproc, nil}, + {`(?:%=|&=|\|=|\^=|\+=|\-=|\*=|/=|<<=|>\s*>\s*=|>\s*>\s*>\s*=|==|!=|<=|>\s*=|&&|\|\||<<|>>>|>\s*>|\.\.\.|<|>|%|&|\||\^|\+|\*|/|\-|=>|=)`, CommentPreproc, Push("#pop", "preproc-expr-in-parenthesis")}, + Default(Pop(1)), + }, + "preproc-expr-in-parenthesis": { + {`\s+`, CommentPreproc, nil}, + {`\!`, CommentPreproc, nil}, + {`\(`, CommentPreproc, Push("#pop", "preproc-expr-chain", "preproc-parenthesis")}, + {`(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, CommentPreproc, Push("#pop", "preproc-expr-chain")}, + {`\.[0-9]+`, LiteralNumberFloat, Push("#pop", "preproc-expr-chain")}, + {`[0-9]+[eE][+\-]?[0-9]+`, LiteralNumberFloat, Push("#pop", "preproc-expr-chain")}, + {`[0-9]+\.[0-9]*[eE][+\-]?[0-9]+`, LiteralNumberFloat, Push("#pop", "preproc-expr-chain")}, + {`[0-9]+\.[0-9]+`, LiteralNumberFloat, Push("#pop", "preproc-expr-chain")}, + {`[0-9]+\.(?!(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)|\.\.)`, LiteralNumberFloat, Push("#pop", "preproc-expr-chain")}, + {`0x[0-9a-fA-F]+`, LiteralNumberHex, Push("#pop", "preproc-expr-chain")}, + {`[0-9]+`, LiteralNumberInteger, Push("#pop", "preproc-expr-chain")}, + {`'`, LiteralStringSingle, Push("#pop", "preproc-expr-chain", "string-single")}, + {`"`, LiteralStringDouble, Push("#pop", "preproc-expr-chain", "string-double")}, + }, + "abstract": { + Include("spaces"), + Default(Pop(1), Push("abstract-body"), Push("abstract-relation"), Push("abstract-opaque"), Push("type-param-constraint"), Push("type-name")), + }, + "abstract-body": { + Include("spaces"), + {`\{`, Punctuation, Push("#pop", "class-body")}, + }, + "abstract-opaque": { + Include("spaces"), + {`\(`, Punctuation, Push("#pop", "parenthesis-close", "type")}, + Default(Pop(1)), + }, + "abstract-relation": { + Include("spaces"), + {`(?:to|from)`, KeywordDeclaration, Push("type")}, + {`,`, Punctuation, nil}, + Default(Pop(1)), + }, + "meta": { + Include("spaces"), + {`@`, NameDecorator, Push("meta-body", "meta-ident", "meta-colon")}, + }, + "meta-colon": { + Include("spaces"), + {`:`, NameDecorator, Pop(1)}, + Default(Pop(1)), + }, + "meta-ident": { + Include("spaces"), + {`(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, NameDecorator, Pop(1)}, + }, + "meta-body": { + Include("spaces"), + {`\(`, NameDecorator, Push("#pop", "meta-call")}, + Default(Pop(1)), + }, + "meta-call": { + Include("spaces"), + {`\)`, NameDecorator, Pop(1)}, + Default(Pop(1), Push("meta-call-sep"), Push("expr")), + }, + "meta-call-sep": { + Include("spaces"), + {`\)`, NameDecorator, Pop(1)}, + {`,`, Punctuation, Push("#pop", "meta-call")}, + }, + "typedef": { + Include("spaces"), + Default(Pop(1), Push("typedef-body"), Push("type-param-constraint"), Push("type-name")), + }, + "typedef-body": { + Include("spaces"), + {`=`, Operator, Push("#pop", "optional-semicolon", "type")}, + }, + "enum": { + Include("spaces"), + Default(Pop(1), Push("enum-body"), Push("bracket-open"), Push("type-param-constraint"), Push("type-name")), + }, + "enum-body": { + Include("spaces"), + Include("meta"), + {`\}`, Punctuation, Pop(1)}, + {`(?!(?:function|class|static|var|if|else|while|do|for|break|return|continue|extends|implements|import|switch|case|default|public|private|try|untyped|catch|new|this|throw|extern|enum|in|interface|cast|override|dynamic|typedef|package|inline|using|null|true|false|abstract)\b)(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, Name, Push("enum-member", "type-param-constraint")}, + }, + "enum-member": { + Include("spaces"), + {`\(`, Punctuation, Push("#pop", "semicolon", "flag", "function-param")}, + Default(Pop(1), Push("semicolon"), Push("flag")), + }, + "class": { + Include("spaces"), + Default(Pop(1), Push("class-body"), Push("bracket-open"), Push("extends"), Push("type-param-constraint"), Push("type-name")), + }, + "extends": { + Include("spaces"), + {`(?:extends|implements)\b`, KeywordDeclaration, Push("type")}, + {`,`, Punctuation, nil}, + Default(Pop(1)), + }, + "bracket-open": { + Include("spaces"), + {`\{`, Punctuation, Pop(1)}, + }, + "bracket-close": { + Include("spaces"), + {`\}`, Punctuation, Pop(1)}, + }, + "class-body": { + Include("spaces"), + Include("meta"), + {`\}`, Punctuation, Pop(1)}, + {`(?:static|public|private|override|dynamic|inline|macro)\b`, KeywordDeclaration, nil}, + Default(Push("class-member")), + }, + "class-member": { + Include("spaces"), + {`(var)\b`, KeywordDeclaration, Push("#pop", "optional-semicolon", "var")}, + {`(function)\b`, KeywordDeclaration, Push("#pop", "optional-semicolon", "class-method")}, + }, + "function-local": { + Include("spaces"), + {`(?!(?:function|class|static|var|if|else|while|do|for|break|return|continue|extends|implements|import|switch|case|default|public|private|try|untyped|catch|new|this|throw|extern|enum|in|interface|cast|override|dynamic|typedef|package|inline|using|null|true|false|abstract)\b)(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, NameFunction, Push("#pop", "optional-expr", "flag", "function-param", "parenthesis-open", "type-param-constraint")}, + Default(Pop(1), Push("optional-expr"), Push("flag"), Push("function-param"), Push("parenthesis-open"), Push("type-param-constraint")), + }, + "optional-expr": { + Include("spaces"), + Include("expr"), + Default(Pop(1)), + }, + "class-method": { + Include("spaces"), + {`(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, NameFunction, Push("#pop", "optional-expr", "flag", "function-param", "parenthesis-open", "type-param-constraint")}, + }, + "function-param": { + Include("spaces"), + {`\)`, Punctuation, Pop(1)}, + {`\?`, Punctuation, nil}, + {`(?!(?:function|class|static|var|if|else|while|do|for|break|return|continue|extends|implements|import|switch|case|default|public|private|try|untyped|catch|new|this|throw|extern|enum|in|interface|cast|override|dynamic|typedef|package|inline|using|null|true|false|abstract)\b)(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, Name, Push("#pop", "function-param-sep", "assign", "flag")}, + }, + "function-param-sep": { + Include("spaces"), + {`\)`, Punctuation, Pop(1)}, + {`,`, Punctuation, Push("#pop", "function-param")}, + }, + "prop-get-set": { + Include("spaces"), + {`\(`, Punctuation, Push("#pop", "parenthesis-close", "prop-get-set-opt", "comma", "prop-get-set-opt")}, + Default(Pop(1)), + }, + "prop-get-set-opt": { + Include("spaces"), + {`(?:default|null|never|dynamic|get|set)\b`, Keyword, Pop(1)}, + {`(?!(?:function|class|static|var|if|else|while|do|for|break|return|continue|extends|implements|import|switch|case|default|public|private|try|untyped|catch|new|this|throw|extern|enum|in|interface|cast|override|dynamic|typedef|package|inline|using|null|true|false|abstract)\b)(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, Text, Pop(1)}, + }, + "expr-statement": { + Include("spaces"), + Default(Pop(1), Push("optional-semicolon"), Push("expr")), + }, + "expr": { + Include("spaces"), + {`@`, NameDecorator, Push("#pop", "optional-expr", "meta-body", "meta-ident", "meta-colon")}, + {`(?:\+\+|\-\-|~(?!/)|!|\-)`, Operator, nil}, + {`\(`, Punctuation, Push("#pop", "expr-chain", "parenthesis")}, + {`(?:static|public|private|override|dynamic|inline)\b`, KeywordDeclaration, nil}, + {`(?:function)\b`, KeywordDeclaration, Push("#pop", "expr-chain", "function-local")}, + {`\{`, Punctuation, Push("#pop", "expr-chain", "bracket")}, + {`(?:true|false|null)\b`, KeywordConstant, Push("#pop", "expr-chain")}, + {`(?:this)\b`, Keyword, Push("#pop", "expr-chain")}, + {`(?:cast)\b`, Keyword, Push("#pop", "expr-chain", "cast")}, + {`(?:try)\b`, Keyword, Push("#pop", "catch", "expr")}, + {`(?:var)\b`, KeywordDeclaration, Push("#pop", "var")}, + {`(?:new)\b`, Keyword, Push("#pop", "expr-chain", "new")}, + {`(?:switch)\b`, Keyword, Push("#pop", "switch")}, + {`(?:if)\b`, Keyword, Push("#pop", "if")}, + {`(?:do)\b`, Keyword, Push("#pop", "do")}, + {`(?:while)\b`, Keyword, Push("#pop", "while")}, + {`(?:for)\b`, Keyword, Push("#pop", "for")}, + {`(?:untyped|throw)\b`, Keyword, nil}, + {`(?:return)\b`, Keyword, Push("#pop", "optional-expr")}, + {`(?:macro)\b`, Keyword, Push("#pop", "macro")}, + {`(?:continue|break)\b`, Keyword, Pop(1)}, + {`(?:\$\s*[a-z]\b|\$(?!(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)))`, Name, Push("#pop", "dollar")}, + {`(?!(?:function|class|static|var|if|else|while|do|for|break|return|continue|extends|implements|import|switch|case|default|public|private|try|untyped|catch|new|this|throw|extern|enum|in|interface|cast|override|dynamic|typedef|package|inline|using|null|true|false|abstract)\b)(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, Name, Push("#pop", "expr-chain")}, + {`\.[0-9]+`, LiteralNumberFloat, Push("#pop", "expr-chain")}, + {`[0-9]+[eE][+\-]?[0-9]+`, LiteralNumberFloat, Push("#pop", "expr-chain")}, + {`[0-9]+\.[0-9]*[eE][+\-]?[0-9]+`, LiteralNumberFloat, Push("#pop", "expr-chain")}, + {`[0-9]+\.[0-9]+`, LiteralNumberFloat, Push("#pop", "expr-chain")}, + {`[0-9]+\.(?!(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)|\.\.)`, LiteralNumberFloat, Push("#pop", "expr-chain")}, + {`0x[0-9a-fA-F]+`, LiteralNumberHex, Push("#pop", "expr-chain")}, + {`[0-9]+`, LiteralNumberInteger, Push("#pop", "expr-chain")}, + {`'`, LiteralStringSingle, Push("#pop", "expr-chain", "string-single-interpol")}, + {`"`, LiteralStringDouble, Push("#pop", "expr-chain", "string-double")}, + {`~/(\\\\|\\/|[^/\n])*/[gimsu]*`, LiteralStringRegex, Push("#pop", "expr-chain")}, + {`\[`, Punctuation, Push("#pop", "expr-chain", "array-decl")}, + }, + "expr-chain": { + Include("spaces"), + {`(?:\+\+|\-\-)`, Operator, nil}, + {`(?:%=|&=|\|=|\^=|\+=|\-=|\*=|/=|<<=|>\s*>\s*=|>\s*>\s*>\s*=|==|!=|<=|>\s*=|&&|\|\||<<|>>>|>\s*>|\.\.\.|<|>|%|&|\||\^|\+|\*|/|\-|=>|=)`, Operator, Push("#pop", "expr")}, + {`(?:in)\b`, Keyword, Push("#pop", "expr")}, + {`\?`, Operator, Push("#pop", "expr", "ternary", "expr")}, + {`(\.)((?!(?:function|class|static|var|if|else|while|do|for|break|return|continue|extends|implements|import|switch|case|default|public|private|try|untyped|catch|new|this|throw|extern|enum|in|interface|cast|override|dynamic|typedef|package|inline|using|null|true|false|abstract)\b)(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+))`, ByGroups(Punctuation, Name), nil}, + {`\[`, Punctuation, Push("array-access")}, + {`\(`, Punctuation, Push("call")}, + Default(Pop(1)), + }, + "macro": { + Include("spaces"), + Include("meta"), + {`:`, Punctuation, Push("#pop", "type")}, + {`(?:extern|private)\b`, KeywordDeclaration, nil}, + {`(?:abstract)\b`, KeywordDeclaration, Push("#pop", "optional-semicolon", "abstract")}, + {`(?:class|interface)\b`, KeywordDeclaration, Push("#pop", "optional-semicolon", "macro-class")}, + {`(?:enum)\b`, KeywordDeclaration, Push("#pop", "optional-semicolon", "enum")}, + {`(?:typedef)\b`, KeywordDeclaration, Push("#pop", "optional-semicolon", "typedef")}, + Default(Pop(1), Push("expr")), + }, + "macro-class": { + {`\{`, Punctuation, Push("#pop", "class-body")}, + Include("class"), + }, + "cast": { + Include("spaces"), + {`\(`, Punctuation, Push("#pop", "parenthesis-close", "cast-type", "expr")}, + Default(Pop(1), Push("expr")), + }, + "cast-type": { + Include("spaces"), + {`,`, Punctuation, Push("#pop", "type")}, + Default(Pop(1)), + }, + "catch": { + Include("spaces"), + {`(?:catch)\b`, Keyword, Push("expr", "function-param", "parenthesis-open")}, + Default(Pop(1)), + }, + "do": { + Include("spaces"), + Default(Pop(1), Push("do-while"), Push("expr")), + }, + "do-while": { + Include("spaces"), + {`(?:while)\b`, Keyword, Push("#pop", "parenthesis", "parenthesis-open")}, + }, + "while": { + Include("spaces"), + {`\(`, Punctuation, Push("#pop", "expr", "parenthesis")}, + }, + "for": { + Include("spaces"), + {`\(`, Punctuation, Push("#pop", "expr", "parenthesis")}, + }, + "if": { + Include("spaces"), + {`\(`, Punctuation, Push("#pop", "else", "optional-semicolon", "expr", "parenthesis")}, + }, + "else": { + Include("spaces"), + {`(?:else)\b`, Keyword, Push("#pop", "expr")}, + Default(Pop(1)), + }, + "switch": { + Include("spaces"), + Default(Pop(1), Push("switch-body"), Push("bracket-open"), Push("expr")), + }, + "switch-body": { + Include("spaces"), + {`(?:case|default)\b`, Keyword, Push("case-block", "case")}, + {`\}`, Punctuation, Pop(1)}, + }, + "case": { + Include("spaces"), + {`:`, Punctuation, Pop(1)}, + Default(Pop(1), Push("case-sep"), Push("case-guard"), Push("expr")), + }, + "case-sep": { + Include("spaces"), + {`:`, Punctuation, Pop(1)}, + {`,`, Punctuation, Push("#pop", "case")}, + }, + "case-guard": { + Include("spaces"), + {`(?:if)\b`, Keyword, Push("#pop", "parenthesis", "parenthesis-open")}, + Default(Pop(1)), + }, + "case-block": { + Include("spaces"), + {`(?!(?:case|default)\b|\})`, Keyword, Push("expr-statement")}, + Default(Pop(1)), + }, + "new": { + Include("spaces"), + Default(Pop(1), Push("call"), Push("parenthesis-open"), Push("type")), + }, + "array-decl": { + Include("spaces"), + {`\]`, Punctuation, Pop(1)}, + Default(Pop(1), Push("array-decl-sep"), Push("expr")), + }, + "array-decl-sep": { + Include("spaces"), + {`\]`, Punctuation, Pop(1)}, + {`,`, Punctuation, Push("#pop", "array-decl")}, + }, + "array-access": { + Include("spaces"), + Default(Pop(1), Push("array-access-close"), Push("expr")), + }, + "array-access-close": { + Include("spaces"), + {`\]`, Punctuation, Pop(1)}, + }, + "comma": { + Include("spaces"), + {`,`, Punctuation, Pop(1)}, + }, + "colon": { + Include("spaces"), + {`:`, Punctuation, Pop(1)}, + }, + "semicolon": { + Include("spaces"), + {`;`, Punctuation, Pop(1)}, + }, + "optional-semicolon": { + Include("spaces"), + {`;`, Punctuation, Pop(1)}, + Default(Pop(1)), + }, + "ident": { + Include("spaces"), + {`(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, Name, Pop(1)}, + }, + "dollar": { + Include("spaces"), + {`\{`, Punctuation, Push("#pop", "expr-chain", "bracket-close", "expr")}, + Default(Pop(1), Push("expr-chain")), + }, + "type-name": { + Include("spaces"), + {`_*[A-Z]\w*`, Name, Pop(1)}, + }, + "type-full-name": { + Include("spaces"), + {`\.`, Punctuation, Push("ident")}, + Default(Pop(1)), + }, + "type": { + Include("spaces"), + {`\?`, Punctuation, nil}, + {`(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, Name, Push("#pop", "type-check", "type-full-name")}, + {`\{`, Punctuation, Push("#pop", "type-check", "type-struct")}, + {`\(`, Punctuation, Push("#pop", "type-check", "type-parenthesis")}, + }, + "type-parenthesis": { + Include("spaces"), + Default(Pop(1), Push("parenthesis-close"), Push("type")), + }, + "type-check": { + Include("spaces"), + {`->`, Punctuation, Push("#pop", "type")}, + {`<(?!=)`, Punctuation, Push("type-param")}, + Default(Pop(1)), + }, + "type-struct": { + Include("spaces"), + {`\}`, Punctuation, Pop(1)}, + {`\?`, Punctuation, nil}, + {`>`, Punctuation, Push("comma", "type")}, + {`(?!(?:function|class|static|var|if|else|while|do|for|break|return|continue|extends|implements|import|switch|case|default|public|private|try|untyped|catch|new|this|throw|extern|enum|in|interface|cast|override|dynamic|typedef|package|inline|using|null|true|false|abstract)\b)(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, Name, Push("#pop", "type-struct-sep", "type", "colon")}, + Include("class-body"), + }, + "type-struct-sep": { + Include("spaces"), + {`\}`, Punctuation, Pop(1)}, + {`,`, Punctuation, Push("#pop", "type-struct")}, + }, + "type-param-type": { + {`\.[0-9]+`, LiteralNumberFloat, Pop(1)}, + {`[0-9]+[eE][+\-]?[0-9]+`, LiteralNumberFloat, Pop(1)}, + {`[0-9]+\.[0-9]*[eE][+\-]?[0-9]+`, LiteralNumberFloat, Pop(1)}, + {`[0-9]+\.[0-9]+`, LiteralNumberFloat, Pop(1)}, + {`[0-9]+\.(?!(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)|\.\.)`, LiteralNumberFloat, Pop(1)}, + {`0x[0-9a-fA-F]+`, LiteralNumberHex, Pop(1)}, + {`[0-9]+`, LiteralNumberInteger, Pop(1)}, + {`'`, LiteralStringSingle, Push("#pop", "string-single")}, + {`"`, LiteralStringDouble, Push("#pop", "string-double")}, + {`~/(\\\\|\\/|[^/\n])*/[gim]*`, LiteralStringRegex, Pop(1)}, + {`\[`, Operator, Push("#pop", "array-decl")}, + Include("type"), + }, + "type-param": { + Include("spaces"), + Default(Pop(1), Push("type-param-sep"), Push("type-param-type")), + }, + "type-param-sep": { + Include("spaces"), + {`>`, Punctuation, Pop(1)}, + {`,`, Punctuation, Push("#pop", "type-param")}, + }, + "type-param-constraint": { + Include("spaces"), + {`<(?!=)`, Punctuation, Push("#pop", "type-param-constraint-sep", "type-param-constraint-flag", "type-name")}, + Default(Pop(1)), + }, + "type-param-constraint-sep": { + Include("spaces"), + {`>`, Punctuation, Pop(1)}, + {`,`, Punctuation, Push("#pop", "type-param-constraint-sep", "type-param-constraint-flag", "type-name")}, + }, + "type-param-constraint-flag": { + Include("spaces"), + {`:`, Punctuation, Push("#pop", "type-param-constraint-flag-type")}, + Default(Pop(1)), + }, + "type-param-constraint-flag-type": { + Include("spaces"), + {`\(`, Punctuation, Push("#pop", "type-param-constraint-flag-type-sep", "type")}, + Default(Pop(1), Push("type")), + }, + "type-param-constraint-flag-type-sep": { + Include("spaces"), + {`\)`, Punctuation, Pop(1)}, + {`,`, Punctuation, Push("type")}, + }, + "parenthesis": { + Include("spaces"), + Default(Pop(1), Push("parenthesis-close"), Push("flag"), Push("expr")), + }, + "parenthesis-open": { + Include("spaces"), + {`\(`, Punctuation, Pop(1)}, + }, + "parenthesis-close": { + Include("spaces"), + {`\)`, Punctuation, Pop(1)}, + }, + "var": { + Include("spaces"), + {`(?!(?:function|class|static|var|if|else|while|do|for|break|return|continue|extends|implements|import|switch|case|default|public|private|try|untyped|catch|new|this|throw|extern|enum|in|interface|cast|override|dynamic|typedef|package|inline|using|null|true|false|abstract)\b)(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, Text, Push("#pop", "var-sep", "assign", "flag", "prop-get-set")}, + }, + "var-sep": { + Include("spaces"), + {`,`, Punctuation, Push("#pop", "var")}, + Default(Pop(1)), + }, + "assign": { + Include("spaces"), + {`=`, Operator, Push("#pop", "expr")}, + Default(Pop(1)), + }, + "flag": { + Include("spaces"), + {`:`, Punctuation, Push("#pop", "type")}, + Default(Pop(1)), + }, + "ternary": { + Include("spaces"), + {`:`, Operator, Pop(1)}, + }, + "call": { + Include("spaces"), + {`\)`, Punctuation, Pop(1)}, + Default(Pop(1), Push("call-sep"), Push("expr")), + }, + "call-sep": { + Include("spaces"), + {`\)`, Punctuation, Pop(1)}, + {`,`, Punctuation, Push("#pop", "call")}, + }, + "bracket": { + Include("spaces"), + {`(?!(?:\$\s*[a-z]\b|\$(?!(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+))))(?!(?:function|class|static|var|if|else|while|do|for|break|return|continue|extends|implements|import|switch|case|default|public|private|try|untyped|catch|new|this|throw|extern|enum|in|interface|cast|override|dynamic|typedef|package|inline|using|null|true|false|abstract)\b)(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, Name, Push("#pop", "bracket-check")}, + {`'`, LiteralStringSingle, Push("#pop", "bracket-check", "string-single")}, + {`"`, LiteralStringDouble, Push("#pop", "bracket-check", "string-double")}, + Default(Pop(1), Push("block")), + }, + "bracket-check": { + Include("spaces"), + {`:`, Punctuation, Push("#pop", "object-sep", "expr")}, + Default(Pop(1), Push("block"), Push("optional-semicolon"), Push("expr-chain")), + }, + "block": { + Include("spaces"), + {`\}`, Punctuation, Pop(1)}, + Default(Push("expr-statement")), + }, + "object": { + Include("spaces"), + {`\}`, Punctuation, Pop(1)}, + Default(Pop(1), Push("object-sep"), Push("expr"), Push("colon"), Push("ident-or-string")), + }, + "ident-or-string": { + Include("spaces"), + {`(?!(?:function|class|static|var|if|else|while|do|for|break|return|continue|extends|implements|import|switch|case|default|public|private|try|untyped|catch|new|this|throw|extern|enum|in|interface|cast|override|dynamic|typedef|package|inline|using|null|true|false|abstract)\b)(?:_*[a-z]\w*|_+[0-9]\w*|_*[A-Z]\w*|_+|\$\w+)`, Name, Pop(1)}, + {`'`, LiteralStringSingle, Push("#pop", "string-single")}, + {`"`, LiteralStringDouble, Push("#pop", "string-double")}, + }, + "object-sep": { + Include("spaces"), + {`\}`, Punctuation, Pop(1)}, + {`,`, Punctuation, Push("#pop", "object")}, + }, + }, +)) + +func haxePreProcMutator(state *LexerState) error { + stack, ok := state.Get("haxe-pre-proc").([][]string) + if !ok { + stack = [][]string{} + } + + proc := state.Groups[2] + switch proc { + case "if": + stack = append(stack, state.Stack) + case "else", "elseif": + if len(stack) > 0 { + state.Stack = stack[len(stack)-1] + } + case "end": + stack = stack[:len(stack)-1] + } + + if proc == "if" || proc == "elseif" { + state.Stack = append(state.Stack, "preproc-expr") + } + + if proc == "error" { + state.Stack = append(state.Stack, "preproc-error") + } + state.Set("haxe-pre-proc", stack) + return nil +} diff --git a/vendor/github.com/alecthomas/chroma/lexers/h/hcl.go b/vendor/github.com/alecthomas/chroma/lexers/h/hcl.go new file mode 100644 index 000000000..ce7064b58 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/h/hcl.go @@ -0,0 +1,69 @@ +package h + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// HCL lexer. +var HCL = internal.Register(MustNewLexer( + &Config{ + Name: "HCL", + Aliases: []string{"hcl"}, + Filenames: []string{"*.hcl"}, + MimeTypes: []string{"application/x-hcl"}, + }, + Rules{ + "root": { + Include("string"), + Include("punctuation"), + Include("curly"), + Include("basic"), + Include("whitespace"), + {`[0-9]+`, LiteralNumber, nil}, + }, + "basic": { + {Words(`\b`, `\b`, `true`, `false`), KeywordType, nil}, + {`\s*/\*`, CommentMultiline, Push("comment")}, + {`\s*#.*\n`, CommentSingle, nil}, + {`(.*?)(\s*)(=)`, ByGroups(Name, Text, Operator), nil}, + {`\d+`, Number, nil}, + {`\b\w+\b`, Keyword, nil}, + {`\$\{`, LiteralStringInterpol, Push("var_builtin")}, + }, + "function": { + {`(\s+)(".*")(\s+)`, ByGroups(Text, LiteralString, Text), nil}, + Include("punctuation"), + Include("curly"), + }, + "var_builtin": { + {`\$\{`, LiteralStringInterpol, Push()}, + {Words(`\b`, `\b`, `concat`, `file`, `join`, `lookup`, `element`), NameBuiltin, nil}, + Include("string"), + Include("punctuation"), + {`\s+`, Text, nil}, + {`\}`, LiteralStringInterpol, Pop(1)}, + }, + "string": { + {`(".*")`, ByGroups(LiteralStringDouble), nil}, + }, + "punctuation": { + {`[\[\](),.]`, Punctuation, nil}, + }, + "curly": { + {`\{`, TextPunctuation, nil}, + {`\}`, TextPunctuation, nil}, + }, + "comment": { + {`[^*/]`, CommentMultiline, nil}, + {`/\*`, CommentMultiline, Push()}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[*/]`, CommentMultiline, nil}, + }, + "whitespace": { + {`\n`, Text, nil}, + {`\s+`, Text, nil}, + {`\\\n`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/h/hexdump.go b/vendor/github.com/alecthomas/chroma/lexers/h/hexdump.go new file mode 100644 index 000000000..8b7e7bdda --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/h/hexdump.go @@ -0,0 +1,67 @@ +package h + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Hexdump lexer. +var Hexdump = internal.Register(MustNewLexer( + &Config{ + Name: "Hexdump", + Aliases: []string{"hexdump"}, + Filenames: []string{}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`\n`, Text, nil}, + Include("offset"), + {`([0-9A-Ha-h]{2})(\-)([0-9A-Ha-h]{2})`, ByGroups(LiteralNumberHex, Punctuation, LiteralNumberHex), nil}, + {`[0-9A-Ha-h]{2}`, LiteralNumberHex, nil}, + {`(\s{2,3})(\>)(.{16})(\<)$`, ByGroups(Text, Punctuation, LiteralString, Punctuation), Push("bracket-strings")}, + {`(\s{2,3})(\|)(.{16})(\|)$`, ByGroups(Text, Punctuation, LiteralString, Punctuation), Push("piped-strings")}, + {`(\s{2,3})(\>)(.{1,15})(\<)$`, ByGroups(Text, Punctuation, LiteralString, Punctuation), nil}, + {`(\s{2,3})(\|)(.{1,15})(\|)$`, ByGroups(Text, Punctuation, LiteralString, Punctuation), nil}, + {`(\s{2,3})(.{1,15})$`, ByGroups(Text, LiteralString), nil}, + {`(\s{2,3})(.{16}|.{20})$`, ByGroups(Text, LiteralString), Push("nonpiped-strings")}, + {`\s`, Text, nil}, + {`^\*`, Punctuation, nil}, + }, + "offset": { + {`^([0-9A-Ha-h]+)(:)`, ByGroups(NameLabel, Punctuation), Push("offset-mode")}, + {`^[0-9A-Ha-h]+`, NameLabel, nil}, + }, + "offset-mode": { + {`\s`, Text, Pop(1)}, + {`[0-9A-Ha-h]+`, NameLabel, nil}, + {`:`, Punctuation, nil}, + }, + "piped-strings": { + {`\n`, Text, nil}, + Include("offset"), + {`[0-9A-Ha-h]{2}`, LiteralNumberHex, nil}, + {`(\s{2,3})(\|)(.{1,16})(\|)$`, ByGroups(Text, Punctuation, LiteralString, Punctuation), nil}, + {`\s`, Text, nil}, + {`^\*`, Punctuation, nil}, + }, + "bracket-strings": { + {`\n`, Text, nil}, + Include("offset"), + {`[0-9A-Ha-h]{2}`, LiteralNumberHex, nil}, + {`(\s{2,3})(\>)(.{1,16})(\<)$`, ByGroups(Text, Punctuation, LiteralString, Punctuation), nil}, + {`\s`, Text, nil}, + {`^\*`, Punctuation, nil}, + }, + "nonpiped-strings": { + {`\n`, Text, nil}, + Include("offset"), + {`([0-9A-Ha-h]{2})(\-)([0-9A-Ha-h]{2})`, ByGroups(LiteralNumberHex, Punctuation, LiteralNumberHex), nil}, + {`[0-9A-Ha-h]{2}`, LiteralNumberHex, nil}, + {`(\s{19,})(.{1,20}?)$`, ByGroups(Text, LiteralString), nil}, + {`(\s{2,3})(.{1,20})$`, ByGroups(Text, LiteralString), nil}, + {`\s`, Text, nil}, + {`^\*`, Punctuation, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/h/html.go b/vendor/github.com/alecthomas/chroma/lexers/h/html.go new file mode 100644 index 000000000..07fc27ef5 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/h/html.go @@ -0,0 +1,59 @@ +package h + +import ( + . "github.com/alecthomas/chroma" // nolint + . "github.com/alecthomas/chroma/lexers/c" // nolint + "github.com/alecthomas/chroma/lexers/internal" + . "github.com/alecthomas/chroma/lexers/j" // nolint +) + +// HTML lexer. +var HTML = internal.Register(MustNewLexer( + &Config{ + Name: "HTML", + Aliases: []string{"html"}, + Filenames: []string{"*.html", "*.htm", "*.xhtml", "*.xslt"}, + MimeTypes: []string{"text/html", "application/xhtml+xml"}, + NotMultiline: true, + DotAll: true, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`[^<&]+`, Text, nil}, + {`&\S*?;`, NameEntity, nil}, + {`\<\!\[CDATA\[.*?\]\]\>`, CommentPreproc, nil}, + {``, Comment, Pop(1)}, + {`-`, Comment, nil}, + }, + "tag": { + {`\s+`, Text, nil}, + {`([\w:-]+\s*)(=)(\s*)`, ByGroups(NameAttribute, Operator, Text), Push("attr")}, + {`[\w:-]+`, NameAttribute, nil}, + {`(/?)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation), Pop(1)}, + }, + "script-content": { + {`(<)(\s*)(/)(\s*)(script)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation, Text, NameTag, Text, Punctuation), Pop(1)}, + {`.+?(?=<\s*/\s*script\s*>)`, Using(Javascript), nil}, + }, + "style-content": { + {`(<)(\s*)(/)(\s*)(style)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation, Text, NameTag, Text, Punctuation), Pop(1)}, + {`.+?(?=<\s*/\s*style\s*>)`, Using(CSS), nil}, + }, + "attr": { + {`".*?"`, LiteralString, Pop(1)}, + {`'.*?'`, LiteralString, Pop(1)}, + {`[^\s>]+`, LiteralString, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/h/http.go b/vendor/github.com/alecthomas/chroma/lexers/h/http.go new file mode 100644 index 000000000..0a1264cf0 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/h/http.go @@ -0,0 +1,128 @@ +package h + +import ( + "strings" + + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// HTTP lexer. +var HTTP = internal.Register(httpBodyContentTypeLexer(MustNewLexer( + &Config{ + Name: "HTTP", + Aliases: []string{"http"}, + Filenames: []string{}, + MimeTypes: []string{}, + NotMultiline: true, + DotAll: true, + }, + Rules{ + "root": { + {`(GET|POST|PUT|DELETE|HEAD|OPTIONS|TRACE|PATCH|CONNECT)( +)([^ ]+)( +)(HTTP)(/)(1\.[01])(\r?\n|\Z)`, ByGroups(NameFunction, Text, NameNamespace, Text, KeywordReserved, Operator, LiteralNumber, Text), Push("headers")}, + {`(HTTP)(/)(1\.[01])( +)(\d{3})( +)([^\r\n]+)(\r?\n|\Z)`, ByGroups(KeywordReserved, Operator, LiteralNumber, Text, LiteralNumber, Text, NameException, Text), Push("headers")}, + }, + "headers": { + {`([^\s:]+)( *)(:)( *)([^\r\n]+)(\r?\n|\Z)`, EmitterFunc(httpHeaderBlock), nil}, + {`([\t ]+)([^\r\n]+)(\r?\n|\Z)`, EmitterFunc(httpContinuousHeaderBlock), nil}, + {`\r?\n`, Text, Push("content")}, + }, + "content": { + {`.+`, EmitterFunc(httpContentBlock), nil}, + }, + }, +))) + +func httpContentBlock(groups []string, lexer Lexer) Iterator { + tokens := []Token{ + {Generic, groups[0]}, + } + return Literator(tokens...) +} + +func httpHeaderBlock(groups []string, lexer Lexer) Iterator { + tokens := []Token{ + {Name, groups[1]}, + {Text, groups[2]}, + {Operator, groups[3]}, + {Text, groups[4]}, + {Literal, groups[5]}, + {Text, groups[6]}, + } + return Literator(tokens...) +} + +func httpContinuousHeaderBlock(groups []string, lexer Lexer) Iterator { + tokens := []Token{ + {Text, groups[1]}, + {Literal, groups[2]}, + {Text, groups[3]}, + } + return Literator(tokens...) +} + +func httpBodyContentTypeLexer(lexer Lexer) Lexer { return &httpBodyContentTyper{lexer} } + +type httpBodyContentTyper struct{ Lexer } + +func (d *httpBodyContentTyper) Tokenise(options *TokeniseOptions, text string) (Iterator, error) { // nolint: gocognit + var contentType string + var isContentType bool + var subIterator Iterator + + it, err := d.Lexer.Tokenise(options, text) + if err != nil { + return nil, err + } + + return func() Token { + token := it() + + if token == EOF { + if subIterator != nil { + return subIterator() + } + return EOF + } + + switch { + case token.Type == Name && strings.ToLower(token.Value) == "content-type": + { + isContentType = true + } + case token.Type == Literal && isContentType: + { + isContentType = false + contentType = strings.TrimSpace(token.Value) + pos := strings.Index(contentType, ";") + if pos > 0 { + contentType = strings.TrimSpace(contentType[:pos]) + } + } + case token.Type == Generic && contentType != "": + { + lexer := internal.MatchMimeType(contentType) + + // application/calendar+xml can be treated as application/xml + // if there's not a better match. + if lexer == nil && strings.Contains(contentType, "+") { + slashPos := strings.Index(contentType, "/") + plusPos := strings.LastIndex(contentType, "+") + contentType = contentType[:slashPos+1] + contentType[plusPos+1:] + lexer = internal.MatchMimeType(contentType) + } + + if lexer == nil { + token.Type = Text + } else { + subIterator, err = lexer.Tokenise(nil, token.Value) + if err != nil { + panic(err) + } + return EOF + } + } + } + return token + }, nil +} diff --git a/vendor/github.com/alecthomas/chroma/lexers/h/hy.go b/vendor/github.com/alecthomas/chroma/lexers/h/hy.go new file mode 100644 index 000000000..17385e86f --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/h/hy.go @@ -0,0 +1,51 @@ +package h + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Hy lexer. +var Hy = internal.Register(MustNewLexer( + &Config{ + Name: "Hy", + Aliases: []string{"hylang"}, + Filenames: []string{"*.hy"}, + MimeTypes: []string{"text/x-hy", "application/x-hy"}, + }, + Rules{ + "root": { + {`;.*$`, CommentSingle, nil}, + {`[,\s]+`, Text, nil}, + {`-?\d+\.\d+`, LiteralNumberFloat, nil}, + {`-?\d+`, LiteralNumberInteger, nil}, + {`0[0-7]+j?`, LiteralNumberOct, nil}, + {`0[xX][a-fA-F0-9]+`, LiteralNumberHex, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`'(?!#)[\w!$%*+<=>?/.#-]+`, LiteralStringSymbol, nil}, + {`\\(.|[a-z]+)`, LiteralStringChar, nil}, + {`^(\s*)([rRuU]{,2}"""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringDoc), nil}, + {`^(\s*)([rRuU]{,2}'''(?:.|\n)*?''')`, ByGroups(Text, LiteralStringDoc), nil}, + {`::?(?!#)[\w!$%*+<=>?/.#-]+`, LiteralStringSymbol, nil}, + {"~@|[`\\'#^~&@]", Operator, nil}, + Include("py-keywords"), + Include("py-builtins"), + {Words(``, ` `, `cond`, `for`, `->`, `->>`, `car`, `cdr`, `first`, `rest`, `let`, `when`, `unless`, `import`, `do`, `progn`, `get`, `slice`, `assoc`, `with-decorator`, `,`, `list_comp`, `kwapply`, `~`, `is`, `in`, `is-not`, `not-in`, `quasiquote`, `unquote`, `unquote-splice`, `quote`, `|`, `<<=`, `>>=`, `foreach`, `while`, `eval-and-compile`, `eval-when-compile`), Keyword, nil}, + {Words(``, ` `, `def`, `defn`, `defun`, `defmacro`, `defclass`, `lambda`, `fn`, `setv`), KeywordDeclaration, nil}, + {Words(``, ` `, `cycle`, `dec`, `distinct`, `drop`, `even?`, `filter`, `inc`, `instance?`, `iterable?`, `iterate`, `iterator?`, `neg?`, `none?`, `nth`, `numeric?`, `odd?`, `pos?`, `remove`, `repeat`, `repeatedly`, `take`, `take_nth`, `take_while`, `zero?`), NameBuiltin, nil}, + {`(?<=\()(?!#)[\w!$%*+<=>?/.#-]+`, NameFunction, nil}, + {`(?!#)[\w!$%*+<=>?/.#-]+`, NameVariable, nil}, + {`(\[|\])`, Punctuation, nil}, + {`(\{|\})`, Punctuation, nil}, + {`(\(|\))`, Punctuation, nil}, + }, + "py-keywords": { + {Words(``, `\b`, `assert`, `break`, `continue`, `del`, `elif`, `else`, `except`, `exec`, `finally`, `for`, `global`, `if`, `lambda`, `pass`, `print`, `raise`, `return`, `try`, `while`, `yield`, `yield from`, `as`, `with`), Keyword, nil}, + }, + "py-builtins": { + {Words(`(??@^|_~:\\]).*?)$`, ByGroups(Text, CommentSingle), nil}, + {`(\s*)(\|{3}.*?)$`, ByGroups(Text, CommentSingle), nil}, + {`(\s*)(\{-)`, ByGroups(Text, CommentMultiline), Push("comment")}, + {`^(\s*)([^\s(){}]+)(\s*)(:)(\s*)`, ByGroups(Text, NameFunction, Text, OperatorWord, Text), nil}, + {`\b(case|class|data|default|using|do|else|if|in|infix[lr]?|instance|rewrite|auto|namespace|codata|mutual|private|public|abstract|total|partial|let|proof|of|then|static|where|_|with|pattern|term|syntax|prefix|postulate|parameters|record|dsl|impossible|implicit|tactics|intros|intro|compute|refine|exact|trivial)(?!\')\b`, KeywordReserved, nil}, + {`(import|module)(\s+)`, ByGroups(KeywordReserved, Text), Push("module")}, + {`('')?[A-Z][\w\']*`, KeywordType, nil}, + {`[a-z][\w\']*`, Text, nil}, + {`(<-|::|->|=>|=)`, OperatorWord, nil}, + {`([(){}\[\]:!#$%&*+.\\/<=>?@^|~-]+)`, OperatorWord, nil}, + {`\d+[eE][+-]?\d+`, LiteralNumberFloat, nil}, + {`\d+\.\d+([eE][+-]?\d+)?`, LiteralNumberFloat, nil}, + {`0[xX][\da-fA-F]+`, LiteralNumberHex, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`'`, LiteralStringChar, Push("character")}, + {`"`, LiteralString, Push("string")}, + {`[^\s(){}]+`, Text, nil}, + {`\s+?`, Text, nil}, + }, + "module": { + {`\s+`, Text, nil}, + {`([A-Z][\w.]*)(\s+)(\()`, ByGroups(NameNamespace, Text, Punctuation), Push("funclist")}, + {`[A-Z][\w.]*`, NameNamespace, Pop(1)}, + }, + "funclist": { + {`\s+`, Text, nil}, + {`[A-Z]\w*`, KeywordType, nil}, + {`(_[\w\']+|[a-z][\w\']*)`, NameFunction, nil}, + {`--.*$`, CommentSingle, nil}, + {`\{-`, CommentMultiline, Push("comment")}, + {`,`, Punctuation, nil}, + {`[:!#$%&*+.\\/<=>?@^|~-]+`, Operator, nil}, + {`\(`, Punctuation, Push("funclist", "funclist")}, + {`\)`, Punctuation, Pop(2)}, + }, + "comment": { + {`[^-{}]+`, CommentMultiline, nil}, + {`\{-`, CommentMultiline, Push()}, + {`-\}`, CommentMultiline, Pop(1)}, + {`[-{}]`, CommentMultiline, nil}, + }, + "character": { + {`[^\\']`, LiteralStringChar, nil}, + {`\\`, LiteralStringEscape, Push("escape")}, + {`'`, LiteralStringChar, Pop(1)}, + }, + "string": { + {`[^\\"]+`, LiteralString, nil}, + {`\\`, LiteralStringEscape, Push("escape")}, + {`"`, LiteralString, Pop(1)}, + }, + "escape": { + {`[abfnrtv"\'&\\]`, LiteralStringEscape, Pop(1)}, + {`\^[][A-Z@^_]`, LiteralStringEscape, Pop(1)}, + {`NUL|SOH|[SE]TX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|S[OI]|DLE|DC[1-4]|NAK|SYN|ETB|CAN|EM|SUB|ESC|[FGRU]S|SP|DEL`, LiteralStringEscape, Pop(1)}, + {`o[0-7]+`, LiteralStringEscape, Pop(1)}, + {`x[\da-fA-F]+`, LiteralStringEscape, Pop(1)}, + {`\d+`, LiteralStringEscape, Pop(1)}, + {`\s+\\`, LiteralStringEscape, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/i/igor.go b/vendor/github.com/alecthomas/chroma/lexers/i/igor.go new file mode 100644 index 000000000..d704a4fbd --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/i/igor.go @@ -0,0 +1,32 @@ +package i + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Igor lexer. +var Igor = internal.Register(MustNewLexer( + &Config{ + Name: "Igor", + Aliases: []string{"igor", "igorpro"}, + Filenames: []string{"*.ipf"}, + MimeTypes: []string{"text/ipf"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`//.*$`, CommentSingle, nil}, + {`"([^"\\]|\\.)*"`, LiteralString, nil}, + {Words(`\b`, `\b`, `if`, `else`, `elseif`, `endif`, `for`, `endfor`, `strswitch`, `switch`, `case`, `default`, `endswitch`, `do`, `while`, `try`, `catch`, `endtry`, `break`, `continue`, `return`, `AbortOnRTE`, `AbortOnValue`), Keyword, nil}, + {Words(`\b`, `\b`, `variable`, `string`, `constant`, `strconstant`, `NVAR`, `SVAR`, `WAVE`, `STRUCT`, `dfref`, `funcref`, `char`, `uchar`, `int16`, `uint16`, `int32`, `uint32`, `int64`, `uint64`, `float`, `double`), KeywordType, nil}, + {Words(`\b`, `\b`, `override`, `ThreadSafe`, `MultiThread`, `static`, `Proc`, `Picture`, `Prompt`, `DoPrompt`, `macro`, `window`, `function`, `end`, `Structure`, `EndStructure`, `EndMacro`, `Menu`, `SubMenu`), KeywordReserved, nil}, + {Words(`\b`, `\b`, `Abort`, `AddFIFOData`, `AddFIFOVectData`, `AddMovieAudio`, `AddMovieFrame`, `AddWavesToBoxPlot`, `AddWavesToViolinPlot`, `AdoptFiles`, `APMath`, `Append`, `AppendBoxPlot`, `AppendImage`, `AppendLayoutObject`, `AppendMatrixContour`, `AppendText`, `AppendToGizmo`, `AppendToGraph`, `AppendToLayout`, `AppendToTable`, `AppendViolinPlot`, `AppendXYZContour`, `AutoPositionWindow`, `AxonTelegraphFindServers`, `BackgroundInfo`, `Beep`, `BoundingBall`, `BoxSmooth`, `BrowseURL`, `BuildMenu`, `Button`, `cd`, `Chart`, `CheckBox`, `CheckDisplayed`, `ChooseColor`, `Close`, `CloseHelp`, `CloseMovie`, `CloseProc`, `ColorScale`, `ColorTab2Wave`, `Concatenate`, `ControlBar`, `ControlInfo`, `ControlUpdate`, `ConvertGlobalStringTextEncoding`, `ConvexHull`, `Convolve`, `CopyDimLabels`, `CopyFile`, `CopyFolder`, `CopyScales`, `Correlate`, `CreateAliasShortcut`, `CreateBrowser`, `Cross`, `CtrlBackground`, `CtrlFIFO`, `CtrlNamedBackground`, `Cursor`, `CurveFit`, `CustomControl`, `CWT`, `DAQmx_AI_SetupReader`, `DAQmx_AO_SetOutputs`, `DAQmx_CTR_CountEdges`, `DAQmx_CTR_OutputPulse`, `DAQmx_CTR_Period`, `DAQmx_CTR_PulseWidth`, `DAQmx_DIO_Config`, `DAQmx_DIO_WriteNewData`, `DAQmx_Scan`, `DAQmx_WaveformGen`, `Debugger`, `DebuggerOptions`, `DefaultFont`, `DefaultGuiControls`, `DefaultGuiFont`, `DefaultTextEncoding`, `DefineGuide`, `DelayUpdate`, `DeleteAnnotations`, `DeleteFile`, `DeleteFolder`, `DeletePoints`, `Differentiate`, `dir`, `Display`, `DisplayHelpTopic`, `DisplayProcedure`, `DoAlert`, `DoIgorMenu`, `DoUpdate`, `DoWindow`, `DoXOPIdle`, `DPSS`, `DrawAction`, `DrawArc`, `DrawBezier`, `DrawLine`, `DrawOval`, `DrawPICT`, `DrawPoly`, `DrawRect`, `DrawRRect`, `DrawText`, `DrawUserShape`, `DSPDetrend`, `DSPPeriodogram`, `Duplicate`, `DuplicateDataFolder`, `DWT`, `EdgeStats`, `Edit`, `ErrorBars`, `EstimatePeakSizes`, `Execute`, `ExecuteScriptText`, `ExperimentInfo`, `ExperimentModified`, `ExportGizmo`, `Extract`, `FastGaussTransform`, `FastOp`, `FBinRead`, `FBinWrite`, `FFT`, `FGetPos`, `FIFOStatus`, `FIFO2Wave`, `FilterFIR`, `FilterIIR`, `FindAPeak`, `FindContour`, `FindDuplicates`, `FindLevel`, `FindLevels`, `FindPeak`, `FindPointsInPoly`, `FindRoots`, `FindSequence`, `FindValue`, `FMaxFlat`, `FPClustering`, `fprintf`, `FReadLine`, `FSetPos`, `FStatus`, `FTPCreateDirectory`, `FTPDelete`, `FTPDownload`, `FTPUpload`, `FuncFit`, `FuncFitMD`, `GBLoadWave`, `GetAxis`, `GetCamera`, `GetFileFolderInfo`, `GetGizmo`, `GetLastUserMenuInfo`, `GetMarquee`, `GetMouse`, `GetSelection`, `GetWindow`, `GISCreateVectorLayer`, `GISGetRasterInfo`, `GISGetRegisteredFileInfo`, `GISGetVectorLayerInfo`, `GISLoadRasterData`, `GISLoadVectorData`, `GISRasterizeVectorData`, `GISRegisterFile`, `GISTransformCoords`, `GISUnRegisterFile`, `GISWriteFieldData`, `GISWriteGeometryData`, `GISWriteRaster`, `GPIBReadBinaryWave2`, `GPIBReadBinary2`, `GPIBReadWave2`, `GPIBRead2`, `GPIBWriteBinaryWave2`, `GPIBWriteBinary2`, `GPIBWriteWave2`, `GPIBWrite2`, `GPIB2`, `GraphNormal`, `GraphWaveDraw`, `GraphWaveEdit`, `Grep`, `GroupBox`, `Hanning`, `HDFInfo`, `HDFReadImage`, `HDFReadSDS`, `HDFReadVset`, `HDF5CloseFile`, `HDF5CloseGroup`, `HDF5ConvertColors`, `HDF5CreateFile`, `HDF5CreateGroup`, `HDF5CreateLink`, `HDF5Dump`, `HDF5DumpErrors`, `HDF5DumpState`, `HDF5FlushFile`, `HDF5ListAttributes`, `HDF5ListGroup`, `HDF5LoadData`, `HDF5LoadGroup`, `HDF5LoadImage`, `HDF5OpenFile`, `HDF5OpenGroup`, `HDF5SaveData`, `HDF5SaveGroup`, `HDF5SaveImage`, `HDF5TestOperation`, `HDF5UnlinkObject`, `HideIgorMenus`, `HideInfo`, `HideProcedures`, `HideTools`, `HilbertTransform`, `Histogram`, `ICA`, `IFFT`, `ImageAnalyzeParticles`, `ImageBlend`, `ImageBoundaryToMask`, `ImageComposite`, `ImageEdgeDetection`, `ImageFileInfo`, `ImageFilter`, `ImageFocus`, `ImageFromXYZ`, `ImageGenerateROIMask`, `ImageGLCM`, `ImageHistModification`, `ImageHistogram`, `ImageInterpolate`, `ImageLineProfile`, `ImageLoad`, `ImageMorphology`, `ImageRegistration`, `ImageRemoveBackground`, `ImageRestore`, `ImageRotate`, `ImageSave`, `ImageSeedFill`, `ImageSkeleton3d`, `ImageSnake`, `ImageStats`, `ImageThreshold`, `ImageTransform`, `ImageUnwrapPhase`, `ImageWindow`, `IndexSort`, `InsertPoints`, `Integrate`, `IntegrateODE`, `Integrate2D`, `Interpolate2`, `Interpolate3D`, `Interp3DPath`, `ITCCloseAll2`, `ITCCloseDevice2`, `ITCConfigAllChannels2`, `ITCConfigChannelReset2`, `ITCConfigChannelUpload2`, `ITCConfigChannel2`, `ITCFIFOAvailableAll2`, `ITCFIFOAvailable2`, `ITCGetAllChannelsConfig2`, `ITCGetChannelConfig2`, `ITCGetCurrentDevice2`, `ITCGetDeviceInfo2`, `ITCGetDevices2`, `ITCGetErrorString2`, `ITCGetSerialNumber2`, `ITCGetState2`, `ITCGetVersions2`, `ITCInitialize2`, `ITCOpenDevice2`, `ITCReadADC2`, `ITCReadDigital2`, `ITCReadTimer2`, `ITCSelectDevice2`, `ITCSetDAC2`, `ITCSetGlobals2`, `ITCSetModes2`, `ITCSetState2`, `ITCStartAcq2`, `ITCStopAcq2`, `ITCUpdateFIFOPositionAll2`, `ITCUpdateFIFOPosition2`, `ITCWriteDigital2`, `JCAMPLoadWave`, `JointHistogram`, `KillBackground`, `KillControl`, `KillDataFolder`, `KillFIFO`, `KillFreeAxis`, `KillPath`, `KillPICTs`, `KillStrings`, `KillVariables`, `KillWaves`, `KillWindow`, `KMeans`, `Label`, `Layout`, `LayoutPageAction`, `LayoutSlideShow`, `Legend`, `LinearFeedbackShiftRegister`, `ListBox`, `LoadData`, `LoadPackagePreferences`, `LoadPICT`, `LoadWave`, `Loess`, `LombPeriodogram`, `Make`, `MakeIndex`, `MarkPerfTestTime`, `MatrixConvolve`, `MatrixCorr`, `MatrixEigenV`, `MatrixFilter`, `MatrixGaussJ`, `MatrixGLM`, `MatrixInverse`, `MatrixLinearSolve`, `MatrixLinearSolveTD`, `MatrixLLS`, `MatrixLUBkSub`, `MatrixLUD`, `MatrixLUDTD`, `MatrixMultiply`, `MatrixOP`, `MatrixSchur`, `MatrixSolve`, `MatrixSVBkSub`, `MatrixSVD`, `MatrixTranspose`, `MCC_FindServers`, `MeasureStyledText`, `MFR_CheckForNewBricklets`, `MFR_CloseResultFile`, `MFR_CreateOverviewTable`, `MFR_GetBrickletCount`, `MFR_GetBrickletData`, `MFR_GetBrickletDeployData`, `MFR_GetBrickletMetaData`, `MFR_GetBrickletRawData`, `MFR_GetReportTemplate`, `MFR_GetResultFileMetaData`, `MFR_GetResultFileName`, `MFR_GetVernissageVersion`, `MFR_GetVersion`, `MFR_GetXOPErrorMessage`, `MFR_OpenResultFile`, `MLLoadWave`, `Modify`, `ModifyBoxPlot`, `ModifyBrowser`, `ModifyCamera`, `ModifyContour`, `ModifyControl`, `ModifyControlList`, `ModifyFreeAxis`, `ModifyGizmo`, `ModifyGraph`, `ModifyImage`, `ModifyLayout`, `ModifyPanel`, `ModifyTable`, `ModifyViolinPlot`, `ModifyWaterfall`, `MoveDataFolder`, `MoveFile`, `MoveFolder`, `MoveString`, `MoveSubwindow`, `MoveVariable`, `MoveWave`, `MoveWindow`, `MultiTaperPSD`, `MultiThreadingControl`, `NC_CloseFile`, `NC_DumpErrors`, `NC_Inquire`, `NC_ListAttributes`, `NC_ListObjects`, `NC_LoadData`, `NC_OpenFile`, `NeuralNetworkRun`, `NeuralNetworkTrain`, `NewCamera`, `NewDataFolder`, `NewFIFO`, `NewFIFOChan`, `NewFreeAxis`, `NewGizmo`, `NewImage`, `NewLayout`, `NewMovie`, `NewNotebook`, `NewPanel`, `NewPath`, `NewWaterfall`, `NILoadWave`, `NI4882`, `Note`, `Notebook`, `NotebookAction`, `Open`, `OpenHelp`, `OpenNotebook`, `Optimize`, `ParseOperationTemplate`, `PathInfo`, `PauseForUser`, `PauseUpdate`, `PCA`, `PlayMovie`, `PlayMovieAction`, `PlaySound`, `PopupContextualMenu`, `PopupMenu`, `Preferences`, `PrimeFactors`, `Print`, `printf`, `PrintGraphs`, `PrintLayout`, `PrintNotebook`, `PrintSettings`, `PrintTable`, `Project`, `PulseStats`, `PutScrapText`, `pwd`, `Quit`, `RatioFromNumber`, `Redimension`, `Remez`, `Remove`, `RemoveContour`, `RemoveFromGizmo`, `RemoveFromGraph`, `RemoveFromLayout`, `RemoveFromTable`, `RemoveImage`, `RemoveLayoutObjects`, `RemovePath`, `Rename`, `RenameDataFolder`, `RenamePath`, `RenamePICT`, `RenameWindow`, `ReorderImages`, `ReorderTraces`, `ReplaceText`, `ReplaceWave`, `Resample`, `ResumeUpdate`, `Reverse`, `Rotate`, `Save`, `SaveData`, `SaveExperiment`, `SaveGizmoCopy`, `SaveGraphCopy`, `SaveNotebook`, `SavePackagePreferences`, `SavePICT`, `SaveTableCopy`, `SetActiveSubwindow`, `SetAxis`, `SetBackground`, `SetDashPattern`, `SetDataFolder`, `SetDimLabel`, `SetDrawEnv`, `SetDrawLayer`, `SetFileFolderInfo`, `SetFormula`, `SetIdlePeriod`, `SetIgorHook`, `SetIgorMenuMode`, `SetIgorOption`, `SetMarquee`, `SetProcessSleep`, `SetRandomSeed`, `SetScale`, `SetVariable`, `SetWaveLock`, `SetWaveTextEncoding`, `SetWindow`, `ShowIgorMenus`, `ShowInfo`, `ShowTools`, `Silent`, `Sleep`, `Slider`, `Smooth`, `SmoothCustom`, `Sort`, `SortColumns`, `SoundInRecord`, `SoundInSet`, `SoundInStartChart`, `SoundInStatus`, `SoundInStopChart`, `SoundLoadWave`, `SoundSaveWave`, `SphericalInterpolate`, `SphericalTriangulate`, `SplitString`, `SplitWave`, `sprintf`, `SQLHighLevelOp`, `sscanf`, `Stack`, `StackWindows`, `StatsAngularDistanceTest`, `StatsANOVA1Test`, `StatsANOVA2NRTest`, `StatsANOVA2RMTest`, `StatsANOVA2Test`, `StatsChiTest`, `StatsCircularCorrelationTest`, `StatsCircularMeans`, `StatsCircularMoments`, `StatsCircularTwoSampleTest`, `StatsCochranTest`, `StatsContingencyTable`, `StatsDIPTest`, `StatsDunnettTest`, `StatsFriedmanTest`, `StatsFTest`, `StatsHodgesAjneTest`, `StatsJBTest`, `StatsKDE`, `StatsKendallTauTest`, `StatsKSTest`, `StatsKWTest`, `StatsLinearCorrelationTest`, `StatsLinearRegression`, `StatsMultiCorrelationTest`, `StatsNPMCTest`, `StatsNPNominalSRTest`, `StatsQuantiles`, `StatsRankCorrelationTest`, `StatsResample`, `StatsSample`, `StatsScheffeTest`, `StatsShapiroWilkTest`, `StatsSignTest`, `StatsSRTest`, `StatsTTest`, `StatsTukeyTest`, `StatsVariancesTest`, `StatsWatsonUSquaredTest`, `StatsWatsonWilliamsTest`, `StatsWheelerWatsonTest`, `StatsWilcoxonRankTest`, `StatsWRCorrelationTest`, `STFT`, `String`, `StructFill`, `StructGet`, `StructPut`, `SumDimension`, `SumSeries`, `TabControl`, `Tag`, `TDMLoadData`, `TDMSaveData`, `TextBox`, `ThreadGroupPutDF`, `ThreadStart`, `TickWavesFromAxis`, `Tile`, `TileWindows`, `TitleBox`, `ToCommandLine`, `ToolsGrid`, `Triangulate3d`, `Unwrap`, `URLRequest`, `ValDisplay`, `Variable`, `VDTClosePort2`, `VDTGetPortList2`, `VDTGetStatus2`, `VDTOpenPort2`, `VDTOperationsPort2`, `VDTReadBinaryWave2`, `VDTReadBinary2`, `VDTReadHexWave2`, `VDTReadHex2`, `VDTReadWave2`, `VDTRead2`, `VDTTerminalPort2`, `VDTWriteBinaryWave2`, `VDTWriteBinary2`, `VDTWriteHexWave2`, `VDTWriteHex2`, `VDTWriteWave2`, `VDTWrite2`, `VDT2`, `VISAControl`, `VISARead`, `VISAReadBinary`, `VISAReadBinaryWave`, `VISAReadWave`, `VISAWrite`, `VISAWriteBinary`, `VISAWriteBinaryWave`, `VISAWriteWave`, `WaveMeanStdv`, `WaveStats`, `WaveTransform`, `wfprintf`, `WignerTransform`, `WindowFunction`, `XLLoadWave`), NameClass, nil}, + {Words(`\b`, `\b`, `abs`, `acos`, `acosh`, `AddListItem`, `AiryA`, `AiryAD`, `AiryB`, `AiryBD`, `alog`, `AnnotationInfo`, `AnnotationList`, `area`, `areaXY`, `asin`, `asinh`, `atan`, `atanh`, `atan2`, `AxisInfo`, `AxisList`, `AxisValFromPixel`, `AxonTelegraphAGetDataNum`, `AxonTelegraphAGetDataString`, `AxonTelegraphAGetDataStruct`, `AxonTelegraphGetDataNum`, `AxonTelegraphGetDataString`, `AxonTelegraphGetDataStruct`, `AxonTelegraphGetTimeoutMs`, `AxonTelegraphSetTimeoutMs`, `Base64Decode`, `Base64Encode`, `Besseli`, `Besselj`, `Besselk`, `Bessely`, `beta`, `betai`, `BinarySearch`, `BinarySearchInterp`, `binomial`, `binomialln`, `binomialNoise`, `cabs`, `CaptureHistory`, `CaptureHistoryStart`, `ceil`, `cequal`, `char2num`, `chebyshev`, `chebyshevU`, `CheckName`, `ChildWindowList`, `CleanupName`, `cmplx`, `cmpstr`, `conj`, `ContourInfo`, `ContourNameList`, `ContourNameToWaveRef`, `ContourZ`, `ControlNameList`, `ConvertTextEncoding`, `cos`, `cosh`, `cosIntegral`, `cot`, `coth`, `CountObjects`, `CountObjectsDFR`, `cpowi`, `CreationDate`, `csc`, `csch`, `CsrInfo`, `CsrWave`, `CsrWaveRef`, `CsrXWave`, `CsrXWaveRef`, `CTabList`, `DataFolderDir`, `DataFolderExists`, `DataFolderRefsEqual`, `DataFolderRefStatus`, `date`, `datetime`, `DateToJulian`, `date2secs`, `Dawson`, `defined`, `deltax`, `digamma`, `dilogarithm`, `DimDelta`, `DimOffset`, `DimSize`, `ei`, `enoise`, `equalWaves`, `erf`, `erfc`, `erfcw`, `exists`, `exp`, `expInt`, `expIntegralE1`, `expNoise`, `factorial`, `Faddeeva`, `fakedata`, `faverage`, `faverageXY`, `fDAQmx_AI_GetReader`, `fDAQmx_AO_UpdateOutputs`, `fDAQmx_ConnectTerminals`, `fDAQmx_CTR_Finished`, `fDAQmx_CTR_IsFinished`, `fDAQmx_CTR_IsPulseFinished`, `fDAQmx_CTR_ReadCounter`, `fDAQmx_CTR_ReadWithOptions`, `fDAQmx_CTR_SetPulseFrequency`, `fDAQmx_CTR_Start`, `fDAQmx_DeviceNames`, `fDAQmx_DIO_Finished`, `fDAQmx_DIO_PortWidth`, `fDAQmx_DIO_Read`, `fDAQmx_DIO_Write`, `fDAQmx_DisconnectTerminals`, `fDAQmx_ErrorString`, `fDAQmx_ExternalCalDate`, `fDAQmx_NumAnalogInputs`, `fDAQmx_NumAnalogOutputs`, `fDAQmx_NumCounters`, `fDAQmx_NumDIOPorts`, `fDAQmx_ReadChan`, `fDAQmx_ReadNamedChan`, `fDAQmx_ResetDevice`, `fDAQmx_ScanGetAvailable`, `fDAQmx_ScanGetNextIndex`, `fDAQmx_ScanStart`, `fDAQmx_ScanStop`, `fDAQmx_ScanWait`, `fDAQmx_ScanWaitWithTimeout`, `fDAQmx_SelfCalDate`, `fDAQmx_SelfCalibration`, `fDAQmx_WaveformStart`, `fDAQmx_WaveformStop`, `fDAQmx_WF_IsFinished`, `fDAQmx_WF_WaitUntilFinished`, `fDAQmx_WriteChan`, `FetchURL`, `FindDimLabel`, `FindListItem`, `floor`, `FontList`, `FontSizeHeight`, `FontSizeStringWidth`, `FresnelCos`, `FresnelSin`, `FuncRefInfo`, `FunctionInfo`, `FunctionList`, `FunctionPath`, `gamma`, `gammaEuler`, `gammaInc`, `gammaNoise`, `gammln`, `gammp`, `gammq`, `Gauss`, `Gauss1D`, `Gauss2D`, `gcd`, `GetBrowserLine`, `GetBrowserSelection`, `GetDataFolder`, `GetDataFolderDFR`, `GetDefaultFont`, `GetDefaultFontSize`, `GetDefaultFontStyle`, `GetDimLabel`, `GetEnvironmentVariable`, `GetErrMessage`, `GetFormula`, `GetIndependentModuleName`, `GetIndexedObjName`, `GetIndexedObjNameDFR`, `GetKeyState`, `GetRTErrMessage`, `GetRTError`, `GetRTLocation`, `GetRTLocInfo`, `GetRTStackInfo`, `GetScrapText`, `GetUserData`, `GetWavesDataFolder`, `GetWavesDataFolderDFR`, `GISGetAllFileFormats`, `GISSRefsAreEqual`, `GizmoInfo`, `GizmoScale`, `gnoise`, `GrepList`, `GrepString`, `GuideInfo`, `GuideNameList`, `Hash`, `hcsr`, `HDF5AttributeInfo`, `HDF5DatasetInfo`, `HDF5LibraryInfo`, `HDF5TypeInfo`, `hermite`, `hermiteGauss`, `HyperGNoise`, `HyperGPFQ`, `HyperG0F1`, `HyperG1F1`, `HyperG2F1`, `IgorInfo`, `IgorVersion`, `imag`, `ImageInfo`, `ImageNameList`, `ImageNameToWaveRef`, `IndependentModuleList`, `IndexedDir`, `IndexedFile`, `IndexToScale`, `Inf`, `Integrate1D`, `interp`, `Interp2D`, `Interp3D`, `inverseERF`, `inverseERFC`, `ItemsInList`, `JacobiCn`, `JacobiSn`, `JulianToDate`, `Laguerre`, `LaguerreA`, `LaguerreGauss`, `LambertW`, `LayoutInfo`, `leftx`, `LegendreA`, `limit`, `ListMatch`, `ListToTextWave`, `ListToWaveRefWave`, `ln`, `log`, `logNormalNoise`, `lorentzianNoise`, `LowerStr`, `MacroList`, `magsqr`, `MandelbrotPoint`, `MarcumQ`, `MatrixCondition`, `MatrixDet`, `MatrixDot`, `MatrixRank`, `MatrixTrace`, `max`, `MCC_AutoBridgeBal`, `MCC_AutoFastComp`, `MCC_AutoPipetteOffset`, `MCC_AutoSlowComp`, `MCC_AutoWholeCellComp`, `MCC_GetBridgeBalEnable`, `MCC_GetBridgeBalResist`, `MCC_GetFastCompCap`, `MCC_GetFastCompTau`, `MCC_GetHolding`, `MCC_GetHoldingEnable`, `MCC_GetMode`, `MCC_GetNeutralizationCap`, `MCC_GetNeutralizationEnable`, `MCC_GetOscKillerEnable`, `MCC_GetPipetteOffset`, `MCC_GetPrimarySignalGain`, `MCC_GetPrimarySignalHPF`, `MCC_GetPrimarySignalLPF`, `MCC_GetRsCompBandwidth`, `MCC_GetRsCompCorrection`, `MCC_GetRsCompEnable`, `MCC_GetRsCompPrediction`, `MCC_GetSecondarySignalGain`, `MCC_GetSecondarySignalLPF`, `MCC_GetSlowCompCap`, `MCC_GetSlowCompTau`, `MCC_GetSlowCompTauX20Enable`, `MCC_GetSlowCurrentInjEnable`, `MCC_GetSlowCurrentInjLevel`, `MCC_GetSlowCurrentInjSetlTime`, `MCC_GetWholeCellCompCap`, `MCC_GetWholeCellCompEnable`, `MCC_GetWholeCellCompResist`, `MCC_SelectMultiClamp700B`, `MCC_SetBridgeBalEnable`, `MCC_SetBridgeBalResist`, `MCC_SetFastCompCap`, `MCC_SetFastCompTau`, `MCC_SetHolding`, `MCC_SetHoldingEnable`, `MCC_SetMode`, `MCC_SetNeutralizationCap`, `MCC_SetNeutralizationEnable`, `MCC_SetOscKillerEnable`, `MCC_SetPipetteOffset`, `MCC_SetPrimarySignalGain`, `MCC_SetPrimarySignalHPF`, `MCC_SetPrimarySignalLPF`, `MCC_SetRsCompBandwidth`, `MCC_SetRsCompCorrection`, `MCC_SetRsCompEnable`, `MCC_SetRsCompPrediction`, `MCC_SetSecondarySignalGain`, `MCC_SetSecondarySignalLPF`, `MCC_SetSlowCompCap`, `MCC_SetSlowCompTau`, `MCC_SetSlowCompTauX20Enable`, `MCC_SetSlowCurrentInjEnable`, `MCC_SetSlowCurrentInjLevel`, `MCC_SetSlowCurrentInjSetlTime`, `MCC_SetTimeoutMs`, `MCC_SetWholeCellCompCap`, `MCC_SetWholeCellCompEnable`, `MCC_SetWholeCellCompResist`, `mean`, `median`, `min`, `mod`, `ModDate`, `MPFXEMGPeak`, `MPFXExpConvExpPeak`, `MPFXGaussPeak`, `MPFXLorenzianPeak`, `MPFXVoigtPeak`, `NameOfWave`, `NaN`, `NewFreeDataFolder`, `NewFreeWave`, `norm`, `NormalizeUnicode`, `note`, `NumberByKey`, `numpnts`, `numtype`, `NumVarOrDefault`, `num2char`, `num2istr`, `num2str`, `NVAR_Exists`, `OperationList`, `PadString`, `PanelResolution`, `ParamIsDefault`, `ParseFilePath`, `PathList`, `pcsr`, `Pi`, `PICTInfo`, `PICTList`, `PixelFromAxisVal`, `pnt2x`, `poissonNoise`, `poly`, `PolygonArea`, `poly2D`, `PossiblyQuoteName`, `ProcedureText`, `p2rect`, `qcsr`, `real`, `RemoveByKey`, `RemoveEnding`, `RemoveFromList`, `RemoveListItem`, `ReplaceNumberByKey`, `ReplaceString`, `ReplaceStringByKey`, `rightx`, `round`, `r2polar`, `sawtooth`, `scaleToIndex`, `ScreenResolution`, `sec`, `sech`, `Secs2Date`, `Secs2Time`, `SelectNumber`, `SelectString`, `SetEnvironmentVariable`, `sign`, `sin`, `sinc`, `sinh`, `sinIntegral`, `SortList`, `SpecialCharacterInfo`, `SpecialCharacterList`, `SpecialDirPath`, `SphericalBessJ`, `SphericalBessJD`, `SphericalBessY`, `SphericalBessYD`, `SphericalHarmonics`, `SQLAllocHandle`, `SQLAllocStmt`, `SQLBinaryWavesToTextWave`, `SQLBindCol`, `SQLBindParameter`, `SQLBrowseConnect`, `SQLBulkOperations`, `SQLCancel`, `SQLCloseCursor`, `SQLColAttributeNum`, `SQLColAttributeStr`, `SQLColumnPrivileges`, `SQLColumns`, `SQLConnect`, `SQLDataSources`, `SQLDescribeCol`, `SQLDescribeParam`, `SQLDisconnect`, `SQLDriverConnect`, `SQLDrivers`, `SQLEndTran`, `SQLError`, `SQLExecDirect`, `SQLExecute`, `SQLFetch`, `SQLFetchScroll`, `SQLForeignKeys`, `SQLFreeConnect`, `SQLFreeEnv`, `SQLFreeHandle`, `SQLFreeStmt`, `SQLGetConnectAttrNum`, `SQLGetConnectAttrStr`, `SQLGetCursorName`, `SQLGetDataNum`, `SQLGetDataStr`, `SQLGetDescFieldNum`, `SQLGetDescFieldStr`, `SQLGetDescRec`, `SQLGetDiagFieldNum`, `SQLGetDiagFieldStr`, `SQLGetDiagRec`, `SQLGetEnvAttrNum`, `SQLGetEnvAttrStr`, `SQLGetFunctions`, `SQLGetInfoNum`, `SQLGetInfoStr`, `SQLGetStmtAttrNum`, `SQLGetStmtAttrStr`, `SQLGetTypeInfo`, `SQLMoreResults`, `SQLNativeSql`, `SQLNumParams`, `SQLNumResultCols`, `SQLNumResultRowsIfKnown`, `SQLNumRowsFetched`, `SQLParamData`, `SQLPrepare`, `SQLPrimaryKeys`, `SQLProcedureColumns`, `SQLProcedures`, `SQLPutData`, `SQLReinitialize`, `SQLRowCount`, `SQLSetConnectAttrNum`, `SQLSetConnectAttrStr`, `SQLSetCursorName`, `SQLSetDescFieldNum`, `SQLSetDescFieldStr`, `SQLSetDescRec`, `SQLSetEnvAttrNum`, `SQLSetEnvAttrStr`, `SQLSetPos`, `SQLSetStmtAttrNum`, `SQLSetStmtAttrStr`, `SQLSpecialColumns`, `SQLStatistics`, `SQLTablePrivileges`, `SQLTables`, `SQLTextWaveToBinaryWaves`, `SQLTextWaveTo2DBinaryWave`, `SQLUpdateBoundValues`, `SQLXOPCheckState`, `SQL2DBinaryWaveToTextWave`, `sqrt`, `StartMSTimer`, `StatsBetaCDF`, `StatsBetaPDF`, `StatsBinomialCDF`, `StatsBinomialPDF`, `StatsCauchyCDF`, `StatsCauchyPDF`, `StatsChiCDF`, `StatsChiPDF`, `StatsCMSSDCDF`, `StatsCorrelation`, `StatsDExpCDF`, `StatsDExpPDF`, `StatsErlangCDF`, `StatsErlangPDF`, `StatsErrorPDF`, `StatsEValueCDF`, `StatsEValuePDF`, `StatsExpCDF`, `StatsExpPDF`, `StatsFCDF`, `StatsFPDF`, `StatsFriedmanCDF`, `StatsGammaCDF`, `StatsGammaPDF`, `StatsGeometricCDF`, `StatsGeometricPDF`, `StatsGEVCDF`, `StatsGEVPDF`, `StatsHyperGCDF`, `StatsHyperGPDF`, `StatsInvBetaCDF`, `StatsInvBinomialCDF`, `StatsInvCauchyCDF`, `StatsInvChiCDF`, `StatsInvCMSSDCDF`, `StatsInvDExpCDF`, `StatsInvEValueCDF`, `StatsInvExpCDF`, `StatsInvFCDF`, `StatsInvFriedmanCDF`, `StatsInvGammaCDF`, `StatsInvGeometricCDF`, `StatsInvKuiperCDF`, `StatsInvLogisticCDF`, `StatsInvLogNormalCDF`, `StatsInvMaxwellCDF`, `StatsInvMooreCDF`, `StatsInvNBinomialCDF`, `StatsInvNCChiCDF`, `StatsInvNCFCDF`, `StatsInvNormalCDF`, `StatsInvParetoCDF`, `StatsInvPoissonCDF`, `StatsInvPowerCDF`, `StatsInvQCDF`, `StatsInvQpCDF`, `StatsInvRayleighCDF`, `StatsInvRectangularCDF`, `StatsInvSpearmanCDF`, `StatsInvStudentCDF`, `StatsInvTopDownCDF`, `StatsInvTriangularCDF`, `StatsInvUsquaredCDF`, `StatsInvVonMisesCDF`, `StatsInvWeibullCDF`, `StatsKuiperCDF`, `StatsLogisticCDF`, `StatsLogisticPDF`, `StatsLogNormalCDF`, `StatsLogNormalPDF`, `StatsMaxwellCDF`, `StatsMaxwellPDF`, `StatsMedian`, `StatsMooreCDF`, `StatsNBinomialCDF`, `StatsNBinomialPDF`, `StatsNCChiCDF`, `StatsNCChiPDF`, `StatsNCFCDF`, `StatsNCFPDF`, `StatsNCTCDF`, `StatsNCTPDF`, `StatsNormalCDF`, `StatsNormalPDF`, `StatsParetoCDF`, `StatsParetoPDF`, `StatsPermute`, `StatsPoissonCDF`, `StatsPoissonPDF`, `StatsPowerCDF`, `StatsPowerNoise`, `StatsPowerPDF`, `StatsQCDF`, `StatsQpCDF`, `StatsRayleighCDF`, `StatsRayleighPDF`, `StatsRectangularCDF`, `StatsRectangularPDF`, `StatsRunsCDF`, `StatsSpearmanRhoCDF`, `StatsStudentCDF`, `StatsStudentPDF`, `StatsTopDownCDF`, `StatsTriangularCDF`, `StatsTriangularPDF`, `StatsTrimmedMean`, `StatsUSquaredCDF`, `StatsVonMisesCDF`, `StatsVonMisesNoise`, `StatsVonMisesPDF`, `StatsWaldCDF`, `StatsWaldPDF`, `StatsWeibullCDF`, `StatsWeibullPDF`, `StopMSTimer`, `StringByKey`, `stringCRC`, `StringFromList`, `StringList`, `stringmatch`, `strlen`, `strsearch`, `StrVarOrDefault`, `str2num`, `StudentA`, `StudentT`, `sum`, `SVAR_Exists`, `TableInfo`, `TagVal`, `TagWaveRef`, `tan`, `tango_close_device`, `tango_command_inout`, `tango_compute_image_proj`, `tango_get_dev_attr_list`, `tango_get_dev_black_box`, `tango_get_dev_cmd_list`, `tango_get_dev_status`, `tango_get_dev_timeout`, `tango_get_error_stack`, `tango_open_device`, `tango_ping_device`, `tango_read_attribute`, `tango_read_attributes`, `tango_reload_dev_interface`, `tango_resume_attr_monitor`, `tango_set_attr_monitor_period`, `tango_set_dev_timeout`, `tango_start_attr_monitor`, `tango_stop_attr_monitor`, `tango_suspend_attr_monitor`, `tango_write_attribute`, `tango_write_attributes`, `tanh`, `TDMAddChannel`, `TDMAddGroup`, `TDMAppendDataValues`, `TDMAppendDataValuesTime`, `TDMChannelPropertyExists`, `TDMCloseChannel`, `TDMCloseFile`, `TDMCloseGroup`, `TDMCreateChannelProperty`, `TDMCreateFile`, `TDMCreateFileProperty`, `TDMCreateGroupProperty`, `TDMFilePropertyExists`, `TDMGetChannelPropertyNames`, `TDMGetChannelPropertyNum`, `TDMGetChannelPropertyStr`, `TDMGetChannelPropertyTime`, `TDMGetChannelPropertyType`, `TDMGetChannels`, `TDMGetChannelStringPropertyLen`, `TDMGetDataType`, `TDMGetDataValues`, `TDMGetDataValuesTime`, `TDMGetFilePropertyNames`, `TDMGetFilePropertyNum`, `TDMGetFilePropertyStr`, `TDMGetFilePropertyTime`, `TDMGetFilePropertyType`, `TDMGetFileStringPropertyLen`, `TDMGetGroupPropertyNames`, `TDMGetGroupPropertyNum`, `TDMGetGroupPropertyStr`, `TDMGetGroupPropertyTime`, `TDMGetGroupPropertyType`, `TDMGetGroups`, `TDMGetGroupStringPropertyLen`, `TDMGetLibraryErrorDescription`, `TDMGetNumChannelProperties`, `TDMGetNumChannels`, `TDMGetNumDataValues`, `TDMGetNumFileProperties`, `TDMGetNumGroupProperties`, `TDMGetNumGroups`, `TDMGroupPropertyExists`, `TDMOpenFile`, `TDMOpenFileEx`, `TDMRemoveChannel`, `TDMRemoveGroup`, `TDMReplaceDataValues`, `TDMReplaceDataValuesTime`, `TDMSaveFile`, `TDMSetChannelPropertyNum`, `TDMSetChannelPropertyStr`, `TDMSetChannelPropertyTime`, `TDMSetDataValues`, `TDMSetDataValuesTime`, `TDMSetFilePropertyNum`, `TDMSetFilePropertyStr`, `TDMSetFilePropertyTime`, `TDMSetGroupPropertyNum`, `TDMSetGroupPropertyStr`, `TDMSetGroupPropertyTime`, `TextEncodingCode`, `TextEncodingName`, `TextFile`, `ThreadGroupCreate`, `ThreadGroupGetDF`, `ThreadGroupGetDFR`, `ThreadGroupRelease`, `ThreadGroupWait`, `ThreadProcessorCount`, `ThreadReturnValue`, `ticks`, `time`, `TraceFromPixel`, `TraceInfo`, `TraceNameList`, `TraceNameToWaveRef`, `TrimString`, `trunc`, `UniqueName`, `UnPadString`, `UnsetEnvironmentVariable`, `UpperStr`, `URLDecode`, `URLEncode`, `VariableList`, `Variance`, `vcsr`, `viAssertIntrSignal`, `viAssertTrigger`, `viAssertUtilSignal`, `viClear`, `viClose`, `viDisableEvent`, `viDiscardEvents`, `viEnableEvent`, `viFindNext`, `viFindRsrc`, `viGetAttribute`, `viGetAttributeString`, `viGpibCommand`, `viGpibControlATN`, `viGpibControlREN`, `viGpibPassControl`, `viGpibSendIFC`, `viIn8`, `viIn16`, `viIn32`, `viLock`, `viMapAddress`, `viMapTrigger`, `viMemAlloc`, `viMemFree`, `viMoveIn8`, `viMoveIn16`, `viMoveIn32`, `viMoveOut8`, `viMoveOut16`, `viMoveOut32`, `viOpen`, `viOpenDefaultRM`, `viOut8`, `viOut16`, `viOut32`, `viPeek8`, `viPeek16`, `viPeek32`, `viPoke8`, `viPoke16`, `viPoke32`, `viRead`, `viReadSTB`, `viSetAttribute`, `viSetAttributeString`, `viStatusDesc`, `viTerminate`, `viUnlock`, `viUnmapAddress`, `viUnmapTrigger`, `viUsbControlIn`, `viUsbControlOut`, `viVxiCommandQuery`, `viWaitOnEvent`, `viWrite`, `VoigtFunc`, `VoigtPeak`, `WaveCRC`, `WaveDims`, `WaveExists`, `WaveHash`, `WaveInfo`, `WaveList`, `WaveMax`, `WaveMin`, `WaveName`, `WaveRefIndexed`, `WaveRefIndexedDFR`, `WaveRefsEqual`, `WaveRefWaveToList`, `WaveTextEncoding`, `WaveType`, `WaveUnits`, `WhichListItem`, `WinList`, `WinName`, `WinRecreation`, `WinType`, `wnoise`, `xcsr`, `XWaveName`, `XWaveRefFromTrace`, `x2pnt`, `zcsr`, `ZernikeR`, `zeromq_client_connect`, `zeromq_client_connect`, `zeromq_client_recv`, `zeromq_client_recv`, `zeromq_client_send`, `zeromq_client_send`, `zeromq_handler_start`, `zeromq_handler_start`, `zeromq_handler_stop`, `zeromq_handler_stop`, `zeromq_server_bind`, `zeromq_server_bind`, `zeromq_server_recv`, `zeromq_server_recv`, `zeromq_server_send`, `zeromq_server_send`, `zeromq_set`, `zeromq_set`, `zeromq_stop`, `zeromq_stop`, `zeromq_test_callfunction`, `zeromq_test_callfunction`, `zeromq_test_serializeWave`, `zeromq_test_serializeWave`, `zeta`), NameFunction, nil}, + {`^#(include|pragma|define|undef|ifdef|ifndef|if|elif|else|endif)`, NameDecorator, nil}, + {`[^a-z"/]+$`, Text, nil}, + {`.`, Text, nil}, + {`\n|\r`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/i/ini.go b/vendor/github.com/alecthomas/chroma/lexers/i/ini.go new file mode 100644 index 000000000..39b5edd2e --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/i/ini.go @@ -0,0 +1,25 @@ +package i + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Ini lexer. +var Ini = internal.Register(MustNewLexer( + &Config{ + Name: "INI", + Aliases: []string{"ini", "cfg", "dosini"}, + Filenames: []string{"*.ini", "*.cfg", "*.inf", ".gitconfig"}, + MimeTypes: []string{"text/x-ini", "text/inf"}, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`[;#].*`, CommentSingle, nil}, + {`\[.*?\]$`, Keyword, nil}, + {`(.*?)([ \t]*)(=)([ \t]*)(.*(?:\n[ \t].+)*)`, ByGroups(NameAttribute, Text, Operator, Text, LiteralString), nil}, + {`(.+?)$`, NameAttribute, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/i/io.go b/vendor/github.com/alecthomas/chroma/lexers/i/io.go new file mode 100644 index 000000000..840feeaae --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/i/io.go @@ -0,0 +1,40 @@ +package i + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Io lexer. +var Io = internal.Register(MustNewLexer( + &Config{ + Name: "Io", + Aliases: []string{"io"}, + Filenames: []string{"*.io"}, + MimeTypes: []string{"text/x-iosrc"}, + }, + Rules{ + "root": { + {`\n`, Text, nil}, + {`\s+`, Text, nil}, + {`//(.*?)\n`, CommentSingle, nil}, + {`#(.*?)\n`, CommentSingle, nil}, + {`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil}, + {`/\+`, CommentMultiline, Push("nestedcomment")}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`::=|:=|=|\(|\)|;|,|\*|-|\+|>|<|@|!|/|\||\^|\.|%|&|\[|\]|\{|\}`, Operator, nil}, + {`(clone|do|doFile|doString|method|for|if|else|elseif|then)\b`, Keyword, nil}, + {`(nil|false|true)\b`, NameConstant, nil}, + {`(Object|list|List|Map|args|Sequence|Coroutine|File)\b`, NameBuiltin, nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + {`(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`\d+`, LiteralNumberInteger, nil}, + }, + "nestedcomment": { + {`[^+/]+`, CommentMultiline, nil}, + {`/\+`, CommentMultiline, Push()}, + {`\+/`, CommentMultiline, Pop(1)}, + {`[+/]`, CommentMultiline, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/internal/api.go b/vendor/github.com/alecthomas/chroma/lexers/internal/api.go new file mode 100644 index 000000000..002997a56 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/internal/api.go @@ -0,0 +1,160 @@ +// Package internal contains common API functions and structures shared between lexer packages. +package internal + +import ( + "path/filepath" + "sort" + "strings" + + "github.com/danwakefield/fnmatch" + + "github.com/alecthomas/chroma" +) + +// Registry of Lexers. +var Registry = struct { + Lexers chroma.Lexers + byName map[string]chroma.Lexer + byAlias map[string]chroma.Lexer +}{ + byName: map[string]chroma.Lexer{}, + byAlias: map[string]chroma.Lexer{}, +} + +// Names of all lexers, optionally including aliases. +func Names(withAliases bool) []string { + out := []string{} + for _, lexer := range Registry.Lexers { + config := lexer.Config() + out = append(out, config.Name) + if withAliases { + out = append(out, config.Aliases...) + } + } + sort.Strings(out) + return out +} + +// Get a Lexer by name, alias or file extension. +func Get(name string) chroma.Lexer { + candidates := chroma.PrioritisedLexers{} + if lexer := Registry.byName[name]; lexer != nil { + candidates = append(candidates, lexer) + } + if lexer := Registry.byAlias[name]; lexer != nil { + candidates = append(candidates, lexer) + } + if lexer := Registry.byName[strings.ToLower(name)]; lexer != nil { + candidates = append(candidates, lexer) + } + if lexer := Registry.byAlias[strings.ToLower(name)]; lexer != nil { + candidates = append(candidates, lexer) + } + // Try file extension. + if lexer := Match("filename." + name); lexer != nil { + candidates = append(candidates, lexer) + } + // Try exact filename. + if lexer := Match(name); lexer != nil { + candidates = append(candidates, lexer) + } + if len(candidates) == 0 { + return nil + } + sort.Sort(candidates) + return candidates[0] +} + +// MatchMimeType attempts to find a lexer for the given MIME type. +func MatchMimeType(mimeType string) chroma.Lexer { + matched := chroma.PrioritisedLexers{} + for _, l := range Registry.Lexers { + for _, lmt := range l.Config().MimeTypes { + if mimeType == lmt { + matched = append(matched, l) + } + } + } + if len(matched) != 0 { + sort.Sort(matched) + return matched[0] + } + return nil +} + +// Match returns the first lexer matching filename. +func Match(filename string) chroma.Lexer { + filename = filepath.Base(filename) + matched := chroma.PrioritisedLexers{} + // First, try primary filename matches. + for _, lexer := range Registry.Lexers { + config := lexer.Config() + for _, glob := range config.Filenames { + if fnmatch.Match(glob, filename, 0) { + matched = append(matched, lexer) + } + } + } + if len(matched) > 0 { + sort.Sort(matched) + return matched[0] + } + matched = nil + // Next, try filename aliases. + for _, lexer := range Registry.Lexers { + config := lexer.Config() + for _, glob := range config.AliasFilenames { + if fnmatch.Match(glob, filename, 0) { + matched = append(matched, lexer) + } + } + } + if len(matched) > 0 { + sort.Sort(matched) + return matched[0] + } + return nil +} + +// Analyse text content and return the "best" lexer.. +func Analyse(text string) chroma.Lexer { + var picked chroma.Lexer + highest := float32(0.0) + for _, lexer := range Registry.Lexers { + if analyser, ok := lexer.(chroma.Analyser); ok { + weight := analyser.AnalyseText(text) + if weight > highest { + picked = lexer + highest = weight + } + } + } + return picked +} + +// Register a Lexer with the global registry. +func Register(lexer chroma.Lexer) chroma.Lexer { + config := lexer.Config() + Registry.byName[config.Name] = lexer + Registry.byName[strings.ToLower(config.Name)] = lexer + for _, alias := range config.Aliases { + Registry.byAlias[alias] = lexer + Registry.byAlias[strings.ToLower(alias)] = lexer + } + Registry.Lexers = append(Registry.Lexers, lexer) + return lexer +} + +// Used for the fallback lexer as well as the explicit plaintext lexer +var PlaintextRules = chroma.Rules{ + "root": []chroma.Rule{ + {`.+`, chroma.Text, nil}, + {`\n`, chroma.Text, nil}, + }, +} + +// Fallback lexer if no other is found. +var Fallback chroma.Lexer = chroma.MustNewLexer(&chroma.Config{ + Name: "fallback", + Filenames: []string{"*"}, +}, PlaintextRules) diff --git a/vendor/github.com/alecthomas/chroma/lexers/j/j.go b/vendor/github.com/alecthomas/chroma/lexers/j/j.go new file mode 100644 index 000000000..686e53b97 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/j/j.go @@ -0,0 +1,73 @@ +package j + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// J lexer. +var J = internal.Register(MustNewLexer( + &Config{ + Name: "J", + Aliases: []string{"j"}, + Filenames: []string{"*.ijs"}, + MimeTypes: []string{"text/x-j"}, + }, + Rules{ + "root": { + {`#!.*$`, CommentPreproc, nil}, + {`NB\..*`, CommentSingle, nil}, + {`\n+\s*Note`, CommentMultiline, Push("comment")}, + {`\s*Note.*`, CommentSingle, nil}, + {`\s+`, Text, nil}, + {`'`, LiteralString, Push("singlequote")}, + {`0\s+:\s*0|noun\s+define\s*$`, NameEntity, Push("nounDefinition")}, + {`(([1-4]|13)\s+:\s*0|(adverb|conjunction|dyad|monad|verb)\s+define)\b`, NameFunction, Push("explicitDefinition")}, + {Words(``, `\b[a-zA-Z]\w*\.`, `for_`, `goto_`, `label_`), NameLabel, nil}, + {Words(``, `\.`, `assert`, `break`, `case`, `catch`, `catchd`, `catcht`, `continue`, `do`, `else`, `elseif`, `end`, `fcase`, `for`, `if`, `return`, `select`, `throw`, `try`, `while`, `whilst`), NameLabel, nil}, + {`\b[a-zA-Z]\w*`, NameVariable, nil}, + {Words(``, ``, `ARGV`, `CR`, `CRLF`, `DEL`, `Debug`, `EAV`, `EMPTY`, `FF`, `JVERSION`, `LF`, `LF2`, `Note`, `TAB`, `alpha17`, `alpha27`, `apply`, `bind`, `boxopen`, `boxxopen`, `bx`, `clear`, `cutLF`, `cutopen`, `datatype`, `def`, `dfh`, `drop`, `each`, `echo`, `empty`, `erase`, `every`, `evtloop`, `exit`, `expand`, `fetch`, `file2url`, `fixdotdot`, `fliprgb`, `getargs`, `getenv`, `hfd`, `inv`, `inverse`, `iospath`, `isatty`, `isutf8`, `items`, `leaf`, `list`, `nameclass`, `namelist`, `names`, `nc`, `nl`, `on`, `pick`, `rows`, `script`, `scriptd`, `sign`, `sminfo`, `smoutput`, `sort`, `split`, `stderr`, `stdin`, `stdout`, `table`, `take`, `timespacex`, `timex`, `tmoutput`, `toCRLF`, `toHOST`, `toJ`, `tolower`, `toupper`, `type`, `ucp`, `ucpcount`, `usleep`, `utf8`, `uucp`), NameFunction, nil}, + {`=[.:]`, Operator, nil}, + {"[-=+*#$%@!~`^&\";:.,<>{}\\[\\]\\\\|/]", Operator, nil}, + {`[abCdDeEfHiIjLMoprtT]\.`, KeywordReserved, nil}, + {`[aDiLpqsStux]\:`, KeywordReserved, nil}, + {`(_[0-9])\:`, KeywordConstant, nil}, + {`\(`, Punctuation, Push("parentheses")}, + Include("numbers"), + }, + "comment": { + {`[^)]`, CommentMultiline, nil}, + {`^\)`, CommentMultiline, Pop(1)}, + {`[)]`, CommentMultiline, nil}, + }, + "explicitDefinition": { + {`\b[nmuvxy]\b`, NameDecorator, nil}, + Include("root"), + {`[^)]`, Name, nil}, + {`^\)`, NameLabel, Pop(1)}, + {`[)]`, Name, nil}, + }, + "numbers": { + {`\b_{1,2}\b`, LiteralNumber, nil}, + {`_?\d+(\.\d+)?(\s*[ejr]\s*)_?\d+(\.?=\d+)?`, LiteralNumber, nil}, + {`_?\d+\.(?=\d+)`, LiteralNumberFloat, nil}, + {`_?\d+x`, LiteralNumberIntegerLong, nil}, + {`_?\d+`, LiteralNumberInteger, nil}, + }, + "nounDefinition": { + {`[^)]`, LiteralString, nil}, + {`^\)`, NameLabel, Pop(1)}, + {`[)]`, LiteralString, nil}, + }, + "parentheses": { + {`\)`, Punctuation, Pop(1)}, + Include("explicitDefinition"), + Include("root"), + }, + "singlequote": { + {`[^']`, LiteralString, nil}, + {`''`, LiteralString, nil}, + {`'`, LiteralString, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/j/java.go b/vendor/github.com/alecthomas/chroma/lexers/j/java.go new file mode 100644 index 000000000..c6b9a762e --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/j/java.go @@ -0,0 +1,51 @@ +package j + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Java lexer. +var Java = internal.Register(MustNewLexer( + &Config{ + Name: "Java", + Aliases: []string{"java"}, + Filenames: []string{"*.java"}, + MimeTypes: []string{"text/x-java"}, + DotAll: true, + }, + Rules{ + "root": { + {`[^\S\n]+`, Text, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/\*.*?\*/`, CommentMultiline, nil}, + {`(assert|break|case|catch|continue|default|do|else|finally|for|if|goto|instanceof|new|return|switch|this|throw|try|while)\b`, Keyword, nil}, + {`((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)((?:[^\W\d]|\$)[\w$]*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil}, + {`@[^\W\d][\w.]*`, NameDecorator, nil}, + {`(abstract|const|enum|extends|final|implements|native|private|protected|public|static|strictfp|super|synchronized|throws|transient|volatile)\b`, KeywordDeclaration, nil}, + {`(boolean|byte|char|double|float|int|long|short|void)\b`, KeywordType, nil}, + {`(package)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")}, + {`(true|false|null)\b`, KeywordConstant, nil}, + {`(class|interface)(\s+)`, ByGroups(KeywordDeclaration, Text), Push("class")}, + {`(import(?:\s+static)?)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'`, LiteralStringChar, nil}, + {`(\.)((?:[^\W\d]|\$)[\w$]*)`, ByGroups(Operator, NameAttribute), nil}, + {`^\s*([^\W\d]|\$)[\w$]*:`, NameLabel, nil}, + {`([^\W\d]|\$)[\w$]*`, Name, nil}, + {`([0-9][0-9_]*\.([0-9][0-9_]*)?|\.[0-9][0-9_]*)([eE][+\-]?[0-9][0-9_]*)?[fFdD]?|[0-9][eE][+\-]?[0-9][0-9_]*[fFdD]?|[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFdD]|0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)[pP][+\-]?[0-9][0-9_]*[fFdD]?`, LiteralNumberFloat, nil}, + {`0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?`, LiteralNumberHex, nil}, + {`0[bB][01][01_]*[lL]?`, LiteralNumberBin, nil}, + {`0[0-7_]+[lL]?`, LiteralNumberOct, nil}, + {`0|[1-9][0-9_]*[lL]?`, LiteralNumberInteger, nil}, + {`[~^*!%&\[\](){}<>|+=:;,./?-]`, Operator, nil}, + {`\n`, Text, nil}, + }, + "class": { + {`([^\W\d]|\$)[\w$]*`, NameClass, Pop(1)}, + }, + "import": { + {`[\w.]+\*?`, NameNamespace, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/j/javascript.go b/vendor/github.com/alecthomas/chroma/lexers/j/javascript.go new file mode 100644 index 000000000..282501d06 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/j/javascript.go @@ -0,0 +1,73 @@ +package j + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Javascript lexer. +var JavascriptRules = Rules{ + "commentsandwhitespace": { + {`\s+`, Text, nil}, + {``, `||`, `&&`, `>`, `<`, `>=`, `≥`, `<=`, `≤`, `==`, `===`, `≡`, `!=`, `≠`, `!==`, `≢`, `.>`, `.<`, `.>=`, `.≥`, `.<=`, `.≤`, `.==`, `.!=`, `.≠`, `.=`, `.!`, `<:`, `>:`, `∈`, `∉`, `∋`, `∌`, `⊆`, `⊈`, `⊂`, `⊄`, `⊊`, `|>`, `<|`, `:`, `+`, `-`, `.+`, `.-`, `|`, `∪`, `$`, `<<`, `>>`, `>>>`, `.<<`, `.>>`, `.>>>`, `*`, `/`, `./`, `÷`, `.÷`, `%`, `⋅`, `.%`, `.*`, `\`, `.\`, `&`, `∩`, `//`, `.//`, `^`, `.^`, `::`, `.`, `+`, `-`, `!`, `√`, `∛`, `∜`), Operator, nil}, + {`'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'`, LiteralStringChar, nil}, + {`(?<=[.\w)\]])\'+`, Operator, nil}, + {`"""`, LiteralString, Push("tqstring")}, + {`"`, LiteralString, Push("string")}, + {`r"""`, LiteralStringRegex, Push("tqregex")}, + {`r"`, LiteralStringRegex, Push("regex")}, + {"`", LiteralStringBacktick, Push("command")}, + {`((?:[a-zA-Z_¡-￿]|[𐀀-􏿿])(?:[a-zA-Z_0-9¡-￿]|[𐀀-􏿿])*!*)(')?`, ByGroups(Name, Operator), nil}, + {`(@(?:[a-zA-Z_¡-￿]|[𐀀-􏿿])(?:[a-zA-Z_0-9¡-￿]|[𐀀-􏿿])*!*)(')?`, ByGroups(NameDecorator, Operator), nil}, + {`(\d+(_\d+)+\.\d*|\d*\.\d+(_\d+)+)([eEf][+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`\d+(_\d+)+[eEf][+-]?[0-9]+`, LiteralNumberFloat, nil}, + {`\d+[eEf][+-]?[0-9]+`, LiteralNumberFloat, nil}, + {`0b[01]+(_[01]+)+`, LiteralNumberBin, nil}, + {`0b[01]+`, LiteralNumberBin, nil}, + {`0o[0-7]+(_[0-7]+)+`, LiteralNumberOct, nil}, + {`0o[0-7]+`, LiteralNumberOct, nil}, + {`0x[a-fA-F0-9]+(_[a-fA-F0-9]+)+`, LiteralNumberHex, nil}, + {`0x[a-fA-F0-9]+`, LiteralNumberHex, nil}, + {`\d+(_\d+)+`, LiteralNumberInteger, nil}, + {`\d+`, LiteralNumberInteger, nil}, + }, + "blockcomment": { + {`[^=#]`, CommentMultiline, nil}, + {`#=`, CommentMultiline, Push()}, + {`=#`, CommentMultiline, Pop(1)}, + {`[=#]`, CommentMultiline, nil}, + }, + "string": { + {`"`, LiteralString, Pop(1)}, + {`\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)`, LiteralStringEscape, nil}, + {`\$(?:[a-zA-Z_¡-￿]|[𐀀-􏿿])(?:[a-zA-Z_0-9¡-￿]|[𐀀-􏿿])*!*`, LiteralStringInterpol, nil}, + {`(\$)(\()`, ByGroups(LiteralStringInterpol, Punctuation), Push("in-intp")}, + {`%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]`, LiteralStringInterpol, nil}, + {`.|\s`, LiteralString, nil}, + }, + "tqstring": { + {`"""`, LiteralString, Pop(1)}, + {`\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)`, LiteralStringEscape, nil}, + {`\$(?:[a-zA-Z_¡-￿]|[𐀀-􏿿])(?:[a-zA-Z_0-9¡-￿]|[𐀀-􏿿])*!*`, LiteralStringInterpol, nil}, + {`(\$)(\()`, ByGroups(LiteralStringInterpol, Punctuation), Push("in-intp")}, + {`.|\s`, LiteralString, nil}, + }, + "regex": { + {`"`, LiteralStringRegex, Pop(1)}, + {`\\"`, LiteralStringRegex, nil}, + {`.|\s`, LiteralStringRegex, nil}, + }, + "tqregex": { + {`"""`, LiteralStringRegex, Pop(1)}, + {`.|\s`, LiteralStringRegex, nil}, + }, + "command": { + {"`", LiteralStringBacktick, Pop(1)}, + {`\$(?:[a-zA-Z_¡-￿]|[𐀀-􏿿])(?:[a-zA-Z_0-9¡-￿]|[𐀀-􏿿])*!*`, LiteralStringInterpol, nil}, + {`(\$)(\()`, ByGroups(LiteralStringInterpol, Punctuation), Push("in-intp")}, + {`.|\s`, LiteralStringBacktick, nil}, + }, + "in-intp": { + {`\(`, Punctuation, Push()}, + {`\)`, Punctuation, Pop(1)}, + Include("root"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/j/jungle.go b/vendor/github.com/alecthomas/chroma/lexers/j/jungle.go new file mode 100644 index 000000000..83d46a48d --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/j/jungle.go @@ -0,0 +1,50 @@ +package j + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +var Jungle = internal.Register(MustNewLexer( + &Config{ + Name: "Jungle", + Aliases: []string{"jungle"}, + Filenames: []string{"*.jungle"}, + MimeTypes: []string{"text/x-jungle"}, + }, + Rules{ + "root": { + {`[^\S\n]+`, Text, nil}, + {`\n`, Text, nil}, + {`#(\n|[\w\W]*?[^#]\n)`, CommentSingle, nil}, + {`^(?=\S)`, None, Push("instruction")}, + {`[\.;\[\]\(\)\$]`, Punctuation, nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + }, + "instruction": { + {`[^\S\n]+`, Text, nil}, + {`=`, Operator, Push("value")}, + {`(?=\S)`, None, Push("var")}, + Default(Pop(1)), + }, + "value": { + {`[^\S\n]+`, Text, nil}, + {`\$\(`, Punctuation, Push("var")}, + {`[;\[\]\(\)\$]`, Punctuation, nil}, + {`#(\n|[\w\W]*?[^#]\n)`, CommentSingle, nil}, + {`[\w_\-\.\/\\]+`, Text, nil}, + Default(Pop(1)), + }, + "var": { + {`[^\S\n]+`, Text, nil}, + {`\b(((re)?source|barrel)Path|excludeAnnotations|annotations|lang)\b`, NameBuiltin, nil}, + {`\bbase\b`, NameConstant, nil}, + {`\b(ind|zsm|hrv|ces|dan|dut|eng|fin|fre|deu|gre|hun|ita|nob|po[lr]|rus|sl[ov]|spa|swe|ara|heb|zh[st]|jpn|kor|tha|vie|bul|tur)`, NameConstant, nil}, + {`\b((semi)?round|rectangle)(-\d+x\d+)?\b`, NameConstant, nil}, + {`[\.;\[\]\(\$]`, Punctuation, nil}, + {`\)`, Punctuation, Pop(1)}, + {`[a-zA-Z_]\w*`, Name, nil}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go b/vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go new file mode 100644 index 000000000..56b796601 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go @@ -0,0 +1,55 @@ +package k + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +var kotlinIdentifier = "_A-Z\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038a\u038c\u038e-\u038f\u0391-\u03a1\u03a3-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0524\u0526\u0531-\u0556\u10a0-\u10c5\u10c7\u10cd\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59\u1f5b\u1f5d\u1f5f\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67\u2c69\u2c6b\u2c6d-\u2c70\u2c72\u2c75\u2c7e-\u2c80\u2c82\u2c84\u2c86\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\u2ceb\u2ced\u2cf2\ua640\ua642\ua644\ua646\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a\ua65c\ua65e\ua660\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\ua78d\ua790\ua792\ua7a0\ua7a2\ua7a4\ua7a6\ua7a8\ua7aa\uff21-\uff3aa-z\u00b5\u00df-\u00f6\u00f8-\u00ff\u0101\u0103\u0105\u0107\u0109\u010b\u010d\u010f\u0111\u0113\u0115\u0117\u0119\u011b\u011d\u011f\u0121\u0123\u0125\u0127\u0129\u012b\u012d\u012f\u0131\u0133\u0135\u0137-\u0138\u013a\u013c\u013e\u0140\u0142\u0144\u0146\u0148-\u0149\u014b\u014d\u014f\u0151\u0153\u0155\u0157\u0159\u015b\u015d\u015f\u0161\u0163\u0165\u0167\u0169\u016b\u016d\u016f\u0171\u0173\u0175\u0177\u017a\u017c\u017e-\u0180\u0183\u0185\u0188\u018c-\u018d\u0192\u0195\u0199-\u019b\u019e\u01a1\u01a3\u01a5\u01a8\u01aa-\u01ab\u01ad\u01b0\u01b4\u01b6\u01b9-\u01ba\u01bd-\u01bf\u01c6\u01c9\u01cc\u01ce\u01d0\u01d2\u01d4\u01d6\u01d8\u01da\u01dc-\u01dd\u01df\u01e1\u01e3\u01e5\u01e7\u01e9\u01eb\u01ed\u01ef-\u01f0\u01f3\u01f5\u01f9\u01fb\u01fd\u01ff\u0201\u0203\u0205\u0207\u0209\u020b\u020d\u020f\u0211\u0213\u0215\u0217\u0219\u021b\u021d\u021f\u0221\u0223\u0225\u0227\u0229\u022b\u022d\u022f\u0231\u0233-\u0239\u023c\u023f-\u0240\u0242\u0247\u0249\u024b\u024d\u024f-\u0293\u0295-\u02af\u0371\u0373\u0377\u037b-\u037d\u0390\u03ac-\u03ce\u03d0-\u03d1\u03d5-\u03d7\u03d9\u03db\u03dd\u03df\u03e1\u03e3\u03e5\u03e7\u03e9\u03eb\u03ed\u03ef-\u03f3\u03f5\u03f8\u03fb-\u03fc\u0430-\u045f\u0461\u0463\u0465\u0467\u0469\u046b\u046d\u046f\u0471\u0473\u0475\u0477\u0479\u047b\u047d\u047f\u0481\u048b\u048d\u048f\u0491\u0493\u0495\u0497\u0499\u049b\u049d\u049f\u04a1\u04a3\u04a5\u04a7\u04a9\u04ab\u04ad\u04af\u04b1\u04b3\u04b5\u04b7\u04b9\u04bb\u04bd\u04bf\u04c2\u04c4\u04c6\u04c8\u04ca\u04cc\u04ce-\u04cf\u04d1\u04d3\u04d5\u04d7\u04d9\u04db\u04dd\u04df\u04e1\u04e3\u04e5\u04e7\u04e9\u04eb\u04ed\u04ef\u04f1\u04f3\u04f5\u04f7\u04f9\u04fb\u04fd\u04ff\u0501\u0503\u0505\u0507\u0509\u050b\u050d\u050f\u0511\u0513\u0515\u0517\u0519\u051b\u051d\u051f\u0521\u0523\u0525\u0527\u0561-\u0587\u1d00-\u1d2b\u1d6b-\u1d77\u1d79-\u1d9a\u1e01\u1e03\u1e05\u1e07\u1e09\u1e0b\u1e0d\u1e0f\u1e11\u1e13\u1e15\u1e17\u1e19\u1e1b\u1e1d\u1e1f\u1e21\u1e23\u1e25\u1e27\u1e29\u1e2b\u1e2d\u1e2f\u1e31\u1e33\u1e35\u1e37\u1e39\u1e3b\u1e3d\u1e3f\u1e41\u1e43\u1e45\u1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2cb7\u2cb9\u2cbb\u2cbd\u2cbf\u2cc1\u2cc3\u2cc5\u2cc7\u2cc9\u2ccb\u2ccd\u2ccf\u2cd1\u2cd3\u2cd5\u2cd7\u2cd9\u2cdb\u2cdd\u2cdf\u2ce1\u2ce3-\u2ce4\u2cec\u2cee\u2cf3\u2d00-\u2d25\u2d27\u2d2d\ua641\ua643\ua645\ua647\ua649\ua64b\ua64d\ua64f\ua651\ua653\ua655\ua657\ua659\ua65b\ua65d\ua65f\ua661\ua663\ua665\ua667\ua669\ua66b\ua66d\ua681\ua683\ua685\ua687\ua689\ua68b\ua68d\ua68f\ua691\ua693\ua695\ua697\ua723\ua725\ua727\ua729\ua72b\ua72d\ua72f-\ua731\ua733\ua735\ua737\ua739\ua73b\ua73d\ua73f\ua741\ua743\ua745\ua747\ua749\ua74b\ua74d\ua74f\ua751\ua753\ua755\ua757\ua759\ua75b\ua75d\ua75f\ua761\ua763\ua765\ua767\ua769\ua76b\ua76d\ua76f\ua771-\ua778\ua77a\ua77c\ua77f\ua781\ua783\ua785\ua787\ua78c\ua78e\ua791\ua793\ua7a1\ua7a3\ua7a5\ua7a7\ua7a9\ua7fa\ufb00-\ufb06\ufb13-\ufb17\uff41-\uff5a\u01c5\u01c8\u01cb\u01f2\u1f88-\u1f8f\u1f98-\u1f9f\u1fa8-\u1faf\u1fbc\u1fcc\u1ffc\u02b0-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0374\u037a\u0559\u0640\u06e5-\u06e6\u07f4-\u07f5\u07fa\u081a\u0824\u0828\u0971\u0e46\u0ec6\u10fc\u17d7\u1843\u1aa7\u1c78-\u1c7d\u1d2c-\u1d6a\u1d78\u1d9b-\u1dbf\u2071\u207f\u2090-\u209c\u2c7c-\u2c7d\u2d6f\u2e2f\u3005\u3031-\u3035\u303b\u309d-\u309e\u30fc-\u30fe\ua015\ua4f8-\ua4fd\ua60c\ua67f\ua717-\ua71f\ua770\ua788\ua7f8-\ua7f9\ua9cf\uaa70\uaadd\uaaf3-\uaaf4\uff70\uff9e-\uff9f\u16ee-\u16f0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303a\ua6e6-\ua6ef][A-Z\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038a\u038c\u038e-\u038f\u0391-\u03a1\u03a3-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0524\u0526\u0531-\u0556\u10a0-\u10c5\u10c7\u10cd\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59\u1f5b\u1f5d\u1f5f\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67\u2c69\u2c6b\u2c6d-\u2c70\u2c72\u2c75\u2c7e-\u2c80\u2c82\u2c84\u2c86\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\u2ceb\u2ced\u2cf2\ua640\ua642\ua644\ua646\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a\ua65c\ua65e\ua660\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\ua78d\ua790\ua792\ua7a0\ua7a2\ua7a4\ua7a6\ua7a8\ua7aa\uff21-\uff3aa-z\u00b5\u00df-\u00f6\u00f8-\u00ff\u0101\u0103\u0105\u0107\u0109\u010b\u010d\u010f\u0111\u0113\u0115\u0117\u0119\u011b\u011d\u011f\u0121\u0123\u0125\u0127\u0129\u012b\u012d\u012f\u0131\u0133\u0135\u0137-\u0138\u013a\u013c\u013e\u0140\u0142\u0144\u0146\u0148-\u0149\u014b\u014d\u014f\u0151\u0153\u0155\u0157\u0159\u015b\u015d\u015f\u0161\u0163\u0165\u0167\u0169\u016b\u016d\u016f\u0171\u0173\u0175\u0177\u017a\u017c\u017e-\u0180\u0183\u0185\u0188\u018c-\u018d\u0192\u0195\u0199-\u019b\u019e\u01a1\u01a3\u01a5\u01a8\u01aa-\u01ab\u01ad\u01b0\u01b4\u01b6\u01b9-\u01ba\u01bd-\u01bf\u01c6\u01c9\u01cc\u01ce\u01d0\u01d2\u01d4\u01d6\u01d8\u01da\u01dc-\u01dd\u01df\u01e1\u01e3\u01e5\u01e7\u01e9\u01eb\u01ed\u01ef-\u01f0\u01f3\u01f5\u01f9\u01fb\u01fd\u01ff\u0201\u0203\u0205\u0207\u0209\u020b\u020d\u020f\u0211\u0213\u0215\u0217\u0219\u021b\u021d\u021f\u0221\u0223\u0225\u0227\u0229\u022b\u022d\u022f\u0231\u0233-\u0239\u023c\u023f-\u0240\u0242\u0247\u0249\u024b\u024d\u024f-\u0293\u0295-\u02af\u0371\u0373\u0377\u037b-\u037d\u0390\u03ac-\u03ce\u03d0-\u03d1\u03d5-\u03d7\u03d9\u03db\u03dd\u03df\u03e1\u03e3\u03e5\u03e7\u03e9\u03eb\u03ed\u03ef-\u03f3\u03f5\u03f8\u03fb-\u03fc\u0430-\u045f\u0461\u0463\u0465\u0467\u0469\u046b\u046d\u046f\u0471\u0473\u0475\u0477\u0479\u047b\u047d\u047f\u0481\u048b\u048d\u048f\u0491\u0493\u0495\u0497\u0499\u049b\u049d\u049f\u04a1\u04a3\u04a5\u04a7\u04a9\u04ab\u04ad\u04af\u04b1\u04b3\u04b5\u04b7\u04b9\u04bb\u04bd\u04bf\u04c2\u04c4\u04c6\u04c8\u04ca\u04cc\u04ce-\u04cf\u04d1\u04d3\u04d5\u04d7\u04d9\u04db\u04dd\u04df\u04e1\u04e3\u04e5\u04e7\u04e9\u04eb\u04ed\u04ef\u04f1\u04f3\u04f5\u04f7\u04f9\u04fb\u04fd\u04ff\u0501\u0503\u0505\u0507\u0509\u050b\u050d\u050f\u0511\u0513\u0515\u0517\u0519\u051b\u051d\u051f\u0521\u0523\u0525\u0527\u0561-\u0587\u1d00-\u1d2b\u1d6b-\u1d77\u1d79-\u1d9a\u1e01\u1e03\u1e05\u1e07\u1e09\u1e0b\u1e0d\u1e0f\u1e11\u1e13\u1e15\u1e17\u1e19\u1e1b\u1e1d\u1e1f\u1e21\u1e23\u1e25\u1e27\u1e29\u1e2b\u1e2d\u1e2f\u1e31\u1e33\u1e35\u1e37\u1e39\u1e3b\u1e3d\u1e3f\u1e41\u1e43\u1e45\u1e47\u1e49\u1e4b\u1e4d\u1e4f\u1e51\u1e53\u1e55\u1e57\u1e59\u1e5b\u1e5d\u1e5f\u1e61\u1e63\u1e65\u1e67\u1e69\u1e6b\u1e6d\u1e6f\u1e71\u1e73\u1e75\u1e77\u1e79\u1e7b\u1e7d\u1e7f\u1e81\u1e83\u1e85\u1e87\u1e89\u1e8b\u1e8d\u1e8f\u1e91\u1e93\u1e95-\u1e9d\u1e9f\u1ea1\u1ea3\u1ea5\u1ea7\u1ea9\u1eab\u1ead\u1eaf\u1eb1\u1eb3\u1eb5\u1eb7\u1eb9\u1ebb\u1ebd\u1ebf\u1ec1\u1ec3\u1ec5\u1ec7\u1ec9\u1ecb\u1ecd\u1ecf\u1ed1\u1ed3\u1ed5\u1ed7\u1ed9\u1edb\u1edd\u1edf\u1ee1\u1ee3\u1ee5\u1ee7\u1ee9\u1eeb\u1eed\u1eef\u1ef1\u1ef3\u1ef5\u1ef7\u1ef9\u1efb\u1efd\u1eff-\u1f07\u1f10-\u1f15\u1f20-\u1f27\u1f30-\u1f37\u1f40-\u1f45\u1f50-\u1f57\u1f60-\u1f67\u1f70-\u1f7d\u1f80-\u1f87\u1f90-\u1f97\u1fa0-\u1fa7\u1fb0-\u1fb4\u1fb6-\u1fb7\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fc7\u1fd0-\u1fd3\u1fd6-\u1fd7\u1fe0-\u1fe7\u1ff2-\u1ff4\u1ff6-\u1ff7\u210a\u210e-\u210f\u2113\u212f\u2134\u2139\u213c-\u213d\u2146-\u2149\u214e\u2184\u2c30-\u2c5e\u2c61\u2c65-\u2c66\u2c68\u2c6a\u2c6c\u2c71\u2c73-\u2c74\u2c76-\u2c7b\u2c81\u2c83\u2c85\u2c87\u2c89\u2c8b\u2c8d\u2c8f\u2c91\u2c93\u2c95\u2c97\u2c99\u2c9b\u2c9d\u2c9f\u2ca1\u2ca3\u2ca5\u2ca7\u2ca9\u2cab\u2cad\u2caf\u2cb1\u2cb3\u2cb5\u2cb7\u2cb9\u2cbb\u2cbd\u2cbf\u2cc1\u2cc3\u2cc5\u2cc7\u2cc9\u2ccb\u2ccd\u2ccf\u2cd1\u2cd3\u2cd5\u2cd7\u2cd9\u2cdb\u2cdd\u2cdf\u2ce1\u2ce3-\u2ce4\u2cec\u2cee\u2cf3\u2d00-\u2d25\u2d27\u2d2d\ua641\ua643\ua645\ua647\ua649\ua64b\ua64d\ua64f\ua651\ua653\ua655\ua657\ua659\ua65b\ua65d\ua65f\ua661\ua663\ua665\ua667\ua669\ua66b\ua66d\ua681\ua683\ua685\ua687\ua689\ua68b\ua68d\ua68f\ua691\ua693\ua695\ua697\ua723\ua725\ua727\ua729\ua72b\ua72d\ua72f-\ua731\ua733\ua735\ua737\ua739\ua73b\ua73d\ua73f\ua741\ua743\ua745\ua747\ua749\ua74b\ua74d\ua74f\ua751\ua753\ua755\ua757\ua759\ua75b\ua75d\ua75f\ua761\ua763\ua765\ua767\ua769\ua76b\ua76d\ua76f\ua771-\ua778\ua77a\ua77c\ua77f\ua781\ua783\ua785\ua787\ua78c\ua78e\ua791\ua793\ua7a1\ua7a3\ua7a5\ua7a7\ua7a9\ua7fa\ufb00-\ufb06\ufb13-\ufb17\uff41-\uff5a\u01c5\u01c8\u01cb\u01f2\u1f88-\u1f8f\u1f98-\u1f9f\u1fa8-\u1faf\u1fbc\u1fcc\u1ffc\u02b0-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0374\u037a\u0559\u0640\u06e5-\u06e6\u07f4-\u07f5\u07fa\u081a\u0824\u0828\u0971\u0e46\u0ec6\u10fc\u17d7\u1843\u1aa7\u1c78-\u1c7d\u1d2c-\u1d6a\u1d78\u1d9b-\u1dbf\u2071\u207f\u2090-\u209c\u2c7c-\u2c7d\u2d6f\u2e2f\u3005\u3031-\u3035\u303b\u309d-\u309e\u30fc-\u30fe\ua015\ua4f8-\ua4fd\ua60c\ua67f\ua717-\ua71f\ua770\ua788\ua7f8-\ua7f9\ua9cf\uaa70\uaadd\uaaf3-\uaaf4\uff70\uff9e-\uff9f\u16ee-\u16f0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303a\ua6e6-\ua6ef0-9\u0660-\u0669\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\uaa50-\uaa59\uabf0-\uabf9\uff10-\uff19_\u203f-\u2040\u2054\ufe33-\ufe34\ufe4d-\ufe4f\uff3f\u00ad\u0600-\u0604\u061c\u06dd\u070f\u180e\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u206f\ufeff\ufff9-\ufffb\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u08fe\u0900-\u0902\u093a\u093c\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09c1-\u09c4\u09cd\u09e2-\u09e3\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b62-\u0b63\u0b82\u0bc0\u0bcd\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c62-\u0c63\u0cbc\u0cbf\u0cc6\u0ccc-\u0ccd\u0ce2-\u0ce3\u0d41-\u0d44\u0d4d\u0d62-\u0d63\u0dca\u0dd2-\u0dd4\u0dd6\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab\u1be6\u1be8-\u1be9\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1dc0-\u1de6\u1dfc-\u1dff\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302d\u3099-\u309a\ua66f\ua674-\ua67d\ua69f\ua6f0-\ua6f1\ua802\ua806\ua80b\ua825-\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\u0903\u093b\u093e-\u0940\u0949-\u094c\u094e-\u094f\u0982-\u0983\u09be-\u09c0\u09c7-\u09c8\u09cb-\u09cc\u09d7\u0a03\u0a3e-\u0a40\u0a83\u0abe-\u0ac0\u0ac9\u0acb-\u0acc\u0b02-\u0b03\u0b3e\u0b40\u0b47-\u0b48\u0b4b-\u0b4c\u0b57\u0bbe-\u0bbf\u0bc1-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcc\u0bd7\u0c01-\u0c03\u0c41-\u0c44\u0c82-\u0c83\u0cbe\u0cc0-\u0cc4\u0cc7-\u0cc8\u0cca-\u0ccb\u0cd5-\u0cd6\u0d02-\u0d03\u0d3e-\u0d40\u0d46-\u0d48\u0d4a-\u0d4c\u0d57\u0d82-\u0d83\u0dcf-\u0dd1\u0dd8-\u0ddf\u0df2-\u0df3\u0f3e-\u0f3f\u0f7f\u102b-\u102c\u1031\u1038\u103b-\u103c\u1056-\u1057\u1062-\u1064\u1067-\u106d\u1083-\u1084\u1087-\u108c\u108f\u109a-\u109c\u17b6\u17be-\u17c5\u17c7-\u17c8\u1923-\u1926\u1929-\u192b\u1930-\u1931\u1933-\u1938\u19b0-\u19c0\u19c8-\u19c9\u1a19-\u1a1a\u1a55\u1a57\u1a61\u1a63-\u1a64\u1a6d-\u1a72\u1b04\u1b35\u1b3b\u1b3d-\u1b41\u1b43-\u1b44\u1b82\u1ba1\u1ba6-\u1ba7\u1baa\u1bac-\u1bad\u1be7\u1bea-\u1bec\u1bee\u1bf2-\u1bf3\u1c24-\u1c2b\u1c34-\u1c35\u1ce1\u1cf2-\u1cf3\u302e-\u302f\ua823-\ua824\ua827\ua880-\ua881\ua8b4-\ua8c3\ua952-\ua953\ua983\ua9b4-\ua9b5\ua9ba-\ua9bb\ua9bd-\ua9c0\uaa2f-\uaa30\uaa33-\uaa34\uaa4d\uaa7b\uaaeb\uaaee-\uaaef\uaaf5\uabe3-\uabe4\uabe6-\uabe7\uabe9-\uabea\uabec]*|`@?[_A-Z\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038a\u038c\u038e-\u038f\u0391-\u03a1\u03a3-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0524\u0526\u0531-\u0556\u10a0-\u10c5\u10c7\u10cd\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59\u1f5b\u1f5d\u1f5f\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67\u2c69\u2c6b\u2c6d-\u2c70\u2c72\u2c75\u2c7e-\u2c80\u2c82\u2c84\u2c86\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\u2ceb\u2ced\u2cf2\ua640\ua642\ua644\ua646\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a\ua65c\ua65e\ua660\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\ua78d\ua790\ua792\ua7a0\ua7a2\ua7a4\ua7a6\ua7a8\ua7aa\uff21-\uff3aa-z\u00b5\u00df-\u00f6\u00f8-\u00ff\u0101\u0103\u0105\u0107\u0109\u010b\u010d\u010f\u0111\u0113\u0115\u0117\u0119\u011b\u011d\u011f\u0121\u0123\u0125\u0127\u0129\u012b\u012d\u012f\u0131\u0133\u0135\u0137-\u0138\u013a\u013c\u013e\u0140\u0142\u0144\u0146\u0148-\u0149\u014b\u014d\u014f\u0151\u0153\u0155\u0157\u0159\u015b\u015d\u015f\u0161\u0163\u0165\u0167\u0169\u016b\u016d\u016f\u0171\u0173\u0175\u0177\u017a\u017c\u017e-\u0180\u0183\u0185\u0188\u018c-\u018d\u0192\u0195\u0199-\u019b\u019e\u01a1\u01a3\u01a5\u01a8\u01aa-\u01ab\u01ad\u01b0\u01b4\u01b6\u01b9-\u01ba\u01bd-\u01bf\u01c6\u01c9\u01cc\u01ce\u01d0\u01d2\u01d4\u01d6\u01d8\u01da\u01dc-\u01dd\u01df\u01e1\u01e3\u01e5\u01e7\u01e9\u01eb\u01ed\u01ef-\u01f0\u01f3\u01f5\u01f9\u01fb\u01fd\u01ff\u0201\u0203\u0205\u0207\u0209\u020b\u020d\u020f\u0211\u0213\u0215\u0217\u0219\u021b\u021d\u021f\u0221\u0223\u0225\u0227\u0229\u022b\u022d\u022f\u0231\u0233-\u0239\u023c\u023f-\u0240\u0242\u0247\u0249\u024b\u024d\u024f-\u0293\u0295-\u02af\u0371\u0373\u0377\u037b-\u037d\u0390\u03ac-\u03ce\u03d0-\u03d1\u03d5-\u03d7\u03d9\u03db\u03dd\u03df\u03e1\u03e3\u03e5\u03e7\u03e9\u03eb\u03ed\u03ef-\u03f3\u03f5\u03f8\u03fb-\u03fc\u0430-\u045f\u0461\u0463\u0465\u0467\u0469\u046b\u046d\u046f\u0471\u0473\u0475\u0477\u0479\u047b\u047d\u047f\u0481\u048b\u048d\u048f\u0491\u0493\u0495\u0497\u0499\u049b\u049d\u049f\u04a1\u04a3\u04a5\u04a7\u04a9\u04ab\u04ad\u04af\u04b1\u04b3\u04b5\u04b7\u04b9\u04bb\u04bd\u04bf\u04c2\u04c4\u04c6\u04c8\u04ca\u04cc\u04ce-\u04cf\u04d1\u04d3\u04d5\u04d7\u04d9\u04db\u04dd\u04df\u04e1\u04e3\u04e5\u04e7\u04e9\u04eb\u04ed\u04ef\u04f1\u04f3\u04f5\u04f7\u04f9\u04fb\u04fd\u04ff\u0501\u0503\u0505\u0507\u0509\u050b\u050d\u050f\u0511\u0513\u0515\u0517\u0519\u051b\u051d\u051f\u0521\u0523\u0525\u0527\u0561-\u0587\u1d00-\u1d2b\u1d6b-\u1d77\u1d79-\u1d9a\u1e01\u1e03\u1e05\u1e07\u1e09\u1e0b\u1e0d\u1e0f\u1e11\u1e13\u1e15\u1e17\u1e19\u1e1b\u1e1d\u1e1f\u1e21\u1e23\u1e25\u1e27\u1e29\u1e2b\u1e2d\u1e2f\u1e31\u1e33\u1e35\u1e37\u1e39\u1e3b\u1e3d\u1e3f\u1e41\u1e43\u1e45\u1e47\u1e49\u1e4b\u1e4d\u1e4f\u1e51\u1e53\u1e55\u1e57\u1e59\u1e5b\u1e5d\u1e5f\u1e61\u1e63\u1e65\u1e67\u1e69\u1e6b\u1e6d\u1e6f\u1e71\u1e73\u1e75\u1e77\u1e79\u1e7b\u1e7d\u1e7f\u1e81\u1e83\u1e85\u1e87\u1e89\u1e8b\u1e8d\u1e8f\u1e91\u1e93\u1e95-\u1e9d\u1e9f\u1ea1\u1ea3\u1ea5\u1ea7\u1ea9\u1eab\u1ead\u1eaf\u1eb1\u1eb3\u1eb5\u1eb7\u1eb9\u1ebb\u1ebd\u1ebf\u1ec1\u1ec3\u1ec5\u1ec7\u1ec9\u1ecb\u1ecd\u1ecf\u1ed1\u1ed3\u1ed5\u1ed7\u1ed9\u1edb\u1edd\u1edf\u1ee1\u1ee3\u1ee5\u1ee7\u1ee9\u1eeb\u1eed\u1eef\u1ef1\u1ef3\u1ef5\u1ef7\u1ef9\u1efb\u1efd\u1eff-\u1f07\u1f10-\u1f15\u1f20-\u1f27\u1f30-\u1f37\u1f40-\u1f45\u1f50-\u1f57\u1f60-\u1f67\u1f70-\u1f7d\u1f80-\u1f87\u1f90-\u1f97\u1fa0-\u1fa7\u1fb0-\u1fb4\u1fb6-\u1fb7\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fc7\u1fd0-\u1fd3\u1fd6-\u1fd7\u1fe0-\u1fe7\u1ff2-\u1ff4\u1ff6-\u1ff7\u210a\u210e-\u210f\u2113\u212f\u2134\u2139\u213c-\u213d\u2146-\u2149\u214e\u2184\u2c30-\u2c5e\u2c61\u2c65-\u2c66\u2c68\u2c6a\u2c6c\u2c71\u2c73-\u2c74\u2c76-\u2c7b\u2c81\u2c83\u2c85\u2c87\u2c89\u2c8b\u2c8d\u2c8f\u2c91\u2c93\u2c95\u2c97\u2c99\u2c9b\u2c9d\u2c9f\u2ca1\u2ca3\u2ca5\u2ca7\u2ca9\u2cab\u2cad\u2caf\u2cb1\u2cb3\u2cb5\u2cb7\u2cb9\u2cbb\u2cbd\u2cbf\u2cc1\u2cc3\u2cc5\u2cc7\u2cc9\u2ccb\u2ccd\u2ccf\u2cd1\u2cd3\u2cd5\u2cd7\u2cd9\u2cdb\u2cdd\u2cdf\u2ce1\u2ce3-\u2ce4\u2cec\u2cee\u2cf3\u2d00-\u2d25\u2d27\u2d2d\ua641\ua643\ua645\ua647\ua649\ua64b\ua64d\ua64f\ua651\ua653\ua655\ua657\ua659\ua65b\ua65d\ua65f\ua661\ua663\ua665\ua667\ua669\ua66b\ua66d\ua681\ua683\ua685\ua687\ua689\ua68b\ua68d\ua68f\ua691\ua693\ua695\ua697\ua723\ua725\ua727\ua729\ua72b\ua72d\ua72f-\ua731\ua733\ua735\ua737\ua739\ua73b\ua73d\ua73f\ua741\ua743\ua745\ua747\ua749\ua74b\ua74d\ua74f\ua751\ua753\ua755\ua757\ua759\ua75b\ua75d\ua75f\ua761\ua763\ua765\ua767\ua769\ua76b\ua76d\ua76f\ua771-\ua778\ua77a\ua77c\ua77f\ua781\ua783\ua785\ua787\ua78c\ua78e\ua791\ua793\ua7a1\ua7a3\ua7a5\ua7a7\ua7a9\ua7fa\ufb00-\ufb06\ufb13-\ufb17\uff41-\uff5a\u01c5\u01c8\u01cb\u01f2\u1f88-\u1f8f\u1f98-\u1f9f\u1fa8-\u1faf\u1fbc\u1fcc\u1ffc\u02b0-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0374\u037a\u0559\u0640\u06e5-\u06e6\u07f4-\u07f5\u07fa\u081a\u0824\u0828\u0971\u0e46\u0ec6\u10fc\u17d7\u1843\u1aa7\u1c78-\u1c7d\u1d2c-\u1d6a\u1d78\u1d9b-\u1dbf\u2071\u207f\u2090-\u209c\u2c7c-\u2c7d\u2d6f\u2e2f\u3005\u3031-\u3035\u303b\u309d-\u309e\u30fc-\u30fe\ua015\ua4f8-\ua4fd\ua60c\ua67f\ua717-\ua71f\ua770\ua788\ua7f8-\ua7f9\ua9cf\uaa70\uaadd\uaaf3-\uaaf4\uff70\uff9e-\uff9f\u16ee-\u16f0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303a\ua6e6-\ua6ef][A-Z\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038a\u038c\u038e-\u038f\u0391-\u03a1\u03a3-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0524\u0526\u0531-\u0556\u10a0-\u10c5\u10c7\u10cd\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59\u1f5b\u1f5d\u1f5f\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67\u2c69\u2c6b\u2c6d-\u2c70\u2c72\u2c75\u2c7e-\u2c80\u2c82\u2c84\u2c86\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\u2ceb\u2ced\u2cf2\ua640\ua642\ua644\ua646\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a\ua65c\ua65e\ua660\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\ua78d\ua790\ua792\ua7a0\ua7a2\ua7a4\ua7a6\ua7a8\ua7aa\uff21-\uff3aa-z\u00b5\u00df-\u00f6\u00f8-\u00ff\u0101\u0103\u0105\u0107\u0109\u010b\u010d\u010f\u0111\u0113\u0115\u0117\u0119\u011b\u011d\u011f\u0121\u0123\u0125\u0127\u0129\u012b\u012d\u012f\u0131\u0133\u0135\u0137-\u0138\u013a\u013c\u013e\u0140\u0142\u0144\u0146\u0148-\u0149\u014b\u014d\u014f\u0151\u0153\u0155\u0157\u0159\u015b\u015d\u015f\u0161\u0163\u0165\u0167\u0169\u016b\u016d\u016f\u0171\u0173\u0175\u0177\u017a\u017c\u017e-\u0180\u0183\u0185\u0188\u018c-\u018d\u0192\u0195\u0199-\u019b\u019e\u01a1\u01a3\u01a5\u01a8\u01aa-\u01ab\u01ad\u01b0\u01b4\u01b6\u01b9-\u01ba\u01bd-\u01bf\u01c6\u01c9\u01cc\u01ce\u01d0\u01d2\u01d4\u01d6\u01d8\u01da\u01dc-\u01dd\u01df\u01e1\u01e3\u01e5\u01e7\u01e9\u01eb\u01ed\u01ef-\u01f0\u01f3\u01f5\u01f9\u01fb\u01fd\u01ff\u0201\u0203\u0205\u0207\u0209\u020b\u020d\u020f\u0211\u0213\u0215\u0217\u0219\u021b\u021d\u021f\u0221\u0223\u0225\u0227\u0229\u022b\u022d\u022f\u0231\u0233-\u0239\u023c\u023f-\u0240\u0242\u0247\u0249\u024b\u024d\u024f-\u0293\u0295-\u02af\u0371\u0373\u0377\u037b-\u037d\u0390\u03ac-\u03ce\u03d0-\u03d1\u03d5-\u03d7\u03d9\u03db\u03dd\u03df\u03e1\u03e3\u03e5\u03e7\u03e9\u03eb\u03ed\u03ef-\u03f3\u03f5\u03f8\u03fb-\u03fc\u0430-\u045f\u0461\u0463\u0465\u0467\u0469\u046b\u046d\u046f\u0471\u0473\u0475\u0477\u0479\u047b\u047d\u047f\u0481\u048b\u048d\u048f\u0491\u0493\u0495\u0497\u0499\u049b\u049d\u049f\u04a1\u04a3\u04a5\u04a7\u04a9\u04ab\u04ad\u04af\u04b1\u04b3\u04b5\u04b7\u04b9\u04bb\u04bd\u04bf\u04c2\u04c4\u04c6\u04c8\u04ca\u04cc\u04ce-\u04cf\u04d1\u04d3\u04d5\u04d7\u04d9\u04db\u04dd\u04df\u04e1\u04e3\u04e5\u04e7\u04e9\u04eb\u04ed\u04ef\u04f1\u04f3\u04f5\u04f7\u04f9\u04fb\u04fd\u04ff\u0501\u0503\u0505\u0507\u0509\u050b\u050d\u050f\u0511\u0513\u0515\u0517\u0519\u051b\u051d\u051f\u0521\u0523\u0525\u0527\u0561-\u0587\u1d00-\u1d2b\u1d6b-\u1d77\u1d79-\u1d9a\u1e01\u1e03\u1e05\u1e07\u1e09\u1e0b\u1e0d\u1e0f\u1e11\u1e13\u1e15\u1e17\u1e19\u1e1b\u1e1d\u1e1f\u1e21\u1e23\u1e25\u1e27\u1e29\u1e2b\u1e2d\u1e2f\u1e31\u1e33\u1e35\u1e37\u1e39\u1e3b\u1e3d\u1e3f\u1e41\u1e43\u1e45\u1e47\u1e49\u1e4b\u1e4d\u1e4f\u1e51\u1e53\u1e55\u1e57\u1e59\u1e5b\u1e5d\u1e5f\u1e61\u1e63\u1e65\u1e67\u1e69\u1e6b\u1e6d\u1e6f\u1e71\u1e73\u1e75\u1e77\u1e79\u1e7b\u1e7d\u1e7f\u1e81\u1e83\u1e85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25\u2d27\u2d2d\ua641\ua643\ua645\ua647\ua649\ua64b\ua64d\ua64f\ua651\ua653\ua655\ua657\ua659\ua65b\ua65d\ua65f\ua661\ua663\ua665\ua667\ua669\ua66b\ua66d\ua681\ua683\ua685\ua687\ua689\ua68b\ua68d\ua68f\ua691\ua693\ua695\ua697\ua723\ua725\ua727\ua729\ua72b\ua72d\ua72f-\ua731\ua733\ua735\ua737\ua739\ua73b\ua73d\ua73f\ua741\ua743\ua745\ua747\ua749\ua74b\ua74d\ua74f\ua751\ua753\ua755\ua757\ua759\ua75b\ua75d\ua75f\ua761\ua763\ua765\ua767\ua769\ua76b\ua76d\ua76f\ua771-\ua778\ua77a\ua77c\ua77f\ua781\ua783\ua785\ua787\ua78c\ua78e\ua791\ua793\ua7a1\ua7a3\ua7a5\ua7a7\ua7a9\ua7fa\ufb00-\ufb06\ufb13-\ufb17\uff41-\uff5a\u01c5\u01c8\u01cb\u01f2\u1f88-\u1f8f\u1f98-\u1f9f\u1fa8-\u1faf\u1fbc\u1fcc\u1ffc\u02b0-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0374\u037a\u0559\u0640\u06e5-\u06e6\u07f4-\u07f5\u07fa\u081a\u0824\u0828\u0971\u0e46\u0ec6\u10fc\u17d7\u1843\u1aa7\u1c78-\u1c7d\u1d2c-\u1d6a\u1d78\u1d9b-\u1dbf\u2071\u207f\u2090-\u209c\u2c7c-\u2c7d\u2d6f\u2e2f\u3005\u3031-\u3035\u303b\u309d-\u309e\u30fc-\u30fe\ua015\ua4f8-\ua4fd\ua60c\ua67f\ua717-\ua71f\ua770\ua788\ua7f8-\ua7f9\ua9cf\uaa70\uaadd\uaaf3-\uaaf4\uff70\uff9e-\uff9f\u16ee-\u16f0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303a\ua6e6-\ua6ef0-9\u0660-\u0669\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\uaa50-\uaa59\uabf0-\uabf9\uff10-\uff19_\u203f-\u2040\u2054\ufe33-\ufe34\ufe4d-\ufe4f\uff3f\u00ad\u0600-\u0604\u061c\u06dd\u070f\u180e\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u206f\ufeff\ufff9-\ufffb\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u08fe\u0900-\u0902\u093a\u093c\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09c1-\u09c4\u09cd\u09e2-\u09e3\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b62-\u0b63\u0b82\u0bc0\u0bcd\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c62-\u0c63\u0cbc\u0cbf\u0cc6\u0ccc-\u0ccd\u0ce2-\u0ce3\u0d41-\u0d44\u0d4d\u0d62-\u0d63\u0dca\u0dd2-\u0dd4\u0dd6\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab\u1be6\u1be8-\u1be9\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1dc0-\u1de6\u1dfc-\u1dff\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302d\u3099-\u309a\ua66f\ua674-\ua67d\ua69f\ua6f0-\ua6f1\ua802\ua806\ua80b\ua825-\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\u0903\u093b\u093e-\u0940\u0949-\u094c\u094e-\u094f\u0982-\u0983\u09be-\u09c0\u09c7-\u09c8\u09cb-\u09cc\u09d7\u0a03\u0a3e-\u0a40\u0a83\u0abe-\u0ac0\u0ac9\u0acb-\u0acc\u0b02-\u0b03\u0b3e\u0b40\u0b47-\u0b48\u0b4b-\u0b4c\u0b57\u0bbe-\u0bbf\u0bc1-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcc\u0bd7\u0c01-\u0c03\u0c41-\u0c44\u0c82-\u0c83\u0cbe\u0cc0-\u0cc4\u0cc7-\u0cc8\u0cca-\u0ccb\u0cd5-\u0cd6\u0d02-\u0d03\u0d3e-\u0d40\u0d46-\u0d48\u0d4a-\u0d4c\u0d57\u0d82-\u0d83\u0dcf-\u0dd1\u0dd8-\u0ddf\u0df2-\u0df3\u0f3e-\u0f3f\u0f7f\u102b-\u102c\u1031\u1038\u103b-\u103c\u1056-\u1057\u1062-\u1064\u1067-\u106d\u1083-\u1084\u1087-\u108c\u108f\u109a-\u109c\u17b6\u17be-\u17c5\u17c7-\u17c8\u1923-\u1926\u1929-\u192b\u1930-\u1931\u1933-\u1938\u19b0-\u19c0\u19c8-\u19c9\u1a19-\u1a1a\u1a55\u1a57\u1a61\u1a63-\u1a64\u1a6d-\u1a72\u1b04\u1b35\u1b3b\u1b3d-\u1b41\u1b43-\u1b44\u1b82\u1ba1\u1ba6-\u1ba7\u1baa\u1bac-\u1bad\u1be7\u1bea-\u1bec\u1bee\u1bf2-\u1bf3\u1c24-\u1c2b\u1c34-\u1c35\u1ce1\u1cf2-\u1cf3\u302e-\u302f\ua823-\ua824\ua827\ua880-\ua881\ua8b4-\ua8c3\ua952-\ua953\ua983\ua9b4-\ua9b5\ua9ba-\ua9bb\ua9bd-\ua9c0\uaa2f-\uaa30\uaa33-\uaa34\uaa4d\uaa7b\uaaeb\uaaee-\uaaef\uaaf5\uabe3-\uabe4\uabe6-\uabe7\uabe9-\uabea\uabec" + +// Kotlin lexer. +var Kotlin = internal.Register(MustNewLexer( + &Config{ + Name: "Kotlin", + Aliases: []string{"kotlin"}, + Filenames: []string{"*.kt"}, + MimeTypes: []string{"text/x-kotlin"}, + DotAll: true, + }, + Rules{ + "root": { + {`^\s*\[.*?\]`, NameAttribute, nil}, + {`[^\S\n]+`, Text, nil}, + {`\\\n`, Text, nil}, + {`//[^\n]*\n?`, CommentSingle, nil}, + {`/[*].*?[*]/`, CommentMultiline, nil}, + {`\n`, Text, nil}, + {`::|!!|\?[:.]`, Operator, nil}, + {`[~!%^&*()+=|\[\]:;,.<>/?-]`, Punctuation, nil}, + {`[{}]`, Punctuation, nil}, + {`"""[^"]*"""`, LiteralString, nil}, + {`"(\\\\|\\"|[^"\n])*["\n]`, LiteralString, nil}, + {`'\\.'|'[^\\]'`, LiteralStringChar, nil}, + {`0[xX][0-9a-fA-F]+[Uu]?[Ll]?|[0-9]+(\.[0-9]*)?([eE][+-][0-9]+)?[fF]?[Uu]?[Ll]?`, LiteralNumber, nil}, + {`(companion)(\s+)(object)`, ByGroups(Keyword, Text, Keyword), nil}, + {`(class|interface|object)(\s+)`, ByGroups(Keyword, Text), Push("class")}, + {`(package|import)(\s+)`, ByGroups(Keyword, Text), Push("package")}, + {`(val|var)(\s+)`, ByGroups(Keyword, Text), Push("property")}, + {`(fun)(\s+)(<[^>]*>\s+)?`, ByGroups(Keyword, Text, Text), Push("function")}, + {`(abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|false|final|finally|for|fun|get|if|import|in|infix|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|true|try|val|var|vararg|when|where|while)\b`, Keyword, nil}, + {"(@?[" + kotlinIdentifier + "]*`)", Name, nil}, + }, + "package": { + {`\S+`, NameNamespace, Pop(1)}, + }, + "class": { + {"(@?[" + kotlinIdentifier + "]*`)", NameClass, Pop(1)}, + }, + "property": { + {"(@?[" + kotlinIdentifier + " ]*`)", NameProperty, Pop(1)}, + }, + "function": { + {"(@?[" + kotlinIdentifier + " ]*`)", NameFunction, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/l/lighttpd.go b/vendor/github.com/alecthomas/chroma/lexers/l/lighttpd.go new file mode 100644 index 000000000..799b77c30 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/l/lighttpd.go @@ -0,0 +1,30 @@ +package l + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Lighttpd Configuration File lexer. +var Lighttpd = internal.Register(MustNewLexer( + &Config{ + Name: "Lighttpd configuration file", + Aliases: []string{"lighty", "lighttpd"}, + Filenames: []string{}, + MimeTypes: []string{"text/x-lighttpd-conf"}, + }, + Rules{ + "root": { + {`#.*\n`, CommentSingle, nil}, + {`/\S*`, Name, nil}, + {`[a-zA-Z._-]+`, Keyword, nil}, + {`\d+\.\d+\.\d+\.\d+(?:/\d+)?`, LiteralNumber, nil}, + {`[0-9]+`, LiteralNumber, nil}, + {`=>|=~|\+=|==|=|\+`, Operator, nil}, + {`\$[A-Z]+`, NameBuiltin, nil}, + {`[(){}\[\],]`, Punctuation, nil}, + {`"([^"\\]*(?:\\.[^"\\]*)*)"`, LiteralStringDouble, nil}, + {`\s+`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/l/llvm.go b/vendor/github.com/alecthomas/chroma/lexers/l/llvm.go new file mode 100644 index 000000000..8f5b0b123 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/l/llvm.go @@ -0,0 +1,43 @@ +package l + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Llvm lexer. +var Llvm = internal.Register(MustNewLexer( + &Config{ + Name: "LLVM", + Aliases: []string{"llvm"}, + Filenames: []string{"*.ll"}, + MimeTypes: []string{"text/x-llvm"}, + }, + Rules{ + "root": { + Include("whitespace"), + {`([-a-zA-Z$._][\w\-$.]*|"[^"]*?")\s*:`, NameLabel, nil}, + Include("keyword"), + {`%([-a-zA-Z$._][\w\-$.]*|"[^"]*?")`, NameVariable, nil}, + {`@([-a-zA-Z$._][\w\-$.]*|"[^"]*?")`, NameVariableGlobal, nil}, + {`%\d+`, NameVariableAnonymous, nil}, + {`@\d+`, NameVariableGlobal, nil}, + {`#\d+`, NameVariableGlobal, nil}, + {`!([-a-zA-Z$._][\w\-$.]*|"[^"]*?")`, NameVariable, nil}, + {`!\d+`, NameVariableAnonymous, nil}, + {`c?"[^"]*?"`, LiteralString, nil}, + {`0[xX][a-fA-F0-9]+`, LiteralNumber, nil}, + {`-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?`, LiteralNumber, nil}, + {`[=<>{}\[\]()*.,!]|x\b`, Punctuation, nil}, + }, + "whitespace": { + {`(\n|\s)+`, Text, nil}, + {`;.*?\n`, Comment, nil}, + }, + "keyword": { + {Words(``, `\b`, `begin`, `end`, `true`, `false`, `declare`, `define`, `global`, `constant`, `private`, `linker_private`, `internal`, `available_externally`, `linkonce`, `linkonce_odr`, `weak`, `weak_odr`, `appending`, `dllimport`, `dllexport`, `common`, `default`, `hidden`, `protected`, `extern_weak`, `external`, `thread_local`, `zeroinitializer`, `undef`, `null`, `to`, `tail`, `target`, `triple`, `datalayout`, `volatile`, `nuw`, `nsw`, `nnan`, `ninf`, `nsz`, `arcp`, `fast`, `exact`, `inbounds`, `align`, `addrspace`, `section`, `alias`, `module`, `asm`, `sideeffect`, `gc`, `dbg`, `linker_private_weak`, `attributes`, `blockaddress`, `initialexec`, `localdynamic`, `localexec`, `prefix`, `unnamed_addr`, `ccc`, `fastcc`, `coldcc`, `x86_stdcallcc`, `x86_fastcallcc`, `arm_apcscc`, `arm_aapcscc`, `arm_aapcs_vfpcc`, `ptx_device`, `ptx_kernel`, `intel_ocl_bicc`, `msp430_intrcc`, `spir_func`, `spir_kernel`, `x86_64_sysvcc`, `x86_64_win64cc`, `x86_thiscallcc`, `cc`, `c`, `signext`, `zeroext`, `inreg`, `sret`, `nounwind`, `noreturn`, `noalias`, `nocapture`, `byval`, `nest`, `readnone`, `readonly`, `inlinehint`, `noinline`, `alwaysinline`, `optsize`, `ssp`, `sspreq`, `noredzone`, `noimplicitfloat`, `naked`, `builtin`, `cold`, `nobuiltin`, `noduplicate`, `nonlazybind`, `optnone`, `returns_twice`, `sanitize_address`, `sanitize_memory`, `sanitize_thread`, `sspstrong`, `uwtable`, `returned`, `type`, `opaque`, `eq`, `ne`, `slt`, `sgt`, `sle`, `sge`, `ult`, `ugt`, `ule`, `uge`, `oeq`, `one`, `olt`, `ogt`, `ole`, `oge`, `ord`, `uno`, `ueq`, `une`, `x`, `acq_rel`, `acquire`, `alignstack`, `atomic`, `catch`, `cleanup`, `filter`, `inteldialect`, `max`, `min`, `monotonic`, `nand`, `personality`, `release`, `seq_cst`, `singlethread`, `umax`, `umin`, `unordered`, `xchg`, `add`, `fadd`, `sub`, `fsub`, `mul`, `fmul`, `udiv`, `sdiv`, `fdiv`, `urem`, `srem`, `frem`, `shl`, `lshr`, `ashr`, `and`, `or`, `xor`, `icmp`, `fcmp`, `phi`, `call`, `trunc`, `zext`, `sext`, `fptrunc`, `fpext`, `uitofp`, `sitofp`, `fptoui`, `fptosi`, `inttoptr`, `ptrtoint`, `bitcast`, `addrspacecast`, `select`, `va_arg`, `ret`, `br`, `switch`, `invoke`, `unwind`, `unreachable`, `indirectbr`, `landingpad`, `resume`, `malloc`, `alloca`, `free`, `load`, `store`, `getelementptr`, `extractelement`, `insertelement`, `shufflevector`, `getresult`, `extractvalue`, `insertvalue`, `atomicrmw`, `cmpxchg`, `fence`, `allocsize`, `amdgpu_cs`, `amdgpu_gs`, `amdgpu_kernel`, `amdgpu_ps`, `amdgpu_vs`, `any`, `anyregcc`, `argmemonly`, `avr_intrcc`, `avr_signalcc`, `caller`, `catchpad`, `catchret`, `catchswitch`, `cleanuppad`, `cleanupret`, `comdat`, `convergent`, `cxx_fast_tlscc`, `deplibs`, `dereferenceable`, `dereferenceable_or_null`, `distinct`, `exactmatch`, `externally_initialized`, `from`, `ghccc`, `hhvm_ccc`, `hhvmcc`, `ifunc`, `inaccessiblemem_or_argmemonly`, `inaccessiblememonly`, `inalloca`, `jumptable`, `largest`, `local_unnamed_addr`, `minsize`, `musttail`, `noduplicates`, `none`, `nonnull`, `norecurse`, `notail`, `preserve_allcc`, `preserve_mostcc`, `prologue`, `safestack`, `samesize`, `source_filename`, `swiftcc`, `swifterror`, `swiftself`, `webkit_jscc`, `within`, `writeonly`, `x86_intrcc`, `x86_vectorcallcc`), Keyword, nil}, + {Words(``, ``, `void`, `half`, `float`, `double`, `x86_fp80`, `fp128`, `ppc_fp128`, `label`, `metadata`, `token`), KeywordType, nil}, + {`i[1-9]\d*`, Keyword, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/l/lua.go b/vendor/github.com/alecthomas/chroma/lexers/l/lua.go new file mode 100644 index 000000000..c397de065 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/l/lua.go @@ -0,0 +1,75 @@ +package l + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Lua lexer. +var Lua = internal.Register(MustNewLexer( + &Config{ + Name: "Lua", + Aliases: []string{"lua"}, + Filenames: []string{"*.lua", "*.wlua"}, + MimeTypes: []string{"text/x-lua", "application/x-lua"}, + }, + Rules{ + "root": { + {`#!.*`, CommentPreproc, nil}, + Default(Push("base")), + }, + "ws": { + {`(?:--\[(=*)\[[\w\W]*?\](\1)\])`, CommentMultiline, nil}, + {`(?:--.*$)`, CommentSingle, nil}, + {`(?:\s+)`, Text, nil}, + }, + "base": { + Include("ws"), + {`(?i)0x[\da-f]*(\.[\da-f]*)?(p[+-]?\d+)?`, LiteralNumberHex, nil}, + {`(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?`, LiteralNumberFloat, nil}, + {`(?i)\d+e[+-]?\d+`, LiteralNumberFloat, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`(?s)\[(=*)\[.*?\]\1\]`, LiteralString, nil}, + {`::`, Punctuation, Push("label")}, + {`\.{3}`, Punctuation, nil}, + {`[=<>|~&+\-*/%#^]+|\.\.`, Operator, nil}, + {`[\[\]{}().,:;]`, Punctuation, nil}, + {`(and|or|not)\b`, OperatorWord, nil}, + {`(break|do|else|elseif|end|for|if|in|repeat|return|then|until|while)\b`, KeywordReserved, nil}, + {`goto\b`, KeywordReserved, Push("goto")}, + {`(local)\b`, KeywordDeclaration, nil}, + {`(true|false|nil)\b`, KeywordConstant, nil}, + {`(function)\b`, KeywordReserved, Push("funcname")}, + {`[A-Za-z_]\w*(\.[A-Za-z_]\w*)?`, Name, nil}, + {`'`, LiteralStringSingle, Combined("stringescape", "sqs")}, + {`"`, LiteralStringDouble, Combined("stringescape", "dqs")}, + }, + "funcname": { + Include("ws"), + {`[.:]`, Punctuation, nil}, + {`(?:[^\W\d]\w*)(?=(?:(?:--\[(=*)\[[\w\W]*?\](\2)\])|(?:--.*$)|(?:\s+))*[.:])`, NameClass, nil}, + {`(?:[^\W\d]\w*)`, NameFunction, Pop(1)}, + {`\(`, Punctuation, Pop(1)}, + }, + "goto": { + Include("ws"), + {`(?:[^\W\d]\w*)`, NameLabel, Pop(1)}, + }, + "label": { + Include("ws"), + {`::`, Punctuation, Pop(1)}, + {`(?:[^\W\d]\w*)`, NameLabel, nil}, + }, + "stringescape": { + {`\\([abfnrtv\\"\']|[\r\n]{1,2}|z\s*|x[0-9a-fA-F]{2}|\d{1,3}|u\{[0-9a-fA-F]+\})`, LiteralStringEscape, nil}, + }, + "sqs": { + {`'`, LiteralStringSingle, Pop(1)}, + {`[^\\']+`, LiteralStringSingle, nil}, + }, + "dqs": { + {`"`, LiteralStringDouble, Pop(1)}, + {`[^\\"]+`, LiteralStringDouble, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/lexers.go b/vendor/github.com/alecthomas/chroma/lexers/lexers.go new file mode 100644 index 000000000..2897299c8 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/lexers.go @@ -0,0 +1,59 @@ +// Package lexers contains the registry of all lexers. +// +// Sub-packages contain lexer implementations. +package lexers + +// nolint: golint +import ( + "github.com/alecthomas/chroma" + _ "github.com/alecthomas/chroma/lexers/a" + _ "github.com/alecthomas/chroma/lexers/b" + _ "github.com/alecthomas/chroma/lexers/c" + _ "github.com/alecthomas/chroma/lexers/circular" + _ "github.com/alecthomas/chroma/lexers/d" + _ "github.com/alecthomas/chroma/lexers/e" + _ "github.com/alecthomas/chroma/lexers/f" + _ "github.com/alecthomas/chroma/lexers/g" + _ "github.com/alecthomas/chroma/lexers/h" + _ "github.com/alecthomas/chroma/lexers/i" + "github.com/alecthomas/chroma/lexers/internal" + _ "github.com/alecthomas/chroma/lexers/j" + _ "github.com/alecthomas/chroma/lexers/k" + _ "github.com/alecthomas/chroma/lexers/l" + _ "github.com/alecthomas/chroma/lexers/m" + _ "github.com/alecthomas/chroma/lexers/n" + _ "github.com/alecthomas/chroma/lexers/o" + _ "github.com/alecthomas/chroma/lexers/p" + _ "github.com/alecthomas/chroma/lexers/q" + _ "github.com/alecthomas/chroma/lexers/r" + _ "github.com/alecthomas/chroma/lexers/s" + _ "github.com/alecthomas/chroma/lexers/t" + _ "github.com/alecthomas/chroma/lexers/v" + _ "github.com/alecthomas/chroma/lexers/w" + _ "github.com/alecthomas/chroma/lexers/x" + _ "github.com/alecthomas/chroma/lexers/y" +) + +// Registry of Lexers. +var Registry = internal.Registry + +// Names of all lexers, optionally including aliases. +func Names(withAliases bool) []string { return internal.Names(withAliases) } + +// Get a Lexer by name, alias or file extension. +func Get(name string) chroma.Lexer { return internal.Get(name) } + +// MatchMimeType attempts to find a lexer for the given MIME type. +func MatchMimeType(mimeType string) chroma.Lexer { return internal.MatchMimeType(mimeType) } + +// Match returns the first lexer matching filename. +func Match(filename string) chroma.Lexer { return internal.Match(filename) } + +// Analyse text content and return the "best" lexer.. +func Analyse(text string) chroma.Lexer { return internal.Analyse(text) } + +// Register a Lexer with the global registry. +func Register(lexer chroma.Lexer) chroma.Lexer { return internal.Register(lexer) } + +// Fallback lexer if no other is found. +var Fallback = internal.Fallback diff --git a/vendor/github.com/alecthomas/chroma/lexers/m/make.go b/vendor/github.com/alecthomas/chroma/lexers/m/make.go new file mode 100644 index 000000000..eb9d9e68b --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/m/make.go @@ -0,0 +1,54 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + . "github.com/alecthomas/chroma/lexers/b" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Makefile lexer. +var Makefile = internal.Register(MustNewLexer( + &Config{ + Name: "Base Makefile", + Aliases: []string{"make", "makefile", "mf", "bsdmake"}, + Filenames: []string{"*.mak", "*.mk", "Makefile", "makefile", "Makefile.*", "GNUmakefile"}, + MimeTypes: []string{"text/x-makefile"}, + EnsureNL: true, + }, + Rules{ + "root": { + {`^(?:[\t ]+.*\n|\n)+`, Using(Bash), nil}, + {`\$[<@$+%?|*]`, Keyword, nil}, + {`\s+`, Text, nil}, + {`#.*?\n`, Comment, nil}, + {`(export)(\s+)(?=[\w${}\t -]+\n)`, ByGroups(Keyword, Text), Push("export")}, + {`export\s+`, Keyword, nil}, + {`([\w${}().-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)`, ByGroups(NameVariable, Text, Operator, Text, Using(Bash)), nil}, + {`(?s)"(\\\\|\\.|[^"\\])*"`, LiteralStringDouble, nil}, + {`(?s)'(\\\\|\\.|[^'\\])*'`, LiteralStringSingle, nil}, + {`([^\n:]+)(:+)([ \t]*)`, ByGroups(NameFunction, Operator, Text), Push("block-header")}, + {`\$\(`, Keyword, Push("expansion")}, + }, + "expansion": { + {`[^$a-zA-Z_()]+`, Text, nil}, + {`[a-zA-Z_]+`, NameVariable, nil}, + {`\$`, Keyword, nil}, + {`\(`, Keyword, Push()}, + {`\)`, Keyword, Pop(1)}, + }, + "export": { + {`[\w${}-]+`, NameVariable, nil}, + {`\n`, Text, Pop(1)}, + {`\s+`, Text, nil}, + }, + "block-header": { + {`[,|]`, Punctuation, nil}, + {`#.*?\n`, Comment, Pop(1)}, + {`\\\n`, Text, nil}, + {`\$\(`, Keyword, Push("expansion")}, + {`[a-zA-Z_]+`, Name, nil}, + {`\n`, Text, Pop(1)}, + {`.`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/m/mako.go b/vendor/github.com/alecthomas/chroma/lexers/m/mako.go new file mode 100644 index 000000000..f7c140d53 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/m/mako.go @@ -0,0 +1,60 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" + . "github.com/alecthomas/chroma/lexers/p" // nolint +) + +// Mako lexer. +var Mako = internal.Register(MustNewLexer( + &Config{ + Name: "Mako", + Aliases: []string{"mako"}, + Filenames: []string{"*.mao"}, + MimeTypes: []string{"application/x-mako"}, + }, + Rules{ + "root": { + {`(\s*)(%)(\s*end(?:\w+))(\n|\Z)`, ByGroups(Text, CommentPreproc, Keyword, Other), nil}, + {`(\s*)(%)([^\n]*)(\n|\Z)`, ByGroups(Text, CommentPreproc, Using(Python), Other), nil}, + {`(\s*)(##[^\n]*)(\n|\Z)`, ByGroups(Text, CommentPreproc, Other), nil}, + {`(?s)<%doc>.*?`, CommentPreproc, nil}, + {`(<%)([\w.:]+)`, ByGroups(CommentPreproc, NameBuiltin), Push("tag")}, + {`()`, ByGroups(CommentPreproc, NameBuiltin, CommentPreproc), nil}, + {`<%(?=([\w.:]+))`, CommentPreproc, Push("ondeftags")}, + {`(<%(?:!?))(.*?)(%>)(?s)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil}, + {`(\$\{)(.*?)(\})`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil}, + {`(?sx) + (.+?) # anything, followed by: + (?: + (?<=\n)(?=%|\#\#) | # an eval or comment line + (?=\#\*) | # multiline comment + (?=`, CommentPreproc, Pop(1)}, + {`\s+`, Text, nil}, + }, + "attr": { + {`".*?"`, LiteralString, Pop(1)}, + {`'.*?'`, LiteralString, Pop(1)}, + {`[^\s>]+`, LiteralString, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/m/markdown.go b/vendor/github.com/alecthomas/chroma/lexers/m/markdown.go new file mode 100644 index 000000000..3720da2b4 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/m/markdown.go @@ -0,0 +1,47 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Markdown lexer. +var Markdown = internal.Register(MustNewLexer( + &Config{ + Name: "markdown", + Aliases: []string{"md", "mkd"}, + Filenames: []string{"*.md", "*.mkd", "*.markdown"}, + MimeTypes: []string{"text/x-markdown"}, + }, + Rules{ + "root": { + {`^(#[^#].+\n)`, ByGroups(GenericHeading), nil}, + {`^(#{2,6}.+\n)`, ByGroups(GenericSubheading), nil}, + {`^(\s*)([*-] )(\[[ xX]\])( .+\n)`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil}, + {`^(\s*)([*-])(\s)(.+\n)`, ByGroups(Text, Keyword, Text, UsingSelf("inline")), nil}, + {`^(\s*)([0-9]+\.)( .+\n)`, ByGroups(Text, Keyword, UsingSelf("inline")), nil}, + {`^(\s*>\s)(.+\n)`, ByGroups(Keyword, GenericEmph), nil}, + {"^(```\\n)([\\w\\W]*?)(^```$)", ByGroups(String, Text, String), nil}, + {"^(```)(\\w+)(\\n)([\\w\\W]*?)(^```$)", + UsingByGroup( + internal.Get, + 2, 4, + String, String, String, Text, String, + ), + nil, + }, + Include("inline"), + }, + "inline": { + {`\\.`, Text, nil}, + {`(\s)([*_][^*_]+[*_])(\W|\n)`, ByGroups(Text, GenericEmph, Text), nil}, + {`(\s)((\*\*|__).*?)\3((?=\W|\n))`, ByGroups(Text, GenericStrong, GenericStrong, Text), nil}, + {`(\s)(~~[^~]+~~)((?=\W|\n))`, ByGroups(Text, GenericDeleted, Text), nil}, + {"`[^`]+`", LiteralStringBacktick, nil}, + {`[@#][\w/:]+`, NameEntity, nil}, + {`(!?\[)([^]]+)(\])(\()([^)]+)(\))`, ByGroups(Text, NameTag, Text, Text, NameAttribute, Text), nil}, + {`[^\\\s]+`, Text, nil}, + {`.|\n`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/m/mason.go b/vendor/github.com/alecthomas/chroma/lexers/m/mason.go new file mode 100644 index 000000000..5c70ab0a9 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/m/mason.go @@ -0,0 +1,43 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + . "github.com/alecthomas/chroma/lexers/h" // nolint + "github.com/alecthomas/chroma/lexers/internal" + . "github.com/alecthomas/chroma/lexers/p" // nolint +) + +// Mason lexer. +var Mason = internal.Register(MustNewLexer( + &Config{ + Name: "Mason", + Aliases: []string{"mason"}, + Filenames: []string{"*.m", "*.mhtml", "*.mc", "*.mi", "autohandler", "dhandler"}, + MimeTypes: []string{"application/x-mason"}, + Priority: 0.1, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`(<%doc>)(.*?)()(?s)`, ByGroups(NameTag, CommentMultiline, NameTag), nil}, + {`(<%(?:def|method))(\s*)(.*?)(>)(.*?)()(?s)`, ByGroups(NameTag, Text, NameFunction, NameTag, UsingSelf("root"), NameTag), nil}, + {`(<%\w+)(.*?)(>)(.*?)()(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using(Perl), NameTag), nil}, + {`(<&[^|])(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Perl), NameTag), nil}, + {`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Perl), NameTag), nil}, + {``, NameTag, nil}, + {`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using(Perl), NameTag), nil}, + {`(?<=^)#[^\n]*(\n|\Z)`, Comment, nil}, + {`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using(Perl), Other), nil}, + {`(?sx) + (.+?) # anything, followed by: + (?: + (?<=\n)(?=[%#]) | # an eval or comment line + (?=`, `:>`, `/.`, `+`, `-`, `*`, `/`, `^`, `&&`, `||`, `!`, `<>`, `|`, `/;`, `?`, `@`, `//`, `/@`, `@@`, `@@@`, `~~`, `===`, `&`, `<`, `>`, `<=`, `>=`), Operator, nil}, + {Words(``, ``, `,`, `;`, `(`, `)`, `[`, `]`, `{`, `}`), Punctuation, nil}, + {`".*?"`, LiteralString, nil}, + {`\s+`, TextWhitespace, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/m/matlab.go b/vendor/github.com/alecthomas/chroma/lexers/m/matlab.go new file mode 100644 index 000000000..5b0baa515 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/m/matlab.go @@ -0,0 +1,51 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Matlab lexer. +var Matlab = internal.Register(MustNewLexer( + &Config{ + Name: "Matlab", + Aliases: []string{"matlab"}, + Filenames: []string{"*.m"}, + MimeTypes: []string{"text/matlab"}, + }, + Rules{ + "root": { + {`\n`, Text, nil}, + {`^!.*`, LiteralStringOther, nil}, + {`%\{\s*\n`, CommentMultiline, Push("blockcomment")}, + {`%.*$`, Comment, nil}, + {`^\s*function`, Keyword, Push("deffunc")}, + {Words(``, `\b`, `break`, `case`, `catch`, `classdef`, `continue`, `else`, `elseif`, `end`, `enumerated`, `events`, `for`, `function`, `global`, `if`, `methods`, `otherwise`, `parfor`, `persistent`, `properties`, `return`, `spmd`, `switch`, `try`, `while`), Keyword, nil}, + {`(sin|sind|sinh|asin|asind|asinh|cos|cosd|cosh|acos|acosd|acosh|tan|tand|tanh|atan|atand|atan2|atanh|sec|secd|sech|asec|asecd|asech|csc|cscd|csch|acsc|acscd|acsch|cot|cotd|coth|acot|acotd|acoth|hypot|exp|expm1|log|log1p|log10|log2|pow2|realpow|reallog|realsqrt|sqrt|nthroot|nextpow2|abs|angle|complex|conj|imag|real|unwrap|isreal|cplxpair|fix|floor|ceil|round|mod|rem|sign|airy|besselj|bessely|besselh|besseli|besselk|beta|betainc|betaln|ellipj|ellipke|erf|erfc|erfcx|erfinv|expint|gamma|gammainc|gammaln|psi|legendre|cross|dot|factor|isprime|primes|gcd|lcm|rat|rats|perms|nchoosek|factorial|cart2sph|cart2pol|pol2cart|sph2cart|hsv2rgb|rgb2hsv|zeros|ones|eye|repmat|rand|randn|linspace|logspace|freqspace|meshgrid|accumarray|size|length|ndims|numel|disp|isempty|isequal|isequalwithequalnans|cat|reshape|diag|blkdiag|tril|triu|fliplr|flipud|flipdim|rot90|find|end|sub2ind|ind2sub|bsxfun|ndgrid|permute|ipermute|shiftdim|circshift|squeeze|isscalar|isvector|ans|eps|realmax|realmin|pi|i|inf|nan|isnan|isinf|isfinite|j|why|compan|gallery|hadamard|hankel|hilb|invhilb|magic|pascal|rosser|toeplitz|vander|wilkinson)\b`, NameBuiltin, nil}, + {`\.\.\..*$`, Comment, nil}, + {`-|==|~=|<|>|<=|>=|&&|&|~|\|\|?`, Operator, nil}, + {`\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\`, Operator, nil}, + {`\[|\]|\(|\)|\{|\}|:|@|\.|,`, Punctuation, nil}, + {`=|:|;`, Punctuation, nil}, + {`(?<=[\w)\].])\'+`, Operator, nil}, + {`(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`\d+[eEf][+-]?[0-9]+`, LiteralNumberFloat, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`(?|->|<-|\\/|xor|/\\)`, Operator, nil}, + {`(<|>|<=|>=|==|=|!=)`, Operator, nil}, + {`(\+|-|\*|/|div|mod)`, Operator, nil}, + {Words(`\b`, `\b`, `in`, `subset`, `superset`, `union`, `diff`, `symdiff`, `intersect`), Operator, nil}, + {`(\\|\.\.|\+\+)`, Operator, nil}, + {`[|()\[\]{},:;]`, Punctuation, nil}, + {`(true|false)\b`, KeywordConstant, nil}, + {`([+-]?)\d+(\.(?!\.)\d*)?([eE][-+]?\d+)?`, LiteralNumber, nil}, + {`::\s*([^\W\d]\w*)(\s*\([^\)]*\))?`, NameDecorator, nil}, + {`\b([^\W\d]\w*)\b(\()`, ByGroups(NameFunction, Punctuation), nil}, + {`[^\W\d]\w*`, NameOther, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/m/mlir.go b/vendor/github.com/alecthomas/chroma/lexers/m/mlir.go new file mode 100644 index 000000000..2ae4b00b0 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/m/mlir.go @@ -0,0 +1,43 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// MLIR lexer. +var Mlir = internal.Register(MustNewLexer( + &Config{ + Name: "MLIR", + Aliases: []string{"mlir"}, + Filenames: []string{"*.mlir"}, + MimeTypes: []string{"text/x-mlir"}, + }, + Rules{ + "root": { + Include("whitespace"), + {`c?"[^"]*?"`, LiteralString, nil}, + {`\^([-a-zA-Z$._][\w\-$.0-9]*)\s*`, NameLabel, nil}, + {`([\w\d_$.]+)\s*=`, NameLabel, nil}, + Include("keyword"), + {`->`, Punctuation, nil}, + {`@([\w_][\w\d_$.]*)`, NameFunction, nil}, + {`[%#][\w\d_$.]+`, NameVariable, nil}, + {`([1-9?][\d?]*\s*x)+`, LiteralNumber, nil}, + {`0[xX][a-fA-F0-9]+`, LiteralNumber, nil}, + {`-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?`, LiteralNumber, nil}, + {`[=<>{}\[\]()*.,!:]|x\b`, Punctuation, nil}, + {`[\w\d]+`, Text, nil}, + }, + "whitespace": { + {`(\n|\s)+`, Text, nil}, + {`//.*?\n`, Comment, nil}, + }, + "keyword": { + {Words(``, ``, `constant`, `return`), KeywordType, nil}, + {Words(``, ``, `func`, `loc`, `memref`, `tensor`, `vector`), KeywordType, nil}, + {`bf16|f16|f32|f64|index`, Keyword, nil}, + {`i[1-9]\d*`, Keyword, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/m/modula2.go b/vendor/github.com/alecthomas/chroma/lexers/m/modula2.go new file mode 100644 index 000000000..6fadb79f3 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/m/modula2.go @@ -0,0 +1,115 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Modula-2 lexer. +var Modula2 = internal.Register(MustNewLexer( + &Config{ + Name: "Modula-2", + Aliases: []string{"modula2", "m2"}, + Filenames: []string{"*.def", "*.mod"}, + MimeTypes: []string{"text/x-modula2"}, + DotAll: true, + }, + Rules{ + "whitespace": { + {`\n+`, Text, nil}, + {`\s+`, Text, nil}, + }, + "dialecttags": { + {`\(\*!m2pim\*\)`, CommentSpecial, nil}, + {`\(\*!m2iso\*\)`, CommentSpecial, nil}, + {`\(\*!m2r10\*\)`, CommentSpecial, nil}, + {`\(\*!objm2\*\)`, CommentSpecial, nil}, + {`\(\*!m2iso\+aglet\*\)`, CommentSpecial, nil}, + {`\(\*!m2pim\+gm2\*\)`, CommentSpecial, nil}, + {`\(\*!m2iso\+p1\*\)`, CommentSpecial, nil}, + {`\(\*!m2iso\+xds\*\)`, CommentSpecial, nil}, + }, + "identifiers": { + {`([a-zA-Z_$][\w$]*)`, Name, nil}, + }, + "prefixed_number_literals": { + {`0b[01]+(\'[01]+)*`, LiteralNumberBin, nil}, + {`0[ux][0-9A-F]+(\'[0-9A-F]+)*`, LiteralNumberHex, nil}, + }, + "plain_number_literals": { + {`[0-9]+(\'[0-9]+)*\.[0-9]+(\'[0-9]+)*[eE][+-]?[0-9]+(\'[0-9]+)*`, LiteralNumberFloat, nil}, + {`[0-9]+(\'[0-9]+)*\.[0-9]+(\'[0-9]+)*`, LiteralNumberFloat, nil}, + {`[0-9]+(\'[0-9]+)*`, LiteralNumberInteger, nil}, + }, + "suffixed_number_literals": { + {`[0-7]+B`, LiteralNumberOct, nil}, + {`[0-7]+C`, LiteralNumberOct, nil}, + {`[0-9A-F]+H`, LiteralNumberHex, nil}, + }, + "string_literals": { + {`'(\\\\|\\'|[^'])*'`, LiteralString, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + }, + "digraph_operators": { + {`\*\.`, Operator, nil}, + {`\+>`, Operator, nil}, + {`<>`, Operator, nil}, + {`<=`, Operator, nil}, + {`>=`, Operator, nil}, + {`==`, Operator, nil}, + {`::`, Operator, nil}, + {`:=`, Operator, nil}, + {`\+\+`, Operator, nil}, + {`--`, Operator, nil}, + }, + "unigraph_operators": { + {`[+-]`, Operator, nil}, + {`[*/]`, Operator, nil}, + {`\\`, Operator, nil}, + {`[=#<>]`, Operator, nil}, + {`\^`, Operator, nil}, + {`@`, Operator, nil}, + {`&`, Operator, nil}, + {`~`, Operator, nil}, + {"`", Operator, nil}, + }, + "digraph_punctuation": { + {`\.\.`, Punctuation, nil}, + {`<<`, Punctuation, nil}, + {`>>`, Punctuation, nil}, + {`->`, Punctuation, nil}, + {`\|#`, Punctuation, nil}, + {`##`, Punctuation, nil}, + {`\|\*`, Punctuation, nil}, + }, + "unigraph_punctuation": { + {`[()\[\]{},.:;|]`, Punctuation, nil}, + {`!`, Punctuation, nil}, + {`\?`, Punctuation, nil}, + }, + "comments": { + {`^//.*?\n`, CommentSingle, nil}, + {`\(\*([^$].*?)\*\)`, CommentMultiline, nil}, + {`/\*(.*?)\*/`, CommentMultiline, nil}, + }, + "pragmas": { + {`<\*.*?\*>`, CommentPreproc, nil}, + {`\(\*\$.*?\*\)`, CommentPreproc, nil}, + }, + "root": { + Include("whitespace"), + Include("dialecttags"), + Include("pragmas"), + Include("comments"), + Include("identifiers"), + Include("suffixed_number_literals"), + Include("prefixed_number_literals"), + Include("plain_number_literals"), + Include("string_literals"), + Include("digraph_punctuation"), + Include("digraph_operators"), + Include("unigraph_punctuation"), + Include("unigraph_operators"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/m/monkeyc.go b/vendor/github.com/alecthomas/chroma/lexers/m/monkeyc.go new file mode 100644 index 000000000..828ff0bff --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/m/monkeyc.go @@ -0,0 +1,62 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +var MonkeyC = internal.Register(MustNewLexer( + &Config{ + Name: "MonkeyC", + Aliases: []string{"monkeyc"}, + Filenames: []string{"*.mc"}, + MimeTypes: []string{"text/x-monkeyc"}, + }, + Rules{ + "root": { + {`[^\S\n]+`, Text, nil}, + {`\n`, Text, nil}, + {`//(\n|[\w\W]*?[^\\]\n)`, CommentSingle, nil}, + {`/(\\\n)?[*][\w\W]*?[*](\\\n)?/`, CommentMultiline, nil}, + {`/(\\\n)?[*][\w\W]*`, CommentMultiline, nil}, + {`:[a-zA-Z_][\w_\.]*`, StringSymbol, nil}, + {`[{}\[\]\(\),;:\.]`, Punctuation, nil}, + {`[&~\|\^!+\-*\/%=?]`, Operator, nil}, + {`=>|[+-]=|&&|\|\||>>|<<|[<>]=?|[!=]=`, Operator, nil}, + {`\b(and|or|instanceof|has|extends|new)`, OperatorWord, nil}, + {Words(``, `\b`, `NaN`, `null`, `true`, `false`), KeywordConstant, nil}, + {`(using)((?:\s|\\\\s)+)`, ByGroups(KeywordNamespace, Text), Push("import")}, + {`(class)((?:\s|\\\\s)+)`, ByGroups(KeywordDeclaration, Text), Push("class")}, + {`(function)((?:\s|\\\\s)+)`, ByGroups(KeywordDeclaration, Text), Push("function")}, + {`(module)((?:\s|\\\\s)+)`, ByGroups(KeywordDeclaration, Text), Push("module")}, + {`\b(if|else|for|switch|case|while|break|continue|default|do|try|catch|finally|return|throw|extends|function)\b`, Keyword, nil}, + {`\b(const|enum|hidden|public|protected|private|static)\b`, KeywordType, nil}, + {`\bvar\b`, KeywordDeclaration, nil}, + {`\b(Activity(Monitor|Recording)?|Ant(Plus)?|Application|Attention|Background|Communications|Cryptography|FitContributor|Graphics|Gregorian|Lang|Math|Media|Persisted(Content|Locations)|Position|Properties|Sensor(History|Logging)?|Storage|StringUtil|System|Test|Time(r)?|Toybox|UserProfile|WatchUi|Rez|Drawables|Strings|Fonts|method)\b`, NameBuiltin, nil}, + {`\b(me|self|\$)\b`, NameBuiltinPseudo, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\'|[^''])*'`, LiteralStringSingle, nil}, + {`-?(0x[0-9a-fA-F]+l?)`, NumberHex, nil}, + {`-?([0-9]+(\.[0-9]+[df]?|[df]))\b`, NumberFloat, nil}, + {`-?([0-9]+l?)`, NumberInteger, nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + }, + "import": { + {`([a-zA-Z_][\w_\.]*)(?:(\s+)(as)(\s+)([a-zA-Z_][\w_]*))?`, ByGroups(NameNamespace, Text, KeywordNamespace, Text, NameNamespace), nil}, + Default(Pop(1)), + }, + "class": { + {`([a-zA-Z_][\w_\.]*)(?:(\s+)(extends)(\s+)([a-zA-Z_][\w_\.]*))?`, ByGroups(NameClass, Text, KeywordDeclaration, Text, NameClass), nil}, + Default(Pop(1)), + }, + "function": { + {`initialize`, NameFunctionMagic, nil}, + {`[a-zA-Z_][\w_\.]*`, NameFunction, nil}, + Default(Pop(1)), + }, + "module": { + {`[a-zA-Z_][\w_\.]*`, NameNamespace, nil}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/m/mwscript.go b/vendor/github.com/alecthomas/chroma/lexers/m/mwscript.go new file mode 100644 index 000000000..b86bbdfee --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/m/mwscript.go @@ -0,0 +1,53 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// MorrowindScript lexer. +var MorrowindScript = internal.Register(MustNewLexer( + &Config{ + Name: "MorrowindScript", + Aliases: []string{"morrowind", "mwscript"}, + Filenames: []string{}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`;.*$`, Comment, nil}, + {`(["'])(?:(?=(\\?))\2.)*?\1`, LiteralString, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`[0-9]+\.[0-9]*(?!\.)`, LiteralNumberFloat, nil}, + Include("keywords"), + Include("types"), + Include("builtins"), + Include("punct"), + Include("operators"), + {`\n`, Text, nil}, + {`\S+\s+`, Text, nil}, + {`[a-zA-Z0-9_]\w*`, Name, nil}, + }, + "keywords": { + {`(?i)(begin|if|else|elseif|endif|while|endwhile|return|to)\b`, Keyword, nil}, + {`(?i)(end)\b`, Keyword, nil}, + {`(?i)(end)\w+.*$`, Text, nil}, + {`[\w+]->[\w+]`, Operator, nil}, + }, + "builtins": { + {`(?i)(Activate|AddItem|AddSoulGem|AddSpell|AddToLevCreature|AddToLevItem|AddTopic|AIActivate|AIEscort|AIEscortCell|AIFollow|AiFollowCell|AITravel|AIWander|BecomeWerewolf|Cast|ChangeWeather|Choice|ClearForceJump|ClearForceMoveJump|ClearForceRun|ClearForceSneak|ClearInfoActor|Disable|DisableLevitation|DisablePlayerControls|DisablePlayerFighting|DisablePlayerJumping|DisablePlayerLooking|DisablePlayerMagic|DisablePlayerViewSwitch|DisableTeleporting|DisableVanityMode|DontSaveObject|Drop|Enable|EnableBirthMenu|EnableClassMenu|EnableInventoryMenu|EnableLevelUpMenu|EnableLevitation|EnableMagicMenu|EnableMapMenu|EnableNameMenu|EnablePlayerControls|EnablePlayerFighting|EnablePlayerJumping|EnablePlayerLooking|EnablePlayerMagic|EnablePlayerViewSwitch|EnableRaceMenu|EnableRest|EnableStatsMenu|EnableTeleporting|EnableVanityMode|Equip|ExplodeSpell|Face|FadeIn|FadeOut|FadeTo|Fall|ForceGreeting|ForceJump|ForceRun|ForceSneak|Flee|GotoJail|HurtCollidingActor|HurtStandingActor|Journal|Lock|LoopGroup|LowerRank|MenuTest|MessageBox|ModAcrobatics|ModAgility|ModAlarm|ModAlchemy|ModAlteration|ModArmorBonus|ModArmorer|ModAthletics|ModAttackBonus|ModAxe|ModBlock|ModBluntWeapon|ModCastPenalty|ModChameleon|ModConjuration|ModCurrentFatigue|ModCurrentHealth|ModCurrentMagicka|ModDefendBonus|ModDestruction|ModDisposition|ModEnchant|ModEndurance|ModFactionReaction|ModFatigue|ModFight|ModFlee|ModFlying|ModHandToHand|ModHealth|ModHeavyArmor|ModIllusion|ModIntelligence|ModInvisible|ModLightArmor|ModLongBlade|ModLuck|ModMagicka|ModMarksman|ModMediumArmor|ModMercantile|ModMysticism|ModParalysis|ModPCCrimeLevel|ModPCFacRep|ModPersonality|ModRegion|ModReputation|ModResistBlight|ModResistCorprus|ModResistDisease|ModResistFire|ModResistFrost|ModResistMagicka|ModResistNormalWeapons|ModResistParalysis|ModResistPoison|ModResistShock|ModRestoration|ModScale|ModSecurity|ModShortBlade|ModSilence|ModSneak|ModSpear|ModSpeechcraft|ModSpeed|ModStrength|ModSuperJump|ModSwimSpeed|ModUnarmored|ModWaterBreathing|ModWaterLevel|ModWaterWalking|ModWillpower|Move|MoveWorld|PayFine|PayFineThief|PCClearExpelled|PCExpell|PCForce1stPerson|PCForce3rdPerson|PCJoinFaction|PCLowerRank|PCRaiseRank|PlaceAtMe|PlaceAtPC|PlaceItem|PlaceItemCell|PlayBink|PlayGroup|PlayLoopSound3D|PlayLoopSound3DVP|PlaySound|PlaySound3D|PlaySound3DVP|PlaySoundVP|Position|PositionCell|RaiseRank|RemoveEffects|RemoveFromLevCreature|RemoveFromLevItem|RemoveItem|RemoveSoulgem|RemoveSpell|RemoveSpellEffects|ResetActors|Resurrect|Rotate|RotateWorld|Say|StartScript|[S|s]et|SetAcrobatics|SetAgility|SetAlarm|SetAlchemy|SetAlteration|SetAngle|SetArmorBonus|SetArmorer|SetAthletics|SetAtStart|SetAttackBonus|SetAxe|SetBlock|SetBluntWeapon|SetCastPenalty|SetChameleon|SetConjuration|SetDelete|SetDefendBonus|SetDestruction|SetDisposition|SetEnchant|SetEndurance|SetFactionReaction|SetFatigue|SetFight|SetFlee|SetFlying|SetHandToHand|SetHealth|SetHeavyArmor|SetIllusion|SetIntelligence|SetInvisible|SetJournalIndex|SetLightArmor|SetLevel|SetLongBlade|SetLuck|SetMagicka|SetMarksman|SetMediumArmor|SetMercantile|SetMysticism|SetParalysis|SetPCCCrimeLevel|SetPCFacRep|SetPersonality|SetPos|SetReputation|SetResistBlight|SetResistCorprus|SetResistDisease|SetResistFire|SetResistFrost|SetResistMagicka|SetResistNormalWeapons|SetResistParalysis|SetResistPoison|SetResistShock|SetRestoration|SetScale|SetSecurity|SetShortBlade|SetSilence|SetSneak|SetSpear|SetSpeechcraft|SetSpeed|SetStrength|SetSuperJump|SetSwimSpeed|SetUnarmored|SetWaterBreathing|SetWaterlevel|SetWaterWalking|SetWerewolfAcrobatics|SetWillpower|ShowMap|ShowRestMenu|SkipAnim|StartCombat|StopCombat|StopScript|StopSound|StreamMusic|TurnMoonRed|TurnMoonWhite|UndoWerewolf|Unlock|WakeUpPC|CenterOnCell|CenterOnExterior|FillMap|FixMe|ToggleAI|ToggleCollision|ToggleFogOfWar|ToggleGodMode|ToggleMenus|ToggleSky|ToggleWorld|ToggleVanityMode|CellChanged|GetAcrobatics|GetAgility|GetAIPackageDone|GetAlarm|GetAlchemy|GetAlteration|GetAngle|GetArmorBonus|GetArmorer|GetAthletics|GetAttackBonus|GetAttacked|GetArmorType,|GetAxe|GetBlightDisease|GetBlock|GetBluntWeapon|GetButtonPressed|GetCastPenalty|GetChameleon|GetCollidingActor|GetCollidingPC|GetCommonDisease|GetConjuration|GetCurrentAIPackage|GetCurrentTime|GetCurrentWeather|GetDeadCount|GetDefendBonus|GetDestruction|GetDetected|GetDisabled|GetDisposition|GetDistance|GetEffect|GetEnchant|GetEndurance|GetFatigue|GetFight|GetFlee|GetFlying|GetForceJump|GetForceRun|GetForceSneak|GetHandToHand|GetHealth|GetHealthGetRatio|GetHeavyArmor|GetIllusion|GetIntelligence|GetInterior|GetInvisible|GetItemCount|GetJournalIndex|GetLightArmor|GetLineOfSight|GetLOS|GetLevel|GetLocked|GetLongBlade|GetLuck|GetMagicka|GetMarksman|GetMasserPhase|GetSecundaPhase|GetMediumArmor|GetMercantile|GetMysticism|GetParalysis|GetPCCell|GetPCCrimeLevel|GetPCinJail|GetPCJumping|GetPCRank|GetPCRunning|GetPCSleep|GetPCSneaking|GetPCTraveling|GetPersonality|GetPlayerControlsDisabled|GetPlayerFightingDisabled|GetPlayerJumpingDisabled|GetPlayerLookingDisabled|GetPlayerMagicDisabled|GetPos|GetRace|GetReputation|GetResistBlight|GetResistCorprus|GetResistDisease|GetResistFire|GetResistFrost|GetResistMagicka|GetResistNormalWeapons|GetResistParalysis|GetResistPoison|GetResistShock|GetRestoration|GetScale|GetSecondsPassed|GetSecurity|GetShortBlade|GetSilence|GetSneak|GetSoundPlaying|GetSpear|GetSpeechcraft|GetSpeed|GetSpell|GetSpellEffects|GetSpellReadied|GetSquareRoot|GetStandingActor|GetStandingPC|GetStrength|GetSuperJump|GetSwimSpeed|GetTarget|GetUnarmored|GetVanityModeDisabled|GetWaterBreathing|GetWaterLevel|GetWaterWalking|GetWeaponDrawn|GetWeaponType|GetWerewolfKills|GetWillpower|GetWindSpeed|HasItemEquipped|HasSoulgem|HitAttemptOnMe|HitOnMe|IsWerewolf|MenuMode|OnActivate|OnDeath|OnKnockout|OnMurder|PCExpelled|PCGet3rdPerson|PCKnownWerewolf|Random|RepairedOnMe|SameFaction|SayDone|ScriptRunning|AllowWereWolfForceGreeting|Companion|MinimumProfit|NoFlee|NoHello|NoIdle|NoLore|OnPCAdd|OnPCDrop|OnPCEquip|OnPCHitMe|OnPCRepair|PCSkipEquip|OnPCSoulGemUse|StayOutside|CrimeGoldDiscount|CrimeGoldTurnIn|Day|DaysPassed|GameHour|Month|NPCVoiceDistance|PCRace|PCWerewolf|PCVampire|TimeScale|VampClan|Year)\b`, NameBuiltin, nil}, + {`(?i)(sEffectWaterBreathing|sEffectSwiftSwim|sEffectWaterWalking|sEffectShield|sEffectFireShield|sEffectLightningShield|sEffectFrostShield|sEffectBurden|sEffectFeather|sEffectJump|sEffectLevitate|sEffectSlowFall|sEffectLock|sEffectOpen|sEffectFireDamage|sEffectShockDamage|sEffectFrostDamage|sEffectDrainAttribute|sEffectDrainHealth|sEffectDrainSpellpoints|sEffectDrainFatigue|sEffectDrainSkill|sEffectDamageAttribute|sEffectDamageHealth|sEffectDamageMagicka|sEffectDamageFatigue|sEffectDamageSkill|sEffectPoison|sEffectWeaknessToFire|sEffectWeaknessToFrost|sEffectWeaknessToShock|sEffectWeaknessToMagicka|sEffectWeaknessToCommonDisease|sEffectWeaknessToBlightDisease|sEffectWeaknessToCorprusDisease|sEffectWeaknessToPoison|sEffectWeaknessToNormalWeapons|sEffectDisintegrateWeapon|sEffectDisintegrateArmor|sEffectInvisibility|sEffectChameleon|sEffectLight|sEffectSanctuary|sEffectNightEye|sEffectCharm|sEffectParalyze|sEffectSilence|sEffectBlind|sEffectSound|sEffectCalmHumanoid|sEffectCalmCreature|sEffectFrenzyHumanoid|sEffectFrenzyCreature|sEffectDemoralizeHumanoid|sEffectDemoralizeCreature|sEffectRallyHumanoid|sEffectRallyCreature|sEffectDispel|sEffectSoultrap|sEffectTelekinesis|sEffectMark|sEffectRecall|sEffectDivineIntervention|sEffectAlmsiviIntervention|sEffectDetectAnimal|sEffectDetectEnchantment|sEffectDetectKey|sEffectSpellAbsorption|sEffectReflect|sEffectCureCommonDisease|sEffectCureBlightDisease|sEffectCureCorprusDisease|sEffectCurePoison|sEffectCureParalyzation|sEffectRestoreAttribute|sEffectRestoreHealth|sEffectRestoreSpellPoints|sEffectRestoreFatigue|sEffectRestoreSkill|sEffectFortifyAttribute|sEffectFortifyHealth|sEffectFortifySpellpoints|sEffectFortifyFatigue|sEffectFortifySkill|sEffectFortifyMagickaMultiplier|sEffectAbsorbAttribute|sEffectAbsorbHealth|sEffectAbsorbSpellPoints|sEffectAbsorbFatigue|sEffectAbsorbSkill|sEffectResistFire|sEffectResistFrost|sEffectResistShock|sEffectResistMagicka|sEffectResistCommonDisease|sEffectResistBlightDisease|sEffectResistCorprusDisease|sEffectResistPoison|sEffectResistNormalWeapons|sEffectResistParalysis|sEffectRemoveCurse|sEffectTurnUndead|sEffectSummonScamp|sEffectSummonClannfear|sEffectSummonDaedroth|sEffectSummonDremora|sEffectSummonAncestralGhost|sEffectSummonSkeletalMinion|sEffectSummonLeastBonewalker|sEffectSummonGreaterBonewalker|sEffectSummonBonelord|sEffectSummonWingedTwilight|sEffectSummonHunger|sEffectSummonGoldensaint|sEffectSummonFlameAtronach|sEffectSummonFrostAtronach|sEffectSummonStormAtronach|sEffectFortifyAttackBonus|sEffectCommandCreatures|sEffectCommandHumanoids|sEffectBoundDagger|sEffectBoundLongsword|sEffectBoundMace|sEffectBoundBattleAxe|sEffectBoundSpear|sEffectBoundLongbow|sEffectExtraSpell|sEffectBoundCuirass|sEffectBoundHelm|sEffectBoundBoots|sEffectBoundShield|sEffectBoundGloves|sEffectCorpus|sEffectVampirism|sEffectSummonCenturionSphere|sEffectSunDamage|sEffectStuntedMagicka)`, NameBuiltin, nil}, + }, + "types": { + {`(?i)(short|long|float)\b`, KeywordType, nil}, + }, + "punct": { + {`[()]`, Punctuation, nil}, + }, + "operators": { + {`[#=,./%+\-?]`, Operator, nil}, + {`(==|<=|<|>=|>|!=)`, Operator, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/m/myghty.go b/vendor/github.com/alecthomas/chroma/lexers/m/myghty.go new file mode 100644 index 000000000..02a20eae5 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/m/myghty.go @@ -0,0 +1,40 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" + . "github.com/alecthomas/chroma/lexers/p" // nolint +) + +// Myghty lexer. +var Myghty = internal.Register(MustNewLexer( + &Config{ + Name: "Myghty", + Aliases: []string{"myghty"}, + Filenames: []string{"*.myt", "autodelegate"}, + MimeTypes: []string{"application/x-myghty"}, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`(<%(?:def|method))(\s*)(.*?)(>)(.*?)()(?s)`, ByGroups(NameTag, Text, NameFunction, NameTag, UsingSelf("root"), NameTag), nil}, + {`(<%\w+)(.*?)(>)(.*?)()(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using(Python), NameTag), nil}, + {`(<&[^|])(.*?)(,.*?)?(&>)`, ByGroups(NameTag, NameFunction, Using(Python), NameTag), nil}, + {`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Python), NameTag), nil}, + {``, NameTag, nil}, + {`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using(Python), NameTag), nil}, + {`(?<=^)#[^\n]*(\n|\Z)`, Comment, nil}, + {`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using(Python), Other), nil}, + {`(?sx) + (.+?) # anything, followed by: + (?: + (?<=\n)(?=[%#]) | # an eval or comment line + (?==~!@#%^&|`?-]", Operator, nil}, + {`\b(tinyint|smallint|mediumint|int|integer|bigint|date|datetime|time|bit|bool|tinytext|mediumtext|longtext|text|tinyblob|mediumblob|longblob|blob|float|double|double\s+precision|real|numeric|dec|decimal|timestamp|year|char|varchar|varbinary|varcharacter|enum|set)(\b\s*)(\()?`, ByGroups(KeywordType, Text, Punctuation), nil}, + {`\b(add|all|alter|analyze|and|as|asc|asensitive|before|between|bigint|binary|blob|both|by|call|cascade|case|change|char|character|check|collate|column|condition|constraint|continue|convert|create|cross|current_date|current_time|current_timestamp|current_user|cursor|database|databases|day_hour|day_microsecond|day_minute|day_second|dec|decimal|declare|default|delayed|delete|desc|describe|deterministic|distinct|distinctrow|div|double|drop|dual|each|else|elseif|enclosed|escaped|exists|exit|explain|fetch|flush|float|float4|float8|for|force|foreign|from|fulltext|grant|group|having|high_priority|hour_microsecond|hour_minute|hour_second|identified|if|ignore|in|index|infile|inner|inout|insensitive|insert|int|int1|int2|int3|int4|int8|integer|interval|into|is|iterate|join|key|keys|kill|leading|leave|left|like|limit|lines|load|localtime|localtimestamp|lock|long|loop|low_priority|match|minute_microsecond|minute_second|mod|modifies|natural|no_write_to_binlog|not|numeric|on|optimize|option|optionally|or|order|out|outer|outfile|precision|primary|privileges|procedure|purge|raid0|read|reads|real|references|regexp|release|rename|repeat|replace|require|restrict|return|revoke|right|rlike|schema|schemas|second_microsecond|select|sensitive|separator|set|show|smallint|soname|spatial|specific|sql|sql_big_result|sql_calc_found_rows|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|starting|straight_join|table|terminated|then|to|trailing|trigger|undo|union|unique|unlock|unsigned|update|usage|use|user|using|utc_date|utc_time|utc_timestamp|values|varying|when|where|while|with|write|x509|xor|year_month|zerofill)\b`, Keyword, nil}, + {`\b(auto_increment|engine|charset|tables)\b`, KeywordPseudo, nil}, + {`(true|false|null)`, NameConstant, nil}, + {`([a-z_]\w*)(\s*)(\()`, ByGroups(NameFunction, Text, Punctuation), nil}, + {`[a-z_]\w*`, Name, nil}, + {`@[a-z0-9]*[._]*[a-z0-9]*`, NameVariable, nil}, + {`[;:()\[\],.]`, Punctuation, nil}, + }, + "multiline-comments": { + {`/\*`, CommentMultiline, Push("multiline-comments")}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[^/*]+`, CommentMultiline, nil}, + {`[/*]`, CommentMultiline, nil}, + }, + "string": { + {`[^']+`, LiteralStringSingle, nil}, + {`''`, LiteralStringSingle, nil}, + {`'`, LiteralStringSingle, Pop(1)}, + }, + "double-string": { + {`[^"]+`, LiteralStringDouble, nil}, + {`""`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/n/nasm.go b/vendor/github.com/alecthomas/chroma/lexers/n/nasm.go new file mode 100644 index 000000000..d769d1575 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/n/nasm.go @@ -0,0 +1,59 @@ +package n + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Nasm lexer. +var Nasm = internal.Register(MustNewLexer( + &Config{ + Name: "NASM", + Aliases: []string{"nasm"}, + Filenames: []string{"*.asm", "*.ASM"}, + MimeTypes: []string{"text/x-nasm"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`^\s*%`, CommentPreproc, Push("preproc")}, + Include("whitespace"), + {`[a-z$._?][\w$.?#@~]*:`, NameLabel, nil}, + {`([a-z$._?][\w$.?#@~]*)(\s+)(equ)`, ByGroups(NameConstant, KeywordDeclaration, KeywordDeclaration), Push("instruction-args")}, + {`BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|ORG|ALIGN|STRUC|ENDSTRUC|COMMON|CPU|GROUP|UPPERCASE|IMPORT|EXPORT|LIBRARY|MODULE`, Keyword, Push("instruction-args")}, + {`(?:res|d)[bwdqt]|times`, KeywordDeclaration, Push("instruction-args")}, + {`[a-z$._?][\w$.?#@~]*`, NameFunction, Push("instruction-args")}, + {`[\r\n]+`, Text, nil}, + }, + "instruction-args": { + {"\"(\\\\\"|[^\"\\n])*\"|'(\\\\'|[^'\\n])*'|`(\\\\`|[^`\\n])*`", LiteralString, nil}, + {`(?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)`, LiteralNumberHex, nil}, + {`[0-7]+q`, LiteralNumberOct, nil}, + {`[01]+b`, LiteralNumberBin, nil}, + {`[0-9]+\.e?[0-9]+`, LiteralNumberFloat, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + Include("punctuation"), + {`r[0-9][0-5]?[bwd]|[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]`, NameBuiltin, nil}, + {`[a-z$._?][\w$.?#@~]*`, NameVariable, nil}, + {`[\r\n]+`, Text, Pop(1)}, + Include("whitespace"), + }, + "preproc": { + {`[^;\n]+`, CommentPreproc, nil}, + {`;.*?\n`, CommentSingle, Pop(1)}, + {`\n`, CommentPreproc, Pop(1)}, + }, + "whitespace": { + {`\n`, Text, nil}, + {`[ \t]+`, Text, nil}, + {`;.*`, CommentSingle, nil}, + }, + "punctuation": { + {`[,():\[\]]+`, Punctuation, nil}, + {`[&|^<>+*/%~-]+`, Operator, nil}, + {`[$]+`, KeywordConstant, nil}, + {`seg|wrt|strict`, OperatorWord, nil}, + {`byte|[dq]?word`, KeywordType, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/n/newspeak.go b/vendor/github.com/alecthomas/chroma/lexers/n/newspeak.go new file mode 100644 index 000000000..1a6a37bd2 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/n/newspeak.go @@ -0,0 +1,55 @@ +package n + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Newspeak lexer. +var Newspeak = internal.Register(MustNewLexer( + &Config{ + Name: "Newspeak", + Aliases: []string{"newspeak"}, + Filenames: []string{"*.ns2"}, + MimeTypes: []string{"text/x-newspeak"}, + }, + Rules{ + "root": { + {`\b(Newsqueak2)\b`, KeywordDeclaration, nil}, + {`'[^']*'`, LiteralString, nil}, + {`\b(class)(\s+)(\w+)(\s*)`, ByGroups(KeywordDeclaration, Text, NameClass, Text), nil}, + {`\b(mixin|self|super|private|public|protected|nil|true|false)\b`, Keyword, nil}, + {`(\w+\:)(\s*)([a-zA-Z_]\w+)`, ByGroups(NameFunction, Text, NameVariable), nil}, + {`(\w+)(\s*)(=)`, ByGroups(NameAttribute, Text, Operator), nil}, + {`<\w+>`, CommentSpecial, nil}, + Include("expressionstat"), + Include("whitespace"), + }, + "expressionstat": { + {`(\d+\.\d*|\.\d+|\d+[fF])[fF]?`, LiteralNumberFloat, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`:\w+`, NameVariable, nil}, + {`(\w+)(::)`, ByGroups(NameVariable, Operator), nil}, + {`\w+:`, NameFunction, nil}, + {`\w+`, NameVariable, nil}, + {`\(|\)`, Punctuation, nil}, + {`\[|\]`, Punctuation, nil}, + {`\{|\}`, Punctuation, nil}, + {`(\^|\+|\/|~|\*|<|>|=|@|%|\||&|\?|!|,|-|:)`, Operator, nil}, + {`\.|;`, Punctuation, nil}, + Include("whitespace"), + Include("literals"), + }, + "literals": { + {`\$.`, LiteralString, nil}, + {`'[^']*'`, LiteralString, nil}, + {`#'[^']*'`, LiteralStringSymbol, nil}, + {`#\w+:?`, LiteralStringSymbol, nil}, + {`#(\+|\/|~|\*|<|>|=|@|%|\||&|\?|!|,|-)+`, LiteralStringSymbol, nil}, + }, + "whitespace": { + {`\s+`, Text, nil}, + {`"[^"]*"`, Comment, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/n/nginx.go b/vendor/github.com/alecthomas/chroma/lexers/n/nginx.go new file mode 100644 index 000000000..840d100b7 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/n/nginx.go @@ -0,0 +1,47 @@ +package n + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Nginx Configuration File lexer. +var Nginx = internal.Register(MustNewLexer( + &Config{ + Name: "Nginx configuration file", + Aliases: []string{"nginx"}, + Filenames: []string{"nginx.conf"}, + MimeTypes: []string{"text/x-nginx-conf"}, + }, + Rules{ + "root": { + {`(include)(\s+)([^\s;]+)`, ByGroups(Keyword, Text, Name), nil}, + {`[^\s;#]+`, Keyword, Push("stmt")}, + Include("base"), + }, + "block": { + {`\}`, Punctuation, Pop(2)}, + {`[^\s;#]+`, KeywordNamespace, Push("stmt")}, + Include("base"), + }, + "stmt": { + {`\{`, Punctuation, Push("block")}, + {`;`, Punctuation, Pop(1)}, + Include("base"), + }, + "base": { + {`#.*\n`, CommentSingle, nil}, + {`on|off`, NameConstant, nil}, + {`\$[^\s;#()]+`, NameVariable, nil}, + {`([a-z0-9.-]+)(:)([0-9]+)`, ByGroups(Name, Punctuation, LiteralNumberInteger), nil}, + {`[a-z-]+/[a-z-+]+`, LiteralString, nil}, + {`[0-9]+[km]?\b`, LiteralNumberInteger, nil}, + {`(~)(\s*)([^\s{]+)`, ByGroups(Punctuation, Text, LiteralStringRegex), nil}, + {`[:=~]`, Punctuation, nil}, + {`[^\s;#{}$]+`, LiteralString, nil}, + {`/[^\s;#]*`, Name, nil}, + {`\s+`, Text, nil}, + {`[$;]`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/n/nim.go b/vendor/github.com/alecthomas/chroma/lexers/n/nim.go new file mode 100644 index 000000000..b08c2f94d --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/n/nim.go @@ -0,0 +1,93 @@ +package n + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Nim lexer. +var Nim = internal.Register(MustNewLexer( + &Config{ + Name: "Nim", + Aliases: []string{"nim", "nimrod"}, + Filenames: []string{"*.nim", "*.nimrod"}, + MimeTypes: []string{"text/x-nim"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`#\[[\s\S]*?\]#`, CommentMultiline, nil}, + {`##.*$`, LiteralStringDoc, nil}, + {`#.*$`, Comment, nil}, + {`[*=><+\-/@$~&%!?|\\\[\]]`, Operator, nil}, + {"\\.\\.|\\.|,|\\[\\.|\\.\\]|\\{\\.|\\.\\}|\\(\\.|\\.\\)|\\{|\\}|\\(|\\)|:|\\^|`|;", Punctuation, nil}, + {`(?:[\w]+)"`, LiteralString, Push("rdqs")}, + {`"""`, LiteralString, Push("tdqs")}, + {`"`, LiteralString, Push("dqs")}, + {`'`, LiteralStringChar, Push("chars")}, + {`(a_?n_?d_?|o_?r_?|n_?o_?t_?|x_?o_?r_?|s_?h_?l_?|s_?h_?r_?|d_?i_?v_?|m_?o_?d_?|i_?n_?|n_?o_?t_?i_?n_?|i_?s_?|i_?s_?n_?o_?t_?)\b`, OperatorWord, nil}, + {`(p_?r_?o_?c_?\s)(?![(\[\]])`, Keyword, Push("funcname")}, + {`(a_?d_?d_?r_?|a_?n_?d_?|a_?s_?|a_?s_?m_?|a_?t_?o_?m_?i_?c_?|b_?i_?n_?d_?|b_?l_?o_?c_?k_?|b_?r_?e_?a_?k_?|c_?a_?s_?e_?|c_?a_?s_?t_?|c_?o_?n_?c_?e_?p_?t_?|c_?o_?n_?s_?t_?|c_?o_?n_?t_?i_?n_?u_?e_?|c_?o_?n_?v_?e_?r_?t_?e_?r_?|d_?e_?f_?e_?r_?|d_?i_?s_?c_?a_?r_?d_?|d_?i_?s_?t_?i_?n_?c_?t_?|d_?i_?v_?|d_?o_?|e_?l_?i_?f_?|e_?l_?s_?e_?|e_?n_?d_?|e_?n_?u_?m_?|e_?x_?c_?e_?p_?t_?|e_?x_?p_?o_?r_?t_?|f_?i_?n_?a_?l_?l_?y_?|f_?o_?r_?|f_?u_?n_?c_?|i_?f_?|i_?n_?|y_?i_?e_?l_?d_?|i_?n_?t_?e_?r_?f_?a_?c_?e_?|i_?s_?|i_?s_?n_?o_?t_?|i_?t_?e_?r_?a_?t_?o_?r_?|l_?e_?t_?|m_?a_?c_?r_?o_?|m_?e_?t_?h_?o_?d_?|m_?i_?x_?i_?n_?|m_?o_?d_?|n_?o_?t_?|n_?o_?t_?i_?n_?|o_?b_?j_?e_?c_?t_?|o_?f_?|o_?r_?|o_?u_?t_?|p_?r_?o_?c_?|p_?t_?r_?|r_?a_?i_?s_?e_?|r_?e_?f_?|r_?e_?t_?u_?r_?n_?|s_?h_?a_?r_?e_?d_?|s_?h_?l_?|s_?h_?r_?|s_?t_?a_?t_?i_?c_?|t_?e_?m_?p_?l_?a_?t_?e_?|t_?r_?y_?|t_?u_?p_?l_?e_?|t_?y_?p_?e_?|w_?h_?e_?n_?|w_?h_?i_?l_?e_?|w_?i_?t_?h_?|w_?i_?t_?h_?o_?u_?t_?|x_?o_?r_?)\b`, Keyword, nil}, + {`(f_?r_?o_?m_?|i_?m_?p_?o_?r_?t_?|i_?n_?c_?l_?u_?d_?e_?)\b`, KeywordNamespace, nil}, + {`(v_?a_?r)\b`, KeywordDeclaration, nil}, + {`(i_?n_?t_?|i_?n_?t_?8_?|i_?n_?t_?1_?6_?|i_?n_?t_?3_?2_?|i_?n_?t_?6_?4_?|f_?l_?o_?a_?t_?|f_?l_?o_?a_?t_?3_?2_?|f_?l_?o_?a_?t_?6_?4_?|b_?o_?o_?l_?|c_?h_?a_?r_?|r_?a_?n_?g_?e_?|a_?r_?r_?a_?y_?|s_?e_?q_?|s_?e_?t_?|s_?t_?r_?i_?n_?g_?)\b`, KeywordType, nil}, + {`(n_?i_?l_?|t_?r_?u_?e_?|f_?a_?l_?s_?e_?)\b`, KeywordPseudo, nil}, + {`\b_\b`, Name, nil}, // Standalone _ used as discardable variable identifier + {`\b((?![_\d])\w)(((?!_)\w)|(_(?!_)\w))*`, Name, nil}, + {`[0-9][0-9_]*(?=([e.]|\'f(32|64)))`, LiteralNumberFloat, Push("float-suffix", "float-number")}, + {`0x[a-f0-9][a-f0-9_]*`, LiteralNumberHex, Push("int-suffix")}, + {`0b[01][01_]*`, LiteralNumberBin, Push("int-suffix")}, + {`0o[0-7][0-7_]*`, LiteralNumberOct, Push("int-suffix")}, + {`[0-9][0-9_]*`, LiteralNumberInteger, Push("int-suffix")}, + {`\s+`, Text, nil}, + {`.+$`, Error, nil}, + }, + "chars": { + {`\\([\\abcefnrtvl"\']|x[a-f0-9]{2}|[0-9]{1,3})`, LiteralStringEscape, nil}, + {`'`, LiteralStringChar, Pop(1)}, + {`.`, LiteralStringChar, nil}, + }, + "strings": { + {`(? <= < >= > *")...), Operator, nil}, + {`[;:]`, Punctuation, nil}, + }, + "comment": { + {`\*/`, CommentMultiline, Pop(1)}, + {`.|\n`, CommentMultiline, nil}, + }, + "paren": { + {`\)`, Punctuation, Pop(1)}, + Include("root"), + }, + "list": { + {`\]`, Punctuation, Pop(1)}, + Include("root"), + }, + "qstring": { + {`"`, StringDouble, Pop(1)}, + {`\${`, StringInterpol, Push("interpol")}, + {`\\.`, StringEscape, nil}, + {`.|\n`, StringDouble, nil}, + }, + "istring": { + {`''\$`, StringEscape, nil}, // "$" + {`'''`, StringEscape, nil}, // "''" + {`''\\.`, StringEscape, nil}, // "\." + {`''`, StringSingle, Pop(1)}, + {`\${`, StringInterpol, Push("interpol")}, + // The next rule is important: "$" escapes any symbol except "{"! + {`\$.`, StringSingle, nil}, // "$." + {`.|\n`, StringSingle, nil}, + }, + "scope": { + {`}:`, Punctuation, Pop(1)}, + {`}`, Punctuation, Pop(1)}, + {`in` + nixb, Keyword, Pop(1)}, + {`\${`, StringInterpol, Push("interpol")}, + Include("root"), // "==" has to be above "=" + {Words(``, ``, strings.Fields("= ? ,")...), Operator, nil}, + }, + "interpol": { + {`}`, StringInterpol, Pop(1)}, + Include("root"), + }, + "id": { + {`[a-zA-Z_][a-zA-Z0-9_'-]*`, Name, nil}, + }, + "uri": { + {`[a-zA-Z][a-zA-Z0-9+.-]*:[a-zA-Z0-9%/?:@&=+$,_.!~*'-]+`, StringDoc, nil}, + }, + "path": { + {`[a-zA-Z0-9._+-]*(/[a-zA-Z0-9._+-]+)+`, StringRegex, nil}, + {`~(/[a-zA-Z0-9._+-]+)+/?`, StringRegex, nil}, + {`<[a-zA-Z0-9._+-]+(/[a-zA-Z0-9._+-]+)*>`, StringRegex, nil}, + }, + "int": { + {`-?[0-9]+` + nixb, NumberInteger, nil}, + }, + "float": { + {`-?(([1-9][0-9]*\.[0-9]*)|(0?\.[0-9]+))([Ee][+-]?[0-9]+)?` + nixb, NumberFloat, nil}, + }, + "space": { + {`[ \t\r\n]+`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/o/objectivec.go b/vendor/github.com/alecthomas/chroma/lexers/o/objectivec.go new file mode 100644 index 000000000..e3d0b1c4f --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/o/objectivec.go @@ -0,0 +1,165 @@ +package o + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Objective-C lexer. +var ObjectiveC = internal.Register(MustNewLexer( + &Config{ + Name: "Objective-C", + Aliases: []string{"objective-c", "objectivec", "obj-c", "objc"}, + Filenames: []string{"*.m", "*.h"}, + MimeTypes: []string{"text/x-objective-c"}, + }, + Rules{ + "statements": { + {`@"`, LiteralString, Push("string")}, + {`@(YES|NO)`, LiteralNumber, nil}, + {`@'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'`, LiteralStringChar, nil}, + {`@(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?`, LiteralNumberFloat, nil}, + {`@(\d+\.\d*|\.\d+|\d+[fF])[fF]?`, LiteralNumberFloat, nil}, + {`@0x[0-9a-fA-F]+[Ll]?`, LiteralNumberHex, nil}, + {`@0[0-7]+[Ll]?`, LiteralNumberOct, nil}, + {`@\d+[Ll]?`, LiteralNumberInteger, nil}, + {`@\(`, Literal, Push("literal_number")}, + {`@\[`, Literal, Push("literal_array")}, + {`@\{`, Literal, Push("literal_dictionary")}, + {Words(``, `\b`, `@selector`, `@private`, `@protected`, `@public`, `@encode`, `@synchronized`, `@try`, `@throw`, `@catch`, `@finally`, `@end`, `@property`, `@synthesize`, `__bridge`, `__bridge_transfer`, `__autoreleasing`, `__block`, `__weak`, `__strong`, `weak`, `strong`, `copy`, `retain`, `assign`, `unsafe_unretained`, `atomic`, `nonatomic`, `readonly`, `readwrite`, `setter`, `getter`, `typeof`, `in`, `out`, `inout`, `release`, `class`, `@dynamic`, `@optional`, `@required`, `@autoreleasepool`), Keyword, nil}, + {Words(``, `\b`, `id`, `instancetype`, `Class`, `IMP`, `SEL`, `BOOL`, `IBOutlet`, `IBAction`, `unichar`), KeywordType, nil}, + {`@(true|false|YES|NO)\n`, NameBuiltin, nil}, + {`(YES|NO|nil|self|super)\b`, NameBuiltin, nil}, + {`(Boolean|UInt8|SInt8|UInt16|SInt16|UInt32|SInt32)\b`, KeywordType, nil}, + {`(TRUE|FALSE)\b`, NameBuiltin, nil}, + {`(@interface|@implementation)(\s+)`, ByGroups(Keyword, Text), Push("#pop", "oc_classname")}, + {`(@class|@protocol)(\s+)`, ByGroups(Keyword, Text), Push("#pop", "oc_forward_classname")}, + {`@`, Punctuation, nil}, + {`(L?)(")`, ByGroups(LiteralStringAffix, LiteralString), Push("string")}, + {`(L?)(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')`, ByGroups(LiteralStringAffix, LiteralStringChar, LiteralStringChar, LiteralStringChar), nil}, + {`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*`, LiteralNumberFloat, nil}, + {`(\d+\.\d*|\.\d+|\d+[fF])[fF]?`, LiteralNumberFloat, nil}, + {`0x[0-9a-fA-F]+[LlUu]*`, LiteralNumberHex, nil}, + {`0[0-7]+[LlUu]*`, LiteralNumberOct, nil}, + {`\d+[LlUu]*`, LiteralNumberInteger, nil}, + {`\*/`, Error, nil}, + {`[~!%^&*+=|?:<>/-]`, Operator, nil}, + {`[()\[\],.]`, Punctuation, nil}, + {Words(``, `\b`, `asm`, `auto`, `break`, `case`, `const`, `continue`, `default`, `do`, `else`, `enum`, `extern`, `for`, `goto`, `if`, `register`, `restricted`, `return`, `sizeof`, `static`, `struct`, `switch`, `typedef`, `union`, `volatile`, `while`), Keyword, nil}, + {`(bool|int|long|float|short|double|char|unsigned|signed|void)\b`, KeywordType, nil}, + {Words(``, `\b`, `inline`, `_inline`, `__inline`, `naked`, `restrict`, `thread`, `typename`), KeywordReserved, nil}, + {`(__m(128i|128d|128|64))\b`, KeywordReserved, nil}, + {Words(`__`, `\b`, `asm`, `int8`, `based`, `except`, `int16`, `stdcall`, `cdecl`, `fastcall`, `int32`, `declspec`, `finally`, `int64`, `try`, `leave`, `wchar_t`, `w64`, `unaligned`, `raise`, `noop`, `identifier`, `forceinline`, `assume`), KeywordReserved, nil}, + {`(true|false|NULL)\b`, NameBuiltin, nil}, + {`([a-zA-Z_]\w*)(\s*)(:)(?!:)`, ByGroups(NameLabel, Text, Punctuation), nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + }, + "oc_classname": { + {`([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?(\s*)(\{)`, ByGroups(NameClass, Text, NameClass, Text, Punctuation), Push("#pop", "oc_ivars")}, + {`([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?`, ByGroups(NameClass, Text, NameClass), Pop(1)}, + {`([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))(\s*)(\{)`, ByGroups(NameClass, Text, NameLabel, Text, Punctuation), Push("#pop", "oc_ivars")}, + {`([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))`, ByGroups(NameClass, Text, NameLabel), Pop(1)}, + {`([a-zA-Z$_][\w$]*)(\s*)(\{)`, ByGroups(NameClass, Text, Punctuation), Push("#pop", "oc_ivars")}, + {`([a-zA-Z$_][\w$]*)`, NameClass, Pop(1)}, + }, + "oc_forward_classname": { + {`([a-zA-Z$_][\w$]*)(\s*,\s*)`, ByGroups(NameClass, Text), Push("oc_forward_classname")}, + {`([a-zA-Z$_][\w$]*)(\s*;?)`, ByGroups(NameClass, Text), Pop(1)}, + }, + "oc_ivars": { + Include("whitespace"), + Include("statements"), + {`;`, Punctuation, nil}, + {`\{`, Punctuation, Push()}, + {`\}`, Punctuation, Pop(1)}, + }, + "root": { + {`^([-+])(\s*)(\(.*?\))?(\s*)([a-zA-Z$_][\w$]*:?)`, ByGroups(Punctuation, Text, UsingSelf("root"), Text, NameFunction), Push("method")}, + Include("whitespace"), + {`((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;{]*)(\{)`, ByGroups(UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), Push("function")}, + {`((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;]*)(;)`, ByGroups(UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), nil}, + Default(Push("statement")), + }, + "method": { + Include("whitespace"), + {`,`, Punctuation, nil}, + {`\.\.\.`, Punctuation, nil}, + {`(\(.*?\))(\s*)([a-zA-Z$_][\w$]*)`, ByGroups(UsingSelf("root"), Text, NameVariable), nil}, + {`[a-zA-Z$_][\w$]*:`, NameFunction, nil}, + {`;`, Punctuation, Pop(1)}, + {`\{`, Punctuation, Push("function")}, + Default(Pop(1)), + }, + "literal_number": { + {`\(`, Punctuation, Push("literal_number_inner")}, + {`\)`, Literal, Pop(1)}, + Include("statement"), + }, + "literal_number_inner": { + {`\(`, Punctuation, Push()}, + {`\)`, Punctuation, Pop(1)}, + Include("statement"), + }, + "literal_array": { + {`\[`, Punctuation, Push("literal_array_inner")}, + {`\]`, Literal, Pop(1)}, + Include("statement"), + }, + "literal_array_inner": { + {`\[`, Punctuation, Push()}, + {`\]`, Punctuation, Pop(1)}, + Include("statement"), + }, + "literal_dictionary": { + {`\}`, Literal, Pop(1)}, + Include("statement"), + }, + "whitespace": { + {`^#if\s+0`, CommentPreproc, Push("if0")}, + {`^#`, CommentPreproc, Push("macro")}, + {`^(\s*(?:/[*].*?[*]/\s*)?)(#if\s+0)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("if0")}, + {`^(\s*(?:/[*].*?[*]/\s*)?)(#)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("macro")}, + {`\n`, Text, nil}, + {`\s+`, Text, nil}, + {`\\\n`, Text, nil}, + {`//(\n|[\w\W]*?[^\\]\n)`, CommentSingle, nil}, + {`/(\\\n)?[*][\w\W]*?[*](\\\n)?/`, CommentMultiline, nil}, + {`/(\\\n)?[*][\w\W]*`, CommentMultiline, nil}, + }, + "statement": { + Include("whitespace"), + Include("statements"), + {`[{}]`, Punctuation, nil}, + {`;`, Punctuation, Pop(1)}, + }, + "function": { + Include("whitespace"), + Include("statements"), + {`;`, Punctuation, nil}, + {`\{`, Punctuation, Push()}, + {`\}`, Punctuation, Pop(1)}, + }, + "string": { + {`"`, LiteralString, Pop(1)}, + {`\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})`, LiteralStringEscape, nil}, + {`[^\\"\n]+`, LiteralString, nil}, + {`\\\n`, LiteralString, nil}, + {`\\`, LiteralString, nil}, + }, + "macro": { + {`(include)(\s*(?:/[*].*?[*]/\s*)?)([^\n]+)`, ByGroups(CommentPreproc, Text, CommentPreprocFile), nil}, + {`[^/\n]+`, CommentPreproc, nil}, + {`/[*](.|\n)*?[*]/`, CommentMultiline, nil}, + {`//.*?\n`, CommentSingle, Pop(1)}, + {`/`, CommentPreproc, nil}, + {`(?<=\\)\n`, CommentPreproc, nil}, + {`\n`, CommentPreproc, Pop(1)}, + }, + "if0": { + {`^\s*#if.*?(?|\\[<|\\[|\\?\\?|\\?|>\\}|>]|>|=|<-|<|;;|;|:>|:=|::|:|\\.\\.|\\.|->|-\\.|-|,|\\+|\\*|\\)|\\(|&&|&|#|!=)", Operator, nil}, + {`([=<>@^|&+\*/$%-]|[!?~])?[!$%&*+\./:<=>?@^|~-]`, Operator, nil}, + {`\b(and|asr|land|lor|lsl|lxor|mod|or)\b`, OperatorWord, nil}, + {`\b(unit|int|float|bool|string|char|list|array)\b`, KeywordType, nil}, + {`[^\W\d][\w']*`, Name, nil}, + {`-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)`, LiteralNumberFloat, nil}, + {`0[xX][\da-fA-F][\da-fA-F_]*`, LiteralNumberHex, nil}, + {`0[oO][0-7][0-7_]*`, LiteralNumberOct, nil}, + {`0[bB][01][01_]*`, LiteralNumberBin, nil}, + {`\d[\d_]*`, LiteralNumberInteger, nil}, + {`'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'`, LiteralStringChar, nil}, + {`'.'`, LiteralStringChar, nil}, + {`'`, Keyword, nil}, + {`"`, LiteralStringDouble, Push("string")}, + {`[~?][a-z][\w\']*:`, NameVariable, nil}, + }, + "comment": { + {`[^(*)]+`, Comment, nil}, + {`\(\*`, Comment, Push()}, + {`\*\)`, Comment, Pop(1)}, + {`[(*)]`, Comment, nil}, + }, + "string": { + {`[^\\"]+`, LiteralStringDouble, nil}, + Include("escape-sequence"), + {`\\\n`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + "dotted": { + {`\s+`, Text, nil}, + {`\.`, Punctuation, nil}, + {`[A-Z][\w\']*(?=\s*\.)`, NameNamespace, nil}, + {`[A-Z][\w\']*`, NameClass, Pop(1)}, + {`[a-z_][\w\']*`, Name, Pop(1)}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/o/octave.go b/vendor/github.com/alecthomas/chroma/lexers/o/octave.go new file mode 100644 index 000000000..c23b586f2 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/o/octave.go @@ -0,0 +1,46 @@ +package o + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Octave lexer. +var Octave = internal.Register(MustNewLexer( + &Config{ + Name: "Octave", + Aliases: []string{"octave"}, + Filenames: []string{"*.m"}, + MimeTypes: []string{"text/octave"}, + }, + Rules{ + "root": { + {`[%#].*$`, Comment, nil}, + {`^\s*function`, Keyword, Push("deffunc")}, + {Words(``, `\b`, `__FILE__`, `__LINE__`, `break`, `case`, `catch`, `classdef`, `continue`, `do`, `else`, `elseif`, `end`, `end_try_catch`, `end_unwind_protect`, `endclassdef`, `endevents`, `endfor`, `endfunction`, `endif`, `endmethods`, `endproperties`, `endswitch`, `endwhile`, `events`, `for`, `function`, `get`, `global`, `if`, `methods`, `otherwise`, `persistent`, `properties`, `return`, `set`, `static`, `switch`, `try`, `until`, `unwind_protect`, `unwind_protect_cleanup`, `while`), Keyword, nil}, + {Words(``, `\b`, `addlistener`, `addpath`, `addproperty`, `all`, `and`, `any`, `argnames`, `argv`, `assignin`, `atexit`, `autoload`, `available_graphics_toolkits`, `beep_on_error`, `bitand`, `bitmax`, `bitor`, `bitshift`, `bitxor`, `cat`, `cell`, `cellstr`, `char`, `class`, `clc`, `columns`, `command_line_path`, `completion_append_char`, `completion_matches`, `complex`, `confirm_recursive_rmdir`, `cputime`, `crash_dumps_octave_core`, `ctranspose`, `cumprod`, `cumsum`, `debug_on_error`, `debug_on_interrupt`, `debug_on_warning`, `default_save_options`, `dellistener`, `diag`, `diff`, `disp`, `doc_cache_file`, `do_string_escapes`, `double`, `drawnow`, `e`, `echo_executing_commands`, `eps`, `eq`, `errno`, `errno_list`, `error`, `eval`, `evalin`, `exec`, `exist`, `exit`, `eye`, `false`, `fclear`, `fclose`, `fcntl`, `fdisp`, `feof`, `ferror`, `feval`, `fflush`, `fgetl`, `fgets`, `fieldnames`, `file_in_loadpath`, `file_in_path`, `filemarker`, `filesep`, `find_dir_in_path`, `fixed_point_format`, `fnmatch`, `fopen`, `fork`, `formula`, `fprintf`, `fputs`, `fread`, `freport`, `frewind`, `fscanf`, `fseek`, `fskipl`, `ftell`, `functions`, `fwrite`, `ge`, `genpath`, `get`, `getegid`, `getenv`, `geteuid`, `getgid`, `getpgrp`, `getpid`, `getppid`, `getuid`, `glob`, `gt`, `gui_mode`, `history_control`, `history_file`, `history_size`, `history_timestamp_format_string`, `home`, `horzcat`, `hypot`, `ifelse`, `ignore_function_time_stamp`, `inferiorto`, `info_file`, `info_program`, `inline`, `input`, `intmax`, `intmin`, `ipermute`, `is_absolute_filename`, `isargout`, `isbool`, `iscell`, `iscellstr`, `ischar`, `iscomplex`, `isempty`, `isfield`, `isfloat`, `isglobal`, `ishandle`, `isieee`, `isindex`, `isinteger`, `islogical`, `ismatrix`, `ismethod`, `isnull`, `isnumeric`, `isobject`, `isreal`, `is_rooted_relative_filename`, `issorted`, `isstruct`, `isvarname`, `kbhit`, `keyboard`, `kill`, `lasterr`, `lasterror`, `lastwarn`, `ldivide`, `le`, `length`, `link`, `linspace`, `logical`, `lstat`, `lt`, `make_absolute_filename`, `makeinfo_program`, `max_recursion_depth`, `merge`, `methods`, `mfilename`, `minus`, `mislocked`, `mkdir`, `mkfifo`, `mkstemp`, `mldivide`, `mlock`, `mouse_wheel_zoom`, `mpower`, `mrdivide`, `mtimes`, `munlock`, `nargin`, `nargout`, `native_float_format`, `ndims`, `ne`, `nfields`, `nnz`, `norm`, `not`, `numel`, `nzmax`, `octave_config_info`, `octave_core_file_limit`, `octave_core_file_name`, `octave_core_file_options`, `ones`, `or`, `output_max_field_width`, `output_precision`, `page_output_immediately`, `page_screen_output`, `path`, `pathsep`, `pause`, `pclose`, `permute`, `pi`, `pipe`, `plus`, `popen`, `power`, `print_empty_dimensions`, `printf`, `print_struct_array_contents`, `prod`, `program_invocation_name`, `program_name`, `putenv`, `puts`, `pwd`, `quit`, `rats`, `rdivide`, `readdir`, `readlink`, `read_readline_init_file`, `realmax`, `realmin`, `rehash`, `rename`, `repelems`, `re_read_readline_init_file`, `reset`, `reshape`, `resize`, `restoredefaultpath`, `rethrow`, `rmdir`, `rmfield`, `rmpath`, `rows`, `save_header_format_string`, `save_precision`, `saving_history`, `scanf`, `set`, `setenv`, `shell_cmd`, `sighup_dumps_octave_core`, `sigterm_dumps_octave_core`, `silent_functions`, `single`, `size`, `size_equal`, `sizemax`, `sizeof`, `sleep`, `source`, `sparse_auto_mutate`, `split_long_rows`, `sprintf`, `squeeze`, `sscanf`, `stat`, `stderr`, `stdin`, `stdout`, `strcmp`, `strcmpi`, `string_fill_char`, `strncmp`, `strncmpi`, `struct`, `struct_levels_to_print`, `strvcat`, `subsasgn`, `subsref`, `sum`, `sumsq`, `superiorto`, `suppress_verbose_help_message`, `symlink`, `system`, `tic`, `tilde_expand`, `times`, `tmpfile`, `tmpnam`, `toc`, `toupper`, `transpose`, `true`, `typeinfo`, `umask`, `uminus`, `uname`, `undo_string_escapes`, `unlink`, `uplus`, `upper`, `usage`, `usleep`, `vec`, `vectorize`, `vertcat`, `waitpid`, `warning`, `warranty`, `whos_line_format`, `yes_or_no`, `zeros`, `inf`, `Inf`, `nan`, `NaN`, `close`, `load`, `who`, `whos`, `accumarray`, `accumdim`, `acosd`, `acotd`, `acscd`, `addtodate`, `allchild`, `ancestor`, `anova`, `arch_fit`, `arch_rnd`, `arch_test`, `area`, `arma_rnd`, `arrayfun`, `ascii`, `asctime`, `asecd`, `asind`, `assert`, `atand`, `autoreg_matrix`, `autumn`, `axes`, `axis`, `bar`, `barh`, `bartlett`, `bartlett_test`, `beep`, `betacdf`, `betainv`, `betapdf`, `betarnd`, `bicgstab`, `bicubic`, `binary`, `binocdf`, `binoinv`, `binopdf`, `binornd`, `bitcmp`, `bitget`, `bitset`, `blackman`, `blanks`, `blkdiag`, `bone`, `box`, `brighten`, `calendar`, `cast`, `cauchy_cdf`, `cauchy_inv`, `cauchy_pdf`, `cauchy_rnd`, `caxis`, `celldisp`, `center`, `cgs`, `chisquare_test_homogeneity`, `chisquare_test_independence`, `circshift`, `cla`, `clabel`, `clf`, `clock`, `cloglog`, `closereq`, `colon`, `colorbar`, `colormap`, `colperm`, `comet`, `common_size`, `commutation_matrix`, `compan`, `compare_versions`, `compass`, `computer`, `cond`, `condest`, `contour`, `contourc`, `contourf`, `contrast`, `conv`, `convhull`, `cool`, `copper`, `copyfile`, `cor`, `corrcoef`, `cor_test`, `cosd`, `cotd`, `cov`, `cplxpair`, `cross`, `cscd`, `cstrcat`, `csvread`, `csvwrite`, `ctime`, `cumtrapz`, `curl`, `cut`, `cylinder`, `date`, `datenum`, `datestr`, `datetick`, `datevec`, `dblquad`, `deal`, `deblank`, `deconv`, `delaunay`, `delaunayn`, `delete`, `demo`, `detrend`, `diffpara`, `diffuse`, `dir`, `discrete_cdf`, `discrete_inv`, `discrete_pdf`, `discrete_rnd`, `display`, `divergence`, `dlmwrite`, `dos`, `dsearch`, `dsearchn`, `duplication_matrix`, `durbinlevinson`, `ellipsoid`, `empirical_cdf`, `empirical_inv`, `empirical_pdf`, `empirical_rnd`, `eomday`, `errorbar`, `etime`, `etreeplot`, `example`, `expcdf`, `expinv`, `expm`, `exppdf`, `exprnd`, `ezcontour`, `ezcontourf`, `ezmesh`, `ezmeshc`, `ezplot`, `ezpolar`, `ezsurf`, `ezsurfc`, `factor`, `factorial`, `fail`, `fcdf`, `feather`, `fftconv`, `fftfilt`, `fftshift`, `figure`, `fileattrib`, `fileparts`, `fill`, `findall`, `findobj`, `findstr`, `finv`, `flag`, `flipdim`, `fliplr`, `flipud`, `fpdf`, `fplot`, `fractdiff`, `freqz`, `freqz_plot`, `frnd`, `fsolve`, `f_test_regression`, `ftp`, `fullfile`, `fzero`, `gamcdf`, `gaminv`, `gampdf`, `gamrnd`, `gca`, `gcbf`, `gcbo`, `gcf`, `genvarname`, `geocdf`, `geoinv`, `geopdf`, `geornd`, `getfield`, `ginput`, `glpk`, `gls`, `gplot`, `gradient`, `graphics_toolkit`, `gray`, `grid`, `griddata`, `griddatan`, `gtext`, `gunzip`, `gzip`, `hadamard`, `hamming`, `hankel`, `hanning`, `hggroup`, `hidden`, `hilb`, `hist`, `histc`, `hold`, `hot`, `hotelling_test`, `housh`, `hsv`, `hurst`, `hygecdf`, `hygeinv`, `hygepdf`, `hygernd`, `idivide`, `ifftshift`, `image`, `imagesc`, `imfinfo`, `imread`, `imshow`, `imwrite`, `index`, `info`, `inpolygon`, `inputname`, `interpft`, `interpn`, `intersect`, `invhilb`, `iqr`, `isa`, `isdefinite`, `isdir`, `is_duplicate_entry`, `isequal`, `isequalwithequalnans`, `isfigure`, `ishermitian`, `ishghandle`, `is_leap_year`, `isletter`, `ismac`, `ismember`, `ispc`, `isprime`, `isprop`, `isscalar`, `issquare`, `isstrprop`, `issymmetric`, `isunix`, `is_valid_file_id`, `isvector`, `jet`, `kendall`, `kolmogorov_smirnov_cdf`, `kolmogorov_smirnov_test`, `kruskal_wallis_test`, `krylov`, `kurtosis`, `laplace_cdf`, `laplace_inv`, `laplace_pdf`, `laplace_rnd`, `legend`, `legendre`, `license`, `line`, `linkprop`, `list_primes`, `loadaudio`, `loadobj`, `logistic_cdf`, `logistic_inv`, `logistic_pdf`, `logistic_rnd`, `logit`, `loglog`, `loglogerr`, `logm`, `logncdf`, `logninv`, `lognpdf`, `lognrnd`, `logspace`, `lookfor`, `ls_command`, `lsqnonneg`, `magic`, `mahalanobis`, `manova`, `matlabroot`, `mcnemar_test`, `mean`, `meansq`, `median`, `menu`, `mesh`, `meshc`, `meshgrid`, `meshz`, `mexext`, `mget`, `mkpp`, `mode`, `moment`, `movefile`, `mpoles`, `mput`, `namelengthmax`, `nargchk`, `nargoutchk`, `nbincdf`, `nbininv`, `nbinpdf`, `nbinrnd`, `nchoosek`, `ndgrid`, `newplot`, `news`, `nonzeros`, `normcdf`, `normest`, `norminv`, `normpdf`, `normrnd`, `now`, `nthroot`, `null`, `ocean`, `ols`, `onenormest`, `optimget`, `optimset`, `orderfields`, `orient`, `orth`, `pack`, `pareto`, `parseparams`, `pascal`, `patch`, `pathdef`, `pcg`, `pchip`, `pcolor`, `pcr`, `peaks`, `periodogram`, `perl`, `perms`, `pie`, `pink`, `planerot`, `playaudio`, `plot`, `plotmatrix`, `plotyy`, `poisscdf`, `poissinv`, `poisspdf`, `poissrnd`, `polar`, `poly`, `polyaffine`, `polyarea`, `polyderiv`, `polyfit`, `polygcd`, `polyint`, `polyout`, `polyreduce`, `polyval`, `polyvalm`, `postpad`, `powerset`, `ppder`, `ppint`, `ppjumps`, `ppplot`, `ppval`, `pqpnonneg`, `prepad`, `primes`, `print`, `print_usage`, `prism`, `probit`, `qp`, `qqplot`, `quadcc`, `quadgk`, `quadl`, `quadv`, `quiver`, `qzhess`, `rainbow`, `randi`, `range`, `rank`, `ranks`, `rat`, `reallog`, `realpow`, `realsqrt`, `record`, `rectangle_lw`, `rectangle_sw`, `rectint`, `refresh`, `refreshdata`, `regexptranslate`, `repmat`, `residue`, `ribbon`, `rindex`, `roots`, `rose`, `rosser`, `rotdim`, `rref`, `run`, `run_count`, `rundemos`, `run_test`, `runtests`, `saveas`, `saveaudio`, `saveobj`, `savepath`, `scatter`, `secd`, `semilogx`, `semilogxerr`, `semilogy`, `semilogyerr`, `setaudio`, `setdiff`, `setfield`, `setxor`, `shading`, `shift`, `shiftdim`, `sign_test`, `sinc`, `sind`, `sinetone`, `sinewave`, `skewness`, `slice`, `sombrero`, `sortrows`, `spaugment`, `spconvert`, `spdiags`, `spearman`, `spectral_adf`, `spectral_xdf`, `specular`, `speed`, `spencer`, `speye`, `spfun`, `sphere`, `spinmap`, `spline`, `spones`, `sprand`, `sprandn`, `sprandsym`, `spring`, `spstats`, `spy`, `sqp`, `stairs`, `statistics`, `std`, `stdnormal_cdf`, `stdnormal_inv`, `stdnormal_pdf`, `stdnormal_rnd`, `stem`, `stft`, `strcat`, `strchr`, `strjust`, `strmatch`, `strread`, `strsplit`, `strtok`, `strtrim`, `strtrunc`, `structfun`, `studentize`, `subplot`, `subsindex`, `subspace`, `substr`, `substruct`, `summer`, `surf`, `surface`, `surfc`, `surfl`, `surfnorm`, `svds`, `swapbytes`, `sylvester_matrix`, `symvar`, `synthesis`, `table`, `tand`, `tar`, `tcdf`, `tempdir`, `tempname`, `test`, `text`, `textread`, `textscan`, `tinv`, `title`, `toeplitz`, `tpdf`, `trace`, `trapz`, `treelayout`, `treeplot`, `triangle_lw`, `triangle_sw`, `tril`, `trimesh`, `triplequad`, `triplot`, `trisurf`, `triu`, `trnd`, `tsearchn`, `t_test`, `t_test_regression`, `type`, `unidcdf`, `unidinv`, `unidpdf`, `unidrnd`, `unifcdf`, `unifinv`, `unifpdf`, `unifrnd`, `union`, `unique`, `unix`, `unmkpp`, `unpack`, `untabify`, `untar`, `unwrap`, `unzip`, `u_test`, `validatestring`, `vander`, `var`, `var_test`, `vech`, `ver`, `version`, `view`, `voronoi`, `voronoin`, `waitforbuttonpress`, `wavread`, `wavwrite`, `wblcdf`, `wblinv`, `wblpdf`, `wblrnd`, `weekday`, `welch_test`, `what`, `white`, `whitebg`, `wienrnd`, `wilcoxon_test`, `wilkinson`, `winter`, `xlabel`, `xlim`, `ylabel`, `yulewalker`, `zip`, `zlabel`, `z_test`, `airy`, `amd`, `balance`, `besselh`, `besseli`, `besselj`, `besselk`, `bessely`, `bitpack`, `bsxfun`, `builtin`, `ccolamd`, `cellfun`, `cellslices`, `chol`, `choldelete`, `cholinsert`, `cholinv`, `cholshift`, `cholupdate`, `colamd`, `colloc`, `convhulln`, `convn`, `csymamd`, `cummax`, `cummin`, `daspk`, `daspk_options`, `dasrt`, `dasrt_options`, `dassl`, `dassl_options`, `dbclear`, `dbdown`, `dbstack`, `dbstatus`, `dbstop`, `dbtype`, `dbup`, `dbwhere`, `det`, `dlmread`, `dmperm`, `dot`, `eig`, `eigs`, `endgrent`, `endpwent`, `etree`, `fft`, `fftn`, `fftw`, `filter`, `find`, `full`, `gcd`, `getgrent`, `getgrgid`, `getgrnam`, `getpwent`, `getpwnam`, `getpwuid`, `getrusage`, `givens`, `gmtime`, `gnuplot_binary`, `hess`, `ifft`, `ifftn`, `inv`, `isdebugmode`, `issparse`, `kron`, `localtime`, `lookup`, `lsode`, `lsode_options`, `lu`, `luinc`, `luupdate`, `matrix_type`, `max`, `min`, `mktime`, `pinv`, `qr`, `qrdelete`, `qrinsert`, `qrshift`, `qrupdate`, `quad`, `quad_options`, `qz`, `rand`, `rande`, `randg`, `randn`, `randp`, `randperm`, `rcond`, `regexp`, `regexpi`, `regexprep`, `schur`, `setgrent`, `setpwent`, `sort`, `spalloc`, `sparse`, `spparms`, `sprank`, `sqrtm`, `strfind`, `strftime`, `strptime`, `strrep`, `svd`, `svd_driver`, `syl`, `symamd`, `symbfact`, `symrcm`, `time`, `tsearch`, `typecast`, `urlread`, `urlwrite`, `abs`, `acos`, `acosh`, `acot`, `acoth`, `acsc`, `acsch`, `angle`, `arg`, `asec`, `asech`, `asin`, `asinh`, `atan`, `atanh`, `beta`, `betainc`, `betaln`, `bincoeff`, `cbrt`, `ceil`, `conj`, `cos`, `cosh`, `cot`, `coth`, `csc`, `csch`, `erf`, `erfc`, `erfcx`, `erfinv`, `exp`, `finite`, `fix`, `floor`, `fmod`, `gamma`, `gammainc`, `gammaln`, `imag`, `isalnum`, `isalpha`, `isascii`, `iscntrl`, `isdigit`, `isfinite`, `isgraph`, `isinf`, `islower`, `isna`, `isnan`, `isprint`, `ispunct`, `isspace`, `isupper`, `isxdigit`, `lcm`, `lgamma`, `log`, `lower`, `mod`, `real`, `rem`, `round`, `roundb`, `sec`, `sech`, `sign`, `sin`, `sinh`, `sqrt`, `tan`, `tanh`, `toascii`, `tolower`, `xor`), NameBuiltin, nil}, + {Words(``, `\b`, `EDITOR`, `EXEC_PATH`, `I`, `IMAGE_PATH`, `NA`, `OCTAVE_HOME`, `OCTAVE_VERSION`, `PAGER`, `PAGER_FLAGS`, `SEEK_CUR`, `SEEK_END`, `SEEK_SET`, `SIG`, `S_ISBLK`, `S_ISCHR`, `S_ISDIR`, `S_ISFIFO`, `S_ISLNK`, `S_ISREG`, `S_ISSOCK`, `WCONTINUE`, `WCOREDUMP`, `WEXITSTATUS`, `WIFCONTINUED`, `WIFEXITED`, `WIFSIGNALED`, `WIFSTOPPED`, `WNOHANG`, `WSTOPSIG`, `WTERMSIG`, `WUNTRACED`), NameConstant, nil}, + {`-=|!=|!|/=|--`, Operator, nil}, + {`-|==|~=|<|>|<=|>=|&&|&|~|\|\|?`, Operator, nil}, + {`\*=|\+=|\^=|\/=|\\=|\*\*|\+\+|\.\*\*`, Operator, nil}, + {`\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\`, Operator, nil}, + {`[\[\](){}:@.,]`, Punctuation, nil}, + {`=|:|;`, Punctuation, nil}, + {`"[^"]*"`, LiteralString, nil}, + {`(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`\d+[eEf][+-]?[0-9]+`, LiteralNumberFloat, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`(?<=[\w)\].])\'+`, Operator, nil}, + {`(?=|>|&&|\|\|`, Operator, nil}, + {`\$(f[asn]|t|vp[rtd]|children)`, NameVariableMagic, nil}, + {Words(``, `\b`, `PI`, `undef`), KeywordConstant, nil}, + {`(use|include)((?:\s|\\\\s)+)`, ByGroups(KeywordNamespace, Text), Push("includes")}, + {`(module)(\s*)([^\s\(]+)`, ByGroups(KeywordNamespace, Text, NameNamespace), nil}, + {`(function)(\s*)([^\s\(]+)`, ByGroups(KeywordDeclaration, Text, NameFunction), nil}, + {`\b(true|false)\b`, Literal, nil}, + {`\b(function|module|include|use|for|intersection_for|if|else|return)\b`, Keyword, nil}, + {`\b(circle|square|polygon|text|sphere|cube|cylinder|polyhedron|translate|rotate|scale|resize|mirror|multmatrix|color|offset|hull|minkowski|union|difference|intersection|abs|sign|sin|cos|tan|acos|asin|atan|atan2|floor|round|ceil|ln|log|pow|sqrt|exp|rands|min|max|concat|lookup|str|chr|search|version|version_num|norm|cross|parent_module|echo|import|import_dxf|dxf_linear_extrude|linear_extrude|rotate_extrude|surface|projection|render|dxf_cross|dxf_dim|let|assign|len)\b`, NameBuiltin, nil}, + {`\bchildren\b`, NameBuiltinPseudo, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`-?\d+(\.\d+)?(e[+-]?\d+)?`, Number, nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + }, + "includes": { + {"(<)([^>]*)(>)", ByGroups(Punctuation, CommentPreprocFile, Punctuation), nil}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/o/org.go b/vendor/github.com/alecthomas/chroma/lexers/o/org.go new file mode 100644 index 000000000..1064eaf0f --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/o/org.go @@ -0,0 +1,102 @@ +package o + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Org mode lexer. +var Org = internal.Register(MustNewLexer( + &Config{ + Name: "Org Mode", + Aliases: []string{"org", "orgmode"}, + Filenames: []string{"*.org"}, + MimeTypes: []string{"text/org"}, // https://lists.gnu.org/r/emacs-orgmode/2017-09/msg00087.html + }, + Rules{ + "root": { + {`^# .*$`, Comment, nil}, + // Headings + {`^(\*)( COMMENT)( .*)$`, ByGroups(GenericHeading, NameEntity, GenericStrong), nil}, + {`^(\*\*+)( COMMENT)( .*)$`, ByGroups(GenericSubheading, NameEntity, Text), nil}, + {`^(\*)( DONE)( .*)$`, ByGroups(GenericHeading, LiteralStringRegex, GenericStrong), nil}, + {`^(\*\*+)( DONE)( .*)$`, ByGroups(GenericSubheading, LiteralStringRegex, Text), nil}, + {`^(\*)( TODO)( .*)$`, ByGroups(GenericHeading, Error, GenericStrong), nil}, + {`^(\*\*+)( TODO)( .*)$`, ByGroups(GenericSubheading, Error, Text), nil}, + {`^(\*)( .+?)( :[a-zA-Z0-9_@:]+:)$`, ByGroups(GenericHeading, GenericStrong, GenericEmph), nil}, // Level 1 heading with tags + {`^(\*)( .+)$`, ByGroups(GenericHeading, GenericStrong), nil}, // // Level 1 heading with NO tags + {`^(\*\*+)( .+?)( :[a-zA-Z0-9_@:]+:)$`, ByGroups(GenericSubheading, Text, GenericEmph), nil}, // Level 2+ heading with tags + {`^(\*\*+)( .+)$`, ByGroups(GenericSubheading, Text), nil}, // Level 2+ heading with NO tags + // Checkbox lists + {`^( *)([+-] )(\[[ X]\])( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil}, + {`^( +)(\* )(\[[ X]\])( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil}, + // Definition lists + {`^( *)([+-] )([^ \n]+ ::)( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil}, + {`^( +)(\* )([^ \n]+ ::)( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil}, + // Unordered lists + {`^( *)([+-] )(.+)$`, ByGroups(Text, Keyword, UsingSelf("inline")), nil}, + {`^( +)(\* )(.+)$`, ByGroups(Text, Keyword, UsingSelf("inline")), nil}, + // Ordered lists + {`^( *)([0-9]+[.)])( \[@[0-9]+\])( .+)$`, ByGroups(Text, Keyword, GenericEmph, UsingSelf("inline")), nil}, + {`^( *)([0-9]+[.)])( .+)$`, ByGroups(Text, Keyword, UsingSelf("inline")), nil}, + // Dynamic Blocks + {`(?i)^( *#\+begin: )([^ ]+)([\w\W]*?\n)([\w\W]*?)(^ *#\+end: *$)`, ByGroups(Comment, CommentSpecial, Comment, UsingSelf("inline"), Comment), nil}, + // Blocks + // - Comment Blocks + {`(?i)^( *#\+begin_comment *\n)([\w\W]*?)(^ *#\+end_comment *$)`, ByGroups(Comment, Comment, Comment), nil}, + // - Src Blocks + {`(?i)^( *#\+begin_src )([^ \n]+)(.*?\n)([\w\W]*?)(^ *#\+end_src *$)`, + UsingByGroup( + internal.Get, + 2, 4, + Comment, CommentSpecial, Comment, Text, Comment, + ), + nil, + }, + // - Export Blocks + {`(?i)^( *#\+begin_export )(\w+)( *\n)([\w\W]*?)(^ *#\+end_export *$)`, + UsingByGroup( + internal.Get, + 2, 4, + Comment, CommentSpecial, Text, Text, Comment, + ), + nil, + }, + // - Org Special, Example, Verse, etc. Blocks + {`(?i)^( *#\+begin_)(\w+)( *\n)([\w\W]*?)(^ *#\+end_\2)( *$)`, ByGroups(Comment, Comment, Text, Text, Comment, Text), nil}, + // Keywords + {`^(#\+\w+)(:.*)$`, ByGroups(CommentSpecial, Comment), nil}, // Other Org keywords like #+title + // Properties and Drawers + {`(?i)^( *:\w+: *\n)([\w\W]*?)(^ *:end: *$)`, ByGroups(Comment, CommentSpecial, Comment), nil}, + // Line break operator + {`^(.*)(\\\\)$`, ByGroups(UsingSelf("inline"), Operator), nil}, + // Deadline/Scheduled + {`(?i)^( *(?:DEADLINE|SCHEDULED): )(<[^<>]+?> *)$`, ByGroups(Comment, CommentSpecial), nil}, // DEADLINE/SCHEDULED: + // DONE state CLOSED + {`(?i)^( *CLOSED: )(\[[^][]+?\] *)$`, ByGroups(Comment, CommentSpecial), nil}, // CLOSED: [datestamp] + // All other lines + Include("inline"), + }, + "inline": { + {`(\s)*(\*[^ \n*][^*]+?[^ \n*]\*)((?=\W|\n|$))`, ByGroups(Text, GenericStrong, Text), nil}, // Bold + {`(\s)*(/[^/]+?/)((?=\W|\n|$))`, ByGroups(Text, GenericEmph, Text), nil}, // Italic + {`(\s)*(=[^\n=]+?=)((?=\W|\n|$))`, ByGroups(Text, NameClass, Text), nil}, // Verbatim + {`(\s)*(~[^\n~]+?~)((?=\W|\n|$))`, ByGroups(Text, NameClass, Text), nil}, // Code + {`(\s)*(\+[^+]+?\+)((?=\W|\n|$))`, ByGroups(Text, GenericDeleted, Text), nil}, // Strikethrough + {`(\s)*(_[^_]+?_)((?=\W|\n|$))`, ByGroups(Text, GenericUnderline, Text), nil}, // Underline + {`(<)([^<>]+?)(>)`, ByGroups(Text, String, Text), nil}, // + {`[{]{3}[^}]+[}]{3}`, NameBuiltin, nil}, // {{{macro(foo,1)}}} + {`([^[])(\[fn:)([^]]+?)(\])([^]])`, ByGroups(Text, NameBuiltinPseudo, LiteralString, NameBuiltinPseudo, Text), nil}, // [fn:1] + // Links + {`(\[\[)([^][]+?)(\]\[)([^][]+)(\]\])`, ByGroups(Text, NameAttribute, Text, NameTag, Text), nil}, // [[link][descr]] + {`(\[\[)([^][]+?)(\]\])`, ByGroups(Text, NameAttribute, Text), nil}, // [[link]] + {`(<<)([^<>]+?)(>>)`, ByGroups(Text, NameAttribute, Text), nil}, // <> + // Tables + {`^( *)(\|[ -].*?[ -]\|)$`, ByGroups(Text, String), nil}, + // Blank lines, newlines + {`\n`, Text, nil}, + // Any other text + {`.`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/pacman.go b/vendor/github.com/alecthomas/chroma/lexers/p/pacman.go new file mode 100644 index 000000000..807b67c56 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/pacman.go @@ -0,0 +1,26 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Pacmanconf lexer. +var Pacmanconf = internal.Register(MustNewLexer( + &Config{ + Name: "PacmanConf", + Aliases: []string{"pacmanconf"}, + Filenames: []string{"pacman.conf"}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`#.*$`, CommentSingle, nil}, + {`^\s*\[.*?\]\s*$`, Keyword, nil}, + {`(\w+)(\s*)(=)`, ByGroups(NameAttribute, Text, Operator), nil}, + {`^(\s*)(\w+)(\s*)$`, ByGroups(Text, NameAttribute, Text), nil}, + {Words(``, `\b`, `$repo`, `$arch`, `%o`, `%u`), NameVariable, nil}, + {`.`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/perl.go b/vendor/github.com/alecthomas/chroma/lexers/p/perl.go new file mode 100644 index 000000000..0a2b35b9a --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/perl.go @@ -0,0 +1,138 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Perl lexer. +var Perl = internal.Register(MustNewLexer( + &Config{ + Name: "Perl", + Aliases: []string{"perl", "pl"}, + Filenames: []string{"*.pl", "*.pm", "*.t"}, + MimeTypes: []string{"text/x-perl", "application/x-perl"}, + DotAll: true, + }, + Rules{ + "balanced-regex": { + {`/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*`, LiteralStringRegex, Pop(1)}, + {`!(\\\\|\\[^\\]|[^\\!])*![egimosx]*`, LiteralStringRegex, Pop(1)}, + {`\\(\\\\|[^\\])*\\[egimosx]*`, LiteralStringRegex, Pop(1)}, + {`\{(\\\\|\\[^\\]|[^\\}])*\}[egimosx]*`, LiteralStringRegex, Pop(1)}, + {`<(\\\\|\\[^\\]|[^\\>])*>[egimosx]*`, LiteralStringRegex, Pop(1)}, + {`\[(\\\\|\\[^\\]|[^\\\]])*\][egimosx]*`, LiteralStringRegex, Pop(1)}, + {`\((\\\\|\\[^\\]|[^\\)])*\)[egimosx]*`, LiteralStringRegex, Pop(1)}, + {`@(\\\\|\\[^\\]|[^\\@])*@[egimosx]*`, LiteralStringRegex, Pop(1)}, + {`%(\\\\|\\[^\\]|[^\\%])*%[egimosx]*`, LiteralStringRegex, Pop(1)}, + {`\$(\\\\|\\[^\\]|[^\\$])*\$[egimosx]*`, LiteralStringRegex, Pop(1)}, + }, + "root": { + {`\A\#!.+?$`, CommentHashbang, nil}, + {`\#.*?$`, CommentSingle, nil}, + {`^=[a-zA-Z0-9]+\s+.*?\n=cut`, CommentMultiline, nil}, + {Words(``, `\b`, `case`, `continue`, `do`, `else`, `elsif`, `for`, `foreach`, `if`, `last`, `my`, `next`, `our`, `redo`, `reset`, `then`, `unless`, `until`, `while`, `print`, `new`, `BEGIN`, `CHECK`, `INIT`, `END`, `return`), Keyword, nil}, + {`(format)(\s+)(\w+)(\s*)(=)(\s*\n)`, ByGroups(Keyword, Text, Name, Text, Punctuation, Text), Push("format")}, + {`(eq|lt|gt|le|ge|ne|not|and|or|cmp)\b`, OperatorWord, nil}, + {`s/(\\\\|\\[^\\]|[^\\/])*/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*`, LiteralStringRegex, nil}, + {`s!(\\\\|\\!|[^!])*!(\\\\|\\!|[^!])*![egimosx]*`, LiteralStringRegex, nil}, + {`s\\(\\\\|[^\\])*\\(\\\\|[^\\])*\\[egimosx]*`, LiteralStringRegex, nil}, + {`s@(\\\\|\\[^\\]|[^\\@])*@(\\\\|\\[^\\]|[^\\@])*@[egimosx]*`, LiteralStringRegex, nil}, + {`s%(\\\\|\\[^\\]|[^\\%])*%(\\\\|\\[^\\]|[^\\%])*%[egimosx]*`, LiteralStringRegex, nil}, + {`s\{(\\\\|\\[^\\]|[^\\}])*\}\s*`, LiteralStringRegex, Push("balanced-regex")}, + {`s<(\\\\|\\[^\\]|[^\\>])*>\s*`, LiteralStringRegex, Push("balanced-regex")}, + {`s\[(\\\\|\\[^\\]|[^\\\]])*\]\s*`, LiteralStringRegex, Push("balanced-regex")}, + {`s\((\\\\|\\[^\\]|[^\\)])*\)\s*`, LiteralStringRegex, Push("balanced-regex")}, + {`m?/(\\\\|\\[^\\]|[^\\/\n])*/[gcimosx]*`, LiteralStringRegex, nil}, + {`m(?=[/!\\{<\[(@%$])`, LiteralStringRegex, Push("balanced-regex")}, + {`((?<==~)|(?<=\())\s*/(\\\\|\\[^\\]|[^\\/])*/[gcimosx]*`, LiteralStringRegex, nil}, + {`\s+`, Text, nil}, + {Words(``, `\b`, `abs`, `accept`, `alarm`, `atan2`, `bind`, `binmode`, `bless`, `caller`, `chdir`, `chmod`, `chomp`, `chop`, `chown`, `chr`, `chroot`, `close`, `closedir`, `connect`, `continue`, `cos`, `crypt`, `dbmclose`, `dbmopen`, `defined`, `delete`, `die`, `dump`, `each`, `endgrent`, `endhostent`, `endnetent`, `endprotoent`, `endpwent`, `endservent`, `eof`, `eval`, `exec`, `exists`, `exit`, `exp`, `fcntl`, `fileno`, `flock`, `fork`, `format`, `formline`, `getc`, `getgrent`, `getgrgid`, `getgrnam`, `gethostbyaddr`, `gethostbyname`, `gethostent`, `getlogin`, `getnetbyaddr`, `getnetbyname`, `getnetent`, `getpeername`, `getpgrp`, `getppid`, `getpriority`, `getprotobyname`, `getprotobynumber`, `getprotoent`, `getpwent`, `getpwnam`, `getpwuid`, `getservbyname`, `getservbyport`, `getservent`, `getsockname`, `getsockopt`, `glob`, `gmtime`, `goto`, `grep`, `hex`, `import`, `index`, `int`, `ioctl`, `join`, `keys`, `kill`, `last`, `lc`, `lcfirst`, `length`, `link`, `listen`, `local`, `localtime`, `log`, `lstat`, `map`, `mkdir`, `msgctl`, `msgget`, `msgrcv`, `msgsnd`, `my`, `next`, `oct`, `open`, `opendir`, `ord`, `our`, `pack`, `pipe`, `pop`, `pos`, `printf`, `prototype`, `push`, `quotemeta`, `rand`, `read`, `readdir`, `readline`, `readlink`, `readpipe`, `recv`, `redo`, `ref`, `rename`, `reverse`, `rewinddir`, `rindex`, `rmdir`, `scalar`, `seek`, `seekdir`, `select`, `semctl`, `semget`, `semop`, `send`, `setgrent`, `sethostent`, `setnetent`, `setpgrp`, `setpriority`, `setprotoent`, `setpwent`, `setservent`, `setsockopt`, `shift`, `shmctl`, `shmget`, `shmread`, `shmwrite`, `shutdown`, `sin`, `sleep`, `socket`, `socketpair`, `sort`, `splice`, `split`, `sprintf`, `sqrt`, `srand`, `stat`, `study`, `substr`, `symlink`, `syscall`, `sysopen`, `sysread`, `sysseek`, `system`, `syswrite`, `tell`, `telldir`, `tie`, `tied`, `time`, `times`, `tr`, `truncate`, `uc`, `ucfirst`, `umask`, `undef`, `unlink`, `unpack`, `unshift`, `untie`, `utime`, `values`, `vec`, `wait`, `waitpid`, `wantarray`, `warn`, `write`), NameBuiltin, nil}, + {`((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b`, NameBuiltinPseudo, nil}, + {`(<<)([\'"]?)([a-zA-Z_]\w*)(\2;?\n.*?\n)(\3)(\n)`, ByGroups(LiteralString, LiteralString, LiteralStringDelimiter, LiteralString, LiteralStringDelimiter, Text), nil}, + {`__END__`, CommentPreproc, Push("end-part")}, + {`\$\^[ADEFHILMOPSTWX]`, NameVariableGlobal, nil}, + {"\\$[\\\\\\\"\\[\\]'&`+*.,;=%~?@$!<>(^|/-](?!\\w)", NameVariableGlobal, nil}, + {`[$@%#]+`, NameVariable, Push("varname")}, + {`0_?[0-7]+(_[0-7]+)*`, LiteralNumberOct, nil}, + {`0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*`, LiteralNumberHex, nil}, + {`0b[01]+(_[01]+)*`, LiteralNumberBin, nil}, + {`(?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?`, LiteralNumberFloat, nil}, + {`(?i)\d+(_\d*)*e[+-]?\d+(_\d*)*`, LiteralNumberFloat, nil}, + {`\d+(_\d+)*`, LiteralNumberInteger, nil}, + {`'(\\\\|\\[^\\]|[^'\\])*'`, LiteralString, nil}, + {`"(\\\\|\\[^\\]|[^"\\])*"`, LiteralString, nil}, + {"`(\\\\\\\\|\\\\[^\\\\]|[^`\\\\])*`", LiteralStringBacktick, nil}, + {`<([^\s>]+)>`, LiteralStringRegex, nil}, + {`(q|qq|qw|qr|qx)\{`, LiteralStringOther, Push("cb-string")}, + {`(q|qq|qw|qr|qx)\(`, LiteralStringOther, Push("rb-string")}, + {`(q|qq|qw|qr|qx)\[`, LiteralStringOther, Push("sb-string")}, + {`(q|qq|qw|qr|qx)\<`, LiteralStringOther, Push("lt-string")}, + {`(q|qq|qw|qr|qx)([\W_])(.|\n)*?\2`, LiteralStringOther, nil}, + {`(package)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)`, ByGroups(Keyword, Text, NameNamespace), nil}, + {`(use|require|no)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)`, ByGroups(Keyword, Text, NameNamespace), nil}, + {`(sub)(\s+)`, ByGroups(Keyword, Text), Push("funcname")}, + {Words(``, `\b`, `no`, `package`, `require`, `use`), Keyword, nil}, + {`(\[\]|\*\*|::|<<|>>|>=|<=>|<=|={3}|!=|=~|!~|&&?|\|\||\.{1,3})`, Operator, nil}, + {`[-+/*%=<>&^|!\\~]=?`, Operator, nil}, + {`[()\[\]:;,<>/?{}]`, Punctuation, nil}, + {`(?=\w)`, Name, Push("name")}, + }, + "format": { + {`\.\n`, LiteralStringInterpol, Pop(1)}, + {`[^\n]*\n`, LiteralStringInterpol, nil}, + }, + "varname": { + {`\s+`, Text, nil}, + {`\{`, Punctuation, Pop(1)}, + {`\)|,`, Punctuation, Pop(1)}, + {`\w+::`, NameNamespace, nil}, + {`[\w:]+`, NameVariable, Pop(1)}, + }, + "name": { + {`[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*(::)?(?=\s*->)`, NameNamespace, Pop(1)}, + {`[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*::`, NameNamespace, Pop(1)}, + {`[\w:]+`, Name, Pop(1)}, + {`[A-Z_]+(?=\W)`, NameConstant, Pop(1)}, + {`(?=\W)`, Text, Pop(1)}, + }, + "funcname": { + {`[a-zA-Z_]\w*[!?]?`, NameFunction, nil}, + {`\s+`, Text, nil}, + {`(\([$@%]*\))(\s*)`, ByGroups(Punctuation, Text), nil}, + {`;`, Punctuation, Pop(1)}, + {`.*?\{`, Punctuation, Pop(1)}, + }, + "cb-string": { + {`\\[{}\\]`, LiteralStringOther, nil}, + {`\\`, LiteralStringOther, nil}, + {`\{`, LiteralStringOther, Push("cb-string")}, + {`\}`, LiteralStringOther, Pop(1)}, + {`[^{}\\]+`, LiteralStringOther, nil}, + }, + "rb-string": { + {`\\[()\\]`, LiteralStringOther, nil}, + {`\\`, LiteralStringOther, nil}, + {`\(`, LiteralStringOther, Push("rb-string")}, + {`\)`, LiteralStringOther, Pop(1)}, + {`[^()]+`, LiteralStringOther, nil}, + }, + "sb-string": { + {`\\[\[\]\\]`, LiteralStringOther, nil}, + {`\\`, LiteralStringOther, nil}, + {`\[`, LiteralStringOther, Push("sb-string")}, + {`\]`, LiteralStringOther, Pop(1)}, + {`[^\[\]]+`, LiteralStringOther, nil}, + }, + "lt-string": { + {`\\[<>\\]`, LiteralStringOther, nil}, + {`\\`, LiteralStringOther, nil}, + {`\<`, LiteralStringOther, Push("lt-string")}, + {`\>`, LiteralStringOther, Pop(1)}, + {`[^<>]+`, LiteralStringOther, nil}, + }, + "end-part": { + {`.+`, CommentPreproc, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/pig.go b/vendor/github.com/alecthomas/chroma/lexers/p/pig.go new file mode 100644 index 000000000..0dbc591ad --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/pig.go @@ -0,0 +1,57 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Pig lexer. +var Pig = internal.Register(MustNewLexer( + &Config{ + Name: "Pig", + Aliases: []string{"pig"}, + Filenames: []string{"*.pig"}, + MimeTypes: []string{"text/x-pig"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`--.*`, Comment, nil}, + {`/\*[\w\W]*?\*/`, CommentMultiline, nil}, + {`\\\n`, Text, nil}, + {`\\`, Text, nil}, + {`\'(?:\\[ntbrf\\\']|\\u[0-9a-f]{4}|[^\'\\\n\r])*\'`, LiteralString, nil}, + Include("keywords"), + Include("types"), + Include("builtins"), + Include("punct"), + Include("operators"), + {`[0-9]*\.[0-9]+(e[0-9]+)?[fd]?`, LiteralNumberFloat, nil}, + {`0x[0-9a-f]+`, LiteralNumberHex, nil}, + {`[0-9]+L?`, LiteralNumberInteger, nil}, + {`\n`, Text, nil}, + {`([a-z_]\w*)(\s*)(\()`, ByGroups(NameFunction, Text, Punctuation), nil}, + {`[()#:]`, Text, nil}, + {`[^(:#\'")\s]+`, Text, nil}, + {`\S+\s+`, Text, nil}, + }, + "keywords": { + {`(assert|and|any|all|arrange|as|asc|bag|by|cache|CASE|cat|cd|cp|%declare|%default|define|dense|desc|describe|distinct|du|dump|eval|exex|explain|filter|flatten|foreach|full|generate|group|help|if|illustrate|import|inner|input|into|is|join|kill|left|limit|load|ls|map|matches|mkdir|mv|not|null|onschema|or|order|outer|output|parallel|pig|pwd|quit|register|returns|right|rm|rmf|rollup|run|sample|set|ship|split|stderr|stdin|stdout|store|stream|through|union|using|void)\b`, Keyword, nil}, + }, + "builtins": { + {`(AVG|BinStorage|cogroup|CONCAT|copyFromLocal|copyToLocal|COUNT|cross|DIFF|MAX|MIN|PigDump|PigStorage|SIZE|SUM|TextLoader|TOKENIZE)\b`, NameBuiltin, nil}, + }, + "types": { + {`(bytearray|BIGINTEGER|BIGDECIMAL|chararray|datetime|double|float|int|long|tuple)\b`, KeywordType, nil}, + }, + "punct": { + {`[;(){}\[\]]`, Punctuation, nil}, + }, + "operators": { + {`[#=,./%+\-?]`, Operator, nil}, + {`(eq|gt|lt|gte|lte|neq|matches)\b`, Operator, nil}, + {`(==|<=|<|>=|>|!=)`, Operator, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/pkgconfig.go b/vendor/github.com/alecthomas/chroma/lexers/p/pkgconfig.go new file mode 100644 index 000000000..0a4872e76 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/pkgconfig.go @@ -0,0 +1,41 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Pkgconfig lexer. +var Pkgconfig = internal.Register(MustNewLexer( + &Config{ + Name: "PkgConfig", + Aliases: []string{"pkgconfig"}, + Filenames: []string{"*.pc"}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`#.*$`, CommentSingle, nil}, + {`^(\w+)(=)`, ByGroups(NameAttribute, Operator), nil}, + {`^([\w.]+)(:)`, ByGroups(NameTag, Punctuation), Push("spvalue")}, + Include("interp"), + {`[^${}#=:\n.]+`, Text, nil}, + {`.`, Text, nil}, + }, + "interp": { + {`\$\$`, Text, nil}, + {`\$\{`, LiteralStringInterpol, Push("curly")}, + }, + "curly": { + {`\}`, LiteralStringInterpol, Pop(1)}, + {`\w+`, NameAttribute, nil}, + }, + "spvalue": { + Include("interp"), + {`#.*$`, CommentSingle, Pop(1)}, + {`\n`, Text, Pop(1)}, + {`[^${}#\n]+`, Text, nil}, + {`.`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/plaintext.go b/vendor/github.com/alecthomas/chroma/lexers/p/plaintext.go new file mode 100644 index 000000000..50b8f35d3 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/plaintext.go @@ -0,0 +1,16 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +var Plaintext = internal.Register(MustNewLexer( + &Config{ + Name: "plaintext", + Aliases: []string{"text", "plain", "no-highlight"}, + Filenames: []string{"*.txt"}, + MimeTypes: []string{"text/plain"}, + }, + internal.PlaintextRules, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/plsql.go b/vendor/github.com/alecthomas/chroma/lexers/p/plsql.go new file mode 100644 index 000000000..a6068fd22 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/plsql.go @@ -0,0 +1,58 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Pl/Pgsql lexer. +var PLpgSQL = internal.Register(MustNewLexer( + &Config{ + Name: "PL/pgSQL", + Aliases: []string{"plpgsql"}, + Filenames: []string{}, + MimeTypes: []string{"text/x-plpgsql"}, + NotMultiline: true, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\%[a-z]\w*\b`, NameBuiltin, nil}, + {`:=`, Operator, nil}, + {`\<\<[a-z]\w*\>\>`, NameLabel, nil}, + {`\#[a-z]\w*\b`, KeywordPseudo, nil}, + {`\s+`, Text, nil}, + {`--.*\n?`, CommentSingle, nil}, + {`/\*`, CommentMultiline, Push("multiline-comments")}, + {`(bigint|bigserial|bit|bit\s+varying|bool|boolean|box|bytea|char|character|character\s+varying|cidr|circle|date|decimal|double\s+precision|float4|float8|inet|int|int2|int4|int8|integer|interval|json|jsonb|line|lseg|macaddr|money|numeric|path|pg_lsn|point|polygon|real|serial|serial2|serial4|serial8|smallint|smallserial|text|time|timestamp|timestamptz|timetz|tsquery|tsvector|txid_snapshot|uuid|varbit|varchar|with\s+time\s+zone|without\s+time\s+zone|xml|anyarray|anyelement|anyenum|anynonarray|anyrange|cstring|fdw_handler|internal|language_handler|opaque|record|void)\b`, NameBuiltin, nil}, + {Words(``, `\b`, `ABORT`, `ABSOLUTE`, `ACCESS`, `ACTION`, `ADD`, `ADMIN`, `AFTER`, `AGGREGATE`, `ALL`, `ALSO`, `ALTER`, `ALWAYS`, `ANALYSE`, `ANALYZE`, `AND`, `ANY`, `ARRAY`, `AS`, `ASC`, `ASSERTION`, `ASSIGNMENT`, `ASYMMETRIC`, `AT`, `ATTRIBUTE`, `AUTHORIZATION`, `BACKWARD`, `BEFORE`, `BEGIN`, `BETWEEN`, `BIGINT`, `BINARY`, `BIT`, `BOOLEAN`, `BOTH`, `BY`, `CACHE`, `CALLED`, `CASCADE`, `CASCADED`, `CASE`, `CAST`, `CATALOG`, `CHAIN`, `CHAR`, `CHARACTER`, `CHARACTERISTICS`, `CHECK`, `CHECKPOINT`, `CLASS`, `CLOSE`, `CLUSTER`, `COALESCE`, `COLLATE`, `COLLATION`, `COLUMN`, `COMMENT`, `COMMENTS`, `COMMIT`, `COMMITTED`, `CONCURRENTLY`, `CONFIGURATION`, `CONNECTION`, `CONSTRAINT`, `CONSTRAINTS`, `CONTENT`, `CONTINUE`, `CONVERSION`, `COPY`, `COST`, `CREATE`, `CROSS`, `CSV`, `CURRENT`, `CURRENT_CATALOG`, `CURRENT_DATE`, `CURRENT_ROLE`, `CURRENT_SCHEMA`, `CURRENT_TIME`, `CURRENT_TIMESTAMP`, `CURRENT_USER`, `CURSOR`, `CYCLE`, `DATA`, `DATABASE`, `DAY`, `DEALLOCATE`, `DEC`, `DECIMAL`, `DECLARE`, `DEFAULT`, `DEFAULTS`, `DEFERRABLE`, `DEFERRED`, `DEFINER`, `DELETE`, `DELIMITER`, `DELIMITERS`, `DESC`, `DICTIONARY`, `DISABLE`, `DISCARD`, `DISTINCT`, `DO`, `DOCUMENT`, `DOMAIN`, `DOUBLE`, `DROP`, `EACH`, `ELSE`, `ENABLE`, `ENCODING`, `ENCRYPTED`, `END`, `ENUM`, `ESCAPE`, `EVENT`, `EXCEPT`, `EXCLUDE`, `EXCLUDING`, `EXCLUSIVE`, `EXECUTE`, `EXISTS`, `EXPLAIN`, `EXTENSION`, `EXTERNAL`, `EXTRACT`, `FALSE`, `FAMILY`, `FETCH`, `FILTER`, `FIRST`, `FLOAT`, `FOLLOWING`, `FOR`, `FORCE`, `FOREIGN`, `FORWARD`, `FREEZE`, `FROM`, `FULL`, `FUNCTION`, `FUNCTIONS`, `GLOBAL`, `GRANT`, `GRANTED`, `GREATEST`, `GROUP`, `HANDLER`, `HAVING`, `HEADER`, `HOLD`, `HOUR`, `IDENTITY`, `IF`, `ILIKE`, `IMMEDIATE`, `IMMUTABLE`, `IMPLICIT`, `IN`, `INCLUDING`, `INCREMENT`, `INDEX`, `INDEXES`, `INHERIT`, `INHERITS`, `INITIALLY`, `INLINE`, `INNER`, `INOUT`, `INPUT`, `INSENSITIVE`, `INSERT`, `INSTEAD`, `INT`, `INTEGER`, `INTERSECT`, `INTERVAL`, `INTO`, `INVOKER`, `IS`, `ISNULL`, `ISOLATION`, `JOIN`, `KEY`, `LABEL`, `LANGUAGE`, `LARGE`, `LAST`, `LATERAL`, `LC_COLLATE`, `LC_CTYPE`, `LEADING`, `LEAKPROOF`, `LEAST`, `LEFT`, `LEVEL`, `LIKE`, `LIMIT`, `LISTEN`, `LOAD`, `LOCAL`, `LOCALTIME`, `LOCALTIMESTAMP`, `LOCATION`, `LOCK`, `MAPPING`, `MATCH`, `MATERIALIZED`, `MAXVALUE`, `MINUTE`, `MINVALUE`, `MODE`, `MONTH`, `MOVE`, `NAME`, `NAMES`, `NATIONAL`, `NATURAL`, `NCHAR`, `NEXT`, `NO`, `NONE`, `NOT`, `NOTHING`, `NOTIFY`, `NOTNULL`, `NOWAIT`, `NULL`, `NULLIF`, `NULLS`, `NUMERIC`, `OBJECT`, `OF`, `OFF`, `OFFSET`, `OIDS`, `ON`, `ONLY`, `OPERATOR`, `OPTION`, `OPTIONS`, `OR`, `ORDER`, `ORDINALITY`, `OUT`, `OUTER`, `OVER`, `OVERLAPS`, `OVERLAY`, `OWNED`, `OWNER`, `PARSER`, `PARTIAL`, `PARTITION`, `PASSING`, `PASSWORD`, `PLACING`, `PLANS`, `POLICY`, `POSITION`, `PRECEDING`, `PRECISION`, `PREPARE`, `PREPARED`, `PRESERVE`, `PRIMARY`, `PRIOR`, `PRIVILEGES`, `PROCEDURAL`, `PROCEDURE`, `PROGRAM`, `QUOTE`, `RANGE`, `READ`, `REAL`, `REASSIGN`, `RECHECK`, `RECURSIVE`, `REF`, `REFERENCES`, `REFRESH`, `REINDEX`, `RELATIVE`, `RELEASE`, `RENAME`, `REPEATABLE`, `REPLACE`, `REPLICA`, `RESET`, `RESTART`, `RESTRICT`, `RETURNING`, `RETURNS`, `REVOKE`, `RIGHT`, `ROLE`, `ROLLBACK`, `ROW`, `ROWS`, `RULE`, `SAVEPOINT`, `SCHEMA`, `SCROLL`, `SEARCH`, `SECOND`, `SECURITY`, `SELECT`, `SEQUENCE`, `SEQUENCES`, `SERIALIZABLE`, `SERVER`, `SESSION`, `SESSION_USER`, `SET`, `SETOF`, `SHARE`, `SHOW`, `SIMILAR`, `SIMPLE`, `SMALLINT`, `SNAPSHOT`, `SOME`, `STABLE`, `STANDALONE`, `START`, `STATEMENT`, `STATISTICS`, `STDIN`, `STDOUT`, `STORAGE`, `STRICT`, `STRIP`, `SUBSTRING`, `SYMMETRIC`, `SYSID`, `SYSTEM`, `TABLE`, `TABLES`, `TABLESPACE`, `TEMP`, `TEMPLATE`, `TEMPORARY`, `TEXT`, `THEN`, `TIME`, `TIMESTAMP`, `TO`, `TRAILING`, `TRANSACTION`, `TREAT`, `TRIGGER`, `TRIM`, `TRUE`, `TRUNCATE`, `TRUSTED`, `TYPE`, `TYPES`, `UNBOUNDED`, `UNCOMMITTED`, `UNENCRYPTED`, `UNION`, `UNIQUE`, `UNKNOWN`, `UNLISTEN`, `UNLOGGED`, `UNTIL`, `UPDATE`, `USER`, `USING`, `VACUUM`, `VALID`, `VALIDATE`, `VALIDATOR`, `VALUE`, `VALUES`, `VARCHAR`, `VARIADIC`, `VARYING`, `VERBOSE`, `VERSION`, `VIEW`, `VIEWS`, `VOLATILE`, `WHEN`, `WHERE`, `WHITESPACE`, `WINDOW`, `WITH`, `WITHIN`, `WITHOUT`, `WORK`, `WRAPPER`, `WRITE`, `XML`, `XMLATTRIBUTES`, `XMLCONCAT`, `XMLELEMENT`, `XMLEXISTS`, `XMLFOREST`, `XMLPARSE`, `XMLPI`, `XMLROOT`, `XMLSERIALIZE`, `YEAR`, `YES`, `ZONE`, `ALIAS`, `CONSTANT`, `DIAGNOSTICS`, `ELSIF`, `EXCEPTION`, `EXIT`, `FOREACH`, `GET`, `LOOP`, `NOTICE`, `OPEN`, `PERFORM`, `QUERY`, `RAISE`, `RETURN`, `REVERSE`, `SQLSTATE`, `WHILE`), Keyword, nil}, + {"[+*/<>=~!@#%^&|`?-]+", Operator, nil}, + {`::`, Operator, nil}, + {`\$\d+`, NameVariable, nil}, + {`([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`((?:E|U&)?)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("string")}, + {`((?:U&)?)(")`, ByGroups(LiteralStringAffix, LiteralStringName), Push("quoted-ident")}, + // { `(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)`, ?? ??, nil }, + {`[a-z_]\w*`, Name, nil}, + {`:(['"]?)[a-z]\w*\b\1`, NameVariable, nil}, + {`[;:()\[\]{},.]`, Punctuation, nil}, + }, + "multiline-comments": { + {`/\*`, CommentMultiline, Push("multiline-comments")}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[^/*]+`, CommentMultiline, nil}, + {`[/*]`, CommentMultiline, nil}, + }, + "string": { + {`[^']+`, LiteralStringSingle, nil}, + {`''`, LiteralStringSingle, nil}, + {`'`, LiteralStringSingle, Pop(1)}, + }, + "quoted-ident": { + {`[^"]+`, LiteralStringName, nil}, + {`""`, LiteralStringName, nil}, + {`"`, LiteralStringName, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/postgres.go b/vendor/github.com/alecthomas/chroma/lexers/p/postgres.go new file mode 100644 index 000000000..3afa54deb --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/postgres.go @@ -0,0 +1,77 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Postgresql Sql Dialect lexer. +var PostgreSQL = internal.Register(MustNewLexer( + &Config{ + Name: "PostgreSQL SQL dialect", + Aliases: []string{"postgresql", "postgres"}, + Filenames: []string{}, + MimeTypes: []string{"text/x-postgresql"}, + NotMultiline: true, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`--.*\n?`, CommentSingle, nil}, + {`/\*`, CommentMultiline, Push("multiline-comments")}, + {`(bigint|bigserial|bit|bit\s+varying|bool|boolean|box|bytea|char|character|character\s+varying|cidr|circle|date|decimal|double\s+precision|float4|float8|inet|int|int2|int4|int8|integer|interval|json|jsonb|line|lseg|macaddr|money|numeric|path|pg_lsn|point|polygon|real|serial|serial2|serial4|serial8|smallint|smallserial|text|time|timestamp|timestamptz|timetz|tsquery|tsvector|txid_snapshot|uuid|varbit|varchar|with\s+time\s+zone|without\s+time\s+zone|xml|anyarray|anyelement|anyenum|anynonarray|anyrange|cstring|fdw_handler|internal|language_handler|opaque|record|void)\b`, NameBuiltin, nil}, + {`(?s)(DO)(\s+)(?:(LANGUAGE)?(\s+)('?)(\w+)?('?)(\s+))?(\$)([^$]*)(\$)(.*?)(\$)(\10)(\$)`, + UsingByGroup( + internal.Get, + 6, 12, + Keyword, Text, Keyword, Text, // DO LANGUAGE + StringSingle, StringSingle, StringSingle, Text, // 'plpgsql' + StringHeredoc, StringHeredoc, StringHeredoc, // $tag$ + StringHeredoc, // (code block) + StringHeredoc, StringHeredoc, StringHeredoc, // $tag$ + ), + nil, + }, + {Words(``, `\b`, `ABORT`, `ABSOLUTE`, `ACCESS`, `ACTION`, `ADD`, `ADMIN`, `AFTER`, `AGGREGATE`, `ALL`, `ALSO`, `ALTER`, `ALWAYS`, `ANALYSE`, `ANALYZE`, `AND`, `ANY`, `ARRAY`, `AS`, `ASC`, `ASSERTION`, `ASSIGNMENT`, `ASYMMETRIC`, `AT`, `ATTRIBUTE`, `AUTHORIZATION`, `BACKWARD`, `BEFORE`, `BEGIN`, `BETWEEN`, `BIGINT`, `BINARY`, `BIT`, `BOOLEAN`, `BOTH`, `BY`, `CACHE`, `CALLED`, `CASCADE`, `CASCADED`, `CASE`, `CAST`, `CATALOG`, `CHAIN`, `CHAR`, `CHARACTER`, `CHARACTERISTICS`, `CHECK`, `CHECKPOINT`, `CLASS`, `CLOSE`, `CLUSTER`, `COALESCE`, `COLLATE`, `COLLATION`, `COLUMN`, `COMMENT`, `COMMENTS`, `COMMIT`, `COMMITTED`, `CONCURRENTLY`, `CONFIGURATION`, `CONNECTION`, `CONSTRAINT`, `CONSTRAINTS`, `CONTENT`, `CONTINUE`, `CONVERSION`, `COPY`, `COST`, `CREATE`, `CROSS`, `CSV`, `CURRENT`, `CURRENT_CATALOG`, `CURRENT_DATE`, `CURRENT_ROLE`, `CURRENT_SCHEMA`, `CURRENT_TIME`, `CURRENT_TIMESTAMP`, `CURRENT_USER`, `CURSOR`, `CYCLE`, `DATA`, `DATABASE`, `DAY`, `DEALLOCATE`, `DEC`, `DECIMAL`, `DECLARE`, `DEFAULT`, `DEFAULTS`, `DEFERRABLE`, `DEFERRED`, `DEFINER`, `DELETE`, `DELIMITER`, `DELIMITERS`, `DESC`, `DICTIONARY`, `DISABLE`, `DISCARD`, `DISTINCT`, `DO`, `DOCUMENT`, `DOMAIN`, `DOUBLE`, `DROP`, `EACH`, `ELSE`, `ENABLE`, `ENCODING`, `ENCRYPTED`, `END`, `ENUM`, `ESCAPE`, `EVENT`, `EXCEPT`, `EXCLUDE`, `EXCLUDING`, `EXCLUSIVE`, `EXECUTE`, `EXISTS`, `EXPLAIN`, `EXTENSION`, `EXTERNAL`, `EXTRACT`, `FALSE`, `FAMILY`, `FETCH`, `FILTER`, `FIRST`, `FLOAT`, `FOLLOWING`, `FOR`, `FORCE`, `FOREIGN`, `FORWARD`, `FREEZE`, `FROM`, `FULL`, `FUNCTION`, `FUNCTIONS`, `GLOBAL`, `GRANT`, `GRANTED`, `GREATEST`, `GROUP`, `HANDLER`, `HAVING`, `HEADER`, `HOLD`, `HOUR`, `IDENTITY`, `IF`, `ILIKE`, `IMMEDIATE`, `IMMUTABLE`, `IMPLICIT`, `IN`, `INCLUDING`, `INCREMENT`, `INDEX`, `INDEXES`, `INHERIT`, `INHERITS`, `INITIALLY`, `INLINE`, `INNER`, `INOUT`, `INPUT`, `INSENSITIVE`, `INSERT`, `INSTEAD`, `INT`, `INTEGER`, `INTERSECT`, `INTERVAL`, `INTO`, `INVOKER`, `IS`, `ISNULL`, `ISOLATION`, `JOIN`, `KEY`, `LABEL`, `LANGUAGE`, `LARGE`, `LAST`, `LATERAL`, `LC_COLLATE`, `LC_CTYPE`, `LEADING`, `LEAKPROOF`, `LEAST`, `LEFT`, `LEVEL`, `LIKE`, `LIMIT`, `LISTEN`, `LOAD`, `LOCAL`, `LOCALTIME`, `LOCALTIMESTAMP`, `LOCATION`, `LOCK`, `MAPPING`, `MATCH`, `MATERIALIZED`, `MAXVALUE`, `MINUTE`, `MINVALUE`, `MODE`, `MONTH`, `MOVE`, `NAME`, `NAMES`, `NATIONAL`, `NATURAL`, `NCHAR`, `NEXT`, `NO`, `NONE`, `NOT`, `NOTHING`, `NOTIFY`, `NOTNULL`, `NOWAIT`, `NULL`, `NULLIF`, `NULLS`, `NUMERIC`, `OBJECT`, `OF`, `OFF`, `OFFSET`, `OIDS`, `ON`, `ONLY`, `OPERATOR`, `OPTION`, `OPTIONS`, `OR`, `ORDER`, `ORDINALITY`, `OUT`, `OUTER`, `OVER`, `OVERLAPS`, `OVERLAY`, `OWNED`, `OWNER`, `PARSER`, `PARTIAL`, `PARTITION`, `PASSING`, `PASSWORD`, `PLACING`, `PLANS`, `POLICY`, `POSITION`, `PRECEDING`, `PRECISION`, `PREPARE`, `PREPARED`, `PRESERVE`, `PRIMARY`, `PRIOR`, `PRIVILEGES`, `PROCEDURAL`, `PROCEDURE`, `PROGRAM`, `QUOTE`, `RANGE`, `READ`, `REAL`, `REASSIGN`, `RECHECK`, `RECURSIVE`, `REF`, `REFERENCES`, `REFRESH`, `REINDEX`, `RELATIVE`, `RELEASE`, `RENAME`, `REPEATABLE`, `REPLACE`, `REPLICA`, `RESET`, `RESTART`, `RESTRICT`, `RETURNING`, `RETURNS`, `REVOKE`, `RIGHT`, `ROLE`, `ROLLBACK`, `ROW`, `ROWS`, `RULE`, `SAVEPOINT`, `SCHEMA`, `SCROLL`, `SEARCH`, `SECOND`, `SECURITY`, `SELECT`, `SEQUENCE`, `SEQUENCES`, `SERIALIZABLE`, `SERVER`, `SESSION`, `SESSION_USER`, `SET`, `SETOF`, `SHARE`, `SHOW`, `SIMILAR`, `SIMPLE`, `SMALLINT`, `SNAPSHOT`, `SOME`, `STABLE`, `STANDALONE`, `START`, `STATEMENT`, `STATISTICS`, `STDIN`, `STDOUT`, `STORAGE`, `STRICT`, `STRIP`, `SUBSTRING`, `SYMMETRIC`, `SYSID`, `SYSTEM`, `TABLE`, `TABLES`, `TABLESPACE`, `TEMP`, `TEMPLATE`, `TEMPORARY`, `TEXT`, `THEN`, `TIME`, `TIMESTAMP`, `TO`, `TRAILING`, `TRANSACTION`, `TREAT`, `TRIGGER`, `TRIM`, `TRUE`, `TRUNCATE`, `TRUSTED`, `TYPE`, `TYPES`, `UNBOUNDED`, `UNCOMMITTED`, `UNENCRYPTED`, `UNION`, `UNIQUE`, `UNKNOWN`, `UNLISTEN`, `UNLOGGED`, `UNTIL`, `UPDATE`, `USER`, `USING`, `VACUUM`, `VALID`, `VALIDATE`, `VALIDATOR`, `VALUE`, `VALUES`, `VARCHAR`, `VARIADIC`, `VARYING`, `VERBOSE`, `VERSION`, `VIEW`, `VIEWS`, `VOLATILE`, `WHEN`, `WHERE`, `WHITESPACE`, `WINDOW`, `WITH`, `WITHIN`, `WITHOUT`, `WORK`, `WRAPPER`, `WRITE`, `XML`, `XMLATTRIBUTES`, `XMLCONCAT`, `XMLELEMENT`, `XMLEXISTS`, `XMLFOREST`, `XMLPARSE`, `XMLPI`, `XMLROOT`, `XMLSERIALIZE`, `YEAR`, `YES`, `ZONE`), Keyword, nil}, + {"[+*/<>=~!@#%^&|`?-]+", Operator, nil}, + {`::`, Operator, nil}, + {`\$\d+`, NameVariable, nil}, + {`([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`((?:E|U&)?)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("string")}, + {`((?:U&)?)(")`, ByGroups(LiteralStringAffix, LiteralStringName), Push("quoted-ident")}, + {`(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)(\s+)(LANGUAGE)?(\s+)('?)(\w+)?('?)`, + UsingByGroup(internal.Get, + 12, 4, + StringHeredoc, StringHeredoc, StringHeredoc, // $tag$ + StringHeredoc, // (code block) + StringHeredoc, StringHeredoc, StringHeredoc, // $tag$ + Text, Keyword, Text, // LANGUAGE + StringSingle, StringSingle, StringSingle, // 'type' + ), + nil, + }, + {`(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)`, LiteralStringHeredoc, nil}, + {`[a-z_]\w*`, Name, nil}, + {`:(['"]?)[a-z]\w*\b\1`, NameVariable, nil}, + {`[;:()\[\]{},.]`, Punctuation, nil}, + }, + "multiline-comments": { + {`/\*`, CommentMultiline, Push("multiline-comments")}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[^/*]+`, CommentMultiline, nil}, + {`[/*]`, CommentMultiline, nil}, + }, + "string": { + {`[^']+`, LiteralStringSingle, nil}, + {`''`, LiteralStringSingle, nil}, + {`'`, LiteralStringSingle, Pop(1)}, + }, + "quoted-ident": { + {`[^"]+`, LiteralStringName, nil}, + {`""`, LiteralStringName, nil}, + {`"`, LiteralStringName, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/postscript.go b/vendor/github.com/alecthomas/chroma/lexers/p/postscript.go new file mode 100644 index 000000000..0cfa3a5f1 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/postscript.go @@ -0,0 +1,46 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Postscript lexer. +var Postscript = internal.Register(MustNewLexer( + &Config{ + Name: "PostScript", + Aliases: []string{"postscript", "postscr"}, + Filenames: []string{"*.ps", "*.eps"}, + MimeTypes: []string{"application/postscript"}, + }, + Rules{ + "root": { + {`^%!.+\n`, CommentPreproc, nil}, + {`%%.*\n`, CommentSpecial, nil}, + {`(^%.*\n){2,}`, CommentMultiline, nil}, + {`%.*\n`, CommentSingle, nil}, + {`\(`, LiteralString, Push("stringliteral")}, + {`[{}<>\[\]]`, Punctuation, nil}, + {`<[0-9A-Fa-f]+>(?=[()<>\[\]{}/%\s])`, LiteralNumberHex, nil}, + {`[0-9]+\#(\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)((e|E)[0-9]+)?(?=[()<>\[\]{}/%\s])`, LiteralNumberOct, nil}, + {`(\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)((e|E)[0-9]+)?(?=[()<>\[\]{}/%\s])`, LiteralNumberFloat, nil}, + {`(\-|\+)?[0-9]+(?=[()<>\[\]{}/%\s])`, LiteralNumberInteger, nil}, + {`\/[^()<>\[\]{}/%\s]+(?=[()<>\[\]{}/%\s])`, NameVariable, nil}, + {`[^()<>\[\]{}/%\s]+(?=[()<>\[\]{}/%\s])`, NameFunction, nil}, + {`(false|true)(?=[()<>\[\]{}/%\s])`, KeywordConstant, nil}, + {`(eq|ne|g[et]|l[et]|and|or|not|if(?:else)?|for(?:all)?)(?=[()<>\[\]{}/%\s])`, KeywordReserved, nil}, + {Words(``, `(?=[()<>\[\]{}/%\s])`, `abs`, `add`, `aload`, `arc`, `arcn`, `array`, `atan`, `begin`, `bind`, `ceiling`, `charpath`, `clip`, `closepath`, `concat`, `concatmatrix`, `copy`, `cos`, `currentlinewidth`, `currentmatrix`, `currentpoint`, `curveto`, `cvi`, `cvs`, `def`, `defaultmatrix`, `dict`, `dictstackoverflow`, `div`, `dtransform`, `dup`, `end`, `exch`, `exec`, `exit`, `exp`, `fill`, `findfont`, `floor`, `get`, `getinterval`, `grestore`, `gsave`, `gt`, `identmatrix`, `idiv`, `idtransform`, `index`, `invertmatrix`, `itransform`, `length`, `lineto`, `ln`, `load`, `log`, `loop`, `matrix`, `mod`, `moveto`, `mul`, `neg`, `newpath`, `pathforall`, `pathbbox`, `pop`, `print`, `pstack`, `put`, `quit`, `rand`, `rangecheck`, `rcurveto`, `repeat`, `restore`, `rlineto`, `rmoveto`, `roll`, `rotate`, `round`, `run`, `save`, `scale`, `scalefont`, `setdash`, `setfont`, `setgray`, `setlinecap`, `setlinejoin`, `setlinewidth`, `setmatrix`, `setrgbcolor`, `shfill`, `show`, `showpage`, `sin`, `sqrt`, `stack`, `stringwidth`, `stroke`, `strokepath`, `sub`, `syntaxerror`, `transform`, `translate`, `truncate`, `typecheck`, `undefined`, `undefinedfilename`, `undefinedresult`), NameBuiltin, nil}, + {`\s+`, Text, nil}, + }, + "stringliteral": { + {`[^()\\]+`, LiteralString, nil}, + {`\\`, LiteralStringEscape, Push("escape")}, + {`\(`, LiteralString, Push()}, + {`\)`, LiteralString, Pop(1)}, + }, + "escape": { + {`[0-8]{3}|n|r|t|b|f|\\|\(|\)`, LiteralStringEscape, Pop(1)}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/povray.go b/vendor/github.com/alecthomas/chroma/lexers/p/povray.go new file mode 100644 index 000000000..6f1bb5249 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/povray.go @@ -0,0 +1,35 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Povray lexer. +var Povray = internal.Register(MustNewLexer( + &Config{ + Name: "POVRay", + Aliases: []string{"pov"}, + Filenames: []string{"*.pov", "*.inc"}, + MimeTypes: []string{"text/x-povray"}, + }, + Rules{ + "root": { + {`/\*[\w\W]*?\*/`, CommentMultiline, nil}, + {`//.*\n`, CommentSingle, nil}, + {`(?s)"(?:\\.|[^"\\])+"`, LiteralStringDouble, nil}, + {Words(`#`, `\b`, `break`, `case`, `debug`, `declare`, `default`, `define`, `else`, `elseif`, `end`, `error`, `fclose`, `fopen`, `for`, `if`, `ifdef`, `ifndef`, `include`, `local`, `macro`, `range`, `read`, `render`, `statistics`, `switch`, `undef`, `version`, `warning`, `while`, `write`), CommentPreproc, nil}, + {Words(`\b`, `\b`, `aa_level`, `aa_threshold`, `abs`, `acos`, `acosh`, `adaptive`, `adc_bailout`, `agate`, `agate_turb`, `all`, `alpha`, `ambient`, `ambient_light`, `angle`, `aperture`, `arc_angle`, `area_light`, `asc`, `asin`, `asinh`, `assumed_gamma`, `atan`, `atan2`, `atanh`, `atmosphere`, `atmospheric_attenuation`, `attenuating`, `average`, `background`, `black_hole`, `blue`, `blur_samples`, `bounded_by`, `box_mapping`, `bozo`, `break`, `brick`, `brick_size`, `brightness`, `brilliance`, `bumps`, `bumpy1`, `bumpy2`, `bumpy3`, `bump_map`, `bump_size`, `case`, `caustics`, `ceil`, `checker`, `chr`, `clipped_by`, `clock`, `color`, `color_map`, `colour`, `colour_map`, `component`, `composite`, `concat`, `confidence`, `conic_sweep`, `constant`, `control0`, `control1`, `cos`, `cosh`, `count`, `crackle`, `crand`, `cube`, `cubic_spline`, `cylindrical_mapping`, `debug`, `declare`, `default`, `degrees`, `dents`, `diffuse`, `direction`, `distance`, `distance_maximum`, `div`, `dust`, `dust_type`, `eccentricity`, `else`, `emitting`, `end`, `error`, `error_bound`, `exp`, `exponent`, `fade_distance`, `fade_power`, `falloff`, `falloff_angle`, `false`, `file_exists`, `filter`, `finish`, `fisheye`, `flatness`, `flip`, `floor`, `focal_point`, `fog`, `fog_alt`, `fog_offset`, `fog_type`, `frequency`, `gif`, `global_settings`, `glowing`, `gradient`, `granite`, `gray_threshold`, `green`, `halo`, `hexagon`, `hf_gray_16`, `hierarchy`, `hollow`, `hypercomplex`, `if`, `ifdef`, `iff`, `image_map`, `incidence`, `include`, `int`, `interpolate`, `inverse`, `ior`, `irid`, `irid_wavelength`, `jitter`, `lambda`, `leopard`, `linear`, `linear_spline`, `linear_sweep`, `location`, `log`, `looks_like`, `look_at`, `low_error_factor`, `mandel`, `map_type`, `marble`, `material_map`, `matrix`, `max`, `max_intersections`, `max_iteration`, `max_trace_level`, `max_value`, `metallic`, `min`, `minimum_reuse`, `mod`, `mortar`, `nearest_count`, `no`, `normal`, `normal_map`, `no_shadow`, `number_of_waves`, `octaves`, `off`, `offset`, `omega`, `omnimax`, `on`, `once`, `onion`, `open`, `orthographic`, `panoramic`, `pattern1`, `pattern2`, `pattern3`, `perspective`, `pgm`, `phase`, `phong`, `phong_size`, `pi`, `pigment`, `pigment_map`, `planar_mapping`, `png`, `point_at`, `pot`, `pow`, `ppm`, `precision`, `pwr`, `quadratic_spline`, `quaternion`, `quick_color`, `quick_colour`, `quilted`, `radial`, `radians`, `radiosity`, `radius`, `rainbow`, `ramp_wave`, `rand`, `range`, `reciprocal`, `recursion_limit`, `red`, `reflection`, `refraction`, `render`, `repeat`, `rgb`, `rgbf`, `rgbft`, `rgbt`, `right`, `ripples`, `rotate`, `roughness`, `samples`, `scale`, `scallop_wave`, `scattering`, `seed`, `shadowless`, `sin`, `sine_wave`, `sinh`, `sky`, `sky_sphere`, `slice`, `slope_map`, `smooth`, `specular`, `spherical_mapping`, `spiral`, `spiral1`, `spiral2`, `spotlight`, `spotted`, `sqr`, `sqrt`, `statistics`, `str`, `strcmp`, `strength`, `strlen`, `strlwr`, `strupr`, `sturm`, `substr`, `switch`, `sys`, `t`, `tan`, `tanh`, `test_camera_1`, `test_camera_2`, `test_camera_3`, `test_camera_4`, `texture`, `texture_map`, `tga`, `thickness`, `threshold`, `tightness`, `tile2`, `tiles`, `track`, `transform`, `translate`, `transmit`, `triangle_wave`, `true`, `ttf`, `turbulence`, `turb_depth`, `type`, `ultra_wide_angle`, `up`, `use_color`, `use_colour`, `use_index`, `u_steps`, `val`, `variance`, `vaxis_rotate`, `vcross`, `vdot`, `version`, `vlength`, `vnormalize`, `volume_object`, `volume_rendered`, `vol_with_light`, `vrotate`, `v_steps`, `warning`, `warp`, `water_level`, `waves`, `while`, `width`, `wood`, `wrinkles`, `yes`), Keyword, nil}, + {Words(``, `\b`, `bicubic_patch`, `blob`, `box`, `camera`, `cone`, `cubic`, `cylinder`, `difference`, `disc`, `height_field`, `intersection`, `julia_fractal`, `lathe`, `light_source`, `merge`, `mesh`, `object`, `plane`, `poly`, `polygon`, `prism`, `quadric`, `quartic`, `smooth_triangle`, `sor`, `sphere`, `superellipsoid`, `text`, `torus`, `triangle`, `union`), NameBuiltin, nil}, + {`[\[\](){}<>;,]`, Punctuation, nil}, + {`[-+*/=]`, Operator, nil}, + {`\b(x|y|z|u|v)\b`, NameBuiltinPseudo, nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + {`[0-9]+\.[0-9]*`, LiteralNumberFloat, nil}, + {`\.[0-9]+`, LiteralNumberFloat, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`\s+`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/powershell.go b/vendor/github.com/alecthomas/chroma/lexers/p/powershell.go new file mode 100644 index 000000000..10eba4f95 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/powershell.go @@ -0,0 +1,66 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Powershell lexer. +var Powershell = internal.Register(MustNewLexer( + &Config{ + Name: "PowerShell", + Aliases: []string{"powershell", "posh", "ps1", "psm1"}, + Filenames: []string{"*.ps1", "*.psm1"}, + MimeTypes: []string{"text/x-powershell"}, + DotAll: true, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\(`, Punctuation, Push("child")}, + {`\s+`, Text, nil}, + {`^(\s*#[#\s]*)(\.(?:component|description|example|externalhelp|forwardhelpcategory|forwardhelptargetname|functionality|inputs|link|notes|outputs|parameter|remotehelprunspace|role|synopsis))([^\n]*$)`, ByGroups(Comment, LiteralStringDoc, Comment), nil}, + {`#[^\n]*?$`, Comment, nil}, + {`(<|<)#`, CommentMultiline, Push("multline")}, + {`(?i)([A-Z]:)`, Name, nil}, + {`@"\n`, LiteralStringHeredoc, Push("heredoc-double")}, + {`@'\n.*?\n'@`, LiteralStringHeredoc, nil}, + {"`[\\'\"$@-]", Punctuation, nil}, + {`"`, LiteralStringDouble, Push("string")}, + {`'([^']|'')*'`, LiteralStringSingle, nil}, + {`(\$|@@|@)((global|script|private|env):)?\w+`, NameVariable, nil}, + {`(while|validateset|validaterange|validatepattern|validatelength|validatecount|until|trap|switch|return|ref|process|param|parameter|in|if|global:|function|foreach|for|finally|filter|end|elseif|else|dynamicparam|do|default|continue|cmdletbinding|break|begin|alias|\?|%|#script|#private|#local|#global|mandatory|parametersetname|position|valuefrompipeline|valuefrompipelinebypropertyname|valuefromremainingarguments|helpmessage|try|catch|throw)\b`, Keyword, nil}, + {`-(and|as|band|bnot|bor|bxor|casesensitive|ccontains|ceq|cge|cgt|cle|clike|clt|cmatch|cne|cnotcontains|cnotlike|cnotmatch|contains|creplace|eq|exact|f|file|ge|gt|icontains|ieq|ige|igt|ile|ilike|ilt|imatch|ine|inotcontains|inotlike|inotmatch|ireplace|is|isnot|le|like|lt|match|ne|not|notcontains|notlike|notmatch|or|regex|replace|wildcard)\b`, Operator, nil}, + {`(write|where|watch|wait|use|update|unregister|unpublish|unprotect|unlock|uninstall|undo|unblock|trace|test|tee|take|sync|switch|suspend|submit|stop|step|start|split|sort|skip|show|set|send|select|search|scroll|save|revoke|resume|restore|restart|resolve|resize|reset|request|repair|rename|remove|register|redo|receive|read|push|publish|protect|pop|ping|out|optimize|open|new|move|mount|merge|measure|lock|limit|join|invoke|install|initialize|import|hide|group|grant|get|format|foreach|find|export|expand|exit|enter|enable|edit|dismount|disconnect|disable|deny|debug|cxnew|copy|convertto|convertfrom|convert|connect|confirm|compress|complete|compare|close|clear|checkpoint|block|backup|assert|approve|aggregate|add)-[a-z_]\w*\b`, NameBuiltin, nil}, + {`(ac|asnp|cat|cd|cfs|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|curl|cvpa|dbp|del|diff|dir|dnsn|ebp|echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fhx|fl|foreach|ft|fw|gal|gbp|gc|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps|gpv|group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md|measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|pwd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri|rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|wget|where|wjb|write)\s`, NameBuiltin, nil}, + {"\\[[a-z_\\[][\\w. `,\\[\\]]*\\]", NameConstant, nil}, + {`-[a-z_]\w*`, Name, nil}, + {`\w+`, Name, nil}, + {"[.,;@{}\\[\\]$()=+*/\\\\&%!~?^`|<>-]|::", Punctuation, nil}, + }, + "child": { + {`\)`, Punctuation, Pop(1)}, + Include("root"), + }, + "multline": { + {`[^#&.]+`, CommentMultiline, nil}, + {`#(>|>)`, CommentMultiline, Pop(1)}, + {`\.(component|description|example|externalhelp|forwardhelpcategory|forwardhelptargetname|functionality|inputs|link|notes|outputs|parameter|remotehelprunspace|role|synopsis)`, LiteralStringDoc, nil}, + {`[#&.]`, CommentMultiline, nil}, + }, + "string": { + {"`[0abfnrtv'\\\"$`]", LiteralStringEscape, nil}, + {"[^$`\"]+", LiteralStringDouble, nil}, + {`\$\(`, Punctuation, Push("child")}, + {`""`, LiteralStringDouble, nil}, + {"[`$]", LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + "heredoc-double": { + {`\n"@`, LiteralStringHeredoc, Pop(1)}, + {`\$\(`, Punctuation, Push("child")}, + {`[^@\n]+"]`, LiteralStringHeredoc, nil}, + {`.`, LiteralStringHeredoc, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/prolog.go b/vendor/github.com/alecthomas/chroma/lexers/p/prolog.go new file mode 100644 index 000000000..08b48121b --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/prolog.go @@ -0,0 +1,50 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Prolog lexer. +var Prolog = internal.Register(MustNewLexer( + &Config{ + Name: "Prolog", + Aliases: []string{"prolog"}, + Filenames: []string{"*.ecl", "*.prolog", "*.pro", "*.pl"}, + MimeTypes: []string{"text/x-prolog"}, + }, + Rules{ + "root": { + {`/\*`, CommentMultiline, Push("nested-comment")}, + {`%.*`, CommentSingle, nil}, + {`0\'.`, LiteralStringChar, nil}, + {`0b[01]+`, LiteralNumberBin, nil}, + {`0o[0-7]+`, LiteralNumberOct, nil}, + {`0x[0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`\d\d?\'[a-zA-Z0-9]+`, LiteralNumberInteger, nil}, + {`(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`[\[\](){}|.,;!]`, Punctuation, nil}, + {`:-|-->`, Punctuation, nil}, + {`"(?:\\x[0-9a-fA-F]+\\|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\[0-7]+\\|\\["\nabcefnrstv]|[^\\"])*"`, LiteralStringDouble, nil}, + {`'(?:''|[^'])*'`, LiteralStringAtom, nil}, + {`is\b`, Operator, nil}, + {`(<|>|=<|>=|==|=:=|=|/|//|\*|\+|-)(?=\s|[a-zA-Z0-9\[])`, Operator, nil}, + {`(mod|div|not)\b`, Operator, nil}, + {`_`, Keyword, nil}, + {`([a-z]+)(:)`, ByGroups(NameNamespace, Punctuation), nil}, + {`([a-zÀ-῿぀-퟿-￯][\w$À-῿぀-퟿-￯]*)(\s*)(:-|-->)`, ByGroups(NameFunction, Text, Operator), nil}, + {`([a-zÀ-῿぀-퟿-￯][\w$À-῿぀-퟿-￯]*)(\s*)(\()`, ByGroups(NameFunction, Text, Punctuation), nil}, + {`[a-zÀ-῿぀-퟿-￯][\w$À-῿぀-퟿-￯]*`, LiteralStringAtom, nil}, + {`[#&*+\-./:<=>?@\\^~¡-¿‐-〿]+`, LiteralStringAtom, nil}, + {`[A-Z_]\w*`, NameVariable, nil}, + {`\s+|[ -‏￰-￾￯]`, Text, nil}, + }, + "nested-comment": { + {`\*/`, CommentMultiline, Pop(1)}, + {`/\*`, CommentMultiline, Push()}, + {`[^*/]+`, CommentMultiline, nil}, + {`[*/]`, CommentMultiline, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/protobuf.go b/vendor/github.com/alecthomas/chroma/lexers/p/protobuf.go new file mode 100644 index 000000000..30140131c --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/protobuf.go @@ -0,0 +1,53 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// ProtocolBuffer lexer. +var ProtocolBuffer = internal.Register(MustNewLexer( + &Config{ + Name: "Protocol Buffer", + Aliases: []string{"protobuf", "proto"}, + Filenames: []string{"*.proto"}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`[ \t]+`, Text, nil}, + {`[,;{}\[\]()<>]`, Punctuation, nil}, + {`/(\\\n)?/(\n|(.|\n)*?[^\\]\n)`, CommentSingle, nil}, + {`/(\\\n)?\*(.|\n)*?\*(\\\n)?/`, CommentMultiline, nil}, + {Words(`\b`, `\b`, `import`, `option`, `optional`, `required`, `repeated`, `default`, `packed`, `ctype`, `extensions`, `to`, `max`, `rpc`, `returns`, `oneof`), Keyword, nil}, + {Words(``, `\b`, `int32`, `int64`, `uint32`, `uint64`, `sint32`, `sint64`, `fixed32`, `fixed64`, `sfixed32`, `sfixed64`, `float`, `double`, `bool`, `string`, `bytes`), KeywordType, nil}, + {`(true|false)\b`, KeywordConstant, nil}, + {`(package)(\s+)`, ByGroups(KeywordNamespace, Text), Push("package")}, + {`(message|extend)(\s+)`, ByGroups(KeywordDeclaration, Text), Push("message")}, + {`(enum|group|service)(\s+)`, ByGroups(KeywordDeclaration, Text), Push("type")}, + {`\".*?\"`, LiteralString, nil}, + {`\'.*?\'`, LiteralString, nil}, + {`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*`, LiteralNumberFloat, nil}, + {`(\d+\.\d*|\.\d+|\d+[fF])[fF]?`, LiteralNumberFloat, nil}, + {`(\-?(inf|nan))\b`, LiteralNumberFloat, nil}, + {`0x[0-9a-fA-F]+[LlUu]*`, LiteralNumberHex, nil}, + {`0[0-7]+[LlUu]*`, LiteralNumberOct, nil}, + {`\d+[LlUu]*`, LiteralNumberInteger, nil}, + {`[+-=]`, Operator, nil}, + {`([a-zA-Z_][\w.]*)([ \t]*)(=)`, ByGroups(Name, Text, Operator), nil}, + {`[a-zA-Z_][\w.]*`, Name, nil}, + }, + "package": { + {`[a-zA-Z_]\w*`, NameNamespace, Pop(1)}, + Default(Pop(1)), + }, + "message": { + {`[a-zA-Z_]\w*`, NameClass, Pop(1)}, + Default(Pop(1)), + }, + "type": { + {`[a-zA-Z_]\w*`, Name, Pop(1)}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/puppet.go b/vendor/github.com/alecthomas/chroma/lexers/p/puppet.go new file mode 100644 index 000000000..a1db0d27b --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/puppet.go @@ -0,0 +1,56 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Puppet lexer. +var Puppet = internal.Register(MustNewLexer( + &Config{ + Name: "Puppet", + Aliases: []string{"puppet"}, + Filenames: []string{"*.pp"}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + Include("comments"), + Include("keywords"), + Include("names"), + Include("numbers"), + Include("operators"), + Include("strings"), + {`[]{}:(),;[]`, Punctuation, nil}, + {`[^\S\n]+`, Text, nil}, + }, + "comments": { + {`\s*#.*$`, Comment, nil}, + {`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil}, + }, + "operators": { + {`(=>|\?|<|>|=|\+|-|/|\*|~|!|\|)`, Operator, nil}, + {`(in|and|or|not)\b`, OperatorWord, nil}, + }, + "names": { + {`[a-zA-Z_]\w*`, NameAttribute, nil}, + {`(\$\S+)(\[)(\S+)(\])`, ByGroups(NameVariable, Punctuation, LiteralString, Punctuation), nil}, + {`\$\S+`, NameVariable, nil}, + }, + "numbers": { + {`(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?`, LiteralNumberFloat, nil}, + {`\d+[eE][+-]?[0-9]+j?`, LiteralNumberFloat, nil}, + {`0[0-7]+j?`, LiteralNumberOct, nil}, + {`0[xX][a-fA-F0-9]+`, LiteralNumberHex, nil}, + {`\d+L`, LiteralNumberIntegerLong, nil}, + {`\d+j?`, LiteralNumberInteger, nil}, + }, + "keywords": { + {Words(`(?i)`, `\b`, `absent`, `alert`, `alias`, `audit`, `augeas`, `before`, `case`, `check`, `class`, `computer`, `configured`, `contained`, `create_resources`, `crit`, `cron`, `debug`, `default`, `define`, `defined`, `directory`, `else`, `elsif`, `emerg`, `err`, `exec`, `extlookup`, `fail`, `false`, `file`, `filebucket`, `fqdn_rand`, `generate`, `host`, `if`, `import`, `include`, `info`, `inherits`, `inline_template`, `installed`, `interface`, `k5login`, `latest`, `link`, `loglevel`, `macauthorization`, `mailalias`, `maillist`, `mcx`, `md5`, `mount`, `mounted`, `nagios_command`, `nagios_contact`, `nagios_contactgroup`, `nagios_host`, `nagios_hostdependency`, `nagios_hostescalation`, `nagios_hostextinfo`, `nagios_hostgroup`, `nagios_service`, `nagios_servicedependency`, `nagios_serviceescalation`, `nagios_serviceextinfo`, `nagios_servicegroup`, `nagios_timeperiod`, `node`, `noop`, `notice`, `notify`, `package`, `present`, `purged`, `realize`, `regsubst`, `resources`, `role`, `router`, `running`, `schedule`, `scheduled_task`, `search`, `selboolean`, `selmodule`, `service`, `sha1`, `shellquote`, `split`, `sprintf`, `ssh_authorized_key`, `sshkey`, `stage`, `stopped`, `subscribe`, `tag`, `tagged`, `template`, `tidy`, `true`, `undef`, `unmounted`, `user`, `versioncmp`, `vlan`, `warning`, `yumrepo`, `zfs`, `zone`, `zpool`), Keyword, nil}, + }, + "strings": { + {`"([^"])*"`, LiteralString, nil}, + {`'(\\'|[^'])*'`, LiteralString, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/p/python.go b/vendor/github.com/alecthomas/chroma/lexers/p/python.go new file mode 100644 index 000000000..77f2c8db6 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/p/python.go @@ -0,0 +1,137 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Python lexer. +var Python = internal.Register(MustNewLexer( + &Config{ + Name: "Python", + Aliases: []string{"python", "py", "sage"}, + Filenames: []string{"*.py", "*.pyw", "*.sc", "SConstruct", "SConscript", "*.tac", "*.sage"}, + MimeTypes: []string{"text/x-python", "application/x-python"}, + }, + Rules{ + "root": { + {`\n`, Text, nil}, + {`^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringAffix, LiteralStringDoc), nil}, + {`^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')`, ByGroups(Text, LiteralStringAffix, LiteralStringDoc), nil}, + {`[^\S\n]+`, Text, nil}, + {`\A#!.+$`, CommentHashbang, nil}, + {`#.*$`, CommentSingle, nil}, + {`[]{}:(),;[]`, Punctuation, nil}, + {`\\\n`, Text, nil}, + {`\\`, Text, nil}, + {`(in|is|and|or|not)\b`, OperatorWord, nil}, + {`!=|==|<<|>>|[-~+/*%=<>&^|.]`, Operator, nil}, + Include("keywords"), + {`(def)((?:\s|\\\s)+)`, ByGroups(Keyword, Text), Push("funcname")}, + {`(class)((?:\s|\\\s)+)`, ByGroups(Keyword, Text), Push("classname")}, + {`(from)((?:\s|\\\s)+)`, ByGroups(KeywordNamespace, Text), Push("fromimport")}, + {`(import)((?:\s|\\\s)+)`, ByGroups(KeywordNamespace, Text), Push("import")}, + Include("builtins"), + Include("magicfuncs"), + Include("magicvars"), + Include("backtick"), + {`([rR]|[uUbB][rR]|[rR][uUbB])(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("tdqs")}, + {`([rR]|[uUbB][rR]|[rR][uUbB])(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("tsqs")}, + {`([rR]|[uUbB][rR]|[rR][uUbB])(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("dqs")}, + {`([rR]|[uUbB][rR]|[rR][uUbB])(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("sqs")}, + {`([uUbB]?)(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("stringescape", "tdqs")}, + {`([uUbB]?)(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("stringescape", "tsqs")}, + {`([uUbB]?)(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("stringescape", "dqs")}, + {`([uUbB]?)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("stringescape", "sqs")}, + Include("name"), + Include("numbers"), + }, + "keywords": { + {Words(``, `\b`, `assert`, `break`, `continue`, `del`, `elif`, `else`, `except`, `exec`, `finally`, `for`, `global`, `if`, `lambda`, `pass`, `print`, `raise`, `return`, `try`, `while`, `yield`, `yield from`, `as`, `with`), Keyword, nil}, + }, + "builtins": { + {Words(`(?>|[-~+/*%=<>&^|.]`, Operator, nil}, + Include("keywords"), + {`(def)((?:\s|\\\s)+)`, ByGroups(Keyword, Text), Push("funcname")}, + {`(class)((?:\s|\\\s)+)`, ByGroups(Keyword, Text), Push("classname")}, + {`(from)((?:\s|\\\s)+)`, ByGroups(KeywordNamespace, Text), Push("fromimport")}, + {`(import)((?:\s|\\\s)+)`, ByGroups(KeywordNamespace, Text), Push("import")}, + Include("builtins"), + Include("magicfuncs"), + Include("magicvars"), + Include("backtick"), + {`([rR]|[uUbB][rR]|[rR][uUbB])(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("tdqs")}, + {`([rR]|[uUbB][rR]|[rR][uUbB])(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("tsqs")}, + {`([rR]|[uUbB][rR]|[rR][uUbB])(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("dqs")}, + {`([rR]|[uUbB][rR]|[rR][uUbB])(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("sqs")}, + {`([uUbB]?)(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("stringescape", "tdqs")}, + {`([uUbB]?)(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("stringescape", "tsqs")}, + {`([uUbB]?)(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("stringescape", "dqs")}, + {`([uUbB]?)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("stringescape", "sqs")}, + Include("name"), + Include("numbers"), + }, + "keywords": { + {Words(``, `\b`, `assert`, `async`, `await`, `break`, `continue`, `del`, `elif`, `else`, `except`, `finally`, `for`, `global`, `if`, `lambda`, `pass`, `raise`, `nonlocal`, `return`, `try`, `while`, `yield`, `yield from`, `as`, `with`), Keyword, nil}, + {Words(``, `\b`, `True`, `False`, `None`), KeywordConstant, nil}, + }, + "builtins": { + {Words(`(?=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?\}`, LiteralStringInterpol, nil}, + {`[^\\\'"%{\n]+`, LiteralStringSingle, nil}, + {`[\'"\\]`, LiteralStringSingle, nil}, + {`%|(\{{1,2})`, LiteralStringSingle, nil}, + }, + "strings-double": { + {`%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]`, LiteralStringInterpol, nil}, + {`\{((\w+)((\.\w+)|(\[[^\]]+\]))*)?(\![sra])?(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?\}`, LiteralStringInterpol, nil}, + {`[^\\\'"%{\n]+`, LiteralStringDouble, nil}, + {`[\'"\\]`, LiteralStringDouble, nil}, + {`%|(\{{1,2})`, LiteralStringDouble, nil}, + }, + "dqs": { + {`"`, LiteralStringDouble, Pop(1)}, + {`\\\\|\\"|\\\n`, LiteralStringEscape, nil}, + Include("strings-double"), + }, + "sqs": { + {`'`, LiteralStringSingle, Pop(1)}, + {`\\\\|\\'|\\\n`, LiteralStringEscape, nil}, + Include("strings-single"), + }, + "tdqs": { + {`"""`, LiteralStringDouble, Pop(1)}, + Include("strings-double"), + {`\n`, LiteralStringDouble, nil}, + }, + "tsqs": { + {`'''`, LiteralStringSingle, Pop(1)}, + Include("strings-single"), + {`\n`, LiteralStringSingle, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/q/qbasic.go b/vendor/github.com/alecthomas/chroma/lexers/q/qbasic.go new file mode 100644 index 000000000..fd47c0800 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/q/qbasic.go @@ -0,0 +1,67 @@ +package q + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Qbasic lexer. +var Qbasic = internal.Register(MustNewLexer( + &Config{ + Name: "QBasic", + Aliases: []string{"qbasic", "basic"}, + Filenames: []string{"*.BAS", "*.bas"}, + MimeTypes: []string{"text/basic"}, + }, + Rules{ + "root": { + {`\n+`, Text, nil}, + {`\s+`, TextWhitespace, nil}, + {`^(\s*)(\d*)(\s*)(REM .*)$`, ByGroups(TextWhitespace, NameLabel, TextWhitespace, CommentSingle), nil}, + {`^(\s*)(\d+)(\s*)`, ByGroups(TextWhitespace, NameLabel, TextWhitespace), nil}, + {`(?=[\s]*)(\w+)(?=[\s]*=)`, NameVariableGlobal, nil}, + {`(?=[^"]*)\'.*$`, CommentSingle, nil}, + {`"[^\n"]*"`, LiteralStringDouble, nil}, + {`(END)(\s+)(FUNCTION|IF|SELECT|SUB)`, ByGroups(KeywordReserved, TextWhitespace, KeywordReserved), nil}, + {`(DECLARE)(\s+)([A-Z]+)(\s+)(\S+)`, ByGroups(KeywordDeclaration, TextWhitespace, NameVariable, TextWhitespace, Name), nil}, + {`(DIM)(\s+)(SHARED)(\s+)([^\s(]+)`, ByGroups(KeywordDeclaration, TextWhitespace, NameVariable, TextWhitespace, NameVariableGlobal), nil}, + {`(DIM)(\s+)([^\s(]+)`, ByGroups(KeywordDeclaration, TextWhitespace, NameVariableGlobal), nil}, + {`^(\s*)([a-zA-Z_]+)(\s*)(\=)`, ByGroups(TextWhitespace, NameVariableGlobal, TextWhitespace, Operator), nil}, + {`(GOTO|GOSUB)(\s+)(\w+\:?)`, ByGroups(KeywordReserved, TextWhitespace, NameLabel), nil}, + {`(SUB)(\s+)(\w+\:?)`, ByGroups(KeywordReserved, TextWhitespace, NameLabel), nil}, + Include("declarations"), + Include("functions"), + Include("metacommands"), + Include("operators"), + Include("statements"), + Include("keywords"), + {`[a-zA-Z_]\w*[$@#&!]`, NameVariableGlobal, nil}, + {`[a-zA-Z_]\w*\:`, NameLabel, nil}, + {`\-?\d*\.\d+[@|#]?`, LiteralNumberFloat, nil}, + {`\-?\d+[@|#]`, LiteralNumberFloat, nil}, + {`\-?\d+#?`, LiteralNumberIntegerLong, nil}, + {`\-?\d+#?`, LiteralNumberInteger, nil}, + {`!=|==|:=|\.=|<<|>>|[-~+/\\*%=<>&^|?:!.]`, Operator, nil}, + {`[\[\]{}(),;]`, Punctuation, nil}, + {`[\w]+`, NameVariableGlobal, nil}, + }, + "declarations": { + {`\b(DATA|LET)(?=\(|\b)`, KeywordDeclaration, nil}, + }, + "functions": { + {`\b(ABS|ASC|ATN|CDBL|CHR\$|CINT|CLNG|COMMAND\$|COS|CSNG|CSRLIN|CVD|CVDMBF|CVI|CVL|CVS|CVSMBF|DATE\$|ENVIRON\$|EOF|ERDEV|ERDEV\$|ERL|ERR|EXP|FILEATTR|FIX|FRE|FREEFILE|HEX\$|INKEY\$|INP|INPUT\$|INSTR|INT|IOCTL\$|LBOUND|LCASE\$|LEFT\$|LEN|LOC|LOF|LOG|LPOS|LTRIM\$|MID\$|MKD\$|MKDMBF\$|MKI\$|MKL\$|MKS\$|MKSMBF\$|OCT\$|PEEK|PEN|PLAY|PMAP|POINT|POS|RIGHT\$|RND|RTRIM\$|SADD|SCREEN|SEEK|SETMEM|SGN|SIN|SPACE\$|SPC|SQR|STICK|STR\$|STRIG|STRING\$|TAB|TAN|TIME\$|TIMER|UBOUND|UCASE\$|VAL|VARPTR|VARPTR\$|VARSEG)(?=\(|\b)`, KeywordReserved, nil}, + }, + "metacommands": { + {`\b(\$DYNAMIC|\$INCLUDE|\$STATIC)(?=\(|\b)`, KeywordConstant, nil}, + }, + "operators": { + {`\b(AND|EQV|IMP|NOT|OR|XOR)(?=\(|\b)`, OperatorWord, nil}, + }, + "statements": { + {`\b(BEEP|BLOAD|BSAVE|CALL|CALL\ ABSOLUTE|CALL\ INTERRUPT|CALLS|CHAIN|CHDIR|CIRCLE|CLEAR|CLOSE|CLS|COLOR|COM|COMMON|CONST|DATA|DATE\$|DECLARE|DEF\ FN|DEF\ SEG|DEFDBL|DEFINT|DEFLNG|DEFSNG|DEFSTR|DEF|DIM|DO|LOOP|DRAW|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|NEXT|FUNCTION|GET|GOSUB|GOTO|IF|THEN|INPUT|INPUT\ \#|IOCTL|KEY|KEY|KILL|LET|LINE|LINE\ INPUT|LINE\ INPUT\ \#|LOCATE|LOCK|UNLOCK|LPRINT|LSET|MID\$|MKDIR|NAME|ON\ COM|ON\ ERROR|ON\ KEY|ON\ PEN|ON\ PLAY|ON\ STRIG|ON\ TIMER|ON\ UEVENT|ON|OPEN|OPEN\ COM|OPTION\ BASE|OUT|PAINT|PALETTE|PCOPY|PEN|PLAY|POKE|PRESET|PRINT|PRINT\ \#|PRINT\ USING|PSET|PUT|PUT|RANDOMIZE|READ|REDIM|REM|RESET|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SCREEN|SEEK|SELECT\ CASE|SHARED|SHELL|SLEEP|SOUND|STATIC|STOP|STRIG|SUB|SWAP|SYSTEM|TIME\$|TIMER|TROFF|TRON|TYPE|UEVENT|UNLOCK|VIEW|WAIT|WHILE|WEND|WIDTH|WINDOW|WRITE)\b`, KeywordReserved, nil}, + }, + "keywords": { + {`\b(ACCESS|ALIAS|ANY|APPEND|AS|BASE|BINARY|BYVAL|CASE|CDECL|DOUBLE|ELSE|ELSEIF|ENDIF|INTEGER|IS|LIST|LOCAL|LONG|LOOP|MOD|NEXT|OFF|ON|OUTPUT|RANDOM|SIGNAL|SINGLE|STEP|STRING|THEN|TO|UNTIL|USING|WEND)\b`, Keyword, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/r/r.go b/vendor/github.com/alecthomas/chroma/lexers/r/r.go new file mode 100644 index 000000000..c2d3f56c7 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/r/r.go @@ -0,0 +1,66 @@ +package r + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// R/S lexer. +var R = internal.Register(MustNewLexer( + &Config{ + Name: "R", + Aliases: []string{"splus", "s", "r"}, + Filenames: []string{"*.S", "*.R", "*.r", ".Rhistory", ".Rprofile", ".Renviron"}, + MimeTypes: []string{"text/S-plus", "text/S", "text/x-r-source", "text/x-r", "text/x-R", "text/x-r-history", "text/x-r-profile"}, + }, + Rules{ + "comments": { + {`#.*$`, CommentSingle, nil}, + }, + "valid_name": { + {"(?:`[^`\\\\]*(?:\\\\.[^`\\\\]*)*`)|(?:(?:[a-zA-z]|[_.][^0-9])[\\w_.]*)", Name, nil}, + }, + "punctuation": { + {`\[{1,2}|\]{1,2}|\(|\)|;|,`, Punctuation, nil}, + }, + "keywords": { + {`(if|else|for|while|repeat|in|next|break|return|switch|function)(?![\w.])`, KeywordReserved, nil}, + }, + "operators": { + {`<>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\?`, Operator, nil}, + {`\*|\+|\^|/|!|%[^%]*%|=|~|\$|@|:{1,3}`, Operator, nil}, + }, + "builtin_symbols": { + {`(NULL|NA(_(integer|real|complex|character)_)?|letters|LETTERS|Inf|TRUE|FALSE|NaN|pi|\.\.(\.|[0-9]+))(?![\w.])`, KeywordConstant, nil}, + {`(T|F)\b`, NameBuiltinPseudo, nil}, + }, + "numbers": { + {`0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?`, LiteralNumberHex, nil}, + {`[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)([eE][+-]?[0-9]+)?[Li]?`, LiteralNumber, nil}, + }, + "statements": { + Include("comments"), + {`\s+`, Text, nil}, + {`\'`, LiteralString, Push("string_squote")}, + {`\"`, LiteralString, Push("string_dquote")}, + Include("builtin_symbols"), + Include("valid_name"), + Include("numbers"), + Include("keywords"), + Include("punctuation"), + Include("operators"), + }, + "root": { + {"((?:`[^`\\\\]*(?:\\\\.[^`\\\\]*)*`)|(?:(?:[a-zA-z]|[_.][^0-9])[\\w_.]*))\\s*(?=\\()", NameFunction, nil}, + Include("statements"), + {`\{|\}`, Punctuation, nil}, + {`.`, Text, nil}, + }, + "string_squote": { + {`([^\'\\]|\\.)*\'`, LiteralString, Pop(1)}, + }, + "string_dquote": { + {`([^"\\]|\\.)*"`, LiteralString, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/r/racket.go b/vendor/github.com/alecthomas/chroma/lexers/r/racket.go new file mode 100644 index 000000000..cf27ea10c --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/r/racket.go @@ -0,0 +1,102 @@ +package r + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Racket lexer. +var Racket = internal.Register(MustNewLexer( + &Config{ + Name: "Racket", + Aliases: []string{"racket", "rkt"}, + Filenames: []string{"*.rkt", "*.rktd", "*.rktl"}, + MimeTypes: []string{"text/x-racket", "application/x-racket"}, + }, + Rules{ + "root": { + {`[)\]}]`, Error, nil}, + {`(?!\Z)`, Text, Push("unquoted-datum")}, + }, + "datum": { + {`(?s)#;|#![ /]([^\\\n]|\\.)*`, Comment, nil}, + {`;[^\n\r…

]*`, CommentSingle, nil}, + {`#\|`, CommentMultiline, Push("block-comment")}, + {`\s+`, Text, nil}, + {"(?i)(?:#e)?(?:#d)?(?:#e)?[-+]?\\d+(?=[()[\\]{}\",\\'`;\\s])", LiteralNumberInteger, Pop(1)}, + {"(?i)(?:#e)?(?:#d)?(?:#e)?[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([deflst][-+]?\\d+)?(?=[()[\\]{}\",\\'`;\\s])", LiteralNumberFloat, Pop(1)}, + {"(?i)(?:#e)?(?:#d)?(?:#e)?[-+]?((?:(?:\\d+(?:/\\d+|\\.\\d*)?|\\.\\d+)(?:[defls][-+]?\\d+)?)([-+](?:(?:\\d+(?:/\\d+|\\.\\d*)?|\\.\\d+)(?:[defls][-+]?\\d+)?)?i)?|[-+](?:(?:\\d+(?:/\\d+|\\.\\d*)?|\\.\\d+)(?:[defls][-+]?\\d+)?)?i)(?=[()[\\]{}\",\\'`;\\s])", LiteralNumber, Pop(1)}, + {"(?i)(#d)?((?:[-+]?(?:(?:(?:\\d+(?:/\\d+|\\.\\d*)?|\\.\\d+)|(?:\\d+#+(?:\\.#*|/\\d+#*)?|\\.\\d+#+|\\d+(?:\\.\\d*#+|/\\d+#+)))(?:[defls][-+]?\\d+)?)|[-+](?:(?:inf|nan)\\.[0f]))([-+](?:(?:(?:(?:\\d+(?:/\\d+|\\.\\d*)?|\\.\\d+)|(?:\\d+#+(?:\\.#*|/\\d+#*)?|\\.\\d+#+|\\d+(?:\\.\\d*#+|/\\d+#+)))(?:[defls][-+]?\\d+)?)|(?:(?:inf|nan)\\.[0f]))?i)?|[-+](?:(?:(?:(?:\\d+(?:/\\d+|\\.\\d*)?|\\.\\d+)|(?:\\d+#+(?:\\.#*|/\\d+#*)?|\\.\\d+#+|\\d+(?:\\.\\d*#+|/\\d+#+)))(?:[defls][-+]?\\d+)?)|(?:(?:inf|nan)\\.[0f]))?i|(?:[-+]?(?:(?:(?:\\d+(?:/\\d+|\\.\\d*)?|\\.\\d+)|(?:\\d+#+(?:\\.#*|/\\d+#*)?|\\.\\d+#+|\\d+(?:\\.\\d*#+|/\\d+#+)))(?:[defls][-+]?\\d+)?)|[-+](?:(?:inf|nan)\\.[0f]))@(?:[-+]?(?:(?:(?:\\d+(?:/\\d+|\\.\\d*)?|\\.\\d+)|(?:\\d+#+(?:\\.#*|/\\d+#*)?|\\.\\d+#+|\\d+(?:\\.\\d*#+|/\\d+#+)))(?:[defls][-+]?\\d+)?)|[-+](?:(?:inf|nan)\\.[0f])))(?=[()[\\]{}\",\\'`;\\s])", LiteralNumberFloat, Pop(1)}, + {"(?i)(([-+]?(?:(?:\\d+(?:/\\d+|\\.\\d*)?|\\.\\d+)|(?:\\d+#+(?:\\.#*|/\\d+#*)?|\\.\\d+#+|\\d+(?:\\.\\d*#+|/\\d+#+)))t[-+]?\\d+)|[-+](inf|nan)\\.t)(?=[()[\\]{}\",\\'`;\\s])", LiteralNumberFloat, Pop(1)}, + {"(?i)(#[ei])?#b(?:\\|[^|]*\\||\\\\[\\w\\W]|[^|\\\\()[\\]{}\",\\'`;\\s]+)+", LiteralNumberBin, Pop(1)}, + {"(?i)(#[ei])?#o(?:\\|[^|]*\\||\\\\[\\w\\W]|[^|\\\\()[\\]{}\",\\'`;\\s]+)+", LiteralNumberOct, Pop(1)}, + {"(?i)(#[ei])?#x(?:\\|[^|]*\\||\\\\[\\w\\W]|[^|\\\\()[\\]{}\",\\'`;\\s]+)+", LiteralNumberHex, Pop(1)}, + {"(?i)(#d)?#i(?:\\|[^|]*\\||\\\\[\\w\\W]|[^|\\\\()[\\]{}\",\\'`;\\s]+)+", LiteralNumberFloat, Pop(1)}, + {`#?"`, LiteralStringDouble, Push("#pop", "string")}, + {`#<<(.+)\n(^(?!\1$).*$\n)*^\1$`, LiteralStringHeredoc, Pop(1)}, + {`#\\(u[\da-fA-F]{1,4}|U[\da-fA-F]{1,8})`, LiteralStringChar, Pop(1)}, + {`(?is)#\\([0-7]{3}|[a-z]+|.)`, LiteralStringChar, Pop(1)}, + {`(?s)#[pr]x#?"(\\?.)*?"`, LiteralStringRegex, Pop(1)}, + {`#(true|false|[tTfF])`, NameConstant, Pop(1)}, + {"#:(?:\\|[^|]*\\||\\\\[\\w\\W]|[^|\\\\()[\\]{}\",\\'`;\\s]+)+", KeywordDeclaration, Pop(1)}, + {`(#lang |#!)(\S+)`, ByGroups(KeywordNamespace, NameNamespace), nil}, + {`#reader`, KeywordNamespace, Push("quoted-datum")}, + {"(?i)\\.(?=[()[\\]{}\",\\'`;\\s])|#c[is]|#['`]|#,@?", Operator, nil}, + {`'|#[s&]|#hash(eqv?)?|#\d*(?=[([{])`, Operator, Push("#pop", "quoted-datum")}, + }, + "datum*": { + {"`|,@?", Operator, nil}, + {"(?:\\|[^|]*\\||\\\\[\\w\\W]|[^|\\\\()[\\]{}\",\\'`;\\s]+)+", LiteralStringSymbol, Pop(1)}, + {`[|\\]`, Error, nil}, + Default(Pop(1)), + }, + "list": { + {`[)\]}]`, Punctuation, Pop(1)}, + }, + "unquoted-datum": { + Include("datum"), + {"quote(?=[()[\\]{}\",\\'`;\\s])", Keyword, Push("#pop", "quoted-datum")}, + {"`", Operator, Push("#pop", "quasiquoted-datum")}, + {"quasiquote(?=[()[\\]{}\",\\'`;\\s])", Keyword, Push("#pop", "quasiquoted-datum")}, + {`[([{]`, Punctuation, Push("#pop", "unquoted-list")}, + {Words(``, "(?=[()[\\]{}\",\\'`;\\s])", `#%app`, `#%datum`, `#%declare`, `#%expression`, `#%module-begin`, `#%plain-app`, `#%plain-lambda`, `#%plain-module-begin`, `#%printing-module-begin`, `#%provide`, `#%require`, `#%stratified-body`, `#%top`, `#%top-interaction`, `#%variable-reference`, `->`, `->*`, `->*m`, `->d`, `->dm`, `->i`, `->m`, `...`, `:do-in`, `==`, `=>`, `_`, `absent`, `abstract`, `all-defined-out`, `all-from-out`, `and`, `any`, `augment`, `augment*`, `augment-final`, `augment-final*`, `augride`, `augride*`, `begin`, `begin-for-syntax`, `begin0`, `case`, `case->`, `case->m`, `case-lambda`, `class`, `class*`, `class-field-accessor`, `class-field-mutator`, `class/c`, `class/derived`, `combine-in`, `combine-out`, `command-line`, `compound-unit`, `compound-unit/infer`, `cond`, `cons/dc`, `contract`, `contract-out`, `contract-struct`, `contracted`, `define`, `define-compound-unit`, `define-compound-unit/infer`, `define-contract-struct`, `define-custom-hash-types`, `define-custom-set-types`, `define-for-syntax`, `define-local-member-name`, `define-logger`, `define-match-expander`, `define-member-name`, `define-module-boundary-contract`, `define-namespace-anchor`, `define-opt/c`, `define-sequence-syntax`, `define-serializable-class`, `define-serializable-class*`, `define-signature`, `define-signature-form`, `define-struct`, `define-struct/contract`, `define-struct/derived`, `define-syntax`, `define-syntax-rule`, `define-syntaxes`, `define-unit`, `define-unit-binding`, `define-unit-from-context`, `define-unit/contract`, `define-unit/new-import-export`, `define-unit/s`, `define-values`, `define-values-for-export`, `define-values-for-syntax`, `define-values/invoke-unit`, `define-values/invoke-unit/infer`, `define/augment`, `define/augment-final`, `define/augride`, `define/contract`, `define/final-prop`, `define/match`, `define/overment`, `define/override`, `define/override-final`, `define/private`, `define/public`, `define/public-final`, `define/pubment`, `define/subexpression-pos-prop`, `define/subexpression-pos-prop/name`, `delay`, `delay/idle`, `delay/name`, `delay/strict`, `delay/sync`, `delay/thread`, `do`, `else`, `except`, `except-in`, `except-out`, `export`, `extends`, `failure-cont`, `false`, `false/c`, `field`, `field-bound?`, `file`, `flat-murec-contract`, `flat-rec-contract`, `for`, `for*`, `for*/and`, `for*/async`, `for*/first`, `for*/fold`, `for*/fold/derived`, `for*/hash`, `for*/hasheq`, `for*/hasheqv`, `for*/last`, `for*/list`, `for*/lists`, `for*/mutable-set`, `for*/mutable-seteq`, `for*/mutable-seteqv`, `for*/or`, `for*/product`, `for*/set`, `for*/seteq`, `for*/seteqv`, `for*/stream`, `for*/sum`, `for*/vector`, `for*/weak-set`, `for*/weak-seteq`, `for*/weak-seteqv`, `for-label`, `for-meta`, `for-syntax`, `for-template`, `for/and`, `for/async`, `for/first`, `for/fold`, `for/fold/derived`, `for/hash`, `for/hasheq`, `for/hasheqv`, `for/last`, `for/list`, `for/lists`, `for/mutable-set`, `for/mutable-seteq`, `for/mutable-seteqv`, `for/or`, `for/product`, `for/set`, `for/seteq`, `for/seteqv`, `for/stream`, `for/sum`, `for/vector`, `for/weak-set`, `for/weak-seteq`, `for/weak-seteqv`, `gen:custom-write`, `gen:dict`, `gen:equal+hash`, `gen:set`, `gen:stream`, `generic`, `get-field`, `hash/dc`, `if`, `implies`, `import`, `include`, `include-at/relative-to`, `include-at/relative-to/reader`, `include/reader`, `inherit`, `inherit-field`, `inherit/inner`, `inherit/super`, `init`, `init-depend`, `init-field`, `init-rest`, `inner`, `inspect`, `instantiate`, `interface`, `interface*`, `invariant-assertion`, `invoke-unit`, `invoke-unit/infer`, `lambda`, `lazy`, `let`, `let*`, `let*-values`, `let-syntax`, `let-syntaxes`, `let-values`, `let/cc`, `let/ec`, `letrec`, `letrec-syntax`, `letrec-syntaxes`, `letrec-syntaxes+values`, `letrec-values`, `lib`, `link`, `local`, `local-require`, `log-debug`, `log-error`, `log-fatal`, `log-info`, `log-warning`, `match`, `match*`, `match*/derived`, `match-define`, `match-define-values`, `match-lambda`, `match-lambda*`, `match-lambda**`, `match-let`, `match-let*`, `match-let*-values`, `match-let-values`, `match-letrec`, `match-letrec-values`, `match/derived`, `match/values`, `member-name-key`, `mixin`, `module`, `module*`, `module+`, `nand`, `new`, `nor`, `object-contract`, `object/c`, `only`, `only-in`, `only-meta-in`, `open`, `opt/c`, `or`, `overment`, `overment*`, `override`, `override*`, `override-final`, `override-final*`, `parameterize`, `parameterize*`, `parameterize-break`, `parametric->/c`, `place`, `place*`, `place/context`, `planet`, `prefix`, `prefix-in`, `prefix-out`, `private`, `private*`, `prompt-tag/c`, `protect-out`, `provide`, `provide-signature-elements`, `provide/contract`, `public`, `public*`, `public-final`, `public-final*`, `pubment`, `pubment*`, `quasiquote`, `quasisyntax`, `quasisyntax/loc`, `quote`, `quote-syntax`, `quote-syntax/prune`, `recontract-out`, `recursive-contract`, `relative-in`, `rename`, `rename-in`, `rename-inner`, `rename-out`, `rename-super`, `require`, `send`, `send*`, `send+`, `send-generic`, `send/apply`, `send/keyword-apply`, `set!`, `set!-values`, `set-field!`, `shared`, `stream`, `stream*`, `stream-cons`, `struct`, `struct*`, `struct-copy`, `struct-field-index`, `struct-out`, `struct/c`, `struct/ctc`, `struct/dc`, `submod`, `super`, `super-instantiate`, `super-make-object`, `super-new`, `syntax`, `syntax-case`, `syntax-case*`, `syntax-id-rules`, `syntax-rules`, `syntax/loc`, `tag`, `this`, `this%`, `thunk`, `thunk*`, `time`, `unconstrained-domain->`, `unit`, `unit-from-context`, `unit/c`, `unit/new-import-export`, `unit/s`, `unless`, `unquote`, `unquote-splicing`, `unsyntax`, `unsyntax-splicing`, `values/drop`, `when`, `with-continuation-mark`, `with-contract`, `with-contract-continuation-mark`, `with-handlers`, `with-handlers*`, `with-method`, `with-syntax`, `λ`), Keyword, Pop(1)}, + {Words(``, "(?=[()[\\]{}\",\\'`;\\s])", `*`, `*list/c`, `+`, `-`, `/`, `<`, ``, `>/c`, `>=`, `>=/c`, `abort-current-continuation`, `abs`, `absolute-path?`, `acos`, `add-between`, `add1`, `alarm-evt`, `always-evt`, `and/c`, `andmap`, `angle`, `any/c`, `append`, `append*`, `append-map`, `apply`, `argmax`, `argmin`, `arithmetic-shift`, `arity-at-least`, `arity-at-least-value`, `arity-at-least?`, `arity-checking-wrapper`, `arity-includes?`, `arity=?`, `arrow-contract-info`, `arrow-contract-info-accepts-arglist`, `arrow-contract-info-chaperone-procedure`, `arrow-contract-info-check-first-order`, `arrow-contract-info?`, `asin`, `assf`, `assoc`, `assq`, `assv`, `atan`, `bad-number-of-results`, `banner`, `base->-doms/c`, `base->-rngs/c`, `base->?`, `between/c`, `bitwise-and`, `bitwise-bit-field`, `bitwise-bit-set?`, `bitwise-ior`, `bitwise-not`, `bitwise-xor`, `blame-add-car-context`, `blame-add-cdr-context`, `blame-add-context`, `blame-add-missing-party`, `blame-add-nth-arg-context`, `blame-add-range-context`, `blame-add-unknown-context`, `blame-context`, `blame-contract`, `blame-fmt->-string`, `blame-missing-party?`, `blame-negative`, `blame-original?`, `blame-positive`, `blame-replace-negative`, `blame-source`, `blame-swap`, `blame-swapped?`, `blame-update`, `blame-value`, `blame?`, `boolean=?`, `boolean?`, `bound-identifier=?`, `box`, `box-cas!`, `box-immutable`, `box-immutable/c`, `box/c`, `box?`, `break-enabled`, `break-parameterization?`, `break-thread`, `build-chaperone-contract-property`, `build-compound-type-name`, `build-contract-property`, `build-flat-contract-property`, `build-list`, `build-path`, `build-path/convention-type`, `build-string`, `build-vector`, `byte-pregexp`, `byte-pregexp?`, `byte-ready?`, `byte-regexp`, `byte-regexp?`, `byte?`, `bytes`, `bytes->immutable-bytes`, `bytes->list`, `bytes->path`, `bytes->path-element`, `bytes->string/latin-1`, `bytes->string/locale`, `bytes->string/utf-8`, `bytes-append`, `bytes-append*`, `bytes-close-converter`, `bytes-convert`, `bytes-convert-end`, `bytes-converter?`, `bytes-copy`, `bytes-copy!`, `bytes-environment-variable-name?`, `bytes-fill!`, `bytes-join`, `bytes-length`, `bytes-no-nuls?`, `bytes-open-converter`, `bytes-ref`, `bytes-set!`, `bytes-utf-8-index`, `bytes-utf-8-length`, `bytes-utf-8-ref`, `bytes?`, `bytes?`, `caaaar`, `caaadr`, `caaar`, `caadar`, `caaddr`, `caadr`, `caar`, `cadaar`, `cadadr`, `cadar`, `caddar`, `cadddr`, `caddr`, `cadr`, `call-in-nested-thread`, `call-with-atomic-output-file`, `call-with-break-parameterization`, `call-with-composable-continuation`, `call-with-continuation-barrier`, `call-with-continuation-prompt`, `call-with-current-continuation`, `call-with-default-reading-parameterization`, `call-with-escape-continuation`, `call-with-exception-handler`, `call-with-file-lock/timeout`, `call-with-immediate-continuation-mark`, `call-with-input-bytes`, `call-with-input-file`, `call-with-input-file*`, `call-with-input-string`, `call-with-output-bytes`, `call-with-output-file`, `call-with-output-file*`, `call-with-output-string`, `call-with-parameterization`, `call-with-semaphore`, `call-with-semaphore/enable-break`, `call-with-values`, `call/cc`, `call/ec`, `car`, `cartesian-product`, `cdaaar`, `cdaadr`, `cdaar`, `cdadar`, `cdaddr`, `cdadr`, `cdar`, `cddaar`, `cddadr`, `cddar`, `cdddar`, `cddddr`, `cdddr`, `cddr`, `cdr`, `ceiling`, `channel-get`, `channel-put`, `channel-put-evt`, `channel-put-evt?`, `channel-try-get`, `channel/c`, `channel?`, `chaperone-box`, `chaperone-channel`, `chaperone-continuation-mark-key`, `chaperone-contract-property?`, `chaperone-contract?`, `chaperone-evt`, `chaperone-hash`, `chaperone-hash-set`, `chaperone-of?`, `chaperone-procedure`, `chaperone-procedure*`, `chaperone-prompt-tag`, `chaperone-struct`, `chaperone-struct-type`, `chaperone-vector`, `chaperone?`, `char->integer`, `char-alphabetic?`, `char-blank?`, `char-ci<=?`, `char-ci=?`, `char-ci>?`, `char-downcase`, `char-foldcase`, `char-general-category`, `char-graphic?`, `char-in`, `char-in/c`, `char-iso-control?`, `char-lower-case?`, `char-numeric?`, `char-punctuation?`, `char-ready?`, `char-symbolic?`, `char-title-case?`, `char-titlecase`, `char-upcase`, `char-upper-case?`, `char-utf-8-length`, `char-whitespace?`, `char<=?`, `char=?`, `char>?`, `char?`, `check-duplicate-identifier`, `check-duplicates`, `checked-procedure-check-and-extract`, `choice-evt`, `class->interface`, `class-info`, `class-seal`, `class-unseal`, `class?`, `cleanse-path`, `close-input-port`, `close-output-port`, `coerce-chaperone-contract`, `coerce-chaperone-contracts`, `coerce-contract`, `coerce-contract/f`, `coerce-contracts`, `coerce-flat-contract`, `coerce-flat-contracts`, `collect-garbage`, `collection-file-path`, `collection-path`, `combinations`, `compile`, `compile-allow-set!-undefined`, `compile-context-preservation-enabled`, `compile-enforce-module-constants`, `compile-syntax`, `compiled-expression-recompile`, `compiled-expression?`, `compiled-module-expression?`, `complete-path?`, `complex?`, `compose`, `compose1`, `conjoin`, `conjugate`, `cons`, `cons/c`, `cons?`, `const`, `continuation-mark-key/c`, `continuation-mark-key?`, `continuation-mark-set->context`, `continuation-mark-set->list`, `continuation-mark-set->list*`, `continuation-mark-set-first`, `continuation-mark-set?`, `continuation-marks`, `continuation-prompt-available?`, `continuation-prompt-tag?`, `continuation?`, `contract-continuation-mark-key`, `contract-custom-write-property-proc`, `contract-exercise`, `contract-first-order`, `contract-first-order-passes?`, `contract-late-neg-projection`, `contract-name`, `contract-proc`, `contract-projection`, `contract-property?`, `contract-random-generate`, `contract-random-generate-fail`, `contract-random-generate-fail?`, `contract-random-generate-get-current-environment`, `contract-random-generate-stash`, `contract-random-generate/choose`, `contract-stronger?`, `contract-struct-exercise`, `contract-struct-generate`, `contract-struct-late-neg-projection`, `contract-struct-list-contract?`, `contract-val-first-projection`, `contract?`, `convert-stream`, `copy-directory/files`, `copy-file`, `copy-port`, `cos`, `cosh`, `count`, `current-blame-format`, `current-break-parameterization`, `current-code-inspector`, `current-command-line-arguments`, `current-compile`, `current-compiled-file-roots`, `current-continuation-marks`, `current-contract-region`, `current-custodian`, `current-directory`, `current-directory-for-user`, `current-drive`, `current-environment-variables`, `current-error-port`, `current-eval`, `current-evt-pseudo-random-generator`, `current-force-delete-permissions`, `current-future`, `current-gc-milliseconds`, `current-get-interaction-input-port`, `current-inexact-milliseconds`, `current-input-port`, `current-inspector`, `current-library-collection-links`, `current-library-collection-paths`, `current-load`, `current-load-extension`, `current-load-relative-directory`, `current-load/use-compiled`, `current-locale`, `current-logger`, `current-memory-use`, `current-milliseconds`, `current-module-declare-name`, `current-module-declare-source`, `current-module-name-resolver`, `current-module-path-for-load`, `current-namespace`, `current-output-port`, `current-parameterization`, `current-plumber`, `current-preserved-thread-cell-values`, `current-print`, `current-process-milliseconds`, `current-prompt-read`, `current-pseudo-random-generator`, `current-read-interaction`, `current-reader-guard`, `current-readtable`, `current-seconds`, `current-security-guard`, `current-subprocess-custodian-mode`, `current-thread`, `current-thread-group`, `current-thread-initial-stack-size`, `current-write-relative-directory`, `curry`, `curryr`, `custodian-box-value`, `custodian-box?`, `custodian-limit-memory`, `custodian-managed-list`, `custodian-memory-accounting-available?`, `custodian-require-memory`, `custodian-shutdown-all`, `custodian?`, `custom-print-quotable-accessor`, `custom-print-quotable?`, `custom-write-accessor`, `custom-write-property-proc`, `custom-write?`, `date`, `date*`, `date*-nanosecond`, `date*-time-zone-name`, `date*?`, `date-day`, `date-dst?`, `date-hour`, `date-minute`, `date-month`, `date-second`, `date-time-zone-offset`, `date-week-day`, `date-year`, `date-year-day`, `date?`, `datum->syntax`, `datum-intern-literal`, `default-continuation-prompt-tag`, `degrees->radians`, `delete-directory`, `delete-directory/files`, `delete-file`, `denominator`, `dict->list`, `dict-can-functional-set?`, `dict-can-remove-keys?`, `dict-clear`, `dict-clear!`, `dict-copy`, `dict-count`, `dict-empty?`, `dict-for-each`, `dict-has-key?`, `dict-implements/c`, `dict-implements?`, `dict-iter-contract`, `dict-iterate-first`, `dict-iterate-key`, `dict-iterate-next`, `dict-iterate-value`, `dict-key-contract`, `dict-keys`, `dict-map`, `dict-mutable?`, `dict-ref`, `dict-ref!`, `dict-remove`, `dict-remove!`, `dict-set`, `dict-set!`, `dict-set*`, `dict-set*!`, `dict-update`, `dict-update!`, `dict-value-contract`, `dict-values`, `dict?`, `directory-exists?`, `directory-list`, `disjoin`, `display`, `display-lines`, `display-lines-to-file`, `display-to-file`, `displayln`, `double-flonum?`, `drop`, `drop-common-prefix`, `drop-right`, `dropf`, `dropf-right`, `dump-memory-stats`, `dup-input-port`, `dup-output-port`, `dynamic->*`, `dynamic-get-field`, `dynamic-object/c`, `dynamic-place`, `dynamic-place*`, `dynamic-require`, `dynamic-require-for-syntax`, `dynamic-send`, `dynamic-set-field!`, `dynamic-wind`, `eighth`, `empty`, `empty-sequence`, `empty-stream`, `empty?`, `environment-variables-copy`, `environment-variables-names`, `environment-variables-ref`, `environment-variables-set!`, `environment-variables?`, `eof`, `eof-evt`, `eof-object?`, `ephemeron-value`, `ephemeron?`, `eprintf`, `eq-contract-val`, `eq-contract?`, `eq-hash-code`, `eq?`, `equal-contract-val`, `equal-contract?`, `equal-hash-code`, `equal-secondary-hash-code`, `equal<%>`, `equal?`, `equal?/recur`, `eqv-hash-code`, `eqv?`, `error`, `error-display-handler`, `error-escape-handler`, `error-print-context-length`, `error-print-source-location`, `error-print-width`, `error-value->string-handler`, `eval`, `eval-jit-enabled`, `eval-syntax`, `even?`, `evt/c`, `evt?`, `exact->inexact`, `exact-ceiling`, `exact-floor`, `exact-integer?`, `exact-nonnegative-integer?`, `exact-positive-integer?`, `exact-round`, `exact-truncate`, `exact?`, `executable-yield-handler`, `exit`, `exit-handler`, `exn`, `exn-continuation-marks`, `exn-message`, `exn:break`, `exn:break-continuation`, `exn:break:hang-up`, `exn:break:hang-up?`, `exn:break:terminate`, `exn:break:terminate?`, `exn:break?`, `exn:fail`, `exn:fail:contract`, `exn:fail:contract:arity`, `exn:fail:contract:arity?`, `exn:fail:contract:blame`, `exn:fail:contract:blame-object`, `exn:fail:contract:blame?`, `exn:fail:contract:continuation`, `exn:fail:contract:continuation?`, `exn:fail:contract:divide-by-zero`, `exn:fail:contract:divide-by-zero?`, `exn:fail:contract:non-fixnum-result`, `exn:fail:contract:non-fixnum-result?`, `exn:fail:contract:variable`, `exn:fail:contract:variable-id`, `exn:fail:contract:variable?`, `exn:fail:contract?`, `exn:fail:filesystem`, `exn:fail:filesystem:errno`, `exn:fail:filesystem:errno-errno`, `exn:fail:filesystem:errno?`, `exn:fail:filesystem:exists`, `exn:fail:filesystem:exists?`, `exn:fail:filesystem:missing-module`, `exn:fail:filesystem:missing-module-path`, `exn:fail:filesystem:missing-module?`, `exn:fail:filesystem:version`, `exn:fail:filesystem:version?`, `exn:fail:filesystem?`, `exn:fail:network`, `exn:fail:network:errno`, `exn:fail:network:errno-errno`, `exn:fail:network:errno?`, `exn:fail:network?`, `exn:fail:object`, `exn:fail:object?`, `exn:fail:out-of-memory`, `exn:fail:out-of-memory?`, `exn:fail:read`, `exn:fail:read-srclocs`, `exn:fail:read:eof`, `exn:fail:read:eof?`, `exn:fail:read:non-char`, `exn:fail:read:non-char?`, `exn:fail:read?`, `exn:fail:syntax`, `exn:fail:syntax-exprs`, `exn:fail:syntax:missing-module`, `exn:fail:syntax:missing-module-path`, `exn:fail:syntax:missing-module?`, `exn:fail:syntax:unbound`, `exn:fail:syntax:unbound?`, `exn:fail:syntax?`, `exn:fail:unsupported`, `exn:fail:unsupported?`, `exn:fail:user`, `exn:fail:user?`, `exn:fail?`, `exn:misc:match?`, `exn:missing-module-accessor`, `exn:missing-module?`, `exn:srclocs-accessor`, `exn:srclocs?`, `exn?`, `exp`, `expand`, `expand-once`, `expand-syntax`, `expand-syntax-once`, `expand-syntax-to-top-form`, `expand-to-top-form`, `expand-user-path`, `explode-path`, `expt`, `externalizable<%>`, `failure-result/c`, `false?`, `field-names`, `fifth`, `file->bytes`, `file->bytes-lines`, `file->lines`, `file->list`, `file->string`, `file->value`, `file-exists?`, `file-name-from-path`, `file-or-directory-identity`, `file-or-directory-modify-seconds`, `file-or-directory-permissions`, `file-position`, `file-position*`, `file-size`, `file-stream-buffer-mode`, `file-stream-port?`, `file-truncate`, `filename-extension`, `filesystem-change-evt`, `filesystem-change-evt-cancel`, `filesystem-change-evt?`, `filesystem-root-list`, `filter`, `filter-map`, `filter-not`, `filter-read-input-port`, `find-executable-path`, `find-files`, `find-library-collection-links`, `find-library-collection-paths`, `find-relative-path`, `find-system-path`, `findf`, `first`, `first-or/c`, `fixnum?`, `flat-contract`, `flat-contract-predicate`, `flat-contract-property?`, `flat-contract?`, `flat-named-contract`, `flatten`, `floating-point-bytes->real`, `flonum?`, `floor`, `flush-output`, `fold-files`, `foldl`, `foldr`, `for-each`, `force`, `format`, `fourth`, `fprintf`, `free-identifier=?`, `free-label-identifier=?`, `free-template-identifier=?`, `free-transformer-identifier=?`, `fsemaphore-count`, `fsemaphore-post`, `fsemaphore-try-wait?`, `fsemaphore-wait`, `fsemaphore?`, `future`, `future?`, `futures-enabled?`, `gcd`, `generate-member-key`, `generate-temporaries`, `generic-set?`, `generic?`, `gensym`, `get-output-bytes`, `get-output-string`, `get-preference`, `get/build-late-neg-projection`, `get/build-val-first-projection`, `getenv`, `global-port-print-handler`, `group-by`, `group-execute-bit`, `group-read-bit`, `group-write-bit`, `guard-evt`, `handle-evt`, `handle-evt?`, `has-blame?`, `has-contract?`, `hash`, `hash->list`, `hash-clear`, `hash-clear!`, `hash-copy`, `hash-copy-clear`, `hash-count`, `hash-empty?`, `hash-eq?`, `hash-equal?`, `hash-eqv?`, `hash-for-each`, `hash-has-key?`, `hash-iterate-first`, `hash-iterate-key`, `hash-iterate-key+value`, `hash-iterate-next`, `hash-iterate-pair`, `hash-iterate-value`, `hash-keys`, `hash-map`, `hash-placeholder?`, `hash-ref`, `hash-ref!`, `hash-remove`, `hash-remove!`, `hash-set`, `hash-set!`, `hash-set*`, `hash-set*!`, `hash-update`, `hash-update!`, `hash-values`, `hash-weak?`, `hash/c`, `hash?`, `hasheq`, `hasheqv`, `identifier-binding`, `identifier-binding-symbol`, `identifier-label-binding`, `identifier-prune-lexical-context`, `identifier-prune-to-source-module`, `identifier-remove-from-definition-context`, `identifier-template-binding`, `identifier-transformer-binding`, `identifier?`, `identity`, `if/c`, `imag-part`, `immutable?`, `impersonate-box`, `impersonate-channel`, `impersonate-continuation-mark-key`, `impersonate-hash`, `impersonate-hash-set`, `impersonate-procedure`, `impersonate-procedure*`, `impersonate-prompt-tag`, `impersonate-struct`, `impersonate-vector`, `impersonator-contract?`, `impersonator-ephemeron`, `impersonator-of?`, `impersonator-prop:application-mark`, `impersonator-prop:blame`, `impersonator-prop:contracted`, `impersonator-property-accessor-procedure?`, `impersonator-property?`, `impersonator?`, `implementation?`, `implementation?/c`, `in-bytes`, `in-bytes-lines`, `in-combinations`, `in-cycle`, `in-dict`, `in-dict-keys`, `in-dict-pairs`, `in-dict-values`, `in-directory`, `in-hash`, `in-hash-keys`, `in-hash-pairs`, `in-hash-values`, `in-immutable-hash`, `in-immutable-hash-keys`, `in-immutable-hash-pairs`, `in-immutable-hash-values`, `in-immutable-set`, `in-indexed`, `in-input-port-bytes`, `in-input-port-chars`, `in-lines`, `in-list`, `in-mlist`, `in-mutable-hash`, `in-mutable-hash-keys`, `in-mutable-hash-pairs`, `in-mutable-hash-values`, `in-mutable-set`, `in-naturals`, `in-parallel`, `in-permutations`, `in-port`, `in-producer`, `in-range`, `in-sequences`, `in-set`, `in-slice`, `in-stream`, `in-string`, `in-syntax`, `in-value`, `in-values*-sequence`, `in-values-sequence`, `in-vector`, `in-weak-hash`, `in-weak-hash-keys`, `in-weak-hash-pairs`, `in-weak-hash-values`, `in-weak-set`, `inexact->exact`, `inexact-real?`, `inexact?`, `infinite?`, `input-port-append`, `input-port?`, `inspector?`, `instanceof/c`, `integer->char`, `integer->integer-bytes`, `integer-bytes->integer`, `integer-in`, `integer-length`, `integer-sqrt`, `integer-sqrt/remainder`, `integer?`, `interface->method-names`, `interface-extension?`, `interface?`, `internal-definition-context-binding-identifiers`, `internal-definition-context-introduce`, `internal-definition-context-seal`, `internal-definition-context?`, `is-a?`, `is-a?/c`, `keyword->string`, `keyword-apply`, `keywordbytes`, `list->mutable-set`, `list->mutable-seteq`, `list->mutable-seteqv`, `list->set`, `list->seteq`, `list->seteqv`, `list->string`, `list->vector`, `list->weak-set`, `list->weak-seteq`, `list->weak-seteqv`, `list-contract?`, `list-prefix?`, `list-ref`, `list-set`, `list-tail`, `list-update`, `list/c`, `list?`, `listen-port-number?`, `listof`, `load`, `load-extension`, `load-on-demand-enabled`, `load-relative`, `load-relative-extension`, `load/cd`, `load/use-compiled`, `local-expand`, `local-expand/capture-lifts`, `local-transformer-expand`, `local-transformer-expand/capture-lifts`, `locale-string-encoding`, `log`, `log-all-levels`, `log-level-evt`, `log-level?`, `log-max-level`, `log-message`, `log-receiver?`, `logger-name`, `logger?`, `magnitude`, `make-arity-at-least`, `make-base-empty-namespace`, `make-base-namespace`, `make-bytes`, `make-channel`, `make-chaperone-contract`, `make-continuation-mark-key`, `make-continuation-prompt-tag`, `make-contract`, `make-custodian`, `make-custodian-box`, `make-custom-hash`, `make-custom-hash-types`, `make-custom-set`, `make-custom-set-types`, `make-date`, `make-date*`, `make-derived-parameter`, `make-directory`, `make-directory*`, `make-do-sequence`, `make-empty-namespace`, `make-environment-variables`, `make-ephemeron`, `make-exn`, `make-exn:break`, `make-exn:break:hang-up`, `make-exn:break:terminate`, `make-exn:fail`, `make-exn:fail:contract`, `make-exn:fail:contract:arity`, `make-exn:fail:contract:blame`, `make-exn:fail:contract:continuation`, `make-exn:fail:contract:divide-by-zero`, `make-exn:fail:contract:non-fixnum-result`, `make-exn:fail:contract:variable`, `make-exn:fail:filesystem`, `make-exn:fail:filesystem:errno`, `make-exn:fail:filesystem:exists`, `make-exn:fail:filesystem:missing-module`, `make-exn:fail:filesystem:version`, `make-exn:fail:network`, `make-exn:fail:network:errno`, `make-exn:fail:object`, `make-exn:fail:out-of-memory`, `make-exn:fail:read`, `make-exn:fail:read:eof`, `make-exn:fail:read:non-char`, `make-exn:fail:syntax`, `make-exn:fail:syntax:missing-module`, `make-exn:fail:syntax:unbound`, `make-exn:fail:unsupported`, `make-exn:fail:user`, `make-file-or-directory-link`, `make-flat-contract`, `make-fsemaphore`, `make-generic`, `make-handle-get-preference-locked`, `make-hash`, `make-hash-placeholder`, `make-hasheq`, `make-hasheq-placeholder`, `make-hasheqv`, `make-hasheqv-placeholder`, `make-immutable-custom-hash`, `make-immutable-hash`, `make-immutable-hasheq`, `make-immutable-hasheqv`, `make-impersonator-property`, `make-input-port`, `make-input-port/read-to-peek`, `make-inspector`, `make-keyword-procedure`, `make-known-char-range-list`, `make-limited-input-port`, `make-list`, `make-lock-file-name`, `make-log-receiver`, `make-logger`, `make-mixin-contract`, `make-mutable-custom-set`, `make-none/c`, `make-object`, `make-output-port`, `make-parameter`, `make-parent-directory*`, `make-phantom-bytes`, `make-pipe`, `make-pipe-with-specials`, `make-placeholder`, `make-plumber`, `make-polar`, `make-prefab-struct`, `make-primitive-class`, `make-proj-contract`, `make-pseudo-random-generator`, `make-reader-graph`, `make-readtable`, `make-rectangular`, `make-rename-transformer`, `make-resolved-module-path`, `make-security-guard`, `make-semaphore`, `make-set!-transformer`, `make-shared-bytes`, `make-sibling-inspector`, `make-special-comment`, `make-srcloc`, `make-string`, `make-struct-field-accessor`, `make-struct-field-mutator`, `make-struct-type`, `make-struct-type-property`, `make-syntax-delta-introducer`, `make-syntax-introducer`, `make-temporary-file`, `make-tentative-pretty-print-output-port`, `make-thread-cell`, `make-thread-group`, `make-vector`, `make-weak-box`, `make-weak-custom-hash`, `make-weak-custom-set`, `make-weak-hash`, `make-weak-hasheq`, `make-weak-hasheqv`, `make-will-executor`, `map`, `match-equality-test`, `matches-arity-exactly?`, `max`, `mcar`, `mcdr`, `mcons`, `member`, `member-name-key-hash-code`, `member-name-key=?`, `member-name-key?`, `memf`, `memq`, `memv`, `merge-input`, `method-in-interface?`, `min`, `mixin-contract`, `module->exports`, `module->imports`, `module->language-info`, `module->namespace`, `module-compiled-cross-phase-persistent?`, `module-compiled-exports`, `module-compiled-imports`, `module-compiled-language-info`, `module-compiled-name`, `module-compiled-submodules`, `module-declared?`, `module-path-index-join`, `module-path-index-resolve`, `module-path-index-split`, `module-path-index-submodule`, `module-path-index?`, `module-path?`, `module-predefined?`, `module-provide-protected?`, `modulo`, `mpair?`, `mutable-set`, `mutable-seteq`, `mutable-seteqv`, `n->th`, `nack-guard-evt`, `namespace-anchor->empty-namespace`, `namespace-anchor->namespace`, `namespace-anchor?`, `namespace-attach-module`, `namespace-attach-module-declaration`, `namespace-base-phase`, `namespace-mapped-symbols`, `namespace-module-identifier`, `namespace-module-registry`, `namespace-require`, `namespace-require/constant`, `namespace-require/copy`, `namespace-require/expansion-time`, `namespace-set-variable-value!`, `namespace-symbol->identifier`, `namespace-syntax-introduce`, `namespace-undefine-variable!`, `namespace-unprotect-module`, `namespace-variable-value`, `namespace?`, `nan?`, `natural-number/c`, `negate`, `negative?`, `never-evt`, `new-∀/c`, `new-∃/c`, `newline`, `ninth`, `non-empty-listof`, `non-empty-string?`, `none/c`, `normal-case-path`, `normalize-arity`, `normalize-path`, `normalized-arity?`, `not`, `not/c`, `null`, `null?`, `number->string`, `number?`, `numerator`, `object%`, `object->vector`, `object-info`, `object-interface`, `object-method-arity-includes?`, `object-name`, `object-or-false=?`, `object=?`, `object?`, `odd?`, `one-of/c`, `open-input-bytes`, `open-input-file`, `open-input-output-file`, `open-input-string`, `open-output-bytes`, `open-output-file`, `open-output-nowhere`, `open-output-string`, `or/c`, `order-of-magnitude`, `ormap`, `other-execute-bit`, `other-read-bit`, `other-write-bit`, `output-port?`, `pair?`, `parameter-procedure=?`, `parameter/c`, `parameter?`, `parameterization?`, `parse-command-line`, `partition`, `path->bytes`, `path->complete-path`, `path->directory-path`, `path->string`, `path-add-suffix`, `path-convention-type`, `path-element->bytes`, `path-element->string`, `path-element?`, `path-for-some-system?`, `path-list-string->path-list`, `path-only`, `path-replace-suffix`, `path-string?`, `pathbytes`, `port->bytes-lines`, `port->lines`, `port->list`, `port->string`, `port-closed-evt`, `port-closed?`, `port-commit-peeked`, `port-count-lines!`, `port-count-lines-enabled`, `port-counts-lines?`, `port-display-handler`, `port-file-identity`, `port-file-unlock`, `port-next-location`, `port-number?`, `port-print-handler`, `port-progress-evt`, `port-provides-progress-evts?`, `port-read-handler`, `port-try-file-lock?`, `port-write-handler`, `port-writes-atomic?`, `port-writes-special?`, `port?`, `positive?`, `predicate/c`, `prefab-key->struct-type`, `prefab-key?`, `prefab-struct-key`, `preferences-lock-file-mode`, `pregexp`, `pregexp?`, `pretty-display`, `pretty-format`, `pretty-print`, `pretty-print-.-symbol-without-bars`, `pretty-print-abbreviate-read-macros`, `pretty-print-columns`, `pretty-print-current-style-table`, `pretty-print-depth`, `pretty-print-exact-as-decimal`, `pretty-print-extend-style-table`, `pretty-print-handler`, `pretty-print-newline`, `pretty-print-post-print-hook`, `pretty-print-pre-print-hook`, `pretty-print-print-hook`, `pretty-print-print-line`, `pretty-print-remap-stylable`, `pretty-print-show-inexactness`, `pretty-print-size-hook`, `pretty-print-style-table?`, `pretty-printing`, `pretty-write`, `primitive-closure?`, `primitive-result-arity`, `primitive?`, `print`, `print-as-expression`, `print-boolean-long-form`, `print-box`, `print-graph`, `print-hash-table`, `print-mpair-curly-braces`, `print-pair-curly-braces`, `print-reader-abbreviations`, `print-struct`, `print-syntax-width`, `print-unreadable`, `print-vector-length`, `printable/c`, `printable<%>`, `printf`, `println`, `procedure->method`, `procedure-arity`, `procedure-arity-includes/c`, `procedure-arity-includes?`, `procedure-arity?`, `procedure-closure-contents-eq?`, `procedure-extract-target`, `procedure-keywords`, `procedure-reduce-arity`, `procedure-reduce-keyword-arity`, `procedure-rename`, `procedure-result-arity`, `procedure-specialize`, `procedure-struct-type?`, `procedure?`, `process`, `process*`, `process*/ports`, `process/ports`, `processor-count`, `progress-evt?`, `promise-forced?`, `promise-running?`, `promise/c`, `promise/name?`, `promise?`, `prop:arity-string`, `prop:arrow-contract`, `prop:arrow-contract-get-info`, `prop:arrow-contract?`, `prop:blame`, `prop:chaperone-contract`, `prop:checked-procedure`, `prop:contract`, `prop:contracted`, `prop:custom-print-quotable`, `prop:custom-write`, `prop:dict`, `prop:dict/contract`, `prop:equal+hash`, `prop:evt`, `prop:exn:missing-module`, `prop:exn:srclocs`, `prop:expansion-contexts`, `prop:flat-contract`, `prop:impersonator-of`, `prop:input-port`, `prop:liberal-define-context`, `prop:object-name`, `prop:opt-chaperone-contract`, `prop:opt-chaperone-contract-get-test`, `prop:opt-chaperone-contract?`, `prop:orc-contract`, `prop:orc-contract-get-subcontracts`, `prop:orc-contract?`, `prop:output-port`, `prop:place-location`, `prop:procedure`, `prop:recursive-contract`, `prop:recursive-contract-unroll`, `prop:recursive-contract?`, `prop:rename-transformer`, `prop:sequence`, `prop:set!-transformer`, `prop:stream`, `proper-subset?`, `pseudo-random-generator->vector`, `pseudo-random-generator-vector?`, `pseudo-random-generator?`, `put-preferences`, `putenv`, `quotient`, `quotient/remainder`, `radians->degrees`, `raise`, `raise-argument-error`, `raise-arguments-error`, `raise-arity-error`, `raise-blame-error`, `raise-contract-error`, `raise-mismatch-error`, `raise-not-cons-blame-error`, `raise-range-error`, `raise-result-error`, `raise-syntax-error`, `raise-type-error`, `raise-user-error`, `random`, `random-seed`, `range`, `rational?`, `rationalize`, `read`, `read-accept-bar-quote`, `read-accept-box`, `read-accept-compiled`, `read-accept-dot`, `read-accept-graph`, `read-accept-infix-dot`, `read-accept-lang`, `read-accept-quasiquote`, `read-accept-reader`, `read-byte`, `read-byte-or-special`, `read-bytes`, `read-bytes!`, `read-bytes!-evt`, `read-bytes-avail!`, `read-bytes-avail!*`, `read-bytes-avail!-evt`, `read-bytes-avail!/enable-break`, `read-bytes-evt`, `read-bytes-line`, `read-bytes-line-evt`, `read-case-sensitive`, `read-cdot`, `read-char`, `read-char-or-special`, `read-curly-brace-as-paren`, `read-curly-brace-with-tag`, `read-decimal-as-inexact`, `read-eval-print-loop`, `read-language`, `read-line`, `read-line-evt`, `read-on-demand-source`, `read-square-bracket-as-paren`, `read-square-bracket-with-tag`, `read-string`, `read-string!`, `read-string!-evt`, `read-string-evt`, `read-syntax`, `read-syntax/recursive`, `read/recursive`, `readtable-mapping`, `readtable?`, `real->decimal-string`, `real->double-flonum`, `real->floating-point-bytes`, `real->single-flonum`, `real-in`, `real-part`, `real?`, `reencode-input-port`, `reencode-output-port`, `regexp`, `regexp-match`, `regexp-match*`, `regexp-match-evt`, `regexp-match-exact?`, `regexp-match-peek`, `regexp-match-peek-immediate`, `regexp-match-peek-positions`, `regexp-match-peek-positions*`, `regexp-match-peek-positions-immediate`, `regexp-match-peek-positions-immediate/end`, `regexp-match-peek-positions/end`, `regexp-match-positions`, `regexp-match-positions*`, `regexp-match-positions/end`, `regexp-match/end`, `regexp-match?`, `regexp-max-lookbehind`, `regexp-quote`, `regexp-replace`, `regexp-replace*`, `regexp-replace-quote`, `regexp-replaces`, `regexp-split`, `regexp-try-match`, `regexp?`, `relative-path?`, `relocate-input-port`, `relocate-output-port`, `remainder`, `remf`, `remf*`, `remove`, `remove*`, `remove-duplicates`, `remq`, `remq*`, `remv`, `remv*`, `rename-contract`, `rename-file-or-directory`, `rename-transformer-target`, `rename-transformer?`, `replace-evt`, `reroot-path`, `resolve-path`, `resolved-module-path-name`, `resolved-module-path?`, `rest`, `reverse`, `round`, `second`, `seconds->date`, `security-guard?`, `semaphore-peek-evt`, `semaphore-peek-evt?`, `semaphore-post`, `semaphore-try-wait?`, `semaphore-wait`, `semaphore-wait/enable-break`, `semaphore?`, `sequence->list`, `sequence->stream`, `sequence-add-between`, `sequence-andmap`, `sequence-append`, `sequence-count`, `sequence-filter`, `sequence-fold`, `sequence-for-each`, `sequence-generate`, `sequence-generate*`, `sequence-length`, `sequence-map`, `sequence-ormap`, `sequence-ref`, `sequence-tail`, `sequence/c`, `sequence?`, `set`, `set!-transformer-procedure`, `set!-transformer?`, `set->list`, `set->stream`, `set-add`, `set-add!`, `set-box!`, `set-clear`, `set-clear!`, `set-copy`, `set-copy-clear`, `set-count`, `set-empty?`, `set-eq?`, `set-equal?`, `set-eqv?`, `set-first`, `set-for-each`, `set-implements/c`, `set-implements?`, `set-intersect`, `set-intersect!`, `set-map`, `set-mcar!`, `set-mcdr!`, `set-member?`, `set-mutable?`, `set-phantom-bytes!`, `set-port-next-location!`, `set-remove`, `set-remove!`, `set-rest`, `set-some-basic-contracts!`, `set-subtract`, `set-subtract!`, `set-symmetric-difference`, `set-symmetric-difference!`, `set-union`, `set-union!`, `set-weak?`, `set/c`, `set=?`, `set?`, `seteq`, `seteqv`, `seventh`, `sgn`, `shared-bytes`, `shell-execute`, `shrink-path-wrt`, `shuffle`, `simple-form-path`, `simplify-path`, `sin`, `single-flonum?`, `sinh`, `sixth`, `skip-projection-wrapper?`, `sleep`, `some-system-path->string`, `sort`, `special-comment-value`, `special-comment?`, `special-filter-input-port`, `split-at`, `split-at-right`, `split-common-prefix`, `split-path`, `splitf-at`, `splitf-at-right`, `sqr`, `sqrt`, `srcloc`, `srcloc->string`, `srcloc-column`, `srcloc-line`, `srcloc-position`, `srcloc-source`, `srcloc-span`, `srcloc?`, `stop-after`, `stop-before`, `stream->list`, `stream-add-between`, `stream-andmap`, `stream-append`, `stream-count`, `stream-empty?`, `stream-filter`, `stream-first`, `stream-fold`, `stream-for-each`, `stream-length`, `stream-map`, `stream-ormap`, `stream-ref`, `stream-rest`, `stream-tail`, `stream/c`, `stream?`, `string`, `string->bytes/latin-1`, `string->bytes/locale`, `string->bytes/utf-8`, `string->immutable-string`, `string->keyword`, `string->list`, `string->number`, `string->path`, `string->path-element`, `string->some-system-path`, `string->symbol`, `string->uninterned-symbol`, `string->unreadable-symbol`, `string-append`, `string-append*`, `string-ci<=?`, `string-ci=?`, `string-ci>?`, `string-contains?`, `string-copy`, `string-copy!`, `string-downcase`, `string-environment-variable-name?`, `string-fill!`, `string-foldcase`, `string-join`, `string-len/c`, `string-length`, `string-locale-ci?`, `string-locale-downcase`, `string-locale-upcase`, `string-locale?`, `string-no-nuls?`, `string-normalize-nfc`, `string-normalize-nfd`, `string-normalize-nfkc`, `string-normalize-nfkd`, `string-normalize-spaces`, `string-port?`, `string-prefix?`, `string-ref`, `string-replace`, `string-set!`, `string-split`, `string-suffix?`, `string-titlecase`, `string-trim`, `string-upcase`, `string-utf-8-length`, `string<=?`, `string=?`, `string>?`, `string?`, `struct->vector`, `struct-accessor-procedure?`, `struct-constructor-procedure?`, `struct-info`, `struct-mutator-procedure?`, `struct-predicate-procedure?`, `struct-type-info`, `struct-type-make-constructor`, `struct-type-make-predicate`, `struct-type-property-accessor-procedure?`, `struct-type-property/c`, `struct-type-property?`, `struct-type?`, `struct:arity-at-least`, `struct:arrow-contract-info`, `struct:date`, `struct:date*`, `struct:exn`, `struct:exn:break`, `struct:exn:break:hang-up`, `struct:exn:break:terminate`, `struct:exn:fail`, `struct:exn:fail:contract`, `struct:exn:fail:contract:arity`, `struct:exn:fail:contract:blame`, `struct:exn:fail:contract:continuation`, `struct:exn:fail:contract:divide-by-zero`, `struct:exn:fail:contract:non-fixnum-result`, `struct:exn:fail:contract:variable`, `struct:exn:fail:filesystem`, `struct:exn:fail:filesystem:errno`, `struct:exn:fail:filesystem:exists`, `struct:exn:fail:filesystem:missing-module`, `struct:exn:fail:filesystem:version`, `struct:exn:fail:network`, `struct:exn:fail:network:errno`, `struct:exn:fail:object`, `struct:exn:fail:out-of-memory`, `struct:exn:fail:read`, `struct:exn:fail:read:eof`, `struct:exn:fail:read:non-char`, `struct:exn:fail:syntax`, `struct:exn:fail:syntax:missing-module`, `struct:exn:fail:syntax:unbound`, `struct:exn:fail:unsupported`, `struct:exn:fail:user`, `struct:srcloc`, `struct:wrapped-extra-arg-arrow`, `struct?`, `sub1`, `subbytes`, `subclass?`, `subclass?/c`, `subprocess`, `subprocess-group-enabled`, `subprocess-kill`, `subprocess-pid`, `subprocess-status`, `subprocess-wait`, `subprocess?`, `subset?`, `substring`, `suggest/c`, `symbol->string`, `symbol-interned?`, `symbol-unreadable?`, `symboldatum`, `syntax->list`, `syntax-arm`, `syntax-column`, `syntax-debug-info`, `syntax-disarm`, `syntax-e`, `syntax-line`, `syntax-local-bind-syntaxes`, `syntax-local-certifier`, `syntax-local-context`, `syntax-local-expand-expression`, `syntax-local-get-shadower`, `syntax-local-identifier-as-binding`, `syntax-local-introduce`, `syntax-local-lift-context`, `syntax-local-lift-expression`, `syntax-local-lift-module`, `syntax-local-lift-module-end-declaration`, `syntax-local-lift-provide`, `syntax-local-lift-require`, `syntax-local-lift-values-expression`, `syntax-local-make-definition-context`, `syntax-local-make-delta-introducer`, `syntax-local-module-defined-identifiers`, `syntax-local-module-exports`, `syntax-local-module-required-identifiers`, `syntax-local-name`, `syntax-local-phase-level`, `syntax-local-submodules`, `syntax-local-transforming-module-provides?`, `syntax-local-value`, `syntax-local-value/immediate`, `syntax-original?`, `syntax-position`, `syntax-property`, `syntax-property-preserved?`, `syntax-property-symbol-keys`, `syntax-protect`, `syntax-rearm`, `syntax-recertify`, `syntax-shift-phase-level`, `syntax-source`, `syntax-source-module`, `syntax-span`, `syntax-taint`, `syntax-tainted?`, `syntax-track-origin`, `syntax-transforming-module-expression?`, `syntax-transforming-with-lifts?`, `syntax-transforming?`, `syntax/c`, `syntax?`, `system`, `system*`, `system*/exit-code`, `system-big-endian?`, `system-idle-evt`, `system-language+country`, `system-library-subpath`, `system-path-convention-type`, `system-type`, `system/exit-code`, `tail-marks-match?`, `take`, `take-common-prefix`, `take-right`, `takef`, `takef-right`, `tan`, `tanh`, `tcp-abandon-port`, `tcp-accept`, `tcp-accept-evt`, `tcp-accept-ready?`, `tcp-accept/enable-break`, `tcp-addresses`, `tcp-close`, `tcp-connect`, `tcp-connect/enable-break`, `tcp-listen`, `tcp-listener?`, `tcp-port?`, `tentative-pretty-print-port-cancel`, `tentative-pretty-print-port-transfer`, `tenth`, `terminal-port?`, `the-unsupplied-arg`, `third`, `thread`, `thread-cell-ref`, `thread-cell-set!`, `thread-cell-values?`, `thread-cell?`, `thread-dead-evt`, `thread-dead?`, `thread-group?`, `thread-receive`, `thread-receive-evt`, `thread-resume`, `thread-resume-evt`, `thread-rewind-receive`, `thread-running?`, `thread-send`, `thread-suspend`, `thread-suspend-evt`, `thread-try-receive`, `thread-wait`, `thread/suspend-to-kill`, `thread?`, `time-apply`, `touch`, `transplant-input-port`, `transplant-output-port`, `true`, `truncate`, `udp-addresses`, `udp-bind!`, `udp-bound?`, `udp-close`, `udp-connect!`, `udp-connected?`, `udp-multicast-interface`, `udp-multicast-join-group!`, `udp-multicast-leave-group!`, `udp-multicast-loopback?`, `udp-multicast-set-interface!`, `udp-multicast-set-loopback!`, `udp-multicast-set-ttl!`, `udp-multicast-ttl`, `udp-open-socket`, `udp-receive!`, `udp-receive!*`, `udp-receive!-evt`, `udp-receive!/enable-break`, `udp-receive-ready-evt`, `udp-send`, `udp-send*`, `udp-send-evt`, `udp-send-ready-evt`, `udp-send-to`, `udp-send-to*`, `udp-send-to-evt`, `udp-send-to/enable-break`, `udp-send/enable-break`, `udp?`, `unbox`, `uncaught-exception-handler`, `unit?`, `unspecified-dom`, `unsupplied-arg?`, `use-collection-link-paths`, `use-compiled-file-paths`, `use-user-specific-search-paths`, `user-execute-bit`, `user-read-bit`, `user-write-bit`, `value-blame`, `value-contract`, `values`, `variable-reference->empty-namespace`, `variable-reference->module-base-phase`, `variable-reference->module-declaration-inspector`, `variable-reference->module-path-index`, `variable-reference->module-source`, `variable-reference->namespace`, `variable-reference->phase`, `variable-reference->resolved-module-path`, `variable-reference-constant?`, `variable-reference?`, `vector`, `vector->immutable-vector`, `vector->list`, `vector->pseudo-random-generator`, `vector->pseudo-random-generator!`, `vector->values`, `vector-append`, `vector-argmax`, `vector-argmin`, `vector-copy`, `vector-copy!`, `vector-count`, `vector-drop`, `vector-drop-right`, `vector-fill!`, `vector-filter`, `vector-filter-not`, `vector-immutable`, `vector-immutable/c`, `vector-immutableof`, `vector-length`, `vector-map`, `vector-map!`, `vector-member`, `vector-memq`, `vector-memv`, `vector-ref`, `vector-set!`, `vector-set*!`, `vector-set-performance-stats!`, `vector-split-at`, `vector-split-at-right`, `vector-take`, `vector-take-right`, `vector/c`, `vector?`, `vectorof`, `version`, `void`, `void?`, `weak-box-value`, `weak-box?`, `weak-set`, `weak-seteq`, `weak-seteqv`, `will-execute`, `will-executor?`, `will-register`, `will-try-execute`, `with-input-from-bytes`, `with-input-from-file`, `with-input-from-string`, `with-output-to-bytes`, `with-output-to-file`, `with-output-to-string`, `would-be-future`, `wrap-evt`, `wrapped-extra-arg-arrow`, `wrapped-extra-arg-arrow-extra-neg-party-argument`, `wrapped-extra-arg-arrow-real-func`, `wrapped-extra-arg-arrow?`, `writable<%>`, `write`, `write-byte`, `write-bytes`, `write-bytes-avail`, `write-bytes-avail*`, `write-bytes-avail-evt`, `write-bytes-avail/enable-break`, `write-char`, `write-special`, `write-special-avail*`, `write-special-evt`, `write-string`, `write-to-file`, `writeln`, `xor`, `zero?`, `~.a`, `~.s`, `~.v`, `~a`, `~e`, `~r`, `~s`, `~v`), NameBuiltin, Pop(1)}, + {"(?:\\|[^|]*\\||\\\\[\\w\\W]|[^|\\\\()[\\]{}\",\\'`;\\s]+)+", Name, Pop(1)}, + Include("datum*"), + }, + "unquoted-list": { + Include("list"), + {`(?!\Z)`, Text, Push("unquoted-datum")}, + }, + "quasiquoted-datum": { + Include("datum"), + {`,@?`, Operator, Push("#pop", "unquoted-datum")}, + {"unquote(-splicing)?(?=[()[\\]{}\",\\'`;\\s])", Keyword, Push("#pop", "unquoted-datum")}, + {`[([{]`, Punctuation, Push("#pop", "quasiquoted-list")}, + Include("datum*"), + }, + "quasiquoted-list": { + Include("list"), + {`(?!\Z)`, Text, Push("quasiquoted-datum")}, + }, + "quoted-datum": { + Include("datum"), + {`[([{]`, Punctuation, Push("#pop", "quoted-list")}, + Include("datum*"), + }, + "quoted-list": { + Include("list"), + {`(?!\Z)`, Text, Push("quoted-datum")}, + }, + "block-comment": { + {`#\|`, CommentMultiline, Push()}, + {`\|#`, CommentMultiline, Pop(1)}, + {`[^#|]+|.`, CommentMultiline, nil}, + }, + "string": { + {`"`, LiteralStringDouble, Pop(1)}, + {`(?s)\\([0-7]{1,3}|x[\da-fA-F]{1,2}|u[\da-fA-F]{1,4}|U[\da-fA-F]{1,8}|.)`, LiteralStringEscape, nil}, + {`[^\\"]+`, LiteralStringDouble, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/r/ragel.go b/vendor/github.com/alecthomas/chroma/lexers/r/ragel.go new file mode 100644 index 000000000..3da0ea70a --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/r/ragel.go @@ -0,0 +1,76 @@ +package r + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Ragel lexer. +var Ragel = internal.Register(MustNewLexer( + &Config{ + Name: "Ragel", + Aliases: []string{"ragel"}, + Filenames: []string{}, + MimeTypes: []string{}, + }, + Rules{ + "whitespace": { + {`\s+`, TextWhitespace, nil}, + }, + "comments": { + {`\#.*$`, Comment, nil}, + }, + "keywords": { + {`(access|action|alphtype)\b`, Keyword, nil}, + {`(getkey|write|machine|include)\b`, Keyword, nil}, + {`(any|ascii|extend|alpha|digit|alnum|lower|upper)\b`, Keyword, nil}, + {`(xdigit|cntrl|graph|print|punct|space|zlen|empty)\b`, Keyword, nil}, + }, + "numbers": { + {`0x[0-9A-Fa-f]+`, LiteralNumberHex, nil}, + {`[+-]?[0-9]+`, LiteralNumberInteger, nil}, + }, + "literals": { + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralString, nil}, + {`\[(\\\\|\\\]|[^\]])*\]`, LiteralString, nil}, + {`/(?!\*)(\\\\|\\/|[^/])*/`, LiteralStringRegex, nil}, + }, + "identifiers": { + {`[a-zA-Z_]\w*`, NameVariable, nil}, + }, + "operators": { + {`,`, Operator, nil}, + {`\||&|--?`, Operator, nil}, + {`\.|<:|:>>?`, Operator, nil}, + {`:`, Operator, nil}, + {`->`, Operator, nil}, + {`(>|\$|%|<|@|<>)(/|eof\b)`, Operator, nil}, + {`(>|\$|%|<|@|<>)(!|err\b)`, Operator, nil}, + {`(>|\$|%|<|@|<>)(\^|lerr\b)`, Operator, nil}, + {`(>|\$|%|<|@|<>)(~|to\b)`, Operator, nil}, + {`(>|\$|%|<|@|<>)(\*|from\b)`, Operator, nil}, + {`>|@|\$|%`, Operator, nil}, + {`\*|\?|\+|\{[0-9]*,[0-9]*\}`, Operator, nil}, + {`!|\^`, Operator, nil}, + {`\(|\)`, Operator, nil}, + }, + "root": { + Include("literals"), + Include("whitespace"), + Include("comments"), + Include("keywords"), + Include("numbers"), + Include("identifiers"), + Include("operators"), + {`\{`, Punctuation, Push("host")}, + {`=`, Operator, nil}, + {`;`, Punctuation, nil}, + }, + "host": { + {`([^{}\'"/#]+|[^\\]\\[{}]|"(\\\\|\\"|[^"])*"|'(\\\\|\\'|[^'])*'|//.*$\n?|/\*(.|\n)*?\*/|\#.*$\n?|/(?!\*)(\\\\|\\/|[^/])*/|/)+`, Other, nil}, + {`\{`, Punctuation, Push()}, + {`\}`, Punctuation, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/r/regedit.go b/vendor/github.com/alecthomas/chroma/lexers/r/regedit.go new file mode 100644 index 000000000..7ee9cb581 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/r/regedit.go @@ -0,0 +1,32 @@ +package r + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Reg lexer. +var Reg = internal.Register(MustNewLexer( + &Config{ + Name: "reg", + Aliases: []string{"registry"}, + Filenames: []string{"*.reg"}, + MimeTypes: []string{"text/x-windows-registry"}, + }, + Rules{ + "root": { + {`Windows Registry Editor.*`, Text, nil}, + {`\s+`, Text, nil}, + {`[;#].*`, CommentSingle, nil}, + {`(\[)(-?)(HKEY_[A-Z_]+)(.*?\])$`, ByGroups(Keyword, Operator, NameBuiltin, Keyword), nil}, + {`("(?:\\"|\\\\|[^"])+")([ \t]*)(=)([ \t]*)`, ByGroups(NameAttribute, Text, Operator, Text), Push("value")}, + {`(.*?)([ \t]*)(=)([ \t]*)`, ByGroups(NameAttribute, Text, Operator, Text), Push("value")}, + }, + "value": { + {`-`, Operator, Pop(1)}, + {`(dword|hex(?:\([0-9a-fA-F]\))?)(:)([0-9a-fA-F,]+)`, ByGroups(NameVariable, Punctuation, LiteralNumber), Pop(1)}, + {`.+`, LiteralString, Pop(1)}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/r/rexx.go b/vendor/github.com/alecthomas/chroma/lexers/r/rexx.go new file mode 100644 index 000000000..1f5550a53 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/r/rexx.go @@ -0,0 +1,59 @@ +package r + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Rexx lexer. +var Rexx = internal.Register(MustNewLexer( + &Config{ + Name: "Rexx", + Aliases: []string{"rexx", "arexx"}, + Filenames: []string{"*.rexx", "*.rex", "*.rx", "*.arexx"}, + MimeTypes: []string{"text/x-rexx"}, + NotMultiline: true, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\s`, TextWhitespace, nil}, + {`/\*`, CommentMultiline, Push("comment")}, + {`"`, LiteralString, Push("string_double")}, + {`'`, LiteralString, Push("string_single")}, + {`[0-9]+(\.[0-9]+)?(e[+-]?[0-9])?`, LiteralNumber, nil}, + {`([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b`, ByGroups(NameFunction, TextWhitespace, Operator, TextWhitespace, KeywordDeclaration), nil}, + {`([a-z_]\w*)(\s*)(:)`, ByGroups(NameLabel, TextWhitespace, Operator), nil}, + Include("function"), + Include("keyword"), + Include("operator"), + {`[a-z_]\w*`, Text, nil}, + }, + "function": { + {Words(``, `(\s*)(\()`, `abbrev`, `abs`, `address`, `arg`, `b2x`, `bitand`, `bitor`, `bitxor`, `c2d`, `c2x`, `center`, `charin`, `charout`, `chars`, `compare`, `condition`, `copies`, `d2c`, `d2x`, `datatype`, `date`, `delstr`, `delword`, `digits`, `errortext`, `form`, `format`, `fuzz`, `insert`, `lastpos`, `left`, `length`, `linein`, `lineout`, `lines`, `max`, `min`, `overlay`, `pos`, `queued`, `random`, `reverse`, `right`, `sign`, `sourceline`, `space`, `stream`, `strip`, `substr`, `subword`, `symbol`, `time`, `trace`, `translate`, `trunc`, `value`, `verify`, `word`, `wordindex`, `wordlength`, `wordpos`, `words`, `x2b`, `x2c`, `x2d`, `xrange`), ByGroups(NameBuiltin, TextWhitespace, Operator), nil}, + }, + "keyword": { + {`(address|arg|by|call|do|drop|else|end|exit|for|forever|if|interpret|iterate|leave|nop|numeric|off|on|options|parse|pull|push|queue|return|say|select|signal|to|then|trace|until|while)\b`, KeywordReserved, nil}, + }, + "operator": { + {`(-|//|/|\(|\)|\*\*|\*|\\<<|\\<|\\==|\\=|\\>>|\\>|\\|\|\||\||&&|&|%|\+|<<=|<<|<=|<>|<|==|=|><|>=|>>=|>>|>|¬<<|¬<|¬==|¬=|¬>>|¬>|¬|\.|,)`, Operator, nil}, + }, + "string_double": { + {`[^"\n]+`, LiteralString, nil}, + {`""`, LiteralString, nil}, + {`"`, LiteralString, Pop(1)}, + {`\n`, Text, Pop(1)}, + }, + "string_single": { + {`[^\'\n]`, LiteralString, nil}, + {`\'\'`, LiteralString, nil}, + {`\'`, LiteralString, Pop(1)}, + {`\n`, Text, Pop(1)}, + }, + "comment": { + {`[^*]+`, CommentMultiline, nil}, + {`\*/`, CommentMultiline, Pop(1)}, + {`\*`, CommentMultiline, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/r/rst.go b/vendor/github.com/alecthomas/chroma/lexers/r/rst.go new file mode 100644 index 000000000..f09dad092 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/r/rst.go @@ -0,0 +1,86 @@ +package r + +import ( + "strings" + + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Restructuredtext lexer. +var Restructuredtext = internal.Register(MustNewLexer( + &Config{ + Name: "reStructuredText", + Aliases: []string{"rst", "rest", "restructuredtext"}, + Filenames: []string{"*.rst", "*.rest"}, + MimeTypes: []string{"text/x-rst", "text/prs.fallenstein.rst"}, + }, + Rules{ + "root": { + {"^(=+|-+|`+|:+|\\.+|\\'+|\"+|~+|\\^+|_+|\\*+|\\++|#+)([ \\t]*\\n)(.+)(\\n)(\\1)(\\n)", ByGroups(GenericHeading, Text, GenericHeading, Text, GenericHeading, Text), nil}, + {"^(\\S.*)(\\n)(={3,}|-{3,}|`{3,}|:{3,}|\\.{3,}|\\'{3,}|\"{3,}|~{3,}|\\^{3,}|_{3,}|\\*{3,}|\\+{3,}|#{3,})(\\n)", ByGroups(GenericHeading, Text, GenericHeading, Text), nil}, + {`^(\s*)([-*+])( .+\n(?:\1 .+\n)*)`, ByGroups(Text, LiteralNumber, UsingSelf("inline")), nil}, + {`^(\s*)([0-9#ivxlcmIVXLCM]+\.)( .+\n(?:\1 .+\n)*)`, ByGroups(Text, LiteralNumber, UsingSelf("inline")), nil}, + {`^(\s*)(\(?[0-9#ivxlcmIVXLCM]+\))( .+\n(?:\1 .+\n)*)`, ByGroups(Text, LiteralNumber, UsingSelf("inline")), nil}, + {`^(\s*)([A-Z]+\.)( .+\n(?:\1 .+\n)+)`, ByGroups(Text, LiteralNumber, UsingSelf("inline")), nil}, + {`^(\s*)(\(?[A-Za-z]+\))( .+\n(?:\1 .+\n)+)`, ByGroups(Text, LiteralNumber, UsingSelf("inline")), nil}, + {`^(\s*)(\|)( .+\n(?:\| .+\n)*)`, ByGroups(Text, Operator, UsingSelf("inline")), nil}, + {`^( *\.\.)(\s*)((?:source)?code(?:-block)?)(::)([ \t]*)([^\n]+)(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\8.*|)\n)+)`, EmitterFunc(rstCodeBlock), nil}, + {`^( *\.\.)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))`, ByGroups(Punctuation, Text, OperatorWord, Punctuation, Text, UsingSelf("inline")), nil}, + {`^( *\.\.)(\s*)(_(?:[^:\\]|\\.)+:)(.*?)$`, ByGroups(Punctuation, Text, NameTag, UsingSelf("inline")), nil}, + {`^( *\.\.)(\s*)(\[.+\])(.*?)$`, ByGroups(Punctuation, Text, NameTag, UsingSelf("inline")), nil}, + {`^( *\.\.)(\s*)(\|.+\|)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))`, ByGroups(Punctuation, Text, NameTag, Text, OperatorWord, Punctuation, Text, UsingSelf("inline")), nil}, + {`^ *\.\..*(\n( +.*\n|\n)+)?`, CommentPreproc, nil}, + {`^( *)(:[a-zA-Z-]+:)(\s*)$`, ByGroups(Text, NameClass, Text), nil}, + {`^( *)(:.*?:)([ \t]+)(.*?)$`, ByGroups(Text, NameClass, Text, NameFunction), nil}, + {`^(\S.*(?)(`__?)", ByGroups(LiteralString, LiteralStringInterpol, LiteralString), nil}, + {"`.+?`__?", LiteralString, nil}, + {"(`.+?`)(:[a-zA-Z0-9:-]+?:)?", ByGroups(NameVariable, NameAttribute), nil}, + {"(:[a-zA-Z0-9:-]+?:)(`.+?`)", ByGroups(NameAttribute, NameVariable), nil}, + {`\*\*.+?\*\*`, GenericStrong, nil}, + {`\*.+?\*`, GenericEmph, nil}, + {`\[.*?\]_`, LiteralString, nil}, + {`<.+?>`, NameTag, nil}, + {"[^\\\\\\n\\[*`:]+", Text, nil}, + {`.`, Text, nil}, + }, + "literal": { + {"[^`]+", LiteralString, nil}, + {"``((?=$)|(?=[-/:.,; \\n\\x00\\\u2010\\\u2011\\\u2012\\\u2013\\\u2014\\\u00a0\\'\\\"\\)\\]\\}\\>\\\u2019\\\u201d\\\u00bb\\!\\?]))", LiteralString, Pop(1)}, + {"`", LiteralString, nil}, + }, + }, +)) + +func rstCodeBlock(groups []string, lexer Lexer) Iterator { + iterators := []Iterator{} + tokens := []Token{ + {Punctuation, groups[1]}, + {Text, groups[2]}, + {OperatorWord, groups[3]}, + {Punctuation, groups[4]}, + {Text, groups[5]}, + {Keyword, groups[6]}, + {Text, groups[7]}, + } + code := strings.Join(groups[8:], "") + lexer = internal.Get(groups[6]) + if lexer == nil { + tokens = append(tokens, Token{String, code}) + iterators = append(iterators, Literator(tokens...)) + } else { + sub, err := lexer.Tokenise(nil, code) + if err != nil { + panic(err) + } + iterators = append(iterators, Literator(tokens...), sub) + } + return Concaterator(iterators...) +} diff --git a/vendor/github.com/alecthomas/chroma/lexers/r/ruby.go b/vendor/github.com/alecthomas/chroma/lexers/r/ruby.go new file mode 100644 index 000000000..6af8db204 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/r/ruby.go @@ -0,0 +1,250 @@ +package r + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Ruby lexer. +var Ruby = internal.Register(MustNewLexer( + &Config{ + Name: "Ruby", + Aliases: []string{"rb", "ruby", "duby"}, + Filenames: []string{"*.rb", "*.rbw", "Rakefile", "*.rake", "*.gemspec", "*.rbx", "*.duby", "Gemfile"}, + MimeTypes: []string{"text/x-ruby", "application/x-ruby"}, + DotAll: true, + }, + Rules{ + "root": { + {`\A#!.+?$`, CommentHashbang, nil}, + {`#.*?$`, CommentSingle, nil}, + {`=begin\s.*?\n=end.*?$`, CommentMultiline, nil}, + {Words(``, `\b`, `BEGIN`, `END`, `alias`, `begin`, `break`, `case`, `defined?`, `do`, `else`, `elsif`, `end`, `ensure`, `for`, `if`, `in`, `next`, `redo`, `rescue`, `raise`, `retry`, `return`, `super`, `then`, `undef`, `unless`, `until`, `when`, `while`, `yield`), Keyword, nil}, + {`(module)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)`, ByGroups(Keyword, Text, NameNamespace), nil}, + {`(def)(\s+)`, ByGroups(Keyword, Text), Push("funcname")}, + {"def(?=[*%&^`~+-/\\[<>=])", Keyword, Push("funcname")}, + {`(class)(\s+)`, ByGroups(Keyword, Text), Push("classname")}, + {Words(``, `\b`, `initialize`, `new`, `loop`, `include`, `extend`, `raise`, `attr_reader`, `attr_writer`, `attr_accessor`, `attr`, `catch`, `throw`, `private`, `module_function`, `public`, `protected`, `true`, `false`, `nil`), KeywordPseudo, nil}, + {`(not|and|or)\b`, OperatorWord, nil}, + {Words(``, `\?`, `autoload`, `block_given`, `const_defined`, `eql`, `equal`, `frozen`, `include`, `instance_of`, `is_a`, `iterator`, `kind_of`, `method_defined`, `nil`, `private_method_defined`, `protected_method_defined`, `public_method_defined`, `respond_to`, `tainted`), NameBuiltin, nil}, + {`(chomp|chop|exit|gsub|sub)!`, NameBuiltin, nil}, + {Words(`(?~!:])|(?<=(?:\s|;)when\s)|(?<=(?:\s|;)or\s)|(?<=(?:\s|;)and\s)|(?<=\.index\s)|(?<=\.scan\s)|(?<=\.sub\s)|(?<=\.sub!\s)|(?<=\.gsub\s)|(?<=\.gsub!\s)|(?<=\.match\s)|(?<=(?:\s|;)if\s)|(?<=(?:\s|;)elsif\s)|(?<=^when\s)|(?<=^index\s)|(?<=^scan\s)|(?<=^sub\s)|(?<=^gsub\s)|(?<=^sub!\s)|(?<=^gsub!\s)|(?<=^match\s)|(?<=^if\s)|(?<=^elsif\s))(\s*)(/)`, ByGroups(Text, LiteralStringRegex), Push("multiline-regex")}, + {`(?<=\(|,|\[)/`, LiteralStringRegex, Push("multiline-regex")}, + {`(\s+)(/)(?![\s=])`, ByGroups(Text, LiteralStringRegex), Push("multiline-regex")}, + {`(0_?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?`, ByGroups(LiteralNumberOct, Text, Operator), nil}, + {`(0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?`, ByGroups(LiteralNumberHex, Text, Operator), nil}, + {`(0b[01]+(?:_[01]+)*)(\s*)([/?])?`, ByGroups(LiteralNumberBin, Text, Operator), nil}, + {`([\d]+(?:_\d+)*)(\s*)([/?])?`, ByGroups(LiteralNumberInteger, Text, Operator), nil}, + {`@@[a-zA-Z_]\w*`, NameVariableClass, nil}, + {`@[a-zA-Z_]\w*`, NameVariableInstance, nil}, + {`\$\w+`, NameVariableGlobal, nil}, + {"\\$[!@&`\\'+~=/\\\\,;.<>_*$?:\"^-]", NameVariableGlobal, nil}, + {`\$-[0adFiIlpvw]`, NameVariableGlobal, nil}, + {`::`, Operator, nil}, + Include("strings"), + {`\?(\\[MC]-)*(\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})|\S)(?!\w)`, LiteralStringChar, nil}, + {`[A-Z]\w+`, NameConstant, nil}, + {Words(`(\.|::)`, ``, `*`, `**`, `-`, `+`, `-@`, `+@`, `/`, `%`, `&`, `|`, `^`, "`", `~`, `[]`, `[]=`, `<<`, `>>`, `<`, `<>`, `<=>`, `>`, `>=`, `==`, `===`), ByGroups(Operator, NameOperator), nil}, + {"(\\.|::)([a-zA-Z_]\\w*[!?]?|[*%&^`~+\\-/\\[<>=])", ByGroups(Operator, Name), nil}, + {`[a-zA-Z_]\w*[!?]?`, Name, nil}, + {`(\[|\]|\*\*|<>?|>=|<=|<=>|=~|={3}|!~|&&?|\|\||\.{1,3})`, Operator, nil}, + {`[-+/*%=<>&!^|~]=?`, Operator, nil}, + {`[(){};,/?:\\]`, Punctuation, nil}, + {`\s+`, Text, nil}, + }, + "funcname": { + {`\(`, Punctuation, Push("defexpr")}, + {"(?:([a-zA-Z_]\\w*)(\\.))?([a-zA-Z_]\\w*[!?]?|\\*\\*?|[-+]@?|[/%&|^`~]|\\[\\]=?|<<|>>|<=?>|>=?|===?)", ByGroups(NameClass, Operator, NameFunction), Pop(1)}, + Default(Pop(1)), + }, + "classname": { + {`\(`, Punctuation, Push("defexpr")}, + {`<<`, Operator, Pop(1)}, + {`[A-Z_]\w*`, NameClass, Pop(1)}, + Default(Pop(1)), + }, + "defexpr": { + {`(\))(\.|::)?`, ByGroups(Punctuation, Operator), Pop(1)}, + {`\(`, Operator, Push()}, + Include("root"), + }, + "in-intp": { + {`\{`, LiteralStringInterpol, Push()}, + {`\}`, LiteralStringInterpol, Pop(1)}, + Include("root"), + }, + "string-intp": { + {`#\{`, LiteralStringInterpol, Push("in-intp")}, + {`#@@?[a-zA-Z_]\w*`, LiteralStringInterpol, nil}, + {`#\$[a-zA-Z_]\w*`, LiteralStringInterpol, nil}, + }, + "string-intp-escaped": { + Include("string-intp"), + {`\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})`, LiteralStringEscape, nil}, + }, + "interpolated-regex": { + Include("string-intp"), + {`[\\#]`, LiteralStringRegex, nil}, + {`[^\\#]+`, LiteralStringRegex, nil}, + }, + "interpolated-string": { + Include("string-intp"), + {`[\\#]`, LiteralStringOther, nil}, + {`[^\\#]+`, LiteralStringOther, nil}, + }, + "multiline-regex": { + Include("string-intp"), + {`\\\\`, LiteralStringRegex, nil}, + {`\\/`, LiteralStringRegex, nil}, + {`[\\#]`, LiteralStringRegex, nil}, + {`[^\\/#]+`, LiteralStringRegex, nil}, + {`/[mixounse]*`, LiteralStringRegex, Pop(1)}, + }, + "end-part": { + {`.+`, CommentPreproc, Pop(1)}, + }, + "strings": { + {`\:@{0,2}[a-zA-Z_]\w*[!?]?`, LiteralStringSymbol, nil}, + {Words(`\:@{0,2}`, ``, `*`, `**`, `-`, `+`, `-@`, `+@`, `/`, `%`, `&`, `|`, `^`, "`", `~`, `[]`, `[]=`, `<<`, `>>`, `<`, `<>`, `<=>`, `>`, `>=`, `==`, `===`), LiteralStringSymbol, nil}, + {`:'(\\\\|\\'|[^'])*'`, LiteralStringSymbol, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`:"`, LiteralStringSymbol, Push("simple-sym")}, + {`([a-zA-Z_]\w*)(:)(?!:)`, ByGroups(LiteralStringSymbol, Punctuation), nil}, + {`"`, LiteralStringDouble, Push("simple-string")}, + {"(?&!^|~,(])(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)`, ByGroups(Text, LiteralStringOther, None), nil}, + {`^(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)`, ByGroups(Text, LiteralStringOther, None), nil}, + {`(%([^a-zA-Z0-9\s]))((?:\\\2|(?!\2).)*)(\2)`, String, nil}, + }, + "simple-string": { + Include("string-intp-escaped"), + {`[^\\"#]+`, LiteralStringDouble, nil}, + {`[\\#]`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + "simple-sym": { + Include("string-intp-escaped"), + {`[^\\"#]+`, LiteralStringSymbol, nil}, + {`[\\#]`, LiteralStringSymbol, nil}, + {`"`, LiteralStringSymbol, Pop(1)}, + }, + "simple-backtick": { + Include("string-intp-escaped"), + {"[^\\\\`#]+", LiteralStringBacktick, nil}, + {`[\\#]`, LiteralStringBacktick, nil}, + {"`", LiteralStringBacktick, Pop(1)}, + }, + "cb-intp-string": { + {`\\[\\{}]`, LiteralStringOther, nil}, + {`\{`, LiteralStringOther, Push()}, + {`\}`, LiteralStringOther, Pop(1)}, + Include("string-intp-escaped"), + {`[\\#{}]`, LiteralStringOther, nil}, + {`[^\\#{}]+`, LiteralStringOther, nil}, + }, + "cb-string": { + {`\\[\\{}]`, LiteralStringOther, nil}, + {`\{`, LiteralStringOther, Push()}, + {`\}`, LiteralStringOther, Pop(1)}, + {`[\\#{}]`, LiteralStringOther, nil}, + {`[^\\#{}]+`, LiteralStringOther, nil}, + }, + "cb-regex": { + {`\\[\\{}]`, LiteralStringRegex, nil}, + {`\{`, LiteralStringRegex, Push()}, + {`\}[mixounse]*`, LiteralStringRegex, Pop(1)}, + Include("string-intp"), + {`[\\#{}]`, LiteralStringRegex, nil}, + {`[^\\#{}]+`, LiteralStringRegex, nil}, + }, + "sb-intp-string": { + {`\\[\\\[\]]`, LiteralStringOther, nil}, + {`\[`, LiteralStringOther, Push()}, + {`\]`, LiteralStringOther, Pop(1)}, + Include("string-intp-escaped"), + {`[\\#\[\]]`, LiteralStringOther, nil}, + {`[^\\#\[\]]+`, LiteralStringOther, nil}, + }, + "sb-string": { + {`\\[\\\[\]]`, LiteralStringOther, nil}, + {`\[`, LiteralStringOther, Push()}, + {`\]`, LiteralStringOther, Pop(1)}, + {`[\\#\[\]]`, LiteralStringOther, nil}, + {`[^\\#\[\]]+`, LiteralStringOther, nil}, + }, + "sb-regex": { + {`\\[\\\[\]]`, LiteralStringRegex, nil}, + {`\[`, LiteralStringRegex, Push()}, + {`\][mixounse]*`, LiteralStringRegex, Pop(1)}, + Include("string-intp"), + {`[\\#\[\]]`, LiteralStringRegex, nil}, + {`[^\\#\[\]]+`, LiteralStringRegex, nil}, + }, + "pa-intp-string": { + {`\\[\\()]`, LiteralStringOther, nil}, + {`\(`, LiteralStringOther, Push()}, + {`\)`, LiteralStringOther, Pop(1)}, + Include("string-intp-escaped"), + {`[\\#()]`, LiteralStringOther, nil}, + {`[^\\#()]+`, LiteralStringOther, nil}, + }, + "pa-string": { + {`\\[\\()]`, LiteralStringOther, nil}, + {`\(`, LiteralStringOther, Push()}, + {`\)`, LiteralStringOther, Pop(1)}, + {`[\\#()]`, LiteralStringOther, nil}, + {`[^\\#()]+`, LiteralStringOther, nil}, + }, + "pa-regex": { + {`\\[\\()]`, LiteralStringRegex, nil}, + {`\(`, LiteralStringRegex, Push()}, + {`\)[mixounse]*`, LiteralStringRegex, Pop(1)}, + Include("string-intp"), + {`[\\#()]`, LiteralStringRegex, nil}, + {`[^\\#()]+`, LiteralStringRegex, nil}, + }, + "ab-intp-string": { + {`\\[\\<>]`, LiteralStringOther, nil}, + {`<`, LiteralStringOther, Push()}, + {`>`, LiteralStringOther, Pop(1)}, + Include("string-intp-escaped"), + {`[\\#<>]`, LiteralStringOther, nil}, + {`[^\\#<>]+`, LiteralStringOther, nil}, + }, + "ab-string": { + {`\\[\\<>]`, LiteralStringOther, nil}, + {`<`, LiteralStringOther, Push()}, + {`>`, LiteralStringOther, Pop(1)}, + {`[\\#<>]`, LiteralStringOther, nil}, + {`[^\\#<>]+`, LiteralStringOther, nil}, + }, + "ab-regex": { + {`\\[\\<>]`, LiteralStringRegex, nil}, + {`<`, LiteralStringRegex, Push()}, + {`>[mixounse]*`, LiteralStringRegex, Pop(1)}, + Include("string-intp"), + {`[\\#<>]`, LiteralStringRegex, nil}, + {`[^\\#<>]+`, LiteralStringRegex, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/r/rust.go b/vendor/github.com/alecthomas/chroma/lexers/r/rust.go new file mode 100644 index 000000000..5e18b8fb6 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/r/rust.go @@ -0,0 +1,135 @@ +package r + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Rust lexer. +var Rust = internal.Register(MustNewLexer( + &Config{ + Name: "Rust", + Aliases: []string{"rust"}, + Filenames: []string{"*.rs", "*.rs.in"}, + MimeTypes: []string{"text/rust"}, + EnsureNL: true, + }, + Rules{ + "root": { + {`#![^[\r\n].*$`, CommentPreproc, nil}, + Default(Push("base")), + }, + "base": { + {`\n`, TextWhitespace, nil}, + {`\s+`, TextWhitespace, nil}, + {`//!.*?\n`, LiteralStringDoc, nil}, + {`///(\n|[^/].*?\n)`, LiteralStringDoc, nil}, + {`//(.*?)\n`, CommentSingle, nil}, + {`/\*\*(\n|[^/*])`, LiteralStringDoc, Push("doccomment")}, + {`/\*!`, LiteralStringDoc, Push("doccomment")}, + {`/\*`, CommentMultiline, Push("comment")}, + {`r#*"(?:\\.|[^\\\r\n;])*"#*`, LiteralString, nil}, + {`"(?:\\.|[^\\\r\n"])*"`, LiteralString, nil}, + {`\$([a-zA-Z_]\w*|\(,?|\),?|,?)`, CommentPreproc, nil}, + {Words(``, `\b`, `as`, `box`, `const`, `crate`, `else`, `extern`, `for`, `if`, `impl`, `in`, `loop`, `match`, `move`, `mut`, `pub`, `ref`, `return`, `static`, `super`, `trait`, `unsafe`, `use`, `where`, `while`), Keyword, nil}, + {Words(``, `\b`, `abstract`, `alignof`, `become`, `do`, `final`, `macro`, `offsetof`, `override`, `priv`, `proc`, `pure`, `sizeof`, `typeof`, `unsized`, `virtual`, `yield`), KeywordReserved, nil}, + {`(true|false)\b`, KeywordConstant, nil}, + {`mod\b`, Keyword, Push("modname")}, + {`let\b`, KeywordDeclaration, nil}, + {`fn\b`, Keyword, Push("funcname")}, + {`(struct|enum|type|union)\b`, Keyword, Push("typename")}, + {`(default)(\s+)(type|fn)\b`, ByGroups(Keyword, Text, Keyword), nil}, + {Words(``, `\b`, `u8`, `u16`, `u32`, `u64`, `i8`, `i16`, `i32`, `i64`, `usize`, `isize`, `f32`, `f64`, `str`, `bool`), KeywordType, nil}, + {`self\b`, NameBuiltinPseudo, nil}, + {Words(``, `\b`, `Copy`, `Send`, `Sized`, `Sync`, `Drop`, `Fn`, `FnMut`, `FnOnce`, `Box`, `ToOwned`, `Clone`, `PartialEq`, `PartialOrd`, `Eq`, `Ord`, `AsRef`, `AsMut`, `Into`, `From`, `Default`, `Iterator`, `Extend`, `IntoIterator`, `DoubleEndedIterator`, `ExactSizeIterator`, `Option`, `Some`, `None`, `Result`, `Ok`, `Err`, `SliceConcatExt`, `String`, `ToString`, `Vec`), NameBuiltin, nil}, + {`::\b`, Text, nil}, + {`(?::|->)`, Text, Push("typename")}, + {`(break|continue)(\s*)(\'[A-Za-z_]\w*)?`, ByGroups(Keyword, TextWhitespace, NameLabel), nil}, + {`'(\\['"\\nrt]|\\x[0-7][0-9a-fA-F]|\\0|\\u\{[0-9a-fA-F]{1,6}\}|.)'`, LiteralStringChar, nil}, + {`b'(\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\0|\\u\{[0-9a-fA-F]{1,6}\}|.)'`, LiteralStringChar, nil}, + {`0b[01_]+`, LiteralNumberBin, Push("number_lit")}, + {`0o[0-7_]+`, LiteralNumberOct, Push("number_lit")}, + {`0[xX][0-9a-fA-F_]+`, LiteralNumberHex, Push("number_lit")}, + {`[0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|\.[0-9_]*(?!\.)|[eE][+\-]?[0-9_]+)`, LiteralNumberFloat, Push("number_lit")}, + {`[0-9][0-9_]*`, LiteralNumberInteger, Push("number_lit")}, + {`b"`, LiteralString, Push("bytestring")}, + {`b?r(#*)".*?"\1`, LiteralString, nil}, + {`'static`, NameBuiltin, nil}, + {`'[a-zA-Z_]\w*`, NameAttribute, nil}, + {`[{}()\[\],.;]`, Punctuation, nil}, + {`[+\-*/%&|<>^!~@=:?]`, Operator, nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + {`#!?\[`, CommentPreproc, Push("attribute[")}, + {`([A-Za-z_]\w*)(!)(\s*)([A-Za-z_]\w*)?(\s*)(\{)`, ByGroups(CommentPreproc, Punctuation, TextWhitespace, Name, TextWhitespace, Punctuation), Push("macro{")}, + {`([A-Za-z_]\w*)(!)(\s*)([A-Za-z_]\w*)?(\()`, ByGroups(CommentPreproc, Punctuation, TextWhitespace, Name, Punctuation), Push("macro(")}, + }, + "comment": { + {`[^*/]+`, CommentMultiline, nil}, + {`/\*`, CommentMultiline, Push()}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[*/]`, CommentMultiline, nil}, + }, + "doccomment": { + {`[^*/]+`, LiteralStringDoc, nil}, + {`/\*`, LiteralStringDoc, Push()}, + {`\*/`, LiteralStringDoc, Pop(1)}, + {`[*/]`, LiteralStringDoc, nil}, + }, + "modname": { + {`\s+`, Text, nil}, + {`[a-zA-Z_]\w*`, NameNamespace, Pop(1)}, + Default(Pop(1)), + }, + "funcname": { + {`\s+`, Text, nil}, + {`[a-zA-Z_]\w*`, NameFunction, Pop(1)}, + Default(Pop(1)), + }, + "typename": { + {`\s+`, Text, nil}, + {`&`, KeywordPseudo, nil}, + {Words(``, `\b`, `Copy`, `Send`, `Sized`, `Sync`, `Drop`, `Fn`, `FnMut`, `FnOnce`, `Box`, `ToOwned`, `Clone`, `PartialEq`, `PartialOrd`, `Eq`, `Ord`, `AsRef`, `AsMut`, `Into`, `From`, `Default`, `Iterator`, `Extend`, `IntoIterator`, `DoubleEndedIterator`, `ExactSizeIterator`, `Option`, `Some`, `None`, `Result`, `Ok`, `Err`, `SliceConcatExt`, `String`, `ToString`, `Vec`), NameBuiltin, nil}, + {Words(``, `\b`, `u8`, `u16`, `u32`, `u64`, `i8`, `i16`, `i32`, `i64`, `usize`, `isize`, `f32`, `f64`, `str`, `bool`), KeywordType, nil}, + {`[a-zA-Z_]\w*`, NameClass, Pop(1)}, + Default(Pop(1)), + }, + "number_lit": { + {`[ui](8|16|32|64|size)`, Keyword, Pop(1)}, + {`f(32|64)`, Keyword, Pop(1)}, + Default(Pop(1)), + }, + "string": { + {`"`, LiteralString, Pop(1)}, + {`\\['"\\nrt]|\\x[0-7][0-9a-fA-F]|\\0|\\u\{[0-9a-fA-F]{1,6}\}`, LiteralStringEscape, nil}, + {`[^\\"]+`, LiteralString, nil}, + {`\\`, LiteralString, nil}, + }, + "bytestring": { + {`\\x[89a-fA-F][0-9a-fA-F]`, LiteralStringEscape, nil}, + Include("string"), + }, + "macro{": { + {`\{`, Operator, Push()}, + {`\}`, Operator, Pop(1)}, + }, + "macro(": { + {`\(`, Operator, Push()}, + {`\)`, Operator, Pop(1)}, + }, + "attribute_common": { + {`"`, LiteralString, Push("string")}, + {`\[`, CommentPreproc, Push("attribute[")}, + {`\(`, CommentPreproc, Push("attribute(")}, + }, + "attribute[": { + Include("attribute_common"), + {`\];?`, CommentPreproc, Pop(1)}, + {`[^"\]]+`, CommentPreproc, nil}, + }, + "attribute(": { + Include("attribute_common"), + {`\);?`, CommentPreproc, Pop(1)}, + {`[^")]+`, CommentPreproc, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/sass.go b/vendor/github.com/alecthomas/chroma/lexers/s/sass.go new file mode 100644 index 000000000..6200f6a37 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/sass.go @@ -0,0 +1,144 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Sass lexer. +var Sass = internal.Register(MustNewLexer( + &Config{ + Name: "Sass", + Aliases: []string{"sass"}, + Filenames: []string{"*.sass"}, + MimeTypes: []string{"text/x-sass"}, + CaseInsensitive: true, + }, + Rules{ + // "root": { + // }, + "root": { + {`[ \t]*\n`, Text, nil}, + // { `[ \t]*`, ?? ??, nil }, + // { `//[^\n]*`, ?? .callback at 0x106936048> ??, Push("root") }, + // { `/\*[^\n]*`, ?? .callback at 0x1069360d0> ??, Push("root") }, + {`@import`, Keyword, Push("import")}, + {`@for`, Keyword, Push("for")}, + {`@(debug|warn|if|while)`, Keyword, Push("value")}, + {`(@mixin)( [\w-]+)`, ByGroups(Keyword, NameFunction), Push("value")}, + {`(@include)( [\w-]+)`, ByGroups(Keyword, NameDecorator), Push("value")}, + {`@extend`, Keyword, Push("selector")}, + {`@[\w-]+`, Keyword, Push("selector")}, + {`=[\w-]+`, NameFunction, Push("value")}, + {`\+[\w-]+`, NameDecorator, Push("value")}, + {`([!$][\w-]\w*)([ \t]*(?:(?:\|\|)?=|:))`, ByGroups(NameVariable, Operator), Push("value")}, + {`:`, NameAttribute, Push("old-style-attr")}, + {`(?=.+?[=:]([^a-z]|$))`, NameAttribute, Push("new-style-attr")}, + Default(Push("selector")), + }, + "single-comment": { + {`.+`, CommentSingle, nil}, + {`\n`, Text, Push("root")}, + }, + "multi-comment": { + {`.+`, CommentMultiline, nil}, + {`\n`, Text, Push("root")}, + }, + "import": { + {`[ \t]+`, Text, nil}, + {`\S+`, LiteralString, nil}, + {`\n`, Text, Push("root")}, + }, + "old-style-attr": { + {`[^\s:="\[]+`, NameAttribute, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`[ \t]*=`, Operator, Push("value")}, + Default(Push("value")), + }, + "new-style-attr": { + {`[^\s:="\[]+`, NameAttribute, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`[ \t]*[=:]`, Operator, Push("value")}, + }, + "inline-comment": { + {`(\\#|#(?=[^\n{])|\*(?=[^\n/])|[^\n#*])+`, CommentMultiline, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`\*/`, Comment, Pop(1)}, + }, + "value": { + {`[ \t]+`, Text, nil}, + {`[!$][\w-]+`, NameVariable, nil}, + {`url\(`, LiteralStringOther, Push("string-url")}, + {`[a-z_-][\w-]*(?=\()`, NameFunction, nil}, + {Words(``, `\b`, `align-content`, `align-items`, `align-self`, `alignment-baseline`, `all`, `animation`, `animation-delay`, `animation-direction`, `animation-duration`, `animation-fill-mode`, `animation-iteration-count`, `animation-name`, `animation-play-state`, `animation-timing-function`, `appearance`, `azimuth`, `backface-visibility`, `background`, `background-attachment`, `background-blend-mode`, `background-clip`, `background-color`, `background-image`, `background-origin`, `background-position`, `background-repeat`, `background-size`, `baseline-shift`, `bookmark-label`, `bookmark-level`, `bookmark-state`, `border`, `border-bottom`, `border-bottom-color`, `border-bottom-left-radius`, `border-bottom-right-radius`, `border-bottom-style`, `border-bottom-width`, `border-boundary`, `border-collapse`, `border-color`, `border-image`, `border-image-outset`, `border-image-repeat`, `border-image-slice`, `border-image-source`, `border-image-width`, `border-left`, `border-left-color`, `border-left-style`, `border-left-width`, `border-radius`, `border-right`, `border-right-color`, `border-right-style`, `border-right-width`, `border-spacing`, `border-style`, `border-top`, `border-top-color`, `border-top-left-radius`, `border-top-right-radius`, `border-top-style`, `border-top-width`, `border-width`, `bottom`, `box-decoration-break`, `box-shadow`, `box-sizing`, `box-snap`, `box-suppress`, `break-after`, `break-before`, `break-inside`, `caption-side`, `caret`, `caret-animation`, `caret-color`, `caret-shape`, `chains`, `clear`, `clip`, `clip-path`, `clip-rule`, `color`, `color-interpolation-filters`, `column-count`, `column-fill`, `column-gap`, `column-rule`, `column-rule-color`, `column-rule-style`, `column-rule-width`, `column-span`, `column-width`, `columns`, `content`, `counter-increment`, `counter-reset`, `counter-set`, `crop`, `cue`, `cue-after`, `cue-before`, `cursor`, `direction`, `display`, `dominant-baseline`, `elevation`, `empty-cells`, `filter`, `flex`, `flex-basis`, `flex-direction`, `flex-flow`, `flex-grow`, `flex-shrink`, `flex-wrap`, `float`, `float-defer`, `float-offset`, `float-reference`, `flood-color`, `flood-opacity`, `flow`, `flow-from`, `flow-into`, `font`, `font-family`, `font-feature-settings`, `font-kerning`, `font-language-override`, `font-size`, `font-size-adjust`, `font-stretch`, `font-style`, `font-synthesis`, `font-variant`, `font-variant-alternates`, `font-variant-caps`, `font-variant-east-asian`, `font-variant-ligatures`, `font-variant-numeric`, `font-variant-position`, `font-weight`, `footnote-display`, `footnote-policy`, `glyph-orientation-vertical`, `grid`, `grid-area`, `grid-auto-columns`, `grid-auto-flow`, `grid-auto-rows`, `grid-column`, `grid-column-end`, `grid-column-gap`, `grid-column-start`, `grid-gap`, `grid-row`, `grid-row-end`, `grid-row-gap`, `grid-row-start`, `grid-template`, `grid-template-areas`, `grid-template-columns`, `grid-template-rows`, `hanging-punctuation`, `height`, `hyphenate-character`, `hyphenate-limit-chars`, `hyphenate-limit-last`, `hyphenate-limit-lines`, `hyphenate-limit-zone`, `hyphens`, `image-orientation`, `image-resolution`, `initial-letter`, `initial-letter-align`, `initial-letter-wrap`, `isolation`, `justify-content`, `justify-items`, `justify-self`, `left`, `letter-spacing`, `lighting-color`, `line-break`, `line-grid`, `line-height`, `line-snap`, `list-style`, `list-style-image`, `list-style-position`, `list-style-type`, `margin`, `margin-bottom`, `margin-left`, `margin-right`, `margin-top`, `marker-side`, `marquee-direction`, `marquee-loop`, `marquee-speed`, `marquee-style`, `mask`, `mask-border`, `mask-border-mode`, `mask-border-outset`, `mask-border-repeat`, `mask-border-slice`, `mask-border-source`, `mask-border-width`, `mask-clip`, `mask-composite`, `mask-image`, `mask-mode`, `mask-origin`, `mask-position`, `mask-repeat`, `mask-size`, `mask-type`, `max-height`, `max-lines`, `max-width`, `min-height`, `min-width`, `mix-blend-mode`, `motion`, `motion-offset`, `motion-path`, `motion-rotation`, `move-to`, `nav-down`, `nav-left`, `nav-right`, `nav-up`, `object-fit`, `object-position`, `offset-after`, `offset-before`, `offset-end`, `offset-start`, `opacity`, `order`, `orphans`, `outline`, `outline-color`, `outline-offset`, `outline-style`, `outline-width`, `overflow`, `overflow-style`, `overflow-wrap`, `overflow-x`, `overflow-y`, `padding`, `padding-bottom`, `padding-left`, `padding-right`, `padding-top`, `page`, `page-break-after`, `page-break-before`, `page-break-inside`, `page-policy`, `pause`, `pause-after`, `pause-before`, `perspective`, `perspective-origin`, `pitch`, `pitch-range`, `play-during`, `polar-angle`, `polar-distance`, `position`, `presentation-level`, `quotes`, `region-fragment`, `resize`, `rest`, `rest-after`, `rest-before`, `richness`, `right`, `rotation`, `rotation-point`, `ruby-align`, `ruby-merge`, `ruby-position`, `running`, `scroll-snap-coordinate`, `scroll-snap-destination`, `scroll-snap-points-x`, `scroll-snap-points-y`, `scroll-snap-type`, `shape-image-threshold`, `shape-inside`, `shape-margin`, `shape-outside`, `size`, `speak`, `speak-as`, `speak-header`, `speak-numeral`, `speak-punctuation`, `speech-rate`, `stress`, `string-set`, `tab-size`, `table-layout`, `text-align`, `text-align-last`, `text-combine-upright`, `text-decoration`, `text-decoration-color`, `text-decoration-line`, `text-decoration-skip`, `text-decoration-style`, `text-emphasis`, `text-emphasis-color`, `text-emphasis-position`, `text-emphasis-style`, `text-indent`, `text-justify`, `text-orientation`, `text-overflow`, `text-shadow`, `text-space-collapse`, `text-space-trim`, `text-spacing`, `text-transform`, `text-underline-position`, `text-wrap`, `top`, `transform`, `transform-origin`, `transform-style`, `transition`, `transition-delay`, `transition-duration`, `transition-property`, `transition-timing-function`, `unicode-bidi`, `user-select`, `vertical-align`, `visibility`, `voice-balance`, `voice-duration`, `voice-family`, `voice-pitch`, `voice-range`, `voice-rate`, `voice-stress`, `voice-volume`, `volume`, `white-space`, `widows`, `width`, `will-change`, `word-break`, `word-spacing`, `word-wrap`, `wrap-after`, `wrap-before`, `wrap-flow`, `wrap-inside`, `wrap-through`, `writing-mode`, `z-index`, `above`, `absolute`, `always`, `armenian`, `aural`, `auto`, `avoid`, `baseline`, `behind`, `below`, `bidi-override`, `blink`, `block`, `bold`, `bolder`, `both`, `capitalize`, `center-left`, `center-right`, `center`, `circle`, `cjk-ideographic`, `close-quote`, `collapse`, `condensed`, `continuous`, `crop`, `crosshair`, `cross`, `cursive`, `dashed`, `decimal-leading-zero`, `decimal`, `default`, `digits`, `disc`, `dotted`, `double`, `e-resize`, `embed`, `extra-condensed`, `extra-expanded`, `expanded`, `fantasy`, `far-left`, `far-right`, `faster`, `fast`, `fixed`, `georgian`, `groove`, `hebrew`, `help`, `hidden`, `hide`, `higher`, `high`, `hiragana-iroha`, `hiragana`, `icon`, `inherit`, `inline-table`, `inline`, `inset`, `inside`, `invert`, `italic`, `justify`, `katakana-iroha`, `katakana`, `landscape`, `larger`, `large`, `left-side`, `leftwards`, `level`, `lighter`, `line-through`, `list-item`, `loud`, `lower-alpha`, `lower-greek`, `lower-roman`, `lowercase`, `ltr`, `lower`, `low`, `medium`, `message-box`, `middle`, `mix`, `monospace`, `n-resize`, `narrower`, `ne-resize`, `no-close-quote`, `no-open-quote`, `no-repeat`, `none`, `normal`, `nowrap`, `nw-resize`, `oblique`, `once`, `open-quote`, `outset`, `outside`, `overline`, `pointer`, `portrait`, `px`, `relative`, `repeat-x`, `repeat-y`, `repeat`, `rgb`, `ridge`, `right-side`, `rightwards`, `s-resize`, `sans-serif`, `scroll`, `se-resize`, `semi-condensed`, `semi-expanded`, `separate`, `serif`, `show`, `silent`, `slow`, `slower`, `small-caps`, `small-caption`, `smaller`, `soft`, `solid`, `spell-out`, `square`, `static`, `status-bar`, `super`, `sw-resize`, `table-caption`, `table-cell`, `table-column`, `table-column-group`, `table-footer-group`, `table-header-group`, `table-row`, `table-row-group`, `text`, `text-bottom`, `text-top`, `thick`, `thin`, `transparent`, `ultra-condensed`, `ultra-expanded`, `underline`, `upper-alpha`, `upper-latin`, `upper-roman`, `uppercase`, `url`, `visible`, `w-resize`, `wait`, `wider`, `x-fast`, `x-high`, `x-large`, `x-loud`, `x-low`, `x-small`, `x-soft`, `xx-large`, `xx-small`, `yes`), NameConstant, nil}, + {Words(``, `\b`, `aliceblue`, `antiquewhite`, `aqua`, `aquamarine`, `azure`, `beige`, `bisque`, `black`, `blanchedalmond`, `blue`, `blueviolet`, `brown`, `burlywood`, `cadetblue`, `chartreuse`, `chocolate`, `coral`, `cornflowerblue`, `cornsilk`, `crimson`, `cyan`, `darkblue`, `darkcyan`, `darkgoldenrod`, `darkgray`, `darkgreen`, `darkgrey`, `darkkhaki`, `darkmagenta`, `darkolivegreen`, `darkorange`, `darkorchid`, `darkred`, `darksalmon`, `darkseagreen`, `darkslateblue`, `darkslategray`, `darkslategrey`, `darkturquoise`, `darkviolet`, `deeppink`, `deepskyblue`, `dimgray`, `dimgrey`, `dodgerblue`, `firebrick`, `floralwhite`, `forestgreen`, `fuchsia`, `gainsboro`, `ghostwhite`, `gold`, `goldenrod`, `gray`, `green`, `greenyellow`, `grey`, `honeydew`, `hotpink`, `indianred`, `indigo`, `ivory`, `khaki`, `lavender`, `lavenderblush`, `lawngreen`, `lemonchiffon`, `lightblue`, `lightcoral`, `lightcyan`, `lightgoldenrodyellow`, `lightgray`, `lightgreen`, `lightgrey`, `lightpink`, `lightsalmon`, `lightseagreen`, `lightskyblue`, `lightslategray`, `lightslategrey`, `lightsteelblue`, `lightyellow`, `lime`, `limegreen`, `linen`, `magenta`, `maroon`, `mediumaquamarine`, `mediumblue`, `mediumorchid`, `mediumpurple`, `mediumseagreen`, `mediumslateblue`, `mediumspringgreen`, `mediumturquoise`, `mediumvioletred`, `midnightblue`, `mintcream`, `mistyrose`, `moccasin`, `navajowhite`, `navy`, `oldlace`, `olive`, `olivedrab`, `orange`, `orangered`, `orchid`, `palegoldenrod`, `palegreen`, `paleturquoise`, `palevioletred`, `papayawhip`, `peachpuff`, `peru`, `pink`, `plum`, `powderblue`, `purple`, `rebeccapurple`, `red`, `rosybrown`, `royalblue`, `saddlebrown`, `salmon`, `sandybrown`, `seagreen`, `seashell`, `sienna`, `silver`, `skyblue`, `slateblue`, `slategray`, `slategrey`, `snow`, `springgreen`, `steelblue`, `tan`, `teal`, `thistle`, `tomato`, `turquoise`, `violet`, `wheat`, `white`, `whitesmoke`, `yellow`, `yellowgreen`, `transparent`), NameEntity, nil}, + {Words(``, `\b`, `black`, `silver`, `gray`, `white`, `maroon`, `red`, `purple`, `fuchsia`, `green`, `lime`, `olive`, `yellow`, `navy`, `blue`, `teal`, `aqua`), NameBuiltin, nil}, + {`\!(important|default)`, NameException, nil}, + {`(true|false)`, NamePseudo, nil}, + {`(and|or|not)`, OperatorWord, nil}, + {`/\*`, CommentMultiline, Push("inline-comment")}, + {`//[^\n]*`, CommentSingle, nil}, + {`\#[a-z0-9]{1,6}`, LiteralNumberHex, nil}, + {`(-?\d+)(\%|[a-z]+)?`, ByGroups(LiteralNumberInteger, KeywordType), nil}, + {`(-?\d*\.\d+)(\%|[a-z]+)?`, ByGroups(LiteralNumberFloat, KeywordType), nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`[~^*!&%<>|+=@:,./?-]+`, Operator, nil}, + {`[\[\]()]+`, Punctuation, nil}, + {`"`, LiteralStringDouble, Push("string-double")}, + {`'`, LiteralStringSingle, Push("string-single")}, + {`[a-z_-][\w-]*`, Name, nil}, + {`\n`, Text, Push("root")}, + }, + "interpolation": { + {`\}`, LiteralStringInterpol, Pop(1)}, + Include("value"), + }, + "selector": { + {`[ \t]+`, Text, nil}, + {`\:`, NameDecorator, Push("pseudo-class")}, + {`\.`, NameClass, Push("class")}, + {`\#`, NameNamespace, Push("id")}, + {`[\w-]+`, NameTag, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`&`, Keyword, nil}, + {`[~^*!&\[\]()<>|+=@:;,./?-]`, Operator, nil}, + {`"`, LiteralStringDouble, Push("string-double")}, + {`'`, LiteralStringSingle, Push("string-single")}, + {`\n`, Text, Push("root")}, + }, + "string-double": { + {`(\\.|#(?=[^\n{])|[^\n"#])+`, LiteralStringDouble, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + "string-single": { + {`(\\.|#(?=[^\n{])|[^\n'#])+`, LiteralStringSingle, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`'`, LiteralStringSingle, Pop(1)}, + }, + "string-url": { + {`(\\#|#(?=[^\n{])|[^\n#)])+`, LiteralStringOther, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`\)`, LiteralStringOther, Pop(1)}, + }, + "pseudo-class": { + {`[\w-]+`, NameDecorator, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + Default(Pop(1)), + }, + "class": { + {`[\w-]+`, NameClass, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + Default(Pop(1)), + }, + "id": { + {`[\w-]+`, NameNamespace, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + Default(Pop(1)), + }, + "for": { + {`(from|to|through)`, OperatorWord, nil}, + Include("value"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/scala.go b/vendor/github.com/alecthomas/chroma/lexers/s/scala.go new file mode 100644 index 000000000..20932de24 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/scala.go @@ -0,0 +1,112 @@ +package s + +import ( + "fmt" + + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +var ( + scalaOp = "[-~\\^\\*!%&\\\\<>\\|+=:/?@\xa6-\xa7\xa9\xac\xae\xb0-\xb1\xb6\xd7\xf7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+" + scalaUpper = "[A-Z\\$_\xc0-\xd6\xd8-\xde\u0100\u0102\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038f\u0391-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0531-\u0556\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59-\u1f5f\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67\u2c69\u2c6b\u2c6d-\u2c6f\u2c72\u2c75\u2c80\u2c82\u2c84\u2c86\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\ua640\ua642\ua644\ua646\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a\ua65c\ua65e\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]" + scalaLetter = `[a-zA-Z\\$_ªµºÀ-ÖØ-öø-ʯͰ-ͳͶ-ͷͻ-ͽΆΈ-ϵϷ-ҁҊ-Ֆա-ևא-ײء-ؿف-يٮ-ٯٱ-ۓەۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪऄ-हऽॐक़-ॡॲ-ॿঅ-হঽৎড়-ৡৰ-ৱਅ-ਹਖ਼-ਫ਼ੲ-ੴઅ-હઽૐ-ૡଅ-ହଽଡ଼-ୡୱஃ-ஹௐఅ-ఽౘ-ౡಅ-ಹಽೞ-ೡഅ-ഽൠ-ൡൺ-ൿඅ-ෆก-ะา-ำเ-ๅກ-ະາ-ຳຽ-ໄໜ-ༀཀ-ཬྈ-ྋက-ဪဿၐ-ၕၚ-ၝၡၥ-ၦၮ-ၰၵ-ႁႎႠ-ჺᄀ-ፚᎀ-ᎏᎠ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᛮ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝰក-ឳៜᠠ-ᡂᡄ-ᢨᢪ-ᤜᥐ-ᦩᧁ-ᧇᨀ-ᨖᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮ-ᮯᰀ-ᰣᱍ-ᱏᱚ-ᱷᴀ-ᴫᵢ-ᵷᵹ-ᶚḀ-ᾼιῂ-ῌῐ-Ίῠ-Ῥῲ-ῼⁱⁿℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⱼⲀ-ⳤⴀ-ⵥⶀ-ⷞ〆-〇〡-〩〸-〺〼ぁ-ゖゟァ-ヺヿ-ㆎㆠ-ㆷㇰ-ㇿ㐀-䶵一-ꀔꀖ-ꒌꔀ-ꘋꘐ-ꘟꘪ-ꙮꚀ-ꚗꜢ-ꝯꝱ-ꞇꞋ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꤊ-ꤥꤰ-ꥆꨀ-ꨨꩀ-ꩂꩄ-ꩋ가-힣豈-יִײַ-ﬨשׁ-ﴽﵐ-ﷻﹰ-ﻼA-Za-zヲ-ッア-ンᅠ-ᅵ]` + scalaIDRest = fmt.Sprintf(`%s(?:%s|[0-9])*(?:(?<=_)%s)?`, scalaLetter, scalaLetter, scalaOp) +) + +// Scala lexer. +var Scala = internal.Register(MustNewLexer( + &Config{ + Name: "Scala", + Aliases: []string{"scala"}, + Filenames: []string{"*.scala"}, + MimeTypes: []string{"text/x-scala"}, + DotAll: true, + }, + Rules{ + "root": { + {`(class|trait|object)(\s+)`, ByGroups(Keyword, Text), Push("class")}, + {`[^\S\n]+`, Text, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/\*`, CommentMultiline, Push("comment")}, + {`@` + scalaIDRest, NameDecorator, nil}, + {`(abstract|ca(?:se|tch)|d(?:ef|o)|e(?:lse|xtends)|f(?:inal(?:ly)?|or(?:Some)?)|i(?:f|mplicit)|lazy|match|new|override|pr(?:ivate|otected)|re(?:quires|turn)|s(?:ealed|uper)|t(?:h(?:is|row)|ry)|va[lr]|w(?:hile|ith)|yield)\b|(<[%:-]|=>|>:|[#=@_⇒←])(\b|(?=\s)|$)`, Keyword, nil}, + {`:(?!` + scalaOp + `%s)`, Keyword, Push("type")}, + {fmt.Sprintf("%s%s\\b", scalaUpper, scalaIDRest), NameClass, nil}, + {`(true|false|null)\b`, KeywordConstant, nil}, + {`(import|package)(\s+)`, ByGroups(Keyword, Text), Push("import")}, + {`(type)(\s+)`, ByGroups(Keyword, Text), Push("type")}, + {`""".*?"""(?!")`, LiteralString, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'`, LiteralStringChar, nil}, + {"'" + scalaIDRest, TextSymbol, nil}, + {`[fs]"""`, LiteralString, Push("interptriplestring")}, + {`[fs]"`, LiteralString, Push("interpstring")}, + {`raw"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {scalaIDRest, Name, nil}, + {"`[^`]+`", Name, nil}, + {`\[`, Operator, Push("typeparam")}, + {`[(){};,.#]`, Operator, nil}, + {scalaOp, Operator, nil}, + {`([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?`, LiteralNumberFloat, nil}, + {`0x[0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`[0-9]+L?`, LiteralNumberInteger, nil}, + {`\n`, Text, nil}, + }, + "class": { + {fmt.Sprintf("(%s|%s|`[^`]+`)(\\s*)(\\[)", scalaIDRest, scalaOp), ByGroups(NameClass, Text, Operator), Push("typeparam")}, + {`\s+`, Text, nil}, + {`\{`, Operator, Pop(1)}, + {`\(`, Operator, Pop(1)}, + {`//.*?\n`, CommentSingle, Pop(1)}, + {fmt.Sprintf("%s|%s|`[^`]+`", scalaIDRest, scalaOp), NameClass, Pop(1)}, + }, + "type": { + {`\s+`, Text, nil}, + {`<[%:]|>:|[#_]|forSome|type`, Keyword, nil}, + {`([,);}]|=>|=|⇒)(\s*)`, ByGroups(Operator, Text), Pop(1)}, + {`[({]`, Operator, Push()}, + {fmt.Sprintf("((?:%s|%s|`[^`]+`)(?:\\.(?:%s|%s|`[^`]+`))*)(\\s*)(\\[)", scalaIDRest, scalaOp, scalaIDRest, scalaOp), ByGroups(KeywordType, Text, Operator), Push("#pop", "typeparam")}, + {fmt.Sprintf("((?:%s|%s|`[^`]+`)(?:\\.(?:%s|%s|`[^`]+`))*)(\\s*)$", scalaIDRest, scalaOp, scalaIDRest, scalaOp), ByGroups(KeywordType, Text), Pop(1)}, + {`//.*?\n`, CommentSingle, Pop(1)}, + {fmt.Sprintf("\\.|%s|%s|`[^`]+`", scalaIDRest, scalaOp), KeywordType, nil}, + }, + "typeparam": { + {`[\s,]+`, Text, nil}, + {`<[%:]|=>|>:|[#_⇒]|forSome|type`, Keyword, nil}, + {`([\])}])`, Operator, Pop(1)}, + {`[(\[{]`, Operator, Push()}, + {fmt.Sprintf("\\.|%s|%s|`[^`]+`", scalaIDRest, scalaOp), KeywordType, nil}, + }, + "comment": { + {`[^/*]+`, CommentMultiline, nil}, + {`/\*`, CommentMultiline, Push()}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[*/]`, CommentMultiline, nil}, + }, + "import": { + {fmt.Sprintf("(%s|\\.)+", scalaIDRest), NameNamespace, Pop(1)}, + }, + "interpstringcommon": { + {`[^"$\\]+`, LiteralString, nil}, + {`\$\$`, LiteralString, nil}, + {`\$` + scalaLetter + `(?:` + scalaLetter + `|\d)*`, LiteralStringInterpol, nil}, + {`\$\{`, LiteralStringInterpol, Push("interpbrace")}, + {`\\.`, LiteralString, nil}, + }, + "interptriplestring": { + {`"""(?!")`, LiteralString, Pop(1)}, + {`"`, LiteralString, nil}, + Include("interpstringcommon"), + }, + "interpstring": { + {`"`, LiteralString, Pop(1)}, + Include("interpstringcommon"), + }, + "interpbrace": { + {`\}`, LiteralStringInterpol, Pop(1)}, + {`\{`, LiteralStringInterpol, Push()}, + Include("root"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/scheme.go b/vendor/github.com/alecthomas/chroma/lexers/s/scheme.go new file mode 100644 index 000000000..b721d68d3 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/scheme.go @@ -0,0 +1,53 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// nolint + +// Scheme lexer. +var SchemeLang = internal.Register(MustNewLexer( + &Config{ + Name: "Scheme", + Aliases: []string{"scheme", "scm"}, + Filenames: []string{"*.scm", "*.ss"}, + MimeTypes: []string{"text/x-scheme", "application/x-scheme"}, + }, + Rules{ + "root": { + {`;.*$`, CommentSingle, nil}, + {`#\|`, CommentMultiline, Push("multiline-comment")}, + {`#;\s*\(`, Comment, Push("commented-form")}, + {`#!r6rs`, Comment, nil}, + {`\s+`, Text, nil}, + {`-?\d+\.\d+`, LiteralNumberFloat, nil}, + {`-?\d+`, LiteralNumberInteger, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`'[\w!$%&*+,/:<=>?@^~|-]+`, LiteralStringSymbol, nil}, + {`#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)`, LiteralStringChar, nil}, + {`(#t|#f)`, NameConstant, nil}, + {"('|#|`|,@|,|\\.)", Operator, nil}, + {`(lambda |define |if |else |cond |and |or |case |let |let\* |letrec |begin |do |delay |set\! |\=\> |quote |quasiquote |unquote |unquote\-splicing |define\-syntax |let\-syntax |letrec\-syntax |syntax\-rules )`, Keyword, nil}, + {`(?<='\()[\w!$%&*+,/:<=>?@^~|-]+`, NameVariable, nil}, + {`(?<=#\()[\w!$%&*+,/:<=>?@^~|-]+`, NameVariable, nil}, + {`(?<=\()(\* |\+ |\- |\/ |\< |\<\= |\= |\> |\>\= |abs |acos |angle |append |apply |asin |assoc |assq |assv |atan |boolean\? |caaaar |caaadr |caaar |caadar |caaddr |caadr |caar |cadaar |cadadr |cadar |caddar |cadddr |caddr |cadr |call\-with\-current\-continuation |call\-with\-input\-file |call\-with\-output\-file |call\-with\-values |call\/cc |car |cdaaar |cdaadr |cdaar |cdadar |cdaddr |cdadr |cdar |cddaar |cddadr |cddar |cdddar |cddddr |cdddr |cddr |cdr |ceiling |char\-\>integer |char\-alphabetic\? |char\-ci\<\=\? |char\-ci\<\? |char\-ci\=\? |char\-ci\>\=\? |char\-ci\>\? |char\-downcase |char\-lower\-case\? |char\-numeric\? |char\-ready\? |char\-upcase |char\-upper\-case\? |char\-whitespace\? |char\<\=\? |char\<\? |char\=\? |char\>\=\? |char\>\? |char\? |close\-input\-port |close\-output\-port |complex\? |cons |cos |current\-input\-port |current\-output\-port |denominator |display |dynamic\-wind |eof\-object\? |eq\? |equal\? |eqv\? |eval |even\? |exact\-\>inexact |exact\? |exp |expt |floor |for\-each |force |gcd |imag\-part |inexact\-\>exact |inexact\? |input\-port\? |integer\-\>char |integer\? |interaction\-environment |lcm |length |list |list\-\>string |list\-\>vector |list\-ref |list\-tail |list\? |load |log |magnitude |make\-polar |make\-rectangular |make\-string |make\-vector |map |max |member |memq |memv |min |modulo |negative\? |newline |not |null\-environment |null\? |number\-\>string |number\? |numerator |odd\? |open\-input\-file |open\-output\-file |output\-port\? |pair\? |peek\-char |port\? |positive\? |procedure\? |quotient |rational\? |rationalize |read |read\-char |real\-part |real\? |remainder |reverse |round |scheme\-report\-environment |set\-car\! |set\-cdr\! |sin |sqrt |string |string\-\>list |string\-\>number |string\-\>symbol |string\-append |string\-ci\<\=\? |string\-ci\<\? |string\-ci\=\? |string\-ci\>\=\? |string\-ci\>\? |string\-copy |string\-fill\! |string\-length |string\-ref |string\-set\! |string\<\=\? |string\<\? |string\=\? |string\>\=\? |string\>\? |string\? |substring |symbol\-\>string |symbol\? |tan |transcript\-off |transcript\-on |truncate |values |vector |vector\-\>list |vector\-fill\! |vector\-length |vector\-ref |vector\-set\! |vector\? |with\-input\-from\-file |with\-output\-to\-file |write |write\-char |zero\? )`, NameBuiltin, nil}, + {`(?<=\()[\w!$%&*+,/:<=>?@^~|-]+`, NameFunction, nil}, + {`[\w!$%&*+,/:<=>?@^~|-]+`, NameVariable, nil}, + {`(\(|\))`, Punctuation, nil}, + {`(\[|\])`, Punctuation, nil}, + }, + "multiline-comment": { + {`#\|`, CommentMultiline, Push()}, + {`\|#`, CommentMultiline, Pop(1)}, + {`[^|#]+`, CommentMultiline, nil}, + {`[|#]`, CommentMultiline, nil}, + }, + "commented-form": { + {`\(`, Comment, Push()}, + {`\)`, Comment, Pop(1)}, + {`[^()]+`, Comment, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/scilab.go b/vendor/github.com/alecthomas/chroma/lexers/s/scilab.go new file mode 100644 index 000000000..87fa66cc0 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/scilab.go @@ -0,0 +1,44 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Scilab lexer. +var Scilab = internal.Register(MustNewLexer( + &Config{ + Name: "Scilab", + Aliases: []string{"scilab"}, + Filenames: []string{"*.sci", "*.sce", "*.tst"}, + MimeTypes: []string{"text/scilab"}, + }, + Rules{ + "root": { + {`//.*?$`, CommentSingle, nil}, + {`^\s*function`, Keyword, Push("deffunc")}, + {Words(``, `\b`, `__FILE__`, `__LINE__`, `break`, `case`, `catch`, `classdef`, `continue`, `do`, `else`, `elseif`, `end`, `end_try_catch`, `end_unwind_protect`, `endclassdef`, `endevents`, `endfor`, `endfunction`, `endif`, `endmethods`, `endproperties`, `endswitch`, `endwhile`, `events`, `for`, `function`, `get`, `global`, `if`, `methods`, `otherwise`, `persistent`, `properties`, `return`, `set`, `static`, `switch`, `try`, `until`, `unwind_protect`, `unwind_protect_cleanup`, `while`), Keyword, nil}, + {Words(``, `\b`, `!!_invoke_`, `%H5Object_e`, `%H5Object_fieldnames`, `%H5Object_p`, `%XMLAttr_6`, `%XMLAttr_e`, `%XMLAttr_i_XMLElem`, `%XMLAttr_length`, `%XMLAttr_p`, `%XMLAttr_size`, `%XMLDoc_6`, `%XMLDoc_e`, `%XMLDoc_i_XMLList`, `%XMLDoc_p`, `%XMLElem_6`, `%XMLElem_e`, `%XMLElem_i_XMLDoc`, `%XMLElem_i_XMLElem`, `%XMLElem_i_XMLList`, `%XMLElem_p`, `%XMLList_6`, `%XMLList_e`, `%XMLList_i_XMLElem`, `%XMLList_i_XMLList`, `%XMLList_length`, `%XMLList_p`, `%XMLList_size`, `%XMLNs_6`, `%XMLNs_e`, `%XMLNs_i_XMLElem`, `%XMLNs_p`, `%XMLSet_6`, `%XMLSet_e`, `%XMLSet_length`, `%XMLSet_p`, `%XMLSet_size`, `%XMLValid_p`, `%_EClass_6`, `%_EClass_e`, `%_EClass_p`, `%_EObj_0`, `%_EObj_1__EObj`, `%_EObj_1_b`, `%_EObj_1_c`, `%_EObj_1_i`, `%_EObj_1_s`, `%_EObj_2__EObj`, `%_EObj_2_b`, `%_EObj_2_c`, `%_EObj_2_i`, `%_EObj_2_s`, `%_EObj_3__EObj`, `%_EObj_3_b`, `%_EObj_3_c`, `%_EObj_3_i`, `%_EObj_3_s`, `%_EObj_4__EObj`, `%_EObj_4_b`, `%_EObj_4_c`, `%_EObj_4_i`, `%_EObj_4_s`, `%_EObj_5`, `%_EObj_6`, `%_EObj_a__EObj`, `%_EObj_a_b`, `%_EObj_a_c`, `%_EObj_a_i`, `%_EObj_a_s`, `%_EObj_d__EObj`, `%_EObj_d_b`, `%_EObj_d_c`, `%_EObj_d_i`, `%_EObj_d_s`, `%_EObj_disp`, `%_EObj_e`, `%_EObj_g__EObj`, `%_EObj_g_b`, `%_EObj_g_c`, `%_EObj_g_i`, `%_EObj_g_s`, `%_EObj_h__EObj`, `%_EObj_h_b`, `%_EObj_h_c`, `%_EObj_h_i`, `%_EObj_h_s`, `%_EObj_i__EObj`, `%_EObj_j__EObj`, `%_EObj_j_b`, `%_EObj_j_c`, `%_EObj_j_i`, `%_EObj_j_s`, `%_EObj_k__EObj`, `%_EObj_k_b`, `%_EObj_k_c`, `%_EObj_k_i`, `%_EObj_k_s`, `%_EObj_l__EObj`, `%_EObj_l_b`, `%_EObj_l_c`, `%_EObj_l_i`, `%_EObj_l_s`, `%_EObj_m__EObj`, `%_EObj_m_b`, `%_EObj_m_c`, `%_EObj_m_i`, `%_EObj_m_s`, `%_EObj_n__EObj`, `%_EObj_n_b`, `%_EObj_n_c`, `%_EObj_n_i`, `%_EObj_n_s`, `%_EObj_o__EObj`, `%_EObj_o_b`, `%_EObj_o_c`, `%_EObj_o_i`, `%_EObj_o_s`, `%_EObj_p`, `%_EObj_p__EObj`, `%_EObj_p_b`, `%_EObj_p_c`, `%_EObj_p_i`, `%_EObj_p_s`, `%_EObj_q__EObj`, `%_EObj_q_b`, `%_EObj_q_c`, `%_EObj_q_i`, `%_EObj_q_s`, `%_EObj_r__EObj`, `%_EObj_r_b`, `%_EObj_r_c`, `%_EObj_r_i`, `%_EObj_r_s`, `%_EObj_s__EObj`, `%_EObj_s_b`, `%_EObj_s_c`, `%_EObj_s_i`, `%_EObj_s_s`, `%_EObj_t`, `%_EObj_x__EObj`, `%_EObj_x_b`, `%_EObj_x_c`, `%_EObj_x_i`, `%_EObj_x_s`, `%_EObj_y__EObj`, `%_EObj_y_b`, `%_EObj_y_c`, `%_EObj_y_i`, `%_EObj_y_s`, `%_EObj_z__EObj`, `%_EObj_z_b`, `%_EObj_z_c`, `%_EObj_z_i`, `%_EObj_z_s`, `%_eigs`, `%_load`, `%b_1__EObj`, `%b_2__EObj`, `%b_3__EObj`, `%b_4__EObj`, `%b_a__EObj`, `%b_d__EObj`, `%b_g__EObj`, `%b_h__EObj`, `%b_i_XMLList`, `%b_i__EObj`, `%b_j__EObj`, `%b_k__EObj`, `%b_l__EObj`, `%b_m__EObj`, `%b_n__EObj`, `%b_o__EObj`, `%b_p__EObj`, `%b_q__EObj`, `%b_r__EObj`, `%b_s__EObj`, `%b_x__EObj`, `%b_y__EObj`, `%b_z__EObj`, `%c_1__EObj`, `%c_2__EObj`, `%c_3__EObj`, `%c_4__EObj`, `%c_a__EObj`, `%c_d__EObj`, `%c_g__EObj`, `%c_h__EObj`, `%c_i_XMLAttr`, `%c_i_XMLDoc`, `%c_i_XMLElem`, `%c_i_XMLList`, `%c_i__EObj`, `%c_j__EObj`, `%c_k__EObj`, `%c_l__EObj`, `%c_m__EObj`, `%c_n__EObj`, `%c_o__EObj`, `%c_p__EObj`, `%c_q__EObj`, `%c_r__EObj`, `%c_s__EObj`, `%c_x__EObj`, `%c_y__EObj`, `%c_z__EObj`, `%ce_i_XMLList`, `%fptr_i_XMLList`, `%h_i_XMLList`, `%hm_i_XMLList`, `%i_1__EObj`, `%i_2__EObj`, `%i_3__EObj`, `%i_4__EObj`, `%i_a__EObj`, `%i_abs`, `%i_cumprod`, `%i_cumsum`, `%i_d__EObj`, `%i_diag`, `%i_g__EObj`, `%i_h__EObj`, `%i_i_XMLList`, `%i_i__EObj`, `%i_j__EObj`, `%i_k__EObj`, `%i_l__EObj`, `%i_m__EObj`, `%i_matrix`, `%i_max`, `%i_maxi`, `%i_min`, `%i_mini`, `%i_mput`, `%i_n__EObj`, `%i_o__EObj`, `%i_p`, `%i_p__EObj`, `%i_prod`, `%i_q__EObj`, `%i_r__EObj`, `%i_s__EObj`, `%i_sum`, `%i_tril`, `%i_triu`, `%i_x__EObj`, `%i_y__EObj`, `%i_z__EObj`, `%ip_i_XMLList`, `%l_i_XMLList`, `%l_i__EObj`, `%lss_i_XMLList`, `%mc_i_XMLList`, `%msp_full`, `%msp_i_XMLList`, `%msp_spget`, `%p_i_XMLList`, `%ptr_i_XMLList`, `%r_i_XMLList`, `%s_1__EObj`, `%s_2__EObj`, `%s_3__EObj`, `%s_4__EObj`, `%s_a__EObj`, `%s_d__EObj`, `%s_g__EObj`, `%s_h__EObj`, `%s_i_XMLList`, `%s_i__EObj`, `%s_j__EObj`, `%s_k__EObj`, `%s_l__EObj`, `%s_m__EObj`, `%s_n__EObj`, `%s_o__EObj`, `%s_p__EObj`, `%s_q__EObj`, `%s_r__EObj`, `%s_s__EObj`, `%s_x__EObj`, `%s_y__EObj`, `%s_z__EObj`, `%sp_i_XMLList`, `%spb_i_XMLList`, `%st_i_XMLList`, `Calendar`, `ClipBoard`, `Matplot`, `Matplot1`, `PlaySound`, `TCL_DeleteInterp`, `TCL_DoOneEvent`, `TCL_EvalFile`, `TCL_EvalStr`, `TCL_ExistArray`, `TCL_ExistInterp`, `TCL_ExistVar`, `TCL_GetVar`, `TCL_GetVersion`, `TCL_SetVar`, `TCL_UnsetVar`, `TCL_UpVar`, `_`, `_code2str`, `_d`, `_str2code`, `about`, `abs`, `acos`, `addModulePreferences`, `addcolor`, `addf`, `addhistory`, `addinter`, `addlocalizationdomain`, `amell`, `and`, `argn`, `arl2_ius`, `ascii`, `asin`, `atan`, `backslash`, `balanc`, `banner`, `base2dec`, `basename`, `bdiag`, `beep`, `besselh`, `besseli`, `besselj`, `besselk`, `bessely`, `beta`, `bezout`, `bfinit`, `blkfc1i`, `blkslvi`, `bool2s`, `browsehistory`, `browsevar`, `bsplin3val`, `buildDoc`, `buildouttb`, `bvode`, `c_link`, `call`, `callblk`, `captions`, `cd`, `cdfbet`, `cdfbin`, `cdfchi`, `cdfchn`, `cdff`, `cdffnc`, `cdfgam`, `cdfnbn`, `cdfnor`, `cdfpoi`, `cdft`, `ceil`, `champ`, `champ1`, `chdir`, `chol`, `clc`, `clean`, `clear`, `clearfun`, `clearglobal`, `closeEditor`, `closeEditvar`, `closeXcos`, `code2str`, `coeff`, `color`, `comp`, `completion`, `conj`, `contour2di`, `contr`, `conv2`, `convstr`, `copy`, `copyfile`, `corr`, `cos`, `coserror`, `createdir`, `cshep2d`, `csvDefault`, `csvIsnum`, `csvRead`, `csvStringToDouble`, `csvTextScan`, `csvWrite`, `ctree2`, `ctree3`, `ctree4`, `cumprod`, `cumsum`, `curblock`, `curblockc`, `daskr`, `dasrt`, `dassl`, `data2sig`, `datatipCreate`, `datatipManagerMode`, `datatipMove`, `datatipRemove`, `datatipSetDisplay`, `datatipSetInterp`, `datatipSetOrientation`, `datatipSetStyle`, `datatipToggle`, `dawson`, `dct`, `debug`, `dec2base`, `deff`, `definedfields`, `degree`, `delbpt`, `delete`, `deletefile`, `delip`, `delmenu`, `det`, `dgettext`, `dhinf`, `diag`, `diary`, `diffobjs`, `disp`, `dispbpt`, `displayhistory`, `disposefftwlibrary`, `dlgamma`, `dnaupd`, `dneupd`, `double`, `drawaxis`, `drawlater`, `drawnow`, `driver`, `dsaupd`, `dsearch`, `dseupd`, `dst`, `duplicate`, `editvar`, `emptystr`, `end_scicosim`, `ereduc`, `erf`, `erfc`, `erfcx`, `erfi`, `errcatch`, `errclear`, `error`, `eval_cshep2d`, `exec`, `execstr`, `exists`, `exit`, `exp`, `expm`, `exportUI`, `export_to_hdf5`, `eye`, `fadj2sp`, `fec`, `feval`, `fft`, `fftw`, `fftw_flags`, `fftw_forget_wisdom`, `fftwlibraryisloaded`, `figure`, `file`, `filebrowser`, `fileext`, `fileinfo`, `fileparts`, `filesep`, `find`, `findBD`, `findfiles`, `fire_closing_finished`, `floor`, `format`, `fort`, `fprintfMat`, `freq`, `frexp`, `fromc`, `fromjava`, `fscanfMat`, `fsolve`, `fstair`, `full`, `fullpath`, `funcprot`, `funptr`, `gamma`, `gammaln`, `geom3d`, `get`, `getURL`, `get_absolute_file_path`, `get_fftw_wisdom`, `getblocklabel`, `getcallbackobject`, `getdate`, `getdebuginfo`, `getdefaultlanguage`, `getdrives`, `getdynlibext`, `getenv`, `getfield`, `gethistory`, `gethistoryfile`, `getinstalledlookandfeels`, `getio`, `getlanguage`, `getlongpathname`, `getlookandfeel`, `getmd5`, `getmemory`, `getmodules`, `getos`, `getpid`, `getrelativefilename`, `getscicosvars`, `getscilabmode`, `getshortpathname`, `gettext`, `getvariablesonstack`, `getversion`, `glist`, `global`, `glue`, `grand`, `graphicfunction`, `grayplot`, `grep`, `gsort`, `gstacksize`, `h5attr`, `h5close`, `h5cp`, `h5dataset`, `h5dump`, `h5exists`, `h5flush`, `h5get`, `h5group`, `h5isArray`, `h5isAttr`, `h5isCompound`, `h5isFile`, `h5isGroup`, `h5isList`, `h5isRef`, `h5isSet`, `h5isSpace`, `h5isType`, `h5isVlen`, `h5label`, `h5ln`, `h5ls`, `h5mount`, `h5mv`, `h5open`, `h5read`, `h5readattr`, `h5rm`, `h5umount`, `h5write`, `h5writeattr`, `havewindow`, `helpbrowser`, `hess`, `hinf`, `historymanager`, `historysize`, `host`, `htmlDump`, `htmlRead`, `htmlReadStr`, `htmlWrite`, `iconvert`, `ieee`, `ilib_verbose`, `imag`, `impl`, `import_from_hdf5`, `imult`, `inpnvi`, `int`, `int16`, `int2d`, `int32`, `int3d`, `int8`, `interp`, `interp2d`, `interp3d`, `intg`, `intppty`, `inttype`, `inv`, `invoke_lu`, `is_handle_valid`, `is_hdf5_file`, `isalphanum`, `isascii`, `isdef`, `isdigit`, `isdir`, `isequal`, `isequalbitwise`, `iserror`, `isfile`, `isglobal`, `isletter`, `isnum`, `isreal`, `iswaitingforinput`, `jallowClassReloading`, `jarray`, `jautoTranspose`, `jautoUnwrap`, `javaclasspath`, `javalibrarypath`, `jcast`, `jcompile`, `jconvMatrixMethod`, `jcreatejar`, `jdeff`, `jdisableTrace`, `jenableTrace`, `jexists`, `jgetclassname`, `jgetfield`, `jgetfields`, `jgetinfo`, `jgetmethods`, `jimport`, `jinvoke`, `jinvoke_db`, `jnewInstance`, `jremove`, `jsetfield`, `junwrap`, `junwraprem`, `jwrap`, `jwrapinfloat`, `kron`, `lasterror`, `ldiv`, `ldivf`, `legendre`, `length`, `lib`, `librarieslist`, `libraryinfo`, `light`, `linear_interpn`, `lines`, `link`, `linmeq`, `list`, `listvar_in_hdf5`, `load`, `loadGui`, `loadScicos`, `loadXcos`, `loadfftwlibrary`, `loadhistory`, `log`, `log1p`, `lsq`, `lsq_splin`, `lsqrsolve`, `lsslist`, `lstcat`, `lstsize`, `ltitr`, `lu`, `ludel`, `lufact`, `luget`, `lusolve`, `macr2lst`, `macr2tree`, `matfile_close`, `matfile_listvar`, `matfile_open`, `matfile_varreadnext`, `matfile_varwrite`, `matrix`, `max`, `maxfiles`, `mclearerr`, `mclose`, `meof`, `merror`, `messagebox`, `mfprintf`, `mfscanf`, `mget`, `mgeti`, `mgetl`, `mgetstr`, `min`, `mlist`, `mode`, `model2blk`, `mopen`, `move`, `movefile`, `mprintf`, `mput`, `mputl`, `mputstr`, `mscanf`, `mseek`, `msprintf`, `msscanf`, `mtell`, `mtlb_mode`, `mtlb_sparse`, `mucomp`, `mulf`, `name2rgb`, `nearfloat`, `newaxes`, `newest`, `newfun`, `nnz`, `norm`, `notify`, `number_properties`, `ode`, `odedc`, `ones`, `openged`, `opentk`, `optim`, `or`, `ordmmd`, `parallel_concurrency`, `parallel_run`, `param3d`, `param3d1`, `part`, `pathconvert`, `pathsep`, `phase_simulation`, `plot2d`, `plot2d1`, `plot2d2`, `plot2d3`, `plot2d4`, `plot3d`, `plot3d1`, `plotbrowser`, `pointer_xproperty`, `poly`, `ppol`, `pppdiv`, `predef`, `preferences`, `print`, `printf`, `printfigure`, `printsetupbox`, `prod`, `progressionbar`, `prompt`, `pwd`, `qld`, `qp_solve`, `qr`, `raise_window`, `rand`, `rankqr`, `rat`, `rcond`, `rdivf`, `read`, `read4b`, `read_csv`, `readb`, `readgateway`, `readmps`, `real`, `realtime`, `realtimeinit`, `regexp`, `relocate_handle`, `remez`, `removeModulePreferences`, `removedir`, `removelinehistory`, `res_with_prec`, `resethistory`, `residu`, `resume`, `return`, `ricc`, `rlist`, `roots`, `rotate_axes`, `round`, `rpem`, `rtitr`, `rubberbox`, `save`, `saveGui`, `saveafterncommands`, `saveconsecutivecommands`, `savehistory`, `schur`, `sci_haltscicos`, `sci_tree2`, `sci_tree3`, `sci_tree4`, `sciargs`, `scicos_debug`, `scicos_debug_count`, `scicos_time`, `scicosim`, `scinotes`, `sctree`, `semidef`, `set`, `set_blockerror`, `set_fftw_wisdom`, `set_xproperty`, `setbpt`, `setdefaultlanguage`, `setenv`, `setfield`, `sethistoryfile`, `setlanguage`, `setlookandfeel`, `setmenu`, `sfact`, `sfinit`, `show_window`, `sident`, `sig2data`, `sign`, `simp`, `simp_mode`, `sin`, `size`, `slash`, `sleep`, `sorder`, `sparse`, `spchol`, `spcompack`, `spec`, `spget`, `splin`, `splin2d`, `splin3d`, `splitURL`, `spones`, `sprintf`, `sqrt`, `stacksize`, `str2code`, `strcat`, `strchr`, `strcmp`, `strcspn`, `strindex`, `string`, `stringbox`, `stripblanks`, `strncpy`, `strrchr`, `strrev`, `strsplit`, `strspn`, `strstr`, `strsubst`, `strtod`, `strtok`, `subf`, `sum`, `svd`, `swap_handles`, `symfcti`, `syredi`, `system_getproperty`, `system_setproperty`, `ta2lpd`, `tan`, `taucs_chdel`, `taucs_chfact`, `taucs_chget`, `taucs_chinfo`, `taucs_chsolve`, `tempname`, `testmatrix`, `timer`, `tlist`, `tohome`, `tokens`, `toolbar`, `toprint`, `tr_zer`, `tril`, `triu`, `type`, `typename`, `uiDisplayTree`, `uicontextmenu`, `uicontrol`, `uigetcolor`, `uigetdir`, `uigetfile`, `uigetfont`, `uimenu`, `uint16`, `uint32`, `uint8`, `uipopup`, `uiputfile`, `uiwait`, `ulink`, `umf_ludel`, `umf_lufact`, `umf_luget`, `umf_luinfo`, `umf_lusolve`, `umfpack`, `unglue`, `unix`, `unsetmenu`, `unzoom`, `updatebrowsevar`, `usecanvas`, `useeditor`, `user`, `var2vec`, `varn`, `vec2var`, `waitbar`, `warnBlockByUID`, `warning`, `what`, `where`, `whereis`, `who`, `winsid`, `with_module`, `writb`, `write`, `write4b`, `write_csv`, `x_choose`, `x_choose_modeless`, `x_dialog`, `x_mdialog`, `xarc`, `xarcs`, `xarrows`, `xchange`, `xchoicesi`, `xclick`, `xcos`, `xcosAddToolsMenu`, `xcosConfigureXmlFile`, `xcosDiagramToScilab`, `xcosPalCategoryAdd`, `xcosPalDelete`, `xcosPalDisable`, `xcosPalEnable`, `xcosPalGenerateIcon`, `xcosPalGet`, `xcosPalLoad`, `xcosPalMove`, `xcosSimulationStarted`, `xcosUpdateBlock`, `xdel`, `xend`, `xfarc`, `xfarcs`, `xfpoly`, `xfpolys`, `xfrect`, `xget`, `xgetmouse`, `xgraduate`, `xgrid`, `xinit`, `xlfont`, `xls_open`, `xls_read`, `xmlAddNs`, `xmlAppend`, `xmlAsNumber`, `xmlAsText`, `xmlDTD`, `xmlDelete`, `xmlDocument`, `xmlDump`, `xmlElement`, `xmlFormat`, `xmlGetNsByHref`, `xmlGetNsByPrefix`, `xmlGetOpenDocs`, `xmlIsValidObject`, `xmlName`, `xmlNs`, `xmlRead`, `xmlReadStr`, `xmlRelaxNG`, `xmlRemove`, `xmlSchema`, `xmlSetAttributes`, `xmlValidate`, `xmlWrite`, `xmlXPath`, `xname`, `xpause`, `xpoly`, `xpolys`, `xrect`, `xrects`, `xs2bmp`, `xs2emf`, `xs2eps`, `xs2gif`, `xs2jpg`, `xs2pdf`, `xs2png`, `xs2ppm`, `xs2ps`, `xs2svg`, `xsegs`, `xset`, `xstring`, `xstringb`, `xtitle`, `zeros`, `znaupd`, `zneupd`, `zoom_rect`, `abort`, `apropos`, `break`, `case`, `catch`, `continue`, `do`, `else`, `elseif`, `end`, `endfunction`, `for`, `function`, `help`, `if`, `pause`, `quit`, `select`, `then`, `try`, `while`, `!_deff_wrapper`, `%0_i_st`, `%3d_i_h`, `%Block_xcosUpdateBlock`, `%TNELDER_p`, `%TNELDER_string`, `%TNMPLOT_p`, `%TNMPLOT_string`, `%TOPTIM_p`, `%TOPTIM_string`, `%TSIMPLEX_p`, `%TSIMPLEX_string`, `%_EVoid_p`, `%_gsort`, `%_listvarinfile`, `%_rlist`, `%_save`, `%_sodload`, `%_strsplit`, `%_unwrap`, `%ar_p`, `%asn`, `%b_a_b`, `%b_a_s`, `%b_c_s`, `%b_c_spb`, `%b_cumprod`, `%b_cumsum`, `%b_d_s`, `%b_diag`, `%b_e`, `%b_f_s`, `%b_f_spb`, `%b_g_s`, `%b_g_spb`, `%b_grand`, `%b_h_s`, `%b_h_spb`, `%b_i_b`, `%b_i_ce`, `%b_i_h`, `%b_i_hm`, `%b_i_s`, `%b_i_sp`, `%b_i_spb`, `%b_i_st`, `%b_iconvert`, `%b_l_b`, `%b_l_s`, `%b_m_b`, `%b_m_s`, `%b_matrix`, `%b_n_hm`, `%b_o_hm`, `%b_p_s`, `%b_prod`, `%b_r_b`, `%b_r_s`, `%b_s_b`, `%b_s_s`, `%b_string`, `%b_sum`, `%b_tril`, `%b_triu`, `%b_x_b`, `%b_x_s`, `%bicg`, `%bicgstab`, `%c_a_c`, `%c_b_c`, `%c_b_s`, `%c_diag`, `%c_dsearch`, `%c_e`, `%c_eye`, `%c_f_s`, `%c_grand`, `%c_i_c`, `%c_i_ce`, `%c_i_h`, `%c_i_hm`, `%c_i_lss`, `%c_i_r`, `%c_i_s`, `%c_i_st`, `%c_matrix`, `%c_n_l`, `%c_n_st`, `%c_o_l`, `%c_o_st`, `%c_ones`, `%c_rand`, `%c_tril`, `%c_triu`, `%cblock_c_cblock`, `%cblock_c_s`, `%cblock_e`, `%cblock_f_cblock`, `%cblock_p`, `%cblock_size`, `%ce_6`, `%ce_c_ce`, `%ce_e`, `%ce_f_ce`, `%ce_i_ce`, `%ce_i_s`, `%ce_i_st`, `%ce_matrix`, `%ce_p`, `%ce_size`, `%ce_string`, `%ce_t`, `%cgs`, `%champdat_i_h`, `%choose`, `%diagram_xcos`, `%dir_p`, `%fptr_i_st`, `%grand_perm`, `%grayplot_i_h`, `%h_i_st`, `%hmS_k_hmS_generic`, `%hm_1_hm`, `%hm_1_s`, `%hm_2_hm`, `%hm_2_s`, `%hm_3_hm`, `%hm_3_s`, `%hm_4_hm`, `%hm_4_s`, `%hm_5`, `%hm_a_hm`, `%hm_a_r`, `%hm_a_s`, `%hm_abs`, `%hm_and`, `%hm_bool2s`, `%hm_c_hm`, `%hm_ceil`, `%hm_conj`, `%hm_cos`, `%hm_cumprod`, `%hm_cumsum`, `%hm_d_hm`, `%hm_d_s`, `%hm_degree`, `%hm_dsearch`, `%hm_e`, `%hm_exp`, `%hm_eye`, `%hm_f_hm`, `%hm_find`, `%hm_floor`, `%hm_g_hm`, `%hm_grand`, `%hm_gsort`, `%hm_h_hm`, `%hm_i_b`, `%hm_i_ce`, `%hm_i_h`, `%hm_i_hm`, `%hm_i_i`, `%hm_i_p`, `%hm_i_r`, `%hm_i_s`, `%hm_i_st`, `%hm_iconvert`, `%hm_imag`, `%hm_int`, `%hm_isnan`, `%hm_isreal`, `%hm_j_hm`, `%hm_j_s`, `%hm_k_hm`, `%hm_k_s`, `%hm_log`, `%hm_m_p`, `%hm_m_r`, `%hm_m_s`, `%hm_matrix`, `%hm_max`, `%hm_mean`, `%hm_median`, `%hm_min`, `%hm_n_b`, `%hm_n_c`, `%hm_n_hm`, `%hm_n_i`, `%hm_n_p`, `%hm_n_s`, `%hm_o_b`, `%hm_o_c`, `%hm_o_hm`, `%hm_o_i`, `%hm_o_p`, `%hm_o_s`, `%hm_ones`, `%hm_or`, `%hm_p`, `%hm_prod`, `%hm_q_hm`, `%hm_r_s`, `%hm_rand`, `%hm_real`, `%hm_round`, `%hm_s`, `%hm_s_hm`, `%hm_s_r`, `%hm_s_s`, `%hm_sign`, `%hm_sin`, `%hm_size`, `%hm_sqrt`, `%hm_stdev`, `%hm_string`, `%hm_sum`, `%hm_x_hm`, `%hm_x_p`, `%hm_x_s`, `%hm_zeros`, `%i_1_s`, `%i_2_s`, `%i_3_s`, `%i_4_s`, `%i_Matplot`, `%i_a_i`, `%i_a_s`, `%i_and`, `%i_ascii`, `%i_b_s`, `%i_bezout`, `%i_champ`, `%i_champ1`, `%i_contour`, `%i_contour2d`, `%i_d_i`, `%i_d_s`, `%i_dsearch`, `%i_e`, `%i_fft`, `%i_g_i`, `%i_gcd`, `%i_grand`, `%i_h_i`, `%i_i_ce`, `%i_i_h`, `%i_i_hm`, `%i_i_i`, `%i_i_s`, `%i_i_st`, `%i_j_i`, `%i_j_s`, `%i_l_s`, `%i_lcm`, `%i_length`, `%i_m_i`, `%i_m_s`, `%i_mfprintf`, `%i_mprintf`, `%i_msprintf`, `%i_n_s`, `%i_o_s`, `%i_or`, `%i_p_i`, `%i_p_s`, `%i_plot2d`, `%i_plot2d1`, `%i_plot2d2`, `%i_q_s`, `%i_r_i`, `%i_r_s`, `%i_round`, `%i_s_i`, `%i_s_s`, `%i_sign`, `%i_string`, `%i_x_i`, `%i_x_s`, `%ip_a_s`, `%ip_i_st`, `%ip_m_s`, `%ip_n_ip`, `%ip_o_ip`, `%ip_p`, `%ip_part`, `%ip_s_s`, `%ip_string`, `%k`, `%l_i_h`, `%l_i_s`, `%l_i_st`, `%l_isequal`, `%l_n_c`, `%l_n_l`, `%l_n_m`, `%l_n_p`, `%l_n_s`, `%l_n_st`, `%l_o_c`, `%l_o_l`, `%l_o_m`, `%l_o_p`, `%l_o_s`, `%l_o_st`, `%lss_a_lss`, `%lss_a_p`, `%lss_a_r`, `%lss_a_s`, `%lss_c_lss`, `%lss_c_p`, `%lss_c_r`, `%lss_c_s`, `%lss_e`, `%lss_eye`, `%lss_f_lss`, `%lss_f_p`, `%lss_f_r`, `%lss_f_s`, `%lss_i_ce`, `%lss_i_lss`, `%lss_i_p`, `%lss_i_r`, `%lss_i_s`, `%lss_i_st`, `%lss_inv`, `%lss_l_lss`, `%lss_l_p`, `%lss_l_r`, `%lss_l_s`, `%lss_m_lss`, `%lss_m_p`, `%lss_m_r`, `%lss_m_s`, `%lss_n_lss`, `%lss_n_p`, `%lss_n_r`, `%lss_n_s`, `%lss_norm`, `%lss_o_lss`, `%lss_o_p`, `%lss_o_r`, `%lss_o_s`, `%lss_ones`, `%lss_r_lss`, `%lss_r_p`, `%lss_r_r`, `%lss_r_s`, `%lss_rand`, `%lss_s`, `%lss_s_lss`, `%lss_s_p`, `%lss_s_r`, `%lss_s_s`, `%lss_size`, `%lss_t`, `%lss_v_lss`, `%lss_v_p`, `%lss_v_r`, `%lss_v_s`, `%lt_i_s`, `%m_n_l`, `%m_o_l`, `%mc_i_h`, `%mc_i_s`, `%mc_i_st`, `%mc_n_st`, `%mc_o_st`, `%mc_string`, `%mps_p`, `%mps_string`, `%msp_a_s`, `%msp_abs`, `%msp_e`, `%msp_find`, `%msp_i_s`, `%msp_i_st`, `%msp_length`, `%msp_m_s`, `%msp_maxi`, `%msp_n_msp`, `%msp_nnz`, `%msp_o_msp`, `%msp_p`, `%msp_sparse`, `%msp_spones`, `%msp_t`, `%p_a_lss`, `%p_a_r`, `%p_c_lss`, `%p_c_r`, `%p_cumprod`, `%p_cumsum`, `%p_d_p`, `%p_d_r`, `%p_d_s`, `%p_det`, `%p_e`, `%p_f_lss`, `%p_f_r`, `%p_grand`, `%p_i_ce`, `%p_i_h`, `%p_i_hm`, `%p_i_lss`, `%p_i_p`, `%p_i_r`, `%p_i_s`, `%p_i_st`, `%p_inv`, `%p_j_s`, `%p_k_p`, `%p_k_r`, `%p_k_s`, `%p_l_lss`, `%p_l_p`, `%p_l_r`, `%p_l_s`, `%p_m_hm`, `%p_m_lss`, `%p_m_r`, `%p_matrix`, `%p_n_l`, `%p_n_lss`, `%p_n_r`, `%p_o_l`, `%p_o_lss`, `%p_o_r`, `%p_o_sp`, `%p_p_s`, `%p_part`, `%p_prod`, `%p_q_p`, `%p_q_r`, `%p_q_s`, `%p_r_lss`, `%p_r_p`, `%p_r_r`, `%p_r_s`, `%p_s_lss`, `%p_s_r`, `%p_simp`, `%p_string`, `%p_sum`, `%p_v_lss`, `%p_v_p`, `%p_v_r`, `%p_v_s`, `%p_x_hm`, `%p_x_r`, `%p_y_p`, `%p_y_r`, `%p_y_s`, `%p_z_p`, `%p_z_r`, `%p_z_s`, `%pcg`, `%plist_p`, `%plist_string`, `%r_0`, `%r_a_hm`, `%r_a_lss`, `%r_a_p`, `%r_a_r`, `%r_a_s`, `%r_c_lss`, `%r_c_p`, `%r_c_r`, `%r_c_s`, `%r_clean`, `%r_cumprod`, `%r_cumsum`, `%r_d_p`, `%r_d_r`, `%r_d_s`, `%r_det`, `%r_diag`, `%r_e`, `%r_eye`, `%r_f_lss`, `%r_f_p`, `%r_f_r`, `%r_f_s`, `%r_i_ce`, `%r_i_hm`, `%r_i_lss`, `%r_i_p`, `%r_i_r`, `%r_i_s`, `%r_i_st`, `%r_inv`, `%r_j_s`, `%r_k_p`, `%r_k_r`, `%r_k_s`, `%r_l_lss`, `%r_l_p`, `%r_l_r`, `%r_l_s`, `%r_m_hm`, `%r_m_lss`, `%r_m_p`, `%r_m_r`, `%r_m_s`, `%r_matrix`, `%r_n_lss`, `%r_n_p`, `%r_n_r`, `%r_n_s`, `%r_norm`, `%r_o_lss`, `%r_o_p`, `%r_o_r`, `%r_o_s`, `%r_ones`, `%r_p`, `%r_p_s`, `%r_prod`, `%r_q_p`, `%r_q_r`, `%r_q_s`, `%r_r_lss`, `%r_r_p`, `%r_r_r`, `%r_r_s`, `%r_rand`, `%r_s`, `%r_s_hm`, `%r_s_lss`, `%r_s_p`, `%r_s_r`, `%r_s_s`, `%r_simp`, `%r_size`, `%r_string`, `%r_sum`, `%r_t`, `%r_tril`, `%r_triu`, `%r_v_lss`, `%r_v_p`, `%r_v_r`, `%r_v_s`, `%r_varn`, `%r_x_p`, `%r_x_r`, `%r_x_s`, `%r_y_p`, `%r_y_r`, `%r_y_s`, `%r_z_p`, `%r_z_r`, `%r_z_s`, `%s_1_hm`, `%s_1_i`, `%s_2_hm`, `%s_2_i`, `%s_3_hm`, `%s_3_i`, `%s_4_hm`, `%s_4_i`, `%s_5`, `%s_a_b`, `%s_a_hm`, `%s_a_i`, `%s_a_ip`, `%s_a_lss`, `%s_a_msp`, `%s_a_r`, `%s_a_sp`, `%s_and`, `%s_b_i`, `%s_b_s`, `%s_bezout`, `%s_c_b`, `%s_c_cblock`, `%s_c_lss`, `%s_c_r`, `%s_c_sp`, `%s_d_b`, `%s_d_i`, `%s_d_p`, `%s_d_r`, `%s_d_sp`, `%s_e`, `%s_f_b`, `%s_f_cblock`, `%s_f_lss`, `%s_f_r`, `%s_f_sp`, `%s_g_b`, `%s_g_s`, `%s_gcd`, `%s_grand`, `%s_h_b`, `%s_h_s`, `%s_i_b`, `%s_i_c`, `%s_i_ce`, `%s_i_h`, `%s_i_hm`, `%s_i_i`, `%s_i_lss`, `%s_i_p`, `%s_i_r`, `%s_i_s`, `%s_i_sp`, `%s_i_spb`, `%s_i_st`, `%s_j_i`, `%s_k_hm`, `%s_k_p`, `%s_k_r`, `%s_k_sp`, `%s_l_b`, `%s_l_hm`, `%s_l_i`, `%s_l_lss`, `%s_l_p`, `%s_l_r`, `%s_l_s`, `%s_l_sp`, `%s_lcm`, `%s_m_b`, `%s_m_hm`, `%s_m_i`, `%s_m_ip`, `%s_m_lss`, `%s_m_msp`, `%s_m_r`, `%s_matrix`, `%s_n_hm`, `%s_n_i`, `%s_n_l`, `%s_n_lss`, `%s_n_r`, `%s_n_st`, `%s_o_hm`, `%s_o_i`, `%s_o_l`, `%s_o_lss`, `%s_o_r`, `%s_o_st`, `%s_or`, `%s_p_b`, `%s_p_i`, `%s_pow`, `%s_q_hm`, `%s_q_i`, `%s_q_p`, `%s_q_r`, `%s_q_sp`, `%s_r_b`, `%s_r_i`, `%s_r_lss`, `%s_r_p`, `%s_r_r`, `%s_r_s`, `%s_r_sp`, `%s_s_b`, `%s_s_hm`, `%s_s_i`, `%s_s_ip`, `%s_s_lss`, `%s_s_r`, `%s_s_sp`, `%s_simp`, `%s_v_lss`, `%s_v_p`, `%s_v_r`, `%s_v_s`, `%s_x_b`, `%s_x_hm`, `%s_x_i`, `%s_x_r`, `%s_y_p`, `%s_y_r`, `%s_y_sp`, `%s_z_p`, `%s_z_r`, `%s_z_sp`, `%sn`, `%sp_a_s`, `%sp_a_sp`, `%sp_and`, `%sp_c_s`, `%sp_ceil`, `%sp_conj`, `%sp_cos`, `%sp_cumprod`, `%sp_cumsum`, `%sp_d_s`, `%sp_d_sp`, `%sp_det`, `%sp_diag`, `%sp_e`, `%sp_exp`, `%sp_f_s`, `%sp_floor`, `%sp_grand`, `%sp_gsort`, `%sp_i_ce`, `%sp_i_h`, `%sp_i_s`, `%sp_i_sp`, `%sp_i_st`, `%sp_int`, `%sp_inv`, `%sp_k_s`, `%sp_k_sp`, `%sp_l_s`, `%sp_l_sp`, `%sp_length`, `%sp_max`, `%sp_min`, `%sp_norm`, `%sp_or`, `%sp_p_s`, `%sp_prod`, `%sp_q_s`, `%sp_q_sp`, `%sp_r_s`, `%sp_r_sp`, `%sp_round`, `%sp_s_s`, `%sp_s_sp`, `%sp_sin`, `%sp_sqrt`, `%sp_string`, `%sp_sum`, `%sp_tril`, `%sp_triu`, `%sp_y_s`, `%sp_y_sp`, `%sp_z_s`, `%sp_z_sp`, `%spb_and`, `%spb_c_b`, `%spb_cumprod`, `%spb_cumsum`, `%spb_diag`, `%spb_e`, `%spb_f_b`, `%spb_g_b`, `%spb_g_spb`, `%spb_h_b`, `%spb_h_spb`, `%spb_i_b`, `%spb_i_ce`, `%spb_i_h`, `%spb_i_st`, `%spb_or`, `%spb_prod`, `%spb_sum`, `%spb_tril`, `%spb_triu`, `%st_6`, `%st_c_st`, `%st_e`, `%st_f_st`, `%st_i_b`, `%st_i_c`, `%st_i_fptr`, `%st_i_h`, `%st_i_i`, `%st_i_ip`, `%st_i_lss`, `%st_i_msp`, `%st_i_p`, `%st_i_r`, `%st_i_s`, `%st_i_sp`, `%st_i_spb`, `%st_i_st`, `%st_matrix`, `%st_n_c`, `%st_n_l`, `%st_n_mc`, `%st_n_p`, `%st_n_s`, `%st_o_c`, `%st_o_l`, `%st_o_mc`, `%st_o_p`, `%st_o_s`, `%st_o_tl`, `%st_p`, `%st_size`, `%st_string`, `%st_t`, `%ticks_i_h`, `%xls_e`, `%xls_p`, `%xlssheet_e`, `%xlssheet_p`, `%xlssheet_size`, `%xlssheet_string`, `DominationRank`, `G_make`, `IsAScalar`, `NDcost`, `OS_Version`, `PlotSparse`, `ReadHBSparse`, `TCL_CreateSlave`, `abcd`, `abinv`, `accept_func_default`, `accept_func_vfsa`, `acf`, `acosd`, `acosh`, `acoshm`, `acosm`, `acot`, `acotd`, `acoth`, `acsc`, `acscd`, `acsch`, `add_demo`, `add_help_chapter`, `add_module_help_chapter`, `add_param`, `add_profiling`, `adj2sp`, `aff2ab`, `ana_style`, `analpf`, `analyze`, `aplat`, `arhnk`, `arl2`, `arma2p`, `arma2ss`, `armac`, `armax`, `armax1`, `arobasestring2strings`, `arsimul`, `ascii2string`, `asciimat`, `asec`, `asecd`, `asech`, `asind`, `asinh`, `asinhm`, `asinm`, `assert_checkalmostequal`, `assert_checkequal`, `assert_checkerror`, `assert_checkfalse`, `assert_checkfilesequal`, `assert_checktrue`, `assert_comparecomplex`, `assert_computedigits`, `assert_cond2reltol`, `assert_cond2reqdigits`, `assert_generror`, `atand`, `atanh`, `atanhm`, `atanm`, `atomsAutoload`, `atomsAutoloadAdd`, `atomsAutoloadDel`, `atomsAutoloadList`, `atomsCategoryList`, `atomsCheckModule`, `atomsDepTreeShow`, `atomsGetConfig`, `atomsGetInstalled`, `atomsGetInstalledPath`, `atomsGetLoaded`, `atomsGetLoadedPath`, `atomsInstall`, `atomsIsInstalled`, `atomsIsLoaded`, `atomsList`, `atomsLoad`, `atomsQuit`, `atomsRemove`, `atomsRepositoryAdd`, `atomsRepositoryDel`, `atomsRepositoryList`, `atomsRestoreConfig`, `atomsSaveConfig`, `atomsSearch`, `atomsSetConfig`, `atomsShow`, `atomsSystemInit`, `atomsSystemUpdate`, `atomsTest`, `atomsUpdate`, `atomsVersion`, `augment`, `auread`, `auwrite`, `balreal`, `bench_run`, `bilin`, `bilt`, `bin2dec`, `binomial`, `bitand`, `bitcmp`, `bitget`, `bitor`, `bitset`, `bitxor`, `black`, `blanks`, `bloc2exp`, `bloc2ss`, `block_parameter_error`, `bode`, `bode_asymp`, `bstap`, `buttmag`, `bvodeS`, `bytecode`, `bytecodewalk`, `cainv`, `calendar`, `calerf`, `calfrq`, `canon`, `casc`, `cat`, `cat_code`, `cb_m2sci_gui`, `ccontrg`, `cell`, `cell2mat`, `cellstr`, `center`, `cepstrum`, `cfspec`, `char`, `chart`, `cheb1mag`, `cheb2mag`, `check_gateways`, `check_modules_xml`, `check_versions`, `chepol`, `chfact`, `chsolve`, `classmarkov`, `clean_help`, `clock`, `cls2dls`, `cmb_lin`, `cmndred`, `cmoment`, `coding_ga_binary`, `coding_ga_identity`, `coff`, `coffg`, `colcomp`, `colcompr`, `colinout`, `colregul`, `companion`, `complex`, `compute_initial_temp`, `cond`, `cond2sp`, `condestsp`, `configure_msifort`, `configure_msvc`, `conjgrad`, `cont_frm`, `cont_mat`, `contrss`, `conv`, `convert_to_float`, `convertindex`, `convol`, `convol2d`, `copfac`, `correl`, `cosd`, `cosh`, `coshm`, `cosm`, `cotd`, `cotg`, `coth`, `cothm`, `cov`, `covar`, `createXConfiguration`, `createfun`, `createstruct`, `cross`, `crossover_ga_binary`, `crossover_ga_default`, `csc`, `cscd`, `csch`, `csgn`, `csim`, `cspect`, `ctr_gram`, `czt`, `dae`, `daeoptions`, `damp`, `datafit`, `date`, `datenum`, `datevec`, `dbphi`, `dcf`, `ddp`, `dec2bin`, `dec2hex`, `dec2oct`, `del_help_chapter`, `del_module_help_chapter`, `demo_begin`, `demo_choose`, `demo_compiler`, `demo_end`, `demo_file_choice`, `demo_folder_choice`, `demo_function_choice`, `demo_gui`, `demo_run`, `demo_viewCode`, `denom`, `derivat`, `derivative`, `des2ss`, `des2tf`, `detectmsifort64tools`, `detectmsvc64tools`, `determ`, `detr`, `detrend`, `devtools_run_builder`, `dhnorm`, `diff`, `diophant`, `dir`, `dirname`, `dispfiles`, `dllinfo`, `dscr`, `dsimul`, `dt_ility`, `dtsi`, `edit`, `edit_error`, `editor`, `eigenmarkov`, `eigs`, `ell1mag`, `enlarge_shape`, `entropy`, `eomday`, `epred`, `eqfir`, `eqiir`, `equil`, `equil1`, `erfinv`, `etime`, `eval`, `evans`, `evstr`, `example_run`, `expression2code`, `extract_help_examples`, `factor`, `factorial`, `factors`, `faurre`, `ffilt`, `fft2`, `fftshift`, `fieldnames`, `filt_sinc`, `filter`, `findABCD`, `findAC`, `findBDK`, `findR`, `find_freq`, `find_links`, `find_scicos_version`, `findm`, `findmsifortcompiler`, `findmsvccompiler`, `findx0BD`, `firstnonsingleton`, `fix`, `fixedpointgcd`, `flipdim`, `flts`, `fminsearch`, `formatBlackTip`, `formatBodeMagTip`, `formatBodePhaseTip`, `formatGainplotTip`, `formatHallModuleTip`, `formatHallPhaseTip`, `formatNicholsGainTip`, `formatNicholsPhaseTip`, `formatNyquistTip`, `formatPhaseplotTip`, `formatSgridDampingTip`, `formatSgridFreqTip`, `formatZgridDampingTip`, `formatZgridFreqTip`, `format_txt`, `fourplan`, `frep2tf`, `freson`, `frfit`, `frmag`, `fseek_origin`, `fsfirlin`, `fspec`, `fspecg`, `fstabst`, `ftest`, `ftuneq`, `fullfile`, `fullrf`, `fullrfk`, `fun2string`, `g_margin`, `gainplot`, `gamitg`, `gcare`, `gcd`, `gencompilationflags_unix`, `generateBlockImage`, `generateBlockImages`, `generic_i_ce`, `generic_i_h`, `generic_i_hm`, `generic_i_s`, `generic_i_st`, `genlib`, `genmarkov`, `geomean`, `getDiagramVersion`, `getModelicaPath`, `getPreferencesValue`, `get_file_path`, `get_function_path`, `get_param`, `get_profile`, `get_scicos_version`, `getd`, `getscilabkeywords`, `getshell`, `gettklib`, `gfare`, `gfrancis`, `givens`, `glever`, `gmres`, `group`, `gschur`, `gspec`, `gtild`, `h2norm`, `h_cl`, `h_inf`, `h_inf_st`, `h_norm`, `hallchart`, `halt`, `hank`, `hankelsv`, `harmean`, `haveacompiler`, `head_comments`, `help_from_sci`, `help_skeleton`, `hermit`, `hex2dec`, `hilb`, `hilbert`, `histc`, `horner`, `householder`, `hrmt`, `htrianr`, `hypermat`, `idct`, `idst`, `ifft`, `ifftshift`, `iir`, `iirgroup`, `iirlp`, `iirmod`, `ilib_build`, `ilib_build_jar`, `ilib_compile`, `ilib_for_link`, `ilib_gen_Make`, `ilib_gen_Make_unix`, `ilib_gen_cleaner`, `ilib_gen_gateway`, `ilib_gen_loader`, `ilib_include_flag`, `ilib_mex_build`, `im_inv`, `importScicosDiagram`, `importScicosPal`, `importXcosDiagram`, `imrep2ss`, `ind2sub`, `inistate`, `init_ga_default`, `init_param`, `initial_scicos_tables`, `input`, `instruction2code`, `intc`, `intdec`, `integrate`, `interp1`, `interpln`, `intersect`, `intl`, `intsplin`, `inttrap`, `inv_coeff`, `invr`, `invrs`, `invsyslin`, `iqr`, `isLeapYear`, `is_absolute_path`, `is_param`, `iscell`, `iscellstr`, `iscolumn`, `isempty`, `isfield`, `isinf`, `ismatrix`, `isnan`, `isrow`, `isscalar`, `issparse`, `issquare`, `isstruct`, `isvector`, `jmat`, `justify`, `kalm`, `karmarkar`, `kernel`, `kpure`, `krac2`, `kroneck`, `lattn`, `lattp`, `launchtest`, `lcf`, `lcm`, `lcmdiag`, `leastsq`, `leqe`, `leqr`, `lev`, `levin`, `lex_sort`, `lft`, `lin`, `lin2mu`, `lincos`, `lindquist`, `linf`, `linfn`, `linsolve`, `linspace`, `list2vec`, `list_param`, `listfiles`, `listfunctions`, `listvarinfile`, `lmisolver`, `lmitool`, `loadXcosLibs`, `loadmatfile`, `loadwave`, `log10`, `log2`, `logm`, `logspace`, `lqe`, `lqg`, `lqg2stan`, `lqg_ltr`, `lqr`, `ls`, `lyap`, `m2sci_gui`, `m_circle`, `macglov`, `macrovar`, `mad`, `makecell`, `manedit`, `mapsound`, `markp2ss`, `matfile2sci`, `mdelete`, `mean`, `meanf`, `median`, `members`, `mese`, `meshgrid`, `mfft`, `mfile2sci`, `minreal`, `minss`, `mkdir`, `modulo`, `moment`, `mrfit`, `msd`, `mstr2sci`, `mtlb`, `mtlb_0`, `mtlb_a`, `mtlb_all`, `mtlb_any`, `mtlb_axes`, `mtlb_axis`, `mtlb_beta`, `mtlb_box`, `mtlb_choices`, `mtlb_close`, `mtlb_colordef`, `mtlb_cond`, `mtlb_cov`, `mtlb_cumprod`, `mtlb_cumsum`, `mtlb_dec2hex`, `mtlb_delete`, `mtlb_diag`, `mtlb_diff`, `mtlb_dir`, `mtlb_double`, `mtlb_e`, `mtlb_echo`, `mtlb_error`, `mtlb_eval`, `mtlb_exist`, `mtlb_eye`, `mtlb_false`, `mtlb_fft`, `mtlb_fftshift`, `mtlb_filter`, `mtlb_find`, `mtlb_findstr`, `mtlb_fliplr`, `mtlb_fopen`, `mtlb_format`, `mtlb_fprintf`, `mtlb_fread`, `mtlb_fscanf`, `mtlb_full`, `mtlb_fwrite`, `mtlb_get`, `mtlb_grid`, `mtlb_hold`, `mtlb_i`, `mtlb_ifft`, `mtlb_image`, `mtlb_imp`, `mtlb_int16`, `mtlb_int32`, `mtlb_int8`, `mtlb_is`, `mtlb_isa`, `mtlb_isfield`, `mtlb_isletter`, `mtlb_isspace`, `mtlb_l`, `mtlb_legendre`, `mtlb_linspace`, `mtlb_logic`, `mtlb_logical`, `mtlb_loglog`, `mtlb_lower`, `mtlb_max`, `mtlb_mean`, `mtlb_median`, `mtlb_mesh`, `mtlb_meshdom`, `mtlb_min`, `mtlb_more`, `mtlb_num2str`, `mtlb_ones`, `mtlb_pcolor`, `mtlb_plot`, `mtlb_prod`, `mtlb_qr`, `mtlb_qz`, `mtlb_rand`, `mtlb_randn`, `mtlb_rcond`, `mtlb_realmax`, `mtlb_realmin`, `mtlb_s`, `mtlb_semilogx`, `mtlb_semilogy`, `mtlb_setstr`, `mtlb_size`, `mtlb_sort`, `mtlb_sortrows`, `mtlb_sprintf`, `mtlb_sscanf`, `mtlb_std`, `mtlb_strcmp`, `mtlb_strcmpi`, `mtlb_strfind`, `mtlb_strrep`, `mtlb_subplot`, `mtlb_sum`, `mtlb_t`, `mtlb_toeplitz`, `mtlb_tril`, `mtlb_triu`, `mtlb_true`, `mtlb_type`, `mtlb_uint16`, `mtlb_uint32`, `mtlb_uint8`, `mtlb_upper`, `mtlb_var`, `mtlb_zeros`, `mu2lin`, `mutation_ga_binary`, `mutation_ga_default`, `mvcorrel`, `mvvacov`, `nancumsum`, `nand2mean`, `nanmax`, `nanmean`, `nanmeanf`, `nanmedian`, `nanmin`, `nanreglin`, `nanstdev`, `nansum`, `narsimul`, `ndgrid`, `ndims`, `nehari`, `neigh_func_csa`, `neigh_func_default`, `neigh_func_fsa`, `neigh_func_vfsa`, `neldermead_cget`, `neldermead_configure`, `neldermead_costf`, `neldermead_defaultoutput`, `neldermead_destroy`, `neldermead_function`, `neldermead_get`, `neldermead_log`, `neldermead_new`, `neldermead_restart`, `neldermead_search`, `neldermead_updatesimp`, `nextpow2`, `nfreq`, `nicholschart`, `nlev`, `nmplot_cget`, `nmplot_configure`, `nmplot_contour`, `nmplot_destroy`, `nmplot_function`, `nmplot_get`, `nmplot_historyplot`, `nmplot_log`, `nmplot_new`, `nmplot_outputcmd`, `nmplot_restart`, `nmplot_search`, `nmplot_simplexhistory`, `noisegen`, `nonreg_test_run`, `now`, `nthroot`, `null`, `num2cell`, `numderivative`, `numdiff`, `numer`, `nyquist`, `nyquistfrequencybounds`, `obs_gram`, `obscont`, `observer`, `obsv_mat`, `obsvss`, `oct2dec`, `odeoptions`, `optim_ga`, `optim_moga`, `optim_nsga`, `optim_nsga2`, `optim_sa`, `optimbase_cget`, `optimbase_checkbounds`, `optimbase_checkcostfun`, `optimbase_checkx0`, `optimbase_configure`, `optimbase_destroy`, `optimbase_function`, `optimbase_get`, `optimbase_hasbounds`, `optimbase_hasconstraints`, `optimbase_hasnlcons`, `optimbase_histget`, `optimbase_histset`, `optimbase_incriter`, `optimbase_isfeasible`, `optimbase_isinbounds`, `optimbase_isinnonlincons`, `optimbase_log`, `optimbase_logshutdown`, `optimbase_logstartup`, `optimbase_new`, `optimbase_outputcmd`, `optimbase_outstruct`, `optimbase_proj2bnds`, `optimbase_set`, `optimbase_stoplog`, `optimbase_terminate`, `optimget`, `optimplotfunccount`, `optimplotfval`, `optimplotx`, `optimset`, `optimsimplex_center`, `optimsimplex_check`, `optimsimplex_compsomefv`, `optimsimplex_computefv`, `optimsimplex_deltafv`, `optimsimplex_deltafvmax`, `optimsimplex_destroy`, `optimsimplex_dirmat`, `optimsimplex_fvmean`, `optimsimplex_fvstdev`, `optimsimplex_fvvariance`, `optimsimplex_getall`, `optimsimplex_getallfv`, `optimsimplex_getallx`, `optimsimplex_getfv`, `optimsimplex_getn`, `optimsimplex_getnbve`, `optimsimplex_getve`, `optimsimplex_getx`, `optimsimplex_gradientfv`, `optimsimplex_log`, `optimsimplex_new`, `optimsimplex_reflect`, `optimsimplex_setall`, `optimsimplex_setallfv`, `optimsimplex_setallx`, `optimsimplex_setfv`, `optimsimplex_setn`, `optimsimplex_setnbve`, `optimsimplex_setve`, `optimsimplex_setx`, `optimsimplex_shrink`, `optimsimplex_size`, `optimsimplex_sort`, `optimsimplex_xbar`, `orth`, `output_ga_default`, `output_moga_default`, `output_nsga2_default`, `output_nsga_default`, `p_margin`, `pack`, `pareto_filter`, `parrot`, `pbig`, `pca`, `pcg`, `pdiv`, `pen2ea`, `pencan`, `pencost`, `penlaur`, `perctl`, `perl`, `perms`, `permute`, `pertrans`, `pfactors`, `pfss`, `phasemag`, `phaseplot`, `phc`, `pinv`, `playsnd`, `plotprofile`, `plzr`, `pmodulo`, `pol2des`, `pol2str`, `polar`, `polfact`, `prbs_a`, `prettyprint`, `primes`, `princomp`, `profile`, `proj`, `projsl`, `projspec`, `psmall`, `pspect`, `qmr`, `qpsolve`, `quart`, `quaskro`, `rafiter`, `randpencil`, `range`, `rank`, `readxls`, `recompilefunction`, `recons`, `reglin`, `regress`, `remezb`, `remove_param`, `remove_profiling`, `repfreq`, `replace_Ix_by_Fx`, `repmat`, `reset_profiling`, `resize_matrix`, `returntoscilab`, `rhs2code`, `ric_desc`, `riccati`, `rmdir`, `routh_t`, `rowcomp`, `rowcompr`, `rowinout`, `rowregul`, `rowshuff`, `rref`, `sample`, `samplef`, `samwr`, `savematfile`, `savewave`, `scanf`, `sci2exp`, `sciGUI_init`, `sci_sparse`, `scicos_getvalue`, `scicos_simulate`, `scicos_workspace_init`, `scisptdemo`, `scitest`, `sdiff`, `sec`, `secd`, `sech`, `selection_ga_elitist`, `selection_ga_random`, `sensi`, `setPreferencesValue`, `set_param`, `setdiff`, `sgrid`, `show_margins`, `show_pca`, `showprofile`, `signm`, `sinc`, `sincd`, `sind`, `sinh`, `sinhm`, `sinm`, `sm2des`, `sm2ss`, `smga`, `smooth`, `solve`, `sound`, `soundsec`, `sp2adj`, `spaninter`, `spanplus`, `spantwo`, `specfact`, `speye`, `sprand`, `spzeros`, `sqroot`, `sqrtm`, `squarewave`, `squeeze`, `srfaur`, `srkf`, `ss2des`, `ss2ss`, `ss2tf`, `sskf`, `ssprint`, `ssrand`, `st_deviation`, `st_i_generic`, `st_ility`, `stabil`, `statgain`, `stdev`, `stdevf`, `steadycos`, `strange`, `strcmpi`, `struct`, `sub2ind`, `sva`, `svplot`, `sylm`, `sylv`, `sysconv`, `sysdiag`, `sysfact`, `syslin`, `syssize`, `system`, `systmat`, `tabul`, `tand`, `tanh`, `tanhm`, `tanm`, `tbx_build_blocks`, `tbx_build_cleaner`, `tbx_build_gateway`, `tbx_build_gateway_clean`, `tbx_build_gateway_loader`, `tbx_build_help`, `tbx_build_help_loader`, `tbx_build_loader`, `tbx_build_localization`, `tbx_build_macros`, `tbx_build_pal_loader`, `tbx_build_src`, `tbx_builder`, `tbx_builder_gateway`, `tbx_builder_gateway_lang`, `tbx_builder_help`, `tbx_builder_help_lang`, `tbx_builder_macros`, `tbx_builder_src`, `tbx_builder_src_lang`, `tbx_generate_pofile`, `temp_law_csa`, `temp_law_default`, `temp_law_fsa`, `temp_law_huang`, `temp_law_vfsa`, `test_clean`, `test_on_columns`, `test_run`, `test_run_level`, `testexamples`, `tf2des`, `tf2ss`, `thrownan`, `tic`, `time_id`, `toc`, `toeplitz`, `tokenpos`, `toolboxes`, `trace`, `trans`, `translatepaths`, `tree2code`, `trfmod`, `trianfml`, `trimmean`, `trisolve`, `trzeros`, `typeof`, `ui_observer`, `union`, `unique`, `unit_test_run`, `unix_g`, `unix_s`, `unix_w`, `unix_x`, `unobs`, `unpack`, `unwrap`, `variance`, `variancef`, `vec2list`, `vectorfind`, `ver`, `warnobsolete`, `wavread`, `wavwrite`, `wcenter`, `weekday`, `wfir`, `wfir_gui`, `whereami`, `who_user`, `whos`, `wiener`, `wigner`, `window`, `winlist`, `with_javasci`, `with_macros_source`, `with_modelica_compiler`, `with_tk`, `xcorr`, `xcosBlockEval`, `xcosBlockInterface`, `xcosCodeGeneration`, `xcosConfigureModelica`, `xcosPal`, `xcosPalAdd`, `xcosPalAddBlock`, `xcosPalExport`, `xcosPalGenerateAllIcons`, `xcosShowBlockWarning`, `xcosValidateBlockSet`, `xcosValidateCompareBlock`, `xcos_compile`, `xcos_debug_gui`, `xcos_run`, `xcos_simulate`, `xcov`, `xmltochm`, `xmltoformat`, `xmltohtml`, `xmltojar`, `xmltopdf`, `xmltops`, `xmltoweb`, `yulewalk`, `zeropen`, `zgrid`, `zpbutt`, `zpch1`, `zpch2`, `zpell`), NameBuiltin, nil}, + {Words(``, `\b`, `$`, `%F`, `%T`, `%e`, `%eps`, `%f`, `%fftw`, `%gui`, `%i`, `%inf`, `%io`, `%modalWarning`, `%nan`, `%pi`, `%s`, `%t`, `%tk`, `%toolboxes`, `%toolboxes_dir`, `%z`, `PWD`, `SCI`, `SCIHOME`, `TMPDIR`, `arnoldilib`, `assertlib`, `atomslib`, `cacsdlib`, `compatibility_functilib`, `corelib`, `data_structureslib`, `demo_toolslib`, `development_toolslib`, `differential_equationlib`, `dynamic_linklib`, `elementary_functionslib`, `enull`, `evoid`, `external_objectslib`, `fd`, `fileiolib`, `functionslib`, `genetic_algorithmslib`, `helptoolslib`, `home`, `integerlib`, `interpolationlib`, `iolib`, `jnull`, `jvoid`, `linear_algebralib`, `m2scilib`, `matiolib`, `modules_managerlib`, `neldermeadlib`, `optimbaselib`, `optimizationlib`, `optimsimplexlib`, `output_streamlib`, `overloadinglib`, `parameterslib`, `polynomialslib`, `preferenceslib`, `randliblib`, `scicos_autolib`, `scicos_utilslib`, `scinoteslib`, `signal_processinglib`, `simulated_annealinglib`, `soundlib`, `sparselib`, `special_functionslib`, `spreadsheetlib`, `statisticslib`, `stringlib`, `tclscilib`, `timelib`, `umfpacklib`, `xcoslib`), NameConstant, nil}, + {`-|==|~=|<|>|<=|>=|&&|&|~|\|\|?`, Operator, nil}, + {`\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\`, Operator, nil}, + {`[\[\](){}@.,=:;]`, Punctuation, nil}, + {`"[^"]*"`, LiteralString, nil}, + {`(?<=[\w)\].])\'+`, Operator, nil}, + {`(?|+=@:,./?-]+`, Operator, nil}, + {`[\[\]()]+`, Punctuation, nil}, + {`"`, LiteralStringDouble, Push("string-double")}, + {`'`, LiteralStringSingle, Push("string-single")}, + {`[a-z_-][\w-]*`, Name, nil}, + {`\n`, Text, nil}, + {`[;{}]`, Punctuation, Pop(1)}, + }, + "interpolation": { + {`\}`, LiteralStringInterpol, Pop(1)}, + Include("value"), + }, + "selector": { + {`[ \t]+`, Text, nil}, + {`\:`, NameDecorator, Push("pseudo-class")}, + {`\.`, NameClass, Push("class")}, + {`\#`, NameNamespace, Push("id")}, + {`[\w-]+`, NameTag, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`&`, Keyword, nil}, + {`[~^*!&\[\]()<>|+=@:,./?-]`, Operator, nil}, + {`"`, LiteralStringDouble, Push("string-double")}, + {`'`, LiteralStringSingle, Push("string-single")}, + {`\n`, Text, nil}, + {`[;{}]`, Punctuation, Pop(1)}, + }, + "string-double": { + {`(\\.|#(?=[^\n{])|[^\n"#])+`, LiteralStringDouble, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + "string-single": { + {`(\\.|#(?=[^\n{])|[^\n'#])+`, LiteralStringSingle, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`'`, LiteralStringSingle, Pop(1)}, + }, + "string-url": { + {`(\\#|#(?=[^\n{])|[^\n#)])+`, LiteralStringOther, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`\)`, LiteralStringOther, Pop(1)}, + }, + "pseudo-class": { + {`[\w-]+`, NameDecorator, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + Default(Pop(1)), + }, + "class": { + {`[\w-]+`, NameClass, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + Default(Pop(1)), + }, + "id": { + {`[\w-]+`, NameNamespace, nil}, + {`#\{`, LiteralStringInterpol, Push("interpolation")}, + Default(Pop(1)), + }, + "for": { + {`(from|to|through)`, OperatorWord, nil}, + Include("value"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/smalltalk.go b/vendor/github.com/alecthomas/chroma/lexers/s/smalltalk.go new file mode 100644 index 000000000..db64707fd --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/smalltalk.go @@ -0,0 +1,99 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Smalltalk lexer. +var Smalltalk = internal.Register(MustNewLexer( + &Config{ + Name: "Smalltalk", + Aliases: []string{"smalltalk", "squeak", "st"}, + Filenames: []string{"*.st"}, + MimeTypes: []string{"text/x-smalltalk"}, + }, + Rules{ + "root": { + {`(<)(\w+:)(.*?)(>)`, ByGroups(Text, Keyword, Text, Text), nil}, + Include("squeak fileout"), + Include("whitespaces"), + Include("method definition"), + {`(\|)([\w\s]*)(\|)`, ByGroups(Operator, NameVariable, Operator), nil}, + Include("objects"), + {`\^|:=|_`, Operator, nil}, + {`[\]({}.;!]`, Text, nil}, + }, + "method definition": { + {`([a-zA-Z]+\w*:)(\s*)(\w+)`, ByGroups(NameFunction, Text, NameVariable), nil}, + {`^(\b[a-zA-Z]+\w*\b)(\s*)$`, ByGroups(NameFunction, Text), nil}, + {`^([-+*/\\~<>=|&!?,@%]+)(\s*)(\w+)(\s*)$`, ByGroups(NameFunction, Text, NameVariable, Text), nil}, + }, + "blockvariables": { + Include("whitespaces"), + {`(:)(\s*)(\w+)`, ByGroups(Operator, Text, NameVariable), nil}, + {`\|`, Operator, Pop(1)}, + Default(Pop(1)), + }, + "literals": { + {`'(''|[^'])*'`, LiteralString, Push("afterobject")}, + {`\$.`, LiteralStringChar, Push("afterobject")}, + {`#\(`, LiteralStringSymbol, Push("parenth")}, + {`\)`, Text, Push("afterobject")}, + {`(\d+r)?-?\d+(\.\d+)?(e-?\d+)?`, LiteralNumber, Push("afterobject")}, + }, + "_parenth_helper": { + Include("whitespaces"), + {`(\d+r)?-?\d+(\.\d+)?(e-?\d+)?`, LiteralNumber, nil}, + {`[-+*/\\~<>=|&#!?,@%\w:]+`, LiteralStringSymbol, nil}, + {`'(''|[^'])*'`, LiteralString, nil}, + {`\$.`, LiteralStringChar, nil}, + {`#*\(`, LiteralStringSymbol, Push("inner_parenth")}, + }, + "parenth": { + {`\)`, LiteralStringSymbol, Push("root", "afterobject")}, + Include("_parenth_helper"), + }, + "inner_parenth": { + {`\)`, LiteralStringSymbol, Pop(1)}, + Include("_parenth_helper"), + }, + "whitespaces": { + {`\s+`, Text, nil}, + {`"(""|[^"])*"`, Comment, nil}, + }, + "objects": { + {`\[`, Text, Push("blockvariables")}, + {`\]`, Text, Push("afterobject")}, + {`\b(self|super|true|false|nil|thisContext)\b`, NameBuiltinPseudo, Push("afterobject")}, + {`\b[A-Z]\w*(?!:)\b`, NameClass, Push("afterobject")}, + {`\b[a-z]\w*(?!:)\b`, NameVariable, Push("afterobject")}, + {`#("(""|[^"])*"|[-+*/\\~<>=|&!?,@%]+|[\w:]+)`, LiteralStringSymbol, Push("afterobject")}, + Include("literals"), + }, + "afterobject": { + {`! !$`, Keyword, Pop(1)}, + Include("whitespaces"), + {`\b(ifTrue:|ifFalse:|whileTrue:|whileFalse:|timesRepeat:)`, NameBuiltin, Pop(1)}, + {`\b(new\b(?!:))`, NameBuiltin, nil}, + {`:=|_`, Operator, Pop(1)}, + {`\b[a-zA-Z]+\w*:`, NameFunction, Pop(1)}, + {`\b[a-zA-Z]+\w*`, NameFunction, nil}, + {`\w+:?|[-+*/\\~<>=|&!?,@%]+`, NameFunction, Pop(1)}, + {`\.`, Punctuation, Pop(1)}, + {`;`, Punctuation, nil}, + {`[\])}]`, Text, nil}, + {`[\[({]`, Text, Pop(1)}, + }, + "squeak fileout": { + {`^"(""|[^"])*"!`, Keyword, nil}, + {`^'(''|[^'])*'!`, Keyword, nil}, + {`^(!)(\w+)( commentStamp: )(.*?)( prior: .*?!\n)(.*?)(!)`, ByGroups(Keyword, NameClass, Keyword, LiteralString, Keyword, Text, Keyword), nil}, + {`^(!)(\w+(?: class)?)( methodsFor: )('(?:''|[^'])*')(.*?!)`, ByGroups(Keyword, NameClass, Keyword, LiteralString, Keyword), nil}, + {`^(\w+)( subclass: )(#\w+)(\s+instanceVariableNames: )(.*?)(\s+classVariableNames: )(.*?)(\s+poolDictionaries: )(.*?)(\s+category: )(.*?)(!)`, ByGroups(NameClass, Keyword, LiteralStringSymbol, Keyword, LiteralString, Keyword, LiteralString, Keyword, LiteralString, Keyword, LiteralString, Keyword), nil}, + {`^(\w+(?: class)?)(\s+instanceVariableNames: )(.*?)(!)`, ByGroups(NameClass, Keyword, LiteralString, Keyword), nil}, + {`(!\n)(\].*)(! !)$`, ByGroups(Keyword, Text, Keyword), nil}, + {`! !$`, Keyword, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/smarty.go b/vendor/github.com/alecthomas/chroma/lexers/s/smarty.go new file mode 100644 index 000000000..c364ffa53 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/smarty.go @@ -0,0 +1,40 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + . "github.com/alecthomas/chroma/lexers/circular" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Smarty lexer. +var Smarty = internal.Register(MustNewLexer( + &Config{ + Name: "Smarty", + Aliases: []string{"smarty"}, + Filenames: []string{"*.tpl"}, + MimeTypes: []string{"application/x-smarty"}, + DotAll: true, + }, + Rules{ + "root": { + {`[^{]+`, Other, nil}, + {`(\{)(\*.*?\*)(\})`, ByGroups(CommentPreproc, Comment, CommentPreproc), nil}, + {`(\{php\})(.*?)(\{/php\})`, ByGroups(CommentPreproc, Using(PHP), CommentPreproc), nil}, + {`(\{)(/?[a-zA-Z_]\w*)(\s*)`, ByGroups(CommentPreproc, NameFunction, Text), Push("smarty")}, + {`\{`, CommentPreproc, Push("smarty")}, + }, + "smarty": { + {`\s+`, Text, nil}, + {`\{`, CommentPreproc, Push()}, + {`\}`, CommentPreproc, Pop(1)}, + {`#[a-zA-Z_]\w*#`, NameVariable, nil}, + {`\$[a-zA-Z_]\w*(\.\w+)*`, NameVariable, nil}, + {`[~!%^&*()+=|\[\]:;,.<>/?@-]`, Operator, nil}, + {`(true|false|null)\b`, KeywordConstant, nil}, + {`[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`[a-zA-Z_]\w*`, NameAttribute, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/sml.go b/vendor/github.com/alecthomas/chroma/lexers/s/sml.go new file mode 100644 index 000000000..f716d92b2 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/sml.go @@ -0,0 +1,200 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Standard ML lexer. +var StandardML = internal.Register(MustNewLexer( + &Config{ + Name: "Standard ML", + Aliases: []string{"sml"}, + Filenames: []string{"*.sml", "*.sig", "*.fun"}, + MimeTypes: []string{"text/x-standardml", "application/x-standardml"}, + }, + Rules{ + "whitespace": { + {`\s+`, Text, nil}, + {`\(\*`, CommentMultiline, Push("comment")}, + }, + "delimiters": { + {`\(|\[|\{`, Punctuation, Push("main")}, + {`\)|\]|\}`, Punctuation, Pop(1)}, + {`\b(let|if|local)\b(?!\')`, KeywordReserved, Push("main", "main")}, + {`\b(struct|sig|while)\b(?!\')`, KeywordReserved, Push("main")}, + {`\b(do|else|end|in|then)\b(?!\')`, KeywordReserved, Pop(1)}, + }, + "core": { + {`(_|\}|\{|\)|;|,|\[|\(|\]|\.\.\.)`, Punctuation, nil}, + {`#"`, LiteralStringChar, Push("char")}, + {`"`, LiteralStringDouble, Push("string")}, + {`~?0x[0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`0wx[0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`0w\d+`, LiteralNumberInteger, nil}, + {`~?\d+\.\d+[eE]~?\d+`, LiteralNumberFloat, nil}, + {`~?\d+\.\d+`, LiteralNumberFloat, nil}, + {`~?\d+[eE]~?\d+`, LiteralNumberFloat, nil}, + {`~?\d+`, LiteralNumberInteger, nil}, + {`#\s*[1-9][0-9]*`, NameLabel, nil}, + {`#\s*([a-zA-Z][\w']*)`, NameLabel, nil}, + {"#\\s+([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", NameLabel, nil}, + {`\b(datatype|abstype)\b(?!\')`, KeywordReserved, Push("dname")}, + {`(?=\b(exception)\b(?!\'))`, Text, Push("ename")}, + {`\b(functor|include|open|signature|structure)\b(?!\')`, KeywordReserved, Push("sname")}, + {`\b(type|eqtype)\b(?!\')`, KeywordReserved, Push("tname")}, + {`\'[\w\']*`, NameDecorator, nil}, + {`([a-zA-Z][\w']*)(\.)`, NameNamespace, Push("dotted")}, + {`\b(abstype|and|andalso|as|case|datatype|do|else|end|exception|fn|fun|handle|if|in|infix|infixr|let|local|nonfix|of|op|open|orelse|raise|rec|then|type|val|with|withtype|while|eqtype|functor|include|sharing|sig|signature|struct|structure|where)\b`, KeywordReserved, nil}, + {`([a-zA-Z][\w']*)`, Name, nil}, + {`\b(:|\|,=|=>|->|#|:>)\b`, KeywordReserved, nil}, + {"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", Name, nil}, + }, + "dotted": { + {`([a-zA-Z][\w']*)(\.)`, NameNamespace, nil}, + // ignoring reserved words + {`([a-zA-Z][\w']*)`, Name, Pop(1)}, + // ignoring reserved words + {"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", Name, Pop(1)}, + {`\s+`, Error, nil}, + {`\S+`, Error, nil}, + }, + "root": { + Default(Push("main")), + }, + "main": { + Include("whitespace"), + {`\b(val|and)\b(?!\')`, KeywordReserved, Push("vname")}, + {`\b(fun)\b(?!\')`, KeywordReserved, Push("#pop", "main-fun", "fname")}, + Include("delimiters"), + Include("core"), + {`\S+`, Error, nil}, + }, + "main-fun": { + Include("whitespace"), + {`\s`, Text, nil}, + {`\(\*`, CommentMultiline, Push("comment")}, + {`\b(fun|and)\b(?!\')`, KeywordReserved, Push("fname")}, + {`\b(val)\b(?!\')`, KeywordReserved, Push("#pop", "main", "vname")}, + {`\|`, Punctuation, Push("fname")}, + {`\b(case|handle)\b(?!\')`, KeywordReserved, Push("#pop", "main")}, + Include("delimiters"), + Include("core"), + {`\S+`, Error, nil}, + }, + "char": { + {`[^"\\]`, LiteralStringChar, nil}, + {`\\[\\"abtnvfr]`, LiteralStringEscape, nil}, + {`\\\^[\x40-\x5e]`, LiteralStringEscape, nil}, + {`\\[0-9]{3}`, LiteralStringEscape, nil}, + {`\\u[0-9a-fA-F]{4}`, LiteralStringEscape, nil}, + {`\\\s+\\`, LiteralStringInterpol, nil}, + {`"`, LiteralStringChar, Pop(1)}, + }, + "string": { + {`[^"\\]`, LiteralStringDouble, nil}, + {`\\[\\"abtnvfr]`, LiteralStringEscape, nil}, + {`\\\^[\x40-\x5e]`, LiteralStringEscape, nil}, + {`\\[0-9]{3}`, LiteralStringEscape, nil}, + {`\\u[0-9a-fA-F]{4}`, LiteralStringEscape, nil}, + {`\\\s+\\`, LiteralStringInterpol, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + "breakout": { + {`(?=\b(where|do|handle|if|sig|op|while|case|as|else|signature|andalso|struct|infixr|functor|in|structure|then|local|rec|end|fun|of|orelse|val|include|fn|with|exception|let|and|infix|sharing|datatype|type|abstype|withtype|eqtype|nonfix|raise|open)\b(?!\'))`, Text, Pop(1)}, + }, + "sname": { + Include("whitespace"), + Include("breakout"), + {`([a-zA-Z][\w']*)`, NameNamespace, nil}, + Default(Pop(1)), + }, + "fname": { + Include("whitespace"), + {`\'[\w\']*`, NameDecorator, nil}, + {`\(`, Punctuation, Push("tyvarseq")}, + {`([a-zA-Z][\w']*)`, NameFunction, Pop(1)}, + {"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", NameFunction, Pop(1)}, + Default(Pop(1)), + }, + "vname": { + Include("whitespace"), + {`\'[\w\']*`, NameDecorator, nil}, + {`\(`, Punctuation, Push("tyvarseq")}, + {"([a-zA-Z][\\w']*)(\\s*)(=(?![!%&$#+\\-/:<=>?@\\\\~`^|*]+))", ByGroups(NameVariable, Text, Punctuation), Pop(1)}, + {"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)(\\s*)(=(?![!%&$#+\\-/:<=>?@\\\\~`^|*]+))", ByGroups(NameVariable, Text, Punctuation), Pop(1)}, + {`([a-zA-Z][\w']*)`, NameVariable, Pop(1)}, + {"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", NameVariable, Pop(1)}, + Default(Pop(1)), + }, + "tname": { + Include("whitespace"), + Include("breakout"), + {`\'[\w\']*`, NameDecorator, nil}, + {`\(`, Punctuation, Push("tyvarseq")}, + {"=(?![!%&$#+\\-/:<=>?@\\\\~`^|*]+)", Punctuation, Push("#pop", "typbind")}, + {`([a-zA-Z][\w']*)`, KeywordType, nil}, + {"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", KeywordType, nil}, + {`\S+`, Error, Pop(1)}, + }, + "typbind": { + Include("whitespace"), + {`\b(and)\b(?!\')`, KeywordReserved, Push("#pop", "tname")}, + Include("breakout"), + Include("core"), + {`\S+`, Error, Pop(1)}, + }, + "dname": { + Include("whitespace"), + Include("breakout"), + {`\'[\w\']*`, NameDecorator, nil}, + {`\(`, Punctuation, Push("tyvarseq")}, + {`(=)(\s*)(datatype)`, ByGroups(Punctuation, Text, KeywordReserved), Pop(1)}, + {"=(?![!%&$#+\\-/:<=>?@\\\\~`^|*]+)", Punctuation, Push("#pop", "datbind", "datcon")}, + {`([a-zA-Z][\w']*)`, KeywordType, nil}, + {"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", KeywordType, nil}, + {`\S+`, Error, Pop(1)}, + }, + "datbind": { + Include("whitespace"), + {`\b(and)\b(?!\')`, KeywordReserved, Push("#pop", "dname")}, + {`\b(withtype)\b(?!\')`, KeywordReserved, Push("#pop", "tname")}, + {`\b(of)\b(?!\')`, KeywordReserved, nil}, + {`(\|)(\s*)([a-zA-Z][\w']*)`, ByGroups(Punctuation, Text, NameClass), nil}, + {"(\\|)(\\s+)([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", ByGroups(Punctuation, Text, NameClass), nil}, + Include("breakout"), + Include("core"), + {`\S+`, Error, nil}, + }, + "ename": { + Include("whitespace"), + {`(exception|and)\b(\s+)([a-zA-Z][\w']*)`, ByGroups(KeywordReserved, Text, NameClass), nil}, + {"(exception|and)\\b(\\s*)([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", ByGroups(KeywordReserved, Text, NameClass), nil}, + {`\b(of)\b(?!\')`, KeywordReserved, nil}, + Include("breakout"), + Include("core"), + {`\S+`, Error, nil}, + }, + "datcon": { + Include("whitespace"), + {`([a-zA-Z][\w']*)`, NameClass, Pop(1)}, + {"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", NameClass, Pop(1)}, + {`\S+`, Error, Pop(1)}, + }, + "tyvarseq": { + {`\s`, Text, nil}, + {`\(\*`, CommentMultiline, Push("comment")}, + {`\'[\w\']*`, NameDecorator, nil}, + {`[a-zA-Z][\w']*`, Name, nil}, + {`,`, Punctuation, nil}, + {`\)`, Punctuation, Pop(1)}, + {"[!%&$#+\\-/:<=>?@\\\\~`^|*]+", Name, nil}, + }, + "comment": { + {`[^(*)]`, CommentMultiline, nil}, + {`\(\*`, CommentMultiline, Push()}, + {`\*\)`, CommentMultiline, Pop(1)}, + {`[(*)]`, CommentMultiline, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/snobol.go b/vendor/github.com/alecthomas/chroma/lexers/s/snobol.go new file mode 100644 index 000000000..c999b50f5 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/snobol.go @@ -0,0 +1,48 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Snobol lexer. +var Snobol = internal.Register(MustNewLexer( + &Config{ + Name: "Snobol", + Aliases: []string{"snobol"}, + Filenames: []string{"*.snobol"}, + MimeTypes: []string{"text/x-snobol"}, + }, + Rules{ + "root": { + {`\*.*\n`, Comment, nil}, + {`[+.] `, Punctuation, Push("statement")}, + {`-.*\n`, Comment, nil}, + {`END\s*\n`, NameLabel, Push("heredoc")}, + {`[A-Za-z$][\w$]*`, NameLabel, Push("statement")}, + {`\s+`, Text, Push("statement")}, + }, + "statement": { + {`\s*\n`, Text, Pop(1)}, + {`\s+`, Text, nil}, + {`(?<=[^\w.])(LT|LE|EQ|NE|GE|GT|INTEGER|IDENT|DIFFER|LGT|SIZE|REPLACE|TRIM|DUPL|REMDR|DATE|TIME|EVAL|APPLY|OPSYN|LOAD|UNLOAD|LEN|SPAN|BREAK|ANY|NOTANY|TAB|RTAB|REM|POS|RPOS|FAIL|FENCE|ABORT|ARB|ARBNO|BAL|SUCCEED|INPUT|OUTPUT|TERMINAL)(?=[^\w.])`, NameBuiltin, nil}, + {`[A-Za-z][\w.]*`, Name, nil}, + {`\*\*|[?$.!%*/#+\-@|&\\=]`, Operator, nil}, + {`"[^"]*"`, LiteralString, nil}, + {`'[^']*'`, LiteralString, nil}, + {`[0-9]+(?=[^.EeDd])`, LiteralNumberInteger, nil}, + {`[0-9]+(\.[0-9]*)?([EDed][-+]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`:`, Punctuation, Push("goto")}, + {`[()<>,;]`, Punctuation, nil}, + }, + "goto": { + {`\s*\n`, Text, Pop(2)}, + {`\s+`, Text, nil}, + {`F|S`, Keyword, nil}, + {`(\()([A-Za-z][\w.]*)(\))`, ByGroups(Punctuation, NameLabel, Punctuation), nil}, + }, + "heredoc": { + {`.*\n`, LiteralStringHeredoc, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/solidity.go b/vendor/github.com/alecthomas/chroma/lexers/s/solidity.go new file mode 100644 index 000000000..d7cf0f97b --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/solidity.go @@ -0,0 +1,110 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Solidity lexer. +var Solidity = internal.Register(MustNewLexer( + &Config{ + Name: "Solidity", + Aliases: []string{"sol", "solidity"}, + Filenames: []string{"*.sol"}, + MimeTypes: []string{}, + DotAll: true, + }, + Rules{ + "assembly": { + Include("comments"), + Include("numbers"), + Include("strings"), + Include("whitespace"), + {`\{`, Punctuation, Push()}, + {`\}`, Punctuation, Pop(1)}, + {`[(),]`, Punctuation, nil}, + {`:=|=:`, Operator, nil}, + {`(let)(\s*)(\w*\b)`, ByGroups(OperatorWord, Text, NameVariable), nil}, + {`(\w*\b)(\:[^=])`, ByGroups(NameLabel, Punctuation), nil}, + {`(stop|add|mul|sub|div|sdiv|mod|smod|addmod|mulmod|exp|signextend|lt|gt|slt|sgt|eq|iszero|and|or|xor|not|byte|keccak256|sha3|address|balance|origin|caller|callvalue|calldataload|calldatasize|calldatacopy|codesize|codecopy|gasprice|extcodesize|extcodecopy|blockhash|coinbase|timestamp|number|difficulty|gaslimit|pop|mload|mstore|mstore8|sload|sstore|for|switch|jump|jumpi|pc|msize|gas|jumpdest|push1|push2|push32|dup1|dup2|dup16|swap1|swap2|swap16|log0|log1|log4|create|call|callcode|return|delegatecall|suicide|returndatasize|returndatacopy|staticcall|revert|invalid)\b`, NameFunction, nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + }, + "comments": { + {`//([\w\W]*?\n)`, CommentSingle, nil}, + {`/[*][\w\W]*?[*]/`, CommentMultiline, nil}, + {`/[*][\w\W]*`, CommentMultiline, nil}, + }, + "keywords-other": { + {Words(``, `\b`, `for`, `in`, `while`, `do`, `break`, `return`, `returns`, `continue`, `if`, `else`, `throw`, `new`, `delete`), Keyword, nil}, + {`assembly\b`, Keyword, Push("assembly")}, + {Words(``, `\b`, `contract`, `interface`, `enum`, `event`, `function`, `library`, `mapping`, `modifier`, `struct`, `var`), KeywordDeclaration, nil}, + {`(import|using)\b`, KeywordNamespace, nil}, + {`pragma (solidity|experimental)\b`, KeywordReserved, nil}, + {`(_|as|constant|default|from|is)\b`, KeywordReserved, nil}, + {`payable\b`, KeywordReserved, nil}, + {`(memory|storage)\b`, KeywordReserved, nil}, + {`(external|internal|private|public)\b`, KeywordReserved, nil}, + {`(anonymous|indexed)\b`, KeywordReserved, nil}, + {`(abstract|pure|static|view)\b`, KeywordReserved, nil}, + {`(true|false)\b`, KeywordConstant, nil}, + {`(wei|finney|szabo|ether)\b`, KeywordConstant, nil}, + {`(seconds|minutes|hours|days|weeks|years)\b`, KeywordConstant, nil}, + }, + "keywords-types": { + {Words(``, `\b`, `address`, `bool`, `byte`, `bytes`, `int`, `fixed`, `string`, `ufixed`, `uint`), KeywordType, nil}, + {Words(``, `\b`, `int8`, `int16`, `int24`, `int32`, `int40`, `int48`, `int56`, `int64`, `int72`, `int80`, `int88`, `int96`, `int104`, `int112`, `int120`, `int128`, `int136`, `int144`, `int152`, `int160`, `int168`, `int176`, `int184`, `int192`, `int200`, `int208`, `int216`, `int224`, `int232`, `int240`, `int248`, `int256`), KeywordType, nil}, + {Words(``, `\b`, `uint8`, `uint16`, `uint24`, `uint32`, `uint40`, `uint48`, `uint56`, `uint64`, `uint72`, `uint80`, `uint88`, `uint96`, `uint104`, `uint112`, `uint120`, `uint128`, `uint136`, `uint144`, `uint152`, `uint160`, `uint168`, `uint176`, `uint184`, `uint192`, `uint200`, `uint208`, `uint216`, `uint224`, `uint232`, `uint240`, `uint248`, `uint256`), KeywordType, nil}, + {Words(``, `\b`, `bytes1`, `bytes2`, `bytes3`, `bytes4`, `bytes5`, `bytes6`, `bytes7`, `bytes8`, `bytes9`, `bytes10`, `bytes11`, `bytes12`, `bytes13`, `bytes14`, `bytes15`, `bytes16`, `bytes17`, `bytes18`, `bytes19`, `bytes20`, `bytes21`, `bytes22`, `bytes23`, `bytes24`, `bytes25`, `bytes26`, `bytes27`, `bytes28`, `bytes29`, `bytes30`, `bytes31`, `bytes32`), KeywordType, nil}, + {Words(``, `\b`, `fixed8x0`, `fixed8x1`, `fixed8x2`, `fixed8x3`, `fixed8x4`, `fixed8x5`, `fixed8x6`, `fixed8x7`, `fixed8x8`, `fixed8x9`, `fixed8x10`, `fixed8x11`, `fixed8x12`, `fixed8x13`, `fixed8x14`, `fixed8x15`, `fixed8x16`, `fixed8x17`, `fixed8x18`, `fixed8x19`, `fixed8x20`, `fixed8x21`, `fixed8x22`, `fixed8x23`, `fixed8x24`, `fixed8x25`, `fixed8x26`, `fixed8x27`, `fixed8x28`, `fixed8x29`, `fixed8x30`, `fixed8x31`, `fixed8x32`, `fixed8x33`, `fixed8x34`, `fixed8x35`, `fixed8x36`, `fixed8x37`, `fixed8x38`, `fixed8x39`, `fixed8x40`, `fixed8x41`, `fixed8x42`, `fixed8x43`, `fixed8x44`, `fixed8x45`, `fixed8x46`, `fixed8x47`, `fixed8x48`, `fixed8x49`, `fixed8x50`, `fixed8x51`, `fixed8x52`, `fixed8x53`, `fixed8x54`, `fixed8x55`, `fixed8x56`, `fixed8x57`, `fixed8x58`, `fixed8x59`, `fixed8x60`, `fixed8x61`, `fixed8x62`, `fixed8x63`, `fixed8x64`, `fixed8x65`, `fixed8x66`, `fixed8x67`, `fixed8x68`, `fixed8x69`, `fixed8x70`, `fixed8x71`, `fixed8x72`, `fixed8x73`, `fixed8x74`, `fixed8x75`, `fixed8x76`, `fixed8x77`, `fixed8x78`, `fixed8x79`, `fixed8x80`, `fixed16x0`, `fixed16x1`, `fixed16x2`, `fixed16x3`, `fixed16x4`, `fixed16x5`, `fixed16x6`, `fixed16x7`, `fixed16x8`, `fixed16x9`, `fixed16x10`, `fixed16x11`, `fixed16x12`, `fixed16x13`, `fixed16x14`, `fixed16x15`, `fixed16x16`, `fixed16x17`, `fixed16x18`, `fixed16x19`, `fixed16x20`, `fixed16x21`, `fixed16x22`, `fixed16x23`, `fixed16x24`, `fixed16x25`, `fixed16x26`, `fixed16x27`, `fixed16x28`, `fixed16x29`, `fixed16x30`, `fixed16x31`, `fixed16x32`, `fixed16x33`, `fixed16x34`, `fixed16x35`, `fixed16x36`, `fixed16x37`, `fixed16x38`, `fixed16x39`, `fixed16x40`, `fixed16x41`, `fixed16x42`, `fixed16x43`, `fixed16x44`, `fixed16x45`, `fixed16x46`, `fixed16x47`, `fixed16x48`, `fixed16x49`, `fixed16x50`, `fixed16x51`, `fixed16x52`, `fixed16x53`, `fixed16x54`, `fixed16x55`, `fixed16x56`, `fixed16x57`, `fixed16x58`, `fixed16x59`, `fixed16x60`, `fixed16x61`, `fixed16x62`, `fixed16x63`, `fixed16x64`, `fixed16x65`, `fixed16x66`, `fixed16x67`, `fixed16x68`, `fixed16x69`, `fixed16x70`, `fixed16x71`, `fixed16x72`, `fixed16x73`, `fixed16x74`, `fixed16x75`, `fixed16x76`, `fixed16x77`, `fixed16x78`, `fixed16x79`, `fixed16x80`, `fixed24x0`, `fixed24x1`, `fixed24x2`, `fixed24x3`, `fixed24x4`, `fixed24x5`, `fixed24x6`, `fixed24x7`, `fixed24x8`, `fixed24x9`, `fixed24x10`, `fixed24x11`, `fixed24x12`, `fixed24x13`, `fixed24x14`, `fixed24x15`, `fixed24x16`, `fixed24x17`, `fixed24x18`, `fixed24x19`, `fixed24x20`, `fixed24x21`, `fixed24x22`, `fixed24x23`, `fixed24x24`, `fixed24x25`, `fixed24x26`, `fixed24x27`, `fixed24x28`, `fixed24x29`, `fixed24x30`, `fixed24x31`, `fixed24x32`, `fixed24x33`, `fixed24x34`, `fixed24x35`, `fixed24x36`, `fixed24x37`, `fixed24x38`, `fixed24x39`, `fixed24x40`, `fixed24x41`, `fixed24x42`, `fixed24x43`, `fixed24x44`, `fixed24x45`, `fixed24x46`, `fixed24x47`, `fixed24x48`, `fixed24x49`, `fixed24x50`, `fixed24x51`, `fixed24x52`, `fixed24x53`, `fixed24x54`, `fixed24x55`, `fixed24x56`, `fixed24x57`, `fixed24x58`, `fixed24x59`, `fixed24x60`, `fixed24x61`, `fixed24x62`, `fixed24x63`, `fixed24x64`, `fixed24x65`, `fixed24x66`, `fixed24x67`, `fixed24x68`, `fixed24x69`, `fixed24x70`, `fixed24x71`, `fixed24x72`, `fixed24x73`, `fixed24x74`, `fixed24x75`, `fixed24x76`, `fixed24x77`, `fixed24x78`, `fixed24x79`, `fixed24x80`, `fixed32x0`, `fixed32x1`, `fixed32x2`, `fixed32x3`, `fixed32x4`, `fixed32x5`, `fixed32x6`, `fixed32x7`, `fixed32x8`, `fixed32x9`, `fixed32x10`, `fixed32x11`, `fixed32x12`, `fixed32x13`, `fixed32x14`, `fixed32x15`, `fixed32x16`, `fixed32x17`, `fixed32x18`, `fixed32x19`, `fixed32x20`, `fixed32x21`, `fixed32x22`, `fixed32x23`, `fixed32x24`, `fixed32x25`, `fixed32x26`, `fixed32x27`, `fixed32x28`, `fixed32x29`, `fixed32x30`, `fixed32x31`, `fixed32x32`, `fixed32x33`, `fixed32x34`, `fixed32x35`, `fixed32x36`, `fixed32x37`, `fixed32x38`, `fixed32x39`, `fixed32x40`, `fixed32x41`, `fixed32x42`, `fixed32x43`, `fixed32x44`, `fixed32x45`, `fixed32x46`, `fixed32x47`, `fixed32x48`, `fixed32x49`, `fixed32x50`, `fixed32x51`, `fixed32x52`, `fixed32x53`, `fixed32x54`, `fixed32x55`, `fixed32x56`, `fixed32x57`, `fixed32x58`, `fixed32x59`, `fixed32x60`, `fixed32x61`, `fixed32x62`, `fixed32x63`, `fixed32x64`, `fixed32x65`, `fixed32x66`, `fixed32x67`, `fixed32x68`, `fixed32x69`, `fixed32x70`, `fixed32x71`, `fixed32x72`, `fixed32x73`, `fixed32x74`, `fixed32x75`, `fixed32x76`, `fixed32x77`, `fixed32x78`, `fixed32x79`, `fixed32x80`, `fixed40x0`, `fixed40x1`, `fixed40x2`, `fixed40x3`, `fixed40x4`, `fixed40x5`, `fixed40x6`, `fixed40x7`, `fixed40x8`, `fixed40x9`, `fixed40x10`, `fixed40x11`, `fixed40x12`, `fixed40x13`, `fixed40x14`, `fixed40x15`, `fixed40x16`, `fixed40x17`, `fixed40x18`, `fixed40x19`, `fixed40x20`, `fixed40x21`, `fixed40x22`, `fixed40x23`, `fixed40x24`, `fixed40x25`, `fixed40x26`, `fixed40x27`, `fixed40x28`, `fixed40x29`, `fixed40x30`, `fixed40x31`, `fixed40x32`, `fixed40x33`, `fixed40x34`, `fixed40x35`, `fixed40x36`, `fixed40x37`, `fixed40x38`, `fixed40x39`, `fixed40x40`, `fixed40x41`, `fixed40x42`, `fixed40x43`, `fixed40x44`, `fixed40x45`, `fixed40x46`, `fixed40x47`, `fixed40x48`, `fixed40x49`, `fixed40x50`, `fixed40x51`, `fixed40x52`, `fixed40x53`, `fixed40x54`, `fixed40x55`, `fixed40x56`, `fixed40x57`, `fixed40x58`, `fixed40x59`, `fixed40x60`, `fixed40x61`, `fixed40x62`, `fixed40x63`, `fixed40x64`, `fixed40x65`, `fixed40x66`, `fixed40x67`, `fixed40x68`, `fixed40x69`, `fixed40x70`, `fixed40x71`, `fixed40x72`, `fixed40x73`, `fixed40x74`, `fixed40x75`, `fixed40x76`, `fixed40x77`, `fixed40x78`, `fixed40x79`, `fixed40x80`, `fixed48x0`, `fixed48x1`, `fixed48x2`, `fixed48x3`, `fixed48x4`, `fixed48x5`, `fixed48x6`, `fixed48x7`, `fixed48x8`, `fixed48x9`, `fixed48x10`, `fixed48x11`, `fixed48x12`, `fixed48x13`, `fixed48x14`, `fixed48x15`, `fixed48x16`, `fixed48x17`, `fixed48x18`, `fixed48x19`, `fixed48x20`, `fixed48x21`, `fixed48x22`, `fixed48x23`, `fixed48x24`, `fixed48x25`, `fixed48x26`, `fixed48x27`, `fixed48x28`, `fixed48x29`, `fixed48x30`, `fixed48x31`, `fixed48x32`, `fixed48x33`, `fixed48x34`, `fixed48x35`, `fixed48x36`, `fixed48x37`, `fixed48x38`, `fixed48x39`, `fixed48x40`, `fixed48x41`, `fixed48x42`, `fixed48x43`, `fixed48x44`, `fixed48x45`, `fixed48x46`, `fixed48x47`, `fixed48x48`, `fixed48x49`, `fixed48x50`, `fixed48x51`, `fixed48x52`, `fixed48x53`, `fixed48x54`, `fixed48x55`, `fixed48x56`, `fixed48x57`, `fixed48x58`, `fixed48x59`, `fixed48x60`, `fixed48x61`, `fixed48x62`, `fixed48x63`, `fixed48x64`, `fixed48x65`, `fixed48x66`, `fixed48x67`, `fixed48x68`, `fixed48x69`, `fixed48x70`, `fixed48x71`, `fixed48x72`, `fixed48x73`, `fixed48x74`, `fixed48x75`, `fixed48x76`, `fixed48x77`, `fixed48x78`, `fixed48x79`, `fixed48x80`, `fixed56x0`, `fixed56x1`, `fixed56x2`, `fixed56x3`, `fixed56x4`, `fixed56x5`, `fixed56x6`, `fixed56x7`, `fixed56x8`, `fixed56x9`, `fixed56x10`, `fixed56x11`, `fixed56x12`, `fixed56x13`, `fixed56x14`, `fixed56x15`, `fixed56x16`, `fixed56x17`, `fixed56x18`, `fixed56x19`, `fixed56x20`, `fixed56x21`, `fixed56x22`, `fixed56x23`, `fixed56x24`, `fixed56x25`, `fixed56x26`, `fixed56x27`, `fixed56x28`, `fixed56x29`, `fixed56x30`, `fixed56x31`, `fixed56x32`, `fixed56x33`, `fixed56x34`, `fixed56x35`, `fixed56x36`, `fixed56x37`, `fixed56x38`, `fixed56x39`, `fixed56x40`, `fixed56x41`, `fixed56x42`, `fixed56x43`, `fixed56x44`, `fixed56x45`, `fixed56x46`, `fixed56x47`, `fixed56x48`, `fixed56x49`, `fixed56x50`, `fixed56x51`, `fixed56x52`, `fixed56x53`, `fixed56x54`, `fixed56x55`, `fixed56x56`, `fixed56x57`, `fixed56x58`, `fixed56x59`, `fixed56x60`, `fixed56x61`, `fixed56x62`, `fixed56x63`, `fixed56x64`, `fixed56x65`, `fixed56x66`, `fixed56x67`, `fixed56x68`, `fixed56x69`, `fixed56x70`, `fixed56x71`, `fixed56x72`, `fixed56x73`, `fixed56x74`, `fixed56x75`, `fixed56x76`, `fixed56x77`, `fixed56x78`, `fixed56x79`, `fixed56x80`, `fixed64x0`, `fixed64x1`, `fixed64x2`, `fixed64x3`, `fixed64x4`, `fixed64x5`, `fixed64x6`, `fixed64x7`, `fixed64x8`, `fixed64x9`, `fixed64x10`, `fixed64x11`, `fixed64x12`, `fixed64x13`, `fixed64x14`, `fixed64x15`, `fixed64x16`, `fixed64x17`, `fixed64x18`, `fixed64x19`, `fixed64x20`, `fixed64x21`, `fixed64x22`, `fixed64x23`, `fixed64x24`, `fixed64x25`, `fixed64x26`, `fixed64x27`, `fixed64x28`, `fixed64x29`, `fixed64x30`, `fixed64x31`, `fixed64x32`, `fixed64x33`, `fixed64x34`, `fixed64x35`, `fixed64x36`, `fixed64x37`, `fixed64x38`, `fixed64x39`, `fixed64x40`, `fixed64x41`, `fixed64x42`, `fixed64x43`, `fixed64x44`, `fixed64x45`, `fixed64x46`, `fixed64x47`, `fixed64x48`, `fixed64x49`, `fixed64x50`, `fixed64x51`, `fixed64x52`, `fixed64x53`, `fixed64x54`, `fixed64x55`, `fixed64x56`, `fixed64x57`, `fixed64x58`, `fixed64x59`, `fixed64x60`, `fixed64x61`, `fixed64x62`, `fixed64x63`, `fixed64x64`, `fixed64x65`, `fixed64x66`, `fixed64x67`, `fixed64x68`, `fixed64x69`, `fixed64x70`, `fixed64x71`, `fixed64x72`, `fixed64x73`, `fixed64x74`, `fixed64x75`, `fixed64x76`, `fixed64x77`, `fixed64x78`, `fixed64x79`, `fixed64x80`, `fixed72x0`, `fixed72x1`, `fixed72x2`, `fixed72x3`, `fixed72x4`, `fixed72x5`, `fixed72x6`, `fixed72x7`, `fixed72x8`, `fixed72x9`, `fixed72x10`, `fixed72x11`, `fixed72x12`, `fixed72x13`, `fixed72x14`, `fixed72x15`, `fixed72x16`, `fixed72x17`, `fixed72x18`, `fixed72x19`, `fixed72x20`, `fixed72x21`, `fixed72x22`, `fixed72x23`, `fixed72x24`, `fixed72x25`, `fixed72x26`, `fixed72x27`, `fixed72x28`, `fixed72x29`, `fixed72x30`, `fixed72x31`, `fixed72x32`, `fixed72x33`, `fixed72x34`, `fixed72x35`, `fixed72x36`, `fixed72x37`, `fixed72x38`, `fixed72x39`, `fixed72x40`, `fixed72x41`, `fixed72x42`, `fixed72x43`, `fixed72x44`, `fixed72x45`, `fixed72x46`, `fixed72x47`, `fixed72x48`, `fixed72x49`, `fixed72x50`, `fixed72x51`, `fixed72x52`, `fixed72x53`, `fixed72x54`, `fixed72x55`, `fixed72x56`, `fixed72x57`, `fixed72x58`, `fixed72x59`, `fixed72x60`, `fixed72x61`, `fixed72x62`, `fixed72x63`, `fixed72x64`, `fixed72x65`, `fixed72x66`, `fixed72x67`, `fixed72x68`, `fixed72x69`, `fixed72x70`, `fixed72x71`, `fixed72x72`, `fixed72x73`, `fixed72x74`, `fixed72x75`, `fixed72x76`, `fixed72x77`, `fixed72x78`, `fixed72x79`, `fixed72x80`, `fixed80x0`, `fixed80x1`, `fixed80x2`, `fixed80x3`, `fixed80x4`, `fixed80x5`, `fixed80x6`, `fixed80x7`, `fixed80x8`, `fixed80x9`, `fixed80x10`, `fixed80x11`, `fixed80x12`, `fixed80x13`, `fixed80x14`, `fixed80x15`, `fixed80x16`, `fixed80x17`, `fixed80x18`, `fixed80x19`, `fixed80x20`, `fixed80x21`, `fixed80x22`, `fixed80x23`, `fixed80x24`, `fixed80x25`, `fixed80x26`, `fixed80x27`, `fixed80x28`, `fixed80x29`, `fixed80x30`, `fixed80x31`, `fixed80x32`, `fixed80x33`, `fixed80x34`, `fixed80x35`, `fixed80x36`, `fixed80x37`, `fixed80x38`, `fixed80x39`, `fixed80x40`, `fixed80x41`, `fixed80x42`, `fixed80x43`, `fixed80x44`, `fixed80x45`, `fixed80x46`, `fixed80x47`, `fixed80x48`, `fixed80x49`, `fixed80x50`, `fixed80x51`, `fixed80x52`, `fixed80x53`, `fixed80x54`, `fixed80x55`, `fixed80x56`, `fixed80x57`, `fixed80x58`, `fixed80x59`, `fixed80x60`, `fixed80x61`, `fixed80x62`, `fixed80x63`, `fixed80x64`, `fixed80x65`, `fixed80x66`, `fixed80x67`, `fixed80x68`, `fixed80x69`, `fixed80x70`, `fixed80x71`, `fixed80x72`, `fixed80x73`, `fixed80x74`, `fixed80x75`, `fixed80x76`, `fixed80x77`, `fixed80x78`, `fixed80x79`, `fixed80x80`, `fixed88x0`, `fixed88x1`, `fixed88x2`, `fixed88x3`, `fixed88x4`, `fixed88x5`, `fixed88x6`, `fixed88x7`, `fixed88x8`, `fixed88x9`, `fixed88x10`, `fixed88x11`, `fixed88x12`, `fixed88x13`, `fixed88x14`, `fixed88x15`, `fixed88x16`, `fixed88x17`, `fixed88x18`, `fixed88x19`, `fixed88x20`, `fixed88x21`, `fixed88x22`, `fixed88x23`, `fixed88x24`, `fixed88x25`, `fixed88x26`, `fixed88x27`, `fixed88x28`, `fixed88x29`, `fixed88x30`, `fixed88x31`, `fixed88x32`, `fixed88x33`, `fixed88x34`, `fixed88x35`, `fixed88x36`, `fixed88x37`, `fixed88x38`, `fixed88x39`, `fixed88x40`, `fixed88x41`, `fixed88x42`, `fixed88x43`, `fixed88x44`, `fixed88x45`, `fixed88x46`, `fixed88x47`, `fixed88x48`, `fixed88x49`, `fixed88x50`, `fixed88x51`, `fixed88x52`, `fixed88x53`, `fixed88x54`, `fixed88x55`, `fixed88x56`, `fixed88x57`, `fixed88x58`, `fixed88x59`, `fixed88x60`, `fixed88x61`, `fixed88x62`, `fixed88x63`, `fixed88x64`, `fixed88x65`, `fixed88x66`, `fixed88x67`, `fixed88x68`, `fixed88x69`, `fixed88x70`, `fixed88x71`, `fixed88x72`, `fixed88x73`, `fixed88x74`, `fixed88x75`, `fixed88x76`, `fixed88x77`, `fixed88x78`, `fixed88x79`, `fixed88x80`, `fixed96x0`, `fixed96x1`, `fixed96x2`, `fixed96x3`, `fixed96x4`, `fixed96x5`, `fixed96x6`, `fixed96x7`, `fixed96x8`, `fixed96x9`, `fixed96x10`, `fixed96x11`, `fixed96x12`, `fixed96x13`, `fixed96x14`, `fixed96x15`, `fixed96x16`, `fixed96x17`, `fixed96x18`, `fixed96x19`, `fixed96x20`, `fixed96x21`, `fixed96x22`, `fixed96x23`, `fixed96x24`, `fixed96x25`, `fixed96x26`, `fixed96x27`, `fixed96x28`, `fixed96x29`, `fixed96x30`, `fixed96x31`, `fixed96x32`, `fixed96x33`, `fixed96x34`, `fixed96x35`, `fixed96x36`, `fixed96x37`, `fixed96x38`, `fixed96x39`, `fixed96x40`, `fixed96x41`, `fixed96x42`, `fixed96x43`, `fixed96x44`, `fixed96x45`, `fixed96x46`, `fixed96x47`, `fixed96x48`, `fixed96x49`, `fixed96x50`, `fixed96x51`, `fixed96x52`, `fixed96x53`, `fixed96x54`, `fixed96x55`, `fixed96x56`, `fixed96x57`, `fixed96x58`, `fixed96x59`, `fixed96x60`, `fixed96x61`, `fixed96x62`, `fixed96x63`, `fixed96x64`, `fixed96x65`, `fixed96x66`, `fixed96x67`, `fixed96x68`, `fixed96x69`, `fixed96x70`, `fixed96x71`, `fixed96x72`, `fixed96x73`, `fixed96x74`, `fixed96x75`, `fixed96x76`, `fixed96x77`, `fixed96x78`, `fixed96x79`, `fixed96x80`, `fixed104x0`, `fixed104x1`, `fixed104x2`, `fixed104x3`, `fixed104x4`, `fixed104x5`, `fixed104x6`, `fixed104x7`, `fixed104x8`, `fixed104x9`, `fixed104x10`, `fixed104x11`, `fixed104x12`, `fixed104x13`, `fixed104x14`, `fixed104x15`, `fixed104x16`, `fixed104x17`, `fixed104x18`, `fixed104x19`, `fixed104x20`, `fixed104x21`, `fixed104x22`, `fixed104x23`, `fixed104x24`, `fixed104x25`, `fixed104x26`, `fixed104x27`, `fixed104x28`, `fixed104x29`, `fixed104x30`, `fixed104x31`, `fixed104x32`, `fixed104x33`, `fixed104x34`, `fixed104x35`, `fixed104x36`, `fixed104x37`, `fixed104x38`, `fixed104x39`, `fixed104x40`, `fixed104x41`, `fixed104x42`, `fixed104x43`, `fixed104x44`, `fixed104x45`, `fixed104x46`, `fixed104x47`, `fixed104x48`, `fixed104x49`, `fixed104x50`, `fixed104x51`, `fixed104x52`, `fixed104x53`, `fixed104x54`, `fixed104x55`, `fixed104x56`, `fixed104x57`, `fixed104x58`, `fixed104x59`, `fixed104x60`, `fixed104x61`, `fixed104x62`, `fixed104x63`, `fixed104x64`, `fixed104x65`, `fixed104x66`, `fixed104x67`, `fixed104x68`, `fixed104x69`, `fixed104x70`, `fixed104x71`, `fixed104x72`, `fixed104x73`, `fixed104x74`, `fixed104x75`, `fixed104x76`, `fixed104x77`, `fixed104x78`, `fixed104x79`, `fixed104x80`, `fixed112x0`, `fixed112x1`, `fixed112x2`, `fixed112x3`, `fixed112x4`, `fixed112x5`, `fixed112x6`, `fixed112x7`, `fixed112x8`, `fixed112x9`, `fixed112x10`, `fixed112x11`, `fixed112x12`, `fixed112x13`, `fixed112x14`, `fixed112x15`, `fixed112x16`, `fixed112x17`, `fixed112x18`, `fixed112x19`, `fixed112x20`, `fixed112x21`, `fixed112x22`, `fixed112x23`, `fixed112x24`, `fixed112x25`, `fixed112x26`, `fixed112x27`, `fixed112x28`, `fixed112x29`, `fixed112x30`, `fixed112x31`, `fixed112x32`, `fixed112x33`, `fixed112x34`, `fixed112x35`, `fixed112x36`, `fixed112x37`, `fixed112x38`, `fixed112x39`, `fixed112x40`, `fixed112x41`, `fixed112x42`, `fixed112x43`, `fixed112x44`, `fixed112x45`, `fixed112x46`, `fixed112x47`, `fixed112x48`, `fixed112x49`, `fixed112x50`, `fixed112x51`, `fixed112x52`, `fixed112x53`, `fixed112x54`, `fixed112x55`, `fixed112x56`, `fixed112x57`, `fixed112x58`, `fixed112x59`, `fixed112x60`, `fixed112x61`, `fixed112x62`, `fixed112x63`, `fixed112x64`, `fixed112x65`, `fixed112x66`, `fixed112x67`, `fixed112x68`, `fixed112x69`, `fixed112x70`, `fixed112x71`, `fixed112x72`, `fixed112x73`, `fixed112x74`, `fixed112x75`, `fixed112x76`, `fixed112x77`, `fixed112x78`, `fixed112x79`, `fixed112x80`, `fixed120x0`, `fixed120x1`, `fixed120x2`, `fixed120x3`, `fixed120x4`, `fixed120x5`, `fixed120x6`, `fixed120x7`, `fixed120x8`, `fixed120x9`, `fixed120x10`, `fixed120x11`, `fixed120x12`, `fixed120x13`, `fixed120x14`, `fixed120x15`, `fixed120x16`, `fixed120x17`, `fixed120x18`, `fixed120x19`, `fixed120x20`, `fixed120x21`, `fixed120x22`, `fixed120x23`, `fixed120x24`, `fixed120x25`, `fixed120x26`, `fixed120x27`, `fixed120x28`, `fixed120x29`, `fixed120x30`, `fixed120x31`, `fixed120x32`, `fixed120x33`, `fixed120x34`, `fixed120x35`, `fixed120x36`, `fixed120x37`, `fixed120x38`, `fixed120x39`, `fixed120x40`, `fixed120x41`, `fixed120x42`, `fixed120x43`, `fixed120x44`, `fixed120x45`, `fixed120x46`, `fixed120x47`, `fixed120x48`, `fixed120x49`, `fixed120x50`, `fixed120x51`, `fixed120x52`, `fixed120x53`, `fixed120x54`, `fixed120x55`, `fixed120x56`, `fixed120x57`, `fixed120x58`, `fixed120x59`, `fixed120x60`, `fixed120x61`, `fixed120x62`, `fixed120x63`, `fixed120x64`, `fixed120x65`, `fixed120x66`, `fixed120x67`, `fixed120x68`, `fixed120x69`, `fixed120x70`, `fixed120x71`, `fixed120x72`, `fixed120x73`, `fixed120x74`, `fixed120x75`, `fixed120x76`, `fixed120x77`, `fixed120x78`, `fixed120x79`, `fixed120x80`, `fixed128x0`, `fixed128x1`, `fixed128x2`, `fixed128x3`, `fixed128x4`, `fixed128x5`, `fixed128x6`, `fixed128x7`, `fixed128x8`, `fixed128x9`, `fixed128x10`, `fixed128x11`, `fixed128x12`, `fixed128x13`, `fixed128x14`, `fixed128x15`, `fixed128x16`, `fixed128x17`, `fixed128x18`, `fixed128x19`, `fixed128x20`, `fixed128x21`, `fixed128x22`, `fixed128x23`, `fixed128x24`, `fixed128x25`, `fixed128x26`, `fixed128x27`, `fixed128x28`, `fixed128x29`, `fixed128x30`, `fixed128x31`, `fixed128x32`, `fixed128x33`, `fixed128x34`, `fixed128x35`, `fixed128x36`, `fixed128x37`, `fixed128x38`, `fixed128x39`, `fixed128x40`, `fixed128x41`, `fixed128x42`, `fixed128x43`, `fixed128x44`, `fixed128x45`, `fixed128x46`, `fixed128x47`, `fixed128x48`, `fixed128x49`, `fixed128x50`, `fixed128x51`, `fixed128x52`, `fixed128x53`, `fixed128x54`, `fixed128x55`, `fixed128x56`, `fixed128x57`, `fixed128x58`, `fixed128x59`, `fixed128x60`, `fixed128x61`, `fixed128x62`, `fixed128x63`, `fixed128x64`, `fixed128x65`, `fixed128x66`, `fixed128x67`, `fixed128x68`, `fixed128x69`, `fixed128x70`, `fixed128x71`, `fixed128x72`, `fixed128x73`, `fixed128x74`, `fixed128x75`, `fixed128x76`, `fixed128x77`, `fixed128x78`, `fixed128x79`, `fixed128x80`, `fixed136x0`, `fixed136x1`, `fixed136x2`, `fixed136x3`, `fixed136x4`, `fixed136x5`, `fixed136x6`, `fixed136x7`, `fixed136x8`, `fixed136x9`, `fixed136x10`, `fixed136x11`, `fixed136x12`, `fixed136x13`, `fixed136x14`, `fixed136x15`, `fixed136x16`, `fixed136x17`, `fixed136x18`, `fixed136x19`, `fixed136x20`, `fixed136x21`, `fixed136x22`, `fixed136x23`, `fixed136x24`, `fixed136x25`, `fixed136x26`, `fixed136x27`, `fixed136x28`, `fixed136x29`, `fixed136x30`, `fixed136x31`, `fixed136x32`, `fixed136x33`, `fixed136x34`, `fixed136x35`, `fixed136x36`, `fixed136x37`, `fixed136x38`, `fixed136x39`, `fixed136x40`, `fixed136x41`, `fixed136x42`, `fixed136x43`, `fixed136x44`, `fixed136x45`, `fixed136x46`, `fixed136x47`, `fixed136x48`, `fixed136x49`, `fixed136x50`, `fixed136x51`, `fixed136x52`, `fixed136x53`, `fixed136x54`, `fixed136x55`, `fixed136x56`, `fixed136x57`, `fixed136x58`, `fixed136x59`, `fixed136x60`, `fixed136x61`, `fixed136x62`, `fixed136x63`, `fixed136x64`, `fixed136x65`, `fixed136x66`, `fixed136x67`, `fixed136x68`, `fixed136x69`, `fixed136x70`, `fixed136x71`, `fixed136x72`, `fixed136x73`, `fixed136x74`, `fixed136x75`, `fixed136x76`, `fixed136x77`, `fixed136x78`, `fixed136x79`, `fixed136x80`, `fixed144x0`, `fixed144x1`, `fixed144x2`, `fixed144x3`, `fixed144x4`, `fixed144x5`, `fixed144x6`, `fixed144x7`, `fixed144x8`, `fixed144x9`, `fixed144x10`, `fixed144x11`, `fixed144x12`, `fixed144x13`, `fixed144x14`, `fixed144x15`, `fixed144x16`, `fixed144x17`, `fixed144x18`, `fixed144x19`, `fixed144x20`, `fixed144x21`, `fixed144x22`, `fixed144x23`, `fixed144x24`, `fixed144x25`, `fixed144x26`, `fixed144x27`, `fixed144x28`, `fixed144x29`, `fixed144x30`, `fixed144x31`, `fixed144x32`, `fixed144x33`, `fixed144x34`, `fixed144x35`, `fixed144x36`, `fixed144x37`, `fixed144x38`, `fixed144x39`, `fixed144x40`, `fixed144x41`, `fixed144x42`, `fixed144x43`, `fixed144x44`, `fixed144x45`, `fixed144x46`, `fixed144x47`, `fixed144x48`, `fixed144x49`, `fixed144x50`, `fixed144x51`, `fixed144x52`, `fixed144x53`, `fixed144x54`, `fixed144x55`, `fixed144x56`, `fixed144x57`, `fixed144x58`, `fixed144x59`, `fixed144x60`, `fixed144x61`, `fixed144x62`, `fixed144x63`, `fixed144x64`, `fixed144x65`, `fixed144x66`, `fixed144x67`, `fixed144x68`, `fixed144x69`, `fixed144x70`, `fixed144x71`, `fixed144x72`, `fixed144x73`, `fixed144x74`, `fixed144x75`, `fixed144x76`, `fixed144x77`, `fixed144x78`, `fixed144x79`, `fixed144x80`, `fixed152x0`, `fixed152x1`, `fixed152x2`, `fixed152x3`, `fixed152x4`, `fixed152x5`, `fixed152x6`, `fixed152x7`, `fixed152x8`, `fixed152x9`, `fixed152x10`, `fixed152x11`, `fixed152x12`, `fixed152x13`, `fixed152x14`, `fixed152x15`, `fixed152x16`, `fixed152x17`, `fixed152x18`, `fixed152x19`, `fixed152x20`, `fixed152x21`, `fixed152x22`, `fixed152x23`, `fixed152x24`, `fixed152x25`, `fixed152x26`, `fixed152x27`, `fixed152x28`, `fixed152x29`, `fixed152x30`, `fixed152x31`, `fixed152x32`, `fixed152x33`, `fixed152x34`, `fixed152x35`, `fixed152x36`, `fixed152x37`, `fixed152x38`, `fixed152x39`, `fixed152x40`, `fixed152x41`, `fixed152x42`, `fixed152x43`, `fixed152x44`, `fixed152x45`, `fixed152x46`, `fixed152x47`, `fixed152x48`, `fixed152x49`, `fixed152x50`, `fixed152x51`, `fixed152x52`, `fixed152x53`, `fixed152x54`, `fixed152x55`, `fixed152x56`, `fixed152x57`, `fixed152x58`, `fixed152x59`, `fixed152x60`, `fixed152x61`, `fixed152x62`, `fixed152x63`, `fixed152x64`, `fixed152x65`, `fixed152x66`, `fixed152x67`, `fixed152x68`, `fixed152x69`, `fixed152x70`, `fixed152x71`, `fixed152x72`, `fixed152x73`, `fixed152x74`, `fixed152x75`, `fixed152x76`, `fixed152x77`, `fixed152x78`, `fixed152x79`, `fixed152x80`, `fixed160x0`, `fixed160x1`, `fixed160x2`, `fixed160x3`, `fixed160x4`, `fixed160x5`, `fixed160x6`, `fixed160x7`, `fixed160x8`, `fixed160x9`, `fixed160x10`, `fixed160x11`, `fixed160x12`, `fixed160x13`, `fixed160x14`, `fixed160x15`, `fixed160x16`, `fixed160x17`, `fixed160x18`, `fixed160x19`, `fixed160x20`, `fixed160x21`, `fixed160x22`, `fixed160x23`, `fixed160x24`, `fixed160x25`, `fixed160x26`, `fixed160x27`, `fixed160x28`, `fixed160x29`, `fixed160x30`, `fixed160x31`, `fixed160x32`, `fixed160x33`, `fixed160x34`, `fixed160x35`, `fixed160x36`, `fixed160x37`, `fixed160x38`, `fixed160x39`, `fixed160x40`, `fixed160x41`, `fixed160x42`, `fixed160x43`, `fixed160x44`, `fixed160x45`, `fixed160x46`, `fixed160x47`, `fixed160x48`, `fixed160x49`, `fixed160x50`, `fixed160x51`, `fixed160x52`, `fixed160x53`, `fixed160x54`, `fixed160x55`, `fixed160x56`, `fixed160x57`, `fixed160x58`, `fixed160x59`, `fixed160x60`, `fixed160x61`, `fixed160x62`, `fixed160x63`, `fixed160x64`, `fixed160x65`, `fixed160x66`, `fixed160x67`, `fixed160x68`, `fixed160x69`, `fixed160x70`, `fixed160x71`, `fixed160x72`, `fixed160x73`, `fixed160x74`, `fixed160x75`, `fixed160x76`, `fixed160x77`, `fixed160x78`, `fixed160x79`, `fixed160x80`, `fixed168x0`, `fixed168x1`, `fixed168x2`, `fixed168x3`, `fixed168x4`, `fixed168x5`, `fixed168x6`, `fixed168x7`, `fixed168x8`, `fixed168x9`, `fixed168x10`, `fixed168x11`, `fixed168x12`, `fixed168x13`, `fixed168x14`, `fixed168x15`, `fixed168x16`, `fixed168x17`, `fixed168x18`, `fixed168x19`, `fixed168x20`, `fixed168x21`, `fixed168x22`, `fixed168x23`, `fixed168x24`, `fixed168x25`, `fixed168x26`, `fixed168x27`, `fixed168x28`, `fixed168x29`, `fixed168x30`, `fixed168x31`, `fixed168x32`, `fixed168x33`, `fixed168x34`, `fixed168x35`, `fixed168x36`, `fixed168x37`, `fixed168x38`, `fixed168x39`, `fixed168x40`, `fixed168x41`, `fixed168x42`, `fixed168x43`, `fixed168x44`, `fixed168x45`, `fixed168x46`, `fixed168x47`, `fixed168x48`, `fixed168x49`, `fixed168x50`, `fixed168x51`, `fixed168x52`, `fixed168x53`, `fixed168x54`, `fixed168x55`, `fixed168x56`, `fixed168x57`, `fixed168x58`, `fixed168x59`, `fixed168x60`, `fixed168x61`, `fixed168x62`, `fixed168x63`, `fixed168x64`, `fixed168x65`, `fixed168x66`, `fixed168x67`, `fixed168x68`, `fixed168x69`, `fixed168x70`, `fixed168x71`, `fixed168x72`, `fixed168x73`, `fixed168x74`, `fixed168x75`, `fixed168x76`, `fixed168x77`, `fixed168x78`, `fixed168x79`, `fixed168x80`, `fixed176x0`, `fixed176x1`, `fixed176x2`, `fixed176x3`, `fixed176x4`, `fixed176x5`, `fixed176x6`, `fixed176x7`, `fixed176x8`, `fixed176x9`, `fixed176x10`, `fixed176x11`, `fixed176x12`, `fixed176x13`, `fixed176x14`, `fixed176x15`, `fixed176x16`, `fixed176x17`, `fixed176x18`, `fixed176x19`, `fixed176x20`, `fixed176x21`, `fixed176x22`, `fixed176x23`, `fixed176x24`, `fixed176x25`, `fixed176x26`, `fixed176x27`, `fixed176x28`, `fixed176x29`, `fixed176x30`, `fixed176x31`, `fixed176x32`, `fixed176x33`, `fixed176x34`, `fixed176x35`, `fixed176x36`, `fixed176x37`, `fixed176x38`, `fixed176x39`, `fixed176x40`, `fixed176x41`, `fixed176x42`, `fixed176x43`, `fixed176x44`, `fixed176x45`, `fixed176x46`, `fixed176x47`, `fixed176x48`, `fixed176x49`, `fixed176x50`, `fixed176x51`, `fixed176x52`, `fixed176x53`, `fixed176x54`, `fixed176x55`, `fixed176x56`, `fixed176x57`, `fixed176x58`, `fixed176x59`, `fixed176x60`, `fixed176x61`, `fixed176x62`, `fixed176x63`, `fixed176x64`, `fixed176x65`, `fixed176x66`, `fixed176x67`, `fixed176x68`, `fixed176x69`, `fixed176x70`, `fixed176x71`, `fixed176x72`, `fixed176x73`, `fixed176x74`, `fixed176x75`, `fixed176x76`, `fixed176x77`, `fixed176x78`, `fixed176x79`, `fixed176x80`, `fixed184x0`, `fixed184x1`, `fixed184x2`, `fixed184x3`, `fixed184x4`, `fixed184x5`, `fixed184x6`, `fixed184x7`, `fixed184x8`, `fixed184x9`, `fixed184x10`, `fixed184x11`, `fixed184x12`, `fixed184x13`, `fixed184x14`, `fixed184x15`, `fixed184x16`, `fixed184x17`, `fixed184x18`, `fixed184x19`, `fixed184x20`, `fixed184x21`, `fixed184x22`, `fixed184x23`, `fixed184x24`, `fixed184x25`, `fixed184x26`, `fixed184x27`, `fixed184x28`, `fixed184x29`, `fixed184x30`, `fixed184x31`, `fixed184x32`, `fixed184x33`, `fixed184x34`, `fixed184x35`, `fixed184x36`, `fixed184x37`, `fixed184x38`, `fixed184x39`, `fixed184x40`, `fixed184x41`, `fixed184x42`, `fixed184x43`, `fixed184x44`, `fixed184x45`, `fixed184x46`, `fixed184x47`, `fixed184x48`, `fixed184x49`, `fixed184x50`, `fixed184x51`, `fixed184x52`, `fixed184x53`, `fixed184x54`, `fixed184x55`, `fixed184x56`, `fixed184x57`, `fixed184x58`, `fixed184x59`, `fixed184x60`, `fixed184x61`, `fixed184x62`, `fixed184x63`, `fixed184x64`, `fixed184x65`, `fixed184x66`, `fixed184x67`, `fixed184x68`, `fixed184x69`, `fixed184x70`, `fixed184x71`, `fixed184x72`, `fixed192x0`, `fixed192x1`, `fixed192x2`, `fixed192x3`, `fixed192x4`, `fixed192x5`, `fixed192x6`, `fixed192x7`, `fixed192x8`, `fixed192x9`, `fixed192x10`, `fixed192x11`, `fixed192x12`, `fixed192x13`, `fixed192x14`, `fixed192x15`, `fixed192x16`, `fixed192x17`, `fixed192x18`, `fixed192x19`, `fixed192x20`, `fixed192x21`, `fixed192x22`, `fixed192x23`, `fixed192x24`, `fixed192x25`, `fixed192x26`, `fixed192x27`, `fixed192x28`, `fixed192x29`, `fixed192x30`, `fixed192x31`, `fixed192x32`, `fixed192x33`, `fixed192x34`, `fixed192x35`, `fixed192x36`, `fixed192x37`, `fixed192x38`, `fixed192x39`, `fixed192x40`, `fixed192x41`, `fixed192x42`, `fixed192x43`, `fixed192x44`, `fixed192x45`, `fixed192x46`, `fixed192x47`, `fixed192x48`, `fixed192x49`, `fixed192x50`, `fixed192x51`, `fixed192x52`, `fixed192x53`, `fixed192x54`, `fixed192x55`, `fixed192x56`, `fixed192x57`, `fixed192x58`, `fixed192x59`, `fixed192x60`, `fixed192x61`, `fixed192x62`, `fixed192x63`, `fixed192x64`, `fixed200x0`, `fixed200x1`, `fixed200x2`, `fixed200x3`, `fixed200x4`, `fixed200x5`, `fixed200x6`, `fixed200x7`, `fixed200x8`, `fixed200x9`, `fixed200x10`, `fixed200x11`, `fixed200x12`, `fixed200x13`, `fixed200x14`, `fixed200x15`, `fixed200x16`, `fixed200x17`, `fixed200x18`, `fixed200x19`, `fixed200x20`, `fixed200x21`, `fixed200x22`, `fixed200x23`, `fixed200x24`, `fixed200x25`, `fixed200x26`, `fixed200x27`, `fixed200x28`, `fixed200x29`, `fixed200x30`, `fixed200x31`, `fixed200x32`, `fixed200x33`, `fixed200x34`, `fixed200x35`, `fixed200x36`, `fixed200x37`, `fixed200x38`, `fixed200x39`, `fixed200x40`, `fixed200x41`, `fixed200x42`, `fixed200x43`, `fixed200x44`, `fixed200x45`, `fixed200x46`, `fixed200x47`, `fixed200x48`, `fixed200x49`, `fixed200x50`, `fixed200x51`, `fixed200x52`, `fixed200x53`, `fixed200x54`, `fixed200x55`, `fixed200x56`, `fixed208x0`, `fixed208x1`, `fixed208x2`, `fixed208x3`, `fixed208x4`, `fixed208x5`, `fixed208x6`, `fixed208x7`, `fixed208x8`, `fixed208x9`, `fixed208x10`, `fixed208x11`, `fixed208x12`, `fixed208x13`, `fixed208x14`, `fixed208x15`, `fixed208x16`, `fixed208x17`, `fixed208x18`, `fixed208x19`, `fixed208x20`, `fixed208x21`, `fixed208x22`, `fixed208x23`, `fixed208x24`, `fixed208x25`, `fixed208x26`, `fixed208x27`, `fixed208x28`, `fixed208x29`, `fixed208x30`, `fixed208x31`, `fixed208x32`, `fixed208x33`, `fixed208x34`, `fixed208x35`, `fixed208x36`, `fixed208x37`, `fixed208x38`, `fixed208x39`, `fixed208x40`, `fixed208x41`, `fixed208x42`, `fixed208x43`, `fixed208x44`, `fixed208x45`, `fixed208x46`, `fixed208x47`, `fixed208x48`, `fixed216x0`, `fixed216x1`, `fixed216x2`, `fixed216x3`, `fixed216x4`, `fixed216x5`, `fixed216x6`, `fixed216x7`, `fixed216x8`, `fixed216x9`, `fixed216x10`, `fixed216x11`, `fixed216x12`, `fixed216x13`, `fixed216x14`, `fixed216x15`, `fixed216x16`, `fixed216x17`, `fixed216x18`, `fixed216x19`, `fixed216x20`, `fixed216x21`, `fixed216x22`, `fixed216x23`, `fixed216x24`, `fixed216x25`, `fixed216x26`, `fixed216x27`, `fixed216x28`, `fixed216x29`, `fixed216x30`, `fixed216x31`, `fixed216x32`, `fixed216x33`, `fixed216x34`, `fixed216x35`, `fixed216x36`, `fixed216x37`, `fixed216x38`, `fixed216x39`, `fixed216x40`, `fixed224x0`, `fixed224x1`, `fixed224x2`, `fixed224x3`, `fixed224x4`, `fixed224x5`, `fixed224x6`, `fixed224x7`, `fixed224x8`, `fixed224x9`, `fixed224x10`, `fixed224x11`, `fixed224x12`, `fixed224x13`, `fixed224x14`, `fixed224x15`, `fixed224x16`, `fixed224x17`, `fixed224x18`, `fixed224x19`, `fixed224x20`, `fixed224x21`, `fixed224x22`, `fixed224x23`, `fixed224x24`, `fixed224x25`, `fixed224x26`, `fixed224x27`, `fixed224x28`, `fixed224x29`, `fixed224x30`, `fixed224x31`, `fixed224x32`, `fixed232x0`, `fixed232x1`, `fixed232x2`, `fixed232x3`, `fixed232x4`, `fixed232x5`, `fixed232x6`, `fixed232x7`, `fixed232x8`, `fixed232x9`, `fixed232x10`, `fixed232x11`, `fixed232x12`, `fixed232x13`, `fixed232x14`, `fixed232x15`, `fixed232x16`, `fixed232x17`, `fixed232x18`, `fixed232x19`, `fixed232x20`, `fixed232x21`, `fixed232x22`, `fixed232x23`, `fixed232x24`, `fixed240x0`, `fixed240x1`, `fixed240x2`, `fixed240x3`, `fixed240x4`, `fixed240x5`, `fixed240x6`, `fixed240x7`, `fixed240x8`, `fixed240x9`, `fixed240x10`, `fixed240x11`, `fixed240x12`, `fixed240x13`, `fixed240x14`, `fixed240x15`, `fixed240x16`, `fixed248x0`, `fixed248x1`, `fixed248x2`, `fixed248x3`, `fixed248x4`, `fixed248x5`, `fixed248x6`, `fixed248x7`, `fixed248x8`, `fixed256x0`), KeywordType, nil}, + {Words(``, `\b`, `ufixed8x0`, `ufixed8x1`, `ufixed8x2`, `ufixed8x3`, `ufixed8x4`, `ufixed8x5`, `ufixed8x6`, `ufixed8x7`, `ufixed8x8`, `ufixed8x9`, `ufixed8x10`, `ufixed8x11`, `ufixed8x12`, `ufixed8x13`, `ufixed8x14`, `ufixed8x15`, `ufixed8x16`, `ufixed8x17`, `ufixed8x18`, `ufixed8x19`, `ufixed8x20`, `ufixed8x21`, `ufixed8x22`, `ufixed8x23`, `ufixed8x24`, `ufixed8x25`, `ufixed8x26`, `ufixed8x27`, `ufixed8x28`, `ufixed8x29`, `ufixed8x30`, `ufixed8x31`, `ufixed8x32`, `ufixed8x33`, `ufixed8x34`, `ufixed8x35`, `ufixed8x36`, `ufixed8x37`, `ufixed8x38`, `ufixed8x39`, `ufixed8x40`, `ufixed8x41`, `ufixed8x42`, `ufixed8x43`, `ufixed8x44`, `ufixed8x45`, `ufixed8x46`, `ufixed8x47`, `ufixed8x48`, `ufixed8x49`, `ufixed8x50`, `ufixed8x51`, `ufixed8x52`, `ufixed8x53`, `ufixed8x54`, `ufixed8x55`, `ufixed8x56`, `ufixed8x57`, `ufixed8x58`, `ufixed8x59`, `ufixed8x60`, `ufixed8x61`, `ufixed8x62`, `ufixed8x63`, `ufixed8x64`, `ufixed8x65`, `ufixed8x66`, `ufixed8x67`, `ufixed8x68`, `ufixed8x69`, `ufixed8x70`, `ufixed8x71`, `ufixed8x72`, `ufixed8x73`, `ufixed8x74`, `ufixed8x75`, `ufixed8x76`, `ufixed8x77`, `ufixed8x78`, `ufixed8x79`, `ufixed8x80`, `ufixed16x0`, `ufixed16x1`, `ufixed16x2`, `ufixed16x3`, `ufixed16x4`, `ufixed16x5`, `ufixed16x6`, `ufixed16x7`, `ufixed16x8`, `ufixed16x9`, `ufixed16x10`, `ufixed16x11`, `ufixed16x12`, `ufixed16x13`, `ufixed16x14`, `ufixed16x15`, `ufixed16x16`, `ufixed16x17`, `ufixed16x18`, `ufixed16x19`, `ufixed16x20`, `ufixed16x21`, `ufixed16x22`, `ufixed16x23`, `ufixed16x24`, `ufixed16x25`, `ufixed16x26`, `ufixed16x27`, `ufixed16x28`, `ufixed16x29`, `ufixed16x30`, `ufixed16x31`, `ufixed16x32`, `ufixed16x33`, `ufixed16x34`, `ufixed16x35`, `ufixed16x36`, `ufixed16x37`, `ufixed16x38`, `ufixed16x39`, `ufixed16x40`, `ufixed16x41`, `ufixed16x42`, `ufixed16x43`, `ufixed16x44`, `ufixed16x45`, `ufixed16x46`, `ufixed16x47`, `ufixed16x48`, `ufixed16x49`, `ufixed16x50`, `ufixed16x51`, `ufixed16x52`, `ufixed16x53`, `ufixed16x54`, `ufixed16x55`, `ufixed16x56`, `ufixed16x57`, `ufixed16x58`, `ufixed16x59`, `ufixed16x60`, `ufixed16x61`, `ufixed16x62`, `ufixed16x63`, `ufixed16x64`, `ufixed16x65`, `ufixed16x66`, `ufixed16x67`, `ufixed16x68`, `ufixed16x69`, `ufixed16x70`, `ufixed16x71`, `ufixed16x72`, `ufixed16x73`, `ufixed16x74`, `ufixed16x75`, `ufixed16x76`, `ufixed16x77`, `ufixed16x78`, `ufixed16x79`, `ufixed16x80`, `ufixed24x0`, `ufixed24x1`, `ufixed24x2`, `ufixed24x3`, `ufixed24x4`, `ufixed24x5`, `ufixed24x6`, `ufixed24x7`, `ufixed24x8`, `ufixed24x9`, `ufixed24x10`, `ufixed24x11`, `ufixed24x12`, `ufixed24x13`, `ufixed24x14`, `ufixed24x15`, `ufixed24x16`, `ufixed24x17`, `ufixed24x18`, `ufixed24x19`, `ufixed24x20`, `ufixed24x21`, `ufixed24x22`, `ufixed24x23`, `ufixed24x24`, `ufixed24x25`, `ufixed24x26`, `ufixed24x27`, `ufixed24x28`, `ufixed24x29`, `ufixed24x30`, `ufixed24x31`, `ufixed24x32`, `ufixed24x33`, `ufixed24x34`, `ufixed24x35`, `ufixed24x36`, `ufixed24x37`, `ufixed24x38`, `ufixed24x39`, `ufixed24x40`, `ufixed24x41`, `ufixed24x42`, `ufixed24x43`, `ufixed24x44`, `ufixed24x45`, `ufixed24x46`, `ufixed24x47`, `ufixed24x48`, `ufixed24x49`, `ufixed24x50`, `ufixed24x51`, `ufixed24x52`, `ufixed24x53`, `ufixed24x54`, `ufixed24x55`, `ufixed24x56`, `ufixed24x57`, `ufixed24x58`, `ufixed24x59`, `ufixed24x60`, `ufixed24x61`, `ufixed24x62`, `ufixed24x63`, `ufixed24x64`, `ufixed24x65`, `ufixed24x66`, `ufixed24x67`, `ufixed24x68`, `ufixed24x69`, `ufixed24x70`, `ufixed24x71`, `ufixed24x72`, `ufixed24x73`, `ufixed24x74`, `ufixed24x75`, `ufixed24x76`, `ufixed24x77`, `ufixed24x78`, `ufixed24x79`, `ufixed24x80`, `ufixed32x0`, `ufixed32x1`, `ufixed32x2`, `ufixed32x3`, `ufixed32x4`, `ufixed32x5`, `ufixed32x6`, `ufixed32x7`, `ufixed32x8`, `ufixed32x9`, `ufixed32x10`, `ufixed32x11`, `ufixed32x12`, `ufixed32x13`, `ufixed32x14`, `ufixed32x15`, `ufixed32x16`, `ufixed32x17`, `ufixed32x18`, `ufixed32x19`, `ufixed32x20`, `ufixed32x21`, `ufixed32x22`, `ufixed32x23`, `ufixed32x24`, `ufixed32x25`, `ufixed32x26`, `ufixed32x27`, `ufixed32x28`, `ufixed32x29`, `ufixed32x30`, `ufixed32x31`, `ufixed32x32`, `ufixed32x33`, `ufixed32x34`, `ufixed32x35`, `ufixed32x36`, `ufixed32x37`, `ufixed32x38`, `ufixed32x39`, `ufixed32x40`, `ufixed32x41`, `ufixed32x42`, `ufixed32x43`, `ufixed32x44`, `ufixed32x45`, `ufixed32x46`, `ufixed32x47`, `ufixed32x48`, `ufixed32x49`, `ufixed32x50`, `ufixed32x51`, `ufixed32x52`, `ufixed32x53`, `ufixed32x54`, `ufixed32x55`, `ufixed32x56`, `ufixed32x57`, `ufixed32x58`, `ufixed32x59`, `ufixed32x60`, `ufixed32x61`, `ufixed32x62`, `ufixed32x63`, `ufixed32x64`, `ufixed32x65`, `ufixed32x66`, `ufixed32x67`, `ufixed32x68`, `ufixed32x69`, `ufixed32x70`, `ufixed32x71`, `ufixed32x72`, `ufixed32x73`, `ufixed32x74`, `ufixed32x75`, `ufixed32x76`, `ufixed32x77`, `ufixed32x78`, `ufixed32x79`, `ufixed32x80`, `ufixed40x0`, `ufixed40x1`, `ufixed40x2`, `ufixed40x3`, `ufixed40x4`, `ufixed40x5`, `ufixed40x6`, `ufixed40x7`, `ufixed40x8`, `ufixed40x9`, `ufixed40x10`, `ufixed40x11`, `ufixed40x12`, `ufixed40x13`, `ufixed40x14`, `ufixed40x15`, `ufixed40x16`, `ufixed40x17`, `ufixed40x18`, `ufixed40x19`, `ufixed40x20`, `ufixed40x21`, `ufixed40x22`, `ufixed40x23`, `ufixed40x24`, `ufixed40x25`, `ufixed40x26`, `ufixed40x27`, `ufixed40x28`, `ufixed40x29`, `ufixed40x30`, `ufixed40x31`, `ufixed40x32`, `ufixed40x33`, `ufixed40x34`, `ufixed40x35`, `ufixed40x36`, `ufixed40x37`, `ufixed40x38`, `ufixed40x39`, `ufixed40x40`, `ufixed40x41`, `ufixed40x42`, `ufixed40x43`, `ufixed40x44`, `ufixed40x45`, `ufixed40x46`, `ufixed40x47`, `ufixed40x48`, `ufixed40x49`, `ufixed40x50`, `ufixed40x51`, `ufixed40x52`, `ufixed40x53`, `ufixed40x54`, `ufixed40x55`, `ufixed40x56`, `ufixed40x57`, `ufixed40x58`, `ufixed40x59`, `ufixed40x60`, `ufixed40x61`, `ufixed40x62`, `ufixed40x63`, `ufixed40x64`, `ufixed40x65`, `ufixed40x66`, `ufixed40x67`, `ufixed40x68`, `ufixed40x69`, `ufixed40x70`, `ufixed40x71`, `ufixed40x72`, `ufixed40x73`, `ufixed40x74`, `ufixed40x75`, `ufixed40x76`, `ufixed40x77`, `ufixed40x78`, `ufixed40x79`, `ufixed40x80`, `ufixed48x0`, `ufixed48x1`, `ufixed48x2`, `ufixed48x3`, `ufixed48x4`, `ufixed48x5`, `ufixed48x6`, `ufixed48x7`, `ufixed48x8`, `ufixed48x9`, `ufixed48x10`, `ufixed48x11`, `ufixed48x12`, `ufixed48x13`, `ufixed48x14`, `ufixed48x15`, `ufixed48x16`, `ufixed48x17`, `ufixed48x18`, `ufixed48x19`, `ufixed48x20`, `ufixed48x21`, `ufixed48x22`, `ufixed48x23`, `ufixed48x24`, `ufixed48x25`, `ufixed48x26`, `ufixed48x27`, `ufixed48x28`, `ufixed48x29`, `ufixed48x30`, `ufixed48x31`, `ufixed48x32`, `ufixed48x33`, `ufixed48x34`, `ufixed48x35`, `ufixed48x36`, `ufixed48x37`, `ufixed48x38`, `ufixed48x39`, `ufixed48x40`, `ufixed48x41`, `ufixed48x42`, `ufixed48x43`, `ufixed48x44`, `ufixed48x45`, `ufixed48x46`, `ufixed48x47`, `ufixed48x48`, `ufixed48x49`, `ufixed48x50`, `ufixed48x51`, `ufixed48x52`, `ufixed48x53`, `ufixed48x54`, `ufixed48x55`, `ufixed48x56`, `ufixed48x57`, `ufixed48x58`, `ufixed48x59`, `ufixed48x60`, `ufixed48x61`, `ufixed48x62`, `ufixed48x63`, `ufixed48x64`, `ufixed48x65`, `ufixed48x66`, `ufixed48x67`, `ufixed48x68`, `ufixed48x69`, `ufixed48x70`, `ufixed48x71`, `ufixed48x72`, `ufixed48x73`, `ufixed48x74`, `ufixed48x75`, `ufixed48x76`, `ufixed48x77`, `ufixed48x78`, `ufixed48x79`, `ufixed48x80`, `ufixed56x0`, `ufixed56x1`, `ufixed56x2`, `ufixed56x3`, `ufixed56x4`, `ufixed56x5`, `ufixed56x6`, `ufixed56x7`, `ufixed56x8`, `ufixed56x9`, `ufixed56x10`, `ufixed56x11`, `ufixed56x12`, `ufixed56x13`, `ufixed56x14`, `ufixed56x15`, `ufixed56x16`, `ufixed56x17`, `ufixed56x18`, `ufixed56x19`, `ufixed56x20`, `ufixed56x21`, `ufixed56x22`, `ufixed56x23`, `ufixed56x24`, `ufixed56x25`, `ufixed56x26`, `ufixed56x27`, `ufixed56x28`, `ufixed56x29`, `ufixed56x30`, `ufixed56x31`, `ufixed56x32`, `ufixed56x33`, `ufixed56x34`, `ufixed56x35`, `ufixed56x36`, `ufixed56x37`, `ufixed56x38`, `ufixed56x39`, `ufixed56x40`, `ufixed56x41`, `ufixed56x42`, `ufixed56x43`, `ufixed56x44`, `ufixed56x45`, `ufixed56x46`, `ufixed56x47`, `ufixed56x48`, `ufixed56x49`, `ufixed56x50`, `ufixed56x51`, `ufixed56x52`, `ufixed56x53`, `ufixed56x54`, `ufixed56x55`, `ufixed56x56`, `ufixed56x57`, `ufixed56x58`, `ufixed56x59`, `ufixed56x60`, `ufixed56x61`, `ufixed56x62`, `ufixed56x63`, `ufixed56x64`, `ufixed56x65`, `ufixed56x66`, `ufixed56x67`, `ufixed56x68`, `ufixed56x69`, `ufixed56x70`, `ufixed56x71`, `ufixed56x72`, `ufixed56x73`, `ufixed56x74`, `ufixed56x75`, `ufixed56x76`, `ufixed56x77`, `ufixed56x78`, `ufixed56x79`, `ufixed56x80`, `ufixed64x0`, `ufixed64x1`, `ufixed64x2`, `ufixed64x3`, `ufixed64x4`, `ufixed64x5`, `ufixed64x6`, `ufixed64x7`, `ufixed64x8`, `ufixed64x9`, `ufixed64x10`, `ufixed64x11`, `ufixed64x12`, `ufixed64x13`, `ufixed64x14`, `ufixed64x15`, `ufixed64x16`, `ufixed64x17`, `ufixed64x18`, `ufixed64x19`, `ufixed64x20`, `ufixed64x21`, `ufixed64x22`, `ufixed64x23`, `ufixed64x24`, `ufixed64x25`, `ufixed64x26`, `ufixed64x27`, `ufixed64x28`, `ufixed64x29`, `ufixed64x30`, `ufixed64x31`, `ufixed64x32`, `ufixed64x33`, `ufixed64x34`, `ufixed64x35`, `ufixed64x36`, `ufixed64x37`, `ufixed64x38`, `ufixed64x39`, `ufixed64x40`, `ufixed64x41`, `ufixed64x42`, `ufixed64x43`, `ufixed64x44`, `ufixed64x45`, `ufixed64x46`, `ufixed64x47`, `ufixed64x48`, `ufixed64x49`, `ufixed64x50`, `ufixed64x51`, `ufixed64x52`, `ufixed64x53`, `ufixed64x54`, `ufixed64x55`, `ufixed64x56`, `ufixed64x57`, `ufixed64x58`, `ufixed64x59`, `ufixed64x60`, `ufixed64x61`, `ufixed64x62`, `ufixed64x63`, `ufixed64x64`, `ufixed64x65`, `ufixed64x66`, `ufixed64x67`, `ufixed64x68`, `ufixed64x69`, `ufixed64x70`, `ufixed64x71`, `ufixed64x72`, `ufixed64x73`, `ufixed64x74`, `ufixed64x75`, `ufixed64x76`, `ufixed64x77`, `ufixed64x78`, `ufixed64x79`, `ufixed64x80`, `ufixed72x0`, `ufixed72x1`, `ufixed72x2`, `ufixed72x3`, `ufixed72x4`, `ufixed72x5`, `ufixed72x6`, `ufixed72x7`, `ufixed72x8`, `ufixed72x9`, `ufixed72x10`, `ufixed72x11`, `ufixed72x12`, `ufixed72x13`, `ufixed72x14`, `ufixed72x15`, `ufixed72x16`, `ufixed72x17`, `ufixed72x18`, `ufixed72x19`, `ufixed72x20`, `ufixed72x21`, `ufixed72x22`, `ufixed72x23`, `ufixed72x24`, `ufixed72x25`, `ufixed72x26`, `ufixed72x27`, `ufixed72x28`, `ufixed72x29`, `ufixed72x30`, `ufixed72x31`, `ufixed72x32`, `ufixed72x33`, `ufixed72x34`, `ufixed72x35`, `ufixed72x36`, `ufixed72x37`, `ufixed72x38`, `ufixed72x39`, `ufixed72x40`, `ufixed72x41`, `ufixed72x42`, `ufixed72x43`, `ufixed72x44`, `ufixed72x45`, `ufixed72x46`, `ufixed72x47`, `ufixed72x48`, `ufixed72x49`, `ufixed72x50`, `ufixed72x51`, `ufixed72x52`, `ufixed72x53`, `ufixed72x54`, `ufixed72x55`, `ufixed72x56`, `ufixed72x57`, `ufixed72x58`, `ufixed72x59`, `ufixed72x60`, `ufixed72x61`, `ufixed72x62`, `ufixed72x63`, `ufixed72x64`, `ufixed72x65`, `ufixed72x66`, `ufixed72x67`, `ufixed72x68`, `ufixed72x69`, `ufixed72x70`, `ufixed72x71`, `ufixed72x72`, `ufixed72x73`, `ufixed72x74`, `ufixed72x75`, `ufixed72x76`, `ufixed72x77`, `ufixed72x78`, `ufixed72x79`, `ufixed72x80`, `ufixed80x0`, `ufixed80x1`, `ufixed80x2`, `ufixed80x3`, `ufixed80x4`, `ufixed80x5`, `ufixed80x6`, `ufixed80x7`, `ufixed80x8`, `ufixed80x9`, `ufixed80x10`, `ufixed80x11`, `ufixed80x12`, `ufixed80x13`, `ufixed80x14`, `ufixed80x15`, `ufixed80x16`, `ufixed80x17`, `ufixed80x18`, `ufixed80x19`, `ufixed80x20`, `ufixed80x21`, `ufixed80x22`, `ufixed80x23`, `ufixed80x24`, `ufixed80x25`, `ufixed80x26`, `ufixed80x27`, `ufixed80x28`, `ufixed80x29`, `ufixed80x30`, `ufixed80x31`, `ufixed80x32`, `ufixed80x33`, `ufixed80x34`, `ufixed80x35`, `ufixed80x36`, `ufixed80x37`, `ufixed80x38`, `ufixed80x39`, `ufixed80x40`, `ufixed80x41`, `ufixed80x42`, `ufixed80x43`, `ufixed80x44`, `ufixed80x45`, `ufixed80x46`, `ufixed80x47`, `ufixed80x48`, `ufixed80x49`, `ufixed80x50`, `ufixed80x51`, `ufixed80x52`, `ufixed80x53`, `ufixed80x54`, `ufixed80x55`, `ufixed80x56`, `ufixed80x57`, `ufixed80x58`, `ufixed80x59`, `ufixed80x60`, `ufixed80x61`, `ufixed80x62`, `ufixed80x63`, `ufixed80x64`, `ufixed80x65`, `ufixed80x66`, `ufixed80x67`, `ufixed80x68`, `ufixed80x69`, `ufixed80x70`, `ufixed80x71`, `ufixed80x72`, `ufixed80x73`, `ufixed80x74`, `ufixed80x75`, `ufixed80x76`, `ufixed80x77`, `ufixed80x78`, `ufixed80x79`, `ufixed80x80`, `ufixed88x0`, `ufixed88x1`, `ufixed88x2`, `ufixed88x3`, `ufixed88x4`, `ufixed88x5`, `ufixed88x6`, `ufixed88x7`, `ufixed88x8`, `ufixed88x9`, `ufixed88x10`, `ufixed88x11`, `ufixed88x12`, `ufixed88x13`, `ufixed88x14`, `ufixed88x15`, `ufixed88x16`, `ufixed88x17`, `ufixed88x18`, `ufixed88x19`, `ufixed88x20`, `ufixed88x21`, `ufixed88x22`, `ufixed88x23`, `ufixed88x24`, `ufixed88x25`, `ufixed88x26`, `ufixed88x27`, `ufixed88x28`, `ufixed88x29`, `ufixed88x30`, `ufixed88x31`, `ufixed88x32`, `ufixed88x33`, `ufixed88x34`, `ufixed88x35`, `ufixed88x36`, `ufixed88x37`, `ufixed88x38`, `ufixed88x39`, `ufixed88x40`, `ufixed88x41`, `ufixed88x42`, `ufixed88x43`, `ufixed88x44`, `ufixed88x45`, `ufixed88x46`, `ufixed88x47`, `ufixed88x48`, `ufixed88x49`, `ufixed88x50`, `ufixed88x51`, `ufixed88x52`, `ufixed88x53`, `ufixed88x54`, `ufixed88x55`, `ufixed88x56`, `ufixed88x57`, `ufixed88x58`, `ufixed88x59`, `ufixed88x60`, `ufixed88x61`, `ufixed88x62`, `ufixed88x63`, `ufixed88x64`, `ufixed88x65`, `ufixed88x66`, `ufixed88x67`, `ufixed88x68`, `ufixed88x69`, `ufixed88x70`, `ufixed88x71`, `ufixed88x72`, `ufixed88x73`, `ufixed88x74`, `ufixed88x75`, `ufixed88x76`, `ufixed88x77`, `ufixed88x78`, `ufixed88x79`, `ufixed88x80`, `ufixed96x0`, `ufixed96x1`, `ufixed96x2`, `ufixed96x3`, `ufixed96x4`, `ufixed96x5`, `ufixed96x6`, `ufixed96x7`, `ufixed96x8`, `ufixed96x9`, `ufixed96x10`, `ufixed96x11`, `ufixed96x12`, `ufixed96x13`, `ufixed96x14`, `ufixed96x15`, `ufixed96x16`, `ufixed96x17`, `ufixed96x18`, `ufixed96x19`, `ufixed96x20`, `ufixed96x21`, `ufixed96x22`, `ufixed96x23`, `ufixed96x24`, `ufixed96x25`, `ufixed96x26`, `ufixed96x27`, `ufixed96x28`, `ufixed96x29`, `ufixed96x30`, `ufixed96x31`, `ufixed96x32`, `ufixed96x33`, `ufixed96x34`, `ufixed96x35`, `ufixed96x36`, `ufixed96x37`, `ufixed96x38`, `ufixed96x39`, `ufixed96x40`, `ufixed96x41`, `ufixed96x42`, `ufixed96x43`, `ufixed96x44`, `ufixed96x45`, `ufixed96x46`, `ufixed96x47`, `ufixed96x48`, `ufixed96x49`, `ufixed96x50`, `ufixed96x51`, `ufixed96x52`, `ufixed96x53`, `ufixed96x54`, `ufixed96x55`, `ufixed96x56`, `ufixed96x57`, `ufixed96x58`, `ufixed96x59`, `ufixed96x60`, `ufixed96x61`, `ufixed96x62`, `ufixed96x63`, `ufixed96x64`, `ufixed96x65`, `ufixed96x66`, `ufixed96x67`, `ufixed96x68`, `ufixed96x69`, `ufixed96x70`, `ufixed96x71`, `ufixed96x72`, `ufixed96x73`, `ufixed96x74`, `ufixed96x75`, `ufixed96x76`, `ufixed96x77`, `ufixed96x78`, `ufixed96x79`, `ufixed96x80`, `ufixed104x0`, `ufixed104x1`, `ufixed104x2`, `ufixed104x3`, `ufixed104x4`, `ufixed104x5`, `ufixed104x6`, `ufixed104x7`, `ufixed104x8`, `ufixed104x9`, `ufixed104x10`, `ufixed104x11`, `ufixed104x12`, `ufixed104x13`, `ufixed104x14`, `ufixed104x15`, `ufixed104x16`, `ufixed104x17`, `ufixed104x18`, `ufixed104x19`, `ufixed104x20`, `ufixed104x21`, `ufixed104x22`, `ufixed104x23`, `ufixed104x24`, `ufixed104x25`, `ufixed104x26`, `ufixed104x27`, `ufixed104x28`, `ufixed104x29`, `ufixed104x30`, `ufixed104x31`, `ufixed104x32`, `ufixed104x33`, `ufixed104x34`, `ufixed104x35`, `ufixed104x36`, `ufixed104x37`, `ufixed104x38`, `ufixed104x39`, `ufixed104x40`, `ufixed104x41`, `ufixed104x42`, `ufixed104x43`, `ufixed104x44`, `ufixed104x45`, `ufixed104x46`, `ufixed104x47`, `ufixed104x48`, `ufixed104x49`, `ufixed104x50`, `ufixed104x51`, `ufixed104x52`, `ufixed104x53`, `ufixed104x54`, `ufixed104x55`, `ufixed104x56`, `ufixed104x57`, `ufixed104x58`, `ufixed104x59`, `ufixed104x60`, `ufixed104x61`, `ufixed104x62`, `ufixed104x63`, `ufixed104x64`, `ufixed104x65`, `ufixed104x66`, `ufixed104x67`, `ufixed104x68`, `ufixed104x69`, `ufixed104x70`, `ufixed104x71`, `ufixed104x72`, `ufixed104x73`, `ufixed104x74`, `ufixed104x75`, `ufixed104x76`, `ufixed104x77`, `ufixed104x78`, `ufixed104x79`, `ufixed104x80`, `ufixed112x0`, `ufixed112x1`, `ufixed112x2`, `ufixed112x3`, `ufixed112x4`, `ufixed112x5`, `ufixed112x6`, `ufixed112x7`, `ufixed112x8`, `ufixed112x9`, `ufixed112x10`, `ufixed112x11`, `ufixed112x12`, `ufixed112x13`, `ufixed112x14`, `ufixed112x15`, `ufixed112x16`, `ufixed112x17`, `ufixed112x18`, `ufixed112x19`, `ufixed112x20`, `ufixed112x21`, `ufixed112x22`, `ufixed112x23`, `ufixed112x24`, `ufixed112x25`, `ufixed112x26`, `ufixed112x27`, `ufixed112x28`, `ufixed112x29`, `ufixed112x30`, `ufixed112x31`, `ufixed112x32`, `ufixed112x33`, `ufixed112x34`, `ufixed112x35`, `ufixed112x36`, `ufixed112x37`, `ufixed112x38`, `ufixed112x39`, `ufixed112x40`, `ufixed112x41`, `ufixed112x42`, `ufixed112x43`, `ufixed112x44`, `ufixed112x45`, `ufixed112x46`, `ufixed112x47`, `ufixed112x48`, `ufixed112x49`, `ufixed112x50`, `ufixed112x51`, `ufixed112x52`, `ufixed112x53`, `ufixed112x54`, `ufixed112x55`, `ufixed112x56`, `ufixed112x57`, `ufixed112x58`, `ufixed112x59`, `ufixed112x60`, `ufixed112x61`, `ufixed112x62`, `ufixed112x63`, `ufixed112x64`, `ufixed112x65`, `ufixed112x66`, `ufixed112x67`, `ufixed112x68`, `ufixed112x69`, `ufixed112x70`, `ufixed112x71`, `ufixed112x72`, `ufixed112x73`, `ufixed112x74`, `ufixed112x75`, `ufixed112x76`, `ufixed112x77`, `ufixed112x78`, `ufixed112x79`, `ufixed112x80`, `ufixed120x0`, `ufixed120x1`, `ufixed120x2`, `ufixed120x3`, `ufixed120x4`, `ufixed120x5`, `ufixed120x6`, `ufixed120x7`, `ufixed120x8`, `ufixed120x9`, `ufixed120x10`, `ufixed120x11`, `ufixed120x12`, `ufixed120x13`, `ufixed120x14`, `ufixed120x15`, `ufixed120x16`, `ufixed120x17`, `ufixed120x18`, `ufixed120x19`, `ufixed120x20`, `ufixed120x21`, `ufixed120x22`, `ufixed120x23`, `ufixed120x24`, `ufixed120x25`, `ufixed120x26`, `ufixed120x27`, `ufixed120x28`, `ufixed120x29`, `ufixed120x30`, `ufixed120x31`, `ufixed120x32`, `ufixed120x33`, `ufixed120x34`, `ufixed120x35`, `ufixed120x36`, `ufixed120x37`, `ufixed120x38`, `ufixed120x39`, `ufixed120x40`, `ufixed120x41`, `ufixed120x42`, `ufixed120x43`, `ufixed120x44`, `ufixed120x45`, `ufixed120x46`, `ufixed120x47`, `ufixed120x48`, `ufixed120x49`, `ufixed120x50`, `ufixed120x51`, `ufixed120x52`, `ufixed120x53`, `ufixed120x54`, `ufixed120x55`, `ufixed120x56`, `ufixed120x57`, `ufixed120x58`, `ufixed120x59`, `ufixed120x60`, `ufixed120x61`, `ufixed120x62`, `ufixed120x63`, `ufixed120x64`, `ufixed120x65`, `ufixed120x66`, `ufixed120x67`, `ufixed120x68`, `ufixed120x69`, `ufixed120x70`, `ufixed120x71`, `ufixed120x72`, `ufixed120x73`, `ufixed120x74`, `ufixed120x75`, `ufixed120x76`, `ufixed120x77`, `ufixed120x78`, `ufixed120x79`, `ufixed120x80`, `ufixed128x0`, `ufixed128x1`, `ufixed128x2`, `ufixed128x3`, `ufixed128x4`, `ufixed128x5`, `ufixed128x6`, `ufixed128x7`, `ufixed128x8`, `ufixed128x9`, `ufixed128x10`, `ufixed128x11`, `ufixed128x12`, `ufixed128x13`, `ufixed128x14`, `ufixed128x15`, `ufixed128x16`, `ufixed128x17`, `ufixed128x18`, `ufixed128x19`, `ufixed128x20`, `ufixed128x21`, `ufixed128x22`, `ufixed128x23`, `ufixed128x24`, `ufixed128x25`, `ufixed128x26`, `ufixed128x27`, `ufixed128x28`, `ufixed128x29`, `ufixed128x30`, `ufixed128x31`, `ufixed128x32`, `ufixed128x33`, `ufixed128x34`, `ufixed128x35`, `ufixed128x36`, `ufixed128x37`, `ufixed128x38`, `ufixed128x39`, `ufixed128x40`, `ufixed128x41`, `ufixed128x42`, `ufixed128x43`, `ufixed128x44`, `ufixed128x45`, `ufixed128x46`, `ufixed128x47`, `ufixed128x48`, `ufixed128x49`, `ufixed128x50`, `ufixed128x51`, `ufixed128x52`, `ufixed128x53`, `ufixed128x54`, `ufixed128x55`, `ufixed128x56`, `ufixed128x57`, `ufixed128x58`, `ufixed128x59`, `ufixed128x60`, `ufixed128x61`, `ufixed128x62`, `ufixed128x63`, `ufixed128x64`, `ufixed128x65`, `ufixed128x66`, `ufixed128x67`, `ufixed128x68`, `ufixed128x69`, `ufixed128x70`, `ufixed128x71`, `ufixed128x72`, `ufixed128x73`, `ufixed128x74`, `ufixed128x75`, `ufixed128x76`, `ufixed128x77`, `ufixed128x78`, `ufixed128x79`, `ufixed128x80`, `ufixed136x0`, `ufixed136x1`, `ufixed136x2`, `ufixed136x3`, `ufixed136x4`, `ufixed136x5`, `ufixed136x6`, `ufixed136x7`, `ufixed136x8`, `ufixed136x9`, `ufixed136x10`, `ufixed136x11`, `ufixed136x12`, `ufixed136x13`, `ufixed136x14`, `ufixed136x15`, `ufixed136x16`, `ufixed136x17`, `ufixed136x18`, `ufixed136x19`, `ufixed136x20`, `ufixed136x21`, `ufixed136x22`, `ufixed136x23`, `ufixed136x24`, `ufixed136x25`, `ufixed136x26`, `ufixed136x27`, `ufixed136x28`, `ufixed136x29`, `ufixed136x30`, `ufixed136x31`, `ufixed136x32`, `ufixed136x33`, `ufixed136x34`, `ufixed136x35`, `ufixed136x36`, `ufixed136x37`, `ufixed136x38`, `ufixed136x39`, `ufixed136x40`, `ufixed136x41`, `ufixed136x42`, `ufixed136x43`, `ufixed136x44`, `ufixed136x45`, `ufixed136x46`, `ufixed136x47`, `ufixed136x48`, `ufixed136x49`, `ufixed136x50`, `ufixed136x51`, `ufixed136x52`, `ufixed136x53`, `ufixed136x54`, `ufixed136x55`, `ufixed136x56`, `ufixed136x57`, `ufixed136x58`, `ufixed136x59`, `ufixed136x60`, `ufixed136x61`, `ufixed136x62`, `ufixed136x63`, `ufixed136x64`, `ufixed136x65`, `ufixed136x66`, `ufixed136x67`, `ufixed136x68`, `ufixed136x69`, `ufixed136x70`, `ufixed136x71`, `ufixed136x72`, `ufixed136x73`, `ufixed136x74`, `ufixed136x75`, `ufixed136x76`, `ufixed136x77`, `ufixed136x78`, `ufixed136x79`, `ufixed136x80`, `ufixed144x0`, `ufixed144x1`, `ufixed144x2`, `ufixed144x3`, `ufixed144x4`, `ufixed144x5`, `ufixed144x6`, `ufixed144x7`, `ufixed144x8`, `ufixed144x9`, `ufixed144x10`, `ufixed144x11`, `ufixed144x12`, `ufixed144x13`, `ufixed144x14`, `ufixed144x15`, `ufixed144x16`, `ufixed144x17`, `ufixed144x18`, `ufixed144x19`, `ufixed144x20`, `ufixed144x21`, `ufixed144x22`, `ufixed144x23`, `ufixed144x24`, `ufixed144x25`, `ufixed144x26`, `ufixed144x27`, `ufixed144x28`, `ufixed144x29`, `ufixed144x30`, `ufixed144x31`, `ufixed144x32`, `ufixed144x33`, `ufixed144x34`, `ufixed144x35`, `ufixed144x36`, `ufixed144x37`, `ufixed144x38`, `ufixed144x39`, `ufixed144x40`, `ufixed144x41`, `ufixed144x42`, `ufixed144x43`, `ufixed144x44`, `ufixed144x45`, `ufixed144x46`, `ufixed144x47`, `ufixed144x48`, `ufixed144x49`, `ufixed144x50`, `ufixed144x51`, `ufixed144x52`, `ufixed144x53`, `ufixed144x54`, `ufixed144x55`, `ufixed144x56`, `ufixed144x57`, `ufixed144x58`, `ufixed144x59`, `ufixed144x60`, `ufixed144x61`, `ufixed144x62`, `ufixed144x63`, `ufixed144x64`, `ufixed144x65`, `ufixed144x66`, `ufixed144x67`, `ufixed144x68`, `ufixed144x69`, `ufixed144x70`, `ufixed144x71`, `ufixed144x72`, `ufixed144x73`, `ufixed144x74`, `ufixed144x75`, `ufixed144x76`, `ufixed144x77`, `ufixed144x78`, `ufixed144x79`, `ufixed144x80`, `ufixed152x0`, `ufixed152x1`, `ufixed152x2`, `ufixed152x3`, `ufixed152x4`, `ufixed152x5`, `ufixed152x6`, `ufixed152x7`, `ufixed152x8`, `ufixed152x9`, `ufixed152x10`, `ufixed152x11`, `ufixed152x12`, `ufixed152x13`, `ufixed152x14`, `ufixed152x15`, `ufixed152x16`, `ufixed152x17`, `ufixed152x18`, `ufixed152x19`, `ufixed152x20`, `ufixed152x21`, `ufixed152x22`, `ufixed152x23`, `ufixed152x24`, `ufixed152x25`, `ufixed152x26`, `ufixed152x27`, `ufixed152x28`, `ufixed152x29`, `ufixed152x30`, `ufixed152x31`, `ufixed152x32`, `ufixed152x33`, `ufixed152x34`, `ufixed152x35`, `ufixed152x36`, `ufixed152x37`, `ufixed152x38`, `ufixed152x39`, `ufixed152x40`, `ufixed152x41`, `ufixed152x42`, `ufixed152x43`, `ufixed152x44`, `ufixed152x45`, `ufixed152x46`, `ufixed152x47`, `ufixed152x48`, `ufixed152x49`, `ufixed152x50`, `ufixed152x51`, `ufixed152x52`, `ufixed152x53`, `ufixed152x54`, `ufixed152x55`, `ufixed152x56`, `ufixed152x57`, `ufixed152x58`, `ufixed152x59`, `ufixed152x60`, `ufixed152x61`, `ufixed152x62`, `ufixed152x63`, `ufixed152x64`, `ufixed152x65`, `ufixed152x66`, `ufixed152x67`, `ufixed152x68`, `ufixed152x69`, `ufixed152x70`, `ufixed152x71`, `ufixed152x72`, `ufixed152x73`, `ufixed152x74`, `ufixed152x75`, `ufixed152x76`, `ufixed152x77`, `ufixed152x78`, `ufixed152x79`, `ufixed152x80`, `ufixed160x0`, `ufixed160x1`, `ufixed160x2`, `ufixed160x3`, `ufixed160x4`, `ufixed160x5`, `ufixed160x6`, `ufixed160x7`, `ufixed160x8`, `ufixed160x9`, `ufixed160x10`, `ufixed160x11`, `ufixed160x12`, `ufixed160x13`, `ufixed160x14`, `ufixed160x15`, `ufixed160x16`, `ufixed160x17`, `ufixed160x18`, `ufixed160x19`, `ufixed160x20`, `ufixed160x21`, `ufixed160x22`, `ufixed160x23`, `ufixed160x24`, `ufixed160x25`, `ufixed160x26`, `ufixed160x27`, `ufixed160x28`, `ufixed160x29`, `ufixed160x30`, `ufixed160x31`, `ufixed160x32`, `ufixed160x33`, `ufixed160x34`, `ufixed160x35`, `ufixed160x36`, `ufixed160x37`, `ufixed160x38`, `ufixed160x39`, `ufixed160x40`, `ufixed160x41`, `ufixed160x42`, `ufixed160x43`, `ufixed160x44`, `ufixed160x45`, `ufixed160x46`, `ufixed160x47`, `ufixed160x48`, `ufixed160x49`, `ufixed160x50`, `ufixed160x51`, `ufixed160x52`, `ufixed160x53`, `ufixed160x54`, `ufixed160x55`, `ufixed160x56`, `ufixed160x57`, `ufixed160x58`, `ufixed160x59`, `ufixed160x60`, `ufixed160x61`, `ufixed160x62`, `ufixed160x63`, `ufixed160x64`, `ufixed160x65`, `ufixed160x66`, `ufixed160x67`, `ufixed160x68`, `ufixed160x69`, `ufixed160x70`, `ufixed160x71`, `ufixed160x72`, `ufixed160x73`, `ufixed160x74`, `ufixed160x75`, `ufixed160x76`, `ufixed160x77`, `ufixed160x78`, `ufixed160x79`, `ufixed160x80`, `ufixed168x0`, `ufixed168x1`, `ufixed168x2`, `ufixed168x3`, `ufixed168x4`, `ufixed168x5`, `ufixed168x6`, `ufixed168x7`, `ufixed168x8`, `ufixed168x9`, `ufixed168x10`, `ufixed168x11`, `ufixed168x12`, `ufixed168x13`, `ufixed168x14`, `ufixed168x15`, `ufixed168x16`, `ufixed168x17`, `ufixed168x18`, `ufixed168x19`, `ufixed168x20`, `ufixed168x21`, `ufixed168x22`, `ufixed168x23`, `ufixed168x24`, `ufixed168x25`, `ufixed168x26`, `ufixed168x27`, `ufixed168x28`, `ufixed168x29`, `ufixed168x30`, `ufixed168x31`, `ufixed168x32`, `ufixed168x33`, `ufixed168x34`, `ufixed168x35`, `ufixed168x36`, `ufixed168x37`, `ufixed168x38`, `ufixed168x39`, `ufixed168x40`, `ufixed168x41`, `ufixed168x42`, `ufixed168x43`, `ufixed168x44`, `ufixed168x45`, `ufixed168x46`, `ufixed168x47`, `ufixed168x48`, `ufixed168x49`, `ufixed168x50`, `ufixed168x51`, `ufixed168x52`, `ufixed168x53`, `ufixed168x54`, `ufixed168x55`, `ufixed168x56`, `ufixed168x57`, `ufixed168x58`, `ufixed168x59`, `ufixed168x60`, `ufixed168x61`, `ufixed168x62`, `ufixed168x63`, `ufixed168x64`, `ufixed168x65`, `ufixed168x66`, `ufixed168x67`, `ufixed168x68`, `ufixed168x69`, `ufixed168x70`, `ufixed168x71`, `ufixed168x72`, `ufixed168x73`, `ufixed168x74`, `ufixed168x75`, `ufixed168x76`, `ufixed168x77`, `ufixed168x78`, `ufixed168x79`, `ufixed168x80`, `ufixed176x0`, `ufixed176x1`, `ufixed176x2`, `ufixed176x3`, `ufixed176x4`, `ufixed176x5`, `ufixed176x6`, `ufixed176x7`, `ufixed176x8`, `ufixed176x9`, `ufixed176x10`, `ufixed176x11`, `ufixed176x12`, `ufixed176x13`, `ufixed176x14`, `ufixed176x15`, `ufixed176x16`, `ufixed176x17`, `ufixed176x18`, `ufixed176x19`, `ufixed176x20`, `ufixed176x21`, `ufixed176x22`, `ufixed176x23`, `ufixed176x24`, `ufixed176x25`, `ufixed176x26`, `ufixed176x27`, `ufixed176x28`, `ufixed176x29`, `ufixed176x30`, `ufixed176x31`, `ufixed176x32`, `ufixed176x33`, `ufixed176x34`, `ufixed176x35`, `ufixed176x36`, `ufixed176x37`, `ufixed176x38`, `ufixed176x39`, `ufixed176x40`, `ufixed176x41`, `ufixed176x42`, `ufixed176x43`, `ufixed176x44`, `ufixed176x45`, `ufixed176x46`, `ufixed176x47`, `ufixed176x48`, `ufixed176x49`, `ufixed176x50`, `ufixed176x51`, `ufixed176x52`, `ufixed176x53`, `ufixed176x54`, `ufixed176x55`, `ufixed176x56`, `ufixed176x57`, `ufixed176x58`, `ufixed176x59`, `ufixed176x60`, `ufixed176x61`, `ufixed176x62`, `ufixed176x63`, `ufixed176x64`, `ufixed176x65`, `ufixed176x66`, `ufixed176x67`, `ufixed176x68`, `ufixed176x69`, `ufixed176x70`, `ufixed176x71`, `ufixed176x72`, `ufixed176x73`, `ufixed176x74`, `ufixed176x75`, `ufixed176x76`, `ufixed176x77`, `ufixed176x78`, `ufixed176x79`, `ufixed176x80`, `ufixed184x0`, `ufixed184x1`, `ufixed184x2`, `ufixed184x3`, `ufixed184x4`, `ufixed184x5`, `ufixed184x6`, `ufixed184x7`, `ufixed184x8`, `ufixed184x9`, `ufixed184x10`, `ufixed184x11`, `ufixed184x12`, `ufixed184x13`, `ufixed184x14`, `ufixed184x15`, `ufixed184x16`, `ufixed184x17`, `ufixed184x18`, `ufixed184x19`, `ufixed184x20`, `ufixed184x21`, `ufixed184x22`, `ufixed184x23`, `ufixed184x24`, `ufixed184x25`, `ufixed184x26`, `ufixed184x27`, `ufixed184x28`, `ufixed184x29`, `ufixed184x30`, `ufixed184x31`, `ufixed184x32`, `ufixed184x33`, `ufixed184x34`, `ufixed184x35`, `ufixed184x36`, `ufixed184x37`, `ufixed184x38`, `ufixed184x39`, `ufixed184x40`, `ufixed184x41`, `ufixed184x42`, `ufixed184x43`, `ufixed184x44`, `ufixed184x45`, `ufixed184x46`, `ufixed184x47`, `ufixed184x48`, `ufixed184x49`, `ufixed184x50`, `ufixed184x51`, `ufixed184x52`, `ufixed184x53`, `ufixed184x54`, `ufixed184x55`, `ufixed184x56`, `ufixed184x57`, `ufixed184x58`, `ufixed184x59`, `ufixed184x60`, `ufixed184x61`, `ufixed184x62`, `ufixed184x63`, `ufixed184x64`, `ufixed184x65`, `ufixed184x66`, `ufixed184x67`, `ufixed184x68`, `ufixed184x69`, `ufixed184x70`, `ufixed184x71`, `ufixed184x72`, `ufixed192x0`, `ufixed192x1`, `ufixed192x2`, `ufixed192x3`, `ufixed192x4`, `ufixed192x5`, `ufixed192x6`, `ufixed192x7`, `ufixed192x8`, `ufixed192x9`, `ufixed192x10`, `ufixed192x11`, `ufixed192x12`, `ufixed192x13`, `ufixed192x14`, `ufixed192x15`, `ufixed192x16`, `ufixed192x17`, `ufixed192x18`, `ufixed192x19`, `ufixed192x20`, `ufixed192x21`, `ufixed192x22`, `ufixed192x23`, `ufixed192x24`, `ufixed192x25`, `ufixed192x26`, `ufixed192x27`, `ufixed192x28`, `ufixed192x29`, `ufixed192x30`, `ufixed192x31`, `ufixed192x32`, `ufixed192x33`, `ufixed192x34`, `ufixed192x35`, `ufixed192x36`, `ufixed192x37`, `ufixed192x38`, `ufixed192x39`, `ufixed192x40`, `ufixed192x41`, `ufixed192x42`, `ufixed192x43`, `ufixed192x44`, `ufixed192x45`, `ufixed192x46`, `ufixed192x47`, `ufixed192x48`, `ufixed192x49`, `ufixed192x50`, `ufixed192x51`, `ufixed192x52`, `ufixed192x53`, `ufixed192x54`, `ufixed192x55`, `ufixed192x56`, `ufixed192x57`, `ufixed192x58`, `ufixed192x59`, `ufixed192x60`, `ufixed192x61`, `ufixed192x62`, `ufixed192x63`, `ufixed192x64`, `ufixed200x0`, `ufixed200x1`, `ufixed200x2`, `ufixed200x3`, `ufixed200x4`, `ufixed200x5`, `ufixed200x6`, `ufixed200x7`, `ufixed200x8`, `ufixed200x9`, `ufixed200x10`, `ufixed200x11`, `ufixed200x12`, `ufixed200x13`, `ufixed200x14`, `ufixed200x15`, `ufixed200x16`, `ufixed200x17`, `ufixed200x18`, `ufixed200x19`, `ufixed200x20`, `ufixed200x21`, `ufixed200x22`, `ufixed200x23`, `ufixed200x24`, `ufixed200x25`, `ufixed200x26`, `ufixed200x27`, `ufixed200x28`, `ufixed200x29`, `ufixed200x30`, `ufixed200x31`, `ufixed200x32`, `ufixed200x33`, `ufixed200x34`, `ufixed200x35`, `ufixed200x36`, `ufixed200x37`, `ufixed200x38`, `ufixed200x39`, `ufixed200x40`, `ufixed200x41`, `ufixed200x42`, `ufixed200x43`, `ufixed200x44`, `ufixed200x45`, `ufixed200x46`, `ufixed200x47`, `ufixed200x48`, `ufixed200x49`, `ufixed200x50`, `ufixed200x51`, `ufixed200x52`, `ufixed200x53`, `ufixed200x54`, `ufixed200x55`, `ufixed200x56`, `ufixed208x0`, `ufixed208x1`, `ufixed208x2`, `ufixed208x3`, `ufixed208x4`, `ufixed208x5`, `ufixed208x6`, `ufixed208x7`, `ufixed208x8`, `ufixed208x9`, `ufixed208x10`, `ufixed208x11`, `ufixed208x12`, `ufixed208x13`, `ufixed208x14`, `ufixed208x15`, `ufixed208x16`, `ufixed208x17`, `ufixed208x18`, `ufixed208x19`, `ufixed208x20`, `ufixed208x21`, `ufixed208x22`, `ufixed208x23`, `ufixed208x24`, `ufixed208x25`, `ufixed208x26`, `ufixed208x27`, `ufixed208x28`, `ufixed208x29`, `ufixed208x30`, `ufixed208x31`, `ufixed208x32`, `ufixed208x33`, `ufixed208x34`, `ufixed208x35`, `ufixed208x36`, `ufixed208x37`, `ufixed208x38`, `ufixed208x39`, `ufixed208x40`, `ufixed208x41`, `ufixed208x42`, `ufixed208x43`, `ufixed208x44`, `ufixed208x45`, `ufixed208x46`, `ufixed208x47`, `ufixed208x48`, `ufixed216x0`, `ufixed216x1`, `ufixed216x2`, `ufixed216x3`, `ufixed216x4`, `ufixed216x5`, `ufixed216x6`, `ufixed216x7`, `ufixed216x8`, `ufixed216x9`, `ufixed216x10`, `ufixed216x11`, `ufixed216x12`, `ufixed216x13`, `ufixed216x14`, `ufixed216x15`, `ufixed216x16`, `ufixed216x17`, `ufixed216x18`, `ufixed216x19`, `ufixed216x20`, `ufixed216x21`, `ufixed216x22`, `ufixed216x23`, `ufixed216x24`, `ufixed216x25`, `ufixed216x26`, `ufixed216x27`, `ufixed216x28`, `ufixed216x29`, `ufixed216x30`, `ufixed216x31`, `ufixed216x32`, `ufixed216x33`, `ufixed216x34`, `ufixed216x35`, `ufixed216x36`, `ufixed216x37`, `ufixed216x38`, `ufixed216x39`, `ufixed216x40`, `ufixed224x0`, `ufixed224x1`, `ufixed224x2`, `ufixed224x3`, `ufixed224x4`, `ufixed224x5`, `ufixed224x6`, `ufixed224x7`, `ufixed224x8`, `ufixed224x9`, `ufixed224x10`, `ufixed224x11`, `ufixed224x12`, `ufixed224x13`, `ufixed224x14`, `ufixed224x15`, `ufixed224x16`, `ufixed224x17`, `ufixed224x18`, `ufixed224x19`, `ufixed224x20`, `ufixed224x21`, `ufixed224x22`, `ufixed224x23`, `ufixed224x24`, `ufixed224x25`, `ufixed224x26`, `ufixed224x27`, `ufixed224x28`, `ufixed224x29`, `ufixed224x30`, `ufixed224x31`, `ufixed224x32`, `ufixed232x0`, `ufixed232x1`, `ufixed232x2`, `ufixed232x3`, `ufixed232x4`, `ufixed232x5`, `ufixed232x6`, `ufixed232x7`, `ufixed232x8`, `ufixed232x9`, `ufixed232x10`, `ufixed232x11`, `ufixed232x12`, `ufixed232x13`, `ufixed232x14`, `ufixed232x15`, `ufixed232x16`, `ufixed232x17`, `ufixed232x18`, `ufixed232x19`, `ufixed232x20`, `ufixed232x21`, `ufixed232x22`, `ufixed232x23`, `ufixed232x24`, `ufixed240x0`, `ufixed240x1`, `ufixed240x2`, `ufixed240x3`, `ufixed240x4`, `ufixed240x5`, `ufixed240x6`, `ufixed240x7`, `ufixed240x8`, `ufixed240x9`, `ufixed240x10`, `ufixed240x11`, `ufixed240x12`, `ufixed240x13`, `ufixed240x14`, `ufixed240x15`, `ufixed240x16`, `ufixed248x0`, `ufixed248x1`, `ufixed248x2`, `ufixed248x3`, `ufixed248x4`, `ufixed248x5`, `ufixed248x6`, `ufixed248x7`, `ufixed248x8`, `ufixed256x0`), KeywordType, nil}, + }, + "numbers": { + {`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + }, + "string-parse-common": { + {`\\(u[0-9a-fA-F]{4}|x..|[^x])`, LiteralStringEscape, nil}, + {`[^\\"\'\n]+`, LiteralString, nil}, + {`\\\n`, LiteralString, nil}, + {`\\`, LiteralString, nil}, + }, + "string-parse-double": { + {`"`, LiteralString, Pop(1)}, + {`'`, LiteralString, nil}, + }, + "string-parse-single": { + {`'`, LiteralString, Pop(1)}, + {`"`, LiteralString, nil}, + }, + "strings": { + {`hex'[0-9a-fA-F]+'`, LiteralString, nil}, + {`hex"[0-9a-fA-F]+"`, LiteralString, nil}, + {`"`, LiteralString, Combined("string-parse-common", "string-parse-double")}, + {`'`, LiteralString, Combined("string-parse-common", "string-parse-single")}, + }, + "whitespace": { + {`\s+`, Text, nil}, + }, + "root": { + Include("comments"), + Include("keywords-types"), + Include("keywords-other"), + Include("numbers"), + Include("strings"), + Include("whitespace"), + {`\+\+|--|\*\*|\?|:|~|&&|\|\||=>|==?|!=?|(<<|>>>?|[-<>+*%&|^/])=?`, Operator, nil}, + {`[{(\[;,]`, Punctuation, nil}, + {`[})\].]`, Punctuation, nil}, + {`(block|msg|now|this|super|tx)\b`, NameBuiltin, nil}, + {`(sender|origin)\b`, NameBuiltin, nil}, + {`(gas|value)\b`, NameBuiltin, nil}, + {`(selfdestruct|suicide)\b`, NameBuiltin, nil}, + {`(balance|send|transfer)\b`, NameBuiltin, nil}, + {`(assert|revert|require)\b`, NameBuiltin, nil}, + {`(call|callcode|delegatecall)\b`, NameBuiltin, nil}, + {`selector\b`, NameBuiltin, nil}, + {`(addmod|ecrecover|keccak256|mulmod|ripemd160|sha256|sha3)\b`, NameFunction, nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/sparql.go b/vendor/github.com/alecthomas/chroma/lexers/s/sparql.go new file mode 100644 index 000000000..47a1716b3 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/sparql.go @@ -0,0 +1,69 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Sparql lexer. +var Sparql = internal.Register(MustNewLexer( + &Config{ + Name: "SPARQL", + Aliases: []string{"sparql"}, + Filenames: []string{"*.rq", "*.sparql"}, + MimeTypes: []string{"application/sparql-query"}, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`((?i)select|construct|describe|ask|where|filter|group\s+by|minus|distinct|reduced|from\s+named|from|order\s+by|desc|asc|limit|offset|bindings|load|clear|drop|create|add|move|copy|insert\s+data|delete\s+data|delete\s+where|delete|insert|using\s+named|using|graph|default|named|all|optional|service|silent|bind|union|not\s+in|in|as|having|to|prefix|base)\b`, Keyword, nil}, + {`(a)\b`, Keyword, nil}, + {"(<(?:[^<>\"{}|^`\\\\\\x00-\\x20])*>)", NameLabel, nil}, + {`(_:[0-9a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_](?:[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_\-0-9·̀-ͯ‿-⁀.]*[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_\-0-9·̀-ͯ‿-⁀])?)`, NameLabel, nil}, + {`[?$][0-9a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_][a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9·̀-ͯ‿-⁀]*`, NameVariable, nil}, + {`([a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�](?:[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_\-0-9·̀-ͯ‿-⁀.]*[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_\-0-9·̀-ͯ‿-⁀])?)?(\:)((?:[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_:0-9]|(?:%[0-9A-Fa-f][0-9A-Fa-f])|(?:\\[ _~.\-!$&"()*+,;=/?#@%]))(?:(?:[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_\-0-9·̀-ͯ‿-⁀.:]|(?:%[0-9A-Fa-f][0-9A-Fa-f])|(?:\\[ _~.\-!$&"()*+,;=/?#@%]))*(?:[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_\-0-9·̀-ͯ‿-⁀:]|(?:%[0-9A-Fa-f][0-9A-Fa-f])|(?:\\[ _~.\-!$&"()*+,;=/?#@%])))?)?`, ByGroups(NameNamespace, Punctuation, NameTag), nil}, + {`((?i)str|lang|langmatches|datatype|bound|iri|uri|bnode|rand|abs|ceil|floor|round|concat|strlen|ucase|lcase|encode_for_uri|contains|strstarts|strends|strbefore|strafter|year|month|day|hours|minutes|seconds|timezone|tz|now|md5|sha1|sha256|sha384|sha512|coalesce|if|strlang|strdt|sameterm|isiri|isuri|isblank|isliteral|isnumeric|regex|substr|replace|exists|not\s+exists|count|sum|min|max|avg|sample|group_concat|separator)\b`, NameFunction, nil}, + {`(true|false)`, KeywordConstant, nil}, + {`[+\-]?(\d+\.\d*[eE][+-]?\d+|\.?\d+[eE][+-]?\d+)`, LiteralNumberFloat, nil}, + {`[+\-]?(\d+\.\d*|\.\d+)`, LiteralNumberFloat, nil}, + {`[+\-]?\d+`, LiteralNumberInteger, nil}, + {`(\|\||&&|=|\*|\-|\+|/|!=|<=|>=|!|<|>)`, Operator, nil}, + {`[(){}.;,:^\[\]]`, Punctuation, nil}, + {`#[^\n]*`, Comment, nil}, + {`"""`, LiteralString, Push("triple-double-quoted-string")}, + {`"`, LiteralString, Push("single-double-quoted-string")}, + {`'''`, LiteralString, Push("triple-single-quoted-string")}, + {`'`, LiteralString, Push("single-single-quoted-string")}, + }, + "triple-double-quoted-string": { + {`"""`, LiteralString, Push("end-of-string")}, + {`[^\\]+`, LiteralString, nil}, + {`\\`, LiteralString, Push("string-escape")}, + }, + "single-double-quoted-string": { + {`"`, LiteralString, Push("end-of-string")}, + {`[^"\\\n]+`, LiteralString, nil}, + {`\\`, LiteralString, Push("string-escape")}, + }, + "triple-single-quoted-string": { + {`'''`, LiteralString, Push("end-of-string")}, + {`[^\\]+`, LiteralString, nil}, + {`\\`, LiteralStringEscape, Push("string-escape")}, + }, + "single-single-quoted-string": { + {`'`, LiteralString, Push("end-of-string")}, + {`[^'\\\n]+`, LiteralString, nil}, + {`\\`, LiteralString, Push("string-escape")}, + }, + "string-escape": { + {`u[0-9A-Fa-f]{4}`, LiteralStringEscape, Pop(1)}, + {`U[0-9A-Fa-f]{8}`, LiteralStringEscape, Pop(1)}, + {`.`, LiteralStringEscape, Pop(1)}, + }, + "end-of-string": { + {`(@)([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)`, ByGroups(Operator, NameFunction), Pop(2)}, + {`\^\^`, Operator, Pop(2)}, + Default(Pop(2)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/sql.go b/vendor/github.com/alecthomas/chroma/lexers/s/sql.go new file mode 100644 index 000000000..6f4e3e079 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/sql.go @@ -0,0 +1,49 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// SQL lexer. +var SQL = internal.Register(MustNewLexer( + &Config{ + Name: "SQL", + Aliases: []string{"sql"}, + Filenames: []string{"*.sql"}, + MimeTypes: []string{"text/x-sql"}, + NotMultiline: true, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`--.*\n?`, CommentSingle, nil}, + {`/\*`, CommentMultiline, Push("multiline-comments")}, + {`'`, LiteralStringSingle, Push("string")}, + {`"`, LiteralStringDouble, Push("double-string")}, + {Words(``, `\b`, `ABORT`, `ABS`, `ABSOLUTE`, `ACCESS`, `ADA`, `ADD`, `ADMIN`, `AFTER`, `AGGREGATE`, `ALIAS`, `ALL`, `ALLOCATE`, `ALTER`, `ANALYSE`, `ANALYZE`, `AND`, `ANY`, `ARE`, `AS`, `ASC`, `ASENSITIVE`, `ASSERTION`, `ASSIGNMENT`, `ASYMMETRIC`, `AT`, `ATOMIC`, `AUTHORIZATION`, `AVG`, `BACKWARD`, `BEFORE`, `BEGIN`, `BETWEEN`, `BITVAR`, `BIT_LENGTH`, `BOTH`, `BREADTH`, `BY`, `C`, `CACHE`, `CALL`, `CALLED`, `CARDINALITY`, `CASCADE`, `CASCADED`, `CASE`, `CAST`, `CATALOG`, `CATALOG_NAME`, `CHAIN`, `CHARACTERISTICS`, `CHARACTER_LENGTH`, `CHARACTER_SET_CATALOG`, `CHARACTER_SET_NAME`, `CHARACTER_SET_SCHEMA`, `CHAR_LENGTH`, `CHECK`, `CHECKED`, `CHECKPOINT`, `CLASS`, `CLASS_ORIGIN`, `CLOB`, `CLOSE`, `CLUSTER`, `COALSECE`, `COBOL`, `COLLATE`, `COLLATION`, `COLLATION_CATALOG`, `COLLATION_NAME`, `COLLATION_SCHEMA`, `COLUMN`, `COLUMN_NAME`, `COMMAND_FUNCTION`, `COMMAND_FUNCTION_CODE`, `COMMENT`, `COMMIT`, `COMMITTED`, `COMPLETION`, `CONDITION_NUMBER`, `CONNECT`, `CONNECTION`, `CONNECTION_NAME`, `CONSTRAINT`, `CONSTRAINTS`, `CONSTRAINT_CATALOG`, `CONSTRAINT_NAME`, `CONSTRAINT_SCHEMA`, `CONSTRUCTOR`, `CONTAINS`, `CONTINUE`, `CONVERSION`, `CONVERT`, `COPY`, `CORRESPONTING`, `COUNT`, `CREATE`, `CREATEDB`, `CREATEUSER`, `CROSS`, `CUBE`, `CURRENT`, `CURRENT_DATE`, `CURRENT_PATH`, `CURRENT_ROLE`, `CURRENT_TIME`, `CURRENT_TIMESTAMP`, `CURRENT_USER`, `CURSOR`, `CURSOR_NAME`, `CYCLE`, `DATA`, `DATABASE`, `DATETIME_INTERVAL_CODE`, `DATETIME_INTERVAL_PRECISION`, `DAY`, `DEALLOCATE`, `DECLARE`, `DEFAULT`, `DEFAULTS`, `DEFERRABLE`, `DEFERRED`, `DEFINED`, `DEFINER`, `DELETE`, `DELIMITER`, `DELIMITERS`, `DEREF`, `DESC`, `DESCRIBE`, `DESCRIPTOR`, `DESTROY`, `DESTRUCTOR`, `DETERMINISTIC`, `DIAGNOSTICS`, `DICTIONARY`, `DISCONNECT`, `DISPATCH`, `DISTINCT`, `DO`, `DOMAIN`, `DROP`, `DYNAMIC`, `DYNAMIC_FUNCTION`, `DYNAMIC_FUNCTION_CODE`, `EACH`, `ELSE`, `ELSIF`, `ENCODING`, `ENCRYPTED`, `END`, `END-EXEC`, `EQUALS`, `ESCAPE`, `EVERY`, `EXCEPTION`, `EXCEPT`, `EXCLUDING`, `EXCLUSIVE`, `EXEC`, `EXECUTE`, `EXISTING`, `EXISTS`, `EXPLAIN`, `EXTERNAL`, `EXTRACT`, `FALSE`, `FETCH`, `FINAL`, `FIRST`, `FOR`, `FORCE`, `FOREIGN`, `FORTRAN`, `FORWARD`, `FOUND`, `FREE`, `FREEZE`, `FROM`, `FULL`, `FUNCTION`, `G`, `GENERAL`, `GENERATED`, `GET`, `GLOBAL`, `GO`, `GOTO`, `GRANT`, `GRANTED`, `GROUP`, `GROUPING`, `HANDLER`, `HAVING`, `HIERARCHY`, `HOLD`, `HOST`, `IDENTITY`, `IF`, `IGNORE`, `ILIKE`, `IMMEDIATE`, `IMMUTABLE`, `IMPLEMENTATION`, `IMPLICIT`, `IN`, `INCLUDING`, `INCREMENT`, `INDEX`, `INDITCATOR`, `INFIX`, `INHERITS`, `INITIALIZE`, `INITIALLY`, `INNER`, `INOUT`, `INPUT`, `INSENSITIVE`, `INSERT`, `INSTANTIABLE`, `INSTEAD`, `INTERSECT`, `INTO`, `INVOKER`, `IS`, `ISNULL`, `ISOLATION`, `ITERATE`, `JOIN`, `KEY`, `KEY_MEMBER`, `KEY_TYPE`, `LANCOMPILER`, `LANGUAGE`, `LARGE`, `LAST`, `LATERAL`, `LEADING`, `LEFT`, `LENGTH`, `LESS`, `LEVEL`, `LIKE`, `LIMIT`, `LISTEN`, `LOAD`, `LOCAL`, `LOCALTIME`, `LOCALTIMESTAMP`, `LOCATION`, `LOCATOR`, `LOCK`, `LOWER`, `MAP`, `MATCH`, `MAX`, `MAXVALUE`, `MESSAGE_LENGTH`, `MESSAGE_OCTET_LENGTH`, `MESSAGE_TEXT`, `METHOD`, `MIN`, `MINUTE`, `MINVALUE`, `MOD`, `MODE`, `MODIFIES`, `MODIFY`, `MONTH`, `MORE`, `MOVE`, `MUMPS`, `NAMES`, `NATIONAL`, `NATURAL`, `NCHAR`, `NCLOB`, `NEW`, `NEXT`, `NO`, `NOCREATEDB`, `NOCREATEUSER`, `NONE`, `NOT`, `NOTHING`, `NOTIFY`, `NOTNULL`, `NULL`, `NULLABLE`, `NULLIF`, `OBJECT`, `OCTET_LENGTH`, `OF`, `OFF`, `OFFSET`, `OIDS`, `OLD`, `ON`, `ONLY`, `OPEN`, `OPERATION`, `OPERATOR`, `OPTION`, `OPTIONS`, `OR`, `ORDER`, `ORDINALITY`, `OUT`, `OUTER`, `OUTPUT`, `OVERLAPS`, `OVERLAY`, `OVERRIDING`, `OWNER`, `PAD`, `PARAMETER`, `PARAMETERS`, `PARAMETER_MODE`, `PARAMATER_NAME`, `PARAMATER_ORDINAL_POSITION`, `PARAMETER_SPECIFIC_CATALOG`, `PARAMETER_SPECIFIC_NAME`, `PARAMATER_SPECIFIC_SCHEMA`, `PARTIAL`, `PASCAL`, `PENDANT`, `PLACING`, `PLI`, `POSITION`, `POSTFIX`, `PRECISION`, `PREFIX`, `PREORDER`, `PREPARE`, `PRESERVE`, `PRIMARY`, `PRIOR`, `PRIVILEGES`, `PROCEDURAL`, `PROCEDURE`, `PUBLIC`, `READ`, `READS`, `RECHECK`, `RECURSIVE`, `REF`, `REFERENCES`, `REFERENCING`, `REINDEX`, `RELATIVE`, `RENAME`, `REPEATABLE`, `REPLACE`, `RESET`, `RESTART`, `RESTRICT`, `RESULT`, `RETURN`, `RETURNED_LENGTH`, `RETURNED_OCTET_LENGTH`, `RETURNED_SQLSTATE`, `RETURNS`, `REVOKE`, `RIGHT`, `ROLE`, `ROLLBACK`, `ROLLUP`, `ROUTINE`, `ROUTINE_CATALOG`, `ROUTINE_NAME`, `ROUTINE_SCHEMA`, `ROW`, `ROWS`, `ROW_COUNT`, `RULE`, `SAVE_POINT`, `SCALE`, `SCHEMA`, `SCHEMA_NAME`, `SCOPE`, `SCROLL`, `SEARCH`, `SECOND`, `SECURITY`, `SELECT`, `SELF`, `SENSITIVE`, `SERIALIZABLE`, `SERVER_NAME`, `SESSION`, `SESSION_USER`, `SET`, `SETOF`, `SETS`, `SHARE`, `SHOW`, `SIMILAR`, `SIMPLE`, `SIZE`, `SOME`, `SOURCE`, `SPACE`, `SPECIFIC`, `SPECIFICTYPE`, `SPECIFIC_NAME`, `SQL`, `SQLCODE`, `SQLERROR`, `SQLEXCEPTION`, `SQLSTATE`, `SQLWARNINIG`, `STABLE`, `START`, `STATE`, `STATEMENT`, `STATIC`, `STATISTICS`, `STDIN`, `STDOUT`, `STORAGE`, `STRICT`, `STRUCTURE`, `STYPE`, `SUBCLASS_ORIGIN`, `SUBLIST`, `SUBSTRING`, `SUM`, `SYMMETRIC`, `SYSID`, `SYSTEM`, `SYSTEM_USER`, `TABLE`, `TABLE_NAME`, ` TEMP`, `TEMPLATE`, `TEMPORARY`, `TERMINATE`, `THAN`, `THEN`, `TIMESTAMP`, `TIMEZONE_HOUR`, `TIMEZONE_MINUTE`, `TO`, `TOAST`, `TRAILING`, `TRANSACTION`, `TRANSACTIONS_COMMITTED`, `TRANSACTIONS_ROLLED_BACK`, `TRANSACTION_ACTIVE`, `TRANSFORM`, `TRANSFORMS`, `TRANSLATE`, `TRANSLATION`, `TREAT`, `TRIGGER`, `TRIGGER_CATALOG`, `TRIGGER_NAME`, `TRIGGER_SCHEMA`, `TRIM`, `TRUE`, `TRUNCATE`, `TRUSTED`, `TYPE`, `UNCOMMITTED`, `UNDER`, `UNENCRYPTED`, `UNION`, `UNIQUE`, `UNKNOWN`, `UNLISTEN`, `UNNAMED`, `UNNEST`, `UNTIL`, `UPDATE`, `UPPER`, `USAGE`, `USER`, `USER_DEFINED_TYPE_CATALOG`, `USER_DEFINED_TYPE_NAME`, `USER_DEFINED_TYPE_SCHEMA`, `USING`, `VACUUM`, `VALID`, `VALIDATOR`, `VALUES`, `VARIABLE`, `VERBOSE`, `VERSION`, `VIEW`, `VOLATILE`, `WHEN`, `WHENEVER`, `WHERE`, `WITH`, `WITHOUT`, `WORK`, `WRITE`, `YEAR`, `ZONE`), Keyword, nil}, + {Words(``, `\b`, `ARRAY`, `BIGINT`, `BINARY`, `BIT`, `BLOB`, `BOOLEAN`, `CHAR`, `CHARACTER`, `DATE`, `DEC`, `DECIMAL`, `FLOAT`, `INT`, `INTEGER`, `INTERVAL`, `NUMBER`, `NUMERIC`, `REAL`, `SERIAL`, `SMALLINT`, `VARCHAR`, `VARYING`, `INT8`, `SERIAL8`, `TEXT`), NameBuiltin, nil}, + {"[+*/<>=~!@#%^&|`?-]", Operator, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`[a-z_][\w$]*`, Name, nil}, + {`[;:()\[\],.]`, Punctuation, nil}, + }, + "multiline-comments": { + {`/\*`, CommentMultiline, Push("multiline-comments")}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[^/*]+`, CommentMultiline, nil}, + {`[/*]`, CommentMultiline, nil}, + }, + "string": { + {`[^']+`, LiteralStringSingle, nil}, + {`''`, LiteralStringSingle, nil}, + {`'`, LiteralStringSingle, Pop(1)}, + }, + "double-string": { + {`[^"]+`, LiteralStringDouble, nil}, + {`""`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/squid.go b/vendor/github.com/alecthomas/chroma/lexers/s/squid.go new file mode 100644 index 000000000..1f161901b --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/squid.go @@ -0,0 +1,38 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Squidconf lexer. +var Squidconf = internal.Register(MustNewLexer( + &Config{ + Name: "SquidConf", + Aliases: []string{"squidconf", "squid.conf", "squid"}, + Filenames: []string{"squid.conf"}, + MimeTypes: []string{"text/x-squidconf"}, + NotMultiline: true, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\s+`, TextWhitespace, nil}, + {`#`, Comment, Push("comment")}, + {Words(`\b`, `\b`, `access_log`, `acl`, `always_direct`, `announce_host`, `announce_period`, `announce_port`, `announce_to`, `anonymize_headers`, `append_domain`, `as_whois_server`, `auth_param_basic`, `authenticate_children`, `authenticate_program`, `authenticate_ttl`, `broken_posts`, `buffered_logs`, `cache_access_log`, `cache_announce`, `cache_dir`, `cache_dns_program`, `cache_effective_group`, `cache_effective_user`, `cache_host`, `cache_host_acl`, `cache_host_domain`, `cache_log`, `cache_mem`, `cache_mem_high`, `cache_mem_low`, `cache_mgr`, `cachemgr_passwd`, `cache_peer`, `cache_peer_access`, `cahce_replacement_policy`, `cache_stoplist`, `cache_stoplist_pattern`, `cache_store_log`, `cache_swap`, `cache_swap_high`, `cache_swap_log`, `cache_swap_low`, `client_db`, `client_lifetime`, `client_netmask`, `connect_timeout`, `coredump_dir`, `dead_peer_timeout`, `debug_options`, `delay_access`, `delay_class`, `delay_initial_bucket_level`, `delay_parameters`, `delay_pools`, `deny_info`, `dns_children`, `dns_defnames`, `dns_nameservers`, `dns_testnames`, `emulate_httpd_log`, `err_html_text`, `fake_user_agent`, `firewall_ip`, `forwarded_for`, `forward_snmpd_port`, `fqdncache_size`, `ftpget_options`, `ftpget_program`, `ftp_list_width`, `ftp_passive`, `ftp_user`, `half_closed_clients`, `header_access`, `header_replace`, `hierarchy_stoplist`, `high_response_time_warning`, `high_page_fault_warning`, `hosts_file`, `htcp_port`, `http_access`, `http_anonymizer`, `httpd_accel`, `httpd_accel_host`, `httpd_accel_port`, `httpd_accel_uses_host_header`, `httpd_accel_with_proxy`, `http_port`, `http_reply_access`, `icp_access`, `icp_hit_stale`, `icp_port`, `icp_query_timeout`, `ident_lookup`, `ident_lookup_access`, `ident_timeout`, `incoming_http_average`, `incoming_icp_average`, `inside_firewall`, `ipcache_high`, `ipcache_low`, `ipcache_size`, `local_domain`, `local_ip`, `logfile_rotate`, `log_fqdn`, `log_icp_queries`, `log_mime_hdrs`, `maximum_object_size`, `maximum_single_addr_tries`, `mcast_groups`, `mcast_icp_query_timeout`, `mcast_miss_addr`, `mcast_miss_encode_key`, `mcast_miss_port`, `memory_pools`, `memory_pools_limit`, `memory_replacement_policy`, `mime_table`, `min_http_poll_cnt`, `min_icp_poll_cnt`, `minimum_direct_hops`, `minimum_object_size`, `minimum_retry_timeout`, `miss_access`, `negative_dns_ttl`, `negative_ttl`, `neighbor_timeout`, `neighbor_type_domain`, `netdb_high`, `netdb_low`, `netdb_ping_period`, `netdb_ping_rate`, `never_direct`, `no_cache`, `passthrough_proxy`, `pconn_timeout`, `pid_filename`, `pinger_program`, `positive_dns_ttl`, `prefer_direct`, `proxy_auth`, `proxy_auth_realm`, `query_icmp`, `quick_abort`, `quick_abort_max`, `quick_abort_min`, `quick_abort_pct`, `range_offset_limit`, `read_timeout`, `redirect_children`, `redirect_program`, `redirect_rewrites_host_header`, `reference_age`, `refresh_pattern`, `reload_into_ims`, `request_body_max_size`, `request_size`, `request_timeout`, `shutdown_lifetime`, `single_parent_bypass`, `siteselect_timeout`, `snmp_access`, `snmp_incoming_address`, `snmp_port`, `source_ping`, `ssl_proxy`, `store_avg_object_size`, `store_objects_per_bucket`, `strip_query_terms`, `swap_level1_dirs`, `swap_level2_dirs`, `tcp_incoming_address`, `tcp_outgoing_address`, `tcp_recv_bufsize`, `test_reachability`, `udp_hit_obj`, `udp_hit_obj_size`, `udp_incoming_address`, `udp_outgoing_address`, `unique_hostname`, `unlinkd_program`, `uri_whitespace`, `useragent_log`, `visible_hostname`, `wais_relay`, `wais_relay_host`, `wais_relay_port`), Keyword, nil}, + {Words(`\b`, `\b`, `proxy-only`, `weight`, `ttl`, `no-query`, `default`, `round-robin`, `multicast-responder`, `on`, `off`, `all`, `deny`, `allow`, `via`, `parent`, `no-digest`, `heap`, `lru`, `realm`, `children`, `q1`, `q2`, `credentialsttl`, `none`, `disable`, `offline_toggle`, `diskd`), NameConstant, nil}, + {Words(`\b`, `\b`, `shutdown`, `info`, `parameter`, `server_list`, `client_list`, `squid.conf`), LiteralString, nil}, + {Words(`stats/`, `\b`, `objects`, `vm_objects`, `utilization`, `ipcache`, `fqdncache`, `dns`, `redirector`, `io`, `reply_headers`, `filedescriptors`, `netdb`), LiteralString, nil}, + {Words(`log/`, `=`, `status`, `enable`, `disable`, `clear`), LiteralString, nil}, + {Words(`\b`, `\b`, `url_regex`, `urlpath_regex`, `referer_regex`, `port`, `proto`, `req_mime_type`, `rep_mime_type`, `method`, `browser`, `user`, `src`, `dst`, `time`, `dstdomain`, `ident`, `snmp_community`), Keyword, nil}, + {`(?:(?:(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|0x0*[0-9a-f]{1,2}|0+[1-3]?[0-7]{0,2})(?:\.(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|0x0*[0-9a-f]{1,2}|0+[1-3]?[0-7]{0,2})){3})|(?!.*::.*::)(?:(?!:)|:(?=:))(?:[0-9a-f]{0,4}(?:(?<=::)|(?|[<&?](?=\\w)|(?<=\\w)[>!?]", Punctuation, nil}, + {`[/=\-+!*%<>&|^?~]+`, Operator, nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + }, + "keywords": { + {Words(``, `\b`, `as`, `break`, `case`, `catch`, `continue`, `default`, `defer`, `do`, `else`, `fallthrough`, `for`, `guard`, `if`, `in`, `is`, `repeat`, `return`, `#selector`, `switch`, `throw`, `try`, `where`, `while`), Keyword, nil}, + {`@availability\([^)]+\)`, KeywordReserved, nil}, + {Words(``, `\b`, `associativity`, `convenience`, `dynamic`, `didSet`, `final`, `get`, `indirect`, `infix`, `inout`, `lazy`, `left`, `mutating`, `none`, `nonmutating`, `optional`, `override`, `postfix`, `precedence`, `prefix`, `Protocol`, `required`, `rethrows`, `right`, `set`, `throws`, `Type`, `unowned`, `weak`, `willSet`, `@availability`, `@autoclosure`, `@noreturn`, `@NSApplicationMain`, `@NSCopying`, `@NSManaged`, `@objc`, `@UIApplicationMain`, `@IBAction`, `@IBDesignable`, `@IBInspectable`, `@IBOutlet`), KeywordReserved, nil}, + {`(as|dynamicType|false|is|nil|self|Self|super|true|__COLUMN__|__FILE__|__FUNCTION__|__LINE__|_|#(?:file|line|column|function))\b`, KeywordConstant, nil}, + {`import\b`, KeywordDeclaration, Push("module")}, + {`(class|enum|extension|struct|protocol)(\s+)([a-zA-Z_]\w*)`, ByGroups(KeywordDeclaration, Text, NameClass), nil}, + {`(func)(\s+)([a-zA-Z_]\w*)`, ByGroups(KeywordDeclaration, Text, NameFunction), nil}, + {`(var|let)(\s+)([a-zA-Z_]\w*)`, ByGroups(KeywordDeclaration, Text, NameVariable), nil}, + {Words(``, `\b`, `class`, `deinit`, `enum`, `extension`, `func`, `import`, `init`, `internal`, `let`, `operator`, `private`, `protocol`, `public`, `static`, `struct`, `subscript`, `typealias`, `var`), KeywordDeclaration, nil}, + }, + "comment": { + {`:param: [a-zA-Z_]\w*|:returns?:|(FIXME|MARK|TODO):`, CommentSpecial, nil}, + }, + "comment-single": { + {`\n`, Text, Pop(1)}, + Include("comment"), + {`[^\n]`, CommentSingle, nil}, + }, + "comment-multi": { + Include("comment"), + {`[^*/]`, CommentMultiline, nil}, + {`/\*`, CommentMultiline, Push()}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[*/]`, CommentMultiline, nil}, + }, + "module": { + {`\n`, Text, Pop(1)}, + {`[a-zA-Z_]\w*`, NameClass, nil}, + Include("root"), + }, + "preproc": { + {`\n`, Text, Pop(1)}, + Include("keywords"), + {`[A-Za-z]\w*`, CommentPreproc, nil}, + Include("root"), + }, + "string": { + {`\\\(`, LiteralStringInterpol, Push("string-intp")}, + {`"`, LiteralString, Pop(1)}, + {`\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}`, LiteralStringEscape, nil}, + {`[^\\"]+`, LiteralString, nil}, + {`\\`, LiteralString, nil}, + }, + "string-intp": { + {`\(`, LiteralStringInterpol, Push()}, + {`\)`, LiteralStringInterpol, Pop(1)}, + Include("root"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/systemd.go b/vendor/github.com/alecthomas/chroma/lexers/s/systemd.go new file mode 100644 index 000000000..6b0884ec0 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/systemd.go @@ -0,0 +1,28 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +var SYSTEMD = internal.Register(MustNewLexer( + &Config{ + Name: "SYSTEMD", + Aliases: []string{"systemd"}, + Filenames: []string{"*.service"}, + MimeTypes: []string{"text/plain"}, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`[;#].*`, Comment, nil}, + {`\[.*?\]$`, Keyword, nil}, + {`(.*?)(=)(.*)(\\\n)`, ByGroups(NameAttribute, Operator, LiteralString, Text), Push("continuation")}, + {`(.*?)(=)(.*)`, ByGroups(NameAttribute, Operator, LiteralString), nil}, + }, + "continuation": { + {`(.*?)(\\\n)`, ByGroups(LiteralString, Text), nil}, + {`(.*)`, LiteralString, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/s/systemverilog.go b/vendor/github.com/alecthomas/chroma/lexers/s/systemverilog.go new file mode 100644 index 000000000..85c459fed --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/s/systemverilog.go @@ -0,0 +1,73 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Systemverilog lexer. +var Systemverilog = internal.Register(MustNewLexer( + &Config{ + Name: "systemverilog", + Aliases: []string{"systemverilog", "sv"}, + Filenames: []string{"*.sv", "*.svh"}, + MimeTypes: []string{"text/x-systemverilog"}, + EnsureNL: true, + }, + Rules{ + "root": { + {"^\\s*`define", CommentPreproc, Push("macro")}, + {`^(\s*)(package)(\s+)`, ByGroups(Text, KeywordNamespace, Text), nil}, + {`^(\s*)(import)(\s+)("DPI(?:-C)?")(\s+)`, ByGroups(Text, KeywordNamespace, Text, LiteralString, Text), nil}, + {`^(\s*)(import)(\s+)`, ByGroups(Text, KeywordNamespace, Text), Push("import")}, + {`\n`, Text, nil}, + {`\s+`, Text, nil}, + {`\\\n`, Text, nil}, + {`/(\\\n)?/(\n|(.|\n)*?[^\\]\n)`, CommentSingle, nil}, + {`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil}, + {`[{}#@]`, Punctuation, nil}, + {`L?"`, LiteralString, Push("string")}, + {`L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'`, LiteralStringChar, nil}, + {`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?`, LiteralNumberFloat, nil}, + {`(\d+\.\d*|\.\d+|\d+[fF])[fF]?`, LiteralNumberFloat, nil}, + {`([0-9]+)|(\'h)[0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`([0-9]+)|(\'b)[01]+`, LiteralNumberBin, nil}, + {`([0-9]+)|(\'d)[0-9]+`, LiteralNumberInteger, nil}, + {`([0-9]+)|(\'o)[0-7]+`, LiteralNumberOct, nil}, + {`\'[01xz]`, LiteralNumber, nil}, + {`\d+[Ll]?`, LiteralNumberInteger, nil}, + {`\*/`, Error, nil}, + {`[~!%^&*+=|?:<>/-]`, Operator, nil}, + {`[()\[\],.;\']`, Punctuation, nil}, + {"`[a-zA-Z_]\\w*", NameConstant, nil}, + {Words(``, `\b`, `accept_on`, `alias`, `always`, `always_comb`, `always_ff`, `always_latch`, `and`, `assert`, `assign`, `assume`, `automatic`, `before`, `begin`, `bind`, `bins`, `binsof`, `bit`, `break`, `buf`, `bufif0`, `bufif1`, `byte`, `case`, `casex`, `casez`, `cell`, `chandle`, `checker`, `class`, `clocking`, `cmos`, `config`, `const`, `constraint`, `context`, `continue`, `cover`, `covergroup`, `coverpoint`, `cross`, `deassign`, `default`, `defparam`, `design`, `disable`, `dist`, `do`, `edge`, `else`, `end`, `endcase`, `endchecker`, `endclass`, `endclocking`, `endconfig`, `endfunction`, `endgenerate`, `endgroup`, `endinterface`, `endmodule`, `endpackage`, `endprimitive`, `endprogram`, `endproperty`, `endsequence`, `endspecify`, `endtable`, `endtask`, `enum`, `event`, `eventually`, `expect`, `export`, `extends`, `extern`, `final`, `first_match`, `for`, `force`, `foreach`, `forever`, `fork`, `forkjoin`, `function`, `generate`, `genvar`, `global`, `highz0`, `highz1`, `if`, `iff`, `ifnone`, `ignore_bins`, `illegal_bins`, `implies`, `import`, `incdir`, `include`, `initial`, `inout`, `input`, `inside`, `instance`, `int`, `integer`, `interface`, `intersect`, `join`, `join_any`, `join_none`, `large`, `let`, `liblist`, `library`, `local`, `localparam`, `logic`, `longint`, `macromodule`, `matches`, `medium`, `modport`, `module`, `nand`, `negedge`, `new`, `nexttime`, `nmos`, `nor`, `noshowcancelled`, `not`, `notif0`, `notif1`, `null`, `or`, `output`, `package`, `packed`, `parameter`, `pmos`, `posedge`, `primitive`, `priority`, `program`, `property`, `protected`, `pull0`, `pull1`, `pulldown`, `pullup`, `pulsestyle_ondetect`, `pulsestyle_onevent`, `pure`, `rand`, `randc`, `randcase`, `randsequence`, `rcmos`, `real`, `realtime`, `ref`, `reg`, `reject_on`, `release`, `repeat`, `restrict`, `return`, `rnmos`, `rpmos`, `rtran`, `rtranif0`, `rtranif1`, `s_always`, `s_eventually`, `s_nexttime`, `s_until`, `s_until_with`, `scalared`, `sequence`, `shortint`, `shortreal`, `showcancelled`, `signed`, `small`, `solve`, `specify`, `specparam`, `static`, `string`, `strong`, `strong0`, `strong1`, `struct`, `super`, `supply0`, `supply1`, `sync_accept_on`, `sync_reject_on`, `table`, `tagged`, `task`, `this`, `throughout`, `time`, `timeprecision`, `timeunit`, `tran`, `tranif0`, `tranif1`, `tri`, `tri0`, `tri1`, `triand`, `trior`, `trireg`, `type`, `typedef`, `union`, `unique`, `unique0`, `unsigned`, `until`, `until_with`, `untyped`, `use`, `uwire`, `var`, `vectored`, `virtual`, `void`, `wait`, `wait_order`, `wand`, `weak`, `weak0`, `weak1`, `while`, `wildcard`, `wire`, `with`, `within`, `wor`, `xnor`, `xor`), Keyword, nil}, + {Words(``, `\b`, "`__FILE__", "`__LINE__", "`begin_keywords", "`celldefine", "`default_nettype", "`define", "`else", "`elsif", "`end_keywords", "`endcelldefine", "`endif", "`ifdef", "`ifndef", "`include", "`line", "`nounconnected_drive", "`pragma", "`resetall", "`timescale", "`unconnected_drive", "`undef", "`undefineall"), CommentPreproc, nil}, + {Words(``, `\b`, `$display`, `$displayb`, `$displayh`, `$displayo`, `$dumpall`, `$dumpfile`, `$dumpflush`, `$dumplimit`, `$dumpoff`, `$dumpon`, `$dumpports`, `$dumpportsall`, `$dumpportsflush`, `$dumpportslimit`, `$dumpportsoff`, `$dumpportson`, `$dumpvars`, `$fclose`, `$fdisplay`, `$fdisplayb`, `$fdisplayh`, `$fdisplayo`, `$feof`, `$ferror`, `$fflush`, `$fgetc`, `$fgets`, `$finish`, `$fmonitor`, `$fmonitorb`, `$fmonitorh`, `$fmonitoro`, `$fopen`, `$fread`, `$fscanf`, `$fseek`, `$fstrobe`, `$fstrobeb`, `$fstrobeh`, `$fstrobeo`, `$ftell`, `$fwrite`, `$fwriteb`, `$fwriteh`, `$fwriteo`, `$monitor`, `$monitorb`, `$monitorh`, `$monitoro`, `$monitoroff`, `$monitoron`, `$plusargs`, `$random`, `$readmemb`, `$readmemh`, `$rewind`, `$sformat`, `$sformatf`, `$sscanf`, `$strobe`, `$strobeb`, `$strobeh`, `$strobeo`, `$swrite`, `$swriteb`, `$swriteh`, `$swriteo`, `$test`, `$ungetc`, `$value$plusargs`, `$write`, `$writeb`, `$writeh`, `$writememb`, `$writememh`, `$writeo`), NameBuiltin, nil}, + {`(class)(\s+)`, ByGroups(Keyword, Text), Push("classname")}, + {Words(``, `\b`, `byte`, `shortint`, `int`, `longint`, `integer`, `time`, `bit`, `logic`, `reg`, `supply0`, `supply1`, `tri`, `triand`, `trior`, `tri0`, `tri1`, `trireg`, `uwire`, `wire`, `wand`, `woshortreal`, `real`, `realtime`), KeywordType, nil}, + {`[a-zA-Z_]\w*:(?!:)`, NameLabel, nil}, + {`\$?[a-zA-Z_]\w*`, Name, nil}, + }, + "classname": { + {`[a-zA-Z_]\w*`, NameClass, Pop(1)}, + }, + "string": { + {`"`, LiteralString, Pop(1)}, + {`\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})`, LiteralStringEscape, nil}, + {`[^\\"\n]+`, LiteralString, nil}, + {`\\\n`, LiteralString, nil}, + {`\\`, LiteralString, nil}, + }, + "macro": { + {`[^/\n]+`, CommentPreproc, nil}, + {`/[*](.|\n)*?[*]/`, CommentMultiline, nil}, + {`//.*?\n`, CommentSingle, Pop(1)}, + {`/`, CommentPreproc, nil}, + {`(?<=\\)\n`, CommentPreproc, nil}, + {`\n`, CommentPreproc, Pop(1)}, + }, + "import": { + {`[\w:]+\*?`, NameNamespace, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/tablegen.go b/vendor/github.com/alecthomas/chroma/lexers/t/tablegen.go new file mode 100644 index 000000000..18c697879 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/tablegen.go @@ -0,0 +1,42 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// TableGen lexer. +var Tablegen = internal.Register(MustNewLexer( + &Config{ + Name: "TableGen", + Aliases: []string{"tablegen"}, + Filenames: []string{"*.td"}, + MimeTypes: []string{"text/x-tablegen"}, + }, + Rules{ + "root": { + Include("macro"), + Include("whitespace"), + {`c?"[^"]*?"`, LiteralString, nil}, + Include("keyword"), + {`\$[_a-zA-Z][_\w]*`, NameVariable, nil}, + {`\d*[_a-zA-Z][_\w]*`, NameVariable, nil}, + {`\[\{[\w\W]*?\}\]`, LiteralString, nil}, + {`[+-]?\d+|0x[\da-fA-F]+|0b[01]+`, LiteralNumber, nil}, + {`[=<>{}\[\]()*.,!:;]`, Punctuation, nil}, + }, + "macro": { + {`(#include\s+)("[^"]*")`, ByGroups(CommentPreproc, LiteralString), nil}, + {`^\s*#(ifdef|ifndef)\s+[_\w][_\w\d]*`, CommentPreproc, nil}, + {`^\s*#define\s+[_\w][_\w\d]*`, CommentPreproc, nil}, + {`^\s*#endif`, CommentPreproc, nil}, + }, + "whitespace": { + {`(\n|\s)+`, Text, nil}, + {`//.*?\n`, Comment, nil}, + }, + "keyword": { + {Words(``, `\b`, `bit`, `bits`, `class`, `code`, `dag`, `def`, `defm`, `field`, `foreach`, `in`, `int`, `let`, `list`, `multiclass`, `string`), Keyword, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/tasm.go b/vendor/github.com/alecthomas/chroma/lexers/t/tasm.go new file mode 100644 index 000000000..960399ca9 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/tasm.go @@ -0,0 +1,61 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Tasm lexer. +var Tasm = internal.Register(MustNewLexer( + &Config{ + Name: "TASM", + Aliases: []string{"tasm"}, + Filenames: []string{"*.asm", "*.ASM", "*.tasm"}, + MimeTypes: []string{"text/x-tasm"}, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`^\s*%`, CommentPreproc, Push("preproc")}, + Include("whitespace"), + {`[@a-z$._?][\w$.?#@~]*:`, NameLabel, nil}, + {`BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|ORG|ALIGN|STRUC|ENDSTRUC|ENDS|COMMON|CPU|GROUP|UPPERCASE|INCLUDE|EXPORT|LIBRARY|MODULE|PROC|ENDP|USES|ARG|DATASEG|UDATASEG|END|IDEAL|P386|MODEL|ASSUME|CODESEG|SIZE`, Keyword, Push("instruction-args")}, + {`([@a-z$._?][\w$.?#@~]*)(\s+)(db|dd|dw|T[A-Z][a-z]+)`, ByGroups(NameConstant, KeywordDeclaration, KeywordDeclaration), Push("instruction-args")}, + {`(?:res|d)[bwdqt]|times`, KeywordDeclaration, Push("instruction-args")}, + {`[@a-z$._?][\w$.?#@~]*`, NameFunction, Push("instruction-args")}, + {`[\r\n]+`, Text, nil}, + }, + "instruction-args": { + {"\"(\\\\\"|[^\"\\n])*\"|'(\\\\'|[^'\\n])*'|`(\\\\`|[^`\\n])*`", LiteralString, nil}, + {`(?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)`, LiteralNumberHex, nil}, + {`[0-7]+q`, LiteralNumberOct, nil}, + {`[01]+b`, LiteralNumberBin, nil}, + {`[0-9]+\.e?[0-9]+`, LiteralNumberFloat, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + Include("punctuation"), + {`r[0-9][0-5]?[bwd]|[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]`, NameBuiltin, nil}, + {`[@a-z$._?][\w$.?#@~]*`, NameVariable, nil}, + {`(\\\s*)(;.*)([\r\n])`, ByGroups(Text, CommentSingle, Text), nil}, + {`[\r\n]+`, Text, Pop(1)}, + Include("whitespace"), + }, + "preproc": { + {`[^;\n]+`, CommentPreproc, nil}, + {`;.*?\n`, CommentSingle, Pop(1)}, + {`\n`, CommentPreproc, Pop(1)}, + }, + "whitespace": { + {`[\n\r]`, Text, nil}, + {`\\[\n\r]`, Text, nil}, + {`[ \t]+`, Text, nil}, + {`;.*`, CommentSingle, nil}, + }, + "punctuation": { + {`[,():\[\]]+`, Punctuation, nil}, + {`[&|^<>+*=/%~-]+`, Operator, nil}, + {`[$]+`, KeywordConstant, nil}, + {`seg|wrt|strict`, OperatorWord, nil}, + {`byte|[dq]?word`, KeywordType, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/tcl.go b/vendor/github.com/alecthomas/chroma/lexers/t/tcl.go new file mode 100644 index 000000000..77951b40f --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/tcl.go @@ -0,0 +1,116 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Tcl lexer. +var Tcl = internal.Register(MustNewLexer( + &Config{ + Name: "Tcl", + Aliases: []string{"tcl"}, + Filenames: []string{"*.tcl", "*.rvt"}, + MimeTypes: []string{"text/x-tcl", "text/x-script.tcl", "application/x-tcl"}, + }, + Rules{ + "root": { + Include("command"), + Include("basic"), + Include("data"), + {`\}`, Keyword, nil}, + }, + "command": { + {Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params")}, + {Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params")}, + {`([\w.-]+)`, NameVariable, Push("params")}, + {`#`, Comment, Push("comment")}, + }, + "command-in-brace": { + {Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params-in-brace")}, + {Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params-in-brace")}, + {`([\w.-]+)`, NameVariable, Push("params-in-brace")}, + {`#`, Comment, Push("comment")}, + }, + "command-in-bracket": { + {Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params-in-bracket")}, + {Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params-in-bracket")}, + {`([\w.-]+)`, NameVariable, Push("params-in-bracket")}, + {`#`, Comment, Push("comment")}, + }, + "command-in-paren": { + {Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params-in-paren")}, + {Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params-in-paren")}, + {`([\w.-]+)`, NameVariable, Push("params-in-paren")}, + {`#`, Comment, Push("comment")}, + }, + "basic": { + {`\(`, Keyword, Push("paren")}, + {`\[`, Keyword, Push("bracket")}, + {`\{`, Keyword, Push("brace")}, + {`"`, LiteralStringDouble, Push("string")}, + {`(eq|ne|in|ni)\b`, OperatorWord, nil}, + {`!=|==|<<|>>|<=|>=|&&|\|\||\*\*|[-+~!*/%<>&^|?:]`, Operator, nil}, + }, + "data": { + {`\s+`, Text, nil}, + {`0x[a-fA-F0-9]+`, LiteralNumberHex, nil}, + {`0[0-7]+`, LiteralNumberOct, nil}, + {`\d+\.\d+`, LiteralNumberFloat, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`\$([\w.:-]+)`, NameVariable, nil}, + {`([\w.:-]+)`, Text, nil}, + }, + "params": { + {`;`, Keyword, Pop(1)}, + {`\n`, Text, Pop(1)}, + {`(else|elseif|then)\b`, Keyword, nil}, + Include("basic"), + Include("data"), + }, + "params-in-brace": { + {`\}`, Keyword, Push("#pop", "#pop")}, + Include("params"), + }, + "params-in-paren": { + {`\)`, Keyword, Push("#pop", "#pop")}, + Include("params"), + }, + "params-in-bracket": { + {`\]`, Keyword, Push("#pop", "#pop")}, + Include("params"), + }, + "string": { + {`\[`, LiteralStringDouble, Push("string-square")}, + {`(?s)(\\\\|\\[0-7]+|\\.|[^"\\])`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + "string-square": { + {`\[`, LiteralStringDouble, Push("string-square")}, + {`(?s)(\\\\|\\[0-7]+|\\.|\\\n|[^\]\\])`, LiteralStringDouble, nil}, + {`\]`, LiteralStringDouble, Pop(1)}, + }, + "brace": { + {`\}`, Keyword, Pop(1)}, + Include("command-in-brace"), + Include("basic"), + Include("data"), + }, + "paren": { + {`\)`, Keyword, Pop(1)}, + Include("command-in-paren"), + Include("basic"), + Include("data"), + }, + "bracket": { + {`\]`, Keyword, Pop(1)}, + Include("command-in-bracket"), + Include("basic"), + Include("data"), + }, + "comment": { + {`.*[^\\]\n`, Comment, Pop(1)}, + {`.*\\\n`, Comment, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/tcsh.go b/vendor/github.com/alecthomas/chroma/lexers/t/tcsh.go new file mode 100644 index 000000000..e36bdfd8e --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/tcsh.go @@ -0,0 +1,59 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Tcsh lexer. +var Tcsh = internal.Register(MustNewLexer( + &Config{ + Name: "Tcsh", + Aliases: []string{"tcsh", "csh"}, + Filenames: []string{"*.tcsh", "*.csh"}, + MimeTypes: []string{"application/x-csh"}, + }, + Rules{ + "root": { + Include("basic"), + {`\$\(`, Keyword, Push("paren")}, + {`\$\{#?`, Keyword, Push("curly")}, + {"`", LiteralStringBacktick, Push("backticks")}, + Include("data"), + }, + "basic": { + {`\b(if|endif|else|while|then|foreach|case|default|continue|goto|breaksw|end|switch|endsw)\s*\b`, Keyword, nil}, + {`\b(alias|alloc|bg|bindkey|break|builtins|bye|caller|cd|chdir|complete|dirs|echo|echotc|eval|exec|exit|fg|filetest|getxvers|glob|getspath|hashstat|history|hup|inlib|jobs|kill|limit|log|login|logout|ls-F|migrate|newgrp|nice|nohup|notify|onintr|popd|printenv|pushd|rehash|repeat|rootnode|popd|pushd|set|shift|sched|setenv|setpath|settc|setty|setxvers|shift|source|stop|suspend|source|suspend|telltc|time|umask|unalias|uncomplete|unhash|universe|unlimit|unset|unsetenv|ver|wait|warp|watchlog|where|which)\s*\b`, NameBuiltin, nil}, + {`#.*`, Comment, nil}, + {`\\[\w\W]`, LiteralStringEscape, nil}, + {`(\b\w+)(\s*)(=)`, ByGroups(NameVariable, Text, Operator), nil}, + {`[\[\]{}()=]+`, Operator, nil}, + {`<<\s*(\'?)\\?(\w+)[\w\W]+?\2`, LiteralString, nil}, + {`;`, Punctuation, nil}, + }, + "data": { + {`(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"`, LiteralStringDouble, nil}, + {`(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'`, LiteralStringSingle, nil}, + {`\s+`, Text, nil}, + {"[^=\\s\\[\\]{}()$\"\\'`\\\\;#]+", Text, nil}, + {`\d+(?= |\Z)`, LiteralNumber, nil}, + {`\$#?(\w+|.)`, NameVariable, nil}, + }, + "curly": { + {`\}`, Keyword, Pop(1)}, + {`:-`, Keyword, nil}, + {`\w+`, NameVariable, nil}, + {"[^}:\"\\'`$]+", Punctuation, nil}, + {`:`, Punctuation, nil}, + Include("root"), + }, + "paren": { + {`\)`, Keyword, Pop(1)}, + Include("root"), + }, + "backticks": { + {"`", LiteralStringBacktick, Pop(1)}, + Include("root"), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/termcap.go b/vendor/github.com/alecthomas/chroma/lexers/t/termcap.go new file mode 100644 index 000000000..21b7d15c6 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/termcap.go @@ -0,0 +1,42 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Termcap lexer. +var Termcap = internal.Register(MustNewLexer( + &Config{ + Name: "Termcap", + Aliases: []string{"termcap"}, + Filenames: []string{"termcap", "termcap.src"}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`^#.*$`, Comment, nil}, + {`^[^\s#:|]+`, NameTag, Push("names")}, + }, + "names": { + {`\n`, Text, Pop(1)}, + {`:`, Punctuation, Push("defs")}, + {`\|`, Punctuation, nil}, + {`[^:|]+`, NameAttribute, nil}, + }, + "defs": { + {`\\\n[ \t]*`, Text, nil}, + {`\n[ \t]*`, Text, Pop(2)}, + {`(#)([0-9]+)`, ByGroups(Operator, LiteralNumber), nil}, + {`=`, Operator, Push("data")}, + {`:`, Punctuation, nil}, + {`[^\s:=#]+`, NameClass, nil}, + }, + "data": { + {`\\072`, Literal, nil}, + {`:`, Punctuation, Pop(1)}, + {`[^:\\]+`, Literal, nil}, + {`.`, Literal, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/terminfo.go b/vendor/github.com/alecthomas/chroma/lexers/t/terminfo.go new file mode 100644 index 000000000..79749e12f --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/terminfo.go @@ -0,0 +1,42 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Terminfo lexer. +var Terminfo = internal.Register(MustNewLexer( + &Config{ + Name: "Terminfo", + Aliases: []string{"terminfo"}, + Filenames: []string{"terminfo", "terminfo.src"}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`^#.*$`, Comment, nil}, + {`^[^\s#,|]+`, NameTag, Push("names")}, + }, + "names": { + {`\n`, Text, Pop(1)}, + {`(,)([ \t]*)`, ByGroups(Punctuation, Text), Push("defs")}, + {`\|`, Punctuation, nil}, + {`[^,|]+`, NameAttribute, nil}, + }, + "defs": { + {`\n[ \t]+`, Text, nil}, + {`\n`, Text, Pop(2)}, + {`(#)([0-9]+)`, ByGroups(Operator, LiteralNumber), nil}, + {`=`, Operator, Push("data")}, + {`(,)([ \t]*)`, ByGroups(Punctuation, Text), nil}, + {`[^\s,=#]+`, NameClass, nil}, + }, + "data": { + {`\\[,\\]`, Literal, nil}, + {`(,)([ \t]*)`, ByGroups(Punctuation, Text), Pop(1)}, + {`[^\\,]+`, Literal, nil}, + {`.`, Literal, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/terraform.go b/vendor/github.com/alecthomas/chroma/lexers/t/terraform.go new file mode 100644 index 000000000..05125f706 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/terraform.go @@ -0,0 +1,69 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Terraform lexer. +var Terraform = internal.Register(MustNewLexer( + &Config{ + Name: "Terraform", + Aliases: []string{"terraform", "tf"}, + Filenames: []string{"*.tf"}, + MimeTypes: []string{"application/x-tf", "application/x-terraform"}, + }, + Rules{ + "root": { + Include("string"), + Include("punctuation"), + Include("curly"), + Include("basic"), + Include("whitespace"), + {`[0-9]+`, LiteralNumber, nil}, + }, + "basic": { + {Words(`\b`, `\b`, `true`, `false`), KeywordType, nil}, + {`\s*/\*`, CommentMultiline, Push("comment")}, + {`\s*#.*\n`, CommentSingle, nil}, + {`(.*?)(\s*)(=)`, ByGroups(NameAttribute, Text, Operator), nil}, + {Words(`\b`, `\b`, `variable`, `resource`, `provider`, `provisioner`, `module`), KeywordReserved, Push("function")}, + {Words(`\b`, `\b`, `ingress`, `egress`, `listener`, `default`, `connection`, `alias`), KeywordDeclaration, nil}, + {`\$\{`, LiteralStringInterpol, Push("var_builtin")}, + }, + "function": { + {`(\s+)(".*")(\s+)`, ByGroups(Text, LiteralString, Text), nil}, + Include("punctuation"), + Include("curly"), + }, + "var_builtin": { + {`\$\{`, LiteralStringInterpol, Push()}, + {Words(`\b`, `\b`, `concat`, `file`, `join`, `lookup`, `element`), NameBuiltin, nil}, + Include("string"), + Include("punctuation"), + {`\s+`, Text, nil}, + {`\}`, LiteralStringInterpol, Pop(1)}, + }, + "string": { + {`(".*")`, ByGroups(LiteralStringDouble), nil}, + }, + "punctuation": { + {`[\[\](),.]`, Punctuation, nil}, + }, + "curly": { + {`\{`, TextPunctuation, nil}, + {`\}`, TextPunctuation, nil}, + }, + "comment": { + {`[^*/]`, CommentMultiline, nil}, + {`/\*`, CommentMultiline, Push()}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[*/]`, CommentMultiline, nil}, + }, + "whitespace": { + {`\n`, Text, nil}, + {`\s+`, Text, nil}, + {`\\\n`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/tex.go b/vendor/github.com/alecthomas/chroma/lexers/t/tex.go new file mode 100644 index 000000000..f1010c4a8 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/tex.go @@ -0,0 +1,56 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Tex lexer. +var TeX = internal.Register(MustNewLexer( + &Config{ + Name: "TeX", + Aliases: []string{"tex", "latex"}, + Filenames: []string{"*.tex", "*.aux", "*.toc"}, + MimeTypes: []string{"text/x-tex", "text/x-latex"}, + }, + Rules{ + "general": { + {`%.*?\n`, Comment, nil}, + {`[{}]`, NameBuiltin, nil}, + {`[&_^]`, NameBuiltin, nil}, + }, + "root": { + {`\\\[`, LiteralStringBacktick, Push("displaymath")}, + {`\\\(`, LiteralString, Push("inlinemath")}, + {`\$\$`, LiteralStringBacktick, Push("displaymath")}, + {`\$`, LiteralString, Push("inlinemath")}, + {`\\([a-zA-Z]+|.)`, Keyword, Push("command")}, + {`\\$`, Keyword, nil}, + Include("general"), + {`[^\\$%&_^{}]+`, Text, nil}, + }, + "math": { + {`\\([a-zA-Z]+|.)`, NameVariable, nil}, + Include("general"), + {`[0-9]+`, LiteralNumber, nil}, + {`[-=!+*/()\[\]]`, Operator, nil}, + {`[^=!+*/()\[\]\\$%&_^{}0-9-]+`, NameBuiltin, nil}, + }, + "inlinemath": { + {`\\\)`, LiteralString, Pop(1)}, + {`\$`, LiteralString, Pop(1)}, + Include("math"), + }, + "displaymath": { + {`\\\]`, LiteralString, Pop(1)}, + {`\$\$`, LiteralString, Pop(1)}, + {`\$`, NameBuiltin, nil}, + Include("math"), + }, + "command": { + {`\[.*?\]`, NameAttribute, nil}, + {`\*`, Keyword, nil}, + Default(Pop(1)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/thrift.go b/vendor/github.com/alecthomas/chroma/lexers/t/thrift.go new file mode 100644 index 000000000..5cbd0af9e --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/thrift.go @@ -0,0 +1,73 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Thrift lexer. +var Thrift = internal.Register(MustNewLexer( + &Config{ + Name: "Thrift", + Aliases: []string{"thrift"}, + Filenames: []string{"*.thrift"}, + MimeTypes: []string{"application/x-thrift"}, + }, + Rules{ + "root": { + Include("whitespace"), + Include("comments"), + {`"`, LiteralStringDouble, Combined("stringescape", "dqs")}, + {`\'`, LiteralStringSingle, Combined("stringescape", "sqs")}, + {`(namespace)(\s+)`, ByGroups(KeywordNamespace, TextWhitespace), Push("namespace")}, + {`(enum|union|struct|service|exception)(\s+)`, ByGroups(KeywordDeclaration, TextWhitespace), Push("class")}, + {`((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)((?:[^\W\d]|\$)[\w$]*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil}, + Include("keywords"), + Include("numbers"), + {`[&=]`, Operator, nil}, + {`[:;,{}()<>\[\]]`, Punctuation, nil}, + {`[a-zA-Z_](\.\w|\w)*`, Name, nil}, + }, + "whitespace": { + {`\n`, TextWhitespace, nil}, + {`\s+`, TextWhitespace, nil}, + }, + "comments": { + {`#.*$`, Comment, nil}, + {`//.*?\n`, Comment, nil}, + {`/\*[\w\W]*?\*/`, CommentMultiline, nil}, + }, + "stringescape": { + {`\\([\\nrt"\'])`, LiteralStringEscape, nil}, + }, + "dqs": { + {`"`, LiteralStringDouble, Pop(1)}, + {`[^\\"\n]+`, LiteralStringDouble, nil}, + }, + "sqs": { + {`'`, LiteralStringSingle, Pop(1)}, + {`[^\\\'\n]+`, LiteralStringSingle, nil}, + }, + "namespace": { + {`[a-z*](\.\w|\w)*`, NameNamespace, Pop(1)}, + Default(Pop(1)), + }, + "class": { + {`[a-zA-Z_]\w*`, NameClass, Pop(1)}, + Default(Pop(1)), + }, + "keywords": { + {`(async|oneway|extends|throws|required|optional)\b`, Keyword, nil}, + {`(true|false)\b`, KeywordConstant, nil}, + {`(const|typedef)\b`, KeywordDeclaration, nil}, + {Words(``, `\b`, `cpp_namespace`, `cpp_include`, `cpp_type`, `java_package`, `cocoa_prefix`, `csharp_namespace`, `delphi_namespace`, `php_namespace`, `py_module`, `perl_package`, `ruby_namespace`, `smalltalk_category`, `smalltalk_prefix`, `xsd_all`, `xsd_optional`, `xsd_nillable`, `xsd_namespace`, `xsd_attrs`, `include`), KeywordNamespace, nil}, + {Words(``, `\b`, `void`, `bool`, `byte`, `i16`, `i32`, `i64`, `double`, `string`, `binary`, `map`, `list`, `set`, `slist`, `senum`), KeywordType, nil}, + {Words(`\b`, `\b`, `BEGIN`, `END`, `__CLASS__`, `__DIR__`, `__FILE__`, `__FUNCTION__`, `__LINE__`, `__METHOD__`, `__NAMESPACE__`, `abstract`, `alias`, `and`, `args`, `as`, `assert`, `begin`, `break`, `case`, `catch`, `class`, `clone`, `continue`, `declare`, `def`, `default`, `del`, `delete`, `do`, `dynamic`, `elif`, `else`, `elseif`, `elsif`, `end`, `enddeclare`, `endfor`, `endforeach`, `endif`, `endswitch`, `endwhile`, `ensure`, `except`, `exec`, `finally`, `float`, `for`, `foreach`, `function`, `global`, `goto`, `if`, `implements`, `import`, `in`, `inline`, `instanceof`, `interface`, `is`, `lambda`, `module`, `native`, `new`, `next`, `nil`, `not`, `or`, `pass`, `public`, `print`, `private`, `protected`, `raise`, `redo`, `rescue`, `retry`, `register`, `return`, `self`, `sizeof`, `static`, `super`, `switch`, `synchronized`, `then`, `this`, `throw`, `transient`, `try`, `undef`, `unless`, `unsigned`, `until`, `use`, `var`, `virtual`, `volatile`, `when`, `while`, `with`, `xor`, `yield`), KeywordReserved, nil}, + }, + "numbers": { + {`[+-]?(\d+\.\d+([eE][+-]?\d+)?|\.?\d+[eE][+-]?\d+)`, LiteralNumberFloat, nil}, + {`[+-]?0x[0-9A-Fa-f]+`, LiteralNumberHex, nil}, + {`[+-]?[0-9]+`, LiteralNumberInteger, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/toml.go b/vendor/github.com/alecthomas/chroma/lexers/t/toml.go new file mode 100644 index 000000000..68bfc9053 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/toml.go @@ -0,0 +1,29 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +var TOML = internal.Register(MustNewLexer( + &Config{ + Name: "TOML", + Aliases: []string{"toml"}, + Filenames: []string{"*.toml"}, + MimeTypes: []string{"text/x-toml"}, + }, + Rules{ + "root": { + {`\s+`, Text, nil}, + {`#.*`, Comment, nil}, + {Words(``, `\b`, `true`, `false`), KeywordConstant, nil}, + {`\d\d\d\d-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d\+)?(Z|[+-]\d{2}:\d{2})`, LiteralDate, nil}, + {`[+-]?[0-9](_?\d)*\.\d+`, LiteralNumberFloat, nil}, + {`[+-]?[0-9](_?\d)*`, LiteralNumberInteger, nil}, + {`"(\\\\|\\"|[^"])*"`, StringDouble, nil}, + {`'(\\\\|\\'|[^'])*'`, StringSingle, nil}, + {`[.,=\[\]]`, Punctuation, nil}, + {`[^\W\d]\w*`, NameOther, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/tradingview.go b/vendor/github.com/alecthomas/chroma/lexers/t/tradingview.go new file mode 100644 index 000000000..e3d8a7ac1 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/tradingview.go @@ -0,0 +1,40 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// TradingView lexer +var TradingView = internal.Register(MustNewLexer( + &Config{ + Name: "TradingView", + Aliases: []string{"tradingview", "tv"}, + Filenames: []string{"*.tv"}, + MimeTypes: []string{"text/x-tradingview"}, + DotAll: true, + EnsureNL: true, + }, + Rules{ + "root": { + {`[^\S\n]+|\n|[()]`, Text, nil}, + {`(//.*?)(\n)`, ByGroups(CommentSingle, Text), nil}, + {`>=|<=|==|!=|>|<|\?|-|\+|\*|\/|%|\[|\]`, Operator, nil}, + {`[:,.]`, Punctuation, nil}, + {`=`, KeywordPseudo, nil}, + {`"(\\\\|\\"|[^"\n])*["\n]`, LiteralString, nil}, + {`'\\.'|'[^\\]'`, LiteralString, nil}, + {`[0-9](\.[0-9]*)?([eE][+-][0-9]+)?`, LiteralNumber, nil}, + {`#[a-fA-F0-9]{8}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{3}`, LiteralStringOther, nil}, + {`(abs|acos|alertcondition|alma|asin|atan|atr|avg|barcolor|barssince|bgcolor|cci|ceil|change|cog|color\.new|correlation|cos|crossover|crossunder|cum|dev|ema|exp|falling|fill|fixnan|floor|heikinashi|highest|highestbars|hline|iff|kagi|label\.(delete|get_text|get_x|get_y|new|set_color|set_size|set_style|set_text|set_textcolor|set_x|set_xloc|set_xy|set_y|set_yloc)|line\.(new|delete|get_x1|get_x2|get_y1|get_y2|set_color|set_width|set_style|set_extend|set_xy1|set_xy2|set_x1|set_x2|set_y1|set_y2|set_xloc)|linebreak|linreg|log|log10|lowest|lowestbars|macd|max|max_bars_back|min|mom|nz|percentile_(linear_interpolation|nearest_rank)|percentrank|pivothigh|pivotlow|plot|plotarrow|plotbar|plotcandle|plotchar|plotshape|pointfigure|pow|renko|rising|rma|roc|round|rsi|sar|security|sign|sin|sma|sqrt|stdev|stoch|study|sum|swma|tan|timestamp|tostring|tsi|valuewhen|variance|vwma|wma|strategy\.(cancel|cancel_all|close|close_all|entry|exit|order|risk\.(allow_entry_in|max_cons_loss_days|max_drawdown|max_intraday_filled_orders|max_intraday_loss|max_position_size)))\b`, NameFunction, nil}, + {`\b(bool|color|cross|dayofmonth|dayofweek|float|hour|input|int|label|line|minute|month|na|offset|second|strategy|string|tickerid|time|tr|vwap|weekofyear|year)(\()`, ByGroups(NameFunction, Text), nil}, // functions that can also be variable + {`(accdist|adjustment\.(dividends|none|splits)|aqua|area|areabr|bar_index|black|blue|bool|circles|close|columns|currency\.(AUD|CAD|CHF|EUR|GBP|HKD|JPY|NOK|NONE|NZD|RUB|SEK|SGD|TRY|USD|ZAR)|color\.(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)|dashed|dotted|dayofweek\.(monday|tuesday|wednesday|thursday|friday|saturday|sunday)|extend\.(both|left|right|none)|float|format\.(inherit|price|volume)|friday|fuchsia|gray|green|high|histogram|hl2|hlc3|hline\.style_(dotted|solid|dashed)|input\.(bool|float|integer|resolution|session|source|string|symbol)|integer|interval|isdaily|isdwm|isintraday|ismonthly|isweekly|label\.style_(arrowdown|arrowup|circle|cross|diamond|flag|labeldown|labelup|none|square|triangledown|triangleup|xcross)|lime|line\.style_(dashed|dotted|solid|arrow_both|arrow_left|arrow_right)|linebr|location\.(abovebar|absolute|belowbar|bottom|top)|low|maroon|monday|n|navy|ohlc4|olive|open|orange|period|plot\.style_(area|areabr|circles|columns|cross|histogram|line|linebr|stepline)|purple|red|resolution|saturday|scale\.(left|none|right)|session|session\.(extended|regular)|silver|size\.(auto|huge|large|normal|small|tiny)|solid|source|stepline|string|sunday|symbol|syminfo\.(mintick|pointvalue|prefix|root|session|ticker|tickerid|timezone)|teal|thursday|ticker|timeframe\.(isdaily|isdwm|isintraday|ismonthly|isweekly|multiplier|period)|timenow|tuesday|volume|wednesday|white|yellow|strategy\.(cash|closedtrades|commission\.(cash_per_contract|cash_per_order|percent)|direction\.(all|long|short)|equity|eventrades|fixed|grossloss|grossprofit|initial_capital|long|losstrades|max_contracts_held_(all|long|short)|max_drawdown|netprofit|oca\.(cancel|none|reduce)|openprofit|opentrades|percent_of_equity|position_avg_price|position_entry_name|position_size|short|wintrades)|shape\.(arrowdown|arrowup|circle|cross|diamond|flag|labeldown|labelup|square|triangledown|triangleup|xcross)|barstate\.is(first|history|last|new|realtime)|barmerge\.(gaps_on|gaps_off|lookahead_on|lookahead_off)|xloc\.bar_(index|time)|yloc\.(abovebar|belowbar|price))\b`, NameVariable, nil}, + {`(cross|dayofmonth|dayofweek|hour|minute|month|na|second|tickerid|time|tr|vwap|weekofyear|year)(\b[^\(])`, ByGroups(NameVariable, Text), nil}, // variables that can also be function + {`(int|float|bool|color|string|label|line)(\b[^\(=.])`, ByGroups(KeywordType, Text), nil}, // types that can also be a function + {`(var)\b`, KeywordType, nil}, + {`(true|false)\b`, KeywordConstant, nil}, + {`(and|or|not|if|else|for|to)\b`, OperatorWord, nil}, + {`@?[_a-zA-Z]\w*`, Text, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/transactsql.go b/vendor/github.com/alecthomas/chroma/lexers/t/transactsql.go new file mode 100644 index 000000000..769a2f919 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/transactsql.go @@ -0,0 +1,60 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// TransactSQL lexer. +var TransactSQL = internal.Register(MustNewLexer( + &Config{ + Name: "Transact-SQL", + Aliases: []string{"tsql", "t-sql"}, + MimeTypes: []string{"text/x-tsql"}, + NotMultiline: true, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\s+`, TextWhitespace, nil}, + {`--(?m).*?$\n?`, CommentSingle, nil}, + {`/\*`, CommentMultiline, Push("multiline-comments")}, + {`'`, LiteralStringSingle, Push("string")}, + {`"`, LiteralStringName, Push("quoted-ident")}, + {Words(``, ``, `!<`, `!=`, `!>`, `<`, `<=`, `<>`, `=`, `>`, `>=`, `+`, `+=`, `-`, `-=`, `*`, `*=`, `/`, `/=`, `%`, `%=`, `&`, `&=`, `|`, `|=`, `^`, `^=`, `~`, `::`), Operator, nil}, + {Words(``, `\b`, `all`, `and`, `any`, `between`, `except`, `exists`, `in`, `intersect`, `like`, `not`, `or`, `some`, `union`), OperatorWord, nil}, + {Words(``, `\b`, `bigint`, `binary`, `bit`, `char`, `cursor`, `date`, `datetime`, `datetime2`, `datetimeoffset`, `decimal`, `float`, `hierarchyid`, `image`, `int`, `money`, `nchar`, `ntext`, `numeric`, `nvarchar`, `real`, `smalldatetime`, `smallint`, `smallmoney`, `sql_variant`, `table`, `text`, `time`, `timestamp`, `tinyint`, `uniqueidentifier`, `varbinary`, `varchar`, `xml`), NameClass, nil}, + {Words(``, `\b`, `$partition`, `abs`, `acos`, `app_name`, `applock_mode`, `applock_test`, `ascii`, `asin`, `assemblyproperty`, `atan`, `atn2`, `avg`, `binary_checksum`, `cast`, `ceiling`, `certencoded`, `certprivatekey`, `char`, `charindex`, `checksum`, `checksum_agg`, `choose`, `col_length`, `col_name`, `columnproperty`, `compress`, `concat`, `connectionproperty`, `context_info`, `convert`, `cos`, `cot`, `count`, `count_big`, `current_request_id`, `current_timestamp`, `current_transaction_id`, `current_user`, `cursor_status`, `database_principal_id`, `databasepropertyex`, `dateadd`, `datediff`, `datediff_big`, `datefromparts`, `datename`, `datepart`, `datetime2fromparts`, `datetimefromparts`, `datetimeoffsetfromparts`, `day`, `db_id`, `db_name`, `decompress`, `degrees`, `dense_rank`, `difference`, `eomonth`, `error_line`, `error_message`, `error_number`, `error_procedure`, `error_severity`, `error_state`, `exp`, `file_id`, `file_idex`, `file_name`, `filegroup_id`, `filegroup_name`, `filegroupproperty`, `fileproperty`, `floor`, `format`, `formatmessage`, `fulltextcatalogproperty`, `fulltextserviceproperty`, `get_filestream_transaction_context`, `getansinull`, `getdate`, `getutcdate`, `grouping`, `grouping_id`, `has_perms_by_name`, `host_id`, `host_name`, `iif`, `index_col`, `indexkey_property`, `indexproperty`, `is_member`, `is_rolemember`, `is_srvrolemember`, `isdate`, `isjson`, `isnull`, `isnumeric`, `json_modify`, `json_query`, `json_value`, `left`, `len`, `log`, `log10`, `lower`, `ltrim`, `max`, `min`, `min_active_rowversion`, `month`, `nchar`, `newid`, `newsequentialid`, `ntile`, `object_definition`, `object_id`, `object_name`, `object_schema_name`, `objectproperty`, `objectpropertyex`, `opendatasource`, `openjson`, `openquery`, `openrowset`, `openxml`, `original_db_name`, `original_login`, `parse`, `parsename`, `patindex`, `permissions`, `pi`, `power`, `pwdcompare`, `pwdencrypt`, `quotename`, `radians`, `rand`, `rank`, `replace`, `replicate`, `reverse`, `right`, `round`, `row_number`, `rowcount_big`, `rtrim`, `schema_id`, `schema_name`, `scope_identity`, `serverproperty`, `session_context`, `session_user`, `sign`, `sin`, `smalldatetimefromparts`, `soundex`, `sp_helplanguage`, `space`, `sqrt`, `square`, `stats_date`, `stdev`, `stdevp`, `str`, `string_escape`, `string_split`, `stuff`, `substring`, `sum`, `suser_id`, `suser_name`, `suser_sid`, `suser_sname`, `switchoffset`, `sysdatetime`, `sysdatetimeoffset`, `system_user`, `sysutcdatetime`, `tan`, `textptr`, `textvalid`, `timefromparts`, `todatetimeoffset`, `try_cast`, `try_convert`, `try_parse`, `type_id`, `type_name`, `typeproperty`, `unicode`, `upper`, `user_id`, `user_name`, `var`, `varp`, `xact_state`, `year`), NameFunction, nil}, + {`(goto)(\s+)(\w+\b)`, ByGroups(Keyword, TextWhitespace, NameLabel), nil}, + {Words(``, `\b`, `absolute`, `action`, `ada`, `add`, `admin`, `after`, `aggregate`, `alias`, `all`, `allocate`, `alter`, `and`, `any`, `are`, `array`, `as`, `asc`, `asensitive`, `assertion`, `asymmetric`, `at`, `atomic`, `authorization`, `avg`, `backup`, `before`, `begin`, `between`, `binary`, `bit`, `bit_length`, `blob`, `boolean`, `both`, `breadth`, `break`, `browse`, `bulk`, `by`, `call`, `called`, `cardinality`, `cascade`, `cascaded`, `case`, `cast`, `catalog`, `catch`, `char`, `char_length`, `character`, `character_length`, `check`, `checkpoint`, `class`, `clob`, `close`, `clustered`, `coalesce`, `collate`, `collation`, `collect`, `column`, `commit`, `completion`, `compute`, `condition`, `connect`, `connection`, `constraint`, `constraints`, `constructor`, `contains`, `containstable`, `continue`, `convert`, `corr`, `corresponding`, `count`, `covar_pop`, `covar_samp`, `create`, `cross`, `cube`, `cume_dist`, `current`, `current_catalog`, `current_date`, `current_default_transform_group`, `current_path`, `current_role`, `current_schema`, `current_time`, `current_timestamp`, `current_transform_group_for_type`, `current_user`, `cursor`, `cycle`, `data`, `database`, `date`, `day`, `dbcc`, `deallocate`, `dec`, `decimal`, `declare`, `default`, `deferrable`, `deferred`, `delete`, `deny`, `depth`, `deref`, `desc`, `describe`, `descriptor`, `destroy`, `destructor`, `deterministic`, `diagnostics`, `dictionary`, `disconnect`, `disk`, `distinct`, `distributed`, `domain`, `double`, `drop`, `dump`, `dynamic`, `each`, `element`, `else`, `end`, `end-exec`, `equals`, `errlvl`, `escape`, `every`, `except`, `exception`, `exec`, `execute`, `exists`, `exit`, `external`, `extract`, `false`, `fetch`, `file`, `fillfactor`, `filter`, `first`, `float`, `for`, `foreign`, `fortran`, `found`, `free`, `freetext`, `freetexttable`, `from`, `full`, `fulltexttable`, `function`, `fusion`, `general`, `get`, `global`, `go`, `goto`, `grant`, `group`, `grouping`, `having`, `hold`, `holdlock`, `host`, `hour`, `identity`, `identity_insert`, `identitycol`, `if`, `ignore`, `immediate`, `in`, `include`, `index`, `indicator`, `initialize`, `initially`, `inner`, `inout`, `input`, `insensitive`, `insert`, `int`, `integer`, `intersect`, `intersection`, `interval`, `into`, `is`, `isolation`, `iterate`, `join`, `key`, `kill`, `language`, `large`, `last`, `lateral`, `leading`, `left`, `less`, `level`, `like`, `like_regex`, `limit`, `lineno`, `ln`, `load`, `local`, `localtime`, `localtimestamp`, `locator`, `lower`, `map`, `match`, `max`, `member`, `merge`, `method`, `min`, `minute`, `mod`, `modifies`, `modify`, `module`, `month`, `multiset`, `names`, `national`, `natural`, `nchar`, `nclob`, `new`, `next`, `no`, `nocheck`, `nonclustered`, `none`, `normalize`, `not`, `null`, `nullif`, `numeric`, `object`, `occurrences_regex`, `octet_length`, `of`, `off`, `offsets`, `old`, `on`, `only`, `open`, `opendatasource`, `openquery`, `openrowset`, `openxml`, `operation`, `option`, `or`, `order`, `ordinality`, `out`, `outer`, `output`, `over`, `overlaps`, `overlay`, `pad`, `parameter`, `parameters`, `partial`, `partition`, `pascal`, `path`, `percent`, `percent_rank`, `percentile_cont`, `percentile_disc`, `pivot`, `plan`, `position`, `position_regex`, `postfix`, `precision`, `prefix`, `preorder`, `prepare`, `preserve`, `primary`, `print`, `prior`, `privileges`, `proc`, `procedure`, `public`, `raiserror`, `range`, `read`, `reads`, `readtext`, `real`, `reconfigure`, `recursive`, `ref`, `references`, `referencing`, `regr_avgx`, `regr_avgy`, `regr_count`, `regr_intercept`, `regr_r2`, `regr_slope`, `regr_sxx`, `regr_sxy`, `regr_syy`, `relative`, `release`, `replication`, `restore`, `restrict`, `result`, `return`, `returns`, `revert`, `revoke`, `right`, `role`, `rollback`, `rollup`, `routine`, `row`, `rowcount`, `rowguidcol`, `rows`, `rule`, `save`, `savepoint`, `schema`, `scope`, `scroll`, `search`, `second`, `section`, `securityaudit`, `select`, `semantickeyphrasetable`, `semanticsimilaritydetailstable`, `semanticsimilaritytable`, `sensitive`, `sequence`, `session`, `session_user`, `set`, `sets`, `setuser`, `shutdown`, `similar`, `size`, `smallint`, `some`, `space`, `specific`, `specifictype`, `sql`, `sqlca`, `sqlcode`, `sqlerror`, `sqlexception`, `sqlstate`, `sqlwarning`, `start`, `state`, `statement`, `static`, `statistics`, `stddev_pop`, `stddev_samp`, `structure`, `submultiset`, `substring`, `substring_regex`, `sum`, `symmetric`, `system`, `system_user`, `table`, `tablesample`, `temporary`, `terminate`, `textsize`, `than`, `then`, `throw`, `time`, `timestamp`, `timezone_hour`, `timezone_minute`, `to`, `top`, `trailing`, `tran`, `transaction`, `translate`, `translate_regex`, `translation`, `treat`, `trigger`, `trim`, `true`, `truncate`, `try`, `try_convert`, `tsequal`, `uescape`, `under`, `union`, `unique`, `unknown`, `unnest`, `unpivot`, `update`, `updatetext`, `upper`, `usage`, `use`, `user`, `using`, `value`, `values`, `var_pop`, `var_samp`, `varchar`, `variable`, `varying`, `view`, `waitfor`, `when`, `whenever`, `where`, `while`, `width_bucket`, `window`, `with`, `within`, `without`, `work`, `write`, `writetext`, `xmlagg`, `xmlattributes`, `xmlbinary`, `xmlcast`, `xmlcomment`, `xmlconcat`, `xmldocument`, `xmlelement`, `xmlexists`, `xmlforest`, `xmliterate`, `xmlnamespaces`, `xmlparse`, `xmlpi`, `xmlquery`, `xmlserialize`, `xmltable`, `xmltext`, `xmlvalidate`, `year`, `zone`), Keyword, nil}, + {`(\[)([^]]+)(\])`, ByGroups(Operator, Name, Operator), nil}, + {`0x[0-9a-f]+`, LiteralNumberHex, nil}, + {`[0-9]+\.[0-9]*(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`\.[0-9]+(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`[0-9]+e[+-]?[0-9]+`, LiteralNumberFloat, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`[;(),.]`, Punctuation, nil}, + {`@@\w+`, NameBuiltin, nil}, + {`@\w+`, NameVariable, nil}, + {`(\w+)(:)`, ByGroups(NameLabel, Punctuation), nil}, + {`#?#?\w+`, Name, nil}, + {`\?`, NameVariableMagic, nil}, + }, + "multiline-comments": { + {`/\*`, CommentMultiline, Push("multiline-comments")}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[^/*]+`, CommentMultiline, nil}, + {`[/*]`, CommentMultiline, nil}, + }, + "string": { + {`[^']+`, LiteralStringSingle, nil}, + {`''`, LiteralStringSingle, nil}, + {`'`, LiteralStringSingle, Pop(1)}, + }, + "quoted-ident": { + {`[^"]+`, LiteralStringName, nil}, + {`""`, LiteralStringName, nil}, + {`"`, LiteralStringName, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/turing.go b/vendor/github.com/alecthomas/chroma/lexers/t/turing.go new file mode 100644 index 000000000..ae5671b50 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/turing.go @@ -0,0 +1,43 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Turing lexer. +var Turing = internal.Register(MustNewLexer( + &Config{ + Name: "Turing", + Aliases: []string{"turing"}, + Filenames: []string{"*.turing", "*.tu"}, + MimeTypes: []string{"text/x-turing"}, + }, + Rules{ + "root": { + {`\n`, Text, nil}, + {`\s+`, Text, nil}, + {`\\\n`, Text, nil}, + {`%(.*?)\n`, CommentSingle, nil}, + {`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil}, + {`(var|fcn|function|proc|procedure|process|class|end|record|type|begin|case|loop|for|const|union|monitor|module|handler)\b`, KeywordDeclaration, nil}, + {`(all|asm|assert|bind|bits|body|break|by|cheat|checked|close|condition|decreasing|def|deferred|else|elsif|exit|export|external|flexible|fork|forward|free|get|if|implement|import|include|inherit|init|invariant|label|new|objectclass|of|opaque|open|packed|pause|pervasive|post|pre|priority|put|quit|read|register|result|seek|self|set|signal|skip|tag|tell|then|timeout|to|unchecked|unqualified|wait|when|write)\b`, Keyword, nil}, + {`(true|false)\b`, KeywordConstant, nil}, + {Words(``, `\b`, `addressint`, `array`, `boolean`, `char`, `int`, `int1`, `int2`, `int4`, `int8`, `nat`, `nat1`, `nat2`, `nat4`, `nat8`, `pointer`, `real`, `real4`, `real8`, `string`, `enum`), KeywordType, nil}, + {`\d+i`, LiteralNumber, nil}, + {`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil}, + {`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil}, + {`\d+[Ee][-+]\d+i`, LiteralNumber, nil}, + {`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil}, + {`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil}, + {`0[0-7]+`, LiteralNumberOct, nil}, + {`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil}, + {`(div|mod|rem|\*\*|=|<|>|>=|<=|not=|not|and|or|xor|=>|in|shl|shr|->|~|~=|~in|&|:=|\.\.|[\^+\-*/&#])`, Operator, nil}, + {`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`[()\[\]{}.,:]`, Punctuation, nil}, + {`[^\W\d]\w*`, NameOther, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/turtle.go b/vendor/github.com/alecthomas/chroma/lexers/t/turtle.go new file mode 100644 index 000000000..71d3c47be --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/turtle.go @@ -0,0 +1,67 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Turtle lexer. +var Turtle = internal.Register(MustNewLexer( + &Config{ + Name: "Turtle", + Aliases: []string{"turtle"}, + Filenames: []string{"*.ttl"}, + MimeTypes: []string{"text/turtle", "application/x-turtle"}, + NotMultiline: true, + CaseInsensitive: true, + }, + Rules{ + "root": { + {`\s+`, TextWhitespace, nil}, + {"(@base|BASE)(\\s+)(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)(\\s*)(\\.?)", ByGroups(Keyword, TextWhitespace, NameVariable, TextWhitespace, Punctuation), nil}, + {"(@prefix|PREFIX)(\\s+)((?:[a-z][\\w-]*)?\\:)(\\s+)(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)(\\s*)(\\.?)", ByGroups(Keyword, TextWhitespace, NameNamespace, TextWhitespace, NameVariable, TextWhitespace, Punctuation), nil}, + {`(?<=\s)a(?=\s)`, KeywordType, nil}, + {"(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)", NameVariable, nil}, + {`((?:[a-z][\w-]*)?\:)([a-z][\w-]*)`, ByGroups(NameNamespace, NameTag), nil}, + {`#[^\n]+`, Comment, nil}, + {`\b(true|false)\b`, Literal, nil}, + {`[+\-]?\d*\.\d+`, LiteralNumberFloat, nil}, + {`[+\-]?\d*(:?\.\d+)?E[+\-]?\d+`, LiteralNumberFloat, nil}, + {`[+\-]?\d+`, LiteralNumberInteger, nil}, + {`[\[\](){}.;,:^]`, Punctuation, nil}, + {`"""`, LiteralString, Push("triple-double-quoted-string")}, + {`"`, LiteralString, Push("single-double-quoted-string")}, + {`'''`, LiteralString, Push("triple-single-quoted-string")}, + {`'`, LiteralString, Push("single-single-quoted-string")}, + }, + "triple-double-quoted-string": { + {`"""`, LiteralString, Push("end-of-string")}, + {`[^\\]+`, LiteralString, nil}, + {`\\`, LiteralString, Push("string-escape")}, + }, + "single-double-quoted-string": { + {`"`, LiteralString, Push("end-of-string")}, + {`[^"\\\n]+`, LiteralString, nil}, + {`\\`, LiteralString, Push("string-escape")}, + }, + "triple-single-quoted-string": { + {`'''`, LiteralString, Push("end-of-string")}, + {`[^\\]+`, LiteralString, nil}, + {`\\`, LiteralString, Push("string-escape")}, + }, + "single-single-quoted-string": { + {`'`, LiteralString, Push("end-of-string")}, + {`[^'\\\n]+`, LiteralString, nil}, + {`\\`, LiteralString, Push("string-escape")}, + }, + "string-escape": { + {`.`, LiteralString, Pop(1)}, + }, + "end-of-string": { + {`(@)([a-z]+(:?-[a-z0-9]+)*)`, ByGroups(Operator, GenericEmph, GenericEmph), Pop(2)}, + {"(\\^\\^)(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)", ByGroups(Operator, GenericEmph), Pop(2)}, + {`(\^\^)((?:[a-z][\w-]*)?\:)([a-z][\w-]*)`, ByGroups(Operator, GenericEmph, GenericEmph), Pop(2)}, + Default(Pop(2)), + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/twig.go b/vendor/github.com/alecthomas/chroma/lexers/t/twig.go new file mode 100644 index 000000000..56aa9b9a7 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/twig.go @@ -0,0 +1,54 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Twig lexer. +var Twig = internal.Register(MustNewLexer( + &Config{ + Name: "Twig", + Aliases: []string{"twig"}, + Filenames: []string{}, + MimeTypes: []string{"application/x-twig"}, + DotAll: true, + }, + Rules{ + "root": { + {`[^{]+`, Other, nil}, + {`\{\{`, CommentPreproc, Push("var")}, + {`\{\#.*?\#\}`, Comment, nil}, + {`(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endraw)(\s*-?)(%\})`, ByGroups(CommentPreproc, Text, Keyword, Text, CommentPreproc, Other, CommentPreproc, Text, Keyword, Text, CommentPreproc), nil}, + {`(\{%)(-?\s*)(verbatim)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endverbatim)(\s*-?)(%\})`, ByGroups(CommentPreproc, Text, Keyword, Text, CommentPreproc, Other, CommentPreproc, Text, Keyword, Text, CommentPreproc), nil}, + {`(\{%)(-?\s*)(filter)(\s+)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*)`, ByGroups(CommentPreproc, Text, Keyword, Text, NameFunction), Push("tag")}, + {`(\{%)(-?\s*)([a-zA-Z_]\w*)`, ByGroups(CommentPreproc, Text, Keyword), Push("tag")}, + {`\{`, Other, nil}, + }, + "varnames": { + {`(\|)(\s*)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*)`, ByGroups(Operator, Text, NameFunction), nil}, + {`(is)(\s+)(not)?(\s*)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*)`, ByGroups(Keyword, Text, Keyword, Text, NameFunction), nil}, + {`(?i)(true|false|none|null)\b`, KeywordPseudo, nil}, + {`(in|not|and|b-and|or|b-or|b-xor|isif|elseif|else|importconstant|defined|divisibleby|empty|even|iterable|odd|sameasmatches|starts\s+with|ends\s+with)\b`, Keyword, nil}, + {`(loop|block|parent)\b`, NameBuiltin, nil}, + {`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*`, NameVariable, nil}, + {`\.(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*`, NameVariable, nil}, + {`\.[0-9]+`, LiteralNumber, nil}, + {`:?"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`:?'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`([{}()\[\]+\-*/,:~%]|\.\.|\?|:|\*\*|\/\/|!=|[><=]=?)`, Operator, nil}, + {`[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil}, + }, + "var": { + {`\s+`, Text, nil}, + {`(-?)(\}\})`, ByGroups(Text, CommentPreproc), Pop(1)}, + Include("varnames"), + }, + "tag": { + {`\s+`, Text, nil}, + {`(-?)(%\})`, ByGroups(Text, CommentPreproc), Pop(1)}, + Include("varnames"), + {`.`, Punctuation, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/t/typescript.go b/vendor/github.com/alecthomas/chroma/lexers/t/typescript.go new file mode 100644 index 000000000..57d08bf16 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/t/typescript.go @@ -0,0 +1,73 @@ +package t + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// TypeScript lexer. +var TypeScript = internal.Register(MustNewLexer( + &Config{ + Name: "TypeScript", + Aliases: []string{"ts", "typescript"}, + Filenames: []string{"*.ts", "*.tsx"}, + MimeTypes: []string{"text/x-typescript"}, + DotAll: true, + EnsureNL: true, + }, + Rules{ + "commentsandwhitespace": { + {`\s+`, Text, nil}, + {``, Comment, Pop(1)}, + {`-`, Comment, nil}, + }, + "tag": { + {`\s+`, Text, nil}, + {`[\w.:-]+\s*=`, NameAttribute, Push("attr")}, + {`/?\s*>`, NameTag, Pop(1)}, + }, + "attr": { + {`\s+`, Text, nil}, + {`".*?"`, LiteralString, Pop(1)}, + {`'.*?'`, LiteralString, Pop(1)}, + {`[^\s>]+`, LiteralString, Pop(1)}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/x/xorg.go b/vendor/github.com/alecthomas/chroma/lexers/x/xorg.go new file mode 100644 index 000000000..6e6cbec60 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/x/xorg.go @@ -0,0 +1,25 @@ +package x + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Xorg lexer. +var Xorg = internal.Register(MustNewLexer( + &Config{ + Name: "Xorg", + Aliases: []string{"xorg.conf"}, + Filenames: []string{"xorg.conf"}, + MimeTypes: []string{}, + }, + Rules{ + "root": { + {`\s+`, TextWhitespace, nil}, + {`#.*$`, Comment, nil}, + {`((|Sub)Section)(\s+)("\w+")`, ByGroups(KeywordNamespace, LiteralStringEscape, TextWhitespace, LiteralStringEscape), nil}, + {`(End(|Sub)Section)`, KeywordNamespace, nil}, + {`(\w+)(\s+)([^\n#]+)`, ByGroups(NameKeyword, TextWhitespace, LiteralString), nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/lexers/y/yaml.go b/vendor/github.com/alecthomas/chroma/lexers/y/yaml.go new file mode 100644 index 000000000..82fed0c0f --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/lexers/y/yaml.go @@ -0,0 +1,50 @@ +package y + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +var YAML = internal.Register(MustNewLexer( + &Config{ + Name: "YAML", + Aliases: []string{"yaml"}, + Filenames: []string{"*.yaml", "*.yml"}, + MimeTypes: []string{"text/x-yaml"}, + }, + Rules{ + "root": { + Include("whitespace"), + {`^---`, Text, nil}, + {`[\n?]?\s*- `, Text, nil}, + {`#.*$`, Comment, nil}, + {`!![^\s]+`, CommentPreproc, nil}, + {`&[^\s]+`, CommentPreproc, nil}, + {`\*[^\s]+`, CommentPreproc, nil}, + {`^%include\s+[^\n\r]+`, CommentPreproc, nil}, + {`([>|+-]\s+)(\s+)((?:(?:.*?$)(?:[\n\r]*?)?)*)`, ByGroups(StringDoc, StringDoc, StringDoc), nil}, + Include("key"), + Include("value"), + {`[?:,\[\]]`, Punctuation, nil}, + {`.`, Text, nil}, + }, + "value": { + {Words(``, `\b`, "true", "false", "null"), KeywordConstant, nil}, + {`"(?:\\.|[^"])*"`, StringDouble, nil}, + {`'(?:\\.|[^'])*'`, StringSingle, nil}, + {`\d\d\d\d-\d\d-\d\d([T ]\d\d:\d\d:\d\d(\.\d+)?(Z|\s+[-+]\d+)?)?`, LiteralDate, nil}, + {`\b[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)\b`, Number, nil}, + {`\b[\w]+\b`, Text, nil}, + }, + "key": { + {`"[^"\n].*": `, Keyword, nil}, + {`(-)( )([^"\n{]*)(:)( )`, ByGroups(Punctuation, Whitespace, Keyword, Punctuation, Whitespace), nil}, + {`([^"\n{]*)(:)( )`, ByGroups(Keyword, Punctuation, Whitespace), nil}, + {`([^"\n{]*)(:)(\n)`, ByGroups(Keyword, Punctuation, Whitespace), nil}, + }, + "whitespace": { + {`\s+`, Whitespace, nil}, + {`\n+`, Whitespace, nil}, + }, + }, +)) diff --git a/vendor/github.com/alecthomas/chroma/mutators.go b/vendor/github.com/alecthomas/chroma/mutators.go new file mode 100644 index 000000000..bd6d720e0 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/mutators.go @@ -0,0 +1,131 @@ +package chroma + +import ( + "fmt" + "strings" +) + +// A Mutator modifies the behaviour of the lexer. +type Mutator interface { + // Mutate the lexer state machine as it is processing. + Mutate(state *LexerState) error +} + +// A LexerMutator is an additional interface that a Mutator can implement +// to modify the lexer when it is compiled. +type LexerMutator interface { + // Rules are the lexer rules, state is the state key for the rule the mutator is associated with. + MutateLexer(rules CompiledRules, state string, rule int) error +} + +// A MutatorFunc is a Mutator that mutates the lexer state machine as it is processing. +type MutatorFunc func(state *LexerState) error + +func (m MutatorFunc) Mutate(state *LexerState) error { return m(state) } // nolint + +// Mutators applies a set of Mutators in order. +func Mutators(modifiers ...Mutator) MutatorFunc { + return func(state *LexerState) error { + for _, modifier := range modifiers { + if err := modifier.Mutate(state); err != nil { + return err + } + } + return nil + } +} + +type includeMutator struct { + state string +} + +// Include the given state. +func Include(state string) Rule { + return Rule{Mutator: &includeMutator{state}} +} + +func (i *includeMutator) Mutate(s *LexerState) error { + return fmt.Errorf("should never reach here Include(%q)", i.state) +} + +func (i *includeMutator) MutateLexer(rules CompiledRules, state string, rule int) error { + includedRules, ok := rules[i.state] + if !ok { + return fmt.Errorf("invalid include state %q", i.state) + } + rules[state] = append(rules[state][:rule], append(includedRules, rules[state][rule+1:]...)...) + return nil +} + +type combinedMutator struct { + states []string +} + +// Combined creates a new anonymous state from the given states, and pushes that state. +func Combined(states ...string) Mutator { + return &combinedMutator{states} +} + +func (c *combinedMutator) Mutate(s *LexerState) error { + return fmt.Errorf("should never reach here Combined(%v)", c.states) +} + +func (c *combinedMutator) MutateLexer(rules CompiledRules, state string, rule int) error { + name := "__combined_" + strings.Join(c.states, "__") + if _, ok := rules[name]; !ok { + combined := []*CompiledRule{} + for _, state := range c.states { + rules, ok := rules[state] + if !ok { + return fmt.Errorf("invalid combine state %q", state) + } + combined = append(combined, rules...) + } + rules[name] = combined + } + rules[state][rule].Mutator = Push(name) + return nil +} + +// Push states onto the stack. +func Push(states ...string) MutatorFunc { + return func(s *LexerState) error { + if len(states) == 0 { + s.Stack = append(s.Stack, s.State) + } else { + for _, state := range states { + if state == "#pop" { + s.Stack = s.Stack[:len(s.Stack)-1] + } else { + s.Stack = append(s.Stack, state) + } + } + } + return nil + } +} + +// Pop state from the stack when rule matches. +func Pop(n int) MutatorFunc { + return func(state *LexerState) error { + if len(state.Stack) == 0 { + return fmt.Errorf("nothing to pop") + } + state.Stack = state.Stack[:len(state.Stack)-n] + return nil + } +} + +// Default returns a Rule that applies a set of Mutators. +func Default(mutators ...Mutator) Rule { + return Rule{Mutator: Mutators(mutators...)} +} + +// Stringify returns the raw string for a set of tokens. +func Stringify(tokens ...Token) string { + out := []string{} + for _, t := range tokens { + out = append(out, t.Value) + } + return strings.Join(out, "") +} diff --git a/vendor/github.com/alecthomas/chroma/pygments-lexers.txt b/vendor/github.com/alecthomas/chroma/pygments-lexers.txt new file mode 100644 index 000000000..9c9ced2ee --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/pygments-lexers.txt @@ -0,0 +1,325 @@ +Generated with: + + g 'class.*RegexLexer' | pawk --strict -F: '"pygments.lexers.%s.%s" % (f[0].split(".")[0], f[2].split()[1].split("(")[0])' > lexers.txt + +perl6: + Requires a bunch of helpers that I do not have the time to convert. + +kotlin: + invalid unicode escape sequences + FIXED: Have to disable wide Unicode characters in unistring.py + +pygments.lexers.ambient.AmbientTalkLexer +pygments.lexers.ampl.AmplLexer +pygments.lexers.actionscript.ActionScriptLexer +pygments.lexers.actionscript.ActionScript3Lexer +pygments.lexers.actionscript.MxmlLexer +pygments.lexers.algebra.GAPLexer +pygments.lexers.algebra.MathematicaLexer +pygments.lexers.algebra.MuPADLexer +pygments.lexers.algebra.BCLexer +pygments.lexers.apl.APLLexer +pygments.lexers.bibtex.BibTeXLexer +pygments.lexers.bibtex.BSTLexer +pygments.lexers.basic.BlitzMaxLexer +pygments.lexers.basic.BlitzBasicLexer +pygments.lexers.basic.MonkeyLexer +pygments.lexers.basic.CbmBasicV2Lexer +pygments.lexers.basic.QBasicLexer +pygments.lexers.automation.AutohotkeyLexer +pygments.lexers.automation.AutoItLexer +pygments.lexers.archetype.AtomsLexer +pygments.lexers.c_like.ClayLexer +pygments.lexers.c_like.ValaLexer +pygments.lexers.asm.GasLexer +pygments.lexers.asm.ObjdumpLexer +pygments.lexers.asm.HsailLexer +pygments.lexers.asm.LlvmLexer +pygments.lexers.asm.NasmLexer +pygments.lexers.asm.TasmLexer +pygments.lexers.asm.Ca65Lexer +pygments.lexers.business.CobolLexer +pygments.lexers.business.ABAPLexer +pygments.lexers.business.OpenEdgeLexer +pygments.lexers.business.GoodDataCLLexer +pygments.lexers.business.MaqlLexer +pygments.lexers.capnproto.CapnProtoLexer +pygments.lexers.chapel.ChapelLexer +pygments.lexers.clean.CleanLexer +pygments.lexers.c_cpp.CFamilyLexer +pygments.lexers.console.VCTreeStatusLexer +pygments.lexers.console.PyPyLogLexer +pygments.lexers.csound.CsoundLexer +pygments.lexers.csound.CsoundDocumentLexer +pygments.lexers.csound.CsoundDocumentLexer +pygments.lexers.crystal.CrystalLexer +pygments.lexers.dalvik.SmaliLexer +pygments.lexers.css.CssLexer +pygments.lexers.css.SassLexer +pygments.lexers.css.ScssLexer +pygments.lexers.configs.IniLexer +pygments.lexers.configs.RegeditLexer +pygments.lexers.configs.PropertiesLexer +pygments.lexers.configs.KconfigLexer +pygments.lexers.configs.Cfengine3Lexer +pygments.lexers.configs.ApacheConfLexer +pygments.lexers.configs.SquidConfLexer +pygments.lexers.configs.NginxConfLexer +pygments.lexers.configs.LighttpdConfLexer +pygments.lexers.configs.DockerLexer +pygments.lexers.configs.TerraformLexer +pygments.lexers.configs.TermcapLexer +pygments.lexers.configs.TerminfoLexer +pygments.lexers.configs.PkgConfigLexer +pygments.lexers.configs.PacmanConfLexer +pygments.lexers.data.YamlLexer +pygments.lexers.data.JsonLexer +pygments.lexers.diff.DiffLexer +pygments.lexers.diff.DarcsPatchLexer +pygments.lexers.diff.WDiffLexer +pygments.lexers.dotnet.CSharpLexer +pygments.lexers.dotnet.NemerleLexer +pygments.lexers.dotnet.BooLexer +pygments.lexers.dotnet.VbNetLexer +pygments.lexers.dotnet.GenericAspxLexer +pygments.lexers.dotnet.FSharpLexer +pygments.lexers.dylan.DylanLexer +pygments.lexers.dylan.DylanLidLexer +pygments.lexers.ecl.ECLLexer +pygments.lexers.eiffel.EiffelLexer +pygments.lexers.dsls.ProtoBufLexer +pygments.lexers.dsls.ThriftLexer +pygments.lexers.dsls.BroLexer +pygments.lexers.dsls.PuppetLexer +pygments.lexers.dsls.RslLexer +pygments.lexers.dsls.MscgenLexer +pygments.lexers.dsls.VGLLexer +pygments.lexers.dsls.AlloyLexer +pygments.lexers.dsls.PanLexer +pygments.lexers.dsls.CrmshLexer +pygments.lexers.dsls.FlatlineLexer +pygments.lexers.dsls.SnowballLexer +pygments.lexers.elm.ElmLexer +pygments.lexers.erlang.ErlangLexer +pygments.lexers.erlang.ElixirLexer +pygments.lexers.ezhil.EzhilLexer +pygments.lexers.esoteric.BrainfuckLexer +pygments.lexers.esoteric.BefungeLexer +pygments.lexers.esoteric.CAmkESLexer +pygments.lexers.esoteric.CapDLLexer +pygments.lexers.esoteric.RedcodeLexer +pygments.lexers.esoteric.AheuiLexer +pygments.lexers.factor.FactorLexer +pygments.lexers.fantom.FantomLexer +pygments.lexers.felix.FelixLexer +pygments.lexers.forth.ForthLexer +pygments.lexers.fortran.FortranLexer +pygments.lexers.fortran.FortranFixedLexer +pygments.lexers.go.GoLexer +pygments.lexers.foxpro.FoxProLexer +pygments.lexers.graph.CypherLexer +pygments.lexers.grammar_notation.BnfLexer +pygments.lexers.grammar_notation.AbnfLexer +pygments.lexers.grammar_notation.JsgfLexer +pygments.lexers.graphics.GLShaderLexer +pygments.lexers.graphics.PostScriptLexer +pygments.lexers.graphics.AsymptoteLexer +pygments.lexers.graphics.GnuplotLexer +pygments.lexers.graphics.PovrayLexer +pygments.lexers.hexdump.HexdumpLexer +pygments.lexers.haskell.HaskellLexer +pygments.lexers.haskell.IdrisLexer +pygments.lexers.haskell.AgdaLexer +pygments.lexers.haskell.CryptolLexer +pygments.lexers.haskell.KokaLexer +pygments.lexers.haxe.HaxeLexer +pygments.lexers.haxe.HxmlLexer +pygments.lexers.hdl.VerilogLexer +pygments.lexers.hdl.SystemVerilogLexer +pygments.lexers.hdl.VhdlLexer +pygments.lexers.idl.IDLLexer +pygments.lexers.inferno.LimboLexer +pygments.lexers.igor.IgorLexer +pygments.lexers.html.HtmlLexer +pygments.lexers.html.DtdLexer +pygments.lexers.html.XmlLexer +pygments.lexers.html.HamlLexer +pygments.lexers.html.ScamlLexer +pygments.lexers.html.PugLexer +pygments.lexers.installers.NSISLexer +pygments.lexers.installers.RPMSpecLexer +pygments.lexers.installers.SourcesListLexer +pygments.lexers.installers.DebianControlLexer +pygments.lexers.iolang.IoLexer +pygments.lexers.julia.JuliaLexer +pygments.lexers.int_fiction.Inform6Lexer +pygments.lexers.int_fiction.Inform7Lexer +pygments.lexers.int_fiction.Tads3Lexer +pygments.lexers.make.BaseMakefileLexer +pygments.lexers.make.CMakeLexer +pygments.lexers.javascript.JavascriptLexer +pygments.lexers.javascript.KalLexer +pygments.lexers.javascript.LiveScriptLexer +pygments.lexers.javascript.DartLexer +pygments.lexers.javascript.TypeScriptLexer +pygments.lexers.javascript.LassoLexer +pygments.lexers.javascript.ObjectiveJLexer +pygments.lexers.javascript.CoffeeScriptLexer +pygments.lexers.javascript.MaskLexer +pygments.lexers.javascript.EarlGreyLexer +pygments.lexers.javascript.JuttleLexer +pygments.lexers.jvm.JavaLexer +pygments.lexers.jvm.ScalaLexer +pygments.lexers.jvm.GosuLexer +pygments.lexers.jvm.GroovyLexer +pygments.lexers.jvm.IokeLexer +pygments.lexers.jvm.ClojureLexer +pygments.lexers.jvm.TeaLangLexer +pygments.lexers.jvm.CeylonLexer +pygments.lexers.jvm.KotlinLexer +pygments.lexers.jvm.XtendLexer +pygments.lexers.jvm.PigLexer +pygments.lexers.jvm.GoloLexer +pygments.lexers.jvm.JasminLexer +pygments.lexers.markup.BBCodeLexer +pygments.lexers.markup.MoinWikiLexer +pygments.lexers.markup.RstLexer +pygments.lexers.markup.TexLexer +pygments.lexers.markup.GroffLexer +pygments.lexers.markup.MozPreprocHashLexer +pygments.lexers.markup.MarkdownLexer +pygments.lexers.ml.SMLLexer +pygments.lexers.ml.OcamlLexer +pygments.lexers.ml.OpaLexer +pygments.lexers.modeling.ModelicaLexer +pygments.lexers.modeling.BugsLexer +pygments.lexers.modeling.JagsLexer +pygments.lexers.modeling.StanLexer +pygments.lexers.matlab.MatlabLexer +pygments.lexers.matlab.OctaveLexer +pygments.lexers.matlab.ScilabLexer +pygments.lexers.monte.MonteLexer +pygments.lexers.lisp.SchemeLexer +pygments.lexers.lisp.CommonLispLexer +pygments.lexers.lisp.HyLexer +pygments.lexers.lisp.RacketLexer +pygments.lexers.lisp.NewLispLexer +pygments.lexers.lisp.EmacsLispLexer +pygments.lexers.lisp.ShenLexer +pygments.lexers.lisp.XtlangLexer +pygments.lexers.modula2.Modula2Lexer +pygments.lexers.ncl.NCLLexer +pygments.lexers.nim.NimLexer +pygments.lexers.nit.NitLexer +pygments.lexers.nix.NixLexer +pygments.lexers.oberon.ComponentPascalLexer +pygments.lexers.ooc.OocLexer +pygments.lexers.objective.SwiftLexer +pygments.lexers.parasail.ParaSailLexer +pygments.lexers.pawn.SourcePawnLexer +pygments.lexers.pawn.PawnLexer +pygments.lexers.pascal.AdaLexer +pygments.lexers.parsers.RagelLexer +pygments.lexers.parsers.RagelEmbeddedLexer +pygments.lexers.parsers.AntlrLexer +pygments.lexers.parsers.TreetopBaseLexer +pygments.lexers.parsers.EbnfLexer +pygments.lexers.php.ZephirLexer +pygments.lexers.php.PhpLexer +pygments.lexers.perl.PerlLexer +pygments.lexers.perl.Perl6Lexer +pygments.lexers.praat.PraatLexer +pygments.lexers.prolog.PrologLexer +pygments.lexers.prolog.LogtalkLexer +pygments.lexers.qvt.QVToLexer +pygments.lexers.rdf.SparqlLexer +pygments.lexers.rdf.TurtleLexer +pygments.lexers.python.PythonLexer +pygments.lexers.python.Python3Lexer +pygments.lexers.python.PythonTracebackLexer +pygments.lexers.python.Python3TracebackLexer +pygments.lexers.python.CythonLexer +pygments.lexers.python.DgLexer +pygments.lexers.rebol.RebolLexer +pygments.lexers.rebol.RedLexer +pygments.lexers.resource.ResourceLexer +pygments.lexers.rnc.RNCCompactLexer +pygments.lexers.roboconf.RoboconfGraphLexer +pygments.lexers.roboconf.RoboconfInstancesLexer +pygments.lexers.rust.RustLexer +pygments.lexers.ruby.RubyLexer +pygments.lexers.ruby.FancyLexer +pygments.lexers.sas.SASLexer +pygments.lexers.smalltalk.SmalltalkLexer +pygments.lexers.smalltalk.NewspeakLexer +pygments.lexers.smv.NuSMVLexer +pygments.lexers.shell.BashLexer +pygments.lexers.shell.BatchLexer +pygments.lexers.shell.TcshLexer +pygments.lexers.shell.PowerShellLexer +pygments.lexers.shell.FishShellLexer +pygments.lexers.snobol.SnobolLexer +pygments.lexers.scripting.LuaLexer +pygments.lexers.scripting.ChaiscriptLexer +pygments.lexers.scripting.LSLLexer +pygments.lexers.scripting.AppleScriptLexer +pygments.lexers.scripting.RexxLexer +pygments.lexers.scripting.MOOCodeLexer +pygments.lexers.scripting.HybrisLexer +pygments.lexers.scripting.EasytrieveLexer +pygments.lexers.scripting.JclLexer +pygments.lexers.supercollider.SuperColliderLexer +pygments.lexers.stata.StataLexer +pygments.lexers.tcl.TclLexer +pygments.lexers.sql.PostgresLexer +pygments.lexers.sql.PlPgsqlLexer +pygments.lexers.sql.PsqlRegexLexer +pygments.lexers.sql.SqlLexer +pygments.lexers.sql.TransactSqlLexer +pygments.lexers.sql.MySqlLexer +pygments.lexers.sql.RqlLexer +pygments.lexers.testing.GherkinLexer +pygments.lexers.testing.TAPLexer +pygments.lexers.textedit.AwkLexer +pygments.lexers.textedit.VimLexer +pygments.lexers.textfmts.IrcLogsLexer +pygments.lexers.textfmts.GettextLexer +pygments.lexers.textfmts.HttpLexer +pygments.lexers.textfmts.TodotxtLexer +pygments.lexers.trafficscript.RtsLexer +pygments.lexers.theorem.CoqLexer +pygments.lexers.theorem.IsabelleLexer +pygments.lexers.theorem.LeanLexer +pygments.lexers.templates.SmartyLexer +pygments.lexers.templates.VelocityLexer +pygments.lexers.templates.DjangoLexer +pygments.lexers.templates.MyghtyLexer +pygments.lexers.templates.MasonLexer +pygments.lexers.templates.MakoLexer +pygments.lexers.templates.CheetahLexer +pygments.lexers.templates.GenshiTextLexer +pygments.lexers.templates.GenshiMarkupLexer +pygments.lexers.templates.JspRootLexer +pygments.lexers.templates.EvoqueLexer +pygments.lexers.templates.ColdfusionLexer +pygments.lexers.templates.ColdfusionMarkupLexer +pygments.lexers.templates.TeaTemplateRootLexer +pygments.lexers.templates.HandlebarsLexer +pygments.lexers.templates.LiquidLexer +pygments.lexers.templates.TwigLexer +pygments.lexers.templates.Angular2Lexer +pygments.lexers.urbi.UrbiscriptLexer +pygments.lexers.typoscript.TypoScriptCssDataLexer +pygments.lexers.typoscript.TypoScriptHtmlDataLexer +pygments.lexers.typoscript.TypoScriptLexer +pygments.lexers.varnish.VCLLexer +pygments.lexers.verification.BoogieLexer +pygments.lexers.verification.SilverLexer +pygments.lexers.x10.X10Lexer +pygments.lexers.whiley.WhileyLexer +pygments.lexers.xorg.XorgLexer +pygments.lexers.webmisc.DuelLexer +pygments.lexers.webmisc.XQueryLexer +pygments.lexers.webmisc.QmlLexer +pygments.lexers.webmisc.CirruLexer +pygments.lexers.webmisc.SlimLexer diff --git a/vendor/github.com/alecthomas/chroma/regexp.go b/vendor/github.com/alecthomas/chroma/regexp.go new file mode 100644 index 000000000..7c2fb0bb8 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/regexp.go @@ -0,0 +1,439 @@ +package chroma + +import ( + "fmt" + "os" + "regexp" + "strings" + "sync" + "unicode/utf8" + + "github.com/dlclark/regexp2" +) + +// A Rule is the fundamental matching unit of the Regex lexer state machine. +type Rule struct { + Pattern string + Type Emitter + Mutator Mutator +} + +// An Emitter takes group matches and returns tokens. +type Emitter interface { + // Emit tokens for the given regex groups. + Emit(groups []string, lexer Lexer) Iterator +} + +// EmitterFunc is a function that is an Emitter. +type EmitterFunc func(groups []string, lexer Lexer) Iterator + +// Emit tokens for groups. +func (e EmitterFunc) Emit(groups []string, lexer Lexer) Iterator { return e(groups, lexer) } + +// ByGroups emits a token for each matching group in the rule's regex. +func ByGroups(emitters ...Emitter) Emitter { + return EmitterFunc(func(groups []string, lexer Lexer) Iterator { + iterators := make([]Iterator, 0, len(groups)-1) + if len(emitters) != len(groups)-1 { + iterators = append(iterators, Error.Emit(groups, lexer)) + // panic(errors.Errorf("number of groups %q does not match number of emitters %v", groups, emitters)) + } else { + for i, group := range groups[1:] { + iterators = append(iterators, emitters[i].Emit([]string{group}, lexer)) + } + } + return Concaterator(iterators...) + }) +} + +// UsingByGroup emits tokens for the matched groups in the regex using a +// "sublexer". Used when lexing code blocks where the name of a sublexer is +// contained within the block, for example on a Markdown text block or SQL +// language block. +// +// The sublexer will be retrieved using sublexerGetFunc (typically +// internal.Get), using the captured value from the matched sublexerNameGroup. +// +// If sublexerGetFunc returns a non-nil lexer for the captured sublexerNameGroup, +// then tokens for the matched codeGroup will be emitted using the retrieved +// lexer. Otherwise, if the sublexer is nil, then tokens will be emitted from +// the passed emitter. +// +// Example: +// +// var Markdown = internal.Register(MustNewLexer( +// &Config{ +// Name: "markdown", +// Aliases: []string{"md", "mkd"}, +// Filenames: []string{"*.md", "*.mkd", "*.markdown"}, +// MimeTypes: []string{"text/x-markdown"}, +// }, +// Rules{ +// "root": { +// {"^(```)(\\w+)(\\n)([\\w\\W]*?)(^```$)", +// UsingByGroup( +// internal.Get, +// 2, 4, +// String, String, String, Text, String, +// ), +// nil, +// }, +// }, +// }, +// )) +// +// See the lexers/m/markdown.go for the complete example. +// +// Note: panic's if the number emitters does not equal the number of matched +// groups in the regex. +func UsingByGroup(sublexerGetFunc func(string) Lexer, sublexerNameGroup, codeGroup int, emitters ...Emitter) Emitter { + return EmitterFunc(func(groups []string, lexer Lexer) Iterator { + // bounds check + if len(emitters) != len(groups)-1 { + panic("UsingByGroup expects number of emitters to be the same as len(groups)-1") + } + + // grab sublexer + sublexer := sublexerGetFunc(groups[sublexerNameGroup]) + + // build iterators + iterators := make([]Iterator, len(groups)-1) + for i, group := range groups[1:] { + if i == codeGroup-1 && sublexer != nil { + var err error + iterators[i], err = sublexer.Tokenise(nil, groups[codeGroup]) + if err != nil { + panic(err) + } + } else { + iterators[i] = emitters[i].Emit([]string{group}, lexer) + } + } + + return Concaterator(iterators...) + }) +} + +// Using returns an Emitter that uses a given Lexer for parsing and emitting. +func Using(lexer Lexer) Emitter { + return EmitterFunc(func(groups []string, _ Lexer) Iterator { + it, err := lexer.Tokenise(&TokeniseOptions{State: "root", Nested: true}, groups[0]) + if err != nil { + panic(err) + } + return it + }) +} + +// UsingSelf is like Using, but uses the current Lexer. +func UsingSelf(state string) Emitter { + return EmitterFunc(func(groups []string, lexer Lexer) Iterator { + it, err := lexer.Tokenise(&TokeniseOptions{State: state, Nested: true}, groups[0]) + if err != nil { + panic(err) + } + return it + }) +} + +// Words creates a regex that matches any of the given literal words. +func Words(prefix, suffix string, words ...string) string { + for i, word := range words { + words[i] = regexp.QuoteMeta(word) + } + return prefix + `(` + strings.Join(words, `|`) + `)` + suffix +} + +// Tokenise text using lexer, returning tokens as a slice. +func Tokenise(lexer Lexer, options *TokeniseOptions, text string) ([]Token, error) { + var out []Token + it, err := lexer.Tokenise(options, text) + if err != nil { + return nil, err + } + for t := it(); t != EOF; t = it() { + out = append(out, t) + } + return out, nil +} + +// Rules maps from state to a sequence of Rules. +type Rules map[string][]Rule + +// Clone returns a clone of the Rules. +func (r Rules) Clone() Rules { + out := map[string][]Rule{} + for key, rules := range r { + out[key] = make([]Rule, len(rules)) + copy(out[key], rules) + } + return out +} + +// MustNewLexer creates a new Lexer or panics. +func MustNewLexer(config *Config, rules Rules) *RegexLexer { + lexer, err := NewLexer(config, rules) + if err != nil { + panic(err) + } + return lexer +} + +// NewLexer creates a new regex-based Lexer. +// +// "rules" is a state machine transitition map. Each key is a state. Values are sets of rules +// that match input, optionally modify lexer state, and output tokens. +func NewLexer(config *Config, rules Rules) (*RegexLexer, error) { + if config == nil { + config = &Config{} + } + if _, ok := rules["root"]; !ok { + return nil, fmt.Errorf("no \"root\" state") + } + compiledRules := map[string][]*CompiledRule{} + for state, rules := range rules { + compiledRules[state] = nil + for _, rule := range rules { + flags := "" + if !config.NotMultiline { + flags += "m" + } + if config.CaseInsensitive { + flags += "i" + } + if config.DotAll { + flags += "s" + } + compiledRules[state] = append(compiledRules[state], &CompiledRule{Rule: rule, flags: flags}) + } + } + return &RegexLexer{ + config: config, + rules: compiledRules, + }, nil +} + +// Trace enables debug tracing. +func (r *RegexLexer) Trace(trace bool) *RegexLexer { + r.trace = trace + return r +} + +// A CompiledRule is a Rule with a pre-compiled regex. +// +// Note that regular expressions are lazily compiled on first use of the lexer. +type CompiledRule struct { + Rule + Regexp *regexp2.Regexp + flags string +} + +// CompiledRules is a map of rule name to sequence of compiled rules in that rule. +type CompiledRules map[string][]*CompiledRule + +// LexerState contains the state for a single lex. +type LexerState struct { + Lexer *RegexLexer + Text []rune + Pos int + Rules CompiledRules + Stack []string + State string + Rule int + // Group matches. + Groups []string + // Custum context for mutators. + MutatorContext map[interface{}]interface{} + iteratorStack []Iterator + options *TokeniseOptions +} + +// Set mutator context. +func (l *LexerState) Set(key interface{}, value interface{}) { + l.MutatorContext[key] = value +} + +// Get mutator context. +func (l *LexerState) Get(key interface{}) interface{} { + return l.MutatorContext[key] +} + +// Iterator returns the next Token from the lexer. +func (l *LexerState) Iterator() Token { // nolint: gocognit + for l.Pos < len(l.Text) && len(l.Stack) > 0 { + // Exhaust the iterator stack, if any. + for len(l.iteratorStack) > 0 { + n := len(l.iteratorStack) - 1 + t := l.iteratorStack[n]() + if t == EOF { + l.iteratorStack = l.iteratorStack[:n] + continue + } + return t + } + + l.State = l.Stack[len(l.Stack)-1] + if l.Lexer.trace { + fmt.Fprintf(os.Stderr, "%s: pos=%d, text=%q\n", l.State, l.Pos, string(l.Text[l.Pos:])) + } + selectedRule, ok := l.Rules[l.State] + if !ok { + panic("unknown state " + l.State) + } + ruleIndex, rule, groups := matchRules(l.Text, l.Pos, selectedRule) + // No match. + if groups == nil { + // From Pygments :\ + // + // If the RegexLexer encounters a newline that is flagged as an error token, the stack is + // emptied and the lexer continues scanning in the 'root' state. This can help producing + // error-tolerant highlighting for erroneous input, e.g. when a single-line string is not + // closed. + if l.Text[l.Pos] == '\n' && l.State != l.options.State { + l.Stack = []string{l.options.State} + continue + } + l.Pos++ + return Token{Error, string(l.Text[l.Pos-1 : l.Pos])} + } + l.Rule = ruleIndex + l.Groups = groups + l.Pos += utf8.RuneCountInString(groups[0]) + if rule.Mutator != nil { + if err := rule.Mutator.Mutate(l); err != nil { + panic(err) + } + } + if rule.Type != nil { + l.iteratorStack = append(l.iteratorStack, rule.Type.Emit(l.Groups, l.Lexer)) + } + } + // Exhaust the IteratorStack, if any. + // Duplicate code, but eh. + for len(l.iteratorStack) > 0 { + n := len(l.iteratorStack) - 1 + t := l.iteratorStack[n]() + if t == EOF { + l.iteratorStack = l.iteratorStack[:n] + continue + } + return t + } + + // If we get to here and we still have text, return it as an error. + if l.Pos != len(l.Text) && len(l.Stack) == 0 { + value := string(l.Text[l.Pos:]) + l.Pos = len(l.Text) + return Token{Type: Error, Value: value} + } + return EOF +} + +// RegexLexer is the default lexer implementation used in Chroma. +type RegexLexer struct { + config *Config + analyser func(text string) float32 + trace bool + + mu sync.Mutex + compiled bool + rules map[string][]*CompiledRule +} + +// SetAnalyser sets the analyser function used to perform content inspection. +func (r *RegexLexer) SetAnalyser(analyser func(text string) float32) *RegexLexer { + r.analyser = analyser + return r +} + +func (r *RegexLexer) AnalyseText(text string) float32 { // nolint + if r.analyser != nil { + return r.analyser(text) + } + return 0.0 +} + +func (r *RegexLexer) Config() *Config { // nolint + return r.config +} + +// Regex compilation is deferred until the lexer is used. This is to avoid significant init() time costs. +func (r *RegexLexer) maybeCompile() (err error) { + r.mu.Lock() + defer r.mu.Unlock() + if r.compiled { + return nil + } + for state, rules := range r.rules { + for i, rule := range rules { + if rule.Regexp == nil { + pattern := "(?:" + rule.Pattern + ")" + if rule.flags != "" { + pattern = "(?" + rule.flags + ")" + pattern + } + pattern = `\G` + pattern + rule.Regexp, err = regexp2.Compile(pattern, 0) + if err != nil { + return fmt.Errorf("failed to compile rule %s.%d: %s", state, i, err) + } + } + } + } +restart: + seen := map[LexerMutator]bool{} + for state := range r.rules { + for i := 0; i < len(r.rules[state]); i++ { + rule := r.rules[state][i] + if compile, ok := rule.Mutator.(LexerMutator); ok { + if seen[compile] { + return fmt.Errorf("saw mutator %T twice; this should not happen", compile) + } + seen[compile] = true + if err := compile.MutateLexer(r.rules, state, i); err != nil { + return err + } + // Process the rules again in case the mutator added/removed rules. + // + // This sounds bad, but shouldn't be significant in practice. + goto restart + } + } + } + r.compiled = true + return nil +} + +func (r *RegexLexer) Tokenise(options *TokeniseOptions, text string) (Iterator, error) { // nolint + if err := r.maybeCompile(); err != nil { + return nil, err + } + if options == nil { + options = defaultOptions + } + if !options.Nested && r.config.EnsureNL && !strings.HasSuffix(text, "\n") { + text += "\n" + } + state := &LexerState{ + options: options, + Lexer: r, + Text: []rune(text), + Stack: []string{options.State}, + Rules: r.rules, + MutatorContext: map[interface{}]interface{}{}, + } + return state.Iterator, nil +} + +func matchRules(text []rune, pos int, rules []*CompiledRule) (int, *CompiledRule, []string) { + for i, rule := range rules { + match, err := rule.Regexp.FindRunesMatchStartingAt(text, pos) + if match != nil && err == nil && match.Index == pos { + groups := []string{} + for _, g := range match.Groups() { + groups = append(groups, g.String()) + } + return i, rule, groups + } + } + return 0, &CompiledRule{}, nil +} diff --git a/vendor/github.com/alecthomas/chroma/remap.go b/vendor/github.com/alecthomas/chroma/remap.go new file mode 100644 index 000000000..cfb5c3814 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/remap.go @@ -0,0 +1,80 @@ +package chroma + +type remappingLexer struct { + lexer Lexer + mapper func(Token) []Token +} + +// RemappingLexer remaps a token to a set of, potentially empty, tokens. +func RemappingLexer(lexer Lexer, mapper func(Token) []Token) Lexer { + return &remappingLexer{lexer, mapper} +} + +func (r *remappingLexer) Config() *Config { + return r.lexer.Config() +} + +func (r *remappingLexer) Tokenise(options *TokeniseOptions, text string) (Iterator, error) { + it, err := r.lexer.Tokenise(options, text) + if err != nil { + return nil, err + } + var buffer []Token + return func() Token { + for { + if len(buffer) > 0 { + t := buffer[0] + buffer = buffer[1:] + return t + } + t := it() + if t == EOF { + return t + } + buffer = r.mapper(t) + } + }, nil +} + +// TypeMapping defines type maps for the TypeRemappingLexer. +type TypeMapping []struct { + From, To TokenType + Words []string +} + +// TypeRemappingLexer remaps types of tokens coming from a parent Lexer. +// +// eg. Map "defvaralias" tokens of type NameVariable to NameFunction: +// +// mapping := TypeMapping{ +// {NameVariable, NameFunction, []string{"defvaralias"}, +// } +// lexer = TypeRemappingLexer(lexer, mapping) +func TypeRemappingLexer(lexer Lexer, mapping TypeMapping) Lexer { + // Lookup table for fast remapping. + lut := map[TokenType]map[string]TokenType{} + for _, rt := range mapping { + km, ok := lut[rt.From] + if !ok { + km = map[string]TokenType{} + lut[rt.From] = km + } + if len(rt.Words) == 0 { + km[""] = rt.To + } else { + for _, k := range rt.Words { + km[k] = rt.To + } + } + } + return RemappingLexer(lexer, func(t Token) []Token { + if k, ok := lut[t.Type]; ok { + if tt, ok := k[t.Value]; ok { + t.Type = tt + } else if tt, ok := k[""]; ok { + t.Type = tt + } + } + return []Token{t} + }) +} diff --git a/vendor/github.com/alecthomas/chroma/style.go b/vendor/github.com/alecthomas/chroma/style.go new file mode 100644 index 000000000..dce9e0a7b --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/style.go @@ -0,0 +1,342 @@ +package chroma + +import ( + "fmt" + "strings" +) + +// Trilean value for StyleEntry value inheritance. +type Trilean uint8 + +// Trilean states. +const ( + Pass Trilean = iota + Yes + No +) + +func (t Trilean) String() string { + switch t { + case Yes: + return "Yes" + case No: + return "No" + default: + return "Pass" + } +} + +// Prefix returns s with "no" as a prefix if Trilean is no. +func (t Trilean) Prefix(s string) string { + if t == Yes { + return s + } else if t == No { + return "no" + s + } + return "" +} + +// A StyleEntry in the Style map. +type StyleEntry struct { + // Hex colours. + Colour Colour + Background Colour + Border Colour + + Bold Trilean + Italic Trilean + Underline Trilean + NoInherit bool +} + +func (s StyleEntry) String() string { + out := []string{} + if s.Bold != Pass { + out = append(out, s.Bold.Prefix("bold")) + } + if s.Italic != Pass { + out = append(out, s.Italic.Prefix("italic")) + } + if s.Underline != Pass { + out = append(out, s.Underline.Prefix("underline")) + } + if s.NoInherit { + out = append(out, "noinherit") + } + if s.Colour.IsSet() { + out = append(out, s.Colour.String()) + } + if s.Background.IsSet() { + out = append(out, "bg:"+s.Background.String()) + } + if s.Border.IsSet() { + out = append(out, "border:"+s.Border.String()) + } + return strings.Join(out, " ") +} + +// Sub subtracts e from s where elements match. +func (s StyleEntry) Sub(e StyleEntry) StyleEntry { + out := StyleEntry{} + if e.Colour != s.Colour { + out.Colour = s.Colour + } + if e.Background != s.Background { + out.Background = s.Background + } + if e.Bold != s.Bold { + out.Bold = s.Bold + } + if e.Italic != s.Italic { + out.Italic = s.Italic + } + if e.Underline != s.Underline { + out.Underline = s.Underline + } + if e.Border != s.Border { + out.Border = s.Border + } + return out +} + +// Inherit styles from ancestors. +// +// Ancestors should be provided from oldest to newest. +func (s StyleEntry) Inherit(ancestors ...StyleEntry) StyleEntry { + out := s + for i := len(ancestors) - 1; i >= 0; i-- { + if out.NoInherit { + return out + } + ancestor := ancestors[i] + if !out.Colour.IsSet() { + out.Colour = ancestor.Colour + } + if !out.Background.IsSet() { + out.Background = ancestor.Background + } + if !out.Border.IsSet() { + out.Border = ancestor.Border + } + if out.Bold == Pass { + out.Bold = ancestor.Bold + } + if out.Italic == Pass { + out.Italic = ancestor.Italic + } + if out.Underline == Pass { + out.Underline = ancestor.Underline + } + } + return out +} + +func (s StyleEntry) IsZero() bool { + return s.Colour == 0 && s.Background == 0 && s.Border == 0 && s.Bold == Pass && s.Italic == Pass && + s.Underline == Pass && !s.NoInherit +} + +// A StyleBuilder is a mutable structure for building styles. +// +// Once built, a Style is immutable. +type StyleBuilder struct { + entries map[TokenType]string + name string + parent *Style +} + +func NewStyleBuilder(name string) *StyleBuilder { + return &StyleBuilder{name: name, entries: map[TokenType]string{}} +} + +func (s *StyleBuilder) AddAll(entries StyleEntries) *StyleBuilder { + for ttype, entry := range entries { + s.entries[ttype] = entry + } + return s +} + +func (s *StyleBuilder) Get(ttype TokenType) StyleEntry { + // This is less than ideal, but it's the price for having to check errors on each Add(). + entry, _ := ParseStyleEntry(s.entries[ttype]) + return entry.Inherit(s.parent.Get(ttype)) +} + +// Add an entry to the Style map. +// +// See http://pygments.org/docs/styles/#style-rules for details. +func (s *StyleBuilder) Add(ttype TokenType, entry string) *StyleBuilder { // nolint: gocyclo + s.entries[ttype] = entry + return s +} + +func (s *StyleBuilder) AddEntry(ttype TokenType, entry StyleEntry) *StyleBuilder { + s.entries[ttype] = entry.String() + return s +} + +func (s *StyleBuilder) Build() (*Style, error) { + style := &Style{ + Name: s.name, + entries: map[TokenType]StyleEntry{}, + parent: s.parent, + } + for ttype, descriptor := range s.entries { + entry, err := ParseStyleEntry(descriptor) + if err != nil { + return nil, fmt.Errorf("invalid entry for %s: %s", ttype, err) + } + style.entries[ttype] = entry + } + return style, nil +} + +// StyleEntries mapping TokenType to colour definition. +type StyleEntries map[TokenType]string + +// NewStyle creates a new style definition. +func NewStyle(name string, entries StyleEntries) (*Style, error) { + return NewStyleBuilder(name).AddAll(entries).Build() +} + +// MustNewStyle creates a new style or panics. +func MustNewStyle(name string, entries StyleEntries) *Style { + style, err := NewStyle(name, entries) + if err != nil { + panic(err) + } + return style +} + +// A Style definition. +// +// See http://pygments.org/docs/styles/ for details. Semantics are intended to be identical. +type Style struct { + Name string + entries map[TokenType]StyleEntry + parent *Style +} + +// Types that are styled. +func (s *Style) Types() []TokenType { + dedupe := map[TokenType]bool{} + for tt := range s.entries { + dedupe[tt] = true + } + if s.parent != nil { + for _, tt := range s.parent.Types() { + dedupe[tt] = true + } + } + out := make([]TokenType, 0, len(dedupe)) + for tt := range dedupe { + out = append(out, tt) + } + return out +} + +// Builder creates a mutable builder from this Style. +// +// The builder can then be safely modified. This is a cheap operation. +func (s *Style) Builder() *StyleBuilder { + return &StyleBuilder{ + name: s.Name, + entries: map[TokenType]string{}, + parent: s, + } +} + +// Has checks if an exact style entry match exists for a token type. +// +// This is distinct from Get() which will merge parent tokens. +func (s *Style) Has(ttype TokenType) bool { + return !s.get(ttype).IsZero() || s.synthesisable(ttype) +} + +// Get a style entry. Will try sub-category or category if an exact match is not found, and +// finally return the Background. +func (s *Style) Get(ttype TokenType) StyleEntry { + return s.get(ttype).Inherit( + s.get(Background), + s.get(Text), + s.get(ttype.Category()), + s.get(ttype.SubCategory())) +} + +func (s *Style) get(ttype TokenType) StyleEntry { + out := s.entries[ttype] + if out.IsZero() && s.synthesisable(ttype) { + out = s.synthesise(ttype) + } + if out.IsZero() && s.parent != nil { + return s.parent.get(ttype) + } + return out +} + +func (s *Style) synthesise(ttype TokenType) StyleEntry { + bg := s.get(Background) + text := StyleEntry{Colour: bg.Colour} + text.Colour = text.Colour.BrightenOrDarken(0.5) + + switch ttype { + // If we don't have a line highlight colour, make one that is 10% brighter/darker than the background. + case LineHighlight: + return StyleEntry{Background: bg.Background.BrightenOrDarken(0.1)} + + // If we don't have line numbers, use the text colour but 20% brighter/darker + case LineNumbers, LineNumbersTable: + return text + } + return StyleEntry{} +} + +func (s *Style) synthesisable(ttype TokenType) bool { + return ttype == LineHighlight || ttype == LineNumbers || ttype == LineNumbersTable +} + +// ParseStyleEntry parses a Pygments style entry. +func ParseStyleEntry(entry string) (StyleEntry, error) { // nolint: gocyclo + out := StyleEntry{} + parts := strings.Fields(entry) + for _, part := range parts { + switch { + case part == "italic": + out.Italic = Yes + case part == "noitalic": + out.Italic = No + case part == "bold": + out.Bold = Yes + case part == "nobold": + out.Bold = No + case part == "underline": + out.Underline = Yes + case part == "nounderline": + out.Underline = No + case part == "inherit": + out.NoInherit = false + case part == "noinherit": + out.NoInherit = true + case part == "bg:": + out.Background = 0 + case strings.HasPrefix(part, "bg:#"): + out.Background = ParseColour(part[3:]) + if !out.Background.IsSet() { + return StyleEntry{}, fmt.Errorf("invalid background colour %q", part) + } + case strings.HasPrefix(part, "border:#"): + out.Border = ParseColour(part[7:]) + if !out.Border.IsSet() { + return StyleEntry{}, fmt.Errorf("invalid border colour %q", part) + } + case strings.HasPrefix(part, "#"): + out.Colour = ParseColour(part) + if !out.Colour.IsSet() { + return StyleEntry{}, fmt.Errorf("invalid colour %q", part) + } + default: + return StyleEntry{}, fmt.Errorf("unknown style element %q", part) + } + } + return out, nil +} diff --git a/vendor/github.com/alecthomas/chroma/styles/abap.go b/vendor/github.com/alecthomas/chroma/styles/abap.go new file mode 100644 index 000000000..b6d07fb27 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/abap.go @@ -0,0 +1,18 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Abap style. +var Abap = Register(chroma.MustNewStyle("abap", chroma.StyleEntries{ + chroma.Comment: "italic #888", + chroma.CommentSpecial: "#888", + chroma.Keyword: "#00f", + chroma.OperatorWord: "#00f", + chroma.Name: "#000", + chroma.LiteralNumber: "#3af", + chroma.LiteralString: "#5a2", + chroma.Error: "#F00", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/algol.go b/vendor/github.com/alecthomas/chroma/styles/algol.go new file mode 100644 index 000000000..1e8a7b442 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/algol.go @@ -0,0 +1,25 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Algol style. +var Algol = Register(chroma.MustNewStyle("algol", chroma.StyleEntries{ + chroma.Comment: "italic #888", + chroma.CommentPreproc: "bold noitalic #888", + chroma.CommentSpecial: "bold noitalic #888", + chroma.Keyword: "underline bold", + chroma.KeywordDeclaration: "italic", + chroma.NameBuiltin: "bold italic", + chroma.NameBuiltinPseudo: "bold italic", + chroma.NameNamespace: "bold italic #666", + chroma.NameClass: "bold italic #666", + chroma.NameFunction: "bold italic #666", + chroma.NameVariable: "bold italic #666", + chroma.NameConstant: "bold italic #666", + chroma.OperatorWord: "bold", + chroma.LiteralString: "italic #666", + chroma.Error: "border:#FF0000", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/algol_nu.go b/vendor/github.com/alecthomas/chroma/styles/algol_nu.go new file mode 100644 index 000000000..f8c6f177e --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/algol_nu.go @@ -0,0 +1,25 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// AlgolNu style. +var AlgolNu = Register(chroma.MustNewStyle("algol_nu", chroma.StyleEntries{ + chroma.Comment: "italic #888", + chroma.CommentPreproc: "bold noitalic #888", + chroma.CommentSpecial: "bold noitalic #888", + chroma.Keyword: "bold", + chroma.KeywordDeclaration: "italic", + chroma.NameBuiltin: "bold italic", + chroma.NameBuiltinPseudo: "bold italic", + chroma.NameNamespace: "bold italic #666", + chroma.NameClass: "bold italic #666", + chroma.NameFunction: "bold italic #666", + chroma.NameVariable: "bold italic #666", + chroma.NameConstant: "bold italic #666", + chroma.OperatorWord: "bold", + chroma.LiteralString: "italic #666", + chroma.Error: "border:#FF0000", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/api.go b/vendor/github.com/alecthomas/chroma/styles/api.go new file mode 100644 index 000000000..f3ce67398 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/api.go @@ -0,0 +1,37 @@ +package styles + +import ( + "sort" + + "github.com/alecthomas/chroma" +) + +// Registry of Styles. +var Registry = map[string]*chroma.Style{} + +// Fallback style. Reassign to change the default fallback style. +var Fallback = SwapOff + +// Register a chroma.Style. +func Register(style *chroma.Style) *chroma.Style { + Registry[style.Name] = style + return style +} + +// Names of all available styles. +func Names() []string { + out := []string{} + for name := range Registry { + out = append(out, name) + } + sort.Strings(out) + return out +} + +// Get named style, or Fallback. +func Get(name string) *chroma.Style { + if style, ok := Registry[name]; ok { + return style + } + return Fallback +} diff --git a/vendor/github.com/alecthomas/chroma/styles/arduino.go b/vendor/github.com/alecthomas/chroma/styles/arduino.go new file mode 100644 index 000000000..9e48fb4ae --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/arduino.go @@ -0,0 +1,25 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Arduino style. +var Arduino = Register(chroma.MustNewStyle("arduino", chroma.StyleEntries{ + chroma.Error: "#a61717", + chroma.Comment: "#95a5a6", + chroma.CommentPreproc: "#728E00", + chroma.Keyword: "#728E00", + chroma.KeywordConstant: "#00979D", + chroma.KeywordPseudo: "#00979D", + chroma.KeywordReserved: "#00979D", + chroma.KeywordType: "#00979D", + chroma.Operator: "#728E00", + chroma.Name: "#434f54", + chroma.NameBuiltin: "#728E00", + chroma.NameFunction: "#D35400", + chroma.NameOther: "#728E00", + chroma.LiteralNumber: "#8A7B52", + chroma.LiteralString: "#7F8C8D", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/autumn.go b/vendor/github.com/alecthomas/chroma/styles/autumn.go new file mode 100644 index 000000000..3966372b9 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/autumn.go @@ -0,0 +1,43 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Autumn style. +var Autumn = Register(chroma.MustNewStyle("autumn", chroma.StyleEntries{ + chroma.TextWhitespace: "#bbbbbb", + chroma.Comment: "italic #aaaaaa", + chroma.CommentPreproc: "noitalic #4c8317", + chroma.CommentSpecial: "italic #0000aa", + chroma.Keyword: "#0000aa", + chroma.KeywordType: "#00aaaa", + chroma.OperatorWord: "#0000aa", + chroma.NameBuiltin: "#00aaaa", + chroma.NameFunction: "#00aa00", + chroma.NameClass: "underline #00aa00", + chroma.NameNamespace: "underline #00aaaa", + chroma.NameVariable: "#aa0000", + chroma.NameConstant: "#aa0000", + chroma.NameEntity: "bold #800", + chroma.NameAttribute: "#1e90ff", + chroma.NameTag: "bold #1e90ff", + chroma.NameDecorator: "#888888", + chroma.LiteralString: "#aa5500", + chroma.LiteralStringSymbol: "#0000aa", + chroma.LiteralStringRegex: "#009999", + chroma.LiteralNumber: "#009999", + chroma.GenericHeading: "bold #000080", + chroma.GenericSubheading: "bold #800080", + chroma.GenericDeleted: "#aa0000", + chroma.GenericInserted: "#00aa00", + chroma.GenericError: "#aa0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "#555555", + chroma.GenericOutput: "#888888", + chroma.GenericTraceback: "#aa0000", + chroma.GenericUnderline: "underline", + chroma.Error: "#F00 bg:#FAA", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/borland.go b/vendor/github.com/alecthomas/chroma/styles/borland.go new file mode 100644 index 000000000..9c0fff6fc --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/borland.go @@ -0,0 +1,33 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Borland style. +var Borland = Register(chroma.MustNewStyle("borland", chroma.StyleEntries{ + chroma.TextWhitespace: "#bbbbbb", + chroma.Comment: "italic #008800", + chroma.CommentPreproc: "noitalic #008080", + chroma.CommentSpecial: "noitalic bold", + chroma.LiteralString: "#0000FF", + chroma.LiteralStringChar: "#800080", + chroma.LiteralNumber: "#0000FF", + chroma.Keyword: "bold #000080", + chroma.OperatorWord: "bold", + chroma.NameTag: "bold #000080", + chroma.NameAttribute: "#FF0000", + chroma.GenericHeading: "#999999", + chroma.GenericSubheading: "#aaaaaa", + chroma.GenericDeleted: "bg:#ffdddd #000000", + chroma.GenericInserted: "bg:#ddffdd #000000", + chroma.GenericError: "#aa0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "#555555", + chroma.GenericOutput: "#888888", + chroma.GenericTraceback: "#aa0000", + chroma.GenericUnderline: "underline", + chroma.Error: "bg:#e3d2d2 #a61717", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/bw.go b/vendor/github.com/alecthomas/chroma/styles/bw.go new file mode 100644 index 000000000..3e800d5a7 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/bw.go @@ -0,0 +1,30 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// BlackWhite style. +var BlackWhite = Register(chroma.MustNewStyle("bw", chroma.StyleEntries{ + chroma.Comment: "italic", + chroma.CommentPreproc: "noitalic", + chroma.Keyword: "bold", + chroma.KeywordPseudo: "nobold", + chroma.KeywordType: "nobold", + chroma.OperatorWord: "bold", + chroma.NameClass: "bold", + chroma.NameNamespace: "bold", + chroma.NameException: "bold", + chroma.NameEntity: "bold", + chroma.NameTag: "bold", + chroma.LiteralString: "italic", + chroma.LiteralStringInterpol: "bold", + chroma.LiteralStringEscape: "bold", + chroma.GenericHeading: "bold", + chroma.GenericSubheading: "bold", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "bold", + chroma.Error: "border:#FF0000", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/colorful.go b/vendor/github.com/alecthomas/chroma/styles/colorful.go new file mode 100644 index 000000000..dc77c5bfe --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/colorful.go @@ -0,0 +1,59 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Colorful style. +var Colorful = Register(chroma.MustNewStyle("colorful", chroma.StyleEntries{ + chroma.TextWhitespace: "#bbbbbb", + chroma.Comment: "#888", + chroma.CommentPreproc: "#579", + chroma.CommentSpecial: "bold #cc0000", + chroma.Keyword: "bold #080", + chroma.KeywordPseudo: "#038", + chroma.KeywordType: "#339", + chroma.Operator: "#333", + chroma.OperatorWord: "bold #000", + chroma.NameBuiltin: "#007020", + chroma.NameFunction: "bold #06B", + chroma.NameClass: "bold #B06", + chroma.NameNamespace: "bold #0e84b5", + chroma.NameException: "bold #F00", + chroma.NameVariable: "#963", + chroma.NameVariableInstance: "#33B", + chroma.NameVariableClass: "#369", + chroma.NameVariableGlobal: "bold #d70", + chroma.NameConstant: "bold #036", + chroma.NameLabel: "bold #970", + chroma.NameEntity: "bold #800", + chroma.NameAttribute: "#00C", + chroma.NameTag: "#070", + chroma.NameDecorator: "bold #555", + chroma.LiteralString: "bg:#fff0f0", + chroma.LiteralStringChar: "#04D bg:", + chroma.LiteralStringDoc: "#D42 bg:", + chroma.LiteralStringInterpol: "bg:#eee", + chroma.LiteralStringEscape: "bold #666", + chroma.LiteralStringRegex: "bg:#fff0ff #000", + chroma.LiteralStringSymbol: "#A60 bg:", + chroma.LiteralStringOther: "#D20", + chroma.LiteralNumber: "bold #60E", + chroma.LiteralNumberInteger: "bold #00D", + chroma.LiteralNumberFloat: "bold #60E", + chroma.LiteralNumberHex: "bold #058", + chroma.LiteralNumberOct: "bold #40E", + chroma.GenericHeading: "bold #000080", + chroma.GenericSubheading: "bold #800080", + chroma.GenericDeleted: "#A00000", + chroma.GenericInserted: "#00A000", + chroma.GenericError: "#FF0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "bold #c65d09", + chroma.GenericOutput: "#888", + chroma.GenericTraceback: "#04D", + chroma.GenericUnderline: "underline", + chroma.Error: "#F00 bg:#FAA", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/dracula.go b/vendor/github.com/alecthomas/chroma/styles/dracula.go new file mode 100644 index 000000000..46e9d5b5b --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/dracula.go @@ -0,0 +1,81 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Dracula Style +var Dracula = Register(chroma.MustNewStyle("dracula", chroma.StyleEntries{ + chroma.Comment: "#6272a4", + chroma.CommentHashbang: "#6272a4", + chroma.CommentMultiline: "#6272a4", + chroma.CommentPreproc: "#ff79c6", + chroma.CommentSingle: "#6272a4", + chroma.CommentSpecial: "#6272a4", + chroma.Generic: "#f8f8f2", + chroma.GenericDeleted: "#8b080b", + chroma.GenericEmph: "#f8f8f2 underline", + chroma.GenericError: "#f8f8f2", + chroma.GenericHeading: "#f8f8f2 bold", + chroma.GenericInserted: "#f8f8f2 bold", + chroma.GenericOutput: "#44475a", + chroma.GenericPrompt: "#f8f8f2", + chroma.GenericStrong: "#f8f8f2", + chroma.GenericSubheading: "#f8f8f2 bold", + chroma.GenericTraceback: "#f8f8f2", + chroma.GenericUnderline: "underline", + chroma.Error: "#f8f8f2", + chroma.Keyword: "#ff79c6", + chroma.KeywordConstant: "#ff79c6", + chroma.KeywordDeclaration: "#8be9fd italic", + chroma.KeywordNamespace: "#ff79c6", + chroma.KeywordPseudo: "#ff79c6", + chroma.KeywordReserved: "#ff79c6", + chroma.KeywordType: "#8be9fd", + chroma.Literal: "#f8f8f2", + chroma.LiteralDate: "#f8f8f2", + chroma.Name: "#f8f8f2", + chroma.NameAttribute: "#50fa7b", + chroma.NameBuiltin: "#8be9fd italic", + chroma.NameBuiltinPseudo: "#f8f8f2", + chroma.NameClass: "#50fa7b", + chroma.NameConstant: "#f8f8f2", + chroma.NameDecorator: "#f8f8f2", + chroma.NameEntity: "#f8f8f2", + chroma.NameException: "#f8f8f2", + chroma.NameFunction: "#50fa7b", + chroma.NameLabel: "#8be9fd italic", + chroma.NameNamespace: "#f8f8f2", + chroma.NameOther: "#f8f8f2", + chroma.NameTag: "#ff79c6", + chroma.NameVariable: "#8be9fd italic", + chroma.NameVariableClass: "#8be9fd italic", + chroma.NameVariableGlobal: "#8be9fd italic", + chroma.NameVariableInstance: "#8be9fd italic", + chroma.LiteralNumber: "#bd93f9", + chroma.LiteralNumberBin: "#bd93f9", + chroma.LiteralNumberFloat: "#bd93f9", + chroma.LiteralNumberHex: "#bd93f9", + chroma.LiteralNumberInteger: "#bd93f9", + chroma.LiteralNumberIntegerLong: "#bd93f9", + chroma.LiteralNumberOct: "#bd93f9", + chroma.Operator: "#ff79c6", + chroma.OperatorWord: "#ff79c6", + chroma.Other: "#f8f8f2", + chroma.Punctuation: "#f8f8f2", + chroma.LiteralString: "#f1fa8c", + chroma.LiteralStringBacktick: "#f1fa8c", + chroma.LiteralStringChar: "#f1fa8c", + chroma.LiteralStringDoc: "#f1fa8c", + chroma.LiteralStringDouble: "#f1fa8c", + chroma.LiteralStringEscape: "#f1fa8c", + chroma.LiteralStringHeredoc: "#f1fa8c", + chroma.LiteralStringInterpol: "#f1fa8c", + chroma.LiteralStringOther: "#f1fa8c", + chroma.LiteralStringRegex: "#f1fa8c", + chroma.LiteralStringSingle: "#f1fa8c", + chroma.LiteralStringSymbol: "#f1fa8c", + chroma.Text: "#f8f8f2", + chroma.TextWhitespace: "#f8f8f2", + chroma.Background: " bg:#282a36", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/emacs.go b/vendor/github.com/alecthomas/chroma/styles/emacs.go new file mode 100644 index 000000000..4835abd71 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/emacs.go @@ -0,0 +1,51 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Emacs style. +var Emacs = Register(chroma.MustNewStyle("emacs", chroma.StyleEntries{ + chroma.TextWhitespace: "#bbbbbb", + chroma.Comment: "italic #008800", + chroma.CommentPreproc: "noitalic", + chroma.CommentSpecial: "noitalic bold", + chroma.Keyword: "bold #AA22FF", + chroma.KeywordPseudo: "nobold", + chroma.KeywordType: "bold #00BB00", + chroma.Operator: "#666666", + chroma.OperatorWord: "bold #AA22FF", + chroma.NameBuiltin: "#AA22FF", + chroma.NameFunction: "#00A000", + chroma.NameClass: "#0000FF", + chroma.NameNamespace: "bold #0000FF", + chroma.NameException: "bold #D2413A", + chroma.NameVariable: "#B8860B", + chroma.NameConstant: "#880000", + chroma.NameLabel: "#A0A000", + chroma.NameEntity: "bold #999999", + chroma.NameAttribute: "#BB4444", + chroma.NameTag: "bold #008000", + chroma.NameDecorator: "#AA22FF", + chroma.LiteralString: "#BB4444", + chroma.LiteralStringDoc: "italic", + chroma.LiteralStringInterpol: "bold #BB6688", + chroma.LiteralStringEscape: "bold #BB6622", + chroma.LiteralStringRegex: "#BB6688", + chroma.LiteralStringSymbol: "#B8860B", + chroma.LiteralStringOther: "#008000", + chroma.LiteralNumber: "#666666", + chroma.GenericHeading: "bold #000080", + chroma.GenericSubheading: "bold #800080", + chroma.GenericDeleted: "#A00000", + chroma.GenericInserted: "#00A000", + chroma.GenericError: "#FF0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "bold #000080", + chroma.GenericOutput: "#888", + chroma.GenericTraceback: "#04D", + chroma.GenericUnderline: "underline", + chroma.Error: "border:#FF0000", + chroma.Background: " bg:#f8f8f8", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/friendly.go b/vendor/github.com/alecthomas/chroma/styles/friendly.go new file mode 100644 index 000000000..ad02341d3 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/friendly.go @@ -0,0 +1,51 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Friendly style. +var Friendly = Register(chroma.MustNewStyle("friendly", chroma.StyleEntries{ + chroma.TextWhitespace: "#bbbbbb", + chroma.Comment: "italic #60a0b0", + chroma.CommentPreproc: "noitalic #007020", + chroma.CommentSpecial: "noitalic bg:#fff0f0", + chroma.Keyword: "bold #007020", + chroma.KeywordPseudo: "nobold", + chroma.KeywordType: "nobold #902000", + chroma.Operator: "#666666", + chroma.OperatorWord: "bold #007020", + chroma.NameBuiltin: "#007020", + chroma.NameFunction: "#06287e", + chroma.NameClass: "bold #0e84b5", + chroma.NameNamespace: "bold #0e84b5", + chroma.NameException: "#007020", + chroma.NameVariable: "#bb60d5", + chroma.NameConstant: "#60add5", + chroma.NameLabel: "bold #002070", + chroma.NameEntity: "bold #d55537", + chroma.NameAttribute: "#4070a0", + chroma.NameTag: "bold #062873", + chroma.NameDecorator: "bold #555555", + chroma.LiteralString: "#4070a0", + chroma.LiteralStringDoc: "italic", + chroma.LiteralStringInterpol: "italic #70a0d0", + chroma.LiteralStringEscape: "bold #4070a0", + chroma.LiteralStringRegex: "#235388", + chroma.LiteralStringSymbol: "#517918", + chroma.LiteralStringOther: "#c65d09", + chroma.LiteralNumber: "#40a070", + chroma.GenericHeading: "bold #000080", + chroma.GenericSubheading: "bold #800080", + chroma.GenericDeleted: "#A00000", + chroma.GenericInserted: "#00A000", + chroma.GenericError: "#FF0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "bold #c65d09", + chroma.GenericOutput: "#888", + chroma.GenericTraceback: "#04D", + chroma.GenericUnderline: "underline", + chroma.Error: "border:#FF0000", + chroma.Background: " bg:#f0f0f0", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/fruity.go b/vendor/github.com/alecthomas/chroma/styles/fruity.go new file mode 100644 index 000000000..c2577fa27 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/fruity.go @@ -0,0 +1,26 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Fruity style. +var Fruity = Register(chroma.MustNewStyle("fruity", chroma.StyleEntries{ + chroma.TextWhitespace: "#888888", + chroma.Background: "#ffffff bg:#111111", + chroma.GenericOutput: "#444444 bg:#222222", + chroma.Keyword: "#fb660a bold", + chroma.KeywordPseudo: "nobold", + chroma.LiteralNumber: "#0086f7 bold", + chroma.NameTag: "#fb660a bold", + chroma.NameVariable: "#fb660a", + chroma.Comment: "#008800 bg:#0f140f italic", + chroma.NameAttribute: "#ff0086 bold", + chroma.LiteralString: "#0086d2", + chroma.NameFunction: "#ff0086 bold", + chroma.GenericHeading: "#ffffff bold", + chroma.KeywordType: "#cdcaa9 bold", + chroma.GenericSubheading: "#ffffff bold", + chroma.NameConstant: "#0086d2", + chroma.CommentPreproc: "#ff0007 bold", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/github.go b/vendor/github.com/alecthomas/chroma/styles/github.go new file mode 100644 index 000000000..7ef2481ca --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/github.go @@ -0,0 +1,51 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// GitHub style. +var GitHub = Register(chroma.MustNewStyle("github", chroma.StyleEntries{ + chroma.CommentMultiline: "italic #999988", + chroma.CommentPreproc: "bold #999999", + chroma.CommentSingle: "italic #999988", + chroma.CommentSpecial: "bold italic #999999", + chroma.Comment: "italic #999988", + chroma.Error: "bg:#e3d2d2 #a61717", + chroma.GenericDeleted: "bg:#ffdddd #000000", + chroma.GenericEmph: "italic #000000", + chroma.GenericError: "#aa0000", + chroma.GenericHeading: "#999999", + chroma.GenericInserted: "bg:#ddffdd #000000", + chroma.GenericOutput: "#888888", + chroma.GenericPrompt: "#555555", + chroma.GenericStrong: "bold", + chroma.GenericSubheading: "#aaaaaa", + chroma.GenericTraceback: "#aa0000", + chroma.GenericUnderline: "underline", + chroma.KeywordType: "bold #445588", + chroma.Keyword: "bold #000000", + chroma.LiteralNumber: "#009999", + chroma.LiteralStringRegex: "#009926", + chroma.LiteralStringSymbol: "#990073", + chroma.LiteralString: "#d14", + chroma.NameAttribute: "#008080", + chroma.NameBuiltinPseudo: "#999999", + chroma.NameBuiltin: "#0086B3", + chroma.NameClass: "bold #445588", + chroma.NameConstant: "#008080", + chroma.NameDecorator: "bold #3c5d5d", + chroma.NameEntity: "#800080", + chroma.NameException: "bold #990000", + chroma.NameFunction: "bold #990000", + chroma.NameLabel: "bold #990000", + chroma.NameNamespace: "#555555", + chroma.NameTag: "#000080", + chroma.NameVariableClass: "#008080", + chroma.NameVariableGlobal: "#008080", + chroma.NameVariableInstance: "#008080", + chroma.NameVariable: "#008080", + chroma.Operator: "bold #000000", + chroma.TextWhitespace: "#bbbbbb", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/igor.go b/vendor/github.com/alecthomas/chroma/styles/igor.go new file mode 100644 index 000000000..6a6d4cd08 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/igor.go @@ -0,0 +1,16 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Igor style. +var Igor = Register(chroma.MustNewStyle("igor", chroma.StyleEntries{ + chroma.Comment: "italic #FF0000", + chroma.Keyword: "#0000FF", + chroma.NameFunction: "#C34E00", + chroma.NameDecorator: "#CC00A3", + chroma.NameClass: "#007575", + chroma.LiteralString: "#009C00", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/lovelace.go b/vendor/github.com/alecthomas/chroma/styles/lovelace.go new file mode 100644 index 000000000..074cc0896 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/lovelace.go @@ -0,0 +1,60 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Lovelace style. +var Lovelace = Register(chroma.MustNewStyle("lovelace", chroma.StyleEntries{ + chroma.TextWhitespace: "#a89028", + chroma.Comment: "italic #888888", + chroma.CommentHashbang: "#287088", + chroma.CommentMultiline: "#888888", + chroma.CommentPreproc: "noitalic #289870", + chroma.Keyword: "#2838b0", + chroma.KeywordConstant: "italic #444444", + chroma.KeywordDeclaration: "italic", + chroma.KeywordType: "italic", + chroma.Operator: "#666666", + chroma.OperatorWord: "#a848a8", + chroma.Punctuation: "#888888", + chroma.NameAttribute: "#388038", + chroma.NameBuiltin: "#388038", + chroma.NameBuiltinPseudo: "italic", + chroma.NameClass: "#287088", + chroma.NameConstant: "#b85820", + chroma.NameDecorator: "#287088", + chroma.NameEntity: "#709030", + chroma.NameException: "#908828", + chroma.NameFunction: "#785840", + chroma.NameFunctionMagic: "#b85820", + chroma.NameLabel: "#289870", + chroma.NameNamespace: "#289870", + chroma.NameTag: "#2838b0", + chroma.NameVariable: "#b04040", + chroma.NameVariableGlobal: "#908828", + chroma.NameVariableMagic: "#b85820", + chroma.LiteralString: "#b83838", + chroma.LiteralStringAffix: "#444444", + chroma.LiteralStringChar: "#a848a8", + chroma.LiteralStringDelimiter: "#b85820", + chroma.LiteralStringDoc: "italic #b85820", + chroma.LiteralStringEscape: "#709030", + chroma.LiteralStringInterpol: "underline", + chroma.LiteralStringOther: "#a848a8", + chroma.LiteralStringRegex: "#a848a8", + chroma.LiteralNumber: "#444444", + chroma.GenericDeleted: "#c02828", + chroma.GenericEmph: "italic", + chroma.GenericError: "#c02828", + chroma.GenericHeading: "#666666", + chroma.GenericSubheading: "#444444", + chroma.GenericInserted: "#388038", + chroma.GenericOutput: "#666666", + chroma.GenericPrompt: "#444444", + chroma.GenericStrong: "bold", + chroma.GenericTraceback: "#2838b0", + chroma.GenericUnderline: "underline", + chroma.Error: "bg:#a848a8", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/manni.go b/vendor/github.com/alecthomas/chroma/styles/manni.go new file mode 100644 index 000000000..9942e7d09 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/manni.go @@ -0,0 +1,51 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Manni style. +var Manni = Register(chroma.MustNewStyle("manni", chroma.StyleEntries{ + chroma.TextWhitespace: "#bbbbbb", + chroma.Comment: "italic #0099FF", + chroma.CommentPreproc: "noitalic #009999", + chroma.CommentSpecial: "bold", + chroma.Keyword: "bold #006699", + chroma.KeywordPseudo: "nobold", + chroma.KeywordType: "#007788", + chroma.Operator: "#555555", + chroma.OperatorWord: "bold #000000", + chroma.NameBuiltin: "#336666", + chroma.NameFunction: "#CC00FF", + chroma.NameClass: "bold #00AA88", + chroma.NameNamespace: "bold #00CCFF", + chroma.NameException: "bold #CC0000", + chroma.NameVariable: "#003333", + chroma.NameConstant: "#336600", + chroma.NameLabel: "#9999FF", + chroma.NameEntity: "bold #999999", + chroma.NameAttribute: "#330099", + chroma.NameTag: "bold #330099", + chroma.NameDecorator: "#9999FF", + chroma.LiteralString: "#CC3300", + chroma.LiteralStringDoc: "italic", + chroma.LiteralStringInterpol: "#AA0000", + chroma.LiteralStringEscape: "bold #CC3300", + chroma.LiteralStringRegex: "#33AAAA", + chroma.LiteralStringSymbol: "#FFCC33", + chroma.LiteralStringOther: "#CC3300", + chroma.LiteralNumber: "#FF6600", + chroma.GenericHeading: "bold #003300", + chroma.GenericSubheading: "bold #003300", + chroma.GenericDeleted: "border:#CC0000 bg:#FFCCCC", + chroma.GenericInserted: "border:#00CC00 bg:#CCFFCC", + chroma.GenericError: "#FF0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "bold #000099", + chroma.GenericOutput: "#AAAAAA", + chroma.GenericTraceback: "#99CC66", + chroma.GenericUnderline: "underline", + chroma.Error: "bg:#FFAAAA #AA0000", + chroma.Background: " bg:#f0f3f3", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/monokai.go b/vendor/github.com/alecthomas/chroma/styles/monokai.go new file mode 100644 index 000000000..2586795ac --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/monokai.go @@ -0,0 +1,36 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Monokai style. +var Monokai = Register(chroma.MustNewStyle("monokai", chroma.StyleEntries{ + chroma.Text: "#f8f8f2", + chroma.Error: "#960050 bg:#1e0010", + chroma.Comment: "#75715e", + chroma.Keyword: "#66d9ef", + chroma.KeywordNamespace: "#f92672", + chroma.Operator: "#f92672", + chroma.Punctuation: "#f8f8f2", + chroma.Name: "#f8f8f2", + chroma.NameAttribute: "#a6e22e", + chroma.NameClass: "#a6e22e", + chroma.NameConstant: "#66d9ef", + chroma.NameDecorator: "#a6e22e", + chroma.NameException: "#a6e22e", + chroma.NameFunction: "#a6e22e", + chroma.NameOther: "#a6e22e", + chroma.NameTag: "#f92672", + chroma.LiteralNumber: "#ae81ff", + chroma.Literal: "#ae81ff", + chroma.LiteralDate: "#e6db74", + chroma.LiteralString: "#e6db74", + chroma.LiteralStringEscape: "#ae81ff", + chroma.GenericDeleted: "#f92672", + chroma.GenericEmph: "italic", + chroma.GenericInserted: "#a6e22e", + chroma.GenericStrong: "bold", + chroma.GenericSubheading: "#75715e", + chroma.Background: "bg:#272822", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/monokailight.go b/vendor/github.com/alecthomas/chroma/styles/monokailight.go new file mode 100644 index 000000000..61818a680 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/monokailight.go @@ -0,0 +1,33 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// MonokaiLight style. +var MonokaiLight = Register(chroma.MustNewStyle("monokailight", chroma.StyleEntries{ + chroma.Text: "#272822", + chroma.Error: "#960050 bg:#1e0010", + chroma.Comment: "#75715e", + chroma.Keyword: "#00a8c8", + chroma.KeywordNamespace: "#f92672", + chroma.Operator: "#f92672", + chroma.Punctuation: "#111111", + chroma.Name: "#111111", + chroma.NameAttribute: "#75af00", + chroma.NameClass: "#75af00", + chroma.NameConstant: "#00a8c8", + chroma.NameDecorator: "#75af00", + chroma.NameException: "#75af00", + chroma.NameFunction: "#75af00", + chroma.NameOther: "#75af00", + chroma.NameTag: "#f92672", + chroma.LiteralNumber: "#ae81ff", + chroma.Literal: "#ae81ff", + chroma.LiteralDate: "#d88200", + chroma.LiteralString: "#d88200", + chroma.LiteralStringEscape: "#8045FF", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.Background: " bg:#fafafa", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/murphy.go b/vendor/github.com/alecthomas/chroma/styles/murphy.go new file mode 100644 index 000000000..90e83c76a --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/murphy.go @@ -0,0 +1,59 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Murphy style. +var Murphy = Register(chroma.MustNewStyle("murphy", chroma.StyleEntries{ + chroma.TextWhitespace: "#bbbbbb", + chroma.Comment: "#666 italic", + chroma.CommentPreproc: "#579 noitalic", + chroma.CommentSpecial: "#c00 bold", + chroma.Keyword: "bold #289", + chroma.KeywordPseudo: "#08f", + chroma.KeywordType: "#66f", + chroma.Operator: "#333", + chroma.OperatorWord: "bold #000", + chroma.NameBuiltin: "#072", + chroma.NameFunction: "bold #5ed", + chroma.NameClass: "bold #e9e", + chroma.NameNamespace: "bold #0e84b5", + chroma.NameException: "bold #F00", + chroma.NameVariable: "#036", + chroma.NameVariableInstance: "#aaf", + chroma.NameVariableClass: "#ccf", + chroma.NameVariableGlobal: "#f84", + chroma.NameConstant: "bold #5ed", + chroma.NameLabel: "bold #970", + chroma.NameEntity: "#800", + chroma.NameAttribute: "#007", + chroma.NameTag: "#070", + chroma.NameDecorator: "bold #555", + chroma.LiteralString: "bg:#e0e0ff", + chroma.LiteralStringChar: "#88F bg:", + chroma.LiteralStringDoc: "#D42 bg:", + chroma.LiteralStringInterpol: "bg:#eee", + chroma.LiteralStringEscape: "bold #666", + chroma.LiteralStringRegex: "bg:#e0e0ff #000", + chroma.LiteralStringSymbol: "#fc8 bg:", + chroma.LiteralStringOther: "#f88", + chroma.LiteralNumber: "bold #60E", + chroma.LiteralNumberInteger: "bold #66f", + chroma.LiteralNumberFloat: "bold #60E", + chroma.LiteralNumberHex: "bold #058", + chroma.LiteralNumberOct: "bold #40E", + chroma.GenericHeading: "bold #000080", + chroma.GenericSubheading: "bold #800080", + chroma.GenericDeleted: "#A00000", + chroma.GenericInserted: "#00A000", + chroma.GenericError: "#FF0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "bold #c65d09", + chroma.GenericOutput: "#888", + chroma.GenericTraceback: "#04D", + chroma.GenericUnderline: "underline", + chroma.Error: "#F00 bg:#FAA", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/native.go b/vendor/github.com/alecthomas/chroma/styles/native.go new file mode 100644 index 000000000..9fae09aca --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/native.go @@ -0,0 +1,42 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Native style. +var Native = Register(chroma.MustNewStyle("native", chroma.StyleEntries{ + chroma.Background: "#d0d0d0 bg:#202020", + chroma.TextWhitespace: "#666666", + chroma.Comment: "italic #999999", + chroma.CommentPreproc: "noitalic bold #cd2828", + chroma.CommentSpecial: "noitalic bold #e50808 bg:#520000", + chroma.Keyword: "bold #6ab825", + chroma.KeywordPseudo: "nobold", + chroma.OperatorWord: "bold #6ab825", + chroma.LiteralString: "#ed9d13", + chroma.LiteralStringOther: "#ffa500", + chroma.LiteralNumber: "#3677a9", + chroma.NameBuiltin: "#24909d", + chroma.NameVariable: "#40ffff", + chroma.NameConstant: "#40ffff", + chroma.NameClass: "underline #447fcf", + chroma.NameFunction: "#447fcf", + chroma.NameNamespace: "underline #447fcf", + chroma.NameException: "#bbbbbb", + chroma.NameTag: "bold #6ab825", + chroma.NameAttribute: "#bbbbbb", + chroma.NameDecorator: "#ffa500", + chroma.GenericHeading: "bold #ffffff", + chroma.GenericSubheading: "underline #ffffff", + chroma.GenericDeleted: "#d22323", + chroma.GenericInserted: "#589819", + chroma.GenericError: "#d22323", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "#aaaaaa", + chroma.GenericOutput: "#cccccc", + chroma.GenericTraceback: "#d22323", + chroma.GenericUnderline: "underline", + chroma.Error: "bg:#e3d2d2 #a61717", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/paraiso-dark.go b/vendor/github.com/alecthomas/chroma/styles/paraiso-dark.go new file mode 100644 index 000000000..c8cf47310 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/paraiso-dark.go @@ -0,0 +1,44 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// ParaisoDark style. +var ParaisoDark = Register(chroma.MustNewStyle("paraiso-dark", chroma.StyleEntries{ + chroma.Text: "#e7e9db", + chroma.Error: "#ef6155", + chroma.Comment: "#776e71", + chroma.Keyword: "#815ba4", + chroma.KeywordNamespace: "#5bc4bf", + chroma.KeywordType: "#fec418", + chroma.Operator: "#5bc4bf", + chroma.Punctuation: "#e7e9db", + chroma.Name: "#e7e9db", + chroma.NameAttribute: "#06b6ef", + chroma.NameClass: "#fec418", + chroma.NameConstant: "#ef6155", + chroma.NameDecorator: "#5bc4bf", + chroma.NameException: "#ef6155", + chroma.NameFunction: "#06b6ef", + chroma.NameNamespace: "#fec418", + chroma.NameOther: "#06b6ef", + chroma.NameTag: "#5bc4bf", + chroma.NameVariable: "#ef6155", + chroma.LiteralNumber: "#f99b15", + chroma.Literal: "#f99b15", + chroma.LiteralDate: "#48b685", + chroma.LiteralString: "#48b685", + chroma.LiteralStringChar: "#e7e9db", + chroma.LiteralStringDoc: "#776e71", + chroma.LiteralStringEscape: "#f99b15", + chroma.LiteralStringInterpol: "#f99b15", + chroma.GenericDeleted: "#ef6155", + chroma.GenericEmph: "italic", + chroma.GenericHeading: "bold #e7e9db", + chroma.GenericInserted: "#48b685", + chroma.GenericPrompt: "bold #776e71", + chroma.GenericStrong: "bold", + chroma.GenericSubheading: "bold #5bc4bf", + chroma.Background: "bg:#2f1e2e", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/paraiso-light.go b/vendor/github.com/alecthomas/chroma/styles/paraiso-light.go new file mode 100644 index 000000000..b514dfa16 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/paraiso-light.go @@ -0,0 +1,44 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// ParaisoLight style. +var ParaisoLight = Register(chroma.MustNewStyle("paraiso-light", chroma.StyleEntries{ + chroma.Text: "#2f1e2e", + chroma.Error: "#ef6155", + chroma.Comment: "#8d8687", + chroma.Keyword: "#815ba4", + chroma.KeywordNamespace: "#5bc4bf", + chroma.KeywordType: "#fec418", + chroma.Operator: "#5bc4bf", + chroma.Punctuation: "#2f1e2e", + chroma.Name: "#2f1e2e", + chroma.NameAttribute: "#06b6ef", + chroma.NameClass: "#fec418", + chroma.NameConstant: "#ef6155", + chroma.NameDecorator: "#5bc4bf", + chroma.NameException: "#ef6155", + chroma.NameFunction: "#06b6ef", + chroma.NameNamespace: "#fec418", + chroma.NameOther: "#06b6ef", + chroma.NameTag: "#5bc4bf", + chroma.NameVariable: "#ef6155", + chroma.LiteralNumber: "#f99b15", + chroma.Literal: "#f99b15", + chroma.LiteralDate: "#48b685", + chroma.LiteralString: "#48b685", + chroma.LiteralStringChar: "#2f1e2e", + chroma.LiteralStringDoc: "#8d8687", + chroma.LiteralStringEscape: "#f99b15", + chroma.LiteralStringInterpol: "#f99b15", + chroma.GenericDeleted: "#ef6155", + chroma.GenericEmph: "italic", + chroma.GenericHeading: "bold #2f1e2e", + chroma.GenericInserted: "#48b685", + chroma.GenericPrompt: "bold #8d8687", + chroma.GenericStrong: "bold", + chroma.GenericSubheading: "bold #5bc4bf", + chroma.Background: "bg:#e7e9db", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/pastie.go b/vendor/github.com/alecthomas/chroma/styles/pastie.go new file mode 100644 index 000000000..9a6854439 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/pastie.go @@ -0,0 +1,52 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Pastie style. +var Pastie = Register(chroma.MustNewStyle("pastie", chroma.StyleEntries{ + chroma.TextWhitespace: "#bbbbbb", + chroma.Comment: "#888888", + chroma.CommentPreproc: "bold #cc0000", + chroma.CommentSpecial: "bg:#fff0f0 bold #cc0000", + chroma.LiteralString: "bg:#fff0f0 #dd2200", + chroma.LiteralStringRegex: "bg:#fff0ff #008800", + chroma.LiteralStringOther: "bg:#f0fff0 #22bb22", + chroma.LiteralStringSymbol: "#aa6600", + chroma.LiteralStringInterpol: "#3333bb", + chroma.LiteralStringEscape: "#0044dd", + chroma.OperatorWord: "#008800", + chroma.Keyword: "bold #008800", + chroma.KeywordPseudo: "nobold", + chroma.KeywordType: "#888888", + chroma.NameClass: "bold #bb0066", + chroma.NameException: "bold #bb0066", + chroma.NameFunction: "bold #0066bb", + chroma.NameProperty: "bold #336699", + chroma.NameNamespace: "bold #bb0066", + chroma.NameBuiltin: "#003388", + chroma.NameVariable: "#336699", + chroma.NameVariableClass: "#336699", + chroma.NameVariableInstance: "#3333bb", + chroma.NameVariableGlobal: "#dd7700", + chroma.NameConstant: "bold #003366", + chroma.NameTag: "bold #bb0066", + chroma.NameAttribute: "#336699", + chroma.NameDecorator: "#555555", + chroma.NameLabel: "italic #336699", + chroma.LiteralNumber: "bold #0000DD", + chroma.GenericHeading: "#333", + chroma.GenericSubheading: "#666", + chroma.GenericDeleted: "bg:#ffdddd #000000", + chroma.GenericInserted: "bg:#ddffdd #000000", + chroma.GenericError: "#aa0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "#555555", + chroma.GenericOutput: "#888888", + chroma.GenericTraceback: "#aa0000", + chroma.GenericUnderline: "underline", + chroma.Error: "bg:#e3d2d2 #a61717", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/perldoc.go b/vendor/github.com/alecthomas/chroma/styles/perldoc.go new file mode 100644 index 000000000..e1372fdfb --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/perldoc.go @@ -0,0 +1,44 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Perldoc style. +var Perldoc = Register(chroma.MustNewStyle("perldoc", chroma.StyleEntries{ + chroma.TextWhitespace: "#bbbbbb", + chroma.Comment: "#228B22", + chroma.CommentPreproc: "#1e889b", + chroma.CommentSpecial: "#8B008B bold", + chroma.LiteralString: "#CD5555", + chroma.LiteralStringHeredoc: "#1c7e71 italic", + chroma.LiteralStringRegex: "#1c7e71", + chroma.LiteralStringOther: "#cb6c20", + chroma.LiteralNumber: "#B452CD", + chroma.OperatorWord: "#8B008B", + chroma.Keyword: "#8B008B bold", + chroma.KeywordType: "#00688B", + chroma.NameClass: "#008b45 bold", + chroma.NameException: "#008b45 bold", + chroma.NameFunction: "#008b45", + chroma.NameNamespace: "#008b45 underline", + chroma.NameVariable: "#00688B", + chroma.NameConstant: "#00688B", + chroma.NameDecorator: "#707a7c", + chroma.NameTag: "#8B008B bold", + chroma.NameAttribute: "#658b00", + chroma.NameBuiltin: "#658b00", + chroma.GenericHeading: "bold #000080", + chroma.GenericSubheading: "bold #800080", + chroma.GenericDeleted: "#aa0000", + chroma.GenericInserted: "#00aa00", + chroma.GenericError: "#aa0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "#555555", + chroma.GenericOutput: "#888888", + chroma.GenericTraceback: "#aa0000", + chroma.GenericUnderline: "underline", + chroma.Error: "bg:#e3d2d2 #a61717", + chroma.Background: " bg:#eeeedd", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/pygments.go b/vendor/github.com/alecthomas/chroma/styles/pygments.go new file mode 100644 index 000000000..327033b71 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/pygments.go @@ -0,0 +1,55 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Pygments default theme. +var Pygments = Register(chroma.MustNewStyle("pygments", chroma.StyleEntries{ + chroma.Whitespace: "#bbbbbb", + chroma.Comment: "italic #408080", + chroma.CommentPreproc: "noitalic #BC7A00", + + chroma.Keyword: "bold #008000", + chroma.KeywordPseudo: "nobold", + chroma.KeywordType: "nobold #B00040", + + chroma.Operator: "#666666", + chroma.OperatorWord: "bold #AA22FF", + + chroma.NameBuiltin: "#008000", + chroma.NameFunction: "#0000FF", + chroma.NameClass: "bold #0000FF", + chroma.NameNamespace: "bold #0000FF", + chroma.NameException: "bold #D2413A", + chroma.NameVariable: "#19177C", + chroma.NameConstant: "#880000", + chroma.NameLabel: "#A0A000", + chroma.NameEntity: "bold #999999", + chroma.NameAttribute: "#7D9029", + chroma.NameTag: "bold #008000", + chroma.NameDecorator: "#AA22FF", + + chroma.String: "#BA2121", + chroma.StringDoc: "italic", + chroma.StringInterpol: "bold #BB6688", + chroma.StringEscape: "bold #BB6622", + chroma.StringRegex: "#BB6688", + chroma.StringSymbol: "#19177C", + chroma.StringOther: "#008000", + chroma.Number: "#666666", + + chroma.GenericHeading: "bold #000080", + chroma.GenericSubheading: "bold #800080", + chroma.GenericDeleted: "#A00000", + chroma.GenericInserted: "#00A000", + chroma.GenericError: "#FF0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "bold #000080", + chroma.GenericOutput: "#888", + chroma.GenericTraceback: "#04D", + chroma.GenericUnderline: "underline", + + chroma.Error: "border:#FF0000", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/rainbow_dash.go b/vendor/github.com/alecthomas/chroma/styles/rainbow_dash.go new file mode 100644 index 000000000..37d66ca25 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/rainbow_dash.go @@ -0,0 +1,47 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// RainbowDash style. +var RainbowDash = Register(chroma.MustNewStyle("rainbow_dash", chroma.StyleEntries{ + chroma.Comment: "italic #0080ff", + chroma.CommentPreproc: "noitalic", + chroma.CommentSpecial: "bold", + chroma.Error: "bg:#cc0000 #ffffff", + chroma.GenericDeleted: "border:#c5060b bg:#ffcccc", + chroma.GenericEmph: "italic", + chroma.GenericError: "#ff0000", + chroma.GenericHeading: "bold #2c5dcd", + chroma.GenericInserted: "border:#00cc00 bg:#ccffcc", + chroma.GenericOutput: "#aaaaaa", + chroma.GenericPrompt: "bold #2c5dcd", + chroma.GenericStrong: "bold", + chroma.GenericSubheading: "bold #2c5dcd", + chroma.GenericTraceback: "#c5060b", + chroma.GenericUnderline: "underline", + chroma.Keyword: "bold #2c5dcd", + chroma.KeywordPseudo: "nobold", + chroma.KeywordType: "#5918bb", + chroma.NameAttribute: "italic #2c5dcd", + chroma.NameBuiltin: "bold #5918bb", + chroma.NameClass: "underline", + chroma.NameConstant: "#318495", + chroma.NameDecorator: "bold #ff8000", + chroma.NameEntity: "bold #5918bb", + chroma.NameException: "bold #5918bb", + chroma.NameFunction: "bold #ff8000", + chroma.NameTag: "bold #2c5dcd", + chroma.LiteralNumber: "bold #5918bb", + chroma.Operator: "#2c5dcd", + chroma.OperatorWord: "bold", + chroma.LiteralString: "#00cc66", + chroma.LiteralStringDoc: "italic", + chroma.LiteralStringEscape: "bold #c5060b", + chroma.LiteralStringOther: "#318495", + chroma.LiteralStringSymbol: "bold #c5060b", + chroma.Text: "#4d4d4d", + chroma.TextWhitespace: "#cbcbcb", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/rrt.go b/vendor/github.com/alecthomas/chroma/styles/rrt.go new file mode 100644 index 000000000..2ccf2cadf --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/rrt.go @@ -0,0 +1,20 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Rrt style. +var Rrt = Register(chroma.MustNewStyle("rrt", chroma.StyleEntries{ + chroma.CommentPreproc: "#e5e5e5", + chroma.Comment: "#00ff00", + chroma.KeywordType: "#ee82ee", + chroma.Keyword: "#ff0000", + chroma.LiteralNumber: "#ff6600", + chroma.LiteralStringSymbol: "#ff6600", + chroma.LiteralString: "#87ceeb", + chroma.NameFunction: "#ffff00", + chroma.NameConstant: "#7fffd4", + chroma.NameVariable: "#eedd82", + chroma.Background: "#f8f8f2 bg:#000000", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/solarized-dark.go b/vendor/github.com/alecthomas/chroma/styles/solarized-dark.go new file mode 100644 index 000000000..2724df24e --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/solarized-dark.go @@ -0,0 +1,46 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// SolarizedDark style. +var SolarizedDark = Register(chroma.MustNewStyle("solarized-dark", chroma.StyleEntries{ + chroma.Keyword: "#719e07", + chroma.KeywordConstant: "#CB4B16", + chroma.KeywordDeclaration: "#268BD2", + chroma.KeywordReserved: "#268BD2", + chroma.KeywordType: "#DC322F", + chroma.NameAttribute: "#93A1A1", + chroma.NameBuiltin: "#B58900", + chroma.NameBuiltinPseudo: "#268BD2", + chroma.NameClass: "#268BD2", + chroma.NameConstant: "#CB4B16", + chroma.NameDecorator: "#268BD2", + chroma.NameEntity: "#CB4B16", + chroma.NameException: "#CB4B16", + chroma.NameFunction: "#268BD2", + chroma.NameTag: "#268BD2", + chroma.NameVariable: "#268BD2", + chroma.LiteralString: "#2AA198", + chroma.LiteralStringBacktick: "#586E75", + chroma.LiteralStringChar: "#2AA198", + chroma.LiteralStringDoc: "#93A1A1", + chroma.LiteralStringEscape: "#CB4B16", + chroma.LiteralStringHeredoc: "#93A1A1", + chroma.LiteralStringRegex: "#DC322F", + chroma.LiteralNumber: "#2AA198", + chroma.Operator: "#719e07", + chroma.Comment: "#586E75", + chroma.CommentPreproc: "#719e07", + chroma.CommentSpecial: "#719e07", + chroma.GenericDeleted: "#DC322F", + chroma.GenericEmph: "italic", + chroma.GenericError: "#DC322F bold", + chroma.GenericHeading: "#CB4B16", + chroma.GenericInserted: "#719e07", + chroma.GenericStrong: "bold", + chroma.GenericSubheading: "#268BD2", + chroma.Background: "#93A1A1 bg:#002B36", + chroma.Other: "#CB4B16", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/solarized-dark256.go b/vendor/github.com/alecthomas/chroma/styles/solarized-dark256.go new file mode 100644 index 000000000..a24ddc153 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/solarized-dark256.go @@ -0,0 +1,48 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// SolarizedDark256 style. +var SolarizedDark256 = Register(chroma.MustNewStyle("solarized-dark256", chroma.StyleEntries{ + chroma.Keyword: "#5f8700", + chroma.KeywordConstant: "#d75f00", + chroma.KeywordDeclaration: "#0087ff", + chroma.KeywordNamespace: "#d75f00", + chroma.KeywordReserved: "#0087ff", + chroma.KeywordType: "#af0000", + chroma.NameAttribute: "#8a8a8a", + chroma.NameBuiltin: "#0087ff", + chroma.NameBuiltinPseudo: "#0087ff", + chroma.NameClass: "#0087ff", + chroma.NameConstant: "#d75f00", + chroma.NameDecorator: "#0087ff", + chroma.NameEntity: "#d75f00", + chroma.NameException: "#af8700", + chroma.NameFunction: "#0087ff", + chroma.NameTag: "#0087ff", + chroma.NameVariable: "#0087ff", + chroma.LiteralString: "#00afaf", + chroma.LiteralStringBacktick: "#4e4e4e", + chroma.LiteralStringChar: "#00afaf", + chroma.LiteralStringDoc: "#00afaf", + chroma.LiteralStringEscape: "#af0000", + chroma.LiteralStringHeredoc: "#00afaf", + chroma.LiteralStringRegex: "#af0000", + chroma.LiteralNumber: "#00afaf", + chroma.Operator: "#8a8a8a", + chroma.OperatorWord: "#5f8700", + chroma.Comment: "#4e4e4e", + chroma.CommentPreproc: "#5f8700", + chroma.CommentSpecial: "#5f8700", + chroma.GenericDeleted: "#af0000", + chroma.GenericEmph: "italic", + chroma.GenericError: "#af0000 bold", + chroma.GenericHeading: "#d75f00", + chroma.GenericInserted: "#5f8700", + chroma.GenericStrong: "bold", + chroma.GenericSubheading: "#0087ff", + chroma.Background: "#8a8a8a bg:#1c1c1c", + chroma.Other: "#d75f00", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/solarized-light.go b/vendor/github.com/alecthomas/chroma/styles/solarized-light.go new file mode 100644 index 000000000..b6d5234a7 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/solarized-light.go @@ -0,0 +1,24 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// SolarizedLight style. +var SolarizedLight = Register(chroma.MustNewStyle("solarized-light", chroma.StyleEntries{ + chroma.Text: "bg: #eee8d5 #586e75", + chroma.Keyword: "#859900", + chroma.KeywordConstant: "bold", + chroma.KeywordNamespace: "#dc322f bold", + chroma.KeywordType: "bold", + chroma.Name: "#268bd2", + chroma.NameBuiltin: "#cb4b16", + chroma.NameClass: "#cb4b16", + chroma.NameTag: "bold", + chroma.Literal: "#2aa198", + chroma.LiteralNumber: "bold", + chroma.OperatorWord: "#859900", + chroma.Comment: "#93a1a1 italic", + chroma.Generic: "#d33682", + chroma.Background: " bg:#eee8d5", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/swapoff.go b/vendor/github.com/alecthomas/chroma/styles/swapoff.go new file mode 100644 index 000000000..e4daae61c --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/swapoff.go @@ -0,0 +1,25 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// SwapOff theme. +var SwapOff = Register(chroma.MustNewStyle("swapoff", chroma.StyleEntries{ + chroma.Background: "#lightgray bg:#black", + chroma.Number: "bold #ansiyellow", + chroma.Comment: "#ansiteal", + chroma.CommentPreproc: "bold #ansigreen", + chroma.String: "bold #ansiturquoise", + chroma.Keyword: "bold #ansiwhite", + chroma.NameKeyword: "bold #ansiwhite", + chroma.NameBuiltin: "bold #ansiwhite", + chroma.GenericHeading: "bold", + chroma.GenericSubheading: "bold", + chroma.GenericStrong: "bold", + chroma.GenericUnderline: "underline", + chroma.NameTag: "bold", + chroma.NameAttribute: "#ansiteal", + chroma.Error: "#ansired", + chroma.LiteralDate: "bold #ansiyellow", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/tango.go b/vendor/github.com/alecthomas/chroma/styles/tango.go new file mode 100644 index 000000000..ae1afe064 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/tango.go @@ -0,0 +1,79 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Tango style. +var Tango = Register(chroma.MustNewStyle("tango", chroma.StyleEntries{ + chroma.TextWhitespace: "underline #f8f8f8", + chroma.Error: "#a40000 border:#ef2929", + chroma.Other: "#000000", + chroma.Comment: "italic #8f5902", + chroma.CommentMultiline: "italic #8f5902", + chroma.CommentPreproc: "italic #8f5902", + chroma.CommentSingle: "italic #8f5902", + chroma.CommentSpecial: "italic #8f5902", + chroma.Keyword: "bold #204a87", + chroma.KeywordConstant: "bold #204a87", + chroma.KeywordDeclaration: "bold #204a87", + chroma.KeywordNamespace: "bold #204a87", + chroma.KeywordPseudo: "bold #204a87", + chroma.KeywordReserved: "bold #204a87", + chroma.KeywordType: "bold #204a87", + chroma.Operator: "bold #ce5c00", + chroma.OperatorWord: "bold #204a87", + chroma.Punctuation: "bold #000000", + chroma.Name: "#000000", + chroma.NameAttribute: "#c4a000", + chroma.NameBuiltin: "#204a87", + chroma.NameBuiltinPseudo: "#3465a4", + chroma.NameClass: "#000000", + chroma.NameConstant: "#000000", + chroma.NameDecorator: "bold #5c35cc", + chroma.NameEntity: "#ce5c00", + chroma.NameException: "bold #cc0000", + chroma.NameFunction: "#000000", + chroma.NameProperty: "#000000", + chroma.NameLabel: "#f57900", + chroma.NameNamespace: "#000000", + chroma.NameOther: "#000000", + chroma.NameTag: "bold #204a87", + chroma.NameVariable: "#000000", + chroma.NameVariableClass: "#000000", + chroma.NameVariableGlobal: "#000000", + chroma.NameVariableInstance: "#000000", + chroma.LiteralNumber: "bold #0000cf", + chroma.LiteralNumberFloat: "bold #0000cf", + chroma.LiteralNumberHex: "bold #0000cf", + chroma.LiteralNumberInteger: "bold #0000cf", + chroma.LiteralNumberIntegerLong: "bold #0000cf", + chroma.LiteralNumberOct: "bold #0000cf", + chroma.Literal: "#000000", + chroma.LiteralDate: "#000000", + chroma.LiteralString: "#4e9a06", + chroma.LiteralStringBacktick: "#4e9a06", + chroma.LiteralStringChar: "#4e9a06", + chroma.LiteralStringDoc: "italic #8f5902", + chroma.LiteralStringDouble: "#4e9a06", + chroma.LiteralStringEscape: "#4e9a06", + chroma.LiteralStringHeredoc: "#4e9a06", + chroma.LiteralStringInterpol: "#4e9a06", + chroma.LiteralStringOther: "#4e9a06", + chroma.LiteralStringRegex: "#4e9a06", + chroma.LiteralStringSingle: "#4e9a06", + chroma.LiteralStringSymbol: "#4e9a06", + chroma.Generic: "#000000", + chroma.GenericDeleted: "#a40000", + chroma.GenericEmph: "italic #000000", + chroma.GenericError: "#ef2929", + chroma.GenericHeading: "bold #000080", + chroma.GenericInserted: "#00A000", + chroma.GenericOutput: "italic #000000", + chroma.GenericPrompt: "#8f5902", + chroma.GenericStrong: "bold #000000", + chroma.GenericSubheading: "bold #800080", + chroma.GenericTraceback: "bold #a40000", + chroma.GenericUnderline: "underline", + chroma.Background: " bg:#f8f8f8", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/trac.go b/vendor/github.com/alecthomas/chroma/styles/trac.go new file mode 100644 index 000000000..3b09c44e8 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/trac.go @@ -0,0 +1,42 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Trac style. +var Trac = Register(chroma.MustNewStyle("trac", chroma.StyleEntries{ + chroma.TextWhitespace: "#bbbbbb", + chroma.Comment: "italic #999988", + chroma.CommentPreproc: "bold noitalic #999999", + chroma.CommentSpecial: "bold #999999", + chroma.Operator: "bold", + chroma.LiteralString: "#bb8844", + chroma.LiteralStringRegex: "#808000", + chroma.LiteralNumber: "#009999", + chroma.Keyword: "bold", + chroma.KeywordType: "#445588", + chroma.NameBuiltin: "#999999", + chroma.NameFunction: "bold #990000", + chroma.NameClass: "bold #445588", + chroma.NameException: "bold #990000", + chroma.NameNamespace: "#555555", + chroma.NameVariable: "#008080", + chroma.NameConstant: "#008080", + chroma.NameTag: "#000080", + chroma.NameAttribute: "#008080", + chroma.NameEntity: "#800080", + chroma.GenericHeading: "#999999", + chroma.GenericSubheading: "#aaaaaa", + chroma.GenericDeleted: "bg:#ffdddd #000000", + chroma.GenericInserted: "bg:#ddffdd #000000", + chroma.GenericError: "#aa0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "#555555", + chroma.GenericOutput: "#888888", + chroma.GenericTraceback: "#aa0000", + chroma.GenericUnderline: "underline", + chroma.Error: "bg:#e3d2d2 #a61717", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/vim.go b/vendor/github.com/alecthomas/chroma/styles/vim.go new file mode 100644 index 000000000..6296042c2 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/vim.go @@ -0,0 +1,36 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Vim style. +var Vim = Register(chroma.MustNewStyle("vim", chroma.StyleEntries{ + chroma.Background: "#cccccc bg:#000000", + chroma.Comment: "#000080", + chroma.CommentSpecial: "bold #cd0000", + chroma.Keyword: "#cdcd00", + chroma.KeywordDeclaration: "#00cd00", + chroma.KeywordNamespace: "#cd00cd", + chroma.KeywordType: "#00cd00", + chroma.Operator: "#3399cc", + chroma.OperatorWord: "#cdcd00", + chroma.NameClass: "#00cdcd", + chroma.NameBuiltin: "#cd00cd", + chroma.NameException: "bold #666699", + chroma.NameVariable: "#00cdcd", + chroma.LiteralString: "#cd0000", + chroma.LiteralNumber: "#cd00cd", + chroma.GenericHeading: "bold #000080", + chroma.GenericSubheading: "bold #800080", + chroma.GenericDeleted: "#cd0000", + chroma.GenericInserted: "#00cd00", + chroma.GenericError: "#FF0000", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "bold #000080", + chroma.GenericOutput: "#888", + chroma.GenericTraceback: "#04D", + chroma.GenericUnderline: "underline", + chroma.Error: "border:#FF0000", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/vs.go b/vendor/github.com/alecthomas/chroma/styles/vs.go new file mode 100644 index 000000000..acbcb9153 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/vs.go @@ -0,0 +1,23 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// VisualStudio style. +var VisualStudio = Register(chroma.MustNewStyle("vs", chroma.StyleEntries{ + chroma.Comment: "#008000", + chroma.CommentPreproc: "#0000ff", + chroma.Keyword: "#0000ff", + chroma.OperatorWord: "#0000ff", + chroma.KeywordType: "#2b91af", + chroma.NameClass: "#2b91af", + chroma.LiteralString: "#a31515", + chroma.GenericHeading: "bold", + chroma.GenericSubheading: "bold", + chroma.GenericEmph: "italic", + chroma.GenericStrong: "bold", + chroma.GenericPrompt: "bold", + chroma.Error: "border:#FF0000", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/styles/xcode.go b/vendor/github.com/alecthomas/chroma/styles/xcode.go new file mode 100644 index 000000000..115cf71cd --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/styles/xcode.go @@ -0,0 +1,29 @@ +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// Xcode style. +var Xcode = Register(chroma.MustNewStyle("xcode", chroma.StyleEntries{ + chroma.Comment: "#177500", + chroma.CommentPreproc: "#633820", + chroma.LiteralString: "#C41A16", + chroma.LiteralStringChar: "#2300CE", + chroma.Operator: "#000000", + chroma.Keyword: "#A90D91", + chroma.Name: "#000000", + chroma.NameAttribute: "#836C28", + chroma.NameClass: "#3F6E75", + chroma.NameFunction: "#000000", + chroma.NameBuiltin: "#A90D91", + chroma.NameBuiltinPseudo: "#5B269A", + chroma.NameVariable: "#000000", + chroma.NameTag: "#000000", + chroma.NameDecorator: "#000000", + chroma.NameLabel: "#000000", + chroma.Literal: "#1C01CE", + chroma.LiteralNumber: "#1C01CE", + chroma.Error: "#000000", + chroma.Background: " bg:#ffffff", +})) diff --git a/vendor/github.com/alecthomas/chroma/table.py b/vendor/github.com/alecthomas/chroma/table.py new file mode 100644 index 000000000..1caa7cc56 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/table.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +from collections import defaultdict +from subprocess import check_output + +lines = check_output(["go", "run", "./cmd/chroma/main.go", "--list"]).decode('utf-8').splitlines() +lines = [line.strip() for line in lines if line.startswith(" ") and not line.startswith(" ")] +lines = sorted(lines, key=lambda l: l.lower()) + +table = defaultdict(list) + +for line in lines: + table[line[0].upper()].append(line) + +for key, value in table.items(): + print("{} | {}".format(key, ', '.join(value))) diff --git a/vendor/github.com/alecthomas/chroma/tokentype_string.go b/vendor/github.com/alecthomas/chroma/tokentype_string.go new file mode 100644 index 000000000..6fe386749 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/tokentype_string.go @@ -0,0 +1,213 @@ +// Code generated by "stringer -type TokenType"; DO NOT EDIT. + +package chroma + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[Background - -1] + _ = x[LineNumbers - -2] + _ = x[LineNumbersTable - -3] + _ = x[LineHighlight - -4] + _ = x[LineTable - -5] + _ = x[LineTableTD - -6] + _ = x[Error - -7] + _ = x[Other - -8] + _ = x[None - -9] + _ = x[EOFType-0] + _ = x[Keyword-1000] + _ = x[KeywordConstant-1001] + _ = x[KeywordDeclaration-1002] + _ = x[KeywordNamespace-1003] + _ = x[KeywordPseudo-1004] + _ = x[KeywordReserved-1005] + _ = x[KeywordType-1006] + _ = x[Name-2000] + _ = x[NameAttribute-2001] + _ = x[NameBuiltin-2002] + _ = x[NameBuiltinPseudo-2003] + _ = x[NameClass-2004] + _ = x[NameConstant-2005] + _ = x[NameDecorator-2006] + _ = x[NameEntity-2007] + _ = x[NameException-2008] + _ = x[NameFunction-2009] + _ = x[NameFunctionMagic-2010] + _ = x[NameKeyword-2011] + _ = x[NameLabel-2012] + _ = x[NameNamespace-2013] + _ = x[NameOperator-2014] + _ = x[NameOther-2015] + _ = x[NamePseudo-2016] + _ = x[NameProperty-2017] + _ = x[NameTag-2018] + _ = x[NameVariable-2019] + _ = x[NameVariableAnonymous-2020] + _ = x[NameVariableClass-2021] + _ = x[NameVariableGlobal-2022] + _ = x[NameVariableInstance-2023] + _ = x[NameVariableMagic-2024] + _ = x[Literal-3000] + _ = x[LiteralDate-3001] + _ = x[LiteralOther-3002] + _ = x[LiteralString-3100] + _ = x[LiteralStringAffix-3101] + _ = x[LiteralStringAtom-3102] + _ = x[LiteralStringBacktick-3103] + _ = x[LiteralStringBoolean-3104] + _ = x[LiteralStringChar-3105] + _ = x[LiteralStringDelimiter-3106] + _ = x[LiteralStringDoc-3107] + _ = x[LiteralStringDouble-3108] + _ = x[LiteralStringEscape-3109] + _ = x[LiteralStringHeredoc-3110] + _ = x[LiteralStringInterpol-3111] + _ = x[LiteralStringName-3112] + _ = x[LiteralStringOther-3113] + _ = x[LiteralStringRegex-3114] + _ = x[LiteralStringSingle-3115] + _ = x[LiteralStringSymbol-3116] + _ = x[LiteralNumber-3200] + _ = x[LiteralNumberBin-3201] + _ = x[LiteralNumberFloat-3202] + _ = x[LiteralNumberHex-3203] + _ = x[LiteralNumberInteger-3204] + _ = x[LiteralNumberIntegerLong-3205] + _ = x[LiteralNumberOct-3206] + _ = x[Operator-4000] + _ = x[OperatorWord-4001] + _ = x[Punctuation-5000] + _ = x[Comment-6000] + _ = x[CommentHashbang-6001] + _ = x[CommentMultiline-6002] + _ = x[CommentSingle-6003] + _ = x[CommentSpecial-6004] + _ = x[CommentPreproc-6100] + _ = x[CommentPreprocFile-6101] + _ = x[Generic-7000] + _ = x[GenericDeleted-7001] + _ = x[GenericEmph-7002] + _ = x[GenericError-7003] + _ = x[GenericHeading-7004] + _ = x[GenericInserted-7005] + _ = x[GenericOutput-7006] + _ = x[GenericPrompt-7007] + _ = x[GenericStrong-7008] + _ = x[GenericSubheading-7009] + _ = x[GenericTraceback-7010] + _ = x[GenericUnderline-7011] + _ = x[Text-8000] + _ = x[TextWhitespace-8001] + _ = x[TextSymbol-8002] + _ = x[TextPunctuation-8003] +} + +const _TokenType_name = "NoneOtherErrorLineTableTDLineTableLineHighlightLineNumbersTableLineNumbersBackgroundEOFTypeKeywordKeywordConstantKeywordDeclarationKeywordNamespaceKeywordPseudoKeywordReservedKeywordTypeNameNameAttributeNameBuiltinNameBuiltinPseudoNameClassNameConstantNameDecoratorNameEntityNameExceptionNameFunctionNameFunctionMagicNameKeywordNameLabelNameNamespaceNameOperatorNameOtherNamePseudoNamePropertyNameTagNameVariableNameVariableAnonymousNameVariableClassNameVariableGlobalNameVariableInstanceNameVariableMagicLiteralLiteralDateLiteralOtherLiteralStringLiteralStringAffixLiteralStringAtomLiteralStringBacktickLiteralStringBooleanLiteralStringCharLiteralStringDelimiterLiteralStringDocLiteralStringDoubleLiteralStringEscapeLiteralStringHeredocLiteralStringInterpolLiteralStringNameLiteralStringOtherLiteralStringRegexLiteralStringSingleLiteralStringSymbolLiteralNumberLiteralNumberBinLiteralNumberFloatLiteralNumberHexLiteralNumberIntegerLiteralNumberIntegerLongLiteralNumberOctOperatorOperatorWordPunctuationCommentCommentHashbangCommentMultilineCommentSingleCommentSpecialCommentPreprocCommentPreprocFileGenericGenericDeletedGenericEmphGenericErrorGenericHeadingGenericInsertedGenericOutputGenericPromptGenericStrongGenericSubheadingGenericTracebackGenericUnderlineTextTextWhitespaceTextSymbolTextPunctuation" + +var _TokenType_map = map[TokenType]string{ + -9: _TokenType_name[0:4], + -8: _TokenType_name[4:9], + -7: _TokenType_name[9:14], + -6: _TokenType_name[14:25], + -5: _TokenType_name[25:34], + -4: _TokenType_name[34:47], + -3: _TokenType_name[47:63], + -2: _TokenType_name[63:74], + -1: _TokenType_name[74:84], + 0: _TokenType_name[84:91], + 1000: _TokenType_name[91:98], + 1001: _TokenType_name[98:113], + 1002: _TokenType_name[113:131], + 1003: _TokenType_name[131:147], + 1004: _TokenType_name[147:160], + 1005: _TokenType_name[160:175], + 1006: _TokenType_name[175:186], + 2000: _TokenType_name[186:190], + 2001: _TokenType_name[190:203], + 2002: _TokenType_name[203:214], + 2003: _TokenType_name[214:231], + 2004: _TokenType_name[231:240], + 2005: _TokenType_name[240:252], + 2006: _TokenType_name[252:265], + 2007: _TokenType_name[265:275], + 2008: _TokenType_name[275:288], + 2009: _TokenType_name[288:300], + 2010: _TokenType_name[300:317], + 2011: _TokenType_name[317:328], + 2012: _TokenType_name[328:337], + 2013: _TokenType_name[337:350], + 2014: _TokenType_name[350:362], + 2015: _TokenType_name[362:371], + 2016: _TokenType_name[371:381], + 2017: _TokenType_name[381:393], + 2018: _TokenType_name[393:400], + 2019: _TokenType_name[400:412], + 2020: _TokenType_name[412:433], + 2021: _TokenType_name[433:450], + 2022: _TokenType_name[450:468], + 2023: _TokenType_name[468:488], + 2024: _TokenType_name[488:505], + 3000: _TokenType_name[505:512], + 3001: _TokenType_name[512:523], + 3002: _TokenType_name[523:535], + 3100: _TokenType_name[535:548], + 3101: _TokenType_name[548:566], + 3102: _TokenType_name[566:583], + 3103: _TokenType_name[583:604], + 3104: _TokenType_name[604:624], + 3105: _TokenType_name[624:641], + 3106: _TokenType_name[641:663], + 3107: _TokenType_name[663:679], + 3108: _TokenType_name[679:698], + 3109: _TokenType_name[698:717], + 3110: _TokenType_name[717:737], + 3111: _TokenType_name[737:758], + 3112: _TokenType_name[758:775], + 3113: _TokenType_name[775:793], + 3114: _TokenType_name[793:811], + 3115: _TokenType_name[811:830], + 3116: _TokenType_name[830:849], + 3200: _TokenType_name[849:862], + 3201: _TokenType_name[862:878], + 3202: _TokenType_name[878:896], + 3203: _TokenType_name[896:912], + 3204: _TokenType_name[912:932], + 3205: _TokenType_name[932:956], + 3206: _TokenType_name[956:972], + 4000: _TokenType_name[972:980], + 4001: _TokenType_name[980:992], + 5000: _TokenType_name[992:1003], + 6000: _TokenType_name[1003:1010], + 6001: _TokenType_name[1010:1025], + 6002: _TokenType_name[1025:1041], + 6003: _TokenType_name[1041:1054], + 6004: _TokenType_name[1054:1068], + 6100: _TokenType_name[1068:1082], + 6101: _TokenType_name[1082:1100], + 7000: _TokenType_name[1100:1107], + 7001: _TokenType_name[1107:1121], + 7002: _TokenType_name[1121:1132], + 7003: _TokenType_name[1132:1144], + 7004: _TokenType_name[1144:1158], + 7005: _TokenType_name[1158:1173], + 7006: _TokenType_name[1173:1186], + 7007: _TokenType_name[1186:1199], + 7008: _TokenType_name[1199:1212], + 7009: _TokenType_name[1212:1229], + 7010: _TokenType_name[1229:1245], + 7011: _TokenType_name[1245:1261], + 8000: _TokenType_name[1261:1265], + 8001: _TokenType_name[1265:1279], + 8002: _TokenType_name[1279:1289], + 8003: _TokenType_name[1289:1304], +} + +func (i TokenType) String() string { + if str, ok := _TokenType_map[i]; ok { + return str + } + return "TokenType(" + strconv.FormatInt(int64(i), 10) + ")" +} diff --git a/vendor/github.com/alecthomas/chroma/types.go b/vendor/github.com/alecthomas/chroma/types.go new file mode 100644 index 000000000..b102f308a --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/types.go @@ -0,0 +1,347 @@ +package chroma + +import ( + "encoding/json" + "fmt" +) + +//go:generate stringer -type TokenType + +// TokenType is the type of token to highlight. +// +// It is also an Emitter, emitting a single token of itself +type TokenType int + +func (t TokenType) MarshalJSON() ([]byte, error) { return json.Marshal(t.String()) } +func (t *TokenType) UnmarshalJSON(data []byte) error { + key := "" + err := json.Unmarshal(data, &key) + if err != nil { + return err + } + for tt, text := range _TokenType_map { + if text == key { + *t = tt + return nil + } + } + return fmt.Errorf("unknown TokenType %q", data) +} + +// Set of TokenTypes. +// +// Categories of types are grouped in ranges of 1000, while sub-categories are in ranges of 100. For +// example, the literal category is in the range 3000-3999. The sub-category for literal strings is +// in the range 3100-3199. + +// Meta token types. +const ( + // Default background style. + Background TokenType = -1 - iota + // Line numbers in output. + LineNumbers + // Line numbers in output when in table. + LineNumbersTable + // Line higlight style. + LineHighlight + // Line numbers table wrapper style. + LineTable + // Line numbers table TD wrapper style. + LineTableTD + // Input that could not be tokenised. + Error + // Other is used by the Delegate lexer to indicate which tokens should be handled by the delegate. + Other + // No highlighting. + None + // Used as an EOF marker / nil token + EOFType TokenType = 0 +) + +// Keywords. +const ( + Keyword TokenType = 1000 + iota + KeywordConstant + KeywordDeclaration + KeywordNamespace + KeywordPseudo + KeywordReserved + KeywordType +) + +// Names. +const ( + Name TokenType = 2000 + iota + NameAttribute + NameBuiltin + NameBuiltinPseudo + NameClass + NameConstant + NameDecorator + NameEntity + NameException + NameFunction + NameFunctionMagic + NameKeyword + NameLabel + NameNamespace + NameOperator + NameOther + NamePseudo + NameProperty + NameTag + NameVariable + NameVariableAnonymous + NameVariableClass + NameVariableGlobal + NameVariableInstance + NameVariableMagic +) + +// Literals. +const ( + Literal TokenType = 3000 + iota + LiteralDate + LiteralOther +) + +// Strings. +const ( + LiteralString TokenType = 3100 + iota + LiteralStringAffix + LiteralStringAtom + LiteralStringBacktick + LiteralStringBoolean + LiteralStringChar + LiteralStringDelimiter + LiteralStringDoc + LiteralStringDouble + LiteralStringEscape + LiteralStringHeredoc + LiteralStringInterpol + LiteralStringName + LiteralStringOther + LiteralStringRegex + LiteralStringSingle + LiteralStringSymbol +) + +// Literals. +const ( + LiteralNumber TokenType = 3200 + iota + LiteralNumberBin + LiteralNumberFloat + LiteralNumberHex + LiteralNumberInteger + LiteralNumberIntegerLong + LiteralNumberOct +) + +// Operators. +const ( + Operator TokenType = 4000 + iota + OperatorWord +) + +// Punctuation. +const ( + Punctuation TokenType = 5000 + iota +) + +// Comments. +const ( + Comment TokenType = 6000 + iota + CommentHashbang + CommentMultiline + CommentSingle + CommentSpecial +) + +// Preprocessor "comments". +const ( + CommentPreproc TokenType = 6100 + iota + CommentPreprocFile +) + +// Generic tokens. +const ( + Generic TokenType = 7000 + iota + GenericDeleted + GenericEmph + GenericError + GenericHeading + GenericInserted + GenericOutput + GenericPrompt + GenericStrong + GenericSubheading + GenericTraceback + GenericUnderline +) + +// Text. +const ( + Text TokenType = 8000 + iota + TextWhitespace + TextSymbol + TextPunctuation +) + +// Aliases. +const ( + Whitespace = TextWhitespace + + Date = LiteralDate + + String = LiteralString + StringAffix = LiteralStringAffix + StringBacktick = LiteralStringBacktick + StringChar = LiteralStringChar + StringDelimiter = LiteralStringDelimiter + StringDoc = LiteralStringDoc + StringDouble = LiteralStringDouble + StringEscape = LiteralStringEscape + StringHeredoc = LiteralStringHeredoc + StringInterpol = LiteralStringInterpol + StringOther = LiteralStringOther + StringRegex = LiteralStringRegex + StringSingle = LiteralStringSingle + StringSymbol = LiteralStringSymbol + + Number = LiteralNumber + NumberBin = LiteralNumberBin + NumberFloat = LiteralNumberFloat + NumberHex = LiteralNumberHex + NumberInteger = LiteralNumberInteger + NumberIntegerLong = LiteralNumberIntegerLong + NumberOct = LiteralNumberOct +) + +var ( + StandardTypes = map[TokenType]string{ + Background: "chroma", + LineNumbers: "ln", + LineNumbersTable: "lnt", + LineHighlight: "hl", + LineTable: "lntable", + LineTableTD: "lntd", + Text: "", + Whitespace: "w", + Error: "err", + Other: "x", + // I have no idea what this is used for... + // Escape: "esc", + + Keyword: "k", + KeywordConstant: "kc", + KeywordDeclaration: "kd", + KeywordNamespace: "kn", + KeywordPseudo: "kp", + KeywordReserved: "kr", + KeywordType: "kt", + + Name: "n", + NameAttribute: "na", + NameBuiltin: "nb", + NameBuiltinPseudo: "bp", + NameClass: "nc", + NameConstant: "no", + NameDecorator: "nd", + NameEntity: "ni", + NameException: "ne", + NameFunction: "nf", + NameFunctionMagic: "fm", + NameProperty: "py", + NameLabel: "nl", + NameNamespace: "nn", + NameOther: "nx", + NameTag: "nt", + NameVariable: "nv", + NameVariableClass: "vc", + NameVariableGlobal: "vg", + NameVariableInstance: "vi", + NameVariableMagic: "vm", + + Literal: "l", + LiteralDate: "ld", + + String: "s", + StringAffix: "sa", + StringBacktick: "sb", + StringChar: "sc", + StringDelimiter: "dl", + StringDoc: "sd", + StringDouble: "s2", + StringEscape: "se", + StringHeredoc: "sh", + StringInterpol: "si", + StringOther: "sx", + StringRegex: "sr", + StringSingle: "s1", + StringSymbol: "ss", + + Number: "m", + NumberBin: "mb", + NumberFloat: "mf", + NumberHex: "mh", + NumberInteger: "mi", + NumberIntegerLong: "il", + NumberOct: "mo", + + Operator: "o", + OperatorWord: "ow", + + Punctuation: "p", + + Comment: "c", + CommentHashbang: "ch", + CommentMultiline: "cm", + CommentPreproc: "cp", + CommentPreprocFile: "cpf", + CommentSingle: "c1", + CommentSpecial: "cs", + + Generic: "g", + GenericDeleted: "gd", + GenericEmph: "ge", + GenericError: "gr", + GenericHeading: "gh", + GenericInserted: "gi", + GenericOutput: "go", + GenericPrompt: "gp", + GenericStrong: "gs", + GenericSubheading: "gu", + GenericTraceback: "gt", + GenericUnderline: "gl", + } +) + +func (t TokenType) Parent() TokenType { + if t%100 != 0 { + return t / 100 * 100 + } + if t%1000 != 0 { + return t / 1000 * 1000 + } + return 0 +} + +func (t TokenType) Category() TokenType { + return t / 1000 * 1000 +} + +func (t TokenType) SubCategory() TokenType { + return t / 100 * 100 +} + +func (t TokenType) InCategory(other TokenType) bool { + return t/1000 == other/1000 +} + +func (t TokenType) InSubCategory(other TokenType) bool { + return t/100 == other/100 +} + +func (t TokenType) Emit(groups []string, lexer Lexer) Iterator { + return Literator(Token{Type: t, Value: groups[0]}) +} diff --git a/vendor/github.com/danwakefield/fnmatch/.gitignore b/vendor/github.com/danwakefield/fnmatch/.gitignore new file mode 100644 index 000000000..daf913b1b --- /dev/null +++ b/vendor/github.com/danwakefield/fnmatch/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/vendor/github.com/danwakefield/fnmatch/LICENSE b/vendor/github.com/danwakefield/fnmatch/LICENSE new file mode 100644 index 000000000..0dc9851a3 --- /dev/null +++ b/vendor/github.com/danwakefield/fnmatch/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2016, Daniel Wakefield +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/danwakefield/fnmatch/README.md b/vendor/github.com/danwakefield/fnmatch/README.md new file mode 100644 index 000000000..b8d715662 --- /dev/null +++ b/vendor/github.com/danwakefield/fnmatch/README.md @@ -0,0 +1,4 @@ +# fnmatch +Updated clone of kballards golang fnmatch gist (https://gist.github.com/kballard/272720) + + diff --git a/vendor/github.com/danwakefield/fnmatch/fnmatch.go b/vendor/github.com/danwakefield/fnmatch/fnmatch.go new file mode 100644 index 000000000..07ac7b37c --- /dev/null +++ b/vendor/github.com/danwakefield/fnmatch/fnmatch.go @@ -0,0 +1,219 @@ +// Provide string-matching based on fnmatch.3 +package fnmatch + +// There are a few issues that I believe to be bugs, but this implementation is +// based as closely as possible on BSD fnmatch. These bugs are present in the +// source of BSD fnmatch, and so are replicated here. The issues are as follows: +// +// * FNM_PERIOD is no longer observed after the first * in a pattern +// This only applies to matches done with FNM_PATHNAME as well +// * FNM_PERIOD doesn't apply to ranges. According to the documentation, +// a period must be matched explicitly, but a range will match it too + +import ( + "unicode" + "unicode/utf8" +) + +const ( + FNM_NOESCAPE = (1 << iota) + FNM_PATHNAME + FNM_PERIOD + + FNM_LEADING_DIR + FNM_CASEFOLD + + FNM_IGNORECASE = FNM_CASEFOLD + FNM_FILE_NAME = FNM_PATHNAME +) + +func unpackRune(str *string) rune { + rune, size := utf8.DecodeRuneInString(*str) + *str = (*str)[size:] + return rune +} + +// Matches the pattern against the string, with the given flags, +// and returns true if the match is successful. +// This function should match fnmatch.3 as closely as possible. +func Match(pattern, s string, flags int) bool { + // The implementation for this function was patterned after the BSD fnmatch.c + // source found at http://src.gnu-darwin.org/src/contrib/csup/fnmatch.c.html + noescape := (flags&FNM_NOESCAPE != 0) + pathname := (flags&FNM_PATHNAME != 0) + period := (flags&FNM_PERIOD != 0) + leadingdir := (flags&FNM_LEADING_DIR != 0) + casefold := (flags&FNM_CASEFOLD != 0) + // the following is some bookkeeping that the original fnmatch.c implementation did not do + // We are forced to do this because we're not keeping indexes into C strings but rather + // processing utf8-encoded strings. Use a custom unpacker to maintain our state for us + sAtStart := true + sLastAtStart := true + sLastSlash := false + sLastUnpacked := rune(0) + unpackS := func() rune { + sLastSlash = (sLastUnpacked == '/') + sLastUnpacked = unpackRune(&s) + sLastAtStart = sAtStart + sAtStart = false + return sLastUnpacked + } + for len(pattern) > 0 { + c := unpackRune(&pattern) + switch c { + case '?': + if len(s) == 0 { + return false + } + sc := unpackS() + if pathname && sc == '/' { + return false + } + if period && sc == '.' && (sLastAtStart || (pathname && sLastSlash)) { + return false + } + case '*': + // collapse multiple *'s + // don't use unpackRune here, the only char we care to detect is ASCII + for len(pattern) > 0 && pattern[0] == '*' { + pattern = pattern[1:] + } + if period && s[0] == '.' && (sAtStart || (pathname && sLastUnpacked == '/')) { + return false + } + // optimize for patterns with * at end or before / + if len(pattern) == 0 { + if pathname { + return leadingdir || (strchr(s, '/') == -1) + } else { + return true + } + return !(pathname && strchr(s, '/') >= 0) + } else if pathname && pattern[0] == '/' { + offset := strchr(s, '/') + if offset == -1 { + return false + } else { + // we already know our pattern and string have a /, skip past it + s = s[offset:] // use unpackS here to maintain our bookkeeping state + unpackS() + pattern = pattern[1:] // we know / is one byte long + break + } + } + // general case, recurse + for test := s; len(test) > 0; unpackRune(&test) { + // I believe the (flags &^ FNM_PERIOD) is a bug when FNM_PATHNAME is specified + // but this follows exactly from how fnmatch.c implements it + if Match(pattern, test, (flags &^ FNM_PERIOD)) { + return true + } else if pathname && test[0] == '/' { + break + } + } + return false + case '[': + if len(s) == 0 { + return false + } + if pathname && s[0] == '/' { + return false + } + sc := unpackS() + if !rangematch(&pattern, sc, flags) { + return false + } + case '\\': + if !noescape { + if len(pattern) > 0 { + c = unpackRune(&pattern) + } + } + fallthrough + default: + if len(s) == 0 { + return false + } + sc := unpackS() + switch { + case sc == c: + case casefold && unicode.ToLower(sc) == unicode.ToLower(c): + default: + return false + } + } + } + return len(s) == 0 || (leadingdir && s[0] == '/') +} + +func rangematch(pattern *string, test rune, flags int) bool { + if len(*pattern) == 0 { + return false + } + casefold := (flags&FNM_CASEFOLD != 0) + noescape := (flags&FNM_NOESCAPE != 0) + if casefold { + test = unicode.ToLower(test) + } + var negate, matched bool + if (*pattern)[0] == '^' || (*pattern)[0] == '!' { + negate = true + (*pattern) = (*pattern)[1:] + } + for !matched && len(*pattern) > 1 && (*pattern)[0] != ']' { + c := unpackRune(pattern) + if !noescape && c == '\\' { + if len(*pattern) > 1 { + c = unpackRune(pattern) + } else { + return false + } + } + if casefold { + c = unicode.ToLower(c) + } + if (*pattern)[0] == '-' && len(*pattern) > 1 && (*pattern)[1] != ']' { + unpackRune(pattern) // skip the - + c2 := unpackRune(pattern) + if !noescape && c2 == '\\' { + if len(*pattern) > 0 { + c2 = unpackRune(pattern) + } else { + return false + } + } + if casefold { + c2 = unicode.ToLower(c2) + } + // this really should be more intelligent, but it looks like + // fnmatch.c does simple int comparisons, therefore we will as well + if c <= test && test <= c2 { + matched = true + } + } else if c == test { + matched = true + } + } + // skip past the rest of the pattern + ok := false + for !ok && len(*pattern) > 0 { + c := unpackRune(pattern) + if c == '\\' && len(*pattern) > 0 { + unpackRune(pattern) + } else if c == ']' { + ok = true + } + } + return ok && matched != negate +} + +// define strchr because strings.Index() seems a bit overkill +// returns the index of c in s, or -1 if there is no match +func strchr(s string, c rune) int { + for i, sc := range s { + if sc == c { + return i + } + } + return -1 +} diff --git a/vendor/github.com/disintegration/imaging/.travis.yml b/vendor/github.com/disintegration/imaging/.travis.yml new file mode 100644 index 000000000..7ae5e4b25 --- /dev/null +++ b/vendor/github.com/disintegration/imaging/.travis.yml @@ -0,0 +1,12 @@ +language: go +go: + - "1.10.x" + - "1.11.x" + - "1.12.x" + +before_install: + - go get github.com/mattn/goveralls + +script: + - go test -v -race -cover + - $GOPATH/bin/goveralls -service=travis-ci diff --git a/vendor/github.com/disintegration/imaging/LICENSE b/vendor/github.com/disintegration/imaging/LICENSE new file mode 100644 index 000000000..a4144a9d2 --- /dev/null +++ b/vendor/github.com/disintegration/imaging/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2012 Grigory Dryapak + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/disintegration/imaging/README.md b/vendor/github.com/disintegration/imaging/README.md new file mode 100644 index 000000000..a1fd764d2 --- /dev/null +++ b/vendor/github.com/disintegration/imaging/README.md @@ -0,0 +1,226 @@ +# Imaging + +[![GoDoc](https://godoc.org/github.com/disintegration/imaging?status.svg)](https://godoc.org/github.com/disintegration/imaging) +[![Build Status](https://travis-ci.org/disintegration/imaging.svg?branch=master)](https://travis-ci.org/disintegration/imaging) +[![Coverage Status](https://coveralls.io/repos/github/disintegration/imaging/badge.svg?branch=master&service=github)](https://coveralls.io/github/disintegration/imaging?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/disintegration/imaging)](https://goreportcard.com/report/github.com/disintegration/imaging) + +Package imaging provides basic image processing functions (resize, rotate, crop, brightness/contrast adjustments, etc.). + +All the image processing functions provided by the package accept any image type that implements `image.Image` interface +as an input, and return a new image of `*image.NRGBA` type (32bit RGBA colors, non-premultiplied alpha). + +## Installation + + go get -u github.com/disintegration/imaging + +## Documentation + +http://godoc.org/github.com/disintegration/imaging + +## Usage examples + +A few usage examples can be found below. See the documentation for the full list of supported functions. + +### Image resizing + +```go +// Resize srcImage to size = 128x128px using the Lanczos filter. +dstImage128 := imaging.Resize(srcImage, 128, 128, imaging.Lanczos) + +// Resize srcImage to width = 800px preserving the aspect ratio. +dstImage800 := imaging.Resize(srcImage, 800, 0, imaging.Lanczos) + +// Scale down srcImage to fit the 800x600px bounding box. +dstImageFit := imaging.Fit(srcImage, 800, 600, imaging.Lanczos) + +// Resize and crop the srcImage to fill the 100x100px area. +dstImageFill := imaging.Fill(srcImage, 100, 100, imaging.Center, imaging.Lanczos) +``` + +Imaging supports image resizing using various resampling filters. The most notable ones: +- `Lanczos` - A high-quality resampling filter for photographic images yielding sharp results. +- `CatmullRom` - A sharp cubic filter that is faster than Lanczos filter while providing similar results. +- `MitchellNetravali` - A cubic filter that produces smoother results with less ringing artifacts than CatmullRom. +- `Linear` - Bilinear resampling filter, produces smooth output. Faster than cubic filters. +- `Box` - Simple and fast averaging filter appropriate for downscaling. When upscaling it's similar to NearestNeighbor. +- `NearestNeighbor` - Fastest resampling filter, no antialiasing. + +The full list of supported filters: NearestNeighbor, Box, Linear, Hermite, MitchellNetravali, CatmullRom, BSpline, Gaussian, Lanczos, Hann, Hamming, Blackman, Bartlett, Welch, Cosine. Custom filters can be created using ResampleFilter struct. + +**Resampling filters comparison** + +Original image: + +![srcImage](testdata/branches.png) + +The same image resized from 600x400px to 150x100px using different resampling filters. +From faster (lower quality) to slower (higher quality): + +Filter | Resize result +--------------------------|--------------------------------------------- +`imaging.NearestNeighbor` | ![dstImage](testdata/out_resize_nearest.png) +`imaging.Linear` | ![dstImage](testdata/out_resize_linear.png) +`imaging.CatmullRom` | ![dstImage](testdata/out_resize_catrom.png) +`imaging.Lanczos` | ![dstImage](testdata/out_resize_lanczos.png) + + +### Gaussian Blur + +```go +dstImage := imaging.Blur(srcImage, 0.5) +``` + +Sigma parameter allows to control the strength of the blurring effect. + +Original image | Sigma = 0.5 | Sigma = 1.5 +-----------------------------------|----------------------------------------|--------------------------------------- +![srcImage](testdata/flowers_small.png) | ![dstImage](testdata/out_blur_0.5.png) | ![dstImage](testdata/out_blur_1.5.png) + +### Sharpening + +```go +dstImage := imaging.Sharpen(srcImage, 0.5) +``` + +`Sharpen` uses gaussian function internally. Sigma parameter allows to control the strength of the sharpening effect. + +Original image | Sigma = 0.5 | Sigma = 1.5 +-----------------------------------|-------------------------------------------|------------------------------------------ +![srcImage](testdata/flowers_small.png) | ![dstImage](testdata/out_sharpen_0.5.png) | ![dstImage](testdata/out_sharpen_1.5.png) + +### Gamma correction + +```go +dstImage := imaging.AdjustGamma(srcImage, 0.75) +``` + +Original image | Gamma = 0.75 | Gamma = 1.25 +-----------------------------------|------------------------------------------|----------------------------------------- +![srcImage](testdata/flowers_small.png) | ![dstImage](testdata/out_gamma_0.75.png) | ![dstImage](testdata/out_gamma_1.25.png) + +### Contrast adjustment + +```go +dstImage := imaging.AdjustContrast(srcImage, 20) +``` + +Original image | Contrast = 15 | Contrast = -15 +-----------------------------------|--------------------------------------------|------------------------------------------- +![srcImage](testdata/flowers_small.png) | ![dstImage](testdata/out_contrast_p15.png) | ![dstImage](testdata/out_contrast_m15.png) + +### Brightness adjustment + +```go +dstImage := imaging.AdjustBrightness(srcImage, 20) +``` + +Original image | Brightness = 10 | Brightness = -10 +-----------------------------------|----------------------------------------------|--------------------------------------------- +![srcImage](testdata/flowers_small.png) | ![dstImage](testdata/out_brightness_p10.png) | ![dstImage](testdata/out_brightness_m10.png) + +### Saturation adjustment + +```go +dstImage := imaging.AdjustSaturation(srcImage, 20) +``` + +Original image | Saturation = 30 | Saturation = -30 +-----------------------------------|----------------------------------------------|--------------------------------------------- +![srcImage](testdata/flowers_small.png) | ![dstImage](testdata/out_saturation_p30.png) | ![dstImage](testdata/out_saturation_m30.png) + +## FAQ + +### Incorrect image orientation after processing (e.g. an image appears rotated after resizing) + +Most probably, the given image contains the EXIF orientation tag. +The stadard `image/*` packages do not support loading and saving +this kind of information. To fix the issue, try opening images with +the `AutoOrientation` decode option. If this option is set to `true`, +the image orientation is changed after decoding, according to the +orientation tag (if present). Here's the example: + +```go +img, err := imaging.Open("test.jpg", imaging.AutoOrientation(true)) +``` + +### What's the difference between `imaging` and `gift` packages? + +[imaging](https://github.com/disintegration/imaging) +is designed to be a lightweight and simple image manipulation package. +It provides basic image processing functions and a few helper functions +such as `Open` and `Save`. It consistently returns *image.NRGBA image +type (8 bits per channel, RGBA). + +[gift](https://github.com/disintegration/gift) +supports more advanced image processing, for example, sRGB/Linear color +space conversions. It also supports different output image types +(e.g. 16 bits per channel) and provides easy-to-use API for chaining +multiple processing steps together. + +## Example code + +```go +package main + +import ( + "image" + "image/color" + "log" + + "github.com/disintegration/imaging" +) + +func main() { + // Open a test image. + src, err := imaging.Open("testdata/flowers.png") + if err != nil { + log.Fatalf("failed to open image: %v", err) + } + + // Crop the original image to 300x300px size using the center anchor. + src = imaging.CropAnchor(src, 300, 300, imaging.Center) + + // Resize the cropped image to width = 200px preserving the aspect ratio. + src = imaging.Resize(src, 200, 0, imaging.Lanczos) + + // Create a blurred version of the image. + img1 := imaging.Blur(src, 5) + + // Create a grayscale version of the image with higher contrast and sharpness. + img2 := imaging.Grayscale(src) + img2 = imaging.AdjustContrast(img2, 20) + img2 = imaging.Sharpen(img2, 2) + + // Create an inverted version of the image. + img3 := imaging.Invert(src) + + // Create an embossed version of the image using a convolution filter. + img4 := imaging.Convolve3x3( + src, + [9]float64{ + -1, -1, 0, + -1, 1, 1, + 0, 1, 1, + }, + nil, + ) + + // Create a new image and paste the four produced images into it. + dst := imaging.New(400, 400, color.NRGBA{0, 0, 0, 0}) + dst = imaging.Paste(dst, img1, image.Pt(0, 0)) + dst = imaging.Paste(dst, img2, image.Pt(0, 200)) + dst = imaging.Paste(dst, img3, image.Pt(200, 0)) + dst = imaging.Paste(dst, img4, image.Pt(200, 200)) + + // Save the resulting image as JPEG. + err = imaging.Save(dst, "testdata/out_example.jpg") + if err != nil { + log.Fatalf("failed to save image: %v", err) + } +} +``` + +Output: + +![dstImage](testdata/out_example.jpg) diff --git a/vendor/github.com/disintegration/imaging/adjust.go b/vendor/github.com/disintegration/imaging/adjust.go new file mode 100644 index 000000000..daaf1de86 --- /dev/null +++ b/vendor/github.com/disintegration/imaging/adjust.go @@ -0,0 +1,253 @@ +package imaging + +import ( + "image" + "image/color" + "math" +) + +// Grayscale produces a grayscale version of the image. +func Grayscale(img image.Image) *image.NRGBA { + src := newScanner(img) + dst := image.NewNRGBA(image.Rect(0, 0, src.w, src.h)) + parallel(0, src.h, func(ys <-chan int) { + for y := range ys { + i := y * dst.Stride + src.scan(0, y, src.w, y+1, dst.Pix[i:i+src.w*4]) + for x := 0; x < src.w; x++ { + d := dst.Pix[i : i+3 : i+3] + r := d[0] + g := d[1] + b := d[2] + f := 0.299*float64(r) + 0.587*float64(g) + 0.114*float64(b) + y := uint8(f + 0.5) + d[0] = y + d[1] = y + d[2] = y + i += 4 + } + } + }) + return dst +} + +// Invert produces an inverted (negated) version of the image. +func Invert(img image.Image) *image.NRGBA { + src := newScanner(img) + dst := image.NewNRGBA(image.Rect(0, 0, src.w, src.h)) + parallel(0, src.h, func(ys <-chan int) { + for y := range ys { + i := y * dst.Stride + src.scan(0, y, src.w, y+1, dst.Pix[i:i+src.w*4]) + for x := 0; x < src.w; x++ { + d := dst.Pix[i : i+3 : i+3] + d[0] = 255 - d[0] + d[1] = 255 - d[1] + d[2] = 255 - d[2] + i += 4 + } + } + }) + return dst +} + +// AdjustSaturation changes the saturation of the image using the percentage parameter and returns the adjusted image. +// The percentage must be in the range (-100, 100). +// The percentage = 0 gives the original image. +// The percentage = 100 gives the image with the saturation value doubled for each pixel. +// The percentage = -100 gives the image with the saturation value zeroed for each pixel (grayscale). +// +// Examples: +// dstImage = imaging.AdjustSaturation(srcImage, 25) // Increase image saturation by 25%. +// dstImage = imaging.AdjustSaturation(srcImage, -10) // Decrease image saturation by 10%. +// +func AdjustSaturation(img image.Image, percentage float64) *image.NRGBA { + percentage = math.Min(math.Max(percentage, -100), 100) + multiplier := 1 + percentage/100 + + return AdjustFunc(img, func(c color.NRGBA) color.NRGBA { + h, s, l := rgbToHSL(c.R, c.G, c.B) + s *= multiplier + if s > 1 { + s = 1 + } + r, g, b := hslToRGB(h, s, l) + return color.NRGBA{r, g, b, c.A} + }) +} + +// AdjustContrast changes the contrast of the image using the percentage parameter and returns the adjusted image. +// The percentage must be in range (-100, 100). The percentage = 0 gives the original image. +// The percentage = -100 gives solid gray image. +// +// Examples: +// +// dstImage = imaging.AdjustContrast(srcImage, -10) // Decrease image contrast by 10%. +// dstImage = imaging.AdjustContrast(srcImage, 20) // Increase image contrast by 20%. +// +func AdjustContrast(img image.Image, percentage float64) *image.NRGBA { + percentage = math.Min(math.Max(percentage, -100.0), 100.0) + lut := make([]uint8, 256) + + v := (100.0 + percentage) / 100.0 + for i := 0; i < 256; i++ { + switch { + case 0 <= v && v <= 1: + lut[i] = clamp((0.5 + (float64(i)/255.0-0.5)*v) * 255.0) + case 1 < v && v < 2: + lut[i] = clamp((0.5 + (float64(i)/255.0-0.5)*(1/(2.0-v))) * 255.0) + default: + lut[i] = uint8(float64(i)/255.0+0.5) * 255 + } + } + + return adjustLUT(img, lut) +} + +// AdjustBrightness changes the brightness of the image using the percentage parameter and returns the adjusted image. +// The percentage must be in range (-100, 100). The percentage = 0 gives the original image. +// The percentage = -100 gives solid black image. The percentage = 100 gives solid white image. +// +// Examples: +// +// dstImage = imaging.AdjustBrightness(srcImage, -15) // Decrease image brightness by 15%. +// dstImage = imaging.AdjustBrightness(srcImage, 10) // Increase image brightness by 10%. +// +func AdjustBrightness(img image.Image, percentage float64) *image.NRGBA { + percentage = math.Min(math.Max(percentage, -100.0), 100.0) + lut := make([]uint8, 256) + + shift := 255.0 * percentage / 100.0 + for i := 0; i < 256; i++ { + lut[i] = clamp(float64(i) + shift) + } + + return adjustLUT(img, lut) +} + +// AdjustGamma performs a gamma correction on the image and returns the adjusted image. +// Gamma parameter must be positive. Gamma = 1.0 gives the original image. +// Gamma less than 1.0 darkens the image and gamma greater than 1.0 lightens it. +// +// Example: +// +// dstImage = imaging.AdjustGamma(srcImage, 0.7) +// +func AdjustGamma(img image.Image, gamma float64) *image.NRGBA { + e := 1.0 / math.Max(gamma, 0.0001) + lut := make([]uint8, 256) + + for i := 0; i < 256; i++ { + lut[i] = clamp(math.Pow(float64(i)/255.0, e) * 255.0) + } + + return adjustLUT(img, lut) +} + +// AdjustSigmoid changes the contrast of the image using a sigmoidal function and returns the adjusted image. +// It's a non-linear contrast change useful for photo adjustments as it preserves highlight and shadow detail. +// The midpoint parameter is the midpoint of contrast that must be between 0 and 1, typically 0.5. +// The factor parameter indicates how much to increase or decrease the contrast, typically in range (-10, 10). +// If the factor parameter is positive the image contrast is increased otherwise the contrast is decreased. +// +// Examples: +// +// dstImage = imaging.AdjustSigmoid(srcImage, 0.5, 3.0) // Increase the contrast. +// dstImage = imaging.AdjustSigmoid(srcImage, 0.5, -3.0) // Decrease the contrast. +// +func AdjustSigmoid(img image.Image, midpoint, factor float64) *image.NRGBA { + if factor == 0 { + return Clone(img) + } + + lut := make([]uint8, 256) + a := math.Min(math.Max(midpoint, 0.0), 1.0) + b := math.Abs(factor) + sig0 := sigmoid(a, b, 0) + sig1 := sigmoid(a, b, 1) + e := 1.0e-6 + + if factor > 0 { + for i := 0; i < 256; i++ { + x := float64(i) / 255.0 + sigX := sigmoid(a, b, x) + f := (sigX - sig0) / (sig1 - sig0) + lut[i] = clamp(f * 255.0) + } + } else { + for i := 0; i < 256; i++ { + x := float64(i) / 255.0 + arg := math.Min(math.Max((sig1-sig0)*x+sig0, e), 1.0-e) + f := a - math.Log(1.0/arg-1.0)/b + lut[i] = clamp(f * 255.0) + } + } + + return adjustLUT(img, lut) +} + +func sigmoid(a, b, x float64) float64 { + return 1 / (1 + math.Exp(b*(a-x))) +} + +// adjustLUT applies the given lookup table to the colors of the image. +func adjustLUT(img image.Image, lut []uint8) *image.NRGBA { + src := newScanner(img) + dst := image.NewNRGBA(image.Rect(0, 0, src.w, src.h)) + lut = lut[0:256] + parallel(0, src.h, func(ys <-chan int) { + for y := range ys { + i := y * dst.Stride + src.scan(0, y, src.w, y+1, dst.Pix[i:i+src.w*4]) + for x := 0; x < src.w; x++ { + d := dst.Pix[i : i+3 : i+3] + d[0] = lut[d[0]] + d[1] = lut[d[1]] + d[2] = lut[d[2]] + i += 4 + } + } + }) + return dst +} + +// AdjustFunc applies the fn function to each pixel of the img image and returns the adjusted image. +// +// Example: +// +// dstImage = imaging.AdjustFunc( +// srcImage, +// func(c color.NRGBA) color.NRGBA { +// // Shift the red channel by 16. +// r := int(c.R) + 16 +// if r > 255 { +// r = 255 +// } +// return color.NRGBA{uint8(r), c.G, c.B, c.A} +// } +// ) +// +func AdjustFunc(img image.Image, fn func(c color.NRGBA) color.NRGBA) *image.NRGBA { + src := newScanner(img) + dst := image.NewNRGBA(image.Rect(0, 0, src.w, src.h)) + parallel(0, src.h, func(ys <-chan int) { + for y := range ys { + i := y * dst.Stride + src.scan(0, y, src.w, y+1, dst.Pix[i:i+src.w*4]) + for x := 0; x < src.w; x++ { + d := dst.Pix[i : i+4 : i+4] + r := d[0] + g := d[1] + b := d[2] + a := d[3] + c := fn(color.NRGBA{r, g, b, a}) + d[0] = c.R + d[1] = c.G + d[2] = c.B + d[3] = c.A + i += 4 + } + } + }) + return dst +} diff --git a/vendor/github.com/disintegration/imaging/convolution.go b/vendor/github.com/disintegration/imaging/convolution.go new file mode 100644 index 000000000..11eddc162 --- /dev/null +++ b/vendor/github.com/disintegration/imaging/convolution.go @@ -0,0 +1,148 @@ +package imaging + +import ( + "image" +) + +// ConvolveOptions are convolution parameters. +type ConvolveOptions struct { + // If Normalize is true the kernel is normalized before convolution. + Normalize bool + + // If Abs is true the absolute value of each color channel is taken after convolution. + Abs bool + + // Bias is added to each color channel value after convolution. + Bias int +} + +// Convolve3x3 convolves the image with the specified 3x3 convolution kernel. +// Default parameters are used if a nil *ConvolveOptions is passed. +func Convolve3x3(img image.Image, kernel [9]float64, options *ConvolveOptions) *image.NRGBA { + return convolve(img, kernel[:], options) +} + +// Convolve5x5 convolves the image with the specified 5x5 convolution kernel. +// Default parameters are used if a nil *ConvolveOptions is passed. +func Convolve5x5(img image.Image, kernel [25]float64, options *ConvolveOptions) *image.NRGBA { + return convolve(img, kernel[:], options) +} + +func convolve(img image.Image, kernel []float64, options *ConvolveOptions) *image.NRGBA { + src := toNRGBA(img) + w := src.Bounds().Max.X + h := src.Bounds().Max.Y + dst := image.NewNRGBA(image.Rect(0, 0, w, h)) + + if w < 1 || h < 1 { + return dst + } + + if options == nil { + options = &ConvolveOptions{} + } + + if options.Normalize { + normalizeKernel(kernel) + } + + type coef struct { + x, y int + k float64 + } + var coefs []coef + var m int + + switch len(kernel) { + case 9: + m = 1 + case 25: + m = 2 + } + + i := 0 + for y := -m; y <= m; y++ { + for x := -m; x <= m; x++ { + if kernel[i] != 0 { + coefs = append(coefs, coef{x: x, y: y, k: kernel[i]}) + } + i++ + } + } + + parallel(0, h, func(ys <-chan int) { + for y := range ys { + for x := 0; x < w; x++ { + var r, g, b float64 + for _, c := range coefs { + ix := x + c.x + if ix < 0 { + ix = 0 + } else if ix >= w { + ix = w - 1 + } + + iy := y + c.y + if iy < 0 { + iy = 0 + } else if iy >= h { + iy = h - 1 + } + + off := iy*src.Stride + ix*4 + s := src.Pix[off : off+3 : off+3] + r += float64(s[0]) * c.k + g += float64(s[1]) * c.k + b += float64(s[2]) * c.k + } + + if options.Abs { + if r < 0 { + r = -r + } + if g < 0 { + g = -g + } + if b < 0 { + b = -b + } + } + + if options.Bias != 0 { + r += float64(options.Bias) + g += float64(options.Bias) + b += float64(options.Bias) + } + + srcOff := y*src.Stride + x*4 + dstOff := y*dst.Stride + x*4 + d := dst.Pix[dstOff : dstOff+4 : dstOff+4] + d[0] = clamp(r) + d[1] = clamp(g) + d[2] = clamp(b) + d[3] = src.Pix[srcOff+3] + } + } + }) + + return dst +} + +func normalizeKernel(kernel []float64) { + var sum, sumpos float64 + for i := range kernel { + sum += kernel[i] + if kernel[i] > 0 { + sumpos += kernel[i] + } + } + if sum != 0 { + for i := range kernel { + kernel[i] /= sum + } + } else if sumpos != 0 { + for i := range kernel { + kernel[i] /= sumpos + } + } +} diff --git a/vendor/github.com/disintegration/imaging/doc.go b/vendor/github.com/disintegration/imaging/doc.go new file mode 100644 index 000000000..c98c91250 --- /dev/null +++ b/vendor/github.com/disintegration/imaging/doc.go @@ -0,0 +1,7 @@ +/* +Package imaging provides basic image processing functions (resize, rotate, crop, brightness/contrast adjustments, etc.). + +All the image processing functions provided by the package accept any image type that implements image.Image interface +as an input, and return a new image of *image.NRGBA type (32bit RGBA colors, non-premultiplied alpha). +*/ +package imaging diff --git a/vendor/github.com/disintegration/imaging/effects.go b/vendor/github.com/disintegration/imaging/effects.go new file mode 100644 index 000000000..47316b701 --- /dev/null +++ b/vendor/github.com/disintegration/imaging/effects.go @@ -0,0 +1,169 @@ +package imaging + +import ( + "image" + "math" +) + +func gaussianBlurKernel(x, sigma float64) float64 { + return math.Exp(-(x*x)/(2*sigma*sigma)) / (sigma * math.Sqrt(2*math.Pi)) +} + +// Blur produces a blurred version of the image using a Gaussian function. +// Sigma parameter must be positive and indicates how much the image will be blurred. +// +// Example: +// +// dstImage := imaging.Blur(srcImage, 3.5) +// +func Blur(img image.Image, sigma float64) *image.NRGBA { + if sigma <= 0 { + return Clone(img) + } + + radius := int(math.Ceil(sigma * 3.0)) + kernel := make([]float64, radius+1) + + for i := 0; i <= radius; i++ { + kernel[i] = gaussianBlurKernel(float64(i), sigma) + } + + return blurVertical(blurHorizontal(img, kernel), kernel) +} + +func blurHorizontal(img image.Image, kernel []float64) *image.NRGBA { + src := newScanner(img) + dst := image.NewNRGBA(image.Rect(0, 0, src.w, src.h)) + radius := len(kernel) - 1 + + parallel(0, src.h, func(ys <-chan int) { + scanLine := make([]uint8, src.w*4) + scanLineF := make([]float64, len(scanLine)) + for y := range ys { + src.scan(0, y, src.w, y+1, scanLine) + for i, v := range scanLine { + scanLineF[i] = float64(v) + } + for x := 0; x < src.w; x++ { + min := x - radius + if min < 0 { + min = 0 + } + max := x + radius + if max > src.w-1 { + max = src.w - 1 + } + var r, g, b, a, wsum float64 + for ix := min; ix <= max; ix++ { + i := ix * 4 + weight := kernel[absint(x-ix)] + wsum += weight + s := scanLineF[i : i+4 : i+4] + wa := s[3] * weight + r += s[0] * wa + g += s[1] * wa + b += s[2] * wa + a += wa + } + if a != 0 { + aInv := 1 / a + j := y*dst.Stride + x*4 + d := dst.Pix[j : j+4 : j+4] + d[0] = clamp(r * aInv) + d[1] = clamp(g * aInv) + d[2] = clamp(b * aInv) + d[3] = clamp(a / wsum) + } + } + } + }) + + return dst +} + +func blurVertical(img image.Image, kernel []float64) *image.NRGBA { + src := newScanner(img) + dst := image.NewNRGBA(image.Rect(0, 0, src.w, src.h)) + radius := len(kernel) - 1 + + parallel(0, src.w, func(xs <-chan int) { + scanLine := make([]uint8, src.h*4) + scanLineF := make([]float64, len(scanLine)) + for x := range xs { + src.scan(x, 0, x+1, src.h, scanLine) + for i, v := range scanLine { + scanLineF[i] = float64(v) + } + for y := 0; y < src.h; y++ { + min := y - radius + if min < 0 { + min = 0 + } + max := y + radius + if max > src.h-1 { + max = src.h - 1 + } + var r, g, b, a, wsum float64 + for iy := min; iy <= max; iy++ { + i := iy * 4 + weight := kernel[absint(y-iy)] + wsum += weight + s := scanLineF[i : i+4 : i+4] + wa := s[3] * weight + r += s[0] * wa + g += s[1] * wa + b += s[2] * wa + a += wa + } + if a != 0 { + aInv := 1 / a + j := y*dst.Stride + x*4 + d := dst.Pix[j : j+4 : j+4] + d[0] = clamp(r * aInv) + d[1] = clamp(g * aInv) + d[2] = clamp(b * aInv) + d[3] = clamp(a / wsum) + } + } + } + }) + + return dst +} + +// Sharpen produces a sharpened version of the image. +// Sigma parameter must be positive and indicates how much the image will be sharpened. +// +// Example: +// +// dstImage := imaging.Sharpen(srcImage, 3.5) +// +func Sharpen(img image.Image, sigma float64) *image.NRGBA { + if sigma <= 0 { + return Clone(img) + } + + src := newScanner(img) + dst := image.NewNRGBA(image.Rect(0, 0, src.w, src.h)) + blurred := Blur(img, sigma) + + parallel(0, src.h, func(ys <-chan int) { + scanLine := make([]uint8, src.w*4) + for y := range ys { + src.scan(0, y, src.w, y+1, scanLine) + j := y * dst.Stride + for i := 0; i < src.w*4; i++ { + val := int(scanLine[i])<<1 - int(blurred.Pix[j]) + if val < 0 { + val = 0 + } else if val > 0xff { + val = 0xff + } + dst.Pix[j] = uint8(val) + j++ + } + } + }) + + return dst +} diff --git a/vendor/github.com/disintegration/imaging/histogram.go b/vendor/github.com/disintegration/imaging/histogram.go new file mode 100644 index 000000000..c547fe822 --- /dev/null +++ b/vendor/github.com/disintegration/imaging/histogram.go @@ -0,0 +1,52 @@ +package imaging + +import ( + "image" + "sync" +) + +// Histogram returns a normalized histogram of an image. +// +// Resulting histogram is represented as an array of 256 floats, where +// histogram[i] is a probability of a pixel being of a particular luminance i. +func Histogram(img image.Image) [256]float64 { + var mu sync.Mutex + var histogram [256]float64 + var total float64 + + src := newScanner(img) + if src.w == 0 || src.h == 0 { + return histogram + } + + parallel(0, src.h, func(ys <-chan int) { + var tmpHistogram [256]float64 + var tmpTotal float64 + scanLine := make([]uint8, src.w*4) + for y := range ys { + src.scan(0, y, src.w, y+1, scanLine) + i := 0 + for x := 0; x < src.w; x++ { + s := scanLine[i : i+3 : i+3] + r := s[0] + g := s[1] + b := s[2] + y := 0.299*float32(r) + 0.587*float32(g) + 0.114*float32(b) + tmpHistogram[int(y+0.5)]++ + tmpTotal++ + i += 4 + } + } + mu.Lock() + for i := 0; i < 256; i++ { + histogram[i] += tmpHistogram[i] + } + total += tmpTotal + mu.Unlock() + }) + + for i := 0; i < 256; i++ { + histogram[i] = histogram[i] / total + } + return histogram +} diff --git a/vendor/github.com/disintegration/imaging/io.go b/vendor/github.com/disintegration/imaging/io.go new file mode 100644 index 000000000..f6c6da86b --- /dev/null +++ b/vendor/github.com/disintegration/imaging/io.go @@ -0,0 +1,444 @@ +package imaging + +import ( + "encoding/binary" + "errors" + "image" + "image/draw" + "image/gif" + "image/jpeg" + "image/png" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + + "golang.org/x/image/bmp" + "golang.org/x/image/tiff" +) + +type fileSystem interface { + Create(string) (io.WriteCloser, error) + Open(string) (io.ReadCloser, error) +} + +type localFS struct{} + +func (localFS) Create(name string) (io.WriteCloser, error) { return os.Create(name) } +func (localFS) Open(name string) (io.ReadCloser, error) { return os.Open(name) } + +var fs fileSystem = localFS{} + +type decodeConfig struct { + autoOrientation bool +} + +var defaultDecodeConfig = decodeConfig{ + autoOrientation: false, +} + +// DecodeOption sets an optional parameter for the Decode and Open functions. +type DecodeOption func(*decodeConfig) + +// AutoOrientation returns a DecodeOption that sets the auto-orientation mode. +// If auto-orientation is enabled, the image will be transformed after decoding +// according to the EXIF orientation tag (if present). By default it's disabled. +func AutoOrientation(enabled bool) DecodeOption { + return func(c *decodeConfig) { + c.autoOrientation = enabled + } +} + +// Decode reads an image from r. +func Decode(r io.Reader, opts ...DecodeOption) (image.Image, error) { + cfg := defaultDecodeConfig + for _, option := range opts { + option(&cfg) + } + + if !cfg.autoOrientation { + img, _, err := image.Decode(r) + return img, err + } + + var orient orientation + pr, pw := io.Pipe() + r = io.TeeReader(r, pw) + done := make(chan struct{}) + go func() { + defer close(done) + orient = readOrientation(pr) + io.Copy(ioutil.Discard, pr) + }() + + img, _, err := image.Decode(r) + pw.Close() + <-done + if err != nil { + return nil, err + } + + return fixOrientation(img, orient), nil +} + +// Open loads an image from file. +// +// Examples: +// +// // Load an image from file. +// img, err := imaging.Open("test.jpg") +// +// // Load an image and transform it depending on the EXIF orientation tag (if present). +// img, err := imaging.Open("test.jpg", imaging.AutoOrientation(true)) +// +func Open(filename string, opts ...DecodeOption) (image.Image, error) { + file, err := fs.Open(filename) + if err != nil { + return nil, err + } + defer file.Close() + return Decode(file, opts...) +} + +// Format is an image file format. +type Format int + +// Image file formats. +const ( + JPEG Format = iota + PNG + GIF + TIFF + BMP +) + +var formatExts = map[string]Format{ + "jpg": JPEG, + "jpeg": JPEG, + "png": PNG, + "gif": GIF, + "tif": TIFF, + "tiff": TIFF, + "bmp": BMP, +} + +var formatNames = map[Format]string{ + JPEG: "JPEG", + PNG: "PNG", + GIF: "GIF", + TIFF: "TIFF", + BMP: "BMP", +} + +func (f Format) String() string { + return formatNames[f] +} + +// ErrUnsupportedFormat means the given image format is not supported. +var ErrUnsupportedFormat = errors.New("imaging: unsupported image format") + +// FormatFromExtension parses image format from filename extension: +// "jpg" (or "jpeg"), "png", "gif", "tif" (or "tiff") and "bmp" are supported. +func FormatFromExtension(ext string) (Format, error) { + if f, ok := formatExts[strings.ToLower(strings.TrimPrefix(ext, "."))]; ok { + return f, nil + } + return -1, ErrUnsupportedFormat +} + +// FormatFromFilename parses image format from filename: +// "jpg" (or "jpeg"), "png", "gif", "tif" (or "tiff") and "bmp" are supported. +func FormatFromFilename(filename string) (Format, error) { + ext := filepath.Ext(filename) + return FormatFromExtension(ext) +} + +type encodeConfig struct { + jpegQuality int + gifNumColors int + gifQuantizer draw.Quantizer + gifDrawer draw.Drawer + pngCompressionLevel png.CompressionLevel +} + +var defaultEncodeConfig = encodeConfig{ + jpegQuality: 95, + gifNumColors: 256, + gifQuantizer: nil, + gifDrawer: nil, + pngCompressionLevel: png.DefaultCompression, +} + +// EncodeOption sets an optional parameter for the Encode and Save functions. +type EncodeOption func(*encodeConfig) + +// JPEGQuality returns an EncodeOption that sets the output JPEG quality. +// Quality ranges from 1 to 100 inclusive, higher is better. Default is 95. +func JPEGQuality(quality int) EncodeOption { + return func(c *encodeConfig) { + c.jpegQuality = quality + } +} + +// GIFNumColors returns an EncodeOption that sets the maximum number of colors +// used in the GIF-encoded image. It ranges from 1 to 256. Default is 256. +func GIFNumColors(numColors int) EncodeOption { + return func(c *encodeConfig) { + c.gifNumColors = numColors + } +} + +// GIFQuantizer returns an EncodeOption that sets the quantizer that is used to produce +// a palette of the GIF-encoded image. +func GIFQuantizer(quantizer draw.Quantizer) EncodeOption { + return func(c *encodeConfig) { + c.gifQuantizer = quantizer + } +} + +// GIFDrawer returns an EncodeOption that sets the drawer that is used to convert +// the source image to the desired palette of the GIF-encoded image. +func GIFDrawer(drawer draw.Drawer) EncodeOption { + return func(c *encodeConfig) { + c.gifDrawer = drawer + } +} + +// PNGCompressionLevel returns an EncodeOption that sets the compression level +// of the PNG-encoded image. Default is png.DefaultCompression. +func PNGCompressionLevel(level png.CompressionLevel) EncodeOption { + return func(c *encodeConfig) { + c.pngCompressionLevel = level + } +} + +// Encode writes the image img to w in the specified format (JPEG, PNG, GIF, TIFF or BMP). +func Encode(w io.Writer, img image.Image, format Format, opts ...EncodeOption) error { + cfg := defaultEncodeConfig + for _, option := range opts { + option(&cfg) + } + + switch format { + case JPEG: + if nrgba, ok := img.(*image.NRGBA); ok && nrgba.Opaque() { + rgba := &image.RGBA{ + Pix: nrgba.Pix, + Stride: nrgba.Stride, + Rect: nrgba.Rect, + } + return jpeg.Encode(w, rgba, &jpeg.Options{Quality: cfg.jpegQuality}) + } + return jpeg.Encode(w, img, &jpeg.Options{Quality: cfg.jpegQuality}) + + case PNG: + encoder := png.Encoder{CompressionLevel: cfg.pngCompressionLevel} + return encoder.Encode(w, img) + + case GIF: + return gif.Encode(w, img, &gif.Options{ + NumColors: cfg.gifNumColors, + Quantizer: cfg.gifQuantizer, + Drawer: cfg.gifDrawer, + }) + + case TIFF: + return tiff.Encode(w, img, &tiff.Options{Compression: tiff.Deflate, Predictor: true}) + + case BMP: + return bmp.Encode(w, img) + } + + return ErrUnsupportedFormat +} + +// Save saves the image to file with the specified filename. +// The format is determined from the filename extension: +// "jpg" (or "jpeg"), "png", "gif", "tif" (or "tiff") and "bmp" are supported. +// +// Examples: +// +// // Save the image as PNG. +// err := imaging.Save(img, "out.png") +// +// // Save the image as JPEG with optional quality parameter set to 80. +// err := imaging.Save(img, "out.jpg", imaging.JPEGQuality(80)) +// +func Save(img image.Image, filename string, opts ...EncodeOption) (err error) { + f, err := FormatFromFilename(filename) + if err != nil { + return err + } + file, err := fs.Create(filename) + if err != nil { + return err + } + err = Encode(file, img, f, opts...) + errc := file.Close() + if err == nil { + err = errc + } + return err +} + +// orientation is an EXIF flag that specifies the transformation +// that should be applied to image to display it correctly. +type orientation int + +const ( + orientationUnspecified = 0 + orientationNormal = 1 + orientationFlipH = 2 + orientationRotate180 = 3 + orientationFlipV = 4 + orientationTranspose = 5 + orientationRotate270 = 6 + orientationTransverse = 7 + orientationRotate90 = 8 +) + +// readOrientation tries to read the orientation EXIF flag from image data in r. +// If the EXIF data block is not found or the orientation flag is not found +// or any other error occures while reading the data, it returns the +// orientationUnspecified (0) value. +func readOrientation(r io.Reader) orientation { + const ( + markerSOI = 0xffd8 + markerAPP1 = 0xffe1 + exifHeader = 0x45786966 + byteOrderBE = 0x4d4d + byteOrderLE = 0x4949 + orientationTag = 0x0112 + ) + + // Check if JPEG SOI marker is present. + var soi uint16 + if err := binary.Read(r, binary.BigEndian, &soi); err != nil { + return orientationUnspecified + } + if soi != markerSOI { + return orientationUnspecified // Missing JPEG SOI marker. + } + + // Find JPEG APP1 marker. + for { + var marker, size uint16 + if err := binary.Read(r, binary.BigEndian, &marker); err != nil { + return orientationUnspecified + } + if err := binary.Read(r, binary.BigEndian, &size); err != nil { + return orientationUnspecified + } + if marker>>8 != 0xff { + return orientationUnspecified // Invalid JPEG marker. + } + if marker == markerAPP1 { + break + } + if size < 2 { + return orientationUnspecified // Invalid block size. + } + if _, err := io.CopyN(ioutil.Discard, r, int64(size-2)); err != nil { + return orientationUnspecified + } + } + + // Check if EXIF header is present. + var header uint32 + if err := binary.Read(r, binary.BigEndian, &header); err != nil { + return orientationUnspecified + } + if header != exifHeader { + return orientationUnspecified + } + if _, err := io.CopyN(ioutil.Discard, r, 2); err != nil { + return orientationUnspecified + } + + // Read byte order information. + var ( + byteOrderTag uint16 + byteOrder binary.ByteOrder + ) + if err := binary.Read(r, binary.BigEndian, &byteOrderTag); err != nil { + return orientationUnspecified + } + switch byteOrderTag { + case byteOrderBE: + byteOrder = binary.BigEndian + case byteOrderLE: + byteOrder = binary.LittleEndian + default: + return orientationUnspecified // Invalid byte order flag. + } + if _, err := io.CopyN(ioutil.Discard, r, 2); err != nil { + return orientationUnspecified + } + + // Skip the EXIF offset. + var offset uint32 + if err := binary.Read(r, byteOrder, &offset); err != nil { + return orientationUnspecified + } + if offset < 8 { + return orientationUnspecified // Invalid offset value. + } + if _, err := io.CopyN(ioutil.Discard, r, int64(offset-8)); err != nil { + return orientationUnspecified + } + + // Read the number of tags. + var numTags uint16 + if err := binary.Read(r, byteOrder, &numTags); err != nil { + return orientationUnspecified + } + + // Find the orientation tag. + for i := 0; i < int(numTags); i++ { + var tag uint16 + if err := binary.Read(r, byteOrder, &tag); err != nil { + return orientationUnspecified + } + if tag != orientationTag { + if _, err := io.CopyN(ioutil.Discard, r, 10); err != nil { + return orientationUnspecified + } + continue + } + if _, err := io.CopyN(ioutil.Discard, r, 6); err != nil { + return orientationUnspecified + } + var val uint16 + if err := binary.Read(r, byteOrder, &val); err != nil { + return orientationUnspecified + } + if val < 1 || val > 8 { + return orientationUnspecified // Invalid tag value. + } + return orientation(val) + } + return orientationUnspecified // Missing orientation tag. +} + +// fixOrientation applies a transform to img corresponding to the given orientation flag. +func fixOrientation(img image.Image, o orientation) image.Image { + switch o { + case orientationNormal: + case orientationFlipH: + img = FlipH(img) + case orientationFlipV: + img = FlipV(img) + case orientationRotate90: + img = Rotate90(img) + case orientationRotate180: + img = Rotate180(img) + case orientationRotate270: + img = Rotate270(img) + case orientationTranspose: + img = Transpose(img) + case orientationTransverse: + img = Transverse(img) + } + return img +} diff --git a/vendor/github.com/disintegration/imaging/resize.go b/vendor/github.com/disintegration/imaging/resize.go new file mode 100644 index 000000000..706435e3d --- /dev/null +++ b/vendor/github.com/disintegration/imaging/resize.go @@ -0,0 +1,595 @@ +package imaging + +import ( + "image" + "math" +) + +type indexWeight struct { + index int + weight float64 +} + +func precomputeWeights(dstSize, srcSize int, filter ResampleFilter) [][]indexWeight { + du := float64(srcSize) / float64(dstSize) + scale := du + if scale < 1.0 { + scale = 1.0 + } + ru := math.Ceil(scale * filter.Support) + + out := make([][]indexWeight, dstSize) + tmp := make([]indexWeight, 0, dstSize*int(ru+2)*2) + + for v := 0; v < dstSize; v++ { + fu := (float64(v)+0.5)*du - 0.5 + + begin := int(math.Ceil(fu - ru)) + if begin < 0 { + begin = 0 + } + end := int(math.Floor(fu + ru)) + if end > srcSize-1 { + end = srcSize - 1 + } + + var sum float64 + for u := begin; u <= end; u++ { + w := filter.Kernel((float64(u) - fu) / scale) + if w != 0 { + sum += w + tmp = append(tmp, indexWeight{index: u, weight: w}) + } + } + if sum != 0 { + for i := range tmp { + tmp[i].weight /= sum + } + } + + out[v] = tmp + tmp = tmp[len(tmp):] + } + + return out +} + +// Resize resizes the image to the specified width and height using the specified resampling +// filter and returns the transformed image. If one of width or height is 0, the image aspect +// ratio is preserved. +// +// Example: +// +// dstImage := imaging.Resize(srcImage, 800, 600, imaging.Lanczos) +// +func Resize(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA { + dstW, dstH := width, height + if dstW < 0 || dstH < 0 { + return &image.NRGBA{} + } + if dstW == 0 && dstH == 0 { + return &image.NRGBA{} + } + + srcW := img.Bounds().Dx() + srcH := img.Bounds().Dy() + if srcW <= 0 || srcH <= 0 { + return &image.NRGBA{} + } + + // If new width or height is 0 then preserve aspect ratio, minimum 1px. + if dstW == 0 { + tmpW := float64(dstH) * float64(srcW) / float64(srcH) + dstW = int(math.Max(1.0, math.Floor(tmpW+0.5))) + } + if dstH == 0 { + tmpH := float64(dstW) * float64(srcH) / float64(srcW) + dstH = int(math.Max(1.0, math.Floor(tmpH+0.5))) + } + + if filter.Support <= 0 { + // Nearest-neighbor special case. + return resizeNearest(img, dstW, dstH) + } + + if srcW != dstW && srcH != dstH { + return resizeVertical(resizeHorizontal(img, dstW, filter), dstH, filter) + } + if srcW != dstW { + return resizeHorizontal(img, dstW, filter) + } + if srcH != dstH { + return resizeVertical(img, dstH, filter) + } + return Clone(img) +} + +func resizeHorizontal(img image.Image, width int, filter ResampleFilter) *image.NRGBA { + src := newScanner(img) + dst := image.NewNRGBA(image.Rect(0, 0, width, src.h)) + weights := precomputeWeights(width, src.w, filter) + parallel(0, src.h, func(ys <-chan int) { + scanLine := make([]uint8, src.w*4) + for y := range ys { + src.scan(0, y, src.w, y+1, scanLine) + j0 := y * dst.Stride + for x := range weights { + var r, g, b, a float64 + for _, w := range weights[x] { + i := w.index * 4 + s := scanLine[i : i+4 : i+4] + aw := float64(s[3]) * w.weight + r += float64(s[0]) * aw + g += float64(s[1]) * aw + b += float64(s[2]) * aw + a += aw + } + if a != 0 { + aInv := 1 / a + j := j0 + x*4 + d := dst.Pix[j : j+4 : j+4] + d[0] = clamp(r * aInv) + d[1] = clamp(g * aInv) + d[2] = clamp(b * aInv) + d[3] = clamp(a) + } + } + } + }) + return dst +} + +func resizeVertical(img image.Image, height int, filter ResampleFilter) *image.NRGBA { + src := newScanner(img) + dst := image.NewNRGBA(image.Rect(0, 0, src.w, height)) + weights := precomputeWeights(height, src.h, filter) + parallel(0, src.w, func(xs <-chan int) { + scanLine := make([]uint8, src.h*4) + for x := range xs { + src.scan(x, 0, x+1, src.h, scanLine) + for y := range weights { + var r, g, b, a float64 + for _, w := range weights[y] { + i := w.index * 4 + s := scanLine[i : i+4 : i+4] + aw := float64(s[3]) * w.weight + r += float64(s[0]) * aw + g += float64(s[1]) * aw + b += float64(s[2]) * aw + a += aw + } + if a != 0 { + aInv := 1 / a + j := y*dst.Stride + x*4 + d := dst.Pix[j : j+4 : j+4] + d[0] = clamp(r * aInv) + d[1] = clamp(g * aInv) + d[2] = clamp(b * aInv) + d[3] = clamp(a) + } + } + } + }) + return dst +} + +// resizeNearest is a fast nearest-neighbor resize, no filtering. +func resizeNearest(img image.Image, width, height int) *image.NRGBA { + dst := image.NewNRGBA(image.Rect(0, 0, width, height)) + dx := float64(img.Bounds().Dx()) / float64(width) + dy := float64(img.Bounds().Dy()) / float64(height) + + if dx > 1 && dy > 1 { + src := newScanner(img) + parallel(0, height, func(ys <-chan int) { + for y := range ys { + srcY := int((float64(y) + 0.5) * dy) + dstOff := y * dst.Stride + for x := 0; x < width; x++ { + srcX := int((float64(x) + 0.5) * dx) + src.scan(srcX, srcY, srcX+1, srcY+1, dst.Pix[dstOff:dstOff+4]) + dstOff += 4 + } + } + }) + } else { + src := toNRGBA(img) + parallel(0, height, func(ys <-chan int) { + for y := range ys { + srcY := int((float64(y) + 0.5) * dy) + srcOff0 := srcY * src.Stride + dstOff := y * dst.Stride + for x := 0; x < width; x++ { + srcX := int((float64(x) + 0.5) * dx) + srcOff := srcOff0 + srcX*4 + copy(dst.Pix[dstOff:dstOff+4], src.Pix[srcOff:srcOff+4]) + dstOff += 4 + } + } + }) + } + + return dst +} + +// Fit scales down the image using the specified resample filter to fit the specified +// maximum width and height and returns the transformed image. +// +// Example: +// +// dstImage := imaging.Fit(srcImage, 800, 600, imaging.Lanczos) +// +func Fit(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA { + maxW, maxH := width, height + + if maxW <= 0 || maxH <= 0 { + return &image.NRGBA{} + } + + srcBounds := img.Bounds() + srcW := srcBounds.Dx() + srcH := srcBounds.Dy() + + if srcW <= 0 || srcH <= 0 { + return &image.NRGBA{} + } + + if srcW <= maxW && srcH <= maxH { + return Clone(img) + } + + srcAspectRatio := float64(srcW) / float64(srcH) + maxAspectRatio := float64(maxW) / float64(maxH) + + var newW, newH int + if srcAspectRatio > maxAspectRatio { + newW = maxW + newH = int(float64(newW) / srcAspectRatio) + } else { + newH = maxH + newW = int(float64(newH) * srcAspectRatio) + } + + return Resize(img, newW, newH, filter) +} + +// Fill creates an image with the specified dimensions and fills it with the scaled source image. +// To achieve the correct aspect ratio without stretching, the source image will be cropped. +// +// Example: +// +// dstImage := imaging.Fill(srcImage, 800, 600, imaging.Center, imaging.Lanczos) +// +func Fill(img image.Image, width, height int, anchor Anchor, filter ResampleFilter) *image.NRGBA { + dstW, dstH := width, height + + if dstW <= 0 || dstH <= 0 { + return &image.NRGBA{} + } + + srcBounds := img.Bounds() + srcW := srcBounds.Dx() + srcH := srcBounds.Dy() + + if srcW <= 0 || srcH <= 0 { + return &image.NRGBA{} + } + + if srcW == dstW && srcH == dstH { + return Clone(img) + } + + if srcW >= 100 && srcH >= 100 { + return cropAndResize(img, dstW, dstH, anchor, filter) + } + return resizeAndCrop(img, dstW, dstH, anchor, filter) +} + +// cropAndResize crops the image to the smallest possible size that has the required aspect ratio using +// the given anchor point, then scales it to the specified dimensions and returns the transformed image. +// +// This is generally faster than resizing first, but may result in inaccuracies when used on small source images. +func cropAndResize(img image.Image, width, height int, anchor Anchor, filter ResampleFilter) *image.NRGBA { + dstW, dstH := width, height + + srcBounds := img.Bounds() + srcW := srcBounds.Dx() + srcH := srcBounds.Dy() + srcAspectRatio := float64(srcW) / float64(srcH) + dstAspectRatio := float64(dstW) / float64(dstH) + + var tmp *image.NRGBA + if srcAspectRatio < dstAspectRatio { + cropH := float64(srcW) * float64(dstH) / float64(dstW) + tmp = CropAnchor(img, srcW, int(math.Max(1, cropH)+0.5), anchor) + } else { + cropW := float64(srcH) * float64(dstW) / float64(dstH) + tmp = CropAnchor(img, int(math.Max(1, cropW)+0.5), srcH, anchor) + } + + return Resize(tmp, dstW, dstH, filter) +} + +// resizeAndCrop resizes the image to the smallest possible size that will cover the specified dimensions, +// crops the resized image to the specified dimensions using the given anchor point and returns +// the transformed image. +func resizeAndCrop(img image.Image, width, height int, anchor Anchor, filter ResampleFilter) *image.NRGBA { + dstW, dstH := width, height + + srcBounds := img.Bounds() + srcW := srcBounds.Dx() + srcH := srcBounds.Dy() + srcAspectRatio := float64(srcW) / float64(srcH) + dstAspectRatio := float64(dstW) / float64(dstH) + + var tmp *image.NRGBA + if srcAspectRatio < dstAspectRatio { + tmp = Resize(img, dstW, 0, filter) + } else { + tmp = Resize(img, 0, dstH, filter) + } + + return CropAnchor(tmp, dstW, dstH, anchor) +} + +// Thumbnail scales the image up or down using the specified resample filter, crops it +// to the specified width and hight and returns the transformed image. +// +// Example: +// +// dstImage := imaging.Thumbnail(srcImage, 100, 100, imaging.Lanczos) +// +func Thumbnail(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA { + return Fill(img, width, height, Center, filter) +} + +// ResampleFilter specifies a resampling filter to be used for image resizing. +// +// General filter recommendations: +// +// - Lanczos +// A high-quality resampling filter for photographic images yielding sharp results. +// +// - CatmullRom +// A sharp cubic filter that is faster than Lanczos filter while providing similar results. +// +// - MitchellNetravali +// A cubic filter that produces smoother results with less ringing artifacts than CatmullRom. +// +// - Linear +// Bilinear resampling filter, produces a smooth output. Faster than cubic filters. +// +// - Box +// Simple and fast averaging filter appropriate for downscaling. +// When upscaling it's similar to NearestNeighbor. +// +// - NearestNeighbor +// Fastest resampling filter, no antialiasing. +// +type ResampleFilter struct { + Support float64 + Kernel func(float64) float64 +} + +// NearestNeighbor is a nearest-neighbor filter (no anti-aliasing). +var NearestNeighbor ResampleFilter + +// Box filter (averaging pixels). +var Box ResampleFilter + +// Linear filter. +var Linear ResampleFilter + +// Hermite cubic spline filter (BC-spline; B=0; C=0). +var Hermite ResampleFilter + +// MitchellNetravali is Mitchell-Netravali cubic filter (BC-spline; B=1/3; C=1/3). +var MitchellNetravali ResampleFilter + +// CatmullRom is a Catmull-Rom - sharp cubic filter (BC-spline; B=0; C=0.5). +var CatmullRom ResampleFilter + +// BSpline is a smooth cubic filter (BC-spline; B=1; C=0). +var BSpline ResampleFilter + +// Gaussian is a Gaussian blurring filter. +var Gaussian ResampleFilter + +// Bartlett is a Bartlett-windowed sinc filter (3 lobes). +var Bartlett ResampleFilter + +// Lanczos filter (3 lobes). +var Lanczos ResampleFilter + +// Hann is a Hann-windowed sinc filter (3 lobes). +var Hann ResampleFilter + +// Hamming is a Hamming-windowed sinc filter (3 lobes). +var Hamming ResampleFilter + +// Blackman is a Blackman-windowed sinc filter (3 lobes). +var Blackman ResampleFilter + +// Welch is a Welch-windowed sinc filter (parabolic window, 3 lobes). +var Welch ResampleFilter + +// Cosine is a Cosine-windowed sinc filter (3 lobes). +var Cosine ResampleFilter + +func bcspline(x, b, c float64) float64 { + var y float64 + x = math.Abs(x) + if x < 1.0 { + y = ((12-9*b-6*c)*x*x*x + (-18+12*b+6*c)*x*x + (6 - 2*b)) / 6 + } else if x < 2.0 { + y = ((-b-6*c)*x*x*x + (6*b+30*c)*x*x + (-12*b-48*c)*x + (8*b + 24*c)) / 6 + } + return y +} + +func sinc(x float64) float64 { + if x == 0 { + return 1 + } + return math.Sin(math.Pi*x) / (math.Pi * x) +} + +func init() { + NearestNeighbor = ResampleFilter{ + Support: 0.0, // special case - not applying the filter + } + + Box = ResampleFilter{ + Support: 0.5, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x <= 0.5 { + return 1.0 + } + return 0 + }, + } + + Linear = ResampleFilter{ + Support: 1.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 1.0 { + return 1.0 - x + } + return 0 + }, + } + + Hermite = ResampleFilter{ + Support: 1.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 1.0 { + return bcspline(x, 0.0, 0.0) + } + return 0 + }, + } + + MitchellNetravali = ResampleFilter{ + Support: 2.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 2.0 { + return bcspline(x, 1.0/3.0, 1.0/3.0) + } + return 0 + }, + } + + CatmullRom = ResampleFilter{ + Support: 2.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 2.0 { + return bcspline(x, 0.0, 0.5) + } + return 0 + }, + } + + BSpline = ResampleFilter{ + Support: 2.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 2.0 { + return bcspline(x, 1.0, 0.0) + } + return 0 + }, + } + + Gaussian = ResampleFilter{ + Support: 2.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 2.0 { + return math.Exp(-2 * x * x) + } + return 0 + }, + } + + Bartlett = ResampleFilter{ + Support: 3.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 3.0 { + return sinc(x) * (3.0 - x) / 3.0 + } + return 0 + }, + } + + Lanczos = ResampleFilter{ + Support: 3.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 3.0 { + return sinc(x) * sinc(x/3.0) + } + return 0 + }, + } + + Hann = ResampleFilter{ + Support: 3.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 3.0 { + return sinc(x) * (0.5 + 0.5*math.Cos(math.Pi*x/3.0)) + } + return 0 + }, + } + + Hamming = ResampleFilter{ + Support: 3.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 3.0 { + return sinc(x) * (0.54 + 0.46*math.Cos(math.Pi*x/3.0)) + } + return 0 + }, + } + + Blackman = ResampleFilter{ + Support: 3.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 3.0 { + return sinc(x) * (0.42 - 0.5*math.Cos(math.Pi*x/3.0+math.Pi) + 0.08*math.Cos(2.0*math.Pi*x/3.0)) + } + return 0 + }, + } + + Welch = ResampleFilter{ + Support: 3.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 3.0 { + return sinc(x) * (1.0 - (x * x / 9.0)) + } + return 0 + }, + } + + Cosine = ResampleFilter{ + Support: 3.0, + Kernel: func(x float64) float64 { + x = math.Abs(x) + if x < 3.0 { + return sinc(x) * math.Cos((math.Pi/2.0)*(x/3.0)) + } + return 0 + }, + } +} diff --git a/vendor/github.com/disintegration/imaging/scanner.go b/vendor/github.com/disintegration/imaging/scanner.go new file mode 100644 index 000000000..37d92cef8 --- /dev/null +++ b/vendor/github.com/disintegration/imaging/scanner.go @@ -0,0 +1,285 @@ +package imaging + +import ( + "image" + "image/color" +) + +type scanner struct { + image image.Image + w, h int + palette []color.NRGBA +} + +func newScanner(img image.Image) *scanner { + s := &scanner{ + image: img, + w: img.Bounds().Dx(), + h: img.Bounds().Dy(), + } + if img, ok := img.(*image.Paletted); ok { + s.palette = make([]color.NRGBA, len(img.Palette)) + for i := 0; i < len(img.Palette); i++ { + s.palette[i] = color.NRGBAModel.Convert(img.Palette[i]).(color.NRGBA) + } + } + return s +} + +// scan scans the given rectangular region of the image into dst. +func (s *scanner) scan(x1, y1, x2, y2 int, dst []uint8) { + switch img := s.image.(type) { + case *image.NRGBA: + size := (x2 - x1) * 4 + j := 0 + i := y1*img.Stride + x1*4 + if size == 4 { + for y := y1; y < y2; y++ { + d := dst[j : j+4 : j+4] + s := img.Pix[i : i+4 : i+4] + d[0] = s[0] + d[1] = s[1] + d[2] = s[2] + d[3] = s[3] + j += size + i += img.Stride + } + } else { + for y := y1; y < y2; y++ { + copy(dst[j:j+size], img.Pix[i:i+size]) + j += size + i += img.Stride + } + } + + case *image.NRGBA64: + j := 0 + for y := y1; y < y2; y++ { + i := y*img.Stride + x1*8 + for x := x1; x < x2; x++ { + s := img.Pix[i : i+8 : i+8] + d := dst[j : j+4 : j+4] + d[0] = s[0] + d[1] = s[2] + d[2] = s[4] + d[3] = s[6] + j += 4 + i += 8 + } + } + + case *image.RGBA: + j := 0 + for y := y1; y < y2; y++ { + i := y*img.Stride + x1*4 + for x := x1; x < x2; x++ { + d := dst[j : j+4 : j+4] + a := img.Pix[i+3] + switch a { + case 0: + d[0] = 0 + d[1] = 0 + d[2] = 0 + d[3] = a + case 0xff: + s := img.Pix[i : i+4 : i+4] + d[0] = s[0] + d[1] = s[1] + d[2] = s[2] + d[3] = a + default: + s := img.Pix[i : i+4 : i+4] + r16 := uint16(s[0]) + g16 := uint16(s[1]) + b16 := uint16(s[2]) + a16 := uint16(a) + d[0] = uint8(r16 * 0xff / a16) + d[1] = uint8(g16 * 0xff / a16) + d[2] = uint8(b16 * 0xff / a16) + d[3] = a + } + j += 4 + i += 4 + } + } + + case *image.RGBA64: + j := 0 + for y := y1; y < y2; y++ { + i := y*img.Stride + x1*8 + for x := x1; x < x2; x++ { + s := img.Pix[i : i+8 : i+8] + d := dst[j : j+4 : j+4] + a := s[6] + switch a { + case 0: + d[0] = 0 + d[1] = 0 + d[2] = 0 + case 0xff: + d[0] = s[0] + d[1] = s[2] + d[2] = s[4] + default: + r32 := uint32(s[0])<<8 | uint32(s[1]) + g32 := uint32(s[2])<<8 | uint32(s[3]) + b32 := uint32(s[4])<<8 | uint32(s[5]) + a32 := uint32(s[6])<<8 | uint32(s[7]) + d[0] = uint8((r32 * 0xffff / a32) >> 8) + d[1] = uint8((g32 * 0xffff / a32) >> 8) + d[2] = uint8((b32 * 0xffff / a32) >> 8) + } + d[3] = a + j += 4 + i += 8 + } + } + + case *image.Gray: + j := 0 + for y := y1; y < y2; y++ { + i := y*img.Stride + x1 + for x := x1; x < x2; x++ { + c := img.Pix[i] + d := dst[j : j+4 : j+4] + d[0] = c + d[1] = c + d[2] = c + d[3] = 0xff + j += 4 + i++ + } + } + + case *image.Gray16: + j := 0 + for y := y1; y < y2; y++ { + i := y*img.Stride + x1*2 + for x := x1; x < x2; x++ { + c := img.Pix[i] + d := dst[j : j+4 : j+4] + d[0] = c + d[1] = c + d[2] = c + d[3] = 0xff + j += 4 + i += 2 + } + } + + case *image.YCbCr: + j := 0 + x1 += img.Rect.Min.X + x2 += img.Rect.Min.X + y1 += img.Rect.Min.Y + y2 += img.Rect.Min.Y + + hy := img.Rect.Min.Y / 2 + hx := img.Rect.Min.X / 2 + for y := y1; y < y2; y++ { + iy := (y-img.Rect.Min.Y)*img.YStride + (x1 - img.Rect.Min.X) + + var yBase int + switch img.SubsampleRatio { + case image.YCbCrSubsampleRatio444, image.YCbCrSubsampleRatio422: + yBase = (y - img.Rect.Min.Y) * img.CStride + case image.YCbCrSubsampleRatio420, image.YCbCrSubsampleRatio440: + yBase = (y/2 - hy) * img.CStride + } + + for x := x1; x < x2; x++ { + var ic int + switch img.SubsampleRatio { + case image.YCbCrSubsampleRatio444, image.YCbCrSubsampleRatio440: + ic = yBase + (x - img.Rect.Min.X) + case image.YCbCrSubsampleRatio422, image.YCbCrSubsampleRatio420: + ic = yBase + (x/2 - hx) + default: + ic = img.COffset(x, y) + } + + yy1 := int32(img.Y[iy]) * 0x10101 + cb1 := int32(img.Cb[ic]) - 128 + cr1 := int32(img.Cr[ic]) - 128 + + r := yy1 + 91881*cr1 + if uint32(r)&0xff000000 == 0 { + r >>= 16 + } else { + r = ^(r >> 31) + } + + g := yy1 - 22554*cb1 - 46802*cr1 + if uint32(g)&0xff000000 == 0 { + g >>= 16 + } else { + g = ^(g >> 31) + } + + b := yy1 + 116130*cb1 + if uint32(b)&0xff000000 == 0 { + b >>= 16 + } else { + b = ^(b >> 31) + } + + d := dst[j : j+4 : j+4] + d[0] = uint8(r) + d[1] = uint8(g) + d[2] = uint8(b) + d[3] = 0xff + + iy++ + j += 4 + } + } + + case *image.Paletted: + j := 0 + for y := y1; y < y2; y++ { + i := y*img.Stride + x1 + for x := x1; x < x2; x++ { + c := s.palette[img.Pix[i]] + d := dst[j : j+4 : j+4] + d[0] = c.R + d[1] = c.G + d[2] = c.B + d[3] = c.A + j += 4 + i++ + } + } + + default: + j := 0 + b := s.image.Bounds() + x1 += b.Min.X + x2 += b.Min.X + y1 += b.Min.Y + y2 += b.Min.Y + for y := y1; y < y2; y++ { + for x := x1; x < x2; x++ { + r16, g16, b16, a16 := s.image.At(x, y).RGBA() + d := dst[j : j+4 : j+4] + switch a16 { + case 0xffff: + d[0] = uint8(r16 >> 8) + d[1] = uint8(g16 >> 8) + d[2] = uint8(b16 >> 8) + d[3] = 0xff + case 0: + d[0] = 0 + d[1] = 0 + d[2] = 0 + d[3] = 0 + default: + d[0] = uint8(((r16 * 0xffff) / a16) >> 8) + d[1] = uint8(((g16 * 0xffff) / a16) >> 8) + d[2] = uint8(((b16 * 0xffff) / a16) >> 8) + d[3] = uint8(a16 >> 8) + } + j += 4 + } + } + } +} diff --git a/vendor/github.com/disintegration/imaging/tools.go b/vendor/github.com/disintegration/imaging/tools.go new file mode 100644 index 000000000..0ec19a039 --- /dev/null +++ b/vendor/github.com/disintegration/imaging/tools.go @@ -0,0 +1,249 @@ +package imaging + +import ( + "bytes" + "image" + "image/color" + "math" +) + +// New creates a new image with the specified width and height, and fills it with the specified color. +func New(width, height int, fillColor color.Color) *image.NRGBA { + if width <= 0 || height <= 0 { + return &image.NRGBA{} + } + + c := color.NRGBAModel.Convert(fillColor).(color.NRGBA) + if (c == color.NRGBA{0, 0, 0, 0}) { + return image.NewNRGBA(image.Rect(0, 0, width, height)) + } + + return &image.NRGBA{ + Pix: bytes.Repeat([]byte{c.R, c.G, c.B, c.A}, width*height), + Stride: 4 * width, + Rect: image.Rect(0, 0, width, height), + } +} + +// Clone returns a copy of the given image. +func Clone(img image.Image) *image.NRGBA { + src := newScanner(img) + dst := image.NewNRGBA(image.Rect(0, 0, src.w, src.h)) + size := src.w * 4 + parallel(0, src.h, func(ys <-chan int) { + for y := range ys { + i := y * dst.Stride + src.scan(0, y, src.w, y+1, dst.Pix[i:i+size]) + } + }) + return dst +} + +// Anchor is the anchor point for image alignment. +type Anchor int + +// Anchor point positions. +const ( + Center Anchor = iota + TopLeft + Top + TopRight + Left + Right + BottomLeft + Bottom + BottomRight +) + +func anchorPt(b image.Rectangle, w, h int, anchor Anchor) image.Point { + var x, y int + switch anchor { + case TopLeft: + x = b.Min.X + y = b.Min.Y + case Top: + x = b.Min.X + (b.Dx()-w)/2 + y = b.Min.Y + case TopRight: + x = b.Max.X - w + y = b.Min.Y + case Left: + x = b.Min.X + y = b.Min.Y + (b.Dy()-h)/2 + case Right: + x = b.Max.X - w + y = b.Min.Y + (b.Dy()-h)/2 + case BottomLeft: + x = b.Min.X + y = b.Max.Y - h + case Bottom: + x = b.Min.X + (b.Dx()-w)/2 + y = b.Max.Y - h + case BottomRight: + x = b.Max.X - w + y = b.Max.Y - h + default: + x = b.Min.X + (b.Dx()-w)/2 + y = b.Min.Y + (b.Dy()-h)/2 + } + return image.Pt(x, y) +} + +// Crop cuts out a rectangular region with the specified bounds +// from the image and returns the cropped image. +func Crop(img image.Image, rect image.Rectangle) *image.NRGBA { + r := rect.Intersect(img.Bounds()).Sub(img.Bounds().Min) + if r.Empty() { + return &image.NRGBA{} + } + src := newScanner(img) + dst := image.NewNRGBA(image.Rect(0, 0, r.Dx(), r.Dy())) + rowSize := r.Dx() * 4 + parallel(r.Min.Y, r.Max.Y, func(ys <-chan int) { + for y := range ys { + i := (y - r.Min.Y) * dst.Stride + src.scan(r.Min.X, y, r.Max.X, y+1, dst.Pix[i:i+rowSize]) + } + }) + return dst +} + +// CropAnchor cuts out a rectangular region with the specified size +// from the image using the specified anchor point and returns the cropped image. +func CropAnchor(img image.Image, width, height int, anchor Anchor) *image.NRGBA { + srcBounds := img.Bounds() + pt := anchorPt(srcBounds, width, height, anchor) + r := image.Rect(0, 0, width, height).Add(pt) + b := srcBounds.Intersect(r) + return Crop(img, b) +} + +// CropCenter cuts out a rectangular region with the specified size +// from the center of the image and returns the cropped image. +func CropCenter(img image.Image, width, height int) *image.NRGBA { + return CropAnchor(img, width, height, Center) +} + +// Paste pastes the img image to the background image at the specified position and returns the combined image. +func Paste(background, img image.Image, pos image.Point) *image.NRGBA { + dst := Clone(background) + pos = pos.Sub(background.Bounds().Min) + pasteRect := image.Rectangle{Min: pos, Max: pos.Add(img.Bounds().Size())} + interRect := pasteRect.Intersect(dst.Bounds()) + if interRect.Empty() { + return dst + } + src := newScanner(img) + parallel(interRect.Min.Y, interRect.Max.Y, func(ys <-chan int) { + for y := range ys { + x1 := interRect.Min.X - pasteRect.Min.X + x2 := interRect.Max.X - pasteRect.Min.X + y1 := y - pasteRect.Min.Y + y2 := y1 + 1 + i1 := y*dst.Stride + interRect.Min.X*4 + i2 := i1 + interRect.Dx()*4 + src.scan(x1, y1, x2, y2, dst.Pix[i1:i2]) + } + }) + return dst +} + +// PasteCenter pastes the img image to the center of the background image and returns the combined image. +func PasteCenter(background, img image.Image) *image.NRGBA { + bgBounds := background.Bounds() + bgW := bgBounds.Dx() + bgH := bgBounds.Dy() + bgMinX := bgBounds.Min.X + bgMinY := bgBounds.Min.Y + + centerX := bgMinX + bgW/2 + centerY := bgMinY + bgH/2 + + x0 := centerX - img.Bounds().Dx()/2 + y0 := centerY - img.Bounds().Dy()/2 + + return Paste(background, img, image.Pt(x0, y0)) +} + +// Overlay draws the img image over the background image at given position +// and returns the combined image. Opacity parameter is the opacity of the img +// image layer, used to compose the images, it must be from 0.0 to 1.0. +// +// Examples: +// +// // Draw spriteImage over backgroundImage at the given position (x=50, y=50). +// dstImage := imaging.Overlay(backgroundImage, spriteImage, image.Pt(50, 50), 1.0) +// +// // Blend two opaque images of the same size. +// dstImage := imaging.Overlay(imageOne, imageTwo, image.Pt(0, 0), 0.5) +// +func Overlay(background, img image.Image, pos image.Point, opacity float64) *image.NRGBA { + opacity = math.Min(math.Max(opacity, 0.0), 1.0) // Ensure 0.0 <= opacity <= 1.0. + dst := Clone(background) + pos = pos.Sub(background.Bounds().Min) + pasteRect := image.Rectangle{Min: pos, Max: pos.Add(img.Bounds().Size())} + interRect := pasteRect.Intersect(dst.Bounds()) + if interRect.Empty() { + return dst + } + src := newScanner(img) + parallel(interRect.Min.Y, interRect.Max.Y, func(ys <-chan int) { + scanLine := make([]uint8, interRect.Dx()*4) + for y := range ys { + x1 := interRect.Min.X - pasteRect.Min.X + x2 := interRect.Max.X - pasteRect.Min.X + y1 := y - pasteRect.Min.Y + y2 := y1 + 1 + src.scan(x1, y1, x2, y2, scanLine) + i := y*dst.Stride + interRect.Min.X*4 + j := 0 + for x := interRect.Min.X; x < interRect.Max.X; x++ { + d := dst.Pix[i : i+4 : i+4] + r1 := float64(d[0]) + g1 := float64(d[1]) + b1 := float64(d[2]) + a1 := float64(d[3]) + + s := scanLine[j : j+4 : j+4] + r2 := float64(s[0]) + g2 := float64(s[1]) + b2 := float64(s[2]) + a2 := float64(s[3]) + + coef2 := opacity * a2 / 255 + coef1 := (1 - coef2) * a1 / 255 + coefSum := coef1 + coef2 + coef1 /= coefSum + coef2 /= coefSum + + d[0] = uint8(r1*coef1 + r2*coef2) + d[1] = uint8(g1*coef1 + g2*coef2) + d[2] = uint8(b1*coef1 + b2*coef2) + d[3] = uint8(math.Min(a1+a2*opacity*(255-a1)/255, 255)) + + i += 4 + j += 4 + } + } + }) + return dst +} + +// OverlayCenter overlays the img image to the center of the background image and +// returns the combined image. Opacity parameter is the opacity of the img +// image layer, used to compose the images, it must be from 0.0 to 1.0. +func OverlayCenter(background, img image.Image, opacity float64) *image.NRGBA { + bgBounds := background.Bounds() + bgW := bgBounds.Dx() + bgH := bgBounds.Dy() + bgMinX := bgBounds.Min.X + bgMinY := bgBounds.Min.Y + + centerX := bgMinX + bgW/2 + centerY := bgMinY + bgH/2 + + x0 := centerX - img.Bounds().Dx()/2 + y0 := centerY - img.Bounds().Dy()/2 + + return Overlay(background, img, image.Point{x0, y0}, opacity) +} diff --git a/vendor/github.com/disintegration/imaging/transform.go b/vendor/github.com/disintegration/imaging/transform.go new file mode 100644 index 000000000..fe4a92f9d --- /dev/null +++ b/vendor/github.com/disintegration/imaging/transform.go @@ -0,0 +1,268 @@ +package imaging + +import ( + "image" + "image/color" + "math" +) + +// FlipH flips the image horizontally (from left to right) and returns the transformed image. +func FlipH(img image.Image) *image.NRGBA { + src := newScanner(img) + dstW := src.w + dstH := src.h + rowSize := dstW * 4 + dst := image.NewNRGBA(image.Rect(0, 0, dstW, dstH)) + parallel(0, dstH, func(ys <-chan int) { + for dstY := range ys { + i := dstY * dst.Stride + srcY := dstY + src.scan(0, srcY, src.w, srcY+1, dst.Pix[i:i+rowSize]) + reverse(dst.Pix[i : i+rowSize]) + } + }) + return dst +} + +// FlipV flips the image vertically (from top to bottom) and returns the transformed image. +func FlipV(img image.Image) *image.NRGBA { + src := newScanner(img) + dstW := src.w + dstH := src.h + rowSize := dstW * 4 + dst := image.NewNRGBA(image.Rect(0, 0, dstW, dstH)) + parallel(0, dstH, func(ys <-chan int) { + for dstY := range ys { + i := dstY * dst.Stride + srcY := dstH - dstY - 1 + src.scan(0, srcY, src.w, srcY+1, dst.Pix[i:i+rowSize]) + } + }) + return dst +} + +// Transpose flips the image horizontally and rotates 90 degrees counter-clockwise. +func Transpose(img image.Image) *image.NRGBA { + src := newScanner(img) + dstW := src.h + dstH := src.w + rowSize := dstW * 4 + dst := image.NewNRGBA(image.Rect(0, 0, dstW, dstH)) + parallel(0, dstH, func(ys <-chan int) { + for dstY := range ys { + i := dstY * dst.Stride + srcX := dstY + src.scan(srcX, 0, srcX+1, src.h, dst.Pix[i:i+rowSize]) + } + }) + return dst +} + +// Transverse flips the image vertically and rotates 90 degrees counter-clockwise. +func Transverse(img image.Image) *image.NRGBA { + src := newScanner(img) + dstW := src.h + dstH := src.w + rowSize := dstW * 4 + dst := image.NewNRGBA(image.Rect(0, 0, dstW, dstH)) + parallel(0, dstH, func(ys <-chan int) { + for dstY := range ys { + i := dstY * dst.Stride + srcX := dstH - dstY - 1 + src.scan(srcX, 0, srcX+1, src.h, dst.Pix[i:i+rowSize]) + reverse(dst.Pix[i : i+rowSize]) + } + }) + return dst +} + +// Rotate90 rotates the image 90 degrees counter-clockwise and returns the transformed image. +func Rotate90(img image.Image) *image.NRGBA { + src := newScanner(img) + dstW := src.h + dstH := src.w + rowSize := dstW * 4 + dst := image.NewNRGBA(image.Rect(0, 0, dstW, dstH)) + parallel(0, dstH, func(ys <-chan int) { + for dstY := range ys { + i := dstY * dst.Stride + srcX := dstH - dstY - 1 + src.scan(srcX, 0, srcX+1, src.h, dst.Pix[i:i+rowSize]) + } + }) + return dst +} + +// Rotate180 rotates the image 180 degrees counter-clockwise and returns the transformed image. +func Rotate180(img image.Image) *image.NRGBA { + src := newScanner(img) + dstW := src.w + dstH := src.h + rowSize := dstW * 4 + dst := image.NewNRGBA(image.Rect(0, 0, dstW, dstH)) + parallel(0, dstH, func(ys <-chan int) { + for dstY := range ys { + i := dstY * dst.Stride + srcY := dstH - dstY - 1 + src.scan(0, srcY, src.w, srcY+1, dst.Pix[i:i+rowSize]) + reverse(dst.Pix[i : i+rowSize]) + } + }) + return dst +} + +// Rotate270 rotates the image 270 degrees counter-clockwise and returns the transformed image. +func Rotate270(img image.Image) *image.NRGBA { + src := newScanner(img) + dstW := src.h + dstH := src.w + rowSize := dstW * 4 + dst := image.NewNRGBA(image.Rect(0, 0, dstW, dstH)) + parallel(0, dstH, func(ys <-chan int) { + for dstY := range ys { + i := dstY * dst.Stride + srcX := dstY + src.scan(srcX, 0, srcX+1, src.h, dst.Pix[i:i+rowSize]) + reverse(dst.Pix[i : i+rowSize]) + } + }) + return dst +} + +// Rotate rotates an image by the given angle counter-clockwise . +// The angle parameter is the rotation angle in degrees. +// The bgColor parameter specifies the color of the uncovered zone after the rotation. +func Rotate(img image.Image, angle float64, bgColor color.Color) *image.NRGBA { + angle = angle - math.Floor(angle/360)*360 + + switch angle { + case 0: + return Clone(img) + case 90: + return Rotate90(img) + case 180: + return Rotate180(img) + case 270: + return Rotate270(img) + } + + src := toNRGBA(img) + srcW := src.Bounds().Max.X + srcH := src.Bounds().Max.Y + dstW, dstH := rotatedSize(srcW, srcH, angle) + dst := image.NewNRGBA(image.Rect(0, 0, dstW, dstH)) + + if dstW <= 0 || dstH <= 0 { + return dst + } + + srcXOff := float64(srcW)/2 - 0.5 + srcYOff := float64(srcH)/2 - 0.5 + dstXOff := float64(dstW)/2 - 0.5 + dstYOff := float64(dstH)/2 - 0.5 + + bgColorNRGBA := color.NRGBAModel.Convert(bgColor).(color.NRGBA) + sin, cos := math.Sincos(math.Pi * angle / 180) + + parallel(0, dstH, func(ys <-chan int) { + for dstY := range ys { + for dstX := 0; dstX < dstW; dstX++ { + xf, yf := rotatePoint(float64(dstX)-dstXOff, float64(dstY)-dstYOff, sin, cos) + xf, yf = xf+srcXOff, yf+srcYOff + interpolatePoint(dst, dstX, dstY, src, xf, yf, bgColorNRGBA) + } + } + }) + + return dst +} + +func rotatePoint(x, y, sin, cos float64) (float64, float64) { + return x*cos - y*sin, x*sin + y*cos +} + +func rotatedSize(w, h int, angle float64) (int, int) { + if w <= 0 || h <= 0 { + return 0, 0 + } + + sin, cos := math.Sincos(math.Pi * angle / 180) + x1, y1 := rotatePoint(float64(w-1), 0, sin, cos) + x2, y2 := rotatePoint(float64(w-1), float64(h-1), sin, cos) + x3, y3 := rotatePoint(0, float64(h-1), sin, cos) + + minx := math.Min(x1, math.Min(x2, math.Min(x3, 0))) + maxx := math.Max(x1, math.Max(x2, math.Max(x3, 0))) + miny := math.Min(y1, math.Min(y2, math.Min(y3, 0))) + maxy := math.Max(y1, math.Max(y2, math.Max(y3, 0))) + + neww := maxx - minx + 1 + if neww-math.Floor(neww) > 0.1 { + neww++ + } + newh := maxy - miny + 1 + if newh-math.Floor(newh) > 0.1 { + newh++ + } + + return int(neww), int(newh) +} + +func interpolatePoint(dst *image.NRGBA, dstX, dstY int, src *image.NRGBA, xf, yf float64, bgColor color.NRGBA) { + j := dstY*dst.Stride + dstX*4 + d := dst.Pix[j : j+4 : j+4] + + x0 := int(math.Floor(xf)) + y0 := int(math.Floor(yf)) + bounds := src.Bounds() + if !image.Pt(x0, y0).In(image.Rect(bounds.Min.X-1, bounds.Min.Y-1, bounds.Max.X, bounds.Max.Y)) { + d[0] = bgColor.R + d[1] = bgColor.G + d[2] = bgColor.B + d[3] = bgColor.A + return + } + + xq := xf - float64(x0) + yq := yf - float64(y0) + points := [4]image.Point{ + {x0, y0}, + {x0 + 1, y0}, + {x0, y0 + 1}, + {x0 + 1, y0 + 1}, + } + weights := [4]float64{ + (1 - xq) * (1 - yq), + xq * (1 - yq), + (1 - xq) * yq, + xq * yq, + } + + var r, g, b, a float64 + for i := 0; i < 4; i++ { + p := points[i] + w := weights[i] + if p.In(bounds) { + i := p.Y*src.Stride + p.X*4 + s := src.Pix[i : i+4 : i+4] + wa := float64(s[3]) * w + r += float64(s[0]) * wa + g += float64(s[1]) * wa + b += float64(s[2]) * wa + a += wa + } else { + wa := float64(bgColor.A) * w + r += float64(bgColor.R) * wa + g += float64(bgColor.G) * wa + b += float64(bgColor.B) * wa + a += wa + } + } + if a != 0 { + aInv := 1 / a + d[0] = clamp(r * aInv) + d[1] = clamp(g * aInv) + d[2] = clamp(b * aInv) + d[3] = clamp(a) + } +} diff --git a/vendor/github.com/disintegration/imaging/utils.go b/vendor/github.com/disintegration/imaging/utils.go new file mode 100644 index 000000000..6c7af1a51 --- /dev/null +++ b/vendor/github.com/disintegration/imaging/utils.go @@ -0,0 +1,167 @@ +package imaging + +import ( + "image" + "math" + "runtime" + "sync" +) + +// parallel processes the data in separate goroutines. +func parallel(start, stop int, fn func(<-chan int)) { + count := stop - start + if count < 1 { + return + } + + procs := runtime.GOMAXPROCS(0) + if procs > count { + procs = count + } + + c := make(chan int, count) + for i := start; i < stop; i++ { + c <- i + } + close(c) + + var wg sync.WaitGroup + for i := 0; i < procs; i++ { + wg.Add(1) + go func() { + defer wg.Done() + fn(c) + }() + } + wg.Wait() +} + +// absint returns the absolute value of i. +func absint(i int) int { + if i < 0 { + return -i + } + return i +} + +// clamp rounds and clamps float64 value to fit into uint8. +func clamp(x float64) uint8 { + v := int64(x + 0.5) + if v > 255 { + return 255 + } + if v > 0 { + return uint8(v) + } + return 0 +} + +func reverse(pix []uint8) { + if len(pix) <= 4 { + return + } + i := 0 + j := len(pix) - 4 + for i < j { + pi := pix[i : i+4 : i+4] + pj := pix[j : j+4 : j+4] + pi[0], pj[0] = pj[0], pi[0] + pi[1], pj[1] = pj[1], pi[1] + pi[2], pj[2] = pj[2], pi[2] + pi[3], pj[3] = pj[3], pi[3] + i += 4 + j -= 4 + } +} + +func toNRGBA(img image.Image) *image.NRGBA { + if img, ok := img.(*image.NRGBA); ok { + return &image.NRGBA{ + Pix: img.Pix, + Stride: img.Stride, + Rect: img.Rect.Sub(img.Rect.Min), + } + } + return Clone(img) +} + +// rgbToHSL converts a color from RGB to HSL. +func rgbToHSL(r, g, b uint8) (float64, float64, float64) { + rr := float64(r) / 255 + gg := float64(g) / 255 + bb := float64(b) / 255 + + max := math.Max(rr, math.Max(gg, bb)) + min := math.Min(rr, math.Min(gg, bb)) + + l := (max + min) / 2 + + if max == min { + return 0, 0, l + } + + var h, s float64 + d := max - min + if l > 0.5 { + s = d / (2 - max - min) + } else { + s = d / (max + min) + } + + switch max { + case rr: + h = (gg - bb) / d + if g < b { + h += 6 + } + case gg: + h = (bb-rr)/d + 2 + case bb: + h = (rr-gg)/d + 4 + } + h /= 6 + + return h, s, l +} + +// hslToRGB converts a color from HSL to RGB. +func hslToRGB(h, s, l float64) (uint8, uint8, uint8) { + var r, g, b float64 + if s == 0 { + v := clamp(l * 255) + return v, v, v + } + + var q float64 + if l < 0.5 { + q = l * (1 + s) + } else { + q = l + s - l*s + } + p := 2*l - q + + r = hueToRGB(p, q, h+1/3.0) + g = hueToRGB(p, q, h) + b = hueToRGB(p, q, h-1/3.0) + + return clamp(r * 255), clamp(g * 255), clamp(b * 255) +} + +func hueToRGB(p, q, t float64) float64 { + if t < 0 { + t++ + } + if t > 1 { + t-- + } + if t < 1/6.0 { + return p + (q-p)*6*t + } + if t < 1/2.0 { + return q + } + if t < 2/3.0 { + return p + (q-p)*(2/3.0-t)*6 + } + return p +} diff --git a/vendor/github.com/dlclark/regexp2/.gitignore b/vendor/github.com/dlclark/regexp2/.gitignore new file mode 100644 index 000000000..38a7addcf --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/.gitignore @@ -0,0 +1,25 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof +*.out \ No newline at end of file diff --git a/vendor/github.com/dlclark/regexp2/.travis.yml b/vendor/github.com/dlclark/regexp2/.travis.yml new file mode 100644 index 000000000..a24aededa --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/.travis.yml @@ -0,0 +1,5 @@ +language: go + +go: + - 1.5 + - tip \ No newline at end of file diff --git a/vendor/github.com/dlclark/regexp2/ATTRIB b/vendor/github.com/dlclark/regexp2/ATTRIB new file mode 100644 index 000000000..cdf4560b9 --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/ATTRIB @@ -0,0 +1,133 @@ +============ +These pieces of code were ported from dotnet/corefx: + +syntax/charclass.go (from RegexCharClass.cs): ported to use the built-in Go unicode classes. Canonicalize is + a direct port, but most of the other code required large changes because the C# implementation + used a string to represent the CharSet data structure and I cleaned that up in my implementation. + +syntax/code.go (from RegexCode.cs): ported literally with various cleanups and layout to make it more Go-ish. + +syntax/escape.go (from RegexParser.cs): ported Escape method and added some optimizations. Unescape is inspired by + the C# implementation but couldn't be directly ported because of the lack of do-while syntax in Go. + +syntax/parser.go (from RegexpParser.cs and RegexOptions.cs): ported parser struct and associated methods as + literally as possible. Several language differences required changes. E.g. lack pre/post-fix increments as + expressions, lack of do-while loops, lack of overloads, etc. + +syntax/prefix.go (from RegexFCD.cs and RegexBoyerMoore.cs): ported as literally as possible and added support + for unicode chars that are longer than the 16-bit char in C# for the 32-bit rune in Go. + +syntax/replacerdata.go (from RegexReplacement.cs): conceptually ported and re-organized to handle differences + in charclass implementation, and fix odd code layout between RegexParser.cs, Regex.cs, and RegexReplacement.cs. + +syntax/tree.go (from RegexTree.cs and RegexNode.cs): ported literally as possible. + +syntax/writer.go (from RegexWriter.cs): ported literally with minor changes to make it more Go-ish. + +match.go (from RegexMatch.cs): ported, simplified, and changed to handle Go's lack of inheritence. + +regexp.go (from Regex.cs and RegexOptions.cs): conceptually serves the same "starting point", but is simplified + and changed to handle differences in C# strings and Go strings/runes. + +replace.go (from RegexReplacement.cs): ported closely and then cleaned up to combine the MatchEvaluator and + simple string replace implementations. + +runner.go (from RegexRunner.cs): ported literally as possible. + +regexp_test.go (from CaptureTests.cs and GroupNamesAndNumbers.cs): conceptually ported, but the code was + manually structured like Go tests. + +replace_test.go (from RegexReplaceStringTest0.cs): conceptually ported + +rtl_test.go (from RightToLeft.cs): conceptually ported +--- +dotnet/corefx was released under this license: + +The MIT License (MIT) + +Copyright (c) Microsoft Corporation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +============ +These pieces of code are copied from the Go framework: + +- The overall directory structure of regexp2 was inspired by the Go runtime regexp package. +- The optimization in the escape method of syntax/escape.go is from the Go runtime QuoteMeta() func in regexp/regexp.go +- The method signatures in regexp.go are designed to match the Go framework regexp methods closely +- func regexp2.MustCompile and func quote are almost identifical to the regexp package versions +- BenchmarkMatch* and TestProgramTooLong* funcs in regexp_performance_test.go were copied from the framework + regexp/exec_test.go +--- +The Go framework was released under this license: + +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +============ +Some test data were gathered from the Mono project. + +regexp_mono_test.go: ported from https://github.com/mono/mono/blob/master/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs +--- +Mono tests released under this license: + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/vendor/github.com/dlclark/regexp2/LICENSE b/vendor/github.com/dlclark/regexp2/LICENSE new file mode 100644 index 000000000..fe83dfdc9 --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Doug Clark + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/dlclark/regexp2/README.md b/vendor/github.com/dlclark/regexp2/README.md new file mode 100644 index 000000000..f4dc33dab --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/README.md @@ -0,0 +1,67 @@ +# regexp2 - full featured regular expressions for Go +Regexp2 is a feature-rich RegExp engine for Go. It doesn't have constant time guarantees like the built-in `regexp` package, but it allows backtracking and is compatible with Perl5 and .NET. You'll likely be better off with the RE2 engine from the `regexp` package and should only use this if you need to write very complex patterns or require compatibility with .NET. + +## Basis of the engine +The engine is ported from the .NET framework's System.Text.RegularExpressions.Regex engine. That engine was open sourced in 2015 under the MIT license. There are some fundamental differences between .NET strings and Go strings that required a bit of borrowing from the Go framework regex engine as well. I cleaned up a couple of the dirtier bits during the port (regexcharclass.cs was terrible), but the parse tree, code emmitted, and therefore patterns matched should be identical. + +## Installing +This is a go-gettable library, so install is easy: + + go get github.com/dlclark/regexp2/... + +## Usage +Usage is similar to the Go `regexp` package. Just like in `regexp`, you start by converting a regex into a state machine via the `Compile` or `MustCompile` methods. They ultimately do the same thing, but `MustCompile` will panic if the regex is invalid. You can then use the provided `Regexp` struct to find matches repeatedly. A `Regexp` struct is safe to use across goroutines. + +```go +re := regexp2.MustCompile(`Your pattern`, 0) +if isMatch, _ := re.MatchString(`Something to match`); isMatch { + //do something +} +``` + +The only error that the `*Match*` methods *should* return is a Timeout if you set the `re.MatchTimeout` field. Any other error is a bug in the `regexp2` package. If you need more details about capture groups in a match then use the `FindStringMatch` method, like so: + +```go +if m, _ := re.FindStringMatch(`Something to match`); m != nil { + // the whole match is always group 0 + fmt.Printf("Group 0: %v\n", m.String()) + + // you can get all the groups too + gps := m.Groups() + + // a group can be captured multiple times, so each cap is separately addressable + fmt.Printf("Group 1, first capture", gps[1].Captures[0].String()) + fmt.Printf("Group 1, second capture", gps[1].Captures[1].String()) +} +``` + +Group 0 is embedded in the Match. Group 0 is an automatically-assigned group that encompasses the whole pattern. This means that `m.String()` is the same as `m.Group.String()` and `m.Groups()[0].String()` + +The __last__ capture is embedded in each group, so `g.String()` will return the same thing as `g.Capture.String()` and `g.Captures[len(g.Captures)-1].String()`. + +## Compare `regexp` and `regexp2` +| Category | regexp | regexp2 | +| --- | --- | --- | +| Catastrophic backtracking possible | no, constant execution time guarantees | yes, if your pattern is at risk you can use the `re.MatchTimeout` field | +| Python-style capture groups `(Pre)` | yes | no | +| .NET-style capture groups `(re)` or `('name're)` | no | yes | +| comments `(?#comment)` | no | yes | +| branch numbering reset `(?\|a\|b)` | no | no | +| possessive match `(?>re)` | no | yes | +| positive lookahead `(?=re)` | no | yes | +| negative lookahead `(?!re)` | no | yes | +| positive lookbehind `(?<=re)` | no | yes | +| negative lookbehind `(? 0 && m.matches[cap][m.matchcount[cap]*2-1] != (-3+1) +} + +// matchIndex returns the index of the last specified matched group by capnum +func (m *Match) matchIndex(cap int) int { + i := m.matches[cap][m.matchcount[cap]*2-2] + if i >= 0 { + return i + } + + return m.matches[cap][-3-i] +} + +// matchLength returns the length of the last specified matched group by capnum +func (m *Match) matchLength(cap int) int { + i := m.matches[cap][m.matchcount[cap]*2-1] + if i >= 0 { + return i + } + + return m.matches[cap][-3-i] +} + +// Nonpublic builder: add a capture to the group specified by "c" +func (m *Match) addMatch(c, start, l int) { + + if m.matches[c] == nil { + m.matches[c] = make([]int, 2) + } + + capcount := m.matchcount[c] + + if capcount*2+2 > len(m.matches[c]) { + oldmatches := m.matches[c] + newmatches := make([]int, capcount*8) + copy(newmatches, oldmatches[:capcount*2]) + m.matches[c] = newmatches + } + + m.matches[c][capcount*2] = start + m.matches[c][capcount*2+1] = l + m.matchcount[c] = capcount + 1 + //log.Printf("addMatch: c=%v, i=%v, l=%v ... matches: %v", c, start, l, m.matches) +} + +// Nonpublic builder: Add a capture to balance the specified group. This is used by the +// balanced match construct. (?...) +// +// If there were no such thing as backtracking, this would be as simple as calling RemoveMatch(c). +// However, since we have backtracking, we need to keep track of everything. +func (m *Match) balanceMatch(c int) { + m.balancing = true + + // we'll look at the last capture first + capcount := m.matchcount[c] + target := capcount*2 - 2 + + // first see if it is negative, and therefore is a reference to the next available + // capture group for balancing. If it is, we'll reset target to point to that capture. + if m.matches[c][target] < 0 { + target = -3 - m.matches[c][target] + } + + // move back to the previous capture + target -= 2 + + // if the previous capture is a reference, just copy that reference to the end. Otherwise, point to it. + if target >= 0 && m.matches[c][target] < 0 { + m.addMatch(c, m.matches[c][target], m.matches[c][target+1]) + } else { + m.addMatch(c, -3-target, -4-target /* == -3 - (target + 1) */) + } +} + +// Nonpublic builder: removes a group match by capnum +func (m *Match) removeMatch(c int) { + m.matchcount[c]-- +} + +// GroupCount returns the number of groups this match has matched +func (m *Match) GroupCount() int { + return len(m.matchcount) +} + +// GroupByName returns a group based on the name of the group, or nil if the group name does not exist +func (m *Match) GroupByName(name string) *Group { + num := m.regex.GroupNumberFromName(name) + if num < 0 { + return nil + } + return m.GroupByNumber(num) +} + +// GroupByNumber returns a group based on the number of the group, or nil if the group number does not exist +func (m *Match) GroupByNumber(num int) *Group { + // check our sparse map + if m.sparseCaps != nil { + if newNum, ok := m.sparseCaps[num]; ok { + num = newNum + } + } + if num >= len(m.matchcount) || num < 0 { + return nil + } + + if num == 0 { + return &m.Group + } + + m.populateOtherGroups() + + return &m.otherGroups[num-1] +} + +// Groups returns all the capture groups, starting with group 0 (the full match) +func (m *Match) Groups() []Group { + m.populateOtherGroups() + g := make([]Group, len(m.otherGroups)+1) + g[0] = m.Group + copy(g[1:], m.otherGroups) + return g +} + +func (m *Match) populateOtherGroups() { + // Construct all the Group objects first time called + if m.otherGroups == nil { + m.otherGroups = make([]Group, len(m.matchcount)-1) + for i := 0; i < len(m.otherGroups); i++ { + m.otherGroups[i] = newGroup(m.regex.GroupNameFromNumber(i+1), m.text, m.matches[i+1], m.matchcount[i+1]) + } + } +} + +func (m *Match) groupValueAppendToBuf(groupnum int, buf *bytes.Buffer) { + c := m.matchcount[groupnum] + if c == 0 { + return + } + + matches := m.matches[groupnum] + + index := matches[(c-1)*2] + last := index + matches[(c*2)-1] + + for ; index < last; index++ { + buf.WriteRune(m.text[index]) + } +} + +func newGroup(name string, text []rune, caps []int, capcount int) Group { + g := Group{} + g.text = text + if capcount > 0 { + g.Index = caps[(capcount-1)*2] + g.Length = caps[(capcount*2)-1] + } + g.Name = name + g.Captures = make([]Capture, capcount) + for i := 0; i < capcount; i++ { + g.Captures[i] = Capture{ + text: text, + Index: caps[i*2], + Length: caps[i*2+1], + } + } + //log.Printf("newGroup! capcount %v, %+v", capcount, g) + + return g +} + +func (m *Match) dump() string { + buf := &bytes.Buffer{} + buf.WriteRune('\n') + if len(m.sparseCaps) > 0 { + for k, v := range m.sparseCaps { + fmt.Fprintf(buf, "Slot %v -> %v\n", k, v) + } + } + + for i, g := range m.Groups() { + fmt.Fprintf(buf, "Group %v (%v), %v caps:\n", i, g.Name, len(g.Captures)) + + for _, c := range g.Captures { + fmt.Fprintf(buf, " (%v, %v) %v\n", c.Index, c.Length, c.String()) + } + } + /* + for i := 0; i < len(m.matchcount); i++ { + fmt.Fprintf(buf, "\nGroup %v (%v):\n", i, m.regex.GroupNameFromNumber(i)) + + for j := 0; j < m.matchcount[i]; j++ { + text := "" + + if m.matches[i][j*2] >= 0 { + start := m.matches[i][j*2] + text = m.text[start : start+m.matches[i][j*2+1]] + } + + fmt.Fprintf(buf, " (%v, %v) %v\n", m.matches[i][j*2], m.matches[i][j*2+1], text) + } + } + */ + return buf.String() +} diff --git a/vendor/github.com/dlclark/regexp2/regexp.go b/vendor/github.com/dlclark/regexp2/regexp.go new file mode 100644 index 000000000..b25fe690f --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/regexp.go @@ -0,0 +1,357 @@ +/* +Package regexp2 is a regexp package that has an interface similar to Go's framework regexp engine but uses a +more feature full regex engine behind the scenes. + +It doesn't have constant time guarantees, but it allows backtracking and is compatible with Perl5 and .NET. +You'll likely be better off with the RE2 engine from the regexp package and should only use this if you +need to write very complex patterns or require compatibility with .NET. +*/ +package regexp2 + +import ( + "errors" + "math" + "strconv" + "sync" + "time" + + "github.com/dlclark/regexp2/syntax" +) + +// Default timeout used when running regexp matches -- "forever" +var DefaultMatchTimeout = time.Duration(math.MaxInt64) + +// Regexp is the representation of a compiled regular expression. +// A Regexp is safe for concurrent use by multiple goroutines. +type Regexp struct { + //timeout when trying to find matches + MatchTimeout time.Duration + + // read-only after Compile + pattern string // as passed to Compile + options RegexOptions // options + + caps map[int]int // capnum->index + capnames map[string]int //capture group name -> index + capslist []string //sorted list of capture group names + capsize int // size of the capture array + + code *syntax.Code // compiled program + + // cache of machines for running regexp + muRun sync.Mutex + runner []*runner +} + +// Compile parses a regular expression and returns, if successful, +// a Regexp object that can be used to match against text. +func Compile(expr string, opt RegexOptions) (*Regexp, error) { + // parse it + tree, err := syntax.Parse(expr, syntax.RegexOptions(opt)) + if err != nil { + return nil, err + } + + // translate it to code + code, err := syntax.Write(tree) + if err != nil { + return nil, err + } + + // return it + return &Regexp{ + pattern: expr, + options: opt, + caps: code.Caps, + capnames: tree.Capnames, + capslist: tree.Caplist, + capsize: code.Capsize, + code: code, + MatchTimeout: DefaultMatchTimeout, + }, nil +} + +// MustCompile is like Compile but panics if the expression cannot be parsed. +// It simplifies safe initialization of global variables holding compiled regular +// expressions. +func MustCompile(str string, opt RegexOptions) *Regexp { + regexp, error := Compile(str, opt) + if error != nil { + panic(`regexp2: Compile(` + quote(str) + `): ` + error.Error()) + } + return regexp +} + +// Escape adds backslashes to any special characters in the input string +func Escape(input string) string { + return syntax.Escape(input) +} + +// Unescape removes any backslashes from previously-escaped special characters in the input string +func Unescape(input string) (string, error) { + return syntax.Unescape(input) +} + +// String returns the source text used to compile the regular expression. +func (re *Regexp) String() string { + return re.pattern +} + +func quote(s string) string { + if strconv.CanBackquote(s) { + return "`" + s + "`" + } + return strconv.Quote(s) +} + +// RegexOptions impact the runtime and parsing behavior +// for each specific regex. They are setable in code as well +// as in the regex pattern itself. +type RegexOptions int32 + +const ( + None RegexOptions = 0x0 + IgnoreCase = 0x0001 // "i" + Multiline = 0x0002 // "m" + ExplicitCapture = 0x0004 // "n" + Compiled = 0x0008 // "c" + Singleline = 0x0010 // "s" + IgnorePatternWhitespace = 0x0020 // "x" + RightToLeft = 0x0040 // "r" + Debug = 0x0080 // "d" + ECMAScript = 0x0100 // "e" +) + +func (re *Regexp) RightToLeft() bool { + return re.options&RightToLeft != 0 +} + +func (re *Regexp) Debug() bool { + return re.options&Debug != 0 +} + +// Replace searches the input string and replaces each match found with the replacement text. +// Count will limit the number of matches attempted and startAt will allow +// us to skip past possible matches at the start of the input (left or right depending on RightToLeft option). +// Set startAt and count to -1 to go through the whole string +func (re *Regexp) Replace(input, replacement string, startAt, count int) (string, error) { + data, err := syntax.NewReplacerData(replacement, re.caps, re.capsize, re.capnames, syntax.RegexOptions(re.options)) + if err != nil { + return "", err + } + //TODO: cache ReplacerData + + return replace(re, data, nil, input, startAt, count) +} + +// ReplaceFunc searches the input string and replaces each match found using the string from the evaluator +// Count will limit the number of matches attempted and startAt will allow +// us to skip past possible matches at the start of the input (left or right depending on RightToLeft option). +// Set startAt and count to -1 to go through the whole string. +func (re *Regexp) ReplaceFunc(input string, evaluator MatchEvaluator, startAt, count int) (string, error) { + return replace(re, nil, evaluator, input, startAt, count) +} + +// FindStringMatch searches the input string for a Regexp match +func (re *Regexp) FindStringMatch(s string) (*Match, error) { + // convert string to runes + return re.run(false, -1, getRunes(s)) +} + +// FindRunesMatch searches the input rune slice for a Regexp match +func (re *Regexp) FindRunesMatch(r []rune) (*Match, error) { + return re.run(false, -1, r) +} + +// FindStringMatchStartingAt searches the input string for a Regexp match starting at the startAt index +func (re *Regexp) FindStringMatchStartingAt(s string, startAt int) (*Match, error) { + if startAt > len(s) { + return nil, errors.New("startAt must be less than the length of the input string") + } + r, startAt := re.getRunesAndStart(s, startAt) + if startAt == -1 { + // we didn't find our start index in the string -- that's a problem + return nil, errors.New("startAt must align to the start of a valid rune in the input string") + } + + return re.run(false, startAt, r) +} + +// FindRunesMatchStartingAt searches the input rune slice for a Regexp match starting at the startAt index +func (re *Regexp) FindRunesMatchStartingAt(r []rune, startAt int) (*Match, error) { + return re.run(false, startAt, r) +} + +// FindNextMatch returns the next match in the same input string as the match parameter. +// Will return nil if there is no next match or if given a nil match. +func (re *Regexp) FindNextMatch(m *Match) (*Match, error) { + if m == nil { + return nil, nil + } + + // If previous match was empty, advance by one before matching to prevent + // infinite loop + startAt := m.textpos + if m.Length == 0 { + if m.textpos == len(m.text) { + return nil, nil + } + + if re.RightToLeft() { + startAt-- + } else { + startAt++ + } + } + return re.run(false, startAt, m.text) +} + +// MatchString return true if the string matches the regex +// error will be set if a timeout occurs +func (re *Regexp) MatchString(s string) (bool, error) { + m, err := re.run(true, -1, getRunes(s)) + if err != nil { + return false, err + } + return m != nil, nil +} + +func (re *Regexp) getRunesAndStart(s string, startAt int) ([]rune, int) { + if startAt < 0 { + if re.RightToLeft() { + r := getRunes(s) + return r, len(r) + } + return getRunes(s), 0 + } + ret := make([]rune, len(s)) + i := 0 + runeIdx := -1 + for strIdx, r := range s { + if strIdx == startAt { + runeIdx = i + } + ret[i] = r + i++ + } + return ret[:i], runeIdx +} + +func getRunes(s string) []rune { + ret := make([]rune, len(s)) + i := 0 + for _, r := range s { + ret[i] = r + i++ + } + return ret[:i] +} + +// MatchRunes return true if the runes matches the regex +// error will be set if a timeout occurs +func (re *Regexp) MatchRunes(r []rune) (bool, error) { + m, err := re.run(true, -1, r) + if err != nil { + return false, err + } + return m != nil, nil +} + +// GetGroupNames Returns the set of strings used to name capturing groups in the expression. +func (re *Regexp) GetGroupNames() []string { + var result []string + + if re.capslist == nil { + result = make([]string, re.capsize) + + for i := 0; i < len(result); i++ { + result[i] = strconv.Itoa(i) + } + } else { + result = make([]string, len(re.capslist)) + copy(result, re.capslist) + } + + return result +} + +// GetGroupNumbers returns the integer group numbers corresponding to a group name. +func (re *Regexp) GetGroupNumbers() []int { + var result []int + + if re.caps == nil { + result = make([]int, re.capsize) + + for i := 0; i < len(result); i++ { + result[i] = i + } + } else { + result = make([]int, len(re.caps)) + + for k, v := range re.caps { + result[v] = k + } + } + + return result +} + +// GroupNameFromNumber retrieves a group name that corresponds to a group number. +// It will return "" for and unknown group number. Unnamed groups automatically +// receive a name that is the decimal string equivalent of its number. +func (re *Regexp) GroupNameFromNumber(i int) string { + if re.capslist == nil { + if i >= 0 && i < re.capsize { + return strconv.Itoa(i) + } + + return "" + } + + if re.caps != nil { + var ok bool + if i, ok = re.caps[i]; !ok { + return "" + } + } + + if i >= 0 && i < len(re.capslist) { + return re.capslist[i] + } + + return "" +} + +// GroupNumberFromName returns a group number that corresponds to a group name. +// Returns -1 if the name is not a recognized group name. Numbered groups +// automatically get a group name that is the decimal string equivalent of its number. +func (re *Regexp) GroupNumberFromName(name string) int { + // look up name if we have a hashtable of names + if re.capnames != nil { + if k, ok := re.capnames[name]; ok { + return k + } + + return -1 + } + + // convert to an int if it looks like a number + result := 0 + for i := 0; i < len(name); i++ { + ch := name[i] + + if ch > '9' || ch < '0' { + return -1 + } + + result *= 10 + result += int(ch - '0') + } + + // return int if it's in range + if result >= 0 && result < re.capsize { + return result + } + + return -1 +} diff --git a/vendor/github.com/dlclark/regexp2/replace.go b/vendor/github.com/dlclark/regexp2/replace.go new file mode 100644 index 000000000..0376bd9d3 --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/replace.go @@ -0,0 +1,177 @@ +package regexp2 + +import ( + "bytes" + "errors" + + "github.com/dlclark/regexp2/syntax" +) + +const ( + replaceSpecials = 4 + replaceLeftPortion = -1 + replaceRightPortion = -2 + replaceLastGroup = -3 + replaceWholeString = -4 +) + +// MatchEvaluator is a function that takes a match and returns a replacement string to be used +type MatchEvaluator func(Match) string + +// Three very similar algorithms appear below: replace (pattern), +// replace (evaluator), and split. + +// Replace Replaces all occurrences of the regex in the string with the +// replacement pattern. +// +// Note that the special case of no matches is handled on its own: +// with no matches, the input string is returned unchanged. +// The right-to-left case is split out because StringBuilder +// doesn't handle right-to-left string building directly very well. +func replace(regex *Regexp, data *syntax.ReplacerData, evaluator MatchEvaluator, input string, startAt, count int) (string, error) { + if count < -1 { + return "", errors.New("Count too small") + } + if count == 0 { + return "", nil + } + + m, err := regex.FindStringMatchStartingAt(input, startAt) + + if err != nil { + return "", err + } + if m == nil { + return input, nil + } + + buf := &bytes.Buffer{} + text := m.text + + if !regex.RightToLeft() { + prevat := 0 + for m != nil { + if m.Index != prevat { + buf.WriteString(string(text[prevat:m.Index])) + } + prevat = m.Index + m.Length + if evaluator == nil { + replacementImpl(data, buf, m) + } else { + buf.WriteString(evaluator(*m)) + } + + count-- + if count == 0 { + break + } + m, err = regex.FindNextMatch(m) + if err != nil { + return "", nil + } + } + + if prevat < len(text) { + buf.WriteString(string(text[prevat:])) + } + } else { + prevat := len(text) + var al []string + + for m != nil { + if m.Index+m.Length != prevat { + al = append(al, string(text[m.Index+m.Length:prevat])) + } + prevat = m.Index + if evaluator == nil { + replacementImplRTL(data, &al, m) + } else { + al = append(al, evaluator(*m)) + } + + count-- + if count == 0 { + break + } + m, err = regex.FindNextMatch(m) + if err != nil { + return "", nil + } + } + + if prevat > 0 { + buf.WriteString(string(text[:prevat])) + } + + for i := len(al) - 1; i >= 0; i-- { + buf.WriteString(al[i]) + } + } + + return buf.String(), nil +} + +// Given a Match, emits into the StringBuilder the evaluated +// substitution pattern. +func replacementImpl(data *syntax.ReplacerData, buf *bytes.Buffer, m *Match) { + for _, r := range data.Rules { + + if r >= 0 { // string lookup + buf.WriteString(data.Strings[r]) + } else if r < -replaceSpecials { // group lookup + m.groupValueAppendToBuf(-replaceSpecials-1-r, buf) + } else { + switch -replaceSpecials - 1 - r { // special insertion patterns + case replaceLeftPortion: + for i := 0; i < m.Index; i++ { + buf.WriteRune(m.text[i]) + } + case replaceRightPortion: + for i := m.Index + m.Length; i < len(m.text); i++ { + buf.WriteRune(m.text[i]) + } + case replaceLastGroup: + m.groupValueAppendToBuf(m.GroupCount()-1, buf) + case replaceWholeString: + for i := 0; i < len(m.text); i++ { + buf.WriteRune(m.text[i]) + } + } + } + } +} + +func replacementImplRTL(data *syntax.ReplacerData, al *[]string, m *Match) { + l := *al + buf := &bytes.Buffer{} + + for _, r := range data.Rules { + buf.Reset() + if r >= 0 { // string lookup + l = append(l, data.Strings[r]) + } else if r < -replaceSpecials { // group lookup + m.groupValueAppendToBuf(-replaceSpecials-1-r, buf) + l = append(l, buf.String()) + } else { + switch -replaceSpecials - 1 - r { // special insertion patterns + case replaceLeftPortion: + for i := 0; i < m.Index; i++ { + buf.WriteRune(m.text[i]) + } + case replaceRightPortion: + for i := m.Index + m.Length; i < len(m.text); i++ { + buf.WriteRune(m.text[i]) + } + case replaceLastGroup: + m.groupValueAppendToBuf(m.GroupCount()-1, buf) + case replaceWholeString: + for i := 0; i < len(m.text); i++ { + buf.WriteRune(m.text[i]) + } + } + l = append(l, buf.String()) + } + } + + *al = l +} diff --git a/vendor/github.com/dlclark/regexp2/runner.go b/vendor/github.com/dlclark/regexp2/runner.go new file mode 100644 index 000000000..2d84a934b --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/runner.go @@ -0,0 +1,1621 @@ +package regexp2 + +import ( + "bytes" + "errors" + "fmt" + "math" + "strconv" + "strings" + "time" + "unicode" + + "github.com/dlclark/regexp2/syntax" +) + +type runner struct { + re *Regexp + code *syntax.Code + + runtextstart int // starting point for search + + runtext []rune // text to search + runtextpos int // current position in text + runtextend int + + // The backtracking stack. Opcodes use this to store data regarding + // what they have matched and where to backtrack to. Each "frame" on + // the stack takes the form of [CodePosition Data1 Data2...], where + // CodePosition is the position of the current opcode and + // the data values are all optional. The CodePosition can be negative, and + // these values (also called "back2") are used by the BranchMark family of opcodes + // to indicate whether they are backtracking after a successful or failed + // match. + // When we backtrack, we pop the CodePosition off the stack, set the current + // instruction pointer to that code position, and mark the opcode + // with a backtracking flag ("Back"). Each opcode then knows how to + // handle its own data. + runtrack []int + runtrackpos int + + // This stack is used to track text positions across different opcodes. + // For example, in /(a*b)+/, the parentheses result in a SetMark/CaptureMark + // pair. SetMark records the text position before we match a*b. Then + // CaptureMark uses that position to figure out where the capture starts. + // Opcodes which push onto this stack are always paired with other opcodes + // which will pop the value from it later. A successful match should mean + // that this stack is empty. + runstack []int + runstackpos int + + // The crawl stack is used to keep track of captures. Every time a group + // has a capture, we push its group number onto the runcrawl stack. In + // the case of a balanced match, we push BOTH groups onto the stack. + runcrawl []int + runcrawlpos int + + runtrackcount int // count of states that may do backtracking + + runmatch *Match // result object + + ignoreTimeout bool + timeout time.Duration // timeout in milliseconds (needed for actual) + timeoutChecksToSkip int + timeoutAt time.Time + + operator syntax.InstOp + codepos int + rightToLeft bool + caseInsensitive bool +} + +// run searches for matches and can continue from the previous match +// +// quick is usually false, but can be true to not return matches, just put it in caches +// textstart is -1 to start at the "beginning" (depending on Right-To-Left), otherwise an index in input +// input is the string to search for our regex pattern +func (re *Regexp) run(quick bool, textstart int, input []rune) (*Match, error) { + + // get a cached runner + runner := re.getRunner() + defer re.putRunner(runner) + + if textstart < 0 { + if re.RightToLeft() { + textstart = len(input) + } else { + textstart = 0 + } + } + + return runner.scan(input, textstart, quick, re.MatchTimeout) +} + +// Scans the string to find the first match. Uses the Match object +// both to feed text in and as a place to store matches that come out. +// +// All the action is in the Go() method. Our +// responsibility is to load up the class members before +// calling Go. +// +// The optimizer can compute a set of candidate starting characters, +// and we could use a separate method Skip() that will quickly scan past +// any characters that we know can't match. +func (r *runner) scan(rt []rune, textstart int, quick bool, timeout time.Duration) (*Match, error) { + r.timeout = timeout + r.ignoreTimeout = (time.Duration(math.MaxInt64) == timeout) + r.runtextstart = textstart + r.runtext = rt + r.runtextend = len(rt) + + stoppos := r.runtextend + bump := 1 + + if r.re.RightToLeft() { + bump = -1 + stoppos = 0 + } + + r.runtextpos = textstart + initted := false + + r.startTimeoutWatch() + for { + if r.re.Debug() { + //fmt.Printf("\nSearch content: %v\n", string(r.runtext)) + fmt.Printf("\nSearch range: from 0 to %v\n", r.runtextend) + fmt.Printf("Firstchar search starting at %v stopping at %v\n", r.runtextpos, stoppos) + } + + if r.findFirstChar() { + if err := r.checkTimeout(); err != nil { + return nil, err + } + + if !initted { + r.initMatch() + initted = true + } + + if r.re.Debug() { + fmt.Printf("Executing engine starting at %v\n\n", r.runtextpos) + } + + if err := r.execute(); err != nil { + return nil, err + } + + if r.runmatch.matchcount[0] > 0 { + // We'll return a match even if it touches a previous empty match + return r.tidyMatch(quick), nil + } + + // reset state for another go + r.runtrackpos = len(r.runtrack) + r.runstackpos = len(r.runstack) + r.runcrawlpos = len(r.runcrawl) + } + + // failure! + + if r.runtextpos == stoppos { + r.tidyMatch(true) + return nil, nil + } + + // Recognize leading []* and various anchors, and bump on failure accordingly + + // r.bump by one and start again + + r.runtextpos += bump + } + // We never get here +} + +func (r *runner) execute() error { + + r.goTo(0) + + for { + + if r.re.Debug() { + r.dumpState() + } + + if err := r.checkTimeout(); err != nil { + return err + } + + switch r.operator { + case syntax.Stop: + return nil + + case syntax.Nothing: + break + + case syntax.Goto: + r.goTo(r.operand(0)) + continue + + case syntax.Testref: + if !r.runmatch.isMatched(r.operand(0)) { + break + } + r.advance(1) + continue + + case syntax.Lazybranch: + r.trackPush1(r.textPos()) + r.advance(1) + continue + + case syntax.Lazybranch | syntax.Back: + r.trackPop() + r.textto(r.trackPeek()) + r.goTo(r.operand(0)) + continue + + case syntax.Setmark: + r.stackPush(r.textPos()) + r.trackPush() + r.advance(0) + continue + + case syntax.Nullmark: + r.stackPush(-1) + r.trackPush() + r.advance(0) + continue + + case syntax.Setmark | syntax.Back, syntax.Nullmark | syntax.Back: + r.stackPop() + break + + case syntax.Getmark: + r.stackPop() + r.trackPush1(r.stackPeek()) + r.textto(r.stackPeek()) + r.advance(0) + continue + + case syntax.Getmark | syntax.Back: + r.trackPop() + r.stackPush(r.trackPeek()) + break + + case syntax.Capturemark: + if r.operand(1) != -1 && !r.runmatch.isMatched(r.operand(1)) { + break + } + r.stackPop() + if r.operand(1) != -1 { + r.transferCapture(r.operand(0), r.operand(1), r.stackPeek(), r.textPos()) + } else { + r.capture(r.operand(0), r.stackPeek(), r.textPos()) + } + r.trackPush1(r.stackPeek()) + + r.advance(2) + + continue + + case syntax.Capturemark | syntax.Back: + r.trackPop() + r.stackPush(r.trackPeek()) + r.uncapture() + if r.operand(0) != -1 && r.operand(1) != -1 { + r.uncapture() + } + + break + + case syntax.Branchmark: + r.stackPop() + + matched := r.textPos() - r.stackPeek() + + if matched != 0 { // Nonempty match -> loop now + r.trackPush2(r.stackPeek(), r.textPos()) // Save old mark, textpos + r.stackPush(r.textPos()) // Make new mark + r.goTo(r.operand(0)) // Loop + } else { // Empty match -> straight now + r.trackPushNeg1(r.stackPeek()) // Save old mark + r.advance(1) // Straight + } + continue + + case syntax.Branchmark | syntax.Back: + r.trackPopN(2) + r.stackPop() + r.textto(r.trackPeekN(1)) // Recall position + r.trackPushNeg1(r.trackPeek()) // Save old mark + r.advance(1) // Straight + continue + + case syntax.Branchmark | syntax.Back2: + r.trackPop() + r.stackPush(r.trackPeek()) // Recall old mark + break // Backtrack + + case syntax.Lazybranchmark: + { + // We hit this the first time through a lazy loop and after each + // successful match of the inner expression. It simply continues + // on and doesn't loop. + r.stackPop() + + oldMarkPos := r.stackPeek() + + if r.textPos() != oldMarkPos { // Nonempty match -> try to loop again by going to 'back' state + if oldMarkPos != -1 { + r.trackPush2(oldMarkPos, r.textPos()) // Save old mark, textpos + } else { + r.trackPush2(r.textPos(), r.textPos()) + } + } else { + // The inner expression found an empty match, so we'll go directly to 'back2' if we + // backtrack. In this case, we need to push something on the stack, since back2 pops. + // However, in the case of ()+? or similar, this empty match may be legitimate, so push the text + // position associated with that empty match. + r.stackPush(oldMarkPos) + + r.trackPushNeg1(r.stackPeek()) // Save old mark + } + r.advance(1) + continue + } + + case syntax.Lazybranchmark | syntax.Back: + + // After the first time, Lazybranchmark | syntax.Back occurs + // with each iteration of the loop, and therefore with every attempted + // match of the inner expression. We'll try to match the inner expression, + // then go back to Lazybranchmark if successful. If the inner expression + // fails, we go to Lazybranchmark | syntax.Back2 + + r.trackPopN(2) + pos := r.trackPeekN(1) + r.trackPushNeg1(r.trackPeek()) // Save old mark + r.stackPush(pos) // Make new mark + r.textto(pos) // Recall position + r.goTo(r.operand(0)) // Loop + continue + + case syntax.Lazybranchmark | syntax.Back2: + // The lazy loop has failed. We'll do a true backtrack and + // start over before the lazy loop. + r.stackPop() + r.trackPop() + r.stackPush(r.trackPeek()) // Recall old mark + break + + case syntax.Setcount: + r.stackPush2(r.textPos(), r.operand(0)) + r.trackPush() + r.advance(1) + continue + + case syntax.Nullcount: + r.stackPush2(-1, r.operand(0)) + r.trackPush() + r.advance(1) + continue + + case syntax.Setcount | syntax.Back: + r.stackPopN(2) + break + + case syntax.Nullcount | syntax.Back: + r.stackPopN(2) + break + + case syntax.Branchcount: + // r.stackPush: + // 0: Mark + // 1: Count + + r.stackPopN(2) + mark := r.stackPeek() + count := r.stackPeekN(1) + matched := r.textPos() - mark + + if count >= r.operand(1) || (matched == 0 && count >= 0) { // Max loops or empty match -> straight now + r.trackPushNeg2(mark, count) // Save old mark, count + r.advance(2) // Straight + } else { // Nonempty match -> count+loop now + r.trackPush1(mark) // remember mark + r.stackPush2(r.textPos(), count+1) // Make new mark, incr count + r.goTo(r.operand(0)) // Loop + } + continue + + case syntax.Branchcount | syntax.Back: + // r.trackPush: + // 0: Previous mark + // r.stackPush: + // 0: Mark (= current pos, discarded) + // 1: Count + r.trackPop() + r.stackPopN(2) + if r.stackPeekN(1) > 0 { // Positive -> can go straight + r.textto(r.stackPeek()) // Zap to mark + r.trackPushNeg2(r.trackPeek(), r.stackPeekN(1)-1) // Save old mark, old count + r.advance(2) // Straight + continue + } + r.stackPush2(r.trackPeek(), r.stackPeekN(1)-1) // recall old mark, old count + break + + case syntax.Branchcount | syntax.Back2: + // r.trackPush: + // 0: Previous mark + // 1: Previous count + r.trackPopN(2) + r.stackPush2(r.trackPeek(), r.trackPeekN(1)) // Recall old mark, old count + break // Backtrack + + case syntax.Lazybranchcount: + // r.stackPush: + // 0: Mark + // 1: Count + + r.stackPopN(2) + mark := r.stackPeek() + count := r.stackPeekN(1) + + if count < 0 { // Negative count -> loop now + r.trackPushNeg1(mark) // Save old mark + r.stackPush2(r.textPos(), count+1) // Make new mark, incr count + r.goTo(r.operand(0)) // Loop + } else { // Nonneg count -> straight now + r.trackPush3(mark, count, r.textPos()) // Save mark, count, position + r.advance(2) // Straight + } + continue + + case syntax.Lazybranchcount | syntax.Back: + // r.trackPush: + // 0: Mark + // 1: Count + // 2: r.textPos + + r.trackPopN(3) + mark := r.trackPeek() + textpos := r.trackPeekN(2) + + if r.trackPeekN(1) < r.operand(1) && textpos != mark { // Under limit and not empty match -> loop + r.textto(textpos) // Recall position + r.stackPush2(textpos, r.trackPeekN(1)+1) // Make new mark, incr count + r.trackPushNeg1(mark) // Save old mark + r.goTo(r.operand(0)) // Loop + continue + } else { // Max loops or empty match -> backtrack + r.stackPush2(r.trackPeek(), r.trackPeekN(1)) // Recall old mark, count + break // backtrack + } + + case syntax.Lazybranchcount | syntax.Back2: + // r.trackPush: + // 0: Previous mark + // r.stackPush: + // 0: Mark (== current pos, discarded) + // 1: Count + r.trackPop() + r.stackPopN(2) + r.stackPush2(r.trackPeek(), r.stackPeekN(1)-1) // Recall old mark, count + break // Backtrack + + case syntax.Setjump: + r.stackPush2(r.trackpos(), r.crawlpos()) + r.trackPush() + r.advance(0) + continue + + case syntax.Setjump | syntax.Back: + r.stackPopN(2) + break + + case syntax.Backjump: + // r.stackPush: + // 0: Saved trackpos + // 1: r.crawlpos + r.stackPopN(2) + r.trackto(r.stackPeek()) + + for r.crawlpos() != r.stackPeekN(1) { + r.uncapture() + } + + break + + case syntax.Forejump: + // r.stackPush: + // 0: Saved trackpos + // 1: r.crawlpos + r.stackPopN(2) + r.trackto(r.stackPeek()) + r.trackPush1(r.stackPeekN(1)) + r.advance(0) + continue + + case syntax.Forejump | syntax.Back: + // r.trackPush: + // 0: r.crawlpos + r.trackPop() + + for r.crawlpos() != r.trackPeek() { + r.uncapture() + } + + break + + case syntax.Bol: + if r.leftchars() > 0 && r.charAt(r.textPos()-1) != '\n' { + break + } + r.advance(0) + continue + + case syntax.Eol: + if r.rightchars() > 0 && r.charAt(r.textPos()) != '\n' { + break + } + r.advance(0) + continue + + case syntax.Boundary: + if !r.isBoundary(r.textPos(), 0, r.runtextend) { + break + } + r.advance(0) + continue + + case syntax.Nonboundary: + if r.isBoundary(r.textPos(), 0, r.runtextend) { + break + } + r.advance(0) + continue + + case syntax.ECMABoundary: + if !r.isECMABoundary(r.textPos(), 0, r.runtextend) { + break + } + r.advance(0) + continue + + case syntax.NonECMABoundary: + if r.isECMABoundary(r.textPos(), 0, r.runtextend) { + break + } + r.advance(0) + continue + + case syntax.Beginning: + if r.leftchars() > 0 { + break + } + r.advance(0) + continue + + case syntax.Start: + if r.textPos() != r.textstart() { + break + } + r.advance(0) + continue + + case syntax.EndZ: + if r.rightchars() > 1 || r.rightchars() == 1 && r.charAt(r.textPos()) != '\n' { + break + } + r.advance(0) + continue + + case syntax.End: + if r.rightchars() > 0 { + break + } + r.advance(0) + continue + + case syntax.One: + if r.forwardchars() < 1 || r.forwardcharnext() != rune(r.operand(0)) { + break + } + + r.advance(1) + continue + + case syntax.Notone: + if r.forwardchars() < 1 || r.forwardcharnext() == rune(r.operand(0)) { + break + } + + r.advance(1) + continue + + case syntax.Set: + + if r.forwardchars() < 1 || !r.code.Sets[r.operand(0)].CharIn(r.forwardcharnext()) { + break + } + + r.advance(1) + continue + + case syntax.Multi: + if !r.runematch(r.code.Strings[r.operand(0)]) { + break + } + + r.advance(1) + continue + + case syntax.Ref: + + capnum := r.operand(0) + + if r.runmatch.isMatched(capnum) { + if !r.refmatch(r.runmatch.matchIndex(capnum), r.runmatch.matchLength(capnum)) { + break + } + } else { + if (r.re.options & ECMAScript) == 0 { + break + } + } + + r.advance(1) + continue + + case syntax.Onerep: + + c := r.operand(1) + + if r.forwardchars() < c { + break + } + + ch := rune(r.operand(0)) + + for c > 0 { + if r.forwardcharnext() != ch { + goto BreakBackward + } + c-- + } + + r.advance(2) + continue + + case syntax.Notonerep: + + c := r.operand(1) + + if r.forwardchars() < c { + break + } + ch := rune(r.operand(0)) + + for c > 0 { + if r.forwardcharnext() == ch { + goto BreakBackward + } + c-- + } + + r.advance(2) + continue + + case syntax.Setrep: + + c := r.operand(1) + + if r.forwardchars() < c { + break + } + + set := r.code.Sets[r.operand(0)] + + for c > 0 { + if !set.CharIn(r.forwardcharnext()) { + goto BreakBackward + } + c-- + } + + r.advance(2) + continue + + case syntax.Oneloop: + + c := r.operand(1) + + if c > r.forwardchars() { + c = r.forwardchars() + } + + ch := rune(r.operand(0)) + i := c + + for ; i > 0; i-- { + if r.forwardcharnext() != ch { + r.backwardnext() + break + } + } + + if c > i { + r.trackPush2(c-i-1, r.textPos()-r.bump()) + } + + r.advance(2) + continue + + case syntax.Notoneloop: + + c := r.operand(1) + + if c > r.forwardchars() { + c = r.forwardchars() + } + + ch := rune(r.operand(0)) + i := c + + for ; i > 0; i-- { + if r.forwardcharnext() == ch { + r.backwardnext() + break + } + } + + if c > i { + r.trackPush2(c-i-1, r.textPos()-r.bump()) + } + + r.advance(2) + continue + + case syntax.Setloop: + + c := r.operand(1) + + if c > r.forwardchars() { + c = r.forwardchars() + } + + set := r.code.Sets[r.operand(0)] + i := c + + for ; i > 0; i-- { + if !set.CharIn(r.forwardcharnext()) { + r.backwardnext() + break + } + } + + if c > i { + r.trackPush2(c-i-1, r.textPos()-r.bump()) + } + + r.advance(2) + continue + + case syntax.Oneloop | syntax.Back, syntax.Notoneloop | syntax.Back: + + r.trackPopN(2) + i := r.trackPeek() + pos := r.trackPeekN(1) + + r.textto(pos) + + if i > 0 { + r.trackPush2(i-1, pos-r.bump()) + } + + r.advance(2) + continue + + case syntax.Setloop | syntax.Back: + + r.trackPopN(2) + i := r.trackPeek() + pos := r.trackPeekN(1) + + r.textto(pos) + + if i > 0 { + r.trackPush2(i-1, pos-r.bump()) + } + + r.advance(2) + continue + + case syntax.Onelazy, syntax.Notonelazy: + + c := r.operand(1) + + if c > r.forwardchars() { + c = r.forwardchars() + } + + if c > 0 { + r.trackPush2(c-1, r.textPos()) + } + + r.advance(2) + continue + + case syntax.Setlazy: + + c := r.operand(1) + + if c > r.forwardchars() { + c = r.forwardchars() + } + + if c > 0 { + r.trackPush2(c-1, r.textPos()) + } + + r.advance(2) + continue + + case syntax.Onelazy | syntax.Back: + + r.trackPopN(2) + pos := r.trackPeekN(1) + r.textto(pos) + + if r.forwardcharnext() != rune(r.operand(0)) { + break + } + + i := r.trackPeek() + + if i > 0 { + r.trackPush2(i-1, pos+r.bump()) + } + + r.advance(2) + continue + + case syntax.Notonelazy | syntax.Back: + + r.trackPopN(2) + pos := r.trackPeekN(1) + r.textto(pos) + + if r.forwardcharnext() == rune(r.operand(0)) { + break + } + + i := r.trackPeek() + + if i > 0 { + r.trackPush2(i-1, pos+r.bump()) + } + + r.advance(2) + continue + + case syntax.Setlazy | syntax.Back: + + r.trackPopN(2) + pos := r.trackPeekN(1) + r.textto(pos) + + if !r.code.Sets[r.operand(0)].CharIn(r.forwardcharnext()) { + break + } + + i := r.trackPeek() + + if i > 0 { + r.trackPush2(i-1, pos+r.bump()) + } + + r.advance(2) + continue + + default: + return errors.New("unknown state in regex runner") + } + + BreakBackward: + ; + + // "break Backward" comes here: + r.backtrack() + } +} + +// increase the size of stack and track storage +func (r *runner) ensureStorage() { + if r.runstackpos < r.runtrackcount*4 { + doubleIntSlice(&r.runstack, &r.runstackpos) + } + if r.runtrackpos < r.runtrackcount*4 { + doubleIntSlice(&r.runtrack, &r.runtrackpos) + } +} + +func doubleIntSlice(s *[]int, pos *int) { + oldLen := len(*s) + newS := make([]int, oldLen*2) + + copy(newS[oldLen:], *s) + *pos += oldLen + *s = newS +} + +// Save a number on the longjump unrolling stack +func (r *runner) crawl(i int) { + if r.runcrawlpos == 0 { + doubleIntSlice(&r.runcrawl, &r.runcrawlpos) + } + r.runcrawlpos-- + r.runcrawl[r.runcrawlpos] = i +} + +// Remove a number from the longjump unrolling stack +func (r *runner) popcrawl() int { + val := r.runcrawl[r.runcrawlpos] + r.runcrawlpos++ + return val +} + +// Get the height of the stack +func (r *runner) crawlpos() int { + return len(r.runcrawl) - r.runcrawlpos +} + +func (r *runner) advance(i int) { + r.codepos += (i + 1) + r.setOperator(r.code.Codes[r.codepos]) +} + +func (r *runner) goTo(newpos int) { + // when branching backward, ensure storage + if newpos < r.codepos { + r.ensureStorage() + } + + r.setOperator(r.code.Codes[newpos]) + r.codepos = newpos +} + +func (r *runner) textto(newpos int) { + r.runtextpos = newpos +} + +func (r *runner) trackto(newpos int) { + r.runtrackpos = len(r.runtrack) - newpos +} + +func (r *runner) textstart() int { + return r.runtextstart +} + +func (r *runner) textPos() int { + return r.runtextpos +} + +// push onto the backtracking stack +func (r *runner) trackpos() int { + return len(r.runtrack) - r.runtrackpos +} + +func (r *runner) trackPush() { + r.runtrackpos-- + r.runtrack[r.runtrackpos] = r.codepos +} + +func (r *runner) trackPush1(I1 int) { + r.runtrackpos-- + r.runtrack[r.runtrackpos] = I1 + r.runtrackpos-- + r.runtrack[r.runtrackpos] = r.codepos +} + +func (r *runner) trackPush2(I1, I2 int) { + r.runtrackpos-- + r.runtrack[r.runtrackpos] = I1 + r.runtrackpos-- + r.runtrack[r.runtrackpos] = I2 + r.runtrackpos-- + r.runtrack[r.runtrackpos] = r.codepos +} + +func (r *runner) trackPush3(I1, I2, I3 int) { + r.runtrackpos-- + r.runtrack[r.runtrackpos] = I1 + r.runtrackpos-- + r.runtrack[r.runtrackpos] = I2 + r.runtrackpos-- + r.runtrack[r.runtrackpos] = I3 + r.runtrackpos-- + r.runtrack[r.runtrackpos] = r.codepos +} + +func (r *runner) trackPushNeg1(I1 int) { + r.runtrackpos-- + r.runtrack[r.runtrackpos] = I1 + r.runtrackpos-- + r.runtrack[r.runtrackpos] = -r.codepos +} + +func (r *runner) trackPushNeg2(I1, I2 int) { + r.runtrackpos-- + r.runtrack[r.runtrackpos] = I1 + r.runtrackpos-- + r.runtrack[r.runtrackpos] = I2 + r.runtrackpos-- + r.runtrack[r.runtrackpos] = -r.codepos +} + +func (r *runner) backtrack() { + newpos := r.runtrack[r.runtrackpos] + r.runtrackpos++ + + if r.re.Debug() { + if newpos < 0 { + fmt.Printf(" Backtracking (back2) to code position %v\n", -newpos) + } else { + fmt.Printf(" Backtracking to code position %v\n", newpos) + } + } + + if newpos < 0 { + newpos = -newpos + r.setOperator(r.code.Codes[newpos] | syntax.Back2) + } else { + r.setOperator(r.code.Codes[newpos] | syntax.Back) + } + + // When branching backward, ensure storage + if newpos < r.codepos { + r.ensureStorage() + } + + r.codepos = newpos +} + +func (r *runner) setOperator(op int) { + r.caseInsensitive = (0 != (op & syntax.Ci)) + r.rightToLeft = (0 != (op & syntax.Rtl)) + r.operator = syntax.InstOp(op & ^(syntax.Rtl | syntax.Ci)) +} + +func (r *runner) trackPop() { + r.runtrackpos++ +} + +// pop framesize items from the backtracking stack +func (r *runner) trackPopN(framesize int) { + r.runtrackpos += framesize +} + +// Technically we are actually peeking at items already popped. So if you want to +// get and pop the top item from the stack, you do +// r.trackPop(); +// r.trackPeek(); +func (r *runner) trackPeek() int { + return r.runtrack[r.runtrackpos-1] +} + +// get the ith element down on the backtracking stack +func (r *runner) trackPeekN(i int) int { + return r.runtrack[r.runtrackpos-i-1] +} + +// Push onto the grouping stack +func (r *runner) stackPush(I1 int) { + r.runstackpos-- + r.runstack[r.runstackpos] = I1 +} + +func (r *runner) stackPush2(I1, I2 int) { + r.runstackpos-- + r.runstack[r.runstackpos] = I1 + r.runstackpos-- + r.runstack[r.runstackpos] = I2 +} + +func (r *runner) stackPop() { + r.runstackpos++ +} + +// pop framesize items from the grouping stack +func (r *runner) stackPopN(framesize int) { + r.runstackpos += framesize +} + +// Technically we are actually peeking at items already popped. So if you want to +// get and pop the top item from the stack, you do +// r.stackPop(); +// r.stackPeek(); +func (r *runner) stackPeek() int { + return r.runstack[r.runstackpos-1] +} + +// get the ith element down on the grouping stack +func (r *runner) stackPeekN(i int) int { + return r.runstack[r.runstackpos-i-1] +} + +func (r *runner) operand(i int) int { + return r.code.Codes[r.codepos+i+1] +} + +func (r *runner) leftchars() int { + return r.runtextpos +} + +func (r *runner) rightchars() int { + return r.runtextend - r.runtextpos +} + +func (r *runner) bump() int { + if r.rightToLeft { + return -1 + } + return 1 +} + +func (r *runner) forwardchars() int { + if r.rightToLeft { + return r.runtextpos + } + return r.runtextend - r.runtextpos +} + +func (r *runner) forwardcharnext() rune { + var ch rune + if r.rightToLeft { + r.runtextpos-- + ch = r.runtext[r.runtextpos] + } else { + ch = r.runtext[r.runtextpos] + r.runtextpos++ + } + + if r.caseInsensitive { + return unicode.ToLower(ch) + } + return ch +} + +func (r *runner) runematch(str []rune) bool { + var pos int + + c := len(str) + if !r.rightToLeft { + if r.runtextend-r.runtextpos < c { + return false + } + + pos = r.runtextpos + c + } else { + if r.runtextpos-0 < c { + return false + } + + pos = r.runtextpos + } + + if !r.caseInsensitive { + for c != 0 { + c-- + pos-- + if str[c] != r.runtext[pos] { + return false + } + } + } else { + for c != 0 { + c-- + pos-- + if str[c] != unicode.ToLower(r.runtext[pos]) { + return false + } + } + } + + if !r.rightToLeft { + pos += len(str) + } + + r.runtextpos = pos + + return true +} + +func (r *runner) refmatch(index, len int) bool { + var c, pos, cmpos int + + if !r.rightToLeft { + if r.runtextend-r.runtextpos < len { + return false + } + + pos = r.runtextpos + len + } else { + if r.runtextpos-0 < len { + return false + } + + pos = r.runtextpos + } + cmpos = index + len + + c = len + + if !r.caseInsensitive { + for c != 0 { + c-- + cmpos-- + pos-- + if r.runtext[cmpos] != r.runtext[pos] { + return false + } + + } + } else { + for c != 0 { + c-- + cmpos-- + pos-- + + if unicode.ToLower(r.runtext[cmpos]) != unicode.ToLower(r.runtext[pos]) { + return false + } + } + } + + if !r.rightToLeft { + pos += len + } + + r.runtextpos = pos + + return true +} + +func (r *runner) backwardnext() { + if r.rightToLeft { + r.runtextpos++ + } else { + r.runtextpos-- + } +} + +func (r *runner) charAt(j int) rune { + return r.runtext[j] +} + +func (r *runner) findFirstChar() bool { + + if 0 != (r.code.Anchors & (syntax.AnchorBeginning | syntax.AnchorStart | syntax.AnchorEndZ | syntax.AnchorEnd)) { + if !r.code.RightToLeft { + if (0 != (r.code.Anchors&syntax.AnchorBeginning) && r.runtextpos > 0) || + (0 != (r.code.Anchors&syntax.AnchorStart) && r.runtextpos > r.runtextstart) { + r.runtextpos = r.runtextend + return false + } + if 0 != (r.code.Anchors&syntax.AnchorEndZ) && r.runtextpos < r.runtextend-1 { + r.runtextpos = r.runtextend - 1 + } else if 0 != (r.code.Anchors&syntax.AnchorEnd) && r.runtextpos < r.runtextend { + r.runtextpos = r.runtextend + } + } else { + if (0 != (r.code.Anchors&syntax.AnchorEnd) && r.runtextpos < r.runtextend) || + (0 != (r.code.Anchors&syntax.AnchorEndZ) && (r.runtextpos < r.runtextend-1 || + (r.runtextpos == r.runtextend-1 && r.charAt(r.runtextpos) != '\n'))) || + (0 != (r.code.Anchors&syntax.AnchorStart) && r.runtextpos < r.runtextstart) { + r.runtextpos = 0 + return false + } + if 0 != (r.code.Anchors&syntax.AnchorBeginning) && r.runtextpos > 0 { + r.runtextpos = 0 + } + } + + if r.code.BmPrefix != nil { + return r.code.BmPrefix.IsMatch(r.runtext, r.runtextpos, 0, r.runtextend) + } + + return true // found a valid start or end anchor + } else if r.code.BmPrefix != nil { + r.runtextpos = r.code.BmPrefix.Scan(r.runtext, r.runtextpos, 0, r.runtextend) + + if r.runtextpos == -1 { + if r.code.RightToLeft { + r.runtextpos = 0 + } else { + r.runtextpos = r.runtextend + } + return false + } + + return true + } else if r.code.FcPrefix == nil { + return true + } + + r.rightToLeft = r.code.RightToLeft + r.caseInsensitive = r.code.FcPrefix.CaseInsensitive + + set := r.code.FcPrefix.PrefixSet + if set.IsSingleton() { + ch := set.SingletonChar() + for i := r.forwardchars(); i > 0; i-- { + if ch == r.forwardcharnext() { + r.backwardnext() + return true + } + } + } else { + for i := r.forwardchars(); i > 0; i-- { + n := r.forwardcharnext() + //fmt.Printf("%v in %v: %v\n", string(n), set.String(), set.CharIn(n)) + if set.CharIn(n) { + r.backwardnext() + return true + } + } + } + + return false +} + +func (r *runner) initMatch() { + // Use a hashtable'ed Match object if the capture numbers are sparse + + if r.runmatch == nil { + if r.re.caps != nil { + r.runmatch = newMatchSparse(r.re, r.re.caps, r.re.capsize, r.runtext, r.runtextstart) + } else { + r.runmatch = newMatch(r.re, r.re.capsize, r.runtext, r.runtextstart) + } + } else { + r.runmatch.reset(r.runtext, r.runtextstart) + } + + // note we test runcrawl, because it is the last one to be allocated + // If there is an alloc failure in the middle of the three allocations, + // we may still return to reuse this instance, and we want to behave + // as if the allocations didn't occur. (we used to test _trackcount != 0) + + if r.runcrawl != nil { + r.runtrackpos = len(r.runtrack) + r.runstackpos = len(r.runstack) + r.runcrawlpos = len(r.runcrawl) + return + } + + r.initTrackCount() + + tracksize := r.runtrackcount * 8 + stacksize := r.runtrackcount * 8 + + if tracksize < 32 { + tracksize = 32 + } + if stacksize < 16 { + stacksize = 16 + } + + r.runtrack = make([]int, tracksize) + r.runtrackpos = tracksize + + r.runstack = make([]int, stacksize) + r.runstackpos = stacksize + + r.runcrawl = make([]int, 32) + r.runcrawlpos = 32 +} + +func (r *runner) tidyMatch(quick bool) *Match { + if !quick { + match := r.runmatch + + r.runmatch = nil + + match.tidy(r.runtextpos) + return match + } else { + // send back our match -- it's not leaving the package, so it's safe to not clean it up + // this reduces allocs for frequent calls to the "IsMatch" bool-only functions + return r.runmatch + } +} + +// capture captures a subexpression. Note that the +// capnum used here has already been mapped to a non-sparse +// index (by the code generator RegexWriter). +func (r *runner) capture(capnum, start, end int) { + if end < start { + T := end + end = start + start = T + } + + r.crawl(capnum) + r.runmatch.addMatch(capnum, start, end-start) +} + +// transferCapture captures a subexpression. Note that the +// capnum used here has already been mapped to a non-sparse +// index (by the code generator RegexWriter). +func (r *runner) transferCapture(capnum, uncapnum, start, end int) { + var start2, end2 int + + // these are the two intervals that are cancelling each other + + if end < start { + T := end + end = start + start = T + } + + start2 = r.runmatch.matchIndex(uncapnum) + end2 = start2 + r.runmatch.matchLength(uncapnum) + + // The new capture gets the innermost defined interval + + if start >= end2 { + end = start + start = end2 + } else if end <= start2 { + start = start2 + } else { + if end > end2 { + end = end2 + } + if start2 > start { + start = start2 + } + } + + r.crawl(uncapnum) + r.runmatch.balanceMatch(uncapnum) + + if capnum != -1 { + r.crawl(capnum) + r.runmatch.addMatch(capnum, start, end-start) + } +} + +// revert the last capture +func (r *runner) uncapture() { + capnum := r.popcrawl() + r.runmatch.removeMatch(capnum) +} + +//debug + +func (r *runner) dumpState() { + back := "" + if r.operator&syntax.Back != 0 { + back = " Back" + } + if r.operator&syntax.Back2 != 0 { + back += " Back2" + } + fmt.Printf("Text: %v\nTrack: %v\nStack: %v\n %s%s\n\n", + r.textposDescription(), + r.stackDescription(r.runtrack, r.runtrackpos), + r.stackDescription(r.runstack, r.runstackpos), + r.code.OpcodeDescription(r.codepos), + back) +} + +func (r *runner) stackDescription(a []int, index int) string { + buf := &bytes.Buffer{} + + fmt.Fprintf(buf, "%v/%v", len(a)-index, len(a)) + if buf.Len() < 8 { + buf.WriteString(strings.Repeat(" ", 8-buf.Len())) + } + + buf.WriteRune('(') + for i := index; i < len(a); i++ { + if i > index { + buf.WriteRune(' ') + } + + buf.WriteString(strconv.Itoa(a[i])) + } + + buf.WriteRune(')') + + return buf.String() +} + +func (r *runner) textposDescription() string { + buf := &bytes.Buffer{} + + buf.WriteString(strconv.Itoa(r.runtextpos)) + + if buf.Len() < 8 { + buf.WriteString(strings.Repeat(" ", 8-buf.Len())) + } + + if r.runtextpos > 0 { + buf.WriteString(syntax.CharDescription(r.runtext[r.runtextpos-1])) + } else { + buf.WriteRune('^') + } + + buf.WriteRune('>') + + for i := r.runtextpos; i < r.runtextend; i++ { + buf.WriteString(syntax.CharDescription(r.runtext[i])) + } + if buf.Len() >= 64 { + buf.Truncate(61) + buf.WriteString("...") + } else { + buf.WriteRune('$') + } + + return buf.String() +} + +// decide whether the pos +// at the specified index is a boundary or not. It's just not worth +// emitting inline code for this logic. +func (r *runner) isBoundary(index, startpos, endpos int) bool { + return (index > startpos && syntax.IsWordChar(r.runtext[index-1])) != + (index < endpos && syntax.IsWordChar(r.runtext[index])) +} + +func (r *runner) isECMABoundary(index, startpos, endpos int) bool { + return (index > startpos && syntax.IsECMAWordChar(r.runtext[index-1])) != + (index < endpos && syntax.IsECMAWordChar(r.runtext[index])) +} + +// this seems like a comment to justify randomly picking 1000 :-P +// We have determined this value in a series of experiments where x86 retail +// builds (ono-lab-optimized) were run on different pattern/input pairs. Larger values +// of TimeoutCheckFrequency did not tend to increase performance; smaller values +// of TimeoutCheckFrequency tended to slow down the execution. +const timeoutCheckFrequency int = 1000 + +func (r *runner) startTimeoutWatch() { + if r.ignoreTimeout { + return + } + + r.timeoutChecksToSkip = timeoutCheckFrequency + r.timeoutAt = time.Now().Add(r.timeout) +} + +func (r *runner) checkTimeout() error { + if r.ignoreTimeout { + return nil + } + r.timeoutChecksToSkip-- + if r.timeoutChecksToSkip != 0 { + return nil + } + + r.timeoutChecksToSkip = timeoutCheckFrequency + return r.doCheckTimeout() +} + +func (r *runner) doCheckTimeout() error { + current := time.Now() + + if current.Before(r.timeoutAt) { + return nil + } + + if r.re.Debug() { + //Debug.WriteLine("") + //Debug.WriteLine("RegEx match timeout occurred!") + //Debug.WriteLine("Specified timeout: " + TimeSpan.FromMilliseconds(_timeout).ToString()) + //Debug.WriteLine("Timeout check frequency: " + TimeoutCheckFrequency) + //Debug.WriteLine("Search pattern: " + _runregex._pattern) + //Debug.WriteLine("Input: " + r.runtext) + //Debug.WriteLine("About to throw RegexMatchTimeoutException.") + } + + return fmt.Errorf("match timeout after %v on input `%v`", r.timeout, string(r.runtext)) +} + +func (r *runner) initTrackCount() { + r.runtrackcount = r.code.TrackCount +} + +// getRunner returns a run to use for matching re. +// It uses the re's runner cache if possible, to avoid +// unnecessary allocation. +func (re *Regexp) getRunner() *runner { + re.muRun.Lock() + if n := len(re.runner); n > 0 { + z := re.runner[n-1] + re.runner = re.runner[:n-1] + re.muRun.Unlock() + return z + } + re.muRun.Unlock() + z := &runner{ + re: re, + code: re.code, + } + return z +} + +// putRunner returns a runner to the re's cache. +// There is no attempt to limit the size of the cache, so it will +// grow to the maximum number of simultaneous matches +// run using re. (The cache empties when re gets garbage collected.) +func (re *Regexp) putRunner(r *runner) { + re.muRun.Lock() + re.runner = append(re.runner, r) + re.muRun.Unlock() +} diff --git a/vendor/github.com/dlclark/regexp2/syntax/charclass.go b/vendor/github.com/dlclark/regexp2/syntax/charclass.go new file mode 100644 index 000000000..f312ea7a0 --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/syntax/charclass.go @@ -0,0 +1,784 @@ +package syntax + +import ( + "bytes" + "encoding/binary" + "fmt" + "sort" + "unicode" + "unicode/utf8" +) + +// CharSet combines start-end rune ranges and unicode categories representing a set of characters +type CharSet struct { + ranges []singleRange + categories []category + sub *CharSet //optional subtractor + negate bool + anything bool +} + +type category struct { + negate bool + cat string +} + +type singleRange struct { + first rune + last rune +} + +const ( + spaceCategoryText = " " + wordCategoryText = "W" +) + +var ( + ecmaSpace = []rune{0x0009, 0x000e, 0x0020, 0x0021, 0x00a0, 0x00a1, 0x1680, 0x1681, 0x2000, 0x200b, 0x2028, 0x202a, 0x202f, 0x2030, 0x205f, 0x2060, 0x3000, 0x3001, 0xfeff, 0xff00} + ecmaWord = []rune{0x0030, 0x003a, 0x0041, 0x005b, 0x005f, 0x0060, 0x0061, 0x007b} + ecmaDigit = []rune{0x0030, 0x003a} +) + +var ( + AnyClass = getCharSetFromOldString([]rune{0}, false) + ECMAAnyClass = getCharSetFromOldString([]rune{0, 0x000a, 0x000b, 0x000d, 0x000e}, false) + NoneClass = getCharSetFromOldString(nil, false) + ECMAWordClass = getCharSetFromOldString(ecmaWord, false) + NotECMAWordClass = getCharSetFromOldString(ecmaWord, true) + ECMASpaceClass = getCharSetFromOldString(ecmaSpace, false) + NotECMASpaceClass = getCharSetFromOldString(ecmaSpace, true) + ECMADigitClass = getCharSetFromOldString(ecmaDigit, false) + NotECMADigitClass = getCharSetFromOldString(ecmaDigit, true) + + WordClass = getCharSetFromCategoryString(false, false, wordCategoryText) + NotWordClass = getCharSetFromCategoryString(true, false, wordCategoryText) + SpaceClass = getCharSetFromCategoryString(false, false, spaceCategoryText) + NotSpaceClass = getCharSetFromCategoryString(true, false, spaceCategoryText) + DigitClass = getCharSetFromCategoryString(false, false, "Nd") + NotDigitClass = getCharSetFromCategoryString(false, true, "Nd") +) + +var unicodeCategories = func() map[string]*unicode.RangeTable { + retVal := make(map[string]*unicode.RangeTable) + for k, v := range unicode.Scripts { + retVal[k] = v + } + for k, v := range unicode.Categories { + retVal[k] = v + } + for k, v := range unicode.Properties { + retVal[k] = v + } + return retVal +}() + +func getCharSetFromCategoryString(negateSet bool, negateCat bool, cats ...string) func() *CharSet { + if negateCat && negateSet { + panic("BUG! You should only negate the set OR the category in a constant setup, but not both") + } + + c := CharSet{negate: negateSet} + + c.categories = make([]category, len(cats)) + for i, cat := range cats { + c.categories[i] = category{cat: cat, negate: negateCat} + } + return func() *CharSet { + //make a copy each time + local := c + //return that address + return &local + } +} + +func getCharSetFromOldString(setText []rune, negate bool) func() *CharSet { + c := CharSet{} + if len(setText) > 0 { + fillFirst := false + l := len(setText) + if negate { + if setText[0] == 0 { + setText = setText[1:] + } else { + l++ + fillFirst = true + } + } + + if l%2 == 0 { + c.ranges = make([]singleRange, l/2) + } else { + c.ranges = make([]singleRange, l/2+1) + } + + first := true + if fillFirst { + c.ranges[0] = singleRange{first: 0} + first = false + } + + i := 0 + for _, r := range setText { + if first { + // lower bound in a new range + c.ranges[i] = singleRange{first: r} + first = false + } else { + c.ranges[i].last = r - 1 + i++ + first = true + } + } + if !first { + c.ranges[i].last = utf8.MaxRune + } + } + + return func() *CharSet { + local := c + return &local + } +} + +// Copy makes a deep copy to prevent accidental mutation of a set +func (c CharSet) Copy() CharSet { + ret := CharSet{ + anything: c.anything, + negate: c.negate, + } + + ret.ranges = append(ret.ranges, c.ranges...) + ret.categories = append(ret.categories, c.categories...) + + if c.sub != nil { + sub := c.sub.Copy() + ret.sub = &sub + } + + return ret +} + +// gets a human-readable description for a set string +func (c CharSet) String() string { + buf := &bytes.Buffer{} + buf.WriteRune('[') + + if c.IsNegated() { + buf.WriteRune('^') + } + + for _, r := range c.ranges { + + buf.WriteString(CharDescription(r.first)) + if r.first != r.last { + if r.last-r.first != 1 { + //groups that are 1 char apart skip the dash + buf.WriteRune('-') + } + buf.WriteString(CharDescription(r.last)) + } + } + + for _, c := range c.categories { + buf.WriteString(c.String()) + } + + if c.sub != nil { + buf.WriteRune('-') + buf.WriteString(c.sub.String()) + } + + buf.WriteRune(']') + + return buf.String() +} + +// mapHashFill converts a charset into a buffer for use in maps +func (c CharSet) mapHashFill(buf *bytes.Buffer) { + if c.negate { + buf.WriteByte(0) + } else { + buf.WriteByte(1) + } + + binary.Write(buf, binary.LittleEndian, len(c.ranges)) + binary.Write(buf, binary.LittleEndian, len(c.categories)) + for _, r := range c.ranges { + buf.WriteRune(r.first) + buf.WriteRune(r.last) + } + for _, ct := range c.categories { + buf.WriteString(ct.cat) + if ct.negate { + buf.WriteByte(1) + } else { + buf.WriteByte(0) + } + } + + if c.sub != nil { + c.sub.mapHashFill(buf) + } +} + +// CharIn returns true if the rune is in our character set (either ranges or categories). +// It handles negations and subtracted sub-charsets. +func (c CharSet) CharIn(ch rune) bool { + val := false + // in s && !s.subtracted + + //check ranges + for _, r := range c.ranges { + if ch < r.first { + continue + } + if ch <= r.last { + val = true + break + } + } + + //check categories if we haven't already found a range + if !val && len(c.categories) > 0 { + for _, ct := range c.categories { + // special categories...then unicode + if ct.cat == spaceCategoryText { + if unicode.IsSpace(ch) { + // we found a space so we're done + // negate means this is a "bad" thing + val = !ct.negate + break + } else if ct.negate { + val = true + break + } + } else if ct.cat == wordCategoryText { + if IsWordChar(ch) { + val = !ct.negate + break + } else if ct.negate { + val = true + break + } + } else if unicode.Is(unicodeCategories[ct.cat], ch) { + // if we're in this unicode category then we're done + // if negate=true on this category then we "failed" our test + // otherwise we're good that we found it + val = !ct.negate + break + } else if ct.negate { + val = true + break + } + } + } + + // negate the whole char set + if c.negate { + val = !val + } + + // get subtracted recurse + if val && c.sub != nil { + val = !c.sub.CharIn(ch) + } + + //log.Printf("Char '%v' in %v == %v", string(ch), c.String(), val) + return val +} + +func (c category) String() string { + switch c.cat { + case spaceCategoryText: + if c.negate { + return "\\S" + } + return "\\s" + case wordCategoryText: + if c.negate { + return "\\W" + } + return "\\w" + } + if _, ok := unicodeCategories[c.cat]; ok { + + if c.negate { + return "\\P{" + c.cat + "}" + } + return "\\p{" + c.cat + "}" + } + return "Unknown category: " + c.cat +} + +// CharDescription Produces a human-readable description for a single character. +func CharDescription(ch rune) string { + /*if ch == '\\' { + return "\\\\" + } + + if ch > ' ' && ch <= '~' { + return string(ch) + } else if ch == '\n' { + return "\\n" + } else if ch == ' ' { + return "\\ " + }*/ + + b := &bytes.Buffer{} + escape(b, ch, false) //fmt.Sprintf("%U", ch) + return b.String() +} + +// According to UTS#18 Unicode Regular Expressions (http://www.unicode.org/reports/tr18/) +// RL 1.4 Simple Word Boundaries The class of includes all Alphabetic +// values from the Unicode character database, from UnicodeData.txt [UData], plus the U+200C +// ZERO WIDTH NON-JOINER and U+200D ZERO WIDTH JOINER. +func IsWordChar(r rune) bool { + //"L", "Mn", "Nd", "Pc" + return unicode.In(r, + unicode.Categories["L"], unicode.Categories["Mn"], + unicode.Categories["Nd"], unicode.Categories["Pc"]) || r == '\u200D' || r == '\u200C' + //return 'A' <= r && r <= 'Z' || 'a' <= r && r <= 'z' || '0' <= r && r <= '9' || r == '_' +} + +func IsECMAWordChar(r rune) bool { + return unicode.In(r, + unicode.Categories["L"], unicode.Categories["Mn"], + unicode.Categories["Nd"], unicode.Categories["Pc"]) + + //return 'A' <= r && r <= 'Z' || 'a' <= r && r <= 'z' || '0' <= r && r <= '9' || r == '_' +} + +// SingletonChar will return the char from the first range without validation. +// It assumes you have checked for IsSingleton or IsSingletonInverse and will panic given bad input +func (c CharSet) SingletonChar() rune { + return c.ranges[0].first +} + +func (c CharSet) IsSingleton() bool { + return !c.negate && //negated is multiple chars + len(c.categories) == 0 && len(c.ranges) == 1 && // multiple ranges and unicode classes represent multiple chars + c.sub == nil && // subtraction means we've got multiple chars + c.ranges[0].first == c.ranges[0].last // first and last equal means we're just 1 char +} + +func (c CharSet) IsSingletonInverse() bool { + return c.negate && //same as above, but requires negated + len(c.categories) == 0 && len(c.ranges) == 1 && // multiple ranges and unicode classes represent multiple chars + c.sub == nil && // subtraction means we've got multiple chars + c.ranges[0].first == c.ranges[0].last // first and last equal means we're just 1 char +} + +func (c CharSet) IsMergeable() bool { + return !c.IsNegated() && !c.HasSubtraction() +} + +func (c CharSet) IsNegated() bool { + return c.negate +} + +func (c CharSet) HasSubtraction() bool { + return c.sub != nil +} + +func (c CharSet) IsEmpty() bool { + return len(c.ranges) == 0 && len(c.categories) == 0 && c.sub == nil +} + +func (c *CharSet) addDigit(ecma, negate bool, pattern string) { + if ecma { + if negate { + c.addRanges(NotECMADigitClass().ranges) + } else { + c.addRanges(ECMADigitClass().ranges) + } + } else { + c.addCategories(category{cat: "Nd", negate: negate}) + } +} + +func (c *CharSet) addChar(ch rune) { + c.addRange(ch, ch) +} + +func (c *CharSet) addSpace(ecma, negate bool) { + if ecma { + if negate { + c.addRanges(NotECMASpaceClass().ranges) + } else { + c.addRanges(ECMASpaceClass().ranges) + } + } else { + c.addCategories(category{cat: spaceCategoryText, negate: negate}) + } +} + +func (c *CharSet) addWord(ecma, negate bool) { + if ecma { + if negate { + c.addRanges(NotECMAWordClass().ranges) + } else { + c.addRanges(ECMAWordClass().ranges) + } + } else { + c.addCategories(category{cat: wordCategoryText, negate: negate}) + } +} + +// Add set ranges and categories into ours -- no deduping or anything +func (c *CharSet) addSet(set CharSet) { + if c.anything { + return + } + if set.anything { + c.makeAnything() + return + } + // just append here to prevent double-canon + c.ranges = append(c.ranges, set.ranges...) + c.addCategories(set.categories...) + c.canonicalize() +} + +func (c *CharSet) makeAnything() { + c.anything = true + c.categories = []category{} + c.ranges = AnyClass().ranges +} + +func (c *CharSet) addCategories(cats ...category) { + // don't add dupes and remove positive+negative + if c.anything { + // if we've had a previous positive+negative group then + // just return, we're as broad as we can get + return + } + + for _, ct := range cats { + found := false + for _, ct2 := range c.categories { + if ct.cat == ct2.cat { + if ct.negate != ct2.negate { + // oposite negations...this mean we just + // take us as anything and move on + c.makeAnything() + return + } + found = true + break + } + } + + if !found { + c.categories = append(c.categories, ct) + } + } +} + +// Merges new ranges to our own +func (c *CharSet) addRanges(ranges []singleRange) { + if c.anything { + return + } + c.ranges = append(c.ranges, ranges...) + c.canonicalize() +} + +func isValidUnicodeCat(catName string) bool { + _, ok := unicodeCategories[catName] + return ok +} + +func (c *CharSet) addCategory(categoryName string, negate, caseInsensitive bool, pattern string) { + if !isValidUnicodeCat(categoryName) { + // unknown unicode category, script, or property "blah" + panic(fmt.Errorf("Unknown unicode category, script, or property '%v'", categoryName)) + + } + + if caseInsensitive && (categoryName == "Ll" || categoryName == "Lu" || categoryName == "Lt") { + // when RegexOptions.IgnoreCase is specified then {Ll} {Lu} and {Lt} cases should all match + c.addCategories( + category{cat: "Ll", negate: negate}, + category{cat: "Lu", negate: negate}, + category{cat: "Lt", negate: negate}) + } + c.addCategories(category{cat: categoryName, negate: negate}) +} + +func (c *CharSet) addSubtraction(sub *CharSet) { + c.sub = sub +} + +func (c *CharSet) addRange(chMin, chMax rune) { + c.ranges = append(c.ranges, singleRange{first: chMin, last: chMax}) + c.canonicalize() +} + +type singleRangeSorter []singleRange + +func (p singleRangeSorter) Len() int { return len(p) } +func (p singleRangeSorter) Less(i, j int) bool { return p[i].first < p[j].first } +func (p singleRangeSorter) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +// Logic to reduce a character class to a unique, sorted form. +func (c *CharSet) canonicalize() { + var i, j int + var last rune + + // + // Find and eliminate overlapping or abutting ranges + // + + if len(c.ranges) > 1 { + sort.Sort(singleRangeSorter(c.ranges)) + + done := false + + for i, j = 1, 0; ; i++ { + for last = c.ranges[j].last; ; i++ { + if i == len(c.ranges) || last == utf8.MaxRune { + done = true + break + } + + CurrentRange := c.ranges[i] + if CurrentRange.first > last+1 { + break + } + + if last < CurrentRange.last { + last = CurrentRange.last + } + } + + c.ranges[j] = singleRange{first: c.ranges[j].first, last: last} + + j++ + + if done { + break + } + + if j < i { + c.ranges[j] = c.ranges[i] + } + } + + c.ranges = append(c.ranges[:j], c.ranges[len(c.ranges):]...) + } +} + +// Adds to the class any lowercase versions of characters already +// in the class. Used for case-insensitivity. +func (c *CharSet) addLowercase() { + if c.anything { + return + } + toAdd := []singleRange{} + for i := 0; i < len(c.ranges); i++ { + r := c.ranges[i] + if r.first == r.last { + lower := unicode.ToLower(r.first) + c.ranges[i] = singleRange{first: lower, last: lower} + } else { + toAdd = append(toAdd, r) + } + } + + for _, r := range toAdd { + c.addLowercaseRange(r.first, r.last) + } + c.canonicalize() +} + +/************************************************************************** + Let U be the set of Unicode character values and let L be the lowercase + function, mapping from U to U. To perform case insensitive matching of + character sets, we need to be able to map an interval I in U, say + + I = [chMin, chMax] = { ch : chMin <= ch <= chMax } + + to a set A such that A contains L(I) and A is contained in the union of + I and L(I). + + The table below partitions U into intervals on which L is non-decreasing. + Thus, for any interval J = [a, b] contained in one of these intervals, + L(J) is contained in [L(a), L(b)]. + + It is also true that for any such J, [L(a), L(b)] is contained in the + union of J and L(J). This does not follow from L being non-decreasing on + these intervals. It follows from the nature of the L on each interval. + On each interval, L has one of the following forms: + + (1) L(ch) = constant (LowercaseSet) + (2) L(ch) = ch + offset (LowercaseAdd) + (3) L(ch) = ch | 1 (LowercaseBor) + (4) L(ch) = ch + (ch & 1) (LowercaseBad) + + It is easy to verify that for any of these forms [L(a), L(b)] is + contained in the union of [a, b] and L([a, b]). +***************************************************************************/ + +const ( + LowercaseSet = 0 // Set to arg. + LowercaseAdd = 1 // Add arg. + LowercaseBor = 2 // Bitwise or with 1. + LowercaseBad = 3 // Bitwise and with 1 and add original. +) + +type lcMap struct { + chMin, chMax rune + op, data int32 +} + +var lcTable = []lcMap{ + lcMap{'\u0041', '\u005A', LowercaseAdd, 32}, + lcMap{'\u00C0', '\u00DE', LowercaseAdd, 32}, + lcMap{'\u0100', '\u012E', LowercaseBor, 0}, + lcMap{'\u0130', '\u0130', LowercaseSet, 0x0069}, + lcMap{'\u0132', '\u0136', LowercaseBor, 0}, + lcMap{'\u0139', '\u0147', LowercaseBad, 0}, + lcMap{'\u014A', '\u0176', LowercaseBor, 0}, + lcMap{'\u0178', '\u0178', LowercaseSet, 0x00FF}, + lcMap{'\u0179', '\u017D', LowercaseBad, 0}, + lcMap{'\u0181', '\u0181', LowercaseSet, 0x0253}, + lcMap{'\u0182', '\u0184', LowercaseBor, 0}, + lcMap{'\u0186', '\u0186', LowercaseSet, 0x0254}, + lcMap{'\u0187', '\u0187', LowercaseSet, 0x0188}, + lcMap{'\u0189', '\u018A', LowercaseAdd, 205}, + lcMap{'\u018B', '\u018B', LowercaseSet, 0x018C}, + lcMap{'\u018E', '\u018E', LowercaseSet, 0x01DD}, + lcMap{'\u018F', '\u018F', LowercaseSet, 0x0259}, + lcMap{'\u0190', '\u0190', LowercaseSet, 0x025B}, + lcMap{'\u0191', '\u0191', LowercaseSet, 0x0192}, + lcMap{'\u0193', '\u0193', LowercaseSet, 0x0260}, + lcMap{'\u0194', '\u0194', LowercaseSet, 0x0263}, + lcMap{'\u0196', '\u0196', LowercaseSet, 0x0269}, + lcMap{'\u0197', '\u0197', LowercaseSet, 0x0268}, + lcMap{'\u0198', '\u0198', LowercaseSet, 0x0199}, + lcMap{'\u019C', '\u019C', LowercaseSet, 0x026F}, + lcMap{'\u019D', '\u019D', LowercaseSet, 0x0272}, + lcMap{'\u019F', '\u019F', LowercaseSet, 0x0275}, + lcMap{'\u01A0', '\u01A4', LowercaseBor, 0}, + lcMap{'\u01A7', '\u01A7', LowercaseSet, 0x01A8}, + lcMap{'\u01A9', '\u01A9', LowercaseSet, 0x0283}, + lcMap{'\u01AC', '\u01AC', LowercaseSet, 0x01AD}, + lcMap{'\u01AE', '\u01AE', LowercaseSet, 0x0288}, + lcMap{'\u01AF', '\u01AF', LowercaseSet, 0x01B0}, + lcMap{'\u01B1', '\u01B2', LowercaseAdd, 217}, + lcMap{'\u01B3', '\u01B5', LowercaseBad, 0}, + lcMap{'\u01B7', '\u01B7', LowercaseSet, 0x0292}, + lcMap{'\u01B8', '\u01B8', LowercaseSet, 0x01B9}, + lcMap{'\u01BC', '\u01BC', LowercaseSet, 0x01BD}, + lcMap{'\u01C4', '\u01C5', LowercaseSet, 0x01C6}, + lcMap{'\u01C7', '\u01C8', LowercaseSet, 0x01C9}, + lcMap{'\u01CA', '\u01CB', LowercaseSet, 0x01CC}, + lcMap{'\u01CD', '\u01DB', LowercaseBad, 0}, + lcMap{'\u01DE', '\u01EE', LowercaseBor, 0}, + lcMap{'\u01F1', '\u01F2', LowercaseSet, 0x01F3}, + lcMap{'\u01F4', '\u01F4', LowercaseSet, 0x01F5}, + lcMap{'\u01FA', '\u0216', LowercaseBor, 0}, + lcMap{'\u0386', '\u0386', LowercaseSet, 0x03AC}, + lcMap{'\u0388', '\u038A', LowercaseAdd, 37}, + lcMap{'\u038C', '\u038C', LowercaseSet, 0x03CC}, + lcMap{'\u038E', '\u038F', LowercaseAdd, 63}, + lcMap{'\u0391', '\u03AB', LowercaseAdd, 32}, + lcMap{'\u03E2', '\u03EE', LowercaseBor, 0}, + lcMap{'\u0401', '\u040F', LowercaseAdd, 80}, + lcMap{'\u0410', '\u042F', LowercaseAdd, 32}, + lcMap{'\u0460', '\u0480', LowercaseBor, 0}, + lcMap{'\u0490', '\u04BE', LowercaseBor, 0}, + lcMap{'\u04C1', '\u04C3', LowercaseBad, 0}, + lcMap{'\u04C7', '\u04C7', LowercaseSet, 0x04C8}, + lcMap{'\u04CB', '\u04CB', LowercaseSet, 0x04CC}, + lcMap{'\u04D0', '\u04EA', LowercaseBor, 0}, + lcMap{'\u04EE', '\u04F4', LowercaseBor, 0}, + lcMap{'\u04F8', '\u04F8', LowercaseSet, 0x04F9}, + lcMap{'\u0531', '\u0556', LowercaseAdd, 48}, + lcMap{'\u10A0', '\u10C5', LowercaseAdd, 48}, + lcMap{'\u1E00', '\u1EF8', LowercaseBor, 0}, + lcMap{'\u1F08', '\u1F0F', LowercaseAdd, -8}, + lcMap{'\u1F18', '\u1F1F', LowercaseAdd, -8}, + lcMap{'\u1F28', '\u1F2F', LowercaseAdd, -8}, + lcMap{'\u1F38', '\u1F3F', LowercaseAdd, -8}, + lcMap{'\u1F48', '\u1F4D', LowercaseAdd, -8}, + lcMap{'\u1F59', '\u1F59', LowercaseSet, 0x1F51}, + lcMap{'\u1F5B', '\u1F5B', LowercaseSet, 0x1F53}, + lcMap{'\u1F5D', '\u1F5D', LowercaseSet, 0x1F55}, + lcMap{'\u1F5F', '\u1F5F', LowercaseSet, 0x1F57}, + lcMap{'\u1F68', '\u1F6F', LowercaseAdd, -8}, + lcMap{'\u1F88', '\u1F8F', LowercaseAdd, -8}, + lcMap{'\u1F98', '\u1F9F', LowercaseAdd, -8}, + lcMap{'\u1FA8', '\u1FAF', LowercaseAdd, -8}, + lcMap{'\u1FB8', '\u1FB9', LowercaseAdd, -8}, + lcMap{'\u1FBA', '\u1FBB', LowercaseAdd, -74}, + lcMap{'\u1FBC', '\u1FBC', LowercaseSet, 0x1FB3}, + lcMap{'\u1FC8', '\u1FCB', LowercaseAdd, -86}, + lcMap{'\u1FCC', '\u1FCC', LowercaseSet, 0x1FC3}, + lcMap{'\u1FD8', '\u1FD9', LowercaseAdd, -8}, + lcMap{'\u1FDA', '\u1FDB', LowercaseAdd, -100}, + lcMap{'\u1FE8', '\u1FE9', LowercaseAdd, -8}, + lcMap{'\u1FEA', '\u1FEB', LowercaseAdd, -112}, + lcMap{'\u1FEC', '\u1FEC', LowercaseSet, 0x1FE5}, + lcMap{'\u1FF8', '\u1FF9', LowercaseAdd, -128}, + lcMap{'\u1FFA', '\u1FFB', LowercaseAdd, -126}, + lcMap{'\u1FFC', '\u1FFC', LowercaseSet, 0x1FF3}, + lcMap{'\u2160', '\u216F', LowercaseAdd, 16}, + lcMap{'\u24B6', '\u24D0', LowercaseAdd, 26}, + lcMap{'\uFF21', '\uFF3A', LowercaseAdd, 32}, +} + +func (c *CharSet) addLowercaseRange(chMin, chMax rune) { + var i, iMax, iMid int + var chMinT, chMaxT rune + var lc lcMap + + for i, iMax = 0, len(lcTable); i < iMax; { + iMid = (i + iMax) / 2 + if lcTable[iMid].chMax < chMin { + i = iMid + 1 + } else { + iMax = iMid + } + } + + for ; i < len(lcTable); i++ { + lc = lcTable[i] + if lc.chMin > chMax { + return + } + chMinT = lc.chMin + if chMinT < chMin { + chMinT = chMin + } + + chMaxT = lc.chMax + if chMaxT > chMax { + chMaxT = chMax + } + + switch lc.op { + case LowercaseSet: + chMinT = rune(lc.data) + chMaxT = rune(lc.data) + break + case LowercaseAdd: + chMinT += lc.data + chMaxT += lc.data + break + case LowercaseBor: + chMinT |= 1 + chMaxT |= 1 + break + case LowercaseBad: + chMinT += (chMinT & 1) + chMaxT += (chMaxT & 1) + break + } + + if chMinT < chMin || chMaxT > chMax { + c.addRange(chMinT, chMaxT) + } + } +} diff --git a/vendor/github.com/dlclark/regexp2/syntax/code.go b/vendor/github.com/dlclark/regexp2/syntax/code.go new file mode 100644 index 000000000..686e822af --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/syntax/code.go @@ -0,0 +1,274 @@ +package syntax + +import ( + "bytes" + "fmt" + "math" +) + +// similar to prog.go in the go regex package...also with comment 'may not belong in this package' + +// File provides operator constants for use by the Builder and the Machine. + +// Implementation notes: +// +// Regexps are built into RegexCodes, which contain an operation array, +// a string table, and some constants. +// +// Each operation is one of the codes below, followed by the integer +// operands specified for each op. +// +// Strings and sets are indices into a string table. + +type InstOp int + +const ( + // lef/back operands description + + Onerep InstOp = 0 // lef,back char,min,max a {n} + Notonerep = 1 // lef,back char,min,max .{n} + Setrep = 2 // lef,back set,min,max [\d]{n} + + Oneloop = 3 // lef,back char,min,max a {,n} + Notoneloop = 4 // lef,back char,min,max .{,n} + Setloop = 5 // lef,back set,min,max [\d]{,n} + + Onelazy = 6 // lef,back char,min,max a {,n}? + Notonelazy = 7 // lef,back char,min,max .{,n}? + Setlazy = 8 // lef,back set,min,max [\d]{,n}? + + One = 9 // lef char a + Notone = 10 // lef char [^a] + Set = 11 // lef set [a-z\s] \w \s \d + + Multi = 12 // lef string abcd + Ref = 13 // lef group \# + + Bol = 14 // ^ + Eol = 15 // $ + Boundary = 16 // \b + Nonboundary = 17 // \B + Beginning = 18 // \A + Start = 19 // \G + EndZ = 20 // \Z + End = 21 // \Z + + Nothing = 22 // Reject! + + // Primitive control structures + + Lazybranch = 23 // back jump straight first + Branchmark = 24 // back jump branch first for loop + Lazybranchmark = 25 // back jump straight first for loop + Nullcount = 26 // back val set counter, null mark + Setcount = 27 // back val set counter, make mark + Branchcount = 28 // back jump,limit branch++ if zero<=c impl group slots + Capsize int // number of impl group slots + FcPrefix *Prefix // the set of candidate first characters (may be null) + BmPrefix *BmPrefix // the fixed prefix string as a Boyer-Moore machine (may be null) + Anchors AnchorLoc // the set of zero-length start anchors (RegexFCD.Bol, etc) + RightToLeft bool // true if right to left +} + +func opcodeBacktracks(op InstOp) bool { + op &= Mask + + switch op { + case Oneloop, Notoneloop, Setloop, Onelazy, Notonelazy, Setlazy, Lazybranch, Branchmark, Lazybranchmark, + Nullcount, Setcount, Branchcount, Lazybranchcount, Setmark, Capturemark, Getmark, Setjump, Backjump, + Forejump, Goto: + return true + + default: + return false + } +} + +func opcodeSize(op InstOp) int { + op &= Mask + + switch op { + case Nothing, Bol, Eol, Boundary, Nonboundary, ECMABoundary, NonECMABoundary, Beginning, Start, EndZ, + End, Nullmark, Setmark, Getmark, Setjump, Backjump, Forejump, Stop: + return 1 + + case One, Notone, Multi, Ref, Testref, Goto, Nullcount, Setcount, Lazybranch, Branchmark, Lazybranchmark, + Prune, Set: + return 2 + + case Capturemark, Branchcount, Lazybranchcount, Onerep, Notonerep, Oneloop, Notoneloop, Onelazy, Notonelazy, + Setlazy, Setrep, Setloop: + return 3 + + default: + panic(fmt.Errorf("Unexpected op code: %v", op)) + } +} + +var codeStr = []string{ + "Onerep", "Notonerep", "Setrep", + "Oneloop", "Notoneloop", "Setloop", + "Onelazy", "Notonelazy", "Setlazy", + "One", "Notone", "Set", + "Multi", "Ref", + "Bol", "Eol", "Boundary", "Nonboundary", "Beginning", "Start", "EndZ", "End", + "Nothing", + "Lazybranch", "Branchmark", "Lazybranchmark", + "Nullcount", "Setcount", "Branchcount", "Lazybranchcount", + "Nullmark", "Setmark", "Capturemark", "Getmark", + "Setjump", "Backjump", "Forejump", "Testref", "Goto", + "Prune", "Stop", + "ECMABoundary", "NonECMABoundary", +} + +func operatorDescription(op InstOp) string { + desc := codeStr[op&Mask] + if (op & Ci) != 0 { + desc += "-Ci" + } + if (op & Rtl) != 0 { + desc += "-Rtl" + } + if (op & Back) != 0 { + desc += "-Back" + } + if (op & Back2) != 0 { + desc += "-Back2" + } + + return desc +} + +// OpcodeDescription is a humman readable string of the specific offset +func (c *Code) OpcodeDescription(offset int) string { + buf := &bytes.Buffer{} + + op := InstOp(c.Codes[offset]) + fmt.Fprintf(buf, "%06d ", offset) + + if opcodeBacktracks(op & Mask) { + buf.WriteString("*") + } else { + buf.WriteString(" ") + } + buf.WriteString(operatorDescription(op)) + buf.WriteString("(") + op &= Mask + + switch op { + case One, Notone, Onerep, Notonerep, Oneloop, Notoneloop, Onelazy, Notonelazy: + buf.WriteString("Ch = ") + buf.WriteString(CharDescription(rune(c.Codes[offset+1]))) + + case Set, Setrep, Setloop, Setlazy: + buf.WriteString("Set = ") + buf.WriteString(c.Sets[c.Codes[offset+1]].String()) + + case Multi: + fmt.Fprintf(buf, "String = %s", string(c.Strings[c.Codes[offset+1]])) + + case Ref, Testref: + fmt.Fprintf(buf, "Index = %d", c.Codes[offset+1]) + + case Capturemark: + fmt.Fprintf(buf, "Index = %d", c.Codes[offset+1]) + if c.Codes[offset+2] != -1 { + fmt.Fprintf(buf, ", Unindex = %d", c.Codes[offset+2]) + } + + case Nullcount, Setcount: + fmt.Fprintf(buf, "Value = %d", c.Codes[offset+1]) + + case Goto, Lazybranch, Branchmark, Lazybranchmark, Branchcount, Lazybranchcount: + fmt.Fprintf(buf, "Addr = %d", c.Codes[offset+1]) + } + + switch op { + case Onerep, Notonerep, Oneloop, Notoneloop, Onelazy, Notonelazy, Setrep, Setloop, Setlazy: + buf.WriteString(", Rep = ") + if c.Codes[offset+2] == math.MaxInt32 { + buf.WriteString("inf") + } else { + fmt.Fprintf(buf, "%d", c.Codes[offset+2]) + } + + case Branchcount, Lazybranchcount: + buf.WriteString(", Limit = ") + if c.Codes[offset+2] == math.MaxInt32 { + buf.WriteString("inf") + } else { + fmt.Fprintf(buf, "%d", c.Codes[offset+2]) + } + + } + + buf.WriteString(")") + + return buf.String() +} + +func (c *Code) Dump() string { + buf := &bytes.Buffer{} + + if c.RightToLeft { + fmt.Fprintln(buf, "Direction: right-to-left") + } else { + fmt.Fprintln(buf, "Direction: left-to-right") + } + if c.FcPrefix == nil { + fmt.Fprintln(buf, "Firstchars: n/a") + } else { + fmt.Fprintf(buf, "Firstchars: %v\n", c.FcPrefix.PrefixSet.String()) + } + + if c.BmPrefix == nil { + fmt.Fprintln(buf, "Prefix: n/a") + } else { + fmt.Fprintf(buf, "Prefix: %v\n", Escape(c.BmPrefix.String())) + } + + fmt.Fprintf(buf, "Anchors: %v\n", c.Anchors) + fmt.Fprintln(buf) + + if c.BmPrefix != nil { + fmt.Fprintln(buf, "BoyerMoore:") + fmt.Fprintln(buf, c.BmPrefix.Dump(" ")) + } + for i := 0; i < len(c.Codes); i += opcodeSize(InstOp(c.Codes[i])) { + fmt.Fprintln(buf, c.OpcodeDescription(i)) + } + + return buf.String() +} diff --git a/vendor/github.com/dlclark/regexp2/syntax/escape.go b/vendor/github.com/dlclark/regexp2/syntax/escape.go new file mode 100644 index 000000000..609df1073 --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/syntax/escape.go @@ -0,0 +1,94 @@ +package syntax + +import ( + "bytes" + "strconv" + "strings" + "unicode" +) + +func Escape(input string) string { + b := &bytes.Buffer{} + for _, r := range input { + escape(b, r, false) + } + return b.String() +} + +const meta = `\.+*?()|[]{}^$# ` + +func escape(b *bytes.Buffer, r rune, force bool) { + if unicode.IsPrint(r) { + if strings.IndexRune(meta, r) >= 0 || force { + b.WriteRune('\\') + } + b.WriteRune(r) + return + } + + switch r { + case '\a': + b.WriteString(`\a`) + case '\f': + b.WriteString(`\f`) + case '\n': + b.WriteString(`\n`) + case '\r': + b.WriteString(`\r`) + case '\t': + b.WriteString(`\t`) + case '\v': + b.WriteString(`\v`) + default: + if r < 0x100 { + b.WriteString(`\x`) + s := strconv.FormatInt(int64(r), 16) + if len(s) == 1 { + b.WriteRune('0') + } + b.WriteString(s) + break + } + b.WriteString(`\u`) + b.WriteString(strconv.FormatInt(int64(r), 16)) + } +} + +func Unescape(input string) (string, error) { + idx := strings.IndexRune(input, '\\') + // no slashes means no unescape needed + if idx == -1 { + return input, nil + } + + buf := bytes.NewBufferString(input[:idx]) + // get the runes for the rest of the string -- we're going full parser scan on this + + p := parser{} + p.setPattern(input[idx+1:]) + for { + if p.rightMost() { + return "", p.getErr(ErrIllegalEndEscape) + } + r, err := p.scanCharEscape() + if err != nil { + return "", err + } + buf.WriteRune(r) + // are we done? + if p.rightMost() { + return buf.String(), nil + } + + r = p.moveRightGetChar() + for r != '\\' { + buf.WriteRune(r) + if p.rightMost() { + // we're done, no more slashes + return buf.String(), nil + } + // keep scanning until we get another slash + r = p.moveRightGetChar() + } + } +} diff --git a/vendor/github.com/dlclark/regexp2/syntax/fuzz.go b/vendor/github.com/dlclark/regexp2/syntax/fuzz.go new file mode 100644 index 000000000..ee863866d --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/syntax/fuzz.go @@ -0,0 +1,20 @@ +// +build gofuzz + +package syntax + +// Fuzz is the input point for go-fuzz +func Fuzz(data []byte) int { + sdata := string(data) + tree, err := Parse(sdata, RegexOptions(0)) + if err != nil { + return 0 + } + + // translate it to code + _, err = Write(tree) + if err != nil { + panic(err) + } + + return 1 +} diff --git a/vendor/github.com/dlclark/regexp2/syntax/parser.go b/vendor/github.com/dlclark/regexp2/syntax/parser.go new file mode 100644 index 000000000..6e8ea8348 --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/syntax/parser.go @@ -0,0 +1,2125 @@ +package syntax + +import ( + "fmt" + "math" + "os" + "sort" + "strconv" + "unicode" +) + +type RegexOptions int32 + +const ( + IgnoreCase RegexOptions = 0x0001 // "i" + Multiline = 0x0002 // "m" + ExplicitCapture = 0x0004 // "n" + Compiled = 0x0008 // "c" + Singleline = 0x0010 // "s" + IgnorePatternWhitespace = 0x0020 // "x" + RightToLeft = 0x0040 // "r" + Debug = 0x0080 // "d" + ECMAScript = 0x0100 // "e" +) + +func optionFromCode(ch rune) RegexOptions { + // case-insensitive + switch ch { + case 'i', 'I': + return IgnoreCase + case 'r', 'R': + return RightToLeft + case 'm', 'M': + return Multiline + case 'n', 'N': + return ExplicitCapture + case 's', 'S': + return Singleline + case 'x', 'X': + return IgnorePatternWhitespace + case 'd', 'D': + return Debug + case 'e', 'E': + return ECMAScript + default: + return 0 + } +} + +// An Error describes a failure to parse a regular expression +// and gives the offending expression. +type Error struct { + Code ErrorCode + Expr string + Args []interface{} +} + +func (e *Error) Error() string { + if len(e.Args) == 0 { + return "error parsing regexp: " + e.Code.String() + " in `" + e.Expr + "`" + } + return "error parsing regexp: " + fmt.Sprintf(e.Code.String(), e.Args...) + " in `" + e.Expr + "`" +} + +// An ErrorCode describes a failure to parse a regular expression. +type ErrorCode string + +const ( + // internal issue + ErrInternalError ErrorCode = "regexp/syntax: internal error" + // Parser errors + ErrUnterminatedComment = "unterminated comment" + ErrInvalidCharRange = "invalid character class range" + ErrInvalidRepeatSize = "invalid repeat count" + ErrInvalidUTF8 = "invalid UTF-8" + ErrCaptureGroupOutOfRange = "capture group number out of range" + ErrUnexpectedParen = "unexpected )" + ErrMissingParen = "missing closing )" + ErrMissingBrace = "missing closing }" + ErrInvalidRepeatOp = "invalid nested repetition operator" + ErrMissingRepeatArgument = "missing argument to repetition operator" + ErrConditionalExpression = "illegal conditional (?(...)) expression" + ErrTooManyAlternates = "too many | in (?()|)" + ErrUnrecognizedGrouping = "unrecognized grouping construct: (%v" + ErrInvalidGroupName = "invalid group name: group names must begin with a word character and have a matching terminator" + ErrCapNumNotZero = "capture number cannot be zero" + ErrUndefinedBackRef = "reference to undefined group number %v" + ErrUndefinedNameRef = "reference to undefined group name %v" + ErrAlternationCantCapture = "alternation conditions do not capture and cannot be named" + ErrAlternationCantHaveComment = "alternation conditions cannot be comments" + ErrMalformedReference = "(?(%v) ) malformed" + ErrUndefinedReference = "(?(%v) ) reference to undefined group" + ErrIllegalEndEscape = "illegal \\ at end of pattern" + ErrMalformedSlashP = "malformed \\p{X} character escape" + ErrIncompleteSlashP = "incomplete \\p{X} character escape" + ErrUnknownSlashP = "unknown unicode category, script, or property '%v'" + ErrUnrecognizedEscape = "unrecognized escape sequence \\%v" + ErrMissingControl = "missing control character" + ErrUnrecognizedControl = "unrecognized control character" + ErrTooFewHex = "insufficient hexadecimal digits" + ErrInvalidHex = "hex values may not be larger than 0x10FFFF" + ErrMalformedNameRef = "malformed \\k<...> named back reference" + ErrBadClassInCharRange = "cannot include class \\%v in character range" + ErrUnterminatedBracket = "unterminated [] set" + ErrSubtractionMustBeLast = "a subtraction must be the last element in a character class" + ErrReversedCharRange = "[x-y] range in reverse order" +) + +func (e ErrorCode) String() string { + return string(e) +} + +type parser struct { + stack *regexNode + group *regexNode + alternation *regexNode + concatenation *regexNode + unit *regexNode + + patternRaw string + pattern []rune + + currentPos int + specialCase *unicode.SpecialCase + + autocap int + capcount int + captop int + capsize int + + caps map[int]int + capnames map[string]int + + capnumlist []int + capnamelist []string + + options RegexOptions + optionsStack []RegexOptions + ignoreNextParen bool +} + +const ( + maxValueDiv10 int = math.MaxInt32 / 10 + maxValueMod10 = math.MaxInt32 % 10 +) + +// Parse converts a regex string into a parse tree +func Parse(re string, op RegexOptions) (*RegexTree, error) { + p := parser{ + options: op, + caps: make(map[int]int), + } + p.setPattern(re) + + if err := p.countCaptures(); err != nil { + return nil, err + } + + p.reset(op) + root, err := p.scanRegex() + + if err != nil { + return nil, err + } + tree := &RegexTree{ + root: root, + caps: p.caps, + capnumlist: p.capnumlist, + captop: p.captop, + Capnames: p.capnames, + Caplist: p.capnamelist, + options: op, + } + + if tree.options&Debug > 0 { + os.Stdout.WriteString(tree.Dump()) + } + + return tree, nil +} + +func (p *parser) setPattern(pattern string) { + p.patternRaw = pattern + p.pattern = make([]rune, 0, len(pattern)) + + //populate our rune array to handle utf8 encoding + for _, r := range pattern { + p.pattern = append(p.pattern, r) + } +} +func (p *parser) getErr(code ErrorCode, args ...interface{}) error { + return &Error{Code: code, Expr: p.patternRaw, Args: args} +} + +func (p *parser) noteCaptureSlot(i, pos int) { + if _, ok := p.caps[i]; !ok { + // the rhs of the hashtable isn't used in the parser + p.caps[i] = pos + p.capcount++ + + if p.captop <= i { + if i == math.MaxInt32 { + p.captop = i + } else { + p.captop = i + 1 + } + } + } +} + +func (p *parser) noteCaptureName(name string, pos int) { + if p.capnames == nil { + p.capnames = make(map[string]int) + } + + if _, ok := p.capnames[name]; !ok { + p.capnames[name] = pos + p.capnamelist = append(p.capnamelist, name) + } +} + +func (p *parser) assignNameSlots() { + if p.capnames != nil { + for _, name := range p.capnamelist { + for p.isCaptureSlot(p.autocap) { + p.autocap++ + } + pos := p.capnames[name] + p.capnames[name] = p.autocap + p.noteCaptureSlot(p.autocap, pos) + + p.autocap++ + } + } + + // if the caps array has at least one gap, construct the list of used slots + if p.capcount < p.captop { + p.capnumlist = make([]int, p.capcount) + i := 0 + + for k := range p.caps { + p.capnumlist[i] = k + i++ + } + + sort.Ints(p.capnumlist) + } + + // merge capsnumlist into capnamelist + if p.capnames != nil || p.capnumlist != nil { + var oldcapnamelist []string + var next int + var k int + + if p.capnames == nil { + oldcapnamelist = nil + p.capnames = make(map[string]int) + p.capnamelist = []string{} + next = -1 + } else { + oldcapnamelist = p.capnamelist + p.capnamelist = []string{} + next = p.capnames[oldcapnamelist[0]] + } + + for i := 0; i < p.capcount; i++ { + j := i + if p.capnumlist != nil { + j = p.capnumlist[i] + } + + if next == j { + p.capnamelist = append(p.capnamelist, oldcapnamelist[k]) + k++ + + if k == len(oldcapnamelist) { + next = -1 + } else { + next = p.capnames[oldcapnamelist[k]] + } + + } else { + //feature: culture? + str := strconv.Itoa(j) + p.capnamelist = append(p.capnamelist, str) + p.capnames[str] = j + } + } + } +} + +func (p *parser) consumeAutocap() int { + r := p.autocap + p.autocap++ + return r +} + +// CountCaptures is a prescanner for deducing the slots used for +// captures by doing a partial tokenization of the pattern. +func (p *parser) countCaptures() error { + var ch rune + + p.noteCaptureSlot(0, 0) + + p.autocap = 1 + + for p.charsRight() > 0 { + pos := p.textpos() + ch = p.moveRightGetChar() + switch ch { + case '\\': + if p.charsRight() > 0 { + p.moveRight(1) + } + + case '#': + if p.useOptionX() { + p.moveLeft() + p.scanBlank() + } + + case '[': + p.scanCharSet(false, true) + + case ')': + if !p.emptyOptionsStack() { + p.popOptions() + } + + case '(': + if p.charsRight() >= 2 && p.rightChar(1) == '#' && p.rightChar(0) == '?' { + p.moveLeft() + p.scanBlank() + } else { + p.pushOptions() + if p.charsRight() > 0 && p.rightChar(0) == '?' { + // we have (?... + p.moveRight(1) + + if p.charsRight() > 1 && (p.rightChar(0) == '<' || p.rightChar(0) == '\'') { + // named group: (?<... or (?'... + + p.moveRight(1) + ch = p.rightChar(0) + + if ch != '0' && IsWordChar(ch) { + if ch >= '1' && ch <= '9' { + dec, err := p.scanDecimal() + if err != nil { + return err + } + p.noteCaptureSlot(dec, pos) + } else { + p.noteCaptureName(p.scanCapname(), pos) + } + } + } else { + // (?... + + // get the options if it's an option construct (?cimsx-cimsx...) + p.scanOptions() + + if p.charsRight() > 0 { + if p.rightChar(0) == ')' { + // (?cimsx-cimsx) + p.moveRight(1) + p.popKeepOptions() + } else if p.rightChar(0) == '(' { + // alternation construct: (?(foo)yes|no) + // ignore the next paren so we don't capture the condition + p.ignoreNextParen = true + + // break from here so we don't reset ignoreNextParen + continue + } + } + } + } else { + if !p.useOptionN() && !p.ignoreNextParen { + p.noteCaptureSlot(p.consumeAutocap(), pos) + } + } + } + + p.ignoreNextParen = false + + } + } + + p.assignNameSlots() + return nil +} + +func (p *parser) reset(topopts RegexOptions) { + p.currentPos = 0 + p.autocap = 1 + p.ignoreNextParen = false + + if len(p.optionsStack) > 0 { + p.optionsStack = p.optionsStack[:0] + } + + p.options = topopts + p.stack = nil +} + +func (p *parser) scanRegex() (*regexNode, error) { + ch := '@' // nonspecial ch, means at beginning + isQuant := false + + p.startGroup(newRegexNodeMN(ntCapture, p.options, 0, -1)) + + for p.charsRight() > 0 { + wasPrevQuantifier := isQuant + isQuant = false + + if err := p.scanBlank(); err != nil { + return nil, err + } + + startpos := p.textpos() + + // move past all of the normal characters. We'll stop when we hit some kind of control character, + // or if IgnorePatternWhiteSpace is on, we'll stop when we see some whitespace. + if p.useOptionX() { + for p.charsRight() > 0 { + ch = p.rightChar(0) + //UGLY: clean up, this is ugly + if !(!isStopperX(ch) || (ch == '{' && !p.isTrueQuantifier())) { + break + } + p.moveRight(1) + } + } else { + for p.charsRight() > 0 { + ch = p.rightChar(0) + if !(!isSpecial(ch) || ch == '{' && !p.isTrueQuantifier()) { + break + } + p.moveRight(1) + } + } + + endpos := p.textpos() + + p.scanBlank() + + if p.charsRight() == 0 { + ch = '!' // nonspecial, means at end + } else if ch = p.rightChar(0); isSpecial(ch) { + isQuant = isQuantifier(ch) + p.moveRight(1) + } else { + ch = ' ' // nonspecial, means at ordinary char + } + + if startpos < endpos { + cchUnquantified := endpos - startpos + if isQuant { + cchUnquantified-- + } + wasPrevQuantifier = false + + if cchUnquantified > 0 { + p.addToConcatenate(startpos, cchUnquantified, false) + } + + if isQuant { + p.addUnitOne(p.charAt(endpos - 1)) + } + } + + switch ch { + case '!': + goto BreakOuterScan + + case ' ': + goto ContinueOuterScan + + case '[': + cc, err := p.scanCharSet(p.useOptionI(), false) + if err != nil { + return nil, err + } + p.addUnitSet(cc) + + case '(': + p.pushOptions() + + if grouper, err := p.scanGroupOpen(); err != nil { + return nil, err + } else if grouper == nil { + p.popKeepOptions() + } else { + p.pushGroup() + p.startGroup(grouper) + } + + continue + + case '|': + p.addAlternate() + goto ContinueOuterScan + + case ')': + if p.emptyStack() { + return nil, p.getErr(ErrUnexpectedParen) + } + + if err := p.addGroup(); err != nil { + return nil, err + } + if err := p.popGroup(); err != nil { + return nil, err + } + p.popOptions() + + if p.unit == nil { + goto ContinueOuterScan + } + + case '\\': + n, err := p.scanBackslash() + if err != nil { + return nil, err + } + p.addUnitNode(n) + + case '^': + if p.useOptionM() { + p.addUnitType(ntBol) + } else { + p.addUnitType(ntBeginning) + } + + case '$': + if p.useOptionM() { + p.addUnitType(ntEol) + } else { + p.addUnitType(ntEndZ) + } + + case '.': + if p.useOptionE() { + p.addUnitSet(ECMAAnyClass()) + } else if p.useOptionS() { + p.addUnitSet(AnyClass()) + } else { + p.addUnitNotone('\n') + } + + case '{', '*', '+', '?': + if p.unit == nil { + if wasPrevQuantifier { + return nil, p.getErr(ErrInvalidRepeatOp) + } else { + return nil, p.getErr(ErrMissingRepeatArgument) + } + } + p.moveLeft() + + default: + return nil, p.getErr(ErrInternalError) + } + + if err := p.scanBlank(); err != nil { + return nil, err + } + + if p.charsRight() > 0 { + isQuant = p.isTrueQuantifier() + } + if p.charsRight() == 0 || !isQuant { + //maintain odd C# assignment order -- not sure if required, could clean up? + p.addConcatenate() + goto ContinueOuterScan + } + + ch = p.moveRightGetChar() + + // Handle quantifiers + for p.unit != nil { + var min, max int + var lazy bool + + switch ch { + case '*': + min = 0 + max = math.MaxInt32 + + case '?': + min = 0 + max = 1 + + case '+': + min = 1 + max = math.MaxInt32 + + case '{': + { + var err error + startpos = p.textpos() + if min, err = p.scanDecimal(); err != nil { + return nil, err + } + max = min + if startpos < p.textpos() { + if p.charsRight() > 0 && p.rightChar(0) == ',' { + p.moveRight(1) + if p.charsRight() == 0 || p.rightChar(0) == '}' { + max = math.MaxInt32 + } else { + if max, err = p.scanDecimal(); err != nil { + return nil, err + } + } + } + } + + if startpos == p.textpos() || p.charsRight() == 0 || p.moveRightGetChar() != '}' { + p.addConcatenate() + p.textto(startpos - 1) + goto ContinueOuterScan + } + } + + default: + return nil, p.getErr(ErrInternalError) + } + + if err := p.scanBlank(); err != nil { + return nil, err + } + + if p.charsRight() == 0 || p.rightChar(0) != '?' { + lazy = false + } else { + p.moveRight(1) + lazy = true + } + + if min > max { + return nil, p.getErr(ErrInvalidRepeatSize) + } + + p.addConcatenate3(lazy, min, max) + } + + ContinueOuterScan: + } + +BreakOuterScan: + ; + + if !p.emptyStack() { + return nil, p.getErr(ErrMissingParen) + } + + if err := p.addGroup(); err != nil { + return nil, err + } + + return p.unit, nil + +} + +/* + * Simple parsing for replacement patterns + */ +func (p *parser) scanReplacement() (*regexNode, error) { + var c, startpos int + + p.concatenation = newRegexNode(ntConcatenate, p.options) + + for { + c = p.charsRight() + if c == 0 { + break + } + + startpos = p.textpos() + + for c > 0 && p.rightChar(0) != '$' { + p.moveRight(1) + c-- + } + + p.addToConcatenate(startpos, p.textpos()-startpos, true) + + if c > 0 { + if p.moveRightGetChar() == '$' { + n, err := p.scanDollar() + if err != nil { + return nil, err + } + p.addUnitNode(n) + } + p.addConcatenate() + } + } + + return p.concatenation, nil +} + +/* + * Scans $ patterns recognized within replacement patterns + */ +func (p *parser) scanDollar() (*regexNode, error) { + if p.charsRight() == 0 { + return newRegexNodeCh(ntOne, p.options, '$'), nil + } + + ch := p.rightChar(0) + angled := false + backpos := p.textpos() + lastEndPos := backpos + + // Note angle + + if ch == '{' && p.charsRight() > 1 { + angled = true + p.moveRight(1) + ch = p.rightChar(0) + } + + // Try to parse backreference: \1 or \{1} or \{cap} + + if ch >= '0' && ch <= '9' { + if !angled && p.useOptionE() { + capnum := -1 + newcapnum := int(ch - '0') + p.moveRight(1) + if p.isCaptureSlot(newcapnum) { + capnum = newcapnum + lastEndPos = p.textpos() + } + + for p.charsRight() > 0 { + ch = p.rightChar(0) + if ch < '0' || ch > '9' { + break + } + digit := int(ch - '0') + if newcapnum > maxValueDiv10 || (newcapnum == maxValueDiv10 && digit > maxValueMod10) { + return nil, p.getErr(ErrCaptureGroupOutOfRange) + } + + newcapnum = newcapnum*10 + digit + + p.moveRight(1) + if p.isCaptureSlot(newcapnum) { + capnum = newcapnum + lastEndPos = p.textpos() + } + } + p.textto(lastEndPos) + if capnum >= 0 { + return newRegexNodeM(ntRef, p.options, capnum), nil + } + } else { + capnum, err := p.scanDecimal() + if err != nil { + return nil, err + } + if !angled || p.charsRight() > 0 && p.moveRightGetChar() == '}' { + if p.isCaptureSlot(capnum) { + return newRegexNodeM(ntRef, p.options, capnum), nil + } + } + } + } else if angled && IsWordChar(ch) { + capname := p.scanCapname() + + if p.charsRight() > 0 && p.moveRightGetChar() == '}' { + if p.isCaptureName(capname) { + return newRegexNodeM(ntRef, p.options, p.captureSlotFromName(capname)), nil + } + } + } else if !angled { + capnum := 1 + + switch ch { + case '$': + p.moveRight(1) + return newRegexNodeCh(ntOne, p.options, '$'), nil + case '&': + capnum = 0 + case '`': + capnum = replaceLeftPortion + case '\'': + capnum = replaceRightPortion + case '+': + capnum = replaceLastGroup + case '_': + capnum = replaceWholeString + } + + if capnum != 1 { + p.moveRight(1) + return newRegexNodeM(ntRef, p.options, capnum), nil + } + } + + // unrecognized $: literalize + + p.textto(backpos) + return newRegexNodeCh(ntOne, p.options, '$'), nil +} + +// scanGroupOpen scans chars following a '(' (not counting the '('), and returns +// a RegexNode for the type of group scanned, or nil if the group +// simply changed options (?cimsx-cimsx) or was a comment (#...). +func (p *parser) scanGroupOpen() (*regexNode, error) { + var ch rune + var nt nodeType + var err error + close := '>' + start := p.textpos() + + // just return a RegexNode if we have: + // 1. "(" followed by nothing + // 2. "(x" where x != ? + // 3. "(?)" + if p.charsRight() == 0 || p.rightChar(0) != '?' || (p.rightChar(0) == '?' && (p.charsRight() > 1 && p.rightChar(1) == ')')) { + if p.useOptionN() || p.ignoreNextParen { + p.ignoreNextParen = false + return newRegexNode(ntGroup, p.options), nil + } + return newRegexNodeMN(ntCapture, p.options, p.consumeAutocap(), -1), nil + } + + p.moveRight(1) + + for { + if p.charsRight() == 0 { + break + } + + switch ch = p.moveRightGetChar(); ch { + case ':': + nt = ntGroup + + case '=': + p.options &= ^RightToLeft + nt = ntRequire + + case '!': + p.options &= ^RightToLeft + nt = ntPrevent + + case '>': + nt = ntGreedy + + case '\'': + close = '\'' + fallthrough + + case '<': + if p.charsRight() == 0 { + goto BreakRecognize + } + + switch ch = p.moveRightGetChar(); ch { + case '=': + if close == '\'' { + goto BreakRecognize + } + + p.options |= RightToLeft + nt = ntRequire + + case '!': + if close == '\'' { + goto BreakRecognize + } + + p.options |= RightToLeft + nt = ntPrevent + + default: + p.moveLeft() + capnum := -1 + uncapnum := -1 + proceed := false + + // grab part before - + + if ch >= '0' && ch <= '9' { + if capnum, err = p.scanDecimal(); err != nil { + return nil, err + } + + if !p.isCaptureSlot(capnum) { + capnum = -1 + } + + // check if we have bogus characters after the number + if p.charsRight() > 0 && !(p.rightChar(0) == close || p.rightChar(0) == '-') { + return nil, p.getErr(ErrInvalidGroupName) + } + if capnum == 0 { + return nil, p.getErr(ErrCapNumNotZero) + } + } else if IsWordChar(ch) { + capname := p.scanCapname() + + if p.isCaptureName(capname) { + capnum = p.captureSlotFromName(capname) + } + + // check if we have bogus character after the name + if p.charsRight() > 0 && !(p.rightChar(0) == close || p.rightChar(0) == '-') { + return nil, p.getErr(ErrInvalidGroupName) + } + } else if ch == '-' { + proceed = true + } else { + // bad group name - starts with something other than a word character and isn't a number + return nil, p.getErr(ErrInvalidGroupName) + } + + // grab part after - if any + + if (capnum != -1 || proceed == true) && p.charsRight() > 0 && p.rightChar(0) == '-' { + p.moveRight(1) + + //no more chars left, no closing char, etc + if p.charsRight() == 0 { + return nil, p.getErr(ErrInvalidGroupName) + } + + ch = p.rightChar(0) + if ch >= '0' && ch <= '9' { + if uncapnum, err = p.scanDecimal(); err != nil { + return nil, err + } + + if !p.isCaptureSlot(uncapnum) { + return nil, p.getErr(ErrUndefinedBackRef, uncapnum) + } + + // check if we have bogus characters after the number + if p.charsRight() > 0 && p.rightChar(0) != close { + return nil, p.getErr(ErrInvalidGroupName) + } + } else if IsWordChar(ch) { + uncapname := p.scanCapname() + + if !p.isCaptureName(uncapname) { + return nil, p.getErr(ErrUndefinedNameRef, uncapname) + } + uncapnum = p.captureSlotFromName(uncapname) + + // check if we have bogus character after the name + if p.charsRight() > 0 && p.rightChar(0) != close { + return nil, p.getErr(ErrInvalidGroupName) + } + } else { + // bad group name - starts with something other than a word character and isn't a number + return nil, p.getErr(ErrInvalidGroupName) + } + } + + // actually make the node + + if (capnum != -1 || uncapnum != -1) && p.charsRight() > 0 && p.moveRightGetChar() == close { + return newRegexNodeMN(ntCapture, p.options, capnum, uncapnum), nil + } + goto BreakRecognize + } + + case '(': + // alternation construct (?(...) | ) + + parenPos := p.textpos() + if p.charsRight() > 0 { + ch = p.rightChar(0) + + // check if the alternation condition is a backref + if ch >= '0' && ch <= '9' { + var capnum int + if capnum, err = p.scanDecimal(); err != nil { + return nil, err + } + if p.charsRight() > 0 && p.moveRightGetChar() == ')' { + if p.isCaptureSlot(capnum) { + return newRegexNodeM(ntTestref, p.options, capnum), nil + } + return nil, p.getErr(ErrUndefinedReference, capnum) + } + + return nil, p.getErr(ErrMalformedReference, capnum) + + } else if IsWordChar(ch) { + capname := p.scanCapname() + + if p.isCaptureName(capname) && p.charsRight() > 0 && p.moveRightGetChar() == ')' { + return newRegexNodeM(ntTestref, p.options, p.captureSlotFromName(capname)), nil + } + } + } + // not a backref + nt = ntTestgroup + p.textto(parenPos - 1) // jump to the start of the parentheses + p.ignoreNextParen = true // but make sure we don't try to capture the insides + + charsRight := p.charsRight() + if charsRight >= 3 && p.rightChar(1) == '?' { + rightchar2 := p.rightChar(2) + // disallow comments in the condition + if rightchar2 == '#' { + return nil, p.getErr(ErrAlternationCantHaveComment) + } + + // disallow named capture group (?<..>..) in the condition + if rightchar2 == '\'' { + return nil, p.getErr(ErrAlternationCantCapture) + } + + if charsRight >= 4 && (rightchar2 == '<' && p.rightChar(3) != '!' && p.rightChar(3) != '=') { + return nil, p.getErr(ErrAlternationCantCapture) + } + } + + default: + p.moveLeft() + + nt = ntGroup + // disallow options in the children of a testgroup node + if p.group.t != ntTestgroup { + p.scanOptions() + } + if p.charsRight() == 0 { + goto BreakRecognize + } + + if ch = p.moveRightGetChar(); ch == ')' { + return nil, nil + } + + if ch != ':' { + goto BreakRecognize + } + + } + + return newRegexNode(nt, p.options), nil + } + +BreakRecognize: + + // break Recognize comes here + + return nil, p.getErr(ErrUnrecognizedGrouping, string(p.pattern[start:p.textpos()])) +} + +// scans backslash specials and basics +func (p *parser) scanBackslash() (*regexNode, error) { + + if p.charsRight() == 0 { + return nil, p.getErr(ErrIllegalEndEscape) + } + + switch ch := p.rightChar(0); ch { + case 'b', 'B', 'A', 'G', 'Z', 'z': + p.moveRight(1) + return newRegexNode(p.typeFromCode(ch), p.options), nil + + case 'w': + p.moveRight(1) + if p.useOptionE() { + return newRegexNodeSet(ntSet, p.options, ECMAWordClass()), nil + } + return newRegexNodeSet(ntSet, p.options, WordClass()), nil + + case 'W': + p.moveRight(1) + if p.useOptionE() { + return newRegexNodeSet(ntSet, p.options, NotECMAWordClass()), nil + } + return newRegexNodeSet(ntSet, p.options, NotWordClass()), nil + + case 's': + p.moveRight(1) + if p.useOptionE() { + return newRegexNodeSet(ntSet, p.options, ECMASpaceClass()), nil + } + return newRegexNodeSet(ntSet, p.options, SpaceClass()), nil + + case 'S': + p.moveRight(1) + if p.useOptionE() { + return newRegexNodeSet(ntSet, p.options, NotECMASpaceClass()), nil + } + return newRegexNodeSet(ntSet, p.options, NotSpaceClass()), nil + + case 'd': + p.moveRight(1) + if p.useOptionE() { + return newRegexNodeSet(ntSet, p.options, ECMADigitClass()), nil + } + return newRegexNodeSet(ntSet, p.options, DigitClass()), nil + + case 'D': + p.moveRight(1) + if p.useOptionE() { + return newRegexNodeSet(ntSet, p.options, NotECMADigitClass()), nil + } + return newRegexNodeSet(ntSet, p.options, NotDigitClass()), nil + + case 'p', 'P': + p.moveRight(1) + prop, err := p.parseProperty() + if err != nil { + return nil, err + } + cc := &CharSet{} + cc.addCategory(prop, (ch != 'p'), p.useOptionI(), p.patternRaw) + if p.useOptionI() { + cc.addLowercase() + } + + return newRegexNodeSet(ntSet, p.options, cc), nil + + default: + return p.scanBasicBackslash() + } +} + +// Scans \-style backreferences and character escapes +func (p *parser) scanBasicBackslash() (*regexNode, error) { + if p.charsRight() == 0 { + return nil, p.getErr(ErrIllegalEndEscape) + } + angled := false + close := '\x00' + + backpos := p.textpos() + ch := p.rightChar(0) + + // allow \k instead of \, which is now deprecated + + if ch == 'k' { + if p.charsRight() >= 2 { + p.moveRight(1) + ch = p.moveRightGetChar() + + if ch == '<' || ch == '\'' { + angled = true + if ch == '\'' { + close = '\'' + } else { + close = '>' + } + } + } + + if !angled || p.charsRight() <= 0 { + return nil, p.getErr(ErrMalformedNameRef) + } + + ch = p.rightChar(0) + + } else if (ch == '<' || ch == '\'') && p.charsRight() > 1 { // Note angle without \g + angled = true + if ch == '\'' { + close = '\'' + } else { + close = '>' + } + + p.moveRight(1) + ch = p.rightChar(0) + } + + // Try to parse backreference: \<1> or \ + + if angled && ch >= '0' && ch <= '9' { + capnum, err := p.scanDecimal() + if err != nil { + return nil, err + } + + if p.charsRight() > 0 && p.moveRightGetChar() == close { + if p.isCaptureSlot(capnum) { + return newRegexNodeM(ntRef, p.options, capnum), nil + } else { + return nil, p.getErr(ErrUndefinedBackRef, capnum) + } + } + } else if !angled && ch >= '1' && ch <= '9' { // Try to parse backreference or octal: \1 + capnum, err := p.scanDecimal() + if err != nil { + return nil, err + } + if p.useOptionE() || p.isCaptureSlot(capnum) { + return newRegexNodeM(ntRef, p.options, capnum), nil + } + if capnum <= 9 { + return nil, p.getErr(ErrUndefinedBackRef, capnum) + } + + } else if angled && IsWordChar(ch) { + capname := p.scanCapname() + + if p.charsRight() > 0 && p.moveRightGetChar() == close { + if p.isCaptureName(capname) { + return newRegexNodeM(ntRef, p.options, p.captureSlotFromName(capname)), nil + } + return nil, p.getErr(ErrUndefinedNameRef, capname) + } + } + + // Not backreference: must be char code + + p.textto(backpos) + ch, err := p.scanCharEscape() + if err != nil { + return nil, err + } + + if p.useOptionI() { + ch = unicode.ToLower(ch) + } + + return newRegexNodeCh(ntOne, p.options, ch), nil +} + +// Scans X for \p{X} or \P{X} +func (p *parser) parseProperty() (string, error) { + if p.charsRight() < 3 { + return "", p.getErr(ErrIncompleteSlashP) + } + ch := p.moveRightGetChar() + if ch != '{' { + return "", p.getErr(ErrMalformedSlashP) + } + + startpos := p.textpos() + for p.charsRight() > 0 { + ch = p.moveRightGetChar() + if !(IsWordChar(ch) || ch == '-') { + p.moveLeft() + break + } + } + capname := string(p.pattern[startpos:p.textpos()]) + + if p.charsRight() == 0 || p.moveRightGetChar() != '}' { + return "", p.getErr(ErrIncompleteSlashP) + } + + if !isValidUnicodeCat(capname) { + return "", p.getErr(ErrUnknownSlashP, capname) + } + + return capname, nil +} + +// Returns ReNode type for zero-length assertions with a \ code. +func (p *parser) typeFromCode(ch rune) nodeType { + switch ch { + case 'b': + if p.useOptionE() { + return ntECMABoundary + } + return ntBoundary + case 'B': + if p.useOptionE() { + return ntNonECMABoundary + } + return ntNonboundary + case 'A': + return ntBeginning + case 'G': + return ntStart + case 'Z': + return ntEndZ + case 'z': + return ntEnd + default: + return ntNothing + } +} + +// Scans whitespace or x-mode comments. +func (p *parser) scanBlank() error { + if p.useOptionX() { + for { + for p.charsRight() > 0 && isSpace(p.rightChar(0)) { + p.moveRight(1) + } + + if p.charsRight() == 0 { + break + } + + if p.rightChar(0) == '#' { + for p.charsRight() > 0 && p.rightChar(0) != '\n' { + p.moveRight(1) + } + } else if p.charsRight() >= 3 && p.rightChar(2) == '#' && + p.rightChar(1) == '?' && p.rightChar(0) == '(' { + for p.charsRight() > 0 && p.rightChar(0) != ')' { + p.moveRight(1) + } + if p.charsRight() == 0 { + return p.getErr(ErrUnterminatedComment) + } + p.moveRight(1) + } else { + break + } + } + } else { + for { + if p.charsRight() < 3 || p.rightChar(2) != '#' || + p.rightChar(1) != '?' || p.rightChar(0) != '(' { + return nil + } + + for p.charsRight() > 0 && p.rightChar(0) != ')' { + p.moveRight(1) + } + if p.charsRight() == 0 { + return p.getErr(ErrUnterminatedComment) + } + p.moveRight(1) + } + } + return nil +} + +func (p *parser) scanCapname() string { + startpos := p.textpos() + + for p.charsRight() > 0 { + if !IsWordChar(p.moveRightGetChar()) { + p.moveLeft() + break + } + } + + return string(p.pattern[startpos:p.textpos()]) +} + +//Scans contents of [] (not including []'s), and converts to a set. +func (p *parser) scanCharSet(caseInsensitive, scanOnly bool) (*CharSet, error) { + ch := '\x00' + chPrev := '\x00' + inRange := false + firstChar := true + closed := false + + var cc *CharSet + if !scanOnly { + cc = &CharSet{} + } + + if p.charsRight() > 0 && p.rightChar(0) == '^' { + p.moveRight(1) + if !scanOnly { + cc.negate = true + } + } + + for ; p.charsRight() > 0; firstChar = false { + fTranslatedChar := false + ch = p.moveRightGetChar() + if ch == ']' { + if !firstChar { + closed = true + break + } else if p.useOptionE() { + if !scanOnly { + cc.addRanges(NoneClass().ranges) + } + closed = true + break + } + + } else if ch == '\\' && p.charsRight() > 0 { + switch ch = p.moveRightGetChar(); ch { + case 'D', 'd': + if !scanOnly { + if inRange { + return nil, p.getErr(ErrBadClassInCharRange, ch) + } + cc.addDigit(p.useOptionE(), ch == 'D', p.patternRaw) + } + continue + + case 'S', 's': + if !scanOnly { + if inRange { + return nil, p.getErr(ErrBadClassInCharRange, ch) + } + cc.addSpace(p.useOptionE(), ch == 'S') + } + continue + + case 'W', 'w': + if !scanOnly { + if inRange { + return nil, p.getErr(ErrBadClassInCharRange, ch) + } + + cc.addWord(p.useOptionE(), ch == 'W') + } + continue + + case 'p', 'P': + if !scanOnly { + if inRange { + return nil, p.getErr(ErrBadClassInCharRange, ch) + } + prop, err := p.parseProperty() + if err != nil { + return nil, err + } + cc.addCategory(prop, (ch != 'p'), caseInsensitive, p.patternRaw) + } else { + p.parseProperty() + } + + continue + + case '-': + if !scanOnly { + cc.addRange(ch, ch) + } + continue + + default: + p.moveLeft() + var err error + ch, err = p.scanCharEscape() // non-literal character + if err != nil { + return nil, err + } + fTranslatedChar = true + break // this break will only break out of the switch + } + } else if ch == '[' { + // This is code for Posix style properties - [:Ll:] or [:IsTibetan:]. + // It currently doesn't do anything other than skip the whole thing! + if p.charsRight() > 0 && p.rightChar(0) == ':' && !inRange { + savePos := p.textpos() + + p.moveRight(1) + p.scanCapname() // throwaway the name + if p.charsRight() < 2 || p.moveRightGetChar() != ':' || p.moveRightGetChar() != ']' { + p.textto(savePos) + } + // else lookup name (nyi) + } + } + + if inRange { + inRange = false + if !scanOnly { + if ch == '[' && !fTranslatedChar && !firstChar { + // We thought we were in a range, but we're actually starting a subtraction. + // In that case, we'll add chPrev to our char class, skip the opening [, and + // scan the new character class recursively. + cc.addChar(chPrev) + sub, err := p.scanCharSet(caseInsensitive, false) + if err != nil { + return nil, err + } + cc.addSubtraction(sub) + + if p.charsRight() > 0 && p.rightChar(0) != ']' { + return nil, p.getErr(ErrSubtractionMustBeLast) + } + } else { + // a regular range, like a-z + if chPrev > ch { + return nil, p.getErr(ErrReversedCharRange) + } + cc.addRange(chPrev, ch) + } + } + } else if p.charsRight() >= 2 && p.rightChar(0) == '-' && p.rightChar(1) != ']' { + // this could be the start of a range + chPrev = ch + inRange = true + p.moveRight(1) + } else if p.charsRight() >= 1 && ch == '-' && !fTranslatedChar && p.rightChar(0) == '[' && !firstChar { + // we aren't in a range, and now there is a subtraction. Usually this happens + // only when a subtraction follows a range, like [a-z-[b]] + if !scanOnly { + p.moveRight(1) + sub, err := p.scanCharSet(caseInsensitive, false) + if err != nil { + return nil, err + } + cc.addSubtraction(sub) + + if p.charsRight() > 0 && p.rightChar(0) != ']' { + return nil, p.getErr(ErrSubtractionMustBeLast) + } + } else { + p.moveRight(1) + p.scanCharSet(caseInsensitive, true) + } + } else { + if !scanOnly { + cc.addRange(ch, ch) + } + } + } + + if !closed { + return nil, p.getErr(ErrUnterminatedBracket) + } + + if !scanOnly && caseInsensitive { + cc.addLowercase() + } + + return cc, nil +} + +// Scans any number of decimal digits (pegs value at 2^31-1 if too large) +func (p *parser) scanDecimal() (int, error) { + i := 0 + var d int + + for p.charsRight() > 0 { + d = int(p.rightChar(0) - '0') + if d < 0 || d > 9 { + break + } + p.moveRight(1) + + if i > maxValueDiv10 || (i == maxValueDiv10 && d > maxValueMod10) { + return 0, p.getErr(ErrCaptureGroupOutOfRange) + } + + i *= 10 + i += d + } + + return int(i), nil +} + +// Returns true for options allowed only at the top level +func isOnlyTopOption(option RegexOptions) bool { + return option == RightToLeft || option == ECMAScript +} + +// Scans cimsx-cimsx option string, stops at the first unrecognized char. +func (p *parser) scanOptions() { + + for off := false; p.charsRight() > 0; p.moveRight(1) { + ch := p.rightChar(0) + + if ch == '-' { + off = true + } else if ch == '+' { + off = false + } else { + option := optionFromCode(ch) + if option == 0 || isOnlyTopOption(option) { + return + } + + if off { + p.options &= ^option + } else { + p.options |= option + } + } + } +} + +// Scans \ code for escape codes that map to single unicode chars. +func (p *parser) scanCharEscape() (rune, error) { + + ch := p.moveRightGetChar() + + if ch >= '0' && ch <= '7' { + p.moveLeft() + return p.scanOctal(), nil + } + + switch ch { + case 'x': + // support for \x{HEX} syntax from Perl and PCRE + if p.charsRight() > 0 && p.rightChar(0) == '{' { + p.moveRight(1) + return p.scanHexUntilBrace() + } + return p.scanHex(2) + case 'u': + return p.scanHex(4) + case 'a': + return '\u0007', nil + case 'b': + return '\b', nil + case 'e': + return '\u001B', nil + case 'f': + return '\f', nil + case 'n': + return '\n', nil + case 'r': + return '\r', nil + case 't': + return '\t', nil + case 'v': + return '\u000B', nil + case 'c': + return p.scanControl() + default: + if !p.useOptionE() && IsWordChar(ch) { + return 0, p.getErr(ErrUnrecognizedEscape, string(ch)) + } + return ch, nil + } +} + +// Grabs and converts an ascii control character +func (p *parser) scanControl() (rune, error) { + if p.charsRight() <= 0 { + return 0, p.getErr(ErrMissingControl) + } + + ch := p.moveRightGetChar() + + // \ca interpreted as \cA + + if ch >= 'a' && ch <= 'z' { + ch = (ch - ('a' - 'A')) + } + ch = (ch - '@') + if ch >= 0 && ch < ' ' { + return ch, nil + } + + return 0, p.getErr(ErrUnrecognizedControl) + +} + +// Scan hex digits until we hit a closing brace. +// Non-hex digits, hex value too large for UTF-8, or running out of chars are errors +func (p *parser) scanHexUntilBrace() (rune, error) { + // PCRE spec reads like unlimited hex digits are allowed, but unicode has a limit + // so we can enforce that + i := 0 + hasContent := false + + for p.charsRight() > 0 { + ch := p.moveRightGetChar() + if ch == '}' { + // hit our close brace, we're done here + // prevent \x{} + if !hasContent { + return 0, p.getErr(ErrTooFewHex) + } + return rune(i), nil + } + hasContent = true + // no brace needs to be hex digit + d := hexDigit(ch) + if d < 0 { + return 0, p.getErr(ErrMissingBrace) + } + + i *= 0x10 + i += d + + if i > unicode.MaxRune { + return 0, p.getErr(ErrInvalidHex) + } + } + + // we only make it here if we run out of digits without finding the brace + return 0, p.getErr(ErrMissingBrace) +} + +// Scans exactly c hex digits (c=2 for \xFF, c=4 for \uFFFF) +func (p *parser) scanHex(c int) (rune, error) { + + i := 0 + + if p.charsRight() >= c { + for c > 0 { + d := hexDigit(p.moveRightGetChar()) + if d < 0 { + break + } + i *= 0x10 + i += d + c-- + } + } + + if c > 0 { + return 0, p.getErr(ErrTooFewHex) + } + + return rune(i), nil +} + +// Returns n <= 0xF for a hex digit. +func hexDigit(ch rune) int { + + if d := uint(ch - '0'); d <= 9 { + return int(d) + } + + if d := uint(ch - 'a'); d <= 5 { + return int(d + 0xa) + } + + if d := uint(ch - 'A'); d <= 5 { + return int(d + 0xa) + } + + return -1 +} + +// Scans up to three octal digits (stops before exceeding 0377). +func (p *parser) scanOctal() rune { + // Consume octal chars only up to 3 digits and value 0377 + + c := 3 + + if c > p.charsRight() { + c = p.charsRight() + } + + //we know the first char is good because the caller had to check + i := 0 + d := int(p.rightChar(0) - '0') + for c > 0 && d <= 7 { + i *= 8 + i += d + if p.useOptionE() && i >= 0x20 { + break + } + c-- + + p.moveRight(1) + if !p.rightMost() { + d = int(p.rightChar(0) - '0') + } + } + + // Octal codes only go up to 255. Any larger and the behavior that Perl follows + // is simply to truncate the high bits. + i &= 0xFF + + return rune(i) +} + +// Returns the current parsing position. +func (p *parser) textpos() int { + return p.currentPos +} + +// Zaps to a specific parsing position. +func (p *parser) textto(pos int) { + p.currentPos = pos +} + +// Returns the char at the right of the current parsing position and advances to the right. +func (p *parser) moveRightGetChar() rune { + ch := p.pattern[p.currentPos] + p.currentPos++ + return ch +} + +// Moves the current position to the right. +func (p *parser) moveRight(i int) { + // default would be 1 + p.currentPos += i +} + +// Moves the current parsing position one to the left. +func (p *parser) moveLeft() { + p.currentPos-- +} + +// Returns the char left of the current parsing position. +func (p *parser) charAt(i int) rune { + return p.pattern[i] +} + +// Returns the char i chars right of the current parsing position. +func (p *parser) rightChar(i int) rune { + // default would be 0 + return p.pattern[p.currentPos+i] +} + +// Number of characters to the right of the current parsing position. +func (p *parser) charsRight() int { + return len(p.pattern) - p.currentPos +} + +func (p *parser) rightMost() bool { + return p.currentPos == len(p.pattern) +} + +// Looks up the slot number for a given name +func (p *parser) captureSlotFromName(capname string) int { + return p.capnames[capname] +} + +// True if the capture slot was noted +func (p *parser) isCaptureSlot(i int) bool { + if p.caps != nil { + _, ok := p.caps[i] + return ok + } + + return (i >= 0 && i < p.capsize) +} + +// Looks up the slot number for a given name +func (p *parser) isCaptureName(capname string) bool { + if p.capnames == nil { + return false + } + + _, ok := p.capnames[capname] + return ok +} + +// option shortcuts + +// True if N option disabling '(' autocapture is on. +func (p *parser) useOptionN() bool { + return (p.options & ExplicitCapture) != 0 +} + +// True if I option enabling case-insensitivity is on. +func (p *parser) useOptionI() bool { + return (p.options & IgnoreCase) != 0 +} + +// True if M option altering meaning of $ and ^ is on. +func (p *parser) useOptionM() bool { + return (p.options & Multiline) != 0 +} + +// True if S option altering meaning of . is on. +func (p *parser) useOptionS() bool { + return (p.options & Singleline) != 0 +} + +// True if X option enabling whitespace/comment mode is on. +func (p *parser) useOptionX() bool { + return (p.options & IgnorePatternWhitespace) != 0 +} + +// True if E option enabling ECMAScript behavior on. +func (p *parser) useOptionE() bool { + return (p.options & ECMAScript) != 0 +} + +// True if options stack is empty. +func (p *parser) emptyOptionsStack() bool { + return len(p.optionsStack) == 0 +} + +// Finish the current quantifiable (when a quantifier is not found or is not possible) +func (p *parser) addConcatenate() { + // The first (| inside a Testgroup group goes directly to the group + p.concatenation.addChild(p.unit) + p.unit = nil +} + +// Finish the current quantifiable (when a quantifier is found) +func (p *parser) addConcatenate3(lazy bool, min, max int) { + p.concatenation.addChild(p.unit.makeQuantifier(lazy, min, max)) + p.unit = nil +} + +// Sets the current unit to a single char node +func (p *parser) addUnitOne(ch rune) { + if p.useOptionI() { + ch = unicode.ToLower(ch) + } + + p.unit = newRegexNodeCh(ntOne, p.options, ch) +} + +// Sets the current unit to a single inverse-char node +func (p *parser) addUnitNotone(ch rune) { + if p.useOptionI() { + ch = unicode.ToLower(ch) + } + + p.unit = newRegexNodeCh(ntNotone, p.options, ch) +} + +// Sets the current unit to a single set node +func (p *parser) addUnitSet(set *CharSet) { + p.unit = newRegexNodeSet(ntSet, p.options, set) +} + +// Sets the current unit to a subtree +func (p *parser) addUnitNode(node *regexNode) { + p.unit = node +} + +// Sets the current unit to an assertion of the specified type +func (p *parser) addUnitType(t nodeType) { + p.unit = newRegexNode(t, p.options) +} + +// Finish the current group (in response to a ')' or end) +func (p *parser) addGroup() error { + if p.group.t == ntTestgroup || p.group.t == ntTestref { + p.group.addChild(p.concatenation.reverseLeft()) + if (p.group.t == ntTestref && len(p.group.children) > 2) || len(p.group.children) > 3 { + return p.getErr(ErrTooManyAlternates) + } + } else { + p.alternation.addChild(p.concatenation.reverseLeft()) + p.group.addChild(p.alternation) + } + + p.unit = p.group + return nil +} + +// Pops the option stack, but keeps the current options unchanged. +func (p *parser) popKeepOptions() { + lastIdx := len(p.optionsStack) - 1 + p.optionsStack = p.optionsStack[:lastIdx] +} + +// Recalls options from the stack. +func (p *parser) popOptions() { + lastIdx := len(p.optionsStack) - 1 + // get the last item on the stack and then remove it by reslicing + p.options = p.optionsStack[lastIdx] + p.optionsStack = p.optionsStack[:lastIdx] +} + +// Saves options on a stack. +func (p *parser) pushOptions() { + p.optionsStack = append(p.optionsStack, p.options) +} + +// Add a string to the last concatenate. +func (p *parser) addToConcatenate(pos, cch int, isReplacement bool) { + var node *regexNode + + if cch == 0 { + return + } + + if cch > 1 { + str := p.pattern[pos : pos+cch] + + if p.useOptionI() && !isReplacement { + // We do the ToLower character by character for consistency. With surrogate chars, doing + // a ToLower on the entire string could actually change the surrogate pair. This is more correct + // linguistically, but since Regex doesn't support surrogates, it's more important to be + // consistent. + for i := 0; i < len(str); i++ { + str[i] = unicode.ToLower(str[i]) + } + } + + node = newRegexNodeStr(ntMulti, p.options, str) + } else { + ch := p.charAt(pos) + + if p.useOptionI() && !isReplacement { + ch = unicode.ToLower(ch) + } + + node = newRegexNodeCh(ntOne, p.options, ch) + } + + p.concatenation.addChild(node) +} + +// Push the parser state (in response to an open paren) +func (p *parser) pushGroup() { + p.group.next = p.stack + p.alternation.next = p.group + p.concatenation.next = p.alternation + p.stack = p.concatenation +} + +// Remember the pushed state (in response to a ')') +func (p *parser) popGroup() error { + p.concatenation = p.stack + p.alternation = p.concatenation.next + p.group = p.alternation.next + p.stack = p.group.next + + // The first () inside a Testgroup group goes directly to the group + if p.group.t == ntTestgroup && len(p.group.children) == 0 { + if p.unit == nil { + return p.getErr(ErrConditionalExpression) + } + + p.group.addChild(p.unit) + p.unit = nil + } + return nil +} + +// True if the group stack is empty. +func (p *parser) emptyStack() bool { + return p.stack == nil +} + +// Start a new round for the parser state (in response to an open paren or string start) +func (p *parser) startGroup(openGroup *regexNode) { + p.group = openGroup + p.alternation = newRegexNode(ntAlternate, p.options) + p.concatenation = newRegexNode(ntConcatenate, p.options) +} + +// Finish the current concatenation (in response to a |) +func (p *parser) addAlternate() { + // The | parts inside a Testgroup group go directly to the group + + if p.group.t == ntTestgroup || p.group.t == ntTestref { + p.group.addChild(p.concatenation.reverseLeft()) + } else { + p.alternation.addChild(p.concatenation.reverseLeft()) + } + + p.concatenation = newRegexNode(ntConcatenate, p.options) +} + +// For categorizing ascii characters. + +const ( + Q byte = 5 // quantifier + S = 4 // ordinary stopper + Z = 3 // ScanBlank stopper + X = 2 // whitespace + E = 1 // should be escaped +) + +var _category = []byte{ + //01 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 0, 0, 0, 0, 0, 0, 0, 0, X, X, X, X, X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? + X, 0, 0, Z, S, 0, 0, 0, S, S, Q, Q, 0, 0, S, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Q, + //@A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, S, 0, + //'a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Q, S, 0, 0, 0, +} + +func isSpace(ch rune) bool { + return (ch <= ' ' && _category[ch] == X) +} + +// Returns true for those characters that terminate a string of ordinary chars. +func isSpecial(ch rune) bool { + return (ch <= '|' && _category[ch] >= S) +} + +// Returns true for those characters that terminate a string of ordinary chars. +func isStopperX(ch rune) bool { + return (ch <= '|' && _category[ch] >= X) +} + +// Returns true for those characters that begin a quantifier. +func isQuantifier(ch rune) bool { + return (ch <= '{' && _category[ch] >= Q) +} + +func (p *parser) isTrueQuantifier() bool { + nChars := p.charsRight() + if nChars == 0 { + return false + } + + startpos := p.textpos() + ch := p.charAt(startpos) + if ch != '{' { + return ch <= '{' && _category[ch] >= Q + } + + //UGLY: this is ugly -- the original code was ugly too + pos := startpos + for { + nChars-- + if nChars <= 0 { + break + } + pos++ + ch = p.charAt(pos) + if ch < '0' || ch > '9' { + break + } + } + + if nChars == 0 || pos-startpos == 1 { + return false + } + if ch == '}' { + return true + } + if ch != ',' { + return false + } + for { + nChars-- + if nChars <= 0 { + break + } + pos++ + ch = p.charAt(pos) + if ch < '0' || ch > '9' { + break + } + } + + return nChars > 0 && ch == '}' +} diff --git a/vendor/github.com/dlclark/regexp2/syntax/prefix.go b/vendor/github.com/dlclark/regexp2/syntax/prefix.go new file mode 100644 index 000000000..011ef0b41 --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/syntax/prefix.go @@ -0,0 +1,896 @@ +package syntax + +import ( + "bytes" + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +type Prefix struct { + PrefixStr []rune + PrefixSet CharSet + CaseInsensitive bool +} + +// It takes a RegexTree and computes the set of chars that can start it. +func getFirstCharsPrefix(tree *RegexTree) *Prefix { + s := regexFcd{ + fcStack: make([]regexFc, 32), + intStack: make([]int, 32), + } + fc := s.regexFCFromRegexTree(tree) + + if fc == nil || fc.nullable || fc.cc.IsEmpty() { + return nil + } + fcSet := fc.getFirstChars() + return &Prefix{PrefixSet: fcSet, CaseInsensitive: fc.caseInsensitive} +} + +type regexFcd struct { + intStack []int + intDepth int + fcStack []regexFc + fcDepth int + skipAllChildren bool // don't process any more children at the current level + skipchild bool // don't process the current child. + failed bool +} + +/* + * The main FC computation. It does a shortcutted depth-first walk + * through the tree and calls CalculateFC to emits code before + * and after each child of an interior node, and at each leaf. + */ +func (s *regexFcd) regexFCFromRegexTree(tree *RegexTree) *regexFc { + curNode := tree.root + curChild := 0 + + for { + if len(curNode.children) == 0 { + // This is a leaf node + s.calculateFC(curNode.t, curNode, 0) + } else if curChild < len(curNode.children) && !s.skipAllChildren { + // This is an interior node, and we have more children to analyze + s.calculateFC(curNode.t|beforeChild, curNode, curChild) + + if !s.skipchild { + curNode = curNode.children[curChild] + // this stack is how we get a depth first walk of the tree. + s.pushInt(curChild) + curChild = 0 + } else { + curChild++ + s.skipchild = false + } + continue + } + + // This is an interior node where we've finished analyzing all the children, or + // the end of a leaf node. + s.skipAllChildren = false + + if s.intIsEmpty() { + break + } + + curChild = s.popInt() + curNode = curNode.next + + s.calculateFC(curNode.t|afterChild, curNode, curChild) + if s.failed { + return nil + } + + curChild++ + } + + if s.fcIsEmpty() { + return nil + } + + return s.popFC() +} + +// To avoid recursion, we use a simple integer stack. +// This is the push. +func (s *regexFcd) pushInt(I int) { + if s.intDepth >= len(s.intStack) { + expanded := make([]int, s.intDepth*2) + copy(expanded, s.intStack) + s.intStack = expanded + } + + s.intStack[s.intDepth] = I + s.intDepth++ +} + +// True if the stack is empty. +func (s *regexFcd) intIsEmpty() bool { + return s.intDepth == 0 +} + +// This is the pop. +func (s *regexFcd) popInt() int { + s.intDepth-- + return s.intStack[s.intDepth] +} + +// We also use a stack of RegexFC objects. +// This is the push. +func (s *regexFcd) pushFC(fc regexFc) { + if s.fcDepth >= len(s.fcStack) { + expanded := make([]regexFc, s.fcDepth*2) + copy(expanded, s.fcStack) + s.fcStack = expanded + } + + s.fcStack[s.fcDepth] = fc + s.fcDepth++ +} + +// True if the stack is empty. +func (s *regexFcd) fcIsEmpty() bool { + return s.fcDepth == 0 +} + +// This is the pop. +func (s *regexFcd) popFC() *regexFc { + s.fcDepth-- + return &s.fcStack[s.fcDepth] +} + +// This is the top. +func (s *regexFcd) topFC() *regexFc { + return &s.fcStack[s.fcDepth-1] +} + +// Called in Beforechild to prevent further processing of the current child +func (s *regexFcd) skipChild() { + s.skipchild = true +} + +// FC computation and shortcut cases for each node type +func (s *regexFcd) calculateFC(nt nodeType, node *regexNode, CurIndex int) { + //fmt.Printf("NodeType: %v, CurIndex: %v, Desc: %v\n", nt, CurIndex, node.description()) + ci := false + rtl := false + + if nt <= ntRef { + if (node.options & IgnoreCase) != 0 { + ci = true + } + if (node.options & RightToLeft) != 0 { + rtl = true + } + } + + switch nt { + case ntConcatenate | beforeChild, ntAlternate | beforeChild, ntTestref | beforeChild, ntLoop | beforeChild, ntLazyloop | beforeChild: + break + + case ntTestgroup | beforeChild: + if CurIndex == 0 { + s.skipChild() + } + break + + case ntEmpty: + s.pushFC(regexFc{nullable: true}) + break + + case ntConcatenate | afterChild: + if CurIndex != 0 { + child := s.popFC() + cumul := s.topFC() + + s.failed = !cumul.addFC(*child, true) + } + + fc := s.topFC() + if !fc.nullable { + s.skipAllChildren = true + } + break + + case ntTestgroup | afterChild: + if CurIndex > 1 { + child := s.popFC() + cumul := s.topFC() + + s.failed = !cumul.addFC(*child, false) + } + break + + case ntAlternate | afterChild, ntTestref | afterChild: + if CurIndex != 0 { + child := s.popFC() + cumul := s.topFC() + + s.failed = !cumul.addFC(*child, false) + } + break + + case ntLoop | afterChild, ntLazyloop | afterChild: + if node.m == 0 { + fc := s.topFC() + fc.nullable = true + } + break + + case ntGroup | beforeChild, ntGroup | afterChild, ntCapture | beforeChild, ntCapture | afterChild, ntGreedy | beforeChild, ntGreedy | afterChild: + break + + case ntRequire | beforeChild, ntPrevent | beforeChild: + s.skipChild() + s.pushFC(regexFc{nullable: true}) + break + + case ntRequire | afterChild, ntPrevent | afterChild: + break + + case ntOne, ntNotone: + s.pushFC(newRegexFc(node.ch, nt == ntNotone, false, ci)) + break + + case ntOneloop, ntOnelazy: + s.pushFC(newRegexFc(node.ch, false, node.m == 0, ci)) + break + + case ntNotoneloop, ntNotonelazy: + s.pushFC(newRegexFc(node.ch, true, node.m == 0, ci)) + break + + case ntMulti: + if len(node.str) == 0 { + s.pushFC(regexFc{nullable: true}) + } else if !rtl { + s.pushFC(newRegexFc(node.str[0], false, false, ci)) + } else { + s.pushFC(newRegexFc(node.str[len(node.str)-1], false, false, ci)) + } + break + + case ntSet: + s.pushFC(regexFc{cc: node.set.Copy(), nullable: false, caseInsensitive: ci}) + break + + case ntSetloop, ntSetlazy: + s.pushFC(regexFc{cc: node.set.Copy(), nullable: node.m == 0, caseInsensitive: ci}) + break + + case ntRef: + s.pushFC(regexFc{cc: *AnyClass(), nullable: true, caseInsensitive: false}) + break + + case ntNothing, ntBol, ntEol, ntBoundary, ntNonboundary, ntECMABoundary, ntNonECMABoundary, ntBeginning, ntStart, ntEndZ, ntEnd: + s.pushFC(regexFc{nullable: true}) + break + + default: + panic(fmt.Sprintf("unexpected op code: %v", nt)) + } +} + +type regexFc struct { + cc CharSet + nullable bool + caseInsensitive bool +} + +func newRegexFc(ch rune, not, nullable, caseInsensitive bool) regexFc { + r := regexFc{ + caseInsensitive: caseInsensitive, + nullable: nullable, + } + if not { + if ch > 0 { + r.cc.addRange('\x00', ch-1) + } + if ch < 0xFFFF { + r.cc.addRange(ch+1, utf8.MaxRune) + } + } else { + r.cc.addRange(ch, ch) + } + return r +} + +func (r *regexFc) getFirstChars() CharSet { + if r.caseInsensitive { + r.cc.addLowercase() + } + + return r.cc +} + +func (r *regexFc) addFC(fc regexFc, concatenate bool) bool { + if !r.cc.IsMergeable() || !fc.cc.IsMergeable() { + return false + } + + if concatenate { + if !r.nullable { + return true + } + + if !fc.nullable { + r.nullable = false + } + } else { + if fc.nullable { + r.nullable = true + } + } + + r.caseInsensitive = r.caseInsensitive || fc.caseInsensitive + r.cc.addSet(fc.cc) + + return true +} + +// This is a related computation: it takes a RegexTree and computes the +// leading substring if it sees one. It's quite trivial and gives up easily. +func getPrefix(tree *RegexTree) *Prefix { + var concatNode *regexNode + nextChild := 0 + + curNode := tree.root + + for { + switch curNode.t { + case ntConcatenate: + if len(curNode.children) > 0 { + concatNode = curNode + nextChild = 0 + } + + case ntGreedy, ntCapture: + curNode = curNode.children[0] + concatNode = nil + continue + + case ntOneloop, ntOnelazy: + if curNode.m > 0 { + return &Prefix{ + PrefixStr: repeat(curNode.ch, curNode.m), + CaseInsensitive: (curNode.options & IgnoreCase) != 0, + } + } + return nil + + case ntOne: + return &Prefix{ + PrefixStr: []rune{curNode.ch}, + CaseInsensitive: (curNode.options & IgnoreCase) != 0, + } + + case ntMulti: + return &Prefix{ + PrefixStr: curNode.str, + CaseInsensitive: (curNode.options & IgnoreCase) != 0, + } + + case ntBol, ntEol, ntBoundary, ntECMABoundary, ntBeginning, ntStart, + ntEndZ, ntEnd, ntEmpty, ntRequire, ntPrevent: + + default: + return nil + } + + if concatNode == nil || nextChild >= len(concatNode.children) { + return nil + } + + curNode = concatNode.children[nextChild] + nextChild++ + } +} + +// repeat the rune r, c times... up to the max of MaxPrefixSize +func repeat(r rune, c int) []rune { + if c > MaxPrefixSize { + c = MaxPrefixSize + } + + ret := make([]rune, c) + + // binary growth using copy for speed + ret[0] = r + bp := 1 + for bp < len(ret) { + copy(ret[bp:], ret[:bp]) + bp *= 2 + } + + return ret +} + +// BmPrefix precomputes the Boyer-Moore +// tables for fast string scanning. These tables allow +// you to scan for the first occurrence of a string within +// a large body of text without examining every character. +// The performance of the heuristic depends on the actual +// string and the text being searched, but usually, the longer +// the string that is being searched for, the fewer characters +// need to be examined. +type BmPrefix struct { + positive []int + negativeASCII []int + negativeUnicode [][]int + pattern []rune + lowASCII rune + highASCII rune + rightToLeft bool + caseInsensitive bool +} + +func newBmPrefix(pattern []rune, caseInsensitive, rightToLeft bool) *BmPrefix { + + b := &BmPrefix{ + rightToLeft: rightToLeft, + caseInsensitive: caseInsensitive, + pattern: pattern, + } + + if caseInsensitive { + for i := 0; i < len(b.pattern); i++ { + // We do the ToLower character by character for consistency. With surrogate chars, doing + // a ToLower on the entire string could actually change the surrogate pair. This is more correct + // linguistically, but since Regex doesn't support surrogates, it's more important to be + // consistent. + + b.pattern[i] = unicode.ToLower(b.pattern[i]) + } + } + + var beforefirst, last, bump int + var scan, match int + + if !rightToLeft { + beforefirst = -1 + last = len(b.pattern) - 1 + bump = 1 + } else { + beforefirst = len(b.pattern) + last = 0 + bump = -1 + } + + // PART I - the good-suffix shift table + // + // compute the positive requirement: + // if char "i" is the first one from the right that doesn't match, + // then we know the matcher can advance by _positive[i]. + // + // This algorithm is a simplified variant of the standard + // Boyer-Moore good suffix calculation. + + b.positive = make([]int, len(b.pattern)) + + examine := last + ch := b.pattern[examine] + b.positive[examine] = bump + examine -= bump + +Outerloop: + for { + // find an internal char (examine) that matches the tail + + for { + if examine == beforefirst { + break Outerloop + } + if b.pattern[examine] == ch { + break + } + examine -= bump + } + + match = last + scan = examine + + // find the length of the match + for { + if scan == beforefirst || b.pattern[match] != b.pattern[scan] { + // at the end of the match, note the difference in _positive + // this is not the length of the match, but the distance from the internal match + // to the tail suffix. + if b.positive[match] == 0 { + b.positive[match] = match - scan + } + + // System.Diagnostics.Debug.WriteLine("Set positive[" + match + "] to " + (match - scan)); + + break + } + + scan -= bump + match -= bump + } + + examine -= bump + } + + match = last - bump + + // scan for the chars for which there are no shifts that yield a different candidate + + // The inside of the if statement used to say + // "_positive[match] = last - beforefirst;" + // This is slightly less aggressive in how much we skip, but at worst it + // should mean a little more work rather than skipping a potential match. + for match != beforefirst { + if b.positive[match] == 0 { + b.positive[match] = bump + } + + match -= bump + } + + // PART II - the bad-character shift table + // + // compute the negative requirement: + // if char "ch" is the reject character when testing position "i", + // we can slide up by _negative[ch]; + // (_negative[ch] = str.Length - 1 - str.LastIndexOf(ch)) + // + // the lookup table is divided into ASCII and Unicode portions; + // only those parts of the Unicode 16-bit code set that actually + // appear in the string are in the table. (Maximum size with + // Unicode is 65K; ASCII only case is 512 bytes.) + + b.negativeASCII = make([]int, 128) + + for i := 0; i < len(b.negativeASCII); i++ { + b.negativeASCII[i] = last - beforefirst + } + + b.lowASCII = 127 + b.highASCII = 0 + + for examine = last; examine != beforefirst; examine -= bump { + ch = b.pattern[examine] + + switch { + case ch < 128: + if b.lowASCII > ch { + b.lowASCII = ch + } + + if b.highASCII < ch { + b.highASCII = ch + } + + if b.negativeASCII[ch] == last-beforefirst { + b.negativeASCII[ch] = last - examine + } + case ch <= 0xffff: + i, j := ch>>8, ch&0xFF + + if b.negativeUnicode == nil { + b.negativeUnicode = make([][]int, 256) + } + + if b.negativeUnicode[i] == nil { + newarray := make([]int, 256) + + for k := 0; k < len(newarray); k++ { + newarray[k] = last - beforefirst + } + + if i == 0 { + copy(newarray, b.negativeASCII) + //TODO: this line needed? + b.negativeASCII = newarray + } + + b.negativeUnicode[i] = newarray + } + + if b.negativeUnicode[i][j] == last-beforefirst { + b.negativeUnicode[i][j] = last - examine + } + default: + // we can't do the filter because this algo doesn't support + // unicode chars >0xffff + return nil + } + } + + return b +} + +func (b *BmPrefix) String() string { + return string(b.pattern) +} + +// Dump returns the contents of the filter as a human readable string +func (b *BmPrefix) Dump(indent string) string { + buf := &bytes.Buffer{} + + fmt.Fprintf(buf, "%sBM Pattern: %s\n%sPositive: ", indent, string(b.pattern), indent) + for i := 0; i < len(b.positive); i++ { + buf.WriteString(strconv.Itoa(b.positive[i])) + buf.WriteRune(' ') + } + buf.WriteRune('\n') + + if b.negativeASCII != nil { + buf.WriteString(indent) + buf.WriteString("Negative table\n") + for i := 0; i < len(b.negativeASCII); i++ { + if b.negativeASCII[i] != len(b.pattern) { + fmt.Fprintf(buf, "%s %s %s\n", indent, Escape(string(rune(i))), strconv.Itoa(b.negativeASCII[i])) + } + } + } + + return buf.String() +} + +// Scan uses the Boyer-Moore algorithm to find the first occurrence +// of the specified string within text, beginning at index, and +// constrained within beglimit and endlimit. +// +// The direction and case-sensitivity of the match is determined +// by the arguments to the RegexBoyerMoore constructor. +func (b *BmPrefix) Scan(text []rune, index, beglimit, endlimit int) int { + var ( + defadv, test, test2 int + match, startmatch, endmatch int + bump, advance int + chTest rune + unicodeLookup []int + ) + + if !b.rightToLeft { + defadv = len(b.pattern) + startmatch = len(b.pattern) - 1 + endmatch = 0 + test = index + defadv - 1 + bump = 1 + } else { + defadv = -len(b.pattern) + startmatch = 0 + endmatch = -defadv - 1 + test = index + defadv + bump = -1 + } + + chMatch := b.pattern[startmatch] + + for { + if test >= endlimit || test < beglimit { + return -1 + } + + chTest = text[test] + + if b.caseInsensitive { + chTest = unicode.ToLower(chTest) + } + + if chTest != chMatch { + if chTest < 128 { + advance = b.negativeASCII[chTest] + } else if chTest < 0xffff && len(b.negativeUnicode) > 0 { + unicodeLookup = b.negativeUnicode[chTest>>8] + if len(unicodeLookup) > 0 { + advance = unicodeLookup[chTest&0xFF] + } else { + advance = defadv + } + } else { + advance = defadv + } + + test += advance + } else { // if (chTest == chMatch) + test2 = test + match = startmatch + + for { + if match == endmatch { + if b.rightToLeft { + return test2 + 1 + } else { + return test2 + } + } + + match -= bump + test2 -= bump + + chTest = text[test2] + + if b.caseInsensitive { + chTest = unicode.ToLower(chTest) + } + + if chTest != b.pattern[match] { + advance = b.positive[match] + if (chTest & 0xFF80) == 0 { + test2 = (match - startmatch) + b.negativeASCII[chTest] + } else if chTest < 0xffff && len(b.negativeUnicode) > 0 { + unicodeLookup = b.negativeUnicode[chTest>>8] + if len(unicodeLookup) > 0 { + test2 = (match - startmatch) + unicodeLookup[chTest&0xFF] + } else { + test += advance + break + } + } else { + test += advance + break + } + + if b.rightToLeft { + if test2 < advance { + advance = test2 + } + } else if test2 > advance { + advance = test2 + } + + test += advance + break + } + } + } + } +} + +// When a regex is anchored, we can do a quick IsMatch test instead of a Scan +func (b *BmPrefix) IsMatch(text []rune, index, beglimit, endlimit int) bool { + if !b.rightToLeft { + if index < beglimit || endlimit-index < len(b.pattern) { + return false + } + + return b.matchPattern(text, index) + } else { + if index > endlimit || index-beglimit < len(b.pattern) { + return false + } + + return b.matchPattern(text, index-len(b.pattern)) + } +} + +func (b *BmPrefix) matchPattern(text []rune, index int) bool { + if len(text)-index < len(b.pattern) { + return false + } + + if b.caseInsensitive { + for i := 0; i < len(b.pattern); i++ { + //Debug.Assert(textinfo.ToLower(_pattern[i]) == _pattern[i], "pattern should be converted to lower case in constructor!"); + if unicode.ToLower(text[index+i]) != b.pattern[i] { + return false + } + } + return true + } else { + for i := 0; i < len(b.pattern); i++ { + if text[index+i] != b.pattern[i] { + return false + } + } + return true + } +} + +type AnchorLoc int16 + +// where the regex can be pegged +const ( + AnchorBeginning AnchorLoc = 0x0001 + AnchorBol = 0x0002 + AnchorStart = 0x0004 + AnchorEol = 0x0008 + AnchorEndZ = 0x0010 + AnchorEnd = 0x0020 + AnchorBoundary = 0x0040 + AnchorECMABoundary = 0x0080 +) + +func getAnchors(tree *RegexTree) AnchorLoc { + + var concatNode *regexNode + nextChild, result := 0, AnchorLoc(0) + + curNode := tree.root + + for { + switch curNode.t { + case ntConcatenate: + if len(curNode.children) > 0 { + concatNode = curNode + nextChild = 0 + } + + case ntGreedy, ntCapture: + curNode = curNode.children[0] + concatNode = nil + continue + + case ntBol, ntEol, ntBoundary, ntECMABoundary, ntBeginning, + ntStart, ntEndZ, ntEnd: + return result | anchorFromType(curNode.t) + + case ntEmpty, ntRequire, ntPrevent: + + default: + return result + } + + if concatNode == nil || nextChild >= len(concatNode.children) { + return result + } + + curNode = concatNode.children[nextChild] + nextChild++ + } +} + +func anchorFromType(t nodeType) AnchorLoc { + switch t { + case ntBol: + return AnchorBol + case ntEol: + return AnchorEol + case ntBoundary: + return AnchorBoundary + case ntECMABoundary: + return AnchorECMABoundary + case ntBeginning: + return AnchorBeginning + case ntStart: + return AnchorStart + case ntEndZ: + return AnchorEndZ + case ntEnd: + return AnchorEnd + default: + return 0 + } +} + +// anchorDescription returns a human-readable description of the anchors +func (anchors AnchorLoc) String() string { + buf := &bytes.Buffer{} + + if 0 != (anchors & AnchorBeginning) { + buf.WriteString(", Beginning") + } + if 0 != (anchors & AnchorStart) { + buf.WriteString(", Start") + } + if 0 != (anchors & AnchorBol) { + buf.WriteString(", Bol") + } + if 0 != (anchors & AnchorBoundary) { + buf.WriteString(", Boundary") + } + if 0 != (anchors & AnchorECMABoundary) { + buf.WriteString(", ECMABoundary") + } + if 0 != (anchors & AnchorEol) { + buf.WriteString(", Eol") + } + if 0 != (anchors & AnchorEnd) { + buf.WriteString(", End") + } + if 0 != (anchors & AnchorEndZ) { + buf.WriteString(", EndZ") + } + + // trim off comma + if buf.Len() >= 2 { + return buf.String()[2:] + } + return "None" +} diff --git a/vendor/github.com/dlclark/regexp2/syntax/replacerdata.go b/vendor/github.com/dlclark/regexp2/syntax/replacerdata.go new file mode 100644 index 000000000..bcf4d3f25 --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/syntax/replacerdata.go @@ -0,0 +1,87 @@ +package syntax + +import ( + "bytes" + "errors" +) + +type ReplacerData struct { + Rep string + Strings []string + Rules []int +} + +const ( + replaceSpecials = 4 + replaceLeftPortion = -1 + replaceRightPortion = -2 + replaceLastGroup = -3 + replaceWholeString = -4 +) + +//ErrReplacementError is a general error during parsing the replacement text +var ErrReplacementError = errors.New("Replacement pattern error.") + +// NewReplacerData will populate a reusable replacer data struct based on the given replacement string +// and the capture group data from a regexp +func NewReplacerData(rep string, caps map[int]int, capsize int, capnames map[string]int, op RegexOptions) (*ReplacerData, error) { + p := parser{ + options: op, + caps: caps, + capsize: capsize, + capnames: capnames, + } + p.setPattern(rep) + concat, err := p.scanReplacement() + if err != nil { + return nil, err + } + + if concat.t != ntConcatenate { + panic(ErrReplacementError) + } + + sb := &bytes.Buffer{} + var ( + strings []string + rules []int + ) + + for _, child := range concat.children { + switch child.t { + case ntMulti: + child.writeStrToBuf(sb) + + case ntOne: + sb.WriteRune(child.ch) + + case ntRef: + if sb.Len() > 0 { + rules = append(rules, len(strings)) + strings = append(strings, sb.String()) + sb.Reset() + } + slot := child.m + + if len(caps) > 0 && slot >= 0 { + slot = caps[slot] + } + + rules = append(rules, -replaceSpecials-1-slot) + + default: + panic(ErrReplacementError) + } + } + + if sb.Len() > 0 { + rules = append(rules, len(strings)) + strings = append(strings, sb.String()) + } + + return &ReplacerData{ + Rep: rep, + Strings: strings, + Rules: rules, + }, nil +} diff --git a/vendor/github.com/dlclark/regexp2/syntax/tree.go b/vendor/github.com/dlclark/regexp2/syntax/tree.go new file mode 100644 index 000000000..ea2882931 --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/syntax/tree.go @@ -0,0 +1,654 @@ +package syntax + +import ( + "bytes" + "fmt" + "math" + "strconv" +) + +type RegexTree struct { + root *regexNode + caps map[int]int + capnumlist []int + captop int + Capnames map[string]int + Caplist []string + options RegexOptions +} + +// It is built into a parsed tree for a regular expression. + +// Implementation notes: +// +// Since the node tree is a temporary data structure only used +// during compilation of the regexp to integer codes, it's +// designed for clarity and convenience rather than +// space efficiency. +// +// RegexNodes are built into a tree, linked by the n.children list. +// Each node also has a n.parent and n.ichild member indicating +// its parent and which child # it is in its parent's list. +// +// RegexNodes come in as many types as there are constructs in +// a regular expression, for example, "concatenate", "alternate", +// "one", "rept", "group". There are also node types for basic +// peephole optimizations, e.g., "onerep", "notsetrep", etc. +// +// Because perl 5 allows "lookback" groups that scan backwards, +// each node also gets a "direction". Normally the value of +// boolean n.backward = false. +// +// During parsing, top-level nodes are also stacked onto a parse +// stack (a stack of trees). For this purpose we have a n.next +// pointer. [Note that to save a few bytes, we could overload the +// n.parent pointer instead.] +// +// On the parse stack, each tree has a "role" - basically, the +// nonterminal in the grammar that the parser has currently +// assigned to the tree. That code is stored in n.role. +// +// Finally, some of the different kinds of nodes have data. +// Two integers (for the looping constructs) are stored in +// n.operands, an an object (either a string or a set) +// is stored in n.data +type regexNode struct { + t nodeType + children []*regexNode + str []rune + set *CharSet + ch rune + m int + n int + options RegexOptions + next *regexNode +} + +type nodeType int32 + +const ( + // The following are leaves, and correspond to primitive operations + + ntOnerep nodeType = 0 // lef,back char,min,max a {n} + ntNotonerep = 1 // lef,back char,min,max .{n} + ntSetrep = 2 // lef,back set,min,max [\d]{n} + ntOneloop = 3 // lef,back char,min,max a {,n} + ntNotoneloop = 4 // lef,back char,min,max .{,n} + ntSetloop = 5 // lef,back set,min,max [\d]{,n} + ntOnelazy = 6 // lef,back char,min,max a {,n}? + ntNotonelazy = 7 // lef,back char,min,max .{,n}? + ntSetlazy = 8 // lef,back set,min,max [\d]{,n}? + ntOne = 9 // lef char a + ntNotone = 10 // lef char [^a] + ntSet = 11 // lef set [a-z\s] \w \s \d + ntMulti = 12 // lef string abcd + ntRef = 13 // lef group \# + ntBol = 14 // ^ + ntEol = 15 // $ + ntBoundary = 16 // \b + ntNonboundary = 17 // \B + ntBeginning = 18 // \A + ntStart = 19 // \G + ntEndZ = 20 // \Z + ntEnd = 21 // \Z + + // Interior nodes do not correspond to primitive operations, but + // control structures compositing other operations + + // Concat and alternate take n children, and can run forward or backwards + + ntNothing = 22 // [] + ntEmpty = 23 // () + ntAlternate = 24 // a|b + ntConcatenate = 25 // ab + ntLoop = 26 // m,x * + ? {,} + ntLazyloop = 27 // m,x *? +? ?? {,}? + ntCapture = 28 // n () + ntGroup = 29 // (?:) + ntRequire = 30 // (?=) (?<=) + ntPrevent = 31 // (?!) (?) (?<) + ntTestref = 33 // (?(n) | ) + ntTestgroup = 34 // (?(...) | ) + + ntECMABoundary = 41 // \b + ntNonECMABoundary = 42 // \B +) + +func newRegexNode(t nodeType, opt RegexOptions) *regexNode { + return ®exNode{ + t: t, + options: opt, + } +} + +func newRegexNodeCh(t nodeType, opt RegexOptions, ch rune) *regexNode { + return ®exNode{ + t: t, + options: opt, + ch: ch, + } +} + +func newRegexNodeStr(t nodeType, opt RegexOptions, str []rune) *regexNode { + return ®exNode{ + t: t, + options: opt, + str: str, + } +} + +func newRegexNodeSet(t nodeType, opt RegexOptions, set *CharSet) *regexNode { + return ®exNode{ + t: t, + options: opt, + set: set, + } +} + +func newRegexNodeM(t nodeType, opt RegexOptions, m int) *regexNode { + return ®exNode{ + t: t, + options: opt, + m: m, + } +} +func newRegexNodeMN(t nodeType, opt RegexOptions, m, n int) *regexNode { + return ®exNode{ + t: t, + options: opt, + m: m, + n: n, + } +} + +func (n *regexNode) writeStrToBuf(buf *bytes.Buffer) { + for i := 0; i < len(n.str); i++ { + buf.WriteRune(n.str[i]) + } +} + +func (n *regexNode) addChild(child *regexNode) { + reduced := child.reduce() + n.children = append(n.children, reduced) + reduced.next = n +} + +func (n *regexNode) insertChildren(afterIndex int, nodes []*regexNode) { + newChildren := make([]*regexNode, 0, len(n.children)+len(nodes)) + n.children = append(append(append(newChildren, n.children[:afterIndex]...), nodes...), n.children[afterIndex:]...) +} + +// removes children including the start but not the end index +func (n *regexNode) removeChildren(startIndex, endIndex int) { + n.children = append(n.children[:startIndex], n.children[endIndex:]...) +} + +// Pass type as OneLazy or OneLoop +func (n *regexNode) makeRep(t nodeType, min, max int) { + n.t += (t - ntOne) + n.m = min + n.n = max +} + +func (n *regexNode) reduce() *regexNode { + switch n.t { + case ntAlternate: + return n.reduceAlternation() + + case ntConcatenate: + return n.reduceConcatenation() + + case ntLoop, ntLazyloop: + return n.reduceRep() + + case ntGroup: + return n.reduceGroup() + + case ntSet, ntSetloop: + return n.reduceSet() + + default: + return n + } +} + +// Basic optimization. Single-letter alternations can be replaced +// by faster set specifications, and nested alternations with no +// intervening operators can be flattened: +// +// a|b|c|def|g|h -> [a-c]|def|[gh] +// apple|(?:orange|pear)|grape -> apple|orange|pear|grape +func (n *regexNode) reduceAlternation() *regexNode { + if len(n.children) == 0 { + return newRegexNode(ntNothing, n.options) + } + + wasLastSet := false + lastNodeCannotMerge := false + var optionsLast RegexOptions + var i, j int + + for i, j = 0, 0; i < len(n.children); i, j = i+1, j+1 { + at := n.children[i] + + if j < i { + n.children[j] = at + } + + for { + if at.t == ntAlternate { + for k := 0; k < len(at.children); k++ { + at.children[k].next = n + } + n.insertChildren(i+1, at.children) + + j-- + } else if at.t == ntSet || at.t == ntOne { + // Cannot merge sets if L or I options differ, or if either are negated. + optionsAt := at.options & (RightToLeft | IgnoreCase) + + if at.t == ntSet { + if !wasLastSet || optionsLast != optionsAt || lastNodeCannotMerge || !at.set.IsMergeable() { + wasLastSet = true + lastNodeCannotMerge = !at.set.IsMergeable() + optionsLast = optionsAt + break + } + } else if !wasLastSet || optionsLast != optionsAt || lastNodeCannotMerge { + wasLastSet = true + lastNodeCannotMerge = false + optionsLast = optionsAt + break + } + + // The last node was a Set or a One, we're a Set or One and our options are the same. + // Merge the two nodes. + j-- + prev := n.children[j] + + var prevCharClass *CharSet + if prev.t == ntOne { + prevCharClass = &CharSet{} + prevCharClass.addChar(prev.ch) + } else { + prevCharClass = prev.set + } + + if at.t == ntOne { + prevCharClass.addChar(at.ch) + } else { + prevCharClass.addSet(*at.set) + } + + prev.t = ntSet + prev.set = prevCharClass + } else if at.t == ntNothing { + j-- + } else { + wasLastSet = false + lastNodeCannotMerge = false + } + break + } + } + + if j < i { + n.removeChildren(j, i) + } + + return n.stripEnation(ntNothing) +} + +// Basic optimization. Adjacent strings can be concatenated. +// +// (?:abc)(?:def) -> abcdef +func (n *regexNode) reduceConcatenation() *regexNode { + // Eliminate empties and concat adjacent strings/chars + + var optionsLast RegexOptions + var optionsAt RegexOptions + var i, j int + + if len(n.children) == 0 { + return newRegexNode(ntEmpty, n.options) + } + + wasLastString := false + + for i, j = 0, 0; i < len(n.children); i, j = i+1, j+1 { + var at, prev *regexNode + + at = n.children[i] + + if j < i { + n.children[j] = at + } + + if at.t == ntConcatenate && + ((at.options & RightToLeft) == (n.options & RightToLeft)) { + for k := 0; k < len(at.children); k++ { + at.children[k].next = n + } + + //insert at.children at i+1 index in n.children + n.insertChildren(i+1, at.children) + + j-- + } else if at.t == ntMulti || at.t == ntOne { + // Cannot merge strings if L or I options differ + optionsAt = at.options & (RightToLeft | IgnoreCase) + + if !wasLastString || optionsLast != optionsAt { + wasLastString = true + optionsLast = optionsAt + continue + } + + j-- + prev = n.children[j] + + if prev.t == ntOne { + prev.t = ntMulti + prev.str = []rune{prev.ch} + } + + if (optionsAt & RightToLeft) == 0 { + if at.t == ntOne { + prev.str = append(prev.str, at.ch) + } else { + prev.str = append(prev.str, at.str...) + } + } else { + if at.t == ntOne { + // insert at the front by expanding our slice, copying the data over, and then setting the value + prev.str = append(prev.str, 0) + copy(prev.str[1:], prev.str) + prev.str[0] = at.ch + } else { + //insert at the front...this one we'll make a new slice and copy both into it + merge := make([]rune, len(prev.str)+len(at.str)) + copy(merge, at.str) + copy(merge[len(at.str):], prev.str) + prev.str = merge + } + } + } else if at.t == ntEmpty { + j-- + } else { + wasLastString = false + } + } + + if j < i { + // remove indices j through i from the children + n.removeChildren(j, i) + } + + return n.stripEnation(ntEmpty) +} + +// Nested repeaters just get multiplied with each other if they're not +// too lumpy +func (n *regexNode) reduceRep() *regexNode { + + u := n + t := n.t + min := n.m + max := n.n + + for { + if len(u.children) == 0 { + break + } + + child := u.children[0] + + // multiply reps of the same type only + if child.t != t { + childType := child.t + + if !(childType >= ntOneloop && childType <= ntSetloop && t == ntLoop || + childType >= ntOnelazy && childType <= ntSetlazy && t == ntLazyloop) { + break + } + } + + // child can be too lumpy to blur, e.g., (a {100,105}) {3} or (a {2,})? + // [but things like (a {2,})+ are not too lumpy...] + if u.m == 0 && child.m > 1 || child.n < child.m*2 { + break + } + + u = child + if u.m > 0 { + if (math.MaxInt32-1)/u.m < min { + u.m = math.MaxInt32 + } else { + u.m = u.m * min + } + } + if u.n > 0 { + if (math.MaxInt32-1)/u.n < max { + u.n = math.MaxInt32 + } else { + u.n = u.n * max + } + } + } + + if math.MaxInt32 == min { + return newRegexNode(ntNothing, n.options) + } + return u + +} + +// Simple optimization. If a concatenation or alternation has only +// one child strip out the intermediate node. If it has zero children, +// turn it into an empty. +func (n *regexNode) stripEnation(emptyType nodeType) *regexNode { + switch len(n.children) { + case 0: + return newRegexNode(emptyType, n.options) + case 1: + return n.children[0] + default: + return n + } +} + +func (n *regexNode) reduceGroup() *regexNode { + u := n + + for u.t == ntGroup { + u = u.children[0] + } + + return u +} + +// Simple optimization. If a set is a singleton, an inverse singleton, +// or empty, it's transformed accordingly. +func (n *regexNode) reduceSet() *regexNode { + // Extract empty-set, one and not-one case as special + + if n.set == nil { + n.t = ntNothing + } else if n.set.IsSingleton() { + n.ch = n.set.SingletonChar() + n.set = nil + n.t += (ntOne - ntSet) + } else if n.set.IsSingletonInverse() { + n.ch = n.set.SingletonChar() + n.set = nil + n.t += (ntNotone - ntSet) + } + + return n +} + +func (n *regexNode) reverseLeft() *regexNode { + if n.options&RightToLeft != 0 && n.t == ntConcatenate && len(n.children) > 0 { + //reverse children order + for left, right := 0, len(n.children)-1; left < right; left, right = left+1, right-1 { + n.children[left], n.children[right] = n.children[right], n.children[left] + } + } + + return n +} + +func (n *regexNode) makeQuantifier(lazy bool, min, max int) *regexNode { + if min == 0 && max == 0 { + return newRegexNode(ntEmpty, n.options) + } + + if min == 1 && max == 1 { + return n + } + + switch n.t { + case ntOne, ntNotone, ntSet: + if lazy { + n.makeRep(Onelazy, min, max) + } else { + n.makeRep(Oneloop, min, max) + } + return n + + default: + var t nodeType + if lazy { + t = ntLazyloop + } else { + t = ntLoop + } + result := newRegexNodeMN(t, n.options, min, max) + result.addChild(n) + return result + } +} + +// debug functions + +var typeStr = []string{ + "Onerep", "Notonerep", "Setrep", + "Oneloop", "Notoneloop", "Setloop", + "Onelazy", "Notonelazy", "Setlazy", + "One", "Notone", "Set", + "Multi", "Ref", + "Bol", "Eol", "Boundary", "Nonboundary", + "Beginning", "Start", "EndZ", "End", + "Nothing", "Empty", + "Alternate", "Concatenate", + "Loop", "Lazyloop", + "Capture", "Group", "Require", "Prevent", "Greedy", + "Testref", "Testgroup", + "Unknown", "Unknown", "Unknown", + "Unknown", "Unknown", "Unknown", + "ECMABoundary", "NonECMABoundary", +} + +func (n *regexNode) description() string { + buf := &bytes.Buffer{} + + buf.WriteString(typeStr[n.t]) + + if (n.options & ExplicitCapture) != 0 { + buf.WriteString("-C") + } + if (n.options & IgnoreCase) != 0 { + buf.WriteString("-I") + } + if (n.options & RightToLeft) != 0 { + buf.WriteString("-L") + } + if (n.options & Multiline) != 0 { + buf.WriteString("-M") + } + if (n.options & Singleline) != 0 { + buf.WriteString("-S") + } + if (n.options & IgnorePatternWhitespace) != 0 { + buf.WriteString("-X") + } + if (n.options & ECMAScript) != 0 { + buf.WriteString("-E") + } + + switch n.t { + case ntOneloop, ntNotoneloop, ntOnelazy, ntNotonelazy, ntOne, ntNotone: + buf.WriteString("(Ch = " + CharDescription(n.ch) + ")") + break + case ntCapture: + buf.WriteString("(index = " + strconv.Itoa(n.m) + ", unindex = " + strconv.Itoa(n.n) + ")") + break + case ntRef, ntTestref: + buf.WriteString("(index = " + strconv.Itoa(n.m) + ")") + break + case ntMulti: + fmt.Fprintf(buf, "(String = %s)", string(n.str)) + break + case ntSet, ntSetloop, ntSetlazy: + buf.WriteString("(Set = " + n.set.String() + ")") + break + } + + switch n.t { + case ntOneloop, ntNotoneloop, ntOnelazy, ntNotonelazy, ntSetloop, ntSetlazy, ntLoop, ntLazyloop: + buf.WriteString("(Min = ") + buf.WriteString(strconv.Itoa(n.m)) + buf.WriteString(", Max = ") + if n.n == math.MaxInt32 { + buf.WriteString("inf") + } else { + buf.WriteString(strconv.Itoa(n.n)) + } + buf.WriteString(")") + + break + } + + return buf.String() +} + +var padSpace = []byte(" ") + +func (t *RegexTree) Dump() string { + return t.root.dump() +} + +func (n *regexNode) dump() string { + var stack []int + CurNode := n + CurChild := 0 + + buf := bytes.NewBufferString(CurNode.description()) + buf.WriteRune('\n') + + for { + if CurNode.children != nil && CurChild < len(CurNode.children) { + stack = append(stack, CurChild+1) + CurNode = CurNode.children[CurChild] + CurChild = 0 + + Depth := len(stack) + if Depth > 32 { + Depth = 32 + } + buf.Write(padSpace[:Depth]) + buf.WriteString(CurNode.description()) + buf.WriteRune('\n') + } else { + if len(stack) == 0 { + break + } + + CurChild = stack[len(stack)-1] + stack = stack[:len(stack)-1] + CurNode = CurNode.next + } + } + return buf.String() +} diff --git a/vendor/github.com/dlclark/regexp2/syntax/writer.go b/vendor/github.com/dlclark/regexp2/syntax/writer.go new file mode 100644 index 000000000..a5aa11ca0 --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/syntax/writer.go @@ -0,0 +1,500 @@ +package syntax + +import ( + "bytes" + "fmt" + "math" + "os" +) + +func Write(tree *RegexTree) (*Code, error) { + w := writer{ + intStack: make([]int, 0, 32), + emitted: make([]int, 2), + stringhash: make(map[string]int), + sethash: make(map[string]int), + } + + code, err := w.codeFromTree(tree) + + if tree.options&Debug > 0 && code != nil { + os.Stdout.WriteString(code.Dump()) + os.Stdout.WriteString("\n") + } + + return code, err +} + +type writer struct { + emitted []int + + intStack []int + curpos int + stringhash map[string]int + stringtable [][]rune + sethash map[string]int + settable []*CharSet + counting bool + count int + trackcount int + caps map[int]int +} + +const ( + beforeChild nodeType = 64 + afterChild = 128 + //MaxPrefixSize is the largest number of runes we'll use for a BoyerMoyer prefix + MaxPrefixSize = 50 +) + +// The top level RegexCode generator. It does a depth-first walk +// through the tree and calls EmitFragment to emits code before +// and after each child of an interior node, and at each leaf. +// +// It runs two passes, first to count the size of the generated +// code, and second to generate the code. +// +// We should time it against the alternative, which is +// to just generate the code and grow the array as we go. +func (w *writer) codeFromTree(tree *RegexTree) (*Code, error) { + var ( + curNode *regexNode + curChild int + capsize int + ) + // construct sparse capnum mapping if some numbers are unused + + if tree.capnumlist == nil || tree.captop == len(tree.capnumlist) { + capsize = tree.captop + w.caps = nil + } else { + capsize = len(tree.capnumlist) + w.caps = tree.caps + for i := 0; i < len(tree.capnumlist); i++ { + w.caps[tree.capnumlist[i]] = i + } + } + + w.counting = true + + for { + if !w.counting { + w.emitted = make([]int, w.count) + } + + curNode = tree.root + curChild = 0 + + w.emit1(Lazybranch, 0) + + for { + if len(curNode.children) == 0 { + w.emitFragment(curNode.t, curNode, 0) + } else if curChild < len(curNode.children) { + w.emitFragment(curNode.t|beforeChild, curNode, curChild) + + curNode = curNode.children[curChild] + + w.pushInt(curChild) + curChild = 0 + continue + } + + if w.emptyStack() { + break + } + + curChild = w.popInt() + curNode = curNode.next + + w.emitFragment(curNode.t|afterChild, curNode, curChild) + curChild++ + } + + w.patchJump(0, w.curPos()) + w.emit(Stop) + + if !w.counting { + break + } + + w.counting = false + } + + fcPrefix := getFirstCharsPrefix(tree) + prefix := getPrefix(tree) + rtl := (tree.options & RightToLeft) != 0 + + var bmPrefix *BmPrefix + //TODO: benchmark string prefixes + if prefix != nil && len(prefix.PrefixStr) > 0 && MaxPrefixSize > 0 { + if len(prefix.PrefixStr) > MaxPrefixSize { + // limit prefix changes to 10k + prefix.PrefixStr = prefix.PrefixStr[:MaxPrefixSize] + } + bmPrefix = newBmPrefix(prefix.PrefixStr, prefix.CaseInsensitive, rtl) + } else { + bmPrefix = nil + } + + return &Code{ + Codes: w.emitted, + Strings: w.stringtable, + Sets: w.settable, + TrackCount: w.trackcount, + Caps: w.caps, + Capsize: capsize, + FcPrefix: fcPrefix, + BmPrefix: bmPrefix, + Anchors: getAnchors(tree), + RightToLeft: rtl, + }, nil +} + +// The main RegexCode generator. It does a depth-first walk +// through the tree and calls EmitFragment to emits code before +// and after each child of an interior node, and at each leaf. +func (w *writer) emitFragment(nodetype nodeType, node *regexNode, curIndex int) error { + bits := InstOp(0) + + if nodetype <= ntRef { + if (node.options & RightToLeft) != 0 { + bits |= Rtl + } + if (node.options & IgnoreCase) != 0 { + bits |= Ci + } + } + ntBits := nodeType(bits) + + switch nodetype { + case ntConcatenate | beforeChild, ntConcatenate | afterChild, ntEmpty: + break + + case ntAlternate | beforeChild: + if curIndex < len(node.children)-1 { + w.pushInt(w.curPos()) + w.emit1(Lazybranch, 0) + } + + case ntAlternate | afterChild: + if curIndex < len(node.children)-1 { + lbPos := w.popInt() + w.pushInt(w.curPos()) + w.emit1(Goto, 0) + w.patchJump(lbPos, w.curPos()) + } else { + for i := 0; i < curIndex; i++ { + w.patchJump(w.popInt(), w.curPos()) + } + } + break + + case ntTestref | beforeChild: + if curIndex == 0 { + w.emit(Setjump) + w.pushInt(w.curPos()) + w.emit1(Lazybranch, 0) + w.emit1(Testref, w.mapCapnum(node.m)) + w.emit(Forejump) + } + + case ntTestref | afterChild: + if curIndex == 0 { + branchpos := w.popInt() + w.pushInt(w.curPos()) + w.emit1(Goto, 0) + w.patchJump(branchpos, w.curPos()) + w.emit(Forejump) + if len(node.children) <= 1 { + w.patchJump(w.popInt(), w.curPos()) + } + } else if curIndex == 1 { + w.patchJump(w.popInt(), w.curPos()) + } + + case ntTestgroup | beforeChild: + if curIndex == 0 { + w.emit(Setjump) + w.emit(Setmark) + w.pushInt(w.curPos()) + w.emit1(Lazybranch, 0) + } + + case ntTestgroup | afterChild: + if curIndex == 0 { + w.emit(Getmark) + w.emit(Forejump) + } else if curIndex == 1 { + Branchpos := w.popInt() + w.pushInt(w.curPos()) + w.emit1(Goto, 0) + w.patchJump(Branchpos, w.curPos()) + w.emit(Getmark) + w.emit(Forejump) + if len(node.children) <= 2 { + w.patchJump(w.popInt(), w.curPos()) + } + } else if curIndex == 2 { + w.patchJump(w.popInt(), w.curPos()) + } + + case ntLoop | beforeChild, ntLazyloop | beforeChild: + + if node.n < math.MaxInt32 || node.m > 1 { + if node.m == 0 { + w.emit1(Nullcount, 0) + } else { + w.emit1(Setcount, 1-node.m) + } + } else if node.m == 0 { + w.emit(Nullmark) + } else { + w.emit(Setmark) + } + + if node.m == 0 { + w.pushInt(w.curPos()) + w.emit1(Goto, 0) + } + w.pushInt(w.curPos()) + + case ntLoop | afterChild, ntLazyloop | afterChild: + + startJumpPos := w.curPos() + lazy := (nodetype - (ntLoop | afterChild)) + + if node.n < math.MaxInt32 || node.m > 1 { + if node.n == math.MaxInt32 { + w.emit2(InstOp(Branchcount+lazy), w.popInt(), math.MaxInt32) + } else { + w.emit2(InstOp(Branchcount+lazy), w.popInt(), node.n-node.m) + } + } else { + w.emit1(InstOp(Branchmark+lazy), w.popInt()) + } + + if node.m == 0 { + w.patchJump(w.popInt(), startJumpPos) + } + + case ntGroup | beforeChild, ntGroup | afterChild: + + case ntCapture | beforeChild: + w.emit(Setmark) + + case ntCapture | afterChild: + w.emit2(Capturemark, w.mapCapnum(node.m), w.mapCapnum(node.n)) + + case ntRequire | beforeChild: + // NOTE: the following line causes lookahead/lookbehind to be + // NON-BACKTRACKING. It can be commented out with (*) + w.emit(Setjump) + + w.emit(Setmark) + + case ntRequire | afterChild: + w.emit(Getmark) + + // NOTE: the following line causes lookahead/lookbehind to be + // NON-BACKTRACKING. It can be commented out with (*) + w.emit(Forejump) + + case ntPrevent | beforeChild: + w.emit(Setjump) + w.pushInt(w.curPos()) + w.emit1(Lazybranch, 0) + + case ntPrevent | afterChild: + w.emit(Backjump) + w.patchJump(w.popInt(), w.curPos()) + w.emit(Forejump) + + case ntGreedy | beforeChild: + w.emit(Setjump) + + case ntGreedy | afterChild: + w.emit(Forejump) + + case ntOne, ntNotone: + w.emit1(InstOp(node.t|ntBits), int(node.ch)) + + case ntNotoneloop, ntNotonelazy, ntOneloop, ntOnelazy: + if node.m > 0 { + if node.t == ntOneloop || node.t == ntOnelazy { + w.emit2(Onerep|bits, int(node.ch), node.m) + } else { + w.emit2(Notonerep|bits, int(node.ch), node.m) + } + } + if node.n > node.m { + if node.n == math.MaxInt32 { + w.emit2(InstOp(node.t|ntBits), int(node.ch), math.MaxInt32) + } else { + w.emit2(InstOp(node.t|ntBits), int(node.ch), node.n-node.m) + } + } + + case ntSetloop, ntSetlazy: + if node.m > 0 { + w.emit2(Setrep|bits, w.setCode(node.set), node.m) + } + if node.n > node.m { + if node.n == math.MaxInt32 { + w.emit2(InstOp(node.t|ntBits), w.setCode(node.set), math.MaxInt32) + } else { + w.emit2(InstOp(node.t|ntBits), w.setCode(node.set), node.n-node.m) + } + } + + case ntMulti: + w.emit1(InstOp(node.t|ntBits), w.stringCode(node.str)) + + case ntSet: + w.emit1(InstOp(node.t|ntBits), w.setCode(node.set)) + + case ntRef: + w.emit1(InstOp(node.t|ntBits), w.mapCapnum(node.m)) + + case ntNothing, ntBol, ntEol, ntBoundary, ntNonboundary, ntECMABoundary, ntNonECMABoundary, ntBeginning, ntStart, ntEndZ, ntEnd: + w.emit(InstOp(node.t)) + + default: + return fmt.Errorf("unexpected opcode in regular expression generation: %v", nodetype) + } + + return nil +} + +// To avoid recursion, we use a simple integer stack. +// This is the push. +func (w *writer) pushInt(i int) { + w.intStack = append(w.intStack, i) +} + +// Returns true if the stack is empty. +func (w *writer) emptyStack() bool { + return len(w.intStack) == 0 +} + +// This is the pop. +func (w *writer) popInt() int { + //get our item + idx := len(w.intStack) - 1 + i := w.intStack[idx] + //trim our slice + w.intStack = w.intStack[:idx] + return i +} + +// Returns the current position in the emitted code. +func (w *writer) curPos() int { + return w.curpos +} + +// Fixes up a jump instruction at the specified offset +// so that it jumps to the specified jumpDest. +func (w *writer) patchJump(offset, jumpDest int) { + w.emitted[offset+1] = jumpDest +} + +// Returns an index in the set table for a charset +// uses a map to eliminate duplicates. +func (w *writer) setCode(set *CharSet) int { + if w.counting { + return 0 + } + + buf := &bytes.Buffer{} + + set.mapHashFill(buf) + hash := buf.String() + i, ok := w.sethash[hash] + if !ok { + i = len(w.sethash) + w.sethash[hash] = i + w.settable = append(w.settable, set) + } + return i +} + +// Returns an index in the string table for a string. +// uses a map to eliminate duplicates. +func (w *writer) stringCode(str []rune) int { + if w.counting { + return 0 + } + + hash := string(str) + i, ok := w.stringhash[hash] + if !ok { + i = len(w.stringhash) + w.stringhash[hash] = i + w.stringtable = append(w.stringtable, str) + } + + return i +} + +// When generating code on a regex that uses a sparse set +// of capture slots, we hash them to a dense set of indices +// for an array of capture slots. Instead of doing the hash +// at match time, it's done at compile time, here. +func (w *writer) mapCapnum(capnum int) int { + if capnum == -1 { + return -1 + } + + if w.caps != nil { + return w.caps[capnum] + } + + return capnum +} + +// Emits a zero-argument operation. Note that the emit +// functions all run in two modes: they can emit code, or +// they can just count the size of the code. +func (w *writer) emit(op InstOp) { + if w.counting { + w.count++ + if opcodeBacktracks(op) { + w.trackcount++ + } + return + } + w.emitted[w.curpos] = int(op) + w.curpos++ +} + +// Emits a one-argument operation. +func (w *writer) emit1(op InstOp, opd1 int) { + if w.counting { + w.count += 2 + if opcodeBacktracks(op) { + w.trackcount++ + } + return + } + w.emitted[w.curpos] = int(op) + w.curpos++ + w.emitted[w.curpos] = opd1 + w.curpos++ +} + +// Emits a two-argument operation. +func (w *writer) emit2(op InstOp, opd1, opd2 int) { + if w.counting { + w.count += 3 + if opcodeBacktracks(op) { + w.trackcount++ + } + return + } + w.emitted[w.curpos] = int(op) + w.curpos++ + w.emitted[w.curpos] = opd1 + w.curpos++ + w.emitted[w.curpos] = opd2 + w.curpos++ +} diff --git a/vendor/github.com/dlclark/regexp2/testoutput1 b/vendor/github.com/dlclark/regexp2/testoutput1 new file mode 100644 index 000000000..fbf63fdf2 --- /dev/null +++ b/vendor/github.com/dlclark/regexp2/testoutput1 @@ -0,0 +1,7061 @@ +# This set of tests is for features that are compatible with all versions of +# Perl >= 5.10, in non-UTF mode. It should run clean for the 8-bit, 16-bit, and +# 32-bit PCRE libraries, and also using the perltest.pl script. + +#forbid_utf +#newline_default lf any anycrlf +#perltest + +/the quick brown fox/ + the quick brown fox + 0: the quick brown fox + What do you know about the quick brown fox? + 0: the quick brown fox +\= Expect no match + The quick brown FOX +No match + What do you know about THE QUICK BROWN FOX? +No match + +/The quick brown fox/i + the quick brown fox + 0: the quick brown fox + The quick brown FOX + 0: The quick brown FOX + What do you know about the quick brown fox? + 0: the quick brown fox + What do you know about THE QUICK BROWN FOX? + 0: THE QUICK BROWN FOX + +/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/ + abcd\t\n\r\f\a\e9;\$\\?caxyz + 0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz + +/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/ + abxyzpqrrrabbxyyyypqAzz + 0: abxyzpqrrrabbxyyyypqAzz + abxyzpqrrrabbxyyyypqAzz + 0: abxyzpqrrrabbxyyyypqAzz + aabxyzpqrrrabbxyyyypqAzz + 0: aabxyzpqrrrabbxyyyypqAzz + aaabxyzpqrrrabbxyyyypqAzz + 0: aaabxyzpqrrrabbxyyyypqAzz + aaaabxyzpqrrrabbxyyyypqAzz + 0: aaaabxyzpqrrrabbxyyyypqAzz + abcxyzpqrrrabbxyyyypqAzz + 0: abcxyzpqrrrabbxyyyypqAzz + aabcxyzpqrrrabbxyyyypqAzz + 0: aabcxyzpqrrrabbxyyyypqAzz + aaabcxyzpqrrrabbxyyyypAzz + 0: aaabcxyzpqrrrabbxyyyypAzz + aaabcxyzpqrrrabbxyyyypqAzz + 0: aaabcxyzpqrrrabbxyyyypqAzz + aaabcxyzpqrrrabbxyyyypqqAzz + 0: aaabcxyzpqrrrabbxyyyypqqAzz + aaabcxyzpqrrrabbxyyyypqqqAzz + 0: aaabcxyzpqrrrabbxyyyypqqqAzz + aaabcxyzpqrrrabbxyyyypqqqqAzz + 0: aaabcxyzpqrrrabbxyyyypqqqqAzz + aaabcxyzpqrrrabbxyyyypqqqqqAzz + 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz + aaabcxyzpqrrrabbxyyyypqqqqqqAzz + 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz + aaaabcxyzpqrrrabbxyyyypqAzz + 0: aaaabcxyzpqrrrabbxyyyypqAzz + abxyzzpqrrrabbxyyyypqAzz + 0: abxyzzpqrrrabbxyyyypqAzz + aabxyzzzpqrrrabbxyyyypqAzz + 0: aabxyzzzpqrrrabbxyyyypqAzz + aaabxyzzzzpqrrrabbxyyyypqAzz + 0: aaabxyzzzzpqrrrabbxyyyypqAzz + aaaabxyzzzzpqrrrabbxyyyypqAzz + 0: aaaabxyzzzzpqrrrabbxyyyypqAzz + abcxyzzpqrrrabbxyyyypqAzz + 0: abcxyzzpqrrrabbxyyyypqAzz + aabcxyzzzpqrrrabbxyyyypqAzz + 0: aabcxyzzzpqrrrabbxyyyypqAzz + aaabcxyzzzzpqrrrabbxyyyypqAzz + 0: aaabcxyzzzzpqrrrabbxyyyypqAzz + aaaabcxyzzzzpqrrrabbxyyyypqAzz + 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz + aaaabcxyzzzzpqrrrabbbxyyyypqAzz + 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz + aaaabcxyzzzzpqrrrabbbxyyyyypqAzz + 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz + aaabcxyzpqrrrabbxyyyypABzz + 0: aaabcxyzpqrrrabbxyyyypABzz + aaabcxyzpqrrrabbxyyyypABBzz + 0: aaabcxyzpqrrrabbxyyyypABBzz + >>>aaabxyzpqrrrabbxyyyypqAzz + 0: aaabxyzpqrrrabbxyyyypqAzz + >aaaabxyzpqrrrabbxyyyypqAzz + 0: aaaabxyzpqrrrabbxyyyypqAzz + >>>>abcxyzpqrrrabbxyyyypqAzz + 0: abcxyzpqrrrabbxyyyypqAzz +\= Expect no match + abxyzpqrrabbxyyyypqAzz +No match + abxyzpqrrrrabbxyyyypqAzz +No match + abxyzpqrrrabxyyyypqAzz +No match + aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz +No match + aaaabcxyzzzzpqrrrabbbxyyypqAzz +No match + aaabcxyzpqrrrabbxyyyypqqqqqqqAzz +No match + +/^(abc){1,2}zz/ + abczz + 0: abczz + 1: abc + abcabczz + 0: abcabczz + 1: abc +\= Expect no match + zz +No match + abcabcabczz +No match + >>abczz +No match + +/^(b+?|a){1,2}?c/ + bc + 0: bc + 1: b + bbc + 0: bbc + 1: b + bbbc + 0: bbbc + 1: bb + bac + 0: bac + 1: a + bbac + 0: bbac + 1: a + aac + 0: aac + 1: a + abbbbbbbbbbbc + 0: abbbbbbbbbbbc + 1: bbbbbbbbbbb + bbbbbbbbbbbac + 0: bbbbbbbbbbbac + 1: a +\= Expect no match + aaac +No match + abbbbbbbbbbbac +No match + +/^(b+|a){1,2}c/ + bc + 0: bc + 1: b + bbc + 0: bbc + 1: bb + bbbc + 0: bbbc + 1: bbb + bac + 0: bac + 1: a + bbac + 0: bbac + 1: a + aac + 0: aac + 1: a + abbbbbbbbbbbc + 0: abbbbbbbbbbbc + 1: bbbbbbbbbbb + bbbbbbbbbbbac + 0: bbbbbbbbbbbac + 1: a +\= Expect no match + aaac +No match + abbbbbbbbbbbac +No match + +/^(b+|a){1,2}?bc/ + bbc + 0: bbc + 1: b + +/^(b*|ba){1,2}?bc/ + babc + 0: babc + 1: ba + bbabc + 0: bbabc + 1: ba + bababc + 0: bababc + 1: ba +\= Expect no match + bababbc +No match + babababc +No match + +/^(ba|b*){1,2}?bc/ + babc + 0: babc + 1: ba + bbabc + 0: bbabc + 1: ba + bababc + 0: bababc + 1: ba +\= Expect no match + bababbc +No match + babababc +No match + +#/^\ca\cA\c[;\c:/ +# \x01\x01\e;z +# 0: \x01\x01\x1b;z + +/^[ab\]cde]/ + athing + 0: a + bthing + 0: b + ]thing + 0: ] + cthing + 0: c + dthing + 0: d + ething + 0: e +\= Expect no match + fthing +No match + [thing +No match + \\thing +No match + +/^[]cde]/ + ]thing + 0: ] + cthing + 0: c + dthing + 0: d + ething + 0: e +\= Expect no match + athing +No match + fthing +No match + +/^[^ab\]cde]/ + fthing + 0: f + [thing + 0: [ + \\thing + 0: \ +\= Expect no match + athing +No match + bthing +No match + ]thing +No match + cthing +No match + dthing +No match + ething +No match + +/^[^]cde]/ + athing + 0: a + fthing + 0: f +\= Expect no match + ]thing +No match + cthing +No match + dthing +No match + ething +No match + +# DLC - I don't get this one +#/^\/ +#  +# 0: \x81 + +#updated to handle 16-bits utf8 +/^ÿ/ + ÿ + 0: \xc3\xbf + +/^[0-9]+$/ + 0 + 0: 0 + 1 + 0: 1 + 2 + 0: 2 + 3 + 0: 3 + 4 + 0: 4 + 5 + 0: 5 + 6 + 0: 6 + 7 + 0: 7 + 8 + 0: 8 + 9 + 0: 9 + 10 + 0: 10 + 100 + 0: 100 +\= Expect no match + abc +No match + +/^.*nter/ + enter + 0: enter + inter + 0: inter + uponter + 0: uponter + +/^xxx[0-9]+$/ + xxx0 + 0: xxx0 + xxx1234 + 0: xxx1234 +\= Expect no match + xxx +No match + +/^.+[0-9][0-9][0-9]$/ + x123 + 0: x123 + x1234 + 0: x1234 + xx123 + 0: xx123 + 123456 + 0: 123456 +\= Expect no match + 123 +No match + +/^.+?[0-9][0-9][0-9]$/ + x123 + 0: x123 + x1234 + 0: x1234 + xx123 + 0: xx123 + 123456 + 0: 123456 +\= Expect no match + 123 +No match + +/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/ + abc!pqr=apquxz.ixr.zzz.ac.uk + 0: abc!pqr=apquxz.ixr.zzz.ac.uk + 1: abc + 2: pqr +\= Expect no match + !pqr=apquxz.ixr.zzz.ac.uk +No match + abc!=apquxz.ixr.zzz.ac.uk +No match + abc!pqr=apquxz:ixr.zzz.ac.uk +No match + abc!pqr=apquxz.ixr.zzz.ac.ukk +No match + +/:/ + Well, we need a colon: somewhere + 0: : +\= Expect no match + Fail without a colon +No match + +/([\da-f:]+)$/i + 0abc + 0: 0abc + 1: 0abc + abc + 0: abc + 1: abc + fed + 0: fed + 1: fed + E + 0: E + 1: E + :: + 0: :: + 1: :: + 5f03:12C0::932e + 0: 5f03:12C0::932e + 1: 5f03:12C0::932e + fed def + 0: def + 1: def + Any old stuff + 0: ff + 1: ff +\= Expect no match + 0zzz +No match + gzzz +No match + fed\x20 +No match + Any old rubbish +No match + +/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ + .1.2.3 + 0: .1.2.3 + 1: 1 + 2: 2 + 3: 3 + A.12.123.0 + 0: A.12.123.0 + 1: 12 + 2: 123 + 3: 0 +\= Expect no match + .1.2.3333 +No match + 1.2.3 +No match + 1234.2.3 +No match + +/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ + 1 IN SOA non-sp1 non-sp2( + 0: 1 IN SOA non-sp1 non-sp2( + 1: 1 + 2: non-sp1 + 3: non-sp2 + 1 IN SOA non-sp1 non-sp2 ( + 0: 1 IN SOA non-sp1 non-sp2 ( + 1: 1 + 2: non-sp1 + 3: non-sp2 +\= Expect no match + 1IN SOA non-sp1 non-sp2( +No match + +/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/ + a. + 0: a. + Z. + 0: Z. + 2. + 0: 2. + ab-c.pq-r. + 0: ab-c.pq-r. + 1: .pq-r + sxk.zzz.ac.uk. + 0: sxk.zzz.ac.uk. + 1: .uk + x-.y-. + 0: x-.y-. + 1: .y- +\= Expect no match + -abc.peq. +No match + +/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/ + *.a + 0: *.a + *.b0-a + 0: *.b0-a + 1: 0-a + *.c3-b.c + 0: *.c3-b.c + 1: 3-b + 2: .c + *.c-a.b-c + 0: *.c-a.b-c + 1: -a + 2: .b-c + 3: -c +\= Expect no match + *.0 +No match + *.a- +No match + *.a-b.c- +No match + *.c-a.0-c +No match + +/^(?=ab(de))(abd)(e)/ + abde + 0: abde + 1: de + 2: abd + 3: e + +/^(?!(ab)de|x)(abd)(f)/ + abdf + 0: abdf + 1: + 2: abd + 3: f + +/^(?=(ab(cd)))(ab)/ + abcd + 0: ab + 1: abcd + 2: cd + 3: ab + +/^[\da-f](\.[\da-f])*$/i + a.b.c.d + 0: a.b.c.d + 1: .d + A.B.C.D + 0: A.B.C.D + 1: .D + a.b.c.1.2.3.C + 0: a.b.c.1.2.3.C + 1: .C + +/^\".*\"\s*(;.*)?$/ + \"1234\" + 0: "1234" + \"abcd\" ; + 0: "abcd" ; + 1: ; + \"\" ; rhubarb + 0: "" ; rhubarb + 1: ; rhubarb +\= Expect no match + \"1234\" : things +No match + +/^$/ + \ + 0: +\= Expect no match + A non-empty line +No match + +/ ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x + ab c + 0: ab c +\= Expect no match + abc +No match + ab cde +No match + +/(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/ + ab c + 0: ab c +\= Expect no match + abc +No match + ab cde +No match + +/^ a\ b[c ]d $/x + a bcd + 0: a bcd + a b d + 0: a b d +\= Expect no match + abcd +No match + ab d +No match + +/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/ + abcdefhijklm + 0: abcdefhijklm + 1: abc + 2: bc + 3: c + 4: def + 5: ef + 6: f + 7: hij + 8: ij + 9: j +10: klm +11: lm +12: m + +/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/ + abcdefhijklm + 0: abcdefhijklm + 1: bc + 2: c + 3: ef + 4: f + 5: ij + 6: j + 7: lm + 8: m + +#/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/ +# a+ Z0+\x08\n\x1d\x12 +# 0: a+ Z0+\x08\x0a\x1d\x12 + +/^[.^$|()*+?{,}]+/ + .^\$(*+)|{?,?} + 0: .^$(*+)|{?,?} + +/^a*\w/ + z + 0: z + az + 0: az + aaaz + 0: aaaz + a + 0: a + aa + 0: aa + aaaa + 0: aaaa + a+ + 0: a + aa+ + 0: aa + +/^a*?\w/ + z + 0: z + az + 0: a + aaaz + 0: a + a + 0: a + aa + 0: a + aaaa + 0: a + a+ + 0: a + aa+ + 0: a + +/^a+\w/ + az + 0: az + aaaz + 0: aaaz + aa + 0: aa + aaaa + 0: aaaa + aa+ + 0: aa + +/^a+?\w/ + az + 0: az + aaaz + 0: aa + aa + 0: aa + aaaa + 0: aa + aa+ + 0: aa + +/^\d{8}\w{2,}/ + 1234567890 + 0: 1234567890 + 12345678ab + 0: 12345678ab + 12345678__ + 0: 12345678__ +\= Expect no match + 1234567 +No match + +/^[aeiou\d]{4,5}$/ + uoie + 0: uoie + 1234 + 0: 1234 + 12345 + 0: 12345 + aaaaa + 0: aaaaa +\= Expect no match + 123456 +No match + +/^[aeiou\d]{4,5}?/ + uoie + 0: uoie + 1234 + 0: 1234 + 12345 + 0: 1234 + aaaaa + 0: aaaa + 123456 + 0: 1234 + +/\A(abc|def)=(\1){2,3}\Z/ + abc=abcabc + 0: abc=abcabc + 1: abc + 2: abc + def=defdefdef + 0: def=defdefdef + 1: def + 2: def +\= Expect no match + abc=defdef +No match + +/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/ + abcdefghijkcda2 + 0: abcdefghijkcda2 + 1: a + 2: b + 3: c + 4: d + 5: e + 6: f + 7: g + 8: h + 9: i +10: j +11: k +12: cd + abcdefghijkkkkcda2 + 0: abcdefghijkkkkcda2 + 1: a + 2: b + 3: c + 4: d + 5: e + 6: f + 7: g + 8: h + 9: i +10: j +11: k +12: cd + +/(cat(a(ract|tonic)|erpillar)) \1()2(3)/ + cataract cataract23 + 0: cataract cataract23 + 1: cataract + 2: aract + 3: ract + 4: + 5: 3 + catatonic catatonic23 + 0: catatonic catatonic23 + 1: catatonic + 2: atonic + 3: tonic + 4: + 5: 3 + caterpillar caterpillar23 + 0: caterpillar caterpillar23 + 1: caterpillar + 2: erpillar + 3: + 4: + 5: 3 + + +/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/ + From abcd Mon Sep 01 12:33:02 1997 + 0: From abcd Mon Sep 01 12:33 + 1: abcd + +/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/ + From abcd Mon Sep 01 12:33:02 1997 + 0: From abcd Mon Sep 01 12:33 + 1: Sep + From abcd Mon Sep 1 12:33:02 1997 + 0: From abcd Mon Sep 1 12:33 + 1: Sep +\= Expect no match + From abcd Sep 01 12:33:02 1997 +No match + +/^12.34/s + 12\n34 + 0: 12\x0a34 + 12\r34 + 0: 12\x0d34 + +/\w+(?=\t)/ + the quick brown\t fox + 0: brown + +/foo(?!bar)(.*)/ + foobar is foolish see? + 0: foolish see? + 1: lish see? + +/(?:(?!foo)...|^.{0,2})bar(.*)/ + foobar crowbar etc + 0: rowbar etc + 1: etc + barrel + 0: barrel + 1: rel + 2barrel + 0: 2barrel + 1: rel + A barrel + 0: A barrel + 1: rel + +/^(\D*)(?=\d)(?!123)/ + abc456 + 0: abc + 1: abc +\= Expect no match + abc123 +No match + +/^1234(?# test newlines + inside)/ + 1234 + 0: 1234 + +/^1234 #comment in extended re + /x + 1234 + 0: 1234 + +/#rhubarb + abcd/x + abcd + 0: abcd + +/^abcd#rhubarb/x + abcd + 0: abcd + +/^(a)\1{2,3}(.)/ + aaab + 0: aaab + 1: a + 2: b + aaaab + 0: aaaab + 1: a + 2: b + aaaaab + 0: aaaaa + 1: a + 2: a + aaaaaab + 0: aaaaa + 1: a + 2: a + +/(?!^)abc/ + the abc + 0: abc +\= Expect no match + abc +No match + +/(?=^)abc/ + abc + 0: abc +\= Expect no match + the abc +No match + +/^[ab]{1,3}(ab*|b)/ + aabbbbb + 0: aabb + 1: b + +/^[ab]{1,3}?(ab*|b)/ + aabbbbb + 0: aabbbbb + 1: abbbbb + +/^[ab]{1,3}?(ab*?|b)/ + aabbbbb + 0: aa + 1: a + +/^[ab]{1,3}(ab*?|b)/ + aabbbbb + 0: aabb + 1: b + +/ (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* # optional leading comment +(?: (?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +" (?: # opening quote... +[^\\\x80-\xff\n\015"] # Anything except backslash and quote +| # or +\\ [^\x80-\xff] # Escaped something (something != CR) +)* " # closing quote +) # initial word +(?: (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* \. (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* (?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +" (?: # opening quote... +[^\\\x80-\xff\n\015"] # Anything except backslash and quote +| # or +\\ [^\x80-\xff] # Escaped something (something != CR) +)* " # closing quote +) )* # further okay, if led by a period +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* @ (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* (?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| \[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) # initial subdomain +(?: # +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* \. # if led by a period... +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* (?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| \[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) # ...further okay +)* +# address +| # or +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +" (?: # opening quote... +[^\\\x80-\xff\n\015"] # Anything except backslash and quote +| # or +\\ [^\x80-\xff] # Escaped something (something != CR) +)* " # closing quote +) # one word, optionally followed by.... +(?: +[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or... +\( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) | # comments, or... + +" (?: # opening quote... +[^\\\x80-\xff\n\015"] # Anything except backslash and quote +| # or +\\ [^\x80-\xff] # Escaped something (something != CR) +)* " # closing quote +# quoted strings +)* +< (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* # leading < +(?: @ (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* (?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| \[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) # initial subdomain +(?: # +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* \. # if led by a period... +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* (?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| \[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) # ...further okay +)* + +(?: (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* , (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* @ (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* (?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| \[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) # initial subdomain +(?: # +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* \. # if led by a period... +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* (?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| \[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) # ...further okay +)* +)* # further okay, if led by comma +: # closing colon +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* )? # optional route +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +" (?: # opening quote... +[^\\\x80-\xff\n\015"] # Anything except backslash and quote +| # or +\\ [^\x80-\xff] # Escaped something (something != CR) +)* " # closing quote +) # initial word +(?: (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* \. (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* (?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +" (?: # opening quote... +[^\\\x80-\xff\n\015"] # Anything except backslash and quote +| # or +\\ [^\x80-\xff] # Escaped something (something != CR) +)* " # closing quote +) )* # further okay, if led by a period +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* @ (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* (?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| \[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) # initial subdomain +(?: # +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* \. # if led by a period... +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* (?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| \[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) # ...further okay +)* +# address spec +(?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* > # trailing > +# name and address +) (?: [\040\t] | \( +(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* +\) )* # optional trailing comment +/x + Alan Other + 0: Alan Other + + 0: user@dom.ain + user\@dom.ain + 0: user@dom.ain + \"A. Other\" (a comment) + 0: "A. Other" (a comment) + A. Other (a comment) + 0: Other (a comment) + \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay + 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay + A missing angle @,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +# Atom +| # or +" # " +[^\\\x80-\xff\n\015"] * # normal +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* +" # " +# Quoted string +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +\. +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +# Atom +| # or +" # " +[^\\\x80-\xff\n\015"] * # normal +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* +" # " +# Quoted string +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# additional words +)* +@ +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +\[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# optional trailing comments +(?: +\. +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +\[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# optional trailing comments +)* +# address +| # or +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +# Atom +| # or +" # " +[^\\\x80-\xff\n\015"] * # normal +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* +" # " +# Quoted string +) +# leading word +[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces +(?: +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +| +" # " +[^\\\x80-\xff\n\015"] * # normal +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* +" # " +) # "special" comment or quoted string +[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal" +)* +< +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# < +(?: +@ +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +\[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# optional trailing comments +(?: +\. +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +\[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# optional trailing comments +)* +(?: , +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +@ +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +\[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# optional trailing comments +(?: +\. +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +\[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# optional trailing comments +)* +)* # additional domains +: +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# optional trailing comments +)? # optional route +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +# Atom +| # or +" # " +[^\\\x80-\xff\n\015"] * # normal +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* +" # " +# Quoted string +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +\. +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +# Atom +| # or +" # " +[^\\\x80-\xff\n\015"] * # normal +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* +" # " +# Quoted string +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# additional words +)* +@ +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +\[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# optional trailing comments +(?: +\. +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +(?: +[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... +(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom +| +\[ # [ +(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff +\] # ] +) +[\040\t]* # Nab whitespace. +(?: +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: # ( +(?: \\ [^\x80-\xff] | +\( # ( +[^\\\x80-\xff\n\015()] * # normal* +(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* +\) # ) +) # special +[^\\\x80-\xff\n\015()] * # normal* +)* # )* +\) # ) +[\040\t]* )* # If comment found, allow more spaces. +# optional trailing comments +)* +# address spec +> # > +# name and address +) +/x + Alan Other + 0: Alan Other + + 0: user@dom.ain + user\@dom.ain + 0: user@dom.ain + \"A. Other\" (a comment) + 0: "A. Other" + A. Other (a comment) + 0: Other + \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay + 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay + A missing angle ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f + +/P[^*]TAIRE[^*]{1,6}?LL/ + xxxxxxxxxxxPSTAIREISLLxxxxxxxxx + 0: PSTAIREISLL + +/P[^*]TAIRE[^*]{1,}?LL/ + xxxxxxxxxxxPSTAIREISLLxxxxxxxxx + 0: PSTAIREISLL + +/(\.\d\d[1-9]?)\d+/ + 1.230003938 + 0: .230003938 + 1: .23 + 1.875000282 + 0: .875000282 + 1: .875 + 1.235 + 0: .235 + 1: .23 + +/(\.\d\d((?=0)|\d(?=\d)))/ + 1.230003938 + 0: .23 + 1: .23 + 2: + 1.875000282 + 0: .875 + 1: .875 + 2: 5 +\= Expect no match + 1.235 +No match + +/\b(foo)\s+(\w+)/i + Food is on the foo table + 0: foo table + 1: foo + 2: table + +/foo(.*)bar/ + The food is under the bar in the barn. + 0: food is under the bar in the bar + 1: d is under the bar in the + +/foo(.*?)bar/ + The food is under the bar in the barn. + 0: food is under the bar + 1: d is under the + +/(.*)(\d*)/ + I have 2 numbers: 53147 + 0: I have 2 numbers: 53147 + 1: I have 2 numbers: 53147 + 2: + +/(.*)(\d+)/ + I have 2 numbers: 53147 + 0: I have 2 numbers: 53147 + 1: I have 2 numbers: 5314 + 2: 7 + +/(.*?)(\d*)/ + I have 2 numbers: 53147 + 0: + 1: + 2: + +/(.*?)(\d+)/ + I have 2 numbers: 53147 + 0: I have 2 + 1: I have + 2: 2 + +/(.*)(\d+)$/ + I have 2 numbers: 53147 + 0: I have 2 numbers: 53147 + 1: I have 2 numbers: 5314 + 2: 7 + +/(.*?)(\d+)$/ + I have 2 numbers: 53147 + 0: I have 2 numbers: 53147 + 1: I have 2 numbers: + 2: 53147 + +/(.*)\b(\d+)$/ + I have 2 numbers: 53147 + 0: I have 2 numbers: 53147 + 1: I have 2 numbers: + 2: 53147 + +/(.*\D)(\d+)$/ + I have 2 numbers: 53147 + 0: I have 2 numbers: 53147 + 1: I have 2 numbers: + 2: 53147 + +/^\D*(?!123)/ + ABC123 + 0: AB + +/^(\D*)(?=\d)(?!123)/ + ABC445 + 0: ABC + 1: ABC +\= Expect no match + ABC123 +No match + +/^[W-]46]/ + W46]789 + 0: W46] + -46]789 + 0: -46] +\= Expect no match + Wall +No match + Zebra +No match + 42 +No match + [abcd] +No match + ]abcd[ +No match + +/^[W-\]46]/ + W46]789 + 0: W + Wall + 0: W + Zebra + 0: Z + Xylophone + 0: X + 42 + 0: 4 + [abcd] + 0: [ + ]abcd[ + 0: ] + \\backslash + 0: \ +\= Expect no match + -46]789 +No match + well +No match + +/\d\d\/\d\d\/\d\d\d\d/ + 01/01/2000 + 0: 01/01/2000 + +/word (?:[a-zA-Z0-9]+ ){0,10}otherword/ + word cat dog elephant mussel cow horse canary baboon snake shark otherword + 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword +\= Expect no match + word cat dog elephant mussel cow horse canary baboon snake shark +No match + +/word (?:[a-zA-Z0-9]+ ){0,300}otherword/ +\= Expect no match + word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope +No match + +/^(a){0,0}/ + bcd + 0: + abc + 0: + aab + 0: + +/^(a){0,1}/ + bcd + 0: + abc + 0: a + 1: a + aab + 0: a + 1: a + +/^(a){0,2}/ + bcd + 0: + abc + 0: a + 1: a + aab + 0: aa + 1: a + +/^(a){0,3}/ + bcd + 0: + abc + 0: a + 1: a + aab + 0: aa + 1: a + aaa + 0: aaa + 1: a + +/^(a){0,}/ + bcd + 0: + abc + 0: a + 1: a + aab + 0: aa + 1: a + aaa + 0: aaa + 1: a + aaaaaaaa + 0: aaaaaaaa + 1: a + +/^(a){1,1}/ + abc + 0: a + 1: a + aab + 0: a + 1: a +\= Expect no match + bcd +No match + +/^(a){1,2}/ + abc + 0: a + 1: a + aab + 0: aa + 1: a +\= Expect no match + bcd +No match + +/^(a){1,3}/ + abc + 0: a + 1: a + aab + 0: aa + 1: a + aaa + 0: aaa + 1: a +\= Expect no match + bcd +No match + +/^(a){1,}/ + abc + 0: a + 1: a + aab + 0: aa + 1: a + aaa + 0: aaa + 1: a + aaaaaaaa + 0: aaaaaaaa + 1: a +\= Expect no match + bcd +No match + +/.*\.gif/ + borfle\nbib.gif\nno + 0: bib.gif + +/.{0,}\.gif/ + borfle\nbib.gif\nno + 0: bib.gif + +/.*\.gif/m + borfle\nbib.gif\nno + 0: bib.gif + +/.*\.gif/s + borfle\nbib.gif\nno + 0: borfle\x0abib.gif + +/.*\.gif/ms + borfle\nbib.gif\nno + 0: borfle\x0abib.gif + +/.*$/ + borfle\nbib.gif\nno + 0: no + +/.*$/m + borfle\nbib.gif\nno + 0: borfle + +/.*$/s + borfle\nbib.gif\nno + 0: borfle\x0abib.gif\x0ano + +/.*$/ms + borfle\nbib.gif\nno + 0: borfle\x0abib.gif\x0ano + +/.*$/ + borfle\nbib.gif\nno\n + 0: no + +/.*$/m + borfle\nbib.gif\nno\n + 0: borfle + +/.*$/s + borfle\nbib.gif\nno\n + 0: borfle\x0abib.gif\x0ano\x0a + +/.*$/ms + borfle\nbib.gif\nno\n + 0: borfle\x0abib.gif\x0ano\x0a + +/(.*X|^B)/ + abcde\n1234Xyz + 0: 1234X + 1: 1234X + BarFoo + 0: B + 1: B +\= Expect no match + abcde\nBar +No match + +/(.*X|^B)/m + abcde\n1234Xyz + 0: 1234X + 1: 1234X + BarFoo + 0: B + 1: B + abcde\nBar + 0: B + 1: B + +/(.*X|^B)/s + abcde\n1234Xyz + 0: abcde\x0a1234X + 1: abcde\x0a1234X + BarFoo + 0: B + 1: B +\= Expect no match + abcde\nBar +No match + +/(.*X|^B)/ms + abcde\n1234Xyz + 0: abcde\x0a1234X + 1: abcde\x0a1234X + BarFoo + 0: B + 1: B + abcde\nBar + 0: B + 1: B + +/(?s)(.*X|^B)/ + abcde\n1234Xyz + 0: abcde\x0a1234X + 1: abcde\x0a1234X + BarFoo + 0: B + 1: B +\= Expect no match + abcde\nBar +No match + +/(?s:.*X|^B)/ + abcde\n1234Xyz + 0: abcde\x0a1234X + BarFoo + 0: B +\= Expect no match + abcde\nBar +No match + +/^.*B/ +\= Expect no match + abc\nB +No match + +/(?s)^.*B/ + abc\nB + 0: abc\x0aB + +/(?m)^.*B/ + abc\nB + 0: B + +/(?ms)^.*B/ + abc\nB + 0: abc\x0aB + +/(?ms)^B/ + abc\nB + 0: B + +/(?s)B$/ + B\n + 0: B + +/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/ + 123456654321 + 0: 123456654321 + +/^\d\d\d\d\d\d\d\d\d\d\d\d/ + 123456654321 + 0: 123456654321 + +/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/ + 123456654321 + 0: 123456654321 + +/^[abc]{12}/ + abcabcabcabc + 0: abcabcabcabc + +/^[a-c]{12}/ + abcabcabcabc + 0: abcabcabcabc + +/^(a|b|c){12}/ + abcabcabcabc + 0: abcabcabcabc + 1: c + +/^[abcdefghijklmnopqrstuvwxy0123456789]/ + n + 0: n +\= Expect no match + z +No match + +/abcde{0,0}/ + abcd + 0: abcd +\= Expect no match + abce +No match + +/ab[cd]{0,0}e/ + abe + 0: abe +\= Expect no match + abcde +No match + +/ab(c){0,0}d/ + abd + 0: abd +\= Expect no match + abcd +No match + +/a(b*)/ + a + 0: a + 1: + ab + 0: ab + 1: b + abbbb + 0: abbbb + 1: bbbb +\= Expect no match + bbbbb +No match + +/ab\d{0}e/ + abe + 0: abe +\= Expect no match + ab1e +No match + +/"([^\\"]+|\\.)*"/ + the \"quick\" brown fox + 0: "quick" + 1: quick + \"the \\\"quick\\\" brown fox\" + 0: "the \"quick\" brown fox" + 1: brown fox + +/]{0,})>]{0,})>([\d]{0,}\.)(.*)((
([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is + 43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide + 0: 43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide + 1: BGCOLOR='#DBE9E9' + 2: align=left valign=top + 3: 43. + 4: Word Processor
(N-1286) + 5: + 6: + 7: + 8: align=left valign=top + 9: Lega lstaff.com +10: align=left valign=top +11: CA - Statewide + +/a[^a]b/ + acb + 0: acb + a\nb + 0: a\x0ab + +/a.b/ + acb + 0: acb +\= Expect no match + a\nb +No match + +/a[^a]b/s + acb + 0: acb + a\nb + 0: a\x0ab + +/a.b/s + acb + 0: acb + a\nb + 0: a\x0ab + +/^(b+?|a){1,2}?c/ + bac + 0: bac + 1: a + bbac + 0: bbac + 1: a + bbbac + 0: bbbac + 1: a + bbbbac + 0: bbbbac + 1: a + bbbbbac + 0: bbbbbac + 1: a + +/^(b+|a){1,2}?c/ + bac + 0: bac + 1: a + bbac + 0: bbac + 1: a + bbbac + 0: bbbac + 1: a + bbbbac + 0: bbbbac + 1: a + bbbbbac + 0: bbbbbac + 1: a + +/(?!\A)x/m + a\bx\n + 0: x + a\nx\n + 0: x +\= Expect no match + x\nb\n +No match + +/(A|B)*?CD/ + CD + 0: CD + +/(A|B)*CD/ + CD + 0: CD + +/(AB)*?\1/ + ABABAB + 0: ABAB + 1: AB + +/(AB)*\1/ + ABABAB + 0: ABABAB + 1: AB + +/(?.*/)foo" + /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo + 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo +\= Expect no match + /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/ +No match + +/(?>(\.\d\d[1-9]?))\d+/ + 1.230003938 + 0: .230003938 + 1: .23 + 1.875000282 + 0: .875000282 + 1: .875 +\= Expect no match + 1.235 +No match + +/^((?>\w+)|(?>\s+))*$/ + now is the time for all good men to come to the aid of the party + 0: now is the time for all good men to come to the aid of the party + 1: party +\= Expect no match + this is not a line with only words and spaces! +No match + +/(\d+)(\w)/ + 12345a + 0: 12345a + 1: 12345 + 2: a + 12345+ + 0: 12345 + 1: 1234 + 2: 5 + +/((?>\d+))(\w)/ + 12345a + 0: 12345a + 1: 12345 + 2: a +\= Expect no match + 12345+ +No match + +/(?>a+)b/ + aaab + 0: aaab + +/((?>a+)b)/ + aaab + 0: aaab + 1: aaab + +/(?>(a+))b/ + aaab + 0: aaab + 1: aaa + +/(?>b)+/ + aaabbbccc + 0: bbb + +/(?>a+|b+|c+)*c/ + aaabbbbccccd + 0: aaabbbbc + +/((?>[^()]+)|\([^()]*\))+/ + ((abc(ade)ufh()()x + 0: abc(ade)ufh()()x + 1: x + +/\(((?>[^()]+)|\([^()]+\))+\)/ + (abc) + 0: (abc) + 1: abc + (abc(def)xyz) + 0: (abc(def)xyz) + 1: xyz +\= Expect no match + ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +No match + +/a(?-i)b/i + ab + 0: ab + Ab + 0: Ab +\= Expect no match + aB +No match + AB +No match + +/(a (?x)b c)d e/ + a bcd e + 0: a bcd e + 1: a bc +\= Expect no match + a b cd e +No match + abcd e +No match + a bcde +No match + +/(a b(?x)c d (?-x)e f)/ + a bcde f + 0: a bcde f + 1: a bcde f +\= Expect no match + abcdef +No match + +/(a(?i)b)c/ + abc + 0: abc + 1: ab + aBc + 0: aBc + 1: aB +\= Expect no match + abC +No match + aBC +No match + Abc +No match + ABc +No match + ABC +No match + AbC +No match + +/a(?i:b)c/ + abc + 0: abc + aBc + 0: aBc +\= Expect no match + ABC +No match + abC +No match + aBC +No match + +/a(?i:b)*c/ + aBc + 0: aBc + aBBc + 0: aBBc +\= Expect no match + aBC +No match + aBBC +No match + +/a(?=b(?i)c)\w\wd/ + abcd + 0: abcd + abCd + 0: abCd +\= Expect no match + aBCd +No match + abcD +No match + +/(?s-i:more.*than).*million/i + more than million + 0: more than million + more than MILLION + 0: more than MILLION + more \n than Million + 0: more \x0a than Million +\= Expect no match + MORE THAN MILLION +No match + more \n than \n million +No match + +/(?:(?s-i)more.*than).*million/i + more than million + 0: more than million + more than MILLION + 0: more than MILLION + more \n than Million + 0: more \x0a than Million +\= Expect no match + MORE THAN MILLION +No match + more \n than \n million +No match + +/(?>a(?i)b+)+c/ + abc + 0: abc + aBbc + 0: aBbc + aBBc + 0: aBBc +\= Expect no match + Abc +No match + abAb +No match + abbC +No match + +/(?=a(?i)b)\w\wc/ + abc + 0: abc + aBc + 0: aBc +\= Expect no match + Ab +No match + abC +No match + aBC +No match + +/(?<=a(?i)b)(\w\w)c/ + abxxc + 0: xxc + 1: xx + aBxxc + 0: xxc + 1: xx +\= Expect no match + Abxxc +No match + ABxxc +No match + abxxC +No match + +/(?:(a)|b)(?(1)A|B)/ + aA + 0: aA + 1: a + bB + 0: bB +\= Expect no match + aB +No match + bA +No match + +/^(a)?(?(1)a|b)+$/ + aa + 0: aa + 1: a + b + 0: b + bb + 0: bb +\= Expect no match + ab +No match + +# Perl gets this next one wrong if the pattern ends with $; in that case it +# fails to match "12". + +/^(?(?=abc)\w{3}:|\d\d)/ + abc: + 0: abc: + 12 + 0: 12 + 123 + 0: 12 +\= Expect no match + xyz +No match + +/^(?(?!abc)\d\d|\w{3}:)$/ + abc: + 0: abc: + 12 + 0: 12 +\= Expect no match + 123 +No match + xyz +No match + +/(?(?<=foo)bar|cat)/ + foobar + 0: bar + cat + 0: cat + fcat + 0: cat + focat + 0: cat +\= Expect no match + foocat +No match + +/(?(?a*)*/ + a + 0: a + aa + 0: aa + aaaa + 0: aaaa + +/(abc|)+/ + abc + 0: abc + 1: + abcabc + 0: abcabc + 1: + abcabcabc + 0: abcabcabc + 1: + xyz + 0: + 1: + +/([a]*)*/ + a + 0: a + 1: + aaaaa + 0: aaaaa + 1: + +/([ab]*)*/ + a + 0: a + 1: + b + 0: b + 1: + ababab + 0: ababab + 1: + aaaabcde + 0: aaaab + 1: + bbbb + 0: bbbb + 1: + +/([^a]*)*/ + b + 0: b + 1: + bbbb + 0: bbbb + 1: + aaa + 0: + 1: + +/([^ab]*)*/ + cccc + 0: cccc + 1: + abab + 0: + 1: + +/([a]*?)*/ + a + 0: + 1: + aaaa + 0: + 1: + +/([ab]*?)*/ + a + 0: + 1: + b + 0: + 1: + abab + 0: + 1: + baba + 0: + 1: + +/([^a]*?)*/ + b + 0: + 1: + bbbb + 0: + 1: + aaa + 0: + 1: + +/([^ab]*?)*/ + c + 0: + 1: + cccc + 0: + 1: + baba + 0: + 1: + +/(?>a*)*/ + a + 0: a + aaabcde + 0: aaa + +/((?>a*))*/ + aaaaa + 0: aaaaa + 1: + aabbaa + 0: aa + 1: + +/((?>a*?))*/ + aaaaa + 0: + 1: + aabbaa + 0: + 1: + +/(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x + 12-sep-98 + 0: 12-sep-98 + 12-09-98 + 0: 12-09-98 +\= Expect no match + sep-12-98 +No match + +/(?<=(foo))bar\1/ + foobarfoo + 0: barfoo + 1: foo + foobarfootling + 0: barfoo + 1: foo +\= Expect no match + foobar +No match + barfoo +No match + +/(?i:saturday|sunday)/ + saturday + 0: saturday + sunday + 0: sunday + Saturday + 0: Saturday + Sunday + 0: Sunday + SATURDAY + 0: SATURDAY + SUNDAY + 0: SUNDAY + SunDay + 0: SunDay + +/(a(?i)bc|BB)x/ + abcx + 0: abcx + 1: abc + aBCx + 0: aBCx + 1: aBC + bbx + 0: bbx + 1: bb + BBx + 0: BBx + 1: BB +\= Expect no match + abcX +No match + aBCX +No match + bbX +No match + BBX +No match + +/^([ab](?i)[cd]|[ef])/ + ac + 0: ac + 1: ac + aC + 0: aC + 1: aC + bD + 0: bD + 1: bD + elephant + 0: e + 1: e + Europe + 0: E + 1: E + frog + 0: f + 1: f + France + 0: F + 1: F +\= Expect no match + Africa +No match + +/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/ + ab + 0: ab + 1: ab + aBd + 0: aBd + 1: aBd + xy + 0: xy + 1: xy + xY + 0: xY + 1: xY + zebra + 0: z + 1: z + Zambesi + 0: Z + 1: Z +\= Expect no match + aCD +No match + XY +No match + +/(?<=foo\n)^bar/m + foo\nbar + 0: bar +\= Expect no match + bar +No match + baz\nbar +No match + +/(?<=(?]&/ + <&OUT + 0: <& + +/^(a\1?){4}$/ + aaaaaaaaaa + 0: aaaaaaaaaa + 1: aaaa +\= Expect no match + AB +No match + aaaaaaaaa +No match + aaaaaaaaaaa +No match + +/^(a(?(1)\1)){4}$/ + aaaaaaaaaa + 0: aaaaaaaaaa + 1: aaaa +\= Expect no match + aaaaaaaaa +No match + aaaaaaaaaaa +No match + +/(?:(f)(o)(o)|(b)(a)(r))*/ + foobar + 0: foobar + 1: f + 2: o + 3: o + 4: b + 5: a + 6: r + +/(?<=a)b/ + ab + 0: b +\= Expect no match + cb +No match + b +No match + +/(? + 2: abcd + xy:z:::abcd + 0: xy:z:::abcd + 1: xy:z::: + 2: abcd + +/^[^bcd]*(c+)/ + aexycd + 0: aexyc + 1: c + +/(a*)b+/ + caab + 0: aab + 1: aa + +/([\w:]+::)?(\w+)$/ + abcd + 0: abcd + 1: + 2: abcd + xy:z:::abcd + 0: xy:z:::abcd + 1: xy:z::: + 2: abcd +\= Expect no match + abcd: +No match + abcd: +No match + +/^[^bcd]*(c+)/ + aexycd + 0: aexyc + 1: c + +/(>a+)ab/ + +/(?>a+)b/ + aaab + 0: aaab + +/([[:]+)/ + a:[b]: + 0: :[ + 1: :[ + +/([[=]+)/ + a=[b]= + 0: =[ + 1: =[ + +/([[.]+)/ + a.[b]. + 0: .[ + 1: .[ + +/((?>a+)b)/ + aaab + 0: aaab + 1: aaab + +/(?>(a+))b/ + aaab + 0: aaab + 1: aaa + +/((?>[^()]+)|\([^()]*\))+/ + ((abc(ade)ufh()()x + 0: abc(ade)ufh()()x + 1: x + +/a\Z/ +\= Expect no match + aaab +No match + a\nb\n +No match + +/b\Z/ + a\nb\n + 0: b + +/b\z/ + +/b\Z/ + a\nb + 0: b + +/b\z/ + a\nb + 0: b + +/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/ + a + 0: a + 1: + abc + 0: abc + 1: + a-b + 0: a-b + 1: + 0-9 + 0: 0-9 + 1: + a.b + 0: a.b + 1: + 5.6.7 + 0: 5.6.7 + 1: + the.quick.brown.fox + 0: the.quick.brown.fox + 1: + a100.b200.300c + 0: a100.b200.300c + 1: + 12-ab.1245 + 0: 12-ab.1245 + 1: +\= Expect no match + \ +No match + .a +No match + -a +No match + a- +No match + a. +No match + a_b +No match + a.- +No match + a.. +No match + ab..bc +No match + the.quick.brown.fox- +No match + the.quick.brown.fox. +No match + the.quick.brown.fox_ +No match + the.quick.brown.fox+ +No match + +/(?>.*)(?<=(abcd|wxyz))/ + alphabetabcd + 0: alphabetabcd + 1: abcd + endingwxyz + 0: endingwxyz + 1: wxyz +\= Expect no match + a rather long string that doesn't end with one of them +No match + +/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/ + word cat dog elephant mussel cow horse canary baboon snake shark otherword + 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword +\= Expect no match + word cat dog elephant mussel cow horse canary baboon snake shark +No match + +/word (?>[a-zA-Z0-9]+ ){0,30}otherword/ +\= Expect no match + word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope +No match + +/(?<=\d{3}(?!999))foo/ + 999foo + 0: foo + 123999foo + 0: foo +\= Expect no match + 123abcfoo +No match + +/(?<=(?!...999)\d{3})foo/ + 999foo + 0: foo + 123999foo + 0: foo +\= Expect no match + 123abcfoo +No match + +/(?<=\d{3}(?!999)...)foo/ + 123abcfoo + 0: foo + 123456foo + 0: foo +\= Expect no match + 123999foo +No match + +/(?<=\d{3}...)(? + 2: + 3: abcd +
+ 2: + 3: abcd + \s*)=(?>\s*) # find + 2: + 3: abcd + Z)+|A)*/ + ZABCDEFG + 0: ZA + 1: A + +/((?>)+|A)*/ + ZABCDEFG + 0: + 1: + +/^[\d-a]/ + abcde + 0: a + -things + 0: - + 0digit + 0: 0 +\= Expect no match + bcdef +No match + +/[\s]+/ + > \x09\x0a\x0c\x0d\x0b< + 0: \x09\x0a\x0c\x0d\x0b + +/\s+/ + > \x09\x0a\x0c\x0d\x0b< + 0: \x09\x0a\x0c\x0d\x0b + +/a b/x + ab + 0: ab + +/(?!\A)x/m + a\nxb\n + 0: x + +/(?!^)x/m +\= Expect no match + a\nxb\n +No match + +#/abc\Qabc\Eabc/ +# abcabcabc +# 0: abcabcabc + +#/abc\Q(*+|\Eabc/ +# abc(*+|abc +# 0: abc(*+|abc + +#/ abc\Q abc\Eabc/x +# abc abcabc +# 0: abc abcabc +#\= Expect no match +# abcabcabc +#No match + +#/abc#comment +# \Q#not comment +# literal\E/x +# abc#not comment\n literal +# 0: abc#not comment\x0a literal + +#/abc#comment +# \Q#not comment +# literal/x +# abc#not comment\n literal +# 0: abc#not comment\x0a literal + +#/abc#comment +# \Q#not comment +# literal\E #more comment +# /x +# abc#not comment\n literal +# 0: abc#not comment\x0a literal + +#/abc#comment +# \Q#not comment +# literal\E #more comment/x +# abc#not comment\n literal +# 0: abc#not comment\x0a literal + +#/\Qabc\$xyz\E/ +# abc\\\$xyz +# 0: abc\$xyz + +#/\Qabc\E\$\Qxyz\E/ +# abc\$xyz +# 0: abc$xyz + +/\Gabc/ + abc + 0: abc +\= Expect no match + xyzabc +No match + +/a(?x: b c )d/ + XabcdY + 0: abcd +\= Expect no match + Xa b c d Y +No match + +/((?x)x y z | a b c)/ + XabcY + 0: abc + 1: abc + AxyzB + 0: xyz + 1: xyz + +/(?i)AB(?-i)C/ + XabCY + 0: abC +\= Expect no match + XabcY +No match + +/((?i)AB(?-i)C|D)E/ + abCE + 0: abCE + 1: abC + DE + 0: DE + 1: D +\= Expect no match + abcE +No match + abCe +No match + dE +No match + De +No match + +/(.*)\d+\1/ + abc123abc + 0: abc123abc + 1: abc + abc123bc + 0: bc123bc + 1: bc + +/(.*)\d+\1/s + abc123abc + 0: abc123abc + 1: abc + abc123bc + 0: bc123bc + 1: bc + +/((.*))\d+\1/ + abc123abc + 0: abc123abc + 1: abc + 2: abc + abc123bc + 0: bc123bc + 1: bc + 2: bc + +# This tests for an IPv6 address in the form where it can have up to +# eight components, one and only one of which is empty. This must be +# an internal component. + +/^(?!:) # colon disallowed at start + (?: # start of item + (?: [0-9a-f]{1,4} | # 1-4 hex digits or + (?(1)0 | () ) ) # if null previously matched, fail; else null + : # followed by colon + ){1,7} # end item; 1-7 of them required + [0-9a-f]{1,4} $ # final hex number at end of string + (?(1)|.) # check that there was an empty component + /ix + a123::a123 + 0: a123::a123 + 1: + a123:b342::abcd + 0: a123:b342::abcd + 1: + a123:b342::324e:abcd + 0: a123:b342::324e:abcd + 1: + a123:ddde:b342::324e:abcd + 0: a123:ddde:b342::324e:abcd + 1: + a123:ddde:b342::324e:dcba:abcd + 0: a123:ddde:b342::324e:dcba:abcd + 1: + a123:ddde:9999:b342::324e:dcba:abcd + 0: a123:ddde:9999:b342::324e:dcba:abcd + 1: +\= Expect no match + 1:2:3:4:5:6:7:8 +No match + a123:bce:ddde:9999:b342::324e:dcba:abcd +No match + a123::9999:b342::324e:dcba:abcd +No match + abcde:2:3:4:5:6:7:8 +No match + ::1 +No match + abcd:fee0:123:: +No match + :1 +No match + 1: +No match + +#/[z\Qa-d]\E]/ +# z +# 0: z +# a +# 0: a +# - +# 0: - +# d +# 0: d +# ] +# 0: ] +#\= Expect no match +# b +#No match + +#TODO: PCRE has an optimization to make this workable, .NET does not +#/(a+)*b/ +#\= Expect no match +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +#No match + +# All these had to be updated because we understand unicode +# and this looks like it's expecting single byte matches + +# .NET generates \xe4...not sure what's up, might just be different code pages +/(?i)reg(?:ul(?:[aä]|ae)r|ex)/ + REGular + 0: REGular + regulaer + 0: regulaer + Regex + 0: Regex + regulär + 0: regul\xc3\xa4r + +#/Åæåä[à-ÿÀ-ß]+/ +# Åæåäà +# 0: \xc5\xe6\xe5\xe4\xe0 +# Åæåäÿ +# 0: \xc5\xe6\xe5\xe4\xff +# ÅæåäÀ +# 0: \xc5\xe6\xe5\xe4\xc0 +# Åæåäß +# 0: \xc5\xe6\xe5\xe4\xdf + +/(?<=Z)X./ + \x84XAZXB + 0: XB + +/ab cd (?x) de fg/ + ab cd defg + 0: ab cd defg + +/ab cd(?x) de fg/ + ab cddefg + 0: ab cddefg +\= Expect no match + abcddefg +No match + +/(? + 2: + D + 0: D + 1: + 2: + +# this is really long with debug -- removing for now +#/(a|)*\d/ +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 +# 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 +# 1: +#\= Expect no match +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +#No match + +/(?>a|)*\d/ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 + 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 +\= Expect no match + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +No match + +/(?:a|)*\d/ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 + 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 +\= Expect no match + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +No match + +/^(?s)(?>.*)(? + 2: a + +/(?>(a))b|(a)c/ + ac + 0: ac + 1: + 2: a + +/(?=(a))ab|(a)c/ + ac + 0: ac + 1: + 2: a + +/((?>(a))b|(a)c)/ + ac + 0: ac + 1: ac + 2: + 3: a + +/(?=(?>(a))b|(a)c)(..)/ + ac + 0: ac + 1: + 2: a + 3: ac + +/(?>(?>(a))b|(a)c)/ + ac + 0: ac + 1: + 2: a + +/((?>(a+)b)+(aabab))/ + aaaabaaabaabab + 0: aaaabaaabaabab + 1: aaaabaaabaabab + 2: aaa + 3: aabab + +/(?>a+|ab)+?c/ +\= Expect no match + aabc +No match + +/(?>a+|ab)+c/ +\= Expect no match + aabc +No match + +/(?:a+|ab)+c/ + aabc + 0: aabc + +/^(?:a|ab)+c/ + aaaabc + 0: aaaabc + +/(?=abc){0}xyz/ + xyz + 0: xyz + +/(?=abc){1}xyz/ +\= Expect no match + xyz +No match + +/(?=(a))?./ + ab + 0: a + 1: a + bc + 0: b + +/(?=(a))??./ + ab + 0: a + bc + 0: b + +/^(?!a){0}\w+/ + aaaaa + 0: aaaaa + +/(?<=(abc))?xyz/ + abcxyz + 0: xyz + 1: abc + pqrxyz + 0: xyz + +/^[g]+/ + ggg<<>> + 0: ggg<<>> +\= Expect no match + \\ga +No match + +/^[ga]+/ + gggagagaxyz + 0: gggagaga + +/[:a]xxx[b:]/ + :xxx: + 0: :xxx: + +/(?<=a{2})b/i + xaabc + 0: b +\= Expect no match + xabc +No match + +/(? +# 4: +# 5: c +# 6: d +# 7: Y + +#/^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/ +# XYabcdY +# 0: XYabcdY +# 1: a +# 2: b +# 3: +# 4: +# 5: c +# 6: d +# 7: Y + +/(?'abc'\w+):\k{2}/ + a:aaxyz + 0: a:aa + 1: a + ab:ababxyz + 0: ab:abab + 1: ab +\= Expect no match + a:axyz +No match + ab:abxyz +No match + +/^(?a)? (?(ab)b|c) (?(ab)d|e)/x + abd + 0: abd + 1: a + ce + 0: ce + +# .NET has more consistent grouping numbers with these dupe groups for the two options +/(?:a(? (?')|(?")) |b(? (?')|(?")) ) (?(quote)[a-z]+|[0-9]+)/x,dupnames + a\"aaaaa + 0: a"aaaaa + 1: " + 2: + 3: " + b\"aaaaa + 0: b"aaaaa + 1: " + 2: + 3: " +\= Expect no match + b\"11111 +No match + +#/(?P(?P0)(?P>L1)|(?P>L2))/ +# 0 +# 0: 0 +# 1: 0 +# 00 +# 0: 00 +# 1: 00 +# 2: 0 +# 0000 +# 0: 0000 +# 1: 0000 +# 2: 0 + +#/(?P(?P0)|(?P>L2)(?P>L1))/ +# 0 +# 0: 0 +# 1: 0 +# 2: 0 +# 00 +# 0: 0 +# 1: 0 +# 2: 0 +# 0000 +# 0: 0 +# 1: 0 +# 2: 0 + +# Check the use of names for failure + +# Check opening parens in comment when seeking forward reference. + +#/(?P(?P=abn)xxx|)+/ +# xxx +# 0: +# 1: + +#Posses +/^(a)?(\w)/ + aaaaX + 0: aa + 1: a + 2: a + YZ + 0: Y + 1: + 2: Y + +#Posses +/^(?:a)?(\w)/ + aaaaX + 0: aa + 1: a + YZ + 0: Y + 1: Y + +/\A.*?(a|bc)/ + ba + 0: ba + 1: a + +/\A.*?(?:a|bc|d)/ + ba + 0: ba + +# -------------------------- + +/(another)?(\1?)test/ + hello world test + 0: test + 1: + 2: + +/(another)?(\1+)test/ +\= Expect no match + hello world test +No match + +/((?:a?)*)*c/ + aac + 0: aac + 1: + +/((?>a?)*)*c/ + aac + 0: aac + 1: + +/(?>.*?a)(?<=ba)/ + aba + 0: ba + +/(?:.*?a)(?<=ba)/ + aba + 0: aba + +/(?>.*?a)b/s + aab + 0: ab + +/(?>.*?a)b/ + aab + 0: ab + +/(?>^a)b/s +\= Expect no match + aab +No match + +/(?>.*?)(?<=(abcd)|(wxyz))/ + alphabetabcd + 0: + 1: abcd + endingwxyz + 0: + 1: + 2: wxyz + +/(?>.*)(?<=(abcd)|(wxyz))/ + alphabetabcd + 0: alphabetabcd + 1: abcd + endingwxyz + 0: endingwxyz + 1: + 2: wxyz + +"(?>.*)foo" +\= Expect no match + abcdfooxyz +No match + +"(?>.*?)foo" + abcdfooxyz + 0: foo + +# Tests that try to figure out how Perl works. My hypothesis is that the first +# verb that is backtracked onto is the one that acts. This seems to be the case +# almost all the time, but there is one exception that is perhaps a bug. + +/a(?=bc).|abd/ + abd + 0: abd + abc + 0: ab + +/a(?>bc)d|abd/ + abceabd + 0: abd + +# These tests were formerly in test 2, but changes in PCRE and Perl have +# made them compatible. + +/^(a)?(?(1)a|b)+$/ +\= Expect no match + a +No match + +# ---- + +/^\d*\w{4}/ + 1234 + 0: 1234 +\= Expect no match + 123 +No match + +/^[^b]*\w{4}/ + aaaa + 0: aaaa +\= Expect no match + aaa +No match + +/^[^b]*\w{4}/i + aaaa + 0: aaaa +\= Expect no match + aaa +No match + +/^a*\w{4}/ + aaaa + 0: aaaa +\= Expect no match + aaa +No match + +/^a*\w{4}/i + aaaa + 0: aaaa +\= Expect no match + aaa +No match + +/(?:(?foo)|(?bar))\k/dupnames + foofoo + 0: foofoo + 1: foo + barbar + 0: barbar + 1: bar + +# A notable difference between PCRE and .NET. According to +# the PCRE docs: +# If you make a subroutine call to a non-unique named +# subpattern, the one that corresponds to the first +# occurrence of the name is used. In the absence of +# duplicate numbers (see the previous section) this is +# the one with the lowest number. +# .NET takes the most recently captured number according to MSDN: +# A backreference refers to the most recent definition of +# a group (the definition most immediately to the left, +# when matching left to right). When a group makes multiple +# captures, a backreference refers to the most recent capture. + +#/(?A)(?:(?foo)|(?bar))\k/dupnames +# AfooA +# 0: AfooA +# 1: A +# 2: foo +# AbarA +# 0: AbarA +# 1: A +# 2: +# 3: bar +#\= Expect no match +# Afoofoo +#No match +# Abarbar +#No match + +/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ + 1 IN SOA non-sp1 non-sp2( + 0: 1 IN SOA non-sp1 non-sp2( + 1: 1 + 2: non-sp1 + 3: non-sp2 + +# TODO: .NET's group number ordering here in the second example is a bit odd +/^ (?:(?A)|(?'B'B)(?A)) (?(A)x) (?(B)y)$/x,dupnames + Ax + 0: Ax + 1: A + BAxy + 0: BAxy + 1: A + 2: B + +/ ^ a + b $ /x + aaaab + 0: aaaab + +/ ^ a + #comment + b $ /x + aaaab + 0: aaaab + +/ ^ a + #comment + #comment + b $ /x + aaaab + 0: aaaab + +/ ^ (?> a + ) b $ /x + aaaab + 0: aaaab + +/ ^ ( a + ) + \w $ /x + aaaab + 0: aaaab + 1: aaaa + +/(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc/ +\= Expect no match + acb +No match + +#Posses +#/\A(?:[^\"]+|\"(?:[^\"]*|\"\")*\")+/ +# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED +# 0: NON QUOTED "QUOT""ED" AFTER + +#Posses +#/\A(?:[^\"]+|\"(?:[^\"]+|\"\")*\")+/ +# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED +# 0: NON QUOTED "QUOT""ED" AFTER + +#Posses +#/\A(?:[^\"]+|\"(?:[^\"]+|\"\")+\")+/ +# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED +# 0: NON QUOTED "QUOT""ED" AFTER + +#Posses +#/\A([^\"1]+|[\"2]([^\"3]*|[\"4][\"5])*[\"6])+/ +# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED +# 0: NON QUOTED "QUOT""ED" AFTER +# 1: AFTER +# 2: + +/^\w+(?>\s*)(?<=\w)/ + test test + 0: tes + +#/(?Pa)?(?Pb)?(?()c|d)*l/ +# acl +# 0: acl +# 1: a +# bdl +# 0: bdl +# 1: +# 2: b +# adl +# 0: dl +# bcl +# 0: l + +/\sabc/ + \x0babc + 0: \x0babc + +#/[\Qa]\E]+/ +# aa]] +# 0: aa]] + +#/[\Q]a\E]+/ +# aa]] +# 0: aa]] + +/A((((((((a))))))))\8B/ + AaaB + 0: AaaB + 1: a + 2: a + 3: a + 4: a + 5: a + 6: a + 7: a + 8: a + +/A(((((((((a)))))))))\9B/ + AaaB + 0: AaaB + 1: a + 2: a + 3: a + 4: a + 5: a + 6: a + 7: a + 8: a + 9: a + +/(|ab)*?d/ + abd + 0: abd + 1: ab + xyd + 0: d + +/(\2|a)(\1)/ + aaa + 0: aa + 1: a + 2: a + +/(\2)(\1)/ + +"Z*(|d*){216}" + +/((((((((((((x))))))))))))\12/ + xx + 0: xx + 1: x + 2: x + 3: x + 4: x + 5: x + 6: x + 7: x + 8: x + 9: x +10: x +11: x +12: x + +#"(?|(\k'Pm')|(?'Pm'))" +# abcd +# 0: +# 1: + +#/(?|(aaa)|(b))\g{1}/ +# aaaaaa +# 0: aaaaaa +# 1: aaa +# bb +# 0: bb +# 1: b + +#/(?|(aaa)|(b))(?1)/ +# aaaaaa +# 0: aaaaaa +# 1: aaa +# baaa +# 0: baaa +# 1: b +#\= Expect no match +# bb +#No match + +#/(?|(aaa)|(b))/ +# xaaa +# 0: aaa +# 1: aaa +# xbc +# 0: b +# 1: b + +#/(?|(?'a'aaa)|(?'a'b))\k'a'/ +# aaaaaa +# 0: aaaaaa +# 1: aaa +# bb +# 0: bb +# 1: b + +#/(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/dupnames +# aaaccccaaa +# 0: aaaccccaaa +# 1: aaa +# 2: cccc +# bccccb +# 0: bccccb +# 1: b +# 2: cccc + +# End of testinput1 diff --git a/vendor/github.com/eliukblau/pixterm/pkg/ansimage/ansimage.go b/vendor/github.com/eliukblau/pixterm/pkg/ansimage/ansimage.go new file mode 100644 index 000000000..7ca6355b3 --- /dev/null +++ b/vendor/github.com/eliukblau/pixterm/pkg/ansimage/ansimage.go @@ -0,0 +1,601 @@ +// ___ _____ ____ +// / _ \/ _/ |/_/ /____ ______ _ +// / ___// /_> =2") + + // ErrOutOfBounds occurs when ANSI-pixel coordinates are out of ANSImage bounds. + ErrOutOfBounds = errors.New("ANSImage: out of bounds") + + // errUnknownScaleMode occurs when scale mode is invalid. + errUnknownScaleMode = errors.New("ANSImage: unknown scale mode") + + // errUnknownDitheringMode occurs when dithering mode is invalid. + errUnknownDitheringMode = errors.New("ANSImage: unknown dithering mode") +) + +// ScaleMode type is used for image scale mode constants. +type ScaleMode uint8 + +// DitheringMode type is used for image scale dithering mode constants. +type DitheringMode uint8 + +// ANSIpixel represents a pixel of an ANSImage. +type ANSIpixel struct { + Brightness uint8 + R, G, B uint8 + upper bool + source *ANSImage +} + +// ANSImage represents an image encoded in ANSI escape codes. +type ANSImage struct { + h, w int + maxprocs int + bgR uint8 + bgG uint8 + bgB uint8 + dithering DitheringMode + pixmap [][]*ANSIpixel +} + +// Render returns the ANSI-compatible string form of ANSI-pixel. +func (ap *ANSIpixel) Render() string { + return ap.RenderExt(false, false) +} + +// RenderExt returns the ANSI-compatible string form of ANSI-pixel. +// Can specify if it renders in form of Go code 'fmt.Printf()'. +// Can specify if background color will be disabled in dithering mode. +func (ap *ANSIpixel) RenderExt(renderGoCode, disableBgColor bool) string { + backslash033 := "\033" + if renderGoCode { + backslash033 = "\\033" + } + + // WITHOUT DITHERING + if ap.source.dithering == NoDithering { + var renderStr string + if ap.upper { + renderStr = fmt.Sprintf( + "%s[48;2;%d;%d;%dm", + backslash033, + ap.R, ap.G, ap.B, + ) + } else { + renderStr = fmt.Sprintf( + "%s[38;2;%d;%d;%dm%s", + backslash033, + ap.R, ap.G, ap.B, + lowerHalfBlock, + ) + } + return renderStr + } + + // WITH DITHERING + block := " " + if ap.source.dithering == DitheringWithBlocks { + switch bri := ap.Brightness; { + case bri > 204: + block = fullBlock + case bri > 152: + block = darkShadeBlock + case bri > 100: + block = mediumShadeBlock + case bri > 48: + block = lightShadeBlock + } + } else if ap.source.dithering == DitheringWithChars { + switch bri := ap.Brightness; { + case bri > 230: + block = "#" + case bri > 207: + block = "&" + case bri > 184: + block = "$" + case bri > 161: + block = "X" + case bri > 138: + block = "x" + case bri > 115: + block = "=" + case bri > 92: + block = "+" + case bri > 69: + block = ";" + case bri > 46: + block = ":" + case bri > 23: + block = "." + } + } else { + panic(errUnknownDitheringMode) + } + + bgColorStr := fmt.Sprintf( + "%s[48;2;%d;%d;%dm", + backslash033, + ap.source.bgR, ap.source.bgG, ap.source.bgB, + ) + if disableBgColor { + bgColorStr = "" + } + return fmt.Sprintf( + "%s%s[38;2;%d;%d;%dm%s", + bgColorStr, + backslash033, + ap.R, ap.G, ap.B, + block, + ) +} + +// Height gets total rows of ANSImage. +func (ai *ANSImage) Height() int { + return ai.h +} + +// Width gets total columns of ANSImage. +func (ai *ANSImage) Width() int { + return ai.w +} + +// DitheringMode gets the dithering mode of ANSImage. +func (ai *ANSImage) DitheringMode() DitheringMode { + return ai.dithering +} + +// SetMaxProcs sets the maximum number of parallel goroutines to render the ANSImage +// (user should manually sets `runtime.GOMAXPROCS(max)` before to this change takes effect). +func (ai *ANSImage) SetMaxProcs(max int) { + ai.maxprocs = max +} + +// GetMaxProcs gets the maximum number of parallels goroutines to render the ANSImage. +func (ai *ANSImage) GetMaxProcs() int { + return ai.maxprocs +} + +// SetAt sets ANSI-pixel color (RBG) and brightness in coordinates (y,x). +func (ai *ANSImage) SetAt(y, x int, r, g, b, brightness uint8) error { + if y >= 0 && y < ai.h && x >= 0 && x < ai.w { + ai.pixmap[y][x].R = r + ai.pixmap[y][x].G = g + ai.pixmap[y][x].B = b + ai.pixmap[y][x].Brightness = brightness + ai.pixmap[y][x].upper = ((ai.dithering == NoDithering) && (y%2 == 0)) + return nil + } + return ErrOutOfBounds +} + +// GetAt gets ANSI-pixel in coordinates (y,x). +func (ai *ANSImage) GetAt(y, x int) (*ANSIpixel, error) { + if y >= 0 && y < ai.h && x >= 0 && x < ai.w { + return &ANSIpixel{ + R: ai.pixmap[y][x].R, + G: ai.pixmap[y][x].G, + B: ai.pixmap[y][x].B, + Brightness: ai.pixmap[y][x].Brightness, + upper: ai.pixmap[y][x].upper, + source: ai.pixmap[y][x].source, + }, + nil + } + return nil, ErrOutOfBounds +} + +// Render returns the ANSI-compatible string form of ANSImage. +func (ai *ANSImage) Render() string { + return ai.RenderExt(false, false) +} + +// RenderExt returns the ANSI-compatible string form of ANSImage. +// Can specify if it renders in form of Go code 'fmt.Printf()'. +// Can specify if background color will be disabled in dithering mode. +// (Nice info for ANSI True Colour - https://gist.github.com/XVilka/8346728) +func (ai *ANSImage) RenderExt(renderGoCode, disableBgColor bool) string { + type renderData struct { + row int + render string + } + + backslashN := "\n" + backslash033 := "\033" + if renderGoCode { + backslashN = "\\n" + backslash033 = "\\033" + } + + // WITHOUT DITHERING + if ai.dithering == NoDithering { + rows := make([]string, ai.h/2) + for y := 0; y < ai.h; y += ai.maxprocs { + ch := make(chan renderData, ai.maxprocs) + for n, r := 0, y+1; (n <= ai.maxprocs) && (2*r+1 < ai.h); n, r = n+1, y+n+1 { + go func(r, y int) { + var str string + for x := 0; x < ai.w; x++ { + str += ai.pixmap[y][x].RenderExt(renderGoCode, disableBgColor) // upper pixel + str += ai.pixmap[y+1][x].RenderExt(renderGoCode, disableBgColor) // lower pixel + } + str += fmt.Sprintf("%s[0m%s", backslash033, backslashN) // reset ansi style + ch <- renderData{row: r, render: str} + }(r, 2*r) + // DEBUG: + // fmt.Printf("y:%d | n:%d | r:%d | 2*r:%d\n", y, n, r, 2*r) + // time.Sleep(time.Millisecond * 100) + } + for n, r := 0, y+1; (n <= ai.maxprocs) && (2*r+1 < ai.h); n, r = n+1, y+n+1 { + data := <-ch + if renderGoCode { + data.render = fmt.Sprintf(`fmt.Print("%s")%s`, data.render, "\n") + } + rows[data.row] = data.render + // DEBUG: + // fmt.Printf("data.row:%d\n", data.row) + // time.Sleep(time.Millisecond * 100) + } + } + return strings.Join(rows, "") + } + + // WITH DITHERING + rows := make([]string, ai.h) + for y := 0; y < ai.h; y += ai.maxprocs { + ch := make(chan renderData, ai.maxprocs) + for n, r := 0, y; (n <= ai.maxprocs) && (r+1 < ai.h); n, r = n+1, y+n+1 { + go func(y int) { + var str string + for x := 0; x < ai.w; x++ { + str += ai.pixmap[y][x].RenderExt(renderGoCode, disableBgColor) + } + str += fmt.Sprintf("%s[0m%s", backslash033, backslashN) // reset ansi style + ch <- renderData{row: y, render: str} + }(r) + } + for n, r := 0, y; (n <= ai.maxprocs) && (r+1 < ai.h); n, r = n+1, y+n+1 { + data := <-ch + if renderGoCode { + data.render = fmt.Sprintf(`fmt.Print("%s")%s`, data.render, "\n") + } + rows[data.row] = data.render + } + } + return strings.Join(rows, "") +} + +// Draw writes the ANSImage to standard output (terminal). +func (ai *ANSImage) Draw() { + ai.DrawExt(false, false) +} + +// DrawExt writes the ANSImage to standard output (terminal). +// Can specify if it prints in form of Go code 'fmt.Printf()'. +// Can specify if background color will be disabled in dithering mode. +func (ai *ANSImage) DrawExt(renderGoCode, disableBgColor bool) { + fmt.Print(ai.RenderExt(renderGoCode, disableBgColor)) +} + +// New creates a new empty ANSImage ready to draw on it. +func New(h, w int, bg color.Color, dm DitheringMode) (*ANSImage, error) { + if (dm == NoDithering) && (h%2 != 0) { + return nil, ErrHeightNonMoT + } + + if h < 2 || w < 2 { + return nil, ErrInvalidBoundsMoT + } + + r, g, b, _ := bg.RGBA() + ansimage := &ANSImage{ + h: h, w: w, + maxprocs: 1, + bgR: uint8(r), + bgG: uint8(g), + bgB: uint8(b), + dithering: dm, + pixmap: nil, + } + + ansimage.pixmap = func() [][]*ANSIpixel { + v := make([][]*ANSIpixel, h) + for y := 0; y < h; y++ { + v[y] = make([]*ANSIpixel, w) + for x := 0; x < w; x++ { + v[y][x] = &ANSIpixel{ + R: 0, + G: 0, + B: 0, + Brightness: 0, + source: ansimage, + upper: ((dm == NoDithering) && (y%2 == 0)), + } + } + } + return v + }() + + return ansimage, nil +} + +// NewFromImage creates a new ANSImage from an image.Image. +// Background color is used to fill when image has transparency or dithering mode is enabled. +// Dithering mode is used to specify the way that ANSImage render ANSI-pixels (char/block elements). +func NewFromImage(image image.Image, bg color.Color, dm DitheringMode) (*ANSImage, error) { + return createANSImage(image, bg, dm) +} + +// NewScaledFromImage creates a new scaled ANSImage from an image.Image. +// Background color is used to fill when image has transparency or dithering mode is enabled. +// Dithering mode is used to specify the way that ANSImage render ANSI-pixels (char/block elements). +func NewScaledFromImage(image image.Image, y, x int, bg color.Color, sm ScaleMode, dm DitheringMode) (*ANSImage, error) { + switch sm { + case ScaleModeResize: + image = imaging.Resize(image, x, y, imaging.Lanczos) + case ScaleModeFill: + image = imaging.Fill(image, x, y, imaging.Center, imaging.Lanczos) + case ScaleModeFit: + image = imaging.Fit(image, x, y, imaging.Lanczos) + default: + panic(errUnknownScaleMode) + } + + return createANSImage(image, bg, dm) +} + +// NewFromReader creates a new ANSImage from an io.Reader. +// Background color is used to fill when image has transparency or dithering mode is enabled. +// Dithering mode is used to specify the way that ANSImage render ANSI-pixels (char/block elements). +func NewFromReader(reader io.Reader, bg color.Color, dm DitheringMode) (*ANSImage, error) { + image, _, err := image.Decode(reader) + if err != nil { + return nil, err + } + + return createANSImage(image, bg, dm) +} + +// NewScaledFromReader creates a new scaled ANSImage from an io.Reader. +// Background color is used to fill when image has transparency or dithering mode is enabled. +// Dithering mode is used to specify the way that ANSImage render ANSI-pixels (char/block elements). +func NewScaledFromReader(reader io.Reader, y, x int, bg color.Color, sm ScaleMode, dm DitheringMode) (*ANSImage, error) { + image, _, err := image.Decode(reader) + if err != nil { + return nil, err + } + + switch sm { + case ScaleModeResize: + image = imaging.Resize(image, x, y, imaging.Lanczos) + case ScaleModeFill: + image = imaging.Fill(image, x, y, imaging.Center, imaging.Lanczos) + case ScaleModeFit: + image = imaging.Fit(image, x, y, imaging.Lanczos) + default: + panic(errUnknownScaleMode) + } + + return createANSImage(image, bg, dm) +} + +// NewFromFile creates a new ANSImage from a file. +// Background color is used to fill when image has transparency or dithering mode is enabled. +// Dithering mode is used to specify the way that ANSImage render ANSI-pixels (char/block elements). +func NewFromFile(name string, bg color.Color, dm DitheringMode) (*ANSImage, error) { + reader, err := os.Open(name) + if err != nil { + return nil, err + } + defer reader.Close() + return NewFromReader(reader, bg, dm) +} + +// NewScaledFromFile creates a new scaled ANSImage from a file. +// Background color is used to fill when image has transparency or dithering mode is enabled. +// Dithering mode is used to specify the way that ANSImage render ANSI-pixels (char/block elements). +func NewScaledFromFile(name string, y, x int, bg color.Color, sm ScaleMode, dm DitheringMode) (*ANSImage, error) { + reader, err := os.Open(name) + if err != nil { + return nil, err + } + defer reader.Close() + return NewScaledFromReader(reader, y, x, bg, sm, dm) +} + +// NewFromURL creates a new ANSImage from an image URL. +// Background color is used to fill when image has transparency or dithering mode is enabled. +// Dithering mode is used to specify the way that ANSImage render ANSI-pixels (char/block elements). +func NewFromURL(url string, bg color.Color, dm DitheringMode) (*ANSImage, error) { + res, err := http.Get(url) + if err != nil { + return nil, err + } + if res.StatusCode != http.StatusOK { + return nil, ErrImageDownloadFailed + } + defer res.Body.Close() + return NewFromReader(res.Body, bg, dm) +} + +// NewScaledFromURL creates a new scaled ANSImage from an image URL. +// Background color is used to fill when image has transparency or dithering mode is enabled. +// Dithering mode is used to specify the way that ANSImage render ANSI-pixels (char/block elements). +func NewScaledFromURL(url string, y, x int, bg color.Color, sm ScaleMode, dm DitheringMode) (*ANSImage, error) { + res, err := http.Get(url) + if err != nil { + return nil, err + } + if res.StatusCode != http.StatusOK { + return nil, ErrImageDownloadFailed + } + defer res.Body.Close() + return NewScaledFromReader(res.Body, y, x, bg, sm, dm) +} + +// ClearTerminal clears current terminal buffer using ANSI escape code. +// (Nice info for ANSI escape codes - http://unix.stackexchange.com/questions/124762/how-does-clear-command-work) +func ClearTerminal() { + fmt.Print("\033[H\033[2J") +} + +// createANSImage loads data from an image and returns an ANSImage. +// Background color is used to fill when image has transparency or dithering mode is enabled. +// Dithering mode is used to specify the way that ANSImage render ANSI-pixels (char/block elements). +func createANSImage(img image.Image, bg color.Color, dm DitheringMode) (*ANSImage, error) { + var rgbaOut *image.RGBA + bounds := img.Bounds() + + // do compositing only if background color has no transparency (thank you @disq for the idea!) + // (info - http://stackoverflow.com/questions/36595687/transparent-pixel-color-go-lang-image) + if _, _, _, a := bg.RGBA(); a >= 0xffff { + rgbaOut = image.NewRGBA(bounds) + draw.Draw(rgbaOut, bounds, image.NewUniform(bg), image.ZP, draw.Src) + draw.Draw(rgbaOut, bounds, img, image.ZP, draw.Over) + } else { + if v, ok := img.(*image.RGBA); ok { + rgbaOut = v + } else { + rgbaOut = image.NewRGBA(bounds) + draw.Draw(rgbaOut, bounds, img, image.ZP, draw.Src) + } + } + + yMin, xMin := bounds.Min.Y, bounds.Min.X + yMax, xMax := bounds.Max.Y, bounds.Max.X + + if dm == NoDithering { + // always sets an even number of ANSIPixel rows... + yMax = yMax - yMax%2 // one for upper pixel and another for lower pixel --> without dithering + } else { + yMax = yMax / BlockSizeY // always sets 1 ANSIPixel block... + xMax = xMax / BlockSizeX // per 8x4 real pixels --> with dithering + } + + ansimage, err := New(yMax, xMax, bg, dm) + if err != nil { + return nil, err + } + + if dm == NoDithering { + for y := yMin; y < yMax; y++ { + for x := xMin; x < xMax; x++ { + v := rgbaOut.RGBAAt(x, y) + if err := ansimage.SetAt(y, x, v.R, v.G, v.B, 0); err != nil { + return nil, err + } + } + } + } else { + pixelCount := BlockSizeY * BlockSizeX + + for y := yMin; y < yMax; y++ { + for x := xMin; x < xMax; x++ { + + var sumR, sumG, sumB, sumBri float64 + for dy := 0; dy < BlockSizeY; dy++ { + py := BlockSizeY*y + dy + + for dx := 0; dx < BlockSizeX; dx++ { + px := BlockSizeX*x + dx + + pixel := rgbaOut.At(px, py) + color, _ := colorful.MakeColor(pixel) + _, _, v := color.Hsv() + sumR += color.R + sumG += color.G + sumB += color.B + sumBri += v + } + } + + r := uint8(sumR/float64(pixelCount)*255.0 + 0.5) + g := uint8(sumG/float64(pixelCount)*255.0 + 0.5) + b := uint8(sumB/float64(pixelCount)*255.0 + 0.5) + brightness := uint8(sumBri/float64(pixelCount)*255.0 + 0.5) + + if err := ansimage.SetAt(y, x, r, g, b, brightness); err != nil { + return nil, err + } + } + } + } + + return ansimage, nil +} diff --git a/vendor/github.com/gomarkdown/markdown/.gitignore b/vendor/github.com/gomarkdown/markdown/.gitignore new file mode 100644 index 000000000..8f15b677f --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/.gitignore @@ -0,0 +1,13 @@ +*.out +*.swp +*.8 +*.6 +_obj +_test* +markdown +tags +fuzz-workdir/ +markdown-fuzz.zip +coverage.txt +testdata/*_got.md +testdata/*_ast.txt diff --git a/vendor/github.com/gomarkdown/markdown/.gitpod b/vendor/github.com/gomarkdown/markdown/.gitpod new file mode 100644 index 000000000..ad5feff66 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/.gitpod @@ -0,0 +1,7 @@ +checkoutLocation: "src/github.com/gomarkdown/markdown" +workspaceLocation: "." +tasks: + - command: > + cd /workspace/src/github.com/gomarkdown/markdown && + go get -v ./... && + go test -c diff --git a/vendor/github.com/gomarkdown/markdown/.travis.yml b/vendor/github.com/gomarkdown/markdown/.travis.yml new file mode 100644 index 000000000..4ec5d7b0c --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/.travis.yml @@ -0,0 +1,17 @@ +dist: bionic +language: go + +go: + - "1.12.x" + +install: + - go build -v ./... + +script: + - go test -v ./... + - go test -run=^$ -bench=BenchmarkReference -benchmem + - ./s/test_with_codecoverage.sh + - ./s/ci_fuzzit.sh + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/gomarkdown/markdown/LICENSE.txt b/vendor/github.com/gomarkdown/markdown/LICENSE.txt new file mode 100644 index 000000000..688046102 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/LICENSE.txt @@ -0,0 +1,31 @@ +Markdown is distributed under the Simplified BSD License: + +Copyright © 2011 Russ Ross +Copyright © 2018 Krzysztof Kowalczyk +Copyright © 2018 Authors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided with + the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/gomarkdown/markdown/README.md b/vendor/github.com/gomarkdown/markdown/README.md new file mode 100644 index 000000000..54eabe92e --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/README.md @@ -0,0 +1,325 @@ +# Markdown Parser and HTML Renderer for Go + +[![GoDoc](https://godoc.org/github.com/gomarkdown/markdown?status.svg)](https://godoc.org/github.com/gomarkdown/markdown) [![codecov](https://codecov.io/gh/gomarkdown/markdown/branch/master/graph/badge.svg)](https://codecov.io/gh/gomarkdown/markdown) + +Package `github.com/gomarkdown/markdown` is a very fast Go library for parsing [Markdown](https://daringfireball.net/projects/markdown/) documents and rendering them to HTML. + +It's fast and supports common extensions. + +## Installation + + go get -u github.com/gomarkdown/markdown + +API Docs: + +- https://godoc.org/github.com/gomarkdown/markdown : top level package +- https://godoc.org/github.com/gomarkdown/markdown/ast : defines abstract syntax tree of parsed markdown document +- https://godoc.org/github.com/gomarkdown/markdown/parser : parser +- https://godoc.org/github.com/gomarkdown/markdown/html : html renderer + +## Usage + +To convert markdown text to HTML using reasonable defaults: + +```go +md := []byte("## markdown document") +output := markdown.ToHTML(md, nil, nil) +``` + +## Customizing markdown parser + +Markdown format is loosely specified and there are multiple extensions invented after original specification was created. + +The parser supports several [extensions](https://godoc.org/github.com/gomarkdown/markdown/parser#Extensions). + +Default parser uses most common `parser.CommonExtensions` but you can easily use parser with custom extension: + +```go +import ( + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/parser" +) + +extensions := parser.CommonExtensions | parser.AutoHeadingIDs +parser := parser.NewWithExtensions(extensions) + +md := []byte("markdown text") +html := markdown.ToHTML(md, parser, nil) +``` + +## Customizing HTML renderer + +Similarly, HTML renderer can be configured with different [options](https://godoc.org/github.com/gomarkdown/markdown/html#RendererOptions) + +Here's how to use a custom renderer: + +```go +import ( + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/html" +) + +htmlFlags := html.CommonFlags | html.HrefTargetBlank +opts := html.RendererOptions{Flags: htmlFlags} +renderer := html.NewRenderer(opts) + +md := []byte("markdown text") +html := markdown.ToHTML(md, nil, renderer) +``` + +HTML renderer also supports reusing most of the logic and overriding rendering of only specifc nodes. + +You can provide [RenderNodeFunc](https://godoc.org/github.com/gomarkdown/markdown/html#RenderNodeFunc) in [RendererOptions](https://godoc.org/github.com/gomarkdown/markdown/html#RendererOptions). + +The function is called for each node in AST, you can implement custom rendering logic and tell HTML renderer to skip rendering this node. + +Here's the simplest example that drops all code blocks from the output: + +````go +import ( + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/ast" + "github.com/gomarkdown/markdown/html" +) + +// return (ast.GoToNext, true) to tell html renderer to skip rendering this node +// (because you've rendered it) +func renderHookDropCodeBlock(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool) { + // skip all nodes that are not CodeBlock nodes + if _, ok := node.(*ast.CodeBlock); !ok { + return ast.GoToNext, false + } + // custom rendering logic for ast.CodeBlock. By doing nothing it won't be + // present in the output + return ast.GoToNext, true +} + +opts := html.RendererOptions{ + Flags: html.CommonFlags, + RenderNodeHook: renderHookDropCodeBlock, +} +renderer := html.NewRenderer(opts) +md := "test\n```\nthis code block will be dropped from output\n```\ntext" +html := markdown.ToHTML([]byte(s), nil, renderer) +```` + +## Sanitize untrusted content + +We don't protect against malicious content. When dealing with user-provided +markdown, run renderer HTML through HTML sanitizer such as [Bluemonday](https://github.com/microcosm-cc/bluemonday). + +Here's an example of simple usage with Bluemonday: + +```go +import ( + "github.com/microcosm-cc/bluemonday" + "github.com/gomarkdown/markdown" +) + +// ... +maybeUnsafeHTML := markdown.ToHTML(md, nil, nil) +html := bluemonday.UGCPolicy().SanitizeBytes(maybeUnsafeHTML) +``` + +## mdtohtml command-line tool + +https://github.com/gomarkdown/mdtohtml is a command-line markdown to html +converter built using this library. + +You can also use it as an example of how to use the library. + +You can install it with: + + go get -u github.com/gomarkdown/mdtohtml + +To run: `mdtohtml input-file [output-file]` + +## Features + +- **Compatibility**. The Markdown v1.0.3 test suite passes with + the `--tidy` option. Without `--tidy`, the differences are + mostly in whitespace and entity escaping, where this package is + more consistent and cleaner. + +- **Common extensions**, including table support, fenced code + blocks, autolinks, strikethroughs, non-strict emphasis, etc. + +- **Safety**. Markdown is paranoid when parsing, making it safe + to feed untrusted user input without fear of bad things + happening. The test suite stress tests this and there are no + known inputs that make it crash. If you find one, please let me + know and send me the input that does it. + + NOTE: "safety" in this context means _runtime safety only_. In order to + protect yourself against JavaScript injection in untrusted content, see + [this example](https://github.com/gomarkdown/markdown#sanitize-untrusted-content). + +- **Fast**. It is fast enough to render on-demand in + most web applications without having to cache the output. + +- **Thread safety**. You can run multiple parsers in different + goroutines without ill effect. There is no dependence on global + shared state. + +- **Minimal dependencies**. Only depends on standard library packages in Go. + +- **Standards compliant**. Output successfully validates using the + W3C validation tool for HTML 4.01 and XHTML 1.0 Transitional. + +## Extensions + +In addition to the standard markdown syntax, this package +implements the following extensions: + +- **Intra-word emphasis supression**. The `_` character is + commonly used inside words when discussing code, so having + markdown interpret it as an emphasis command is usually the + wrong thing. We let you treat all emphasis markers as + normal characters when they occur inside a word. + +- **Tables**. Tables can be created by drawing them in the input + using a simple syntax: + + ``` + Name | Age + --------|------ + Bob | 27 + Alice | 23 + ``` + + Table footers are supported as well and can be added with equal signs (`=`): + + ``` + Name | Age + --------|------ + Bob | 27 + Alice | 23 + ========|====== + Total | 50 + ``` + +- **Fenced code blocks**. In addition to the normal 4-space + indentation to mark code blocks, you can explicitly mark them + and supply a language (to make syntax highlighting simple). Just + mark it like this: + + ```go + func getTrue() bool { + return true + } + ``` + + You can use 3 or more backticks to mark the beginning of the + block, and the same number to mark the end of the block. + +- **Definition lists**. A simple definition list is made of a single-line + term followed by a colon and the definition for that term. + + Cat + : Fluffy animal everyone likes + + Internet + : Vector of transmission for pictures of cats + + Terms must be separated from the previous definition by a blank line. + +- **Footnotes**. A marker in the text that will become a superscript number; + a footnote definition that will be placed in a list of footnotes at the + end of the document. A footnote looks like this: + + This is a footnote.[^1] + + [^1]: the footnote text. + +- **Autolinking**. We can find URLs that have not been + explicitly marked as links and turn them into links. + +- **Strikethrough**. Use two tildes (`~~`) to mark text that + should be crossed out. + +- **Hard line breaks**. With this extension enabled newlines in the input + translate into line breaks in the output. This extension is off by default. + +- **Non blocking space**. With this extension enabled spaces preceeded by an backslash n the input + translate non-blocking spaces in the output. This extension is off by default. + +- **Smart quotes**. Smartypants-style punctuation substitution is + supported, turning normal double- and single-quote marks into + curly quotes, etc. + +- **LaTeX-style dash parsing** is an additional option, where `--` + is translated into `–`, and `---` is translated into + `—`. This differs from most smartypants processors, which + turn a single hyphen into an ndash and a double hyphen into an + mdash. + +- **Smart fractions**, where anything that looks like a fraction + is translated into suitable HTML (instead of just a few special + cases like most smartypant processors). For example, `4/5` + becomes `45`, which renders as + 45. + +- **MathJaX Support** is an additional feature which is supported by + many markdown editor. It translate inline math equation quoted by `$` + and display math block quoted by `$$` into MathJax compatible format. + hyphen `_` won't break LaTeX render within a math element any more. + + ``` + $$ + \left[ \begin{array}{a} a^l_1 \\ ⋮ \\ a^l_{d_l} \end{array}\right] + = \sigma( + \left[ \begin{matrix} + w^l_{1,1} & ⋯ & w^l_{1,d_{l-1}} \\ + ⋮ & ⋱ & ⋮ \\ + w^l_{d_l,1} & ⋯ & w^l_{d_l,d_{l-1}} \\ + \end{matrix}\right] · + \left[ \begin{array}{x} a^{l-1}_1 \\ ⋮ \\ ⋮ \\ a^{l-1}_{d_{l-1}} \end{array}\right] + + \left[ \begin{array}{b} b^l_1 \\ ⋮ \\ b^l_{d_l} \end{array}\right]) + $$ + ``` + +- **Ordered list start number**. With this extension enabled an ordered list will start with the + the number that was used to start it. + +- **Super and subscript**. With this extension enabled sequences between ^ will indicate + superscript and ~ will become a subscript. For example: H~2~O is a liquid, 2^10^ is 1024. + +- **Block level attributes**, allow setting attributes (ID, classes and key/value pairs) on block + level elements. The attribute must be enclosed with braces and be put on a line before the + element. + + ``` + {#id3 .myclass fontsize="tiny"} + # Header 1 + ``` + + Will convert into `

Header 1

`. + +- **Mmark support**, see for all new syntax elements this adds. + +## Todo + +- port https://github.com/russross/blackfriday/issues/348 +- port [LaTeX output](https://github.com/Ambrevar/Blackfriday-LaTeX): + renders output as LaTeX. +- port https://github.com/shurcooL/github_flavored_markdown to markdown +- port [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt, + but for markdown. +- More unit testing +- Improve unicode support. It does not understand all unicode + rules (about what constitutes a letter, a punctuation symbol, + etc.), so it may fail to detect word boundaries correctly in + some instances. It is safe on all utf-8 input. + +## History + +markdown is a fork of v2 of https://github.com/russross/blackfriday that is: + +- actively maintained (sadly in Feb 2018 blackfriday was inactive for 5 months with many bugs and pull requests accumulated) +- refactored API (split into ast/parser/html sub-packages) + +Blackfriday itself was based on C implementation [sundown](https://github.com/vmg/sundown) which in turn was based on [libsoldout](http://fossil.instinctive.eu/libsoldout/home). + +## License + +[Simplified BSD License](LICENSE.txt) diff --git a/vendor/github.com/gomarkdown/markdown/ast/attribute.go b/vendor/github.com/gomarkdown/markdown/ast/attribute.go new file mode 100644 index 000000000..002c6a2ec --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/ast/attribute.go @@ -0,0 +1,10 @@ +package ast + +// An attribute can be attached to block elements. They are specified as +// {#id .classs key="value"} where quotes for values are mandatory, multiple +// key/value pairs are separated by whitespace. +type Attribute struct { + ID []byte + Classes [][]byte + Attrs map[string][]byte +} diff --git a/vendor/github.com/gomarkdown/markdown/ast/doc.go b/vendor/github.com/gomarkdown/markdown/ast/doc.go new file mode 100644 index 000000000..376dc67cc --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/ast/doc.go @@ -0,0 +1,4 @@ +/* +Package ast defines tree representation of a parsed markdown document. +*/ +package ast diff --git a/vendor/github.com/gomarkdown/markdown/ast/node.go b/vendor/github.com/gomarkdown/markdown/ast/node.go new file mode 100644 index 000000000..e6fcba9a5 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/ast/node.go @@ -0,0 +1,559 @@ +package ast + +// ListType contains bitwise or'ed flags for list and list item objects. +type ListType int + +// These are the possible flag values for the ListItem renderer. +// Multiple flag values may be ORed together. +// These are mostly of interest if you are writing a new output format. +const ( + ListTypeOrdered ListType = 1 << iota + ListTypeDefinition + ListTypeTerm + + ListItemContainsBlock + ListItemBeginningOfList // TODO: figure out if this is of any use now + ListItemEndOfList +) + +// CellAlignFlags holds a type of alignment in a table cell. +type CellAlignFlags int + +// These are the possible flag values for the table cell renderer. +// Only a single one of these values will be used; they are not ORed together. +// These are mostly of interest if you are writing a new output format. +const ( + TableAlignmentLeft CellAlignFlags = 1 << iota + TableAlignmentRight + TableAlignmentCenter = (TableAlignmentLeft | TableAlignmentRight) +) + +func (a CellAlignFlags) String() string { + switch a { + case TableAlignmentLeft: + return "left" + case TableAlignmentRight: + return "right" + case TableAlignmentCenter: + return "center" + default: + return "" + } +} + +// DocumentMatters holds the type of a {front,main,back}matter in the document +type DocumentMatters int + +// These are all possible Document divisions. +const ( + DocumentMatterNone DocumentMatters = iota + DocumentMatterFront + DocumentMatterMain + DocumentMatterBack +) + +// CitationTypes holds the type of a citation, informative, normative or suppressed +type CitationTypes int + +const ( + CitationTypeNone CitationTypes = iota + CitationTypeSuppressed + CitationTypeInformative + CitationTypeNormative +) + +// Node defines an ast node +type Node interface { + AsContainer() *Container + AsLeaf() *Leaf + GetParent() Node + SetParent(newParent Node) + GetChildren() []Node + SetChildren(newChildren []Node) +} + +// Container is a type of node that can contain children +type Container struct { + Parent Node + Children []Node + + Literal []byte // Text contents of the leaf nodes + Content []byte // Markdown content of the block nodes + + *Attribute // Block level attribute +} + +// AsContainer returns itself as *Container +func (c *Container) AsContainer() *Container { + return c +} + +// AsLeaf returns nil +func (c *Container) AsLeaf() *Leaf { + return nil +} + +// GetParent returns parent node +func (c *Container) GetParent() Node { + return c.Parent +} + +// SetParent sets the parent node +func (c *Container) SetParent(newParent Node) { + c.Parent = newParent +} + +// GetChildren returns children nodes +func (c *Container) GetChildren() []Node { + return c.Children +} + +// SetChildren sets children node +func (c *Container) SetChildren(newChildren []Node) { + c.Children = newChildren +} + +// Leaf is a type of node that cannot have children +type Leaf struct { + Parent Node + + Literal []byte // Text contents of the leaf nodes + Content []byte // Markdown content of the block nodes + + *Attribute // Block level attribute +} + +// AsContainer returns nil +func (l *Leaf) AsContainer() *Container { + return nil +} + +// AsLeaf returns itself as *Leaf +func (l *Leaf) AsLeaf() *Leaf { + return l +} + +// GetParent returns parent node +func (l *Leaf) GetParent() Node { + return l.Parent +} + +// SetParent sets the parent nodd +func (l *Leaf) SetParent(newParent Node) { + l.Parent = newParent +} + +// GetChildren returns nil because Leaf cannot have children +func (l *Leaf) GetChildren() []Node { + return nil +} + +// SetChildren will panic becuase Leaf cannot have children +func (l *Leaf) SetChildren(newChildren []Node) { + panic("leaf node cannot have children") +} + +// Document represents markdown document node, a root of ast +type Document struct { + Container +} + +// DocumentMatter represents markdown node that signals a document +// division: frontmatter, mainmatter or backmatter. +type DocumentMatter struct { + Container + + Matter DocumentMatters +} + +// BlockQuote represents markdown block quote node +type BlockQuote struct { + Container +} + +// Aside represents an markdown aside node. +type Aside struct { + Container +} + +// List represents markdown list node +type List struct { + Container + + ListFlags ListType + Tight bool // Skip

s around list item data if true + BulletChar byte // '*', '+' or '-' in bullet lists + Delimiter byte // '.' or ')' after the number in ordered lists + Start int // for ordered lists this indicates the starting number if > 0 + RefLink []byte // If not nil, turns this list item into a footnote item and triggers different rendering + IsFootnotesList bool // This is a list of footnotes +} + +// ListItem represents markdown list item node +type ListItem struct { + Container + + ListFlags ListType + Tight bool // Skip

s around list item data if true + BulletChar byte // '*', '+' or '-' in bullet lists + Delimiter byte // '.' or ')' after the number in ordered lists + RefLink []byte // If not nil, turns this list item into a footnote item and triggers different rendering + IsFootnotesList bool // This is a list of footnotes +} + +// Paragraph represents markdown paragraph node +type Paragraph struct { + Container +} + +// Math represents markdown MathAjax inline node +type Math struct { + Leaf +} + +// MathBlock represents markdown MathAjax block node +type MathBlock struct { + Container +} + +// Heading represents markdown heading node +type Heading struct { + Container + + Level int // This holds the heading level number + HeadingID string // This might hold heading ID, if present + IsTitleblock bool // Specifies whether it's a title block + IsSpecial bool // We are a special heading (starts with .#) +} + +// HorizontalRule represents markdown horizontal rule node +type HorizontalRule struct { + Leaf +} + +// Emph represents markdown emphasis node +type Emph struct { + Container +} + +// Strong represents markdown strong node +type Strong struct { + Container +} + +// Del represents markdown del node +type Del struct { + Container +} + +// Link represents markdown link node +type Link struct { + Container + + Destination []byte // Destination is what goes into a href + Title []byte // Title is the tooltip thing that goes in a title attribute + NoteID int // NoteID contains a serial number of a footnote, zero if it's not a footnote + Footnote Node // If it's a footnote, this is a direct link to the footnote Node. Otherwise nil. + DeferredID []byte // If a deferred link this holds the original ID. +} + +// CrossReference is a reference node. +type CrossReference struct { + Container + + Destination []byte // Destination is where the reference points to +} + +// Citation is a citation node. +type Citation struct { + Leaf + + Destination [][]byte // Destination is where the citation points to. Multiple ones are allowed. + Type []CitationTypes // 1:1 mapping of destination and citation type + Suffix [][]byte // Potential citation suffix, i.e. [@!RFC1035, p. 144] +} + +// Image represents markdown image node +type Image struct { + Container + + Destination []byte // Destination is what goes into a href + Title []byte // Title is the tooltip thing that goes in a title attribute +} + +// Text represents markdown text node +type Text struct { + Leaf +} + +// HTMLBlock represents markdown html node +type HTMLBlock struct { + Leaf +} + +// CodeBlock represents markdown code block node +type CodeBlock struct { + Leaf + + IsFenced bool // Specifies whether it's a fenced code block or an indented one + Info []byte // This holds the info string + FenceChar byte + FenceLength int + FenceOffset int +} + +// Softbreak represents markdown softbreak node +// Note: not used currently +type Softbreak struct { + Leaf +} + +// Hardbreak represents markdown hard break node +type Hardbreak struct { + Leaf +} + +// NonBlockingSpace represents markdown non-blocking space node +type NonBlockingSpace struct { + Leaf +} + +// Code represents markdown code node +type Code struct { + Leaf +} + +// HTMLSpan represents markdown html span node +type HTMLSpan struct { + Leaf +} + +// Table represents markdown table node +type Table struct { + Container +} + +// TableCell represents markdown table cell node +type TableCell struct { + Container + + IsHeader bool // This tells if it's under the header row + Align CellAlignFlags // This holds the value for align attribute +} + +// TableHeader represents markdown table head node +type TableHeader struct { + Container +} + +// TableBody represents markdown table body node +type TableBody struct { + Container +} + +// TableRow represents markdown table row node +type TableRow struct { + Container +} + +// TableFooter represents markdown table foot node +type TableFooter struct { + Container +} + +// Caption represents a figure, code or quote caption +type Caption struct { + Container +} + +// CaptionFigure is a node (blockquote or codeblock) that has a caption +type CaptionFigure struct { + Container + + HeadingID string // This might hold heading ID, if present +} + +// Callout is a node that can exist both in text (where it is an actual node) and in a code block. +type Callout struct { + Leaf + + ID []byte // number of this callout +} + +// Index is a node that contains an Index item and an optional, subitem. +type Index struct { + Leaf + + Primary bool + Item []byte + Subitem []byte + ID string // ID of the index +} + +// Subscript is a subscript node +type Subscript struct { + Leaf +} + +// Subscript is a superscript node +type Superscript struct { + Leaf +} + +// Footnotes is a node that contains all footnotes +type Footnotes struct { + Container +} + +func removeNodeFromArray(a []Node, node Node) []Node { + n := len(a) + for i := 0; i < n; i++ { + if a[i] == node { + return append(a[:i], a[i+1:]...) + } + } + return nil +} + +// AppendChild appends child to children of parent +// It panics if either node is nil. +func AppendChild(parent Node, child Node) { + RemoveFromTree(child) + child.SetParent(parent) + newChildren := append(parent.GetChildren(), child) + parent.SetChildren(newChildren) +} + +// RemoveFromTree removes this node from tree +func RemoveFromTree(n Node) { + if n.GetParent() == nil { + return + } + // important: don't clear n.Children if n has no parent + // we're called from AppendChild and that might happen on a node + // that accumulated Children but hasn't been inserted into the tree + n.SetChildren(nil) + p := n.GetParent() + newChildren := removeNodeFromArray(p.GetChildren(), n) + if newChildren != nil { + p.SetChildren(newChildren) + } +} + +// GetLastChild returns last child of node n +// It's implemented as stand-alone function to keep Node interface small +func GetLastChild(n Node) Node { + a := n.GetChildren() + if len(a) > 0 { + return a[len(a)-1] + } + return nil +} + +// GetFirstChild returns first child of node n +// It's implemented as stand-alone function to keep Node interface small +func GetFirstChild(n Node) Node { + a := n.GetChildren() + if len(a) > 0 { + return a[0] + } + return nil +} + +// GetNextNode returns next sibling of node n (node after n) +// We can't make it part of Container or Leaf because we loose Node identity +func GetNextNode(n Node) Node { + parent := n.GetParent() + if parent == nil { + return nil + } + a := parent.GetChildren() + len := len(a) - 1 + for i := 0; i < len; i++ { + if a[i] == n { + return a[i+1] + } + } + return nil +} + +// GetPrevNode returns previous sibling of node n (node before n) +// We can't make it part of Container or Leaf because we loose Node identity +func GetPrevNode(n Node) Node { + parent := n.GetParent() + if parent == nil { + return nil + } + a := parent.GetChildren() + len := len(a) + for i := 1; i < len; i++ { + if a[i] == n { + return a[i-1] + } + } + return nil +} + +// WalkStatus allows NodeVisitor to have some control over the tree traversal. +// It is returned from NodeVisitor and different values allow Node.Walk to +// decide which node to go to next. +type WalkStatus int + +const ( + // GoToNext is the default traversal of every node. + GoToNext WalkStatus = iota + // SkipChildren tells walker to skip all children of current node. + SkipChildren + // Terminate tells walker to terminate the traversal. + Terminate +) + +// NodeVisitor is a callback to be called when traversing the syntax tree. +// Called twice for every node: once with entering=true when the branch is +// first visited, then with entering=false after all the children are done. +type NodeVisitor interface { + Visit(node Node, entering bool) WalkStatus +} + +// NodeVisitorFunc casts a function to match NodeVisitor interface +type NodeVisitorFunc func(node Node, entering bool) WalkStatus + +// Walk traverses tree recursively +func Walk(n Node, visitor NodeVisitor) WalkStatus { + isContainer := n.AsContainer() != nil + status := visitor.Visit(n, true) // entering + if status == Terminate { + // even if terminating, close container node + if isContainer { + visitor.Visit(n, false) + } + return status + } + if isContainer && status != SkipChildren { + children := n.GetChildren() + for _, n := range children { + status = Walk(n, visitor) + if status == Terminate { + return status + } + } + } + if isContainer { + status = visitor.Visit(n, false) // exiting + if status == Terminate { + return status + } + } + return GoToNext +} + +// Visit calls visitor function +func (f NodeVisitorFunc) Visit(node Node, entering bool) WalkStatus { + return f(node, entering) +} + +// WalkFunc is like Walk but accepts just a callback function +func WalkFunc(n Node, f NodeVisitorFunc) { + visitor := NodeVisitorFunc(f) + Walk(n, visitor) +} diff --git a/vendor/github.com/gomarkdown/markdown/ast/print.go b/vendor/github.com/gomarkdown/markdown/ast/print.go new file mode 100644 index 000000000..75daf911b --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/ast/print.go @@ -0,0 +1,165 @@ +package ast + +import ( + "bytes" + "fmt" + "io" + "strings" +) + +// Print is for debugging. It prints a string representation of parsed +// markdown doc (result of parser.Parse()) to dst. +// +// To make output readable, it shortens text output. +func Print(dst io.Writer, doc Node) { + PrintWithPrefix(dst, doc, " ") +} + +// PrintWithPrefix is like Print but allows customizing prefix used for +// indentation. By default it's 2 spaces. You can change it to e.g. tab +// by passing "\t" +func PrintWithPrefix(w io.Writer, doc Node, prefix string) { + // for more compact output, don't print outer Document + if _, ok := doc.(*Document); ok { + for _, c := range doc.GetChildren() { + printRecur(w, c, prefix, 0) + } + } else { + printRecur(w, doc, prefix, 0) + } +} + +// ToString is like Dump but returns result as a string +func ToString(doc Node) string { + var buf bytes.Buffer + Print(&buf, doc) + return buf.String() +} + +func contentToString(d1 []byte, d2 []byte) string { + if d1 != nil { + return string(d1) + } + if d2 != nil { + return string(d2) + } + return "" +} + +func getContent(node Node) string { + if c := node.AsContainer(); c != nil { + return contentToString(c.Literal, c.Content) + } + leaf := node.AsLeaf() + return contentToString(leaf.Literal, leaf.Content) +} + +func shortenString(s string, maxLen int) string { + // for cleaner, one-line ouput, replace some white-space chars + // with their escaped version + s = strings.Replace(s, "\n", `\n`, -1) + s = strings.Replace(s, "\r", `\r`, -1) + s = strings.Replace(s, "\t", `\t`, -1) + if maxLen < 0 { + return s + } + if len(s) < maxLen { + return s + } + // add "..." to indicate truncation + return s[:maxLen-3] + "..." +} + +// get a short name of the type of v which excludes package name +// and strips "()" from the end +func getNodeType(node Node) string { + s := fmt.Sprintf("%T", node) + s = strings.TrimSuffix(s, "()") + if idx := strings.Index(s, "."); idx != -1 { + return s[idx+1:] + } + return s +} + +func printDefault(w io.Writer, indent string, typeName string, content string) { + content = strings.TrimSpace(content) + if len(content) > 0 { + fmt.Fprintf(w, "%s%s '%s'\n", indent, typeName, content) + } else { + fmt.Fprintf(w, "%s%s\n", indent, typeName) + } +} + +func getListFlags(f ListType) string { + var s string + if f&ListTypeOrdered != 0 { + s += "ordered " + } + if f&ListTypeDefinition != 0 { + s += "definition " + } + if f&ListTypeTerm != 0 { + s += "term " + } + if f&ListItemContainsBlock != 0 { + s += "has_block " + } + if f&ListItemBeginningOfList != 0 { + s += "start " + } + if f&ListItemEndOfList != 0 { + s += "end " + } + s = strings.TrimSpace(s) + return s +} + +func printRecur(w io.Writer, node Node, prefix string, depth int) { + if node == nil { + return + } + indent := strings.Repeat(prefix, depth) + + content := shortenString(getContent(node), 40) + typeName := getNodeType(node) + switch v := node.(type) { + case *Link: + content := "url=" + string(v.Destination) + printDefault(w, indent, typeName, content) + case *Image: + content := "url=" + string(v.Destination) + printDefault(w, indent, typeName, content) + case *List: + if v.Start > 1 { + content += fmt.Sprintf("start=%d ", v.Start) + } + if v.Tight { + content += "tight " + } + if v.IsFootnotesList { + content += "footnotes " + } + flags := getListFlags(v.ListFlags) + if len(flags) > 0 { + content += "flags=" + flags + " " + } + printDefault(w, indent, typeName, content) + case *ListItem: + if v.Tight { + content += "tight " + } + if v.IsFootnotesList { + content += "footnotes " + } + flags := getListFlags(v.ListFlags) + if len(flags) > 0 { + content += "flags=" + flags + " " + } + printDefault(w, indent, typeName, content) + default: + printDefault(w, indent, typeName, content) + } + for _, child := range node.GetChildren() { + printRecur(w, child, prefix, depth+1) + } +} diff --git a/vendor/github.com/gomarkdown/markdown/changes-from-blackfriday.md b/vendor/github.com/gomarkdown/markdown/changes-from-blackfriday.md new file mode 100644 index 000000000..b618dfefc --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/changes-from-blackfriday.md @@ -0,0 +1,27 @@ +## Changes from blackfriday + +This library is derived from blackfriday library. Here's a list of changes. + +**Redesigned API** + +- split into 3 separate packages: ast, parser and html (for html renderer). This makes the API more manageable. It also separates e.g. parser option from renderer options +- changed how AST node is represented from union-like representation (manually keeping track of the type of the node) to using interface{} (which is a Go way to combine an arbitrary value with its type) + +**Allow re-using most of html renderer logic** + +You can implement your own renderer by implementing `Renderer` interface. + +Implementing a full renderer is a lot of work and often you just want to tweak html rendering of few node typs. + +I've added a way to hook `Renderer.Render` function in html renderer with a custom function that can take over rendering of specific nodes. + +I use it myself to do syntax-highlighting of code snippets. + +**Speed up go test** + +Running `go test` was really slow (17 secs) because it did a poor man's version of fuzzing by feeding the parser all subsets of test strings in order to find panics +due to incorrect parsing logic. + +I've moved that logic to `cmd/crashtest`, so that it can be run on CI but not slow down regular development. + +Now `go test` is blazing fast. diff --git a/vendor/github.com/gomarkdown/markdown/codecov.yml b/vendor/github.com/gomarkdown/markdown/codecov.yml new file mode 100644 index 000000000..f681ff11d --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/codecov.yml @@ -0,0 +1,8 @@ +coverage: + status: + project: + default: + # basic + target: 60% + threshold: 2% + base: auto diff --git a/vendor/github.com/gomarkdown/markdown/doc.go b/vendor/github.com/gomarkdown/markdown/doc.go new file mode 100644 index 000000000..b623024d9 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/doc.go @@ -0,0 +1,35 @@ +/* +Package markdown implements markdown parser and HTML renderer. + +It parses markdown into AST format which can be serialized to HTML +(using html.Renderer) or possibly other formats (using alternate renderers). + +Convert markdown to HTML + +The simplest way to convert markdown document to HTML + + md := []byte("## markdown document") + html := markdown.ToHTML(md, nil, nil) + +Customizing parsing and HTML rendering + +You can customize parser and HTML renderer: + + import ( + "github.com/gomarkdown/markdown/parser" + "github.com/gomarkdown/markdown/renderer" + "github.com/gomarkdown/markdown" + ) + extensions := parser.CommonExtensions | parser.AutoHeadingIDs + p := parser.NewWithExtensions(extensions) + + htmlFlags := html.CommonFlags | html.HrefTargetBlank + opts := html.RendererOptions{Flags: htmlFlags} + renderer := html.NewRenderer(opts) + + md := []byte("markdown text") + html := markdown.ToHTML(md, p, renderer) + +For a cmd-line tool see https://github.com/gomarkdown/mdtohtml +*/ +package markdown diff --git a/vendor/github.com/gomarkdown/markdown/fuzz.go b/vendor/github.com/gomarkdown/markdown/fuzz.go new file mode 100644 index 000000000..704182b8f --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/fuzz.go @@ -0,0 +1,9 @@ +// +build gofuzz + +package markdown + +// Fuzz is to be used by https://github.com/dvyukov/go-fuzz +func Fuzz(data []byte) int { + Parse(data, nil) + return 0 +} diff --git a/vendor/github.com/gomarkdown/markdown/html/callouts.go b/vendor/github.com/gomarkdown/markdown/html/callouts.go new file mode 100644 index 000000000..e377af229 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/html/callouts.go @@ -0,0 +1,42 @@ +package html + +import ( + "bytes" + "io" + + "github.com/gomarkdown/markdown/ast" + "github.com/gomarkdown/markdown/parser" +) + +// EscapeHTMLCallouts writes html-escaped d to w. It escapes &, <, > and " characters, *but* +// expands callouts <> with the callout HTML, i.e. by calling r.callout() with a newly created +// ast.Callout node. +func (r *Renderer) EscapeHTMLCallouts(w io.Writer, d []byte) { + ld := len(d) +Parse: + for i := 0; i < ld; i++ { + for _, comment := range r.opts.Comments { + if !bytes.HasPrefix(d[i:], comment) { + break + } + + lc := len(comment) + if i+lc < ld { + if id, consumed := parser.IsCallout(d[i+lc:]); consumed > 0 { + // We have seen a callout + callout := &ast.Callout{ID: id} + r.callout(w, callout) + i += consumed + lc - 1 + continue Parse + } + } + } + + escSeq := Escaper[d[i]] + if escSeq != nil { + w.Write(escSeq) + } else { + w.Write([]byte{d[i]}) + } + } +} diff --git a/vendor/github.com/gomarkdown/markdown/html/doc.go b/vendor/github.com/gomarkdown/markdown/html/doc.go new file mode 100644 index 000000000..f837c63d1 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/html/doc.go @@ -0,0 +1,43 @@ +/* +Package html implements HTML renderer of parsed markdown document. + +Configuring and customizing a renderer + +A renderer can be configured with multiple options: + + import "github.com/gomarkdown/markdown/html" + + flags := html.CommonFlags | html.CompletePage | html.HrefTargetBlank + opts := html.RenderOptions{ + TItle: "A custom title", + Flags: flags, + } + renderer := html.NewRenderer(opts) + +You can also re-use most of the logic and customize rendering of selected nodes +by providing node render hook. +This is most useful for rendering nodes that allow for design choices, like +links or code blocks. + + import ( + "github.com/gomarkdown/markdown/html" + "github.com/gomarkdown/markdown/ast" + ) + + // a very dummy render hook that will output "code_replacements" instead of + // ${content} emitted by html.Renderer + func renderHookCodeBlock(w io.Writer, node *ast.Node, entering bool) (ast.WalkStatus, bool) { + _, ok := node.Data.(*ast.CodeBlockData) + if !ok { + return ast.GoToNext, false + } + io.WriteString(w, "code_replacement") + return ast.GoToNext, true + } + + opts := html.RendererOptions{ + RenderNodeHook: renderHookCodeBlock, + } + renderer := html.NewRenderer(opts) +*/ +package html diff --git a/vendor/github.com/gomarkdown/markdown/html/esc.go b/vendor/github.com/gomarkdown/markdown/html/esc.go new file mode 100644 index 000000000..89ec9a278 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/html/esc.go @@ -0,0 +1,50 @@ +package html + +import ( + "html" + "io" +) + +var Escaper = [256][]byte{ + '&': []byte("&"), + '<': []byte("<"), + '>': []byte(">"), + '"': []byte("""), +} + +// EscapeHTML writes html-escaped d to w. It escapes &, <, > and " characters. +func EscapeHTML(w io.Writer, d []byte) { + var start, end int + n := len(d) + for end < n { + escSeq := Escaper[d[end]] + if escSeq != nil { + w.Write(d[start:end]) + w.Write(escSeq) + start = end + 1 + } + end++ + } + if start < n && end <= n { + w.Write(d[start:end]) + } +} + +func escLink(w io.Writer, text []byte) { + unesc := html.UnescapeString(string(text)) + EscapeHTML(w, []byte(unesc)) +} + +// Escape writes the text to w, but skips the escape character. +func Escape(w io.Writer, text []byte) { + esc := false + for i := 0; i < len(text); i++ { + if text[i] == '\\' { + esc = !esc + } + if esc && text[i] == '\\' { + continue + } + w.Write([]byte{text[i]}) + } +} diff --git a/vendor/github.com/gomarkdown/markdown/html/renderer.go b/vendor/github.com/gomarkdown/markdown/html/renderer.go new file mode 100644 index 000000000..367f7dfa1 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/html/renderer.go @@ -0,0 +1,1318 @@ +package html + +import ( + "bytes" + "fmt" + "io" + "regexp" + "sort" + "strconv" + "strings" + + "github.com/gomarkdown/markdown/ast" +) + +// Flags control optional behavior of HTML renderer. +type Flags int + +// IDTag is the tag used for tag identification, it defaults to "id", some renderers +// may wish to override this and use e.g. "anchor". +var IDTag = "id" + +// HTML renderer configuration options. +const ( + FlagsNone Flags = 0 + SkipHTML Flags = 1 << iota // Skip preformatted HTML blocks + SkipImages // Skip embedded images + SkipLinks // Skip all links + Safelink // Only link to trusted protocols + NofollowLinks // Only link with rel="nofollow" + NoreferrerLinks // Only link with rel="noreferrer" + HrefTargetBlank // Add a blank target + CompletePage // Generate a complete HTML page + UseXHTML // Generate XHTML output instead of HTML + FootnoteReturnLinks // Generate a link at the end of a footnote to return to the source + FootnoteNoHRTag // Do not output an HR after starting a footnote list. + Smartypants // Enable smart punctuation substitutions + SmartypantsFractions // Enable smart fractions (with Smartypants) + SmartypantsDashes // Enable smart dashes (with Smartypants) + SmartypantsLatexDashes // Enable LaTeX-style dashes (with Smartypants) + SmartypantsAngledQuotes // Enable angled double quotes (with Smartypants) for double quotes rendering + SmartypantsQuotesNBSP // Enable « French guillemets » (with Smartypants) + TOC // Generate a table of contents + + CommonFlags Flags = Smartypants | SmartypantsFractions | SmartypantsDashes | SmartypantsLatexDashes +) + +var ( + htmlTagRe = regexp.MustCompile("(?i)^" + htmlTag) +) + +const ( + htmlTag = "(?:" + openTag + "|" + closeTag + "|" + htmlComment + "|" + + processingInstruction + "|" + declaration + "|" + cdata + ")" + closeTag = "]" + openTag = "<" + tagName + attribute + "*" + "\\s*/?>" + attribute = "(?:" + "\\s+" + attributeName + attributeValueSpec + "?)" + attributeValue = "(?:" + unquotedValue + "|" + singleQuotedValue + "|" + doubleQuotedValue + ")" + attributeValueSpec = "(?:" + "\\s*=" + "\\s*" + attributeValue + ")" + attributeName = "[a-zA-Z_:][a-zA-Z0-9:._-]*" + cdata = "" + declaration = "]*>" + doubleQuotedValue = "\"[^\"]*\"" + htmlComment = "|" + processingInstruction = "[<][?].*?[?][>]" + singleQuotedValue = "'[^']*'" + tagName = "[A-Za-z][A-Za-z0-9-]*" + unquotedValue = "[^\"'=<>`\\x00-\\x20]+" +) + +// RenderNodeFunc allows reusing most of Renderer logic and replacing +// rendering of some nodes. If it returns false, Renderer.RenderNode +// will execute its logic. If it returns true, Renderer.RenderNode will +// skip rendering this node and will return WalkStatus +type RenderNodeFunc func(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool) + +// RendererOptions is a collection of supplementary parameters tweaking +// the behavior of various parts of HTML renderer. +type RendererOptions struct { + // Prepend this text to each relative URL. + AbsolutePrefix string + // Add this text to each footnote anchor, to ensure uniqueness. + FootnoteAnchorPrefix string + // Show this text inside the tag for a footnote return link, if the + // FootnoteReturnLinks flag is enabled. If blank, the string + // [return] is used. + FootnoteReturnLinkContents string + // CitationFormatString defines how a citation is rendered. If blnck, the string + // [%s] is used. Where %s will be substituted with the citation target. + CitationFormatString string + // If set, add this text to the front of each Heading ID, to ensure uniqueness. + HeadingIDPrefix string + // If set, add this text to the back of each Heading ID, to ensure uniqueness. + HeadingIDSuffix string + + Title string // Document title (used if CompletePage is set) + CSS string // Optional CSS file URL (used if CompletePage is set) + Icon string // Optional icon file URL (used if CompletePage is set) + Head []byte // Optional head data injected in the section (used if CompletePage is set) + + Flags Flags // Flags allow customizing this renderer's behavior + + // if set, called at the start of RenderNode(). Allows replacing + // rendering of some nodes + RenderNodeHook RenderNodeFunc + + // Comments is a list of comments the renderer should detect when + // parsing code blocks and detecting callouts. + Comments [][]byte + + // Generator is a meta tag that is inserted in the generated HTML so show what rendered it. It should not include the closing tag. + // Defaults (note content quote is not closed) to ` " or ">" + + // Track heading IDs to prevent ID collision in a single generation. + headingIDs map[string]int + + lastOutputLen int + disableTags int + + sr *SPRenderer + + documentMatter ast.DocumentMatters // keep track of front/main/back matter. +} + +// NewRenderer creates and configures an Renderer object, which +// satisfies the Renderer interface. +func NewRenderer(opts RendererOptions) *Renderer { + // configure the rendering engine + closeTag := ">" + if opts.Flags&UseXHTML != 0 { + closeTag = " />" + } + + if opts.FootnoteReturnLinkContents == "" { + opts.FootnoteReturnLinkContents = `[return]` + } + if opts.CitationFormatString == "" { + opts.CitationFormatString = `[%s]` + } + if opts.Generator == "" { + opts.Generator = ` = len(tagname) { + break + } + + if strings.ToLower(string(tag[i]))[0] != tagname[j] { + return false, -1 + } + } + + if i == len(tag) { + return false, -1 + } + + rightAngle := skipUntilCharIgnoreQuotes(tag, i, '>') + if rightAngle >= i { + return true, rightAngle + } + + return false, -1 +} + +func isRelativeLink(link []byte) (yes bool) { + // a tag begin with '#' + if link[0] == '#' { + return true + } + + // link begin with '/' but not '//', the second maybe a protocol relative link + if len(link) >= 2 && link[0] == '/' && link[1] != '/' { + return true + } + + // only the root '/' + if len(link) == 1 && link[0] == '/' { + return true + } + + // current directory : begin with "./" + if bytes.HasPrefix(link, []byte("./")) { + return true + } + + // parent directory : begin with "../" + if bytes.HasPrefix(link, []byte("../")) { + return true + } + + return false +} + +func (r *Renderer) ensureUniqueHeadingID(id string) string { + for count, found := r.headingIDs[id]; found; count, found = r.headingIDs[id] { + tmp := fmt.Sprintf("%s-%d", id, count+1) + + if _, tmpFound := r.headingIDs[tmp]; !tmpFound { + r.headingIDs[id] = count + 1 + id = tmp + } else { + id = id + "-1" + } + } + + if _, found := r.headingIDs[id]; !found { + r.headingIDs[id] = 0 + } + + return id +} + +func (r *Renderer) addAbsPrefix(link []byte) []byte { + if r.opts.AbsolutePrefix != "" && isRelativeLink(link) && link[0] != '.' { + newDest := r.opts.AbsolutePrefix + if link[0] != '/' { + newDest += "/" + } + newDest += string(link) + return []byte(newDest) + } + return link +} + +func appendLinkAttrs(attrs []string, flags Flags, link []byte) []string { + if isRelativeLink(link) { + return attrs + } + var val []string + if flags&NofollowLinks != 0 { + val = append(val, "nofollow") + } + if flags&NoreferrerLinks != 0 { + val = append(val, "noreferrer") + } + if flags&HrefTargetBlank != 0 { + attrs = append(attrs, `target="_blank"`) + } + if len(val) == 0 { + return attrs + } + attr := fmt.Sprintf("rel=%q", strings.Join(val, " ")) + return append(attrs, attr) +} + +func isMailto(link []byte) bool { + return bytes.HasPrefix(link, []byte("mailto:")) +} + +func needSkipLink(flags Flags, dest []byte) bool { + if flags&SkipLinks != 0 { + return true + } + return flags&Safelink != 0 && !isSafeLink(dest) && !isMailto(dest) +} + +func isSmartypantable(node ast.Node) bool { + switch node.GetParent().(type) { + case *ast.Link, *ast.CodeBlock, *ast.Code: + return false + } + return true +} + +func appendLanguageAttr(attrs []string, info []byte) []string { + if len(info) == 0 { + return attrs + } + endOfLang := bytes.IndexAny(info, "\t ") + if endOfLang < 0 { + endOfLang = len(info) + } + s := `class="language-` + string(info[:endOfLang]) + `"` + return append(attrs, s) +} + +func (r *Renderer) outTag(w io.Writer, name string, attrs []string) { + s := name + if len(attrs) > 0 { + s += " " + strings.Join(attrs, " ") + } + io.WriteString(w, s+">") + r.lastOutputLen = 1 +} + +func footnoteRef(prefix string, node *ast.Link) string { + urlFrag := prefix + string(slugify(node.Destination)) + nStr := strconv.Itoa(node.NoteID) + anchor := `` + nStr + `` + return `` + anchor + `` +} + +func footnoteItem(prefix string, slug []byte) string { + return `

  • ` +} + +func footnoteReturnLink(prefix, returnLink string, slug []byte) string { + return ` ` + returnLink + `` +} + +func listItemOpenCR(listItem *ast.ListItem) bool { + if ast.GetPrevNode(listItem) == nil { + return false + } + ld := listItem.Parent.(*ast.List) + return !ld.Tight && ld.ListFlags&ast.ListTypeDefinition == 0 +} + +func skipParagraphTags(para *ast.Paragraph) bool { + parent := para.Parent + grandparent := parent.GetParent() + if grandparent == nil || !isList(grandparent) { + return false + } + isParentTerm := isListItemTerm(parent) + grandparentListData := grandparent.(*ast.List) + tightOrTerm := grandparentListData.Tight || isParentTerm + return tightOrTerm +} + +func (r *Renderer) out(w io.Writer, d []byte) { + r.lastOutputLen = len(d) + if r.disableTags > 0 { + d = htmlTagRe.ReplaceAll(d, []byte{}) + } + w.Write(d) +} + +func (r *Renderer) outs(w io.Writer, s string) { + r.lastOutputLen = len(s) + if r.disableTags > 0 { + s = htmlTagRe.ReplaceAllString(s, "") + } + io.WriteString(w, s) +} + +func (r *Renderer) cr(w io.Writer) { + if r.lastOutputLen > 0 { + r.outs(w, "\n") + } +} + +var ( + openHTags = []string{"", "", "", "", ""} +) + +func headingOpenTagFromLevel(level int) string { + if level < 1 || level > 5 { + return " 5 { + return "" + } + return closeHTags[level-1] +} + +func (r *Renderer) outHRTag(w io.Writer, attrs []string) { + hr := tagWithAttributes("") +} + +func (r *Renderer) text(w io.Writer, text *ast.Text) { + if r.opts.Flags&Smartypants != 0 { + var tmp bytes.Buffer + EscapeHTML(&tmp, text.Literal) + r.sr.Process(w, tmp.Bytes()) + } else { + _, parentIsLink := text.Parent.(*ast.Link) + if parentIsLink { + escLink(w, text.Literal) + } else { + EscapeHTML(w, text.Literal) + } + } +} + +func (r *Renderer) hardBreak(w io.Writer, node *ast.Hardbreak) { + r.outOneOf(w, r.opts.Flags&UseXHTML == 0, "
    ", "
    ") + r.cr(w) +} + +func (r *Renderer) nonBlockingSpace(w io.Writer, node *ast.NonBlockingSpace) { + r.outs(w, " ") +} + +func (r *Renderer) outOneOf(w io.Writer, outFirst bool, first string, second string) { + if outFirst { + r.outs(w, first) + } else { + r.outs(w, second) + } +} + +func (r *Renderer) outOneOfCr(w io.Writer, outFirst bool, first string, second string) { + if outFirst { + r.cr(w) + r.outs(w, first) + } else { + r.outs(w, second) + r.cr(w) + } +} + +func (r *Renderer) htmlSpan(w io.Writer, span *ast.HTMLSpan) { + if r.opts.Flags&SkipHTML == 0 { + r.out(w, span.Literal) + } +} + +func (r *Renderer) linkEnter(w io.Writer, link *ast.Link) { + var attrs []string + dest := link.Destination + dest = r.addAbsPrefix(dest) + var hrefBuf bytes.Buffer + hrefBuf.WriteString("href=\"") + escLink(&hrefBuf, dest) + hrefBuf.WriteByte('"') + attrs = append(attrs, hrefBuf.String()) + if link.NoteID != 0 { + r.outs(w, footnoteRef(r.opts.FootnoteAnchorPrefix, link)) + return + } + + attrs = appendLinkAttrs(attrs, r.opts.Flags, dest) + if len(link.Title) > 0 { + var titleBuff bytes.Buffer + titleBuff.WriteString("title=\"") + EscapeHTML(&titleBuff, link.Title) + titleBuff.WriteByte('"') + attrs = append(attrs, titleBuff.String()) + } + r.outTag(w, "") + } +} + +func (r *Renderer) link(w io.Writer, link *ast.Link, entering bool) { + // mark it but don't link it if it is not a safe link: no smartypants + if needSkipLink(r.opts.Flags, link.Destination) { + r.outOneOf(w, entering, "", "") + return + } + + if entering { + r.linkEnter(w, link) + } else { + r.linkExit(w, link) + } +} + +func (r *Renderer) imageEnter(w io.Writer, image *ast.Image) { + dest := image.Destination + dest = r.addAbsPrefix(dest) + if r.disableTags == 0 { + //if options.safe && potentiallyUnsafe(dest) { + //out(w, ``)
+		//} else {
+		r.outs(w, `<img src=`) + } +} + +func (r *Renderer) paragraphEnter(w io.Writer, para *ast.Paragraph) { + // TODO: untangle this clusterfuck about when the newlines need + // to be added and when not. + prev := ast.GetPrevNode(para) + if prev != nil { + switch prev.(type) { + case *ast.HTMLBlock, *ast.List, *ast.Paragraph, *ast.Heading, *ast.CaptionFigure, *ast.CodeBlock, *ast.BlockQuote, *ast.Aside, *ast.HorizontalRule: + r.cr(w) + } + } + + if prev == nil { + _, isParentBlockQuote := para.Parent.(*ast.BlockQuote) + if isParentBlockQuote { + r.cr(w) + } + _, isParentAside := para.Parent.(*ast.Aside) + if isParentAside { + r.cr(w) + } + } + + tag := tagWithAttributes("") + if !(isListItem(para.Parent) && ast.GetNextNode(para) == nil) { + r.cr(w) + } +} + +func (r *Renderer) paragraph(w io.Writer, para *ast.Paragraph, entering bool) { + if skipParagraphTags(para) { + return + } + if entering { + r.paragraphEnter(w, para) + } else { + r.paragraphExit(w, para) + } +} +func (r *Renderer) image(w io.Writer, node *ast.Image, entering bool) { + if entering { + r.imageEnter(w, node) + } else { + r.imageExit(w, node) + } +} + +func (r *Renderer) code(w io.Writer, node *ast.Code) { + r.outs(w, "") + EscapeHTML(w, node.Literal) + r.outs(w, "") +} + +func (r *Renderer) htmlBlock(w io.Writer, node *ast.HTMLBlock) { + if r.opts.Flags&SkipHTML != 0 { + return + } + r.cr(w) + r.out(w, node.Literal) + r.cr(w) +} + +func (r *Renderer) headingEnter(w io.Writer, nodeData *ast.Heading) { + var attrs []string + var class string + // TODO(miek): add helper functions for coalescing these classes. + if nodeData.IsTitleblock { + class = "title" + } + if nodeData.IsSpecial { + if class != "" { + class += " special" + } else { + class = "special" + } + } + if class != "" { + attrs = []string{`class="` + class + `"`} + } + if nodeData.HeadingID != "" { + id := r.ensureUniqueHeadingID(nodeData.HeadingID) + if r.opts.HeadingIDPrefix != "" { + id = r.opts.HeadingIDPrefix + id + } + if r.opts.HeadingIDSuffix != "" { + id = id + r.opts.HeadingIDSuffix + } + attrID := `id="` + id + `"` + attrs = append(attrs, attrID) + } + attrs = append(attrs, BlockAttrs(nodeData)...) + r.cr(w) + r.outTag(w, headingOpenTagFromLevel(nodeData.Level), attrs) +} + +func (r *Renderer) headingExit(w io.Writer, heading *ast.Heading) { + r.outs(w, headingCloseTagFromLevel(heading.Level)) + if !(isListItem(heading.Parent) && ast.GetNextNode(heading) == nil) { + r.cr(w) + } +} + +func (r *Renderer) heading(w io.Writer, node *ast.Heading, entering bool) { + if entering { + r.headingEnter(w, node) + } else { + r.headingExit(w, node) + } +} + +func (r *Renderer) horizontalRule(w io.Writer, node *ast.HorizontalRule) { + r.cr(w) + r.outHRTag(w, BlockAttrs(node)) + r.cr(w) +} + +func (r *Renderer) listEnter(w io.Writer, nodeData *ast.List) { + // TODO: attrs don't seem to be set + var attrs []string + + if nodeData.IsFootnotesList { + r.outs(w, "\n
    \n\n") + if r.opts.Flags&FootnoteNoHRTag == 0 { + r.outHRTag(w, nil) + r.cr(w) + } + } + r.cr(w) + if isListItem(nodeData.Parent) { + grand := nodeData.Parent.GetParent() + if isListTight(grand) { + r.cr(w) + } + } + + openTag := " 0 { + attrs = append(attrs, fmt.Sprintf(`start="%d"`, nodeData.Start)) + } + openTag = "\n") + } +} + +func (r *Renderer) list(w io.Writer, list *ast.List, entering bool) { + if entering { + r.listEnter(w, list) + } else { + r.listExit(w, list) + } +} + +func (r *Renderer) listItemEnter(w io.Writer, listItem *ast.ListItem) { + if listItemOpenCR(listItem) { + r.cr(w) + } + if listItem.RefLink != nil { + slug := slugify(listItem.RefLink) + r.outs(w, footnoteItem(r.opts.FootnoteAnchorPrefix, slug)) + return + } + + openTag := "
  • " + if listItem.ListFlags&ast.ListTypeDefinition != 0 { + openTag = "
    " + } + if listItem.ListFlags&ast.ListTypeTerm != 0 { + openTag = "
    " + } + r.outs(w, openTag) +} + +func (r *Renderer) listItemExit(w io.Writer, listItem *ast.ListItem) { + if listItem.RefLink != nil && r.opts.Flags&FootnoteReturnLinks != 0 { + slug := slugify(listItem.RefLink) + prefix := r.opts.FootnoteAnchorPrefix + link := r.opts.FootnoteReturnLinkContents + s := footnoteReturnLink(prefix, link, slug) + r.outs(w, s) + } + + closeTag := "
  • " + if listItem.ListFlags&ast.ListTypeDefinition != 0 { + closeTag = "" + } + if listItem.ListFlags&ast.ListTypeTerm != 0 { + closeTag = "" + } + r.outs(w, closeTag) + r.cr(w) +} + +func (r *Renderer) listItem(w io.Writer, listItem *ast.ListItem, entering bool) { + if entering { + r.listItemEnter(w, listItem) + } else { + r.listItemExit(w, listItem) + } +} + +func (r *Renderer) codeBlock(w io.Writer, codeBlock *ast.CodeBlock) { + var attrs []string + // TODO(miek): this can add multiple class= attribute, they should be coalesced into one. + // This is probably true for some other elements as well + attrs = appendLanguageAttr(attrs, codeBlock.Info) + attrs = append(attrs, BlockAttrs(codeBlock)...) + r.cr(w) + + r.outs(w, "
    ")
    +	code := tagWithAttributes("")
    +	r.outs(w, "
    ") + if !isListItem(codeBlock.Parent) { + r.cr(w) + } +} + +func (r *Renderer) caption(w io.Writer, caption *ast.Caption, entering bool) { + if entering { + r.outs(w, "
    ") + return + } + r.outs(w, "
    ") +} + +func (r *Renderer) captionFigure(w io.Writer, figure *ast.CaptionFigure, entering bool) { + // TODO(miek): copy more generic ways of mmark over to here. + fig := "` + } else { + fig += ">" + } + r.outOneOf(w, entering, fig, "\n\n") +} + +func (r *Renderer) tableCell(w io.Writer, tableCell *ast.TableCell, entering bool) { + if !entering { + r.outOneOf(w, tableCell.IsHeader, "", "") + r.cr(w) + return + } + + // entering + var attrs []string + openTag := "") + // XXX: this is to adhere to a rather silly test. Should fix test. + if ast.GetFirstChild(node) == nil { + r.cr(w) + } + } else { + r.outs(w, "") + r.cr(w) + } +} + +func (r *Renderer) matter(w io.Writer, node *ast.DocumentMatter, entering bool) { + if !entering { + return + } + if r.documentMatter != ast.DocumentMatterNone { + r.outs(w, "\n") + } + switch node.Matter { + case ast.DocumentMatterFront: + r.outs(w, `
    `) + case ast.DocumentMatterMain: + r.outs(w, `
    `) + case ast.DocumentMatterBack: + r.outs(w, `
    `) + } + r.documentMatter = node.Matter +} + +func (r *Renderer) citation(w io.Writer, node *ast.Citation) { + for i, c := range node.Destination { + attr := []string{`class="none"`} + switch node.Type[i] { + case ast.CitationTypeNormative: + attr[0] = `class="normative"` + case ast.CitationTypeInformative: + attr[0] = `class="informative"` + case ast.CitationTypeSuppressed: + attr[0] = `class="suppressed"` + } + r.outTag(w, "`+r.opts.CitationFormatString+``, c, c)) + r.outs(w, "") + } +} + +func (r *Renderer) callout(w io.Writer, node *ast.Callout) { + attr := []string{`class="callout"`} + r.outTag(w, "") +} + +func (r *Renderer) index(w io.Writer, node *ast.Index) { + // there is no in-text representation. + attr := []string{`class="index"`, fmt.Sprintf(`id="%s"`, node.ID)} + r.outTag(w, "") +} + +// RenderNode renders a markdown node to HTML +func (r *Renderer) RenderNode(w io.Writer, node ast.Node, entering bool) ast.WalkStatus { + if r.opts.RenderNodeHook != nil { + status, didHandle := r.opts.RenderNodeHook(w, node, entering) + if didHandle { + return status + } + } + switch node := node.(type) { + case *ast.Text: + r.text(w, node) + case *ast.Softbreak: + r.cr(w) + // TODO: make it configurable via out(renderer.softbreak) + case *ast.Hardbreak: + r.hardBreak(w, node) + case *ast.NonBlockingSpace: + r.nonBlockingSpace(w, node) + case *ast.Emph: + r.outOneOf(w, entering, "", "") + case *ast.Strong: + r.outOneOf(w, entering, "", "") + case *ast.Del: + r.outOneOf(w, entering, "", "") + case *ast.BlockQuote: + tag := tagWithAttributes("") + case *ast.Aside: + tag := tagWithAttributes("") + case *ast.Link: + r.link(w, node, entering) + case *ast.CrossReference: + link := &ast.Link{Destination: append([]byte("#"), node.Destination...)} + r.link(w, link, entering) + case *ast.Citation: + r.citation(w, node) + case *ast.Image: + if r.opts.Flags&SkipImages != 0 { + return ast.SkipChildren + } + r.image(w, node, entering) + case *ast.Code: + r.code(w, node) + case *ast.CodeBlock: + r.codeBlock(w, node) + case *ast.Caption: + r.caption(w, node, entering) + case *ast.CaptionFigure: + r.captionFigure(w, node, entering) + case *ast.Document: + // do nothing + case *ast.Paragraph: + r.paragraph(w, node, entering) + case *ast.HTMLSpan: + r.htmlSpan(w, node) + case *ast.HTMLBlock: + r.htmlBlock(w, node) + case *ast.Heading: + r.heading(w, node, entering) + case *ast.HorizontalRule: + r.horizontalRule(w, node) + case *ast.List: + r.list(w, node, entering) + case *ast.ListItem: + r.listItem(w, node, entering) + case *ast.Table: + tag := tagWithAttributes("") + case *ast.TableCell: + r.tableCell(w, node, entering) + case *ast.TableHeader: + r.outOneOfCr(w, entering, "", "") + case *ast.TableBody: + r.tableBody(w, node, entering) + case *ast.TableRow: + r.outOneOfCr(w, entering, "", "") + case *ast.TableFooter: + r.outOneOfCr(w, entering, "", "") + case *ast.Math: + r.outOneOf(w, true, `\(`, `\)`) + EscapeHTML(w, node.Literal) + r.outOneOf(w, false, `\(`, `\)`) + case *ast.MathBlock: + r.outOneOf(w, entering, `

    \[`, `\]

    `) + if entering { + EscapeHTML(w, node.Literal) + } + case *ast.DocumentMatter: + r.matter(w, node, entering) + case *ast.Callout: + r.callout(w, node) + case *ast.Index: + r.index(w, node) + case *ast.Subscript: + r.outOneOf(w, true, "", "") + if entering { + Escape(w, node.Literal) + } + r.outOneOf(w, false, "", "") + case *ast.Superscript: + r.outOneOf(w, true, "", "") + if entering { + Escape(w, node.Literal) + } + r.outOneOf(w, false, "", "") + case *ast.Footnotes: + // nothing by default; just output the list. + default: + panic(fmt.Sprintf("Unknown node %T", node)) + } + return ast.GoToNext +} + +// RenderHeader writes HTML document preamble and TOC if requested. +func (r *Renderer) RenderHeader(w io.Writer, ast ast.Node) { + r.writeDocumentHeader(w) + if r.opts.Flags&TOC != 0 { + r.writeTOC(w, ast) + } +} + +// RenderFooter writes HTML document footer. +func (r *Renderer) RenderFooter(w io.Writer, _ ast.Node) { + if r.documentMatter != ast.DocumentMatterNone { + r.outs(w, "
    \n") + } + + if r.opts.Flags&CompletePage == 0 { + return + } + io.WriteString(w, "\n\n\n") +} + +func (r *Renderer) writeDocumentHeader(w io.Writer) { + if r.opts.Flags&CompletePage == 0 { + return + } + ending := "" + if r.opts.Flags&UseXHTML != 0 { + io.WriteString(w, "\n") + io.WriteString(w, "\n") + ending = " /" + } else { + io.WriteString(w, "\n") + io.WriteString(w, "\n") + } + io.WriteString(w, "\n") + io.WriteString(w, " ") + if r.opts.Flags&Smartypants != 0 { + r.sr.Process(w, []byte(r.opts.Title)) + } else { + EscapeHTML(w, []byte(r.opts.Title)) + } + io.WriteString(w, "\n") + io.WriteString(w, r.opts.Generator) + io.WriteString(w, "\"") + io.WriteString(w, ending) + io.WriteString(w, ">\n") + io.WriteString(w, " \n") + if r.opts.CSS != "" { + io.WriteString(w, " \n") + } + if r.opts.Icon != "" { + io.WriteString(w, " \n") + } + if r.opts.Head != nil { + w.Write(r.opts.Head) + } + io.WriteString(w, "\n") + io.WriteString(w, "\n\n") +} + +func (r *Renderer) writeTOC(w io.Writer, doc ast.Node) { + buf := bytes.Buffer{} + + inHeading := false + tocLevel := 0 + headingCount := 0 + + ast.WalkFunc(doc, func(node ast.Node, entering bool) ast.WalkStatus { + if nodeData, ok := node.(*ast.Heading); ok && !nodeData.IsTitleblock { + inHeading = entering + if !entering { + buf.WriteString("") + return ast.GoToNext + } + nodeData.HeadingID = fmt.Sprintf("toc_%d", headingCount) + if nodeData.Level == tocLevel { + buf.WriteString("\n\n
  • ") + } else if nodeData.Level < tocLevel { + for nodeData.Level < tocLevel { + tocLevel-- + buf.WriteString("
  • \n") + } + buf.WriteString("\n\n
  • ") + } else { + for nodeData.Level > tocLevel { + tocLevel++ + buf.WriteString("\n") + } + + if buf.Len() > 0 { + io.WriteString(w, "\n") + } + r.lastOutputLen = buf.Len() +} + +func isList(node ast.Node) bool { + _, ok := node.(*ast.List) + return ok +} + +func isListTight(node ast.Node) bool { + if list, ok := node.(*ast.List); ok { + return list.Tight + } + return false +} + +func isListItem(node ast.Node) bool { + _, ok := node.(*ast.ListItem) + return ok +} + +func isListItemTerm(node ast.Node) bool { + data, ok := node.(*ast.ListItem) + return ok && data.ListFlags&ast.ListTypeTerm != 0 +} + +// TODO: move to internal package +func skipSpace(data []byte, i int) int { + n := len(data) + for i < n && isSpace(data[i]) { + i++ + } + return i +} + +// TODO: move to internal package +var validUris = [][]byte{[]byte("http://"), []byte("https://"), []byte("ftp://"), []byte("mailto://")} +var validPaths = [][]byte{[]byte("/"), []byte("./"), []byte("../")} + +func isSafeLink(link []byte) bool { + for _, path := range validPaths { + if len(link) >= len(path) && bytes.Equal(link[:len(path)], path) { + if len(link) == len(path) { + return true + } else if isAlnum(link[len(path)]) { + return true + } + } + } + + for _, prefix := range validUris { + // TODO: handle unicode here + // case-insensitive prefix test + if len(link) > len(prefix) && bytes.Equal(bytes.ToLower(link[:len(prefix)]), prefix) && isAlnum(link[len(prefix)]) { + return true + } + } + + return false +} + +// TODO: move to internal package +// Create a url-safe slug for fragments +func slugify(in []byte) []byte { + if len(in) == 0 { + return in + } + out := make([]byte, 0, len(in)) + sym := false + + for _, ch := range in { + if isAlnum(ch) { + sym = false + out = append(out, ch) + } else if sym { + continue + } else { + out = append(out, '-') + sym = true + } + } + var a, b int + var ch byte + for a, ch = range out { + if ch != '-' { + break + } + } + for b = len(out) - 1; b > 0; b-- { + if out[b] != '-' { + break + } + } + return out[a : b+1] +} + +// TODO: move to internal package +// isAlnum returns true if c is a digit or letter +// TODO: check when this is looking for ASCII alnum and when it should use unicode +func isAlnum(c byte) bool { + return (c >= '0' && c <= '9') || isLetter(c) +} + +// isSpace returns true if c is a white-space charactr +func isSpace(c byte) bool { + return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v' +} + +// isLetter returns true if c is ascii letter +func isLetter(c byte) bool { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') +} + +// isPunctuation returns true if c is a punctuation symbol. +func isPunctuation(c byte) bool { + for _, r := range []byte("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~") { + if c == r { + return true + } + } + return false +} + +// BlockAttrs takes a node and checks if it has block level attributes set. If so it +// will return a slice each containing a "key=value(s)" string. +func BlockAttrs(node ast.Node) []string { + var attr *ast.Attribute + if c := node.AsContainer(); c != nil && c.Attribute != nil { + attr = c.Attribute + } + if l := node.AsLeaf(); l != nil && l.Attribute != nil { + attr = l.Attribute + } + if attr == nil { + return nil + } + + var s []string + if attr.ID != nil { + s = append(s, fmt.Sprintf(`%s="%s"`, IDTag, attr.ID)) + } + + classes := "" + for _, c := range attr.Classes { + classes += " " + string(c) + } + if classes != "" { + s = append(s, fmt.Sprintf(`class="%s"`, classes[1:])) // skip space we added. + } + + // sort the attributes so it remain stable between runs + var keys = []string{} + for k, _ := range attr.Attrs { + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + s = append(s, fmt.Sprintf(`%s="%s"`, k, attr.Attrs[k])) + } + + return s +} + +func tagWithAttributes(name string, attrs []string) string { + s := name + if len(attrs) > 0 { + s += " " + strings.Join(attrs, " ") + } + return s + ">" +} diff --git a/vendor/github.com/gomarkdown/markdown/html/smartypants.go b/vendor/github.com/gomarkdown/markdown/html/smartypants.go new file mode 100644 index 000000000..a09866b02 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/html/smartypants.go @@ -0,0 +1,444 @@ +package html + +import ( + "bytes" + "io" +) + +// SmartyPants rendering + +// SPRenderer is a struct containing state of a Smartypants renderer. +type SPRenderer struct { + inSingleQuote bool + inDoubleQuote bool + callbacks [256]smartCallback +} + +func wordBoundary(c byte) bool { + return c == 0 || isSpace(c) || isPunctuation(c) +} + +func tolower(c byte) byte { + if c >= 'A' && c <= 'Z' { + return c - 'A' + 'a' + } + return c +} + +func isdigit(c byte) bool { + return c >= '0' && c <= '9' +} + +func smartQuoteHelper(out *bytes.Buffer, previousChar byte, nextChar byte, quote byte, isOpen *bool, addNBSP bool) bool { + // edge of the buffer is likely to be a tag that we don't get to see, + // so we treat it like text sometimes + + // enumerate all sixteen possibilities for (previousChar, nextChar) + // each can be one of {0, space, punct, other} + switch { + case previousChar == 0 && nextChar == 0: + // context is not any help here, so toggle + *isOpen = !*isOpen + case isSpace(previousChar) && nextChar == 0: + // [ "] might be [ "foo...] + *isOpen = true + case isPunctuation(previousChar) && nextChar == 0: + // [!"] hmm... could be [Run!"] or [("...] + *isOpen = false + case /* isnormal(previousChar) && */ nextChar == 0: + // [a"] is probably a close + *isOpen = false + case previousChar == 0 && isSpace(nextChar): + // [" ] might be [...foo" ] + *isOpen = false + case isSpace(previousChar) && isSpace(nextChar): + // [ " ] context is not any help here, so toggle + *isOpen = !*isOpen + case isPunctuation(previousChar) && isSpace(nextChar): + // [!" ] is probably a close + *isOpen = false + case /* isnormal(previousChar) && */ isSpace(nextChar): + // [a" ] this is one of the easy cases + *isOpen = false + case previousChar == 0 && isPunctuation(nextChar): + // ["!] hmm... could be ["$1.95] or ["!...] + *isOpen = false + case isSpace(previousChar) && isPunctuation(nextChar): + // [ "!] looks more like [ "$1.95] + *isOpen = true + case isPunctuation(previousChar) && isPunctuation(nextChar): + // [!"!] context is not any help here, so toggle + *isOpen = !*isOpen + case /* isnormal(previousChar) && */ isPunctuation(nextChar): + // [a"!] is probably a close + *isOpen = false + case previousChar == 0 /* && isnormal(nextChar) */ : + // ["a] is probably an open + *isOpen = true + case isSpace(previousChar) /* && isnormal(nextChar) */ : + // [ "a] this is one of the easy cases + *isOpen = true + case isPunctuation(previousChar) /* && isnormal(nextChar) */ : + // [!"a] is probably an open + *isOpen = true + default: + // [a'b] maybe a contraction? + *isOpen = false + } + + // Note that with the limited lookahead, this non-breaking + // space will also be appended to single double quotes. + if addNBSP && !*isOpen { + out.WriteString(" ") + } + + out.WriteByte('&') + if *isOpen { + out.WriteByte('l') + } else { + out.WriteByte('r') + } + out.WriteByte(quote) + out.WriteString("quo;") + + if addNBSP && *isOpen { + out.WriteString(" ") + } + + return true +} + +func (r *SPRenderer) smartSingleQuote(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 2 { + t1 := tolower(text[1]) + + if t1 == '\'' { + nextChar := byte(0) + if len(text) >= 3 { + nextChar = text[2] + } + if smartQuoteHelper(out, previousChar, nextChar, 'd', &r.inDoubleQuote, false) { + return 1 + } + } + + if (t1 == 's' || t1 == 't' || t1 == 'm' || t1 == 'd') && (len(text) < 3 || wordBoundary(text[2])) { + out.WriteString("’") + return 0 + } + + if len(text) >= 3 { + t2 := tolower(text[2]) + + if ((t1 == 'r' && t2 == 'e') || (t1 == 'l' && t2 == 'l') || (t1 == 'v' && t2 == 'e')) && + (len(text) < 4 || wordBoundary(text[3])) { + out.WriteString("’") + return 0 + } + } + } + + nextChar := byte(0) + if len(text) > 1 { + nextChar = text[1] + } + if smartQuoteHelper(out, previousChar, nextChar, 's', &r.inSingleQuote, false) { + return 0 + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartParens(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 3 { + t1 := tolower(text[1]) + t2 := tolower(text[2]) + + if t1 == 'c' && t2 == ')' { + out.WriteString("©") + return 2 + } + + if t1 == 'r' && t2 == ')' { + out.WriteString("®") + return 2 + } + + if len(text) >= 4 && t1 == 't' && t2 == 'm' && text[3] == ')' { + out.WriteString("™") + return 3 + } + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartDash(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 2 { + if text[1] == '-' { + out.WriteString("—") + return 1 + } + + if wordBoundary(previousChar) && wordBoundary(text[1]) { + out.WriteString("–") + return 0 + } + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartDashLatex(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 3 && text[1] == '-' && text[2] == '-' { + out.WriteString("—") + return 2 + } + if len(text) >= 2 && text[1] == '-' { + out.WriteString("–") + return 1 + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartAmpVariant(out *bytes.Buffer, previousChar byte, text []byte, quote byte, addNBSP bool) int { + if bytes.HasPrefix(text, []byte(""")) { + nextChar := byte(0) + if len(text) >= 7 { + nextChar = text[6] + } + if smartQuoteHelper(out, previousChar, nextChar, quote, &r.inDoubleQuote, addNBSP) { + return 5 + } + } + + if bytes.HasPrefix(text, []byte("�")) { + return 3 + } + + out.WriteByte('&') + return 0 +} + +func (r *SPRenderer) smartAmp(angledQuotes, addNBSP bool) func(*bytes.Buffer, byte, []byte) int { + var quote byte = 'd' + if angledQuotes { + quote = 'a' + } + + return func(out *bytes.Buffer, previousChar byte, text []byte) int { + return r.smartAmpVariant(out, previousChar, text, quote, addNBSP) + } +} + +func (r *SPRenderer) smartPeriod(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 3 && text[1] == '.' && text[2] == '.' { + out.WriteString("…") + return 2 + } + + if len(text) >= 5 && text[1] == ' ' && text[2] == '.' && text[3] == ' ' && text[4] == '.' { + out.WriteString("…") + return 4 + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartBacktick(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 2 && text[1] == '`' { + nextChar := byte(0) + if len(text) >= 3 { + nextChar = text[2] + } + if smartQuoteHelper(out, previousChar, nextChar, 'd', &r.inDoubleQuote, false) { + return 1 + } + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartNumberGeneric(out *bytes.Buffer, previousChar byte, text []byte) int { + if wordBoundary(previousChar) && previousChar != '/' && len(text) >= 3 { + // is it of the form digits/digits(word boundary)?, i.e., \d+/\d+\b + // note: check for regular slash (/) or fraction slash (⁄, 0x2044, or 0xe2 81 84 in utf-8) + // and avoid changing dates like 1/23/2005 into fractions. + numEnd := 0 + for len(text) > numEnd && isdigit(text[numEnd]) { + numEnd++ + } + if numEnd == 0 { + out.WriteByte(text[0]) + return 0 + } + denStart := numEnd + 1 + if len(text) > numEnd+3 && text[numEnd] == 0xe2 && text[numEnd+1] == 0x81 && text[numEnd+2] == 0x84 { + denStart = numEnd + 3 + } else if len(text) < numEnd+2 || text[numEnd] != '/' { + out.WriteByte(text[0]) + return 0 + } + denEnd := denStart + for len(text) > denEnd && isdigit(text[denEnd]) { + denEnd++ + } + if denEnd == denStart { + out.WriteByte(text[0]) + return 0 + } + if len(text) == denEnd || wordBoundary(text[denEnd]) && text[denEnd] != '/' { + out.WriteString("") + out.Write(text[:numEnd]) + out.WriteString("") + out.Write(text[denStart:denEnd]) + out.WriteString("") + return denEnd - 1 + } + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartNumber(out *bytes.Buffer, previousChar byte, text []byte) int { + if wordBoundary(previousChar) && previousChar != '/' && len(text) >= 3 { + if text[0] == '1' && text[1] == '/' && text[2] == '2' { + if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' { + out.WriteString("½") + return 2 + } + } + + if text[0] == '1' && text[1] == '/' && text[2] == '4' { + if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' || (len(text) >= 5 && tolower(text[3]) == 't' && tolower(text[4]) == 'h') { + out.WriteString("¼") + return 2 + } + } + + if text[0] == '3' && text[1] == '/' && text[2] == '4' { + if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' || (len(text) >= 6 && tolower(text[3]) == 't' && tolower(text[4]) == 'h' && tolower(text[5]) == 's') { + out.WriteString("¾") + return 2 + } + } + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartDoubleQuoteVariant(out *bytes.Buffer, previousChar byte, text []byte, quote byte) int { + nextChar := byte(0) + if len(text) > 1 { + nextChar = text[1] + } + if !smartQuoteHelper(out, previousChar, nextChar, quote, &r.inDoubleQuote, false) { + out.WriteString(""") + } + + return 0 +} + +func (r *SPRenderer) smartDoubleQuote(out *bytes.Buffer, previousChar byte, text []byte) int { + return r.smartDoubleQuoteVariant(out, previousChar, text, 'd') +} + +func (r *SPRenderer) smartAngledDoubleQuote(out *bytes.Buffer, previousChar byte, text []byte) int { + return r.smartDoubleQuoteVariant(out, previousChar, text, 'a') +} + +func (r *SPRenderer) smartLeftAngle(out *bytes.Buffer, previousChar byte, text []byte) int { + i := 0 + + for i < len(text) && text[i] != '>' { + i++ + } + + out.Write(text[:i+1]) + return i +} + +type smartCallback func(out *bytes.Buffer, previousChar byte, text []byte) int + +// NewSmartypantsRenderer constructs a Smartypants renderer object. +func NewSmartypantsRenderer(flags Flags) *SPRenderer { + var ( + r SPRenderer + + smartAmpAngled = r.smartAmp(true, false) + smartAmpAngledNBSP = r.smartAmp(true, true) + smartAmpRegular = r.smartAmp(false, false) + smartAmpRegularNBSP = r.smartAmp(false, true) + + addNBSP = flags&SmartypantsQuotesNBSP != 0 + ) + + if flags&SmartypantsAngledQuotes == 0 { + r.callbacks['"'] = r.smartDoubleQuote + if !addNBSP { + r.callbacks['&'] = smartAmpRegular + } else { + r.callbacks['&'] = smartAmpRegularNBSP + } + } else { + r.callbacks['"'] = r.smartAngledDoubleQuote + if !addNBSP { + r.callbacks['&'] = smartAmpAngled + } else { + r.callbacks['&'] = smartAmpAngledNBSP + } + } + r.callbacks['\''] = r.smartSingleQuote + r.callbacks['('] = r.smartParens + if flags&SmartypantsDashes != 0 { + if flags&SmartypantsLatexDashes == 0 { + r.callbacks['-'] = r.smartDash + } else { + r.callbacks['-'] = r.smartDashLatex + } + } + r.callbacks['.'] = r.smartPeriod + if flags&SmartypantsFractions == 0 { + r.callbacks['1'] = r.smartNumber + r.callbacks['3'] = r.smartNumber + } else { + for ch := '1'; ch <= '9'; ch++ { + r.callbacks[ch] = r.smartNumberGeneric + } + } + r.callbacks['<'] = r.smartLeftAngle + r.callbacks['`'] = r.smartBacktick + return &r +} + +// Process is the entry point of the Smartypants renderer. +func (r *SPRenderer) Process(w io.Writer, text []byte) { + mark := 0 + for i := 0; i < len(text); i++ { + if action := r.callbacks[text[i]]; action != nil { + if i > mark { + w.Write(text[mark:i]) + } + previousChar := byte(0) + if i > 0 { + previousChar = text[i-1] + } + var tmp bytes.Buffer + i += action(&tmp, previousChar, text[i:]) + w.Write(tmp.Bytes()) + mark = i + 1 + } + } + if mark < len(text) { + w.Write(text[mark:]) + } +} diff --git a/vendor/github.com/gomarkdown/markdown/markdown.go b/vendor/github.com/gomarkdown/markdown/markdown.go new file mode 100644 index 000000000..fd5c1cfb2 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/markdown.go @@ -0,0 +1,85 @@ +package markdown + +import ( + "bytes" + "io" + + "github.com/gomarkdown/markdown/ast" + "github.com/gomarkdown/markdown/html" + "github.com/gomarkdown/markdown/parser" +) + +// Renderer is an interface for implementing custom renderers. +type Renderer interface { + // RenderNode renders markdown node to w. + // It's called once for a leaf node. + // It's called twice for non-leaf nodes: + // * first with entering=true + // * then with entering=false + // + // Return value is a way to tell the calling walker to adjust its walk + // pattern: e.g. it can terminate the traversal by returning Terminate. Or it + // can ask the walker to skip a subtree of this node by returning SkipChildren. + // The typical behavior is to return GoToNext, which asks for the usual + // traversal to the next node. + RenderNode(w io.Writer, node ast.Node, entering bool) ast.WalkStatus + + // RenderHeader is a method that allows the renderer to produce some + // content preceding the main body of the output document. The header is + // understood in the broad sense here. For example, the default HTML + // renderer will write not only the HTML document preamble, but also the + // table of contents if it was requested. + // + // The method will be passed an entire document tree, in case a particular + // implementation needs to inspect it to produce output. + // + // The output should be written to the supplied writer w. If your + // implementation has no header to write, supply an empty implementation. + RenderHeader(w io.Writer, ast ast.Node) + + // RenderFooter is a symmetric counterpart of RenderHeader. + RenderFooter(w io.Writer, ast ast.Node) +} + +// Parse parsers a markdown document using provided parser. If parser is nil, +// we use parser configured with parser.CommonExtensions. +// +// It returns AST (abstract syntax tree) that can be converted to another +// format using Render function. +func Parse(markdown []byte, p *parser.Parser) ast.Node { + if p == nil { + p = parser.New() + } + return p.Parse(markdown) +} + +// Render uses renderer to convert parsed markdown document into a different format. +// +// To convert to HTML, pass html.Renderer +func Render(doc ast.Node, renderer Renderer) []byte { + var buf bytes.Buffer + renderer.RenderHeader(&buf, doc) + ast.WalkFunc(doc, func(node ast.Node, entering bool) ast.WalkStatus { + return renderer.RenderNode(&buf, node, entering) + }) + renderer.RenderFooter(&buf, doc) + return buf.Bytes() +} + +// ToHTML converts markdownDoc to HTML. +// +// You can optionally pass a parser and renderer. This allows to customize +// a parser, use a customized html render or use completely custom renderer. +// +// If you pass nil for both, we use parser configured with parser.CommonExtensions +// and html.Renderer configured with html.CommonFlags. +func ToHTML(markdown []byte, p *parser.Parser, renderer Renderer) []byte { + doc := Parse(markdown, p) + if renderer == nil { + opts := html.RendererOptions{ + Flags: html.CommonFlags, + } + renderer = html.NewRenderer(opts) + } + return Render(doc, renderer) +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/aside.go b/vendor/github.com/gomarkdown/markdown/parser/aside.go new file mode 100644 index 000000000..96e25fe06 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/aside.go @@ -0,0 +1,73 @@ +package parser + +import ( + "bytes" + + "github.com/gomarkdown/markdown/ast" +) + +// returns aisde prefix length +func (p *Parser) asidePrefix(data []byte) int { + i := 0 + n := len(data) + for i < 3 && i < n && data[i] == ' ' { + i++ + } + if i+1 < n && data[i] == 'A' && data[i+1] == '>' { + if i+2 < n && data[i+2] == ' ' { + return i + 3 + } + return i + 2 + } + return 0 +} + +// aside ends with at least one blank line +// followed by something without a aside prefix +func (p *Parser) terminateAside(data []byte, beg, end int) bool { + if p.isEmpty(data[beg:]) <= 0 { + return false + } + if end >= len(data) { + return true + } + return p.asidePrefix(data[end:]) == 0 && p.isEmpty(data[end:]) == 0 +} + +// parse a aside fragment +func (p *Parser) aside(data []byte) int { + var raw bytes.Buffer + beg, end := 0, 0 + // identical to quote + for beg < len(data) { + end = beg + // Step over whole lines, collecting them. While doing that, check for + // fenced code and if one's found, incorporate it altogether, + // irregardless of any contents inside it + for end < len(data) && data[end] != '\n' { + if p.extensions&FencedCode != 0 { + if i := p.fencedCodeBlock(data[end:], false); i > 0 { + // -1 to compensate for the extra end++ after the loop: + end += i - 1 + break + } + } + end++ + } + end = skipCharN(data, end, '\n', 1) + if pre := p.asidePrefix(data[beg:]); pre > 0 { + // skip the prefix + beg += pre + } else if p.terminateAside(data, beg, end) { + break + } + // this line is part of the aside + raw.Write(data[beg:end]) + beg = end + } + + block := p.addBlock(&ast.Aside{}) + p.block(raw.Bytes()) + p.finalize(block) + return end +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/attribute.go b/vendor/github.com/gomarkdown/markdown/parser/attribute.go new file mode 100644 index 000000000..5fdb07095 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/attribute.go @@ -0,0 +1,116 @@ +package parser + +import ( + "bytes" + + "github.com/gomarkdown/markdown/ast" +) + +// attribute parses a (potential) block attribute and adds it to p. +func (p *Parser) attribute(data []byte) []byte { + if len(data) < 3 { + return data + } + i := 0 + if data[i] != '{' { + return data + } + i++ + + // last character must be a } otherwise it's not an attribute + end := skipUntilChar(data, i, '\n') + if data[end-1] != '}' { + return data + } + + i = skipSpace(data, i) + b := &ast.Attribute{Attrs: make(map[string][]byte)} + + esc := false + quote := false + trail := 0 +Loop: + for ; i < len(data); i++ { + switch data[i] { + case ' ', '\t', '\f', '\v': + if quote { + continue + } + chunk := data[trail+1 : i] + if len(chunk) == 0 { + trail = i + continue + } + switch { + case chunk[0] == '.': + b.Classes = append(b.Classes, chunk[1:]) + case chunk[0] == '#': + b.ID = chunk[1:] + default: + k, v := keyValue(chunk) + if k != nil && v != nil { + b.Attrs[string(k)] = v + } else { + // this is illegal in an attribute + return data + } + } + trail = i + case '"': + if esc { + esc = !esc + continue + } + quote = !quote + case '\\': + esc = !esc + case '}': + if esc { + esc = !esc + continue + } + chunk := data[trail+1 : i] + if len(chunk) == 0 { + return data + } + switch { + case chunk[0] == '.': + b.Classes = append(b.Classes, chunk[1:]) + case chunk[0] == '#': + b.ID = chunk[1:] + default: + k, v := keyValue(chunk) + if k != nil && v != nil { + b.Attrs[string(k)] = v + } else { + return data + } + } + i++ + break Loop + default: + esc = false + } + } + + p.attr = b + return data[i:] +} + +// key="value" quotes are mandatory. +func keyValue(data []byte) ([]byte, []byte) { + chunk := bytes.SplitN(data, []byte{'='}, 2) + if len(chunk) != 2 { + return nil, nil + } + key := chunk[0] + value := chunk[1] + + if len(value) < 3 || len(key) == 0 { + return nil, nil + } + if value[0] != '"' || value[len(value)-1] != '"' { + return key, nil + } + return key, value[1 : len(value)-1] +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/block.go b/vendor/github.com/gomarkdown/markdown/parser/block.go new file mode 100644 index 000000000..18a2dd894 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/block.go @@ -0,0 +1,1978 @@ +package parser + +import ( + "bytes" + "html" + "regexp" + "strconv" + "unicode" + + "github.com/gomarkdown/markdown/ast" +) + +// Parsing block-level elements. + +const ( + charEntity = "&(?:#x[a-f0-9]{1,8}|#[0-9]{1,8}|[a-z][a-z0-9]{1,31});" + escapable = "[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]" +) + +var ( + reBackslashOrAmp = regexp.MustCompile("[\\&]") + reEntityOrEscapedChar = regexp.MustCompile("(?i)\\\\" + escapable + "|" + charEntity) + + // blockTags is a set of tags that are recognized as HTML block tags. + // Any of these can be included in markdown text without special escaping. + blockTags = map[string]struct{}{ + "blockquote": struct{}{}, + "del": struct{}{}, + "div": struct{}{}, + "dl": struct{}{}, + "fieldset": struct{}{}, + "form": struct{}{}, + "h1": struct{}{}, + "h2": struct{}{}, + "h3": struct{}{}, + "h4": struct{}{}, + "h5": struct{}{}, + "h6": struct{}{}, + "iframe": struct{}{}, + "ins": struct{}{}, + "math": struct{}{}, + "noscript": struct{}{}, + "ol": struct{}{}, + "pre": struct{}{}, + "p": struct{}{}, + "script": struct{}{}, + "style": struct{}{}, + "table": struct{}{}, + "ul": struct{}{}, + + // HTML5 + "address": struct{}{}, + "article": struct{}{}, + "aside": struct{}{}, + "canvas": struct{}{}, + "figcaption": struct{}{}, + "figure": struct{}{}, + "footer": struct{}{}, + "header": struct{}{}, + "hgroup": struct{}{}, + "main": struct{}{}, + "nav": struct{}{}, + "output": struct{}{}, + "progress": struct{}{}, + "section": struct{}{}, + "video": struct{}{}, + } +) + +// sanitizeAnchorName returns a sanitized anchor name for the given text. +// Taken from https://github.com/shurcooL/sanitized_anchor_name/blob/master/main.go#L14:1 +func sanitizeAnchorName(text string) string { + var anchorName []rune + var futureDash = false + for _, r := range text { + switch { + case unicode.IsLetter(r) || unicode.IsNumber(r): + if futureDash && len(anchorName) > 0 { + anchorName = append(anchorName, '-') + } + futureDash = false + anchorName = append(anchorName, unicode.ToLower(r)) + default: + futureDash = true + } + } + return string(anchorName) +} + +// Parse block-level data. +// Note: this function and many that it calls assume that +// the input buffer ends with a newline. +func (p *Parser) block(data []byte) { + // this is called recursively: enforce a maximum depth + if p.nesting >= p.maxNesting { + return + } + p.nesting++ + + // parse out one block-level construct at a time + for len(data) > 0 { + // attributes that can be specific before a block element: + // + // {#id .class1 .class2 key="value"} + if p.extensions&Attributes != 0 { + data = p.attribute(data) + } + + if p.extensions&Includes != 0 { + f := p.readInclude + path, address, consumed := p.isInclude(data) + if consumed == 0 { + path, address, consumed = p.isCodeInclude(data) + f = p.readCodeInclude + } + if consumed > 0 { + included := f(p.includeStack.Last(), path, address) + p.includeStack.Push(path) + p.block(included) + p.includeStack.Pop() + data = data[consumed:] + continue + } + } + + // user supplied parser function + if p.Opts.ParserHook != nil { + node, blockdata, consumed := p.Opts.ParserHook(data) + if consumed > 0 { + data = data[consumed:] + + if node != nil { + p.addBlock(node) + if blockdata != nil { + p.block(blockdata) + p.finalize(node) + } + } + continue + } + } + + // prefixed heading: + // + // # Heading 1 + // ## Heading 2 + // ... + // ###### Heading 6 + if p.isPrefixHeading(data) { + data = data[p.prefixHeading(data):] + continue + } + + // prefixed special heading: + // (there are no levels.) + // + // .# Abstract + if p.isPrefixSpecialHeading(data) { + data = data[p.prefixSpecialHeading(data):] + continue + } + + // block of preformatted HTML: + // + //
    + // ... + //
    + if data[0] == '<' { + if i := p.html(data, true); i > 0 { + data = data[i:] + continue + } + } + + // title block + // + // % stuff + // % more stuff + // % even more stuff + if p.extensions&Titleblock != 0 { + if data[0] == '%' { + if i := p.titleBlock(data, true); i > 0 { + data = data[i:] + continue + } + } + } + + // blank lines. note: returns the # of bytes to skip + if i := p.isEmpty(data); i > 0 { + data = data[i:] + continue + } + + // indented code block: + // + // func max(a, b int) int { + // if a > b { + // return a + // } + // return b + // } + if p.codePrefix(data) > 0 { + data = data[p.code(data):] + continue + } + + // fenced code block: + // + // ``` go + // func fact(n int) int { + // if n <= 1 { + // return n + // } + // return n * fact(n-1) + // } + // ``` + if p.extensions&FencedCode != 0 { + if i := p.fencedCodeBlock(data, true); i > 0 { + data = data[i:] + continue + } + } + + // horizontal rule: + // + // ------ + // or + // ****** + // or + // ______ + if p.isHRule(data) { + p.addBlock(&ast.HorizontalRule{}) + i := skipUntilChar(data, 0, '\n') + data = data[i:] + continue + } + + // block quote: + // + // > A big quote I found somewhere + // > on the web + if p.quotePrefix(data) > 0 { + data = data[p.quote(data):] + continue + } + + // aside: + // + // A> The proof is too large to fit + // A> in the margin. + if p.extensions&Mmark != 0 { + if p.asidePrefix(data) > 0 { + data = data[p.aside(data):] + continue + } + } + + // figure block: + // + // !--- + // ![Alt Text](img.jpg "This is an image") + // ![Alt Text](img2.jpg "This is a second image") + // !--- + if p.extensions&Mmark != 0 { + if i := p.figureBlock(data, true); i > 0 { + data = data[i:] + continue + } + } + + // table: + // + // Name | Age | Phone + // ------|-----|--------- + // Bob | 31 | 555-1234 + // Alice | 27 | 555-4321 + if p.extensions&Tables != 0 { + if i := p.table(data); i > 0 { + data = data[i:] + continue + } + } + + // an itemized/unordered list: + // + // * Item 1 + // * Item 2 + // + // also works with + or - + if p.uliPrefix(data) > 0 { + data = data[p.list(data, 0, 0):] + continue + } + + // a numbered/ordered list: + // + // 1. Item 1 + // 2. Item 2 + if i := p.oliPrefix(data); i > 0 { + start := 0 + if i > 2 && p.extensions&OrderedListStart != 0 { + s := string(data[:i-2]) + start, _ = strconv.Atoi(s) + if start == 1 { + start = 0 + } + } + data = data[p.list(data, ast.ListTypeOrdered, start):] + continue + } + + // definition lists: + // + // Term 1 + // : Definition a + // : Definition b + // + // Term 2 + // : Definition c + if p.extensions&DefinitionLists != 0 { + if p.dliPrefix(data) > 0 { + data = data[p.list(data, ast.ListTypeDefinition, 0):] + continue + } + } + + if p.extensions&MathJax != 0 { + if i := p.blockMath(data); i > 0 { + data = data[i:] + continue + } + } + + // document matters: + // + // {frontmatter}/{mainmatter}/{backmatter} + if p.extensions&Mmark != 0 { + if i := p.documentMatter(data); i > 0 { + data = data[i:] + continue + } + } + + // anything else must look like a normal paragraph + // note: this finds underlined headings, too + idx := p.paragraph(data) + data = data[idx:] + } + + p.nesting-- +} + +func (p *Parser) addBlock(n ast.Node) ast.Node { + p.closeUnmatchedBlocks() + + if p.attr != nil { + if c := n.AsContainer(); c != nil { + c.Attribute = p.attr + } + if l := n.AsLeaf(); l != nil { + l.Attribute = p.attr + } + p.attr = nil + } + return p.addChild(n) +} + +func (p *Parser) isPrefixHeading(data []byte) bool { + if data[0] != '#' { + return false + } + + if p.extensions&SpaceHeadings != 0 { + level := skipCharN(data, 0, '#', 6) + if level == len(data) || data[level] != ' ' { + return false + } + } + return true +} + +func (p *Parser) prefixHeading(data []byte) int { + level := skipCharN(data, 0, '#', 6) + i := skipChar(data, level, ' ') + end := skipUntilChar(data, i, '\n') + skip := end + id := "" + if p.extensions&HeadingIDs != 0 { + j, k := 0, 0 + // find start/end of heading id + for j = i; j < end-1 && (data[j] != '{' || data[j+1] != '#'); j++ { + } + for k = j + 1; k < end && data[k] != '}'; k++ { + } + // extract heading id iff found + if j < end && k < end { + id = string(data[j+2 : k]) + end = j + skip = k + 1 + for end > 0 && data[end-1] == ' ' { + end-- + } + } + } + for end > 0 && data[end-1] == '#' { + if isBackslashEscaped(data, end-1) { + break + } + end-- + } + for end > 0 && data[end-1] == ' ' { + end-- + } + if end > i { + if id == "" && p.extensions&AutoHeadingIDs != 0 { + id = sanitizeAnchorName(string(data[i:end])) + } + block := &ast.Heading{ + HeadingID: id, + Level: level, + } + block.Content = data[i:end] + p.addBlock(block) + } + return skip +} + +func (p *Parser) isPrefixSpecialHeading(data []byte) bool { + if p.extensions|Mmark == 0 { + return false + } + if len(data) < 4 { + return false + } + if data[0] != '.' { + return false + } + if data[1] != '#' { + return false + } + if data[2] == '#' { // we don't support level, so nack this. + return false + } + + if p.extensions&SpaceHeadings != 0 { + if data[2] != ' ' { + return false + } + } + return true +} + +func (p *Parser) prefixSpecialHeading(data []byte) int { + i := skipChar(data, 2, ' ') // ".#" skipped + end := skipUntilChar(data, i, '\n') + skip := end + id := "" + if p.extensions&HeadingIDs != 0 { + j, k := 0, 0 + // find start/end of heading id + for j = i; j < end-1 && (data[j] != '{' || data[j+1] != '#'); j++ { + } + for k = j + 1; k < end && data[k] != '}'; k++ { + } + // extract heading id iff found + if j < end && k < end { + id = string(data[j+2 : k]) + end = j + skip = k + 1 + for end > 0 && data[end-1] == ' ' { + end-- + } + } + } + for end > 0 && data[end-1] == '#' { + if isBackslashEscaped(data, end-1) { + break + } + end-- + } + for end > 0 && data[end-1] == ' ' { + end-- + } + if end > i { + if id == "" && p.extensions&AutoHeadingIDs != 0 { + id = sanitizeAnchorName(string(data[i:end])) + } + block := &ast.Heading{ + HeadingID: id, + IsSpecial: true, + Level: 1, // always level 1. + } + block.Literal = data[i:end] + block.Content = data[i:end] + p.addBlock(block) + } + return skip +} + +func (p *Parser) isUnderlinedHeading(data []byte) int { + // test of level 1 heading + if data[0] == '=' { + i := skipChar(data, 1, '=') + i = skipChar(data, i, ' ') + if i < len(data) && data[i] == '\n' { + return 1 + } + return 0 + } + + // test of level 2 heading + if data[0] == '-' { + i := skipChar(data, 1, '-') + i = skipChar(data, i, ' ') + if i < len(data) && data[i] == '\n' { + return 2 + } + return 0 + } + + return 0 +} + +func (p *Parser) titleBlock(data []byte, doRender bool) int { + if data[0] != '%' { + return 0 + } + splitData := bytes.Split(data, []byte("\n")) + var i int + for idx, b := range splitData { + if !bytes.HasPrefix(b, []byte("%")) { + i = idx // - 1 + break + } + } + + data = bytes.Join(splitData[0:i], []byte("\n")) + consumed := len(data) + data = bytes.TrimPrefix(data, []byte("% ")) + data = bytes.Replace(data, []byte("\n% "), []byte("\n"), -1) + block := &ast.Heading{ + Level: 1, + IsTitleblock: true, + } + block.Content = data + p.addBlock(block) + + return consumed +} + +func (p *Parser) html(data []byte, doRender bool) int { + var i, j int + + // identify the opening tag + if data[0] != '<' { + return 0 + } + curtag, tagfound := p.htmlFindTag(data[1:]) + + // handle special cases + if !tagfound { + // check for an HTML comment + if size := p.htmlComment(data, doRender); size > 0 { + return size + } + + // check for an
    tag + if size := p.htmlHr(data, doRender); size > 0 { + return size + } + + // no special case recognized + return 0 + } + + // look for an unindented matching closing tag + // followed by a blank line + found := false + /* + closetag := []byte("\n") + j = len(curtag) + 1 + for !found { + // scan for a closing tag at the beginning of a line + if skip := bytes.Index(data[j:], closetag); skip >= 0 { + j += skip + len(closetag) + } else { + break + } + + // see if it is the only thing on the line + if skip := p.isEmpty(data[j:]); skip > 0 { + // see if it is followed by a blank line/eof + j += skip + if j >= len(data) { + found = true + i = j + } else { + if skip := p.isEmpty(data[j:]); skip > 0 { + j += skip + found = true + i = j + } + } + } + } + */ + + // if not found, try a second pass looking for indented match + // but not if tag is "ins" or "del" (following original Markdown.pl) + if !found && curtag != "ins" && curtag != "del" { + i = 1 + for i < len(data) { + i++ + for i < len(data) && !(data[i-1] == '<' && data[i] == '/') { + i++ + } + + if i+2+len(curtag) >= len(data) { + break + } + + j = p.htmlFindEnd(curtag, data[i-1:]) + + if j > 0 { + i += j - 1 + found = true + break + } + } + } + + if !found { + return 0 + } + + // the end of the block has been found + if doRender { + // trim newlines + end := backChar(data, i, '\n') + htmlBLock := &ast.HTMLBlock{ast.Leaf{Content: data[:end]}} + p.addBlock(htmlBLock) + finalizeHTMLBlock(htmlBLock) + } + + return i +} + +func finalizeHTMLBlock(block *ast.HTMLBlock) { + block.Literal = block.Content + block.Content = nil +} + +// HTML comment, lax form +func (p *Parser) htmlComment(data []byte, doRender bool) int { + i := p.inlineHTMLComment(data) + // needs to end with a blank line + if j := p.isEmpty(data[i:]); j > 0 { + size := i + j + if doRender { + // trim trailing newlines + end := backChar(data, size, '\n') + htmlBLock := &ast.HTMLBlock{ast.Leaf{Content: data[:end]}} + p.addBlock(htmlBLock) + finalizeHTMLBlock(htmlBLock) + } + return size + } + return 0 +} + +// HR, which is the only self-closing block tag considered +func (p *Parser) htmlHr(data []byte, doRender bool) int { + if len(data) < 4 { + return 0 + } + if data[0] != '<' || (data[1] != 'h' && data[1] != 'H') || (data[2] != 'r' && data[2] != 'R') { + return 0 + } + if data[3] != ' ' && data[3] != '/' && data[3] != '>' { + // not an
    tag after all; at least not a valid one + return 0 + } + i := 3 + for i < len(data) && data[i] != '>' && data[i] != '\n' { + i++ + } + if i < len(data) && data[i] == '>' { + i++ + if j := p.isEmpty(data[i:]); j > 0 { + size := i + j + if doRender { + // trim newlines + end := backChar(data, size, '\n') + htmlBlock := &ast.HTMLBlock{ast.Leaf{Content: data[:end]}} + p.addBlock(htmlBlock) + finalizeHTMLBlock(htmlBlock) + } + return size + } + } + return 0 +} + +func (p *Parser) htmlFindTag(data []byte) (string, bool) { + i := skipAlnum(data, 0) + key := string(data[:i]) + if _, ok := blockTags[key]; ok { + return key, true + } + return "", false +} + +func (p *Parser) htmlFindEnd(tag string, data []byte) int { + // assume data[0] == '<' && data[1] == '/' already tested + if tag == "hr" { + return 2 + } + // check if tag is a match + closetag := []byte("") + if !bytes.HasPrefix(data, closetag) { + return 0 + } + i := len(closetag) + + // check that the rest of the line is blank + skip := 0 + if skip = p.isEmpty(data[i:]); skip == 0 { + return 0 + } + i += skip + skip = 0 + + if i >= len(data) { + return i + } + + if p.extensions&LaxHTMLBlocks != 0 { + return i + } + if skip = p.isEmpty(data[i:]); skip == 0 { + // following line must be blank + return 0 + } + + return i + skip +} + +func (*Parser) isEmpty(data []byte) int { + // it is okay to call isEmpty on an empty buffer + if len(data) == 0 { + return 0 + } + + var i int + for i = 0; i < len(data) && data[i] != '\n'; i++ { + if data[i] != ' ' && data[i] != '\t' { + return 0 + } + } + i = skipCharN(data, i, '\n', 1) + return i +} + +func (*Parser) isHRule(data []byte) bool { + i := 0 + + // skip up to three spaces + for i < 3 && data[i] == ' ' { + i++ + } + + // look at the hrule char + if data[i] != '*' && data[i] != '-' && data[i] != '_' { + return false + } + c := data[i] + + // the whole line must be the char or whitespace + n := 0 + for i < len(data) && data[i] != '\n' { + switch { + case data[i] == c: + n++ + case data[i] != ' ': + return false + } + i++ + } + + return n >= 3 +} + +// isFenceLine checks if there's a fence line (e.g., ``` or ``` go) at the beginning of data, +// and returns the end index if so, or 0 otherwise. It also returns the marker found. +// If syntax is not nil, it gets set to the syntax specified in the fence line. +func isFenceLine(data []byte, syntax *string, oldmarker string) (end int, marker string) { + i, size := 0, 0 + + n := len(data) + // skip up to three spaces + for i < n && i < 3 && data[i] == ' ' { + i++ + } + + // check for the marker characters: ~ or ` + if i >= n { + return 0, "" + } + if data[i] != '~' && data[i] != '`' { + return 0, "" + } + + c := data[i] + + // the whole line must be the same char or whitespace + for i < n && data[i] == c { + size++ + i++ + } + + // the marker char must occur at least 3 times + if size < 3 { + return 0, "" + } + marker = string(data[i-size : i]) + + // if this is the end marker, it must match the beginning marker + if oldmarker != "" && marker != oldmarker { + return 0, "" + } + + // TODO(shurcooL): It's probably a good idea to simplify the 2 code paths here + // into one, always get the syntax, and discard it if the caller doesn't care. + if syntax != nil { + syn := 0 + i = skipChar(data, i, ' ') + + if i >= n { + if i == n { + return i, marker + } + return 0, "" + } + + syntaxStart := i + + if data[i] == '{' { + i++ + syntaxStart++ + + for i < n && data[i] != '}' && data[i] != '\n' { + syn++ + i++ + } + + if i >= n || data[i] != '}' { + return 0, "" + } + + // strip all whitespace at the beginning and the end + // of the {} block + for syn > 0 && isSpace(data[syntaxStart]) { + syntaxStart++ + syn-- + } + + for syn > 0 && isSpace(data[syntaxStart+syn-1]) { + syn-- + } + + i++ + } else { + for i < n && !isSpace(data[i]) { + syn++ + i++ + } + } + + *syntax = string(data[syntaxStart : syntaxStart+syn]) + } + + i = skipChar(data, i, ' ') + if i >= n || data[i] != '\n' { + if i == n { + return i, marker + } + return 0, "" + } + return i + 1, marker // Take newline into account. +} + +// fencedCodeBlock returns the end index if data contains a fenced code block at the beginning, +// or 0 otherwise. It writes to out if doRender is true, otherwise it has no side effects. +// If doRender is true, a final newline is mandatory to recognize the fenced code block. +func (p *Parser) fencedCodeBlock(data []byte, doRender bool) int { + var syntax string + beg, marker := isFenceLine(data, &syntax, "") + if beg == 0 || beg >= len(data) { + return 0 + } + + var work bytes.Buffer + work.WriteString(syntax) + work.WriteByte('\n') + + for { + // safe to assume beg < len(data) + + // check for the end of the code block + fenceEnd, _ := isFenceLine(data[beg:], nil, marker) + if fenceEnd != 0 { + beg += fenceEnd + break + } + + // copy the current line + end := skipUntilChar(data, beg, '\n') + 1 + + // did we reach the end of the buffer without a closing marker? + if end >= len(data) { + return 0 + } + + // verbatim copy to the working buffer + if doRender { + work.Write(data[beg:end]) + } + beg = end + } + + if doRender { + codeBlock := &ast.CodeBlock{ + IsFenced: true, + } + codeBlock.Content = work.Bytes() // TODO: get rid of temp buffer + + if p.extensions&Mmark == 0 { + p.addBlock(codeBlock) + finalizeCodeBlock(codeBlock) + return beg + } + + // Check for caption and if found make it a figure. + if captionContent, id, consumed := p.caption(data[beg:], []byte("Figure: ")); consumed > 0 { + figure := &ast.CaptionFigure{} + caption := &ast.Caption{} + figure.HeadingID = id + p.Inline(caption, captionContent) + + p.addBlock(figure) + codeBlock.AsLeaf().Attribute = figure.AsContainer().Attribute + p.addChild(codeBlock) + finalizeCodeBlock(codeBlock) + p.addChild(caption) + p.finalize(figure) + + beg += consumed + + return beg + } + + // Still here, normal block + p.addBlock(codeBlock) + finalizeCodeBlock(codeBlock) + } + + return beg +} + +func unescapeChar(str []byte) []byte { + if str[0] == '\\' { + return []byte{str[1]} + } + return []byte(html.UnescapeString(string(str))) +} + +func unescapeString(str []byte) []byte { + if reBackslashOrAmp.Match(str) { + return reEntityOrEscapedChar.ReplaceAllFunc(str, unescapeChar) + } + return str +} + +func finalizeCodeBlock(code *ast.CodeBlock) { + c := code.Content + if code.IsFenced { + newlinePos := bytes.IndexByte(c, '\n') + firstLine := c[:newlinePos] + rest := c[newlinePos+1:] + code.Info = unescapeString(bytes.Trim(firstLine, "\n")) + code.Literal = rest + } else { + code.Literal = c + } + code.Content = nil +} + +func (p *Parser) table(data []byte) int { + i, columns, table := p.tableHeader(data) + if i == 0 { + return 0 + } + + p.addBlock(&ast.TableBody{}) + + for i < len(data) { + pipes, rowStart := 0, i + for ; i < len(data) && data[i] != '\n'; i++ { + if data[i] == '|' { + pipes++ + } + } + + if pipes == 0 { + i = rowStart + break + } + + // include the newline in data sent to tableRow + i = skipCharN(data, i, '\n', 1) + + if p.tableFooter(data[rowStart:i]) { + continue + } + + p.tableRow(data[rowStart:i], columns, false) + } + if captionContent, id, consumed := p.caption(data[i:], []byte("Table: ")); consumed > 0 { + caption := &ast.Caption{} + p.Inline(caption, captionContent) + + // Some switcheroo to re-insert the parsed table as a child of the captionfigure. + figure := &ast.CaptionFigure{} + figure.HeadingID = id + table2 := &ast.Table{} + // Retain any block level attributes. + table2.AsContainer().Attribute = table.AsContainer().Attribute + children := table.GetChildren() + ast.RemoveFromTree(table) + + table2.SetChildren(children) + ast.AppendChild(figure, table2) + ast.AppendChild(figure, caption) + + p.addChild(figure) + p.finalize(figure) + + i += consumed + } + + return i +} + +// check if the specified position is preceded by an odd number of backslashes +func isBackslashEscaped(data []byte, i int) bool { + backslashes := 0 + for i-backslashes-1 >= 0 && data[i-backslashes-1] == '\\' { + backslashes++ + } + return backslashes&1 == 1 +} + +// tableHeaders parses the header. If recognized it will also add a table. +func (p *Parser) tableHeader(data []byte) (size int, columns []ast.CellAlignFlags, table ast.Node) { + i := 0 + colCount := 1 + for i = 0; i < len(data) && data[i] != '\n'; i++ { + if data[i] == '|' && !isBackslashEscaped(data, i) { + colCount++ + } + } + + // doesn't look like a table header + if colCount == 1 { + return + } + + // include the newline in the data sent to tableRow + j := skipCharN(data, i, '\n', 1) + header := data[:j] + + // column count ignores pipes at beginning or end of line + if data[0] == '|' { + colCount-- + } + if i > 2 && data[i-1] == '|' && !isBackslashEscaped(data, i-1) { + colCount-- + } + + columns = make([]ast.CellAlignFlags, colCount) + + // move on to the header underline + i++ + if i >= len(data) { + return + } + + if data[i] == '|' && !isBackslashEscaped(data, i) { + i++ + } + i = skipChar(data, i, ' ') + + // each column header is of form: / *:?-+:? *|/ with # dashes + # colons >= 3 + // and trailing | optional on last column + col := 0 + n := len(data) + for i < n && data[i] != '\n' { + dashes := 0 + + if data[i] == ':' { + i++ + columns[col] |= ast.TableAlignmentLeft + dashes++ + } + for i < n && data[i] == '-' { + i++ + dashes++ + } + if i < n && data[i] == ':' { + i++ + columns[col] |= ast.TableAlignmentRight + dashes++ + } + for i < n && data[i] == ' ' { + i++ + } + if i == n { + return + } + // end of column test is messy + switch { + case dashes < 3: + // not a valid column + return + + case data[i] == '|' && !isBackslashEscaped(data, i): + // marker found, now skip past trailing whitespace + col++ + i++ + for i < n && data[i] == ' ' { + i++ + } + + // trailing junk found after last column + if col >= colCount && i < len(data) && data[i] != '\n' { + return + } + + case (data[i] != '|' || isBackslashEscaped(data, i)) && col+1 < colCount: + // something else found where marker was required + return + + case data[i] == '\n': + // marker is optional for the last column + col++ + + default: + // trailing junk found after last column + return + } + } + if col != colCount { + return + } + + table = &ast.Table{} + p.addBlock(table) + p.addBlock(&ast.TableHeader{}) + p.tableRow(header, columns, true) + size = skipCharN(data, i, '\n', 1) + return +} + +func (p *Parser) tableRow(data []byte, columns []ast.CellAlignFlags, header bool) { + p.addBlock(&ast.TableRow{}) + i, col := 0, 0 + + if data[i] == '|' && !isBackslashEscaped(data, i) { + i++ + } + + n := len(data) + for col = 0; col < len(columns) && i < n; col++ { + for i < n && data[i] == ' ' { + i++ + } + + cellStart := i + + for i < n && (data[i] != '|' || isBackslashEscaped(data, i)) && data[i] != '\n' { + i++ + } + + cellEnd := i + + // skip the end-of-cell marker, possibly taking us past end of buffer + i++ + + for cellEnd > cellStart && cellEnd-1 < n && data[cellEnd-1] == ' ' { + cellEnd-- + } + + block := &ast.TableCell{ + IsHeader: header, + Align: columns[col], + } + block.Content = data[cellStart:cellEnd] + p.addBlock(block) + } + + // pad it out with empty columns to get the right number + for ; col < len(columns); col++ { + block := &ast.TableCell{ + IsHeader: header, + Align: columns[col], + } + p.addBlock(block) + } + + // silently ignore rows with too many cells +} + +// tableFooter parses the (optional) table footer. +func (p *Parser) tableFooter(data []byte) bool { + colCount := 1 + for i := 0; i < len(data) && data[i] != '\n'; i++ { + if data[i] == '|' && !isBackslashEscaped(data, i) { + colCount++ + continue + } + // remaining data must be the = character + if data[i] != '=' { + return false + } + } + + // doesn't look like a table footer + if colCount == 1 { + return false + } + + p.addBlock(&ast.TableFooter{}) + + return true +} + +// returns blockquote prefix length +func (p *Parser) quotePrefix(data []byte) int { + i := 0 + n := len(data) + for i < 3 && i < n && data[i] == ' ' { + i++ + } + if i < n && data[i] == '>' { + if i+1 < n && data[i+1] == ' ' { + return i + 2 + } + return i + 1 + } + return 0 +} + +// blockquote ends with at least one blank line +// followed by something without a blockquote prefix +func (p *Parser) terminateBlockquote(data []byte, beg, end int) bool { + if p.isEmpty(data[beg:]) <= 0 { + return false + } + if end >= len(data) { + return true + } + return p.quotePrefix(data[end:]) == 0 && p.isEmpty(data[end:]) == 0 +} + +// parse a blockquote fragment +func (p *Parser) quote(data []byte) int { + var raw bytes.Buffer + beg, end := 0, 0 + for beg < len(data) { + end = beg + // Step over whole lines, collecting them. While doing that, check for + // fenced code and if one's found, incorporate it altogether, + // irregardless of any contents inside it + for end < len(data) && data[end] != '\n' { + if p.extensions&FencedCode != 0 { + if i := p.fencedCodeBlock(data[end:], false); i > 0 { + // -1 to compensate for the extra end++ after the loop: + end += i - 1 + break + } + } + end++ + } + end = skipCharN(data, end, '\n', 1) + if pre := p.quotePrefix(data[beg:]); pre > 0 { + // skip the prefix + beg += pre + } else if p.terminateBlockquote(data, beg, end) { + break + } + // this line is part of the blockquote + raw.Write(data[beg:end]) + beg = end + } + + if p.extensions&Mmark == 0 { + block := p.addBlock(&ast.BlockQuote{}) + p.block(raw.Bytes()) + p.finalize(block) + return end + } + + if captionContent, id, consumed := p.caption(data[end:], []byte("Quote: ")); consumed > 0 { + figure := &ast.CaptionFigure{} + caption := &ast.Caption{} + figure.HeadingID = id + p.Inline(caption, captionContent) + + p.addBlock(figure) // this discard any attributes + block := &ast.BlockQuote{} + block.AsContainer().Attribute = figure.AsContainer().Attribute + p.addChild(block) + p.block(raw.Bytes()) + p.finalize(block) + + p.addChild(caption) + p.finalize(figure) + + end += consumed + + return end + } + + block := p.addBlock(&ast.BlockQuote{}) + p.block(raw.Bytes()) + p.finalize(block) + + return end +} + +// returns prefix length for block code +func (p *Parser) codePrefix(data []byte) int { + n := len(data) + if n >= 1 && data[0] == '\t' { + return 1 + } + if n >= 4 && data[3] == ' ' && data[2] == ' ' && data[1] == ' ' && data[0] == ' ' { + return 4 + } + return 0 +} + +func (p *Parser) code(data []byte) int { + var work bytes.Buffer + + i := 0 + for i < len(data) { + beg := i + + i = skipUntilChar(data, i, '\n') + i = skipCharN(data, i, '\n', 1) + + blankline := p.isEmpty(data[beg:i]) > 0 + if pre := p.codePrefix(data[beg:i]); pre > 0 { + beg += pre + } else if !blankline { + // non-empty, non-prefixed line breaks the pre + i = beg + break + } + + // verbatim copy to the working buffer + if blankline { + work.WriteByte('\n') + } else { + work.Write(data[beg:i]) + } + } + + // trim all the \n off the end of work + workbytes := work.Bytes() + + eol := backChar(workbytes, len(workbytes), '\n') + + if eol != len(workbytes) { + work.Truncate(eol) + } + + work.WriteByte('\n') + + codeBlock := &ast.CodeBlock{ + IsFenced: false, + } + // TODO: get rid of temp buffer + codeBlock.Content = work.Bytes() + p.addBlock(codeBlock) + finalizeCodeBlock(codeBlock) + + return i +} + +// returns unordered list item prefix +func (p *Parser) uliPrefix(data []byte) int { + // start with up to 3 spaces + i := skipCharN(data, 0, ' ', 3) + + if i >= len(data)-1 { + return 0 + } + // need one of {'*', '+', '-'} followed by a space or a tab + if (data[i] != '*' && data[i] != '+' && data[i] != '-') || + (data[i+1] != ' ' && data[i+1] != '\t') { + return 0 + } + return i + 2 +} + +// returns ordered list item prefix +func (p *Parser) oliPrefix(data []byte) int { + // start with up to 3 spaces + i := skipCharN(data, 0, ' ', 3) + + // count the digits + start := i + for i < len(data) && data[i] >= '0' && data[i] <= '9' { + i++ + } + if start == i || i >= len(data)-1 { + return 0 + } + + // we need >= 1 digits followed by a dot and a space or a tab + if data[i] != '.' || !(data[i+1] == ' ' || data[i+1] == '\t') { + return 0 + } + return i + 2 +} + +// returns definition list item prefix +func (p *Parser) dliPrefix(data []byte) int { + if len(data) < 2 { + return 0 + } + // need a ':' followed by a space or a tab + if data[0] != ':' || !(data[1] == ' ' || data[1] == '\t') { + return 0 + } + i := skipChar(data, 0, ' ') + return i + 2 +} + +// parse ordered or unordered list block +func (p *Parser) list(data []byte, flags ast.ListType, start int) int { + i := 0 + flags |= ast.ListItemBeginningOfList + list := &ast.List{ + ListFlags: flags, + Tight: true, + Start: start, + } + block := p.addBlock(list) + + for i < len(data) { + skip := p.listItem(data[i:], &flags) + if flags&ast.ListItemContainsBlock != 0 { + list.Tight = false + } + i += skip + if skip == 0 || flags&ast.ListItemEndOfList != 0 { + break + } + flags &= ^ast.ListItemBeginningOfList + } + + above := block.GetParent() + finalizeList(list) + p.tip = above + return i +} + +// Returns true if the list item is not the same type as its parent list +func (p *Parser) listTypeChanged(data []byte, flags *ast.ListType) bool { + if p.dliPrefix(data) > 0 && *flags&ast.ListTypeDefinition == 0 { + return true + } else if p.oliPrefix(data) > 0 && *flags&ast.ListTypeOrdered == 0 { + return true + } else if p.uliPrefix(data) > 0 && (*flags&ast.ListTypeOrdered != 0 || *flags&ast.ListTypeDefinition != 0) { + return true + } + return false +} + +// Returns true if block ends with a blank line, descending if needed +// into lists and sublists. +func endsWithBlankLine(block ast.Node) bool { + // TODO: figure this out. Always false now. + for block != nil { + //if block.lastLineBlank { + //return true + //} + switch block.(type) { + case *ast.List, *ast.ListItem: + block = ast.GetLastChild(block) + default: + return false + } + } + return false +} + +func finalizeList(list *ast.List) { + items := list.Parent.GetChildren() + lastItemIdx := len(items) - 1 + for i, item := range items { + isLastItem := i == lastItemIdx + // check for non-final list item ending with blank line: + if !isLastItem && endsWithBlankLine(item) { + list.Tight = false + break + } + // recurse into children of list item, to see if there are spaces + // between any of them: + subItems := item.GetParent().GetChildren() + lastSubItemIdx := len(subItems) - 1 + for j, subItem := range subItems { + isLastSubItem := j == lastSubItemIdx + if (!isLastItem || !isLastSubItem) && endsWithBlankLine(subItem) { + list.Tight = false + break + } + } + } +} + +// Parse a single list item. +// Assumes initial prefix is already removed if this is a sublist. +func (p *Parser) listItem(data []byte, flags *ast.ListType) int { + // keep track of the indentation of the first line + itemIndent := 0 + if data[0] == '\t' { + itemIndent += 4 + } else { + for itemIndent < 3 && data[itemIndent] == ' ' { + itemIndent++ + } + } + + var bulletChar byte = '*' + i := p.uliPrefix(data) + if i == 0 { + i = p.oliPrefix(data) + } else { + bulletChar = data[i-2] + } + if i == 0 { + i = p.dliPrefix(data) + // reset definition term flag + if i > 0 { + *flags &= ^ast.ListTypeTerm + } + } + if i == 0 { + // if in definition list, set term flag and continue + if *flags&ast.ListTypeDefinition != 0 { + *flags |= ast.ListTypeTerm + } else { + return 0 + } + } + + // skip leading whitespace on first line + i = skipChar(data, i, ' ') + + // find the end of the line + line := i + for i > 0 && i < len(data) && data[i-1] != '\n' { + i++ + } + + // get working buffer + var raw bytes.Buffer + + // put the first line into the working buffer + raw.Write(data[line:i]) + line = i + + // process the following lines + containsBlankLine := false + sublist := 0 + +gatherlines: + for line < len(data) { + i++ + + // find the end of this line + for i < len(data) && data[i-1] != '\n' { + i++ + } + + // if it is an empty line, guess that it is part of this item + // and move on to the next line + if p.isEmpty(data[line:i]) > 0 { + containsBlankLine = true + line = i + continue + } + + // calculate the indentation + indent := 0 + indentIndex := 0 + if data[line] == '\t' { + indentIndex++ + indent += 4 + } else { + for indent < 4 && line+indent < i && data[line+indent] == ' ' { + indent++ + indentIndex++ + } + } + + chunk := data[line+indentIndex : i] + + // evaluate how this line fits in + switch { + // is this a nested list item? + case (p.uliPrefix(chunk) > 0 && !p.isHRule(chunk)) || p.oliPrefix(chunk) > 0 || p.dliPrefix(chunk) > 0: + + // to be a nested list, it must be indented more + // if not, it is either a different kind of list + // or the next item in the same list + if indent <= itemIndent { + if p.listTypeChanged(chunk, flags) { + *flags |= ast.ListItemEndOfList + } else if containsBlankLine { + *flags |= ast.ListItemContainsBlock + } + + break gatherlines + } + + if containsBlankLine { + *flags |= ast.ListItemContainsBlock + } + + // is this the first item in the nested list? + if sublist == 0 { + sublist = raw.Len() + // in the case of dliPrefix we are too late and need to search back for the definition item, which + // should be on the previous line, we then adjust sublist to start there. + if p.dliPrefix(chunk) > 0 { + sublist = backUntilChar(raw.Bytes(), raw.Len()-1, '\n') + } + } + + // is this a nested prefix heading? + case p.isPrefixHeading(chunk), p.isPrefixSpecialHeading(chunk): + // if the heading is not indented, it is not nested in the list + // and thus ends the list + if containsBlankLine && indent < 4 { + *flags |= ast.ListItemEndOfList + break gatherlines + } + *flags |= ast.ListItemContainsBlock + + // anything following an empty line is only part + // of this item if it is indented 4 spaces + // (regardless of the indentation of the beginning of the item) + case containsBlankLine && indent < 4: + if *flags&ast.ListTypeDefinition != 0 && i < len(data)-1 { + // is the next item still a part of this list? + next := i + for next < len(data) && data[next] != '\n' { + next++ + } + for next < len(data)-1 && data[next] == '\n' { + next++ + } + if i < len(data)-1 && data[i] != ':' && next < len(data)-1 && data[next] != ':' { + *flags |= ast.ListItemEndOfList + } + } else { + *flags |= ast.ListItemEndOfList + } + break gatherlines + + // a blank line means this should be parsed as a block + case containsBlankLine: + raw.WriteByte('\n') + *flags |= ast.ListItemContainsBlock + } + + // if this line was preceded by one or more blanks, + // re-introduce the blank into the buffer + if containsBlankLine { + containsBlankLine = false + raw.WriteByte('\n') + } + + // add the line into the working buffer without prefix + raw.Write(data[line+indentIndex : i]) + + line = i + } + + rawBytes := raw.Bytes() + + listItem := &ast.ListItem{ + ListFlags: *flags, + Tight: false, + BulletChar: bulletChar, + Delimiter: '.', // Only '.' is possible in Markdown, but ')' will also be possible in CommonMark + } + p.addBlock(listItem) + + // render the contents of the list item + if *flags&ast.ListItemContainsBlock != 0 && *flags&ast.ListTypeTerm == 0 { + // intermediate render of block item, except for definition term + if sublist > 0 { + p.block(rawBytes[:sublist]) + p.block(rawBytes[sublist:]) + } else { + p.block(rawBytes) + } + } else { + // intermediate render of inline item + para := &ast.Paragraph{} + if sublist > 0 { + para.Content = rawBytes[:sublist] + } else { + para.Content = rawBytes + } + p.addChild(para) + if sublist > 0 { + p.block(rawBytes[sublist:]) + } + } + return line +} + +// render a single paragraph that has already been parsed out +func (p *Parser) renderParagraph(data []byte) { + if len(data) == 0 { + return + } + + // trim leading spaces + beg := skipChar(data, 0, ' ') + + end := len(data) + // trim trailing newline + if data[len(data)-1] == '\n' { + end-- + } + + // trim trailing spaces + for end > beg && data[end-1] == ' ' { + end-- + } + para := &ast.Paragraph{} + para.Content = data[beg:end] + p.addBlock(para) +} + +// blockMath handle block surround with $$ +func (p *Parser) blockMath(data []byte) int { + if len(data) <= 4 || data[0] != '$' || data[1] != '$' || data[2] == '$' { + return 0 + } + + // find next $$ + var end int + for end = 2; end+1 < len(data) && (data[end] != '$' || data[end+1] != '$'); end++ { + } + + // $$ not match + if end+1 == len(data) { + return 0 + } + + // render the display math + mathBlock := &ast.MathBlock{} + mathBlock.Literal = data[2:end] + p.addBlock(mathBlock) + + return end + 2 +} + +func (p *Parser) paragraph(data []byte) int { + // prev: index of 1st char of previous line + // line: index of 1st char of current line + // i: index of cursor/end of current line + var prev, line, i int + tabSize := tabSizeDefault + if p.extensions&TabSizeEight != 0 { + tabSize = tabSizeDouble + } + // keep going until we find something to mark the end of the paragraph + for i < len(data) { + // mark the beginning of the current line + prev = line + current := data[i:] + line = i + + // did we find a reference or a footnote? If so, end a paragraph + // preceding it and report that we have consumed up to the end of that + // reference: + if refEnd := isReference(p, current, tabSize); refEnd > 0 { + p.renderParagraph(data[:i]) + return i + refEnd + } + + // did we find a blank line marking the end of the paragraph? + if n := p.isEmpty(current); n > 0 { + // did this blank line followed by a definition list item? + if p.extensions&DefinitionLists != 0 { + if i < len(data)-1 && data[i+1] == ':' { + listLen := p.list(data[prev:], ast.ListTypeDefinition, 0) + return prev + listLen + } + } + + p.renderParagraph(data[:i]) + return i + n + } + + // an underline under some text marks a heading, so our paragraph ended on prev line + if i > 0 { + if level := p.isUnderlinedHeading(current); level > 0 { + // render the paragraph + p.renderParagraph(data[:prev]) + + // ignore leading and trailing whitespace + eol := i - 1 + for prev < eol && data[prev] == ' ' { + prev++ + } + for eol > prev && data[eol-1] == ' ' { + eol-- + } + + id := "" + if p.extensions&AutoHeadingIDs != 0 { + id = sanitizeAnchorName(string(data[prev:eol])) + } + + block := &ast.Heading{ + Level: level, + HeadingID: id, + } + block.Content = data[prev:eol] + p.addBlock(block) + + // find the end of the underline + return skipUntilChar(data, i, '\n') + } + } + + // if the next line starts a block of HTML, then the paragraph ends here + if p.extensions&LaxHTMLBlocks != 0 { + if data[i] == '<' && p.html(current, false) > 0 { + // rewind to before the HTML block + p.renderParagraph(data[:i]) + return i + } + } + + // if there's a prefixed heading or a horizontal rule after this, paragraph is over + if p.isPrefixHeading(current) || p.isPrefixSpecialHeading(current) || p.isHRule(current) { + p.renderParagraph(data[:i]) + return i + } + + // if there's a fenced code block, paragraph is over + if p.extensions&FencedCode != 0 { + if p.fencedCodeBlock(current, false) > 0 { + p.renderParagraph(data[:i]) + return i + } + } + + // if there's a figure block, paragraph is over + if p.extensions&Mmark != 0 { + if p.figureBlock(current, false) > 0 { + p.renderParagraph(data[:i]) + return i + } + } + + // if there's a definition list item, prev line is a definition term + if p.extensions&DefinitionLists != 0 { + if p.dliPrefix(current) != 0 { + ret := p.list(data[prev:], ast.ListTypeDefinition, 0) + return ret + prev + } + } + + // if there's a list after this, paragraph is over + if p.extensions&NoEmptyLineBeforeBlock != 0 { + if p.uliPrefix(current) != 0 || + p.oliPrefix(current) != 0 || + p.quotePrefix(current) != 0 || + p.codePrefix(current) != 0 { + p.renderParagraph(data[:i]) + return i + } + } + + // otherwise, scan to the beginning of the next line + nl := bytes.IndexByte(data[i:], '\n') + if nl >= 0 { + i += nl + 1 + } else { + i += len(data[i:]) + } + } + + p.renderParagraph(data[:i]) + return i +} + +// skipChar advances i as long as data[i] == c +func skipChar(data []byte, i int, c byte) int { + n := len(data) + for i < n && data[i] == c { + i++ + } + return i +} + +// like skipChar but only skips up to max characters +func skipCharN(data []byte, i int, c byte, max int) int { + n := len(data) + for i < n && max > 0 && data[i] == c { + i++ + max-- + } + return i +} + +// skipUntilChar advances i as long as data[i] != c +func skipUntilChar(data []byte, i int, c byte) int { + n := len(data) + for i < n && data[i] != c { + i++ + } + return i +} + +func skipAlnum(data []byte, i int) int { + n := len(data) + for i < n && isAlnum(data[i]) { + i++ + } + return i +} + +func skipSpace(data []byte, i int) int { + n := len(data) + for i < n && isSpace(data[i]) { + i++ + } + return i +} + +func backChar(data []byte, i int, c byte) int { + for i > 0 && data[i-1] == c { + i-- + } + return i +} + +func backUntilChar(data []byte, i int, c byte) int { + for i > 0 && data[i-1] != c { + i-- + } + return i +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/callout.go b/vendor/github.com/gomarkdown/markdown/parser/callout.go new file mode 100644 index 000000000..15858aa97 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/callout.go @@ -0,0 +1,29 @@ +package parser + +import ( + "bytes" + "strconv" +) + +// IsCallout detects a callout in the following format: <> Where N is a integer > 0. +func IsCallout(data []byte) (id []byte, consumed int) { + if !bytes.HasPrefix(data, []byte("<<")) { + return nil, 0 + } + start := 2 + end := bytes.Index(data[start:], []byte(">>")) + if end < 0 { + return nil, 0 + } + + b := data[start : start+end] + b = bytes.TrimSpace(b) + i, err := strconv.Atoi(string(b)) + if err != nil { + return nil, 0 + } + if i <= 0 { + return nil, 0 + } + return b, start + end + 2 // 2 for >> +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/caption.go b/vendor/github.com/gomarkdown/markdown/parser/caption.go new file mode 100644 index 000000000..54d3f741f --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/caption.go @@ -0,0 +1,70 @@ +package parser + +import ( + "bytes" +) + +// caption checks for a caption, it returns the caption data and a potential "headingID". +func (p *Parser) caption(data, caption []byte) ([]byte, string, int) { + if !bytes.HasPrefix(data, caption) { + return nil, "", 0 + } + j := len(caption) + data = data[j:] + end := p.linesUntilEmpty(data) + + data = data[:end] + + id, start := captionID(data) + if id != "" { + return data[:start], id, end + j + } + + return data, "", end + j +} + +// linesUntilEmpty scans lines up to the first empty line. +func (p *Parser) linesUntilEmpty(data []byte) int { + line, i := 0, 0 + + for line < len(data) { + i++ + + // find the end of this line + for i < len(data) && data[i-1] != '\n' { + i++ + } + + if p.isEmpty(data[line:i]) == 0 { + line = i + continue + } + + break + } + return i +} + +// captionID checks if the caption *ends* in {#....}. If so the text after {# is taken to be +// the ID/anchor of the entire figure block. +func captionID(data []byte) (string, int) { + end := len(data) + + j, k := 0, 0 + // find start/end of heading id + for j = 0; j < end-1 && (data[j] != '{' || data[j+1] != '#'); j++ { + } + for k = j + 1; k < end && data[k] != '}'; k++ { + } + // remains must be whitespace. + for l := k + 1; l < end; l++ { + if !isSpace(data[l]) { + return "", 0 + } + } + + if j > 0 && k > 0 && j+2 < k { + return string(data[j+2 : k]), j + } + return "", 0 +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/citation.go b/vendor/github.com/gomarkdown/markdown/parser/citation.go new file mode 100644 index 000000000..8ea1fbeee --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/citation.go @@ -0,0 +1,86 @@ +package parser + +import ( + "bytes" + + "github.com/gomarkdown/markdown/ast" +) + +// citation parses a citation. In its most simple form [@ref], we allow multiple +// being separated by semicolons and a sub reference inside ala pandoc: [@ref, p. 23]. +// Each citation can have a modifier: !, ? or - wich mean: +// +// ! - normative +// ? - formative +// - - suppressed +// +// The suffix starts after a comma, we strip any whitespace before and after. If the output +// allows for it, this can be rendered. +func citation(p *Parser, data []byte, offset int) (int, ast.Node) { + // look for the matching closing bracket + i := offset + 1 + for level := 1; level > 0 && i < len(data); i++ { + switch { + case data[i] == '\n': + // no newlines allowed. + return 0, nil + + case data[i-1] == '\\': + continue + + case data[i] == '[': + level++ + + case data[i] == ']': + level-- + if level <= 0 { + i-- // compensate for extra i++ in for loop + } + } + } + + if i >= len(data) { + return 0, nil + } + + node := &ast.Citation{} + + citations := bytes.Split(data[1:i], []byte(";")) + for _, citation := range citations { + var suffix []byte + citation = bytes.TrimSpace(citation) + j := 0 + if citation[j] != '@' { + // not a citation, drop out entirely. + return 0, nil + } + if c := bytes.Index(citation, []byte(",")); c > 0 { + part := citation[:c] + suff := citation[c+1:] + part = bytes.TrimSpace(part) + suff = bytes.TrimSpace(suff) + + citation = part + suffix = suff + } + + citeType := ast.CitationTypeInformative + j = 1 + switch citation[j] { + case '!': + citeType = ast.CitationTypeNormative + j++ + case '?': + citeType = ast.CitationTypeInformative + j++ + case '-': + citeType = ast.CitationTypeSuppressed + j++ + } + node.Destination = append(node.Destination, citation[j:]) + node.Type = append(node.Type, citeType) + node.Suffix = append(node.Suffix, suffix) + } + + return i + 1, node +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/esc.go b/vendor/github.com/gomarkdown/markdown/parser/esc.go new file mode 100644 index 000000000..0a79aa35e --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/esc.go @@ -0,0 +1,20 @@ +package parser + +// isEscape returns true if byte i is prefixed by an odd number of backslahses. +func isEscape(data []byte, i int) bool { + if i == 0 { + return false + } + if i == 1 { + return data[0] == '\\' + } + j := i - 1 + for ; j >= 0; j-- { + if data[j] != '\\' { + break + } + } + j++ + // odd number of backslahes means escape + return (i-j)%2 != 0 +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/figures.go b/vendor/github.com/gomarkdown/markdown/parser/figures.go new file mode 100644 index 000000000..6615449cf --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/figures.go @@ -0,0 +1,119 @@ +package parser + +import ( + "bytes" + + "github.com/gomarkdown/markdown/ast" +) + +// sFigureLine checks if there's a figure line (e.g., !--- ) at the beginning of data, +// and returns the end index if so, or 0 otherwise. +func sFigureLine(data []byte, oldmarker string) (end int, marker string) { + i, size := 0, 0 + + n := len(data) + // skip up to three spaces + for i < n && i < 3 && data[i] == ' ' { + i++ + } + + // check for the marker characters: ! + if i+1 >= n { + return 0, "" + } + if data[i] != '!' || data[i+1] != '-' { + return 0, "" + } + i++ + + c := data[i] // i.e. the - + + // the whole line must be the same char or whitespace + for i < n && data[i] == c { + size++ + i++ + } + + // the marker char must occur at least 3 times + if size < 3 { + return 0, "" + } + marker = string(data[i-size : i]) + + // if this is the end marker, it must match the beginning marker + if oldmarker != "" && marker != oldmarker { + return 0, "" + } + + // there is no syntax modifier although it might be an idea to re-use this space for something? + + i = skipChar(data, i, ' ') + if i >= n || data[i] != '\n' { + if i == n { + return i, marker + } + return 0, "" + } + return i + 1, marker // Take newline into account. +} + +// figureBlock returns the end index if data contains a figure block at the beginning, +// or 0 otherwise. It writes to out if doRender is true, otherwise it has no side effects. +// If doRender is true, a final newline is mandatory to recognize the figure block. +func (p *Parser) figureBlock(data []byte, doRender bool) int { + beg, marker := sFigureLine(data, "") + if beg == 0 || beg >= len(data) { + return 0 + } + + var raw bytes.Buffer + + for { + // safe to assume beg < len(data) + + // check for the end of the code block + figEnd, _ := sFigureLine(data[beg:], marker) + if figEnd != 0 { + beg += figEnd + break + } + + // copy the current line + end := skipUntilChar(data, beg, '\n') + 1 + + // did we reach the end of the buffer without a closing marker? + if end >= len(data) { + return 0 + } + + // verbatim copy to the working buffer + if doRender { + raw.Write(data[beg:end]) + } + beg = end + } + + if !doRender { + return beg + } + + figure := &ast.CaptionFigure{} + p.addBlock(figure) + p.block(raw.Bytes()) + + defer p.finalize(figure) + + if captionContent, id, consumed := p.caption(data[beg:], []byte("Figure: ")); consumed > 0 { + caption := &ast.Caption{} + p.Inline(caption, captionContent) + + figure.HeadingID = id + + p.addChild(caption) + + beg += consumed + } + + p.finalize(figure) + return beg +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/include.go b/vendor/github.com/gomarkdown/markdown/parser/include.go new file mode 100644 index 000000000..2448a6854 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/include.go @@ -0,0 +1,129 @@ +package parser + +import ( + "bytes" + "path" + "path/filepath" +) + +// isInclude parses {{...}}[...], that contains a path between the {{, the [...] syntax contains +// an address to select which lines to include. It is treated as an opaque string and just given +// to readInclude. +func (p *Parser) isInclude(data []byte) (filename string, address []byte, consumed int) { + i := skipCharN(data, 0, ' ', 3) // start with up to 3 spaces + if len(data[i:]) < 3 { + return "", nil, 0 + } + if data[i] != '{' || data[i+1] != '{' { + return "", nil, 0 + } + start := i + 2 + + // find the end delimiter + i = skipUntilChar(data, i, '}') + if i+1 >= len(data) { + return "", nil, 0 + } + end := i + i++ + if data[i] != '}' { + return "", nil, 0 + } + filename = string(data[start:end]) + + if i+1 < len(data) && data[i+1] == '[' { // potential address specification + start := i + 2 + + end = skipUntilChar(data, start, ']') + if end >= len(data) { + return "", nil, 0 + } + address = data[start:end] + return filename, address, end + 1 + } + + return filename, address, i + 1 +} + +func (p *Parser) readInclude(from, file string, address []byte) []byte { + if p.Opts.ReadIncludeFn != nil { + return p.Opts.ReadIncludeFn(from, file, address) + } + + return nil +} + +// isCodeInclude parses <{{...}} which is similar to isInclude the returned bytes are, however wrapped in a code block. +func (p *Parser) isCodeInclude(data []byte) (filename string, address []byte, consumed int) { + i := skipCharN(data, 0, ' ', 3) // start with up to 3 spaces + if len(data[i:]) < 3 { + return "", nil, 0 + } + if data[i] != '<' { + return "", nil, 0 + } + start := i + + filename, address, consumed = p.isInclude(data[i+1:]) + if consumed == 0 { + return "", nil, 0 + } + return filename, address, start + consumed + 1 +} + +// readCodeInclude acts like include except the returned bytes are wrapped in a fenced code block. +func (p *Parser) readCodeInclude(from, file string, address []byte) []byte { + data := p.readInclude(from, file, address) + if data == nil { + return nil + } + ext := path.Ext(file) + buf := &bytes.Buffer{} + buf.Write([]byte("```")) + if ext != "" { // starts with a dot + buf.WriteString(" " + ext[1:] + "\n") + } else { + buf.WriteByte('\n') + } + buf.Write(data) + buf.WriteString("```\n") + return buf.Bytes() +} + +// incStack hold the current stack of chained includes. Each value is the containing +// path of the file being parsed. +type incStack struct { + stack []string +} + +func newIncStack() *incStack { + return &incStack{stack: []string{}} +} + +// Push updates i with new. +func (i *incStack) Push(new string) { + if path.IsAbs(new) { + i.stack = append(i.stack, path.Dir(new)) + return + } + last := "" + if len(i.stack) > 0 { + last = i.stack[len(i.stack)-1] + } + i.stack = append(i.stack, path.Dir(filepath.Join(last, new))) +} + +// Pop pops the last value. +func (i *incStack) Pop() { + if len(i.stack) == 0 { + return + } + i.stack = i.stack[:len(i.stack)-1] +} + +func (i *incStack) Last() string { + if len(i.stack) == 0 { + return "" + } + return i.stack[len(i.stack)-1] +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/inline.go b/vendor/github.com/gomarkdown/markdown/parser/inline.go new file mode 100644 index 000000000..81766b85e --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/inline.go @@ -0,0 +1,1284 @@ +package parser + +import ( + "bytes" + "regexp" + "strconv" + + "github.com/gomarkdown/markdown/ast" +) + +// Parsing of inline elements + +var ( + urlRe = `((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+` + anchorRe = regexp.MustCompile(`^(]+")?\s?>` + urlRe + `<\/a>)`) + + // TODO: improve this regexp to catch all possible entities: + htmlEntityRe = regexp.MustCompile(`&[a-z]{2,5};`) +) + +// Inline parses text within a block. +// Each function returns the number of consumed chars. +func (p *Parser) Inline(currBlock ast.Node, data []byte) { + // handlers might call us recursively: enforce a maximum depth + if p.nesting >= p.maxNesting || len(data) == 0 { + return + } + p.nesting++ + beg, end := 0, 0 + + n := len(data) + for end < n { + handler := p.inlineCallback[data[end]] + if handler == nil { + end++ + continue + } + consumed, node := handler(p, data, end) + if consumed == 0 { + // no action from the callback + end++ + continue + } + // copy inactive chars into the output + ast.AppendChild(currBlock, newTextNode(data[beg:end])) + if node != nil { + ast.AppendChild(currBlock, node) + } + beg = end + consumed + end = beg + } + + if beg < n { + if data[end-1] == '\n' { + end-- + } + ast.AppendChild(currBlock, newTextNode(data[beg:end])) + } + p.nesting-- +} + +// single and double emphasis parsing +func emphasis(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + c := data[0] + + n := len(data) + if n > 2 && data[1] != c { + // whitespace cannot follow an opening emphasis; + // strikethrough only takes two characters '~~' + if isSpace(data[1]) { + return 0, nil + } + if p.extensions&SuperSubscript != 0 && c == '~' { + // potential subscript, no spaces, except when escaped, helperEmphasis does + // not check that for us, so walk the bytes and check. + ret := skipUntilChar(data[1:], 0, c) + if ret == 0 { + return 0, nil + } + ret++ // we started with data[1:] above. + for i := 1; i < ret; i++ { + if isSpace(data[i]) && !isEscape(data, i) { + return 0, nil + } + } + sub := &ast.Subscript{} + sub.Literal = data[1:ret] + return ret + 1, sub + } + ret, node := helperEmphasis(p, data[1:], c) + if ret == 0 { + return 0, nil + } + + return ret + 1, node + } + + if n > 3 && data[1] == c && data[2] != c { + if isSpace(data[2]) { + return 0, nil + } + ret, node := helperDoubleEmphasis(p, data[2:], c) + if ret == 0 { + return 0, nil + } + + return ret + 2, node + } + + if n > 4 && data[1] == c && data[2] == c && data[3] != c { + if c == '~' || isSpace(data[3]) { + return 0, nil + } + ret, node := helperTripleEmphasis(p, data, 3, c) + if ret == 0 { + return 0, nil + } + + return ret + 3, node + } + + return 0, nil +} + +func codeSpan(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + + // count the number of backticks in the delimiter + nb := skipChar(data, 0, '`') + + // find the next delimiter + i, end := 0, 0 + for end = nb; end < len(data) && i < nb; end++ { + if data[end] == '`' { + i++ + } else { + i = 0 + } + } + + // no matching delimiter? + if i < nb && end >= len(data) { + return 0, nil + } + + // trim outside whitespace + fBegin := nb + for fBegin < end && data[fBegin] == ' ' { + fBegin++ + } + + fEnd := end - nb + for fEnd > fBegin && data[fEnd-1] == ' ' { + fEnd-- + } + + // render the code span + if fBegin != fEnd { + code := &ast.Code{} + code.Literal = data[fBegin:fEnd] + return end, code + } + + return end, nil +} + +// newline preceded by two spaces becomes
    +func maybeLineBreak(p *Parser, data []byte, offset int) (int, ast.Node) { + origOffset := offset + offset = skipChar(data, offset, ' ') + + if offset < len(data) && data[offset] == '\n' { + if offset-origOffset >= 2 { + return offset - origOffset + 1, &ast.Hardbreak{} + } + return offset - origOffset, nil + } + return 0, nil +} + +// newline without two spaces works when HardLineBreak is enabled +func lineBreak(p *Parser, data []byte, offset int) (int, ast.Node) { + if p.extensions&HardLineBreak != 0 { + return 1, &ast.Hardbreak{} + } + return 0, nil +} + +type linkType int + +const ( + linkNormal linkType = iota + linkImg + linkDeferredFootnote + linkInlineFootnote + linkCitation +) + +func isReferenceStyleLink(data []byte, pos int, t linkType) bool { + if t == linkDeferredFootnote { + return false + } + return pos < len(data)-1 && data[pos] == '[' && data[pos+1] != '^' +} + +func maybeImage(p *Parser, data []byte, offset int) (int, ast.Node) { + if offset < len(data)-1 && data[offset+1] == '[' { + return link(p, data, offset) + } + return 0, nil +} + +func maybeInlineFootnoteOrSuper(p *Parser, data []byte, offset int) (int, ast.Node) { + if offset < len(data)-1 && data[offset+1] == '[' { + return link(p, data, offset) + } + + if p.extensions&SuperSubscript != 0 { + ret := skipUntilChar(data[offset:], 1, '^') + if ret == 0 { + return 0, nil + } + for i := offset; i < offset+ret; i++ { + if isSpace(data[i]) && !isEscape(data, i) { + return 0, nil + } + } + sup := &ast.Superscript{} + sup.Literal = data[offset+1 : offset+ret] + return offset + ret, sup + } + + return 0, nil +} + +// '[': parse a link or an image or a footnote or a citation +func link(p *Parser, data []byte, offset int) (int, ast.Node) { + // no links allowed inside regular links, footnote, and deferred footnotes + if p.insideLink && (offset > 0 && data[offset-1] == '[' || len(data)-1 > offset && data[offset+1] == '^') { + return 0, nil + } + + var t linkType + switch { + // special case: ![^text] == deferred footnote (that follows something with + // an exclamation point) + case p.extensions&Footnotes != 0 && len(data)-1 > offset && data[offset+1] == '^': + t = linkDeferredFootnote + // ![alt] == image + case offset >= 0 && data[offset] == '!': + t = linkImg + offset++ + // [@citation], [@-citation], [@?citation], [@!citation] + case p.extensions&Mmark != 0 && len(data)-1 > offset && data[offset+1] == '@': + t = linkCitation + // [text] == regular link + // ^[text] == inline footnote + // [^refId] == deferred footnote + case p.extensions&Footnotes != 0: + if offset >= 0 && data[offset] == '^' { + t = linkInlineFootnote + offset++ + } else if len(data)-1 > offset && data[offset+1] == '^' { + t = linkDeferredFootnote + } + default: + t = linkNormal + } + + data = data[offset:] + + if t == linkCitation { + return citation(p, data, 0) + } + + var ( + i = 1 + noteID int + title, link, linkID, altContent []byte + textHasNl = false + ) + + if t == linkDeferredFootnote { + i++ + } + + // look for the matching closing bracket + for level := 1; level > 0 && i < len(data); i++ { + switch { + case data[i] == '\n': + textHasNl = true + + case data[i-1] == '\\': + continue + + case data[i] == '[': + level++ + + case data[i] == ']': + level-- + if level <= 0 { + i-- // compensate for extra i++ in for loop + } + } + } + + if i >= len(data) { + return 0, nil + } + + txtE := i + i++ + var footnoteNode ast.Node + + // skip any amount of whitespace or newline + // (this is much more lax than original markdown syntax) + i = skipSpace(data, i) + + // inline style link + switch { + case i < len(data) && data[i] == '(': + // skip initial whitespace + i++ + + i = skipSpace(data, i) + + linkB := i + + // look for link end: ' " ) + findlinkend: + for i < len(data) { + switch { + case data[i] == '\\': + i += 2 + + case data[i] == ')' || data[i] == '\'' || data[i] == '"': + break findlinkend + + default: + i++ + } + } + + if i >= len(data) { + return 0, nil + } + linkE := i + + // look for title end if present + titleB, titleE := 0, 0 + if data[i] == '\'' || data[i] == '"' { + i++ + titleB = i + + findtitleend: + for i < len(data) { + switch { + case data[i] == '\\': + i += 2 + + case data[i] == ')': + break findtitleend + + default: + i++ + } + } + + if i >= len(data) { + return 0, nil + } + + // skip whitespace after title + titleE = i - 1 + for titleE > titleB && isSpace(data[titleE]) { + titleE-- + } + + // check for closing quote presence + if data[titleE] != '\'' && data[titleE] != '"' { + titleB, titleE = 0, 0 + linkE = i + } + } + + // remove whitespace at the end of the link + for linkE > linkB && isSpace(data[linkE-1]) { + linkE-- + } + + // remove optional angle brackets around the link + if data[linkB] == '<' { + linkB++ + } + if data[linkE-1] == '>' { + linkE-- + } + + // build escaped link and title + if linkE > linkB { + link = data[linkB:linkE] + } + + if titleE > titleB { + title = data[titleB:titleE] + } + + i++ + + // reference style link + case isReferenceStyleLink(data, i, t): + var id []byte + altContentConsidered := false + + // look for the id + i++ + linkB := i + i = skipUntilChar(data, i, ']') + + if i >= len(data) { + return 0, nil + } + linkE := i + + // find the reference + if linkB == linkE { + if textHasNl { + var b bytes.Buffer + + for j := 1; j < txtE; j++ { + switch { + case data[j] != '\n': + b.WriteByte(data[j]) + case data[j-1] != ' ': + b.WriteByte(' ') + } + } + + id = b.Bytes() + } else { + id = data[1:txtE] + altContentConsidered = true + } + } else { + id = data[linkB:linkE] + } + + // find the reference with matching id + lr, ok := p.getRef(string(id)) + if !ok { + return 0, nil + } + + // keep link and title from reference + linkID = id + link = lr.link + title = lr.title + if altContentConsidered { + altContent = lr.text + } + i++ + + // shortcut reference style link or reference or inline footnote + default: + var id []byte + + // craft the id + if textHasNl { + var b bytes.Buffer + + for j := 1; j < txtE; j++ { + switch { + case data[j] != '\n': + b.WriteByte(data[j]) + case data[j-1] != ' ': + b.WriteByte(' ') + } + } + + id = b.Bytes() + } else { + if t == linkDeferredFootnote { + id = data[2:txtE] // get rid of the ^ + } else { + id = data[1:txtE] + } + } + + footnoteNode = &ast.ListItem{} + if t == linkInlineFootnote { + // create a new reference + noteID = len(p.notes) + 1 + + var fragment []byte + if len(id) > 0 { + if len(id) < 16 { + fragment = make([]byte, len(id)) + } else { + fragment = make([]byte, 16) + } + copy(fragment, slugify(id)) + } else { + fragment = append([]byte("footnote-"), []byte(strconv.Itoa(noteID))...) + } + + ref := &reference{ + noteID: noteID, + hasBlock: false, + link: fragment, + title: id, + footnote: footnoteNode, + } + + p.notes = append(p.notes, ref) + p.refsRecord[string(ref.link)] = struct{}{} + + link = ref.link + title = ref.title + } else { + // find the reference with matching id + lr, ok := p.getRef(string(id)) + if !ok { + return 0, nil + } + + if t == linkDeferredFootnote && !p.isFootnote(lr) { + lr.noteID = len(p.notes) + 1 + lr.footnote = footnoteNode + p.notes = append(p.notes, lr) + p.refsRecord[string(lr.link)] = struct{}{} + } + + // keep link and title from reference + link = lr.link + // if inline footnote, title == footnote contents + title = lr.title + noteID = lr.noteID + } + + // rewind the whitespace + i = txtE + 1 + } + + var uLink []byte + if t == linkNormal || t == linkImg { + if len(link) > 0 { + var uLinkBuf bytes.Buffer + unescapeText(&uLinkBuf, link) + uLink = uLinkBuf.Bytes() + } + + // links need something to click on and somewhere to go + if len(uLink) == 0 || (t == linkNormal && txtE <= 1) { + return 0, nil + } + } + + // call the relevant rendering function + switch t { + case linkNormal: + link := &ast.Link{ + Destination: normalizeURI(uLink), + Title: title, + DeferredID: linkID, + } + if len(altContent) > 0 { + ast.AppendChild(link, newTextNode(altContent)) + } else { + // links cannot contain other links, so turn off link parsing + // temporarily and recurse + insideLink := p.insideLink + p.insideLink = true + p.Inline(link, data[1:txtE]) + p.insideLink = insideLink + } + return i, link + + case linkImg: + image := &ast.Image{ + Destination: uLink, + Title: title, + } + ast.AppendChild(image, newTextNode(data[1:txtE])) + return i + 1, image + + case linkInlineFootnote, linkDeferredFootnote: + link := &ast.Link{ + Destination: link, + Title: title, + NoteID: noteID, + Footnote: footnoteNode, + } + if t == linkDeferredFootnote { + link.DeferredID = data[2:txtE] + } + if t == linkInlineFootnote { + i++ + } + return i, link + + default: + return 0, nil + } +} + +func (p *Parser) inlineHTMLComment(data []byte) int { + if len(data) < 5 { + return 0 + } + if data[0] != '<' || data[1] != '!' || data[2] != '-' || data[3] != '-' { + return 0 + } + i := 5 + // scan for an end-of-comment marker, across lines if necessary + for i < len(data) && !(data[i-2] == '-' && data[i-1] == '-' && data[i] == '>') { + i++ + } + // no end-of-comment marker + if i >= len(data) { + return 0 + } + return i + 1 +} + +func stripMailto(link []byte) []byte { + if bytes.HasPrefix(link, []byte("mailto://")) { + return link[9:] + } else if bytes.HasPrefix(link, []byte("mailto:")) { + return link[7:] + } else { + return link + } +} + +// autolinkType specifies a kind of autolink that gets detected. +type autolinkType int + +// These are the possible flag values for the autolink renderer. +const ( + notAutolink autolinkType = iota + normalAutolink + emailAutolink +) + +// '<' when tags or autolinks are allowed +func leftAngle(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + + if p.extensions&Mmark != 0 { + id, consumed := IsCallout(data) + if consumed > 0 { + node := &ast.Callout{} + node.ID = id + return consumed, node + } + } + + altype, end := tagLength(data) + if size := p.inlineHTMLComment(data); size > 0 { + end = size + } + if end <= 2 { + return end, nil + } + if altype == notAutolink { + htmlTag := &ast.HTMLSpan{} + htmlTag.Literal = data[:end] + return end, htmlTag + } + + var uLink bytes.Buffer + unescapeText(&uLink, data[1:end+1-2]) + if uLink.Len() <= 0 { + return end, nil + } + link := uLink.Bytes() + node := &ast.Link{ + Destination: link, + } + if altype == emailAutolink { + node.Destination = append([]byte("mailto:"), link...) + } + ast.AppendChild(node, newTextNode(stripMailto(link))) + return end, node +} + +// '\\' backslash escape +var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>~") + +func escape(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + + if len(data) <= 1 { + return 2, nil + } + + if p.extensions&NonBlockingSpace != 0 && data[1] == ' ' { + return 2, &ast.NonBlockingSpace{} + } + + if p.extensions&BackslashLineBreak != 0 && data[1] == '\n' { + return 2, &ast.Hardbreak{} + } + + if bytes.IndexByte(escapeChars, data[1]) < 0 { + return 0, nil + } + + return 2, newTextNode(data[1:2]) +} + +func unescapeText(ob *bytes.Buffer, src []byte) { + i := 0 + for i < len(src) { + org := i + for i < len(src) && src[i] != '\\' { + i++ + } + + if i > org { + ob.Write(src[org:i]) + } + + if i+1 >= len(src) { + break + } + + ob.WriteByte(src[i+1]) + i += 2 + } +} + +// '&' escaped when it doesn't belong to an entity +// valid entities are assumed to be anything matching &#?[A-Za-z0-9]+; +func entity(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + + end := skipCharN(data, 1, '#', 1) + end = skipAlnum(data, end) + + if end < len(data) && data[end] == ';' { + end++ // real entity + } else { + return 0, nil // lone '&' + } + + ent := data[:end] + // undo & escaping or it will be converted to &amp; by another + // escaper in the renderer + if bytes.Equal(ent, []byte("&")) { + ent = []byte{'&'} + } + + return end, newTextNode(ent) +} + +func linkEndsWithEntity(data []byte, linkEnd int) bool { + entityRanges := htmlEntityRe.FindAllIndex(data[:linkEnd], -1) + return entityRanges != nil && entityRanges[len(entityRanges)-1][1] == linkEnd +} + +// hasPrefixCaseInsensitive is a custom implementation of +// strings.HasPrefix(strings.ToLower(s), prefix) +// we rolled our own because ToLower pulls in a huge machinery of lowercasing +// anything from Unicode and that's very slow. Since this func will only be +// used on ASCII protocol prefixes, we can take shortcuts. +func hasPrefixCaseInsensitive(s, prefix []byte) bool { + if len(s) < len(prefix) { + return false + } + delta := byte('a' - 'A') + for i, b := range prefix { + if b != s[i] && b != s[i]+delta { + return false + } + } + return true +} + +var protocolPrefixes = [][]byte{ + []byte("http://"), + []byte("https://"), + []byte("ftp://"), + []byte("file://"), + []byte("mailto:"), +} + +const shortestPrefix = 6 // len("ftp://"), the shortest of the above + +func maybeAutoLink(p *Parser, data []byte, offset int) (int, ast.Node) { + // quick check to rule out most false hits + if p.insideLink || len(data) < offset+shortestPrefix { + return 0, nil + } + for _, prefix := range protocolPrefixes { + endOfHead := offset + 8 // 8 is the len() of the longest prefix + if endOfHead > len(data) { + endOfHead = len(data) + } + if hasPrefixCaseInsensitive(data[offset:endOfHead], prefix) { + return autoLink(p, data, offset) + } + } + return 0, nil +} + +func autoLink(p *Parser, data []byte, offset int) (int, ast.Node) { + // Now a more expensive check to see if we're not inside an anchor element + anchorStart := offset + offsetFromAnchor := 0 + for anchorStart > 0 && data[anchorStart] != '<' { + anchorStart-- + offsetFromAnchor++ + } + + anchorStr := anchorRe.Find(data[anchorStart:]) + if anchorStr != nil { + anchorClose := &ast.HTMLSpan{} + anchorClose.Literal = anchorStr[offsetFromAnchor:] + return len(anchorStr) - offsetFromAnchor, anchorClose + } + + // scan backward for a word boundary + rewind := 0 + for offset-rewind > 0 && rewind <= 7 && isLetter(data[offset-rewind-1]) { + rewind++ + } + if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters + return 0, nil + } + + origData := data + data = data[offset-rewind:] + + if !isSafeLink(data) { + return 0, nil + } + + linkEnd := 0 + for linkEnd < len(data) && !isEndOfLink(data[linkEnd]) { + linkEnd++ + } + + // Skip punctuation at the end of the link + if (data[linkEnd-1] == '.' || data[linkEnd-1] == ',') && data[linkEnd-2] != '\\' { + linkEnd-- + } + + // But don't skip semicolon if it's a part of escaped entity: + if data[linkEnd-1] == ';' && data[linkEnd-2] != '\\' && !linkEndsWithEntity(data, linkEnd) { + linkEnd-- + } + + // See if the link finishes with a punctuation sign that can be closed. + var copen byte + switch data[linkEnd-1] { + case '"': + copen = '"' + case '\'': + copen = '\'' + case ')': + copen = '(' + case ']': + copen = '[' + case '}': + copen = '{' + default: + copen = 0 + } + + if copen != 0 { + bufEnd := offset - rewind + linkEnd - 2 + + openDelim := 1 + + /* Try to close the final punctuation sign in this same line; + * if we managed to close it outside of the URL, that means that it's + * not part of the URL. If it closes inside the URL, that means it + * is part of the URL. + * + * Examples: + * + * foo http://www.pokemon.com/Pikachu_(Electric) bar + * => http://www.pokemon.com/Pikachu_(Electric) + * + * foo (http://www.pokemon.com/Pikachu_(Electric)) bar + * => http://www.pokemon.com/Pikachu_(Electric) + * + * foo http://www.pokemon.com/Pikachu_(Electric)) bar + * => http://www.pokemon.com/Pikachu_(Electric)) + * + * (foo http://www.pokemon.com/Pikachu_(Electric)) bar + * => foo http://www.pokemon.com/Pikachu_(Electric) + */ + + for bufEnd >= 0 && origData[bufEnd] != '\n' && openDelim != 0 { + if origData[bufEnd] == data[linkEnd-1] { + openDelim++ + } + + if origData[bufEnd] == copen { + openDelim-- + } + + bufEnd-- + } + + if openDelim == 0 { + linkEnd-- + } + } + + var uLink bytes.Buffer + unescapeText(&uLink, data[:linkEnd]) + + if uLink.Len() > 0 { + node := &ast.Link{ + Destination: uLink.Bytes(), + } + ast.AppendChild(node, newTextNode(uLink.Bytes())) + return linkEnd, node + } + + return linkEnd, nil +} + +func isEndOfLink(char byte) bool { + return isSpace(char) || char == '<' +} + +var validUris = [][]byte{[]byte("http://"), []byte("https://"), []byte("ftp://"), []byte("mailto://")} +var validPaths = [][]byte{[]byte("/"), []byte("./"), []byte("../")} + +func isSafeLink(link []byte) bool { + nLink := len(link) + for _, path := range validPaths { + nPath := len(path) + linkPrefix := link[:nPath] + if nLink >= nPath && bytes.Equal(linkPrefix, path) { + if nLink == nPath { + return true + } else if isAlnum(link[nPath]) { + return true + } + } + } + + for _, prefix := range validUris { + // TODO: handle unicode here + // case-insensitive prefix test + nPrefix := len(prefix) + if nLink > nPrefix { + linkPrefix := bytes.ToLower(link[:nPrefix]) + if bytes.Equal(linkPrefix, prefix) && isAlnum(link[nPrefix]) { + return true + } + } + } + + return false +} + +// return the length of the given tag, or 0 is it's not valid +func tagLength(data []byte) (autolink autolinkType, end int) { + var i, j int + + // a valid tag can't be shorter than 3 chars + if len(data) < 3 { + return notAutolink, 0 + } + + // begins with a '<' optionally followed by '/', followed by letter or number + if data[0] != '<' { + return notAutolink, 0 + } + if data[1] == '/' { + i = 2 + } else { + i = 1 + } + + if !isAlnum(data[i]) { + return notAutolink, 0 + } + + // scheme test + autolink = notAutolink + + // try to find the beginning of an URI + for i < len(data) && (isAlnum(data[i]) || data[i] == '.' || data[i] == '+' || data[i] == '-') { + i++ + } + + if i > 1 && i < len(data) && data[i] == '@' { + if j = isMailtoAutoLink(data[i:]); j != 0 { + return emailAutolink, i + j + } + } + + if i > 2 && i < len(data) && data[i] == ':' { + autolink = normalAutolink + i++ + } + + // complete autolink test: no whitespace or ' or " + switch { + case i >= len(data): + autolink = notAutolink + case autolink != notAutolink: + j = i + + for i < len(data) { + if data[i] == '\\' { + i += 2 + } else if data[i] == '>' || data[i] == '\'' || data[i] == '"' || isSpace(data[i]) { + break + } else { + i++ + } + + } + + if i >= len(data) { + return autolink, 0 + } + if i > j && data[i] == '>' { + return autolink, i + 1 + } + + // one of the forbidden chars has been found + autolink = notAutolink + } + i += bytes.IndexByte(data[i:], '>') + if i < 0 { + return autolink, 0 + } + return autolink, i + 1 +} + +// look for the address part of a mail autolink and '>' +// this is less strict than the original markdown e-mail address matching +func isMailtoAutoLink(data []byte) int { + nb := 0 + + // address is assumed to be: [-@._a-zA-Z0-9]+ with exactly one '@' + for i, c := range data { + if isAlnum(c) { + continue + } + + switch c { + case '@': + nb++ + + case '-', '.', '_': + break + + case '>': + if nb == 1 { + return i + 1 + } + return 0 + default: + return 0 + } + } + + return 0 +} + +// look for the next emph char, skipping other constructs +func helperFindEmphChar(data []byte, c byte) int { + i := 0 + + for i < len(data) { + for i < len(data) && data[i] != c && data[i] != '`' && data[i] != '[' { + i++ + } + if i >= len(data) { + return 0 + } + // do not count escaped chars + if i != 0 && data[i-1] == '\\' { + i++ + continue + } + if data[i] == c { + return i + } + + if data[i] == '`' { + // skip a code span + tmpI := 0 + i++ + for i < len(data) && data[i] != '`' { + if tmpI == 0 && data[i] == c { + tmpI = i + } + i++ + } + if i >= len(data) { + return tmpI + } + i++ + } else if data[i] == '[' { + // skip a link + tmpI := 0 + i++ + for i < len(data) && data[i] != ']' { + if tmpI == 0 && data[i] == c { + tmpI = i + } + i++ + } + i++ + for i < len(data) && (data[i] == ' ' || data[i] == '\n') { + i++ + } + if i >= len(data) { + return tmpI + } + if data[i] != '[' && data[i] != '(' { // not a link + if tmpI > 0 { + return tmpI + } + continue + } + cc := data[i] + i++ + for i < len(data) && data[i] != cc { + if tmpI == 0 && data[i] == c { + return i + } + i++ + } + if i >= len(data) { + return tmpI + } + i++ + } + } + return 0 +} + +func helperEmphasis(p *Parser, data []byte, c byte) (int, ast.Node) { + i := 0 + + // skip one symbol if coming from emph3 + if len(data) > 1 && data[0] == c && data[1] == c { + i = 1 + } + + for i < len(data) { + length := helperFindEmphChar(data[i:], c) + if length == 0 { + return 0, nil + } + i += length + if i >= len(data) { + return 0, nil + } + + if i+1 < len(data) && data[i+1] == c { + i++ + continue + } + + if data[i] == c && !isSpace(data[i-1]) { + + if p.extensions&NoIntraEmphasis != 0 { + if !(i+1 == len(data) || isSpace(data[i+1]) || isPunctuation(data[i+1])) { + continue + } + } + + emph := &ast.Emph{} + p.Inline(emph, data[:i]) + return i + 1, emph + } + } + + return 0, nil +} + +func helperDoubleEmphasis(p *Parser, data []byte, c byte) (int, ast.Node) { + i := 0 + + for i < len(data) { + length := helperFindEmphChar(data[i:], c) + if length == 0 { + return 0, nil + } + i += length + + if i+1 < len(data) && data[i] == c && data[i+1] == c && i > 0 && !isSpace(data[i-1]) { + var node ast.Node = &ast.Strong{} + if c == '~' { + node = &ast.Del{} + } + p.Inline(node, data[:i]) + return i + 2, node + } + i++ + } + return 0, nil +} + +func helperTripleEmphasis(p *Parser, data []byte, offset int, c byte) (int, ast.Node) { + i := 0 + origData := data + data = data[offset:] + + for i < len(data) { + length := helperFindEmphChar(data[i:], c) + if length == 0 { + return 0, nil + } + i += length + + // skip whitespace preceded symbols + if data[i] != c || isSpace(data[i-1]) { + continue + } + + switch { + case i+2 < len(data) && data[i+1] == c && data[i+2] == c: + // triple symbol found + strong := &ast.Strong{} + em := &ast.Emph{} + ast.AppendChild(strong, em) + p.Inline(em, data[:i]) + return i + 3, strong + case i+1 < len(data) && data[i+1] == c: + // double symbol found, hand over to emph1 + length, node := helperEmphasis(p, origData[offset-2:], c) + if length == 0 { + return 0, nil + } + return length - 2, node + default: + // single symbol found, hand over to emph2 + length, node := helperDoubleEmphasis(p, origData[offset-1:], c) + if length == 0 { + return 0, nil + } + return length - 1, node + } + } + return 0, nil +} + +// math handle inline math wrapped with '$' +func math(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + + // too short, or block math + if len(data) <= 2 || data[1] == '$' { + return 0, nil + } + + // find next '$' + var end int + for end = 1; end < len(data) && data[end] != '$'; end++ { + } + + // $ not match + if end == len(data) { + return 0, nil + } + + // create inline math node + math := &ast.Math{} + math.Literal = data[1:end] + return end + 1, math +} + +func newTextNode(d []byte) *ast.Text { + return &ast.Text{ast.Leaf{Literal: d}} +} + +func normalizeURI(s []byte) []byte { + return s // TODO: implement +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/matter.go b/vendor/github.com/gomarkdown/markdown/parser/matter.go new file mode 100644 index 000000000..926863572 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/matter.go @@ -0,0 +1,36 @@ +package parser + +import ( + "bytes" + + "github.com/gomarkdown/markdown/ast" +) + +func (p *Parser) documentMatter(data []byte) int { + if data[0] != '{' { + return 0 + } + + consumed := 0 + matter := ast.DocumentMatterNone + if bytes.HasPrefix(data, []byte("{frontmatter}")) { + consumed = len("{frontmatter}") + matter = ast.DocumentMatterFront + } + if bytes.HasPrefix(data, []byte("{mainmatter}")) { + consumed = len("{mainmatter}") + matter = ast.DocumentMatterMain + } + if bytes.HasPrefix(data, []byte("{backmatter}")) { + consumed = len("{backmatter}") + matter = ast.DocumentMatterBack + } + if consumed == 0 { + return 0 + } + node := &ast.DocumentMatter{Matter: matter} + p.addBlock(node) + p.finalize(node) + + return consumed +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/options.go b/vendor/github.com/gomarkdown/markdown/parser/options.go new file mode 100644 index 000000000..d3d0c0887 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/options.go @@ -0,0 +1,32 @@ +package parser + +import ( + "github.com/gomarkdown/markdown/ast" +) + +// Flags control optional behavior of parser. +type Flags int + +// Options is a collection of supplementary parameters tweaking the behavior of various parts of the parser. +type Options struct { + ParserHook BlockFunc + ReadIncludeFn ReadIncludeFunc + + Flags Flags // Flags allow customizing parser's behavior +} + +// Parser renderer configuration options. +const ( + FlagsNone Flags = 0 + SkipFootnoteList Flags = 1 << iota // Skip adding the footnote list (regardless if they are parsed) +) + +// BlockFunc allows to registration of a parser function. If successful it +// returns an ast.Node, a buffer that should be parsed as a block and the the number of bytes consumed. +type BlockFunc func(data []byte) (ast.Node, []byte, int) + +// ReadIncludeFunc should read the file under path and returns the read bytes, +// from will be set to the name of the current file being parsed. Initially +// this will be empty. address is the optional address specifier of which lines +// of the file to return. If this function is not set no data will be read. +type ReadIncludeFunc func(from, path string, address []byte) []byte diff --git a/vendor/github.com/gomarkdown/markdown/parser/parser.go b/vendor/github.com/gomarkdown/markdown/parser/parser.go new file mode 100644 index 000000000..c7302dfd6 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/parser.go @@ -0,0 +1,812 @@ +/* +Package parser implements parser for markdown text that generates AST (abstract syntax tree). +*/ +package parser + +import ( + "bytes" + "fmt" + "strings" + "unicode/utf8" + + "github.com/gomarkdown/markdown/ast" +) + +// Extensions is a bitmask of enabled parser extensions. +type Extensions int + +// Bit flags representing markdown parsing extensions. +// Use | (or) to specify multiple extensions. +const ( + NoExtensions Extensions = 0 + NoIntraEmphasis Extensions = 1 << iota // Ignore emphasis markers inside words + Tables // Parse tables + FencedCode // Parse fenced code blocks + Autolink // Detect embedded URLs that are not explicitly marked + Strikethrough // Strikethrough text using ~~test~~ + LaxHTMLBlocks // Loosen up HTML block parsing rules + SpaceHeadings // Be strict about prefix heading rules + HardLineBreak // Translate newlines into line breaks + NonBlockingSpace // Translate backspace spaces into line non-blocking spaces + TabSizeEight // Expand tabs to eight spaces instead of four + Footnotes // Pandoc-style footnotes + NoEmptyLineBeforeBlock // No need to insert an empty line to start a (code, quote, ordered list, unordered list) block + HeadingIDs // specify heading IDs with {#id} + Titleblock // Titleblock ala pandoc + AutoHeadingIDs // Create the heading ID from the text + BackslashLineBreak // Translate trailing backslashes into line breaks + DefinitionLists // Parse definition lists + MathJax // Parse MathJax + OrderedListStart // Keep track of the first number used when starting an ordered list. + Attributes // Block Attributes + SuperSubscript // Super- and subscript support: 2^10^, H~2~O. + EmptyLinesBreakList // 2 empty lines break out of list + Includes // Support including other files. + Mmark // Support Mmark syntax, see https://mmark.nl/syntax + + CommonExtensions Extensions = NoIntraEmphasis | Tables | FencedCode | + Autolink | Strikethrough | SpaceHeadings | HeadingIDs | + BackslashLineBreak | DefinitionLists | MathJax +) + +// The size of a tab stop. +const ( + tabSizeDefault = 4 + tabSizeDouble = 8 +) + +// for each character that triggers a response when parsing inline data. +type inlineParser func(p *Parser, data []byte, offset int) (int, ast.Node) + +// ReferenceOverrideFunc is expected to be called with a reference string and +// return either a valid Reference type that the reference string maps to or +// nil. If overridden is false, the default reference logic will be executed. +// See the documentation in Options for more details on use-case. +type ReferenceOverrideFunc func(reference string) (ref *Reference, overridden bool) + +// Parser is a type that holds extensions and the runtime state used by +// Parse, and the renderer. You can not use it directly, construct it with New. +type Parser struct { + + // ReferenceOverride is an optional function callback that is called every + // time a reference is resolved. It can be set before starting parsing. + // + // In Markdown, the link reference syntax can be made to resolve a link to + // a reference instead of an inline URL, in one of the following ways: + // + // * [link text][refid] + // * [refid][] + // + // Usually, the refid is defined at the bottom of the Markdown document. If + // this override function is provided, the refid is passed to the override + // function first, before consulting the defined refids at the bottom. If + // the override function indicates an override did not occur, the refids at + // the bottom will be used to fill in the link details. + ReferenceOverride ReferenceOverrideFunc + + Opts Options + + // after parsing, this is AST root of parsed markdown text + Doc ast.Node + + extensions Extensions + + refs map[string]*reference + refsRecord map[string]struct{} + inlineCallback [256]inlineParser + nesting int + maxNesting int + insideLink bool + indexCnt int // incremented after every index + + // Footnotes need to be ordered as well as available to quickly check for + // presence. If a ref is also a footnote, it's stored both in refs and here + // in notes. Slice is nil if footnotes not enabled. + notes []*reference + + tip ast.Node // = doc + oldTip ast.Node + lastMatchedContainer ast.Node // = doc + allClosed bool + + // Attributes are attached to block level elements. + attr *ast.Attribute + + includeStack *incStack +} + +// New creates a markdown parser with CommonExtensions. +// +// You can then call `doc := p.Parse(markdown)` to parse markdown document +// and `markdown.Render(doc, renderer)` to convert it to another format with +// a renderer. +func New() *Parser { + return NewWithExtensions(CommonExtensions) +} + +// NewWithExtensions creates a markdown parser with given extensions. +func NewWithExtensions(extension Extensions) *Parser { + p := Parser{ + refs: make(map[string]*reference), + refsRecord: make(map[string]struct{}), + maxNesting: 16, + insideLink: false, + Doc: &ast.Document{}, + extensions: extension, + allClosed: true, + includeStack: newIncStack(), + } + p.tip = p.Doc + p.oldTip = p.Doc + p.lastMatchedContainer = p.Doc + + p.inlineCallback[' '] = maybeLineBreak + p.inlineCallback['*'] = emphasis + p.inlineCallback['_'] = emphasis + if p.extensions&Strikethrough != 0 { + p.inlineCallback['~'] = emphasis + } + p.inlineCallback['`'] = codeSpan + p.inlineCallback['\n'] = lineBreak + p.inlineCallback['['] = link + p.inlineCallback['<'] = leftAngle + p.inlineCallback['\\'] = escape + p.inlineCallback['&'] = entity + p.inlineCallback['!'] = maybeImage + if p.extensions&Mmark != 0 { + p.inlineCallback['('] = maybeShortRefOrIndex + } + p.inlineCallback['^'] = maybeInlineFootnoteOrSuper + if p.extensions&Autolink != 0 { + p.inlineCallback['h'] = maybeAutoLink + p.inlineCallback['m'] = maybeAutoLink + p.inlineCallback['f'] = maybeAutoLink + p.inlineCallback['H'] = maybeAutoLink + p.inlineCallback['M'] = maybeAutoLink + p.inlineCallback['F'] = maybeAutoLink + } + if p.extensions&MathJax != 0 { + p.inlineCallback['$'] = math + } + + return &p +} + +func (p *Parser) getRef(refid string) (ref *reference, found bool) { + if p.ReferenceOverride != nil { + r, overridden := p.ReferenceOverride(refid) + if overridden { + if r == nil { + return nil, false + } + return &reference{ + link: []byte(r.Link), + title: []byte(r.Title), + noteID: 0, + hasBlock: false, + text: []byte(r.Text)}, true + } + } + // refs are case insensitive + ref, found = p.refs[strings.ToLower(refid)] + return ref, found +} + +func (p *Parser) isFootnote(ref *reference) bool { + _, ok := p.refsRecord[string(ref.link)] + return ok +} + +func (p *Parser) finalize(block ast.Node) { + p.tip = block.GetParent() +} + +func (p *Parser) addChild(node ast.Node) ast.Node { + for !canNodeContain(p.tip, node) { + p.finalize(p.tip) + } + ast.AppendChild(p.tip, node) + p.tip = node + return node +} + +func canNodeContain(n ast.Node, v ast.Node) bool { + switch n.(type) { + case *ast.List: + return isListItem(v) + case *ast.Document, *ast.BlockQuote, *ast.Aside, *ast.ListItem, *ast.CaptionFigure: + return !isListItem(v) + case *ast.Table: + switch v.(type) { + case *ast.TableHeader, *ast.TableBody, *ast.TableFooter: + return true + default: + return false + } + case *ast.TableHeader, *ast.TableBody, *ast.TableFooter: + _, ok := v.(*ast.TableRow) + return ok + case *ast.TableRow: + _, ok := v.(*ast.TableCell) + return ok + } + return false +} + +func (p *Parser) closeUnmatchedBlocks() { + if p.allClosed { + return + } + for p.oldTip != p.lastMatchedContainer { + parent := p.oldTip.GetParent() + p.finalize(p.oldTip) + p.oldTip = parent + } + p.allClosed = true +} + +// Reference represents the details of a link. +// See the documentation in Options for more details on use-case. +type Reference struct { + // Link is usually the URL the reference points to. + Link string + // Title is the alternate text describing the link in more detail. + Title string + // Text is the optional text to override the ref with if the syntax used was + // [refid][] + Text string +} + +// Parse generates AST (abstract syntax tree) representing markdown document. +// +// The result is a root of the tree whose underlying type is *ast.Document +// +// You can then convert AST to html using html.Renderer, to some other format +// using a custom renderer or transform the tree. +func (p *Parser) Parse(input []byte) ast.Node { + p.block(input) + // Walk the tree and finish up some of unfinished blocks + for p.tip != nil { + p.finalize(p.tip) + } + // Walk the tree again and process inline markdown in each block + ast.WalkFunc(p.Doc, func(node ast.Node, entering bool) ast.WalkStatus { + switch node.(type) { + case *ast.Paragraph, *ast.Heading, *ast.TableCell: + p.Inline(node, node.AsContainer().Content) + node.AsContainer().Content = nil + } + return ast.GoToNext + }) + + if p.Opts.Flags&SkipFootnoteList == 0 { + p.parseRefsToAST() + } + return p.Doc +} + +func (p *Parser) parseRefsToAST() { + if p.extensions&Footnotes == 0 || len(p.notes) == 0 { + return + } + p.tip = p.Doc + list := &ast.List{ + IsFootnotesList: true, + ListFlags: ast.ListTypeOrdered, + } + p.addBlock(&ast.Footnotes{}) + block := p.addBlock(list) + flags := ast.ListItemBeginningOfList + // Note: this loop is intentionally explicit, not range-form. This is + // because the body of the loop will append nested footnotes to p.notes and + // we need to process those late additions. Range form would only walk over + // the fixed initial set. + for i := 0; i < len(p.notes); i++ { + ref := p.notes[i] + p.addChild(ref.footnote) + block := ref.footnote + listItem := block.(*ast.ListItem) + listItem.ListFlags = flags | ast.ListTypeOrdered + listItem.RefLink = ref.link + if ref.hasBlock { + flags |= ast.ListItemContainsBlock + p.block(ref.title) + } else { + p.Inline(block, ref.title) + } + flags &^= ast.ListItemBeginningOfList | ast.ListItemContainsBlock + } + above := list.Parent + finalizeList(list) + p.tip = above + + ast.WalkFunc(block, func(node ast.Node, entering bool) ast.WalkStatus { + switch node.(type) { + case *ast.Paragraph, *ast.Heading: + p.Inline(node, node.AsContainer().Content) + node.AsContainer().Content = nil + } + return ast.GoToNext + }) +} + +// +// Link references +// +// This section implements support for references that (usually) appear +// as footnotes in a document, and can be referenced anywhere in the document. +// The basic format is: +// +// [1]: http://www.google.com/ "Google" +// [2]: http://www.github.com/ "Github" +// +// Anywhere in the document, the reference can be linked by referring to its +// label, i.e., 1 and 2 in this example, as in: +// +// This library is hosted on [Github][2], a git hosting site. +// +// Actual footnotes as specified in Pandoc and supported by some other Markdown +// libraries such as php-markdown are also taken care of. They look like this: +// +// This sentence needs a bit of further explanation.[^note] +// +// [^note]: This is the explanation. +// +// Footnotes should be placed at the end of the document in an ordered list. +// Inline footnotes such as: +// +// Inline footnotes^[Not supported.] also exist. +// +// are not yet supported. + +// reference holds all information necessary for a reference-style links or +// footnotes. +// +// Consider this markdown with reference-style links: +// +// [link][ref] +// +// [ref]: /url/ "tooltip title" +// +// It will be ultimately converted to this HTML: +// +//

    link

    +// +// And a reference structure will be populated as follows: +// +// p.refs["ref"] = &reference{ +// link: "/url/", +// title: "tooltip title", +// } +// +// Alternatively, reference can contain information about a footnote. Consider +// this markdown: +// +// Text needing a footnote.[^a] +// +// [^a]: This is the note +// +// A reference structure will be populated as follows: +// +// p.refs["a"] = &reference{ +// link: "a", +// title: "This is the note", +// noteID: , +// } +// +// TODO: As you can see, it begs for splitting into two dedicated structures +// for refs and for footnotes. +type reference struct { + link []byte + title []byte + noteID int // 0 if not a footnote ref + hasBlock bool + footnote ast.Node // a link to the Item node within a list of footnotes + + text []byte // only gets populated by refOverride feature with Reference.Text +} + +func (r *reference) String() string { + return fmt.Sprintf("{link: %q, title: %q, text: %q, noteID: %d, hasBlock: %v}", + r.link, r.title, r.text, r.noteID, r.hasBlock) +} + +// Check whether or not data starts with a reference link. +// If so, it is parsed and stored in the list of references +// (in the render struct). +// Returns the number of bytes to skip to move past it, +// or zero if the first line is not a reference. +func isReference(p *Parser, data []byte, tabSize int) int { + // up to 3 optional leading spaces + if len(data) < 4 { + return 0 + } + i := 0 + for i < 3 && data[i] == ' ' { + i++ + } + + noteID := 0 + + // id part: anything but a newline between brackets + if data[i] != '[' { + return 0 + } + i++ + if p.extensions&Footnotes != 0 { + if i < len(data) && data[i] == '^' { + // we can set it to anything here because the proper noteIds will + // be assigned later during the second pass. It just has to be != 0 + noteID = 1 + i++ + } + } + idOffset := i + for i < len(data) && data[i] != '\n' && data[i] != '\r' && data[i] != ']' { + i++ + } + if i >= len(data) || data[i] != ']' { + return 0 + } + idEnd := i + // footnotes can have empty ID, like this: [^], but a reference can not be + // empty like this: []. Break early if it's not a footnote and there's no ID + if noteID == 0 && idOffset == idEnd { + return 0 + } + // spacer: colon (space | tab)* newline? (space | tab)* + i++ + if i >= len(data) || data[i] != ':' { + return 0 + } + i++ + for i < len(data) && (data[i] == ' ' || data[i] == '\t') { + i++ + } + if i < len(data) && (data[i] == '\n' || data[i] == '\r') { + i++ + if i < len(data) && data[i] == '\n' && data[i-1] == '\r' { + i++ + } + } + for i < len(data) && (data[i] == ' ' || data[i] == '\t') { + i++ + } + if i >= len(data) { + return 0 + } + + var ( + linkOffset, linkEnd int + titleOffset, titleEnd int + lineEnd int + raw []byte + hasBlock bool + ) + + if p.extensions&Footnotes != 0 && noteID != 0 { + linkOffset, linkEnd, raw, hasBlock = scanFootnote(p, data, i, tabSize) + lineEnd = linkEnd + } else { + linkOffset, linkEnd, titleOffset, titleEnd, lineEnd = scanLinkRef(p, data, i) + } + if lineEnd == 0 { + return 0 + } + + // a valid ref has been found + + ref := &reference{ + noteID: noteID, + hasBlock: hasBlock, + } + + if noteID > 0 { + // reusing the link field for the id since footnotes don't have links + ref.link = data[idOffset:idEnd] + // if footnote, it's not really a title, it's the contained text + ref.title = raw + } else { + ref.link = data[linkOffset:linkEnd] + ref.title = data[titleOffset:titleEnd] + } + + // id matches are case-insensitive + id := string(bytes.ToLower(data[idOffset:idEnd])) + + p.refs[id] = ref + + return lineEnd +} + +func scanLinkRef(p *Parser, data []byte, i int) (linkOffset, linkEnd, titleOffset, titleEnd, lineEnd int) { + // link: whitespace-free sequence, optionally between angle brackets + if data[i] == '<' { + i++ + } + linkOffset = i + for i < len(data) && data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r' { + i++ + } + linkEnd = i + if linkEnd < len(data) && data[linkOffset] == '<' && data[linkEnd-1] == '>' { + linkOffset++ + linkEnd-- + } + + // optional spacer: (space | tab)* (newline | '\'' | '"' | '(' ) + for i < len(data) && (data[i] == ' ' || data[i] == '\t') { + i++ + } + if i < len(data) && data[i] != '\n' && data[i] != '\r' && data[i] != '\'' && data[i] != '"' && data[i] != '(' { + return + } + + // compute end-of-line + if i >= len(data) || data[i] == '\r' || data[i] == '\n' { + lineEnd = i + } + if i+1 < len(data) && data[i] == '\r' && data[i+1] == '\n' { + lineEnd++ + } + + // optional (space|tab)* spacer after a newline + if lineEnd > 0 { + i = lineEnd + 1 + for i < len(data) && (data[i] == ' ' || data[i] == '\t') { + i++ + } + } + + // optional title: any non-newline sequence enclosed in '"() alone on its line + if i+1 < len(data) && (data[i] == '\'' || data[i] == '"' || data[i] == '(') { + i++ + titleOffset = i + + // look for EOL + for i < len(data) && data[i] != '\n' && data[i] != '\r' { + i++ + } + if i+1 < len(data) && data[i] == '\n' && data[i+1] == '\r' { + titleEnd = i + 1 + } else { + titleEnd = i + } + + // step back + i-- + for i > titleOffset && (data[i] == ' ' || data[i] == '\t') { + i-- + } + if i > titleOffset && (data[i] == '\'' || data[i] == '"' || data[i] == ')') { + lineEnd = titleEnd + titleEnd = i + } + } + + return +} + +// The first bit of this logic is the same as Parser.listItem, but the rest +// is much simpler. This function simply finds the entire block and shifts it +// over by one tab if it is indeed a block (just returns the line if it's not). +// blockEnd is the end of the section in the input buffer, and contents is the +// extracted text that was shifted over one tab. It will need to be rendered at +// the end of the document. +func scanFootnote(p *Parser, data []byte, i, indentSize int) (blockStart, blockEnd int, contents []byte, hasBlock bool) { + if i == 0 || len(data) == 0 { + return + } + + // skip leading whitespace on first line + for i < len(data) && data[i] == ' ' { + i++ + } + + blockStart = i + + // find the end of the line + blockEnd = i + for i < len(data) && data[i-1] != '\n' { + i++ + } + + // get working buffer + var raw bytes.Buffer + + // put the first line into the working buffer + raw.Write(data[blockEnd:i]) + blockEnd = i + + // process the following lines + containsBlankLine := false + +gatherLines: + for blockEnd < len(data) { + i++ + + // find the end of this line + for i < len(data) && data[i-1] != '\n' { + i++ + } + + // if it is an empty line, guess that it is part of this item + // and move on to the next line + if p.isEmpty(data[blockEnd:i]) > 0 { + containsBlankLine = true + blockEnd = i + continue + } + + n := 0 + if n = isIndented(data[blockEnd:i], indentSize); n == 0 { + // this is the end of the block. + // we don't want to include this last line in the index. + break gatherLines + } + + // if there were blank lines before this one, insert a new one now + if containsBlankLine { + raw.WriteByte('\n') + containsBlankLine = false + } + + // get rid of that first tab, write to buffer + raw.Write(data[blockEnd+n : i]) + hasBlock = true + + blockEnd = i + } + + if data[blockEnd-1] != '\n' { + raw.WriteByte('\n') + } + + contents = raw.Bytes() + + return +} + +// isPunctuation returns true if c is a punctuation symbol. +func isPunctuation(c byte) bool { + for _, r := range []byte("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~") { + if c == r { + return true + } + } + return false +} + +// isSpace returns true if c is a white-space charactr +func isSpace(c byte) bool { + return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v' +} + +// isLetter returns true if c is ascii letter +func isLetter(c byte) bool { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') +} + +// isAlnum returns true if c is a digit or letter +// TODO: check when this is looking for ASCII alnum and when it should use unicode +func isAlnum(c byte) bool { + return (c >= '0' && c <= '9') || isLetter(c) +} + +// TODO: this is not used +// Replace tab characters with spaces, aligning to the next TAB_SIZE column. +// always ends output with a newline +func expandTabs(out *bytes.Buffer, line []byte, tabSize int) { + // first, check for common cases: no tabs, or only tabs at beginning of line + i, prefix := 0, 0 + slowcase := false + for i = 0; i < len(line); i++ { + if line[i] == '\t' { + if prefix == i { + prefix++ + } else { + slowcase = true + break + } + } + } + + // no need to decode runes if all tabs are at the beginning of the line + if !slowcase { + for i = 0; i < prefix*tabSize; i++ { + out.WriteByte(' ') + } + out.Write(line[prefix:]) + return + } + + // the slow case: we need to count runes to figure out how + // many spaces to insert for each tab + column := 0 + i = 0 + for i < len(line) { + start := i + for i < len(line) && line[i] != '\t' { + _, size := utf8.DecodeRune(line[i:]) + i += size + column++ + } + + if i > start { + out.Write(line[start:i]) + } + + if i >= len(line) { + break + } + + for { + out.WriteByte(' ') + column++ + if column%tabSize == 0 { + break + } + } + + i++ + } +} + +// Find if a line counts as indented or not. +// Returns number of characters the indent is (0 = not indented). +func isIndented(data []byte, indentSize int) int { + if len(data) == 0 { + return 0 + } + if data[0] == '\t' { + return 1 + } + if len(data) < indentSize { + return 0 + } + for i := 0; i < indentSize; i++ { + if data[i] != ' ' { + return 0 + } + } + return indentSize +} + +// Create a url-safe slug for fragments +func slugify(in []byte) []byte { + if len(in) == 0 { + return in + } + out := make([]byte, 0, len(in)) + sym := false + + for _, ch := range in { + if isAlnum(ch) { + sym = false + out = append(out, ch) + } else if sym { + continue + } else { + out = append(out, '-') + sym = true + } + } + var a, b int + var ch byte + for a, ch = range out { + if ch != '-' { + break + } + } + for b = len(out) - 1; b > 0; b-- { + if out[b] != '-' { + break + } + } + return out[a : b+1] +} + +func isListItem(d ast.Node) bool { + _, ok := d.(*ast.ListItem) + return ok +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/ref.go b/vendor/github.com/gomarkdown/markdown/parser/ref.go new file mode 100644 index 000000000..0b59a196d --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/ref.go @@ -0,0 +1,89 @@ +package parser + +import ( + "bytes" + "fmt" + + "github.com/gomarkdown/markdown/ast" +) + +// parse '(#r)', where r does not contain spaces. Or. +// (!item) (!item, subitem), for an index, (!!item) signals primary. +func maybeShortRefOrIndex(p *Parser, data []byte, offset int) (int, ast.Node) { + if len(data[offset:]) < 4 { + return 0, nil + } + // short ref first + data = data[offset:] + i := 1 + switch data[i] { + case '#': // cross ref + i++ + Loop: + for i < len(data) { + c := data[i] + switch { + case c == ')': + break Loop + case !isAlnum(c): + if c == '_' || c == '-' || c == ':' { + i++ + continue + } + i = 0 + break Loop + } + i++ + } + if i >= len(data) { + return 0, nil + } + if data[i] != ')' { + return 0, nil + } + + id := data[2:i] + node := &ast.CrossReference{} + node.Destination = id + + return i + 1, node + + case '!': // index + i++ + start := i + i = skipUntilChar(data, start, ')') + + // did we reach the end of the buffer without a closing marker? + if i >= len(data) { + return 0, nil + } + + if len(data[start:i]) < 1 { + return 0, nil + } + + idx := &ast.Index{} + + idx.ID = fmt.Sprintf("idxref:%d", p.indexCnt) + p.indexCnt++ + + idx.Primary = data[start] == '!' + buf := data[start:i] + + if idx.Primary { + buf = buf[1:] + } + items := bytes.Split(buf, []byte(",")) + switch len(items) { + case 1: + idx.Item = bytes.TrimSpace(items[0]) + return i + 1, idx + case 2: + idx.Item = bytes.TrimSpace(items[0]) + idx.Subitem = bytes.TrimSpace(items[1]) + return i + 1, idx + } + } + + return 0, nil +} diff --git a/vendor/github.com/gomarkdown/markdown/todo.md b/vendor/github.com/gomarkdown/markdown/todo.md new file mode 100644 index 000000000..be8bb55c6 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/todo.md @@ -0,0 +1,7 @@ +# Things to do + +[ ] docs: add examples like https://godoc.org/github.com/dgrijalva/jwt-go (put in foo_example_test.go). Or see https://github.com/garyburd/redigo/blob/master/redis/zpop_example_test.go#L5 / https://godoc.org/github.com/garyburd/redigo/redis or https://godoc.org/github.com/go-redis/redis + +[ ] figure out expandTabs and parser.TabSizeEight. Are those used? + +[ ] SoftbreakData is not used diff --git a/vendor/github.com/gomarkdown/markdown/tracking-perf.md b/vendor/github.com/gomarkdown/markdown/tracking-perf.md new file mode 100644 index 000000000..40b951830 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/tracking-perf.md @@ -0,0 +1,189 @@ +## Tracking perf changes + +Initial performance: +``` +goos: darwin +goarch: amd64 +pkg: github.com/gomarkdown/markdown +BenchmarkEscapeHTML-8 2000000 823 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 5033 ns/op 9872 B/op 56 allocs/op +BenchmarkReferenceAmps-8 100000 19538 ns/op 26776 B/op 150 allocs/op +BenchmarkReferenceAutoLinks-8 100000 17574 ns/op 24544 B/op 132 allocs/op +BenchmarkReferenceBackslashEscapes-8 30000 50977 ns/op 76752 B/op 243 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 8546 ns/op 12864 B/op 65 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 9000 ns/op 14912 B/op 70 allocs/op +BenchmarkReferenceCodeSpans-8 200000 8856 ns/op 14992 B/op 69 allocs/op +BenchmarkReferenceHardWrappedPara-8 200000 6599 ns/op 11312 B/op 57 allocs/op +BenchmarkReferenceHorizontalRules-8 100000 15483 ns/op 23536 B/op 98 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 200000 6839 ns/op 12150 B/op 62 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 100000 19940 ns/op 28488 B/op 117 allocs/op +BenchmarkReferenceInlineHTMLComments-8 200000 7455 ns/op 13440 B/op 64 allocs/op +BenchmarkReferenceLinksInline-8 100000 16425 ns/op 23664 B/op 147 allocs/op +BenchmarkReferenceLinksReference-8 30000 54895 ns/op 66464 B/op 416 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 17647 ns/op 23776 B/op 158 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 200000 9367 ns/op 14832 B/op 95 allocs/op +BenchmarkReferenceMarkdownBasics-8 10000 129772 ns/op 130848 B/op 378 allocs/op +BenchmarkReferenceMarkdownSyntax-8 3000 502365 ns/op 461411 B/op 1411 allocs/op +BenchmarkReferenceNestedBlockquotes-8 200000 7028 ns/op 12688 B/op 64 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 20000 79686 ns/op 107520 B/op 374 allocs/op +BenchmarkReferenceStrongAndEm-8 200000 10020 ns/op 17792 B/op 78 allocs/op +BenchmarkReferenceTabs-8 200000 12025 ns/op 18224 B/op 81 allocs/op +BenchmarkReferenceTidyness-8 200000 8985 ns/op 14432 B/op 71 allocs/op +PASS +ok github.com/gomarkdown/markdown 45.375s +``` + +After switching to using interface{} for Node.Data: +``` +BenchmarkEscapeHTML-8 2000000 929 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 5126 ns/op 9248 B/op 56 allocs/op +BenchmarkReferenceAmps-8 100000 19927 ns/op 17880 B/op 154 allocs/op +BenchmarkReferenceAutoLinks-8 100000 20732 ns/op 17360 B/op 141 allocs/op +BenchmarkReferenceBackslashEscapes-8 30000 50267 ns/op 38128 B/op 244 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 8988 ns/op 10912 B/op 67 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 8611 ns/op 12256 B/op 74 allocs/op +BenchmarkReferenceCodeSpans-8 200000 8256 ns/op 11248 B/op 69 allocs/op +BenchmarkReferenceHardWrappedPara-8 200000 6739 ns/op 9856 B/op 57 allocs/op +BenchmarkReferenceHorizontalRules-8 100000 15503 ns/op 15600 B/op 104 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 200000 6874 ns/op 10278 B/op 62 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 100000 22271 ns/op 18552 B/op 121 allocs/op +BenchmarkReferenceInlineHTMLComments-8 200000 8315 ns/op 10736 B/op 64 allocs/op +BenchmarkReferenceLinksInline-8 100000 16155 ns/op 16912 B/op 152 allocs/op +BenchmarkReferenceLinksReference-8 30000 52387 ns/op 38192 B/op 445 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 17111 ns/op 16592 B/op 167 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 200000 9164 ns/op 12048 B/op 97 allocs/op +BenchmarkReferenceMarkdownBasics-8 10000 129262 ns/op 87264 B/op 416 allocs/op +BenchmarkReferenceMarkdownSyntax-8 3000 496873 ns/op 293906 B/op 1559 allocs/op +BenchmarkReferenceNestedBlockquotes-8 200000 6854 ns/op 10192 B/op 64 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 20000 79633 ns/op 55024 B/op 447 allocs/op +BenchmarkReferenceStrongAndEm-8 200000 9637 ns/op 12176 B/op 78 allocs/op +BenchmarkReferenceTabs-8 100000 12164 ns/op 13776 B/op 87 allocs/op +BenchmarkReferenceTidyness-8 200000 8677 ns/op 11296 B/op 75 allocs/op +``` + +Not necessarily faster, but uses less bytes per op (but sometimes more allocs). + +After tweaking the API: +``` +$ ./s/run-bench.sh + +go test -bench=. -test.benchmem +goos: darwin +goarch: amd64 +pkg: github.com/gomarkdown/markdown +BenchmarkEscapeHTML-8 2000000 834 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 3486 ns/op 6160 B/op 27 allocs/op +BenchmarkReferenceAmps-8 100000 18158 ns/op 14792 B/op 125 allocs/op +BenchmarkReferenceAutoLinks-8 100000 16824 ns/op 14272 B/op 112 allocs/op +BenchmarkReferenceBackslashEscapes-8 30000 44066 ns/op 35040 B/op 215 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 6868 ns/op 7824 B/op 38 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 7157 ns/op 9168 B/op 45 allocs/op +BenchmarkReferenceCodeSpans-8 200000 6663 ns/op 8160 B/op 40 allocs/op +BenchmarkReferenceHardWrappedPara-8 300000 4821 ns/op 6768 B/op 28 allocs/op +BenchmarkReferenceHorizontalRules-8 100000 13033 ns/op 12512 B/op 75 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 300000 4998 ns/op 7190 B/op 33 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 100000 17696 ns/op 15464 B/op 92 allocs/op +BenchmarkReferenceInlineHTMLComments-8 300000 5506 ns/op 7648 B/op 35 allocs/op +BenchmarkReferenceLinksInline-8 100000 14450 ns/op 13824 B/op 123 allocs/op +BenchmarkReferenceLinksReference-8 30000 52561 ns/op 35104 B/op 416 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 15616 ns/op 13504 B/op 138 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 200000 7772 ns/op 8960 B/op 68 allocs/op +BenchmarkReferenceMarkdownBasics-8 10000 121436 ns/op 84176 B/op 387 allocs/op +BenchmarkReferenceMarkdownSyntax-8 3000 487404 ns/op 290818 B/op 1530 allocs/op +BenchmarkReferenceNestedBlockquotes-8 300000 5098 ns/op 7104 B/op 35 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 20000 74422 ns/op 51936 B/op 418 allocs/op +BenchmarkReferenceStrongAndEm-8 200000 7888 ns/op 9088 B/op 49 allocs/op +BenchmarkReferenceTabs-8 200000 10061 ns/op 10688 B/op 58 allocs/op +BenchmarkReferenceTidyness-8 200000 7152 ns/op 8208 B/op 46 allocs/op +ok github.com/gomarkdown/markdown 40.809s +``` + +After refactoring Renderer: +``` +BenchmarkEscapeHTML-8 2000000 883 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 3717 ns/op 6208 B/op 29 allocs/op +BenchmarkReferenceAmps-8 100000 19135 ns/op 14680 B/op 123 allocs/op +BenchmarkReferenceAutoLinks-8 100000 17142 ns/op 14176 B/op 110 allocs/op +BenchmarkReferenceBackslashEscapes-8 30000 54616 ns/op 35088 B/op 217 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 7993 ns/op 7872 B/op 40 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 8285 ns/op 9216 B/op 47 allocs/op +BenchmarkReferenceCodeSpans-8 200000 7684 ns/op 8208 B/op 42 allocs/op +BenchmarkReferenceHardWrappedPara-8 200000 5595 ns/op 6816 B/op 30 allocs/op +BenchmarkReferenceHorizontalRules-8 100000 16444 ns/op 12560 B/op 77 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 200000 5415 ns/op 7238 B/op 35 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 100000 19867 ns/op 15512 B/op 94 allocs/op +BenchmarkReferenceInlineHTMLComments-8 200000 6026 ns/op 7696 B/op 37 allocs/op +BenchmarkReferenceLinksInline-8 100000 14864 ns/op 13664 B/op 120 allocs/op +BenchmarkReferenceLinksReference-8 30000 52479 ns/op 34816 B/op 401 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 15812 ns/op 13472 B/op 135 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 200000 7767 ns/op 8880 B/op 68 allocs/op +BenchmarkReferenceMarkdownBasics-8 10000 131065 ns/op 84048 B/op 386 allocs/op +BenchmarkReferenceMarkdownSyntax-8 2000 515604 ns/op 289953 B/op 1501 allocs/op +BenchmarkReferenceNestedBlockquotes-8 200000 5655 ns/op 7152 B/op 37 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 20000 84188 ns/op 51984 B/op 420 allocs/op +BenchmarkReferenceStrongAndEm-8 200000 8664 ns/op 9136 B/op 51 allocs/op +BenchmarkReferenceTabs-8 100000 11110 ns/op 10736 B/op 60 allocs/op +BenchmarkReferenceTidyness-8 200000 7628 ns/op 8256 B/op 48 allocs/op +ok github.com/gomarkdown/markdown 40.841s +``` + +After Node refactor to have Children array: +``` +BenchmarkEscapeHTML-8 2000000 901 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 3905 ns/op 6224 B/op 31 allocs/op +BenchmarkReferenceAmps-8 100000 22216 ns/op 15560 B/op 157 allocs/op +BenchmarkReferenceAutoLinks-8 100000 20335 ns/op 14824 B/op 146 allocs/op +BenchmarkReferenceBackslashEscapes-8 20000 69174 ns/op 37392 B/op 316 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 8443 ns/op 7968 B/op 48 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 9250 ns/op 9392 B/op 58 allocs/op +BenchmarkReferenceCodeSpans-8 200000 8515 ns/op 8432 B/op 54 allocs/op +BenchmarkReferenceHardWrappedPara-8 200000 5738 ns/op 6856 B/op 34 allocs/op +BenchmarkReferenceHorizontalRules-8 100000 20864 ns/op 13648 B/op 93 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 200000 6187 ns/op 7310 B/op 40 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 50000 23793 ns/op 16128 B/op 114 allocs/op +BenchmarkReferenceInlineHTMLComments-8 200000 7060 ns/op 7840 B/op 44 allocs/op +BenchmarkReferenceLinksInline-8 100000 18432 ns/op 14496 B/op 153 allocs/op +BenchmarkReferenceLinksReference-8 20000 67666 ns/op 37136 B/op 502 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 19324 ns/op 13984 B/op 162 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 200000 8998 ns/op 9320 B/op 83 allocs/op +BenchmarkReferenceMarkdownBasics-8 10000 160908 ns/op 88152 B/op 518 allocs/op +BenchmarkReferenceMarkdownSyntax-8 2000 707160 ns/op 303801 B/op 2044 allocs/op +BenchmarkReferenceNestedBlockquotes-8 200000 6740 ns/op 7248 B/op 45 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 10000 115808 ns/op 55052 B/op 626 allocs/op +BenchmarkReferenceStrongAndEm-8 100000 10540 ns/op 9416 B/op 72 allocs/op +BenchmarkReferenceTabs-8 100000 13171 ns/op 10968 B/op 77 allocs/op +BenchmarkReferenceTidyness-8 200000 8903 ns/op 8404 B/op 62 allocs/op +PASS +ok github.com/gomarkdown/markdown 43.477s +``` +It's slower (but opens up possibilities for further improvements). + +After refactoring to make ast.Node a top-level thing. +``` +BenchmarkEscapeHTML-8 2000000 829 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 3998 ns/op 6192 B/op 31 allocs/op +BenchmarkReferenceAmps-8 50000 27389 ns/op 15480 B/op 153 allocs/op +BenchmarkReferenceAutoLinks-8 50000 23106 ns/op 14656 B/op 137 allocs/op +BenchmarkReferenceBackslashEscapes-8 10000 112435 ns/op 36696 B/op 315 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 9227 ns/op 7856 B/op 46 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 10469 ns/op 9248 B/op 54 allocs/op +BenchmarkReferenceCodeSpans-8 200000 10522 ns/op 8368 B/op 54 allocs/op +BenchmarkReferenceHardWrappedPara-8 200000 6354 ns/op 6784 B/op 34 allocs/op +BenchmarkReferenceHorizontalRules-8 50000 32393 ns/op 13952 B/op 87 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 200000 6894 ns/op 7238 B/op 40 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 50000 32942 ns/op 15864 B/op 110 allocs/op +BenchmarkReferenceInlineHTMLComments-8 200000 8181 ns/op 7776 B/op 44 allocs/op +BenchmarkReferenceLinksInline-8 100000 21679 ns/op 14400 B/op 148 allocs/op +BenchmarkReferenceLinksReference-8 20000 83928 ns/op 36688 B/op 473 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 22053 ns/op 13872 B/op 153 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 100000 10784 ns/op 9296 B/op 81 allocs/op +BenchmarkReferenceMarkdownBasics-8 5000 237097 ns/op 87760 B/op 480 allocs/op +BenchmarkReferenceMarkdownSyntax-8 1000 1465402 ns/op 300769 B/op 1896 allocs/op +BenchmarkReferenceNestedBlockquotes-8 200000 7461 ns/op 7152 B/op 45 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 5000 212256 ns/op 53724 B/op 553 allocs/op +BenchmarkReferenceStrongAndEm-8 100000 13018 ns/op 9264 B/op 72 allocs/op +BenchmarkReferenceTabs-8 100000 15005 ns/op 10752 B/op 71 allocs/op +BenchmarkReferenceTidyness-8 200000 10308 ns/op 8292 B/op 58 allocs/op +PASS +ok github.com/gomarkdown/markdown 42.176s +``` diff --git a/vendor/github.com/gookit/color/.gitignore b/vendor/github.com/gookit/color/.gitignore new file mode 100644 index 000000000..5efa5e3f0 --- /dev/null +++ b/vendor/github.com/gookit/color/.gitignore @@ -0,0 +1,20 @@ +*.log +*.swp +.idea +*.patch +### Go template +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out +.DS_Store +app +demo diff --git a/vendor/github.com/gookit/color/.nojekyll b/vendor/github.com/gookit/color/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/gookit/color/LICENSE b/vendor/github.com/gookit/color/LICENSE new file mode 100644 index 000000000..d839cdc1a --- /dev/null +++ b/vendor/github.com/gookit/color/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2016 inhere + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/gookit/color/README.md b/vendor/github.com/gookit/color/README.md new file mode 100644 index 000000000..718b11b58 --- /dev/null +++ b/vendor/github.com/gookit/color/README.md @@ -0,0 +1,579 @@ +# CLI Color + +![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/gookit/color?style=flat-square) +[![Actions Status](https://github.com/gookit/color/workflows/action-tests/badge.svg)](https://github.com/gookit/color/actions) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/7fef8d74c1d64afc99ce0f2c6d3f8af1)](https://www.codacy.com/gh/gookit/color/dashboard?utm_source=github.com&utm_medium=referral&utm_content=gookit/color&utm_campaign=Badge_Grade) +[![GoDoc](https://godoc.org/github.com/gookit/color?status.svg)](https://pkg.go.dev/github.com/gookit/color?tab=overview) +[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/gookit/color)](https://github.com/gookit/color) +[![Build Status](https://travis-ci.org/gookit/color.svg?branch=master)](https://travis-ci.org/gookit/color) +[![Coverage Status](https://coveralls.io/repos/github/gookit/color/badge.svg?branch=master)](https://coveralls.io/github/gookit/color?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/gookit/color)](https://goreportcard.com/report/github.com/gookit/color) + +A command-line color library with 16/256/True color support, universal API methods and Windows support. + +> **[中文说明](README.zh-CN.md)** + +Basic color preview: + +![basic-color](_examples/images/basic-color2.png) + +Now, 256 colors and RGB colors have also been supported to work in Windows CMD and PowerShell: + +![color-on-cmd-pwsh](_examples/images/color-on-cmd-pwsh.jpg) + +## Features + + - Simple to use, zero dependencies + - Supports rich color output: 16-color (4-bit), 256-color (8-bit), true color (24-bit, RGB) + - 16-color output is the most commonly used and most widely supported, working on any Windows version + - Since `v1.2.4` **the 256-color (8-bit), true color (24-bit) support windows CMD and PowerShell** + - See [this gist](https://gist.github.com/XVilka/8346728) for information on true color support + - Support converts `HEX` `HSL` value to RGB color + - Generic API methods: `Print`, `Printf`, `Println`, `Sprint`, `Sprintf` + - Supports HTML tag-style color rendering, such as `message text`. + - In addition to using built-in tags, it also supports custom color attributes + - Custom color attributes support the use of 16 color names, 256 color values, rgb color values and hex color values + - Support working on Windows `cmd` and `powerShell` terminal + - Basic colors: `Bold`, `Black`, `White`, `Gray`, `Red`, `Green`, `Yellow`, `Blue`, `Magenta`, `Cyan` + - Additional styles: `Info`, `Note`, `Light`, `Error`, `Danger`, `Notice`, `Success`, `Comment`, `Primary`, `Warning`, `Question`, `Secondary` + - Support by set `NO_COLOR` for disable color or use `FORCE_COLOR` for force open color render. + - Support Rgb, 256, 16 color conversion + +## GoDoc + + - [godoc for gopkg](https://pkg.go.dev/gopkg.in/gookit/color.v1) + - [godoc for github](https://pkg.go.dev/github.com/gookit/color) + +## Install + +```bash +go get github.com/gookit/color +``` + +## Quick start + +```go +package main + +import ( + "fmt" + + "github.com/gookit/color" +) + +func main() { + // quick use package func + color.Redp("Simple to use color") + color.Redln("Simple to use color") + color.Greenp("Simple to use color\n") + color.Cyanln("Simple to use color") + color.Yellowln("Simple to use color") + + // quick use like fmt.Print* + color.Red.Println("Simple to use color") + color.Green.Print("Simple to use color\n") + color.Cyan.Printf("Simple to use %s\n", "color") + color.Yellow.Printf("Simple to use %s\n", "color") + + // use like func + red := color.FgRed.Render + green := color.FgGreen.Render + fmt.Printf("%s line %s library\n", red("Command"), green("color")) + + // custom color + color.New(color.FgWhite, color.BgBlack).Println("custom color style") + + // can also: + color.Style{color.FgCyan, color.OpBold}.Println("custom color style") + + // internal theme/style: + color.Info.Tips("message") + color.Info.Prompt("message") + color.Info.Println("message") + color.Warn.Println("message") + color.Error.Println("message") + + // use style tag + color.Print("hello, welcome\n") + // Custom label attr: Supports the use of 16 color names, 256 color values, rgb color values and hex color values + color.Println("hello, welcome") + + // apply a style tag + color.Tag("info").Println("info style text") + + // prompt message + color.Info.Prompt("prompt style message") + color.Warn.Prompt("prompt style message") + + // tips message + color.Info.Tips("tips style message") + color.Warn.Tips("tips style message") +} +``` + +Run demo: `go run ./_examples/demo.go` + +![colored-out](_examples/images/color-demo.jpg) + +## Basic/16 color + +Supported on any Windows version. Provide generic API methods: `Print`, `Printf`, `Println`, `Sprint`, `Sprintf` + +```go +color.Bold.Println("bold message") +color.Cyan.Println("yellow message") +color.Yellow.Println("yellow message") +color.Magenta.Println("yellow message") + +// Only use foreground color +color.FgCyan.Printf("Simple to use %s\n", "color") +// Only use background color +color.BgRed.Printf("Simple to use %s\n", "color") +``` + +Run demo: `go run ./_examples/color_16.go` + +![basic-color](_examples/images/basic-color.png) + +### Custom build color + +```go +// Full custom: foreground, background, option +myStyle := color.New(color.FgWhite, color.BgBlack, color.OpBold) +myStyle.Println("custom color style") + +// can also: +color.Style{color.FgCyan, color.OpBold}.Println("custom color style") +``` + +custom set console settings: + +```go +// set console color +color.Set(color.FgCyan) + +// print message +fmt.Print("message") + +// reset console settings +color.Reset() +``` + +### Additional styles + +provide generic API methods: `Print`, `Printf`, `Println`, `Sprint`, `Sprintf` + +print message use defined style: + +```go +color.Info.Println("Info message") +color.Notice.Println("Notice message") +color.Error.Println("Error message") +// ... +``` + +Run demo: `go run ./_examples/theme_basic.go` + +![theme-basic](_examples/images/theme-basic.png) + +**Tips style** + +```go +color.Info.Tips("Info tips message") +color.Notice.Tips("Notice tips message") +color.Error.Tips("Error tips message") +color.Secondary.Tips("Secondary tips message") +``` + +Run demo: `go run ./_examples/theme_tips.go` + +![theme-tips](_examples/images/theme-tips.png) + +**Prompt Style** + +```go +color.Info.Prompt("Info prompt message") +color.Notice.Prompt("Notice prompt message") +color.Error.Prompt("Error prompt message") +// ... +``` + +Run demo: `go run ./_examples/theme_prompt.go` + +![theme-prompt](_examples/images/theme-prompt.png) + +**Block Style** + +```go +color.Danger.Block("Danger block message") +color.Warn.Block("Warn block message") +// ... +``` + +Run demo: `go run ./_examples/theme_block.go` + +![theme-block](_examples/images/theme-block.png) + +## 256-color usage + +> 256 colors support Windows CMD, PowerShell environment after `v1.2.4` + +### Set the foreground or background color + +- `color.C256(val uint8, isBg ...bool) Color256` + +```go +c := color.C256(132) // fg color +c.Println("message") +c.Printf("format %s", "message") + +c := color.C256(132, true) // bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +### 256-color style + +Can be used to set foreground and background colors at the same time. + +- `S256(fgAndBg ...uint8) *Style256` + +```go +s := color.S256(32, 203) +s.Println("message") +s.Printf("format %s", "message") +``` + +with options: + +```go +s := color.S256(32, 203) +s.SetOpts(color.Opts{color.OpBold}) + +s.Println("style with options") +s.Printf("style with %s\n", "options") +``` + +Run demo: `go run ./_examples/color_256.go` + +![color-tags](_examples/images/color-256.png) + +## RGB/True color + +> RGB colors support Windows `CMD`, `PowerShell` environment after `v1.2.4` + +**Preview:** + +> Run demo: `Run demo: go run ./_examples/color_rgb.go` + +![color-rgb](_examples/images/color-rgb.png) + +example: + +```go +color.RGB(30, 144, 255).Println("message. use RGB number") + +color.HEX("#1976D2").Println("blue-darken") +color.HEX("#D50000", true).Println("red-accent. use HEX style") + +color.RGBStyleFromString("213,0,0").Println("red-accent. use RGB number") +color.HEXStyle("eee", "D50000").Println("deep-purple color") +``` + +### Set the foreground or background color + +- `color.RGB(r, g, b uint8, isBg ...bool) RGBColor` + +```go +c := color.RGB(30,144,255) // fg color +c.Println("message") +c.Printf("format %s", "message") + +c := color.RGB(30,144,255, true) // bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +Create a style from an hexadecimal color string: + +- `color.HEX(hex string, isBg ...bool) RGBColor` + +```go +c := color.HEX("ccc") // can also: "cccccc" "#cccccc" +c.Println("message") +c.Printf("format %s", "message") + +c = color.HEX("aabbcc", true) // as bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +### RGB color style + +Can be used to set the foreground and background colors at the same time. + +- `color.NewRGBStyle(fg RGBColor, bg ...RGBColor) *RGBStyle` + +```go +s := color.NewRGBStyle(RGB(20, 144, 234), RGB(234, 78, 23)) +s.Println("message") +s.Printf("format %s", "message") +``` + +Create a style from an hexadecimal color string: + +- `color.HEXStyle(fg string, bg ...string) *RGBStyle` + +```go +s := color.HEXStyle("11aa23", "eee") +s.Println("message") +s.Printf("format %s", "message") +``` + +with options: + +```go +s := color.HEXStyle("11aa23", "eee") +s.SetOpts(color.Opts{color.OpBold}) + +s.Println("style with options") +s.Printf("style with %s\n", "options") +``` + +## HTML-like tag usage + +`Print,Printf,Println` functions support auto parse and render color tags. + +```go + text := ` + gookit/color: + A command-line + color library with 256-color + and True-color support, + universal API methods + and Windows support. +` + color.Print(text) +``` + +Preview, code please see [_examples/demo_tag.go](_examples/demo_tag.go): + +![demo_tag](_examples/images/demo_tag.png) + +**Tag formats:** + +- Use built in tags: `CONTENT` e.g: `message` +- Custom tag attributes: `CONTENT` e.g: `wel` + +> **Supported** on Windows `cmd.exe` `PowerShell`. + +Examples: + +```go +// use style tag +color.Print("hello, welcome") +color.Println("hello") +color.Println("hello") +color.Println("hello") + +// custom color attributes +color.Print("hello, welcome\n") + +// Custom label attr: Supports the use of 16 color names, 256 color values, rgb color values and hex color values +color.Println("hello, welcome") +``` + +### Tag attributes + +tag attributes format: + +```text +attr format: + // VALUE please see var: FgColors, BgColors, AllOptions + "fg=VALUE;bg=VALUE;op=VALUE" + +16 color: + "fg=yellow" + "bg=red" + "op=bold,underscore" // option is allow multi value + "fg=white;bg=blue;op=bold" + "fg=white;op=bold,underscore" + +256 color: + "fg=167" + "fg=167;bg=23" + "fg=167;bg=23;op=bold" + +True color: + // hex + "fg=fc1cac" + "fg=fc1cac;bg=c2c3c4" + // r,g,b + "fg=23,45,214" + "fg=23,45,214;bg=109,99,88" +``` + +> tag attributes parse please see `func ParseCodeFromAttr()` + +### Built-in tags + +Built-in tags please see var `colorTags` in [color_tag.go](color_tag.go) + +```go +// use style tag +color.Print("hello, welcome") +color.Println("hello") +color.Println("hello") +``` + +Run demo: `go run ./_examples/color_tag.go` + +![color-tags](_examples/images/color-tags.png) + +**Use `color.Tag` build message**: + +```go +// set a style tag +color.Tag("info").Print("info style text") +color.Tag("info").Printf("%s style text", "info") +color.Tag("info").Println("info style text") +``` + +## Color convert + +Supports conversion between Rgb, 256, 16 colors, `Rgb <=> 256 <=> 16` + +```go +basic := color.Red +basic.Println("basic color") + +c256 := color.Red.C256() +c256.Println("256 color") +c256.C16().Println("basic color") + +rgb := color.Red.RGB() +rgb.Println("rgb color") +rgb.C256().Println("256 color") +``` + +### Convert utils + +`color` has many built-in color conversion utility functions. + +```go +func Basic2hex(val uint8) string + +func Bg2Fg(val uint8) uint8 +func Fg2Bg(val uint8) uint8 + +func C256ToRgb(val uint8) (rgb []uint8) +func C256ToRgbV1(val uint8) (rgb []uint8) + +func Hex2basic(hex string, asBg ...bool) uint8 +func Hex2rgb(hex string) []int +func HexToRGB(hex string) []int +func HexToRgb(hex string) (rgb []int) + +func HslIntToRgb(h, s, l int) (rgb []uint8) +func HslToRgb(h, s, l float64) (rgb []uint8) +func HsvToRgb(h, s, v int) (rgb []uint8) + +func Rgb2ansi(r, g, b uint8, isBg bool) uint8 +func Rgb2basic(r, g, b uint8, isBg bool) uint8 +func Rgb2hex(rgb []int) string +func Rgb2short(r, g, b uint8) uint8 +func RgbTo256(r, g, b uint8) uint8 +func RgbTo256Table() map[string]uint8 +func RgbToAnsi(r, g, b uint8, isBg bool) uint8 +func RgbToHex(rgb []int) string +func RgbToHsl(r, g, b uint8) []float64 +func RgbToHslInt(r, g, b uint8) []int +``` + +**Convert to `RGBColor`**: + +- `func RGBFromSlice(rgb []uint8, isBg ...bool) RGBColor` +- `func RGBFromString(rgb string, isBg ...bool) RGBColor` +- `func HEX(hex string, isBg ...bool) RGBColor` +- `func HSL(h, s, l float64, isBg ...bool) RGBColor` +- `func HSLInt(h, s, l int, isBg ...bool) RGBColor` + +## Util functions + +There are some useful functions reference + +- `Disable()` disable color render +- `SetOutput(io.Writer)` custom set the colored text output writer +- `ForceOpenColor()` force open color render +- `Colors2code(colors ...Color) string` Convert colors to code. return like "32;45;3" +- `ClearCode(str string) string` Use for clear color codes +- `ClearTag(s string) string` clear all color html-tag for a string +- `IsConsole(w io.Writer)` Determine whether w is one of stderr, stdout, stdin + +> More useful func please see https://pkg.go.dev/github.com/gookit/color + +### Detect color level + +`color` automatically checks the color levels supported by the current environment. + +```go +// Level is the color level supported by a terminal. +type Level = terminfo.ColorLevel + +// terminal color available level alias of the terminfo.ColorLevel* +const ( + LevelNo = terminfo.ColorLevelNone // not support color. + Level16 = terminfo.ColorLevelBasic // basic - 3/4 bit color supported + Level256 = terminfo.ColorLevelHundreds // hundreds - 8-bit color supported + LevelRgb = terminfo.ColorLevelMillions // millions - (24 bit)true color supported +) +``` + +- `func SupportColor() bool` Whether the current environment supports color output +- `func Support256Color() bool` Whether the current environment supports 256-color output +- `func SupportTrueColor() bool` Whether the current environment supports (RGB)True-color output +- `func TermColorLevel() Level` Get the currently supported color level + + +## Projects using color + +Check out these projects, which use https://github.com/gookit/color : + +- https://github.com/Delta456/box-cli-maker Make Highly Customized Boxes for your CLI +- https://github.com/flipped-aurora/gin-vue-admin 基于gin+vue搭建的(中)后台系统框架 +- https://github.com/JanDeDobbeleer/oh-my-posh A prompt theme engine for any shell. +- https://github.com/jesseduffield/lazygit Simple terminal UI for git commands +- https://github.com/olivia-ai/olivia 💁‍♀️Your new best friend powered by an artificial neural network +- https://github.com/pterm/pterm PTerm is a modern Go module to beautify console output. Featuring charts, progressbars, tables, trees, etc. +- https://github.com/securego/gosec Golang security checker +- https://github.com/TNK-Studio/lazykube ⎈ The lazier way to manage kubernetes. +- [+ See More](https://pkg.go.dev/github.com/gookit/color?tab=importedby) + +## Gookit packages + + - [gookit/ini](https://github.com/gookit/ini) Go config management, use INI files + - [gookit/rux](https://github.com/gookit/rux) Simple and fast request router for golang HTTP + - [gookit/gcli](https://github.com/gookit/gcli) build CLI application, tool library, running CLI commands + - [gookit/slog](https://github.com/gookit/slog) Concise and extensible go log library + - [gookit/event](https://github.com/gookit/event) Lightweight event manager and dispatcher implements by Go + - [gookit/cache](https://github.com/gookit/cache) Generic cache use and cache manager for golang. support File, Memory, Redis, Memcached. + - [gookit/config](https://github.com/gookit/config) Go config management. support JSON, YAML, TOML, INI, HCL, ENV and Flags + - [gookit/color](https://github.com/gookit/color) A command-line color library with true color support, universal API methods and Windows support + - [gookit/filter](https://github.com/gookit/filter) Provide filtering, sanitizing, and conversion of golang data + - [gookit/validate](https://github.com/gookit/validate) Use for data validation and filtering. support Map, Struct, Form data + - [gookit/goutil](https://github.com/gookit/goutil) Some utils for the Go: string, array/slice, map, format, cli, env, filesystem, test and more + - More, please see https://github.com/gookit + +## See also + + - [inhere/console](https://github.com/inhere/php-console) + - [xo/terminfo](https://github.com/xo/terminfo) + - [beego/bee](https://github.com/beego/bee) + - [issue9/term](https://github.com/issue9/term) + - [ANSI escape code](https://en.wikipedia.org/wiki/ANSI_escape_code) + - [Standard ANSI color map](https://conemu.github.io/en/AnsiEscapeCodes.html#Standard_ANSI_color_map) + - [Terminal Colors](https://gist.github.com/XVilka/8346728) + +## License + +[MIT](/LICENSE) diff --git a/vendor/github.com/gookit/color/README.zh-CN.md b/vendor/github.com/gookit/color/README.zh-CN.md new file mode 100644 index 000000000..1b144058e --- /dev/null +++ b/vendor/github.com/gookit/color/README.zh-CN.md @@ -0,0 +1,590 @@ +# CLI Color + +![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/gookit/color?style=flat-square) +[![Actions Status](https://github.com/gookit/color/workflows/action-tests/badge.svg)](https://github.com/gookit/color/actions) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/7fef8d74c1d64afc99ce0f2c6d3f8af1)](https://www.codacy.com/gh/gookit/color/dashboard?utm_source=github.com&utm_medium=referral&utm_content=gookit/color&utm_campaign=Badge_Grade) +[![GoDoc](https://godoc.org/github.com/gookit/color?status.svg)](https://pkg.go.dev/github.com/gookit/color?tab=overview) +[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/gookit/color)](https://github.com/gookit/color) +[![Build Status](https://travis-ci.org/gookit/color.svg?branch=master)](https://travis-ci.org/gookit/color) +[![Coverage Status](https://coveralls.io/repos/github/gookit/color/badge.svg?branch=master)](https://coveralls.io/github/gookit/color?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/gookit/color)](https://goreportcard.com/report/github.com/gookit/color) + +Golang下的命令行色彩使用库, 拥有丰富的色彩(16/256/True)渲染输出,通用的API方法,兼容Windows系统 + +> **[EN README](README.md)** + +基本颜色预览: + +![basic-color](_examples/images/basic-color2.png) + +现在,256色和RGB色彩也已经支持windows CMD和PowerShell中工作: + +![color-on-cmd-pwsh](_examples/images/color-on-cmd-pwsh.jpg) + +## 功能特色 + + - 使用简单方便 + - 支持丰富的颜色输出, 16色(4bit),256色(8bit),RGB色彩(24bit, RGB) + - 16色(4bit)是最常用和支持最广的,支持Windows `cmd.exe` + - 自 `v1.2.4` 起 **256色(8bit),RGB色彩(24bit)均支持Windows CMD和PowerShell终端** + - 请查看 [this gist](https://gist.github.com/XVilka/8346728) 了解支持RGB色彩的终端 + - 支持转换 `HEX` `HSL` 等为RGB色彩 + - 提供通用的API方法:`Print` `Printf` `Println` `Sprint` `Sprintf` + - 同时支持html标签式的颜色渲染,除了使用内置标签,同时支持自定义颜色属性 + - 例如: `this an message text` 标签内部文本将会渲染对应色彩 + - 自定义颜色属性: 支持使用16色彩名称,256色彩值,rgb色彩值以及hex色彩值 + - 基础色彩: `Bold` `Black` `White` `Gray` `Red` `Green` `Yellow` `Blue` `Magenta` `Cyan` + - 扩展风格: `Info` `Note` `Light` `Error` `Danger` `Notice` `Success` `Comment` `Primary` `Warning` `Question` `Secondary` + - 支持通过设置环境变量 `NO_COLOR` 来禁用色彩,或者使用 `FORCE_COLOR` 来强制使用色彩渲染. + - 支持 Rgb, 256, 16 色彩之间的互相转换 + - 支持Linux、Mac,同时兼容Windows系统环境 + +## GoDoc + + - [godoc for gopkg](https://pkg.go.dev/gopkg.in/gookit/color.v1) + - [godoc for github](https://pkg.go.dev/github.com/gookit/color) + +## 安装 + +```bash +go get github.com/gookit/color +``` + +## 快速开始 + +如下,引入当前包就可以快速的使用 + +```go +package main + +import ( + "fmt" + + "github.com/gookit/color" +) + +func main() { + // 简单快速的使用,跟 fmt.Print* 类似 + color.Redp("Simple to use color") + color.Redln("Simple to use color") + color.Greenp("Simple to use color\n") + color.Cyanln("Simple to use color") + color.Yellowln("Simple to use color") + + // 简单快速的使用,跟 fmt.Print* 类似 + color.Red.Println("Simple to use color") + color.Green.Print("Simple to use color\n") + color.Cyan.Printf("Simple to use %s\n", "color") + color.Yellow.Printf("Simple to use %s\n", "color") + + // use like func + red := color.FgRed.Render + green := color.FgGreen.Render + fmt.Printf("%s line %s library\n", red("Command"), green("color")) + + // 自定义颜色 + color.New(color.FgWhite, color.BgBlack).Println("custom color style") + + // 也可以: + color.Style{color.FgCyan, color.OpBold}.Println("custom color style") + + // internal style: + color.Info.Println("message") + color.Warn.Println("message") + color.Error.Println("message") + + // 使用内置颜色标签 + color.Print("hello, welcome\n") + // 自定义标签: 支持使用16色彩名称,256色彩值,rgb色彩值以及hex色彩值 + color.Println("hello, welcome") + + // apply a style tag + color.Tag("info").Println("info style text") + + // prompt message + color.Info.Prompt("prompt style message") + color.Warn.Prompt("prompt style message") + + // tips message + color.Info.Tips("tips style message") + color.Warn.Tips("tips style message") +} +``` + +> 运行 demo: `go run ./_examples/demo.go` + +![colored-out](_examples/images/color-demo.jpg) + +## 基础颜色(16-color) + +提供通用的API方法:`Print` `Printf` `Println` `Sprint` `Sprintf` + +> 支持在windows `cmd.exe` `powerShell` 等终端使用 + +```go +color.Bold.Println("bold message") +color.Black.Println("bold message") +color.White.Println("bold message") +// ... + +// Only use foreground color +color.FgCyan.Printf("Simple to use %s\n", "color") +// Only use background color +color.BgRed.Printf("Simple to use %s\n", "color") +``` + +> 运行demo: `go run ./_examples/color_16.go` + +![basic-color](_examples/images/basic-color.png) + +### 构建风格 + +```go +// 仅设置前景色 +color.FgCyan.Printf("Simple to use %s\n", "color") +// 仅设置背景色 +color.BgRed.Printf("Simple to use %s\n", "color") + +// 完全自定义: 前景色 背景色 选项 +style := color.New(color.FgWhite, color.BgBlack, color.OpBold) +style.Println("custom color style") + +// 也可以: +color.Style{color.FgCyan, color.OpBold}.Println("custom color style") +``` + +直接设置控制台属性: + +```go +// 设置console颜色 +color.Set(color.FgCyan) + +// 输出信息 +fmt.Print("message") + +// 重置console颜色 +color.Reset() +``` + +> 当然,color已经内置丰富的色彩风格支持 + +### 扩展风格方法 + +提供通用的API方法:`Print` `Printf` `Println` `Sprint` `Sprintf` + +> 支持在windows `cmd.exe` `powerShell` 等终端使用 + +基础使用: + +```go +// print message +color.Info.Println("Info message") +color.Note.Println("Note message") +color.Notice.Println("Notice message") +// ... +``` + +Run demo: `go run ./_examples/theme_basic.go` + +![theme-basic](_examples/images/theme-basic.png) + +**简约提示风格** + +```go +color.Info.Tips("Info tips message") +color.Notice.Tips("Notice tips message") +color.Error.Tips("Error tips message") +// ... +``` + +Run demo: `go run ./_examples/theme_tips.go` + +![theme-tips](_examples/images/theme-tips.png) + +**着重提示风格** + +```go +color.Info.Prompt("Info prompt message") +color.Error.Prompt("Error prompt message") +color.Danger.Prompt("Danger prompt message") +``` + +Run demo: `go run ./_examples/theme_prompt.go` + +![theme-prompt](_examples/images/theme-prompt.png) + +**强调提示风格** + +```go +color.Warn.Block("Warn block message") +color.Debug.Block("Debug block message") +color.Question.Block("Question block message") +``` + +Run demo: `go run ./_examples/theme_block.go` + +![theme-block](_examples/images/theme-block.png) + +## 256 色彩使用 + +> 256色彩在 `v1.2.4` 后支持Windows CMD,PowerShell 环境 + +### 使用前景或后景色 + +- `color.C256(val uint8, isBg ...bool) Color256` + +```go +c := color.C256(132) // fg color +c.Println("message") +c.Printf("format %s", "message") + +c := color.C256(132, true) // bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +### 使用256 色彩风格 + +> 可同时设置前景和背景色 + +- `color.S256(fgAndBg ...uint8) *Style256` + +```go +s := color.S256(32, 203) +s.Println("message") +s.Printf("format %s", "message") +``` + +可以同时添加选项设置: + +```go +s := color.S256(32, 203) +s.SetOpts(color.Opts{color.OpBold}) + +s.Println("style with options") +s.Printf("style with %s\n", "options") +``` + +> 运行 demo: `go run ./_examples/color_256.go` + +![color-tags](_examples/images/color-256.png) + +## RGB/True色彩使用 + +> RGB色彩在 `v1.2.4` 后支持 Windows `CMD`, `PowerShell` 环境 + +**效果预览:** + +> 运行 demo: `Run demo: go run ./_examples/color_rgb.go` + +![color-rgb](_examples/images/color-rgb.png) + +代码示例: + +```go +color.RGB(30, 144, 255).Println("message. use RGB number") + +color.HEX("#1976D2").Println("blue-darken") +color.HEX("#D50000", true).Println("red-accent. use HEX style") + +color.RGBStyleFromString("213,0,0").Println("red-accent. use RGB number") +color.HEXStyle("eee", "D50000").Println("deep-purple color") +``` + +### 使用前景或后景色 + +- `color.RGB(r, g, b uint8, isBg ...bool) RGBColor` + +```go +c := color.RGB(30,144,255) // fg color +c.Println("message") +c.Printf("format %s", "message") + +c := color.RGB(30,144,255, true) // bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +- `color.HEX(hex string, isBg ...bool) RGBColor` 从16进制颜色创建 + +```go +c := color.HEX("ccc") // 也可以写为: "cccccc" "#cccccc" +c.Println("message") +c.Printf("format %s", "message") + +c = color.HEX("aabbcc", true) // as bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +### 使用RGB风格 + +> TIP: 可同时设置前景和背景色 + +- `color.NewRGBStyle(fg RGBColor, bg ...RGBColor) *RGBStyle` + +```go +s := color.NewRGBStyle(RGB(20, 144, 234), RGB(234, 78, 23)) +s.Println("message") +s.Printf("format %s", "message") +``` + +- `color.HEXStyle(fg string, bg ...string) *RGBStyle` 从16进制颜色创建 + +```go +s := color.HEXStyle("11aa23", "eee") +s.Println("message") +s.Printf("format %s", "message") +``` + +- 可以同时添加选项设置: + +```go +s := color.HEXStyle("11aa23", "eee") +s.SetOpts(color.Opts{color.OpBold}) + +s.Println("style with options") +s.Printf("style with %s\n", "options") +``` + +## 使用颜色标签 + +`Print,Printf,Println` 等方法支持自动解析并渲染 HTML 风格的颜色标签 + +> **支持** 在windows `cmd.exe` `PowerShell` 使用 + +简单示例: + +```go + text := ` + gookit/color: + A command-line + color library with 256-color + and True-color support, + universal API methods + and Windows support. +` + color.Print(text) +``` + +输出效果, 示例代码请看 [_examples/demo_tag.go](_examples/demo_tag.go): + +![demo_tag](_examples/images/demo_tag.png) + +**颜色标签格式:** + +- 直接使用内置风格标签: `CONTENT` e.g: `message` +- 自定义标签属性: `CONTENT` e.g: `wel` + +使用内置的颜色标签,可以非常方便简单的构建自己需要的任何格式 + +> 同时支持自定义颜色属性: 支持使用16色彩名称,256色彩值,rgb色彩值以及hex色彩值 + +```go +// 使用内置的 color tag +color.Print("hello, welcome") +color.Println("hello") +color.Println("hello") +color.Println("hello") + +// 自定义颜色属性 +color.Print("hello, welcome\n") + +// 自定义颜色属性: 支持使用16色彩名称,256色彩值,rgb色彩值以及hex色彩值 +color.Println("hello, welcome") +``` + +### 自定义标签属性 + +标签属性格式: + +```text +attr format: + // VALUE please see var: FgColors, BgColors, AllOptions + "fg=VALUE;bg=VALUE;op=VALUE" + +16 color: + "fg=yellow" + "bg=red" + "op=bold,underscore" // option is allow multi value + "fg=white;bg=blue;op=bold" + "fg=white;op=bold,underscore" + +256 color: + "fg=167" + "fg=167;bg=23" + "fg=167;bg=23;op=bold" + +True color: + // hex + "fg=fc1cac" + "fg=fc1cac;bg=c2c3c4" + // r,g,b + "fg=23,45,214" + "fg=23,45,214;bg=109,99,88" +``` + +> tag attributes parse please see `func ParseCodeFromAttr()` + +### 内置标签 + +内置标签请参见变量 `colorTags` 定义, 源文件 [color_tag.go](color_tag.go) + +```go +// use style tag +color.Print("hello, welcome") +color.Println("hello") +color.Println("hello") +``` + +> 运行 demo: `go run ./_examples/color_tag.go` + +![color-tags](_examples/images/color-tags.png) + +**使用 `color.Tag` 包装标签**: + +可以使用通用的输出API方法,给后面输出的文本信息加上给定的颜色风格标签 + +```go +// set a style tag +color.Tag("info").Print("info style text") +color.Tag("info").Printf("%s style text", "info") +color.Tag("info").Println("info style text") +``` + +## 颜色转换 + +支持 Rgb, 256, 16 色彩之间的互相转换 `Rgb <=> 256 <=> 16` + +```go +basic := color.Red +basic.Println("basic color") + +c256 := color.Red.C256() +c256.Println("256 color") +c256.C16().Println("basic color") + +rgb := color.Red.RGB() +rgb.Println("rgb color") +rgb.C256().Println("256 color") +``` + +### 颜色转换方法 + +`color` 内置了许多颜色转换工具方法 + +```go +func Basic2hex(val uint8) string + +func Bg2Fg(val uint8) uint8 +func Fg2Bg(val uint8) uint8 + +func C256ToRgb(val uint8) (rgb []uint8) +func C256ToRgbV1(val uint8) (rgb []uint8) + +func Hex2basic(hex string, asBg ...bool) uint8 +func Hex2rgb(hex string) []int +func HexToRGB(hex string) []int +func HexToRgb(hex string) (rgb []int) + +func HslIntToRgb(h, s, l int) (rgb []uint8) +func HslToRgb(h, s, l float64) (rgb []uint8) +func HsvToRgb(h, s, v int) (rgb []uint8) + +func Rgb2ansi(r, g, b uint8, isBg bool) uint8 +func Rgb2basic(r, g, b uint8, isBg bool) uint8 +func Rgb2hex(rgb []int) string +func Rgb2short(r, g, b uint8) uint8 +func RgbTo256(r, g, b uint8) uint8 +func RgbTo256Table() map[string]uint8 +func RgbToAnsi(r, g, b uint8, isBg bool) uint8 +func RgbToHex(rgb []int) string +func RgbToHsl(r, g, b uint8) []float64 +func RgbToHslInt(r, g, b uint8) []int +``` + +**转换为 `RGBColor`**: + +- `func RGBFromSlice(rgb []uint8, isBg ...bool) RGBColor` +- `func RGBFromString(rgb string, isBg ...bool) RGBColor` +- `func HEX(hex string, isBg ...bool) RGBColor` +- `func HSL(h, s, l float64, isBg ...bool) RGBColor` +- `func HSLInt(h, s, l int, isBg ...bool) RGBColor` + +## 工具方法参考 + +一些有用的工具方法参考 + +- `Disable()` 禁用颜色渲染输出 +- `SetOutput(io.Writer)` 自定义设置渲染后的彩色文本输出位置 +- `ForceOpenColor()` 强制开启颜色渲染 +- `ClearCode(str string) string` Use for clear color codes +- `Colors2code(colors ...Color) string` Convert colors to code. return like "32;45;3" +- `ClearTag(s string) string` clear all color html-tag for a string +- `IsConsole(w io.Writer)` Determine whether w is one of stderr, stdout, stdin +- 更多请查看文档 https://pkg.go.dev/github.com/gookit/color + +### 检测支持的颜色级别 + +`color` 会自动检查当前环境支持的颜色级别 + +```go +// Level is the color level supported by a terminal. +type Level = terminfo.ColorLevel + +// terminal color available level alias of the terminfo.ColorLevel* +const ( + LevelNo = terminfo.ColorLevelNone // not support color. + Level16 = terminfo.ColorLevelBasic // basic - 3/4 bit color supported + Level256 = terminfo.ColorLevelHundreds // hundreds - 8-bit color supported + LevelRgb = terminfo.ColorLevelMillions // millions - (24 bit)true color supported +) +``` + +- `func SupportColor() bool` 当前环境是否支持色彩输出 +- `func Support256Color() bool` 当前环境是否支持256色彩输出 +- `func SupportTrueColor() bool` 当前环境是否支持(RGB)True色彩输出 +- `func TermColorLevel() Level` 获取当前支持的颜色级别 + +## 使用Color的项目 + +看看这些使用了 https://github.com/gookit/color 的项目: + +- https://github.com/Delta456/box-cli-maker Make Highly Customized Boxes for your CLI +- https://github.com/flipped-aurora/gin-vue-admin 基于gin+vue搭建的(中)后台系统框架 +- https://github.com/JanDeDobbeleer/oh-my-posh A prompt theme engine for any shell. +- https://github.com/jesseduffield/lazygit Simple terminal UI for git commands +- https://github.com/olivia-ai/olivia 💁‍♀️Your new best friend powered by an artificial neural network +- https://github.com/pterm/pterm PTerm is a modern Go module to beautify console output. Featuring charts, progressbars, tables, trees, etc. +- https://github.com/securego/gosec Golang security checker +- https://github.com/TNK-Studio/lazykube ⎈ The lazier way to manage kubernetes. +- [+ See More](https://pkg.go.dev/github.com/gookit/color?tab=importedby) + +## Gookit 工具包 + + - [gookit/ini](https://github.com/gookit/ini) INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用 + - [gookit/rux](https://github.com/gookit/rux) Simple and fast request router for golang HTTP + - [gookit/gcli](https://github.com/gookit/gcli) Go的命令行应用,工具库,运行CLI命令,支持命令行色彩,用户交互,进度显示,数据格式化显示 + - [gookit/slog](https://github.com/gookit/slog) 简洁易扩展的go日志库 + - [gookit/event](https://github.com/gookit/event) Go实现的轻量级的事件管理、调度程序库, 支持设置监听器的优先级, 支持对一组事件进行监听 + - [gookit/cache](https://github.com/gookit/cache) 通用的缓存使用包装库,通过包装各种常用的驱动,来提供统一的使用API + - [gookit/config](https://github.com/gookit/config) Go应用配置管理,支持多种格式(JSON, YAML, TOML, INI, HCL, ENV, Flags),多文件加载,远程文件加载,数据合并 + - [gookit/color](https://github.com/gookit/color) CLI 控制台颜色渲染工具库, 拥有简洁的使用API,支持16色,256色,RGB色彩渲染输出 + - [gookit/filter](https://github.com/gookit/filter) 提供对Golang数据的过滤,净化,转换 + - [gookit/validate](https://github.com/gookit/validate) Go通用的数据验证与过滤库,使用简单,内置大部分常用验证、过滤器 + - [gookit/goutil](https://github.com/gookit/goutil) Go 的一些工具函数,格式化,特殊处理,常用信息获取等 + - 更多请查看 https://github.com/gookit + +## 参考项目 + + - [inhere/console](https://github.com/inhere/php-console) + - [xo/terminfo](https://github.com/xo/terminfo) + - [beego/bee](https://github.com/beego/bee) + - [issue9/term](https://github.com/issue9/term) + - [ANSI转义序列](https://zh.wikipedia.org/wiki/ANSI转义序列) + - [Standard ANSI color map](https://conemu.github.io/en/AnsiEscapeCodes.html#Standard_ANSI_color_map) + - [Terminal Colors](https://gist.github.com/XVilka/8346728) + +## License + +MIT diff --git a/vendor/github.com/gookit/color/color.go b/vendor/github.com/gookit/color/color.go new file mode 100644 index 000000000..59e0b0b67 --- /dev/null +++ b/vendor/github.com/gookit/color/color.go @@ -0,0 +1,251 @@ +/* +Package color is command line color library. +Support rich color rendering output, universal API method, compatible with Windows system + +Source code and other details for the project are available at GitHub: + + https://github.com/gookit/color + +More usage please see README and tests. +*/ +package color + +import ( + "fmt" + "io" + "os" + "regexp" + "strings" + + "github.com/xo/terminfo" +) + +// color render templates +// +// ESC 操作的表示: +// +// "\033"(Octal 8进制) = "\x1b"(Hexadecimal 16进制) = 27 (10进制) +const ( + // StartSet chars + StartSet = "\x1b[" + // ResetSet close all properties. + ResetSet = "\x1b[0m" + // SettingTpl string. + SettingTpl = "\x1b[%sm" + // FullColorTpl for build color code + FullColorTpl = "\x1b[%sm%s\x1b[0m" + // CodeSuffix string for color code. + CodeSuffix = "[0m" +) + +// CodeExpr regex to clear color codes eg "\033[1;36mText\x1b[0m" +const CodeExpr = `\033\[[\d;?]+m` + +var ( + // Enable switch color render and display + // + // NOTICE: + // if ENV: NO_COLOR is not empty, will disable color render. + Enable = os.Getenv("NO_COLOR") == "" + // RenderTag render HTML tag on call color.Xprint, color.PrintX + RenderTag = true + // debug mode for development. + // + // set env: + // COLOR_DEBUG_MODE=on + // or: + // COLOR_DEBUG_MODE=on go run ./_examples/envcheck.go + debugMode = os.Getenv("COLOR_DEBUG_MODE") == "on" + // inner errors record on detect color level + innerErrs []error + // output the default io.Writer message print + output io.Writer = os.Stdout + // mark current env, It's like in `cmd.exe` + // if not in windows, it's always False. + isLikeInCmd bool + // the color support level for current terminal + // needVTP - need enable VTP, only for Windows OS + colorLevel, needVTP = detectTermColorLevel() + // match color codes + codeRegex = regexp.MustCompile(CodeExpr) + // mark current env is support color. + // Always: isLikeInCmd != supportColor + // supportColor = IsSupportColor() +) + +// TermColorLevel Get the currently supported color level +func TermColorLevel() Level { + return colorLevel +} + +// SupportColor Whether the current environment supports color output +func SupportColor() bool { + return colorLevel > terminfo.ColorLevelNone +} + +// Support16Color on the current ENV +// func Support16Color() bool { +// return colorLevel > terminfo.ColorLevelNone +// } + +// Support256Color Whether the current environment supports 256-color output +func Support256Color() bool { + return colorLevel > terminfo.ColorLevelBasic +} + +// SupportTrueColor Whether the current environment supports (RGB)True-color output +func SupportTrueColor() bool { + return colorLevel > terminfo.ColorLevelHundreds +} + +/************************************************************* + * global settings + *************************************************************/ + +// Set console color attributes +func Set(colors ...Color) (int, error) { + code := Colors2code(colors...) + err := SetTerminal(code) + return 0, err +} + +// Reset reset console color attributes +func Reset() (int, error) { + err := ResetTerminal() + return 0, err +} + +// Disable disable color output +func Disable() bool { + oldVal := Enable + Enable = false + return oldVal +} + +// NotRenderTag on call color.Xprint, color.PrintX +func NotRenderTag() { + RenderTag = false +} + +// SetOutput set default colored text output +func SetOutput(w io.Writer) { + output = w +} + +// ResetOutput reset output +func ResetOutput() { + output = os.Stdout +} + +// ResetOptions reset all package option setting +func ResetOptions() { + RenderTag = true + Enable = true + output = os.Stdout +} + +// ForceSetColorLevel force open color render +func ForceSetColorLevel(level terminfo.ColorLevel) terminfo.ColorLevel { + oldLevelVal := colorLevel + colorLevel = level + return oldLevelVal +} + +// ForceColor force open color render +func ForceColor() terminfo.ColorLevel { + return ForceOpenColor() +} + +// ForceOpenColor force open color render +func ForceOpenColor() terminfo.ColorLevel { + // TODO should set level to ? + return ForceSetColorLevel(terminfo.ColorLevelMillions) +} + +// IsLikeInCmd check result +// +// Deprecated: please don't use +func IsLikeInCmd() bool { + return isLikeInCmd +} + +// InnerErrs info +func InnerErrs() []error { + return innerErrs +} + +/************************************************************* + * render color code + *************************************************************/ + +// RenderCode render message by color code. +// +// Usage: +// +// msg := RenderCode("3;32;45", "some", "message") +func RenderCode(code string, args ...interface{}) string { + var message string + if ln := len(args); ln == 0 { + return "" + } + + message = fmt.Sprint(args...) + if len(code) == 0 { + return message + } + + // disabled OR not support color + if !Enable || !SupportColor() { + return ClearCode(message) + } + + // return fmt.Sprintf(FullColorTpl, code, message) + return StartSet + code + "m" + message + ResetSet +} + +// RenderWithSpaces Render code with spaces. +// If the number of args is > 1, a space will be added between the args +func RenderWithSpaces(code string, args ...interface{}) string { + msg := formatArgsForPrintln(args) + if len(code) == 0 { + return msg + } + + // disabled OR not support color + if !Enable || !SupportColor() { + return ClearCode(msg) + } + + return StartSet + code + "m" + msg + ResetSet +} + +// RenderString render a string with color code. +// +// Usage: +// +// msg := RenderString("3;32;45", "a message") +func RenderString(code string, str string) string { + if len(code) == 0 || str == "" { + return str + } + + // disabled OR not support color + if !Enable || !SupportColor() { + return ClearCode(str) + } + + // return fmt.Sprintf(FullColorTpl, code, str) + return StartSet + code + "m" + str + ResetSet +} + +// ClearCode clear color codes. +// +// eg: +// +// "\033[36;1mText\x1b[0m" -> "Text" +func ClearCode(str string) string { + if !strings.Contains(str, CodeSuffix) { + return str + } + return codeRegex.ReplaceAllString(str, "") +} diff --git a/vendor/github.com/gookit/color/color_16.go b/vendor/github.com/gookit/color/color_16.go new file mode 100644 index 000000000..3551521c0 --- /dev/null +++ b/vendor/github.com/gookit/color/color_16.go @@ -0,0 +1,477 @@ +package color + +import ( + "fmt" + "strconv" +) + +// Color Color16, 16 color value type +// 3(2^3=8) OR 4(2^4=16) bite color. +type Color uint8 +type Basic = Color // alias of Color + +// Opts basic color options. code: 0 - 9 +type Opts []Color + +// Add option value +func (o *Opts) Add(ops ...Color) { + for _, op := range ops { + if uint8(op) < 10 { + *o = append(*o, op) + } + } +} + +// IsValid options +func (o Opts) IsValid() bool { + return len(o) > 0 +} + +// IsEmpty options +func (o Opts) IsEmpty() bool { + return len(o) == 0 +} + +// String options to string. eg: "1;3" +func (o Opts) String() string { + return Colors2code(o...) +} + +/************************************************************* + * Basic 16 color definition + *************************************************************/ + +// Base value for foreground/background color +// base: fg 30~37, bg 40~47 +// light: fg 90~97, bg 100~107 +const ( + FgBase uint8 = 30 + BgBase uint8 = 40 + + HiFgBase uint8 = 90 + HiBgBase uint8 = 100 +) + +// Foreground colors. basic foreground colors 30 - 37 +const ( + FgBlack Color = iota + 30 + FgRed + FgGreen + FgYellow + FgBlue + FgMagenta // 品红 + FgCyan // 青色 + FgWhite + // FgDefault revert default FG + FgDefault Color = 39 +) + +// Extra foreground color 90 - 97(非标准) +const ( + FgDarkGray Color = iota + 90 // 亮黑(灰) + FgLightRed + FgLightGreen + FgLightYellow + FgLightBlue + FgLightMagenta + FgLightCyan + FgLightWhite + // FgGray is alias of FgDarkGray + FgGray Color = 90 // 亮黑(灰) +) + +// Background colors. basic background colors 40 - 47 +const ( + BgBlack Color = iota + 40 + BgRed + BgGreen + BgYellow // BgBrown like yellow + BgBlue + BgMagenta + BgCyan + BgWhite + // BgDefault revert default BG + BgDefault Color = 49 +) + +// Extra background color 100 - 107(非标准) +const ( + BgDarkGray Color = iota + 100 + BgLightRed + BgLightGreen + BgLightYellow + BgLightBlue + BgLightMagenta + BgLightCyan + BgLightWhite + // BgGray is alias of BgDarkGray + BgGray Color = 100 +) + +// Option settings +const ( + OpReset Color = iota // 0 重置所有设置 + OpBold // 1 加粗 + OpFuzzy // 2 模糊(不是所有的终端仿真器都支持) + OpItalic // 3 斜体(不是所有的终端仿真器都支持) + OpUnderscore // 4 下划线 + OpBlink // 5 闪烁 + OpFastBlink // 6 快速闪烁(未广泛支持) + OpReverse // 7 颠倒的 交换背景色与前景色 + OpConcealed // 8 隐匿的 + OpStrikethrough // 9 删除的,删除线(未广泛支持) +) + +// There are basic and light foreground color aliases +const ( + Red = FgRed + Cyan = FgCyan + Gray = FgDarkGray // is light Black + Blue = FgBlue + Black = FgBlack + Green = FgGreen + White = FgWhite + Yellow = FgYellow + Magenta = FgMagenta + + // special + + Bold = OpBold + Normal = FgDefault + + // extra light + + LightRed = FgLightRed + LightCyan = FgLightCyan + LightBlue = FgLightBlue + LightGreen = FgLightGreen + LightWhite = FgLightWhite + LightYellow = FgLightYellow + LightMagenta = FgLightMagenta + + HiRed = FgLightRed + HiCyan = FgLightCyan + HiBlue = FgLightBlue + HiGreen = FgLightGreen + HiWhite = FgLightWhite + HiYellow = FgLightYellow + HiMagenta = FgLightMagenta + + BgHiRed = BgLightRed + BgHiCyan = BgLightCyan + BgHiBlue = BgLightBlue + BgHiGreen = BgLightGreen + BgHiWhite = BgLightWhite + BgHiYellow = BgLightYellow + BgHiMagenta = BgLightMagenta +) + +// Bit4 a method for create Color +func Bit4(code uint8) Color { return Color(code) } + +/************************************************************* + * Color render methods + *************************************************************/ + +// Name get color code name. +func (c Color) Name() string { + name, ok := basic2nameMap[uint8(c)] + if ok { + return name + } + return "unknown" +} + +// Text render a text message +func (c Color) Text(message string) string { return RenderString(c.String(), message) } + +// Render messages by color setting +// +// Usage: +// green := color.FgGreen.Render +// fmt.Println(green("message")) +func (c Color) Render(a ...interface{}) string { return RenderCode(c.String(), a...) } + +// Renderln messages by color setting. +// like Println, will add spaces for each argument +// +// Usage: +// green := color.FgGreen.Renderln +// fmt.Println(green("message")) +func (c Color) Renderln(a ...interface{}) string { return RenderWithSpaces(c.String(), a...) } + +// Sprint render messages by color setting. is alias of the Render() +func (c Color) Sprint(a ...interface{}) string { return RenderCode(c.String(), a...) } + +// Sprintf format and render message. +// +// Usage: +// green := color.Green.Sprintf +// colored := green("message") +func (c Color) Sprintf(format string, args ...interface{}) string { + return RenderString(c.String(), fmt.Sprintf(format, args...)) +} + +// Print messages. +// +// Usage: +// color.Green.Print("message") +// OR: +// green := color.FgGreen.Print +// green("message") +func (c Color) Print(args ...interface{}) { + doPrintV2(c.Code(), fmt.Sprint(args...)) +} + +// Printf format and print messages. +// +// Usage: +// color.Cyan.Printf("string %s", "arg0") +func (c Color) Printf(format string, a ...interface{}) { + doPrintV2(c.Code(), fmt.Sprintf(format, a...)) +} + +// Println messages with new line +func (c Color) Println(a ...interface{}) { doPrintlnV2(c.String(), a) } + +// Light current color. eg: 36(FgCyan) -> 96(FgLightCyan). +// +// Usage: +// lightCyan := Cyan.Light() +// lightCyan.Print("message") +func (c Color) Light() Color { + val := int(c) + if val >= 30 && val <= 47 { + return Color(uint8(c) + 60) + } + + // don't change + return c +} + +// Darken current color. eg. 96(FgLightCyan) -> 36(FgCyan) +// +// Usage: +// cyan := LightCyan.Darken() +// cyan.Print("message") +func (c Color) Darken() Color { + val := int(c) + if val >= 90 && val <= 107 { + return Color(uint8(c) - 60) + } + + // don't change + return c +} + +// C256 convert 16 color to 256-color code. +func (c Color) C256() Color256 { + val := uint8(c) + if val < 10 { // is option code + return emptyC256 // empty + } + + var isBg uint8 + if val >= BgBase && val <= 47 { // is bg + isBg = AsBg + val = val - 10 // to fg code + } else if val >= HiBgBase && val <= 107 { // is hi bg + isBg = AsBg + val = val - 10 // to fg code + } + + if c256, ok := basicTo256Map[val]; ok { + return Color256{c256, isBg} + } + + // use raw value direct convert + return Color256{val} +} + +// ToFg always convert fg +func (c Color) ToFg() Color { + val := uint8(c) + // option code, don't change + if val < 10 { + return c + } + return Color(Bg2Fg(val)) +} + +// ToBg always convert bg +func (c Color) ToBg() Color { + val := uint8(c) + // option code, don't change + if val < 10 { + return c + } + return Color(Fg2Bg(val)) +} + +// RGB convert 16 color to 256-color code. +func (c Color) RGB() RGBColor { + val := uint8(c) + if val < 10 { // is option code + return emptyRGBColor + } + + return HEX(Basic2hex(val)) +} + +// Code convert to code string. eg "35" +func (c Color) Code() string { + return strconv.FormatInt(int64(c), 10) +} + +// String convert to code string. eg "35" +func (c Color) String() string { + return strconv.FormatInt(int64(c), 10) +} + +// IsValid color value +func (c Color) IsValid() bool { return c < 107 } + +/************************************************************* + * basic color maps + *************************************************************/ + +// FgColors foreground colors map +var FgColors = map[string]Color{ + "black": FgBlack, + "red": FgRed, + "green": FgGreen, + "yellow": FgYellow, + "blue": FgBlue, + "magenta": FgMagenta, + "cyan": FgCyan, + "white": FgWhite, + "default": FgDefault, +} + +// BgColors background colors map +var BgColors = map[string]Color{ + "black": BgBlack, + "red": BgRed, + "green": BgGreen, + "yellow": BgYellow, + "blue": BgBlue, + "magenta": BgMagenta, + "cyan": BgCyan, + "white": BgWhite, + "default": BgDefault, +} + +// ExFgColors extra foreground colors map +var ExFgColors = map[string]Color{ + "darkGray": FgDarkGray, + "lightRed": FgLightRed, + "lightGreen": FgLightGreen, + "lightYellow": FgLightYellow, + "lightBlue": FgLightBlue, + "lightMagenta": FgLightMagenta, + "lightCyan": FgLightCyan, + "lightWhite": FgLightWhite, +} + +// ExBgColors extra background colors map +var ExBgColors = map[string]Color{ + "darkGray": BgDarkGray, + "lightRed": BgLightRed, + "lightGreen": BgLightGreen, + "lightYellow": BgLightYellow, + "lightBlue": BgLightBlue, + "lightMagenta": BgLightMagenta, + "lightCyan": BgLightCyan, + "lightWhite": BgLightWhite, +} + +// Options color options map +// +// Deprecated: please use AllOptions instead. +var Options = AllOptions + +// AllOptions color options map +var AllOptions = map[string]Color{ + "reset": OpReset, + "bold": OpBold, + "fuzzy": OpFuzzy, + "italic": OpItalic, + "underscore": OpUnderscore, + "blink": OpBlink, + "reverse": OpReverse, + "concealed": OpConcealed, +} + +var ( + // TODO basic name alias + // basicNameAlias = map[string]string{} + // optionWithAlias = buildOpWithAlias() + // basic color name to code + // name2basicMap = initName2basicMap() + + // basic2nameMap basic color code to name + basic2nameMap = map[uint8]string{ + 30: "black", + 31: "red", + 32: "green", + 33: "yellow", + 34: "blue", + 35: "magenta", + 36: "cyan", + 37: "white", + // hi color code + 90: "lightBlack", + 91: "lightRed", + 92: "lightGreen", + 93: "lightYellow", + 94: "lightBlue", + 95: "lightMagenta", + 96: "lightCyan", + 97: "lightWhite", + // options + 0: "reset", + 1: "bold", + 2: "fuzzy", + 3: "italic", + 4: "underscore", + 5: "blink", + 7: "reverse", + 8: "concealed", + } +) + +// Bg2Fg bg color value to fg value +func Bg2Fg(val uint8) uint8 { + if val >= BgBase && val <= 47 { // is bg + val = val - 10 + } else if val >= HiBgBase && val <= 107 { // is hi bg + val = val - 10 + } + return val +} + +// Fg2Bg fg color value to bg value +func Fg2Bg(val uint8) uint8 { + if val >= FgBase && val <= 37 { // is fg + val = val + 10 + } else if val >= HiFgBase && val <= 97 { // is hi fg + val = val + 10 + } + return val +} + +// Basic2nameMap data +func Basic2nameMap() map[uint8]string { + return basic2nameMap +} + +// func initName2basicMap() map[string]uint8 { +// n2b := make(map[string]uint8, len(basic2nameMap)) +// for u, s := range basic2nameMap { +// n2b[s] = u +// } +// return n2b +// } + +// func buildOpWithAlias() map[string]uint8 { +// } diff --git a/vendor/github.com/gookit/color/color_256.go b/vendor/github.com/gookit/color/color_256.go new file mode 100644 index 000000000..c95c0f7b4 --- /dev/null +++ b/vendor/github.com/gookit/color/color_256.go @@ -0,0 +1,303 @@ +package color + +import ( + "fmt" + "strconv" + "strings" +) + +/* +from wikipedia, 256 color: + ESC[ … 38;5; … m选择前景色 + ESC[ … 48;5; … m选择背景色 + 0- 7:标准颜色(同 ESC[30–37m) + 8- 15:高强度颜色(同 ESC[90–97m) + 16-231:6 × 6 × 6 立方(216色): 16 + 36 × r + 6 × g + b (0 ≤ r, g, b ≤ 5) + 232-255:从黑到白的24阶灰度色 +*/ + +// tpl for 8 bit 256 color(`2^8`) +// +// format: +// ESC[ … 38;5; … m // 选择前景色 +// ESC[ … 48;5; … m // 选择背景色 +// +// example: +// fg "\x1b[38;5;242m" +// bg "\x1b[48;5;208m" +// both "\x1b[38;5;242;48;5;208m" +// +// links: +// https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97#8位 +const ( + TplFg256 = "38;5;%d" + TplBg256 = "48;5;%d" + Fg256Pfx = "38;5;" + Bg256Pfx = "48;5;" +) + +/************************************************************* + * 8bit(256) Color: Bit8Color Color256 + *************************************************************/ + +// Color256 256 color (8 bit), uint8 range at 0 - 255 +// +// 颜色值使用10进制和16进制都可 0x98 = 152 +// +// The color consists of two uint8: +// 0: color value +// 1: color type; Fg=0, Bg=1, >1: unset value +// +// example: +// fg color: [152, 0] +// bg color: [152, 1] +// +// NOTICE: now support 256 color on windows CMD, PowerShell +// lint warn - Name starts with package name +type Color256 [2]uint8 +type Bit8Color = Color256 // alias + +var emptyC256 = Color256{1: 99} + +// Bit8 create a color256 +func Bit8(val uint8, isBg ...bool) Color256 { + return C256(val, isBg...) +} + +// C256 create a color256 +func C256(val uint8, isBg ...bool) Color256 { + bc := Color256{val} + + // mark is bg color + if len(isBg) > 0 && isBg[0] { + bc[1] = AsBg + } + + return bc +} + +// Set terminal by 256 color code +func (c Color256) Set() error { + return SetTerminal(c.String()) +} + +// Reset terminal. alias of the ResetTerminal() +func (c Color256) Reset() error { + return ResetTerminal() +} + +// Print print message +func (c Color256) Print(a ...interface{}) { + doPrintV2(c.String(), fmt.Sprint(a...)) +} + +// Printf format and print message +func (c Color256) Printf(format string, a ...interface{}) { + doPrintV2(c.String(), fmt.Sprintf(format, a...)) +} + +// Println print message with newline +func (c Color256) Println(a ...interface{}) { + doPrintlnV2(c.String(), a) +} + +// Sprint returns rendered message +func (c Color256) Sprint(a ...interface{}) string { + return RenderCode(c.String(), a...) +} + +// Sprintf returns format and rendered message +func (c Color256) Sprintf(format string, a ...interface{}) string { + return RenderString(c.String(), fmt.Sprintf(format, a...)) +} + +// C16 convert color-256 to 16 color. +func (c Color256) C16() Color { + return c.Basic() +} + +// Basic convert color-256 to basic 16 color. +func (c Color256) Basic() Color { + return Color(c[0]) // TODO +} + +// RGB convert color-256 to RGB color. +func (c Color256) RGB() RGBColor { + return RGBFromSlice(C256ToRgb(c[0]), c[1] == AsBg) +} + +// RGBColor convert color-256 to RGB color. +func (c Color256) RGBColor() RGBColor { + return c.RGB() +} + +// Value return color value +func (c Color256) Value() uint8 { + return c[0] +} + +// Code convert to color code string. eg: "12" +func (c Color256) Code() string { + return strconv.Itoa(int(c[0])) +} + +// FullCode convert to color code string with prefix. eg: "38;5;12" +func (c Color256) FullCode() string { + return c.String() +} + +// String convert to color code string with prefix. eg: "38;5;12" +func (c Color256) String() string { + if c[1] == AsFg { // 0 is Fg + return Fg256Pfx + strconv.Itoa(int(c[0])) + } + + if c[1] == AsBg { // 1 is Bg + return Bg256Pfx + strconv.Itoa(int(c[0])) + } + return "" // empty +} + +// IsFg color +func (c Color256) IsFg() bool { + return c[1] == AsFg +} + +// ToFg 256 color +func (c Color256) ToFg() Color256 { + c[1] = AsFg + return c +} + +// IsBg color +func (c Color256) IsBg() bool { + return c[1] == AsBg +} + +// ToBg 256 color +func (c Color256) ToBg() Color256 { + c[1] = AsBg + return c +} + +// IsEmpty value +func (c Color256) IsEmpty() bool { + return c[1] > 1 +} + +/************************************************************* + * 8bit(256) Style + *************************************************************/ + +// Style256 definition +// +// 前/背景色 +// 都是由两位uint8组成, 第一位是色彩值; +// 第二位与 Bit8Color 不一样的是,在这里表示是否设置了值 0 未设置 !=0 已设置 +type Style256 struct { + // Name of the style + Name string + // color options of the style + opts Opts + // fg and bg color + fg, bg Color256 +} + +// S256 create a color256 style +// +// Usage: +// s := color.S256() +// s := color.S256(132) // fg +// s := color.S256(132, 203) // fg and bg +func S256(fgAndBg ...uint8) *Style256 { + s := &Style256{} + vl := len(fgAndBg) + if vl > 0 { // with fg + s.fg = Color256{fgAndBg[0], 1} + + if vl > 1 { // and with bg + s.bg = Color256{fgAndBg[1], 1} + } + } + + return s +} + +// Set fg and bg color value, can also with color options +func (s *Style256) Set(fgVal, bgVal uint8, opts ...Color) *Style256 { + s.fg = Color256{fgVal, 1} + s.bg = Color256{bgVal, 1} + s.opts.Add(opts...) + return s +} + +// SetBg set bg color value +func (s *Style256) SetBg(bgVal uint8) *Style256 { + s.bg = Color256{bgVal, 1} + return s +} + +// SetFg set fg color value +func (s *Style256) SetFg(fgVal uint8) *Style256 { + s.fg = Color256{fgVal, 1} + return s +} + +// SetOpts set options +func (s *Style256) SetOpts(opts Opts) *Style256 { + s.opts = opts + return s +} + +// AddOpts add options +func (s *Style256) AddOpts(opts ...Color) *Style256 { + s.opts.Add(opts...) + return s +} + +// Print message +func (s *Style256) Print(a ...interface{}) { + doPrintV2(s.String(), fmt.Sprint(a...)) +} + +// Printf format and print message +func (s *Style256) Printf(format string, a ...interface{}) { + doPrintV2(s.String(), fmt.Sprintf(format, a...)) +} + +// Println print message with newline +func (s *Style256) Println(a ...interface{}) { + doPrintlnV2(s.String(), a) +} + +// Sprint returns rendered message +func (s *Style256) Sprint(a ...interface{}) string { + return RenderCode(s.Code(), a...) +} + +// Sprintf returns format and rendered message +func (s *Style256) Sprintf(format string, a ...interface{}) string { + return RenderString(s.Code(), fmt.Sprintf(format, a...)) +} + +// Code convert to color code string +func (s *Style256) Code() string { + return s.String() +} + +// String convert to color code string +func (s *Style256) String() string { + var ss []string + if s.fg[1] > 0 { + ss = append(ss, Fg256Pfx+strconv.FormatInt(int64(s.fg[0]), 10)) + } + + if s.bg[1] > 0 { + ss = append(ss, Bg256Pfx+strconv.FormatInt(int64(s.bg[0]), 10)) + } + + if s.opts.IsValid() { + ss = append(ss, s.opts.String()) + } + return strings.Join(ss, ";") +} diff --git a/vendor/github.com/gookit/color/color_rgb.go b/vendor/github.com/gookit/color/color_rgb.go new file mode 100644 index 000000000..ff3c1bb08 --- /dev/null +++ b/vendor/github.com/gookit/color/color_rgb.go @@ -0,0 +1,422 @@ +package color + +import ( + "fmt" + "strconv" + "strings" +) + +// 24 bit RGB color +// RGB: +// R 0-255 G 0-255 B 0-255 +// R 00-FF G 00-FF B 00-FF (16进制) +// +// Format: +// ESC[ … 38;2;;; … m // Select RGB foreground color +// ESC[ … 48;2;;; … m // Choose RGB background color +// +// links: +// https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97#24位 +// +// example: +// fg: \x1b[38;2;30;144;255mMESSAGE\x1b[0m +// bg: \x1b[48;2;30;144;255mMESSAGE\x1b[0m +// both: \x1b[38;2;233;90;203;48;2;30;144;255mMESSAGE\x1b[0m +const ( + TplFgRGB = "38;2;%d;%d;%d" + TplBgRGB = "48;2;%d;%d;%d" + FgRGBPfx = "38;2;" + BgRGBPfx = "48;2;" +) + +// mark color is fg or bg. +const ( + AsFg uint8 = iota + AsBg +) + +/************************************************************* + * RGB Color(Bit24Color, TrueColor) + *************************************************************/ + +// RGBColor definition. +// +// The first to third digits represent the color value. +// The last digit represents the foreground(0), background(1), >1 is unset value +// +// Usage: +// // 0, 1, 2 is R,G,B. +// // 3rd: Fg=0, Bg=1, >1: unset value +// RGBColor{30,144,255, 0} +// RGBColor{30,144,255, 1} +// +// NOTICE: now support RGB color on Windows CMD, PowerShell +type RGBColor [4]uint8 + +// create an empty RGBColor +var emptyRGBColor = RGBColor{3: 99} + +// RGB color create. +// +// Usage: +// c := RGB(30,144,255) +// c := RGB(30,144,255, true) +// c.Print("message") +func RGB(r, g, b uint8, isBg ...bool) RGBColor { + rgb := RGBColor{r, g, b} + if len(isBg) > 0 && isBg[0] { + rgb[3] = AsBg + } + + return rgb +} + +// Rgb alias of the RGB() +func Rgb(r, g, b uint8, isBg ...bool) RGBColor { return RGB(r, g, b, isBg...) } + +// Bit24 alias of the RGB() +func Bit24(r, g, b uint8, isBg ...bool) RGBColor { return RGB(r, g, b, isBg...) } + +// RgbFromInt create instance from int r,g,b value +func RgbFromInt(r, g, b int, isBg ...bool) RGBColor { + return RGB(uint8(r), uint8(g), uint8(b), isBg...) +} + +// RgbFromInts create instance from []int r,g,b value +func RgbFromInts(rgb []int, isBg ...bool) RGBColor { + return RGB(uint8(rgb[0]), uint8(rgb[1]), uint8(rgb[2]), isBg...) +} + +// HEX create RGB color from a HEX color string. +// +// Usage: +// c := HEX("ccc") // rgb: [204 204 204] +// c := HEX("aabbcc") // rgb: [170 187 204] +// c := HEX("#aabbcc") +// c := HEX("0xaabbcc") +// c.Print("message") +func HEX(hex string, isBg ...bool) RGBColor { + if rgb := HexToRgb(hex); len(rgb) > 0 { + return RGB(uint8(rgb[0]), uint8(rgb[1]), uint8(rgb[2]), isBg...) + } + + // mark is empty + return emptyRGBColor +} + +// Hex alias of the HEX() +func Hex(hex string, isBg ...bool) RGBColor { return HEX(hex, isBg...) } + +// RGBFromHEX quick RGBColor from hex string, alias of HEX() +func RGBFromHEX(hex string, isBg ...bool) RGBColor { return HEX(hex, isBg...) } + +// HSL create RGB color from a hsl value. +// more see HslToRgb() +func HSL(h, s, l float64, isBg ...bool) RGBColor { + rgb := HslToRgb(h, s, l) + return RGB(rgb[0], rgb[1], rgb[2], isBg...) +} + +// Hsl alias of the HSL() +func Hsl(h, s, l float64, isBg ...bool) RGBColor { return HSL(h, s, l, isBg...) } + +// HSLInt create RGB color from a hsl int value. +// more see HslIntToRgb() +func HSLInt(h, s, l int, isBg ...bool) RGBColor { + rgb := HslIntToRgb(h, s, l) + return RGB(rgb[0], rgb[1], rgb[2], isBg...) +} + +// HslInt alias of the HSLInt() +func HslInt(h, s, l int, isBg ...bool) RGBColor { return HSLInt(h, s, l, isBg...) } + +// RGBFromSlice quick RGBColor from slice +func RGBFromSlice(rgb []uint8, isBg ...bool) RGBColor { + return RGB(rgb[0], rgb[1], rgb[2], isBg...) +} + +// RGBFromString create RGB color from a string. +// Support use color name in the {namedRgbMap} +// +// Usage: +// c := RGBFromString("170,187,204") +// c.Print("message") +// +// c := RGBFromString("brown") +// c.Print("message with color brown") +func RGBFromString(rgb string, isBg ...bool) RGBColor { + // use color name in the {namedRgbMap} + if rgbVal, ok := namedRgbMap[rgb]; ok { + rgb = rgbVal + } + + // use rgb string. + ss := stringToArr(rgb, ",") + if len(ss) != 3 { + return emptyRGBColor + } + + var ar [3]uint8 + for i, val := range ss { + iv, err := strconv.Atoi(val) + if err != nil || !isValidUint8(iv) { + return emptyRGBColor + } + + ar[i] = uint8(iv) + } + + return RGB(ar[0], ar[1], ar[2], isBg...) +} + +// Set terminal by rgb/true color code +func (c RGBColor) Set() error { + return SetTerminal(c.String()) +} + +// Reset terminal. alias of the ResetTerminal() +func (c RGBColor) Reset() error { + return ResetTerminal() +} + +// Print print message +func (c RGBColor) Print(a ...interface{}) { + doPrintV2(c.String(), fmt.Sprint(a...)) +} + +// Printf format and print message +func (c RGBColor) Printf(format string, a ...interface{}) { + doPrintV2(c.String(), fmt.Sprintf(format, a...)) +} + +// Println print message with newline +func (c RGBColor) Println(a ...interface{}) { + doPrintlnV2(c.String(), a) +} + +// Sprint returns rendered message +func (c RGBColor) Sprint(a ...interface{}) string { + return RenderCode(c.String(), a...) +} + +// Sprintf returns format and rendered message +func (c RGBColor) Sprintf(format string, a ...interface{}) string { + return RenderString(c.String(), fmt.Sprintf(format, a...)) +} + +// Values to RGB values +func (c RGBColor) Values() []int { + return []int{int(c[0]), int(c[1]), int(c[2])} +} + +// Code to color code string without prefix. eg: "204;123;56" +func (c RGBColor) Code() string { + return fmt.Sprintf("%d;%d;%d", c[0], c[1], c[2]) +} + +// Hex color rgb to hex string. as in "ff0080". +func (c RGBColor) Hex() string { + return fmt.Sprintf("%02x%02x%02x", c[0], c[1], c[2]) +} + +// RgbString to color code string without prefix. eg: "204,123,56" +func (c RGBColor) RgbString() string { + return fmt.Sprintf("%d,%d,%d", c[0], c[1], c[2]) +} + +// FullCode to color code string with prefix +func (c RGBColor) FullCode() string { + return c.String() +} + +// String to color code string with prefix. eg: "38;2;204;123;56" +func (c RGBColor) String() string { + if c[3] == AsFg { + return fmt.Sprintf(TplFgRGB, c[0], c[1], c[2]) + } + + if c[3] == AsBg { + return fmt.Sprintf(TplBgRGB, c[0], c[1], c[2]) + } + + // c[3] > 1 is empty + return "" +} + +// IsEmpty value +func (c RGBColor) IsEmpty() bool { + return c[3] > AsBg +} + +// IsValid value +// func (c RGBColor) IsValid() bool { +// return c[3] <= AsBg +// } + +// C256 returns the closest approximate 256 (8 bit) color +func (c RGBColor) C256() Color256 { + return C256(RgbTo256(c[0], c[1], c[2]), c[3] == AsBg) +} + +// Basic returns the closest approximate 16 (4 bit) color +func (c RGBColor) Basic() Color { + // return Color(RgbToAnsi(c[0], c[1], c[2], c[3] == AsBg)) + return Color(Rgb2basic(c[0], c[1], c[2], c[3] == AsBg)) +} + +// Color returns the closest approximate 16 (4 bit) color +func (c RGBColor) Color() Color { return c.Basic() } + +// C16 returns the closest approximate 16 (4 bit) color +func (c RGBColor) C16() Color { return c.Basic() } + +/************************************************************* + * RGB Style + *************************************************************/ + +// RGBStyle supports set foreground and background color +// +// All are composed of 4 digits uint8, the first three digits are the color value; +// The last bit is different from RGBColor, here it indicates whether the value is set. +// +// 1 Has been set +// ^1 Not set +type RGBStyle struct { + // Name of the style + Name string + // color options of the style + opts Opts + // fg and bg color + fg, bg RGBColor +} + +// NewRGBStyle create a RGBStyle. +func NewRGBStyle(fg RGBColor, bg ...RGBColor) *RGBStyle { + s := &RGBStyle{} + if len(bg) > 0 { + s.SetBg(bg[0]) + } + + return s.SetFg(fg) +} + +// HEXStyle create a RGBStyle from HEX color string. +// +// Usage: +// s := HEXStyle("aabbcc", "eee") +// s.Print("message") +func HEXStyle(fg string, bg ...string) *RGBStyle { + s := &RGBStyle{} + if len(bg) > 0 { + s.SetBg(HEX(bg[0])) + } + + if len(fg) > 0 { + s.SetFg(HEX(fg)) + } + return s +} + +// RGBStyleFromString create a RGBStyle from color value string. +// +// Usage: +// s := RGBStyleFromString("170,187,204", "70,87,4") +// s.Print("message") +func RGBStyleFromString(fg string, bg ...string) *RGBStyle { + s := &RGBStyle{} + if len(bg) > 0 { + s.SetBg(RGBFromString(bg[0])) + } + + return s.SetFg(RGBFromString(fg)) +} + +// Set fg and bg color, can also with color options +func (s *RGBStyle) Set(fg, bg RGBColor, opts ...Color) *RGBStyle { + return s.SetFg(fg).SetBg(bg).SetOpts(opts) +} + +// SetFg set fg color +func (s *RGBStyle) SetFg(fg RGBColor) *RGBStyle { + fg[3] = 1 // add fixed value, mark is valid + s.fg = fg + return s +} + +// SetBg set bg color +func (s *RGBStyle) SetBg(bg RGBColor) *RGBStyle { + bg[3] = 1 // add fixed value, mark is valid + s.bg = bg + return s +} + +// SetOpts set color options +func (s *RGBStyle) SetOpts(opts Opts) *RGBStyle { + s.opts = opts + return s +} + +// AddOpts add options +func (s *RGBStyle) AddOpts(opts ...Color) *RGBStyle { + s.opts.Add(opts...) + return s +} + +// Print print message +func (s *RGBStyle) Print(a ...interface{}) { + doPrintV2(s.String(), fmt.Sprint(a...)) +} + +// Printf format and print message +func (s *RGBStyle) Printf(format string, a ...interface{}) { + doPrintV2(s.String(), fmt.Sprintf(format, a...)) +} + +// Println print message with newline +func (s *RGBStyle) Println(a ...interface{}) { + doPrintlnV2(s.String(), a) +} + +// Sprint returns rendered message +func (s *RGBStyle) Sprint(a ...interface{}) string { + return RenderCode(s.String(), a...) +} + +// Sprintf returns format and rendered message +func (s *RGBStyle) Sprintf(format string, a ...interface{}) string { + return RenderString(s.String(), fmt.Sprintf(format, a...)) +} + +// Code convert to color code string +func (s *RGBStyle) Code() string { + return s.String() +} + +// FullCode convert to color code string +func (s *RGBStyle) FullCode() string { + return s.String() +} + +// String convert to color code string +func (s *RGBStyle) String() string { + var ss []string + // last value ensure is enable. + if s.fg[3] == 1 { + ss = append(ss, fmt.Sprintf(TplFgRGB, s.fg[0], s.fg[1], s.fg[2])) + } + + if s.bg[3] == 1 { + ss = append(ss, fmt.Sprintf(TplBgRGB, s.bg[0], s.bg[1], s.bg[2])) + } + + if s.opts.IsValid() { + ss = append(ss, s.opts.String()) + } + + return strings.Join(ss, ";") +} + +// IsEmpty style +func (s *RGBStyle) IsEmpty() bool { + return s.fg[3] != 1 && s.bg[3] != 1 +} diff --git a/vendor/github.com/gookit/color/color_tag.go b/vendor/github.com/gookit/color/color_tag.go new file mode 100644 index 000000000..4f6fed938 --- /dev/null +++ b/vendor/github.com/gookit/color/color_tag.go @@ -0,0 +1,561 @@ +package color + +import ( + "fmt" + "regexp" + "strings" +) + +// output colored text like use html tag. (not support windows cmd) +const ( + // MatchExpr regex to match color tags + // + // Notice: golang 不支持反向引用. 即不支持使用 \1 引用第一个匹配 ([a-z=;]+) + // MatchExpr = `<([a-z=;]+)>(.*?)<\/\1>` + // 所以调整一下 统一使用 `` 来结束标签,例如 "some text" + // + // allow custom attrs, eg: "content" + // (?s:...) s - 让 "." 匹配换行 + MatchExpr = `<([0-9a-zA-Z_=,;]+)>(?s:(.*?))<\/>` + + // AttrExpr regex to match custom color attributes + // eg: "content" + AttrExpr = `(fg|bg|op)[\s]*=[\s]*([0-9a-zA-Z,]+);?` + + // StripExpr regex used for removing color tags + // StripExpr = `<[\/]?[a-zA-Z=;]+>` + // 随着上面的做一些调整 + StripExpr = `<[\/]?[0-9a-zA-Z_=,;]*>` +) + +var ( + attrRegex = regexp.MustCompile(AttrExpr) + matchRegex = regexp.MustCompile(MatchExpr) + stripRegex = regexp.MustCompile(StripExpr) +) + +/************************************************************* + * internal defined color tags + *************************************************************/ + +// There are internal defined fg color tags +// +// Usage: +// content text +// +// @notice 加 0 在前面是为了防止之前的影响到现在的设置 +var colorTags = map[string]string{ + // basic tags + "red": "0;31", + "red1": "1;31", // with bold + "redB": "1;31", + "red_b": "1;31", + "blue": "0;34", + "blue1": "1;34", // with bold + "blueB": "1;34", + "blue_b": "1;34", + "cyan": "0;36", + "cyan1": "1;36", // with bold + "cyanB": "1;36", + "cyan_b": "1;36", + "green": "0;32", + "green1": "1;32", // with bold + "greenB": "1;32", + "green_b": "1;32", + "black": "0;30", + "white": "1;37", + "default": "0;39", // no color + "normal": "0;39", // no color + "brown": "0;33", // #A52A2A + "yellow": "0;33", + "ylw0": "0;33", + "yellowB": "1;33", // with bold + "ylw1": "1;33", + "ylwB": "1;33", + "magenta": "0;35", + "mga": "0;35", // short name + "magentaB": "1;35", // with bold + "magenta1": "1;35", + "mgb": "1;35", + "mga1": "1;35", + "mgaB": "1;35", + + // light/hi tags + + "gray": "0;90", + "darkGray": "0;90", + "dark_gray": "0;90", + "lightYellow": "0;93", + "light_yellow": "0;93", + "hiYellow": "0;93", + "hi_yellow": "0;93", + "hiYellowB": "1;93", // with bold + "hi_yellow_b": "1;93", + "lightMagenta": "0;95", + "light_magenta": "0;95", + "hiMagenta": "0;95", + "hi_magenta": "0;95", + "lightMagenta1": "1;95", // with bold + "hiMagentaB": "1;95", // with bold + "hi_magenta_b": "1;95", + "lightRed": "0;91", + "light_red": "0;91", + "hiRed": "0;91", + "hi_red": "0;91", + "lightRedB": "1;91", // with bold + "light_red_b": "1;91", + "hi_red_b": "1;91", + "lightGreen": "0;92", + "light_green": "0;92", + "hiGreen": "0;92", + "hi_green": "0;92", + "lightGreenB": "1;92", + "light_green_b": "1;92", + "hi_green_b": "1;92", + "lightBlue": "0;94", + "light_blue": "0;94", + "hiBlue": "0;94", + "hi_blue": "0;94", + "lightBlueB": "1;94", + "light_blue_b": "1;94", + "hi_blue_b": "1;94", + "lightCyan": "0;96", + "light_cyan": "0;96", + "hiCyan": "0;96", + "hi_cyan": "0;96", + "lightCyanB": "1;96", + "light_cyan_b": "1;96", + "hi_cyan_b": "1;96", + "lightWhite": "0;97;40", + "light_white": "0;97;40", + + // option + "bold": "1", + "b": "1", + "italic": "3", + "i": "3", // italic + "underscore": "4", + "us": "4", // short name for 'underscore' + "blink": "5", + "fb": "6", // fast blink + "reverse": "7", + "st": "9", // strikethrough + + // alert tags, like bootstrap's alert + "suc": "1;32", // same "green" and "bold" + "success": "1;32", + "info": "0;32", // same "green", + "comment": "0;33", // same "brown" + "note": "36;1", + "notice": "36;4", + "warn": "0;1;33", + "warning": "0;30;43", + "primary": "0;34", + "danger": "1;31", // same "red" but add bold + "err": "97;41", + "error": "97;41", // fg light white; bg red +} + +/************************************************************* + * internal defined tag attributes + *************************************************************/ + +// built-in attributes for fg,bg 16-colors and op codes. +var ( + attrFgs = map[string]string{ + // basic colors + + "black": FgBlack.Code(), + "red": "31", + "green": "32", + "brown": "33", // #A52A2A + "yellow": "33", + "ylw": "33", + "blue": "34", + "cyan": "36", + "magenta": "35", + "mga": "35", + "white": FgWhite.Code(), + "default": "39", // no color + "normal": "39", // no color + + // light/hi colors + + "darkGray": FgDarkGray.Code(), + "dark_gray": "90", + "gray": "90", + "lightYellow": "93", + "light_yellow": "93", + "hiYellow": "93", + "hi_yellow": "93", + "lightMagenta": "95", + "light_magenta": "95", + "hiMagenta": "95", + "hi_magenta": "95", + "hi_mga": "95", + "lightRed": "91", + "light_red": "91", + "hiRed": "91", + "hi_red": "91", + "lightGreen": "92", + "light_green": "92", + "hiGreen": "92", + "hi_green": "92", + "lightBlue": "94", + "light_blue": "94", + "hiBlue": "94", + "hi_blue": "94", + "lightCyan": "96", + "light_cyan": "96", + "hiCyan": "96", + "hi_cyan": "96", + "lightWhite": "97", + "light_white": "97", + } + + attrBgs = map[string]string{ + // basic colors + + "black": BgBlack.Code(), + "red": "41", + "green": "42", + "brown": "43", // #A52A2A + "yellow": "43", + "ylw": "43", + "blue": "44", + "cyan": "46", + "magenta": "45", + "mga": "45", + "white": FgWhite.Code(), + "default": "49", // no color + "normal": "49", // no color + + // light/hi colors + + "darkGray": BgDarkGray.Code(), + "dark_gray": "100", + "gray": "100", + "lightYellow": "103", + "light_yellow": "103", + "hiYellow": "103", + "hi_yellow": "103", + "lightMagenta": "105", + "light_magenta": "105", + "hiMagenta": "105", + "hi_magenta": "105", + "hi_mga": "105", + "lightRed": "101", + "light_red": "101", + "hiRed": "101", + "hi_red": "101", + "lightGreen": "102", + "light_green": "102", + "hiGreen": "102", + "hi_green": "102", + "lightBlue": "104", + "light_blue": "104", + "hiBlue": "104", + "hi_blue": "104", + "lightCyan": "106", + "light_cyan": "106", + "hiCyan": "106", + "hi_cyan": "106", + "lightWhite": BgLightWhite.Code(), + "light_white": "107", + } + + attrOpts = map[string]string{ + "reset": OpReset.Code(), + "bold": OpBold.Code(), + "b": OpBold.Code(), + "fuzzy": OpFuzzy.Code(), + "italic": OpItalic.Code(), + "i": OpItalic.Code(), + "underscore": OpUnderscore.Code(), + "us": OpUnderscore.Code(), + "u": OpUnderscore.Code(), + "blink": OpBlink.Code(), + "fastblink": OpFastBlink.Code(), + "fb": OpFastBlink.Code(), + "reverse": OpReverse.Code(), + "concealed": OpConcealed.Code(), + "strikethrough": OpStrikethrough.Code(), + "st": OpStrikethrough.Code(), + } +) + +/************************************************************* + * parse color tags + *************************************************************/ + +var ( + tagParser = TagParser{} + // regex for match color 256 code + rxNumStr = regexp.MustCompile("^[0-9]{1,3}$") + rxHexCode = regexp.MustCompile("^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$") +) + +// TagParser struct +type TagParser struct { + disable bool +} + +// NewTagParser create +func NewTagParser() *TagParser { + return &TagParser{} +} + +// func (tp *TagParser) Disable() *TagParser { +// tp.disable = true +// return tp +// } + +// ParseByEnv parse given string. will check package setting. +func (tp *TagParser) ParseByEnv(str string) string { + // disable handler TAG + if !RenderTag { + return str + } + + // disable OR not support color + if !Enable || !SupportColor() { + return ClearTag(str) + } + return tp.Parse(str) +} + +// Parse parse given string, replace color tag and return rendered string +// +// Use built in tags: +// CONTENT +// // e.g: `message` +// +// Custom tag attributes: +// `CONTENT` +// // e.g: `wel` +func (tp *TagParser) Parse(str string) string { + // not contains color tag + if !strings.Contains(str, "") { + return str + } + + // find color tags by regex. str eg: "content" + matched := matchRegex.FindAllStringSubmatch(str, -1) + + // item: 0 full text 1 tag name 2 tag content + for _, item := range matched { + full, tag, body := item[0], item[1], item[2] + + // use defined color tag name: "content" -> tag: "info" + if !strings.ContainsRune(tag, '=') { + if code := colorTags[tag]; len(code) > 0 { + str = strings.Replace(str, full, RenderString(code, body), 1) + } else if code, ok := namedRgbMap[tag]; ok { + code = strings.Replace(code, ",", ";", -1) + now := RenderString(FgRGBPfx+code, body) + str = strings.Replace(str, full, now, 1) + } + continue + } + + // custom color in tag + // - basic: "fg=white;bg=blue;op=bold" + if code := ParseCodeFromAttr(tag); len(code) > 0 { + str = strings.Replace(str, full, RenderString(code, body), 1) + } + } + + return str +} + +// ReplaceTag parse string, replace color tag and return rendered string +func ReplaceTag(str string) string { + return tagParser.ParseByEnv(str) +} + +// ParseCodeFromAttr parse color attributes. +// +// attr format: +// // VALUE please see var: FgColors, BgColors, AllOptions +// "fg=VALUE;bg=VALUE;op=VALUE" +// +// 16 color: +// "fg=yellow" +// "bg=red" +// "op=bold,underscore" // option is allow multi value +// "fg=white;bg=blue;op=bold" +// "fg=white;op=bold,underscore" +// +// 256 color: +// "fg=167" +// "fg=167;bg=23" +// "fg=167;bg=23;op=bold" +// +// True color: +// // hex +// "fg=fc1cac" +// "fg=fc1cac;bg=c2c3c4" +// // r,g,b +// "fg=23,45,214" +// "fg=23,45,214;bg=109,99,88" +func ParseCodeFromAttr(attr string) (code string) { + if !strings.ContainsRune(attr, '=') { + return + } + + attr = strings.Trim(attr, ";=,") + if len(attr) == 0 { + return + } + + var codes []string + matched := attrRegex.FindAllStringSubmatch(attr, -1) + + for _, item := range matched { + pos, val := item[1], item[2] + switch pos { + case "fg": + if code, ok := attrFgs[val]; ok { // attr fg + codes = append(codes, code) + } else if code := rgbHex256toCode(val, false); code != "" { + codes = append(codes, code) + } + case "bg": + if code, ok := attrBgs[val]; ok { // attr bg + codes = append(codes, code) + } else if code := rgbHex256toCode(val, true); code != "" { + codes = append(codes, code) + } + case "op": // options allow multi value + if strings.Contains(val, ",") { + ns := strings.Split(val, ",") + for _, n := range ns { + if code, ok := attrOpts[n]; ok { // attr ops + codes = append(codes, code) + } + } + } else if code, ok := attrOpts[val]; ok { + codes = append(codes, code) + } + } + } + + return strings.Join(codes, ";") +} + +func rgbHex256toCode(val string, isBg bool) (code string) { + if len(val) == 6 && rxHexCode.MatchString(val) { // hex: "fc1cac" + code = HEX(val, isBg).String() + } else if strings.ContainsRune(val, ',') { // rgb: "231,178,161" + code = strings.Replace(val, ",", ";", -1) + if isBg { + code = BgRGBPfx + code + } else { + code = FgRGBPfx + code + } + } else if len(val) < 4 && rxNumStr.MatchString(val) { // 256 code + if isBg { + code = Bg256Pfx + val + } else { + code = Fg256Pfx + val + } + } + return +} + +// ClearTag clear all tag for a string +func ClearTag(s string) string { + if !strings.Contains(s, "") { + return s + } + return stripRegex.ReplaceAllString(s, "") +} + +/************************************************************* + * helper methods + *************************************************************/ + +// GetTagCode get color code by tag name +func GetTagCode(name string) string { + return colorTags[name] +} + +// ApplyTag for messages +func ApplyTag(tag string, a ...interface{}) string { + return RenderCode(GetTagCode(tag), a...) +} + +// WrapTag wrap a tag for a string "content" +func WrapTag(s string, tag string) string { + if s == "" || tag == "" { + return s + } + return fmt.Sprintf("<%s>%s", tag, s) +} + +// GetColorTags get all internal color tags +func GetColorTags() map[string]string { + return colorTags +} + +// IsDefinedTag is defined tag name +func IsDefinedTag(name string) bool { + _, ok := colorTags[name] + return ok +} + +/************************************************************* + * Tag extra + *************************************************************/ + +// Tag value is a defined style name +// Usage: +// Tag("info").Println("message") +type Tag string + +// Print messages +func (tg Tag) Print(a ...interface{}) { + name := string(tg) + str := fmt.Sprint(a...) + + if stl := GetStyle(name); !stl.IsEmpty() { + stl.Print(str) + } else { + doPrintV2(GetTagCode(name), str) + } +} + +// Printf format and print messages +func (tg Tag) Printf(format string, a ...interface{}) { + name := string(tg) + str := fmt.Sprintf(format, a...) + + if stl := GetStyle(name); !stl.IsEmpty() { + stl.Print(str) + } else { + doPrintV2(GetTagCode(name), str) + } +} + +// Println messages line +func (tg Tag) Println(a ...interface{}) { + name := string(tg) + if stl := GetStyle(name); !stl.IsEmpty() { + stl.Println(a...) + } else { + doPrintlnV2(GetTagCode(name), a) + } +} + +// Sprint render messages +func (tg Tag) Sprint(a ...interface{}) string { + return RenderCode(GetTagCode(string(tg)), a...) +} + +// Sprintf format and render messages +func (tg Tag) Sprintf(format string, a ...interface{}) string { + tag := string(tg) + str := fmt.Sprintf(format, a...) + + return RenderString(GetTagCode(tag), str) +} diff --git a/vendor/github.com/gookit/color/convert.go b/vendor/github.com/gookit/color/convert.go new file mode 100644 index 000000000..39aac7d2e --- /dev/null +++ b/vendor/github.com/gookit/color/convert.go @@ -0,0 +1,956 @@ +package color + +import ( + "fmt" + "math" + "sort" + "strconv" + "strings" +) + +// values from https://github.com/go-terminfo/terminfo +// var ( +// RgbaBlack = image_color.RGBA{0, 0, 0, 255} +// Red = color.RGBA{205, 0, 0, 255} +// Green = color.RGBA{0, 205, 0, 255} +// Orange = color.RGBA{205, 205, 0, 255} +// Blue = color.RGBA{0, 0, 238, 255} +// Magenta = color.RGBA{205, 0, 205, 255} +// Cyan = color.RGBA{0, 205, 205, 255} +// LightGrey = color.RGBA{229, 229, 229, 255} +// +// DarkGrey = color.RGBA{127, 127, 127, 255} +// LightRed = color.RGBA{255, 0, 0, 255} +// LightGreen = color.RGBA{0, 255, 0, 255} +// Yellow = color.RGBA{255, 255, 0, 255} +// LightBlue = color.RGBA{92, 92, 255, 255} +// LightMagenta = color.RGBA{255, 0, 255, 255} +// LightCyan = color.RGBA{0, 255, 255, 255} +// White = color.RGBA{255, 255, 255, 255} +// ) + +var ( + // ---------- basic(16) <=> 256 color convert ---------- + basicTo256Map = map[uint8]uint8{ + 30: 0, // black 000000 + 31: 160, // red c51e14 + 32: 34, // green 1dc121 + 33: 184, // yellow c7c329 + 34: 20, // blue 0a2fc4 + 35: 170, // magenta c839c5 + 36: 44, // cyan 20c5c6 + 37: 188, // white c7c7c7 + 90: 59, // lightBlack 686868 + 91: 203, // lightRed fd6f6b + 92: 83, // lightGreen 67f86f + 93: 227, // lightYellow fffa72 + 94: 69, // lightBlue 6a76fb + 95: 213, // lightMagenta fd7cfc + 96: 87, // lightCyan 68fdfe + 97: 15, // lightWhite ffffff + } + + // ---------- basic(16) <=> RGB color convert ---------- + // refer from Hyper app + basic2hexMap = map[uint8]string{ + 30: "000000", // black + 31: "c51e14", // red + 32: "1dc121", // green + 33: "c7c329", // yellow + 34: "0a2fc4", // blue + 35: "c839c5", // magenta + 36: "20c5c6", // cyan + 37: "c7c7c7", // white + // - don't add bg color + // 40: "000000", // black + // 41: "c51e14", // red + // 42: "1dc121", // green + // 43: "c7c329", // yellow + // 44: "0a2fc4", // blue + // 45: "c839c5", // magenta + // 46: "20c5c6", // cyan + // 47: "c7c7c7", // white + 90: "686868", // lightBlack/darkGray + 91: "fd6f6b", // lightRed + 92: "67f86f", // lightGreen + 93: "fffa72", // lightYellow + 94: "6a76fb", // lightBlue + 95: "fd7cfc", // lightMagenta + 96: "68fdfe", // lightCyan + 97: "ffffff", // lightWhite + // - don't add bg color + // 100: "686868", // lightBlack/darkGray + // 101: "fd6f6b", // lightRed + // 102: "67f86f", // lightGreen + // 103: "fffa72", // lightYellow + // 104: "6a76fb", // lightBlue + // 105: "fd7cfc", // lightMagenta + // 106: "68fdfe", // lightCyan + // 107: "ffffff", // lightWhite + } + // will convert data from basic2hexMap + hex2basicMap = initHex2basicMap() + + // ---------- 256 <=> RGB color convert ---------- + // adapted from https://gist.github.com/MicahElliott/719710 + + c256ToHexMap = init256ToHexMap() + + // rgb to 256 color look-up table + // RGB hex => 256 code + hexTo256Table = map[string]uint8{ + // Primary 3-bit (8 colors). Unique representation! + "000000": 0, + "800000": 1, + "008000": 2, + "808000": 3, + "000080": 4, + "800080": 5, + "008080": 6, + "c0c0c0": 7, + + // Equivalent "bright" versions of original 8 colors. + "808080": 8, + "ff0000": 9, + "00ff00": 10, + "ffff00": 11, + "0000ff": 12, + "ff00ff": 13, + "00ffff": 14, + "ffffff": 15, + + // values commented out below are duplicates from the prior sections + + // Strictly ascending. + // "000000": 16, + "000001": 16, // up: avoid key conflicts, value + 1 + "00005f": 17, + "000087": 18, + "0000af": 19, + "0000d7": 20, + // "0000ff": 21, + "0000fe": 21, // up: avoid key conflicts, value - 1 + "005f00": 22, + "005f5f": 23, + "005f87": 24, + "005faf": 25, + "005fd7": 26, + "005fff": 27, + "008700": 28, + "00875f": 29, + "008787": 30, + "0087af": 31, + "0087d7": 32, + "0087ff": 33, + "00af00": 34, + "00af5f": 35, + "00af87": 36, + "00afaf": 37, + "00afd7": 38, + "00afff": 39, + "00d700": 40, + "00d75f": 41, + "00d787": 42, + "00d7af": 43, + "00d7d7": 44, + "00d7ff": 45, + // "00ff00": 46, + "00ff01": 46, // up: avoid key conflicts, value + 1 + "00ff5f": 47, + "00ff87": 48, + "00ffaf": 49, + "00ffd7": 50, + // "00ffff": 51, + "00fffe": 51, // up: avoid key conflicts, value - 1 + "5f0000": 52, + "5f005f": 53, + "5f0087": 54, + "5f00af": 55, + "5f00d7": 56, + "5f00ff": 57, + "5f5f00": 58, + "5f5f5f": 59, + "5f5f87": 60, + "5f5faf": 61, + "5f5fd7": 62, + "5f5fff": 63, + "5f8700": 64, + "5f875f": 65, + "5f8787": 66, + "5f87af": 67, + "5f87d7": 68, + "5f87ff": 69, + "5faf00": 70, + "5faf5f": 71, + "5faf87": 72, + "5fafaf": 73, + "5fafd7": 74, + "5fafff": 75, + "5fd700": 76, + "5fd75f": 77, + "5fd787": 78, + "5fd7af": 79, + "5fd7d7": 80, + "5fd7ff": 81, + "5fff00": 82, + "5fff5f": 83, + "5fff87": 84, + "5fffaf": 85, + "5fffd7": 86, + "5fffff": 87, + "870000": 88, + "87005f": 89, + "870087": 90, + "8700af": 91, + "8700d7": 92, + "8700ff": 93, + "875f00": 94, + "875f5f": 95, + "875f87": 96, + "875faf": 97, + "875fd7": 98, + "875fff": 99, + "878700": 100, + "87875f": 101, + "878787": 102, + "8787af": 103, + "8787d7": 104, + "8787ff": 105, + "87af00": 106, + "87af5f": 107, + "87af87": 108, + "87afaf": 109, + "87afd7": 110, + "87afff": 111, + "87d700": 112, + "87d75f": 113, + "87d787": 114, + "87d7af": 115, + "87d7d7": 116, + "87d7ff": 117, + "87ff00": 118, + "87ff5f": 119, + "87ff87": 120, + "87ffaf": 121, + "87ffd7": 122, + "87ffff": 123, + "af0000": 124, + "af005f": 125, + "af0087": 126, + "af00af": 127, + "af00d7": 128, + "af00ff": 129, + "af5f00": 130, + "af5f5f": 131, + "af5f87": 132, + "af5faf": 133, + "af5fd7": 134, + "af5fff": 135, + "af8700": 136, + "af875f": 137, + "af8787": 138, + "af87af": 139, + "af87d7": 140, + "af87ff": 141, + "afaf00": 142, + "afaf5f": 143, + "afaf87": 144, + "afafaf": 145, + "afafd7": 146, + "afafff": 147, + "afd700": 148, + "afd75f": 149, + "afd787": 150, + "afd7af": 151, + "afd7d7": 152, + "afd7ff": 153, + "afff00": 154, + "afff5f": 155, + "afff87": 156, + "afffaf": 157, + "afffd7": 158, + "afffff": 159, + "d70000": 160, + "d7005f": 161, + "d70087": 162, + "d700af": 163, + "d700d7": 164, + "d700ff": 165, + "d75f00": 166, + "d75f5f": 167, + "d75f87": 168, + "d75faf": 169, + "d75fd7": 170, + "d75fff": 171, + "d78700": 172, + "d7875f": 173, + "d78787": 174, + "d787af": 175, + "d787d7": 176, + "d787ff": 177, + "d7af00": 178, + "d7af5f": 179, + "d7af87": 180, + "d7afaf": 181, + "d7afd7": 182, + "d7afff": 183, + "d7d700": 184, + "d7d75f": 185, + "d7d787": 186, + "d7d7af": 187, + "d7d7d7": 188, + "d7d7ff": 189, + "d7ff00": 190, + "d7ff5f": 191, + "d7ff87": 192, + "d7ffaf": 193, + "d7ffd7": 194, + "d7ffff": 195, + // "ff0000": 196, + "ff0001": 196, // up: avoid key conflicts, value + 1 + "ff005f": 197, + "ff0087": 198, + "ff00af": 199, + "ff00d7": 200, + // "ff00ff": 201, + "ff00fe": 201, // up: avoid key conflicts, value - 1 + "ff5f00": 202, + "ff5f5f": 203, + "ff5f87": 204, + "ff5faf": 205, + "ff5fd7": 206, + "ff5fff": 207, + "ff8700": 208, + "ff875f": 209, + "ff8787": 210, + "ff87af": 211, + "ff87d7": 212, + "ff87ff": 213, + "ffaf00": 214, + "ffaf5f": 215, + "ffaf87": 216, + "ffafaf": 217, + "ffafd7": 218, + "ffafff": 219, + "ffd700": 220, + "ffd75f": 221, + "ffd787": 222, + "ffd7af": 223, + "ffd7d7": 224, + "ffd7ff": 225, + // "ffff00": 226, + "ffff01": 226, // up: avoid key conflicts, value + 1 + "ffff5f": 227, + "ffff87": 228, + "ffffaf": 229, + "ffffd7": 230, + // "ffffff": 231, + "fffffe": 231, // up: avoid key conflicts, value - 1 + + // Gray-scale range. + "080808": 232, + "121212": 233, + "1c1c1c": 234, + "262626": 235, + "303030": 236, + "3a3a3a": 237, + "444444": 238, + "4e4e4e": 239, + "585858": 240, + "626262": 241, + "6c6c6c": 242, + "767676": 243, + // "808080": 244, + "808081": 244, // up: avoid key conflicts, value + 1 + "8a8a8a": 245, + "949494": 246, + "9e9e9e": 247, + "a8a8a8": 248, + "b2b2b2": 249, + "bcbcbc": 250, + "c6c6c6": 251, + "d0d0d0": 252, + "dadada": 253, + "e4e4e4": 254, + "eeeeee": 255, + } + + incs = []uint8{0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff} +) + +func initHex2basicMap() map[string]uint8 { + h2b := make(map[string]uint8, len(basic2hexMap)) + // ini data map + for u, s := range basic2hexMap { + h2b[s] = u + } + return h2b +} + +func init256ToHexMap() map[uint8]string { + c256toh := make(map[uint8]string, len(hexTo256Table)) + // ini data map + for hex, c256 := range hexTo256Table { + c256toh[c256] = hex + } + return c256toh +} + +// RgbTo256Table mapping data +func RgbTo256Table() map[string]uint8 { + return hexTo256Table +} + +// Colors2code convert colors to code. return like "32;45;3" +func Colors2code(colors ...Color) string { + if len(colors) == 0 { + return "" + } + + var codes []string + for _, color := range colors { + codes = append(codes, color.String()) + } + + return strings.Join(codes, ";") +} + +/************************************************************* + * HEX code <=> RGB/True color code + *************************************************************/ + +// Hex2rgb alias of the HexToRgb() +func Hex2rgb(hex string) []int { return HexToRgb(hex) } + +// HexToRGB alias of the HexToRgb() +func HexToRGB(hex string) []int { return HexToRgb(hex) } + +// HexToRgb convert hex color string to RGB numbers +// +// Usage: +// rgb := HexToRgb("ccc") // rgb: [204 204 204] +// rgb := HexToRgb("aabbcc") // rgb: [170 187 204] +// rgb := HexToRgb("#aabbcc") // rgb: [170 187 204] +// rgb := HexToRgb("0xad99c0") // rgb: [170 187 204] +func HexToRgb(hex string) (rgb []int) { + hex = strings.TrimSpace(hex) + if hex == "" { + return + } + + // like from css. eg "#ccc" "#ad99c0" + if hex[0] == '#' { + hex = hex[1:] + } + + hex = strings.ToLower(hex) + switch len(hex) { + case 3: // "ccc" + hex = string([]byte{hex[0], hex[0], hex[1], hex[1], hex[2], hex[2]}) + case 8: // "0xad99c0" + hex = strings.TrimPrefix(hex, "0x") + } + + // recheck + if len(hex) != 6 { + return + } + + // convert string to int64 + if i64, err := strconv.ParseInt(hex, 16, 32); err == nil { + color := int(i64) + // parse int + rgb = make([]int, 3) + rgb[0] = color >> 16 + rgb[1] = (color & 0x00FF00) >> 8 + rgb[2] = color & 0x0000FF + } + return +} + +// Rgb2hex alias of the RgbToHex() +func Rgb2hex(rgb []int) string { return RgbToHex(rgb) } + +// RgbToHex convert RGB-code to hex-code +// +// Usage: +// hex := RgbToHex([]int{170, 187, 204}) // hex: "aabbcc" +func RgbToHex(rgb []int) string { + hexNodes := make([]string, len(rgb)) + + for _, v := range rgb { + hexNodes = append(hexNodes, strconv.FormatInt(int64(v), 16)) + } + return strings.Join(hexNodes, "") +} + +/************************************************************* + * 4bit(16) color <=> RGB/True color + *************************************************************/ + +// Basic2hex convert basic color to hex string. +func Basic2hex(val uint8) string { + val = Fg2Bg(val) + return basic2hexMap[val] +} + +// Hex2basic convert hex string to basic color code. +func Hex2basic(hex string, asBg ...bool) uint8 { + val := hex2basicMap[hex] + + if len(asBg) > 0 && asBg[0] { + return Fg2Bg(val) + } + return val +} + +// Rgb2basic alias of the RgbToAnsi() +func Rgb2basic(r, g, b uint8, isBg bool) uint8 { + // is basic color, direct use static map data. + hex := RgbToHex([]int{int(r), int(g), int(b)}) + if val, ok := hex2basicMap[hex]; ok { + if isBg { + return val + 10 + } + return val + } + + return RgbToAnsi(r, g, b, isBg) +} + +// Rgb2ansi convert RGB-code to 16-code, alias of the RgbToAnsi() +func Rgb2ansi(r, g, b uint8, isBg bool) uint8 { + return RgbToAnsi(r, g, b, isBg) +} + +// RgbToAnsi convert RGB-code to 16-code +// refer https://github.com/radareorg/radare2/blob/master/libr/cons/rgb.c#L249-L271 +func RgbToAnsi(r, g, b uint8, isBg bool) uint8 { + var bright, c, k uint8 + base := compareVal(isBg, BgBase, FgBase) + + // eco bright-specific + if r == 0x80 && g == 0x80 && b == 0x80 { // 0x80=128 + bright = 53 + } else if r == 0xff || g == 0xff || b == 0xff { // 0xff=255 + bright = 60 + } // else bright = 0 + + if r == g && g == b { + // 0x7f=127 + // r = (r > 0x7f) ? 1 : 0; + r = compareVal(r > 0x7f, 1, 0) + g = compareVal(g > 0x7f, 1, 0) + b = compareVal(b > 0x7f, 1, 0) + } else { + k = (r + g + b) / 3 + + // r = (r >= k) ? 1 : 0; + r = compareVal(r >= k, 1, 0) + g = compareVal(g >= k, 1, 0) + b = compareVal(b >= k, 1, 0) + } + + // c = (r ? 1 : 0) + (g ? (b ? 6 : 2) : (b ? 4 : 0)) + c = compareVal(r > 0, 1, 0) + + if g > 0 { + c += compareVal(b > 0, 6, 2) + } else { + c += compareVal(b > 0, 4, 0) + } + return base + bright + c +} + +/************************************************************* + * 8bit(256) color <=> RGB/True color + *************************************************************/ + +// Rgb2short convert RGB-code to 256-code +func Rgb2short(r, g, b uint8) uint8 { + return RgbTo256(r, g, b) +} + +// RgbTo256 convert RGB-code to 256-code +func RgbTo256(r, g, b uint8) uint8 { + res := make([]uint8, 3) + for partI, part := range [3]uint8{r, g, b} { + i := 0 + for i < len(incs)-1 { + s, b := incs[i], incs[i+1] // smaller, bigger + if s <= part && part <= b { + s1 := math.Abs(float64(s) - float64(part)) + b1 := math.Abs(float64(b) - float64(part)) + var closest uint8 + if s1 < b1 { + closest = s + } else { + closest = b + } + res[partI] = closest + break + } + i++ + } + } + hex := fmt.Sprintf("%02x%02x%02x", res[0], res[1], res[2]) + equiv := hexTo256Table[hex] + return equiv +} + +// C256ToRgb convert an 256 color code to RGB numbers +func C256ToRgb(val uint8) (rgb []uint8) { + hex := c256ToHexMap[val] + // convert to rgb code + rgbInts := Hex2rgb(hex) + + return []uint8{ + uint8(rgbInts[0]), + uint8(rgbInts[1]), + uint8(rgbInts[2]), + } +} + +// C256ToRgbV1 convert an 256 color code to RGB numbers +// refer https://github.com/torvalds/linux/commit/cec5b2a97a11ade56a701e83044d0a2a984c67b4 +func C256ToRgbV1(val uint8) (rgb []uint8) { + var r, g, b uint8 + if val < 8 { // Standard colours. + // r = val&1 ? 0xaa : 0x00; + r = compareVal(val&1 == 1, 0xaa, 0x00) + g = compareVal(val&2 == 2, 0xaa, 0x00) + b = compareVal(val&4 == 4, 0xaa, 0x00) + } else if val < 16 { + // r = val & 1 ? 0xff : 0x55; + r = compareVal(val&1 == 1, 0xff, 0x55) + g = compareVal(val&2 == 2, 0xff, 0x55) + b = compareVal(val&4 == 4, 0xff, 0x55) + } else if val < 232 { /* 6x6x6 colour cube. */ + r = (val - 16) / 36 * 85 / 2 + g = (val - 16) / 6 % 6 * 85 / 2 + b = (val - 16) % 6 * 85 / 2 + } else { /* Grayscale ramp. */ + nv := uint8(int(val)*10 - 2312) + // set value + r, g, b = nv, nv, nv + } + + return []uint8{r, g, b} +} + +/************************************************************** + * HSL color <=> RGB/True color + ************************************************************ + * h,s,l = Hue, Saturation, Lightness + * + * refers + * http://en.wikipedia.org/wiki/HSL_color_space + * https://www.w3.org/TR/css-color-3/#hsl-color + * https://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion + * https://github.com/less/less.js/blob/master/packages/less/src/less/functions/color.js + * https://github.com/d3/d3-color/blob/v3.0.1/README.md#hsl + * + * examples: + * color: hsl(0, 100%, 50%) // red + * color: hsl(120, 100%, 50%) // lime + * color: hsl(120, 100%, 25%) // dark green + * color: hsl(120, 100%, 75%) // light green + * color: hsl(120, 75%, 75%) // pastel green, and so on + */ + +// HslIntToRgb Converts an HSL color value to RGB +// Assumes h: 0-360, s: 0-100, l: 0-100 +// returns r, g, and b in the set [0, 255]. +// +// Usage: +// HslIntToRgb(0, 100, 50) // red +// HslIntToRgb(120, 100, 50) // lime +// HslIntToRgb(120, 100, 25) // dark green +// HslIntToRgb(120, 100, 75) // light green +func HslIntToRgb(h, s, l int) (rgb []uint8) { + return HslToRgb(float64(h)/360, float64(s)/100, float64(l)/100) +} + +// HslToRgb Converts an HSL color value to RGB. Conversion formula +// adapted from http://en.wikipedia.org/wiki/HSL_color_space. +// Assumes h, s, and l are contained in the set [0, 1] +// returns r, g, and b in the set [0, 255]. +// +// Usage: +// rgbVals := HslToRgb(0, 1, 0.5) // red +func HslToRgb(h, s, l float64) (rgb []uint8) { + var r, g, b float64 + + if s == 0 { // achromatic + r, g, b = l, l, l + } else { + var hue2rgb = func(p, q, t float64) float64 { + if t < 0.0 { + t += 1 + } + if t > 1.0 { + t -= 1 + } + + if t < 1.0/6.0 { + return p + (q-p)*6.0*t + } + + if t < 1.0/2.0 { + return q + } + + if t < 2.0/3.0 { + return p + (q-p)*(2.0/3.0-t)*6.0 + } + return p + } + + // q = l < 0.5 ? l * (1 + s) : l + s - l*s + var q float64 + if l < 0.5 { + q = l * (1.0 + s) + } else { + q = l + s - l*s + } + + var p = 2.0*l - q + + r = hue2rgb(p, q, h+1.0/3.0) + g = hue2rgb(p, q, h) + b = hue2rgb(p, q, h-1.0/3.0) + } + + // return []uint8{uint8(r * 255), uint8(g * 255), uint8(b * 255)} + return []uint8{ + uint8(math.Round(r * 255)), + uint8(math.Round(g * 255)), + uint8(math.Round(b * 255)), + } +} + +// RgbToHslInt Converts an RGB color value to HSL. Conversion formula +// Assumes r, g, and b are contained in the set [0, 255] and +// returns [h,s,l] h: 0-360, s: 0-100, l: 0-100. +func RgbToHslInt(r, g, b uint8) []int { + f64s := RgbToHsl(r, g, b) + + return []int{int(f64s[0] * 360), int(f64s[1] * 100), int(f64s[2] * 100)} +} + +// RgbToHsl Converts an RGB color value to HSL. Conversion formula +// +// adapted from http://en.wikipedia.org/wiki/HSL_color_space. +// +// Assumes r, g, and b are contained in the set [0, 255] and +// returns h, s, and l in the set [0, 1]. +func RgbToHsl(r, g, b uint8) []float64 { + // to float64 + fr, fg, fb := float64(r), float64(g), float64(b) + // percentage + pr, pg, pb := float64(r)/255.0, float64(g)/255.0, float64(b)/255.0 + + ps := []float64{pr, pg, pb} + sort.Float64s(ps) + + min, max := ps[0], ps[2] + // max := math.Max(math.Max(pr, pg), pb) + // min := math.Min(math.Min(pr, pg), pb) + mid := (max + min) / 2 + + h, s, l := mid, mid, mid + if max == min { + h, s = 0, 0 // achromatic + } else { + var d = max - min + // s = l > 0.5 ? d / (2 - max - min) : d / (max + min) + s = compareF64Val(l > 0.5, d/(2-max-min), d/(max+min)) + + switch max { + case fr: + // h = (g - b) / d + (g < b ? 6 : 0) + h = (fg - fb) / d + h += compareF64Val(g < b, 6, 0) + case fg: + h = (fb-fr)/d + 2 + case fb: + h = (fr-fg)/d + 4 + } + + h /= 6 + } + + return []float64{h, s, l} +} + +/************************************************************** + * HSV color <=> RGB/True color + ************************************************************ + * h,s,l = Hue, Saturation, Value(Brightness) + * + * refers + * https://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion + * https://github.com/less/less.js/blob/master/packages/less/src/less/functions/color.js + * https://github.com/d3/d3-color/blob/v3.0.1/README.md#hsl + */ + +// HsvToRgb Converts an HSL color value to RGB. Conversion formula +// adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB +// Assumes h: 0-360, s: 0-100, l: 0-100 +// returns r, g, and b in the set [0, 255]. +func HsvToRgb(h, s, v int) (rgb []uint8) { + // TODO ... + return +} + +// Named rgb colors +// https://www.w3.org/TR/css-color-3/#svg-color +var namedRgbMap = map[string]string{ + "aliceblue": "240,248,255", // #F0F8FF + "antiquewhite": "250,235,215", // #FAEBD7 + "aqua": "0,255,255", // #00FFFF + "aquamarine": "127,255,212", // #7FFFD4 + "azure": "240,255,255", // #F0FFFF + "beige": "245,245,220", // #F5F5DC + "bisque": "255,228,196", // #FFE4C4 + "black": "0,0,0", // #000000 + "blanchedalmond": "255,235,205", // #FFEBCD + "blue": "0,0,255", // #0000FF + "blueviolet": "138,43,226", // #8A2BE2 + "brown": "165,42,42", // #A52A2A + "burlywood": "222,184,135", // #DEB887 + "cadetblue": "95,158,160", // #5F9EA0 + "chartreuse": "127,255,0", // #7FFF00 + "chocolate": "210,105,30", // #D2691E + "coral": "255,127,80", // #FF7F50 + "cornflowerblue": "100,149,237", // #6495ED + "cornsilk": "255,248,220", // #FFF8DC + "crimson": "220,20,60", // #DC143C + "cyan": "0,255,255", // #00FFFF + "darkblue": "0,0,139", // #00008B + "darkcyan": "0,139,139", // #008B8B + "darkgoldenrod": "184,134,11", // #B8860B + "darkgray": "169,169,169", // #A9A9A9 + "darkgreen": "0,100,0", // #006400 + "darkgrey": "169,169,169", // #A9A9A9 + "darkkhaki": "189,183,107", // #BDB76B + "darkmagenta": "139,0,139", // #8B008B + "darkolivegreen": "85,107,47", // #556B2F + "darkorange": "255,140,0", // #FF8C00 + "darkorchid": "153,50,204", // #9932CC + "darkred": "139,0,0", // #8B0000 + "darksalmon": "233,150,122", // #E9967A + "darkseagreen": "143,188,143", // #8FBC8F + "darkslateblue": "72,61,139", // #483D8B + "darkslategray": "47,79,79", // #2F4F4F + "darkslategrey": "47,79,79", // #2F4F4F + "darkturquoise": "0,206,209", // #00CED1 + "darkviolet": "148,0,211", // #9400D3 + "deeppink": "255,20,147", // #FF1493 + "deepskyblue": "0,191,255", // #00BFFF + "dimgray": "105,105,105", // #696969 + "dimgrey": "105,105,105", // #696969 + "dodgerblue": "30,144,255", // #1E90FF + "firebrick": "178,34,34", // #B22222 + "floralwhite": "255,250,240", // #FFFAF0 + "forestgreen": "34,139,34", // #228B22 + "fuchsia": "255,0,255", // #FF00FF + "gainsboro": "220,220,220", // #DCDCDC + "ghostwhite": "248,248,255", // #F8F8FF + "gold": "255,215,0", // #FFD700 + "goldenrod": "218,165,32", // #DAA520 + "gray": "128,128,128", // #808080 + "green": "0,128,0", // #008000 + "greenyellow": "173,255,47", // #ADFF2F + "grey": "128,128,128", // #808080 + "honeydew": "240,255,240", // #F0FFF0 + "hotpink": "255,105,180", // #FF69B4 + "indianred": "205,92,92", // #CD5C5C + "indigo": "75,0,130", // #4B0082 + "ivory": "255,255,240", // #FFFFF0 + "khaki": "240,230,140", // #F0E68C + "lavender": "230,230,250", // #E6E6FA + "lavenderblush": "255,240,245", // #FFF0F5 + "lawngreen": "124,252,0", // #7CFC00 + "lemonchiffon": "255,250,205", // #FFFACD + "lightblue": "173,216,230", // #ADD8E6 + "lightcoral": "240,128,128", // #F08080 + "lightcyan": "224,255,255", // #E0FFFF + "lightgoldenrodyellow": "250,250,210", // #FAFAD2 + "lightgray": "211,211,211", // #D3D3D3 + "lightgreen": "144,238,144", // #90EE90 + "lightgrey": "211,211,211", // #D3D3D3 + "lightpink": "255,182,193", // #FFB6C1 + "lightsalmon": "255,160,122", // #FFA07A + "lightseagreen": "32,178,170", // #20B2AA + "lightskyblue": "135,206,250", // #87CEFA + "lightslategray": "119,136,153", // #778899 + "lightslategrey": "119,136,153", // #778899 + "lightsteelblue": "176,196,222", // #B0C4DE + "lightyellow": "255,255,224", // #FFFFE0 + "lime": "0,255,0", // #00FF00 + "limegreen": "50,205,50", // #32CD32 + "linen": "250,240,230", // #FAF0E6 + "magenta": "255,0,255", // #FF00FF + "maroon": "128,0,0", // #800000 + "mediumaquamarine": "102,205,170", // #66CDAA + "mediumblue": "0,0,205", // #0000CD + "mediumorchid": "186,85,211", // #BA55D3 + "mediumpurple": "147,112,219", // #9370DB + "mediumseagreen": "60,179,113", // #3CB371 + "mediumslateblue": "123,104,238", // #7B68EE + "mediumspringgreen": "0,250,154", // #00FA9A + "mediumturquoise": "72,209,204", // #48D1CC + "mediumvioletred": "199,21,133", // #C71585 + "midnightblue": "25,25,112", // #191970 + "mintcream": "245,255,250", // #F5FFFA + "mistyrose": "255,228,225", // #FFE4E1 + "moccasin": "255,228,181", // #FFE4B5 + "navajowhite": "255,222,173", // #FFDEAD + "navy": "0,0,128", // #000080 + "oldlace": "253,245,230", // #FDF5E6 + "olive": "128,128,0", // #808000 + "olivedrab": "107,142,35", // #6B8E23 + "orange": "255,165,0", // #FFA500 + "orangered": "255,69,0", // #FF4500 + "orchid": "218,112,214", // #DA70D6 + "palegoldenrod": "238,232,170", // #EEE8AA + "palegreen": "152,251,152", // #98FB98 + "paleturquoise": "175,238,238", // #AFEEEE + "palevioletred": "219,112,147", // #DB7093 + "papayawhip": "255,239,213", // #FFEFD5 + "peachpuff": "255,218,185", // #FFDAB9 + "peru": "205,133,63", // #CD853F + "pink": "255,192,203", // #FFC0CB + "plum": "221,160,221", // #DDA0DD + "powderblue": "176,224,230", // #B0E0E6 + "purple": "128,0,128", // #800080 + "red": "255,0,0", // #FF0000 + "rosybrown": "188,143,143", // #BC8F8F + "royalblue": "65,105,225", // #4169E1 + "saddlebrown": "139,69,19", // #8B4513 + "salmon": "250,128,114", // #FA8072 + "sandybrown": "244,164,96", // #F4A460 + "seagreen": "46,139,87", // #2E8B57 + "seashell": "255,245,238", // #FFF5EE + "sienna": "160,82,45", // #A0522D + "silver": "192,192,192", // #C0C0C0 + "skyblue": "135,206,235", // #87CEEB + "slateblue": "106,90,205", // #6A5ACD + "slategray": "112,128,144", // #708090 + "slategrey": "112,128,144", // #708090 + "snow": "255,250,250", // #FFFAFA + "springgreen": "0,255,127", // #00FF7F + "steelblue": "70,130,180", // #4682B4 + "tan": "210,180,140", // #D2B48C + "teal": "0,128,128", // #008080 + "thistle": "216,191,216", // #D8BFD8 + "tomato": "255,99,71", // #FF6347 + "turquoise": "64,224,208", // #40E0D0 + "violet": "238,130,238", // #EE82EE + "wheat": "245,222,179", // #F5DEB3 + "white": "255,255,255", // #FFFFFF + "whitesmoke": "245,245,245", // #F5F5F5 + "yellow": "255,255,0", // #FFFF00 + "yellowgreen": "154,205,50", // #9ACD32 +} diff --git a/vendor/github.com/gookit/color/detect_env.go b/vendor/github.com/gookit/color/detect_env.go new file mode 100644 index 000000000..7fd8d81e2 --- /dev/null +++ b/vendor/github.com/gookit/color/detect_env.go @@ -0,0 +1,291 @@ +package color + +import ( + "io" + "os" + "runtime" + "strconv" + "strings" + "syscall" + + "github.com/xo/terminfo" +) + +// Level is the color level supported by a terminal. +type Level = terminfo.ColorLevel + +// terminal color available level alias of the terminfo.ColorLevel* +const ( + LevelNo = terminfo.ColorLevelNone // not support color. + Level16 = terminfo.ColorLevelBasic // basic - 3/4 bit color supported + Level256 = terminfo.ColorLevelHundreds // hundreds - 8-bit color supported + LevelRgb = terminfo.ColorLevelMillions // millions - (24 bit)true color supported +) + +/************************************************************* + * helper methods for detect color supports + *************************************************************/ + +// DetectColorLevel for current env +// +// NOTICE: The method will detect terminal info each times, +// if only want to get current color level, please direct call SupportColor() or TermColorLevel() +func DetectColorLevel() Level { + level, _ := detectTermColorLevel() + return level +} + +// detect terminal color support level +// +// refer https://github.com/Delta456/box-cli-maker +func detectTermColorLevel() (level Level, needVTP bool) { + // on windows WSL: + // - runtime.GOOS == "Linux" + // - support true-color + // env: + // WSL_DISTRO_NAME=Debian + if val := os.Getenv("WSL_DISTRO_NAME"); val != "" { + // detect WSL as it has True Color support + if detectWSL() { + debugf("True Color support on WSL environment") + return terminfo.ColorLevelMillions, false + } + } + + isWin := runtime.GOOS == "windows" + termVal := os.Getenv("TERM") + + // on TERM=screen: not support true-color + if termVal != "screen" { + // On JetBrains Terminal + // - support true-color + // env: + // TERMINAL_EMULATOR=JetBrains-JediTerm + val := os.Getenv("TERMINAL_EMULATOR") + if val == "JetBrains-JediTerm" { + debugf("True Color support on JetBrains-JediTerm, is win: %v", isWin) + return terminfo.ColorLevelMillions, isWin + } + } + + // level, err = terminfo.ColorLevelFromEnv() + level = detectColorLevelFromEnv(termVal, isWin) + debugf("color level by detectColorLevelFromEnv: %s", level.String()) + + // fallback: simple detect by TERM value string. + if level == terminfo.ColorLevelNone { + debugf("level none - fallback check special term color support") + // on Windows: enable VTP as it has True Color support + level, needVTP = detectSpecialTermColor(termVal) + } + return +} + +// detectColorFromEnv returns the color level COLORTERM, FORCE_COLOR, +// TERM_PROGRAM, or determined from the TERM environment variable. +// +// refer the terminfo.ColorLevelFromEnv() +// https://en.wikipedia.org/wiki/Terminfo +func detectColorLevelFromEnv(termVal string, isWin bool) Level { + // check for overriding environment variables + colorTerm, termProg, forceColor := os.Getenv("COLORTERM"), os.Getenv("TERM_PROGRAM"), os.Getenv("FORCE_COLOR") + switch { + case strings.Contains(colorTerm, "truecolor") || strings.Contains(colorTerm, "24bit"): + if termVal == "screen" { // on TERM=screen: not support true-color + return terminfo.ColorLevelHundreds + } + return terminfo.ColorLevelMillions + case colorTerm != "" || forceColor != "": + return terminfo.ColorLevelBasic + case termProg == "Apple_Terminal": + return terminfo.ColorLevelHundreds + case termProg == "Terminus" || termProg == "Hyper": + if termVal == "screen" { // on TERM=screen: not support true-color + return terminfo.ColorLevelHundreds + } + return terminfo.ColorLevelMillions + case termProg == "iTerm.app": + if termVal == "screen" { // on TERM=screen: not support true-color + return terminfo.ColorLevelHundreds + } + + // check iTerm version + ver := os.Getenv("TERM_PROGRAM_VERSION") + if ver != "" { + i, err := strconv.Atoi(strings.Split(ver, ".")[0]) + if err != nil { + saveInternalError(terminfo.ErrInvalidTermProgramVersion) + // return terminfo.ColorLevelNone + return terminfo.ColorLevelHundreds + } + if i == 3 { + return terminfo.ColorLevelMillions + } + } + return terminfo.ColorLevelHundreds + } + + // otherwise determine from TERM's max_colors capability + if !isWin && termVal != "" { + debugf("TERM=%s - check color level by load terminfo file", termVal) + ti, err := terminfo.Load(termVal) + if err != nil { + saveInternalError(err) + return terminfo.ColorLevelNone + } + + debugf("the loaded term info file is: %s", ti.File) + v, ok := ti.Nums[terminfo.MaxColors] + switch { + case !ok || v <= 16: + return terminfo.ColorLevelNone + case ok && v >= 256: + return terminfo.ColorLevelHundreds + } + return terminfo.ColorLevelBasic + } + + // no TERM env value. default return none level + return terminfo.ColorLevelNone + // return terminfo.ColorLevelBasic +} + +var detectedWSL bool +var wslContents string + +// https://github.com/Microsoft/WSL/issues/423#issuecomment-221627364 +func detectWSL() bool { + if !detectedWSL { + detectedWSL = true + + b := make([]byte, 1024) + // `cat /proc/version` + // on mac: + // !not the file! + // on linux(debian,ubuntu,alpine): + // Linux version 4.19.121-linuxkit (root@18b3f92ade35) (gcc version 9.2.0 (Alpine 9.2.0)) #1 SMP Thu Jan 21 15:36:34 UTC 2021 + // on win git bash, conEmu: + // MINGW64_NT-10.0-19042 version 3.1.7-340.x86_64 (@WIN-N0G619FD3UK) (gcc version 9.3.0 (GCC) ) 2020-10-23 13:08 UTC + // on WSL: + // Linux version 4.4.0-19041-Microsoft (Microsoft@Microsoft.com) (gcc version 5.4.0 (GCC) ) #488-Microsoft Mon Sep 01 13:43:00 PST 2020 + f, err := os.Open("/proc/version") + if err == nil { + _, _ = f.Read(b) // ignore error + if err = f.Close(); err != nil { + saveInternalError(err) + } + + wslContents = string(b) + return strings.Contains(wslContents, "Microsoft") + } + } + return false +} + +/* +// refer +// https://github.com/Delta456/box-cli-maker/blob/7b5a1ad8a016ce181e7d8b05e24b54ff60b4b38a/detect_unix.go#L27-L45 +// detect WSL as it has True Color support +func isWSL() bool { + // on windows WSL: + // - runtime.GOOS == "Linux" + // - support true-color + // WSL_DISTRO_NAME=Debian + if val := os.Getenv("WSL_DISTRO_NAME"); val == "" { + return false + } + + // `cat /proc/sys/kernel/osrelease` + // on mac: + // !not the file! + // on linux: + // 4.19.121-linuxkit + // on WSL Output: + // 4.4.0-19041-Microsoft + wsl, err := ioutil.ReadFile("/proc/sys/kernel/osrelease") + if err != nil { + saveInternalError(err) + return false + } + + // it gives "Microsoft" for WSL and "microsoft" for WSL 2 + // it supports True-color + content := strings.ToLower(string(wsl)) + return strings.Contains(content, "microsoft") +} +*/ + +/************************************************************* + * helper methods for check env + *************************************************************/ + +// IsWindows OS env +func IsWindows() bool { + return runtime.GOOS == "windows" +} + +// IsConsole Determine whether w is one of stderr, stdout, stdin +func IsConsole(w io.Writer) bool { + o, ok := w.(*os.File) + if !ok { + return false + } + + fd := o.Fd() + + // fix: cannot use 'o == os.Stdout' to compare + return fd == uintptr(syscall.Stdout) || fd == uintptr(syscall.Stdin) || fd == uintptr(syscall.Stderr) +} + +// IsMSys msys(MINGW64) environment, does not necessarily support color +func IsMSys() bool { + // like "MSYSTEM=MINGW64" + return len(os.Getenv("MSYSTEM")) > 0 +} + +// IsSupportColor check current console is support color. +// +// NOTICE: The method will detect terminal info each times, +// if only want get current color level, please direct call SupportColor() or TermColorLevel() +func IsSupportColor() bool { + return IsSupport16Color() +} + +// IsSupport16Color check current console is support color. +// +// NOTICE: The method will detect terminal info each times, +// if only want get current color level, please direct call SupportColor() or TermColorLevel() +func IsSupport16Color() bool { + level, _ := detectTermColorLevel() + return level > terminfo.ColorLevelNone +} + +// IsSupport256Color render check +// +// NOTICE: The method will detect terminal info each times, +// if only want to get current color level, please direct call SupportColor() or TermColorLevel() +func IsSupport256Color() bool { + level, _ := detectTermColorLevel() + return level > terminfo.ColorLevelBasic +} + +// IsSupportRGBColor check. alias of the IsSupportTrueColor() +// +// NOTICE: The method will detect terminal info each times, +// if only want get current color level, please direct call SupportColor() or TermColorLevel() +func IsSupportRGBColor() bool { + return IsSupportTrueColor() +} + +// IsSupportTrueColor render check. +// +// NOTICE: The method will detect terminal info each times, +// if only want get current color level, please direct call SupportColor() or TermColorLevel() +// +// ENV: +// "COLORTERM=truecolor" +// "COLORTERM=24bit" +func IsSupportTrueColor() bool { + level, _ := detectTermColorLevel() + return level > terminfo.ColorLevelHundreds +} diff --git a/vendor/github.com/gookit/color/detect_nonwin.go b/vendor/github.com/gookit/color/detect_nonwin.go new file mode 100644 index 000000000..26f10908e --- /dev/null +++ b/vendor/github.com/gookit/color/detect_nonwin.go @@ -0,0 +1,49 @@ +//go:build !windows +// +build !windows + +// The method in the file has no effect +// Only for compatibility with non-Windows systems + +package color + +import ( + "strings" + "syscall" + + "github.com/xo/terminfo" +) + +// detect special term color support +func detectSpecialTermColor(termVal string) (Level, bool) { + if termVal == "" { + return terminfo.ColorLevelNone, false + } + + debugf("terminfo check fail - fallback detect color by check TERM value") + + // on TERM=screen: + // - support 256, not support true-color. test on macOS + if termVal == "screen" { + return terminfo.ColorLevelHundreds, false + } + + if strings.Contains(termVal, "256color") { + return terminfo.ColorLevelHundreds, false + } + + if strings.Contains(termVal, "xterm") { + return terminfo.ColorLevelHundreds, false + // return terminfo.ColorLevelBasic, false + } + + // return terminfo.ColorLevelNone, nil + return terminfo.ColorLevelBasic, false +} + +// IsTerminal returns true if the given file descriptor is a terminal. +// +// Usage: +// IsTerminal(os.Stdout.Fd()) +func IsTerminal(fd uintptr) bool { + return fd == uintptr(syscall.Stdout) || fd == uintptr(syscall.Stdin) || fd == uintptr(syscall.Stderr) +} diff --git a/vendor/github.com/gookit/color/detect_windows.go b/vendor/github.com/gookit/color/detect_windows.go new file mode 100644 index 000000000..df538b215 --- /dev/null +++ b/vendor/github.com/gookit/color/detect_windows.go @@ -0,0 +1,250 @@ +//go:build windows +// +build windows + +// Display color on Windows +// +// refer: +// +// golang.org/x/sys/windows +// golang.org/x/crypto/ssh/terminal +// https://docs.microsoft.com/en-us/windows/console +package color + +import ( + "os" + "syscall" + "unsafe" + + "github.com/xo/terminfo" + "golang.org/x/sys/windows" +) + +// related docs +// https://docs.microsoft.com/zh-cn/windows/console/console-virtual-terminal-sequences +// https://docs.microsoft.com/zh-cn/windows/console/console-virtual-terminal-sequences#samples +var ( + // isMSys bool + kernel32 *syscall.LazyDLL + + procGetConsoleMode *syscall.LazyProc + procSetConsoleMode *syscall.LazyProc +) + +func init() { + if !SupportColor() { + isLikeInCmd = true + return + } + + // if disabled. + if !Enable { + return + } + + // if at Windows's ConEmu, Cmder, putty ... terminals not need VTP + + // -------- try force enable colors on windows terminal ------- + tryEnableVTP(needVTP) + + // fetch console screen buffer info + // err := getConsoleScreenBufferInfo(uintptr(syscall.Stdout), &defScreenInfo) +} + +// try force enable colors on Windows terminal +func tryEnableVTP(enable bool) bool { + if !enable { + return false + } + + debugf("True-Color by enable VirtualTerminalProcessing on windows") + + initKernel32Proc() + + // enable colors on Windows terminal + if tryEnableOnCONOUT() { + return true + } + + return tryEnableOnStdout() +} + +func initKernel32Proc() { + if kernel32 != nil { + return + } + + // load related Windows dll + // https://docs.microsoft.com/en-us/windows/console/setconsolemode + kernel32 = syscall.NewLazyDLL("kernel32.dll") + + procGetConsoleMode = kernel32.NewProc("GetConsoleMode") + procSetConsoleMode = kernel32.NewProc("SetConsoleMode") +} + +func tryEnableOnCONOUT() bool { + outHandle, err := syscall.Open("CONOUT$", syscall.O_RDWR, 0) + if err != nil { + saveInternalError(err) + return false + } + + err = EnableVirtualTerminalProcessing(outHandle, true) + if err != nil { + saveInternalError(err) + return false + } + + return true +} + +func tryEnableOnStdout() bool { + // try direct open syscall.Stdout + err := EnableVirtualTerminalProcessing(syscall.Stdout, true) + if err != nil { + saveInternalError(err) + return false + } + + return true +} + +// Get the Windows Version and Build Number +var ( + winVersion, _, buildNumber = windows.RtlGetNtVersionNumbers() +) + +// refer +// +// https://github.com/Delta456/box-cli-maker/blob/7b5a1ad8a016ce181e7d8b05e24b54ff60b4b38a/detect_windows.go#L30-L57 +// https://github.com/gookit/color/issues/25#issuecomment-738727917 +// +// detects the color level supported on Windows: cmd, powerShell +func detectSpecialTermColor(termVal string) (tl Level, needVTP bool) { + if os.Getenv("ConEmuANSI") == "ON" { + debugf("support True Color by ConEmuANSI=ON") + // ConEmuANSI is "ON" for generic ANSI support + // but True Color option is enabled by default + // I am just assuming that people wouldn't have disabled it + // Even if it is not enabled then ConEmu will auto round off + // accordingly + return terminfo.ColorLevelMillions, false + } + + // Before Windows 10 Build Number 10586, console never supported ANSI Colors + if buildNumber < 10586 || winVersion < 10 { + // Detect if using ANSICON on older systems + if os.Getenv("ANSICON") != "" { + conVersion := os.Getenv("ANSICON_VER") + // 8-bit Colors were only supported after v1.81 release + if conVersion >= "181" { + return terminfo.ColorLevelHundreds, false + } + return terminfo.ColorLevelBasic, false + } + + return terminfo.ColorLevelNone, false + } + + // True Color is not available before build 14931 so fallback to 8-bit color. + if buildNumber < 14931 { + return terminfo.ColorLevelHundreds, true + } + + // Windows 10 build 14931 is the first release that supports 16m/TrueColor + debugf("support True Color on windows version is >= build 14931") + return terminfo.ColorLevelMillions, true +} + +/************************************************************* + * render full color code on Windows(8,16,24bit color) + *************************************************************/ + +// docs https://docs.microsoft.com/zh-cn/windows/console/getconsolemode#parameters +const ( + // equals to docs page's ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 + EnableVirtualTerminalProcessingMode uint32 = 0x4 +) + +// EnableVirtualTerminalProcessing Enable virtual terminal processing +// +// ref from github.com/konsorten/go-windows-terminal-sequences +// doc https://docs.microsoft.com/zh-cn/windows/console/console-virtual-terminal-sequences#samples +// +// Usage: +// +// err := EnableVirtualTerminalProcessing(syscall.Stdout, true) +// // support print color text +// err = EnableVirtualTerminalProcessing(syscall.Stdout, false) +func EnableVirtualTerminalProcessing(stream syscall.Handle, enable bool) error { + var mode uint32 + // Check if it is currently in the terminal + // err := syscall.GetConsoleMode(syscall.Stdout, &mode) + err := syscall.GetConsoleMode(stream, &mode) + if err != nil { + // fmt.Println("EnableVirtualTerminalProcessing", err) + return err + } + + if enable { + mode |= EnableVirtualTerminalProcessingMode + } else { + mode &^= EnableVirtualTerminalProcessingMode + } + + ret, _, err := procSetConsoleMode.Call(uintptr(stream), uintptr(mode)) + if ret == 0 { + return err + } + + return nil +} + +// renderColorCodeOnCmd enable cmd color render. +// func renderColorCodeOnCmd(fn func()) { +// err := EnableVirtualTerminalProcessing(syscall.Stdout, true) +// // if is not in terminal, will clear color tag. +// if err != nil { +// // panic(err) +// fn() +// return +// } +// +// // force open color render +// old := ForceOpenColor() +// fn() +// // revert color setting +// supportColor = old +// +// err = EnableVirtualTerminalProcessing(syscall.Stdout, false) +// if err != nil { +// panic(err) +// } +// } + +/************************************************************* + * render simple color code on Windows + *************************************************************/ + +// IsTty returns true if the given file descriptor is a terminal. +func IsTty(fd uintptr) bool { + initKernel32Proc() + + var st uint32 + r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) + return r != 0 && e == 0 +} + +// IsTerminal returns true if the given file descriptor is a terminal. +// +// Usage: +// +// fd := os.Stdout.Fd() +// fd := uintptr(syscall.Stdout) // for Windows +// IsTerminal(fd) +func IsTerminal(fd uintptr) bool { + initKernel32Proc() + + var st uint32 + r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) + return r != 0 && e == 0 +} diff --git a/vendor/github.com/gookit/color/index.html b/vendor/github.com/gookit/color/index.html new file mode 100644 index 000000000..19e8e9a50 --- /dev/null +++ b/vendor/github.com/gookit/color/index.html @@ -0,0 +1,25 @@ + + + + + + + + Color - A command-line color library with true color support, universal API methods and Windows support. + + +
    + + + + diff --git a/vendor/github.com/gookit/color/printer.go b/vendor/github.com/gookit/color/printer.go new file mode 100644 index 000000000..326aabc0b --- /dev/null +++ b/vendor/github.com/gookit/color/printer.go @@ -0,0 +1,122 @@ +package color + +import "fmt" + +/************************************************************* + * colored message Printer + *************************************************************/ + +// PrinterFace interface +type PrinterFace interface { + fmt.Stringer + Sprint(a ...interface{}) string + Sprintf(format string, a ...interface{}) string + Print(a ...interface{}) + Printf(format string, a ...interface{}) + Println(a ...interface{}) +} + +// Printer a generic color message printer. +// +// Usage: +// p := &Printer{Code: "32;45;3"} +// p.Print("message") +type Printer struct { + // NoColor disable color. + NoColor bool + // Code color code string. eg "32;45;3" + Code string +} + +// NewPrinter instance +func NewPrinter(colorCode string) *Printer { + return &Printer{Code: colorCode} +} + +// String returns color code string. eg: "32;45;3" +func (p *Printer) String() string { + // panic("implement me") + return p.Code +} + +// Sprint returns rendering colored messages +func (p *Printer) Sprint(a ...interface{}) string { + return RenderCode(p.String(), a...) +} + +// Sprintf returns format and rendering colored messages +func (p *Printer) Sprintf(format string, a ...interface{}) string { + return RenderString(p.String(), fmt.Sprintf(format, a...)) +} + +// Print rendering colored messages +func (p *Printer) Print(a ...interface{}) { + doPrintV2(p.String(), fmt.Sprint(a...)) +} + +// Printf format and rendering colored messages +func (p *Printer) Printf(format string, a ...interface{}) { + doPrintV2(p.String(), fmt.Sprintf(format, a...)) +} + +// Println rendering colored messages with newline +func (p *Printer) Println(a ...interface{}) { + doPrintlnV2(p.Code, a) +} + +// IsEmpty color code +func (p *Printer) IsEmpty() bool { + return p.Code == "" +} + +/************************************************************* + * SimplePrinter struct + *************************************************************/ + +// SimplePrinter use for quick use color print on inject to struct +type SimplePrinter struct{} + +// Print message +func (s *SimplePrinter) Print(v ...interface{}) { + Print(v...) +} + +// Printf message +func (s *SimplePrinter) Printf(format string, v ...interface{}) { + Printf(format, v...) +} + +// Println message +func (s *SimplePrinter) Println(v ...interface{}) { + Println(v...) +} + +// Infof message +func (s *SimplePrinter) Infof(format string, a ...interface{}) { + Info.Printf(format, a...) +} + +// Infoln message +func (s *SimplePrinter) Infoln(a ...interface{}) { + Info.Println(a...) +} + +// Warnf message +func (s *SimplePrinter) Warnf(format string, a ...interface{}) { + Warn.Printf(format, a...) +} + +// Warnln message +func (s *SimplePrinter) Warnln(a ...interface{}) { + Warn.Println(a...) +} + +// Errorf message +func (s *SimplePrinter) Errorf(format string, a ...interface{}) { + Error.Printf(format, a...) +} + +// Errorln message +func (s *SimplePrinter) Errorln(a ...interface{}) { + Error.Println(a...) +} diff --git a/vendor/github.com/gookit/color/quickstart.go b/vendor/github.com/gookit/color/quickstart.go new file mode 100644 index 000000000..4dbd1a431 --- /dev/null +++ b/vendor/github.com/gookit/color/quickstart.go @@ -0,0 +1,108 @@ +package color + +/************************************************************* + * quick use color print message + *************************************************************/ + +// Redp print message with Red color +func Redp(a ...interface{}) { Red.Print(a...) } + +// Redf print message with Red color +func Redf(format string, a ...interface{}) { Red.Printf(format, a...) } + +// Redln print message line with Red color +func Redln(a ...interface{}) { Red.Println(a...) } + +// Bluep print message with Blue color +func Bluep(a ...interface{}) { Blue.Print(a...) } + +// Bluef print message with Blue color +func Bluef(format string, a ...interface{}) { Blue.Printf(format, a...) } + +// Blueln print message line with Blue color +func Blueln(a ...interface{}) { Blue.Println(a...) } + +// Cyanp print message with Cyan color +func Cyanp(a ...interface{}) { Cyan.Print(a...) } + +// Cyanf print message with Cyan color +func Cyanf(format string, a ...interface{}) { Cyan.Printf(format, a...) } + +// Cyanln print message line with Cyan color +func Cyanln(a ...interface{}) { Cyan.Println(a...) } + +// Grayp print message with Gray color +func Grayp(a ...interface{}) { Gray.Print(a...) } + +// Grayf print message with Gray color +func Grayf(format string, a ...interface{}) { Gray.Printf(format, a...) } + +// Grayln print message line with Gray color +func Grayln(a ...interface{}) { Gray.Println(a...) } + +// Greenp print message with Green color +func Greenp(a ...interface{}) { Green.Print(a...) } + +// Greenf print message with Green color +func Greenf(format string, a ...interface{}) { Green.Printf(format, a...) } + +// Greenln print message line with Green color +func Greenln(a ...interface{}) { Green.Println(a...) } + +// Yellowp print message with Yellow color +func Yellowp(a ...interface{}) { Yellow.Print(a...) } + +// Yellowf print message with Yellow color +func Yellowf(format string, a ...interface{}) { Yellow.Printf(format, a...) } + +// Yellowln print message line with Yellow color +func Yellowln(a ...interface{}) { Yellow.Println(a...) } + +// Magentap print message with Magenta color +func Magentap(a ...interface{}) { Magenta.Print(a...) } + +// Magentaf print message with Magenta color +func Magentaf(format string, a ...interface{}) { Magenta.Printf(format, a...) } + +// Magentaln print message line with Magenta color +func Magentaln(a ...interface{}) { Magenta.Println(a...) } + +/************************************************************* + * quick use style print message + *************************************************************/ + +// Infop print message with Info color +func Infop(a ...interface{}) { Info.Print(a...) } + +// Infof print message with Info style +func Infof(format string, a ...interface{}) { Info.Printf(format, a...) } + +// Infoln print message with Info style +func Infoln(a ...interface{}) { Info.Println(a...) } + +// Successp print message with success color +func Successp(a ...interface{}) { Success.Print(a...) } + +// Successf print message with success style +func Successf(format string, a ...interface{}) { Success.Printf(format, a...) } + +// Successln print message with success style +func Successln(a ...interface{}) { Success.Println(a...) } + +// Errorp print message with Error color +func Errorp(a ...interface{}) { Error.Print(a...) } + +// Errorf print message with Error style +func Errorf(format string, a ...interface{}) { Error.Printf(format, a...) } + +// Errorln print message with Error style +func Errorln(a ...interface{}) { Error.Println(a...) } + +// Warnp print message with Warn color +func Warnp(a ...interface{}) { Warn.Print(a...) } + +// Warnf print message with Warn style +func Warnf(format string, a ...interface{}) { Warn.Printf(format, a...) } + +// Warnln print message with Warn style +func Warnln(a ...interface{}) { Warn.Println(a...) } diff --git a/vendor/github.com/gookit/color/style.go b/vendor/github.com/gookit/color/style.go new file mode 100644 index 000000000..fad76fb33 --- /dev/null +++ b/vendor/github.com/gookit/color/style.go @@ -0,0 +1,315 @@ +package color + +import ( + "fmt" + "strings" +) + +/************************************************************* + * 16 color Style + *************************************************************/ + +// Style a 16 color style. can add: fg color, bg color, color options +// +// Example: +// color.Style{color.FgGreen}.Print("message") +type Style []Color + +// New create a custom style +// +// Usage: +// color.New(color.FgGreen).Print("message") +// equals to: +// color.Style{color.FgGreen}.Print("message") +func New(colors ...Color) Style { + return colors +} + +// Save to global styles map +func (s Style) Save(name string) { + AddStyle(name, s) +} + +// Add to global styles map +func (s *Style) Add(cs ...Color) { + *s = append(*s, cs...) +} + +// Render render text +// Usage: +// color.New(color.FgGreen).Render("text") +// color.New(color.FgGreen, color.BgBlack, color.OpBold).Render("text") +func (s Style) Render(a ...interface{}) string { + return RenderCode(s.String(), a...) +} + +// Renderln render text line. +// like Println, will add spaces for each argument +// Usage: +// color.New(color.FgGreen).Renderln("text", "more") +// color.New(color.FgGreen, color.BgBlack, color.OpBold).Render("text", "more") +func (s Style) Renderln(a ...interface{}) string { + return RenderWithSpaces(s.String(), a...) +} + +// Sprint is alias of the 'Render' +func (s Style) Sprint(a ...interface{}) string { + return RenderCode(s.String(), a...) +} + +// Sprintf format and render message. +func (s Style) Sprintf(format string, a ...interface{}) string { + return RenderString(s.String(), fmt.Sprintf(format, a...)) +} + +// Print render and Print text +func (s Style) Print(a ...interface{}) { + doPrintV2(s.String(), fmt.Sprint(a...)) +} + +// Printf render and print text +func (s Style) Printf(format string, a ...interface{}) { + doPrintV2(s.Code(), fmt.Sprintf(format, a...)) +} + +// Println render and print text line +func (s Style) Println(a ...interface{}) { + doPrintlnV2(s.String(), a) +} + +// Code convert to code string. returns like "32;45;3" +func (s Style) Code() string { + return s.String() +} + +// String convert to code string. returns like "32;45;3" +func (s Style) String() string { + return Colors2code(s...) +} + +// IsEmpty style +func (s Style) IsEmpty() bool { + return len(s) == 0 +} + +/************************************************************* + * Theme(extended Style) + *************************************************************/ + +// Theme definition. extends from Style +type Theme struct { + // Name theme name + Name string + // Style for the theme + Style +} + +// NewTheme instance +func NewTheme(name string, style Style) *Theme { + return &Theme{name, style} +} + +// Save to themes map +func (t *Theme) Save() { + AddTheme(t.Name, t.Style) +} + +// Tips use name as title, only apply style for name +func (t *Theme) Tips(format string, a ...interface{}) { + // only apply style for name + t.Print(strings.ToUpper(t.Name) + ": ") + Printf(format+"\n", a...) +} + +// Prompt use name as title, and apply style for message +func (t *Theme) Prompt(format string, a ...interface{}) { + title := strings.ToUpper(t.Name) + ":" + t.Println(title, fmt.Sprintf(format, a...)) +} + +// Block like Prompt, but will wrap a empty line +func (t *Theme) Block(format string, a ...interface{}) { + title := strings.ToUpper(t.Name) + ":\n" + + t.Println(title, fmt.Sprintf(format, a...)) +} + +/************************************************************* + * Theme: internal themes + *************************************************************/ + +// internal themes(like bootstrap style) +// Usage: +// color.Info.Print("message") +// color.Info.Printf("a %s message", "test") +// color.Warn.Println("message") +// color.Error.Println("message") +var ( + // Info color style + Info = &Theme{"info", Style{OpReset, FgGreen}} + // Note color style + Note = &Theme{"note", Style{OpBold, FgLightCyan}} + // Warn color style + Warn = &Theme{"warning", Style{OpBold, FgYellow}} + // Light color style + Light = &Theme{"light", Style{FgLightWhite, BgBlack}} + // Error color style + Error = &Theme{"error", Style{FgLightWhite, BgRed}} + // Danger color style + Danger = &Theme{"danger", Style{OpBold, FgRed}} + // Debug color style + Debug = &Theme{"debug", Style{OpReset, FgCyan}} + // Notice color style + Notice = &Theme{"notice", Style{OpBold, FgCyan}} + // Comment color style + Comment = &Theme{"comment", Style{OpReset, FgYellow}} + // Success color style + Success = &Theme{"success", Style{OpBold, FgGreen}} + // Primary color style + Primary = &Theme{"primary", Style{OpReset, FgBlue}} + // Question color style + Question = &Theme{"question", Style{OpReset, FgMagenta}} + // Secondary color style + Secondary = &Theme{"secondary", Style{FgDarkGray}} +) + +// Themes internal defined themes. +// Usage: +// color.Themes["info"].Println("message") +var Themes = map[string]*Theme{ + "info": Info, + "note": Note, + "light": Light, + "error": Error, + + "debug": Debug, + "danger": Danger, + "notice": Notice, + "success": Success, + "comment": Comment, + "primary": Primary, + "warning": Warn, + + "question": Question, + "secondary": Secondary, +} + +// AddTheme add a theme and style +func AddTheme(name string, style Style) { + Themes[name] = NewTheme(name, style) + Styles[name] = style +} + +// GetTheme get defined theme by name +func GetTheme(name string) *Theme { + return Themes[name] +} + +/************************************************************* + * internal styles + *************************************************************/ + +// Styles internal defined styles, like bootstrap styles. +// Usage: +// color.Styles["info"].Println("message") +var Styles = map[string]Style{ + "info": {OpReset, FgGreen}, + "note": {OpBold, FgLightCyan}, + "light": {FgLightWhite, BgRed}, + "error": {FgLightWhite, BgRed}, + + "danger": {OpBold, FgRed}, + "notice": {OpBold, FgCyan}, + "success": {OpBold, FgGreen}, + "comment": {OpReset, FgMagenta}, + "primary": {OpReset, FgBlue}, + "warning": {OpBold, FgYellow}, + + "question": {OpReset, FgMagenta}, + "secondary": {FgDarkGray}, +} + +// some style name alias +var styleAliases = map[string]string{ + "err": "error", + "suc": "success", + "warn": "warning", +} + +// AddStyle add a style +func AddStyle(name string, s Style) { + Styles[name] = s +} + +// GetStyle get defined style by name +func GetStyle(name string) Style { + if s, ok := Styles[name]; ok { + return s + } + + if realName, ok := styleAliases[name]; ok { + return Styles[realName] + } + + // empty style + return New() +} + +/************************************************************* + * color scheme + *************************************************************/ + +// Scheme struct +type Scheme struct { + Name string + Styles map[string]Style +} + +// NewScheme create new Scheme +func NewScheme(name string, styles map[string]Style) *Scheme { + return &Scheme{Name: name, Styles: styles} +} + +// NewDefaultScheme create an defuault color Scheme +func NewDefaultScheme(name string) *Scheme { + return NewScheme(name, map[string]Style{ + "info": {OpReset, FgGreen}, + "warn": {OpBold, FgYellow}, + "error": {FgLightWhite, BgRed}, + }) +} + +// Style get by name +func (s *Scheme) Style(name string) Style { + return s.Styles[name] +} + +// Infof message print +func (s *Scheme) Infof(format string, a ...interface{}) { + s.Styles["info"].Printf(format, a...) +} + +// Infoln message print +func (s *Scheme) Infoln(v ...interface{}) { + s.Styles["info"].Println(v...) +} + +// Warnf message print +func (s *Scheme) Warnf(format string, a ...interface{}) { + s.Styles["warn"].Printf(format, a...) +} + +// Warnln message print +func (s *Scheme) Warnln(v ...interface{}) { + s.Styles["warn"].Println(v...) +} + +// Errorf message print +func (s *Scheme) Errorf(format string, a ...interface{}) { + s.Styles["error"].Printf(format, a...) +} + +// Errorln message print +func (s *Scheme) Errorln(v ...interface{}) { + s.Styles["error"].Println(v...) +} diff --git a/vendor/github.com/gookit/color/utils.go b/vendor/github.com/gookit/color/utils.go new file mode 100644 index 000000000..4554b27ee --- /dev/null +++ b/vendor/github.com/gookit/color/utils.go @@ -0,0 +1,230 @@ +package color + +import ( + "fmt" + "io" + "log" + "strings" +) + +// SetTerminal by given code. +func SetTerminal(code string) error { + if !Enable || !SupportColor() { + return nil + } + + _, err := fmt.Fprintf(output, SettingTpl, code) + return err +} + +// ResetTerminal terminal setting. +func ResetTerminal() error { + if !Enable || !SupportColor() { + return nil + } + + _, err := fmt.Fprint(output, ResetSet) + return err +} + +/************************************************************* + * print methods(will auto parse color tags) + *************************************************************/ + +// Print render color tag and print messages +func Print(a ...interface{}) { + Fprint(output, a...) +} + +// Printf format and print messages +func Printf(format string, a ...interface{}) { + Fprintf(output, format, a...) +} + +// Println messages with new line +func Println(a ...interface{}) { + Fprintln(output, a...) +} + +// Fprint print rendered messages to writer +// +// Notice: will ignore print error +func Fprint(w io.Writer, a ...interface{}) { + _, err := fmt.Fprint(w, Render(a...)) + saveInternalError(err) + + // if isLikeInCmd { + // renderColorCodeOnCmd(func() { + // _, _ = fmt.Fprint(w, Render(a...)) + // }) + // } else { + // _, _ = fmt.Fprint(w, Render(a...)) + // } +} + +// Fprintf print format and rendered messages to writer. +// Notice: will ignore print error +func Fprintf(w io.Writer, format string, a ...interface{}) { + str := fmt.Sprintf(format, a...) + _, err := fmt.Fprint(w, ReplaceTag(str)) + saveInternalError(err) +} + +// Fprintln print rendered messages line to writer +// Notice: will ignore print error +func Fprintln(w io.Writer, a ...interface{}) { + str := formatArgsForPrintln(a) + _, err := fmt.Fprintln(w, ReplaceTag(str)) + saveInternalError(err) +} + +// Lprint passes colored messages to a log.Logger for printing. +// Notice: should be goroutine safe +func Lprint(l *log.Logger, a ...interface{}) { + l.Print(Render(a...)) +} + +// Render parse color tags, return rendered string. +// +// Usage: +// +// text := Render("hello world!") +// fmt.Println(text) +func Render(a ...interface{}) string { + if len(a) == 0 { + return "" + } + return ReplaceTag(fmt.Sprint(a...)) +} + +// Sprint parse color tags, return rendered string +func Sprint(a ...interface{}) string { + if len(a) == 0 { + return "" + } + + return ReplaceTag(fmt.Sprint(a...)) +} + +// Sprintf format and return rendered string +func Sprintf(format string, a ...interface{}) string { + return ReplaceTag(fmt.Sprintf(format, a...)) +} + +// String alias of the ReplaceTag +func String(s string) string { + return ReplaceTag(s) +} + +// Text alias of the ReplaceTag +func Text(s string) string { + return ReplaceTag(s) +} + +// Uint8sToInts convert []uint8 to []int +// func Uint8sToInts(u8s []uint8 ) []int { +// ints := make([]int, len(u8s)) +// for i, u8 := range u8s { +// ints[i] = int(u8) +// } +// return ints +// } + +/************************************************************* + * helper methods for print + *************************************************************/ + +// new implementation, support render full color code on pwsh.exe, cmd.exe +func doPrintV2(code, str string) { + _, err := fmt.Fprint(output, RenderString(code, str)) + saveInternalError(err) + + // if isLikeInCmd { + // renderColorCodeOnCmd(func() { + // _, _ = fmt.Fprint(output, RenderString(code, str)) + // }) + // } else { + // _, _ = fmt.Fprint(output, RenderString(code, str)) + // } +} + +// new implementation, support render full color code on pwsh.exe, cmd.exe +func doPrintlnV2(code string, args []interface{}) { + str := formatArgsForPrintln(args) + _, err := fmt.Fprintln(output, RenderString(code, str)) + saveInternalError(err) +} + +// use Println, will add spaces for each arg +func formatArgsForPrintln(args []interface{}) (message string) { + if ln := len(args); ln == 0 { + message = "" + } else if ln == 1 { + message = fmt.Sprint(args[0]) + } else { + message = fmt.Sprintln(args...) + // clear last "\n" + message = message[:len(message)-1] + } + return +} + +/************************************************************* + * helper methods + *************************************************************/ + +// is on debug mode +// func isDebugMode() bool { +// return debugMode == "on" +// } + +func debugf(f string, v ...interface{}) { + if debugMode { + fmt.Print("COLOR_DEBUG: ") + fmt.Printf(f, v...) + fmt.Println() + } +} + +// equals: return ok ? val1 : val2 +func isValidUint8(val int) bool { + return val >= 0 && val < 256 +} + +// equals: return ok ? val1 : val2 +func compareVal(ok bool, val1, val2 uint8) uint8 { + if ok { + return val1 + } + return val2 +} + +// equals: return ok ? val1 : val2 +func compareF64Val(ok bool, val1, val2 float64) float64 { + if ok { + return val1 + } + return val2 +} + +func saveInternalError(err error) { + if err != nil { + debugf("inner error: %s", err.Error()) + innerErrs = append(innerErrs, err) + } +} + +func stringToArr(str, sep string) (arr []string) { + str = strings.TrimSpace(str) + if str == "" { + return + } + + ss := strings.Split(str, sep) + for _, val := range ss { + if val = strings.TrimSpace(val); val != "" { + arr = append(arr, val) + } + } + return +} diff --git a/vendor/github.com/huandu/xstrings/.gitignore b/vendor/github.com/huandu/xstrings/.gitignore new file mode 100644 index 000000000..daf913b1b --- /dev/null +++ b/vendor/github.com/huandu/xstrings/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/vendor/github.com/huandu/xstrings/.travis.yml b/vendor/github.com/huandu/xstrings/.travis.yml new file mode 100644 index 000000000..d6460be41 --- /dev/null +++ b/vendor/github.com/huandu/xstrings/.travis.yml @@ -0,0 +1,7 @@ +language: go +install: + - go get golang.org/x/tools/cmd/cover + - go get github.com/mattn/goveralls +script: + - go test -v -covermode=count -coverprofile=coverage.out + - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ ! -z "$COVERALLS_TOKEN" ]; then $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN; fi' diff --git a/vendor/github.com/huandu/xstrings/CONTRIBUTING.md b/vendor/github.com/huandu/xstrings/CONTRIBUTING.md new file mode 100644 index 000000000..d7b4b8d58 --- /dev/null +++ b/vendor/github.com/huandu/xstrings/CONTRIBUTING.md @@ -0,0 +1,23 @@ +# Contributing # + +Thanks for your contribution in advance. No matter what you will contribute to this project, pull request or bug report or feature discussion, it's always highly appreciated. + +## New API or feature ## + +I want to speak more about how to add new functions to this package. + +Package `xstring` is a collection of useful string functions which should be implemented in Go. It's a bit subject to say which function should be included and which should not. I set up following rules in order to make it clear and as objective as possible. + +* Rule 1: Only string algorithm, which takes string as input, can be included. +* Rule 2: If a function has been implemented in package `string`, it must not be included. +* Rule 3: If a function is not language neutral, it must not be included. +* Rule 4: If a function is a part of standard library in other languages, it can be included. +* Rule 5: If a function is quite useful in some famous framework or library, it can be included. + +New function must be discussed in project issues before submitting any code. If a pull request with new functions is sent without any ref issue, it will be rejected. + +## Pull request ## + +Pull request is always welcome. Just make sure you have run `go fmt` and all test cases passed before submit. + +If the pull request is to add a new API or feature, don't forget to update README.md and add new API in function list. diff --git a/vendor/github.com/huandu/xstrings/LICENSE b/vendor/github.com/huandu/xstrings/LICENSE new file mode 100644 index 000000000..270177259 --- /dev/null +++ b/vendor/github.com/huandu/xstrings/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Huan Du + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/vendor/github.com/huandu/xstrings/README.md b/vendor/github.com/huandu/xstrings/README.md new file mode 100644 index 000000000..292bf2f39 --- /dev/null +++ b/vendor/github.com/huandu/xstrings/README.md @@ -0,0 +1,117 @@ +# xstrings # + +[![Build Status](https://travis-ci.org/huandu/xstrings.svg?branch=master)](https://travis-ci.org/huandu/xstrings) +[![GoDoc](https://godoc.org/github.com/huandu/xstrings?status.svg)](https://godoc.org/github.com/huandu/xstrings) +[![Go Report](https://goreportcard.com/badge/github.com/huandu/xstrings)](https://goreportcard.com/report/github.com/huandu/xstrings) +[![Coverage Status](https://coveralls.io/repos/github/huandu/xstrings/badge.svg?branch=master)](https://coveralls.io/github/huandu/xstrings?branch=master) + +Go package [xstrings](https://godoc.org/github.com/huandu/xstrings) is a collection of string functions, which are widely used in other languages but absent in Go package [strings](http://golang.org/pkg/strings). + +All functions are well tested and carefully tuned for performance. + +## Propose a new function ## + +Please review [contributing guideline](CONTRIBUTING.md) and [create new issue](https://github.com/huandu/xstrings/issues) to state why it should be included. + +## Install ## + +Use `go get` to install this library. + + go get github.com/huandu/xstrings + +## API document ## + +See [GoDoc](https://godoc.org/github.com/huandu/xstrings) for full document. + +## Function list ## + +Go functions have a unique naming style. One, who has experience in other language but new in Go, may have difficulties to find out right string function to use. + +Here is a list of functions in [strings](http://golang.org/pkg/strings) and [xstrings](https://godoc.org/github.com/huandu/xstrings) with enough extra information about how to map these functions to their friends in other languages. Hope this list could be helpful for fresh gophers. + +### Package `xstrings` functions ### + +*Keep this table sorted by Function in ascending order.* + +| Function | Friends | # | +| -------- | ------- | --- | +| [Center](https://godoc.org/github.com/huandu/xstrings#Center) | `str.center` in Python; `String#center` in Ruby | [#30](https://github.com/huandu/xstrings/issues/30) | +| [Count](https://godoc.org/github.com/huandu/xstrings#Count) | `String#count` in Ruby | [#16](https://github.com/huandu/xstrings/issues/16) | +| [Delete](https://godoc.org/github.com/huandu/xstrings#Delete) | `String#delete` in Ruby | [#17](https://github.com/huandu/xstrings/issues/17) | +| [ExpandTabs](https://godoc.org/github.com/huandu/xstrings#ExpandTabs) | `str.expandtabs` in Python | [#27](https://github.com/huandu/xstrings/issues/27) | +| [FirstRuneToLower](https://godoc.org/github.com/huandu/xstrings#FirstRuneToLower) | `lcfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) | +| [FirstRuneToUpper](https://godoc.org/github.com/huandu/xstrings#FirstRuneToUpper) | `String#capitalize` in Ruby; `ucfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) | +| [Insert](https://godoc.org/github.com/huandu/xstrings#Insert) | `String#insert` in Ruby | [#18](https://github.com/huandu/xstrings/issues/18) | +| [LastPartition](https://godoc.org/github.com/huandu/xstrings#LastPartition) | `str.rpartition` in Python; `String#rpartition` in Ruby | [#19](https://github.com/huandu/xstrings/issues/19) | +| [LeftJustify](https://godoc.org/github.com/huandu/xstrings#LeftJustify) | `str.ljust` in Python; `String#ljust` in Ruby | [#28](https://github.com/huandu/xstrings/issues/28) | +| [Len](https://godoc.org/github.com/huandu/xstrings#Len) | `mb_strlen` in PHP | [#23](https://github.com/huandu/xstrings/issues/23) | +| [Partition](https://godoc.org/github.com/huandu/xstrings#Partition) | `str.partition` in Python; `String#partition` in Ruby | [#10](https://github.com/huandu/xstrings/issues/10) | +| [Reverse](https://godoc.org/github.com/huandu/xstrings#Reverse) | `String#reverse` in Ruby; `strrev` in PHP; `reverse` in Perl | [#7](https://github.com/huandu/xstrings/issues/7) | +| [RightJustify](https://godoc.org/github.com/huandu/xstrings#RightJustify) | `str.rjust` in Python; `String#rjust` in Ruby | [#29](https://github.com/huandu/xstrings/issues/29) | +| [RuneWidth](https://godoc.org/github.com/huandu/xstrings#RuneWidth) | - | [#27](https://github.com/huandu/xstrings/issues/27) | +| [Scrub](https://godoc.org/github.com/huandu/xstrings#Scrub) | `String#scrub` in Ruby | [#20](https://github.com/huandu/xstrings/issues/20) | +| [Shuffle](https://godoc.org/github.com/huandu/xstrings#Shuffle) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) | +| [ShuffleSource](https://godoc.org/github.com/huandu/xstrings#ShuffleSource) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) | +| [Slice](https://godoc.org/github.com/huandu/xstrings#Slice) | `mb_substr` in PHP | [#9](https://github.com/huandu/xstrings/issues/9) | +| [Squeeze](https://godoc.org/github.com/huandu/xstrings#Squeeze) | `String#squeeze` in Ruby | [#11](https://github.com/huandu/xstrings/issues/11) | +| [Successor](https://godoc.org/github.com/huandu/xstrings#Successor) | `String#succ` or `String#next` in Ruby | [#22](https://github.com/huandu/xstrings/issues/22) | +| [SwapCase](https://godoc.org/github.com/huandu/xstrings#SwapCase) | `str.swapcase` in Python; `String#swapcase` in Ruby | [#12](https://github.com/huandu/xstrings/issues/12) | +| [ToCamelCase](https://godoc.org/github.com/huandu/xstrings#ToCamelCase) | `String#camelize` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) | +| [ToKebab](https://godoc.org/github.com/huandu/xstrings#ToKebabCase) | - | [#41](https://github.com/huandu/xstrings/issues/41) | +| [ToSnakeCase](https://godoc.org/github.com/huandu/xstrings#ToSnakeCase) | `String#underscore` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) | +| [Translate](https://godoc.org/github.com/huandu/xstrings#Translate) | `str.translate` in Python; `String#tr` in Ruby; `strtr` in PHP; `tr///` in Perl | [#21](https://github.com/huandu/xstrings/issues/21) | +| [Width](https://godoc.org/github.com/huandu/xstrings#Width) | `mb_strwidth` in PHP | [#26](https://github.com/huandu/xstrings/issues/26) | +| [WordCount](https://godoc.org/github.com/huandu/xstrings#WordCount) | `str_word_count` in PHP | [#14](https://github.com/huandu/xstrings/issues/14) | +| [WordSplit](https://godoc.org/github.com/huandu/xstrings#WordSplit) | - | [#14](https://github.com/huandu/xstrings/issues/14) | + +### Package `strings` functions ### + +*Keep this table sorted by Function in ascending order.* + +| Function | Friends | +| -------- | ------- | +| [Contains](http://golang.org/pkg/strings/#Contains) | `String#include?` in Ruby | +| [ContainsAny](http://golang.org/pkg/strings/#ContainsAny) | - | +| [ContainsRune](http://golang.org/pkg/strings/#ContainsRune) | - | +| [Count](http://golang.org/pkg/strings/#Count) | `str.count` in Python; `substr_count` in PHP | +| [EqualFold](http://golang.org/pkg/strings/#EqualFold) | `stricmp` in PHP; `String#casecmp` in Ruby | +| [Fields](http://golang.org/pkg/strings/#Fields) | `str.split` in Python; `split` in Perl; `String#split` in Ruby | +| [FieldsFunc](http://golang.org/pkg/strings/#FieldsFunc) | - | +| [HasPrefix](http://golang.org/pkg/strings/#HasPrefix) | `str.startswith` in Python; `String#start_with?` in Ruby | +| [HasSuffix](http://golang.org/pkg/strings/#HasSuffix) | `str.endswith` in Python; `String#end_with?` in Ruby | +| [Index](http://golang.org/pkg/strings/#Index) | `str.index` in Python; `String#index` in Ruby; `strpos` in PHP; `index` in Perl | +| [IndexAny](http://golang.org/pkg/strings/#IndexAny) | - | +| [IndexByte](http://golang.org/pkg/strings/#IndexByte) | - | +| [IndexFunc](http://golang.org/pkg/strings/#IndexFunc) | - | +| [IndexRune](http://golang.org/pkg/strings/#IndexRune) | - | +| [Join](http://golang.org/pkg/strings/#Join) | `str.join` in Python; `Array#join` in Ruby; `implode` in PHP; `join` in Perl | +| [LastIndex](http://golang.org/pkg/strings/#LastIndex) | `str.rindex` in Python; `String#rindex`; `strrpos` in PHP; `rindex` in Perl | +| [LastIndexAny](http://golang.org/pkg/strings/#LastIndexAny) | - | +| [LastIndexFunc](http://golang.org/pkg/strings/#LastIndexFunc) | - | +| [Map](http://golang.org/pkg/strings/#Map) | `String#each_codepoint` in Ruby | +| [Repeat](http://golang.org/pkg/strings/#Repeat) | operator `*` in Python and Ruby; `str_repeat` in PHP | +| [Replace](http://golang.org/pkg/strings/#Replace) | `str.replace` in Python; `String#sub` in Ruby; `str_replace` in PHP | +| [Split](http://golang.org/pkg/strings/#Split) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl | +| [SplitAfter](http://golang.org/pkg/strings/#SplitAfter) | - | +| [SplitAfterN](http://golang.org/pkg/strings/#SplitAfterN) | - | +| [SplitN](http://golang.org/pkg/strings/#SplitN) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl | +| [Title](http://golang.org/pkg/strings/#Title) | `str.title` in Python | +| [ToLower](http://golang.org/pkg/strings/#ToLower) | `str.lower` in Python; `String#downcase` in Ruby; `strtolower` in PHP; `lc` in Perl | +| [ToLowerSpecial](http://golang.org/pkg/strings/#ToLowerSpecial) | - | +| [ToTitle](http://golang.org/pkg/strings/#ToTitle) | - | +| [ToTitleSpecial](http://golang.org/pkg/strings/#ToTitleSpecial) | - | +| [ToUpper](http://golang.org/pkg/strings/#ToUpper) | `str.upper` in Python; `String#upcase` in Ruby; `strtoupper` in PHP; `uc` in Perl | +| [ToUpperSpecial](http://golang.org/pkg/strings/#ToUpperSpecial) | - | +| [Trim](http://golang.org/pkg/strings/#Trim) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP | +| [TrimFunc](http://golang.org/pkg/strings/#TrimFunc) | - | +| [TrimLeft](http://golang.org/pkg/strings/#TrimLeft) | `str.lstrip` in Python; `String#lstrip` in Ruby; `ltrim` in PHP | +| [TrimLeftFunc](http://golang.org/pkg/strings/#TrimLeftFunc) | - | +| [TrimPrefix](http://golang.org/pkg/strings/#TrimPrefix) | - | +| [TrimRight](http://golang.org/pkg/strings/#TrimRight) | `str.rstrip` in Python; `String#rstrip` in Ruby; `rtrim` in PHP | +| [TrimRightFunc](http://golang.org/pkg/strings/#TrimRightFunc) | - | +| [TrimSpace](http://golang.org/pkg/strings/#TrimSpace) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP | +| [TrimSuffix](http://golang.org/pkg/strings/#TrimSuffix) | `String#chomp` in Ruby; `chomp` in Perl | + +## License ## + +This library is licensed under MIT license. See LICENSE for details. diff --git a/vendor/github.com/huandu/xstrings/common.go b/vendor/github.com/huandu/xstrings/common.go new file mode 100644 index 000000000..f427cc84e --- /dev/null +++ b/vendor/github.com/huandu/xstrings/common.go @@ -0,0 +1,21 @@ +// Copyright 2015 Huan Du. All rights reserved. +// Licensed under the MIT license that can be found in the LICENSE file. + +package xstrings + +const bufferMaxInitGrowSize = 2048 + +// Lazy initialize a buffer. +func allocBuffer(orig, cur string) *stringBuilder { + output := &stringBuilder{} + maxSize := len(orig) * 4 + + // Avoid to reserve too much memory at once. + if maxSize > bufferMaxInitGrowSize { + maxSize = bufferMaxInitGrowSize + } + + output.Grow(maxSize) + output.WriteString(orig[:len(orig)-len(cur)]) + return output +} diff --git a/vendor/github.com/huandu/xstrings/convert.go b/vendor/github.com/huandu/xstrings/convert.go new file mode 100644 index 000000000..3d5a34950 --- /dev/null +++ b/vendor/github.com/huandu/xstrings/convert.go @@ -0,0 +1,590 @@ +// Copyright 2015 Huan Du. All rights reserved. +// Licensed under the MIT license that can be found in the LICENSE file. + +package xstrings + +import ( + "math/rand" + "unicode" + "unicode/utf8" +) + +// ToCamelCase is to convert words separated by space, underscore and hyphen to camel case. +// +// Some samples. +// "some_words" => "SomeWords" +// "http_server" => "HttpServer" +// "no_https" => "NoHttps" +// "_complex__case_" => "_Complex_Case_" +// "some words" => "SomeWords" +func ToCamelCase(str string) string { + if len(str) == 0 { + return "" + } + + buf := &stringBuilder{} + var r0, r1 rune + var size int + + // leading connector will appear in output. + for len(str) > 0 { + r0, size = utf8.DecodeRuneInString(str) + str = str[size:] + + if !isConnector(r0) { + r0 = unicode.ToUpper(r0) + break + } + + buf.WriteRune(r0) + } + + if len(str) == 0 { + // A special case for a string contains only 1 rune. + if size != 0 { + buf.WriteRune(r0) + } + + return buf.String() + } + + for len(str) > 0 { + r1 = r0 + r0, size = utf8.DecodeRuneInString(str) + str = str[size:] + + if isConnector(r0) && isConnector(r1) { + buf.WriteRune(r1) + continue + } + + if isConnector(r1) { + r0 = unicode.ToUpper(r0) + } else { + r0 = unicode.ToLower(r0) + buf.WriteRune(r1) + } + } + + buf.WriteRune(r0) + return buf.String() +} + +// ToSnakeCase can convert all upper case characters in a string to +// snake case format. +// +// Some samples. +// "FirstName" => "first_name" +// "HTTPServer" => "http_server" +// "NoHTTPS" => "no_https" +// "GO_PATH" => "go_path" +// "GO PATH" => "go_path" // space is converted to underscore. +// "GO-PATH" => "go_path" // hyphen is converted to underscore. +// "http2xx" => "http_2xx" // insert an underscore before a number and after an alphabet. +// "HTTP20xOK" => "http_20x_ok" +// "Duration2m3s" => "duration_2m3s" +// "Bld4Floor3rd" => "bld4_floor_3rd" +func ToSnakeCase(str string) string { + return camelCaseToLowerCase(str, '_') +} + +// ToKebabCase can convert all upper case characters in a string to +// kebab case format. +// +// Some samples. +// "FirstName" => "first-name" +// "HTTPServer" => "http-server" +// "NoHTTPS" => "no-https" +// "GO_PATH" => "go-path" +// "GO PATH" => "go-path" // space is converted to '-'. +// "GO-PATH" => "go-path" // hyphen is converted to '-'. +// "http2xx" => "http-2xx" // insert an underscore before a number and after an alphabet. +// "HTTP20xOK" => "http-20x-ok" +// "Duration2m3s" => "duration-2m3s" +// "Bld4Floor3rd" => "bld4-floor-3rd" +func ToKebabCase(str string) string { + return camelCaseToLowerCase(str, '-') +} + +func camelCaseToLowerCase(str string, connector rune) string { + if len(str) == 0 { + return "" + } + + buf := &stringBuilder{} + wt, word, remaining := nextWord(str) + + for len(remaining) > 0 { + if wt != connectorWord { + toLower(buf, wt, word, connector) + } + + prev := wt + last := word + wt, word, remaining = nextWord(remaining) + + switch prev { + case numberWord: + for wt == alphabetWord || wt == numberWord { + toLower(buf, wt, word, connector) + wt, word, remaining = nextWord(remaining) + } + + if wt != invalidWord && wt != punctWord { + buf.WriteRune(connector) + } + + case connectorWord: + toLower(buf, prev, last, connector) + + case punctWord: + // nothing. + + default: + if wt != numberWord { + if wt != connectorWord && wt != punctWord { + buf.WriteRune(connector) + } + + break + } + + if len(remaining) == 0 { + break + } + + last := word + wt, word, remaining = nextWord(remaining) + + // consider number as a part of previous word. + // e.g. "Bld4Floor" => "bld4_floor" + if wt != alphabetWord { + toLower(buf, numberWord, last, connector) + + if wt != connectorWord && wt != punctWord { + buf.WriteRune(connector) + } + + break + } + + // if there are some lower case letters following a number, + // add connector before the number. + // e.g. "HTTP2xx" => "http_2xx" + buf.WriteRune(connector) + toLower(buf, numberWord, last, connector) + + for wt == alphabetWord || wt == numberWord { + toLower(buf, wt, word, connector) + wt, word, remaining = nextWord(remaining) + } + + if wt != invalidWord && wt != connectorWord && wt != punctWord { + buf.WriteRune(connector) + } + } + } + + toLower(buf, wt, word, connector) + return buf.String() +} + +func isConnector(r rune) bool { + return r == '-' || r == '_' || unicode.IsSpace(r) +} + +type wordType int + +const ( + invalidWord wordType = iota + numberWord + upperCaseWord + alphabetWord + connectorWord + punctWord + otherWord +) + +func nextWord(str string) (wt wordType, word, remaining string) { + if len(str) == 0 { + return + } + + var offset int + remaining = str + r, size := nextValidRune(remaining, utf8.RuneError) + offset += size + + if r == utf8.RuneError { + wt = invalidWord + word = str[:offset] + remaining = str[offset:] + return + } + + switch { + case isConnector(r): + wt = connectorWord + remaining = remaining[size:] + + for len(remaining) > 0 { + r, size = nextValidRune(remaining, r) + + if !isConnector(r) { + break + } + + offset += size + remaining = remaining[size:] + } + + case unicode.IsPunct(r): + wt = punctWord + remaining = remaining[size:] + + for len(remaining) > 0 { + r, size = nextValidRune(remaining, r) + + if !unicode.IsPunct(r) { + break + } + + offset += size + remaining = remaining[size:] + } + + case unicode.IsUpper(r): + wt = upperCaseWord + remaining = remaining[size:] + + if len(remaining) == 0 { + break + } + + r, size = nextValidRune(remaining, r) + + switch { + case unicode.IsUpper(r): + prevSize := size + offset += size + remaining = remaining[size:] + + for len(remaining) > 0 { + r, size = nextValidRune(remaining, r) + + if !unicode.IsUpper(r) { + break + } + + prevSize = size + offset += size + remaining = remaining[size:] + } + + // it's a bit complex when dealing with a case like "HTTPStatus". + // it's expected to be splitted into "HTTP" and "Status". + // Therefore "S" should be in remaining instead of word. + if len(remaining) > 0 && isAlphabet(r) { + offset -= prevSize + remaining = str[offset:] + } + + case isAlphabet(r): + offset += size + remaining = remaining[size:] + + for len(remaining) > 0 { + r, size = nextValidRune(remaining, r) + + if !isAlphabet(r) || unicode.IsUpper(r) { + break + } + + offset += size + remaining = remaining[size:] + } + } + + case isAlphabet(r): + wt = alphabetWord + remaining = remaining[size:] + + for len(remaining) > 0 { + r, size = nextValidRune(remaining, r) + + if !isAlphabet(r) || unicode.IsUpper(r) { + break + } + + offset += size + remaining = remaining[size:] + } + + case unicode.IsNumber(r): + wt = numberWord + remaining = remaining[size:] + + for len(remaining) > 0 { + r, size = nextValidRune(remaining, r) + + if !unicode.IsNumber(r) { + break + } + + offset += size + remaining = remaining[size:] + } + + default: + wt = otherWord + remaining = remaining[size:] + + for len(remaining) > 0 { + r, size = nextValidRune(remaining, r) + + if size == 0 || isConnector(r) || isAlphabet(r) || unicode.IsNumber(r) || unicode.IsPunct(r) { + break + } + + offset += size + remaining = remaining[size:] + } + } + + word = str[:offset] + return +} + +func nextValidRune(str string, prev rune) (r rune, size int) { + var sz int + + for len(str) > 0 { + r, sz = utf8.DecodeRuneInString(str) + size += sz + + if r != utf8.RuneError { + return + } + + str = str[sz:] + } + + r = prev + return +} + +func toLower(buf *stringBuilder, wt wordType, str string, connector rune) { + buf.Grow(buf.Len() + len(str)) + + if wt != upperCaseWord && wt != connectorWord { + buf.WriteString(str) + return + } + + for len(str) > 0 { + r, size := utf8.DecodeRuneInString(str) + str = str[size:] + + if isConnector(r) { + buf.WriteRune(connector) + } else if unicode.IsUpper(r) { + buf.WriteRune(unicode.ToLower(r)) + } else { + buf.WriteRune(r) + } + } +} + +// SwapCase will swap characters case from upper to lower or lower to upper. +func SwapCase(str string) string { + var r rune + var size int + + buf := &stringBuilder{} + + for len(str) > 0 { + r, size = utf8.DecodeRuneInString(str) + + switch { + case unicode.IsUpper(r): + buf.WriteRune(unicode.ToLower(r)) + + case unicode.IsLower(r): + buf.WriteRune(unicode.ToUpper(r)) + + default: + buf.WriteRune(r) + } + + str = str[size:] + } + + return buf.String() +} + +// FirstRuneToUpper converts first rune to upper case if necessary. +func FirstRuneToUpper(str string) string { + if str == "" { + return str + } + + r, size := utf8.DecodeRuneInString(str) + + if !unicode.IsLower(r) { + return str + } + + buf := &stringBuilder{} + buf.WriteRune(unicode.ToUpper(r)) + buf.WriteString(str[size:]) + return buf.String() +} + +// FirstRuneToLower converts first rune to lower case if necessary. +func FirstRuneToLower(str string) string { + if str == "" { + return str + } + + r, size := utf8.DecodeRuneInString(str) + + if !unicode.IsUpper(r) { + return str + } + + buf := &stringBuilder{} + buf.WriteRune(unicode.ToLower(r)) + buf.WriteString(str[size:]) + return buf.String() +} + +// Shuffle randomizes runes in a string and returns the result. +// It uses default random source in `math/rand`. +func Shuffle(str string) string { + if str == "" { + return str + } + + runes := []rune(str) + index := 0 + + for i := len(runes) - 1; i > 0; i-- { + index = rand.Intn(i + 1) + + if i != index { + runes[i], runes[index] = runes[index], runes[i] + } + } + + return string(runes) +} + +// ShuffleSource randomizes runes in a string with given random source. +func ShuffleSource(str string, src rand.Source) string { + if str == "" { + return str + } + + runes := []rune(str) + index := 0 + r := rand.New(src) + + for i := len(runes) - 1; i > 0; i-- { + index = r.Intn(i + 1) + + if i != index { + runes[i], runes[index] = runes[index], runes[i] + } + } + + return string(runes) +} + +// Successor returns the successor to string. +// +// If there is one alphanumeric rune is found in string, increase the rune by 1. +// If increment generates a "carry", the rune to the left of it is incremented. +// This process repeats until there is no carry, adding an additional rune if necessary. +// +// If there is no alphanumeric rune, the rightmost rune will be increased by 1 +// regardless whether the result is a valid rune or not. +// +// Only following characters are alphanumeric. +// * a - z +// * A - Z +// * 0 - 9 +// +// Samples (borrowed from ruby's String#succ document): +// "abcd" => "abce" +// "THX1138" => "THX1139" +// "<>" => "<>" +// "1999zzz" => "2000aaa" +// "ZZZ9999" => "AAAA0000" +// "***" => "**+" +func Successor(str string) string { + if str == "" { + return str + } + + var r rune + var i int + carry := ' ' + runes := []rune(str) + l := len(runes) + lastAlphanumeric := l + + for i = l - 1; i >= 0; i-- { + r = runes[i] + + if ('a' <= r && r <= 'y') || + ('A' <= r && r <= 'Y') || + ('0' <= r && r <= '8') { + runes[i]++ + carry = ' ' + lastAlphanumeric = i + break + } + + switch r { + case 'z': + runes[i] = 'a' + carry = 'a' + lastAlphanumeric = i + + case 'Z': + runes[i] = 'A' + carry = 'A' + lastAlphanumeric = i + + case '9': + runes[i] = '0' + carry = '0' + lastAlphanumeric = i + } + } + + // Needs to add one character for carry. + if i < 0 && carry != ' ' { + buf := &stringBuilder{} + buf.Grow(l + 4) // Reserve enough space for write. + + if lastAlphanumeric != 0 { + buf.WriteString(str[:lastAlphanumeric]) + } + + buf.WriteRune(carry) + + for _, r = range runes[lastAlphanumeric:] { + buf.WriteRune(r) + } + + return buf.String() + } + + // No alphanumeric character. Simply increase last rune's value. + if lastAlphanumeric == l { + runes[l-1]++ + } + + return string(runes) +} diff --git a/vendor/github.com/huandu/xstrings/count.go b/vendor/github.com/huandu/xstrings/count.go new file mode 100644 index 000000000..f96e38703 --- /dev/null +++ b/vendor/github.com/huandu/xstrings/count.go @@ -0,0 +1,120 @@ +// Copyright 2015 Huan Du. All rights reserved. +// Licensed under the MIT license that can be found in the LICENSE file. + +package xstrings + +import ( + "unicode" + "unicode/utf8" +) + +// Len returns str's utf8 rune length. +func Len(str string) int { + return utf8.RuneCountInString(str) +} + +// WordCount returns number of words in a string. +// +// Word is defined as a locale dependent string containing alphabetic characters, +// which may also contain but not start with `'` and `-` characters. +func WordCount(str string) int { + var r rune + var size, n int + + inWord := false + + for len(str) > 0 { + r, size = utf8.DecodeRuneInString(str) + + switch { + case isAlphabet(r): + if !inWord { + inWord = true + n++ + } + + case inWord && (r == '\'' || r == '-'): + // Still in word. + + default: + inWord = false + } + + str = str[size:] + } + + return n +} + +const minCJKCharacter = '\u3400' + +// Checks r is a letter but not CJK character. +func isAlphabet(r rune) bool { + if !unicode.IsLetter(r) { + return false + } + + switch { + // Quick check for non-CJK character. + case r < minCJKCharacter: + return true + + // Common CJK characters. + case r >= '\u4E00' && r <= '\u9FCC': + return false + + // Rare CJK characters. + case r >= '\u3400' && r <= '\u4D85': + return false + + // Rare and historic CJK characters. + case r >= '\U00020000' && r <= '\U0002B81D': + return false + } + + return true +} + +// Width returns string width in monotype font. +// Multi-byte characters are usually twice the width of single byte characters. +// +// Algorithm comes from `mb_strwidth` in PHP. +// http://php.net/manual/en/function.mb-strwidth.php +func Width(str string) int { + var r rune + var size, n int + + for len(str) > 0 { + r, size = utf8.DecodeRuneInString(str) + n += RuneWidth(r) + str = str[size:] + } + + return n +} + +// RuneWidth returns character width in monotype font. +// Multi-byte characters are usually twice the width of single byte characters. +// +// Algorithm comes from `mb_strwidth` in PHP. +// http://php.net/manual/en/function.mb-strwidth.php +func RuneWidth(r rune) int { + switch { + case r == utf8.RuneError || r < '\x20': + return 0 + + case '\x20' <= r && r < '\u2000': + return 1 + + case '\u2000' <= r && r < '\uFF61': + return 2 + + case '\uFF61' <= r && r < '\uFFA0': + return 1 + + case '\uFFA0' <= r: + return 2 + } + + return 0 +} diff --git a/vendor/github.com/huandu/xstrings/doc.go b/vendor/github.com/huandu/xstrings/doc.go new file mode 100644 index 000000000..1a6ef069f --- /dev/null +++ b/vendor/github.com/huandu/xstrings/doc.go @@ -0,0 +1,8 @@ +// Copyright 2015 Huan Du. All rights reserved. +// Licensed under the MIT license that can be found in the LICENSE file. + +// Package xstrings is to provide string algorithms which are useful but not included in `strings` package. +// See project home page for details. https://github.com/huandu/xstrings +// +// Package xstrings assumes all strings are encoded in utf8. +package xstrings diff --git a/vendor/github.com/huandu/xstrings/format.go b/vendor/github.com/huandu/xstrings/format.go new file mode 100644 index 000000000..8cd76c525 --- /dev/null +++ b/vendor/github.com/huandu/xstrings/format.go @@ -0,0 +1,169 @@ +// Copyright 2015 Huan Du. All rights reserved. +// Licensed under the MIT license that can be found in the LICENSE file. + +package xstrings + +import ( + "unicode/utf8" +) + +// ExpandTabs can expand tabs ('\t') rune in str to one or more spaces dpending on +// current column and tabSize. +// The column number is reset to zero after each newline ('\n') occurring in the str. +// +// ExpandTabs uses RuneWidth to decide rune's width. +// For example, CJK characters will be treated as two characters. +// +// If tabSize <= 0, ExpandTabs panics with error. +// +// Samples: +// ExpandTabs("a\tbc\tdef\tghij\tk", 4) => "a bc def ghij k" +// ExpandTabs("abcdefg\thij\nk\tl", 4) => "abcdefg hij\nk l" +// ExpandTabs("z中\t文\tw", 4) => "z中 文 w" +func ExpandTabs(str string, tabSize int) string { + if tabSize <= 0 { + panic("tab size must be positive") + } + + var r rune + var i, size, column, expand int + var output *stringBuilder + + orig := str + + for len(str) > 0 { + r, size = utf8.DecodeRuneInString(str) + + if r == '\t' { + expand = tabSize - column%tabSize + + if output == nil { + output = allocBuffer(orig, str) + } + + for i = 0; i < expand; i++ { + output.WriteRune(' ') + } + + column += expand + } else { + if r == '\n' { + column = 0 + } else { + column += RuneWidth(r) + } + + if output != nil { + output.WriteRune(r) + } + } + + str = str[size:] + } + + if output == nil { + return orig + } + + return output.String() +} + +// LeftJustify returns a string with pad string at right side if str's rune length is smaller than length. +// If str's rune length is larger than length, str itself will be returned. +// +// If pad is an empty string, str will be returned. +// +// Samples: +// LeftJustify("hello", 4, " ") => "hello" +// LeftJustify("hello", 10, " ") => "hello " +// LeftJustify("hello", 10, "123") => "hello12312" +func LeftJustify(str string, length int, pad string) string { + l := Len(str) + + if l >= length || pad == "" { + return str + } + + remains := length - l + padLen := Len(pad) + + output := &stringBuilder{} + output.Grow(len(str) + (remains/padLen+1)*len(pad)) + output.WriteString(str) + writePadString(output, pad, padLen, remains) + return output.String() +} + +// RightJustify returns a string with pad string at left side if str's rune length is smaller than length. +// If str's rune length is larger than length, str itself will be returned. +// +// If pad is an empty string, str will be returned. +// +// Samples: +// RightJustify("hello", 4, " ") => "hello" +// RightJustify("hello", 10, " ") => " hello" +// RightJustify("hello", 10, "123") => "12312hello" +func RightJustify(str string, length int, pad string) string { + l := Len(str) + + if l >= length || pad == "" { + return str + } + + remains := length - l + padLen := Len(pad) + + output := &stringBuilder{} + output.Grow(len(str) + (remains/padLen+1)*len(pad)) + writePadString(output, pad, padLen, remains) + output.WriteString(str) + return output.String() +} + +// Center returns a string with pad string at both side if str's rune length is smaller than length. +// If str's rune length is larger than length, str itself will be returned. +// +// If pad is an empty string, str will be returned. +// +// Samples: +// Center("hello", 4, " ") => "hello" +// Center("hello", 10, " ") => " hello " +// Center("hello", 10, "123") => "12hello123" +func Center(str string, length int, pad string) string { + l := Len(str) + + if l >= length || pad == "" { + return str + } + + remains := length - l + padLen := Len(pad) + + output := &stringBuilder{} + output.Grow(len(str) + (remains/padLen+1)*len(pad)) + writePadString(output, pad, padLen, remains/2) + output.WriteString(str) + writePadString(output, pad, padLen, (remains+1)/2) + return output.String() +} + +func writePadString(output *stringBuilder, pad string, padLen, remains int) { + var r rune + var size int + + repeats := remains / padLen + + for i := 0; i < repeats; i++ { + output.WriteString(pad) + } + + remains = remains % padLen + + if remains != 0 { + for i := 0; i < remains; i++ { + r, size = utf8.DecodeRuneInString(pad) + output.WriteRune(r) + pad = pad[size:] + } + } +} diff --git a/vendor/github.com/huandu/xstrings/manipulate.go b/vendor/github.com/huandu/xstrings/manipulate.go new file mode 100644 index 000000000..64075f9bb --- /dev/null +++ b/vendor/github.com/huandu/xstrings/manipulate.go @@ -0,0 +1,216 @@ +// Copyright 2015 Huan Du. All rights reserved. +// Licensed under the MIT license that can be found in the LICENSE file. + +package xstrings + +import ( + "strings" + "unicode/utf8" +) + +// Reverse a utf8 encoded string. +func Reverse(str string) string { + var size int + + tail := len(str) + buf := make([]byte, tail) + s := buf + + for len(str) > 0 { + _, size = utf8.DecodeRuneInString(str) + tail -= size + s = append(s[:tail], []byte(str[:size])...) + str = str[size:] + } + + return string(buf) +} + +// Slice a string by rune. +// +// Start must satisfy 0 <= start <= rune length. +// +// End can be positive, zero or negative. +// If end >= 0, start and end must satisfy start <= end <= rune length. +// If end < 0, it means slice to the end of string. +// +// Otherwise, Slice will panic as out of range. +func Slice(str string, start, end int) string { + var size, startPos, endPos int + + origin := str + + if start < 0 || end > len(str) || (end >= 0 && start > end) { + panic("out of range") + } + + if end >= 0 { + end -= start + } + + for start > 0 && len(str) > 0 { + _, size = utf8.DecodeRuneInString(str) + start-- + startPos += size + str = str[size:] + } + + if end < 0 { + return origin[startPos:] + } + + endPos = startPos + + for end > 0 && len(str) > 0 { + _, size = utf8.DecodeRuneInString(str) + end-- + endPos += size + str = str[size:] + } + + if len(str) == 0 && (start > 0 || end > 0) { + panic("out of range") + } + + return origin[startPos:endPos] +} + +// Partition splits a string by sep into three parts. +// The return value is a slice of strings with head, match and tail. +// +// If str contains sep, for example "hello" and "l", Partition returns +// "he", "l", "lo" +// +// If str doesn't contain sep, for example "hello" and "x", Partition returns +// "hello", "", "" +func Partition(str, sep string) (head, match, tail string) { + index := strings.Index(str, sep) + + if index == -1 { + head = str + return + } + + head = str[:index] + match = str[index : index+len(sep)] + tail = str[index+len(sep):] + return +} + +// LastPartition splits a string by last instance of sep into three parts. +// The return value is a slice of strings with head, match and tail. +// +// If str contains sep, for example "hello" and "l", LastPartition returns +// "hel", "l", "o" +// +// If str doesn't contain sep, for example "hello" and "x", LastPartition returns +// "", "", "hello" +func LastPartition(str, sep string) (head, match, tail string) { + index := strings.LastIndex(str, sep) + + if index == -1 { + tail = str + return + } + + head = str[:index] + match = str[index : index+len(sep)] + tail = str[index+len(sep):] + return +} + +// Insert src into dst at given rune index. +// Index is counted by runes instead of bytes. +// +// If index is out of range of dst, panic with out of range. +func Insert(dst, src string, index int) string { + return Slice(dst, 0, index) + src + Slice(dst, index, -1) +} + +// Scrub scrubs invalid utf8 bytes with repl string. +// Adjacent invalid bytes are replaced only once. +func Scrub(str, repl string) string { + var buf *stringBuilder + var r rune + var size, pos int + var hasError bool + + origin := str + + for len(str) > 0 { + r, size = utf8.DecodeRuneInString(str) + + if r == utf8.RuneError { + if !hasError { + if buf == nil { + buf = &stringBuilder{} + } + + buf.WriteString(origin[:pos]) + hasError = true + } + } else if hasError { + hasError = false + buf.WriteString(repl) + + origin = origin[pos:] + pos = 0 + } + + pos += size + str = str[size:] + } + + if buf != nil { + buf.WriteString(origin) + return buf.String() + } + + // No invalid byte. + return origin +} + +// WordSplit splits a string into words. Returns a slice of words. +// If there is no word in a string, return nil. +// +// Word is defined as a locale dependent string containing alphabetic characters, +// which may also contain but not start with `'` and `-` characters. +func WordSplit(str string) []string { + var word string + var words []string + var r rune + var size, pos int + + inWord := false + + for len(str) > 0 { + r, size = utf8.DecodeRuneInString(str) + + switch { + case isAlphabet(r): + if !inWord { + inWord = true + word = str + pos = 0 + } + + case inWord && (r == '\'' || r == '-'): + // Still in word. + + default: + if inWord { + inWord = false + words = append(words, word[:pos]) + } + } + + pos += size + str = str[size:] + } + + if inWord { + words = append(words, word[:pos]) + } + + return words +} diff --git a/vendor/github.com/huandu/xstrings/stringbuilder.go b/vendor/github.com/huandu/xstrings/stringbuilder.go new file mode 100644 index 000000000..bb0919d32 --- /dev/null +++ b/vendor/github.com/huandu/xstrings/stringbuilder.go @@ -0,0 +1,7 @@ +//+build go1.10 + +package xstrings + +import "strings" + +type stringBuilder = strings.Builder diff --git a/vendor/github.com/huandu/xstrings/stringbuilder_go110.go b/vendor/github.com/huandu/xstrings/stringbuilder_go110.go new file mode 100644 index 000000000..dac389d13 --- /dev/null +++ b/vendor/github.com/huandu/xstrings/stringbuilder_go110.go @@ -0,0 +1,9 @@ +//+build !go1.10 + +package xstrings + +import "bytes" + +type stringBuilder struct { + bytes.Buffer +} diff --git a/vendor/github.com/huandu/xstrings/translate.go b/vendor/github.com/huandu/xstrings/translate.go new file mode 100644 index 000000000..42e694fb1 --- /dev/null +++ b/vendor/github.com/huandu/xstrings/translate.go @@ -0,0 +1,546 @@ +// Copyright 2015 Huan Du. All rights reserved. +// Licensed under the MIT license that can be found in the LICENSE file. + +package xstrings + +import ( + "unicode" + "unicode/utf8" +) + +type runeRangeMap struct { + FromLo rune // Lower bound of range map. + FromHi rune // An inclusive higher bound of range map. + ToLo rune + ToHi rune +} + +type runeDict struct { + Dict [unicode.MaxASCII + 1]rune +} + +type runeMap map[rune]rune + +// Translator can translate string with pre-compiled from and to patterns. +// If a from/to pattern pair needs to be used more than once, it's recommended +// to create a Translator and reuse it. +type Translator struct { + quickDict *runeDict // A quick dictionary to look up rune by index. Only available for latin runes. + runeMap runeMap // Rune map for translation. + ranges []*runeRangeMap // Ranges of runes. + mappedRune rune // If mappedRune >= 0, all matched runes are translated to the mappedRune. + reverted bool // If to pattern is empty, all matched characters will be deleted. + hasPattern bool +} + +// NewTranslator creates new Translator through a from/to pattern pair. +func NewTranslator(from, to string) *Translator { + tr := &Translator{} + + if from == "" { + return tr + } + + reverted := from[0] == '^' + deletion := len(to) == 0 + + if reverted { + from = from[1:] + } + + var fromStart, fromEnd, fromRangeStep rune + var toStart, toEnd, toRangeStep rune + var fromRangeSize, toRangeSize rune + var singleRunes []rune + + // Update the to rune range. + updateRange := func() { + // No more rune to read in the to rune pattern. + if toEnd == utf8.RuneError { + return + } + + if toRangeStep == 0 { + to, toStart, toEnd, toRangeStep = nextRuneRange(to, toEnd) + return + } + + // Current range is not empty. Consume 1 rune from start. + if toStart != toEnd { + toStart += toRangeStep + return + } + + // No more rune. Repeat the last rune. + if to == "" { + toEnd = utf8.RuneError + return + } + + // Both start and end are used. Read two more runes from the to pattern. + to, toStart, toEnd, toRangeStep = nextRuneRange(to, utf8.RuneError) + } + + if deletion { + toStart = utf8.RuneError + toEnd = utf8.RuneError + } else { + // If from pattern is reverted, only the last rune in the to pattern will be used. + if reverted { + var size int + + for len(to) > 0 { + toStart, size = utf8.DecodeRuneInString(to) + to = to[size:] + } + + toEnd = utf8.RuneError + } else { + to, toStart, toEnd, toRangeStep = nextRuneRange(to, utf8.RuneError) + } + } + + fromEnd = utf8.RuneError + + for len(from) > 0 { + from, fromStart, fromEnd, fromRangeStep = nextRuneRange(from, fromEnd) + + // fromStart is a single character. Just map it with a rune in the to pattern. + if fromRangeStep == 0 { + singleRunes = tr.addRune(fromStart, toStart, singleRunes) + updateRange() + continue + } + + for toEnd != utf8.RuneError && fromStart != fromEnd { + // If mapped rune is a single character instead of a range, simply shift first + // rune in the range. + if toRangeStep == 0 { + singleRunes = tr.addRune(fromStart, toStart, singleRunes) + updateRange() + fromStart += fromRangeStep + continue + } + + fromRangeSize = (fromEnd - fromStart) * fromRangeStep + toRangeSize = (toEnd - toStart) * toRangeStep + + // Not enough runes in the to pattern. Need to read more. + if fromRangeSize > toRangeSize { + fromStart, toStart = tr.addRuneRange(fromStart, fromStart+toRangeSize*fromRangeStep, toStart, toEnd, singleRunes) + fromStart += fromRangeStep + updateRange() + + // Edge case: If fromRangeSize == toRangeSize + 1, the last fromStart value needs be considered + // as a single rune. + if fromStart == fromEnd { + singleRunes = tr.addRune(fromStart, toStart, singleRunes) + updateRange() + } + + continue + } + + fromStart, toStart = tr.addRuneRange(fromStart, fromEnd, toStart, toStart+fromRangeSize*toRangeStep, singleRunes) + updateRange() + break + } + + if fromStart == fromEnd { + fromEnd = utf8.RuneError + continue + } + + _, toStart = tr.addRuneRange(fromStart, fromEnd, toStart, toStart, singleRunes) + fromEnd = utf8.RuneError + } + + if fromEnd != utf8.RuneError { + tr.addRune(fromEnd, toStart, singleRunes) + } + + tr.reverted = reverted + tr.mappedRune = -1 + tr.hasPattern = true + + // Translate RuneError only if in deletion or reverted mode. + if deletion || reverted { + tr.mappedRune = toStart + } + + return tr +} + +func (tr *Translator) addRune(from, to rune, singleRunes []rune) []rune { + if from <= unicode.MaxASCII { + if tr.quickDict == nil { + tr.quickDict = &runeDict{} + } + + tr.quickDict.Dict[from] = to + } else { + if tr.runeMap == nil { + tr.runeMap = make(runeMap) + } + + tr.runeMap[from] = to + } + + singleRunes = append(singleRunes, from) + return singleRunes +} + +func (tr *Translator) addRuneRange(fromLo, fromHi, toLo, toHi rune, singleRunes []rune) (rune, rune) { + var r rune + var rrm *runeRangeMap + + if fromLo < fromHi { + rrm = &runeRangeMap{ + FromLo: fromLo, + FromHi: fromHi, + ToLo: toLo, + ToHi: toHi, + } + } else { + rrm = &runeRangeMap{ + FromLo: fromHi, + FromHi: fromLo, + ToLo: toHi, + ToHi: toLo, + } + } + + // If there is any single rune conflicts with this rune range, clear single rune record. + for _, r = range singleRunes { + if rrm.FromLo <= r && r <= rrm.FromHi { + if r <= unicode.MaxASCII { + tr.quickDict.Dict[r] = 0 + } else { + delete(tr.runeMap, r) + } + } + } + + tr.ranges = append(tr.ranges, rrm) + return fromHi, toHi +} + +func nextRuneRange(str string, last rune) (remaining string, start, end rune, rangeStep rune) { + var r rune + var size int + + remaining = str + escaping := false + isRange := false + + for len(remaining) > 0 { + r, size = utf8.DecodeRuneInString(remaining) + remaining = remaining[size:] + + // Parse special characters. + if !escaping { + if r == '\\' { + escaping = true + continue + } + + if r == '-' { + // Ignore slash at beginning of string. + if last == utf8.RuneError { + continue + } + + start = last + isRange = true + continue + } + } + + escaping = false + + if last != utf8.RuneError { + // This is a range which start and end are the same. + // Considier it as a normal character. + if isRange && last == r { + isRange = false + continue + } + + start = last + end = r + + if isRange { + if start < end { + rangeStep = 1 + } else { + rangeStep = -1 + } + } + + return + } + + last = r + } + + start = last + end = utf8.RuneError + return +} + +// Translate str with a from/to pattern pair. +// +// See comment in Translate function for usage and samples. +func (tr *Translator) Translate(str string) string { + if !tr.hasPattern || str == "" { + return str + } + + var r rune + var size int + var needTr bool + + orig := str + + var output *stringBuilder + + for len(str) > 0 { + r, size = utf8.DecodeRuneInString(str) + r, needTr = tr.TranslateRune(r) + + if needTr && output == nil { + output = allocBuffer(orig, str) + } + + if r != utf8.RuneError && output != nil { + output.WriteRune(r) + } + + str = str[size:] + } + + // No character is translated. + if output == nil { + return orig + } + + return output.String() +} + +// TranslateRune return translated rune and true if r matches the from pattern. +// If r doesn't match the pattern, original r is returned and translated is false. +func (tr *Translator) TranslateRune(r rune) (result rune, translated bool) { + switch { + case tr.quickDict != nil: + if r <= unicode.MaxASCII { + result = tr.quickDict.Dict[r] + + if result != 0 { + translated = true + + if tr.mappedRune >= 0 { + result = tr.mappedRune + } + + break + } + } + + fallthrough + + case tr.runeMap != nil: + var ok bool + + if result, ok = tr.runeMap[r]; ok { + translated = true + + if tr.mappedRune >= 0 { + result = tr.mappedRune + } + + break + } + + fallthrough + + default: + var rrm *runeRangeMap + ranges := tr.ranges + + for i := len(ranges) - 1; i >= 0; i-- { + rrm = ranges[i] + + if rrm.FromLo <= r && r <= rrm.FromHi { + translated = true + + if tr.mappedRune >= 0 { + result = tr.mappedRune + break + } + + if rrm.ToLo < rrm.ToHi { + result = rrm.ToLo + r - rrm.FromLo + } else if rrm.ToLo > rrm.ToHi { + // ToHi can be smaller than ToLo if range is from higher to lower. + result = rrm.ToLo - r + rrm.FromLo + } else { + result = rrm.ToLo + } + + break + } + } + } + + if tr.reverted { + if !translated { + result = tr.mappedRune + } + + translated = !translated + } + + if !translated { + result = r + } + + return +} + +// HasPattern returns true if Translator has one pattern at least. +func (tr *Translator) HasPattern() bool { + return tr.hasPattern +} + +// Translate str with the characters defined in from replaced by characters defined in to. +// +// From and to are patterns representing a set of characters. Pattern is defined as following. +// +// * Special characters +// * '-' means a range of runes, e.g. +// * "a-z" means all characters from 'a' to 'z' inclusive; +// * "z-a" means all characters from 'z' to 'a' inclusive. +// * '^' as first character means a set of all runes excepted listed, e.g. +// * "^a-z" means all characters except 'a' to 'z' inclusive. +// * '\' escapes special characters. +// * Normal character represents itself, e.g. "abc" is a set including 'a', 'b' and 'c'. +// +// Translate will try to find a 1:1 mapping from from to to. +// If to is smaller than from, last rune in to will be used to map "out of range" characters in from. +// +// Note that '^' only works in the from pattern. It will be considered as a normal character in the to pattern. +// +// If the to pattern is an empty string, Translate works exactly the same as Delete. +// +// Samples: +// Translate("hello", "aeiou", "12345") => "h2ll4" +// Translate("hello", "a-z", "A-Z") => "HELLO" +// Translate("hello", "z-a", "a-z") => "svool" +// Translate("hello", "aeiou", "*") => "h*ll*" +// Translate("hello", "^l", "*") => "**ll*" +// Translate("hello ^ world", `\^lo`, "*") => "he*** * w*r*d" +func Translate(str, from, to string) string { + tr := NewTranslator(from, to) + return tr.Translate(str) +} + +// Delete runes in str matching the pattern. +// Pattern is defined in Translate function. +// +// Samples: +// Delete("hello", "aeiou") => "hll" +// Delete("hello", "a-k") => "llo" +// Delete("hello", "^a-k") => "he" +func Delete(str, pattern string) string { + tr := NewTranslator(pattern, "") + return tr.Translate(str) +} + +// Count how many runes in str match the pattern. +// Pattern is defined in Translate function. +// +// Samples: +// Count("hello", "aeiou") => 3 +// Count("hello", "a-k") => 3 +// Count("hello", "^a-k") => 2 +func Count(str, pattern string) int { + if pattern == "" || str == "" { + return 0 + } + + var r rune + var size int + var matched bool + + tr := NewTranslator(pattern, "") + cnt := 0 + + for len(str) > 0 { + r, size = utf8.DecodeRuneInString(str) + str = str[size:] + + if _, matched = tr.TranslateRune(r); matched { + cnt++ + } + } + + return cnt +} + +// Squeeze deletes adjacent repeated runes in str. +// If pattern is not empty, only runes matching the pattern will be squeezed. +// +// Samples: +// Squeeze("hello", "") => "helo" +// Squeeze("hello", "m-z") => "hello" +// Squeeze("hello world", " ") => "hello world" +func Squeeze(str, pattern string) string { + var last, r rune + var size int + var skipSqueeze, matched bool + var tr *Translator + var output *stringBuilder + + orig := str + last = -1 + + if len(pattern) > 0 { + tr = NewTranslator(pattern, "") + } + + for len(str) > 0 { + r, size = utf8.DecodeRuneInString(str) + + // Need to squeeze the str. + if last == r && !skipSqueeze { + if tr != nil { + if _, matched = tr.TranslateRune(r); !matched { + skipSqueeze = true + } + } + + if output == nil { + output = allocBuffer(orig, str) + } + + if skipSqueeze { + output.WriteRune(r) + } + } else { + if output != nil { + output.WriteRune(r) + } + + last = r + skipSqueeze = false + } + + str = str[size:] + } + + if output == nil { + return orig + } + + return output.String() +} diff --git a/vendor/github.com/lucasb-eyer/go-colorful/.gitignore b/vendor/github.com/lucasb-eyer/go-colorful/.gitignore new file mode 100644 index 000000000..47fda8eeb --- /dev/null +++ b/vendor/github.com/lucasb-eyer/go-colorful/.gitignore @@ -0,0 +1,28 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Vim swap files +.*.sw? + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe + +# Code coverage stuff +coverage.out diff --git a/vendor/github.com/lucasb-eyer/go-colorful/.travis.yml b/vendor/github.com/lucasb-eyer/go-colorful/.travis.yml new file mode 100644 index 000000000..5bb2a827b --- /dev/null +++ b/vendor/github.com/lucasb-eyer/go-colorful/.travis.yml @@ -0,0 +1,7 @@ +language: go +install: + - go get golang.org/x/tools/cmd/cover + - go get github.com/mattn/goveralls +script: + - go test -v -covermode=count -coverprofile=coverage.out + - if [[ "$TRAVIS_PULL_REQUEST" = "false" ]]; then $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN; fi diff --git a/vendor/github.com/lucasb-eyer/go-colorful/LICENSE b/vendor/github.com/lucasb-eyer/go-colorful/LICENSE new file mode 100644 index 000000000..4e402a00e --- /dev/null +++ b/vendor/github.com/lucasb-eyer/go-colorful/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2013 Lucas Beyer + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/lucasb-eyer/go-colorful/README.md b/vendor/github.com/lucasb-eyer/go-colorful/README.md new file mode 100644 index 000000000..2cb0c4243 --- /dev/null +++ b/vendor/github.com/lucasb-eyer/go-colorful/README.md @@ -0,0 +1,492 @@ +go-colorful +=========== +A library for playing with colors in go (golang). + +[![Build Status](https://travis-ci.org/lucasb-eyer/go-colorful.svg?branch=master)](https://travis-ci.org/lucasb-eyer/go-colorful) +[![Coverage Status](https://coveralls.io/repos/github/lucasb-eyer/go-colorful/badge.svg?branch=master)](https://coveralls.io/github/lucasb-eyer/go-colorful?branch=master) + +Why? +==== +I love games. I make games. I love detail and I get lost in detail. +One such detail popped up during the development of [Memory Which Does Not Suck](https://github.com/lucasb-eyer/mwdns/), +when we wanted the server to assign the players random colors. Sometimes +two players got very similar colors, which bugged me. The very same evening, +[I want hue](http://tools.medialab.sciences-po.fr/iwanthue/) was the top post +on HackerNews' frontpage and showed me how to Do It Right™. Last but not +least, there was no library for handling color spaces available in go. Colorful +does just that and implements Go's `color.Color` interface. + +What? +===== +Go-Colorful stores colors in RGB and provides methods from converting these to various color-spaces. Currently supported colorspaces are: + +- **RGB:** All three of Red, Green and Blue in [0..1]. +- **HSL:** Hue in [0..360], Saturation and Luminance in [0..1]. For legacy reasons; please forget that it exists. +- **HSV:** Hue in [0..360], Saturation and Value in [0..1]. You're better off using HCL, see below. +- **Hex RGB:** The "internet" color format, as in #FF00FF. +- **Linear RGB:** See [gamma correct rendering](http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/). +- **CIE-XYZ:** CIE's standard color space, almost in [0..1]. +- **CIE-xyY:** encodes chromacity in x and y and luminance in Y, all in [0..1] +- **CIE-L\*a\*b\*:** A *perceptually uniform* color space, i.e. distances are meaningful. L\* in [0..1] and a\*, b\* almost in [-1..1]. +- **CIE-L\*u\*v\*:** Very similar to CIE-L\*a\*b\*, there is [no consensus](http://en.wikipedia.org/wiki/CIELUV#Historical_background) on which one is "better". +- **CIE-L\*C\*h° (HCL):** This is generally the [most useful](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) one; CIE-L\*a\*b\* space in polar coordinates, i.e. a *better* HSV. H° is in [0..360], C\* almost in [-1..1] and L\* as in CIE-L\*a\*b\*. + +For the colorspaces where it makes sense (XYZ, Lab, Luv, HCl), the +[D65](http://en.wikipedia.org/wiki/Illuminant_D65) is used as reference white +by default but methods for using your own reference white are provided. + +A coordinate being *almost in* a range means that generally it is, but for very +bright colors and depending on the reference white, it might overflow this +range slightly. For example, C\* of #0000ff is 1.338. + +Unit-tests are provided. + +Nice, but what's it useful for? +------------------------------- + +- Converting color spaces. Some people like to do that. +- Blending (interpolating) between colors in a "natural" look by using the right colorspace. +- Generating random colors under some constraints (e.g. colors of the same shade, or shades of one color.) +- Generating gorgeous random palettes with distinct colors of a same temperature. + +What not (yet)? +=============== +There are a few features which are currently missing and might be useful. +I just haven't implemented them yet because I didn't have the need for it. +Pull requests welcome. + +- Sorting colors (potentially using above mentioned distances) + +So which colorspace should I use? +================================= +It depends on what you want to do. I think the folks from *I want hue* are +on-spot when they say that RGB fits to how *screens produce* color, CIE L\*a\*b\* +fits how *humans perceive* color and HCL fits how *humans think* colors. + +Whenever you'd use HSV, rather go for CIE-L\*C\*h°. for fixed lightness L\* and +chroma C\* values, the hue angle h° rotates through colors of the same +perceived brightness and intensity. + +How? +==== + +### Installing +Installing the library is as easy as + +```bash +$ go get github.com/lucasb-eyer/go-colorful +``` + +The package can then be used through an + +```go +import "github.com/lucasb-eyer/go-colorful" +``` + +### Basic usage + +Create a beautiful blue color using different source space: + +```go +// Any of the following should be the same +c := colorful.Color{0.313725, 0.478431, 0.721569} +c, err := colorful.Hex("#517AB8") +if err != nil { + log.Fatal(err) +} +c = colorful.Hsv(216.0, 0.56, 0.722) +c = colorful.Xyz(0.189165, 0.190837, 0.480248) +c = colorful.Xyy(0.219895, 0.221839, 0.190837) +c = colorful.Lab(0.507850, 0.040585,-0.370945) +c = colorful.Luv(0.507849,-0.194172,-0.567924) +c = colorful.Hcl(276.2440, 0.373160, 0.507849) +fmt.Printf("RGB values: %v, %v, %v", c.R, c.G, c.B) +``` + +And then converting this color back into various color spaces: + +```go +hex := c.Hex() +h, s, v := c.Hsv() +x, y, z := c.Xyz() +x, y, Y := c.Xyy() +l, a, b := c.Lab() +l, u, v := c.Luv() +h, c, l := c.Hcl() +``` + +Note that, because of Go's unfortunate choice of requiring an initial uppercase, +the name of the functions relating to the xyY space are just off. If you have +any good suggestion, please open an issue. (I don't consider XyY good.) + +### The `color.Color` interface +Because a `colorful.Color` implements Go's `color.Color` interface (found in the +`image/color` package), it can be used anywhere that expects a `color.Color`. + +Furthermore, you can convert anything that implements the `color.Color` interface +into a `colorful.Color` using the `MakeColor` function: + +```go +c, ok := colorful.MakeColor(color.Gray16{12345}) +``` + +**Caveat:** Be aware that this latter conversion (using `MakeColor`) hits a +corner-case when alpha is exactly zero. Because `color.Color` uses pre-multiplied +alpha colors, this means the RGB values are lost (set to 0) and it's impossible +to recover them. In such a case `MakeColor` will return `false` as its second value. + +### Comparing colors +In the RGB color space, the Euclidian distance between colors *doesn't* correspond +to visual/perceptual distance. This means that two pairs of colors which have the +same distance in RGB space can look much further apart. This is fixed by the +CIE-L\*a\*b\*, CIE-L\*u\*v\* and CIE-L\*C\*h° color spaces. +Thus you should only compare colors in any of these space. +(Note that the distance in CIE-L\*a\*b\* and CIE-L\*C\*h° are the same, since it's the same space but in cylindrical coordinates) + +![Color distance comparison](doc/colordist/colordist.png) + +The two colors shown on the top look much more different than the two shown on +the bottom. Still, in RGB space, their distance is the same. +Here is a little example program which shows the distances between the top two +and bottom two colors in RGB, CIE-L\*a\*b\* and CIE-L\*u\*v\* space. You can find it in `doc/colordist/colordist.go`. + +```go +package main + +import "fmt" +import "github.com/lucasb-eyer/go-colorful" + +func main() { + c1a := colorful.Color{150.0 / 255.0, 10.0 / 255.0, 150.0 / 255.0} + c1b := colorful.Color{53.0 / 255.0, 10.0 / 255.0, 150.0 / 255.0} + c2a := colorful.Color{10.0 / 255.0, 150.0 / 255.0, 50.0 / 255.0} + c2b := colorful.Color{99.9 / 255.0, 150.0 / 255.0, 10.0 / 255.0} + + fmt.Printf("DistanceRgb: c1: %v\tand c2: %v\n", c1a.DistanceRgb(c1b), c2a.DistanceRgb(c2b)) + fmt.Printf("DistanceLab: c1: %v\tand c2: %v\n", c1a.DistanceLab(c1b), c2a.DistanceLab(c2b)) + fmt.Printf("DistanceLuv: c1: %v\tand c2: %v\n", c1a.DistanceLuv(c1b), c2a.DistanceLuv(c2b)) + fmt.Printf("DistanceCIE76: c1: %v\tand c2: %v\n", c1a.DistanceCIE76(c1b), c2a.DistanceCIE76(c2b)) + fmt.Printf("DistanceCIE94: c1: %v\tand c2: %v\n", c1a.DistanceCIE94(c1b), c2a.DistanceCIE94(c2b)) + fmt.Printf("DistanceCIEDE2000: c1: %v\tand c2: %v\n", c1a.DistanceCIEDE2000(c1b), c2a.DistanceCIEDE2000(c2b)) +} +``` + +Running the above program shows that you should always prefer any of the CIE distances: + +```bash +$ go run colordist.go +DistanceRgb: c1: 0.3803921568627451 and c2: 0.3858713931171159 +DistanceLab: c1: 0.32048458312798056 and c2: 0.24397151758565272 +DistanceLuv: c1: 0.5134369614199698 and c2: 0.2568692839860636 +DistanceCIE76: c1: 0.32048458312798056 and c2: 0.24397151758565272 +DistanceCIE94: c1: 0.19799168128511324 and c2: 0.12207136371167401 +DistanceCIEDE2000: c1: 0.17274551120971166 and c2: 0.10665210031428465 +``` + +It also shows that `DistanceLab` is more formally known as `DistanceCIE76` and +has been superseded by the slightly more accurate, but much more expensive +`DistanceCIE94` and `DistanceCIEDE2000`. + +Note that `AlmostEqualRgb` is provided mainly for (unit-)testing purposes. Use +it only if you really know what you're doing. It will eat your cat. + +### Blending colors +Blending is highly connected to distance, since it basically "walks through" the +colorspace thus, if the colorspace maps distances well, the walk is "smooth". + +Colorful comes with blending functions in RGB, HSV and any of the LAB spaces. +Of course, you'd rather want to use the blending functions of the LAB spaces since +these spaces map distances well but, just in case, here is an example showing +you how the blendings (`#fdffcc` to `#242a42`) are done in the various spaces: + +![Blending colors in different spaces.](doc/colorblend/colorblend.png) + +What you see is that HSV is really bad: it adds some green, which is not present +in the original colors at all! RGB is much better, but it stays light a little +too long. LUV and LAB both hit the right lightness but LAB has a little more +color. HCL works in the same vein as HSV (both cylindrical interpolations) but +it does it right in that there is no green appearing and the lighthness changes +in a linear manner. + +While this seems all good, you need to know one thing: When interpolating in any +of the CIE color spaces, you might get invalid RGB colors! This is important if +the starting and ending colors are user-input or random. An example of where this +happens is when blending between `#eeef61` and `#1e3140`: + +![Invalid RGB colors may crop up when blending in CIE spaces.](doc/colorblend/invalid.png) + +You can test whether a color is a valid RGB color by calling the `IsValid` method +and indeed, calling IsValid will return false for the redish colors on the bottom. +One way to "fix" this is to get a valid color close to the invalid one by calling +`Clamped`, which always returns a nearby valid color. Doing this, we get the +following result, which is satisfactory: + +![Fixing invalid RGB colors by clamping them to the valid range.](doc/colorblend/clamped.png) + +The following is the code creating the above three images; it can be found in `doc/colorblend/colorblend.go` + +```go +package main + +import "fmt" +import "github.com/lucasb-eyer/go-colorful" +import "image" +import "image/draw" +import "image/png" +import "os" + +func main() { + blocks := 10 + blockw := 40 + img := image.NewRGBA(image.Rect(0,0,blocks*blockw,200)) + + c1, _ := colorful.Hex("#fdffcc") + c2, _ := colorful.Hex("#242a42") + + // Use these colors to get invalid RGB in the gradient. + //c1, _ := colorful.Hex("#EEEF61") + //c2, _ := colorful.Hex("#1E3140") + + for i := 0 ; i < blocks ; i++ { + draw.Draw(img, image.Rect(i*blockw, 0,(i+1)*blockw, 40), &image.Uniform{c1.BlendHsv(c2, float64(i)/float64(blocks-1))}, image.ZP, draw.Src) + draw.Draw(img, image.Rect(i*blockw, 40,(i+1)*blockw, 80), &image.Uniform{c1.BlendLuv(c2, float64(i)/float64(blocks-1))}, image.ZP, draw.Src) + draw.Draw(img, image.Rect(i*blockw, 80,(i+1)*blockw,120), &image.Uniform{c1.BlendRgb(c2, float64(i)/float64(blocks-1))}, image.ZP, draw.Src) + draw.Draw(img, image.Rect(i*blockw,120,(i+1)*blockw,160), &image.Uniform{c1.BlendLab(c2, float64(i)/float64(blocks-1))}, image.ZP, draw.Src) + draw.Draw(img, image.Rect(i*blockw,160,(i+1)*blockw,200), &image.Uniform{c1.BlendHcl(c2, float64(i)/float64(blocks-1))}, image.ZP, draw.Src) + + // This can be used to "fix" invalid colors in the gradient. + //draw.Draw(img, image.Rect(i*blockw,160,(i+1)*blockw,200), &image.Uniform{c1.BlendHcl(c2, float64(i)/float64(blocks-1)).Clamped()}, image.ZP, draw.Src) + } + + toimg, err := os.Create("colorblend.png") + if err != nil { + fmt.Printf("Error: %v", err) + return + } + defer toimg.Close() + + png.Encode(toimg, img) +} +``` + +#### Generating color gradients +A very common reason to blend colors is creating gradients. There is an example +program in [doc/gradientgen.go](doc/gradientgen/gradientgen.go); it doesn't use any API +which hasn't been used in the previous example code, so I won't bother pasting +the code in here. Just look at that gorgeous gradient it generated in HCL space: + +!["Spectral" colorbrewer gradient in HCL space.](doc/gradientgen/gradientgen.png) + +### Getting random colors +It is sometimes necessary to generate random colors. You could simply do this +on your own by generating colors with random values. By restricting the random +values to a range smaller than [0..1] and using a space such as CIE-H\*C\*l° or +HSV, you can generate both random shades of a color or random colors of a +lightness: + +```go +random_blue := colorful.Hcl(180.0+rand.Float64()*50.0, 0.2+rand.Float64()*0.8, 0.3+rand.Float64()*0.7) +random_dark := colorful.Hcl(rand.Float64()*360.0, rand.Float64(), rand.Float64()*0.4) +random_light := colorful.Hcl(rand.Float64()*360.0, rand.Float64(), 0.6+rand.Float64()*0.4) +``` + +Since getting random "warm" and "happy" colors is quite a common task, there +are some helper functions: + +```go +colorful.WarmColor() +colorful.HappyColor() +colorful.FastWarmColor() +colorful.FastHappyColor() +``` + +The ones prefixed by `Fast` are faster but less coherent since they use the HSV +space as opposed to the regular ones which use CIE-L\*C\*h° space. The +following picture shows the warm colors in the top two rows and happy colors +in the bottom two rows. Within these, the first is the regular one and the +second is the fast one. + +![Warm, fast warm, happy and fast happy random colors, respectively.](doc/colorgens/colorgens.png) + +Don't forget to initialize the random seed! You can see the code used for +generating this picture in `doc/colorgens/colorgens.go`. + +### Getting random palettes +As soon as you need to generate more than one random color, you probably want +them to be distinguishible. Playing against an opponent which has almost the +same blue as I do is not fun. This is where random palettes can help. + +These palettes are generated using an algorithm which ensures that all colors +on the palette are as distinguishible as possible. Again, there is a `Fast` +method which works in HSV and is less perceptually uniform and a non-`Fast` +method which works in CIE spaces. For more theory on `SoftPalette`, check out +[I want hue](http://tools.medialab.sciences-po.fr/iwanthue/theory.php). Yet +again, there is a `Happy` and a `Warm` version, which do what you expect, but +now there is an additional `Soft` version, which is more configurable: you can +give a constraint on the color space in order to get colors within a certain *feel*. + +Let's start with the simple methods first, all they take is the amount of +colors to generate, which could, for example, be the player count. They return +an array of `colorful.Color` objects: + +```go +pal1, err1 := colorful.WarmPalette(10) +pal2 := colorful.FastWarmPalette(10) +pal3, err3 := colorful.HappyPalette(10) +pal4 := colorful.FastHappyPalette(10) +pal5, err5 := colorful.SoftPalette(10) +``` + +Note that the non-fast methods *may* fail if you ask for way too many colors. +Let's move on to the advanced one, namely `SoftPaletteEx`. Besides the color +count, this function takes a `SoftPaletteSettings` object as argument. The +interesting part here is its `CheckColor` member, which is a boolean function +taking three floating points as arguments: `l`, `a` and `b`. This function +should return `true` for colors which lie within the region you want and `false` +otherwise. The other members are `Iteration`, which should be within [5..100] +where higher means slower but more exact palette, and `ManySamples` which you +should set to `true` in case your `CheckColor` constraint rejects a large part +of the color space. + +For example, to create a palette of 10 brownish colors, you'd call it like this: + +```go +func isbrowny(l, a, b float64) bool { + h, c, L := colorful.LabToHcl(l, a, b) + return 10.0 < h && h < 50.0 && 0.1 < c && c < 0.5 && L < 0.5 +} +// Since the above function is pretty restrictive, we set ManySamples to true. +brownies := colorful.SoftPaletteEx(10, colorful.SoftPaletteSettings{isbrowny, 50, true}) +``` + +The following picture shows the palettes generated by all of these methods +(sourcecode in `doc/palettegens/palettegens.go`), in the order they were presented, i.e. +from top to bottom: `Warm`, `FastWarm`, `Happy`, `FastHappy`, `Soft`, +`SoftEx(isbrowny)`. All of them contain some randomness, so YMMV. + +![All example palettes](doc/palettegens/palettegens.png) + +Again, the code used for generating the above image is available as [doc/palettegens/palettegens.go](https://github.com/lucasb-eyer/go-colorful/blob/master/doc/palettegens/palettegens.go). + +### Sorting colors +TODO: Sort using dist fn. + +### Using linear RGB for computations +There are two methods for transforming RGB<->Linear RGB: a fast and almost precise one, +and a slow and precise one. + +```go +r, g, b := colorful.Hex("#FF0000").FastLinearRgb() +``` + +TODO: describe some more. + +### Want to use some other reference point? + +```go +c := colorful.LabWhiteRef(0.507850, 0.040585,-0.370945, colorful.D50) +l, a, b := c.LabWhiteRef(colorful.D50) +``` + +### Reading and writing colors from databases + +The type `HexColor` makes it easy to store colors as strings in a database. It +implements the [https://godoc.org/database/sql#Scanner](database/sql.Scanner) +and [database/sql/driver.Value](https://godoc.org/database/sql/driver.Value) +interfaces which provide automatic type conversion. + +Example: + +```go +var hc HexColor +_, err := db.QueryRow("SELECT '#ff0000';").Scan(&hc) +// hc == HexColor{R: 1, G: 0, B: 0}; err == nil +``` + +FAQ +=== + +### Q: I get all f!@#ed up values! Your library sucks! +A: You probably provided values in the wrong range. For example, RGB values are +expected to reside between 0 and 1, *not* between 0 and 255. Normalize your colors. + +### Q: Lab/Luv/HCl seem broken! Your library sucks! +They look like this: + + + +A: You're likely trying to generate and display colors that can't be represented by RGB, +and thus monitors. When you're trying to convert, say, `HCL(190.0, 1.0, 1.0).RGB255()`, +you're asking for RGB values of `(-2105.254 300.680 286.185)`, which clearly don't exist, +and the `RGB255` function just casts these numbers to `uint8`, creating wrap-around and +what looks like a completely broken gradient. What you want to do, is either use more +reasonable values of colors which actually exist in RGB, or just `Clamp()` the resulting +color to its nearest existing one, living with the consequences: +`HCL(190.0, 1.0, 1.0).Clamp().RGB255()`. It will look something like this: + + + +[Here's an issue going in-depth about this](https://github.com/lucasb-eyer/go-colorful/issues/14), +as well as [my answer](https://github.com/lucasb-eyer/go-colorful/issues/14#issuecomment-324205385), +both with code and pretty pictures. Also note that this was somewhat covered above in the +["Blending colors" section](https://github.com/lucasb-eyer/go-colorful#blending-colors). + +### Q: In a tight loop, conversion to Lab/Luv/HCl/... are slooooow! +A: Yes, they are. +This library aims for correctness, readability, and modularity; it wasn't written with speed in mind. +A large part of the slowness comes from these conversions going through `LinearRgb` which uses powers. +I implemented a fast approximation to `LinearRgb` called `FastLinearRgb` by using Taylor approximations. +The approximation is roughly 5x faster and precise up to roughly 0.5%, +the major caveat being that if the input values are outside the range 0-1, accuracy drops dramatically. +You can use these in your conversions as follows: + +```go +col := // Get your color somehow +l, a, b := XyzToLab(LinearRgbToXyz(col.LinearRgb())) +``` + +If you need faster versions of `Distance*` and `Blend*` that make use of this fast approximation, +feel free to implement them and open a pull-request, I'll happily accept. + +The derivation of these functions can be followed in [this Jupyter notebook](doc/LinearRGB Approximations.ipynb). +Here's the main figure showing the approximation quality: + +![approximation quality](doc/approx-quality.png) + +More speed could be gained by using SIMD instructions in many places. +You can also get more speed for specific conversions by approximating the full conversion function, +but that is outside the scope of this library. +Thanks to [@ZirconiumX](https://github.com/ZirconiumX) for starting this investigation, +see [issue #18](https://github.com/lucasb-eyer/go-colorful/issues/18) for details. + +### Q: Why would `MakeColor` ever fail!? +A: `MakeColor` fails when the alpha channel is zero. In that case, the +conversion is undefined. See [issue 21](https://github.com/lucasb-eyer/go-colorful/issues/21) +as well as the short caveat note in the ["The `color.Color` interface"](README.md#the-colorcolor-interface) +section above. + +Who? +==== + +This library has been developed by Lucas Beyer with contributions from +Bastien Dejean (@baskerville), Phil Kulak (@pkulak) and Christian Muehlhaeuser (@muesli). + +Release Notes +============= + +### Version 1.0 +- API Breaking change in `MakeColor`: instead of `panic`ing when alpha is zero, it now returns a secondary, boolean return value indicating success. See [the color.Color interface](https://github.com/lucasb-eyer/go-colorful#the-colorcolor-interface) section and [this FAQ entry](https://github.com/lucasb-eyer/go-colorful#q-why-would-makecolor-ever-fail) for details. + +### Version 0.9 +- Initial version number after having ignored versioning for a long time :) + +License: MIT +============ +Copyright (c) 2013 Lucas Beyer + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/vendor/github.com/lucasb-eyer/go-colorful/colorgens.go b/vendor/github.com/lucasb-eyer/go-colorful/colorgens.go new file mode 100644 index 000000000..2e2e49e19 --- /dev/null +++ b/vendor/github.com/lucasb-eyer/go-colorful/colorgens.go @@ -0,0 +1,55 @@ +// Various ways to generate single random colors + +package colorful + +import ( + "math/rand" +) + +// Creates a random dark, "warm" color through a restricted HSV space. +func FastWarmColor() Color { + return Hsv( + rand.Float64()*360.0, + 0.5+rand.Float64()*0.3, + 0.3+rand.Float64()*0.3) +} + +// Creates a random dark, "warm" color through restricted HCL space. +// This is slower than FastWarmColor but will likely give you colors which have +// the same "warmness" if you run it many times. +func WarmColor() (c Color) { + for c = randomWarm(); !c.IsValid(); c = randomWarm() { + } + return +} + +func randomWarm() Color { + return Hcl( + rand.Float64()*360.0, + 0.1+rand.Float64()*0.3, + 0.2+rand.Float64()*0.3) +} + +// Creates a random bright, "pimpy" color through a restricted HSV space. +func FastHappyColor() Color { + return Hsv( + rand.Float64()*360.0, + 0.7+rand.Float64()*0.3, + 0.6+rand.Float64()*0.3) +} + +// Creates a random bright, "pimpy" color through restricted HCL space. +// This is slower than FastHappyColor but will likely give you colors which +// have the same "brightness" if you run it many times. +func HappyColor() (c Color) { + for c = randomPimp(); !c.IsValid(); c = randomPimp() { + } + return +} + +func randomPimp() Color { + return Hcl( + rand.Float64()*360.0, + 0.5+rand.Float64()*0.3, + 0.5+rand.Float64()*0.3) +} diff --git a/vendor/github.com/lucasb-eyer/go-colorful/colors.go b/vendor/github.com/lucasb-eyer/go-colorful/colors.go new file mode 100644 index 000000000..29870df04 --- /dev/null +++ b/vendor/github.com/lucasb-eyer/go-colorful/colors.go @@ -0,0 +1,903 @@ +// The colorful package provides all kinds of functions for working with colors. +package colorful + +import ( + "fmt" + "image/color" + "math" +) + +// A color is stored internally using sRGB (standard RGB) values in the range 0-1 +type Color struct { + R, G, B float64 +} + +// Implement the Go color.Color interface. +func (col Color) RGBA() (r, g, b, a uint32) { + r = uint32(col.R*65535.0 + 0.5) + g = uint32(col.G*65535.0 + 0.5) + b = uint32(col.B*65535.0 + 0.5) + a = 0xFFFF + return +} + +// Constructs a colorful.Color from something implementing color.Color +func MakeColor(col color.Color) (Color, bool) { + r, g, b, a := col.RGBA() + if a == 0 { + return Color{0, 0, 0}, false + } + + // Since color.Color is alpha pre-multiplied, we need to divide the + // RGB values by alpha again in order to get back the original RGB. + r *= 0xffff + r /= a + g *= 0xffff + g /= a + b *= 0xffff + b /= a + + return Color{float64(r) / 65535.0, float64(g) / 65535.0, float64(b) / 65535.0}, true +} + +// Might come in handy sometimes to reduce boilerplate code. +func (col Color) RGB255() (r, g, b uint8) { + r = uint8(col.R*255.0 + 0.5) + g = uint8(col.G*255.0 + 0.5) + b = uint8(col.B*255.0 + 0.5) + return +} + +// This is the tolerance used when comparing colors using AlmostEqualRgb. +const Delta = 1.0 / 255.0 + +// This is the default reference white point. +var D65 = [3]float64{0.95047, 1.00000, 1.08883} + +// And another one. +var D50 = [3]float64{0.96422, 1.00000, 0.82521} + +// Checks whether the color exists in RGB space, i.e. all values are in [0..1] +func (c Color) IsValid() bool { + return 0.0 <= c.R && c.R <= 1.0 && + 0.0 <= c.G && c.G <= 1.0 && + 0.0 <= c.B && c.B <= 1.0 +} + +func clamp01(v float64) float64 { + return math.Max(0.0, math.Min(v, 1.0)) +} + +// Returns Clamps the color into valid range, clamping each value to [0..1] +// If the color is valid already, this is a no-op. +func (c Color) Clamped() Color { + return Color{clamp01(c.R), clamp01(c.G), clamp01(c.B)} +} + +func sq(v float64) float64 { + return v * v +} + +func cub(v float64) float64 { + return v * v * v +} + +// DistanceRgb computes the distance between two colors in RGB space. +// This is not a good measure! Rather do it in Lab space. +func (c1 Color) DistanceRgb(c2 Color) float64 { + return math.Sqrt(sq(c1.R-c2.R) + sq(c1.G-c2.G) + sq(c1.B-c2.B)) +} + +// Check for equality between colors within the tolerance Delta (1/255). +func (c1 Color) AlmostEqualRgb(c2 Color) bool { + return math.Abs(c1.R-c2.R)+ + math.Abs(c1.G-c2.G)+ + math.Abs(c1.B-c2.B) < 3.0*Delta +} + +// You don't really want to use this, do you? Go for BlendLab, BlendLuv or BlendHcl. +func (c1 Color) BlendRgb(c2 Color, t float64) Color { + return Color{c1.R + t*(c2.R-c1.R), + c1.G + t*(c2.G-c1.G), + c1.B + t*(c2.B-c1.B)} +} + +// Utility used by Hxx color-spaces for interpolating between two angles in [0,360]. +func interp_angle(a0, a1, t float64) float64 { + // Based on the answer here: http://stackoverflow.com/a/14498790/2366315 + // With potential proof that it works here: http://math.stackexchange.com/a/2144499 + delta := math.Mod(math.Mod(a1-a0, 360.0)+540, 360.0) - 180.0 + return math.Mod(a0+t*delta+360.0, 360.0) +} + +/// HSV /// +/////////// +// From http://en.wikipedia.org/wiki/HSL_and_HSV +// Note that h is in [0..360] and s,v in [0..1] + +// Hsv returns the Hue [0..360], Saturation and Value [0..1] of the color. +func (col Color) Hsv() (h, s, v float64) { + min := math.Min(math.Min(col.R, col.G), col.B) + v = math.Max(math.Max(col.R, col.G), col.B) + C := v - min + + s = 0.0 + if v != 0.0 { + s = C / v + } + + h = 0.0 // We use 0 instead of undefined as in wp. + if min != v { + if v == col.R { + h = math.Mod((col.G-col.B)/C, 6.0) + } + if v == col.G { + h = (col.B-col.R)/C + 2.0 + } + if v == col.B { + h = (col.R-col.G)/C + 4.0 + } + h *= 60.0 + if h < 0.0 { + h += 360.0 + } + } + return +} + +// Hsv creates a new Color given a Hue in [0..360], a Saturation and a Value in [0..1] +func Hsv(H, S, V float64) Color { + Hp := H / 60.0 + C := V * S + X := C * (1.0 - math.Abs(math.Mod(Hp, 2.0)-1.0)) + + m := V - C + r, g, b := 0.0, 0.0, 0.0 + + switch { + case 0.0 <= Hp && Hp < 1.0: + r = C + g = X + case 1.0 <= Hp && Hp < 2.0: + r = X + g = C + case 2.0 <= Hp && Hp < 3.0: + g = C + b = X + case 3.0 <= Hp && Hp < 4.0: + g = X + b = C + case 4.0 <= Hp && Hp < 5.0: + r = X + b = C + case 5.0 <= Hp && Hp < 6.0: + r = C + b = X + } + + return Color{m + r, m + g, m + b} +} + +// You don't really want to use this, do you? Go for BlendLab, BlendLuv or BlendHcl. +func (c1 Color) BlendHsv(c2 Color, t float64) Color { + h1, s1, v1 := c1.Hsv() + h2, s2, v2 := c2.Hsv() + + // We know that h are both in [0..360] + return Hsv(interp_angle(h1, h2, t), s1+t*(s2-s1), v1+t*(v2-v1)) +} + +/// HSL /// +/////////// + +// Hsl returns the Hue [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color. +func (col Color) Hsl() (h, s, l float64) { + min := math.Min(math.Min(col.R, col.G), col.B) + max := math.Max(math.Max(col.R, col.G), col.B) + + l = (max + min) / 2 + + if min == max { + s = 0 + h = 0 + } else { + if l < 0.5 { + s = (max - min) / (max + min) + } else { + s = (max - min) / (2.0 - max - min) + } + + if max == col.R { + h = (col.G - col.B) / (max - min) + } else if max == col.G { + h = 2.0 + (col.B-col.R)/(max-min) + } else { + h = 4.0 + (col.R-col.G)/(max-min) + } + + h *= 60 + + if h < 0 { + h += 360 + } + } + + return +} + +// Hsl creates a new Color given a Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1] +func Hsl(h, s, l float64) Color { + if s == 0 { + return Color{l, l, l} + } + + var r, g, b float64 + var t1 float64 + var t2 float64 + var tr float64 + var tg float64 + var tb float64 + + if l < 0.5 { + t1 = l * (1.0 + s) + } else { + t1 = l + s - l*s + } + + t2 = 2*l - t1 + h /= 360 + tr = h + 1.0/3.0 + tg = h + tb = h - 1.0/3.0 + + if tr < 0 { + tr++ + } + if tr > 1 { + tr-- + } + if tg < 0 { + tg++ + } + if tg > 1 { + tg-- + } + if tb < 0 { + tb++ + } + if tb > 1 { + tb-- + } + + // Red + if 6*tr < 1 { + r = t2 + (t1-t2)*6*tr + } else if 2*tr < 1 { + r = t1 + } else if 3*tr < 2 { + r = t2 + (t1-t2)*(2.0/3.0-tr)*6 + } else { + r = t2 + } + + // Green + if 6*tg < 1 { + g = t2 + (t1-t2)*6*tg + } else if 2*tg < 1 { + g = t1 + } else if 3*tg < 2 { + g = t2 + (t1-t2)*(2.0/3.0-tg)*6 + } else { + g = t2 + } + + // Blue + if 6*tb < 1 { + b = t2 + (t1-t2)*6*tb + } else if 2*tb < 1 { + b = t1 + } else if 3*tb < 2 { + b = t2 + (t1-t2)*(2.0/3.0-tb)*6 + } else { + b = t2 + } + + return Color{r, g, b} +} + +/// Hex /// +/////////// + +// Hex returns the hex "html" representation of the color, as in #ff0080. +func (col Color) Hex() string { + // Add 0.5 for rounding + return fmt.Sprintf("#%02x%02x%02x", uint8(col.R*255.0+0.5), uint8(col.G*255.0+0.5), uint8(col.B*255.0+0.5)) +} + +// Hex parses a "html" hex color-string, either in the 3 "#f0c" or 6 "#ff1034" digits form. +func Hex(scol string) (Color, error) { + format := "#%02x%02x%02x" + factor := 1.0 / 255.0 + if len(scol) == 4 { + format = "#%1x%1x%1x" + factor = 1.0 / 15.0 + } + + var r, g, b uint8 + n, err := fmt.Sscanf(scol, format, &r, &g, &b) + if err != nil { + return Color{}, err + } + if n != 3 { + return Color{}, fmt.Errorf("color: %v is not a hex-color", scol) + } + + return Color{float64(r) * factor, float64(g) * factor, float64(b) * factor}, nil +} + +/// Linear /// +////////////// +// http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/ +// http://www.brucelindbloom.com/Eqn_RGB_to_XYZ.html + +func linearize(v float64) float64 { + if v <= 0.04045 { + return v / 12.92 + } + return math.Pow((v+0.055)/1.055, 2.4) +} + +// LinearRgb converts the color into the linear RGB space (see http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/). +func (col Color) LinearRgb() (r, g, b float64) { + r = linearize(col.R) + g = linearize(col.G) + b = linearize(col.B) + return +} + +// A much faster and still quite precise linearization using a 6th-order Taylor approximation. +// See the accompanying Jupyter notebook for derivation of the constants. +func linearize_fast(v float64) float64 { + v1 := v - 0.5 + v2 := v1 * v1 + v3 := v2 * v1 + v4 := v2 * v2 + //v5 := v3*v2 + return -0.248750514614486 + 0.925583310193438*v + 1.16740237321695*v2 + 0.280457026598666*v3 - 0.0757991963780179*v4 //+ 0.0437040411548932*v5 +} + +// FastLinearRgb is much faster than and almost as accurate as LinearRgb. +// BUT it is important to NOTE that they only produce good results for valid colors r,g,b in [0,1]. +func (col Color) FastLinearRgb() (r, g, b float64) { + r = linearize_fast(col.R) + g = linearize_fast(col.G) + b = linearize_fast(col.B) + return +} + +func delinearize(v float64) float64 { + if v <= 0.0031308 { + return 12.92 * v + } + return 1.055*math.Pow(v, 1.0/2.4) - 0.055 +} + +// LinearRgb creates an sRGB color out of the given linear RGB color (see http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/). +func LinearRgb(r, g, b float64) Color { + return Color{delinearize(r), delinearize(g), delinearize(b)} +} + +func delinearize_fast(v float64) float64 { + // This function (fractional root) is much harder to linearize, so we need to split. + if v > 0.2 { + v1 := v - 0.6 + v2 := v1 * v1 + v3 := v2 * v1 + v4 := v2 * v2 + v5 := v3 * v2 + return 0.442430344268235 + 0.592178981271708*v - 0.287864782562636*v2 + 0.253214392068985*v3 - 0.272557158129811*v4 + 0.325554383321718*v5 + } else if v > 0.03 { + v1 := v - 0.115 + v2 := v1 * v1 + v3 := v2 * v1 + v4 := v2 * v2 + v5 := v3 * v2 + return 0.194915592891669 + 1.55227076330229*v - 3.93691860257828*v2 + 18.0679839248761*v3 - 101.468750302746*v4 + 632.341487393927*v5 + } else { + v1 := v - 0.015 + v2 := v1 * v1 + v3 := v2 * v1 + v4 := v2 * v2 + v5 := v3 * v2 + // You can clearly see from the involved constants that the low-end is highly nonlinear. + return 0.0519565234928877 + 5.09316778537561*v - 99.0338180489702*v2 + 3484.52322764895*v3 - 150028.083412663*v4 + 7168008.42971613*v5 + } +} + +// FastLinearRgb is much faster than and almost as accurate as LinearRgb. +// BUT it is important to NOTE that they only produce good results for valid inputs r,g,b in [0,1]. +func FastLinearRgb(r, g, b float64) Color { + return Color{delinearize_fast(r), delinearize_fast(g), delinearize_fast(b)} +} + +// XyzToLinearRgb converts from CIE XYZ-space to Linear RGB space. +func XyzToLinearRgb(x, y, z float64) (r, g, b float64) { + r = 3.2404542*x - 1.5371385*y - 0.4985314*z + g = -0.9692660*x + 1.8760108*y + 0.0415560*z + b = 0.0556434*x - 0.2040259*y + 1.0572252*z + return +} + +func LinearRgbToXyz(r, g, b float64) (x, y, z float64) { + x = 0.4124564*r + 0.3575761*g + 0.1804375*b + y = 0.2126729*r + 0.7151522*g + 0.0721750*b + z = 0.0193339*r + 0.1191920*g + 0.9503041*b + return +} + +/// XYZ /// +/////////// +// http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/ + +func (col Color) Xyz() (x, y, z float64) { + return LinearRgbToXyz(col.LinearRgb()) +} + +func Xyz(x, y, z float64) Color { + return LinearRgb(XyzToLinearRgb(x, y, z)) +} + +/// xyY /// +/////////// +// http://www.brucelindbloom.com/Eqn_XYZ_to_xyY.html + +// Well, the name is bad, since it's xyY but Golang needs me to start with a +// capital letter to make the method public. +func XyzToXyy(X, Y, Z float64) (x, y, Yout float64) { + return XyzToXyyWhiteRef(X, Y, Z, D65) +} + +func XyzToXyyWhiteRef(X, Y, Z float64, wref [3]float64) (x, y, Yout float64) { + Yout = Y + N := X + Y + Z + if math.Abs(N) < 1e-14 { + // When we have black, Bruce Lindbloom recommends to use + // the reference white's chromacity for x and y. + x = wref[0] / (wref[0] + wref[1] + wref[2]) + y = wref[1] / (wref[0] + wref[1] + wref[2]) + } else { + x = X / N + y = Y / N + } + return +} + +func XyyToXyz(x, y, Y float64) (X, Yout, Z float64) { + Yout = Y + + if -1e-14 < y && y < 1e-14 { + X = 0.0 + Z = 0.0 + } else { + X = Y / y * x + Z = Y / y * (1.0 - x - y) + } + + return +} + +// Converts the given color to CIE xyY space using D65 as reference white. +// (Note that the reference white is only used for black input.) +// x, y and Y are in [0..1] +func (col Color) Xyy() (x, y, Y float64) { + return XyzToXyy(col.Xyz()) +} + +// Converts the given color to CIE xyY space, taking into account +// a given reference white. (i.e. the monitor's white) +// (Note that the reference white is only used for black input.) +// x, y and Y are in [0..1] +func (col Color) XyyWhiteRef(wref [3]float64) (x, y, Y float64) { + X, Y2, Z := col.Xyz() + return XyzToXyyWhiteRef(X, Y2, Z, wref) +} + +// Generates a color by using data given in CIE xyY space. +// x, y and Y are in [0..1] +func Xyy(x, y, Y float64) Color { + return Xyz(XyyToXyz(x, y, Y)) +} + +/// L*a*b* /// +////////////// +// http://en.wikipedia.org/wiki/Lab_color_space#CIELAB-CIEXYZ_conversions +// For L*a*b*, we need to L*a*b*<->XYZ->RGB and the first one is device dependent. + +func lab_f(t float64) float64 { + if t > 6.0/29.0*6.0/29.0*6.0/29.0 { + return math.Cbrt(t) + } + return t/3.0*29.0/6.0*29.0/6.0 + 4.0/29.0 +} + +func XyzToLab(x, y, z float64) (l, a, b float64) { + // Use D65 white as reference point by default. + // http://www.fredmiranda.com/forum/topic/1035332 + // http://en.wikipedia.org/wiki/Standard_illuminant + return XyzToLabWhiteRef(x, y, z, D65) +} + +func XyzToLabWhiteRef(x, y, z float64, wref [3]float64) (l, a, b float64) { + fy := lab_f(y / wref[1]) + l = 1.16*fy - 0.16 + a = 5.0 * (lab_f(x/wref[0]) - fy) + b = 2.0 * (fy - lab_f(z/wref[2])) + return +} + +func lab_finv(t float64) float64 { + if t > 6.0/29.0 { + return t * t * t + } + return 3.0 * 6.0 / 29.0 * 6.0 / 29.0 * (t - 4.0/29.0) +} + +func LabToXyz(l, a, b float64) (x, y, z float64) { + // D65 white (see above). + return LabToXyzWhiteRef(l, a, b, D65) +} + +func LabToXyzWhiteRef(l, a, b float64, wref [3]float64) (x, y, z float64) { + l2 := (l + 0.16) / 1.16 + x = wref[0] * lab_finv(l2+a/5.0) + y = wref[1] * lab_finv(l2) + z = wref[2] * lab_finv(l2-b/2.0) + return +} + +// Converts the given color to CIE L*a*b* space using D65 as reference white. +func (col Color) Lab() (l, a, b float64) { + return XyzToLab(col.Xyz()) +} + +// Converts the given color to CIE L*a*b* space, taking into account +// a given reference white. (i.e. the monitor's white) +func (col Color) LabWhiteRef(wref [3]float64) (l, a, b float64) { + x, y, z := col.Xyz() + return XyzToLabWhiteRef(x, y, z, wref) +} + +// Generates a color by using data given in CIE L*a*b* space using D65 as reference white. +// WARNING: many combinations of `l`, `a`, and `b` values do not have corresponding +// valid RGB values, check the FAQ in the README if you're unsure. +func Lab(l, a, b float64) Color { + return Xyz(LabToXyz(l, a, b)) +} + +// Generates a color by using data given in CIE L*a*b* space, taking +// into account a given reference white. (i.e. the monitor's white) +func LabWhiteRef(l, a, b float64, wref [3]float64) Color { + return Xyz(LabToXyzWhiteRef(l, a, b, wref)) +} + +// DistanceLab is a good measure of visual similarity between two colors! +// A result of 0 would mean identical colors, while a result of 1 or higher +// means the colors differ a lot. +func (c1 Color) DistanceLab(c2 Color) float64 { + l1, a1, b1 := c1.Lab() + l2, a2, b2 := c2.Lab() + return math.Sqrt(sq(l1-l2) + sq(a1-a2) + sq(b1-b2)) +} + +// That's actually the same, but I don't want to break code. +func (c1 Color) DistanceCIE76(c2 Color) float64 { + return c1.DistanceLab(c2) +} + +// Uses the CIE94 formula to calculate color distance. More accurate than +// DistanceLab, but also more work. +func (cl Color) DistanceCIE94(cr Color) float64 { + l1, a1, b1 := cl.Lab() + l2, a2, b2 := cr.Lab() + + // NOTE: Since all those formulas expect L,a,b values 100x larger than we + // have them in this library, we either need to adjust all constants + // in the formula, or convert the ranges of L,a,b before, and then + // scale the distances down again. The latter is less error-prone. + l1, a1, b1 = l1*100.0, a1*100.0, b1*100.0 + l2, a2, b2 = l2*100.0, a2*100.0, b2*100.0 + + kl := 1.0 // 2.0 for textiles + kc := 1.0 + kh := 1.0 + k1 := 0.045 // 0.048 for textiles + k2 := 0.015 // 0.014 for textiles. + + deltaL := l1 - l2 + c1 := math.Sqrt(sq(a1) + sq(b1)) + c2 := math.Sqrt(sq(a2) + sq(b2)) + deltaCab := c1 - c2 + + // Not taking Sqrt here for stability, and it's unnecessary. + deltaHab2 := sq(a1-a2) + sq(b1-b2) - sq(deltaCab) + sl := 1.0 + sc := 1.0 + k1*c1 + sh := 1.0 + k2*c1 + + vL2 := sq(deltaL / (kl * sl)) + vC2 := sq(deltaCab / (kc * sc)) + vH2 := deltaHab2 / sq(kh*sh) + + return math.Sqrt(vL2+vC2+vH2) * 0.01 // See above. +} + +// DistanceCIEDE2000 uses the Delta E 2000 formula to calculate color +// distance. It is more expensive but more accurate than both DistanceLab +// and DistanceCIE94. +func (cl Color) DistanceCIEDE2000(cr Color) float64 { + return cl.DistanceCIEDE2000klch(cr, 1.0, 1.0, 1.0) +} + +// DistanceCIEDE2000klch uses the Delta E 2000 formula with custom values +// for the weighting factors kL, kC, and kH. +func (cl Color) DistanceCIEDE2000klch(cr Color, kl, kc, kh float64) float64 { + l1, a1, b1 := cl.Lab() + l2, a2, b2 := cr.Lab() + + // As with CIE94, we scale up the ranges of L,a,b beforehand and scale + // them down again afterwards. + l1, a1, b1 = l1*100.0, a1*100.0, b1*100.0 + l2, a2, b2 = l2*100.0, a2*100.0, b2*100.0 + + cab1 := math.Sqrt(sq(a1) + sq(b1)) + cab2 := math.Sqrt(sq(a2) + sq(b2)) + cabmean := (cab1 + cab2) / 2 + + g := 0.5 * (1 - math.Sqrt(math.Pow(cabmean, 7)/(math.Pow(cabmean, 7)+math.Pow(25, 7)))) + ap1 := (1 + g) * a1 + ap2 := (1 + g) * a2 + cp1 := math.Sqrt(sq(ap1) + sq(b1)) + cp2 := math.Sqrt(sq(ap2) + sq(b2)) + + hp1 := 0.0 + if b1 != ap1 || ap1 != 0 { + hp1 = math.Atan2(b1, ap1) + if hp1 < 0 { + hp1 += math.Pi * 2 + } + hp1 *= 180 / math.Pi + } + hp2 := 0.0 + if b2 != ap2 || ap2 != 0 { + hp2 = math.Atan2(b2, ap2) + if hp2 < 0 { + hp2 += math.Pi * 2 + } + hp2 *= 180 / math.Pi + } + + deltaLp := l2 - l1 + deltaCp := cp2 - cp1 + dhp := 0.0 + cpProduct := cp1 * cp2 + if cpProduct != 0 { + dhp = hp2 - hp1 + if dhp > 180 { + dhp -= 360 + } else if dhp < -180 { + dhp += 360 + } + } + deltaHp := 2 * math.Sqrt(cpProduct) * math.Sin(dhp/2*math.Pi/180) + + lpmean := (l1 + l2) / 2 + cpmean := (cp1 + cp2) / 2 + hpmean := hp1 + hp2 + if cpProduct != 0 { + hpmean /= 2 + if math.Abs(hp1-hp2) > 180 { + if hp1+hp2 < 360 { + hpmean += 180 + } else { + hpmean -= 180 + } + } + } + + t := 1 - 0.17*math.Cos((hpmean-30)*math.Pi/180) + 0.24*math.Cos(2*hpmean*math.Pi/180) + 0.32*math.Cos((3*hpmean+6)*math.Pi/180) - 0.2*math.Cos((4*hpmean-63)*math.Pi/180) + deltaTheta := 30 * math.Exp(-sq((hpmean-275)/25)) + rc := 2 * math.Sqrt(math.Pow(cpmean, 7)/(math.Pow(cpmean, 7)+math.Pow(25, 7))) + sl := 1 + (0.015*sq(lpmean-50))/math.Sqrt(20+sq(lpmean-50)) + sc := 1 + 0.045*cpmean + sh := 1 + 0.015*cpmean*t + rt := -math.Sin(2*deltaTheta*math.Pi/180) * rc + + return math.Sqrt(sq(deltaLp/(kl*sl))+sq(deltaCp/(kc*sc))+sq(deltaHp/(kh*sh))+rt*(deltaCp/(kc*sc))*(deltaHp/(kh*sh))) * 0.01 +} + +// BlendLab blends two colors in the L*a*b* color-space, which should result in a smoother blend. +// t == 0 results in c1, t == 1 results in c2 +func (c1 Color) BlendLab(c2 Color, t float64) Color { + l1, a1, b1 := c1.Lab() + l2, a2, b2 := c2.Lab() + return Lab(l1+t*(l2-l1), + a1+t*(a2-a1), + b1+t*(b2-b1)) +} + +/// L*u*v* /// +////////////// +// http://en.wikipedia.org/wiki/CIELUV#XYZ_.E2.86.92_CIELUV_and_CIELUV_.E2.86.92_XYZ_conversions +// For L*u*v*, we need to L*u*v*<->XYZ<->RGB and the first one is device dependent. + +func XyzToLuv(x, y, z float64) (l, a, b float64) { + // Use D65 white as reference point by default. + // http://www.fredmiranda.com/forum/topic/1035332 + // http://en.wikipedia.org/wiki/Standard_illuminant + return XyzToLuvWhiteRef(x, y, z, D65) +} + +func XyzToLuvWhiteRef(x, y, z float64, wref [3]float64) (l, u, v float64) { + if y/wref[1] <= 6.0/29.0*6.0/29.0*6.0/29.0 { + l = y / wref[1] * 29.0 / 3.0 * 29.0 / 3.0 * 29.0 / 3.0 + } else { + l = 1.16*math.Cbrt(y/wref[1]) - 0.16 + } + ubis, vbis := xyz_to_uv(x, y, z) + un, vn := xyz_to_uv(wref[0], wref[1], wref[2]) + u = 13.0 * l * (ubis - un) + v = 13.0 * l * (vbis - vn) + return +} + +// For this part, we do as R's graphics.hcl does, not as wikipedia does. +// Or is it the same? +func xyz_to_uv(x, y, z float64) (u, v float64) { + denom := x + 15.0*y + 3.0*z + if denom == 0.0 { + u, v = 0.0, 0.0 + } else { + u = 4.0 * x / denom + v = 9.0 * y / denom + } + return +} + +func LuvToXyz(l, u, v float64) (x, y, z float64) { + // D65 white (see above). + return LuvToXyzWhiteRef(l, u, v, D65) +} + +func LuvToXyzWhiteRef(l, u, v float64, wref [3]float64) (x, y, z float64) { + //y = wref[1] * lab_finv((l + 0.16) / 1.16) + if l <= 0.08 { + y = wref[1] * l * 100.0 * 3.0 / 29.0 * 3.0 / 29.0 * 3.0 / 29.0 + } else { + y = wref[1] * cub((l+0.16)/1.16) + } + un, vn := xyz_to_uv(wref[0], wref[1], wref[2]) + if l != 0.0 { + ubis := u/(13.0*l) + un + vbis := v/(13.0*l) + vn + x = y * 9.0 * ubis / (4.0 * vbis) + z = y * (12.0 - 3.0*ubis - 20.0*vbis) / (4.0 * vbis) + } else { + x, y = 0.0, 0.0 + } + return +} + +// Converts the given color to CIE L*u*v* space using D65 as reference white. +// L* is in [0..1] and both u* and v* are in about [-1..1] +func (col Color) Luv() (l, u, v float64) { + return XyzToLuv(col.Xyz()) +} + +// Converts the given color to CIE L*u*v* space, taking into account +// a given reference white. (i.e. the monitor's white) +// L* is in [0..1] and both u* and v* are in about [-1..1] +func (col Color) LuvWhiteRef(wref [3]float64) (l, u, v float64) { + x, y, z := col.Xyz() + return XyzToLuvWhiteRef(x, y, z, wref) +} + +// Generates a color by using data given in CIE L*u*v* space using D65 as reference white. +// L* is in [0..1] and both u* and v* are in about [-1..1] +// WARNING: many combinations of `l`, `a`, and `b` values do not have corresponding +// valid RGB values, check the FAQ in the README if you're unsure. +func Luv(l, u, v float64) Color { + return Xyz(LuvToXyz(l, u, v)) +} + +// Generates a color by using data given in CIE L*u*v* space, taking +// into account a given reference white. (i.e. the monitor's white) +// L* is in [0..1] and both u* and v* are in about [-1..1] +func LuvWhiteRef(l, u, v float64, wref [3]float64) Color { + return Xyz(LuvToXyzWhiteRef(l, u, v, wref)) +} + +// DistanceLuv is a good measure of visual similarity between two colors! +// A result of 0 would mean identical colors, while a result of 1 or higher +// means the colors differ a lot. +func (c1 Color) DistanceLuv(c2 Color) float64 { + l1, u1, v1 := c1.Luv() + l2, u2, v2 := c2.Luv() + return math.Sqrt(sq(l1-l2) + sq(u1-u2) + sq(v1-v2)) +} + +// BlendLuv blends two colors in the CIE-L*u*v* color-space, which should result in a smoother blend. +// t == 0 results in c1, t == 1 results in c2 +func (c1 Color) BlendLuv(c2 Color, t float64) Color { + l1, u1, v1 := c1.Luv() + l2, u2, v2 := c2.Luv() + return Luv(l1+t*(l2-l1), + u1+t*(u2-u1), + v1+t*(v2-v1)) +} + +/// HCL /// +/////////// +// HCL is nothing else than L*a*b* in cylindrical coordinates! +// (this was wrong on English wikipedia, I fixed it, let's hope the fix stays.) +// But it is widely popular since it is a "correct HSV" +// http://www.hunterlab.com/appnotes/an09_96a.pdf + +// Converts the given color to HCL space using D65 as reference white. +// H values are in [0..360], C and L values are in [0..1] although C can overshoot 1.0 +func (col Color) Hcl() (h, c, l float64) { + return col.HclWhiteRef(D65) +} + +func LabToHcl(L, a, b float64) (h, c, l float64) { + // Oops, floating point workaround necessary if a ~= b and both are very small (i.e. almost zero). + if math.Abs(b-a) > 1e-4 && math.Abs(a) > 1e-4 { + h = math.Mod(57.29577951308232087721*math.Atan2(b, a)+360.0, 360.0) // Rad2Deg + } else { + h = 0.0 + } + c = math.Sqrt(sq(a) + sq(b)) + l = L + return +} + +// Converts the given color to HCL space, taking into account +// a given reference white. (i.e. the monitor's white) +// H values are in [0..360], C and L values are in [0..1] +func (col Color) HclWhiteRef(wref [3]float64) (h, c, l float64) { + L, a, b := col.LabWhiteRef(wref) + return LabToHcl(L, a, b) +} + +// Generates a color by using data given in HCL space using D65 as reference white. +// H values are in [0..360], C and L values are in [0..1] +// WARNING: many combinations of `l`, `a`, and `b` values do not have corresponding +// valid RGB values, check the FAQ in the README if you're unsure. +func Hcl(h, c, l float64) Color { + return HclWhiteRef(h, c, l, D65) +} + +func HclToLab(h, c, l float64) (L, a, b float64) { + H := 0.01745329251994329576 * h // Deg2Rad + a = c * math.Cos(H) + b = c * math.Sin(H) + L = l + return +} + +// Generates a color by using data given in HCL space, taking +// into account a given reference white. (i.e. the monitor's white) +// H values are in [0..360], C and L values are in [0..1] +func HclWhiteRef(h, c, l float64, wref [3]float64) Color { + L, a, b := HclToLab(h, c, l) + return LabWhiteRef(L, a, b, wref) +} + +// BlendHcl blends two colors in the CIE-L*C*h° color-space, which should result in a smoother blend. +// t == 0 results in c1, t == 1 results in c2 +func (col1 Color) BlendHcl(col2 Color, t float64) Color { + h1, c1, l1 := col1.Hcl() + h2, c2, l2 := col2.Hcl() + + // We know that h are both in [0..360] + return Hcl(interp_angle(h1, h2, t), c1+t*(c2-c1), l1+t*(l2-l1)) +} diff --git a/vendor/github.com/lucasb-eyer/go-colorful/happy_palettegen.go b/vendor/github.com/lucasb-eyer/go-colorful/happy_palettegen.go new file mode 100644 index 000000000..bb66dfa4f --- /dev/null +++ b/vendor/github.com/lucasb-eyer/go-colorful/happy_palettegen.go @@ -0,0 +1,25 @@ +package colorful + +import ( + "math/rand" +) + +// Uses the HSV color space to generate colors with similar S,V but distributed +// evenly along their Hue. This is fast but not always pretty. +// If you've got time to spare, use Lab (the non-fast below). +func FastHappyPalette(colorsCount int) (colors []Color) { + colors = make([]Color, colorsCount) + + for i := 0; i < colorsCount; i++ { + colors[i] = Hsv(float64(i)*(360.0/float64(colorsCount)), 0.8+rand.Float64()*0.2, 0.65+rand.Float64()*0.2) + } + return +} + +func HappyPalette(colorsCount int) ([]Color, error) { + pimpy := func(l, a, b float64) bool { + _, c, _ := LabToHcl(l, a, b) + return 0.3 <= c && 0.4 <= l && l <= 0.8 + } + return SoftPaletteEx(colorsCount, SoftPaletteSettings{pimpy, 50, true}) +} diff --git a/vendor/github.com/lucasb-eyer/go-colorful/hexcolor.go b/vendor/github.com/lucasb-eyer/go-colorful/hexcolor.go new file mode 100644 index 000000000..86a5ed987 --- /dev/null +++ b/vendor/github.com/lucasb-eyer/go-colorful/hexcolor.go @@ -0,0 +1,37 @@ +package colorful + +import ( + "database/sql/driver" + "fmt" + "reflect" +) + +// A HexColor is a Color stored as a hex string "#rrggbb". It implements the +// database/sql.Scanner and database/sql/driver.Value interfaces. +type HexColor Color + +type errUnsupportedType struct { + got interface{} + want reflect.Type +} + +func (hc *HexColor) Scan(value interface{}) error { + s, ok := value.(string) + if !ok { + return errUnsupportedType{got: reflect.TypeOf(value), want: reflect.TypeOf("")} + } + c, err := Hex(s) + if err != nil { + return err + } + *hc = HexColor(c) + return nil +} + +func (hc *HexColor) Value() (driver.Value, error) { + return Color(*hc).Hex(), nil +} + +func (e errUnsupportedType) Error() string { + return fmt.Sprintf("unsupported type: got %v, want a %s", e.got, e.want) +} diff --git a/vendor/github.com/lucasb-eyer/go-colorful/soft_palettegen.go b/vendor/github.com/lucasb-eyer/go-colorful/soft_palettegen.go new file mode 100644 index 000000000..0154ac9ba --- /dev/null +++ b/vendor/github.com/lucasb-eyer/go-colorful/soft_palettegen.go @@ -0,0 +1,185 @@ +// Largely inspired by the descriptions in http://lab.medialab.sciences-po.fr/iwanthue/ +// but written from scratch. + +package colorful + +import ( + "fmt" + "math" + "math/rand" +) + +// The algorithm works in L*a*b* color space and converts to RGB in the end. +// L* in [0..1], a* and b* in [-1..1] +type lab_t struct { + L, A, B float64 +} + +type SoftPaletteSettings struct { + // A function which can be used to restrict the allowed color-space. + CheckColor func(l, a, b float64) bool + + // The higher, the better quality but the slower. Usually two figures. + Iterations int + + // Use up to 160000 or 8000 samples of the L*a*b* space (and thus calls to CheckColor). + // Set this to true only if your CheckColor shapes the Lab space weirdly. + ManySamples bool +} + +// Yeah, windows-stype Foo, FooEx, screw you golang... +// Uses K-means to cluster the color-space and return the means of the clusters +// as a new palette of distinctive colors. Falls back to K-medoid if the mean +// happens to fall outside of the color-space, which can only happen if you +// specify a CheckColor function. +func SoftPaletteEx(colorsCount int, settings SoftPaletteSettings) ([]Color, error) { + + // Checks whether it's a valid RGB and also fulfills the potentially provided constraint. + check := func(col lab_t) bool { + c := Lab(col.L, col.A, col.B) + return c.IsValid() && (settings.CheckColor == nil || settings.CheckColor(col.L, col.A, col.B)) + } + + // Sample the color space. These will be the points k-means is run on. + dl := 0.05 + dab := 0.1 + if settings.ManySamples { + dl = 0.01 + dab = 0.05 + } + + samples := make([]lab_t, 0, int(1.0/dl*2.0/dab*2.0/dab)) + for l := 0.0; l <= 1.0; l += dl { + for a := -1.0; a <= 1.0; a += dab { + for b := -1.0; b <= 1.0; b += dab { + if check(lab_t{l, a, b}) { + samples = append(samples, lab_t{l, a, b}) + } + } + } + } + + // That would cause some infinite loops down there... + if len(samples) < colorsCount { + return nil, fmt.Errorf("palettegen: more colors requested (%v) than samples available (%v). Your requested color count may be wrong, you might want to use many samples or your constraint function makes the valid color space too small.", colorsCount, len(samples)) + } else if len(samples) == colorsCount { + return labs2cols(samples), nil // Oops? + } + + // We take the initial means out of the samples, so they are in fact medoids. + // This helps us avoid infinite loops or arbitrary cutoffs with too restrictive constraints. + means := make([]lab_t, colorsCount) + for i := 0; i < colorsCount; i++ { + for means[i] = samples[rand.Intn(len(samples))]; in(means, i, means[i]); means[i] = samples[rand.Intn(len(samples))] { + } + } + + clusters := make([]int, len(samples)) + samples_used := make([]bool, len(samples)) + + // The actual k-means/medoid iterations + for i := 0; i < settings.Iterations; i++ { + // Reassing the samples to clusters, i.e. to their closest mean. + // By the way, also check if any sample is used as a medoid and if so, mark that. + for isample, sample := range samples { + samples_used[isample] = false + mindist := math.Inf(+1) + for imean, mean := range means { + dist := lab_dist(sample, mean) + if dist < mindist { + mindist = dist + clusters[isample] = imean + } + + // Mark samples which are used as a medoid. + if lab_eq(sample, mean) { + samples_used[isample] = true + } + } + } + + // Compute new means according to the samples. + for imean := range means { + // The new mean is the average of all samples belonging to it.. + nsamples := 0 + newmean := lab_t{0.0, 0.0, 0.0} + for isample, sample := range samples { + if clusters[isample] == imean { + nsamples++ + newmean.L += sample.L + newmean.A += sample.A + newmean.B += sample.B + } + } + if nsamples > 0 { + newmean.L /= float64(nsamples) + newmean.A /= float64(nsamples) + newmean.B /= float64(nsamples) + } else { + // That mean doesn't have any samples? Get a new mean from the sample list! + var inewmean int + for inewmean = rand.Intn(len(samples_used)); samples_used[inewmean]; inewmean = rand.Intn(len(samples_used)) { + } + newmean = samples[inewmean] + samples_used[inewmean] = true + } + + // But now we still need to check whether the new mean is an allowed color. + if nsamples > 0 && check(newmean) { + // It does, life's good (TM) + means[imean] = newmean + } else { + // New mean isn't an allowed color or doesn't have any samples! + // Switch to medoid mode and pick the closest (unused) sample. + // This should always find something thanks to len(samples) >= colorsCount + mindist := math.Inf(+1) + for isample, sample := range samples { + if !samples_used[isample] { + dist := lab_dist(sample, newmean) + if dist < mindist { + mindist = dist + newmean = sample + } + } + } + } + } + } + return labs2cols(means), nil +} + +// A wrapper which uses common parameters. +func SoftPalette(colorsCount int) ([]Color, error) { + return SoftPaletteEx(colorsCount, SoftPaletteSettings{nil, 50, false}) +} + +func in(haystack []lab_t, upto int, needle lab_t) bool { + for i := 0; i < upto && i < len(haystack); i++ { + if haystack[i] == needle { + return true + } + } + return false +} + +const LAB_DELTA = 1e-6 + +func lab_eq(lab1, lab2 lab_t) bool { + return math.Abs(lab1.L-lab2.L) < LAB_DELTA && + math.Abs(lab1.A-lab2.A) < LAB_DELTA && + math.Abs(lab1.B-lab2.B) < LAB_DELTA +} + +// That's faster than using colorful's DistanceLab since we would have to +// convert back and forth for that. Here is no conversion. +func lab_dist(lab1, lab2 lab_t) float64 { + return math.Sqrt(sq(lab1.L-lab2.L) + sq(lab1.A-lab2.A) + sq(lab1.B-lab2.B)) +} + +func labs2cols(labs []lab_t) (cols []Color) { + cols = make([]Color, len(labs)) + for k, v := range labs { + cols[k] = Lab(v.L, v.A, v.B) + } + return cols +} diff --git a/vendor/github.com/lucasb-eyer/go-colorful/warm_palettegen.go b/vendor/github.com/lucasb-eyer/go-colorful/warm_palettegen.go new file mode 100644 index 000000000..00f42a5cc --- /dev/null +++ b/vendor/github.com/lucasb-eyer/go-colorful/warm_palettegen.go @@ -0,0 +1,25 @@ +package colorful + +import ( + "math/rand" +) + +// Uses the HSV color space to generate colors with similar S,V but distributed +// evenly along their Hue. This is fast but not always pretty. +// If you've got time to spare, use Lab (the non-fast below). +func FastWarmPalette(colorsCount int) (colors []Color) { + colors = make([]Color, colorsCount) + + for i := 0; i < colorsCount; i++ { + colors[i] = Hsv(float64(i)*(360.0/float64(colorsCount)), 0.55+rand.Float64()*0.2, 0.35+rand.Float64()*0.2) + } + return +} + +func WarmPalette(colorsCount int) ([]Color, error) { + warmy := func(l, a, b float64) bool { + _, c, _ := LabToHcl(l, a, b) + return 0.1 <= c && c <= 0.4 && 0.2 <= l && l <= 0.5 + } + return SoftPaletteEx(colorsCount, SoftPaletteSettings{warmy, 50, true}) +} diff --git a/vendor/github.com/mattn/go-runewidth/.travis.yml b/vendor/github.com/mattn/go-runewidth/.travis.yml deleted file mode 100644 index 6a21813a3..000000000 --- a/vendor/github.com/mattn/go-runewidth/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: go -sudo: false -go: - - 1.13.x - - tip - -before_install: - - go get -t -v ./... - -script: - - go generate - - git diff --cached --exit-code - - ./go.test.sh - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/mattn/go-runewidth/README.md b/vendor/github.com/mattn/go-runewidth/README.md index aa56ab96c..5e2cfd98c 100644 --- a/vendor/github.com/mattn/go-runewidth/README.md +++ b/vendor/github.com/mattn/go-runewidth/README.md @@ -1,7 +1,7 @@ go-runewidth ============ -[![Build Status](https://travis-ci.org/mattn/go-runewidth.png?branch=master)](https://travis-ci.org/mattn/go-runewidth) +[![Build Status](https://github.com/mattn/go-runewidth/workflows/test/badge.svg?branch=master)](https://github.com/mattn/go-runewidth/actions?query=workflow%3Atest) [![Codecov](https://codecov.io/gh/mattn/go-runewidth/branch/master/graph/badge.svg)](https://codecov.io/gh/mattn/go-runewidth) [![GoDoc](https://godoc.org/github.com/mattn/go-runewidth?status.svg)](http://godoc.org/github.com/mattn/go-runewidth) [![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-runewidth)](https://goreportcard.com/report/github.com/mattn/go-runewidth) diff --git a/vendor/github.com/mattn/go-runewidth/go.test.sh b/vendor/github.com/mattn/go-runewidth/go.test.sh deleted file mode 100644 index 012162b07..000000000 --- a/vendor/github.com/mattn/go-runewidth/go.test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -e -echo "" > coverage.txt - -for d in $(go list ./... | grep -v vendor); do - go test -race -coverprofile=profile.out -covermode=atomic "$d" - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done diff --git a/vendor/github.com/mattn/go-runewidth/runewidth.go b/vendor/github.com/mattn/go-runewidth/runewidth.go index 19f8e0449..7dfbb3be9 100644 --- a/vendor/github.com/mattn/go-runewidth/runewidth.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth.go @@ -2,6 +2,9 @@ package runewidth import ( "os" + "strings" + + "github.com/rivo/uniseg" ) //go:generate go run script/generate.go @@ -10,11 +13,14 @@ var ( // EastAsianWidth will be set true if the current locale is CJK EastAsianWidth bool - // ZeroWidthJoiner is flag to set to use UTR#51 ZWJ - ZeroWidthJoiner bool + // StrictEmojiNeutral should be set false if handle broken fonts + StrictEmojiNeutral bool = true // DefaultCondition is a condition in current locale - DefaultCondition = &Condition{} + DefaultCondition = &Condition{ + EastAsianWidth: false, + StrictEmojiNeutral: true, + } ) func init() { @@ -29,8 +35,13 @@ func handleEnv() { EastAsianWidth = env == "1" } // update DefaultCondition - DefaultCondition.EastAsianWidth = EastAsianWidth - DefaultCondition.ZeroWidthJoiner = ZeroWidthJoiner + if DefaultCondition.EastAsianWidth != EastAsianWidth { + DefaultCondition.EastAsianWidth = EastAsianWidth + if len(DefaultCondition.combinedLut) > 0 { + DefaultCondition.combinedLut = DefaultCondition.combinedLut[:0] + CreateLUT() + } + } } type interval struct { @@ -85,63 +96,97 @@ var nonprint = table{ // Condition have flag EastAsianWidth whether the current locale is CJK or not. type Condition struct { - EastAsianWidth bool - ZeroWidthJoiner bool + combinedLut []byte + EastAsianWidth bool + StrictEmojiNeutral bool } // NewCondition return new instance of Condition which is current locale. func NewCondition() *Condition { return &Condition{ - EastAsianWidth: EastAsianWidth, - ZeroWidthJoiner: ZeroWidthJoiner, + EastAsianWidth: EastAsianWidth, + StrictEmojiNeutral: StrictEmojiNeutral, } } // RuneWidth returns the number of cells in r. // See http://www.unicode.org/reports/tr11/ func (c *Condition) RuneWidth(r rune) int { - switch { - case r < 0 || r > 0x10FFFF || inTables(r, nonprint, combining, notassigned): + if r < 0 || r > 0x10FFFF { return 0 - case (c.EastAsianWidth && IsAmbiguousWidth(r)) || inTables(r, doublewidth): - return 2 - default: - return 1 } -} - -func (c *Condition) stringWidth(s string) (width int) { - for _, r := range []rune(s) { - width += c.RuneWidth(r) + if len(c.combinedLut) > 0 { + return int(c.combinedLut[r>>1]>>(uint(r&1)*4)) & 3 } - return width -} - -func (c *Condition) stringWidthZeroJoiner(s string) (width int) { - r1, r2 := rune(0), rune(0) - for _, r := range []rune(s) { - if r == 0xFE0E || r == 0xFE0F { - continue + // optimized version, verified by TestRuneWidthChecksums() + if !c.EastAsianWidth { + switch { + case r < 0x20: + return 0 + case (r >= 0x7F && r <= 0x9F) || r == 0xAD: // nonprint + return 0 + case r < 0x300: + return 1 + case inTable(r, narrow): + return 1 + case inTables(r, nonprint, combining): + return 0 + case inTable(r, doublewidth): + return 2 + default: + return 1 } - w := c.RuneWidth(r) - if r2 == 0x200D && inTables(r, emoji) && inTables(r1, emoji) { - if width < w { - width = w - } - } else { - width += w + } else { + switch { + case inTables(r, nonprint, combining): + return 0 + case inTable(r, narrow): + return 1 + case inTables(r, ambiguous, doublewidth): + return 2 + case !c.StrictEmojiNeutral && inTables(r, ambiguous, emoji, narrow): + return 2 + default: + return 1 } - r1, r2 = r2, r } - return width +} + +// CreateLUT will create an in-memory lookup table of 557056 bytes for faster operation. +// This should not be called concurrently with other operations on c. +// If options in c is changed, CreateLUT should be called again. +func (c *Condition) CreateLUT() { + const max = 0x110000 + lut := c.combinedLut + if len(c.combinedLut) != 0 { + // Remove so we don't use it. + c.combinedLut = nil + } else { + lut = make([]byte, max/2) + } + for i := range lut { + i32 := int32(i * 2) + x0 := c.RuneWidth(i32) + x1 := c.RuneWidth(i32 + 1) + lut[i] = uint8(x0) | uint8(x1)<<4 + } + c.combinedLut = lut } // StringWidth return width as you can see func (c *Condition) StringWidth(s string) (width int) { - if c.ZeroWidthJoiner { - return c.stringWidthZeroJoiner(s) + g := uniseg.NewGraphemes(s) + for g.Next() { + var chWidth int + for _, r := range g.Runes() { + chWidth = c.RuneWidth(r) + if chWidth > 0 { + break // Our best guess at this point is to use the width of the first non-zero-width rune. + } + } + width += chWidth } - return c.stringWidth(s) + return } // Truncate return string truncated with w cells @@ -149,27 +194,69 @@ func (c *Condition) Truncate(s string, w int, tail string) string { if c.StringWidth(s) <= w { return s } - r := []rune(s) - tw := c.StringWidth(tail) - w -= tw - width := 0 - i := 0 - for ; i < len(r); i++ { - cw := c.RuneWidth(r[i]) - if width+cw > w { + w -= c.StringWidth(tail) + var width int + pos := len(s) + g := uniseg.NewGraphemes(s) + for g.Next() { + var chWidth int + for _, r := range g.Runes() { + chWidth = c.RuneWidth(r) + if chWidth > 0 { + break // See StringWidth() for details. + } + } + if width+chWidth > w { + pos, _ = g.Positions() break } - width += cw + width += chWidth + } + return s[:pos] + tail +} + +// TruncateLeft cuts w cells from the beginning of the `s`. +func (c *Condition) TruncateLeft(s string, w int, prefix string) string { + if c.StringWidth(s) <= w { + return prefix + } + + var width int + pos := len(s) + + g := uniseg.NewGraphemes(s) + for g.Next() { + var chWidth int + for _, r := range g.Runes() { + chWidth = c.RuneWidth(r) + if chWidth > 0 { + break // See StringWidth() for details. + } + } + + if width+chWidth > w { + if width < w { + _, pos = g.Positions() + prefix += strings.Repeat(" ", width+chWidth-w) + } else { + pos, _ = g.Positions() + } + + break + } + + width += chWidth } - return string(r[0:i]) + tail + + return prefix + s[pos:] } // Wrap return string wrapped with w cells func (c *Condition) Wrap(s string, w int) string { width := 0 out := "" - for _, r := range []rune(s) { - cw := RuneWidth(r) + for _, r := range s { + cw := c.RuneWidth(r) if r == '\n' { out += string(r) width = 0 @@ -241,6 +328,11 @@ func Truncate(s string, w int, tail string) string { return DefaultCondition.Truncate(s, w, tail) } +// TruncateLeft cuts w cells from the beginning of the `s`. +func TruncateLeft(s string, w int, prefix string) string { + return DefaultCondition.TruncateLeft(s, w, prefix) +} + // Wrap return string wrapped with w cells func Wrap(s string, w int) string { return DefaultCondition.Wrap(s, w) @@ -255,3 +347,12 @@ func FillLeft(s string, w int) string { func FillRight(s string, w int) string { return DefaultCondition.FillRight(s, w) } + +// CreateLUT will create an in-memory lookup table of 557055 bytes for faster operation. +// This should not be called concurrently with other operations. +func CreateLUT() { + if len(DefaultCondition.combinedLut) > 0 { + return + } + DefaultCondition.CreateLUT() +} diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_appengine.go b/vendor/github.com/mattn/go-runewidth/runewidth_appengine.go index 7d99f6e52..84b6528df 100644 --- a/vendor/github.com/mattn/go-runewidth/runewidth_appengine.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth_appengine.go @@ -1,3 +1,4 @@ +//go:build appengine // +build appengine package runewidth diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_js.go b/vendor/github.com/mattn/go-runewidth/runewidth_js.go index c5fdf40ba..c2abbc2db 100644 --- a/vendor/github.com/mattn/go-runewidth/runewidth_js.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth_js.go @@ -1,5 +1,5 @@ -// +build js -// +build !appengine +//go:build js && !appengine +// +build js,!appengine package runewidth diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_posix.go b/vendor/github.com/mattn/go-runewidth/runewidth_posix.go index 480ad7485..5a31d738e 100644 --- a/vendor/github.com/mattn/go-runewidth/runewidth_posix.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth_posix.go @@ -1,6 +1,5 @@ -// +build !windows -// +build !js -// +build !appengine +//go:build !windows && !js && !appengine +// +build !windows,!js,!appengine package runewidth diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_table.go b/vendor/github.com/mattn/go-runewidth/runewidth_table.go index b27d77d89..e5d890c26 100644 --- a/vendor/github.com/mattn/go-runewidth/runewidth_table.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth_table.go @@ -124,8 +124,10 @@ var ambiguous = table{ {0x1F18F, 0x1F190}, {0x1F19B, 0x1F1AC}, {0xE0100, 0xE01EF}, {0xF0000, 0xFFFFD}, {0x100000, 0x10FFFD}, } -var notassigned = table{ - {0x27E6, 0x27ED}, {0x2985, 0x2986}, +var narrow = table{ + {0x0020, 0x007E}, {0x00A2, 0x00A3}, {0x00A5, 0x00A6}, + {0x00AC, 0x00AC}, {0x00AF, 0x00AF}, {0x27E6, 0x27ED}, + {0x2985, 0x2986}, } var neutral = table{ diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_windows.go b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go index d6a61777d..5f987a310 100644 --- a/vendor/github.com/mattn/go-runewidth/runewidth_windows.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go @@ -1,5 +1,5 @@ -// +build windows -// +build !appengine +//go:build windows && !appengine +// +build windows,!appengine package runewidth diff --git a/vendor/github.com/muesli/reflow/LICENSE b/vendor/github.com/muesli/reflow/LICENSE new file mode 100644 index 000000000..8532c45c9 --- /dev/null +++ b/vendor/github.com/muesli/reflow/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Christian Muehlhaeuser + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/muesli/reflow/ansi/ansi.go b/vendor/github.com/muesli/reflow/ansi/ansi.go new file mode 100644 index 000000000..f3d0700af --- /dev/null +++ b/vendor/github.com/muesli/reflow/ansi/ansi.go @@ -0,0 +1,7 @@ +package ansi + +const Marker = '\x1B' + +func IsTerminator(c rune) bool { + return (c >= 0x40 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a) +} diff --git a/vendor/github.com/muesli/reflow/ansi/buffer.go b/vendor/github.com/muesli/reflow/ansi/buffer.go new file mode 100644 index 000000000..471bcaf78 --- /dev/null +++ b/vendor/github.com/muesli/reflow/ansi/buffer.go @@ -0,0 +1,40 @@ +package ansi + +import ( + "bytes" + + "github.com/mattn/go-runewidth" +) + +// Buffer is a buffer aware of ANSI escape sequences. +type Buffer struct { + bytes.Buffer +} + +// PrintableRuneWidth returns the cell width of all printable runes in the +// buffer. +func (w Buffer) PrintableRuneWidth() int { + return PrintableRuneWidth(w.String()) +} + +// PrintableRuneWidth returns the cell width of the given string. +func PrintableRuneWidth(s string) int { + var n int + var ansi bool + + for _, c := range s { + if c == Marker { + // ANSI escape sequence + ansi = true + } else if ansi { + if IsTerminator(c) { + // ANSI sequence terminated + ansi = false + } + } else { + n += runewidth.RuneWidth(c) + } + } + + return n +} diff --git a/vendor/github.com/muesli/reflow/ansi/writer.go b/vendor/github.com/muesli/reflow/ansi/writer.go new file mode 100644 index 000000000..a6aaa1ec6 --- /dev/null +++ b/vendor/github.com/muesli/reflow/ansi/writer.go @@ -0,0 +1,76 @@ +package ansi + +import ( + "bytes" + "io" + "unicode/utf8" +) + +type Writer struct { + Forward io.Writer + + ansi bool + ansiseq bytes.Buffer + lastseq bytes.Buffer + seqchanged bool + runeBuf []byte +} + +// Write is used to write content to the ANSI buffer. +func (w *Writer) Write(b []byte) (int, error) { + for _, c := range string(b) { + if c == Marker { + // ANSI escape sequence + w.ansi = true + w.seqchanged = true + _, _ = w.ansiseq.WriteRune(c) + } else if w.ansi { + _, _ = w.ansiseq.WriteRune(c) + if IsTerminator(c) { + // ANSI sequence terminated + w.ansi = false + + if bytes.HasSuffix(w.ansiseq.Bytes(), []byte("[0m")) { + // reset sequence + w.lastseq.Reset() + w.seqchanged = false + } else if c == 'm' { + // color code + _, _ = w.lastseq.Write(w.ansiseq.Bytes()) + } + + _, _ = w.ansiseq.WriteTo(w.Forward) + } + } else { + _, err := w.writeRune(c) + if err != nil { + return 0, err + } + } + } + + return len(b), nil +} + +func (w *Writer) writeRune(r rune) (int, error) { + if w.runeBuf == nil { + w.runeBuf = make([]byte, utf8.UTFMax) + } + n := utf8.EncodeRune(w.runeBuf, r) + return w.Forward.Write(w.runeBuf[:n]) +} + +func (w *Writer) LastSequence() string { + return w.lastseq.String() +} + +func (w *Writer) ResetAnsi() { + if !w.seqchanged { + return + } + _, _ = w.Forward.Write([]byte("\x1b[0m")) +} + +func (w *Writer) RestoreAnsi() { + _, _ = w.Forward.Write(w.lastseq.Bytes()) +} diff --git a/vendor/github.com/muesli/reflow/wrap/wrap.go b/vendor/github.com/muesli/reflow/wrap/wrap.go new file mode 100644 index 000000000..f624c5f40 --- /dev/null +++ b/vendor/github.com/muesli/reflow/wrap/wrap.go @@ -0,0 +1,134 @@ +package wrap + +import ( + "bytes" + "strings" + "unicode" + + "github.com/mattn/go-runewidth" + "github.com/muesli/reflow/ansi" +) + +var ( + defaultNewline = []rune{'\n'} + defaultTabWidth = 4 +) + +type Wrap struct { + Limit int + Newline []rune + KeepNewlines bool + PreserveSpace bool + TabWidth int + + buf *bytes.Buffer + lineLen int + ansi bool + forcefulNewline bool +} + +// NewWriter returns a new instance of a wrapping writer, initialized with +// default settings. +func NewWriter(limit int) *Wrap { + return &Wrap{ + Limit: limit, + Newline: defaultNewline, + KeepNewlines: true, + // Keep whitespaces following a forceful line break. If disabled, + // leading whitespaces in a line are only kept if the line break + // was not forceful, meaning a line break that was already present + // in the input + PreserveSpace: false, + TabWidth: defaultTabWidth, + + buf: &bytes.Buffer{}, + } +} + +// Bytes is shorthand for declaring a new default Wrap instance, +// used to immediately wrap a byte slice. +func Bytes(b []byte, limit int) []byte { + f := NewWriter(limit) + _, _ = f.Write(b) + + return f.buf.Bytes() +} + +func (w *Wrap) addNewLine() { + _, _ = w.buf.WriteRune('\n') + w.lineLen = 0 +} + +// String is shorthand for declaring a new default Wrap instance, +// used to immediately wrap a string. +func String(s string, limit int) string { + return string(Bytes([]byte(s), limit)) +} + +func (w *Wrap) Write(b []byte) (int, error) { + s := strings.Replace(string(b), "\t", strings.Repeat(" ", w.TabWidth), -1) + if !w.KeepNewlines { + s = strings.Replace(s, "\n", "", -1) + } + + width := ansi.PrintableRuneWidth(s) + + if w.Limit <= 0 || w.lineLen+width <= w.Limit { + w.lineLen += width + return w.buf.Write(b) + } + + for _, c := range s { + if c == ansi.Marker { + w.ansi = true + } else if w.ansi { + if ansi.IsTerminator(c) { + w.ansi = false + } + } else if inGroup(w.Newline, c) { + w.addNewLine() + w.forcefulNewline = false + continue + } else { + width := runewidth.RuneWidth(c) + + if w.lineLen+width > w.Limit { + w.addNewLine() + w.forcefulNewline = true + } + + if w.lineLen == 0 { + if w.forcefulNewline && !w.PreserveSpace && unicode.IsSpace(c) { + continue + } + } else { + w.forcefulNewline = false + } + + w.lineLen += width + } + + _, _ = w.buf.WriteRune(c) + } + + return len(b), nil +} + +// Bytes returns the wrapped result as a byte slice. +func (w *Wrap) Bytes() []byte { + return w.buf.Bytes() +} + +// String returns the wrapped result as a string. +func (w *Wrap) String() string { + return w.buf.String() +} + +func inGroup(a []rune, c rune) bool { + for _, v := range a { + if v == c { + return true + } + } + return false +} diff --git a/vendor/github.com/rivo/uniseg/LICENSE.txt b/vendor/github.com/rivo/uniseg/LICENSE.txt new file mode 100644 index 000000000..5040f1ef8 --- /dev/null +++ b/vendor/github.com/rivo/uniseg/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Oliver Kuederle + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/rivo/uniseg/README.md b/vendor/github.com/rivo/uniseg/README.md new file mode 100644 index 000000000..f8da293e1 --- /dev/null +++ b/vendor/github.com/rivo/uniseg/README.md @@ -0,0 +1,62 @@ +# Unicode Text Segmentation for Go + +[![Godoc Reference](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/rivo/uniseg) +[![Go Report](https://img.shields.io/badge/go%20report-A%2B-brightgreen.svg)](https://goreportcard.com/report/github.com/rivo/uniseg) + +This Go package implements Unicode Text Segmentation according to [Unicode Standard Annex #29](http://unicode.org/reports/tr29/) (Unicode version 12.0.0). + +At this point, only the determination of grapheme cluster boundaries is implemented. + +## Background + +In Go, [strings are read-only slices of bytes](https://blog.golang.org/strings). They can be turned into Unicode code points using the `for` loop or by casting: `[]rune(str)`. However, multiple code points may be combined into one user-perceived character or what the Unicode specification calls "grapheme cluster". Here are some examples: + +|String|Bytes (UTF-8)|Code points (runes)|Grapheme clusters| +|-|-|-|-| +|Käse|6 bytes: `4b 61 cc 88 73 65`|5 code points: `4b 61 308 73 65`|4 clusters: `[4b],[61 308],[73],[65]`| +|🏳️‍🌈|14 bytes: `f0 9f 8f b3 ef b8 8f e2 80 8d f0 9f 8c 88`|4 code points: `1f3f3 fe0f 200d 1f308`|1 cluster: `[1f3f3 fe0f 200d 1f308]`| +|🇩🇪|8 bytes: `f0 9f 87 a9 f0 9f 87 aa`|2 code points: `1f1e9 1f1ea`|1 cluster: `[1f1e9 1f1ea]`| + +This package provides a tool to iterate over these grapheme clusters. This may be used to determine the number of user-perceived characters, to split strings in their intended places, or to extract individual characters which form a unit. + +## Installation + +```bash +go get github.com/rivo/uniseg +``` + +## Basic Example + +```go +package uniseg + +import ( + "fmt" + + "github.com/rivo/uniseg" +) + +func main() { + gr := uniseg.NewGraphemes("👍🏼!") + for gr.Next() { + fmt.Printf("%x ", gr.Runes()) + } + // Output: [1f44d 1f3fc] [21] +} +``` + +## Documentation + +Refer to https://godoc.org/github.com/rivo/uniseg for the package's documentation. + +## Dependencies + +This package does not depend on any packages outside the standard library. + +## Your Feedback + +Add your issue here on GitHub. Feel free to get in touch if you have any questions. + +## Version + +Version tags will be introduced once Golang modules are official. Consider this version 0.1. diff --git a/vendor/github.com/rivo/uniseg/doc.go b/vendor/github.com/rivo/uniseg/doc.go new file mode 100644 index 000000000..60c737d7b --- /dev/null +++ b/vendor/github.com/rivo/uniseg/doc.go @@ -0,0 +1,8 @@ +/* +Package uniseg implements Unicode Text Segmentation according to Unicode +Standard Annex #29 (http://unicode.org/reports/tr29/). + +At this point, only the determination of grapheme cluster boundaries is +implemented. +*/ +package uniseg diff --git a/vendor/github.com/rivo/uniseg/grapheme.go b/vendor/github.com/rivo/uniseg/grapheme.go new file mode 100644 index 000000000..207157f5e --- /dev/null +++ b/vendor/github.com/rivo/uniseg/grapheme.go @@ -0,0 +1,268 @@ +package uniseg + +import "unicode/utf8" + +// The states of the grapheme cluster parser. +const ( + grAny = iota + grCR + grControlLF + grL + grLVV + grLVTT + grPrepend + grExtendedPictographic + grExtendedPictographicZWJ + grRIOdd + grRIEven +) + +// The grapheme cluster parser's breaking instructions. +const ( + grNoBoundary = iota + grBoundary +) + +// The grapheme cluster parser's state transitions. Maps (state, property) to +// (new state, breaking instruction, rule number). The breaking instruction +// always refers to the boundary between the last and next code point. +// +// This map is queried as follows: +// +// 1. Find specific state + specific property. Stop if found. +// 2. Find specific state + any property. +// 3. Find any state + specific property. +// 4. If only (2) or (3) (but not both) was found, stop. +// 5. If both (2) and (3) were found, use state and breaking instruction from +// the transition with the lower rule number, prefer (3) if rule numbers +// are equal. Stop. +// 6. Assume grAny and grBoundary. +var grTransitions = map[[2]int][3]int{ + // GB5 + {grAny, prCR}: {grCR, grBoundary, 50}, + {grAny, prLF}: {grControlLF, grBoundary, 50}, + {grAny, prControl}: {grControlLF, grBoundary, 50}, + + // GB4 + {grCR, prAny}: {grAny, grBoundary, 40}, + {grControlLF, prAny}: {grAny, grBoundary, 40}, + + // GB3. + {grCR, prLF}: {grAny, grNoBoundary, 30}, + + // GB6. + {grAny, prL}: {grL, grBoundary, 9990}, + {grL, prL}: {grL, grNoBoundary, 60}, + {grL, prV}: {grLVV, grNoBoundary, 60}, + {grL, prLV}: {grLVV, grNoBoundary, 60}, + {grL, prLVT}: {grLVTT, grNoBoundary, 60}, + + // GB7. + {grAny, prLV}: {grLVV, grBoundary, 9990}, + {grAny, prV}: {grLVV, grBoundary, 9990}, + {grLVV, prV}: {grLVV, grNoBoundary, 70}, + {grLVV, prT}: {grLVTT, grNoBoundary, 70}, + + // GB8. + {grAny, prLVT}: {grLVTT, grBoundary, 9990}, + {grAny, prT}: {grLVTT, grBoundary, 9990}, + {grLVTT, prT}: {grLVTT, grNoBoundary, 80}, + + // GB9. + {grAny, prExtend}: {grAny, grNoBoundary, 90}, + {grAny, prZWJ}: {grAny, grNoBoundary, 90}, + + // GB9a. + {grAny, prSpacingMark}: {grAny, grNoBoundary, 91}, + + // GB9b. + {grAny, prPreprend}: {grPrepend, grBoundary, 9990}, + {grPrepend, prAny}: {grAny, grNoBoundary, 92}, + + // GB11. + {grAny, prExtendedPictographic}: {grExtendedPictographic, grBoundary, 9990}, + {grExtendedPictographic, prExtend}: {grExtendedPictographic, grNoBoundary, 110}, + {grExtendedPictographic, prZWJ}: {grExtendedPictographicZWJ, grNoBoundary, 110}, + {grExtendedPictographicZWJ, prExtendedPictographic}: {grExtendedPictographic, grNoBoundary, 110}, + + // GB12 / GB13. + {grAny, prRegionalIndicator}: {grRIOdd, grBoundary, 9990}, + {grRIOdd, prRegionalIndicator}: {grRIEven, grNoBoundary, 120}, + {grRIEven, prRegionalIndicator}: {grRIOdd, grBoundary, 120}, +} + +// Graphemes implements an iterator over Unicode extended grapheme clusters, +// specified in the Unicode Standard Annex #29. Grapheme clusters correspond to +// "user-perceived characters". These characters often consist of multiple +// code points (e.g. the "woman kissing woman" emoji consists of 8 code points: +// woman + ZWJ + heavy black heart (2 code points) + ZWJ + kiss mark + ZWJ + +// woman) and the rules described in Annex #29 must be applied to group those +// code points into clusters perceived by the user as one character. +type Graphemes struct { + // The code points over which this class iterates. + codePoints []rune + + // The (byte-based) indices of the code points into the original string plus + // len(original string). Thus, len(indices) = len(codePoints) + 1. + indices []int + + // The current grapheme cluster to be returned. These are indices into + // codePoints/indices. If start == end, we either haven't started iterating + // yet (0) or the iteration has already completed (1). + start, end int + + // The index of the next code point to be parsed. + pos int + + // The current state of the code point parser. + state int +} + +// NewGraphemes returns a new grapheme cluster iterator. +func NewGraphemes(s string) *Graphemes { + l := utf8.RuneCountInString(s) + codePoints := make([]rune, l) + indices := make([]int, l+1) + i := 0 + for pos, r := range s { + codePoints[i] = r + indices[i] = pos + i++ + } + indices[l] = len(s) + g := &Graphemes{ + codePoints: codePoints, + indices: indices, + } + g.Next() // Parse ahead. + return g +} + +// Next advances the iterator by one grapheme cluster and returns false if no +// clusters are left. This function must be called before the first cluster is +// accessed. +func (g *Graphemes) Next() bool { + g.start = g.end + + // The state transition gives us a boundary instruction BEFORE the next code + // point so we always need to stay ahead by one code point. + + // Parse the next code point. + for g.pos <= len(g.codePoints) { + // GB2. + if g.pos == len(g.codePoints) { + g.end = g.pos + g.pos++ + break + } + + // Determine the property of the next character. + nextProperty := property(g.codePoints[g.pos]) + g.pos++ + + // Find the applicable transition. + var boundary bool + transition, ok := grTransitions[[2]int{g.state, nextProperty}] + if ok { + // We have a specific transition. We'll use it. + g.state = transition[0] + boundary = transition[1] == grBoundary + } else { + // No specific transition found. Try the less specific ones. + transAnyProp, okAnyProp := grTransitions[[2]int{g.state, prAny}] + transAnyState, okAnyState := grTransitions[[2]int{grAny, nextProperty}] + if okAnyProp && okAnyState { + // Both apply. We'll use a mix (see comments for grTransitions). + g.state = transAnyState[0] + boundary = transAnyState[1] == grBoundary + if transAnyProp[2] < transAnyState[2] { + g.state = transAnyProp[0] + boundary = transAnyProp[1] == grBoundary + } + } else if okAnyProp { + // We only have a specific state. + g.state = transAnyProp[0] + boundary = transAnyProp[1] == grBoundary + // This branch will probably never be reached because okAnyState will + // always be true given the current transition map. But we keep it here + // for future modifications to the transition map where this may not be + // true anymore. + } else if okAnyState { + // We only have a specific property. + g.state = transAnyState[0] + boundary = transAnyState[1] == grBoundary + } else { + // No known transition. GB999: Any x Any. + g.state = grAny + boundary = true + } + } + + // If we found a cluster boundary, let's stop here. The current cluster will + // be the one that just ended. + if g.pos-1 == 0 /* GB1 */ || boundary { + g.end = g.pos - 1 + break + } + } + + return g.start != g.end +} + +// Runes returns a slice of runes (code points) which corresponds to the current +// grapheme cluster. If the iterator is already past the end or Next() has not +// yet been called, nil is returned. +func (g *Graphemes) Runes() []rune { + if g.start == g.end { + return nil + } + return g.codePoints[g.start:g.end] +} + +// Str returns a substring of the original string which corresponds to the +// current grapheme cluster. If the iterator is already past the end or Next() +// has not yet been called, an empty string is returned. +func (g *Graphemes) Str() string { + if g.start == g.end { + return "" + } + return string(g.codePoints[g.start:g.end]) +} + +// Bytes returns a byte slice which corresponds to the current grapheme cluster. +// If the iterator is already past the end or Next() has not yet been called, +// nil is returned. +func (g *Graphemes) Bytes() []byte { + if g.start == g.end { + return nil + } + return []byte(string(g.codePoints[g.start:g.end])) +} + +// Positions returns the interval of the current grapheme cluster as byte +// positions into the original string. The first returned value "from" indexes +// the first byte and the second returned value "to" indexes the first byte that +// is not included anymore, i.e. str[from:to] is the current grapheme cluster of +// the original string "str". If Next() has not yet been called, both values are +// 0. If the iterator is already past the end, both values are 1. +func (g *Graphemes) Positions() (int, int) { + return g.indices[g.start], g.indices[g.end] +} + +// Reset puts the iterator into its initial state such that the next call to +// Next() sets it to the first grapheme cluster again. +func (g *Graphemes) Reset() { + g.start, g.end, g.pos, g.state = 0, 0, 0, grAny + g.Next() // Parse ahead again. +} + +// GraphemeClusterCount returns the number of user-perceived characters +// (grapheme clusters) for the given string. To calculate this number, it +// iterates through the string using the Graphemes iterator. +func GraphemeClusterCount(s string) (n int) { + g := NewGraphemes(s) + for g.Next() { + n++ + } + return +} diff --git a/vendor/github.com/rivo/uniseg/properties.go b/vendor/github.com/rivo/uniseg/properties.go new file mode 100644 index 000000000..a75ab5883 --- /dev/null +++ b/vendor/github.com/rivo/uniseg/properties.go @@ -0,0 +1,1658 @@ +package uniseg + +// The unicode properties. Only the ones needed in the context of this package +// are included. +const ( + prAny = iota + prPreprend + prCR + prLF + prControl + prExtend + prRegionalIndicator + prSpacingMark + prL + prV + prT + prLV + prLVT + prZWJ + prExtendedPictographic +) + +// Maps code point ranges to their properties. In the context of this package, +// any code point that is not contained may map to "prAny". The code point +// ranges in this slice are numerically sorted. +// +// These ranges were taken from +// http://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt +// as well as +// https://unicode.org/Public/emoji/latest/emoji-data.txt +// ("Extended_Pictographic" only) on March 11, 2019. See +// https://www.unicode.org/license.html for the Unicode license agreement. +var codePoints = [][3]int{ + {0x0000, 0x0009, prControl}, // Cc [10] .. + {0x000A, 0x000A, prLF}, // Cc + {0x000B, 0x000C, prControl}, // Cc [2] .. + {0x000D, 0x000D, prCR}, // Cc + {0x000E, 0x001F, prControl}, // Cc [18] .. + {0x007F, 0x009F, prControl}, // Cc [33] .. + {0x00A9, 0x00A9, prExtendedPictographic}, // 1.1 [1] (©️) copyright + {0x00AD, 0x00AD, prControl}, // Cf SOFT HYPHEN + {0x00AE, 0x00AE, prExtendedPictographic}, // 1.1 [1] (®️) registered + {0x0300, 0x036F, prExtend}, // Mn [112] COMBINING GRAVE ACCENT..COMBINING LATIN SMALL LETTER X + {0x0483, 0x0487, prExtend}, // Mn [5] COMBINING CYRILLIC TITLO..COMBINING CYRILLIC POKRYTIE + {0x0488, 0x0489, prExtend}, // Me [2] COMBINING CYRILLIC HUNDRED THOUSANDS SIGN..COMBINING CYRILLIC MILLIONS SIGN + {0x0591, 0x05BD, prExtend}, // Mn [45] HEBREW ACCENT ETNAHTA..HEBREW POINT METEG + {0x05BF, 0x05BF, prExtend}, // Mn HEBREW POINT RAFE + {0x05C1, 0x05C2, prExtend}, // Mn [2] HEBREW POINT SHIN DOT..HEBREW POINT SIN DOT + {0x05C4, 0x05C5, prExtend}, // Mn [2] HEBREW MARK UPPER DOT..HEBREW MARK LOWER DOT + {0x05C7, 0x05C7, prExtend}, // Mn HEBREW POINT QAMATS QATAN + {0x0600, 0x0605, prPreprend}, // Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER MARK ABOVE + {0x0610, 0x061A, prExtend}, // Mn [11] ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM..ARABIC SMALL KASRA + {0x061C, 0x061C, prControl}, // Cf ARABIC LETTER MARK + {0x064B, 0x065F, prExtend}, // Mn [21] ARABIC FATHATAN..ARABIC WAVY HAMZA BELOW + {0x0670, 0x0670, prExtend}, // Mn ARABIC LETTER SUPERSCRIPT ALEF + {0x06D6, 0x06DC, prExtend}, // Mn [7] ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA..ARABIC SMALL HIGH SEEN + {0x06DD, 0x06DD, prPreprend}, // Cf ARABIC END OF AYAH + {0x06DF, 0x06E4, prExtend}, // Mn [6] ARABIC SMALL HIGH ROUNDED ZERO..ARABIC SMALL HIGH MADDA + {0x06E7, 0x06E8, prExtend}, // Mn [2] ARABIC SMALL HIGH YEH..ARABIC SMALL HIGH NOON + {0x06EA, 0x06ED, prExtend}, // Mn [4] ARABIC EMPTY CENTRE LOW STOP..ARABIC SMALL LOW MEEM + {0x070F, 0x070F, prPreprend}, // Cf SYRIAC ABBREVIATION MARK + {0x0711, 0x0711, prExtend}, // Mn SYRIAC LETTER SUPERSCRIPT ALAPH + {0x0730, 0x074A, prExtend}, // Mn [27] SYRIAC PTHAHA ABOVE..SYRIAC BARREKH + {0x07A6, 0x07B0, prExtend}, // Mn [11] THAANA ABAFILI..THAANA SUKUN + {0x07EB, 0x07F3, prExtend}, // Mn [9] NKO COMBINING SHORT HIGH TONE..NKO COMBINING DOUBLE DOT ABOVE + {0x07FD, 0x07FD, prExtend}, // Mn NKO DANTAYALAN + {0x0816, 0x0819, prExtend}, // Mn [4] SAMARITAN MARK IN..SAMARITAN MARK DAGESH + {0x081B, 0x0823, prExtend}, // Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAMARITAN VOWEL SIGN A + {0x0825, 0x0827, prExtend}, // Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMARITAN VOWEL SIGN U + {0x0829, 0x082D, prExtend}, // Mn [5] SAMARITAN VOWEL SIGN LONG I..SAMARITAN MARK NEQUDAA + {0x0859, 0x085B, prExtend}, // Mn [3] MANDAIC AFFRICATION MARK..MANDAIC GEMINATION MARK + {0x08D3, 0x08E1, prExtend}, // Mn [15] ARABIC SMALL LOW WAW..ARABIC SMALL HIGH SIGN SAFHA + {0x08E2, 0x08E2, prPreprend}, // Cf ARABIC DISPUTED END OF AYAH + {0x08E3, 0x0902, prExtend}, // Mn [32] ARABIC TURNED DAMMA BELOW..DEVANAGARI SIGN ANUSVARA + {0x0903, 0x0903, prSpacingMark}, // Mc DEVANAGARI SIGN VISARGA + {0x093A, 0x093A, prExtend}, // Mn DEVANAGARI VOWEL SIGN OE + {0x093B, 0x093B, prSpacingMark}, // Mc DEVANAGARI VOWEL SIGN OOE + {0x093C, 0x093C, prExtend}, // Mn DEVANAGARI SIGN NUKTA + {0x093E, 0x0940, prSpacingMark}, // Mc [3] DEVANAGARI VOWEL SIGN AA..DEVANAGARI VOWEL SIGN II + {0x0941, 0x0948, prExtend}, // Mn [8] DEVANAGARI VOWEL SIGN U..DEVANAGARI VOWEL SIGN AI + {0x0949, 0x094C, prSpacingMark}, // Mc [4] DEVANAGARI VOWEL SIGN CANDRA O..DEVANAGARI VOWEL SIGN AU + {0x094D, 0x094D, prExtend}, // Mn DEVANAGARI SIGN VIRAMA + {0x094E, 0x094F, prSpacingMark}, // Mc [2] DEVANAGARI VOWEL SIGN PRISHTHAMATRA E..DEVANAGARI VOWEL SIGN AW + {0x0951, 0x0957, prExtend}, // Mn [7] DEVANAGARI STRESS SIGN UDATTA..DEVANAGARI VOWEL SIGN UUE + {0x0962, 0x0963, prExtend}, // Mn [2] DEVANAGARI VOWEL SIGN VOCALIC L..DEVANAGARI VOWEL SIGN VOCALIC LL + {0x0981, 0x0981, prExtend}, // Mn BENGALI SIGN CANDRABINDU + {0x0982, 0x0983, prSpacingMark}, // Mc [2] BENGALI SIGN ANUSVARA..BENGALI SIGN VISARGA + {0x09BC, 0x09BC, prExtend}, // Mn BENGALI SIGN NUKTA + {0x09BE, 0x09BE, prExtend}, // Mc BENGALI VOWEL SIGN AA + {0x09BF, 0x09C0, prSpacingMark}, // Mc [2] BENGALI VOWEL SIGN I..BENGALI VOWEL SIGN II + {0x09C1, 0x09C4, prExtend}, // Mn [4] BENGALI VOWEL SIGN U..BENGALI VOWEL SIGN VOCALIC RR + {0x09C7, 0x09C8, prSpacingMark}, // Mc [2] BENGALI VOWEL SIGN E..BENGALI VOWEL SIGN AI + {0x09CB, 0x09CC, prSpacingMark}, // Mc [2] BENGALI VOWEL SIGN O..BENGALI VOWEL SIGN AU + {0x09CD, 0x09CD, prExtend}, // Mn BENGALI SIGN VIRAMA + {0x09D7, 0x09D7, prExtend}, // Mc BENGALI AU LENGTH MARK + {0x09E2, 0x09E3, prExtend}, // Mn [2] BENGALI VOWEL SIGN VOCALIC L..BENGALI VOWEL SIGN VOCALIC LL + {0x09FE, 0x09FE, prExtend}, // Mn BENGALI SANDHI MARK + {0x0A01, 0x0A02, prExtend}, // Mn [2] GURMUKHI SIGN ADAK BINDI..GURMUKHI SIGN BINDI + {0x0A03, 0x0A03, prSpacingMark}, // Mc GURMUKHI SIGN VISARGA + {0x0A3C, 0x0A3C, prExtend}, // Mn GURMUKHI SIGN NUKTA + {0x0A3E, 0x0A40, prSpacingMark}, // Mc [3] GURMUKHI VOWEL SIGN AA..GURMUKHI VOWEL SIGN II + {0x0A41, 0x0A42, prExtend}, // Mn [2] GURMUKHI VOWEL SIGN U..GURMUKHI VOWEL SIGN UU + {0x0A47, 0x0A48, prExtend}, // Mn [2] GURMUKHI VOWEL SIGN EE..GURMUKHI VOWEL SIGN AI + {0x0A4B, 0x0A4D, prExtend}, // Mn [3] GURMUKHI VOWEL SIGN OO..GURMUKHI SIGN VIRAMA + {0x0A51, 0x0A51, prExtend}, // Mn GURMUKHI SIGN UDAAT + {0x0A70, 0x0A71, prExtend}, // Mn [2] GURMUKHI TIPPI..GURMUKHI ADDAK + {0x0A75, 0x0A75, prExtend}, // Mn GURMUKHI SIGN YAKASH + {0x0A81, 0x0A82, prExtend}, // Mn [2] GUJARATI SIGN CANDRABINDU..GUJARATI SIGN ANUSVARA + {0x0A83, 0x0A83, prSpacingMark}, // Mc GUJARATI SIGN VISARGA + {0x0ABC, 0x0ABC, prExtend}, // Mn GUJARATI SIGN NUKTA + {0x0ABE, 0x0AC0, prSpacingMark}, // Mc [3] GUJARATI VOWEL SIGN AA..GUJARATI VOWEL SIGN II + {0x0AC1, 0x0AC5, prExtend}, // Mn [5] GUJARATI VOWEL SIGN U..GUJARATI VOWEL SIGN CANDRA E + {0x0AC7, 0x0AC8, prExtend}, // Mn [2] GUJARATI VOWEL SIGN E..GUJARATI VOWEL SIGN AI + {0x0AC9, 0x0AC9, prSpacingMark}, // Mc GUJARATI VOWEL SIGN CANDRA O + {0x0ACB, 0x0ACC, prSpacingMark}, // Mc [2] GUJARATI VOWEL SIGN O..GUJARATI VOWEL SIGN AU + {0x0ACD, 0x0ACD, prExtend}, // Mn GUJARATI SIGN VIRAMA + {0x0AE2, 0x0AE3, prExtend}, // Mn [2] GUJARATI VOWEL SIGN VOCALIC L..GUJARATI VOWEL SIGN VOCALIC LL + {0x0AFA, 0x0AFF, prExtend}, // Mn [6] GUJARATI SIGN SUKUN..GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE + {0x0B01, 0x0B01, prExtend}, // Mn ORIYA SIGN CANDRABINDU + {0x0B02, 0x0B03, prSpacingMark}, // Mc [2] ORIYA SIGN ANUSVARA..ORIYA SIGN VISARGA + {0x0B3C, 0x0B3C, prExtend}, // Mn ORIYA SIGN NUKTA + {0x0B3E, 0x0B3E, prExtend}, // Mc ORIYA VOWEL SIGN AA + {0x0B3F, 0x0B3F, prExtend}, // Mn ORIYA VOWEL SIGN I + {0x0B40, 0x0B40, prSpacingMark}, // Mc ORIYA VOWEL SIGN II + {0x0B41, 0x0B44, prExtend}, // Mn [4] ORIYA VOWEL SIGN U..ORIYA VOWEL SIGN VOCALIC RR + {0x0B47, 0x0B48, prSpacingMark}, // Mc [2] ORIYA VOWEL SIGN E..ORIYA VOWEL SIGN AI + {0x0B4B, 0x0B4C, prSpacingMark}, // Mc [2] ORIYA VOWEL SIGN O..ORIYA VOWEL SIGN AU + {0x0B4D, 0x0B4D, prExtend}, // Mn ORIYA SIGN VIRAMA + {0x0B56, 0x0B56, prExtend}, // Mn ORIYA AI LENGTH MARK + {0x0B57, 0x0B57, prExtend}, // Mc ORIYA AU LENGTH MARK + {0x0B62, 0x0B63, prExtend}, // Mn [2] ORIYA VOWEL SIGN VOCALIC L..ORIYA VOWEL SIGN VOCALIC LL + {0x0B82, 0x0B82, prExtend}, // Mn TAMIL SIGN ANUSVARA + {0x0BBE, 0x0BBE, prExtend}, // Mc TAMIL VOWEL SIGN AA + {0x0BBF, 0x0BBF, prSpacingMark}, // Mc TAMIL VOWEL SIGN I + {0x0BC0, 0x0BC0, prExtend}, // Mn TAMIL VOWEL SIGN II + {0x0BC1, 0x0BC2, prSpacingMark}, // Mc [2] TAMIL VOWEL SIGN U..TAMIL VOWEL SIGN UU + {0x0BC6, 0x0BC8, prSpacingMark}, // Mc [3] TAMIL VOWEL SIGN E..TAMIL VOWEL SIGN AI + {0x0BCA, 0x0BCC, prSpacingMark}, // Mc [3] TAMIL VOWEL SIGN O..TAMIL VOWEL SIGN AU + {0x0BCD, 0x0BCD, prExtend}, // Mn TAMIL SIGN VIRAMA + {0x0BD7, 0x0BD7, prExtend}, // Mc TAMIL AU LENGTH MARK + {0x0C00, 0x0C00, prExtend}, // Mn TELUGU SIGN COMBINING CANDRABINDU ABOVE + {0x0C01, 0x0C03, prSpacingMark}, // Mc [3] TELUGU SIGN CANDRABINDU..TELUGU SIGN VISARGA + {0x0C04, 0x0C04, prExtend}, // Mn TELUGU SIGN COMBINING ANUSVARA ABOVE + {0x0C3E, 0x0C40, prExtend}, // Mn [3] TELUGU VOWEL SIGN AA..TELUGU VOWEL SIGN II + {0x0C41, 0x0C44, prSpacingMark}, // Mc [4] TELUGU VOWEL SIGN U..TELUGU VOWEL SIGN VOCALIC RR + {0x0C46, 0x0C48, prExtend}, // Mn [3] TELUGU VOWEL SIGN E..TELUGU VOWEL SIGN AI + {0x0C4A, 0x0C4D, prExtend}, // Mn [4] TELUGU VOWEL SIGN O..TELUGU SIGN VIRAMA + {0x0C55, 0x0C56, prExtend}, // Mn [2] TELUGU LENGTH MARK..TELUGU AI LENGTH MARK + {0x0C62, 0x0C63, prExtend}, // Mn [2] TELUGU VOWEL SIGN VOCALIC L..TELUGU VOWEL SIGN VOCALIC LL + {0x0C81, 0x0C81, prExtend}, // Mn KANNADA SIGN CANDRABINDU + {0x0C82, 0x0C83, prSpacingMark}, // Mc [2] KANNADA SIGN ANUSVARA..KANNADA SIGN VISARGA + {0x0CBC, 0x0CBC, prExtend}, // Mn KANNADA SIGN NUKTA + {0x0CBE, 0x0CBE, prSpacingMark}, // Mc KANNADA VOWEL SIGN AA + {0x0CBF, 0x0CBF, prExtend}, // Mn KANNADA VOWEL SIGN I + {0x0CC0, 0x0CC1, prSpacingMark}, // Mc [2] KANNADA VOWEL SIGN II..KANNADA VOWEL SIGN U + {0x0CC2, 0x0CC2, prExtend}, // Mc KANNADA VOWEL SIGN UU + {0x0CC3, 0x0CC4, prSpacingMark}, // Mc [2] KANNADA VOWEL SIGN VOCALIC R..KANNADA VOWEL SIGN VOCALIC RR + {0x0CC6, 0x0CC6, prExtend}, // Mn KANNADA VOWEL SIGN E + {0x0CC7, 0x0CC8, prSpacingMark}, // Mc [2] KANNADA VOWEL SIGN EE..KANNADA VOWEL SIGN AI + {0x0CCA, 0x0CCB, prSpacingMark}, // Mc [2] KANNADA VOWEL SIGN O..KANNADA VOWEL SIGN OO + {0x0CCC, 0x0CCD, prExtend}, // Mn [2] KANNADA VOWEL SIGN AU..KANNADA SIGN VIRAMA + {0x0CD5, 0x0CD6, prExtend}, // Mc [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK + {0x0CE2, 0x0CE3, prExtend}, // Mn [2] KANNADA VOWEL SIGN VOCALIC L..KANNADA VOWEL SIGN VOCALIC LL + {0x0D00, 0x0D01, prExtend}, // Mn [2] MALAYALAM SIGN COMBINING ANUSVARA ABOVE..MALAYALAM SIGN CANDRABINDU + {0x0D02, 0x0D03, prSpacingMark}, // Mc [2] MALAYALAM SIGN ANUSVARA..MALAYALAM SIGN VISARGA + {0x0D3B, 0x0D3C, prExtend}, // Mn [2] MALAYALAM SIGN VERTICAL BAR VIRAMA..MALAYALAM SIGN CIRCULAR VIRAMA + {0x0D3E, 0x0D3E, prExtend}, // Mc MALAYALAM VOWEL SIGN AA + {0x0D3F, 0x0D40, prSpacingMark}, // Mc [2] MALAYALAM VOWEL SIGN I..MALAYALAM VOWEL SIGN II + {0x0D41, 0x0D44, prExtend}, // Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM VOWEL SIGN VOCALIC RR + {0x0D46, 0x0D48, prSpacingMark}, // Mc [3] MALAYALAM VOWEL SIGN E..MALAYALAM VOWEL SIGN AI + {0x0D4A, 0x0D4C, prSpacingMark}, // Mc [3] MALAYALAM VOWEL SIGN O..MALAYALAM VOWEL SIGN AU + {0x0D4D, 0x0D4D, prExtend}, // Mn MALAYALAM SIGN VIRAMA + {0x0D4E, 0x0D4E, prPreprend}, // Lo MALAYALAM LETTER DOT REPH + {0x0D57, 0x0D57, prExtend}, // Mc MALAYALAM AU LENGTH MARK + {0x0D62, 0x0D63, prExtend}, // Mn [2] MALAYALAM VOWEL SIGN VOCALIC L..MALAYALAM VOWEL SIGN VOCALIC LL + {0x0D82, 0x0D83, prSpacingMark}, // Mc [2] SINHALA SIGN ANUSVARAYA..SINHALA SIGN VISARGAYA + {0x0DCA, 0x0DCA, prExtend}, // Mn SINHALA SIGN AL-LAKUNA + {0x0DCF, 0x0DCF, prExtend}, // Mc SINHALA VOWEL SIGN AELA-PILLA + {0x0DD0, 0x0DD1, prSpacingMark}, // Mc [2] SINHALA VOWEL SIGN KETTI AEDA-PILLA..SINHALA VOWEL SIGN DIGA AEDA-PILLA + {0x0DD2, 0x0DD4, prExtend}, // Mn [3] SINHALA VOWEL SIGN KETTI IS-PILLA..SINHALA VOWEL SIGN KETTI PAA-PILLA + {0x0DD6, 0x0DD6, prExtend}, // Mn SINHALA VOWEL SIGN DIGA PAA-PILLA + {0x0DD8, 0x0DDE, prSpacingMark}, // Mc [7] SINHALA VOWEL SIGN GAETTA-PILLA..SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA + {0x0DDF, 0x0DDF, prExtend}, // Mc SINHALA VOWEL SIGN GAYANUKITTA + {0x0DF2, 0x0DF3, prSpacingMark}, // Mc [2] SINHALA VOWEL SIGN DIGA GAETTA-PILLA..SINHALA VOWEL SIGN DIGA GAYANUKITTA + {0x0E31, 0x0E31, prExtend}, // Mn THAI CHARACTER MAI HAN-AKAT + {0x0E33, 0x0E33, prSpacingMark}, // Lo THAI CHARACTER SARA AM + {0x0E34, 0x0E3A, prExtend}, // Mn [7] THAI CHARACTER SARA I..THAI CHARACTER PHINTHU + {0x0E47, 0x0E4E, prExtend}, // Mn [8] THAI CHARACTER MAITAIKHU..THAI CHARACTER YAMAKKAN + {0x0EB1, 0x0EB1, prExtend}, // Mn LAO VOWEL SIGN MAI KAN + {0x0EB3, 0x0EB3, prSpacingMark}, // Lo LAO VOWEL SIGN AM + {0x0EB4, 0x0EBC, prExtend}, // Mn [9] LAO VOWEL SIGN I..LAO SEMIVOWEL SIGN LO + {0x0EC8, 0x0ECD, prExtend}, // Mn [6] LAO TONE MAI EK..LAO NIGGAHITA + {0x0F18, 0x0F19, prExtend}, // Mn [2] TIBETAN ASTROLOGICAL SIGN -KHYUD PA..TIBETAN ASTROLOGICAL SIGN SDONG TSHUGS + {0x0F35, 0x0F35, prExtend}, // Mn TIBETAN MARK NGAS BZUNG NYI ZLA + {0x0F37, 0x0F37, prExtend}, // Mn TIBETAN MARK NGAS BZUNG SGOR RTAGS + {0x0F39, 0x0F39, prExtend}, // Mn TIBETAN MARK TSA -PHRU + {0x0F3E, 0x0F3F, prSpacingMark}, // Mc [2] TIBETAN SIGN YAR TSHES..TIBETAN SIGN MAR TSHES + {0x0F71, 0x0F7E, prExtend}, // Mn [14] TIBETAN VOWEL SIGN AA..TIBETAN SIGN RJES SU NGA RO + {0x0F7F, 0x0F7F, prSpacingMark}, // Mc TIBETAN SIGN RNAM BCAD + {0x0F80, 0x0F84, prExtend}, // Mn [5] TIBETAN VOWEL SIGN REVERSED I..TIBETAN MARK HALANTA + {0x0F86, 0x0F87, prExtend}, // Mn [2] TIBETAN SIGN LCI RTAGS..TIBETAN SIGN YANG RTAGS + {0x0F8D, 0x0F97, prExtend}, // Mn [11] TIBETAN SUBJOINED SIGN LCE TSA CAN..TIBETAN SUBJOINED LETTER JA + {0x0F99, 0x0FBC, prExtend}, // Mn [36] TIBETAN SUBJOINED LETTER NYA..TIBETAN SUBJOINED LETTER FIXED-FORM RA + {0x0FC6, 0x0FC6, prExtend}, // Mn TIBETAN SYMBOL PADMA GDAN + {0x102D, 0x1030, prExtend}, // Mn [4] MYANMAR VOWEL SIGN I..MYANMAR VOWEL SIGN UU + {0x1031, 0x1031, prSpacingMark}, // Mc MYANMAR VOWEL SIGN E + {0x1032, 0x1037, prExtend}, // Mn [6] MYANMAR VOWEL SIGN AI..MYANMAR SIGN DOT BELOW + {0x1039, 0x103A, prExtend}, // Mn [2] MYANMAR SIGN VIRAMA..MYANMAR SIGN ASAT + {0x103B, 0x103C, prSpacingMark}, // Mc [2] MYANMAR CONSONANT SIGN MEDIAL YA..MYANMAR CONSONANT SIGN MEDIAL RA + {0x103D, 0x103E, prExtend}, // Mn [2] MYANMAR CONSONANT SIGN MEDIAL WA..MYANMAR CONSONANT SIGN MEDIAL HA + {0x1056, 0x1057, prSpacingMark}, // Mc [2] MYANMAR VOWEL SIGN VOCALIC R..MYANMAR VOWEL SIGN VOCALIC RR + {0x1058, 0x1059, prExtend}, // Mn [2] MYANMAR VOWEL SIGN VOCALIC L..MYANMAR VOWEL SIGN VOCALIC LL + {0x105E, 0x1060, prExtend}, // Mn [3] MYANMAR CONSONANT SIGN MON MEDIAL NA..MYANMAR CONSONANT SIGN MON MEDIAL LA + {0x1071, 0x1074, prExtend}, // Mn [4] MYANMAR VOWEL SIGN GEBA KAREN I..MYANMAR VOWEL SIGN KAYAH EE + {0x1082, 0x1082, prExtend}, // Mn MYANMAR CONSONANT SIGN SHAN MEDIAL WA + {0x1084, 0x1084, prSpacingMark}, // Mc MYANMAR VOWEL SIGN SHAN E + {0x1085, 0x1086, prExtend}, // Mn [2] MYANMAR VOWEL SIGN SHAN E ABOVE..MYANMAR VOWEL SIGN SHAN FINAL Y + {0x108D, 0x108D, prExtend}, // Mn MYANMAR SIGN SHAN COUNCIL EMPHATIC TONE + {0x109D, 0x109D, prExtend}, // Mn MYANMAR VOWEL SIGN AITON AI + {0x1100, 0x115F, prL}, // Lo [96] HANGUL CHOSEONG KIYEOK..HANGUL CHOSEONG FILLER + {0x1160, 0x11A7, prV}, // Lo [72] HANGUL JUNGSEONG FILLER..HANGUL JUNGSEONG O-YAE + {0x11A8, 0x11FF, prT}, // Lo [88] HANGUL JONGSEONG KIYEOK..HANGUL JONGSEONG SSANGNIEUN + {0x135D, 0x135F, prExtend}, // Mn [3] ETHIOPIC COMBINING GEMINATION AND VOWEL LENGTH MARK..ETHIOPIC COMBINING GEMINATION MARK + {0x1712, 0x1714, prExtend}, // Mn [3] TAGALOG VOWEL SIGN I..TAGALOG SIGN VIRAMA + {0x1732, 0x1734, prExtend}, // Mn [3] HANUNOO VOWEL SIGN I..HANUNOO SIGN PAMUDPOD + {0x1752, 0x1753, prExtend}, // Mn [2] BUHID VOWEL SIGN I..BUHID VOWEL SIGN U + {0x1772, 0x1773, prExtend}, // Mn [2] TAGBANWA VOWEL SIGN I..TAGBANWA VOWEL SIGN U + {0x17B4, 0x17B5, prExtend}, // Mn [2] KHMER VOWEL INHERENT AQ..KHMER VOWEL INHERENT AA + {0x17B6, 0x17B6, prSpacingMark}, // Mc KHMER VOWEL SIGN AA + {0x17B7, 0x17BD, prExtend}, // Mn [7] KHMER VOWEL SIGN I..KHMER VOWEL SIGN UA + {0x17BE, 0x17C5, prSpacingMark}, // Mc [8] KHMER VOWEL SIGN OE..KHMER VOWEL SIGN AU + {0x17C6, 0x17C6, prExtend}, // Mn KHMER SIGN NIKAHIT + {0x17C7, 0x17C8, prSpacingMark}, // Mc [2] KHMER SIGN REAHMUK..KHMER SIGN YUUKALEAPINTU + {0x17C9, 0x17D3, prExtend}, // Mn [11] KHMER SIGN MUUSIKATOAN..KHMER SIGN BATHAMASAT + {0x17DD, 0x17DD, prExtend}, // Mn KHMER SIGN ATTHACAN + {0x180B, 0x180D, prExtend}, // Mn [3] MONGOLIAN FREE VARIATION SELECTOR ONE..MONGOLIAN FREE VARIATION SELECTOR THREE + {0x180E, 0x180E, prControl}, // Cf MONGOLIAN VOWEL SEPARATOR + {0x1885, 0x1886, prExtend}, // Mn [2] MONGOLIAN LETTER ALI GALI BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA + {0x18A9, 0x18A9, prExtend}, // Mn MONGOLIAN LETTER ALI GALI DAGALGA + {0x1920, 0x1922, prExtend}, // Mn [3] LIMBU VOWEL SIGN A..LIMBU VOWEL SIGN U + {0x1923, 0x1926, prSpacingMark}, // Mc [4] LIMBU VOWEL SIGN EE..LIMBU VOWEL SIGN AU + {0x1927, 0x1928, prExtend}, // Mn [2] LIMBU VOWEL SIGN E..LIMBU VOWEL SIGN O + {0x1929, 0x192B, prSpacingMark}, // Mc [3] LIMBU SUBJOINED LETTER YA..LIMBU SUBJOINED LETTER WA + {0x1930, 0x1931, prSpacingMark}, // Mc [2] LIMBU SMALL LETTER KA..LIMBU SMALL LETTER NGA + {0x1932, 0x1932, prExtend}, // Mn LIMBU SMALL LETTER ANUSVARA + {0x1933, 0x1938, prSpacingMark}, // Mc [6] LIMBU SMALL LETTER TA..LIMBU SMALL LETTER LA + {0x1939, 0x193B, prExtend}, // Mn [3] LIMBU SIGN MUKPHRENG..LIMBU SIGN SA-I + {0x1A17, 0x1A18, prExtend}, // Mn [2] BUGINESE VOWEL SIGN I..BUGINESE VOWEL SIGN U + {0x1A19, 0x1A1A, prSpacingMark}, // Mc [2] BUGINESE VOWEL SIGN E..BUGINESE VOWEL SIGN O + {0x1A1B, 0x1A1B, prExtend}, // Mn BUGINESE VOWEL SIGN AE + {0x1A55, 0x1A55, prSpacingMark}, // Mc TAI THAM CONSONANT SIGN MEDIAL RA + {0x1A56, 0x1A56, prExtend}, // Mn TAI THAM CONSONANT SIGN MEDIAL LA + {0x1A57, 0x1A57, prSpacingMark}, // Mc TAI THAM CONSONANT SIGN LA TANG LAI + {0x1A58, 0x1A5E, prExtend}, // Mn [7] TAI THAM SIGN MAI KANG LAI..TAI THAM CONSONANT SIGN SA + {0x1A60, 0x1A60, prExtend}, // Mn TAI THAM SIGN SAKOT + {0x1A62, 0x1A62, prExtend}, // Mn TAI THAM VOWEL SIGN MAI SAT + {0x1A65, 0x1A6C, prExtend}, // Mn [8] TAI THAM VOWEL SIGN I..TAI THAM VOWEL SIGN OA BELOW + {0x1A6D, 0x1A72, prSpacingMark}, // Mc [6] TAI THAM VOWEL SIGN OY..TAI THAM VOWEL SIGN THAM AI + {0x1A73, 0x1A7C, prExtend}, // Mn [10] TAI THAM VOWEL SIGN OA ABOVE..TAI THAM SIGN KHUEN-LUE KARAN + {0x1A7F, 0x1A7F, prExtend}, // Mn TAI THAM COMBINING CRYPTOGRAMMIC DOT + {0x1AB0, 0x1ABD, prExtend}, // Mn [14] COMBINING DOUBLED CIRCUMFLEX ACCENT..COMBINING PARENTHESES BELOW + {0x1ABE, 0x1ABE, prExtend}, // Me COMBINING PARENTHESES OVERLAY + {0x1B00, 0x1B03, prExtend}, // Mn [4] BALINESE SIGN ULU RICEM..BALINESE SIGN SURANG + {0x1B04, 0x1B04, prSpacingMark}, // Mc BALINESE SIGN BISAH + {0x1B34, 0x1B34, prExtend}, // Mn BALINESE SIGN REREKAN + {0x1B35, 0x1B35, prExtend}, // Mc BALINESE VOWEL SIGN TEDUNG + {0x1B36, 0x1B3A, prExtend}, // Mn [5] BALINESE VOWEL SIGN ULU..BALINESE VOWEL SIGN RA REPA + {0x1B3B, 0x1B3B, prSpacingMark}, // Mc BALINESE VOWEL SIGN RA REPA TEDUNG + {0x1B3C, 0x1B3C, prExtend}, // Mn BALINESE VOWEL SIGN LA LENGA + {0x1B3D, 0x1B41, prSpacingMark}, // Mc [5] BALINESE VOWEL SIGN LA LENGA TEDUNG..BALINESE VOWEL SIGN TALING REPA TEDUNG + {0x1B42, 0x1B42, prExtend}, // Mn BALINESE VOWEL SIGN PEPET + {0x1B43, 0x1B44, prSpacingMark}, // Mc [2] BALINESE VOWEL SIGN PEPET TEDUNG..BALINESE ADEG ADEG + {0x1B6B, 0x1B73, prExtend}, // Mn [9] BALINESE MUSICAL SYMBOL COMBINING TEGEH..BALINESE MUSICAL SYMBOL COMBINING GONG + {0x1B80, 0x1B81, prExtend}, // Mn [2] SUNDANESE SIGN PANYECEK..SUNDANESE SIGN PANGLAYAR + {0x1B82, 0x1B82, prSpacingMark}, // Mc SUNDANESE SIGN PANGWISAD + {0x1BA1, 0x1BA1, prSpacingMark}, // Mc SUNDANESE CONSONANT SIGN PAMINGKAL + {0x1BA2, 0x1BA5, prExtend}, // Mn [4] SUNDANESE CONSONANT SIGN PANYAKRA..SUNDANESE VOWEL SIGN PANYUKU + {0x1BA6, 0x1BA7, prSpacingMark}, // Mc [2] SUNDANESE VOWEL SIGN PANAELAENG..SUNDANESE VOWEL SIGN PANOLONG + {0x1BA8, 0x1BA9, prExtend}, // Mn [2] SUNDANESE VOWEL SIGN PAMEPET..SUNDANESE VOWEL SIGN PANEULEUNG + {0x1BAA, 0x1BAA, prSpacingMark}, // Mc SUNDANESE SIGN PAMAAEH + {0x1BAB, 0x1BAD, prExtend}, // Mn [3] SUNDANESE SIGN VIRAMA..SUNDANESE CONSONANT SIGN PASANGAN WA + {0x1BE6, 0x1BE6, prExtend}, // Mn BATAK SIGN TOMPI + {0x1BE7, 0x1BE7, prSpacingMark}, // Mc BATAK VOWEL SIGN E + {0x1BE8, 0x1BE9, prExtend}, // Mn [2] BATAK VOWEL SIGN PAKPAK E..BATAK VOWEL SIGN EE + {0x1BEA, 0x1BEC, prSpacingMark}, // Mc [3] BATAK VOWEL SIGN I..BATAK VOWEL SIGN O + {0x1BED, 0x1BED, prExtend}, // Mn BATAK VOWEL SIGN KARO O + {0x1BEE, 0x1BEE, prSpacingMark}, // Mc BATAK VOWEL SIGN U + {0x1BEF, 0x1BF1, prExtend}, // Mn [3] BATAK VOWEL SIGN U FOR SIMALUNGUN SA..BATAK CONSONANT SIGN H + {0x1BF2, 0x1BF3, prSpacingMark}, // Mc [2] BATAK PANGOLAT..BATAK PANONGONAN + {0x1C24, 0x1C2B, prSpacingMark}, // Mc [8] LEPCHA SUBJOINED LETTER YA..LEPCHA VOWEL SIGN UU + {0x1C2C, 0x1C33, prExtend}, // Mn [8] LEPCHA VOWEL SIGN E..LEPCHA CONSONANT SIGN T + {0x1C34, 0x1C35, prSpacingMark}, // Mc [2] LEPCHA CONSONANT SIGN NYIN-DO..LEPCHA CONSONANT SIGN KANG + {0x1C36, 0x1C37, prExtend}, // Mn [2] LEPCHA SIGN RAN..LEPCHA SIGN NUKTA + {0x1CD0, 0x1CD2, prExtend}, // Mn [3] VEDIC TONE KARSHANA..VEDIC TONE PRENKHA + {0x1CD4, 0x1CE0, prExtend}, // Mn [13] VEDIC SIGN YAJURVEDIC MIDLINE SVARITA..VEDIC TONE RIGVEDIC KASHMIRI INDEPENDENT SVARITA + {0x1CE1, 0x1CE1, prSpacingMark}, // Mc VEDIC TONE ATHARVAVEDIC INDEPENDENT SVARITA + {0x1CE2, 0x1CE8, prExtend}, // Mn [7] VEDIC SIGN VISARGA SVARITA..VEDIC SIGN VISARGA ANUDATTA WITH TAIL + {0x1CED, 0x1CED, prExtend}, // Mn VEDIC SIGN TIRYAK + {0x1CF4, 0x1CF4, prExtend}, // Mn VEDIC TONE CANDRA ABOVE + {0x1CF7, 0x1CF7, prSpacingMark}, // Mc VEDIC SIGN ATIKRAMA + {0x1CF8, 0x1CF9, prExtend}, // Mn [2] VEDIC TONE RING ABOVE..VEDIC TONE DOUBLE RING ABOVE + {0x1DC0, 0x1DF9, prExtend}, // Mn [58] COMBINING DOTTED GRAVE ACCENT..COMBINING WIDE INVERTED BRIDGE BELOW + {0x1DFB, 0x1DFF, prExtend}, // Mn [5] COMBINING DELETION MARK..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW + {0x200B, 0x200B, prControl}, // Cf ZERO WIDTH SPACE + {0x200C, 0x200C, prExtend}, // Cf ZERO WIDTH NON-JOINER + {0x200D, 0x200D, prZWJ}, // Cf ZERO WIDTH JOINER + {0x200E, 0x200F, prControl}, // Cf [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT MARK + {0x2028, 0x2028, prControl}, // Zl LINE SEPARATOR + {0x2029, 0x2029, prControl}, // Zp PARAGRAPH SEPARATOR + {0x202A, 0x202E, prControl}, // Cf [5] LEFT-TO-RIGHT EMBEDDING..RIGHT-TO-LEFT OVERRIDE + {0x203C, 0x203C, prExtendedPictographic}, // 1.1 [1] (‼️) double exclamation mark + {0x2049, 0x2049, prExtendedPictographic}, // 3.0 [1] (⁉️) exclamation question mark + {0x2060, 0x2064, prControl}, // Cf [5] WORD JOINER..INVISIBLE PLUS + {0x2065, 0x2065, prControl}, // Cn + {0x2066, 0x206F, prControl}, // Cf [10] LEFT-TO-RIGHT ISOLATE..NOMINAL DIGIT SHAPES + {0x20D0, 0x20DC, prExtend}, // Mn [13] COMBINING LEFT HARPOON ABOVE..COMBINING FOUR DOTS ABOVE + {0x20DD, 0x20E0, prExtend}, // Me [4] COMBINING ENCLOSING CIRCLE..COMBINING ENCLOSING CIRCLE BACKSLASH + {0x20E1, 0x20E1, prExtend}, // Mn COMBINING LEFT RIGHT ARROW ABOVE + {0x20E2, 0x20E4, prExtend}, // Me [3] COMBINING ENCLOSING SCREEN..COMBINING ENCLOSING UPWARD POINTING TRIANGLE + {0x20E5, 0x20F0, prExtend}, // Mn [12] COMBINING REVERSE SOLIDUS OVERLAY..COMBINING ASTERISK ABOVE + {0x2122, 0x2122, prExtendedPictographic}, // 1.1 [1] (™️) trade mark + {0x2139, 0x2139, prExtendedPictographic}, // 3.0 [1] (ℹ️) information + {0x2194, 0x2199, prExtendedPictographic}, // 1.1 [6] (↔️..↙️) left-right arrow..down-left arrow + {0x21A9, 0x21AA, prExtendedPictographic}, // 1.1 [2] (↩️..↪️) right arrow curving left..left arrow curving right + {0x231A, 0x231B, prExtendedPictographic}, // 1.1 [2] (⌚..⌛) watch..hourglass done + {0x2328, 0x2328, prExtendedPictographic}, // 1.1 [1] (⌨️) keyboard + {0x2388, 0x2388, prExtendedPictographic}, // 3.0 [1] (⎈) HELM SYMBOL + {0x23CF, 0x23CF, prExtendedPictographic}, // 4.0 [1] (⏏️) eject button + {0x23E9, 0x23F3, prExtendedPictographic}, // 6.0 [11] (⏩..⏳) fast-forward button..hourglass not done + {0x23F8, 0x23FA, prExtendedPictographic}, // 7.0 [3] (⏸️..⏺️) pause button..record button + {0x24C2, 0x24C2, prExtendedPictographic}, // 1.1 [1] (Ⓜ️) circled M + {0x25AA, 0x25AB, prExtendedPictographic}, // 1.1 [2] (▪️..▫️) black small square..white small square + {0x25B6, 0x25B6, prExtendedPictographic}, // 1.1 [1] (▶️) play button + {0x25C0, 0x25C0, prExtendedPictographic}, // 1.1 [1] (◀️) reverse button + {0x25FB, 0x25FE, prExtendedPictographic}, // 3.2 [4] (◻️..◾) white medium square..black medium-small square + {0x2600, 0x2605, prExtendedPictographic}, // 1.1 [6] (☀️..★) sun..BLACK STAR + {0x2607, 0x2612, prExtendedPictographic}, // 1.1 [12] (☇..☒) LIGHTNING..BALLOT BOX WITH X + {0x2614, 0x2615, prExtendedPictographic}, // 4.0 [2] (☔..☕) umbrella with rain drops..hot beverage + {0x2616, 0x2617, prExtendedPictographic}, // 3.2 [2] (☖..☗) WHITE SHOGI PIECE..BLACK SHOGI PIECE + {0x2618, 0x2618, prExtendedPictographic}, // 4.1 [1] (☘️) shamrock + {0x2619, 0x2619, prExtendedPictographic}, // 3.0 [1] (☙) REVERSED ROTATED FLORAL HEART BULLET + {0x261A, 0x266F, prExtendedPictographic}, // 1.1 [86] (☚..♯) BLACK LEFT POINTING INDEX..MUSIC SHARP SIGN + {0x2670, 0x2671, prExtendedPictographic}, // 3.0 [2] (♰..♱) WEST SYRIAC CROSS..EAST SYRIAC CROSS + {0x2672, 0x267D, prExtendedPictographic}, // 3.2 [12] (♲..♽) UNIVERSAL RECYCLING SYMBOL..PARTIALLY-RECYCLED PAPER SYMBOL + {0x267E, 0x267F, prExtendedPictographic}, // 4.1 [2] (♾️..♿) infinity..wheelchair symbol + {0x2680, 0x2685, prExtendedPictographic}, // 3.2 [6] (⚀..⚅) DIE FACE-1..DIE FACE-6 + {0x2690, 0x2691, prExtendedPictographic}, // 4.0 [2] (⚐..⚑) WHITE FLAG..BLACK FLAG + {0x2692, 0x269C, prExtendedPictographic}, // 4.1 [11] (⚒️..⚜️) hammer and pick..fleur-de-lis + {0x269D, 0x269D, prExtendedPictographic}, // 5.1 [1] (⚝) OUTLINED WHITE STAR + {0x269E, 0x269F, prExtendedPictographic}, // 5.2 [2] (⚞..⚟) THREE LINES CONVERGING RIGHT..THREE LINES CONVERGING LEFT + {0x26A0, 0x26A1, prExtendedPictographic}, // 4.0 [2] (⚠️..⚡) warning..high voltage + {0x26A2, 0x26B1, prExtendedPictographic}, // 4.1 [16] (⚢..⚱️) DOUBLED FEMALE SIGN..funeral urn + {0x26B2, 0x26B2, prExtendedPictographic}, // 5.0 [1] (⚲) NEUTER + {0x26B3, 0x26BC, prExtendedPictographic}, // 5.1 [10] (⚳..⚼) CERES..SESQUIQUADRATE + {0x26BD, 0x26BF, prExtendedPictographic}, // 5.2 [3] (⚽..⚿) soccer ball..SQUARED KEY + {0x26C0, 0x26C3, prExtendedPictographic}, // 5.1 [4] (⛀..⛃) WHITE DRAUGHTS MAN..BLACK DRAUGHTS KING + {0x26C4, 0x26CD, prExtendedPictographic}, // 5.2 [10] (⛄..⛍) snowman without snow..DISABLED CAR + {0x26CE, 0x26CE, prExtendedPictographic}, // 6.0 [1] (⛎) Ophiuchus + {0x26CF, 0x26E1, prExtendedPictographic}, // 5.2 [19] (⛏️..⛡) pick..RESTRICTED LEFT ENTRY-2 + {0x26E2, 0x26E2, prExtendedPictographic}, // 6.0 [1] (⛢) ASTRONOMICAL SYMBOL FOR URANUS + {0x26E3, 0x26E3, prExtendedPictographic}, // 5.2 [1] (⛣) HEAVY CIRCLE WITH STROKE AND TWO DOTS ABOVE + {0x26E4, 0x26E7, prExtendedPictographic}, // 6.0 [4] (⛤..⛧) PENTAGRAM..INVERTED PENTAGRAM + {0x26E8, 0x26FF, prExtendedPictographic}, // 5.2 [24] (⛨..⛿) BLACK CROSS ON SHIELD..WHITE FLAG WITH HORIZONTAL MIDDLE BLACK STRIPE + {0x2700, 0x2700, prExtendedPictographic}, // 7.0 [1] (✀) BLACK SAFETY SCISSORS + {0x2701, 0x2704, prExtendedPictographic}, // 1.1 [4] (✁..✄) UPPER BLADE SCISSORS..WHITE SCISSORS + {0x2705, 0x2705, prExtendedPictographic}, // 6.0 [1] (✅) check mark button + {0x2708, 0x2709, prExtendedPictographic}, // 1.1 [2] (✈️..✉️) airplane..envelope + {0x270A, 0x270B, prExtendedPictographic}, // 6.0 [2] (✊..✋) raised fist..raised hand + {0x270C, 0x2712, prExtendedPictographic}, // 1.1 [7] (✌️..✒️) victory hand..black nib + {0x2714, 0x2714, prExtendedPictographic}, // 1.1 [1] (✔️) check mark + {0x2716, 0x2716, prExtendedPictographic}, // 1.1 [1] (✖️) multiplication sign + {0x271D, 0x271D, prExtendedPictographic}, // 1.1 [1] (✝️) latin cross + {0x2721, 0x2721, prExtendedPictographic}, // 1.1 [1] (✡️) star of David + {0x2728, 0x2728, prExtendedPictographic}, // 6.0 [1] (✨) sparkles + {0x2733, 0x2734, prExtendedPictographic}, // 1.1 [2] (✳️..✴️) eight-spoked asterisk..eight-pointed star + {0x2744, 0x2744, prExtendedPictographic}, // 1.1 [1] (❄️) snowflake + {0x2747, 0x2747, prExtendedPictographic}, // 1.1 [1] (❇️) sparkle + {0x274C, 0x274C, prExtendedPictographic}, // 6.0 [1] (❌) cross mark + {0x274E, 0x274E, prExtendedPictographic}, // 6.0 [1] (❎) cross mark button + {0x2753, 0x2755, prExtendedPictographic}, // 6.0 [3] (❓..❕) question mark..white exclamation mark + {0x2757, 0x2757, prExtendedPictographic}, // 5.2 [1] (❗) exclamation mark + {0x2763, 0x2767, prExtendedPictographic}, // 1.1 [5] (❣️..❧) heart exclamation..ROTATED FLORAL HEART BULLET + {0x2795, 0x2797, prExtendedPictographic}, // 6.0 [3] (➕..➗) plus sign..division sign + {0x27A1, 0x27A1, prExtendedPictographic}, // 1.1 [1] (➡️) right arrow + {0x27B0, 0x27B0, prExtendedPictographic}, // 6.0 [1] (➰) curly loop + {0x27BF, 0x27BF, prExtendedPictographic}, // 6.0 [1] (➿) double curly loop + {0x2934, 0x2935, prExtendedPictographic}, // 3.2 [2] (⤴️..⤵️) right arrow curving up..right arrow curving down + {0x2B05, 0x2B07, prExtendedPictographic}, // 4.0 [3] (⬅️..⬇️) left arrow..down arrow + {0x2B1B, 0x2B1C, prExtendedPictographic}, // 5.1 [2] (⬛..⬜) black large square..white large square + {0x2B50, 0x2B50, prExtendedPictographic}, // 5.1 [1] (⭐) star + {0x2B55, 0x2B55, prExtendedPictographic}, // 5.2 [1] (⭕) hollow red circle + {0x2CEF, 0x2CF1, prExtend}, // Mn [3] COPTIC COMBINING NI ABOVE..COPTIC COMBINING SPIRITUS LENIS + {0x2D7F, 0x2D7F, prExtend}, // Mn TIFINAGH CONSONANT JOINER + {0x2DE0, 0x2DFF, prExtend}, // Mn [32] COMBINING CYRILLIC LETTER BE..COMBINING CYRILLIC LETTER IOTIFIED BIG YUS + {0x302A, 0x302D, prExtend}, // Mn [4] IDEOGRAPHIC LEVEL TONE MARK..IDEOGRAPHIC ENTERING TONE MARK + {0x302E, 0x302F, prExtend}, // Mc [2] HANGUL SINGLE DOT TONE MARK..HANGUL DOUBLE DOT TONE MARK + {0x3030, 0x3030, prExtendedPictographic}, // 1.1 [1] (〰️) wavy dash + {0x303D, 0x303D, prExtendedPictographic}, // 3.2 [1] (〽️) part alternation mark + {0x3099, 0x309A, prExtend}, // Mn [2] COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK..COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK + {0x3297, 0x3297, prExtendedPictographic}, // 1.1 [1] (㊗️) Japanese “congratulations” button + {0x3299, 0x3299, prExtendedPictographic}, // 1.1 [1] (㊙️) Japanese “secret” button + {0xA66F, 0xA66F, prExtend}, // Mn COMBINING CYRILLIC VZMET + {0xA670, 0xA672, prExtend}, // Me [3] COMBINING CYRILLIC TEN MILLIONS SIGN..COMBINING CYRILLIC THOUSAND MILLIONS SIGN + {0xA674, 0xA67D, prExtend}, // Mn [10] COMBINING CYRILLIC LETTER UKRAINIAN IE..COMBINING CYRILLIC PAYEROK + {0xA69E, 0xA69F, prExtend}, // Mn [2] COMBINING CYRILLIC LETTER EF..COMBINING CYRILLIC LETTER IOTIFIED E + {0xA6F0, 0xA6F1, prExtend}, // Mn [2] BAMUM COMBINING MARK KOQNDON..BAMUM COMBINING MARK TUKWENTIS + {0xA802, 0xA802, prExtend}, // Mn SYLOTI NAGRI SIGN DVISVARA + {0xA806, 0xA806, prExtend}, // Mn SYLOTI NAGRI SIGN HASANTA + {0xA80B, 0xA80B, prExtend}, // Mn SYLOTI NAGRI SIGN ANUSVARA + {0xA823, 0xA824, prSpacingMark}, // Mc [2] SYLOTI NAGRI VOWEL SIGN A..SYLOTI NAGRI VOWEL SIGN I + {0xA825, 0xA826, prExtend}, // Mn [2] SYLOTI NAGRI VOWEL SIGN U..SYLOTI NAGRI VOWEL SIGN E + {0xA827, 0xA827, prSpacingMark}, // Mc SYLOTI NAGRI VOWEL SIGN OO + {0xA880, 0xA881, prSpacingMark}, // Mc [2] SAURASHTRA SIGN ANUSVARA..SAURASHTRA SIGN VISARGA + {0xA8B4, 0xA8C3, prSpacingMark}, // Mc [16] SAURASHTRA CONSONANT SIGN HAARU..SAURASHTRA VOWEL SIGN AU + {0xA8C4, 0xA8C5, prExtend}, // Mn [2] SAURASHTRA SIGN VIRAMA..SAURASHTRA SIGN CANDRABINDU + {0xA8E0, 0xA8F1, prExtend}, // Mn [18] COMBINING DEVANAGARI DIGIT ZERO..COMBINING DEVANAGARI SIGN AVAGRAHA + {0xA8FF, 0xA8FF, prExtend}, // Mn DEVANAGARI VOWEL SIGN AY + {0xA926, 0xA92D, prExtend}, // Mn [8] KAYAH LI VOWEL UE..KAYAH LI TONE CALYA PLOPHU + {0xA947, 0xA951, prExtend}, // Mn [11] REJANG VOWEL SIGN I..REJANG CONSONANT SIGN R + {0xA952, 0xA953, prSpacingMark}, // Mc [2] REJANG CONSONANT SIGN H..REJANG VIRAMA + {0xA960, 0xA97C, prL}, // Lo [29] HANGUL CHOSEONG TIKEUT-MIEUM..HANGUL CHOSEONG SSANGYEORINHIEUH + {0xA980, 0xA982, prExtend}, // Mn [3] JAVANESE SIGN PANYANGGA..JAVANESE SIGN LAYAR + {0xA983, 0xA983, prSpacingMark}, // Mc JAVANESE SIGN WIGNYAN + {0xA9B3, 0xA9B3, prExtend}, // Mn JAVANESE SIGN CECAK TELU + {0xA9B4, 0xA9B5, prSpacingMark}, // Mc [2] JAVANESE VOWEL SIGN TARUNG..JAVANESE VOWEL SIGN TOLONG + {0xA9B6, 0xA9B9, prExtend}, // Mn [4] JAVANESE VOWEL SIGN WULU..JAVANESE VOWEL SIGN SUKU MENDUT + {0xA9BA, 0xA9BB, prSpacingMark}, // Mc [2] JAVANESE VOWEL SIGN TALING..JAVANESE VOWEL SIGN DIRGA MURE + {0xA9BC, 0xA9BD, prExtend}, // Mn [2] JAVANESE VOWEL SIGN PEPET..JAVANESE CONSONANT SIGN KERET + {0xA9BE, 0xA9C0, prSpacingMark}, // Mc [3] JAVANESE CONSONANT SIGN PENGKAL..JAVANESE PANGKON + {0xA9E5, 0xA9E5, prExtend}, // Mn MYANMAR SIGN SHAN SAW + {0xAA29, 0xAA2E, prExtend}, // Mn [6] CHAM VOWEL SIGN AA..CHAM VOWEL SIGN OE + {0xAA2F, 0xAA30, prSpacingMark}, // Mc [2] CHAM VOWEL SIGN O..CHAM VOWEL SIGN AI + {0xAA31, 0xAA32, prExtend}, // Mn [2] CHAM VOWEL SIGN AU..CHAM VOWEL SIGN UE + {0xAA33, 0xAA34, prSpacingMark}, // Mc [2] CHAM CONSONANT SIGN YA..CHAM CONSONANT SIGN RA + {0xAA35, 0xAA36, prExtend}, // Mn [2] CHAM CONSONANT SIGN LA..CHAM CONSONANT SIGN WA + {0xAA43, 0xAA43, prExtend}, // Mn CHAM CONSONANT SIGN FINAL NG + {0xAA4C, 0xAA4C, prExtend}, // Mn CHAM CONSONANT SIGN FINAL M + {0xAA4D, 0xAA4D, prSpacingMark}, // Mc CHAM CONSONANT SIGN FINAL H + {0xAA7C, 0xAA7C, prExtend}, // Mn MYANMAR SIGN TAI LAING TONE-2 + {0xAAB0, 0xAAB0, prExtend}, // Mn TAI VIET MAI KANG + {0xAAB2, 0xAAB4, prExtend}, // Mn [3] TAI VIET VOWEL I..TAI VIET VOWEL U + {0xAAB7, 0xAAB8, prExtend}, // Mn [2] TAI VIET MAI KHIT..TAI VIET VOWEL IA + {0xAABE, 0xAABF, prExtend}, // Mn [2] TAI VIET VOWEL AM..TAI VIET TONE MAI EK + {0xAAC1, 0xAAC1, prExtend}, // Mn TAI VIET TONE MAI THO + {0xAAEB, 0xAAEB, prSpacingMark}, // Mc MEETEI MAYEK VOWEL SIGN II + {0xAAEC, 0xAAED, prExtend}, // Mn [2] MEETEI MAYEK VOWEL SIGN UU..MEETEI MAYEK VOWEL SIGN AAI + {0xAAEE, 0xAAEF, prSpacingMark}, // Mc [2] MEETEI MAYEK VOWEL SIGN AU..MEETEI MAYEK VOWEL SIGN AAU + {0xAAF5, 0xAAF5, prSpacingMark}, // Mc MEETEI MAYEK VOWEL SIGN VISARGA + {0xAAF6, 0xAAF6, prExtend}, // Mn MEETEI MAYEK VIRAMA + {0xABE3, 0xABE4, prSpacingMark}, // Mc [2] MEETEI MAYEK VOWEL SIGN ONAP..MEETEI MAYEK VOWEL SIGN INAP + {0xABE5, 0xABE5, prExtend}, // Mn MEETEI MAYEK VOWEL SIGN ANAP + {0xABE6, 0xABE7, prSpacingMark}, // Mc [2] MEETEI MAYEK VOWEL SIGN YENAP..MEETEI MAYEK VOWEL SIGN SOUNAP + {0xABE8, 0xABE8, prExtend}, // Mn MEETEI MAYEK VOWEL SIGN UNAP + {0xABE9, 0xABEA, prSpacingMark}, // Mc [2] MEETEI MAYEK VOWEL SIGN CHEINAP..MEETEI MAYEK VOWEL SIGN NUNG + {0xABEC, 0xABEC, prSpacingMark}, // Mc MEETEI MAYEK LUM IYEK + {0xABED, 0xABED, prExtend}, // Mn MEETEI MAYEK APUN IYEK + {0xAC00, 0xAC00, prLV}, // Lo HANGUL SYLLABLE GA + {0xAC01, 0xAC1B, prLVT}, // Lo [27] HANGUL SYLLABLE GAG..HANGUL SYLLABLE GAH + {0xAC1C, 0xAC1C, prLV}, // Lo HANGUL SYLLABLE GAE + {0xAC1D, 0xAC37, prLVT}, // Lo [27] HANGUL SYLLABLE GAEG..HANGUL SYLLABLE GAEH + {0xAC38, 0xAC38, prLV}, // Lo HANGUL SYLLABLE GYA + {0xAC39, 0xAC53, prLVT}, // Lo [27] HANGUL SYLLABLE GYAG..HANGUL SYLLABLE GYAH + {0xAC54, 0xAC54, prLV}, // Lo HANGUL SYLLABLE GYAE + {0xAC55, 0xAC6F, prLVT}, // Lo [27] HANGUL SYLLABLE GYAEG..HANGUL SYLLABLE GYAEH + {0xAC70, 0xAC70, prLV}, // Lo HANGUL SYLLABLE GEO + {0xAC71, 0xAC8B, prLVT}, // Lo [27] HANGUL SYLLABLE GEOG..HANGUL SYLLABLE GEOH + {0xAC8C, 0xAC8C, prLV}, // Lo HANGUL SYLLABLE GE + {0xAC8D, 0xACA7, prLVT}, // Lo [27] HANGUL SYLLABLE GEG..HANGUL SYLLABLE GEH + {0xACA8, 0xACA8, prLV}, // Lo HANGUL SYLLABLE GYEO + {0xACA9, 0xACC3, prLVT}, // Lo [27] HANGUL SYLLABLE GYEOG..HANGUL SYLLABLE GYEOH + {0xACC4, 0xACC4, prLV}, // Lo HANGUL SYLLABLE GYE + {0xACC5, 0xACDF, prLVT}, // Lo [27] HANGUL SYLLABLE GYEG..HANGUL SYLLABLE GYEH + {0xACE0, 0xACE0, prLV}, // Lo HANGUL SYLLABLE GO + {0xACE1, 0xACFB, prLVT}, // Lo [27] HANGUL SYLLABLE GOG..HANGUL SYLLABLE GOH + {0xACFC, 0xACFC, prLV}, // Lo HANGUL SYLLABLE GWA + {0xACFD, 0xAD17, prLVT}, // Lo [27] HANGUL SYLLABLE GWAG..HANGUL SYLLABLE GWAH + {0xAD18, 0xAD18, prLV}, // Lo HANGUL SYLLABLE GWAE + {0xAD19, 0xAD33, prLVT}, // Lo [27] HANGUL SYLLABLE GWAEG..HANGUL SYLLABLE GWAEH + {0xAD34, 0xAD34, prLV}, // Lo HANGUL SYLLABLE GOE + {0xAD35, 0xAD4F, prLVT}, // Lo [27] HANGUL SYLLABLE GOEG..HANGUL SYLLABLE GOEH + {0xAD50, 0xAD50, prLV}, // Lo HANGUL SYLLABLE GYO + {0xAD51, 0xAD6B, prLVT}, // Lo [27] HANGUL SYLLABLE GYOG..HANGUL SYLLABLE GYOH + {0xAD6C, 0xAD6C, prLV}, // Lo HANGUL SYLLABLE GU + {0xAD6D, 0xAD87, prLVT}, // Lo [27] HANGUL SYLLABLE GUG..HANGUL SYLLABLE GUH + {0xAD88, 0xAD88, prLV}, // Lo HANGUL SYLLABLE GWEO + {0xAD89, 0xADA3, prLVT}, // Lo [27] HANGUL SYLLABLE GWEOG..HANGUL SYLLABLE GWEOH + {0xADA4, 0xADA4, prLV}, // Lo HANGUL SYLLABLE GWE + {0xADA5, 0xADBF, prLVT}, // Lo [27] HANGUL SYLLABLE GWEG..HANGUL SYLLABLE GWEH + {0xADC0, 0xADC0, prLV}, // Lo HANGUL SYLLABLE GWI + {0xADC1, 0xADDB, prLVT}, // Lo [27] HANGUL SYLLABLE GWIG..HANGUL SYLLABLE GWIH + {0xADDC, 0xADDC, prLV}, // Lo HANGUL SYLLABLE GYU + {0xADDD, 0xADF7, prLVT}, // Lo [27] HANGUL SYLLABLE GYUG..HANGUL SYLLABLE GYUH + {0xADF8, 0xADF8, prLV}, // Lo HANGUL SYLLABLE GEU + {0xADF9, 0xAE13, prLVT}, // Lo [27] HANGUL SYLLABLE GEUG..HANGUL SYLLABLE GEUH + {0xAE14, 0xAE14, prLV}, // Lo HANGUL SYLLABLE GYI + {0xAE15, 0xAE2F, prLVT}, // Lo [27] HANGUL SYLLABLE GYIG..HANGUL SYLLABLE GYIH + {0xAE30, 0xAE30, prLV}, // Lo HANGUL SYLLABLE GI + {0xAE31, 0xAE4B, prLVT}, // Lo [27] HANGUL SYLLABLE GIG..HANGUL SYLLABLE GIH + {0xAE4C, 0xAE4C, prLV}, // Lo HANGUL SYLLABLE GGA + {0xAE4D, 0xAE67, prLVT}, // Lo [27] HANGUL SYLLABLE GGAG..HANGUL SYLLABLE GGAH + {0xAE68, 0xAE68, prLV}, // Lo HANGUL SYLLABLE GGAE + {0xAE69, 0xAE83, prLVT}, // Lo [27] HANGUL SYLLABLE GGAEG..HANGUL SYLLABLE GGAEH + {0xAE84, 0xAE84, prLV}, // Lo HANGUL SYLLABLE GGYA + {0xAE85, 0xAE9F, prLVT}, // Lo [27] HANGUL SYLLABLE GGYAG..HANGUL SYLLABLE GGYAH + {0xAEA0, 0xAEA0, prLV}, // Lo HANGUL SYLLABLE GGYAE + {0xAEA1, 0xAEBB, prLVT}, // Lo [27] HANGUL SYLLABLE GGYAEG..HANGUL SYLLABLE GGYAEH + {0xAEBC, 0xAEBC, prLV}, // Lo HANGUL SYLLABLE GGEO + {0xAEBD, 0xAED7, prLVT}, // Lo [27] HANGUL SYLLABLE GGEOG..HANGUL SYLLABLE GGEOH + {0xAED8, 0xAED8, prLV}, // Lo HANGUL SYLLABLE GGE + {0xAED9, 0xAEF3, prLVT}, // Lo [27] HANGUL SYLLABLE GGEG..HANGUL SYLLABLE GGEH + {0xAEF4, 0xAEF4, prLV}, // Lo HANGUL SYLLABLE GGYEO + {0xAEF5, 0xAF0F, prLVT}, // Lo [27] HANGUL SYLLABLE GGYEOG..HANGUL SYLLABLE GGYEOH + {0xAF10, 0xAF10, prLV}, // Lo HANGUL SYLLABLE GGYE + {0xAF11, 0xAF2B, prLVT}, // Lo [27] HANGUL SYLLABLE GGYEG..HANGUL SYLLABLE GGYEH + {0xAF2C, 0xAF2C, prLV}, // Lo HANGUL SYLLABLE GGO + {0xAF2D, 0xAF47, prLVT}, // Lo [27] HANGUL SYLLABLE GGOG..HANGUL SYLLABLE GGOH + {0xAF48, 0xAF48, prLV}, // Lo HANGUL SYLLABLE GGWA + {0xAF49, 0xAF63, prLVT}, // Lo [27] HANGUL SYLLABLE GGWAG..HANGUL SYLLABLE GGWAH + {0xAF64, 0xAF64, prLV}, // Lo HANGUL SYLLABLE GGWAE + {0xAF65, 0xAF7F, prLVT}, // Lo [27] HANGUL SYLLABLE GGWAEG..HANGUL SYLLABLE GGWAEH + {0xAF80, 0xAF80, prLV}, // Lo HANGUL SYLLABLE GGOE + {0xAF81, 0xAF9B, prLVT}, // Lo [27] HANGUL SYLLABLE GGOEG..HANGUL SYLLABLE GGOEH + {0xAF9C, 0xAF9C, prLV}, // Lo HANGUL SYLLABLE GGYO + {0xAF9D, 0xAFB7, prLVT}, // Lo [27] HANGUL SYLLABLE GGYOG..HANGUL SYLLABLE GGYOH + {0xAFB8, 0xAFB8, prLV}, // Lo HANGUL SYLLABLE GGU + {0xAFB9, 0xAFD3, prLVT}, // Lo [27] HANGUL SYLLABLE GGUG..HANGUL SYLLABLE GGUH + {0xAFD4, 0xAFD4, prLV}, // Lo HANGUL SYLLABLE GGWEO + {0xAFD5, 0xAFEF, prLVT}, // Lo [27] HANGUL SYLLABLE GGWEOG..HANGUL SYLLABLE GGWEOH + {0xAFF0, 0xAFF0, prLV}, // Lo HANGUL SYLLABLE GGWE + {0xAFF1, 0xB00B, prLVT}, // Lo [27] HANGUL SYLLABLE GGWEG..HANGUL SYLLABLE GGWEH + {0xB00C, 0xB00C, prLV}, // Lo HANGUL SYLLABLE GGWI + {0xB00D, 0xB027, prLVT}, // Lo [27] HANGUL SYLLABLE GGWIG..HANGUL SYLLABLE GGWIH + {0xB028, 0xB028, prLV}, // Lo HANGUL SYLLABLE GGYU + {0xB029, 0xB043, prLVT}, // Lo [27] HANGUL SYLLABLE GGYUG..HANGUL SYLLABLE GGYUH + {0xB044, 0xB044, prLV}, // Lo HANGUL SYLLABLE GGEU + {0xB045, 0xB05F, prLVT}, // Lo [27] HANGUL SYLLABLE GGEUG..HANGUL SYLLABLE GGEUH + {0xB060, 0xB060, prLV}, // Lo HANGUL SYLLABLE GGYI + {0xB061, 0xB07B, prLVT}, // Lo [27] HANGUL SYLLABLE GGYIG..HANGUL SYLLABLE GGYIH + {0xB07C, 0xB07C, prLV}, // Lo HANGUL SYLLABLE GGI + {0xB07D, 0xB097, prLVT}, // Lo [27] HANGUL SYLLABLE GGIG..HANGUL SYLLABLE GGIH + {0xB098, 0xB098, prLV}, // Lo HANGUL SYLLABLE NA + {0xB099, 0xB0B3, prLVT}, // Lo [27] HANGUL SYLLABLE NAG..HANGUL SYLLABLE NAH + {0xB0B4, 0xB0B4, prLV}, // Lo HANGUL SYLLABLE NAE + {0xB0B5, 0xB0CF, prLVT}, // Lo [27] HANGUL SYLLABLE NAEG..HANGUL SYLLABLE NAEH + {0xB0D0, 0xB0D0, prLV}, // Lo HANGUL SYLLABLE NYA + {0xB0D1, 0xB0EB, prLVT}, // Lo [27] HANGUL SYLLABLE NYAG..HANGUL SYLLABLE NYAH + {0xB0EC, 0xB0EC, prLV}, // Lo HANGUL SYLLABLE NYAE + {0xB0ED, 0xB107, prLVT}, // Lo [27] HANGUL SYLLABLE NYAEG..HANGUL SYLLABLE NYAEH + {0xB108, 0xB108, prLV}, // Lo HANGUL SYLLABLE NEO + {0xB109, 0xB123, prLVT}, // Lo [27] HANGUL SYLLABLE NEOG..HANGUL SYLLABLE NEOH + {0xB124, 0xB124, prLV}, // Lo HANGUL SYLLABLE NE + {0xB125, 0xB13F, prLVT}, // Lo [27] HANGUL SYLLABLE NEG..HANGUL SYLLABLE NEH + {0xB140, 0xB140, prLV}, // Lo HANGUL SYLLABLE NYEO + {0xB141, 0xB15B, prLVT}, // Lo [27] HANGUL SYLLABLE NYEOG..HANGUL SYLLABLE NYEOH + {0xB15C, 0xB15C, prLV}, // Lo HANGUL SYLLABLE NYE + {0xB15D, 0xB177, prLVT}, // Lo [27] HANGUL SYLLABLE NYEG..HANGUL SYLLABLE NYEH + {0xB178, 0xB178, prLV}, // Lo HANGUL SYLLABLE NO + {0xB179, 0xB193, prLVT}, // Lo [27] HANGUL SYLLABLE NOG..HANGUL SYLLABLE NOH + {0xB194, 0xB194, prLV}, // Lo HANGUL SYLLABLE NWA + {0xB195, 0xB1AF, prLVT}, // Lo [27] HANGUL SYLLABLE NWAG..HANGUL SYLLABLE NWAH + {0xB1B0, 0xB1B0, prLV}, // Lo HANGUL SYLLABLE NWAE + {0xB1B1, 0xB1CB, prLVT}, // Lo [27] HANGUL SYLLABLE NWAEG..HANGUL SYLLABLE NWAEH + {0xB1CC, 0xB1CC, prLV}, // Lo HANGUL SYLLABLE NOE + {0xB1CD, 0xB1E7, prLVT}, // Lo [27] HANGUL SYLLABLE NOEG..HANGUL SYLLABLE NOEH + {0xB1E8, 0xB1E8, prLV}, // Lo HANGUL SYLLABLE NYO + {0xB1E9, 0xB203, prLVT}, // Lo [27] HANGUL SYLLABLE NYOG..HANGUL SYLLABLE NYOH + {0xB204, 0xB204, prLV}, // Lo HANGUL SYLLABLE NU + {0xB205, 0xB21F, prLVT}, // Lo [27] HANGUL SYLLABLE NUG..HANGUL SYLLABLE NUH + {0xB220, 0xB220, prLV}, // Lo HANGUL SYLLABLE NWEO + {0xB221, 0xB23B, prLVT}, // Lo [27] HANGUL SYLLABLE NWEOG..HANGUL SYLLABLE NWEOH + {0xB23C, 0xB23C, prLV}, // Lo HANGUL SYLLABLE NWE + {0xB23D, 0xB257, prLVT}, // Lo [27] HANGUL SYLLABLE NWEG..HANGUL SYLLABLE NWEH + {0xB258, 0xB258, prLV}, // Lo HANGUL SYLLABLE NWI + {0xB259, 0xB273, prLVT}, // Lo [27] HANGUL SYLLABLE NWIG..HANGUL SYLLABLE NWIH + {0xB274, 0xB274, prLV}, // Lo HANGUL SYLLABLE NYU + {0xB275, 0xB28F, prLVT}, // Lo [27] HANGUL SYLLABLE NYUG..HANGUL SYLLABLE NYUH + {0xB290, 0xB290, prLV}, // Lo HANGUL SYLLABLE NEU + {0xB291, 0xB2AB, prLVT}, // Lo [27] HANGUL SYLLABLE NEUG..HANGUL SYLLABLE NEUH + {0xB2AC, 0xB2AC, prLV}, // Lo HANGUL SYLLABLE NYI + {0xB2AD, 0xB2C7, prLVT}, // Lo [27] HANGUL SYLLABLE NYIG..HANGUL SYLLABLE NYIH + {0xB2C8, 0xB2C8, prLV}, // Lo HANGUL SYLLABLE NI + {0xB2C9, 0xB2E3, prLVT}, // Lo [27] HANGUL SYLLABLE NIG..HANGUL SYLLABLE NIH + {0xB2E4, 0xB2E4, prLV}, // Lo HANGUL SYLLABLE DA + {0xB2E5, 0xB2FF, prLVT}, // Lo [27] HANGUL SYLLABLE DAG..HANGUL SYLLABLE DAH + {0xB300, 0xB300, prLV}, // Lo HANGUL SYLLABLE DAE + {0xB301, 0xB31B, prLVT}, // Lo [27] HANGUL SYLLABLE DAEG..HANGUL SYLLABLE DAEH + {0xB31C, 0xB31C, prLV}, // Lo HANGUL SYLLABLE DYA + {0xB31D, 0xB337, prLVT}, // Lo [27] HANGUL SYLLABLE DYAG..HANGUL SYLLABLE DYAH + {0xB338, 0xB338, prLV}, // Lo HANGUL SYLLABLE DYAE + {0xB339, 0xB353, prLVT}, // Lo [27] HANGUL SYLLABLE DYAEG..HANGUL SYLLABLE DYAEH + {0xB354, 0xB354, prLV}, // Lo HANGUL SYLLABLE DEO + {0xB355, 0xB36F, prLVT}, // Lo [27] HANGUL SYLLABLE DEOG..HANGUL SYLLABLE DEOH + {0xB370, 0xB370, prLV}, // Lo HANGUL SYLLABLE DE + {0xB371, 0xB38B, prLVT}, // Lo [27] HANGUL SYLLABLE DEG..HANGUL SYLLABLE DEH + {0xB38C, 0xB38C, prLV}, // Lo HANGUL SYLLABLE DYEO + {0xB38D, 0xB3A7, prLVT}, // Lo [27] HANGUL SYLLABLE DYEOG..HANGUL SYLLABLE DYEOH + {0xB3A8, 0xB3A8, prLV}, // Lo HANGUL SYLLABLE DYE + {0xB3A9, 0xB3C3, prLVT}, // Lo [27] HANGUL SYLLABLE DYEG..HANGUL SYLLABLE DYEH + {0xB3C4, 0xB3C4, prLV}, // Lo HANGUL SYLLABLE DO + {0xB3C5, 0xB3DF, prLVT}, // Lo [27] HANGUL SYLLABLE DOG..HANGUL SYLLABLE DOH + {0xB3E0, 0xB3E0, prLV}, // Lo HANGUL SYLLABLE DWA + {0xB3E1, 0xB3FB, prLVT}, // Lo [27] HANGUL SYLLABLE DWAG..HANGUL SYLLABLE DWAH + {0xB3FC, 0xB3FC, prLV}, // Lo HANGUL SYLLABLE DWAE + {0xB3FD, 0xB417, prLVT}, // Lo [27] HANGUL SYLLABLE DWAEG..HANGUL SYLLABLE DWAEH + {0xB418, 0xB418, prLV}, // Lo HANGUL SYLLABLE DOE + {0xB419, 0xB433, prLVT}, // Lo [27] HANGUL SYLLABLE DOEG..HANGUL SYLLABLE DOEH + {0xB434, 0xB434, prLV}, // Lo HANGUL SYLLABLE DYO + {0xB435, 0xB44F, prLVT}, // Lo [27] HANGUL SYLLABLE DYOG..HANGUL SYLLABLE DYOH + {0xB450, 0xB450, prLV}, // Lo HANGUL SYLLABLE DU + {0xB451, 0xB46B, prLVT}, // Lo [27] HANGUL SYLLABLE DUG..HANGUL SYLLABLE DUH + {0xB46C, 0xB46C, prLV}, // Lo HANGUL SYLLABLE DWEO + {0xB46D, 0xB487, prLVT}, // Lo [27] HANGUL SYLLABLE DWEOG..HANGUL SYLLABLE DWEOH + {0xB488, 0xB488, prLV}, // Lo HANGUL SYLLABLE DWE + {0xB489, 0xB4A3, prLVT}, // Lo [27] HANGUL SYLLABLE DWEG..HANGUL SYLLABLE DWEH + {0xB4A4, 0xB4A4, prLV}, // Lo HANGUL SYLLABLE DWI + {0xB4A5, 0xB4BF, prLVT}, // Lo [27] HANGUL SYLLABLE DWIG..HANGUL SYLLABLE DWIH + {0xB4C0, 0xB4C0, prLV}, // Lo HANGUL SYLLABLE DYU + {0xB4C1, 0xB4DB, prLVT}, // Lo [27] HANGUL SYLLABLE DYUG..HANGUL SYLLABLE DYUH + {0xB4DC, 0xB4DC, prLV}, // Lo HANGUL SYLLABLE DEU + {0xB4DD, 0xB4F7, prLVT}, // Lo [27] HANGUL SYLLABLE DEUG..HANGUL SYLLABLE DEUH + {0xB4F8, 0xB4F8, prLV}, // Lo HANGUL SYLLABLE DYI + {0xB4F9, 0xB513, prLVT}, // Lo [27] HANGUL SYLLABLE DYIG..HANGUL SYLLABLE DYIH + {0xB514, 0xB514, prLV}, // Lo HANGUL SYLLABLE DI + {0xB515, 0xB52F, prLVT}, // Lo [27] HANGUL SYLLABLE DIG..HANGUL SYLLABLE DIH + {0xB530, 0xB530, prLV}, // Lo HANGUL SYLLABLE DDA + {0xB531, 0xB54B, prLVT}, // Lo [27] HANGUL SYLLABLE DDAG..HANGUL SYLLABLE DDAH + {0xB54C, 0xB54C, prLV}, // Lo HANGUL SYLLABLE DDAE + {0xB54D, 0xB567, prLVT}, // Lo [27] HANGUL SYLLABLE DDAEG..HANGUL SYLLABLE DDAEH + {0xB568, 0xB568, prLV}, // Lo HANGUL SYLLABLE DDYA + {0xB569, 0xB583, prLVT}, // Lo [27] HANGUL SYLLABLE DDYAG..HANGUL SYLLABLE DDYAH + {0xB584, 0xB584, prLV}, // Lo HANGUL SYLLABLE DDYAE + {0xB585, 0xB59F, prLVT}, // Lo [27] HANGUL SYLLABLE DDYAEG..HANGUL SYLLABLE DDYAEH + {0xB5A0, 0xB5A0, prLV}, // Lo HANGUL SYLLABLE DDEO + {0xB5A1, 0xB5BB, prLVT}, // Lo [27] HANGUL SYLLABLE DDEOG..HANGUL SYLLABLE DDEOH + {0xB5BC, 0xB5BC, prLV}, // Lo HANGUL SYLLABLE DDE + {0xB5BD, 0xB5D7, prLVT}, // Lo [27] HANGUL SYLLABLE DDEG..HANGUL SYLLABLE DDEH + {0xB5D8, 0xB5D8, prLV}, // Lo HANGUL SYLLABLE DDYEO + {0xB5D9, 0xB5F3, prLVT}, // Lo [27] HANGUL SYLLABLE DDYEOG..HANGUL SYLLABLE DDYEOH + {0xB5F4, 0xB5F4, prLV}, // Lo HANGUL SYLLABLE DDYE + {0xB5F5, 0xB60F, prLVT}, // Lo [27] HANGUL SYLLABLE DDYEG..HANGUL SYLLABLE DDYEH + {0xB610, 0xB610, prLV}, // Lo HANGUL SYLLABLE DDO + {0xB611, 0xB62B, prLVT}, // Lo [27] HANGUL SYLLABLE DDOG..HANGUL SYLLABLE DDOH + {0xB62C, 0xB62C, prLV}, // Lo HANGUL SYLLABLE DDWA + {0xB62D, 0xB647, prLVT}, // Lo [27] HANGUL SYLLABLE DDWAG..HANGUL SYLLABLE DDWAH + {0xB648, 0xB648, prLV}, // Lo HANGUL SYLLABLE DDWAE + {0xB649, 0xB663, prLVT}, // Lo [27] HANGUL SYLLABLE DDWAEG..HANGUL SYLLABLE DDWAEH + {0xB664, 0xB664, prLV}, // Lo HANGUL SYLLABLE DDOE + {0xB665, 0xB67F, prLVT}, // Lo [27] HANGUL SYLLABLE DDOEG..HANGUL SYLLABLE DDOEH + {0xB680, 0xB680, prLV}, // Lo HANGUL SYLLABLE DDYO + {0xB681, 0xB69B, prLVT}, // Lo [27] HANGUL SYLLABLE DDYOG..HANGUL SYLLABLE DDYOH + {0xB69C, 0xB69C, prLV}, // Lo HANGUL SYLLABLE DDU + {0xB69D, 0xB6B7, prLVT}, // Lo [27] HANGUL SYLLABLE DDUG..HANGUL SYLLABLE DDUH + {0xB6B8, 0xB6B8, prLV}, // Lo HANGUL SYLLABLE DDWEO + {0xB6B9, 0xB6D3, prLVT}, // Lo [27] HANGUL SYLLABLE DDWEOG..HANGUL SYLLABLE DDWEOH + {0xB6D4, 0xB6D4, prLV}, // Lo HANGUL SYLLABLE DDWE + {0xB6D5, 0xB6EF, prLVT}, // Lo [27] HANGUL SYLLABLE DDWEG..HANGUL SYLLABLE DDWEH + {0xB6F0, 0xB6F0, prLV}, // Lo HANGUL SYLLABLE DDWI + {0xB6F1, 0xB70B, prLVT}, // Lo [27] HANGUL SYLLABLE DDWIG..HANGUL SYLLABLE DDWIH + {0xB70C, 0xB70C, prLV}, // Lo HANGUL SYLLABLE DDYU + {0xB70D, 0xB727, prLVT}, // Lo [27] HANGUL SYLLABLE DDYUG..HANGUL SYLLABLE DDYUH + {0xB728, 0xB728, prLV}, // Lo HANGUL SYLLABLE DDEU + {0xB729, 0xB743, prLVT}, // Lo [27] HANGUL SYLLABLE DDEUG..HANGUL SYLLABLE DDEUH + {0xB744, 0xB744, prLV}, // Lo HANGUL SYLLABLE DDYI + {0xB745, 0xB75F, prLVT}, // Lo [27] HANGUL SYLLABLE DDYIG..HANGUL SYLLABLE DDYIH + {0xB760, 0xB760, prLV}, // Lo HANGUL SYLLABLE DDI + {0xB761, 0xB77B, prLVT}, // Lo [27] HANGUL SYLLABLE DDIG..HANGUL SYLLABLE DDIH + {0xB77C, 0xB77C, prLV}, // Lo HANGUL SYLLABLE RA + {0xB77D, 0xB797, prLVT}, // Lo [27] HANGUL SYLLABLE RAG..HANGUL SYLLABLE RAH + {0xB798, 0xB798, prLV}, // Lo HANGUL SYLLABLE RAE + {0xB799, 0xB7B3, prLVT}, // Lo [27] HANGUL SYLLABLE RAEG..HANGUL SYLLABLE RAEH + {0xB7B4, 0xB7B4, prLV}, // Lo HANGUL SYLLABLE RYA + {0xB7B5, 0xB7CF, prLVT}, // Lo [27] HANGUL SYLLABLE RYAG..HANGUL SYLLABLE RYAH + {0xB7D0, 0xB7D0, prLV}, // Lo HANGUL SYLLABLE RYAE + {0xB7D1, 0xB7EB, prLVT}, // Lo [27] HANGUL SYLLABLE RYAEG..HANGUL SYLLABLE RYAEH + {0xB7EC, 0xB7EC, prLV}, // Lo HANGUL SYLLABLE REO + {0xB7ED, 0xB807, prLVT}, // Lo [27] HANGUL SYLLABLE REOG..HANGUL SYLLABLE REOH + {0xB808, 0xB808, prLV}, // Lo HANGUL SYLLABLE RE + {0xB809, 0xB823, prLVT}, // Lo [27] HANGUL SYLLABLE REG..HANGUL SYLLABLE REH + {0xB824, 0xB824, prLV}, // Lo HANGUL SYLLABLE RYEO + {0xB825, 0xB83F, prLVT}, // Lo [27] HANGUL SYLLABLE RYEOG..HANGUL SYLLABLE RYEOH + {0xB840, 0xB840, prLV}, // Lo HANGUL SYLLABLE RYE + {0xB841, 0xB85B, prLVT}, // Lo [27] HANGUL SYLLABLE RYEG..HANGUL SYLLABLE RYEH + {0xB85C, 0xB85C, prLV}, // Lo HANGUL SYLLABLE RO + {0xB85D, 0xB877, prLVT}, // Lo [27] HANGUL SYLLABLE ROG..HANGUL SYLLABLE ROH + {0xB878, 0xB878, prLV}, // Lo HANGUL SYLLABLE RWA + {0xB879, 0xB893, prLVT}, // Lo [27] HANGUL SYLLABLE RWAG..HANGUL SYLLABLE RWAH + {0xB894, 0xB894, prLV}, // Lo HANGUL SYLLABLE RWAE + {0xB895, 0xB8AF, prLVT}, // Lo [27] HANGUL SYLLABLE RWAEG..HANGUL SYLLABLE RWAEH + {0xB8B0, 0xB8B0, prLV}, // Lo HANGUL SYLLABLE ROE + {0xB8B1, 0xB8CB, prLVT}, // Lo [27] HANGUL SYLLABLE ROEG..HANGUL SYLLABLE ROEH + {0xB8CC, 0xB8CC, prLV}, // Lo HANGUL SYLLABLE RYO + {0xB8CD, 0xB8E7, prLVT}, // Lo [27] HANGUL SYLLABLE RYOG..HANGUL SYLLABLE RYOH + {0xB8E8, 0xB8E8, prLV}, // Lo HANGUL SYLLABLE RU + {0xB8E9, 0xB903, prLVT}, // Lo [27] HANGUL SYLLABLE RUG..HANGUL SYLLABLE RUH + {0xB904, 0xB904, prLV}, // Lo HANGUL SYLLABLE RWEO + {0xB905, 0xB91F, prLVT}, // Lo [27] HANGUL SYLLABLE RWEOG..HANGUL SYLLABLE RWEOH + {0xB920, 0xB920, prLV}, // Lo HANGUL SYLLABLE RWE + {0xB921, 0xB93B, prLVT}, // Lo [27] HANGUL SYLLABLE RWEG..HANGUL SYLLABLE RWEH + {0xB93C, 0xB93C, prLV}, // Lo HANGUL SYLLABLE RWI + {0xB93D, 0xB957, prLVT}, // Lo [27] HANGUL SYLLABLE RWIG..HANGUL SYLLABLE RWIH + {0xB958, 0xB958, prLV}, // Lo HANGUL SYLLABLE RYU + {0xB959, 0xB973, prLVT}, // Lo [27] HANGUL SYLLABLE RYUG..HANGUL SYLLABLE RYUH + {0xB974, 0xB974, prLV}, // Lo HANGUL SYLLABLE REU + {0xB975, 0xB98F, prLVT}, // Lo [27] HANGUL SYLLABLE REUG..HANGUL SYLLABLE REUH + {0xB990, 0xB990, prLV}, // Lo HANGUL SYLLABLE RYI + {0xB991, 0xB9AB, prLVT}, // Lo [27] HANGUL SYLLABLE RYIG..HANGUL SYLLABLE RYIH + {0xB9AC, 0xB9AC, prLV}, // Lo HANGUL SYLLABLE RI + {0xB9AD, 0xB9C7, prLVT}, // Lo [27] HANGUL SYLLABLE RIG..HANGUL SYLLABLE RIH + {0xB9C8, 0xB9C8, prLV}, // Lo HANGUL SYLLABLE MA + {0xB9C9, 0xB9E3, prLVT}, // Lo [27] HANGUL SYLLABLE MAG..HANGUL SYLLABLE MAH + {0xB9E4, 0xB9E4, prLV}, // Lo HANGUL SYLLABLE MAE + {0xB9E5, 0xB9FF, prLVT}, // Lo [27] HANGUL SYLLABLE MAEG..HANGUL SYLLABLE MAEH + {0xBA00, 0xBA00, prLV}, // Lo HANGUL SYLLABLE MYA + {0xBA01, 0xBA1B, prLVT}, // Lo [27] HANGUL SYLLABLE MYAG..HANGUL SYLLABLE MYAH + {0xBA1C, 0xBA1C, prLV}, // Lo HANGUL SYLLABLE MYAE + {0xBA1D, 0xBA37, prLVT}, // Lo [27] HANGUL SYLLABLE MYAEG..HANGUL SYLLABLE MYAEH + {0xBA38, 0xBA38, prLV}, // Lo HANGUL SYLLABLE MEO + {0xBA39, 0xBA53, prLVT}, // Lo [27] HANGUL SYLLABLE MEOG..HANGUL SYLLABLE MEOH + {0xBA54, 0xBA54, prLV}, // Lo HANGUL SYLLABLE ME + {0xBA55, 0xBA6F, prLVT}, // Lo [27] HANGUL SYLLABLE MEG..HANGUL SYLLABLE MEH + {0xBA70, 0xBA70, prLV}, // Lo HANGUL SYLLABLE MYEO + {0xBA71, 0xBA8B, prLVT}, // Lo [27] HANGUL SYLLABLE MYEOG..HANGUL SYLLABLE MYEOH + {0xBA8C, 0xBA8C, prLV}, // Lo HANGUL SYLLABLE MYE + {0xBA8D, 0xBAA7, prLVT}, // Lo [27] HANGUL SYLLABLE MYEG..HANGUL SYLLABLE MYEH + {0xBAA8, 0xBAA8, prLV}, // Lo HANGUL SYLLABLE MO + {0xBAA9, 0xBAC3, prLVT}, // Lo [27] HANGUL SYLLABLE MOG..HANGUL SYLLABLE MOH + {0xBAC4, 0xBAC4, prLV}, // Lo HANGUL SYLLABLE MWA + {0xBAC5, 0xBADF, prLVT}, // Lo [27] HANGUL SYLLABLE MWAG..HANGUL SYLLABLE MWAH + {0xBAE0, 0xBAE0, prLV}, // Lo HANGUL SYLLABLE MWAE + {0xBAE1, 0xBAFB, prLVT}, // Lo [27] HANGUL SYLLABLE MWAEG..HANGUL SYLLABLE MWAEH + {0xBAFC, 0xBAFC, prLV}, // Lo HANGUL SYLLABLE MOE + {0xBAFD, 0xBB17, prLVT}, // Lo [27] HANGUL SYLLABLE MOEG..HANGUL SYLLABLE MOEH + {0xBB18, 0xBB18, prLV}, // Lo HANGUL SYLLABLE MYO + {0xBB19, 0xBB33, prLVT}, // Lo [27] HANGUL SYLLABLE MYOG..HANGUL SYLLABLE MYOH + {0xBB34, 0xBB34, prLV}, // Lo HANGUL SYLLABLE MU + {0xBB35, 0xBB4F, prLVT}, // Lo [27] HANGUL SYLLABLE MUG..HANGUL SYLLABLE MUH + {0xBB50, 0xBB50, prLV}, // Lo HANGUL SYLLABLE MWEO + {0xBB51, 0xBB6B, prLVT}, // Lo [27] HANGUL SYLLABLE MWEOG..HANGUL SYLLABLE MWEOH + {0xBB6C, 0xBB6C, prLV}, // Lo HANGUL SYLLABLE MWE + {0xBB6D, 0xBB87, prLVT}, // Lo [27] HANGUL SYLLABLE MWEG..HANGUL SYLLABLE MWEH + {0xBB88, 0xBB88, prLV}, // Lo HANGUL SYLLABLE MWI + {0xBB89, 0xBBA3, prLVT}, // Lo [27] HANGUL SYLLABLE MWIG..HANGUL SYLLABLE MWIH + {0xBBA4, 0xBBA4, prLV}, // Lo HANGUL SYLLABLE MYU + {0xBBA5, 0xBBBF, prLVT}, // Lo [27] HANGUL SYLLABLE MYUG..HANGUL SYLLABLE MYUH + {0xBBC0, 0xBBC0, prLV}, // Lo HANGUL SYLLABLE MEU + {0xBBC1, 0xBBDB, prLVT}, // Lo [27] HANGUL SYLLABLE MEUG..HANGUL SYLLABLE MEUH + {0xBBDC, 0xBBDC, prLV}, // Lo HANGUL SYLLABLE MYI + {0xBBDD, 0xBBF7, prLVT}, // Lo [27] HANGUL SYLLABLE MYIG..HANGUL SYLLABLE MYIH + {0xBBF8, 0xBBF8, prLV}, // Lo HANGUL SYLLABLE MI + {0xBBF9, 0xBC13, prLVT}, // Lo [27] HANGUL SYLLABLE MIG..HANGUL SYLLABLE MIH + {0xBC14, 0xBC14, prLV}, // Lo HANGUL SYLLABLE BA + {0xBC15, 0xBC2F, prLVT}, // Lo [27] HANGUL SYLLABLE BAG..HANGUL SYLLABLE BAH + {0xBC30, 0xBC30, prLV}, // Lo HANGUL SYLLABLE BAE + {0xBC31, 0xBC4B, prLVT}, // Lo [27] HANGUL SYLLABLE BAEG..HANGUL SYLLABLE BAEH + {0xBC4C, 0xBC4C, prLV}, // Lo HANGUL SYLLABLE BYA + {0xBC4D, 0xBC67, prLVT}, // Lo [27] HANGUL SYLLABLE BYAG..HANGUL SYLLABLE BYAH + {0xBC68, 0xBC68, prLV}, // Lo HANGUL SYLLABLE BYAE + {0xBC69, 0xBC83, prLVT}, // Lo [27] HANGUL SYLLABLE BYAEG..HANGUL SYLLABLE BYAEH + {0xBC84, 0xBC84, prLV}, // Lo HANGUL SYLLABLE BEO + {0xBC85, 0xBC9F, prLVT}, // Lo [27] HANGUL SYLLABLE BEOG..HANGUL SYLLABLE BEOH + {0xBCA0, 0xBCA0, prLV}, // Lo HANGUL SYLLABLE BE + {0xBCA1, 0xBCBB, prLVT}, // Lo [27] HANGUL SYLLABLE BEG..HANGUL SYLLABLE BEH + {0xBCBC, 0xBCBC, prLV}, // Lo HANGUL SYLLABLE BYEO + {0xBCBD, 0xBCD7, prLVT}, // Lo [27] HANGUL SYLLABLE BYEOG..HANGUL SYLLABLE BYEOH + {0xBCD8, 0xBCD8, prLV}, // Lo HANGUL SYLLABLE BYE + {0xBCD9, 0xBCF3, prLVT}, // Lo [27] HANGUL SYLLABLE BYEG..HANGUL SYLLABLE BYEH + {0xBCF4, 0xBCF4, prLV}, // Lo HANGUL SYLLABLE BO + {0xBCF5, 0xBD0F, prLVT}, // Lo [27] HANGUL SYLLABLE BOG..HANGUL SYLLABLE BOH + {0xBD10, 0xBD10, prLV}, // Lo HANGUL SYLLABLE BWA + {0xBD11, 0xBD2B, prLVT}, // Lo [27] HANGUL SYLLABLE BWAG..HANGUL SYLLABLE BWAH + {0xBD2C, 0xBD2C, prLV}, // Lo HANGUL SYLLABLE BWAE + {0xBD2D, 0xBD47, prLVT}, // Lo [27] HANGUL SYLLABLE BWAEG..HANGUL SYLLABLE BWAEH + {0xBD48, 0xBD48, prLV}, // Lo HANGUL SYLLABLE BOE + {0xBD49, 0xBD63, prLVT}, // Lo [27] HANGUL SYLLABLE BOEG..HANGUL SYLLABLE BOEH + {0xBD64, 0xBD64, prLV}, // Lo HANGUL SYLLABLE BYO + {0xBD65, 0xBD7F, prLVT}, // Lo [27] HANGUL SYLLABLE BYOG..HANGUL SYLLABLE BYOH + {0xBD80, 0xBD80, prLV}, // Lo HANGUL SYLLABLE BU + {0xBD81, 0xBD9B, prLVT}, // Lo [27] HANGUL SYLLABLE BUG..HANGUL SYLLABLE BUH + {0xBD9C, 0xBD9C, prLV}, // Lo HANGUL SYLLABLE BWEO + {0xBD9D, 0xBDB7, prLVT}, // Lo [27] HANGUL SYLLABLE BWEOG..HANGUL SYLLABLE BWEOH + {0xBDB8, 0xBDB8, prLV}, // Lo HANGUL SYLLABLE BWE + {0xBDB9, 0xBDD3, prLVT}, // Lo [27] HANGUL SYLLABLE BWEG..HANGUL SYLLABLE BWEH + {0xBDD4, 0xBDD4, prLV}, // Lo HANGUL SYLLABLE BWI + {0xBDD5, 0xBDEF, prLVT}, // Lo [27] HANGUL SYLLABLE BWIG..HANGUL SYLLABLE BWIH + {0xBDF0, 0xBDF0, prLV}, // Lo HANGUL SYLLABLE BYU + {0xBDF1, 0xBE0B, prLVT}, // Lo [27] HANGUL SYLLABLE BYUG..HANGUL SYLLABLE BYUH + {0xBE0C, 0xBE0C, prLV}, // Lo HANGUL SYLLABLE BEU + {0xBE0D, 0xBE27, prLVT}, // Lo [27] HANGUL SYLLABLE BEUG..HANGUL SYLLABLE BEUH + {0xBE28, 0xBE28, prLV}, // Lo HANGUL SYLLABLE BYI + {0xBE29, 0xBE43, prLVT}, // Lo [27] HANGUL SYLLABLE BYIG..HANGUL SYLLABLE BYIH + {0xBE44, 0xBE44, prLV}, // Lo HANGUL SYLLABLE BI + {0xBE45, 0xBE5F, prLVT}, // Lo [27] HANGUL SYLLABLE BIG..HANGUL SYLLABLE BIH + {0xBE60, 0xBE60, prLV}, // Lo HANGUL SYLLABLE BBA + {0xBE61, 0xBE7B, prLVT}, // Lo [27] HANGUL SYLLABLE BBAG..HANGUL SYLLABLE BBAH + {0xBE7C, 0xBE7C, prLV}, // Lo HANGUL SYLLABLE BBAE + {0xBE7D, 0xBE97, prLVT}, // Lo [27] HANGUL SYLLABLE BBAEG..HANGUL SYLLABLE BBAEH + {0xBE98, 0xBE98, prLV}, // Lo HANGUL SYLLABLE BBYA + {0xBE99, 0xBEB3, prLVT}, // Lo [27] HANGUL SYLLABLE BBYAG..HANGUL SYLLABLE BBYAH + {0xBEB4, 0xBEB4, prLV}, // Lo HANGUL SYLLABLE BBYAE + {0xBEB5, 0xBECF, prLVT}, // Lo [27] HANGUL SYLLABLE BBYAEG..HANGUL SYLLABLE BBYAEH + {0xBED0, 0xBED0, prLV}, // Lo HANGUL SYLLABLE BBEO + {0xBED1, 0xBEEB, prLVT}, // Lo [27] HANGUL SYLLABLE BBEOG..HANGUL SYLLABLE BBEOH + {0xBEEC, 0xBEEC, prLV}, // Lo HANGUL SYLLABLE BBE + {0xBEED, 0xBF07, prLVT}, // Lo [27] HANGUL SYLLABLE BBEG..HANGUL SYLLABLE BBEH + {0xBF08, 0xBF08, prLV}, // Lo HANGUL SYLLABLE BBYEO + {0xBF09, 0xBF23, prLVT}, // Lo [27] HANGUL SYLLABLE BBYEOG..HANGUL SYLLABLE BBYEOH + {0xBF24, 0xBF24, prLV}, // Lo HANGUL SYLLABLE BBYE + {0xBF25, 0xBF3F, prLVT}, // Lo [27] HANGUL SYLLABLE BBYEG..HANGUL SYLLABLE BBYEH + {0xBF40, 0xBF40, prLV}, // Lo HANGUL SYLLABLE BBO + {0xBF41, 0xBF5B, prLVT}, // Lo [27] HANGUL SYLLABLE BBOG..HANGUL SYLLABLE BBOH + {0xBF5C, 0xBF5C, prLV}, // Lo HANGUL SYLLABLE BBWA + {0xBF5D, 0xBF77, prLVT}, // Lo [27] HANGUL SYLLABLE BBWAG..HANGUL SYLLABLE BBWAH + {0xBF78, 0xBF78, prLV}, // Lo HANGUL SYLLABLE BBWAE + {0xBF79, 0xBF93, prLVT}, // Lo [27] HANGUL SYLLABLE BBWAEG..HANGUL SYLLABLE BBWAEH + {0xBF94, 0xBF94, prLV}, // Lo HANGUL SYLLABLE BBOE + {0xBF95, 0xBFAF, prLVT}, // Lo [27] HANGUL SYLLABLE BBOEG..HANGUL SYLLABLE BBOEH + {0xBFB0, 0xBFB0, prLV}, // Lo HANGUL SYLLABLE BBYO + {0xBFB1, 0xBFCB, prLVT}, // Lo [27] HANGUL SYLLABLE BBYOG..HANGUL SYLLABLE BBYOH + {0xBFCC, 0xBFCC, prLV}, // Lo HANGUL SYLLABLE BBU + {0xBFCD, 0xBFE7, prLVT}, // Lo [27] HANGUL SYLLABLE BBUG..HANGUL SYLLABLE BBUH + {0xBFE8, 0xBFE8, prLV}, // Lo HANGUL SYLLABLE BBWEO + {0xBFE9, 0xC003, prLVT}, // Lo [27] HANGUL SYLLABLE BBWEOG..HANGUL SYLLABLE BBWEOH + {0xC004, 0xC004, prLV}, // Lo HANGUL SYLLABLE BBWE + {0xC005, 0xC01F, prLVT}, // Lo [27] HANGUL SYLLABLE BBWEG..HANGUL SYLLABLE BBWEH + {0xC020, 0xC020, prLV}, // Lo HANGUL SYLLABLE BBWI + {0xC021, 0xC03B, prLVT}, // Lo [27] HANGUL SYLLABLE BBWIG..HANGUL SYLLABLE BBWIH + {0xC03C, 0xC03C, prLV}, // Lo HANGUL SYLLABLE BBYU + {0xC03D, 0xC057, prLVT}, // Lo [27] HANGUL SYLLABLE BBYUG..HANGUL SYLLABLE BBYUH + {0xC058, 0xC058, prLV}, // Lo HANGUL SYLLABLE BBEU + {0xC059, 0xC073, prLVT}, // Lo [27] HANGUL SYLLABLE BBEUG..HANGUL SYLLABLE BBEUH + {0xC074, 0xC074, prLV}, // Lo HANGUL SYLLABLE BBYI + {0xC075, 0xC08F, prLVT}, // Lo [27] HANGUL SYLLABLE BBYIG..HANGUL SYLLABLE BBYIH + {0xC090, 0xC090, prLV}, // Lo HANGUL SYLLABLE BBI + {0xC091, 0xC0AB, prLVT}, // Lo [27] HANGUL SYLLABLE BBIG..HANGUL SYLLABLE BBIH + {0xC0AC, 0xC0AC, prLV}, // Lo HANGUL SYLLABLE SA + {0xC0AD, 0xC0C7, prLVT}, // Lo [27] HANGUL SYLLABLE SAG..HANGUL SYLLABLE SAH + {0xC0C8, 0xC0C8, prLV}, // Lo HANGUL SYLLABLE SAE + {0xC0C9, 0xC0E3, prLVT}, // Lo [27] HANGUL SYLLABLE SAEG..HANGUL SYLLABLE SAEH + {0xC0E4, 0xC0E4, prLV}, // Lo HANGUL SYLLABLE SYA + {0xC0E5, 0xC0FF, prLVT}, // Lo [27] HANGUL SYLLABLE SYAG..HANGUL SYLLABLE SYAH + {0xC100, 0xC100, prLV}, // Lo HANGUL SYLLABLE SYAE + {0xC101, 0xC11B, prLVT}, // Lo [27] HANGUL SYLLABLE SYAEG..HANGUL SYLLABLE SYAEH + {0xC11C, 0xC11C, prLV}, // Lo HANGUL SYLLABLE SEO + {0xC11D, 0xC137, prLVT}, // Lo [27] HANGUL SYLLABLE SEOG..HANGUL SYLLABLE SEOH + {0xC138, 0xC138, prLV}, // Lo HANGUL SYLLABLE SE + {0xC139, 0xC153, prLVT}, // Lo [27] HANGUL SYLLABLE SEG..HANGUL SYLLABLE SEH + {0xC154, 0xC154, prLV}, // Lo HANGUL SYLLABLE SYEO + {0xC155, 0xC16F, prLVT}, // Lo [27] HANGUL SYLLABLE SYEOG..HANGUL SYLLABLE SYEOH + {0xC170, 0xC170, prLV}, // Lo HANGUL SYLLABLE SYE + {0xC171, 0xC18B, prLVT}, // Lo [27] HANGUL SYLLABLE SYEG..HANGUL SYLLABLE SYEH + {0xC18C, 0xC18C, prLV}, // Lo HANGUL SYLLABLE SO + {0xC18D, 0xC1A7, prLVT}, // Lo [27] HANGUL SYLLABLE SOG..HANGUL SYLLABLE SOH + {0xC1A8, 0xC1A8, prLV}, // Lo HANGUL SYLLABLE SWA + {0xC1A9, 0xC1C3, prLVT}, // Lo [27] HANGUL SYLLABLE SWAG..HANGUL SYLLABLE SWAH + {0xC1C4, 0xC1C4, prLV}, // Lo HANGUL SYLLABLE SWAE + {0xC1C5, 0xC1DF, prLVT}, // Lo [27] HANGUL SYLLABLE SWAEG..HANGUL SYLLABLE SWAEH + {0xC1E0, 0xC1E0, prLV}, // Lo HANGUL SYLLABLE SOE + {0xC1E1, 0xC1FB, prLVT}, // Lo [27] HANGUL SYLLABLE SOEG..HANGUL SYLLABLE SOEH + {0xC1FC, 0xC1FC, prLV}, // Lo HANGUL SYLLABLE SYO + {0xC1FD, 0xC217, prLVT}, // Lo [27] HANGUL SYLLABLE SYOG..HANGUL SYLLABLE SYOH + {0xC218, 0xC218, prLV}, // Lo HANGUL SYLLABLE SU + {0xC219, 0xC233, prLVT}, // Lo [27] HANGUL SYLLABLE SUG..HANGUL SYLLABLE SUH + {0xC234, 0xC234, prLV}, // Lo HANGUL SYLLABLE SWEO + {0xC235, 0xC24F, prLVT}, // Lo [27] HANGUL SYLLABLE SWEOG..HANGUL SYLLABLE SWEOH + {0xC250, 0xC250, prLV}, // Lo HANGUL SYLLABLE SWE + {0xC251, 0xC26B, prLVT}, // Lo [27] HANGUL SYLLABLE SWEG..HANGUL SYLLABLE SWEH + {0xC26C, 0xC26C, prLV}, // Lo HANGUL SYLLABLE SWI + {0xC26D, 0xC287, prLVT}, // Lo [27] HANGUL SYLLABLE SWIG..HANGUL SYLLABLE SWIH + {0xC288, 0xC288, prLV}, // Lo HANGUL SYLLABLE SYU + {0xC289, 0xC2A3, prLVT}, // Lo [27] HANGUL SYLLABLE SYUG..HANGUL SYLLABLE SYUH + {0xC2A4, 0xC2A4, prLV}, // Lo HANGUL SYLLABLE SEU + {0xC2A5, 0xC2BF, prLVT}, // Lo [27] HANGUL SYLLABLE SEUG..HANGUL SYLLABLE SEUH + {0xC2C0, 0xC2C0, prLV}, // Lo HANGUL SYLLABLE SYI + {0xC2C1, 0xC2DB, prLVT}, // Lo [27] HANGUL SYLLABLE SYIG..HANGUL SYLLABLE SYIH + {0xC2DC, 0xC2DC, prLV}, // Lo HANGUL SYLLABLE SI + {0xC2DD, 0xC2F7, prLVT}, // Lo [27] HANGUL SYLLABLE SIG..HANGUL SYLLABLE SIH + {0xC2F8, 0xC2F8, prLV}, // Lo HANGUL SYLLABLE SSA + {0xC2F9, 0xC313, prLVT}, // Lo [27] HANGUL SYLLABLE SSAG..HANGUL SYLLABLE SSAH + {0xC314, 0xC314, prLV}, // Lo HANGUL SYLLABLE SSAE + {0xC315, 0xC32F, prLVT}, // Lo [27] HANGUL SYLLABLE SSAEG..HANGUL SYLLABLE SSAEH + {0xC330, 0xC330, prLV}, // Lo HANGUL SYLLABLE SSYA + {0xC331, 0xC34B, prLVT}, // Lo [27] HANGUL SYLLABLE SSYAG..HANGUL SYLLABLE SSYAH + {0xC34C, 0xC34C, prLV}, // Lo HANGUL SYLLABLE SSYAE + {0xC34D, 0xC367, prLVT}, // Lo [27] HANGUL SYLLABLE SSYAEG..HANGUL SYLLABLE SSYAEH + {0xC368, 0xC368, prLV}, // Lo HANGUL SYLLABLE SSEO + {0xC369, 0xC383, prLVT}, // Lo [27] HANGUL SYLLABLE SSEOG..HANGUL SYLLABLE SSEOH + {0xC384, 0xC384, prLV}, // Lo HANGUL SYLLABLE SSE + {0xC385, 0xC39F, prLVT}, // Lo [27] HANGUL SYLLABLE SSEG..HANGUL SYLLABLE SSEH + {0xC3A0, 0xC3A0, prLV}, // Lo HANGUL SYLLABLE SSYEO + {0xC3A1, 0xC3BB, prLVT}, // Lo [27] HANGUL SYLLABLE SSYEOG..HANGUL SYLLABLE SSYEOH + {0xC3BC, 0xC3BC, prLV}, // Lo HANGUL SYLLABLE SSYE + {0xC3BD, 0xC3D7, prLVT}, // Lo [27] HANGUL SYLLABLE SSYEG..HANGUL SYLLABLE SSYEH + {0xC3D8, 0xC3D8, prLV}, // Lo HANGUL SYLLABLE SSO + {0xC3D9, 0xC3F3, prLVT}, // Lo [27] HANGUL SYLLABLE SSOG..HANGUL SYLLABLE SSOH + {0xC3F4, 0xC3F4, prLV}, // Lo HANGUL SYLLABLE SSWA + {0xC3F5, 0xC40F, prLVT}, // Lo [27] HANGUL SYLLABLE SSWAG..HANGUL SYLLABLE SSWAH + {0xC410, 0xC410, prLV}, // Lo HANGUL SYLLABLE SSWAE + {0xC411, 0xC42B, prLVT}, // Lo [27] HANGUL SYLLABLE SSWAEG..HANGUL SYLLABLE SSWAEH + {0xC42C, 0xC42C, prLV}, // Lo HANGUL SYLLABLE SSOE + {0xC42D, 0xC447, prLVT}, // Lo [27] HANGUL SYLLABLE SSOEG..HANGUL SYLLABLE SSOEH + {0xC448, 0xC448, prLV}, // Lo HANGUL SYLLABLE SSYO + {0xC449, 0xC463, prLVT}, // Lo [27] HANGUL SYLLABLE SSYOG..HANGUL SYLLABLE SSYOH + {0xC464, 0xC464, prLV}, // Lo HANGUL SYLLABLE SSU + {0xC465, 0xC47F, prLVT}, // Lo [27] HANGUL SYLLABLE SSUG..HANGUL SYLLABLE SSUH + {0xC480, 0xC480, prLV}, // Lo HANGUL SYLLABLE SSWEO + {0xC481, 0xC49B, prLVT}, // Lo [27] HANGUL SYLLABLE SSWEOG..HANGUL SYLLABLE SSWEOH + {0xC49C, 0xC49C, prLV}, // Lo HANGUL SYLLABLE SSWE + {0xC49D, 0xC4B7, prLVT}, // Lo [27] HANGUL SYLLABLE SSWEG..HANGUL SYLLABLE SSWEH + {0xC4B8, 0xC4B8, prLV}, // Lo HANGUL SYLLABLE SSWI + {0xC4B9, 0xC4D3, prLVT}, // Lo [27] HANGUL SYLLABLE SSWIG..HANGUL SYLLABLE SSWIH + {0xC4D4, 0xC4D4, prLV}, // Lo HANGUL SYLLABLE SSYU + {0xC4D5, 0xC4EF, prLVT}, // Lo [27] HANGUL SYLLABLE SSYUG..HANGUL SYLLABLE SSYUH + {0xC4F0, 0xC4F0, prLV}, // Lo HANGUL SYLLABLE SSEU + {0xC4F1, 0xC50B, prLVT}, // Lo [27] HANGUL SYLLABLE SSEUG..HANGUL SYLLABLE SSEUH + {0xC50C, 0xC50C, prLV}, // Lo HANGUL SYLLABLE SSYI + {0xC50D, 0xC527, prLVT}, // Lo [27] HANGUL SYLLABLE SSYIG..HANGUL SYLLABLE SSYIH + {0xC528, 0xC528, prLV}, // Lo HANGUL SYLLABLE SSI + {0xC529, 0xC543, prLVT}, // Lo [27] HANGUL SYLLABLE SSIG..HANGUL SYLLABLE SSIH + {0xC544, 0xC544, prLV}, // Lo HANGUL SYLLABLE A + {0xC545, 0xC55F, prLVT}, // Lo [27] HANGUL SYLLABLE AG..HANGUL SYLLABLE AH + {0xC560, 0xC560, prLV}, // Lo HANGUL SYLLABLE AE + {0xC561, 0xC57B, prLVT}, // Lo [27] HANGUL SYLLABLE AEG..HANGUL SYLLABLE AEH + {0xC57C, 0xC57C, prLV}, // Lo HANGUL SYLLABLE YA + {0xC57D, 0xC597, prLVT}, // Lo [27] HANGUL SYLLABLE YAG..HANGUL SYLLABLE YAH + {0xC598, 0xC598, prLV}, // Lo HANGUL SYLLABLE YAE + {0xC599, 0xC5B3, prLVT}, // Lo [27] HANGUL SYLLABLE YAEG..HANGUL SYLLABLE YAEH + {0xC5B4, 0xC5B4, prLV}, // Lo HANGUL SYLLABLE EO + {0xC5B5, 0xC5CF, prLVT}, // Lo [27] HANGUL SYLLABLE EOG..HANGUL SYLLABLE EOH + {0xC5D0, 0xC5D0, prLV}, // Lo HANGUL SYLLABLE E + {0xC5D1, 0xC5EB, prLVT}, // Lo [27] HANGUL SYLLABLE EG..HANGUL SYLLABLE EH + {0xC5EC, 0xC5EC, prLV}, // Lo HANGUL SYLLABLE YEO + {0xC5ED, 0xC607, prLVT}, // Lo [27] HANGUL SYLLABLE YEOG..HANGUL SYLLABLE YEOH + {0xC608, 0xC608, prLV}, // Lo HANGUL SYLLABLE YE + {0xC609, 0xC623, prLVT}, // Lo [27] HANGUL SYLLABLE YEG..HANGUL SYLLABLE YEH + {0xC624, 0xC624, prLV}, // Lo HANGUL SYLLABLE O + {0xC625, 0xC63F, prLVT}, // Lo [27] HANGUL SYLLABLE OG..HANGUL SYLLABLE OH + {0xC640, 0xC640, prLV}, // Lo HANGUL SYLLABLE WA + {0xC641, 0xC65B, prLVT}, // Lo [27] HANGUL SYLLABLE WAG..HANGUL SYLLABLE WAH + {0xC65C, 0xC65C, prLV}, // Lo HANGUL SYLLABLE WAE + {0xC65D, 0xC677, prLVT}, // Lo [27] HANGUL SYLLABLE WAEG..HANGUL SYLLABLE WAEH + {0xC678, 0xC678, prLV}, // Lo HANGUL SYLLABLE OE + {0xC679, 0xC693, prLVT}, // Lo [27] HANGUL SYLLABLE OEG..HANGUL SYLLABLE OEH + {0xC694, 0xC694, prLV}, // Lo HANGUL SYLLABLE YO + {0xC695, 0xC6AF, prLVT}, // Lo [27] HANGUL SYLLABLE YOG..HANGUL SYLLABLE YOH + {0xC6B0, 0xC6B0, prLV}, // Lo HANGUL SYLLABLE U + {0xC6B1, 0xC6CB, prLVT}, // Lo [27] HANGUL SYLLABLE UG..HANGUL SYLLABLE UH + {0xC6CC, 0xC6CC, prLV}, // Lo HANGUL SYLLABLE WEO + {0xC6CD, 0xC6E7, prLVT}, // Lo [27] HANGUL SYLLABLE WEOG..HANGUL SYLLABLE WEOH + {0xC6E8, 0xC6E8, prLV}, // Lo HANGUL SYLLABLE WE + {0xC6E9, 0xC703, prLVT}, // Lo [27] HANGUL SYLLABLE WEG..HANGUL SYLLABLE WEH + {0xC704, 0xC704, prLV}, // Lo HANGUL SYLLABLE WI + {0xC705, 0xC71F, prLVT}, // Lo [27] HANGUL SYLLABLE WIG..HANGUL SYLLABLE WIH + {0xC720, 0xC720, prLV}, // Lo HANGUL SYLLABLE YU + {0xC721, 0xC73B, prLVT}, // Lo [27] HANGUL SYLLABLE YUG..HANGUL SYLLABLE YUH + {0xC73C, 0xC73C, prLV}, // Lo HANGUL SYLLABLE EU + {0xC73D, 0xC757, prLVT}, // Lo [27] HANGUL SYLLABLE EUG..HANGUL SYLLABLE EUH + {0xC758, 0xC758, prLV}, // Lo HANGUL SYLLABLE YI + {0xC759, 0xC773, prLVT}, // Lo [27] HANGUL SYLLABLE YIG..HANGUL SYLLABLE YIH + {0xC774, 0xC774, prLV}, // Lo HANGUL SYLLABLE I + {0xC775, 0xC78F, prLVT}, // Lo [27] HANGUL SYLLABLE IG..HANGUL SYLLABLE IH + {0xC790, 0xC790, prLV}, // Lo HANGUL SYLLABLE JA + {0xC791, 0xC7AB, prLVT}, // Lo [27] HANGUL SYLLABLE JAG..HANGUL SYLLABLE JAH + {0xC7AC, 0xC7AC, prLV}, // Lo HANGUL SYLLABLE JAE + {0xC7AD, 0xC7C7, prLVT}, // Lo [27] HANGUL SYLLABLE JAEG..HANGUL SYLLABLE JAEH + {0xC7C8, 0xC7C8, prLV}, // Lo HANGUL SYLLABLE JYA + {0xC7C9, 0xC7E3, prLVT}, // Lo [27] HANGUL SYLLABLE JYAG..HANGUL SYLLABLE JYAH + {0xC7E4, 0xC7E4, prLV}, // Lo HANGUL SYLLABLE JYAE + {0xC7E5, 0xC7FF, prLVT}, // Lo [27] HANGUL SYLLABLE JYAEG..HANGUL SYLLABLE JYAEH + {0xC800, 0xC800, prLV}, // Lo HANGUL SYLLABLE JEO + {0xC801, 0xC81B, prLVT}, // Lo [27] HANGUL SYLLABLE JEOG..HANGUL SYLLABLE JEOH + {0xC81C, 0xC81C, prLV}, // Lo HANGUL SYLLABLE JE + {0xC81D, 0xC837, prLVT}, // Lo [27] HANGUL SYLLABLE JEG..HANGUL SYLLABLE JEH + {0xC838, 0xC838, prLV}, // Lo HANGUL SYLLABLE JYEO + {0xC839, 0xC853, prLVT}, // Lo [27] HANGUL SYLLABLE JYEOG..HANGUL SYLLABLE JYEOH + {0xC854, 0xC854, prLV}, // Lo HANGUL SYLLABLE JYE + {0xC855, 0xC86F, prLVT}, // Lo [27] HANGUL SYLLABLE JYEG..HANGUL SYLLABLE JYEH + {0xC870, 0xC870, prLV}, // Lo HANGUL SYLLABLE JO + {0xC871, 0xC88B, prLVT}, // Lo [27] HANGUL SYLLABLE JOG..HANGUL SYLLABLE JOH + {0xC88C, 0xC88C, prLV}, // Lo HANGUL SYLLABLE JWA + {0xC88D, 0xC8A7, prLVT}, // Lo [27] HANGUL SYLLABLE JWAG..HANGUL SYLLABLE JWAH + {0xC8A8, 0xC8A8, prLV}, // Lo HANGUL SYLLABLE JWAE + {0xC8A9, 0xC8C3, prLVT}, // Lo [27] HANGUL SYLLABLE JWAEG..HANGUL SYLLABLE JWAEH + {0xC8C4, 0xC8C4, prLV}, // Lo HANGUL SYLLABLE JOE + {0xC8C5, 0xC8DF, prLVT}, // Lo [27] HANGUL SYLLABLE JOEG..HANGUL SYLLABLE JOEH + {0xC8E0, 0xC8E0, prLV}, // Lo HANGUL SYLLABLE JYO + {0xC8E1, 0xC8FB, prLVT}, // Lo [27] HANGUL SYLLABLE JYOG..HANGUL SYLLABLE JYOH + {0xC8FC, 0xC8FC, prLV}, // Lo HANGUL SYLLABLE JU + {0xC8FD, 0xC917, prLVT}, // Lo [27] HANGUL SYLLABLE JUG..HANGUL SYLLABLE JUH + {0xC918, 0xC918, prLV}, // Lo HANGUL SYLLABLE JWEO + {0xC919, 0xC933, prLVT}, // Lo [27] HANGUL SYLLABLE JWEOG..HANGUL SYLLABLE JWEOH + {0xC934, 0xC934, prLV}, // Lo HANGUL SYLLABLE JWE + {0xC935, 0xC94F, prLVT}, // Lo [27] HANGUL SYLLABLE JWEG..HANGUL SYLLABLE JWEH + {0xC950, 0xC950, prLV}, // Lo HANGUL SYLLABLE JWI + {0xC951, 0xC96B, prLVT}, // Lo [27] HANGUL SYLLABLE JWIG..HANGUL SYLLABLE JWIH + {0xC96C, 0xC96C, prLV}, // Lo HANGUL SYLLABLE JYU + {0xC96D, 0xC987, prLVT}, // Lo [27] HANGUL SYLLABLE JYUG..HANGUL SYLLABLE JYUH + {0xC988, 0xC988, prLV}, // Lo HANGUL SYLLABLE JEU + {0xC989, 0xC9A3, prLVT}, // Lo [27] HANGUL SYLLABLE JEUG..HANGUL SYLLABLE JEUH + {0xC9A4, 0xC9A4, prLV}, // Lo HANGUL SYLLABLE JYI + {0xC9A5, 0xC9BF, prLVT}, // Lo [27] HANGUL SYLLABLE JYIG..HANGUL SYLLABLE JYIH + {0xC9C0, 0xC9C0, prLV}, // Lo HANGUL SYLLABLE JI + {0xC9C1, 0xC9DB, prLVT}, // Lo [27] HANGUL SYLLABLE JIG..HANGUL SYLLABLE JIH + {0xC9DC, 0xC9DC, prLV}, // Lo HANGUL SYLLABLE JJA + {0xC9DD, 0xC9F7, prLVT}, // Lo [27] HANGUL SYLLABLE JJAG..HANGUL SYLLABLE JJAH + {0xC9F8, 0xC9F8, prLV}, // Lo HANGUL SYLLABLE JJAE + {0xC9F9, 0xCA13, prLVT}, // Lo [27] HANGUL SYLLABLE JJAEG..HANGUL SYLLABLE JJAEH + {0xCA14, 0xCA14, prLV}, // Lo HANGUL SYLLABLE JJYA + {0xCA15, 0xCA2F, prLVT}, // Lo [27] HANGUL SYLLABLE JJYAG..HANGUL SYLLABLE JJYAH + {0xCA30, 0xCA30, prLV}, // Lo HANGUL SYLLABLE JJYAE + {0xCA31, 0xCA4B, prLVT}, // Lo [27] HANGUL SYLLABLE JJYAEG..HANGUL SYLLABLE JJYAEH + {0xCA4C, 0xCA4C, prLV}, // Lo HANGUL SYLLABLE JJEO + {0xCA4D, 0xCA67, prLVT}, // Lo [27] HANGUL SYLLABLE JJEOG..HANGUL SYLLABLE JJEOH + {0xCA68, 0xCA68, prLV}, // Lo HANGUL SYLLABLE JJE + {0xCA69, 0xCA83, prLVT}, // Lo [27] HANGUL SYLLABLE JJEG..HANGUL SYLLABLE JJEH + {0xCA84, 0xCA84, prLV}, // Lo HANGUL SYLLABLE JJYEO + {0xCA85, 0xCA9F, prLVT}, // Lo [27] HANGUL SYLLABLE JJYEOG..HANGUL SYLLABLE JJYEOH + {0xCAA0, 0xCAA0, prLV}, // Lo HANGUL SYLLABLE JJYE + {0xCAA1, 0xCABB, prLVT}, // Lo [27] HANGUL SYLLABLE JJYEG..HANGUL SYLLABLE JJYEH + {0xCABC, 0xCABC, prLV}, // Lo HANGUL SYLLABLE JJO + {0xCABD, 0xCAD7, prLVT}, // Lo [27] HANGUL SYLLABLE JJOG..HANGUL SYLLABLE JJOH + {0xCAD8, 0xCAD8, prLV}, // Lo HANGUL SYLLABLE JJWA + {0xCAD9, 0xCAF3, prLVT}, // Lo [27] HANGUL SYLLABLE JJWAG..HANGUL SYLLABLE JJWAH + {0xCAF4, 0xCAF4, prLV}, // Lo HANGUL SYLLABLE JJWAE + {0xCAF5, 0xCB0F, prLVT}, // Lo [27] HANGUL SYLLABLE JJWAEG..HANGUL SYLLABLE JJWAEH + {0xCB10, 0xCB10, prLV}, // Lo HANGUL SYLLABLE JJOE + {0xCB11, 0xCB2B, prLVT}, // Lo [27] HANGUL SYLLABLE JJOEG..HANGUL SYLLABLE JJOEH + {0xCB2C, 0xCB2C, prLV}, // Lo HANGUL SYLLABLE JJYO + {0xCB2D, 0xCB47, prLVT}, // Lo [27] HANGUL SYLLABLE JJYOG..HANGUL SYLLABLE JJYOH + {0xCB48, 0xCB48, prLV}, // Lo HANGUL SYLLABLE JJU + {0xCB49, 0xCB63, prLVT}, // Lo [27] HANGUL SYLLABLE JJUG..HANGUL SYLLABLE JJUH + {0xCB64, 0xCB64, prLV}, // Lo HANGUL SYLLABLE JJWEO + {0xCB65, 0xCB7F, prLVT}, // Lo [27] HANGUL SYLLABLE JJWEOG..HANGUL SYLLABLE JJWEOH + {0xCB80, 0xCB80, prLV}, // Lo HANGUL SYLLABLE JJWE + {0xCB81, 0xCB9B, prLVT}, // Lo [27] HANGUL SYLLABLE JJWEG..HANGUL SYLLABLE JJWEH + {0xCB9C, 0xCB9C, prLV}, // Lo HANGUL SYLLABLE JJWI + {0xCB9D, 0xCBB7, prLVT}, // Lo [27] HANGUL SYLLABLE JJWIG..HANGUL SYLLABLE JJWIH + {0xCBB8, 0xCBB8, prLV}, // Lo HANGUL SYLLABLE JJYU + {0xCBB9, 0xCBD3, prLVT}, // Lo [27] HANGUL SYLLABLE JJYUG..HANGUL SYLLABLE JJYUH + {0xCBD4, 0xCBD4, prLV}, // Lo HANGUL SYLLABLE JJEU + {0xCBD5, 0xCBEF, prLVT}, // Lo [27] HANGUL SYLLABLE JJEUG..HANGUL SYLLABLE JJEUH + {0xCBF0, 0xCBF0, prLV}, // Lo HANGUL SYLLABLE JJYI + {0xCBF1, 0xCC0B, prLVT}, // Lo [27] HANGUL SYLLABLE JJYIG..HANGUL SYLLABLE JJYIH + {0xCC0C, 0xCC0C, prLV}, // Lo HANGUL SYLLABLE JJI + {0xCC0D, 0xCC27, prLVT}, // Lo [27] HANGUL SYLLABLE JJIG..HANGUL SYLLABLE JJIH + {0xCC28, 0xCC28, prLV}, // Lo HANGUL SYLLABLE CA + {0xCC29, 0xCC43, prLVT}, // Lo [27] HANGUL SYLLABLE CAG..HANGUL SYLLABLE CAH + {0xCC44, 0xCC44, prLV}, // Lo HANGUL SYLLABLE CAE + {0xCC45, 0xCC5F, prLVT}, // Lo [27] HANGUL SYLLABLE CAEG..HANGUL SYLLABLE CAEH + {0xCC60, 0xCC60, prLV}, // Lo HANGUL SYLLABLE CYA + {0xCC61, 0xCC7B, prLVT}, // Lo [27] HANGUL SYLLABLE CYAG..HANGUL SYLLABLE CYAH + {0xCC7C, 0xCC7C, prLV}, // Lo HANGUL SYLLABLE CYAE + {0xCC7D, 0xCC97, prLVT}, // Lo [27] HANGUL SYLLABLE CYAEG..HANGUL SYLLABLE CYAEH + {0xCC98, 0xCC98, prLV}, // Lo HANGUL SYLLABLE CEO + {0xCC99, 0xCCB3, prLVT}, // Lo [27] HANGUL SYLLABLE CEOG..HANGUL SYLLABLE CEOH + {0xCCB4, 0xCCB4, prLV}, // Lo HANGUL SYLLABLE CE + {0xCCB5, 0xCCCF, prLVT}, // Lo [27] HANGUL SYLLABLE CEG..HANGUL SYLLABLE CEH + {0xCCD0, 0xCCD0, prLV}, // Lo HANGUL SYLLABLE CYEO + {0xCCD1, 0xCCEB, prLVT}, // Lo [27] HANGUL SYLLABLE CYEOG..HANGUL SYLLABLE CYEOH + {0xCCEC, 0xCCEC, prLV}, // Lo HANGUL SYLLABLE CYE + {0xCCED, 0xCD07, prLVT}, // Lo [27] HANGUL SYLLABLE CYEG..HANGUL SYLLABLE CYEH + {0xCD08, 0xCD08, prLV}, // Lo HANGUL SYLLABLE CO + {0xCD09, 0xCD23, prLVT}, // Lo [27] HANGUL SYLLABLE COG..HANGUL SYLLABLE COH + {0xCD24, 0xCD24, prLV}, // Lo HANGUL SYLLABLE CWA + {0xCD25, 0xCD3F, prLVT}, // Lo [27] HANGUL SYLLABLE CWAG..HANGUL SYLLABLE CWAH + {0xCD40, 0xCD40, prLV}, // Lo HANGUL SYLLABLE CWAE + {0xCD41, 0xCD5B, prLVT}, // Lo [27] HANGUL SYLLABLE CWAEG..HANGUL SYLLABLE CWAEH + {0xCD5C, 0xCD5C, prLV}, // Lo HANGUL SYLLABLE COE + {0xCD5D, 0xCD77, prLVT}, // Lo [27] HANGUL SYLLABLE COEG..HANGUL SYLLABLE COEH + {0xCD78, 0xCD78, prLV}, // Lo HANGUL SYLLABLE CYO + {0xCD79, 0xCD93, prLVT}, // Lo [27] HANGUL SYLLABLE CYOG..HANGUL SYLLABLE CYOH + {0xCD94, 0xCD94, prLV}, // Lo HANGUL SYLLABLE CU + {0xCD95, 0xCDAF, prLVT}, // Lo [27] HANGUL SYLLABLE CUG..HANGUL SYLLABLE CUH + {0xCDB0, 0xCDB0, prLV}, // Lo HANGUL SYLLABLE CWEO + {0xCDB1, 0xCDCB, prLVT}, // Lo [27] HANGUL SYLLABLE CWEOG..HANGUL SYLLABLE CWEOH + {0xCDCC, 0xCDCC, prLV}, // Lo HANGUL SYLLABLE CWE + {0xCDCD, 0xCDE7, prLVT}, // Lo [27] HANGUL SYLLABLE CWEG..HANGUL SYLLABLE CWEH + {0xCDE8, 0xCDE8, prLV}, // Lo HANGUL SYLLABLE CWI + {0xCDE9, 0xCE03, prLVT}, // Lo [27] HANGUL SYLLABLE CWIG..HANGUL SYLLABLE CWIH + {0xCE04, 0xCE04, prLV}, // Lo HANGUL SYLLABLE CYU + {0xCE05, 0xCE1F, prLVT}, // Lo [27] HANGUL SYLLABLE CYUG..HANGUL SYLLABLE CYUH + {0xCE20, 0xCE20, prLV}, // Lo HANGUL SYLLABLE CEU + {0xCE21, 0xCE3B, prLVT}, // Lo [27] HANGUL SYLLABLE CEUG..HANGUL SYLLABLE CEUH + {0xCE3C, 0xCE3C, prLV}, // Lo HANGUL SYLLABLE CYI + {0xCE3D, 0xCE57, prLVT}, // Lo [27] HANGUL SYLLABLE CYIG..HANGUL SYLLABLE CYIH + {0xCE58, 0xCE58, prLV}, // Lo HANGUL SYLLABLE CI + {0xCE59, 0xCE73, prLVT}, // Lo [27] HANGUL SYLLABLE CIG..HANGUL SYLLABLE CIH + {0xCE74, 0xCE74, prLV}, // Lo HANGUL SYLLABLE KA + {0xCE75, 0xCE8F, prLVT}, // Lo [27] HANGUL SYLLABLE KAG..HANGUL SYLLABLE KAH + {0xCE90, 0xCE90, prLV}, // Lo HANGUL SYLLABLE KAE + {0xCE91, 0xCEAB, prLVT}, // Lo [27] HANGUL SYLLABLE KAEG..HANGUL SYLLABLE KAEH + {0xCEAC, 0xCEAC, prLV}, // Lo HANGUL SYLLABLE KYA + {0xCEAD, 0xCEC7, prLVT}, // Lo [27] HANGUL SYLLABLE KYAG..HANGUL SYLLABLE KYAH + {0xCEC8, 0xCEC8, prLV}, // Lo HANGUL SYLLABLE KYAE + {0xCEC9, 0xCEE3, prLVT}, // Lo [27] HANGUL SYLLABLE KYAEG..HANGUL SYLLABLE KYAEH + {0xCEE4, 0xCEE4, prLV}, // Lo HANGUL SYLLABLE KEO + {0xCEE5, 0xCEFF, prLVT}, // Lo [27] HANGUL SYLLABLE KEOG..HANGUL SYLLABLE KEOH + {0xCF00, 0xCF00, prLV}, // Lo HANGUL SYLLABLE KE + {0xCF01, 0xCF1B, prLVT}, // Lo [27] HANGUL SYLLABLE KEG..HANGUL SYLLABLE KEH + {0xCF1C, 0xCF1C, prLV}, // Lo HANGUL SYLLABLE KYEO + {0xCF1D, 0xCF37, prLVT}, // Lo [27] HANGUL SYLLABLE KYEOG..HANGUL SYLLABLE KYEOH + {0xCF38, 0xCF38, prLV}, // Lo HANGUL SYLLABLE KYE + {0xCF39, 0xCF53, prLVT}, // Lo [27] HANGUL SYLLABLE KYEG..HANGUL SYLLABLE KYEH + {0xCF54, 0xCF54, prLV}, // Lo HANGUL SYLLABLE KO + {0xCF55, 0xCF6F, prLVT}, // Lo [27] HANGUL SYLLABLE KOG..HANGUL SYLLABLE KOH + {0xCF70, 0xCF70, prLV}, // Lo HANGUL SYLLABLE KWA + {0xCF71, 0xCF8B, prLVT}, // Lo [27] HANGUL SYLLABLE KWAG..HANGUL SYLLABLE KWAH + {0xCF8C, 0xCF8C, prLV}, // Lo HANGUL SYLLABLE KWAE + {0xCF8D, 0xCFA7, prLVT}, // Lo [27] HANGUL SYLLABLE KWAEG..HANGUL SYLLABLE KWAEH + {0xCFA8, 0xCFA8, prLV}, // Lo HANGUL SYLLABLE KOE + {0xCFA9, 0xCFC3, prLVT}, // Lo [27] HANGUL SYLLABLE KOEG..HANGUL SYLLABLE KOEH + {0xCFC4, 0xCFC4, prLV}, // Lo HANGUL SYLLABLE KYO + {0xCFC5, 0xCFDF, prLVT}, // Lo [27] HANGUL SYLLABLE KYOG..HANGUL SYLLABLE KYOH + {0xCFE0, 0xCFE0, prLV}, // Lo HANGUL SYLLABLE KU + {0xCFE1, 0xCFFB, prLVT}, // Lo [27] HANGUL SYLLABLE KUG..HANGUL SYLLABLE KUH + {0xCFFC, 0xCFFC, prLV}, // Lo HANGUL SYLLABLE KWEO + {0xCFFD, 0xD017, prLVT}, // Lo [27] HANGUL SYLLABLE KWEOG..HANGUL SYLLABLE KWEOH + {0xD018, 0xD018, prLV}, // Lo HANGUL SYLLABLE KWE + {0xD019, 0xD033, prLVT}, // Lo [27] HANGUL SYLLABLE KWEG..HANGUL SYLLABLE KWEH + {0xD034, 0xD034, prLV}, // Lo HANGUL SYLLABLE KWI + {0xD035, 0xD04F, prLVT}, // Lo [27] HANGUL SYLLABLE KWIG..HANGUL SYLLABLE KWIH + {0xD050, 0xD050, prLV}, // Lo HANGUL SYLLABLE KYU + {0xD051, 0xD06B, prLVT}, // Lo [27] HANGUL SYLLABLE KYUG..HANGUL SYLLABLE KYUH + {0xD06C, 0xD06C, prLV}, // Lo HANGUL SYLLABLE KEU + {0xD06D, 0xD087, prLVT}, // Lo [27] HANGUL SYLLABLE KEUG..HANGUL SYLLABLE KEUH + {0xD088, 0xD088, prLV}, // Lo HANGUL SYLLABLE KYI + {0xD089, 0xD0A3, prLVT}, // Lo [27] HANGUL SYLLABLE KYIG..HANGUL SYLLABLE KYIH + {0xD0A4, 0xD0A4, prLV}, // Lo HANGUL SYLLABLE KI + {0xD0A5, 0xD0BF, prLVT}, // Lo [27] HANGUL SYLLABLE KIG..HANGUL SYLLABLE KIH + {0xD0C0, 0xD0C0, prLV}, // Lo HANGUL SYLLABLE TA + {0xD0C1, 0xD0DB, prLVT}, // Lo [27] HANGUL SYLLABLE TAG..HANGUL SYLLABLE TAH + {0xD0DC, 0xD0DC, prLV}, // Lo HANGUL SYLLABLE TAE + {0xD0DD, 0xD0F7, prLVT}, // Lo [27] HANGUL SYLLABLE TAEG..HANGUL SYLLABLE TAEH + {0xD0F8, 0xD0F8, prLV}, // Lo HANGUL SYLLABLE TYA + {0xD0F9, 0xD113, prLVT}, // Lo [27] HANGUL SYLLABLE TYAG..HANGUL SYLLABLE TYAH + {0xD114, 0xD114, prLV}, // Lo HANGUL SYLLABLE TYAE + {0xD115, 0xD12F, prLVT}, // Lo [27] HANGUL SYLLABLE TYAEG..HANGUL SYLLABLE TYAEH + {0xD130, 0xD130, prLV}, // Lo HANGUL SYLLABLE TEO + {0xD131, 0xD14B, prLVT}, // Lo [27] HANGUL SYLLABLE TEOG..HANGUL SYLLABLE TEOH + {0xD14C, 0xD14C, prLV}, // Lo HANGUL SYLLABLE TE + {0xD14D, 0xD167, prLVT}, // Lo [27] HANGUL SYLLABLE TEG..HANGUL SYLLABLE TEH + {0xD168, 0xD168, prLV}, // Lo HANGUL SYLLABLE TYEO + {0xD169, 0xD183, prLVT}, // Lo [27] HANGUL SYLLABLE TYEOG..HANGUL SYLLABLE TYEOH + {0xD184, 0xD184, prLV}, // Lo HANGUL SYLLABLE TYE + {0xD185, 0xD19F, prLVT}, // Lo [27] HANGUL SYLLABLE TYEG..HANGUL SYLLABLE TYEH + {0xD1A0, 0xD1A0, prLV}, // Lo HANGUL SYLLABLE TO + {0xD1A1, 0xD1BB, prLVT}, // Lo [27] HANGUL SYLLABLE TOG..HANGUL SYLLABLE TOH + {0xD1BC, 0xD1BC, prLV}, // Lo HANGUL SYLLABLE TWA + {0xD1BD, 0xD1D7, prLVT}, // Lo [27] HANGUL SYLLABLE TWAG..HANGUL SYLLABLE TWAH + {0xD1D8, 0xD1D8, prLV}, // Lo HANGUL SYLLABLE TWAE + {0xD1D9, 0xD1F3, prLVT}, // Lo [27] HANGUL SYLLABLE TWAEG..HANGUL SYLLABLE TWAEH + {0xD1F4, 0xD1F4, prLV}, // Lo HANGUL SYLLABLE TOE + {0xD1F5, 0xD20F, prLVT}, // Lo [27] HANGUL SYLLABLE TOEG..HANGUL SYLLABLE TOEH + {0xD210, 0xD210, prLV}, // Lo HANGUL SYLLABLE TYO + {0xD211, 0xD22B, prLVT}, // Lo [27] HANGUL SYLLABLE TYOG..HANGUL SYLLABLE TYOH + {0xD22C, 0xD22C, prLV}, // Lo HANGUL SYLLABLE TU + {0xD22D, 0xD247, prLVT}, // Lo [27] HANGUL SYLLABLE TUG..HANGUL SYLLABLE TUH + {0xD248, 0xD248, prLV}, // Lo HANGUL SYLLABLE TWEO + {0xD249, 0xD263, prLVT}, // Lo [27] HANGUL SYLLABLE TWEOG..HANGUL SYLLABLE TWEOH + {0xD264, 0xD264, prLV}, // Lo HANGUL SYLLABLE TWE + {0xD265, 0xD27F, prLVT}, // Lo [27] HANGUL SYLLABLE TWEG..HANGUL SYLLABLE TWEH + {0xD280, 0xD280, prLV}, // Lo HANGUL SYLLABLE TWI + {0xD281, 0xD29B, prLVT}, // Lo [27] HANGUL SYLLABLE TWIG..HANGUL SYLLABLE TWIH + {0xD29C, 0xD29C, prLV}, // Lo HANGUL SYLLABLE TYU + {0xD29D, 0xD2B7, prLVT}, // Lo [27] HANGUL SYLLABLE TYUG..HANGUL SYLLABLE TYUH + {0xD2B8, 0xD2B8, prLV}, // Lo HANGUL SYLLABLE TEU + {0xD2B9, 0xD2D3, prLVT}, // Lo [27] HANGUL SYLLABLE TEUG..HANGUL SYLLABLE TEUH + {0xD2D4, 0xD2D4, prLV}, // Lo HANGUL SYLLABLE TYI + {0xD2D5, 0xD2EF, prLVT}, // Lo [27] HANGUL SYLLABLE TYIG..HANGUL SYLLABLE TYIH + {0xD2F0, 0xD2F0, prLV}, // Lo HANGUL SYLLABLE TI + {0xD2F1, 0xD30B, prLVT}, // Lo [27] HANGUL SYLLABLE TIG..HANGUL SYLLABLE TIH + {0xD30C, 0xD30C, prLV}, // Lo HANGUL SYLLABLE PA + {0xD30D, 0xD327, prLVT}, // Lo [27] HANGUL SYLLABLE PAG..HANGUL SYLLABLE PAH + {0xD328, 0xD328, prLV}, // Lo HANGUL SYLLABLE PAE + {0xD329, 0xD343, prLVT}, // Lo [27] HANGUL SYLLABLE PAEG..HANGUL SYLLABLE PAEH + {0xD344, 0xD344, prLV}, // Lo HANGUL SYLLABLE PYA + {0xD345, 0xD35F, prLVT}, // Lo [27] HANGUL SYLLABLE PYAG..HANGUL SYLLABLE PYAH + {0xD360, 0xD360, prLV}, // Lo HANGUL SYLLABLE PYAE + {0xD361, 0xD37B, prLVT}, // Lo [27] HANGUL SYLLABLE PYAEG..HANGUL SYLLABLE PYAEH + {0xD37C, 0xD37C, prLV}, // Lo HANGUL SYLLABLE PEO + {0xD37D, 0xD397, prLVT}, // Lo [27] HANGUL SYLLABLE PEOG..HANGUL SYLLABLE PEOH + {0xD398, 0xD398, prLV}, // Lo HANGUL SYLLABLE PE + {0xD399, 0xD3B3, prLVT}, // Lo [27] HANGUL SYLLABLE PEG..HANGUL SYLLABLE PEH + {0xD3B4, 0xD3B4, prLV}, // Lo HANGUL SYLLABLE PYEO + {0xD3B5, 0xD3CF, prLVT}, // Lo [27] HANGUL SYLLABLE PYEOG..HANGUL SYLLABLE PYEOH + {0xD3D0, 0xD3D0, prLV}, // Lo HANGUL SYLLABLE PYE + {0xD3D1, 0xD3EB, prLVT}, // Lo [27] HANGUL SYLLABLE PYEG..HANGUL SYLLABLE PYEH + {0xD3EC, 0xD3EC, prLV}, // Lo HANGUL SYLLABLE PO + {0xD3ED, 0xD407, prLVT}, // Lo [27] HANGUL SYLLABLE POG..HANGUL SYLLABLE POH + {0xD408, 0xD408, prLV}, // Lo HANGUL SYLLABLE PWA + {0xD409, 0xD423, prLVT}, // Lo [27] HANGUL SYLLABLE PWAG..HANGUL SYLLABLE PWAH + {0xD424, 0xD424, prLV}, // Lo HANGUL SYLLABLE PWAE + {0xD425, 0xD43F, prLVT}, // Lo [27] HANGUL SYLLABLE PWAEG..HANGUL SYLLABLE PWAEH + {0xD440, 0xD440, prLV}, // Lo HANGUL SYLLABLE POE + {0xD441, 0xD45B, prLVT}, // Lo [27] HANGUL SYLLABLE POEG..HANGUL SYLLABLE POEH + {0xD45C, 0xD45C, prLV}, // Lo HANGUL SYLLABLE PYO + {0xD45D, 0xD477, prLVT}, // Lo [27] HANGUL SYLLABLE PYOG..HANGUL SYLLABLE PYOH + {0xD478, 0xD478, prLV}, // Lo HANGUL SYLLABLE PU + {0xD479, 0xD493, prLVT}, // Lo [27] HANGUL SYLLABLE PUG..HANGUL SYLLABLE PUH + {0xD494, 0xD494, prLV}, // Lo HANGUL SYLLABLE PWEO + {0xD495, 0xD4AF, prLVT}, // Lo [27] HANGUL SYLLABLE PWEOG..HANGUL SYLLABLE PWEOH + {0xD4B0, 0xD4B0, prLV}, // Lo HANGUL SYLLABLE PWE + {0xD4B1, 0xD4CB, prLVT}, // Lo [27] HANGUL SYLLABLE PWEG..HANGUL SYLLABLE PWEH + {0xD4CC, 0xD4CC, prLV}, // Lo HANGUL SYLLABLE PWI + {0xD4CD, 0xD4E7, prLVT}, // Lo [27] HANGUL SYLLABLE PWIG..HANGUL SYLLABLE PWIH + {0xD4E8, 0xD4E8, prLV}, // Lo HANGUL SYLLABLE PYU + {0xD4E9, 0xD503, prLVT}, // Lo [27] HANGUL SYLLABLE PYUG..HANGUL SYLLABLE PYUH + {0xD504, 0xD504, prLV}, // Lo HANGUL SYLLABLE PEU + {0xD505, 0xD51F, prLVT}, // Lo [27] HANGUL SYLLABLE PEUG..HANGUL SYLLABLE PEUH + {0xD520, 0xD520, prLV}, // Lo HANGUL SYLLABLE PYI + {0xD521, 0xD53B, prLVT}, // Lo [27] HANGUL SYLLABLE PYIG..HANGUL SYLLABLE PYIH + {0xD53C, 0xD53C, prLV}, // Lo HANGUL SYLLABLE PI + {0xD53D, 0xD557, prLVT}, // Lo [27] HANGUL SYLLABLE PIG..HANGUL SYLLABLE PIH + {0xD558, 0xD558, prLV}, // Lo HANGUL SYLLABLE HA + {0xD559, 0xD573, prLVT}, // Lo [27] HANGUL SYLLABLE HAG..HANGUL SYLLABLE HAH + {0xD574, 0xD574, prLV}, // Lo HANGUL SYLLABLE HAE + {0xD575, 0xD58F, prLVT}, // Lo [27] HANGUL SYLLABLE HAEG..HANGUL SYLLABLE HAEH + {0xD590, 0xD590, prLV}, // Lo HANGUL SYLLABLE HYA + {0xD591, 0xD5AB, prLVT}, // Lo [27] HANGUL SYLLABLE HYAG..HANGUL SYLLABLE HYAH + {0xD5AC, 0xD5AC, prLV}, // Lo HANGUL SYLLABLE HYAE + {0xD5AD, 0xD5C7, prLVT}, // Lo [27] HANGUL SYLLABLE HYAEG..HANGUL SYLLABLE HYAEH + {0xD5C8, 0xD5C8, prLV}, // Lo HANGUL SYLLABLE HEO + {0xD5C9, 0xD5E3, prLVT}, // Lo [27] HANGUL SYLLABLE HEOG..HANGUL SYLLABLE HEOH + {0xD5E4, 0xD5E4, prLV}, // Lo HANGUL SYLLABLE HE + {0xD5E5, 0xD5FF, prLVT}, // Lo [27] HANGUL SYLLABLE HEG..HANGUL SYLLABLE HEH + {0xD600, 0xD600, prLV}, // Lo HANGUL SYLLABLE HYEO + {0xD601, 0xD61B, prLVT}, // Lo [27] HANGUL SYLLABLE HYEOG..HANGUL SYLLABLE HYEOH + {0xD61C, 0xD61C, prLV}, // Lo HANGUL SYLLABLE HYE + {0xD61D, 0xD637, prLVT}, // Lo [27] HANGUL SYLLABLE HYEG..HANGUL SYLLABLE HYEH + {0xD638, 0xD638, prLV}, // Lo HANGUL SYLLABLE HO + {0xD639, 0xD653, prLVT}, // Lo [27] HANGUL SYLLABLE HOG..HANGUL SYLLABLE HOH + {0xD654, 0xD654, prLV}, // Lo HANGUL SYLLABLE HWA + {0xD655, 0xD66F, prLVT}, // Lo [27] HANGUL SYLLABLE HWAG..HANGUL SYLLABLE HWAH + {0xD670, 0xD670, prLV}, // Lo HANGUL SYLLABLE HWAE + {0xD671, 0xD68B, prLVT}, // Lo [27] HANGUL SYLLABLE HWAEG..HANGUL SYLLABLE HWAEH + {0xD68C, 0xD68C, prLV}, // Lo HANGUL SYLLABLE HOE + {0xD68D, 0xD6A7, prLVT}, // Lo [27] HANGUL SYLLABLE HOEG..HANGUL SYLLABLE HOEH + {0xD6A8, 0xD6A8, prLV}, // Lo HANGUL SYLLABLE HYO + {0xD6A9, 0xD6C3, prLVT}, // Lo [27] HANGUL SYLLABLE HYOG..HANGUL SYLLABLE HYOH + {0xD6C4, 0xD6C4, prLV}, // Lo HANGUL SYLLABLE HU + {0xD6C5, 0xD6DF, prLVT}, // Lo [27] HANGUL SYLLABLE HUG..HANGUL SYLLABLE HUH + {0xD6E0, 0xD6E0, prLV}, // Lo HANGUL SYLLABLE HWEO + {0xD6E1, 0xD6FB, prLVT}, // Lo [27] HANGUL SYLLABLE HWEOG..HANGUL SYLLABLE HWEOH + {0xD6FC, 0xD6FC, prLV}, // Lo HANGUL SYLLABLE HWE + {0xD6FD, 0xD717, prLVT}, // Lo [27] HANGUL SYLLABLE HWEG..HANGUL SYLLABLE HWEH + {0xD718, 0xD718, prLV}, // Lo HANGUL SYLLABLE HWI + {0xD719, 0xD733, prLVT}, // Lo [27] HANGUL SYLLABLE HWIG..HANGUL SYLLABLE HWIH + {0xD734, 0xD734, prLV}, // Lo HANGUL SYLLABLE HYU + {0xD735, 0xD74F, prLVT}, // Lo [27] HANGUL SYLLABLE HYUG..HANGUL SYLLABLE HYUH + {0xD750, 0xD750, prLV}, // Lo HANGUL SYLLABLE HEU + {0xD751, 0xD76B, prLVT}, // Lo [27] HANGUL SYLLABLE HEUG..HANGUL SYLLABLE HEUH + {0xD76C, 0xD76C, prLV}, // Lo HANGUL SYLLABLE HYI + {0xD76D, 0xD787, prLVT}, // Lo [27] HANGUL SYLLABLE HYIG..HANGUL SYLLABLE HYIH + {0xD788, 0xD788, prLV}, // Lo HANGUL SYLLABLE HI + {0xD789, 0xD7A3, prLVT}, // Lo [27] HANGUL SYLLABLE HIG..HANGUL SYLLABLE HIH + {0xD7B0, 0xD7C6, prV}, // Lo [23] HANGUL JUNGSEONG O-YEO..HANGUL JUNGSEONG ARAEA-E + {0xD7CB, 0xD7FB, prT}, // Lo [49] HANGUL JONGSEONG NIEUN-RIEUL..HANGUL JONGSEONG PHIEUPH-THIEUTH + {0xFB1E, 0xFB1E, prExtend}, // Mn HEBREW POINT JUDEO-SPANISH VARIKA + {0xFE00, 0xFE0F, prExtend}, // Mn [16] VARIATION SELECTOR-1..VARIATION SELECTOR-16 + {0xFE20, 0xFE2F, prExtend}, // Mn [16] COMBINING LIGATURE LEFT HALF..COMBINING CYRILLIC TITLO RIGHT HALF + {0xFEFF, 0xFEFF, prControl}, // Cf ZERO WIDTH NO-BREAK SPACE + {0xFF9E, 0xFF9F, prExtend}, // Lm [2] HALFWIDTH KATAKANA VOICED SOUND MARK..HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK + {0xFFF0, 0xFFF8, prControl}, // Cn [9] .. + {0xFFF9, 0xFFFB, prControl}, // Cf [3] INTERLINEAR ANNOTATION ANCHOR..INTERLINEAR ANNOTATION TERMINATOR + {0x101FD, 0x101FD, prExtend}, // Mn PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE + {0x102E0, 0x102E0, prExtend}, // Mn COPTIC EPACT THOUSANDS MARK + {0x10376, 0x1037A, prExtend}, // Mn [5] COMBINING OLD PERMIC LETTER AN..COMBINING OLD PERMIC LETTER SII + {0x10A01, 0x10A03, prExtend}, // Mn [3] KHAROSHTHI VOWEL SIGN I..KHAROSHTHI VOWEL SIGN VOCALIC R + {0x10A05, 0x10A06, prExtend}, // Mn [2] KHAROSHTHI VOWEL SIGN E..KHAROSHTHI VOWEL SIGN O + {0x10A0C, 0x10A0F, prExtend}, // Mn [4] KHAROSHTHI VOWEL LENGTH MARK..KHAROSHTHI SIGN VISARGA + {0x10A38, 0x10A3A, prExtend}, // Mn [3] KHAROSHTHI SIGN BAR ABOVE..KHAROSHTHI SIGN DOT BELOW + {0x10A3F, 0x10A3F, prExtend}, // Mn KHAROSHTHI VIRAMA + {0x10AE5, 0x10AE6, prExtend}, // Mn [2] MANICHAEAN ABBREVIATION MARK ABOVE..MANICHAEAN ABBREVIATION MARK BELOW + {0x10D24, 0x10D27, prExtend}, // Mn [4] HANIFI ROHINGYA SIGN HARBAHAY..HANIFI ROHINGYA SIGN TASSI + {0x10F46, 0x10F50, prExtend}, // Mn [11] SOGDIAN COMBINING DOT BELOW..SOGDIAN COMBINING STROKE BELOW + {0x11000, 0x11000, prSpacingMark}, // Mc BRAHMI SIGN CANDRABINDU + {0x11001, 0x11001, prExtend}, // Mn BRAHMI SIGN ANUSVARA + {0x11002, 0x11002, prSpacingMark}, // Mc BRAHMI SIGN VISARGA + {0x11038, 0x11046, prExtend}, // Mn [15] BRAHMI VOWEL SIGN AA..BRAHMI VIRAMA + {0x1107F, 0x11081, prExtend}, // Mn [3] BRAHMI NUMBER JOINER..KAITHI SIGN ANUSVARA + {0x11082, 0x11082, prSpacingMark}, // Mc KAITHI SIGN VISARGA + {0x110B0, 0x110B2, prSpacingMark}, // Mc [3] KAITHI VOWEL SIGN AA..KAITHI VOWEL SIGN II + {0x110B3, 0x110B6, prExtend}, // Mn [4] KAITHI VOWEL SIGN U..KAITHI VOWEL SIGN AI + {0x110B7, 0x110B8, prSpacingMark}, // Mc [2] KAITHI VOWEL SIGN O..KAITHI VOWEL SIGN AU + {0x110B9, 0x110BA, prExtend}, // Mn [2] KAITHI SIGN VIRAMA..KAITHI SIGN NUKTA + {0x110BD, 0x110BD, prPreprend}, // Cf KAITHI NUMBER SIGN + {0x110CD, 0x110CD, prPreprend}, // Cf KAITHI NUMBER SIGN ABOVE + {0x11100, 0x11102, prExtend}, // Mn [3] CHAKMA SIGN CANDRABINDU..CHAKMA SIGN VISARGA + {0x11127, 0x1112B, prExtend}, // Mn [5] CHAKMA VOWEL SIGN A..CHAKMA VOWEL SIGN UU + {0x1112C, 0x1112C, prSpacingMark}, // Mc CHAKMA VOWEL SIGN E + {0x1112D, 0x11134, prExtend}, // Mn [8] CHAKMA VOWEL SIGN AI..CHAKMA MAAYYAA + {0x11145, 0x11146, prSpacingMark}, // Mc [2] CHAKMA VOWEL SIGN AA..CHAKMA VOWEL SIGN EI + {0x11173, 0x11173, prExtend}, // Mn MAHAJANI SIGN NUKTA + {0x11180, 0x11181, prExtend}, // Mn [2] SHARADA SIGN CANDRABINDU..SHARADA SIGN ANUSVARA + {0x11182, 0x11182, prSpacingMark}, // Mc SHARADA SIGN VISARGA + {0x111B3, 0x111B5, prSpacingMark}, // Mc [3] SHARADA VOWEL SIGN AA..SHARADA VOWEL SIGN II + {0x111B6, 0x111BE, prExtend}, // Mn [9] SHARADA VOWEL SIGN U..SHARADA VOWEL SIGN O + {0x111BF, 0x111C0, prSpacingMark}, // Mc [2] SHARADA VOWEL SIGN AU..SHARADA SIGN VIRAMA + {0x111C2, 0x111C3, prPreprend}, // Lo [2] SHARADA SIGN JIHVAMULIYA..SHARADA SIGN UPADHMANIYA + {0x111C9, 0x111CC, prExtend}, // Mn [4] SHARADA SANDHI MARK..SHARADA EXTRA SHORT VOWEL MARK + {0x1122C, 0x1122E, prSpacingMark}, // Mc [3] KHOJKI VOWEL SIGN AA..KHOJKI VOWEL SIGN II + {0x1122F, 0x11231, prExtend}, // Mn [3] KHOJKI VOWEL SIGN U..KHOJKI VOWEL SIGN AI + {0x11232, 0x11233, prSpacingMark}, // Mc [2] KHOJKI VOWEL SIGN O..KHOJKI VOWEL SIGN AU + {0x11234, 0x11234, prExtend}, // Mn KHOJKI SIGN ANUSVARA + {0x11235, 0x11235, prSpacingMark}, // Mc KHOJKI SIGN VIRAMA + {0x11236, 0x11237, prExtend}, // Mn [2] KHOJKI SIGN NUKTA..KHOJKI SIGN SHADDA + {0x1123E, 0x1123E, prExtend}, // Mn KHOJKI SIGN SUKUN + {0x112DF, 0x112DF, prExtend}, // Mn KHUDAWADI SIGN ANUSVARA + {0x112E0, 0x112E2, prSpacingMark}, // Mc [3] KHUDAWADI VOWEL SIGN AA..KHUDAWADI VOWEL SIGN II + {0x112E3, 0x112EA, prExtend}, // Mn [8] KHUDAWADI VOWEL SIGN U..KHUDAWADI SIGN VIRAMA + {0x11300, 0x11301, prExtend}, // Mn [2] GRANTHA SIGN COMBINING ANUSVARA ABOVE..GRANTHA SIGN CANDRABINDU + {0x11302, 0x11303, prSpacingMark}, // Mc [2] GRANTHA SIGN ANUSVARA..GRANTHA SIGN VISARGA + {0x1133B, 0x1133C, prExtend}, // Mn [2] COMBINING BINDU BELOW..GRANTHA SIGN NUKTA + {0x1133E, 0x1133E, prExtend}, // Mc GRANTHA VOWEL SIGN AA + {0x1133F, 0x1133F, prSpacingMark}, // Mc GRANTHA VOWEL SIGN I + {0x11340, 0x11340, prExtend}, // Mn GRANTHA VOWEL SIGN II + {0x11341, 0x11344, prSpacingMark}, // Mc [4] GRANTHA VOWEL SIGN U..GRANTHA VOWEL SIGN VOCALIC RR + {0x11347, 0x11348, prSpacingMark}, // Mc [2] GRANTHA VOWEL SIGN EE..GRANTHA VOWEL SIGN AI + {0x1134B, 0x1134D, prSpacingMark}, // Mc [3] GRANTHA VOWEL SIGN OO..GRANTHA SIGN VIRAMA + {0x11357, 0x11357, prExtend}, // Mc GRANTHA AU LENGTH MARK + {0x11362, 0x11363, prSpacingMark}, // Mc [2] GRANTHA VOWEL SIGN VOCALIC L..GRANTHA VOWEL SIGN VOCALIC LL + {0x11366, 0x1136C, prExtend}, // Mn [7] COMBINING GRANTHA DIGIT ZERO..COMBINING GRANTHA DIGIT SIX + {0x11370, 0x11374, prExtend}, // Mn [5] COMBINING GRANTHA LETTER A..COMBINING GRANTHA LETTER PA + {0x11435, 0x11437, prSpacingMark}, // Mc [3] NEWA VOWEL SIGN AA..NEWA VOWEL SIGN II + {0x11438, 0x1143F, prExtend}, // Mn [8] NEWA VOWEL SIGN U..NEWA VOWEL SIGN AI + {0x11440, 0x11441, prSpacingMark}, // Mc [2] NEWA VOWEL SIGN O..NEWA VOWEL SIGN AU + {0x11442, 0x11444, prExtend}, // Mn [3] NEWA SIGN VIRAMA..NEWA SIGN ANUSVARA + {0x11445, 0x11445, prSpacingMark}, // Mc NEWA SIGN VISARGA + {0x11446, 0x11446, prExtend}, // Mn NEWA SIGN NUKTA + {0x1145E, 0x1145E, prExtend}, // Mn NEWA SANDHI MARK + {0x114B0, 0x114B0, prExtend}, // Mc TIRHUTA VOWEL SIGN AA + {0x114B1, 0x114B2, prSpacingMark}, // Mc [2] TIRHUTA VOWEL SIGN I..TIRHUTA VOWEL SIGN II + {0x114B3, 0x114B8, prExtend}, // Mn [6] TIRHUTA VOWEL SIGN U..TIRHUTA VOWEL SIGN VOCALIC LL + {0x114B9, 0x114B9, prSpacingMark}, // Mc TIRHUTA VOWEL SIGN E + {0x114BA, 0x114BA, prExtend}, // Mn TIRHUTA VOWEL SIGN SHORT E + {0x114BB, 0x114BC, prSpacingMark}, // Mc [2] TIRHUTA VOWEL SIGN AI..TIRHUTA VOWEL SIGN O + {0x114BD, 0x114BD, prExtend}, // Mc TIRHUTA VOWEL SIGN SHORT O + {0x114BE, 0x114BE, prSpacingMark}, // Mc TIRHUTA VOWEL SIGN AU + {0x114BF, 0x114C0, prExtend}, // Mn [2] TIRHUTA SIGN CANDRABINDU..TIRHUTA SIGN ANUSVARA + {0x114C1, 0x114C1, prSpacingMark}, // Mc TIRHUTA SIGN VISARGA + {0x114C2, 0x114C3, prExtend}, // Mn [2] TIRHUTA SIGN VIRAMA..TIRHUTA SIGN NUKTA + {0x115AF, 0x115AF, prExtend}, // Mc SIDDHAM VOWEL SIGN AA + {0x115B0, 0x115B1, prSpacingMark}, // Mc [2] SIDDHAM VOWEL SIGN I..SIDDHAM VOWEL SIGN II + {0x115B2, 0x115B5, prExtend}, // Mn [4] SIDDHAM VOWEL SIGN U..SIDDHAM VOWEL SIGN VOCALIC RR + {0x115B8, 0x115BB, prSpacingMark}, // Mc [4] SIDDHAM VOWEL SIGN E..SIDDHAM VOWEL SIGN AU + {0x115BC, 0x115BD, prExtend}, // Mn [2] SIDDHAM SIGN CANDRABINDU..SIDDHAM SIGN ANUSVARA + {0x115BE, 0x115BE, prSpacingMark}, // Mc SIDDHAM SIGN VISARGA + {0x115BF, 0x115C0, prExtend}, // Mn [2] SIDDHAM SIGN VIRAMA..SIDDHAM SIGN NUKTA + {0x115DC, 0x115DD, prExtend}, // Mn [2] SIDDHAM VOWEL SIGN ALTERNATE U..SIDDHAM VOWEL SIGN ALTERNATE UU + {0x11630, 0x11632, prSpacingMark}, // Mc [3] MODI VOWEL SIGN AA..MODI VOWEL SIGN II + {0x11633, 0x1163A, prExtend}, // Mn [8] MODI VOWEL SIGN U..MODI VOWEL SIGN AI + {0x1163B, 0x1163C, prSpacingMark}, // Mc [2] MODI VOWEL SIGN O..MODI VOWEL SIGN AU + {0x1163D, 0x1163D, prExtend}, // Mn MODI SIGN ANUSVARA + {0x1163E, 0x1163E, prSpacingMark}, // Mc MODI SIGN VISARGA + {0x1163F, 0x11640, prExtend}, // Mn [2] MODI SIGN VIRAMA..MODI SIGN ARDHACANDRA + {0x116AB, 0x116AB, prExtend}, // Mn TAKRI SIGN ANUSVARA + {0x116AC, 0x116AC, prSpacingMark}, // Mc TAKRI SIGN VISARGA + {0x116AD, 0x116AD, prExtend}, // Mn TAKRI VOWEL SIGN AA + {0x116AE, 0x116AF, prSpacingMark}, // Mc [2] TAKRI VOWEL SIGN I..TAKRI VOWEL SIGN II + {0x116B0, 0x116B5, prExtend}, // Mn [6] TAKRI VOWEL SIGN U..TAKRI VOWEL SIGN AU + {0x116B6, 0x116B6, prSpacingMark}, // Mc TAKRI SIGN VIRAMA + {0x116B7, 0x116B7, prExtend}, // Mn TAKRI SIGN NUKTA + {0x1171D, 0x1171F, prExtend}, // Mn [3] AHOM CONSONANT SIGN MEDIAL LA..AHOM CONSONANT SIGN MEDIAL LIGATING RA + {0x11720, 0x11721, prSpacingMark}, // Mc [2] AHOM VOWEL SIGN A..AHOM VOWEL SIGN AA + {0x11722, 0x11725, prExtend}, // Mn [4] AHOM VOWEL SIGN I..AHOM VOWEL SIGN UU + {0x11726, 0x11726, prSpacingMark}, // Mc AHOM VOWEL SIGN E + {0x11727, 0x1172B, prExtend}, // Mn [5] AHOM VOWEL SIGN AW..AHOM SIGN KILLER + {0x1182C, 0x1182E, prSpacingMark}, // Mc [3] DOGRA VOWEL SIGN AA..DOGRA VOWEL SIGN II + {0x1182F, 0x11837, prExtend}, // Mn [9] DOGRA VOWEL SIGN U..DOGRA SIGN ANUSVARA + {0x11838, 0x11838, prSpacingMark}, // Mc DOGRA SIGN VISARGA + {0x11839, 0x1183A, prExtend}, // Mn [2] DOGRA SIGN VIRAMA..DOGRA SIGN NUKTA + {0x119D1, 0x119D3, prSpacingMark}, // Mc [3] NANDINAGARI VOWEL SIGN AA..NANDINAGARI VOWEL SIGN II + {0x119D4, 0x119D7, prExtend}, // Mn [4] NANDINAGARI VOWEL SIGN U..NANDINAGARI VOWEL SIGN VOCALIC RR + {0x119DA, 0x119DB, prExtend}, // Mn [2] NANDINAGARI VOWEL SIGN E..NANDINAGARI VOWEL SIGN AI + {0x119DC, 0x119DF, prSpacingMark}, // Mc [4] NANDINAGARI VOWEL SIGN O..NANDINAGARI SIGN VISARGA + {0x119E0, 0x119E0, prExtend}, // Mn NANDINAGARI SIGN VIRAMA + {0x119E4, 0x119E4, prSpacingMark}, // Mc NANDINAGARI VOWEL SIGN PRISHTHAMATRA E + {0x11A01, 0x11A0A, prExtend}, // Mn [10] ZANABAZAR SQUARE VOWEL SIGN I..ZANABAZAR SQUARE VOWEL LENGTH MARK + {0x11A33, 0x11A38, prExtend}, // Mn [6] ZANABAZAR SQUARE FINAL CONSONANT MARK..ZANABAZAR SQUARE SIGN ANUSVARA + {0x11A39, 0x11A39, prSpacingMark}, // Mc ZANABAZAR SQUARE SIGN VISARGA + {0x11A3A, 0x11A3A, prPreprend}, // Lo ZANABAZAR SQUARE CLUSTER-INITIAL LETTER RA + {0x11A3B, 0x11A3E, prExtend}, // Mn [4] ZANABAZAR SQUARE CLUSTER-FINAL LETTER YA..ZANABAZAR SQUARE CLUSTER-FINAL LETTER VA + {0x11A47, 0x11A47, prExtend}, // Mn ZANABAZAR SQUARE SUBJOINER + {0x11A51, 0x11A56, prExtend}, // Mn [6] SOYOMBO VOWEL SIGN I..SOYOMBO VOWEL SIGN OE + {0x11A57, 0x11A58, prSpacingMark}, // Mc [2] SOYOMBO VOWEL SIGN AI..SOYOMBO VOWEL SIGN AU + {0x11A59, 0x11A5B, prExtend}, // Mn [3] SOYOMBO VOWEL SIGN VOCALIC R..SOYOMBO VOWEL LENGTH MARK + {0x11A84, 0x11A89, prPreprend}, // Lo [6] SOYOMBO SIGN JIHVAMULIYA..SOYOMBO CLUSTER-INITIAL LETTER SA + {0x11A8A, 0x11A96, prExtend}, // Mn [13] SOYOMBO FINAL CONSONANT SIGN G..SOYOMBO SIGN ANUSVARA + {0x11A97, 0x11A97, prSpacingMark}, // Mc SOYOMBO SIGN VISARGA + {0x11A98, 0x11A99, prExtend}, // Mn [2] SOYOMBO GEMINATION MARK..SOYOMBO SUBJOINER + {0x11C2F, 0x11C2F, prSpacingMark}, // Mc BHAIKSUKI VOWEL SIGN AA + {0x11C30, 0x11C36, prExtend}, // Mn [7] BHAIKSUKI VOWEL SIGN I..BHAIKSUKI VOWEL SIGN VOCALIC L + {0x11C38, 0x11C3D, prExtend}, // Mn [6] BHAIKSUKI VOWEL SIGN E..BHAIKSUKI SIGN ANUSVARA + {0x11C3E, 0x11C3E, prSpacingMark}, // Mc BHAIKSUKI SIGN VISARGA + {0x11C3F, 0x11C3F, prExtend}, // Mn BHAIKSUKI SIGN VIRAMA + {0x11C92, 0x11CA7, prExtend}, // Mn [22] MARCHEN SUBJOINED LETTER KA..MARCHEN SUBJOINED LETTER ZA + {0x11CA9, 0x11CA9, prSpacingMark}, // Mc MARCHEN SUBJOINED LETTER YA + {0x11CAA, 0x11CB0, prExtend}, // Mn [7] MARCHEN SUBJOINED LETTER RA..MARCHEN VOWEL SIGN AA + {0x11CB1, 0x11CB1, prSpacingMark}, // Mc MARCHEN VOWEL SIGN I + {0x11CB2, 0x11CB3, prExtend}, // Mn [2] MARCHEN VOWEL SIGN U..MARCHEN VOWEL SIGN E + {0x11CB4, 0x11CB4, prSpacingMark}, // Mc MARCHEN VOWEL SIGN O + {0x11CB5, 0x11CB6, prExtend}, // Mn [2] MARCHEN SIGN ANUSVARA..MARCHEN SIGN CANDRABINDU + {0x11D31, 0x11D36, prExtend}, // Mn [6] MASARAM GONDI VOWEL SIGN AA..MASARAM GONDI VOWEL SIGN VOCALIC R + {0x11D3A, 0x11D3A, prExtend}, // Mn MASARAM GONDI VOWEL SIGN E + {0x11D3C, 0x11D3D, prExtend}, // Mn [2] MASARAM GONDI VOWEL SIGN AI..MASARAM GONDI VOWEL SIGN O + {0x11D3F, 0x11D45, prExtend}, // Mn [7] MASARAM GONDI VOWEL SIGN AU..MASARAM GONDI VIRAMA + {0x11D46, 0x11D46, prPreprend}, // Lo MASARAM GONDI REPHA + {0x11D47, 0x11D47, prExtend}, // Mn MASARAM GONDI RA-KARA + {0x11D8A, 0x11D8E, prSpacingMark}, // Mc [5] GUNJALA GONDI VOWEL SIGN AA..GUNJALA GONDI VOWEL SIGN UU + {0x11D90, 0x11D91, prExtend}, // Mn [2] GUNJALA GONDI VOWEL SIGN EE..GUNJALA GONDI VOWEL SIGN AI + {0x11D93, 0x11D94, prSpacingMark}, // Mc [2] GUNJALA GONDI VOWEL SIGN OO..GUNJALA GONDI VOWEL SIGN AU + {0x11D95, 0x11D95, prExtend}, // Mn GUNJALA GONDI SIGN ANUSVARA + {0x11D96, 0x11D96, prSpacingMark}, // Mc GUNJALA GONDI SIGN VISARGA + {0x11D97, 0x11D97, prExtend}, // Mn GUNJALA GONDI VIRAMA + {0x11EF3, 0x11EF4, prExtend}, // Mn [2] MAKASAR VOWEL SIGN I..MAKASAR VOWEL SIGN U + {0x11EF5, 0x11EF6, prSpacingMark}, // Mc [2] MAKASAR VOWEL SIGN E..MAKASAR VOWEL SIGN O + {0x13430, 0x13438, prControl}, // Cf [9] EGYPTIAN HIEROGLYPH VERTICAL JOINER..EGYPTIAN HIEROGLYPH END SEGMENT + {0x16AF0, 0x16AF4, prExtend}, // Mn [5] BASSA VAH COMBINING HIGH TONE..BASSA VAH COMBINING HIGH-LOW TONE + {0x16B30, 0x16B36, prExtend}, // Mn [7] PAHAWH HMONG MARK CIM TUB..PAHAWH HMONG MARK CIM TAUM + {0x16F4F, 0x16F4F, prExtend}, // Mn MIAO SIGN CONSONANT MODIFIER BAR + {0x16F51, 0x16F87, prSpacingMark}, // Mc [55] MIAO SIGN ASPIRATION..MIAO VOWEL SIGN UI + {0x16F8F, 0x16F92, prExtend}, // Mn [4] MIAO TONE RIGHT..MIAO TONE BELOW + {0x1BC9D, 0x1BC9E, prExtend}, // Mn [2] DUPLOYAN THICK LETTER SELECTOR..DUPLOYAN DOUBLE MARK + {0x1BCA0, 0x1BCA3, prControl}, // Cf [4] SHORTHAND FORMAT LETTER OVERLAP..SHORTHAND FORMAT UP STEP + {0x1D165, 0x1D165, prExtend}, // Mc MUSICAL SYMBOL COMBINING STEM + {0x1D166, 0x1D166, prSpacingMark}, // Mc MUSICAL SYMBOL COMBINING SPRECHGESANG STEM + {0x1D167, 0x1D169, prExtend}, // Mn [3] MUSICAL SYMBOL COMBINING TREMOLO-1..MUSICAL SYMBOL COMBINING TREMOLO-3 + {0x1D16D, 0x1D16D, prSpacingMark}, // Mc MUSICAL SYMBOL COMBINING AUGMENTATION DOT + {0x1D16E, 0x1D172, prExtend}, // Mc [5] MUSICAL SYMBOL COMBINING FLAG-1..MUSICAL SYMBOL COMBINING FLAG-5 + {0x1D173, 0x1D17A, prControl}, // Cf [8] MUSICAL SYMBOL BEGIN BEAM..MUSICAL SYMBOL END PHRASE + {0x1D17B, 0x1D182, prExtend}, // Mn [8] MUSICAL SYMBOL COMBINING ACCENT..MUSICAL SYMBOL COMBINING LOURE + {0x1D185, 0x1D18B, prExtend}, // Mn [7] MUSICAL SYMBOL COMBINING DOIT..MUSICAL SYMBOL COMBINING TRIPLE TONGUE + {0x1D1AA, 0x1D1AD, prExtend}, // Mn [4] MUSICAL SYMBOL COMBINING DOWN BOW..MUSICAL SYMBOL COMBINING SNAP PIZZICATO + {0x1D242, 0x1D244, prExtend}, // Mn [3] COMBINING GREEK MUSICAL TRISEME..COMBINING GREEK MUSICAL PENTASEME + {0x1DA00, 0x1DA36, prExtend}, // Mn [55] SIGNWRITING HEAD RIM..SIGNWRITING AIR SUCKING IN + {0x1DA3B, 0x1DA6C, prExtend}, // Mn [50] SIGNWRITING MOUTH CLOSED NEUTRAL..SIGNWRITING EXCITEMENT + {0x1DA75, 0x1DA75, prExtend}, // Mn SIGNWRITING UPPER BODY TILTING FROM HIP JOINTS + {0x1DA84, 0x1DA84, prExtend}, // Mn SIGNWRITING LOCATION HEAD NECK + {0x1DA9B, 0x1DA9F, prExtend}, // Mn [5] SIGNWRITING FILL MODIFIER-2..SIGNWRITING FILL MODIFIER-6 + {0x1DAA1, 0x1DAAF, prExtend}, // Mn [15] SIGNWRITING ROTATION MODIFIER-2..SIGNWRITING ROTATION MODIFIER-16 + {0x1E000, 0x1E006, prExtend}, // Mn [7] COMBINING GLAGOLITIC LETTER AZU..COMBINING GLAGOLITIC LETTER ZHIVETE + {0x1E008, 0x1E018, prExtend}, // Mn [17] COMBINING GLAGOLITIC LETTER ZEMLJA..COMBINING GLAGOLITIC LETTER HERU + {0x1E01B, 0x1E021, prExtend}, // Mn [7] COMBINING GLAGOLITIC LETTER SHTA..COMBINING GLAGOLITIC LETTER YATI + {0x1E023, 0x1E024, prExtend}, // Mn [2] COMBINING GLAGOLITIC LETTER YU..COMBINING GLAGOLITIC LETTER SMALL YUS + {0x1E026, 0x1E02A, prExtend}, // Mn [5] COMBINING GLAGOLITIC LETTER YO..COMBINING GLAGOLITIC LETTER FITA + {0x1E130, 0x1E136, prExtend}, // Mn [7] NYIAKENG PUACHUE HMONG TONE-B..NYIAKENG PUACHUE HMONG TONE-D + {0x1E2EC, 0x1E2EF, prExtend}, // Mn [4] WANCHO TONE TUP..WANCHO TONE KOINI + {0x1E8D0, 0x1E8D6, prExtend}, // Mn [7] MENDE KIKAKUI COMBINING NUMBER TEENS..MENDE KIKAKUI COMBINING NUMBER MILLIONS + {0x1E944, 0x1E94A, prExtend}, // Mn [7] ADLAM ALIF LENGTHENER..ADLAM NUKTA + {0x1F000, 0x1F02B, prExtendedPictographic}, // 5.1 [44] (🀀..🀫) MAHJONG TILE EAST WIND..MAHJONG TILE BACK + {0x1F02C, 0x1F02F, prExtendedPictographic}, // NA [4] (🀬..🀯) .. + {0x1F030, 0x1F093, prExtendedPictographic}, // 5.1[100] (🀰..🂓) DOMINO TILE HORIZONTAL BACK..DOMINO TILE VERTICAL-06-06 + {0x1F094, 0x1F09F, prExtendedPictographic}, // NA [12] (🂔..🂟) .. + {0x1F0A0, 0x1F0AE, prExtendedPictographic}, // 6.0 [15] (🂠..🂮) PLAYING CARD BACK..PLAYING CARD KING OF SPADES + {0x1F0AF, 0x1F0B0, prExtendedPictographic}, // NA [2] (🂯..🂰) .. + {0x1F0B1, 0x1F0BE, prExtendedPictographic}, // 6.0 [14] (🂱..🂾) PLAYING CARD ACE OF HEARTS..PLAYING CARD KING OF HEARTS + {0x1F0BF, 0x1F0BF, prExtendedPictographic}, // 7.0 [1] (🂿) PLAYING CARD RED JOKER + {0x1F0C0, 0x1F0C0, prExtendedPictographic}, // NA [1] (🃀) + {0x1F0C1, 0x1F0CF, prExtendedPictographic}, // 6.0 [15] (🃁..🃏) PLAYING CARD ACE OF DIAMONDS..joker + {0x1F0D0, 0x1F0D0, prExtendedPictographic}, // NA [1] (🃐) + {0x1F0D1, 0x1F0DF, prExtendedPictographic}, // 6.0 [15] (🃑..🃟) PLAYING CARD ACE OF CLUBS..PLAYING CARD WHITE JOKER + {0x1F0E0, 0x1F0F5, prExtendedPictographic}, // 7.0 [22] (🃠..🃵) PLAYING CARD FOOL..PLAYING CARD TRUMP-21 + {0x1F0F6, 0x1F0FF, prExtendedPictographic}, // NA [10] (🃶..🃿) .. + {0x1F10D, 0x1F10F, prExtendedPictographic}, // NA [3] (🄍..🄏) .. + {0x1F12F, 0x1F12F, prExtendedPictographic}, // 11.0 [1] (🄯) COPYLEFT SYMBOL + {0x1F16C, 0x1F16C, prExtendedPictographic}, // 12.0 [1] (🅬) RAISED MR SIGN + {0x1F16D, 0x1F16F, prExtendedPictographic}, // NA [3] (🅭..🅯) .. + {0x1F170, 0x1F171, prExtendedPictographic}, // 6.0 [2] (🅰️..🅱️) A button (blood type)..B button (blood type) + {0x1F17E, 0x1F17E, prExtendedPictographic}, // 6.0 [1] (🅾️) O button (blood type) + {0x1F17F, 0x1F17F, prExtendedPictographic}, // 5.2 [1] (🅿️) P button + {0x1F18E, 0x1F18E, prExtendedPictographic}, // 6.0 [1] (🆎) AB button (blood type) + {0x1F191, 0x1F19A, prExtendedPictographic}, // 6.0 [10] (🆑..🆚) CL button..VS button + {0x1F1AD, 0x1F1E5, prExtendedPictographic}, // NA [57] (🆭..🇥) .. + {0x1F1E6, 0x1F1FF, prRegionalIndicator}, // So [26] REGIONAL INDICATOR SYMBOL LETTER A..REGIONAL INDICATOR SYMBOL LETTER Z + {0x1F201, 0x1F202, prExtendedPictographic}, // 6.0 [2] (🈁..🈂️) Japanese “here” button..Japanese “service charge” button + {0x1F203, 0x1F20F, prExtendedPictographic}, // NA [13] (🈃..🈏) .. + {0x1F21A, 0x1F21A, prExtendedPictographic}, // 5.2 [1] (🈚) Japanese “free of charge” button + {0x1F22F, 0x1F22F, prExtendedPictographic}, // 5.2 [1] (🈯) Japanese “reserved” button + {0x1F232, 0x1F23A, prExtendedPictographic}, // 6.0 [9] (🈲..🈺) Japanese “prohibited” button..Japanese “open for business” button + {0x1F23C, 0x1F23F, prExtendedPictographic}, // NA [4] (🈼..🈿) .. + {0x1F249, 0x1F24F, prExtendedPictographic}, // NA [7] (🉉..🉏) .. + {0x1F250, 0x1F251, prExtendedPictographic}, // 6.0 [2] (🉐..🉑) Japanese “bargain” button..Japanese “acceptable” button + {0x1F252, 0x1F25F, prExtendedPictographic}, // NA [14] (🉒..🉟) .. + {0x1F260, 0x1F265, prExtendedPictographic}, // 10.0 [6] (🉠..🉥) ROUNDED SYMBOL FOR FU..ROUNDED SYMBOL FOR CAI + {0x1F266, 0x1F2FF, prExtendedPictographic}, // NA[154] (🉦..🋿) .. + {0x1F300, 0x1F320, prExtendedPictographic}, // 6.0 [33] (🌀..🌠) cyclone..shooting star + {0x1F321, 0x1F32C, prExtendedPictographic}, // 7.0 [12] (🌡️..🌬️) thermometer..wind face + {0x1F32D, 0x1F32F, prExtendedPictographic}, // 8.0 [3] (🌭..🌯) hot dog..burrito + {0x1F330, 0x1F335, prExtendedPictographic}, // 6.0 [6] (🌰..🌵) chestnut..cactus + {0x1F336, 0x1F336, prExtendedPictographic}, // 7.0 [1] (🌶️) hot pepper + {0x1F337, 0x1F37C, prExtendedPictographic}, // 6.0 [70] (🌷..🍼) tulip..baby bottle + {0x1F37D, 0x1F37D, prExtendedPictographic}, // 7.0 [1] (🍽️) fork and knife with plate + {0x1F37E, 0x1F37F, prExtendedPictographic}, // 8.0 [2] (🍾..🍿) bottle with popping cork..popcorn + {0x1F380, 0x1F393, prExtendedPictographic}, // 6.0 [20] (🎀..🎓) ribbon..graduation cap + {0x1F394, 0x1F39F, prExtendedPictographic}, // 7.0 [12] (🎔..🎟️) HEART WITH TIP ON THE LEFT..admission tickets + {0x1F3A0, 0x1F3C4, prExtendedPictographic}, // 6.0 [37] (🎠..🏄) carousel horse..person surfing + {0x1F3C5, 0x1F3C5, prExtendedPictographic}, // 7.0 [1] (🏅) sports medal + {0x1F3C6, 0x1F3CA, prExtendedPictographic}, // 6.0 [5] (🏆..🏊) trophy..person swimming + {0x1F3CB, 0x1F3CE, prExtendedPictographic}, // 7.0 [4] (🏋️..🏎️) person lifting weights..racing car + {0x1F3CF, 0x1F3D3, prExtendedPictographic}, // 8.0 [5] (🏏..🏓) cricket game..ping pong + {0x1F3D4, 0x1F3DF, prExtendedPictographic}, // 7.0 [12] (🏔️..🏟️) snow-capped mountain..stadium + {0x1F3E0, 0x1F3F0, prExtendedPictographic}, // 6.0 [17] (🏠..🏰) house..castle + {0x1F3F1, 0x1F3F7, prExtendedPictographic}, // 7.0 [7] (🏱..🏷️) WHITE PENNANT..label + {0x1F3F8, 0x1F3FA, prExtendedPictographic}, // 8.0 [3] (🏸..🏺) badminton..amphora + {0x1F3FB, 0x1F3FF, prExtend}, // Sk [5] EMOJI MODIFIER FITZPATRICK TYPE-1-2..EMOJI MODIFIER FITZPATRICK TYPE-6 + {0x1F400, 0x1F43E, prExtendedPictographic}, // 6.0 [63] (🐀..🐾) rat..paw prints + {0x1F43F, 0x1F43F, prExtendedPictographic}, // 7.0 [1] (🐿️) chipmunk + {0x1F440, 0x1F440, prExtendedPictographic}, // 6.0 [1] (👀) eyes + {0x1F441, 0x1F441, prExtendedPictographic}, // 7.0 [1] (👁️) eye + {0x1F442, 0x1F4F7, prExtendedPictographic}, // 6.0[182] (👂..📷) ear..camera + {0x1F4F8, 0x1F4F8, prExtendedPictographic}, // 7.0 [1] (📸) camera with flash + {0x1F4F9, 0x1F4FC, prExtendedPictographic}, // 6.0 [4] (📹..📼) video camera..videocassette + {0x1F4FD, 0x1F4FE, prExtendedPictographic}, // 7.0 [2] (📽️..📾) film projector..PORTABLE STEREO + {0x1F4FF, 0x1F4FF, prExtendedPictographic}, // 8.0 [1] (📿) prayer beads + {0x1F500, 0x1F53D, prExtendedPictographic}, // 6.0 [62] (🔀..🔽) shuffle tracks button..downwards button + {0x1F546, 0x1F54A, prExtendedPictographic}, // 7.0 [5] (🕆..🕊️) WHITE LATIN CROSS..dove + {0x1F54B, 0x1F54F, prExtendedPictographic}, // 8.0 [5] (🕋..🕏) kaaba..BOWL OF HYGIEIA + {0x1F550, 0x1F567, prExtendedPictographic}, // 6.0 [24] (🕐..🕧) one o’clock..twelve-thirty + {0x1F568, 0x1F579, prExtendedPictographic}, // 7.0 [18] (🕨..🕹️) RIGHT SPEAKER..joystick + {0x1F57A, 0x1F57A, prExtendedPictographic}, // 9.0 [1] (🕺) man dancing + {0x1F57B, 0x1F5A3, prExtendedPictographic}, // 7.0 [41] (🕻..🖣) LEFT HAND TELEPHONE RECEIVER..BLACK DOWN POINTING BACKHAND INDEX + {0x1F5A4, 0x1F5A4, prExtendedPictographic}, // 9.0 [1] (🖤) black heart + {0x1F5A5, 0x1F5FA, prExtendedPictographic}, // 7.0 [86] (🖥️..🗺️) desktop computer..world map + {0x1F5FB, 0x1F5FF, prExtendedPictographic}, // 6.0 [5] (🗻..🗿) mount fuji..moai + {0x1F600, 0x1F600, prExtendedPictographic}, // 6.1 [1] (😀) grinning face + {0x1F601, 0x1F610, prExtendedPictographic}, // 6.0 [16] (😁..😐) beaming face with smiling eyes..neutral face + {0x1F611, 0x1F611, prExtendedPictographic}, // 6.1 [1] (😑) expressionless face + {0x1F612, 0x1F614, prExtendedPictographic}, // 6.0 [3] (😒..😔) unamused face..pensive face + {0x1F615, 0x1F615, prExtendedPictographic}, // 6.1 [1] (😕) confused face + {0x1F616, 0x1F616, prExtendedPictographic}, // 6.0 [1] (😖) confounded face + {0x1F617, 0x1F617, prExtendedPictographic}, // 6.1 [1] (😗) kissing face + {0x1F618, 0x1F618, prExtendedPictographic}, // 6.0 [1] (😘) face blowing a kiss + {0x1F619, 0x1F619, prExtendedPictographic}, // 6.1 [1] (😙) kissing face with smiling eyes + {0x1F61A, 0x1F61A, prExtendedPictographic}, // 6.0 [1] (😚) kissing face with closed eyes + {0x1F61B, 0x1F61B, prExtendedPictographic}, // 6.1 [1] (😛) face with tongue + {0x1F61C, 0x1F61E, prExtendedPictographic}, // 6.0 [3] (😜..😞) winking face with tongue..disappointed face + {0x1F61F, 0x1F61F, prExtendedPictographic}, // 6.1 [1] (😟) worried face + {0x1F620, 0x1F625, prExtendedPictographic}, // 6.0 [6] (😠..😥) angry face..sad but relieved face + {0x1F626, 0x1F627, prExtendedPictographic}, // 6.1 [2] (😦..😧) frowning face with open mouth..anguished face + {0x1F628, 0x1F62B, prExtendedPictographic}, // 6.0 [4] (😨..😫) fearful face..tired face + {0x1F62C, 0x1F62C, prExtendedPictographic}, // 6.1 [1] (😬) grimacing face + {0x1F62D, 0x1F62D, prExtendedPictographic}, // 6.0 [1] (😭) loudly crying face + {0x1F62E, 0x1F62F, prExtendedPictographic}, // 6.1 [2] (😮..😯) face with open mouth..hushed face + {0x1F630, 0x1F633, prExtendedPictographic}, // 6.0 [4] (😰..😳) anxious face with sweat..flushed face + {0x1F634, 0x1F634, prExtendedPictographic}, // 6.1 [1] (😴) sleeping face + {0x1F635, 0x1F640, prExtendedPictographic}, // 6.0 [12] (😵..🙀) dizzy face..weary cat + {0x1F641, 0x1F642, prExtendedPictographic}, // 7.0 [2] (🙁..🙂) slightly frowning face..slightly smiling face + {0x1F643, 0x1F644, prExtendedPictographic}, // 8.0 [2] (🙃..🙄) upside-down face..face with rolling eyes + {0x1F645, 0x1F64F, prExtendedPictographic}, // 6.0 [11] (🙅..🙏) person gesturing NO..folded hands + {0x1F680, 0x1F6C5, prExtendedPictographic}, // 6.0 [70] (🚀..🛅) rocket..left luggage + {0x1F6C6, 0x1F6CF, prExtendedPictographic}, // 7.0 [10] (🛆..🛏️) TRIANGLE WITH ROUNDED CORNERS..bed + {0x1F6D0, 0x1F6D0, prExtendedPictographic}, // 8.0 [1] (🛐) place of worship + {0x1F6D1, 0x1F6D2, prExtendedPictographic}, // 9.0 [2] (🛑..🛒) stop sign..shopping cart + {0x1F6D3, 0x1F6D4, prExtendedPictographic}, // 10.0 [2] (🛓..🛔) STUPA..PAGODA + {0x1F6D5, 0x1F6D5, prExtendedPictographic}, // 12.0 [1] (🛕) hindu temple + {0x1F6D6, 0x1F6DF, prExtendedPictographic}, // NA [10] (🛖..🛟) .. + {0x1F6E0, 0x1F6EC, prExtendedPictographic}, // 7.0 [13] (🛠️..🛬) hammer and wrench..airplane arrival + {0x1F6ED, 0x1F6EF, prExtendedPictographic}, // NA [3] (🛭..🛯) .. + {0x1F6F0, 0x1F6F3, prExtendedPictographic}, // 7.0 [4] (🛰️..🛳️) satellite..passenger ship + {0x1F6F4, 0x1F6F6, prExtendedPictographic}, // 9.0 [3] (🛴..🛶) kick scooter..canoe + {0x1F6F7, 0x1F6F8, prExtendedPictographic}, // 10.0 [2] (🛷..🛸) sled..flying saucer + {0x1F6F9, 0x1F6F9, prExtendedPictographic}, // 11.0 [1] (🛹) skateboard + {0x1F6FA, 0x1F6FA, prExtendedPictographic}, // 12.0 [1] (🛺) auto rickshaw + {0x1F6FB, 0x1F6FF, prExtendedPictographic}, // NA [5] (🛻..🛿) .. + {0x1F774, 0x1F77F, prExtendedPictographic}, // NA [12] (🝴..🝿) .. + {0x1F7D5, 0x1F7D8, prExtendedPictographic}, // 11.0 [4] (🟕..🟘) CIRCLED TRIANGLE..NEGATIVE CIRCLED SQUARE + {0x1F7D9, 0x1F7DF, prExtendedPictographic}, // NA [7] (🟙..🟟) .. + {0x1F7E0, 0x1F7EB, prExtendedPictographic}, // 12.0 [12] (🟠..🟫) orange circle..brown square + {0x1F7EC, 0x1F7FF, prExtendedPictographic}, // NA [20] (🟬..🟿) .. + {0x1F80C, 0x1F80F, prExtendedPictographic}, // NA [4] (🠌..🠏) .. + {0x1F848, 0x1F84F, prExtendedPictographic}, // NA [8] (🡈..🡏) .. + {0x1F85A, 0x1F85F, prExtendedPictographic}, // NA [6] (🡚..🡟) .. + {0x1F888, 0x1F88F, prExtendedPictographic}, // NA [8] (🢈..🢏) .. + {0x1F8AE, 0x1F8FF, prExtendedPictographic}, // NA [82] (🢮..🣿) .. + {0x1F90C, 0x1F90C, prExtendedPictographic}, // NA [1] (🤌) + {0x1F90D, 0x1F90F, prExtendedPictographic}, // 12.0 [3] (🤍..🤏) white heart..pinching hand + {0x1F910, 0x1F918, prExtendedPictographic}, // 8.0 [9] (🤐..🤘) zipper-mouth face..sign of the horns + {0x1F919, 0x1F91E, prExtendedPictographic}, // 9.0 [6] (🤙..🤞) call me hand..crossed fingers + {0x1F91F, 0x1F91F, prExtendedPictographic}, // 10.0 [1] (🤟) love-you gesture + {0x1F920, 0x1F927, prExtendedPictographic}, // 9.0 [8] (🤠..🤧) cowboy hat face..sneezing face + {0x1F928, 0x1F92F, prExtendedPictographic}, // 10.0 [8] (🤨..🤯) face with raised eyebrow..exploding head + {0x1F930, 0x1F930, prExtendedPictographic}, // 9.0 [1] (🤰) pregnant woman + {0x1F931, 0x1F932, prExtendedPictographic}, // 10.0 [2] (🤱..🤲) breast-feeding..palms up together + {0x1F933, 0x1F93A, prExtendedPictographic}, // 9.0 [8] (🤳..🤺) selfie..person fencing + {0x1F93C, 0x1F93E, prExtendedPictographic}, // 9.0 [3] (🤼..🤾) people wrestling..person playing handball + {0x1F93F, 0x1F93F, prExtendedPictographic}, // 12.0 [1] (🤿) diving mask + {0x1F940, 0x1F945, prExtendedPictographic}, // 9.0 [6] (🥀..🥅) wilted flower..goal net + {0x1F947, 0x1F94B, prExtendedPictographic}, // 9.0 [5] (🥇..🥋) 1st place medal..martial arts uniform + {0x1F94C, 0x1F94C, prExtendedPictographic}, // 10.0 [1] (🥌) curling stone + {0x1F94D, 0x1F94F, prExtendedPictographic}, // 11.0 [3] (🥍..🥏) lacrosse..flying disc + {0x1F950, 0x1F95E, prExtendedPictographic}, // 9.0 [15] (🥐..🥞) croissant..pancakes + {0x1F95F, 0x1F96B, prExtendedPictographic}, // 10.0 [13] (🥟..🥫) dumpling..canned food + {0x1F96C, 0x1F970, prExtendedPictographic}, // 11.0 [5] (🥬..🥰) leafy green..smiling face with hearts + {0x1F971, 0x1F971, prExtendedPictographic}, // 12.0 [1] (🥱) yawning face + {0x1F972, 0x1F972, prExtendedPictographic}, // NA [1] (🥲) + {0x1F973, 0x1F976, prExtendedPictographic}, // 11.0 [4] (🥳..🥶) partying face..cold face + {0x1F977, 0x1F979, prExtendedPictographic}, // NA [3] (🥷..🥹) .. + {0x1F97A, 0x1F97A, prExtendedPictographic}, // 11.0 [1] (🥺) pleading face + {0x1F97B, 0x1F97B, prExtendedPictographic}, // 12.0 [1] (🥻) sari + {0x1F97C, 0x1F97F, prExtendedPictographic}, // 11.0 [4] (🥼..🥿) lab coat..flat shoe + {0x1F980, 0x1F984, prExtendedPictographic}, // 8.0 [5] (🦀..🦄) crab..unicorn + {0x1F985, 0x1F991, prExtendedPictographic}, // 9.0 [13] (🦅..🦑) eagle..squid + {0x1F992, 0x1F997, prExtendedPictographic}, // 10.0 [6] (🦒..🦗) giraffe..cricket + {0x1F998, 0x1F9A2, prExtendedPictographic}, // 11.0 [11] (🦘..🦢) kangaroo..swan + {0x1F9A3, 0x1F9A4, prExtendedPictographic}, // NA [2] (🦣..🦤) .. + {0x1F9A5, 0x1F9AA, prExtendedPictographic}, // 12.0 [6] (🦥..🦪) sloth..oyster + {0x1F9AB, 0x1F9AD, prExtendedPictographic}, // NA [3] (🦫..🦭) .. + {0x1F9AE, 0x1F9AF, prExtendedPictographic}, // 12.0 [2] (🦮..🦯) guide dog..probing cane + {0x1F9B0, 0x1F9B9, prExtendedPictographic}, // 11.0 [10] (🦰..🦹) red hair..supervillain + {0x1F9BA, 0x1F9BF, prExtendedPictographic}, // 12.0 [6] (🦺..🦿) safety vest..mechanical leg + {0x1F9C0, 0x1F9C0, prExtendedPictographic}, // 8.0 [1] (🧀) cheese wedge + {0x1F9C1, 0x1F9C2, prExtendedPictographic}, // 11.0 [2] (🧁..🧂) cupcake..salt + {0x1F9C3, 0x1F9CA, prExtendedPictographic}, // 12.0 [8] (🧃..🧊) beverage box..ice cube + {0x1F9CB, 0x1F9CC, prExtendedPictographic}, // NA [2] (🧋..🧌) .. + {0x1F9CD, 0x1F9CF, prExtendedPictographic}, // 12.0 [3] (🧍..🧏) person standing..deaf person + {0x1F9D0, 0x1F9E6, prExtendedPictographic}, // 10.0 [23] (🧐..🧦) face with monocle..socks + {0x1F9E7, 0x1F9FF, prExtendedPictographic}, // 11.0 [25] (🧧..🧿) red envelope..nazar amulet + {0x1FA00, 0x1FA53, prExtendedPictographic}, // 12.0 [84] (🨀..🩓) NEUTRAL CHESS KING..BLACK CHESS KNIGHT-BISHOP + {0x1FA54, 0x1FA5F, prExtendedPictographic}, // NA [12] (🩔..🩟) .. + {0x1FA60, 0x1FA6D, prExtendedPictographic}, // 11.0 [14] (🩠..🩭) XIANGQI RED GENERAL..XIANGQI BLACK SOLDIER + {0x1FA6E, 0x1FA6F, prExtendedPictographic}, // NA [2] (🩮..🩯) .. + {0x1FA70, 0x1FA73, prExtendedPictographic}, // 12.0 [4] (🩰..🩳) ballet shoes..shorts + {0x1FA74, 0x1FA77, prExtendedPictographic}, // NA [4] (🩴..🩷) .. + {0x1FA78, 0x1FA7A, prExtendedPictographic}, // 12.0 [3] (🩸..🩺) drop of blood..stethoscope + {0x1FA7B, 0x1FA7F, prExtendedPictographic}, // NA [5] (🩻..🩿) .. + {0x1FA80, 0x1FA82, prExtendedPictographic}, // 12.0 [3] (🪀..🪂) yo-yo..parachute + {0x1FA83, 0x1FA8F, prExtendedPictographic}, // NA [13] (🪃..🪏) .. + {0x1FA90, 0x1FA95, prExtendedPictographic}, // 12.0 [6] (🪐..🪕) ringed planet..banjo + {0x1FA96, 0x1FFFD, prExtendedPictographic}, // NA[1384] (🪖..🿽) .. + {0xE0000, 0xE0000, prControl}, // Cn + {0xE0001, 0xE0001, prControl}, // Cf LANGUAGE TAG + {0xE0002, 0xE001F, prControl}, // Cn [30] .. + {0xE0020, 0xE007F, prExtend}, // Cf [96] TAG SPACE..CANCEL TAG + {0xE0080, 0xE00FF, prControl}, // Cn [128] .. + {0xE0100, 0xE01EF, prExtend}, // Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-256 + {0xE01F0, 0xE0FFF, prControl}, // Cn [3600] .. +} + +// property returns the Unicode property value (see constants above) of the +// given code point. +func property(r rune) int { + // Run a binary search. + from := 0 + to := len(codePoints) + for to > from { + middle := (from + to) / 2 + cpRange := codePoints[middle] + if int(r) < cpRange[0] { + to = middle + continue + } + if int(r) > cpRange[1] { + from = middle + 1 + continue + } + return cpRange[2] + } + return prAny +} diff --git a/vendor/github.com/xo/terminfo/.gitignore b/vendor/github.com/xo/terminfo/.gitignore new file mode 100644 index 000000000..368e0c06c --- /dev/null +++ b/vendor/github.com/xo/terminfo/.gitignore @@ -0,0 +1,9 @@ +/.cache/ + +/cmd/infocmp/infocmp +/cmd/infocmp/.out/ + +/infocmp +/.out/ + +*.txt diff --git a/vendor/github.com/xo/terminfo/LICENSE b/vendor/github.com/xo/terminfo/LICENSE new file mode 100644 index 000000000..197dadb12 --- /dev/null +++ b/vendor/github.com/xo/terminfo/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Anmol Sethi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/xo/terminfo/README.md b/vendor/github.com/xo/terminfo/README.md new file mode 100644 index 000000000..e5002d239 --- /dev/null +++ b/vendor/github.com/xo/terminfo/README.md @@ -0,0 +1,139 @@ +# About terminfo [![GoDoc][1]][2] + +Package `terminfo` provides a pure-Go implementation of reading information +from the terminfo database. + +`terminfo` is meant as a replacement for `ncurses` in simple Go programs. + +## Installing + +Install in the usual Go way: + +```sh +$ go get -u github.com/xo/terminfo +``` + +## Using + +Please see the [GoDoc API listing][2] for more information on using `terminfo`. + +```go +// _examples/simple/main.go +package main + +import ( + "bytes" + "fmt" + "log" + "os" + "os/signal" + "strings" + "sync" + "syscall" + + "github.com/xo/terminfo" +) + +func main() { + //r := rand.New(nil) + + // load terminfo + ti, err := terminfo.LoadFromEnv() + if err != nil { + log.Fatal(err) + } + + // cleanup + defer func() { + err := recover() + termreset(ti) + if err != nil { + log.Fatal(err) + } + }() + + terminit(ti) + termtitle(ti, "simple example!") + termputs(ti, 3, 3, "Ctrl-C to exit") + maxColors := termcolors(ti) + if maxColors > 256 { + maxColors = 256 + } + for i := 0; i < maxColors; i++ { + termputs(ti, 5+i/16, 5+i%16, ti.Colorf(i, 0, "█")) + } + + // wait for signal + sigs := make(chan os.Signal, 1) + signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) + <-sigs +} + +// terminit initializes the special CA mode on the terminal, and makes the +// cursor invisible. +func terminit(ti *terminfo.Terminfo) { + buf := new(bytes.Buffer) + // set the cursor invisible + ti.Fprintf(buf, terminfo.CursorInvisible) + // enter special mode + ti.Fprintf(buf, terminfo.EnterCaMode) + // clear the screen + ti.Fprintf(buf, terminfo.ClearScreen) + os.Stdout.Write(buf.Bytes()) +} + +// termreset is the inverse of terminit. +func termreset(ti *terminfo.Terminfo) { + buf := new(bytes.Buffer) + ti.Fprintf(buf, terminfo.ExitCaMode) + ti.Fprintf(buf, terminfo.CursorNormal) + os.Stdout.Write(buf.Bytes()) +} + +// termputs puts a string at row, col, interpolating v. +func termputs(ti *terminfo.Terminfo, row, col int, s string, v ...interface{}) { + buf := new(bytes.Buffer) + ti.Fprintf(buf, terminfo.CursorAddress, row, col) + fmt.Fprintf(buf, s, v...) + os.Stdout.Write(buf.Bytes()) +} + +// sl is the status line terminfo. +var sl *terminfo.Terminfo + +// termtitle sets the window title. +func termtitle(ti *terminfo.Terminfo, s string) { + var once sync.Once + once.Do(func() { + if ti.Has(terminfo.HasStatusLine) { + return + } + // load the sl xterm if terminal is an xterm or has COLORTERM + if strings.Contains(strings.ToLower(os.Getenv("TERM")), "xterm") || os.Getenv("COLORTERM") == "truecolor" { + sl, _ = terminfo.Load("xterm+sl") + } + }) + if sl != nil { + ti = sl + } + if !ti.Has(terminfo.HasStatusLine) { + return + } + buf := new(bytes.Buffer) + ti.Fprintf(buf, terminfo.ToStatusLine) + fmt.Fprint(buf, s) + ti.Fprintf(buf, terminfo.FromStatusLine) + os.Stdout.Write(buf.Bytes()) +} + +// termcolors returns the maximum colors available for the terminal. +func termcolors(ti *terminfo.Terminfo) int { + if colors := ti.Num(terminfo.MaxColors); colors > 0 { + return colors + } + return int(terminfo.ColorLevelBasic) +} +``` + +[1]: https://godoc.org/github.com/xo/terminfo?status.svg +[2]: https://godoc.org/github.com/xo/terminfo diff --git a/vendor/github.com/xo/terminfo/caps.go b/vendor/github.com/xo/terminfo/caps.go new file mode 100644 index 000000000..e5e1d41f1 --- /dev/null +++ b/vendor/github.com/xo/terminfo/caps.go @@ -0,0 +1,31 @@ +package terminfo + +// BoolCapName returns the bool capability name. +func BoolCapName(i int) string { + return boolCapNames[2*i] +} + +// BoolCapNameShort returns the short bool capability name. +func BoolCapNameShort(i int) string { + return boolCapNames[2*i+1] +} + +// NumCapName returns the num capability name. +func NumCapName(i int) string { + return numCapNames[2*i] +} + +// NumCapNameShort returns the short num capability name. +func NumCapNameShort(i int) string { + return numCapNames[2*i+1] +} + +// StringCapName returns the string capability name. +func StringCapName(i int) string { + return stringCapNames[2*i] +} + +// StringCapNameShort returns the short string capability name. +func StringCapNameShort(i int) string { + return stringCapNames[2*i+1] +} diff --git a/vendor/github.com/xo/terminfo/capvals.go b/vendor/github.com/xo/terminfo/capvals.go new file mode 100644 index 000000000..0c2274e3a --- /dev/null +++ b/vendor/github.com/xo/terminfo/capvals.go @@ -0,0 +1,1525 @@ +package terminfo + +// Code generated by gen.go. DO NOT EDIT. +// Bool capabilities. +const ( + // The AutoLeftMargin [auto_left_margin, bw] bool capability indicates cub1 wraps from column 0 to last column. + AutoLeftMargin = iota + // The AutoRightMargin [auto_right_margin, am] bool capability indicates terminal has automatic margins. + AutoRightMargin + // The NoEscCtlc [no_esc_ctlc, xsb] bool capability indicates beehive (f1=escape, f2=ctrl C). + NoEscCtlc + // The CeolStandoutGlitch [ceol_standout_glitch, xhp] bool capability indicates standout not erased by overwriting (hp). + CeolStandoutGlitch + // The EatNewlineGlitch [eat_newline_glitch, xenl] bool capability indicates newline ignored after 80 cols (concept). + EatNewlineGlitch + // The EraseOverstrike [erase_overstrike, eo] bool capability indicates can erase overstrikes with a blank. + EraseOverstrike + // The GenericType [generic_type, gn] bool capability indicates generic line type. + GenericType + // The HardCopy [hard_copy, hc] bool capability indicates hardcopy terminal. + HardCopy + // The HasMetaKey [has_meta_key, km] bool capability indicates Has a meta key (i.e., sets 8th-bit). + HasMetaKey + // The HasStatusLine [has_status_line, hs] bool capability indicates has extra status line. + HasStatusLine + // The InsertNullGlitch [insert_null_glitch, in] bool capability indicates insert mode distinguishes nulls. + InsertNullGlitch + // The MemoryAbove [memory_above, da] bool capability indicates display may be retained above the screen. + MemoryAbove + // The MemoryBelow [memory_below, db] bool capability indicates display may be retained below the screen. + MemoryBelow + // The MoveInsertMode [move_insert_mode, mir] bool capability indicates safe to move while in insert mode. + MoveInsertMode + // The MoveStandoutMode [move_standout_mode, msgr] bool capability indicates safe to move while in standout mode. + MoveStandoutMode + // The OverStrike [over_strike, os] bool capability indicates terminal can overstrike. + OverStrike + // The StatusLineEscOk [status_line_esc_ok, eslok] bool capability indicates escape can be used on the status line. + StatusLineEscOk + // The DestTabsMagicSmso [dest_tabs_magic_smso, xt] bool capability indicates tabs destructive, magic so char (t1061). + DestTabsMagicSmso + // The TildeGlitch [tilde_glitch, hz] bool capability indicates cannot print ~'s (Hazeltine). + TildeGlitch + // The TransparentUnderline [transparent_underline, ul] bool capability indicates underline character overstrikes. + TransparentUnderline + // The XonXoff [xon_xoff, xon] bool capability indicates terminal uses xon/xoff handshaking. + XonXoff + // The NeedsXonXoff [needs_xon_xoff, nxon] bool capability indicates padding will not work, xon/xoff required. + NeedsXonXoff + // The PrtrSilent [prtr_silent, mc5i] bool capability indicates printer will not echo on screen. + PrtrSilent + // The HardCursor [hard_cursor, chts] bool capability indicates cursor is hard to see. + HardCursor + // The NonRevRmcup [non_rev_rmcup, nrrmc] bool capability indicates smcup does not reverse rmcup. + NonRevRmcup + // The NoPadChar [no_pad_char, npc] bool capability indicates pad character does not exist. + NoPadChar + // The NonDestScrollRegion [non_dest_scroll_region, ndscr] bool capability indicates scrolling region is non-destructive. + NonDestScrollRegion + // The CanChange [can_change, ccc] bool capability indicates terminal can re-define existing colors. + CanChange + // The BackColorErase [back_color_erase, bce] bool capability indicates screen erased with background color. + BackColorErase + // The HueLightnessSaturation [hue_lightness_saturation, hls] bool capability indicates terminal uses only HLS color notation (Tektronix). + HueLightnessSaturation + // The ColAddrGlitch [col_addr_glitch, xhpa] bool capability indicates only positive motion for hpa/mhpa caps. + ColAddrGlitch + // The CrCancelsMicroMode [cr_cancels_micro_mode, crxm] bool capability indicates using cr turns off micro mode. + CrCancelsMicroMode + // The HasPrintWheel [has_print_wheel, daisy] bool capability indicates printer needs operator to change character set. + HasPrintWheel + // The RowAddrGlitch [row_addr_glitch, xvpa] bool capability indicates only positive motion for vpa/mvpa caps. + RowAddrGlitch + // The SemiAutoRightMargin [semi_auto_right_margin, sam] bool capability indicates printing in last column causes cr. + SemiAutoRightMargin + // The CpiChangesRes [cpi_changes_res, cpix] bool capability indicates changing character pitch changes resolution. + CpiChangesRes + // The LpiChangesRes [lpi_changes_res, lpix] bool capability indicates changing line pitch changes resolution. + LpiChangesRes + // The BackspacesWithBs [backspaces_with_bs, OTbs] bool capability indicates uses ^H to move left. + BackspacesWithBs + // The CrtNoScrolling [crt_no_scrolling, OTns] bool capability indicates crt cannot scroll. + CrtNoScrolling + // The NoCorrectlyWorkingCr [no_correctly_working_cr, OTnc] bool capability indicates no way to go to start of line. + NoCorrectlyWorkingCr + // The GnuHasMetaKey [gnu_has_meta_key, OTMT] bool capability indicates has meta key. + GnuHasMetaKey + // The LinefeedIsNewline [linefeed_is_newline, OTNL] bool capability indicates move down with \n. + LinefeedIsNewline + // The HasHardwareTabs [has_hardware_tabs, OTpt] bool capability indicates has 8-char tabs invoked with ^I. + HasHardwareTabs + // The ReturnDoesClrEol [return_does_clr_eol, OTxr] bool capability indicates return clears the line. + ReturnDoesClrEol +) + +// Num capabilities. +const ( + // The Columns [columns, cols] num capability is number of columns in a line. + Columns = iota + // The InitTabs [init_tabs, it] num capability is tabs initially every # spaces. + InitTabs + // The Lines [lines, lines] num capability is number of lines on screen or page. + Lines + // The LinesOfMemory [lines_of_memory, lm] num capability is lines of memory if > line. 0 means varies. + LinesOfMemory + // The MagicCookieGlitch [magic_cookie_glitch, xmc] num capability is number of blank characters left by smso or rmso. + MagicCookieGlitch + // The PaddingBaudRate [padding_baud_rate, pb] num capability is lowest baud rate where padding needed. + PaddingBaudRate + // The VirtualTerminal [virtual_terminal, vt] num capability is virtual terminal number (CB/unix). + VirtualTerminal + // The WidthStatusLine [width_status_line, wsl] num capability is number of columns in status line. + WidthStatusLine + // The NumLabels [num_labels, nlab] num capability is number of labels on screen. + NumLabels + // The LabelHeight [label_height, lh] num capability is rows in each label. + LabelHeight + // The LabelWidth [label_width, lw] num capability is columns in each label. + LabelWidth + // The MaxAttributes [max_attributes, ma] num capability is maximum combined attributes terminal can handle. + MaxAttributes + // The MaximumWindows [maximum_windows, wnum] num capability is maximum number of definable windows. + MaximumWindows + // The MaxColors [max_colors, colors] num capability is maximum number of colors on screen. + MaxColors + // The MaxPairs [max_pairs, pairs] num capability is maximum number of color-pairs on the screen. + MaxPairs + // The NoColorVideo [no_color_video, ncv] num capability is video attributes that cannot be used with colors. + NoColorVideo + // The BufferCapacity [buffer_capacity, bufsz] num capability is numbers of bytes buffered before printing. + BufferCapacity + // The DotVertSpacing [dot_vert_spacing, spinv] num capability is spacing of pins vertically in pins per inch. + DotVertSpacing + // The DotHorzSpacing [dot_horz_spacing, spinh] num capability is spacing of dots horizontally in dots per inch. + DotHorzSpacing + // The MaxMicroAddress [max_micro_address, maddr] num capability is maximum value in micro_..._address. + MaxMicroAddress + // The MaxMicroJump [max_micro_jump, mjump] num capability is maximum value in parm_..._micro. + MaxMicroJump + // The MicroColSize [micro_col_size, mcs] num capability is character step size when in micro mode. + MicroColSize + // The MicroLineSize [micro_line_size, mls] num capability is line step size when in micro mode. + MicroLineSize + // The NumberOfPins [number_of_pins, npins] num capability is numbers of pins in print-head. + NumberOfPins + // The OutputResChar [output_res_char, orc] num capability is horizontal resolution in units per line. + OutputResChar + // The OutputResLine [output_res_line, orl] num capability is vertical resolution in units per line. + OutputResLine + // The OutputResHorzInch [output_res_horz_inch, orhi] num capability is horizontal resolution in units per inch. + OutputResHorzInch + // The OutputResVertInch [output_res_vert_inch, orvi] num capability is vertical resolution in units per inch. + OutputResVertInch + // The PrintRate [print_rate, cps] num capability is print rate in characters per second. + PrintRate + // The WideCharSize [wide_char_size, widcs] num capability is character step size when in double wide mode. + WideCharSize + // The Buttons [buttons, btns] num capability is number of buttons on mouse. + Buttons + // The BitImageEntwining [bit_image_entwining, bitwin] num capability is number of passes for each bit-image row. + BitImageEntwining + // The BitImageType [bit_image_type, bitype] num capability is type of bit-image device. + BitImageType + // The MagicCookieGlitchUl [magic_cookie_glitch_ul, OTug] num capability is number of blanks left by ul. + MagicCookieGlitchUl + // The CarriageReturnDelay [carriage_return_delay, OTdC] num capability is pad needed for CR. + CarriageReturnDelay + // The NewLineDelay [new_line_delay, OTdN] num capability is pad needed for LF. + NewLineDelay + // The BackspaceDelay [backspace_delay, OTdB] num capability is padding required for ^H. + BackspaceDelay + // The HorizontalTabDelay [horizontal_tab_delay, OTdT] num capability is padding required for ^I. + HorizontalTabDelay + // The NumberOfFunctionKeys [number_of_function_keys, OTkn] num capability is count of function keys. + NumberOfFunctionKeys +) + +// String capabilities. +const ( + // The BackTab [back_tab, cbt] string capability is the back tab (P). + BackTab = iota + // The Bell [bell, bel] string capability is the audible signal (bell) (P). + Bell + // The CarriageReturn [carriage_return, cr] string capability is the carriage return (P*) (P*). + CarriageReturn + // The ChangeScrollRegion [change_scroll_region, csr] string capability is the change region to line #1 to line #2 (P). + ChangeScrollRegion + // The ClearAllTabs [clear_all_tabs, tbc] string capability is the clear all tab stops (P). + ClearAllTabs + // The ClearScreen [clear_screen, clear] string capability is the clear screen and home cursor (P*). + ClearScreen + // The ClrEol [clr_eol, el] string capability is the clear to end of line (P). + ClrEol + // The ClrEos [clr_eos, ed] string capability is the clear to end of screen (P*). + ClrEos + // The ColumnAddress [column_address, hpa] string capability is the horizontal position #1, absolute (P). + ColumnAddress + // The CommandCharacter [command_character, cmdch] string capability is the terminal settable cmd character in prototype !?. + CommandCharacter + // The CursorAddress [cursor_address, cup] string capability is the move to row #1 columns #2. + CursorAddress + // The CursorDown [cursor_down, cud1] string capability is the down one line. + CursorDown + // The CursorHome [cursor_home, home] string capability is the home cursor (if no cup). + CursorHome + // The CursorInvisible [cursor_invisible, civis] string capability is the make cursor invisible. + CursorInvisible + // The CursorLeft [cursor_left, cub1] string capability is the move left one space. + CursorLeft + // The CursorMemAddress [cursor_mem_address, mrcup] string capability is the memory relative cursor addressing, move to row #1 columns #2. + CursorMemAddress + // The CursorNormal [cursor_normal, cnorm] string capability is the make cursor appear normal (undo civis/cvvis). + CursorNormal + // The CursorRight [cursor_right, cuf1] string capability is the non-destructive space (move right one space). + CursorRight + // The CursorToLl [cursor_to_ll, ll] string capability is the last line, first column (if no cup). + CursorToLl + // The CursorUp [cursor_up, cuu1] string capability is the up one line. + CursorUp + // The CursorVisible [cursor_visible, cvvis] string capability is the make cursor very visible. + CursorVisible + // The DeleteCharacter [delete_character, dch1] string capability is the delete character (P*). + DeleteCharacter + // The DeleteLine [delete_line, dl1] string capability is the delete line (P*). + DeleteLine + // The DisStatusLine [dis_status_line, dsl] string capability is the disable status line. + DisStatusLine + // The DownHalfLine [down_half_line, hd] string capability is the half a line down. + DownHalfLine + // The EnterAltCharsetMode [enter_alt_charset_mode, smacs] string capability is the start alternate character set (P). + EnterAltCharsetMode + // The EnterBlinkMode [enter_blink_mode, blink] string capability is the turn on blinking. + EnterBlinkMode + // The EnterBoldMode [enter_bold_mode, bold] string capability is the turn on bold (extra bright) mode. + EnterBoldMode + // The EnterCaMode [enter_ca_mode, smcup] string capability is the string to start programs using cup. + EnterCaMode + // The EnterDeleteMode [enter_delete_mode, smdc] string capability is the enter delete mode. + EnterDeleteMode + // The EnterDimMode [enter_dim_mode, dim] string capability is the turn on half-bright mode. + EnterDimMode + // The EnterInsertMode [enter_insert_mode, smir] string capability is the enter insert mode. + EnterInsertMode + // The EnterSecureMode [enter_secure_mode, invis] string capability is the turn on blank mode (characters invisible). + EnterSecureMode + // The EnterProtectedMode [enter_protected_mode, prot] string capability is the turn on protected mode. + EnterProtectedMode + // The EnterReverseMode [enter_reverse_mode, rev] string capability is the turn on reverse video mode. + EnterReverseMode + // The EnterStandoutMode [enter_standout_mode, smso] string capability is the begin standout mode. + EnterStandoutMode + // The EnterUnderlineMode [enter_underline_mode, smul] string capability is the begin underline mode. + EnterUnderlineMode + // The EraseChars [erase_chars, ech] string capability is the erase #1 characters (P). + EraseChars + // The ExitAltCharsetMode [exit_alt_charset_mode, rmacs] string capability is the end alternate character set (P). + ExitAltCharsetMode + // The ExitAttributeMode [exit_attribute_mode, sgr0] string capability is the turn off all attributes. + ExitAttributeMode + // The ExitCaMode [exit_ca_mode, rmcup] string capability is the strings to end programs using cup. + ExitCaMode + // The ExitDeleteMode [exit_delete_mode, rmdc] string capability is the end delete mode. + ExitDeleteMode + // The ExitInsertMode [exit_insert_mode, rmir] string capability is the exit insert mode. + ExitInsertMode + // The ExitStandoutMode [exit_standout_mode, rmso] string capability is the exit standout mode. + ExitStandoutMode + // The ExitUnderlineMode [exit_underline_mode, rmul] string capability is the exit underline mode. + ExitUnderlineMode + // The FlashScreen [flash_screen, flash] string capability is the visible bell (may not move cursor). + FlashScreen + // The FormFeed [form_feed, ff] string capability is the hardcopy terminal page eject (P*). + FormFeed + // The FromStatusLine [from_status_line, fsl] string capability is the return from status line. + FromStatusLine + // The Init1string [init_1string, is1] string capability is the initialization string. + Init1string + // The Init2string [init_2string, is2] string capability is the initialization string. + Init2string + // The Init3string [init_3string, is3] string capability is the initialization string. + Init3string + // The InitFile [init_file, if] string capability is the name of initialization file. + InitFile + // The InsertCharacter [insert_character, ich1] string capability is the insert character (P). + InsertCharacter + // The InsertLine [insert_line, il1] string capability is the insert line (P*). + InsertLine + // The InsertPadding [insert_padding, ip] string capability is the insert padding after inserted character. + InsertPadding + // The KeyBackspace [key_backspace, kbs] string capability is the backspace key. + KeyBackspace + // The KeyCatab [key_catab, ktbc] string capability is the clear-all-tabs key. + KeyCatab + // The KeyClear [key_clear, kclr] string capability is the clear-screen or erase key. + KeyClear + // The KeyCtab [key_ctab, kctab] string capability is the clear-tab key. + KeyCtab + // The KeyDc [key_dc, kdch1] string capability is the delete-character key. + KeyDc + // The KeyDl [key_dl, kdl1] string capability is the delete-line key. + KeyDl + // The KeyDown [key_down, kcud1] string capability is the down-arrow key. + KeyDown + // The KeyEic [key_eic, krmir] string capability is the sent by rmir or smir in insert mode. + KeyEic + // The KeyEol [key_eol, kel] string capability is the clear-to-end-of-line key. + KeyEol + // The KeyEos [key_eos, ked] string capability is the clear-to-end-of-screen key. + KeyEos + // The KeyF0 [key_f0, kf0] string capability is the F0 function key. + KeyF0 + // The KeyF1 [key_f1, kf1] string capability is the F1 function key. + KeyF1 + // The KeyF10 [key_f10, kf10] string capability is the F10 function key. + KeyF10 + // The KeyF2 [key_f2, kf2] string capability is the F2 function key. + KeyF2 + // The KeyF3 [key_f3, kf3] string capability is the F3 function key. + KeyF3 + // The KeyF4 [key_f4, kf4] string capability is the F4 function key. + KeyF4 + // The KeyF5 [key_f5, kf5] string capability is the F5 function key. + KeyF5 + // The KeyF6 [key_f6, kf6] string capability is the F6 function key. + KeyF6 + // The KeyF7 [key_f7, kf7] string capability is the F7 function key. + KeyF7 + // The KeyF8 [key_f8, kf8] string capability is the F8 function key. + KeyF8 + // The KeyF9 [key_f9, kf9] string capability is the F9 function key. + KeyF9 + // The KeyHome [key_home, khome] string capability is the home key. + KeyHome + // The KeyIc [key_ic, kich1] string capability is the insert-character key. + KeyIc + // The KeyIl [key_il, kil1] string capability is the insert-line key. + KeyIl + // The KeyLeft [key_left, kcub1] string capability is the left-arrow key. + KeyLeft + // The KeyLl [key_ll, kll] string capability is the lower-left key (home down). + KeyLl + // The KeyNpage [key_npage, knp] string capability is the next-page key. + KeyNpage + // The KeyPpage [key_ppage, kpp] string capability is the previous-page key. + KeyPpage + // The KeyRight [key_right, kcuf1] string capability is the right-arrow key. + KeyRight + // The KeySf [key_sf, kind] string capability is the scroll-forward key. + KeySf + // The KeySr [key_sr, kri] string capability is the scroll-backward key. + KeySr + // The KeyStab [key_stab, khts] string capability is the set-tab key. + KeyStab + // The KeyUp [key_up, kcuu1] string capability is the up-arrow key. + KeyUp + // The KeypadLocal [keypad_local, rmkx] string capability is the leave 'keyboard_transmit' mode. + KeypadLocal + // The KeypadXmit [keypad_xmit, smkx] string capability is the enter 'keyboard_transmit' mode. + KeypadXmit + // The LabF0 [lab_f0, lf0] string capability is the label on function key f0 if not f0. + LabF0 + // The LabF1 [lab_f1, lf1] string capability is the label on function key f1 if not f1. + LabF1 + // The LabF10 [lab_f10, lf10] string capability is the label on function key f10 if not f10. + LabF10 + // The LabF2 [lab_f2, lf2] string capability is the label on function key f2 if not f2. + LabF2 + // The LabF3 [lab_f3, lf3] string capability is the label on function key f3 if not f3. + LabF3 + // The LabF4 [lab_f4, lf4] string capability is the label on function key f4 if not f4. + LabF4 + // The LabF5 [lab_f5, lf5] string capability is the label on function key f5 if not f5. + LabF5 + // The LabF6 [lab_f6, lf6] string capability is the label on function key f6 if not f6. + LabF6 + // The LabF7 [lab_f7, lf7] string capability is the label on function key f7 if not f7. + LabF7 + // The LabF8 [lab_f8, lf8] string capability is the label on function key f8 if not f8. + LabF8 + // The LabF9 [lab_f9, lf9] string capability is the label on function key f9 if not f9. + LabF9 + // The MetaOff [meta_off, rmm] string capability is the turn off meta mode. + MetaOff + // The MetaOn [meta_on, smm] string capability is the turn on meta mode (8th-bit on). + MetaOn + // The Newline [newline, nel] string capability is the newline (behave like cr followed by lf). + Newline + // The PadChar [pad_char, pad] string capability is the padding char (instead of null). + PadChar + // The ParmDch [parm_dch, dch] string capability is the delete #1 characters (P*). + ParmDch + // The ParmDeleteLine [parm_delete_line, dl] string capability is the delete #1 lines (P*). + ParmDeleteLine + // The ParmDownCursor [parm_down_cursor, cud] string capability is the down #1 lines (P*). + ParmDownCursor + // The ParmIch [parm_ich, ich] string capability is the insert #1 characters (P*). + ParmIch + // The ParmIndex [parm_index, indn] string capability is the scroll forward #1 lines (P). + ParmIndex + // The ParmInsertLine [parm_insert_line, il] string capability is the insert #1 lines (P*). + ParmInsertLine + // The ParmLeftCursor [parm_left_cursor, cub] string capability is the move #1 characters to the left (P). + ParmLeftCursor + // The ParmRightCursor [parm_right_cursor, cuf] string capability is the move #1 characters to the right (P*). + ParmRightCursor + // The ParmRindex [parm_rindex, rin] string capability is the scroll back #1 lines (P). + ParmRindex + // The ParmUpCursor [parm_up_cursor, cuu] string capability is the up #1 lines (P*). + ParmUpCursor + // The PkeyKey [pkey_key, pfkey] string capability is the program function key #1 to type string #2. + PkeyKey + // The PkeyLocal [pkey_local, pfloc] string capability is the program function key #1 to execute string #2. + PkeyLocal + // The PkeyXmit [pkey_xmit, pfx] string capability is the program function key #1 to transmit string #2. + PkeyXmit + // The PrintScreen [print_screen, mc0] string capability is the print contents of screen. + PrintScreen + // The PrtrOff [prtr_off, mc4] string capability is the turn off printer. + PrtrOff + // The PrtrOn [prtr_on, mc5] string capability is the turn on printer. + PrtrOn + // The RepeatChar [repeat_char, rep] string capability is the repeat char #1 #2 times (P*). + RepeatChar + // The Reset1string [reset_1string, rs1] string capability is the reset string. + Reset1string + // The Reset2string [reset_2string, rs2] string capability is the reset string. + Reset2string + // The Reset3string [reset_3string, rs3] string capability is the reset string. + Reset3string + // The ResetFile [reset_file, rf] string capability is the name of reset file. + ResetFile + // The RestoreCursor [restore_cursor, rc] string capability is the restore cursor to position of last save_cursor. + RestoreCursor + // The RowAddress [row_address, vpa] string capability is the vertical position #1 absolute (P). + RowAddress + // The SaveCursor [save_cursor, sc] string capability is the save current cursor position (P). + SaveCursor + // The ScrollForward [scroll_forward, ind] string capability is the scroll text up (P). + ScrollForward + // The ScrollReverse [scroll_reverse, ri] string capability is the scroll text down (P). + ScrollReverse + // The SetAttributes [set_attributes, sgr] string capability is the define video attributes #1-#9 (PG9). + SetAttributes + // The SetTab [set_tab, hts] string capability is the set a tab in every row, current columns. + SetTab + // The SetWindow [set_window, wind] string capability is the current window is lines #1-#2 cols #3-#4. + SetWindow + // The Tab [tab, ht] string capability is the tab to next 8-space hardware tab stop. + Tab + // The ToStatusLine [to_status_line, tsl] string capability is the move to status line, column #1. + ToStatusLine + // The UnderlineChar [underline_char, uc] string capability is the underline char and move past it. + UnderlineChar + // The UpHalfLine [up_half_line, hu] string capability is the half a line up. + UpHalfLine + // The InitProg [init_prog, iprog] string capability is the path name of program for initialization. + InitProg + // The KeyA1 [key_a1, ka1] string capability is the upper left of keypad. + KeyA1 + // The KeyA3 [key_a3, ka3] string capability is the upper right of keypad. + KeyA3 + // The KeyB2 [key_b2, kb2] string capability is the center of keypad. + KeyB2 + // The KeyC1 [key_c1, kc1] string capability is the lower left of keypad. + KeyC1 + // The KeyC3 [key_c3, kc3] string capability is the lower right of keypad. + KeyC3 + // The PrtrNon [prtr_non, mc5p] string capability is the turn on printer for #1 bytes. + PrtrNon + // The CharPadding [char_padding, rmp] string capability is the like ip but when in insert mode. + CharPadding + // The AcsChars [acs_chars, acsc] string capability is the graphics charset pairs, based on vt100. + AcsChars + // The PlabNorm [plab_norm, pln] string capability is the program label #1 to show string #2. + PlabNorm + // The KeyBtab [key_btab, kcbt] string capability is the back-tab key. + KeyBtab + // The EnterXonMode [enter_xon_mode, smxon] string capability is the turn on xon/xoff handshaking. + EnterXonMode + // The ExitXonMode [exit_xon_mode, rmxon] string capability is the turn off xon/xoff handshaking. + ExitXonMode + // The EnterAmMode [enter_am_mode, smam] string capability is the turn on automatic margins. + EnterAmMode + // The ExitAmMode [exit_am_mode, rmam] string capability is the turn off automatic margins. + ExitAmMode + // The XonCharacter [xon_character, xonc] string capability is the XON character. + XonCharacter + // The XoffCharacter [xoff_character, xoffc] string capability is the XOFF character. + XoffCharacter + // The EnaAcs [ena_acs, enacs] string capability is the enable alternate char set. + EnaAcs + // The LabelOn [label_on, smln] string capability is the turn on soft labels. + LabelOn + // The LabelOff [label_off, rmln] string capability is the turn off soft labels. + LabelOff + // The KeyBeg [key_beg, kbeg] string capability is the begin key. + KeyBeg + // The KeyCancel [key_cancel, kcan] string capability is the cancel key. + KeyCancel + // The KeyClose [key_close, kclo] string capability is the close key. + KeyClose + // The KeyCommand [key_command, kcmd] string capability is the command key. + KeyCommand + // The KeyCopy [key_copy, kcpy] string capability is the copy key. + KeyCopy + // The KeyCreate [key_create, kcrt] string capability is the create key. + KeyCreate + // The KeyEnd [key_end, kend] string capability is the end key. + KeyEnd + // The KeyEnter [key_enter, kent] string capability is the enter/send key. + KeyEnter + // The KeyExit [key_exit, kext] string capability is the exit key. + KeyExit + // The KeyFind [key_find, kfnd] string capability is the find key. + KeyFind + // The KeyHelp [key_help, khlp] string capability is the help key. + KeyHelp + // The KeyMark [key_mark, kmrk] string capability is the mark key. + KeyMark + // The KeyMessage [key_message, kmsg] string capability is the message key. + KeyMessage + // The KeyMove [key_move, kmov] string capability is the move key. + KeyMove + // The KeyNext [key_next, knxt] string capability is the next key. + KeyNext + // The KeyOpen [key_open, kopn] string capability is the open key. + KeyOpen + // The KeyOptions [key_options, kopt] string capability is the options key. + KeyOptions + // The KeyPrevious [key_previous, kprv] string capability is the previous key. + KeyPrevious + // The KeyPrint [key_print, kprt] string capability is the print key. + KeyPrint + // The KeyRedo [key_redo, krdo] string capability is the redo key. + KeyRedo + // The KeyReference [key_reference, kref] string capability is the reference key. + KeyReference + // The KeyRefresh [key_refresh, krfr] string capability is the refresh key. + KeyRefresh + // The KeyReplace [key_replace, krpl] string capability is the replace key. + KeyReplace + // The KeyRestart [key_restart, krst] string capability is the restart key. + KeyRestart + // The KeyResume [key_resume, kres] string capability is the resume key. + KeyResume + // The KeySave [key_save, ksav] string capability is the save key. + KeySave + // The KeySuspend [key_suspend, kspd] string capability is the suspend key. + KeySuspend + // The KeyUndo [key_undo, kund] string capability is the undo key. + KeyUndo + // The KeySbeg [key_sbeg, kBEG] string capability is the shifted begin key. + KeySbeg + // The KeyScancel [key_scancel, kCAN] string capability is the shifted cancel key. + KeyScancel + // The KeyScommand [key_scommand, kCMD] string capability is the shifted command key. + KeyScommand + // The KeyScopy [key_scopy, kCPY] string capability is the shifted copy key. + KeyScopy + // The KeyScreate [key_screate, kCRT] string capability is the shifted create key. + KeyScreate + // The KeySdc [key_sdc, kDC] string capability is the shifted delete-character key. + KeySdc + // The KeySdl [key_sdl, kDL] string capability is the shifted delete-line key. + KeySdl + // The KeySelect [key_select, kslt] string capability is the select key. + KeySelect + // The KeySend [key_send, kEND] string capability is the shifted end key. + KeySend + // The KeySeol [key_seol, kEOL] string capability is the shifted clear-to-end-of-line key. + KeySeol + // The KeySexit [key_sexit, kEXT] string capability is the shifted exit key. + KeySexit + // The KeySfind [key_sfind, kFND] string capability is the shifted find key. + KeySfind + // The KeyShelp [key_shelp, kHLP] string capability is the shifted help key. + KeyShelp + // The KeyShome [key_shome, kHOM] string capability is the shifted home key. + KeyShome + // The KeySic [key_sic, kIC] string capability is the shifted insert-character key. + KeySic + // The KeySleft [key_sleft, kLFT] string capability is the shifted left-arrow key. + KeySleft + // The KeySmessage [key_smessage, kMSG] string capability is the shifted message key. + KeySmessage + // The KeySmove [key_smove, kMOV] string capability is the shifted move key. + KeySmove + // The KeySnext [key_snext, kNXT] string capability is the shifted next key. + KeySnext + // The KeySoptions [key_soptions, kOPT] string capability is the shifted options key. + KeySoptions + // The KeySprevious [key_sprevious, kPRV] string capability is the shifted previous key. + KeySprevious + // The KeySprint [key_sprint, kPRT] string capability is the shifted print key. + KeySprint + // The KeySredo [key_sredo, kRDO] string capability is the shifted redo key. + KeySredo + // The KeySreplace [key_sreplace, kRPL] string capability is the shifted replace key. + KeySreplace + // The KeySright [key_sright, kRIT] string capability is the shifted right-arrow key. + KeySright + // The KeySrsume [key_srsume, kRES] string capability is the shifted resume key. + KeySrsume + // The KeySsave [key_ssave, kSAV] string capability is the shifted save key. + KeySsave + // The KeySsuspend [key_ssuspend, kSPD] string capability is the shifted suspend key. + KeySsuspend + // The KeySundo [key_sundo, kUND] string capability is the shifted undo key. + KeySundo + // The ReqForInput [req_for_input, rfi] string capability is the send next input char (for ptys). + ReqForInput + // The KeyF11 [key_f11, kf11] string capability is the F11 function key. + KeyF11 + // The KeyF12 [key_f12, kf12] string capability is the F12 function key. + KeyF12 + // The KeyF13 [key_f13, kf13] string capability is the F13 function key. + KeyF13 + // The KeyF14 [key_f14, kf14] string capability is the F14 function key. + KeyF14 + // The KeyF15 [key_f15, kf15] string capability is the F15 function key. + KeyF15 + // The KeyF16 [key_f16, kf16] string capability is the F16 function key. + KeyF16 + // The KeyF17 [key_f17, kf17] string capability is the F17 function key. + KeyF17 + // The KeyF18 [key_f18, kf18] string capability is the F18 function key. + KeyF18 + // The KeyF19 [key_f19, kf19] string capability is the F19 function key. + KeyF19 + // The KeyF20 [key_f20, kf20] string capability is the F20 function key. + KeyF20 + // The KeyF21 [key_f21, kf21] string capability is the F21 function key. + KeyF21 + // The KeyF22 [key_f22, kf22] string capability is the F22 function key. + KeyF22 + // The KeyF23 [key_f23, kf23] string capability is the F23 function key. + KeyF23 + // The KeyF24 [key_f24, kf24] string capability is the F24 function key. + KeyF24 + // The KeyF25 [key_f25, kf25] string capability is the F25 function key. + KeyF25 + // The KeyF26 [key_f26, kf26] string capability is the F26 function key. + KeyF26 + // The KeyF27 [key_f27, kf27] string capability is the F27 function key. + KeyF27 + // The KeyF28 [key_f28, kf28] string capability is the F28 function key. + KeyF28 + // The KeyF29 [key_f29, kf29] string capability is the F29 function key. + KeyF29 + // The KeyF30 [key_f30, kf30] string capability is the F30 function key. + KeyF30 + // The KeyF31 [key_f31, kf31] string capability is the F31 function key. + KeyF31 + // The KeyF32 [key_f32, kf32] string capability is the F32 function key. + KeyF32 + // The KeyF33 [key_f33, kf33] string capability is the F33 function key. + KeyF33 + // The KeyF34 [key_f34, kf34] string capability is the F34 function key. + KeyF34 + // The KeyF35 [key_f35, kf35] string capability is the F35 function key. + KeyF35 + // The KeyF36 [key_f36, kf36] string capability is the F36 function key. + KeyF36 + // The KeyF37 [key_f37, kf37] string capability is the F37 function key. + KeyF37 + // The KeyF38 [key_f38, kf38] string capability is the F38 function key. + KeyF38 + // The KeyF39 [key_f39, kf39] string capability is the F39 function key. + KeyF39 + // The KeyF40 [key_f40, kf40] string capability is the F40 function key. + KeyF40 + // The KeyF41 [key_f41, kf41] string capability is the F41 function key. + KeyF41 + // The KeyF42 [key_f42, kf42] string capability is the F42 function key. + KeyF42 + // The KeyF43 [key_f43, kf43] string capability is the F43 function key. + KeyF43 + // The KeyF44 [key_f44, kf44] string capability is the F44 function key. + KeyF44 + // The KeyF45 [key_f45, kf45] string capability is the F45 function key. + KeyF45 + // The KeyF46 [key_f46, kf46] string capability is the F46 function key. + KeyF46 + // The KeyF47 [key_f47, kf47] string capability is the F47 function key. + KeyF47 + // The KeyF48 [key_f48, kf48] string capability is the F48 function key. + KeyF48 + // The KeyF49 [key_f49, kf49] string capability is the F49 function key. + KeyF49 + // The KeyF50 [key_f50, kf50] string capability is the F50 function key. + KeyF50 + // The KeyF51 [key_f51, kf51] string capability is the F51 function key. + KeyF51 + // The KeyF52 [key_f52, kf52] string capability is the F52 function key. + KeyF52 + // The KeyF53 [key_f53, kf53] string capability is the F53 function key. + KeyF53 + // The KeyF54 [key_f54, kf54] string capability is the F54 function key. + KeyF54 + // The KeyF55 [key_f55, kf55] string capability is the F55 function key. + KeyF55 + // The KeyF56 [key_f56, kf56] string capability is the F56 function key. + KeyF56 + // The KeyF57 [key_f57, kf57] string capability is the F57 function key. + KeyF57 + // The KeyF58 [key_f58, kf58] string capability is the F58 function key. + KeyF58 + // The KeyF59 [key_f59, kf59] string capability is the F59 function key. + KeyF59 + // The KeyF60 [key_f60, kf60] string capability is the F60 function key. + KeyF60 + // The KeyF61 [key_f61, kf61] string capability is the F61 function key. + KeyF61 + // The KeyF62 [key_f62, kf62] string capability is the F62 function key. + KeyF62 + // The KeyF63 [key_f63, kf63] string capability is the F63 function key. + KeyF63 + // The ClrBol [clr_bol, el1] string capability is the Clear to beginning of line. + ClrBol + // The ClearMargins [clear_margins, mgc] string capability is the clear right and left soft margins. + ClearMargins + // The SetLeftMargin [set_left_margin, smgl] string capability is the set left soft margin at current column. (ML is not in BSD termcap). + SetLeftMargin + // The SetRightMargin [set_right_margin, smgr] string capability is the set right soft margin at current column. + SetRightMargin + // The LabelFormat [label_format, fln] string capability is the label format. + LabelFormat + // The SetClock [set_clock, sclk] string capability is the set clock, #1 hrs #2 mins #3 secs. + SetClock + // The DisplayClock [display_clock, dclk] string capability is the display clock. + DisplayClock + // The RemoveClock [remove_clock, rmclk] string capability is the remove clock. + RemoveClock + // The CreateWindow [create_window, cwin] string capability is the define a window #1 from #2,#3 to #4,#5. + CreateWindow + // The GotoWindow [goto_window, wingo] string capability is the go to window #1. + GotoWindow + // The Hangup [hangup, hup] string capability is the hang-up phone. + Hangup + // The DialPhone [dial_phone, dial] string capability is the dial number #1. + DialPhone + // The QuickDial [quick_dial, qdial] string capability is the dial number #1 without checking. + QuickDial + // The Tone [tone, tone] string capability is the select touch tone dialing. + Tone + // The Pulse [pulse, pulse] string capability is the select pulse dialing. + Pulse + // The FlashHook [flash_hook, hook] string capability is the flash switch hook. + FlashHook + // The FixedPause [fixed_pause, pause] string capability is the pause for 2-3 seconds. + FixedPause + // The WaitTone [wait_tone, wait] string capability is the wait for dial-tone. + WaitTone + // The User0 [user0, u0] string capability is the User string #0. + User0 + // The User1 [user1, u1] string capability is the User string #1. + User1 + // The User2 [user2, u2] string capability is the User string #2. + User2 + // The User3 [user3, u3] string capability is the User string #3. + User3 + // The User4 [user4, u4] string capability is the User string #4. + User4 + // The User5 [user5, u5] string capability is the User string #5. + User5 + // The User6 [user6, u6] string capability is the User string #6. + User6 + // The User7 [user7, u7] string capability is the User string #7. + User7 + // The User8 [user8, u8] string capability is the User string #8. + User8 + // The User9 [user9, u9] string capability is the User string #9. + User9 + // The OrigPair [orig_pair, op] string capability is the Set default pair to its original value. + OrigPair + // The OrigColors [orig_colors, oc] string capability is the Set all color pairs to the original ones. + OrigColors + // The InitializeColor [initialize_color, initc] string capability is the initialize color #1 to (#2,#3,#4). + InitializeColor + // The InitializePair [initialize_pair, initp] string capability is the Initialize color pair #1 to fg=(#2,#3,#4), bg=(#5,#6,#7). + InitializePair + // The SetColorPair [set_color_pair, scp] string capability is the Set current color pair to #1. + SetColorPair + // The SetForeground [set_foreground, setf] string capability is the Set foreground color #1. + SetForeground + // The SetBackground [set_background, setb] string capability is the Set background color #1. + SetBackground + // The ChangeCharPitch [change_char_pitch, cpi] string capability is the Change number of characters per inch to #1. + ChangeCharPitch + // The ChangeLinePitch [change_line_pitch, lpi] string capability is the Change number of lines per inch to #1. + ChangeLinePitch + // The ChangeResHorz [change_res_horz, chr] string capability is the Change horizontal resolution to #1. + ChangeResHorz + // The ChangeResVert [change_res_vert, cvr] string capability is the Change vertical resolution to #1. + ChangeResVert + // The DefineChar [define_char, defc] string capability is the Define a character #1, #2 dots wide, descender #3. + DefineChar + // The EnterDoublewideMode [enter_doublewide_mode, swidm] string capability is the Enter double-wide mode. + EnterDoublewideMode + // The EnterDraftQuality [enter_draft_quality, sdrfq] string capability is the Enter draft-quality mode. + EnterDraftQuality + // The EnterItalicsMode [enter_italics_mode, sitm] string capability is the Enter italic mode. + EnterItalicsMode + // The EnterLeftwardMode [enter_leftward_mode, slm] string capability is the Start leftward carriage motion. + EnterLeftwardMode + // The EnterMicroMode [enter_micro_mode, smicm] string capability is the Start micro-motion mode. + EnterMicroMode + // The EnterNearLetterQuality [enter_near_letter_quality, snlq] string capability is the Enter NLQ mode. + EnterNearLetterQuality + // The EnterNormalQuality [enter_normal_quality, snrmq] string capability is the Enter normal-quality mode. + EnterNormalQuality + // The EnterShadowMode [enter_shadow_mode, sshm] string capability is the Enter shadow-print mode. + EnterShadowMode + // The EnterSubscriptMode [enter_subscript_mode, ssubm] string capability is the Enter subscript mode. + EnterSubscriptMode + // The EnterSuperscriptMode [enter_superscript_mode, ssupm] string capability is the Enter superscript mode. + EnterSuperscriptMode + // The EnterUpwardMode [enter_upward_mode, sum] string capability is the Start upward carriage motion. + EnterUpwardMode + // The ExitDoublewideMode [exit_doublewide_mode, rwidm] string capability is the End double-wide mode. + ExitDoublewideMode + // The ExitItalicsMode [exit_italics_mode, ritm] string capability is the End italic mode. + ExitItalicsMode + // The ExitLeftwardMode [exit_leftward_mode, rlm] string capability is the End left-motion mode. + ExitLeftwardMode + // The ExitMicroMode [exit_micro_mode, rmicm] string capability is the End micro-motion mode. + ExitMicroMode + // The ExitShadowMode [exit_shadow_mode, rshm] string capability is the End shadow-print mode. + ExitShadowMode + // The ExitSubscriptMode [exit_subscript_mode, rsubm] string capability is the End subscript mode. + ExitSubscriptMode + // The ExitSuperscriptMode [exit_superscript_mode, rsupm] string capability is the End superscript mode. + ExitSuperscriptMode + // The ExitUpwardMode [exit_upward_mode, rum] string capability is the End reverse character motion. + ExitUpwardMode + // The MicroColumnAddress [micro_column_address, mhpa] string capability is the Like column_address in micro mode. + MicroColumnAddress + // The MicroDown [micro_down, mcud1] string capability is the Like cursor_down in micro mode. + MicroDown + // The MicroLeft [micro_left, mcub1] string capability is the Like cursor_left in micro mode. + MicroLeft + // The MicroRight [micro_right, mcuf1] string capability is the Like cursor_right in micro mode. + MicroRight + // The MicroRowAddress [micro_row_address, mvpa] string capability is the Like row_address #1 in micro mode. + MicroRowAddress + // The MicroUp [micro_up, mcuu1] string capability is the Like cursor_up in micro mode. + MicroUp + // The OrderOfPins [order_of_pins, porder] string capability is the Match software bits to print-head pins. + OrderOfPins + // The ParmDownMicro [parm_down_micro, mcud] string capability is the Like parm_down_cursor in micro mode. + ParmDownMicro + // The ParmLeftMicro [parm_left_micro, mcub] string capability is the Like parm_left_cursor in micro mode. + ParmLeftMicro + // The ParmRightMicro [parm_right_micro, mcuf] string capability is the Like parm_right_cursor in micro mode. + ParmRightMicro + // The ParmUpMicro [parm_up_micro, mcuu] string capability is the Like parm_up_cursor in micro mode. + ParmUpMicro + // The SelectCharSet [select_char_set, scs] string capability is the Select character set, #1. + SelectCharSet + // The SetBottomMargin [set_bottom_margin, smgb] string capability is the Set bottom margin at current line. + SetBottomMargin + // The SetBottomMarginParm [set_bottom_margin_parm, smgbp] string capability is the Set bottom margin at line #1 or (if smgtp is not given) #2 lines from bottom. + SetBottomMarginParm + // The SetLeftMarginParm [set_left_margin_parm, smglp] string capability is the Set left (right) margin at column #1. + SetLeftMarginParm + // The SetRightMarginParm [set_right_margin_parm, smgrp] string capability is the Set right margin at column #1. + SetRightMarginParm + // The SetTopMargin [set_top_margin, smgt] string capability is the Set top margin at current line. + SetTopMargin + // The SetTopMarginParm [set_top_margin_parm, smgtp] string capability is the Set top (bottom) margin at row #1. + SetTopMarginParm + // The StartBitImage [start_bit_image, sbim] string capability is the Start printing bit image graphics. + StartBitImage + // The StartCharSetDef [start_char_set_def, scsd] string capability is the Start character set definition #1, with #2 characters in the set. + StartCharSetDef + // The StopBitImage [stop_bit_image, rbim] string capability is the Stop printing bit image graphics. + StopBitImage + // The StopCharSetDef [stop_char_set_def, rcsd] string capability is the End definition of character set #1. + StopCharSetDef + // The SubscriptCharacters [subscript_characters, subcs] string capability is the List of subscriptable characters. + SubscriptCharacters + // The SuperscriptCharacters [superscript_characters, supcs] string capability is the List of superscriptable characters. + SuperscriptCharacters + // The TheseCauseCr [these_cause_cr, docr] string capability is the Printing any of these characters causes CR. + TheseCauseCr + // The ZeroMotion [zero_motion, zerom] string capability is the No motion for subsequent character. + ZeroMotion + // The CharSetNames [char_set_names, csnm] string capability is the Produce #1'th item from list of character set names. + CharSetNames + // The KeyMouse [key_mouse, kmous] string capability is the Mouse event has occurred. + KeyMouse + // The MouseInfo [mouse_info, minfo] string capability is the Mouse status information. + MouseInfo + // The ReqMousePos [req_mouse_pos, reqmp] string capability is the Request mouse position. + ReqMousePos + // The GetMouse [get_mouse, getm] string capability is the Curses should get button events, parameter #1 not documented. + GetMouse + // The SetAForeground [set_a_foreground, setaf] string capability is the Set foreground color to #1, using ANSI escape. + SetAForeground + // The SetABackground [set_a_background, setab] string capability is the Set background color to #1, using ANSI escape. + SetABackground + // The PkeyPlab [pkey_plab, pfxl] string capability is the Program function key #1 to type string #2 and show string #3. + PkeyPlab + // The DeviceType [device_type, devt] string capability is the Indicate language/codeset support. + DeviceType + // The CodeSetInit [code_set_init, csin] string capability is the Init sequence for multiple codesets. + CodeSetInit + // The Set0DesSeq [set0_des_seq, s0ds] string capability is the Shift to codeset 0 (EUC set 0, ASCII). + Set0DesSeq + // The Set1DesSeq [set1_des_seq, s1ds] string capability is the Shift to codeset 1. + Set1DesSeq + // The Set2DesSeq [set2_des_seq, s2ds] string capability is the Shift to codeset 2. + Set2DesSeq + // The Set3DesSeq [set3_des_seq, s3ds] string capability is the Shift to codeset 3. + Set3DesSeq + // The SetLrMargin [set_lr_margin, smglr] string capability is the Set both left and right margins to #1, #2. (ML is not in BSD termcap). + SetLrMargin + // The SetTbMargin [set_tb_margin, smgtb] string capability is the Sets both top and bottom margins to #1, #2. + SetTbMargin + // The BitImageRepeat [bit_image_repeat, birep] string capability is the Repeat bit image cell #1 #2 times. + BitImageRepeat + // The BitImageNewline [bit_image_newline, binel] string capability is the Move to next row of the bit image. + BitImageNewline + // The BitImageCarriageReturn [bit_image_carriage_return, bicr] string capability is the Move to beginning of same row. + BitImageCarriageReturn + // The ColorNames [color_names, colornm] string capability is the Give name for color #1. + ColorNames + // The DefineBitImageRegion [define_bit_image_region, defbi] string capability is the Define rectangular bit image region. + DefineBitImageRegion + // The EndBitImageRegion [end_bit_image_region, endbi] string capability is the End a bit-image region. + EndBitImageRegion + // The SetColorBand [set_color_band, setcolor] string capability is the Change to ribbon color #1. + SetColorBand + // The SetPageLength [set_page_length, slines] string capability is the Set page length to #1 lines. + SetPageLength + // The DisplayPcChar [display_pc_char, dispc] string capability is the Display PC character #1. + DisplayPcChar + // The EnterPcCharsetMode [enter_pc_charset_mode, smpch] string capability is the Enter PC character display mode. + EnterPcCharsetMode + // The ExitPcCharsetMode [exit_pc_charset_mode, rmpch] string capability is the Exit PC character display mode. + ExitPcCharsetMode + // The EnterScancodeMode [enter_scancode_mode, smsc] string capability is the Enter PC scancode mode. + EnterScancodeMode + // The ExitScancodeMode [exit_scancode_mode, rmsc] string capability is the Exit PC scancode mode. + ExitScancodeMode + // The PcTermOptions [pc_term_options, pctrm] string capability is the PC terminal options. + PcTermOptions + // The ScancodeEscape [scancode_escape, scesc] string capability is the Escape for scancode emulation. + ScancodeEscape + // The AltScancodeEsc [alt_scancode_esc, scesa] string capability is the Alternate escape for scancode emulation. + AltScancodeEsc + // The EnterHorizontalHlMode [enter_horizontal_hl_mode, ehhlm] string capability is the Enter horizontal highlight mode. + EnterHorizontalHlMode + // The EnterLeftHlMode [enter_left_hl_mode, elhlm] string capability is the Enter left highlight mode. + EnterLeftHlMode + // The EnterLowHlMode [enter_low_hl_mode, elohlm] string capability is the Enter low highlight mode. + EnterLowHlMode + // The EnterRightHlMode [enter_right_hl_mode, erhlm] string capability is the Enter right highlight mode. + EnterRightHlMode + // The EnterTopHlMode [enter_top_hl_mode, ethlm] string capability is the Enter top highlight mode. + EnterTopHlMode + // The EnterVerticalHlMode [enter_vertical_hl_mode, evhlm] string capability is the Enter vertical highlight mode. + EnterVerticalHlMode + // The SetAAttributes [set_a_attributes, sgr1] string capability is the Define second set of video attributes #1-#6. + SetAAttributes + // The SetPglenInch [set_pglen_inch, slength] string capability is the Set page length to #1 hundredth of an inch (some implementations use sL for termcap). + SetPglenInch + // The TermcapInit2 [termcap_init2, OTi2] string capability is the secondary initialization string. + TermcapInit2 + // The TermcapReset [termcap_reset, OTrs] string capability is the terminal reset string. + TermcapReset + // The LinefeedIfNotLf [linefeed_if_not_lf, OTnl] string capability is the use to move down. + LinefeedIfNotLf + // The BackspaceIfNotBs [backspace_if_not_bs, OTbc] string capability is the move left, if not ^H. + BackspaceIfNotBs + // The OtherNonFunctionKeys [other_non_function_keys, OTko] string capability is the list of self-mapped keycaps. + OtherNonFunctionKeys + // The ArrowKeyMap [arrow_key_map, OTma] string capability is the map motion-keys for vi version 2. + ArrowKeyMap + // The AcsUlcorner [acs_ulcorner, OTG2] string capability is the single upper left. + AcsUlcorner + // The AcsLlcorner [acs_llcorner, OTG3] string capability is the single lower left. + AcsLlcorner + // The AcsUrcorner [acs_urcorner, OTG1] string capability is the single upper right. + AcsUrcorner + // The AcsLrcorner [acs_lrcorner, OTG4] string capability is the single lower right. + AcsLrcorner + // The AcsLtee [acs_ltee, OTGR] string capability is the tee pointing right. + AcsLtee + // The AcsRtee [acs_rtee, OTGL] string capability is the tee pointing left. + AcsRtee + // The AcsBtee [acs_btee, OTGU] string capability is the tee pointing up. + AcsBtee + // The AcsTtee [acs_ttee, OTGD] string capability is the tee pointing down. + AcsTtee + // The AcsHline [acs_hline, OTGH] string capability is the single horizontal line. + AcsHline + // The AcsVline [acs_vline, OTGV] string capability is the single vertical line. + AcsVline + // The AcsPlus [acs_plus, OTGC] string capability is the single intersection. + AcsPlus + // The MemoryLock [memory_lock, meml] string capability is the lock memory above cursor. + MemoryLock + // The MemoryUnlock [memory_unlock, memu] string capability is the unlock memory. + MemoryUnlock + // The BoxChars1 [box_chars_1, box1] string capability is the box characters primary set. + BoxChars1 +) +const ( + // CapCountBool is the count of bool capabilities. + CapCountBool = ReturnDoesClrEol + 1 + // CapCountNum is the count of num capabilities. + CapCountNum = NumberOfFunctionKeys + 1 + // CapCountString is the count of string capabilities. + CapCountString = BoxChars1 + 1 +) + +// boolCapNames are the bool term cap names. +var boolCapNames = [...]string{ + "auto_left_margin", "bw", + "auto_right_margin", "am", + "no_esc_ctlc", "xsb", + "ceol_standout_glitch", "xhp", + "eat_newline_glitch", "xenl", + "erase_overstrike", "eo", + "generic_type", "gn", + "hard_copy", "hc", + "has_meta_key", "km", + "has_status_line", "hs", + "insert_null_glitch", "in", + "memory_above", "da", + "memory_below", "db", + "move_insert_mode", "mir", + "move_standout_mode", "msgr", + "over_strike", "os", + "status_line_esc_ok", "eslok", + "dest_tabs_magic_smso", "xt", + "tilde_glitch", "hz", + "transparent_underline", "ul", + "xon_xoff", "xon", + "needs_xon_xoff", "nxon", + "prtr_silent", "mc5i", + "hard_cursor", "chts", + "non_rev_rmcup", "nrrmc", + "no_pad_char", "npc", + "non_dest_scroll_region", "ndscr", + "can_change", "ccc", + "back_color_erase", "bce", + "hue_lightness_saturation", "hls", + "col_addr_glitch", "xhpa", + "cr_cancels_micro_mode", "crxm", + "has_print_wheel", "daisy", + "row_addr_glitch", "xvpa", + "semi_auto_right_margin", "sam", + "cpi_changes_res", "cpix", + "lpi_changes_res", "lpix", + "backspaces_with_bs", "OTbs", + "crt_no_scrolling", "OTns", + "no_correctly_working_cr", "OTnc", + "gnu_has_meta_key", "OTMT", + "linefeed_is_newline", "OTNL", + "has_hardware_tabs", "OTpt", + "return_does_clr_eol", "OTxr", +} + +// numCapNames are the num term cap names. +var numCapNames = [...]string{ + "columns", "cols", + "init_tabs", "it", + "lines", "lines", + "lines_of_memory", "lm", + "magic_cookie_glitch", "xmc", + "padding_baud_rate", "pb", + "virtual_terminal", "vt", + "width_status_line", "wsl", + "num_labels", "nlab", + "label_height", "lh", + "label_width", "lw", + "max_attributes", "ma", + "maximum_windows", "wnum", + "max_colors", "colors", + "max_pairs", "pairs", + "no_color_video", "ncv", + "buffer_capacity", "bufsz", + "dot_vert_spacing", "spinv", + "dot_horz_spacing", "spinh", + "max_micro_address", "maddr", + "max_micro_jump", "mjump", + "micro_col_size", "mcs", + "micro_line_size", "mls", + "number_of_pins", "npins", + "output_res_char", "orc", + "output_res_line", "orl", + "output_res_horz_inch", "orhi", + "output_res_vert_inch", "orvi", + "print_rate", "cps", + "wide_char_size", "widcs", + "buttons", "btns", + "bit_image_entwining", "bitwin", + "bit_image_type", "bitype", + "magic_cookie_glitch_ul", "OTug", + "carriage_return_delay", "OTdC", + "new_line_delay", "OTdN", + "backspace_delay", "OTdB", + "horizontal_tab_delay", "OTdT", + "number_of_function_keys", "OTkn", +} + +// stringCapNames are the string term cap names. +var stringCapNames = [...]string{ + "back_tab", "cbt", + "bell", "bel", + "carriage_return", "cr", + "change_scroll_region", "csr", + "clear_all_tabs", "tbc", + "clear_screen", "clear", + "clr_eol", "el", + "clr_eos", "ed", + "column_address", "hpa", + "command_character", "cmdch", + "cursor_address", "cup", + "cursor_down", "cud1", + "cursor_home", "home", + "cursor_invisible", "civis", + "cursor_left", "cub1", + "cursor_mem_address", "mrcup", + "cursor_normal", "cnorm", + "cursor_right", "cuf1", + "cursor_to_ll", "ll", + "cursor_up", "cuu1", + "cursor_visible", "cvvis", + "delete_character", "dch1", + "delete_line", "dl1", + "dis_status_line", "dsl", + "down_half_line", "hd", + "enter_alt_charset_mode", "smacs", + "enter_blink_mode", "blink", + "enter_bold_mode", "bold", + "enter_ca_mode", "smcup", + "enter_delete_mode", "smdc", + "enter_dim_mode", "dim", + "enter_insert_mode", "smir", + "enter_secure_mode", "invis", + "enter_protected_mode", "prot", + "enter_reverse_mode", "rev", + "enter_standout_mode", "smso", + "enter_underline_mode", "smul", + "erase_chars", "ech", + "exit_alt_charset_mode", "rmacs", + "exit_attribute_mode", "sgr0", + "exit_ca_mode", "rmcup", + "exit_delete_mode", "rmdc", + "exit_insert_mode", "rmir", + "exit_standout_mode", "rmso", + "exit_underline_mode", "rmul", + "flash_screen", "flash", + "form_feed", "ff", + "from_status_line", "fsl", + "init_1string", "is1", + "init_2string", "is2", + "init_3string", "is3", + "init_file", "if", + "insert_character", "ich1", + "insert_line", "il1", + "insert_padding", "ip", + "key_backspace", "kbs", + "key_catab", "ktbc", + "key_clear", "kclr", + "key_ctab", "kctab", + "key_dc", "kdch1", + "key_dl", "kdl1", + "key_down", "kcud1", + "key_eic", "krmir", + "key_eol", "kel", + "key_eos", "ked", + "key_f0", "kf0", + "key_f1", "kf1", + "key_f10", "kf10", + "key_f2", "kf2", + "key_f3", "kf3", + "key_f4", "kf4", + "key_f5", "kf5", + "key_f6", "kf6", + "key_f7", "kf7", + "key_f8", "kf8", + "key_f9", "kf9", + "key_home", "khome", + "key_ic", "kich1", + "key_il", "kil1", + "key_left", "kcub1", + "key_ll", "kll", + "key_npage", "knp", + "key_ppage", "kpp", + "key_right", "kcuf1", + "key_sf", "kind", + "key_sr", "kri", + "key_stab", "khts", + "key_up", "kcuu1", + "keypad_local", "rmkx", + "keypad_xmit", "smkx", + "lab_f0", "lf0", + "lab_f1", "lf1", + "lab_f10", "lf10", + "lab_f2", "lf2", + "lab_f3", "lf3", + "lab_f4", "lf4", + "lab_f5", "lf5", + "lab_f6", "lf6", + "lab_f7", "lf7", + "lab_f8", "lf8", + "lab_f9", "lf9", + "meta_off", "rmm", + "meta_on", "smm", + "newline", "nel", + "pad_char", "pad", + "parm_dch", "dch", + "parm_delete_line", "dl", + "parm_down_cursor", "cud", + "parm_ich", "ich", + "parm_index", "indn", + "parm_insert_line", "il", + "parm_left_cursor", "cub", + "parm_right_cursor", "cuf", + "parm_rindex", "rin", + "parm_up_cursor", "cuu", + "pkey_key", "pfkey", + "pkey_local", "pfloc", + "pkey_xmit", "pfx", + "print_screen", "mc0", + "prtr_off", "mc4", + "prtr_on", "mc5", + "repeat_char", "rep", + "reset_1string", "rs1", + "reset_2string", "rs2", + "reset_3string", "rs3", + "reset_file", "rf", + "restore_cursor", "rc", + "row_address", "vpa", + "save_cursor", "sc", + "scroll_forward", "ind", + "scroll_reverse", "ri", + "set_attributes", "sgr", + "set_tab", "hts", + "set_window", "wind", + "tab", "ht", + "to_status_line", "tsl", + "underline_char", "uc", + "up_half_line", "hu", + "init_prog", "iprog", + "key_a1", "ka1", + "key_a3", "ka3", + "key_b2", "kb2", + "key_c1", "kc1", + "key_c3", "kc3", + "prtr_non", "mc5p", + "char_padding", "rmp", + "acs_chars", "acsc", + "plab_norm", "pln", + "key_btab", "kcbt", + "enter_xon_mode", "smxon", + "exit_xon_mode", "rmxon", + "enter_am_mode", "smam", + "exit_am_mode", "rmam", + "xon_character", "xonc", + "xoff_character", "xoffc", + "ena_acs", "enacs", + "label_on", "smln", + "label_off", "rmln", + "key_beg", "kbeg", + "key_cancel", "kcan", + "key_close", "kclo", + "key_command", "kcmd", + "key_copy", "kcpy", + "key_create", "kcrt", + "key_end", "kend", + "key_enter", "kent", + "key_exit", "kext", + "key_find", "kfnd", + "key_help", "khlp", + "key_mark", "kmrk", + "key_message", "kmsg", + "key_move", "kmov", + "key_next", "knxt", + "key_open", "kopn", + "key_options", "kopt", + "key_previous", "kprv", + "key_print", "kprt", + "key_redo", "krdo", + "key_reference", "kref", + "key_refresh", "krfr", + "key_replace", "krpl", + "key_restart", "krst", + "key_resume", "kres", + "key_save", "ksav", + "key_suspend", "kspd", + "key_undo", "kund", + "key_sbeg", "kBEG", + "key_scancel", "kCAN", + "key_scommand", "kCMD", + "key_scopy", "kCPY", + "key_screate", "kCRT", + "key_sdc", "kDC", + "key_sdl", "kDL", + "key_select", "kslt", + "key_send", "kEND", + "key_seol", "kEOL", + "key_sexit", "kEXT", + "key_sfind", "kFND", + "key_shelp", "kHLP", + "key_shome", "kHOM", + "key_sic", "kIC", + "key_sleft", "kLFT", + "key_smessage", "kMSG", + "key_smove", "kMOV", + "key_snext", "kNXT", + "key_soptions", "kOPT", + "key_sprevious", "kPRV", + "key_sprint", "kPRT", + "key_sredo", "kRDO", + "key_sreplace", "kRPL", + "key_sright", "kRIT", + "key_srsume", "kRES", + "key_ssave", "kSAV", + "key_ssuspend", "kSPD", + "key_sundo", "kUND", + "req_for_input", "rfi", + "key_f11", "kf11", + "key_f12", "kf12", + "key_f13", "kf13", + "key_f14", "kf14", + "key_f15", "kf15", + "key_f16", "kf16", + "key_f17", "kf17", + "key_f18", "kf18", + "key_f19", "kf19", + "key_f20", "kf20", + "key_f21", "kf21", + "key_f22", "kf22", + "key_f23", "kf23", + "key_f24", "kf24", + "key_f25", "kf25", + "key_f26", "kf26", + "key_f27", "kf27", + "key_f28", "kf28", + "key_f29", "kf29", + "key_f30", "kf30", + "key_f31", "kf31", + "key_f32", "kf32", + "key_f33", "kf33", + "key_f34", "kf34", + "key_f35", "kf35", + "key_f36", "kf36", + "key_f37", "kf37", + "key_f38", "kf38", + "key_f39", "kf39", + "key_f40", "kf40", + "key_f41", "kf41", + "key_f42", "kf42", + "key_f43", "kf43", + "key_f44", "kf44", + "key_f45", "kf45", + "key_f46", "kf46", + "key_f47", "kf47", + "key_f48", "kf48", + "key_f49", "kf49", + "key_f50", "kf50", + "key_f51", "kf51", + "key_f52", "kf52", + "key_f53", "kf53", + "key_f54", "kf54", + "key_f55", "kf55", + "key_f56", "kf56", + "key_f57", "kf57", + "key_f58", "kf58", + "key_f59", "kf59", + "key_f60", "kf60", + "key_f61", "kf61", + "key_f62", "kf62", + "key_f63", "kf63", + "clr_bol", "el1", + "clear_margins", "mgc", + "set_left_margin", "smgl", + "set_right_margin", "smgr", + "label_format", "fln", + "set_clock", "sclk", + "display_clock", "dclk", + "remove_clock", "rmclk", + "create_window", "cwin", + "goto_window", "wingo", + "hangup", "hup", + "dial_phone", "dial", + "quick_dial", "qdial", + "tone", "tone", + "pulse", "pulse", + "flash_hook", "hook", + "fixed_pause", "pause", + "wait_tone", "wait", + "user0", "u0", + "user1", "u1", + "user2", "u2", + "user3", "u3", + "user4", "u4", + "user5", "u5", + "user6", "u6", + "user7", "u7", + "user8", "u8", + "user9", "u9", + "orig_pair", "op", + "orig_colors", "oc", + "initialize_color", "initc", + "initialize_pair", "initp", + "set_color_pair", "scp", + "set_foreground", "setf", + "set_background", "setb", + "change_char_pitch", "cpi", + "change_line_pitch", "lpi", + "change_res_horz", "chr", + "change_res_vert", "cvr", + "define_char", "defc", + "enter_doublewide_mode", "swidm", + "enter_draft_quality", "sdrfq", + "enter_italics_mode", "sitm", + "enter_leftward_mode", "slm", + "enter_micro_mode", "smicm", + "enter_near_letter_quality", "snlq", + "enter_normal_quality", "snrmq", + "enter_shadow_mode", "sshm", + "enter_subscript_mode", "ssubm", + "enter_superscript_mode", "ssupm", + "enter_upward_mode", "sum", + "exit_doublewide_mode", "rwidm", + "exit_italics_mode", "ritm", + "exit_leftward_mode", "rlm", + "exit_micro_mode", "rmicm", + "exit_shadow_mode", "rshm", + "exit_subscript_mode", "rsubm", + "exit_superscript_mode", "rsupm", + "exit_upward_mode", "rum", + "micro_column_address", "mhpa", + "micro_down", "mcud1", + "micro_left", "mcub1", + "micro_right", "mcuf1", + "micro_row_address", "mvpa", + "micro_up", "mcuu1", + "order_of_pins", "porder", + "parm_down_micro", "mcud", + "parm_left_micro", "mcub", + "parm_right_micro", "mcuf", + "parm_up_micro", "mcuu", + "select_char_set", "scs", + "set_bottom_margin", "smgb", + "set_bottom_margin_parm", "smgbp", + "set_left_margin_parm", "smglp", + "set_right_margin_parm", "smgrp", + "set_top_margin", "smgt", + "set_top_margin_parm", "smgtp", + "start_bit_image", "sbim", + "start_char_set_def", "scsd", + "stop_bit_image", "rbim", + "stop_char_set_def", "rcsd", + "subscript_characters", "subcs", + "superscript_characters", "supcs", + "these_cause_cr", "docr", + "zero_motion", "zerom", + "char_set_names", "csnm", + "key_mouse", "kmous", + "mouse_info", "minfo", + "req_mouse_pos", "reqmp", + "get_mouse", "getm", + "set_a_foreground", "setaf", + "set_a_background", "setab", + "pkey_plab", "pfxl", + "device_type", "devt", + "code_set_init", "csin", + "set0_des_seq", "s0ds", + "set1_des_seq", "s1ds", + "set2_des_seq", "s2ds", + "set3_des_seq", "s3ds", + "set_lr_margin", "smglr", + "set_tb_margin", "smgtb", + "bit_image_repeat", "birep", + "bit_image_newline", "binel", + "bit_image_carriage_return", "bicr", + "color_names", "colornm", + "define_bit_image_region", "defbi", + "end_bit_image_region", "endbi", + "set_color_band", "setcolor", + "set_page_length", "slines", + "display_pc_char", "dispc", + "enter_pc_charset_mode", "smpch", + "exit_pc_charset_mode", "rmpch", + "enter_scancode_mode", "smsc", + "exit_scancode_mode", "rmsc", + "pc_term_options", "pctrm", + "scancode_escape", "scesc", + "alt_scancode_esc", "scesa", + "enter_horizontal_hl_mode", "ehhlm", + "enter_left_hl_mode", "elhlm", + "enter_low_hl_mode", "elohlm", + "enter_right_hl_mode", "erhlm", + "enter_top_hl_mode", "ethlm", + "enter_vertical_hl_mode", "evhlm", + "set_a_attributes", "sgr1", + "set_pglen_inch", "slength", + "termcap_init2", "OTi2", + "termcap_reset", "OTrs", + "linefeed_if_not_lf", "OTnl", + "backspace_if_not_bs", "OTbc", + "other_non_function_keys", "OTko", + "arrow_key_map", "OTma", + "acs_ulcorner", "OTG2", + "acs_llcorner", "OTG3", + "acs_urcorner", "OTG1", + "acs_lrcorner", "OTG4", + "acs_ltee", "OTGR", + "acs_rtee", "OTGL", + "acs_btee", "OTGU", + "acs_ttee", "OTGD", + "acs_hline", "OTGH", + "acs_vline", "OTGV", + "acs_plus", "OTGC", + "memory_lock", "meml", + "memory_unlock", "memu", + "box_chars_1", "box1", +} diff --git a/vendor/github.com/xo/terminfo/color.go b/vendor/github.com/xo/terminfo/color.go new file mode 100644 index 000000000..76c439fc9 --- /dev/null +++ b/vendor/github.com/xo/terminfo/color.go @@ -0,0 +1,88 @@ +package terminfo + +import ( + "os" + "strconv" + "strings" +) + +// ColorLevel is the color level supported by a terminal. +type ColorLevel uint + +// ColorLevel values. +const ( + ColorLevelNone ColorLevel = iota + ColorLevelBasic + ColorLevelHundreds + ColorLevelMillions +) + +// String satisfies the Stringer interface. +func (c ColorLevel) String() string { + switch c { + case ColorLevelBasic: + return "basic" + case ColorLevelHundreds: + return "hundreds" + case ColorLevelMillions: + return "millions" + } + return "none" +} + +// ChromaFormatterName returns the github.com/alecthomas/chroma compatible +// formatter name for the color level. +func (c ColorLevel) ChromaFormatterName() string { + switch c { + case ColorLevelBasic: + return "terminal" + case ColorLevelHundreds: + return "terminal256" + case ColorLevelMillions: + return "terminal16m" + } + return "noop" +} + +// ColorLevelFromEnv returns the color level COLORTERM, FORCE_COLOR, +// TERM_PROGRAM, or determined from the TERM environment variable. +func ColorLevelFromEnv() (ColorLevel, error) { + // check for overriding environment variables + colorTerm, termProg, forceColor := os.Getenv("COLORTERM"), os.Getenv("TERM_PROGRAM"), os.Getenv("FORCE_COLOR") + switch { + case strings.Contains(colorTerm, "truecolor") || strings.Contains(colorTerm, "24bit") || termProg == "Hyper": + return ColorLevelMillions, nil + case colorTerm != "" || forceColor != "": + return ColorLevelBasic, nil + case termProg == "Apple_Terminal": + return ColorLevelHundreds, nil + case termProg == "iTerm.app": + ver := os.Getenv("TERM_PROGRAM_VERSION") + if ver == "" { + return ColorLevelHundreds, nil + } + i, err := strconv.Atoi(strings.Split(ver, ".")[0]) + if err != nil { + return ColorLevelNone, ErrInvalidTermProgramVersion + } + if i == 3 { + return ColorLevelMillions, nil + } + return ColorLevelHundreds, nil + } + // otherwise determine from TERM's max_colors capability + if term := os.Getenv("TERM"); term != "" { + ti, err := Load(term) + if err != nil { + return ColorLevelNone, err + } + v, ok := ti.Nums[MaxColors] + switch { + case !ok || v <= 16: + return ColorLevelNone, nil + case ok && v >= 256: + return ColorLevelHundreds, nil + } + } + return ColorLevelBasic, nil +} diff --git a/vendor/github.com/xo/terminfo/dec.go b/vendor/github.com/xo/terminfo/dec.go new file mode 100644 index 000000000..dacc88e38 --- /dev/null +++ b/vendor/github.com/xo/terminfo/dec.go @@ -0,0 +1,245 @@ +package terminfo + +import ( + "sort" +) + +const ( + // maxFileLength is the max file length. + maxFileLength = 4096 + // magic is the file magic for terminfo files. + magic = 0o432 + // magicExtended is the file magic for terminfo files with the extended + // number format. + magicExtended = 0o1036 +) + +// header fields. +const ( + fieldMagic = iota + fieldNameSize + fieldBoolCount + fieldNumCount + fieldStringCount + fieldTableSize +) + +// header extended fields. +const ( + fieldExtBoolCount = iota + fieldExtNumCount + fieldExtStringCount + fieldExtOffsetCount + fieldExtTableSize +) + +// hasInvalidCaps determines if the capabilities in h are invalid. +func hasInvalidCaps(h []int) bool { + return h[fieldBoolCount] > CapCountBool || + h[fieldNumCount] > CapCountNum || + h[fieldStringCount] > CapCountString +} + +// capLength returns the total length of the capabilities in bytes. +func capLength(h []int) int { + return h[fieldNameSize] + + h[fieldBoolCount] + + (h[fieldNameSize]+h[fieldBoolCount])%2 + // account for word align + h[fieldNumCount]*2 + + h[fieldStringCount]*2 + + h[fieldTableSize] +} + +// hasInvalidExtOffset determines if the extended offset field is valid. +func hasInvalidExtOffset(h []int) bool { + return h[fieldExtBoolCount]+ + h[fieldExtNumCount]+ + h[fieldExtStringCount]*2 != h[fieldExtOffsetCount] +} + +// extCapLength returns the total length of extended capabilities in bytes. +func extCapLength(h []int, numWidth int) int { + return h[fieldExtBoolCount] + + h[fieldExtBoolCount]%2 + // account for word align + h[fieldExtNumCount]*(numWidth/8) + + h[fieldExtOffsetCount]*2 + + h[fieldExtTableSize] +} + +// findNull finds the position of null in buf. +func findNull(buf []byte, i int) int { + for ; i < len(buf); i++ { + if buf[i] == 0 { + return i + } + } + return -1 +} + +// readStrings decodes n strings from string data table buf using the indexes in idx. +func readStrings(idx []int, buf []byte, n int) (map[int][]byte, int, error) { + var last int + m := make(map[int][]byte) + for i := 0; i < n; i++ { + start := idx[i] + if start < 0 { + continue + } + if end := findNull(buf, start); end != -1 { + m[i], last = buf[start:end], end+1 + } else { + return nil, 0, ErrInvalidStringTable + } + } + return m, last, nil +} + +// decoder holds state info while decoding a terminfo file. +type decoder struct { + buf []byte + pos int + n int +} + +// readBytes reads the next n bytes of buf, incrementing pos by n. +func (d *decoder) readBytes(n int) ([]byte, error) { + if d.n < d.pos+n { + return nil, ErrUnexpectedFileEnd + } + n, d.pos = d.pos, d.pos+n + return d.buf[n:d.pos], nil +} + +// readInts reads n number of ints with width w. +func (d *decoder) readInts(n, w int) ([]int, error) { + w /= 8 + l := n * w + buf, err := d.readBytes(l) + if err != nil { + return nil, err + } + // align + d.pos += d.pos % 2 + z := make([]int, n) + for i, j := 0, 0; i < l; i, j = i+w, j+1 { + switch w { + case 1: + z[i] = int(buf[i]) + case 2: + z[j] = int(int16(buf[i+1])<<8 | int16(buf[i])) + case 4: + z[j] = int(buf[i+3])<<24 | int(buf[i+2])<<16 | int(buf[i+1])<<8 | int(buf[i]) + } + } + return z, nil +} + +// readBools reads the next n bools. +func (d *decoder) readBools(n int) (map[int]bool, map[int]bool, error) { + buf, err := d.readInts(n, 8) + if err != nil { + return nil, nil, err + } + // process + bools, boolsM := make(map[int]bool), make(map[int]bool) + for i, b := range buf { + bools[i] = b == 1 + if int8(b) == -2 { + boolsM[i] = true + } + } + return bools, boolsM, nil +} + +// readNums reads the next n nums. +func (d *decoder) readNums(n, w int) (map[int]int, map[int]bool, error) { + buf, err := d.readInts(n, w) + if err != nil { + return nil, nil, err + } + // process + nums, numsM := make(map[int]int), make(map[int]bool) + for i := 0; i < n; i++ { + nums[i] = buf[i] + if buf[i] == -2 { + numsM[i] = true + } + } + return nums, numsM, nil +} + +// readStringTable reads the string data for n strings and the accompanying data +// table of length sz. +func (d *decoder) readStringTable(n, sz int) ([][]byte, []int, error) { + buf, err := d.readInts(n, 16) + if err != nil { + return nil, nil, err + } + // read string data table + data, err := d.readBytes(sz) + if err != nil { + return nil, nil, err + } + // align + d.pos += d.pos % 2 + // process + s := make([][]byte, n) + var m []int + for i := 0; i < n; i++ { + start := buf[i] + if start == -2 { + m = append(m, i) + } else if start >= 0 { + if end := findNull(data, start); end != -1 { + s[i] = data[start:end] + } else { + return nil, nil, ErrInvalidStringTable + } + } + } + return s, m, nil +} + +// readStrings reads the next n strings and processes the string data table of +// length sz. +func (d *decoder) readStrings(n, sz int) (map[int][]byte, map[int]bool, error) { + s, m, err := d.readStringTable(n, sz) + if err != nil { + return nil, nil, err + } + strs := make(map[int][]byte) + for k, v := range s { + if k == AcsChars { + v = canonicalizeAscChars(v) + } + strs[k] = v + } + strsM := make(map[int]bool, len(m)) + for _, k := range m { + strsM[k] = true + } + return strs, strsM, nil +} + +// canonicalizeAscChars reorders chars to be unique, in order. +// +// see repair_ascc in ncurses-6.3/progs/dump_entry.c +func canonicalizeAscChars(z []byte) []byte { + var c []byte + enc := make(map[byte]byte, len(z)/2) + for i := 0; i < len(z); i += 2 { + if _, ok := enc[z[i]]; !ok { + a, b := z[i], z[i+1] + // log.Printf(">>> a: %d %c, b: %d %c", a, a, b, b) + c, enc[a] = append(c, b), b + } + } + sort.Slice(c, func(i, j int) bool { + return c[i] < c[j] + }) + r := make([]byte, 2*len(c)) + for i := 0; i < len(c); i++ { + r[i*2], r[i*2+1] = c[i], enc[c[i]] + } + return r +} diff --git a/vendor/github.com/xo/terminfo/load.go b/vendor/github.com/xo/terminfo/load.go new file mode 100644 index 000000000..d7cd266cb --- /dev/null +++ b/vendor/github.com/xo/terminfo/load.go @@ -0,0 +1,64 @@ +package terminfo + +import ( + "os" + "os/user" + "path" + "strings" + "sync" +) + +// termCache is the terminfo cache. +var termCache = struct { + db map[string]*Terminfo + sync.RWMutex +}{ + db: make(map[string]*Terminfo), +} + +// Load follows the behavior described in terminfo(5) to find correct the +// terminfo file using the name, reads the file and then returns a Terminfo +// struct that describes the file. +func Load(name string) (*Terminfo, error) { + if name == "" { + return nil, ErrEmptyTermName + } + termCache.RLock() + ti, ok := termCache.db[name] + termCache.RUnlock() + if ok { + return ti, nil + } + var checkDirs []string + // check $TERMINFO + if dir := os.Getenv("TERMINFO"); dir != "" { + checkDirs = append(checkDirs, dir) + } + // check $HOME/.terminfo + u, err := user.Current() + if err != nil { + return nil, err + } + checkDirs = append(checkDirs, path.Join(u.HomeDir, ".terminfo")) + // check $TERMINFO_DIRS + if dirs := os.Getenv("TERMINFO_DIRS"); dirs != "" { + checkDirs = append(checkDirs, strings.Split(dirs, ":")...) + } + // check fallback directories + checkDirs = append(checkDirs, "/etc/terminfo", "/lib/terminfo", "/usr/share/terminfo") + for _, dir := range checkDirs { + ti, err = Open(dir, name) + if err != nil && err != ErrFileNotFound && !os.IsNotExist(err) { + return nil, err + } else if err == nil { + return ti, nil + } + } + return nil, ErrDatabaseDirectoryNotFound +} + +// LoadFromEnv loads the terminal info based on the name contained in +// environment variable TERM. +func LoadFromEnv() (*Terminfo, error) { + return Load(os.Getenv("TERM")) +} diff --git a/vendor/github.com/xo/terminfo/param.go b/vendor/github.com/xo/terminfo/param.go new file mode 100644 index 000000000..ed4cb86b6 --- /dev/null +++ b/vendor/github.com/xo/terminfo/param.go @@ -0,0 +1,405 @@ +package terminfo + +import ( + "bytes" + "fmt" + "io" + "strconv" + "strings" + "sync" +) + +// parametizer represents the a scan state for a parameterized string. +type parametizer struct { + // z is the string to parameterize + z []byte + // pos is the current position in s. + pos int + // nest is the current nest level. + nest int + // s is the variable stack. + s stack + // skipElse keeps the state of skipping else. + skipElse bool + // buf is the result buffer. + buf *bytes.Buffer + // params are the parameters to interpolate. + params [9]interface{} + // vars are dynamic variables. + vars [26]interface{} +} + +// staticVars are the static, global variables. +var staticVars = struct { + vars [26]interface{} + sync.Mutex +}{} + +var parametizerPool = sync.Pool{ + New: func() interface{} { + p := new(parametizer) + p.buf = bytes.NewBuffer(make([]byte, 0, 45)) + return p + }, +} + +// newParametizer returns a new initialized parametizer from the pool. +func newParametizer(z []byte) *parametizer { + p := parametizerPool.Get().(*parametizer) + p.z = z + return p +} + +// reset resets the parametizer. +func (p *parametizer) reset() { + p.pos, p.nest = 0, 0 + p.s.reset() + p.buf.Reset() + p.params, p.vars = [9]interface{}{}, [26]interface{}{} + parametizerPool.Put(p) +} + +// stateFn represents the state of the scanner as a function that returns the +// next state. +type stateFn func() stateFn + +// exec executes the parameterizer, interpolating the supplied parameters. +func (p *parametizer) exec() string { + for state := p.scanTextFn; state != nil; { + state = state() + } + return p.buf.String() +} + +// peek returns the next byte. +func (p *parametizer) peek() (byte, error) { + if p.pos >= len(p.z) { + return 0, io.EOF + } + return p.z[p.pos], nil +} + +// writeFrom writes the characters from ppos to pos to the buffer. +func (p *parametizer) writeFrom(ppos int) { + if p.pos > ppos { + // append remaining characters. + p.buf.Write(p.z[ppos:p.pos]) + } +} + +func (p *parametizer) scanTextFn() stateFn { + ppos := p.pos + for { + ch, err := p.peek() + if err != nil { + p.writeFrom(ppos) + return nil + } + if ch == '%' { + p.writeFrom(ppos) + p.pos++ + return p.scanCodeFn + } + p.pos++ + } +} + +func (p *parametizer) scanCodeFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + switch ch { + case '%': + p.buf.WriteByte('%') + case ':': + // this character is used to avoid interpreting "%-" and "%+" as operators. + // the next character is where the format really begins. + p.pos++ + _, err = p.peek() + if err != nil { + return nil + } + return p.scanFormatFn + case '#', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.': + return p.scanFormatFn + case 'o': + p.buf.WriteString(strconv.FormatInt(int64(p.s.popInt()), 8)) + case 'd': + p.buf.WriteString(strconv.Itoa(p.s.popInt())) + case 'x': + p.buf.WriteString(strconv.FormatInt(int64(p.s.popInt()), 16)) + case 'X': + p.buf.WriteString(strings.ToUpper(strconv.FormatInt(int64(p.s.popInt()), 16))) + case 's': + p.buf.WriteString(p.s.popString()) + case 'c': + p.buf.WriteByte(p.s.popByte()) + case 'p': + p.pos++ + return p.pushParamFn + case 'P': + p.pos++ + return p.setDsVarFn + case 'g': + p.pos++ + return p.getDsVarFn + case '\'': + p.pos++ + ch, err = p.peek() + if err != nil { + return nil + } + p.s.push(ch) + // skip the '\'' + p.pos++ + case '{': + p.pos++ + return p.pushIntfn + case 'l': + p.s.push(len(p.s.popString())) + case '+': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai + bi) + case '-': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai - bi) + case '*': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai * bi) + case '/': + bi, ai := p.s.popInt(), p.s.popInt() + if bi != 0 { + p.s.push(ai / bi) + } else { + p.s.push(0) + } + case 'm': + bi, ai := p.s.popInt(), p.s.popInt() + if bi != 0 { + p.s.push(ai % bi) + } else { + p.s.push(0) + } + case '&': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai & bi) + case '|': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai | bi) + case '^': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai ^ bi) + case '=': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai == bi) + case '>': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai > bi) + case '<': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai < bi) + case 'A': + bi, ai := p.s.popBool(), p.s.popBool() + p.s.push(ai && bi) + case 'O': + bi, ai := p.s.popBool(), p.s.popBool() + p.s.push(ai || bi) + case '!': + p.s.push(!p.s.popBool()) + case '~': + p.s.push(^p.s.popInt()) + case 'i': + for i := range p.params[:2] { + if n, ok := p.params[i].(int); ok { + p.params[i] = n + 1 + } + } + case '?', ';': + case 't': + return p.scanThenFn + case 'e': + p.skipElse = true + return p.skipTextFn + } + p.pos++ + return p.scanTextFn +} + +func (p *parametizer) scanFormatFn() stateFn { + // the character was already read, so no need to check the error. + ch, _ := p.peek() + // 6 should be the maximum length of a format string, for example "%:-9.9d". + f := []byte{'%', ch, 0, 0, 0, 0} + var err error + for { + p.pos++ + ch, err = p.peek() + if err != nil { + return nil + } + f = append(f, ch) + switch ch { + case 'o', 'd', 'x', 'X': + fmt.Fprintf(p.buf, string(f), p.s.popInt()) + break + case 's': + fmt.Fprintf(p.buf, string(f), p.s.popString()) + break + case 'c': + fmt.Fprintf(p.buf, string(f), p.s.popByte()) + break + } + } + p.pos++ + return p.scanTextFn +} + +func (p *parametizer) pushParamFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + if ai := int(ch - '1'); ai >= 0 && ai < len(p.params) { + p.s.push(p.params[ai]) + } else { + p.s.push(0) + } + // skip the '}' + p.pos++ + return p.scanTextFn +} + +func (p *parametizer) setDsVarFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + if ch >= 'A' && ch <= 'Z' { + staticVars.Lock() + staticVars.vars[int(ch-'A')] = p.s.pop() + staticVars.Unlock() + } else if ch >= 'a' && ch <= 'z' { + p.vars[int(ch-'a')] = p.s.pop() + } + p.pos++ + return p.scanTextFn +} + +func (p *parametizer) getDsVarFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + var a byte + if ch >= 'A' && ch <= 'Z' { + a = 'A' + } else if ch >= 'a' && ch <= 'z' { + a = 'a' + } + staticVars.Lock() + p.s.push(staticVars.vars[int(ch-a)]) + staticVars.Unlock() + p.pos++ + return p.scanTextFn +} + +func (p *parametizer) pushIntfn() stateFn { + var ai int + for { + ch, err := p.peek() + if err != nil { + return nil + } + p.pos++ + if ch < '0' || ch > '9' { + p.s.push(ai) + return p.scanTextFn + } + ai = (ai * 10) + int(ch-'0') + } +} + +func (p *parametizer) scanThenFn() stateFn { + p.pos++ + if p.s.popBool() { + return p.scanTextFn + } + p.skipElse = false + return p.skipTextFn +} + +func (p *parametizer) skipTextFn() stateFn { + for { + ch, err := p.peek() + if err != nil { + return nil + } + p.pos++ + if ch == '%' { + break + } + } + if p.skipElse { + return p.skipElseFn + } + return p.skipThenFn +} + +func (p *parametizer) skipThenFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + p.pos++ + switch ch { + case ';': + if p.nest == 0 { + return p.scanTextFn + } + p.nest-- + case '?': + p.nest++ + case 'e': + if p.nest == 0 { + return p.scanTextFn + } + } + return p.skipTextFn +} + +func (p *parametizer) skipElseFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + p.pos++ + switch ch { + case ';': + if p.nest == 0 { + return p.scanTextFn + } + p.nest-- + case '?': + p.nest++ + } + return p.skipTextFn +} + +// Printf evaluates a parameterized terminfo value z, interpolating params. +func Printf(z []byte, params ...interface{}) string { + p := newParametizer(z) + defer p.reset() + // make sure we always have 9 parameters -- makes it easier + // later to skip checks and its faster + for i := 0; i < len(p.params) && i < len(params); i++ { + p.params[i] = params[i] + } + return p.exec() +} + +// Fprintf evaluates a parameterized terminfo value z, interpolating params and +// writing to w. +func Fprintf(w io.Writer, z []byte, params ...interface{}) { + w.Write([]byte(Printf(z, params...))) +} diff --git a/vendor/github.com/xo/terminfo/stack.go b/vendor/github.com/xo/terminfo/stack.go new file mode 100644 index 000000000..a6de39503 --- /dev/null +++ b/vendor/github.com/xo/terminfo/stack.go @@ -0,0 +1,48 @@ +package terminfo + +type stack []interface{} + +func (s *stack) push(v interface{}) { + *s = append(*s, v) +} + +func (s *stack) pop() interface{} { + if len(*s) == 0 { + return nil + } + v := (*s)[len(*s)-1] + *s = (*s)[:len(*s)-1] + return v +} + +func (s *stack) popInt() int { + if i, ok := s.pop().(int); ok { + return i + } + return 0 +} + +func (s *stack) popBool() bool { + if b, ok := s.pop().(bool); ok { + return b + } + return false +} + +func (s *stack) popByte() byte { + if b, ok := s.pop().(byte); ok { + return b + } + return 0 +} + +func (s *stack) popString() string { + if a, ok := s.pop().(string); ok { + return a + } + return "" +} + +func (s *stack) reset() { + *s = (*s)[:0] +} diff --git a/vendor/github.com/xo/terminfo/terminfo.go b/vendor/github.com/xo/terminfo/terminfo.go new file mode 100644 index 000000000..69e3b6064 --- /dev/null +++ b/vendor/github.com/xo/terminfo/terminfo.go @@ -0,0 +1,479 @@ +// Package terminfo implements reading terminfo files in pure go. +package terminfo + +//go:generate go run gen.go + +import ( + "io" + "io/ioutil" + "path" + "strconv" + "strings" +) + +// Error is a terminfo error. +type Error string + +// Error satisfies the error interface. +func (err Error) Error() string { + return string(err) +} + +const ( + // ErrInvalidFileSize is the invalid file size error. + ErrInvalidFileSize Error = "invalid file size" + // ErrUnexpectedFileEnd is the unexpected file end error. + ErrUnexpectedFileEnd Error = "unexpected file end" + // ErrInvalidStringTable is the invalid string table error. + ErrInvalidStringTable Error = "invalid string table" + // ErrInvalidMagic is the invalid magic error. + ErrInvalidMagic Error = "invalid magic" + // ErrInvalidHeader is the invalid header error. + ErrInvalidHeader Error = "invalid header" + // ErrInvalidNames is the invalid names error. + ErrInvalidNames Error = "invalid names" + // ErrInvalidExtendedHeader is the invalid extended header error. + ErrInvalidExtendedHeader Error = "invalid extended header" + // ErrEmptyTermName is the empty term name error. + ErrEmptyTermName Error = "empty term name" + // ErrDatabaseDirectoryNotFound is the database directory not found error. + ErrDatabaseDirectoryNotFound Error = "database directory not found" + // ErrFileNotFound is the file not found error. + ErrFileNotFound Error = "file not found" + // ErrInvalidTermProgramVersion is the invalid TERM_PROGRAM_VERSION error. + ErrInvalidTermProgramVersion Error = "invalid TERM_PROGRAM_VERSION" +) + +// Terminfo describes a terminal's capabilities. +type Terminfo struct { + // File is the original source file. + File string + // Names are the provided cap names. + Names []string + // Bools are the bool capabilities. + Bools map[int]bool + // BoolsM are the missing bool capabilities. + BoolsM map[int]bool + // Nums are the num capabilities. + Nums map[int]int + // NumsM are the missing num capabilities. + NumsM map[int]bool + // Strings are the string capabilities. + Strings map[int][]byte + // StringsM are the missing string capabilities. + StringsM map[int]bool + // ExtBools are the extended bool capabilities. + ExtBools map[int]bool + // ExtBoolsNames is the map of extended bool capabilities to their index. + ExtBoolNames map[int][]byte + // ExtNums are the extended num capabilities. + ExtNums map[int]int + // ExtNumsNames is the map of extended num capabilities to their index. + ExtNumNames map[int][]byte + // ExtStrings are the extended string capabilities. + ExtStrings map[int][]byte + // ExtStringsNames is the map of extended string capabilities to their index. + ExtStringNames map[int][]byte +} + +// Decode decodes the terminfo data contained in buf. +func Decode(buf []byte) (*Terminfo, error) { + var err error + // check max file length + if len(buf) >= maxFileLength { + return nil, ErrInvalidFileSize + } + d := &decoder{ + buf: buf, + n: len(buf), + } + // read header + h, err := d.readInts(6, 16) + if err != nil { + return nil, err + } + var numWidth int + // check magic + switch { + case h[fieldMagic] == magic: + numWidth = 16 + case h[fieldMagic] == magicExtended: + numWidth = 32 + default: + return nil, ErrInvalidMagic + } + // check header + if hasInvalidCaps(h) { + return nil, ErrInvalidHeader + } + // check remaining length + if d.n-d.pos < capLength(h) { + return nil, ErrUnexpectedFileEnd + } + // read names + names, err := d.readBytes(h[fieldNameSize]) + if err != nil { + return nil, err + } + // check name is terminated properly + i := findNull(names, 0) + if i == -1 { + return nil, ErrInvalidNames + } + names = names[:i] + // read bool caps + bools, boolsM, err := d.readBools(h[fieldBoolCount]) + if err != nil { + return nil, err + } + // read num caps + nums, numsM, err := d.readNums(h[fieldNumCount], numWidth) + if err != nil { + return nil, err + } + // read string caps + strs, strsM, err := d.readStrings(h[fieldStringCount], h[fieldTableSize]) + if err != nil { + return nil, err + } + ti := &Terminfo{ + Names: strings.Split(string(names), "|"), + Bools: bools, + BoolsM: boolsM, + Nums: nums, + NumsM: numsM, + Strings: strs, + StringsM: strsM, + } + // at the end of file, so no extended caps + if d.pos >= d.n { + return ti, nil + } + // decode extended header + eh, err := d.readInts(5, 16) + if err != nil { + return nil, err + } + // check extended offset field + if hasInvalidExtOffset(eh) { + return nil, ErrInvalidExtendedHeader + } + // check extended cap lengths + if d.n-d.pos != extCapLength(eh, numWidth) { + return nil, ErrInvalidExtendedHeader + } + // read extended bool caps + ti.ExtBools, _, err = d.readBools(eh[fieldExtBoolCount]) + if err != nil { + return nil, err + } + // read extended num caps + ti.ExtNums, _, err = d.readNums(eh[fieldExtNumCount], numWidth) + if err != nil { + return nil, err + } + // read extended string data table indexes + extIndexes, err := d.readInts(eh[fieldExtOffsetCount], 16) + if err != nil { + return nil, err + } + // read string data table + extData, err := d.readBytes(eh[fieldExtTableSize]) + if err != nil { + return nil, err + } + // precautionary check that exactly at end of file + if d.pos != d.n { + return nil, ErrUnexpectedFileEnd + } + var last int + // read extended string caps + ti.ExtStrings, last, err = readStrings(extIndexes, extData, eh[fieldExtStringCount]) + if err != nil { + return nil, err + } + extIndexes, extData = extIndexes[eh[fieldExtStringCount]:], extData[last:] + // read extended bool names + ti.ExtBoolNames, _, err = readStrings(extIndexes, extData, eh[fieldExtBoolCount]) + if err != nil { + return nil, err + } + extIndexes = extIndexes[eh[fieldExtBoolCount]:] + // read extended num names + ti.ExtNumNames, _, err = readStrings(extIndexes, extData, eh[fieldExtNumCount]) + if err != nil { + return nil, err + } + extIndexes = extIndexes[eh[fieldExtNumCount]:] + // read extended string names + ti.ExtStringNames, _, err = readStrings(extIndexes, extData, eh[fieldExtStringCount]) + if err != nil { + return nil, err + } + // extIndexes = extIndexes[eh[fieldExtStringCount]:] + return ti, nil +} + +// Open reads the terminfo file name from the specified directory dir. +func Open(dir, name string) (*Terminfo, error) { + var err error + var buf []byte + var filename string + for _, f := range []string{ + path.Join(dir, name[0:1], name), + path.Join(dir, strconv.FormatUint(uint64(name[0]), 16), name), + } { + buf, err = ioutil.ReadFile(f) + if err == nil { + filename = f + break + } + } + if buf == nil { + return nil, ErrFileNotFound + } + // decode + ti, err := Decode(buf) + if err != nil { + return nil, err + } + // save original file name + ti.File = filename + // add to cache + termCache.Lock() + for _, n := range ti.Names { + termCache.db[n] = ti + } + termCache.Unlock() + return ti, nil +} + +// boolCaps returns all bool and extended capabilities using f to format the +// index key. +func (ti *Terminfo) boolCaps(f func(int) string, extended bool) map[string]bool { + m := make(map[string]bool, len(ti.Bools)+len(ti.ExtBools)) + if !extended { + for k, v := range ti.Bools { + m[f(k)] = v + } + } else { + for k, v := range ti.ExtBools { + m[string(ti.ExtBoolNames[k])] = v + } + } + return m +} + +// BoolCaps returns all bool capabilities. +func (ti *Terminfo) BoolCaps() map[string]bool { + return ti.boolCaps(BoolCapName, false) +} + +// BoolCapsShort returns all bool capabilities, using the short name as the +// index. +func (ti *Terminfo) BoolCapsShort() map[string]bool { + return ti.boolCaps(BoolCapNameShort, false) +} + +// ExtBoolCaps returns all extended bool capabilities. +func (ti *Terminfo) ExtBoolCaps() map[string]bool { + return ti.boolCaps(BoolCapName, true) +} + +// ExtBoolCapsShort returns all extended bool capabilities, using the short +// name as the index. +func (ti *Terminfo) ExtBoolCapsShort() map[string]bool { + return ti.boolCaps(BoolCapNameShort, true) +} + +// numCaps returns all num and extended capabilities using f to format the +// index key. +func (ti *Terminfo) numCaps(f func(int) string, extended bool) map[string]int { + m := make(map[string]int, len(ti.Nums)+len(ti.ExtNums)) + if !extended { + for k, v := range ti.Nums { + m[f(k)] = v + } + } else { + for k, v := range ti.ExtNums { + m[string(ti.ExtNumNames[k])] = v + } + } + return m +} + +// NumCaps returns all num capabilities. +func (ti *Terminfo) NumCaps() map[string]int { + return ti.numCaps(NumCapName, false) +} + +// NumCapsShort returns all num capabilities, using the short name as the +// index. +func (ti *Terminfo) NumCapsShort() map[string]int { + return ti.numCaps(NumCapNameShort, false) +} + +// ExtNumCaps returns all extended num capabilities. +func (ti *Terminfo) ExtNumCaps() map[string]int { + return ti.numCaps(NumCapName, true) +} + +// ExtNumCapsShort returns all extended num capabilities, using the short +// name as the index. +func (ti *Terminfo) ExtNumCapsShort() map[string]int { + return ti.numCaps(NumCapNameShort, true) +} + +// stringCaps returns all string and extended capabilities using f to format the +// index key. +func (ti *Terminfo) stringCaps(f func(int) string, extended bool) map[string][]byte { + m := make(map[string][]byte, len(ti.Strings)+len(ti.ExtStrings)) + if !extended { + for k, v := range ti.Strings { + m[f(k)] = v + } + } else { + for k, v := range ti.ExtStrings { + m[string(ti.ExtStringNames[k])] = v + } + } + return m +} + +// StringCaps returns all string capabilities. +func (ti *Terminfo) StringCaps() map[string][]byte { + return ti.stringCaps(StringCapName, false) +} + +// StringCapsShort returns all string capabilities, using the short name as the +// index. +func (ti *Terminfo) StringCapsShort() map[string][]byte { + return ti.stringCaps(StringCapNameShort, false) +} + +// ExtStringCaps returns all extended string capabilities. +func (ti *Terminfo) ExtStringCaps() map[string][]byte { + return ti.stringCaps(StringCapName, true) +} + +// ExtStringCapsShort returns all extended string capabilities, using the short +// name as the index. +func (ti *Terminfo) ExtStringCapsShort() map[string][]byte { + return ti.stringCaps(StringCapNameShort, true) +} + +// Has determines if the bool cap i is present. +func (ti *Terminfo) Has(i int) bool { + return ti.Bools[i] +} + +// Num returns the num cap i, or -1 if not present. +func (ti *Terminfo) Num(i int) int { + n, ok := ti.Nums[i] + if !ok { + return -1 + } + return n +} + +// Printf formats the string cap i, interpolating parameters v. +func (ti *Terminfo) Printf(i int, v ...interface{}) string { + return Printf(ti.Strings[i], v...) +} + +// Fprintf prints the string cap i to writer w, interpolating parameters v. +func (ti *Terminfo) Fprintf(w io.Writer, i int, v ...interface{}) { + Fprintf(w, ti.Strings[i], v...) +} + +// Color takes a foreground and background color and returns string that sets +// them for this terminal. +func (ti *Terminfo) Colorf(fg, bg int, str string) string { + maxColors := int(ti.Nums[MaxColors]) + // map bright colors to lower versions if the color table only holds 8. + if maxColors == 8 { + if fg > 7 && fg < 16 { + fg -= 8 + } + if bg > 7 && bg < 16 { + bg -= 8 + } + } + var s string + if maxColors > fg && fg >= 0 { + s += ti.Printf(SetAForeground, fg) + } + if maxColors > bg && bg >= 0 { + s += ti.Printf(SetABackground, bg) + } + return s + str + ti.Printf(ExitAttributeMode) +} + +// Goto returns a string suitable for addressing the cursor at the given +// row and column. The origin 0, 0 is in the upper left corner of the screen. +func (ti *Terminfo) Goto(row, col int) string { + return Printf(ti.Strings[CursorAddress], row, col) +} + +// Puts emits the string to the writer, but expands inline padding indications +// (of the form $<[delay]> where [delay] is msec) to a suitable number of +// padding characters (usually null bytes) based upon the supplied baud. At +// high baud rates, more padding characters will be inserted. +/*func (ti *Terminfo) Puts(w io.Writer, s string, lines, baud int) (int, error) { + var err error + for { + start := strings.Index(s, "$<") + if start == -1 { + // most strings don't need padding, which is good news! + return io.WriteString(w, s) + } + end := strings.Index(s, ">") + if end == -1 { + // unterminated... just emit bytes unadulterated. + return io.WriteString(w, "$<"+s) + } + var c int + c, err = io.WriteString(w, s[:start]) + if err != nil { + return n + c, err + } + n += c + s = s[start+2:] + val := s[:end] + s = s[end+1:] + var ms int + var dot, mandatory, asterisk bool + unit := 1000 + for _, ch := range val { + switch { + case ch >= '0' && ch <= '9': + ms = (ms * 10) + int(ch-'0') + if dot { + unit *= 10 + } + case ch == '.' && !dot: + dot = true + case ch == '*' && !asterisk: + ms *= lines + asterisk = true + case ch == '/': + mandatory = true + default: + break + } + } + z, pad := ((baud/8)/unit)*ms, ti.Strings[PadChar] + b := make([]byte, len(pad)*z) + for bp := copy(b, pad); bp < len(b); bp *= 2 { + copy(b[bp:], b[:bp]) + } + if (!ti.Bools[XonXoff] && baud > int(ti.Nums[PaddingBaudRate])) || mandatory { + c, err = w.Write(b) + if err != nil { + return n + c, err + } + n += c + } + } + return n, nil +}*/ diff --git a/vendor/golang.org/x/image/AUTHORS b/vendor/golang.org/x/image/AUTHORS new file mode 100644 index 000000000..15167cd74 --- /dev/null +++ b/vendor/golang.org/x/image/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/image/CONTRIBUTORS b/vendor/golang.org/x/image/CONTRIBUTORS new file mode 100644 index 000000000..1c4577e96 --- /dev/null +++ b/vendor/golang.org/x/image/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/image/LICENSE b/vendor/golang.org/x/image/LICENSE new file mode 100644 index 000000000..6a66aea5e --- /dev/null +++ b/vendor/golang.org/x/image/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/image/PATENTS b/vendor/golang.org/x/image/PATENTS new file mode 100644 index 000000000..733099041 --- /dev/null +++ b/vendor/golang.org/x/image/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/image/bmp/reader.go b/vendor/golang.org/x/image/bmp/reader.go new file mode 100644 index 000000000..52e25205c --- /dev/null +++ b/vendor/golang.org/x/image/bmp/reader.go @@ -0,0 +1,219 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package bmp implements a BMP image decoder and encoder. +// +// The BMP specification is at http://www.digicamsoft.com/bmp/bmp.html. +package bmp // import "golang.org/x/image/bmp" + +import ( + "errors" + "image" + "image/color" + "io" +) + +// ErrUnsupported means that the input BMP image uses a valid but unsupported +// feature. +var ErrUnsupported = errors.New("bmp: unsupported BMP image") + +func readUint16(b []byte) uint16 { + return uint16(b[0]) | uint16(b[1])<<8 +} + +func readUint32(b []byte) uint32 { + return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 +} + +// decodePaletted reads an 8 bit-per-pixel BMP image from r. +// If topDown is false, the image rows will be read bottom-up. +func decodePaletted(r io.Reader, c image.Config, topDown bool) (image.Image, error) { + paletted := image.NewPaletted(image.Rect(0, 0, c.Width, c.Height), c.ColorModel.(color.Palette)) + if c.Width == 0 || c.Height == 0 { + return paletted, nil + } + var tmp [4]byte + y0, y1, yDelta := c.Height-1, -1, -1 + if topDown { + y0, y1, yDelta = 0, c.Height, +1 + } + for y := y0; y != y1; y += yDelta { + p := paletted.Pix[y*paletted.Stride : y*paletted.Stride+c.Width] + if _, err := io.ReadFull(r, p); err != nil { + return nil, err + } + // Each row is 4-byte aligned. + if c.Width%4 != 0 { + _, err := io.ReadFull(r, tmp[:4-c.Width%4]) + if err != nil { + return nil, err + } + } + } + return paletted, nil +} + +// decodeRGB reads a 24 bit-per-pixel BMP image from r. +// If topDown is false, the image rows will be read bottom-up. +func decodeRGB(r io.Reader, c image.Config, topDown bool) (image.Image, error) { + rgba := image.NewRGBA(image.Rect(0, 0, c.Width, c.Height)) + if c.Width == 0 || c.Height == 0 { + return rgba, nil + } + // There are 3 bytes per pixel, and each row is 4-byte aligned. + b := make([]byte, (3*c.Width+3)&^3) + y0, y1, yDelta := c.Height-1, -1, -1 + if topDown { + y0, y1, yDelta = 0, c.Height, +1 + } + for y := y0; y != y1; y += yDelta { + if _, err := io.ReadFull(r, b); err != nil { + return nil, err + } + p := rgba.Pix[y*rgba.Stride : y*rgba.Stride+c.Width*4] + for i, j := 0, 0; i < len(p); i, j = i+4, j+3 { + // BMP images are stored in BGR order rather than RGB order. + p[i+0] = b[j+2] + p[i+1] = b[j+1] + p[i+2] = b[j+0] + p[i+3] = 0xFF + } + } + return rgba, nil +} + +// decodeNRGBA reads a 32 bit-per-pixel BMP image from r. +// If topDown is false, the image rows will be read bottom-up. +func decodeNRGBA(r io.Reader, c image.Config, topDown bool) (image.Image, error) { + rgba := image.NewNRGBA(image.Rect(0, 0, c.Width, c.Height)) + if c.Width == 0 || c.Height == 0 { + return rgba, nil + } + y0, y1, yDelta := c.Height-1, -1, -1 + if topDown { + y0, y1, yDelta = 0, c.Height, +1 + } + for y := y0; y != y1; y += yDelta { + p := rgba.Pix[y*rgba.Stride : y*rgba.Stride+c.Width*4] + if _, err := io.ReadFull(r, p); err != nil { + return nil, err + } + for i := 0; i < len(p); i += 4 { + // BMP images are stored in BGRA order rather than RGBA order. + p[i+0], p[i+2] = p[i+2], p[i+0] + } + } + return rgba, nil +} + +// Decode reads a BMP image from r and returns it as an image.Image. +// Limitation: The file must be 8, 24 or 32 bits per pixel. +func Decode(r io.Reader) (image.Image, error) { + c, bpp, topDown, err := decodeConfig(r) + if err != nil { + return nil, err + } + switch bpp { + case 8: + return decodePaletted(r, c, topDown) + case 24: + return decodeRGB(r, c, topDown) + case 32: + return decodeNRGBA(r, c, topDown) + } + panic("unreachable") +} + +// DecodeConfig returns the color model and dimensions of a BMP image without +// decoding the entire image. +// Limitation: The file must be 8, 24 or 32 bits per pixel. +func DecodeConfig(r io.Reader) (image.Config, error) { + config, _, _, err := decodeConfig(r) + return config, err +} + +func decodeConfig(r io.Reader) (config image.Config, bitsPerPixel int, topDown bool, err error) { + // We only support those BMP images that are a BITMAPFILEHEADER + // immediately followed by a BITMAPINFOHEADER. + const ( + fileHeaderLen = 14 + infoHeaderLen = 40 + v4InfoHeaderLen = 108 + v5InfoHeaderLen = 124 + ) + var b [1024]byte + if _, err := io.ReadFull(r, b[:fileHeaderLen+4]); err != nil { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + return image.Config{}, 0, false, err + } + if string(b[:2]) != "BM" { + return image.Config{}, 0, false, errors.New("bmp: invalid format") + } + offset := readUint32(b[10:14]) + infoLen := readUint32(b[14:18]) + if infoLen != infoHeaderLen && infoLen != v4InfoHeaderLen && infoLen != v5InfoHeaderLen { + return image.Config{}, 0, false, ErrUnsupported + } + if _, err := io.ReadFull(r, b[fileHeaderLen+4:fileHeaderLen+infoLen]); err != nil { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + return image.Config{}, 0, false, err + } + width := int(int32(readUint32(b[18:22]))) + height := int(int32(readUint32(b[22:26]))) + if height < 0 { + height, topDown = -height, true + } + if width < 0 || height < 0 { + return image.Config{}, 0, false, ErrUnsupported + } + // We only support 1 plane and 8, 24 or 32 bits per pixel and no + // compression. + planes, bpp, compression := readUint16(b[26:28]), readUint16(b[28:30]), readUint32(b[30:34]) + // if compression is set to BITFIELDS, but the bitmask is set to the default bitmask + // that would be used if compression was set to 0, we can continue as if compression was 0 + if compression == 3 && infoLen > infoHeaderLen && + readUint32(b[54:58]) == 0xff0000 && readUint32(b[58:62]) == 0xff00 && + readUint32(b[62:66]) == 0xff && readUint32(b[66:70]) == 0xff000000 { + compression = 0 + } + if planes != 1 || compression != 0 { + return image.Config{}, 0, false, ErrUnsupported + } + switch bpp { + case 8: + if offset != fileHeaderLen+infoLen+256*4 { + return image.Config{}, 0, false, ErrUnsupported + } + _, err = io.ReadFull(r, b[:256*4]) + if err != nil { + return image.Config{}, 0, false, err + } + pcm := make(color.Palette, 256) + for i := range pcm { + // BMP images are stored in BGR order rather than RGB order. + // Every 4th byte is padding. + pcm[i] = color.RGBA{b[4*i+2], b[4*i+1], b[4*i+0], 0xFF} + } + return image.Config{ColorModel: pcm, Width: width, Height: height}, 8, topDown, nil + case 24: + if offset != fileHeaderLen+infoLen { + return image.Config{}, 0, false, ErrUnsupported + } + return image.Config{ColorModel: color.RGBAModel, Width: width, Height: height}, 24, topDown, nil + case 32: + if offset != fileHeaderLen+infoLen { + return image.Config{}, 0, false, ErrUnsupported + } + return image.Config{ColorModel: color.RGBAModel, Width: width, Height: height}, 32, topDown, nil + } + return image.Config{}, 0, false, ErrUnsupported +} + +func init() { + image.RegisterFormat("bmp", "BM????\x00\x00\x00\x00", Decode, DecodeConfig) +} diff --git a/vendor/golang.org/x/image/bmp/writer.go b/vendor/golang.org/x/image/bmp/writer.go new file mode 100644 index 000000000..f07b39dba --- /dev/null +++ b/vendor/golang.org/x/image/bmp/writer.go @@ -0,0 +1,262 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package bmp + +import ( + "encoding/binary" + "errors" + "image" + "io" +) + +type header struct { + sigBM [2]byte + fileSize uint32 + resverved [2]uint16 + pixOffset uint32 + dibHeaderSize uint32 + width uint32 + height uint32 + colorPlane uint16 + bpp uint16 + compression uint32 + imageSize uint32 + xPixelsPerMeter uint32 + yPixelsPerMeter uint32 + colorUse uint32 + colorImportant uint32 +} + +func encodePaletted(w io.Writer, pix []uint8, dx, dy, stride, step int) error { + var padding []byte + if dx < step { + padding = make([]byte, step-dx) + } + for y := dy - 1; y >= 0; y-- { + min := y*stride + 0 + max := y*stride + dx + if _, err := w.Write(pix[min:max]); err != nil { + return err + } + if padding != nil { + if _, err := w.Write(padding); err != nil { + return err + } + } + } + return nil +} + +func encodeRGBA(w io.Writer, pix []uint8, dx, dy, stride, step int, opaque bool) error { + buf := make([]byte, step) + if opaque { + for y := dy - 1; y >= 0; y-- { + min := y*stride + 0 + max := y*stride + dx*4 + off := 0 + for i := min; i < max; i += 4 { + buf[off+2] = pix[i+0] + buf[off+1] = pix[i+1] + buf[off+0] = pix[i+2] + off += 3 + } + if _, err := w.Write(buf); err != nil { + return err + } + } + } else { + for y := dy - 1; y >= 0; y-- { + min := y*stride + 0 + max := y*stride + dx*4 + off := 0 + for i := min; i < max; i += 4 { + a := uint32(pix[i+3]) + if a == 0 { + buf[off+2] = 0 + buf[off+1] = 0 + buf[off+0] = 0 + buf[off+3] = 0 + off += 4 + continue + } else if a == 0xff { + buf[off+2] = pix[i+0] + buf[off+1] = pix[i+1] + buf[off+0] = pix[i+2] + buf[off+3] = 0xff + off += 4 + continue + } + buf[off+2] = uint8(((uint32(pix[i+0]) * 0xffff) / a) >> 8) + buf[off+1] = uint8(((uint32(pix[i+1]) * 0xffff) / a) >> 8) + buf[off+0] = uint8(((uint32(pix[i+2]) * 0xffff) / a) >> 8) + buf[off+3] = uint8(a) + off += 4 + } + if _, err := w.Write(buf); err != nil { + return err + } + } + } + return nil +} + +func encodeNRGBA(w io.Writer, pix []uint8, dx, dy, stride, step int, opaque bool) error { + buf := make([]byte, step) + if opaque { + for y := dy - 1; y >= 0; y-- { + min := y*stride + 0 + max := y*stride + dx*4 + off := 0 + for i := min; i < max; i += 4 { + buf[off+2] = pix[i+0] + buf[off+1] = pix[i+1] + buf[off+0] = pix[i+2] + off += 3 + } + if _, err := w.Write(buf); err != nil { + return err + } + } + } else { + for y := dy - 1; y >= 0; y-- { + min := y*stride + 0 + max := y*stride + dx*4 + off := 0 + for i := min; i < max; i += 4 { + buf[off+2] = pix[i+0] + buf[off+1] = pix[i+1] + buf[off+0] = pix[i+2] + buf[off+3] = pix[i+3] + off += 4 + } + if _, err := w.Write(buf); err != nil { + return err + } + } + } + return nil +} + +func encode(w io.Writer, m image.Image, step int) error { + b := m.Bounds() + buf := make([]byte, step) + for y := b.Max.Y - 1; y >= b.Min.Y; y-- { + off := 0 + for x := b.Min.X; x < b.Max.X; x++ { + r, g, b, _ := m.At(x, y).RGBA() + buf[off+2] = byte(r >> 8) + buf[off+1] = byte(g >> 8) + buf[off+0] = byte(b >> 8) + off += 3 + } + if _, err := w.Write(buf); err != nil { + return err + } + } + return nil +} + +// Encode writes the image m to w in BMP format. +func Encode(w io.Writer, m image.Image) error { + d := m.Bounds().Size() + if d.X < 0 || d.Y < 0 { + return errors.New("bmp: negative bounds") + } + h := &header{ + sigBM: [2]byte{'B', 'M'}, + fileSize: 14 + 40, + pixOffset: 14 + 40, + dibHeaderSize: 40, + width: uint32(d.X), + height: uint32(d.Y), + colorPlane: 1, + } + + var step int + var palette []byte + var opaque bool + switch m := m.(type) { + case *image.Gray: + step = (d.X + 3) &^ 3 + palette = make([]byte, 1024) + for i := 0; i < 256; i++ { + palette[i*4+0] = uint8(i) + palette[i*4+1] = uint8(i) + palette[i*4+2] = uint8(i) + palette[i*4+3] = 0xFF + } + h.imageSize = uint32(d.Y * step) + h.fileSize += uint32(len(palette)) + h.imageSize + h.pixOffset += uint32(len(palette)) + h.bpp = 8 + + case *image.Paletted: + step = (d.X + 3) &^ 3 + palette = make([]byte, 1024) + for i := 0; i < len(m.Palette) && i < 256; i++ { + r, g, b, _ := m.Palette[i].RGBA() + palette[i*4+0] = uint8(b >> 8) + palette[i*4+1] = uint8(g >> 8) + palette[i*4+2] = uint8(r >> 8) + palette[i*4+3] = 0xFF + } + h.imageSize = uint32(d.Y * step) + h.fileSize += uint32(len(palette)) + h.imageSize + h.pixOffset += uint32(len(palette)) + h.bpp = 8 + case *image.RGBA: + opaque = m.Opaque() + if opaque { + step = (3*d.X + 3) &^ 3 + h.bpp = 24 + } else { + step = 4 * d.X + h.bpp = 32 + } + h.imageSize = uint32(d.Y * step) + h.fileSize += h.imageSize + case *image.NRGBA: + opaque = m.Opaque() + if opaque { + step = (3*d.X + 3) &^ 3 + h.bpp = 24 + } else { + step = 4 * d.X + h.bpp = 32 + } + h.imageSize = uint32(d.Y * step) + h.fileSize += h.imageSize + default: + step = (3*d.X + 3) &^ 3 + h.imageSize = uint32(d.Y * step) + h.fileSize += h.imageSize + h.bpp = 24 + } + + if err := binary.Write(w, binary.LittleEndian, h); err != nil { + return err + } + if palette != nil { + if err := binary.Write(w, binary.LittleEndian, palette); err != nil { + return err + } + } + + if d.X == 0 || d.Y == 0 { + return nil + } + + switch m := m.(type) { + case *image.Gray: + return encodePaletted(w, m.Pix, d.X, d.Y, m.Stride, step) + case *image.Paletted: + return encodePaletted(w, m.Pix, d.X, d.Y, m.Stride, step) + case *image.RGBA: + return encodeRGBA(w, m.Pix, d.X, d.Y, m.Stride, step, opaque) + case *image.NRGBA: + return encodeNRGBA(w, m.Pix, d.X, d.Y, m.Stride, step, opaque) + } + return encode(w, m, step) +} diff --git a/vendor/golang.org/x/image/ccitt/reader.go b/vendor/golang.org/x/image/ccitt/reader.go new file mode 100644 index 000000000..16bd495d5 --- /dev/null +++ b/vendor/golang.org/x/image/ccitt/reader.go @@ -0,0 +1,697 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:generate go run gen.go + +// Package ccitt implements a CCITT (fax) image decoder. +package ccitt + +import ( + "encoding/binary" + "errors" + "image" + "io" + "math/bits" +) + +var ( + errInvalidBounds = errors.New("ccitt: invalid bounds") + errInvalidCode = errors.New("ccitt: invalid code") + errInvalidMode = errors.New("ccitt: invalid mode") + errInvalidOffset = errors.New("ccitt: invalid offset") + errMissingEOL = errors.New("ccitt: missing End-of-Line") + errRunLengthOverflowsWidth = errors.New("ccitt: run length overflows width") + errRunLengthTooLong = errors.New("ccitt: run length too long") + errUnsupportedMode = errors.New("ccitt: unsupported mode") + errUnsupportedSubFormat = errors.New("ccitt: unsupported sub-format") + errUnsupportedWidth = errors.New("ccitt: unsupported width") +) + +// Order specifies the bit ordering in a CCITT data stream. +type Order uint32 + +const ( + // LSB means Least Significant Bits first. + LSB Order = iota + // MSB means Most Significant Bits first. + MSB +) + +// SubFormat represents that the CCITT format consists of a number of +// sub-formats. Decoding or encoding a CCITT data stream requires knowing the +// sub-format context. It is not represented in the data stream per se. +type SubFormat uint32 + +const ( + Group3 SubFormat = iota + Group4 +) + +// Options are optional parameters. +type Options struct { + // Align means that some variable-bit-width codes are byte-aligned. + Align bool + // Invert means that black is the 1 bit or 0xFF byte, and white is 0. + Invert bool +} + +// maxWidth is the maximum (inclusive) supported width. This is a limitation of +// this implementation, to guard against integer overflow, and not anything +// inherent to the CCITT format. +const maxWidth = 1 << 20 + +func invertBytes(b []byte) { + for i, c := range b { + b[i] = ^c + } +} + +func reverseBitsWithinBytes(b []byte) { + for i, c := range b { + b[i] = bits.Reverse8(c) + } +} + +// highBits writes to dst (1 bit per pixel, most significant bit first) the +// high (0x80) bits from src (1 byte per pixel). It returns the number of bytes +// written and read such that dst[:d] is the packed form of src[:s]. +// +// For example, if src starts with the 8 bytes [0x7D, 0x7E, 0x7F, 0x80, 0x81, +// 0x82, 0x00, 0xFF] then 0x1D will be written to dst[0]. +// +// If src has (8 * len(dst)) or more bytes then only len(dst) bytes are +// written, (8 * len(dst)) bytes are read, and invert is ignored. +// +// Otherwise, if len(src) is not a multiple of 8 then the final byte written to +// dst is padded with 1 bits (if invert is true) or 0 bits. If inverted, the 1s +// are typically temporary, e.g. they will be flipped back to 0s by an +// invertBytes call in the highBits caller, reader.Read. +func highBits(dst []byte, src []byte, invert bool) (d int, s int) { + // Pack as many complete groups of 8 src bytes as we can. + n := len(src) / 8 + if n > len(dst) { + n = len(dst) + } + dstN := dst[:n] + for i := range dstN { + src8 := src[i*8 : i*8+8] + dstN[i] = ((src8[0] & 0x80) >> 0) | + ((src8[1] & 0x80) >> 1) | + ((src8[2] & 0x80) >> 2) | + ((src8[3] & 0x80) >> 3) | + ((src8[4] & 0x80) >> 4) | + ((src8[5] & 0x80) >> 5) | + ((src8[6] & 0x80) >> 6) | + ((src8[7] & 0x80) >> 7) + } + d, s = n, 8*n + dst, src = dst[d:], src[s:] + + // Pack up to 7 remaining src bytes, if there's room in dst. + if (len(dst) > 0) && (len(src) > 0) { + dstByte := byte(0) + if invert { + dstByte = 0xFF >> uint(len(src)) + } + for n, srcByte := range src { + dstByte |= (srcByte & 0x80) >> uint(n) + } + dst[0] = dstByte + d, s = d+1, s+len(src) + } + return d, s +} + +type bitReader struct { + r io.Reader + + // readErr is the error returned from the most recent r.Read call. As the + // io.Reader documentation says, when r.Read returns (n, err), "always + // process the n > 0 bytes returned before considering the error err". + readErr error + + // order is whether to process r's bytes LSB first or MSB first. + order Order + + // The high nBits bits of the bits field hold upcoming bits in MSB order. + bits uint64 + nBits uint32 + + // bytes[br:bw] holds bytes read from r but not yet loaded into bits. + br uint32 + bw uint32 + bytes [1024]uint8 +} + +func (b *bitReader) alignToByteBoundary() { + n := b.nBits & 7 + b.bits <<= n + b.nBits -= n +} + +// nextBitMaxNBits is the maximum possible value of bitReader.nBits after a +// bitReader.nextBit call, provided that bitReader.nBits was not more than this +// value before that call. +// +// Note that the decode function can unread bits, which can temporarily set the +// bitReader.nBits value above nextBitMaxNBits. +const nextBitMaxNBits = 31 + +func (b *bitReader) nextBit() (uint64, error) { + for { + if b.nBits > 0 { + bit := b.bits >> 63 + b.bits <<= 1 + b.nBits-- + return bit, nil + } + + if available := b.bw - b.br; available >= 4 { + // Read 32 bits, even though b.bits is a uint64, since the decode + // function may need to unread up to maxCodeLength bits, putting + // them back in the remaining (64 - 32) bits. TestMaxCodeLength + // checks that the generated maxCodeLength constant fits. + // + // If changing the Uint32 call, also change nextBitMaxNBits. + b.bits = uint64(binary.BigEndian.Uint32(b.bytes[b.br:])) << 32 + b.br += 4 + b.nBits = 32 + continue + } else if available > 0 { + b.bits = uint64(b.bytes[b.br]) << (7 * 8) + b.br++ + b.nBits = 8 + continue + } + + if b.readErr != nil { + return 0, b.readErr + } + + n, err := b.r.Read(b.bytes[:]) + b.br = 0 + b.bw = uint32(n) + b.readErr = err + + if b.order != MSB { + reverseBitsWithinBytes(b.bytes[:b.bw]) + } + } +} + +func decode(b *bitReader, decodeTable [][2]int16) (uint32, error) { + nBitsRead, bitsRead, state := uint32(0), uint64(0), int32(1) + for { + bit, err := b.nextBit() + if err != nil { + return 0, err + } + bitsRead |= bit << (63 - nBitsRead) + nBitsRead++ + // The "&1" is redundant, but can eliminate a bounds check. + state = int32(decodeTable[state][bit&1]) + if state < 0 { + return uint32(^state), nil + } else if state == 0 { + // Unread the bits we've read, then return errInvalidCode. + b.bits = (b.bits >> nBitsRead) | bitsRead + b.nBits += nBitsRead + return 0, errInvalidCode + } + } +} + +type reader struct { + br bitReader + subFormat SubFormat + + // width is the image width in pixels. + width int + + // rowsRemaining starts at the image height in pixels, when the reader is + // driven through the io.Reader interface, and decrements to zero as rows + // are decoded. When driven through DecodeIntoGray, this field is unused. + rowsRemaining int + + // curr and prev hold the current and previous rows. Each element is either + // 0x00 (black) or 0xFF (white). + // + // prev may be nil, when processing the first row. + curr []byte + prev []byte + + // ri is the read index. curr[:ri] are those bytes of curr that have been + // passed along via the Read method. + // + // When the reader is driven through DecodeIntoGray, instead of through the + // io.Reader interface, this field is unused. + ri int + + // wi is the write index. curr[:wi] are those bytes of curr that have + // already been decoded via the decodeRow method. + // + // What this implementation calls wi is roughly equivalent to what the spec + // calls the a0 index. + wi int + + // These fields are copied from the *Options (which may be nil). + align bool + invert bool + + // atStartOfRow is whether we have just started the row. Some parts of the + // spec say to treat this situation as if "wi = -1". + atStartOfRow bool + + // penColorIsWhite is whether the next run is black or white. + penColorIsWhite bool + + // seenStartOfImage is whether we've called the startDecode method. + seenStartOfImage bool + + // readErr is a sticky error for the Read method. + readErr error +} + +func (z *reader) Read(p []byte) (int, error) { + if z.readErr != nil { + return 0, z.readErr + } + originalP := p + + for len(p) > 0 { + // Allocate buffers (and decode any start-of-image codes), if + // processing the first or second row. + if z.curr == nil { + if !z.seenStartOfImage { + if z.readErr = z.startDecode(); z.readErr != nil { + break + } + z.atStartOfRow = true + } + z.curr = make([]byte, z.width) + } + + // Decode the next row, if necessary. + if z.atStartOfRow { + if z.rowsRemaining <= 0 { + if z.readErr = z.finishDecode(); z.readErr != nil { + break + } + z.readErr = io.EOF + break + } + if z.readErr = z.decodeRow(); z.readErr != nil { + break + } + z.rowsRemaining-- + } + + // Pack from z.curr (1 byte per pixel) to p (1 bit per pixel). + packD, packS := highBits(p, z.curr[z.ri:], z.invert) + p = p[packD:] + z.ri += packS + + // Prepare to decode the next row, if necessary. + if z.ri == len(z.curr) { + z.ri, z.curr, z.prev = 0, z.prev, z.curr + z.atStartOfRow = true + } + } + + n := len(originalP) - len(p) + if z.invert { + invertBytes(originalP[:n]) + } + return n, z.readErr +} + +func (z *reader) penColor() byte { + if z.penColorIsWhite { + return 0xFF + } + return 0x00 +} + +func (z *reader) startDecode() error { + switch z.subFormat { + case Group3: + if err := z.decodeEOL(); err != nil { + return err + } + + case Group4: + // No-op. + + default: + return errUnsupportedSubFormat + } + + z.seenStartOfImage = true + return nil +} + +func (z *reader) finishDecode() error { + numberOfEOLs := 0 + switch z.subFormat { + case Group3: + // The stream ends with a RTC (Return To Control) of 6 consecutive + // EOL's, but we should have already just seen an EOL, either in + // z.startDecode (for a zero-height image) or in z.decodeRow. + numberOfEOLs = 5 + + case Group4: + // The stream ends with two EOL's, the first of which is possibly + // byte-aligned. + numberOfEOLs = 2 + if err := z.decodeEOL(); err == nil { + numberOfEOLs-- + } else if err == errInvalidCode { + // Try again, this time starting from a byte boundary. + z.br.alignToByteBoundary() + } else { + return err + } + + default: + return errUnsupportedSubFormat + } + + for ; numberOfEOLs > 0; numberOfEOLs-- { + if err := z.decodeEOL(); err != nil { + return err + } + } + return nil +} + +func (z *reader) decodeEOL() error { + // TODO: EOL doesn't have to be in the modeDecodeTable. It could be in its + // own table, or we could just hard-code it, especially if we might need to + // cater for optional byte-alignment, or an arbitrary number (potentially + // more than 8) of 0-valued padding bits. + if mode, err := decode(&z.br, modeDecodeTable[:]); err != nil { + return err + } else if mode != modeEOL { + return errMissingEOL + } + return nil +} + +func (z *reader) decodeRow() error { + z.wi = 0 + z.atStartOfRow = true + z.penColorIsWhite = true + + if z.align { + z.br.alignToByteBoundary() + } + + switch z.subFormat { + case Group3: + for ; z.wi < len(z.curr); z.atStartOfRow = false { + if err := z.decodeRun(); err != nil { + return err + } + } + return z.decodeEOL() + + case Group4: + for ; z.wi < len(z.curr); z.atStartOfRow = false { + mode, err := decode(&z.br, modeDecodeTable[:]) + if err != nil { + return err + } + rm := readerMode{} + if mode < uint32(len(readerModes)) { + rm = readerModes[mode] + } + if rm.function == nil { + return errInvalidMode + } + if err := rm.function(z, rm.arg); err != nil { + return err + } + } + return nil + } + + return errUnsupportedSubFormat +} + +func (z *reader) decodeRun() error { + table := blackDecodeTable[:] + if z.penColorIsWhite { + table = whiteDecodeTable[:] + } + + total := 0 + for { + n, err := decode(&z.br, table) + if err != nil { + return err + } + if n > maxWidth { + panic("unreachable") + } + total += int(n) + if total > maxWidth { + return errRunLengthTooLong + } + // Anything 0x3F or below is a terminal code. + if n <= 0x3F { + break + } + } + + if total > (len(z.curr) - z.wi) { + return errRunLengthOverflowsWidth + } + dst := z.curr[z.wi : z.wi+total] + penColor := z.penColor() + for i := range dst { + dst[i] = penColor + } + z.wi += total + z.penColorIsWhite = !z.penColorIsWhite + + return nil +} + +// The various modes' semantics are based on determining a row of pixels' +// "changing elements": those pixels whose color differs from the one on its +// immediate left. +// +// The row above the first row is implicitly all white. Similarly, the column +// to the left of the first column is implicitly all white. +// +// For example, here's Figure 1 in "ITU-T Recommendation T.6", where the +// current and previous rows contain black (B) and white (w) pixels. The a? +// indexes point into curr, the b? indexes point into prev. +// +// b1 b2 +// v v +// prev: BBBBBwwwwwBBBwwwww +// curr: BBBwwwwwBBBBBBwwww +// ^ ^ ^ +// a0 a1 a2 +// +// a0 is the "reference element" or current decoder position, roughly +// equivalent to what this implementation calls reader.wi. +// +// a1 is the next changing element to the right of a0, on the "coding line" +// (the current row). +// +// a2 is the next changing element to the right of a1, again on curr. +// +// b1 is the first changing element on the "reference line" (the previous row) +// to the right of a0 and of opposite color to a0. +// +// b2 is the next changing element to the right of b1, again on prev. +// +// The various modes calculate a1 (and a2, for modeH): +// - modePass calculates that a1 is at or to the right of b2. +// - modeH calculates a1 and a2 without considering b1 or b2. +// - modeV* calculates a1 to be b1 plus an adjustment (between -3 and +3). + +const ( + findB1 = false + findB2 = true +) + +// findB finds either the b1 or b2 value. +func (z *reader) findB(whichB bool) int { + // The initial row is a special case. The previous row is implicitly all + // white, so that there are no changing pixel elements. We return b1 or b2 + // to be at the end of the row. + if len(z.prev) != len(z.curr) { + return len(z.curr) + } + + i := z.wi + + if z.atStartOfRow { + // a0 is implicitly at -1, on a white pixel. b1 is the first black + // pixel in the previous row. b2 is the first white pixel after that. + for ; (i < len(z.prev)) && (z.prev[i] == 0xFF); i++ { + } + if whichB == findB2 { + for ; (i < len(z.prev)) && (z.prev[i] == 0x00); i++ { + } + } + return i + } + + // As per figure 1 above, assume that the current pen color is white. + // First, walk past every contiguous black pixel in prev, starting at a0. + oppositeColor := ^z.penColor() + for ; (i < len(z.prev)) && (z.prev[i] == oppositeColor); i++ { + } + + // Then walk past every contiguous white pixel. + penColor := ^oppositeColor + for ; (i < len(z.prev)) && (z.prev[i] == penColor); i++ { + } + + // We're now at a black pixel (or at the end of the row). That's b1. + if whichB == findB2 { + // If we're looking for b2, walk past every contiguous black pixel + // again. + oppositeColor := ^penColor + for ; (i < len(z.prev)) && (z.prev[i] == oppositeColor); i++ { + } + } + + return i +} + +type readerMode struct { + function func(z *reader, arg int) error + arg int +} + +var readerModes = [...]readerMode{ + modePass: {function: readerModePass}, + modeH: {function: readerModeH}, + modeV0: {function: readerModeV, arg: +0}, + modeVR1: {function: readerModeV, arg: +1}, + modeVR2: {function: readerModeV, arg: +2}, + modeVR3: {function: readerModeV, arg: +3}, + modeVL1: {function: readerModeV, arg: -1}, + modeVL2: {function: readerModeV, arg: -2}, + modeVL3: {function: readerModeV, arg: -3}, + modeExt: {function: readerModeExt}, +} + +func readerModePass(z *reader, arg int) error { + b2 := z.findB(findB2) + if (b2 < z.wi) || (len(z.curr) < b2) { + return errInvalidOffset + } + dst := z.curr[z.wi:b2] + penColor := z.penColor() + for i := range dst { + dst[i] = penColor + } + z.wi = b2 + return nil +} + +func readerModeH(z *reader, arg int) error { + // The first iteration finds a1. The second finds a2. + for i := 0; i < 2; i++ { + if err := z.decodeRun(); err != nil { + return err + } + } + return nil +} + +func readerModeV(z *reader, arg int) error { + a1 := z.findB(findB1) + arg + if (a1 < z.wi) || (len(z.curr) < a1) { + return errInvalidOffset + } + dst := z.curr[z.wi:a1] + penColor := z.penColor() + for i := range dst { + dst[i] = penColor + } + z.wi = a1 + z.penColorIsWhite = !z.penColorIsWhite + return nil +} + +func readerModeExt(z *reader, arg int) error { + return errUnsupportedMode +} + +// DecodeIntoGray decodes the CCITT-formatted data in r into dst. +// +// It returns an error if dst's width and height don't match the implied width +// and height of CCITT-formatted data. +func DecodeIntoGray(dst *image.Gray, r io.Reader, order Order, sf SubFormat, opts *Options) error { + bounds := dst.Bounds() + if (bounds.Dx() < 0) || (bounds.Dy() < 0) { + return errInvalidBounds + } + if bounds.Dx() > maxWidth { + return errUnsupportedWidth + } + + z := reader{ + br: bitReader{r: r, order: order}, + subFormat: sf, + align: (opts != nil) && opts.Align, + invert: (opts != nil) && opts.Invert, + width: bounds.Dx(), + } + if err := z.startDecode(); err != nil { + return err + } + + width := bounds.Dx() + for y := bounds.Min.Y; y < bounds.Max.Y; y++ { + p := (y - bounds.Min.Y) * dst.Stride + z.curr = dst.Pix[p : p+width] + if err := z.decodeRow(); err != nil { + return err + } + z.curr, z.prev = nil, z.curr + } + + if err := z.finishDecode(); err != nil { + return err + } + + if z.invert { + for y := bounds.Min.Y; y < bounds.Max.Y; y++ { + p := (y - bounds.Min.Y) * dst.Stride + invertBytes(dst.Pix[p : p+width]) + } + } + + return nil +} + +// NewReader returns an io.Reader that decodes the CCITT-formatted data in r. +// The resultant byte stream is one bit per pixel (MSB first), with 1 meaning +// white and 0 meaning black. Each row in the result is byte-aligned. +func NewReader(r io.Reader, order Order, sf SubFormat, width int, height int, opts *Options) io.Reader { + readErr := error(nil) + if (width < 0) || (height < 0) { + readErr = errInvalidBounds + } else if width > maxWidth { + readErr = errUnsupportedWidth + } + + return &reader{ + br: bitReader{r: r, order: order}, + subFormat: sf, + align: (opts != nil) && opts.Align, + invert: (opts != nil) && opts.Invert, + width: width, + rowsRemaining: height, + readErr: readErr, + } +} diff --git a/vendor/golang.org/x/image/ccitt/table.go b/vendor/golang.org/x/image/ccitt/table.go new file mode 100644 index 000000000..f01cc12b5 --- /dev/null +++ b/vendor/golang.org/x/image/ccitt/table.go @@ -0,0 +1,989 @@ +// generated by "go run gen.go". DO NOT EDIT. + +package ccitt + +// Each decodeTable is represented by an array of [2]int16's: a binary tree. +// Each array element (other than element 0, which means invalid) is a branch +// node in that tree. The root node is always element 1 (the second element). +// +// To walk the tree, look at the next bit in the bit stream, using it to select +// the first or second element of the [2]int16. If that int16 is 0, we have an +// invalid code. If it is positive, go to that branch node. If it is negative, +// then we have a leaf node, whose value is the bitwise complement (the ^ +// operator) of that int16. +// +// Comments above each decodeTable also show the same structure visually. The +// "b123" lines show the 123'rd branch node. The "=XXXXX" lines show an invalid +// code. The "=v1234" lines show a leaf node with value 1234. When reading the +// bit stream, a 0 or 1 bit means to go up or down, as you move left to right. +// +// For example, in modeDecodeTable, branch node b005 is three steps up from the +// root node, meaning that we have already seen "000". If the next bit is "0" +// then we move to branch node b006. Otherwise, the next bit is "1", and we +// move to the leaf node v0000 (also known as the modePass constant). Indeed, +// the bits that encode modePass are "0001". +// +// Tables 1, 2 and 3 come from the "ITU-T Recommendation T.6: FACSIMILE CODING +// SCHEMES AND CODING CONTROL FUNCTIONS FOR GROUP 4 FACSIMILE APPARATUS" +// specification: +// +// https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-T.6-198811-I!!PDF-E&type=items + +// modeDecodeTable represents Table 1 and the End-of-Line code. +// +// +=XXXXX +// b015 +-+ +// | +=v0010 +// b014 +-+ +// | +=XXXXX +// b013 +-+ +// | +=XXXXX +// b012 +-+ +// | +=XXXXX +// b011 +-+ +// | +=XXXXX +// b009 +-+ +// | +=v0009 +// b007 +-+ +// | | +=v0008 +// b010 | +-+ +// | +=v0005 +// b006 +-+ +// | | +=v0007 +// b008 | +-+ +// | +=v0004 +// b005 +-+ +// | +=v0000 +// b003 +-+ +// | +=v0001 +// b002 +-+ +// | | +=v0006 +// b004 | +-+ +// | +=v0003 +// b001 +-+ +// +=v0002 +var modeDecodeTable = [...][2]int16{ + 0: {0, 0}, + 1: {2, ^2}, + 2: {3, 4}, + 3: {5, ^1}, + 4: {^6, ^3}, + 5: {6, ^0}, + 6: {7, 8}, + 7: {9, 10}, + 8: {^7, ^4}, + 9: {11, ^9}, + 10: {^8, ^5}, + 11: {12, 0}, + 12: {13, 0}, + 13: {14, 0}, + 14: {15, 0}, + 15: {0, ^10}, +} + +// whiteDecodeTable represents Tables 2 and 3 for a white run. +// +// +=XXXXX +// b059 +-+ +// | | +=v1792 +// b096 | | +-+ +// | | | | +=v1984 +// b100 | | | +-+ +// | | | +=v2048 +// b094 | | +-+ +// | | | | +=v2112 +// b101 | | | | +-+ +// | | | | | +=v2176 +// b097 | | | +-+ +// | | | | +=v2240 +// b102 | | | +-+ +// | | | +=v2304 +// b085 | +-+ +// | | +=v1856 +// b098 | | +-+ +// | | | +=v1920 +// b095 | +-+ +// | | +=v2368 +// b103 | | +-+ +// | | | +=v2432 +// b099 | +-+ +// | | +=v2496 +// b104 | +-+ +// | +=v2560 +// b040 +-+ +// | | +=v0029 +// b060 | +-+ +// | +=v0030 +// b026 +-+ +// | | +=v0045 +// b061 | | +-+ +// | | | +=v0046 +// b041 | +-+ +// | +=v0022 +// b016 +-+ +// | | +=v0023 +// b042 | | +-+ +// | | | | +=v0047 +// b062 | | | +-+ +// | | | +=v0048 +// b027 | +-+ +// | +=v0013 +// b008 +-+ +// | | +=v0020 +// b043 | | +-+ +// | | | | +=v0033 +// b063 | | | +-+ +// | | | +=v0034 +// b028 | | +-+ +// | | | | +=v0035 +// b064 | | | | +-+ +// | | | | | +=v0036 +// b044 | | | +-+ +// | | | | +=v0037 +// b065 | | | +-+ +// | | | +=v0038 +// b017 | +-+ +// | | +=v0019 +// b045 | | +-+ +// | | | | +=v0031 +// b066 | | | +-+ +// | | | +=v0032 +// b029 | +-+ +// | +=v0001 +// b004 +-+ +// | | +=v0012 +// b030 | | +-+ +// | | | | +=v0053 +// b067 | | | | +-+ +// | | | | | +=v0054 +// b046 | | | +-+ +// | | | +=v0026 +// b018 | | +-+ +// | | | | +=v0039 +// b068 | | | | +-+ +// | | | | | +=v0040 +// b047 | | | | +-+ +// | | | | | | +=v0041 +// b069 | | | | | +-+ +// | | | | | +=v0042 +// b031 | | | +-+ +// | | | | +=v0043 +// b070 | | | | +-+ +// | | | | | +=v0044 +// b048 | | | +-+ +// | | | +=v0021 +// b009 | +-+ +// | | +=v0028 +// b049 | | +-+ +// | | | | +=v0061 +// b071 | | | +-+ +// | | | +=v0062 +// b032 | | +-+ +// | | | | +=v0063 +// b072 | | | | +-+ +// | | | | | +=v0000 +// b050 | | | +-+ +// | | | | +=v0320 +// b073 | | | +-+ +// | | | +=v0384 +// b019 | +-+ +// | +=v0010 +// b002 +-+ +// | | +=v0011 +// b020 | | +-+ +// | | | | +=v0027 +// b051 | | | | +-+ +// | | | | | | +=v0059 +// b074 | | | | | +-+ +// | | | | | +=v0060 +// b033 | | | +-+ +// | | | | +=v1472 +// b086 | | | | +-+ +// | | | | | +=v1536 +// b075 | | | | +-+ +// | | | | | | +=v1600 +// b087 | | | | | +-+ +// | | | | | +=v1728 +// b052 | | | +-+ +// | | | +=v0018 +// b010 | | +-+ +// | | | | +=v0024 +// b053 | | | | +-+ +// | | | | | | +=v0049 +// b076 | | | | | +-+ +// | | | | | +=v0050 +// b034 | | | | +-+ +// | | | | | | +=v0051 +// b077 | | | | | | +-+ +// | | | | | | | +=v0052 +// b054 | | | | | +-+ +// | | | | | +=v0025 +// b021 | | | +-+ +// | | | | +=v0055 +// b078 | | | | +-+ +// | | | | | +=v0056 +// b055 | | | | +-+ +// | | | | | | +=v0057 +// b079 | | | | | +-+ +// | | | | | +=v0058 +// b035 | | | +-+ +// | | | +=v0192 +// b005 | +-+ +// | | +=v1664 +// b036 | | +-+ +// | | | | +=v0448 +// b080 | | | | +-+ +// | | | | | +=v0512 +// b056 | | | +-+ +// | | | | +=v0704 +// b088 | | | | +-+ +// | | | | | +=v0768 +// b081 | | | +-+ +// | | | +=v0640 +// b022 | | +-+ +// | | | | +=v0576 +// b082 | | | | +-+ +// | | | | | | +=v0832 +// b089 | | | | | +-+ +// | | | | | +=v0896 +// b057 | | | | +-+ +// | | | | | | +=v0960 +// b090 | | | | | | +-+ +// | | | | | | | +=v1024 +// b083 | | | | | +-+ +// | | | | | | +=v1088 +// b091 | | | | | +-+ +// | | | | | +=v1152 +// b037 | | | +-+ +// | | | | +=v1216 +// b092 | | | | +-+ +// | | | | | +=v1280 +// b084 | | | | +-+ +// | | | | | | +=v1344 +// b093 | | | | | +-+ +// | | | | | +=v1408 +// b058 | | | +-+ +// | | | +=v0256 +// b011 | +-+ +// | +=v0002 +// b001 +-+ +// | +=v0003 +// b012 | +-+ +// | | | +=v0128 +// b023 | | +-+ +// | | +=v0008 +// b006 | +-+ +// | | | +=v0009 +// b024 | | | +-+ +// | | | | | +=v0016 +// b038 | | | | +-+ +// | | | | +=v0017 +// b013 | | +-+ +// | | +=v0004 +// b003 +-+ +// | +=v0005 +// b014 | +-+ +// | | | +=v0014 +// b039 | | | +-+ +// | | | | +=v0015 +// b025 | | +-+ +// | | +=v0064 +// b007 +-+ +// | +=v0006 +// b015 +-+ +// +=v0007 +var whiteDecodeTable = [...][2]int16{ + 0: {0, 0}, + 1: {2, 3}, + 2: {4, 5}, + 3: {6, 7}, + 4: {8, 9}, + 5: {10, 11}, + 6: {12, 13}, + 7: {14, 15}, + 8: {16, 17}, + 9: {18, 19}, + 10: {20, 21}, + 11: {22, ^2}, + 12: {^3, 23}, + 13: {24, ^4}, + 14: {^5, 25}, + 15: {^6, ^7}, + 16: {26, 27}, + 17: {28, 29}, + 18: {30, 31}, + 19: {32, ^10}, + 20: {^11, 33}, + 21: {34, 35}, + 22: {36, 37}, + 23: {^128, ^8}, + 24: {^9, 38}, + 25: {39, ^64}, + 26: {40, 41}, + 27: {42, ^13}, + 28: {43, 44}, + 29: {45, ^1}, + 30: {^12, 46}, + 31: {47, 48}, + 32: {49, 50}, + 33: {51, 52}, + 34: {53, 54}, + 35: {55, ^192}, + 36: {^1664, 56}, + 37: {57, 58}, + 38: {^16, ^17}, + 39: {^14, ^15}, + 40: {59, 60}, + 41: {61, ^22}, + 42: {^23, 62}, + 43: {^20, 63}, + 44: {64, 65}, + 45: {^19, 66}, + 46: {67, ^26}, + 47: {68, 69}, + 48: {70, ^21}, + 49: {^28, 71}, + 50: {72, 73}, + 51: {^27, 74}, + 52: {75, ^18}, + 53: {^24, 76}, + 54: {77, ^25}, + 55: {78, 79}, + 56: {80, 81}, + 57: {82, 83}, + 58: {84, ^256}, + 59: {0, 85}, + 60: {^29, ^30}, + 61: {^45, ^46}, + 62: {^47, ^48}, + 63: {^33, ^34}, + 64: {^35, ^36}, + 65: {^37, ^38}, + 66: {^31, ^32}, + 67: {^53, ^54}, + 68: {^39, ^40}, + 69: {^41, ^42}, + 70: {^43, ^44}, + 71: {^61, ^62}, + 72: {^63, ^0}, + 73: {^320, ^384}, + 74: {^59, ^60}, + 75: {86, 87}, + 76: {^49, ^50}, + 77: {^51, ^52}, + 78: {^55, ^56}, + 79: {^57, ^58}, + 80: {^448, ^512}, + 81: {88, ^640}, + 82: {^576, 89}, + 83: {90, 91}, + 84: {92, 93}, + 85: {94, 95}, + 86: {^1472, ^1536}, + 87: {^1600, ^1728}, + 88: {^704, ^768}, + 89: {^832, ^896}, + 90: {^960, ^1024}, + 91: {^1088, ^1152}, + 92: {^1216, ^1280}, + 93: {^1344, ^1408}, + 94: {96, 97}, + 95: {98, 99}, + 96: {^1792, 100}, + 97: {101, 102}, + 98: {^1856, ^1920}, + 99: {103, 104}, + 100: {^1984, ^2048}, + 101: {^2112, ^2176}, + 102: {^2240, ^2304}, + 103: {^2368, ^2432}, + 104: {^2496, ^2560}, +} + +// blackDecodeTable represents Tables 2 and 3 for a black run. +// +// +=XXXXX +// b017 +-+ +// | | +=v1792 +// b042 | | +-+ +// | | | | +=v1984 +// b063 | | | +-+ +// | | | +=v2048 +// b029 | | +-+ +// | | | | +=v2112 +// b064 | | | | +-+ +// | | | | | +=v2176 +// b043 | | | +-+ +// | | | | +=v2240 +// b065 | | | +-+ +// | | | +=v2304 +// b022 | +-+ +// | | +=v1856 +// b044 | | +-+ +// | | | +=v1920 +// b030 | +-+ +// | | +=v2368 +// b066 | | +-+ +// | | | +=v2432 +// b045 | +-+ +// | | +=v2496 +// b067 | +-+ +// | +=v2560 +// b013 +-+ +// | | +=v0018 +// b031 | | +-+ +// | | | | +=v0052 +// b068 | | | | +-+ +// | | | | | | +=v0640 +// b095 | | | | | +-+ +// | | | | | +=v0704 +// b046 | | | +-+ +// | | | | +=v0768 +// b096 | | | | +-+ +// | | | | | +=v0832 +// b069 | | | +-+ +// | | | +=v0055 +// b023 | | +-+ +// | | | | +=v0056 +// b070 | | | | +-+ +// | | | | | | +=v1280 +// b097 | | | | | +-+ +// | | | | | +=v1344 +// b047 | | | | +-+ +// | | | | | | +=v1408 +// b098 | | | | | | +-+ +// | | | | | | | +=v1472 +// b071 | | | | | +-+ +// | | | | | +=v0059 +// b032 | | | +-+ +// | | | | +=v0060 +// b072 | | | | +-+ +// | | | | | | +=v1536 +// b099 | | | | | +-+ +// | | | | | +=v1600 +// b048 | | | +-+ +// | | | +=v0024 +// b018 | +-+ +// | | +=v0025 +// b049 | | +-+ +// | | | | +=v1664 +// b100 | | | | +-+ +// | | | | | +=v1728 +// b073 | | | +-+ +// | | | +=v0320 +// b033 | | +-+ +// | | | | +=v0384 +// b074 | | | | +-+ +// | | | | | +=v0448 +// b050 | | | +-+ +// | | | | +=v0512 +// b101 | | | | +-+ +// | | | | | +=v0576 +// b075 | | | +-+ +// | | | +=v0053 +// b024 | +-+ +// | | +=v0054 +// b076 | | +-+ +// | | | | +=v0896 +// b102 | | | +-+ +// | | | +=v0960 +// b051 | | +-+ +// | | | | +=v1024 +// b103 | | | | +-+ +// | | | | | +=v1088 +// b077 | | | +-+ +// | | | | +=v1152 +// b104 | | | +-+ +// | | | +=v1216 +// b034 | +-+ +// | +=v0064 +// b010 +-+ +// | | +=v0013 +// b019 | | +-+ +// | | | | +=v0023 +// b052 | | | | +-+ +// | | | | | | +=v0050 +// b078 | | | | | +-+ +// | | | | | +=v0051 +// b035 | | | | +-+ +// | | | | | | +=v0044 +// b079 | | | | | | +-+ +// | | | | | | | +=v0045 +// b053 | | | | | +-+ +// | | | | | | +=v0046 +// b080 | | | | | +-+ +// | | | | | +=v0047 +// b025 | | | +-+ +// | | | | +=v0057 +// b081 | | | | +-+ +// | | | | | +=v0058 +// b054 | | | | +-+ +// | | | | | | +=v0061 +// b082 | | | | | +-+ +// | | | | | +=v0256 +// b036 | | | +-+ +// | | | +=v0016 +// b014 | +-+ +// | | +=v0017 +// b037 | | +-+ +// | | | | +=v0048 +// b083 | | | | +-+ +// | | | | | +=v0049 +// b055 | | | +-+ +// | | | | +=v0062 +// b084 | | | +-+ +// | | | +=v0063 +// b026 | | +-+ +// | | | | +=v0030 +// b085 | | | | +-+ +// | | | | | +=v0031 +// b056 | | | | +-+ +// | | | | | | +=v0032 +// b086 | | | | | +-+ +// | | | | | +=v0033 +// b038 | | | +-+ +// | | | | +=v0040 +// b087 | | | | +-+ +// | | | | | +=v0041 +// b057 | | | +-+ +// | | | +=v0022 +// b020 | +-+ +// | +=v0014 +// b008 +-+ +// | | +=v0010 +// b015 | | +-+ +// | | | +=v0011 +// b011 | +-+ +// | | +=v0015 +// b027 | | +-+ +// | | | | +=v0128 +// b088 | | | | +-+ +// | | | | | +=v0192 +// b058 | | | | +-+ +// | | | | | | +=v0026 +// b089 | | | | | +-+ +// | | | | | +=v0027 +// b039 | | | +-+ +// | | | | +=v0028 +// b090 | | | | +-+ +// | | | | | +=v0029 +// b059 | | | +-+ +// | | | +=v0019 +// b021 | | +-+ +// | | | | +=v0020 +// b060 | | | | +-+ +// | | | | | | +=v0034 +// b091 | | | | | +-+ +// | | | | | +=v0035 +// b040 | | | | +-+ +// | | | | | | +=v0036 +// b092 | | | | | | +-+ +// | | | | | | | +=v0037 +// b061 | | | | | +-+ +// | | | | | | +=v0038 +// b093 | | | | | +-+ +// | | | | | +=v0039 +// b028 | | | +-+ +// | | | | +=v0021 +// b062 | | | | +-+ +// | | | | | | +=v0042 +// b094 | | | | | +-+ +// | | | | | +=v0043 +// b041 | | | +-+ +// | | | +=v0000 +// b016 | +-+ +// | +=v0012 +// b006 +-+ +// | | +=v0009 +// b012 | | +-+ +// | | | +=v0008 +// b009 | +-+ +// | +=v0007 +// b004 +-+ +// | | +=v0006 +// b007 | +-+ +// | +=v0005 +// b002 +-+ +// | | +=v0001 +// b005 | +-+ +// | +=v0004 +// b001 +-+ +// | +=v0003 +// b003 +-+ +// +=v0002 +var blackDecodeTable = [...][2]int16{ + 0: {0, 0}, + 1: {2, 3}, + 2: {4, 5}, + 3: {^3, ^2}, + 4: {6, 7}, + 5: {^1, ^4}, + 6: {8, 9}, + 7: {^6, ^5}, + 8: {10, 11}, + 9: {12, ^7}, + 10: {13, 14}, + 11: {15, 16}, + 12: {^9, ^8}, + 13: {17, 18}, + 14: {19, 20}, + 15: {^10, ^11}, + 16: {21, ^12}, + 17: {0, 22}, + 18: {23, 24}, + 19: {^13, 25}, + 20: {26, ^14}, + 21: {27, 28}, + 22: {29, 30}, + 23: {31, 32}, + 24: {33, 34}, + 25: {35, 36}, + 26: {37, 38}, + 27: {^15, 39}, + 28: {40, 41}, + 29: {42, 43}, + 30: {44, 45}, + 31: {^18, 46}, + 32: {47, 48}, + 33: {49, 50}, + 34: {51, ^64}, + 35: {52, 53}, + 36: {54, ^16}, + 37: {^17, 55}, + 38: {56, 57}, + 39: {58, 59}, + 40: {60, 61}, + 41: {62, ^0}, + 42: {^1792, 63}, + 43: {64, 65}, + 44: {^1856, ^1920}, + 45: {66, 67}, + 46: {68, 69}, + 47: {70, 71}, + 48: {72, ^24}, + 49: {^25, 73}, + 50: {74, 75}, + 51: {76, 77}, + 52: {^23, 78}, + 53: {79, 80}, + 54: {81, 82}, + 55: {83, 84}, + 56: {85, 86}, + 57: {87, ^22}, + 58: {88, 89}, + 59: {90, ^19}, + 60: {^20, 91}, + 61: {92, 93}, + 62: {^21, 94}, + 63: {^1984, ^2048}, + 64: {^2112, ^2176}, + 65: {^2240, ^2304}, + 66: {^2368, ^2432}, + 67: {^2496, ^2560}, + 68: {^52, 95}, + 69: {96, ^55}, + 70: {^56, 97}, + 71: {98, ^59}, + 72: {^60, 99}, + 73: {100, ^320}, + 74: {^384, ^448}, + 75: {101, ^53}, + 76: {^54, 102}, + 77: {103, 104}, + 78: {^50, ^51}, + 79: {^44, ^45}, + 80: {^46, ^47}, + 81: {^57, ^58}, + 82: {^61, ^256}, + 83: {^48, ^49}, + 84: {^62, ^63}, + 85: {^30, ^31}, + 86: {^32, ^33}, + 87: {^40, ^41}, + 88: {^128, ^192}, + 89: {^26, ^27}, + 90: {^28, ^29}, + 91: {^34, ^35}, + 92: {^36, ^37}, + 93: {^38, ^39}, + 94: {^42, ^43}, + 95: {^640, ^704}, + 96: {^768, ^832}, + 97: {^1280, ^1344}, + 98: {^1408, ^1472}, + 99: {^1536, ^1600}, + 100: {^1664, ^1728}, + 101: {^512, ^576}, + 102: {^896, ^960}, + 103: {^1024, ^1088}, + 104: {^1152, ^1216}, +} + +const maxCodeLength = 13 + +// Each encodeTable is represented by an array of bitStrings. + +// bitString is a pair of uint32 values representing a bit code. +// The nBits low bits of bits make up the actual bit code. +// Eg. bitString{0x0004, 8} represents the bitcode "00000100". +type bitString struct { + bits uint32 + nBits uint32 +} + +// modeEncodeTable represents Table 1 and the End-of-Line code. +var modeEncodeTable = [...]bitString{ + 0: {0x0001, 4}, // "0001" + 1: {0x0001, 3}, // "001" + 2: {0x0001, 1}, // "1" + 3: {0x0003, 3}, // "011" + 4: {0x0003, 6}, // "000011" + 5: {0x0003, 7}, // "0000011" + 6: {0x0002, 3}, // "010" + 7: {0x0002, 6}, // "000010" + 8: {0x0002, 7}, // "0000010" + 9: {0x0001, 7}, // "0000001" + 10: {0x0001, 12}, // "000000000001" +} + +// whiteEncodeTable2 represents Table 2 for a white run. +var whiteEncodeTable2 = [...]bitString{ + 0: {0x0035, 8}, // "00110101" + 1: {0x0007, 6}, // "000111" + 2: {0x0007, 4}, // "0111" + 3: {0x0008, 4}, // "1000" + 4: {0x000b, 4}, // "1011" + 5: {0x000c, 4}, // "1100" + 6: {0x000e, 4}, // "1110" + 7: {0x000f, 4}, // "1111" + 8: {0x0013, 5}, // "10011" + 9: {0x0014, 5}, // "10100" + 10: {0x0007, 5}, // "00111" + 11: {0x0008, 5}, // "01000" + 12: {0x0008, 6}, // "001000" + 13: {0x0003, 6}, // "000011" + 14: {0x0034, 6}, // "110100" + 15: {0x0035, 6}, // "110101" + 16: {0x002a, 6}, // "101010" + 17: {0x002b, 6}, // "101011" + 18: {0x0027, 7}, // "0100111" + 19: {0x000c, 7}, // "0001100" + 20: {0x0008, 7}, // "0001000" + 21: {0x0017, 7}, // "0010111" + 22: {0x0003, 7}, // "0000011" + 23: {0x0004, 7}, // "0000100" + 24: {0x0028, 7}, // "0101000" + 25: {0x002b, 7}, // "0101011" + 26: {0x0013, 7}, // "0010011" + 27: {0x0024, 7}, // "0100100" + 28: {0x0018, 7}, // "0011000" + 29: {0x0002, 8}, // "00000010" + 30: {0x0003, 8}, // "00000011" + 31: {0x001a, 8}, // "00011010" + 32: {0x001b, 8}, // "00011011" + 33: {0x0012, 8}, // "00010010" + 34: {0x0013, 8}, // "00010011" + 35: {0x0014, 8}, // "00010100" + 36: {0x0015, 8}, // "00010101" + 37: {0x0016, 8}, // "00010110" + 38: {0x0017, 8}, // "00010111" + 39: {0x0028, 8}, // "00101000" + 40: {0x0029, 8}, // "00101001" + 41: {0x002a, 8}, // "00101010" + 42: {0x002b, 8}, // "00101011" + 43: {0x002c, 8}, // "00101100" + 44: {0x002d, 8}, // "00101101" + 45: {0x0004, 8}, // "00000100" + 46: {0x0005, 8}, // "00000101" + 47: {0x000a, 8}, // "00001010" + 48: {0x000b, 8}, // "00001011" + 49: {0x0052, 8}, // "01010010" + 50: {0x0053, 8}, // "01010011" + 51: {0x0054, 8}, // "01010100" + 52: {0x0055, 8}, // "01010101" + 53: {0x0024, 8}, // "00100100" + 54: {0x0025, 8}, // "00100101" + 55: {0x0058, 8}, // "01011000" + 56: {0x0059, 8}, // "01011001" + 57: {0x005a, 8}, // "01011010" + 58: {0x005b, 8}, // "01011011" + 59: {0x004a, 8}, // "01001010" + 60: {0x004b, 8}, // "01001011" + 61: {0x0032, 8}, // "00110010" + 62: {0x0033, 8}, // "00110011" + 63: {0x0034, 8}, // "00110100" +} + +// whiteEncodeTable3 represents Table 3 for a white run. +var whiteEncodeTable3 = [...]bitString{ + 0: {0x001b, 5}, // "11011" + 1: {0x0012, 5}, // "10010" + 2: {0x0017, 6}, // "010111" + 3: {0x0037, 7}, // "0110111" + 4: {0x0036, 8}, // "00110110" + 5: {0x0037, 8}, // "00110111" + 6: {0x0064, 8}, // "01100100" + 7: {0x0065, 8}, // "01100101" + 8: {0x0068, 8}, // "01101000" + 9: {0x0067, 8}, // "01100111" + 10: {0x00cc, 9}, // "011001100" + 11: {0x00cd, 9}, // "011001101" + 12: {0x00d2, 9}, // "011010010" + 13: {0x00d3, 9}, // "011010011" + 14: {0x00d4, 9}, // "011010100" + 15: {0x00d5, 9}, // "011010101" + 16: {0x00d6, 9}, // "011010110" + 17: {0x00d7, 9}, // "011010111" + 18: {0x00d8, 9}, // "011011000" + 19: {0x00d9, 9}, // "011011001" + 20: {0x00da, 9}, // "011011010" + 21: {0x00db, 9}, // "011011011" + 22: {0x0098, 9}, // "010011000" + 23: {0x0099, 9}, // "010011001" + 24: {0x009a, 9}, // "010011010" + 25: {0x0018, 6}, // "011000" + 26: {0x009b, 9}, // "010011011" + 27: {0x0008, 11}, // "00000001000" + 28: {0x000c, 11}, // "00000001100" + 29: {0x000d, 11}, // "00000001101" + 30: {0x0012, 12}, // "000000010010" + 31: {0x0013, 12}, // "000000010011" + 32: {0x0014, 12}, // "000000010100" + 33: {0x0015, 12}, // "000000010101" + 34: {0x0016, 12}, // "000000010110" + 35: {0x0017, 12}, // "000000010111" + 36: {0x001c, 12}, // "000000011100" + 37: {0x001d, 12}, // "000000011101" + 38: {0x001e, 12}, // "000000011110" + 39: {0x001f, 12}, // "000000011111" +} + +// blackEncodeTable2 represents Table 2 for a black run. +var blackEncodeTable2 = [...]bitString{ + 0: {0x0037, 10}, // "0000110111" + 1: {0x0002, 3}, // "010" + 2: {0x0003, 2}, // "11" + 3: {0x0002, 2}, // "10" + 4: {0x0003, 3}, // "011" + 5: {0x0003, 4}, // "0011" + 6: {0x0002, 4}, // "0010" + 7: {0x0003, 5}, // "00011" + 8: {0x0005, 6}, // "000101" + 9: {0x0004, 6}, // "000100" + 10: {0x0004, 7}, // "0000100" + 11: {0x0005, 7}, // "0000101" + 12: {0x0007, 7}, // "0000111" + 13: {0x0004, 8}, // "00000100" + 14: {0x0007, 8}, // "00000111" + 15: {0x0018, 9}, // "000011000" + 16: {0x0017, 10}, // "0000010111" + 17: {0x0018, 10}, // "0000011000" + 18: {0x0008, 10}, // "0000001000" + 19: {0x0067, 11}, // "00001100111" + 20: {0x0068, 11}, // "00001101000" + 21: {0x006c, 11}, // "00001101100" + 22: {0x0037, 11}, // "00000110111" + 23: {0x0028, 11}, // "00000101000" + 24: {0x0017, 11}, // "00000010111" + 25: {0x0018, 11}, // "00000011000" + 26: {0x00ca, 12}, // "000011001010" + 27: {0x00cb, 12}, // "000011001011" + 28: {0x00cc, 12}, // "000011001100" + 29: {0x00cd, 12}, // "000011001101" + 30: {0x0068, 12}, // "000001101000" + 31: {0x0069, 12}, // "000001101001" + 32: {0x006a, 12}, // "000001101010" + 33: {0x006b, 12}, // "000001101011" + 34: {0x00d2, 12}, // "000011010010" + 35: {0x00d3, 12}, // "000011010011" + 36: {0x00d4, 12}, // "000011010100" + 37: {0x00d5, 12}, // "000011010101" + 38: {0x00d6, 12}, // "000011010110" + 39: {0x00d7, 12}, // "000011010111" + 40: {0x006c, 12}, // "000001101100" + 41: {0x006d, 12}, // "000001101101" + 42: {0x00da, 12}, // "000011011010" + 43: {0x00db, 12}, // "000011011011" + 44: {0x0054, 12}, // "000001010100" + 45: {0x0055, 12}, // "000001010101" + 46: {0x0056, 12}, // "000001010110" + 47: {0x0057, 12}, // "000001010111" + 48: {0x0064, 12}, // "000001100100" + 49: {0x0065, 12}, // "000001100101" + 50: {0x0052, 12}, // "000001010010" + 51: {0x0053, 12}, // "000001010011" + 52: {0x0024, 12}, // "000000100100" + 53: {0x0037, 12}, // "000000110111" + 54: {0x0038, 12}, // "000000111000" + 55: {0x0027, 12}, // "000000100111" + 56: {0x0028, 12}, // "000000101000" + 57: {0x0058, 12}, // "000001011000" + 58: {0x0059, 12}, // "000001011001" + 59: {0x002b, 12}, // "000000101011" + 60: {0x002c, 12}, // "000000101100" + 61: {0x005a, 12}, // "000001011010" + 62: {0x0066, 12}, // "000001100110" + 63: {0x0067, 12}, // "000001100111" +} + +// blackEncodeTable3 represents Table 3 for a black run. +var blackEncodeTable3 = [...]bitString{ + 0: {0x000f, 10}, // "0000001111" + 1: {0x00c8, 12}, // "000011001000" + 2: {0x00c9, 12}, // "000011001001" + 3: {0x005b, 12}, // "000001011011" + 4: {0x0033, 12}, // "000000110011" + 5: {0x0034, 12}, // "000000110100" + 6: {0x0035, 12}, // "000000110101" + 7: {0x006c, 13}, // "0000001101100" + 8: {0x006d, 13}, // "0000001101101" + 9: {0x004a, 13}, // "0000001001010" + 10: {0x004b, 13}, // "0000001001011" + 11: {0x004c, 13}, // "0000001001100" + 12: {0x004d, 13}, // "0000001001101" + 13: {0x0072, 13}, // "0000001110010" + 14: {0x0073, 13}, // "0000001110011" + 15: {0x0074, 13}, // "0000001110100" + 16: {0x0075, 13}, // "0000001110101" + 17: {0x0076, 13}, // "0000001110110" + 18: {0x0077, 13}, // "0000001110111" + 19: {0x0052, 13}, // "0000001010010" + 20: {0x0053, 13}, // "0000001010011" + 21: {0x0054, 13}, // "0000001010100" + 22: {0x0055, 13}, // "0000001010101" + 23: {0x005a, 13}, // "0000001011010" + 24: {0x005b, 13}, // "0000001011011" + 25: {0x0064, 13}, // "0000001100100" + 26: {0x0065, 13}, // "0000001100101" + 27: {0x0008, 11}, // "00000001000" + 28: {0x000c, 11}, // "00000001100" + 29: {0x000d, 11}, // "00000001101" + 30: {0x0012, 12}, // "000000010010" + 31: {0x0013, 12}, // "000000010011" + 32: {0x0014, 12}, // "000000010100" + 33: {0x0015, 12}, // "000000010101" + 34: {0x0016, 12}, // "000000010110" + 35: {0x0017, 12}, // "000000010111" + 36: {0x001c, 12}, // "000000011100" + 37: {0x001d, 12}, // "000000011101" + 38: {0x001e, 12}, // "000000011110" + 39: {0x001f, 12}, // "000000011111" +} + +// COPY PASTE table.go BEGIN + +const ( + modePass = iota // Pass + modeH // Horizontal + modeV0 // Vertical-0 + modeVR1 // Vertical-Right-1 + modeVR2 // Vertical-Right-2 + modeVR3 // Vertical-Right-3 + modeVL1 // Vertical-Left-1 + modeVL2 // Vertical-Left-2 + modeVL3 // Vertical-Left-3 + modeExt // Extension + modeEOL // End-of-Line +) + +// COPY PASTE table.go END diff --git a/vendor/golang.org/x/image/ccitt/writer.go b/vendor/golang.org/x/image/ccitt/writer.go new file mode 100644 index 000000000..87130ab04 --- /dev/null +++ b/vendor/golang.org/x/image/ccitt/writer.go @@ -0,0 +1,102 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ccitt + +import ( + "encoding/binary" + "io" +) + +type bitWriter struct { + w io.Writer + + // order is whether to process w's bytes LSB first or MSB first. + order Order + + // The high nBits bits of the bits field hold encoded bits to be written to w. + bits uint64 + nBits uint32 + + // bytes[:bw] holds encoded bytes not yet written to w. + // Overflow protection is ensured by using a multiple of 8 as bytes length. + bw uint32 + bytes [1024]uint8 +} + +// flushBits copies 64 bits from b.bits to b.bytes. If b.bytes is then full, it +// is written to b.w. +func (b *bitWriter) flushBits() error { + binary.BigEndian.PutUint64(b.bytes[b.bw:], b.bits) + b.bits = 0 + b.nBits = 0 + b.bw += 8 + if b.bw < uint32(len(b.bytes)) { + return nil + } + b.bw = 0 + if b.order != MSB { + reverseBitsWithinBytes(b.bytes[:]) + } + _, err := b.w.Write(b.bytes[:]) + return err +} + +// close finalizes a bitcode stream by writing any +// pending bits to bitWriter's underlying io.Writer. +func (b *bitWriter) close() error { + // Write any encoded bits to bytes. + if b.nBits > 0 { + binary.BigEndian.PutUint64(b.bytes[b.bw:], b.bits) + b.bw += (b.nBits + 7) >> 3 + } + + if b.order != MSB { + reverseBitsWithinBytes(b.bytes[:b.bw]) + } + + // Write b.bw bytes to b.w. + _, err := b.w.Write(b.bytes[:b.bw]) + return err +} + +// alignToByteBoundary rounds b.nBits up to a multiple of 8. +// If all 64 bits are used, flush them to bitWriter's bytes. +func (b *bitWriter) alignToByteBoundary() error { + if b.nBits = (b.nBits + 7) &^ 7; b.nBits == 64 { + return b.flushBits() + } + return nil +} + +// writeCode writes a variable length bitcode to b's underlying io.Writer. +func (b *bitWriter) writeCode(bs bitString) error { + bits := bs.bits + nBits := bs.nBits + if 64-b.nBits >= nBits { + // b.bits has sufficient room for storing nBits bits. + b.bits |= uint64(bits) << (64 - nBits - b.nBits) + b.nBits += nBits + if b.nBits == 64 { + return b.flushBits() + } + return nil + } + + // Number of leading bits that fill b.bits. + i := 64 - b.nBits + + // Fill b.bits then flush and write remaining bits. + b.bits |= uint64(bits) >> (nBits - i) + b.nBits = 64 + + if err := b.flushBits(); err != nil { + return err + } + + nBits -= i + b.bits = uint64(bits) << (64 - nBits) + b.nBits = nBits + return nil +} diff --git a/vendor/golang.org/x/image/riff/riff.go b/vendor/golang.org/x/image/riff/riff.go new file mode 100644 index 000000000..38dc0e568 --- /dev/null +++ b/vendor/golang.org/x/image/riff/riff.go @@ -0,0 +1,193 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package riff implements the Resource Interchange File Format, used by media +// formats such as AVI, WAVE and WEBP. +// +// A RIFF stream contains a sequence of chunks. Each chunk consists of an 8-byte +// header (containing a 4-byte chunk type and a 4-byte chunk length), the chunk +// data (presented as an io.Reader), and some padding bytes. +// +// A detailed description of the format is at +// http://www.tactilemedia.com/info/MCI_Control_Info.html +package riff // import "golang.org/x/image/riff" + +import ( + "errors" + "io" + "io/ioutil" + "math" +) + +var ( + errMissingPaddingByte = errors.New("riff: missing padding byte") + errMissingRIFFChunkHeader = errors.New("riff: missing RIFF chunk header") + errListSubchunkTooLong = errors.New("riff: list subchunk too long") + errShortChunkData = errors.New("riff: short chunk data") + errShortChunkHeader = errors.New("riff: short chunk header") + errStaleReader = errors.New("riff: stale reader") +) + +// u32 decodes the first four bytes of b as a little-endian integer. +func u32(b []byte) uint32 { + return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 +} + +const chunkHeaderSize = 8 + +// FourCC is a four character code. +type FourCC [4]byte + +// LIST is the "LIST" FourCC. +var LIST = FourCC{'L', 'I', 'S', 'T'} + +// NewReader returns the RIFF stream's form type, such as "AVI " or "WAVE", and +// its chunks as a *Reader. +func NewReader(r io.Reader) (formType FourCC, data *Reader, err error) { + var buf [chunkHeaderSize]byte + if _, err := io.ReadFull(r, buf[:]); err != nil { + if err == io.EOF || err == io.ErrUnexpectedEOF { + err = errMissingRIFFChunkHeader + } + return FourCC{}, nil, err + } + if buf[0] != 'R' || buf[1] != 'I' || buf[2] != 'F' || buf[3] != 'F' { + return FourCC{}, nil, errMissingRIFFChunkHeader + } + return NewListReader(u32(buf[4:]), r) +} + +// NewListReader returns a LIST chunk's list type, such as "movi" or "wavl", +// and its chunks as a *Reader. +func NewListReader(chunkLen uint32, chunkData io.Reader) (listType FourCC, data *Reader, err error) { + if chunkLen < 4 { + return FourCC{}, nil, errShortChunkData + } + z := &Reader{r: chunkData} + if _, err := io.ReadFull(chunkData, z.buf[:4]); err != nil { + if err == io.EOF || err == io.ErrUnexpectedEOF { + err = errShortChunkData + } + return FourCC{}, nil, err + } + z.totalLen = chunkLen - 4 + return FourCC{z.buf[0], z.buf[1], z.buf[2], z.buf[3]}, z, nil +} + +// Reader reads chunks from an underlying io.Reader. +type Reader struct { + r io.Reader + err error + + totalLen uint32 + chunkLen uint32 + + chunkReader *chunkReader + buf [chunkHeaderSize]byte + padded bool +} + +// Next returns the next chunk's ID, length and data. It returns io.EOF if there +// are no more chunks. The io.Reader returned becomes stale after the next Next +// call, and should no longer be used. +// +// It is valid to call Next even if all of the previous chunk's data has not +// been read. +func (z *Reader) Next() (chunkID FourCC, chunkLen uint32, chunkData io.Reader, err error) { + if z.err != nil { + return FourCC{}, 0, nil, z.err + } + + // Drain the rest of the previous chunk. + if z.chunkLen != 0 { + want := z.chunkLen + var got int64 + got, z.err = io.Copy(ioutil.Discard, z.chunkReader) + if z.err == nil && uint32(got) != want { + z.err = errShortChunkData + } + if z.err != nil { + return FourCC{}, 0, nil, z.err + } + } + z.chunkReader = nil + if z.padded { + if z.totalLen == 0 { + z.err = errListSubchunkTooLong + return FourCC{}, 0, nil, z.err + } + z.totalLen-- + _, z.err = io.ReadFull(z.r, z.buf[:1]) + if z.err != nil { + if z.err == io.EOF { + z.err = errMissingPaddingByte + } + return FourCC{}, 0, nil, z.err + } + } + + // We are done if we have no more data. + if z.totalLen == 0 { + z.err = io.EOF + return FourCC{}, 0, nil, z.err + } + + // Read the next chunk header. + if z.totalLen < chunkHeaderSize { + z.err = errShortChunkHeader + return FourCC{}, 0, nil, z.err + } + z.totalLen -= chunkHeaderSize + if _, z.err = io.ReadFull(z.r, z.buf[:chunkHeaderSize]); z.err != nil { + if z.err == io.EOF || z.err == io.ErrUnexpectedEOF { + z.err = errShortChunkHeader + } + return FourCC{}, 0, nil, z.err + } + chunkID = FourCC{z.buf[0], z.buf[1], z.buf[2], z.buf[3]} + z.chunkLen = u32(z.buf[4:]) + if z.chunkLen > z.totalLen { + z.err = errListSubchunkTooLong + return FourCC{}, 0, nil, z.err + } + z.padded = z.chunkLen&1 == 1 + z.chunkReader = &chunkReader{z} + return chunkID, z.chunkLen, z.chunkReader, nil +} + +type chunkReader struct { + z *Reader +} + +func (c *chunkReader) Read(p []byte) (int, error) { + if c != c.z.chunkReader { + return 0, errStaleReader + } + z := c.z + if z.err != nil { + if z.err == io.EOF { + return 0, errStaleReader + } + return 0, z.err + } + + n := int(z.chunkLen) + if n == 0 { + return 0, io.EOF + } + if n < 0 { + // Converting uint32 to int overflowed. + n = math.MaxInt32 + } + if n > len(p) { + n = len(p) + } + n, err := z.r.Read(p[:n]) + z.totalLen -= uint32(n) + z.chunkLen -= uint32(n) + if err != io.EOF { + z.err = err + } + return n, err +} diff --git a/vendor/golang.org/x/image/tiff/buffer.go b/vendor/golang.org/x/image/tiff/buffer.go new file mode 100644 index 000000000..d1801be48 --- /dev/null +++ b/vendor/golang.org/x/image/tiff/buffer.go @@ -0,0 +1,69 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tiff + +import "io" + +// buffer buffers an io.Reader to satisfy io.ReaderAt. +type buffer struct { + r io.Reader + buf []byte +} + +// fill reads data from b.r until the buffer contains at least end bytes. +func (b *buffer) fill(end int) error { + m := len(b.buf) + if end > m { + if end > cap(b.buf) { + newcap := 1024 + for newcap < end { + newcap *= 2 + } + newbuf := make([]byte, end, newcap) + copy(newbuf, b.buf) + b.buf = newbuf + } else { + b.buf = b.buf[:end] + } + if n, err := io.ReadFull(b.r, b.buf[m:end]); err != nil { + end = m + n + b.buf = b.buf[:end] + return err + } + } + return nil +} + +func (b *buffer) ReadAt(p []byte, off int64) (int, error) { + o := int(off) + end := o + len(p) + if int64(end) != off+int64(len(p)) { + return 0, io.ErrUnexpectedEOF + } + + err := b.fill(end) + return copy(p, b.buf[o:end]), err +} + +// Slice returns a slice of the underlying buffer. The slice contains +// n bytes starting at offset off. +func (b *buffer) Slice(off, n int) ([]byte, error) { + end := off + n + if err := b.fill(end); err != nil { + return nil, err + } + return b.buf[off:end], nil +} + +// newReaderAt converts an io.Reader into an io.ReaderAt. +func newReaderAt(r io.Reader) io.ReaderAt { + if ra, ok := r.(io.ReaderAt); ok { + return ra + } + return &buffer{ + r: r, + buf: make([]byte, 0, 1024), + } +} diff --git a/vendor/golang.org/x/image/tiff/compress.go b/vendor/golang.org/x/image/tiff/compress.go new file mode 100644 index 000000000..3f176f00a --- /dev/null +++ b/vendor/golang.org/x/image/tiff/compress.go @@ -0,0 +1,58 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tiff + +import ( + "bufio" + "io" +) + +type byteReader interface { + io.Reader + io.ByteReader +} + +// unpackBits decodes the PackBits-compressed data in src and returns the +// uncompressed data. +// +// The PackBits compression format is described in section 9 (p. 42) +// of the TIFF spec. +func unpackBits(r io.Reader) ([]byte, error) { + buf := make([]byte, 128) + dst := make([]byte, 0, 1024) + br, ok := r.(byteReader) + if !ok { + br = bufio.NewReader(r) + } + + for { + b, err := br.ReadByte() + if err != nil { + if err == io.EOF { + return dst, nil + } + return nil, err + } + code := int(int8(b)) + switch { + case code >= 0: + n, err := io.ReadFull(br, buf[:code+1]) + if err != nil { + return nil, err + } + dst = append(dst, buf[:n]...) + case code == -128: + // No-op. + default: + if b, err = br.ReadByte(); err != nil { + return nil, err + } + for j := 0; j < 1-code; j++ { + buf[j] = b + } + dst = append(dst, buf[:1-code]...) + } + } +} diff --git a/vendor/golang.org/x/image/tiff/consts.go b/vendor/golang.org/x/image/tiff/consts.go new file mode 100644 index 000000000..3e5f7f14d --- /dev/null +++ b/vendor/golang.org/x/image/tiff/consts.go @@ -0,0 +1,149 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tiff + +// A tiff image file contains one or more images. The metadata +// of each image is contained in an Image File Directory (IFD), +// which contains entries of 12 bytes each and is described +// on page 14-16 of the specification. An IFD entry consists of +// +// - a tag, which describes the signification of the entry, +// - the data type and length of the entry, +// - the data itself or a pointer to it if it is more than 4 bytes. +// +// The presence of a length means that each IFD is effectively an array. + +const ( + leHeader = "II\x2A\x00" // Header for little-endian files. + beHeader = "MM\x00\x2A" // Header for big-endian files. + + ifdLen = 12 // Length of an IFD entry in bytes. +) + +// Data types (p. 14-16 of the spec). +const ( + dtByte = 1 + dtASCII = 2 + dtShort = 3 + dtLong = 4 + dtRational = 5 +) + +// The length of one instance of each data type in bytes. +var lengths = [...]uint32{0, 1, 1, 2, 4, 8} + +// Tags (see p. 28-41 of the spec). +const ( + tImageWidth = 256 + tImageLength = 257 + tBitsPerSample = 258 + tCompression = 259 + tPhotometricInterpretation = 262 + + tFillOrder = 266 + + tStripOffsets = 273 + tSamplesPerPixel = 277 + tRowsPerStrip = 278 + tStripByteCounts = 279 + + tT4Options = 292 // CCITT Group 3 options, a set of 32 flag bits. + tT6Options = 293 // CCITT Group 4 options, a set of 32 flag bits. + + tTileWidth = 322 + tTileLength = 323 + tTileOffsets = 324 + tTileByteCounts = 325 + + tXResolution = 282 + tYResolution = 283 + tResolutionUnit = 296 + + tPredictor = 317 + tColorMap = 320 + tExtraSamples = 338 + tSampleFormat = 339 +) + +// Compression types (defined in various places in the spec and supplements). +const ( + cNone = 1 + cCCITT = 2 + cG3 = 3 // Group 3 Fax. + cG4 = 4 // Group 4 Fax. + cLZW = 5 + cJPEGOld = 6 // Superseded by cJPEG. + cJPEG = 7 + cDeflate = 8 // zlib compression. + cPackBits = 32773 + cDeflateOld = 32946 // Superseded by cDeflate. +) + +// Photometric interpretation values (see p. 37 of the spec). +const ( + pWhiteIsZero = 0 + pBlackIsZero = 1 + pRGB = 2 + pPaletted = 3 + pTransMask = 4 // transparency mask + pCMYK = 5 + pYCbCr = 6 + pCIELab = 8 +) + +// Values for the tPredictor tag (page 64-65 of the spec). +const ( + prNone = 1 + prHorizontal = 2 +) + +// Values for the tResolutionUnit tag (page 18). +const ( + resNone = 1 + resPerInch = 2 // Dots per inch. + resPerCM = 3 // Dots per centimeter. +) + +// imageMode represents the mode of the image. +type imageMode int + +const ( + mBilevel imageMode = iota + mPaletted + mGray + mGrayInvert + mRGB + mRGBA + mNRGBA + mCMYK +) + +// CompressionType describes the type of compression used in Options. +type CompressionType int + +// Constants for supported compression types. +const ( + Uncompressed CompressionType = iota + Deflate + LZW + CCITTGroup3 + CCITTGroup4 +) + +// specValue returns the compression type constant from the TIFF spec that +// is equivalent to c. +func (c CompressionType) specValue() uint32 { + switch c { + case LZW: + return cLZW + case Deflate: + return cDeflate + case CCITTGroup3: + return cG3 + case CCITTGroup4: + return cG4 + } + return cNone +} diff --git a/vendor/golang.org/x/image/tiff/fuzz.go b/vendor/golang.org/x/image/tiff/fuzz.go new file mode 100644 index 000000000..ec52c7882 --- /dev/null +++ b/vendor/golang.org/x/image/tiff/fuzz.go @@ -0,0 +1,29 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build gofuzz + +package tiff + +import "bytes" + +func Fuzz(data []byte) int { + cfg, err := DecodeConfig(bytes.NewReader(data)) + if err != nil { + return 0 + } + if cfg.Width*cfg.Height > 1e6 { + return 0 + } + img, err := Decode(bytes.NewReader(data)) + if err != nil { + return 0 + } + var w bytes.Buffer + err = Encode(&w, img, nil) + if err != nil { + panic(err) + } + return 1 +} diff --git a/vendor/golang.org/x/image/tiff/lzw/reader.go b/vendor/golang.org/x/image/tiff/lzw/reader.go new file mode 100644 index 000000000..78204ba92 --- /dev/null +++ b/vendor/golang.org/x/image/tiff/lzw/reader.go @@ -0,0 +1,272 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package lzw implements the Lempel-Ziv-Welch compressed data format, +// described in T. A. Welch, ``A Technique for High-Performance Data +// Compression'', Computer, 17(6) (June 1984), pp 8-19. +// +// In particular, it implements LZW as used by the TIFF file format, including +// an "off by one" algorithmic difference when compared to standard LZW. +package lzw // import "golang.org/x/image/tiff/lzw" + +/* +This file was branched from src/pkg/compress/lzw/reader.go in the +standard library. Differences from the original are marked with "NOTE". + +The tif_lzw.c file in the libtiff C library has this comment: + +---- +The 5.0 spec describes a different algorithm than Aldus +implements. Specifically, Aldus does code length transitions +one code earlier than should be done (for real LZW). +Earlier versions of this library implemented the correct +LZW algorithm, but emitted codes in a bit order opposite +to the TIFF spec. Thus, to maintain compatibility w/ Aldus +we interpret MSB-LSB ordered codes to be images written w/ +old versions of this library, but otherwise adhere to the +Aldus "off by one" algorithm. +---- + +The Go code doesn't read (invalid) TIFF files written by old versions of +libtiff, but the LZW algorithm in this package still differs from the one in +Go's standard package library to accomodate this "off by one" in valid TIFFs. +*/ + +import ( + "bufio" + "errors" + "fmt" + "io" +) + +// Order specifies the bit ordering in an LZW data stream. +type Order int + +const ( + // LSB means Least Significant Bits first, as used in the GIF file format. + LSB Order = iota + // MSB means Most Significant Bits first, as used in the TIFF and PDF + // file formats. + MSB +) + +const ( + maxWidth = 12 + decoderInvalidCode = 0xffff + flushBuffer = 1 << maxWidth +) + +// decoder is the state from which the readXxx method converts a byte +// stream into a code stream. +type decoder struct { + r io.ByteReader + bits uint32 + nBits uint + width uint + read func(*decoder) (uint16, error) // readLSB or readMSB + litWidth int // width in bits of literal codes + err error + + // The first 1<= 1<>= d.width + d.nBits -= d.width + return code, nil +} + +// readMSB returns the next code for "Most Significant Bits first" data. +func (d *decoder) readMSB() (uint16, error) { + for d.nBits < d.width { + x, err := d.r.ReadByte() + if err != nil { + return 0, err + } + d.bits |= uint32(x) << (24 - d.nBits) + d.nBits += 8 + } + code := uint16(d.bits >> (32 - d.width)) + d.bits <<= d.width + d.nBits -= d.width + return code, nil +} + +func (d *decoder) Read(b []byte) (int, error) { + for { + if len(d.toRead) > 0 { + n := copy(b, d.toRead) + d.toRead = d.toRead[n:] + return n, nil + } + if d.err != nil { + return 0, d.err + } + d.decode() + } +} + +// decode decompresses bytes from r and leaves them in d.toRead. +// read specifies how to decode bytes into codes. +// litWidth is the width in bits of literal codes. +func (d *decoder) decode() { + // Loop over the code stream, converting codes into decompressed bytes. +loop: + for { + code, err := d.read(d) + if err != nil { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + d.err = err + break + } + switch { + case code < d.clear: + // We have a literal code. + d.output[d.o] = uint8(code) + d.o++ + if d.last != decoderInvalidCode { + // Save what the hi code expands to. + d.suffix[d.hi] = uint8(code) + d.prefix[d.hi] = d.last + } + case code == d.clear: + d.width = 1 + uint(d.litWidth) + d.hi = d.eof + d.overflow = 1 << d.width + d.last = decoderInvalidCode + continue + case code == d.eof: + d.err = io.EOF + break loop + case code <= d.hi: + c, i := code, len(d.output)-1 + if code == d.hi && d.last != decoderInvalidCode { + // code == hi is a special case which expands to the last expansion + // followed by the head of the last expansion. To find the head, we walk + // the prefix chain until we find a literal code. + c = d.last + for c >= d.clear { + c = d.prefix[c] + } + d.output[i] = uint8(c) + i-- + c = d.last + } + // Copy the suffix chain into output and then write that to w. + for c >= d.clear { + d.output[i] = d.suffix[c] + i-- + c = d.prefix[c] + } + d.output[i] = uint8(c) + d.o += copy(d.output[d.o:], d.output[i:]) + if d.last != decoderInvalidCode { + // Save what the hi code expands to. + d.suffix[d.hi] = uint8(c) + d.prefix[d.hi] = d.last + } + default: + d.err = errors.New("lzw: invalid code") + break loop + } + d.last, d.hi = code, d.hi+1 + if d.hi+1 >= d.overflow { // NOTE: the "+1" is where TIFF's LZW differs from the standard algorithm. + if d.width == maxWidth { + d.last = decoderInvalidCode + } else { + d.width++ + d.overflow <<= 1 + } + } + if d.o >= flushBuffer { + break + } + } + // Flush pending output. + d.toRead = d.output[:d.o] + d.o = 0 +} + +var errClosed = errors.New("lzw: reader/writer is closed") + +func (d *decoder) Close() error { + d.err = errClosed // in case any Reads come along + return nil +} + +// NewReader creates a new io.ReadCloser. +// Reads from the returned io.ReadCloser read and decompress data from r. +// If r does not also implement io.ByteReader, +// the decompressor may read more data than necessary from r. +// It is the caller's responsibility to call Close on the ReadCloser when +// finished reading. +// The number of bits to use for literal codes, litWidth, must be in the +// range [2,8] and is typically 8. It must equal the litWidth +// used during compression. +func NewReader(r io.Reader, order Order, litWidth int) io.ReadCloser { + d := new(decoder) + switch order { + case LSB: + d.read = (*decoder).readLSB + case MSB: + d.read = (*decoder).readMSB + default: + d.err = errors.New("lzw: unknown order") + return d + } + if litWidth < 2 || 8 < litWidth { + d.err = fmt.Errorf("lzw: litWidth %d out of range", litWidth) + return d + } + if br, ok := r.(io.ByteReader); ok { + d.r = br + } else { + d.r = bufio.NewReader(r) + } + d.litWidth = litWidth + d.width = 1 + uint(litWidth) + d.clear = uint16(1) << uint(litWidth) + d.eof, d.hi = d.clear+1, d.clear+1 + d.overflow = uint16(1) << d.width + d.last = decoderInvalidCode + + return d +} diff --git a/vendor/golang.org/x/image/tiff/reader.go b/vendor/golang.org/x/image/tiff/reader.go new file mode 100644 index 000000000..de73f4b99 --- /dev/null +++ b/vendor/golang.org/x/image/tiff/reader.go @@ -0,0 +1,709 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package tiff implements a TIFF image decoder and encoder. +// +// The TIFF specification is at http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf +package tiff // import "golang.org/x/image/tiff" + +import ( + "compress/zlib" + "encoding/binary" + "fmt" + "image" + "image/color" + "io" + "io/ioutil" + "math" + + "golang.org/x/image/ccitt" + "golang.org/x/image/tiff/lzw" +) + +// A FormatError reports that the input is not a valid TIFF image. +type FormatError string + +func (e FormatError) Error() string { + return "tiff: invalid format: " + string(e) +} + +// An UnsupportedError reports that the input uses a valid but +// unimplemented feature. +type UnsupportedError string + +func (e UnsupportedError) Error() string { + return "tiff: unsupported feature: " + string(e) +} + +var errNoPixels = FormatError("not enough pixel data") + +type decoder struct { + r io.ReaderAt + byteOrder binary.ByteOrder + config image.Config + mode imageMode + bpp uint + features map[int][]uint + palette []color.Color + + buf []byte + off int // Current offset in buf. + v uint32 // Buffer value for reading with arbitrary bit depths. + nbits uint // Remaining number of bits in v. +} + +// firstVal returns the first uint of the features entry with the given tag, +// or 0 if the tag does not exist. +func (d *decoder) firstVal(tag int) uint { + f := d.features[tag] + if len(f) == 0 { + return 0 + } + return f[0] +} + +// ifdUint decodes the IFD entry in p, which must be of the Byte, Short +// or Long type, and returns the decoded uint values. +func (d *decoder) ifdUint(p []byte) (u []uint, err error) { + var raw []byte + if len(p) < ifdLen { + return nil, FormatError("bad IFD entry") + } + + datatype := d.byteOrder.Uint16(p[2:4]) + if dt := int(datatype); dt <= 0 || dt >= len(lengths) { + return nil, UnsupportedError("IFD entry datatype") + } + + count := d.byteOrder.Uint32(p[4:8]) + if count > math.MaxInt32/lengths[datatype] { + return nil, FormatError("IFD data too large") + } + if datalen := lengths[datatype] * count; datalen > 4 { + // The IFD contains a pointer to the real value. + raw = make([]byte, datalen) + _, err = d.r.ReadAt(raw, int64(d.byteOrder.Uint32(p[8:12]))) + } else { + raw = p[8 : 8+datalen] + } + if err != nil { + return nil, err + } + + u = make([]uint, count) + switch datatype { + case dtByte: + for i := uint32(0); i < count; i++ { + u[i] = uint(raw[i]) + } + case dtShort: + for i := uint32(0); i < count; i++ { + u[i] = uint(d.byteOrder.Uint16(raw[2*i : 2*(i+1)])) + } + case dtLong: + for i := uint32(0); i < count; i++ { + u[i] = uint(d.byteOrder.Uint32(raw[4*i : 4*(i+1)])) + } + default: + return nil, UnsupportedError("data type") + } + return u, nil +} + +// parseIFD decides whether the IFD entry in p is "interesting" and +// stows away the data in the decoder. It returns the tag number of the +// entry and an error, if any. +func (d *decoder) parseIFD(p []byte) (int, error) { + tag := d.byteOrder.Uint16(p[0:2]) + switch tag { + case tBitsPerSample, + tExtraSamples, + tPhotometricInterpretation, + tCompression, + tPredictor, + tStripOffsets, + tStripByteCounts, + tRowsPerStrip, + tTileWidth, + tTileLength, + tTileOffsets, + tTileByteCounts, + tImageLength, + tImageWidth, + tFillOrder, + tT4Options, + tT6Options: + val, err := d.ifdUint(p) + if err != nil { + return 0, err + } + d.features[int(tag)] = val + case tColorMap: + val, err := d.ifdUint(p) + if err != nil { + return 0, err + } + numcolors := len(val) / 3 + if len(val)%3 != 0 || numcolors <= 0 || numcolors > 256 { + return 0, FormatError("bad ColorMap length") + } + d.palette = make([]color.Color, numcolors) + for i := 0; i < numcolors; i++ { + d.palette[i] = color.RGBA64{ + uint16(val[i]), + uint16(val[i+numcolors]), + uint16(val[i+2*numcolors]), + 0xffff, + } + } + case tSampleFormat: + // Page 27 of the spec: If the SampleFormat is present and + // the value is not 1 [= unsigned integer data], a Baseline + // TIFF reader that cannot handle the SampleFormat value + // must terminate the import process gracefully. + val, err := d.ifdUint(p) + if err != nil { + return 0, err + } + for _, v := range val { + if v != 1 { + return 0, UnsupportedError("sample format") + } + } + } + return int(tag), nil +} + +// readBits reads n bits from the internal buffer starting at the current offset. +func (d *decoder) readBits(n uint) (v uint32, ok bool) { + for d.nbits < n { + d.v <<= 8 + if d.off >= len(d.buf) { + return 0, false + } + d.v |= uint32(d.buf[d.off]) + d.off++ + d.nbits += 8 + } + d.nbits -= n + rv := d.v >> d.nbits + d.v &^= rv << d.nbits + return rv, true +} + +// flushBits discards the unread bits in the buffer used by readBits. +// It is used at the end of a line. +func (d *decoder) flushBits() { + d.v = 0 + d.nbits = 0 +} + +// minInt returns the smaller of x or y. +func minInt(a, b int) int { + if a <= b { + return a + } + return b +} + +// decode decodes the raw data of an image. +// It reads from d.buf and writes the strip or tile into dst. +func (d *decoder) decode(dst image.Image, xmin, ymin, xmax, ymax int) error { + d.off = 0 + + // Apply horizontal predictor if necessary. + // In this case, p contains the color difference to the preceding pixel. + // See page 64-65 of the spec. + if d.firstVal(tPredictor) == prHorizontal { + switch d.bpp { + case 16: + var off int + n := 2 * len(d.features[tBitsPerSample]) // bytes per sample times samples per pixel + for y := ymin; y < ymax; y++ { + off += n + for x := 0; x < (xmax-xmin-1)*n; x += 2 { + if off+2 > len(d.buf) { + return errNoPixels + } + v0 := d.byteOrder.Uint16(d.buf[off-n : off-n+2]) + v1 := d.byteOrder.Uint16(d.buf[off : off+2]) + d.byteOrder.PutUint16(d.buf[off:off+2], v1+v0) + off += 2 + } + } + case 8: + var off int + n := 1 * len(d.features[tBitsPerSample]) // bytes per sample times samples per pixel + for y := ymin; y < ymax; y++ { + off += n + for x := 0; x < (xmax-xmin-1)*n; x++ { + if off >= len(d.buf) { + return errNoPixels + } + d.buf[off] += d.buf[off-n] + off++ + } + } + case 1: + return UnsupportedError("horizontal predictor with 1 BitsPerSample") + } + } + + rMaxX := minInt(xmax, dst.Bounds().Max.X) + rMaxY := minInt(ymax, dst.Bounds().Max.Y) + switch d.mode { + case mGray, mGrayInvert: + if d.bpp == 16 { + img := dst.(*image.Gray16) + for y := ymin; y < rMaxY; y++ { + for x := xmin; x < rMaxX; x++ { + if d.off+2 > len(d.buf) { + return errNoPixels + } + v := d.byteOrder.Uint16(d.buf[d.off : d.off+2]) + d.off += 2 + if d.mode == mGrayInvert { + v = 0xffff - v + } + img.SetGray16(x, y, color.Gray16{v}) + } + if rMaxX == img.Bounds().Max.X { + d.off += 2 * (xmax - img.Bounds().Max.X) + } + } + } else { + img := dst.(*image.Gray) + max := uint32((1 << d.bpp) - 1) + for y := ymin; y < rMaxY; y++ { + for x := xmin; x < rMaxX; x++ { + v, ok := d.readBits(d.bpp) + if !ok { + return errNoPixels + } + v = v * 0xff / max + if d.mode == mGrayInvert { + v = 0xff - v + } + img.SetGray(x, y, color.Gray{uint8(v)}) + } + d.flushBits() + } + } + case mPaletted: + img := dst.(*image.Paletted) + for y := ymin; y < rMaxY; y++ { + for x := xmin; x < rMaxX; x++ { + v, ok := d.readBits(d.bpp) + if !ok { + return errNoPixels + } + img.SetColorIndex(x, y, uint8(v)) + } + d.flushBits() + } + case mRGB: + if d.bpp == 16 { + img := dst.(*image.RGBA64) + for y := ymin; y < rMaxY; y++ { + for x := xmin; x < rMaxX; x++ { + if d.off+6 > len(d.buf) { + return errNoPixels + } + r := d.byteOrder.Uint16(d.buf[d.off+0 : d.off+2]) + g := d.byteOrder.Uint16(d.buf[d.off+2 : d.off+4]) + b := d.byteOrder.Uint16(d.buf[d.off+4 : d.off+6]) + d.off += 6 + img.SetRGBA64(x, y, color.RGBA64{r, g, b, 0xffff}) + } + } + } else { + img := dst.(*image.RGBA) + for y := ymin; y < rMaxY; y++ { + min := img.PixOffset(xmin, y) + max := img.PixOffset(rMaxX, y) + off := (y - ymin) * (xmax - xmin) * 3 + for i := min; i < max; i += 4 { + if off+3 > len(d.buf) { + return errNoPixels + } + img.Pix[i+0] = d.buf[off+0] + img.Pix[i+1] = d.buf[off+1] + img.Pix[i+2] = d.buf[off+2] + img.Pix[i+3] = 0xff + off += 3 + } + } + } + case mNRGBA: + if d.bpp == 16 { + img := dst.(*image.NRGBA64) + for y := ymin; y < rMaxY; y++ { + for x := xmin; x < rMaxX; x++ { + if d.off+8 > len(d.buf) { + return errNoPixels + } + r := d.byteOrder.Uint16(d.buf[d.off+0 : d.off+2]) + g := d.byteOrder.Uint16(d.buf[d.off+2 : d.off+4]) + b := d.byteOrder.Uint16(d.buf[d.off+4 : d.off+6]) + a := d.byteOrder.Uint16(d.buf[d.off+6 : d.off+8]) + d.off += 8 + img.SetNRGBA64(x, y, color.NRGBA64{r, g, b, a}) + } + } + } else { + img := dst.(*image.NRGBA) + for y := ymin; y < rMaxY; y++ { + min := img.PixOffset(xmin, y) + max := img.PixOffset(rMaxX, y) + i0, i1 := (y-ymin)*(xmax-xmin)*4, (y-ymin+1)*(xmax-xmin)*4 + if i1 > len(d.buf) { + return errNoPixels + } + copy(img.Pix[min:max], d.buf[i0:i1]) + } + } + case mRGBA: + if d.bpp == 16 { + img := dst.(*image.RGBA64) + for y := ymin; y < rMaxY; y++ { + for x := xmin; x < rMaxX; x++ { + if d.off+8 > len(d.buf) { + return errNoPixels + } + r := d.byteOrder.Uint16(d.buf[d.off+0 : d.off+2]) + g := d.byteOrder.Uint16(d.buf[d.off+2 : d.off+4]) + b := d.byteOrder.Uint16(d.buf[d.off+4 : d.off+6]) + a := d.byteOrder.Uint16(d.buf[d.off+6 : d.off+8]) + d.off += 8 + img.SetRGBA64(x, y, color.RGBA64{r, g, b, a}) + } + } + } else { + img := dst.(*image.RGBA) + for y := ymin; y < rMaxY; y++ { + min := img.PixOffset(xmin, y) + max := img.PixOffset(rMaxX, y) + i0, i1 := (y-ymin)*(xmax-xmin)*4, (y-ymin+1)*(xmax-xmin)*4 + if i1 > len(d.buf) { + return errNoPixels + } + copy(img.Pix[min:max], d.buf[i0:i1]) + } + } + } + + return nil +} + +func newDecoder(r io.Reader) (*decoder, error) { + d := &decoder{ + r: newReaderAt(r), + features: make(map[int][]uint), + } + + p := make([]byte, 8) + if _, err := d.r.ReadAt(p, 0); err != nil { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + return nil, err + } + switch string(p[0:4]) { + case leHeader: + d.byteOrder = binary.LittleEndian + case beHeader: + d.byteOrder = binary.BigEndian + default: + return nil, FormatError("malformed header") + } + + ifdOffset := int64(d.byteOrder.Uint32(p[4:8])) + + // The first two bytes contain the number of entries (12 bytes each). + if _, err := d.r.ReadAt(p[0:2], ifdOffset); err != nil { + return nil, err + } + numItems := int(d.byteOrder.Uint16(p[0:2])) + + // All IFD entries are read in one chunk. + p = make([]byte, ifdLen*numItems) + if _, err := d.r.ReadAt(p, ifdOffset+2); err != nil { + return nil, err + } + + prevTag := -1 + for i := 0; i < len(p); i += ifdLen { + tag, err := d.parseIFD(p[i : i+ifdLen]) + if err != nil { + return nil, err + } + if tag <= prevTag { + return nil, FormatError("tags are not sorted in ascending order") + } + prevTag = tag + } + + d.config.Width = int(d.firstVal(tImageWidth)) + d.config.Height = int(d.firstVal(tImageLength)) + + if _, ok := d.features[tBitsPerSample]; !ok { + // Default is 1 per specification. + d.features[tBitsPerSample] = []uint{1} + } + d.bpp = d.firstVal(tBitsPerSample) + switch d.bpp { + case 0: + return nil, FormatError("BitsPerSample must not be 0") + case 1, 8, 16: + // Nothing to do, these are accepted by this implementation. + default: + return nil, UnsupportedError(fmt.Sprintf("BitsPerSample of %v", d.bpp)) + } + + // Determine the image mode. + switch d.firstVal(tPhotometricInterpretation) { + case pRGB: + if d.bpp == 16 { + for _, b := range d.features[tBitsPerSample] { + if b != 16 { + return nil, FormatError("wrong number of samples for 16bit RGB") + } + } + } else { + for _, b := range d.features[tBitsPerSample] { + if b != 8 { + return nil, FormatError("wrong number of samples for 8bit RGB") + } + } + } + // RGB images normally have 3 samples per pixel. + // If there are more, ExtraSamples (p. 31-32 of the spec) + // gives their meaning (usually an alpha channel). + // + // This implementation does not support extra samples + // of an unspecified type. + switch len(d.features[tBitsPerSample]) { + case 3: + d.mode = mRGB + if d.bpp == 16 { + d.config.ColorModel = color.RGBA64Model + } else { + d.config.ColorModel = color.RGBAModel + } + case 4: + switch d.firstVal(tExtraSamples) { + case 1: + d.mode = mRGBA + if d.bpp == 16 { + d.config.ColorModel = color.RGBA64Model + } else { + d.config.ColorModel = color.RGBAModel + } + case 2: + d.mode = mNRGBA + if d.bpp == 16 { + d.config.ColorModel = color.NRGBA64Model + } else { + d.config.ColorModel = color.NRGBAModel + } + default: + return nil, FormatError("wrong number of samples for RGB") + } + default: + return nil, FormatError("wrong number of samples for RGB") + } + case pPaletted: + d.mode = mPaletted + d.config.ColorModel = color.Palette(d.palette) + case pWhiteIsZero: + d.mode = mGrayInvert + if d.bpp == 16 { + d.config.ColorModel = color.Gray16Model + } else { + d.config.ColorModel = color.GrayModel + } + case pBlackIsZero: + d.mode = mGray + if d.bpp == 16 { + d.config.ColorModel = color.Gray16Model + } else { + d.config.ColorModel = color.GrayModel + } + default: + return nil, UnsupportedError("color model") + } + + return d, nil +} + +// DecodeConfig returns the color model and dimensions of a TIFF image without +// decoding the entire image. +func DecodeConfig(r io.Reader) (image.Config, error) { + d, err := newDecoder(r) + if err != nil { + return image.Config{}, err + } + return d.config, nil +} + +func ccittFillOrder(tiffFillOrder uint) ccitt.Order { + if tiffFillOrder == 2 { + return ccitt.LSB + } + return ccitt.MSB +} + +// Decode reads a TIFF image from r and returns it as an image.Image. +// The type of Image returned depends on the contents of the TIFF. +func Decode(r io.Reader) (img image.Image, err error) { + d, err := newDecoder(r) + if err != nil { + return + } + + blockPadding := false + blockWidth := d.config.Width + blockHeight := d.config.Height + blocksAcross := 1 + blocksDown := 1 + + if d.config.Width == 0 { + blocksAcross = 0 + } + if d.config.Height == 0 { + blocksDown = 0 + } + + var blockOffsets, blockCounts []uint + + if int(d.firstVal(tTileWidth)) != 0 { + blockPadding = true + + blockWidth = int(d.firstVal(tTileWidth)) + blockHeight = int(d.firstVal(tTileLength)) + + if blockWidth != 0 { + blocksAcross = (d.config.Width + blockWidth - 1) / blockWidth + } + if blockHeight != 0 { + blocksDown = (d.config.Height + blockHeight - 1) / blockHeight + } + + blockCounts = d.features[tTileByteCounts] + blockOffsets = d.features[tTileOffsets] + + } else { + if int(d.firstVal(tRowsPerStrip)) != 0 { + blockHeight = int(d.firstVal(tRowsPerStrip)) + } + + if blockHeight != 0 { + blocksDown = (d.config.Height + blockHeight - 1) / blockHeight + } + + blockOffsets = d.features[tStripOffsets] + blockCounts = d.features[tStripByteCounts] + } + + // Check if we have the right number of strips/tiles, offsets and counts. + if n := blocksAcross * blocksDown; len(blockOffsets) < n || len(blockCounts) < n { + return nil, FormatError("inconsistent header") + } + + imgRect := image.Rect(0, 0, d.config.Width, d.config.Height) + switch d.mode { + case mGray, mGrayInvert: + if d.bpp == 16 { + img = image.NewGray16(imgRect) + } else { + img = image.NewGray(imgRect) + } + case mPaletted: + img = image.NewPaletted(imgRect, d.palette) + case mNRGBA: + if d.bpp == 16 { + img = image.NewNRGBA64(imgRect) + } else { + img = image.NewNRGBA(imgRect) + } + case mRGB, mRGBA: + if d.bpp == 16 { + img = image.NewRGBA64(imgRect) + } else { + img = image.NewRGBA(imgRect) + } + } + + for i := 0; i < blocksAcross; i++ { + blkW := blockWidth + if !blockPadding && i == blocksAcross-1 && d.config.Width%blockWidth != 0 { + blkW = d.config.Width % blockWidth + } + for j := 0; j < blocksDown; j++ { + blkH := blockHeight + if !blockPadding && j == blocksDown-1 && d.config.Height%blockHeight != 0 { + blkH = d.config.Height % blockHeight + } + offset := int64(blockOffsets[j*blocksAcross+i]) + n := int64(blockCounts[j*blocksAcross+i]) + switch d.firstVal(tCompression) { + + // According to the spec, Compression does not have a default value, + // but some tools interpret a missing Compression value as none so we do + // the same. + case cNone, 0: + if b, ok := d.r.(*buffer); ok { + d.buf, err = b.Slice(int(offset), int(n)) + } else { + d.buf = make([]byte, n) + _, err = d.r.ReadAt(d.buf, offset) + } + case cG3: + inv := d.firstVal(tPhotometricInterpretation) == pWhiteIsZero + order := ccittFillOrder(d.firstVal(tFillOrder)) + r := ccitt.NewReader(io.NewSectionReader(d.r, offset, n), order, ccitt.Group3, blkW, blkH, &ccitt.Options{Invert: inv, Align: false}) + d.buf, err = ioutil.ReadAll(r) + case cG4: + inv := d.firstVal(tPhotometricInterpretation) == pWhiteIsZero + order := ccittFillOrder(d.firstVal(tFillOrder)) + r := ccitt.NewReader(io.NewSectionReader(d.r, offset, n), order, ccitt.Group4, blkW, blkH, &ccitt.Options{Invert: inv, Align: false}) + d.buf, err = ioutil.ReadAll(r) + case cLZW: + r := lzw.NewReader(io.NewSectionReader(d.r, offset, n), lzw.MSB, 8) + d.buf, err = ioutil.ReadAll(r) + r.Close() + case cDeflate, cDeflateOld: + var r io.ReadCloser + r, err = zlib.NewReader(io.NewSectionReader(d.r, offset, n)) + if err != nil { + return nil, err + } + d.buf, err = ioutil.ReadAll(r) + r.Close() + case cPackBits: + d.buf, err = unpackBits(io.NewSectionReader(d.r, offset, n)) + default: + err = UnsupportedError(fmt.Sprintf("compression value %d", d.firstVal(tCompression))) + } + if err != nil { + return nil, err + } + + xmin := i * blockWidth + ymin := j * blockHeight + xmax := xmin + blkW + ymax := ymin + blkH + err = d.decode(img, xmin, ymin, xmax, ymax) + if err != nil { + return nil, err + } + } + } + return +} + +func init() { + image.RegisterFormat("tiff", leHeader, Decode, DecodeConfig) + image.RegisterFormat("tiff", beHeader, Decode, DecodeConfig) +} diff --git a/vendor/golang.org/x/image/tiff/writer.go b/vendor/golang.org/x/image/tiff/writer.go new file mode 100644 index 000000000..c8a01cea7 --- /dev/null +++ b/vendor/golang.org/x/image/tiff/writer.go @@ -0,0 +1,438 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tiff + +import ( + "bytes" + "compress/zlib" + "encoding/binary" + "image" + "io" + "sort" +) + +// The TIFF format allows to choose the order of the different elements freely. +// The basic structure of a TIFF file written by this package is: +// +// 1. Header (8 bytes). +// 2. Image data. +// 3. Image File Directory (IFD). +// 4. "Pointer area" for larger entries in the IFD. + +// We only write little-endian TIFF files. +var enc = binary.LittleEndian + +// An ifdEntry is a single entry in an Image File Directory. +// A value of type dtRational is composed of two 32-bit values, +// thus data contains two uints (numerator and denominator) for a single number. +type ifdEntry struct { + tag int + datatype int + data []uint32 +} + +func (e ifdEntry) putData(p []byte) { + for _, d := range e.data { + switch e.datatype { + case dtByte, dtASCII: + p[0] = byte(d) + p = p[1:] + case dtShort: + enc.PutUint16(p, uint16(d)) + p = p[2:] + case dtLong, dtRational: + enc.PutUint32(p, uint32(d)) + p = p[4:] + } + } +} + +type byTag []ifdEntry + +func (d byTag) Len() int { return len(d) } +func (d byTag) Less(i, j int) bool { return d[i].tag < d[j].tag } +func (d byTag) Swap(i, j int) { d[i], d[j] = d[j], d[i] } + +func encodeGray(w io.Writer, pix []uint8, dx, dy, stride int, predictor bool) error { + if !predictor { + return writePix(w, pix, dy, dx, stride) + } + buf := make([]byte, dx) + for y := 0; y < dy; y++ { + min := y*stride + 0 + max := y*stride + dx + off := 0 + var v0 uint8 + for i := min; i < max; i++ { + v1 := pix[i] + buf[off] = v1 - v0 + v0 = v1 + off++ + } + if _, err := w.Write(buf); err != nil { + return err + } + } + return nil +} + +func encodeGray16(w io.Writer, pix []uint8, dx, dy, stride int, predictor bool) error { + buf := make([]byte, dx*2) + for y := 0; y < dy; y++ { + min := y*stride + 0 + max := y*stride + dx*2 + off := 0 + var v0 uint16 + for i := min; i < max; i += 2 { + // An image.Gray16's Pix is in big-endian order. + v1 := uint16(pix[i])<<8 | uint16(pix[i+1]) + if predictor { + v0, v1 = v1, v1-v0 + } + // We only write little-endian TIFF files. + buf[off+0] = byte(v1) + buf[off+1] = byte(v1 >> 8) + off += 2 + } + if _, err := w.Write(buf); err != nil { + return err + } + } + return nil +} + +func encodeRGBA(w io.Writer, pix []uint8, dx, dy, stride int, predictor bool) error { + if !predictor { + return writePix(w, pix, dy, dx*4, stride) + } + buf := make([]byte, dx*4) + for y := 0; y < dy; y++ { + min := y*stride + 0 + max := y*stride + dx*4 + off := 0 + var r0, g0, b0, a0 uint8 + for i := min; i < max; i += 4 { + r1, g1, b1, a1 := pix[i+0], pix[i+1], pix[i+2], pix[i+3] + buf[off+0] = r1 - r0 + buf[off+1] = g1 - g0 + buf[off+2] = b1 - b0 + buf[off+3] = a1 - a0 + off += 4 + r0, g0, b0, a0 = r1, g1, b1, a1 + } + if _, err := w.Write(buf); err != nil { + return err + } + } + return nil +} + +func encodeRGBA64(w io.Writer, pix []uint8, dx, dy, stride int, predictor bool) error { + buf := make([]byte, dx*8) + for y := 0; y < dy; y++ { + min := y*stride + 0 + max := y*stride + dx*8 + off := 0 + var r0, g0, b0, a0 uint16 + for i := min; i < max; i += 8 { + // An image.RGBA64's Pix is in big-endian order. + r1 := uint16(pix[i+0])<<8 | uint16(pix[i+1]) + g1 := uint16(pix[i+2])<<8 | uint16(pix[i+3]) + b1 := uint16(pix[i+4])<<8 | uint16(pix[i+5]) + a1 := uint16(pix[i+6])<<8 | uint16(pix[i+7]) + if predictor { + r0, r1 = r1, r1-r0 + g0, g1 = g1, g1-g0 + b0, b1 = b1, b1-b0 + a0, a1 = a1, a1-a0 + } + // We only write little-endian TIFF files. + buf[off+0] = byte(r1) + buf[off+1] = byte(r1 >> 8) + buf[off+2] = byte(g1) + buf[off+3] = byte(g1 >> 8) + buf[off+4] = byte(b1) + buf[off+5] = byte(b1 >> 8) + buf[off+6] = byte(a1) + buf[off+7] = byte(a1 >> 8) + off += 8 + } + if _, err := w.Write(buf); err != nil { + return err + } + } + return nil +} + +func encode(w io.Writer, m image.Image, predictor bool) error { + bounds := m.Bounds() + buf := make([]byte, 4*bounds.Dx()) + for y := bounds.Min.Y; y < bounds.Max.Y; y++ { + off := 0 + if predictor { + var r0, g0, b0, a0 uint8 + for x := bounds.Min.X; x < bounds.Max.X; x++ { + r, g, b, a := m.At(x, y).RGBA() + r1 := uint8(r >> 8) + g1 := uint8(g >> 8) + b1 := uint8(b >> 8) + a1 := uint8(a >> 8) + buf[off+0] = r1 - r0 + buf[off+1] = g1 - g0 + buf[off+2] = b1 - b0 + buf[off+3] = a1 - a0 + off += 4 + r0, g0, b0, a0 = r1, g1, b1, a1 + } + } else { + for x := bounds.Min.X; x < bounds.Max.X; x++ { + r, g, b, a := m.At(x, y).RGBA() + buf[off+0] = uint8(r >> 8) + buf[off+1] = uint8(g >> 8) + buf[off+2] = uint8(b >> 8) + buf[off+3] = uint8(a >> 8) + off += 4 + } + } + if _, err := w.Write(buf); err != nil { + return err + } + } + return nil +} + +// writePix writes the internal byte array of an image to w. It is less general +// but much faster then encode. writePix is used when pix directly +// corresponds to one of the TIFF image types. +func writePix(w io.Writer, pix []byte, nrows, length, stride int) error { + if length == stride { + _, err := w.Write(pix[:nrows*length]) + return err + } + for ; nrows > 0; nrows-- { + if _, err := w.Write(pix[:length]); err != nil { + return err + } + pix = pix[stride:] + } + return nil +} + +func writeIFD(w io.Writer, ifdOffset int, d []ifdEntry) error { + var buf [ifdLen]byte + // Make space for "pointer area" containing IFD entry data + // longer than 4 bytes. + parea := make([]byte, 1024) + pstart := ifdOffset + ifdLen*len(d) + 6 + var o int // Current offset in parea. + + // The IFD has to be written with the tags in ascending order. + sort.Sort(byTag(d)) + + // Write the number of entries in this IFD. + if err := binary.Write(w, enc, uint16(len(d))); err != nil { + return err + } + for _, ent := range d { + enc.PutUint16(buf[0:2], uint16(ent.tag)) + enc.PutUint16(buf[2:4], uint16(ent.datatype)) + count := uint32(len(ent.data)) + if ent.datatype == dtRational { + count /= 2 + } + enc.PutUint32(buf[4:8], count) + datalen := int(count * lengths[ent.datatype]) + if datalen <= 4 { + ent.putData(buf[8:12]) + } else { + if (o + datalen) > len(parea) { + newlen := len(parea) + 1024 + for (o + datalen) > newlen { + newlen += 1024 + } + newarea := make([]byte, newlen) + copy(newarea, parea) + parea = newarea + } + ent.putData(parea[o : o+datalen]) + enc.PutUint32(buf[8:12], uint32(pstart+o)) + o += datalen + } + if _, err := w.Write(buf[:]); err != nil { + return err + } + } + // The IFD ends with the offset of the next IFD in the file, + // or zero if it is the last one (page 14). + if err := binary.Write(w, enc, uint32(0)); err != nil { + return err + } + _, err := w.Write(parea[:o]) + return err +} + +// Options are the encoding parameters. +type Options struct { + // Compression is the type of compression used. + Compression CompressionType + // Predictor determines whether a differencing predictor is used; + // if true, instead of each pixel's color, the color difference to the + // preceding one is saved. This improves the compression for certain + // types of images and compressors. For example, it works well for + // photos with Deflate compression. + Predictor bool +} + +// Encode writes the image m to w. opt determines the options used for +// encoding, such as the compression type. If opt is nil, an uncompressed +// image is written. +func Encode(w io.Writer, m image.Image, opt *Options) error { + d := m.Bounds().Size() + + compression := uint32(cNone) + predictor := false + if opt != nil { + compression = opt.Compression.specValue() + // The predictor field is only used with LZW. See page 64 of the spec. + predictor = opt.Predictor && compression == cLZW + } + + _, err := io.WriteString(w, leHeader) + if err != nil { + return err + } + + // Compressed data is written into a buffer first, so that we + // know the compressed size. + var buf bytes.Buffer + // dst holds the destination for the pixel data of the image -- + // either w or a writer to buf. + var dst io.Writer + // imageLen is the length of the pixel data in bytes. + // The offset of the IFD is imageLen + 8 header bytes. + var imageLen int + + switch compression { + case cNone: + dst = w + // Write IFD offset before outputting pixel data. + switch m.(type) { + case *image.Paletted: + imageLen = d.X * d.Y * 1 + case *image.Gray: + imageLen = d.X * d.Y * 1 + case *image.Gray16: + imageLen = d.X * d.Y * 2 + case *image.RGBA64: + imageLen = d.X * d.Y * 8 + case *image.NRGBA64: + imageLen = d.X * d.Y * 8 + default: + imageLen = d.X * d.Y * 4 + } + err = binary.Write(w, enc, uint32(imageLen+8)) + if err != nil { + return err + } + case cDeflate: + dst = zlib.NewWriter(&buf) + } + + pr := uint32(prNone) + photometricInterpretation := uint32(pRGB) + samplesPerPixel := uint32(4) + bitsPerSample := []uint32{8, 8, 8, 8} + extraSamples := uint32(0) + colorMap := []uint32{} + + if predictor { + pr = prHorizontal + } + switch m := m.(type) { + case *image.Paletted: + photometricInterpretation = pPaletted + samplesPerPixel = 1 + bitsPerSample = []uint32{8} + colorMap = make([]uint32, 256*3) + for i := 0; i < 256 && i < len(m.Palette); i++ { + r, g, b, _ := m.Palette[i].RGBA() + colorMap[i+0*256] = uint32(r) + colorMap[i+1*256] = uint32(g) + colorMap[i+2*256] = uint32(b) + } + err = encodeGray(dst, m.Pix, d.X, d.Y, m.Stride, predictor) + case *image.Gray: + photometricInterpretation = pBlackIsZero + samplesPerPixel = 1 + bitsPerSample = []uint32{8} + err = encodeGray(dst, m.Pix, d.X, d.Y, m.Stride, predictor) + case *image.Gray16: + photometricInterpretation = pBlackIsZero + samplesPerPixel = 1 + bitsPerSample = []uint32{16} + err = encodeGray16(dst, m.Pix, d.X, d.Y, m.Stride, predictor) + case *image.NRGBA: + extraSamples = 2 // Unassociated alpha. + err = encodeRGBA(dst, m.Pix, d.X, d.Y, m.Stride, predictor) + case *image.NRGBA64: + extraSamples = 2 // Unassociated alpha. + bitsPerSample = []uint32{16, 16, 16, 16} + err = encodeRGBA64(dst, m.Pix, d.X, d.Y, m.Stride, predictor) + case *image.RGBA: + extraSamples = 1 // Associated alpha. + err = encodeRGBA(dst, m.Pix, d.X, d.Y, m.Stride, predictor) + case *image.RGBA64: + extraSamples = 1 // Associated alpha. + bitsPerSample = []uint32{16, 16, 16, 16} + err = encodeRGBA64(dst, m.Pix, d.X, d.Y, m.Stride, predictor) + default: + extraSamples = 1 // Associated alpha. + err = encode(dst, m, predictor) + } + if err != nil { + return err + } + + if compression != cNone { + if err = dst.(io.Closer).Close(); err != nil { + return err + } + imageLen = buf.Len() + if err = binary.Write(w, enc, uint32(imageLen+8)); err != nil { + return err + } + if _, err = buf.WriteTo(w); err != nil { + return err + } + } + + ifd := []ifdEntry{ + {tImageWidth, dtShort, []uint32{uint32(d.X)}}, + {tImageLength, dtShort, []uint32{uint32(d.Y)}}, + {tBitsPerSample, dtShort, bitsPerSample}, + {tCompression, dtShort, []uint32{compression}}, + {tPhotometricInterpretation, dtShort, []uint32{photometricInterpretation}}, + {tStripOffsets, dtLong, []uint32{8}}, + {tSamplesPerPixel, dtShort, []uint32{samplesPerPixel}}, + {tRowsPerStrip, dtShort, []uint32{uint32(d.Y)}}, + {tStripByteCounts, dtLong, []uint32{uint32(imageLen)}}, + // There is currently no support for storing the image + // resolution, so give a bogus value of 72x72 dpi. + {tXResolution, dtRational, []uint32{72, 1}}, + {tYResolution, dtRational, []uint32{72, 1}}, + {tResolutionUnit, dtShort, []uint32{resPerInch}}, + } + if pr != prNone { + ifd = append(ifd, ifdEntry{tPredictor, dtShort, []uint32{pr}}) + } + if len(colorMap) != 0 { + ifd = append(ifd, ifdEntry{tColorMap, dtShort, colorMap}) + } + if extraSamples > 0 { + ifd = append(ifd, ifdEntry{tExtraSamples, dtShort, []uint32{extraSamples}}) + } + + return writeIFD(w, imageLen+8, ifd) +} diff --git a/vendor/golang.org/x/image/vp8/decode.go b/vendor/golang.org/x/image/vp8/decode.go new file mode 100644 index 000000000..2aa9fee03 --- /dev/null +++ b/vendor/golang.org/x/image/vp8/decode.go @@ -0,0 +1,403 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package vp8 implements a decoder for the VP8 lossy image format. +// +// The VP8 specification is RFC 6386. +package vp8 // import "golang.org/x/image/vp8" + +// This file implements the top-level decoding algorithm. + +import ( + "errors" + "image" + "io" +) + +// limitReader wraps an io.Reader to read at most n bytes from it. +type limitReader struct { + r io.Reader + n int +} + +// ReadFull reads exactly len(p) bytes into p. +func (r *limitReader) ReadFull(p []byte) error { + if len(p) > r.n { + return io.ErrUnexpectedEOF + } + n, err := io.ReadFull(r.r, p) + r.n -= n + return err +} + +// FrameHeader is a frame header, as specified in section 9.1. +type FrameHeader struct { + KeyFrame bool + VersionNumber uint8 + ShowFrame bool + FirstPartitionLen uint32 + Width int + Height int + XScale uint8 + YScale uint8 +} + +const ( + nSegment = 4 + nSegmentProb = 3 +) + +// segmentHeader holds segment-related header information. +type segmentHeader struct { + useSegment bool + updateMap bool + relativeDelta bool + quantizer [nSegment]int8 + filterStrength [nSegment]int8 + prob [nSegmentProb]uint8 +} + +const ( + nRefLFDelta = 4 + nModeLFDelta = 4 +) + +// filterHeader holds filter-related header information. +type filterHeader struct { + simple bool + level int8 + sharpness uint8 + useLFDelta bool + refLFDelta [nRefLFDelta]int8 + modeLFDelta [nModeLFDelta]int8 + perSegmentLevel [nSegment]int8 +} + +// mb is the per-macroblock decode state. A decoder maintains mbw+1 of these +// as it is decoding macroblocks left-to-right and top-to-bottom: mbw for the +// macroblocks in the row above, and one for the macroblock to the left. +type mb struct { + // pred is the predictor mode for the 4 bottom or right 4x4 luma regions. + pred [4]uint8 + // nzMask is a mask of 8 bits: 4 for the bottom or right 4x4 luma regions, + // and 2 + 2 for the bottom or right 4x4 chroma regions. A 1 bit indicates + // that region has non-zero coefficients. + nzMask uint8 + // nzY16 is a 0/1 value that is 1 if the macroblock used Y16 prediction and + // had non-zero coefficients. + nzY16 uint8 +} + +// Decoder decodes VP8 bitstreams into frames. Decoding one frame consists of +// calling Init, DecodeFrameHeader and then DecodeFrame in that order. +// A Decoder can be re-used to decode multiple frames. +type Decoder struct { + // r is the input bitsream. + r limitReader + // scratch is a scratch buffer. + scratch [8]byte + // img is the YCbCr image to decode into. + img *image.YCbCr + // mbw and mbh are the number of 16x16 macroblocks wide and high the image is. + mbw, mbh int + // frameHeader is the frame header. When decoding multiple frames, + // frames that aren't key frames will inherit the Width, Height, + // XScale and YScale of the most recent key frame. + frameHeader FrameHeader + // Other headers. + segmentHeader segmentHeader + filterHeader filterHeader + // The image data is divided into a number of independent partitions. + // There is 1 "first partition" and between 1 and 8 "other partitions" + // for coefficient data. + fp partition + op [8]partition + nOP int + // Quantization factors. + quant [nSegment]quant + // DCT/WHT coefficient decoding probabilities. + tokenProb [nPlane][nBand][nContext][nProb]uint8 + useSkipProb bool + skipProb uint8 + // Loop filter parameters. + filterParams [nSegment][2]filterParam + perMBFilterParams []filterParam + + // The eight fields below relate to the current macroblock being decoded. + // + // Segment-based adjustments. + segment int + // Per-macroblock state for the macroblock immediately left of and those + // macroblocks immediately above the current macroblock. + leftMB mb + upMB []mb + // Bitmasks for which 4x4 regions of coeff contain non-zero coefficients. + nzDCMask, nzACMask uint32 + // Predictor modes. + usePredY16 bool // The libwebp C code calls this !is_i4x4_. + predY16 uint8 + predC8 uint8 + predY4 [4][4]uint8 + + // The two fields below form a workspace for reconstructing a macroblock. + // Their specific sizes are documented in reconstruct.go. + coeff [1*16*16 + 2*8*8 + 1*4*4]int16 + ybr [1 + 16 + 1 + 8][32]uint8 +} + +// NewDecoder returns a new Decoder. +func NewDecoder() *Decoder { + return &Decoder{} +} + +// Init initializes the decoder to read at most n bytes from r. +func (d *Decoder) Init(r io.Reader, n int) { + d.r = limitReader{r, n} +} + +// DecodeFrameHeader decodes the frame header. +func (d *Decoder) DecodeFrameHeader() (fh FrameHeader, err error) { + // All frame headers are at least 3 bytes long. + b := d.scratch[:3] + if err = d.r.ReadFull(b); err != nil { + return + } + d.frameHeader.KeyFrame = (b[0] & 1) == 0 + d.frameHeader.VersionNumber = (b[0] >> 1) & 7 + d.frameHeader.ShowFrame = (b[0]>>4)&1 == 1 + d.frameHeader.FirstPartitionLen = uint32(b[0])>>5 | uint32(b[1])<<3 | uint32(b[2])<<11 + if !d.frameHeader.KeyFrame { + return d.frameHeader, nil + } + // Frame headers for key frames are an additional 7 bytes long. + b = d.scratch[:7] + if err = d.r.ReadFull(b); err != nil { + return + } + // Check the magic sync code. + if b[0] != 0x9d || b[1] != 0x01 || b[2] != 0x2a { + err = errors.New("vp8: invalid format") + return + } + d.frameHeader.Width = int(b[4]&0x3f)<<8 | int(b[3]) + d.frameHeader.Height = int(b[6]&0x3f)<<8 | int(b[5]) + d.frameHeader.XScale = b[4] >> 6 + d.frameHeader.YScale = b[6] >> 6 + d.mbw = (d.frameHeader.Width + 0x0f) >> 4 + d.mbh = (d.frameHeader.Height + 0x0f) >> 4 + d.segmentHeader = segmentHeader{ + prob: [3]uint8{0xff, 0xff, 0xff}, + } + d.tokenProb = defaultTokenProb + d.segment = 0 + return d.frameHeader, nil +} + +// ensureImg ensures that d.img is large enough to hold the decoded frame. +func (d *Decoder) ensureImg() { + if d.img != nil { + p0, p1 := d.img.Rect.Min, d.img.Rect.Max + if p0.X == 0 && p0.Y == 0 && p1.X >= 16*d.mbw && p1.Y >= 16*d.mbh { + return + } + } + m := image.NewYCbCr(image.Rect(0, 0, 16*d.mbw, 16*d.mbh), image.YCbCrSubsampleRatio420) + d.img = m.SubImage(image.Rect(0, 0, d.frameHeader.Width, d.frameHeader.Height)).(*image.YCbCr) + d.perMBFilterParams = make([]filterParam, d.mbw*d.mbh) + d.upMB = make([]mb, d.mbw) +} + +// parseSegmentHeader parses the segment header, as specified in section 9.3. +func (d *Decoder) parseSegmentHeader() { + d.segmentHeader.useSegment = d.fp.readBit(uniformProb) + if !d.segmentHeader.useSegment { + d.segmentHeader.updateMap = false + return + } + d.segmentHeader.updateMap = d.fp.readBit(uniformProb) + if d.fp.readBit(uniformProb) { + d.segmentHeader.relativeDelta = !d.fp.readBit(uniformProb) + for i := range d.segmentHeader.quantizer { + d.segmentHeader.quantizer[i] = int8(d.fp.readOptionalInt(uniformProb, 7)) + } + for i := range d.segmentHeader.filterStrength { + d.segmentHeader.filterStrength[i] = int8(d.fp.readOptionalInt(uniformProb, 6)) + } + } + if !d.segmentHeader.updateMap { + return + } + for i := range d.segmentHeader.prob { + if d.fp.readBit(uniformProb) { + d.segmentHeader.prob[i] = uint8(d.fp.readUint(uniformProb, 8)) + } else { + d.segmentHeader.prob[i] = 0xff + } + } +} + +// parseFilterHeader parses the filter header, as specified in section 9.4. +func (d *Decoder) parseFilterHeader() { + d.filterHeader.simple = d.fp.readBit(uniformProb) + d.filterHeader.level = int8(d.fp.readUint(uniformProb, 6)) + d.filterHeader.sharpness = uint8(d.fp.readUint(uniformProb, 3)) + d.filterHeader.useLFDelta = d.fp.readBit(uniformProb) + if d.filterHeader.useLFDelta && d.fp.readBit(uniformProb) { + for i := range d.filterHeader.refLFDelta { + d.filterHeader.refLFDelta[i] = int8(d.fp.readOptionalInt(uniformProb, 6)) + } + for i := range d.filterHeader.modeLFDelta { + d.filterHeader.modeLFDelta[i] = int8(d.fp.readOptionalInt(uniformProb, 6)) + } + } + if d.filterHeader.level == 0 { + return + } + if d.segmentHeader.useSegment { + for i := range d.filterHeader.perSegmentLevel { + strength := d.segmentHeader.filterStrength[i] + if d.segmentHeader.relativeDelta { + strength += d.filterHeader.level + } + d.filterHeader.perSegmentLevel[i] = strength + } + } else { + d.filterHeader.perSegmentLevel[0] = d.filterHeader.level + } + d.computeFilterParams() +} + +// parseOtherPartitions parses the other partitions, as specified in section 9.5. +func (d *Decoder) parseOtherPartitions() error { + const maxNOP = 1 << 3 + var partLens [maxNOP]int + d.nOP = 1 << d.fp.readUint(uniformProb, 2) + + // The final partition length is implied by the remaining chunk data + // (d.r.n) and the other d.nOP-1 partition lengths. Those d.nOP-1 partition + // lengths are stored as 24-bit uints, i.e. up to 16 MiB per partition. + n := 3 * (d.nOP - 1) + partLens[d.nOP-1] = d.r.n - n + if partLens[d.nOP-1] < 0 { + return io.ErrUnexpectedEOF + } + if n > 0 { + buf := make([]byte, n) + if err := d.r.ReadFull(buf); err != nil { + return err + } + for i := 0; i < d.nOP-1; i++ { + pl := int(buf[3*i+0]) | int(buf[3*i+1])<<8 | int(buf[3*i+2])<<16 + if pl > partLens[d.nOP-1] { + return io.ErrUnexpectedEOF + } + partLens[i] = pl + partLens[d.nOP-1] -= pl + } + } + + // We check if the final partition length can also fit into a 24-bit uint. + // Strictly speaking, this isn't part of the spec, but it guards against a + // malicious WEBP image that is too large to ReadFull the encoded DCT + // coefficients into memory, whether that's because the actual WEBP file is + // too large, or whether its RIFF metadata lists too large a chunk. + if 1<<24 <= partLens[d.nOP-1] { + return errors.New("vp8: too much data to decode") + } + + buf := make([]byte, d.r.n) + if err := d.r.ReadFull(buf); err != nil { + return err + } + for i, pl := range partLens { + if i == d.nOP { + break + } + d.op[i].init(buf[:pl]) + buf = buf[pl:] + } + return nil +} + +// parseOtherHeaders parses header information other than the frame header. +func (d *Decoder) parseOtherHeaders() error { + // Initialize and parse the first partition. + firstPartition := make([]byte, d.frameHeader.FirstPartitionLen) + if err := d.r.ReadFull(firstPartition); err != nil { + return err + } + d.fp.init(firstPartition) + if d.frameHeader.KeyFrame { + // Read and ignore the color space and pixel clamp values. They are + // specified in section 9.2, but are unimplemented. + d.fp.readBit(uniformProb) + d.fp.readBit(uniformProb) + } + d.parseSegmentHeader() + d.parseFilterHeader() + if err := d.parseOtherPartitions(); err != nil { + return err + } + d.parseQuant() + if !d.frameHeader.KeyFrame { + // Golden and AltRef frames are specified in section 9.7. + // TODO(nigeltao): implement. Note that they are only used for video, not still images. + return errors.New("vp8: Golden / AltRef frames are not implemented") + } + // Read and ignore the refreshLastFrameBuffer bit, specified in section 9.8. + // It applies only to video, and not still images. + d.fp.readBit(uniformProb) + d.parseTokenProb() + d.useSkipProb = d.fp.readBit(uniformProb) + if d.useSkipProb { + d.skipProb = uint8(d.fp.readUint(uniformProb, 8)) + } + if d.fp.unexpectedEOF { + return io.ErrUnexpectedEOF + } + return nil +} + +// DecodeFrame decodes the frame and returns it as an YCbCr image. +// The image's contents are valid up until the next call to Decoder.Init. +func (d *Decoder) DecodeFrame() (*image.YCbCr, error) { + d.ensureImg() + if err := d.parseOtherHeaders(); err != nil { + return nil, err + } + // Reconstruct the rows. + for mbx := 0; mbx < d.mbw; mbx++ { + d.upMB[mbx] = mb{} + } + for mby := 0; mby < d.mbh; mby++ { + d.leftMB = mb{} + for mbx := 0; mbx < d.mbw; mbx++ { + skip := d.reconstruct(mbx, mby) + fs := d.filterParams[d.segment][btou(!d.usePredY16)] + fs.inner = fs.inner || !skip + d.perMBFilterParams[d.mbw*mby+mbx] = fs + } + } + if d.fp.unexpectedEOF { + return nil, io.ErrUnexpectedEOF + } + for i := 0; i < d.nOP; i++ { + if d.op[i].unexpectedEOF { + return nil, io.ErrUnexpectedEOF + } + } + // Apply the loop filter. + // + // Even if we are using per-segment levels, section 15 says that "loop + // filtering must be skipped entirely if loop_filter_level at either the + // frame header level or macroblock override level is 0". + if d.filterHeader.level != 0 { + if d.filterHeader.simple { + d.simpleFilter() + } else { + d.normalFilter() + } + } + return d.img, nil +} diff --git a/vendor/golang.org/x/image/vp8/filter.go b/vendor/golang.org/x/image/vp8/filter.go new file mode 100644 index 000000000..e34a811b1 --- /dev/null +++ b/vendor/golang.org/x/image/vp8/filter.go @@ -0,0 +1,273 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package vp8 + +// filter2 modifies a 2-pixel wide or 2-pixel high band along an edge. +func filter2(pix []byte, level, index, iStep, jStep int) { + for n := 16; n > 0; n, index = n-1, index+iStep { + p1 := int(pix[index-2*jStep]) + p0 := int(pix[index-1*jStep]) + q0 := int(pix[index+0*jStep]) + q1 := int(pix[index+1*jStep]) + if abs(p0-q0)<<1+abs(p1-q1)>>1 > level { + continue + } + a := 3*(q0-p0) + clamp127(p1-q1) + a1 := clamp15((a + 4) >> 3) + a2 := clamp15((a + 3) >> 3) + pix[index-1*jStep] = clamp255(p0 + a2) + pix[index+0*jStep] = clamp255(q0 - a1) + } +} + +// filter246 modifies a 2-, 4- or 6-pixel wide or high band along an edge. +func filter246(pix []byte, n, level, ilevel, hlevel, index, iStep, jStep int, fourNotSix bool) { + for ; n > 0; n, index = n-1, index+iStep { + p3 := int(pix[index-4*jStep]) + p2 := int(pix[index-3*jStep]) + p1 := int(pix[index-2*jStep]) + p0 := int(pix[index-1*jStep]) + q0 := int(pix[index+0*jStep]) + q1 := int(pix[index+1*jStep]) + q2 := int(pix[index+2*jStep]) + q3 := int(pix[index+3*jStep]) + if abs(p0-q0)<<1+abs(p1-q1)>>1 > level { + continue + } + if abs(p3-p2) > ilevel || + abs(p2-p1) > ilevel || + abs(p1-p0) > ilevel || + abs(q1-q0) > ilevel || + abs(q2-q1) > ilevel || + abs(q3-q2) > ilevel { + continue + } + if abs(p1-p0) > hlevel || abs(q1-q0) > hlevel { + // Filter 2 pixels. + a := 3*(q0-p0) + clamp127(p1-q1) + a1 := clamp15((a + 4) >> 3) + a2 := clamp15((a + 3) >> 3) + pix[index-1*jStep] = clamp255(p0 + a2) + pix[index+0*jStep] = clamp255(q0 - a1) + } else if fourNotSix { + // Filter 4 pixels. + a := 3 * (q0 - p0) + a1 := clamp15((a + 4) >> 3) + a2 := clamp15((a + 3) >> 3) + a3 := (a1 + 1) >> 1 + pix[index-2*jStep] = clamp255(p1 + a3) + pix[index-1*jStep] = clamp255(p0 + a2) + pix[index+0*jStep] = clamp255(q0 - a1) + pix[index+1*jStep] = clamp255(q1 - a3) + } else { + // Filter 6 pixels. + a := clamp127(3*(q0-p0) + clamp127(p1-q1)) + a1 := (27*a + 63) >> 7 + a2 := (18*a + 63) >> 7 + a3 := (9*a + 63) >> 7 + pix[index-3*jStep] = clamp255(p2 + a3) + pix[index-2*jStep] = clamp255(p1 + a2) + pix[index-1*jStep] = clamp255(p0 + a1) + pix[index+0*jStep] = clamp255(q0 - a1) + pix[index+1*jStep] = clamp255(q1 - a2) + pix[index+2*jStep] = clamp255(q2 - a3) + } + } +} + +// simpleFilter implements the simple filter, as specified in section 15.2. +func (d *Decoder) simpleFilter() { + for mby := 0; mby < d.mbh; mby++ { + for mbx := 0; mbx < d.mbw; mbx++ { + f := d.perMBFilterParams[d.mbw*mby+mbx] + if f.level == 0 { + continue + } + l := int(f.level) + yIndex := (mby*d.img.YStride + mbx) * 16 + if mbx > 0 { + filter2(d.img.Y, l+4, yIndex, d.img.YStride, 1) + } + if f.inner { + filter2(d.img.Y, l, yIndex+0x4, d.img.YStride, 1) + filter2(d.img.Y, l, yIndex+0x8, d.img.YStride, 1) + filter2(d.img.Y, l, yIndex+0xc, d.img.YStride, 1) + } + if mby > 0 { + filter2(d.img.Y, l+4, yIndex, 1, d.img.YStride) + } + if f.inner { + filter2(d.img.Y, l, yIndex+d.img.YStride*0x4, 1, d.img.YStride) + filter2(d.img.Y, l, yIndex+d.img.YStride*0x8, 1, d.img.YStride) + filter2(d.img.Y, l, yIndex+d.img.YStride*0xc, 1, d.img.YStride) + } + } + } +} + +// normalFilter implements the normal filter, as specified in section 15.3. +func (d *Decoder) normalFilter() { + for mby := 0; mby < d.mbh; mby++ { + for mbx := 0; mbx < d.mbw; mbx++ { + f := d.perMBFilterParams[d.mbw*mby+mbx] + if f.level == 0 { + continue + } + l, il, hl := int(f.level), int(f.ilevel), int(f.hlevel) + yIndex := (mby*d.img.YStride + mbx) * 16 + cIndex := (mby*d.img.CStride + mbx) * 8 + if mbx > 0 { + filter246(d.img.Y, 16, l+4, il, hl, yIndex, d.img.YStride, 1, false) + filter246(d.img.Cb, 8, l+4, il, hl, cIndex, d.img.CStride, 1, false) + filter246(d.img.Cr, 8, l+4, il, hl, cIndex, d.img.CStride, 1, false) + } + if f.inner { + filter246(d.img.Y, 16, l, il, hl, yIndex+0x4, d.img.YStride, 1, true) + filter246(d.img.Y, 16, l, il, hl, yIndex+0x8, d.img.YStride, 1, true) + filter246(d.img.Y, 16, l, il, hl, yIndex+0xc, d.img.YStride, 1, true) + filter246(d.img.Cb, 8, l, il, hl, cIndex+0x4, d.img.CStride, 1, true) + filter246(d.img.Cr, 8, l, il, hl, cIndex+0x4, d.img.CStride, 1, true) + } + if mby > 0 { + filter246(d.img.Y, 16, l+4, il, hl, yIndex, 1, d.img.YStride, false) + filter246(d.img.Cb, 8, l+4, il, hl, cIndex, 1, d.img.CStride, false) + filter246(d.img.Cr, 8, l+4, il, hl, cIndex, 1, d.img.CStride, false) + } + if f.inner { + filter246(d.img.Y, 16, l, il, hl, yIndex+d.img.YStride*0x4, 1, d.img.YStride, true) + filter246(d.img.Y, 16, l, il, hl, yIndex+d.img.YStride*0x8, 1, d.img.YStride, true) + filter246(d.img.Y, 16, l, il, hl, yIndex+d.img.YStride*0xc, 1, d.img.YStride, true) + filter246(d.img.Cb, 8, l, il, hl, cIndex+d.img.CStride*0x4, 1, d.img.CStride, true) + filter246(d.img.Cr, 8, l, il, hl, cIndex+d.img.CStride*0x4, 1, d.img.CStride, true) + } + } + } +} + +// filterParam holds the loop filter parameters for a macroblock. +type filterParam struct { + // The first three fields are thresholds used by the loop filter to smooth + // over the edges and interior of a macroblock. level is used by both the + // simple and normal filters. The inner level and high edge variance level + // are only used by the normal filter. + level, ilevel, hlevel uint8 + // inner is whether the inner loop filter cannot be optimized out as a + // no-op for this particular macroblock. + inner bool +} + +// computeFilterParams computes the loop filter parameters, as specified in +// section 15.4. +func (d *Decoder) computeFilterParams() { + for i := range d.filterParams { + baseLevel := d.filterHeader.level + if d.segmentHeader.useSegment { + baseLevel = d.segmentHeader.filterStrength[i] + if d.segmentHeader.relativeDelta { + baseLevel += d.filterHeader.level + } + } + + for j := range d.filterParams[i] { + p := &d.filterParams[i][j] + p.inner = j != 0 + level := baseLevel + if d.filterHeader.useLFDelta { + // The libwebp C code has a "TODO: only CURRENT is handled for now." + level += d.filterHeader.refLFDelta[0] + if j != 0 { + level += d.filterHeader.modeLFDelta[0] + } + } + if level <= 0 { + p.level = 0 + continue + } + if level > 63 { + level = 63 + } + ilevel := level + if d.filterHeader.sharpness > 0 { + if d.filterHeader.sharpness > 4 { + ilevel >>= 2 + } else { + ilevel >>= 1 + } + if x := int8(9 - d.filterHeader.sharpness); ilevel > x { + ilevel = x + } + } + if ilevel < 1 { + ilevel = 1 + } + p.ilevel = uint8(ilevel) + p.level = uint8(2*level + ilevel) + if d.frameHeader.KeyFrame { + if level < 15 { + p.hlevel = 0 + } else if level < 40 { + p.hlevel = 1 + } else { + p.hlevel = 2 + } + } else { + if level < 15 { + p.hlevel = 0 + } else if level < 20 { + p.hlevel = 1 + } else if level < 40 { + p.hlevel = 2 + } else { + p.hlevel = 3 + } + } + } + } +} + +// intSize is either 32 or 64. +const intSize = 32 << (^uint(0) >> 63) + +func abs(x int) int { + // m := -1 if x < 0. m := 0 otherwise. + m := x >> (intSize - 1) + + // In two's complement representation, the negative number + // of any number (except the smallest one) can be computed + // by flipping all the bits and add 1. This is faster than + // code with a branch. + // See Hacker's Delight, section 2-4. + return (x ^ m) - m +} + +func clamp15(x int) int { + if x < -16 { + return -16 + } + if x > 15 { + return 15 + } + return x +} + +func clamp127(x int) int { + if x < -128 { + return -128 + } + if x > 127 { + return 127 + } + return x +} + +func clamp255(x int) uint8 { + if x < 0 { + return 0 + } + if x > 255 { + return 255 + } + return uint8(x) +} diff --git a/vendor/golang.org/x/image/vp8/idct.go b/vendor/golang.org/x/image/vp8/idct.go new file mode 100644 index 000000000..929af2cc9 --- /dev/null +++ b/vendor/golang.org/x/image/vp8/idct.go @@ -0,0 +1,98 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package vp8 + +// This file implements the inverse Discrete Cosine Transform and the inverse +// Walsh Hadamard Transform (WHT), as specified in sections 14.3 and 14.4. + +func clip8(i int32) uint8 { + if i < 0 { + return 0 + } + if i > 255 { + return 255 + } + return uint8(i) +} + +func (z *Decoder) inverseDCT4(y, x, coeffBase int) { + const ( + c1 = 85627 // 65536 * cos(pi/8) * sqrt(2). + c2 = 35468 // 65536 * sin(pi/8) * sqrt(2). + ) + var m [4][4]int32 + for i := 0; i < 4; i++ { + a := int32(z.coeff[coeffBase+0]) + int32(z.coeff[coeffBase+8]) + b := int32(z.coeff[coeffBase+0]) - int32(z.coeff[coeffBase+8]) + c := (int32(z.coeff[coeffBase+4])*c2)>>16 - (int32(z.coeff[coeffBase+12])*c1)>>16 + d := (int32(z.coeff[coeffBase+4])*c1)>>16 + (int32(z.coeff[coeffBase+12])*c2)>>16 + m[i][0] = a + d + m[i][1] = b + c + m[i][2] = b - c + m[i][3] = a - d + coeffBase++ + } + for j := 0; j < 4; j++ { + dc := m[0][j] + 4 + a := dc + m[2][j] + b := dc - m[2][j] + c := (m[1][j]*c2)>>16 - (m[3][j]*c1)>>16 + d := (m[1][j]*c1)>>16 + (m[3][j]*c2)>>16 + z.ybr[y+j][x+0] = clip8(int32(z.ybr[y+j][x+0]) + (a+d)>>3) + z.ybr[y+j][x+1] = clip8(int32(z.ybr[y+j][x+1]) + (b+c)>>3) + z.ybr[y+j][x+2] = clip8(int32(z.ybr[y+j][x+2]) + (b-c)>>3) + z.ybr[y+j][x+3] = clip8(int32(z.ybr[y+j][x+3]) + (a-d)>>3) + } +} + +func (z *Decoder) inverseDCT4DCOnly(y, x, coeffBase int) { + dc := (int32(z.coeff[coeffBase+0]) + 4) >> 3 + for j := 0; j < 4; j++ { + for i := 0; i < 4; i++ { + z.ybr[y+j][x+i] = clip8(int32(z.ybr[y+j][x+i]) + dc) + } + } +} + +func (z *Decoder) inverseDCT8(y, x, coeffBase int) { + z.inverseDCT4(y+0, x+0, coeffBase+0*16) + z.inverseDCT4(y+0, x+4, coeffBase+1*16) + z.inverseDCT4(y+4, x+0, coeffBase+2*16) + z.inverseDCT4(y+4, x+4, coeffBase+3*16) +} + +func (z *Decoder) inverseDCT8DCOnly(y, x, coeffBase int) { + z.inverseDCT4DCOnly(y+0, x+0, coeffBase+0*16) + z.inverseDCT4DCOnly(y+0, x+4, coeffBase+1*16) + z.inverseDCT4DCOnly(y+4, x+0, coeffBase+2*16) + z.inverseDCT4DCOnly(y+4, x+4, coeffBase+3*16) +} + +func (d *Decoder) inverseWHT16() { + var m [16]int32 + for i := 0; i < 4; i++ { + a0 := int32(d.coeff[384+0+i]) + int32(d.coeff[384+12+i]) + a1 := int32(d.coeff[384+4+i]) + int32(d.coeff[384+8+i]) + a2 := int32(d.coeff[384+4+i]) - int32(d.coeff[384+8+i]) + a3 := int32(d.coeff[384+0+i]) - int32(d.coeff[384+12+i]) + m[0+i] = a0 + a1 + m[8+i] = a0 - a1 + m[4+i] = a3 + a2 + m[12+i] = a3 - a2 + } + out := 0 + for i := 0; i < 4; i++ { + dc := m[0+i*4] + 3 + a0 := dc + m[3+i*4] + a1 := m[1+i*4] + m[2+i*4] + a2 := m[1+i*4] - m[2+i*4] + a3 := dc - m[3+i*4] + d.coeff[out+0] = int16((a0 + a1) >> 3) + d.coeff[out+16] = int16((a3 + a2) >> 3) + d.coeff[out+32] = int16((a0 - a1) >> 3) + d.coeff[out+48] = int16((a3 - a2) >> 3) + out += 64 + } +} diff --git a/vendor/golang.org/x/image/vp8/partition.go b/vendor/golang.org/x/image/vp8/partition.go new file mode 100644 index 000000000..72288bdeb --- /dev/null +++ b/vendor/golang.org/x/image/vp8/partition.go @@ -0,0 +1,129 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package vp8 + +// Each VP8 frame consists of between 2 and 9 bitstream partitions. +// Each partition is byte-aligned and is independently arithmetic-encoded. +// +// This file implements decoding a partition's bitstream, as specified in +// chapter 7. The implementation follows libwebp's approach instead of the +// specification's reference C implementation. For example, we use a look-up +// table instead of a for loop to recalibrate the encoded range. + +var ( + lutShift = [127]uint8{ + 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + } + lutRangeM1 = [127]uint8{ + 127, + 127, 191, + 127, 159, 191, 223, + 127, 143, 159, 175, 191, 207, 223, 239, + 127, 135, 143, 151, 159, 167, 175, 183, 191, 199, 207, 215, 223, 231, 239, 247, + 127, 131, 135, 139, 143, 147, 151, 155, 159, 163, 167, 171, 175, 179, 183, 187, + 191, 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, + 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, + 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, + 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, + 223, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, + } +) + +// uniformProb represents a 50% probability that the next bit is 0. +const uniformProb = 128 + +// partition holds arithmetic-coded bits. +type partition struct { + // buf is the input bytes. + buf []byte + // r is how many of buf's bytes have been consumed. + r int + // rangeM1 is range minus 1, where range is in the arithmetic coding sense, + // not the Go language sense. + rangeM1 uint32 + // bits and nBits hold those bits shifted out of buf but not yet consumed. + bits uint32 + nBits uint8 + // unexpectedEOF tells whether we tried to read past buf. + unexpectedEOF bool +} + +// init initializes the partition. +func (p *partition) init(buf []byte) { + p.buf = buf + p.r = 0 + p.rangeM1 = 254 + p.bits = 0 + p.nBits = 0 + p.unexpectedEOF = false +} + +// readBit returns the next bit. +func (p *partition) readBit(prob uint8) bool { + if p.nBits < 8 { + if p.r >= len(p.buf) { + p.unexpectedEOF = true + return false + } + // Expression split for 386 compiler. + x := uint32(p.buf[p.r]) + p.bits |= x << (8 - p.nBits) + p.r++ + p.nBits += 8 + } + split := (p.rangeM1*uint32(prob))>>8 + 1 + bit := p.bits >= split<<8 + if bit { + p.rangeM1 -= split + p.bits -= split << 8 + } else { + p.rangeM1 = split - 1 + } + if p.rangeM1 < 127 { + shift := lutShift[p.rangeM1] + p.rangeM1 = uint32(lutRangeM1[p.rangeM1]) + p.bits <<= shift + p.nBits -= shift + } + return bit +} + +// readUint returns the next n-bit unsigned integer. +func (p *partition) readUint(prob, n uint8) uint32 { + var u uint32 + for n > 0 { + n-- + if p.readBit(prob) { + u |= 1 << n + } + } + return u +} + +// readInt returns the next n-bit signed integer. +func (p *partition) readInt(prob, n uint8) int32 { + u := p.readUint(prob, n) + b := p.readBit(prob) + if b { + return -int32(u) + } + return int32(u) +} + +// readOptionalInt returns the next n-bit signed integer in an encoding +// where the likely result is zero. +func (p *partition) readOptionalInt(prob, n uint8) int32 { + if !p.readBit(prob) { + return 0 + } + return p.readInt(prob, n) +} diff --git a/vendor/golang.org/x/image/vp8/pred.go b/vendor/golang.org/x/image/vp8/pred.go new file mode 100644 index 000000000..58c2689ea --- /dev/null +++ b/vendor/golang.org/x/image/vp8/pred.go @@ -0,0 +1,201 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package vp8 + +// This file implements parsing the predictor modes, as specified in chapter +// 11. + +func (d *Decoder) parsePredModeY16(mbx int) { + var p uint8 + if !d.fp.readBit(156) { + if !d.fp.readBit(163) { + p = predDC + } else { + p = predVE + } + } else if !d.fp.readBit(128) { + p = predHE + } else { + p = predTM + } + for i := 0; i < 4; i++ { + d.upMB[mbx].pred[i] = p + d.leftMB.pred[i] = p + } + d.predY16 = p +} + +func (d *Decoder) parsePredModeC8() { + if !d.fp.readBit(142) { + d.predC8 = predDC + } else if !d.fp.readBit(114) { + d.predC8 = predVE + } else if !d.fp.readBit(183) { + d.predC8 = predHE + } else { + d.predC8 = predTM + } +} + +func (d *Decoder) parsePredModeY4(mbx int) { + for j := 0; j < 4; j++ { + p := d.leftMB.pred[j] + for i := 0; i < 4; i++ { + prob := &predProb[d.upMB[mbx].pred[i]][p] + if !d.fp.readBit(prob[0]) { + p = predDC + } else if !d.fp.readBit(prob[1]) { + p = predTM + } else if !d.fp.readBit(prob[2]) { + p = predVE + } else if !d.fp.readBit(prob[3]) { + if !d.fp.readBit(prob[4]) { + p = predHE + } else if !d.fp.readBit(prob[5]) { + p = predRD + } else { + p = predVR + } + } else if !d.fp.readBit(prob[6]) { + p = predLD + } else if !d.fp.readBit(prob[7]) { + p = predVL + } else if !d.fp.readBit(prob[8]) { + p = predHD + } else { + p = predHU + } + d.predY4[j][i] = p + d.upMB[mbx].pred[i] = p + } + d.leftMB.pred[j] = p + } +} + +// predProb are the probabilities to decode a 4x4 region's predictor mode given +// the predictor modes of the regions above and left of it. +// These values are specified in section 11.5. +var predProb = [nPred][nPred][9]uint8{ + { + {231, 120, 48, 89, 115, 113, 120, 152, 112}, + {152, 179, 64, 126, 170, 118, 46, 70, 95}, + {175, 69, 143, 80, 85, 82, 72, 155, 103}, + {56, 58, 10, 171, 218, 189, 17, 13, 152}, + {114, 26, 17, 163, 44, 195, 21, 10, 173}, + {121, 24, 80, 195, 26, 62, 44, 64, 85}, + {144, 71, 10, 38, 171, 213, 144, 34, 26}, + {170, 46, 55, 19, 136, 160, 33, 206, 71}, + {63, 20, 8, 114, 114, 208, 12, 9, 226}, + {81, 40, 11, 96, 182, 84, 29, 16, 36}, + }, + { + {134, 183, 89, 137, 98, 101, 106, 165, 148}, + {72, 187, 100, 130, 157, 111, 32, 75, 80}, + {66, 102, 167, 99, 74, 62, 40, 234, 128}, + {41, 53, 9, 178, 241, 141, 26, 8, 107}, + {74, 43, 26, 146, 73, 166, 49, 23, 157}, + {65, 38, 105, 160, 51, 52, 31, 115, 128}, + {104, 79, 12, 27, 217, 255, 87, 17, 7}, + {87, 68, 71, 44, 114, 51, 15, 186, 23}, + {47, 41, 14, 110, 182, 183, 21, 17, 194}, + {66, 45, 25, 102, 197, 189, 23, 18, 22}, + }, + { + {88, 88, 147, 150, 42, 46, 45, 196, 205}, + {43, 97, 183, 117, 85, 38, 35, 179, 61}, + {39, 53, 200, 87, 26, 21, 43, 232, 171}, + {56, 34, 51, 104, 114, 102, 29, 93, 77}, + {39, 28, 85, 171, 58, 165, 90, 98, 64}, + {34, 22, 116, 206, 23, 34, 43, 166, 73}, + {107, 54, 32, 26, 51, 1, 81, 43, 31}, + {68, 25, 106, 22, 64, 171, 36, 225, 114}, + {34, 19, 21, 102, 132, 188, 16, 76, 124}, + {62, 18, 78, 95, 85, 57, 50, 48, 51}, + }, + { + {193, 101, 35, 159, 215, 111, 89, 46, 111}, + {60, 148, 31, 172, 219, 228, 21, 18, 111}, + {112, 113, 77, 85, 179, 255, 38, 120, 114}, + {40, 42, 1, 196, 245, 209, 10, 25, 109}, + {88, 43, 29, 140, 166, 213, 37, 43, 154}, + {61, 63, 30, 155, 67, 45, 68, 1, 209}, + {100, 80, 8, 43, 154, 1, 51, 26, 71}, + {142, 78, 78, 16, 255, 128, 34, 197, 171}, + {41, 40, 5, 102, 211, 183, 4, 1, 221}, + {51, 50, 17, 168, 209, 192, 23, 25, 82}, + }, + { + {138, 31, 36, 171, 27, 166, 38, 44, 229}, + {67, 87, 58, 169, 82, 115, 26, 59, 179}, + {63, 59, 90, 180, 59, 166, 93, 73, 154}, + {40, 40, 21, 116, 143, 209, 34, 39, 175}, + {47, 15, 16, 183, 34, 223, 49, 45, 183}, + {46, 17, 33, 183, 6, 98, 15, 32, 183}, + {57, 46, 22, 24, 128, 1, 54, 17, 37}, + {65, 32, 73, 115, 28, 128, 23, 128, 205}, + {40, 3, 9, 115, 51, 192, 18, 6, 223}, + {87, 37, 9, 115, 59, 77, 64, 21, 47}, + }, + { + {104, 55, 44, 218, 9, 54, 53, 130, 226}, + {64, 90, 70, 205, 40, 41, 23, 26, 57}, + {54, 57, 112, 184, 5, 41, 38, 166, 213}, + {30, 34, 26, 133, 152, 116, 10, 32, 134}, + {39, 19, 53, 221, 26, 114, 32, 73, 255}, + {31, 9, 65, 234, 2, 15, 1, 118, 73}, + {75, 32, 12, 51, 192, 255, 160, 43, 51}, + {88, 31, 35, 67, 102, 85, 55, 186, 85}, + {56, 21, 23, 111, 59, 205, 45, 37, 192}, + {55, 38, 70, 124, 73, 102, 1, 34, 98}, + }, + { + {125, 98, 42, 88, 104, 85, 117, 175, 82}, + {95, 84, 53, 89, 128, 100, 113, 101, 45}, + {75, 79, 123, 47, 51, 128, 81, 171, 1}, + {57, 17, 5, 71, 102, 57, 53, 41, 49}, + {38, 33, 13, 121, 57, 73, 26, 1, 85}, + {41, 10, 67, 138, 77, 110, 90, 47, 114}, + {115, 21, 2, 10, 102, 255, 166, 23, 6}, + {101, 29, 16, 10, 85, 128, 101, 196, 26}, + {57, 18, 10, 102, 102, 213, 34, 20, 43}, + {117, 20, 15, 36, 163, 128, 68, 1, 26}, + }, + { + {102, 61, 71, 37, 34, 53, 31, 243, 192}, + {69, 60, 71, 38, 73, 119, 28, 222, 37}, + {68, 45, 128, 34, 1, 47, 11, 245, 171}, + {62, 17, 19, 70, 146, 85, 55, 62, 70}, + {37, 43, 37, 154, 100, 163, 85, 160, 1}, + {63, 9, 92, 136, 28, 64, 32, 201, 85}, + {75, 15, 9, 9, 64, 255, 184, 119, 16}, + {86, 6, 28, 5, 64, 255, 25, 248, 1}, + {56, 8, 17, 132, 137, 255, 55, 116, 128}, + {58, 15, 20, 82, 135, 57, 26, 121, 40}, + }, + { + {164, 50, 31, 137, 154, 133, 25, 35, 218}, + {51, 103, 44, 131, 131, 123, 31, 6, 158}, + {86, 40, 64, 135, 148, 224, 45, 183, 128}, + {22, 26, 17, 131, 240, 154, 14, 1, 209}, + {45, 16, 21, 91, 64, 222, 7, 1, 197}, + {56, 21, 39, 155, 60, 138, 23, 102, 213}, + {83, 12, 13, 54, 192, 255, 68, 47, 28}, + {85, 26, 85, 85, 128, 128, 32, 146, 171}, + {18, 11, 7, 63, 144, 171, 4, 4, 246}, + {35, 27, 10, 146, 174, 171, 12, 26, 128}, + }, + { + {190, 80, 35, 99, 180, 80, 126, 54, 45}, + {85, 126, 47, 87, 176, 51, 41, 20, 32}, + {101, 75, 128, 139, 118, 146, 116, 128, 85}, + {56, 41, 15, 176, 236, 85, 37, 9, 62}, + {71, 30, 17, 119, 118, 255, 17, 18, 138}, + {101, 38, 60, 138, 55, 70, 43, 26, 142}, + {146, 36, 19, 30, 171, 255, 97, 27, 20}, + {138, 45, 61, 62, 219, 1, 81, 188, 64}, + {32, 41, 20, 117, 151, 142, 20, 21, 163}, + {112, 19, 12, 61, 195, 128, 48, 4, 24}, + }, +} diff --git a/vendor/golang.org/x/image/vp8/predfunc.go b/vendor/golang.org/x/image/vp8/predfunc.go new file mode 100644 index 000000000..f8999582b --- /dev/null +++ b/vendor/golang.org/x/image/vp8/predfunc.go @@ -0,0 +1,553 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package vp8 + +// This file implements the predicition functions, as specified in chapter 12. +// +// For each macroblock (of 1x16x16 luma and 2x8x8 chroma coefficients), the +// luma values are either predicted as one large 16x16 region or 16 separate +// 4x4 regions. The chroma values are always predicted as one 8x8 region. +// +// For 4x4 regions, the target block's predicted values (Xs) are a function of +// its previously-decoded top and left border values, as well as a number of +// pixels from the top-right: +// +// a b c d e f g h +// p X X X X +// q X X X X +// r X X X X +// s X X X X +// +// The predictor modes are: +// - DC: all Xs = (b + c + d + e + p + q + r + s + 4) / 8. +// - TM: the first X = (b + p - a), the second X = (c + p - a), and so on. +// - VE: each X = the weighted average of its column's top value and that +// value's neighbors, i.e. averages of abc, bcd, cde or def. +// - HE: similar to VE except rows instead of columns, and the final row is +// an average of r, s and s. +// - RD, VR, LD, VL, HD, HU: these diagonal modes ("Right Down", "Vertical +// Right", etc) are more complicated and are described in section 12.3. +// All Xs are clipped to the range [0, 255]. +// +// For 8x8 and 16x16 regions, the target block's predicted values are a +// function of the top and left border values without the top-right overhang, +// i.e. without the 8x8 or 16x16 equivalent of f, g and h. Furthermore: +// - There are no diagonal predictor modes, only DC, TM, VE and HE. +// - The DC mode has variants for macroblocks in the top row and/or left +// column, i.e. for macroblocks with mby == 0 || mbx == 0. +// - The VE and HE modes take only the column top or row left values; they do +// not smooth that top/left value with its neighbors. + +// nPred is the number of predictor modes, not including the Top/Left versions +// of the DC predictor mode. +const nPred = 10 + +const ( + predDC = iota + predTM + predVE + predHE + predRD + predVR + predLD + predVL + predHD + predHU + predDCTop + predDCLeft + predDCTopLeft +) + +func checkTopLeftPred(mbx, mby int, p uint8) uint8 { + if p != predDC { + return p + } + if mbx == 0 { + if mby == 0 { + return predDCTopLeft + } + return predDCLeft + } + if mby == 0 { + return predDCTop + } + return predDC +} + +var predFunc4 = [...]func(*Decoder, int, int){ + predFunc4DC, + predFunc4TM, + predFunc4VE, + predFunc4HE, + predFunc4RD, + predFunc4VR, + predFunc4LD, + predFunc4VL, + predFunc4HD, + predFunc4HU, + nil, + nil, + nil, +} + +var predFunc8 = [...]func(*Decoder, int, int){ + predFunc8DC, + predFunc8TM, + predFunc8VE, + predFunc8HE, + nil, + nil, + nil, + nil, + nil, + nil, + predFunc8DCTop, + predFunc8DCLeft, + predFunc8DCTopLeft, +} + +var predFunc16 = [...]func(*Decoder, int, int){ + predFunc16DC, + predFunc16TM, + predFunc16VE, + predFunc16HE, + nil, + nil, + nil, + nil, + nil, + nil, + predFunc16DCTop, + predFunc16DCLeft, + predFunc16DCTopLeft, +} + +func predFunc4DC(z *Decoder, y, x int) { + sum := uint32(4) + for i := 0; i < 4; i++ { + sum += uint32(z.ybr[y-1][x+i]) + } + for j := 0; j < 4; j++ { + sum += uint32(z.ybr[y+j][x-1]) + } + avg := uint8(sum / 8) + for j := 0; j < 4; j++ { + for i := 0; i < 4; i++ { + z.ybr[y+j][x+i] = avg + } + } +} + +func predFunc4TM(z *Decoder, y, x int) { + delta0 := -int32(z.ybr[y-1][x-1]) + for j := 0; j < 4; j++ { + delta1 := delta0 + int32(z.ybr[y+j][x-1]) + for i := 0; i < 4; i++ { + delta2 := delta1 + int32(z.ybr[y-1][x+i]) + z.ybr[y+j][x+i] = uint8(clip(delta2, 0, 255)) + } + } +} + +func predFunc4VE(z *Decoder, y, x int) { + a := int32(z.ybr[y-1][x-1]) + b := int32(z.ybr[y-1][x+0]) + c := int32(z.ybr[y-1][x+1]) + d := int32(z.ybr[y-1][x+2]) + e := int32(z.ybr[y-1][x+3]) + f := int32(z.ybr[y-1][x+4]) + abc := uint8((a + 2*b + c + 2) / 4) + bcd := uint8((b + 2*c + d + 2) / 4) + cde := uint8((c + 2*d + e + 2) / 4) + def := uint8((d + 2*e + f + 2) / 4) + for j := 0; j < 4; j++ { + z.ybr[y+j][x+0] = abc + z.ybr[y+j][x+1] = bcd + z.ybr[y+j][x+2] = cde + z.ybr[y+j][x+3] = def + } +} + +func predFunc4HE(z *Decoder, y, x int) { + s := int32(z.ybr[y+3][x-1]) + r := int32(z.ybr[y+2][x-1]) + q := int32(z.ybr[y+1][x-1]) + p := int32(z.ybr[y+0][x-1]) + a := int32(z.ybr[y-1][x-1]) + ssr := uint8((s + 2*s + r + 2) / 4) + srq := uint8((s + 2*r + q + 2) / 4) + rqp := uint8((r + 2*q + p + 2) / 4) + apq := uint8((a + 2*p + q + 2) / 4) + for i := 0; i < 4; i++ { + z.ybr[y+0][x+i] = apq + z.ybr[y+1][x+i] = rqp + z.ybr[y+2][x+i] = srq + z.ybr[y+3][x+i] = ssr + } +} + +func predFunc4RD(z *Decoder, y, x int) { + s := int32(z.ybr[y+3][x-1]) + r := int32(z.ybr[y+2][x-1]) + q := int32(z.ybr[y+1][x-1]) + p := int32(z.ybr[y+0][x-1]) + a := int32(z.ybr[y-1][x-1]) + b := int32(z.ybr[y-1][x+0]) + c := int32(z.ybr[y-1][x+1]) + d := int32(z.ybr[y-1][x+2]) + e := int32(z.ybr[y-1][x+3]) + srq := uint8((s + 2*r + q + 2) / 4) + rqp := uint8((r + 2*q + p + 2) / 4) + qpa := uint8((q + 2*p + a + 2) / 4) + pab := uint8((p + 2*a + b + 2) / 4) + abc := uint8((a + 2*b + c + 2) / 4) + bcd := uint8((b + 2*c + d + 2) / 4) + cde := uint8((c + 2*d + e + 2) / 4) + z.ybr[y+0][x+0] = pab + z.ybr[y+0][x+1] = abc + z.ybr[y+0][x+2] = bcd + z.ybr[y+0][x+3] = cde + z.ybr[y+1][x+0] = qpa + z.ybr[y+1][x+1] = pab + z.ybr[y+1][x+2] = abc + z.ybr[y+1][x+3] = bcd + z.ybr[y+2][x+0] = rqp + z.ybr[y+2][x+1] = qpa + z.ybr[y+2][x+2] = pab + z.ybr[y+2][x+3] = abc + z.ybr[y+3][x+0] = srq + z.ybr[y+3][x+1] = rqp + z.ybr[y+3][x+2] = qpa + z.ybr[y+3][x+3] = pab +} + +func predFunc4VR(z *Decoder, y, x int) { + r := int32(z.ybr[y+2][x-1]) + q := int32(z.ybr[y+1][x-1]) + p := int32(z.ybr[y+0][x-1]) + a := int32(z.ybr[y-1][x-1]) + b := int32(z.ybr[y-1][x+0]) + c := int32(z.ybr[y-1][x+1]) + d := int32(z.ybr[y-1][x+2]) + e := int32(z.ybr[y-1][x+3]) + ab := uint8((a + b + 1) / 2) + bc := uint8((b + c + 1) / 2) + cd := uint8((c + d + 1) / 2) + de := uint8((d + e + 1) / 2) + rqp := uint8((r + 2*q + p + 2) / 4) + qpa := uint8((q + 2*p + a + 2) / 4) + pab := uint8((p + 2*a + b + 2) / 4) + abc := uint8((a + 2*b + c + 2) / 4) + bcd := uint8((b + 2*c + d + 2) / 4) + cde := uint8((c + 2*d + e + 2) / 4) + z.ybr[y+0][x+0] = ab + z.ybr[y+0][x+1] = bc + z.ybr[y+0][x+2] = cd + z.ybr[y+0][x+3] = de + z.ybr[y+1][x+0] = pab + z.ybr[y+1][x+1] = abc + z.ybr[y+1][x+2] = bcd + z.ybr[y+1][x+3] = cde + z.ybr[y+2][x+0] = qpa + z.ybr[y+2][x+1] = ab + z.ybr[y+2][x+2] = bc + z.ybr[y+2][x+3] = cd + z.ybr[y+3][x+0] = rqp + z.ybr[y+3][x+1] = pab + z.ybr[y+3][x+2] = abc + z.ybr[y+3][x+3] = bcd +} + +func predFunc4LD(z *Decoder, y, x int) { + a := int32(z.ybr[y-1][x+0]) + b := int32(z.ybr[y-1][x+1]) + c := int32(z.ybr[y-1][x+2]) + d := int32(z.ybr[y-1][x+3]) + e := int32(z.ybr[y-1][x+4]) + f := int32(z.ybr[y-1][x+5]) + g := int32(z.ybr[y-1][x+6]) + h := int32(z.ybr[y-1][x+7]) + abc := uint8((a + 2*b + c + 2) / 4) + bcd := uint8((b + 2*c + d + 2) / 4) + cde := uint8((c + 2*d + e + 2) / 4) + def := uint8((d + 2*e + f + 2) / 4) + efg := uint8((e + 2*f + g + 2) / 4) + fgh := uint8((f + 2*g + h + 2) / 4) + ghh := uint8((g + 2*h + h + 2) / 4) + z.ybr[y+0][x+0] = abc + z.ybr[y+0][x+1] = bcd + z.ybr[y+0][x+2] = cde + z.ybr[y+0][x+3] = def + z.ybr[y+1][x+0] = bcd + z.ybr[y+1][x+1] = cde + z.ybr[y+1][x+2] = def + z.ybr[y+1][x+3] = efg + z.ybr[y+2][x+0] = cde + z.ybr[y+2][x+1] = def + z.ybr[y+2][x+2] = efg + z.ybr[y+2][x+3] = fgh + z.ybr[y+3][x+0] = def + z.ybr[y+3][x+1] = efg + z.ybr[y+3][x+2] = fgh + z.ybr[y+3][x+3] = ghh +} + +func predFunc4VL(z *Decoder, y, x int) { + a := int32(z.ybr[y-1][x+0]) + b := int32(z.ybr[y-1][x+1]) + c := int32(z.ybr[y-1][x+2]) + d := int32(z.ybr[y-1][x+3]) + e := int32(z.ybr[y-1][x+4]) + f := int32(z.ybr[y-1][x+5]) + g := int32(z.ybr[y-1][x+6]) + h := int32(z.ybr[y-1][x+7]) + ab := uint8((a + b + 1) / 2) + bc := uint8((b + c + 1) / 2) + cd := uint8((c + d + 1) / 2) + de := uint8((d + e + 1) / 2) + abc := uint8((a + 2*b + c + 2) / 4) + bcd := uint8((b + 2*c + d + 2) / 4) + cde := uint8((c + 2*d + e + 2) / 4) + def := uint8((d + 2*e + f + 2) / 4) + efg := uint8((e + 2*f + g + 2) / 4) + fgh := uint8((f + 2*g + h + 2) / 4) + z.ybr[y+0][x+0] = ab + z.ybr[y+0][x+1] = bc + z.ybr[y+0][x+2] = cd + z.ybr[y+0][x+3] = de + z.ybr[y+1][x+0] = abc + z.ybr[y+1][x+1] = bcd + z.ybr[y+1][x+2] = cde + z.ybr[y+1][x+3] = def + z.ybr[y+2][x+0] = bc + z.ybr[y+2][x+1] = cd + z.ybr[y+2][x+2] = de + z.ybr[y+2][x+3] = efg + z.ybr[y+3][x+0] = bcd + z.ybr[y+3][x+1] = cde + z.ybr[y+3][x+2] = def + z.ybr[y+3][x+3] = fgh +} + +func predFunc4HD(z *Decoder, y, x int) { + s := int32(z.ybr[y+3][x-1]) + r := int32(z.ybr[y+2][x-1]) + q := int32(z.ybr[y+1][x-1]) + p := int32(z.ybr[y+0][x-1]) + a := int32(z.ybr[y-1][x-1]) + b := int32(z.ybr[y-1][x+0]) + c := int32(z.ybr[y-1][x+1]) + d := int32(z.ybr[y-1][x+2]) + sr := uint8((s + r + 1) / 2) + rq := uint8((r + q + 1) / 2) + qp := uint8((q + p + 1) / 2) + pa := uint8((p + a + 1) / 2) + srq := uint8((s + 2*r + q + 2) / 4) + rqp := uint8((r + 2*q + p + 2) / 4) + qpa := uint8((q + 2*p + a + 2) / 4) + pab := uint8((p + 2*a + b + 2) / 4) + abc := uint8((a + 2*b + c + 2) / 4) + bcd := uint8((b + 2*c + d + 2) / 4) + z.ybr[y+0][x+0] = pa + z.ybr[y+0][x+1] = pab + z.ybr[y+0][x+2] = abc + z.ybr[y+0][x+3] = bcd + z.ybr[y+1][x+0] = qp + z.ybr[y+1][x+1] = qpa + z.ybr[y+1][x+2] = pa + z.ybr[y+1][x+3] = pab + z.ybr[y+2][x+0] = rq + z.ybr[y+2][x+1] = rqp + z.ybr[y+2][x+2] = qp + z.ybr[y+2][x+3] = qpa + z.ybr[y+3][x+0] = sr + z.ybr[y+3][x+1] = srq + z.ybr[y+3][x+2] = rq + z.ybr[y+3][x+3] = rqp +} + +func predFunc4HU(z *Decoder, y, x int) { + s := int32(z.ybr[y+3][x-1]) + r := int32(z.ybr[y+2][x-1]) + q := int32(z.ybr[y+1][x-1]) + p := int32(z.ybr[y+0][x-1]) + pq := uint8((p + q + 1) / 2) + qr := uint8((q + r + 1) / 2) + rs := uint8((r + s + 1) / 2) + pqr := uint8((p + 2*q + r + 2) / 4) + qrs := uint8((q + 2*r + s + 2) / 4) + rss := uint8((r + 2*s + s + 2) / 4) + sss := uint8(s) + z.ybr[y+0][x+0] = pq + z.ybr[y+0][x+1] = pqr + z.ybr[y+0][x+2] = qr + z.ybr[y+0][x+3] = qrs + z.ybr[y+1][x+0] = qr + z.ybr[y+1][x+1] = qrs + z.ybr[y+1][x+2] = rs + z.ybr[y+1][x+3] = rss + z.ybr[y+2][x+0] = rs + z.ybr[y+2][x+1] = rss + z.ybr[y+2][x+2] = sss + z.ybr[y+2][x+3] = sss + z.ybr[y+3][x+0] = sss + z.ybr[y+3][x+1] = sss + z.ybr[y+3][x+2] = sss + z.ybr[y+3][x+3] = sss +} + +func predFunc8DC(z *Decoder, y, x int) { + sum := uint32(8) + for i := 0; i < 8; i++ { + sum += uint32(z.ybr[y-1][x+i]) + } + for j := 0; j < 8; j++ { + sum += uint32(z.ybr[y+j][x-1]) + } + avg := uint8(sum / 16) + for j := 0; j < 8; j++ { + for i := 0; i < 8; i++ { + z.ybr[y+j][x+i] = avg + } + } +} + +func predFunc8TM(z *Decoder, y, x int) { + delta0 := -int32(z.ybr[y-1][x-1]) + for j := 0; j < 8; j++ { + delta1 := delta0 + int32(z.ybr[y+j][x-1]) + for i := 0; i < 8; i++ { + delta2 := delta1 + int32(z.ybr[y-1][x+i]) + z.ybr[y+j][x+i] = uint8(clip(delta2, 0, 255)) + } + } +} + +func predFunc8VE(z *Decoder, y, x int) { + for j := 0; j < 8; j++ { + for i := 0; i < 8; i++ { + z.ybr[y+j][x+i] = z.ybr[y-1][x+i] + } + } +} + +func predFunc8HE(z *Decoder, y, x int) { + for j := 0; j < 8; j++ { + for i := 0; i < 8; i++ { + z.ybr[y+j][x+i] = z.ybr[y+j][x-1] + } + } +} + +func predFunc8DCTop(z *Decoder, y, x int) { + sum := uint32(4) + for j := 0; j < 8; j++ { + sum += uint32(z.ybr[y+j][x-1]) + } + avg := uint8(sum / 8) + for j := 0; j < 8; j++ { + for i := 0; i < 8; i++ { + z.ybr[y+j][x+i] = avg + } + } +} + +func predFunc8DCLeft(z *Decoder, y, x int) { + sum := uint32(4) + for i := 0; i < 8; i++ { + sum += uint32(z.ybr[y-1][x+i]) + } + avg := uint8(sum / 8) + for j := 0; j < 8; j++ { + for i := 0; i < 8; i++ { + z.ybr[y+j][x+i] = avg + } + } +} + +func predFunc8DCTopLeft(z *Decoder, y, x int) { + for j := 0; j < 8; j++ { + for i := 0; i < 8; i++ { + z.ybr[y+j][x+i] = 0x80 + } + } +} + +func predFunc16DC(z *Decoder, y, x int) { + sum := uint32(16) + for i := 0; i < 16; i++ { + sum += uint32(z.ybr[y-1][x+i]) + } + for j := 0; j < 16; j++ { + sum += uint32(z.ybr[y+j][x-1]) + } + avg := uint8(sum / 32) + for j := 0; j < 16; j++ { + for i := 0; i < 16; i++ { + z.ybr[y+j][x+i] = avg + } + } +} + +func predFunc16TM(z *Decoder, y, x int) { + delta0 := -int32(z.ybr[y-1][x-1]) + for j := 0; j < 16; j++ { + delta1 := delta0 + int32(z.ybr[y+j][x-1]) + for i := 0; i < 16; i++ { + delta2 := delta1 + int32(z.ybr[y-1][x+i]) + z.ybr[y+j][x+i] = uint8(clip(delta2, 0, 255)) + } + } +} + +func predFunc16VE(z *Decoder, y, x int) { + for j := 0; j < 16; j++ { + for i := 0; i < 16; i++ { + z.ybr[y+j][x+i] = z.ybr[y-1][x+i] + } + } +} + +func predFunc16HE(z *Decoder, y, x int) { + for j := 0; j < 16; j++ { + for i := 0; i < 16; i++ { + z.ybr[y+j][x+i] = z.ybr[y+j][x-1] + } + } +} + +func predFunc16DCTop(z *Decoder, y, x int) { + sum := uint32(8) + for j := 0; j < 16; j++ { + sum += uint32(z.ybr[y+j][x-1]) + } + avg := uint8(sum / 16) + for j := 0; j < 16; j++ { + for i := 0; i < 16; i++ { + z.ybr[y+j][x+i] = avg + } + } +} + +func predFunc16DCLeft(z *Decoder, y, x int) { + sum := uint32(8) + for i := 0; i < 16; i++ { + sum += uint32(z.ybr[y-1][x+i]) + } + avg := uint8(sum / 16) + for j := 0; j < 16; j++ { + for i := 0; i < 16; i++ { + z.ybr[y+j][x+i] = avg + } + } +} + +func predFunc16DCTopLeft(z *Decoder, y, x int) { + for j := 0; j < 16; j++ { + for i := 0; i < 16; i++ { + z.ybr[y+j][x+i] = 0x80 + } + } +} diff --git a/vendor/golang.org/x/image/vp8/quant.go b/vendor/golang.org/x/image/vp8/quant.go new file mode 100644 index 000000000..da4361604 --- /dev/null +++ b/vendor/golang.org/x/image/vp8/quant.go @@ -0,0 +1,98 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package vp8 + +// This file implements parsing the quantization factors. + +// quant are DC/AC quantization factors. +type quant struct { + y1 [2]uint16 + y2 [2]uint16 + uv [2]uint16 +} + +// clip clips x to the range [min, max] inclusive. +func clip(x, min, max int32) int32 { + if x < min { + return min + } + if x > max { + return max + } + return x +} + +// parseQuant parses the quantization factors, as specified in section 9.6. +func (d *Decoder) parseQuant() { + baseQ0 := d.fp.readUint(uniformProb, 7) + dqy1DC := d.fp.readOptionalInt(uniformProb, 4) + const dqy1AC = 0 + dqy2DC := d.fp.readOptionalInt(uniformProb, 4) + dqy2AC := d.fp.readOptionalInt(uniformProb, 4) + dquvDC := d.fp.readOptionalInt(uniformProb, 4) + dquvAC := d.fp.readOptionalInt(uniformProb, 4) + for i := 0; i < nSegment; i++ { + q := int32(baseQ0) + if d.segmentHeader.useSegment { + if d.segmentHeader.relativeDelta { + q += int32(d.segmentHeader.quantizer[i]) + } else { + q = int32(d.segmentHeader.quantizer[i]) + } + } + d.quant[i].y1[0] = dequantTableDC[clip(q+dqy1DC, 0, 127)] + d.quant[i].y1[1] = dequantTableAC[clip(q+dqy1AC, 0, 127)] + d.quant[i].y2[0] = dequantTableDC[clip(q+dqy2DC, 0, 127)] * 2 + d.quant[i].y2[1] = dequantTableAC[clip(q+dqy2AC, 0, 127)] * 155 / 100 + if d.quant[i].y2[1] < 8 { + d.quant[i].y2[1] = 8 + } + // The 117 is not a typo. The dequant_init function in the spec's Reference + // Decoder Source Code (http://tools.ietf.org/html/rfc6386#section-9.6 Page 145) + // says to clamp the LHS value at 132, which is equal to dequantTableDC[117]. + d.quant[i].uv[0] = dequantTableDC[clip(q+dquvDC, 0, 117)] + d.quant[i].uv[1] = dequantTableAC[clip(q+dquvAC, 0, 127)] + } +} + +// The dequantization tables are specified in section 14.1. +var ( + dequantTableDC = [128]uint16{ + 4, 5, 6, 7, 8, 9, 10, 10, + 11, 12, 13, 14, 15, 16, 17, 17, + 18, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 25, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, + 37, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, + 91, 93, 95, 96, 98, 100, 101, 102, + 104, 106, 108, 110, 112, 114, 116, 118, + 122, 124, 126, 128, 130, 132, 134, 136, + 138, 140, 143, 145, 148, 151, 154, 157, + } + dequantTableAC = [128]uint16{ + 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 60, + 62, 64, 66, 68, 70, 72, 74, 76, + 78, 80, 82, 84, 86, 88, 90, 92, + 94, 96, 98, 100, 102, 104, 106, 108, + 110, 112, 114, 116, 119, 122, 125, 128, + 131, 134, 137, 140, 143, 146, 149, 152, + 155, 158, 161, 164, 167, 170, 173, 177, + 181, 185, 189, 193, 197, 201, 205, 209, + 213, 217, 221, 225, 229, 234, 239, 245, + 249, 254, 259, 264, 269, 274, 279, 284, + } +) diff --git a/vendor/golang.org/x/image/vp8/reconstruct.go b/vendor/golang.org/x/image/vp8/reconstruct.go new file mode 100644 index 000000000..c1cc4b532 --- /dev/null +++ b/vendor/golang.org/x/image/vp8/reconstruct.go @@ -0,0 +1,442 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package vp8 + +// This file implements decoding DCT/WHT residual coefficients and +// reconstructing YCbCr data equal to predicted values plus residuals. +// +// There are 1*16*16 + 2*8*8 + 1*4*4 coefficients per macroblock: +// - 1*16*16 luma DCT coefficients, +// - 2*8*8 chroma DCT coefficients, and +// - 1*4*4 luma WHT coefficients. +// Coefficients are read in lots of 16, and the later coefficients in each lot +// are often zero. +// +// The YCbCr data consists of 1*16*16 luma values and 2*8*8 chroma values, +// plus previously decoded values along the top and left borders. The combined +// values are laid out as a [1+16+1+8][32]uint8 so that vertically adjacent +// samples are 32 bytes apart. In detail, the layout is: +// +// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +// . . . . . . . a b b b b b b b b b b b b b b b b c c c c . . . . 0 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 1 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 2 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 3 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y c c c c . . . . 4 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 5 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 6 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 7 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y c c c c . . . . 8 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 9 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 10 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 11 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y c c c c . . . . 12 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 13 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 14 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 15 +// . . . . . . . d Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y . . . . . . . . 16 +// . . . . . . . e f f f f f f f f . . . . . . . g h h h h h h h h 17 +// . . . . . . . i B B B B B B B B . . . . . . . j R R R R R R R R 18 +// . . . . . . . i B B B B B B B B . . . . . . . j R R R R R R R R 19 +// . . . . . . . i B B B B B B B B . . . . . . . j R R R R R R R R 20 +// . . . . . . . i B B B B B B B B . . . . . . . j R R R R R R R R 21 +// . . . . . . . i B B B B B B B B . . . . . . . j R R R R R R R R 22 +// . . . . . . . i B B B B B B B B . . . . . . . j R R R R R R R R 23 +// . . . . . . . i B B B B B B B B . . . . . . . j R R R R R R R R 24 +// . . . . . . . i B B B B B B B B . . . . . . . j R R R R R R R R 25 +// +// Y, B and R are the reconstructed luma (Y) and chroma (B, R) values. +// The Y values are predicted (either as one 16x16 region or 16 4x4 regions) +// based on the row above's Y values (some combination of {abc} or {dYC}) and +// the column left's Y values (either {ad} or {bY}). Similarly, B and R values +// are predicted on the row above and column left of their respective 8x8 +// region: {efi} for B, {ghj} for R. +// +// For uppermost macroblocks (i.e. those with mby == 0), the {abcefgh} values +// are initialized to 0x81. Otherwise, they are copied from the bottom row of +// the macroblock above. The {c} values are then duplicated from row 0 to rows +// 4, 8 and 12 of the ybr workspace. +// Similarly, for leftmost macroblocks (i.e. those with mbx == 0), the {adeigj} +// values are initialized to 0x7f. Otherwise, they are copied from the right +// column of the macroblock to the left. +// For the top-left macroblock (with mby == 0 && mbx == 0), {aeg} is 0x81. +// +// When moving from one macroblock to the next horizontally, the {adeigj} +// values can simply be copied from the workspace to itself, shifted by 8 or +// 16 columns. When moving from one macroblock to the next vertically, +// filtering can occur and hence the row values have to be copied from the +// post-filtered image instead of the pre-filtered workspace. + +const ( + bCoeffBase = 1*16*16 + 0*8*8 + rCoeffBase = 1*16*16 + 1*8*8 + whtCoeffBase = 1*16*16 + 2*8*8 +) + +const ( + ybrYX = 8 + ybrYY = 1 + ybrBX = 8 + ybrBY = 18 + ybrRX = 24 + ybrRY = 18 +) + +// prepareYBR prepares the {abcdefghij} elements of ybr. +func (d *Decoder) prepareYBR(mbx, mby int) { + if mbx == 0 { + for y := 0; y < 17; y++ { + d.ybr[y][7] = 0x81 + } + for y := 17; y < 26; y++ { + d.ybr[y][7] = 0x81 + d.ybr[y][23] = 0x81 + } + } else { + for y := 0; y < 17; y++ { + d.ybr[y][7] = d.ybr[y][7+16] + } + for y := 17; y < 26; y++ { + d.ybr[y][7] = d.ybr[y][15] + d.ybr[y][23] = d.ybr[y][31] + } + } + if mby == 0 { + for x := 7; x < 28; x++ { + d.ybr[0][x] = 0x7f + } + for x := 7; x < 16; x++ { + d.ybr[17][x] = 0x7f + } + for x := 23; x < 32; x++ { + d.ybr[17][x] = 0x7f + } + } else { + for i := 0; i < 16; i++ { + d.ybr[0][8+i] = d.img.Y[(16*mby-1)*d.img.YStride+16*mbx+i] + } + for i := 0; i < 8; i++ { + d.ybr[17][8+i] = d.img.Cb[(8*mby-1)*d.img.CStride+8*mbx+i] + } + for i := 0; i < 8; i++ { + d.ybr[17][24+i] = d.img.Cr[(8*mby-1)*d.img.CStride+8*mbx+i] + } + if mbx == d.mbw-1 { + for i := 16; i < 20; i++ { + d.ybr[0][8+i] = d.img.Y[(16*mby-1)*d.img.YStride+16*mbx+15] + } + } else { + for i := 16; i < 20; i++ { + d.ybr[0][8+i] = d.img.Y[(16*mby-1)*d.img.YStride+16*mbx+i] + } + } + } + for y := 4; y < 16; y += 4 { + d.ybr[y][24] = d.ybr[0][24] + d.ybr[y][25] = d.ybr[0][25] + d.ybr[y][26] = d.ybr[0][26] + d.ybr[y][27] = d.ybr[0][27] + } +} + +// btou converts a bool to a 0/1 value. +func btou(b bool) uint8 { + if b { + return 1 + } + return 0 +} + +// pack packs four 0/1 values into four bits of a uint32. +func pack(x [4]uint8, shift int) uint32 { + u := uint32(x[0])<<0 | uint32(x[1])<<1 | uint32(x[2])<<2 | uint32(x[3])<<3 + return u << uint(shift) +} + +// unpack unpacks four 0/1 values from a four-bit value. +var unpack = [16][4]uint8{ + {0, 0, 0, 0}, + {1, 0, 0, 0}, + {0, 1, 0, 0}, + {1, 1, 0, 0}, + {0, 0, 1, 0}, + {1, 0, 1, 0}, + {0, 1, 1, 0}, + {1, 1, 1, 0}, + {0, 0, 0, 1}, + {1, 0, 0, 1}, + {0, 1, 0, 1}, + {1, 1, 0, 1}, + {0, 0, 1, 1}, + {1, 0, 1, 1}, + {0, 1, 1, 1}, + {1, 1, 1, 1}, +} + +var ( + // The mapping from 4x4 region position to band is specified in section 13.3. + bands = [17]uint8{0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 0} + // Category probabilties are specified in section 13.2. + // Decoding categories 1 and 2 are done inline. + cat3456 = [4][12]uint8{ + {173, 148, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {176, 155, 140, 135, 0, 0, 0, 0, 0, 0, 0, 0}, + {180, 157, 141, 134, 130, 0, 0, 0, 0, 0, 0, 0}, + {254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0}, + } + // The zigzag order is: + // 0 1 5 6 + // 2 4 7 12 + // 3 8 11 13 + // 9 10 14 15 + zigzag = [16]uint8{0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15} +) + +// parseResiduals4 parses a 4x4 region of residual coefficients, as specified +// in section 13.3, and returns a 0/1 value indicating whether there was at +// least one non-zero coefficient. +// r is the partition to read bits from. +// plane and context describe which token probability table to use. context is +// either 0, 1 or 2, and equals how many of the macroblock left and macroblock +// above have non-zero coefficients. +// quant are the DC/AC quantization factors. +// skipFirstCoeff is whether the DC coefficient has already been parsed. +// coeffBase is the base index of d.coeff to write to. +func (d *Decoder) parseResiduals4(r *partition, plane int, context uint8, quant [2]uint16, skipFirstCoeff bool, coeffBase int) uint8 { + prob, n := &d.tokenProb[plane], 0 + if skipFirstCoeff { + n = 1 + } + p := prob[bands[n]][context] + if !r.readBit(p[0]) { + return 0 + } + for n != 16 { + n++ + if !r.readBit(p[1]) { + p = prob[bands[n]][0] + continue + } + var v uint32 + if !r.readBit(p[2]) { + v = 1 + p = prob[bands[n]][1] + } else { + if !r.readBit(p[3]) { + if !r.readBit(p[4]) { + v = 2 + } else { + v = 3 + r.readUint(p[5], 1) + } + } else if !r.readBit(p[6]) { + if !r.readBit(p[7]) { + // Category 1. + v = 5 + r.readUint(159, 1) + } else { + // Category 2. + v = 7 + 2*r.readUint(165, 1) + r.readUint(145, 1) + } + } else { + // Categories 3, 4, 5 or 6. + b1 := r.readUint(p[8], 1) + b0 := r.readUint(p[9+b1], 1) + cat := 2*b1 + b0 + tab := &cat3456[cat] + v = 0 + for i := 0; tab[i] != 0; i++ { + v *= 2 + v += r.readUint(tab[i], 1) + } + v += 3 + (8 << cat) + } + p = prob[bands[n]][2] + } + z := zigzag[n-1] + c := int32(v) * int32(quant[btou(z > 0)]) + if r.readBit(uniformProb) { + c = -c + } + d.coeff[coeffBase+int(z)] = int16(c) + if n == 16 || !r.readBit(p[0]) { + return 1 + } + } + return 1 +} + +// parseResiduals parses the residuals and returns whether inner loop filtering +// should be skipped for this macroblock. +func (d *Decoder) parseResiduals(mbx, mby int) (skip bool) { + partition := &d.op[mby&(d.nOP-1)] + plane := planeY1SansY2 + quant := &d.quant[d.segment] + + // Parse the DC coefficient of each 4x4 luma region. + if d.usePredY16 { + nz := d.parseResiduals4(partition, planeY2, d.leftMB.nzY16+d.upMB[mbx].nzY16, quant.y2, false, whtCoeffBase) + d.leftMB.nzY16 = nz + d.upMB[mbx].nzY16 = nz + d.inverseWHT16() + plane = planeY1WithY2 + } + + var ( + nzDC, nzAC [4]uint8 + nzDCMask, nzACMask uint32 + coeffBase int + ) + + // Parse the luma coefficients. + lnz := unpack[d.leftMB.nzMask&0x0f] + unz := unpack[d.upMB[mbx].nzMask&0x0f] + for y := 0; y < 4; y++ { + nz := lnz[y] + for x := 0; x < 4; x++ { + nz = d.parseResiduals4(partition, plane, nz+unz[x], quant.y1, d.usePredY16, coeffBase) + unz[x] = nz + nzAC[x] = nz + nzDC[x] = btou(d.coeff[coeffBase] != 0) + coeffBase += 16 + } + lnz[y] = nz + nzDCMask |= pack(nzDC, y*4) + nzACMask |= pack(nzAC, y*4) + } + lnzMask := pack(lnz, 0) + unzMask := pack(unz, 0) + + // Parse the chroma coefficients. + lnz = unpack[d.leftMB.nzMask>>4] + unz = unpack[d.upMB[mbx].nzMask>>4] + for c := 0; c < 4; c += 2 { + for y := 0; y < 2; y++ { + nz := lnz[y+c] + for x := 0; x < 2; x++ { + nz = d.parseResiduals4(partition, planeUV, nz+unz[x+c], quant.uv, false, coeffBase) + unz[x+c] = nz + nzAC[y*2+x] = nz + nzDC[y*2+x] = btou(d.coeff[coeffBase] != 0) + coeffBase += 16 + } + lnz[y+c] = nz + } + nzDCMask |= pack(nzDC, 16+c*2) + nzACMask |= pack(nzAC, 16+c*2) + } + lnzMask |= pack(lnz, 4) + unzMask |= pack(unz, 4) + + // Save decoder state. + d.leftMB.nzMask = uint8(lnzMask) + d.upMB[mbx].nzMask = uint8(unzMask) + d.nzDCMask = nzDCMask + d.nzACMask = nzACMask + + // Section 15.1 of the spec says that "Steps 2 and 4 [of the loop filter] + // are skipped... [if] there is no DCT coefficient coded for the whole + // macroblock." + return nzDCMask == 0 && nzACMask == 0 +} + +// reconstructMacroblock applies the predictor functions and adds the inverse- +// DCT transformed residuals to recover the YCbCr data. +func (d *Decoder) reconstructMacroblock(mbx, mby int) { + if d.usePredY16 { + p := checkTopLeftPred(mbx, mby, d.predY16) + predFunc16[p](d, 1, 8) + for j := 0; j < 4; j++ { + for i := 0; i < 4; i++ { + n := 4*j + i + y := 4*j + 1 + x := 4*i + 8 + mask := uint32(1) << uint(n) + if d.nzACMask&mask != 0 { + d.inverseDCT4(y, x, 16*n) + } else if d.nzDCMask&mask != 0 { + d.inverseDCT4DCOnly(y, x, 16*n) + } + } + } + } else { + for j := 0; j < 4; j++ { + for i := 0; i < 4; i++ { + n := 4*j + i + y := 4*j + 1 + x := 4*i + 8 + predFunc4[d.predY4[j][i]](d, y, x) + mask := uint32(1) << uint(n) + if d.nzACMask&mask != 0 { + d.inverseDCT4(y, x, 16*n) + } else if d.nzDCMask&mask != 0 { + d.inverseDCT4DCOnly(y, x, 16*n) + } + } + } + } + p := checkTopLeftPred(mbx, mby, d.predC8) + predFunc8[p](d, ybrBY, ybrBX) + if d.nzACMask&0x0f0000 != 0 { + d.inverseDCT8(ybrBY, ybrBX, bCoeffBase) + } else if d.nzDCMask&0x0f0000 != 0 { + d.inverseDCT8DCOnly(ybrBY, ybrBX, bCoeffBase) + } + predFunc8[p](d, ybrRY, ybrRX) + if d.nzACMask&0xf00000 != 0 { + d.inverseDCT8(ybrRY, ybrRX, rCoeffBase) + } else if d.nzDCMask&0xf00000 != 0 { + d.inverseDCT8DCOnly(ybrRY, ybrRX, rCoeffBase) + } +} + +// reconstruct reconstructs one macroblock and returns whether inner loop +// filtering should be skipped for it. +func (d *Decoder) reconstruct(mbx, mby int) (skip bool) { + if d.segmentHeader.updateMap { + if !d.fp.readBit(d.segmentHeader.prob[0]) { + d.segment = int(d.fp.readUint(d.segmentHeader.prob[1], 1)) + } else { + d.segment = int(d.fp.readUint(d.segmentHeader.prob[2], 1)) + 2 + } + } + if d.useSkipProb { + skip = d.fp.readBit(d.skipProb) + } + // Prepare the workspace. + for i := range d.coeff { + d.coeff[i] = 0 + } + d.prepareYBR(mbx, mby) + // Parse the predictor modes. + d.usePredY16 = d.fp.readBit(145) + if d.usePredY16 { + d.parsePredModeY16(mbx) + } else { + d.parsePredModeY4(mbx) + } + d.parsePredModeC8() + // Parse the residuals. + if !skip { + skip = d.parseResiduals(mbx, mby) + } else { + if d.usePredY16 { + d.leftMB.nzY16 = 0 + d.upMB[mbx].nzY16 = 0 + } + d.leftMB.nzMask = 0 + d.upMB[mbx].nzMask = 0 + d.nzDCMask = 0 + d.nzACMask = 0 + } + // Reconstruct the YCbCr data and copy it to the image. + d.reconstructMacroblock(mbx, mby) + for i, y := (mby*d.img.YStride+mbx)*16, 0; y < 16; i, y = i+d.img.YStride, y+1 { + copy(d.img.Y[i:i+16], d.ybr[ybrYY+y][ybrYX:ybrYX+16]) + } + for i, y := (mby*d.img.CStride+mbx)*8, 0; y < 8; i, y = i+d.img.CStride, y+1 { + copy(d.img.Cb[i:i+8], d.ybr[ybrBY+y][ybrBX:ybrBX+8]) + copy(d.img.Cr[i:i+8], d.ybr[ybrRY+y][ybrRX:ybrRX+8]) + } + return skip +} diff --git a/vendor/golang.org/x/image/vp8/token.go b/vendor/golang.org/x/image/vp8/token.go new file mode 100644 index 000000000..da99cf0f9 --- /dev/null +++ b/vendor/golang.org/x/image/vp8/token.go @@ -0,0 +1,381 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package vp8 + +// This file contains token probabilities for decoding DCT/WHT coefficients, as +// specified in chapter 13. + +func (d *Decoder) parseTokenProb() { + for i := range d.tokenProb { + for j := range d.tokenProb[i] { + for k := range d.tokenProb[i][j] { + for l := range d.tokenProb[i][j][k] { + if d.fp.readBit(tokenProbUpdateProb[i][j][k][l]) { + d.tokenProb[i][j][k][l] = uint8(d.fp.readUint(uniformProb, 8)) + } + } + } + } + } +} + +// The plane enumeration is specified in section 13.3. +const ( + planeY1WithY2 = iota + planeY2 + planeUV + planeY1SansY2 + nPlane +) + +const ( + nBand = 8 + nContext = 3 + nProb = 11 +) + +// Token probability update probabilities are specified in section 13.4. +var tokenProbUpdateProb = [nPlane][nBand][nContext][nProb]uint8{ + { + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255}, + {249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255}, + {234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255}, + {250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255}, + {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + }, + { + { + {217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255}, + {234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255}, + }, + { + {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + }, + { + { + {186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255}, + {234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255}, + {251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255}, + }, + { + {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + }, + { + { + {248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255}, + {248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255}, + {248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + }, +} + +// Default token probabilities are specified in section 13.5. +var defaultTokenProb = [nPlane][nBand][nContext][nProb]uint8{ + { + { + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + { + {253, 136, 254, 255, 228, 219, 128, 128, 128, 128, 128}, + {189, 129, 242, 255, 227, 213, 255, 219, 128, 128, 128}, + {106, 126, 227, 252, 214, 209, 255, 255, 128, 128, 128}, + }, + { + {1, 98, 248, 255, 236, 226, 255, 255, 128, 128, 128}, + {181, 133, 238, 254, 221, 234, 255, 154, 128, 128, 128}, + {78, 134, 202, 247, 198, 180, 255, 219, 128, 128, 128}, + }, + { + {1, 185, 249, 255, 243, 255, 128, 128, 128, 128, 128}, + {184, 150, 247, 255, 236, 224, 128, 128, 128, 128, 128}, + {77, 110, 216, 255, 236, 230, 128, 128, 128, 128, 128}, + }, + { + {1, 101, 251, 255, 241, 255, 128, 128, 128, 128, 128}, + {170, 139, 241, 252, 236, 209, 255, 255, 128, 128, 128}, + {37, 116, 196, 243, 228, 255, 255, 255, 128, 128, 128}, + }, + { + {1, 204, 254, 255, 245, 255, 128, 128, 128, 128, 128}, + {207, 160, 250, 255, 238, 128, 128, 128, 128, 128, 128}, + {102, 103, 231, 255, 211, 171, 128, 128, 128, 128, 128}, + }, + { + {1, 152, 252, 255, 240, 255, 128, 128, 128, 128, 128}, + {177, 135, 243, 255, 234, 225, 128, 128, 128, 128, 128}, + {80, 129, 211, 255, 194, 224, 128, 128, 128, 128, 128}, + }, + { + {1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {246, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {255, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + }, + { + { + {198, 35, 237, 223, 193, 187, 162, 160, 145, 155, 62}, + {131, 45, 198, 221, 172, 176, 220, 157, 252, 221, 1}, + {68, 47, 146, 208, 149, 167, 221, 162, 255, 223, 128}, + }, + { + {1, 149, 241, 255, 221, 224, 255, 255, 128, 128, 128}, + {184, 141, 234, 253, 222, 220, 255, 199, 128, 128, 128}, + {81, 99, 181, 242, 176, 190, 249, 202, 255, 255, 128}, + }, + { + {1, 129, 232, 253, 214, 197, 242, 196, 255, 255, 128}, + {99, 121, 210, 250, 201, 198, 255, 202, 128, 128, 128}, + {23, 91, 163, 242, 170, 187, 247, 210, 255, 255, 128}, + }, + { + {1, 200, 246, 255, 234, 255, 128, 128, 128, 128, 128}, + {109, 178, 241, 255, 231, 245, 255, 255, 128, 128, 128}, + {44, 130, 201, 253, 205, 192, 255, 255, 128, 128, 128}, + }, + { + {1, 132, 239, 251, 219, 209, 255, 165, 128, 128, 128}, + {94, 136, 225, 251, 218, 190, 255, 255, 128, 128, 128}, + {22, 100, 174, 245, 186, 161, 255, 199, 128, 128, 128}, + }, + { + {1, 182, 249, 255, 232, 235, 128, 128, 128, 128, 128}, + {124, 143, 241, 255, 227, 234, 128, 128, 128, 128, 128}, + {35, 77, 181, 251, 193, 211, 255, 205, 128, 128, 128}, + }, + { + {1, 157, 247, 255, 236, 231, 255, 255, 128, 128, 128}, + {121, 141, 235, 255, 225, 227, 255, 255, 128, 128, 128}, + {45, 99, 188, 251, 195, 217, 255, 224, 128, 128, 128}, + }, + { + {1, 1, 251, 255, 213, 255, 128, 128, 128, 128, 128}, + {203, 1, 248, 255, 255, 128, 128, 128, 128, 128, 128}, + {137, 1, 177, 255, 224, 255, 128, 128, 128, 128, 128}, + }, + }, + { + { + {253, 9, 248, 251, 207, 208, 255, 192, 128, 128, 128}, + {175, 13, 224, 243, 193, 185, 249, 198, 255, 255, 128}, + {73, 17, 171, 221, 161, 179, 236, 167, 255, 234, 128}, + }, + { + {1, 95, 247, 253, 212, 183, 255, 255, 128, 128, 128}, + {239, 90, 244, 250, 211, 209, 255, 255, 128, 128, 128}, + {155, 77, 195, 248, 188, 195, 255, 255, 128, 128, 128}, + }, + { + {1, 24, 239, 251, 218, 219, 255, 205, 128, 128, 128}, + {201, 51, 219, 255, 196, 186, 128, 128, 128, 128, 128}, + {69, 46, 190, 239, 201, 218, 255, 228, 128, 128, 128}, + }, + { + {1, 191, 251, 255, 255, 128, 128, 128, 128, 128, 128}, + {223, 165, 249, 255, 213, 255, 128, 128, 128, 128, 128}, + {141, 124, 248, 255, 255, 128, 128, 128, 128, 128, 128}, + }, + { + {1, 16, 248, 255, 255, 128, 128, 128, 128, 128, 128}, + {190, 36, 230, 255, 236, 255, 128, 128, 128, 128, 128}, + {149, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + { + {1, 226, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {247, 192, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {240, 128, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + { + {1, 134, 252, 255, 255, 128, 128, 128, 128, 128, 128}, + {213, 62, 250, 255, 255, 128, 128, 128, 128, 128, 128}, + {55, 93, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + { + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + }, + { + { + {202, 24, 213, 235, 186, 191, 220, 160, 240, 175, 255}, + {126, 38, 182, 232, 169, 184, 228, 174, 255, 187, 128}, + {61, 46, 138, 219, 151, 178, 240, 170, 255, 216, 128}, + }, + { + {1, 112, 230, 250, 199, 191, 247, 159, 255, 255, 128}, + {166, 109, 228, 252, 211, 215, 255, 174, 128, 128, 128}, + {39, 77, 162, 232, 172, 180, 245, 178, 255, 255, 128}, + }, + { + {1, 52, 220, 246, 198, 199, 249, 220, 255, 255, 128}, + {124, 74, 191, 243, 183, 193, 250, 221, 255, 255, 128}, + {24, 71, 130, 219, 154, 170, 243, 182, 255, 255, 128}, + }, + { + {1, 182, 225, 249, 219, 240, 255, 224, 128, 128, 128}, + {149, 150, 226, 252, 216, 205, 255, 171, 128, 128, 128}, + {28, 108, 170, 242, 183, 194, 254, 223, 255, 255, 128}, + }, + { + {1, 81, 230, 252, 204, 203, 255, 192, 128, 128, 128}, + {123, 102, 209, 247, 188, 196, 255, 233, 128, 128, 128}, + {20, 95, 153, 243, 164, 173, 255, 203, 128, 128, 128}, + }, + { + {1, 222, 248, 255, 216, 213, 128, 128, 128, 128, 128}, + {168, 175, 246, 252, 235, 205, 255, 255, 128, 128, 128}, + {47, 116, 215, 255, 211, 212, 255, 255, 128, 128, 128}, + }, + { + {1, 121, 236, 253, 212, 214, 255, 255, 128, 128, 128}, + {141, 84, 213, 252, 201, 202, 255, 219, 128, 128, 128}, + {42, 80, 160, 240, 162, 185, 255, 205, 128, 128, 128}, + }, + { + {1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {244, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {238, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + }, +} diff --git a/vendor/golang.org/x/image/vp8l/decode.go b/vendor/golang.org/x/image/vp8l/decode.go new file mode 100644 index 000000000..431948701 --- /dev/null +++ b/vendor/golang.org/x/image/vp8l/decode.go @@ -0,0 +1,603 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package vp8l implements a decoder for the VP8L lossless image format. +// +// The VP8L specification is at: +// https://developers.google.com/speed/webp/docs/riff_container +package vp8l // import "golang.org/x/image/vp8l" + +import ( + "bufio" + "errors" + "image" + "image/color" + "io" +) + +var ( + errInvalidCodeLengths = errors.New("vp8l: invalid code lengths") + errInvalidHuffmanTree = errors.New("vp8l: invalid Huffman tree") +) + +// colorCacheMultiplier is the multiplier used for the color cache hash +// function, specified in section 4.2.3. +const colorCacheMultiplier = 0x1e35a7bd + +// distanceMapTable is the look-up table for distanceMap. +var distanceMapTable = [120]uint8{ + 0x18, 0x07, 0x17, 0x19, 0x28, 0x06, 0x27, 0x29, 0x16, 0x1a, + 0x26, 0x2a, 0x38, 0x05, 0x37, 0x39, 0x15, 0x1b, 0x36, 0x3a, + 0x25, 0x2b, 0x48, 0x04, 0x47, 0x49, 0x14, 0x1c, 0x35, 0x3b, + 0x46, 0x4a, 0x24, 0x2c, 0x58, 0x45, 0x4b, 0x34, 0x3c, 0x03, + 0x57, 0x59, 0x13, 0x1d, 0x56, 0x5a, 0x23, 0x2d, 0x44, 0x4c, + 0x55, 0x5b, 0x33, 0x3d, 0x68, 0x02, 0x67, 0x69, 0x12, 0x1e, + 0x66, 0x6a, 0x22, 0x2e, 0x54, 0x5c, 0x43, 0x4d, 0x65, 0x6b, + 0x32, 0x3e, 0x78, 0x01, 0x77, 0x79, 0x53, 0x5d, 0x11, 0x1f, + 0x64, 0x6c, 0x42, 0x4e, 0x76, 0x7a, 0x21, 0x2f, 0x75, 0x7b, + 0x31, 0x3f, 0x63, 0x6d, 0x52, 0x5e, 0x00, 0x74, 0x7c, 0x41, + 0x4f, 0x10, 0x20, 0x62, 0x6e, 0x30, 0x73, 0x7d, 0x51, 0x5f, + 0x40, 0x72, 0x7e, 0x61, 0x6f, 0x50, 0x71, 0x7f, 0x60, 0x70, +} + +// distanceMap maps a LZ77 backwards reference distance to a two-dimensional +// pixel offset, specified in section 4.2.2. +func distanceMap(w int32, code uint32) int32 { + if int32(code) > int32(len(distanceMapTable)) { + return int32(code) - int32(len(distanceMapTable)) + } + distCode := int32(distanceMapTable[code-1]) + yOffset := distCode >> 4 + xOffset := 8 - distCode&0xf + if d := yOffset*w + xOffset; d >= 1 { + return d + } + return 1 +} + +// decoder holds the bit-stream for a VP8L image. +type decoder struct { + r io.ByteReader + bits uint32 + nBits uint32 +} + +// read reads the next n bits from the decoder's bit-stream. +func (d *decoder) read(n uint32) (uint32, error) { + for d.nBits < n { + c, err := d.r.ReadByte() + if err != nil { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + return 0, err + } + d.bits |= uint32(c) << d.nBits + d.nBits += 8 + } + u := d.bits & (1<>= n + d.nBits -= n + return u, nil +} + +// decodeTransform decodes the next transform and the width of the image after +// transformation (or equivalently, before inverse transformation), specified +// in section 3. +func (d *decoder) decodeTransform(w int32, h int32) (t transform, newWidth int32, err error) { + t.oldWidth = w + t.transformType, err = d.read(2) + if err != nil { + return transform{}, 0, err + } + switch t.transformType { + case transformTypePredictor, transformTypeCrossColor: + t.bits, err = d.read(3) + if err != nil { + return transform{}, 0, err + } + t.bits += 2 + t.pix, err = d.decodePix(nTiles(w, t.bits), nTiles(h, t.bits), 0, false) + if err != nil { + return transform{}, 0, err + } + case transformTypeSubtractGreen: + // No-op. + case transformTypeColorIndexing: + nColors, err := d.read(8) + if err != nil { + return transform{}, 0, err + } + nColors++ + t.bits = 0 + switch { + case nColors <= 2: + t.bits = 3 + case nColors <= 4: + t.bits = 2 + case nColors <= 16: + t.bits = 1 + } + w = nTiles(w, t.bits) + pix, err := d.decodePix(int32(nColors), 1, 4*256, false) + if err != nil { + return transform{}, 0, err + } + for p := 4; p < len(pix); p += 4 { + pix[p+0] += pix[p-4] + pix[p+1] += pix[p-3] + pix[p+2] += pix[p-2] + pix[p+3] += pix[p-1] + } + // The spec says that "if the index is equal or larger than color_table_size, + // the argb color value should be set to 0x00000000 (transparent black)." + // We re-slice up to 256 4-byte pixels. + t.pix = pix[:4*256] + } + return t, w, nil +} + +// repeatsCodeLength is the minimum code length for repeated codes. +const repeatsCodeLength = 16 + +// These magic numbers are specified at the end of section 5.2.2. +// The 3-length arrays apply to code lengths >= repeatsCodeLength. +var ( + codeLengthCodeOrder = [19]uint8{ + 17, 18, 0, 1, 2, 3, 4, 5, 16, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + } + repeatBits = [3]uint8{2, 3, 7} + repeatOffsets = [3]uint8{3, 3, 11} +) + +// decodeCodeLengths decodes a Huffman tree's code lengths which are themselves +// encoded via a Huffman tree, specified in section 5.2.2. +func (d *decoder) decodeCodeLengths(dst []uint32, codeLengthCodeLengths []uint32) error { + h := hTree{} + if err := h.build(codeLengthCodeLengths); err != nil { + return err + } + + maxSymbol := len(dst) + useLength, err := d.read(1) + if err != nil { + return err + } + if useLength != 0 { + n, err := d.read(3) + if err != nil { + return err + } + n = 2 + 2*n + ms, err := d.read(n) + if err != nil { + return err + } + maxSymbol = int(ms) + 2 + if maxSymbol > len(dst) { + return errInvalidCodeLengths + } + } + + // The spec says that "if code 16 [meaning repeat] is used before + // a non-zero value has been emitted, a value of 8 is repeated." + prevCodeLength := uint32(8) + + for symbol := 0; symbol < len(dst); { + if maxSymbol == 0 { + break + } + maxSymbol-- + codeLength, err := h.next(d) + if err != nil { + return err + } + if codeLength < repeatsCodeLength { + dst[symbol] = codeLength + symbol++ + if codeLength != 0 { + prevCodeLength = codeLength + } + continue + } + + repeat, err := d.read(uint32(repeatBits[codeLength-repeatsCodeLength])) + if err != nil { + return err + } + repeat += uint32(repeatOffsets[codeLength-repeatsCodeLength]) + if symbol+int(repeat) > len(dst) { + return errInvalidCodeLengths + } + // A code length of 16 repeats the previous non-zero code. + // A code length of 17 or 18 repeats zeroes. + cl := uint32(0) + if codeLength == 16 { + cl = prevCodeLength + } + for ; repeat > 0; repeat-- { + dst[symbol] = cl + symbol++ + } + } + return nil +} + +// decodeHuffmanTree decodes a Huffman tree into h. +func (d *decoder) decodeHuffmanTree(h *hTree, alphabetSize uint32) error { + useSimple, err := d.read(1) + if err != nil { + return err + } + if useSimple != 0 { + nSymbols, err := d.read(1) + if err != nil { + return err + } + nSymbols++ + firstSymbolLengthCode, err := d.read(1) + if err != nil { + return err + } + firstSymbolLengthCode = 7*firstSymbolLengthCode + 1 + var symbols [2]uint32 + symbols[0], err = d.read(firstSymbolLengthCode) + if err != nil { + return err + } + if nSymbols == 2 { + symbols[1], err = d.read(8) + if err != nil { + return err + } + } + return h.buildSimple(nSymbols, symbols, alphabetSize) + } + + nCodes, err := d.read(4) + if err != nil { + return err + } + nCodes += 4 + if int(nCodes) > len(codeLengthCodeOrder) { + return errInvalidHuffmanTree + } + codeLengthCodeLengths := [len(codeLengthCodeOrder)]uint32{} + for i := uint32(0); i < nCodes; i++ { + codeLengthCodeLengths[codeLengthCodeOrder[i]], err = d.read(3) + if err != nil { + return err + } + } + codeLengths := make([]uint32, alphabetSize) + if err = d.decodeCodeLengths(codeLengths, codeLengthCodeLengths[:]); err != nil { + return err + } + return h.build(codeLengths) +} + +const ( + huffGreen = 0 + huffRed = 1 + huffBlue = 2 + huffAlpha = 3 + huffDistance = 4 + nHuff = 5 +) + +// hGroup is an array of 5 Huffman trees. +type hGroup [nHuff]hTree + +// decodeHuffmanGroups decodes the one or more hGroups used to decode the pixel +// data. If one hGroup is used for the entire image, then hPix and hBits will +// be zero. If more than one hGroup is used, then hPix contains the meta-image +// that maps tiles to hGroup index, and hBits contains the log-2 tile size. +func (d *decoder) decodeHuffmanGroups(w int32, h int32, topLevel bool, ccBits uint32) ( + hGroups []hGroup, hPix []byte, hBits uint32, err error) { + + maxHGroupIndex := 0 + if topLevel { + useMeta, err := d.read(1) + if err != nil { + return nil, nil, 0, err + } + if useMeta != 0 { + hBits, err = d.read(3) + if err != nil { + return nil, nil, 0, err + } + hBits += 2 + hPix, err = d.decodePix(nTiles(w, hBits), nTiles(h, hBits), 0, false) + if err != nil { + return nil, nil, 0, err + } + for p := 0; p < len(hPix); p += 4 { + i := int(hPix[p])<<8 | int(hPix[p+1]) + if maxHGroupIndex < i { + maxHGroupIndex = i + } + } + } + } + hGroups = make([]hGroup, maxHGroupIndex+1) + for i := range hGroups { + for j, alphabetSize := range alphabetSizes { + if j == 0 && ccBits > 0 { + alphabetSize += 1 << ccBits + } + if err := d.decodeHuffmanTree(&hGroups[i][j], alphabetSize); err != nil { + return nil, nil, 0, err + } + } + } + return hGroups, hPix, hBits, nil +} + +const ( + nLiteralCodes = 256 + nLengthCodes = 24 + nDistanceCodes = 40 +) + +var alphabetSizes = [nHuff]uint32{ + nLiteralCodes + nLengthCodes, + nLiteralCodes, + nLiteralCodes, + nLiteralCodes, + nDistanceCodes, +} + +// decodePix decodes pixel data, specified in section 5.2.2. +func (d *decoder) decodePix(w int32, h int32, minCap int32, topLevel bool) ([]byte, error) { + // Decode the color cache parameters. + ccBits, ccShift, ccEntries := uint32(0), uint32(0), ([]uint32)(nil) + useColorCache, err := d.read(1) + if err != nil { + return nil, err + } + if useColorCache != 0 { + ccBits, err = d.read(4) + if err != nil { + return nil, err + } + if ccBits < 1 || 11 < ccBits { + return nil, errors.New("vp8l: invalid color cache parameters") + } + ccShift = 32 - ccBits + ccEntries = make([]uint32, 1<>hBits) + (x >> hBits)) + hg = &hGroups[uint32(hPix[i])<<8|uint32(hPix[i+1])] + } + + green, err := hg[huffGreen].next(d) + if err != nil { + return nil, err + } + switch { + case green < nLiteralCodes: + // We have a literal pixel. + red, err := hg[huffRed].next(d) + if err != nil { + return nil, err + } + blue, err := hg[huffBlue].next(d) + if err != nil { + return nil, err + } + alpha, err := hg[huffAlpha].next(d) + if err != nil { + return nil, err + } + pix[p+0] = uint8(red) + pix[p+1] = uint8(green) + pix[p+2] = uint8(blue) + pix[p+3] = uint8(alpha) + p += 4 + + x++ + if x == w { + x, y = 0, y+1 + } + lookupHG = hMask != 0 && x&hMask == 0 + + case green < nLiteralCodes+nLengthCodes: + // We have a LZ77 backwards reference. + length, err := d.lz77Param(green - nLiteralCodes) + if err != nil { + return nil, err + } + distSym, err := hg[huffDistance].next(d) + if err != nil { + return nil, err + } + distCode, err := d.lz77Param(distSym) + if err != nil { + return nil, err + } + dist := distanceMap(w, distCode) + pEnd := p + 4*int(length) + q := p - 4*int(dist) + qEnd := pEnd - 4*int(dist) + if p < 0 || len(pix) < pEnd || q < 0 || len(pix) < qEnd { + return nil, errors.New("vp8l: invalid LZ77 parameters") + } + for ; p < pEnd; p, q = p+1, q+1 { + pix[p] = pix[q] + } + + x += int32(length) + for x >= w { + x, y = x-w, y+1 + } + lookupHG = hMask != 0 + + default: + // We have a color cache lookup. First, insert previous pixels + // into the cache. Note that VP8L assumes ARGB order, but the + // Go image.RGBA type is in RGBA order. + for ; cachedP < p; cachedP += 4 { + argb := uint32(pix[cachedP+0])<<16 | + uint32(pix[cachedP+1])<<8 | + uint32(pix[cachedP+2])<<0 | + uint32(pix[cachedP+3])<<24 + ccEntries[(argb*colorCacheMultiplier)>>ccShift] = argb + } + green -= nLiteralCodes + nLengthCodes + if int(green) >= len(ccEntries) { + return nil, errors.New("vp8l: invalid color cache index") + } + argb := ccEntries[green] + pix[p+0] = uint8(argb >> 16) + pix[p+1] = uint8(argb >> 8) + pix[p+2] = uint8(argb >> 0) + pix[p+3] = uint8(argb >> 24) + p += 4 + + x++ + if x == w { + x, y = 0, y+1 + } + lookupHG = hMask != 0 && x&hMask == 0 + } + } + return pix, nil +} + +// lz77Param returns the next LZ77 parameter: a length or a distance, specified +// in section 4.2.2. +func (d *decoder) lz77Param(symbol uint32) (uint32, error) { + if symbol < 4 { + return symbol + 1, nil + } + extraBits := (symbol - 2) >> 1 + offset := (2 + symbol&1) << extraBits + n, err := d.read(extraBits) + if err != nil { + return 0, err + } + return offset + n + 1, nil +} + +// decodeHeader decodes the VP8L header from r. +func decodeHeader(r io.Reader) (d *decoder, w int32, h int32, err error) { + rr, ok := r.(io.ByteReader) + if !ok { + rr = bufio.NewReader(r) + } + d = &decoder{r: rr} + magic, err := d.read(8) + if err != nil { + return nil, 0, 0, err + } + if magic != 0x2f { + return nil, 0, 0, errors.New("vp8l: invalid header") + } + width, err := d.read(14) + if err != nil { + return nil, 0, 0, err + } + width++ + height, err := d.read(14) + if err != nil { + return nil, 0, 0, err + } + height++ + _, err = d.read(1) // Read and ignore the hasAlpha hint. + if err != nil { + return nil, 0, 0, err + } + version, err := d.read(3) + if err != nil { + return nil, 0, 0, err + } + if version != 0 { + return nil, 0, 0, errors.New("vp8l: invalid version") + } + return d, int32(width), int32(height), nil +} + +// DecodeConfig decodes the color model and dimensions of a VP8L image from r. +func DecodeConfig(r io.Reader) (image.Config, error) { + _, w, h, err := decodeHeader(r) + if err != nil { + return image.Config{}, err + } + return image.Config{ + ColorModel: color.NRGBAModel, + Width: int(w), + Height: int(h), + }, nil +} + +// Decode decodes a VP8L image from r. +func Decode(r io.Reader) (image.Image, error) { + d, w, h, err := decodeHeader(r) + if err != nil { + return nil, err + } + // Decode the transforms. + var ( + nTransforms int + transforms [nTransformTypes]transform + transformsSeen [nTransformTypes]bool + originalW = w + ) + for { + more, err := d.read(1) + if err != nil { + return nil, err + } + if more == 0 { + break + } + var t transform + t, w, err = d.decodeTransform(w, h) + if err != nil { + return nil, err + } + if transformsSeen[t.transformType] { + return nil, errors.New("vp8l: repeated transform") + } + transformsSeen[t.transformType] = true + transforms[nTransforms] = t + nTransforms++ + } + // Decode the transformed pixels. + pix, err := d.decodePix(w, h, 0, true) + if err != nil { + return nil, err + } + // Apply the inverse transformations. + for i := nTransforms - 1; i >= 0; i-- { + t := &transforms[i] + pix = inverseTransforms[t.transformType](t, pix, h) + } + return &image.NRGBA{ + Pix: pix, + Stride: 4 * int(originalW), + Rect: image.Rect(0, 0, int(originalW), int(h)), + }, nil +} diff --git a/vendor/golang.org/x/image/vp8l/huffman.go b/vendor/golang.org/x/image/vp8l/huffman.go new file mode 100644 index 000000000..36368a872 --- /dev/null +++ b/vendor/golang.org/x/image/vp8l/huffman.go @@ -0,0 +1,245 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package vp8l + +import ( + "io" +) + +// reverseBits reverses the bits in a byte. +var reverseBits = [256]uint8{ + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,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xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, +} + +// hNode is a node in a Huffman tree. +type hNode struct { + // symbol is the symbol held by this node. + symbol uint32 + // children, if positive, is the hTree.nodes index of the first of + // this node's two children. Zero means an uninitialized node, + // and -1 means a leaf node. + children int32 +} + +const leafNode = -1 + +// lutSize is the log-2 size of an hTree's look-up table. +const lutSize, lutMask = 7, 1<<7 - 1 + +// hTree is a Huffman tree. +type hTree struct { + // nodes are the nodes of the Huffman tree. During construction, + // len(nodes) grows from 1 up to cap(nodes) by steps of two. + // After construction, len(nodes) == cap(nodes), and both equal + // 2*theNumberOfSymbols - 1. + nodes []hNode + // lut is a look-up table for walking the nodes. The x in lut[x] is + // the next lutSize bits in the bit-stream. The low 8 bits of lut[x] + // equals 1 plus the number of bits in the next code, or 0 if the + // next code requires more than lutSize bits. The high 24 bits are: + // - the symbol, if the code requires lutSize or fewer bits, or + // - the hTree.nodes index to start the tree traversal from, if + // the next code requires more than lutSize bits. + lut [1 << lutSize]uint32 +} + +// insert inserts into the hTree a symbol whose encoding is the least +// significant codeLength bits of code. +func (h *hTree) insert(symbol uint32, code uint32, codeLength uint32) error { + if symbol > 0xffff || codeLength > 0xfe { + return errInvalidHuffmanTree + } + baseCode := uint32(0) + if codeLength > lutSize { + baseCode = uint32(reverseBits[(code>>(codeLength-lutSize))&0xff]) >> (8 - lutSize) + } else { + baseCode = uint32(reverseBits[code&0xff]) >> (8 - codeLength) + for i := 0; i < 1<<(lutSize-codeLength); i++ { + h.lut[baseCode|uint32(i)< 0; { + codeLength-- + if int(n) > len(h.nodes) { + return errInvalidHuffmanTree + } + switch h.nodes[n].children { + case leafNode: + return errInvalidHuffmanTree + case 0: + if len(h.nodes) == cap(h.nodes) { + return errInvalidHuffmanTree + } + // Create two empty child nodes. + h.nodes[n].children = int32(len(h.nodes)) + h.nodes = h.nodes[:len(h.nodes)+2] + } + n = uint32(h.nodes[n].children) + 1&(code>>codeLength) + jump-- + if jump == 0 && h.lut[baseCode] == 0 { + h.lut[baseCode] = n << 8 + } + } + + switch h.nodes[n].children { + case leafNode: + // No-op. + case 0: + // Turn the uninitialized node into a leaf. + h.nodes[n].children = leafNode + default: + return errInvalidHuffmanTree + } + h.nodes[n].symbol = symbol + return nil +} + +// codeLengthsToCodes returns the canonical Huffman codes implied by the +// sequence of code lengths. +func codeLengthsToCodes(codeLengths []uint32) ([]uint32, error) { + maxCodeLength := uint32(0) + for _, cl := range codeLengths { + if maxCodeLength < cl { + maxCodeLength = cl + } + } + const maxAllowedCodeLength = 15 + if len(codeLengths) == 0 || maxCodeLength > maxAllowedCodeLength { + return nil, errInvalidHuffmanTree + } + histogram := [maxAllowedCodeLength + 1]uint32{} + for _, cl := range codeLengths { + histogram[cl]++ + } + currCode, nextCodes := uint32(0), [maxAllowedCodeLength + 1]uint32{} + for cl := 1; cl < len(nextCodes); cl++ { + currCode = (currCode + histogram[cl-1]) << 1 + nextCodes[cl] = currCode + } + codes := make([]uint32, len(codeLengths)) + for symbol, cl := range codeLengths { + if cl > 0 { + codes[symbol] = nextCodes[cl] + nextCodes[cl]++ + } + } + return codes, nil +} + +// build builds a canonical Huffman tree from the given code lengths. +func (h *hTree) build(codeLengths []uint32) error { + // Calculate the number of symbols. + var nSymbols, lastSymbol uint32 + for symbol, cl := range codeLengths { + if cl != 0 { + nSymbols++ + lastSymbol = uint32(symbol) + } + } + if nSymbols == 0 { + return errInvalidHuffmanTree + } + h.nodes = make([]hNode, 1, 2*nSymbols-1) + // Handle the trivial case. + if nSymbols == 1 { + if len(codeLengths) <= int(lastSymbol) { + return errInvalidHuffmanTree + } + return h.insert(lastSymbol, 0, 0) + } + // Handle the non-trivial case. + codes, err := codeLengthsToCodes(codeLengths) + if err != nil { + return err + } + for symbol, cl := range codeLengths { + if cl > 0 { + if err := h.insert(uint32(symbol), codes[symbol], cl); err != nil { + return err + } + } + } + return nil +} + +// buildSimple builds a Huffman tree with 1 or 2 symbols. +func (h *hTree) buildSimple(nSymbols uint32, symbols [2]uint32, alphabetSize uint32) error { + h.nodes = make([]hNode, 1, 2*nSymbols-1) + for i := uint32(0); i < nSymbols; i++ { + if symbols[i] >= alphabetSize { + return errInvalidHuffmanTree + } + if err := h.insert(symbols[i], i, nSymbols-1); err != nil { + return err + } + } + return nil +} + +// next returns the next Huffman-encoded symbol from the bit-stream d. +func (h *hTree) next(d *decoder) (uint32, error) { + var n uint32 + // Read enough bits so that we can use the look-up table. + if d.nBits < lutSize { + c, err := d.r.ReadByte() + if err != nil { + if err == io.EOF { + // There are no more bytes of data, but we may still be able + // to read the next symbol out of the previously read bits. + goto slowPath + } + return 0, err + } + d.bits |= uint32(c) << d.nBits + d.nBits += 8 + } + // Use the look-up table. + n = h.lut[d.bits&lutMask] + if b := n & 0xff; b != 0 { + b-- + d.bits >>= b + d.nBits -= b + return n >> 8, nil + } + n >>= 8 + d.bits >>= lutSize + d.nBits -= lutSize + +slowPath: + for h.nodes[n].children != leafNode { + if d.nBits == 0 { + c, err := d.r.ReadByte() + if err != nil { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + return 0, err + } + d.bits = uint32(c) + d.nBits = 8 + } + n = uint32(h.nodes[n].children) + 1&d.bits + d.bits >>= 1 + d.nBits-- + } + return h.nodes[n].symbol, nil +} diff --git a/vendor/golang.org/x/image/vp8l/transform.go b/vendor/golang.org/x/image/vp8l/transform.go new file mode 100644 index 000000000..06543dacb --- /dev/null +++ b/vendor/golang.org/x/image/vp8l/transform.go @@ -0,0 +1,299 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package vp8l + +// This file deals with image transforms, specified in section 3. + +// nTiles returns the number of tiles needed to cover size pixels, where each +// tile's side is 1<> bits +} + +const ( + transformTypePredictor = 0 + transformTypeCrossColor = 1 + transformTypeSubtractGreen = 2 + transformTypeColorIndexing = 3 + nTransformTypes = 4 +) + +// transform holds the parameters for an invertible transform. +type transform struct { + // transformType is the type of the transform. + transformType uint32 + // oldWidth is the width of the image before transformation (or + // equivalently, after inverse transformation). The color-indexing + // transform can reduce the width. For example, a 50-pixel-wide + // image that only needs 4 bits (half a byte) per color index can + // be transformed into a 25-pixel-wide image. + oldWidth int32 + // bits is the log-2 size of the transform's tiles, for the predictor + // and cross-color transforms. 8>>bits is the number of bits per + // color index, for the color-index transform. + bits uint32 + // pix is the tile values, for the predictor and cross-color + // transforms, and the color palette, for the color-index transform. + pix []byte +} + +var inverseTransforms = [nTransformTypes]func(*transform, []byte, int32) []byte{ + transformTypePredictor: inversePredictor, + transformTypeCrossColor: inverseCrossColor, + transformTypeSubtractGreen: inverseSubtractGreen, + transformTypeColorIndexing: inverseColorIndexing, +} + +func inversePredictor(t *transform, pix []byte, h int32) []byte { + if t.oldWidth == 0 || h == 0 { + return pix + } + // The first pixel's predictor is mode 0 (opaque black). + pix[3] += 0xff + p, mask := int32(4), int32(1)<> t.bits) * tilesPerRow + predictorMode := t.pix[q+1] & 0x0f + q += 4 + for x := int32(1); x < t.oldWidth; x++ { + if x&mask == 0 { + predictorMode = t.pix[q+1] & 0x0f + q += 4 + } + switch predictorMode { + case 0: // Opaque black. + pix[p+3] += 0xff + + case 1: // L. + pix[p+0] += pix[p-4] + pix[p+1] += pix[p-3] + pix[p+2] += pix[p-2] + pix[p+3] += pix[p-1] + + case 2: // T. + pix[p+0] += pix[top+0] + pix[p+1] += pix[top+1] + pix[p+2] += pix[top+2] + pix[p+3] += pix[top+3] + + case 3: // TR. + pix[p+0] += pix[top+4] + pix[p+1] += pix[top+5] + pix[p+2] += pix[top+6] + pix[p+3] += pix[top+7] + + case 4: // TL. + pix[p+0] += pix[top-4] + pix[p+1] += pix[top-3] + pix[p+2] += pix[top-2] + pix[p+3] += pix[top-1] + + case 5: // Average2(Average2(L, TR), T). + pix[p+0] += avg2(avg2(pix[p-4], pix[top+4]), pix[top+0]) + pix[p+1] += avg2(avg2(pix[p-3], pix[top+5]), pix[top+1]) + pix[p+2] += avg2(avg2(pix[p-2], pix[top+6]), pix[top+2]) + pix[p+3] += avg2(avg2(pix[p-1], pix[top+7]), pix[top+3]) + + case 6: // Average2(L, TL). + pix[p+0] += avg2(pix[p-4], pix[top-4]) + pix[p+1] += avg2(pix[p-3], pix[top-3]) + pix[p+2] += avg2(pix[p-2], pix[top-2]) + pix[p+3] += avg2(pix[p-1], pix[top-1]) + + case 7: // Average2(L, T). + pix[p+0] += avg2(pix[p-4], pix[top+0]) + pix[p+1] += avg2(pix[p-3], pix[top+1]) + pix[p+2] += avg2(pix[p-2], pix[top+2]) + pix[p+3] += avg2(pix[p-1], pix[top+3]) + + case 8: // Average2(TL, T). + pix[p+0] += avg2(pix[top-4], pix[top+0]) + pix[p+1] += avg2(pix[top-3], pix[top+1]) + pix[p+2] += avg2(pix[top-2], pix[top+2]) + pix[p+3] += avg2(pix[top-1], pix[top+3]) + + case 9: // Average2(T, TR). + pix[p+0] += avg2(pix[top+0], pix[top+4]) + pix[p+1] += avg2(pix[top+1], pix[top+5]) + pix[p+2] += avg2(pix[top+2], pix[top+6]) + pix[p+3] += avg2(pix[top+3], pix[top+7]) + + case 10: // Average2(Average2(L, TL), Average2(T, TR)). + pix[p+0] += avg2(avg2(pix[p-4], pix[top-4]), avg2(pix[top+0], pix[top+4])) + pix[p+1] += avg2(avg2(pix[p-3], pix[top-3]), avg2(pix[top+1], pix[top+5])) + pix[p+2] += avg2(avg2(pix[p-2], pix[top-2]), avg2(pix[top+2], pix[top+6])) + pix[p+3] += avg2(avg2(pix[p-1], pix[top-1]), avg2(pix[top+3], pix[top+7])) + + case 11: // Select(L, T, TL). + l0 := int32(pix[p-4]) + l1 := int32(pix[p-3]) + l2 := int32(pix[p-2]) + l3 := int32(pix[p-1]) + c0 := int32(pix[top-4]) + c1 := int32(pix[top-3]) + c2 := int32(pix[top-2]) + c3 := int32(pix[top-1]) + t0 := int32(pix[top+0]) + t1 := int32(pix[top+1]) + t2 := int32(pix[top+2]) + t3 := int32(pix[top+3]) + l := abs(c0-t0) + abs(c1-t1) + abs(c2-t2) + abs(c3-t3) + t := abs(c0-l0) + abs(c1-l1) + abs(c2-l2) + abs(c3-l3) + if l < t { + pix[p+0] += uint8(l0) + pix[p+1] += uint8(l1) + pix[p+2] += uint8(l2) + pix[p+3] += uint8(l3) + } else { + pix[p+0] += uint8(t0) + pix[p+1] += uint8(t1) + pix[p+2] += uint8(t2) + pix[p+3] += uint8(t3) + } + + case 12: // ClampAddSubtractFull(L, T, TL). + pix[p+0] += clampAddSubtractFull(pix[p-4], pix[top+0], pix[top-4]) + pix[p+1] += clampAddSubtractFull(pix[p-3], pix[top+1], pix[top-3]) + pix[p+2] += clampAddSubtractFull(pix[p-2], pix[top+2], pix[top-2]) + pix[p+3] += clampAddSubtractFull(pix[p-1], pix[top+3], pix[top-1]) + + case 13: // ClampAddSubtractHalf(Average2(L, T), TL). + pix[p+0] += clampAddSubtractHalf(avg2(pix[p-4], pix[top+0]), pix[top-4]) + pix[p+1] += clampAddSubtractHalf(avg2(pix[p-3], pix[top+1]), pix[top-3]) + pix[p+2] += clampAddSubtractHalf(avg2(pix[p-2], pix[top+2]), pix[top-2]) + pix[p+3] += clampAddSubtractHalf(avg2(pix[p-1], pix[top+3]), pix[top-1]) + } + p, top = p+4, top+4 + } + } + return pix +} + +func inverseCrossColor(t *transform, pix []byte, h int32) []byte { + var greenToRed, greenToBlue, redToBlue int32 + p, mask, tilesPerRow := int32(0), int32(1)<> t.bits) * tilesPerRow + for x := int32(0); x < t.oldWidth; x++ { + if x&mask == 0 { + redToBlue = int32(int8(t.pix[q+0])) + greenToBlue = int32(int8(t.pix[q+1])) + greenToRed = int32(int8(t.pix[q+2])) + q += 4 + } + red := pix[p+0] + green := pix[p+1] + blue := pix[p+2] + red += uint8(uint32(greenToRed*int32(int8(green))) >> 5) + blue += uint8(uint32(greenToBlue*int32(int8(green))) >> 5) + blue += uint8(uint32(redToBlue*int32(int8(red))) >> 5) + pix[p+0] = red + pix[p+2] = blue + p += 4 + } + } + return pix +} + +func inverseSubtractGreen(t *transform, pix []byte, h int32) []byte { + for p := 0; p < len(pix); p += 4 { + green := pix[p+1] + pix[p+0] += green + pix[p+2] += green + } + return pix +} + +func inverseColorIndexing(t *transform, pix []byte, h int32) []byte { + if t.bits == 0 { + for p := 0; p < len(pix); p += 4 { + i := 4 * uint32(pix[p+1]) + pix[p+0] = t.pix[i+0] + pix[p+1] = t.pix[i+1] + pix[p+2] = t.pix[i+2] + pix[p+3] = t.pix[i+3] + } + return pix + } + + vMask, xMask, bitsPerPixel := uint32(0), int32(0), uint32(8>>t.bits) + switch t.bits { + case 1: + vMask, xMask = 0x0f, 0x01 + case 2: + vMask, xMask = 0x03, 0x03 + case 3: + vMask, xMask = 0x01, 0x07 + } + + d, p, v, dst := 0, 0, uint32(0), make([]byte, 4*t.oldWidth*h) + for y := int32(0); y < h; y++ { + for x := int32(0); x < t.oldWidth; x++ { + if x&xMask == 0 { + v = uint32(pix[p+1]) + p += 4 + } + + i := 4 * (v & vMask) + dst[d+0] = t.pix[i+0] + dst[d+1] = t.pix[i+1] + dst[d+2] = t.pix[i+2] + dst[d+3] = t.pix[i+3] + d += 4 + + v >>= bitsPerPixel + } + } + return dst +} + +func abs(x int32) int32 { + if x < 0 { + return -x + } + return x +} + +func avg2(a, b uint8) uint8 { + return uint8((int32(a) + int32(b)) / 2) +} + +func clampAddSubtractFull(a, b, c uint8) uint8 { + x := int32(a) + int32(b) - int32(c) + if x < 0 { + return 0 + } + if x > 255 { + return 255 + } + return uint8(x) +} + +func clampAddSubtractHalf(a, b uint8) uint8 { + x := int32(a) + (int32(a)-int32(b))/2 + if x < 0 { + return 0 + } + if x > 255 { + return 255 + } + return uint8(x) +} diff --git a/vendor/golang.org/x/image/webp/decode.go b/vendor/golang.org/x/image/webp/decode.go new file mode 100644 index 000000000..f77a4ebf8 --- /dev/null +++ b/vendor/golang.org/x/image/webp/decode.go @@ -0,0 +1,270 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package webp + +import ( + "bytes" + "errors" + "image" + "image/color" + "io" + + "golang.org/x/image/riff" + "golang.org/x/image/vp8" + "golang.org/x/image/vp8l" +) + +var errInvalidFormat = errors.New("webp: invalid format") + +var ( + fccALPH = riff.FourCC{'A', 'L', 'P', 'H'} + fccVP8 = riff.FourCC{'V', 'P', '8', ' '} + fccVP8L = riff.FourCC{'V', 'P', '8', 'L'} + fccVP8X = riff.FourCC{'V', 'P', '8', 'X'} + fccWEBP = riff.FourCC{'W', 'E', 'B', 'P'} +) + +func decode(r io.Reader, configOnly bool) (image.Image, image.Config, error) { + formType, riffReader, err := riff.NewReader(r) + if err != nil { + return nil, image.Config{}, err + } + if formType != fccWEBP { + return nil, image.Config{}, errInvalidFormat + } + + var ( + alpha []byte + alphaStride int + wantAlpha bool + widthMinusOne uint32 + heightMinusOne uint32 + buf [10]byte + ) + for { + chunkID, chunkLen, chunkData, err := riffReader.Next() + if err == io.EOF { + err = errInvalidFormat + } + if err != nil { + return nil, image.Config{}, err + } + + switch chunkID { + case fccALPH: + if !wantAlpha { + return nil, image.Config{}, errInvalidFormat + } + wantAlpha = false + // Read the Pre-processing | Filter | Compression byte. + if _, err := io.ReadFull(chunkData, buf[:1]); err != nil { + if err == io.EOF { + err = errInvalidFormat + } + return nil, image.Config{}, err + } + alpha, alphaStride, err = readAlpha(chunkData, widthMinusOne, heightMinusOne, buf[0]&0x03) + if err != nil { + return nil, image.Config{}, err + } + unfilterAlpha(alpha, alphaStride, (buf[0]>>2)&0x03) + + case fccVP8: + if wantAlpha || int32(chunkLen) < 0 { + return nil, image.Config{}, errInvalidFormat + } + d := vp8.NewDecoder() + d.Init(chunkData, int(chunkLen)) + fh, err := d.DecodeFrameHeader() + if err != nil { + return nil, image.Config{}, err + } + if configOnly { + return nil, image.Config{ + ColorModel: color.YCbCrModel, + Width: fh.Width, + Height: fh.Height, + }, nil + } + m, err := d.DecodeFrame() + if err != nil { + return nil, image.Config{}, err + } + if alpha != nil { + return &image.NYCbCrA{ + YCbCr: *m, + A: alpha, + AStride: alphaStride, + }, image.Config{}, nil + } + return m, image.Config{}, nil + + case fccVP8L: + if wantAlpha || alpha != nil { + return nil, image.Config{}, errInvalidFormat + } + if configOnly { + c, err := vp8l.DecodeConfig(chunkData) + return nil, c, err + } + m, err := vp8l.Decode(chunkData) + return m, image.Config{}, err + + case fccVP8X: + if chunkLen != 10 { + return nil, image.Config{}, errInvalidFormat + } + if _, err := io.ReadFull(chunkData, buf[:10]); err != nil { + return nil, image.Config{}, err + } + const ( + animationBit = 1 << 1 + xmpMetadataBit = 1 << 2 + exifMetadataBit = 1 << 3 + alphaBit = 1 << 4 + iccProfileBit = 1 << 5 + ) + if buf[0] != alphaBit { + return nil, image.Config{}, errors.New("webp: non-Alpha VP8X is not implemented") + } + widthMinusOne = uint32(buf[4]) | uint32(buf[5])<<8 | uint32(buf[6])<<16 + heightMinusOne = uint32(buf[7]) | uint32(buf[8])<<8 | uint32(buf[9])<<16 + if configOnly { + return nil, image.Config{ + ColorModel: color.NYCbCrAModel, + Width: int(widthMinusOne) + 1, + Height: int(heightMinusOne) + 1, + }, nil + } + wantAlpha = true + + default: + return nil, image.Config{}, errInvalidFormat + } + } +} + +func readAlpha(chunkData io.Reader, widthMinusOne, heightMinusOne uint32, compression byte) ( + alpha []byte, alphaStride int, err error) { + + switch compression { + case 0: + w := int(widthMinusOne) + 1 + h := int(heightMinusOne) + 1 + alpha = make([]byte, w*h) + if _, err := io.ReadFull(chunkData, alpha); err != nil { + return nil, 0, err + } + return alpha, w, nil + + case 1: + // Read the VP8L-compressed alpha values. First, synthesize a 5-byte VP8L header: + // a 1-byte magic number, a 14-bit widthMinusOne, a 14-bit heightMinusOne, + // a 1-bit (ignored, zero) alphaIsUsed and a 3-bit (zero) version. + // TODO(nigeltao): be more efficient than decoding an *image.NRGBA just to + // extract the green values to a separately allocated []byte. Fixing this + // will require changes to the vp8l package's API. + if widthMinusOne > 0x3fff || heightMinusOne > 0x3fff { + return nil, 0, errors.New("webp: invalid format") + } + alphaImage, err := vp8l.Decode(io.MultiReader( + bytes.NewReader([]byte{ + 0x2f, // VP8L magic number. + uint8(widthMinusOne), + uint8(widthMinusOne>>8) | uint8(heightMinusOne<<6), + uint8(heightMinusOne >> 2), + uint8(heightMinusOne >> 10), + }), + chunkData, + )) + if err != nil { + return nil, 0, err + } + // The green values of the inner NRGBA image are the alpha values of the + // outer NYCbCrA image. + pix := alphaImage.(*image.NRGBA).Pix + alpha = make([]byte, len(pix)/4) + for i := range alpha { + alpha[i] = pix[4*i+1] + } + return alpha, int(widthMinusOne) + 1, nil + } + return nil, 0, errInvalidFormat +} + +func unfilterAlpha(alpha []byte, alphaStride int, filter byte) { + if len(alpha) == 0 || alphaStride == 0 { + return + } + switch filter { + case 1: // Horizontal filter. + for i := 1; i < alphaStride; i++ { + alpha[i] += alpha[i-1] + } + for i := alphaStride; i < len(alpha); i += alphaStride { + // The first column is equivalent to the vertical filter. + alpha[i] += alpha[i-alphaStride] + + for j := 1; j < alphaStride; j++ { + alpha[i+j] += alpha[i+j-1] + } + } + + case 2: // Vertical filter. + // The first row is equivalent to the horizontal filter. + for i := 1; i < alphaStride; i++ { + alpha[i] += alpha[i-1] + } + + for i := alphaStride; i < len(alpha); i++ { + alpha[i] += alpha[i-alphaStride] + } + + case 3: // Gradient filter. + // The first row is equivalent to the horizontal filter. + for i := 1; i < alphaStride; i++ { + alpha[i] += alpha[i-1] + } + + for i := alphaStride; i < len(alpha); i += alphaStride { + // The first column is equivalent to the vertical filter. + alpha[i] += alpha[i-alphaStride] + + // The interior is predicted on the three top/left pixels. + for j := 1; j < alphaStride; j++ { + c := int(alpha[i+j-alphaStride-1]) + b := int(alpha[i+j-alphaStride]) + a := int(alpha[i+j-1]) + x := a + b - c + if x < 0 { + x = 0 + } else if x > 255 { + x = 255 + } + alpha[i+j] += uint8(x) + } + } + } +} + +// Decode reads a WEBP image from r and returns it as an image.Image. +func Decode(r io.Reader) (image.Image, error) { + m, _, err := decode(r, false) + if err != nil { + return nil, err + } + return m, err +} + +// DecodeConfig returns the color model and dimensions of a WEBP image without +// decoding the entire image. +func DecodeConfig(r io.Reader) (image.Config, error) { + _, c, err := decode(r, true) + return c, err +} + +func init() { + image.RegisterFormat("webp", "RIFF????WEBPVP8", Decode, DecodeConfig) +} diff --git a/vendor/golang.org/x/image/webp/doc.go b/vendor/golang.org/x/image/webp/doc.go new file mode 100644 index 000000000..e321c8542 --- /dev/null +++ b/vendor/golang.org/x/image/webp/doc.go @@ -0,0 +1,9 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package webp implements a decoder for WEBP images. +// +// WEBP is defined at: +// https://developers.google.com/speed/webp/docs/riff_container +package webp // import "golang.org/x/image/webp" diff --git a/vendor/golang.org/x/net/html/atom/atom.go b/vendor/golang.org/x/net/html/atom/atom.go new file mode 100644 index 000000000..cd0a8ac15 --- /dev/null +++ b/vendor/golang.org/x/net/html/atom/atom.go @@ -0,0 +1,78 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package atom provides integer codes (also known as atoms) for a fixed set of +// frequently occurring HTML strings: tag names and attribute keys such as "p" +// and "id". +// +// Sharing an atom's name between all elements with the same tag can result in +// fewer string allocations when tokenizing and parsing HTML. Integer +// comparisons are also generally faster than string comparisons. +// +// The value of an atom's particular code is not guaranteed to stay the same +// between versions of this package. Neither is any ordering guaranteed: +// whether atom.H1 < atom.H2 may also change. The codes are not guaranteed to +// be dense. The only guarantees are that e.g. looking up "div" will yield +// atom.Div, calling atom.Div.String will return "div", and atom.Div != 0. +package atom // import "golang.org/x/net/html/atom" + +// Atom is an integer code for a string. The zero value maps to "". +type Atom uint32 + +// String returns the atom's name. +func (a Atom) String() string { + start := uint32(a >> 8) + n := uint32(a & 0xff) + if start+n > uint32(len(atomText)) { + return "" + } + return atomText[start : start+n] +} + +func (a Atom) string() string { + return atomText[a>>8 : a>>8+a&0xff] +} + +// fnv computes the FNV hash with an arbitrary starting value h. +func fnv(h uint32, s []byte) uint32 { + for i := range s { + h ^= uint32(s[i]) + h *= 16777619 + } + return h +} + +func match(s string, t []byte) bool { + for i, c := range t { + if s[i] != c { + return false + } + } + return true +} + +// Lookup returns the atom whose name is s. It returns zero if there is no +// such atom. The lookup is case sensitive. +func Lookup(s []byte) Atom { + if len(s) == 0 || len(s) > maxAtomLen { + return 0 + } + h := fnv(hash0, s) + if a := table[h&uint32(len(table)-1)]; int(a&0xff) == len(s) && match(a.string(), s) { + return a + } + if a := table[(h>>16)&uint32(len(table)-1)]; int(a&0xff) == len(s) && match(a.string(), s) { + return a + } + return 0 +} + +// String returns a string whose contents are equal to s. In that sense, it is +// equivalent to string(s) but may be more efficient. +func String(s []byte) string { + if a := Lookup(s); a != 0 { + return a.String() + } + return string(s) +} diff --git a/vendor/golang.org/x/net/html/atom/table.go b/vendor/golang.org/x/net/html/atom/table.go new file mode 100644 index 000000000..2a938864c --- /dev/null +++ b/vendor/golang.org/x/net/html/atom/table.go @@ -0,0 +1,783 @@ +// Code generated by go generate gen.go; DO NOT EDIT. + +//go:generate go run gen.go + +package atom + +const ( + A Atom = 0x1 + Abbr Atom = 0x4 + Accept Atom = 0x1a06 + AcceptCharset Atom = 0x1a0e + Accesskey Atom = 0x2c09 + Acronym Atom = 0xaa07 + Action Atom = 0x27206 + Address Atom = 0x6f307 + Align Atom = 0xb105 + Allowfullscreen Atom = 0x2080f + Allowpaymentrequest Atom = 0xc113 + Allowusermedia Atom = 0xdd0e + Alt Atom = 0xf303 + Annotation Atom = 0x1c90a + AnnotationXml Atom = 0x1c90e + Applet Atom = 0x31906 + Area Atom = 0x35604 + Article Atom = 0x3fc07 + As Atom = 0x3c02 + Aside Atom = 0x10705 + Async Atom = 0xff05 + Audio Atom = 0x11505 + Autocomplete Atom = 0x2780c + Autofocus Atom = 0x12109 + Autoplay Atom = 0x13c08 + B Atom = 0x101 + Base Atom = 0x3b04 + Basefont Atom = 0x3b08 + Bdi Atom = 0xba03 + Bdo Atom = 0x14b03 + Bgsound Atom = 0x15e07 + Big Atom = 0x17003 + Blink Atom = 0x17305 + Blockquote Atom = 0x1870a + Body Atom = 0x2804 + Br Atom = 0x202 + Button Atom = 0x19106 + Canvas Atom = 0x10306 + Caption Atom = 0x23107 + Center Atom = 0x22006 + Challenge Atom = 0x29b09 + Charset Atom = 0x2107 + Checked Atom = 0x47907 + Cite Atom = 0x19c04 + Class Atom = 0x56405 + Code Atom = 0x5c504 + Col Atom = 0x1ab03 + Colgroup Atom = 0x1ab08 + Color Atom = 0x1bf05 + Cols Atom = 0x1c404 + Colspan Atom = 0x1c407 + Command Atom = 0x1d707 + Content Atom = 0x58b07 + Contenteditable Atom = 0x58b0f + Contextmenu Atom = 0x3800b + Controls Atom = 0x1de08 + Coords Atom = 0x1ea06 + Crossorigin Atom = 0x1fb0b + Data Atom = 0x4a504 + Datalist Atom = 0x4a508 + Datetime Atom = 0x2b808 + Dd Atom = 0x2d702 + Default Atom = 0x10a07 + Defer Atom = 0x5c705 + Del Atom = 0x45203 + Desc Atom = 0x56104 + Details Atom = 0x7207 + Dfn Atom = 0x8703 + Dialog Atom = 0xbb06 + Dir Atom = 0x9303 + Dirname Atom = 0x9307 + Disabled Atom = 0x16408 + Div Atom = 0x16b03 + Dl Atom = 0x5e602 + Download Atom = 0x46308 + Draggable Atom = 0x17a09 + Dropzone Atom = 0x40508 + Dt Atom = 0x64b02 + Em Atom = 0x6e02 + Embed Atom = 0x6e05 + Enctype Atom = 0x28d07 + Face Atom = 0x21e04 + Fieldset Atom = 0x22608 + Figcaption Atom = 0x22e0a + Figure Atom = 0x24806 + Font Atom = 0x3f04 + Footer Atom = 0xf606 + For Atom = 0x25403 + ForeignObject Atom = 0x2540d + Foreignobject Atom = 0x2610d + Form Atom = 0x26e04 + Formaction Atom = 0x26e0a + Formenctype Atom = 0x2890b + Formmethod Atom = 0x2a40a + Formnovalidate Atom = 0x2ae0e + Formtarget Atom = 0x2c00a + Frame Atom = 0x8b05 + Frameset Atom = 0x8b08 + H1 Atom = 0x15c02 + H2 Atom = 0x2de02 + H3 Atom = 0x30d02 + H4 Atom = 0x34502 + H5 Atom = 0x34f02 + H6 Atom = 0x64d02 + Head Atom = 0x33104 + Header Atom = 0x33106 + Headers Atom = 0x33107 + Height Atom = 0x5206 + Hgroup Atom = 0x2ca06 + Hidden Atom = 0x2d506 + High Atom = 0x2db04 + Hr Atom = 0x15702 + Href Atom = 0x2e004 + Hreflang Atom = 0x2e008 + Html Atom = 0x5604 + HttpEquiv Atom = 0x2e80a + I Atom = 0x601 + Icon Atom = 0x58a04 + Id Atom = 0x10902 + Iframe Atom = 0x2fc06 + Image Atom = 0x30205 + Img Atom = 0x30703 + Input Atom = 0x44b05 + Inputmode Atom = 0x44b09 + Ins Atom = 0x20403 + Integrity Atom = 0x23f09 + Is Atom = 0x16502 + Isindex Atom = 0x30f07 + Ismap Atom = 0x31605 + Itemid Atom = 0x38b06 + Itemprop Atom = 0x19d08 + Itemref Atom = 0x3cd07 + Itemscope Atom = 0x67109 + Itemtype Atom = 0x31f08 + Kbd Atom = 0xb903 + Keygen Atom = 0x3206 + Keytype Atom = 0xd607 + Kind Atom = 0x17704 + Label Atom = 0x5905 + Lang Atom = 0x2e404 + Legend Atom = 0x18106 + Li Atom = 0xb202 + Link Atom = 0x17404 + List Atom = 0x4a904 + Listing Atom = 0x4a907 + Loop Atom = 0x5d04 + Low Atom = 0xc303 + Main Atom = 0x1004 + Malignmark Atom = 0xb00a + Manifest Atom = 0x6d708 + Map Atom = 0x31803 + Mark Atom = 0xb604 + Marquee Atom = 0x32707 + Math Atom = 0x32e04 + Max Atom = 0x33d03 + Maxlength Atom = 0x33d09 + Media Atom = 0xe605 + Mediagroup Atom = 0xe60a + Menu Atom = 0x38704 + Menuitem Atom = 0x38708 + Meta Atom = 0x4b804 + Meter Atom = 0x9805 + Method Atom = 0x2a806 + Mglyph Atom = 0x30806 + Mi Atom = 0x34702 + Min Atom = 0x34703 + Minlength Atom = 0x34709 + Mn Atom = 0x2b102 + Mo Atom = 0xa402 + Ms Atom = 0x67402 + Mtext Atom = 0x35105 + Multiple Atom = 0x35f08 + Muted Atom = 0x36705 + Name Atom = 0x9604 + Nav Atom = 0x1303 + Nobr Atom = 0x3704 + Noembed Atom = 0x6c07 + Noframes Atom = 0x8908 + Nomodule Atom = 0xa208 + Nonce Atom = 0x1a605 + Noscript Atom = 0x21608 + Novalidate Atom = 0x2b20a + Object Atom = 0x26806 + Ol Atom = 0x13702 + Onabort Atom = 0x19507 + Onafterprint Atom = 0x2360c + Onautocomplete Atom = 0x2760e + Onautocompleteerror Atom = 0x27613 + Onauxclick Atom = 0x61f0a + Onbeforeprint Atom = 0x69e0d + Onbeforeunload Atom = 0x6e70e + Onblur Atom = 0x56d06 + Oncancel Atom = 0x11908 + Oncanplay Atom = 0x14d09 + Oncanplaythrough Atom = 0x14d10 + Onchange Atom = 0x41b08 + Onclick Atom = 0x2f507 + Onclose Atom = 0x36c07 + Oncontextmenu Atom = 0x37e0d + Oncopy Atom = 0x39106 + Oncuechange Atom = 0x3970b + Oncut Atom = 0x3a205 + Ondblclick Atom = 0x3a70a + Ondrag Atom = 0x3b106 + Ondragend Atom = 0x3b109 + Ondragenter Atom = 0x3ba0b + Ondragexit Atom = 0x3c50a + Ondragleave Atom = 0x3df0b + Ondragover Atom = 0x3ea0a + Ondragstart Atom = 0x3f40b + Ondrop Atom = 0x40306 + Ondurationchange Atom = 0x41310 + Onemptied Atom = 0x40a09 + Onended Atom = 0x42307 + Onerror Atom = 0x42a07 + Onfocus Atom = 0x43107 + Onhashchange Atom = 0x43d0c + Oninput Atom = 0x44907 + Oninvalid Atom = 0x45509 + Onkeydown Atom = 0x45e09 + Onkeypress Atom = 0x46b0a + Onkeyup Atom = 0x48007 + Onlanguagechange Atom = 0x48d10 + Onload Atom = 0x49d06 + Onloadeddata Atom = 0x49d0c + Onloadedmetadata Atom = 0x4b010 + Onloadend Atom = 0x4c609 + Onloadstart Atom = 0x4cf0b + Onmessage Atom = 0x4da09 + Onmessageerror Atom = 0x4da0e + Onmousedown Atom = 0x4e80b + Onmouseenter Atom = 0x4f30c + Onmouseleave Atom = 0x4ff0c + Onmousemove Atom = 0x50b0b + Onmouseout Atom = 0x5160a + Onmouseover Atom = 0x5230b + Onmouseup Atom = 0x52e09 + Onmousewheel Atom = 0x53c0c + Onoffline Atom = 0x54809 + Ononline Atom = 0x55108 + Onpagehide Atom = 0x5590a + Onpageshow Atom = 0x5730a + Onpaste Atom = 0x57f07 + Onpause Atom = 0x59a07 + Onplay Atom = 0x5a406 + Onplaying Atom = 0x5a409 + Onpopstate Atom = 0x5ad0a + Onprogress Atom = 0x5b70a + Onratechange Atom = 0x5cc0c + Onrejectionhandled Atom = 0x5d812 + Onreset Atom = 0x5ea07 + Onresize Atom = 0x5f108 + Onscroll Atom = 0x60008 + Onsecuritypolicyviolation Atom = 0x60819 + Onseeked Atom = 0x62908 + Onseeking Atom = 0x63109 + Onselect Atom = 0x63a08 + Onshow Atom = 0x64406 + Onsort Atom = 0x64f06 + Onstalled Atom = 0x65909 + Onstorage Atom = 0x66209 + Onsubmit Atom = 0x66b08 + Onsuspend Atom = 0x67b09 + Ontimeupdate Atom = 0x400c + Ontoggle Atom = 0x68408 + Onunhandledrejection Atom = 0x68c14 + Onunload Atom = 0x6ab08 + Onvolumechange Atom = 0x6b30e + Onwaiting Atom = 0x6c109 + Onwheel Atom = 0x6ca07 + Open Atom = 0x1a304 + Optgroup Atom = 0x5f08 + Optimum Atom = 0x6d107 + Option Atom = 0x6e306 + Output Atom = 0x51d06 + P Atom = 0xc01 + Param Atom = 0xc05 + Pattern Atom = 0x6607 + Picture Atom = 0x7b07 + Ping Atom = 0xef04 + Placeholder Atom = 0x1310b + Plaintext Atom = 0x1b209 + Playsinline Atom = 0x1400b + Poster Atom = 0x2cf06 + Pre Atom = 0x47003 + Preload Atom = 0x48607 + Progress Atom = 0x5b908 + Prompt Atom = 0x53606 + Public Atom = 0x58606 + Q Atom = 0xcf01 + Radiogroup Atom = 0x30a + Rb Atom = 0x3a02 + Readonly Atom = 0x35708 + Referrerpolicy Atom = 0x3d10e + Rel Atom = 0x48703 + Required Atom = 0x24c08 + Reversed Atom = 0x8008 + Rows Atom = 0x9c04 + Rowspan Atom = 0x9c07 + Rp Atom = 0x23c02 + Rt Atom = 0x19a02 + Rtc Atom = 0x19a03 + Ruby Atom = 0xfb04 + S Atom = 0x2501 + Samp Atom = 0x7804 + Sandbox Atom = 0x12907 + Scope Atom = 0x67505 + Scoped Atom = 0x67506 + Script Atom = 0x21806 + Seamless Atom = 0x37108 + Section Atom = 0x56807 + Select Atom = 0x63c06 + Selected Atom = 0x63c08 + Shape Atom = 0x1e505 + Size Atom = 0x5f504 + Sizes Atom = 0x5f505 + Slot Atom = 0x1ef04 + Small Atom = 0x20605 + Sortable Atom = 0x65108 + Sorted Atom = 0x33706 + Source Atom = 0x37806 + Spacer Atom = 0x43706 + Span Atom = 0x9f04 + Spellcheck Atom = 0x4740a + Src Atom = 0x5c003 + Srcdoc Atom = 0x5c006 + Srclang Atom = 0x5f907 + Srcset Atom = 0x6f906 + Start Atom = 0x3fa05 + Step Atom = 0x58304 + Strike Atom = 0xd206 + Strong Atom = 0x6dd06 + Style Atom = 0x6ff05 + Sub Atom = 0x66d03 + Summary Atom = 0x70407 + Sup Atom = 0x70b03 + Svg Atom = 0x70e03 + System Atom = 0x71106 + Tabindex Atom = 0x4be08 + Table Atom = 0x59505 + Target Atom = 0x2c406 + Tbody Atom = 0x2705 + Td Atom = 0x9202 + Template Atom = 0x71408 + Textarea Atom = 0x35208 + Tfoot Atom = 0xf505 + Th Atom = 0x15602 + Thead Atom = 0x33005 + Time Atom = 0x4204 + Title Atom = 0x11005 + Tr Atom = 0xcc02 + Track Atom = 0x1ba05 + Translate Atom = 0x1f209 + Tt Atom = 0x6802 + Type Atom = 0xd904 + Typemustmatch Atom = 0x2900d + U Atom = 0xb01 + Ul Atom = 0xa702 + Updateviacache Atom = 0x460e + Usemap Atom = 0x59e06 + Value Atom = 0x1505 + Var Atom = 0x16d03 + Video Atom = 0x2f105 + Wbr Atom = 0x57c03 + Width Atom = 0x64905 + Workertype Atom = 0x71c0a + Wrap Atom = 0x72604 + Xmp Atom = 0x12f03 +) + +const hash0 = 0x81cdf10e + +const maxAtomLen = 25 + +var table = [1 << 9]Atom{ + 0x1: 0xe60a, // mediagroup + 0x2: 0x2e404, // lang + 0x4: 0x2c09, // accesskey + 0x5: 0x8b08, // frameset + 0x7: 0x63a08, // onselect + 0x8: 0x71106, // system + 0xa: 0x64905, // width + 0xc: 0x2890b, // formenctype + 0xd: 0x13702, // ol + 0xe: 0x3970b, // oncuechange + 0x10: 0x14b03, // bdo + 0x11: 0x11505, // audio + 0x12: 0x17a09, // draggable + 0x14: 0x2f105, // video + 0x15: 0x2b102, // mn + 0x16: 0x38704, // menu + 0x17: 0x2cf06, // poster + 0x19: 0xf606, // footer + 0x1a: 0x2a806, // method + 0x1b: 0x2b808, // datetime + 0x1c: 0x19507, // onabort + 0x1d: 0x460e, // updateviacache + 0x1e: 0xff05, // async + 0x1f: 0x49d06, // onload + 0x21: 0x11908, // oncancel + 0x22: 0x62908, // onseeked + 0x23: 0x30205, // image + 0x24: 0x5d812, // onrejectionhandled + 0x26: 0x17404, // link + 0x27: 0x51d06, // output + 0x28: 0x33104, // head + 0x29: 0x4ff0c, // onmouseleave + 0x2a: 0x57f07, // onpaste + 0x2b: 0x5a409, // onplaying + 0x2c: 0x1c407, // colspan + 0x2f: 0x1bf05, // color + 0x30: 0x5f504, // size + 0x31: 0x2e80a, // http-equiv + 0x33: 0x601, // i + 0x34: 0x5590a, // onpagehide + 0x35: 0x68c14, // onunhandledrejection + 0x37: 0x42a07, // onerror + 0x3a: 0x3b08, // basefont + 0x3f: 0x1303, // nav + 0x40: 0x17704, // kind + 0x41: 0x35708, // readonly + 0x42: 0x30806, // mglyph + 0x44: 0xb202, // li + 0x46: 0x2d506, // hidden + 0x47: 0x70e03, // svg + 0x48: 0x58304, // step + 0x49: 0x23f09, // integrity + 0x4a: 0x58606, // public + 0x4c: 0x1ab03, // col + 0x4d: 0x1870a, // blockquote + 0x4e: 0x34f02, // h5 + 0x50: 0x5b908, // progress + 0x51: 0x5f505, // sizes + 0x52: 0x34502, // h4 + 0x56: 0x33005, // thead + 0x57: 0xd607, // keytype + 0x58: 0x5b70a, // onprogress + 0x59: 0x44b09, // inputmode + 0x5a: 0x3b109, // ondragend + 0x5d: 0x3a205, // oncut + 0x5e: 0x43706, // spacer + 0x5f: 0x1ab08, // colgroup + 0x62: 0x16502, // is + 0x65: 0x3c02, // as + 0x66: 0x54809, // onoffline + 0x67: 0x33706, // sorted + 0x69: 0x48d10, // onlanguagechange + 0x6c: 0x43d0c, // onhashchange + 0x6d: 0x9604, // name + 0x6e: 0xf505, // tfoot + 0x6f: 0x56104, // desc + 0x70: 0x33d03, // max + 0x72: 0x1ea06, // coords + 0x73: 0x30d02, // h3 + 0x74: 0x6e70e, // onbeforeunload + 0x75: 0x9c04, // rows + 0x76: 0x63c06, // select + 0x77: 0x9805, // meter + 0x78: 0x38b06, // itemid + 0x79: 0x53c0c, // onmousewheel + 0x7a: 0x5c006, // srcdoc + 0x7d: 0x1ba05, // track + 0x7f: 0x31f08, // itemtype + 0x82: 0xa402, // mo + 0x83: 0x41b08, // onchange + 0x84: 0x33107, // headers + 0x85: 0x5cc0c, // onratechange + 0x86: 0x60819, // onsecuritypolicyviolation + 0x88: 0x4a508, // datalist + 0x89: 0x4e80b, // onmousedown + 0x8a: 0x1ef04, // slot + 0x8b: 0x4b010, // onloadedmetadata + 0x8c: 0x1a06, // accept + 0x8d: 0x26806, // object + 0x91: 0x6b30e, // onvolumechange + 0x92: 0x2107, // charset + 0x93: 0x27613, // onautocompleteerror + 0x94: 0xc113, // allowpaymentrequest + 0x95: 0x2804, // body + 0x96: 0x10a07, // default + 0x97: 0x63c08, // selected + 0x98: 0x21e04, // face + 0x99: 0x1e505, // shape + 0x9b: 0x68408, // ontoggle + 0x9e: 0x64b02, // dt + 0x9f: 0xb604, // mark + 0xa1: 0xb01, // u + 0xa4: 0x6ab08, // onunload + 0xa5: 0x5d04, // loop + 0xa6: 0x16408, // disabled + 0xaa: 0x42307, // onended + 0xab: 0xb00a, // malignmark + 0xad: 0x67b09, // onsuspend + 0xae: 0x35105, // mtext + 0xaf: 0x64f06, // onsort + 0xb0: 0x19d08, // itemprop + 0xb3: 0x67109, // itemscope + 0xb4: 0x17305, // blink + 0xb6: 0x3b106, // ondrag + 0xb7: 0xa702, // ul + 0xb8: 0x26e04, // form + 0xb9: 0x12907, // sandbox + 0xba: 0x8b05, // frame + 0xbb: 0x1505, // value + 0xbc: 0x66209, // onstorage + 0xbf: 0xaa07, // acronym + 0xc0: 0x19a02, // rt + 0xc2: 0x202, // br + 0xc3: 0x22608, // fieldset + 0xc4: 0x2900d, // typemustmatch + 0xc5: 0xa208, // nomodule + 0xc6: 0x6c07, // noembed + 0xc7: 0x69e0d, // onbeforeprint + 0xc8: 0x19106, // button + 0xc9: 0x2f507, // onclick + 0xca: 0x70407, // summary + 0xcd: 0xfb04, // ruby + 0xce: 0x56405, // class + 0xcf: 0x3f40b, // ondragstart + 0xd0: 0x23107, // caption + 0xd4: 0xdd0e, // allowusermedia + 0xd5: 0x4cf0b, // onloadstart + 0xd9: 0x16b03, // div + 0xda: 0x4a904, // list + 0xdb: 0x32e04, // math + 0xdc: 0x44b05, // input + 0xdf: 0x3ea0a, // ondragover + 0xe0: 0x2de02, // h2 + 0xe2: 0x1b209, // plaintext + 0xe4: 0x4f30c, // onmouseenter + 0xe7: 0x47907, // checked + 0xe8: 0x47003, // pre + 0xea: 0x35f08, // multiple + 0xeb: 0xba03, // bdi + 0xec: 0x33d09, // maxlength + 0xed: 0xcf01, // q + 0xee: 0x61f0a, // onauxclick + 0xf0: 0x57c03, // wbr + 0xf2: 0x3b04, // base + 0xf3: 0x6e306, // option + 0xf5: 0x41310, // ondurationchange + 0xf7: 0x8908, // noframes + 0xf9: 0x40508, // dropzone + 0xfb: 0x67505, // scope + 0xfc: 0x8008, // reversed + 0xfd: 0x3ba0b, // ondragenter + 0xfe: 0x3fa05, // start + 0xff: 0x12f03, // xmp + 0x100: 0x5f907, // srclang + 0x101: 0x30703, // img + 0x104: 0x101, // b + 0x105: 0x25403, // for + 0x106: 0x10705, // aside + 0x107: 0x44907, // oninput + 0x108: 0x35604, // area + 0x109: 0x2a40a, // formmethod + 0x10a: 0x72604, // wrap + 0x10c: 0x23c02, // rp + 0x10d: 0x46b0a, // onkeypress + 0x10e: 0x6802, // tt + 0x110: 0x34702, // mi + 0x111: 0x36705, // muted + 0x112: 0xf303, // alt + 0x113: 0x5c504, // code + 0x114: 0x6e02, // em + 0x115: 0x3c50a, // ondragexit + 0x117: 0x9f04, // span + 0x119: 0x6d708, // manifest + 0x11a: 0x38708, // menuitem + 0x11b: 0x58b07, // content + 0x11d: 0x6c109, // onwaiting + 0x11f: 0x4c609, // onloadend + 0x121: 0x37e0d, // oncontextmenu + 0x123: 0x56d06, // onblur + 0x124: 0x3fc07, // article + 0x125: 0x9303, // dir + 0x126: 0xef04, // ping + 0x127: 0x24c08, // required + 0x128: 0x45509, // oninvalid + 0x129: 0xb105, // align + 0x12b: 0x58a04, // icon + 0x12c: 0x64d02, // h6 + 0x12d: 0x1c404, // cols + 0x12e: 0x22e0a, // figcaption + 0x12f: 0x45e09, // onkeydown + 0x130: 0x66b08, // onsubmit + 0x131: 0x14d09, // oncanplay + 0x132: 0x70b03, // sup + 0x133: 0xc01, // p + 0x135: 0x40a09, // onemptied + 0x136: 0x39106, // oncopy + 0x137: 0x19c04, // cite + 0x138: 0x3a70a, // ondblclick + 0x13a: 0x50b0b, // onmousemove + 0x13c: 0x66d03, // sub + 0x13d: 0x48703, // rel + 0x13e: 0x5f08, // optgroup + 0x142: 0x9c07, // rowspan + 0x143: 0x37806, // source + 0x144: 0x21608, // noscript + 0x145: 0x1a304, // open + 0x146: 0x20403, // ins + 0x147: 0x2540d, // foreignObject + 0x148: 0x5ad0a, // onpopstate + 0x14a: 0x28d07, // enctype + 0x14b: 0x2760e, // onautocomplete + 0x14c: 0x35208, // textarea + 0x14e: 0x2780c, // autocomplete + 0x14f: 0x15702, // hr + 0x150: 0x1de08, // controls + 0x151: 0x10902, // id + 0x153: 0x2360c, // onafterprint + 0x155: 0x2610d, // foreignobject + 0x156: 0x32707, // marquee + 0x157: 0x59a07, // onpause + 0x158: 0x5e602, // dl + 0x159: 0x5206, // height + 0x15a: 0x34703, // min + 0x15b: 0x9307, // dirname + 0x15c: 0x1f209, // translate + 0x15d: 0x5604, // html + 0x15e: 0x34709, // minlength + 0x15f: 0x48607, // preload + 0x160: 0x71408, // template + 0x161: 0x3df0b, // ondragleave + 0x162: 0x3a02, // rb + 0x164: 0x5c003, // src + 0x165: 0x6dd06, // strong + 0x167: 0x7804, // samp + 0x168: 0x6f307, // address + 0x169: 0x55108, // ononline + 0x16b: 0x1310b, // placeholder + 0x16c: 0x2c406, // target + 0x16d: 0x20605, // small + 0x16e: 0x6ca07, // onwheel + 0x16f: 0x1c90a, // annotation + 0x170: 0x4740a, // spellcheck + 0x171: 0x7207, // details + 0x172: 0x10306, // canvas + 0x173: 0x12109, // autofocus + 0x174: 0xc05, // param + 0x176: 0x46308, // download + 0x177: 0x45203, // del + 0x178: 0x36c07, // onclose + 0x179: 0xb903, // kbd + 0x17a: 0x31906, // applet + 0x17b: 0x2e004, // href + 0x17c: 0x5f108, // onresize + 0x17e: 0x49d0c, // onloadeddata + 0x180: 0xcc02, // tr + 0x181: 0x2c00a, // formtarget + 0x182: 0x11005, // title + 0x183: 0x6ff05, // style + 0x184: 0xd206, // strike + 0x185: 0x59e06, // usemap + 0x186: 0x2fc06, // iframe + 0x187: 0x1004, // main + 0x189: 0x7b07, // picture + 0x18c: 0x31605, // ismap + 0x18e: 0x4a504, // data + 0x18f: 0x5905, // label + 0x191: 0x3d10e, // referrerpolicy + 0x192: 0x15602, // th + 0x194: 0x53606, // prompt + 0x195: 0x56807, // section + 0x197: 0x6d107, // optimum + 0x198: 0x2db04, // high + 0x199: 0x15c02, // h1 + 0x19a: 0x65909, // onstalled + 0x19b: 0x16d03, // var + 0x19c: 0x4204, // time + 0x19e: 0x67402, // ms + 0x19f: 0x33106, // header + 0x1a0: 0x4da09, // onmessage + 0x1a1: 0x1a605, // nonce + 0x1a2: 0x26e0a, // formaction + 0x1a3: 0x22006, // center + 0x1a4: 0x3704, // nobr + 0x1a5: 0x59505, // table + 0x1a6: 0x4a907, // listing + 0x1a7: 0x18106, // legend + 0x1a9: 0x29b09, // challenge + 0x1aa: 0x24806, // figure + 0x1ab: 0xe605, // media + 0x1ae: 0xd904, // type + 0x1af: 0x3f04, // font + 0x1b0: 0x4da0e, // onmessageerror + 0x1b1: 0x37108, // seamless + 0x1b2: 0x8703, // dfn + 0x1b3: 0x5c705, // defer + 0x1b4: 0xc303, // low + 0x1b5: 0x19a03, // rtc + 0x1b6: 0x5230b, // onmouseover + 0x1b7: 0x2b20a, // novalidate + 0x1b8: 0x71c0a, // workertype + 0x1ba: 0x3cd07, // itemref + 0x1bd: 0x1, // a + 0x1be: 0x31803, // map + 0x1bf: 0x400c, // ontimeupdate + 0x1c0: 0x15e07, // bgsound + 0x1c1: 0x3206, // keygen + 0x1c2: 0x2705, // tbody + 0x1c5: 0x64406, // onshow + 0x1c7: 0x2501, // s + 0x1c8: 0x6607, // pattern + 0x1cc: 0x14d10, // oncanplaythrough + 0x1ce: 0x2d702, // dd + 0x1cf: 0x6f906, // srcset + 0x1d0: 0x17003, // big + 0x1d2: 0x65108, // sortable + 0x1d3: 0x48007, // onkeyup + 0x1d5: 0x5a406, // onplay + 0x1d7: 0x4b804, // meta + 0x1d8: 0x40306, // ondrop + 0x1da: 0x60008, // onscroll + 0x1db: 0x1fb0b, // crossorigin + 0x1dc: 0x5730a, // onpageshow + 0x1dd: 0x4, // abbr + 0x1de: 0x9202, // td + 0x1df: 0x58b0f, // contenteditable + 0x1e0: 0x27206, // action + 0x1e1: 0x1400b, // playsinline + 0x1e2: 0x43107, // onfocus + 0x1e3: 0x2e008, // hreflang + 0x1e5: 0x5160a, // onmouseout + 0x1e6: 0x5ea07, // onreset + 0x1e7: 0x13c08, // autoplay + 0x1e8: 0x63109, // onseeking + 0x1ea: 0x67506, // scoped + 0x1ec: 0x30a, // radiogroup + 0x1ee: 0x3800b, // contextmenu + 0x1ef: 0x52e09, // onmouseup + 0x1f1: 0x2ca06, // hgroup + 0x1f2: 0x2080f, // allowfullscreen + 0x1f3: 0x4be08, // tabindex + 0x1f6: 0x30f07, // isindex + 0x1f7: 0x1a0e, // accept-charset + 0x1f8: 0x2ae0e, // formnovalidate + 0x1fb: 0x1c90e, // annotation-xml + 0x1fc: 0x6e05, // embed + 0x1fd: 0x21806, // script + 0x1fe: 0xbb06, // dialog + 0x1ff: 0x1d707, // command +} + +const atomText = "abbradiogrouparamainavalueaccept-charsetbodyaccesskeygenobrb" + + "asefontimeupdateviacacheightmlabelooptgroupatternoembedetail" + + "sampictureversedfnoframesetdirnameterowspanomoduleacronymali" + + "gnmarkbdialogallowpaymentrequestrikeytypeallowusermediagroup" + + "ingaltfooterubyasyncanvasidefaultitleaudioncancelautofocusan" + + "dboxmplaceholderautoplaysinlinebdoncanplaythrough1bgsoundisa" + + "bledivarbigblinkindraggablegendblockquotebuttonabortcitempro" + + "penoncecolgrouplaintextrackcolorcolspannotation-xmlcommandco" + + "ntrolshapecoordslotranslatecrossoriginsmallowfullscreenoscri" + + "ptfacenterfieldsetfigcaptionafterprintegrityfigurequiredfore" + + "ignObjectforeignobjectformactionautocompleteerrorformenctype" + + "mustmatchallengeformmethodformnovalidatetimeformtargethgroup" + + "osterhiddenhigh2hreflanghttp-equivideonclickiframeimageimgly" + + "ph3isindexismappletitemtypemarqueematheadersortedmaxlength4m" + + "inlength5mtextareadonlymultiplemutedoncloseamlessourceoncont" + + "extmenuitemidoncopyoncuechangeoncutondblclickondragendondrag" + + "enterondragexitemreferrerpolicyondragleaveondragoverondragst" + + "articleondropzonemptiedondurationchangeonendedonerroronfocus" + + "paceronhashchangeoninputmodeloninvalidonkeydownloadonkeypres" + + "spellcheckedonkeyupreloadonlanguagechangeonloadeddatalisting" + + "onloadedmetadatabindexonloadendonloadstartonmessageerroronmo" + + "usedownonmouseenteronmouseleaveonmousemoveonmouseoutputonmou" + + "seoveronmouseupromptonmousewheelonofflineononlineonpagehides" + + "classectionbluronpageshowbronpastepublicontenteditableonpaus" + + "emaponplayingonpopstateonprogressrcdocodeferonratechangeonre" + + "jectionhandledonresetonresizesrclangonscrollonsecuritypolicy" + + "violationauxclickonseekedonseekingonselectedonshowidth6onsor" + + "tableonstalledonstorageonsubmitemscopedonsuspendontoggleonun" + + "handledrejectionbeforeprintonunloadonvolumechangeonwaitingon" + + "wheeloptimumanifestrongoptionbeforeunloaddressrcsetstylesumm" + + "arysupsvgsystemplateworkertypewrap" diff --git a/vendor/golang.org/x/net/html/const.go b/vendor/golang.org/x/net/html/const.go new file mode 100644 index 000000000..ff7acf2d5 --- /dev/null +++ b/vendor/golang.org/x/net/html/const.go @@ -0,0 +1,111 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +// Section 12.2.4.2 of the HTML5 specification says "The following elements +// have varying levels of special parsing rules". +// https://html.spec.whatwg.org/multipage/syntax.html#the-stack-of-open-elements +var isSpecialElementMap = map[string]bool{ + "address": true, + "applet": true, + "area": true, + "article": true, + "aside": true, + "base": true, + "basefont": true, + "bgsound": true, + "blockquote": true, + "body": true, + "br": true, + "button": true, + "caption": true, + "center": true, + "col": true, + "colgroup": true, + "dd": true, + "details": true, + "dir": true, + "div": true, + "dl": true, + "dt": true, + "embed": true, + "fieldset": true, + "figcaption": true, + "figure": true, + "footer": true, + "form": true, + "frame": true, + "frameset": true, + "h1": true, + "h2": true, + "h3": true, + "h4": true, + "h5": true, + "h6": true, + "head": true, + "header": true, + "hgroup": true, + "hr": true, + "html": true, + "iframe": true, + "img": true, + "input": true, + "keygen": true, // "keygen" has been removed from the spec, but are kept here for backwards compatibility. + "li": true, + "link": true, + "listing": true, + "main": true, + "marquee": true, + "menu": true, + "meta": true, + "nav": true, + "noembed": true, + "noframes": true, + "noscript": true, + "object": true, + "ol": true, + "p": true, + "param": true, + "plaintext": true, + "pre": true, + "script": true, + "section": true, + "select": true, + "source": true, + "style": true, + "summary": true, + "table": true, + "tbody": true, + "td": true, + "template": true, + "textarea": true, + "tfoot": true, + "th": true, + "thead": true, + "title": true, + "tr": true, + "track": true, + "ul": true, + "wbr": true, + "xmp": true, +} + +func isSpecialElement(element *Node) bool { + switch element.Namespace { + case "", "html": + return isSpecialElementMap[element.Data] + case "math": + switch element.Data { + case "mi", "mo", "mn", "ms", "mtext", "annotation-xml": + return true + } + case "svg": + switch element.Data { + case "foreignObject", "desc", "title": + return true + } + } + return false +} diff --git a/vendor/golang.org/x/net/html/doc.go b/vendor/golang.org/x/net/html/doc.go new file mode 100644 index 000000000..822ed42a0 --- /dev/null +++ b/vendor/golang.org/x/net/html/doc.go @@ -0,0 +1,106 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package html implements an HTML5-compliant tokenizer and parser. + +Tokenization is done by creating a Tokenizer for an io.Reader r. It is the +caller's responsibility to ensure that r provides UTF-8 encoded HTML. + + z := html.NewTokenizer(r) + +Given a Tokenizer z, the HTML is tokenized by repeatedly calling z.Next(), +which parses the next token and returns its type, or an error: + + for { + tt := z.Next() + if tt == html.ErrorToken { + // ... + return ... + } + // Process the current token. + } + +There are two APIs for retrieving the current token. The high-level API is to +call Token; the low-level API is to call Text or TagName / TagAttr. Both APIs +allow optionally calling Raw after Next but before Token, Text, TagName, or +TagAttr. In EBNF notation, the valid call sequence per token is: + + Next {Raw} [ Token | Text | TagName {TagAttr} ] + +Token returns an independent data structure that completely describes a token. +Entities (such as "<") are unescaped, tag names and attribute keys are +lower-cased, and attributes are collected into a []Attribute. For example: + + for { + if z.Next() == html.ErrorToken { + // Returning io.EOF indicates success. + return z.Err() + } + emitToken(z.Token()) + } + +The low-level API performs fewer allocations and copies, but the contents of +the []byte values returned by Text, TagName and TagAttr may change on the next +call to Next. For example, to extract an HTML page's anchor text: + + depth := 0 + for { + tt := z.Next() + switch tt { + case html.ErrorToken: + return z.Err() + case html.TextToken: + if depth > 0 { + // emitBytes should copy the []byte it receives, + // if it doesn't process it immediately. + emitBytes(z.Text()) + } + case html.StartTagToken, html.EndTagToken: + tn, _ := z.TagName() + if len(tn) == 1 && tn[0] == 'a' { + if tt == html.StartTagToken { + depth++ + } else { + depth-- + } + } + } + } + +Parsing is done by calling Parse with an io.Reader, which returns the root of +the parse tree (the document element) as a *Node. It is the caller's +responsibility to ensure that the Reader provides UTF-8 encoded HTML. For +example, to process each anchor node in depth-first order: + + doc, err := html.Parse(r) + if err != nil { + // ... + } + var f func(*html.Node) + f = func(n *html.Node) { + if n.Type == html.ElementNode && n.Data == "a" { + // Do something with n... + } + for c := n.FirstChild; c != nil; c = c.NextSibling { + f(c) + } + } + f(doc) + +The relevant specifications include: +https://html.spec.whatwg.org/multipage/syntax.html and +https://html.spec.whatwg.org/multipage/syntax.html#tokenization +*/ +package html // import "golang.org/x/net/html" + +// The tokenization algorithm implemented by this package is not a line-by-line +// transliteration of the relatively verbose state-machine in the WHATWG +// specification. A more direct approach is used instead, where the program +// counter implies the state, such as whether it is tokenizing a tag or a text +// node. Specification compliance is verified by checking expected and actual +// outputs over a test suite rather than aiming for algorithmic fidelity. + +// TODO(nigeltao): Does a DOM API belong in this package or a separate one? +// TODO(nigeltao): How does parsing interact with a JavaScript engine? diff --git a/vendor/golang.org/x/net/html/doctype.go b/vendor/golang.org/x/net/html/doctype.go new file mode 100644 index 000000000..c484e5a94 --- /dev/null +++ b/vendor/golang.org/x/net/html/doctype.go @@ -0,0 +1,156 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +import ( + "strings" +) + +// parseDoctype parses the data from a DoctypeToken into a name, +// public identifier, and system identifier. It returns a Node whose Type +// is DoctypeNode, whose Data is the name, and which has attributes +// named "system" and "public" for the two identifiers if they were present. +// quirks is whether the document should be parsed in "quirks mode". +func parseDoctype(s string) (n *Node, quirks bool) { + n = &Node{Type: DoctypeNode} + + // Find the name. + space := strings.IndexAny(s, whitespace) + if space == -1 { + space = len(s) + } + n.Data = s[:space] + // The comparison to "html" is case-sensitive. + if n.Data != "html" { + quirks = true + } + n.Data = strings.ToLower(n.Data) + s = strings.TrimLeft(s[space:], whitespace) + + if len(s) < 6 { + // It can't start with "PUBLIC" or "SYSTEM". + // Ignore the rest of the string. + return n, quirks || s != "" + } + + key := strings.ToLower(s[:6]) + s = s[6:] + for key == "public" || key == "system" { + s = strings.TrimLeft(s, whitespace) + if s == "" { + break + } + quote := s[0] + if quote != '"' && quote != '\'' { + break + } + s = s[1:] + q := strings.IndexRune(s, rune(quote)) + var id string + if q == -1 { + id = s + s = "" + } else { + id = s[:q] + s = s[q+1:] + } + n.Attr = append(n.Attr, Attribute{Key: key, Val: id}) + if key == "public" { + key = "system" + } else { + key = "" + } + } + + if key != "" || s != "" { + quirks = true + } else if len(n.Attr) > 0 { + if n.Attr[0].Key == "public" { + public := strings.ToLower(n.Attr[0].Val) + switch public { + case "-//w3o//dtd w3 html strict 3.0//en//", "-/w3d/dtd html 4.0 transitional/en", "html": + quirks = true + default: + for _, q := range quirkyIDs { + if strings.HasPrefix(public, q) { + quirks = true + break + } + } + } + // The following two public IDs only cause quirks mode if there is no system ID. + if len(n.Attr) == 1 && (strings.HasPrefix(public, "-//w3c//dtd html 4.01 frameset//") || + strings.HasPrefix(public, "-//w3c//dtd html 4.01 transitional//")) { + quirks = true + } + } + if lastAttr := n.Attr[len(n.Attr)-1]; lastAttr.Key == "system" && + strings.ToLower(lastAttr.Val) == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" { + quirks = true + } + } + + return n, quirks +} + +// quirkyIDs is a list of public doctype identifiers that cause a document +// to be interpreted in quirks mode. The identifiers should be in lower case. +var quirkyIDs = []string{ + "+//silmaril//dtd html pro v0r11 19970101//", + "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", + "-//as//dtd html 3.0 aswedit + extensions//", + "-//ietf//dtd html 2.0 level 1//", + "-//ietf//dtd html 2.0 level 2//", + "-//ietf//dtd html 2.0 strict level 1//", + "-//ietf//dtd html 2.0 strict level 2//", + "-//ietf//dtd html 2.0 strict//", + "-//ietf//dtd html 2.0//", + "-//ietf//dtd html 2.1e//", + "-//ietf//dtd html 3.0//", + "-//ietf//dtd html 3.2 final//", + "-//ietf//dtd html 3.2//", + "-//ietf//dtd html 3//", + "-//ietf//dtd html level 0//", + "-//ietf//dtd html level 1//", + "-//ietf//dtd html level 2//", + "-//ietf//dtd html level 3//", + "-//ietf//dtd html strict level 0//", + "-//ietf//dtd html strict level 1//", + "-//ietf//dtd html strict level 2//", + "-//ietf//dtd html strict level 3//", + "-//ietf//dtd html strict//", + "-//ietf//dtd html//", + "-//metrius//dtd metrius presentational//", + "-//microsoft//dtd internet explorer 2.0 html strict//", + "-//microsoft//dtd internet explorer 2.0 html//", + "-//microsoft//dtd internet explorer 2.0 tables//", + "-//microsoft//dtd internet explorer 3.0 html strict//", + "-//microsoft//dtd internet explorer 3.0 html//", + "-//microsoft//dtd internet explorer 3.0 tables//", + "-//netscape comm. corp.//dtd html//", + "-//netscape comm. corp.//dtd strict html//", + "-//o'reilly and associates//dtd html 2.0//", + "-//o'reilly and associates//dtd html extended 1.0//", + "-//o'reilly and associates//dtd html extended relaxed 1.0//", + "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//", + "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//", + "-//spyglass//dtd html 2.0 extended//", + "-//sq//dtd html 2.0 hotmetal + extensions//", + "-//sun microsystems corp.//dtd hotjava html//", + "-//sun microsystems corp.//dtd hotjava strict html//", + "-//w3c//dtd html 3 1995-03-24//", + "-//w3c//dtd html 3.2 draft//", + "-//w3c//dtd html 3.2 final//", + "-//w3c//dtd html 3.2//", + "-//w3c//dtd html 3.2s draft//", + "-//w3c//dtd html 4.0 frameset//", + "-//w3c//dtd html 4.0 transitional//", + "-//w3c//dtd html experimental 19960712//", + "-//w3c//dtd html experimental 970421//", + "-//w3c//dtd w3 html//", + "-//w3o//dtd w3 html 3.0//", + "-//webtechs//dtd mozilla html 2.0//", + "-//webtechs//dtd mozilla html//", +} diff --git a/vendor/golang.org/x/net/html/entity.go b/vendor/golang.org/x/net/html/entity.go new file mode 100644 index 000000000..b628880a0 --- /dev/null +++ b/vendor/golang.org/x/net/html/entity.go @@ -0,0 +1,2253 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +// All entities that do not end with ';' are 6 or fewer bytes long. +const longestEntityWithoutSemicolon = 6 + +// entity is a map from HTML entity names to their values. The semicolon matters: +// https://html.spec.whatwg.org/multipage/syntax.html#named-character-references +// lists both "amp" and "amp;" as two separate entries. +// +// Note that the HTML5 list is larger than the HTML4 list at +// http://www.w3.org/TR/html4/sgml/entities.html +var entity = map[string]rune{ + "AElig;": '\U000000C6', + "AMP;": '\U00000026', + "Aacute;": '\U000000C1', + "Abreve;": '\U00000102', + "Acirc;": '\U000000C2', + "Acy;": '\U00000410', + "Afr;": '\U0001D504', + "Agrave;": '\U000000C0', + "Alpha;": '\U00000391', + "Amacr;": '\U00000100', + "And;": '\U00002A53', + "Aogon;": '\U00000104', + "Aopf;": '\U0001D538', + "ApplyFunction;": '\U00002061', + "Aring;": '\U000000C5', + "Ascr;": '\U0001D49C', + "Assign;": '\U00002254', + "Atilde;": '\U000000C3', + "Auml;": '\U000000C4', + "Backslash;": '\U00002216', + "Barv;": '\U00002AE7', + "Barwed;": '\U00002306', + "Bcy;": '\U00000411', + "Because;": '\U00002235', + "Bernoullis;": '\U0000212C', + "Beta;": '\U00000392', + "Bfr;": '\U0001D505', + "Bopf;": '\U0001D539', + "Breve;": '\U000002D8', + "Bscr;": '\U0000212C', + "Bumpeq;": '\U0000224E', + "CHcy;": '\U00000427', + "COPY;": '\U000000A9', + "Cacute;": '\U00000106', + "Cap;": '\U000022D2', + "CapitalDifferentialD;": '\U00002145', + "Cayleys;": '\U0000212D', + "Ccaron;": '\U0000010C', + "Ccedil;": '\U000000C7', + "Ccirc;": '\U00000108', + "Cconint;": '\U00002230', + "Cdot;": '\U0000010A', + "Cedilla;": '\U000000B8', + "CenterDot;": '\U000000B7', + "Cfr;": '\U0000212D', + "Chi;": '\U000003A7', + "CircleDot;": '\U00002299', + "CircleMinus;": '\U00002296', + "CirclePlus;": '\U00002295', + "CircleTimes;": '\U00002297', + "ClockwiseContourIntegral;": '\U00002232', + "CloseCurlyDoubleQuote;": '\U0000201D', + "CloseCurlyQuote;": '\U00002019', + "Colon;": '\U00002237', + "Colone;": '\U00002A74', + "Congruent;": '\U00002261', + "Conint;": '\U0000222F', + "ContourIntegral;": '\U0000222E', + "Copf;": '\U00002102', + "Coproduct;": '\U00002210', + "CounterClockwiseContourIntegral;": '\U00002233', + "Cross;": '\U00002A2F', + "Cscr;": '\U0001D49E', + "Cup;": '\U000022D3', + "CupCap;": '\U0000224D', + "DD;": '\U00002145', + "DDotrahd;": '\U00002911', + "DJcy;": '\U00000402', + "DScy;": '\U00000405', + "DZcy;": '\U0000040F', + "Dagger;": '\U00002021', + "Darr;": '\U000021A1', + "Dashv;": '\U00002AE4', + "Dcaron;": '\U0000010E', + "Dcy;": '\U00000414', + "Del;": '\U00002207', + "Delta;": '\U00000394', + "Dfr;": '\U0001D507', + "DiacriticalAcute;": '\U000000B4', + "DiacriticalDot;": '\U000002D9', + "DiacriticalDoubleAcute;": '\U000002DD', + "DiacriticalGrave;": '\U00000060', + "DiacriticalTilde;": '\U000002DC', + "Diamond;": '\U000022C4', + "DifferentialD;": '\U00002146', + "Dopf;": '\U0001D53B', + "Dot;": '\U000000A8', + "DotDot;": '\U000020DC', + "DotEqual;": '\U00002250', + "DoubleContourIntegral;": '\U0000222F', + "DoubleDot;": '\U000000A8', + "DoubleDownArrow;": '\U000021D3', + "DoubleLeftArrow;": '\U000021D0', + "DoubleLeftRightArrow;": '\U000021D4', + "DoubleLeftTee;": '\U00002AE4', + "DoubleLongLeftArrow;": '\U000027F8', + "DoubleLongLeftRightArrow;": '\U000027FA', + "DoubleLongRightArrow;": '\U000027F9', + "DoubleRightArrow;": '\U000021D2', + "DoubleRightTee;": '\U000022A8', + "DoubleUpArrow;": '\U000021D1', + "DoubleUpDownArrow;": '\U000021D5', + "DoubleVerticalBar;": '\U00002225', + "DownArrow;": '\U00002193', + "DownArrowBar;": '\U00002913', + "DownArrowUpArrow;": '\U000021F5', + "DownBreve;": '\U00000311', + "DownLeftRightVector;": '\U00002950', + "DownLeftTeeVector;": '\U0000295E', + "DownLeftVector;": '\U000021BD', + "DownLeftVectorBar;": '\U00002956', + "DownRightTeeVector;": '\U0000295F', + "DownRightVector;": '\U000021C1', + "DownRightVectorBar;": '\U00002957', + "DownTee;": '\U000022A4', + "DownTeeArrow;": '\U000021A7', + "Downarrow;": '\U000021D3', + "Dscr;": '\U0001D49F', + "Dstrok;": '\U00000110', + "ENG;": '\U0000014A', + "ETH;": '\U000000D0', + "Eacute;": '\U000000C9', + "Ecaron;": '\U0000011A', + "Ecirc;": '\U000000CA', + "Ecy;": '\U0000042D', + "Edot;": '\U00000116', + "Efr;": '\U0001D508', + "Egrave;": '\U000000C8', + "Element;": '\U00002208', + "Emacr;": '\U00000112', + "EmptySmallSquare;": '\U000025FB', + "EmptyVerySmallSquare;": '\U000025AB', + "Eogon;": '\U00000118', + "Eopf;": '\U0001D53C', + "Epsilon;": '\U00000395', + "Equal;": '\U00002A75', + "EqualTilde;": '\U00002242', + "Equilibrium;": '\U000021CC', + "Escr;": '\U00002130', + "Esim;": '\U00002A73', + "Eta;": '\U00000397', + "Euml;": '\U000000CB', + "Exists;": '\U00002203', + "ExponentialE;": '\U00002147', + "Fcy;": '\U00000424', + "Ffr;": '\U0001D509', + "FilledSmallSquare;": '\U000025FC', + "FilledVerySmallSquare;": '\U000025AA', + "Fopf;": '\U0001D53D', + "ForAll;": '\U00002200', + "Fouriertrf;": '\U00002131', + "Fscr;": '\U00002131', + "GJcy;": '\U00000403', + "GT;": '\U0000003E', + "Gamma;": '\U00000393', + "Gammad;": '\U000003DC', + "Gbreve;": '\U0000011E', + "Gcedil;": '\U00000122', + "Gcirc;": '\U0000011C', + "Gcy;": '\U00000413', + "Gdot;": '\U00000120', + "Gfr;": '\U0001D50A', + "Gg;": '\U000022D9', + "Gopf;": '\U0001D53E', + "GreaterEqual;": '\U00002265', + "GreaterEqualLess;": '\U000022DB', + "GreaterFullEqual;": '\U00002267', + "GreaterGreater;": '\U00002AA2', + "GreaterLess;": '\U00002277', + "GreaterSlantEqual;": '\U00002A7E', + "GreaterTilde;": '\U00002273', + "Gscr;": '\U0001D4A2', + "Gt;": '\U0000226B', + "HARDcy;": '\U0000042A', + "Hacek;": '\U000002C7', + "Hat;": '\U0000005E', + "Hcirc;": '\U00000124', + "Hfr;": '\U0000210C', + "HilbertSpace;": '\U0000210B', + "Hopf;": '\U0000210D', + "HorizontalLine;": '\U00002500', + "Hscr;": '\U0000210B', + "Hstrok;": '\U00000126', + "HumpDownHump;": '\U0000224E', + "HumpEqual;": '\U0000224F', + "IEcy;": '\U00000415', + "IJlig;": '\U00000132', + "IOcy;": '\U00000401', + "Iacute;": '\U000000CD', + "Icirc;": '\U000000CE', + "Icy;": '\U00000418', + "Idot;": '\U00000130', + "Ifr;": '\U00002111', + "Igrave;": '\U000000CC', + "Im;": '\U00002111', + "Imacr;": '\U0000012A', + "ImaginaryI;": '\U00002148', + "Implies;": '\U000021D2', + "Int;": '\U0000222C', + "Integral;": '\U0000222B', + "Intersection;": '\U000022C2', + "InvisibleComma;": '\U00002063', + "InvisibleTimes;": '\U00002062', + "Iogon;": '\U0000012E', + "Iopf;": '\U0001D540', + "Iota;": '\U00000399', + "Iscr;": '\U00002110', + "Itilde;": '\U00000128', + "Iukcy;": '\U00000406', + "Iuml;": '\U000000CF', + "Jcirc;": '\U00000134', + "Jcy;": '\U00000419', + "Jfr;": '\U0001D50D', + "Jopf;": '\U0001D541', + "Jscr;": '\U0001D4A5', + "Jsercy;": '\U00000408', + "Jukcy;": '\U00000404', + "KHcy;": '\U00000425', + "KJcy;": '\U0000040C', + "Kappa;": '\U0000039A', + "Kcedil;": '\U00000136', + "Kcy;": '\U0000041A', + "Kfr;": '\U0001D50E', + "Kopf;": '\U0001D542', + "Kscr;": '\U0001D4A6', + "LJcy;": '\U00000409', + "LT;": '\U0000003C', + "Lacute;": '\U00000139', + "Lambda;": '\U0000039B', + "Lang;": '\U000027EA', + "Laplacetrf;": '\U00002112', + "Larr;": '\U0000219E', + "Lcaron;": '\U0000013D', + "Lcedil;": '\U0000013B', + "Lcy;": '\U0000041B', + "LeftAngleBracket;": '\U000027E8', + "LeftArrow;": '\U00002190', + "LeftArrowBar;": '\U000021E4', + "LeftArrowRightArrow;": '\U000021C6', + "LeftCeiling;": '\U00002308', + "LeftDoubleBracket;": '\U000027E6', + "LeftDownTeeVector;": '\U00002961', + "LeftDownVector;": '\U000021C3', + "LeftDownVectorBar;": '\U00002959', + "LeftFloor;": '\U0000230A', + "LeftRightArrow;": '\U00002194', + "LeftRightVector;": '\U0000294E', + "LeftTee;": '\U000022A3', + "LeftTeeArrow;": '\U000021A4', + "LeftTeeVector;": '\U0000295A', + "LeftTriangle;": '\U000022B2', + "LeftTriangleBar;": '\U000029CF', + "LeftTriangleEqual;": '\U000022B4', + "LeftUpDownVector;": '\U00002951', + "LeftUpTeeVector;": '\U00002960', + "LeftUpVector;": '\U000021BF', + "LeftUpVectorBar;": '\U00002958', + "LeftVector;": '\U000021BC', + "LeftVectorBar;": '\U00002952', + "Leftarrow;": '\U000021D0', + "Leftrightarrow;": '\U000021D4', + "LessEqualGreater;": '\U000022DA', + "LessFullEqual;": '\U00002266', + "LessGreater;": '\U00002276', + "LessLess;": '\U00002AA1', + "LessSlantEqual;": '\U00002A7D', + "LessTilde;": '\U00002272', + "Lfr;": '\U0001D50F', + "Ll;": '\U000022D8', + "Lleftarrow;": '\U000021DA', + "Lmidot;": '\U0000013F', + "LongLeftArrow;": '\U000027F5', + "LongLeftRightArrow;": '\U000027F7', + "LongRightArrow;": '\U000027F6', + "Longleftarrow;": '\U000027F8', + "Longleftrightarrow;": '\U000027FA', + "Longrightarrow;": '\U000027F9', + "Lopf;": '\U0001D543', + "LowerLeftArrow;": '\U00002199', + "LowerRightArrow;": '\U00002198', + "Lscr;": '\U00002112', + "Lsh;": '\U000021B0', + "Lstrok;": '\U00000141', + "Lt;": '\U0000226A', + "Map;": '\U00002905', + "Mcy;": '\U0000041C', + "MediumSpace;": '\U0000205F', + "Mellintrf;": '\U00002133', + "Mfr;": '\U0001D510', + "MinusPlus;": '\U00002213', + "Mopf;": '\U0001D544', + "Mscr;": '\U00002133', + "Mu;": '\U0000039C', + "NJcy;": '\U0000040A', + "Nacute;": '\U00000143', + "Ncaron;": '\U00000147', + "Ncedil;": '\U00000145', + "Ncy;": '\U0000041D', + "NegativeMediumSpace;": '\U0000200B', + "NegativeThickSpace;": '\U0000200B', + "NegativeThinSpace;": '\U0000200B', + "NegativeVeryThinSpace;": '\U0000200B', + "NestedGreaterGreater;": '\U0000226B', + "NestedLessLess;": '\U0000226A', + "NewLine;": '\U0000000A', + "Nfr;": '\U0001D511', + "NoBreak;": '\U00002060', + "NonBreakingSpace;": '\U000000A0', + "Nopf;": '\U00002115', + "Not;": '\U00002AEC', + "NotCongruent;": '\U00002262', + "NotCupCap;": '\U0000226D', + "NotDoubleVerticalBar;": '\U00002226', + "NotElement;": '\U00002209', + "NotEqual;": '\U00002260', + "NotExists;": '\U00002204', + "NotGreater;": '\U0000226F', + "NotGreaterEqual;": '\U00002271', + "NotGreaterLess;": '\U00002279', + "NotGreaterTilde;": '\U00002275', + "NotLeftTriangle;": '\U000022EA', + "NotLeftTriangleEqual;": '\U000022EC', + "NotLess;": '\U0000226E', + "NotLessEqual;": '\U00002270', + "NotLessGreater;": '\U00002278', + "NotLessTilde;": '\U00002274', + "NotPrecedes;": '\U00002280', + "NotPrecedesSlantEqual;": '\U000022E0', + "NotReverseElement;": '\U0000220C', + "NotRightTriangle;": '\U000022EB', + "NotRightTriangleEqual;": '\U000022ED', + "NotSquareSubsetEqual;": '\U000022E2', + "NotSquareSupersetEqual;": '\U000022E3', + "NotSubsetEqual;": '\U00002288', + "NotSucceeds;": '\U00002281', + "NotSucceedsSlantEqual;": '\U000022E1', + "NotSupersetEqual;": '\U00002289', + "NotTilde;": '\U00002241', + "NotTildeEqual;": '\U00002244', + "NotTildeFullEqual;": '\U00002247', + "NotTildeTilde;": '\U00002249', + "NotVerticalBar;": '\U00002224', + "Nscr;": '\U0001D4A9', + "Ntilde;": '\U000000D1', + "Nu;": '\U0000039D', + "OElig;": '\U00000152', + "Oacute;": '\U000000D3', + "Ocirc;": '\U000000D4', + "Ocy;": '\U0000041E', + "Odblac;": '\U00000150', + "Ofr;": '\U0001D512', + "Ograve;": '\U000000D2', + "Omacr;": '\U0000014C', + "Omega;": '\U000003A9', + "Omicron;": '\U0000039F', + "Oopf;": '\U0001D546', + "OpenCurlyDoubleQuote;": '\U0000201C', + "OpenCurlyQuote;": '\U00002018', + "Or;": '\U00002A54', + "Oscr;": '\U0001D4AA', + "Oslash;": '\U000000D8', + "Otilde;": '\U000000D5', + "Otimes;": '\U00002A37', + "Ouml;": '\U000000D6', + "OverBar;": '\U0000203E', + "OverBrace;": '\U000023DE', + "OverBracket;": '\U000023B4', + "OverParenthesis;": '\U000023DC', + "PartialD;": '\U00002202', + "Pcy;": '\U0000041F', + "Pfr;": '\U0001D513', + "Phi;": '\U000003A6', + "Pi;": '\U000003A0', + "PlusMinus;": '\U000000B1', + "Poincareplane;": '\U0000210C', + "Popf;": '\U00002119', + "Pr;": '\U00002ABB', + "Precedes;": '\U0000227A', + "PrecedesEqual;": '\U00002AAF', + "PrecedesSlantEqual;": '\U0000227C', + "PrecedesTilde;": '\U0000227E', + "Prime;": '\U00002033', + "Product;": '\U0000220F', + "Proportion;": '\U00002237', + "Proportional;": '\U0000221D', + "Pscr;": '\U0001D4AB', + "Psi;": '\U000003A8', + "QUOT;": '\U00000022', + "Qfr;": '\U0001D514', + "Qopf;": '\U0000211A', + "Qscr;": '\U0001D4AC', + "RBarr;": '\U00002910', + "REG;": '\U000000AE', + "Racute;": '\U00000154', + "Rang;": '\U000027EB', + "Rarr;": '\U000021A0', + "Rarrtl;": '\U00002916', + "Rcaron;": '\U00000158', + "Rcedil;": '\U00000156', + "Rcy;": '\U00000420', + "Re;": '\U0000211C', + "ReverseElement;": '\U0000220B', + "ReverseEquilibrium;": '\U000021CB', + "ReverseUpEquilibrium;": '\U0000296F', + "Rfr;": '\U0000211C', + "Rho;": '\U000003A1', + "RightAngleBracket;": '\U000027E9', + "RightArrow;": '\U00002192', + "RightArrowBar;": '\U000021E5', + "RightArrowLeftArrow;": '\U000021C4', + "RightCeiling;": '\U00002309', + "RightDoubleBracket;": '\U000027E7', + "RightDownTeeVector;": '\U0000295D', + "RightDownVector;": '\U000021C2', + "RightDownVectorBar;": '\U00002955', + "RightFloor;": '\U0000230B', + "RightTee;": '\U000022A2', + "RightTeeArrow;": '\U000021A6', + "RightTeeVector;": '\U0000295B', + "RightTriangle;": '\U000022B3', + "RightTriangleBar;": '\U000029D0', + "RightTriangleEqual;": '\U000022B5', + "RightUpDownVector;": '\U0000294F', + "RightUpTeeVector;": '\U0000295C', + "RightUpVector;": '\U000021BE', + "RightUpVectorBar;": '\U00002954', + "RightVector;": '\U000021C0', + "RightVectorBar;": '\U00002953', + "Rightarrow;": '\U000021D2', + "Ropf;": '\U0000211D', + "RoundImplies;": '\U00002970', + "Rrightarrow;": '\U000021DB', + "Rscr;": '\U0000211B', + "Rsh;": '\U000021B1', + "RuleDelayed;": '\U000029F4', + "SHCHcy;": '\U00000429', + "SHcy;": '\U00000428', + "SOFTcy;": '\U0000042C', + "Sacute;": '\U0000015A', + "Sc;": '\U00002ABC', + "Scaron;": '\U00000160', + "Scedil;": '\U0000015E', + "Scirc;": '\U0000015C', + "Scy;": '\U00000421', + "Sfr;": '\U0001D516', + "ShortDownArrow;": '\U00002193', + "ShortLeftArrow;": '\U00002190', + "ShortRightArrow;": '\U00002192', + "ShortUpArrow;": '\U00002191', + "Sigma;": '\U000003A3', + "SmallCircle;": '\U00002218', + "Sopf;": '\U0001D54A', + "Sqrt;": '\U0000221A', + "Square;": '\U000025A1', + "SquareIntersection;": '\U00002293', + "SquareSubset;": '\U0000228F', + "SquareSubsetEqual;": '\U00002291', + "SquareSuperset;": '\U00002290', + "SquareSupersetEqual;": '\U00002292', + "SquareUnion;": '\U00002294', + "Sscr;": '\U0001D4AE', + "Star;": '\U000022C6', + "Sub;": '\U000022D0', + "Subset;": '\U000022D0', + "SubsetEqual;": '\U00002286', + "Succeeds;": '\U0000227B', + "SucceedsEqual;": '\U00002AB0', + "SucceedsSlantEqual;": '\U0000227D', + "SucceedsTilde;": '\U0000227F', + "SuchThat;": '\U0000220B', + "Sum;": '\U00002211', + "Sup;": '\U000022D1', + "Superset;": '\U00002283', + "SupersetEqual;": '\U00002287', + "Supset;": '\U000022D1', + "THORN;": '\U000000DE', + "TRADE;": '\U00002122', + "TSHcy;": '\U0000040B', + "TScy;": '\U00000426', + "Tab;": '\U00000009', + "Tau;": '\U000003A4', + "Tcaron;": '\U00000164', + "Tcedil;": '\U00000162', + "Tcy;": '\U00000422', + "Tfr;": '\U0001D517', + "Therefore;": '\U00002234', + "Theta;": '\U00000398', + "ThinSpace;": '\U00002009', + "Tilde;": '\U0000223C', + "TildeEqual;": '\U00002243', + "TildeFullEqual;": '\U00002245', + "TildeTilde;": '\U00002248', + "Topf;": '\U0001D54B', + "TripleDot;": '\U000020DB', + "Tscr;": '\U0001D4AF', + "Tstrok;": '\U00000166', + "Uacute;": '\U000000DA', + "Uarr;": '\U0000219F', + "Uarrocir;": '\U00002949', + "Ubrcy;": '\U0000040E', + "Ubreve;": '\U0000016C', + "Ucirc;": '\U000000DB', + "Ucy;": '\U00000423', + "Udblac;": '\U00000170', + "Ufr;": '\U0001D518', + "Ugrave;": '\U000000D9', + "Umacr;": '\U0000016A', + "UnderBar;": '\U0000005F', + "UnderBrace;": '\U000023DF', + "UnderBracket;": '\U000023B5', + "UnderParenthesis;": '\U000023DD', + "Union;": '\U000022C3', + "UnionPlus;": '\U0000228E', + "Uogon;": '\U00000172', + "Uopf;": '\U0001D54C', + "UpArrow;": '\U00002191', + "UpArrowBar;": '\U00002912', + "UpArrowDownArrow;": '\U000021C5', + "UpDownArrow;": '\U00002195', + "UpEquilibrium;": '\U0000296E', + "UpTee;": '\U000022A5', + "UpTeeArrow;": '\U000021A5', + "Uparrow;": '\U000021D1', + "Updownarrow;": '\U000021D5', + "UpperLeftArrow;": '\U00002196', + "UpperRightArrow;": '\U00002197', + "Upsi;": '\U000003D2', + "Upsilon;": '\U000003A5', + "Uring;": '\U0000016E', + "Uscr;": '\U0001D4B0', + "Utilde;": '\U00000168', + "Uuml;": '\U000000DC', + "VDash;": '\U000022AB', + "Vbar;": '\U00002AEB', + "Vcy;": '\U00000412', + "Vdash;": '\U000022A9', + "Vdashl;": '\U00002AE6', + "Vee;": '\U000022C1', + "Verbar;": '\U00002016', + "Vert;": '\U00002016', + "VerticalBar;": '\U00002223', + "VerticalLine;": '\U0000007C', + "VerticalSeparator;": '\U00002758', + "VerticalTilde;": '\U00002240', + "VeryThinSpace;": '\U0000200A', + "Vfr;": '\U0001D519', + "Vopf;": '\U0001D54D', + "Vscr;": '\U0001D4B1', + "Vvdash;": '\U000022AA', + "Wcirc;": '\U00000174', + "Wedge;": '\U000022C0', + "Wfr;": '\U0001D51A', + "Wopf;": '\U0001D54E', + "Wscr;": '\U0001D4B2', + "Xfr;": '\U0001D51B', + "Xi;": '\U0000039E', + "Xopf;": '\U0001D54F', + "Xscr;": '\U0001D4B3', + "YAcy;": '\U0000042F', + "YIcy;": '\U00000407', + "YUcy;": '\U0000042E', + "Yacute;": '\U000000DD', + "Ycirc;": '\U00000176', + "Ycy;": '\U0000042B', + "Yfr;": '\U0001D51C', + "Yopf;": '\U0001D550', + "Yscr;": '\U0001D4B4', + "Yuml;": '\U00000178', + "ZHcy;": '\U00000416', + "Zacute;": '\U00000179', + "Zcaron;": '\U0000017D', + "Zcy;": '\U00000417', + "Zdot;": '\U0000017B', + "ZeroWidthSpace;": '\U0000200B', + "Zeta;": '\U00000396', + "Zfr;": '\U00002128', + "Zopf;": '\U00002124', + "Zscr;": '\U0001D4B5', + "aacute;": '\U000000E1', + "abreve;": '\U00000103', + "ac;": '\U0000223E', + "acd;": '\U0000223F', + "acirc;": '\U000000E2', + "acute;": '\U000000B4', + "acy;": '\U00000430', + "aelig;": '\U000000E6', + "af;": '\U00002061', + "afr;": '\U0001D51E', + "agrave;": '\U000000E0', + "alefsym;": '\U00002135', + "aleph;": '\U00002135', + "alpha;": '\U000003B1', + "amacr;": '\U00000101', + "amalg;": '\U00002A3F', + "amp;": '\U00000026', + "and;": '\U00002227', + "andand;": '\U00002A55', + "andd;": '\U00002A5C', + "andslope;": '\U00002A58', + "andv;": '\U00002A5A', + "ang;": '\U00002220', + "ange;": '\U000029A4', + "angle;": '\U00002220', + "angmsd;": '\U00002221', + "angmsdaa;": '\U000029A8', + "angmsdab;": '\U000029A9', + "angmsdac;": '\U000029AA', + "angmsdad;": '\U000029AB', + "angmsdae;": '\U000029AC', + "angmsdaf;": '\U000029AD', + "angmsdag;": '\U000029AE', + "angmsdah;": '\U000029AF', + "angrt;": '\U0000221F', + "angrtvb;": '\U000022BE', + "angrtvbd;": '\U0000299D', + "angsph;": '\U00002222', + "angst;": '\U000000C5', + "angzarr;": '\U0000237C', + "aogon;": '\U00000105', + "aopf;": '\U0001D552', + "ap;": '\U00002248', + "apE;": '\U00002A70', + "apacir;": '\U00002A6F', + "ape;": '\U0000224A', + "apid;": '\U0000224B', + "apos;": '\U00000027', + "approx;": '\U00002248', + "approxeq;": '\U0000224A', + "aring;": '\U000000E5', + "ascr;": '\U0001D4B6', + "ast;": '\U0000002A', + "asymp;": '\U00002248', + "asympeq;": '\U0000224D', + "atilde;": '\U000000E3', + "auml;": '\U000000E4', + "awconint;": '\U00002233', + "awint;": '\U00002A11', + "bNot;": '\U00002AED', + "backcong;": '\U0000224C', + "backepsilon;": '\U000003F6', + "backprime;": '\U00002035', + "backsim;": '\U0000223D', + "backsimeq;": '\U000022CD', + "barvee;": '\U000022BD', + "barwed;": '\U00002305', + "barwedge;": '\U00002305', + "bbrk;": '\U000023B5', + "bbrktbrk;": '\U000023B6', + "bcong;": '\U0000224C', + "bcy;": '\U00000431', + "bdquo;": '\U0000201E', + "becaus;": '\U00002235', + "because;": '\U00002235', + "bemptyv;": '\U000029B0', + "bepsi;": '\U000003F6', + "bernou;": '\U0000212C', + "beta;": '\U000003B2', + "beth;": '\U00002136', + "between;": '\U0000226C', + "bfr;": '\U0001D51F', + "bigcap;": '\U000022C2', + "bigcirc;": '\U000025EF', + "bigcup;": '\U000022C3', + "bigodot;": '\U00002A00', + "bigoplus;": '\U00002A01', + "bigotimes;": '\U00002A02', + "bigsqcup;": '\U00002A06', + "bigstar;": '\U00002605', + "bigtriangledown;": '\U000025BD', + "bigtriangleup;": '\U000025B3', + "biguplus;": '\U00002A04', + "bigvee;": '\U000022C1', + "bigwedge;": '\U000022C0', + "bkarow;": '\U0000290D', + "blacklozenge;": '\U000029EB', + "blacksquare;": '\U000025AA', + "blacktriangle;": '\U000025B4', + "blacktriangledown;": '\U000025BE', + "blacktriangleleft;": '\U000025C2', + "blacktriangleright;": '\U000025B8', + "blank;": '\U00002423', + "blk12;": '\U00002592', + "blk14;": '\U00002591', + "blk34;": '\U00002593', + "block;": '\U00002588', + "bnot;": '\U00002310', + "bopf;": '\U0001D553', + "bot;": '\U000022A5', + "bottom;": '\U000022A5', + "bowtie;": '\U000022C8', + "boxDL;": '\U00002557', + "boxDR;": '\U00002554', + "boxDl;": '\U00002556', + "boxDr;": '\U00002553', + "boxH;": '\U00002550', + "boxHD;": '\U00002566', + "boxHU;": '\U00002569', + "boxHd;": '\U00002564', + "boxHu;": '\U00002567', + "boxUL;": '\U0000255D', + "boxUR;": '\U0000255A', + "boxUl;": '\U0000255C', + "boxUr;": '\U00002559', + "boxV;": '\U00002551', + "boxVH;": '\U0000256C', + "boxVL;": '\U00002563', + "boxVR;": '\U00002560', + "boxVh;": '\U0000256B', + "boxVl;": '\U00002562', + "boxVr;": '\U0000255F', + "boxbox;": '\U000029C9', + "boxdL;": '\U00002555', + "boxdR;": '\U00002552', + "boxdl;": '\U00002510', + "boxdr;": '\U0000250C', + "boxh;": '\U00002500', + "boxhD;": '\U00002565', + "boxhU;": '\U00002568', + "boxhd;": '\U0000252C', + "boxhu;": '\U00002534', + "boxminus;": '\U0000229F', + "boxplus;": '\U0000229E', + "boxtimes;": '\U000022A0', + "boxuL;": '\U0000255B', + "boxuR;": '\U00002558', + "boxul;": '\U00002518', + "boxur;": '\U00002514', + "boxv;": '\U00002502', + "boxvH;": '\U0000256A', + "boxvL;": '\U00002561', + "boxvR;": '\U0000255E', + "boxvh;": '\U0000253C', + "boxvl;": '\U00002524', + "boxvr;": '\U0000251C', + "bprime;": '\U00002035', + "breve;": '\U000002D8', + "brvbar;": '\U000000A6', + "bscr;": '\U0001D4B7', + "bsemi;": '\U0000204F', + "bsim;": '\U0000223D', + "bsime;": '\U000022CD', + "bsol;": '\U0000005C', + "bsolb;": '\U000029C5', + "bsolhsub;": '\U000027C8', + "bull;": '\U00002022', + "bullet;": '\U00002022', + "bump;": '\U0000224E', + "bumpE;": '\U00002AAE', + "bumpe;": '\U0000224F', + "bumpeq;": '\U0000224F', + "cacute;": '\U00000107', + "cap;": '\U00002229', + "capand;": '\U00002A44', + "capbrcup;": '\U00002A49', + "capcap;": '\U00002A4B', + "capcup;": '\U00002A47', + "capdot;": '\U00002A40', + "caret;": '\U00002041', + "caron;": '\U000002C7', + "ccaps;": '\U00002A4D', + "ccaron;": '\U0000010D', + "ccedil;": '\U000000E7', + "ccirc;": '\U00000109', + "ccups;": '\U00002A4C', + "ccupssm;": '\U00002A50', + "cdot;": '\U0000010B', + "cedil;": '\U000000B8', + "cemptyv;": '\U000029B2', + "cent;": '\U000000A2', + "centerdot;": '\U000000B7', + "cfr;": '\U0001D520', + "chcy;": '\U00000447', + "check;": '\U00002713', + "checkmark;": '\U00002713', + "chi;": '\U000003C7', + "cir;": '\U000025CB', + "cirE;": '\U000029C3', + "circ;": '\U000002C6', + "circeq;": '\U00002257', + "circlearrowleft;": '\U000021BA', + "circlearrowright;": '\U000021BB', + "circledR;": '\U000000AE', + "circledS;": '\U000024C8', + "circledast;": '\U0000229B', + "circledcirc;": '\U0000229A', + "circleddash;": '\U0000229D', + "cire;": '\U00002257', + "cirfnint;": '\U00002A10', + "cirmid;": '\U00002AEF', + "cirscir;": '\U000029C2', + "clubs;": '\U00002663', + "clubsuit;": '\U00002663', + "colon;": '\U0000003A', + "colone;": '\U00002254', + "coloneq;": '\U00002254', + "comma;": '\U0000002C', + "commat;": '\U00000040', + "comp;": '\U00002201', + "compfn;": '\U00002218', + "complement;": '\U00002201', + "complexes;": '\U00002102', + "cong;": '\U00002245', + "congdot;": '\U00002A6D', + "conint;": '\U0000222E', + "copf;": '\U0001D554', + "coprod;": '\U00002210', + "copy;": '\U000000A9', + "copysr;": '\U00002117', + "crarr;": '\U000021B5', + "cross;": '\U00002717', + "cscr;": '\U0001D4B8', + "csub;": '\U00002ACF', + "csube;": '\U00002AD1', + "csup;": '\U00002AD0', + "csupe;": '\U00002AD2', + "ctdot;": '\U000022EF', + "cudarrl;": '\U00002938', + "cudarrr;": '\U00002935', + "cuepr;": '\U000022DE', + "cuesc;": '\U000022DF', + "cularr;": '\U000021B6', + "cularrp;": '\U0000293D', + "cup;": '\U0000222A', + "cupbrcap;": '\U00002A48', + "cupcap;": '\U00002A46', + "cupcup;": '\U00002A4A', + "cupdot;": '\U0000228D', + "cupor;": '\U00002A45', + "curarr;": '\U000021B7', + "curarrm;": '\U0000293C', + "curlyeqprec;": '\U000022DE', + "curlyeqsucc;": '\U000022DF', + "curlyvee;": '\U000022CE', + "curlywedge;": '\U000022CF', + "curren;": '\U000000A4', + "curvearrowleft;": '\U000021B6', + "curvearrowright;": '\U000021B7', + "cuvee;": '\U000022CE', + "cuwed;": '\U000022CF', + "cwconint;": '\U00002232', + "cwint;": '\U00002231', + "cylcty;": '\U0000232D', + "dArr;": '\U000021D3', + "dHar;": '\U00002965', + "dagger;": '\U00002020', + "daleth;": '\U00002138', + "darr;": '\U00002193', + "dash;": '\U00002010', + "dashv;": '\U000022A3', + "dbkarow;": '\U0000290F', + "dblac;": '\U000002DD', + "dcaron;": '\U0000010F', + "dcy;": '\U00000434', + "dd;": '\U00002146', + "ddagger;": '\U00002021', + "ddarr;": '\U000021CA', + "ddotseq;": '\U00002A77', + "deg;": '\U000000B0', + "delta;": '\U000003B4', + "demptyv;": '\U000029B1', + "dfisht;": '\U0000297F', + "dfr;": '\U0001D521', + "dharl;": '\U000021C3', + "dharr;": '\U000021C2', + "diam;": '\U000022C4', + "diamond;": '\U000022C4', + "diamondsuit;": '\U00002666', + "diams;": '\U00002666', + "die;": '\U000000A8', + "digamma;": '\U000003DD', + "disin;": '\U000022F2', + "div;": '\U000000F7', + "divide;": '\U000000F7', + "divideontimes;": '\U000022C7', + "divonx;": '\U000022C7', + "djcy;": '\U00000452', + "dlcorn;": '\U0000231E', + "dlcrop;": '\U0000230D', + "dollar;": '\U00000024', + "dopf;": '\U0001D555', + "dot;": '\U000002D9', + "doteq;": '\U00002250', + "doteqdot;": '\U00002251', + "dotminus;": '\U00002238', + "dotplus;": '\U00002214', + "dotsquare;": '\U000022A1', + "doublebarwedge;": '\U00002306', + "downarrow;": '\U00002193', + "downdownarrows;": '\U000021CA', + "downharpoonleft;": '\U000021C3', + "downharpoonright;": '\U000021C2', + "drbkarow;": '\U00002910', + "drcorn;": '\U0000231F', + "drcrop;": '\U0000230C', + "dscr;": '\U0001D4B9', + "dscy;": '\U00000455', + "dsol;": '\U000029F6', + "dstrok;": '\U00000111', + "dtdot;": '\U000022F1', + "dtri;": '\U000025BF', + "dtrif;": '\U000025BE', + "duarr;": '\U000021F5', + "duhar;": '\U0000296F', + "dwangle;": '\U000029A6', + "dzcy;": '\U0000045F', + "dzigrarr;": '\U000027FF', + "eDDot;": '\U00002A77', + "eDot;": '\U00002251', + "eacute;": '\U000000E9', + "easter;": '\U00002A6E', + "ecaron;": '\U0000011B', + "ecir;": '\U00002256', + "ecirc;": '\U000000EA', + "ecolon;": '\U00002255', + "ecy;": '\U0000044D', + "edot;": '\U00000117', + "ee;": '\U00002147', + "efDot;": '\U00002252', + "efr;": '\U0001D522', + "eg;": '\U00002A9A', + "egrave;": '\U000000E8', + "egs;": '\U00002A96', + "egsdot;": '\U00002A98', + "el;": '\U00002A99', + "elinters;": '\U000023E7', + "ell;": '\U00002113', + "els;": '\U00002A95', + "elsdot;": '\U00002A97', + "emacr;": '\U00000113', + "empty;": '\U00002205', + "emptyset;": '\U00002205', + "emptyv;": '\U00002205', + "emsp;": '\U00002003', + "emsp13;": '\U00002004', + "emsp14;": '\U00002005', + "eng;": '\U0000014B', + "ensp;": '\U00002002', + "eogon;": '\U00000119', + "eopf;": '\U0001D556', + "epar;": '\U000022D5', + "eparsl;": '\U000029E3', + "eplus;": '\U00002A71', + "epsi;": '\U000003B5', + "epsilon;": '\U000003B5', + "epsiv;": '\U000003F5', + "eqcirc;": '\U00002256', + "eqcolon;": '\U00002255', + "eqsim;": '\U00002242', + "eqslantgtr;": '\U00002A96', + "eqslantless;": '\U00002A95', + "equals;": '\U0000003D', + "equest;": '\U0000225F', + "equiv;": '\U00002261', + "equivDD;": '\U00002A78', + "eqvparsl;": '\U000029E5', + "erDot;": '\U00002253', + "erarr;": '\U00002971', + "escr;": '\U0000212F', + "esdot;": '\U00002250', + "esim;": '\U00002242', + "eta;": '\U000003B7', + "eth;": '\U000000F0', + "euml;": '\U000000EB', + "euro;": '\U000020AC', + "excl;": '\U00000021', + "exist;": '\U00002203', + "expectation;": '\U00002130', + "exponentiale;": '\U00002147', + "fallingdotseq;": '\U00002252', + "fcy;": '\U00000444', + "female;": '\U00002640', + "ffilig;": '\U0000FB03', + "fflig;": '\U0000FB00', + "ffllig;": '\U0000FB04', + "ffr;": '\U0001D523', + "filig;": '\U0000FB01', + "flat;": '\U0000266D', + "fllig;": '\U0000FB02', + "fltns;": '\U000025B1', + "fnof;": '\U00000192', + "fopf;": '\U0001D557', + "forall;": '\U00002200', + "fork;": '\U000022D4', + "forkv;": '\U00002AD9', + "fpartint;": '\U00002A0D', + "frac12;": '\U000000BD', + "frac13;": '\U00002153', + "frac14;": '\U000000BC', + "frac15;": '\U00002155', + "frac16;": '\U00002159', + "frac18;": '\U0000215B', + "frac23;": '\U00002154', + "frac25;": '\U00002156', + "frac34;": '\U000000BE', + "frac35;": '\U00002157', + "frac38;": '\U0000215C', + "frac45;": '\U00002158', + "frac56;": '\U0000215A', + "frac58;": '\U0000215D', + "frac78;": '\U0000215E', + "frasl;": '\U00002044', + "frown;": '\U00002322', + "fscr;": '\U0001D4BB', + "gE;": '\U00002267', + "gEl;": '\U00002A8C', + "gacute;": '\U000001F5', + "gamma;": '\U000003B3', + "gammad;": '\U000003DD', + "gap;": '\U00002A86', + "gbreve;": '\U0000011F', + "gcirc;": '\U0000011D', + "gcy;": '\U00000433', + "gdot;": '\U00000121', + "ge;": '\U00002265', + "gel;": '\U000022DB', + "geq;": '\U00002265', + "geqq;": '\U00002267', + "geqslant;": '\U00002A7E', + "ges;": '\U00002A7E', + "gescc;": '\U00002AA9', + "gesdot;": '\U00002A80', + "gesdoto;": '\U00002A82', + "gesdotol;": '\U00002A84', + "gesles;": '\U00002A94', + "gfr;": '\U0001D524', + "gg;": '\U0000226B', + "ggg;": '\U000022D9', + "gimel;": '\U00002137', + "gjcy;": '\U00000453', + "gl;": '\U00002277', + "glE;": '\U00002A92', + "gla;": '\U00002AA5', + "glj;": '\U00002AA4', + "gnE;": '\U00002269', + "gnap;": '\U00002A8A', + "gnapprox;": '\U00002A8A', + "gne;": '\U00002A88', + "gneq;": '\U00002A88', + "gneqq;": '\U00002269', + "gnsim;": '\U000022E7', + "gopf;": '\U0001D558', + "grave;": '\U00000060', + "gscr;": '\U0000210A', + "gsim;": '\U00002273', + "gsime;": '\U00002A8E', + "gsiml;": '\U00002A90', + "gt;": '\U0000003E', + "gtcc;": '\U00002AA7', + "gtcir;": '\U00002A7A', + "gtdot;": '\U000022D7', + "gtlPar;": '\U00002995', + "gtquest;": '\U00002A7C', + "gtrapprox;": '\U00002A86', + "gtrarr;": '\U00002978', + "gtrdot;": '\U000022D7', + "gtreqless;": '\U000022DB', + "gtreqqless;": '\U00002A8C', + "gtrless;": '\U00002277', + "gtrsim;": '\U00002273', + "hArr;": '\U000021D4', + "hairsp;": '\U0000200A', + "half;": '\U000000BD', + "hamilt;": '\U0000210B', + "hardcy;": '\U0000044A', + "harr;": '\U00002194', + "harrcir;": '\U00002948', + "harrw;": '\U000021AD', + "hbar;": '\U0000210F', + "hcirc;": '\U00000125', + "hearts;": '\U00002665', + "heartsuit;": '\U00002665', + "hellip;": '\U00002026', + "hercon;": '\U000022B9', + "hfr;": '\U0001D525', + "hksearow;": '\U00002925', + "hkswarow;": '\U00002926', + "hoarr;": '\U000021FF', + "homtht;": '\U0000223B', + "hookleftarrow;": '\U000021A9', + "hookrightarrow;": '\U000021AA', + "hopf;": '\U0001D559', + "horbar;": '\U00002015', + "hscr;": '\U0001D4BD', + "hslash;": '\U0000210F', + "hstrok;": '\U00000127', + "hybull;": '\U00002043', + "hyphen;": '\U00002010', + "iacute;": '\U000000ED', + "ic;": '\U00002063', + "icirc;": '\U000000EE', + "icy;": '\U00000438', + "iecy;": '\U00000435', + "iexcl;": '\U000000A1', + "iff;": '\U000021D4', + "ifr;": '\U0001D526', + "igrave;": '\U000000EC', + "ii;": '\U00002148', + "iiiint;": '\U00002A0C', + "iiint;": '\U0000222D', + "iinfin;": '\U000029DC', + "iiota;": '\U00002129', + "ijlig;": '\U00000133', + "imacr;": '\U0000012B', + "image;": '\U00002111', + "imagline;": '\U00002110', + "imagpart;": '\U00002111', + "imath;": '\U00000131', + "imof;": '\U000022B7', + "imped;": '\U000001B5', + "in;": '\U00002208', + "incare;": '\U00002105', + "infin;": '\U0000221E', + "infintie;": '\U000029DD', + "inodot;": '\U00000131', + "int;": '\U0000222B', + "intcal;": '\U000022BA', + "integers;": '\U00002124', + "intercal;": '\U000022BA', + "intlarhk;": '\U00002A17', + "intprod;": '\U00002A3C', + "iocy;": '\U00000451', + "iogon;": '\U0000012F', + "iopf;": '\U0001D55A', + "iota;": '\U000003B9', + "iprod;": '\U00002A3C', + "iquest;": '\U000000BF', + "iscr;": '\U0001D4BE', + "isin;": '\U00002208', + "isinE;": '\U000022F9', + "isindot;": '\U000022F5', + "isins;": '\U000022F4', + "isinsv;": '\U000022F3', + "isinv;": '\U00002208', + "it;": '\U00002062', + "itilde;": '\U00000129', + "iukcy;": '\U00000456', + "iuml;": '\U000000EF', + "jcirc;": '\U00000135', + "jcy;": '\U00000439', + "jfr;": '\U0001D527', + "jmath;": '\U00000237', + "jopf;": '\U0001D55B', + "jscr;": '\U0001D4BF', + "jsercy;": '\U00000458', + "jukcy;": '\U00000454', + "kappa;": '\U000003BA', + "kappav;": '\U000003F0', + "kcedil;": '\U00000137', + "kcy;": '\U0000043A', + "kfr;": '\U0001D528', + "kgreen;": '\U00000138', + "khcy;": '\U00000445', + "kjcy;": '\U0000045C', + "kopf;": '\U0001D55C', + "kscr;": '\U0001D4C0', + "lAarr;": '\U000021DA', + "lArr;": '\U000021D0', + "lAtail;": '\U0000291B', + "lBarr;": '\U0000290E', + "lE;": '\U00002266', + "lEg;": '\U00002A8B', + "lHar;": '\U00002962', + "lacute;": '\U0000013A', + "laemptyv;": '\U000029B4', + "lagran;": '\U00002112', + "lambda;": '\U000003BB', + "lang;": '\U000027E8', + "langd;": '\U00002991', + "langle;": '\U000027E8', + "lap;": '\U00002A85', + "laquo;": '\U000000AB', + "larr;": '\U00002190', + "larrb;": '\U000021E4', + "larrbfs;": '\U0000291F', + "larrfs;": '\U0000291D', + "larrhk;": '\U000021A9', + "larrlp;": '\U000021AB', + "larrpl;": '\U00002939', + "larrsim;": '\U00002973', + "larrtl;": '\U000021A2', + "lat;": '\U00002AAB', + "latail;": '\U00002919', + "late;": '\U00002AAD', + "lbarr;": '\U0000290C', + "lbbrk;": '\U00002772', + "lbrace;": '\U0000007B', + "lbrack;": '\U0000005B', + "lbrke;": '\U0000298B', + "lbrksld;": '\U0000298F', + "lbrkslu;": '\U0000298D', + "lcaron;": '\U0000013E', + "lcedil;": '\U0000013C', + "lceil;": '\U00002308', + "lcub;": '\U0000007B', + "lcy;": '\U0000043B', + "ldca;": '\U00002936', + "ldquo;": '\U0000201C', + "ldquor;": '\U0000201E', + "ldrdhar;": '\U00002967', + "ldrushar;": '\U0000294B', + "ldsh;": '\U000021B2', + "le;": '\U00002264', + "leftarrow;": '\U00002190', + "leftarrowtail;": '\U000021A2', + "leftharpoondown;": '\U000021BD', + "leftharpoonup;": '\U000021BC', + "leftleftarrows;": '\U000021C7', + "leftrightarrow;": '\U00002194', + "leftrightarrows;": '\U000021C6', + "leftrightharpoons;": '\U000021CB', + "leftrightsquigarrow;": '\U000021AD', + "leftthreetimes;": '\U000022CB', + "leg;": '\U000022DA', + "leq;": '\U00002264', + "leqq;": '\U00002266', + "leqslant;": '\U00002A7D', + "les;": '\U00002A7D', + "lescc;": '\U00002AA8', + "lesdot;": '\U00002A7F', + "lesdoto;": '\U00002A81', + "lesdotor;": '\U00002A83', + "lesges;": '\U00002A93', + "lessapprox;": '\U00002A85', + "lessdot;": '\U000022D6', + "lesseqgtr;": '\U000022DA', + "lesseqqgtr;": '\U00002A8B', + "lessgtr;": '\U00002276', + "lesssim;": '\U00002272', + "lfisht;": '\U0000297C', + "lfloor;": '\U0000230A', + "lfr;": '\U0001D529', + "lg;": '\U00002276', + "lgE;": '\U00002A91', + "lhard;": '\U000021BD', + "lharu;": '\U000021BC', + "lharul;": '\U0000296A', + "lhblk;": '\U00002584', + "ljcy;": '\U00000459', + "ll;": '\U0000226A', + "llarr;": '\U000021C7', + "llcorner;": '\U0000231E', + "llhard;": '\U0000296B', + "lltri;": '\U000025FA', + "lmidot;": '\U00000140', + "lmoust;": '\U000023B0', + "lmoustache;": '\U000023B0', + "lnE;": '\U00002268', + "lnap;": '\U00002A89', + "lnapprox;": '\U00002A89', + "lne;": '\U00002A87', + "lneq;": '\U00002A87', + "lneqq;": '\U00002268', + "lnsim;": '\U000022E6', + "loang;": '\U000027EC', + "loarr;": '\U000021FD', + "lobrk;": '\U000027E6', + "longleftarrow;": '\U000027F5', + "longleftrightarrow;": '\U000027F7', + "longmapsto;": '\U000027FC', + "longrightarrow;": '\U000027F6', + "looparrowleft;": '\U000021AB', + "looparrowright;": '\U000021AC', + "lopar;": '\U00002985', + "lopf;": '\U0001D55D', + "loplus;": '\U00002A2D', + "lotimes;": '\U00002A34', + "lowast;": '\U00002217', + "lowbar;": '\U0000005F', + "loz;": '\U000025CA', + "lozenge;": '\U000025CA', + "lozf;": '\U000029EB', + "lpar;": '\U00000028', + "lparlt;": '\U00002993', + "lrarr;": '\U000021C6', + "lrcorner;": '\U0000231F', + "lrhar;": '\U000021CB', + "lrhard;": '\U0000296D', + "lrm;": '\U0000200E', + "lrtri;": '\U000022BF', + "lsaquo;": '\U00002039', + "lscr;": '\U0001D4C1', + "lsh;": '\U000021B0', + "lsim;": '\U00002272', + "lsime;": '\U00002A8D', + "lsimg;": '\U00002A8F', + "lsqb;": '\U0000005B', + "lsquo;": '\U00002018', + "lsquor;": '\U0000201A', + "lstrok;": '\U00000142', + "lt;": '\U0000003C', + "ltcc;": '\U00002AA6', + "ltcir;": '\U00002A79', + "ltdot;": '\U000022D6', + "lthree;": '\U000022CB', + "ltimes;": '\U000022C9', + "ltlarr;": '\U00002976', + "ltquest;": '\U00002A7B', + "ltrPar;": '\U00002996', + "ltri;": '\U000025C3', + "ltrie;": '\U000022B4', + "ltrif;": '\U000025C2', + "lurdshar;": '\U0000294A', + "luruhar;": '\U00002966', + "mDDot;": '\U0000223A', + "macr;": '\U000000AF', + "male;": '\U00002642', + "malt;": '\U00002720', + "maltese;": '\U00002720', + "map;": '\U000021A6', + "mapsto;": '\U000021A6', + "mapstodown;": '\U000021A7', + "mapstoleft;": '\U000021A4', + "mapstoup;": '\U000021A5', + "marker;": '\U000025AE', + "mcomma;": '\U00002A29', + "mcy;": '\U0000043C', + "mdash;": '\U00002014', + "measuredangle;": '\U00002221', + "mfr;": '\U0001D52A', + "mho;": '\U00002127', + "micro;": '\U000000B5', + "mid;": '\U00002223', + "midast;": '\U0000002A', + "midcir;": '\U00002AF0', + "middot;": '\U000000B7', + "minus;": '\U00002212', + "minusb;": '\U0000229F', + "minusd;": '\U00002238', + "minusdu;": '\U00002A2A', + "mlcp;": '\U00002ADB', + "mldr;": '\U00002026', + "mnplus;": '\U00002213', + "models;": '\U000022A7', + "mopf;": '\U0001D55E', + "mp;": '\U00002213', + "mscr;": '\U0001D4C2', + "mstpos;": '\U0000223E', + "mu;": '\U000003BC', + "multimap;": '\U000022B8', + "mumap;": '\U000022B8', + "nLeftarrow;": '\U000021CD', + "nLeftrightarrow;": '\U000021CE', + "nRightarrow;": '\U000021CF', + "nVDash;": '\U000022AF', + "nVdash;": '\U000022AE', + "nabla;": '\U00002207', + "nacute;": '\U00000144', + "nap;": '\U00002249', + "napos;": '\U00000149', + "napprox;": '\U00002249', + "natur;": '\U0000266E', + "natural;": '\U0000266E', + "naturals;": '\U00002115', + "nbsp;": '\U000000A0', + "ncap;": '\U00002A43', + "ncaron;": '\U00000148', + "ncedil;": '\U00000146', + "ncong;": '\U00002247', + "ncup;": '\U00002A42', + "ncy;": '\U0000043D', + "ndash;": '\U00002013', + "ne;": '\U00002260', + "neArr;": '\U000021D7', + "nearhk;": '\U00002924', + "nearr;": '\U00002197', + "nearrow;": '\U00002197', + "nequiv;": '\U00002262', + "nesear;": '\U00002928', + "nexist;": '\U00002204', + "nexists;": '\U00002204', + "nfr;": '\U0001D52B', + "nge;": '\U00002271', + "ngeq;": '\U00002271', + "ngsim;": '\U00002275', + "ngt;": '\U0000226F', + "ngtr;": '\U0000226F', + "nhArr;": '\U000021CE', + "nharr;": '\U000021AE', + "nhpar;": '\U00002AF2', + "ni;": '\U0000220B', + "nis;": '\U000022FC', + "nisd;": '\U000022FA', + "niv;": '\U0000220B', + "njcy;": '\U0000045A', + "nlArr;": '\U000021CD', + "nlarr;": '\U0000219A', + "nldr;": '\U00002025', + "nle;": '\U00002270', + "nleftarrow;": '\U0000219A', + "nleftrightarrow;": '\U000021AE', + "nleq;": '\U00002270', + "nless;": '\U0000226E', + "nlsim;": '\U00002274', + "nlt;": '\U0000226E', + "nltri;": '\U000022EA', + "nltrie;": '\U000022EC', + "nmid;": '\U00002224', + "nopf;": '\U0001D55F', + "not;": '\U000000AC', + "notin;": '\U00002209', + "notinva;": '\U00002209', + "notinvb;": '\U000022F7', + "notinvc;": '\U000022F6', + "notni;": '\U0000220C', + "notniva;": '\U0000220C', + "notnivb;": '\U000022FE', + "notnivc;": '\U000022FD', + "npar;": '\U00002226', + "nparallel;": '\U00002226', + "npolint;": '\U00002A14', + "npr;": '\U00002280', + "nprcue;": '\U000022E0', + "nprec;": '\U00002280', + "nrArr;": '\U000021CF', + "nrarr;": '\U0000219B', + "nrightarrow;": '\U0000219B', + "nrtri;": '\U000022EB', + "nrtrie;": '\U000022ED', + "nsc;": '\U00002281', + "nsccue;": '\U000022E1', + "nscr;": '\U0001D4C3', + "nshortmid;": '\U00002224', + "nshortparallel;": '\U00002226', + "nsim;": '\U00002241', + "nsime;": '\U00002244', + "nsimeq;": '\U00002244', + "nsmid;": '\U00002224', + "nspar;": '\U00002226', + "nsqsube;": '\U000022E2', + "nsqsupe;": '\U000022E3', + "nsub;": '\U00002284', + "nsube;": '\U00002288', + "nsubseteq;": '\U00002288', + "nsucc;": '\U00002281', + "nsup;": '\U00002285', + "nsupe;": '\U00002289', + "nsupseteq;": '\U00002289', + "ntgl;": '\U00002279', + "ntilde;": '\U000000F1', + "ntlg;": '\U00002278', + "ntriangleleft;": '\U000022EA', + "ntrianglelefteq;": '\U000022EC', + "ntriangleright;": '\U000022EB', + "ntrianglerighteq;": '\U000022ED', + "nu;": '\U000003BD', + "num;": '\U00000023', + "numero;": '\U00002116', + "numsp;": '\U00002007', + "nvDash;": '\U000022AD', + "nvHarr;": '\U00002904', + "nvdash;": '\U000022AC', + "nvinfin;": '\U000029DE', + "nvlArr;": '\U00002902', + "nvrArr;": '\U00002903', + "nwArr;": '\U000021D6', + "nwarhk;": '\U00002923', + "nwarr;": '\U00002196', + "nwarrow;": '\U00002196', + "nwnear;": '\U00002927', + "oS;": '\U000024C8', + "oacute;": '\U000000F3', + "oast;": '\U0000229B', + "ocir;": '\U0000229A', + "ocirc;": '\U000000F4', + "ocy;": '\U0000043E', + "odash;": '\U0000229D', + "odblac;": '\U00000151', + "odiv;": '\U00002A38', + "odot;": '\U00002299', + "odsold;": '\U000029BC', + "oelig;": '\U00000153', + "ofcir;": '\U000029BF', + "ofr;": '\U0001D52C', + "ogon;": '\U000002DB', + "ograve;": '\U000000F2', + "ogt;": '\U000029C1', + "ohbar;": '\U000029B5', + "ohm;": '\U000003A9', + "oint;": '\U0000222E', + "olarr;": '\U000021BA', + "olcir;": '\U000029BE', + "olcross;": '\U000029BB', + "oline;": '\U0000203E', + "olt;": '\U000029C0', + "omacr;": '\U0000014D', + "omega;": '\U000003C9', + "omicron;": '\U000003BF', + "omid;": '\U000029B6', + "ominus;": '\U00002296', + "oopf;": '\U0001D560', + "opar;": '\U000029B7', + "operp;": '\U000029B9', + "oplus;": '\U00002295', + "or;": '\U00002228', + "orarr;": '\U000021BB', + "ord;": '\U00002A5D', + "order;": '\U00002134', + "orderof;": '\U00002134', + "ordf;": '\U000000AA', + "ordm;": '\U000000BA', + "origof;": '\U000022B6', + "oror;": '\U00002A56', + "orslope;": '\U00002A57', + "orv;": '\U00002A5B', + "oscr;": '\U00002134', + "oslash;": '\U000000F8', + "osol;": '\U00002298', + "otilde;": '\U000000F5', + "otimes;": '\U00002297', + "otimesas;": '\U00002A36', + "ouml;": '\U000000F6', + "ovbar;": '\U0000233D', + "par;": '\U00002225', + "para;": '\U000000B6', + "parallel;": '\U00002225', + "parsim;": '\U00002AF3', + "parsl;": '\U00002AFD', + "part;": '\U00002202', + "pcy;": '\U0000043F', + "percnt;": '\U00000025', + "period;": '\U0000002E', + "permil;": '\U00002030', + "perp;": '\U000022A5', + "pertenk;": '\U00002031', + "pfr;": '\U0001D52D', + "phi;": '\U000003C6', + "phiv;": '\U000003D5', + "phmmat;": '\U00002133', + "phone;": '\U0000260E', + "pi;": '\U000003C0', + "pitchfork;": '\U000022D4', + "piv;": '\U000003D6', + "planck;": '\U0000210F', + "planckh;": '\U0000210E', + "plankv;": '\U0000210F', + "plus;": '\U0000002B', + "plusacir;": '\U00002A23', + "plusb;": '\U0000229E', + "pluscir;": '\U00002A22', + "plusdo;": '\U00002214', + "plusdu;": '\U00002A25', + "pluse;": '\U00002A72', + "plusmn;": '\U000000B1', + "plussim;": '\U00002A26', + "plustwo;": '\U00002A27', + "pm;": '\U000000B1', + "pointint;": '\U00002A15', + "popf;": '\U0001D561', + "pound;": '\U000000A3', + "pr;": '\U0000227A', + "prE;": '\U00002AB3', + "prap;": '\U00002AB7', + "prcue;": '\U0000227C', + "pre;": '\U00002AAF', + "prec;": '\U0000227A', + "precapprox;": '\U00002AB7', + "preccurlyeq;": '\U0000227C', + "preceq;": '\U00002AAF', + "precnapprox;": '\U00002AB9', + "precneqq;": '\U00002AB5', + "precnsim;": '\U000022E8', + "precsim;": '\U0000227E', + "prime;": '\U00002032', + "primes;": '\U00002119', + "prnE;": '\U00002AB5', + "prnap;": '\U00002AB9', + "prnsim;": '\U000022E8', + "prod;": '\U0000220F', + "profalar;": '\U0000232E', + "profline;": '\U00002312', + "profsurf;": '\U00002313', + "prop;": '\U0000221D', + "propto;": '\U0000221D', + "prsim;": '\U0000227E', + "prurel;": '\U000022B0', + "pscr;": '\U0001D4C5', + "psi;": '\U000003C8', + "puncsp;": '\U00002008', + "qfr;": '\U0001D52E', + "qint;": '\U00002A0C', + "qopf;": '\U0001D562', + "qprime;": '\U00002057', + "qscr;": '\U0001D4C6', + "quaternions;": '\U0000210D', + "quatint;": '\U00002A16', + "quest;": '\U0000003F', + "questeq;": '\U0000225F', + "quot;": '\U00000022', + "rAarr;": '\U000021DB', + "rArr;": '\U000021D2', + "rAtail;": '\U0000291C', + "rBarr;": '\U0000290F', + "rHar;": '\U00002964', + "racute;": '\U00000155', + "radic;": '\U0000221A', + "raemptyv;": '\U000029B3', + "rang;": '\U000027E9', + "rangd;": '\U00002992', + "range;": '\U000029A5', + "rangle;": '\U000027E9', + "raquo;": '\U000000BB', + "rarr;": '\U00002192', + "rarrap;": '\U00002975', + "rarrb;": '\U000021E5', + "rarrbfs;": '\U00002920', + "rarrc;": '\U00002933', + "rarrfs;": '\U0000291E', + "rarrhk;": '\U000021AA', + "rarrlp;": '\U000021AC', + "rarrpl;": '\U00002945', + "rarrsim;": '\U00002974', + "rarrtl;": '\U000021A3', + "rarrw;": '\U0000219D', + "ratail;": '\U0000291A', + "ratio;": '\U00002236', + "rationals;": '\U0000211A', + "rbarr;": '\U0000290D', + "rbbrk;": '\U00002773', + "rbrace;": '\U0000007D', + "rbrack;": '\U0000005D', + "rbrke;": '\U0000298C', + "rbrksld;": '\U0000298E', + "rbrkslu;": '\U00002990', + "rcaron;": '\U00000159', + "rcedil;": '\U00000157', + "rceil;": '\U00002309', + "rcub;": '\U0000007D', + "rcy;": '\U00000440', + "rdca;": '\U00002937', + "rdldhar;": '\U00002969', + "rdquo;": '\U0000201D', + "rdquor;": '\U0000201D', + "rdsh;": '\U000021B3', + "real;": '\U0000211C', + "realine;": '\U0000211B', + "realpart;": '\U0000211C', + "reals;": '\U0000211D', + "rect;": '\U000025AD', + "reg;": '\U000000AE', + "rfisht;": '\U0000297D', + "rfloor;": '\U0000230B', + "rfr;": '\U0001D52F', + "rhard;": '\U000021C1', + "rharu;": '\U000021C0', + "rharul;": '\U0000296C', + "rho;": '\U000003C1', + "rhov;": '\U000003F1', + "rightarrow;": '\U00002192', + "rightarrowtail;": '\U000021A3', + "rightharpoondown;": '\U000021C1', + "rightharpoonup;": '\U000021C0', + "rightleftarrows;": '\U000021C4', + "rightleftharpoons;": '\U000021CC', + "rightrightarrows;": '\U000021C9', + "rightsquigarrow;": '\U0000219D', + "rightthreetimes;": '\U000022CC', + "ring;": '\U000002DA', + "risingdotseq;": '\U00002253', + "rlarr;": '\U000021C4', + "rlhar;": '\U000021CC', + "rlm;": '\U0000200F', + "rmoust;": '\U000023B1', + "rmoustache;": '\U000023B1', + "rnmid;": '\U00002AEE', + "roang;": '\U000027ED', + "roarr;": '\U000021FE', + "robrk;": '\U000027E7', + "ropar;": '\U00002986', + "ropf;": '\U0001D563', + "roplus;": '\U00002A2E', + "rotimes;": '\U00002A35', + "rpar;": '\U00000029', + "rpargt;": '\U00002994', + "rppolint;": '\U00002A12', + "rrarr;": '\U000021C9', + "rsaquo;": '\U0000203A', + "rscr;": '\U0001D4C7', + "rsh;": '\U000021B1', + "rsqb;": '\U0000005D', + "rsquo;": '\U00002019', + "rsquor;": '\U00002019', + "rthree;": '\U000022CC', + "rtimes;": '\U000022CA', + "rtri;": '\U000025B9', + "rtrie;": '\U000022B5', + "rtrif;": '\U000025B8', + "rtriltri;": '\U000029CE', + "ruluhar;": '\U00002968', + "rx;": '\U0000211E', + "sacute;": '\U0000015B', + "sbquo;": '\U0000201A', + "sc;": '\U0000227B', + "scE;": '\U00002AB4', + "scap;": '\U00002AB8', + "scaron;": '\U00000161', + "sccue;": '\U0000227D', + "sce;": '\U00002AB0', + "scedil;": '\U0000015F', + "scirc;": '\U0000015D', + "scnE;": '\U00002AB6', + "scnap;": '\U00002ABA', + "scnsim;": '\U000022E9', + "scpolint;": '\U00002A13', + "scsim;": '\U0000227F', + "scy;": '\U00000441', + "sdot;": '\U000022C5', + "sdotb;": '\U000022A1', + "sdote;": '\U00002A66', + "seArr;": '\U000021D8', + "searhk;": '\U00002925', + "searr;": '\U00002198', + "searrow;": '\U00002198', + "sect;": '\U000000A7', + "semi;": '\U0000003B', + "seswar;": '\U00002929', + "setminus;": '\U00002216', + "setmn;": '\U00002216', + "sext;": '\U00002736', + "sfr;": '\U0001D530', + "sfrown;": '\U00002322', + "sharp;": '\U0000266F', + "shchcy;": '\U00000449', + "shcy;": '\U00000448', + "shortmid;": '\U00002223', + "shortparallel;": '\U00002225', + "shy;": '\U000000AD', + "sigma;": '\U000003C3', + "sigmaf;": '\U000003C2', + "sigmav;": '\U000003C2', + "sim;": '\U0000223C', + "simdot;": '\U00002A6A', + "sime;": '\U00002243', + "simeq;": '\U00002243', + "simg;": '\U00002A9E', + "simgE;": '\U00002AA0', + "siml;": '\U00002A9D', + "simlE;": '\U00002A9F', + "simne;": '\U00002246', + "simplus;": '\U00002A24', + "simrarr;": '\U00002972', + "slarr;": '\U00002190', + "smallsetminus;": '\U00002216', + "smashp;": '\U00002A33', + "smeparsl;": '\U000029E4', + "smid;": '\U00002223', + "smile;": '\U00002323', + "smt;": '\U00002AAA', + "smte;": '\U00002AAC', + "softcy;": '\U0000044C', + "sol;": '\U0000002F', + "solb;": '\U000029C4', + "solbar;": '\U0000233F', + "sopf;": '\U0001D564', + "spades;": '\U00002660', + "spadesuit;": '\U00002660', + "spar;": '\U00002225', + "sqcap;": '\U00002293', + "sqcup;": '\U00002294', + "sqsub;": '\U0000228F', + "sqsube;": '\U00002291', + "sqsubset;": '\U0000228F', + "sqsubseteq;": '\U00002291', + "sqsup;": '\U00002290', + "sqsupe;": '\U00002292', + "sqsupset;": '\U00002290', + "sqsupseteq;": '\U00002292', + "squ;": '\U000025A1', + "square;": '\U000025A1', + "squarf;": '\U000025AA', + "squf;": '\U000025AA', + "srarr;": '\U00002192', + "sscr;": '\U0001D4C8', + "ssetmn;": '\U00002216', + "ssmile;": '\U00002323', + "sstarf;": '\U000022C6', + "star;": '\U00002606', + "starf;": '\U00002605', + "straightepsilon;": '\U000003F5', + "straightphi;": '\U000003D5', + "strns;": '\U000000AF', + "sub;": '\U00002282', + "subE;": '\U00002AC5', + "subdot;": '\U00002ABD', + "sube;": '\U00002286', + "subedot;": '\U00002AC3', + "submult;": '\U00002AC1', + "subnE;": '\U00002ACB', + "subne;": '\U0000228A', + "subplus;": '\U00002ABF', + "subrarr;": '\U00002979', + "subset;": '\U00002282', + "subseteq;": '\U00002286', + "subseteqq;": '\U00002AC5', + "subsetneq;": '\U0000228A', + "subsetneqq;": '\U00002ACB', + "subsim;": '\U00002AC7', + "subsub;": '\U00002AD5', + "subsup;": '\U00002AD3', + "succ;": '\U0000227B', + "succapprox;": '\U00002AB8', + "succcurlyeq;": '\U0000227D', + "succeq;": '\U00002AB0', + "succnapprox;": '\U00002ABA', + "succneqq;": '\U00002AB6', + "succnsim;": '\U000022E9', + "succsim;": '\U0000227F', + "sum;": '\U00002211', + "sung;": '\U0000266A', + "sup;": '\U00002283', + "sup1;": '\U000000B9', + "sup2;": '\U000000B2', + "sup3;": '\U000000B3', + "supE;": '\U00002AC6', + "supdot;": '\U00002ABE', + "supdsub;": '\U00002AD8', + "supe;": '\U00002287', + "supedot;": '\U00002AC4', + "suphsol;": '\U000027C9', + "suphsub;": '\U00002AD7', + "suplarr;": '\U0000297B', + "supmult;": '\U00002AC2', + "supnE;": '\U00002ACC', + "supne;": '\U0000228B', + "supplus;": '\U00002AC0', + "supset;": '\U00002283', + "supseteq;": '\U00002287', + "supseteqq;": '\U00002AC6', + "supsetneq;": '\U0000228B', + "supsetneqq;": '\U00002ACC', + "supsim;": '\U00002AC8', + "supsub;": '\U00002AD4', + "supsup;": '\U00002AD6', + "swArr;": '\U000021D9', + "swarhk;": '\U00002926', + "swarr;": '\U00002199', + "swarrow;": '\U00002199', + "swnwar;": '\U0000292A', + "szlig;": '\U000000DF', + "target;": '\U00002316', + "tau;": '\U000003C4', + "tbrk;": '\U000023B4', + "tcaron;": '\U00000165', + "tcedil;": '\U00000163', + "tcy;": '\U00000442', + "tdot;": '\U000020DB', + "telrec;": '\U00002315', + "tfr;": '\U0001D531', + "there4;": '\U00002234', + "therefore;": '\U00002234', + "theta;": '\U000003B8', + "thetasym;": '\U000003D1', + "thetav;": '\U000003D1', + "thickapprox;": '\U00002248', + "thicksim;": '\U0000223C', + "thinsp;": '\U00002009', + "thkap;": '\U00002248', + "thksim;": '\U0000223C', + "thorn;": '\U000000FE', + "tilde;": '\U000002DC', + "times;": '\U000000D7', + "timesb;": '\U000022A0', + "timesbar;": '\U00002A31', + "timesd;": '\U00002A30', + "tint;": '\U0000222D', + "toea;": '\U00002928', + "top;": '\U000022A4', + "topbot;": '\U00002336', + "topcir;": '\U00002AF1', + "topf;": '\U0001D565', + "topfork;": '\U00002ADA', + "tosa;": '\U00002929', + "tprime;": '\U00002034', + "trade;": '\U00002122', + "triangle;": '\U000025B5', + "triangledown;": '\U000025BF', + "triangleleft;": '\U000025C3', + "trianglelefteq;": '\U000022B4', + "triangleq;": '\U0000225C', + "triangleright;": '\U000025B9', + "trianglerighteq;": '\U000022B5', + "tridot;": '\U000025EC', + "trie;": '\U0000225C', + "triminus;": '\U00002A3A', + "triplus;": '\U00002A39', + "trisb;": '\U000029CD', + "tritime;": '\U00002A3B', + "trpezium;": '\U000023E2', + "tscr;": '\U0001D4C9', + "tscy;": '\U00000446', + "tshcy;": '\U0000045B', + "tstrok;": '\U00000167', + "twixt;": '\U0000226C', + "twoheadleftarrow;": '\U0000219E', + "twoheadrightarrow;": '\U000021A0', + "uArr;": '\U000021D1', + "uHar;": '\U00002963', + "uacute;": '\U000000FA', + "uarr;": '\U00002191', + "ubrcy;": '\U0000045E', + "ubreve;": '\U0000016D', + "ucirc;": '\U000000FB', + "ucy;": '\U00000443', + "udarr;": '\U000021C5', + "udblac;": '\U00000171', + "udhar;": '\U0000296E', + "ufisht;": '\U0000297E', + "ufr;": '\U0001D532', + "ugrave;": '\U000000F9', + "uharl;": '\U000021BF', + "uharr;": '\U000021BE', + "uhblk;": '\U00002580', + "ulcorn;": '\U0000231C', + "ulcorner;": '\U0000231C', + "ulcrop;": '\U0000230F', + "ultri;": '\U000025F8', + "umacr;": '\U0000016B', + "uml;": '\U000000A8', + "uogon;": '\U00000173', + "uopf;": '\U0001D566', + "uparrow;": '\U00002191', + "updownarrow;": '\U00002195', + "upharpoonleft;": '\U000021BF', + "upharpoonright;": '\U000021BE', + "uplus;": '\U0000228E', + "upsi;": '\U000003C5', + "upsih;": '\U000003D2', + "upsilon;": '\U000003C5', + "upuparrows;": '\U000021C8', + "urcorn;": '\U0000231D', + "urcorner;": '\U0000231D', + "urcrop;": '\U0000230E', + "uring;": '\U0000016F', + "urtri;": '\U000025F9', + "uscr;": '\U0001D4CA', + "utdot;": '\U000022F0', + "utilde;": '\U00000169', + "utri;": '\U000025B5', + "utrif;": '\U000025B4', + "uuarr;": '\U000021C8', + "uuml;": '\U000000FC', + "uwangle;": '\U000029A7', + "vArr;": '\U000021D5', + "vBar;": '\U00002AE8', + "vBarv;": '\U00002AE9', + "vDash;": '\U000022A8', + "vangrt;": '\U0000299C', + "varepsilon;": '\U000003F5', + "varkappa;": '\U000003F0', + "varnothing;": '\U00002205', + "varphi;": '\U000003D5', + "varpi;": '\U000003D6', + "varpropto;": '\U0000221D', + "varr;": '\U00002195', + "varrho;": '\U000003F1', + "varsigma;": '\U000003C2', + "vartheta;": '\U000003D1', + "vartriangleleft;": '\U000022B2', + "vartriangleright;": '\U000022B3', + "vcy;": '\U00000432', + "vdash;": '\U000022A2', + "vee;": '\U00002228', + "veebar;": '\U000022BB', + "veeeq;": '\U0000225A', + "vellip;": '\U000022EE', + "verbar;": '\U0000007C', + "vert;": '\U0000007C', + "vfr;": '\U0001D533', + "vltri;": '\U000022B2', + "vopf;": '\U0001D567', + "vprop;": '\U0000221D', + "vrtri;": '\U000022B3', + "vscr;": '\U0001D4CB', + "vzigzag;": '\U0000299A', + "wcirc;": '\U00000175', + "wedbar;": '\U00002A5F', + "wedge;": '\U00002227', + "wedgeq;": '\U00002259', + "weierp;": '\U00002118', + "wfr;": '\U0001D534', + "wopf;": '\U0001D568', + "wp;": '\U00002118', + "wr;": '\U00002240', + "wreath;": '\U00002240', + "wscr;": '\U0001D4CC', + "xcap;": '\U000022C2', + "xcirc;": '\U000025EF', + "xcup;": '\U000022C3', + "xdtri;": '\U000025BD', + "xfr;": '\U0001D535', + "xhArr;": '\U000027FA', + "xharr;": '\U000027F7', + "xi;": '\U000003BE', + "xlArr;": '\U000027F8', + "xlarr;": '\U000027F5', + "xmap;": '\U000027FC', + "xnis;": '\U000022FB', + "xodot;": '\U00002A00', + "xopf;": '\U0001D569', + "xoplus;": '\U00002A01', + "xotime;": '\U00002A02', + "xrArr;": '\U000027F9', + "xrarr;": '\U000027F6', + "xscr;": '\U0001D4CD', + "xsqcup;": '\U00002A06', + "xuplus;": '\U00002A04', + "xutri;": '\U000025B3', + "xvee;": '\U000022C1', + "xwedge;": '\U000022C0', + "yacute;": '\U000000FD', + "yacy;": '\U0000044F', + "ycirc;": '\U00000177', + "ycy;": '\U0000044B', + "yen;": '\U000000A5', + "yfr;": '\U0001D536', + "yicy;": '\U00000457', + "yopf;": '\U0001D56A', + "yscr;": '\U0001D4CE', + "yucy;": '\U0000044E', + "yuml;": '\U000000FF', + "zacute;": '\U0000017A', + "zcaron;": '\U0000017E', + "zcy;": '\U00000437', + "zdot;": '\U0000017C', + "zeetrf;": '\U00002128', + "zeta;": '\U000003B6', + "zfr;": '\U0001D537', + "zhcy;": '\U00000436', + "zigrarr;": '\U000021DD', + "zopf;": '\U0001D56B', + "zscr;": '\U0001D4CF', + "zwj;": '\U0000200D', + "zwnj;": '\U0000200C', + "AElig": '\U000000C6', + "AMP": '\U00000026', + "Aacute": '\U000000C1', + "Acirc": '\U000000C2', + "Agrave": '\U000000C0', + "Aring": '\U000000C5', + "Atilde": '\U000000C3', + "Auml": '\U000000C4', + "COPY": '\U000000A9', + "Ccedil": '\U000000C7', + "ETH": '\U000000D0', + "Eacute": '\U000000C9', + "Ecirc": '\U000000CA', + "Egrave": '\U000000C8', + "Euml": '\U000000CB', + "GT": '\U0000003E', + "Iacute": '\U000000CD', + "Icirc": '\U000000CE', + "Igrave": '\U000000CC', + "Iuml": '\U000000CF', + "LT": '\U0000003C', + "Ntilde": '\U000000D1', + "Oacute": '\U000000D3', + "Ocirc": '\U000000D4', + "Ograve": '\U000000D2', + "Oslash": '\U000000D8', + "Otilde": '\U000000D5', + "Ouml": '\U000000D6', + "QUOT": '\U00000022', + "REG": '\U000000AE', + "THORN": '\U000000DE', + "Uacute": '\U000000DA', + "Ucirc": '\U000000DB', + "Ugrave": '\U000000D9', + "Uuml": '\U000000DC', + "Yacute": '\U000000DD', + "aacute": '\U000000E1', + "acirc": '\U000000E2', + "acute": '\U000000B4', + "aelig": '\U000000E6', + "agrave": '\U000000E0', + "amp": '\U00000026', + "aring": '\U000000E5', + "atilde": '\U000000E3', + "auml": '\U000000E4', + "brvbar": '\U000000A6', + "ccedil": '\U000000E7', + "cedil": '\U000000B8', + "cent": '\U000000A2', + "copy": '\U000000A9', + "curren": '\U000000A4', + "deg": '\U000000B0', + "divide": '\U000000F7', + "eacute": '\U000000E9', + "ecirc": '\U000000EA', + "egrave": '\U000000E8', + "eth": '\U000000F0', + "euml": '\U000000EB', + "frac12": '\U000000BD', + "frac14": '\U000000BC', + "frac34": '\U000000BE', + "gt": '\U0000003E', + "iacute": '\U000000ED', + "icirc": '\U000000EE', + "iexcl": '\U000000A1', + "igrave": '\U000000EC', + "iquest": '\U000000BF', + "iuml": '\U000000EF', + "laquo": '\U000000AB', + "lt": '\U0000003C', + "macr": '\U000000AF', + "micro": '\U000000B5', + "middot": '\U000000B7', + "nbsp": '\U000000A0', + "not": '\U000000AC', + "ntilde": '\U000000F1', + "oacute": '\U000000F3', + "ocirc": '\U000000F4', + "ograve": '\U000000F2', + "ordf": '\U000000AA', + "ordm": '\U000000BA', + "oslash": '\U000000F8', + "otilde": '\U000000F5', + "ouml": '\U000000F6', + "para": '\U000000B6', + "plusmn": '\U000000B1', + "pound": '\U000000A3', + "quot": '\U00000022', + "raquo": '\U000000BB', + "reg": '\U000000AE', + "sect": '\U000000A7', + "shy": '\U000000AD', + "sup1": '\U000000B9', + "sup2": '\U000000B2', + "sup3": '\U000000B3', + "szlig": '\U000000DF', + "thorn": '\U000000FE', + "times": '\U000000D7', + "uacute": '\U000000FA', + "ucirc": '\U000000FB', + "ugrave": '\U000000F9', + "uml": '\U000000A8', + "uuml": '\U000000FC', + "yacute": '\U000000FD', + "yen": '\U000000A5', + "yuml": '\U000000FF', +} + +// HTML entities that are two unicode codepoints. +var entity2 = map[string][2]rune{ + // TODO(nigeltao): Handle replacements that are wider than their names. + // "nLt;": {'\u226A', '\u20D2'}, + // "nGt;": {'\u226B', '\u20D2'}, + "NotEqualTilde;": {'\u2242', '\u0338'}, + "NotGreaterFullEqual;": {'\u2267', '\u0338'}, + "NotGreaterGreater;": {'\u226B', '\u0338'}, + "NotGreaterSlantEqual;": {'\u2A7E', '\u0338'}, + "NotHumpDownHump;": {'\u224E', '\u0338'}, + "NotHumpEqual;": {'\u224F', '\u0338'}, + "NotLeftTriangleBar;": {'\u29CF', '\u0338'}, + "NotLessLess;": {'\u226A', '\u0338'}, + "NotLessSlantEqual;": {'\u2A7D', '\u0338'}, + "NotNestedGreaterGreater;": {'\u2AA2', '\u0338'}, + "NotNestedLessLess;": {'\u2AA1', '\u0338'}, + "NotPrecedesEqual;": {'\u2AAF', '\u0338'}, + "NotRightTriangleBar;": {'\u29D0', '\u0338'}, + "NotSquareSubset;": {'\u228F', '\u0338'}, + "NotSquareSuperset;": {'\u2290', '\u0338'}, + "NotSubset;": {'\u2282', '\u20D2'}, + "NotSucceedsEqual;": {'\u2AB0', '\u0338'}, + "NotSucceedsTilde;": {'\u227F', '\u0338'}, + "NotSuperset;": {'\u2283', '\u20D2'}, + "ThickSpace;": {'\u205F', '\u200A'}, + "acE;": {'\u223E', '\u0333'}, + "bne;": {'\u003D', '\u20E5'}, + "bnequiv;": {'\u2261', '\u20E5'}, + "caps;": {'\u2229', '\uFE00'}, + "cups;": {'\u222A', '\uFE00'}, + "fjlig;": {'\u0066', '\u006A'}, + "gesl;": {'\u22DB', '\uFE00'}, + "gvertneqq;": {'\u2269', '\uFE00'}, + "gvnE;": {'\u2269', '\uFE00'}, + "lates;": {'\u2AAD', '\uFE00'}, + "lesg;": {'\u22DA', '\uFE00'}, + "lvertneqq;": {'\u2268', '\uFE00'}, + "lvnE;": {'\u2268', '\uFE00'}, + "nGg;": {'\u22D9', '\u0338'}, + "nGtv;": {'\u226B', '\u0338'}, + "nLl;": {'\u22D8', '\u0338'}, + "nLtv;": {'\u226A', '\u0338'}, + "nang;": {'\u2220', '\u20D2'}, + "napE;": {'\u2A70', '\u0338'}, + "napid;": {'\u224B', '\u0338'}, + "nbump;": {'\u224E', '\u0338'}, + "nbumpe;": {'\u224F', '\u0338'}, + "ncongdot;": {'\u2A6D', '\u0338'}, + "nedot;": {'\u2250', '\u0338'}, + "nesim;": {'\u2242', '\u0338'}, + "ngE;": {'\u2267', '\u0338'}, + "ngeqq;": {'\u2267', '\u0338'}, + "ngeqslant;": {'\u2A7E', '\u0338'}, + "nges;": {'\u2A7E', '\u0338'}, + "nlE;": {'\u2266', '\u0338'}, + "nleqq;": {'\u2266', '\u0338'}, + "nleqslant;": {'\u2A7D', '\u0338'}, + "nles;": {'\u2A7D', '\u0338'}, + "notinE;": {'\u22F9', '\u0338'}, + "notindot;": {'\u22F5', '\u0338'}, + "nparsl;": {'\u2AFD', '\u20E5'}, + "npart;": {'\u2202', '\u0338'}, + "npre;": {'\u2AAF', '\u0338'}, + "npreceq;": {'\u2AAF', '\u0338'}, + "nrarrc;": {'\u2933', '\u0338'}, + "nrarrw;": {'\u219D', '\u0338'}, + "nsce;": {'\u2AB0', '\u0338'}, + "nsubE;": {'\u2AC5', '\u0338'}, + "nsubset;": {'\u2282', '\u20D2'}, + "nsubseteqq;": {'\u2AC5', '\u0338'}, + "nsucceq;": {'\u2AB0', '\u0338'}, + "nsupE;": {'\u2AC6', '\u0338'}, + "nsupset;": {'\u2283', '\u20D2'}, + "nsupseteqq;": {'\u2AC6', '\u0338'}, + "nvap;": {'\u224D', '\u20D2'}, + "nvge;": {'\u2265', '\u20D2'}, + "nvgt;": {'\u003E', '\u20D2'}, + "nvle;": {'\u2264', '\u20D2'}, + "nvlt;": {'\u003C', '\u20D2'}, + "nvltrie;": {'\u22B4', '\u20D2'}, + "nvrtrie;": {'\u22B5', '\u20D2'}, + "nvsim;": {'\u223C', '\u20D2'}, + "race;": {'\u223D', '\u0331'}, + "smtes;": {'\u2AAC', '\uFE00'}, + "sqcaps;": {'\u2293', '\uFE00'}, + "sqcups;": {'\u2294', '\uFE00'}, + "varsubsetneq;": {'\u228A', '\uFE00'}, + "varsubsetneqq;": {'\u2ACB', '\uFE00'}, + "varsupsetneq;": {'\u228B', '\uFE00'}, + "varsupsetneqq;": {'\u2ACC', '\uFE00'}, + "vnsub;": {'\u2282', '\u20D2'}, + "vnsup;": {'\u2283', '\u20D2'}, + "vsubnE;": {'\u2ACB', '\uFE00'}, + "vsubne;": {'\u228A', '\uFE00'}, + "vsupnE;": {'\u2ACC', '\uFE00'}, + "vsupne;": {'\u228B', '\uFE00'}, +} diff --git a/vendor/golang.org/x/net/html/escape.go b/vendor/golang.org/x/net/html/escape.go new file mode 100644 index 000000000..d85613962 --- /dev/null +++ b/vendor/golang.org/x/net/html/escape.go @@ -0,0 +1,258 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +import ( + "bytes" + "strings" + "unicode/utf8" +) + +// These replacements permit compatibility with old numeric entities that +// assumed Windows-1252 encoding. +// https://html.spec.whatwg.org/multipage/syntax.html#consume-a-character-reference +var replacementTable = [...]rune{ + '\u20AC', // First entry is what 0x80 should be replaced with. + '\u0081', + '\u201A', + '\u0192', + '\u201E', + '\u2026', + '\u2020', + '\u2021', + '\u02C6', + '\u2030', + '\u0160', + '\u2039', + '\u0152', + '\u008D', + '\u017D', + '\u008F', + '\u0090', + '\u2018', + '\u2019', + '\u201C', + '\u201D', + '\u2022', + '\u2013', + '\u2014', + '\u02DC', + '\u2122', + '\u0161', + '\u203A', + '\u0153', + '\u009D', + '\u017E', + '\u0178', // Last entry is 0x9F. + // 0x00->'\uFFFD' is handled programmatically. + // 0x0D->'\u000D' is a no-op. +} + +// unescapeEntity reads an entity like "<" from b[src:] and writes the +// corresponding "<" to b[dst:], returning the incremented dst and src cursors. +// Precondition: b[src] == '&' && dst <= src. +// attribute should be true if parsing an attribute value. +func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) { + // https://html.spec.whatwg.org/multipage/syntax.html#consume-a-character-reference + + // i starts at 1 because we already know that s[0] == '&'. + i, s := 1, b[src:] + + if len(s) <= 1 { + b[dst] = b[src] + return dst + 1, src + 1 + } + + if s[i] == '#' { + if len(s) <= 3 { // We need to have at least "&#.". + b[dst] = b[src] + return dst + 1, src + 1 + } + i++ + c := s[i] + hex := false + if c == 'x' || c == 'X' { + hex = true + i++ + } + + x := '\x00' + for i < len(s) { + c = s[i] + i++ + if hex { + if '0' <= c && c <= '9' { + x = 16*x + rune(c) - '0' + continue + } else if 'a' <= c && c <= 'f' { + x = 16*x + rune(c) - 'a' + 10 + continue + } else if 'A' <= c && c <= 'F' { + x = 16*x + rune(c) - 'A' + 10 + continue + } + } else if '0' <= c && c <= '9' { + x = 10*x + rune(c) - '0' + continue + } + if c != ';' { + i-- + } + break + } + + if i <= 3 { // No characters matched. + b[dst] = b[src] + return dst + 1, src + 1 + } + + if 0x80 <= x && x <= 0x9F { + // Replace characters from Windows-1252 with UTF-8 equivalents. + x = replacementTable[x-0x80] + } else if x == 0 || (0xD800 <= x && x <= 0xDFFF) || x > 0x10FFFF { + // Replace invalid characters with the replacement character. + x = '\uFFFD' + } + + return dst + utf8.EncodeRune(b[dst:], x), src + i + } + + // Consume the maximum number of characters possible, with the + // consumed characters matching one of the named references. + + for i < len(s) { + c := s[i] + i++ + // Lower-cased characters are more common in entities, so we check for them first. + if 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c && c <= '9' { + continue + } + if c != ';' { + i-- + } + break + } + + entityName := string(s[1:i]) + if entityName == "" { + // No-op. + } else if attribute && entityName[len(entityName)-1] != ';' && len(s) > i && s[i] == '=' { + // No-op. + } else if x := entity[entityName]; x != 0 { + return dst + utf8.EncodeRune(b[dst:], x), src + i + } else if x := entity2[entityName]; x[0] != 0 { + dst1 := dst + utf8.EncodeRune(b[dst:], x[0]) + return dst1 + utf8.EncodeRune(b[dst1:], x[1]), src + i + } else if !attribute { + maxLen := len(entityName) - 1 + if maxLen > longestEntityWithoutSemicolon { + maxLen = longestEntityWithoutSemicolon + } + for j := maxLen; j > 1; j-- { + if x := entity[entityName[:j]]; x != 0 { + return dst + utf8.EncodeRune(b[dst:], x), src + j + 1 + } + } + } + + dst1, src1 = dst+i, src+i + copy(b[dst:dst1], b[src:src1]) + return dst1, src1 +} + +// unescape unescapes b's entities in-place, so that "a<b" becomes "a': + esc = ">" + case '"': + // """ is shorter than """. + esc = """ + case '\r': + esc = " " + default: + panic("unrecognized escape character") + } + s = s[i+1:] + if _, err := w.WriteString(esc); err != nil { + return err + } + i = strings.IndexAny(s, escapedChars) + } + _, err := w.WriteString(s) + return err +} + +// EscapeString escapes special characters like "<" to become "<". It +// escapes only five such characters: <, >, &, ' and ". +// UnescapeString(EscapeString(s)) == s always holds, but the converse isn't +// always true. +func EscapeString(s string) string { + if strings.IndexAny(s, escapedChars) == -1 { + return s + } + var buf bytes.Buffer + escape(&buf, s) + return buf.String() +} + +// UnescapeString unescapes entities like "<" to become "<". It unescapes a +// larger range of entities than EscapeString escapes. For example, "á" +// unescapes to "á", as does "á" and "&xE1;". +// UnescapeString(EscapeString(s)) == s always holds, but the converse isn't +// always true. +func UnescapeString(s string) string { + for _, c := range s { + if c == '&' { + return string(unescape([]byte(s), false)) + } + } + return s +} diff --git a/vendor/golang.org/x/net/html/foreign.go b/vendor/golang.org/x/net/html/foreign.go new file mode 100644 index 000000000..9da9e9dc4 --- /dev/null +++ b/vendor/golang.org/x/net/html/foreign.go @@ -0,0 +1,222 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +import ( + "strings" +) + +func adjustAttributeNames(aa []Attribute, nameMap map[string]string) { + for i := range aa { + if newName, ok := nameMap[aa[i].Key]; ok { + aa[i].Key = newName + } + } +} + +func adjustForeignAttributes(aa []Attribute) { + for i, a := range aa { + if a.Key == "" || a.Key[0] != 'x' { + continue + } + switch a.Key { + case "xlink:actuate", "xlink:arcrole", "xlink:href", "xlink:role", "xlink:show", + "xlink:title", "xlink:type", "xml:base", "xml:lang", "xml:space", "xmlns:xlink": + j := strings.Index(a.Key, ":") + aa[i].Namespace = a.Key[:j] + aa[i].Key = a.Key[j+1:] + } + } +} + +func htmlIntegrationPoint(n *Node) bool { + if n.Type != ElementNode { + return false + } + switch n.Namespace { + case "math": + if n.Data == "annotation-xml" { + for _, a := range n.Attr { + if a.Key == "encoding" { + val := strings.ToLower(a.Val) + if val == "text/html" || val == "application/xhtml+xml" { + return true + } + } + } + } + case "svg": + switch n.Data { + case "desc", "foreignObject", "title": + return true + } + } + return false +} + +func mathMLTextIntegrationPoint(n *Node) bool { + if n.Namespace != "math" { + return false + } + switch n.Data { + case "mi", "mo", "mn", "ms", "mtext": + return true + } + return false +} + +// Section 12.2.6.5. +var breakout = map[string]bool{ + "b": true, + "big": true, + "blockquote": true, + "body": true, + "br": true, + "center": true, + "code": true, + "dd": true, + "div": true, + "dl": true, + "dt": true, + "em": true, + "embed": true, + "h1": true, + "h2": true, + "h3": true, + "h4": true, + "h5": true, + "h6": true, + "head": true, + "hr": true, + "i": true, + "img": true, + "li": true, + "listing": true, + "menu": true, + "meta": true, + "nobr": true, + "ol": true, + "p": true, + "pre": true, + "ruby": true, + "s": true, + "small": true, + "span": true, + "strong": true, + "strike": true, + "sub": true, + "sup": true, + "table": true, + "tt": true, + "u": true, + "ul": true, + "var": true, +} + +// Section 12.2.6.5. +var svgTagNameAdjustments = map[string]string{ + "altglyph": "altGlyph", + "altglyphdef": "altGlyphDef", + "altglyphitem": "altGlyphItem", + "animatecolor": "animateColor", + "animatemotion": "animateMotion", + "animatetransform": "animateTransform", + "clippath": "clipPath", + "feblend": "feBlend", + "fecolormatrix": "feColorMatrix", + "fecomponenttransfer": "feComponentTransfer", + "fecomposite": "feComposite", + "feconvolvematrix": "feConvolveMatrix", + "fediffuselighting": "feDiffuseLighting", + "fedisplacementmap": "feDisplacementMap", + "fedistantlight": "feDistantLight", + "feflood": "feFlood", + "fefunca": "feFuncA", + "fefuncb": "feFuncB", + "fefuncg": "feFuncG", + "fefuncr": "feFuncR", + "fegaussianblur": "feGaussianBlur", + "feimage": "feImage", + "femerge": "feMerge", + "femergenode": "feMergeNode", + "femorphology": "feMorphology", + "feoffset": "feOffset", + "fepointlight": "fePointLight", + "fespecularlighting": "feSpecularLighting", + "fespotlight": "feSpotLight", + "fetile": "feTile", + "feturbulence": "feTurbulence", + "foreignobject": "foreignObject", + "glyphref": "glyphRef", + "lineargradient": "linearGradient", + "radialgradient": "radialGradient", + "textpath": "textPath", +} + +// Section 12.2.6.1 +var mathMLAttributeAdjustments = map[string]string{ + "definitionurl": "definitionURL", +} + +var svgAttributeAdjustments = map[string]string{ + "attributename": "attributeName", + "attributetype": "attributeType", + "basefrequency": "baseFrequency", + "baseprofile": "baseProfile", + "calcmode": "calcMode", + "clippathunits": "clipPathUnits", + "diffuseconstant": "diffuseConstant", + "edgemode": "edgeMode", + "filterunits": "filterUnits", + "glyphref": "glyphRef", + "gradienttransform": "gradientTransform", + "gradientunits": "gradientUnits", + "kernelmatrix": "kernelMatrix", + "kernelunitlength": "kernelUnitLength", + "keypoints": "keyPoints", + "keysplines": "keySplines", + "keytimes": "keyTimes", + "lengthadjust": "lengthAdjust", + "limitingconeangle": "limitingConeAngle", + "markerheight": "markerHeight", + "markerunits": "markerUnits", + "markerwidth": "markerWidth", + "maskcontentunits": "maskContentUnits", + "maskunits": "maskUnits", + "numoctaves": "numOctaves", + "pathlength": "pathLength", + "patterncontentunits": "patternContentUnits", + "patterntransform": "patternTransform", + "patternunits": "patternUnits", + "pointsatx": "pointsAtX", + "pointsaty": "pointsAtY", + "pointsatz": "pointsAtZ", + "preservealpha": "preserveAlpha", + "preserveaspectratio": "preserveAspectRatio", + "primitiveunits": "primitiveUnits", + "refx": "refX", + "refy": "refY", + "repeatcount": "repeatCount", + "repeatdur": "repeatDur", + "requiredextensions": "requiredExtensions", + "requiredfeatures": "requiredFeatures", + "specularconstant": "specularConstant", + "specularexponent": "specularExponent", + "spreadmethod": "spreadMethod", + "startoffset": "startOffset", + "stddeviation": "stdDeviation", + "stitchtiles": "stitchTiles", + "surfacescale": "surfaceScale", + "systemlanguage": "systemLanguage", + "tablevalues": "tableValues", + "targetx": "targetX", + "targety": "targetY", + "textlength": "textLength", + "viewbox": "viewBox", + "viewtarget": "viewTarget", + "xchannelselector": "xChannelSelector", + "ychannelselector": "yChannelSelector", + "zoomandpan": "zoomAndPan", +} diff --git a/vendor/golang.org/x/net/html/node.go b/vendor/golang.org/x/net/html/node.go new file mode 100644 index 000000000..1350eef22 --- /dev/null +++ b/vendor/golang.org/x/net/html/node.go @@ -0,0 +1,225 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +import ( + "golang.org/x/net/html/atom" +) + +// A NodeType is the type of a Node. +type NodeType uint32 + +const ( + ErrorNode NodeType = iota + TextNode + DocumentNode + ElementNode + CommentNode + DoctypeNode + // RawNode nodes are not returned by the parser, but can be part of the + // Node tree passed to func Render to insert raw HTML (without escaping). + // If so, this package makes no guarantee that the rendered HTML is secure + // (from e.g. Cross Site Scripting attacks) or well-formed. + RawNode + scopeMarkerNode +) + +// Section 12.2.4.3 says "The markers are inserted when entering applet, +// object, marquee, template, td, th, and caption elements, and are used +// to prevent formatting from "leaking" into applet, object, marquee, +// template, td, th, and caption elements". +var scopeMarker = Node{Type: scopeMarkerNode} + +// A Node consists of a NodeType and some Data (tag name for element nodes, +// content for text) and are part of a tree of Nodes. Element nodes may also +// have a Namespace and contain a slice of Attributes. Data is unescaped, so +// that it looks like "a 0 { + return (*s)[i-1] + } + return nil +} + +// index returns the index of the top-most occurrence of n in the stack, or -1 +// if n is not present. +func (s *nodeStack) index(n *Node) int { + for i := len(*s) - 1; i >= 0; i-- { + if (*s)[i] == n { + return i + } + } + return -1 +} + +// contains returns whether a is within s. +func (s *nodeStack) contains(a atom.Atom) bool { + for _, n := range *s { + if n.DataAtom == a && n.Namespace == "" { + return true + } + } + return false +} + +// insert inserts a node at the given index. +func (s *nodeStack) insert(i int, n *Node) { + (*s) = append(*s, nil) + copy((*s)[i+1:], (*s)[i:]) + (*s)[i] = n +} + +// remove removes a node from the stack. It is a no-op if n is not present. +func (s *nodeStack) remove(n *Node) { + i := s.index(n) + if i == -1 { + return + } + copy((*s)[i:], (*s)[i+1:]) + j := len(*s) - 1 + (*s)[j] = nil + *s = (*s)[:j] +} + +type insertionModeStack []insertionMode + +func (s *insertionModeStack) pop() (im insertionMode) { + i := len(*s) + im = (*s)[i-1] + *s = (*s)[:i-1] + return im +} + +func (s *insertionModeStack) top() insertionMode { + if i := len(*s); i > 0 { + return (*s)[i-1] + } + return nil +} diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go new file mode 100644 index 000000000..46a89eda6 --- /dev/null +++ b/vendor/golang.org/x/net/html/parse.go @@ -0,0 +1,2460 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +import ( + "errors" + "fmt" + "io" + "strings" + + a "golang.org/x/net/html/atom" +) + +// A parser implements the HTML5 parsing algorithm: +// https://html.spec.whatwg.org/multipage/syntax.html#tree-construction +type parser struct { + // tokenizer provides the tokens for the parser. + tokenizer *Tokenizer + // tok is the most recently read token. + tok Token + // Self-closing tags like
    are treated as start tags, except that + // hasSelfClosingToken is set while they are being processed. + hasSelfClosingToken bool + // doc is the document root element. + doc *Node + // The stack of open elements (section 12.2.4.2) and active formatting + // elements (section 12.2.4.3). + oe, afe nodeStack + // Element pointers (section 12.2.4.4). + head, form *Node + // Other parsing state flags (section 12.2.4.5). + scripting, framesetOK bool + // The stack of template insertion modes + templateStack insertionModeStack + // im is the current insertion mode. + im insertionMode + // originalIM is the insertion mode to go back to after completing a text + // or inTableText insertion mode. + originalIM insertionMode + // fosterParenting is whether new elements should be inserted according to + // the foster parenting rules (section 12.2.6.1). + fosterParenting bool + // quirks is whether the parser is operating in "quirks mode." + quirks bool + // fragment is whether the parser is parsing an HTML fragment. + fragment bool + // context is the context element when parsing an HTML fragment + // (section 12.4). + context *Node +} + +func (p *parser) top() *Node { + if n := p.oe.top(); n != nil { + return n + } + return p.doc +} + +// Stop tags for use in popUntil. These come from section 12.2.4.2. +var ( + defaultScopeStopTags = map[string][]a.Atom{ + "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template}, + "math": {a.AnnotationXml, a.Mi, a.Mn, a.Mo, a.Ms, a.Mtext}, + "svg": {a.Desc, a.ForeignObject, a.Title}, + } +) + +type scope int + +const ( + defaultScope scope = iota + listItemScope + buttonScope + tableScope + tableRowScope + tableBodyScope + selectScope +) + +// popUntil pops the stack of open elements at the highest element whose tag +// is in matchTags, provided there is no higher element in the scope's stop +// tags (as defined in section 12.2.4.2). It returns whether or not there was +// such an element. If there was not, popUntil leaves the stack unchanged. +// +// For example, the set of stop tags for table scope is: "html", "table". If +// the stack was: +// ["html", "body", "font", "table", "b", "i", "u"] +// then popUntil(tableScope, "font") would return false, but +// popUntil(tableScope, "i") would return true and the stack would become: +// ["html", "body", "font", "table", "b"] +// +// If an element's tag is in both the stop tags and matchTags, then the stack +// will be popped and the function returns true (provided, of course, there was +// no higher element in the stack that was also in the stop tags). For example, +// popUntil(tableScope, "table") returns true and leaves: +// ["html", "body", "font"] +func (p *parser) popUntil(s scope, matchTags ...a.Atom) bool { + if i := p.indexOfElementInScope(s, matchTags...); i != -1 { + p.oe = p.oe[:i] + return true + } + return false +} + +// indexOfElementInScope returns the index in p.oe of the highest element whose +// tag is in matchTags that is in scope. If no matching element is in scope, it +// returns -1. +func (p *parser) indexOfElementInScope(s scope, matchTags ...a.Atom) int { + for i := len(p.oe) - 1; i >= 0; i-- { + tagAtom := p.oe[i].DataAtom + if p.oe[i].Namespace == "" { + for _, t := range matchTags { + if t == tagAtom { + return i + } + } + switch s { + case defaultScope: + // No-op. + case listItemScope: + if tagAtom == a.Ol || tagAtom == a.Ul { + return -1 + } + case buttonScope: + if tagAtom == a.Button { + return -1 + } + case tableScope: + if tagAtom == a.Html || tagAtom == a.Table || tagAtom == a.Template { + return -1 + } + case selectScope: + if tagAtom != a.Optgroup && tagAtom != a.Option { + return -1 + } + default: + panic("unreachable") + } + } + switch s { + case defaultScope, listItemScope, buttonScope: + for _, t := range defaultScopeStopTags[p.oe[i].Namespace] { + if t == tagAtom { + return -1 + } + } + } + } + return -1 +} + +// elementInScope is like popUntil, except that it doesn't modify the stack of +// open elements. +func (p *parser) elementInScope(s scope, matchTags ...a.Atom) bool { + return p.indexOfElementInScope(s, matchTags...) != -1 +} + +// clearStackToContext pops elements off the stack of open elements until a +// scope-defined element is found. +func (p *parser) clearStackToContext(s scope) { + for i := len(p.oe) - 1; i >= 0; i-- { + tagAtom := p.oe[i].DataAtom + switch s { + case tableScope: + if tagAtom == a.Html || tagAtom == a.Table || tagAtom == a.Template { + p.oe = p.oe[:i+1] + return + } + case tableRowScope: + if tagAtom == a.Html || tagAtom == a.Tr || tagAtom == a.Template { + p.oe = p.oe[:i+1] + return + } + case tableBodyScope: + if tagAtom == a.Html || tagAtom == a.Tbody || tagAtom == a.Tfoot || tagAtom == a.Thead || tagAtom == a.Template { + p.oe = p.oe[:i+1] + return + } + default: + panic("unreachable") + } + } +} + +// parseGenericRawTextElement implements the generic raw text element parsing +// algorithm defined in 12.2.6.2. +// https://html.spec.whatwg.org/multipage/parsing.html#parsing-elements-that-contain-only-text +// TODO: Since both RAWTEXT and RCDATA states are treated as tokenizer's part +// officially, need to make tokenizer consider both states. +func (p *parser) parseGenericRawTextElement() { + p.addElement() + p.originalIM = p.im + p.im = textIM +} + +// generateImpliedEndTags pops nodes off the stack of open elements as long as +// the top node has a tag name of dd, dt, li, optgroup, option, p, rb, rp, rt or rtc. +// If exceptions are specified, nodes with that name will not be popped off. +func (p *parser) generateImpliedEndTags(exceptions ...string) { + var i int +loop: + for i = len(p.oe) - 1; i >= 0; i-- { + n := p.oe[i] + if n.Type != ElementNode { + break + } + switch n.DataAtom { + case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc: + for _, except := range exceptions { + if n.Data == except { + break loop + } + } + continue + } + break + } + + p.oe = p.oe[:i+1] +} + +// addChild adds a child node n to the top element, and pushes n onto the stack +// of open elements if it is an element node. +func (p *parser) addChild(n *Node) { + if p.shouldFosterParent() { + p.fosterParent(n) + } else { + p.top().AppendChild(n) + } + + if n.Type == ElementNode { + p.oe = append(p.oe, n) + } +} + +// shouldFosterParent returns whether the next node to be added should be +// foster parented. +func (p *parser) shouldFosterParent() bool { + if p.fosterParenting { + switch p.top().DataAtom { + case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr: + return true + } + } + return false +} + +// fosterParent adds a child node according to the foster parenting rules. +// Section 12.2.6.1, "foster parenting". +func (p *parser) fosterParent(n *Node) { + var table, parent, prev, template *Node + var i int + for i = len(p.oe) - 1; i >= 0; i-- { + if p.oe[i].DataAtom == a.Table { + table = p.oe[i] + break + } + } + + var j int + for j = len(p.oe) - 1; j >= 0; j-- { + if p.oe[j].DataAtom == a.Template { + template = p.oe[j] + break + } + } + + if template != nil && (table == nil || j > i) { + template.AppendChild(n) + return + } + + if table == nil { + // The foster parent is the html element. + parent = p.oe[0] + } else { + parent = table.Parent + } + if parent == nil { + parent = p.oe[i-1] + } + + if table != nil { + prev = table.PrevSibling + } else { + prev = parent.LastChild + } + if prev != nil && prev.Type == TextNode && n.Type == TextNode { + prev.Data += n.Data + return + } + + parent.InsertBefore(n, table) +} + +// addText adds text to the preceding node if it is a text node, or else it +// calls addChild with a new text node. +func (p *parser) addText(text string) { + if text == "" { + return + } + + if p.shouldFosterParent() { + p.fosterParent(&Node{ + Type: TextNode, + Data: text, + }) + return + } + + t := p.top() + if n := t.LastChild; n != nil && n.Type == TextNode { + n.Data += text + return + } + p.addChild(&Node{ + Type: TextNode, + Data: text, + }) +} + +// addElement adds a child element based on the current token. +func (p *parser) addElement() { + p.addChild(&Node{ + Type: ElementNode, + DataAtom: p.tok.DataAtom, + Data: p.tok.Data, + Attr: p.tok.Attr, + }) +} + +// Section 12.2.4.3. +func (p *parser) addFormattingElement() { + tagAtom, attr := p.tok.DataAtom, p.tok.Attr + p.addElement() + + // Implement the Noah's Ark clause, but with three per family instead of two. + identicalElements := 0 +findIdenticalElements: + for i := len(p.afe) - 1; i >= 0; i-- { + n := p.afe[i] + if n.Type == scopeMarkerNode { + break + } + if n.Type != ElementNode { + continue + } + if n.Namespace != "" { + continue + } + if n.DataAtom != tagAtom { + continue + } + if len(n.Attr) != len(attr) { + continue + } + compareAttributes: + for _, t0 := range n.Attr { + for _, t1 := range attr { + if t0.Key == t1.Key && t0.Namespace == t1.Namespace && t0.Val == t1.Val { + // Found a match for this attribute, continue with the next attribute. + continue compareAttributes + } + } + // If we get here, there is no attribute that matches a. + // Therefore the element is not identical to the new one. + continue findIdenticalElements + } + + identicalElements++ + if identicalElements >= 3 { + p.afe.remove(n) + } + } + + p.afe = append(p.afe, p.top()) +} + +// Section 12.2.4.3. +func (p *parser) clearActiveFormattingElements() { + for { + if n := p.afe.pop(); len(p.afe) == 0 || n.Type == scopeMarkerNode { + return + } + } +} + +// Section 12.2.4.3. +func (p *parser) reconstructActiveFormattingElements() { + n := p.afe.top() + if n == nil { + return + } + if n.Type == scopeMarkerNode || p.oe.index(n) != -1 { + return + } + i := len(p.afe) - 1 + for n.Type != scopeMarkerNode && p.oe.index(n) == -1 { + if i == 0 { + i = -1 + break + } + i-- + n = p.afe[i] + } + for { + i++ + clone := p.afe[i].clone() + p.addChild(clone) + p.afe[i] = clone + if i == len(p.afe)-1 { + break + } + } +} + +// Section 12.2.5. +func (p *parser) acknowledgeSelfClosingTag() { + p.hasSelfClosingToken = false +} + +// An insertion mode (section 12.2.4.1) is the state transition function from +// a particular state in the HTML5 parser's state machine. It updates the +// parser's fields depending on parser.tok (where ErrorToken means EOF). +// It returns whether the token was consumed. +type insertionMode func(*parser) bool + +// setOriginalIM sets the insertion mode to return to after completing a text or +// inTableText insertion mode. +// Section 12.2.4.1, "using the rules for". +func (p *parser) setOriginalIM() { + if p.originalIM != nil { + panic("html: bad parser state: originalIM was set twice") + } + p.originalIM = p.im +} + +// Section 12.2.4.1, "reset the insertion mode". +func (p *parser) resetInsertionMode() { + for i := len(p.oe) - 1; i >= 0; i-- { + n := p.oe[i] + last := i == 0 + if last && p.context != nil { + n = p.context + } + + switch n.DataAtom { + case a.Select: + if !last { + for ancestor, first := n, p.oe[0]; ancestor != first; { + ancestor = p.oe[p.oe.index(ancestor)-1] + switch ancestor.DataAtom { + case a.Template: + p.im = inSelectIM + return + case a.Table: + p.im = inSelectInTableIM + return + } + } + } + p.im = inSelectIM + case a.Td, a.Th: + // TODO: remove this divergence from the HTML5 spec. + // + // See https://bugs.chromium.org/p/chromium/issues/detail?id=829668 + p.im = inCellIM + case a.Tr: + p.im = inRowIM + case a.Tbody, a.Thead, a.Tfoot: + p.im = inTableBodyIM + case a.Caption: + p.im = inCaptionIM + case a.Colgroup: + p.im = inColumnGroupIM + case a.Table: + p.im = inTableIM + case a.Template: + // TODO: remove this divergence from the HTML5 spec. + if n.Namespace != "" { + continue + } + p.im = p.templateStack.top() + case a.Head: + // TODO: remove this divergence from the HTML5 spec. + // + // See https://bugs.chromium.org/p/chromium/issues/detail?id=829668 + p.im = inHeadIM + case a.Body: + p.im = inBodyIM + case a.Frameset: + p.im = inFramesetIM + case a.Html: + if p.head == nil { + p.im = beforeHeadIM + } else { + p.im = afterHeadIM + } + default: + if last { + p.im = inBodyIM + return + } + continue + } + return + } +} + +const whitespace = " \t\r\n\f" + +// Section 12.2.6.4.1. +func initialIM(p *parser) bool { + switch p.tok.Type { + case TextToken: + p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace) + if len(p.tok.Data) == 0 { + // It was all whitespace, so ignore it. + return true + } + case CommentToken: + p.doc.AppendChild(&Node{ + Type: CommentNode, + Data: p.tok.Data, + }) + return true + case DoctypeToken: + n, quirks := parseDoctype(p.tok.Data) + p.doc.AppendChild(n) + p.quirks = quirks + p.im = beforeHTMLIM + return true + } + p.quirks = true + p.im = beforeHTMLIM + return false +} + +// Section 12.2.6.4.2. +func beforeHTMLIM(p *parser) bool { + switch p.tok.Type { + case DoctypeToken: + // Ignore the token. + return true + case TextToken: + p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace) + if len(p.tok.Data) == 0 { + // It was all whitespace, so ignore it. + return true + } + case StartTagToken: + if p.tok.DataAtom == a.Html { + p.addElement() + p.im = beforeHeadIM + return true + } + case EndTagToken: + switch p.tok.DataAtom { + case a.Head, a.Body, a.Html, a.Br: + p.parseImpliedToken(StartTagToken, a.Html, a.Html.String()) + return false + default: + // Ignore the token. + return true + } + case CommentToken: + p.doc.AppendChild(&Node{ + Type: CommentNode, + Data: p.tok.Data, + }) + return true + } + p.parseImpliedToken(StartTagToken, a.Html, a.Html.String()) + return false +} + +// Section 12.2.6.4.3. +func beforeHeadIM(p *parser) bool { + switch p.tok.Type { + case TextToken: + p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace) + if len(p.tok.Data) == 0 { + // It was all whitespace, so ignore it. + return true + } + case StartTagToken: + switch p.tok.DataAtom { + case a.Head: + p.addElement() + p.head = p.top() + p.im = inHeadIM + return true + case a.Html: + return inBodyIM(p) + } + case EndTagToken: + switch p.tok.DataAtom { + case a.Head, a.Body, a.Html, a.Br: + p.parseImpliedToken(StartTagToken, a.Head, a.Head.String()) + return false + default: + // Ignore the token. + return true + } + case CommentToken: + p.addChild(&Node{ + Type: CommentNode, + Data: p.tok.Data, + }) + return true + case DoctypeToken: + // Ignore the token. + return true + } + + p.parseImpliedToken(StartTagToken, a.Head, a.Head.String()) + return false +} + +// Section 12.2.6.4.4. +func inHeadIM(p *parser) bool { + switch p.tok.Type { + case TextToken: + s := strings.TrimLeft(p.tok.Data, whitespace) + if len(s) < len(p.tok.Data) { + // Add the initial whitespace to the current node. + p.addText(p.tok.Data[:len(p.tok.Data)-len(s)]) + if s == "" { + return true + } + p.tok.Data = s + } + case StartTagToken: + switch p.tok.DataAtom { + case a.Html: + return inBodyIM(p) + case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta: + p.addElement() + p.oe.pop() + p.acknowledgeSelfClosingTag() + return true + case a.Noscript: + if p.scripting { + p.parseGenericRawTextElement() + return true + } + p.addElement() + p.im = inHeadNoscriptIM + // Don't let the tokenizer go into raw text mode when scripting is disabled. + p.tokenizer.NextIsNotRawText() + return true + case a.Script, a.Title: + p.addElement() + p.setOriginalIM() + p.im = textIM + return true + case a.Noframes, a.Style: + p.parseGenericRawTextElement() + return true + case a.Head: + // Ignore the token. + return true + case a.Template: + // TODO: remove this divergence from the HTML5 spec. + // + // We don't handle all of the corner cases when mixing foreign + // content (i.e. or ) with tag. + case a.Template: + return inHeadIM(p) + default: + // Ignore the token. + return true + } + case CommentToken: + p.addChild(&Node{ + Type: CommentNode, + Data: p.tok.Data, + }) + return true + case DoctypeToken: + // Ignore the token. + return true + } + + p.parseImpliedToken(StartTagToken, a.Body, a.Body.String()) + p.framesetOK = true + return false +} + +// copyAttributes copies attributes of src not found on dst to dst. +func copyAttributes(dst *Node, src Token) { + if len(src.Attr) == 0 { + return + } + attr := map[string]string{} + for _, t := range dst.Attr { + attr[t.Key] = t.Val + } + for _, t := range src.Attr { + if _, ok := attr[t.Key]; !ok { + dst.Attr = append(dst.Attr, t) + attr[t.Key] = t.Val + } + } +} + +// Section 12.2.6.4.7. +func inBodyIM(p *parser) bool { + switch p.tok.Type { + case TextToken: + d := p.tok.Data + switch n := p.oe.top(); n.DataAtom { + case a.Pre, a.Listing: + if n.FirstChild == nil { + // Ignore a newline at the start of a
     block.
    +				if d != "" && d[0] == '\r' {
    +					d = d[1:]
    +				}
    +				if d != "" && d[0] == '\n' {
    +					d = d[1:]
    +				}
    +			}
    +		}
    +		d = strings.Replace(d, "\x00", "", -1)
    +		if d == "" {
    +			return true
    +		}
    +		p.reconstructActiveFormattingElements()
    +		p.addText(d)
    +		if p.framesetOK && strings.TrimLeft(d, whitespace) != "" {
    +			// There were non-whitespace characters inserted.
    +			p.framesetOK = false
    +		}
    +	case StartTagToken:
    +		switch p.tok.DataAtom {
    +		case a.Html:
    +			if p.oe.contains(a.Template) {
    +				return true
    +			}
    +			copyAttributes(p.oe[0], p.tok)
    +		case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title:
    +			return inHeadIM(p)
    +		case a.Body:
    +			if p.oe.contains(a.Template) {
    +				return true
    +			}
    +			if len(p.oe) >= 2 {
    +				body := p.oe[1]
    +				if body.Type == ElementNode && body.DataAtom == a.Body {
    +					p.framesetOK = false
    +					copyAttributes(body, p.tok)
    +				}
    +			}
    +		case a.Frameset:
    +			if !p.framesetOK || len(p.oe) < 2 || p.oe[1].DataAtom != a.Body {
    +				// Ignore the token.
    +				return true
    +			}
    +			body := p.oe[1]
    +			if body.Parent != nil {
    +				body.Parent.RemoveChild(body)
    +			}
    +			p.oe = p.oe[:1]
    +			p.addElement()
    +			p.im = inFramesetIM
    +			return true
    +		case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Main, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul:
    +			p.popUntil(buttonScope, a.P)
    +			p.addElement()
    +		case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
    +			p.popUntil(buttonScope, a.P)
    +			switch n := p.top(); n.DataAtom {
    +			case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
    +				p.oe.pop()
    +			}
    +			p.addElement()
    +		case a.Pre, a.Listing:
    +			p.popUntil(buttonScope, a.P)
    +			p.addElement()
    +			// The newline, if any, will be dealt with by the TextToken case.
    +			p.framesetOK = false
    +		case a.Form:
    +			if p.form != nil && !p.oe.contains(a.Template) {
    +				// Ignore the token
    +				return true
    +			}
    +			p.popUntil(buttonScope, a.P)
    +			p.addElement()
    +			if !p.oe.contains(a.Template) {
    +				p.form = p.top()
    +			}
    +		case a.Li:
    +			p.framesetOK = false
    +			for i := len(p.oe) - 1; i >= 0; i-- {
    +				node := p.oe[i]
    +				switch node.DataAtom {
    +				case a.Li:
    +					p.oe = p.oe[:i]
    +				case a.Address, a.Div, a.P:
    +					continue
    +				default:
    +					if !isSpecialElement(node) {
    +						continue
    +					}
    +				}
    +				break
    +			}
    +			p.popUntil(buttonScope, a.P)
    +			p.addElement()
    +		case a.Dd, a.Dt:
    +			p.framesetOK = false
    +			for i := len(p.oe) - 1; i >= 0; i-- {
    +				node := p.oe[i]
    +				switch node.DataAtom {
    +				case a.Dd, a.Dt:
    +					p.oe = p.oe[:i]
    +				case a.Address, a.Div, a.P:
    +					continue
    +				default:
    +					if !isSpecialElement(node) {
    +						continue
    +					}
    +				}
    +				break
    +			}
    +			p.popUntil(buttonScope, a.P)
    +			p.addElement()
    +		case a.Plaintext:
    +			p.popUntil(buttonScope, a.P)
    +			p.addElement()
    +		case a.Button:
    +			p.popUntil(defaultScope, a.Button)
    +			p.reconstructActiveFormattingElements()
    +			p.addElement()
    +			p.framesetOK = false
    +		case a.A:
    +			for i := len(p.afe) - 1; i >= 0 && p.afe[i].Type != scopeMarkerNode; i-- {
    +				if n := p.afe[i]; n.Type == ElementNode && n.DataAtom == a.A {
    +					p.inBodyEndTagFormatting(a.A, "a")
    +					p.oe.remove(n)
    +					p.afe.remove(n)
    +					break
    +				}
    +			}
    +			p.reconstructActiveFormattingElements()
    +			p.addFormattingElement()
    +		case a.B, a.Big, a.Code, a.Em, a.Font, a.I, a.S, a.Small, a.Strike, a.Strong, a.Tt, a.U:
    +			p.reconstructActiveFormattingElements()
    +			p.addFormattingElement()
    +		case a.Nobr:
    +			p.reconstructActiveFormattingElements()
    +			if p.elementInScope(defaultScope, a.Nobr) {
    +				p.inBodyEndTagFormatting(a.Nobr, "nobr")
    +				p.reconstructActiveFormattingElements()
    +			}
    +			p.addFormattingElement()
    +		case a.Applet, a.Marquee, a.Object:
    +			p.reconstructActiveFormattingElements()
    +			p.addElement()
    +			p.afe = append(p.afe, &scopeMarker)
    +			p.framesetOK = false
    +		case a.Table:
    +			if !p.quirks {
    +				p.popUntil(buttonScope, a.P)
    +			}
    +			p.addElement()
    +			p.framesetOK = false
    +			p.im = inTableIM
    +			return true
    +		case a.Area, a.Br, a.Embed, a.Img, a.Input, a.Keygen, a.Wbr:
    +			p.reconstructActiveFormattingElements()
    +			p.addElement()
    +			p.oe.pop()
    +			p.acknowledgeSelfClosingTag()
    +			if p.tok.DataAtom == a.Input {
    +				for _, t := range p.tok.Attr {
    +					if t.Key == "type" {
    +						if strings.ToLower(t.Val) == "hidden" {
    +							// Skip setting framesetOK = false
    +							return true
    +						}
    +					}
    +				}
    +			}
    +			p.framesetOK = false
    +		case a.Param, a.Source, a.Track:
    +			p.addElement()
    +			p.oe.pop()
    +			p.acknowledgeSelfClosingTag()
    +		case a.Hr:
    +			p.popUntil(buttonScope, a.P)
    +			p.addElement()
    +			p.oe.pop()
    +			p.acknowledgeSelfClosingTag()
    +			p.framesetOK = false
    +		case a.Image:
    +			p.tok.DataAtom = a.Img
    +			p.tok.Data = a.Img.String()
    +			return false
    +		case a.Textarea:
    +			p.addElement()
    +			p.setOriginalIM()
    +			p.framesetOK = false
    +			p.im = textIM
    +		case a.Xmp:
    +			p.popUntil(buttonScope, a.P)
    +			p.reconstructActiveFormattingElements()
    +			p.framesetOK = false
    +			p.parseGenericRawTextElement()
    +		case a.Iframe:
    +			p.framesetOK = false
    +			p.parseGenericRawTextElement()
    +		case a.Noembed:
    +			p.parseGenericRawTextElement()
    +		case a.Noscript:
    +			if p.scripting {
    +				p.parseGenericRawTextElement()
    +				return true
    +			}
    +			p.reconstructActiveFormattingElements()
    +			p.addElement()
    +			// Don't let the tokenizer go into raw text mode when scripting is disabled.
    +			p.tokenizer.NextIsNotRawText()
    +		case a.Select:
    +			p.reconstructActiveFormattingElements()
    +			p.addElement()
    +			p.framesetOK = false
    +			p.im = inSelectIM
    +			return true
    +		case a.Optgroup, a.Option:
    +			if p.top().DataAtom == a.Option {
    +				p.oe.pop()
    +			}
    +			p.reconstructActiveFormattingElements()
    +			p.addElement()
    +		case a.Rb, a.Rtc:
    +			if p.elementInScope(defaultScope, a.Ruby) {
    +				p.generateImpliedEndTags()
    +			}
    +			p.addElement()
    +		case a.Rp, a.Rt:
    +			if p.elementInScope(defaultScope, a.Ruby) {
    +				p.generateImpliedEndTags("rtc")
    +			}
    +			p.addElement()
    +		case a.Math, a.Svg:
    +			p.reconstructActiveFormattingElements()
    +			if p.tok.DataAtom == a.Math {
    +				adjustAttributeNames(p.tok.Attr, mathMLAttributeAdjustments)
    +			} else {
    +				adjustAttributeNames(p.tok.Attr, svgAttributeAdjustments)
    +			}
    +			adjustForeignAttributes(p.tok.Attr)
    +			p.addElement()
    +			p.top().Namespace = p.tok.Data
    +			if p.hasSelfClosingToken {
    +				p.oe.pop()
    +				p.acknowledgeSelfClosingTag()
    +			}
    +			return true
    +		case a.Caption, a.Col, a.Colgroup, a.Frame, a.Head, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr:
    +			// Ignore the token.
    +		default:
    +			p.reconstructActiveFormattingElements()
    +			p.addElement()
    +		}
    +	case EndTagToken:
    +		switch p.tok.DataAtom {
    +		case a.Body:
    +			if p.elementInScope(defaultScope, a.Body) {
    +				p.im = afterBodyIM
    +			}
    +		case a.Html:
    +			if p.elementInScope(defaultScope, a.Body) {
    +				p.parseImpliedToken(EndTagToken, a.Body, a.Body.String())
    +				return false
    +			}
    +			return true
    +		case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul:
    +			p.popUntil(defaultScope, p.tok.DataAtom)
    +		case a.Form:
    +			if p.oe.contains(a.Template) {
    +				i := p.indexOfElementInScope(defaultScope, a.Form)
    +				if i == -1 {
    +					// Ignore the token.
    +					return true
    +				}
    +				p.generateImpliedEndTags()
    +				if p.oe[i].DataAtom != a.Form {
    +					// Ignore the token.
    +					return true
    +				}
    +				p.popUntil(defaultScope, a.Form)
    +			} else {
    +				node := p.form
    +				p.form = nil
    +				i := p.indexOfElementInScope(defaultScope, a.Form)
    +				if node == nil || i == -1 || p.oe[i] != node {
    +					// Ignore the token.
    +					return true
    +				}
    +				p.generateImpliedEndTags()
    +				p.oe.remove(node)
    +			}
    +		case a.P:
    +			if !p.elementInScope(buttonScope, a.P) {
    +				p.parseImpliedToken(StartTagToken, a.P, a.P.String())
    +			}
    +			p.popUntil(buttonScope, a.P)
    +		case a.Li:
    +			p.popUntil(listItemScope, a.Li)
    +		case a.Dd, a.Dt:
    +			p.popUntil(defaultScope, p.tok.DataAtom)
    +		case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
    +			p.popUntil(defaultScope, a.H1, a.H2, a.H3, a.H4, a.H5, a.H6)
    +		case a.A, a.B, a.Big, a.Code, a.Em, a.Font, a.I, a.Nobr, a.S, a.Small, a.Strike, a.Strong, a.Tt, a.U:
    +			p.inBodyEndTagFormatting(p.tok.DataAtom, p.tok.Data)
    +		case a.Applet, a.Marquee, a.Object:
    +			if p.popUntil(defaultScope, p.tok.DataAtom) {
    +				p.clearActiveFormattingElements()
    +			}
    +		case a.Br:
    +			p.tok.Type = StartTagToken
    +			return false
    +		case a.Template:
    +			return inHeadIM(p)
    +		default:
    +			p.inBodyEndTagOther(p.tok.DataAtom, p.tok.Data)
    +		}
    +	case CommentToken:
    +		p.addChild(&Node{
    +			Type: CommentNode,
    +			Data: p.tok.Data,
    +		})
    +	case ErrorToken:
    +		// TODO: remove this divergence from the HTML5 spec.
    +		if len(p.templateStack) > 0 {
    +			p.im = inTemplateIM
    +			return false
    +		}
    +		for _, e := range p.oe {
    +			switch e.DataAtom {
    +			case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc, a.Tbody, a.Td, a.Tfoot, a.Th,
    +				a.Thead, a.Tr, a.Body, a.Html:
    +			default:
    +				return true
    +			}
    +		}
    +	}
    +
    +	return true
    +}
    +
    +func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) {
    +	// This is the "adoption agency" algorithm, described at
    +	// https://html.spec.whatwg.org/multipage/syntax.html#adoptionAgency
    +
    +	// TODO: this is a fairly literal line-by-line translation of that algorithm.
    +	// Once the code successfully parses the comprehensive test suite, we should
    +	// refactor this code to be more idiomatic.
    +
    +	// Steps 1-2
    +	if current := p.oe.top(); current.Data == tagName && p.afe.index(current) == -1 {
    +		p.oe.pop()
    +		return
    +	}
    +
    +	// Steps 3-5. The outer loop.
    +	for i := 0; i < 8; i++ {
    +		// Step 6. Find the formatting element.
    +		var formattingElement *Node
    +		for j := len(p.afe) - 1; j >= 0; j-- {
    +			if p.afe[j].Type == scopeMarkerNode {
    +				break
    +			}
    +			if p.afe[j].DataAtom == tagAtom {
    +				formattingElement = p.afe[j]
    +				break
    +			}
    +		}
    +		if formattingElement == nil {
    +			p.inBodyEndTagOther(tagAtom, tagName)
    +			return
    +		}
    +
    +		// Step 7. Ignore the tag if formatting element is not in the stack of open elements.
    +		feIndex := p.oe.index(formattingElement)
    +		if feIndex == -1 {
    +			p.afe.remove(formattingElement)
    +			return
    +		}
    +		// Step 8. Ignore the tag if formatting element is not in the scope.
    +		if !p.elementInScope(defaultScope, tagAtom) {
    +			// Ignore the tag.
    +			return
    +		}
    +
    +		// Step 9. This step is omitted because it's just a parse error but no need to return.
    +
    +		// Steps 10-11. Find the furthest block.
    +		var furthestBlock *Node
    +		for _, e := range p.oe[feIndex:] {
    +			if isSpecialElement(e) {
    +				furthestBlock = e
    +				break
    +			}
    +		}
    +		if furthestBlock == nil {
    +			e := p.oe.pop()
    +			for e != formattingElement {
    +				e = p.oe.pop()
    +			}
    +			p.afe.remove(e)
    +			return
    +		}
    +
    +		// Steps 12-13. Find the common ancestor and bookmark node.
    +		commonAncestor := p.oe[feIndex-1]
    +		bookmark := p.afe.index(formattingElement)
    +
    +		// Step 14. The inner loop. Find the lastNode to reparent.
    +		lastNode := furthestBlock
    +		node := furthestBlock
    +		x := p.oe.index(node)
    +		// Step 14.1.
    +		j := 0
    +		for {
    +			// Step 14.2.
    +			j++
    +			// Step. 14.3.
    +			x--
    +			node = p.oe[x]
    +			// Step 14.4. Go to the next step if node is formatting element.
    +			if node == formattingElement {
    +				break
    +			}
    +			// Step 14.5. Remove node from the list of active formatting elements if
    +			// inner loop counter is greater than three and node is in the list of
    +			// active formatting elements.
    +			if ni := p.afe.index(node); j > 3 && ni > -1 {
    +				p.afe.remove(node)
    +				// If any element of the list of active formatting elements is removed,
    +				// we need to take care whether bookmark should be decremented or not.
    +				// This is because the value of bookmark may exceed the size of the
    +				// list by removing elements from the list.
    +				if ni <= bookmark {
    +					bookmark--
    +				}
    +				continue
    +			}
    +			// Step 14.6. Continue the next inner loop if node is not in the list of
    +			// active formatting elements.
    +			if p.afe.index(node) == -1 {
    +				p.oe.remove(node)
    +				continue
    +			}
    +			// Step 14.7.
    +			clone := node.clone()
    +			p.afe[p.afe.index(node)] = clone
    +			p.oe[p.oe.index(node)] = clone
    +			node = clone
    +			// Step 14.8.
    +			if lastNode == furthestBlock {
    +				bookmark = p.afe.index(node) + 1
    +			}
    +			// Step 14.9.
    +			if lastNode.Parent != nil {
    +				lastNode.Parent.RemoveChild(lastNode)
    +			}
    +			node.AppendChild(lastNode)
    +			// Step 14.10.
    +			lastNode = node
    +		}
    +
    +		// Step 15. Reparent lastNode to the common ancestor,
    +		// or for misnested table nodes, to the foster parent.
    +		if lastNode.Parent != nil {
    +			lastNode.Parent.RemoveChild(lastNode)
    +		}
    +		switch commonAncestor.DataAtom {
    +		case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr:
    +			p.fosterParent(lastNode)
    +		default:
    +			commonAncestor.AppendChild(lastNode)
    +		}
    +
    +		// Steps 16-18. Reparent nodes from the furthest block's children
    +		// to a clone of the formatting element.
    +		clone := formattingElement.clone()
    +		reparentChildren(clone, furthestBlock)
    +		furthestBlock.AppendChild(clone)
    +
    +		// Step 19. Fix up the list of active formatting elements.
    +		if oldLoc := p.afe.index(formattingElement); oldLoc != -1 && oldLoc < bookmark {
    +			// Move the bookmark with the rest of the list.
    +			bookmark--
    +		}
    +		p.afe.remove(formattingElement)
    +		p.afe.insert(bookmark, clone)
    +
    +		// Step 20. Fix up the stack of open elements.
    +		p.oe.remove(formattingElement)
    +		p.oe.insert(p.oe.index(furthestBlock)+1, clone)
    +	}
    +}
    +
    +// inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM.
    +// "Any other end tag" handling from 12.2.6.5 The rules for parsing tokens in foreign content
    +// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inforeign
    +func (p *parser) inBodyEndTagOther(tagAtom a.Atom, tagName string) {
    +	for i := len(p.oe) - 1; i >= 0; i-- {
    +		// Two element nodes have the same tag if they have the same Data (a
    +		// string-typed field). As an optimization, for common HTML tags, each
    +		// Data string is assigned a unique, non-zero DataAtom (a uint32-typed
    +		// field), since integer comparison is faster than string comparison.
    +		// Uncommon (custom) tags get a zero DataAtom.
    +		//
    +		// The if condition here is equivalent to (p.oe[i].Data == tagName).
    +		if (p.oe[i].DataAtom == tagAtom) &&
    +			((tagAtom != 0) || (p.oe[i].Data == tagName)) {
    +			p.oe = p.oe[:i]
    +			break
    +		}
    +		if isSpecialElement(p.oe[i]) {
    +			break
    +		}
    +	}
    +}
    +
    +// Section 12.2.6.4.8.
    +func textIM(p *parser) bool {
    +	switch p.tok.Type {
    +	case ErrorToken:
    +		p.oe.pop()
    +	case TextToken:
    +		d := p.tok.Data
    +		if n := p.oe.top(); n.DataAtom == a.Textarea && n.FirstChild == nil {
    +			// Ignore a newline at the start of a