From 3f0ede560cc79c7878add5258b1e3b59e2955370 Mon Sep 17 00:00:00 2001 From: Dmitry Verkhoturov Date: Sat, 4 Sep 2021 11:41:35 +0300 Subject: [PATCH] bump go modules in the project --- backend/_example/memory_store/go.sum | 94 +- backend/app/store/formatter_test.go | 4 +- backend/go.mod | 36 +- backend/go.sum | 115 +- backend/remark.rest | 2 +- .../github.com/Depado/bfchroma/.golangci.yml | 16 + .../github.com/Depado/bfchroma/README.md | 9 +- .../vendor/github.com/Depado/bfchroma/go.mod | 17 +- .../vendor/github.com/Depado/bfchroma/go.sum | 38 +- .../github.com/Depado/bfchroma/renderer.go | 20 + .../PuerkitoBio/goquery/.travis.yml | 24 +- .../github.com/PuerkitoBio/goquery/LICENSE | 2 +- .../github.com/PuerkitoBio/goquery/README.md | 42 +- .../github.com/PuerkitoBio/goquery/go.mod | 4 +- .../github.com/PuerkitoBio/goquery/go.sum | 16 +- .../PuerkitoBio/goquery/manipulation.go | 167 +- .../github.com/PuerkitoBio/goquery/type.go | 64 +- .../PuerkitoBio/goquery/utilities.go | 18 +- .../alecthomas/chroma/.golangci.yml | 21 + .../alecthomas/chroma/.goreleaser.yml | 2 + .../github.com/alecthomas/chroma/.travis.yml | 12 - .../github.com/alecthomas/chroma/Makefile | 6 +- .../github.com/alecthomas/chroma/README.md | 53 +- .../alecthomas/chroma/formatters/html/html.go | 26 +- .../github.com/alecthomas/chroma/go.mod | 11 +- .../github.com/alecthomas/chroma/go.sum | 27 +- .../github.com/alecthomas/chroma/iterator.go | 2 +- .../github.com/alecthomas/chroma/lexer.go | 9 +- .../alecthomas/chroma/lexers/README.md | 3 + .../alecthomas/chroma/lexers/a/abap.go | 12 +- .../alecthomas/chroma/lexers/a/abnf.go | 12 +- .../chroma/lexers/a/actionscript.go | 12 +- .../chroma/lexers/a/actionscript3.go | 12 +- .../alecthomas/chroma/lexers/a/ada.go | 12 +- .../alecthomas/chroma/lexers/a/al.go | 48 + .../alecthomas/chroma/lexers/a/angular2.go | 12 +- .../alecthomas/chroma/lexers/a/antlr.go | 12 +- .../alecthomas/chroma/lexers/a/apache.go | 12 +- .../alecthomas/chroma/lexers/a/apl.go | 12 +- .../alecthomas/chroma/lexers/a/applescript.go | 12 +- .../alecthomas/chroma/lexers/a/arduino.go | 12 +- .../alecthomas/chroma/lexers/a/awk.go | 22 +- .../alecthomas/chroma/lexers/b/ballerina.go | 12 +- .../alecthomas/chroma/lexers/b/bash.go | 25 +- .../alecthomas/chroma/lexers/b/batch.go | 12 +- .../alecthomas/chroma/lexers/b/bibtex.go | 12 +- .../alecthomas/chroma/lexers/b/blitz.go | 12 +- .../alecthomas/chroma/lexers/b/bnf.go | 12 +- .../alecthomas/chroma/lexers/b/brainfuck.go | 12 +- .../alecthomas/chroma/lexers/c/c.go | 19 +- .../alecthomas/chroma/lexers/c/caddyfile.go | 216 + .../alecthomas/chroma/lexers/c/capnproto.go | 12 +- .../alecthomas/chroma/lexers/c/ceylon.go | 12 +- .../alecthomas/chroma/lexers/c/cfengine3.go | 12 +- .../alecthomas/chroma/lexers/c/chaiscript.go | 12 +- .../alecthomas/chroma/lexers/c/cheetah.go | 12 +- .../alecthomas/chroma/lexers/c/cl.go | 28 +- .../alecthomas/chroma/lexers/c/clojure.go | 12 +- .../alecthomas/chroma/lexers/c/cmake.go | 12 +- .../alecthomas/chroma/lexers/c/cobol.go | 12 +- .../alecthomas/chroma/lexers/c/coffee.go | 12 +- .../alecthomas/chroma/lexers/c/coldfusion.go | 12 +- .../alecthomas/chroma/lexers/c/coq.go | 12 +- .../alecthomas/chroma/lexers/c/cpp.go | 12 +- .../alecthomas/chroma/lexers/c/cql.go | 15 +- .../alecthomas/chroma/lexers/c/crystal.go | 12 +- .../alecthomas/chroma/lexers/c/csharp.go | 14 +- .../alecthomas/chroma/lexers/c/css.go | 25 +- .../alecthomas/chroma/lexers/c/cython.go | 12 +- .../alecthomas/chroma/lexers/circular/php.go | 33 +- .../chroma/lexers/circular/phtml.go | 39 + .../alecthomas/chroma/lexers/d/d.go | 12 +- .../alecthomas/chroma/lexers/d/dart.go | 12 +- .../alecthomas/chroma/lexers/d/diff.go | 12 +- .../alecthomas/chroma/lexers/d/django.go | 12 +- .../alecthomas/chroma/lexers/d/docker.go | 12 +- .../alecthomas/chroma/lexers/d/dtd.go | 12 +- .../alecthomas/chroma/lexers/d/dylan.go | 76 + .../alecthomas/chroma/lexers/e/ebnf.go | 12 +- .../alecthomas/chroma/lexers/e/elixir.go | 19 +- .../alecthomas/chroma/lexers/e/elm.go | 12 +- .../alecthomas/chroma/lexers/e/emacs.go | 24 +- .../alecthomas/chroma/lexers/e/erlang.go | 12 +- .../alecthomas/chroma/lexers/f/factor.go | 12 +- .../alecthomas/chroma/lexers/f/fish.go | 55 +- .../alecthomas/chroma/lexers/f/forth.go | 12 +- .../alecthomas/chroma/lexers/f/fortran.go | 12 +- .../chroma/lexers/f/fortran_fixed.go | 39 + .../alecthomas/chroma/lexers/f/fsharp.go | 12 +- .../alecthomas/chroma/lexers/g/gas.go | 12 +- .../alecthomas/chroma/lexers/g/gdscript.go | 12 +- .../alecthomas/chroma/lexers/g/genshi.go | 116 +- .../alecthomas/chroma/lexers/g/gherkin.go | 122 + .../alecthomas/chroma/lexers/g/glsl.go | 12 +- .../alecthomas/chroma/lexers/g/gnuplot.go | 12 +- .../alecthomas/chroma/lexers/g/go.go | 115 +- .../alecthomas/chroma/lexers/g/graphql.go | 12 +- .../alecthomas/chroma/lexers/g/groff.go | 47 + .../alecthomas/chroma/lexers/g/groovy.go | 12 +- .../alecthomas/chroma/lexers/h/handlebars.go | 16 +- .../alecthomas/chroma/lexers/h/haskell.go | 12 +- .../alecthomas/chroma/lexers/h/haxe.go | 12 +- .../alecthomas/chroma/lexers/h/hcl.go | 12 +- .../alecthomas/chroma/lexers/h/hexdump.go | 12 +- .../alecthomas/chroma/lexers/{ => h}/hlb.go | 14 +- .../alecthomas/chroma/lexers/h/html.go | 12 +- .../alecthomas/chroma/lexers/h/http.go | 22 +- .../alecthomas/chroma/lexers/h/hy.go | 12 +- .../alecthomas/chroma/lexers/i/idris.go | 12 +- .../alecthomas/chroma/lexers/i/igor.go | 12 +- .../alecthomas/chroma/lexers/i/ini.go | 14 +- .../alecthomas/chroma/lexers/i/io.go | 12 +- .../alecthomas/chroma/lexers/internal/api.go | 55 +- .../alecthomas/chroma/lexers/j/j.go | 12 +- .../alecthomas/chroma/lexers/j/java.go | 13 +- .../alecthomas/chroma/lexers/j/javascript.go | 11 +- .../alecthomas/chroma/lexers/j/json.go | 12 +- .../alecthomas/chroma/lexers/j/jsx.go | 19 +- .../alecthomas/chroma/lexers/j/julia.go | 157 +- .../alecthomas/chroma/lexers/j/jungle.go | 12 +- .../alecthomas/chroma/lexers/k/kotlin.go | 75 +- .../alecthomas/chroma/lexers/l/lighttpd.go | 12 +- .../alecthomas/chroma/lexers/l/llvm.go | 12 +- .../alecthomas/chroma/lexers/l/lua.go | 12 +- .../alecthomas/chroma/lexers/lexers.go | 3 +- .../alecthomas/chroma/lexers/m/make.go | 12 +- .../alecthomas/chroma/lexers/m/mako.go | 12 +- .../alecthomas/chroma/lexers/m/markdown.go | 17 +- .../alecthomas/chroma/lexers/m/mason.go | 12 +- .../alecthomas/chroma/lexers/m/mathematica.go | 12 +- .../alecthomas/chroma/lexers/m/matlab.go | 12 +- .../alecthomas/chroma/lexers/m/mcfunction.go | 109 + .../alecthomas/chroma/lexers/m/metal.go | 101 + .../alecthomas/chroma/lexers/m/minizinc.go | 12 +- .../alecthomas/chroma/lexers/m/mlir.go | 12 +- .../alecthomas/chroma/lexers/m/modula2.go | 12 +- .../alecthomas/chroma/lexers/m/monkeyc.go | 12 +- .../alecthomas/chroma/lexers/m/mwscript.go | 12 +- .../alecthomas/chroma/lexers/m/myghty.go | 22 +- .../alecthomas/chroma/lexers/m/mysql.go | 43 +- .../alecthomas/chroma/lexers/n/nasm.go | 12 +- .../alecthomas/chroma/lexers/n/newspeak.go | 12 +- .../alecthomas/chroma/lexers/n/nginx.go | 12 +- .../alecthomas/chroma/lexers/n/nim.go | 12 +- .../alecthomas/chroma/lexers/n/nix.go | 18 +- .../alecthomas/chroma/lexers/o/objectivec.go | 12 +- .../alecthomas/chroma/lexers/o/ocaml.go | 12 +- .../alecthomas/chroma/lexers/o/octave.go | 12 +- .../alecthomas/chroma/lexers/o/openscad.go | 12 +- .../alecthomas/chroma/lexers/o/org.go | 18 +- .../alecthomas/chroma/lexers/p/pacman.go | 12 +- .../alecthomas/chroma/lexers/p/perl.go | 12 +- .../alecthomas/chroma/lexers/p/pig.go | 12 +- .../alecthomas/chroma/lexers/p/pkgconfig.go | 12 +- .../alecthomas/chroma/lexers/p/plaintext.go | 2 +- .../alecthomas/chroma/lexers/p/plsql.go | 14 +- .../alecthomas/chroma/lexers/p/pony.go | 63 + .../alecthomas/chroma/lexers/p/postgres.go | 18 +- .../alecthomas/chroma/lexers/p/postscript.go | 12 +- .../alecthomas/chroma/lexers/p/povray.go | 12 +- .../alecthomas/chroma/lexers/p/powerquery.go | 38 + .../alecthomas/chroma/lexers/p/powershell.go | 18 +- .../alecthomas/chroma/lexers/p/prolog.go | 12 +- .../alecthomas/chroma/lexers/p/promql.go | 59 + .../alecthomas/chroma/lexers/p/protobuf.go | 12 +- .../alecthomas/chroma/lexers/p/puppet.go | 12 +- .../alecthomas/chroma/lexers/p/python.go | 182 +- .../alecthomas/chroma/lexers/p/python2.go | 141 + .../alecthomas/chroma/lexers/p/python3.go | 137 - .../alecthomas/chroma/lexers/q/qbasic.go | 12 +- .../alecthomas/chroma/lexers/q/qml.go | 58 + .../alecthomas/chroma/lexers/r/r.go | 12 +- .../alecthomas/chroma/lexers/r/racket.go | 12 +- .../alecthomas/chroma/lexers/r/ragel.go | 12 +- .../alecthomas/chroma/lexers/r/raku.go | 1496 +++ .../alecthomas/chroma/lexers/r/reasonml.go | 71 + .../alecthomas/chroma/lexers/r/regedit.go | 12 +- .../alecthomas/chroma/lexers/r/rexx.go | 12 +- .../alecthomas/chroma/lexers/r/rst.go | 16 +- .../alecthomas/chroma/lexers/r/ruby.go | 14 +- .../alecthomas/chroma/lexers/r/rust.go | 22 +- .../alecthomas/chroma/lexers/s/sas.go | 12 +- .../alecthomas/chroma/lexers/s/sass.go | 12 +- .../alecthomas/chroma/lexers/s/scala.go | 26 +- .../alecthomas/chroma/lexers/s/scheme.go | 12 +- .../alecthomas/chroma/lexers/s/scilab.go | 12 +- .../alecthomas/chroma/lexers/s/scss.go | 59 +- .../alecthomas/chroma/lexers/s/smalltalk.go | 12 +- .../alecthomas/chroma/lexers/s/smarty.go | 12 +- .../alecthomas/chroma/lexers/s/sml.go | 12 +- .../alecthomas/chroma/lexers/s/snobol.go | 12 +- .../alecthomas/chroma/lexers/s/solidity.go | 44 +- .../alecthomas/chroma/lexers/s/sparql.go | 12 +- .../alecthomas/chroma/lexers/s/sql.go | 14 +- .../alecthomas/chroma/lexers/s/squid.go | 12 +- .../alecthomas/chroma/lexers/s/stylus.go | 66 + .../alecthomas/chroma/lexers/s/svelte.go | 73 + .../alecthomas/chroma/lexers/s/swift.go | 12 +- .../alecthomas/chroma/lexers/s/systemd.go | 19 +- .../chroma/lexers/s/systemverilog.go | 12 +- .../alecthomas/chroma/lexers/t/tablegen.go | 12 +- .../alecthomas/chroma/lexers/t/tasm.go | 12 +- .../alecthomas/chroma/lexers/t/tcl.go | 12 +- .../alecthomas/chroma/lexers/t/tcsh.go | 12 +- .../alecthomas/chroma/lexers/t/termcap.go | 12 +- .../alecthomas/chroma/lexers/t/terminfo.go | 12 +- .../alecthomas/chroma/lexers/t/terraform.go | 12 +- .../alecthomas/chroma/lexers/t/tex.go | 12 +- .../alecthomas/chroma/lexers/t/thrift.go | 12 +- .../alecthomas/chroma/lexers/t/toml.go | 16 +- .../alecthomas/chroma/lexers/t/tradingview.go | 12 +- .../alecthomas/chroma/lexers/t/transactsql.go | 12 +- .../alecthomas/chroma/lexers/t/turing.go | 12 +- .../alecthomas/chroma/lexers/t/turtle.go | 12 +- .../alecthomas/chroma/lexers/t/twig.go | 12 +- .../alecthomas/chroma/lexers/t/typescript.go | 48 +- .../alecthomas/chroma/lexers/t/typoscript.go | 36 +- .../alecthomas/chroma/lexers/v/vb.go | 12 +- .../alecthomas/chroma/lexers/v/verilog.go | 12 +- .../alecthomas/chroma/lexers/v/vhdl.go | 12 +- .../alecthomas/chroma/lexers/v/vim.go | 12 +- .../alecthomas/chroma/lexers/v/vue.go | 12 +- .../alecthomas/chroma/lexers/w/wdte.go | 12 +- .../alecthomas/chroma/lexers/x/xml.go | 12 +- .../alecthomas/chroma/lexers/x/xorg.go | 12 +- .../alecthomas/chroma/lexers/y/yaml.go | 32 +- .../alecthomas/chroma/lexers/y/yang.go | 71 + .../alecthomas/chroma/lexers/z/zig.go | 58 + .../alecthomas/chroma/pygments-lexers.txt | 3 - .../github.com/alecthomas/chroma/regexp.go | 210 +- .../github.com/alecthomas/chroma/style.go | 10 +- .../alecthomas/chroma/styles/base16-snazzy.go | 81 + .../alecthomas/chroma/styles/doom-one.go | 58 + .../alecthomas/chroma/styles/doom-one2.go | 71 + .../alecthomas/chroma/styles/dracula.go | 4 +- .../alecthomas/chroma/styles/hr_dark.go | 17 + .../chroma/styles/hr_high_contrast.go | 19 + .../alecthomas/chroma/styles/nord.go | 75 + .../alecthomas/chroma/styles/vulcan.go | 95 + .../alecthomas/chroma/styles/xcode-dark.go | 62 + .../github.com/alecthomas/chroma/table.py | 21 +- .../github.com/alecthomas/chroma/types.go | 2 +- .../github.com/andybalholm/cascadia/go.mod | 6 +- .../github.com/andybalholm/cascadia/parser.go | 93 +- .../andybalholm/cascadia/selector.go | 113 +- .../andybalholm/cascadia/serialize.go | 120 + .../github.com/aws/aws-sdk-go/LICENSE.txt | 202 - .../github.com/aws/aws-sdk-go/NOTICE.txt | 3 - .../aws/aws-sdk-go/aws/awserr/error.go | 164 - .../aws/aws-sdk-go/aws/awserr/types.go | 221 - .../aws/aws-sdk-go/aws/awsutil/copy.go | 108 - .../aws/aws-sdk-go/aws/awsutil/equal.go | 27 - .../aws/aws-sdk-go/aws/awsutil/path_value.go | 221 - .../aws/aws-sdk-go/aws/awsutil/prettify.go | 113 - .../aws-sdk-go/aws/awsutil/string_value.go | 88 - .../aws/client/metadata/client_info.go | 14 - .../github.com/aws/aws-sdk-go/aws/config.go | 587 - .../aws/aws-sdk-go/aws/context_1_5.go | 37 - .../aws/aws-sdk-go/aws/context_1_9.go | 11 - .../aws-sdk-go/aws/context_background_1_5.go | 22 - .../aws-sdk-go/aws/context_background_1_7.go | 20 - .../aws/aws-sdk-go/aws/context_sleep.go | 24 - .../aws/aws-sdk-go/aws/convert_types.go | 918 -- .../aws/credentials/chain_provider.go | 100 - .../credentials/context_background_go1.5.go | 22 - .../credentials/context_background_go1.7.go | 20 - .../aws/credentials/context_go1.5.go | 39 - .../aws/credentials/context_go1.9.go | 13 - .../aws-sdk-go/aws/credentials/credentials.go | 339 - .../aws/credentials/env_provider.go | 74 - .../aws-sdk-go/aws/credentials/example.ini | 12 - .../shared_credentials_provider.go | 151 - .../aws/credentials/static_provider.go | 57 - .../github.com/aws/aws-sdk-go/aws/doc.go | 56 - .../aws/aws-sdk-go/aws/endpoints/decode.go | 216 - .../aws/aws-sdk-go/aws/endpoints/defaults.go | 9674 ----------------- .../aws/endpoints/dep_service_ids.go | 141 - .../aws/aws-sdk-go/aws/endpoints/doc.go | 66 - .../aws/aws-sdk-go/aws/endpoints/endpoints.go | 564 - .../aws/endpoints/legacy_regions.go | 24 - .../aws/aws-sdk-go/aws/endpoints/v3model.go | 351 - .../aws/endpoints/v3model_codegen.go | 351 - .../github.com/aws/aws-sdk-go/aws/errors.go | 13 - .../aws/aws-sdk-go/aws/jsonvalue.go | 12 - .../github.com/aws/aws-sdk-go/aws/logger.go | 118 - .../aws/request/connection_reset_error.go | 19 - .../aws/aws-sdk-go/aws/request/handlers.go | 343 - .../aws-sdk-go/aws/request/http_request.go | 24 - .../aws-sdk-go/aws/request/offset_reader.go | 65 - .../aws/aws-sdk-go/aws/request/request.go | 698 -- .../aws/aws-sdk-go/aws/request/request_1_7.go | 39 - .../aws/aws-sdk-go/aws/request/request_1_8.go | 36 - .../aws-sdk-go/aws/request/request_context.go | 14 - .../aws/request/request_context_1_6.go | 14 - .../aws/request/request_pagination.go | 266 - .../aws/aws-sdk-go/aws/request/retryer.go | 309 - .../aws/request/timeout_read_closer.go | 94 - .../aws/aws-sdk-go/aws/request/validation.go | 286 - .../aws/aws-sdk-go/aws/request/waiter.go | 295 - .../aws/aws-sdk-go/aws/signer/v4/options.go | 7 - .../aws/signer/v4/request_context_go1.5.go | 13 - .../aws/signer/v4/request_context_go1.7.go | 13 - .../aws/aws-sdk-go/aws/signer/v4/stream.go | 63 - .../aws/aws-sdk-go/aws/signer/v4/uri_path.go | 24 - .../aws/aws-sdk-go/aws/signer/v4/v4.go | 846 -- .../github.com/aws/aws-sdk-go/aws/types.go | 264 - .../github.com/aws/aws-sdk-go/aws/url.go | 12 - .../github.com/aws/aws-sdk-go/aws/url_1_7.go | 29 - .../github.com/aws/aws-sdk-go/aws/version.go | 8 - .../internal/context/background_go1.5.go | 40 - .../aws/aws-sdk-go/internal/ini/ast.go | 120 - .../aws-sdk-go/internal/ini/comma_token.go | 11 - .../aws-sdk-go/internal/ini/comment_token.go | 35 - .../aws/aws-sdk-go/internal/ini/doc.go | 29 - .../aws-sdk-go/internal/ini/empty_token.go | 4 - .../aws/aws-sdk-go/internal/ini/expression.go | 24 - .../aws/aws-sdk-go/internal/ini/fuzz.go | 17 - .../aws/aws-sdk-go/internal/ini/ini.go | 51 - .../aws/aws-sdk-go/internal/ini/ini_lexer.go | 165 - .../aws/aws-sdk-go/internal/ini/ini_parser.go | 356 - .../aws-sdk-go/internal/ini/literal_tokens.go | 324 - .../aws-sdk-go/internal/ini/newline_token.go | 30 - .../aws-sdk-go/internal/ini/number_helper.go | 152 - .../aws/aws-sdk-go/internal/ini/op_tokens.go | 39 - .../aws-sdk-go/internal/ini/parse_error.go | 43 - .../aws-sdk-go/internal/ini/parse_stack.go | 60 - .../aws/aws-sdk-go/internal/ini/sep_tokens.go | 41 - .../aws/aws-sdk-go/internal/ini/skipper.go | 45 - .../aws/aws-sdk-go/internal/ini/statement.go | 35 - .../aws/aws-sdk-go/internal/ini/value_util.go | 284 - .../aws/aws-sdk-go/internal/ini/visitor.go | 166 - .../aws/aws-sdk-go/internal/ini/walker.go | 25 - .../aws/aws-sdk-go/internal/ini/ws_token.go | 24 - .../aws/aws-sdk-go/internal/sdkio/byte.go | 12 - .../aws/aws-sdk-go/internal/sdkio/io_go1.6.go | 10 - .../aws/aws-sdk-go/internal/sdkio/io_go1.7.go | 12 - .../aws/aws-sdk-go/internal/sdkmath/floor.go | 15 - .../internal/sdkmath/floor_go1.9.go | 56 - .../internal/shareddefaults/ecs_container.go | 12 - .../internal/shareddefaults/shared_config.go | 40 - .../aws-sdk-go/internal/strings/strings.go | 11 - .../internal/sync/singleflight/LICENSE | 27 - .../sync/singleflight/singleflight.go | 120 - .../aws/aws-sdk-go/private/protocol/host.go | 68 - .../private/protocol/host_prefix.go | 54 - .../private/protocol/idempotency.go | 75 - .../aws-sdk-go/private/protocol/jsonvalue.go | 76 - .../aws-sdk-go/private/protocol/payload.go | 81 - .../aws-sdk-go/private/protocol/protocol.go | 49 - .../aws-sdk-go/private/protocol/rest/build.go | 310 - .../private/protocol/rest/payload.go | 45 - .../private/protocol/rest/unmarshal.go | 257 - .../aws-sdk-go/private/protocol/timestamp.go | 85 - .../aws-sdk-go/private/protocol/unmarshal.go | 27 - .../private/protocol/unmarshal_error.go | 65 - .../didip/tollbooth/v6/limiter/limiter.go | 24 +- .../didip/tollbooth/v6/tollbooth.go | 6 +- .../github.com/dlclark/regexp2/.gitignore | 4 +- .../github.com/dlclark/regexp2/.travis.yml | 2 +- .../github.com/dlclark/regexp2/README.md | 24 +- .../github.com/dlclark/regexp2/regexp.go | 12 +- .../github.com/dlclark/regexp2/runner.go | 19 +- .../dlclark/regexp2/syntax/charclass.go | 70 + .../dlclark/regexp2/syntax/parser.go | 128 +- .../github.com/go-chi/chi/v5/CHANGELOG.md | 10 + .../vendor/github.com/go-chi/chi/v5/Makefile | 4 + .../vendor/github.com/go-chi/chi/v5/README.md | 15 +- .../go-chi/chi/v5/middleware/page_route.go | 20 + .../go-chi/chi/v5/middleware/path_rewrite.go | 16 + .../go-chi/chi/v5/middleware/profiler.go | 7 + .../go-chi/chi/v5/middleware/realip.go | 2 +- .../go-chi/chi/v5/middleware/recoverer.go | 17 +- .../go-chi/chi/v5/middleware/wrap_writer.go | 72 +- .../github.com/go-pkgz/auth/.golangci.yml | 3 +- .../vendor/github.com/go-pkgz/auth/README.md | 7 +- .../vendor/github.com/go-pkgz/auth/auth.go | 70 +- backend/vendor/github.com/go-pkgz/auth/go.mod | 8 +- backend/vendor/github.com/go-pkgz/auth/go.sum | 40 +- .../github.com/go-pkgz/auth/provider/apple.go | 6 +- .../go-pkgz/auth/provider/direct.go | 12 +- .../go-pkgz/auth/provider/providers.go | 60 +- .../github.com/go-pkgz/auth/token/jwt.go | 39 +- .../github.com/go-pkgz/auth/token/user.go | 15 +- .../github.com/go-pkgz/rest/.golangci.yml | 2 +- .../github.com/go-pkgz/rest/file_server.go | 67 +- .../github.com/go-pkgz/rest/sizelimit.go | 2 + .../github.com/go-pkgz/rest/throttle.go | 46 + .../github.com/golang-jwt/jwt/.travis.yml | 11 - .../github.com/golang-jwt/jwt/README.md | 9 +- .../golang-jwt/jwt/VERSION_HISTORY.md | 7 + .../vendor/github.com/golang-jwt/jwt/ecdsa.go | 18 +- .../github.com/golang-jwt/jwt/ed25519.go | 81 + .../golang-jwt/jwt/ed25519_utils.go | 64 + .../github.com/golang-jwt/jwt/map_claims.go | 36 +- .../vendor/github.com/golang-jwt/jwt/token.go | 8 +- backend/vendor/github.com/google/uuid/hash.go | 4 +- backend/vendor/github.com/google/uuid/null.go | 118 + backend/vendor/github.com/google/uuid/sql.go | 2 +- backend/vendor/github.com/google/uuid/uuid.go | 55 +- .../vendor/github.com/google/uuid/version4.go | 35 +- .../hashicorp/go-multierror/.travis.yml | 12 - .../hashicorp/go-multierror/README.md | 29 +- .../hashicorp/go-multierror/append.go | 2 + .../github.com/hashicorp/go-multierror/go.mod | 2 +- .../hashicorp/go-multierror/multierror.go | 15 +- .../jmespath/go-jmespath/.gitignore | 4 - .../jmespath/go-jmespath/.travis.yml | 28 - .../github.com/jmespath/go-jmespath/LICENSE | 13 - .../github.com/jmespath/go-jmespath/Makefile | 51 - .../github.com/jmespath/go-jmespath/README.md | 87 - .../github.com/jmespath/go-jmespath/api.go | 49 - .../go-jmespath/astnodetype_string.go | 16 - .../jmespath/go-jmespath/functions.go | 842 -- .../github.com/jmespath/go-jmespath/go.mod | 5 - .../github.com/jmespath/go-jmespath/go.sum | 11 - .../jmespath/go-jmespath/interpreter.go | 418 - .../github.com/jmespath/go-jmespath/lexer.go | 420 - .../github.com/jmespath/go-jmespath/parser.go | 603 - .../jmespath/go-jmespath/toktype_string.go | 16 - .../github.com/jmespath/go-jmespath/util.go | 185 - .../microcosm-cc/bluemonday/CONTRIBUTING.md | 1 + .../microcosm-cc/bluemonday/Makefile | 2 +- .../microcosm-cc/bluemonday/README.md | 29 +- .../bluemonday/{ => css}/handlers.go | 4 +- .../github.com/microcosm-cc/bluemonday/doc.go | 14 +- .../github.com/microcosm-cc/bluemonday/go.mod | 3 +- .../github.com/microcosm-cc/bluemonday/go.sum | 7 + .../microcosm-cc/bluemonday/helpers.go | 2 +- .../microcosm-cc/bluemonday/policy.go | 133 +- .../microcosm-cc/bluemonday/sanitize.go | 344 +- .../bluemonday/stringwriterwriter_go1.12.go | 10 + .../bluemonday/stringwriterwriter_ltgo1.12.go | 14 + backend/vendor/github.com/rs/xid/README.md | 13 +- backend/vendor/github.com/rs/xid/go.mod | 2 + .../vendor/github.com/rs/xid/hostid_linux.go | 5 +- backend/vendor/github.com/rs/xid/id.go | 81 +- .../github.com/slack-go/slack/README.md | 5 +- .../vendor/github.com/slack-go/slack/apps.go | 3 +- .../github.com/slack-go/slack/attachments.go | 4 +- .../vendor/github.com/slack-go/slack/audit.go | 142 + .../vendor/github.com/slack-go/slack/block.go | 4 +- .../github.com/slack-go/slack/block_conv.go | 2 + .../github.com/slack-go/slack/channels.go | 678 -- .../vendor/github.com/slack-go/slack/chat.go | 3 +- .../github.com/slack-go/slack/conversation.go | 10 +- .../slack-go/slack/dialog_select.go | 14 + .../vendor/github.com/slack-go/slack/files.go | 9 +- .../vendor/github.com/slack-go/slack/go.mod | 2 +- .../github.com/slack-go/slack/groups.go | 567 - .../vendor/github.com/slack-go/slack/im.go | 199 - .../vendor/github.com/slack-go/slack/info.go | 3 +- .../github.com/slack-go/slack/interactions.go | 5 +- .../vendor/github.com/slack-go/slack/misc.go | 11 +- .../vendor/github.com/slack-go/slack/slack.go | 4 +- .../vendor/github.com/slack-go/slack/users.go | 23 +- .../vendor/github.com/slack-go/slack/views.go | 10 +- backend/vendor/go.etcd.io/bbolt/.gitignore | 2 + backend/vendor/go.etcd.io/bbolt/.travis.yml | 3 +- backend/vendor/go.etcd.io/bbolt/Makefile | 2 - backend/vendor/go.etcd.io/bbolt/README.md | 5 +- backend/vendor/go.etcd.io/bbolt/bolt_unix.go | 17 +- backend/vendor/go.etcd.io/bbolt/compact.go | 114 + backend/vendor/go.etcd.io/bbolt/db.go | 66 +- .../vendor/go.etcd.io/bbolt/freelist_hmap.go | 6 +- backend/vendor/go.etcd.io/bbolt/go.mod | 2 +- backend/vendor/go.etcd.io/bbolt/go.sum | 4 +- backend/vendor/go.etcd.io/bbolt/mlock_unix.go | 36 + .../vendor/go.etcd.io/bbolt/mlock_windows.go | 11 + backend/vendor/go.etcd.io/bbolt/tx.go | 3 +- .../bson/bsoncodec/default_value_decoders.go | 2 +- .../bson/bsonrw/extjson_reader.go | 17 + .../bson/bsonrw/extjson_wrappers.go | 6 - .../mongo-driver/bson/bsonrw/value_writer.go | 17 +- .../go.mongodb.org/mongo-driver/bson/doc.go | 2 +- .../mongo-driver/bson/marshal.go | 8 +- .../mongo-driver/bson/primitive/objectid.go | 8 +- .../mongo-driver/bson/primitive/primitive.go | 22 +- .../mongo-driver/event/monitoring.go | 9 + .../mongo-driver/internal/const.go | 5 + .../internal/uri_validation_errors.go | 18 + .../mongo-driver/mongo/bulk_write.go | 10 +- .../mongo-driver/mongo/change_stream.go | 5 +- .../mongo-driver/mongo/client.go | 65 +- .../mongo-driver/mongo/collection.go | 51 +- .../mongo-driver/mongo/cursor.go | 3 +- .../mongo-driver/mongo/database.go | 59 +- .../mongo-driver/mongo/description/server.go | 40 +- .../mongo/description/server_kind.go | 17 +- .../mongo/description/server_selector.go | 13 +- .../mongo/description/topology_kind.go | 3 + .../mongo-driver/mongo/errors.go | 107 +- .../mongo-driver/mongo/index_view.go | 6 +- .../mongo-driver/mongo/mongo.go | 115 +- .../mongo-driver/mongo/mongocryptd.go | 2 +- .../mongo/options/aggregateoptions.go | 15 + .../mongo/options/clientoptions.go | 65 +- .../mongo/options/createcollectionoptions.go | 63 + .../mongo/options/serverapioptions.go | 60 + .../mongo/options/sessionoptions.go | 24 +- .../mongo-driver/mongo/session.go | 9 +- .../mongo-driver/version/version.go | 2 +- .../mongo-driver/x/mongo/driver/auth/auth.go | 8 +- .../x/mongo/driver/auth/aws_conv.go | 19 +- .../driver/auth/internal/awsv4/credentials.go | 63 + .../x/mongo/driver/auth/internal/awsv4/doc.go | 15 + .../driver/auth/internal/awsv4/request.go | 80 + .../mongo/driver/auth/internal/awsv4/rest.go | 46 + .../driver/auth/internal/awsv4/rules.go} | 23 +- .../driver/auth/internal/awsv4/signer.go | 472 + .../x/mongo/driver/auth/mongodbcr.go | 6 +- .../mongo-driver/x/mongo/driver/auth/sasl.go | 6 +- .../mongo-driver/x/mongo/driver/auth/x509.go | 3 +- .../x/mongo/driver/batch_cursor.go | 120 +- .../x/mongo/driver/connstring/connstring.go | 26 + .../mongo-driver/x/mongo/driver/dns/dns.go | 5 +- .../mongo-driver/x/mongo/driver/driver.go | 20 + .../mongo-driver/x/mongo/driver/errors.go | 33 +- .../mongo-driver/x/mongo/driver/operation.go | 182 +- .../driver/operation/abort_transaction.go | 14 +- .../x/mongo/driver/operation/aggregate.go | 31 +- .../x/mongo/driver/operation/command.go | 79 +- .../driver/operation/commit_transaction.go | 14 +- .../x/mongo/driver/operation/count.go | 94 +- .../x/mongo/driver/operation/create.go | 42 +- .../x/mongo/driver/operation/createIndexes.go | 16 +- .../x/mongo/driver/operation/delete.go | 16 +- .../x/mongo/driver/operation/distinct.go | 16 +- .../mongo/driver/operation/drop_collection.go | 16 +- .../x/mongo/driver/operation/drop_database.go | 66 +- .../x/mongo/driver/operation/drop_indexes.go | 16 +- .../x/mongo/driver/operation/end_sessions.go | 14 +- .../x/mongo/driver/operation/find.go | 17 +- .../mongo/driver/operation/find_and_modify.go | 16 +- .../x/mongo/driver/operation/insert.go | 16 +- .../x/mongo/driver/operation/ismaster.go | 35 +- .../x/mongo/driver/operation/listDatabases.go | 16 +- .../driver/operation/list_collections.go | 17 +- .../x/mongo/driver/operation/list_indexes.go | 17 +- .../x/mongo/driver/operation/update.go | 20 +- .../x/mongo/driver/operation_exhaust.go | 9 +- .../x/mongo/driver/operation_legacy.go | 36 +- .../x/mongo/driver/serverapioptions.go | 36 + .../x/mongo/driver/session/client_session.go | 151 +- .../x/mongo/driver/session/options.go | 4 + .../x/mongo/driver/session/server_session.go | 13 +- .../x/mongo/driver/session/session_pool.go | 28 +- .../x/mongo/driver/topology/connection.go | 127 +- .../driver/topology/connection_options.go | 25 +- .../x/mongo/driver/topology/errors.go | 13 +- .../x/mongo/driver/topology/fsm.go | 2 +- .../x/mongo/driver/topology/pool.go | 77 +- .../topology/pool_generation_counter.go | 133 + .../x/mongo/driver/topology/server.go | 120 +- .../x/mongo/driver/topology/server_options.go | 19 + .../x/mongo/driver/topology/topology.go | 114 +- .../mongo/driver/topology/topology_options.go | 20 + backend/vendor/go.uber.org/goleak/.travis.yml | 1 + .../vendor/go.uber.org/goleak/CHANGELOG.md | 7 + backend/vendor/go.uber.org/goleak/README.md | 11 +- backend/vendor/go.uber.org/goleak/options.go | 12 + .../vendor/golang.org/x/crypto/acme/http.go | 4 + .../golang.org/x/image/draw/draw_go117.go | 27 + backend/vendor/golang.org/x/net/html/parse.go | 24 +- .../golang.org/x/net/idna/idna10.0.0.go | 113 +- .../vendor/golang.org/x/net/idna/idna9.0.0.go | 93 +- .../vendor/golang.org/x/sys/unix/README.md | 6 +- .../golang.org/x/sys/unix/asm_aix_ppc64.s | 1 + .../golang.org/x/sys/unix/asm_bsd_386.s | 4 +- .../golang.org/x/sys/unix/asm_bsd_arm.s | 4 +- .../golang.org/x/sys/unix/asm_linux_386.s | 1 + .../golang.org/x/sys/unix/asm_linux_amd64.s | 1 + .../golang.org/x/sys/unix/asm_linux_arm.s | 1 + .../golang.org/x/sys/unix/asm_linux_arm64.s | 1 + .../golang.org/x/sys/unix/asm_linux_mips64x.s | 1 + .../golang.org/x/sys/unix/asm_linux_mipsx.s | 1 + .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 1 + .../golang.org/x/sys/unix/asm_linux_riscv64.s | 4 +- .../golang.org/x/sys/unix/asm_linux_s390x.s | 3 +- .../x/sys/unix/asm_openbsd_mips64.s | 1 + .../golang.org/x/sys/unix/asm_solaris_amd64.s | 1 + backend/vendor/golang.org/x/sys/unix/fdset.go | 4 +- backend/vendor/golang.org/x/sys/unix/mkall.sh | 12 - .../vendor/golang.org/x/sys/unix/mkerrors.sh | 8 + .../x/sys/unix/syscall_darwin.1_13.go | 4 +- .../x/sys/unix/syscall_darwin_386.go | 51 - .../x/sys/unix/syscall_darwin_arm.go | 51 - .../x/sys/unix/syscall_darwin_libSystem.go | 9 +- .../golang.org/x/sys/unix/syscall_illumos.go | 51 +- .../golang.org/x/sys/unix/syscall_linux.go | 77 +- .../x/sys/unix/syscall_linux_386.go | 4 + .../x/sys/unix/syscall_linux_amd64.go | 4 + .../x/sys/unix/syscall_linux_arm.go | 4 + .../x/sys/unix/syscall_linux_arm64.go | 4 + .../x/sys/unix/syscall_linux_mips64x.go | 4 + .../x/sys/unix/syscall_linux_mipsx.go | 4 + .../x/sys/unix/syscall_linux_ppc.go | 4 + .../x/sys/unix/syscall_linux_ppc64x.go | 4 + .../x/sys/unix/syscall_linux_riscv64.go | 4 + .../x/sys/unix/syscall_linux_s390x.go | 4 + .../x/sys/unix/syscall_linux_sparc64.go | 4 + .../x/sys/unix/syscall_zos_s390x.go | 52 +- .../x/sys/unix/zerrors_darwin_386.go | 1789 --- .../x/sys/unix/zerrors_darwin_arm.go | 1789 --- .../golang.org/x/sys/unix/zerrors_linux.go | 113 +- .../x/sys/unix/zerrors_linux_386.go | 19 + .../x/sys/unix/zerrors_linux_amd64.go | 19 + .../x/sys/unix/zerrors_linux_arm.go | 19 + .../x/sys/unix/zerrors_linux_arm64.go | 19 + .../x/sys/unix/zerrors_linux_mips.go | 19 + .../x/sys/unix/zerrors_linux_mips64.go | 19 + .../x/sys/unix/zerrors_linux_mips64le.go | 19 + .../x/sys/unix/zerrors_linux_mipsle.go | 19 + .../x/sys/unix/zerrors_linux_ppc.go | 19 + .../x/sys/unix/zerrors_linux_ppc64.go | 19 + .../x/sys/unix/zerrors_linux_ppc64le.go | 19 + .../x/sys/unix/zerrors_linux_riscv64.go | 19 + .../x/sys/unix/zerrors_linux_s390x.go | 21 + .../x/sys/unix/zerrors_linux_sparc64.go | 19 + .../x/sys/unix/zerrors_zos_s390x.go | 22 + .../x/sys/unix/zsyscall_darwin_386.1_13.go | 40 - .../x/sys/unix/zsyscall_darwin_386.1_13.s | 12 - .../x/sys/unix/zsyscall_darwin_386.go | 2431 ----- .../x/sys/unix/zsyscall_darwin_386.s | 290 - .../x/sys/unix/zsyscall_darwin_amd64.1_13.go | 8 +- .../x/sys/unix/zsyscall_darwin_amd64.1_13.s | 19 +- .../x/sys/unix/zsyscall_darwin_amd64.go | 572 +- .../x/sys/unix/zsyscall_darwin_amd64.s | 853 +- .../x/sys/unix/zsyscall_darwin_arm.1_13.go | 40 - .../x/sys/unix/zsyscall_darwin_arm.1_13.s | 12 - .../x/sys/unix/zsyscall_darwin_arm.go | 2417 ---- .../x/sys/unix/zsyscall_darwin_arm.s | 288 - .../x/sys/unix/zsyscall_darwin_arm64.1_13.go | 8 +- .../x/sys/unix/zsyscall_darwin_arm64.1_13.s | 19 +- .../x/sys/unix/zsyscall_darwin_arm64.go | 572 +- .../x/sys/unix/zsyscall_darwin_arm64.s | 853 +- .../x/sys/unix/zsyscall_zos_s390x.go | 42 +- .../x/sys/unix/zsysnum_darwin_386.go | 438 - .../x/sys/unix/zsysnum_darwin_arm.go | 438 - .../x/sys/unix/zsysnum_linux_386.go | 1 + .../x/sys/unix/zsysnum_linux_amd64.go | 1 + .../x/sys/unix/zsysnum_linux_arm.go | 1 + .../x/sys/unix/zsysnum_linux_arm64.go | 1 + .../x/sys/unix/zsysnum_linux_mips.go | 1 + .../x/sys/unix/zsysnum_linux_mips64.go | 1 + .../x/sys/unix/zsysnum_linux_mips64le.go | 1 + .../x/sys/unix/zsysnum_linux_mipsle.go | 1 + .../x/sys/unix/zsysnum_linux_ppc.go | 1 + .../x/sys/unix/zsysnum_linux_ppc64.go | 1 + .../x/sys/unix/zsysnum_linux_ppc64le.go | 1 + .../x/sys/unix/zsysnum_linux_riscv64.go | 1 + .../x/sys/unix/zsysnum_linux_s390x.go | 1 + .../x/sys/unix/zsysnum_linux_sparc64.go | 1 + .../x/sys/unix/ztypes_darwin_386.go | 524 - .../x/sys/unix/ztypes_darwin_arm.go | 524 - .../x/sys/unix/ztypes_dragonfly_amd64.go | 3 + .../x/sys/unix/ztypes_freebsd_386.go | 5 +- .../x/sys/unix/ztypes_freebsd_amd64.go | 5 +- .../x/sys/unix/ztypes_freebsd_arm.go | 5 +- .../x/sys/unix/ztypes_freebsd_arm64.go | 5 +- .../x/sys/unix/ztypes_illumos_amd64.go | 4 +- .../golang.org/x/sys/unix/ztypes_linux.go | 178 +- .../golang.org/x/sys/unix/ztypes_linux_386.go | 18 +- .../x/sys/unix/ztypes_linux_amd64.go | 18 +- .../golang.org/x/sys/unix/ztypes_linux_arm.go | 18 +- .../x/sys/unix/ztypes_linux_arm64.go | 18 +- .../x/sys/unix/ztypes_linux_mips.go | 18 +- .../x/sys/unix/ztypes_linux_mips64.go | 18 +- .../x/sys/unix/ztypes_linux_mips64le.go | 18 +- .../x/sys/unix/ztypes_linux_mipsle.go | 18 +- .../golang.org/x/sys/unix/ztypes_linux_ppc.go | 18 +- .../x/sys/unix/ztypes_linux_ppc64.go | 18 +- .../x/sys/unix/ztypes_linux_ppc64le.go | 18 +- .../x/sys/unix/ztypes_linux_riscv64.go | 18 +- .../x/sys/unix/ztypes_linux_s390x.go | 18 +- .../x/sys/unix/ztypes_linux_sparc64.go | 18 +- .../x/sys/unix/ztypes_netbsd_386.go | 4 +- .../x/sys/unix/ztypes_netbsd_amd64.go | 4 +- .../x/sys/unix/ztypes_netbsd_arm.go | 4 +- .../x/sys/unix/ztypes_netbsd_arm64.go | 4 +- .../x/sys/unix/ztypes_openbsd_386.go | 4 +- .../x/sys/unix/ztypes_openbsd_amd64.go | 4 +- .../x/sys/unix/ztypes_openbsd_arm.go | 4 +- .../x/sys/unix/ztypes_openbsd_arm64.go | 4 +- .../x/sys/unix/ztypes_openbsd_mips64.go | 4 +- .../golang.org/x/sys/unix/ztypes_zos_s390x.go | 4 + backend/vendor/modules.txt | 67 +- 686 files changed, 14927 insertions(+), 41766 deletions(-) create mode 100644 backend/vendor/github.com/Depado/bfchroma/.golangci.yml delete mode 100644 backend/vendor/github.com/alecthomas/chroma/.travis.yml create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/a/al.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/c/caddyfile.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/circular/phtml.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/d/dylan.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/f/fortran_fixed.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/g/gherkin.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/g/groff.go rename backend/vendor/github.com/alecthomas/chroma/lexers/{ => h}/hlb.go (95%) create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/m/mcfunction.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/m/metal.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/p/pony.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/p/powerquery.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/p/promql.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/p/python2.go delete mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/p/python3.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/q/qml.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/r/raku.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/r/reasonml.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/s/stylus.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/s/svelte.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/y/yang.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/lexers/z/zig.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/styles/base16-snazzy.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/styles/doom-one.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/styles/doom-one2.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/styles/hr_dark.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/styles/hr_high_contrast.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/styles/nord.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/styles/vulcan.go create mode 100644 backend/vendor/github.com/alecthomas/chroma/styles/xcode-dark.go create mode 100644 backend/vendor/github.com/andybalholm/cascadia/serialize.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/LICENSE.txt delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/NOTICE.txt delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/config.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/context_1_5.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/context_1_9.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_5.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_7.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/context_sleep.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.5.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.7.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.5.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.9.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/doc.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/endpoints/legacy_regions.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/errors.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/logger.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/request.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.5.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.7.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/stream.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/types.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/url.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/aws/version.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/context/background_go1.5.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/ast.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/comma_token.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/comment_token.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/doc.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/empty_token.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/expression.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/fuzz.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/ini.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_lexer.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/literal_tokens.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/newline_token.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/number_helper.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/op_tokens.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_stack.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/sep_tokens.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/statement.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/value_util.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/visitor.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/walker.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/sdkio/byte.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.6.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.7.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/ecs_container.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/strings/strings.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/LICENSE delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/singleflight.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/host.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/host_prefix.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/payload.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/protocol.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go delete mode 100644 backend/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_error.go create mode 100644 backend/vendor/github.com/go-chi/chi/v5/middleware/page_route.go create mode 100644 backend/vendor/github.com/go-chi/chi/v5/middleware/path_rewrite.go create mode 100644 backend/vendor/github.com/go-pkgz/rest/throttle.go delete mode 100644 backend/vendor/github.com/golang-jwt/jwt/.travis.yml create mode 100644 backend/vendor/github.com/golang-jwt/jwt/ed25519.go create mode 100644 backend/vendor/github.com/golang-jwt/jwt/ed25519_utils.go create mode 100644 backend/vendor/github.com/google/uuid/null.go delete mode 100644 backend/vendor/github.com/hashicorp/go-multierror/.travis.yml delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/.gitignore delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/.travis.yml delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/LICENSE delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/Makefile delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/README.md delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/api.go delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/astnodetype_string.go delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/functions.go delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/go.mod delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/go.sum delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/interpreter.go delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/lexer.go delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/parser.go delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/toktype_string.go delete mode 100644 backend/vendor/github.com/jmespath/go-jmespath/util.go rename backend/vendor/github.com/microcosm-cc/bluemonday/{ => css}/handlers.go (99%) create mode 100644 backend/vendor/github.com/microcosm-cc/bluemonday/stringwriterwriter_go1.12.go create mode 100644 backend/vendor/github.com/microcosm-cc/bluemonday/stringwriterwriter_ltgo1.12.go create mode 100644 backend/vendor/github.com/slack-go/slack/audit.go create mode 100644 backend/vendor/go.etcd.io/bbolt/compact.go create mode 100644 backend/vendor/go.etcd.io/bbolt/mlock_unix.go create mode 100644 backend/vendor/go.etcd.io/bbolt/mlock_windows.go create mode 100644 backend/vendor/go.mongodb.org/mongo-driver/internal/uri_validation_errors.go create mode 100644 backend/vendor/go.mongodb.org/mongo-driver/mongo/options/serverapioptions.go create mode 100644 backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/credentials.go create mode 100644 backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/doc.go create mode 100644 backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/request.go create mode 100644 backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rest.go rename backend/vendor/{github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go => go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rules.go} (66%) create mode 100644 backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/signer.go create mode 100644 backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/serverapioptions.go create mode 100644 backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool_generation_counter.go create mode 100644 backend/vendor/golang.org/x/image/draw/draw_go117.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/syscall_darwin_386.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s delete mode 100644 backend/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s delete mode 100644 backend/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s delete mode 100644 backend/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s delete mode 100644 backend/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go delete mode 100644 backend/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go diff --git a/backend/_example/memory_store/go.sum b/backend/_example/memory_store/go.sum index d7456638..3570879b 100644 --- a/backend/_example/memory_store/go.sum +++ b/backend/_example/memory_store/go.sum @@ -33,27 +33,27 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/Depado/bfchroma v1.2.0 h1:NyYPFVhWvq8S2ts6Ok4kwXVE3TEO5fof+9ZOKbBJQUo= -github.com/Depado/bfchroma v1.2.0/go.mod h1:U3RJUYwWVJrZRaJQyfS+wuxBApSTR/BC37PhAI+Ydps= -github.com/PuerkitoBio/goquery v1.5.1 h1:PSPBGne8NIUWw+/7vFBV+kG2J/5MOjbzc7154OaKCSE= -github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= +github.com/Depado/bfchroma v1.3.0 h1:zz14vpvySU6S0CL6yGPr1vkFevQecIt8dJdCsMS2JpM= +github.com/Depado/bfchroma v1.3.0/go.mod h1:c0bFk0tFmT+clD3TIGurjWCfD/QV8/EebfM3JGr+98M= +github.com/PuerkitoBio/goquery v1.7.1 h1:oE+T06D+1T7LNrn91B4aERsRIeCLJ/oPSa6xB9FPnz4= +github.com/PuerkitoBio/goquery v1.7.1/go.mod h1:XY0pP4kfraEmmV1O7Uf6XyjoslwsneBbgeDjLYuN8xY= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= 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.6.0/go.mod h1:MmozekIi2rfQSzDcdEZ2BoJ9Pxs/7uc2Y4Boh+hIeZo= -github.com/alecthomas/chroma v0.7.2 h1:B76NU/zbQYIUhUowbi4fmvREmDUJLsUzKWTZmQd3ABY= -github.com/alecthomas/chroma v0.7.2/go.mod h1:fv5SzZPFJbwp2NXJWpFIX7DZS4HgV1K4ew4Pc2OZD9s= +github.com/alecthomas/chroma v0.7.3/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM= +github.com/alecthomas/chroma v0.9.2 h1:yU1sE2+TZbLIQPMk30SolL2Hn53SR/Pv750f7qZ/XMs= +github.com/alecthomas/chroma v0.9.2/go.mod h1:eMuEnpA18XbG/WhOWtCzJHS7WqEtDAI+HxdwoW0nVSk= 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/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= -github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1 h1:GDQdwm/gAcJcLAKQQZGOJ4knlw+7rfEQQcmwTbt4p5E= -github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= +github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c h1:MVVbswUlqicyj8P/JljoocA7AyCo62gzD0O7jfvrhtE= +github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis/v2 v2.11.4/go.mod h1:VL3UDEfAH59bSa7MuHMuFToxkqyHh69s/WUbYlOAuyg= -github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= -github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= -github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= +github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE= +github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -70,13 +70,14 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/dghubble/oauth1 v0.7.0/go.mod h1:8pFdfPkv/jr8mkChVbNVuJ0suiHe278BtWI4Tk1ujxk= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/didip/tollbooth/v6 v6.0.1/go.mod h1:j2pKs+JQ5PvU/K4jFnrnwntrmfUbYLJE5oSdxR37FD0= -github.com/didip/tollbooth/v6 v6.1.0 h1:ZS2fNa9JhFdRSJCj3+V12VfuUifYrGB4Z0jSwXmKMeE= -github.com/didip/tollbooth/v6 v6.1.0/go.mod h1:xjcse6CTHCLuOkzsWrEgdy9WPJFv+p/x6v+MyfP+O9s= +github.com/didip/tollbooth/v6 v6.1.1 h1:Nt7PvWLa9Y94OrykXsFNBinVRQIu8xdy4avpl99Dc1M= +github.com/didip/tollbooth/v6 v6.1.1/go.mod h1:xjcse6CTHCLuOkzsWrEgdy9WPJFv+p/x6v+MyfP+O9s= github.com/didip/tollbooth_chi v0.0.0-20200524181329-8b84cd7183d9/go.mod h1:YWyIfq3y4ArRfWZ9XksmuusP+7Mad+T0iFZ0kv0XG/M= github.com/didip/tollbooth_chi v0.0.0-20200828173446-a7173453ea21 h1:x7YpwKSBIBcKe9I3aTNOqgSyJ6QKDdtOxnEkxBTsi9w= github.com/didip/tollbooth_chi v0.0.0-20200828173446-a7173453ea21/go.mod h1:0ZVa6kSzS011nfTC1rELyxK4tjVf6vqBnOv7oY2KlsA= -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/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E= +github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -87,14 +88,14 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/go-chi/chi v4.1.1+incompatible h1:MmTgB0R8Bt/jccxp+t6S/1VGIKdJw5J74CK/c9tTfA4= github.com/go-chi/chi v4.1.1+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= -github.com/go-chi/chi/v5 v5.0.2/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.0.4/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/cors v1.2.0/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= github.com/go-chi/render v1.0.1 h1:4/5tis2cKaNdnv9zFLfXzcquC9HbeZgCnxGnKrltBS8= github.com/go-chi/render v1.0.1/go.mod h1:pq4Rr7HbnsdaeHagklXub+p6Wd16Af5l9koip1OvJns= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-pkgz/auth v1.17.1-0.20210817211320-fed26c31c35c/go.mod h1:KhMsOKhNU8fJbWKUYPhfGaYGgnZuSOIs52ojELWxOUk= +github.com/go-pkgz/auth v1.18.0/go.mod h1:hfGyJXugY0O9IPKYHBzf6pDozWtqYMMkI8iSc0kPd14= github.com/go-pkgz/expirable-cache v0.0.3 h1:rTh6qNPp78z0bQE6HDhXBHUwqnV9i09Vm6dksJLXQDc= github.com/go-pkgz/expirable-cache v0.0.3/go.mod h1:+IauqN00R2FqNRLCLA+X5YljQJrwB179PfiAoMPlTlQ= github.com/go-pkgz/jrpc v0.2.0 h1:CLy/eZyekjraVrxZV18N2R1mYLMJ/nWrgdfyIOGPY/E= @@ -104,12 +105,11 @@ github.com/go-pkgz/lgr v0.10.4 h1:l7qyFjqEZgwRgaQQSEp6tve4A3OU80VrfzpvtEX8ngw= github.com/go-pkgz/lgr v0.10.4/go.mod h1:CD0s1z6EFpIUplV067gitF77tn25JItzwHNKAPqeCF0= github.com/go-pkgz/repeater v1.1.3/go.mod h1:hVTavuO5x3Gxnu8zW7d6sQBfAneKV8X2FjU48kGfpKw= github.com/go-pkgz/rest v1.5.0/go.mod h1:nQaM3RhSTUAmbBZWY4hfe4buyeC9VckvhoCktiQXJxI= -github.com/go-pkgz/rest v1.9.2 h1:RyBBRXBYY6eBgTW3UGYOyT4VQPDiBBFh/tesELWsryQ= -github.com/go-pkgz/rest v1.9.2/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw= +github.com/go-pkgz/rest v1.11.0 h1:Z//qgmM0NhBYfhXYEP/aJtDVLK5XlJGxqcb4sHFNN0E= +github.com/go-pkgz/rest v1.11.0/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw= github.com/go-pkgz/syncs v1.1.1/go.mod h1:bt9lxWRRJ9vOCMGc8Big8ttjYHLKP88ofj1y38UlaHE= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-session/session v3.1.2+incompatible/go.mod h1:8B3iivBQjrz/JtC68Np2T1yBBLxTan3mn/3OM0CyRt0= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= @@ -137,6 +137,7 @@ github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGt github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -185,6 +186,7 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -195,8 +197,9 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= @@ -204,8 +207,6 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= @@ -227,14 +228,13 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kyokomi/emoji/v2 v2.2.8/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/microcosm-cc/bluemonday v1.0.9 h1:dpCwruVKoyrULicJwhuY76jB+nIxRVKv/e248Vx/BXg= -github.com/microcosm-cc/bluemonday v1.0.9/go.mod h1:B2riunDr9benLHghZB7hjIgdwSUzzs0pjCxFrWYEZFU= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/microcosm-cc/bluemonday v1.0.15 h1:J4uN+qPng9rvkBZBoBb8YGR+ijuklIMpSOZZLjYpbeY= +github.com/microcosm-cc/bluemonday v1.0.15/go.mod h1:ZLvAzeakRwrGnzQEvstVzVt3ZpqOF2+sdFr0Om+ce30= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/nullrocks/identicon v0.0.0-20180626043057-7875f45b0022/go.mod h1:x4NsS+uc7ecH/Cbm9xKQ6XzmJM57rWTkjywjfB2yQ18= @@ -254,8 +254,8 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= -github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/xid v1.3.0 h1:6NjYksEUlhurdVehpc7S7dk6DAmcKv8V9gG0FsVN2U4= +github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 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= @@ -265,7 +265,7 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/slack-go/slack v0.8.2/go.mod h1:FGqNzJBmxIsZURAxh2a8D21AnOVvvXZvGligs4npPUM= +github.com/slack-go/slack v0.9.4/go.mod h1:wWL//kk0ho+FcQXcBTmEafUI5dz4qz5f4mMk8oIkioQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= @@ -308,15 +308,16 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= -go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.mongodb.org/mongo-driver v1.5.2/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= +go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.mongodb.org/mongo-driver v1.7.1/go.mod h1:Q4oFMbo1+MSNqICAdYMlC/zSTrwCogR4R8NzkI+yfU8= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/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-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= @@ -325,7 +326,7 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -338,8 +339,9 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= 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-20210504121937-7319ad40d33e h1:PzJMNfFQx+QO9hrC1GwZ4BoPGeNGhfeQEgcQFArEjPk= golang.org/x/image v0.0.0-20210504121937-7319ad40d33e/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d h1:RNPAfi2nHY7C2srAV8A49jpsYr0ADedCk1wq6fTMTvs= +golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= 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= @@ -389,9 +391,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= -golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6 h1:0PC75Fz/kyMGhL0e1QnypqK2kQMqKt9csD1GnMJR+Zk= -golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -410,8 +411,6 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ 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-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/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-20190204203706-41f3e6584952/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= @@ -431,6 +430,7 @@ golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -438,15 +438,17 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/backend/app/store/formatter_test.go b/backend/app/store/formatter_test.go index 24f63834..6222b968 100644 --- a/backend/app/store/formatter_test.go +++ b/backend/app/store/formatter_test.go @@ -32,9 +32,9 @@ func TestFormatter_FormatText(t *testing.T) { }, {"— not translated #354", "

— not translated #354

\n!converted", "mdash"}, {"smth\n```go\nfunc main(aa string) int {return 0}\n```", `

smth

-
func main(aa string) int {return 0}
+
func main(aa string) int {return 0}
 
!converted`, "code with language"}, - {"```\ntest_code\n```", `
test_code
+		{"```\ntest_code\n```", `
test_code
 
!converted`, "code without language"}, } f := NewCommentFormatter(mockConverter{}) diff --git a/backend/go.mod b/backend/go.mod index 35e2861f..758cf863 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -3,37 +3,37 @@ module github.com/umputun/remark42/backend go 1.16 require ( - github.com/Depado/bfchroma v1.2.0 - github.com/PuerkitoBio/goquery v1.5.1 - github.com/alecthomas/chroma v0.7.2 - github.com/didip/tollbooth/v6 v6.1.0 + github.com/Depado/bfchroma v1.3.0 + github.com/PuerkitoBio/goquery v1.7.1 + github.com/alecthomas/chroma v0.9.2 + github.com/didip/tollbooth/v6 v6.1.1 github.com/didip/tollbooth_chi v0.0.0-20200828173446-a7173453ea21 - github.com/go-chi/chi/v5 v5.0.2 + github.com/go-chi/chi/v5 v5.0.4 github.com/go-chi/cors v1.2.0 github.com/go-chi/render v1.0.1 - github.com/go-pkgz/auth v1.17.1-0.20210817211320-fed26c31c35c + github.com/go-pkgz/auth v1.18.0 github.com/go-pkgz/jrpc v0.2.0 github.com/go-pkgz/lcw v0.8.1 github.com/go-pkgz/lgr v0.10.4 github.com/go-pkgz/repeater v1.1.3 - github.com/go-pkgz/rest v1.9.2 + github.com/go-pkgz/rest v1.11.0 github.com/go-pkgz/syncs v1.1.1 - github.com/golang-jwt/jwt v3.2.1+incompatible - github.com/google/uuid v1.1.2 + github.com/golang-jwt/jwt v3.2.2+incompatible + github.com/google/uuid v1.3.0 github.com/gorilla/feeds v1.1.1 - github.com/hashicorp/go-multierror v1.1.0 + github.com/hashicorp/go-multierror v1.1.1 github.com/kyokomi/emoji/v2 v2.2.8 - github.com/microcosm-cc/bluemonday v1.0.9 + github.com/microcosm-cc/bluemonday v1.0.15 github.com/pkg/errors v0.9.1 github.com/rakyll/statik v0.1.7 - github.com/rs/xid v1.2.1 + github.com/rs/xid v1.3.0 github.com/russross/blackfriday/v2 v2.1.0 - github.com/slack-go/slack v0.8.2 + github.com/slack-go/slack v0.9.4 github.com/stretchr/testify v1.7.0 github.com/umputun/go-flags v1.5.1 - go.etcd.io/bbolt v1.3.5 - go.uber.org/goleak v1.0.0 - golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b - golang.org/x/image v0.0.0-20210504121937-7319ad40d33e - golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6 + go.etcd.io/bbolt v1.3.6 + go.uber.org/goleak v1.1.10 + golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 + golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d + golang.org/x/net v0.0.0-20210614182718-04defd469f4e ) diff --git a/backend/go.sum b/backend/go.sum index 1bde6486..5c38beb0 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -34,31 +34,30 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/Depado/bfchroma v1.2.0 h1:NyYPFVhWvq8S2ts6Ok4kwXVE3TEO5fof+9ZOKbBJQUo= -github.com/Depado/bfchroma v1.2.0/go.mod h1:U3RJUYwWVJrZRaJQyfS+wuxBApSTR/BC37PhAI+Ydps= -github.com/PuerkitoBio/goquery v1.5.1 h1:PSPBGne8NIUWw+/7vFBV+kG2J/5MOjbzc7154OaKCSE= -github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= +github.com/Depado/bfchroma v1.3.0 h1:zz14vpvySU6S0CL6yGPr1vkFevQecIt8dJdCsMS2JpM= +github.com/Depado/bfchroma v1.3.0/go.mod h1:c0bFk0tFmT+clD3TIGurjWCfD/QV8/EebfM3JGr+98M= +github.com/PuerkitoBio/goquery v1.7.1 h1:oE+T06D+1T7LNrn91B4aERsRIeCLJ/oPSa6xB9FPnz4= +github.com/PuerkitoBio/goquery v1.7.1/go.mod h1:XY0pP4kfraEmmV1O7Uf6XyjoslwsneBbgeDjLYuN8xY= github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/alecthomas/assert 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.6.0/go.mod h1:MmozekIi2rfQSzDcdEZ2BoJ9Pxs/7uc2Y4Boh+hIeZo= -github.com/alecthomas/chroma v0.7.2 h1:B76NU/zbQYIUhUowbi4fmvREmDUJLsUzKWTZmQd3ABY= -github.com/alecthomas/chroma v0.7.2/go.mod h1:fv5SzZPFJbwp2NXJWpFIX7DZS4HgV1K4ew4Pc2OZD9s= +github.com/alecthomas/chroma v0.7.3/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM= +github.com/alecthomas/chroma v0.9.2 h1:yU1sE2+TZbLIQPMk30SolL2Hn53SR/Pv750f7qZ/XMs= +github.com/alecthomas/chroma v0.9.2/go.mod h1:eMuEnpA18XbG/WhOWtCzJHS7WqEtDAI+HxdwoW0nVSk= 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/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= -github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1 h1:GDQdwm/gAcJcLAKQQZGOJ4knlw+7rfEQQcmwTbt4p5E= -github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= +github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c h1:MVVbswUlqicyj8P/JljoocA7AyCo62gzD0O7jfvrhtE= +github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 h1:45bxf7AZMwWcqkLzDAQugVEwedisr5nRJ1r+7LYnv0U= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis/v2 v2.11.4 h1:GsuyeunTx7EllZBU3/6Ji3dhMQZDpC9rLf1luJ+6M5M= github.com/alicebob/miniredis/v2 v2.11.4/go.mod h1:VL3UDEfAH59bSa7MuHMuFToxkqyHh69s/WUbYlOAuyg= -github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= -github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= -github.com/aws/aws-sdk-go v1.34.28 h1:sscPpn/Ns3i0F4HPEWAVcwdIRaZZCuL7llJ2/60yPIk= -github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= +github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE= +github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -77,13 +76,14 @@ github.com/dghubble/oauth1 v0.7.0/go.mod h1:8pFdfPkv/jr8mkChVbNVuJ0suiHe278BtWI4 github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/didip/tollbooth/v6 v6.0.1/go.mod h1:j2pKs+JQ5PvU/K4jFnrnwntrmfUbYLJE5oSdxR37FD0= -github.com/didip/tollbooth/v6 v6.1.0 h1:ZS2fNa9JhFdRSJCj3+V12VfuUifYrGB4Z0jSwXmKMeE= -github.com/didip/tollbooth/v6 v6.1.0/go.mod h1:xjcse6CTHCLuOkzsWrEgdy9WPJFv+p/x6v+MyfP+O9s= +github.com/didip/tollbooth/v6 v6.1.1 h1:Nt7PvWLa9Y94OrykXsFNBinVRQIu8xdy4avpl99Dc1M= +github.com/didip/tollbooth/v6 v6.1.1/go.mod h1:xjcse6CTHCLuOkzsWrEgdy9WPJFv+p/x6v+MyfP+O9s= github.com/didip/tollbooth_chi v0.0.0-20200524181329-8b84cd7183d9/go.mod h1:YWyIfq3y4ArRfWZ9XksmuusP+7Mad+T0iFZ0kv0XG/M= github.com/didip/tollbooth_chi v0.0.0-20200828173446-a7173453ea21 h1:x7YpwKSBIBcKe9I3aTNOqgSyJ6QKDdtOxnEkxBTsi9w= github.com/didip/tollbooth_chi v0.0.0-20200828173446-a7173453ea21/go.mod h1:0ZVa6kSzS011nfTC1rELyxK4tjVf6vqBnOv7oY2KlsA= -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/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E= +github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -96,8 +96,8 @@ github.com/gavv/httpexpect v2.0.0+incompatible h1:1X9kcRshkSKEjNJJxX9Y9mQ5BRfbxU github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/go-chi/chi v4.1.1+incompatible h1:MmTgB0R8Bt/jccxp+t6S/1VGIKdJw5J74CK/c9tTfA4= github.com/go-chi/chi v4.1.1+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= -github.com/go-chi/chi/v5 v5.0.2 h1:4xKeALZdMEsuI5s05PU2Bm89Uc5iM04qFubUCl5LfAQ= -github.com/go-chi/chi/v5 v5.0.2/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.0.4 h1:5e494iHzsYBiyXQAHHuI4tyJS9M3V84OuX3ufIIGHFo= +github.com/go-chi/chi/v5 v5.0.4/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/cors v1.2.0 h1:tV1g1XENQ8ku4Bq3K9ub2AtgG+p16SmzeMSGTwrOKdE= github.com/go-chi/cors v1.2.0/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= github.com/go-chi/render v1.0.1 h1:4/5tis2cKaNdnv9zFLfXzcquC9HbeZgCnxGnKrltBS8= @@ -105,10 +105,8 @@ github.com/go-chi/render v1.0.1/go.mod h1:pq4Rr7HbnsdaeHagklXub+p6Wd16Af5l9koip1 github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-pkgz/auth v1.17.0 h1:m6seF+WbIUlLM96RNZvdq0kKDzZ8ynMOQpANJ1YDviQ= -github.com/go-pkgz/auth v1.17.0/go.mod h1:KhMsOKhNU8fJbWKUYPhfGaYGgnZuSOIs52ojELWxOUk= -github.com/go-pkgz/auth v1.17.1-0.20210817211320-fed26c31c35c h1:khIhLaxSlY6vxbAFYrxcePBJ7uuZTezKxZkiQ417cng= -github.com/go-pkgz/auth v1.17.1-0.20210817211320-fed26c31c35c/go.mod h1:KhMsOKhNU8fJbWKUYPhfGaYGgnZuSOIs52ojELWxOUk= +github.com/go-pkgz/auth v1.18.0 h1:H+C/VZ/qZqDpqJfS7lwuF89OnMIcZINXwFAuEfTSQTA= +github.com/go-pkgz/auth v1.18.0/go.mod h1:hfGyJXugY0O9IPKYHBzf6pDozWtqYMMkI8iSc0kPd14= github.com/go-pkgz/expirable-cache v0.0.3 h1:rTh6qNPp78z0bQE6HDhXBHUwqnV9i09Vm6dksJLXQDc= github.com/go-pkgz/expirable-cache v0.0.3/go.mod h1:+IauqN00R2FqNRLCLA+X5YljQJrwB179PfiAoMPlTlQ= github.com/go-pkgz/jrpc v0.2.0 h1:CLy/eZyekjraVrxZV18N2R1mYLMJ/nWrgdfyIOGPY/E= @@ -120,14 +118,13 @@ github.com/go-pkgz/lgr v0.10.4/go.mod h1:CD0s1z6EFpIUplV067gitF77tn25JItzwHNKAPq github.com/go-pkgz/repeater v1.1.3 h1:q6+JQF14ESSy28Dd7F+wRelY4F+41HJ0LEy/szNnMiE= github.com/go-pkgz/repeater v1.1.3/go.mod h1:hVTavuO5x3Gxnu8zW7d6sQBfAneKV8X2FjU48kGfpKw= github.com/go-pkgz/rest v1.5.0/go.mod h1:nQaM3RhSTUAmbBZWY4hfe4buyeC9VckvhoCktiQXJxI= -github.com/go-pkgz/rest v1.9.2 h1:RyBBRXBYY6eBgTW3UGYOyT4VQPDiBBFh/tesELWsryQ= -github.com/go-pkgz/rest v1.9.2/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw= +github.com/go-pkgz/rest v1.11.0 h1:Z//qgmM0NhBYfhXYEP/aJtDVLK5XlJGxqcb4sHFNN0E= +github.com/go-pkgz/rest v1.11.0/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw= github.com/go-pkgz/syncs v1.1.1 h1:jWN+y6FS/Xe+8z4l3QMbSnODGyaxDHGojIS+wyKIjxg= github.com/go-pkgz/syncs v1.1.1/go.mod h1:bt9lxWRRJ9vOCMGc8Big8ttjYHLKP88ofj1y38UlaHE= github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-session/session v3.1.2+incompatible/go.mod h1:8B3iivBQjrz/JtC68Np2T1yBBLxTan3mn/3OM0CyRt0= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= @@ -156,8 +153,9 @@ github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWe github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -209,8 +207,9 @@ github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -223,8 +222,9 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= @@ -235,10 +235,6 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/imkira/go-interpol v1.1.0 h1:KIiKr0VSG2CUW1hl1jpiyuzuJeKUUpC8iM1AIE7N1Vk= github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= @@ -262,14 +258,13 @@ github.com/kyokomi/emoji/v2 v2.2.8 h1:jcofPxjHWEkJtkIbcLHvZhxKgCPl6C7MyjTrD4KDqU github.com/kyokomi/emoji/v2 v2.2.8/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/microcosm-cc/bluemonday v1.0.9 h1:dpCwruVKoyrULicJwhuY76jB+nIxRVKv/e248Vx/BXg= -github.com/microcosm-cc/bluemonday v1.0.9/go.mod h1:B2riunDr9benLHghZB7hjIgdwSUzzs0pjCxFrWYEZFU= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/microcosm-cc/bluemonday v1.0.15 h1:J4uN+qPng9rvkBZBoBb8YGR+ijuklIMpSOZZLjYpbeY= +github.com/microcosm-cc/bluemonday v1.0.15/go.mod h1:ZLvAzeakRwrGnzQEvstVzVt3ZpqOF2+sdFr0Om+ce30= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= @@ -294,8 +289,8 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= -github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/xid v1.3.0 h1:6NjYksEUlhurdVehpc7S7dk6DAmcKv8V9gG0FsVN2U4= +github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 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= @@ -305,8 +300,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/slack-go/slack v0.8.2 h1:D7jNu0AInBfdQ4QyKPtVSp+ZxQes3EzWW17RZ/va4JE= -github.com/slack-go/slack v0.8.2/go.mod h1:FGqNzJBmxIsZURAxh2a8D21AnOVvvXZvGligs4npPUM= +github.com/slack-go/slack v0.9.4 h1:C+FC3zLxLxUTQjDy2RZeMHYon005zsCROiZNWVo+opQ= +github.com/slack-go/slack v0.9.4/go.mod h1:wWL//kk0ho+FcQXcBTmEafUI5dz4qz5f4mMk8oIkioQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= @@ -370,17 +365,18 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb h1:ZkM6LRnq40pR1Ox0hTHlnpkcOTuFIDQpZ1IN8rKKhX0= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= -go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.mongodb.org/mongo-driver v1.5.2 h1:AsxOLoJTgP6YNM0fXWw4OjdluYmWzQYp+lFJL7xu9fU= -go.mongodb.org/mongo-driver v1.5.2/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= +go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.mongodb.org/mongo-driver v1.7.1 h1:jwqTeEM3x6L9xDXrCxN0Hbg7vdGfPBOTIkr0+/LYZDA= +go.mongodb.org/mongo-driver v1.7.1/go.mod h1:Q4oFMbo1+MSNqICAdYMlC/zSTrwCogR4R8NzkI+yfU8= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.uber.org/goleak v1.0.0 h1:qsup4IcBdlmsnGfqyLl4Ntn3C2XCCuKAE7DwHpScyUo= -go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/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-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= @@ -389,8 +385,8 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b h1:7mWr3k41Qtv8XlltBkDkl8LoP3mpSgBW8BUoxtEdbXg= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -403,8 +399,9 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= 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-20210504121937-7319ad40d33e h1:PzJMNfFQx+QO9hrC1GwZ4BoPGeNGhfeQEgcQFArEjPk= golang.org/x/image v0.0.0-20210504121937-7319ad40d33e/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d h1:RNPAfi2nHY7C2srAV8A49jpsYr0ADedCk1wq6fTMTvs= +golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= 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= @@ -455,9 +452,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= -golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6 h1:0PC75Fz/kyMGhL0e1QnypqK2kQMqKt9csD1GnMJR+Zk= -golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -478,8 +474,6 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ 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-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/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-20190204203706-41f3e6584952/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= @@ -499,6 +493,7 @@ golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -506,15 +501,17 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/backend/remark.rest b/backend/remark.rest index db39c9bf..8220480f 100644 --- a/backend/remark.rest +++ b/backend/remark.rest @@ -164,7 +164,7 @@ GET {{host}}/ping ### create comment with bad locator.url, dev token for secret=12345, not admin POST {{host}}/api/v1/comment Content-Type: application/json -X-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZW1hcmsiLCJleHAiOjE2MTY3OTQ2NTMsImp0aSI6ImNjOGVlNzNlNjM4MzQ1Mjc1MmZjN2M3ZmQ0MmE4MDIzZDY3ZWFiMDIiLCJpYXQiOjE2MTY3OTQzNTMsImlzcyI6InJlbWFyazQyIiwidXNlciI6eyJuYW1lIjoic29tZW9uZSIsImlkIjoiYW5vbnltb3VzX2NhMjlmMjkwOTU3NGE3Zjk3YjRkNGU4YmIwOTU1N2IxMDM1ODE4YjAiLCJwaWN0dXJlIjoiaHR0cHM6Ly9kZW1vLnJlbWFyazQyLmNvbS9hcGkvdjEvYXZhdGFyLzZlMTU5OGE5MWM4MWZlZjhmOGU5MzMwODg4ZWJiZjVlMzkzODVkYTkuaW1hZ2UiLCJhdHRycyI6eyJhZG1pbiI6ZmFsc2UsImJsb2NrZWQiOmZhbHNlfX19.TUEr1qN0j9WGx1jlOL-rc14qjuenH56yI-5_xF9FSGY +X-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZW1hcmsiLCJleHAiOjE5NzYwNTY3NTYsImp0aSI6IjJlOGJmMTE5OTI0MjQxMDRjYjFhZGRlODllMWYwNGFiMTg4YWZjMzQiLCJpYXQiOjE1NzYwNTY0NTYsImlzcyI6InJlbWFyazQyIiwidXNlciI6eyJuYW1lIjoiZGV2X3VzZXIiLCJpZCI6ImRldl91c2VyIiwicGljdHVyZSI6Imh0dHA6Ly8xMjcuMC4wLjE6ODA4MC9hcGkvdjEvYXZhdGFyL2NjZmEyYWJkMDE2Njc2MDViNGUxZmM0ZmNiOTFiMWUxYWYzMjMyNDAuaW1hZ2UiLCJhdHRycyI6eyJhZG1pbiI6dHJ1ZSwiYmxvY2tlZCI6ZmFsc2V9fX0.6Qt5s2enBMRC-Jmsua01yViVYI95Dx6BPBMaNjj36d4 { "text": "comment *blah* http://radio-t.com", diff --git a/backend/vendor/github.com/Depado/bfchroma/.golangci.yml b/backend/vendor/github.com/Depado/bfchroma/.golangci.yml new file mode 100644 index 00000000..d70bd655 --- /dev/null +++ b/backend/vendor/github.com/Depado/bfchroma/.golangci.yml @@ -0,0 +1,16 @@ +run: + timeout: 5m + +linters: + enable: + - megacheck + - govet + disable: + - errcheck + - maligned + - prealloc + disable-all: false + presets: + - bugs + - unused + fast: false diff --git a/backend/vendor/github.com/Depado/bfchroma/README.md b/backend/vendor/github.com/Depado/bfchroma/README.md index 30537471..56bab5b0 100644 --- a/backend/vendor/github.com/Depado/bfchroma/README.md +++ b/backend/vendor/github.com/Depado/bfchroma/README.md @@ -55,13 +55,14 @@ By default when no language information is written in the code block, this renderer will try to auto-detect the used language. This option disables this behavior and will fallback to a sane default when no language information is available. +- `EmbedCSS()` +This option will embed CSS needed for chroma's `html.WithClasses()` at the beginning of blackfriday document. +CSS can also be extracted separately by calling `Renderer`'s.`ChromaCSS(w)` method, which will return styleshet for currently set style - `Extend(bf.Renderer)` This option allows to define the base blackfriday that will be extended. - `ChromaOptions(...html.Option)` This option allows you to pass Chroma's html options in the renderer. Such options can be found [here](https://github.com/alecthomas/chroma#the-html-formatter). -There is currently an issue with the `html.WithClasses()` option as it expects -the CSS classes to be written separately. I'll come up with a fix later. ### Option examples @@ -92,6 +93,8 @@ r := bfchroma.NewRenderer(bfchroma.Style("dracula")) r = bfchroma.NewRenderer(bfchroma.ChromaStyle(styles.Dracula)) ``` + + ## Examples ```go @@ -194,7 +197,7 @@ r := bfchroma.NewRenderer( var css template.CSS b := new(bytes.Buffer) -if err := r.Formatter.WriteCSS(b, r.Style); err != nil { +if err := r.ChromaCSS(b); err != nil { logrus.WithError(err).Warning("Couldn't write CSS") } css = template.CSS(b.String()) diff --git a/backend/vendor/github.com/Depado/bfchroma/go.mod b/backend/vendor/github.com/Depado/bfchroma/go.mod index 2fd48fa2..fc0c3bd0 100644 --- a/backend/vendor/github.com/Depado/bfchroma/go.mod +++ b/backend/vendor/github.com/Depado/bfchroma/go.mod @@ -1,20 +1,11 @@ module github.com/Depado/bfchroma -go 1.13 +go 1.14 require ( - github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 // indirect - github.com/alecthomas/chroma v0.6.0 - github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 // indirect - github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1 // indirect - github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dlclark/regexp2 v1.1.6 // indirect - github.com/mattn/go-isatty v0.0.4 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/alecthomas/chroma v0.7.3 + github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c // indirect github.com/russross/blackfriday/v2 v2.0.1 - github.com/sergi/go-diff v1.0.0 // indirect github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect - github.com/stretchr/testify v1.2.2 - golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 // indirect + github.com/stretchr/testify v1.6.1 ) diff --git a/backend/vendor/github.com/Depado/bfchroma/go.sum b/backend/vendor/github.com/Depado/bfchroma/go.sum index c196dc2d..4677ed2c 100644 --- a/backend/vendor/github.com/Depado/bfchroma/go.sum +++ b/backend/vendor/github.com/Depado/bfchroma/go.sum @@ -1,19 +1,25 @@ 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.6.0 h1:gcvXlpe0/NoQP3BvneRfgcauLIJDw9VblkoFwZ5XGFs= -github.com/alecthomas/chroma v0.6.0/go.mod h1:MmozekIi2rfQSzDcdEZ2BoJ9Pxs/7uc2Y4Boh+hIeZo= +github.com/alecthomas/chroma v0.7.3 h1:NfdAERMy+esYQs8OXk0I868/qDxxCEo7FMz1WIqMAeI= +github.com/alecthomas/chroma v0.7.3/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM= 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/repr v0.0.0-20181024024818-d37bc2a10ba1 h1:GDQdwm/gAcJcLAKQQZGOJ4knlw+7rfEQQcmwTbt4p5E= -github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= +github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= +github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= +github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c h1:MVVbswUlqicyj8P/JljoocA7AyCo62gzD0O7jfvrhtE= +github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= 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/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/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk= +github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= @@ -22,7 +28,19 @@ github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 h1:YoY1wS6JYVRpIfFngRf2HHo9R9dAne3xbkGOQ5rJXjU= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY= +golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/backend/vendor/github.com/Depado/bfchroma/renderer.go b/backend/vendor/github.com/Depado/bfchroma/renderer.go index 7cc5d723..e9e997a0 100644 --- a/backend/vendor/github.com/Depado/bfchroma/renderer.go +++ b/backend/vendor/github.com/Depado/bfchroma/renderer.go @@ -40,6 +40,13 @@ func WithoutAutodetect() Option { } } +// EmbedCSS will embed CSS needed for html.WithClasses() in beginning of the document +func EmbedCSS() Option { + return func(r *Renderer) { + r.embedCSS = true + } +} + // ChromaOptions allows to pass Chroma html.Option such as Standalone() // WithClasses(), ClassPrefix(prefix)... func ChromaOptions(options ...html.Option) Option { @@ -101,11 +108,19 @@ type Renderer struct { ChromaOptions []html.Option Style *chroma.Style Formatter *html.Formatter + embedCSS bool } // RenderNode satisfies the Renderer interface func (r *Renderer) RenderNode(w io.Writer, node *bf.Node, entering bool) bf.WalkStatus { switch node.Type { + case bf.Document: + if entering && r.embedCSS { + w.Write([]byte("")) + } + return r.Base.RenderNode(w, node, entering) case bf.CodeBlock: if err := r.RenderWithChroma(w, node.Literal, node.CodeBlockData); err != nil { return r.Base.RenderNode(w, node, entering) @@ -125,3 +140,8 @@ func (r *Renderer) RenderHeader(w io.Writer, ast *bf.Node) { func (r *Renderer) RenderFooter(w io.Writer, ast *bf.Node) { r.Base.RenderFooter(w, ast) } + +// ChromaCSS returns CSS used with chroma's html.WithClasses() option +func (r *Renderer) ChromaCSS(w io.Writer) error { + return r.Formatter.WriteCSS(w, r.Style) +} \ No newline at end of file diff --git a/backend/vendor/github.com/PuerkitoBio/goquery/.travis.yml b/backend/vendor/github.com/PuerkitoBio/goquery/.travis.yml index 27c3ce81..8430c86a 100644 --- a/backend/vendor/github.com/PuerkitoBio/goquery/.travis.yml +++ b/backend/vendor/github.com/PuerkitoBio/goquery/.travis.yml @@ -1,11 +1,9 @@ +arch: + - amd64 + - ppc64le language: go go: - - 1.2.x - - 1.3.x - - 1.4.x - - 1.5.x - - 1.6.x - 1.7.x - 1.8.x - 1.9.x @@ -13,5 +11,21 @@ go: - 1.11.x - 1.12.x - 1.13.x + - 1.14.x + - 1.15.x - tip +jobs: + exclude: + - arch: ppc64le + go: 1.7.x + - arch: ppc64le + go: 1.8.x + - arch: ppc64le + go: 1.9.x + - arch: ppc64le + go: 1.10.x + - arch: ppc64le + go: 1.11.x + - arch: ppc64le + go: 1.12.x diff --git a/backend/vendor/github.com/PuerkitoBio/goquery/LICENSE b/backend/vendor/github.com/PuerkitoBio/goquery/LICENSE index f743d372..25372c2b 100644 --- a/backend/vendor/github.com/PuerkitoBio/goquery/LICENSE +++ b/backend/vendor/github.com/PuerkitoBio/goquery/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2012-2016, Martin Angers & Contributors +Copyright (c) 2012-2021, Martin Angers & Contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/backend/vendor/github.com/PuerkitoBio/goquery/README.md b/backend/vendor/github.com/PuerkitoBio/goquery/README.md index 0bc221d1..6bb185c2 100644 --- a/backend/vendor/github.com/PuerkitoBio/goquery/README.md +++ b/backend/vendor/github.com/PuerkitoBio/goquery/README.md @@ -1,5 +1,9 @@ # goquery - a little like that j-thing, only in Go -[![build status](https://secure.travis-ci.org/PuerkitoBio/goquery.svg?branch=master)](http://travis-ci.org/PuerkitoBio/goquery) [![GoDoc](https://godoc.org/github.com/PuerkitoBio/goquery?status.png)](http://godoc.org/github.com/PuerkitoBio/goquery) [![Sourcegraph Badge](https://sourcegraph.com/github.com/PuerkitoBio/goquery/-/badge.svg)](https://sourcegraph.com/github.com/PuerkitoBio/goquery?badge) + +[![builds.sr.ht status](https://builds.sr.ht/~mna/goquery/commits/fedora.yml.svg)](https://builds.sr.ht/~mna/goquery/commits/fedora.yml?) +[![build status](https://secure.travis-ci.org/PuerkitoBio/goquery.svg?branch=master)](http://travis-ci.org/PuerkitoBio/goquery) +[![Go Reference](https://pkg.go.dev/badge/github.com/PuerkitoBio/goquery.svg)](https://pkg.go.dev/github.com/PuerkitoBio/goquery) +[![Sourcegraph Badge](https://sourcegraph.com/github.com/PuerkitoBio/goquery/-/badge.svg)](https://sourcegraph.com/github.com/PuerkitoBio/goquery?badge) goquery brings a syntax and a set of features similar to [jQuery][] to the [Go language][go]. It is based on Go's [net/html package][html] and the CSS Selector library [cascadia][]. Since the net/html parser returns nodes, and not a full-featured DOM tree, jQuery's stateful manipulation functions (like height(), css(), detach()) have been left off. @@ -19,7 +23,7 @@ Syntax-wise, it is as close as possible to jQuery, with the same function names ## Installation -Please note that because of the net/html dependency, goquery requires Go1.1+. +Please note that because of the net/html dependency, goquery requires Go1.1+ and is tested on Go1.7+. $ go get github.com/PuerkitoBio/goquery @@ -37,6 +41,10 @@ Please note that because of the net/html dependency, goquery requires Go1.1+. **Note that goquery's API is now stable, and will not break.** +* **2021-07-11 (v1.7.1)** : Update go.mod dependencies and add dependabot config (thanks [@jauderho](https://github.com/jauderho)). +* **2021-06-14 (v1.7.0)** : Add `Single` and `SingleMatcher` functions to optimize first-match selection (thanks [@gdollardollar](https://github.com/gdollardollar)). +* **2021-01-11 (v1.6.1)** : Fix panic when calling `{Prepend,Append,Set}Html` on a `Selection` that contains non-Element nodes. +* **2020-10-08 (v1.6.0)** : Parse html in context of the container node for all functions that deal with html strings (`AfterHtml`, `AppendHtml`, etc.). Thanks to [@thiemok][thiemok] and [@davidjwilkins][djw] for their work on this. * **2020-02-04 (v1.5.1)** : Update module dependencies. * **2018-11-15 (v1.5.0)** : Go module support (thanks @Zaba505). * **2018-06-07 (v1.4.1)** : Add `NewDocumentFromReader` examples. @@ -48,7 +56,7 @@ Please note that because of the net/html dependency, goquery requires Go1.1+. * **2016-08-28 (v1.0.1)** : Optimize performance for large documents. * **2016-07-27 (v1.0.0)** : Tag version 1.0.0. * **2016-06-15** : Invalid selector strings internally compile to a `Matcher` implementation that never matches any node (instead of a panic). So for example, `doc.Find("~")` returns an empty `*Selection` object. -* **2016-02-02** : Add `NodeName` utility function similar to the DOM's `nodeName` property. It returns the tag name of the first element in a selection, and other relevant values of non-element nodes (see godoc for details). Add `OuterHtml` utility function similar to the DOM's `outerHTML` property (named `OuterHtml` in small caps for consistency with the existing `Html` method on the `Selection`). +* **2016-02-02** : Add `NodeName` utility function similar to the DOM's `nodeName` property. It returns the tag name of the first element in a selection, and other relevant values of non-element nodes (see [doc][] for details). Add `OuterHtml` utility function similar to the DOM's `outerHTML` property (named `OuterHtml` in small caps for consistency with the existing `Html` method on the `Selection`). * **2015-04-20** : Add `AttrOr` helper method to return the attribute's value or a default value if absent. Thanks to [piotrkowalczuk][piotr]. * **2015-02-04** : Add more manipulation functions - Prepend* - thanks again to [Andrew Stone][thatguystone]. * **2014-11-28** : Add more manipulation functions - ReplaceWith*, Wrap* and Unwrap - thanks again to [Andrew Stone][thatguystone]. @@ -77,7 +85,7 @@ jQuery often has many variants for the same function (no argument, a selector st Utility functions that are not in jQuery but are useful in Go are implemented as functions (that take a `*Selection` as parameter), to avoid a potential naming clash on the `*Selection`'s methods (reserved for jQuery-equivalent behaviour). -The complete [godoc reference documentation can be found here][doc]. +The complete [package reference documentation can be found here][doc]. Please note that Cascadia's selectors do not necessarily match all supported selectors of jQuery (Sizzle). See the [cascadia project][cascadia] for details. Invalid selector strings compile to a `Matcher` that fails to match any node. Behaviour of the various functions that take a selector string as argument follows from that fact, e.g. (where `~` is an invalid selector string): @@ -121,12 +129,11 @@ func ExampleScrape() { } // Find the review items - doc.Find(".sidebar-reviews article .content-block").Each(func(i int, s *goquery.Selection) { - // For each item found, get the band and title - band := s.Find("a").Text() - title := s.Find("i").Text() - fmt.Printf("Review %d: %s - %s\n", i, band, title) - }) + doc.Find(".left-content article .post-title").Each(func(i int, s *goquery.Selection) { + // For each item found, get the title + title := s.Find("a").Text() + fmt.Printf("Review %d: %s\n", i, title) + }) } func main() { @@ -143,8 +150,10 @@ func main() { - [gnulnx/goperf](https://github.com/gnulnx/goperf), a website performance test tool that also fetches static assets. - [MontFerret/ferret](https://github.com/MontFerret/ferret), declarative web scraping. - [tacusci/berrycms](https://github.com/tacusci/berrycms), a modern simple to use CMS with easy to write plugins -- [Dataflow kit](https://github.com/slotix/dataflowkit), Web Scraping framework for Gophers. +- [Dataflow kit](https://github.com/slotix/dataflowkit), Web Scraping framework for Gophers. - [Geziyor](https://github.com/geziyor/geziyor), a fast web crawling & scraping framework for Go. Supports JS rendering. +- [Pagser](https://github.com/foolin/pagser), a simple, easy, extensible, configurable HTML parser to struct based on goquery and struct tags. +- [stitcherd](https://github.com/vhodges/stitcherd), A server for doing server side includes using css selectors and DOM updates. ## Support @@ -157,8 +166,9 @@ There are a number of ways you can support the project: * Pull requests: please discuss new code in an issue first, unless the fix is really trivial. - Make sure new code is tested. - Be mindful of existing code - PRs that break existing code have a high probability of being declined, unless it fixes a serious issue. - -If you desperately want to send money my way, I have a BuyMeACoffee.com page: +* Sponsor the developer + - See the Github Sponsor button at the top of the repo on github + - or via BuyMeACoffee.com, below Buy Me A Coffee @@ -173,11 +183,13 @@ The [BSD 3-Clause license][bsd], the same as the [Go language][golic]. Cascadia' [bsd]: http://opensource.org/licenses/BSD-3-Clause [golic]: http://golang.org/LICENSE [caslic]: https://github.com/andybalholm/cascadia/blob/master/LICENSE -[doc]: http://godoc.org/github.com/PuerkitoBio/goquery +[doc]: https://pkg.go.dev/github.com/PuerkitoBio/goquery [index]: http://api.jquery.com/index/ [gonet]: https://github.com/golang/net/ -[html]: http://godoc.org/golang.org/x/net/html +[html]: https://pkg.go.dev/golang.org/x/net/html [wiki]: https://github.com/PuerkitoBio/goquery/wiki/Tips-and-tricks [thatguystone]: https://github.com/thatguystone [piotr]: https://github.com/piotrkowalczuk [goq]: https://github.com/andrewstuart/goq +[thiemok]: https://github.com/thiemok +[djw]: https://github.com/davidjwilkins diff --git a/backend/vendor/github.com/PuerkitoBio/goquery/go.mod b/backend/vendor/github.com/PuerkitoBio/goquery/go.mod index 95826ad3..3af3b154 100644 --- a/backend/vendor/github.com/PuerkitoBio/goquery/go.mod +++ b/backend/vendor/github.com/PuerkitoBio/goquery/go.mod @@ -1,8 +1,8 @@ module github.com/PuerkitoBio/goquery require ( - github.com/andybalholm/cascadia v1.1.0 - golang.org/x/net v0.0.0-20200202094626-16171245cfb2 + github.com/andybalholm/cascadia v1.2.0 + golang.org/x/net v0.0.0-20210614182718-04defd469f4e ) go 1.13 diff --git a/backend/vendor/github.com/PuerkitoBio/goquery/go.sum b/backend/vendor/github.com/PuerkitoBio/goquery/go.sum index bc79107e..13b128d4 100644 --- a/backend/vendor/github.com/PuerkitoBio/goquery/go.sum +++ b/backend/vendor/github.com/PuerkitoBio/goquery/go.sum @@ -1,8 +1,10 @@ -github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= -github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE= +github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/backend/vendor/github.com/PuerkitoBio/goquery/manipulation.go b/backend/vendor/github.com/PuerkitoBio/goquery/manipulation.go index 34eb7570..35febf11 100644 --- a/backend/vendor/github.com/PuerkitoBio/goquery/manipulation.go +++ b/backend/vendor/github.com/PuerkitoBio/goquery/manipulation.go @@ -39,8 +39,15 @@ func (s *Selection) AfterSelection(sel *Selection) *Selection { // AfterHtml parses the html and inserts it after the set of matched elements. // // This follows the same rules as Selection.Append. -func (s *Selection) AfterHtml(html string) *Selection { - return s.AfterNodes(parseHtml(html)...) +func (s *Selection) AfterHtml(htmlStr string) *Selection { + return s.eachNodeHtml(htmlStr, true, func(node *html.Node, nodes []*html.Node) { + nextSibling := node.NextSibling + for _, n := range nodes { + if node.Parent != nil { + node.Parent.InsertBefore(n, nextSibling) + } + } + }) } // AfterNodes inserts the nodes after each element in the set of matched elements. @@ -85,8 +92,12 @@ func (s *Selection) AppendSelection(sel *Selection) *Selection { } // AppendHtml parses the html and appends it to the set of matched elements. -func (s *Selection) AppendHtml(html string) *Selection { - return s.AppendNodes(parseHtml(html)...) +func (s *Selection) AppendHtml(htmlStr string) *Selection { + return s.eachNodeHtml(htmlStr, false, func(node *html.Node, nodes []*html.Node) { + for _, n := range nodes { + node.AppendChild(n) + } + }) } // AppendNodes appends the specified nodes to each node in the set of matched elements. @@ -123,8 +134,14 @@ func (s *Selection) BeforeSelection(sel *Selection) *Selection { // BeforeHtml parses the html and inserts it before the set of matched elements. // // This follows the same rules as Selection.Append. -func (s *Selection) BeforeHtml(html string) *Selection { - return s.BeforeNodes(parseHtml(html)...) +func (s *Selection) BeforeHtml(htmlStr string) *Selection { + return s.eachNodeHtml(htmlStr, true, func(node *html.Node, nodes []*html.Node) { + for _, n := range nodes { + if node.Parent != nil { + node.Parent.InsertBefore(n, node) + } + } + }) } // BeforeNodes inserts the nodes before each element in the set of matched elements. @@ -184,8 +201,13 @@ func (s *Selection) PrependSelection(sel *Selection) *Selection { } // PrependHtml parses the html and prepends it to the set of matched elements. -func (s *Selection) PrependHtml(html string) *Selection { - return s.PrependNodes(parseHtml(html)...) +func (s *Selection) PrependHtml(htmlStr string) *Selection { + return s.eachNodeHtml(htmlStr, false, func(node *html.Node, nodes []*html.Node) { + firstChild := node.FirstChild + for _, n := range nodes { + node.InsertBefore(n, firstChild) + } + }) } // PrependNodes prepends the specified nodes to each node in the set of @@ -212,14 +234,19 @@ func (s *Selection) Remove() *Selection { return s } -// RemoveFiltered removes the set of matched elements by selector. -// It returns the Selection of removed nodes. +// RemoveFiltered removes from the current set of matched elements those that +// match the selector filter. It returns the Selection of removed nodes. +// +// For example if the selection s contains "

", "

" and "

" +// and s.RemoveFiltered("h2") is called, only the "

" node is removed +// (and returned), while "

" and "

" are kept in the document. func (s *Selection) RemoveFiltered(selector string) *Selection { return s.RemoveMatcher(compileMatcher(selector)) } -// RemoveMatcher removes the set of matched elements. -// It returns the Selection of removed nodes. +// RemoveMatcher removes from the current set of matched elements those that +// match the Matcher filter. It returns the Selection of removed nodes. +// See RemoveFiltered for additional information. func (s *Selection) RemoveMatcher(m Matcher) *Selection { return s.FilterMatcher(m).Remove() } @@ -256,8 +283,16 @@ func (s *Selection) ReplaceWithSelection(sel *Selection) *Selection { // It returns the removed elements. // // This follows the same rules as Selection.Append. -func (s *Selection) ReplaceWithHtml(html string) *Selection { - return s.ReplaceWithNodes(parseHtml(html)...) +func (s *Selection) ReplaceWithHtml(htmlStr string) *Selection { + s.eachNodeHtml(htmlStr, true, func(node *html.Node, nodes []*html.Node) { + nextSibling := node.NextSibling + for _, n := range nodes { + if node.Parent != nil { + node.Parent.InsertBefore(n, nextSibling) + } + } + }) + return s.Remove() } // ReplaceWithNodes replaces each element in the set of matched elements with @@ -272,8 +307,17 @@ func (s *Selection) ReplaceWithNodes(ns ...*html.Node) *Selection { // SetHtml sets the html content of each element in the selection to // specified html string. -func (s *Selection) SetHtml(html string) *Selection { - return setHtmlNodes(s, parseHtml(html)...) +func (s *Selection) SetHtml(htmlStr string) *Selection { + for _, context := range s.Nodes { + for c := context.FirstChild; c != nil; c = context.FirstChild { + context.RemoveChild(c) + } + } + return s.eachNodeHtml(htmlStr, false, func(node *html.Node, nodes []*html.Node) { + for _, n := range nodes { + node.AppendChild(n) + } + }) } // SetText sets the content of each element in the selection to specified content. @@ -329,8 +373,23 @@ func (s *Selection) WrapSelection(sel *Selection) *Selection { // most child of the given HTML. // // It returns the original set of elements. -func (s *Selection) WrapHtml(html string) *Selection { - return s.wrapNodes(parseHtml(html)...) +func (s *Selection) WrapHtml(htmlStr string) *Selection { + nodesMap := make(map[string][]*html.Node) + for _, context := range s.Nodes { + var parent *html.Node + if context.Parent != nil { + parent = context.Parent + } else { + parent = &html.Node{Type: html.ElementNode} + } + nodes, found := nodesMap[nodeName(parent)] + if !found { + nodes = parseHtmlWithContext(htmlStr, parent) + nodesMap[nodeName(parent)] = nodes + } + newSingleSelection(context, s.document).wrapAllNodes(cloneNodes(nodes)...) + } + return s } // WrapNode wraps each element in the set of matched elements inside the inner- @@ -382,8 +441,18 @@ func (s *Selection) WrapAllSelection(sel *Selection) *Selection { // document. // // It returns the original set of elements. -func (s *Selection) WrapAllHtml(html string) *Selection { - return s.wrapAllNodes(parseHtml(html)...) +func (s *Selection) WrapAllHtml(htmlStr string) *Selection { + var context *html.Node + var nodes []*html.Node + if len(s.Nodes) > 0 { + context = s.Nodes[0] + if context.Parent != nil { + nodes = parseHtmlWithContext(htmlStr, context) + } else { + nodes = parseHtml(htmlStr) + } + } + return s.wrapAllNodes(nodes...) } func (s *Selection) wrapAllNodes(ns ...*html.Node) *Selection { @@ -452,8 +521,17 @@ func (s *Selection) WrapInnerSelection(sel *Selection) *Selection { // cloned before being inserted into the document. // // It returns the original set of elements. -func (s *Selection) WrapInnerHtml(html string) *Selection { - return s.wrapInnerNodes(parseHtml(html)...) +func (s *Selection) WrapInnerHtml(htmlStr string) *Selection { + nodesMap := make(map[string][]*html.Node) + for _, context := range s.Nodes { + nodes, found := nodesMap[nodeName(context)] + if !found { + nodes = parseHtmlWithContext(htmlStr, context) + nodesMap[nodeName(context)] = nodes + } + newSingleSelection(context, s.document).wrapInnerNodes(cloneNodes(nodes)...) + } + return s } // WrapInnerNode wraps an HTML structure, matched by the given selector, around @@ -493,16 +571,14 @@ func parseHtml(h string) []*html.Node { return nodes } -func setHtmlNodes(s *Selection, ns ...*html.Node) *Selection { - for _, n := range s.Nodes { - for c := n.FirstChild; c != nil; c = n.FirstChild { - n.RemoveChild(c) - } - for _, c := range ns { - n.AppendChild(cloneNode(c)) - } +func parseHtmlWithContext(h string, context *html.Node) []*html.Node { + // Errors are only returned when the io.Reader returns any error besides + // EOF, but strings.Reader never will + nodes, err := html.ParseFragment(strings.NewReader(h), context) + if err != nil { + panic("goquery: failed to parse HTML: " + err.Error()) } - return s + return nodes } // Get the first child that is an ElementNode @@ -572,3 +648,32 @@ func (s *Selection) manipulateNodes(ns []*html.Node, reverse bool, return s } + +// eachNodeHtml parses the given html string and inserts the resulting nodes in the dom with the mergeFn. +// The parsed nodes are inserted for each element of the selection. +// isParent can be used to indicate that the elements of the selection should be treated as the parent for the parsed html. +// A cache is used to avoid parsing the html multiple times should the elements of the selection result in the same context. +func (s *Selection) eachNodeHtml(htmlStr string, isParent bool, mergeFn func(n *html.Node, nodes []*html.Node)) *Selection { + // cache to avoid parsing the html for the same context multiple times + nodeCache := make(map[string][]*html.Node) + var context *html.Node + for _, n := range s.Nodes { + if isParent { + context = n.Parent + } else { + if n.Type != html.ElementNode { + continue + } + context = n + } + if context != nil { + nodes, found := nodeCache[nodeName(context)] + if !found { + nodes = parseHtmlWithContext(htmlStr, context) + nodeCache[nodeName(context)] = nodes + } + mergeFn(n, cloneNodes(nodes)) + } + } + return s +} diff --git a/backend/vendor/github.com/PuerkitoBio/goquery/type.go b/backend/vendor/github.com/PuerkitoBio/goquery/type.go index 6ad51dbc..6646c143 100644 --- a/backend/vendor/github.com/PuerkitoBio/goquery/type.go +++ b/backend/vendor/github.com/PuerkitoBio/goquery/type.go @@ -7,7 +7,6 @@ import ( "net/url" "github.com/andybalholm/cascadia" - "golang.org/x/net/html" ) @@ -122,6 +121,45 @@ type Matcher interface { Filter([]*html.Node) []*html.Node } +// Single compiles a selector string to a Matcher that stops after the first +// match is found. +// +// By default, Selection.Find and other functions that accept a selector string +// to select nodes will use all matches corresponding to that selector. By +// using the Matcher returned by Single, at most the first match will be +// selected. +// +// For example, those two statements are semantically equivalent: +// +// sel1 := doc.Find("a").First() +// sel2 := doc.FindMatcher(goquery.Single("a")) +// +// The one using Single is optimized to be potentially much faster on large +// documents. +// +// Only the behaviour of the MatchAll method of the Matcher interface is +// altered compared to standard Matchers. This means that the single-selection +// property of the Matcher only applies for Selection methods where the Matcher +// is used to select nodes, not to filter or check if a node matches the +// Matcher - in those cases, the behaviour of the Matcher is unchanged (e.g. +// FilterMatcher(Single("div")) will still result in a Selection with multiple +// "div"s if there were many "div"s in the Selection to begin with). +func Single(selector string) Matcher { + return singleMatcher{compileMatcher(selector)} +} + +// SingleMatcher returns a Matcher matches the same nodes as m, but that stops +// after the first match is found. +// +// See the documentation of function Single for more details. +func SingleMatcher(m Matcher) Matcher { + if _, ok := m.(singleMatcher); ok { + // m is already a singleMatcher + return m + } + return singleMatcher{m} +} + // compileMatcher compiles the selector string s and returns // the corresponding Matcher. If s is an invalid selector string, // it returns a Matcher that fails all matches. @@ -133,6 +171,30 @@ func compileMatcher(s string) Matcher { return cs } +type singleMatcher struct { + Matcher +} + +func (m singleMatcher) MatchAll(n *html.Node) []*html.Node { + // Optimized version - stops finding at the first match (cascadia-compiled + // matchers all use this code path). + if mm, ok := m.Matcher.(interface{ MatchFirst(*html.Node) *html.Node }); ok { + node := mm.MatchFirst(n) + if node == nil { + return nil + } + return []*html.Node{node} + } + + // Fallback version, for e.g. test mocks that don't provide the MatchFirst + // method. + nodes := m.Matcher.MatchAll(n) + if len(nodes) > 0 { + return nodes[:1:1] + } + return nil +} + // invalidMatcher is a Matcher that always fails to match. type invalidMatcher struct{} diff --git a/backend/vendor/github.com/PuerkitoBio/goquery/utilities.go b/backend/vendor/github.com/PuerkitoBio/goquery/utilities.go index b4c061a4..3e11b1db 100644 --- a/backend/vendor/github.com/PuerkitoBio/goquery/utilities.go +++ b/backend/vendor/github.com/PuerkitoBio/goquery/utilities.go @@ -36,12 +36,22 @@ func NodeName(s *Selection) string { if s.Length() == 0 { return "" } - switch n := s.Get(0); n.Type { + return nodeName(s.Get(0)) +} + +// nodeName returns the node name of the given html node. +// See NodeName for additional details on behaviour. +func nodeName(node *html.Node) string { + if node == nil { + return "" + } + + switch node.Type { case html.ElementNode, html.DoctypeNode: - return n.Data + return node.Data default: - if n.Type >= 0 && int(n.Type) < len(nodeNames) { - return nodeNames[n.Type] + if node.Type >= 0 && int(node.Type) < len(nodeNames) { + return nodeNames[node.Type] } return "" } diff --git a/backend/vendor/github.com/alecthomas/chroma/.golangci.yml b/backend/vendor/github.com/alecthomas/chroma/.golangci.yml index b1e51f39..ba755733 100644 --- a/backend/vendor/github.com/alecthomas/chroma/.golangci.yml +++ b/backend/vendor/github.com/alecthomas/chroma/.golangci.yml @@ -20,6 +20,22 @@ linters: - wsl - gomnd - gocognit + - goerr113 + - nolintlint + - testpackage + - godot + - nestif + - paralleltest + - nlreturn + - cyclop + - exhaustivestruct + - gci + - gofumpt + - errorlint + - exhaustive + - ifshort + - wrapcheck + - stylecheck linters-settings: govet: @@ -31,6 +47,11 @@ linters-settings: goconst: min-len: 8 min-occurrences: 3 + forbidigo: + forbid: + - (Must)?NewLexer + exclude_godoc_examples: false + issues: max-per-linter: 0 diff --git a/backend/vendor/github.com/alecthomas/chroma/.goreleaser.yml b/backend/vendor/github.com/alecthomas/chroma/.goreleaser.yml index 99d13e31..f8abfdd8 100644 --- a/backend/vendor/github.com/alecthomas/chroma/.goreleaser.yml +++ b/backend/vendor/github.com/alecthomas/chroma/.goreleaser.yml @@ -6,6 +6,8 @@ release: brews: - install: bin.install "chroma" +env: + - CGO_ENABLED=0 builds: - goos: - linux diff --git a/backend/vendor/github.com/alecthomas/chroma/.travis.yml b/backend/vendor/github.com/alecthomas/chroma/.travis.yml deleted file mode 100644 index 9216ec97..00000000 --- a/backend/vendor/github.com/alecthomas/chroma/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -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/backend/vendor/github.com/alecthomas/chroma/Makefile b/backend/vendor/github.com/alecthomas/chroma/Makefile index 1b8320a5..010ec039 100644 --- a/backend/vendor/github.com/alecthomas/chroma/Makefile +++ b/backend/vendor/github.com/alecthomas/chroma/Makefile @@ -1,5 +1,7 @@ .PHONY: chromad upload all +VERSION ?= $(shell git describe --tags --dirty --always) + all: README.md tokentype_string.go README.md: lexers/*/*.go @@ -9,10 +11,8 @@ 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 + (export CGOENABLED=0 GOOS=linux ; cd ./cmd/chromad && go build -ldflags="-X 'main.version=$(VERSION)'" -o ../../chromad .) upload: chromad scp chromad root@swapoff.org: && \ diff --git a/backend/vendor/github.com/alecthomas/chroma/README.md b/backend/vendor/github.com/alecthomas/chroma/README.md index 490adeac..95d54e61 100644 --- a/backend/vendor/github.com/alecthomas/chroma/README.md +++ b/backend/vendor/github.com/alecthomas/chroma/README.md @@ -1,4 +1,4 @@ -# 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) +# 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) [![CircleCI](https://img.shields.io/circleci/project/github/alecthomas/chroma.svg)](https://circleci.com/gh/alecthomas/chroma) [![Go Report Card](https://goreportcard.com/badge/github.com/alecthomas/chroma)](https://goreportcard.com/report/github.com/alecthomas/chroma) [![Slack chat](https://img.shields.io/static/v1?logo=slack&style=flat&label=slack&color=green&message=gophers)](https://invite.slack.golangbridge.org/) > **NOTE:** As Chroma has just been released, its API is still in flux. That said, the high-level interface should not change significantly. @@ -36,29 +36,30 @@ translators for Pygments lexers and styles. 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 +B | Ballerina, Base Makefile, Bash, Batchfile, BibTeX, BlitzBasic, BNF, Brainfuck +C | C, C#, C++, Caddyfile, Caddyfile Directives, 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, Dylan 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 +G | GAS, GDScript, Genshi, Genshi HTML, Genshi Text, Gherkin, GLSL, Gnuplot, Go, Go HTML Template, Go Text Template, GraphQL, Groff, Groovy +H | Handlebars, Haskell, Haxe, HCL, Hexdump, HLB, HTML, HTTP, Hy +I | Idris, Igor, 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 +P | PacmanConf, Perl, PHP, PHTML, Pig, PkgConfig, PL/pgSQL, plaintext, Pony, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, PromQL, Protocol Buffer, Puppet, Python 2, Python 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 +R | R, Racket, Ragel, Raku, react, ReasonML, reg, reStructuredText, Rexx, Ruby, Rust +S | SAS, Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, Snobol, Solidity, SPARQL, SQL, SquidConf, Standard ML, Stylus, Svelte, 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 +Y | YAML, YANG +Z | Zig _I will attempt to keep this section up to date, but an authoritative list can be @@ -183,7 +184,7 @@ following constructor options: - `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. +- `LinkableLineNumbers()` - Make the line numbers linkable and be a link to themselves. - `HighlightLines(ranges)` - Highlight lines in these ranges (style with `LineHighlight`). - `LineNumbersInTable()` - Use a table for formatting line numbers and code, rather than spans. @@ -209,13 +210,13 @@ using the included Python 3 script `pygments2chroma.py`. I use something like the following: ```sh -python3 ~/Projects/chroma/_tools/pygments2chroma.py \ +python3 _tools/pygments2chroma.py \ pygments.lexers.jvm.KotlinLexer \ - > ~/Projects/chroma/lexers/kotlin.go \ - && gofmt -s -w ~/Projects/chroma/lexers/*.go + > lexers/k/kotlin.go \ + && gofmt -s -w lexers/k/kotlin.go ``` -See notes in [pygments-lexers.go](https://github.com/alecthomas/chroma/blob/master/pygments-lexers.txt) +See notes in [pygments-lexers.txt](https://github.com/alecthomas/chroma/blob/master/pygments-lexers.txt) for a list of lexers, and notes on some of the issues importing them. @@ -254,12 +255,30 @@ A command-line interface to Chroma is included. It can be installed with: go get -u github.com/alecthomas/chroma/cmd/chroma ``` +The CLI can be used as a preprocessor to colorise output of `less(1)`, +see documentation for the `LESSOPEN` environment variable. + +The `--fail` flag can be used to suppress output and return with exit status +1 to facilitate falling back to some other preprocessor in case chroma +does not resolve a specific lexer to use for the given file. For example: + +```shell +export LESSOPEN='| p() { chroma --fail "$1" || cat "$1"; }; p "%s"' +``` + +Replace `cat` with your favourite fallback preprocessor. + +When invoked as `.lessfilter`, the `--fail` flag is automatically turned +on under the hood for easy integration with [lesspipe shipping with +Debian and derivatives](https://manpages.debian.org/lesspipe#USER_DEFINED_FILTERS); +for that setup the `chroma` executable can be just symlinked to `~/.lessfilter`. + ## 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 + handle certain aspects, such as Raku'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. diff --git a/backend/vendor/github.com/alecthomas/chroma/formatters/html/html.go b/backend/vendor/github.com/alecthomas/chroma/formatters/html/html.go index 0bdc1e59..5121529e 100644 --- a/backend/vendor/github.com/alecthomas/chroma/formatters/html/html.go +++ b/backend/vendor/github.com/alecthomas/chroma/formatters/html/html.go @@ -131,7 +131,7 @@ var ( } defaultPreWrapper = preWrapper{ start: func(code bool, styleAttr string) string { - return fmt.Sprintf("", styleAttr) + return fmt.Sprintf(`
`, styleAttr)
 		},
 		end: func(code bool) string {
 			return "
" @@ -211,7 +211,7 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma. fmt.Fprintf(w, "", f.styleAttr(css, chroma.LineHighlight)) } - fmt.Fprintf(w, "%*d\n", f.styleAttr(css, chroma.LineNumbersTable), f.lineIDAttribute(line), lineDigits, line) + fmt.Fprintf(w, "%s\n", f.styleAttr(css, chroma.LineNumbersTable), f.lineIDAttribute(line), f.lineTitleWithLinkIfNeeded(lineDigits, line)) if highlight { fmt.Fprintf(w, "") @@ -237,7 +237,7 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma. } if f.lineNumbers && !wrapInTable { - fmt.Fprintf(w, "%*d", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), lineDigits, line) + fmt.Fprintf(w, "%s", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), f.lineTitleWithLinkIfNeeded(lineDigits, line)) } for _, token := range tokens { @@ -272,7 +272,19 @@ func (f *Formatter) lineIDAttribute(line int) string { if !f.linkableLineNumbers { return "" } - return fmt.Sprintf(" id=\"%s%d\"", f.lineNumbersIDPrefix, line) + return fmt.Sprintf(" id=\"%s\"", f.lineID(line)) +} + +func (f *Formatter) lineTitleWithLinkIfNeeded(lineDigits, line int) string { + title := fmt.Sprintf("%*d", lineDigits, line) + if !f.linkableLineNumbers { + return title + } + return fmt.Sprintf("%s", f.lineID(line), title) +} + +func (f *Formatter) lineID(line int) string { + return fmt.Sprintf("%s%d", f.lineNumbersIDPrefix, line) } func (f *Formatter) shouldHighlight(highlightIndex, line int) (bool, bool) { @@ -366,8 +378,12 @@ func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error { if tt == chroma.Background { continue } + class := f.class(tt) + if class == "" { + continue + } styles := css[tt] - if _, err := fmt.Fprintf(w, "/* %s */ .%schroma .%s { %s }\n", tt, f.prefix, f.class(tt), styles); err != nil { + if _, err := fmt.Fprintf(w, "/* %s */ .%schroma .%s { %s }\n", tt, f.prefix, class, styles); err != nil { return err } } diff --git a/backend/vendor/github.com/alecthomas/chroma/go.mod b/backend/vendor/github.com/alecthomas/chroma/go.mod index 307b4fff..3baf1cb5 100644 --- a/backend/vendor/github.com/alecthomas/chroma/go.mod +++ b/backend/vendor/github.com/alecthomas/chroma/go.mod @@ -5,13 +5,14 @@ go 1.13 require ( github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 // indirect - github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae + github.com/alecthomas/kong v0.2.4 github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 // indirect github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 - github.com/dlclark/regexp2 v1.1.6 - github.com/mattn/go-colorable v0.0.9 - github.com/mattn/go-isatty v0.0.4 + github.com/dlclark/regexp2 v1.4.0 + github.com/mattn/go-colorable v0.1.6 + github.com/mattn/go-isatty v0.0.12 + github.com/pkg/errors v0.9.1 // indirect github.com/sergi/go-diff v1.0.0 // indirect github.com/stretchr/testify v1.3.0 // indirect - golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35 // indirect + golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 // indirect ) diff --git a/backend/vendor/github.com/alecthomas/chroma/go.sum b/backend/vendor/github.com/alecthomas/chroma/go.sum index 82643a3c..12000b74 100644 --- a/backend/vendor/github.com/alecthomas/chroma/go.sum +++ b/backend/vendor/github.com/alecthomas/chroma/go.sum @@ -2,8 +2,8 @@ github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= 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 h1:C4Q9m+oXOxcSWwYk9XzzafY2xAVAaeubZbUHJkw3PlY= -github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI= +github.com/alecthomas/kong v0.2.4 h1:Y0ZBCHAvHhTHw7FFJ2FzCAAG4pkbTgA45nc7BpMhDNk= +github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= 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/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= @@ -11,23 +11,24 @@ github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9 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/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/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E= +github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35 h1:YAFjXN64LMvktoUZH9zgY4lGc/msGN7HQfoSuKCgaDU= -golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY= +golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/backend/vendor/github.com/alecthomas/chroma/iterator.go b/backend/vendor/github.com/alecthomas/chroma/iterator.go index c8845a1f..d5175de8 100644 --- a/backend/vendor/github.com/alecthomas/chroma/iterator.go +++ b/backend/vendor/github.com/alecthomas/chroma/iterator.go @@ -4,7 +4,7 @@ import "strings" // An Iterator across tokens. // -// nil will be returned at the end of the Token stream. +// EOF 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 diff --git a/backend/vendor/github.com/alecthomas/chroma/lexer.go b/backend/vendor/github.com/alecthomas/chroma/lexer.go index 1269d338..fe625198 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexer.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexer.go @@ -2,6 +2,7 @@ package chroma import ( "fmt" + "strings" ) var ( @@ -98,9 +99,11 @@ type Lexer interface { // 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 } +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 strings.ToLower(l[i].Config().Name) < strings.ToLower(l[j].Config().Name) +} // PrioritisedLexers is a slice of lexers sortable by priority. type PrioritisedLexers []Lexer diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/README.md b/backend/vendor/github.com/alecthomas/chroma/lexers/README.md index 2421710e..b4ed292b 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/README.md +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/README.md @@ -3,6 +3,9 @@ The tests in this directory feed a known input `testdata/.actual` into the parser for `` and check that its output matches `.exported`. +It is also possible to perform several tests on a same parser ``, by placing know inputs `*.actual` into a +directory `testdata//`. + ## Running the tests Run the tests as normal: diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/abap.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/abap.go index 61c294e0..268aa6a5 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/a/abap.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/abap.go @@ -6,7 +6,7 @@ import ( ) // ABAP lexer. -var Abap = internal.Register(MustNewLexer( +var Abap = internal.Register(MustNewLazyLexer( &Config{ Name: "ABAP", Aliases: []string{"abap"}, @@ -14,7 +14,11 @@ var Abap = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-abap"}, CaseInsensitive: true, }, - Rules{ + abapRules, +)) + +func abapRules() Rules { + return Rules{ "common": { {`\s+`, Text, nil}, {`^\*.*$`, CommentSingle, nil}, @@ -52,5 +56,5 @@ var Abap = internal.Register(MustNewLexer( {`[/;:()\[\],.]`, Punctuation, nil}, {`(!)(\w+)`, ByGroups(Operator, Name), nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/abnf.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/abnf.go index ff29aed2..85c47afc 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/a/abnf.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/abnf.go @@ -6,14 +6,18 @@ import ( ) // Abnf lexer. -var Abnf = internal.Register(MustNewLexer( +var Abnf = internal.Register(MustNewLazyLexer( &Config{ Name: "ABNF", Aliases: []string{"abnf"}, Filenames: []string{"*.abnf"}, MimeTypes: []string{"text/x-abnf"}, }, - Rules{ + abnfRules, +)) + +func abnfRules() Rules { + return Rules{ "root": { {`;.*$`, CommentSingle, nil}, {`(%[si])?"[^"]*"`, Literal, nil}, @@ -34,5 +38,5 @@ var Abnf = internal.Register(MustNewLexer( {`\s+`, Text, nil}, {`.`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/actionscript.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/actionscript.go index 43d38521..df55d6da 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/a/actionscript.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/actionscript.go @@ -6,7 +6,7 @@ import ( ) // Actionscript lexer. -var Actionscript = internal.Register(MustNewLexer( +var Actionscript = internal.Register(MustNewLazyLexer( &Config{ Name: "ActionScript", Aliases: []string{"as", "actionscript"}, @@ -15,7 +15,11 @@ var Actionscript = internal.Register(MustNewLexer( NotMultiline: true, DotAll: true, }, - Rules{ + actionscriptRules, +)) + +func actionscriptRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`//.*?\n`, CommentSingle, nil}, @@ -35,5 +39,5 @@ var Actionscript = internal.Register(MustNewLexer( {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/actionscript3.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/actionscript3.go index 3404bd55..45596dcc 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/a/actionscript3.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/actionscript3.go @@ -6,7 +6,7 @@ import ( ) // Actionscript 3 lexer. -var Actionscript3 = internal.Register(MustNewLexer( +var Actionscript3 = internal.Register(MustNewLazyLexer( &Config{ Name: "ActionScript 3", Aliases: []string{"as3", "actionscript3"}, @@ -14,7 +14,11 @@ var Actionscript3 = internal.Register(MustNewLexer( MimeTypes: []string{"application/x-actionscript3", "text/x-actionscript3", "text/actionscript3"}, DotAll: true, }, - Rules{ + actionscript3Rules, +)) + +func actionscript3Rules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`(function\s+)([$a-zA-Z_]\w*)(\s*)(\()`, ByGroups(KeywordDeclaration, NameFunction, Text, Operator), Push("funcparams")}, @@ -52,5 +56,5 @@ var Actionscript3 = internal.Register(MustNewLexer( {`,`, Operator, Pop(1)}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/ada.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/ada.go index d9b34e3c..91672712 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/a/ada.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/ada.go @@ -6,7 +6,7 @@ import ( ) // Ada lexer. -var Ada = internal.Register(MustNewLexer( +var Ada = internal.Register(MustNewLazyLexer( &Config{ Name: "Ada", Aliases: []string{"ada", "ada95", "ada2005"}, @@ -14,7 +14,11 @@ var Ada = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-ada"}, CaseInsensitive: true, }, - Rules{ + adaRules, +)) + +func adaRules() Rules { + return Rules{ "root": { {`[^\S\n]+`, Text, nil}, {`--.*?\n`, CommentSingle, nil}, @@ -110,5 +114,5 @@ var Ada = internal.Register(MustNewLexer( {`\)`, Punctuation, Pop(1)}, Include("root"), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/al.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/al.go new file mode 100644 index 00000000..d7016444 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/al.go @@ -0,0 +1,48 @@ +package a + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Al lexer. +var Al = internal.Register(MustNewLazyLexer( + &Config{ + Name: "AL", + Aliases: []string{"al"}, + Filenames: []string{"*.al", "*.dal"}, + MimeTypes: []string{"text/x-al"}, + DotAll: true, + CaseInsensitive: true, + }, + alRules, +)) + +// https://github.com/microsoft/AL/blob/master/grammar/alsyntax.tmlanguage +func alRules() Rules { + return Rules{ + "root": { + {`\s+`, TextWhitespace, nil}, + {`(?s)\/\*.*?\\*\*\/`, CommentMultiline, nil}, + {`(?s)//.*?\n`, CommentSingle, nil}, + {`\"([^\"])*\"`, Text, nil}, + {`'([^'])*'`, LiteralString, nil}, + {`\b(?i:(ARRAY|ASSERTERROR|BEGIN|BREAK|CASE|DO|DOWNTO|ELSE|END|EVENT|EXIT|FOR|FOREACH|FUNCTION|IF|IMPLEMENTS|IN|INDATASET|INTERFACE|INTERNAL|LOCAL|OF|PROCEDURE|PROGRAM|PROTECTED|REPEAT|RUNONCLIENT|SECURITYFILTERING|SUPPRESSDISPOSE|TEMPORARY|THEN|TO|TRIGGER|UNTIL|VAR|WHILE|WITH|WITHEVENTS))\b`, Keyword, nil}, + {`\b(?i:(AND|DIV|MOD|NOT|OR|XOR))\b`, OperatorWord, nil}, + {`\b(?i:(AVERAGE|CONST|COUNT|EXIST|FIELD|FILTER|LOOKUP|MAX|MIN|ORDER|SORTING|SUM|TABLEDATA|UPPERLIMIT|WHERE|ASCENDING|DESCENDING))\b`, Keyword, nil}, + // Added new objects types of BC 2021 wave 1 (REPORTEXTENSION|Entitlement|PermissionSet|PermissionSetExtension) + {`\b(?i:(CODEUNIT|PAGE|PAGEEXTENSION|PAGECUSTOMIZATION|DOTNET|ENUM|ENUMEXTENSION|VALUE|QUERY|REPORT|TABLE|TABLEEXTENSION|XMLPORT|PROFILE|CONTROLADDIN|REPORTEXTENSION|Entitlement|PermissionSet|PermissionSetExtension))\b`, Keyword, nil}, + {`\b(?i:(Action|Array|Automation|BigInteger|BigText|Blob|Boolean|Byte|Char|ClientType|Code|Codeunit|CompletionTriggerErrorLevel|ConnectionType|Database|DataClassification|DataScope|Date|DateFormula|DateTime|Decimal|DefaultLayout|Dialog|Dictionary|DotNet|DotNetAssembly|DotNetTypeDeclaration|Duration|Enum|ErrorInfo|ErrorType|ExecutionContext|ExecutionMode|FieldClass|FieldRef|FieldType|File|FilterPageBuilder|Guid|InStream|Integer|Joker|KeyRef|List|ModuleDependencyInfo|ModuleInfo|None|Notification|NotificationScope|ObjectType|Option|OutStream|Page|PageResult|Query|Record|RecordId|RecordRef|Report|ReportFormat|SecurityFilter|SecurityFiltering|Table|TableConnectionType|TableFilter|TestAction|TestField|TestFilterField|TestPage|TestPermissions|TestRequestPage|Text|TextBuilder|TextConst|TextEncoding|Time|TransactionModel|TransactionType|Variant|Verbosity|Version|XmlPort|HttpContent|HttpHeaders|HttpClient|HttpRequestMessage|HttpResponseMessage|JsonToken|JsonValue|JsonArray|JsonObject|View|Views|XmlAttribute|XmlAttributeCollection|XmlComment|XmlCData|XmlDeclaration|XmlDocument|XmlDocumentType|XmlElement|XmlNamespaceManager|XmlNameTable|XmlNode|XmlNodeList|XmlProcessingInstruction|XmlReadOptions|XmlText|XmlWriteOptions|WebServiceActionContext|WebServiceActionResultCode|SessionSettings))\b`, Keyword, nil}, + {`\b([<>]=|<>|<|>)\b?`, Operator, nil}, + {`\b(\-|\+|\/|\*)\b`, Operator, nil}, + {`\s*(\:=|\+=|-=|\/=|\*=)\s*?`, Operator, nil}, + {`\b(?i:(ADDFIRST|ADDLAST|ADDAFTER|ADDBEFORE|ACTION|ACTIONS|AREA|ASSEMBLY|CHARTPART|CUEGROUP|CUSTOMIZES|COLUMN|DATAITEM|DATASET|ELEMENTS|EXTENDS|FIELD|FIELDGROUP|FIELDATTRIBUTE|FIELDELEMENT|FIELDGROUPS|FIELDS|FILTER|FIXED|GRID|GROUP|MOVEAFTER|MOVEBEFORE|KEY|KEYS|LABEL|LABELS|LAYOUT|MODIFY|MOVEFIRST|MOVELAST|MOVEBEFORE|MOVEAFTER|PART|REPEATER|USERCONTROL|REQUESTPAGE|SCHEMA|SEPARATOR|SYSTEMPART|TABLEELEMENT|TEXTATTRIBUTE|TEXTELEMENT|TYPE))\b`, Keyword, nil}, + {`\s*[(\.\.)&\|]\s*`, Operator, nil}, + {`\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b`, LiteralNumber, nil}, + {`[;:,]`, Punctuation, nil}, + {`#[ \t]*(if|else|elif|endif|define|undef|region|endregion|pragma)\b.*?\n`, CommentPreproc, nil}, + {`\w+`, Text, nil}, + {`.`, Text, nil}, + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/angular2.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/angular2.go index 5258c928..a947edad 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/a/angular2.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/angular2.go @@ -6,14 +6,18 @@ import ( ) // Angular2 lexer. -var Angular2 = internal.Register(MustNewLexer( +var Angular2 = internal.Register(MustNewLazyLexer( &Config{ Name: "Angular2", Aliases: []string{"ng2"}, Filenames: []string{}, MimeTypes: []string{}, }, - Rules{ + angular2Rules, +)) + +func angular2Rules() Rules { + return Rules{ "root": { {`[^{([*#]+`, Other, nil}, {`(\{\{)(\s*)`, ByGroups(CommentPreproc, Text), Push("ngExpression")}, @@ -38,5 +42,5 @@ var Angular2 = internal.Register(MustNewLexer( {`'.*?'`, LiteralString, Pop(1)}, {`[^\s>]+`, LiteralString, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/antlr.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/antlr.go index d7649d4a..c744353f 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/a/antlr.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/antlr.go @@ -6,14 +6,18 @@ import ( ) // ANTLR lexer. -var ANTLR = internal.Register(MustNewLexer( +var ANTLR = internal.Register(MustNewLazyLexer( &Config{ Name: "ANTLR", Aliases: []string{"antlr"}, Filenames: []string{}, MimeTypes: []string{}, }, - Rules{ + antlrRules, +)) + +func antlrRules() Rules { + return Rules{ "whitespace": { {`\s+`, TextWhitespace, nil}, }, @@ -97,5 +101,5 @@ var ANTLR = internal.Register(MustNewLexer( {`(\$[a-zA-Z]+)(\.?)(text|value)?`, ByGroups(NameVariable, Punctuation, NameProperty), nil}, {`(\\\\|\\\]|\\\[|[^\[\]])+`, Other, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/apache.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/apache.go index 6c56a1db..5685eb15 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/a/apache.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/apache.go @@ -6,7 +6,7 @@ import ( ) // Apacheconf lexer. -var Apacheconf = internal.Register(MustNewLexer( +var Apacheconf = internal.Register(MustNewLazyLexer( &Config{ Name: "ApacheConf", Aliases: []string{"apacheconf", "aconf", "apache"}, @@ -14,7 +14,11 @@ var Apacheconf = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-apacheconf"}, CaseInsensitive: true, }, - Rules{ + apacheconfRules, +)) + +func apacheconfRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`(#.*?)$`, Comment, nil}, @@ -34,5 +38,5 @@ var Apacheconf = internal.Register(MustNewLexer( {`"([^"\\]*(?:\\.[^"\\]*)*)"`, LiteralStringDouble, nil}, {`[^\s"\\]+`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/apl.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/apl.go index 820e13b6..6cf1ea05 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/a/apl.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/apl.go @@ -6,14 +6,18 @@ import ( ) // Apl lexer. -var Apl = internal.Register(MustNewLexer( +var Apl = internal.Register(MustNewLazyLexer( &Config{ Name: "APL", Aliases: []string{"apl"}, Filenames: []string{"*.apl"}, MimeTypes: []string{}, }, - Rules{ + aplRules, +)) + +func aplRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`[⍝#].*$`, CommentSingle, nil}, @@ -32,5 +36,5 @@ var Apl = internal.Register(MustNewLexer( {`[⍺⍵⍶⍹∇:]`, NameBuiltinPseudo, nil}, {`[{}]`, KeywordType, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/applescript.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/applescript.go index db83ed0e..b6a53c5f 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/a/applescript.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/applescript.go @@ -6,7 +6,7 @@ import ( ) // Applescript lexer. -var Applescript = internal.Register(MustNewLexer( +var Applescript = internal.Register(MustNewLazyLexer( &Config{ Name: "AppleScript", Aliases: []string{"applescript"}, @@ -14,7 +14,11 @@ var Applescript = internal.Register(MustNewLexer( MimeTypes: []string{}, DotAll: true, }, - Rules{ + applescriptRules, +)) + +func applescriptRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`¬\n`, LiteralStringEscape, nil}, @@ -51,5 +55,5 @@ var Applescript = internal.Register(MustNewLexer( {`[^*(]+`, CommentMultiline, nil}, {`[*(]`, CommentMultiline, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/a/arduino.go b/backend/vendor/github.com/alecthomas/chroma/lexers/a/arduino.go index b0cd8c95..0edbe3f9 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/a/arduino.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/a/arduino.go @@ -6,7 +6,7 @@ import ( ) // Arduino lexer. -var Arduino = internal.Register(MustNewLexer( +var Arduino = internal.Register(MustNewLazyLexer( &Config{ Name: "Arduino", Aliases: []string{"arduino"}, @@ -14,7 +14,11 @@ var Arduino = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-arduino"}, EnsureNL: true, }, - Rules{ + arduinoRules, +)) + +func arduinoRules() Rules { + return 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}, @@ -106,5 +110,5 @@ var Arduino = internal.Register(MustNewLexer( {`^\s*#endif.*?(?+*%\^/!=|])=?`, Operator, Push("slashstartsregex")}, + {`\+\+|--|\|\||&&|in\b|\$|!?~|\|&|(\*\*|[-<>+*%\^/!=|])=?`, Operator, Push("slashstartsregex")}, {`[{(\[;,]`, Punctuation, Push("slashstartsregex")}, {`[})\].]`, Punctuation, nil}, - {`(break|continue|do|while|exit|for|if|else|return)\b`, Keyword, Push("slashstartsregex")}, + {`(break|continue|do|while|exit|for|if|else|return|switch|case|default)\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}, + {`(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gensub|gsub|index|length|match|split|patsplit|sprintf|sub|substr|tolower|toupper|close|fflush|getline|next(file)|print|printf|strftime|systime|mktime|delete|system|strtonum|and|compl|lshift|or|rshift|asorti?|isarray|bindtextdomain|dcn?gettext|@(include|load|namespace))\b`, KeywordReserved, nil}, + {`(ARGC|ARGIND|ARGV|BEGIN(FILE)?|BINMODE|CONVFMT|ENVIRON|END(FILE)?|ERRNO|FIELDWIDTHS|FILENAME|FNR|FPAT|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS|PROCINFO|RLENGTH|RS|RSTART|RT|SUBSEP|TEXTDOMAIN)\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/backend/vendor/github.com/alecthomas/chroma/lexers/b/ballerina.go b/backend/vendor/github.com/alecthomas/chroma/lexers/b/ballerina.go index 91dc9017..d8916d0e 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/b/ballerina.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/b/ballerina.go @@ -6,7 +6,7 @@ import ( ) // Ballerina lexer. -var Ballerina = internal.Register(MustNewLexer( +var Ballerina = internal.Register(MustNewLazyLexer( &Config{ Name: "Ballerina", Aliases: []string{"ballerina"}, @@ -14,7 +14,11 @@ var Ballerina = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-ballerina"}, DotAll: true, }, - Rules{ + ballerinaRules, +)) + +func ballerinaRules() Rules { + return Rules{ "root": { {`[^\S\n]+`, Text, nil}, {`//.*?\n`, CommentSingle, nil}, @@ -42,5 +46,5 @@ var Ballerina = internal.Register(MustNewLexer( "import": { {`[\w.]+`, NameNamespace, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/b/bash.go b/backend/vendor/github.com/alecthomas/chroma/lexers/b/bash.go index 38b3f224..34b1e222 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/b/bash.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/b/bash.go @@ -7,17 +7,27 @@ import ( "github.com/alecthomas/chroma/lexers/internal" ) +// TODO(moorereason): can this be factored away? var bashAnalyserRe = regexp.MustCompile(`(?m)^#!.*/bin/(?:env |)(?:bash|zsh|sh|ksh)`) // Bash lexer. -var Bash = internal.Register(MustNewLexer( +var Bash = internal.Register(MustNewLazyLexer( &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"}, + Filenames: []string{"*.sh", "*.ksh", "*.bash", "*.ebuild", "*.eclass", ".env", "*.env", "*.exheres-0", "*.exlib", "*.zsh", "*.zshrc", ".bashrc", "bashrc", ".bash_*", "bash_*", "zshrc", ".zshrc", "PKGBUILD"}, MimeTypes: []string{"application/x-sh", "application/x-shellscript"}, }, - Rules{ + bashRules, +).SetAnalyser(func(text string) float32 { + if bashAnalyserRe.FindString(text) != "" { + return 1.0 + } + return 0.0 +})) + +func bashRules() Rules { + return Rules{ "root": { Include("basic"), {"`", LiteralStringBacktick, Push("backticks")}, @@ -36,7 +46,7 @@ var Bash = internal.Register(MustNewLexer( {`\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}, + {`#.*(\S|$)`, CommentSingle, nil}, {`\\[\w\W]`, LiteralStringEscape, nil}, {`(\b\w+)(\s*)(\+?=)`, ByGroups(NameVariable, Text, Operator), nil}, {`[\[\]{}()=]`, Operator, nil}, @@ -86,10 +96,5 @@ var Bash = internal.Register(MustNewLexer( {"`", LiteralStringBacktick, Pop(1)}, Include("root"), }, - }, -).SetAnalyser(func(text string) float32 { - if bashAnalyserRe.FindString(text) != "" { - return 1.0 } - return 0.0 -})) +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/b/batch.go b/backend/vendor/github.com/alecthomas/chroma/lexers/b/batch.go index dc6ce524..f7a86776 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/b/batch.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/b/batch.go @@ -6,7 +6,7 @@ import ( ) // Batchfile lexer. -var Batchfile = internal.Register(MustNewLexer( +var Batchfile = internal.Register(MustNewLazyLexer( &Config{ Name: "Batchfile", Aliases: []string{"bat", "batch", "dosbatch", "winbatch"}, @@ -14,7 +14,11 @@ var Batchfile = internal.Register(MustNewLexer( MimeTypes: []string{"application/x-dos-batch"}, CaseInsensitive: true, }, - Rules{ + batchfileRules, +)) + +func batchfileRules() Rules { + return 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")}, @@ -190,5 +194,5 @@ var Batchfile = internal.Register(MustNewLexer( {`else(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])`, Keyword, Pop(1)}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/b/bibtex.go b/backend/vendor/github.com/alecthomas/chroma/lexers/b/bibtex.go index 1d76b1d8..d6a0ae33 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/b/bibtex.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/b/bibtex.go @@ -6,7 +6,7 @@ import ( ) // Bibtex lexer. -var Bibtex = internal.Register(MustNewLexer( +var Bibtex = internal.Register(MustNewLazyLexer( &Config{ Name: "BibTeX", Aliases: []string{"bib", "bibtex"}, @@ -15,7 +15,11 @@ var Bibtex = internal.Register(MustNewLexer( NotMultiline: true, CaseInsensitive: true, }, - Rules{ + bibtexRules, +)) + +func bibtexRules() Rules { + return Rules{ "root": { Include("whitespace"), {`@comment`, Comment, nil}, @@ -72,5 +76,5 @@ var Bibtex = internal.Register(MustNewLexer( "whitespace": { {`\s+`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/b/blitz.go b/backend/vendor/github.com/alecthomas/chroma/lexers/b/blitz.go index 5d5ffc85..119f96b0 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/b/blitz.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/b/blitz.go @@ -6,7 +6,7 @@ import ( ) // Blitzbasic lexer. -var Blitzbasic = internal.Register(MustNewLexer( +var Blitzbasic = internal.Register(MustNewLazyLexer( &Config{ Name: "BlitzBasic", Aliases: []string{"blitzbasic", "b3d", "bplus"}, @@ -14,7 +14,11 @@ var Blitzbasic = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-bb"}, CaseInsensitive: true, }, - Rules{ + blitzbasicRules, +)) + +func blitzbasicRules() Rules { + return Rules{ "root": { {`[ \t]+`, Text, nil}, {`;.*?\n`, CommentSingle, nil}, @@ -44,5 +48,5 @@ var Blitzbasic = internal.Register(MustNewLexer( {`"C?`, LiteralStringDouble, Pop(1)}, {`[^"]+`, LiteralStringDouble, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/b/bnf.go b/backend/vendor/github.com/alecthomas/chroma/lexers/b/bnf.go index 5123a45a..dcf7360c 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/b/bnf.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/b/bnf.go @@ -6,19 +6,23 @@ import ( ) // Bnf lexer. -var Bnf = internal.Register(MustNewLexer( +var Bnf = internal.Register(MustNewLazyLexer( &Config{ Name: "BNF", Aliases: []string{"bnf"}, Filenames: []string{"*.bnf"}, MimeTypes: []string{"text/x-bnf"}, }, - Rules{ + bnfRules, +)) + +func bnfRules() Rules { + return Rules{ "root": { {`(<)([ -;=?-~]+)(>)`, ByGroups(Punctuation, NameClass, Punctuation), nil}, {`::=`, Operator, nil}, {`[^<>:]+`, Text, nil}, {`.`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/b/brainfuck.go b/backend/vendor/github.com/alecthomas/chroma/lexers/b/brainfuck.go index 6fac5f5e..d35e9c6d 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/b/brainfuck.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/b/brainfuck.go @@ -6,14 +6,18 @@ import ( ) // Brainfuck lexer. -var Brainfuck = internal.Register(MustNewLexer( +var Brainfuck = internal.Register(MustNewLazyLexer( &Config{ Name: "Brainfuck", Aliases: []string{"brainfuck", "bf"}, Filenames: []string{"*.bf", "*.b"}, MimeTypes: []string{"application/x-brainfuck"}, }, - Rules{ + brainfuckRules, +)) + +func brainfuckRules() Rules { + return Rules{ "common": { {`[.,]+`, NameTag, nil}, {`[+-]+`, NameBuiltin, nil}, @@ -30,5 +34,5 @@ var Brainfuck = internal.Register(MustNewLexer( {`\]`, Keyword, Pop(1)}, Include("common"), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/c.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/c.go index df2c0faa..3698c4f2 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/c.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/c.go @@ -6,14 +6,19 @@ import ( ) // C lexer. -var C = internal.Register(MustNewLexer( +var C = internal.Register(MustNewLazyLexer( &Config{ Name: "C", Aliases: []string{"c"}, - Filenames: []string{"*.c", "*.h", "*.idc"}, - MimeTypes: []string{"text/x-chdr", "text/x-csrc"}, + Filenames: []string{"*.c", "*.h", "*.idc", "*.x[bp]m"}, + MimeTypes: []string{"text/x-chdr", "text/x-csrc", "image/x-xbitmap", "image/x-xpixmap"}, + EnsureNL: true, }, - Rules{ + cRules, +)) + +func cRules() Rules { + return Rules{ "whitespace": { {`^#if\s+0`, CommentPreproc, Push("if0")}, {`^#`, CommentPreproc, Push("macro")}, @@ -38,7 +43,7 @@ var C = internal.Register(MustNewLexer( {`[~!%^&*+=|?:<>/-]`, 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}, + {`(bool|int|long|float|short|double|char((8|16|32)_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`, `wchar_t`, `w64`, `unaligned`, `raise`, `noop`, `identifier`, `forceinline`, `assume`), KeywordReserved, nil}, @@ -87,5 +92,5 @@ var C = internal.Register(MustNewLexer( {`^\s*#endif.*?(?\]`, NameDecorator, Push("matcher")}, + // These cannot have matchers but may have things that look like + // matchers in their arguments, so we just parse as a subdirective. + {`try_files`, Keyword, Push("subdirective")}, + // These are special, they can nest more directives + {`handle_errors|handle|route|handle_path|not`, Keyword, Push("nested_directive")}, + // Any other directive + {`[^\s#]+`, Keyword, Push("directive")}, + Include("base"), + }, + "matcher": { + {`\{`, Punctuation, Push("block")}, + // Not can be one-liner + {`not`, Keyword, Push("deep_not_matcher")}, + // Any other same-line matcher + {`[^\s#]+`, Keyword, Push("arguments")}, + // Terminators + {`\n`, Text, Pop(1)}, + {`\}`, Punctuation, Pop(1)}, + Include("base"), + }, + "block": { + {`\}`, Punctuation, Pop(2)}, + // Not can be one-liner + {`not`, Keyword, Push("not_matcher")}, + // Any other subdirective + {`[^\s#]+`, Keyword, Push("subdirective")}, + Include("base"), + }, + "nested_block": { + {`\}`, Punctuation, Pop(2)}, + // Matcher definition + {`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")}, + // Something that starts with literally < is probably a docs stub + {`\<[^#]+\>`, Keyword, Push("nested_directive")}, + // Any other directive + {`[^\s#]+`, Keyword, Push("nested_directive")}, + Include("base"), + }, + "not_matcher": { + {`\}`, Punctuation, Pop(2)}, + {`\{(?=\s)`, Punctuation, Push("block")}, + {`[^\s#]+`, Keyword, Push("arguments")}, + {`\s+`, Text, nil}, + }, + "deep_not_matcher": { + {`\}`, Punctuation, Pop(2)}, + {`\{(?=\s)`, Punctuation, Push("block")}, + {`[^\s#]+`, Keyword, Push("deep_subdirective")}, + {`\s+`, Text, nil}, + }, + "directive": { + {`\{(?=\s)`, Punctuation, Push("block")}, + Include("matcher_token"), + Include("comments_pop_1"), + {`\n`, Text, Pop(1)}, + Include("base"), + }, + "nested_directive": { + {`\{(?=\s)`, Punctuation, Push("nested_block")}, + Include("matcher_token"), + Include("comments_pop_1"), + {`\n`, Text, Pop(1)}, + Include("base"), + }, + "subdirective": { + {`\{(?=\s)`, Punctuation, Push("block")}, + Include("comments_pop_1"), + {`\n`, Text, Pop(1)}, + Include("base"), + }, + "arguments": { + {`\{(?=\s)`, Punctuation, Push("block")}, + Include("comments_pop_2"), + {`\\\n`, Text, nil}, // Skip escaped newlines + {`\n`, Text, Pop(2)}, + Include("base"), + }, + "deep_subdirective": { + {`\{(?=\s)`, Punctuation, Push("block")}, + Include("comments_pop_3"), + {`\n`, Text, Pop(3)}, + Include("base"), + }, + "matcher_token": { + {`@[^\s]+`, NameDecorator, Push("arguments")}, // Named matcher + {`/[^\s]+`, NameDecorator, Push("arguments")}, // Path matcher + {`\*`, NameDecorator, Push("arguments")}, // Wildcard path matcher + {`\[\\]`, NameDecorator, Push("arguments")}, // Matcher token stub for docs + }, + "comments": { + {`^#.*\n`, CommentSingle, nil}, // Comment at start of line + {`\s+#.*\n`, CommentSingle, nil}, // Comment preceded by whitespace + }, + "comments_pop_1": { + {`^#.*\n`, CommentSingle, Pop(1)}, // Comment at start of line + {`\s+#.*\n`, CommentSingle, Pop(1)}, // Comment preceded by whitespace + }, + "comments_pop_2": { + {`^#.*\n`, CommentSingle, Pop(2)}, // Comment at start of line + {`\s+#.*\n`, CommentSingle, Pop(2)}, // Comment preceded by whitespace + }, + "comments_pop_3": { + {`^#.*\n`, CommentSingle, Pop(3)}, // Comment at start of line + {`\s+#.*\n`, CommentSingle, Pop(3)}, // Comment preceded by whitespace + }, + "base": { + Include("comments"), + {`(on|off|first|last|before|after|internal|strip_prefix|strip_suffix|replace)\b`, NameConstant, nil}, + {`(https?://)?([a-z0-9.-]+)(:)([0-9]+)`, ByGroups(Name, Name, Punctuation, LiteralNumberInteger), nil}, + {`[a-z-]+/[a-z-+]+`, LiteralString, nil}, + {`[0-9]+[km]?\b`, LiteralNumberInteger, nil}, + {`\{[\w+.\$-]+\}`, LiteralStringEscape, nil}, // Placeholder + {`\[(?=[^#{}$]+\])`, Punctuation, nil}, + {`\]|\|`, Punctuation, nil}, + {`[^\s#{}$\]]+`, LiteralString, nil}, + {`/[^\s#]*`, Name, nil}, + {`\s+`, Text, nil}, + }, + } +} + +// Caddyfile lexer. +var Caddyfile = internal.Register(MustNewLazyLexer( + &Config{ + Name: "Caddyfile", + Aliases: []string{"caddyfile", "caddy"}, + Filenames: []string{"Caddyfile*"}, + MimeTypes: []string{}, + }, + caddyfileRules, +)) + +func caddyfileRules() Rules { + return Rules{ + "root": { + Include("comments"), + // Global options block + {`^\s*(\{)\s*$`, ByGroups(Punctuation), Push("globals")}, + // Snippets + {`(\([^\s#]+\))(\s*)(\{)`, ByGroups(NameVariableAnonymous, Text, Punctuation), Push("snippet")}, + // Site label + {`[^#{(\s,]+`, GenericHeading, Push("label")}, + // Site label with placeholder + {`\{[\w+.\$-]+\}`, LiteralStringEscape, Push("label")}, + {`\s+`, Text, nil}, + }, + "globals": { + {`\}`, Punctuation, Pop(1)}, + {`[^\s#]+`, Keyword, Push("directive")}, + Include("base"), + }, + "snippet": { + {`\}`, Punctuation, Pop(1)}, + // Matcher definition + {`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")}, + // Any directive + {`[^\s#]+`, Keyword, Push("directive")}, + Include("base"), + }, + "label": { + // Allow multiple labels, comma separated, newlines after + // a comma means another label is coming + {`,\s*\n?`, Text, nil}, + {` `, Text, nil}, + // Site label with placeholder + {`\{[\w+.\$-]+\}`, LiteralStringEscape, nil}, + // Site label + {`[^#{(\s,]+`, GenericHeading, nil}, + // Comment after non-block label (hack because comments end in \n) + {`#.*\n`, CommentSingle, Push("site_block")}, + // Note: if \n, we'll never pop out of the site_block, it's valid + {`\{(?=\s)|\n`, Punctuation, Push("site_block")}, + }, + "site_block": { + {`\}`, Punctuation, Pop(2)}, + Include("site_block_common"), + }, + }.Merge(caddyfileCommonRules()) +} + +// Caddyfile directive-only lexer. +var CaddyfileDirectives = internal.Register(MustNewLazyLexer( + &Config{ + Name: "Caddyfile Directives", + Aliases: []string{"caddyfile-directives", "caddyfile-d", "caddy-d"}, + Filenames: []string{}, + MimeTypes: []string{}, + }, + caddyfileDirectivesRules, +)) + +func caddyfileDirectivesRules() Rules { + return Rules{ + // Same as "site_block" in Caddyfile + "root": { + Include("site_block_common"), + }, + }.Merge(caddyfileCommonRules()) +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/capnproto.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/capnproto.go index 0f9d03c6..ec0d892c 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/capnproto.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/capnproto.go @@ -6,14 +6,18 @@ import ( ) // Cap'N'Proto Proto lexer. -var CapNProto = internal.Register(MustNewLexer( +var CapNProto = internal.Register(MustNewLazyLexer( &Config{ Name: "Cap'n Proto", Aliases: []string{"capnp"}, Filenames: []string{"*.capnp"}, MimeTypes: []string{}, }, - Rules{ + capNProtoRules, +)) + +func capNProtoRules() Rules { + return Rules{ "root": { {`#.*?$`, CommentSingle, nil}, {`@[0-9a-zA-Z]*`, NameDecorator, nil}, @@ -57,5 +61,5 @@ var CapNProto = internal.Register(MustNewLexer( {`[])]`, NameAttribute, Pop(1)}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/ceylon.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/ceylon.go index 07324ca1..9d424d4b 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/ceylon.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/ceylon.go @@ -6,7 +6,7 @@ import ( ) // Ceylon lexer. -var Ceylon = internal.Register(MustNewLexer( +var Ceylon = internal.Register(MustNewLazyLexer( &Config{ Name: "Ceylon", Aliases: []string{"ceylon"}, @@ -14,7 +14,11 @@ var Ceylon = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-ceylon"}, DotAll: true, }, - Rules{ + ceylonRules, +)) + +func ceylonRules() Rules { + return Rules{ "root": { {`^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil}, {`[^\S\n]+`, Text, nil}, @@ -59,5 +63,5 @@ var Ceylon = internal.Register(MustNewLexer( {`\*/`, CommentMultiline, Pop(1)}, {`[*/]`, CommentMultiline, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go index f96252fa..f3050346 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go @@ -6,14 +6,18 @@ import ( ) // Cfengine3 lexer. -var Cfengine3 = internal.Register(MustNewLexer( +var Cfengine3 = internal.Register(MustNewLazyLexer( &Config{ Name: "CFEngine3", Aliases: []string{"cfengine3", "cf3"}, Filenames: []string{"*.cf"}, MimeTypes: []string{}, }, - Rules{ + cfengine3Rules, +)) + +func cfengine3Rules() Rules { + return Rules{ "root": { {`#.*?\n`, Comment, nil}, {`(body)(\s+)(\S+)(\s+)(control)`, ByGroups(Keyword, Text, Keyword, Text, Keyword), nil}, @@ -52,5 +56,5 @@ var Cfengine3 = internal.Register(MustNewLexer( {`\w+`, NameVariable, nil}, {`\s+`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go index d2aa50db..58db9aac 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go @@ -6,7 +6,7 @@ import ( ) // Chaiscript lexer. -var Chaiscript = internal.Register(MustNewLexer( +var Chaiscript = internal.Register(MustNewLazyLexer( &Config{ Name: "ChaiScript", Aliases: []string{"chai", "chaiscript"}, @@ -14,7 +14,11 @@ var Chaiscript = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-chaiscript", "application/x-chaiscript"}, DotAll: true, }, - Rules{ + chaiscriptRules, +)) + +func chaiscriptRules() Rules { + return Rules{ "commentsandwhitespace": { {`\s+`, Text, nil}, {`//.*?\n`, CommentSingle, nil}, @@ -59,5 +63,5 @@ var Chaiscript = internal.Register(MustNewLexer( {`[^\\"$]+`, LiteralStringDouble, nil}, {`"`, LiteralStringDouble, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go index b2cb9c40..bd5fb9d9 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go @@ -7,14 +7,18 @@ import ( ) // Cheetah lexer. -var Cheetah = internal.Register(MustNewLexer( +var Cheetah = internal.Register(MustNewLazyLexer( &Config{ Name: "Cheetah", Aliases: []string{"cheetah", "spitfire"}, Filenames: []string{"*.tmpl", "*.spt"}, MimeTypes: []string{"application/x-cheetah", "application/x-spitfire"}, }, - Rules{ + cheetahRules, +)) + +func cheetahRules() Rules { + return Rules{ "root": { {`(##[^\n]*)$`, ByGroups(Comment), nil}, {`#[*](.|\n)*?[*]#`, Comment, nil}, @@ -33,5 +37,5 @@ var Cheetah = internal.Register(MustNewLexer( `, Other, nil}, {`\s+`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cl.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cl.go index fdc97297..bb162734 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cl.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cl.go @@ -230,7 +230,7 @@ var ( ) // Common Lisp lexer. -var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLexer( +var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLazyLexer( &Config{ Name: "Common Lisp", Aliases: []string{"common-lisp", "cl", "lisp"}, @@ -238,7 +238,19 @@ var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLexer( MimeTypes: []string{"text/x-common-lisp"}, CaseInsensitive: true, }, - Rules{ + commonLispRules, +), TypeMapping{ + {NameVariable, NameFunction, clBuiltinFunctions}, + {NameVariable, Keyword, clSpecialForms}, + {NameVariable, NameBuiltin, clMacros}, + {NameVariable, Keyword, clLambdaListKeywords}, + {NameVariable, Keyword, clDeclarations}, + {NameVariable, KeywordType, clBuiltinTypes}, + {NameVariable, NameClass, clBuiltinClasses}, +})) + +func commonLispRules() Rules { + return Rules{ "root": { Default(Push("body")), }, @@ -294,13 +306,5 @@ var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLexer( {`\(`, 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/backend/vendor/github.com/alecthomas/chroma/lexers/c/clojure.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/clojure.go index e63752a5..f99f906c 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/clojure.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/clojure.go @@ -6,14 +6,18 @@ import ( ) // Clojure lexer. -var Clojure = internal.Register(MustNewLexer( +var Clojure = internal.Register(MustNewLazyLexer( &Config{ Name: "Clojure", Aliases: []string{"clojure", "clj"}, Filenames: []string{"*.clj"}, MimeTypes: []string{"text/x-clojure", "application/x-clojure"}, }, - Rules{ + clojureRules, +)) + +func clojureRules() Rules { + return Rules{ "root": { {`;.*$`, CommentSingle, nil}, {`[,\s]+`, Text, nil}, @@ -34,5 +38,5 @@ var Clojure = internal.Register(MustNewLexer( {`(\{|\})`, Punctuation, nil}, {`(\(|\))`, Punctuation, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cmake.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cmake.go index 163f17d9..0e0708db 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cmake.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cmake.go @@ -6,14 +6,18 @@ import ( ) // Cmake lexer. -var Cmake = internal.Register(MustNewLexer( +var Cmake = internal.Register(MustNewLazyLexer( &Config{ Name: "CMake", Aliases: []string{"cmake"}, Filenames: []string{"*.cmake", "CMakeLists.txt"}, MimeTypes: []string{"text/x-cmake"}, }, - Rules{ + cmakeRules, +)) + +func cmakeRules() Rules { + return Rules{ "root": { {`\b(\w+)([ \t]*)(\()`, ByGroups(NameBuiltin, Text, Punctuation), Push("args")}, Include("keywords"), @@ -40,5 +44,5 @@ var Cmake = internal.Register(MustNewLexer( {`[ \t]+`, Text, nil}, {`#.*\n`, Comment, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cobol.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cobol.go index e9ae0bb7..8b2f6d9b 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cobol.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cobol.go @@ -6,7 +6,7 @@ import ( ) // Cobol lexer. -var Cobol = internal.Register(MustNewLexer( +var Cobol = internal.Register(MustNewLazyLexer( &Config{ Name: "COBOL", Aliases: []string{"cobol"}, @@ -14,7 +14,11 @@ var Cobol = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-cobol"}, CaseInsensitive: true, }, - Rules{ + cobolRules, +)) + +func cobolRules() Rules { + return Rules{ "root": { Include("comment"), Include("strings"), @@ -47,5 +51,5 @@ var Cobol = internal.Register(MustNewLexer( {`[+-]?\d*\.\d+(E[-+]?\d+)?`, LiteralNumberFloat, nil}, {`[+-]?\d+\.\d*(E[-+]?\d+)?`, LiteralNumberFloat, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/coffee.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/coffee.go index e402b8f2..381a8fed 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/coffee.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/coffee.go @@ -6,7 +6,7 @@ import ( ) // Coffeescript lexer. -var Coffeescript = internal.Register(MustNewLexer( +var Coffeescript = internal.Register(MustNewLazyLexer( &Config{ Name: "CoffeeScript", Aliases: []string{"coffee-script", "coffeescript", "coffee"}, @@ -15,7 +15,11 @@ var Coffeescript = internal.Register(MustNewLexer( NotMultiline: true, DotAll: true, }, - Rules{ + coffeescriptRules, +)) + +func coffeescriptRules() Rules { + return Rules{ "commentsandwhitespace": { {`\s+`, Text, nil}, {`###[^#].*?###`, CommentMultiline, nil}, @@ -87,5 +91,5 @@ var Coffeescript = internal.Register(MustNewLexer( {`#|\\.|\'|"`, LiteralString, nil}, Include("strings"), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/coldfusion.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/coldfusion.go index 2f12472c..bc28bc3b 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/coldfusion.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/coldfusion.go @@ -6,7 +6,7 @@ import ( ) // Cfstatement lexer. -var Cfstatement = internal.Register(MustNewLexer( +var Cfstatement = internal.Register(MustNewLazyLexer( &Config{ Name: "cfstatement", Aliases: []string{"cfs"}, @@ -15,7 +15,11 @@ var Cfstatement = internal.Register(MustNewLexer( NotMultiline: true, CaseInsensitive: true, }, - Rules{ + cfstatementRules, +)) + +func cfstatementRules() Rules { + return Rules{ "root": { {`//.*?\n`, CommentSingle, nil}, {`/\*(?:.|\n)*?\*/`, CommentMultiline, nil}, @@ -44,5 +48,5 @@ var Cfstatement = internal.Register(MustNewLexer( {`#`, LiteralStringDouble, nil}, {`"`, LiteralStringDouble, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/coq.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/coq.go index e69a5c16..e0103ef6 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/coq.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/coq.go @@ -6,14 +6,18 @@ import ( ) // Coq lexer. -var Coq = internal.Register(MustNewLexer( +var Coq = internal.Register(MustNewLazyLexer( &Config{ Name: "Coq", Aliases: []string{"coq"}, Filenames: []string{"*.v"}, MimeTypes: []string{"text/x-coq"}, }, - Rules{ + coqRules, +)) + +func coqRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`false|true|\(\)|\[\]`, NameBuiltinPseudo, nil}, @@ -59,5 +63,5 @@ var Coq = internal.Register(MustNewLexer( {`[a-z][a-z0-9_\']*`, Name, Pop(1)}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cpp.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cpp.go index 104be240..3f4a1fde 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cpp.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cpp.go @@ -6,7 +6,7 @@ import ( ) // CPP lexer. -var CPP = internal.Register(MustNewLexer( +var CPP = internal.Register(MustNewLazyLexer( &Config{ Name: "C++", Aliases: []string{"cpp", "c++"}, @@ -14,7 +14,11 @@ var CPP = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-c++hdr", "text/x-c++src"}, EnsureNL: true, }, - Rules{ + cppRules, +)) + +func cppRules() Rules { + return 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")}, @@ -102,5 +106,5 @@ var CPP = internal.Register(MustNewLexer( {`^\s*#endif.*?(?=~!@#%^&|`?-]+", Operator, nil}, - {`(?s)(java|javascript)(\s+)(AS)(\s+)('|\$\$)(.*?)(\5)`, + { + `(?s)(java|javascript)(\s+)(AS)(\s+)('|\$\$)(.*?)(\5)`, UsingByGroup( internal.Get, 1, 6, @@ -65,5 +70,5 @@ var CassandraCQL = internal.Register(MustNewLexer( {`[^\$]+`, LiteralStringHeredoc, nil}, {`\$\$`, LiteralStringHeredoc, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/crystal.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/crystal.go index 69e053c7..f06830d2 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/crystal.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/crystal.go @@ -6,7 +6,7 @@ import ( ) // Crystal lexer. -var Crystal = internal.Register(MustNewLexer( +var Crystal = internal.Register(MustNewLazyLexer( &Config{ Name: "Crystal", Aliases: []string{"cr", "crystal"}, @@ -14,7 +14,11 @@ var Crystal = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-crystal"}, DotAll: true, }, - Rules{ + crystalRules, +)) + +func crystalRules() Rules { + return 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}, @@ -258,5 +262,5 @@ var Crystal = internal.Register(MustNewLexer( {`[\\#<>]`, LiteralStringRegex, nil}, {`[^\\#<>]+`, LiteralStringRegex, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/csharp.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/csharp.go index c6a5f468..725bcb86 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/csharp.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/csharp.go @@ -6,7 +6,7 @@ import ( ) // CSharp lexer. -var CSharp = internal.Register(MustNewLexer( +var CSharp = internal.Register(MustNewLazyLexer( &Config{ Name: "C#", Aliases: []string{"csharp", "c#"}, @@ -15,7 +15,11 @@ var CSharp = internal.Register(MustNewLexer( DotAll: true, EnsureNL: true, }, - Rules{ + cSharpRules, +)) + +func cSharpRules() Rules { + return Rules{ "root": { {`^\s*\[.*?\]`, NameAttribute, nil}, {`[^\S\n]+`, Text, nil}, @@ -29,7 +33,7 @@ var CSharp = internal.Register(MustNewLexer( {`\$@?"(""|[^"])*"`, 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}, + {`0[xX][0-9a-fA-F]+[Ll]?|[0-9_](\.[0-9]*)?([eE][+-]?[0-9]+)?[flFLdD]?`, 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}, @@ -47,5 +51,5 @@ var CSharp = internal.Register(MustNewLexer( {`(?=\()`, Text, Pop(1)}, {`(@?[_a-zA-Z]\w*|\.)+`, NameNamespace, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/css.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/css.go index fedc809b..9f3a01d5 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/css.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/css.go @@ -6,14 +6,18 @@ import ( ) // CSS lexer. -var CSS = internal.Register(MustNewLexer( +var CSS = internal.Register(MustNewLazyLexer( &Config{ Name: "CSS", Aliases: []string{"css"}, Filenames: []string{"*.css"}, MimeTypes: []string{"text/css"}, }, - Rules{ + cssRules, +)) + +func cssRules() Rules { + return Rules{ "root": { Include("basics"), }, @@ -39,6 +43,18 @@ var CSS = internal.Register(MustNewLexer( Include("basics"), {`\}`, Punctuation, Pop(2)}, }, + "atparenthesis": { + Include("common-values"), + {`/\*(?:.|\n)*?\*/`, Comment, nil}, + Include("numeric-values"), + {`[*+/-]`, Operator, nil}, + {`[,]`, Punctuation, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`[a-zA-Z_-]\w*`, Name, nil}, + {`\(`, Punctuation, Push("atparenthesis")}, + {`\)`, Punctuation, Pop(1)}, + }, "content": { {`\s+`, Text, nil}, {`\}`, Punctuation, Pop(1)}, @@ -73,6 +89,7 @@ var CSS = internal.Register(MustNewLexer( {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, {`[a-zA-Z_-]\w*`, Name, nil}, + {`\(`, Punctuation, Push("atparenthesis")}, {`\)`, Punctuation, Pop(1)}, }, "common-values": { @@ -100,5 +117,5 @@ var CSS = internal.Register(MustNewLexer( {`%`, KeywordType, nil}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cython.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cython.go index 701e2b79..0cce2041 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/cython.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/cython.go @@ -6,14 +6,18 @@ import ( ) // Cython lexer. -var Cython = internal.Register(MustNewLexer( +var Cython = internal.Register(MustNewLazyLexer( &Config{ Name: "Cython", Aliases: []string{"cython", "pyx", "pyrex"}, Filenames: []string{"*.pyx", "*.pxd", "*.pxi"}, MimeTypes: []string{"text/x-cython", "application/x-cython"}, }, - Rules{ + cythonRules, +)) + +func cythonRules() Rules { + return Rules{ "root": { {`\n`, Text, nil}, {`^(\s*)("""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringDoc), nil}, @@ -131,5 +135,5 @@ var Cython = internal.Register(MustNewLexer( Include("strings"), Include("nl"), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/circular/php.go b/backend/vendor/github.com/alecthomas/chroma/lexers/circular/php.go index d7f89404..517fb690 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/circular/php.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/circular/php.go @@ -1,15 +1,12 @@ package circular import ( - "strings" - . "github.com/alecthomas/chroma" // nolint - "github.com/alecthomas/chroma/lexers/h" "github.com/alecthomas/chroma/lexers/internal" ) -// PHP lexer. -var PHP = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( +// PHP lexer for pure PHP code (not embedded in HTML). +var PHP = internal.Register(MustNewLazyLexer( &Config{ Name: "PHP", Aliases: []string{"php", "php3", "php4", "php5"}, @@ -19,12 +16,15 @@ var PHP = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( CaseInsensitive: true, EnsureNL: true, }, - Rules{ - "root": { - {`<\?(php)?`, CommentPreproc, Push("php")}, - {`[^<]+`, Other, nil}, - {`<`, Other, nil}, - }, + phpRules, +)) + +func phpRules() Rules { + return phpCommonRules().Rename("php", "root") +} + +func phpCommonRules() Rules { + return Rules{ "php": { {`\?>`, 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}, @@ -51,8 +51,8 @@ var PHP = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( {`(\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}, + {`0x[a-f0-9_]+`, LiteralNumberHex, nil}, + {`[\d_]+`, LiteralNumberInteger, nil}, {`0b[01]+`, LiteralNumberBin, nil}, {`'([^'\\]*(?:\\.[^'\\]*)*)'`, LiteralStringSingle, nil}, {"`([^`\\\\]*(?:\\\\.[^`\\\\]*)*)`", LiteralStringBacktick, nil}, @@ -82,10 +82,5 @@ var PHP = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( {`(\$\{)(\S+)(\})`, ByGroups(LiteralStringInterpol, NameVariable, LiteralStringInterpol), nil}, {`[${\\]`, LiteralStringDouble, nil}, }, - }, -).SetAnalyser(func(text string) float32 { - if strings.Contains(text, "\s|()?+*,]+`, NameAttribute, nil}, {`>`, Keyword, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/d/dylan.go b/backend/vendor/github.com/alecthomas/chroma/lexers/d/dylan.go new file mode 100644 index 00000000..feda7487 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/d/dylan.go @@ -0,0 +1,76 @@ +package d + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Dylan lexer. +var Dylan = internal.Register(MustNewLazyLexer( + &Config{ + Name: "Dylan", + Aliases: []string{"dylan"}, + Filenames: []string{"*.dylan", "*.dyl", "*.intr"}, + MimeTypes: []string{"text/x-dylan"}, + CaseInsensitive: true, + }, + func() Rules { + return Rules{ + "root": { + {`\s+`, Whitespace, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`([a-z0-9-]+:)([ \t]*)(.*(?:\n[ \t].+)*)`, ByGroups(NameAttribute, Whitespace, LiteralString), nil}, + Default(Push("code")), + }, + "code": { + {`\s+`, Whitespace, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/\*`, CommentMultiline, Push("comment")}, + {`"`, LiteralString, Push("string")}, + {`'(\\.|\\[0-7]{1,3}|\\x[a-f0-9]{1,2}|[^\\\'\n])'`, LiteralStringChar, nil}, + {`#b[01]+`, LiteralNumberBin, nil}, + {`#o[0-7]+`, LiteralNumberOct, nil}, + {`[-+]?(\d*\.\d+([ed][-+]?\d+)?|\d+(\.\d*)?e[-+]?\d+)`, LiteralNumberFloat, nil}, + {`[-+]?\d+`, LiteralNumberInteger, nil}, + {`#x[0-9a-f]+`, LiteralNumberHex, nil}, + + {`(\?\\?)([\w!&*<>|^$%@+~?/=-]+)(:)(token|name|variable|expression|body|case-body|\*)`, + ByGroups(Operator, NameVariable, Operator, NameBuiltin), nil}, + {`(\?)(:)(token|name|variable|expression|body|case-body|\*)`, + ByGroups(Operator, Operator, NameVariable), nil}, + {`(\?\\?)([\w!&*<>|^$%@+~?/=-]+)`, ByGroups(Operator, NameVariable), nil}, + + {`(=>|::|#\(|#\[|##|\?\?|\?=|\?|[(){}\[\],.;])`, Punctuation, nil}, + {`:=`, Operator, nil}, + {`#[tf]`, Literal, nil}, + {`#"`, LiteralStringSymbol, Push("symbol")}, + {`#[a-z0-9-]+`, Keyword, nil}, + {`#(all-keys|include|key|next|rest)`, Keyword, nil}, + {`[\w!&*<>|^$%@+~?/=-]+:`, KeywordConstant, nil}, + {`<[\w!&*<>|^$%@+~?/=-]+>`, NameClass, nil}, + {`\*[\w!&*<>|^$%@+~?/=-]+\*`, NameVariableGlobal, nil}, + {`\$[\w!&*<>|^$%@+~?/=-]+`, NameConstant, nil}, + {`(let|method|function)([ \t]+)([\w!&*<>|^$%@+~?/=-]+)`, ByGroups(NameBuiltin, Whitespace, NameVariable), nil}, + {`(error|signal|return|break)`, NameException, nil}, + {`(\\?)([\w!&*<>|^$%@+~?/=-]+)`, ByGroups(Operator, Name), nil}, + }, + "comment": { + {`[^*/]`, CommentMultiline, nil}, + {`/\*`, CommentMultiline, Push()}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[*/]`, CommentMultiline, nil}, + }, + "symbol": { + {`"`, LiteralStringSymbol, Pop(1)}, + {`[^\\"]+`, LiteralStringSymbol, nil}, + }, + "string": { + {`"`, LiteralString, Pop(1)}, + {`\\([\\abfnrtv"\']|x[a-f0-9]{2,4}|[0-7]{1,3})`, LiteralStringEscape, nil}, + {`[^\\"\n]+`, LiteralString, nil}, + {`\\\n`, LiteralString, nil}, + {`\\`, LiteralString, nil}, + }, + } + }, +)) diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/e/ebnf.go b/backend/vendor/github.com/alecthomas/chroma/lexers/e/ebnf.go index 42a3a379..5ccdd38e 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/e/ebnf.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/e/ebnf.go @@ -6,14 +6,18 @@ import ( ) // Ebnf lexer. -var Ebnf = internal.Register(MustNewLexer( +var Ebnf = internal.Register(MustNewLazyLexer( &Config{ Name: "EBNF", Aliases: []string{"ebnf"}, Filenames: []string{"*.ebnf"}, MimeTypes: []string{"text/x-ebnf"}, }, - Rules{ + ebnfRules, +)) + +func ebnfRules() Rules { + return Rules{ "root": { Include("whitespace"), Include("comment_start"), @@ -47,5 +51,5 @@ var Ebnf = internal.Register(MustNewLexer( "identifier": { {`([a-zA-Z][\w \-]*)`, Keyword, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/e/elixir.go b/backend/vendor/github.com/alecthomas/chroma/lexers/e/elixir.go index 40730290..f283f846 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/e/elixir.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/e/elixir.go @@ -6,14 +6,18 @@ import ( ) // Elixir lexer. -var Elixir = internal.Register(MustNewLexer( +var Elixir = internal.Register(MustNewLazyLexer( &Config{ Name: "Elixir", Aliases: []string{"elixir", "ex", "exs"}, Filenames: []string{"*.ex", "*.exs"}, MimeTypes: []string{"text/x-elixir"}, }, - Rules{ + elixirRules, +)) + +func elixirRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`#.*$`, CommentSingle, nil}, @@ -28,6 +32,13 @@ var Elixir = internal.Register(MustNewLexer( {`:"`, 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}, + {`(fn|do|end|after|else|rescue|catch)\b`, Keyword, nil}, + {`(not|and|or|when|in)\b`, OperatorWord, nil}, + {`(case|cond|for|if|unless|try|receive|raise|quote|unquote|unquote_splicing|throw|super|while)\b`, Keyword, nil}, + {`(def|defp|defmodule|defprotocol|defmacro|defmacrop|defdelegate|defexception|defstruct|defimpl|defcallback)\b`, KeywordDeclaration, nil}, + {`(import|require|use|alias)\b`, KeywordNamespace, nil}, + {`(nil|true|false)\b`, NameConstant, nil}, + {`(_|__MODULE__|__DIR__|__ENV__|__CALLER__)\b`, NamePseudo, nil}, {`@(?:\.\.\.|[a-z_]\w*[!?]?)`, NameAttribute, nil}, {`(?:\.\.\.|[a-z_]\w*[!?]?)`, Name, nil}, {`(%?)([A-Z]\w*(?:\.[A-Z]\w*)*)`, ByGroups(Punctuation, NameClass), nil}, @@ -266,5 +277,5 @@ var Elixir = internal.Register(MustNewLexer( {`\\.`, LiteralStringOther, nil}, {`'[a-zA-Z]*`, LiteralStringOther, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/e/elm.go b/backend/vendor/github.com/alecthomas/chroma/lexers/e/elm.go index a71c6270..0fb66895 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/e/elm.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/e/elm.go @@ -6,14 +6,18 @@ import ( ) // Elm lexer. -var Elm = internal.Register(MustNewLexer( +var Elm = internal.Register(MustNewLazyLexer( &Config{ Name: "Elm", Aliases: []string{"elm"}, Filenames: []string{"*.elm"}, MimeTypes: []string{"text/x-elm"}, }, - Rules{ + elmRules, +)) + +func elmRules() Rules { + return Rules{ "root": { {`\{-`, CommentMultiline, Push("comment")}, {`--.*`, CommentSingle, nil}, @@ -55,5 +59,5 @@ var Elm = internal.Register(MustNewLexer( {`\|\]`, NameEntity, Pop(1)}, {`.*\n`, NameEntity, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/e/emacs.go b/backend/vendor/github.com/alecthomas/chroma/lexers/e/emacs.go index 78ffda12..51c49101 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/e/emacs.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/e/emacs.go @@ -522,14 +522,24 @@ var ( ) // EmacsLisp lexer. -var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLexer( +var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLazyLexer( &Config{ Name: "EmacsLisp", Aliases: []string{"emacs", "elisp", "emacs-lisp"}, Filenames: []string{"*.el"}, MimeTypes: []string{"text/x-elisp", "application/x-elisp"}, }, - Rules{ + emacsLispRules, +), TypeMapping{ + {NameVariable, NameFunction, emacsBuiltinFunction}, + {NameVariable, NameBuiltin, emacsSpecialForms}, + {NameVariable, NameException, emacsErrorKeywords}, + {NameVariable, NameBuiltin, append(emacsBuiltinFunctionHighlighted, emacsMacros...)}, + {NameVariable, KeywordPseudo, emacsLambdaListKeywords}, +})) + +func emacsLispRules() Rules { + return Rules{ "root": { Default(Push("body")), }, @@ -572,11 +582,5 @@ var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLexer( {`\\\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/backend/vendor/github.com/alecthomas/chroma/lexers/e/erlang.go b/backend/vendor/github.com/alecthomas/chroma/lexers/e/erlang.go index 63cd59a4..5f5c9caa 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/e/erlang.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/e/erlang.go @@ -6,14 +6,18 @@ import ( ) // Erlang lexer. -var Erlang = internal.Register(MustNewLexer( +var Erlang = internal.Register(MustNewLazyLexer( &Config{ Name: "Erlang", Aliases: []string{"erlang"}, Filenames: []string{"*.erl", "*.hrl", "*.es", "*.escript"}, MimeTypes: []string{"text/x-erlang"}, }, - Rules{ + erlangRules, +)) + +func erlangRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`%.*\n`, Comment, nil}, @@ -62,5 +66,5 @@ var Erlang = internal.Register(MustNewLexer( {`,`, Punctuation, Pop(1)}, {`(?=\})`, Punctuation, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/f/factor.go b/backend/vendor/github.com/alecthomas/chroma/lexers/f/factor.go index 26c0d562..d88beb23 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/f/factor.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/f/factor.go @@ -6,14 +6,18 @@ import ( ) // Factor lexer. -var Factor = internal.Register(MustNewLexer( +var Factor = internal.Register(MustNewLazyLexer( &Config{ Name: "Factor", Aliases: []string{"factor"}, Filenames: []string{"*.factor"}, MimeTypes: []string{"text/x-factor"}, }, - Rules{ + factorRules, +)) + +func factorRules() Rules { + return Rules{ "root": { {`#!.*$`, CommentPreproc, nil}, Default(Push("base")), @@ -111,5 +115,5 @@ var Factor = internal.Register(MustNewLexer( {`;\s`, Keyword, Pop(1)}, {`\S+`, NameFunction, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/f/fish.go b/backend/vendor/github.com/alecthomas/chroma/lexers/f/fish.go index 185fc92b..c3509000 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/f/fish.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/f/fish.go @@ -6,18 +6,43 @@ import ( ) // Fish lexer. -var Fish = internal.Register(MustNewLexer( +var Fish = internal.Register(MustNewLazyLexer( &Config{ Name: "Fish", Aliases: []string{"fish", "fishshell"}, Filenames: []string{"*.fish", "*.load"}, MimeTypes: []string{"application/x-fish"}, }, - Rules{ + fishRules, +)) + +func fishRules() Rules { + keywords := []string{ + `begin`, `end`, `if`, `else`, `while`, `break`, `for`, `return`, `function`, `block`, + `case`, `continue`, `switch`, `not`, `and`, `or`, `set`, `echo`, `exit`, `pwd`, `true`, + `false`, `cd`, `cdh`, `count`, `test`, + } + keywordsPattern := Words(`\b`, `\b`, keywords...) + + builtins := []string{ + `alias`, `bg`, `bind`, `breakpoint`, `builtin`, `argparse`, `abbr`, `string`, `command`, + `commandline`, `complete`, `contains`, `dirh`, `dirs`, `disown`, `emit`, `eval`, `exec`, + `fg`, `fish`, `fish_add_path`, `fish_breakpoint_prompt`, `fish_command_not_found`, + `fish_config`, `fish_git_prompt`, `fish_greeting`, `fish_hg_prompt`, `fish_indent`, + `fish_is_root_user`, `fish_key_reader`, `fish_mode_prompt`, `fish_opt`, `fish_pager`, + `fish_prompt`, `fish_right_prompt`, `fish_status_to_signal`, `fish_svn_prompt`, + `fish_title`, `fish_update_completions`, `fish_vcs_prompt`, `fishd`, `funced`, + `funcsave`, `functions`, `help`, `history`, `isatty`, `jobs`, `math`, `mimedb`, `nextd`, + `open`, `prompt_pwd`, `realpath`, `popd`, `prevd`, `psub`, `pushd`, `random`, `read`, + `set_color`, `source`, `status`, `suspend`, `trap`, `type`, `ulimit`, `umask`, `vared`, + `fc`, `getopts`, `hash`, `kill`, `printf`, `time`, `wait`, + } + + return Rules{ "root": { Include("basic"), - Include("data"), Include("interp"), + Include("data"), }, "interp": { {`\$\(\(`, Keyword, Push("math")}, @@ -25,13 +50,20 @@ var Fish = internal.Register(MustNewLexer( {`\$#?(\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}, + {Words(`(?<=(?:^|\A|;|&&|\|\||\||`+keywordsPattern+`)\s*)`, `(?=;?\b)`, keywords...), Keyword, nil}, + {`(?<=for\s+\S+\s+)in\b`, Keyword, nil}, + {Words(`\b`, `\s*\b(?!\.)`, builtins...), NameBuiltin, nil}, + {`#!.*\n`, CommentHashbang, nil}, {`#.*\n`, Comment, nil}, {`\\[\w\W]`, LiteralStringEscape, nil}, {`(\b\w+)(\s*)(=)`, ByGroups(NameVariable, Text, Operator), nil}, - {`[\[\]()=]`, Operator, nil}, + {`[\[\]()={}]`, Operator, nil}, + {`(?<=\[[^\]]+)\.\.|-(?=[^\[]+\])`, Operator, nil}, {`<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2`, LiteralString, nil}, + {`(?<=set\s+(?:--?[^\d\W][\w-]*\s+)?)\w+`, NameVariable, nil}, + {`(?<=for\s+)\w[\w-]*(?=\s+in)`, NameVariable, nil}, + {`(?<=function\s+)\w(?:[^\n])*?(?= *[-\n])`, NameFunction, nil}, + {`(?<=(?:^|\b(?:and|or|sudo)\b|;|\|\||&&|\||\(|(?:\b\w+\s*=\S+\s)) *)\w[\w-]*`, NameFunction, nil}, }, "data": { {`(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"`, LiteralStringDouble, nil}, @@ -39,10 +71,11 @@ var Fish = internal.Register(MustNewLexer( {`(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'`, LiteralStringSingle, nil}, {`(?s)'.*?'`, LiteralStringSingle, nil}, {`;`, Punctuation, nil}, - {`&|\||\^|<|>`, Operator, nil}, + {`&&|\|\||&|\||\^|<|>`, Operator, nil}, {`\s+`, Text, nil}, - {`\d+(?= |\Z)`, LiteralNumber, nil}, - {"[^=\\s\\[\\]{}()$\"\\'`\\\\<&|;]+", Text, nil}, + {`\b\d+\b`, LiteralNumber, nil}, + {`--?[^\d][\w-]*`, NameAttribute, nil}, + {".+?", Text, nil}, }, "string": { {`"`, LiteralStringDouble, Pop(1)}, @@ -61,5 +94,5 @@ var Fish = internal.Register(MustNewLexer( {`\d+`, LiteralNumber, nil}, Include("root"), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/f/forth.go b/backend/vendor/github.com/alecthomas/chroma/lexers/f/forth.go index 47de6365..8d66708d 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/f/forth.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/f/forth.go @@ -6,7 +6,7 @@ import ( ) // Forth lexer. -var Forth = internal.Register(MustNewLexer( +var Forth = internal.Register(MustNewLazyLexer( &Config{ Name: "Forth", Aliases: []string{"forth"}, @@ -14,7 +14,11 @@ var Forth = internal.Register(MustNewLexer( MimeTypes: []string{"application/x-forth"}, CaseInsensitive: true, }, - Rules{ + forthRules, +)) + +func forthRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`\\.*?\n`, CommentSingle, nil}, @@ -36,5 +40,5 @@ var Forth = internal.Register(MustNewLexer( "stringdef": { {`[^"]+`, LiteralString, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/f/fortran.go b/backend/vendor/github.com/alecthomas/chroma/lexers/f/fortran.go index 6c57afa6..af4a969c 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/f/fortran.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/f/fortran.go @@ -6,7 +6,7 @@ import ( ) // Fortran lexer. -var Fortran = internal.Register(MustNewLexer( +var Fortran = internal.Register(MustNewLazyLexer( &Config{ Name: "Fortran", Aliases: []string{"fortran"}, @@ -14,7 +14,11 @@ var Fortran = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-fortran"}, CaseInsensitive: true, }, - Rules{ + fortranRules, +)) + +func fortranRules() Rules { + return Rules{ "root": { {`^#.*\n`, CommentPreproc, nil}, {`!.*\n`, Comment, nil}, @@ -43,5 +47,5 @@ var Fortran = internal.Register(MustNewLexer( {`[+-]?\d*\.\d+([ed][-+]?\d+)?(_[a-z]\w+)?`, LiteralNumberFloat, nil}, {`[+-]?\d+\.\d*([ed][-+]?\d+)?(_[a-z]\w+)?`, LiteralNumberFloat, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/f/fortran_fixed.go b/backend/vendor/github.com/alecthomas/chroma/lexers/f/fortran_fixed.go new file mode 100644 index 00000000..7c646386 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/f/fortran_fixed.go @@ -0,0 +1,39 @@ +package f + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// FortranFixed lexer. +var FortranFixed = internal.Register(MustNewLazyLexer( + &Config{ + Name: "FortranFixed", + Aliases: []string{"fortranfixed"}, + Filenames: []string{"*.f", "*.F"}, + MimeTypes: []string{"text/x-fortran"}, + NotMultiline: true, + CaseInsensitive: true, + }, + func() Rules { + return Rules{ + "root": { + {`[C*].*\n`, Comment, nil}, + {`#.*\n`, CommentPreproc, nil}, + {`[\t ]*!.*\n`, Comment, nil}, + {`(.{5})`, NameLabel, Push("cont-char")}, + {`.*\n`, Using(Fortran), nil}, + }, + "cont-char": { + {` `, Text, Push("code")}, + {`0`, Comment, Push("code")}, + {`.`, GenericStrong, Push("code")}, + }, + "code": { + {`(.{66})(.*)(\n)`, ByGroups(Using(Fortran), Comment, Text), Push("root")}, + {`.*\n`, Using(Fortran), Push("root")}, + Default(Push("root")), + }, + } + }, +)) diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/f/fsharp.go b/backend/vendor/github.com/alecthomas/chroma/lexers/f/fsharp.go index d00f63dd..44fced4d 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/f/fsharp.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/f/fsharp.go @@ -6,14 +6,18 @@ import ( ) // Fsharp lexer. -var Fsharp = internal.Register(MustNewLexer( +var Fsharp = internal.Register(MustNewLazyLexer( &Config{ Name: "FSharp", Aliases: []string{"fsharp"}, Filenames: []string{"*.fs", "*.fsi"}, MimeTypes: []string{"text/x-fsharp"}, }, - Rules{ + fsharpRules, +)) + +func fsharpRules() Rules { + return Rules{ "escape-sequence": { {`\\[\\"\'ntbrafv]`, LiteralStringEscape, nil}, {`\\[0-9]{3}`, LiteralStringEscape, nil}, @@ -90,5 +94,5 @@ var Fsharp = internal.Register(MustNewLexer( {`"""B?`, LiteralString, Pop(1)}, {`"`, LiteralString, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/g/gas.go b/backend/vendor/github.com/alecthomas/chroma/lexers/g/gas.go index a9228068..1f733f6a 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/g/gas.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/g/gas.go @@ -6,14 +6,18 @@ import ( ) // Gas lexer. -var Gas = internal.Register(MustNewLexer( +var Gas = internal.Register(MustNewLazyLexer( &Config{ Name: "GAS", Aliases: []string{"gas", "asm"}, Filenames: []string{"*.s", "*.S"}, MimeTypes: []string{"text/x-gas"}, }, - Rules{ + gasRules, +)) + +func gasRules() Rules { + return Rules{ "root": { Include("whitespace"), {`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+):`, NameLabel, nil}, @@ -51,5 +55,5 @@ var Gas = internal.Register(MustNewLexer( "punctuation": { {`[-*,.()\[\]!:]+`, Punctuation, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/g/gdscript.go b/backend/vendor/github.com/alecthomas/chroma/lexers/g/gdscript.go index bfe30637..2b6af973 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/g/gdscript.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/g/gdscript.go @@ -6,14 +6,18 @@ import ( ) // GDScript lexer. -var GDScript = internal.Register(MustNewLexer( +var GDScript = internal.Register(MustNewLazyLexer( &Config{ Name: "GDScript", Aliases: []string{"gdscript", "gd"}, Filenames: []string{"*.gd"}, MimeTypes: []string{"text/x-gdscript", "application/x-gdscript"}, }, - Rules{ + gdscriptRules, +)) + +func gdscriptRules() Rules { + return Rules{ "root": { {`\n`, Text, nil}, {`^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringAffix, LiteralStringDoc), nil}, @@ -120,5 +124,5 @@ var GDScript = internal.Register(MustNewLexer( Include("strings-single"), {`\n`, LiteralStringSingle, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/g/genshi.go b/backend/vendor/github.com/alecthomas/chroma/lexers/g/genshi.go index 0d3663a0..dc4d4b17 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/g/genshi.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/g/genshi.go @@ -7,14 +7,18 @@ import ( ) // Genshi Text lexer. -var GenshiText = internal.Register(MustNewLexer( +var GenshiText = internal.Register(MustNewLazyLexer( &Config{ Name: "Genshi Text", Aliases: []string{"genshitext"}, Filenames: []string{}, MimeTypes: []string{"application/x-genshi-text", "text/x-genshi"}, }, - Rules{ + genshiTextRules, +)) + +func genshiTextRules() Rules { + return Rules{ "root": { {`[^#$\s]+`, Other, nil}, {`^(\s*)(##.*)$`, ByGroups(Text, Comment), nil}, @@ -33,11 +37,11 @@ var GenshiText = internal.Register(MustNewLexer( {`(?)`, 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": { - {`(?)`, 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": { + {`(?]+>)`, NameVariable, nil}, + }, + "numbers": { + {`(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?`, LiteralString, nil}, + }, + "string": { + Include("tableVars"), + {`(\s|.)`, LiteralString, nil}, + }, + "pyString": { + {`"""`, Keyword, Pop(1)}, + Include("string"), + }, + "stepContentRoot": { + {`$`, Keyword, Pop(1)}, + Include("stepContent"), + }, + "stepContentStack": { + {`$`, Keyword, Pop(2)}, + Include("stepContent"), + }, + "stepContent": { + {`"`, NameFunction, Push("doubleString")}, + Include("tableVars"), + Include("numbers"), + Include("comments"), + {`(\s|.)`, NameFunction, nil}, + }, + "tableContent": { + {`\s+\|\s*$`, Keyword, Pop(1)}, + Include("comments"), + {`\\\|`, LiteralString, nil}, + {`\s*\|`, Keyword, nil}, + {`"`, LiteralString, Push("doubleStringTable")}, + Include("string"), + }, + "doubleString": { + {`"`, NameFunction, Pop(1)}, + Include("string"), + }, + "doubleStringTable": { + {`"`, LiteralString, Pop(1)}, + Include("string"), + }, + "root": { + {`\n`, NameFunction, nil}, + Include("comments"), + {`"""`, Keyword, Push("pyString")}, + {`\s+\|`, Keyword, Push("tableContent")}, + {`"`, NameFunction, Push("doubleString")}, + Include("tableVars"), + Include("numbers"), + {`(\s*)(@[^@\r\n\t ]+)`, ByGroups(NameFunction, NameTag), nil}, + {stepKeywords, ByGroups(NameFunction, Keyword), Push("stepContentRoot")}, + {featureKeywords, ByGroups(Keyword, Keyword, NameFunction), Push("narrative")}, + {featureElementKeywords, ByGroups(NameFunction, Keyword, Keyword, NameFunction), Push("featureElements")}, + {examplesKeywords, ByGroups(NameFunction, Keyword, Keyword, NameFunction), Push("examplesTable")}, + {`(\s|.)`, NameFunction, nil}, + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/g/glsl.go b/backend/vendor/github.com/alecthomas/chroma/lexers/g/glsl.go index 9b3a3f5a..14aa58db 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/g/glsl.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/g/glsl.go @@ -6,14 +6,18 @@ import ( ) // GLSL lexer. -var GLSL = internal.Register(MustNewLexer( +var GLSL = internal.Register(MustNewLazyLexer( &Config{ Name: "GLSL", Aliases: []string{"glsl"}, Filenames: []string{"*.vert", "*.frag", "*.geo"}, MimeTypes: []string{"text/x-glslsrc"}, }, - Rules{ + glslRules, +)) + +func glslRules() Rules { + return Rules{ "root": { {`^#.*`, CommentPreproc, nil}, {`//.*`, CommentSingle, nil}, @@ -33,5 +37,5 @@ var GLSL = internal.Register(MustNewLexer( {`\.`, Punctuation, nil}, {`\s+`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/g/gnuplot.go b/backend/vendor/github.com/alecthomas/chroma/lexers/g/gnuplot.go index 77c6363c..a7a25094 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/g/gnuplot.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/g/gnuplot.go @@ -6,14 +6,18 @@ import ( ) // Gnuplot lexer. -var Gnuplot = internal.Register(MustNewLexer( +var Gnuplot = internal.Register(MustNewLazyLexer( &Config{ Name: "Gnuplot", Aliases: []string{"gnuplot"}, Filenames: []string{"*.plot", "*.plt"}, MimeTypes: []string{"text/x-gnuplot"}, }, - Rules{ + gnuplotRules, +)) + +func gnuplotRules() Rules { + return Rules{ "root": { Include("whitespace"), {`bind\b|bin\b|bi\b`, Keyword, Push("bind")}, @@ -113,5 +117,5 @@ var Gnuplot = internal.Register(MustNewLexer( {`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/backend/vendor/github.com/alecthomas/chroma/lexers/g/go.go b/backend/vendor/github.com/alecthomas/chroma/lexers/g/go.go index a93fa8bb..a927b5e0 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/g/go.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/g/go.go @@ -9,14 +9,27 @@ import ( ) // Go lexer. -var Go = internal.Register(MustNewLexer( +var Go = internal.Register(MustNewLazyLexer( &Config{ Name: "Go", Aliases: []string{"go", "golang"}, Filenames: []string{"*.go"}, MimeTypes: []string{"text/x-gosrc"}, + EnsureNL: true, }, - Rules{ + goRules, +).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 +})) + +func goRules() Rules { + return Rules{ "root": { {`\n`, Text, nil}, {`\s+`, Text, nil}, @@ -36,8 +49,8 @@ var Go = internal.Register(MustNewLexer( {`\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}, + {`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}, @@ -46,58 +59,52 @@ var Go = internal.Register(MustNewLexer( {`[|^<>=!()\[\]{}.,;:]`, 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( +func goTemplateRules() Rules { + return Rules{ + "root": { + {`{{(- )?/\*(.|\n)*?\*/( -)?}}`, CommentMultiline, nil}, + {`{{[-]?`, CommentPreproc, Push("template")}, + {`[^{]+`, Other, nil}, + {`{`, Other, nil}, + }, + "template": { + {`[-]?}}`, CommentPreproc, Pop(1)}, + {`(?=}})`, 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, MustNewLazyLexer( &Config{ Name: "Go HTML Template", Aliases: []string{"go-html-template"}, @@ -105,7 +112,7 @@ var GoHTMLTemplate = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( goTemplateRules, ))) -var GoTextTemplate = internal.Register(MustNewLexer( +var GoTextTemplate = internal.Register(MustNewLazyLexer( &Config{ Name: "Go Text Template", Aliases: []string{"go-text-template"}, diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/g/graphql.go b/backend/vendor/github.com/alecthomas/chroma/lexers/g/graphql.go index a57e693a..7d465cd4 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/g/graphql.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/g/graphql.go @@ -6,13 +6,17 @@ import ( ) // Go lexer. -var Graphql = internal.Register(MustNewLexer( +var Graphql = internal.Register(MustNewLazyLexer( &Config{ Name: "GraphQL", Aliases: []string{"graphql", "graphqls", "gql"}, Filenames: []string{"*.graphql", "*.graphqls"}, }, - Rules{ + graphqlRules, +)) + +func graphqlRules() Rules { + return Rules{ "root": { {`(query|mutation|subscription|fragment|scalar|implements|interface|union|enum|input|type)`, KeywordDeclaration, Push("type")}, {`(on|extend|schema|directive|\.\.\.)`, KeywordDeclaration, nil}, @@ -41,5 +45,5 @@ var Graphql = internal.Register(MustNewLexer( {`[^\W\d]\w*`, NameClass, Pop(1)}, Include("root"), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/g/groff.go b/backend/vendor/github.com/alecthomas/chroma/lexers/g/groff.go new file mode 100644 index 00000000..65a70934 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/g/groff.go @@ -0,0 +1,47 @@ +package g + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Groff lexer. +var Groff = internal.Register(MustNewLazyLexer( + &Config{ + Name: "Groff", + Aliases: []string{"groff", "nroff", "man"}, + Filenames: []string{"*.[1-9]", "*.1p", "*.3pm", "*.man"}, + MimeTypes: []string{"application/x-troff", "text/troff"}, + }, + func() Rules { + return Rules{ + "root": { + {`(\.)(\w+)`, ByGroups(Text, Keyword), Push("request")}, + {`\.`, Punctuation, Push("request")}, + {`[^\\\n]+`, Text, Push("textline")}, + Default(Push("textline")), + }, + "textline": { + Include("escapes"), + {`[^\\\n]+`, Text, nil}, + {`\n`, Text, Pop(1)}, + }, + "escapes": { + {`\\"[^\n]*`, Comment, nil}, + {`\\[fn]\w`, LiteralStringEscape, nil}, + {`\\\(.{2}`, LiteralStringEscape, nil}, + {`\\.\[.*\]`, LiteralStringEscape, nil}, + {`\\.`, LiteralStringEscape, nil}, + {`\\\n`, Text, Push("request")}, + }, + "request": { + {`\n`, Text, Pop(1)}, + Include("escapes"), + {`"[^\n"]+"`, LiteralStringDouble, nil}, + {`\d+`, LiteralNumber, nil}, + {`\S+`, LiteralString, nil}, + {`\s+`, Text, nil}, + }, + } + }, +)) diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/g/groovy.go b/backend/vendor/github.com/alecthomas/chroma/lexers/g/groovy.go index a395415a..8d37bd87 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/g/groovy.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/g/groovy.go @@ -6,7 +6,7 @@ import ( ) // Groovy lexer. -var Groovy = internal.Register(MustNewLexer( +var Groovy = internal.Register(MustNewLazyLexer( &Config{ Name: "Groovy", Aliases: []string{"groovy"}, @@ -14,7 +14,11 @@ var Groovy = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-groovy"}, DotAll: true, }, - Rules{ + groovyRules, +)) + +func groovyRules() Rules { + return Rules{ "root": { {`#!(.*?)$`, CommentPreproc, Push("base")}, Default(Push("base")), @@ -54,5 +58,5 @@ var Groovy = internal.Register(MustNewLexer( "import": { {`[\w.]+\*?`, NameNamespace, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/h/handlebars.go b/backend/vendor/github.com/alecthomas/chroma/lexers/h/handlebars.go index 07072da5..d34ef3a9 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/h/handlebars.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/h/handlebars.go @@ -6,14 +6,18 @@ import ( ) // Handlebars lexer. -var Handlebars = internal.Register(MustNewLexer( +var Handlebars = internal.Register(MustNewLazyLexer( &Config{ Name: "Handlebars", - Aliases: []string{"handlebars"}, - Filenames: []string{"*.handlebars"}, + Aliases: []string{"handlebars", "hbs"}, + Filenames: []string{"*.handlebars", "*.hbs"}, MimeTypes: []string{}, }, - Rules{ + handlebarsRules, +)) + +func handlebarsRules() Rules { + return Rules{ "root": { {`[^{]+`, Other, nil}, {`\{\{!.*\}\}`, Comment, nil}, @@ -52,5 +56,5 @@ var Handlebars = internal.Register(MustNewLexer( {`:?'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, {`[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/h/haskell.go b/backend/vendor/github.com/alecthomas/chroma/lexers/h/haskell.go index b018eab4..9780481a 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/h/haskell.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/h/haskell.go @@ -6,14 +6,18 @@ import ( ) // Haskell lexer. -var Haskell = internal.Register(MustNewLexer( +var Haskell = internal.Register(MustNewLazyLexer( &Config{ Name: "Haskell", Aliases: []string{"haskell", "hs"}, Filenames: []string{"*.hs"}, MimeTypes: []string{"text/x-haskell"}, }, - Rules{ + haskellRules, +)) + +func haskellRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`--(?![!#$%&*+./<=>?@^|_~:\\]).*?$`, CommentSingle, nil}, @@ -95,5 +99,5 @@ var Haskell = internal.Register(MustNewLexer( {`\d+`, LiteralStringEscape, Pop(1)}, {`\s+\\`, LiteralStringEscape, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/h/haxe.go b/backend/vendor/github.com/alecthomas/chroma/lexers/h/haxe.go index 59585431..cc8c693e 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/h/haxe.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/h/haxe.go @@ -6,7 +6,7 @@ import ( ) // Haxe lexer. -var Haxe = internal.Register(MustNewLexer( +var Haxe = internal.Register(MustNewLazyLexer( &Config{ Name: "Haxe", Aliases: []string{"hx", "haxe", "hxsl"}, @@ -14,7 +14,11 @@ var Haxe = internal.Register(MustNewLexer( MimeTypes: []string{"text/haxe", "text/x-haxe", "text/x-hx"}, DotAll: true, }, - Rules{ + haxeRules, +)) + +func haxeRules() Rules { + return Rules{ "root": { Include("spaces"), Include("meta"), @@ -609,8 +613,8 @@ var Haxe = internal.Register(MustNewLexer( {`\}`, Punctuation, Pop(1)}, {`,`, Punctuation, Push("#pop", "object")}, }, - }, -)) + } +} func haxePreProcMutator(state *LexerState) error { stack, ok := state.Get("haxe-pre-proc").([][]string) diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/h/hcl.go b/backend/vendor/github.com/alecthomas/chroma/lexers/h/hcl.go index ce7064b5..7206fba0 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/h/hcl.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/h/hcl.go @@ -6,14 +6,18 @@ import ( ) // HCL lexer. -var HCL = internal.Register(MustNewLexer( +var HCL = internal.Register(MustNewLazyLexer( &Config{ Name: "HCL", Aliases: []string{"hcl"}, Filenames: []string{"*.hcl"}, MimeTypes: []string{"application/x-hcl"}, }, - Rules{ + hclRules, +)) + +func hclRules() Rules { + return Rules{ "root": { Include("string"), Include("punctuation"), @@ -65,5 +69,5 @@ var HCL = internal.Register(MustNewLexer( {`\s+`, Text, nil}, {`\\\n`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/h/hexdump.go b/backend/vendor/github.com/alecthomas/chroma/lexers/h/hexdump.go index 8b7e7bdd..08935374 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/h/hexdump.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/h/hexdump.go @@ -6,14 +6,18 @@ import ( ) // Hexdump lexer. -var Hexdump = internal.Register(MustNewLexer( +var Hexdump = internal.Register(MustNewLazyLexer( &Config{ Name: "Hexdump", Aliases: []string{"hexdump"}, Filenames: []string{}, MimeTypes: []string{}, }, - Rules{ + hexdumpRules, +)) + +func hexdumpRules() Rules { + return Rules{ "root": { {`\n`, Text, nil}, Include("offset"), @@ -63,5 +67,5 @@ var Hexdump = internal.Register(MustNewLexer( {`\s`, Text, nil}, {`^\*`, Punctuation, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/hlb.go b/backend/vendor/github.com/alecthomas/chroma/lexers/h/hlb.go similarity index 95% rename from backend/vendor/github.com/alecthomas/chroma/lexers/hlb.go rename to backend/vendor/github.com/alecthomas/chroma/lexers/h/hlb.go index 4dcf8ed3..6c5f6377 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/hlb.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/h/hlb.go @@ -1,4 +1,4 @@ -package lexers +package h import ( . "github.com/alecthomas/chroma" // nolint @@ -6,14 +6,18 @@ import ( ) // HLB lexer. -var HLB = internal.Register(MustNewLexer( +var HLB = internal.Register(MustNewLazyLexer( &Config{ Name: "HLB", Aliases: []string{"hlb"}, Filenames: []string{"*.hlb"}, MimeTypes: []string{}, }, - Rules{ + hlbRules, +)) + +func hlbRules() Rules { + return Rules{ "root": { {`(#.*)`, ByGroups(CommentSingle), nil}, {`((\b(0(b|B|o|O|x|X)[a-fA-F0-9]+)\b)|(\b(0|[1-9][0-9]*)\b))`, ByGroups(LiteralNumber), nil}, @@ -50,5 +54,5 @@ var HLB = internal.Register(MustNewLexer( {`(\n|\r|\r\n)`, Text, nil}, {`.`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/h/html.go b/backend/vendor/github.com/alecthomas/chroma/lexers/h/html.go index 07fc27ef..b9ca1e1d 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/h/html.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/h/html.go @@ -8,7 +8,7 @@ import ( ) // HTML lexer. -var HTML = internal.Register(MustNewLexer( +var HTML = internal.Register(MustNewLazyLexer( &Config{ Name: "HTML", Aliases: []string{"html"}, @@ -18,7 +18,11 @@ var HTML = internal.Register(MustNewLexer( DotAll: true, CaseInsensitive: true, }, - Rules{ + htmlRules, +)) + +func htmlRules() Rules { + return Rules{ "root": { {`[^<&]+`, Text, nil}, {`&\S*?;`, NameEntity, nil}, @@ -55,5 +59,5 @@ var HTML = internal.Register(MustNewLexer( {`'.*?'`, LiteralString, Pop(1)}, {`[^\s>]+`, LiteralString, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/h/http.go b/backend/vendor/github.com/alecthomas/chroma/lexers/h/http.go index 0a1264cf..c515ed4c 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/h/http.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/h/http.go @@ -8,7 +8,7 @@ import ( ) // HTTP lexer. -var HTTP = internal.Register(httpBodyContentTypeLexer(MustNewLexer( +var HTTP = internal.Register(httpBodyContentTypeLexer(MustNewLazyLexer( &Config{ Name: "HTTP", Aliases: []string{"http"}, @@ -17,10 +17,14 @@ var HTTP = internal.Register(httpBodyContentTypeLexer(MustNewLexer( NotMultiline: true, DotAll: true, }, - Rules{ + httpRules, +))) + +func httpRules() Rules { + return 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")}, + {`(GET|POST|PUT|DELETE|HEAD|OPTIONS|TRACE|PATCH|CONNECT)( +)([^ ]+)( +)(HTTP)(/)([12]\.[01])(\r?\n|\Z)`, ByGroups(NameFunction, Text, NameNamespace, Text, KeywordReserved, Operator, LiteralNumber, Text), Push("headers")}, + {`(HTTP)(/)([12]\.[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}, @@ -30,17 +34,17 @@ var HTTP = internal.Register(httpBodyContentTypeLexer(MustNewLexer( "content": { {`.+`, EmitterFunc(httpContentBlock), nil}, }, - }, -))) + } +} -func httpContentBlock(groups []string, lexer Lexer) Iterator { +func httpContentBlock(groups []string, state *LexerState) Iterator { tokens := []Token{ {Generic, groups[0]}, } return Literator(tokens...) } -func httpHeaderBlock(groups []string, lexer Lexer) Iterator { +func httpHeaderBlock(groups []string, state *LexerState) Iterator { tokens := []Token{ {Name, groups[1]}, {Text, groups[2]}, @@ -52,7 +56,7 @@ func httpHeaderBlock(groups []string, lexer Lexer) Iterator { return Literator(tokens...) } -func httpContinuousHeaderBlock(groups []string, lexer Lexer) Iterator { +func httpContinuousHeaderBlock(groups []string, state *LexerState) Iterator { tokens := []Token{ {Text, groups[1]}, {Literal, groups[2]}, diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/h/hy.go b/backend/vendor/github.com/alecthomas/chroma/lexers/h/hy.go index 17385e86..7a078979 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/h/hy.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/h/hy.go @@ -6,14 +6,18 @@ import ( ) // Hy lexer. -var Hy = internal.Register(MustNewLexer( +var Hy = internal.Register(MustNewLazyLexer( &Config{ Name: "Hy", Aliases: []string{"hylang"}, Filenames: []string{"*.hy"}, MimeTypes: []string{"text/x-hy", "application/x-hy"}, }, - Rules{ + hyRules, +)) + +func hyRules() Rules { + return Rules{ "root": { {`;.*$`, CommentSingle, nil}, {`[,\s]+`, Text, nil}, @@ -47,5 +51,5 @@ var Hy = internal.Register(MustNewLexer( {`(??@^|_~:\\]).*?)$`, ByGroups(Text, CommentSingle), nil}, @@ -76,5 +80,5 @@ var Idris = internal.Register(MustNewLexer( {`\d+`, LiteralStringEscape, Pop(1)}, {`\s+\\`, LiteralStringEscape, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/i/igor.go b/backend/vendor/github.com/alecthomas/chroma/lexers/i/igor.go index d704a4fb..bbb1d723 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/i/igor.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/i/igor.go @@ -6,7 +6,7 @@ import ( ) // Igor lexer. -var Igor = internal.Register(MustNewLexer( +var Igor = internal.Register(MustNewLazyLexer( &Config{ Name: "Igor", Aliases: []string{"igor", "igorpro"}, @@ -14,7 +14,11 @@ var Igor = internal.Register(MustNewLexer( MimeTypes: []string{"text/ipf"}, CaseInsensitive: true, }, - Rules{ + igorRules, +)) + +func igorRules() Rules { + return Rules{ "root": { {`//.*$`, CommentSingle, nil}, {`"([^"\\]|\\.)*"`, LiteralString, nil}, @@ -28,5 +32,5 @@ var Igor = internal.Register(MustNewLexer( {`.`, Text, nil}, {`\n|\r`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/i/ini.go b/backend/vendor/github.com/alecthomas/chroma/lexers/i/ini.go index 39b5edd2..46b2ce23 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/i/ini.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/i/ini.go @@ -6,14 +6,18 @@ import ( ) // Ini lexer. -var Ini = internal.Register(MustNewLexer( +var Ini = internal.Register(MustNewLazyLexer( &Config{ Name: "INI", Aliases: []string{"ini", "cfg", "dosini"}, - Filenames: []string{"*.ini", "*.cfg", "*.inf", ".gitconfig"}, + Filenames: []string{"*.ini", "*.cfg", "*.inf", ".gitconfig", ".editorconfig"}, MimeTypes: []string{"text/x-ini", "text/inf"}, }, - Rules{ + iniRules, +)) + +func iniRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`[;#].*`, CommentSingle, nil}, @@ -21,5 +25,5 @@ var Ini = internal.Register(MustNewLexer( {`(.*?)([ \t]*)(=)([ \t]*)(.*(?:\n[ \t].+)*)`, ByGroups(NameAttribute, Text, Operator, Text, LiteralString), nil}, {`(.+?)$`, NameAttribute, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/i/io.go b/backend/vendor/github.com/alecthomas/chroma/lexers/i/io.go index 840feeaa..8b2e53a0 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/i/io.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/i/io.go @@ -6,14 +6,18 @@ import ( ) // Io lexer. -var Io = internal.Register(MustNewLexer( +var Io = internal.Register(MustNewLazyLexer( &Config{ Name: "Io", Aliases: []string{"io"}, Filenames: []string{"*.io"}, MimeTypes: []string{"text/x-iosrc"}, }, - Rules{ + ioRules, +)) + +func ioRules() Rules { + return Rules{ "root": { {`\n`, Text, nil}, {`\s+`, Text, nil}, @@ -36,5 +40,5 @@ var Io = internal.Register(MustNewLexer( {`\+/`, CommentMultiline, Pop(1)}, {`[+/]`, CommentMultiline, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/internal/api.go b/backend/vendor/github.com/alecthomas/chroma/lexers/internal/api.go index 002997a5..5c7970ae 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/internal/api.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/internal/api.go @@ -11,6 +11,19 @@ import ( "github.com/alecthomas/chroma" ) +var ( + ignoredSuffixes = [...]string{ + // Editor backups + "~", ".bak", ".old", ".orig", + // Debian and derivatives apt/dpkg backups + ".dpkg-dist", ".dpkg-old", + // Red Hat and derivatives rpm backups + ".rpmnew", ".rpmorig", ".rpmsave", + // Build system input/template files + ".in", + } +) + // Registry of Lexers. var Registry = struct { Lexers chroma.Lexers @@ -37,19 +50,20 @@ func Names(withAliases bool) []string { // 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) + return lexer } if lexer := Registry.byAlias[name]; lexer != nil { - candidates = append(candidates, lexer) + return lexer } if lexer := Registry.byName[strings.ToLower(name)]; lexer != nil { - candidates = append(candidates, lexer) + return lexer } if lexer := Registry.byAlias[strings.ToLower(name)]; lexer != nil { - candidates = append(candidates, lexer) + return lexer } + + candidates := chroma.PrioritisedLexers{} // Try file extension. if lexer := Match("filename." + name); lexer != nil { candidates = append(candidates, lexer) @@ -92,6 +106,13 @@ func Match(filename string) chroma.Lexer { for _, glob := range config.Filenames { if fnmatch.Match(glob, filename, 0) { matched = append(matched, lexer) + } else { + for _, suf := range &ignoredSuffixes { + if fnmatch.Match(glob+suf, filename, 0) { + matched = append(matched, lexer) + break + } + } } } } @@ -106,6 +127,13 @@ func Match(filename string) chroma.Lexer { for _, glob := range config.AliasFilenames { if fnmatch.Match(glob, filename, 0) { matched = append(matched, lexer) + } else { + for _, suf := range &ignoredSuffixes { + if fnmatch.Match(glob+suf, filename, 0) { + matched = append(matched, lexer) + break + } + } } } } @@ -145,16 +173,19 @@ func Register(lexer chroma.Lexer) chroma.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}, - }, +// PlaintextRules is used for the fallback lexer as well as the explicit +// plaintext lexer. +func PlaintextRules() chroma.Rules { + return 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{ +var Fallback chroma.Lexer = chroma.MustNewLazyLexer(&chroma.Config{ Name: "fallback", Filenames: []string{"*"}, }, PlaintextRules) diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/j/j.go b/backend/vendor/github.com/alecthomas/chroma/lexers/j/j.go index 686e53b9..9a2a4e3c 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/j/j.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/j/j.go @@ -6,14 +6,18 @@ import ( ) // J lexer. -var J = internal.Register(MustNewLexer( +var J = internal.Register(MustNewLazyLexer( &Config{ Name: "J", Aliases: []string{"j"}, Filenames: []string{"*.ijs"}, MimeTypes: []string{"text/x-j"}, }, - Rules{ + jRules, +)) + +func jRules() Rules { + return Rules{ "root": { {`#!.*$`, CommentPreproc, nil}, {`NB\..*`, CommentSingle, nil}, @@ -69,5 +73,5 @@ var J = internal.Register(MustNewLexer( {`''`, LiteralString, nil}, {`'`, LiteralString, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/j/java.go b/backend/vendor/github.com/alecthomas/chroma/lexers/j/java.go index c6b9a762..48a9d9fe 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/j/java.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/j/java.go @@ -6,15 +6,20 @@ import ( ) // Java lexer. -var Java = internal.Register(MustNewLexer( +var Java = internal.Register(MustNewLazyLexer( &Config{ Name: "Java", Aliases: []string{"java"}, Filenames: []string{"*.java"}, MimeTypes: []string{"text/x-java"}, DotAll: true, + EnsureNL: true, }, - Rules{ + javaRules, +)) + +func javaRules() Rules { + return Rules{ "root": { {`[^\S\n]+`, Text, nil}, {`//.*?\n`, CommentSingle, nil}, @@ -47,5 +52,5 @@ var Java = internal.Register(MustNewLexer( "import": { {`[\w.]+\*?`, NameNamespace, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/j/javascript.go b/backend/vendor/github.com/alecthomas/chroma/lexers/j/javascript.go index 282501d0..6bb3145c 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/j/javascript.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/j/javascript.go @@ -26,18 +26,18 @@ var JavascriptRules = Rules{ {`\A#! ?/.*?\n`, CommentHashbang, nil}, {`^(?=\s|/|`, `||`, `&&`, `>`, `<`, `>=`, `≥`, `<=`, `≤`, `==`, `===`, `≡`, `!=`, `≠`, `!==`, `≢`, `.>`, `.<`, `.>=`, `.≥`, `.<=`, `.≤`, `.==`, `.!=`, `.≠`, `.=`, `.!`, `<:`, `>:`, `∈`, `∉`, `∋`, `∌`, `⊆`, `⊈`, `⊂`, `⊄`, `⊊`, `|>`, `<|`, `:`, `+`, `-`, `.+`, `.-`, `|`, `∪`, `$`, `<<`, `>>`, `>>>`, `.<<`, `.>>`, `.>>>`, `*`, `/`, `./`, `÷`, `.÷`, `%`, `⋅`, `.%`, `.*`, `\`, `.\`, `&`, `∩`, `//`, `.//`, `^`, `.^`, `::`, `.`, `+`, `-`, `!`, `√`, `∛`, `∜`), Operator, nil}, + {`[\[\](),;]`, Punctuation, nil}, + {`((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))(\s*)(:)((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))`, ByGroups(Name, Text, Operator, Name), nil}, + {`(?\d.])(:(?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))`, LiteralStringSymbol, nil}, + {`(?<=::)(\s*)((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))\b(?![(\[])`, ByGroups(Text, KeywordType), nil}, + {`((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))(\s*)([<>]:)(\s*)((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))\b(?![(\[])`, ByGroups(KeywordType, Text, Operator, Text, KeywordType), nil}, + {`([<>]:)(\s*)((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))\b(?![(\[])`, ByGroups(Operator, Text, KeywordType), nil}, + {`\b((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))(\s*)([<>]:)`, ByGroups(KeywordType, Text, Operator), nil}, + {Words(``, `[²³¹ʰʲʳʷʸˡˢˣᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁᵂᵃᵇᵈᵉᵍᵏᵐᵒᵖᵗᵘᵛᵝᵞᵟᵠᵡᵢᵣᵤᵥᵦᵧᵨᵩᵪᶜᶠᶥᶦᶫᶰᶸᶻᶿ′″‴‵‶‷⁗⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₐₑₒₓₕₖₗₘₙₚₛₜⱼⱽ]*`, `->`, `:=`, `$=`, `?`, `||`, `&&`, `:`, `$`, `::`, `=`, `+=`, `-=`, `*=`, `/=`, `//=`, `\=`, `^=`, `÷=`, `%=`, `<<=`, `>>=`, `>>>=`, `|=`, `&=`, `⊻=`, `≔`, `⩴`, `≕'`, `~`, `=>`, `→`, `↔`, `↚`, `↛`, `↞`, `↠`, `↢`, `↣`, `↦`, `↤`, `↮`, `⇎`, `⇍`, `⇏`, `⇐`, `⇒`, `⇔`, `⇴`, `⇶`, `⇷`, `⇸`, `⇹`, `⇺`, `⇻`, `⇼`, `⇽`, `⇾`, `⇿`, `⟵`, `⟶`, `⟷`, `⟹`, `⟺`, `⟻`, `⟼`, `⟽`, `⟾`, `⟿`, `⤀`, `⤁`, `⤂`, `⤃`, `⤄`, `⤅`, `⤆`, `⤇`, `⤌`, `⤍`, `⤎`, `⤏`, `⤐`, `⤑`, `⤔`, `⤕`, `⤖`, `⤗`, `⤘`, `⤝`, `⤞`, `⤟`, `⤠`, `⥄`, `⥅`, `⥆`, `⥇`, `⥈`, `⥊`, `⥋`, `⥎`, `⥐`, `⥒`, `⥓`, `⥖`, `⥗`, `⥚`, `⥛`, `⥞`, `⥟`, `⥢`, `⥤`, `⥦`, `⥧`, `⥨`, `⥩`, `⥪`, `⥫`, `⥬`, `⥭`, `⥰`, `⧴`, `⬱`, `⬰`, `⬲`, `⬳`, `⬴`, `⬵`, `⬶`, `⬷`, `⬸`, `⬹`, `⬺`, `⬻`, `⬼`, `⬽`, `⬾`, `⬿`, `⭀`, `⭁`, `⭂`, `⭃`, `⭄`, `⭇`, `⭈`, `⭉`, `⭊`, `⭋`, `⭌`, `←`, `→`, `⇜`, `⇝`, `↜`, `↝`, `↩`, `↪`, `↫`, `↬`, `↼`, `↽`, `⇀`, `⇁`, `⇄`, `⇆`, `⇇`, `⇉`, `⇋`, `⇌`, `⇚`, `⇛`, `⇠`, `⇢`, `↷`, `↶`, `↺`, `↻`, `-->`, `<--`, `<-->`, `>`, `<`, `>=`, `≥`, `<=`, `≤`, `==`, `===`, `≡`, `!=`, `≠`, `!==`, `≢`, `∈`, `∉`, `∋`, `∌`, `⊆`, `⊈`, `⊂`, `⊄`, `⊊`, `∝`, `∊`, `∍`, `∥`, `∦`, `∷`, `∺`, `∻`, `∽`, `∾`, `≁`, `≃`, `≂`, `≄`, `≅`, `≆`, `≇`, `≈`, `≉`, `≊`, `≋`, `≌`, `≍`, `≎`, `≐`, `≑`, `≒`, `≓`, `≖`, `≗`, `≘`, `≙`, `≚`, `≛`, `≜`, `≝`, `≞`, `≟`, `≣`, `≦`, `≧`, `≨`, `≩`, `≪`, `≫`, `≬`, `≭`, `≮`, `≯`, `≰`, `≱`, `≲`, `≳`, `≴`, `≵`, `≶`, `≷`, `≸`, `≹`, `≺`, `≻`, `≼`, `≽`, `≾`, `≿`, `⊀`, `⊁`, `⊃`, `⊅`, `⊇`, `⊉`, `⊋`, `⊏`, `⊐`, `⊑`, `⊒`, `⊜`, `⊩`, `⊬`, `⊮`, `⊰`, `⊱`, `⊲`, `⊳`, `⊴`, `⊵`, `⊶`, `⊷`, `⋍`, `⋐`, `⋑`, `⋕`, `⋖`, `⋗`, `⋘`, `⋙`, `⋚`, `⋛`, `⋜`, `⋝`, `⋞`, `⋟`, `⋠`, `⋡`, `⋢`, `⋣`, `⋤`, `⋥`, `⋦`, `⋧`, `⋨`, `⋩`, `⋪`, `⋫`, `⋬`, `⋭`, `⋲`, `⋳`, `⋴`, `⋵`, `⋶`, `⋷`, `⋸`, `⋹`, `⋺`, `⋻`, `⋼`, `⋽`, `⋾`, `⋿`, `⟈`, `⟉`, `⟒`, `⦷`, `⧀`, `⧁`, `⧡`, `⧣`, `⧤`, `⧥`, `⩦`, `⩧`, `⩪`, `⩫`, `⩬`, `⩭`, `⩮`, `⩯`, `⩰`, `⩱`, `⩲`, `⩳`, `⩵`, `⩶`, `⩷`, `⩸`, `⩹`, `⩺`, `⩻`, `⩼`, `⩽`, `⩾`, `⩿`, `⪀`, `⪁`, `⪂`, `⪃`, `⪄`, `⪅`, `⪆`, `⪇`, `⪈`, `⪉`, `⪊`, `⪋`, `⪌`, `⪍`, `⪎`, `⪏`, `⪐`, `⪑`, `⪒`, `⪓`, `⪔`, `⪕`, `⪖`, `⪗`, `⪘`, `⪙`, `⪚`, `⪛`, `⪜`, `⪝`, `⪞`, `⪟`, `⪠`, `⪡`, `⪢`, `⪣`, `⪤`, `⪥`, `⪦`, `⪧`, `⪨`, `⪩`, `⪪`, `⪫`, `⪬`, `⪭`, `⪮`, `⪯`, `⪰`, `⪱`, `⪲`, `⪳`, `⪴`, `⪵`, `⪶`, `⪷`, `⪸`, `⪹`, `⪺`, `⪻`, `⪼`, `⪽`, `⪾`, `⪿`, `⫀`, `⫁`, `⫂`, `⫃`, `⫄`, `⫅`, `⫆`, `⫇`, `⫈`, `⫉`, `⫊`, `⫋`, `⫌`, `⫍`, `⫎`, `⫏`, `⫐`, `⫑`, `⫒`, `⫓`, `⫔`, `⫕`, `⫖`, `⫗`, `⫘`, `⫙`, `⫷`, `⫸`, `⫹`, `⫺`, `⊢`, `⊣`, `⟂`, `<:`, `>:`, `<|`, `|>`, `…`, `⁝`, `⋮`, `⋱`, `⋰`, `⋯`, `+`, `-`, `¦`, `|`, `⊕`, `⊖`, `⊞`, `⊟`, `++`, `∪`, `∨`, `⊔`, `±`, `∓`, `∔`, `∸`, `≏`, `⊎`, `⊻`, `⊽`, `⋎`, `⋓`, `⧺`, `⧻`, `⨈`, `⨢`, `⨣`, `⨤`, `⨥`, `⨦`, `⨧`, `⨨`, `⨩`, `⨪`, `⨫`, `⨬`, `⨭`, `⨮`, `⨹`, `⨺`, `⩁`, `⩂`, `⩅`, `⩊`, `⩌`, `⩏`, `⩐`, `⩒`, `⩔`, `⩖`, `⩗`, `⩛`, `⩝`, `⩡`, `⩢`, `⩣`, `*`, `/`, `⌿`, `÷`, `%`, `&`, `⋅`, `∘`, `×`, `\`, `∩`, `∧`, `⊗`, `⊘`, `⊙`, `⊚`, `⊛`, `⊠`, `⊡`, `⊓`, `∗`, `∙`, `∤`, `⅋`, `≀`, `⊼`, `⋄`, `⋆`, `⋇`, `⋉`, `⋊`, `⋋`, `⋌`, `⋏`, `⋒`, `⟑`, `⦸`, `⦼`, `⦾`, `⦿`, `⧶`, `⧷`, `⨇`, `⨰`, `⨱`, `⨲`, `⨳`, `⨴`, `⨵`, `⨶`, `⨷`, `⨸`, `⨻`, `⨼`, `⨽`, `⩀`, `⩃`, `⩄`, `⩋`, `⩍`, `⩎`, `⩑`, `⩓`, `⩕`, `⩘`, `⩚`, `⩜`, `⩞`, `⩟`, `⩠`, `⫛`, `⊍`, `▷`, `⨝`, `⟕`, `⟖`, `⟗`, `⨟`, `//`, `>>`, `<<`, `>>>`, `^`, `↑`, `↓`, `⇵`, `⟰`, `⟱`, `⤈`, `⤉`, `⤊`, `⤋`, `⤒`, `⤓`, `⥉`, `⥌`, `⥍`, `⥏`, `⥑`, `⥔`, `⥕`, `⥘`, `⥙`, `⥜`, `⥝`, `⥠`, `⥡`, `⥣`, `⥥`, `⥮`, `⥯`, `↑`, `↓`, `!`, `¬`, `√`, `∛`, `∜`), Operator, nil}, + {Words(``, `[²³¹ʰʲʳʷʸˡˢˣᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁᵂᵃᵇᵈᵉᵍᵏᵐᵒᵖᵗᵘᵛᵝᵞᵟᵠᵡᵢᵣᵤᵥᵦᵧᵨᵩᵪᶜᶠᶥᶦᶫᶰᶸᶻᶿ′″‴‵‶‷⁗⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₐₑₒₓₕₖₗₘₙₚₛₜⱼⱽ]*`, `.=`, `.+=`, `.-=`, `.*=`, `./=`, `.//=`, `.\=`, `.^=`, `.÷=`, `.%=`, `.<<=`, `.>>=`, `.>>>=`, `.|=`, `.&=`, `.⊻=`, `.≔`, `.⩴`, `.≕'`, `.~`, `.=>`, `.→`, `.↔`, `.↚`, `.↛`, `.↞`, `.↠`, `.↢`, `.↣`, `.↦`, `.↤`, `.↮`, `.⇎`, `.⇍`, `.⇏`, `.⇐`, `.⇒`, `.⇔`, `.⇴`, `.⇶`, `.⇷`, `.⇸`, `.⇹`, `.⇺`, `.⇻`, `.⇼`, `.⇽`, `.⇾`, `.⇿`, `.⟵`, `.⟶`, `.⟷`, `.⟹`, `.⟺`, `.⟻`, `.⟼`, `.⟽`, `.⟾`, `.⟿`, `.⤀`, `.⤁`, `.⤂`, `.⤃`, `.⤄`, `.⤅`, `.⤆`, `.⤇`, `.⤌`, `.⤍`, `.⤎`, `.⤏`, `.⤐`, `.⤑`, `.⤔`, `.⤕`, `.⤖`, `.⤗`, `.⤘`, `.⤝`, `.⤞`, `.⤟`, `.⤠`, `.⥄`, `.⥅`, `.⥆`, `.⥇`, `.⥈`, `.⥊`, `.⥋`, `.⥎`, `.⥐`, `.⥒`, `.⥓`, `.⥖`, `.⥗`, `.⥚`, `.⥛`, `.⥞`, `.⥟`, `.⥢`, `.⥤`, `.⥦`, `.⥧`, `.⥨`, `.⥩`, `.⥪`, `.⥫`, `.⥬`, `.⥭`, `.⥰`, `.⧴`, `.⬱`, `.⬰`, `.⬲`, `.⬳`, `.⬴`, `.⬵`, `.⬶`, `.⬷`, `.⬸`, `.⬹`, `.⬺`, `.⬻`, `.⬼`, `.⬽`, `.⬾`, `.⬿`, `.⭀`, `.⭁`, `.⭂`, `.⭃`, `.⭄`, `.⭇`, `.⭈`, `.⭉`, `.⭊`, `.⭋`, `.⭌`, `.←`, `.→`, `.⇜`, `.⇝`, `.↜`, `.↝`, `.↩`, `.↪`, `.↫`, `.↬`, `.↼`, `.↽`, `.⇀`, `.⇁`, `.⇄`, `.⇆`, `.⇇`, `.⇉`, `.⇋`, `.⇌`, `.⇚`, `.⇛`, `.⇠`, `.⇢`, `.↷`, `.↶`, `.↺`, `.↻`, `.-->`, `.<--`, `.<-->`, `.>`, `.<`, `.>=`, `.≥`, `.<=`, `.≤`, `.==`, `.===`, `.≡`, `.!=`, `.≠`, `.!==`, `.≢`, `.∈`, `.∉`, `.∋`, `.∌`, `.⊆`, `.⊈`, `.⊂`, `.⊄`, `.⊊`, `.∝`, `.∊`, `.∍`, `.∥`, `.∦`, `.∷`, `.∺`, `.∻`, `.∽`, `.∾`, `.≁`, `.≃`, `.≂`, `.≄`, `.≅`, `.≆`, `.≇`, `.≈`, `.≉`, `.≊`, `.≋`, `.≌`, `.≍`, `.≎`, `.≐`, `.≑`, `.≒`, `.≓`, `.≖`, `.≗`, `.≘`, `.≙`, `.≚`, `.≛`, `.≜`, `.≝`, `.≞`, `.≟`, `.≣`, `.≦`, `.≧`, `.≨`, `.≩`, `.≪`, `.≫`, `.≬`, `.≭`, `.≮`, `.≯`, `.≰`, `.≱`, `.≲`, `.≳`, `.≴`, `.≵`, `.≶`, `.≷`, `.≸`, `.≹`, `.≺`, `.≻`, `.≼`, `.≽`, `.≾`, `.≿`, `.⊀`, `.⊁`, `.⊃`, `.⊅`, `.⊇`, `.⊉`, `.⊋`, `.⊏`, `.⊐`, `.⊑`, `.⊒`, `.⊜`, `.⊩`, `.⊬`, `.⊮`, `.⊰`, `.⊱`, `.⊲`, `.⊳`, `.⊴`, `.⊵`, `.⊶`, `.⊷`, `.⋍`, `.⋐`, `.⋑`, `.⋕`, `.⋖`, `.⋗`, `.⋘`, `.⋙`, `.⋚`, `.⋛`, `.⋜`, `.⋝`, `.⋞`, `.⋟`, `.⋠`, `.⋡`, `.⋢`, `.⋣`, `.⋤`, `.⋥`, `.⋦`, `.⋧`, `.⋨`, `.⋩`, `.⋪`, `.⋫`, `.⋬`, `.⋭`, `.⋲`, `.⋳`, `.⋴`, `.⋵`, `.⋶`, `.⋷`, `.⋸`, `.⋹`, `.⋺`, `.⋻`, `.⋼`, `.⋽`, `.⋾`, `.⋿`, `.⟈`, `.⟉`, `.⟒`, `.⦷`, `.⧀`, `.⧁`, `.⧡`, `.⧣`, `.⧤`, `.⧥`, `.⩦`, `.⩧`, `.⩪`, `.⩫`, `.⩬`, `.⩭`, `.⩮`, `.⩯`, `.⩰`, `.⩱`, `.⩲`, `.⩳`, `.⩵`, `.⩶`, `.⩷`, `.⩸`, `.⩹`, `.⩺`, `.⩻`, `.⩼`, `.⩽`, `.⩾`, `.⩿`, `.⪀`, `.⪁`, `.⪂`, `.⪃`, `.⪄`, `.⪅`, `.⪆`, `.⪇`, `.⪈`, `.⪉`, `.⪊`, `.⪋`, `.⪌`, `.⪍`, `.⪎`, `.⪏`, `.⪐`, `.⪑`, `.⪒`, `.⪓`, `.⪔`, `.⪕`, `.⪖`, `.⪗`, `.⪘`, `.⪙`, `.⪚`, `.⪛`, `.⪜`, `.⪝`, `.⪞`, `.⪟`, `.⪠`, `.⪡`, `.⪢`, `.⪣`, `.⪤`, `.⪥`, `.⪦`, `.⪧`, `.⪨`, `.⪩`, `.⪪`, `.⪫`, `.⪬`, `.⪭`, `.⪮`, `.⪯`, `.⪰`, `.⪱`, `.⪲`, `.⪳`, `.⪴`, `.⪵`, `.⪶`, `.⪷`, `.⪸`, `.⪹`, `.⪺`, `.⪻`, `.⪼`, `.⪽`, `.⪾`, `.⪿`, `.⫀`, `.⫁`, `.⫂`, `.⫃`, `.⫄`, `.⫅`, `.⫆`, `.⫇`, `.⫈`, `.⫉`, `.⫊`, `.⫋`, `.⫌`, `.⫍`, `.⫎`, `.⫏`, `.⫐`, `.⫑`, `.⫒`, `.⫓`, `.⫔`, `.⫕`, `.⫖`, `.⫗`, `.⫘`, `.⫙`, `.⫷`, `.⫸`, `.⫹`, `.⫺`, `.⊢`, `.⊣`, `.⟂`, `.<:`, `.>:`, `.<|`, `.|>`, `.…`, `.⁝`, `.⋮`, `.⋱`, `.⋰`, `.⋯`, `.+`, `.-`, `.¦`, `.|`, `.⊕`, `.⊖`, `.⊞`, `.⊟`, `.++`, `.∪`, `.∨`, `.⊔`, `.±`, `.∓`, `.∔`, `.∸`, `.≏`, `.⊎`, `.⊻`, `.⊽`, `.⋎`, `.⋓`, `.⧺`, `.⧻`, `.⨈`, `.⨢`, `.⨣`, `.⨤`, `.⨥`, `.⨦`, `.⨧`, `.⨨`, `.⨩`, `.⨪`, `.⨫`, `.⨬`, `.⨭`, `.⨮`, `.⨹`, `.⨺`, `.⩁`, `.⩂`, `.⩅`, `.⩊`, `.⩌`, `.⩏`, `.⩐`, `.⩒`, `.⩔`, `.⩖`, `.⩗`, `.⩛`, `.⩝`, `.⩡`, `.⩢`, `.⩣`, `.*`, `./`, `.⌿`, `.÷`, `.%`, `.&`, `.⋅`, `.∘`, `.×`, `.\`, `.∩`, `.∧`, `.⊗`, `.⊘`, `.⊙`, `.⊚`, `.⊛`, `.⊠`, `.⊡`, `.⊓`, `.∗`, `.∙`, `.∤`, `.⅋`, `.≀`, `.⊼`, `.⋄`, `.⋆`, `.⋇`, `.⋉`, `.⋊`, `.⋋`, `.⋌`, `.⋏`, `.⋒`, `.⟑`, `.⦸`, `.⦼`, `.⦾`, `.⦿`, `.⧶`, `.⧷`, `.⨇`, `.⨰`, `.⨱`, `.⨲`, `.⨳`, `.⨴`, `.⨵`, `.⨶`, `.⨷`, `.⨸`, `.⨻`, `.⨼`, `.⨽`, `.⩀`, `.⩃`, `.⩄`, `.⩋`, `.⩍`, `.⩎`, `.⩑`, `.⩓`, `.⩕`, `.⩘`, `.⩚`, `.⩜`, `.⩞`, `.⩟`, `.⩠`, `.⫛`, `.⊍`, `.▷`, `.⨝`, `.⟕`, `.⟖`, `.⟗`, `.⨟`, `.//`, `.>>`, `.<<`, `.>>>`, `.^`, `.↑`, `.↓`, `.⇵`, `.⟰`, `.⟱`, `.⤈`, `.⤉`, `.⤊`, `.⤋`, `.⤒`, `.⤓`, `.⥉`, `.⥌`, `.⥍`, `.⥏`, `.⥑`, `.⥔`, `.⥕`, `.⥘`, `.⥙`, `.⥜`, `.⥝`, `.⥠`, `.⥡`, `.⥣`, `.⥥`, `.⥮`, `.⥯`, `.↑`, `.↓`, `.!`, `.¬`, `.√`, `.∛`, `.∜`), Operator, nil}, + {Words(``, ``, `...`, `..`), 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}, + {`(?<=[.\w)\]])(\'[²³¹ʰʲʳʷʸˡˢˣᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁᵂᵃᵇᵈᵉᵍᵏᵐᵒᵖᵗᵘᵛᵝᵞᵟᵠᵡᵢᵣᵤᵥᵦᵧᵨᵩᵪᶜᶠᶥᶦᶫᶰᶸᶻᶿ′″‴‵‶‷⁗⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₐₑₒₓₕₖₗₘₙₚₛₜⱼⱽ]*)+`, Operator, nil}, + {`(raw)(""")`, ByGroups(LiteralStringAffix, LiteralString), Push("tqrawstring")}, + {`(raw)(")`, ByGroups(LiteralStringAffix, LiteralString), Push("rawstring")}, + {`(r)(""")`, ByGroups(LiteralStringAffix, LiteralStringRegex), Push("tqregex")}, + {`(r)(")`, ByGroups(LiteralStringAffix, LiteralStringRegex), Push("regex")}, + {`((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))?(""")`, ByGroups(LiteralStringAffix, LiteralString), Push("tqstring")}, + {`((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))?(")`, ByGroups(LiteralStringAffix, LiteralString), Push("string")}, + {"((?:[a-zA-Z_\u00a1-\U0010ffff][a-zA-Z_0-9!\u00a1-\U0010ffff]*))?(```)", ByGroups(LiteralStringAffix, LiteralStringBacktick), Push("tqcommand")}, + {"((?:[a-zA-Z_\u00a1-\U0010ffff][a-zA-Z_0-9!\u00a1-\U0010ffff]*))?(`)", ByGroups(LiteralStringAffix, LiteralStringBacktick), Push("command")}, + {`((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))(\{)`, ByGroups(KeywordType, Punctuation), Push("curly")}, + {`(where)(\s+)((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))`, ByGroups(Keyword, Text, KeywordType), nil}, + {`(\{)`, Punctuation, Push("curly")}, + {`(abstract[ \t]+type|primitive[ \t]+type|mutable[ \t]+struct|struct)([\s()]+)((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*))`, ByGroups(Keyword, Text, KeywordType), nil}, + {`@(?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*)`, NameDecorator, nil}, + {Words(`@`, `[²³¹ʰʲʳʷʸˡˢˣᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁᵂᵃᵇᵈᵉᵍᵏᵐᵒᵖᵗᵘᵛᵝᵞᵟᵠᵡᵢᵣᵤᵥᵦᵧᵨᵩᵪᶜᶠᶥᶦᶫᶰᶸᶻᶿ′″‴‵‶‷⁗⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₐₑₒₓₕₖₗₘₙₚₛₜⱼⱽ]*`, `->`, `:=`, `$=`, `?`, `||`, `&&`, `:`, `$`, `::`, `..`, `.`, `=`, `+=`, `-=`, `*=`, `/=`, `//=`, `\=`, `^=`, `÷=`, `%=`, `<<=`, `>>=`, `>>>=`, `|=`, `&=`, `⊻=`, `≔`, `⩴`, `≕'`, `~`, `=>`, `→`, `↔`, `↚`, `↛`, `↞`, `↠`, `↢`, `↣`, `↦`, `↤`, `↮`, `⇎`, `⇍`, `⇏`, `⇐`, `⇒`, `⇔`, `⇴`, `⇶`, `⇷`, `⇸`, `⇹`, `⇺`, `⇻`, `⇼`, `⇽`, `⇾`, `⇿`, `⟵`, `⟶`, `⟷`, `⟹`, `⟺`, `⟻`, `⟼`, `⟽`, `⟾`, `⟿`, `⤀`, `⤁`, `⤂`, `⤃`, `⤄`, `⤅`, `⤆`, `⤇`, `⤌`, `⤍`, `⤎`, `⤏`, `⤐`, `⤑`, `⤔`, `⤕`, `⤖`, `⤗`, `⤘`, `⤝`, `⤞`, `⤟`, `⤠`, `⥄`, `⥅`, `⥆`, `⥇`, `⥈`, `⥊`, `⥋`, `⥎`, `⥐`, `⥒`, `⥓`, `⥖`, `⥗`, `⥚`, `⥛`, `⥞`, `⥟`, `⥢`, `⥤`, `⥦`, `⥧`, `⥨`, `⥩`, `⥪`, `⥫`, `⥬`, `⥭`, `⥰`, `⧴`, `⬱`, `⬰`, `⬲`, `⬳`, `⬴`, `⬵`, `⬶`, `⬷`, `⬸`, `⬹`, `⬺`, `⬻`, `⬼`, `⬽`, `⬾`, `⬿`, `⭀`, `⭁`, `⭂`, `⭃`, `⭄`, `⭇`, `⭈`, `⭉`, `⭊`, `⭋`, `⭌`, `←`, `→`, `⇜`, `⇝`, `↜`, `↝`, `↩`, `↪`, `↫`, `↬`, `↼`, `↽`, `⇀`, `⇁`, `⇄`, `⇆`, `⇇`, `⇉`, `⇋`, `⇌`, `⇚`, `⇛`, `⇠`, `⇢`, `↷`, `↶`, `↺`, `↻`, `-->`, `<--`, `<-->`, `>`, `<`, `>=`, `≥`, `<=`, `≤`, `==`, `===`, `≡`, `!=`, `≠`, `!==`, `≢`, `∈`, `∉`, `∋`, `∌`, `⊆`, `⊈`, `⊂`, `⊄`, `⊊`, `∝`, `∊`, `∍`, `∥`, `∦`, `∷`, `∺`, `∻`, `∽`, `∾`, `≁`, `≃`, `≂`, `≄`, `≅`, `≆`, `≇`, `≈`, `≉`, `≊`, `≋`, `≌`, `≍`, `≎`, `≐`, `≑`, `≒`, `≓`, `≖`, `≗`, `≘`, `≙`, `≚`, `≛`, `≜`, `≝`, `≞`, `≟`, `≣`, `≦`, `≧`, `≨`, `≩`, `≪`, `≫`, `≬`, `≭`, `≮`, `≯`, `≰`, `≱`, `≲`, `≳`, `≴`, `≵`, `≶`, `≷`, `≸`, `≹`, `≺`, `≻`, `≼`, `≽`, `≾`, `≿`, `⊀`, `⊁`, `⊃`, `⊅`, `⊇`, `⊉`, `⊋`, `⊏`, `⊐`, `⊑`, `⊒`, `⊜`, `⊩`, `⊬`, `⊮`, `⊰`, `⊱`, `⊲`, `⊳`, `⊴`, `⊵`, `⊶`, `⊷`, `⋍`, `⋐`, `⋑`, `⋕`, `⋖`, `⋗`, `⋘`, `⋙`, `⋚`, `⋛`, `⋜`, `⋝`, `⋞`, `⋟`, `⋠`, `⋡`, `⋢`, `⋣`, `⋤`, `⋥`, `⋦`, `⋧`, `⋨`, `⋩`, `⋪`, `⋫`, `⋬`, `⋭`, `⋲`, `⋳`, `⋴`, `⋵`, `⋶`, `⋷`, `⋸`, `⋹`, `⋺`, `⋻`, `⋼`, `⋽`, `⋾`, `⋿`, `⟈`, `⟉`, `⟒`, `⦷`, `⧀`, `⧁`, `⧡`, `⧣`, `⧤`, `⧥`, `⩦`, `⩧`, `⩪`, `⩫`, `⩬`, `⩭`, `⩮`, `⩯`, `⩰`, `⩱`, `⩲`, `⩳`, `⩵`, `⩶`, `⩷`, `⩸`, `⩹`, `⩺`, `⩻`, `⩼`, `⩽`, `⩾`, `⩿`, `⪀`, `⪁`, `⪂`, `⪃`, `⪄`, `⪅`, `⪆`, `⪇`, `⪈`, `⪉`, `⪊`, `⪋`, `⪌`, `⪍`, `⪎`, `⪏`, `⪐`, `⪑`, `⪒`, `⪓`, `⪔`, `⪕`, `⪖`, `⪗`, `⪘`, `⪙`, `⪚`, `⪛`, `⪜`, `⪝`, `⪞`, `⪟`, `⪠`, `⪡`, `⪢`, `⪣`, `⪤`, `⪥`, `⪦`, `⪧`, `⪨`, `⪩`, `⪪`, `⪫`, `⪬`, `⪭`, `⪮`, `⪯`, `⪰`, `⪱`, `⪲`, `⪳`, `⪴`, `⪵`, `⪶`, `⪷`, `⪸`, `⪹`, `⪺`, `⪻`, `⪼`, `⪽`, `⪾`, `⪿`, `⫀`, `⫁`, `⫂`, `⫃`, `⫄`, `⫅`, `⫆`, `⫇`, `⫈`, `⫉`, `⫊`, `⫋`, `⫌`, `⫍`, `⫎`, `⫏`, `⫐`, `⫑`, `⫒`, `⫓`, `⫔`, `⫕`, `⫖`, `⫗`, `⫘`, `⫙`, `⫷`, `⫸`, `⫹`, `⫺`, `⊢`, `⊣`, `⟂`, `<:`, `>:`, `<|`, `|>`, `…`, `⁝`, `⋮`, `⋱`, `⋰`, `⋯`, `+`, `-`, `¦`, `|`, `⊕`, `⊖`, `⊞`, `⊟`, `++`, `∪`, `∨`, `⊔`, `±`, `∓`, `∔`, `∸`, `≏`, `⊎`, `⊻`, `⊽`, `⋎`, `⋓`, `⧺`, `⧻`, `⨈`, `⨢`, `⨣`, `⨤`, `⨥`, `⨦`, `⨧`, `⨨`, `⨩`, `⨪`, `⨫`, `⨬`, `⨭`, `⨮`, `⨹`, `⨺`, `⩁`, `⩂`, `⩅`, `⩊`, `⩌`, `⩏`, `⩐`, `⩒`, `⩔`, `⩖`, `⩗`, `⩛`, `⩝`, `⩡`, `⩢`, `⩣`, `*`, `/`, `⌿`, `÷`, `%`, `&`, `⋅`, `∘`, `×`, `\`, `∩`, `∧`, `⊗`, `⊘`, `⊙`, `⊚`, `⊛`, `⊠`, `⊡`, `⊓`, `∗`, `∙`, `∤`, `⅋`, `≀`, `⊼`, `⋄`, `⋆`, `⋇`, `⋉`, `⋊`, `⋋`, `⋌`, `⋏`, `⋒`, `⟑`, `⦸`, `⦼`, `⦾`, `⦿`, `⧶`, `⧷`, `⨇`, `⨰`, `⨱`, `⨲`, `⨳`, `⨴`, `⨵`, `⨶`, `⨷`, `⨸`, `⨻`, `⨼`, `⨽`, `⩀`, `⩃`, `⩄`, `⩋`, `⩍`, `⩎`, `⩑`, `⩓`, `⩕`, `⩘`, `⩚`, `⩜`, `⩞`, `⩟`, `⩠`, `⫛`, `⊍`, `▷`, `⨝`, `⟕`, `⟖`, `⟗`, `⨟`, `//`, `>>`, `<<`, `>>>`, `^`, `↑`, `↓`, `⇵`, `⟰`, `⟱`, `⤈`, `⤉`, `⤊`, `⤋`, `⤒`, `⤓`, `⥉`, `⥌`, `⥍`, `⥏`, `⥑`, `⥔`, `⥕`, `⥘`, `⥙`, `⥜`, `⥝`, `⥠`, `⥡`, `⥣`, `⥥`, `⥮`, `⥯`, `↑`, `↓`, `!`, `¬`, `√`, `∛`, `∜`), NameDecorator, nil}, + {Words(``, `\b`, `baremodule`, `begin`, `break`, `catch`, `ccall`, `const`, `continue`, `do`, `else`, `elseif`, `end`, `export`, `finally`, `for`, `function`, `global`, `if`, `import`, `in`, `isa`, `let`, `local`, `macro`, `module`, `quote`, `return`, `try`, `using`, `where`, `while`), Keyword, nil}, + {Words(``, `\b`, `AbstractArray`, `AbstractChannel`, `AbstractChar`, `AbstractDict`, `AbstractDisplay`, `AbstractFloat`, `AbstractIrrational`, `AbstractMatch`, `AbstractMatrix`, `AbstractPattern`, `AbstractRange`, `AbstractSet`, `AbstractString`, `AbstractUnitRange`, `AbstractVecOrMat`, `AbstractVector`, `Any`, `ArgumentError`, `Array`, `AssertionError`, `BigFloat`, `BigInt`, `BitArray`, `BitMatrix`, `BitSet`, `BitVector`, `Bool`, `BoundsError`, `CapturedException`, `CartesianIndex`, `CartesianIndices`, `Cchar`, `Cdouble`, `Cfloat`, `Channel`, `Char`, `Cint`, `Cintmax_t`, `Clong`, `Clonglong`, `Cmd`, `Colon`, `Complex`, `ComplexF16`, `ComplexF32`, `ComplexF64`, `ComposedFunction`, `CompositeException`, `Condition`, `Cptrdiff_t`, `Cshort`, `Csize_t`, `Cssize_t`, `Cstring`, `Cuchar`, `Cuint`, `Cuintmax_t`, `Culong`, `Culonglong`, `Cushort`, `Cvoid`, `Cwchar_t`, `Cwstring`, `DataType`, `DenseArray`, `DenseMatrix`, `DenseVecOrMat`, `DenseVector`, `Dict`, `DimensionMismatch`, `Dims`, `DivideError`, `DomainError`, `EOFError`, `Enum`, `ErrorException`, `Exception`, `ExponentialBackOff`, `Expr`, `Float16`, `Float32`, `Float64`, `Function`, `GlobalRef`, `HTML`, `IO`, `IOBuffer`, `IOContext`, `IOStream`, `IdDict`, `IndexCartesian`, `IndexLinear`, `IndexStyle`, `InexactError`, `InitError`, `Int`, `Int128`, `Int16`, `Int32`, `Int64`, `Int8`, `Integer`, `InterruptException`, `InvalidStateException`, `Irrational`, `KeyError`, `LinRange`, `LineNumberNode`, `LinearIndices`, `LoadError`, `MIME`, `Matrix`, `Method`, `MethodError`, `Missing`, `MissingException`, `Module`, `NTuple`, `NamedTuple`, `Nothing`, `Number`, `OrdinalRange`, `OutOfMemoryError`, `OverflowError`, `Pair`, `PartialQuickSort`, `PermutedDimsArray`, `Pipe`, `ProcessFailedException`, `Ptr`, `QuoteNode`, `Rational`, `RawFD`, `ReadOnlyMemoryError`, `Real`, `ReentrantLock`, `Ref`, `Regex`, `RegexMatch`, `RoundingMode`, `SegmentationFault`, `Set`, `Signed`, `Some`, `StackOverflowError`, `StepRange`, `StepRangeLen`, `StridedArray`, `StridedMatrix`, `StridedVecOrMat`, `StridedVector`, `String`, `StringIndexError`, `SubArray`, `SubString`, `SubstitutionString`, `Symbol`, `SystemError`, `Task`, `TaskFailedException`, `Text`, `TextDisplay`, `Timer`, `Tuple`, `Type`, `TypeError`, `TypeVar`, `UInt`, `UInt128`, `UInt16`, `UInt32`, `UInt64`, `UInt8`, `UndefInitializer`, `UndefKeywordError`, `UndefRefError`, `UndefVarError`, `Union`, `UnionAll`, `UnitRange`, `Unsigned`, `Val`, `Vararg`, `VecElement`, `VecOrMat`, `Vector`, `VersionNumber`, `WeakKeyDict`, `WeakRef`), KeywordType, nil}, + {Words(``, `\b`, `ARGS`, `C_NULL`, `DEPOT_PATH`, `ENDIAN_BOM`, `ENV`, `Inf`, `Inf16`, `Inf32`, `Inf64`, `InsertionSort`, `LOAD_PATH`, `MergeSort`, `NaN`, `NaN16`, `NaN32`, `NaN64`, `PROGRAM_FILE`, `QuickSort`, `RoundDown`, `RoundFromZero`, `RoundNearest`, `RoundNearestTiesAway`, `RoundNearestTiesUp`, `RoundToZero`, `RoundUp`, `VERSION`, `devnull`, `false`, `im`, `missing`, `nothing`, `pi`, `stderr`, `stdin`, `stdout`, `true`, `undef`, `π`, `ℯ`), NameBuiltin, nil}, + {`(?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*)`, Name, nil}, + {`(\d+((_\d+)+)?\.(?!\.)(\d+((_\d+)+)?)?|\.\d+((_\d+)+)?)([eEf][+-]?[0-9]+)?`, LiteralNumberFloat, nil}, + {`\d+((_\d+)+)?[eEf][+-]?[0-9]+`, LiteralNumberFloat, nil}, + {`0x[a-fA-F0-9]+((_[a-fA-F0-9]+)+)?(\.([a-fA-F0-9]+((_[a-fA-F0-9]+)+)?)?)?p[+-]?\d+`, LiteralNumberFloat, nil}, + {`0b[01]+((_[01]+)+)?`, LiteralNumberBin, nil}, + {`0o[0-7]+((_[0-7]+)+)?`, LiteralNumberOct, nil}, + {`0x[a-fA-F0-9]+((_[a-fA-F0-9]+)+)?`, LiteralNumberHex, nil}, + {`\d+((_\d+)+)?`, LiteralNumberInteger, nil}, + {Words(``, ``, `.`), Operator, nil}, }, "blockcomment": { {`[^=#]`, CommentMultiline, nil}, @@ -56,40 +68,67 @@ var Julia = internal.Register(MustNewLexer( {`=#`, 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}, + "curly": { + {`\{`, Punctuation, Push()}, + {`\}`, Punctuation, Pop(1)}, + {`(?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*)`, KeywordType, nil}, + Include("root"), }, - "tqstring": { + "tqrawstring": { {`"""`, LiteralString, Pop(1)}, - {`\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)`, LiteralStringEscape, nil}, - {`\$(?:[a-zA-Z_¡-￿]|[𐀀-􏿿])(?:[a-zA-Z_0-9¡-￿]|[𐀀-􏿿])*!*`, LiteralStringInterpol, nil}, + {`([^"]|"[^"][^"])+`, LiteralString, nil}, + }, + "rawstring": { + {`"`, LiteralString, Pop(1)}, + {`\\"`, LiteralStringEscape, nil}, + {`([^"\\]|\\[^"])+`, LiteralString, nil}, + }, + "interp": { + {`\$(?:[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"), }, - }, -)) + "string": { + {`(")((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*)|\d+)?`, ByGroups(LiteralString, LiteralStringAffix), Pop(1)}, + {`\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)`, LiteralStringEscape, nil}, + Include("interp"), + {`%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]`, LiteralStringInterpol, nil}, + {`[^"$%\\]+`, LiteralString, nil}, + {`.`, LiteralString, nil}, + }, + "tqstring": { + {`(""")((?:[a-zA-Z_¡-􏿿][a-zA-Z_0-9!¡-􏿿]*)|\d+)?`, ByGroups(LiteralString, LiteralStringAffix), Pop(1)}, + {`\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)`, LiteralStringEscape, nil}, + Include("interp"), + {`[^"$%\\]+`, LiteralString, nil}, + {`.`, LiteralString, nil}, + }, + "regex": { + {`(")([imsxa]*)?`, ByGroups(LiteralStringRegex, LiteralStringAffix), Pop(1)}, + {`\\"`, LiteralStringRegex, nil}, + {`[^\\"]+`, LiteralStringRegex, nil}, + }, + "tqregex": { + {`(""")([imsxa]*)?`, ByGroups(LiteralStringRegex, LiteralStringAffix), Pop(1)}, + {`[^"]+`, LiteralStringRegex, nil}, + }, + "command": { + {"(`)((?:[a-zA-Z_\u00a1-\U0010ffff][a-zA-Z_0-9!\u00a1-\U0010ffff]*)|\\d+)?", ByGroups(LiteralStringBacktick, LiteralStringAffix), Pop(1)}, + {"\\\\[`$]", LiteralStringEscape, nil}, + Include("interp"), + {"[^\\\\`$]+", LiteralStringBacktick, nil}, + {`.`, LiteralStringBacktick, nil}, + }, + "tqcommand": { + {"(```)((?:[a-zA-Z_\u00a1-\U0010ffff][a-zA-Z_0-9!\u00a1-\U0010ffff]*)|\\d+)?", ByGroups(LiteralStringBacktick, LiteralStringAffix), Pop(1)}, + {`\\\$`, LiteralStringEscape, nil}, + Include("interp"), + {"[^\\\\`$]+", LiteralStringBacktick, nil}, + {`.`, LiteralStringBacktick, nil}, + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/j/jungle.go b/backend/vendor/github.com/alecthomas/chroma/lexers/j/jungle.go index 83d46a48..5dbda9fb 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/j/jungle.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/j/jungle.go @@ -5,14 +5,18 @@ import ( "github.com/alecthomas/chroma/lexers/internal" ) -var Jungle = internal.Register(MustNewLexer( +var Jungle = internal.Register(MustNewLazyLexer( &Config{ Name: "Jungle", Aliases: []string{"jungle"}, Filenames: []string{"*.jungle"}, MimeTypes: []string{"text/x-jungle"}, }, - Rules{ + jungleRules, +)) + +func jungleRules() Rules { + return Rules{ "root": { {`[^\S\n]+`, Text, nil}, {`\n`, Text, nil}, @@ -46,5 +50,5 @@ var Jungle = internal.Register(MustNewLexer( {`[a-zA-Z_]\w*`, Name, nil}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go b/backend/vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go index 56b79660..671f85e0 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go @@ -5,10 +5,8 @@ import ( "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\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\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\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" - // Kotlin lexer. -var Kotlin = internal.Register(MustNewLexer( +var Kotlin = internal.Register(MustNewLazyLexer( &Config{ Name: "Kotlin", Aliases: []string{"kotlin"}, @@ -16,7 +14,13 @@ var Kotlin = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-kotlin"}, DotAll: true, }, - Rules{ + kotlinRules, +)) + +func kotlinRules() Rules { + const 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\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\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\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" + + return Rules{ "root": { {`^\s*\[.*?\]`, NameAttribute, nil}, {`[^\S\n]+`, Text, nil}, @@ -24,32 +28,71 @@ var Kotlin = internal.Register(MustNewLexer( {`//[^\n]*\n?`, CommentSingle, nil}, {`/[*].*?[*]/`, CommentMultiline, nil}, {`\n`, Text, nil}, - {`::|!!|\?[:.]`, Operator, nil}, - {`[~!%^&*()+=|\[\]:;,.<>/?-]`, Punctuation, nil}, + {`!==|!in|!is|===`, Operator, nil}, + {`%=|&&|\*=|\+\+|\+=|--|-=|->|\.\.|\/=|::|<=|==|>=|!!|!=|\|\||\?[:.]`, Operator, nil}, + {`[~!%^&*()+=|\[\]:;,.<>\/?-]`, Punctuation, nil}, {`[{}]`, Punctuation, nil}, - {`"""[^"]*"""`, LiteralString, nil}, - {`"(\\\\|\\"|[^"\n])*["\n]`, LiteralString, nil}, + {`"""`, LiteralString, Push("rawstring")}, + {`"`, LiteralStringDouble, Push("string")}, + {`(')(\\u[0-9a-fA-F]{4})(')`, ByGroups(LiteralStringChar, LiteralStringEscape, LiteralStringChar), 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}, + {`(fun)(\s+)`, ByGroups(Keyword, Text), Push("function")}, + {`(abstract|actual|annotation|as|as\?|break|by|catch|class|companion|const|constructor|continue|crossinline|data|delegate|do|dynamic|else|enum|expect|external|false|field|file|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|it|lateinit|noinline|null|object|open|operator|out|override|package|param|private|property|protected|public|receiver|reified|return|sealed|set|setparam|super|suspend|tailrec|this|throw|true|try|typealias|typeof|val|var|vararg|when|where|while)\b`, Keyword, nil}, + {`@[` + kotlinIdentifier + `]+`, NameDecorator, nil}, + {`[` + kotlinIdentifier + `]+`, Name, nil}, }, "package": { {`\S+`, NameNamespace, Pop(1)}, }, "class": { - {"(@?[" + kotlinIdentifier + "]*`)", NameClass, Pop(1)}, + // \x60 is the back tick character (`) + {`\x60[^\x60]+?\x60`, NameClass, Pop(1)}, + {`[` + kotlinIdentifier + `]+`, NameClass, Pop(1)}, }, "property": { - {"(@?[" + kotlinIdentifier + " ]*`)", NameProperty, Pop(1)}, + {`\x60[^\x60]+?\x60`, NameProperty, Pop(1)}, + {`[` + kotlinIdentifier + `]+`, NameProperty, Pop(1)}, + }, + "generics-specification": { + {`<`, Punctuation, Push("generics-specification")}, // required for generics inside generics e.g. > + {`>`, Punctuation, Pop(1)}, + {`[,:*?]`, Punctuation, nil}, + {`(in|out|reified)`, Keyword, nil}, + {`\x60[^\x60]+?\x60`, NameClass, nil}, + {`[` + kotlinIdentifier + `]+`, NameClass, nil}, + {`\s+`, Text, nil}, }, "function": { - {"(@?[" + kotlinIdentifier + " ]*`)", NameFunction, Pop(1)}, + {`<`, Punctuation, Push("generics-specification")}, + {`\x60[^\x60]+?\x60`, NameFunction, Pop(1)}, + {`[` + kotlinIdentifier + `]+`, NameFunction, Pop(1)}, + {`\s+`, Text, nil}, }, - }, -)) + "rawstring": { + // raw strings don't allow character escaping + {`"""`, LiteralString, Pop(1)}, + {`(?:[^$"]+|\"{1,2}[^"])+`, LiteralString, nil}, + Include("string-interpol"), + // remaining dollar signs are just a string + {`\$`, LiteralString, nil}, + }, + "string": { + {`\\[tbnr'"\\\$]`, LiteralStringEscape, nil}, + {`\\u[0-9a-fA-F]{4}`, LiteralStringEscape, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + Include("string-interpol"), + {`[^\n\\"$]+`, LiteralStringDouble, nil}, + // remaining dollar signs are just a string + {`\$`, LiteralStringDouble, nil}, + }, + "string-interpol": { + {`\$[` + kotlinIdentifier + `]+`, LiteralStringInterpol, nil}, + {`\${[^}\n]*}`, LiteralStringInterpol, nil}, + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/l/lighttpd.go b/backend/vendor/github.com/alecthomas/chroma/lexers/l/lighttpd.go index 799b77c3..6d83298b 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/l/lighttpd.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/l/lighttpd.go @@ -6,14 +6,18 @@ import ( ) // Lighttpd Configuration File lexer. -var Lighttpd = internal.Register(MustNewLexer( +var Lighttpd = internal.Register(MustNewLazyLexer( &Config{ Name: "Lighttpd configuration file", Aliases: []string{"lighty", "lighttpd"}, Filenames: []string{}, MimeTypes: []string{"text/x-lighttpd-conf"}, }, - Rules{ + lighttpdRules, +)) + +func lighttpdRules() Rules { + return Rules{ "root": { {`#.*\n`, CommentSingle, nil}, {`/\S*`, Name, nil}, @@ -26,5 +30,5 @@ var Lighttpd = internal.Register(MustNewLexer( {`"([^"\\]*(?:\\.[^"\\]*)*)"`, LiteralStringDouble, nil}, {`\s+`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/l/llvm.go b/backend/vendor/github.com/alecthomas/chroma/lexers/l/llvm.go index 8f5b0b12..e9ea319e 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/l/llvm.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/l/llvm.go @@ -6,14 +6,18 @@ import ( ) // Llvm lexer. -var Llvm = internal.Register(MustNewLexer( +var Llvm = internal.Register(MustNewLazyLexer( &Config{ Name: "LLVM", Aliases: []string{"llvm"}, Filenames: []string{"*.ll"}, MimeTypes: []string{"text/x-llvm"}, }, - Rules{ + llvmRules, +)) + +func llvmRules() Rules { + return Rules{ "root": { Include("whitespace"), {`([-a-zA-Z$._][\w\-$.]*|"[^"]*?")\s*:`, NameLabel, nil}, @@ -39,5 +43,5 @@ var Llvm = internal.Register(MustNewLexer( {Words(``, ``, `void`, `half`, `float`, `double`, `x86_fp80`, `fp128`, `ppc_fp128`, `label`, `metadata`, `token`), KeywordType, nil}, {`i[1-9]\d*`, Keyword, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/l/lua.go b/backend/vendor/github.com/alecthomas/chroma/lexers/l/lua.go index c397de06..db574a1b 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/l/lua.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/l/lua.go @@ -6,14 +6,18 @@ import ( ) // Lua lexer. -var Lua = internal.Register(MustNewLexer( +var Lua = internal.Register(MustNewLazyLexer( &Config{ Name: "Lua", Aliases: []string{"lua"}, Filenames: []string{"*.lua", "*.wlua"}, MimeTypes: []string{"text/x-lua", "application/x-lua"}, }, - Rules{ + luaRules, +)) + +func luaRules() Rules { + return Rules{ "root": { {`#!.*`, CommentPreproc, nil}, Default(Push("base")), @@ -71,5 +75,5 @@ var Lua = internal.Register(MustNewLexer( {`"`, LiteralStringDouble, Pop(1)}, {`[^\\"]+`, LiteralStringDouble, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/lexers.go b/backend/vendor/github.com/alecthomas/chroma/lexers/lexers.go index 2897299c..2b429212 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/lexers.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/lexers.go @@ -3,7 +3,7 @@ // Sub-packages contain lexer implementations. package lexers -// nolint: golint +// nolint import ( "github.com/alecthomas/chroma" _ "github.com/alecthomas/chroma/lexers/a" @@ -32,6 +32,7 @@ import ( _ "github.com/alecthomas/chroma/lexers/w" _ "github.com/alecthomas/chroma/lexers/x" _ "github.com/alecthomas/chroma/lexers/y" + _ "github.com/alecthomas/chroma/lexers/z" ) // Registry of Lexers. diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/m/make.go b/backend/vendor/github.com/alecthomas/chroma/lexers/m/make.go index eb9d9e68..905491a6 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/m/make.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/m/make.go @@ -7,7 +7,7 @@ import ( ) // Makefile lexer. -var Makefile = internal.Register(MustNewLexer( +var Makefile = internal.Register(MustNewLazyLexer( &Config{ Name: "Base Makefile", Aliases: []string{"make", "makefile", "mf", "bsdmake"}, @@ -15,7 +15,11 @@ var Makefile = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-makefile"}, EnsureNL: true, }, - Rules{ + makefileRules, +)) + +func makefileRules() Rules { + return Rules{ "root": { {`^(?:[\t ]+.*\n|\n)+`, Using(Bash), nil}, {`\$[<@$+%?|*]`, Keyword, nil}, @@ -50,5 +54,5 @@ var Makefile = internal.Register(MustNewLexer( {`\n`, Text, Pop(1)}, {`.`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/m/mako.go b/backend/vendor/github.com/alecthomas/chroma/lexers/m/mako.go index f7c140d5..6f777dd5 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/m/mako.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/m/mako.go @@ -7,14 +7,18 @@ import ( ) // Mako lexer. -var Mako = internal.Register(MustNewLexer( +var Mako = internal.Register(MustNewLazyLexer( &Config{ Name: "Mako", Aliases: []string{"mako"}, Filenames: []string{"*.mao"}, MimeTypes: []string{"application/x-mako"}, }, - Rules{ + makoRules, +)) + +func makoRules() Rules { + return 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}, @@ -56,5 +60,5 @@ var Mako = internal.Register(MustNewLexer( {`'.*?'`, LiteralString, Pop(1)}, {`[^\s>]+`, LiteralString, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/m/markdown.go b/backend/vendor/github.com/alecthomas/chroma/lexers/m/markdown.go index dd78ec08..e50e4702 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/m/markdown.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/m/markdown.go @@ -7,14 +7,18 @@ import ( ) // Markdown lexer. -var Markdown = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( +var Markdown = internal.Register(DelegatingLexer(h.HTML, MustNewLazyLexer( &Config{ Name: "markdown", Aliases: []string{"md", "mkd"}, Filenames: []string{"*.md", "*.mkd", "*.markdown"}, MimeTypes: []string{"text/x-markdown"}, }, - Rules{ + markdownRules, +))) + +func markdownRules() Rules { + return Rules{ "root": { {`^(#[^#].+\n)`, ByGroups(GenericHeading), nil}, {`^(#{2,6}.+\n)`, ByGroups(GenericSubheading), nil}, @@ -23,7 +27,8 @@ var Markdown = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( {`^(\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]*?)(^```$)", + { + "^(```)(\\w+)(\\n)([\\w\\W]*?)(^```$)", UsingByGroup( internal.Get, 2, 4, @@ -35,7 +40,7 @@ var Markdown = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( }, "inline": { {`\\.`, Text, nil}, - {`(\s)([*_][^*_]+[*_])(\W|\n)`, ByGroups(Text, GenericEmph, Text), nil}, + {`(\s)(\*|_)((?:(?!\2).)*)(\2)((?=\W|\n))`, ByGroups(Text, GenericEmph, GenericEmph, GenericEmph, Text), nil}, {`(\s)((\*\*|__).*?)\3((?=\W|\n))`, ByGroups(Text, GenericStrong, GenericStrong, Text), nil}, {`(\s)(~~[^~]+~~)((?=\W|\n))`, ByGroups(Text, GenericDeleted, Text), nil}, {"`[^`]+`", LiteralStringBacktick, nil}, @@ -44,5 +49,5 @@ var Markdown = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( {`[^\\\s]+`, Other, nil}, {`.|\n`, Other, nil}, }, - }, -))) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/m/mason.go b/backend/vendor/github.com/alecthomas/chroma/lexers/m/mason.go index 5c70ab0a..bc48f5ca 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/m/mason.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/m/mason.go @@ -8,7 +8,7 @@ import ( ) // Mason lexer. -var Mason = internal.Register(MustNewLexer( +var Mason = internal.Register(MustNewLazyLexer( &Config{ Name: "Mason", Aliases: []string{"mason"}, @@ -16,7 +16,11 @@ var Mason = internal.Register(MustNewLexer( MimeTypes: []string{"application/x-mason"}, Priority: 0.1, }, - Rules{ + masonRules, +)) + +func masonRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`(<%doc>)(.*?)()(?s)`, ByGroups(NameTag, CommentMultiline, NameTag), nil}, @@ -39,5 +43,5 @@ var Mason = internal.Register(MustNewLexer( \Z # end of string )`, ByGroups(Using(HTML), Operator), nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/m/mathematica.go b/backend/vendor/github.com/alecthomas/chroma/lexers/m/mathematica.go index 3d1f641f..ed1ea24b 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/m/mathematica.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/m/mathematica.go @@ -6,14 +6,18 @@ import ( ) // Mathematica lexer. -var Mathematica = internal.Register(MustNewLexer( +var Mathematica = internal.Register(MustNewLazyLexer( &Config{ Name: "Mathematica", Aliases: []string{"mathematica", "mma", "nb"}, Filenames: []string{"*.nb", "*.cdf", "*.nbp", "*.ma"}, MimeTypes: []string{"application/mathematica", "application/vnd.wolfram.mathematica", "application/vnd.wolfram.mathematica.package", "application/vnd.wolfram.cdf"}, }, - Rules{ + mathematicaRules, +)) + +func mathematicaRules() Rules { + return Rules{ "root": { {`(?s)\(\*.*?\*\)`, Comment, nil}, {"([a-zA-Z]+[A-Za-z0-9]*`)", NameNamespace, nil}, @@ -28,5 +32,5 @@ var Mathematica = internal.Register(MustNewLexer( {`".*?"`, LiteralString, nil}, {`\s+`, TextWhitespace, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/m/matlab.go b/backend/vendor/github.com/alecthomas/chroma/lexers/m/matlab.go index 5b0baa51..4e98d697 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/m/matlab.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/m/matlab.go @@ -6,14 +6,18 @@ import ( ) // Matlab lexer. -var Matlab = internal.Register(MustNewLexer( +var Matlab = internal.Register(MustNewLazyLexer( &Config{ Name: "Matlab", Aliases: []string{"matlab"}, Filenames: []string{"*.m"}, MimeTypes: []string{"text/matlab"}, }, - Rules{ + matlabRules, +)) + +func matlabRules() Rules { + return Rules{ "root": { {`\n`, Text, nil}, {`^!.*`, LiteralStringOther, nil}, @@ -47,5 +51,5 @@ var Matlab = internal.Register(MustNewLexer( {`(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)`, ByGroups(TextWhitespace, Text, TextWhitespace, Punctuation, TextWhitespace, NameFunction, Punctuation, Text, Punctuation, TextWhitespace), Pop(1)}, {`(\s*)([a-zA-Z_]\w*)`, ByGroups(Text, NameFunction), Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/m/mcfunction.go b/backend/vendor/github.com/alecthomas/chroma/lexers/m/mcfunction.go new file mode 100644 index 00000000..7baec6d6 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/m/mcfunction.go @@ -0,0 +1,109 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// mcfunction lexer. +var MCFunction = internal.Register(MustNewLazyLexer( + &Config{ + Name: "mcfunction", + Aliases: []string{"mcfunction"}, + Filenames: []string{"*.mcfunction"}, + MimeTypes: []string{}, + NotMultiline: true, + DotAll: true, + }, + func() Rules { + return Rules{ + "simplevalue": { + {`(true|false)`, KeywordConstant, nil}, + {`[01]b`, LiteralNumber, nil}, + {`-?(0|[1-9]\d*)(\.\d+[eE](\+|-)?\d+|[eE](\+|-)?\d+|\.\d+)`, LiteralNumberFloat, nil}, + {`(-?\d+)(\.\.)(-?\d+)`, ByGroups(LiteralNumberInteger, Punctuation, LiteralNumberInteger), nil}, + {`-?(0|[1-9]\d*)`, LiteralNumberInteger, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'[^']+'`, LiteralStringSingle, nil}, + {`([!#]?)(\w+)`, ByGroups(Punctuation, Text), nil}, + }, + "nbtobjectattribute": { + Include("nbtvalue"), + {`:`, Punctuation, nil}, + {`,`, Punctuation, Pop(1)}, + {`\}`, Punctuation, Pop(2)}, + }, + "nbtobjectvalue": { + {`("(\\\\|\\"|[^"])*"|[a-zA-Z0-9_]+)`, NameTag, Push("nbtobjectattribute")}, + {`\}`, Punctuation, Pop(1)}, + }, + "nbtarrayvalue": { + Include("nbtvalue"), + {`,`, Punctuation, nil}, + {`\]`, Punctuation, Pop(1)}, + }, + "nbtvalue": { + Include("simplevalue"), + {`\{`, Punctuation, Push("nbtobjectvalue")}, + {`\[`, Punctuation, Push("nbtarrayvalue")}, + }, + "argumentvalue": { + Include("simplevalue"), + {`,`, Punctuation, Pop(1)}, + {`[}\]]`, Punctuation, Pop(2)}, + }, + "argumentlist": { + {`(nbt)(={)`, ByGroups(NameAttribute, Punctuation), Push("nbtobjectvalue")}, + {`([A-Za-z0-9/_!]+)(={)`, ByGroups(NameAttribute, Punctuation), Push("argumentlist")}, + {`([A-Za-z0-9/_!]+)(=)`, ByGroups(NameAttribute, Punctuation), Push("argumentvalue")}, + Include("simplevalue"), + {`,`, Punctuation, nil}, + {`[}\]]`, Punctuation, Pop(1)}, + }, + "root": { + {`#.*?\n`, CommentSingle, nil}, + {Words(`/?`, `\b`, `ability`, `attributes`, `advancement`, + `ban`, `ban-ip`, `banlist`, `bossbar`, + `camerashake`, `classroommode`, `clear`, + `clearspawnpoint`, `clone`, `code`, `collect`, + `createagent`, `data`, `datapack`, `debug`, + `defaultgamemode`, `deop`, `destroy`, `detect`, + `detectredstone`, `difficulty`, `dropall`, + `effect`, `enchant`, `event`, `execute`, + `experience`, `fill`, `flog`, `forceload`, + `function`, `gamemode`, `gamerule`, + `geteduclientinfo`, `give`, `help`, `item`, + `immutableworld`, `kick`, `kill`, `list`, + `locate`, `locatebiome`, `loot`, `me`, `mixer`, + `mobevent`, `move`, `msg`, `music`, `op`, + `pardon`, `particle`, `playanimation`, + `playsound`, `position`, `publish`, + `raytracefog`, `recipe`, `reload`, `remove`, + `replaceitem`, `ride`, `save`, `save-all`, + `save-off`, `save-on`, `say`, `schedule`, + `scoreboard`, `seed`, `setblock`, + `setidletimeout`, `setmaxplayers`, + `setworldspawn`, `spawnpoint`, `spectate`, + `spreadplayers`, `stop`, `stopsound`, + `structure`, `summon`, `tag`, `team`, `teammsg`, + `teleport`, `tell`, `tellraw`, `testfor`, + `testforblock`, `testforblocks`, `tickingarea`, + `time`, `title`, `toggledownfall`, `tp`, + `tpagent`, `transfer`, `transferserver`, + `trigger`, `turn`, `w`, `weather`, `whitelist`, + `worldborder`, `worldbuilder`, `wsserver`, `xp`, + ), KeywordReserved, nil}, + {Words(``, ``, `@p`, `@r`, `@a`, `@e`, `@s`, `@c`, `@v`), + KeywordConstant, nil}, + {`\[`, Punctuation, Push("argumentlist")}, + {`{`, Punctuation, Push("nbtobjectvalue")}, + {`~`, NameBuiltin, nil}, + {`([a-zA-Z_]+:)?[a-zA-Z_]+\b`, Text, nil}, + {`([a-z]+)(\.)([0-9]+)\b`, ByGroups(Text, Punctuation, LiteralNumber), nil}, + {`([<>=]|<=|>=)`, Punctuation, nil}, + Include("simplevalue"), + {`\s+`, TextWhitespace, nil}, + }, + } + }, +)) diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/m/metal.go b/backend/vendor/github.com/alecthomas/chroma/lexers/m/metal.go new file mode 100644 index 00000000..4a9ba2b7 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/m/metal.go @@ -0,0 +1,101 @@ +package m + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Metal lexer. +var Metal = internal.Register(MustNewLazyLexer( + &Config{ + Name: "Metal", + Aliases: []string{"metal"}, + Filenames: []string{"*.metal"}, + MimeTypes: []string{"text/x-metal"}, + EnsureNL: true, + }, + metalRules, +)) + +func metalRules() Rules { + return Rules{ + "statements": { + {Words(``, `\b`, `namespace`, `operator`, `template`, `this`, `using`, `constexpr`), 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}, + {`(\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`, `break`, `case`, `const`, `continue`, `do`, `else`, `enum`, `extern`, `for`, `if`, `return`, `sizeof`, `static`, `struct`, `switch`, `typedef`, `union`, `while`), Keyword, nil}, + {`(bool|float|half|long|ptrdiff_t|size_t|unsigned|u?char|u?int((8|16|32|64)_t)?|u?short)\b`, KeywordType, nil}, + {`(bool|float|half|u?(char|int|long|short))(2|3|4)\b`, KeywordType, nil}, + {`packed_(float|half|long|u?(char|int|short))(2|3|4)\b`, KeywordType, nil}, + {`(float|half)(2|3|4)x(2|3|4)\b`, KeywordType, nil}, + {`atomic_u?int\b`, KeywordType, nil}, + {`(rg?(8|16)(u|s)norm|rgba(8|16)(u|s)norm|srgba8unorm|rgb10a2|rg11b10f|rgb9e5)\b`, KeywordType, nil}, + {`(array|depth(2d|cube)(_array)?|depth2d_ms(_array)?|sampler|texture_buffer|texture(1|2)d(_array)?|texture2d_ms(_array)?|texture3d|texturecube(_array)?|uniform|visible_function_table)\b`, KeywordType, nil}, + {`(true|false|NULL)\b`, NameBuiltin, nil}, + {Words(``, `\b`, `device`, `constant`, `ray_data`, `thread`, `threadgroup`, `threadgroup_imageblock`), Keyword, nil}, + {`([a-zA-Z_]\w*)(\s*)(:)(?!:)`, ByGroups(NameLabel, Text, Punctuation), nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + }, + "root": { + Include("whitespace"), + {`(fragment|kernel|vertex)?((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;{]*)(\{)`, ByGroups(Keyword, UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), Push("function")}, + {`(fragment|kernel|vertex)?((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;]*)(;)`, ByGroups(Keyword, UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), nil}, + Default(Push("statement")), + }, + "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)}, + }, + "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}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/m/myghty.go b/backend/vendor/github.com/alecthomas/chroma/lexers/m/myghty.go index 02a20eae..eac082cf 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/m/myghty.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/m/myghty.go @@ -7,24 +7,28 @@ import ( ) // Myghty lexer. -var Myghty = internal.Register(MustNewLexer( +var Myghty = internal.Register(MustNewLazyLexer( &Config{ Name: "Myghty", Aliases: []string{"myghty"}, Filenames: []string{"*.myt", "autodelegate"}, MimeTypes: []string{"application/x-myghty"}, }, - Rules{ + myghtyRules, +)) + +func myghtyRules() Rules { + return 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}, + {`(<%\w+)(.*?)(>)(.*?)()(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using(Python2), NameTag), nil}, + {`(<&[^|])(.*?)(,.*?)?(&>)`, ByGroups(NameTag, NameFunction, Using(Python2), NameTag), nil}, + {`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Python2), NameTag), nil}, {``, NameTag, nil}, - {`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using(Python), NameTag), nil}, + {`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using(Python2), NameTag), nil}, {`(?<=^)#[^\n]*(\n|\Z)`, Comment, nil}, - {`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using(Python), Other), nil}, + {`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using(Python2), Other), nil}, {`(?sx) (.+?) # anything, followed by: (?: @@ -36,5 +40,5 @@ var Myghty = internal.Register(MustNewLexer( \Z # end of string )`, ByGroups(Other, Operator), nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/m/mysql.go b/backend/vendor/github.com/alecthomas/chroma/lexers/m/mysql.go index 9f47e32a..2738628b 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/m/mysql.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/m/mysql.go @@ -1,12 +1,19 @@ package m import ( + "regexp" + . "github.com/alecthomas/chroma" // nolint "github.com/alecthomas/chroma/lexers/internal" ) +var ( + mysqlAnalyserNameBetweenBacktickRe = regexp.MustCompile("`[a-zA-Z_]\\w*`") + mysqlAnalyserNameBetweenBracketRe = regexp.MustCompile(`\[[a-zA-Z_]\w*\]`) +) + // MySQL lexer. -var MySQL = internal.Register(MustNewLexer( +var MySQL = internal.Register(MustNewLazyLexer( &Config{ Name: "MySQL", Aliases: []string{"mysql"}, @@ -15,9 +22,31 @@ var MySQL = internal.Register(MustNewLexer( NotMultiline: true, CaseInsensitive: true, }, - Rules{ + mySQLRules, +).SetAnalyser(func(text string) float32 { + nameBetweenBacktickCount := len(mysqlAnalyserNameBetweenBacktickRe.FindAllString(text, -1)) + nameBetweenBracketCount := len(mysqlAnalyserNameBetweenBracketRe.FindAllString(text, -1)) + + var result float32 + + // Same logic as above in the TSQL analysis. + dialectNameCount := nameBetweenBacktickCount + nameBetweenBracketCount + if dialectNameCount >= 1 && nameBetweenBacktickCount >= (2*nameBetweenBracketCount) { + // Found at least twice as many `name` as [name]. + result += 0.5 + } else if nameBetweenBacktickCount > nameBetweenBracketCount { + result += 0.2 + } else if nameBetweenBacktickCount > 0 { + result += 0.1 + } + + return result +})) + +func mySQLRules() Rules { + return Rules{ "root": { - {`\s+`, Text, nil}, + {`\s+`, TextWhitespace, nil}, {`(#|--\s+).*\n?`, CommentSingle, nil}, {`/\*`, CommentMultiline, Push("multiline-comments")}, {`[0-9]+`, LiteralNumberInteger, nil}, @@ -25,11 +54,11 @@ var MySQL = internal.Register(MustNewLexer( {`((?:_[a-z0-9]+)?)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("string")}, {`((?:_[a-z0-9]+)?)(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("double-string")}, {"[+*/<>=~!@#%^&|`?-]", 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(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, TextWhitespace, 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*)(\s*)(\()`, ByGroups(NameFunction, TextWhitespace, Punctuation), nil}, {`[a-z_]\w*`, Name, nil}, {`@[a-z0-9]*[._]*[a-z0-9]*`, NameVariable, nil}, {`[;:()\[\],.]`, Punctuation, nil}, @@ -50,5 +79,5 @@ var MySQL = internal.Register(MustNewLexer( {`""`, LiteralStringDouble, nil}, {`"`, LiteralStringDouble, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/n/nasm.go b/backend/vendor/github.com/alecthomas/chroma/lexers/n/nasm.go index d769d157..de6734e8 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/n/nasm.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/n/nasm.go @@ -6,7 +6,7 @@ import ( ) // Nasm lexer. -var Nasm = internal.Register(MustNewLexer( +var Nasm = internal.Register(MustNewLazyLexer( &Config{ Name: "NASM", Aliases: []string{"nasm"}, @@ -14,7 +14,11 @@ var Nasm = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-nasm"}, CaseInsensitive: true, }, - Rules{ + nasmRules, +)) + +func nasmRules() Rules { + return Rules{ "root": { {`^\s*%`, CommentPreproc, Push("preproc")}, Include("whitespace"), @@ -55,5 +59,5 @@ var Nasm = internal.Register(MustNewLexer( {`seg|wrt|strict`, OperatorWord, nil}, {`byte|[dq]?word`, KeywordType, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/n/newspeak.go b/backend/vendor/github.com/alecthomas/chroma/lexers/n/newspeak.go index 1a6a37bd..c9d3ae03 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/n/newspeak.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/n/newspeak.go @@ -6,14 +6,18 @@ import ( ) // Newspeak lexer. -var Newspeak = internal.Register(MustNewLexer( +var Newspeak = internal.Register(MustNewLazyLexer( &Config{ Name: "Newspeak", Aliases: []string{"newspeak"}, Filenames: []string{"*.ns2"}, MimeTypes: []string{"text/x-newspeak"}, }, - Rules{ + newspeakRules, +)) + +func newspeakRules() Rules { + return Rules{ "root": { {`\b(Newsqueak2)\b`, KeywordDeclaration, nil}, {`'[^']*'`, LiteralString, nil}, @@ -51,5 +55,5 @@ var Newspeak = internal.Register(MustNewLexer( {`\s+`, Text, nil}, {`"[^"]*"`, Comment, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/n/nginx.go b/backend/vendor/github.com/alecthomas/chroma/lexers/n/nginx.go index 840d100b..6d80523e 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/n/nginx.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/n/nginx.go @@ -6,14 +6,18 @@ import ( ) // Nginx Configuration File lexer. -var Nginx = internal.Register(MustNewLexer( +var Nginx = internal.Register(MustNewLazyLexer( &Config{ Name: "Nginx configuration file", Aliases: []string{"nginx"}, Filenames: []string{"nginx.conf"}, MimeTypes: []string{"text/x-nginx-conf"}, }, - Rules{ + nginxRules, +)) + +func nginxRules() Rules { + return Rules{ "root": { {`(include)(\s+)([^\s;]+)`, ByGroups(Keyword, Text, Name), nil}, {`[^\s;#]+`, Keyword, Push("stmt")}, @@ -43,5 +47,5 @@ var Nginx = internal.Register(MustNewLexer( {`\s+`, Text, nil}, {`[$;]`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/n/nim.go b/backend/vendor/github.com/alecthomas/chroma/lexers/n/nim.go index b08c2f94..3f98086b 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/n/nim.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/n/nim.go @@ -6,7 +6,7 @@ import ( ) // Nim lexer. -var Nim = internal.Register(MustNewLexer( +var Nim = internal.Register(MustNewLazyLexer( &Config{ Name: "Nim", Aliases: []string{"nim", "nimrod"}, @@ -14,7 +14,11 @@ var Nim = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-nim"}, CaseInsensitive: true, }, - Rules{ + nimRules, +)) + +func nimRules() Rules { + return Rules{ "root": { {`#\[[\s\S]*?\]#`, CommentMultiline, nil}, {`##.*$`, LiteralStringDoc, nil}, @@ -89,5 +93,5 @@ var Nim = internal.Register(MustNewLexer( {`\'i(8|16)`, LiteralNumberInteger, nil}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/n/nix.go b/backend/vendor/github.com/alecthomas/chroma/lexers/n/nix.go index 7e21dd7c..874560a5 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/n/nix.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/n/nix.go @@ -7,18 +7,22 @@ import ( "github.com/alecthomas/chroma/lexers/internal" ) -// nixb matches right boundary of a nix word. Use it instead of \b. -const nixb = `(?![a-zA-Z0-9_'-])` - // Nix lexer. -var Nix = internal.Register(MustNewLexer( +var Nix = internal.Register(MustNewLazyLexer( &Config{ Name: "Nix", Aliases: []string{"nixos", "nix"}, Filenames: []string{"*.nix"}, MimeTypes: []string{"text/x-nix"}, }, - Rules{ + nixRules, +)) + +func nixRules() Rules { + // nixb matches right boundary of a nix word. Use it instead of \b. + const nixb = `(?![a-zA-Z0-9_'-])` + + return Rules{ "root": { Include("keywords"), Include("builtins"), @@ -118,5 +122,5 @@ var Nix = internal.Register(MustNewLexer( "space": { {`[ \t\r\n]+`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/o/objectivec.go b/backend/vendor/github.com/alecthomas/chroma/lexers/o/objectivec.go index e3d0b1c4..0ae30296 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/o/objectivec.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/o/objectivec.go @@ -6,14 +6,18 @@ import ( ) // Objective-C lexer. -var ObjectiveC = internal.Register(MustNewLexer( +var ObjectiveC = internal.Register(MustNewLazyLexer( &Config{ Name: "Objective-C", Aliases: []string{"objective-c", "objectivec", "obj-c", "objc"}, Filenames: []string{"*.m", "*.h"}, MimeTypes: []string{"text/x-objective-c"}, }, - Rules{ + objectiveCRules, +)) + +func objectiveCRules() Rules { + return Rules{ "statements": { {`@"`, LiteralString, Push("string")}, {`@(YES|NO)`, LiteralNumber, nil}, @@ -161,5 +165,5 @@ var ObjectiveC = internal.Register(MustNewLexer( {`^\s*#endif.*?(?]*)(>)", ByGroups(Punctuation, CommentPreprocFile, Punctuation), nil}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/o/org.go b/backend/vendor/github.com/alecthomas/chroma/lexers/o/org.go index 1064eaf0..00f6df44 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/o/org.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/o/org.go @@ -6,14 +6,18 @@ import ( ) // Org mode lexer. -var Org = internal.Register(MustNewLexer( +var Org = internal.Register(MustNewLazyLexer( &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{ + orgRules, +)) + +func orgRules() Rules { + return Rules{ "root": { {`^# .*$`, Comment, nil}, // Headings @@ -45,7 +49,8 @@ var Org = internal.Register(MustNewLexer( // - 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 *$)`, + { + `(?i)^( *#\+begin_src )([^ \n]+)(.*?\n)([\w\W]*?)(^ *#\+end_src *$)`, UsingByGroup( internal.Get, 2, 4, @@ -54,7 +59,8 @@ var Org = internal.Register(MustNewLexer( nil, }, // - Export Blocks - {`(?i)^( *#\+begin_export )(\w+)( *\n)([\w\W]*?)(^ *#\+end_export *$)`, + { + `(?i)^( *#\+begin_export )(\w+)( *\n)([\w\W]*?)(^ *#\+end_export *$)`, UsingByGroup( internal.Get, 2, 4, @@ -98,5 +104,5 @@ var Org = internal.Register(MustNewLexer( // Any other text {`.`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/pacman.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/pacman.go index 807b67c5..00c6255a 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/pacman.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/pacman.go @@ -6,14 +6,18 @@ import ( ) // Pacmanconf lexer. -var Pacmanconf = internal.Register(MustNewLexer( +var Pacmanconf = internal.Register(MustNewLazyLexer( &Config{ Name: "PacmanConf", Aliases: []string{"pacmanconf"}, Filenames: []string{"pacman.conf"}, MimeTypes: []string{}, }, - Rules{ + pacmanconfRules, +)) + +func pacmanconfRules() Rules { + return Rules{ "root": { {`#.*$`, CommentSingle, nil}, {`^\s*\[.*?\]\s*$`, Keyword, nil}, @@ -22,5 +26,5 @@ var Pacmanconf = internal.Register(MustNewLexer( {Words(``, `\b`, `$repo`, `$arch`, `%o`, `%u`), NameVariable, nil}, {`.`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/perl.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/perl.go index 0a2b35b9..6aa338ad 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/perl.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/perl.go @@ -6,7 +6,7 @@ import ( ) // Perl lexer. -var Perl = internal.Register(MustNewLexer( +var Perl = internal.Register(MustNewLazyLexer( &Config{ Name: "Perl", Aliases: []string{"perl", "pl"}, @@ -14,7 +14,11 @@ var Perl = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-perl", "application/x-perl"}, DotAll: true, }, - Rules{ + perlRules, +)) + +func perlRules() Rules { + return Rules{ "balanced-regex": { {`/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*`, LiteralStringRegex, Pop(1)}, {`!(\\\\|\\[^\\]|[^\\!])*![egimosx]*`, LiteralStringRegex, Pop(1)}, @@ -134,5 +138,5 @@ var Perl = internal.Register(MustNewLexer( "end-part": { {`.+`, CommentPreproc, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/pig.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/pig.go index 0dbc591a..f2852c18 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/pig.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/pig.go @@ -6,7 +6,7 @@ import ( ) // Pig lexer. -var Pig = internal.Register(MustNewLexer( +var Pig = internal.Register(MustNewLazyLexer( &Config{ Name: "Pig", Aliases: []string{"pig"}, @@ -14,7 +14,11 @@ var Pig = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-pig"}, CaseInsensitive: true, }, - Rules{ + pigRules, +)) + +func pigRules() Rules { + return Rules{ "root": { {`\s+`, Text, nil}, {`--.*`, Comment, nil}, @@ -53,5 +57,5 @@ var Pig = internal.Register(MustNewLexer( {`(eq|gt|lt|gte|lte|neq|matches)\b`, Operator, nil}, {`(==|<=|<|>=|>|!=)`, Operator, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/pkgconfig.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/pkgconfig.go index 0a4872e7..9e024107 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/pkgconfig.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/pkgconfig.go @@ -6,14 +6,18 @@ import ( ) // Pkgconfig lexer. -var Pkgconfig = internal.Register(MustNewLexer( +var Pkgconfig = internal.Register(MustNewLazyLexer( &Config{ Name: "PkgConfig", Aliases: []string{"pkgconfig"}, Filenames: []string{"*.pc"}, MimeTypes: []string{}, }, - Rules{ + pkgconfigRules, +)) + +func pkgconfigRules() Rules { + return Rules{ "root": { {`#.*$`, CommentSingle, nil}, {`^(\w+)(=)`, ByGroups(NameAttribute, Operator), nil}, @@ -37,5 +41,5 @@ var Pkgconfig = internal.Register(MustNewLexer( {`[^${}#\n]+`, Text, nil}, {`.`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/plaintext.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/plaintext.go index 7b252930..058c02a8 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/plaintext.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/plaintext.go @@ -5,7 +5,7 @@ import ( "github.com/alecthomas/chroma/lexers/internal" ) -var Plaintext = internal.Register(MustNewLexer( +var Plaintext = internal.Register(MustNewLazyLexer( &Config{ Name: "plaintext", Aliases: []string{"text", "plain", "no-highlight"}, diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/plsql.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/plsql.go index a6068fd2..324d3feb 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/plsql.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/plsql.go @@ -6,7 +6,7 @@ import ( ) // Pl/Pgsql lexer. -var PLpgSQL = internal.Register(MustNewLexer( +var PLpgSQL = internal.Register(MustNewLazyLexer( &Config{ Name: "PL/pgSQL", Aliases: []string{"plpgsql"}, @@ -15,13 +15,17 @@ var PLpgSQL = internal.Register(MustNewLexer( NotMultiline: true, CaseInsensitive: true, }, - Rules{ + plpgSQLRules, +)) + +func plpgSQLRules() Rules { + return Rules{ "root": { {`\%[a-z]\w*\b`, NameBuiltin, nil}, {`:=`, Operator, nil}, {`\<\<[a-z]\w*\>\>`, NameLabel, nil}, {`\#[a-z]\w*\b`, KeywordPseudo, nil}, - {`\s+`, Text, nil}, + {`\s+`, TextWhitespace, 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}, @@ -54,5 +58,5 @@ var PLpgSQL = internal.Register(MustNewLexer( {`""`, LiteralStringName, nil}, {`"`, LiteralStringName, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/pony.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/pony.go new file mode 100644 index 00000000..41d56828 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/pony.go @@ -0,0 +1,63 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Pony lexer. +var Pony = internal.Register(MustNewLazyLexer( + &Config{ + Name: "Pony", + Aliases: []string{"pony"}, + Filenames: []string{"*.pony"}, + MimeTypes: []string{}, + }, + ponyRules, +)) + +func ponyRules() Rules { + return Rules{ + "root": { + {`\n`, Text, nil}, + {`[^\S\n]+`, Text, nil}, + {`//.*\n`, CommentSingle, nil}, + {`/\*`, CommentMultiline, Push("nested_comment")}, + {`"""(?:.|\n)*?"""`, LiteralStringDoc, nil}, + {`"`, LiteralString, Push("string")}, + {`\'.*\'`, LiteralStringChar, nil}, + {`=>|[]{}:().~;,|&!^?[]`, Punctuation, nil}, + {Words(``, `\b`, `addressof`, `and`, `as`, `consume`, `digestof`, `is`, `isnt`, `not`, `or`), OperatorWord, nil}, + {`!=|==|<<|>>|[-+/*%=<>]`, Operator, nil}, + {Words(``, `\b`, `box`, `break`, `compile_error`, `compile_intrinsic`, `continue`, `do`, `else`, `elseif`, `embed`, `end`, `error`, `for`, `if`, `ifdef`, `in`, `iso`, `lambda`, `let`, `match`, `object`, `recover`, `ref`, `repeat`, `return`, `tag`, `then`, `this`, `trn`, `try`, `until`, `use`, `var`, `val`, `where`, `while`, `with`, `#any`, `#read`, `#send`, `#share`), Keyword, nil}, + {`(actor|class|struct|primitive|interface|trait|type)((?:\s)+)`, ByGroups(Keyword, Text), Push("typename")}, + {`(new|fun|be)((?:\s)+)`, ByGroups(Keyword, Text), Push("methodname")}, + {Words(``, `\b`, `U8`, `U16`, `U32`, `U64`, `ULong`, `USize`, `U128`, `Unsigned`, `Stringable`, `String`, `StringBytes`, `StringRunes`, `InputNotify`, `InputStream`, `Stdin`, `ByteSeq`, `ByteSeqIter`, `OutStream`, `StdStream`, `SourceLoc`, `I8`, `I16`, `I32`, `I64`, `ILong`, `ISize`, `I128`, `Signed`, `Seq`, `RuntimeOptions`, `Real`, `Integer`, `SignedInteger`, `UnsignedInteger`, `FloatingPoint`, `Number`, `Int`, `ReadSeq`, `ReadElement`, `Pointer`, `Platform`, `NullablePointer`, `None`, `Iterator`, `F32`, `F64`, `Float`, `Env`, `DoNotOptimise`, `DisposableActor`, `Less`, `Equal`, `Greater`, `Compare`, `HasEq`, `Equatable`, `Comparable`, `Bool`, `AsioEventID`, `AsioEventNotify`, `AsioEvent`, `Array`, `ArrayKeys`, `ArrayValues`, `ArrayPairs`, `Any`, `AmbientAuth`), KeywordType, nil}, + {`_?[A-Z]\w*`, NameClass, nil}, + {`string\(\)`, NameOther, nil}, + {`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+`, LiteralNumberFloat, nil}, + {`0x[0-9a-fA-F]+`, LiteralNumberHex, nil}, + {`\d+`, LiteralNumberInteger, nil}, + {`(true|false)\b`, Keyword, nil}, + {`_\d*`, Name, nil}, + {`_?[a-z][\w\'_]*`, Name, nil}, + }, + "typename": { + {`(iso|trn|ref|val|box|tag)?((?:\s)*)(_?[A-Z]\w*)`, ByGroups(Keyword, Text, NameClass), Pop(1)}, + }, + "methodname": { + {`(iso|trn|ref|val|box|tag)?((?:\s)*)(_?[a-z]\w*)`, ByGroups(Keyword, Text, NameFunction), Pop(1)}, + }, + "nested_comment": { + {`[^*/]+`, CommentMultiline, nil}, + {`/\*`, CommentMultiline, Push()}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[*/]`, CommentMultiline, nil}, + }, + "string": { + {`"`, LiteralString, Pop(1)}, + {`\\"`, LiteralString, nil}, + {`[^\\"]+`, LiteralString, nil}, + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/postgres.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/postgres.go index 3afa54de..8977e2cf 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/postgres.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/postgres.go @@ -6,7 +6,7 @@ import ( ) // Postgresql Sql Dialect lexer. -var PostgreSQL = internal.Register(MustNewLexer( +var PostgreSQL = internal.Register(MustNewLazyLexer( &Config{ Name: "PostgreSQL SQL dialect", Aliases: []string{"postgresql", "postgres"}, @@ -15,13 +15,18 @@ var PostgreSQL = internal.Register(MustNewLexer( NotMultiline: true, CaseInsensitive: true, }, - Rules{ + postgreSQLRules, +)) + +func postgreSQLRules() Rules { + return 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)(\$)`, + { + `(?s)(DO)(\s+)(?:(LANGUAGE)?(\s+)('?)(\w+)?('?)(\s+))?(\$)([^$]*)(\$)(.*?)(\$)(\10)(\$)`, UsingByGroup( internal.Get, 6, 12, @@ -41,7 +46,8 @@ var PostgreSQL = internal.Register(MustNewLexer( {`[0-9]+`, LiteralNumberInteger, nil}, {`((?:E|U&)?)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("string")}, {`((?:U&)?)(")`, ByGroups(LiteralStringAffix, LiteralStringName), Push("quoted-ident")}, - {`(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)(\s+)(LANGUAGE)?(\s+)('?)(\w+)?('?)`, + { + `(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)(\s+)(LANGUAGE)?(\s+)('?)(\w+)?('?)`, UsingByGroup(internal.Get, 12, 4, StringHeredoc, StringHeredoc, StringHeredoc, // $tag$ @@ -73,5 +79,5 @@ var PostgreSQL = internal.Register(MustNewLexer( {`""`, LiteralStringName, nil}, {`"`, LiteralStringName, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/postscript.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/postscript.go index 0cfa3a5f..0b51ba5e 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/postscript.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/postscript.go @@ -6,14 +6,18 @@ import ( ) // Postscript lexer. -var Postscript = internal.Register(MustNewLexer( +var Postscript = internal.Register(MustNewLazyLexer( &Config{ Name: "PostScript", Aliases: []string{"postscript", "postscr"}, Filenames: []string{"*.ps", "*.eps"}, MimeTypes: []string{"application/postscript"}, }, - Rules{ + postscriptRules, +)) + +func postscriptRules() Rules { + return Rules{ "root": { {`^%!.+\n`, CommentPreproc, nil}, {`%%.*\n`, CommentSpecial, nil}, @@ -42,5 +46,5 @@ var Postscript = internal.Register(MustNewLexer( {`[0-8]{3}|n|r|t|b|f|\\|\(|\)`, LiteralStringEscape, Pop(1)}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/povray.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/povray.go index 6f1bb524..2d870f10 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/povray.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/povray.go @@ -6,14 +6,18 @@ import ( ) // Povray lexer. -var Povray = internal.Register(MustNewLexer( +var Povray = internal.Register(MustNewLazyLexer( &Config{ Name: "POVRay", Aliases: []string{"pov"}, Filenames: []string{"*.pov", "*.inc"}, MimeTypes: []string{"text/x-povray"}, }, - Rules{ + povrayRules, +)) + +func povrayRules() Rules { + return Rules{ "root": { {`/\*[\w\W]*?\*/`, CommentMultiline, nil}, {`//.*\n`, CommentSingle, nil}, @@ -31,5 +35,5 @@ var Povray = internal.Register(MustNewLexer( {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, {`\s+`, Text, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/powerquery.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/powerquery.go new file mode 100644 index 00000000..0302420e --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/powerquery.go @@ -0,0 +1,38 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// PowerQuery lexer. +var PowerQuery = internal.Register(MustNewLazyLexer( + &Config{ + Name: "PowerQuery", + Aliases: []string{"powerquery", "pq"}, + Filenames: []string{"*.pq"}, + MimeTypes: []string{"text/x-powerquery"}, + DotAll: true, + CaseInsensitive: true, + }, + powerqueryRules, +)) + +func powerqueryRules() Rules { + return Rules{ + "root": { + {`\s+`, Text, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/\*.*?\*/`, CommentMultiline, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, + {`(and|as|each|else|error|false|if|in|is|let|meta|not|null|or|otherwise|section|shared|then|true|try|type)\b`, Keyword, nil}, + {`(#binary|#date|#datetime|#datetimezone|#duration|#infinity|#nan|#sections|#shared|#table|#time)\b`, KeywordType, nil}, + {`(([a-zA-Z]|_)[\w|._]*|#"[^"]+")`, Name, nil}, + {`0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?`, LiteralNumberHex, nil}, + {`([0-9]+\.[0-9]+|\.[0-9]+)([eE][0-9]+)?`, LiteralNumberFloat, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`[\(\)\[\]\{\}]`, Punctuation, nil}, + {`\.\.|\.\.\.|=>|<=|>=|<>|[@!?,;=<>\+\-\*\/&]`, Operator, nil}, + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/powershell.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/powershell.go index 10eba4f9..9b7b56ee 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/powershell.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/powershell.go @@ -6,16 +6,20 @@ import ( ) // Powershell lexer. -var Powershell = internal.Register(MustNewLexer( +var Powershell = internal.Register(MustNewLazyLexer( &Config{ Name: "PowerShell", - Aliases: []string{"powershell", "posh", "ps1", "psm1"}, - Filenames: []string{"*.ps1", "*.psm1"}, + Aliases: []string{"powershell", "posh", "ps1", "psm1", "psd1"}, + Filenames: []string{"*.ps1", "*.psm1", "*.psd1"}, MimeTypes: []string{"text/x-powershell"}, DotAll: true, CaseInsensitive: true, }, - Rules{ + powershellRules, +)) + +func powershellRules() Rules { + return Rules{ "root": { {`\(`, Punctuation, Push("child")}, {`\s+`, Text, nil}, @@ -29,9 +33,9 @@ var Powershell = internal.Register(MustNewLexer( {`"`, LiteralStringDouble, Push("string")}, {`'([^']|'')*'`, LiteralStringSingle, nil}, {`(\$|@@|@)((global|script|private|env):)?\w+`, NameVariable, nil}, + {`[a-z]\w*-[a-z]\w*\b`, NameBuiltin, 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}, @@ -62,5 +66,5 @@ var Powershell = internal.Register(MustNewLexer( {`[^@\n]+"]`, LiteralStringHeredoc, nil}, {`.`, LiteralStringHeredoc, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/prolog.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/prolog.go index 08b48121..a2f346b6 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/prolog.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/prolog.go @@ -6,14 +6,18 @@ import ( ) // Prolog lexer. -var Prolog = internal.Register(MustNewLexer( +var Prolog = internal.Register(MustNewLazyLexer( &Config{ Name: "Prolog", Aliases: []string{"prolog"}, Filenames: []string{"*.ecl", "*.prolog", "*.pro", "*.pl"}, MimeTypes: []string{"text/x-prolog"}, }, - Rules{ + prologRules, +)) + +func prologRules() Rules { + return Rules{ "root": { {`/\*`, CommentMultiline, Push("nested-comment")}, {`%.*`, CommentSingle, nil}, @@ -46,5 +50,5 @@ var Prolog = internal.Register(MustNewLexer( {`[^*/]+`, CommentMultiline, nil}, {`[*/]`, CommentMultiline, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/promql.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/promql.go new file mode 100644 index 00000000..e80b926c --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/promql.go @@ -0,0 +1,59 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Promql lexer. +var Promql = internal.Register(MustNewLazyLexer( + &Config{ + Name: "PromQL", + Aliases: []string{"promql"}, + Filenames: []string{"*.promql"}, + MimeTypes: []string{}, + }, + promqlRules, +)) + +func promqlRules() Rules { + return Rules{ + "root": { + {`\n`, TextWhitespace, nil}, + {`\s+`, TextWhitespace, nil}, + {`,`, Punctuation, nil}, + {Words(``, `\b`, `bool`, `by`, `group_left`, `group_right`, `ignoring`, `offset`, `on`, `without`), Keyword, nil}, + {Words(``, `\b`, `sum`, `min`, `max`, `avg`, `group`, `stddev`, `stdvar`, `count`, `count_values`, `bottomk`, `topk`, `quantile`), Keyword, nil}, + {Words(``, `\b`, `abs`, `absent`, `absent_over_time`, `avg_over_time`, `ceil`, `changes`, `clamp_max`, `clamp_min`, `count_over_time`, `day_of_month`, `day_of_week`, `days_in_month`, `delta`, `deriv`, `exp`, `floor`, `histogram_quantile`, `holt_winters`, `hour`, `idelta`, `increase`, `irate`, `label_join`, `label_replace`, `ln`, `log10`, `log2`, `max_over_time`, `min_over_time`, `minute`, `month`, `predict_linear`, `quantile_over_time`, `rate`, `resets`, `round`, `scalar`, `sort`, `sort_desc`, `sqrt`, `stddev_over_time`, `stdvar_over_time`, `sum_over_time`, `time`, `timestamp`, `vector`, `year`), KeywordReserved, nil}, + {`[1-9][0-9]*[smhdwy]`, LiteralString, nil}, + {`-?[0-9]+\.[0-9]+`, LiteralNumberFloat, nil}, + {`-?[0-9]+`, LiteralNumberInteger, nil}, + {`#.*?$`, CommentSingle, nil}, + {`(\+|\-|\*|\/|\%|\^)`, Operator, nil}, + {`==|!=|>=|<=|<|>`, Operator, nil}, + {`and|or|unless`, OperatorWord, nil}, + {`[_a-zA-Z][a-zA-Z0-9_]+`, NameVariable, nil}, + {`(["\'])(.*?)(["\'])`, ByGroups(Punctuation, LiteralString, Punctuation), nil}, + {`\(`, Operator, Push("function")}, + {`\)`, Operator, nil}, + {`\{`, Punctuation, Push("labels")}, + {`\[`, Punctuation, Push("range")}, + }, + "labels": { + {`\}`, Punctuation, Pop(1)}, + {`\n`, TextWhitespace, nil}, + {`\s+`, TextWhitespace, nil}, + {`,`, Punctuation, nil}, + {`([_a-zA-Z][a-zA-Z0-9_]*?)(\s*?)(=~|!=|=|!~)(\s*?)("|')(.*?)("|')`, ByGroups(NameLabel, TextWhitespace, Operator, TextWhitespace, Punctuation, LiteralString, Punctuation), nil}, + }, + "range": { + {`\]`, Punctuation, Pop(1)}, + {`[1-9][0-9]*[smhdwy]`, LiteralString, nil}, + }, + "function": { + {`\)`, Operator, Pop(1)}, + {`\(`, Operator, Push()}, + Default(Pop(1)), + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/protobuf.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/protobuf.go index 30140131..76576cb3 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/protobuf.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/protobuf.go @@ -6,14 +6,18 @@ import ( ) // ProtocolBuffer lexer. -var ProtocolBuffer = internal.Register(MustNewLexer( +var ProtocolBuffer = internal.Register(MustNewLazyLexer( &Config{ Name: "Protocol Buffer", Aliases: []string{"protobuf", "proto"}, Filenames: []string{"*.proto"}, MimeTypes: []string{}, }, - Rules{ + protocolBufferRules, +)) + +func protocolBufferRules() Rules { + return Rules{ "root": { {`[ \t]+`, Text, nil}, {`[,;{}\[\]()<>]`, Punctuation, nil}, @@ -49,5 +53,5 @@ var ProtocolBuffer = internal.Register(MustNewLexer( {`[a-zA-Z_]\w*`, Name, Pop(1)}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/puppet.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/puppet.go index a1db0d27..b32caed0 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/puppet.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/puppet.go @@ -6,14 +6,18 @@ import ( ) // Puppet lexer. -var Puppet = internal.Register(MustNewLexer( +var Puppet = internal.Register(MustNewLazyLexer( &Config{ Name: "Puppet", Aliases: []string{"puppet"}, Filenames: []string{"*.pp"}, MimeTypes: []string{}, }, - Rules{ + puppetRules, +)) + +func puppetRules() Rules { + return Rules{ "root": { Include("comments"), Include("keywords"), @@ -52,5 +56,5 @@ var Puppet = internal.Register(MustNewLexer( {`"([^"])*"`, LiteralString, nil}, {`'(\\'|[^'])*'`, LiteralString, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/python.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/python.go index 77f2c8db..b432a420 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/p/python.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/python.go @@ -6,112 +6,176 @@ import ( ) // Python lexer. -var Python = internal.Register(MustNewLexer( +var Python = internal.Register(MustNewLazyLexer( &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"}, + Aliases: []string{"python", "py", "sage", "python3", "py3"}, + Filenames: []string{"*.py", "*.pyi", "*.pyw", "*.jy", "*.sage", "*.sc", "SConstruct", "SConscript", "*.bzl", "BUCK", "BUILD", "BUILD.bazel", "WORKSPACE", "*.tac"}, + MimeTypes: []string{"text/x-python", "application/x-python", "text/x-python3", "application/x-python3"}, }, - Rules{ + pythonRules, +)) + +func pythonRules() Rules { + const pythonIdentifier = `[A-Z_a-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶ-ͷͻ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴ-ߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱৼਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡૹଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠ-ౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡೱ-ೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥ-ၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮ-ᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳱᳵ-ᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿯ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪ-ꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞹꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽ-ꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵ-ꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﱝﱤ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷹﹱﹳﹷﹹﹻﹽﹿ-ﻼA-Za-zヲ-ンᅠ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ𐀀-𐀋𐀍-𐀦𐀨-𐀺𐀼-𐀽𐀿-𐁍𐁐-𐁝𐂀-𐃺𐅀-𐅴𐊀-𐊜𐊠-𐋐𐌀-𐌟𐌭-𐍊𐍐-𐍵𐎀-𐎝𐎠-𐏃𐏈-𐏏𐏑-𐏕𐐀-𐒝𐒰-𐓓𐓘-𐓻𐔀-𐔧𐔰-𐕣𐘀-𐜶𐝀-𐝕𐝠-𐝧𐠀-𐠅𐠈𐠊-𐠵𐠷-𐠸𐠼𐠿-𐡕𐡠-𐡶𐢀-𐢞𐣠-𐣲𐣴-𐣵𐤀-𐤕𐤠-𐤹𐦀-𐦷𐦾-𐦿𐨀𐨐-𐨓𐨕-𐨗𐨙-𐨵𐩠-𐩼𐪀-𐪜𐫀-𐫇𐫉-𐫤𐬀-𐬵𐭀-𐭕𐭠-𐭲𐮀-𐮑𐰀-𐱈𐲀-𐲲𐳀-𐳲𐴀-𐴣𐼀-𐼜𐼧𐼰-𐽅𑀃-𑀷𑂃-𑂯𑃐-𑃨𑄃-𑄦𑅄𑅐-𑅲𑅶𑆃-𑆲𑇁-𑇄𑇚𑇜𑈀-𑈑𑈓-𑈫𑊀-𑊆𑊈𑊊-𑊍𑊏-𑊝𑊟-𑊨𑊰-𑋞𑌅-𑌌𑌏-𑌐𑌓-𑌨𑌪-𑌰𑌲-𑌳𑌵-𑌹𑌽𑍐𑍝-𑍡𑐀-𑐴𑑇-𑑊𑒀-𑒯𑓄-𑓅𑓇𑖀-𑖮𑗘-𑗛𑘀-𑘯𑙄𑚀-𑚪𑜀-𑜚𑠀-𑠫𑢠-𑣟𑣿𑨀𑨋-𑨲𑨺𑩐𑩜-𑪃𑪆-𑪉𑪝𑫀-𑫸𑰀-𑰈𑰊-𑰮𑱀𑱲-𑲏𑴀-𑴆𑴈-𑴉𑴋-𑴰𑵆𑵠-𑵥𑵧-𑵨𑵪-𑶉𑶘𑻠-𑻲𒀀-𒎙𒐀-𒑮𒒀-𒕃𓀀-𓐮𔐀-𔙆𖠀-𖨸𖩀-𖩞𖫐-𖫭𖬀-𖬯𖭀-𖭃𖭣-𖭷𖭽-𖮏𖹀-𖹿𖼀-𖽄𖽐𖾓-𖾟𖿠-𖿡𗀀-𘟱𘠀-𘫲𛀀-𛄞𛅰-𛋻𛰀-𛱪𛱰-𛱼𛲀-𛲈𛲐-𛲙𝐀-𝑔𝑖-𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒹𝒻𝒽-𝓃𝓅-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔞-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕒-𝚥𝚨-𝛀𝛂-𝛚𝛜-𝛺𝛼-𝜔𝜖-𝜴𝜶-𝝎𝝐-𝝮𝝰-𝞈𝞊-𝞨𝞪-𝟂𝟄-𝟋𞠀-𞣄𞤀-𞥃𞸀-𞸃𞸅-𞸟𞸡-𞸢𞸤𞸧𞸩-𞸲𞸴-𞸷𞸹𞸻𞹂𞹇𞹉𞹋𞹍-𞹏𞹑-𞹒𞹔𞹗𞹙𞹛𞹝𞹟𞹡-𞹢𞹤𞹧-𞹪𞹬-𞹲𞹴-𞹷𞹹-𞹼𞹾𞺀-𞺉𞺋-𞺛𞺡-𞺣𞺥-𞺩𞺫-𞺻𠀀-𪛖𪜀-𫜴𫝀-𫠝𫠠-𬺡𬺰-𮯠丽-𪘀][0-9A-Z_a-zªµ·ºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶ-ͷͻ-ͽͿΆ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙՠ-ֈ֑-ֽֿׁ-ׂׄ-ׇׅא-תׯ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺ߽ࠀ-࠭ࡀ-࡛ࡠ-ࡪࢠ-ࢴࢶ-ࢽ࣓-ࣣ࣡-ॣ०-९ॱ-ঃঅ-ঌএ-ঐও-নপ-রলশ-হ়-ৄে-ৈো-ৎৗড়-ঢ়য়-ৣ০-ৱৼ৾ਁ-ਃਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹ਼ਾ-ੂੇ-ੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ૹ-૿ଁ-ଃଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ୄେ-ୈୋ-୍ୖ-ୗଡ଼-ଢ଼ୟ-ୣ୦-୯ୱஂ-ஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕ-ౖౘ-ౚౠ-ౣ౦-౯ಀ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕ-ೖೞೠ-ೣ೦-೯ೱ-ೲഀ-ഃഅ-ഌഎ-ഐഒ-ൄെ-ൈൊ-ൎൔ-ൗൟ-ൣ൦-൯ൺ-ൿං-ඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲ-ෳก-ฺเ-๎๐-๙ກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘-༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟፩-፱ᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲ-ᝳក-៓ៗៜ-៝០-៩᠋-᠍᠐-᠙ᠠ-ᡸᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧚ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿ᳐-᳔᳒-᳹ᴀ-᷹᷻-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿-⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙-゚ゝ-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿯ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞹꟷ-ꠧꡀ-ꡳꢀ-ꣅ꣐-꣙꣠-ꣷꣻꣽ-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯪ꯬-꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﱝﱤ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷹ︀-️︠-︯︳-︴﹍-﹏ﹱﹳﹷﹹﹻﹽﹿ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ𐀀-𐀋𐀍-𐀦𐀨-𐀺𐀼-𐀽𐀿-𐁍𐁐-𐁝𐂀-𐃺𐅀-𐅴𐇽𐊀-𐊜𐊠-𐋐𐋠𐌀-𐌟𐌭-𐍊𐍐-𐍺𐎀-𐎝𐎠-𐏃𐏈-𐏏𐏑-𐏕𐐀-𐒝𐒠-𐒩𐒰-𐓓𐓘-𐓻𐔀-𐔧𐔰-𐕣𐘀-𐜶𐝀-𐝕𐝠-𐝧𐠀-𐠅𐠈𐠊-𐠵𐠷-𐠸𐠼𐠿-𐡕𐡠-𐡶𐢀-𐢞𐣠-𐣲𐣴-𐣵𐤀-𐤕𐤠-𐤹𐦀-𐦷𐦾-𐦿𐨀-𐨃𐨅-𐨆𐨌-𐨓𐨕-𐨗𐨙-𐨵𐨸-𐨿𐨺𐩠-𐩼𐪀-𐪜𐫀-𐫇𐫉-𐫦𐬀-𐬵𐭀-𐭕𐭠-𐭲𐮀-𐮑𐰀-𐱈𐲀-𐲲𐳀-𐳲𐴀-𐴧𐴰-𐴹𐼀-𐼜𐼧𐼰-𐽐𑀀-𑁆𑁦-𑁯𑁿-𑂺𑃐-𑃨𑃰-𑃹𑄀-𑄴𑄶-𑄿𑅄-𑅆𑅐-𑅳𑅶𑆀-𑇄𑇉-𑇌𑇐-𑇚𑇜𑈀-𑈑𑈓-𑈷𑈾𑊀-𑊆𑊈𑊊-𑊍𑊏-𑊝𑊟-𑊨𑊰-𑋪𑋰-𑋹𑌀-𑌃𑌅-𑌌𑌏-𑌐𑌓-𑌨𑌪-𑌰𑌲-𑌳𑌵-𑌹𑌻-𑍄𑍇-𑍈𑍋-𑍍𑍐𑍗𑍝-𑍣𑍦-𑍬𑍰-𑍴𑐀-𑑊𑑐-𑑙𑑞𑒀-𑓅𑓇𑓐-𑓙𑖀-𑖵𑖸-𑗀𑗘-𑗝𑘀-𑙀𑙄𑙐-𑙙𑚀-𑚷𑛀-𑛉𑜀-𑜚𑜝-𑜫𑜰-𑜹𑠀-𑠺𑢠-𑣩𑣿𑨀-𑨾𑩇𑩐-𑪃𑪆-𑪙𑪝𑫀-𑫸𑰀-𑰈𑰊-𑰶𑰸-𑱀𑱐-𑱙𑱲-𑲏𑲒-𑲧𑲩-𑲶𑴀-𑴆𑴈-𑴉𑴋-𑴶𑴺𑴼-𑴽𑴿-𑵇𑵐-𑵙𑵠-𑵥𑵧-𑵨𑵪-𑶎𑶐-𑶑𑶓-𑶘𑶠-𑶩𑻠-𑻶𒀀-𒎙𒐀-𒑮𒒀-𒕃𓀀-𓐮𔐀-𔙆𖠀-𖨸𖩀-𖩞𖩠-𖩩𖫐-𖫭𖫰-𖫴𖬀-𖬶𖭀-𖭃𖭐-𖭙𖭣-𖭷𖭽-𖮏𖹀-𖹿𖼀-𖽄𖽐-𖽾𖾏-𖾟𖿠-𖿡𗀀-𘟱𘠀-𘫲𛀀-𛄞𛅰-𛋻𛰀-𛱪𛱰-𛱼𛲀-𛲈𛲐-𛲙𛲝-𛲞𝅥-𝅩𝅭-𝅲𝅻-𝆂𝆅-𝆋𝆪-𝆭𝉂-𝉄𝐀-𝑔𝑖-𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒹𝒻𝒽-𝓃𝓅-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔞-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕒-𝚥𝚨-𝛀𝛂-𝛚𝛜-𝛺𝛼-𝜔𝜖-𝜴𝜶-𝝎𝝐-𝝮𝝰-𝞈𝞊-𝞨𝞪-𝟂𝟄-𝟋𝟎-𝟿𝨀-𝨶𝨻-𝩬𝩵𝪄𝪛-𝪟𝪡-𝪯𞀀-𞀆𞀈-𞀘𞀛-𞀡𞀣-𞀤𞀦-𞀪𞠀-𞣄𞣐-𞣖𞤀-𞥊𞥐-𞥙𞸀-𞸃𞸅-𞸟𞸡-𞸢𞸤𞸧𞸩-𞸲𞸴-𞸷𞸹𞸻𞹂𞹇𞹉𞹋𞹍-𞹏𞹑-𞹒𞹔𞹗𞹙𞹛𞹝𞹟𞹡-𞹢𞹤𞹧-𞹪𞹬-𞹲𞹴-𞹷𞹹-𞹼𞹾𞺀-𞺉𞺋-𞺛𞺡-𞺣𞺥-𞺩𞺫-𞺻𠀀-𪛖𪜀-𫜴𫝀-𫠝𫠠-𬺡𬺰-𮯠丽-𪘀󠄀-󠇯]*` + + return 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")}, + Include("expr"), + }, + "expr": { + {`(?i)(rf|fr)(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("rfstringescape", "tdqf")}, + {`(?i)(rf|fr)(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("rfstringescape", "tsqf")}, + {`(?i)(rf|fr)(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("rfstringescape", "dqf")}, + {`(?i)(rf|fr)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("rfstringescape", "sqf")}, + {`([fF])(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("fstringescape", "tdqf")}, + {`([fF])(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("fstringescape", "tsqf")}, + {`([fF])(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("fstringescape", "dqf")}, + {`([fF])(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("fstringescape", "sqf")}, + {`(?i)(rb|br|r)(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("tdqs")}, + {`(?i)(rb|br|r)(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("tsqs")}, + {`(?i)(rb|br|r)(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("dqs")}, + {`(?i)(rb|br|r)(')`, 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"), + {`[^\S\n]+`, Text, nil}, Include("numbers"), + {`!=|==|<<|>>|:=|[-~+/*%=<>&^|.]`, Operator, nil}, + {`[]{}:(),;[]`, Punctuation, nil}, + {`(in|is|and|or|not)\b`, OperatorWord, nil}, + Include("expr-keywords"), + Include("builtins"), + Include("magicfuncs"), + Include("magicvars"), + Include("name"), + }, + "expr-inside-fstring": { + {`[{([]`, Punctuation, Push("expr-inside-fstring-inner")}, + {`(=\s*)?(\![sraf])?\}`, LiteralStringInterpol, Pop(1)}, + {`(=\s*)?(\![sraf])?:`, LiteralStringInterpol, Pop(1)}, + {`\s+`, Text, nil}, + Include("expr"), + }, + "expr-inside-fstring-inner": { + {`[{([]`, Punctuation, Push("expr-inside-fstring-inner")}, + {`[])}]`, Punctuation, Pop(1)}, + {`\s+`, Text, nil}, + Include("expr"), + }, + "expr-keywords": { + {Words(``, `\b`, `async for`, `await`, `else`, `for`, `if`, `lambda`, `yield`, `yield from`), Keyword, nil}, + {Words(``, `\b`, `True`, `False`, `None`), KeywordConstant, nil}, }, "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}, + {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}, - {`[^\\\'"%\n]+`, LiteralStringDouble, nil}, + {`%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsaux%]`, LiteralStringInterpol, nil}, + {`\{((\w+)((\.\w+)|(\[[^\]]+\]))*)?(\![sra])?(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?\}`, LiteralStringInterpol, nil}, + {`[^\\\'"%{\n]+`, LiteralStringDouble, nil}, {`[\'"\\]`, LiteralStringDouble, nil}, - {`%`, LiteralStringDouble, nil}, + {`%|(\{{1,2})`, LiteralStringDouble, nil}, + }, + "dqf": { + {`"`, LiteralStringDouble, Pop(1)}, + {`\\\\|\\"|\\\n`, LiteralStringEscape, nil}, + Include("fstrings-double"), + }, + "sqf": { + {`'`, LiteralStringSingle, Pop(1)}, + {`\\\\|\\'|\\\n`, LiteralStringEscape, nil}, + Include("fstrings-single"), }, "dqs": { {`"`, LiteralStringDouble, Pop(1)}, @@ -123,6 +187,16 @@ var Python = internal.Register(MustNewLexer( {`\\\\|\\'|\\\n`, LiteralStringEscape, nil}, Include("strings-single"), }, + "tdqf": { + {`"""`, LiteralStringDouble, Pop(1)}, + Include("fstrings-double"), + {`\n`, LiteralStringDouble, nil}, + }, + "tsqf": { + {`'''`, LiteralStringSingle, Pop(1)}, + Include("fstrings-single"), + {`\n`, LiteralStringSingle, nil}, + }, "tdqs": { {`"""`, LiteralStringDouble, Pop(1)}, Include("strings-double"), @@ -133,5 +207,5 @@ var Python = internal.Register(MustNewLexer( Include("strings-single"), {`\n`, LiteralStringSingle, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/python2.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/python2.go new file mode 100644 index 00000000..f1f60360 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/python2.go @@ -0,0 +1,141 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Python2 lexer. +var Python2 = internal.Register(MustNewLazyLexer( + &Config{ + Name: "Python 2", + Aliases: []string{"python2", "py2"}, + Filenames: []string{}, + MimeTypes: []string{"text/x-python2", "application/x-python2"}, + }, + python2Rules, +)) + +func python2Rules() Rules { + return 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/backend/vendor/github.com/alecthomas/chroma/lexers/q/qbasic.go b/backend/vendor/github.com/alecthomas/chroma/lexers/q/qbasic.go index fd47c080..1e36f865 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/q/qbasic.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/q/qbasic.go @@ -6,14 +6,18 @@ import ( ) // Qbasic lexer. -var Qbasic = internal.Register(MustNewLexer( +var Qbasic = internal.Register(MustNewLazyLexer( &Config{ Name: "QBasic", Aliases: []string{"qbasic", "basic"}, Filenames: []string{"*.BAS", "*.bas"}, MimeTypes: []string{"text/basic"}, }, - Rules{ + qbasicRules, +)) + +func qbasicRules() Rules { + return Rules{ "root": { {`\n+`, Text, nil}, {`\s+`, TextWhitespace, nil}, @@ -63,5 +67,5 @@ var Qbasic = internal.Register(MustNewLexer( "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/backend/vendor/github.com/alecthomas/chroma/lexers/q/qml.go b/backend/vendor/github.com/alecthomas/chroma/lexers/q/qml.go new file mode 100644 index 00000000..dfd3c753 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/q/qml.go @@ -0,0 +1,58 @@ +package q + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Qml lexer. +var Qml = internal.Register(MustNewLazyLexer( + &Config{ + Name: "QML", + Aliases: []string{"qml", "qbs"}, + Filenames: []string{"*.qml", "*.qbs"}, + MimeTypes: []string{"application/x-qml", "application/x-qt.qbs+qml"}, + DotAll: true, + }, + qmlRules, +)) + +func qmlRules() Rules { + return Rules{ + "commentsandwhitespace": { + {`\s+`, Text, nil}, + {``, `role`, `state`, `sub`, `no`, + `submethod`, `subset`, `succeed`, `supersede`, `try`, `unit`, `unless`, `until`, + `use`, `when`, `while`, `with`, `without`, `export`, `native`, `repr`, `required`, `rw`, + `symbol`, `default`, `cached`, `DEPRECATED`, `dynamic`, `hidden-from-backtrace`, `nodal`, + `pure`, `raw`, `start`, `react`, `supply`, `whenever`, `also`, `rule`, `token`, `regex`, + `dynamic-scope`, `built`, `temp`, + } + + keywordsPattern := Words(`(?)`, `(>=)`, `minmax`, `notandthen`, `S`, + } + + wordOperatorsPattern := Words(`(?<=^|\b|\s)`, `(?=$|\b|\s)`, wordOperators...) + + operators := []string{ + `++`, `--`, `-`, `**`, `!`, `+`, `~`, `?`, `+^`, `~^`, `?^`, `^`, `*`, `/`, `%`, `%%`, `+&`, + `+<`, `+>`, `~&`, `~<`, `~>`, `?&`, `+|`, `+^`, `~|`, `~^`, `?`, `?|`, `?^`, `&`, `^`, + `<=>`, `^…^`, `^…`, `…^`, `…`, `...`, `...^`, `^...`, `^...^`, `..`, `..^`, `^..`, `^..^`, + `::=`, `:=`, `!=`, `==`, `<=`, `<`, `>=`, `>`, `~~`, `===`, `&&`, `||`, `|`, `^^`, `//`, + `??`, `!!`, `^fff^`, `^ff^`, `<==`, `==>`, `<<==`, `==>>`, `=>`, `=`, `<<`, `«`, `>>`, `»`, + `,`, `>>.`, `».`, `.&`, `.=`, `.^`, `.?`, `.+`, `.*`, `.`, `∘`, `∩`, `⊍`, `∪`, `⊎`, `∖`, + `⊖`, `≠`, `≤`, `≥`, `=:=`, `=~=`, `≅`, `∈`, `∉`, `≡`, `≢`, `∋`, `∌`, `⊂`, `⊄`, `⊆`, `⊈`, + `⊃`, `⊅`, `⊇`, `⊉`, `:`, `!!!`, `???`, `¯`, `×`, `÷`, `−`, `⁺`, `⁻`, + } + + operatorsPattern := Words(``, ``, operators...) + + builtinTypes := []string{ + `False`, `True`, `Order`, `More`, `Less`, `Same`, `Any`, `Array`, `Associative`, `AST`, + `atomicint`, `Attribute`, `Backtrace`, `Backtrace::Frame`, `Bag`, `Baggy`, `BagHash`, + `Blob`, `Block`, `Bool`, `Buf`, `Callable`, `CallFrame`, `Cancellation`, `Capture`, + `CArray`, `Channel`, `Code`, `compiler`, `Complex`, `ComplexStr`, `CompUnit`, + `CompUnit::PrecompilationRepository`, `CompUnit::Repository`, `Empty`, + `CompUnit::Repository::FileSystem`, `CompUnit::Repository::Installation`, `Cool`, + `CurrentThreadScheduler`, `CX::Warn`, `CX::Take`, `CX::Succeed`, `CX::Return`, `CX::Redo`, + `CX::Proceed`, `CX::Next`, `CX::Last`, `CX::Emit`, `CX::Done`, `Cursor`, `Date`, `Dateish`, + `DateTime`, `Distribution`, `Distribution::Hash`, `Distribution::Locally`, + `Distribution::Path`, `Distribution::Resource`, `Distro`, `Duration`, `Encoding`, + `Encoding::Registry`, `Endian`, `Enumeration`, `Exception`, `Failure`, `FatRat`, `Grammar`, + `Hash`, `HyperWhatever`, `Instant`, `Int`, `int`, `int16`, `int32`, `int64`, `int8`, `str`, + `IntStr`, `IO`, `IO::ArgFiles`, `IO::CatHandle`, `IO::Handle`, `IO::Notification`, + `IO::Notification::Change`, `IO::Path`, `IO::Path::Cygwin`, `IO::Path::Parts`, + `IO::Path::QNX`, `IO::Path::Unix`, `IO::Path::Win32`, `IO::Pipe`, `IO::Socket`, + `IO::Socket::Async`, `IO::Socket::Async::ListenSocket`, `IO::Socket::INET`, `IO::Spec`, + `IO::Spec::Cygwin`, `IO::Spec::QNX`, `IO::Spec::Unix`, `IO::Spec::Win32`, `IO::Special`, + `Iterable`, `Iterator`, `Junction`, `Kernel`, `Label`, `List`, `Lock`, `Lock::Async`, + `Lock::ConditionVariable`, `long`, `longlong`, `Macro`, `Map`, `Match`, + `Metamodel::AttributeContainer`, `Metamodel::C3MRO`, `Metamodel::ClassHOW`, + `Metamodel::ConcreteRoleHOW`, `Metamodel::CurriedRoleHOW`, `Metamodel::DefiniteHOW`, + `Metamodel::Documenting`, `Metamodel::EnumHOW`, `Metamodel::Finalization`, + `Metamodel::MethodContainer`, `Metamodel::Mixins`, `Metamodel::MROBasedMethodDispatch`, + `Metamodel::MultipleInheritance`, `Metamodel::Naming`, `Metamodel::Primitives`, + `Metamodel::PrivateMethodContainer`, `Metamodel::RoleContainer`, `Metamodel::RolePunning`, + `Metamodel::Stashing`, `Metamodel::Trusting`, `Metamodel::Versioning`, `Method`, `Mix`, + `MixHash`, `Mixy`, `Mu`, `NFC`, `NFD`, `NFKC`, `NFKD`, `Nil`, `Num`, `num32`, `num64`, + `Numeric`, `NumStr`, `ObjAt`, `Order`, `Pair`, `Parameter`, `Perl`, `Pod::Block`, + `Pod::Block::Code`, `Pod::Block::Comment`, `Pod::Block::Declarator`, `Pod::Block::Named`, + `Pod::Block::Para`, `Pod::Block::Table`, `Pod::Heading`, `Pod::Item`, `Pointer`, + `Positional`, `PositionalBindFailover`, `Proc`, `Proc::Async`, `Promise`, `Proxy`, + `PseudoStash`, `QuantHash`, `RaceSeq`, `Raku`, `Range`, `Rat`, `Rational`, `RatStr`, + `Real`, `Regex`, `Routine`, `Routine::WrapHandle`, `Scalar`, `Scheduler`, `Semaphore`, + `Seq`, `Sequence`, `Set`, `SetHash`, `Setty`, `Signature`, `size_t`, `Slip`, `Stash`, + `Str`, `StrDistance`, `Stringy`, `Sub`, `Submethod`, `Supplier`, `Supplier::Preserving`, + `Supply`, `Systemic`, `Tap`, `Telemetry`, `Telemetry::Instrument::Thread`, + `Telemetry::Instrument::ThreadPool`, `Telemetry::Instrument::Usage`, `Telemetry::Period`, + `Telemetry::Sampler`, `Thread`, `Test`, `ThreadPoolScheduler`, `UInt`, `uint16`, `uint32`, + `uint64`, `uint8`, `Uni`, `utf8`, `ValueObjAt`, `Variable`, `Version`, `VM`, `Whatever`, + `WhateverCode`, `WrapHandle`, `NativeCall`, + // Pragmas + `precompilation`, `experimental`, `worries`, `MONKEY-TYPING`, `MONKEY-SEE-NO-EVAL`, + `MONKEY-GUTS`, `fatal`, `lib`, `isms`, `newline`, `nqp`, `soft`, + `strict`, `trace`, `variables`, + } + + builtinTypesPattern := Words(`(? 0 { + nextOpenPos := indexAt(text, openingChars, searchPos+nChars) + nextClosePos = indexAt(text, closingChars, searchPos+nChars) + + switch { + case nextClosePos == -1: + nextClosePos = len(text) + nestingLevel = 0 + case nextOpenPos != -1 && nextOpenPos < nextClosePos: + nestingLevel++ + nChars = len(openingChars) + searchPos = nextOpenPos + default: // next_close_pos < next_open_pos + nestingLevel-- + nChars = len(closingChars) + searchPos = nextClosePos + } + } + + endPos = nextClosePos + } + + if endPos < 0 { + // if we didn't find a closer, just highlight the + // rest of the text in this class + endPos = len(text) + } + + adverbre := regexp.MustCompile(`:to\b|:heredoc\b`) + var heredocTerminator []rune + if adverbre.MatchString(string(adverbs)) { + heredocTerminator = text[state.Pos:endPos] + if len(heredocTerminator) > 0 { + endHeredocPos := indexAt(text[endPos:], heredocTerminator, 0) + nChars = len(heredocTerminator) + endPos += endHeredocPos + } else { + endPos = len(text) + } + } + + textBetweenBrackets := string(text[state.Pos:endPos]) + switch tokenClass { + case rakuPod, rakuPodDeclaration, rakuNameAttribute: + state.NamedGroups[`value`] = textBetweenBrackets + state.NamedGroups[`closing_delimiters`] = string(closingChars) + case rakuQuote: + if len(heredocTerminator) > 0 { + // Length of heredoc terminator + closing chars + `;` + heredocFristPunctuationLen := len(heredocTerminator) + len(openingChars) + 1 + + state.NamedGroups[`opening_delimiters`] = string(openingChars) + + string(text[state.Pos:state.Pos+heredocFristPunctuationLen]) + + state.NamedGroups[`value`] = + string(text[state.Pos+heredocFristPunctuationLen : endPos]) + + state.NamedGroups[`closing_delimiters`] = string(heredocTerminator) + } else { + state.NamedGroups[`value`] = textBetweenBrackets + state.NamedGroups[`closing_delimiters`] = string(closingChars) + } + default: + state.Groups = []string{state.Groups[0] + string(text[state.Pos:endPos+nChars])} + } + + state.Pos = endPos + nChars + + return nil + } + } + + // Raku rules + // Empty capture groups are placeholders and will be replaced by bracketsFinder. + // DO NOT REMOVE THEM! + return Rules{ + "root": { + Include("common"), + {`[{}();]`, Punctuation, nil}, + {`\[|\]`, Operator, nil}, + {`.+?`, Text, nil}, + }, + "common": { + {`^#![^\n]*$`, CommentHashbang, nil}, + Include("pod"), + // Multi-line, Embedded comment + { + "#`(?(?" + bracketsPattern + `)\k*)`, + CommentMultiline, + bracketsFinder(rakuMultilineComment), + }, + {`#[^\n]*$`, CommentSingle, nil}, + // /regex/ + { + `(?<=(?:^|\(|=|:|~~|\[|,|=>)\s*)(/)(?!\]|\))((?:\\\\|\\/|.)*?)((?>)(\S+?)(<<)`, ByGroups(Operator, UsingSelf("root"), Operator), nil}, + {`(»)(\S+?)(«)`, ByGroups(Operator, UsingSelf("root"), Operator), nil}, + // Hyperoperator | «*« + {`(<<)(\S+?)(<<)`, ByGroups(Operator, UsingSelf("root"), Operator), nil}, + {`(«)(\S+?)(«)`, ByGroups(Operator, UsingSelf("root"), Operator), nil}, + // Hyperoperator | »*» + {`(>>)(\S+?)(>>)`, ByGroups(Operator, UsingSelf("root"), Operator), nil}, + {`(»)(\S+?)(»)`, ByGroups(Operator, UsingSelf("root"), Operator), nil}, + // <> + {`(?>)[^\n])+?[},;] *\n)(?!(?:(?!>>).)+?>>\S+?>>)`, Punctuation, Push("<<")}, + // «quoted words» + {`(? operators | something < onething > something + { + `(?<=[$@%&]?\w[\w':-]* +)(<=?)( *[^ ]+? *)(>=?)(?= *[$@%&]?\w[\w':-]*)`, + ByGroups(Operator, UsingSelf("root"), Operator), + nil, + }, + // + { + `(?])+?)(>)(?!\s*(?:\d+|\.(?:Int|Numeric)|[$@%]\w[\w':-]*[^(]|\s+\[))`, + ByGroups(Punctuation, String, Punctuation), + nil, + }, + {`C?X::['\w:-]+`, NameException, nil}, + Include("metaoperator"), + // Pair | (key) => value + { + `(\([^)]+\))(\s*)(=>)(\s*)([^,\n]+)(,?\n*)`, + ByGroups(UsingSelf("root"), Text, Operator, Text, UsingSelf("root"), Text), + nil, + }, + // Pair | key => value + { + `(\w[\w'-]*)(\s*)(=>)(\s*)([^,\n]+)(,?\n*)`, + ByGroups(String, Text, Operator, Text, UsingSelf("root"), Text), + nil, + }, + Include("colon-pair"), + // Token + { + // Token with adverbs + `(?<=(?:^|\s)(?:regex|token|rule)(\s+))(['\w:-]+)(?=:['\w-]+` + + colonPairOpeningBrackets + `.+?` + colonPairClosingBrackets + `[({])`, + NameFunction, + Push("token", "name-adverb"), + }, + { + // Token without adverbs + `(?<=(?:^|\s)(?:regex|token|rule)(?:\s+))(['\w:-]+)`, + NameFunction, + Push("token"), + }, + // Substitution + {`(?<=^|\b|\s)(?(?:qq|q|Q))(?(?::?(?:heredoc|to|qq|ww|q|w|s|a|h|f|c|b|to|v|x))*)(?\s*)(?(?[^0-9a-zA-Z:\s])\k*)`, + EmitterFunc(quote), + bracketsFinder(rakuQuote), + }, + // Function + { + `\b(?:\w['\w:-]*)(?=:['\w-]+` + + colonPairOpeningBrackets + `.+?` + colonPairClosingBrackets + `\()`, + NameFunction, + Push("name-adverb"), + }, + {`\b(?:\w['\w:-]*)(?=\()`, NameFunction, nil}, + // Method + // Method with adverb + { + `(?(?[^\w:\s])\k*)`, + ByGroupNames(map[string]Emitter{ + `opening_delimiters`: Punctuation, + `delimiter`: nil, + }), + Mutators(Pop(1), bracketsFinder(rakuMatchRegex)), + }, + }, + "substitution": { + Include("colon-pair-attribute"), + // Substitution | s{regex} = value + { + `(?(?` + bracketsPattern + `)\k*)`, + ByGroupNames(map[string]Emitter{ + `opening_delimiters`: Punctuation, + `delimiter`: nil, + }), + Mutators(Pop(1), bracketsFinder(rakuSubstitutionSingleRegex)), + }, + // Substitution | s/regex/string/ + { + `([^\w:\s])((?:\\\\|\\/|.)*?)(\1)((?:\\\\|\\/|.)*?)(\1)`, + ByGroups( + Punctuation, UsingSelf("regex"), Punctuation, UsingSelf("qq"), Punctuation, + ), + Mutators(Pop(1), MutatorFunc(makeRegexPoppingRule)), + }, + }, + "number": { + {`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+)i`, NameConstant, nil}, + {`\d+(_\d+)*`, LiteralNumberInteger, nil}, + }, + "name-adverb": { + Include("colon-pair-attribute-keyvalue"), + Default(Pop(1)), + }, + "colon-pair": { + // :key(value) + {colonPairPattern, colonPair(String), bracketsFinder(rakuNameAttribute)}, + // :123abc + { + `(:)(\d+)(\w[\w'-]*)(\s*[,;)]?\s*$)`, + ByGroups(Punctuation, UsingSelf("number"), String, Text), + nil, + }, + // :key + {`(:!?)(\w[\w'-]*)`, ByGroups(Punctuation, String), nil}, + {`\s+`, Text, nil}, + }, + "colon-pair-attribute": { + // :key(value) + {colonPairPattern, colonPair(NameAttribute), bracketsFinder(rakuNameAttribute)}, + // :123abc + { + `(:)(\d+)(\w+)(\s*[,;)]?\s*$)`, + ByGroups(Punctuation, UsingSelf("number"), NameAttribute, Text), + nil, + }, + // :key + {`(:!?)(\w[\w'-]*)`, ByGroups(Punctuation, NameAttribute), nil}, + {`\s+`, Text, nil}, + }, + "colon-pair-attribute-keyvalue": { + // :key(value) + {colonPairPattern, colonPair(NameAttribute), bracketsFinder(rakuNameAttribute)}, + }, + "escape-qq": { + { + `(? + { + `(?)`, + ByGroups(Punctuation, Operator, Punctuation, UsingSelf("root"), Punctuation), + nil, + }, + // {code} + {`(?>|»|\+|\*\*|\*|\?|=|~|<~~>`, Operator, nil}, + // Anchors + {`\^\^|\^|\$\$|\$`, NameEntity, nil}, + {`\.`, NameEntity, nil}, + {`#[^\n]*\n`, CommentSingle, nil}, + // Lookaround + { + `(?)`, + ByGroups(Punctuation, Operator, OperatorWord, Punctuation), + nil, + }, + // <$variable> + { + `(?)`, + ByGroups(Punctuation, NameVariable, Punctuation), + nil, + }, + // Capture markers + {`(?`, Operator, nil}, + {`(?)`, Punctuation, Pop(1)}, + {`(?`, Punctuation, Pop(1)}, + Include("regex-class-builtin"), + Include("variable"), + // | | + { + `(?:(\w[\w-:]*)(=\.?))?(&?\w[\w'-:]+?)(\(.+?\))?(?=>)`, + ByGroups( + NameVariable, Operator, NameFunction, UsingSelf("root"), + ), + nil, + }, + // + { + `(&?\w[\w':-]*?)(:)((?:.*?(?:\$<\w[\w':-]*>)?.*?)*?)(?=>)`, + ByGroups( + NameFunction, Punctuation, UsingSelf("root"), + ), + nil, + }, + Include("colon-pair-attribute"), + {`(?] + { + `\b([RZX]+)\b(\[)([^\s\]]+?)(\])`, + ByGroups(OperatorWord, Punctuation, UsingSelf("root"), Punctuation), + nil, + }, + // Z=> + {`\b([RZX]+)\b([^\s\]]+)`, ByGroups(OperatorWord, UsingSelf("operator")), nil}, + }, + "operator": { + // Word Operator + {wordOperatorsPattern, OperatorWord, nil}, + // Operator + {operatorsPattern, Operator, nil}, + }, + "pod": { + // Single-line pod declaration + {`(#[|=])\s`, Keyword, Push("pod-single")}, + // Multi-line pod declaration + { + "(?#[|=])(?(?" + bracketsPattern + `)\k*)(?)(?)`, + ByGroupNames( + map[string]Emitter{ + `keyword`: Keyword, + `opening_delimiters`: Punctuation, + `delimiter`: nil, + `value`: UsingSelf("pod-begin"), + `closing_delimiters`: Punctuation, + }), + bracketsFinder(rakuPodDeclaration), + }, + Include("pod-blocks"), + }, + "pod-blocks": { + // =begin code + { + `(?<=^ *)(? *)(?=begin)(? +)(?code)(?[^\n]*)(?.*?)(?^\k)(?=end)(? +)\k`, + EmitterFunc(podCode), + nil, + }, + // =begin + { + `(?<=^ *)(? *)(?=begin)(? +)(?!code)(?\w[\w'-]*)(?[^\n]*)(?)(?)`, + ByGroupNames( + map[string]Emitter{ + `ws`: Comment, + `keyword`: Keyword, + `ws2`: StringDoc, + `name`: Keyword, + `config`: EmitterFunc(podConfig), + `value`: UsingSelf("pod-begin"), + `closing_delimiters`: Keyword, + }), + bracketsFinder(rakuPod), + }, + // =for ... + { + `(?<=^ *)(? *)(?=(?:for|defn))(? +)(?\w[\w'-]*)(?[^\n]*\n)`, + ByGroups(Comment, Keyword, StringDoc, Keyword, EmitterFunc(podConfig)), + Push("pod-paragraph"), + }, + // =config + { + `(?<=^ *)(? *)(?=config)(? +)(?\w[\w'-]*)(?[^\n]*\n)`, + ByGroups(Comment, Keyword, StringDoc, Keyword, EmitterFunc(podConfig)), + nil, + }, + // =alias + { + `(?<=^ *)(? *)(?=alias)(? +)(?\w[\w'-]*)(?[^\n]*\n)`, + ByGroups(Comment, Keyword, StringDoc, Keyword, StringDoc), + nil, + }, + // =encoding + { + `(?<=^ *)(? *)(?=encoding)(? +)(?[^\n]+)`, + ByGroups(Comment, Keyword, StringDoc, Name), + nil, + }, + // =para ... + { + `(?<=^ *)(? *)(?=(?:para|table|pod))(?(? *)(?=head\d+)(? *)(?#?)`, + ByGroups(Comment, Keyword, GenericHeading, Keyword), + Push("pod-single-heading"), + }, + // =item ... + { + `(?<=^ *)(? *)(?=(?:item\d*|comment|data|[A-Z]+))(? *)(?#?)`, + ByGroups(Comment, Keyword, StringDoc, Keyword), + Push("pod-single"), + }, + { + `(?<=^ *)(? *)(?=finish)(?[^\n]*)`, + ByGroups(Comment, Keyword, EmitterFunc(podConfig)), + Push("pod-finish"), + }, + // ={custom} ... + { + `(?<=^ *)(? *)(?=\w[\w'-]*)(? *)(?#?)`, + ByGroups(Comment, Name, StringDoc, Keyword), + Push("pod-single"), + }, + // = podconfig + { + `(?<=^ *)(? *=)(? *)(?(?::\w[\w'-]*(?:` + colonPairOpeningBrackets + `.+?` + + colonPairClosingBrackets + `) *)*\n)`, + ByGroups(Keyword, StringDoc, EmitterFunc(podConfig)), + nil, + }, + }, + "pod-begin": { + Include("pod-blocks"), + Include("pre-pod-formatter"), + {`.+?`, StringDoc, nil}, + }, + "pod-paragraph": { + {`\n\s*?\n`, StringDoc, Pop(1)}, + Include("pre-pod-formatter"), + {`.+?`, StringDoc, nil}, + }, + "pod-single": { + {`\n`, StringDoc, Pop(1)}, + Include("pre-pod-formatter"), + {`.+?`, StringDoc, nil}, + }, + "pod-single-heading": { + {`\n`, GenericHeading, Pop(1)}, + Include("pre-pod-formatter"), + {`.+?`, GenericHeading, nil}, + }, + "pod-finish": { + {`\z`, nil, Pop(1)}, + Include("pre-pod-formatter"), + {`.+?`, StringDoc, nil}, + }, + "pre-pod-formatter": { + // C, B, ... + { + `(?[CBIUDTKRPAELZVMSXN])(?<+|«)`, + ByGroups(Keyword, Punctuation), + Mutators( + bracketsFinder(rakuPodFormatter), + Push("pod-formatter"), MutatorFunc(podFormatter), + ), + }, + }, + "pod-formatter": { + // Placeholder rule, will be replaced by podFormatter. DO NOT REMOVE! + {`>`, Punctuation, Pop(1)}, + Include("pre-pod-formatter"), + // Placeholder rule, will be replaced by podFormatter. DO NOT REMOVE! + {`.+?`, StringOther, nil}, + }, + "variable": { + {variablePattern, NameVariable, Push("name-adverb")}, + {globalVariablePattern, NameVariableGlobal, Push("name-adverb")}, + {`[$@](?:<.*?>)+`, NameVariable, nil}, + {`\$/`, NameVariable, nil}, + {`\$!`, NameVariable, nil}, + {`[$@%]`, NameVariable, nil}, + }, + "single-quote": { + {`(?>(?!\s*(?:\d+|\.(?:Int|Numeric)|[$@%][\w':-]+|\s+\[))`, Punctuation, Pop(1)}, + Include("ww"), + }, + "«": { + {`»(?!\s*(?:\d+|\.(?:Int|Numeric)|[$@%][\w':-]+|\s+\[))`, Punctuation, Pop(1)}, + Include("ww"), + }, + "ww": { + Include("single-quote"), + Include("qq"), + }, + "qq": { + Include("qq-variable"), + // Function with adverb + { + `\w[\w:'-]+(?=:['\w-]+` + + colonPairOpeningBrackets + `.+?` + colonPairClosingBrackets + `\()`, + NameFunction, + Push("qq-function", "name-adverb"), + }, + // Function without adverb + {`\w[\w:'-]+(?=\((?!"))`, NameFunction, Push("qq-function")}, + Include("closure"), + Include("escape-hexadecimal"), + Include("escape-c-name"), + Include("escape-qq"), + {`.+?`, StringDouble, nil}, + }, + "qq-function": { + {`(\([^"]*?\))`, UsingSelf("root"), nil}, + Default(Pop(1)), + }, + "qq-variable": { + { + `(?>|<.*?>|«.*?»)+`, UsingSelf("root"), nil}, + // Method + { + `(\.)([^(\s]+)(\([^"]*?\))`, + ByGroups(Operator, NameFunction, UsingSelf("root")), + nil, + }, + Default(Pop(1)), + }, + "Q": { + Include("escape-qq"), + {`.+?`, String, nil}, + }, + "Q-closure": { + Include("escape-qq"), + Include("closure"), + {`.+?`, String, nil}, + }, + "Q-variable": { + Include("escape-qq"), + Include("qq-variable"), + {`.+?`, String, nil}, + }, + "closure": { + {`(? -1 { + idx = utf8.RuneCountInString(text[:idx]) + idx += pos + } + + return idx +} + +// Tells if an array of string contains a string +func contains(s []string, e string) bool { + for _, value := range s { + if value == e { + return true + } + } + return false +} + +type RakuFormatterRules struct { + pop, formatter *CompiledRule +} + +// Pop from the pod_formatter_stack and reformat the pod code +func podFormatterPopper(state *LexerState) error { + stack, ok := state.Get("pod_formatter_stack").([]RakuFormatterRules) + + if ok && len(stack) > 0 { + // Pop from stack + stack = stack[:len(stack)-1] + state.Set("pod_formatter_stack", stack) + // Call podFormatter to use the last formatter rules + err := podFormatter(state) + if err != nil { + panic(err) + } + } + + return nil +} + +// Use the rules from pod_formatter_stack to format the pod code +func podFormatter(state *LexerState) error { + stack, ok := state.Get("pod_formatter_stack").([]RakuFormatterRules) + if ok && len(stack) > 0 { + rules := stack[len(stack)-1] + state.Rules["pod-formatter"][0] = rules.pop + state.Rules["pod-formatter"][len(state.Rules["pod-formatter"])-1] = rules.formatter + } + + return nil +} + +type RulePosition int + +const ( + topRule RulePosition = iota + 1000 + bottomRule +) + +type RuleMakingConfig struct { + delimiter []rune + pattern string + tokenType TokenType + mutator Mutator + rulePosition RulePosition + state *LexerState + stateName string + pushToStack bool + numberOfDelimiterChars int +} + +// Makes compiled rules and returns them, If rule position is given, rules are added to the state +// If pushToStack is true, state name will be added to the state stack +func makeRuleAndPushMaybe(config RuleMakingConfig) *CompiledRule { + var rePattern string + if len(config.delimiter) > 0 { + delimiter := strings.Repeat(string(config.delimiter), config.numberOfDelimiterChars) + rePattern = regexp2.Escape(delimiter) + } else { + rePattern = config.pattern + } + regex := regexp2.MustCompile(rePattern, regexp2.None) + + cRule := &CompiledRule{ + Rule: Rule{rePattern, config.tokenType, config.mutator}, + Regexp: regex, + } + state := config.state + stateName := config.stateName + switch config.rulePosition { + case topRule: + state.Rules[stateName] = + append([]*CompiledRule{cRule}, state.Rules[stateName][1:]...) + case bottomRule: + state.Rules[stateName] = + append(state.Rules[stateName][:len(state.Rules[stateName])-1], cRule) + } + + // Push state name to stack if asked + if config.pushToStack { + state.Stack = append(state.Stack, config.stateName) + } + + return cRule +} + +// Used when the regex knows its own delimiter and uses `UsingSelf("regex")`, +// it only puts a placeholder rule at the top of "regex" state +func makeRegexPoppingRule(state *LexerState) error { + makeRuleAndPushMaybe(RuleMakingConfig{ + pattern: `^$`, + rulePosition: topRule, + state: state, + stateName: "regex", + }) + + return nil +} + +// Emitter for colon pairs, changes token state based on key and brackets +func colonPair(tokenClass TokenType) Emitter { + return EmitterFunc(func(groups []string, state *LexerState) Iterator { + iterators := []Iterator{} + tokens := []Token{ + {Punctuation, state.NamedGroups[`colon`]}, + {Punctuation, state.NamedGroups[`opening_delimiters`]}, + {Punctuation, state.NamedGroups[`closing_delimiters`]}, + } + + // Append colon + iterators = append(iterators, Literator(tokens[0])) + + if tokenClass == NameAttribute { + iterators = append(iterators, Literator(Token{NameAttribute, state.NamedGroups[`key`]})) + } else { + var keyTokenState string + keyre := regexp.MustCompile(`^\d+$`) + if keyre.MatchString(state.NamedGroups[`key`]) { + keyTokenState = "common" + } else { + keyTokenState = "Q" + } + + // Use token state to Tokenise key + if keyTokenState != "" { + iterator, err := state.Lexer.Tokenise( + &TokeniseOptions{ + State: keyTokenState, + Nested: true, + }, state.NamedGroups[`key`]) + + if err != nil { + panic(err) + } else { + // Append key + iterators = append(iterators, iterator) + } + } + } + + // Append punctuation + iterators = append(iterators, Literator(tokens[1])) + + var valueTokenState string + + switch state.NamedGroups[`opening_delimiters`] { + case "(", "{", "[": + valueTokenState = "root" + case "<<", "«": + valueTokenState = "ww" + case "<": + valueTokenState = "Q" + } + + // Use token state to Tokenise value + if valueTokenState != "" { + iterator, err := state.Lexer.Tokenise( + &TokeniseOptions{ + State: valueTokenState, + Nested: true, + }, state.NamedGroups[`value`]) + + if err != nil { + panic(err) + } else { + // Append value + iterators = append(iterators, iterator) + } + } + // Append last punctuation + iterators = append(iterators, Literator(tokens[2])) + + return Concaterator(iterators...) + }) +} + +// Emitter for quoting constructs, changes token state based on quote name and adverbs +func quote(groups []string, state *LexerState) Iterator { + keyword := state.NamedGroups[`keyword`] + adverbsStr := state.NamedGroups[`adverbs`] + iterators := []Iterator{} + tokens := []Token{ + {Keyword, keyword}, + {StringAffix, adverbsStr}, + {Text, state.NamedGroups[`ws`]}, + {Punctuation, state.NamedGroups[`opening_delimiters`]}, + {Punctuation, state.NamedGroups[`closing_delimiters`]}, + } + + // Append all tokens before dealing with the main string + iterators = append(iterators, Literator(tokens[:4]...)) + + var tokenStates []string + + // Set tokenStates based on adverbs + adverbs := strings.Split(adverbsStr, ":") + for _, adverb := range adverbs { + switch adverb { + case "c", "closure": + tokenStates = append(tokenStates, "Q-closure") + case "qq": + tokenStates = append(tokenStates, "qq") + case "ww": + tokenStates = append(tokenStates, "ww") + case "s", "scalar", "a", "array", "h", "hash", "f", "function": + tokenStates = append(tokenStates, "Q-variable") + } + } + + var tokenState string + + switch { + case keyword == "qq" || contains(tokenStates, "qq"): + tokenState = "qq" + case adverbsStr == "ww" || contains(tokenStates, "ww"): + tokenState = "ww" + case contains(tokenStates, "Q-closure") && contains(tokenStates, "Q-variable"): + tokenState = "qq" + case contains(tokenStates, "Q-closure"): + tokenState = "Q-closure" + case contains(tokenStates, "Q-variable"): + tokenState = "Q-variable" + default: + tokenState = "Q" + } + + iterator, err := state.Lexer.Tokenise( + &TokeniseOptions{ + State: tokenState, + Nested: true, + }, state.NamedGroups[`value`]) + + if err != nil { + panic(err) + } else { + iterators = append(iterators, iterator) + } + + // Append the last punctuation + iterators = append(iterators, Literator(tokens[4])) + + return Concaterator(iterators...) +} + +// Emitter for pod config, tokenises the properties with "colon-pair-attribute" state +func podConfig(groups []string, state *LexerState) Iterator { + // Tokenise pod config + iterator, err := state.Lexer.Tokenise( + &TokeniseOptions{ + State: "colon-pair-attribute", + Nested: true, + }, groups[0]) + + if err != nil { + panic(err) + } else { + return iterator + } +} + +// Emitter for pod code, tokenises the code based on the lang specified +func podCode(groups []string, state *LexerState) Iterator { + iterators := []Iterator{} + tokens := []Token{ + {Comment, state.NamedGroups[`ws`]}, + {Keyword, state.NamedGroups[`keyword`]}, + {Keyword, state.NamedGroups[`ws2`]}, + {Keyword, state.NamedGroups[`name`]}, + {StringDoc, state.NamedGroups[`value`]}, + {Comment, state.NamedGroups[`ws3`]}, + {Keyword, state.NamedGroups[`end_keyword`]}, + {Keyword, state.NamedGroups[`ws4`]}, + {Keyword, state.NamedGroups[`name`]}, + } + + // Append all tokens before dealing with the pod config + iterators = append(iterators, Literator(tokens[:4]...)) + + // Tokenise pod config + iterators = append(iterators, podConfig([]string{state.NamedGroups[`config`]}, state)) + + langMatch := regexp.MustCompile(`:lang\W+(\w+)`).FindStringSubmatch(state.NamedGroups[`config`]) + var lang string + if len(langMatch) > 1 { + lang = langMatch[1] + } + + // Tokenise code based on lang property + sublexer := internal.Get(lang) + if sublexer != nil { + iterator, err := sublexer.Tokenise(nil, state.NamedGroups[`value`]) + + if err != nil { + panic(err) + } else { + iterators = append(iterators, iterator) + } + } else { + iterators = append(iterators, Literator(tokens[4])) + } + + // Append the rest of the tokens + iterators = append(iterators, Literator(tokens[5:]...)) + + return Concaterator(iterators...) +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/r/reasonml.go b/backend/vendor/github.com/alecthomas/chroma/lexers/r/reasonml.go new file mode 100644 index 00000000..0ade5691 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/r/reasonml.go @@ -0,0 +1,71 @@ +package r + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Reasonml lexer. +var Reasonml = internal.Register(MustNewLazyLexer( + &Config{ + Name: "ReasonML", + Aliases: []string{"reason", "reasonml"}, + Filenames: []string{"*.re", "*.rei"}, + MimeTypes: []string{"text/x-reasonml"}, + }, + reasonmlRules, +)) + +func reasonmlRules() Rules { + return Rules{ + "escape-sequence": { + {`\\[\\"\'ntbr]`, LiteralStringEscape, nil}, + {`\\[0-9]{3}`, LiteralStringEscape, nil}, + {`\\x[0-9a-fA-F]{2}`, LiteralStringEscape, nil}, + }, + "root": { + {`\s+`, Text, nil}, + {`false|true|\(\)|\[\]`, NameBuiltinPseudo, nil}, + {`\b([A-Z][\w\']*)(?=\s*\.)`, NameNamespace, Push("dotted")}, + {`\b([A-Z][\w\']*)`, NameClass, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`\/\*(?![\/])`, CommentMultiline, Push("comment")}, + {`\b(as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|false|for|fun|esfun|function|functor|if|in|include|inherit|initializer|lazy|let|switch|module|pub|mutable|new|nonrec|object|of|open|pri|rec|sig|struct|then|to|true|try|type|val|virtual|when|while|with)\b`, Keyword, nil}, + {"(~|\\}|\\|]|\\||\\|\\||\\{<|\\{|`|_|]|\\[\\||\\[>|\\[<|\\[|\\?\\?|\\?|>\\}|>]|>|=|<-|<|;;|;|:>|:=|::|:|\\.\\.\\.|\\.\\.|\\.|=>|-\\.|-|,|\\+|\\*|\\)|\\(|&&|&|#|!=)", OperatorWord, nil}, + {`([=<>@^|&+\*/$%-]|[!?~])?[!$%&*+\./:<=>?@^|~-]`, Operator, nil}, + {`\b(and|asr|land|lor|lsl|lsr|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": { + {`[^\/*]+`, CommentMultiline, nil}, + {`\/\*`, CommentMultiline, Push()}, + {`\*\/`, CommentMultiline, Pop(1)}, + {`[\*]`, CommentMultiline, 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/backend/vendor/github.com/alecthomas/chroma/lexers/r/regedit.go b/backend/vendor/github.com/alecthomas/chroma/lexers/r/regedit.go index 7ee9cb58..61772345 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/r/regedit.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/r/regedit.go @@ -6,14 +6,18 @@ import ( ) // Reg lexer. -var Reg = internal.Register(MustNewLexer( +var Reg = internal.Register(MustNewLazyLexer( &Config{ Name: "reg", Aliases: []string{"registry"}, Filenames: []string{"*.reg"}, MimeTypes: []string{"text/x-windows-registry"}, }, - Rules{ + regRules, +)) + +func regRules() Rules { + return Rules{ "root": { {`Windows Registry Editor.*`, Text, nil}, {`\s+`, Text, nil}, @@ -28,5 +32,5 @@ var Reg = internal.Register(MustNewLexer( {`.+`, LiteralString, Pop(1)}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/r/rexx.go b/backend/vendor/github.com/alecthomas/chroma/lexers/r/rexx.go index 1f5550a5..38ca768d 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/r/rexx.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/r/rexx.go @@ -6,7 +6,7 @@ import ( ) // Rexx lexer. -var Rexx = internal.Register(MustNewLexer( +var Rexx = internal.Register(MustNewLazyLexer( &Config{ Name: "Rexx", Aliases: []string{"rexx", "arexx"}, @@ -15,7 +15,11 @@ var Rexx = internal.Register(MustNewLexer( NotMultiline: true, CaseInsensitive: true, }, - Rules{ + rexxRules, +)) + +func rexxRules() Rules { + return Rules{ "root": { {`\s`, TextWhitespace, nil}, {`/\*`, CommentMultiline, Push("comment")}, @@ -55,5 +59,5 @@ var Rexx = internal.Register(MustNewLexer( {`\*/`, CommentMultiline, Pop(1)}, {`\*`, CommentMultiline, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/r/rst.go b/backend/vendor/github.com/alecthomas/chroma/lexers/r/rst.go index f09dad09..2a874790 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/r/rst.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/r/rst.go @@ -8,14 +8,18 @@ import ( ) // Restructuredtext lexer. -var Restructuredtext = internal.Register(MustNewLexer( +var Restructuredtext = internal.Register(MustNewLazyLexer( &Config{ Name: "reStructuredText", Aliases: []string{"rst", "rest", "restructuredtext"}, Filenames: []string{"*.rst", "*.rest"}, MimeTypes: []string{"text/x-rst", "text/prs.fallenstein.rst"}, }, - Rules{ + restructuredtextRules, +)) + +func restructuredtextRules() Rules { + return 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}, @@ -56,10 +60,10 @@ var Restructuredtext = internal.Register(MustNewLexer( {"``((?=$)|(?=[-/:.,; \\n\\x00\\\u2010\\\u2011\\\u2012\\\u2013\\\u2014\\\u00a0\\'\\\"\\)\\]\\}\\>\\\u2019\\\u201d\\\u00bb\\!\\?]))", LiteralString, Pop(1)}, {"`", LiteralString, nil}, }, - }, -)) + } +} -func rstCodeBlock(groups []string, lexer Lexer) Iterator { +func rstCodeBlock(groups []string, state *LexerState) Iterator { iterators := []Iterator{} tokens := []Token{ {Punctuation, groups[1]}, @@ -71,7 +75,7 @@ func rstCodeBlock(groups []string, lexer Lexer) Iterator { {Text, groups[7]}, } code := strings.Join(groups[8:], "") - lexer = internal.Get(groups[6]) + lexer := internal.Get(groups[6]) if lexer == nil { tokens = append(tokens, Token{String, code}) iterators = append(iterators, Literator(tokens...)) diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/r/ruby.go b/backend/vendor/github.com/alecthomas/chroma/lexers/r/ruby.go index 6af8db20..296cae9c 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/r/ruby.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/r/ruby.go @@ -6,7 +6,7 @@ import ( ) // Ruby lexer. -var Ruby = internal.Register(MustNewLexer( +var Ruby = internal.Register(MustNewLazyLexer( &Config{ Name: "Ruby", Aliases: []string{"rb", "ruby", "duby"}, @@ -14,7 +14,11 @@ var Ruby = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-ruby", "application/x-ruby"}, DotAll: true, }, - Rules{ + rubyRules, +)) + +func rubyRules() Rules { + return Rules{ "root": { {`\A#!.+?$`, CommentHashbang, nil}, {`#.*?$`, CommentSingle, nil}, @@ -39,7 +43,7 @@ var Ruby = internal.Register(MustNewLexer( {`(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}, + {`([\d]+(?:[_e]\d+)*)(\s*)([/?])?`, ByGroups(LiteralNumberInteger, Text, Operator), nil}, {`@@[a-zA-Z_]\w*`, NameVariableClass, nil}, {`@[a-zA-Z_]\w*`, NameVariableInstance, nil}, {`\$\w+`, NameVariableGlobal, nil}, @@ -246,5 +250,5 @@ var Ruby = internal.Register(MustNewLexer( {`[\\#<>]`, LiteralStringRegex, nil}, {`[^\\#<>]+`, LiteralStringRegex, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/r/rust.go b/backend/vendor/github.com/alecthomas/chroma/lexers/r/rust.go index 191d1bec..25d42e59 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/r/rust.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/r/rust.go @@ -6,7 +6,7 @@ import ( ) // Rust lexer. -var Rust = internal.Register(MustNewLexer( +var Rust = internal.Register(MustNewLazyLexer( &Config{ Name: "Rust", Aliases: []string{"rust"}, @@ -14,7 +14,11 @@ var Rust = internal.Register(MustNewLexer( MimeTypes: []string{"text/rust"}, EnsureNL: true, }, - Rules{ + rustRules, +)) + +func rustRules() Rules { + return Rules{ "root": { {`#![^[\r\n].*$`, CommentPreproc, nil}, Default(Push("base")), @@ -28,18 +32,18 @@ var Rust = internal.Register(MustNewLexer( {`/\*\*(\n|[^/*])`, LiteralStringDoc, Push("doccomment")}, {`/\*!`, LiteralStringDoc, Push("doccomment")}, {`/\*`, CommentMultiline, Push("comment")}, - {`r#*"(?:\\.|[^\\\r\n;])*"#*`, LiteralString, nil}, - {`"(?:\\.|[^\\\r\n"])*"`, LiteralString, nil}, + {`r#*"(?:\\.|[^\\;])*"#*`, LiteralString, nil}, + {`"(?:\\.|[^\\"])*"`, 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}, + {Words(``, `\b`, `as`, `async`, `await`, `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`, `become`, `box`, `do`, `final`, `macro`, `override`, `priv`, `try`, `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}, + {Words(``, `\b`, `u8`, `u16`, `u32`, `u64`, `u128`, `i8`, `i16`, `i32`, `i64`, `i128`, `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}, @@ -131,5 +135,5 @@ var Rust = internal.Register(MustNewLexer( {`\);?`, CommentPreproc, Pop(1)}, {`[^")]+`, CommentPreproc, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/sas.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/sas.go index 47a67ed8..016a91bb 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/sas.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/sas.go @@ -6,7 +6,7 @@ import ( ) // Sas lexer. -var Sas = internal.Register(MustNewLexer( +var Sas = internal.Register(MustNewLazyLexer( &Config{ Name: "SAS", Aliases: []string{"sas"}, @@ -14,7 +14,11 @@ var Sas = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-sas", "text/sas", "application/x-sas"}, CaseInsensitive: true, }, - Rules{ + sasRules, +)) + +func sasRules() Rules { + return Rules{ "root": { Include("comments"), Include("proc-data"), @@ -90,5 +94,5 @@ var Sas = internal.Register(MustNewLexer( "special": { {`(null|missing|_all_|_automatic_|_character_|_n_|_infile_|_name_|_null_|_numeric_|_user_|_webout_)`, KeywordConstant, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/sass.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/sass.go index 6200f6a3..1b733779 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/sass.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/sass.go @@ -6,7 +6,7 @@ import ( ) // Sass lexer. -var Sass = internal.Register(MustNewLexer( +var Sass = internal.Register(MustNewLazyLexer( &Config{ Name: "Sass", Aliases: []string{"sass"}, @@ -14,7 +14,11 @@ var Sass = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-sass"}, CaseInsensitive: true, }, - Rules{ + sassRules, +)) + +func sassRules() Rules { + return Rules{ // "root": { // }, "root": { @@ -140,5 +144,5 @@ var Sass = internal.Register(MustNewLexer( {`(from|to|through)`, OperatorWord, nil}, Include("value"), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/scala.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/scala.go index 20932de2..2885d01e 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/scala.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/scala.go @@ -7,15 +7,8 @@ import ( "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( +var Scala = internal.Register(MustNewLazyLexer( &Config{ Name: "Scala", Aliases: []string{"scala"}, @@ -23,7 +16,18 @@ var Scala = internal.Register(MustNewLexer( MimeTypes: []string{"text/x-scala"}, DotAll: true, }, - Rules{ + scalaRules, +)) + +func scalaRules() Rules { + 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) + ) + + return Rules{ "root": { {`(class|trait|object)(\s+)`, ByGroups(Keyword, Text), Push("class")}, {`[^\S\n]+`, Text, nil}, @@ -108,5 +112,5 @@ var Scala = internal.Register(MustNewLexer( {`\{`, LiteralStringInterpol, Push()}, Include("root"), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/scheme.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/scheme.go index b721d68d..d2f177ea 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/scheme.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/scheme.go @@ -8,14 +8,18 @@ import ( // nolint // Scheme lexer. -var SchemeLang = internal.Register(MustNewLexer( +var SchemeLang = internal.Register(MustNewLazyLexer( &Config{ Name: "Scheme", Aliases: []string{"scheme", "scm"}, Filenames: []string{"*.scm", "*.ss"}, MimeTypes: []string{"text/x-scheme", "application/x-scheme"}, }, - Rules{ + schemeLangRules, +)) + +func schemeLangRules() Rules { + return Rules{ "root": { {`;.*$`, CommentSingle, nil}, {`#\|`, CommentMultiline, Push("multiline-comment")}, @@ -49,5 +53,5 @@ var SchemeLang = internal.Register(MustNewLexer( {`\)`, Comment, Pop(1)}, {`[^()]+`, Comment, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/scilab.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/scilab.go index 87fa66cc..f8164927 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/scilab.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/scilab.go @@ -6,14 +6,18 @@ import ( ) // Scilab lexer. -var Scilab = internal.Register(MustNewLexer( +var Scilab = internal.Register(MustNewLazyLexer( &Config{ Name: "Scilab", Aliases: []string{"scilab"}, Filenames: []string{"*.sci", "*.sce", "*.tst"}, MimeTypes: []string{"text/scilab"}, }, - Rules{ + scilabRules, +)) + +func scilabRules() Rules { + return Rules{ "root": { {`//.*?$`, CommentSingle, nil}, {`^\s*function`, Keyword, Push("deffunc")}, @@ -40,5 +44,5 @@ var Scilab = internal.Register(MustNewLexer( {`(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)`, ByGroups(TextWhitespace, Text, TextWhitespace, Punctuation, TextWhitespace, NameFunction, Punctuation, Text, Punctuation, TextWhitespace), Pop(1)}, {`(\s*)([a-zA-Z_]\w*)`, ByGroups(Text, NameFunction), Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/scss.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/scss.go index 48195de3..e489aded 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/scss.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/scss.go @@ -6,7 +6,7 @@ import ( ) // Scss lexer. -var Scss = internal.Register(MustNewLexer( +var Scss = internal.Register(MustNewLazyLexer( &Config{ Name: "SCSS", Aliases: []string{"scss"}, @@ -16,24 +16,47 @@ var Scss = internal.Register(MustNewLexer( DotAll: true, CaseInsensitive: true, }, - Rules{ + scssRules, +)) + +func scssRules() Rules { + cssProperties := []string{`src`, `align-content`, `align-items`, `align-self`, `all`, `animation`, `animation-delay`, `animation-direction`, `animation-duration`, `animation-fill-mode`, `animation-iteration-count`, `animation-name`, `animation-play-state`, `animation-timing-function`, `appearance`, `aspect-ratio`, `backface-visibility`, `background`, `background-attachment`, `background-blend-mode`, `background-clip`, `background-color`, `background-image`, `background-origin`, `background-position`, `background-repeat`, `background-size`, `block-size`, `border`, `border-block`, `border-block-color`, `border-block-end`, `border-block-end-color`, `border-block-end-style`, `border-block-end-width`, `border-block-start`, `border-block-start-color`, `border-block-start-style`, `border-block-start-width`, `border-block-style`, `border-block-width`, `border-bottom`, `border-bottom-color`, `border-bottom-left-radius`, `border-bottom-right-radius`, `border-bottom-style`, `border-bottom-width`, `border-collapse`, `border-color`, `border-end-end-radius`, `border-end-start-radius`, `border-image`, `border-image-outset`, `border-image-repeat`, `border-image-slice`, `border-image-source`, `border-image-width`, `border-inline`, `border-inline-color`, `border-inline-end`, `border-inline-end-color`, `border-inline-end-style`, `border-inline-end-width`, `border-inline-start`, `border-inline-start-color`, `border-inline-start-style`, `border-inline-start-width`, `border-inline-style`, `border-inline-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-start-end-radius`, `border-start-start-radius`, `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`, `break-after`, `break-before`, `break-inside`, `caption-side`, `caret-color`, `clear`, `clip`, `clip-path`, `color`, `color-adjust`, `column-count`, `column-fill`, `column-gap`, `column-rule`, `column-rule-color`, `column-rule-style`, `column-rule-width`, `column-span`, `column-width`, `columns`, `content`, `content-visibility`, `counter-increment`, `counter-reset`, `counter-set`, `cursor`, `direction`, `display`, `empty-cells`, `filter`, `flex`, `flex-basis`, `flex-direction`, `flex-flow`, `flex-grow`, `flex-shrink`, `flex-wrap`, `float`, `font`, `font-family`, `font-feature-settings`, `font-kerning`, `font-language-override`, `font-optical-sizing`, `font-size`, `font-size-adjust`, `font-stretch`, `font-style`, `font-synthesis`, `font-variant`, `font-variant-caps`, `font-variant-east-asian`, `font-variant-emoji`, `font-variant-ligatures`, `font-variant-numeric`, `font-variant-position`, `font-weight`, `footnote-display`, `footnote-policy`, `forced-color-adjust`, `gap`, `grid`, `grid-area`, `grid-auto-columns`, `grid-auto-flow`, `grid-auto-rows`, `grid-column`, `grid-column-end`, `grid-column-start`, `grid-row`, `grid-row-end`, `grid-row-start`, `grid-template`, `grid-template-areas`, `grid-template-columns`, `grid-template-rows`, `hanging-punctuation`, `height`, `hyphens`, `image-orientation`, `image-rendering`, `image-resolution`, `initial-letter`, `initial-letter-align`, `initial-letter-wrap`, `inline-size`, `inline-sizing`, `inset`, `inset-block`, `inset-block-end`, `inset-block-start`, `inset-inline`, `inset-inline-end`, `inset-inline-start`, `isolation`, `justify-content`, `justify-items`, `justify-self`, `left`, `letter-spacing`, `lighting-color`, `line-break`, `line-clamp`, `line-grid`, `line-height`, `line-padding`, `line-snap`, `list-style`, `list-style-image`, `list-style-position`, `list-style-type`, `margin`, `margin-block`, `margin-block-end`, `margin-block-start`, `margin-bottom`, `margin-break`, `margin-inline`, `margin-inline-end`, `margin-inline-start`, `margin-left`, `margin-right`, `margin-top`, `margin-trim`, `mask`, `mask-border`, `mask-border-mode`, `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-block-size`, `max-height`, `max-lines`, `max-width`, `min-height`, `min-width`, `mix-blend-mode`, `nav-down`, `nav-left`, `nav-right`, `nav-up`, `object-fit`, `object-position`, `offset`, `offset-anchor`, `offset-distance`, `offset-path`, `offset-position`, `offset-rotate`, `opacity`, `order`, `orphans`, `outline`, `outline-color`, `outline-offset`, `outline-style`, `outline-width`, `overflow`, `overflow-anchor`, `overflow-block`, `overflow-clip-margin`, `overflow-inline`, `overflow-wrap`, `overflow-x`, `overflow-y`, `overscroll-behavior`, `overscroll-behavior-block`, `overscroll-behavior-inline`, `overscroll-behavior-x`, `overscroll-behavior-y`, `padding`, `padding-block`, `padding-block-end`, `padding-block-start`, `padding-bottom`, `padding-inline`, `padding-inline-end`, `padding-inline-start`, `padding-left`, `padding-right`, `padding-top`, `page`, `page-break-after`, `page-break-before`, `page-break-inside`, `page-orientation`, `perspective`, `perspective-origin`, `place-content`, `place-items`, `place-self`, `pointer-events`, `position`, `quotes`, `resize`, `right`, `rotate`, `row-gap`, `scale`, `scroll-behavior`, `scroll-margin`, `scroll-margin-block`, `scroll-margin-block-end`, `scroll-margin-block-start`, `scroll-margin-bottom`, `scroll-margin-inline`, `scroll-margin-inline-end`, `scroll-margin-inline-start`, `scroll-margin-left`, `scroll-margin-right`, `scroll-margin-top`, `scroll-padding`, `scroll-padding-block`, `scroll-padding-block-end`, `scroll-padding-block-start`, `scroll-padding-bottom`, `scroll-padding-inline`, `scroll-padding-inline-end`, `scroll-padding-inline-start`, `scroll-padding-left`, `scroll-padding-right`, `scroll-padding-top`, `scroll-snap-align`, `scroll-snap-stop`, `scroll-snap-type`, `scrollbar-color`, `scrollbar-gutter`, `scrollbar-width`, `shape-image-threshold`, `shape-inside`, `shape-margin`, `shape-outside`, `shape-padding`, `spatial-navigation-action`, `spatial-navigation-contain`, `spatial-navigation-function`, `string-set`, `tab-size`, `table-layout`, `text-align`, `text-align-all`, `text-align-last`, `text-combine-upright`, `text-decoration`, `text-decoration-color`, `text-decoration-line`, `text-decoration-skip`, `text-decoration-style`, `text-decoration-thickness`, `text-emphasis`, `text-emphasis-position`, `text-emphasis-style`, `text-group-align`, `text-indent`, `text-justify`, `text-orientation`, `text-overflow`, `text-rendering`, `text-shadow`, `text-size-adjust`, `text-space-trim`, `text-spacing`, `text-transform`, `text-underline-offset`, `text-underline-position`, `text-wrap`, `top`, `touch-action`, `transform`, `transform-box`, `transform-origin`, `transform-style`, `transition`, `transition-delay`, `transition-duration`, `transition-property`, `transition-timing-function`, `translate`, `unicode-bidi`, `user-select`, `vertical-align`, `visibility`, `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`} + + cssPropertyValues := []string{ + `stretch`, `flex-start`, `flex-end`, `center`, `space-between`, `space-around`, `normal`, `baseline`, `first`, `last`, `space-evenly`, `start`, `end`, `safe`, `unsafe`, `self-start`, `self-end`, `auto`, `initial`, `inherit`, `unset`, `revert`, `reverse`, `alternate-reverse`, `alternate`, `none`, `forwards`, `both`, `backwards`, `infinite`, `running`, `paused`, `ease`, `linear`, `step-start`, `step-end`, `ease-in`, `ease-out`, `ease-in-out`, `cubic-bezier`, `textfield`, `menulist-button`, `searchfield`, `textarea`, `push-button`, `slider-horizontal`, `checkbox`, `radio`, `square-button`, `menulist`, `listbox`, `meter`, `progress-bar`, `button`, `visible`, `hidden`, `scroll`, `fixed`, `local`, `multiply`, `screen`, `overlay`, `darken`, `lighten`, `color-dodge`, `color-burn`, `hard-light`, `soft-light`, `difference`, `exclusion`, `hue`, `saturation`, `color`, `luminosity`, `border-box`, `padding-box`, `content-box`, `text`, `transparent`, `currentColor`, `url`, `element`, `image`, `image-set`, `cross-fade`, `top`, `bottom`, `left`, `right`, `repeat`, `no-repeat`, `space`, `round`, `repeat-y`, `repeat-x`, `cover`, `contain`, `max-content`, `min-content`, `available`, `fit-content`, `dotted`, `dashed`, `solid`, `double`, `groove`, `ridge`, `inset`, `outset`, `medium`, `thin`, `thick`, `separate`, `collapse`, `slice`, `clone`, `avoid`, `always`, `all`, `avoid-page`, `page`, `recto`, `verso`, `avoid-column`, `column`, `avoid-region`, `region`, `inline-start`, `inline-end`, `rect`, `circle`, `ellipse`, `polygon`, `path`, `margin-box`, `fill-box`, `stroke-box`, `view-box`, `economy`, `exact`, `balance`, `balance-all`, `open-quote`, `close-quote`, `no-open-quote`, `no-close-quote`, `contents`, `attr`, `target-counter`, `target-text`, `leader`, `default`, `context-menu`, `help`, `pointer`, `progress`, `wait`, `cell`, `crosshair`, `vertical-text`, `alias`, `copy`, `move`, `no-drop`, `not-allowed`, `grab`, `grabbing`, `all-scroll`, `col-resize`, `row-resize`, `n-resize`, `s-resize`, `w-resize`, `ne-resize`, `nw-resize`, `se-resize`, `sw-resize`, `ew-resize`, `ns-resize`, `nesw-resize`, `nwse-resize`, `zoom-in`, `zoom-out`, `ltr`, `rtl`, `inline`, `block`, `inline-block`, `inline-table`, `run-in`, `flow`, `flow-root`, `table`, `flex`, `grid`, `ruby`, `list-item`, `table-row-group`, `table-header-group`, `table-footer-group`, `table-row`, `table-cell`, `table-column-group`, `table-column`, `table-caption`, `ruby-base`, `ruby-text`, `ruby-base-container`, `ruby-text-container`, `inline-flex`, `inline-grid`, `show`, `hide`, `url;`, `blur`, `brightness`, `contrast`, `drop-shadow`, `grayscale`, `hue-rotate`, `invert`, `opacity`, `saturate`, `sepia`, `content`, `row`, `row-reverse`, `column-reverse`, `nowrap`, `wrap`, `wrap-reverse`, `block-start`, `block-end`, `caption`, `icon`, `menu`, `message-box`, `small-caption`, `status-bar`, `serif`, `sans-serif`, `cursive`, `fantasy`, `monospace`, `system-ui`, `emoji`, `math`, `fangsong`, `ui-serif`, `ui-sans-serif`, `ui-monospace`, `ui-rounded`, `xx-small`, `x-small`, `small`, `large`, `x-large`, `xx-large`, `xxx-large`, `smaller`, `larger`, `semi-condensed`, `condensed`, `extra-condensed`, `ultra-condensed`, `semi-expanded`, `expanded`, `extra-expanded`, `ultra-expanded`, `italic`, `weight`, `style`, `small-caps`, `all-small-caps`, `petite-caps`, `all-petite-caps`, `unicase`, `titling-caps`, `jis78`, `jis83`, `jis90`, `jis04`, `simplified`, `traditional`, `full-width`, `proportional-width`, `unicode`, `common-ligatures`, `no-common-ligatures`, `discretionary-ligatures`, `no-discretionary-ligatures`, `historical-ligatures`, `no-historical-ligatures`, `contextual`, `no-contextual`, `ordinal`, `slashed-zero`, `lining-nums`, `oldstyle-nums`, `proportional-nums`, `tabular-nums`, `diagonal-fractions`, `stacked-fractions`, `sub`, `super`, `bold`, `lighter`, `bolder`, `line`, `auto‑flow`, `minmax`, `auto;`, `dense`, `subgrid`, `masonry`, `force-end`, `allow-end`, `manual`, `from-image`, `smooth`, `high-quality`, `crisp-edges`, `pixelated`, `snap`, `alphabetic`, `ideographic`, `hebrew`, `hanging`, `isolate`, `legacy`, `white`, `strict`, `loose`, `anywhere`, `match-parent`, `create`, `outside`, `inside`, `disc`, `square`, `decimal`, `symbols`, `cjk-decimal`, `decimal-leading-zero`, `lower-roman`, `upper-roman`, `lower-greek`, `lower-alpha`, `lower-latin`, `upper-alpha`, `upper-latin`, `arabic-indic`, `armenian`, `bengali`, `cambodian`, `cjk-earthly-branch`, `cjk-heavenly-stem`, `cjk-ideographic`, `devanagari`, `ethiopic-numeric`, `georgian`, `gujarati`, `gurmukhi`, `hiragana`, `hiragana-iroha`, `japanese-formal`, `japanese-informal`, `kannada`, `katakana`, `katakana-iroha`, `khmer`, `korean-hangul-formal`, `korean-hanja-formal`, `korean-hanja-informal`, `lao`, `lower-armenian`, `malayalam`, `mongolian`, `myanmar`, `oriya`, `persian`, `simp-chinese-formal`, `simp-chinese-informal`, `tamil`, `telugu`, `thai`, `tibetan`, `trad-chinese-formal`, `trad-chinese-informal`, `upper-armenian`, `disclosure-open`, `disclosure-closed`, `keep`, `discard`, `in-flow`, `alpha`, `luminance`, `no-clip`, `add`, `subtract`, `intersect`, `exclude`, `match-source`, `current`, `fill`, `scale-down`, `ray`, `clip`, `break-word`, `upright`, `rotate-left`, `rotate-right`, `static`, `relative`, `absolute`, `sticky`, `horizontal`, `vertical`, `x`, `y`, `z`, `mandatory`, `proximity`, `dark`, `light`, `stable`, `force`, `outside-shape`, `display`, `focus`, `justify`, `justify-all`, `underline`, `overline`, `line-through`, `blink`, `spelling-error`, `grammar-error`, `wavy`, `from-font`, `over`, `under`, `filled`, `open`, `dot`, `double-circle`, `triangle`, `sesame`, `inter-word`, `inter-character`, `mixed`, `sideways`, `ellipsis`, `optimizeSpeed`, `optimizeLegibility`, `geometricPrecision`, `trim-inner`, `discard-before`, `discard-after`, `trim-start`, `space-start`, `space-first`, `trim-end`, `space-end`, `trim-adjacent`, `space-adjacent`, `no-compress`, `ideograph-alpha`, `ideograph-numeric`, `punctuation`, `capitalize`, `uppercase`, `lowercase`, `full-size-kana`, `pretty`, `pan-x`, `pan-left`, `pan-right`, `pan-y`, `pan-up`, `pan-down`, `manipulation`, `matrix`, `matrix3d`, `translate`, `translateX`, `translateY`, `translate3d`, `translateZ`, `scale`, `scaleX`, `scaleY`, `scaleZ`, `rotate`, `rotate3d`, `rotateX`, `rotateY`, `rotateZ`, `perspective`, `skew`, `skewX`, `skewY`, `flat`, `preserve-3d`, `border-bottom`, `embed`, `bidi-override`, `isolate-override`, `plaintext`, `middle`, `text-top`, `text-bottom`, `pre`, `pre-wrap`, `pre-line`, `scroll-position`, `transform`, `width`, `keep-all`, `break-all`, `avoid-line`, `avoid-flex`, `minimum`, `maximum`, `clear`, `horizontal-tb`, `vertical-rl`, `vertical-lr`, `sideways-rl`, `sideways-lr`, + } + + cssColorNames := []string{`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`, `DarkGrey`, `DarkGreen`, `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`, `Grey`, `Green`, `GreenYellow`, `HoneyDew`, `HotPink`, `IndianRed`, `Indigo`, `Ivory`, `Khaki`, `Lavender`, `LavenderBlush`, `LawnGreen`, `LemonChiffon`, `LightBlue`, `LightCoral`, `LightCyan`, `LightGoldenRodYellow`, `LightGray`, `LightGrey`, `LightGreen`, `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`} + + const cssPropertyPattern = `(?|+=@:,./?-]+`, Operator, nil}, {`[\[\]()]+`, Punctuation, nil}, @@ -76,15 +100,16 @@ var Scss = internal.Register(MustNewLexer( {`[ \t]+`, Text, nil}, {`\:`, NameDecorator, Push("pseudo-class")}, {`\.`, NameClass, Push("class")}, - {`\#`, NameNamespace, Push("id")}, - {`[\w-]+`, NameTag, nil}, {`#\{`, LiteralStringInterpol, Push("interpolation")}, + {`\#`, NameNamespace, Push("id")}, {`&`, Keyword, nil}, {`[~^*!&\[\]()<>|+=@:,./?-]`, Operator, nil}, + {`(%)([\w-]+)`, ByGroups(Operator, NameClass), nil}, {`"`, LiteralStringDouble, Push("string-double")}, {`'`, LiteralStringSingle, Push("string-single")}, {`\n`, Text, nil}, {`[;{}]`, Punctuation, Pop(1)}, + {`[\w-]+`, NameTag, nil}, }, "string-double": { {`(\\.|#(?=[^\n{])|[^\n"#])+`, LiteralStringDouble, nil}, @@ -120,5 +145,9 @@ var Scss = internal.Register(MustNewLexer( {`(from|to|through)`, OperatorWord, nil}, Include("value"), }, - }, -)) + "each": { + {`in`, OperatorWord, nil}, + Include("value"), + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/smalltalk.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/smalltalk.go index db64707f..b4143d02 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/smalltalk.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/smalltalk.go @@ -6,14 +6,18 @@ import ( ) // Smalltalk lexer. -var Smalltalk = internal.Register(MustNewLexer( +var Smalltalk = internal.Register(MustNewLazyLexer( &Config{ Name: "Smalltalk", Aliases: []string{"smalltalk", "squeak", "st"}, Filenames: []string{"*.st"}, MimeTypes: []string{"text/x-smalltalk"}, }, - Rules{ + smalltalkRules, +)) + +func smalltalkRules() Rules { + return Rules{ "root": { {`(<)(\w+:)(.*?)(>)`, ByGroups(Text, Keyword, Text, Text), nil}, Include("squeak fileout"), @@ -95,5 +99,5 @@ var Smalltalk = internal.Register(MustNewLexer( {`(!\n)(\].*)(! !)$`, ByGroups(Keyword, Text, Keyword), nil}, {`! !$`, Keyword, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/smarty.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/smarty.go index c364ffa5..566efbbe 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/smarty.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/smarty.go @@ -7,7 +7,7 @@ import ( ) // Smarty lexer. -var Smarty = internal.Register(MustNewLexer( +var Smarty = internal.Register(MustNewLazyLexer( &Config{ Name: "Smarty", Aliases: []string{"smarty"}, @@ -15,7 +15,11 @@ var Smarty = internal.Register(MustNewLexer( MimeTypes: []string{"application/x-smarty"}, DotAll: true, }, - Rules{ + smartyRules, +)) + +func smartyRules() Rules { + return Rules{ "root": { {`[^{]+`, Other, nil}, {`(\{)(\*.*?\*)(\})`, ByGroups(CommentPreproc, Comment, CommentPreproc), nil}, @@ -36,5 +40,5 @@ var Smarty = internal.Register(MustNewLexer( {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, {`[a-zA-Z_]\w*`, NameAttribute, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/sml.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/sml.go index f716d92b..c795ea86 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/sml.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/sml.go @@ -6,14 +6,18 @@ import ( ) // Standard ML lexer. -var StandardML = internal.Register(MustNewLexer( +var StandardML = internal.Register(MustNewLazyLexer( &Config{ Name: "Standard ML", Aliases: []string{"sml"}, Filenames: []string{"*.sml", "*.sig", "*.fun"}, MimeTypes: []string{"text/x-standardml", "application/x-standardml"}, }, - Rules{ + standardMLRules, +)) + +func standardMLRules() Rules { + return Rules{ "whitespace": { {`\s+`, Text, nil}, {`\(\*`, CommentMultiline, Push("comment")}, @@ -196,5 +200,5 @@ var StandardML = internal.Register(MustNewLexer( {`\*\)`, CommentMultiline, Pop(1)}, {`[(*)]`, CommentMultiline, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/snobol.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/snobol.go index c999b50f..45290346 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/snobol.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/snobol.go @@ -6,14 +6,18 @@ import ( ) // Snobol lexer. -var Snobol = internal.Register(MustNewLexer( +var Snobol = internal.Register(MustNewLazyLexer( &Config{ Name: "Snobol", Aliases: []string{"snobol"}, Filenames: []string{"*.snobol"}, MimeTypes: []string{"text/x-snobol"}, }, - Rules{ + snobolRules, +)) + +func snobolRules() Rules { + return Rules{ "root": { {`\*.*\n`, Comment, nil}, {`[+.] `, Punctuation, Push("statement")}, @@ -44,5 +48,5 @@ var Snobol = internal.Register(MustNewLexer( "heredoc": { {`.*\n`, LiteralStringHeredoc, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/solidity.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/solidity.go index d7cf0f97..62a3a40a 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/solidity.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/solidity.go @@ -6,7 +6,7 @@ import ( ) // Solidity lexer. -var Solidity = internal.Register(MustNewLexer( +var Solidity = internal.Register(MustNewLazyLexer( &Config{ Name: "Solidity", Aliases: []string{"sol", "solidity"}, @@ -14,7 +14,11 @@ var Solidity = internal.Register(MustNewLexer( MimeTypes: []string{}, DotAll: true, }, - Rules{ + solidityRules, +)) + +func solidityRules() Rules { + return Rules{ "assembly": { Include("comments"), Include("numbers"), @@ -35,17 +39,16 @@ var Solidity = internal.Register(MustNewLexer( {`/[*][\w\W]*`, CommentMultiline, nil}, }, "keywords-other": { - {Words(``, `\b`, `for`, `in`, `while`, `do`, `break`, `return`, `returns`, `continue`, `if`, `else`, `throw`, `new`, `delete`), Keyword, nil}, + {Words(``, `\b`, `for`, `in`, `while`, `do`, `break`, `return`, `returns`, `continue`, `if`, `else`, `try`, `catch`, `throw`, `_`, `new`, `delete`, `is`, `as`, `from`, `memory`, `storage`), Keyword, nil}, {`assembly\b`, Keyword, Push("assembly")}, - {Words(``, `\b`, `contract`, `interface`, `enum`, `event`, `function`, `library`, `mapping`, `modifier`, `struct`, `var`), KeywordDeclaration, nil}, + {`(contract|interface|enum|event|struct)(\s+)([a-zA-Z_]\w*)`, ByGroups(KeywordDeclaration, Text, NameClass), nil}, + {`(function|modifier)(\s+)([a-zA-Z_]\w*)`, ByGroups(KeywordDeclaration, Text, NameFunction), nil}, + {Words(``, `\b`, `contract`, `interface`, `enum`, `event`, `constructor`, `function`, `library`, `mapping`, `modifier`, `struct`, `var`), KeywordDeclaration, nil}, + {Words(``, `\b`, `abstract`, `external`, `internal`, `private`, `public`), Keyword, nil}, + {Words(``, `\b`, `anonymous`, `constant`, `immutable`, `indexed`, `override`, `payable`, `pure`, `view`, `virtual`), Keyword, 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}, + {`pragma (solidity|experimental)\b`, Keyword, nil}, + {Words(``, `\b`, `after`, `alias`, `apply`, `auto`, `case`, `copyof`, `default`, `define`, `final`, `implements`, `inline`, `let`, `macro`, `match`, `mutable`, `null`, `of`, `partial`, `promise`, `reference`, `relocatable`, `sealed`, `sizeof`, `static`, `supports`, `switch`, `typedef`, `typeof`, `unchecked`), KeywordReserved, nil}, {`(true|false)\b`, KeywordConstant, nil}, {`(wei|finney|szabo|ether)\b`, KeywordConstant, nil}, {`(seconds|minutes|hours|days|weeks|years)\b`, KeywordConstant, nil}, @@ -95,16 +98,21 @@ var Solidity = internal.Register(MustNewLexer( {`\+\+|--|\*\*|\?|:|~|&&|\|\||=>|==?|!=?|(<<|>>>?|[-<>+*%&|^/])=?`, 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}, + {`(abi|block|msg|tx)\b`, NameBuiltin, nil}, + {`(?!abi\.)(decode|encode|encodePacked|encodeWithSelector|encodeWithSignature|encodeWithSelector)\b`, NameBuiltin, nil}, + {`(?!block\.)(chainid|coinbase|difficulty|gaslimit|number|timestamp)\b`, NameBuiltin, nil}, + {`(?!msg\.)(data|gas|sender|value)\b`, NameBuiltin, nil}, + {`(?!tx\.)(gasprice|origin)\b`, NameBuiltin, nil}, + {`(type)(\()([a-zA-Z_]\w*)(\))`, ByGroups(NameBuiltin, Punctuation, NameClass, Punctuation), nil}, + {`(?!type\([a-zA-Z_]\w*\)\.)(creationCode|interfaceId|max|min|name|runtimeCode)\b`, NameBuiltin, nil}, + {`(now|this|super|gasleft)\b`, NameBuiltin, nil}, {`(selfdestruct|suicide)\b`, NameBuiltin, nil}, - {`(balance|send|transfer)\b`, NameBuiltin, nil}, + {`(?!0x[0-9a-fA-F]+\.)(balance|code|codehash|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}, + {`(addmod|blockhash|ecrecover|keccak256|mulmod|ripemd160|sha256|sha3)\b`, NameBuiltin, nil}, {`[a-zA-Z_]\w*`, Name, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/sparql.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/sparql.go index 47a1716b..eef73d9d 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/sparql.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/sparql.go @@ -6,14 +6,18 @@ import ( ) // Sparql lexer. -var Sparql = internal.Register(MustNewLexer( +var Sparql = internal.Register(MustNewLazyLexer( &Config{ Name: "SPARQL", Aliases: []string{"sparql"}, Filenames: []string{"*.rq", "*.sparql"}, MimeTypes: []string{"application/sparql-query"}, }, - Rules{ + sparqlRules, +)) + +func sparqlRules() Rules { + return 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}, @@ -65,5 +69,5 @@ var Sparql = internal.Register(MustNewLexer( {`\^\^`, Operator, Pop(2)}, Default(Pop(2)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/sql.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/sql.go index 6f4e3e07..fb8c8edf 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/sql.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/sql.go @@ -6,7 +6,7 @@ import ( ) // SQL lexer. -var SQL = internal.Register(MustNewLexer( +var SQL = internal.Register(MustNewLazyLexer( &Config{ Name: "SQL", Aliases: []string{"sql"}, @@ -15,9 +15,13 @@ var SQL = internal.Register(MustNewLexer( NotMultiline: true, CaseInsensitive: true, }, - Rules{ + sqlRules, +)) + +func sqlRules() Rules { + return Rules{ "root": { - {`\s+`, Text, nil}, + {`\s+`, TextWhitespace, nil}, {`--.*\n?`, CommentSingle, nil}, {`/\*`, CommentMultiline, Push("multiline-comments")}, {`'`, LiteralStringSingle, Push("string")}, @@ -45,5 +49,5 @@ var SQL = internal.Register(MustNewLexer( {`""`, LiteralStringDouble, nil}, {`"`, LiteralStringDouble, Pop(1)}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/squid.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/squid.go index 1f161901..b4da3da1 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/squid.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/squid.go @@ -6,7 +6,7 @@ import ( ) // Squidconf lexer. -var Squidconf = internal.Register(MustNewLexer( +var Squidconf = internal.Register(MustNewLazyLexer( &Config{ Name: "SquidConf", Aliases: []string{"squidconf", "squid.conf", "squid"}, @@ -15,7 +15,11 @@ var Squidconf = internal.Register(MustNewLexer( NotMultiline: true, CaseInsensitive: true, }, - Rules{ + squidconfRules, +)) + +func squidconfRules() Rules { + return Rules{ "root": { {`\s+`, TextWhitespace, nil}, {`#`, Comment, Push("comment")}, @@ -34,5 +38,5 @@ var Squidconf = internal.Register(MustNewLexer( {`.+`, Comment, Pop(1)}, Default(Pop(1)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/stylus.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/stylus.go new file mode 100644 index 00000000..159077f4 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/stylus.go @@ -0,0 +1,66 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Stylus lexer. +var Stylus = internal.Register(MustNewLazyLexer( + &Config{ + Name: "Stylus", + Aliases: []string{"stylus"}, + Filenames: []string{"*.styl"}, + MimeTypes: []string{"text/x-styl"}, + CaseInsensitive: true, + }, + stylusRules, +)) + +func stylusRules() Rules { + return Rules{ + // "root": { + // }, + "root": { + {`([ \t]*\n|\s+)`, Text, nil}, + {`[!$][\w-]+`, NameVariable, nil}, + {`@[\w-]+`, KeywordPseudo, Push("atrule")}, + {`(\.)([\w-]+)`, ByGroups(Punctuation, NameClass), nil}, + {`for|if|else if|else|unless|return|\&`, Keyword, nil}, + {`([\w-]+)(\()`, ByGroups(NameDecorator, Punctuation), Push("function-start")}, + {`(\+)([\w-]+)(\(\))`, ByGroups(Keyword, NameDecorator, Punctuation), nil}, + {Words(``, ``, `-ms-`, `mso-`, `-moz-`, `-o-`, `-xv-`, `-atsc-`, `-wap-`, `-khtml-`, `-webkit-`, `prince-`, `-ah-`, `-hp-`, `-ro-`, `-rim-`, `-tc-`), NameProperty, nil}, + {`\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)\b(\:)?`, ByGroups(NameProperty, Punctuation), Push("values")}, + {`\b(a|abbr|acronym|address|applet|area|article|aside|audio|b|base(?:front)?|bd(?:i|o)|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|data|datalist|d(?:d|l|t)|del|details|dfn|dialog|dir|div|em(?:bed)?|fieldset|fig(?:caption|ure)|font|footer|form|frame(?:set)?|h[1-6]+|head(?:er)?|hr|html|i|iframe|img|input|ins|kbd|label|legend|li|link|main|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|picture|pre|progress|q|r(?:p|t|uby)|s|samp|script|section|select|small|source|span|strike|strong|style|sub|summary|sup|svg|table|tbody|td|template|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video|wbr)\b`, NameTag, nil}, + {Words(`\b`, `\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`, `\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}, + {`(\{|\}|\(|\)|\[|\]|,|:|;)`, Punctuation, nil}, + {`(\.|\!|\-|\+|\~|\*\*|\*|\/|\%|\.\.\.|\.\.|\<\=|\>\=|\<|\>|\=\=|\!\=|\&\&|\|\||\=|\:\=|\?\=|\+\=|\-\=|\*\=|\/\=|\%\=|\?|\:)`, Operator, nil}, + {`\b(and|if unless|in|is|is a|is defined|is not|isnt|or|not)\b`, OperatorWord, nil}, + {`(\#[a-f0-9]{3,6})`, LiteralNumberHex, nil}, + {`\n`, Text, nil}, + }, + "inline-comment": { + {`\*/`, Comment, Pop(1)}, + }, + "atrule": { + {`\{`, Punctuation, Push("atcontent")}, + {`$`, Punctuation, Pop(1)}, + Include("root"), + }, + "atcontent": { + Include("root"), + {`\}`, Punctuation, Pop(2)}, + }, + "function-start": { + {`\)`, Punctuation, Pop(1)}, + Include("root"), + }, + "values": { + {`\s+`, Text, nil}, + {`(\#[a-f0-9]{3,6})`, LiteralNumberHex, nil}, + {Words(`\b`, `\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}, + {`\;?`, Punctuation, Pop(1)}, + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/svelte.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/svelte.go new file mode 100644 index 00000000..1f91a213 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/svelte.go @@ -0,0 +1,73 @@ +package s + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/h" + "github.com/alecthomas/chroma/lexers/internal" + "github.com/alecthomas/chroma/lexers/t" +) + +// Svelte lexer. +var Svelte = internal.Register(DelegatingLexer(h.HTML, MustNewLazyLexer( + &Config{ + Name: "Svelte", + Aliases: []string{"svelte"}, + Filenames: []string{"*.svelte"}, + MimeTypes: []string{"application/x-svelte"}, + DotAll: true, + }, + svelteRules, +))) + +func svelteRules() Rules { + return Rules{ + "root": { + // Let HTML handle the comments, including comments containing script and style tags + {``, Other, Pop(1)}, + {`.+?`, Other, nil}, + }, + "templates": { + {`}`, Punctuation, Pop(1)}, + // Let TypeScript handle strings and the curly braces inside them + {`(?\"{}|^`\\\\\\x00-\\x20]*>)(\\s*)(\\.?)", ByGroups(Keyword, TextWhitespace, NameVariable, TextWhitespace, Punctuation), nil}, @@ -63,5 +67,5 @@ var Turtle = internal.Register(MustNewLexer( {`(\^\^)((?:[a-z][\w-]*)?\:)([a-z][\w-]*)`, ByGroups(Operator, GenericEmph, GenericEmph), Pop(2)}, Default(Pop(2)), }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/t/twig.go b/backend/vendor/github.com/alecthomas/chroma/lexers/t/twig.go index 56aa9b9a..0e0c1f18 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/t/twig.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/t/twig.go @@ -6,7 +6,7 @@ import ( ) // Twig lexer. -var Twig = internal.Register(MustNewLexer( +var Twig = internal.Register(MustNewLazyLexer( &Config{ Name: "Twig", Aliases: []string{"twig"}, @@ -14,7 +14,11 @@ var Twig = internal.Register(MustNewLexer( MimeTypes: []string{"application/x-twig"}, DotAll: true, }, - Rules{ + twigRules, +)) + +func twigRules() Rules { + return Rules{ "root": { {`[^{]+`, Other, nil}, {`\{\{`, CommentPreproc, Push("var")}, @@ -50,5 +54,5 @@ var Twig = internal.Register(MustNewLexer( Include("varnames"), {`.`, Punctuation, nil}, }, - }, -)) + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/t/typescript.go b/backend/vendor/github.com/alecthomas/chroma/lexers/t/typescript.go index 57d08bf1..0625bb09 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/t/typescript.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/t/typescript.go @@ -6,16 +6,20 @@ import ( ) // TypeScript lexer. -var TypeScript = internal.Register(MustNewLexer( +var TypeScript = internal.Register(MustNewLazyLexer( &Config{ Name: "TypeScript", - Aliases: []string{"ts", "typescript"}, + Aliases: []string{"ts", "tsx", "typescript"}, Filenames: []string{"*.ts", "*.tsx"}, MimeTypes: []string{"text/x-typescript"}, DotAll: true, EnsureNL: true, }, - Rules{ + typeScriptRules, +)) + +func typeScriptRules() Rules { + return Rules{ "commentsandwhitespace": { {`\s+`, Text, nil}, {` which includes the use of that to permit +// conditionals as per https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/compatibility/ms537512(v=vs.85)?redirectedfrom=MSDN +// +// What is not permitted are CDATA XML comments, as the x/net/html package we depend +// on does not handle this fully and we are not choosing to take on that work: +// https://pkg.go.dev/golang.org/x/net/html#Tokenizer.AllowCDATA . If the x/net/html +// package changes this then these will be considered, otherwise if you AllowComments +// but provide a CDATA comment, then as per the documentation in x/net/html this will +// be treated as a plain HTML comment. +func (p *Policy) AllowComments() { + p.allowComments = true +} + // AllowNoAttrs says that attributes on element are optional. // // The attribute policy is only added to the core policy when OnElements(...) @@ -265,8 +286,7 @@ func (abp *attrPolicyBuilder) AllowNoAttrs() *attrPolicyBuilder { } // Matching allows a regular expression to be applied to a nascent attribute -// policy, and returns the attribute policy. Calling this more than once will -// replace the existing regexp. +// policy, and returns the attribute policy. func (abp *attrPolicyBuilder) Matching(regex *regexp.Regexp) *attrPolicyBuilder { abp.regexp = regex @@ -284,7 +304,7 @@ func (abp *attrPolicyBuilder) OnElements(elements ...string) *Policy { for _, attr := range abp.attrNames { if _, ok := abp.p.elsAndAttrs[element]; !ok { - abp.p.elsAndAttrs[element] = make(map[string]attrPolicy) + abp.p.elsAndAttrs[element] = make(map[string][]attrPolicy) } ap := attrPolicy{} @@ -292,14 +312,14 @@ func (abp *attrPolicyBuilder) OnElements(elements ...string) *Policy { ap.regexp = abp.regexp } - abp.p.elsAndAttrs[element][attr] = ap + abp.p.elsAndAttrs[element][attr] = append(abp.p.elsAndAttrs[element][attr], ap) } if abp.allowEmpty { abp.p.setOfElementsAllowedWithoutAttrs[element] = struct{}{} if _, ok := abp.p.elsAndAttrs[element]; !ok { - abp.p.elsAndAttrs[element] = make(map[string]attrPolicy) + abp.p.elsAndAttrs[element] = make(map[string][]attrPolicy) } } } @@ -312,19 +332,19 @@ func (abp *attrPolicyBuilder) OnElements(elements ...string) *Policy { func (abp *attrPolicyBuilder) OnElementsMatching(regex *regexp.Regexp) *Policy { for _, attr := range abp.attrNames { if _, ok := abp.p.elsMatchingAndAttrs[regex]; !ok { - abp.p.elsMatchingAndAttrs[regex] = make(map[string]attrPolicy) + abp.p.elsMatchingAndAttrs[regex] = make(map[string][]attrPolicy) } ap := attrPolicy{} if abp.regexp != nil { ap.regexp = abp.regexp } - abp.p.elsMatchingAndAttrs[regex][attr] = ap + abp.p.elsMatchingAndAttrs[regex][attr] = append(abp.p.elsMatchingAndAttrs[regex][attr], ap) } if abp.allowEmpty { abp.p.setOfElementsMatchingAllowedWithoutAttrs = append(abp.p.setOfElementsMatchingAllowedWithoutAttrs, regex) if _, ok := abp.p.elsMatchingAndAttrs[regex]; !ok { - abp.p.elsMatchingAndAttrs[regex] = make(map[string]attrPolicy) + abp.p.elsMatchingAndAttrs[regex] = make(map[string][]attrPolicy) } } @@ -337,7 +357,7 @@ func (abp *attrPolicyBuilder) Globally() *Policy { for _, attr := range abp.attrNames { if _, ok := abp.p.globalAttrs[attr]; !ok { - abp.p.globalAttrs[attr] = attrPolicy{} + abp.p.globalAttrs[attr] = []attrPolicy{} } ap := attrPolicy{} @@ -345,7 +365,7 @@ func (abp *attrPolicyBuilder) Globally() *Policy { ap.regexp = abp.regexp } - abp.p.globalAttrs[attr] = ap + abp.p.globalAttrs[attr] = append(abp.p.globalAttrs[attr], ap) } return abp.p @@ -353,7 +373,7 @@ func (abp *attrPolicyBuilder) Globally() *Policy { // AllowStyles takes a range of CSS property names and returns a // style policy builder that allows you to specify the pattern and scope of -// the whitelisted property. +// the allowed property. // // The style policy is only added to the core policy when either Globally() // or OnElements(...) are called. @@ -373,8 +393,7 @@ func (p *Policy) AllowStyles(propertyNames ...string) *stylePolicyBuilder { } // Matching allows a regular expression to be applied to a nascent style -// policy, and returns the style policy. Calling this more than once will -// replace the existing regexp. +// policy, and returns the style policy. func (spb *stylePolicyBuilder) Matching(regex *regexp.Regexp) *stylePolicyBuilder { spb.regexp = regex @@ -383,8 +402,7 @@ func (spb *stylePolicyBuilder) Matching(regex *regexp.Regexp) *stylePolicyBuilde } // MatchingEnum allows a list of allowed values to be applied to a nascent style -// policy, and returns the style policy. Calling this more than once will -// replace the existing list of allowed values. +// policy, and returns the style policy. func (spb *stylePolicyBuilder) MatchingEnum(enum ...string) *stylePolicyBuilder { spb.enum = enum @@ -393,8 +411,7 @@ func (spb *stylePolicyBuilder) MatchingEnum(enum ...string) *stylePolicyBuilder } // MatchingHandler allows a handler to be applied to a nascent style -// policy, and returns the style policy. Calling this more than once will -// replace the existing handler. +// policy, and returns the style policy. func (spb *stylePolicyBuilder) MatchingHandler(handler func(string) bool) *stylePolicyBuilder { spb.handler = handler @@ -412,7 +429,7 @@ func (spb *stylePolicyBuilder) OnElements(elements ...string) *Policy { for _, attr := range spb.propertyNames { if _, ok := spb.p.elsAndStyles[element]; !ok { - spb.p.elsAndStyles[element] = make(map[string]stylePolicy) + spb.p.elsAndStyles[element] = make(map[string][]stylePolicy) } sp := stylePolicy{} @@ -423,9 +440,9 @@ func (spb *stylePolicyBuilder) OnElements(elements ...string) *Policy { } else if spb.regexp != nil { sp.regexp = spb.regexp } else { - sp.handler = getDefaultHandler(attr) + sp.handler = css.GetDefaultHandler(attr) } - spb.p.elsAndStyles[element][attr] = sp + spb.p.elsAndStyles[element][attr] = append(spb.p.elsAndStyles[element][attr], sp) } } @@ -439,7 +456,7 @@ func (spb *stylePolicyBuilder) OnElementsMatching(regex *regexp.Regexp) *Policy for _, attr := range spb.propertyNames { if _, ok := spb.p.elsMatchingAndStyles[regex]; !ok { - spb.p.elsMatchingAndStyles[regex] = make(map[string]stylePolicy) + spb.p.elsMatchingAndStyles[regex] = make(map[string][]stylePolicy) } sp := stylePolicy{} @@ -450,9 +467,9 @@ func (spb *stylePolicyBuilder) OnElementsMatching(regex *regexp.Regexp) *Policy } else if spb.regexp != nil { sp.regexp = spb.regexp } else { - sp.handler = getDefaultHandler(attr) + sp.handler = css.GetDefaultHandler(attr) } - spb.p.elsMatchingAndStyles[regex][attr] = sp + spb.p.elsMatchingAndStyles[regex][attr] = append(spb.p.elsMatchingAndStyles[regex][attr], sp) } return spb.p @@ -464,7 +481,7 @@ func (spb *stylePolicyBuilder) Globally() *Policy { for _, attr := range spb.propertyNames { if _, ok := spb.p.globalStyles[attr]; !ok { - spb.p.globalStyles[attr] = stylePolicy{} + spb.p.globalStyles[attr] = []stylePolicy{} } // Use only one strategy for validating styles, fallback to default @@ -476,15 +493,15 @@ func (spb *stylePolicyBuilder) Globally() *Policy { } else if spb.regexp != nil { sp.regexp = spb.regexp } else { - sp.handler = getDefaultHandler(attr) + sp.handler = css.GetDefaultHandler(attr) } - spb.p.globalStyles[attr] = sp + spb.p.globalStyles[attr] = append(spb.p.globalStyles[attr], sp) } return spb.p } -// AllowElements will append HTML elements to the whitelist without applying an +// AllowElements will append HTML elements to the allowlist without applying an // attribute policy to those elements (the elements are permitted // sans-attributes) func (p *Policy) AllowElements(names ...string) *Policy { @@ -494,17 +511,19 @@ func (p *Policy) AllowElements(names ...string) *Policy { element = strings.ToLower(element) if _, ok := p.elsAndAttrs[element]; !ok { - p.elsAndAttrs[element] = make(map[string]attrPolicy) + p.elsAndAttrs[element] = make(map[string][]attrPolicy) } } return p } +// AllowElementsMatching will append HTML elements to the allowlist if they +// match a regexp. func (p *Policy) AllowElementsMatching(regex *regexp.Regexp) *Policy { p.init() if _, ok := p.elsMatchingAndAttrs[regex]; !ok { - p.elsMatchingAndAttrs[regex] = make(map[string]attrPolicy) + p.elsMatchingAndAttrs[regex] = make(map[string][]attrPolicy) } return p } @@ -611,7 +630,7 @@ func (p *Policy) AllowRelativeURLs(require bool) *Policy { return p } -// AllowURLSchemes will append URL schemes to the whitelist +// AllowURLSchemes will append URL schemes to the allowlist // Example: p.AllowURLSchemes("mailto", "http", "https") func (p *Policy) AllowURLSchemes(schemes ...string) *Policy { p.init() @@ -629,7 +648,7 @@ func (p *Policy) AllowURLSchemes(schemes ...string) *Policy { } // AllowURLSchemeWithCustomPolicy will append URL schemes with -// a custom URL policy to the whitelist. +// a custom URL policy to the allowlist. // Only the URLs with matching schema and urlPolicy(url) // returning true will be allowed. func (p *Policy) AllowURLSchemeWithCustomPolicy( @@ -643,13 +662,13 @@ func (p *Policy) AllowURLSchemeWithCustomPolicy( scheme = strings.ToLower(scheme) - p.allowURLSchemes[scheme] = urlPolicy + p.allowURLSchemes[scheme] = append(p.allowURLSchemes[scheme], urlPolicy) return p } // AddSpaceWhenStrippingTag states whether to add a single space " " when -// removing tags that are not whitelisted by the policy. +// removing tags that are not allowed by the policy. // // This is useful if you expect to strip tags in dense markup and may lose the // value of whitespace. diff --git a/backend/vendor/github.com/microcosm-cc/bluemonday/sanitize.go b/backend/vendor/github.com/microcosm-cc/bluemonday/sanitize.go index b462f099..5f4b60d7 100644 --- a/backend/vendor/github.com/microcosm-cc/bluemonday/sanitize.go +++ b/backend/vendor/github.com/microcosm-cc/bluemonday/sanitize.go @@ -31,6 +31,7 @@ package bluemonday import ( "bytes" + "fmt" "io" "net/url" "regexp" @@ -47,10 +48,11 @@ var ( dataAttributeXMLPrefix = regexp.MustCompile("^xml.+") dataAttributeInvalidChars = regexp.MustCompile("[A-Z;]+") cssUnicodeChar = regexp.MustCompile(`\\[0-9a-f]{1,6} ?`) + dataURIbase64Prefix = regexp.MustCompile(`^data:[^,]*;base64,`) ) // Sanitize takes a string that contains a HTML fragment or document and applies -// the given policy whitelist. +// the given policy allowlist. // // It returns a HTML string that has been sanitized by the policy or an empty // string if an error has occurred (most likely as a consequence of extremely @@ -60,11 +62,11 @@ func (p *Policy) Sanitize(s string) string { return s } - return p.sanitize(strings.NewReader(s)).String() + return p.sanitizeWithBuff(strings.NewReader(s)).String() } // SanitizeBytes takes a []byte that contains a HTML fragment or document and applies -// the given policy whitelist. +// the given policy allowlist. // // It returns a []byte containing the HTML that has been sanitized by the policy // or an empty []byte if an error has occurred (most likely as a consequence of @@ -74,26 +76,32 @@ func (p *Policy) SanitizeBytes(b []byte) []byte { return b } - return p.sanitize(bytes.NewReader(b)).Bytes() + return p.sanitizeWithBuff(bytes.NewReader(b)).Bytes() } // SanitizeReader takes an io.Reader that contains a HTML fragment or document -// and applies the given policy whitelist. +// and applies the given policy allowlist. // // It returns a bytes.Buffer containing the HTML that has been sanitized by the // policy. Errors during sanitization will merely return an empty result. func (p *Policy) SanitizeReader(r io.Reader) *bytes.Buffer { - return p.sanitize(r) + return p.sanitizeWithBuff(r) +} + +// SanitizeReaderToWriter takes an io.Reader that contains a HTML fragment or document +// and applies the given policy allowlist and writes to the provided writer returning +// an error if there is one. +func (p *Policy) SanitizeReaderToWriter(r io.Reader, w io.Writer) error { + return p.sanitize(r, w) } const escapedURLChars = "'<>\"\r" -func escapeUrlComponent(val string) string { - w := bytes.NewBufferString("") +func escapeUrlComponent(w stringWriterWriter, val string) error { i := strings.IndexAny(val, escapedURLChars) for i != -1 { if _, err := w.WriteString(val[:i]); err != nil { - return w.String() + return err } var esc string switch val[i] { @@ -114,15 +122,15 @@ func escapeUrlComponent(val string) string { } val = val[i+1:] if _, err := w.WriteString(esc); err != nil { - return w.String() + return err } i = strings.IndexAny(val, escapedURLChars) } - w.WriteString(val) - return w.String() + _, err := w.WriteString(val) + return err } -// Query represents a query +// Query represents a single part of the query string, a query param type Query struct { Key string Value string @@ -130,6 +138,10 @@ type Query struct { } func parseQuery(query string) (values []Query, err error) { + // This is essentially a copy of parseQuery from + // https://golang.org/src/net/url/url.go but adjusted to build our values + // based on our type, which we need to preserve the ordering of the query + // string for query != "" { key := query if i := strings.IndexAny(key, "&;"); i >= 0 { @@ -205,45 +217,24 @@ func sanitizedURL(val string) (string, error) { return u.String(), nil } -func (p *Policy) writeLinkableBuf(buff *bytes.Buffer, token *html.Token) { - // do not escape multiple query parameters - tokenBuff := bytes.NewBufferString("") - tokenBuff.WriteString("<") - tokenBuff.WriteString(token.Data) - for _, attr := range token.Attr { - tokenBuff.WriteByte(' ') - tokenBuff.WriteString(attr.Key) - tokenBuff.WriteString(`="`) - switch attr.Key { - case "href", "src": - u, ok := p.validURL(attr.Val) - if !ok { - tokenBuff.WriteString(html.EscapeString(attr.Val)) - continue - } - u, err := sanitizedURL(u) - if err == nil { - tokenBuff.WriteString(u) - } else { - // fallthrough - tokenBuff.WriteString(html.EscapeString(attr.Val)) - } - default: - // re-apply - tokenBuff.WriteString(html.EscapeString(attr.Val)) - } - tokenBuff.WriteByte('"') +// Performs the actual sanitization process. +func (p *Policy) sanitizeWithBuff(r io.Reader) *bytes.Buffer { + var buff bytes.Buffer + if err := p.sanitize(r, &buff); err != nil { + return &bytes.Buffer{} } - if token.Type == html.SelfClosingTagToken { - tokenBuff.WriteString("/") - } - tokenBuff.WriteString(">") - buff.WriteString(tokenBuff.String()) + return &buff } -// Performs the actual sanitization process. -func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { +type asStringWriter struct { + io.Writer +} +func (a *asStringWriter) WriteString(s string) (int, error) { + return a.Write([]byte(s)) +} + +func (p *Policy) sanitize(r io.Reader, w io.Writer) error { // It is possible that the developer has created the policy via: // p := bluemonday.Policy{} // rather than: @@ -252,8 +243,12 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { // would initiliaze the maps, then we need to do that. p.init() + buff, ok := w.(stringWriterWriter) + if !ok { + buff = &asStringWriter{w} + } + var ( - buff bytes.Buffer skipElementContent bool skippingElementsCount int64 skipClosingTag bool @@ -267,11 +262,11 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { err := tokenizer.Err() if err == io.EOF { // End of input means end of processing - return &buff + return nil } // Raw tokenizer error - return &bytes.Buffer{} + return err } token := tokenizer.Token() @@ -289,6 +284,10 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { case html.CommentToken: // Comments are ignored by default + if p.allowComments { + // But if allowed then write the comment out as-is + buff.WriteString(token.String()) + } case html.StartTagToken: @@ -303,14 +302,18 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { skippingElementsCount++ } if p.addSpaces { - buff.WriteString(" ") + if _, err := buff.WriteString(" "); err != nil { + return err + } } break } aps = aa } if len(token.Attr) != 0 { - token.Attr = p.sanitizeAttrs(token.Data, token.Attr, aps) + token.Attr = escapeAttributes( + p.sanitizeAttrs(token.Data, token.Attr, aps), + ) } if len(token.Attr) == 0 { @@ -318,18 +321,17 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { skipClosingTag = true closingTagToSkipStack = append(closingTagToSkipStack, token.Data) if p.addSpaces { - buff.WriteString(" ") + if _, err := buff.WriteString(" "); err != nil { + return err + } } break } } if !skipElementContent { - // do not escape multiple query parameters - if linkable(token.Data) { - p.writeLinkableBuf(&buff, &token) - } else { - buff.WriteString(token.String()) + if _, err := buff.WriteString(token.String()); err != nil { + return err } } @@ -345,7 +347,9 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { skipClosingTag = false } if p.addSpaces { - buff.WriteString(" ") + if _, err := buff.WriteString(" "); err != nil { + return err + } } break } @@ -366,14 +370,18 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { } if !match { if p.addSpaces { - buff.WriteString(" ") + if _, err := buff.WriteString(" "); err != nil { + return err + } } break } } if !skipElementContent { - buff.WriteString(token.String()) + if _, err := buff.WriteString(token.String()); err != nil { + return err + } } case html.SelfClosingTagToken: @@ -383,7 +391,9 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { aa, matched := p.matchRegex(token.Data) if !matched { if p.addSpaces && !matched { - buff.WriteString(" ") + if _, err := buff.WriteString(" "); err != nil { + return err + } } break } @@ -391,21 +401,20 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { } if len(token.Attr) != 0 { - token.Attr = p.sanitizeAttrs(token.Data, token.Attr, aps) + token.Attr = escapeAttributes(p.sanitizeAttrs(token.Data, token.Attr, aps)) } if len(token.Attr) == 0 && !p.allowNoAttrs(token.Data) { if p.addSpaces { - buff.WriteString(" ") + if _, err := buff.WriteString(" "); err != nil { + return err + } break } } if !skipElementContent { - // do not escape multiple query parameters - if linkable(token.Data) { - p.writeLinkableBuf(&buff, &token) - } else { - buff.WriteString(token.String()) + if _, err := buff.WriteString(token.String()); err != nil { + return err } } @@ -416,20 +425,26 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { case `script`: // not encouraged, but if a policy allows JavaScript we // should not HTML escape it as that would break the output - buff.WriteString(token.Data) - case `style`: + if _, err := buff.WriteString(token.Data); err != nil { + return err + } + case "style": // not encouraged, but if a policy allows CSS styles we // should not HTML escape it as that would break the output - buff.WriteString(token.Data) + if _, err := buff.WriteString(token.Data); err != nil { + return err + } default: // HTML escape the text - buff.WriteString(token.String()) + if _, err := buff.WriteString(token.String()); err != nil { + return err + } } } default: // A token that didn't exist in the html package when we wrote this - return &bytes.Buffer{} + return fmt.Errorf("unknown token: %v", token) } } } @@ -440,7 +455,7 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer { func (p *Policy) sanitizeAttrs( elementName string, attrs []html.Attribute, - aps map[string]attrPolicy, + aps map[string][]attrPolicy, ) []html.Attribute { if len(attrs) == 0 { @@ -465,8 +480,9 @@ func (p *Policy) sanitizeAttrs( } // Builds a new attribute slice based on the whether the attribute has been - // whitelisted explicitly or globally. + // allowed explicitly or globally. cleanAttrs := []html.Attribute{} +attrsLoop: for _, htmlAttr := range attrs { if p.allowDataAttributes { // If we see a data attribute, let it through. @@ -489,27 +505,32 @@ func (p *Policy) sanitizeAttrs( } // Is there an element specific attribute policy that applies? - if ap, ok := aps[htmlAttr.Key]; ok { - if ap.regexp != nil { - if ap.regexp.MatchString(htmlAttr.Val) { + if apl, ok := aps[htmlAttr.Key]; ok { + for _, ap := range apl { + if ap.regexp != nil { + if ap.regexp.MatchString(htmlAttr.Val) { + cleanAttrs = append(cleanAttrs, htmlAttr) + continue attrsLoop + } + } else { cleanAttrs = append(cleanAttrs, htmlAttr) - continue + continue attrsLoop } - } else { - cleanAttrs = append(cleanAttrs, htmlAttr) - continue } } // Is there a global attribute policy that applies? - if ap, ok := p.globalAttrs[htmlAttr.Key]; ok { - - if ap.regexp != nil { - if ap.regexp.MatchString(htmlAttr.Val) { + if apl, ok := p.globalAttrs[htmlAttr.Key]; ok { + for _, ap := range apl { + if ap.regexp != nil { + if ap.regexp.MatchString(htmlAttr.Val) { + htmlAttr.Val = escapeAttribute(htmlAttr.Val) + cleanAttrs = append(cleanAttrs, htmlAttr) + } + } else { + htmlAttr.Val = escapeAttribute(htmlAttr.Val) cleanAttrs = append(cleanAttrs, htmlAttr) } - } else { - cleanAttrs = append(cleanAttrs, htmlAttr) } } } @@ -533,7 +554,7 @@ func (p *Policy) sanitizeAttrs( tmpAttrs := []html.Attribute{} for _, htmlAttr := range cleanAttrs { switch elementName { - case "a", "area", "link": + case "a", "area", "base", "link": if htmlAttr.Key == "href" { if u, ok := p.validURL(htmlAttr.Val); ok { htmlAttr.Val = u @@ -542,7 +563,7 @@ func (p *Policy) sanitizeAttrs( break } tmpAttrs = append(tmpAttrs, htmlAttr) - case "blockquote", "q": + case "blockquote", "del", "ins", "q": if htmlAttr.Key == "cite" { if u, ok := p.validURL(htmlAttr.Val); ok { htmlAttr.Val = u @@ -551,7 +572,7 @@ func (p *Policy) sanitizeAttrs( break } tmpAttrs = append(tmpAttrs, htmlAttr) - case "img", "script": + case "audio", "embed", "iframe", "img", "script", "source", "track", "video": if htmlAttr.Key == "src" { if u, ok := p.validURL(htmlAttr.Val); ok { htmlAttr.Val = u @@ -576,7 +597,7 @@ func (p *Policy) sanitizeAttrs( // Add rel="nofollow" if a "href" exists switch elementName { - case "a", "area", "link": + case "a", "area", "base", "link": var hrefFound bool var externalLink bool for _, htmlAttr := range cleanAttrs { @@ -753,14 +774,14 @@ func (p *Policy) sanitizeAttrs( func (p *Policy) sanitizeStyles(attr html.Attribute, elementName string) html.Attribute { sps := p.elsAndStyles[elementName] if len(sps) == 0 { - sps = map[string]stylePolicy{} + sps = map[string][]stylePolicy{} // check for any matching elements, if we don't already have a policy found // if multiple matches are found they will be overwritten, it's best // to not have overlapping matchers for regex, policies := range p.elsMatchingAndStyles { if regex.MatchString(elementName) { for k, v := range policies { - sps[k] = v + sps[k] = append(sps[k], v...) } } } @@ -778,46 +799,51 @@ func (p *Policy) sanitizeStyles(attr html.Attribute, elementName string) html.At clean := []string{} prefixes := []string{"-webkit-", "-moz-", "-ms-", "-o-", "mso-", "-xv-", "-atsc-", "-wap-", "-khtml-", "prince-", "-ah-", "-hp-", "-ro-", "-rim-", "-tc-"} +decLoop: for _, dec := range decs { - addedProperty := false tempProperty := strings.ToLower(dec.Property) tempValue := removeUnicode(strings.ToLower(dec.Value)) for _, i := range prefixes { tempProperty = strings.TrimPrefix(tempProperty, i) } - if sp, ok := sps[tempProperty]; ok { - if sp.handler != nil { - if sp.handler(tempValue) { - clean = append(clean, dec.Property+": "+dec.Value) - addedProperty = true + if spl, ok := sps[tempProperty]; ok { + for _, sp := range spl { + if sp.handler != nil { + if sp.handler(tempValue) { + clean = append(clean, dec.Property+": "+dec.Value) + continue decLoop + } + } else if len(sp.enum) > 0 { + if stringInSlice(tempValue, sp.enum) { + clean = append(clean, dec.Property+": "+dec.Value) + continue decLoop + } + } else if sp.regexp != nil { + if sp.regexp.MatchString(tempValue) { + clean = append(clean, dec.Property+": "+dec.Value) + continue decLoop + } } - } else if len(sp.enum) > 0 { - if stringInSlice(tempValue, sp.enum) { - clean = append(clean, dec.Property+": "+dec.Value) - addedProperty = true - } - } else if sp.regexp != nil { - if sp.regexp.MatchString(tempValue) { - clean = append(clean, dec.Property+": "+dec.Value) - addedProperty = true - } - continue } } - if sp, ok := p.globalStyles[tempProperty]; ok && !addedProperty { - if sp.handler != nil { - if sp.handler(tempValue) { - clean = append(clean, dec.Property+": "+dec.Value) + if spl, ok := p.globalStyles[tempProperty]; ok { + for _, sp := range spl { + if sp.handler != nil { + if sp.handler(tempValue) { + clean = append(clean, dec.Property+": "+dec.Value) + continue decLoop + } + } else if len(sp.enum) > 0 { + if stringInSlice(tempValue, sp.enum) { + clean = append(clean, dec.Property+": "+dec.Value) + continue decLoop + } + } else if sp.regexp != nil { + if sp.regexp.MatchString(tempValue) { + clean = append(clean, dec.Property+": "+dec.Value) + continue decLoop + } } - } else if len(sp.enum) > 0 { - if stringInSlice(tempValue, sp.enum) { - clean = append(clean, dec.Property+": "+dec.Value) - } - } else if sp.regexp != nil { - if sp.regexp.MatchString(tempValue) { - clean = append(clean, dec.Property+": "+dec.Value) - } - continue } } } @@ -848,11 +874,28 @@ func (p *Policy) validURL(rawurl string) (string, bool) { rawurl = strings.TrimSpace(rawurl) // URLs cannot contain whitespace, unless it is a data-uri - if (strings.Contains(rawurl, " ") || + if strings.Contains(rawurl, " ") || strings.Contains(rawurl, "\t") || - strings.Contains(rawurl, "\n")) && - !strings.HasPrefix(rawurl, `data:`) { - return "", false + strings.Contains(rawurl, "\n") { + if !strings.HasPrefix(rawurl, `data:`) { + return "", false + } + + // Remove \r and \n from base64 encoded data to pass url.Parse. + matched := dataURIbase64Prefix.FindString(rawurl) + if matched != "" { + rawurl = matched + strings.Replace( + strings.Replace( + rawurl[len(matched):], + "\r", + "", + -1, + ), + "\n", + "", + -1, + ) + } } // URLs are valid if they parse @@ -863,16 +906,21 @@ func (p *Policy) validURL(rawurl string) (string, bool) { if u.Scheme != "" { - urlPolicy, ok := p.allowURLSchemes[u.Scheme] + urlPolicies, ok := p.allowURLSchemes[u.Scheme] if !ok { return "", false - } - if urlPolicy == nil || urlPolicy(u) == true { + if len(urlPolicies) == 0 { return u.String(), true } + for _, urlPolicy := range urlPolicies { + if urlPolicy(u) == true { + return u.String(), true + } + } + return "", false } @@ -890,7 +938,14 @@ func (p *Policy) validURL(rawurl string) (string, bool) { func linkable(elementName string) bool { switch elementName { - case "a", "area", "blockquote", "img", "link", "script": + case "a", "area", "base", "link": + // elements that allow .href + return true + case "blockquote", "del", "ins", "q": + // elements that allow .cite + return true + case "audio", "embed", "iframe", "img", "input", "script", "track", "video": + // elements that allow .src return true default: return false @@ -957,14 +1012,14 @@ func removeUnicode(value string) string { return substitutedValue } -func (p *Policy) matchRegex(elementName string) (map[string]attrPolicy, bool) { - aps := make(map[string]attrPolicy, 0) +func (p *Policy) matchRegex(elementName string) (map[string][]attrPolicy, bool) { + aps := make(map[string][]attrPolicy, 0) matched := false for regex, attrs := range p.elsMatchingAndAttrs { if regex.MatchString(elementName) { matched = true for k, v := range attrs { - aps[k] = v + aps[k] = append(aps[k], v...) } } } @@ -989,3 +1044,18 @@ func normaliseElementName(str string) string { `"`, ) } + +func escapeAttributes(attrs []html.Attribute) []html.Attribute { + escapedAttrs := []html.Attribute{} + for _, attr := range attrs { + attr.Val = escapeAttribute(attr.Val) + escapedAttrs = append(escapedAttrs, attr) + } + return escapedAttrs +} + +func escapeAttribute(val string) string { + val = strings.Replace(val, string([]rune{'\u00A0'}), ` `, -1) + val = strings.Replace(val, `"`, `"`, -1) + return val +} \ No newline at end of file diff --git a/backend/vendor/github.com/microcosm-cc/bluemonday/stringwriterwriter_go1.12.go b/backend/vendor/github.com/microcosm-cc/bluemonday/stringwriterwriter_go1.12.go new file mode 100644 index 00000000..afa011e0 --- /dev/null +++ b/backend/vendor/github.com/microcosm-cc/bluemonday/stringwriterwriter_go1.12.go @@ -0,0 +1,10 @@ +// +build go1.12 + +package bluemonday + +import "io" + +type stringWriterWriter interface { + io.Writer + io.StringWriter +} diff --git a/backend/vendor/github.com/microcosm-cc/bluemonday/stringwriterwriter_ltgo1.12.go b/backend/vendor/github.com/microcosm-cc/bluemonday/stringwriterwriter_ltgo1.12.go new file mode 100644 index 00000000..9bc67479 --- /dev/null +++ b/backend/vendor/github.com/microcosm-cc/bluemonday/stringwriterwriter_ltgo1.12.go @@ -0,0 +1,14 @@ +// +build go1.1,!go1.12 + +package bluemonday + +import "io" + +type stringWriterWriter interface { + io.Writer + StringWriter +} + +type StringWriter interface { + WriteString(s string) (n int, err error) +} diff --git a/backend/vendor/github.com/rs/xid/README.md b/backend/vendor/github.com/rs/xid/README.md index 1f886fd7..79818877 100644 --- a/backend/vendor/github.com/rs/xid/README.md +++ b/backend/vendor/github.com/rs/xid/README.md @@ -2,9 +2,9 @@ [![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/rs/xid) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/rs/xid/master/LICENSE) [![Build Status](https://travis-ci.org/rs/xid.svg?branch=master)](https://travis-ci.org/rs/xid) [![Coverage](http://gocover.io/_badge/github.com/rs/xid)](http://gocover.io/github.com/rs/xid) -Package xid is a globally unique id generator library, ready to be used safely directly in your server code. +Package xid is a globally unique id generator library, ready to safely be used directly in your server code. -Xid is using Mongo Object ID algorithm to generate globally unique ids with a different serialization (base64) to make it shorter when transported as a string: +Xid uses the Mongo Object ID algorithm to generate globally unique ids with a different serialization (base64) to make it shorter when transported as a string: https://docs.mongodb.org/manual/reference/object-id/ - 4-byte value representing the seconds since the Unix epoch, @@ -33,7 +33,7 @@ is required so it can be used directly in server's code. |-------------|-------------|----------------|---------------- | [UUID] | 16 bytes | 36 chars | configuration free, not sortable | [shortuuid] | 16 bytes | 22 chars | configuration free, not sortable -| [Snowflake] | 8 bytes | up to 20 chars | needs machin/DC configuration, needs central server, sortable +| [Snowflake] | 8 bytes | up to 20 chars | needs machine/DC configuration, needs central server, sortable | [MongoID] | 12 bytes | 24 chars | configuration free, sortable | xid | 12 bytes | 20 chars | configuration free, sortable @@ -57,7 +57,7 @@ Best used with [zerolog](https://github.com/rs/zerolog)'s Notes: -- Xid is dependent on the system time, a monotonic counter and so is not cryptographically secure. If unpredictability of IDs is important, you should not use Xids. It is worth noting that most of the other UUID like implementations are also not cryptographically secure. You shoud use libraries that rely on cryptographically secure sources (like /dev/urandom on unix, crypto/rand in golang), if you want a truly random ID generator. +- Xid is dependent on the system time, a monotonic counter and so is not cryptographically secure. If unpredictability of IDs is important, you should not use Xids. It is worth noting that most other UUID-like implementations are also not cryptographically secure. You should use libraries that rely on cryptographically secure sources (like /dev/urandom on unix, crypto/rand in golang), if you want a truly random ID generator. References: @@ -66,6 +66,9 @@ References: - https://blog.twitter.com/2010/announcing-snowflake - Python port by [Graham Abbott](https://github.com/graham): https://github.com/graham/python_xid - Scala port by [Egor Kolotaev](https://github.com/kolotaev): https://github.com/kolotaev/ride +- Rust port by [Jérôme Renard](https://github.com/jeromer/): https://github.com/jeromer/libxid +- Ruby port by [Valar](https://github.com/valarpirai/): https://github.com/valarpirai/ruby_xid +- Java port by [0xShamil](https://github.com/0xShamil/): https://github.com/0xShamil/java-xid ## Install @@ -105,7 +108,7 @@ BenchmarkUUIDv4-2 1000000 1427 ns/op 64 B/op 2 allocs/op BenchmarkUUIDv4-4 1000000 1452 ns/op 64 B/op 2 allocs/op ``` -Note: UUIDv1 requires a global lock, hence the performence degrading as we add more CPUs. +Note: UUIDv1 requires a global lock, hence the performance degradation as we add more CPUs. ## Licenses diff --git a/backend/vendor/github.com/rs/xid/go.mod b/backend/vendor/github.com/rs/xid/go.mod index 95b83386..3d61b506 100644 --- a/backend/vendor/github.com/rs/xid/go.mod +++ b/backend/vendor/github.com/rs/xid/go.mod @@ -1 +1,3 @@ module github.com/rs/xid + +go 1.12 diff --git a/backend/vendor/github.com/rs/xid/hostid_linux.go b/backend/vendor/github.com/rs/xid/hostid_linux.go index 7d0c4a9e..837b2043 100644 --- a/backend/vendor/github.com/rs/xid/hostid_linux.go +++ b/backend/vendor/github.com/rs/xid/hostid_linux.go @@ -5,6 +5,9 @@ package xid import "io/ioutil" func readPlatformMachineID() (string, error) { - b, err := ioutil.ReadFile("/sys/class/dmi/id/product_uuid") + b, err := ioutil.ReadFile("/etc/machine-id") + if err != nil || len(b) == 0 { + b, err = ioutil.ReadFile("/sys/class/dmi/id/product_uuid") + } return string(b), err } diff --git a/backend/vendor/github.com/rs/xid/id.go b/backend/vendor/github.com/rs/xid/id.go index 466faf26..f1db1a18 100644 --- a/backend/vendor/github.com/rs/xid/id.go +++ b/backend/vendor/github.com/rs/xid/id.go @@ -55,6 +55,7 @@ import ( "sort" "sync/atomic" "time" + "unsafe" ) // Code inspired from mgo/bson ObjectId @@ -177,7 +178,13 @@ func FromString(id string) (ID, error) { func (id ID) String() string { text := make([]byte, encodedLen) encode(text, id[:]) - return string(text) + return *(*string)(unsafe.Pointer(&text)) +} + +// Encode encodes the id using base32 encoding, writing 20 bytes to dst and return it. +func (id ID) Encode(dst []byte) []byte { + encode(dst, id[:]) + return dst } // MarshalText implements encoding/text TextMarshaler interface @@ -192,32 +199,37 @@ func (id ID) MarshalJSON() ([]byte, error) { if id.IsNil() { return []byte("null"), nil } - text, err := id.MarshalText() - return []byte(`"` + string(text) + `"`), err + text := make([]byte, encodedLen+2) + encode(text[1:encodedLen+1], id[:]) + text[0], text[encodedLen+1] = '"', '"' + return text, nil } // encode by unrolling the stdlib base32 algorithm + removing all safe checks func encode(dst, id []byte) { - dst[0] = encoding[id[0]>>3] - dst[1] = encoding[(id[1]>>6)&0x1F|(id[0]<<2)&0x1F] - dst[2] = encoding[(id[1]>>1)&0x1F] - dst[3] = encoding[(id[2]>>4)&0x1F|(id[1]<<4)&0x1F] - dst[4] = encoding[id[3]>>7|(id[2]<<1)&0x1F] - dst[5] = encoding[(id[3]>>2)&0x1F] - dst[6] = encoding[id[4]>>5|(id[3]<<3)&0x1F] - dst[7] = encoding[id[4]&0x1F] - dst[8] = encoding[id[5]>>3] - dst[9] = encoding[(id[6]>>6)&0x1F|(id[5]<<2)&0x1F] - dst[10] = encoding[(id[6]>>1)&0x1F] - dst[11] = encoding[(id[7]>>4)&0x1F|(id[6]<<4)&0x1F] - dst[12] = encoding[id[8]>>7|(id[7]<<1)&0x1F] - dst[13] = encoding[(id[8]>>2)&0x1F] - dst[14] = encoding[(id[9]>>5)|(id[8]<<3)&0x1F] - dst[15] = encoding[id[9]&0x1F] - dst[16] = encoding[id[10]>>3] - dst[17] = encoding[(id[11]>>6)&0x1F|(id[10]<<2)&0x1F] - dst[18] = encoding[(id[11]>>1)&0x1F] + _ = dst[19] + _ = id[11] + dst[19] = encoding[(id[11]<<4)&0x1F] + dst[18] = encoding[(id[11]>>1)&0x1F] + dst[17] = encoding[(id[11]>>6)&0x1F|(id[10]<<2)&0x1F] + dst[16] = encoding[id[10]>>3] + dst[15] = encoding[id[9]&0x1F] + dst[14] = encoding[(id[9]>>5)|(id[8]<<3)&0x1F] + dst[13] = encoding[(id[8]>>2)&0x1F] + dst[12] = encoding[id[8]>>7|(id[7]<<1)&0x1F] + dst[11] = encoding[(id[7]>>4)&0x1F|(id[6]<<4)&0x1F] + dst[10] = encoding[(id[6]>>1)&0x1F] + dst[9] = encoding[(id[6]>>6)&0x1F|(id[5]<<2)&0x1F] + dst[8] = encoding[id[5]>>3] + dst[7] = encoding[id[4]&0x1F] + dst[6] = encoding[id[4]>>5|(id[3]<<3)&0x1F] + dst[5] = encoding[(id[3]>>2)&0x1F] + dst[4] = encoding[id[3]>>7|(id[2]<<1)&0x1F] + dst[3] = encoding[(id[2]>>4)&0x1F|(id[1]<<4)&0x1F] + dst[2] = encoding[(id[1]>>1)&0x1F] + dst[1] = encoding[(id[1]>>6)&0x1F|(id[0]<<2)&0x1F] + dst[0] = encoding[id[0]>>3] } // UnmarshalText implements encoding/text TextUnmarshaler interface @@ -246,18 +258,21 @@ func (id *ID) UnmarshalJSON(b []byte) error { // decode by unrolling the stdlib base32 algorithm + removing all safe checks func decode(id *ID, src []byte) { - id[0] = dec[src[0]]<<3 | dec[src[1]]>>2 - id[1] = dec[src[1]]<<6 | dec[src[2]]<<1 | dec[src[3]]>>4 - id[2] = dec[src[3]]<<4 | dec[src[4]]>>1 - id[3] = dec[src[4]]<<7 | dec[src[5]]<<2 | dec[src[6]]>>3 - id[4] = dec[src[6]]<<5 | dec[src[7]] - id[5] = dec[src[8]]<<3 | dec[src[9]]>>2 - id[6] = dec[src[9]]<<6 | dec[src[10]]<<1 | dec[src[11]]>>4 - id[7] = dec[src[11]]<<4 | dec[src[12]]>>1 - id[8] = dec[src[12]]<<7 | dec[src[13]]<<2 | dec[src[14]]>>3 - id[9] = dec[src[14]]<<5 | dec[src[15]] - id[10] = dec[src[16]]<<3 | dec[src[17]]>>2 + _ = src[19] + _ = id[11] + id[11] = dec[src[17]]<<6 | dec[src[18]]<<1 | dec[src[19]]>>4 + id[10] = dec[src[16]]<<3 | dec[src[17]]>>2 + id[9] = dec[src[14]]<<5 | dec[src[15]] + id[8] = dec[src[12]]<<7 | dec[src[13]]<<2 | dec[src[14]]>>3 + id[7] = dec[src[11]]<<4 | dec[src[12]]>>1 + id[6] = dec[src[9]]<<6 | dec[src[10]]<<1 | dec[src[11]]>>4 + id[5] = dec[src[8]]<<3 | dec[src[9]]>>2 + id[4] = dec[src[6]]<<5 | dec[src[7]] + id[3] = dec[src[4]]<<7 | dec[src[5]]<<2 | dec[src[6]]>>3 + id[2] = dec[src[3]]<<4 | dec[src[4]]>>1 + id[1] = dec[src[1]]<<6 | dec[src[2]]<<1 | dec[src[3]]>>4 + id[0] = dec[src[0]]<<3 | dec[src[1]]>>2 } // Time returns the timestamp part of the id. diff --git a/backend/vendor/github.com/slack-go/slack/README.md b/backend/vendor/github.com/slack-go/slack/README.md index 7be89066..dc83eaa8 100644 --- a/backend/vendor/github.com/slack-go/slack/README.md +++ b/backend/vendor/github.com/slack-go/slack/README.md @@ -1,5 +1,6 @@ -Slack API in Go [![GoDoc](https://godoc.org/github.com/slack-go/slack?status.svg)](https://godoc.org/github.com/slack-go/slack) [![Build Status](https://travis-ci.org/slack-go/slack.svg)](https://travis-ci.org/slack-go/slack) +Slack API in Go [![Go Reference](https://pkg.go.dev/badge/github.com/slack-go/slack.svg)](https://pkg.go.dev/github.com/slack-go/slack) =============== + This is the original Slack library for Go created by Norberto Lopes, transferred to a Github organization. [![Join the chat at https://gitter.im/go-slack/Lobby](https://badges.gitter.im/go-slack/Lobby.svg)](https://gitter.im/go-slack/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) @@ -14,7 +15,7 @@ a fully managed way. There is currently no major version released. Therefore, minor version releases may include backward incompatible changes. -See [CHANGELOG.md](https://github.com/slack-go/slack/blob/master/CHANGELOG.md) for more information about the changes. +See [CHANGELOG.md](https://github.com/slack-go/slack/blob/master/CHANGELOG.md) or [Releases](https://github.com/slack-go/slack/releases) for more information about the changes. ## Installing diff --git a/backend/vendor/github.com/slack-go/slack/apps.go b/backend/vendor/github.com/slack-go/slack/apps.go index d9749438..4f60da0a 100644 --- a/backend/vendor/github.com/slack-go/slack/apps.go +++ b/backend/vendor/github.com/slack-go/slack/apps.go @@ -45,14 +45,13 @@ func (api *Client) ListEventAuthorizationsContext(ctx context.Context, eventCont func (api *Client) UninstallApp(clientID, clientSecret string) error { values := url.Values{ - "token": {api.token}, "client_id": {clientID}, "client_secret": {clientSecret}, } response := SlackResponse{} - err := api.getMethod(context.Background(), "apps.uninstall", values, &response) + err := api.getMethod(context.Background(), "apps.uninstall", api.token, values, &response) if err != nil { return err } diff --git a/backend/vendor/github.com/slack-go/slack/attachments.go b/backend/vendor/github.com/slack-go/slack/attachments.go index 69b223a2..f4eb9b93 100644 --- a/backend/vendor/github.com/slack-go/slack/attachments.go +++ b/backend/vendor/github.com/slack-go/slack/attachments.go @@ -17,7 +17,7 @@ type AttachmentAction struct { Name string `json:"name"` // Required. Text string `json:"text"` // Required. Style string `json:"style,omitempty"` // Optional. Allowed values: "default", "primary", "danger". - Type actionType `json:"type"` // Required. Must be set to "button" or "select". + Type ActionType `json:"type"` // Required. Must be set to "button" or "select". Value string `json:"value,omitempty"` // Optional. DataSource string `json:"data_source,omitempty"` // Optional. MinQueryLength int `json:"min_query_length,omitempty"` // Optional. Default value is 1. @@ -29,7 +29,7 @@ type AttachmentAction struct { } // actionType returns the type of the action -func (a AttachmentAction) actionType() actionType { +func (a AttachmentAction) actionType() ActionType { return a.Type } diff --git a/backend/vendor/github.com/slack-go/slack/audit.go b/backend/vendor/github.com/slack-go/slack/audit.go new file mode 100644 index 00000000..041ffd77 --- /dev/null +++ b/backend/vendor/github.com/slack-go/slack/audit.go @@ -0,0 +1,142 @@ +package slack + +import ( + "context" + "net/url" + "strconv" +) + +type AuditLogResponse struct { + Entries []AuditEntry `json:"entries"` + SlackResponse +} + +type AuditEntry struct { + ID string `json:"id"` + DateCreate int `json:"date_create"` + Action string `json:"action"` + Actor struct { + Type string `json:"type"` + User AuditUser `json:"user"` + } `json:"actor"` + Entity struct { + Type string `json:"type"` + // Only one of the below will be completed, based on the value of Type a user, a channel, a file, an app, a workspace, or an enterprise + User AuditUser `json:"user"` + Channel AuditChannel `json:"channel"` + File AuditFile `json:"file"` + App AuditApp `json:"app"` + Workspace AuditWorkspace `json:"workspace"` + Enterprise AuditEnterprise `json:"enterprise"` + } `json:"entity"` + Context struct { + Location struct { + Type string `json:"type"` + ID string `json:"id"` + Name string `json:"name"` + Domain string `json:"domain"` + } `json:"location"` + UA string `json:"ua"` + IPAddress string `json:"ip_address"` + } `json:"context"` +} + +type AuditUser struct { + ID string `json:"id"` + Name string `json:"name"` + Email string `json:"email"` + Team string `json:"team"` +} + +type AuditChannel struct { + ID string `json:"id"` + Name string `json:"name"` + Privacy string `json:"privacy"` + IsShared bool `json:"is_shared"` + IsOrgShared bool `json:"is_org_shared"` +} + +type AuditFile struct { + ID string `json:"id"` + Name string `json:"name"` + Filetype string `json:"filetype"` + Title string `json:"title"` +} + +type AuditApp struct { + ID string `json:"id"` + Name string `json:"name"` + IsDistributed bool `json:"is_distributed"` + IsDirectoryApproved bool `json:"is_directory_approved"` + IsWorkflowApp bool `json:"is_workflow_app"` + Scopes []string `json:"scopes"` +} + +type AuditWorkspace struct { + ID string `json:"id"` + Name string `json:"name"` + Domain string `json:"domain"` +} + +type AuditEnterprise struct { + ID string `json:"id"` + Name string `json:"name"` + Domain string `json:"domain"` +} + +// AuditLogParameters contains all the parameters necessary (including the optional ones) for a GetAuditLogs() request +type AuditLogParameters struct { + Limit int + Cursor string + Latest int + Oldest int + Action string + Actor string + Entity string +} + +func (api *Client) auditLogsRequest(ctx context.Context, path string, values url.Values) (*AuditLogResponse, error) { + response := &AuditLogResponse{} + err := api.getMethod(ctx, path, api.token, values, response) + if err != nil { + return nil, err + } + return response, response.Err() +} + +// GetAuditLogs retrieves a page of audit entires according to the parameters given +func (api *Client) GetAuditLogs(params AuditLogParameters) (entries []AuditEntry, nextCursor string, err error) { + return api.GetAuditLogsContext(context.Background(), params) +} + +// GetAuditLogsContext retrieves a page of audit entries according to the parameters given with a custom context +func (api *Client) GetAuditLogsContext(ctx context.Context, params AuditLogParameters) (entries []AuditEntry, nextCursor string, err error) { + values := url.Values{} + if params.Limit != 0 { + values.Add("limit", strconv.Itoa(params.Limit)) + } + if params.Oldest != 0 { + values.Add("oldest", strconv.Itoa(params.Oldest)) + } + if params.Latest != 0 { + values.Add("latest", strconv.Itoa(params.Latest)) + } + if params.Cursor != "" { + values.Add("cursor", params.Cursor) + } + if params.Action != "" { + values.Add("action", params.Action) + } + if params.Actor != "" { + values.Add("actor", params.Actor) + } + if params.Entity != "" { + values.Add("entity", params.Entity) + } + + response, err := api.auditLogsRequest(ctx, "audit/v1/logs", values) + if err != nil { + return nil, "", err + } + return response.Entries, response.ResponseMetadata.Cursor, response.Err() +} diff --git a/backend/vendor/github.com/slack-go/slack/block.go b/backend/vendor/github.com/slack-go/slack/block.go index 9946a294..3686db85 100644 --- a/backend/vendor/github.com/slack-go/slack/block.go +++ b/backend/vendor/github.com/slack-go/slack/block.go @@ -35,7 +35,7 @@ type Blocks struct { type BlockAction struct { ActionID string `json:"action_id"` BlockID string `json:"block_id"` - Type actionType `json:"type"` + Type ActionType `json:"type"` Text TextBlockObject `json:"text"` Value string `json:"value"` ActionTs string `json:"action_ts"` @@ -58,7 +58,7 @@ type BlockAction struct { } // actionType returns the type of the action -func (b BlockAction) actionType() actionType { +func (b BlockAction) actionType() ActionType { return b.Type } diff --git a/backend/vendor/github.com/slack-go/slack/block_conv.go b/backend/vendor/github.com/slack-go/slack/block_conv.go index f2d744c4..6936700a 100644 --- a/backend/vendor/github.com/slack-go/slack/block_conv.go +++ b/backend/vendor/github.com/slack-go/slack/block_conv.go @@ -181,6 +181,8 @@ func (b *BlockElements) UnmarshalJSON(data []byte) error { blockElement = &OverflowBlockElement{} case "datepicker": blockElement = &DatePickerBlockElement{} + case "timepicker": + blockElement = &TimePickerBlockElement{} case "plain_text_input": blockElement = &PlainTextInputBlockElement{} case "checkboxes": diff --git a/backend/vendor/github.com/slack-go/slack/channels.go b/backend/vendor/github.com/slack-go/slack/channels.go index c05521d0..2fca8b92 100644 --- a/backend/vendor/github.com/slack-go/slack/channels.go +++ b/backend/vendor/github.com/slack-go/slack/channels.go @@ -3,8 +3,6 @@ package slack import ( "context" "net/url" - "strconv" - "time" ) type channelResponseFull struct { @@ -19,12 +17,6 @@ type channelResponseFull struct { } // Channel contains information about the channel -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api type Channel struct { GroupConversation IsChannel bool `json:"is_channel"` @@ -42,673 +34,3 @@ func (api *Client) channelRequest(ctx context.Context, path string, values url.V return response, response.Err() } - -// GetChannelsOption option provided when getting channels. -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -type GetChannelsOption func(*ChannelPagination) error - -// GetChannelsOptionExcludeMembers excludes the members collection from each channel. -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func GetChannelsOptionExcludeMembers() GetChannelsOption { - return func(p *ChannelPagination) error { - p.excludeMembers = true - return nil - } -} - -// GetChannelsOptionExcludeArchived excludes archived channels from results. -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func GetChannelsOptionExcludeArchived() GetChannelsOption { - return func(p *ChannelPagination) error { - p.excludeArchived = true - return nil - } -} - -// ArchiveChannel archives the given channel -// see https://api.slack.com/methods/channels.archive -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) ArchiveChannel(channelID string) error { - return api.ArchiveChannelContext(context.Background(), channelID) -} - -// ArchiveChannelContext archives the given channel with a custom context -// see https://api.slack.com/methods/channels.archive -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) ArchiveChannelContext(ctx context.Context, channelID string) (err error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - } - - _, err = api.channelRequest(ctx, "channels.archive", values) - return err -} - -// UnarchiveChannel unarchives the given channel -// see https://api.slack.com/methods/channels.unarchive -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) UnarchiveChannel(channelID string) error { - return api.UnarchiveChannelContext(context.Background(), channelID) -} - -// UnarchiveChannelContext unarchives the given channel with a custom context -// see https://api.slack.com/methods/channels.unarchive -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) UnarchiveChannelContext(ctx context.Context, channelID string) (err error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - } - - _, err = api.channelRequest(ctx, "channels.unarchive", values) - return err -} - -// CreateChannel creates a channel with the given name and returns a *Channel -// see https://api.slack.com/methods/channels.create -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) CreateChannel(channelName string) (*Channel, error) { - return api.CreateChannelContext(context.Background(), channelName) -} - -// CreateChannelContext creates a channel with the given name and returns a *Channel with a custom context -// see https://api.slack.com/methods/channels.create -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) CreateChannelContext(ctx context.Context, channelName string) (*Channel, error) { - values := url.Values{ - "token": {api.token}, - "name": {channelName}, - } - - response, err := api.channelRequest(ctx, "channels.create", values) - if err != nil { - return nil, err - } - return &response.Channel, nil -} - -// GetChannelHistory retrieves the channel history -// see https://api.slack.com/methods/channels.history -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetChannelHistory(channelID string, params HistoryParameters) (*History, error) { - return api.GetChannelHistoryContext(context.Background(), channelID, params) -} - -// GetChannelHistoryContext retrieves the channel history with a custom context -// see https://api.slack.com/methods/channels.history -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetChannelHistoryContext(ctx context.Context, channelID string, params HistoryParameters) (*History, error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - } - if params.Latest != DEFAULT_HISTORY_LATEST { - values.Add("latest", params.Latest) - } - if params.Oldest != DEFAULT_HISTORY_OLDEST { - values.Add("oldest", params.Oldest) - } - if params.Count != DEFAULT_HISTORY_COUNT { - values.Add("count", strconv.Itoa(params.Count)) - } - if params.Inclusive != DEFAULT_HISTORY_INCLUSIVE { - if params.Inclusive { - values.Add("inclusive", "1") - } else { - values.Add("inclusive", "0") - } - } - - if params.Unreads != DEFAULT_HISTORY_UNREADS { - if params.Unreads { - values.Add("unreads", "1") - } else { - values.Add("unreads", "0") - } - } - - response, err := api.channelRequest(ctx, "channels.history", values) - if err != nil { - return nil, err - } - return &response.History, nil -} - -// GetChannelInfo retrieves the given channel -// see https://api.slack.com/methods/channels.info -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetChannelInfo(channelID string) (*Channel, error) { - return api.GetChannelInfoContext(context.Background(), channelID) -} - -// GetChannelInfoContext retrieves the given channel with a custom context -// see https://api.slack.com/methods/channels.info -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetChannelInfoContext(ctx context.Context, channelID string) (*Channel, error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - "include_locale": {strconv.FormatBool(true)}, - } - - response, err := api.channelRequest(ctx, "channels.info", values) - if err != nil { - return nil, err - } - return &response.Channel, nil -} - -// InviteUserToChannel invites a user to a given channel and returns a *Channel -// see https://api.slack.com/methods/channels.invite -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) InviteUserToChannel(channelID, user string) (*Channel, error) { - return api.InviteUserToChannelContext(context.Background(), channelID, user) -} - -// InviteUserToChannelContext invites a user to a given channel and returns a *Channel with a custom context -// see https://api.slack.com/methods/channels.invite -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) InviteUserToChannelContext(ctx context.Context, channelID, user string) (*Channel, error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - "user": {user}, - } - - response, err := api.channelRequest(ctx, "channels.invite", values) - if err != nil { - return nil, err - } - return &response.Channel, nil -} - -// JoinChannel joins the currently authenticated user to a channel -// see https://api.slack.com/methods/channels.join -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) JoinChannel(channelName string) (*Channel, error) { - return api.JoinChannelContext(context.Background(), channelName) -} - -// JoinChannelContext joins the currently authenticated user to a channel with a custom context -// see https://api.slack.com/methods/channels.join -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) JoinChannelContext(ctx context.Context, channelName string) (*Channel, error) { - values := url.Values{ - "token": {api.token}, - "name": {channelName}, - } - - response, err := api.channelRequest(ctx, "channels.join", values) - if err != nil { - return nil, err - } - return &response.Channel, nil -} - -// LeaveChannel makes the authenticated user leave the given channel -// see https://api.slack.com/methods/channels.leave -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) LeaveChannel(channelID string) (bool, error) { - return api.LeaveChannelContext(context.Background(), channelID) -} - -// LeaveChannelContext makes the authenticated user leave the given channel with a custom context -// see https://api.slack.com/methods/channels.leave -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) LeaveChannelContext(ctx context.Context, channelID string) (bool, error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - } - - response, err := api.channelRequest(ctx, "channels.leave", values) - if err != nil { - return false, err - } - - return response.NotInChannel, nil -} - -// KickUserFromChannel kicks a user from a given channel -// see https://api.slack.com/methods/channels.kick -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) KickUserFromChannel(channelID, user string) error { - return api.KickUserFromChannelContext(context.Background(), channelID, user) -} - -// KickUserFromChannelContext kicks a user from a given channel with a custom context -// see https://api.slack.com/methods/channels.kick -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) KickUserFromChannelContext(ctx context.Context, channelID, user string) (err error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - "user": {user}, - } - - _, err = api.channelRequest(ctx, "channels.kick", values) - return err -} - -func newChannelPagination(c *Client, options ...GetChannelsOption) (cp ChannelPagination) { - cp = ChannelPagination{ - c: c, - limit: 200, // per slack api documentation. - } - - for _, opt := range options { - opt(&cp) - } - - return cp -} - -// ChannelPagination allows for paginating over the channels -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -type ChannelPagination struct { - Channels []Channel - limit int - excludeArchived bool - excludeMembers bool - previousResp *ResponseMetadata - c *Client -} - -// Done checks if the pagination has completed -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (ChannelPagination) Done(err error) bool { - return err == errPaginationComplete -} - -// Failure checks if pagination failed. -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (t ChannelPagination) Failure(err error) error { - if t.Done(err) { - return nil - } - - return err -} - -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (t ChannelPagination) Next(ctx context.Context) (_ ChannelPagination, err error) { - var ( - resp *channelResponseFull - ) - - if t.c == nil || (t.previousResp != nil && t.previousResp.Cursor == "") { - return t, errPaginationComplete - } - - t.previousResp = t.previousResp.initialize() - - values := url.Values{ - "limit": {strconv.Itoa(t.limit)}, - "exclude_archived": {strconv.FormatBool(t.excludeArchived)}, - "exclude_members": {strconv.FormatBool(t.excludeMembers)}, - "token": {t.c.token}, - "cursor": {t.previousResp.Cursor}, - } - - if resp, err = t.c.channelRequest(ctx, "channels.list", values); err != nil { - return t, err - } - - t.c.Debugf("GetChannelsContext: got %d channels; metadata %v", len(resp.Channels), resp.Metadata) - t.Channels = resp.Channels - t.previousResp = &resp.Metadata - - return t, nil -} - -// GetChannelsPaginated fetches channels in a paginated fashion, see GetChannelsContext for usage. -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetChannelsPaginated(options ...GetChannelsOption) ChannelPagination { - return newChannelPagination(api, options...) -} - -// GetChannels retrieves all the channels -// see https://api.slack.com/methods/channels.list -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetChannels(excludeArchived bool, options ...GetChannelsOption) ([]Channel, error) { - return api.GetChannelsContext(context.Background(), excludeArchived, options...) -} - -// GetChannelsContext retrieves all the channels with a custom context -// see https://api.slack.com/methods/channels.list -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetChannelsContext(ctx context.Context, excludeArchived bool, options ...GetChannelsOption) (results []Channel, err error) { - if excludeArchived { - options = append(options, GetChannelsOptionExcludeArchived()) - } - - p := api.GetChannelsPaginated(options...) - for err == nil { - p, err = p.Next(ctx) - if err == nil { - results = append(results, p.Channels...) - } else if rateLimitedError, ok := err.(*RateLimitedError); ok { - select { - case <-ctx.Done(): - err = ctx.Err() - case <-time.After(rateLimitedError.RetryAfter): - err = nil - } - } - } - - return results, p.Failure(err) -} - -// SetChannelReadMark sets the read mark of a given channel to a specific point -// Clients should try to avoid making this call too often. When needing to mark a read position, a client should set a -// timer before making the call. In this way, any further updates needed during the timeout will not generate extra calls -// (just one per channel). This is useful for when reading scroll-back history, or following a busy live channel. A -// timeout of 5 seconds is a good starting point. Be sure to flush these calls on shutdown/logout. -// see https://api.slack.com/methods/channels.mark -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetChannelReadMark(channelID, ts string) error { - return api.SetChannelReadMarkContext(context.Background(), channelID, ts) -} - -// SetChannelReadMarkContext sets the read mark of a given channel to a specific point with a custom context -// For more details see SetChannelReadMark documentation -// see https://api.slack.com/methods/channels.mark -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetChannelReadMarkContext(ctx context.Context, channelID, ts string) (err error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - "ts": {ts}, - } - - _, err = api.channelRequest(ctx, "channels.mark", values) - return err -} - -// RenameChannel renames a given channel -// see https://api.slack.com/methods/channels.rename -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) RenameChannel(channelID, name string) (*Channel, error) { - return api.RenameChannelContext(context.Background(), channelID, name) -} - -// RenameChannelContext renames a given channel with a custom context -// see https://api.slack.com/methods/channels.rename -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) RenameChannelContext(ctx context.Context, channelID, name string) (*Channel, error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - "name": {name}, - } - - // XXX: the created entry in this call returns a string instead of a number - // so I may have to do some workaround to solve it. - response, err := api.channelRequest(ctx, "channels.rename", values) - if err != nil { - return nil, err - } - return &response.Channel, nil -} - -// SetChannelPurpose sets the channel purpose and returns the purpose that was successfully set -// see https://api.slack.com/methods/channels.setPurpose -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetChannelPurpose(channelID, purpose string) (string, error) { - return api.SetChannelPurposeContext(context.Background(), channelID, purpose) -} - -// SetChannelPurposeContext sets the channel purpose and returns the purpose that was successfully set with a custom context -// see https://api.slack.com/methods/channels.setPurpose -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetChannelPurposeContext(ctx context.Context, channelID, purpose string) (string, error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - "purpose": {purpose}, - } - - response, err := api.channelRequest(ctx, "channels.setPurpose", values) - if err != nil { - return "", err - } - return response.Purpose, nil -} - -// SetChannelTopic sets the channel topic and returns the topic that was successfully set -// see https://api.slack.com/methods/channels.setTopic -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetChannelTopic(channelID, topic string) (string, error) { - return api.SetChannelTopicContext(context.Background(), channelID, topic) -} - -// SetChannelTopicContext sets the channel topic and returns the topic that was successfully set with a custom context -// see https://api.slack.com/methods/channels.setTopic -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetChannelTopicContext(ctx context.Context, channelID, topic string) (string, error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - "topic": {topic}, - } - - response, err := api.channelRequest(ctx, "channels.setTopic", values) - if err != nil { - return "", err - } - return response.Topic, nil -} - -// GetChannelReplies gets an entire thread (a message plus all the messages in reply to it). -// see https://api.slack.com/methods/channels.replies -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetChannelReplies(channelID, thread_ts string) ([]Message, error) { - return api.GetChannelRepliesContext(context.Background(), channelID, thread_ts) -} - -// GetChannelRepliesContext gets an entire thread (a message plus all the messages in reply to it) with a custom context -// see https://api.slack.com/methods/channels.replies -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetChannelRepliesContext(ctx context.Context, channelID, thread_ts string) ([]Message, error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - "thread_ts": {thread_ts}, - } - response, err := api.channelRequest(ctx, "channels.replies", values) - if err != nil { - return nil, err - } - return response.History.Messages, nil -} diff --git a/backend/vendor/github.com/slack-go/slack/chat.go b/backend/vendor/github.com/slack-go/slack/chat.go index f5b80346..2a1e452e 100644 --- a/backend/vendor/github.com/slack-go/slack/chat.go +++ b/backend/vendor/github.com/slack-go/slack/chat.go @@ -744,7 +744,6 @@ func (api *Client) GetPermalink(params *PermalinkParameters) (string, error) { // GetPermalinkContext returns the permalink for a message using a custom context. func (api *Client) GetPermalinkContext(ctx context.Context, params *PermalinkParameters) (string, error) { values := url.Values{ - "token": {api.token}, "channel": {params.Channel}, "message_ts": {params.Ts}, } @@ -754,7 +753,7 @@ func (api *Client) GetPermalinkContext(ctx context.Context, params *PermalinkPar Permalink string `json:"permalink"` SlackResponse }{} - err := api.getMethod(ctx, "chat.getPermalink", values, &response) + err := api.getMethod(ctx, "chat.getPermalink", api.token, values, &response) if err != nil { return "", err } diff --git a/backend/vendor/github.com/slack-go/slack/conversation.go b/backend/vendor/github.com/slack-go/slack/conversation.go index 6fc4a083..29936260 100644 --- a/backend/vendor/github.com/slack-go/slack/conversation.go +++ b/backend/vendor/github.com/slack-go/slack/conversation.go @@ -455,9 +455,10 @@ func (api *Client) GetConversationRepliesContext(ctx context.Context, params *Ge type GetConversationsParameters struct { Cursor string - ExcludeArchived string + ExcludeArchived bool Limit int Types []string + TeamID string } // GetConversations returns the list of channels in a Slack team @@ -479,8 +480,11 @@ func (api *Client) GetConversationsContext(ctx context.Context, params *GetConve if params.Types != nil { values.Add("types", strings.Join(params.Types, ",")) } - if params.ExcludeArchived == "true" { - values.Add("exclude_archived", "true") + if params.ExcludeArchived { + values.Add("exclude_archived", strconv.FormatBool(params.ExcludeArchived)) + } + if params.TeamID != "" { + values.Add("team_id", params.TeamID) } response := struct { diff --git a/backend/vendor/github.com/slack-go/slack/dialog_select.go b/backend/vendor/github.com/slack-go/slack/dialog_select.go index 385cef68..3d6be989 100644 --- a/backend/vendor/github.com/slack-go/slack/dialog_select.go +++ b/backend/vendor/github.com/slack-go/slack/dialog_select.go @@ -54,6 +54,20 @@ func NewStaticSelectDialogInput(name, label string, options []DialogSelectOption } } +// NewExternalSelectDialogInput constructor for a `external` datasource menu input +func NewExternalSelectDialogInput(name, label string, options []DialogSelectOption) *DialogInputSelect { + return &DialogInputSelect{ + DialogInput: DialogInput{ + Type: InputTypeSelect, + Name: name, + Label: label, + Optional: true, + }, + DataSource: DialogDataSourceExternal, + Options: options, + } +} + // NewGroupedSelectDialogInput creates grouped options select input for Dialogs. func NewGroupedSelectDialogInput(name, label string, options []DialogOptionGroup) *DialogInputSelect { return &DialogInputSelect{ diff --git a/backend/vendor/github.com/slack-go/slack/files.go b/backend/vendor/github.com/slack-go/slack/files.go index 713038f0..00c255bc 100644 --- a/backend/vendor/github.com/slack-go/slack/files.go +++ b/backend/vendor/github.com/slack-go/slack/files.go @@ -295,9 +295,7 @@ func (api *Client) UploadFileContext(ctx context.Context, params FileUploadParam return nil, err } response := &fileResponseFull{} - values := url.Values{ - "token": {api.token}, - } + values := url.Values{} if params.Filetype != "" { values.Add("filetype", params.Filetype) } @@ -318,14 +316,15 @@ func (api *Client) UploadFileContext(ctx context.Context, params FileUploadParam } if params.Content != "" { values.Add("content", params.Content) + values.Add("token", api.token) err = api.postMethod(ctx, "files.upload", values, response) } else if params.File != "" { - err = postLocalWithMultipartResponse(ctx, api.httpclient, api.endpoint+"files.upload", params.File, "file", values, response, api) + err = postLocalWithMultipartResponse(ctx, api.httpclient, api.endpoint+"files.upload", params.File, "file", api.token, values, response, api) } else if params.Reader != nil { if params.Filename == "" { return nil, fmt.Errorf("files.upload: FileUploadParameters.Filename is mandatory when using FileUploadParameters.Reader") } - err = postWithMultipartResponse(ctx, api.httpclient, api.endpoint+"files.upload", params.Filename, "file", values, params.Reader, response, api) + err = postWithMultipartResponse(ctx, api.httpclient, api.endpoint+"files.upload", params.Filename, "file", api.token, values, params.Reader, response, api) } if err != nil { diff --git a/backend/vendor/github.com/slack-go/slack/go.mod b/backend/vendor/github.com/slack-go/slack/go.mod index 32fc4b93..e93a8a4a 100644 --- a/backend/vendor/github.com/slack-go/slack/go.mod +++ b/backend/vendor/github.com/slack-go/slack/go.mod @@ -9,4 +9,4 @@ require ( github.com/stretchr/testify v1.2.2 ) -go 1.13 +go 1.16 diff --git a/backend/vendor/github.com/slack-go/slack/groups.go b/backend/vendor/github.com/slack-go/slack/groups.go index 4c5793dc..b77f909d 100644 --- a/backend/vendor/github.com/slack-go/slack/groups.go +++ b/backend/vendor/github.com/slack-go/slack/groups.go @@ -1,574 +1,7 @@ package slack -import ( - "context" - "net/url" - "strconv" -) - // Group contains all the information for a group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api type Group struct { GroupConversation IsGroup bool `json:"is_group"` } - -type groupResponseFull struct { - Group Group `json:"group"` - Groups []Group `json:"groups"` - Purpose string `json:"purpose"` - Topic string `json:"topic"` - NotInGroup bool `json:"not_in_group"` - NoOp bool `json:"no_op"` - AlreadyClosed bool `json:"already_closed"` - AlreadyOpen bool `json:"already_open"` - AlreadyInGroup bool `json:"already_in_group"` - Channel Channel `json:"channel"` - History - SlackResponse -} - -func (api *Client) groupRequest(ctx context.Context, path string, values url.Values) (*groupResponseFull, error) { - response := &groupResponseFull{} - err := api.postMethod(ctx, path, values, response) - if err != nil { - return nil, err - } - - return response, response.Err() -} - -// ArchiveGroup archives a private group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) ArchiveGroup(group string) error { - return api.ArchiveGroupContext(context.Background(), group) -} - -// ArchiveGroupContext archives a private group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) ArchiveGroupContext(ctx context.Context, group string) error { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - } - - _, err := api.groupRequest(ctx, "groups.archive", values) - return err -} - -// UnarchiveGroup unarchives a private group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) UnarchiveGroup(group string) error { - return api.UnarchiveGroupContext(context.Background(), group) -} - -// UnarchiveGroupContext unarchives a private group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) UnarchiveGroupContext(ctx context.Context, group string) error { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - } - - _, err := api.groupRequest(ctx, "groups.unarchive", values) - return err -} - -// CreateGroup creates a private group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) CreateGroup(group string) (*Group, error) { - return api.CreateGroupContext(context.Background(), group) -} - -// CreateGroupContext creates a private group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) CreateGroupContext(ctx context.Context, group string) (*Group, error) { - values := url.Values{ - "token": {api.token}, - "name": {group}, - } - - response, err := api.groupRequest(ctx, "groups.create", values) - if err != nil { - return nil, err - } - return &response.Group, nil -} - -// CreateChildGroup creates a new private group archiving the old one -// This method takes an existing private group and performs the following steps: -// 1. Renames the existing group (from "example" to "example-archived"). -// 2. Archives the existing group. -// 3. Creates a new group with the name of the existing group. -// 4. Adds all members of the existing group to the new group. -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) CreateChildGroup(group string) (*Group, error) { - return api.CreateChildGroupContext(context.Background(), group) -} - -// CreateChildGroupContext creates a new private group archiving the old one with a custom context -// For more information see CreateChildGroup -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) CreateChildGroupContext(ctx context.Context, group string) (*Group, error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - } - - response, err := api.groupRequest(ctx, "groups.createChild", values) - if err != nil { - return nil, err - } - return &response.Group, nil -} - -// GetGroupHistory fetches all the history for a private group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetGroupHistory(group string, params HistoryParameters) (*History, error) { - return api.GetGroupHistoryContext(context.Background(), group, params) -} - -// GetGroupHistoryContext fetches all the history for a private group with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetGroupHistoryContext(ctx context.Context, group string, params HistoryParameters) (*History, error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - } - if params.Latest != DEFAULT_HISTORY_LATEST { - values.Add("latest", params.Latest) - } - if params.Oldest != DEFAULT_HISTORY_OLDEST { - values.Add("oldest", params.Oldest) - } - if params.Count != DEFAULT_HISTORY_COUNT { - values.Add("count", strconv.Itoa(params.Count)) - } - if params.Inclusive != DEFAULT_HISTORY_INCLUSIVE { - if params.Inclusive { - values.Add("inclusive", "1") - } else { - values.Add("inclusive", "0") - } - } - if params.Unreads != DEFAULT_HISTORY_UNREADS { - if params.Unreads { - values.Add("unreads", "1") - } else { - values.Add("unreads", "0") - } - } - - response, err := api.groupRequest(ctx, "groups.history", values) - if err != nil { - return nil, err - } - return &response.History, nil -} - -// InviteUserToGroup invites a specific user to a private group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) InviteUserToGroup(group, user string) (*Group, bool, error) { - return api.InviteUserToGroupContext(context.Background(), group, user) -} - -// InviteUserToGroupContext invites a specific user to a private group with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) InviteUserToGroupContext(ctx context.Context, group, user string) (*Group, bool, error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - "user": {user}, - } - - response, err := api.groupRequest(ctx, "groups.invite", values) - if err != nil { - return nil, false, err - } - return &response.Group, response.AlreadyInGroup, nil -} - -// LeaveGroup makes authenticated user leave the group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) LeaveGroup(group string) error { - return api.LeaveGroupContext(context.Background(), group) -} - -// LeaveGroupContext makes authenticated user leave the group with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) LeaveGroupContext(ctx context.Context, group string) (err error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - } - - _, err = api.groupRequest(ctx, "groups.leave", values) - return err -} - -// KickUserFromGroup kicks a user from a group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) KickUserFromGroup(group, user string) error { - return api.KickUserFromGroupContext(context.Background(), group, user) -} - -// KickUserFromGroupContext kicks a user from a group with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) KickUserFromGroupContext(ctx context.Context, group, user string) (err error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - "user": {user}, - } - - _, err = api.groupRequest(ctx, "groups.kick", values) - return err -} - -// GetGroups retrieves all groups -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetGroups(excludeArchived bool) ([]Group, error) { - return api.GetGroupsContext(context.Background(), excludeArchived) -} - -// GetGroupsContext retrieves all groups with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetGroupsContext(ctx context.Context, excludeArchived bool) ([]Group, error) { - values := url.Values{ - "token": {api.token}, - } - if excludeArchived { - values.Add("exclude_archived", "1") - } - - response, err := api.groupRequest(ctx, "groups.list", values) - if err != nil { - return nil, err - } - return response.Groups, nil -} - -// GetGroupInfo retrieves the given group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetGroupInfo(group string) (*Group, error) { - return api.GetGroupInfoContext(context.Background(), group) -} - -// GetGroupInfoContext retrieves the given group with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetGroupInfoContext(ctx context.Context, group string) (*Group, error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - "include_locale": {strconv.FormatBool(true)}, - } - - response, err := api.groupRequest(ctx, "groups.info", values) - if err != nil { - return nil, err - } - return &response.Group, nil -} - -// SetGroupReadMark sets the read mark on a private group -// Clients should try to avoid making this call too often. When needing to mark a read position, a client should set a -// timer before making the call. In this way, any further updates needed during the timeout will not generate extra -// calls (just one per channel). This is useful for when reading scroll-back history, or following a busy live -// channel. A timeout of 5 seconds is a good starting point. Be sure to flush these calls on shutdown/logout. -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetGroupReadMark(group, ts string) error { - return api.SetGroupReadMarkContext(context.Background(), group, ts) -} - -// SetGroupReadMarkContext sets the read mark on a private group with a custom context -// For more details see SetGroupReadMark -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetGroupReadMarkContext(ctx context.Context, group, ts string) (err error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - "ts": {ts}, - } - - _, err = api.groupRequest(ctx, "groups.mark", values) - return err -} - -// OpenGroup opens a private group -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) OpenGroup(group string) (bool, bool, error) { - return api.OpenGroupContext(context.Background(), group) -} - -// OpenGroupContext opens a private group with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) OpenGroupContext(ctx context.Context, group string) (bool, bool, error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - } - - response, err := api.groupRequest(ctx, "groups.open", values) - if err != nil { - return false, false, err - } - return response.NoOp, response.AlreadyOpen, nil -} - -// RenameGroup renames a group -// XXX: They return a channel, not a group. What is this crap? :( -// Inconsistent api it seems. -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) RenameGroup(group, name string) (*Channel, error) { - return api.RenameGroupContext(context.Background(), group, name) -} - -// RenameGroupContext renames a group with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) RenameGroupContext(ctx context.Context, group, name string) (*Channel, error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - "name": {name}, - } - - // XXX: the created entry in this call returns a string instead of a number - // so I may have to do some workaround to solve it. - response, err := api.groupRequest(ctx, "groups.rename", values) - if err != nil { - return nil, err - } - return &response.Channel, nil -} - -// SetGroupPurpose sets the group purpose -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetGroupPurpose(group, purpose string) (string, error) { - return api.SetGroupPurposeContext(context.Background(), group, purpose) -} - -// SetGroupPurposeContext sets the group purpose with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetGroupPurposeContext(ctx context.Context, group, purpose string) (string, error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - "purpose": {purpose}, - } - - response, err := api.groupRequest(ctx, "groups.setPurpose", values) - if err != nil { - return "", err - } - return response.Purpose, nil -} - -// SetGroupTopic sets the group topic -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetGroupTopic(group, topic string) (string, error) { - return api.SetGroupTopicContext(context.Background(), group, topic) -} - -// SetGroupTopicContext sets the group topic with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) SetGroupTopicContext(ctx context.Context, group, topic string) (string, error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - "topic": {topic}, - } - - response, err := api.groupRequest(ctx, "groups.setTopic", values) - if err != nil { - return "", err - } - return response.Topic, nil -} - -// GetGroupReplies gets an entire thread (a message plus all the messages in reply to it). -// see https://api.slack.com/methods/groups.replies -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetGroupReplies(channelID, thread_ts string) ([]Message, error) { - return api.GetGroupRepliesContext(context.Background(), channelID, thread_ts) -} - -// GetGroupRepliesContext gets an entire thread (a message plus all the messages in reply to it) with a custom context -// see https://api.slack.com/methods/groups.replies -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetGroupRepliesContext(ctx context.Context, channelID, thread_ts string) ([]Message, error) { - values := url.Values{ - "token": {api.token}, - "channel": {channelID}, - "thread_ts": {thread_ts}, - } - response, err := api.groupRequest(ctx, "groups.replies", values) - if err != nil { - return nil, err - } - return response.History.Messages, nil -} diff --git a/backend/vendor/github.com/slack-go/slack/im.go b/backend/vendor/github.com/slack-go/slack/im.go index a884b295..7c4bc257 100644 --- a/backend/vendor/github.com/slack-go/slack/im.go +++ b/backend/vendor/github.com/slack-go/slack/im.go @@ -1,11 +1,5 @@ package slack -import ( - "context" - "net/url" - "strconv" -) - type imChannel struct { ID string `json:"id"` } @@ -21,200 +15,7 @@ type imResponseFull struct { } // IM contains information related to the Direct Message channel -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api type IM struct { Conversation IsUserDeleted bool `json:"is_user_deleted"` } - -func (api *Client) imRequest(ctx context.Context, path string, values url.Values) (*imResponseFull, error) { - response := &imResponseFull{} - err := api.postMethod(ctx, path, values, response) - if err != nil { - return nil, err - } - - return response, response.Err() -} - -// CloseIMChannel closes the direct message channel -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) CloseIMChannel(channel string) (bool, bool, error) { - return api.CloseIMChannelContext(context.Background(), channel) -} - -// CloseIMChannelContext closes the direct message channel with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) CloseIMChannelContext(ctx context.Context, channel string) (bool, bool, error) { - values := url.Values{ - "token": {api.token}, - "channel": {channel}, - } - - response, err := api.imRequest(ctx, "im.close", values) - if err != nil { - return false, false, err - } - return response.NoOp, response.AlreadyClosed, nil -} - -// OpenIMChannel opens a direct message channel to the user provided as argument -// Returns some status and the channel ID -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) OpenIMChannel(user string) (bool, bool, string, error) { - return api.OpenIMChannelContext(context.Background(), user) -} - -// OpenIMChannelContext opens a direct message channel to the user provided as argument with a custom context -// Returns some status and the channel ID -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) OpenIMChannelContext(ctx context.Context, user string) (bool, bool, string, error) { - values := url.Values{ - "token": {api.token}, - "user": {user}, - } - - response, err := api.imRequest(ctx, "im.open", values) - if err != nil { - return false, false, "", err - } - return response.NoOp, response.AlreadyOpen, response.Channel.ID, nil -} - -// MarkIMChannel sets the read mark of a direct message channel to a specific point -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) MarkIMChannel(channel, ts string) (err error) { - return api.MarkIMChannelContext(context.Background(), channel, ts) -} - -// MarkIMChannelContext sets the read mark of a direct message channel to a specific point with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) MarkIMChannelContext(ctx context.Context, channel, ts string) error { - values := url.Values{ - "token": {api.token}, - "channel": {channel}, - "ts": {ts}, - } - - _, err := api.imRequest(ctx, "im.mark", values) - return err -} - -// GetIMHistory retrieves the direct message channel history -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetIMHistory(channel string, params HistoryParameters) (*History, error) { - return api.GetIMHistoryContext(context.Background(), channel, params) -} - -// GetIMHistoryContext retrieves the direct message channel history with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetIMHistoryContext(ctx context.Context, channel string, params HistoryParameters) (*History, error) { - values := url.Values{ - "token": {api.token}, - "channel": {channel}, - } - if params.Latest != DEFAULT_HISTORY_LATEST { - values.Add("latest", params.Latest) - } - if params.Oldest != DEFAULT_HISTORY_OLDEST { - values.Add("oldest", params.Oldest) - } - if params.Count != DEFAULT_HISTORY_COUNT { - values.Add("count", strconv.Itoa(params.Count)) - } - if params.Inclusive != DEFAULT_HISTORY_INCLUSIVE { - if params.Inclusive { - values.Add("inclusive", "1") - } else { - values.Add("inclusive", "0") - } - } - if params.Unreads != DEFAULT_HISTORY_UNREADS { - if params.Unreads { - values.Add("unreads", "1") - } else { - values.Add("unreads", "0") - } - } - - response, err := api.imRequest(ctx, "im.history", values) - if err != nil { - return nil, err - } - return &response.History, nil -} - -// GetIMChannels returns the list of direct message channels -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetIMChannels() ([]IM, error) { - return api.GetIMChannelsContext(context.Background()) -} - -// GetIMChannelsContext returns the list of direct message channels with a custom context -// -// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version. -// In Slack, these API are no longer available for newly Apps created after June 10th, 2020. -// Also, existing applications will not be able to use these APIs after February 24th, 2021. -// -// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api -func (api *Client) GetIMChannelsContext(ctx context.Context) ([]IM, error) { - values := url.Values{ - "token": {api.token}, - } - - response, err := api.imRequest(ctx, "im.list", values) - if err != nil { - return nil, err - } - return response.IMs, nil -} diff --git a/backend/vendor/github.com/slack-go/slack/info.go b/backend/vendor/github.com/slack-go/slack/info.go index ec706240..16fa667b 100644 --- a/backend/vendor/github.com/slack-go/slack/info.go +++ b/backend/vendor/github.com/slack-go/slack/info.go @@ -321,10 +321,9 @@ type UserPrefs struct { } func (api *Client) GetUserPrefs() (*UserPrefsCarrier, error) { - values := url.Values{"token": {api.token}} response := UserPrefsCarrier{} - err := api.getMethod(context.Background(), "users.prefs.get", values, &response) + err := api.getMethod(context.Background(), "users.prefs.get", api.token, url.Values{}, &response) if err != nil { return nil, err } diff --git a/backend/vendor/github.com/slack-go/slack/interactions.go b/backend/vendor/github.com/slack-go/slack/interactions.go index 2515e290..391cb987 100644 --- a/backend/vendor/github.com/slack-go/slack/interactions.go +++ b/backend/vendor/github.com/slack-go/slack/interactions.go @@ -9,11 +9,11 @@ import ( type InteractionType string // ActionType type represents the type of action (attachment, block, etc.) -type actionType string +type ActionType string // action is an interface that should be implemented by all callback action types type action interface { - actionType() actionType + actionType() ActionType } // Types of interactions that can be received. @@ -121,6 +121,7 @@ type Container struct { Type string `json:"type"` ViewID string `json:"view_id"` MessageTs string `json:"message_ts"` + ThreadTs string `json:"thread_ts,omitempty"` AttachmentID json.Number `json:"attachment_id"` ChannelID string `json:"channel_id"` IsEphemeral bool `json:"is_ephemeral"` diff --git a/backend/vendor/github.com/slack-go/slack/misc.go b/backend/vendor/github.com/slack-go/slack/misc.go index 821bda86..8c50305b 100644 --- a/backend/vendor/github.com/slack-go/slack/misc.go +++ b/backend/vendor/github.com/slack-go/slack/misc.go @@ -135,7 +135,7 @@ func parseResponseBody(body io.ReadCloser, intf interface{}, d Debug) error { return json.Unmarshal(response, intf) } -func postLocalWithMultipartResponse(ctx context.Context, client httpClient, method, fpath, fieldname string, values url.Values, intf interface{}, d Debug) error { +func postLocalWithMultipartResponse(ctx context.Context, client httpClient, method, fpath, fieldname, token string, values url.Values, intf interface{}, d Debug) error { fullpath, err := filepath.Abs(fpath) if err != nil { return err @@ -146,10 +146,10 @@ func postLocalWithMultipartResponse(ctx context.Context, client httpClient, meth } defer file.Close() - return postWithMultipartResponse(ctx, client, method, filepath.Base(fpath), fieldname, values, file, intf, d) + return postWithMultipartResponse(ctx, client, method, filepath.Base(fpath), fieldname, token, values, file, intf, d) } -func postWithMultipartResponse(ctx context.Context, client httpClient, path, name, fieldname string, values url.Values, r io.Reader, intf interface{}, d Debug) error { +func postWithMultipartResponse(ctx context.Context, client httpClient, path, name, fieldname, token string, values url.Values, r io.Reader, intf interface{}, d Debug) error { pipeReader, pipeWriter := io.Pipe() wr := multipart.NewWriter(pipeWriter) errc := make(chan error) @@ -175,6 +175,7 @@ func postWithMultipartResponse(ctx context.Context, client httpClient, path, nam return err } req.Header.Add("Content-Type", wr.FormDataContentType()) + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) req = req.WithContext(ctx) resp, err := client.Do(req) @@ -236,12 +237,14 @@ func postForm(ctx context.Context, client httpClient, endpoint string, values ur return doPost(ctx, client, req, newJSONParser(intf), d) } -func getResource(ctx context.Context, client httpClient, endpoint string, values url.Values, intf interface{}, d Debug) error { +func getResource(ctx context.Context, client httpClient, endpoint, token string, values url.Values, intf interface{}, d Debug) error { req, err := http.NewRequest("GET", endpoint, nil) if err != nil { return err } req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) + req.URL.RawQuery = values.Encode() return doPost(ctx, client, req, newJSONParser(intf), d) diff --git a/backend/vendor/github.com/slack-go/slack/slack.go b/backend/vendor/github.com/slack-go/slack/slack.go index 14367365..ea3aab6d 100644 --- a/backend/vendor/github.com/slack-go/slack/slack.go +++ b/backend/vendor/github.com/slack-go/slack/slack.go @@ -157,6 +157,6 @@ func (api *Client) postMethod(ctx context.Context, path string, values url.Value } // get a slack web method. -func (api *Client) getMethod(ctx context.Context, path string, values url.Values, intf interface{}) error { - return getResource(ctx, api.httpclient, api.endpoint+path, values, intf, api) +func (api *Client) getMethod(ctx context.Context, path string, token string, values url.Values, intf interface{}) error { + return getResource(ctx, api.httpclient, api.endpoint+path, token, values, intf, api) } diff --git a/backend/vendor/github.com/slack-go/slack/users.go b/backend/vendor/github.com/slack-go/slack/users.go index 82657d76..3696e37f 100644 --- a/backend/vendor/github.com/slack-go/slack/users.go +++ b/backend/vendor/github.com/slack-go/slack/users.go @@ -482,7 +482,7 @@ func (api *Client) SetUserPhotoContext(ctx context.Context, image string, params values.Add("crop_w", strconv.Itoa(params.CropW)) } - err = postLocalWithMultipartResponse(ctx, api.httpclient, api.endpoint+"users.setPhoto", image, "image", values, response, api) + err = postLocalWithMultipartResponse(ctx, api.httpclient, api.endpoint+"users.setPhoto", image, "image", api.token, values, response, api) if err != nil { return err } @@ -632,9 +632,15 @@ func (api *Client) UnsetUserCustomStatusContext(ctx context.Context) error { return api.SetUserCustomStatusContext(ctx, "", "", 0) } +// GetUserProfileParameters are the parameters required to get user profile +type GetUserProfileParameters struct { + UserID string + IncludeLabels bool +} + // GetUserProfile retrieves a user's profile information. -func (api *Client) GetUserProfile(userID string, includeLabels bool) (*UserProfile, error) { - return api.GetUserProfileContext(context.Background(), userID, includeLabels) +func (api *Client) GetUserProfile(params *GetUserProfileParameters) (*UserProfile, error) { + return api.GetUserProfileContext(context.Background(), params) } type getUserProfileResponse struct { @@ -643,13 +649,14 @@ type getUserProfileResponse struct { } // GetUserProfileContext retrieves a user's profile information with a context. -func (api *Client) GetUserProfileContext(ctx context.Context, userID string, includeLabels bool) (*UserProfile, error) { +func (api *Client) GetUserProfileContext(ctx context.Context, params *GetUserProfileParameters) (*UserProfile, error) { values := url.Values{"token": {api.token}} - if includeLabels { - values.Add("include_labels", "true") + + if params.UserID != "" { + values.Add("user", params.UserID) } - if userID != "" { - values.Add("user", userID) + if params.IncludeLabels { + values.Add("include_labels", "true") } resp := &getUserProfileResponse{} diff --git a/backend/vendor/github.com/slack-go/slack/views.go b/backend/vendor/github.com/slack-go/slack/views.go index ee197ad8..e3ee8815 100644 --- a/backend/vendor/github.com/slack-go/slack/views.go +++ b/backend/vendor/github.com/slack-go/slack/views.go @@ -38,8 +38,16 @@ type View struct { BotID string `json:"bot_id"` } +type ViewSubmissionCallbackResponseURL struct { + BlockID string `json:"block_id"` + ActionID string `json:"action_id"` + ChannelID string `json:"channel_id"` + ResponseURL string `json:"response_url"` +} + type ViewSubmissionCallback struct { - Hash string `json:"hash"` + Hash string `json:"hash"` + ResponseURLs []ViewSubmissionCallbackResponseURL `json:"response_urls,omitempty"` } type ViewClosedCallback struct { diff --git a/backend/vendor/go.etcd.io/bbolt/.gitignore b/backend/vendor/go.etcd.io/bbolt/.gitignore index 3bcd8cba..18312f00 100644 --- a/backend/vendor/go.etcd.io/bbolt/.gitignore +++ b/backend/vendor/go.etcd.io/bbolt/.gitignore @@ -3,3 +3,5 @@ *.swp /bin/ cover.out +/.idea +*.iml diff --git a/backend/vendor/go.etcd.io/bbolt/.travis.yml b/backend/vendor/go.etcd.io/bbolt/.travis.yml index 257dfdfe..452601e4 100644 --- a/backend/vendor/go.etcd.io/bbolt/.travis.yml +++ b/backend/vendor/go.etcd.io/bbolt/.travis.yml @@ -4,9 +4,10 @@ go_import_path: go.etcd.io/bbolt sudo: false go: -- 1.12 +- 1.15 before_install: +- go get -v golang.org/x/sys/unix - go get -v honnef.co/go/tools/... - go get -v github.com/kisielk/errcheck diff --git a/backend/vendor/go.etcd.io/bbolt/Makefile b/backend/vendor/go.etcd.io/bbolt/Makefile index 2968aaa6..21ecf48f 100644 --- a/backend/vendor/go.etcd.io/bbolt/Makefile +++ b/backend/vendor/go.etcd.io/bbolt/Makefile @@ -2,8 +2,6 @@ BRANCH=`git rev-parse --abbrev-ref HEAD` COMMIT=`git rev-parse --short HEAD` GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)" -default: build - race: @TEST_FREELIST_TYPE=hashmap go test -v -race -test.run="TestSimulate_(100op|1000op)" @echo "array freelist test" diff --git a/backend/vendor/go.etcd.io/bbolt/README.md b/backend/vendor/go.etcd.io/bbolt/README.md index c9e64b1a..f1b4a7b2 100644 --- a/backend/vendor/go.etcd.io/bbolt/README.md +++ b/backend/vendor/go.etcd.io/bbolt/README.md @@ -908,12 +908,14 @@ Below is a list of public, open source projects that use Bolt: * [BoltStore](https://github.com/yosssi/boltstore) - Session store using Bolt. * [Boltdb Boilerplate](https://github.com/bobintornado/boltdb-boilerplate) - Boilerplate wrapper around bolt aiming to make simple calls one-liners. * [BoltDbWeb](https://github.com/evnix/boltdbweb) - A web based GUI for BoltDB files. +* [BoltDB Viewer](https://github.com/zc310/rich_boltdb) - A BoltDB Viewer Can run on Windows、Linux、Android system. * [bleve](http://www.blevesearch.com/) - A pure Go search engine similar to ElasticSearch that uses Bolt as the default storage backend. * [btcwallet](https://github.com/btcsuite/btcwallet) - A bitcoin wallet. * [buckets](https://github.com/joyrexus/buckets) - a bolt wrapper streamlining simple tx and key scans. * [cayley](https://github.com/google/cayley) - Cayley is an open-source graph database using Bolt as optional backend. * [ChainStore](https://github.com/pressly/chainstore) - Simple key-value interface to a variety of storage engines organized as a chain of operations. +* [🌰 Chestnut](https://github.com/jrapoport/chestnut) - Chestnut is encrypted storage for Go. * [Consul](https://github.com/hashicorp/consul) - Consul is service discovery and configuration made easy. Distributed, highly available, and datacenter-aware. * [DVID](https://github.com/janelia-flyem/dvid) - Added Bolt as optional storage engine and testing it against Basho-tuned leveldb. * [dcrwallet](https://github.com/decred/dcrwallet) - A wallet for the Decred cryptocurrency. @@ -938,9 +940,8 @@ Below is a list of public, open source projects that use Bolt: * [MetricBase](https://github.com/msiebuhr/MetricBase) - Single-binary version of Graphite. * [MuLiFS](https://github.com/dankomiocevic/mulifs) - Music Library Filesystem creates a filesystem to organise your music files. * [NATS](https://github.com/nats-io/nats-streaming-server) - NATS Streaming uses bbolt for message and metadata storage. -* [Operation Go: A Routine Mission](http://gocode.io) - An online programming game for Golang using Bolt for user accounts and a leaderboard. -* [photosite/session](https://godoc.org/bitbucket.org/kardianos/photosite/session) - Sessions for a photo viewing site. * [Prometheus Annotation Server](https://github.com/oliver006/prom_annotation_server) - Annotation server for PromDash & Prometheus service monitoring system. +* [Rain](https://github.com/cenkalti/rain) - BitTorrent client and library. * [reef-pi](https://github.com/reef-pi/reef-pi) - reef-pi is an award winning, modular, DIY reef tank controller using easy to learn electronics based on a Raspberry Pi. * [Request Baskets](https://github.com/darklynx/request-baskets) - A web service to collect arbitrary HTTP requests and inspect them via REST API or simple web UI, similar to [RequestBin](http://requestb.in/) service * [Seaweed File System](https://github.com/chrislusf/seaweedfs) - Highly scalable distributed key~file system with O(1) disk read. diff --git a/backend/vendor/go.etcd.io/bbolt/bolt_unix.go b/backend/vendor/go.etcd.io/bbolt/bolt_unix.go index 2938fed5..4e5f65cc 100644 --- a/backend/vendor/go.etcd.io/bbolt/bolt_unix.go +++ b/backend/vendor/go.etcd.io/bbolt/bolt_unix.go @@ -7,6 +7,8 @@ import ( "syscall" "time" "unsafe" + + "golang.org/x/sys/unix" ) // flock acquires an advisory lock on a file descriptor. @@ -49,13 +51,13 @@ func funlock(db *DB) error { // mmap memory maps a DB's data file. func mmap(db *DB, sz int) error { // Map the data file to memory. - b, err := syscall.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags) + b, err := unix.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags) if err != nil { return err } // Advise the kernel that the mmap is accessed randomly. - err = madvise(b, syscall.MADV_RANDOM) + err = unix.Madvise(b, syscall.MADV_RANDOM) if err != nil && err != syscall.ENOSYS { // Ignore not implemented error in kernel because it still works. return fmt.Errorf("madvise: %s", err) @@ -76,18 +78,9 @@ func munmap(db *DB) error { } // Unmap using the original byte slice. - err := syscall.Munmap(db.dataref) + err := unix.Munmap(db.dataref) db.dataref = nil db.data = nil db.datasz = 0 return err } - -// NOTE: This function is copied from stdlib because it is not available on darwin. -func madvise(b []byte, advice int) (err error) { - _, _, e1 := syscall.Syscall(syscall.SYS_MADVISE, uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), uintptr(advice)) - if e1 != 0 { - err = e1 - } - return -} diff --git a/backend/vendor/go.etcd.io/bbolt/compact.go b/backend/vendor/go.etcd.io/bbolt/compact.go new file mode 100644 index 00000000..e4fe91b0 --- /dev/null +++ b/backend/vendor/go.etcd.io/bbolt/compact.go @@ -0,0 +1,114 @@ +package bbolt + +// Compact will create a copy of the source DB and in the destination DB. This may +// reclaim space that the source database no longer has use for. txMaxSize can be +// used to limit the transactions size of this process and may trigger intermittent +// commits. A value of zero will ignore transaction sizes. +// TODO: merge with: https://github.com/etcd-io/etcd/blob/b7f0f52a16dbf83f18ca1d803f7892d750366a94/mvcc/backend/backend.go#L349 +func Compact(dst, src *DB, txMaxSize int64) error { + // commit regularly, or we'll run out of memory for large datasets if using one transaction. + var size int64 + tx, err := dst.Begin(true) + if err != nil { + return err + } + defer tx.Rollback() + + if err := walk(src, func(keys [][]byte, k, v []byte, seq uint64) error { + // On each key/value, check if we have exceeded tx size. + sz := int64(len(k) + len(v)) + if size+sz > txMaxSize && txMaxSize != 0 { + // Commit previous transaction. + if err := tx.Commit(); err != nil { + return err + } + + // Start new transaction. + tx, err = dst.Begin(true) + if err != nil { + return err + } + size = 0 + } + size += sz + + // Create bucket on the root transaction if this is the first level. + nk := len(keys) + if nk == 0 { + bkt, err := tx.CreateBucket(k) + if err != nil { + return err + } + if err := bkt.SetSequence(seq); err != nil { + return err + } + return nil + } + + // Create buckets on subsequent levels, if necessary. + b := tx.Bucket(keys[0]) + if nk > 1 { + for _, k := range keys[1:] { + b = b.Bucket(k) + } + } + + // Fill the entire page for best compaction. + b.FillPercent = 1.0 + + // If there is no value then this is a bucket call. + if v == nil { + bkt, err := b.CreateBucket(k) + if err != nil { + return err + } + if err := bkt.SetSequence(seq); err != nil { + return err + } + return nil + } + + // Otherwise treat it as a key/value pair. + return b.Put(k, v) + }); err != nil { + return err + } + + return tx.Commit() +} + +// walkFunc is the type of the function called for keys (buckets and "normal" +// values) discovered by Walk. keys is the list of keys to descend to the bucket +// owning the discovered key/value pair k/v. +type walkFunc func(keys [][]byte, k, v []byte, seq uint64) error + +// walk walks recursively the bolt database db, calling walkFn for each key it finds. +func walk(db *DB, walkFn walkFunc) error { + return db.View(func(tx *Tx) error { + return tx.ForEach(func(name []byte, b *Bucket) error { + return walkBucket(b, nil, name, nil, b.Sequence(), walkFn) + }) + }) +} + +func walkBucket(b *Bucket, keypath [][]byte, k, v []byte, seq uint64, fn walkFunc) error { + // Execute callback. + if err := fn(keypath, k, v, seq); err != nil { + return err + } + + // If this is not a bucket then stop. + if v != nil { + return nil + } + + // Iterate over each child key/value. + keypath = append(keypath, k) + return b.ForEach(func(k, v []byte) error { + if v == nil { + bkt := b.Bucket(k) + return walkBucket(bkt, keypath, k, nil, bkt.Sequence(), fn) + } + return walkBucket(b, keypath, k, v, b.Sequence(), fn) + }) +} diff --git a/backend/vendor/go.etcd.io/bbolt/db.go b/backend/vendor/go.etcd.io/bbolt/db.go index 80b0095c..a798c390 100644 --- a/backend/vendor/go.etcd.io/bbolt/db.go +++ b/backend/vendor/go.etcd.io/bbolt/db.go @@ -120,6 +120,12 @@ type DB struct { // of truncate() and fsync() when growing the data file. AllocSize int + // Mlock locks database file in memory when set to true. + // It prevents major page faults, however used memory can't be reclaimed. + // + // Supported only on Unix via mlock/munlock syscalls. + Mlock bool + path string openFile func(string, int, os.FileMode) (*os.File, error) file *os.File @@ -188,6 +194,7 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) { db.MmapFlags = options.MmapFlags db.NoFreelistSync = options.NoFreelistSync db.FreelistType = options.FreelistType + db.Mlock = options.Mlock // Set default values for later DB operations. db.MaxBatchSize = DefaultMaxBatchSize @@ -337,7 +344,8 @@ func (db *DB) mmap(minsz int) error { } // Ensure the size is at least the minimum size. - var size = int(info.Size()) + fileSize := int(info.Size()) + var size = fileSize if size < minsz { size = minsz } @@ -346,6 +354,13 @@ func (db *DB) mmap(minsz int) error { return err } + if db.Mlock { + // Unlock db memory + if err := db.munlock(fileSize); err != nil { + return err + } + } + // Dereference all mmap references before unmapping. if db.rwtx != nil { db.rwtx.root.dereference() @@ -361,6 +376,13 @@ func (db *DB) mmap(minsz int) error { return err } + if db.Mlock { + // Don't allow swapping of data file + if err := db.mlock(fileSize); err != nil { + return err + } + } + // Save references to the meta pages. db.meta0 = db.page(0).meta() db.meta1 = db.page(1).meta() @@ -422,12 +444,36 @@ func (db *DB) mmapSize(size int) (int, error) { return int(sz), nil } +func (db *DB) munlock(fileSize int) error { + if err := munlock(db, fileSize); err != nil { + return fmt.Errorf("munlock error: " + err.Error()) + } + return nil +} + +func (db *DB) mlock(fileSize int) error { + if err := mlock(db, fileSize); err != nil { + return fmt.Errorf("mlock error: " + err.Error()) + } + return nil +} + +func (db *DB) mrelock(fileSizeFrom, fileSizeTo int) error { + if err := db.munlock(fileSizeFrom); err != nil { + return err + } + if err := db.mlock(fileSizeTo); err != nil { + return err + } + return nil +} + // init creates a new database file and initializes its meta pages. func (db *DB) init() error { // Create two meta pages on a buffer. buf := make([]byte, db.pageSize*4) for i := 0; i < 2; i++ { - p := db.pageInBuffer(buf[:], pgid(i)) + p := db.pageInBuffer(buf, pgid(i)) p.id = pgid(i) p.flags = metaPageFlag @@ -444,13 +490,13 @@ func (db *DB) init() error { } // Write an empty freelist at page 3. - p := db.pageInBuffer(buf[:], pgid(2)) + p := db.pageInBuffer(buf, pgid(2)) p.id = pgid(2) p.flags = freelistPageFlag p.count = 0 // Write an empty leaf page at page 4. - p = db.pageInBuffer(buf[:], pgid(3)) + p = db.pageInBuffer(buf, pgid(3)) p.id = pgid(3) p.flags = leafPageFlag p.count = 0 @@ -462,6 +508,7 @@ func (db *DB) init() error { if err := fdatasync(db); err != nil { return err } + db.filesz = len(buf) return nil } @@ -973,6 +1020,12 @@ func (db *DB) grow(sz int) error { if err := db.file.Sync(); err != nil { return fmt.Errorf("file sync error: %s", err) } + if db.Mlock { + // unlock old file and lock new one + if err := db.mrelock(db.filesz, sz); err != nil { + return fmt.Errorf("mlock/munlock error: %s", err) + } + } } db.filesz = sz @@ -1064,6 +1117,11 @@ type Options struct { // OpenFile is used to open files. It defaults to os.OpenFile. This option // is useful for writing hermetic tests. OpenFile func(string, int, os.FileMode) (*os.File, error) + + // Mlock locks database file in memory when set to true. + // It prevents potential page faults, however + // used memory can't be reclaimed. (UNIX only) + Mlock bool } // DefaultOptions represent the options used if nil options are passed into Open(). diff --git a/backend/vendor/go.etcd.io/bbolt/freelist_hmap.go b/backend/vendor/go.etcd.io/bbolt/freelist_hmap.go index 02ef2be0..dbd67a1e 100644 --- a/backend/vendor/go.etcd.io/bbolt/freelist_hmap.go +++ b/backend/vendor/go.etcd.io/bbolt/freelist_hmap.go @@ -4,7 +4,7 @@ import "sort" // hashmapFreeCount returns count of free pages(hashmap version) func (f *freelist) hashmapFreeCount() int { - // use the forwardmap to get the total count + // use the forwardMap to get the total count count := 0 for _, size := range f.forwardMap { count += int(size) @@ -41,7 +41,7 @@ func (f *freelist) hashmapAllocate(txid txid, n int) pgid { for pid := range bm { // remove the initial - f.delSpan(pid, uint64(size)) + f.delSpan(pid, size) f.allocs[pid] = txid @@ -51,7 +51,7 @@ func (f *freelist) hashmapAllocate(txid txid, n int) pgid { f.addSpan(pid+pgid(n), remain) for i := pgid(0); i < pgid(n); i++ { - delete(f.cache, pid+pgid(i)) + delete(f.cache, pid+i) } return pid } diff --git a/backend/vendor/go.etcd.io/bbolt/go.mod b/backend/vendor/go.etcd.io/bbolt/go.mod index c2366dae..96355a69 100644 --- a/backend/vendor/go.etcd.io/bbolt/go.mod +++ b/backend/vendor/go.etcd.io/bbolt/go.mod @@ -2,4 +2,4 @@ module go.etcd.io/bbolt go 1.12 -require golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 +require golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d diff --git a/backend/vendor/go.etcd.io/bbolt/go.sum b/backend/vendor/go.etcd.io/bbolt/go.sum index 4ad15a48..c13f8f47 100644 --- a/backend/vendor/go.etcd.io/bbolt/go.sum +++ b/backend/vendor/go.etcd.io/bbolt/go.sum @@ -1,2 +1,2 @@ -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d h1:L/IKR6COd7ubZrs2oTnTi73IhgqJ71c9s80WsQnh0Es= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/backend/vendor/go.etcd.io/bbolt/mlock_unix.go b/backend/vendor/go.etcd.io/bbolt/mlock_unix.go new file mode 100644 index 00000000..6a6c7b35 --- /dev/null +++ b/backend/vendor/go.etcd.io/bbolt/mlock_unix.go @@ -0,0 +1,36 @@ +// +build !windows + +package bbolt + +import "golang.org/x/sys/unix" + +// mlock locks memory of db file +func mlock(db *DB, fileSize int) error { + sizeToLock := fileSize + if sizeToLock > db.datasz { + // Can't lock more than mmaped slice + sizeToLock = db.datasz + } + if err := unix.Mlock(db.dataref[:sizeToLock]); err != nil { + return err + } + return nil +} + +//munlock unlocks memory of db file +func munlock(db *DB, fileSize int) error { + if db.dataref == nil { + return nil + } + + sizeToUnlock := fileSize + if sizeToUnlock > db.datasz { + // Can't unlock more than mmaped slice + sizeToUnlock = db.datasz + } + + if err := unix.Munlock(db.dataref[:sizeToUnlock]); err != nil { + return err + } + return nil +} diff --git a/backend/vendor/go.etcd.io/bbolt/mlock_windows.go b/backend/vendor/go.etcd.io/bbolt/mlock_windows.go new file mode 100644 index 00000000..b4a36a49 --- /dev/null +++ b/backend/vendor/go.etcd.io/bbolt/mlock_windows.go @@ -0,0 +1,11 @@ +package bbolt + +// mlock locks memory of db file +func mlock(_ *DB, _ int) error { + panic("mlock is supported only on UNIX systems") +} + +//munlock unlocks memory of db file +func munlock(_ *DB, _ int) error { + panic("munlock is supported only on UNIX systems") +} diff --git a/backend/vendor/go.etcd.io/bbolt/tx.go b/backend/vendor/go.etcd.io/bbolt/tx.go index 4b1a64a8..869d4120 100644 --- a/backend/vendor/go.etcd.io/bbolt/tx.go +++ b/backend/vendor/go.etcd.io/bbolt/tx.go @@ -188,7 +188,6 @@ func (tx *Tx) Commit() error { } // If strict mode is enabled then perform a consistency check. - // Only the first consistency error is reported in the panic. if tx.db.StrictMode { ch := tx.Check() var errs []string @@ -393,7 +392,7 @@ func (tx *Tx) CopyFile(path string, mode os.FileMode) error { return err } - err = tx.Copy(f) + _, err = tx.WriteTo(f) if err != nil { _ = f.Close() return err diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/default_value_decoders.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/default_value_decoders.go index 18919e3c..32fd1427 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/default_value_decoders.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/default_value_decoders.go @@ -55,7 +55,7 @@ type DefaultValueDecoders struct{} // // There is no support for decoding map[string]interface{} becuase there is no decoder for // interface{}, so users must either register this decoder themselves or use the -// EmptyInterfaceDecoder avaialble in the bson package. +// EmptyInterfaceDecoder available in the bson package. func (dvd DefaultValueDecoders) RegisterDefaultDecoders(rb *RegistryBuilder) { if rb == nil { panic(errors.New("argument to RegisterDefaultDecoders must not be nil")) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_reader.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_reader.go index b83012b2..35832d73 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_reader.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_reader.go @@ -164,6 +164,23 @@ func (ejvr *extJSONValueReader) skipObject() { depth := 1 for depth > 0 { ejvr.p.advanceState() + + // If object is empty, raise depth and continue. When emptyObject is true, the + // parser has already read both the opening and closing brackets of an empty + // object ("{}"), so the next valid token will be part of the parent document, + // not part of the nested document. + // + // If there is a comma, there are remaining fields, emptyObject must be set back + // to false, and comma must be skipped with advanceState(). + if ejvr.p.emptyObject { + if ejvr.p.s == jpsSawComma { + ejvr.p.emptyObject = false + ejvr.p.advanceState() + } + depth-- + continue + } + switch ejvr.p.s { case jpsSawBeginObject, jpsSawBeginArray: depth++ diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_wrappers.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_wrappers.go index 7bcf6621..3af6fcf0 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_wrappers.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_wrappers.go @@ -46,12 +46,6 @@ func wrapperKeyBSONType(key string) bsontype.Type { return bsontype.DBPointer case "$date": return bsontype.DateTime - case "$ref": - fallthrough - case "$id": - fallthrough - case "$db": - return bsontype.EmbeddedDocument // dbrefs aren't bson types case "$minKey": return bsontype.MinKey case "$maxKey": diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/value_writer.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/value_writer.go index 7b7d7ad3..a39c4ea4 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/value_writer.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/value_writer.go @@ -47,11 +47,9 @@ func NewBSONValueWriterPool() *BSONValueWriterPool { // Get retrieves a BSON ValueWriter from the pool and resets it to use w as the destination. func (bvwp *BSONValueWriterPool) Get(w io.Writer) ValueWriter { vw := bvwp.pool.Get().(*valueWriter) - if writer, ok := w.(*SliceWriter); ok { - vw.reset(*writer) - vw.w = writer - return vw - } + + // TODO: Having to call reset here with the same buffer doesn't really make sense. + vw.reset(vw.buf) vw.buf = vw.buf[:0] vw.w = w return vw @@ -72,11 +70,6 @@ func (bvwp *BSONValueWriterPool) Put(vw ValueWriter) (ok bool) { return false } - if _, ok := bvw.w.(*SliceWriter); ok { - bvw.buf = nil - } - bvw.w = nil - bvwp.pool.Put(bvw) return true } @@ -549,10 +542,6 @@ func (vw *valueWriter) Flush() error { return nil } - if sw, ok := vw.w.(*SliceWriter); ok { - *sw = vw.buf - return nil - } if _, err := vw.w.Write(vw.buf); err != nil { return err } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/doc.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/doc.go index 07ba9d8f..094be934 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/doc.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/doc.go @@ -80,7 +80,7 @@ // 1. Only exported fields in structs will be marshalled or unmarshalled. // // 2. When marshalling a struct, each field will be lowercased to generate the key for the corresponding BSON element. -// For example, a struct field named "Foo" will generate key "foo". This can be overriden via a struct tag (e.g. +// For example, a struct field named "Foo" will generate key "foo". This can be overridden via a struct tag (e.g. // `bson:"fooField"` to generate key "fooField" instead). // // 3. An embedded struct field is marshalled as a subdocument. The key will be the lowercased name of the field's type. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/marshal.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/marshal.go index 381822af..8d8fc8ce 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/marshal.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/marshal.go @@ -52,14 +52,14 @@ func MarshalAppend(dst []byte, val interface{}) ([]byte, error) { // MarshalWithRegistry returns the BSON encoding of val as a BSON document. If val is not a type that can be transformed // into a document, MarshalValueWithRegistry should be used instead. func MarshalWithRegistry(r *bsoncodec.Registry, val interface{}) ([]byte, error) { - dst := make([]byte, 0, 256) // TODO: make the default cap a constant + dst := make([]byte, 0) return MarshalAppendWithRegistry(r, dst, val) } // MarshalWithContext returns the BSON encoding of val as a BSON document using EncodeContext ec. If val is not a type // that can be transformed into a document, MarshalValueWithContext should be used instead. func MarshalWithContext(ec bsoncodec.EncodeContext, val interface{}) ([]byte, error) { - dst := make([]byte, 0, 256) // TODO: make the default cap a constant + dst := make([]byte, 0) return MarshalAppendWithContext(ec, dst, val) } @@ -115,13 +115,13 @@ func MarshalValueAppend(dst []byte, val interface{}) (bsontype.Type, []byte, err // MarshalValueWithRegistry returns the BSON encoding of val using Registry r. func MarshalValueWithRegistry(r *bsoncodec.Registry, val interface{}) (bsontype.Type, []byte, error) { - dst := make([]byte, 0, defaultDstCap) + dst := make([]byte, 0) return MarshalValueAppendWithRegistry(r, dst, val) } // MarshalValueWithContext returns the BSON encoding of val using EncodeContext ec. func MarshalValueWithContext(ec bsoncodec.EncodeContext, val interface{}) (bsontype.Type, []byte, error) { - dst := make([]byte, 0, defaultDstCap) + dst := make([]byte, 0) return MarshalValueAppendWithContext(ec, dst, val) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/objectid.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/objectid.go index 30aaafe6..a5a7d7c6 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/objectid.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/objectid.go @@ -73,15 +73,15 @@ func (id ObjectID) IsZero() bool { // ObjectIDFromHex creates a new ObjectID from a hex string. It returns an error if the hex string is not a // valid ObjectID. func ObjectIDFromHex(s string) (ObjectID, error) { + if len(s) != 24 { + return NilObjectID, ErrInvalidHex + } + b, err := hex.DecodeString(s) if err != nil { return NilObjectID, err } - if len(b) != 12 { - return NilObjectID, ErrInvalidHex - } - var oid [12]byte copy(oid[:], b[:]) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go index 5420496b..51984e22 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go @@ -4,7 +4,7 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Package primitive contains types similar to Go primitives for BSON types can do not have direct +// Package primitive contains types similar to Go primitives for BSON types that do not have direct // Go primitive representations. package primitive // import "go.mongodb.org/mongo-driver/bson/primitive" @@ -21,7 +21,7 @@ type Binary struct { Data []byte } -// Equal compares bp to bp2 and returns true is the are equal. +// Equal compares bp to bp2 and returns true if they are equal. func (bp Binary) Equal(bp2 Binary) bool { if bp.Subtype != bp2.Subtype { return false @@ -29,7 +29,7 @@ func (bp Binary) Equal(bp2 Binary) bool { return bytes.Equal(bp.Data, bp2.Data) } -// IsZero returns if bp is the empty Binary +// IsZero returns if bp is the empty Binary. func (bp Binary) IsZero() bool { return bp.Subtype == 0 && len(bp.Data) == 0 } @@ -43,7 +43,7 @@ type DateTime int64 var _ json.Marshaler = DateTime(0) var _ json.Unmarshaler = (*DateTime)(nil) -// MarshalJSON marshal to time type +// MarshalJSON marshal to time type. func (d DateTime) MarshalJSON() ([]byte, error) { return json.Marshal(d.Time()) } @@ -89,12 +89,12 @@ func (rp Regex) String() string { return fmt.Sprintf(`{"pattern": "%s", "options": "%s"}`, rp.Pattern, rp.Options) } -// Equal compares rp to rp2 and returns true is the are equal. +// Equal compares rp to rp2 and returns true if they are equal. func (rp Regex) Equal(rp2 Regex) bool { return rp.Pattern == rp2.Pattern && rp.Options == rp2.Options } -// IsZero returns if rp is the empty Regex +// IsZero returns if rp is the empty Regex. func (rp Regex) IsZero() bool { return rp.Pattern == "" && rp.Options == "" } @@ -109,12 +109,12 @@ func (d DBPointer) String() string { return fmt.Sprintf(`{"db": "%s", "pointer": "%s"}`, d.DB, d.Pointer) } -// Equal compares d to d2 and returns true is the are equal. +// Equal compares d to d2 and returns true if they are equal. func (d DBPointer) Equal(d2 DBPointer) bool { return d.DB == d2.DB && bytes.Equal(d.Pointer[:], d2.Pointer[:]) } -// IsZero returns if d is the empty DBPointer +// IsZero returns if d is the empty DBPointer. func (d DBPointer) IsZero() bool { return d.DB == "" && d.Pointer.IsZero() } @@ -141,12 +141,12 @@ type Timestamp struct { I uint32 } -// Equal compares tp to tp2 and returns true is the are equal. +// Equal compares tp to tp2 and returns true if they are equal. func (tp Timestamp) Equal(tp2 Timestamp) bool { return tp.T == tp2.T && tp.I == tp2.I } -// IsZero returns if tp is the zero Timestamp +// IsZero returns if tp is the zero Timestamp. func (tp Timestamp) IsZero() bool { return tp.T == 0 && tp.I == 0 } @@ -206,7 +206,7 @@ type E struct { // // Example usage: // -// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159}. +// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} type M map[string]interface{} // An A is an ordered representation of a BSON array. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/event/monitoring.go b/backend/vendor/go.mongodb.org/mongo-driver/event/monitoring.go index be891fbf..bc802f0f 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/event/monitoring.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/event/monitoring.go @@ -22,6 +22,9 @@ type CommandStartedEvent struct { CommandName string RequestID int64 ConnectionID string + // ServiceID contains the ID of the server to which the command was sent if it is running behind a load balancer. + // Otherwise, it is unset. + ServiceID *primitive.ObjectID } // CommandFinishedEvent represents a generic command finishing. @@ -30,6 +33,9 @@ type CommandFinishedEvent struct { CommandName string RequestID int64 ConnectionID string + // ServiceID contains the ID of the server to which the command was sent if it is running behind a load balancer. + // Otherwise, it is unset. + ServiceID *primitive.ObjectID } // CommandSucceededEvent represents an event generated when a command's execution succeeds. @@ -87,6 +93,9 @@ type PoolEvent struct { ConnectionID uint64 `json:"connectionId"` PoolOptions *MonitorPoolOptions `json:"options"` Reason string `json:"reason"` + // ServiceID is only set if the Type is PoolCleared and the server is deployed behind a load balancer. This field + // can be used to distinguish between individual servers in a load balanced deployment. + ServiceID *primitive.ObjectID `json:"serviceId"` } // PoolMonitor is a function that allows the user to gain access to events occurring in the pool diff --git a/backend/vendor/go.mongodb.org/mongo-driver/internal/const.go b/backend/vendor/go.mongodb.org/mongo-driver/internal/const.go index 11354c4f..772053ad 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/internal/const.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/internal/const.go @@ -8,3 +8,8 @@ package internal // import "go.mongodb.org/mongo-driver/internal" // Version is the current version of the driver. var Version = "local build" + +// SetMockServiceID enables a mode in which the driver mocks server support for returning a "serviceId" field in "hello" +// command responses by using the value of "topologyVersion.processId". This is used for testing load balancer support +// until an upstream service can support running behind a load balancer. +var SetMockServiceID = false diff --git a/backend/vendor/go.mongodb.org/mongo-driver/internal/uri_validation_errors.go b/backend/vendor/go.mongodb.org/mongo-driver/internal/uri_validation_errors.go new file mode 100644 index 00000000..8d1fcdc7 --- /dev/null +++ b/backend/vendor/go.mongodb.org/mongo-driver/internal/uri_validation_errors.go @@ -0,0 +1,18 @@ +// Copyright (C) MongoDB, Inc. 2017-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + +package internal + +import "errors" + +var ( + // ErrLoadBalancedWithMultipleHosts is returned when loadBalanced=true is specified in a URI with multiple hosts. + ErrLoadBalancedWithMultipleHosts = errors.New("loadBalanced cannot be set to true if multiple hosts are specified") + // ErrLoadBalancedWithReplicaSet is returned when loadBalanced=true is specified in a URI with the replicaSet option. + ErrLoadBalancedWithReplicaSet = errors.New("loadBalanced cannot be set to true if a replica set name is specified") + // ErrLoadBalancedWithDirectConnection is returned when loadBalanced=true is specified in a URI with the directConnection option. + ErrLoadBalancedWithDirectConnection = errors.New("loadBalanced cannot be set to true if the direct connection option is specified") +) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/bulk_write.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/bulk_write.go index 532f544e..56736a23 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/bulk_write.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/bulk_write.go @@ -168,7 +168,7 @@ func (bw *bulkWrite) runInsert(ctx context.Context, batch bulkWriteBatch) (opera var i int for _, model := range batch.models { converted := model.(*InsertOneModel) - doc, _, err := transformAndEnsureIDv2(bw.collection.registry, converted.Document) + doc, _, err := transformAndEnsureID(bw.collection.registry, converted.Document) if err != nil { return operation.InsertResult{}, err } @@ -181,7 +181,8 @@ func (bw *bulkWrite) runInsert(ctx context.Context, batch bulkWriteBatch) (opera Session(bw.session).WriteConcern(bw.writeConcern).CommandMonitor(bw.collection.client.monitor). ServerSelector(bw.selector).ClusterClock(bw.collection.client.clock). Database(bw.collection.db.name).Collection(bw.collection.name). - Deployment(bw.collection.client.deployment).Crypt(bw.collection.client.cryptFLE) + Deployment(bw.collection.client.deployment).Crypt(bw.collection.client.cryptFLE). + ServerAPI(bw.collection.client.serverAPI) if bw.bypassDocumentValidation != nil && *bw.bypassDocumentValidation { op = op.BypassDocumentValidation(*bw.bypassDocumentValidation) } @@ -230,7 +231,8 @@ func (bw *bulkWrite) runDelete(ctx context.Context, batch bulkWriteBatch) (opera Session(bw.session).WriteConcern(bw.writeConcern).CommandMonitor(bw.collection.client.monitor). ServerSelector(bw.selector).ClusterClock(bw.collection.client.clock). Database(bw.collection.db.name).Collection(bw.collection.name). - Deployment(bw.collection.client.deployment).Crypt(bw.collection.client.cryptFLE).Hint(hasHint) + Deployment(bw.collection.client.deployment).Crypt(bw.collection.client.cryptFLE).Hint(hasHint). + ServerAPI(bw.collection.client.serverAPI) if bw.ordered != nil { op = op.Ordered(*bw.ordered) } @@ -311,7 +313,7 @@ func (bw *bulkWrite) runUpdate(ctx context.Context, batch bulkWriteBatch) (opera ServerSelector(bw.selector).ClusterClock(bw.collection.client.clock). Database(bw.collection.db.name).Collection(bw.collection.name). Deployment(bw.collection.client.deployment).Crypt(bw.collection.client.cryptFLE).Hint(hasHint). - ArrayFilters(hasArrayFilters) + ArrayFilters(hasArrayFilters).ServerAPI(bw.collection.client.serverAPI) if bw.ordered != nil { op = op.Ordered(*bw.ordered) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go index 37d72862..f05dc8cb 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go @@ -61,7 +61,8 @@ var ( ) // ChangeStream is used to iterate over a stream of events. Each event can be decoded into a Go type via the Decode -// method or accessed as raw BSON via the Current field. For more information about change streams, see +// method or accessed as raw BSON via the Current field. This type is not goroutine safe and must not be used +// concurrently by multiple goroutines. For more information about change streams, see // https://docs.mongodb.com/manual/changeStreams/. type ChangeStream struct { // Current is the BSON bytes of the current event. This property is only valid until the next call to Next or @@ -127,7 +128,7 @@ func newChangeStream(ctx context.Context, config changeStreamConfig, pipeline in ReadPreference(config.readPreference).ReadConcern(config.readConcern). Deployment(cs.client.deployment).ClusterClock(cs.client.clock). CommandMonitor(cs.client.monitor).Session(cs.sess).ServerSelector(cs.selector).Retry(driver.RetryNone). - Crypt(config.crypt) + ServerAPI(cs.client.serverAPI).Crypt(config.crypt) if cs.options.Collation != nil { cs.aggregate.Collation(bsoncore.Document(cs.options.Collation.ToDocument())) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/client.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/client.go index fcf62719..4f429207 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/client.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/client.go @@ -63,6 +63,7 @@ type Client struct { registry *bsoncodec.Registry marshaller BSONAppender monitor *event.CommandMonitor + serverAPI *driver.ServerAPIOptions serverMonitor *event.ServerMonitor sessionPool *session.Pool @@ -242,7 +243,7 @@ func (c *Client) Disconnect(ctx context.Context) error { // Ping sends a ping command to verify that the client can connect to the deployment. // -// The rp paramter is used to determine which server is selected for the operation. +// The rp parameter is used to determine which server is selected for the operation. // If it is nil, the client's read preference is used. // // If the server is down, Ping will try to select a server until the client's server selection timeout expires. @@ -270,6 +271,9 @@ func (c *Client) Ping(ctx context.Context, rp *readpref.ReadPref) error { // StartSession starts a new session configured with the given options. // +// StartSession does not actually communicate with the server and will not error if the client is +// disconnected. +// // If the DefaultReadConcern, DefaultWriteConcern, or DefaultReadPreference options are not set, the client's read // concern, write concern, or read preference will be used, respectively. func (c *Client) StartSession(opts ...*options.SessionOptions) (Session, error) { @@ -298,6 +302,9 @@ func (c *Client) StartSession(opts ...*options.SessionOptions) (Session, error) if sopts.DefaultMaxCommitTime != nil { coreOpts.DefaultMaxCommitTime = sopts.DefaultMaxCommitTime } + if sopts.Snapshot != nil { + coreOpts.Snapshot = sopts.Snapshot + } sess, err := session.NewClientSession(c.sessionPool, c.id, session.Explicit, coreOpts) if err != nil { @@ -323,7 +330,7 @@ func (c *Client) endSessions(ctx context.Context) { sessionIDs := c.sessionPool.IDSlice() op := operation.NewEndSessions(nil).ClusterClock(c.clock).Deployment(c.deployment). ServerSelector(description.ReadPrefSelector(readpref.PrimaryPreferred())).CommandMonitor(c.monitor). - Database("admin").Crypt(c.cryptFLE) + Database("admin").Crypt(c.cryptFLE).ServerAPI(c.serverAPI) totalNumIDs := len(sessionIDs) var currentBatch []bsoncore.Document @@ -354,6 +361,17 @@ func (c *Client) configure(opts *options.ClientOptions) error { // TODO(GODRIVER-814): Add tests for topology, server, and connection related options. + // ServerAPIOptions need to be handled early as other client and server options below reference + // c.serverAPI and serverOpts.serverAPI. + if opts.ServerAPIOptions != nil { + // convert passed in options to driver form for client. + c.serverAPI = convertToDriverAPIOptions(opts.ServerAPIOptions) + + serverOpts = append(serverOpts, topology.WithServerAPI(func(*driver.ServerAPIOptions) *driver.ServerAPIOptions { + return c.serverAPI + })) + } + // ClusterClock c.clock = new(session.ClusterClock) @@ -399,9 +417,16 @@ func (c *Client) configure(opts *options.ClientOptions) error { func(opts ...string) []string { return append(opts, comps...) }, )) } + + var loadBalanced bool + if opts.LoadBalanced != nil { + loadBalanced = *opts.LoadBalanced + } + // Handshaker var handshaker = func(driver.Handshaker) driver.Handshaker { - return operation.NewIsMaster().AppName(appName).Compressors(comps).ClusterClock(c.clock) + return operation.NewIsMaster().AppName(appName).Compressors(comps).ClusterClock(c.clock). + ServerAPI(c.serverAPI).LoadBalanced(loadBalanced) } // Auth & Database & Password & Username if opts.Auth != nil { @@ -433,6 +458,8 @@ func (c *Client) configure(opts *options.ClientOptions) error { Authenticator: authenticator, Compressors: comps, ClusterClock: c.clock, + ServerAPI: c.serverAPI, + LoadBalanced: loadBalanced, } if mechanism == "" { // Required for SASL mechanism negotiation during handshake @@ -615,6 +642,22 @@ func (c *Client) configure(opts *options.ClientOptions) error { ) } + // LoadBalanced + if opts.LoadBalanced != nil { + topologyOpts = append( + topologyOpts, + topology.WithLoadBalanced(func(bool) bool { return *opts.LoadBalanced }), + ) + serverOpts = append( + serverOpts, + topology.WithServerLoadBalanced(func(bool) bool { return *opts.LoadBalanced }), + ) + connOpts = append( + connOpts, + topology.WithConnectionLoadBalanced(func(bool) bool { return *opts.LoadBalanced }), + ) + } + serverOpts = append( serverOpts, topology.WithClock(func(*session.ClusterClock) *session.ClusterClock { return c.clock }), @@ -757,6 +800,18 @@ func (c *Client) validSession(sess *session.Client) error { return nil } +// convertToDriverAPIOptions converts a options.ServerAPIOptions instance to a driver.ServerAPIOptions. +func convertToDriverAPIOptions(s *options.ServerAPIOptions) *driver.ServerAPIOptions { + driverOpts := driver.NewServerAPIOptions(string(s.ServerAPIVersion)) + if s.Strict != nil { + driverOpts.SetStrict(*s.Strict) + } + if s.DeprecationErrors != nil { + driverOpts.SetDeprecationErrors(*s.DeprecationErrors) + } + return driverOpts +} + // Database returns a handle for a database with the given name configured with the given DatabaseOptions. func (c *Client) Database(name string, opts ...*options.DatabaseOptions) *Database { return newDatabase(c, name, opts...) @@ -806,7 +861,8 @@ func (c *Client) ListDatabases(ctx context.Context, filter interface{}, opts ... ldo := options.MergeListDatabasesOptions(opts...) op := operation.NewListDatabases(filterDoc). Session(sess).ReadPreference(c.readPreference).CommandMonitor(c.monitor). - ServerSelector(selector).ClusterClock(c.clock).Database("admin").Deployment(c.deployment).Crypt(c.cryptFLE) + ServerSelector(selector).ClusterClock(c.clock).Database("admin").Deployment(c.deployment).Crypt(c.cryptFLE). + ServerAPI(c.serverAPI) if ldo.NameOnly != nil { op = op.NameOnly(*ldo.NameOnly) @@ -931,5 +987,6 @@ func (c *Client) createBaseCursorOptions() driver.CursorOptions { return driver.CursorOptions{ CommandMonitor: c.monitor, Crypt: c.cryptFLE, + ServerAPI: c.serverAPI, } } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/collection.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/collection.go index 246880cf..02e197d5 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/collection.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/collection.go @@ -244,7 +244,7 @@ func (coll *Collection) insert(ctx context.Context, documents []interface{}, for i, doc := range documents { var err error - docs[i], result[i], err = transformAndEnsureIDv2(coll.registry, doc) + docs[i], result[i], err = transformAndEnsureID(coll.registry, doc) if err != nil { return nil, err } @@ -279,7 +279,8 @@ func (coll *Collection) insert(ctx context.Context, documents []interface{}, Session(sess).WriteConcern(wc).CommandMonitor(coll.client.monitor). ServerSelector(selector).ClusterClock(coll.client.clock). Database(coll.db.name).Collection(coll.name). - Deployment(coll.client.deployment).Crypt(coll.client.cryptFLE).Ordered(true) + Deployment(coll.client.deployment).Crypt(coll.client.cryptFLE).Ordered(true). + ServerAPI(coll.client.serverAPI) imo := options.MergeInsertManyOptions(opts...) if imo.BypassDocumentValidation != nil && *imo.BypassDocumentValidation { op = op.BypassDocumentValidation(*imo.BypassDocumentValidation) @@ -347,7 +348,7 @@ func (coll *Collection) InsertOne(ctx context.Context, document interface{}, // The documents parameter must be a slice of documents to insert. The slice cannot be nil or empty. The elements must // all be non-nil. For any document that does not have an _id field when transformed into BSON, one will be added // automatically to the marshalled document. The original document will not be modified. The _id values for the inserted -// documents can be retrieved from the InsertedIDs field of the returnd InsertManyResult. +// documents can be retrieved from the InsertedIDs field of the returned InsertManyResult. // // The opts parameter can be used to specify options for the operation (see the options.InsertManyOptions documentation.) // @@ -375,12 +376,8 @@ func (coll *Collection) InsertMany(ctx context.Context, documents []interface{}, bwErrors := make([]BulkWriteError, 0, len(writeException.WriteErrors)) for _, we := range writeException.WriteErrors { bwErrors = append(bwErrors, BulkWriteError{ - WriteError{ - Index: we.Index, - Code: we.Code, - Message: we.Message, - }, - nil, + WriteError: we, + Request: nil, }) } @@ -452,7 +449,8 @@ func (coll *Collection) delete(ctx context.Context, filter interface{}, deleteOn Session(sess).WriteConcern(wc).CommandMonitor(coll.client.monitor). ServerSelector(selector).ClusterClock(coll.client.clock). Database(coll.db.name).Collection(coll.name). - Deployment(coll.client.deployment).Crypt(coll.client.cryptFLE).Ordered(true) + Deployment(coll.client.deployment).Crypt(coll.client.cryptFLE).Ordered(true). + ServerAPI(coll.client.serverAPI) if do.Hint != nil { op = op.Hint(true) } @@ -549,7 +547,7 @@ func (coll *Collection) updateOrReplace(ctx context.Context, filter bsoncore.Doc ServerSelector(selector).ClusterClock(coll.client.clock). Database(coll.db.name).Collection(coll.name). Deployment(coll.client.deployment).Crypt(coll.client.cryptFLE).Hint(uo.Hint != nil). - ArrayFilters(uo.ArrayFilters != nil).Ordered(true) + ArrayFilters(uo.ArrayFilters != nil).Ordered(true).ServerAPI(coll.client.serverAPI) if uo.BypassDocumentValidation != nil && *uo.BypassDocumentValidation { op = op.BypassDocumentValidation(*uo.BypassDocumentValidation) @@ -744,7 +742,7 @@ func aggregate(a aggregateParams) (*Cursor, error) { a.ctx = context.Background() } - pipelineArr, hasOutputStage, err := transformAggregatePipelinev2(a.registry, a.pipeline) + pipelineArr, hasOutputStage, err := transformAggregatePipeline(a.registry, a.pipeline) if err != nil { return nil, err } @@ -792,7 +790,8 @@ func aggregate(a aggregateParams) (*Cursor, error) { Database(a.db). Collection(a.col). Deployment(a.client.deployment). - Crypt(a.client.cryptFLE) + Crypt(a.client.cryptFLE). + ServerAPI(a.client.serverAPI) if !hasOutputStage { // Only pass the user-specified read preference if the aggregation doesn't have a $out or $merge stage. // Otherwise, the read preference could be forwarded to a mongos, which would error if the aggregation were @@ -831,6 +830,14 @@ func aggregate(a aggregateParams) (*Cursor, error) { } op.Hint(hintVal) } + if ao.Let != nil { + let, err := transformBsoncoreDocument(a.registry, ao.Let, true, "let") + if err != nil { + closeImplicitSession(sess) + return nil, err + } + op.Let(let) + } retry := driver.RetryNone if a.retryRead && !hasOutputStage { @@ -898,7 +905,7 @@ func (coll *Collection) CountDocuments(ctx context.Context, filter interface{}, selector := makeReadPrefSelector(sess, coll.readSelector, coll.client.localThreshold) op := operation.NewAggregate(pipelineArr).Session(sess).ReadConcern(rc).ReadPreference(coll.readPreference). CommandMonitor(coll.client.monitor).ServerSelector(selector).ClusterClock(coll.client.clock).Database(coll.db.name). - Collection(coll.name).Deployment(coll.client.deployment).Crypt(coll.client.cryptFLE) + Collection(coll.name).Deployment(coll.client.deployment).Crypt(coll.client.cryptFLE).ServerAPI(coll.client.serverAPI) if countOpts.Collation != nil { op.Collation(bsoncore.Document(countOpts.Collation.ToDocument())) } @@ -980,7 +987,7 @@ func (coll *Collection) EstimatedDocumentCount(ctx context.Context, op := operation.NewCount().Session(sess).ClusterClock(coll.client.clock). Database(coll.db.name).Collection(coll.name).CommandMonitor(coll.client.monitor). Deployment(coll.client.deployment).ReadConcern(rc).ReadPreference(coll.readPreference). - ServerSelector(selector).Crypt(coll.client.cryptFLE) + ServerSelector(selector).Crypt(coll.client.cryptFLE).ServerAPI(coll.client.serverAPI) co := options.MergeEstimatedDocumentCountOptions(opts...) if co.MaxTime != nil { @@ -1046,7 +1053,7 @@ func (coll *Collection) Distinct(ctx context.Context, fieldName string, filter i Session(sess).ClusterClock(coll.client.clock). Database(coll.db.name).Collection(coll.name).CommandMonitor(coll.client.monitor). Deployment(coll.client.deployment).ReadConcern(rc).ReadPreference(coll.readPreference). - ServerSelector(selector).Crypt(coll.client.cryptFLE) + ServerSelector(selector).Crypt(coll.client.cryptFLE).ServerAPI(coll.client.serverAPI) if option.Collation != nil { op.Collation(bsoncore.Document(option.Collation.ToDocument())) @@ -1133,7 +1140,7 @@ func (coll *Collection) Find(ctx context.Context, filter interface{}, Session(sess).ReadConcern(rc).ReadPreference(coll.readPreference). CommandMonitor(coll.client.monitor).ServerSelector(selector). ClusterClock(coll.client.clock).Database(coll.db.name).Collection(coll.name). - Deployment(coll.client.deployment).Crypt(coll.client.cryptFLE) + Deployment(coll.client.deployment).Crypt(coll.client.cryptFLE).ServerAPI(coll.client.serverAPI) fo := options.MergeFindOptions(opts...) cursorOpts := coll.client.createBaseCursorOptions() @@ -1375,7 +1382,7 @@ func (coll *Collection) FindOneAndDelete(ctx context.Context, filter interface{} return &SingleResult{err: err} } fod := options.MergeFindOneAndDeleteOptions(opts...) - op := operation.NewFindAndModify(f).Remove(true) + op := operation.NewFindAndModify(f).Remove(true).ServerAPI(coll.client.serverAPI) if fod.Collation != nil { op = op.Collation(bsoncore.Document(fod.Collation.ToDocument())) } @@ -1437,7 +1444,8 @@ func (coll *Collection) FindOneAndReplace(ctx context.Context, filter interface{ } fo := options.MergeFindOneAndReplaceOptions(opts...) - op := operation.NewFindAndModify(f).Update(bsoncore.Value{Type: bsontype.EmbeddedDocument, Data: r}) + op := operation.NewFindAndModify(f).Update(bsoncore.Value{Type: bsontype.EmbeddedDocument, Data: r}). + ServerAPI(coll.client.serverAPI) if fo.BypassDocumentValidation != nil && *fo.BypassDocumentValidation { op = op.BypassDocumentValidation(*fo.BypassDocumentValidation) } @@ -1506,7 +1514,7 @@ func (coll *Collection) FindOneAndUpdate(ctx context.Context, filter interface{} } fo := options.MergeFindOneAndUpdateOptions(opts...) - op := operation.NewFindAndModify(f) + op := operation.NewFindAndModify(f).ServerAPI(coll.client.serverAPI) u, err := transformUpdateValue(coll.registry, update, true) if err != nil { @@ -1631,7 +1639,8 @@ func (coll *Collection) Drop(ctx context.Context) error { Session(sess).WriteConcern(wc).CommandMonitor(coll.client.monitor). ServerSelector(selector).ClusterClock(coll.client.clock). Database(coll.db.name).Collection(coll.name). - Deployment(coll.client.deployment).Crypt(coll.client.cryptFLE) + Deployment(coll.client.deployment).Crypt(coll.client.cryptFLE). + ServerAPI(coll.client.serverAPI) err = op.Execute(ctx) // ignore namespace not found erorrs diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/cursor.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/cursor.go index 9958a80d..3ec03baf 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/cursor.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/cursor.go @@ -21,7 +21,8 @@ import ( ) // Cursor is used to iterate over a stream of documents. Each document can be decoded into a Go type via the Decode -// method or accessed as raw BSON via the Current field. +// method or accessed as raw BSON via the Current field. This type is not goroutine safe and must not be used +// concurrently by multiple goroutines. type Cursor struct { // Current contains the BSON bytes of the current change document. This property is only valid until the next call // to Next or TryNext. If continued access is required, a copy must be made. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/database.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/database.go index 2974cd3d..20787334 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/database.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/database.go @@ -133,7 +133,7 @@ func (db *Database) Aggregate(ctx context.Context, pipeline interface{}, } func (db *Database) processRunCommand(ctx context.Context, cmd interface{}, - opts ...*options.RunCmdOptions) (*operation.Command, *session.Client, error) { + cursorCommand bool, opts ...*options.RunCmdOptions) (*operation.Command, *session.Client, error) { sess := sessionFromContext(ctx) if sess == nil && db.client.sessionPool != nil { var err error @@ -165,11 +165,18 @@ func (db *Database) processRunCommand(ctx context.Context, cmd interface{}, readSelect = makePinnedSelector(sess, readSelect) } - return operation.NewCommand(runCmdDoc). - Session(sess).CommandMonitor(db.client.monitor). + var op *operation.Command + switch cursorCommand { + case true: + cursorOpts := db.client.createBaseCursorOptions() + op = operation.NewCursorCommand(runCmdDoc, cursorOpts) + default: + op = operation.NewCommand(runCmdDoc) + } + return op.Session(sess).CommandMonitor(db.client.monitor). ServerSelector(readSelect).ClusterClock(db.client.clock). Database(db.name).Deployment(db.client.deployment).ReadConcern(db.readConcern). - Crypt(db.client.cryptFLE).ReadPreference(ro.ReadPreference), sess, nil + Crypt(db.client.cryptFLE).ReadPreference(ro.ReadPreference).ServerAPI(db.client.serverAPI), sess, nil } // RunCommand executes the given command against the database. This function does not obey the Database's read @@ -178,6 +185,8 @@ func (db *Database) processRunCommand(ctx context.Context, cmd interface{}, // The runCommand parameter must be a document for the command to be executed. It cannot be nil. // This must be an order-preserving type such as bson.D. Map types such as bson.M are not valid. // If the command document contains a session ID or any transaction-specific fields, the behavior is undefined. +// Specifying API versioning options in the command document and declaring an API version on the client is not supported. +// The behavior of RunCommand is undefined in this case. // // The opts parameter can be used to specify options for this operation (see the options.RunCmdOptions documentation). func (db *Database) RunCommand(ctx context.Context, runCommand interface{}, opts ...*options.RunCmdOptions) *SingleResult { @@ -185,7 +194,7 @@ func (db *Database) RunCommand(ctx context.Context, runCommand interface{}, opts ctx = context.Background() } - op, sess, err := db.processRunCommand(ctx, runCommand, opts...) + op, sess, err := db.processRunCommand(ctx, runCommand, false, opts...) defer closeImplicitSession(sess) if err != nil { return &SingleResult{err: err} @@ -216,7 +225,7 @@ func (db *Database) RunCommandCursor(ctx context.Context, runCommand interface{} ctx = context.Background() } - op, sess, err := db.processRunCommand(ctx, runCommand, opts...) + op, sess, err := db.processRunCommand(ctx, runCommand, true, opts...) if err != nil { closeImplicitSession(sess) return nil, replaceErrors(err) @@ -227,7 +236,7 @@ func (db *Database) RunCommandCursor(ctx context.Context, runCommand interface{} return nil, replaceErrors(err) } - bc, err := op.ResultCursor(db.client.createBaseCursorOptions()) + bc, err := op.ResultCursor() if err != nil { closeImplicitSession(sess) return nil, replaceErrors(err) @@ -271,7 +280,8 @@ func (db *Database) Drop(ctx context.Context) error { op := operation.NewDropDatabase(). Session(sess).WriteConcern(wc).CommandMonitor(db.client.monitor). ServerSelector(selector).ClusterClock(db.client.clock). - Database(db.name).Deployment(db.client.deployment).Crypt(db.client.cryptFLE) + Database(db.name).Deployment(db.client.deployment).Crypt(db.client.cryptFLE). + ServerAPI(db.client.serverAPI) err = op.Execute(ctx) @@ -361,7 +371,8 @@ func (db *Database) ListCollections(ctx context.Context, filter interface{}, opt op := operation.NewListCollections(filterDoc). Session(sess).ReadPreference(db.readPreference).CommandMonitor(db.client.monitor). ServerSelector(selector).ClusterClock(db.client.clock). - Database(db.name).Deployment(db.client.deployment).Crypt(db.client.cryptFLE) + Database(db.name).Deployment(db.client.deployment).Crypt(db.client.cryptFLE). + ServerAPI(db.client.serverAPI) cursorOpts := db.client.createBaseCursorOptions() if lco.NameOnly != nil { @@ -488,9 +499,11 @@ func (db *Database) Watch(ctx context.Context, pipeline interface{}, // // The opts parameter can be used to specify options for the operation (see the options.CreateCollectionOptions // documentation). +// +// For more information about the command, see https://docs.mongodb.com/manual/reference/command/create/. func (db *Database) CreateCollection(ctx context.Context, name string, opts ...*options.CreateCollectionOptions) error { cco := options.MergeCreateCollectionOptions(opts...) - op := operation.NewCreate(name) + op := operation.NewCreate(name).ServerAPI(db.client.serverAPI) if cco.Capped != nil { op.Capped(*cco.Capped) @@ -541,6 +554,27 @@ func (db *Database) CreateCollection(ctx context.Context, name string, opts ...* } op.Validator(validator) } + if cco.ExpireAfterSeconds != nil { + op.ExpireAfterSeconds(*cco.ExpireAfterSeconds) + } + if cco.TimeSeriesOptions != nil { + idx, doc := bsoncore.AppendDocumentStart(nil) + doc = bsoncore.AppendStringElement(doc, "timeField", cco.TimeSeriesOptions.TimeField) + + if cco.TimeSeriesOptions.MetaField != nil { + doc = bsoncore.AppendStringElement(doc, "metaField", *cco.TimeSeriesOptions.MetaField) + } + if cco.TimeSeriesOptions.Granularity != nil { + doc = bsoncore.AppendStringElement(doc, "granularity", *cco.TimeSeriesOptions.Granularity) + } + + doc, err := bsoncore.AppendDocumentEnd(doc, idx) + if err != nil { + return err + } + + op.TimeSeries(doc) + } return db.executeCreateOperation(ctx, op) } @@ -561,14 +595,15 @@ func (db *Database) CreateCollection(ctx context.Context, name string, opts ...* func (db *Database) CreateView(ctx context.Context, viewName, viewOn string, pipeline interface{}, opts ...*options.CreateViewOptions) error { - pipelineArray, _, err := transformAggregatePipelinev2(db.registry, pipeline) + pipelineArray, _, err := transformAggregatePipeline(db.registry, pipeline) if err != nil { return err } op := operation.NewCreate(viewName). ViewOn(viewOn). - Pipeline(pipelineArray) + Pipeline(pipelineArray). + ServerAPI(db.client.serverAPI) cvo := options.MergeCreateViewOptions(opts...) if cvo.Collation != nil { op.Collation(bsoncore.Document(cvo.Collation.ToDocument())) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server.go index 5034efd1..7de7df5e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server.go @@ -25,7 +25,9 @@ type SelectedServer struct { Kind TopologyKind } -// Server contains information about a node in a cluster. This is created from isMaster command responses. +// Server contains information about a node in a cluster. This is created from isMaster command responses. If the value +// of the Kind field is LoadBalancer, only the Addr and Kind fields will be set. All other fields will be set to the +// zero value of the field's type. type Server struct { Addr address.Address @@ -47,6 +49,7 @@ type Server struct { Passives []string Primary address.Address ReadOnly bool + ServiceID *primitive.ObjectID // Only set for servers that are deployed behind a load balancer. SessionTimeoutMinutes uint32 SetName string SetVersion uint32 @@ -65,7 +68,7 @@ func NewServer(addr address.Address, response bson.Raw) Server { return desc } var ok bool - var isReplicaSet, isMaster, hidden, secondary, arbiterOnly bool + var isReplicaSet, isWritablePrimary, hidden, secondary, arbiterOnly bool var msg string var version VersionRange for _, element := range elements { @@ -109,10 +112,16 @@ func NewServer(addr address.Address, response bson.Raw) Server { desc.LastError = err return desc } - case "ismaster": - isMaster, ok = element.Value().BooleanOK() + case "isWritablePrimary": + isWritablePrimary, ok = element.Value().BooleanOK() if !ok { - desc.LastError = fmt.Errorf("expected 'isMaster' to be a boolean but it's a BSON %s", element.Value().Type) + desc.LastError = fmt.Errorf("expected 'isWritablePrimary' to be a boolean but it's a BSON %s", element.Value().Type) + return desc + } + case "ismaster": + isWritablePrimary, ok = element.Value().BooleanOK() + if !ok { + desc.LastError = fmt.Errorf("expected 'ismaster' to be a boolean but it's a BSON %s", element.Value().Type) return desc } case "isreplicaset": @@ -225,6 +234,12 @@ func NewServer(addr address.Address, response bson.Raw) Server { desc.LastError = fmt.Errorf("expected 'secondary' to be a boolean but it's a BSON %s", element.Value().Type) return desc } + case "serviceId": + oid, ok := element.Value().ObjectIDOK() + if !ok { + desc.LastError = fmt.Errorf("expected 'serviceId' to be an ObjectId but it's a BSON %s", element.Value().Type) + } + desc.ServiceID = &oid case "setName": desc.SetName, ok = element.Value().StringValueOK() if !ok { @@ -257,6 +272,10 @@ func NewServer(addr address.Address, response bson.Raw) Server { desc.LastError = err return desc } + + if internal.SetMockServiceID { + desc.ServiceID = &desc.TopologyVersion.ProcessID + } } } @@ -277,7 +296,7 @@ func NewServer(addr address.Address, response bson.Raw) Server { if isReplicaSet { desc.Kind = RSGhost } else if desc.SetName != "" { - if isMaster { + if isWritablePrimary { desc.Kind = RSPrimary } else if hidden { desc.Kind = RSMember @@ -327,6 +346,11 @@ func (s Server) DataBearing() bool { s.Kind == Standalone } +// LoadBalanced returns true if the server is a load balancer or is behind a load balancer. +func (s Server) LoadBalanced() bool { + return s.Kind == LoadBalancer || s.ServiceID != nil +} + // String implements the Stringer interface func (s Server) String() string { str := fmt.Sprintf("Addr: %s, Type: %s", @@ -335,7 +359,9 @@ func (s Server) String() string { str += fmt.Sprintf(", Tag sets: %s", s.Tags) } - str += fmt.Sprintf(", Average RTT: %d", s.AverageRTT) + if s.AverageRTTSet { + str += fmt.Sprintf(", Average RTT: %d", s.AverageRTT) + } if s.LastError != nil { str += fmt.Sprintf(", Last error: %s", s.LastError) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_kind.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_kind.go index 933b38f7..b71d29d8 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_kind.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_kind.go @@ -11,13 +11,14 @@ type ServerKind uint32 // These constants are the possible types of servers. const ( - Standalone ServerKind = 1 - RSMember ServerKind = 2 - RSPrimary ServerKind = 4 + RSMember - RSSecondary ServerKind = 8 + RSMember - RSArbiter ServerKind = 16 + RSMember - RSGhost ServerKind = 32 + RSMember - Mongos ServerKind = 256 + Standalone ServerKind = 1 + RSMember ServerKind = 2 + RSPrimary ServerKind = 4 + RSMember + RSSecondary ServerKind = 8 + RSMember + RSArbiter ServerKind = 16 + RSMember + RSGhost ServerKind = 32 + RSMember + Mongos ServerKind = 256 + LoadBalancer ServerKind = 512 ) // String returns a stringified version of the kind or "Unknown" if the kind is invalid. @@ -37,6 +38,8 @@ func (kind ServerKind) String() string { return "RSGhost" case Mongos: return "Mongos" + case LoadBalancer: + return "LoadBalancer" } return "Unknown" diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_selector.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_selector.go index 81273e70..f0c728e4 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_selector.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_selector.go @@ -72,6 +72,10 @@ func (ls *latencySelector) SelectServer(t Topology, candidates []Server) ([]Serv if ls.latency < 0 { return candidates, nil } + if t.Kind == LoadBalanced { + // In LoadBalanced mode, there should only be one server in the topology and it must be selected. + return candidates, nil + } switch len(candidates) { case 0, 1: @@ -109,7 +113,7 @@ func (ls *latencySelector) SelectServer(t Topology, candidates []Server) ([]Serv func WriteSelector() ServerSelector { return ServerSelectorFunc(func(t Topology, candidates []Server) ([]Server, error) { switch t.Kind { - case Single: + case Single, LoadBalanced: return candidates, nil default: result := []Server{} @@ -127,6 +131,13 @@ func WriteSelector() ServerSelector { // ReadPrefSelector selects servers based on the provided read preference. func ReadPrefSelector(rp *readpref.ReadPref) ServerSelector { return ServerSelectorFunc(func(t Topology, candidates []Server) ([]Server, error) { + if t.Kind == LoadBalanced { + // In LoadBalanced mode, there should only be one server in the topology and it must be selected. We check + // this before checking MaxStaleness support becuase there's no monitoring in this mode, so the candidate + // server wouldn't have a wire version set, which would result in an error. + return candidates, nil + } + if _, set := rp.MaxStaleness(); set { for _, s := range candidates { if s.Kind != Unknown { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/topology_kind.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/topology_kind.go index 69f81773..6d60c4d8 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/topology_kind.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/topology_kind.go @@ -16,6 +16,7 @@ const ( ReplicaSetNoPrimary TopologyKind = 4 + ReplicaSet ReplicaSetWithPrimary TopologyKind = 8 + ReplicaSet Sharded TopologyKind = 256 + LoadBalanced TopologyKind = 512 ) // String implements the fmt.Stringer interface. @@ -31,6 +32,8 @@ func (kind TopologyKind) String() string { return "ReplicaSetWithPrimary" case Sharded: return "Sharded" + case LoadBalanced: + return "LoadBalanced" } return "Unknown" diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/errors.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/errors.go index 6123635f..2c3ae157 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/errors.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/errors.go @@ -275,31 +275,39 @@ type WriteError struct { Code int Message string + Details bson.Raw } -func (we WriteError) Error() string { return we.Message } +func (we WriteError) Error() string { + msg := we.Message + if len(we.Details) > 0 { + msg = fmt.Sprintf("%s: %s", msg, we.Details.String()) + } + return msg +} // WriteErrors is a group of write errors that occurred during execution of a write operation. type WriteErrors []WriteError // Error implements the error interface. func (we WriteErrors) Error() string { - var buf bytes.Buffer - fmt.Fprint(&buf, "write errors: [") - for idx, err := range we { - if idx != 0 { - fmt.Fprintf(&buf, ", ") - } - fmt.Fprintf(&buf, "{%s}", err) + errs := make([]error, len(we)) + for i := 0; i < len(we); i++ { + errs[i] = we[i] } - fmt.Fprint(&buf, "]") - return buf.String() + // WriteErrors isn't returned from batch operations, but we can still use the same formatter. + return "write errors: " + joinBatchErrors(errs) } func writeErrorsFromDriverWriteErrors(errs driver.WriteErrors) WriteErrors { wes := make(WriteErrors, 0, len(errs)) for _, err := range errs { - wes = append(wes, WriteError{Index: int(err.Index), Code: int(err.Code), Message: err.Message}) + wes = append(wes, WriteError{ + Index: int(err.Index), + Code: int(err.Code), + Message: err.Message, + Details: bson.Raw(err.Details), + }) } return wes } @@ -336,11 +344,21 @@ type WriteException struct { // Error implements the error interface. func (mwe WriteException) Error() string { - var buf bytes.Buffer - fmt.Fprint(&buf, "multiple write errors: [") - fmt.Fprintf(&buf, "{%s}, ", mwe.WriteErrors) - fmt.Fprintf(&buf, "{%s}]", mwe.WriteConcernError) - return buf.String() + causes := make([]string, 0, 2) + if mwe.WriteConcernError != nil { + causes = append(causes, "write concern error: "+mwe.WriteConcernError.Error()) + } + if len(mwe.WriteErrors) > 0 { + // The WriteErrors error message already starts with "write errors:", so don't add it to the + // error message again. + causes = append(causes, mwe.WriteErrors.Error()) + } + + message := "write exception: " + if len(causes) == 0 { + return message + "no causes" + } + return message + strings.Join(causes, ", ") } // HasErrorCode returns true if the error has the specified code. @@ -420,9 +438,7 @@ type BulkWriteError struct { // Error implements the error interface. func (bwe BulkWriteError) Error() string { - var buf bytes.Buffer - fmt.Fprintf(&buf, "{%s}", bwe.WriteError) - return buf.String() + return bwe.WriteError.Error() } // BulkWriteException is the error type returned by BulkWrite and InsertMany operations. @@ -439,11 +455,23 @@ type BulkWriteException struct { // Error implements the error interface. func (bwe BulkWriteException) Error() string { - var buf bytes.Buffer - fmt.Fprint(&buf, "bulk write error: [") - fmt.Fprintf(&buf, "{%s}, ", bwe.WriteErrors) - fmt.Fprintf(&buf, "{%s}]", bwe.WriteConcernError) - return buf.String() + causes := make([]string, 0, 2) + if bwe.WriteConcernError != nil { + causes = append(causes, "write concern error: "+bwe.WriteConcernError.Error()) + } + if len(bwe.WriteErrors) > 0 { + errs := make([]error, len(bwe.WriteErrors)) + for i := 0; i < len(bwe.WriteErrors); i++ { + errs[i] = &bwe.WriteErrors[i] + } + causes = append(causes, "write errors: "+joinBatchErrors(errs)) + } + + message := "bulk write exception: " + if len(causes) == 0 { + return message + "no causes" + } + return "bulk write exception: " + strings.Join(causes, ", ") } // HasErrorCode returns true if any of the errors have the specified code. @@ -539,3 +567,34 @@ func processWriteError(err error) (returnResult, error) { return rrAll, nil } } + +// batchErrorsTargetLength is the target length of error messages returned by batch operation +// error types. Try to limit batch error messages to 2kb to prevent problems when printing error +// messages from large batch operations. +const batchErrorsTargetLength = 2000 + +// joinBatchErrors appends messages from the given errors to a comma-separated string. If the +// string exceeds 2kb, it stops appending error messages and appends the message "+N more errors..." +// to the end. +// +// Example format: +// "[message 1, message 2, +8 more errors...]" +func joinBatchErrors(errs []error) string { + var buf bytes.Buffer + fmt.Fprint(&buf, "[") + for idx, err := range errs { + if idx != 0 { + fmt.Fprint(&buf, ", ") + } + // If the error message has exceeded the target error message length, stop appending errors + // to the message and append the number of remaining errors instead. + if buf.Len() > batchErrorsTargetLength { + fmt.Fprintf(&buf, "+%d more errors...", len(errs)-idx) + break + } + fmt.Fprint(&buf, err.Error()) + } + fmt.Fprint(&buf, "]") + + return buf.String() +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/index_view.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/index_view.go index e7def1eb..18fc5244 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/index_view.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/index_view.go @@ -95,7 +95,7 @@ func (iv IndexView) List(ctx context.Context, opts ...*options.ListIndexesOption Session(sess).CommandMonitor(iv.coll.client.monitor). ServerSelector(selector).ClusterClock(iv.coll.client.clock). Database(iv.coll.db.name).Collection(iv.coll.name). - Deployment(iv.coll.client.deployment) + Deployment(iv.coll.client.deployment).ServerAPI(iv.coll.client.serverAPI) cursorOpts := iv.coll.client.createBaseCursorOptions() lio := options.MergeListIndexesOptions(opts...) @@ -256,7 +256,7 @@ func (iv IndexView) CreateMany(ctx context.Context, models []IndexModel, opts .. op := operation.NewCreateIndexes(indexes). Session(sess).WriteConcern(wc).ClusterClock(iv.coll.client.clock). Database(iv.coll.db.name).Collection(iv.coll.name).CommandMonitor(iv.coll.client.monitor). - Deployment(iv.coll.client.deployment).ServerSelector(selector) + Deployment(iv.coll.client.deployment).ServerSelector(selector).ServerAPI(iv.coll.client.serverAPI) if option.MaxTime != nil { op.MaxTimeMS(int64(*option.MaxTime / time.Millisecond)) @@ -399,7 +399,7 @@ func (iv IndexView) drop(ctx context.Context, name string, opts ...*options.Drop Session(sess).WriteConcern(wc).CommandMonitor(iv.coll.client.monitor). ServerSelector(selector).ClusterClock(iv.coll.client.clock). Database(iv.coll.db.name).Collection(iv.coll.name). - Deployment(iv.coll.client.deployment) + Deployment(iv.coll.client.deployment).ServerAPI(iv.coll.client.serverAPI) if dio.MaxTime != nil { op.MaxTimeMS(int64(*dio.MaxTime / time.Millisecond)) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go index 09e2fa42..a0535877 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go @@ -72,70 +72,9 @@ func (me MarshalError) Error() string { // type Pipeline []bson.D -// transformAndEnsureID is a hack that makes it easy to get a RawValue as the _id value. This will -// be removed when we switch from using bsonx to bsoncore for the driver package. -func transformAndEnsureID(registry *bsoncodec.Registry, val interface{}) (bsonx.Doc, interface{}, error) { - // TODO: performance is going to be pretty bad for bsonx.Doc here since we turn it into a []byte - // only to turn it back into a bsonx.Doc. We can fix this post beta1 when we refactor the driver - // package to use bsoncore.Document instead of bsonx.Doc. - if registry == nil { - registry = bson.NewRegistryBuilder().Build() - } - switch tt := val.(type) { - case nil: - return nil, nil, ErrNilDocument - case bsonx.Doc: - val = tt.Copy() - case []byte: - // Slight optimization so we'll just use MarshalBSON and not go through the codec machinery. - val = bson.Raw(tt) - } - - // TODO(skriptble): Use a pool of these instead. - buf := make([]byte, 0, 256) - b, err := bson.MarshalAppendWithRegistry(registry, buf, val) - if err != nil { - return nil, nil, MarshalError{Value: val, Err: err} - } - - d, err := bsonx.ReadDoc(b) - if err != nil { - return nil, nil, err - } - - var id interface{} - - idx := d.IndexOf("_id") - var idElem bsonx.Elem - switch idx { - case -1: - idElem = bsonx.Elem{"_id", bsonx.ObjectID(primitive.NewObjectID())} - d = append(d, bsonx.Elem{}) - copy(d[1:], d) - d[0] = idElem - default: - idElem = d[idx] - copy(d[1:idx+1], d[0:idx]) - d[0] = idElem - } - - idBuf := make([]byte, 0, 256) - t, data, err := idElem.Value.MarshalAppendBSONValue(idBuf[:0]) - if err != nil { - return nil, nil, err - } - - err = bson.RawValue{Type: t, Value: data}.UnmarshalWithRegistry(registry, &id) - if err != nil { - return nil, nil, err - } - - return d, id, nil -} - -// transformAndEnsureIDv2 is a hack that makes it easy to get a RawValue as the _id value. This will -// be removed when we switch from using bsonx to bsoncore for the driver package. -func transformAndEnsureIDv2(registry *bsoncodec.Registry, val interface{}) (bsoncore.Document, interface{}, error) { +// transformAndEnsureID is a hack that makes it easy to get a RawValue as the _id value. +// It will also add an ObjectID _id as the first key if it not already present in the passed-in val. +func transformAndEnsureID(registry *bsoncodec.Registry, val interface{}) (bsoncore.Document, interface{}, error) { if registry == nil { registry = bson.NewRegistryBuilder().Build() } @@ -237,17 +176,7 @@ func ensureID(d bsonx.Doc) (bsonx.Doc, interface{}) { return d, id } -func ensureDollarKey(doc bsonx.Doc) error { - if len(doc) == 0 { - return errors.New("update document must have at least one element") - } - if !strings.HasPrefix(doc[0].Key, "$") { - return errors.New("update document must contain key beginning with '$'") - } - return nil -} - -func ensureDollarKeyv2(doc bsoncore.Document) error { +func ensureDollarKey(doc bsoncore.Document) error { firstElem, err := doc.IndexErr(0) if err != nil { return errors.New("update document must have at least one element") @@ -267,39 +196,7 @@ func ensureNoDollarKey(doc bsoncore.Document) error { return nil } -func transformAggregatePipeline(registry *bsoncodec.Registry, pipeline interface{}) (bsonx.Arr, error) { - pipelineArr := bsonx.Arr{} - switch t := pipeline.(type) { - case bsoncodec.ValueMarshaler: - btype, val, err := t.MarshalBSONValue() - if err != nil { - return nil, err - } - if btype != bsontype.Array { - return nil, fmt.Errorf("ValueMarshaler returned a %v, but was expecting %v", btype, bsontype.Array) - } - err = pipelineArr.UnmarshalBSONValue(btype, val) - if err != nil { - return nil, err - } - default: - val := reflect.ValueOf(t) - if !val.IsValid() || (val.Kind() != reflect.Slice && val.Kind() != reflect.Array) { - return nil, fmt.Errorf("can only transform slices and arrays into aggregation pipelines, but got %v", val.Kind()) - } - for idx := 0; idx < val.Len(); idx++ { - elem, err := transformDocument(registry, val.Index(idx).Interface()) - if err != nil { - return nil, err - } - pipelineArr = append(pipelineArr, bsonx.Document(elem)) - } - } - - return pipelineArr, nil -} - -func transformAggregatePipelinev2(registry *bsoncodec.Registry, pipeline interface{}) (bsoncore.Document, bool, error) { +func transformAggregatePipeline(registry *bsoncodec.Registry, pipeline interface{}) (bsoncore.Document, bool, error) { switch t := pipeline.(type) { case bsoncodec.ValueMarshaler: btype, val, err := t.MarshalBSONValue() @@ -350,7 +247,7 @@ func transformAggregatePipelinev2(registry *bsoncodec.Registry, pipeline interfa } func transformUpdateValue(registry *bsoncodec.Registry, update interface{}, dollarKeysAllowed bool) (bsoncore.Value, error) { - documentCheckerFunc := ensureDollarKeyv2 + documentCheckerFunc := ensureDollarKey if !dollarKeysAllowed { documentCheckerFunc = ensureNoDollarKey } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongocryptd.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongocryptd.go index c88674cc..2eab62f9 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongocryptd.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongocryptd.go @@ -19,7 +19,7 @@ import ( ) const ( - defaultServerSelectionTimeout = 1 * time.Second + defaultServerSelectionTimeout = 10 * time.Second defaultURI = "mongodb://localhost:27020" defaultPath = "mongocryptd" serverSelectionTimeoutStr = "server selection error" diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/aggregateoptions.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/aggregateoptions.go index 33752c30..e1f710fd 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/aggregateoptions.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/aggregateoptions.go @@ -44,6 +44,12 @@ type AggregateOptions struct { // as a document. The hint does not apply to $lookup and $graphLookup aggregation stages. The driver will return an // error if the hint parameter is a multi-key map. The default value is nil, which means that no hint will be sent. Hint interface{} + + // Specifies parameters for the aggregate expression. This option is only valid for MongoDB versions >= 5.0. Older + // servers will report an error for using this option. This must be a document mapping parameter names to values. + // Values must be constant or closed expressions that do not reference document fields. Parameters can then be + // accessed as variables in an aggregate expression context (e.g. "$$var"). + Let interface{} } // Aggregate creates a new AggregateOptions instance. @@ -99,6 +105,12 @@ func (ao *AggregateOptions) SetHint(h interface{}) *AggregateOptions { return ao } +// SetLet sets the value for the Let field. +func (ao *AggregateOptions) SetLet(let interface{}) *AggregateOptions { + ao.Let = let + return ao +} + // MergeAggregateOptions combines the given AggregateOptions instances into a single AggregateOptions in a last-one-wins // fashion. func MergeAggregateOptions(opts ...*AggregateOptions) *AggregateOptions { @@ -131,6 +143,9 @@ func MergeAggregateOptions(opts ...*AggregateOptions) *AggregateOptions { if ao.Hint != nil { aggOpts.Hint = ao.Hint } + if ao.Let != nil { + aggOpts.Let = ao.Let + } } return aggOpts diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions.go index 354a5dac..d66114fa 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions.go @@ -22,6 +22,7 @@ import ( "github.com/youmark/pkcs8" "go.mongodb.org/mongo-driver/bson/bsoncodec" "go.mongodb.org/mongo-driver/event" + "go.mongodb.org/mongo-driver/internal" "go.mongodb.org/mongo-driver/mongo/readconcern" "go.mongodb.org/mongo-driver/mongo/readpref" "go.mongodb.org/mongo-driver/mongo/writeconcern" @@ -103,6 +104,7 @@ type ClientOptions struct { DisableOCSPEndpointCheck *bool HeartbeatInterval *time.Duration Hosts []string + LoadBalanced *bool LocalThreshold *time.Duration MaxConnIdleTime *time.Duration MaxPoolSize *uint64 @@ -116,6 +118,7 @@ type ClientOptions struct { ReplicaSet *string RetryReads *bool RetryWrites *bool + ServerAPIOptions *ServerAPIOptions ServerSelectionTimeout *time.Duration SocketTimeout *time.Duration TLSConfig *tls.Config @@ -167,6 +170,24 @@ func (c *ClientOptions) validateAndSetError() { return } } + + // verify server API version if ServerAPIOptions are passed in. + if c.ServerAPIOptions != nil { + c.err = c.ServerAPIOptions.ServerAPIVersion.Validate() + } + + // Validation for load-balanced mode. + if c.LoadBalanced != nil && *c.LoadBalanced { + if len(c.Hosts) > 1 { + c.err = internal.ErrLoadBalancedWithMultipleHosts + } + if c.ReplicaSet != nil { + c.err = internal.ErrLoadBalancedWithReplicaSet + } + if c.Direct != nil { + c.err = internal.ErrLoadBalancedWithDirectConnection + } + } } // GetURI returns the original URI used to configure the ClientOptions instance. If ApplyURI was not called during @@ -184,7 +205,7 @@ func (c *ClientOptions) GetURI() string { // parameters are specified. If an option is set on ClientOptions after this method is called, that option will override // any option applied via the connection string. // -// If the URI format is incorrect or there are conflicing options specified in the URI an error will be recorded and +// If the URI format is incorrect or there are conflicting options specified in the URI an error will be recorded and // can be retrieved by calling Validate. // // For more information about the URI format, see https://docs.mongodb.com/manual/reference/connection-string/. See @@ -249,6 +270,10 @@ func (c *ClientOptions) ApplyURI(uri string) *ClientOptions { c.Hosts = cs.Hosts + if cs.LoadBalancedSet { + c.LoadBalanced = &cs.LoadBalanced + } + if cs.LocalThresholdSet { c.LocalThreshold = &cs.LocalThreshold } @@ -480,6 +505,21 @@ func (c *ClientOptions) SetHosts(s []string) *ClientOptions { return c } +// SetLoadBalanced specifies whether or not the MongoDB deployment is hosted behind a load balancer. This can also be +// set through the "loadBalanced" URI option. The driver will error during Client configuration if this option is set +// to true and one of the following conditions are met: +// +// 1. Multiple hosts are specified, either via the ApplyURI or SetHosts methods. This includes the case where an SRV +// URI is used and the SRV record resolves to multiple hostnames. +// 2. A replica set name is specified, either via the URI or the SetReplicaSet method. +// 3. The options specify whether or not a direct connection should be made, either via the URI or the SetDirect method. +// +// The default value is false. +func (c *ClientOptions) SetLoadBalanced(lb bool) *ClientOptions { + c.LoadBalanced = &lb + return c +} + // SetLocalThreshold specifies the width of the 'latency window': when choosing between multiple suitable servers for an // operation, this is the acceptable non-negative delta between shortest and longest average round-trip times. A server // within the latency window is selected randomly. This can also be set through the "localThresholdMS" URI option (e.g. @@ -545,7 +585,7 @@ func (c *ClientOptions) SetReadConcern(rc *readconcern.ReadConcern) *ClientOptio // SetReadPreference specifies the read preference to use for read operations. This can also be set through the // following URI options: // -// 1. "readPreference" - Specifiy the read preference mode (e.g. "readPreference=primary"). +// 1. "readPreference" - Specify the read preference mode (e.g. "readPreference=primary"). // // 2. "readPreferenceTags": Specify one or more read preference tags // (e.g. "readPreferenceTags=region:south,datacenter:A"). @@ -712,6 +752,14 @@ func (c *ClientOptions) SetDisableOCSPEndpointCheck(disableCheck bool) *ClientOp return c } +// SetServerAPIOptions specifies a ServerAPIOptions instance used to configure the API version sent to the server +// when running commands. See the options.ServerAPIOptions documentation for more information about the supported +// options. +func (c *ClientOptions) SetServerAPIOptions(opts *ServerAPIOptions) *ClientOptions { + c.ServerAPIOptions = opts + return c +} + // MergeClientOptions combines the given *ClientOptions into a single *ClientOptions in a last one wins fashion. // The specified options are merged with the existing options on the client, with the specified options taking // precedence. @@ -747,6 +795,9 @@ func MergeClientOptions(opts ...*ClientOptions) *ClientOptions { if len(opt.Hosts) > 0 { c.Hosts = opt.Hosts } + if opt.LoadBalanced != nil { + c.LoadBalanced = opt.LoadBalanced + } if opt.LocalThreshold != nil { c.LocalThreshold = opt.LocalThreshold } @@ -765,6 +816,9 @@ func MergeClientOptions(opts ...*ClientOptions) *ClientOptions { if opt.Monitor != nil { c.Monitor = opt.Monitor } + if opt.ServerAPIOptions != nil { + c.ServerAPIOptions = opt.ServerAPIOptions + } if opt.ServerMonitor != nil { c.ServerMonitor = opt.ServerMonitor } @@ -819,7 +873,12 @@ func MergeClientOptions(opts ...*ClientOptions) *ClientOptions { if opt.err != nil { c.err = opt.err } - + if opt.uri != "" { + c.uri = opt.uri + } + if opt.cs != nil { + c.cs = opt.cs + } } return c diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/createcollectionoptions.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/createcollectionoptions.go index a65049e0..3fe63c32 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/createcollectionoptions.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/createcollectionoptions.go @@ -26,6 +26,45 @@ func (d *DefaultIndexOptions) SetStorageEngine(storageEngine interface{}) *Defau return d } +// TimeSeriesOptions specifies options on a time-series collection. +type TimeSeriesOptions struct { + // Name of the top-level field to be used for time. Inserted documents must have this field, + // and the field must be of the BSON UTC datetime type (0x9). + TimeField string + + // Optional name of the top-level field describing the series. This field is used to group + // related data and may be of any BSON type, except for array. This name may not be the same + // as the TimeField or _id. + MetaField *string + + // Optional string specifying granularity of time-series data. Allowed granularity options are + // "seconds", "minutes" and "hours". + Granularity *string +} + +// TimeSeries creates a new TimeSeriesOptions instance. +func TimeSeries() *TimeSeriesOptions { + return &TimeSeriesOptions{} +} + +// SetTimeField sets the value for the TimeField. +func (tso *TimeSeriesOptions) SetTimeField(timeField string) *TimeSeriesOptions { + tso.TimeField = timeField + return tso +} + +// SetMetaField sets the value for the MetaField. +func (tso *TimeSeriesOptions) SetMetaField(metaField string) *TimeSeriesOptions { + tso.MetaField = &metaField + return tso +} + +// SetGranularity sets the value for Granularity. +func (tso *TimeSeriesOptions) SetGranularity(granularity string) *TimeSeriesOptions { + tso.Granularity = &granularity + return tso +} + // CreateCollectionOptions represents options that can be used to configure a CreateCollection operation. type CreateCollectionOptions struct { // Specifies if the collection is capped (see https://docs.mongodb.com/manual/core/capped-collections/). If true, @@ -70,6 +109,12 @@ type CreateCollectionOptions struct { // is only valid for MongoDB versions >= 3.2. The default value is nil, meaning no validator will be used for the // collection. Validator interface{} + + // Value indicating after how many seconds old time-series data should be deleted. + ExpireAfterSeconds *int64 + + // Options for specifying a time-series collection. + TimeSeriesOptions *TimeSeriesOptions } // CreateCollection creates a new CreateCollectionOptions instance. @@ -131,6 +176,18 @@ func (c *CreateCollectionOptions) SetValidator(validator interface{}) *CreateCol return c } +// SetExpireAfterSeconds sets the value for the ExpireAfterSeconds field. +func (c *CreateCollectionOptions) SetExpireAfterSeconds(eas int64) *CreateCollectionOptions { + c.ExpireAfterSeconds = &eas + return c +} + +// SetTimeSeriesOptions sets the options for time-series collections. +func (c *CreateCollectionOptions) SetTimeSeriesOptions(timeSeriesOpts *TimeSeriesOptions) *CreateCollectionOptions { + c.TimeSeriesOptions = timeSeriesOpts + return c +} + // MergeCreateCollectionOptions combines the given CreateCollectionOptions instances into a single // CreateCollectionOptions in a last-one-wins fashion. func MergeCreateCollectionOptions(opts ...*CreateCollectionOptions) *CreateCollectionOptions { @@ -168,6 +225,12 @@ func MergeCreateCollectionOptions(opts ...*CreateCollectionOptions) *CreateColle if opt.Validator != nil { cc.Validator = opt.Validator } + if opt.ExpireAfterSeconds != nil { + cc.ExpireAfterSeconds = opt.ExpireAfterSeconds + } + if opt.TimeSeriesOptions != nil { + cc.TimeSeriesOptions = opt.TimeSeriesOptions + } } return cc diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/serverapioptions.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/serverapioptions.go new file mode 100644 index 00000000..5beb795e --- /dev/null +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/serverapioptions.go @@ -0,0 +1,60 @@ +// Copyright (C) MongoDB, Inc. 2017-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + +package options + +import ( + "fmt" +) + +// ServerAPIOptions represents options used to configure the API version sent to the server +// when running commands. +// +// Sending a specified server API version causes the server to behave in a manner compatible with that +// API version. It also causes the driver to behave in a manner compatible with the driver’s behavior as +// of the release when the driver first started to support the specified server API version. +// +// The user must specify a ServerAPIVersion if including ServerAPIOptions in their client. That version +// must also be currently supported by the driver. This version of the driver supports API version "1". +type ServerAPIOptions struct { + ServerAPIVersion ServerAPIVersion + Strict *bool + DeprecationErrors *bool +} + +// ServerAPI creates a new ServerAPIOptions configured with the provided serverAPIversion. +func ServerAPI(serverAPIVersion ServerAPIVersion) *ServerAPIOptions { + return &ServerAPIOptions{ServerAPIVersion: serverAPIVersion} +} + +// SetStrict specifies whether the server should return errors for features that are not part of the API version. +func (s *ServerAPIOptions) SetStrict(strict bool) *ServerAPIOptions { + s.Strict = &strict + return s +} + +// SetDeprecationErrors specifies whether the server should return errors for deprecated features. +func (s *ServerAPIOptions) SetDeprecationErrors(deprecationErrors bool) *ServerAPIOptions { + s.DeprecationErrors = &deprecationErrors + return s +} + +// ServerAPIVersion represents an API version that can be used in ServerAPIOptions. +type ServerAPIVersion string + +const ( + // ServerAPIVersion1 is the first API version. + ServerAPIVersion1 ServerAPIVersion = "1" +) + +// Validate determines if the provided ServerAPIVersion is currently supported by the driver. +func (sav ServerAPIVersion) Validate() error { + switch sav { + case ServerAPIVersion1: + return nil + } + return fmt.Errorf("api version %q not supported; this driver version only supports API version \"1\"", sav) +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/sessionoptions.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/sessionoptions.go index 0ea393fa..32bc20d5 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/sessionoptions.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/sessionoptions.go @@ -19,7 +19,8 @@ var DefaultCausalConsistency = true // SessionOptions represents options that can be used to configure a Session. type SessionOptions struct { - // If true, causal consistency will be enabled for the session. The default value is true. See + // If true, causal consistency will be enabled for the session. This option cannot be set to true if Snapshot is + // set to true. The default value is true unless Snapshot is set to true. See // https://docs.mongodb.com/manual/core/read-isolation-consistency-recency/#sessions for more information. CausalConsistency *bool @@ -38,13 +39,16 @@ type SessionOptions struct { // The default maximum amount of time that a CommitTransaction operation executed in the session can run on the // server. The default value is nil, which means that that there is no time limit for execution. DefaultMaxCommitTime *time.Duration + + // If true, all read operations performed with this session will be read from the same snapshot. This option cannot + // be set to true if CausalConsistency is set to true. Transactions and write operations are not allowed on + // snapshot sessions and will error. The default value is false. + Snapshot *bool } // Session creates a new SessionOptions instance. func Session() *SessionOptions { - return &SessionOptions{ - CausalConsistency: &DefaultCausalConsistency, - } + return &SessionOptions{} } // SetCausalConsistency sets the value for the CausalConsistency field. @@ -77,6 +81,12 @@ func (s *SessionOptions) SetDefaultMaxCommitTime(mct *time.Duration) *SessionOpt return s } +// SetSnapshot sets the value for the Snapshot field. +func (s *SessionOptions) SetSnapshot(b bool) *SessionOptions { + s.Snapshot = &b + return s +} + // MergeSessionOptions combines the given SessionOptions instances into a single SessionOptions in a last-one-wins // fashion. func MergeSessionOptions(opts ...*SessionOptions) *SessionOptions { @@ -100,6 +110,12 @@ func MergeSessionOptions(opts ...*SessionOptions) *SessionOptions { if opt.DefaultMaxCommitTime != nil { s.DefaultMaxCommitTime = opt.DefaultMaxCommitTime } + if opt.Snapshot != nil { + s.Snapshot = opt.Snapshot + } + } + if s.CausalConsistency == nil && (s.Snapshot == nil || !*s.Snapshot) { + s.CausalConsistency = &DefaultCausalConsistency } return s diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/session.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/session.go index f51aee21..c1a2c8ea 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/session.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/session.go @@ -193,6 +193,10 @@ func (s *sessionImpl) WithTransaction(ctx context.Context, fn func(sessCtx Sessi default: } + // End if context has timed out or been canceled, as retrying has no chance of success. + if ctx.Err() != nil { + return res, err + } if errorHasLabel(err, driver.TransientTransactionError) { continue } @@ -270,7 +274,7 @@ func (s *sessionImpl) AbortTransaction(ctx context.Context) error { _ = operation.NewAbortTransaction().Session(s.clientSession).ClusterClock(s.client.clock).Database("admin"). Deployment(s.deployment).WriteConcern(s.clientSession.CurrentWc).ServerSelector(selector). Retry(driver.RetryOncePerCommand).CommandMonitor(s.client.monitor). - RecoveryToken(bsoncore.Document(s.clientSession.RecoveryToken)).Execute(ctx) + RecoveryToken(bsoncore.Document(s.clientSession.RecoveryToken)).ServerAPI(s.client.serverAPI).Execute(ctx) s.clientSession.Aborting = false _ = s.clientSession.AbortTransaction() @@ -301,7 +305,8 @@ func (s *sessionImpl) CommitTransaction(ctx context.Context) error { op := operation.NewCommitTransaction(). Session(s.clientSession).ClusterClock(s.client.clock).Database("admin").Deployment(s.deployment). WriteConcern(s.clientSession.CurrentWc).ServerSelector(selector).Retry(driver.RetryOncePerCommand). - CommandMonitor(s.client.monitor).RecoveryToken(bsoncore.Document(s.clientSession.RecoveryToken)) + CommandMonitor(s.client.monitor).RecoveryToken(bsoncore.Document(s.clientSession.RecoveryToken)). + ServerAPI(s.client.serverAPI) if s.clientSession.CurrentMct != nil { op.MaxTimeMS(int64(*s.clientSession.CurrentMct / time.Millisecond)) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/version/version.go b/backend/vendor/go.mongodb.org/mongo-driver/version/version.go index b7f209fa..460ff3a7 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/version/version.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/version/version.go @@ -7,4 +7,4 @@ package version // import "go.mongodb.org/mongo-driver/version" // Driver is the current version of the driver. -var Driver = "v1.5.2" +var Driver = "v1.7.1" diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/auth.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/auth.go index adf50a37..d0436904 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/auth.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/auth.go @@ -59,6 +59,8 @@ type HandshakeOptions struct { DBUser string PerformAuthentication func(description.Server) bool ClusterClock *session.ClusterClock + ServerAPI *driver.ServerAPIOptions + LoadBalanced bool } type authHandshaker struct { @@ -82,7 +84,9 @@ func (ah *authHandshaker) GetHandshakeInformation(ctx context.Context, addr addr AppName(ah.options.AppName). Compressors(ah.options.Compressors). SASLSupportedMechs(ah.options.DBUser). - ClusterClock(ah.options.ClusterClock) + ClusterClock(ah.options.ClusterClock). + ServerAPI(ah.options.ServerAPI). + LoadBalanced(ah.options.LoadBalanced) if ah.options.Authenticator != nil { if speculativeAuth, ok := ah.options.Authenticator.(SpeculativeAuthenticator); ok { @@ -126,6 +130,7 @@ func (ah *authHandshaker) FinishHandshake(ctx context.Context, conn driver.Conne Connection: conn, ClusterClock: ah.options.ClusterClock, HandshakeInfo: ah.handshakeInfo, + ServerAPI: ah.options.ServerAPI, } if err := ah.authenticate(ctx, cfg); err != nil { @@ -169,6 +174,7 @@ type Config struct { Connection driver.Connection ClusterClock *session.ClusterClock HandshakeInfo driver.HandshakeInformation + ServerAPI *driver.ServerAPIOptions } // Authenticator handles authenticating a connection. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/aws_conv.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/aws_conv.go index 9a7a113d..fa0b0d0e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/aws_conv.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/aws_conv.go @@ -20,11 +20,10 @@ import ( "strings" "time" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/signer/v4" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" + "go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4" ) type clientState int @@ -128,7 +127,7 @@ func getRegion(host string) (string, error) { return region, nil } -func (ac *awsConversation) validateAndMakeCredentials() (*credentials.Credentials, error) { +func (ac *awsConversation) validateAndMakeCredentials() (*awsv4.StaticProvider, error) { if ac.username != "" && ac.password == "" { return nil, errors.New("ACCESS_KEY_ID is set, but SECRET_ACCESS_KEY is missing") } @@ -139,7 +138,11 @@ func (ac *awsConversation) validateAndMakeCredentials() (*credentials.Credential return nil, errors.New("AWS_SESSION_TOKEN is set, but ACCESS_KEY_ID and SECRET_ACCESS_KEY are missing") } if ac.username != "" || ac.password != "" || ac.token != "" { - return credentials.NewStaticCredentials(ac.username, ac.password, ac.token), nil + return &awsv4.StaticProvider{Value: awsv4.Value{ + AccessKeyID: ac.username, + SecretAccessKey: ac.password, + SessionToken: ac.token, + }}, nil } return nil, nil } @@ -156,7 +159,7 @@ func executeAWSHTTPRequest(req *http.Request) ([]byte, error) { return ioutil.ReadAll(resp.Body) } -func (ac *awsConversation) getEC2Credentials() (*credentials.Credentials, error) { +func (ac *awsConversation) getEC2Credentials() (*awsv4.StaticProvider, error) { // get token req, err := http.NewRequest("PUT", awsEC2URI+awsEC2TokenPath, nil) if err != nil { @@ -212,7 +215,7 @@ func (ac *awsConversation) getEC2Credentials() (*credentials.Credentials, error) return ac.validateAndMakeCredentials() } -func (ac *awsConversation) getCredentials() (*credentials.Credentials, error) { +func (ac *awsConversation) getCredentials() (*awsv4.StaticProvider, error) { // Credentials passed through URI creds, err := ac.validateAndMakeCredentials() if creds != nil || err != nil { @@ -323,9 +326,7 @@ func (ac *awsConversation) finalMsg(s1 []byte) ([]byte, error) { req.Header.Set("X-MongoDB-GS2-CB-Flag", "n") // Create signer with credentials - signer := v4.Signer{ - Credentials: creds, - } + signer := awsv4.NewSigner(creds) // Get signed header _, err = signer.Sign(req, strings.NewReader(body), "sts", region, currentTime) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/credentials.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/credentials.go new file mode 100644 index 00000000..95225a47 --- /dev/null +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/credentials.go @@ -0,0 +1,63 @@ +// Copyright (C) MongoDB, Inc. 2017-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// +// Based on github.com/aws/aws-sdk-go by Amazon.com, Inc. with code from: +// - github.com/aws/aws-sdk-go/blob/v1.34.28/aws/credentials/static_provider.go +// - github.com/aws/aws-sdk-go/blob/v1.34.28/aws/credentials/credentials.go +// See THIRD-PARTY-NOTICES for original license terms + +package awsv4 + +import ( + "errors" +) + +// StaticProviderName provides a name of Static provider +const StaticProviderName = "StaticProvider" + +var ( + // ErrStaticCredentialsEmpty is emitted when static credentials are empty. + ErrStaticCredentialsEmpty = errors.New("EmptyStaticCreds: static credentials are empty") +) + +// A Value is the AWS credentials value for individual credential fields. +type Value struct { + // AWS Access key ID + AccessKeyID string + + // AWS Secret Access Key + SecretAccessKey string + + // AWS Session Token + SessionToken string + + // Provider used to get credentials + ProviderName string +} + +// HasKeys returns if the credentials Value has both AccessKeyID and +// SecretAccessKey value set. +func (v Value) HasKeys() bool { + return len(v.AccessKeyID) != 0 && len(v.SecretAccessKey) != 0 +} + +// A StaticProvider is a set of credentials which are set programmatically, +// and will never expire. +type StaticProvider struct { + Value +} + +// Retrieve returns the credentials or error if the credentials are invalid. +func (s *StaticProvider) Retrieve() (Value, error) { + if s.AccessKeyID == "" || s.SecretAccessKey == "" { + return Value{ProviderName: StaticProviderName}, ErrStaticCredentialsEmpty + } + + if len(s.Value.ProviderName) == 0 { + s.Value.ProviderName = StaticProviderName + } + return s.Value, nil +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/doc.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/doc.go new file mode 100644 index 00000000..6a29293d --- /dev/null +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/doc.go @@ -0,0 +1,15 @@ +// Copyright (C) MongoDB, Inc. 2017-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// +// Based on github.com/aws/aws-sdk-go v1.34.28 by Amazon.com, Inc. +// See THIRD-PARTY-NOTICES for original license terms + +// Package awsv4 implements signing for AWS V4 signer with static credentials, +// and is based on and modified from code in the package aws-sdk-go. The +// modifications remove non-static credentials, support for non-sts services, +// and the options for v4.Signer. They also reduce the number of non-Go +// library dependencies. +package awsv4 diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/request.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/request.go new file mode 100644 index 00000000..014ee083 --- /dev/null +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/request.go @@ -0,0 +1,80 @@ +// Copyright (C) MongoDB, Inc. 2017-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// +// Based on github.com/aws/aws-sdk-go by Amazon.com, Inc. with code from: +// - github.com/aws/aws-sdk-go/blob/v1.34.28/aws/request/request.go +// See THIRD-PARTY-NOTICES for original license terms + +package awsv4 + +import ( + "net/http" + "strings" +) + +// Returns host from request +func getHost(r *http.Request) string { + if r.Host != "" { + return r.Host + } + + if r.URL == nil { + return "" + } + + return r.URL.Host +} + +// Hostname returns u.Host, without any port number. +// +// If Host is an IPv6 literal with a port number, Hostname returns the +// IPv6 literal without the square brackets. IPv6 literals may include +// a zone identifier. +// +// Copied from the Go 1.8 standard library (net/url) +func stripPort(hostport string) string { + colon := strings.IndexByte(hostport, ':') + if colon == -1 { + return hostport + } + if i := strings.IndexByte(hostport, ']'); i != -1 { + return strings.TrimPrefix(hostport[:i], "[") + } + return hostport[:colon] +} + +// Port returns the port part of u.Host, without the leading colon. +// If u.Host doesn't contain a port, Port returns an empty string. +// +// Copied from the Go 1.8 standard library (net/url) +func portOnly(hostport string) string { + colon := strings.IndexByte(hostport, ':') + if colon == -1 { + return "" + } + if i := strings.Index(hostport, "]:"); i != -1 { + return hostport[i+len("]:"):] + } + if strings.Contains(hostport, "]") { + return "" + } + return hostport[colon+len(":"):] +} + +// Returns true if the specified URI is using the standard port +// (i.e. port 80 for HTTP URIs or 443 for HTTPS URIs) +func isDefaultPort(scheme, port string) bool { + if port == "" { + return true + } + + lowerCaseScheme := strings.ToLower(scheme) + if (lowerCaseScheme == "http" && port == "80") || (lowerCaseScheme == "https" && port == "443") { + return true + } + + return false +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rest.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rest.go new file mode 100644 index 00000000..b1f86a09 --- /dev/null +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rest.go @@ -0,0 +1,46 @@ +// Copyright (C) MongoDB, Inc. 2017-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// +// Based on github.com/aws/aws-sdk-go by Amazon.com, Inc. with code from: +// - github.com/aws/aws-sdk-go/blob/v1.34.28/private/protocol/rest/build.go +// See THIRD-PARTY-NOTICES for original license terms + +package awsv4 + +import ( + "bytes" + "fmt" +) + +// Whether the byte value can be sent without escaping in AWS URLs +var noEscape [256]bool + +func init() { + for i := 0; i < len(noEscape); i++ { + // AWS expects every character except these to be escaped + noEscape[i] = (i >= 'A' && i <= 'Z') || + (i >= 'a' && i <= 'z') || + (i >= '0' && i <= '9') || + i == '-' || + i == '.' || + i == '_' || + i == '~' + } +} + +// EscapePath escapes part of a URL path in Amazon style +func EscapePath(path string, encodeSep bool) string { + var buf bytes.Buffer + for i := 0; i < len(path); i++ { + c := path[i] + if noEscape[c] || (c == '/' && !encodeSep) { + buf.WriteByte(c) + } else { + fmt.Fprintf(&buf, "%%%02X", c) + } + } + return buf.String() +} diff --git a/backend/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rules.go similarity index 66% rename from backend/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go rename to backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rules.go index 07ea799f..2649db45 100644 --- a/backend/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rules.go @@ -1,7 +1,18 @@ -package v4 +// Copyright (C) MongoDB, Inc. 2017-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// +// Based on github.com/aws/aws-sdk-go by Amazon.com, Inc. with code from: +// - github.com/aws/aws-sdk-go/blob/v1.34.28/aws/signer/v4/header_rules.go +// - github.com/aws/aws-sdk-go/blob/v1.34.28/internal/strings/strings.go +// See THIRD-PARTY-NOTICES for original license terms + +package awsv4 import ( - "github.com/aws/aws-sdk-go/internal/strings" + "strings" ) // validator houses a set of rule needed for validation of a @@ -56,11 +67,17 @@ func (b blacklist) IsValid(value string) bool { type patterns []string +// hasPrefixFold tests whether the string s begins with prefix, interpreted as UTF-8 strings, +// under Unicode case-folding. +func hasPrefixFold(s, prefix string) bool { + return len(s) >= len(prefix) && strings.EqualFold(s[0:len(prefix)], prefix) +} + // IsValid for patterns checks each pattern and returns if a match has // been found func (p patterns) IsValid(value string) bool { for _, pattern := range p { - if strings.HasPrefixFold(value, pattern) { + if hasPrefixFold(value, pattern) { return true } } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/signer.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/signer.go new file mode 100644 index 00000000..1e4662b0 --- /dev/null +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/signer.go @@ -0,0 +1,472 @@ +// Copyright (C) MongoDB, Inc. 2017-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// +// Based on github.com/aws/aws-sdk-go by Amazon.com, Inc. with code from: +// - github.com/aws/aws-sdk-go/blob/v1.34.28/aws/request/request.go +// - github.com/aws/aws-sdk-go/blob/v1.34.28/aws/signer/v4/v4.go +// - github.com/aws/aws-sdk-go/blob/v1.34.28/aws/signer/v4/uri_path.go +// - github.com/aws/aws-sdk-go/blob/v1.34.28/aws/types.go +// See THIRD-PARTY-NOTICES for original license terms + +package awsv4 + +import ( + "crypto/hmac" + "crypto/sha256" + "encoding/hex" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "sort" + "strings" + "time" +) + +const ( + authorizationHeader = "Authorization" + authHeaderSignatureElem = "Signature=" + + authHeaderPrefix = "AWS4-HMAC-SHA256" + timeFormat = "20060102T150405Z" + shortTimeFormat = "20060102" + awsV4Request = "aws4_request" + + // emptyStringSHA256 is a SHA256 of an empty string + emptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855` +) + +var ignoredHeaders = rules{ + blacklist{ + mapRule{ + authorizationHeader: struct{}{}, + "User-Agent": struct{}{}, + "X-Amzn-Trace-Id": struct{}{}, + }, + }, +} + +// Signer applies AWS v4 signing to given request. Use this to sign requests +// that need to be signed with AWS V4 Signatures. +type Signer struct { + Credentials *StaticProvider +} + +// NewSigner returns a Signer pointer configured with the credentials and optional +// option values provided. If not options are provided the Signer will use its +// default configuration. +func NewSigner(credentials *StaticProvider) *Signer { + v4 := &Signer{ + Credentials: credentials, + } + + return v4 +} + +type signingCtx struct { + ServiceName string + Region string + Request *http.Request + Body io.ReadSeeker + Query url.Values + Time time.Time + SignedHeaderVals http.Header + + credValues Value + + bodyDigest string + signedHeaders string + canonicalHeaders string + canonicalString string + credentialString string + stringToSign string + signature string + authorization string +} + +// Sign signs AWS v4 requests with the provided body, service name, region the +// request is made to, and time the request is signed at. The signTime allows +// you to specify that a request is signed for the future, and cannot be +// used until then. +// +// Returns a list of HTTP headers that were included in the signature or an +// error if signing the request failed. Generally for signed requests this value +// is not needed as the full request context will be captured by the http.Request +// value. It is included for reference though. +// +// Sign will set the request's Body to be the `body` parameter passed in. If +// the body is not already an io.ReadCloser, it will be wrapped within one. If +// a `nil` body parameter passed to Sign, the request's Body field will be +// also set to nil. Its important to note that this functionality will not +// change the request's ContentLength of the request. +// +// Sign differs from Presign in that it will sign the request using HTTP +// header values. This type of signing is intended for http.Request values that +// will not be shared, or are shared in a way the header values on the request +// will not be lost. +// +// The requests body is an io.ReadSeeker so the SHA256 of the body can be +// generated. To bypass the signer computing the hash you can set the +// "X-Amz-Content-Sha256" header with a precomputed value. The signer will +// only compute the hash if the request header value is empty. +func (v4 Signer) Sign(r *http.Request, body io.ReadSeeker, service, region string, signTime time.Time) (http.Header, error) { + return v4.signWithBody(r, body, service, region, signTime) +} + +func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, region string, signTime time.Time) (http.Header, error) { + ctx := &signingCtx{ + Request: r, + Body: body, + Query: r.URL.Query(), + Time: signTime, + ServiceName: service, + Region: region, + } + + for key := range ctx.Query { + sort.Strings(ctx.Query[key]) + } + + if ctx.isRequestSigned() { + ctx.Time = time.Now() + } + + var err error + ctx.credValues, err = v4.Credentials.Retrieve() + if err != nil { + return http.Header{}, err + } + + ctx.sanitizeHostForHeader() + ctx.assignAmzQueryValues() + if err := ctx.build(); err != nil { + return nil, err + } + + var reader io.ReadCloser + if body != nil { + var ok bool + if reader, ok = body.(io.ReadCloser); !ok { + reader = ioutil.NopCloser(body) + } + } + r.Body = reader + + return ctx.SignedHeaderVals, nil +} + +// sanitizeHostForHeader removes default port from host and updates request.Host +func (ctx *signingCtx) sanitizeHostForHeader() { + r := ctx.Request + host := getHost(r) + port := portOnly(host) + if port != "" && isDefaultPort(r.URL.Scheme, port) { + r.Host = stripPort(host) + } +} + +func (ctx *signingCtx) assignAmzQueryValues() { + if ctx.credValues.SessionToken != "" { + ctx.Request.Header.Set("X-Amz-Security-Token", ctx.credValues.SessionToken) + } +} + +func (ctx *signingCtx) build() error { + ctx.buildTime() // no depends + ctx.buildCredentialString() // no depends + + if err := ctx.buildBodyDigest(); err != nil { + return err + } + + unsignedHeaders := ctx.Request.Header + + ctx.buildCanonicalHeaders(ignoredHeaders, unsignedHeaders) + ctx.buildCanonicalString() // depends on canon headers / signed headers + ctx.buildStringToSign() // depends on canon string + ctx.buildSignature() // depends on string to sign + + parts := []string{ + authHeaderPrefix + " Credential=" + ctx.credValues.AccessKeyID + "/" + ctx.credentialString, + "SignedHeaders=" + ctx.signedHeaders, + authHeaderSignatureElem + ctx.signature, + } + ctx.Request.Header.Set(authorizationHeader, strings.Join(parts, ", ")) + + return nil +} + +// GetSignedRequestSignature attempts to extract the signature of the request. +// Returning an error if the request is unsigned, or unable to extract the +// signature. +func GetSignedRequestSignature(r *http.Request) ([]byte, error) { + + if auth := r.Header.Get(authorizationHeader); len(auth) != 0 { + ps := strings.Split(auth, ", ") + for _, p := range ps { + if idx := strings.Index(p, authHeaderSignatureElem); idx >= 0 { + sig := p[len(authHeaderSignatureElem):] + if len(sig) == 0 { + return nil, fmt.Errorf("invalid request signature authorization header") + } + return hex.DecodeString(sig) + } + } + } + + if sig := r.URL.Query().Get("X-Amz-Signature"); len(sig) != 0 { + return hex.DecodeString(sig) + } + + return nil, fmt.Errorf("request not signed") +} + +func (ctx *signingCtx) buildTime() { + ctx.Request.Header.Set("X-Amz-Date", formatTime(ctx.Time)) +} + +func (ctx *signingCtx) buildCredentialString() { + ctx.credentialString = buildSigningScope(ctx.Region, ctx.ServiceName, ctx.Time) +} + +func (ctx *signingCtx) buildCanonicalHeaders(r rule, header http.Header) { + var headers []string + headers = append(headers, "host") + for k, v := range header { + if !r.IsValid(k) { + continue // ignored header + } + if ctx.SignedHeaderVals == nil { + ctx.SignedHeaderVals = make(http.Header) + } + + lowerCaseKey := strings.ToLower(k) + if _, ok := ctx.SignedHeaderVals[lowerCaseKey]; ok { + // include additional values + ctx.SignedHeaderVals[lowerCaseKey] = append(ctx.SignedHeaderVals[lowerCaseKey], v...) + continue + } + + headers = append(headers, lowerCaseKey) + ctx.SignedHeaderVals[lowerCaseKey] = v + } + sort.Strings(headers) + + ctx.signedHeaders = strings.Join(headers, ";") + + headerValues := make([]string, len(headers)) + for i, k := range headers { + if k == "host" { + if ctx.Request.Host != "" { + headerValues[i] = "host:" + ctx.Request.Host + } else { + headerValues[i] = "host:" + ctx.Request.URL.Host + } + } else { + headerValues[i] = k + ":" + + strings.Join(ctx.SignedHeaderVals[k], ",") + } + } + stripExcessSpaces(headerValues) + ctx.canonicalHeaders = strings.Join(headerValues, "\n") +} + +func getURIPath(u *url.URL) string { + var uri string + + if len(u.Opaque) > 0 { + uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") + } else { + uri = u.EscapedPath() + } + + if len(uri) == 0 { + uri = "/" + } + + return uri +} + +func (ctx *signingCtx) buildCanonicalString() { + ctx.Request.URL.RawQuery = strings.Replace(ctx.Query.Encode(), "+", "%20", -1) + + uri := getURIPath(ctx.Request.URL) + + uri = EscapePath(uri, false) + + ctx.canonicalString = strings.Join([]string{ + ctx.Request.Method, + uri, + ctx.Request.URL.RawQuery, + ctx.canonicalHeaders + "\n", + ctx.signedHeaders, + ctx.bodyDigest, + }, "\n") +} + +func (ctx *signingCtx) buildStringToSign() { + ctx.stringToSign = strings.Join([]string{ + authHeaderPrefix, + formatTime(ctx.Time), + ctx.credentialString, + hex.EncodeToString(hashSHA256([]byte(ctx.canonicalString))), + }, "\n") +} + +func (ctx *signingCtx) buildSignature() { + creds := deriveSigningKey(ctx.Region, ctx.ServiceName, ctx.credValues.SecretAccessKey, ctx.Time) + signature := hmacSHA256(creds, []byte(ctx.stringToSign)) + ctx.signature = hex.EncodeToString(signature) +} + +func (ctx *signingCtx) buildBodyDigest() error { + hash := ctx.Request.Header.Get("X-Amz-Content-Sha256") + if hash == "" { + if ctx.Body == nil { + hash = emptyStringSHA256 + } else { + hashBytes, err := makeSha256Reader(ctx.Body) + if err != nil { + return err + } + hash = hex.EncodeToString(hashBytes) + } + } + ctx.bodyDigest = hash + + return nil +} + +// isRequestSigned returns if the request is currently signed or presigned +func (ctx *signingCtx) isRequestSigned() bool { + return ctx.Request.Header.Get("Authorization") != "" +} + +func hmacSHA256(key []byte, data []byte) []byte { + hash := hmac.New(sha256.New, key) + hash.Write(data) + return hash.Sum(nil) +} + +func hashSHA256(data []byte) []byte { + hash := sha256.New() + hash.Write(data) + return hash.Sum(nil) +} + +// seekerLen attempts to get the number of bytes remaining at the seeker's +// current position. Returns the number of bytes remaining or error. +func seekerLen(s io.Seeker) (int64, error) { + curOffset, err := s.Seek(0, io.SeekCurrent) + if err != nil { + return 0, err + } + + endOffset, err := s.Seek(0, io.SeekEnd) + if err != nil { + return 0, err + } + + _, err = s.Seek(curOffset, io.SeekStart) + if err != nil { + return 0, err + } + + return endOffset - curOffset, nil +} + +func makeSha256Reader(reader io.ReadSeeker) (hashBytes []byte, err error) { + hash := sha256.New() + start, err := reader.Seek(0, io.SeekCurrent) + if err != nil { + return nil, err + } + defer func() { + // ensure error is return if unable to seek back to start of payload. + _, err = reader.Seek(start, io.SeekStart) + }() + + // Use CopyN to avoid allocating the 32KB buffer in io.Copy for bodies + // smaller than 32KB. Fall back to io.Copy if we fail to determine the size. + size, err := seekerLen(reader) + if err != nil { + _, _ = io.Copy(hash, reader) + } else { + _, _ = io.CopyN(hash, reader, size) + } + + return hash.Sum(nil), nil +} + +const doubleSpace = " " + +// stripExcessSpaces will rewrite the passed in slice's string values to not +// contain multiple side-by-side spaces. +func stripExcessSpaces(vals []string) { + var j, k, l, m, spaces int + for i, str := range vals { + // Trim trailing spaces + for j = len(str) - 1; j >= 0 && str[j] == ' '; j-- { + } + + // Trim leading spaces + for k = 0; k < j && str[k] == ' '; k++ { + } + str = str[k : j+1] + + // Strip multiple spaces. + j = strings.Index(str, doubleSpace) + if j < 0 { + vals[i] = str + continue + } + + buf := []byte(str) + for k, m, l = j, j, len(buf); k < l; k++ { + if buf[k] == ' ' { + if spaces == 0 { + // First space. + buf[m] = buf[k] + m++ + } + spaces++ + } else { + // End of multiple spaces. + spaces = 0 + buf[m] = buf[k] + m++ + } + } + + vals[i] = string(buf[:m]) + } +} + +func buildSigningScope(region, service string, dt time.Time) string { + return strings.Join([]string{ + formatShortTime(dt), + region, + service, + awsV4Request, + }, "/") +} + +func deriveSigningKey(region, service, secretKey string, dt time.Time) []byte { + keyDate := hmacSHA256([]byte("AWS4"+secretKey), []byte(formatShortTime(dt))) + keyRegion := hmacSHA256(keyDate, []byte(region)) + keyService := hmacSHA256(keyRegion, []byte(service)) + signingKey := hmacSHA256(keyService, []byte(awsV4Request)) + return signingKey +} + +func formatShortTime(dt time.Time) string { + return dt.UTC().Format(shortTimeFormat) +} + +func formatTime(dt time.Time) string { + return dt.UTC().Format(timeFormat) +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbcr.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbcr.go index e683475a..d39772ef 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbcr.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbcr.go @@ -55,7 +55,8 @@ func (a *MongoDBCRAuthenticator) Auth(ctx context.Context, cfg *Config) error { cmd := operation.NewCommand(doc). Database(db). Deployment(driver.SingleConnectionDeployment{cfg.Connection}). - ClusterClock(cfg.ClusterClock) + ClusterClock(cfg.ClusterClock). + ServerAPI(cfg.ServerAPI) err := cmd.Execute(ctx) if err != nil { return newError(err, MONGODBCR) @@ -80,7 +81,8 @@ func (a *MongoDBCRAuthenticator) Auth(ctx context.Context, cfg *Config) error { cmd = operation.NewCommand(doc). Database(db). Deployment(driver.SingleConnectionDeployment{cfg.Connection}). - ClusterClock(cfg.ClusterClock) + ClusterClock(cfg.ClusterClock). + ServerAPI(cfg.ServerAPI) err = cmd.Execute(ctx) if err != nil { return newError(err, MONGODBCR) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/sasl.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/sasl.go index 5cef51e4..b91a08f1 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/sasl.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/sasl.go @@ -135,7 +135,8 @@ func (sc *saslConversation) Finish(ctx context.Context, cfg *Config, firstRespon saslContinueCmd := operation.NewCommand(doc). Database(sc.source). Deployment(driver.SingleConnectionDeployment{cfg.Connection}). - ClusterClock(cfg.ClusterClock) + ClusterClock(cfg.ClusterClock). + ServerAPI(cfg.ServerAPI) err = saslContinueCmd.Execute(ctx) if err != nil { @@ -163,7 +164,8 @@ func ConductSaslConversation(ctx context.Context, cfg *Config, authSource string saslStartCmd := operation.NewCommand(saslStartDoc). Database(authSource). Deployment(driver.SingleConnectionDeployment{cfg.Connection}). - ClusterClock(cfg.ClusterClock) + ClusterClock(cfg.ClusterClock). + ServerAPI(cfg.ServerAPI) if err := saslStartCmd.Execute(ctx); err != nil { return newError(err, conversation.mechanism) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/x509.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/x509.go index eed517e0..e0a61eda 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/x509.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/x509.go @@ -74,7 +74,8 @@ func (a *MongoDBX509Authenticator) Auth(ctx context.Context, cfg *Config) error NewCommand(requestDoc). Database("$external"). Deployment(driver.SingleConnectionDeployment{cfg.Connection}). - ClusterClock(cfg.ClusterClock) + ClusterClock(cfg.ClusterClock). + ServerAPI(cfg.ServerAPI) err := authCmd.Execute(ctx) if err != nil { return newAuthError("round trip error", err) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batch_cursor.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batch_cursor.go index 9966e148..4c3e4acf 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batch_cursor.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batch_cursor.go @@ -23,6 +23,8 @@ type BatchCursor struct { id int64 err error server Server + errorProcessor ErrorProcessor // This will only be set when pinning to a connection. + connection PinnedConnection batchSize int32 maxTimeMS int64 currentBatch *bsoncore.DocumentSequence @@ -30,6 +32,7 @@ type BatchCursor struct { cmdMonitor *event.CommandMonitor postBatchResumeToken bsoncore.Document crypt *Crypt + serverAPI *ServerAPIOptions // legacy server (< 3.2) fields legacy bool // This field is provided for ListCollectionsBatchCursor. @@ -41,6 +44,8 @@ type BatchCursor struct { // be constructed from a CursorResponse. type CursorResponse struct { Server Server + ErrorProcessor ErrorProcessor // This will only be set when pinning to a connection. + Connection PinnedConnection Desc description.Server FirstBatch *bsoncore.DocumentSequence Database string @@ -51,7 +56,8 @@ type CursorResponse struct { // NewCursorResponse constructs a cursor response from the given response and server. This method // can be used within the ProcessResponse method for an operation. -func NewCursorResponse(response bsoncore.Document, server Server, desc description.Server) (CursorResponse, error) { +func NewCursorResponse(info ResponseInfo) (CursorResponse, error) { + response := info.ServerResponse cur, ok := response.Lookup("cursor").DocumentOK() if !ok { return CursorResponse{}, fmt.Errorf("cursor should be an embedded document but is of BSON type %s", response.Lookup("cursor").Type) @@ -60,7 +66,7 @@ func NewCursorResponse(response bsoncore.Document, server Server, desc descripti if err != nil { return CursorResponse{}, err } - curresp := CursorResponse{Server: server, Desc: desc} + curresp := CursorResponse{Server: info.Server, Desc: info.ConnectionDescription} for _, elem := range elems { switch elem.Key() { @@ -93,6 +99,27 @@ func NewCursorResponse(response bsoncore.Document, server Server, desc descripti } } } + + // If the deployment is behind a load balancer and the cursor has a non-zero ID, pin the cursor to a connection and + // use the same connection to execute getMore and killCursors commands. + if curresp.Desc.LoadBalanced() && curresp.ID != 0 { + // Cache the server as an ErrorProcessor to use when constructing deployments for cursor commands. + ep, ok := curresp.Server.(ErrorProcessor) + if !ok { + return CursorResponse{}, fmt.Errorf("expected Server used to establish a cursor to implement ErrorProcessor, but got %T", curresp.Server) + } + curresp.ErrorProcessor = ep + + refConn, ok := info.Connection.(PinnedConnection) + if !ok { + return CursorResponse{}, fmt.Errorf("expected Connection used to establish a cursor to implement PinnedConnection, but got %T", info.Connection) + } + if err := refConn.PinToCursor(); err != nil { + return CursorResponse{}, fmt.Errorf("error incrementing connection reference count when creating a cursor: %v", err) + } + curresp.Connection = refConn + } + return curresp, nil } @@ -103,6 +130,7 @@ type CursorOptions struct { Limit int32 CommandMonitor *event.CommandMonitor Crypt *Crypt + ServerAPI *ServerAPIOptions } // NewBatchCursor creates a new BatchCursor from the provided parameters. @@ -115,12 +143,15 @@ func NewBatchCursor(cr CursorResponse, clientSession *session.Client, clock *ses collection: cr.Collection, id: cr.ID, server: cr.Server, + connection: cr.Connection, + errorProcessor: cr.ErrorProcessor, batchSize: opts.BatchSize, maxTimeMS: opts.MaxTimeMS, cmdMonitor: opts.CommandMonitor, firstBatch: true, postBatchResumeToken: cr.postBatchResumeToken, crypt: opts.Crypt, + serverAPI: opts.ServerAPI, } if ds != nil { @@ -200,6 +231,24 @@ func (bc *BatchCursor) Close(ctx context.Context) error { bc.currentBatch.Style = 0 bc.currentBatch.ResetIterator() + connErr := bc.unpinConnection() + if err == nil { + err = connErr + } + return err +} + +func (bc *BatchCursor) unpinConnection() error { + if bc.connection == nil { + return nil + } + + err := bc.connection.UnpinFromCursor() + closeErr := bc.connection.Close() + if err == nil && closeErr != nil { + err = closeErr + } + bc.connection = nil return err } @@ -225,11 +274,12 @@ func (bc *BatchCursor) KillCursor(ctx context.Context) error { return dst, nil }, Database: bc.database, - Deployment: SingleServerDeployment{Server: bc.server}, + Deployment: bc.getOperationDeployment(), Client: bc.clientSession, Clock: bc.clock, Legacy: LegacyKillCursors, CommandMonitor: bc.cmdMonitor, + ServerAPI: bc.serverAPI, }.Execute(ctx, nil) } @@ -265,8 +315,9 @@ func (bc *BatchCursor) getMore(ctx context.Context) { return dst, nil }, Database: bc.database, - Deployment: SingleServerDeployment{Server: bc.server}, - ProcessResponseFn: func(response bsoncore.Document, srvr Server, desc description.Server, currIndex int) error { + Deployment: bc.getOperationDeployment(), + ProcessResponseFn: func(info ResponseInfo) error { + response := info.ServerResponse id, ok := response.Lookup("cursor", "id").Int64OK() if !ok { return fmt.Errorf("cursor.id should be an int64 but is a BSON %s", response.Lookup("cursor", "id").Type) @@ -303,8 +354,24 @@ func (bc *BatchCursor) getMore(ctx context.Context) { Legacy: LegacyGetMore, CommandMonitor: bc.cmdMonitor, Crypt: bc.crypt, + ServerAPI: bc.serverAPI, }.Execute(ctx, nil) + // Once the cursor has been drained, we can unpin the connection if one is currently pinned. + if bc.id == 0 { + err := bc.unpinConnection() + if err != nil && bc.err == nil { + bc.err = err + } + } + + // If we're in load balanced mode and the pinned connection encounters a network error, we should not use it for + // future commands. Per the spec, the connection will not be unpinned until the cursor is actually closed, but + // we set the cursor ID to 0 to ensure the Close() call will not execute a killCursors command. + if driverErr, ok := bc.err.(Error); ok && driverErr.NetworkError() && bc.connection != nil { + bc.id = 0 + } + // Required for legacy operations which don't support limit. if bc.limit != 0 && bc.numReturned >= bc.limit { // call KillCursor instead of Close because Close will clear out the data for the current batch. @@ -320,3 +387,46 @@ func (bc *BatchCursor) getMore(ctx context.Context) { func (bc *BatchCursor) PostBatchResumeToken() bsoncore.Document { return bc.postBatchResumeToken } + +// SetBatchSize sets the batchSize for future getMores. +func (bc *BatchCursor) SetBatchSize(size int32) { + bc.batchSize = size +} + +func (bc *BatchCursor) getOperationDeployment() Deployment { + if bc.connection != nil { + return &loadBalancedCursorDeployment{ + errorProcessor: bc.errorProcessor, + conn: bc.connection, + } + } + return SingleServerDeployment{bc.server} +} + +// loadBalancedCursorDeployment is used as a Deployment for getMore and killCursors commands when pinning to a +// connection in load balanced mode. This type also functions as an ErrorProcessor to ensure that SDAM errors are +// handled for these commands in this mode. +type loadBalancedCursorDeployment struct { + errorProcessor ErrorProcessor + conn PinnedConnection +} + +var _ Deployment = (*loadBalancedCursorDeployment)(nil) +var _ Server = (*loadBalancedCursorDeployment)(nil) +var _ ErrorProcessor = (*loadBalancedCursorDeployment)(nil) + +func (lbcd *loadBalancedCursorDeployment) SelectServer(_ context.Context, _ description.ServerSelector) (Server, error) { + return lbcd, nil +} + +func (lbcd *loadBalancedCursorDeployment) Kind() description.TopologyKind { + return description.LoadBalanced +} + +func (lbcd *loadBalancedCursorDeployment) Connection(_ context.Context) (Connection, error) { + return lbcd.conn, nil +} + +func (lbcd *loadBalancedCursorDeployment) ProcessError(err error, conn Connection) ProcessErrorResult { + return lbcd.errorProcessor.ProcessError(err, conn) +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go index 52f81e03..2e20a055 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go @@ -70,6 +70,8 @@ type ConnString struct { Hosts []string J bool JSet bool + LoadBalanced bool + LoadBalancedSet bool LocalThreshold time.Duration LocalThresholdSet bool MaxConnIdleTime time.Duration @@ -338,6 +340,19 @@ func (p *parser) validate() error { if p.Scheme == SchemeMongoDBSRV { return errors.New("a direct connection cannot be made if an SRV URI is used") } + if p.LoadBalancedSet && p.LoadBalanced { + return internal.ErrLoadBalancedWithDirectConnection + } + } + + // Validation for load-balanced mode. + if p.LoadBalancedSet && p.LoadBalanced { + if len(p.Hosts) > 1 { + return internal.ErrLoadBalancedWithMultipleHosts + } + if p.ReplicaSet != "" { + return internal.ErrLoadBalancedWithReplicaSet + } } return nil @@ -643,6 +658,17 @@ func (p *parser) addOption(pair string) error { } p.JSet = true + case "loadbalanced": + switch value { + case "true": + p.LoadBalanced = true + case "false": + p.LoadBalanced = false + default: + return fmt.Errorf("invalid value for %s: %s", key, value) + } + + p.LoadBalancedSet = true case "localthresholdms": n, err := strconv.Atoi(value) if err != nil || n < 0 { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/dns/dns.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/dns/dns.go index e89f6dab..f71337d1 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/dns/dns.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/dns/dns.go @@ -120,8 +120,9 @@ func validateSRVResult(recordFromSRV, inputHostName string) error { } var allowedTXTOptions = map[string]struct{}{ - "authsource": {}, - "replicaset": {}, + "authsource": {}, + "replicaset": {}, + "loadbalanced": {}, } func validateTXTResult(paramsFromTXT []string) error { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/driver.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/driver.go index ec01d51c..6ba7c770 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/driver.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/driver.go @@ -6,6 +6,7 @@ import ( "go.mongodb.org/mongo-driver/mongo/address" "go.mongodb.org/mongo-driver/mongo/description" "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" + "go.mongodb.org/mongo-driver/x/mongo/driver/session" ) // Deployment is implemented by types that can select a server from a deployment. @@ -55,6 +56,25 @@ type Connection interface { Stale() bool } +// PinnedConnection represents a Connection that can be pinned by one or more cursors or transactions. Implementations +// of this interface should maintain the following invariants: +// +// 1. Each Pin* call should increment the number of references for the connection. +// 2. Each Unpin* call should decrement the number of references for the connection. +// 3. Calls to Close() should be ignored until all resources have unpinned the connection. +type PinnedConnection interface { + Connection + PinToCursor() error + PinToTransaction() error + UnpinFromCursor() error + UnpinFromTransaction() error +} + +// The session.LoadBalancedTransactionConnection type is a copy of PinnedConnection that was introduced to avoid +// import cycles. This compile-time assertion ensures that these types remain in sync if the PinnedConnection interface +// is changed in the future. +var _ PinnedConnection = (session.LoadBalancedTransactionConnection)(nil) + // LocalAddresser is a type that is able to supply its local address type LocalAddresser interface { LocalAddress() address.Address diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/errors.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/errors.go index 771f5bae..23c94a8b 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/errors.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/errors.go @@ -14,7 +14,7 @@ import ( var ( retryableCodes = []int32{11600, 11602, 10107, 13435, 13436, 189, 91, 7, 6, 89, 9001, 262} nodeIsRecoveringCodes = []int32{11600, 11602, 13436, 189, 91} - notMasterCodes = []int32{10107, 13435} + notMasterCodes = []int32{10107, 13435, 10058} nodeIsShuttingDownCodes = []int32{11600, 91} unknownReplWriteConcernCode = int32(79) @@ -155,7 +155,8 @@ func (wce WriteConcernError) NodeIsRecovering() bool { return true } } - return strings.Contains(wce.Message, "node is recovering") + hasNoCode := wce.Code == 0 + return hasNoCode && strings.Contains(wce.Message, "node is recovering") } // NodeIsShuttingDown returns true if this error is a node is shutting down error. @@ -165,7 +166,8 @@ func (wce WriteConcernError) NodeIsShuttingDown() bool { return true } } - return strings.Contains(wce.Message, "node is shutting down") + hasNoCode := wce.Code == 0 + return hasNoCode && strings.Contains(wce.Message, "node is shutting down") } // NotMaster returns true if this error is a not master error. @@ -175,7 +177,8 @@ func (wce WriteConcernError) NotMaster() bool { return true } } - return strings.Contains(wce.Message, "not master") + hasNoCode := wce.Code == 0 + return hasNoCode && strings.Contains(wce.Message, "not master") } // WriteError is a non-write concern failure that occurred as a result of a write @@ -184,6 +187,7 @@ type WriteError struct { Index int64 Code int64 Message string + Details bsoncore.Document } func (we WriteError) Error() string { return we.Message } @@ -297,7 +301,8 @@ func (e Error) NodeIsRecovering() bool { return true } } - return strings.Contains(e.Message, "node is recovering") + hasNoCode := e.Code == 0 + return hasNoCode && strings.Contains(e.Message, "node is recovering") } // NodeIsShuttingDown returns true if this error is a node is shutting down error. @@ -307,7 +312,8 @@ func (e Error) NodeIsShuttingDown() bool { return true } } - return strings.Contains(e.Message, "node is shutting down") + hasNoCode := e.Code == 0 + return hasNoCode && strings.Contains(e.Message, "node is shutting down") } // NotMaster returns true if this error is a not master error. @@ -317,7 +323,8 @@ func (e Error) NotMaster() bool { return true } } - return strings.Contains(e.Message, "not master") + hasNoCode := e.Code == 0 + return hasNoCode && strings.Contains(e.Message, "not master") } // NamespaceNotFound returns true if this errors is a NamespaceNotFound error. @@ -325,16 +332,16 @@ func (e Error) NamespaceNotFound() bool { return e.Code == 26 || e.Message == "ns not found" } -// helper method to extract an error from a reader if there is one; first returned item is the -// error if it exists, the second holds parsing errors -func extractError(rdr bsoncore.Document) error { +// ExtractErrorFromServerResponse extracts an error from a server response bsoncore.Document +// if there is one. Also used in testing for SDAM. +func ExtractErrorFromServerResponse(doc bsoncore.Document) error { var errmsg, codeName string var code int32 var labels []string var ok bool var tv *description.TopologyVersion var wcError WriteCommandError - elems, err := rdr.Elements() + elems, err := doc.Elements() if err != nil { return err } @@ -405,6 +412,10 @@ func extractError(rdr bsoncore.Document) error { if msg, exists := doc.Lookup("errmsg").StringValueOK(); exists { we.Message = msg } + if info, exists := doc.Lookup("errInfo").DocumentOK(); exists { + we.Details = make([]byte, len(info)) + copy(we.Details, info) + } wcError.WriteErrors = append(wcError.WriteErrors, we) } case "writeConcernError": diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go index f57565f5..5c2593bd 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go @@ -42,6 +42,8 @@ const ( cryptMaxBsonObjectSize uint32 = 2097152 // minimum wire version necessary to use automatic encryption cryptMinWireVersion int32 = 8 + // minimum wire version necessary to use read snapshots + readSnapshotMinWireVersion int32 = 13 ) // InvalidOperationError is returned from Validate and indicates that a required field is missing @@ -71,6 +73,7 @@ type startedInformation struct { documentSequenceIncluded bool connID string redacted bool + serviceID *primitive.ObjectID } // finishedInformation keeps track of all of the information necessary for monitoring success and failure events. @@ -82,6 +85,16 @@ type finishedInformation struct { connID string startTime time.Time redacted bool + serviceID *primitive.ObjectID +} + +// ResponseInfo contains the context required to parse a server response. +type ResponseInfo struct { + ServerResponse bsoncore.Document + Server Server + Connection Connection + ConnectionDescription description.Server + CurrentIndex int } // Operation is used to execute an operation. It contains all of the common code required to @@ -113,7 +126,7 @@ type Operation struct { // ProcessResponseFn is called after a response to the command is returned. The server is // provided for types like Cursor that are required to run subsequent commands using the same // server. - ProcessResponseFn func(response bsoncore.Document, srvr Server, desc description.Server, currIndex int) error + ProcessResponseFn func(ResponseInfo) error // Selector is the server selector that's used during both initial server selection and // subsequent selection for retries. Depending on the Deployment implementation, the @@ -182,6 +195,12 @@ type Operation struct { // Crypt specifies a Crypt object to use for automatic client side encryption and decryption. Crypt *Crypt + + // ServerAPI specifies options used to configure the API version sent to the server. + ServerAPI *ServerAPIOptions + + // cmdName is only set when serializing OP_MSG and is used internally in readWireMessage. + cmdName string } // shouldEncrypt returns true if this operation should automatically be encrypted. @@ -210,6 +229,44 @@ func (op Operation) selectServer(ctx context.Context) (Server, error) { return op.Deployment.SelectServer(ctx, selector) } +// getServerAndConnection should be used to retrieve a Server and Connection to execute an operation. +func (op Operation) getServerAndConnection(ctx context.Context) (Server, Connection, error) { + server, err := op.selectServer(ctx) + if err != nil { + return nil, nil, err + } + + // If the provided client session has a pinned connection, it should be used for the operation because this + // indicates that we're in a transaction and the target server is behind a load balancer. + if op.Client != nil && op.Client.PinnedConnection != nil { + return server, op.Client.PinnedConnection, nil + } + + // Otherwise, default to checking out a connection from the server's pool. + conn, err := server.Connection(ctx) + if err != nil { + return nil, nil, err + } + + // If we're in load balanced mode and this is the first operation in a transaction, pin the session to a connection. + if conn.Description().LoadBalanced() && op.Client != nil && op.Client.TransactionStarting() { + pinnedConn, ok := conn.(PinnedConnection) + if !ok { + // Close the original connection to avoid a leak. + _ = conn.Close() + return nil, nil, fmt.Errorf("expected Connection used to start a transaction to be a PinnedConnection, but got %T", conn) + } + if err := pinnedConn.PinToTransaction(); err != nil { + // Close the original connection to avoid a leak. + _ = conn.Close() + return nil, nil, fmt.Errorf("error incrementing connection reference count when starting a transaction: %v", err) + } + op.Client.PinnedConnection = pinnedConn + } + + return server, conn, nil +} + // Validate validates this operation, ensuring the fields are set properly. func (op Operation) Validate() error { if op.CommandFn == nil { @@ -235,12 +292,13 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { return err } - srvr, err := op.selectServer(ctx) - if err != nil { - return err + if op.Client != nil { + if err := op.Client.StartCommand(); err != nil { + return err + } } - conn, err := srvr.Connection(ctx) + srvr, conn, err := op.getServerAndConnection(ctx) if err != nil { return err } @@ -337,7 +395,9 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { // set extra data and send event if possible startedInfo.connID = conn.ID() startedInfo.cmdName = op.getCommandName(startedInfo.cmd) + op.cmdName = startedInfo.cmdName startedInfo.redacted = op.redactCommand(startedInfo.cmdName, startedInfo.cmd) + startedInfo.serviceID = conn.Description().ServiceID op.publishStartedEvent(ctx, startedInfo) // get the moreToCome flag information before we compress @@ -357,6 +417,7 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { startTime: time.Now(), connID: startedInfo.connID, redacted: startedInfo.redacted, + serviceID: startedInfo.serviceID, } // roundtrip using either the full roundTripper or a special one for when the moreToCome @@ -396,11 +457,7 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { retries-- original, err = err, nil conn.Close() // Avoid leaking the connection. - srvr, err = op.selectServer(ctx) - if err != nil { - return original - } - conn, err = srvr.Connection(ctx) + srvr, conn, err = op.getServerAndConnection(ctx) if err != nil || conn == nil || !op.retryable(conn.Description()) { if conn != nil { conn.Close() @@ -418,7 +475,14 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { // If the operation isn't being retried, process the response if op.ProcessResponseFn != nil { - perr = op.ProcessResponseFn(res, srvr, desc.Server, currIndex) + info := ResponseInfo{ + ServerResponse: res, + Server: srvr, + Connection: conn, + ConnectionDescription: desc.Server, + CurrentIndex: currIndex, + } + perr = op.ProcessResponseFn(info) } if batching && len(tt.WriteErrors) > 0 && currIndex > 0 { @@ -455,7 +519,9 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { operationErr.Labels = tt.Labels case Error: if tt.HasErrorLabel(TransientTransactionError) || tt.HasErrorLabel(UnknownTransactionCommitResult) { - op.Client.ClearPinnedServer() + if err := op.Client.ClearPinnedResources(); err != nil { + return err + } } if e := err.(Error); retryable && op.Type == Write && e.UnsupportedStorageEngine() { return ErrUnsupportedStorageEngine @@ -482,11 +548,7 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { retries-- original, err = err, nil conn.Close() // Avoid leaking the connection. - srvr, err = op.selectServer(ctx) - if err != nil { - return original - } - conn, err = srvr.Connection(ctx) + srvr, conn, err = op.getServerAndConnection(ctx) if err != nil || conn == nil || !op.retryable(conn.Description()) { if conn != nil { conn.Close() @@ -504,7 +566,14 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { // If the operation isn't being retried, process the response if op.ProcessResponseFn != nil { - perr = op.ProcessResponseFn(res, srvr, desc.Server, currIndex) + info := ResponseInfo{ + ServerResponse: res, + Server: srvr, + Connection: conn, + ConnectionDescription: desc.Server, + CurrentIndex: currIndex, + } + perr = op.ProcessResponseFn(info) } if op.Client != nil && op.Client.Committing && (retryableErr || tt.Code == 50) { @@ -517,14 +586,28 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { return ErrUnacknowledgedWrite } if op.ProcessResponseFn != nil { - perr = op.ProcessResponseFn(res, srvr, desc.Server, currIndex) + info := ResponseInfo{ + ServerResponse: res, + Server: srvr, + Connection: conn, + ConnectionDescription: desc.Server, + CurrentIndex: currIndex, + } + perr = op.ProcessResponseFn(info) } if perr != nil { return perr } default: if op.ProcessResponseFn != nil { - perr = op.ProcessResponseFn(res, srvr, desc.Server, currIndex) + info := ResponseInfo{ + ServerResponse: res, + Server: srvr, + Connection: conn, + ConnectionDescription: desc.Server, + CurrentIndex: currIndex, + } + perr = op.ProcessResponseFn(info) } return err } @@ -635,6 +718,11 @@ func (op Operation) readWireMessage(ctx context.Context, conn Connection, wm []b op.updateOperationTime(res) op.Client.UpdateRecoveryToken(bson.Raw(res)) + // Update snapshot time if operation was a "find", "aggregate" or "distinct". + if op.cmdName == "find" || op.cmdName == "aggregate" || op.cmdName == "distinct" { + op.Client.UpdateSnapshotTime(res) + } + if err != nil { return res, err } @@ -772,6 +860,7 @@ func (op Operation) createQueryWireMessage(dst []byte, desc description.Selected } dst = op.addClusterTime(dst, desc) + dst = op.addServerAPI(dst) dst, _ = bsoncore.AppendDocumentEnd(dst, idx) // Command monitoring only reports the document inside $query @@ -826,13 +915,13 @@ func (op Operation) createMsgWireMessage(ctx context.Context, dst []byte, desc d if err != nil { return dst, info, err } - dst, err = op.addSession(dst, desc) if err != nil { return dst, info, err } dst = op.addClusterTime(dst, desc) + dst = op.addServerAPI(dst) dst = bsoncore.AppendStringElement(dst, "$db", op.Database) rp, err := op.createReadPref(desc.Server.Kind, desc.Kind, false) @@ -901,6 +990,23 @@ func (op Operation) addCommandFields(ctx context.Context, dst []byte, desc descr return dst, nil } +// addServerAPI adds the relevant fields for server API specification to the wire message in dst. +func (op Operation) addServerAPI(dst []byte) []byte { + sa := op.ServerAPI + if sa == nil { + return dst + } + + dst = bsoncore.AppendStringElement(dst, "apiVersion", sa.ServerAPIVersion) + if sa.Strict != nil { + dst = bsoncore.AppendBooleanElement(dst, "apiStrict", *sa.Strict) + } + if sa.DeprecationErrors != nil { + dst = bsoncore.AppendBooleanElement(dst, "apiDeprecationErrors", *sa.DeprecationErrors) + } + return dst +} + func (op Operation) addReadConcern(dst []byte, desc description.SelectedServer) ([]byte, error) { if op.MinimumReadConcernWireVersion > 0 && (desc.WireVersion == nil || !desc.WireVersion.Includes(op.MinimumReadConcernWireVersion)) { return dst, nil @@ -917,6 +1023,13 @@ func (op Operation) addReadConcern(dst []byte, desc description.SelectedServer) rc = readconcern.New() } + if client != nil && client.Snapshot { + if desc.WireVersion.Max < readSnapshotMinWireVersion { + return dst, errors.New("snapshot reads require MongoDB 5.0 or later") + } + rc = readconcern.Snapshot() + } + if rc == nil { return dst, nil } @@ -926,10 +1039,17 @@ func (op Operation) addReadConcern(dst []byte, desc description.SelectedServer) return dst, err } - if sessionsSupported(desc.WireVersion) && client != nil && client.Consistent && client.OperationTime != nil { - data = data[:len(data)-1] // remove the null byte - data = bsoncore.AppendTimestampElement(data, "afterClusterTime", client.OperationTime.T, client.OperationTime.I) - data, _ = bsoncore.AppendDocumentEnd(data, 0) + if sessionsSupported(desc.WireVersion) && client != nil { + if client.Consistent && client.OperationTime != nil { + data = data[:len(data)-1] // remove the null byte + data = bsoncore.AppendTimestampElement(data, "afterClusterTime", client.OperationTime.T, client.OperationTime.I) + data, _ = bsoncore.AppendDocumentEnd(data, 0) + } + if client.Snapshot && client.SnapshotTime != nil { + data = data[:len(data)-1] // remove the null byte + data = bsoncore.AppendTimestampElement(data, "atClusterTime", client.SnapshotTime.T, client.SnapshotTime.I) + data, _ = bsoncore.AppendDocumentEnd(data, 0) + } } if len(data) == bsoncore.EmptyDocumentLength { @@ -983,9 +1103,7 @@ func (op Operation) addSession(dst []byte, desc description.SelectedServer) ([]b dst = bsoncore.AppendBooleanElement(dst, "autocommit", false) } - client.ApplyCommand(desc.Server) - - return dst, nil + return dst, client.ApplyCommand(desc.Server) } func (op Operation) addClusterTime(dst []byte, desc description.SelectedServer) []byte { @@ -1265,7 +1383,7 @@ func (op Operation) decodeResult(wm []byte) (bsoncore.Document, error) { return nil, NewCommandResponseError("malformed OP_REPLY: invalid document", err) } - return rdr, extractError(rdr) + return rdr, ExtractErrorFromServerResponse(rdr) case wiremessage.OpMsg: _, wm, ok = wiremessage.ReadMsgFlags(wm) if !ok { @@ -1302,7 +1420,7 @@ func (op Operation) decodeResult(wm []byte) (bsoncore.Document, error) { return nil, NewCommandResponseError("malformed OP_MSG: invalid document", err) } - return res, extractError(res) + return res, ExtractErrorFromServerResponse(res) default: return nil, fmt.Errorf("cannot decode result from %s", opcode) } @@ -1321,7 +1439,7 @@ func (op *Operation) redactCommand(cmd string, doc bsoncore.Document) bool { return true } - if strings.ToLower(cmd) != "ismaster" { + if strings.ToLower(cmd) != "ismaster" && cmd != "hello" { return false } @@ -1357,6 +1475,7 @@ func (op Operation) publishStartedEvent(ctx context.Context, info startedInforma CommandName: info.cmdName, RequestID: int64(info.requestID), ConnectionID: info.connID, + ServiceID: info.serviceID, } op.CommandMonitor.Started(ctx, started) } @@ -1383,6 +1502,7 @@ func (op Operation) publishFinishedEvent(ctx context.Context, info finishedInfor RequestID: int64(info.requestID), ConnectionID: info.connID, DurationNanos: durationNanos, + ServiceID: info.serviceID, } if success { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.go index 885c9b88..b1957a3e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.go @@ -33,6 +33,7 @@ type AbortTransaction struct { selector description.ServerSelector writeConcern *writeconcern.WriteConcern retry *driver.RetryMode + serverAPI *driver.ServerAPIOptions } // NewAbortTransaction constructs and returns a new AbortTransaction. @@ -40,7 +41,7 @@ func NewAbortTransaction() *AbortTransaction { return &AbortTransaction{} } -func (at *AbortTransaction) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, currIndex int) error { +func (at *AbortTransaction) processResponse(driver.ResponseInfo) error { var err error return err } @@ -64,6 +65,7 @@ func (at *AbortTransaction) Execute(ctx context.Context) error { Deployment: at.deployment, Selector: at.selector, WriteConcern: at.writeConcern, + ServerAPI: at.serverAPI, }.Execute(ctx, nil) } @@ -187,3 +189,13 @@ func (at *AbortTransaction) Retry(retry driver.RetryMode) *AbortTransaction { at.retry = &retry return at } + +// ServerAPI sets the server API version for this operation. +func (at *AbortTransaction) ServerAPI(serverAPI *driver.ServerAPIOptions) *AbortTransaction { + if at == nil { + at = new(AbortTransaction) + } + + at.serverAPI = serverAPI + return at +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/aggregate.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/aggregate.go index 2b329485..311d2874 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/aggregate.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/aggregate.go @@ -45,6 +45,8 @@ type Aggregate struct { selector description.ServerSelector writeConcern *writeconcern.WriteConcern crypt *driver.Crypt + serverAPI *driver.ServerAPIOptions + let bsoncore.Document result driver.CursorResponse } @@ -62,6 +64,7 @@ func (a *Aggregate) Result(opts driver.CursorOptions) (*driver.BatchCursor, erro clientSession := a.session clock := a.clock + opts.ServerAPI = a.serverAPI return driver.NewBatchCursor(a.result, clientSession, clock, opts) } @@ -69,10 +72,10 @@ func (a *Aggregate) ResultCursorResponse() driver.CursorResponse { return a.result } -func (a *Aggregate) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, currIndex int) error { +func (a *Aggregate) processResponse(info driver.ResponseInfo) error { var err error - a.result, err = driver.NewCursorResponse(response, srvr, desc) + a.result, err = driver.NewCursorResponse(info) return err } @@ -100,6 +103,7 @@ func (a *Aggregate) Execute(ctx context.Context) error { WriteConcern: a.writeConcern, Crypt: a.crypt, MinimumWriteConcernWireVersion: 5, + ServerAPI: a.serverAPI, }.Execute(ctx, nil) } @@ -146,6 +150,9 @@ func (a *Aggregate) command(dst []byte, desc description.SelectedServer) ([]byte dst = bsoncore.AppendArrayElement(dst, "pipeline", a.pipeline) } + if a.let != nil { + dst = bsoncore.AppendDocumentElement(dst, "let", a.let) + } cursorDoc, _ = bsoncore.AppendDocumentEnd(cursorDoc, cursorIdx) dst = bsoncore.AppendDocumentElement(dst, "cursor", cursorDoc) @@ -353,3 +360,23 @@ func (a *Aggregate) Crypt(crypt *driver.Crypt) *Aggregate { a.crypt = crypt return a } + +// ServerAPI sets the server API version for this operation. +func (a *Aggregate) ServerAPI(serverAPI *driver.ServerAPIOptions) *Aggregate { + if a == nil { + a = new(Aggregate) + } + + a.serverAPI = serverAPI + return a +} + +// Let specifies the let document to use. This option is only valid for server versions 5.0 and above. +func (a *Aggregate) Let(let bsoncore.Document) *Aggregate { + if a == nil { + a = new(Aggregate) + } + + a.let = let + return a +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/command.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/command.go index 3e04814f..f2a1ca46 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/command.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/command.go @@ -26,26 +26,45 @@ type Command struct { clock *session.ClusterClock session *session.Client monitor *event.CommandMonitor - result bsoncore.Document + resultResponse bsoncore.Document + resultCursor *driver.BatchCursor srvr driver.Server desc description.Server crypt *driver.Crypt + serverAPI *driver.ServerAPIOptions + createCursor bool + cursorOpts driver.CursorOptions } -// NewCommand constructs and returns a new Command. -func NewCommand(command bsoncore.Document) *Command { return &Command{command: command} } +// NewCommand constructs and returns a new Command. Once the operation is executed, the result may only be accessed via +// the Result() function. +func NewCommand(command bsoncore.Document) *Command { + return &Command{ + command: command, + } +} + +// NewCursorCommand constructs a new Command. Once the operation is executed, the server response will be used to +// construct a cursor, which can be accessed via the ResultCursor() function. +func NewCursorCommand(command bsoncore.Document, cursorOpts driver.CursorOptions) *Command { + return &Command{ + command: command, + cursorOpts: cursorOpts, + createCursor: true, + } +} // Result returns the result of executing this operation. -func (c *Command) Result() bsoncore.Document { return c.result } +func (c *Command) Result() bsoncore.Document { return c.resultResponse } -// ResultCursor parses the command response as a cursor and returns the resulting BatchCursor. -func (c *Command) ResultCursor(opts driver.CursorOptions) (*driver.BatchCursor, error) { - cursorRes, err := driver.NewCursorResponse(c.result, c.srvr, c.desc) - if err != nil { - return nil, err +// ResultCursor returns the BatchCursor that was constructed using the command response. If the operation was not +// configured to create a cursor (i.e. it was created using NewCommand rather than NewCursorCommand), this function +// will return nil and an error. +func (c *Command) ResultCursor() (*driver.BatchCursor, error) { + if !c.createCursor { + return nil, errors.New("command operation was not configured to create a cursor, but a result cursor was requested") } - - return driver.NewBatchCursor(cursorRes, c.session, c.clock, opts) + return c.resultCursor, nil } // Execute runs this operations and returns an error if the operaiton did not execute successfully. @@ -58,10 +77,19 @@ func (c *Command) Execute(ctx context.Context) error { CommandFn: func(dst []byte, desc description.SelectedServer) ([]byte, error) { return append(dst, c.command[4:len(c.command)-1]...), nil }, - ProcessResponseFn: func(resp bsoncore.Document, srvr driver.Server, desc description.Server, currIndex int) error { - c.result = resp - c.srvr = srvr - c.desc = desc + ProcessResponseFn: func(info driver.ResponseInfo) error { + c.resultResponse = info.ServerResponse + + if c.createCursor { + cursorRes, err := driver.NewCursorResponse(info) + if err != nil { + return err + } + + c.resultCursor, err = driver.NewBatchCursor(cursorRes, c.session, c.clock, c.cursorOpts) + return err + } + return nil }, Client: c.session, @@ -72,19 +100,10 @@ func (c *Command) Execute(ctx context.Context) error { ReadPreference: c.readPreference, Selector: c.selector, Crypt: c.crypt, + ServerAPI: c.serverAPI, }.Execute(ctx, nil) } -// Command sets the command to be run. -func (c *Command) Command(command bsoncore.Document) *Command { - if c == nil { - c = new(Command) - } - - c.command = command - return c -} - // Session sets the session for this operation. func (c *Command) Session(session *session.Client) *Command { if c == nil { @@ -174,3 +193,13 @@ func (c *Command) Crypt(crypt *driver.Crypt) *Command { c.crypt = crypt return c } + +// ServerAPI sets the server API version for this operation. +func (c *Command) ServerAPI(serverAPI *driver.ServerAPIOptions) *Command { + if c == nil { + c = new(Command) + } + + c.serverAPI = serverAPI + return c +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.go index 13307dc3..c5605250 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.go @@ -33,6 +33,7 @@ type CommitTransaction struct { selector description.ServerSelector writeConcern *writeconcern.WriteConcern retry *driver.RetryMode + serverAPI *driver.ServerAPIOptions } // NewCommitTransaction constructs and returns a new CommitTransaction. @@ -40,7 +41,7 @@ func NewCommitTransaction() *CommitTransaction { return &CommitTransaction{} } -func (ct *CommitTransaction) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (ct *CommitTransaction) processResponse(driver.ResponseInfo) error { var err error return err } @@ -64,6 +65,7 @@ func (ct *CommitTransaction) Execute(ctx context.Context) error { Deployment: ct.deployment, Selector: ct.selector, WriteConcern: ct.writeConcern, + ServerAPI: ct.serverAPI, }.Execute(ctx, nil) } @@ -190,3 +192,13 @@ func (ct *CommitTransaction) Retry(retry driver.RetryMode) *CommitTransaction { ct.retry = &retry return ct } + +// ServerAPI sets the server API version for this operation. +func (ct *CommitTransaction) ServerAPI(serverAPI *driver.ServerAPIOptions) *CommitTransaction { + if ct == nil { + ct = new(CommitTransaction) + } + + ct.serverAPI = serverAPI + return ct +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.go index c3c5dc75..f38d6aa3 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.go @@ -38,6 +38,7 @@ type Count struct { selector description.ServerSelector retry *driver.RetryMode result CountResult + serverAPI *driver.ServerAPIOptions } type CountResult struct { @@ -51,17 +52,41 @@ func buildCountResult(response bsoncore.Document, srvr driver.Server) (CountResu return CountResult{}, err } cr := CountResult{} +elementLoop: for _, element := range elements { switch element.Key() { - case "n": + case "n": // for count using original command var ok bool cr.N, ok = element.Value().AsInt64OK() if !ok { - err = fmt.Errorf("response field 'n' is type int64, but received BSON type %s", element.Value().Type) + err = fmt.Errorf("response field 'n' is type int64, but received BSON type %s", + element.Value().Type) + break elementLoop + } + case "cursor": // for count using aggregate with $collStats + firstBatch, err := element.Value().Document().LookupErr("firstBatch") + if err != nil { + break elementLoop + } + + // get count value from first batch + val := firstBatch.Array().Index(0) + count, err := val.Document().LookupErr("n") + if err != nil { + break elementLoop + } + + // use count as Int64 for result + var ok bool + cr.N, ok = count.AsInt64OK() + if !ok { + err = fmt.Errorf("response field 'n' is type int64, but received BSON type %s", + element.Value().Type) + break elementLoop } } } - return cr, nil + return cr, err } // NewCount constructs and returns a new Count. @@ -72,9 +97,9 @@ func NewCount() *Count { // Result returns the result of executing this operation. func (c *Count) Result() CountResult { return c.result } -func (c *Count) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (c *Count) processResponse(info driver.ResponseInfo) error { var err error - c.result, err = buildCountResult(response, srvr) + c.result, err = buildCountResult(info.ServerResponse, info.Server) return err } @@ -84,7 +109,7 @@ func (c *Count) Execute(ctx context.Context) error { return errors.New("the Count operation must have a Deployment set before Execute can be called") } - return driver.Operation{ + err := driver.Operation{ CommandFn: c.command, ProcessResponseFn: c.processResponse, RetryMode: c.retry, @@ -98,18 +123,57 @@ func (c *Count) Execute(ctx context.Context) error { ReadConcern: c.readConcern, ReadPreference: c.readPreference, Selector: c.selector, + ServerAPI: c.serverAPI, }.Execute(ctx, nil) + // Swallow error if NamespaceNotFound(26) is returned from aggregate on non-existent namespace + if err != nil { + dErr, ok := err.(driver.Error) + if ok && dErr.Code == 26 { + err = nil + } + } + return err } func (c *Count) command(dst []byte, desc description.SelectedServer) ([]byte, error) { - dst = bsoncore.AppendStringElement(dst, "count", c.collection) + switch { + case desc.WireVersion.Max < 12: // If wire version < 12 (4.9.0), use count command + dst = bsoncore.AppendStringElement(dst, "count", c.collection) + if c.query != nil { + dst = bsoncore.AppendDocumentElement(dst, "query", c.query) + } + default: // If wire version >= 12 (4.9.0), use aggregate with $collStats + dst = bsoncore.AppendStringElement(dst, "aggregate", c.collection) + var idx int32 + idx, dst = bsoncore.AppendDocumentElementStart(dst, "cursor") + dst, _ = bsoncore.AppendDocumentEnd(dst, idx) + if c.query != nil { + return nil, fmt.Errorf("'query' cannot be set on Count against servers at or above 4.9.0") + } + + collStatsStage := bsoncore.NewDocumentBuilder(). + AppendDocument("$collStats", bsoncore.NewDocumentBuilder(). + AppendDocument("count", bsoncore.NewDocumentBuilder().Build()). + Build()). + Build() + groupStage := bsoncore.NewDocumentBuilder(). + AppendDocument("$group", bsoncore.NewDocumentBuilder(). + AppendInt64("_id", 1). + AppendDocument("n", bsoncore.NewDocumentBuilder(). + AppendString("$sum", "$count").Build()). + Build()). + Build() + countPipeline := bsoncore.NewArrayBuilder(). + AppendDocument(collStatsStage). + AppendDocument(groupStage). + Build() + dst = bsoncore.AppendArrayElement(dst, "pipeline", countPipeline) + } + if c.maxTimeMS != nil { dst = bsoncore.AppendInt64Element(dst, "maxTimeMS", *c.maxTimeMS) } - if c.query != nil { - dst = bsoncore.AppendDocumentElement(dst, "query", c.query) - } return dst, nil } @@ -243,3 +307,13 @@ func (c *Count) Retry(retry driver.RetryMode) *Count { c.retry = &retry return c } + +// ServerAPI sets the server API version for this operation. +func (c *Count) ServerAPI(serverAPI *driver.ServerAPIOptions) *Count { + if c == nil { + c = new(Count) + } + + c.serverAPI = serverAPI + return c +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/create.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/create.go index 45e376a9..a06fac7e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/create.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/create.go @@ -42,6 +42,9 @@ type Create struct { deployment driver.Deployment selector description.ServerSelector writeConcern *writeconcern.WriteConcern + serverAPI *driver.ServerAPIOptions + expireAfterSeconds *int64 + timeSeries bsoncore.Document } // NewCreate constructs and returns a new Create. @@ -51,7 +54,7 @@ func NewCreate(collectionName string) *Create { } } -func (c *Create) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (c *Create) processResponse(driver.ResponseInfo) error { var err error return err } @@ -73,6 +76,7 @@ func (c *Create) Execute(ctx context.Context) error { Deployment: c.deployment, Selector: c.selector, WriteConcern: c.writeConcern, + ServerAPI: c.serverAPI, }.Execute(ctx, nil) } @@ -117,6 +121,12 @@ func (c *Create) command(dst []byte, desc description.SelectedServer) ([]byte, e if c.viewOn != nil { dst = bsoncore.AppendStringElement(dst, "viewOn", *c.viewOn) } + if c.expireAfterSeconds != nil { + dst = bsoncore.AppendInt64Element(dst, "expireAfterSeconds", *c.expireAfterSeconds) + } + if c.timeSeries != nil { + dst = bsoncore.AppendDocumentElement(dst, "timeseries", c.timeSeries) + } return dst, nil } @@ -319,3 +329,33 @@ func (c *Create) WriteConcern(writeConcern *writeconcern.WriteConcern) *Create { c.writeConcern = writeConcern return c } + +// ServerAPI sets the server API version for this operation. +func (c *Create) ServerAPI(serverAPI *driver.ServerAPIOptions) *Create { + if c == nil { + c = new(Create) + } + + c.serverAPI = serverAPI + return c +} + +// ExpireAfterSeconds sets the seconds to wait before deleting old time-series data. +func (c *Create) ExpireAfterSeconds(eas int64) *Create { + if c == nil { + c = new(Create) + } + + c.expireAfterSeconds = &eas + return c +} + +// TimeSeries sets the time series options for this operation. +func (c *Create) TimeSeries(timeSeries bsoncore.Document) *Create { + if c == nil { + c = new(Create) + } + + c.timeSeries = timeSeries + return c +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.go index 289a9c09..63d3fc9b 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.go @@ -37,6 +37,7 @@ type CreateIndexes struct { selector description.ServerSelector writeConcern *writeconcern.WriteConcern result CreateIndexesResult + serverAPI *driver.ServerAPIOptions } type CreateIndexesResult struct { @@ -89,9 +90,9 @@ func NewCreateIndexes(indexes bsoncore.Document) *CreateIndexes { // Result returns the result of executing this operation. func (ci *CreateIndexes) Result() CreateIndexesResult { return ci.result } -func (ci *CreateIndexes) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (ci *CreateIndexes) processResponse(info driver.ResponseInfo) error { var err error - ci.result, err = buildCreateIndexesResult(response, srvr) + ci.result, err = buildCreateIndexesResult(info.ServerResponse, info.Server) return err } @@ -112,6 +113,7 @@ func (ci *CreateIndexes) Execute(ctx context.Context) error { Deployment: ci.deployment, Selector: ci.selector, WriteConcern: ci.writeConcern, + ServerAPI: ci.serverAPI, }.Execute(ctx, nil) } @@ -254,3 +256,13 @@ func (ci *CreateIndexes) WriteConcern(writeConcern *writeconcern.WriteConcern) * ci.writeConcern = writeConcern return ci } + +// ServerAPI sets the server API version for this operation. +func (ci *CreateIndexes) ServerAPI(serverAPI *driver.ServerAPIOptions) *CreateIndexes { + if ci == nil { + ci = new(CreateIndexes) + } + + ci.serverAPI = serverAPI + return ci +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/delete.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/delete.go index f915e015..c221f8a3 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/delete.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/delete.go @@ -37,6 +37,7 @@ type Delete struct { retry *driver.RetryMode hint *bool result DeleteResult + serverAPI *driver.ServerAPIOptions } type DeleteResult struct { @@ -73,8 +74,8 @@ func NewDelete(deletes ...bsoncore.Document) *Delete { // Result returns the result of executing this operation. func (d *Delete) Result() DeleteResult { return d.result } -func (d *Delete) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { - dr, err := buildDeleteResult(response, srvr) +func (d *Delete) processResponse(info driver.ResponseInfo) error { + dr, err := buildDeleteResult(info.ServerResponse, info.Server) d.result.N += dr.N return err } @@ -104,6 +105,7 @@ func (d *Delete) Execute(ctx context.Context) error { Deployment: d.deployment, Selector: d.selector, WriteConcern: d.writeConcern, + ServerAPI: d.serverAPI, }.Execute(ctx, nil) } @@ -259,3 +261,13 @@ func (d *Delete) Hint(hint bool) *Delete { d.hint = &hint return d } + +// ServerAPI sets the server API version for this operation. +func (d *Delete) ServerAPI(serverAPI *driver.ServerAPIOptions) *Delete { + if d == nil { + d = new(Delete) + } + + d.serverAPI = serverAPI + return d +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.go index 28dd5c62..a233b9af 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.go @@ -39,6 +39,7 @@ type Distinct struct { selector description.ServerSelector retry *driver.RetryMode result DistinctResult + serverAPI *driver.ServerAPIOptions } type DistinctResult struct { @@ -72,9 +73,9 @@ func NewDistinct(key string, query bsoncore.Document) *Distinct { // Result returns the result of executing this operation. func (d *Distinct) Result() DistinctResult { return d.result } -func (d *Distinct) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (d *Distinct) processResponse(info driver.ResponseInfo) error { var err error - d.result, err = buildDistinctResult(response, srvr) + d.result, err = buildDistinctResult(info.ServerResponse, info.Server) return err } @@ -98,6 +99,7 @@ func (d *Distinct) Execute(ctx context.Context) error { ReadConcern: d.readConcern, ReadPreference: d.readPreference, Selector: d.selector, + ServerAPI: d.serverAPI, }.Execute(ctx, nil) } @@ -272,3 +274,13 @@ func (d *Distinct) Retry(retry driver.RetryMode) *Distinct { d.retry = &retry return d } + +// ServerAPI sets the server API version for this operation. +func (d *Distinct) ServerAPI(serverAPI *driver.ServerAPIOptions) *Distinct { + if d == nil { + d = new(Distinct) + } + + d.serverAPI = serverAPI + return d +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.go index 5d1504b5..769e486e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.go @@ -33,6 +33,7 @@ type DropCollection struct { selector description.ServerSelector writeConcern *writeconcern.WriteConcern result DropCollectionResult + serverAPI *driver.ServerAPIOptions } type DropCollectionResult struct { @@ -75,9 +76,9 @@ func NewDropCollection() *DropCollection { // Result returns the result of executing this operation. func (dc *DropCollection) Result() DropCollectionResult { return dc.result } -func (dc *DropCollection) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (dc *DropCollection) processResponse(info driver.ResponseInfo) error { var err error - dc.result, err = buildDropCollectionResult(response, srvr) + dc.result, err = buildDropCollectionResult(info.ServerResponse, info.Server) return err } @@ -98,6 +99,7 @@ func (dc *DropCollection) Execute(ctx context.Context) error { Deployment: dc.deployment, Selector: dc.selector, WriteConcern: dc.writeConcern, + ServerAPI: dc.serverAPI, }.Execute(ctx, nil) } @@ -196,3 +198,13 @@ func (dc *DropCollection) WriteConcern(writeConcern *writeconcern.WriteConcern) dc.writeConcern = writeConcern return dc } + +// ServerAPI sets the server API version for this operation. +func (dc *DropCollection) ServerAPI(serverAPI *driver.ServerAPIOptions) *DropCollection { + if dc == nil { + dc = new(DropCollection) + } + + dc.serverAPI = serverAPI + return dc +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.go index 28068bd9..47bf4f87 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.go @@ -11,7 +11,6 @@ package operation import ( "context" "errors" - "fmt" "go.mongodb.org/mongo-driver/event" "go.mongodb.org/mongo-driver/mongo/description" @@ -31,31 +30,7 @@ type DropDatabase struct { deployment driver.Deployment selector description.ServerSelector writeConcern *writeconcern.WriteConcern - result DropDatabaseResult -} - -type DropDatabaseResult struct { - // The dropped database. - Dropped string -} - -func buildDropDatabaseResult(response bsoncore.Document, srvr driver.Server) (DropDatabaseResult, error) { - elements, err := response.Elements() - if err != nil { - return DropDatabaseResult{}, err - } - ddr := DropDatabaseResult{} - for _, element := range elements { - switch element.Key() { - case "dropped": - var ok bool - ddr.Dropped, ok = element.Value().StringValueOK() - if !ok { - err = fmt.Errorf("response field 'dropped' is type string, but received BSON type %s", element.Value().Type) - } - } - } - return ddr, nil + serverAPI *driver.ServerAPIOptions } // NewDropDatabase constructs and returns a new DropDatabase. @@ -63,15 +38,6 @@ func NewDropDatabase() *DropDatabase { return &DropDatabase{} } -// Result returns the result of executing this operation. -func (dd *DropDatabase) Result() DropDatabaseResult { return dd.result } - -func (dd *DropDatabase) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { - var err error - dd.result, err = buildDropDatabaseResult(response, srvr) - return err -} - // Execute runs this operations and returns an error if the operaiton did not execute successfully. func (dd *DropDatabase) Execute(ctx context.Context) error { if dd.deployment == nil { @@ -79,16 +45,16 @@ func (dd *DropDatabase) Execute(ctx context.Context) error { } return driver.Operation{ - CommandFn: dd.command, - ProcessResponseFn: dd.processResponse, - Client: dd.session, - Clock: dd.clock, - CommandMonitor: dd.monitor, - Crypt: dd.crypt, - Database: dd.database, - Deployment: dd.deployment, - Selector: dd.selector, - WriteConcern: dd.writeConcern, + CommandFn: dd.command, + Client: dd.session, + Clock: dd.clock, + CommandMonitor: dd.monitor, + Crypt: dd.crypt, + Database: dd.database, + Deployment: dd.deployment, + Selector: dd.selector, + WriteConcern: dd.writeConcern, + ServerAPI: dd.serverAPI, }.Execute(ctx, nil) } @@ -178,3 +144,13 @@ func (dd *DropDatabase) WriteConcern(writeConcern *writeconcern.WriteConcern) *D dd.writeConcern = writeConcern return dd } + +// ServerAPI sets the server API version for this operation. +func (dd *DropDatabase) ServerAPI(serverAPI *driver.ServerAPIOptions) *DropDatabase { + if dd == nil { + dd = new(DropDatabase) + } + + dd.serverAPI = serverAPI + return dd +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.go index 5d365697..fa53a0f0 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.go @@ -35,6 +35,7 @@ type DropIndexes struct { selector description.ServerSelector writeConcern *writeconcern.WriteConcern result DropIndexesResult + serverAPI *driver.ServerAPIOptions } type DropIndexesResult struct { @@ -71,9 +72,9 @@ func NewDropIndexes(index string) *DropIndexes { // Result returns the result of executing this operation. func (di *DropIndexes) Result() DropIndexesResult { return di.result } -func (di *DropIndexes) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (di *DropIndexes) processResponse(info driver.ResponseInfo) error { var err error - di.result, err = buildDropIndexesResult(response, srvr) + di.result, err = buildDropIndexesResult(info.ServerResponse, info.Server) return err } @@ -94,6 +95,7 @@ func (di *DropIndexes) Execute(ctx context.Context) error { Deployment: di.deployment, Selector: di.selector, WriteConcern: di.writeConcern, + ServerAPI: di.serverAPI, }.Execute(ctx, nil) } @@ -219,3 +221,13 @@ func (di *DropIndexes) WriteConcern(writeConcern *writeconcern.WriteConcern) *Dr di.writeConcern = writeConcern return di } + +// ServerAPI sets the server API version for this operation. +func (di *DropIndexes) ServerAPI(serverAPI *driver.ServerAPIOptions) *DropIndexes { + if di == nil { + di = new(DropIndexes) + } + + di.serverAPI = serverAPI + return di +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.go index 8f8a3baa..94381801 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.go @@ -29,6 +29,7 @@ type EndSessions struct { database string deployment driver.Deployment selector description.ServerSelector + serverAPI *driver.ServerAPIOptions } // NewEndSessions constructs and returns a new EndSessions. @@ -38,7 +39,7 @@ func NewEndSessions(sessionIDs bsoncore.Document) *EndSessions { } } -func (es *EndSessions) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (es *EndSessions) processResponse(driver.ResponseInfo) error { var err error return err } @@ -59,6 +60,7 @@ func (es *EndSessions) Execute(ctx context.Context) error { Database: es.database, Deployment: es.deployment, Selector: es.selector, + ServerAPI: es.serverAPI, }.Execute(ctx, nil) } @@ -149,3 +151,13 @@ func (es *EndSessions) ServerSelector(selector description.ServerSelector) *EndS es.selector = selector return es } + +// ServerAPI sets the server API version for this operation. +func (es *EndSessions) ServerAPI(serverAPI *driver.ServerAPIOptions) *EndSessions { + if es == nil { + es = new(EndSessions) + } + + es.serverAPI = serverAPI + return es +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find.go index 0675a960..8e3e0f1c 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find.go @@ -58,6 +58,7 @@ type Find struct { selector description.ServerSelector retry *driver.RetryMode result driver.CursorResponse + serverAPI *driver.ServerAPIOptions } // NewFind constructs and returns a new Find. @@ -69,12 +70,13 @@ func NewFind(filter bsoncore.Document) *Find { // Result returns the result of executing this operation. func (f *Find) Result(opts driver.CursorOptions) (*driver.BatchCursor, error) { + opts.ServerAPI = f.serverAPI return driver.NewBatchCursor(f.result, f.session, f.clock, opts) } -func (f *Find) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (f *Find) processResponse(info driver.ResponseInfo) error { var err error - f.result, err = driver.NewCursorResponse(response, srvr, desc) + f.result, err = driver.NewCursorResponse(info) return err } @@ -99,6 +101,7 @@ func (f *Find) Execute(ctx context.Context) error { ReadPreference: f.readPreference, Selector: f.selector, Legacy: driver.LegacyFind, + ServerAPI: f.serverAPI, }.Execute(ctx, nil) } @@ -510,3 +513,13 @@ func (f *Find) Retry(retry driver.RetryMode) *Find { f.retry = &retry return f } + +// ServerAPI sets the server API version for this operation. +func (f *Find) ServerAPI(serverAPI *driver.ServerAPIOptions) *Find { + if f == nil { + f = new(Find) + } + + f.serverAPI = serverAPI + return f +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find_and_modify.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find_and_modify.go index e2e1f8e1..d1ad66f0 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find_and_modify.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find_and_modify.go @@ -47,6 +47,7 @@ type FindAndModify struct { retry *driver.RetryMode crypt *driver.Crypt hint bsoncore.Value + serverAPI *driver.ServerAPIOptions result FindAndModifyResult } @@ -107,10 +108,10 @@ func NewFindAndModify(query bsoncore.Document) *FindAndModify { // Result returns the result of executing this operation. func (fam *FindAndModify) Result() FindAndModifyResult { return fam.result } -func (fam *FindAndModify) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (fam *FindAndModify) processResponse(info driver.ResponseInfo) error { var err error - fam.result, err = buildFindAndModifyResult(response, srvr) + fam.result, err = buildFindAndModifyResult(info.ServerResponse, info.Server) return err } @@ -135,6 +136,7 @@ func (fam *FindAndModify) Execute(ctx context.Context) error { Selector: fam.selector, WriteConcern: fam.writeConcern, Crypt: fam.crypt, + ServerAPI: fam.serverAPI, }.Execute(ctx, nil) } @@ -426,3 +428,13 @@ func (fam *FindAndModify) Hint(hint bsoncore.Value) *FindAndModify { fam.hint = hint return fam } + +// ServerAPI sets the server API version for this operation. +func (fam *FindAndModify) ServerAPI(serverAPI *driver.ServerAPIOptions) *FindAndModify { + if fam == nil { + fam = new(FindAndModify) + } + + fam.serverAPI = serverAPI + return fam +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.go index 13494d0d..b4d09537 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.go @@ -37,6 +37,7 @@ type Insert struct { writeConcern *writeconcern.WriteConcern retry *driver.RetryMode result InsertResult + serverAPI *driver.ServerAPIOptions } type InsertResult struct { @@ -73,8 +74,8 @@ func NewInsert(documents ...bsoncore.Document) *Insert { // Result returns the result of executing this operation. func (i *Insert) Result() InsertResult { return i.result } -func (i *Insert) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, insert int) error { - ir, err := buildInsertResult(response, srvr) +func (i *Insert) processResponse(info driver.ResponseInfo) error { + ir, err := buildInsertResult(info.ServerResponse, info.Server) i.result.N += ir.N return err } @@ -104,6 +105,7 @@ func (i *Insert) Execute(ctx context.Context) error { Deployment: i.deployment, Selector: i.selector, WriteConcern: i.writeConcern, + ServerAPI: i.serverAPI, }.Execute(ctx, nil) } @@ -252,3 +254,13 @@ func (i *Insert) Retry(retry driver.RetryMode) *Insert { i.retry = &retry return i } + +// ServerAPI sets the server API version for this operation. +func (i *Insert) ServerAPI(serverAPI *driver.ServerAPIOptions) *Insert { + if i == nil { + i = new(Insert) + } + + i.serverAPI = serverAPI + return i +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/ismaster.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/ismaster.go index 7d24dd82..544ed4e5 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/ismaster.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/ismaster.go @@ -27,6 +27,8 @@ type IsMaster struct { speculativeAuth bsoncore.Document topologyVersion *description.TopologyVersion maxAwaitTimeMS *int64 + serverAPI *driver.ServerAPIOptions + loadBalanced bool res bsoncore.Document } @@ -89,6 +91,18 @@ func (im *IsMaster) MaxAwaitTimeMS(awaitTime int64) *IsMaster { return im } +// ServerAPI sets the server API version for this operation. +func (im *IsMaster) ServerAPI(serverAPI *driver.ServerAPIOptions) *IsMaster { + im.serverAPI = serverAPI + return im +} + +// LoadBalanced specifies whether or not this operation is being sent over a connection to a load balanced cluster. +func (im *IsMaster) LoadBalanced(lb bool) *IsMaster { + im.loadBalanced = lb + return im +} + // Result returns the result of executing this operation. func (im *IsMaster) Result(addr address.Address) description.Server { return description.NewServer(addr, bson.Raw(im.res)) @@ -181,7 +195,11 @@ func (im *IsMaster) handshakeCommand(dst []byte, desc description.SelectedServer // command appends all necessary command fields. func (im *IsMaster) command(dst []byte, _ description.SelectedServer) ([]byte, error) { - dst = bsoncore.AppendInt32Element(dst, "isMaster", 1) + if im.serverAPI != nil { + dst = bsoncore.AppendInt32Element(dst, "hello", 1) + } else { + dst = bsoncore.AppendInt32Element(dst, "isMaster", 1) + } if tv := im.topologyVersion; tv != nil { var tvIdx int32 @@ -194,6 +212,11 @@ func (im *IsMaster) command(dst []byte, _ description.SelectedServer) ([]byte, e if im.maxAwaitTimeMS != nil { dst = bsoncore.AppendInt64Element(dst, "maxAwaitTimeMS", *im.maxAwaitTimeMS) } + if im.loadBalanced { + // The loadBalanced parameter should only be added if it's true. We should never explicitly send + // loadBalanced=false per the load balancing spec. + dst = bsoncore.AppendBooleanElement(dst, "loadBalanced", true) + } return dst, nil } @@ -218,10 +241,11 @@ func (im *IsMaster) createOperation() driver.Operation { CommandFn: im.command, Database: "admin", Deployment: im.d, - ProcessResponseFn: func(response bsoncore.Document, _ driver.Server, _ description.Server, _ int) error { - im.res = response + ProcessResponseFn: func(info driver.ResponseInfo) error { + im.res = info.ServerResponse return nil }, + ServerAPI: im.serverAPI, } } @@ -233,10 +257,11 @@ func (im *IsMaster) GetHandshakeInformation(ctx context.Context, _ address.Addre CommandFn: im.handshakeCommand, Deployment: driver.SingleConnectionDeployment{c}, Database: "admin", - ProcessResponseFn: func(response bsoncore.Document, _ driver.Server, _ description.Server, _ int) error { - im.res = response + ProcessResponseFn: func(info driver.ResponseInfo) error { + im.res = info.ServerResponse return nil }, + ServerAPI: im.serverAPI, }.Execute(ctx, nil) if err != nil { return driver.HandshakeInformation{}, err diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.go index 36c989b7..067c84ae 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.go @@ -36,6 +36,7 @@ type ListDatabases struct { retry *driver.RetryMode selector description.ServerSelector crypt *driver.Crypt + serverAPI *driver.ServerAPIOptions result ListDatabasesResult } @@ -143,10 +144,10 @@ func NewListDatabases(filter bsoncore.Document) *ListDatabases { // Result returns the result of executing this operation. func (ld *ListDatabases) Result() ListDatabasesResult { return ld.result } -func (ld *ListDatabases) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (ld *ListDatabases) processResponse(info driver.ResponseInfo) error { var err error - ld.result, err = buildListDatabasesResult(response, srvr) + ld.result, err = buildListDatabasesResult(info.ServerResponse, info.Server) return err } @@ -171,6 +172,7 @@ func (ld *ListDatabases) Execute(ctx context.Context) error { Type: driver.Read, Selector: ld.selector, Crypt: ld.crypt, + ServerAPI: ld.serverAPI, }.Execute(ctx, nil) } @@ -313,3 +315,13 @@ func (ld *ListDatabases) Crypt(crypt *driver.Crypt) *ListDatabases { ld.crypt = crypt return ld } + +// ServerAPI sets the server API version for this operation. +func (ld *ListDatabases) ServerAPI(serverAPI *driver.ServerAPIOptions) *ListDatabases { + if ld == nil { + ld = new(ListDatabases) + } + + ld.serverAPI = serverAPI + return ld +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.go index 383e2f12..8f96eb13 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.go @@ -35,6 +35,7 @@ type ListCollections struct { retry *driver.RetryMode result driver.CursorResponse batchSize *int32 + serverAPI *driver.ServerAPIOptions } // NewListCollections constructs and returns a new ListCollections. @@ -46,6 +47,7 @@ func NewListCollections(filter bsoncore.Document) *ListCollections { // Result returns the result of executing this operation. func (lc *ListCollections) Result(opts driver.CursorOptions) (*driver.ListCollectionsBatchCursor, error) { + opts.ServerAPI = lc.serverAPI bc, err := driver.NewBatchCursor(lc.result, lc.session, lc.clock, opts) if err != nil { return nil, err @@ -57,9 +59,9 @@ func (lc *ListCollections) Result(opts driver.CursorOptions) (*driver.ListCollec return driver.NewListCollectionsBatchCursor(bc) } -func (lc *ListCollections) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (lc *ListCollections) processResponse(info driver.ResponseInfo) error { var err error - lc.result, err = driver.NewCursorResponse(response, srvr, desc) + lc.result, err = driver.NewCursorResponse(info) return err } @@ -83,6 +85,7 @@ func (lc *ListCollections) Execute(ctx context.Context) error { ReadPreference: lc.readPreference, Selector: lc.selector, Legacy: driver.LegacyListCollections, + ServerAPI: lc.serverAPI, }.Execute(ctx, nil) } @@ -225,3 +228,13 @@ func (lc *ListCollections) BatchSize(batchSize int32) *ListCollections { lc.batchSize = &batchSize return lc } + +// ServerAPI sets the server API version for this operation. +func (lc *ListCollections) ServerAPI(serverAPI *driver.ServerAPIOptions) *ListCollections { + if lc == nil { + lc = new(ListCollections) + } + + lc.serverAPI = serverAPI + return lc +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.go index 1fc7dbdd..33db54e4 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.go @@ -32,6 +32,7 @@ type ListIndexes struct { selector description.ServerSelector retry *driver.RetryMode crypt *driver.Crypt + serverAPI *driver.ServerAPIOptions result driver.CursorResponse } @@ -47,13 +48,14 @@ func (li *ListIndexes) Result(opts driver.CursorOptions) (*driver.BatchCursor, e clientSession := li.session clock := li.clock + opts.ServerAPI = li.serverAPI return driver.NewBatchCursor(li.result, clientSession, clock, opts) } -func (li *ListIndexes) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error { +func (li *ListIndexes) processResponse(info driver.ResponseInfo) error { var err error - li.result, err = driver.NewCursorResponse(response, srvr, desc) + li.result, err = driver.NewCursorResponse(info) return err } @@ -78,6 +80,7 @@ func (li *ListIndexes) Execute(ctx context.Context) error { Legacy: driver.LegacyListIndexes, RetryMode: li.retry, Type: driver.Read, + ServerAPI: li.serverAPI, }.Execute(ctx, nil) } @@ -210,3 +213,13 @@ func (li *ListIndexes) Crypt(crypt *driver.Crypt) *ListIndexes { li.crypt = crypt return li } + +// ServerAPI sets the server API version for this operation. +func (li *ListIndexes) ServerAPI(serverAPI *driver.ServerAPIOptions) *ListIndexes { + if li == nil { + li = new(ListIndexes) + } + + li.serverAPI = serverAPI + return li +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/update.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/update.go index 2ccbaee3..0a3a9e6d 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/update.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/update.go @@ -40,6 +40,7 @@ type Update struct { retry *driver.RetryMode result UpdateResult crypt *driver.Crypt + serverAPI *driver.ServerAPIOptions } // Upsert contains the information for an upsert in an Update operation. @@ -121,14 +122,14 @@ func NewUpdate(updates ...bsoncore.Document) *Update { // Result returns the result of executing this operation. func (u *Update) Result() UpdateResult { return u.result } -func (u *Update) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, currIndex int) error { - ur, err := buildUpdateResult(response, srvr) +func (u *Update) processResponse(info driver.ResponseInfo) error { + ur, err := buildUpdateResult(info.ServerResponse, info.Server) u.result.N += ur.N u.result.NModified += ur.NModified - if currIndex > 0 { + if info.CurrentIndex > 0 { for ind := range ur.Upserted { - ur.Upserted[ind].Index += int64(currIndex) + ur.Upserted[ind].Index += int64(info.CurrentIndex) } } u.result.Upserted = append(u.result.Upserted, ur.Upserted...) @@ -161,6 +162,7 @@ func (u *Update) Execute(ctx context.Context) error { Selector: u.selector, WriteConcern: u.writeConcern, Crypt: u.crypt, + ServerAPI: u.serverAPI, }.Execute(ctx, nil) } @@ -352,3 +354,13 @@ func (u *Update) Crypt(crypt *driver.Crypt) *Update { u.crypt = crypt return u } + +// ServerAPI sets the server API version for this operation. +func (u *Update) ServerAPI(serverAPI *driver.ServerAPIOptions) *Update { + if u == nil { + u = new(Update) + } + + u.serverAPI = serverAPI + return u +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_exhaust.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_exhaust.go index caee435e..eb15dc95 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_exhaust.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_exhaust.go @@ -9,8 +9,6 @@ package driver import ( "context" "errors" - - "go.mongodb.org/mongo-driver/mongo/description" ) // ExecuteExhaust reads a response from the provided StreamerConnection. This will error if the connection's @@ -26,7 +24,12 @@ func (op Operation) ExecuteExhaust(ctx context.Context, conn StreamerConnection, return err } if op.ProcessResponseFn != nil { - if err = op.ProcessResponseFn(res, nil, description.Server{}, 0); err != nil { + // Server, ConnectionDescription, and CurrentIndex are unused in this mode. + info := ResponseInfo{ + ServerResponse: res, + Connection: conn, + } + if err = op.ProcessResponseFn(info); err != nil { return err } } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_legacy.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_legacy.go index b8ac39bd..a4390d05 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_legacy.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_legacy.go @@ -55,7 +55,14 @@ func (op Operation) legacyFind(ctx context.Context, dst []byte, srvr Server, con } if op.ProcessResponseFn != nil { - return op.ProcessResponseFn(finishedInfo.response, srvr, desc.Server, 0) + // CurrentIndex is always 0 in this mode. + info := ResponseInfo{ + ServerResponse: finishedInfo.response, + Server: srvr, + Connection: conn, + ConnectionDescription: desc.Server, + } + return op.ProcessResponseFn(info) } return nil } @@ -225,7 +232,14 @@ func (op Operation) legacyGetMore(ctx context.Context, dst []byte, srvr Server, } if op.ProcessResponseFn != nil { - return op.ProcessResponseFn(finishedInfo.response, srvr, desc.Server, 0) + // CurrentIndex is always 0 in this mode. + info := ResponseInfo{ + ServerResponse: finishedInfo.response, + Server: srvr, + Connection: conn, + ConnectionDescription: desc.Server, + } + return op.ProcessResponseFn(info) } return nil } @@ -393,7 +407,14 @@ func (op Operation) legacyListCollections(ctx context.Context, dst []byte, srvr } if op.ProcessResponseFn != nil { - return op.ProcessResponseFn(finishedInfo.response, srvr, desc.Server, 0) + // CurrentIndex is always 0 in this mode. + info := ResponseInfo{ + ServerResponse: finishedInfo.response, + Server: srvr, + Connection: conn, + ConnectionDescription: desc.Server, + } + return op.ProcessResponseFn(info) } return nil } @@ -525,7 +546,14 @@ func (op Operation) legacyListIndexes(ctx context.Context, dst []byte, srvr Serv } if op.ProcessResponseFn != nil { - return op.ProcessResponseFn(finishedInfo.response, srvr, desc.Server, 0) + // CurrentIndex is always 0 in this mode. + info := ResponseInfo{ + ServerResponse: finishedInfo.response, + Server: srvr, + Connection: conn, + ConnectionDescription: desc.Server, + } + return op.ProcessResponseFn(info) } return nil } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/serverapioptions.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/serverapioptions.go new file mode 100644 index 00000000..a033cf12 --- /dev/null +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/serverapioptions.go @@ -0,0 +1,36 @@ +// Copyright (C) MongoDB, Inc. 2017-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + +package driver + +// TestServerAPIVersion is the most recent, stable variant of options.ServerAPIVersion. +// Only to be used in testing. +const TestServerAPIVersion = "1" + +// ServerAPIOptions represents options used to configure the API version sent to the server +// when running commands. +type ServerAPIOptions struct { + ServerAPIVersion string + Strict *bool + DeprecationErrors *bool +} + +// NewServerAPIOptions creates a new ServerAPIOptions configured with the provided serverAPIVersion. +func NewServerAPIOptions(serverAPIVersion string) *ServerAPIOptions { + return &ServerAPIOptions{ServerAPIVersion: serverAPIVersion} +} + +// SetStrict specifies whether the server should return errors for features that are not part of the API version. +func (s *ServerAPIOptions) SetStrict(strict bool) *ServerAPIOptions { + s.Strict = &strict + return s +} + +// SetDeprecationErrors specifies whether the server should return errors for deprecated features. +func (s *ServerAPIOptions) SetDeprecationErrors(deprecationErrors bool) *ServerAPIOptions { + s.DeprecationErrors = &deprecationErrors + return s +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/client_session.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/client_session.go index 92676d8a..64adeb71 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/client_session.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/client_session.go @@ -7,15 +7,18 @@ package session // import "go.mongodb.org/mongo-driver/x/mongo/driver/session" import ( + "context" "errors" "time" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" + "go.mongodb.org/mongo-driver/mongo/address" "go.mongodb.org/mongo-driver/mongo/description" "go.mongodb.org/mongo-driver/mongo/readconcern" "go.mongodb.org/mongo-driver/mongo/readpref" "go.mongodb.org/mongo-driver/mongo/writeconcern" + "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" "go.mongodb.org/mongo-driver/x/mongo/driver/uuid" ) @@ -40,6 +43,9 @@ var ErrCommitAfterAbort = errors.New("cannot call commitTransaction after callin // ErrUnackWCUnsupported is returned if an unacknowledged write concern is supported for a transaciton. var ErrUnackWCUnsupported = errors.New("transactions do not support unacknowledged write concerns") +// ErrSnapshotTransaction is returned if an transaction is started on a snapshot session. +var ErrSnapshotTransaction = errors.New("transactions are not supported in snapshot sessions") + // Type describes the type of the session type Type uint8 @@ -79,6 +85,26 @@ func (s TransactionState) String() string { } } +// LoadBalancedTransactionConnection represents a connection that's pinned by a ClientSession because it's being used +// to execute a transaction when running against a load balancer. This interface is a copy of driver.PinnedConnection +// and exists to be able to pin transactions to a connection without causing an import cycle. +type LoadBalancedTransactionConnection interface { + // Functions copied over from driver.Connection. + WriteWireMessage(context.Context, []byte) error + ReadWireMessage(ctx context.Context, dst []byte) ([]byte, error) + Description() description.Server + Close() error + ID() string + Address() address.Address + Stale() bool + + // Functions copied over from driver.PinnedConnection that are not part of Connection or Expirable. + PinToCursor() error + PinToTransaction() error + UnpinFromCursor() error + UnpinFromTransaction() error +} + // Client is a session for clients to run commands. type Client struct { *Server @@ -93,6 +119,7 @@ type Client struct { Aborting bool RetryWrite bool RetryRead bool + Snapshot bool // options for the current transaction // most recently set by transactionopt @@ -111,6 +138,8 @@ type Client struct { TransactionState TransactionState PinnedServer *description.Server RecoveryToken bson.Raw + PinnedConnection LoadBalancedTransactionConnection + SnapshotTime *primitive.Timestamp } func getClusterTime(clusterTime bson.Raw) (uint32, uint32) { @@ -151,17 +180,13 @@ func MaxClusterTime(ct1, ct2 bson.Raw) bson.Raw { // NewClientSession creates a Client. func NewClientSession(pool *Pool, clientID uuid.UUID, sessionType Type, opts ...*ClientOptions) (*Client, error) { + mergedOpts := mergeClientOptions(opts...) + c := &Client{ - Consistent: true, // set default ClientID: clientID, SessionType: sessionType, pool: pool, } - - mergedOpts := mergeClientOptions(opts...) - if mergedOpts.CausalConsistency != nil { - c.Consistent = *mergedOpts.CausalConsistency - } if mergedOpts.DefaultReadPreference != nil { c.transactionRp = mergedOpts.DefaultReadPreference } @@ -174,6 +199,20 @@ func NewClientSession(pool *Pool, clientID uuid.UUID, sessionType Type, opts ... if mergedOpts.DefaultMaxCommitTime != nil { c.transactionMaxCommitTime = mergedOpts.DefaultMaxCommitTime } + if mergedOpts.Snapshot != nil { + c.Snapshot = *mergedOpts.Snapshot + } + + // The default for causalConsistency is true, unless Snapshot is enabled, then it's false. Set + // the default and then allow any explicit causalConsistency setting to override it. + c.Consistent = !c.Snapshot + if mergedOpts.CausalConsistency != nil { + c.Consistent = *mergedOpts.CausalConsistency + } + + if c.Consistent && c.Snapshot { + return nil, errors.New("causal consistency and snapshot cannot both be set for a session") + } servSess, err := pool.GetSession() if err != nil { @@ -239,11 +278,63 @@ func (c *Client) UpdateRecoveryToken(response bson.Raw) { c.RecoveryToken = token.Document() } -// ClearPinnedServer sets the PinnedServer to nil. -func (c *Client) ClearPinnedServer() { - if c != nil { - c.PinnedServer = nil +// UpdateSnapshotTime updates the session's value for the atClusterTime field of ReadConcern. +func (c *Client) UpdateSnapshotTime(response bsoncore.Document) { + if c == nil { + return } + + subDoc := response + if cur, ok := response.Lookup("cursor").DocumentOK(); ok { + subDoc = cur + } + + ssTimeElem, err := subDoc.LookupErr("atClusterTime") + if err != nil { + // atClusterTime not included by the server + return + } + + t, i := ssTimeElem.Timestamp() + c.SnapshotTime = &primitive.Timestamp{ + T: t, + I: i, + } +} + +// ClearPinnedResources clears the pinned server and/or connection associated with the session. +func (c *Client) ClearPinnedResources() error { + if c == nil { + return nil + } + + c.PinnedServer = nil + if c.PinnedConnection != nil { + if err := c.PinnedConnection.UnpinFromTransaction(); err != nil { + return err + } + if err := c.PinnedConnection.Close(); err != nil { + return err + } + } + c.PinnedConnection = nil + return nil +} + +// UnpinConnection gracefully unpins the connection associated with the session if there is one. This is done via +// the pinned connection's UnpinFromTransaction function. +func (c *Client) UnpinConnection() error { + if c == nil || c.PinnedConnection == nil { + return nil + } + + err := c.PinnedConnection.UnpinFromTransaction() + closeErr := c.PinnedConnection.Close() + if err == nil && closeErr != nil { + err = closeErr + } + c.PinnedConnection = nil + return err } // EndSession ends the session. @@ -285,6 +376,9 @@ func (c *Client) CheckStartTransaction() error { if c.TransactionState == InProgress || c.TransactionState == Starting { return ErrTransactInProgress } + if c.Snapshot { + return ErrSnapshotTransaction + } return nil } @@ -323,13 +417,12 @@ func (c *Client) StartTransaction(opts *TransactionOptions) error { } if !writeconcern.AckWrite(c.CurrentWc) { - c.clearTransactionOpts() + _ = c.clearTransactionOpts() return ErrUnackWCUnsupported } c.TransactionState = Starting - c.PinnedServer = nil - return nil + return c.ClearPinnedResources() } // CheckCommitTransaction checks to see if allowed to commit transaction and returns @@ -387,15 +480,30 @@ func (c *Client) AbortTransaction() error { return err } c.TransactionState = Aborted - c.clearTransactionOpts() + return c.clearTransactionOpts() +} + +// StartCommand updates the session's internal state at the beginning of an operation. This must be called before +// server selection is done for the operation as the session's state can impact the result of that process. +func (c *Client) StartCommand() error { + if c == nil { + return nil + } + + // If we're executing the first operation using this session after a transaction, we must ensure that the session + // is not pinned to any resources. + if !c.TransactionRunning() && !c.Committing && !c.Aborting { + return c.ClearPinnedResources() + } return nil } -// ApplyCommand advances the state machine upon command execution. -func (c *Client) ApplyCommand(desc description.Server) { +// ApplyCommand advances the state machine upon command execution. This must be called after server selection is +// complete. +func (c *Client) ApplyCommand(desc description.Server) error { if c.Committing { // Do not change state if committing after already committed - return + return nil } if c.TransactionState == Starting { c.TransactionState = InProgress @@ -404,18 +512,21 @@ func (c *Client) ApplyCommand(desc description.Server) { c.PinnedServer = &desc } } else if c.TransactionState == Committed || c.TransactionState == Aborted { - c.clearTransactionOpts() c.TransactionState = None + return c.clearTransactionOpts() } + + return nil } -func (c *Client) clearTransactionOpts() { +func (c *Client) clearTransactionOpts() error { c.RetryingCommit = false c.Aborting = false c.Committing = false c.CurrentWc = nil c.CurrentRp = nil c.CurrentRc = nil - c.PinnedServer = nil c.RecoveryToken = nil + + return c.ClearPinnedResources() } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/options.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/options.go index e2c2e7c2..ee7c301d 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/options.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/options.go @@ -21,6 +21,7 @@ type ClientOptions struct { DefaultWriteConcern *writeconcern.WriteConcern DefaultReadPreference *readpref.ReadPref DefaultMaxCommitTime *time.Duration + Snapshot *bool } // TransactionOptions represents all possible options for starting a transaction in a session. @@ -52,6 +53,9 @@ func mergeClientOptions(opts ...*ClientOptions) *ClientOptions { if opt.DefaultMaxCommitTime != nil { c.DefaultMaxCommitTime = opt.DefaultMaxCommitTime } + if opt.Snapshot != nil { + c.Snapshot = opt.Snapshot + } } return c diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/server_session.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/server_session.go index 4dbb5ee9..e7881fa1 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/server_session.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/server_session.go @@ -11,6 +11,7 @@ import ( "crypto/rand" + "go.mongodb.org/mongo-driver/mongo/description" "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" "go.mongodb.org/mongo-driver/x/mongo/driver/uuid" ) @@ -27,12 +28,18 @@ type Server struct { // returns whether or not a session has expired given a timeout in minutes // a session is considered expired if it has less than 1 minute left before becoming stale -func (ss *Server) expired(timeoutMinutes uint32) bool { - if timeoutMinutes <= 0 { +func (ss *Server) expired(topoDesc topologyDescription) bool { + // There is no server monitoring in LB mode, so we do not track session timeout minutes from server hello responses + // and never consider sessions to be expired. + if topoDesc.kind == description.LoadBalanced { + return false + } + + if topoDesc.timeoutMinutes <= 0 { return true } timeUnused := time.Since(ss.LastUsed).Minutes() - return timeUnused > float64(timeoutMinutes-1) + return timeUnused > float64(topoDesc.timeoutMinutes-1) } // update the last used time for this session. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/session_pool.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/session_pool.go index 61616ac3..27db7c47 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/session_pool.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/session_pool.go @@ -20,13 +20,20 @@ type Node struct { prev *Node } +// topologyDescription is used to track a subset of the fields present in a description.Topology instance that are +// relevant for determining session expiration. +type topologyDescription struct { + kind description.TopologyKind + timeoutMinutes uint32 +} + // Pool is a pool of server sessions that can be reused. type Pool struct { - descChan <-chan description.Topology - head *Node - tail *Node - timeout uint32 - mutex sync.Mutex // mutex to protect list and sessionTimeout + descChan <-chan description.Topology + head *Node + tail *Node + latestTopology topologyDescription + mutex sync.Mutex // mutex to protect list and sessionTimeout checkedOut int // number of sessions checked out of pool } @@ -54,7 +61,10 @@ func NewPool(descChan <-chan description.Topology) *Pool { func (p *Pool) updateTimeout() { select { case newDesc := <-p.descChan: - p.timeout = newDesc.SessionTimeoutMinutes + p.latestTopology = topologyDescription{ + kind: newDesc.Kind, + timeoutMinutes: newDesc.SessionTimeoutMinutes, + } default: // no new description waiting } @@ -73,7 +83,7 @@ func (p *Pool) GetSession() (*Server, error) { p.updateTimeout() for p.head != nil { // pull session from head of queue and return if it is valid for at least 1 more minute - if p.head.expired(p.timeout) { + if p.head.expired(p.latestTopology) { p.head = p.head.next continue } @@ -112,7 +122,7 @@ func (p *Pool) ReturnSession(ss *Server) { p.updateTimeout() // check sessions at end of queue for expired // stop checking after hitting the first valid session - for p.tail != nil && p.tail.expired(p.timeout) { + for p.tail != nil && p.tail.expired(p.latestTopology) { if p.tail.prev != nil { p.tail.prev.next = nil } @@ -120,7 +130,7 @@ func (p *Pool) ReturnSession(ss *Server) { } // session expired - if ss.expired(p.timeout) { + if ss.expired(p.latestTopology) { return } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go index a015a647..e23aeeaf 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go @@ -31,8 +31,9 @@ import ( var globalConnectionID uint64 = 1 var ( - defaultMaxMessageSize uint32 = 48000000 - errResponseTooLarge error = errors.New("length of read message too large") + defaultMaxMessageSize uint32 = 48000000 + errResponseTooLarge error = errors.New("length of read message too large") + errLoadBalancedStateMismatch = errors.New("driver attempted to initialize in load balancing mode, but the server does not support this mode") ) func nextConnectionID() uint64 { return atomic.AddUint64(&globalConnectionID, 1) } @@ -90,12 +91,17 @@ func newConnection(addr address.Address, opts ...ConnectionOption) (*connection, cancellationListener: internal.NewCancellationListener(), poolMonitor: cfg.poolMonitor, } + // Connections to non-load balanced deployments should eagerly set the generation numbers so errors encountered + // at any point during connection establishment can be processed without the connection being considered stale. + if !c.config.loadBalanced { + c.setGenerationNumber() + } atomic.StoreInt32(&c.connected, initialized) return c, nil } -func (c *connection) processInitializationError(err error) { +func (c *connection) processInitializationError(opCtx context.Context, err error) { atomic.StoreInt32(&c.connected, disconnected) if c.nc != nil { _ = c.nc.Close() @@ -103,10 +109,31 @@ func (c *connection) processInitializationError(err error) { c.connectErr = ConnectionError{Wrapped: err, init: true} if c.config.errorHandlingCallback != nil { - c.config.errorHandlingCallback(c.connectErr, c.generation) + c.config.errorHandlingCallback(opCtx, c.connectErr, c.generation, c.desc.ServiceID) } } +// setGenerationNumber sets the connection's generation number if a callback has been provided to do so in connection +// configuration. +func (c *connection) setGenerationNumber() { + if c.config.getGenerationFn != nil { + c.generation = c.config.getGenerationFn(c.desc.ServiceID) + } +} + +// hasGenerationNumber returns true if the connection has set its generation number. If so, this indicates that the +// generationNumberFn provided via the connection options has been called exactly once. +func (c *connection) hasGenerationNumber() bool { + if !c.config.loadBalanced { + // The generation is known for all non-LB clusters once the connection object has been created. + return true + } + + // For LB clusters, we set the generation after the initial handshake, so we know it's set if the connection + // description has been updated to reflect that it's behind an LB. + return c.desc.LoadBalanced() +} + // connect handles the I/O for a connection. It will dial, configure TLS, and perform // initialization handshakes. func (c *connection) connect(ctx context.Context) { @@ -157,7 +184,7 @@ func (c *connection) connect(ctx context.Context) { var tempNc net.Conn tempNc, err = c.config.dialer.DialContext(dialCtx, c.addr.Network(), c.addr.String()) if err != nil { - c.processInitializationError(err) + c.processInitializationError(ctx, err) return } c.nc = tempNc @@ -173,7 +200,7 @@ func (c *connection) connect(ctx context.Context) { } tlsNc, err := configureTLS(dialCtx, c.config.tlsConnectionSource, c.nc, c.addr, tlsConfig, ocspOpts) if err != nil { - c.processInitializationError(err) + c.processInitializationError(ctx, err) return } c.nc = tlsNc @@ -203,12 +230,29 @@ func (c *connection) connect(ctx context.Context) { // fields in handshakeInfo are tracked by the handshaker if necessary. c.desc = handshakeInfo.Description c.isMasterRTT = time.Since(handshakeStartTime) + + // If the application has indicated that the cluster is load balanced, ensure the server has included serviceId + // in its handshake response to signal that it knows it's behind an LB as well. + if c.config.loadBalanced && c.desc.ServiceID == nil { + err = errLoadBalancedStateMismatch + } + } + if err == nil { + // For load-balanced connections, the generation number depends on the service ID, which isn't known until the + // initial MongoDB handshake is done. To account for this, we don't attempt to set the connection's generation + // number unless GetHandshakeInformation succeeds. + if c.config.loadBalanced { + c.setGenerationNumber() + } + + // If we successfully finished the first part of the handshake and verified LB state, continue with the rest of + // the handshake. err = handshaker.FinishHandshake(handshakeCtx, handshakeConn) } // We have a failed handshake here if err != nil { - c.processInitializationError(err) + c.processInitializationError(ctx, err) return } @@ -561,12 +605,15 @@ func (c initConnection) SupportsStreaming() bool { // messages and the driver.Expirable interface to allow expiring. type Connection struct { *connection + refCount int + cleanupPoolFn func() mu sync.RWMutex } var _ driver.Connection = (*Connection)(nil) var _ driver.Expirable = (*Connection)(nil) +var _ driver.PinnedConnection = (*Connection)(nil) // WriteWireMessage handles writing a wire message to the underlying connection. func (c *Connection) WriteWireMessage(ctx context.Context, wm []byte) error { @@ -637,13 +684,11 @@ func (c *Connection) Description() description.Server { func (c *Connection) Close() error { c.mu.Lock() defer c.mu.Unlock() - if c.connection == nil { + if c.connection == nil || c.refCount > 0 { return nil } - err := c.pool.put(c.connection) - c.connection = nil - return err + return c.cleanupReferences() } // Expire closes this connection and will closeConnection the underlying socket. @@ -655,7 +700,15 @@ func (c *Connection) Expire() error { } _ = c.close() + return c.cleanupReferences() +} + +func (c *Connection) cleanupReferences() error { err := c.pool.put(c.connection) + if c.cleanupPoolFn != nil { + c.cleanupPoolFn() + c.cleanupPoolFn = nil + } c.connection = nil return err } @@ -702,6 +755,58 @@ func (c *Connection) LocalAddress() address.Address { return address.Address(c.nc.LocalAddr().String()) } +// PinToCursor updates this connection to reflect that it is pinned to a cursor. +func (c *Connection) PinToCursor() error { + return c.pin("cursor", c.pool.pinConnectionToCursor, c.pool.unpinConnectionFromCursor) +} + +// PinToTransaction updates this connection to reflect that it is pinned to a transaction. +func (c *Connection) PinToTransaction() error { + return c.pin("transaction", c.pool.pinConnectionToTransaction, c.pool.unpinConnectionFromTransaction) +} + +func (c *Connection) pin(reason string, updatePoolFn, cleanupPoolFn func()) error { + c.mu.Lock() + defer c.mu.Unlock() + if c.connection == nil { + return fmt.Errorf("attempted to pin a connection for a %s, but the connection has already been returned to the pool", reason) + } + + // Only use the provided callbacks for the first reference to avoid double-counting pinned connection statistics + // in the pool. + if c.refCount == 0 { + updatePoolFn() + c.cleanupPoolFn = cleanupPoolFn + } + c.refCount++ + return nil +} + +// UnpinFromCursor updates this connection to reflect that it is no longer pinned to a cursor. +func (c *Connection) UnpinFromCursor() error { + return c.unpin("cursor") +} + +// UnpinFromTransaction updates this connection to reflect that it is no longer pinned to a transaction. +func (c *Connection) UnpinFromTransaction() error { + return c.unpin("transaction") +} + +func (c *Connection) unpin(reason string) error { + c.mu.Lock() + defer c.mu.Unlock() + if c.connection == nil { + // We don't error here because the resource could have been forcefully closed via Expire. + return nil + } + if c.refCount == 0 { + return fmt.Errorf("attempted to unpin a connection from a %s, but the connection is not pinned by any resources", reason) + } + + c.refCount-- + return nil +} + var notMasterCodes = []int32{10107, 13435} var recoveringCodes = []int32{11600, 11602, 13436, 189, 91} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_options.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_options.go index 2a1f4e83..b9dac8c4 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_options.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_options.go @@ -6,6 +6,7 @@ import ( "net" "time" + "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/event" "go.mongodb.org/mongo-driver/x/mongo/driver" "go.mongodb.org/mongo-driver/x/mongo/driver/ocsp" @@ -35,6 +36,9 @@ var DefaultDialer Dialer = &net.Dialer{} // initialization. Implementations must be goroutine safe. type Handshaker = driver.Handshaker +// generationNumberFn is a callback type used by a connection to fetch its generation number given its service ID. +type generationNumberFn func(serviceID *primitive.ObjectID) uint64 + type connectionConfig struct { appName string connectTimeout time.Duration @@ -51,8 +55,10 @@ type connectionConfig struct { zstdLevel *int ocspCache ocsp.Cache disableOCSPEndpointCheck bool - errorHandlingCallback func(error, uint64) + errorHandlingCallback func(opCtx context.Context, err error, startGenNum uint64, svcID *primitive.ObjectID) tlsConnectionSource tlsConnectionSource + loadBalanced bool + getGenerationFn generationNumberFn } func newConnectionConfig(opts ...ConnectionOption) (*connectionConfig, error) { @@ -86,7 +92,7 @@ func withTLSConnectionSource(fn func(tlsConnectionSource) tlsConnectionSource) C } } -func withErrorHandlingCallback(fn func(error, uint64)) ConnectionOption { +func withErrorHandlingCallback(fn func(opCtx context.Context, err error, startGenNum uint64, svcID *primitive.ObjectID)) ConnectionOption { return func(c *connectionConfig) error { c.errorHandlingCallback = fn return nil @@ -208,3 +214,18 @@ func WithDisableOCSPEndpointCheck(fn func(bool) bool) ConnectionOption { return nil } } + +// WithConnectionLoadBalanced specifies whether or not the connection is to a server behind a load balancer. +func WithConnectionLoadBalanced(fn func(bool) bool) ConnectionOption { + return func(c *connectionConfig) error { + c.loadBalanced = fn(c.loadBalanced) + return nil + } +} + +func withGenerationNumberFn(fn func(generationNumberFn) generationNumberFn) ConnectionOption { + return func(c *connectionConfig) error { + c.getGenerationFn = fn(c.getGenerationFn) + return nil + } +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/errors.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/errors.go index 30274ee9..f3e2e3a7 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/errors.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/errors.go @@ -62,16 +62,23 @@ func (e ServerSelectionError) Unwrap() error { // WaitQueueTimeoutError represents a timeout when requesting a connection from the pool type WaitQueueTimeoutError struct { - Wrapped error + Wrapped error + PinnedCursorConnections uint64 + PinnedTransactionConnections uint64 + maxPoolSize uint64 } // Error implements the error interface. func (w WaitQueueTimeoutError) Error() string { errorMsg := "timed out while checking out a connection from connection pool" if w.Wrapped != nil { - return fmt.Sprintf("%s: %s", errorMsg, w.Wrapped.Error()) + errorMsg = fmt.Sprintf("%s: %s", errorMsg, w.Wrapped.Error()) } - return errorMsg + + errorMsg = fmt.Sprintf("%s; maxPoolSize: %d, connections in use by cursors: %d, connections in use by transactions: %d", + errorMsg, w.maxPoolSize, w.PinnedCursorConnections, w.PinnedTransactionConnections) + return fmt.Sprintf("%s, connections in use by other operations: %d", errorMsg, + w.maxPoolSize-(w.PinnedCursorConnections+w.PinnedTransactionConnections)) } // Unwrap returns the underlying error. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/fsm.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/fsm.go index 9f5d1f1b..7a7f7b3c 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/fsm.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/fsm.go @@ -18,7 +18,7 @@ import ( var ( // SupportedWireVersions is the range of wire versions supported by the driver. - SupportedWireVersions = description.NewVersionRange(2, 9) + SupportedWireVersions = description.NewVersionRange(2, 13) ) const ( diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go index a8bfcc3c..21bc2a69 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go @@ -13,6 +13,7 @@ import ( "sync/atomic" "time" + "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/event" "go.mongodb.org/mongo-driver/mongo/address" "golang.org/x/sync/semaphore" @@ -60,13 +61,17 @@ type pool struct { address address.Address opts []ConnectionOption conns *resourcePool // pool for non-checked out connections - generation uint64 // must be accessed using atomic package + generation *poolGenerationMap monitor *event.PoolMonitor - connected int32 // Must be accessed using the sync/atomic package. - nextid uint64 - opened map[uint64]*connection // opened holds all of the currently open connections. - sem *semaphore.Weighted + // Must be accessed using the atomic package. + connected int32 + pinnedCursorConnections uint64 + pinnedTransactionConnections uint64 + + nextid uint64 + opened map[uint64]*connection // opened holds all of the currently open connections. + sem *semaphore.Weighted sync.Mutex } @@ -148,13 +153,15 @@ func newPool(config poolConfig, connOpts ...ConnectionOption) (*pool, error) { } pool := &pool{ - address: config.Address, - monitor: config.PoolMonitor, - connected: disconnected, - opened: make(map[uint64]*connection), - opts: opts, - sem: semaphore.NewWeighted(int64(maxConns)), + address: config.Address, + monitor: config.PoolMonitor, + connected: disconnected, + opened: make(map[uint64]*connection), + opts: opts, + sem: semaphore.NewWeighted(int64(maxConns)), + generation: newPoolGenerationMap(), } + pool.opts = append(pool.opts, withGenerationNumberFn(func(_ generationNumberFn) generationNumberFn { return pool.getGenerationForNewConnection })) // we do not pass in config.MaxPoolSize because we manage the max size at this level rather than the resource pool level rpc := resourcePoolConfig{ @@ -189,7 +196,7 @@ func newPool(config poolConfig, connOpts ...ConnectionOption) (*pool, error) { // stale checks if a given connection's generation is below the generation of the pool func (p *pool) stale(c *connection) bool { - return c == nil || c.generation < atomic.LoadUint64(&p.generation) + return c == nil || p.generation.stale(c.desc.ServiceID, c.generation) } // connect puts the pool into the connected state, allowing it to be used and will allow items to begin being processed from the wait queue @@ -197,6 +204,7 @@ func (p *pool) connect() error { if !atomic.CompareAndSwapInt32(&p.connected, disconnected, connected) { return ErrPoolConnected } + p.generation.connect() p.conns.initialize() return nil } @@ -212,7 +220,7 @@ func (p *pool) disconnect(ctx context.Context) error { } p.conns.Close() - atomic.AddUint64(&p.generation, 1) + p.generation.disconnect() var err error if dl, ok := ctx.Deadline(); ok { @@ -277,7 +285,6 @@ func (p *pool) makeNewConnection() (*connection, string, error) { c.pool = p c.poolID = atomic.AddUint64(&p.nextid, 1) - c.generation = atomic.LoadUint64(&p.generation) if p.monitor != nil { p.monitor.Event(&event.PoolEvent{ @@ -310,8 +317,22 @@ func (p *pool) makeNewConnection() (*connection, string, error) { } -func (p *pool) getGeneration() uint64 { - return atomic.LoadUint64(&p.generation) +func (p *pool) pinConnectionToCursor() { + atomic.AddUint64(&p.pinnedCursorConnections, 1) +} + +func (p *pool) unpinConnectionFromCursor() { + // See https://golang.org/pkg/sync/atomic/#AddUint64 for an explanation of the ^uint64(0) syntax. + atomic.AddUint64(&p.pinnedCursorConnections, ^uint64(0)) +} + +func (p *pool) pinConnectionToTransaction() { + atomic.AddUint64(&p.pinnedTransactionConnections, 1) +} + +func (p *pool) unpinConnectionFromTransaction() { + // See https://golang.org/pkg/sync/atomic/#AddUint64 for an explanation of the ^uint64(0) syntax. + atomic.AddUint64(&p.pinnedTransactionConnections, ^uint64(0)) } // Checkout returns a connection from the pool @@ -341,7 +362,10 @@ func (p *pool) get(ctx context.Context) (*connection, error) { }) } errWaitQueueTimeout := WaitQueueTimeoutError{ - Wrapped: ctx.Err(), + Wrapped: ctx.Err(), + PinnedCursorConnections: atomic.LoadUint64(&p.pinnedCursorConnections), + PinnedTransactionConnections: atomic.LoadUint64(&p.pinnedTransactionConnections), + maxPoolSize: p.conns.maxSize, } return nil, errWaitQueueTimeout } @@ -487,6 +511,10 @@ func (p *pool) closeConnection(c *connection) error { return nil } +func (p *pool) getGenerationForNewConnection(serviceID *primitive.ObjectID) uint64 { + return p.generation.addConnection(serviceID) +} + // removeConnection removes a connection from the pool. func (p *pool) removeConnection(c *connection, reason string) error { if c.pool != p { @@ -501,6 +529,12 @@ func (p *pool) removeConnection(c *connection, reason string) error { } p.Unlock() + // Only update the generation numbers map if the connection has retrieved its generation number. Otherwise, we'd + // decrement the count for the generation even though it had never been incremented. + if c.hasGenerationNumber() { + p.generation.removeConnection(c.desc.ServiceID) + } + if publishEvent && p.monitor != nil { c.pool.monitor.Event(&event.PoolEvent{ Type: event.ConnectionClosed, @@ -545,12 +579,13 @@ func (p *pool) put(c *connection) error { } // clear clears the pool by incrementing the generation -func (p *pool) clear() { +func (p *pool) clear(serviceID *primitive.ObjectID) { if p.monitor != nil { p.monitor.Event(&event.PoolEvent{ - Type: event.PoolCleared, - Address: p.address.String(), + Type: event.PoolCleared, + Address: p.address.String(), + ServiceID: serviceID, }) } - atomic.AddUint64(&p.generation, 1) + p.generation.clear(serviceID) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool_generation_counter.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool_generation_counter.go new file mode 100644 index 00000000..85fa5869 --- /dev/null +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool_generation_counter.go @@ -0,0 +1,133 @@ +// Copyright (C) MongoDB, Inc. 2017-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + +package topology + +import ( + "sync" + "sync/atomic" + + "go.mongodb.org/mongo-driver/bson/primitive" +) + +// generationStats represents the version of a pool. It tracks the generation number as well as the number of +// connections that have been created in the generation. +type generationStats struct { + generation uint64 + numConns uint64 +} + +// poolGenerationMap tracks the version for each service ID present in a pool. For deployments that are not behind a +// load balancer, there is only one service ID: primitive.NilObjectID. For load-balanced deployments, each server behind +// the load balancer will have a unique service ID. +type poolGenerationMap struct { + // state must be accessed using the atomic package. + state int32 + generationMap map[primitive.ObjectID]*generationStats + + sync.Mutex +} + +func newPoolGenerationMap() *poolGenerationMap { + pgm := &poolGenerationMap{ + generationMap: make(map[primitive.ObjectID]*generationStats), + } + pgm.generationMap[primitive.NilObjectID] = &generationStats{} + return pgm +} + +func (p *poolGenerationMap) connect() { + atomic.StoreInt32(&p.state, connected) +} + +func (p *poolGenerationMap) disconnect() { + atomic.StoreInt32(&p.state, disconnected) +} + +// addConnection increments the connection count for the generation associated with the given service ID and returns the +// generation number for the connection. +func (p *poolGenerationMap) addConnection(serviceIDPtr *primitive.ObjectID) uint64 { + serviceID := getServiceID(serviceIDPtr) + p.Lock() + defer p.Unlock() + + stats, ok := p.generationMap[serviceID] + if ok { + // If the serviceID is already being tracked, we only need to increment the connection count. + stats.numConns++ + return stats.generation + } + + // If the serviceID is untracked, create a new entry with a starting generation number of 0. + stats = &generationStats{ + numConns: 1, + } + p.generationMap[serviceID] = stats + return 0 +} + +func (p *poolGenerationMap) removeConnection(serviceIDPtr *primitive.ObjectID) { + serviceID := getServiceID(serviceIDPtr) + p.Lock() + defer p.Unlock() + + stats, ok := p.generationMap[serviceID] + if !ok { + return + } + + // If the serviceID is being tracked, decrement the connection count and delete this serviceID to prevent the map + // from growing unboundedly. This case would happen if a server behind a load-balancer was permanently removed + // and its connections were pruned after a network error or idle timeout. + stats.numConns-- + if stats.numConns == 0 { + delete(p.generationMap, serviceID) + } +} + +func (p *poolGenerationMap) clear(serviceIDPtr *primitive.ObjectID) { + serviceID := getServiceID(serviceIDPtr) + p.Lock() + defer p.Unlock() + + if stats, ok := p.generationMap[serviceID]; ok { + stats.generation++ + } +} + +func (p *poolGenerationMap) stale(serviceIDPtr *primitive.ObjectID, knownGeneration uint64) bool { + // If the map has been disconnected, all connections should be considered stale to ensure that they're closed. + if atomic.LoadInt32(&p.state) == disconnected { + return true + } + + serviceID := getServiceID(serviceIDPtr) + p.Lock() + defer p.Unlock() + + if stats, ok := p.generationMap[serviceID]; ok { + return knownGeneration < stats.generation + } + return false +} + +func (p *poolGenerationMap) getGeneration(serviceIDPtr *primitive.ObjectID) uint64 { + serviceID := getServiceID(serviceIDPtr) + p.Lock() + defer p.Unlock() + + if stats, ok := p.generationMap[serviceID]; ok { + return stats.generation + } + return 0 +} + +func getServiceID(oid *primitive.ObjectID) primitive.ObjectID { + if oid == nil { + return primitive.NilObjectID + } + return *oid +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server.go index 649faa53..c6f154fd 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server.go @@ -179,7 +179,9 @@ func NewServer(addr address.Address, topologyID primitive.ObjectID, opts ...Serv PoolMonitor: cfg.poolMonitor, } - connectionOpts := append(cfg.connectionOpts, withErrorHandlingCallback(s.ProcessHandshakeError)) + connectionOpts := make([]ConnectionOption, len(cfg.connectionOpts)) + copy(connectionOpts, cfg.connectionOpts) + connectionOpts = append(connectionOpts, withErrorHandlingCallback(s.ProcessHandshakeError)) s.pool, err = newPool(pc, connectionOpts...) if err != nil { return nil, err @@ -196,10 +198,16 @@ func (s *Server) Connect(updateCallback updateTopologyCallback) error { if !atomic.CompareAndSwapInt32(&s.connectionstate, disconnected, connected) { return ErrServerConnected } - s.desc.Store(description.NewDefaultServer(s.address)) + + desc := description.NewDefaultServer(s.address) + if s.cfg.loadBalanced { + // LBs automatically start off with kind LoadBalancer because there is no monitoring routine for state changes. + desc.Kind = description.LoadBalancer + } + s.desc.Store(desc) s.updateTopologyCallback.Store(updateCallback) - if !s.cfg.monitoringDisabled { + if !s.cfg.monitoringDisabled && !s.cfg.loadBalanced { s.rttMonitor.connect() s.closewg.Add(1) go s.update() @@ -266,10 +274,19 @@ func (s *Server) Connection(ctx context.Context) (driver.Connection, error) { return &Connection{connection: connImpl}, nil } -// ProcessHandshakeError implements SDAM error handling for errors that occur before a connection finishes handshaking. -func (s *Server) ProcessHandshakeError(err error, startingGenerationNumber uint64) { - // ignore nil or stale error - if err == nil || startingGenerationNumber < atomic.LoadUint64(&s.pool.generation) { +// ProcessHandshakeError implements SDAM error handling for errors that occur before a connection +// finishes handshaking. opCtx is the context passed to Server.Connection() and is used to determine +// whether or not an operation-scoped context deadline or cancellation was the cause of the +// handshake error; it is not used for timeout or cancellation of ProcessHandshakeError. +func (s *Server) ProcessHandshakeError(opCtx context.Context, err error, startingGenerationNumber uint64, serviceID *primitive.ObjectID) { + // Ignore the error if the server is behind a load balancer but the service ID is unknown. This indicates that the + // error happened when dialing the connection or during the MongoDB handshake, so we don't know the service ID to + // use for clearing the pool. + if err == nil || s.cfg.loadBalanced && serviceID == nil { + return + } + // Ignore the error if the connection is stale. + if startingGenerationNumber < s.pool.generation.getGeneration(serviceID) { return } @@ -278,11 +295,67 @@ func (s *Server) ProcessHandshakeError(err error, startingGenerationNumber uint6 return } + isCtxTimeoutOrCanceled := func(ctx context.Context) bool { + if ctx == nil { + return false + } + + if ctx.Err() != nil { + return true + } + + // In some networking functions, the deadline from the context is used to determine timeouts + // instead of the ctx.Done() chan closure. In that case, there can be a race condition + // between the networking functing returning an error and ctx.Err() returning an an error + // (i.e. the networking function returns an error caused by the context deadline, but + // ctx.Err() returns nil). If the operation-scoped context deadline was exceeded, assume + // operation-scoped context timeout caused the error. + if deadline, ok := ctx.Deadline(); ok && time.Now().After(deadline) { + return true + } + + return false + } + + isErrTimeoutOrCanceled := func(err error) bool { + for err != nil { + // Check for errors that implement the "net.Error" interface and self-report as timeout + // errors. Includes some "*net.OpError" errors and "context.DeadlineExceeded". + if netErr, ok := err.(net.Error); ok && netErr.Timeout() { + return true + } + // Check for context cancellation. Also handle the case where the cancellation error has + // been replaced by "net.errCanceled" (which isn't exported and can't be compared + // directly) by checking the error message. + if err == context.Canceled || err.Error() == "operation was canceled" { + return true + } + + wrapper, ok := err.(interface{ Unwrap() error }) + if !ok { + break + } + err = wrapper.Unwrap() + } + + return false + } + + // Ignore errors that indicate a client-side timeout occurred when the context passed into an + // operation timed out or was canceled (i.e. errors caused by an operation-scoped timeout). + // Timeouts caused by reaching connectTimeoutMS or other non-operation-scoped timeouts should + // still clear the pool. + // TODO(GODRIVER-2038): Remove this condition when connections are no longer created with an + // operation-scoped timeout. + if isCtxTimeoutOrCanceled(opCtx) && isErrTimeoutOrCanceled(wrappedConnErr) { + return + } + // Since the only kind of ConnectionError we receive from pool.Get will be an initialization error, we should set // the description.Server appropriately. The description should not have a TopologyVersion because the staleness // checking logic above has already determined that this description is not stale. s.updateDescription(description.NewServerFromError(s.address, wrappedConnErr, nil)) - s.pool.clear() + s.pool.clear(serviceID) s.cancelCheck() } @@ -386,7 +459,7 @@ func (s *Server) ProcessError(err error, conn driver.Connection) driver.ProcessE // If the node is shutting down or is older than 4.2, we synchronously clear the pool if cerr.NodeIsShuttingDown() || desc.WireVersion == nil || desc.WireVersion.Max < 8 { res = driver.ConnectionPoolCleared - s.pool.clear() + s.pool.clear(desc.ServiceID) } return res } @@ -404,7 +477,7 @@ func (s *Server) ProcessError(err error, conn driver.Connection) driver.ProcessE // If the node is shutting down or is older than 4.2, we synchronously clear the pool if wcerr.NodeIsShuttingDown() || desc.WireVersion == nil || desc.WireVersion.Max < 8 { res = driver.ConnectionPoolCleared - s.pool.clear() + s.pool.clear(desc.ServiceID) } return res } @@ -426,7 +499,7 @@ func (s *Server) ProcessError(err error, conn driver.Connection) driver.ProcessE // monitoring check. The check is cancelled last to avoid a post-cancellation reconnect racing with // updateDescription. s.updateDescription(description.NewServerFromError(s.address, err, nil)) - s.pool.clear() + s.pool.clear(desc.ServiceID) s.cancelCheck() return driver.ConnectionPoolCleared } @@ -516,8 +589,10 @@ func (s *Server) update() { s.updateDescription(desc) if desc.LastError != nil { - // Clear the pool once the description has been updated to Unknown. - s.pool.clear() + // Clear the pool once the description has been updated to Unknown. Pass in a nil service ID to clear + // because the monitoring routine only runs for non-load balanced deployments in which servers don't return + // IDs. + s.pool.clear(nil) } // If the server supports streaming or we're already streaming, we want to move to streaming the next response @@ -543,6 +618,12 @@ func (s *Server) update() { // parameter is used to determine if this is the first description from the // server. func (s *Server) updateDescription(desc description.Server) { + if s.cfg.loadBalanced { + // In load balanced mode, there are no updates from the monitoring routine. For errors encountered in pooled + // connections, the server should not be marked Unknown to ensure that the LB remains selectable. + return + } + defer func() { // ¯\_(ツ)_/¯ _ = recover() @@ -570,20 +651,22 @@ func (s *Server) updateDescription(desc description.Server) { // createConnection creates a new connection instance but does not call connect on it. The caller must call connect // before the connection can be used for network operations. func (s *Server) createConnection() (*connection, error) { - opts := []ConnectionOption{ + opts := make([]ConnectionOption, len(s.cfg.connectionOpts)) + copy(opts, s.cfg.connectionOpts) + opts = append(opts, WithConnectTimeout(func(time.Duration) time.Duration { return s.cfg.heartbeatTimeout }), WithReadTimeout(func(time.Duration) time.Duration { return s.cfg.heartbeatTimeout }), WithWriteTimeout(func(time.Duration) time.Duration { return s.cfg.heartbeatTimeout }), // We override whatever handshaker is currently attached to the options with a basic // one because need to make sure we don't do auth. WithHandshaker(func(h Handshaker) Handshaker { - return operation.NewIsMaster().AppName(s.cfg.appname).Compressors(s.cfg.compressionOpts) + return operation.NewIsMaster().AppName(s.cfg.appname).Compressors(s.cfg.compressionOpts). + ServerAPI(s.cfg.serverAPI) }), // Override any monitors specified in options with nil to avoid monitoring heartbeats. WithMonitor(func(*event.CommandMonitor) *event.CommandMonitor { return nil }), withPoolMonitor(func(*event.PoolMonitor) *event.PoolMonitor { return nil }), - } - opts = append(s.cfg.connectionOpts, opts...) + ) return newConnection(s.address, opts...) } @@ -640,7 +723,8 @@ func (s *Server) createBaseOperation(conn driver.Connection) *operation.IsMaster return operation. NewIsMaster(). ClusterClock(s.cfg.clock). - Deployment(driver.SingleConnectionDeployment{conn}) + Deployment(driver.SingleConnectionDeployment{conn}). + ServerAPI(s.cfg.serverAPI) } func (s *Server) check() (description.Server, error) { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server_options.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server_options.go index 902bfbdd..1b82f192 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server_options.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server_options.go @@ -12,6 +12,7 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/bsoncodec" "go.mongodb.org/mongo-driver/event" + "go.mongodb.org/mongo-driver/x/mongo/driver" "go.mongodb.org/mongo-driver/x/mongo/driver/session" ) @@ -31,6 +32,8 @@ type serverConfig struct { connectionPoolMaxIdleTime time.Duration registry *bsoncodec.Registry monitoringDisabled bool + serverAPI *driver.ServerAPIOptions + loadBalanced bool } func newServerConfig(opts ...ServerOption) (*serverConfig, error) { @@ -163,3 +166,19 @@ func WithRegistry(fn func(*bsoncodec.Registry) *bsoncodec.Registry) ServerOption return nil } } + +// WithServerAPI configures the server API options for the server to use. +func WithServerAPI(fn func(serverAPI *driver.ServerAPIOptions) *driver.ServerAPIOptions) ServerOption { + return func(cfg *serverConfig) error { + cfg.serverAPI = fn(cfg.serverAPI) + return nil + } +} + +// WithServerLoadBalanced specifies whether or not the server is behind a load balancer. +func WithServerLoadBalanced(fn func(bool) bool) ServerOption { + return func(cfg *serverConfig) error { + cfg.loadBalanced = fn(cfg.loadBalanced) + return nil + } +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology.go index a5cde18c..ddd24cd9 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology.go @@ -133,7 +133,7 @@ func New(opts ...Option) (*Topology, error) { } if t.cfg.uri != "" { - t.pollingRequired = strings.HasPrefix(t.cfg.uri, "mongodb+srv://") + t.pollingRequired = strings.HasPrefix(t.cfg.uri, "mongodb+srv://") && !t.cfg.loadBalanced } t.publishTopologyOpeningEvent() @@ -169,23 +169,56 @@ func (t *Topology) Connect() error { t.fsm.Servers = append(t.fsm.Servers, description.NewDefaultServer(addr)) } - // store new description - newDesc := description.Topology{ - Kind: t.fsm.Kind, - Servers: t.fsm.Servers, - SessionTimeoutMinutes: t.fsm.SessionTimeoutMinutes, - } - t.desc.Store(newDesc) - t.publishTopologyDescriptionChangedEvent(description.Topology{}, t.fsm.Topology) - for _, a := range t.cfg.seedList { - addr := address.Address(a).Canonicalize() - err = t.addServer(addr) - if err != nil { + switch { + case t.cfg.loadBalanced: + // In LoadBalanced mode, we mock a series of events: TopologyDescriptionChanged from Unknown to LoadBalanced, + // ServerDescriptionChanged from Unknown to LoadBalancer, and then TopologyDescriptionChanged to reflect the + // previous ServerDescriptionChanged event. We publish all of these events here because we don't start server + // monitoring routines in this mode, so we have to mock state changes. + + // Transition from Unknown with no servers to LoadBalanced with a single Unknown server. + t.fsm.Kind = description.LoadBalanced + t.publishTopologyDescriptionChangedEvent(description.Topology{}, t.fsm.Topology) + + addr := address.Address(t.cfg.seedList[0]).Canonicalize() + if err := t.addServer(addr); err != nil { + t.serversLock.Unlock() return err } - } - t.serversLock.Unlock() + // Transition the server from Unknown to LoadBalancer. + newServerDesc := t.servers[addr].Description() + t.publishServerDescriptionChangedEvent(t.fsm.Servers[0], newServerDesc) + + // Transition from LoadBalanced with an Unknown server to LoadBalanced with a LoadBalancer. + oldDesc := t.fsm.Topology + t.fsm.Servers = []description.Server{newServerDesc} + t.desc.Store(t.fsm.Topology) + t.publishTopologyDescriptionChangedEvent(oldDesc, t.fsm.Topology) + default: + // In non-LB mode, we only publish an initial TopologyDescriptionChanged event from Unknown with no servers to + // the current state (e.g. Unknown with one or more servers if we're discovering or Single with one server if + // we're connecting directly). Other events are published when state changes occur due to responses in the + // server monitoring goroutines. + + newDesc := description.Topology{ + Kind: t.fsm.Kind, + Servers: t.fsm.Servers, + SessionTimeoutMinutes: t.fsm.SessionTimeoutMinutes, + } + t.desc.Store(newDesc) + t.publishTopologyDescriptionChangedEvent(description.Topology{}, t.fsm.Topology) + for _, a := range t.cfg.seedList { + addr := address.Address(a).Canonicalize() + err = t.addServer(addr) + if err != nil { + t.serversLock.Unlock() + return err + } + } + } + + t.serversLock.Unlock() if t.pollingRequired { go t.pollSRVRecords() t.pollingwg.Add(1) @@ -378,50 +411,6 @@ func (t *Topology) SelectServer(ctx context.Context, ss description.ServerSelect } } -// SelectServerLegacy selects a server with given a selector. SelectServerLegacy complies with the -// server selection spec, and will time out after severSelectionTimeout or when the -// parent context is done. -func (t *Topology) SelectServerLegacy(ctx context.Context, ss description.ServerSelector) (*SelectedServer, error) { - if atomic.LoadInt32(&t.connectionstate) != connected { - return nil, ErrTopologyClosed - } - var ssTimeoutCh <-chan time.Time - - if t.cfg.serverSelectionTimeout > 0 { - ssTimeout := time.NewTimer(t.cfg.serverSelectionTimeout) - ssTimeoutCh = ssTimeout.C - defer ssTimeout.Stop() - } - - sub, err := t.Subscribe() - if err != nil { - return nil, err - } - defer t.Unsubscribe(sub) - - selectionState := newServerSelectionState(ss, ssTimeoutCh) - for { - suitable, err := t.selectServerFromSubscription(ctx, sub.Updates, selectionState) - if err != nil { - return nil, err - } - - selected := suitable[rand.Intn(len(suitable))] - selectedS, err := t.FindServer(selected) - switch { - case err != nil: - return nil, err - case selectedS != nil: - return selectedS, nil - default: - // We don't have an actual server for the provided description. - // This could happen for a number of reasons, including that the - // server has since stopped being a part of this topology, or that - // the server selector returned no suitable servers. - } - } -} - // FindServer will attempt to find a server that fits the given server description. // This method will return nil, nil if a matching server could not be found. func (t *Topology) FindServer(selected description.Server) (*SelectedServer, error) { @@ -481,6 +470,13 @@ func (t *Topology) selectServerFromDescription(desc description.Topology, return nil, desc.CompatibilityErr } + // If the topology kind is LoadBalanced, the LB is the only server and it is always considered selectable. The + // selectors exported by the driver should already return the LB as a candidate, so this but this check ensures that + // the LB is always selectable even if a user of the low-level driver provides a custom selector. + if desc.Kind == description.LoadBalanced { + return desc.Servers, nil + } + var allowed []description.Server for _, s := range desc.Servers { if s.Kind != description.Unknown { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options.go index c40f5510..fa74764e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options.go @@ -36,6 +36,7 @@ type config struct { uri string serverSelectionTimeout time.Duration serverMonitor *event.ServerMonitor + loadBalanced bool } func newConfig(opts ...Option) (*config, error) { @@ -224,6 +225,17 @@ func WithConnString(fn func(connstring.ConnString) connstring.ConnString) Option })) } + // LoadBalanced + if cs.LoadBalancedSet { + c.loadBalanced = cs.LoadBalanced + c.serverOpts = append(c.serverOpts, WithServerLoadBalanced(func(bool) bool { + return cs.LoadBalanced + })) + connOpts = append(connOpts, WithConnectionLoadBalanced(func(bool) bool { + return cs.LoadBalanced + })) + } + if len(connOpts) > 0 { c.serverOpts = append(c.serverOpts, WithConnectionOptions(func(opts ...ConnectionOption) []ConnectionOption { return append(opts, connOpts...) @@ -410,3 +422,11 @@ func addClientCertFromFile(cfg *tls.Config, clientFile, keyPasswd string) (strin return x509CertSubject(crt), nil } + +// WithLoadBalanced specifies whether or not the cluster is behind a load balancer. +func WithLoadBalanced(fn func(bool) bool) Option { + return func(cfg *config) error { + cfg.loadBalanced = fn(cfg.loadBalanced) + return nil + } +} diff --git a/backend/vendor/go.uber.org/goleak/.travis.yml b/backend/vendor/go.uber.org/goleak/.travis.yml index b215cef1..dfdb5b6d 100644 --- a/backend/vendor/go.uber.org/goleak/.travis.yml +++ b/backend/vendor/go.uber.org/goleak/.travis.yml @@ -10,6 +10,7 @@ matrix: include: - go: 1.12.x - go: 1.13.x + - go: 1.14.x env: LINT=1 install: diff --git a/backend/vendor/go.uber.org/goleak/CHANGELOG.md b/backend/vendor/go.uber.org/goleak/CHANGELOG.md index 2dfb98f6..ba3df4f3 100644 --- a/backend/vendor/go.uber.org/goleak/CHANGELOG.md +++ b/backend/vendor/go.uber.org/goleak/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.1.0] +### Added +- [#49]: Add option to ignore current goroutines, which checks for any additional leaks and allows for incremental adoption of goleak in larger projects. + +Thanks to @denis-tingajkin for their contributions to this release. + ## [1.0.0] ### Changed - Migrate to Go modules. @@ -15,3 +21,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Initial release. [1.0.0]: https://github.com/uber-go/goleak/compare/v0.10.0...v1.0.0 +[#49]: https://github.com/uber-go/goleak/pull/49 diff --git a/backend/vendor/go.uber.org/goleak/README.md b/backend/vendor/go.uber.org/goleak/README.md index 8702de9f..b8a748b0 100644 --- a/backend/vendor/go.uber.org/goleak/README.md +++ b/backend/vendor/go.uber.org/goleak/README.md @@ -2,10 +2,6 @@ Goroutine leak detector to help avoid Goroutine leaks. -## Development Status: Alpha - -goleak is still in development, and APIs are still in flux. - ## Installation You can use `go get` to get the latest version: @@ -50,7 +46,7 @@ $ go test -c -o tests # Run each test individually, printing "." for successful tests, or the test name # for failing tests. -$ for test in $(go test -list . | grep "^Test"); do ./tests -test.run "^$test\$" &>/dev/null && echo -n "." || echo "\n$test failed"; done +$ for test in $(go test -list . | grep -E "^(Test|Example)"); do ./tests -test.run "^$test\$" &>/dev/null && echo -n "." || echo "\n$test failed"; done ``` This will only print names of failing tests which can be investigated individually. E.g., @@ -61,6 +57,11 @@ TestLeakyTest failed ....... ``` +## Stability + +goleak is v1 and follows [SemVer](http://semver.org/) strictly. + +No breaking changes will be made to exported APIs before 2.0. [doc-img]: https://godoc.org/go.uber.org/goleak?status.svg [doc]: https://godoc.org/go.uber.org/goleak diff --git a/backend/vendor/go.uber.org/goleak/options.go b/backend/vendor/go.uber.org/goleak/options.go index e011ba1b..0f6bd9e7 100644 --- a/backend/vendor/go.uber.org/goleak/options.go +++ b/backend/vendor/go.uber.org/goleak/options.go @@ -57,6 +57,18 @@ func IgnoreTopFunction(f string) Option { }) } +// IgnoreCurrent records all current goroutines when the option is created, and ignores +// them in any future Find/Verify calls. +func IgnoreCurrent() Option { + excludeIDSet := map[int]bool{} + for _, s := range stack.All() { + excludeIDSet[s.ID()] = true + } + return addFilter(func(s stack.Stack) bool { + return excludeIDSet[s.ID()] + }) +} + func maxSleep(d time.Duration) Option { return optionFunc(func(opts *opts) { opts.maxSleep = d diff --git a/backend/vendor/golang.org/x/crypto/acme/http.go b/backend/vendor/golang.org/x/crypto/acme/http.go index c51943e7..2b4c1a10 100644 --- a/backend/vendor/golang.org/x/crypto/acme/http.go +++ b/backend/vendor/golang.org/x/crypto/acme/http.go @@ -10,6 +10,7 @@ import ( "crypto" "crypto/rand" "encoding/json" + "errors" "fmt" "io/ioutil" "math/big" @@ -215,6 +216,9 @@ func (c *Client) post(ctx context.Context, key crypto.Signer, url string, body i func (c *Client) postNoRetry(ctx context.Context, key crypto.Signer, url string, body interface{}) (*http.Response, *http.Request, error) { kid := noKeyID if key == nil { + if c.Key == nil { + return nil, nil, errors.New("acme: Client.Key must be populated to make POST requests") + } key = c.Key kid = c.accountKID(ctx) } diff --git a/backend/vendor/golang.org/x/image/draw/draw_go117.go b/backend/vendor/golang.org/x/image/draw/draw_go117.go new file mode 100644 index 00000000..fa836486 --- /dev/null +++ b/backend/vendor/golang.org/x/image/draw/draw_go117.go @@ -0,0 +1,27 @@ +// Copyright 2021 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:build go1.17 +// +build go1.17 + +package draw + +import ( + "image/draw" +) + +// The package documentation, in draw.go, gives the intent of this package: +// +// This package is a superset of and a drop-in replacement for the +// image/draw package in the standard library. +// +// "Drop-in replacement" means that we use type aliases in this file. +// +// TODO: move the type aliases to draw.go once Go 1.16 is no longer supported. + +// RGBA64Image extends both the Image and image.RGBA64Image interfaces with a +// SetRGBA64 method to change a single pixel. SetRGBA64 is equivalent to +// calling Set, but it can avoid allocations from converting concrete color +// types to the color.Color interface type. +type RGBA64Image = draw.RGBA64Image diff --git a/backend/vendor/golang.org/x/net/html/parse.go b/backend/vendor/golang.org/x/net/html/parse.go index f91466f7..038941d7 100644 --- a/backend/vendor/golang.org/x/net/html/parse.go +++ b/backend/vendor/golang.org/x/net/html/parse.go @@ -663,6 +663,24 @@ func inHeadIM(p *parser) bool { // 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