diff --git a/Makefile b/Makefile index f9c05ed9..20679c07 100644 --- a/Makefile +++ b/Makefile @@ -280,8 +280,3 @@ clean: clean-vendor rm -rf cmd/Import-Export/deploy rm -f build last.log mem.pprof main.go rm -rf logo.ico icon.rc icon_windows.syso internal/frontend/qt/icon_windows.syso - -.PHONY: generate -generate: - go generate ./... - $(MAKE) add-license diff --git a/go.mod b/go.mod index b9cf5264..e1ac9ae2 100644 --- a/go.mod +++ b/go.mod @@ -18,13 +18,13 @@ require ( github.com/ProtonMail/go-apple-mobileconfig v0.0.0-20160701194735-7ea9927a11f6 github.com/ProtonMail/go-autostart v0.0.0-20181114175602-c5272053443a github.com/ProtonMail/go-imap-id v0.0.0-20190926060100-f94a56b9ecde + github.com/ProtonMail/go-rfc5322 v0.2.0 github.com/ProtonMail/go-vcard v0.0.0-20180326232728-33aaa0a0c8a5 github.com/ProtonMail/gopenpgp/v2 v2.0.1 github.com/PuerkitoBio/goquery v1.5.1 github.com/abiosoft/ishell v2.0.0+incompatible github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db // indirect github.com/allan-simon/go-singleinstance v0.0.0-20160830203053-79edcfdc2dfc - github.com/antlr/antlr4 v0.0.0-20201020194047-0a7eaede42b0 github.com/certifi/gocertifi v0.0.0-20200211180108-c7c1fbc02894 // indirect github.com/chzyer/logex v1.1.10 // indirect github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect @@ -60,13 +60,11 @@ require ( github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce github.com/olekukonko/tablewriter v0.0.4 // indirect github.com/pkg/errors v0.9.1 - github.com/sirupsen/logrus v1.6.0 + github.com/sirupsen/logrus v1.7.0 github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect github.com/stretchr/testify v1.6.1 github.com/therecipe/qt v0.0.0-20200701200531-7f61353ee73e - github.com/therecipe/qt/internal/binding/files/docs/5.12.0 v0.0.0-20200904063919-c0c124a5770d // indirect - github.com/therecipe/qt/internal/binding/files/docs/5.13.0 v0.0.0-20200904063919-c0c124a5770d // indirect github.com/twinj/uuid v1.0.0 // indirect github.com/urfave/cli v1.22.4 go.etcd.io/bbolt v1.3.5 diff --git a/go.sum b/go.sum index 15ede6c9..9db92e54 100644 --- a/go.sum +++ b/go.sum @@ -21,6 +21,8 @@ github.com/ProtonMail/go-imap-id v0.0.0-20190926060100-f94a56b9ecde h1:5koQozTDE github.com/ProtonMail/go-imap-id v0.0.0-20190926060100-f94a56b9ecde/go.mod h1:795VPXcRUIQ9JyMNHP4el582VokQfippgjkQP3Gk0r0= github.com/ProtonMail/go-mime v0.0.0-20190923161245-9b5a4261663a h1:W6RrgN/sTxg1msqzFFb+G80MFmpjMw61IU+slm+wln4= github.com/ProtonMail/go-mime v0.0.0-20190923161245-9b5a4261663a/go.mod h1:NYt+V3/4rEeDuaev/zw1zCq8uqVEuPHzDPo3OZrlGJ4= +github.com/ProtonMail/go-rfc5322 v0.2.0 h1:tndoDGFtiCvESta9KLUeMksojz8qf76PefnkoQ+fqeg= +github.com/ProtonMail/go-rfc5322 v0.2.0/go.mod h1:mzZWlMWnQJuYLL7JpzuPF5+FimV2lZ9f0jeq24kJjpU= github.com/ProtonMail/go-smtp v0.0.0-20181206232543-8261df20d309 h1:2pzfKjhBjSnw3BgmfTYRFQr1rFGxhfhUY0KKkg+RYxE= github.com/ProtonMail/go-smtp v0.0.0-20181206232543-8261df20d309/go.mod h1:6UoBvDAMA/cTBwS3Y7tGpKnY5RH1F1uYHschT6eqAkI= github.com/ProtonMail/go-vcard v0.0.0-20180326232728-33aaa0a0c8a5 h1:Uga1DHFN4GUxuDQr0F71tpi8I9HqPIlZodZAI1lR6VQ= @@ -37,8 +39,8 @@ github.com/allan-simon/go-singleinstance v0.0.0-20160830203053-79edcfdc2dfc h1:m github.com/allan-simon/go-singleinstance v0.0.0-20160830203053-79edcfdc2dfc/go.mod h1:qqsTQiwdyqxU05iDCsi0oN3P4nrVxAmn8xCtODDSf/U= github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= -github.com/antlr/antlr4 v0.0.0-20201020194047-0a7eaede42b0 h1:7RW94Pqb4Twsfpz42ALQ+sD0cUUpN8HF4uzKyQf2D8Y= -github.com/antlr/antlr4 v0.0.0-20201020194047-0a7eaede42b0/go.mod h1:T7PbCXFs94rrTttyxjbyT5+/1V8T2TYDejxUfHJjw1Y= +github.com/antlr/antlr4 v0.0.0-20201029161626-9a95f0cc3d7c h1:j/C2kxPfyE0d87/ggAjIsCV5Cdkqmjb+O0W8W+1J+IY= +github.com/antlr/antlr4 v0.0.0-20201029161626-9a95f0cc3d7c/go.mod h1:T7PbCXFs94rrTttyxjbyT5+/1V8T2TYDejxUfHJjw1Y= github.com/certifi/gocertifi v0.0.0-20200211180108-c7c1fbc02894 h1:JLaf/iINcLyjwbtTsCJjc6rtlASgHeIJPrB6QmwURnA= github.com/certifi/gocertifi v0.0.0-20200211180108-c7c1fbc02894/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= @@ -109,8 +111,6 @@ github.com/keybase/go-keychain v0.0.0-20200502122510-cda31fe0c86d/go.mod h1:W6Eb github.com/keybase/go.dbus v0.0.0-20200324223359-a94be52c0b03/go.mod h1:a8clEhrrGV/d76/f9r2I41BwANMihfZYV9C223vaxqE= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -148,8 +148,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5I github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= 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/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cmavspvIl9nulOYwdy6IFRRo= @@ -166,12 +166,6 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/therecipe/qt v0.0.0-20200701200531-7f61353ee73e h1:G0DQ/TRQyrEZjtLlLwevFjaRiG8eeCMlq9WXQ2OO2bk= github.com/therecipe/qt v0.0.0-20200701200531-7f61353ee73e/go.mod h1:SUUR2j3aE1z6/g76SdD6NwACEpvCxb3fvG82eKbD6us= -github.com/therecipe/qt v0.0.0-20200904063919-c0c124a5770d h1:T+d8FnaLSvM/1BdlDXhW4d5dr2F07bAbB+LpgzMxx+o= -github.com/therecipe/qt/internal/binding/files/docs v0.0.0-20191019224306-1097424d656c h1:/VhcwU7WuFEVgDHZ9V8PIYAyYqQ6KNxFUjBMOf2aFZM= -github.com/therecipe/qt/internal/binding/files/docs/5.12.0 v0.0.0-20200904063919-c0c124a5770d h1:hAZyEG2swPRWjF0kqqdGERXUazYnRJdAk4a58f14z7Y= -github.com/therecipe/qt/internal/binding/files/docs/5.12.0 v0.0.0-20200904063919-c0c124a5770d/go.mod h1:7m8PDYDEtEVqfjoUQc2UrFqhG0CDmoVJjRlQxexndFc= -github.com/therecipe/qt/internal/binding/files/docs/5.13.0 v0.0.0-20200904063919-c0c124a5770d h1:AJRoBel/g9cDS+yE8BcN3E+TDD/xNAguG21aoR8DAIE= -github.com/therecipe/qt/internal/binding/files/docs/5.13.0 v0.0.0-20200904063919-c0c124a5770d/go.mod h1:mH55Ek7AZcdns5KPp99O0bg+78el64YCYWHiQKrOdt4= github.com/twinj/uuid v1.0.0 h1:fzz7COZnDrXGTAOHGuUGYd6sG+JMq+AoE7+Jlu0przk= github.com/twinj/uuid v1.0.0/go.mod h1:mMgcE1RHFUFqe5AfiwlINXisXfDGro23fWdPUfOMjRY= github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA= diff --git a/internal/transfer/utils.go b/internal/transfer/utils.go index 45be1301..e8871af5 100644 --- a/internal/transfer/utils.go +++ b/internal/transfer/utils.go @@ -28,7 +28,7 @@ import ( "sort" "strings" - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322" + "github.com/ProtonMail/go-rfc5322" "github.com/pkg/errors" ) diff --git a/pkg/message/rfc5322/gen.go b/pkg/message/init.go similarity index 79% rename from pkg/message/rfc5322/gen.go rename to pkg/message/init.go index babf2ac4..a8a09f06 100644 --- a/pkg/message/rfc5322/gen.go +++ b/pkg/message/init.go @@ -15,6 +15,13 @@ // You should have received a copy of the GNU General Public License // along with ProtonMail Bridge. If not, see . -package rfc5322 +package message -//go:generate make antlr +import ( + "github.com/ProtonMail/go-rfc5322" + pmmime "github.com/ProtonMail/proton-bridge/pkg/mime" +) + +func init() { // nolint[noinit] + rfc5322.CharsetReader = pmmime.CharsetReader +} diff --git a/pkg/message/parser.go b/pkg/message/parser.go index bd03d8f5..c350316f 100644 --- a/pkg/message/parser.go +++ b/pkg/message/parser.go @@ -26,8 +26,8 @@ import ( "net/textproto" "strings" + "github.com/ProtonMail/go-rfc5322" "github.com/ProtonMail/proton-bridge/pkg/message/parser" - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322" pmmime "github.com/ProtonMail/proton-bridge/pkg/mime" "github.com/ProtonMail/proton-bridge/pkg/pmapi" "github.com/emersion/go-message" diff --git a/pkg/message/rfc5322/Makefile b/pkg/message/rfc5322/Makefile deleted file mode 100644 index 6082392e..00000000 --- a/pkg/message/rfc5322/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -antlr: RFC5322Parser.g4 RFC5322Lexer.g4 - antlr4 -Dlanguage=Go -o parser $^ diff --git a/pkg/message/rfc5322/README.md b/pkg/message/rfc5322/README.md deleted file mode 100644 index ee5bdbba..00000000 --- a/pkg/message/rfc5322/README.md +++ /dev/null @@ -1,160 +0,0 @@ -# Outline -The `rfc5322` package implements a parser for `address-list` and `date-time` strings, as defined in RFC5322. -It also supports encoded words (RFC2047) and has international tokens (RFC6532). - -# `rfc5322/parser` directory -The lexer and parser are generated using ANTLR4. -The grammar is defined in the g4 files: -- RFC5322Parser.g4 defines the parser grammar, -- RFC5322Lexer.g4 defines the lexer grammar. - -These grammars are derived from the ABNF grammar provided in the RFCs above, -albeit with some relaxations added to support "nonstandard" (bad) input. - -Running `antlr4` on these g4 files generates a parser which recognises strings conforming to the grammar: -- rfc5322_lexer.go -- rfc5322parser_base_listener.go -- rfc5322_parser.go -- rfc5322parser_listener.go - -The generated parser can then be used to convert a valid address/date into an abstract syntax tree. - -# `rfc5322` directory -Once we have an abstract syntax tree, we must turn it into something usable, namely a `mail.Address` or `time.Time`. - -The generated code in the `rfc5322/parser` directory implements a walker. -This walker walks over the abstract syntax tree, -calling a callback when entering and another when when exiting each node. -By default, the callbacks are no-ops, unless they are overridden. - -## `walker.go` -The `walker` type extends the base walker, overriding the default no-op callbacks -to do something specific when entering and exiting certain nodes. - -The goal of the walker is to traverse the syntax tree, picking out relevant information from each node's text. -For example, when parsing a `mailbox` node, the relevant information to pick out from the parse tree is the -name and address of the mailbox. This information can appear in a number of different ways, e.g. it might be -RFC2047 word-encoded, it might be a string with escaped chars that need to be handled, it might have comments -that should be ignored, and so on. - -So while walking the syntax tree, each node needs to ask its children what their "value" is. -The `mailbox` needs to ask its child nodes (either a `nameAddr` node or an `addrSpec` node) -what the name and address are. -If the child node is a `nameAddr`, it needs to ask its `displayName` child what the name is -and the `angleAddr` what the address is; these in turn ask `word` nodes, `addrSpec` nodes, etc. - -Each child node is responsible for telling its parent what its own value is. -The parent is responsible for assembling the children into something useful. - -Ideally, this would be done with the visitor pattern. But unfortunately, the generated parser only -provides a walker interface. So we need to make use of a stack, pushing on nodes when we enter them -and popping off nodes when we exit them, to turn the walker into a kind of visitor. - -## `parser.go` -This file implements two methods, -`ParseAddressList(string) ([]*mail.Address, error)` -and -`ParseDateTime(string) (time.Time, error)`. - -These methods set up a parser from the raw input, start the walker, and convert the walker result -into an object of the correct type. - - -# Example: Parsing `dateTime` -Parsing a date-time is rather simple. The implementation begins in `date_time.go`. The abridged code is below: - -``` -type dateTime struct { - year int - ... -} - -func (dt *dateTime) withYear(year *year) { - dt.year = year.value -} - -... - -func (w *walker) EnterDateTime(ctx *parser.DateTimeContext) { - w.enter(&dateTime{ - loc: time.UTC, - }) -} - -func (w *walker) ExitDateTime(ctx *parser.DateTimeContext) { - dt := w.exit().(*dateTime) - w.res = time.Date(dt.year, ...) -} -``` - -As you can see, when the walker reaches a `dateTime` node, it pushes a `dateTime` object onto the stack: -``` -w.enter(&dateTime{ - loc: time.UTC, -}) -``` - -and when it leaves a `dateTime` node, it pops it off the stack, -converting it from `interface{}` to the concrete type, -and uses the parsed `dateTime` values like day, month, year etc -to construct a go `time.Time` object to set the walker result: -``` -dt := w.exit().(*dateTime) -w.res = time.Date(dt.year, ...) -``` - -These parsed values were discovered while the walker continued to walk across the date-time node. - -Let's see how the walker discovers the `year`. -Here is the abridged code of what happens when the walker enters a `year` node: -``` -type year struct { - value int -} - -func (w *walker) EnterYear(ctx *parser.YearContext) { - var text string - - for _, digit := range ctx.AllDigit() { - text += digit.GetText() - } - - val, err := strconv.Atoi(text) - if err != nil { - w.err = err - } - - w.enter(&year{ - value: val, - }) -} -``` - -When entering the `year` node, it collects all the raw digits, which are strings, then -converts them to an integer, and sets that as the year's integer value while pushing it onto the stack. - -When exiting, it pops the year off the stack and gives itself to the parent (now on the top of the stack). -It doesn't know what type of object the parent is, it just checks to see if anything above it on the stack -is expecting a `year` node: -``` -func (w *walker) ExitYear(ctx *parser.YearContext) { - type withYear interface { - withYear(*year) - } - - res := w.exit().(*year) - - if parent, ok := w.parent().(withYear); ok { - parent.withYear(res) - } -} -``` - -In our case, the `date` is expecting a `year` node because it implements `withYear`, -``` -func (dt *dateTime) withYear(year *year) { - dt.year = year.value -} -``` -and that is how the `dateTime` data members are collected. - diff --git a/pkg/message/rfc5322/RFC5322Lexer.g4 b/pkg/message/rfc5322/RFC5322Lexer.g4 deleted file mode 100644 index 1ba51e2c..00000000 --- a/pkg/message/rfc5322/RFC5322Lexer.g4 +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -lexer grammar RFC5322Lexer; - -U_00: '\u0000'; -U_01_08: '\u0001'..'\u0008'; -TAB: '\t'; // \u0009 -LF: '\n'; // \u000A -U_0B: '\u000B'; -U_0C: '\u000C'; -CR: '\r'; // \u000D -U_0E_1F: '\u000E'..'\u001F'; - -// Printable (0x20-0x7E) -SP: ' '; // \u0020 -Exclamation: '!'; // \u0021 -DQuote: '"'; // \u0022 -Hash: '#'; // \u0023 -Dollar: '$'; // \u0024 -Percent: '%'; // \u0025 -Ampersand: '&'; // \u0026 -SQuote: '\''; // \u0027 -LParens: '('; // \u0028 -RParens: ')'; // \u0029 -Asterisk: '*'; // \u002A -Plus: '+'; // \u002B -Comma: ','; // \u002C -Minus: '-'; // \u002D -Period: '.'; // \u002E -Slash: '/'; // \u002F -Digit: [0-9]; // \u0030 -- \u0039 -Colon: ':'; // \u003A -Semicolon: ';'; // \u003B -Less: '<'; // \u003C -Equal: '='; // \u003D -Greater: '>'; // \u003E -Question: '?'; // \u003F -At: '@'; // \u0040 -// alphaUpper -LBracket: '['; // \u005B -Backslash: '\\'; // \u005C -RBracket: ']'; // \u005D -Caret: '^'; // \u005E -Underscore: '_'; // \u005F -Backtick: '`'; // \u0060 -// alphaLower -LCurly: '{'; // \u007B -Pipe: '|'; // \u007C -RCurly: '}'; // \u007D -Tilde: '~'; // \u007E - -// Other -Delete: '\u007F'; - -// RFC6532 Extension -UTF8NonAscii: '\u0080'..'\uFFFF'; - -A: 'A'|'a'; -B: 'B'|'b'; -C: 'C'|'c'; -D: 'D'|'d'; -E: 'E'|'e'; -F: 'F'|'f'; -G: 'G'|'g'; -H: 'H'|'h'; -I: 'I'|'i'; -J: 'J'|'j'; -K: 'K'|'k'; -L: 'L'|'l'; -M: 'M'|'m'; -N: 'N'|'n'; -O: 'O'|'o'; -P: 'P'|'p'; -Q: 'Q'|'q'; -R: 'R'|'r'; -S: 'S'|'s'; -T: 'T'|'t'; -U: 'U'|'u'; -V: 'V'|'v'; -W: 'W'|'w'; -X: 'X'|'x'; -Y: 'Y'|'y'; -Z: 'Z'|'z'; diff --git a/pkg/message/rfc5322/RFC5322Parser.g4 b/pkg/message/rfc5322/RFC5322Parser.g4 deleted file mode 100644 index 7e655b1a..00000000 --- a/pkg/message/rfc5322/RFC5322Parser.g4 +++ /dev/null @@ -1,530 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -parser grammar RFC5322Parser; - -options { tokenVocab=RFC5322Lexer; } - - -// ------------------- -// 3.2. Lexical tokens -// ------------------- - -quotedChar: vchar | wsp; - -quotedPair - : Backslash quotedChar - | obsQP - ; - -fws - : (wsp* crlf)? wsp+ - | obsFWS - ; - -ctext - : alpha - | Exclamation - | DQuote - | Hash - | Dollar - | Percent - | Ampersand - | SQuote - | Asterisk - | Plus - | Comma - | Minus - | Period - | Slash - | Digit - | Colon - | Semicolon - | Less - | Equal - | Greater - | Question - | At - | LBracket - | RBracket - | Caret - | Underscore - | Backtick - | LCurly - | Pipe - | RCurly - | Tilde - | obsCtext - | UTF8NonAscii - ; - -ccontent - : ctext - | quotedPair - | comment - ; - -comment: LParens (fws? ccontent)* fws? RParens; - -cfws - : (fws? comment)+ fws? - | fws - ; - -atext - : alpha - | Digit - | Exclamation - | Hash - | Dollar - | Percent - | Ampersand - | SQuote - | Asterisk - | Plus - | Minus - | Slash - | Equal - | Question - | Caret - | Underscore - | Backtick - | LCurly - | Pipe - | RCurly - | Tilde - | UTF8NonAscii - ; - -atom: atext+; - -// Allow dotAtom to have a trailing period; some messages in the wild look like this. -dotAtom: atext+ (Period atext+)* Period?; - -qtext - : alpha - | Exclamation - | Hash - | Dollar - | Percent - | Ampersand - | SQuote - | LParens - | RParens - | Asterisk - | Plus - | Comma - | Minus - | Period - | Slash - | Digit - | Colon - | Semicolon - | Less - | Equal - | Greater - | Question - | At - | LBracket - | RBracket - | Caret - | Underscore - | Backtick - | LCurly - | Pipe - | RCurly - | Tilde - | obsQtext - | UTF8NonAscii - ; - -quotedContent - : qtext - | quotedPair - ; - -quotedValue: (fws? quotedContent)*; - -quotedString: DQuote quotedValue fws? DQuote; - -// Allow word to consist of the @ token. -word - : cfws? encodedWord cfws? - | cfws? atom cfws? - | cfws? quotedString cfws? - | At - ; - - -// -------------------------------- -// 3.3. Date and Time Specification -// -------------------------------- - -dateTime: (dayOfweek Comma)? day month year hour Colon minute (Colon second)? zone? cfws? EOF; - -dayOfweek - : fws? dayName - | cfws? dayName cfws? - ; - -dayName - : M O N - | T U E - | W E D - | T H U - | F R I - | S A T - | S U N - ; - -day - : fws? Digit Digit? fws - | cfws? Digit Digit? cfws? - ; - -month - : J A N - | F E B - | M A R - | A P R - | M A Y - | J U N - | J U L - | A U G - | S E P - | O C T - | N O V - | D E C - ; - -year - : fws Digit Digit Digit Digit fws - | cfws? Digit Digit cfws? - ; - -// NOTE: RFC5322 requires two digits for the hour, but we -// relax that requirement a bit, allowing single digits. -hour - : Digit? Digit - | cfws? Digit? Digit cfws? - ; - -minute - : Digit Digit - | cfws? Digit Digit cfws? - ; - -second - : Digit Digit - | cfws? Digit Digit cfws? - ; - -offset: (Plus | Minus)? Digit Digit Digit Digit; - -zone - : fws offset - | obsZone - ; - - -// -------------------------- -// 3.4. Address Specification -// -------------------------- - -address - : mailbox - | group - ; - -mailbox - : nameAddr - | addrSpec - ; - -nameAddr: displayName? angleAddr; - -angleAddr - : cfws? Less addrSpec? Greater cfws? - | obsAngleAddr - ; - -group: displayName Colon groupList? Semicolon cfws?; - -displayName - : word+ - | word (word | Period | cfws)* - ; - -mailboxList - : mailbox (Comma mailbox)* - | obsMboxList - ; - -addressList - : address (Comma address)* EOF - | obsAddrList EOF - ; - -groupList - : mailboxList - | cfws - | obsGroupList - ; - -// Allow addrSpec contain a port. -addrSpec: localPart At domain (Colon port)?; - -localPart - : cfws? dotAtom cfws? - | cfws? quotedString cfws? - | obsLocalPart - ; - -port: Digit+; - -domain - : cfws? dotAtom cfws? - | cfws? domainLiteral cfws? - | cfws? obsDomain cfws? - ; - -domainLiteral: LBracket (fws? dtext)* fws? RBracket; - -dtext - : alpha - | Exclamation - | DQuote - | Hash - | Dollar - | Percent - | Ampersand - | SQuote - | LParens - | RParens - | Asterisk - | Plus - | Comma - | Minus - | Period - | Slash - | Digit - | Colon - | Semicolon - | Less - | Equal - | Greater - | Question - | At - | Caret - | Underscore - | Backtick - | LCurly - | Pipe - | RCurly - | Tilde -//| obsDtext - | UTF8NonAscii - ; - - -// ---------------------------------- -// 4.1. Miscellaneous Obsolete Tokens -// ---------------------------------- - -obsNoWSCTL - : U_01_08 - | U_0B - | U_0C - | U_0E_1F - | Delete - ; - -obsCtext: obsNoWSCTL; - -obsQtext: obsNoWSCTL; - -obsQP: Backslash (U_00 | obsNoWSCTL | LF | CR); - - -// --------------------------------- -// 4.2. Obsolete Folding White Space -// --------------------------------- - -obsFWS: wsp+ (crlf wsp+); - - -// --------------------------- -// 4.3. Obsolete Date and Time -// --------------------------- - -obsZone - : U T - | U T C - | G M T - | E S T - | E D T - | C S T - | C D T - | M S T - | M D T - | P S T - | P D T -//| obsZoneMilitary - ; - - -// ------------------------ -// 4.4. Obsolete Addressing -// ------------------------ - -obsAngleAddr: cfws? Less obsRoute addrSpec Greater cfws?; - -obsRoute: obsDomainList Colon; - -obsDomainList: (cfws | Comma)* At domain (Comma cfws? (At domain)?)*; - -obsMboxList: (cfws? Comma)* mailbox (Comma (mailbox | cfws)?)*; - -obsAddrList: (cfws? Comma)* address (Comma (address | cfws)?)*; - -obsGroupList: (cfws? Comma)+ cfws?; - -obsLocalPart: word (Period word)*; - -obsDomain: atom (Period atom)*; - - -// ------------------------------------ -// 2. Syntax of encoded-words (RFC2047) -// ------------------------------------ - -encodedWord: Equal Question charset Question encoding Question encodedText Question Equal; - -charset: token; - -encoding: token; - -token: tokenChar+; - -tokenChar - : alpha - | Exclamation - | Hash - | Dollar - | Percent - | Ampersand - | SQuote - | Asterisk - | Plus - | Minus - | Digit - | Backslash - | Caret - | Underscore - | Backtick - | LCurly - | Pipe - | RCurly - | Tilde - ; - -encodedText: encodedChar+; - -encodedChar - : alpha - | Exclamation - | DQuote - | Hash - | Dollar - | Percent - | Ampersand - | SQuote - | LParens - | RParens - | Asterisk - | Plus - | Comma - | Minus - | Period - | Slash - | Digit - | Colon - | Semicolon - | Less - | Equal - | Greater - | At - | LBracket - | Backslash - | RBracket - | Caret - | Underscore - | Backtick - | LCurly - | Pipe - | RCurly - | Tilde - ; - - -// ------------------------- -// B.1. Core Rules (RFC5234) -// ------------------------- - -crlf: CR LF; - -wsp: SP | TAB; - -vchar - : alpha - | Exclamation - | DQuote - | Hash - | Dollar - | Percent - | Ampersand - | SQuote - | LParens - | RParens - | Asterisk - | Plus - | Comma - | Minus - | Period - | Slash - | Digit - | Colon - | Semicolon - | Less - | Equal - | Greater - | Question - | At - | LBracket - | Backslash - | RBracket - | Caret - | Underscore - | Backtick - | LCurly - | Pipe - | RCurly - | Tilde - | UTF8NonAscii - ; - -alpha: A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z ; diff --git a/pkg/message/rfc5322/addr_spec.go b/pkg/message/rfc5322/addr_spec.go deleted file mode 100644 index c8587e25..00000000 --- a/pkg/message/rfc5322/addr_spec.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type addrSpec struct { - localPart, domain string -} - -func (a *addrSpec) withLocalPart(localPart *localPart) { - a.localPart = localPart.value -} - -func (a *addrSpec) withDomain(domain *domain) { - a.domain = domain.value -} - -func (a *addrSpec) withPort(port *port) { - a.domain += ":" + port.value -} - -func (w *walker) EnterAddrSpec(ctx *parser.AddrSpecContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering addrSpec") - w.enter(&addrSpec{}) -} - -func (w *walker) ExitAddrSpec(ctx *parser.AddrSpecContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting addrSpec") - - type withAddrSpec interface { - withAddrSpec(*addrSpec) - } - - res := w.exit().(*addrSpec) - - if parent, ok := w.parent().(withAddrSpec); ok { - parent.withAddrSpec(res) - } -} diff --git a/pkg/message/rfc5322/address.go b/pkg/message/rfc5322/address.go deleted file mode 100644 index 144bc339..00000000 --- a/pkg/message/rfc5322/address.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "net/mail" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type address struct { - addresses []*mail.Address -} - -func (a *address) withMailbox(mailbox *mailbox) { - a.addresses = append(a.addresses, &mail.Address{ - Name: mailbox.name, - Address: mailbox.address, - }) -} - -func (a *address) withGroup(group *group) { - a.addresses = append(a.addresses, group.addresses...) -} - -func (w *walker) EnterAddress(ctx *parser.AddressContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering address") - w.enter(&address{}) -} - -func (w *walker) ExitAddress(ctx *parser.AddressContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting address") - - type withAddress interface { - withAddress(*address) - } - - res := w.exit().(*address) - - if parent, ok := w.parent().(withAddress); ok { - parent.withAddress(res) - } -} diff --git a/pkg/message/rfc5322/address_list.go b/pkg/message/rfc5322/address_list.go deleted file mode 100644 index e9b6a64a..00000000 --- a/pkg/message/rfc5322/address_list.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "net/mail" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type addressList struct { - addresses []*mail.Address -} - -func (a *addressList) withAddress(address *address) { - a.addresses = append(a.addresses, address.addresses...) -} - -func (w *walker) EnterAddressList(ctx *parser.AddressListContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering addressList") - w.enter(&addressList{}) -} - -func (w *walker) ExitAddressList(ctx *parser.AddressListContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting addressList") - w.res = w.exit().(*addressList).addresses -} diff --git a/pkg/message/rfc5322/angle_addr.go b/pkg/message/rfc5322/angle_addr.go deleted file mode 100644 index 3c4f94e8..00000000 --- a/pkg/message/rfc5322/angle_addr.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "fmt" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type angleAddr struct { - address string -} - -func (a *angleAddr) withAddrSpec(addrSpec *addrSpec) { - a.address = fmt.Sprintf("%v@%v", addrSpec.localPart, addrSpec.domain) -} - -func (a *angleAddr) withObsAngleAddr(obsAngleAddr *obsAngleAddr) { - a.address = obsAngleAddr.address -} - -func (w *walker) EnterAngleAddr(ctx *parser.AngleAddrContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering angleAddr") - w.enter(&angleAddr{}) -} - -func (w *walker) ExitAngleAddr(ctx *parser.AngleAddrContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting angleAddr") - - type withAngleAddr interface { - withAngleAddr(*angleAddr) - } - - res := w.exit().(*angleAddr) - - if parent, ok := w.parent().(withAngleAddr); ok { - parent.withAngleAddr(res) - } -} diff --git a/pkg/message/rfc5322/atom.go b/pkg/message/rfc5322/atom.go deleted file mode 100644 index 456fa661..00000000 --- a/pkg/message/rfc5322/atom.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type atom struct { - value string -} - -func (w *walker) EnterAtom(ctx *parser.AtomContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering atom") - - w.enter(&atom{ - value: ctx.GetText(), - }) -} - -func (w *walker) ExitAtom(ctx *parser.AtomContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting atom") - - type withAtom interface { - withAtom(*atom) - } - - res := w.exit().(*atom) - - if parent, ok := w.parent().(withAtom); ok { - parent.withAtom(res) - } -} diff --git a/pkg/message/rfc5322/benchmark_test.go b/pkg/message/rfc5322/benchmark_test.go deleted file mode 100644 index ad075c8e..00000000 --- a/pkg/message/rfc5322/benchmark_test.go +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "net/mail" - "testing" -) - -func BenchmarkStandardSet(b *testing.B) { - for i := 0; i < b.N; i++ { - parseSet(benchStandardSet) - } -} - -func BenchmarkStandardSetGolang(b *testing.B) { - for i := 0; i < b.N; i++ { - parseSetGolang(benchStandardSet) - } -} - -func BenchmarkEncodedSet(b *testing.B) { - for i := 0; i < b.N; i++ { - parseSet(benchEncodedSet) - } -} - -func BenchmarkEncodedSetGolang(b *testing.B) { - for i := 0; i < b.N; i++ { - parseSetGolang(benchEncodedSet) - } -} - -func BenchmarkAddressListSet(b *testing.B) { - for i := 0; i < b.N; i++ { - parseSet(benchAddressListSet) - } -} - -func BenchmarkAddressListSetGolang(b *testing.B) { - for i := 0; i < b.N; i++ { - parseSetGolang(benchAddressListSet) - } -} - -func BenchmarkGroupSet(b *testing.B) { - for i := 0; i < b.N; i++ { - parseSet(benchGroupSet) - } -} - -func BenchmarkGroupSetGolang(b *testing.B) { - for i := 0; i < b.N; i++ { - parseSetGolang(benchGroupSet) - } -} - -func parseSet(set []string) { - for _, addr := range set { - _, _ = ParseAddressList(addr) - } -} - -func parseSetGolang(set []string) { - for _, addr := range set { - _, _ = mail.ParseAddressList(addr) - } -} - -var benchStandardSet = []string{ - `user@example.com`, - `John Doe `, - `Mary Smith `, - `"Joe Q. Public" `, - `Mary Smith `, - `jdoe@example.org`, - `Who? `, - ``, - `"Giant; \"Big\" Box" `, - `Pete `, - `"Mary Smith: Personal Account" `, - `Pete(A nice \) chap) `, - `Gogh Fir `, - `normal name `, - `"comma, name" `, - `name (ignore comment)`, - `"Mail Robot" <>`, - `Michal Hořejšek `, - `First Last `, - `First Last `, - `First Last `, - `First Last `, - `First Last `, - ``, - `user@domain `, - `First Last < user@domain.com>`, - `First Middle @ Last `, - `user@domain.com,`, - `First Middle "Last" `, - `First Middle Last `, - `First Middle"Last" `, - `First Middle "Last"`, - `First "Middle" "Last" `, - `First "Middle""Last" `, -} - -var benchEncodedSet = []string{ - `=?US-ASCII?Q?Keith_Moore?= `, - `=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= `, - `=?ISO-8859-1?Q?Andr=E9?= Pirard `, - `=?ISO-8859-1?Q?Olle_J=E4rnefors?= `, - `=?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= `, - `Nathaniel Borenstein (=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=)`, - `=?UTF-8?B?PEJlemUgam3DqW5hPg==?= `, - `First Middle =?utf-8?Q?Last?= `, - `First Middle =?utf-8?Q?Last?=`, - `First =?utf-8?Q?Middle?= =?utf-8?Q?Last?= `, - `First =?utf-8?Q?Middle?==?utf-8?Q?Last?= `, - `First "Middle"=?utf-8?Q?Last?= `, - `First "Middle" =?utf-8?Q?Last?= `, - `First "Middle" =?utf-8?Q?Last?=`, - `=?UTF-8?B?PEJlemUgam3DqW5hPg==?= `, - `=?utf-8?B?6YCZ5piv5ryi5a2X55qE5LiA5YCL5L6L5a2Q?= `, - `=?utf-8?B?8J+MmfCfjbc=?= `, - `=?utf-8?B?8J+MmfCfjbc=?= `, -} - -var benchAddressListSet = []string{ - `Alice , Bob , Eve `, - `Ed Jones ,joe@where.test,John `, - `name (ignore comment) , (Comment as name) username2@server.com`, - `"normal name" , "comma, name" `, - `"comma, one" , "comma, two" `, - `normal name , (comment)All.(around)address@(the)server.com`, - `normal name , All.("comma, in comment")address@(the)server.com`, -} - -var benchGroupSet = []string{ - `A Group:Ed Jones ,joe@where.test,John ;`, - `Undisclosed recipients:;`, - `(Empty list)(start)Hidden recipients :(nobody(that I know)) ;`, -} diff --git a/pkg/message/rfc5322/date_time.go b/pkg/message/rfc5322/date_time.go deleted file mode 100644 index 9bafa5b5..00000000 --- a/pkg/message/rfc5322/date_time.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "time" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type dateTime struct { - day int - month time.Month - year int - - hour, min, sec int - - loc *time.Location -} - -func (dt *dateTime) withDay(day *day) { - dt.day = day.value -} - -func (dt *dateTime) withMonth(month *month) { - dt.month = month.value -} - -func (dt *dateTime) withYear(year *year) { - dt.year = year.value -} - -func (dt *dateTime) withHour(hour *hour) { - dt.hour = hour.value -} - -func (dt *dateTime) withMinute(minute *minute) { - dt.min = minute.value -} - -func (dt *dateTime) withSecond(second *second) { - dt.sec = second.value -} - -func (dt *dateTime) withZone(zone *zone) { - dt.loc = zone.location -} - -func (w *walker) EnterDateTime(ctx *parser.DateTimeContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering dateTime") - - w.enter(&dateTime{ - loc: time.UTC, - }) -} - -func (w *walker) ExitDateTime(ctx *parser.DateTimeContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting dateTime") - - dt := w.exit().(*dateTime) - - w.res = time.Date(dt.year, dt.month, dt.day, dt.hour, dt.min, dt.sec, 0, dt.loc) -} diff --git a/pkg/message/rfc5322/day.go b/pkg/message/rfc5322/day.go deleted file mode 100644 index be5c8f34..00000000 --- a/pkg/message/rfc5322/day.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "strconv" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type day struct { - value int -} - -func (w *walker) EnterDay(ctx *parser.DayContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering day") - - var text string - - for _, digit := range ctx.AllDigit() { - text += digit.GetText() - } - - val, err := strconv.Atoi(text) - if err != nil { - w.err = err - } - - w.enter(&day{ - value: val, - }) -} - -func (w *walker) ExitDay(ctx *parser.DayContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting day") - - type withDay interface { - withDay(*day) - } - - res := w.exit().(*day) - - if parent, ok := w.parent().(withDay); ok { - parent.withDay(res) - } -} diff --git a/pkg/message/rfc5322/display_name.go b/pkg/message/rfc5322/display_name.go deleted file mode 100644 index 1f36941f..00000000 --- a/pkg/message/rfc5322/display_name.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type displayName struct { - words []string -} - -func (n *displayName) withWord(word *word) { - n.words = append(n.words, word.value) -} - -func (w *walker) EnterDisplayName(ctx *parser.DisplayNameContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering displayName") - w.enter(&displayName{}) -} - -func (w *walker) ExitDisplayName(ctx *parser.DisplayNameContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting displayName") - - type withDisplayName interface { - withDisplayName(*displayName) - } - - res := w.exit().(*displayName) - - if parent, ok := w.parent().(withDisplayName); ok { - parent.withDisplayName(res) - } -} diff --git a/pkg/message/rfc5322/domain.go b/pkg/message/rfc5322/domain.go deleted file mode 100644 index 41b9d692..00000000 --- a/pkg/message/rfc5322/domain.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "strings" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type domain struct { - value string -} - -func (d *domain) withDotAtom(dotAtom *dotAtom) { - d.value = dotAtom.value -} - -func (d *domain) withDomainLiteral(domainLiteral *domainLiteral) { - d.value = domainLiteral.value -} - -func (d *domain) withObsDomain(obsDomain *obsDomain) { - d.value = strings.Join(obsDomain.atoms, ".") -} - -func (w *walker) EnterDomain(ctx *parser.DomainContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering domain") - w.enter(&domain{}) -} - -func (w *walker) ExitDomain(ctx *parser.DomainContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting domain") - - type withDomain interface { - withDomain(*domain) - } - - res := w.exit().(*domain) - - if parent, ok := w.parent().(withDomain); ok { - parent.withDomain(res) - } -} diff --git a/pkg/message/rfc5322/domain_literal.go b/pkg/message/rfc5322/domain_literal.go deleted file mode 100644 index 99d29250..00000000 --- a/pkg/message/rfc5322/domain_literal.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type domainLiteral struct { - value string -} - -func (w *walker) EnterDomainLiteral(ctx *parser.DomainLiteralContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering domainLiteral") - - w.enter(&domainLiteral{ - value: ctx.GetText(), - }) -} - -func (w *walker) ExitDomainLiteral(ctx *parser.DomainLiteralContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting domainLiteral") - - type withDomainLiteral interface { - withDomainLiteral(*domainLiteral) - } - - res := w.exit().(*domainLiteral) - - if parent, ok := w.parent().(withDomainLiteral); ok { - parent.withDomainLiteral(res) - } -} diff --git a/pkg/message/rfc5322/dot_atom.go b/pkg/message/rfc5322/dot_atom.go deleted file mode 100644 index 43f15462..00000000 --- a/pkg/message/rfc5322/dot_atom.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type dotAtom struct { - value string -} - -func (w *walker) EnterDotAtom(ctx *parser.DotAtomContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering dotAtom") - - w.enter(&dotAtom{ - value: ctx.GetText(), - }) -} - -func (w *walker) ExitDotAtom(ctx *parser.DotAtomContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting dotAtom") - - type withDotAtom interface { - withDotAtom(*dotAtom) - } - - res := w.exit().(*dotAtom) - - if parent, ok := w.parent().(withDotAtom); ok { - parent.withDotAtom(res) - } -} diff --git a/pkg/message/rfc5322/encoded_word.go b/pkg/message/rfc5322/encoded_word.go deleted file mode 100644 index 9eb3a99f..00000000 --- a/pkg/message/rfc5322/encoded_word.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - pmmime "github.com/ProtonMail/proton-bridge/pkg/mime" - "github.com/sirupsen/logrus" -) - -type encodedWord struct { - value string -} - -func (w *walker) EnterEncodedWord(ctx *parser.EncodedWordContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering encodedWord") - - word, err := pmmime.WordDec.Decode(ctx.GetText()) - if err != nil { - word = ctx.GetText() - } - - w.enter(&encodedWord{ - value: word, - }) -} - -func (w *walker) ExitEncodedWord(ctx *parser.EncodedWordContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting encodedWord") - - type withEncodedWord interface { - withEncodedWord(*encodedWord) - } - - res := w.exit().(*encodedWord) - - if parent, ok := w.parent().(withEncodedWord); ok { - parent.withEncodedWord(res) - } -} diff --git a/pkg/message/rfc5322/fws.go b/pkg/message/rfc5322/fws.go deleted file mode 100644 index d2b8e8a0..00000000 --- a/pkg/message/rfc5322/fws.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type fws struct { - value string -} - -func (w *walker) EnterFws(ctx *parser.FwsContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering fws") - - w.enter(&fws{ - value: ctx.GetText(), - }) -} - -func (w *walker) ExitFws(ctx *parser.FwsContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting fws") - - type withFws interface { - withFws(*fws) - } - - res := w.exit().(*fws) - - if parent, ok := w.parent().(withFws); ok { - parent.withFws(res) - } -} diff --git a/pkg/message/rfc5322/group.go b/pkg/message/rfc5322/group.go deleted file mode 100644 index 24df688c..00000000 --- a/pkg/message/rfc5322/group.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "net/mail" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type group struct { - addresses []*mail.Address -} - -func (g *group) withGroupList(groupList *groupList) { - g.addresses = append(g.addresses, groupList.addresses...) -} - -func (w *walker) EnterGroup(ctx *parser.GroupContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering group") - w.enter(&group{}) -} - -func (w *walker) ExitGroup(ctx *parser.GroupContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting group") - - type withGroup interface { - withGroup(*group) - } - - res := w.exit().(*group) - - if parent, ok := w.parent().(withGroup); ok { - parent.withGroup(res) - } -} diff --git a/pkg/message/rfc5322/group_list.go b/pkg/message/rfc5322/group_list.go deleted file mode 100644 index 8ff05202..00000000 --- a/pkg/message/rfc5322/group_list.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "net/mail" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type groupList struct { - addresses []*mail.Address -} - -func (gl *groupList) withMailboxList(mailboxList *mailboxList) { - gl.addresses = append(gl.addresses, mailboxList.addresses...) -} - -func (w *walker) EnterGroupList(ctx *parser.GroupListContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering groupList") - w.enter(&groupList{}) -} - -func (w *walker) ExitGroupList(ctx *parser.GroupListContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting groupList") - - type withGroupList interface { - withGroupList(*groupList) - } - - res := w.exit().(*groupList) - - if parent, ok := w.parent().(withGroupList); ok { - parent.withGroupList(res) - } -} diff --git a/pkg/message/rfc5322/hour.go b/pkg/message/rfc5322/hour.go deleted file mode 100644 index 95a47b82..00000000 --- a/pkg/message/rfc5322/hour.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "strconv" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type hour struct { - value int -} - -func (w *walker) EnterHour(ctx *parser.HourContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering hour") - - var text string - - for _, digit := range ctx.AllDigit() { - text += digit.GetText() - } - - val, err := strconv.Atoi(text) - if err != nil { - w.err = err - } - - w.enter(&hour{ - value: val, - }) -} - -func (w *walker) ExitHour(ctx *parser.HourContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting hour") - - type withHour interface { - withHour(*hour) - } - - res := w.exit().(*hour) - - if parent, ok := w.parent().(withHour); ok { - parent.withHour(res) - } -} diff --git a/pkg/message/rfc5322/local_part.go b/pkg/message/rfc5322/local_part.go deleted file mode 100644 index 0050c452..00000000 --- a/pkg/message/rfc5322/local_part.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "strings" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type localPart struct { - value string -} - -func (p *localPart) withDotAtom(dotAtom *dotAtom) { - p.value = dotAtom.value -} - -func (p *localPart) withQuotedString(quotedString *quotedString) { - p.value = quotedString.value -} - -func (p *localPart) withObsLocalPart(obsLocalPart *obsLocalPart) { - p.value = strings.Join(obsLocalPart.words, ".") -} - -func (w *walker) EnterLocalPart(ctx *parser.LocalPartContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering localPart") - w.enter(&localPart{}) -} - -func (w *walker) ExitLocalPart(ctx *parser.LocalPartContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting localPart") - - type withLocalPart interface { - withLocalPart(*localPart) - } - - res := w.exit().(*localPart) - - if parent, ok := w.parent().(withLocalPart); ok { - parent.withLocalPart(res) - } -} diff --git a/pkg/message/rfc5322/mailbox.go b/pkg/message/rfc5322/mailbox.go deleted file mode 100644 index 7a295c7e..00000000 --- a/pkg/message/rfc5322/mailbox.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "fmt" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type mailbox struct { - name, address string -} - -func (m *mailbox) withNameAddr(nameAddr *nameAddr) { - m.name = nameAddr.name - m.address = nameAddr.address -} - -func (m *mailbox) withAddrSpec(addrSpec *addrSpec) { - m.address = fmt.Sprintf("%v@%v", addrSpec.localPart, addrSpec.domain) -} - -func (w *walker) EnterMailbox(ctx *parser.MailboxContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering mailbox") - w.enter(&mailbox{}) -} - -func (w *walker) ExitMailbox(ctx *parser.MailboxContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting mailbox") - - type withMailbox interface { - withMailbox(*mailbox) - } - - res := w.exit().(*mailbox) - - if parent, ok := w.parent().(withMailbox); ok { - parent.withMailbox(res) - } -} diff --git a/pkg/message/rfc5322/mailbox_list.go b/pkg/message/rfc5322/mailbox_list.go deleted file mode 100644 index f791546b..00000000 --- a/pkg/message/rfc5322/mailbox_list.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "net/mail" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type mailboxList struct { - addresses []*mail.Address -} - -func (ml *mailboxList) withMailbox(mailbox *mailbox) { - ml.addresses = append(ml.addresses, &mail.Address{ - Name: mailbox.name, - Address: mailbox.address, - }) -} - -func (ml *mailboxList) withObsMboxList(obsMboxList *obsMboxList) { - ml.addresses = append(ml.addresses, obsMboxList.addresses...) -} - -func (w *walker) EnterMailboxList(ctx *parser.MailboxListContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering mailboxList") - w.enter(&mailboxList{}) -} - -func (w *walker) ExitMailboxList(ctx *parser.MailboxListContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting mailboxList") - - type withMailboxList interface { - withMailboxList(*mailboxList) - } - - res := w.exit().(*mailboxList) - - if parent, ok := w.parent().(withMailboxList); ok { - parent.withMailboxList(res) - } -} diff --git a/pkg/message/rfc5322/minute.go b/pkg/message/rfc5322/minute.go deleted file mode 100644 index b0e9134b..00000000 --- a/pkg/message/rfc5322/minute.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "strconv" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type minute struct { - value int -} - -func (w *walker) EnterMinute(ctx *parser.MinuteContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering minute") - - var text string - - for _, digit := range ctx.AllDigit() { - text += digit.GetText() - } - - val, err := strconv.Atoi(text) - if err != nil { - w.err = err - } - - w.enter(&minute{ - value: val, - }) -} - -func (w *walker) ExitMinute(ctx *parser.MinuteContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting minute") - - type withMinute interface { - withMinute(*minute) - } - - res := w.exit().(*minute) - - if parent, ok := w.parent().(withMinute); ok { - parent.withMinute(res) - } -} diff --git a/pkg/message/rfc5322/month.go b/pkg/message/rfc5322/month.go deleted file mode 100644 index c7214034..00000000 --- a/pkg/message/rfc5322/month.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "errors" - "strings" - "time" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type month struct { - value time.Month -} - -func (w *walker) EnterMonth(ctx *parser.MonthContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering month") - - var m time.Month - - switch strings.ToLower(ctx.GetText()) { - case "jan": - m = time.January - case "feb": - m = time.February - case "mar": - m = time.March - case "apr": - m = time.April - case "may": - m = time.May - case "jun": - m = time.June - case "jul": - m = time.July - case "aug": - m = time.August - case "sep": - m = time.September - case "oct": - m = time.October - case "nov": - m = time.November - case "dec": - m = time.December - default: - w.err = errors.New("no such month") - } - - w.enter(&month{ - value: m, - }) -} - -func (w *walker) ExitMonth(ctx *parser.MonthContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting month") - - type withMonth interface { - withMonth(*month) - } - - res := w.exit().(*month) - - if parent, ok := w.parent().(withMonth); ok { - parent.withMonth(res) - } -} diff --git a/pkg/message/rfc5322/name_addr.go b/pkg/message/rfc5322/name_addr.go deleted file mode 100644 index 73445e22..00000000 --- a/pkg/message/rfc5322/name_addr.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "strings" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type nameAddr struct { - name, address string -} - -func (a *nameAddr) withDisplayName(displayName *displayName) { - a.name = strings.Join(displayName.words, " ") -} - -func (a *nameAddr) withAngleAddr(angleAddr *angleAddr) { - a.address = angleAddr.address -} - -func (w *walker) EnterNameAddr(ctx *parser.NameAddrContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering nameAddr") - w.enter(&nameAddr{}) -} - -func (w *walker) ExitNameAddr(ctx *parser.NameAddrContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting nameAddr") - - type withNameAddr interface { - withNameAddr(*nameAddr) - } - - res := w.exit().(*nameAddr) - - if parent, ok := w.parent().(withNameAddr); ok { - parent.withNameAddr(res) - } -} diff --git a/pkg/message/rfc5322/obs_angle_addr.go b/pkg/message/rfc5322/obs_angle_addr.go deleted file mode 100644 index 351f36b2..00000000 --- a/pkg/message/rfc5322/obs_angle_addr.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "fmt" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -// When interpreting addresses, the route portion SHOULD be ignored. - -type obsAngleAddr struct { - address string -} - -func (a *obsAngleAddr) withAddrSpec(addrSpec *addrSpec) { - a.address = fmt.Sprintf("%v@%v", addrSpec.localPart, addrSpec.domain) -} - -func (w *walker) EnterObsAngleAddr(ctx *parser.ObsAngleAddrContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering obsAngleAddr") - w.enter(&obsAngleAddr{}) -} - -func (w *walker) ExitObsAngleAddr(ctx *parser.ObsAngleAddrContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting obsAngleAddr") - - type withObsAngleAddr interface { - withObsAngleAddr(*obsAngleAddr) - } - - res := w.exit().(*obsAngleAddr) - - if parent, ok := w.parent().(withObsAngleAddr); ok { - parent.withObsAngleAddr(res) - } -} diff --git a/pkg/message/rfc5322/obs_domain.go b/pkg/message/rfc5322/obs_domain.go deleted file mode 100644 index 3fbc837b..00000000 --- a/pkg/message/rfc5322/obs_domain.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type obsDomain struct { - atoms []string -} - -func (p *obsDomain) withAtom(atom *atom) { - p.atoms = append(p.atoms, atom.value) -} - -func (w *walker) EnterObsDomain(ctx *parser.ObsDomainContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering obsDomain") - w.enter(&obsDomain{}) -} - -func (w *walker) ExitObsDomain(ctx *parser.ObsDomainContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting obsDomain") - - type withObsDomain interface { - withObsDomain(*obsDomain) - } - - res := w.exit().(*obsDomain) - - if parent, ok := w.parent().(withObsDomain); ok { - parent.withObsDomain(res) - } -} diff --git a/pkg/message/rfc5322/obs_local_part.go b/pkg/message/rfc5322/obs_local_part.go deleted file mode 100644 index c6faf689..00000000 --- a/pkg/message/rfc5322/obs_local_part.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type obsLocalPart struct { - words []string -} - -func (p *obsLocalPart) withWord(word *word) { - p.words = append(p.words, word.value) -} - -func (w *walker) EnterObsLocalPart(ctx *parser.ObsLocalPartContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering obsLocalPart") - w.enter(&obsLocalPart{}) -} - -func (w *walker) ExitObsLocalPart(ctx *parser.ObsLocalPartContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting obsLocalPart") - - type withObsLocalPart interface { - withObsLocalPart(*obsLocalPart) - } - - res := w.exit().(*obsLocalPart) - - if parent, ok := w.parent().(withObsLocalPart); ok { - parent.withObsLocalPart(res) - } -} diff --git a/pkg/message/rfc5322/obs_mbox_list.go b/pkg/message/rfc5322/obs_mbox_list.go deleted file mode 100644 index 2c7e5c76..00000000 --- a/pkg/message/rfc5322/obs_mbox_list.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "net/mail" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type obsMboxList struct { - addresses []*mail.Address -} - -func (ml *obsMboxList) withMailbox(mailbox *mailbox) { - ml.addresses = append(ml.addresses, &mail.Address{ - Name: mailbox.name, - Address: mailbox.address, - }) -} - -func (w *walker) EnterObsMboxList(ctx *parser.ObsMboxListContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering obsMboxList") - w.enter(&obsMboxList{}) -} - -func (w *walker) ExitObsMboxList(ctx *parser.ObsMboxListContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting obsMboxList") - - type withObsMboxList interface { - withObsMboxList(*obsMboxList) - } - - res := w.exit().(*obsMboxList) - - if parent, ok := w.parent().(withObsMboxList); ok { - parent.withObsMboxList(res) - } -} diff --git a/pkg/message/rfc5322/obs_zone.go b/pkg/message/rfc5322/obs_zone.go deleted file mode 100644 index 1f346931..00000000 --- a/pkg/message/rfc5322/obs_zone.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "errors" - "strings" - "time" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type obsZone struct { - location *time.Location -} - -func (w *walker) EnterObsZone(ctx *parser.ObsZoneContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering obsZone") - - loc := time.UTC - - switch strings.ToLower(ctx.GetText()) { - case "ut": - loc = time.FixedZone(ctx.GetText(), 0) - case "utc": - loc = time.FixedZone(ctx.GetText(), 0) - case "gmt": - loc = time.FixedZone(ctx.GetText(), 0) - case "est": - loc = time.FixedZone(ctx.GetText(), -5*60*60) - case "edt": - loc = time.FixedZone(ctx.GetText(), -4*60*60) - case "cst": - loc = time.FixedZone(ctx.GetText(), -6*60*60) - case "cdt": - loc = time.FixedZone(ctx.GetText(), -5*60*60) - case "mst": - loc = time.FixedZone(ctx.GetText(), -7*60*60) - case "mdt": - loc = time.FixedZone(ctx.GetText(), -6*60*60) - case "pst": - loc = time.FixedZone(ctx.GetText(), -8*60*60) - case "pdt": - loc = time.FixedZone(ctx.GetText(), -7*60*60) - default: - w.err = errors.New("bad timezone") - } - - w.enter(&obsZone{ - location: loc, - }) -} - -func (w *walker) ExitObsZone(ctx *parser.ObsZoneContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting obsZone") - - type withObsZone interface { - withObsZone(*obsZone) - } - - res := w.exit().(*obsZone) - - if parent, ok := w.parent().(withObsZone); ok { - parent.withObsZone(res) - } -} diff --git a/pkg/message/rfc5322/offset.go b/pkg/message/rfc5322/offset.go deleted file mode 100644 index 9e63f079..00000000 --- a/pkg/message/rfc5322/offset.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "fmt" - "strings" - "time" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type offset struct { - rep string - value int -} - -func (w *walker) EnterOffset(ctx *parser.OffsetContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering offset") - - text := ctx.GetText() - - // NOTE: RFC5322 date-time should always begin with + or - - // but we relax that requirement a bit due to many messages - // in the wild that skip the +; we add the "+" if missing. - if !strings.HasPrefix(text, "+") && !strings.HasPrefix(text, "-") { - text = "+" + text - } - - sgn := text[0:1] - hrs := text[1:3] - min := text[3:5] - - dur, err := time.ParseDuration(fmt.Sprintf("%v%vh%vm", sgn, hrs, min)) - if err != nil { - w.err = err - } - - w.enter(&offset{ - rep: text, - value: int(dur.Seconds()), - }) -} - -func (w *walker) ExitOffset(ctx *parser.OffsetContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting offset") - - type withOffset interface { - withOffset(*offset) - } - - res := w.exit().(*offset) - - if parent, ok := w.parent().(withOffset); ok { - parent.withOffset(res) - } -} diff --git a/pkg/message/rfc5322/parse_address_list_test.go b/pkg/message/rfc5322/parse_address_list_test.go deleted file mode 100644 index 0ab2222a..00000000 --- a/pkg/message/rfc5322/parse_address_list_test.go +++ /dev/null @@ -1,701 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "encoding/xml" - "io" - "net/mail" - "os" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestParseSingleAddress(t *testing.T) { - tests := []struct { - input string - addrs []*mail.Address - }{ - { - input: `user@example.com`, - addrs: []*mail.Address{{ - Address: `user@example.com`, - }}, - }, - { - input: `John Doe `, - addrs: []*mail.Address{{ - Name: `John Doe`, - Address: `jdoe@machine.example`, - }}, - }, - { - input: `Mary Smith `, - addrs: []*mail.Address{{ - Name: `Mary Smith`, - Address: `mary@example.net`, - }}, - }, - { - input: `"Joe Q. Public" `, - addrs: []*mail.Address{{ - Name: `Joe Q. Public`, - Address: `john.q.public@example.com`, - }}, - }, - { - input: `Mary Smith `, - addrs: []*mail.Address{{ - Name: `Mary Smith`, - Address: `mary@x.test`, - }}, - }, - { - input: `jdoe@example.org`, - addrs: []*mail.Address{{ - Address: `jdoe@example.org`, - }}, - }, - { - input: `Who? `, - addrs: []*mail.Address{{ - Name: `Who?`, - Address: `one@y.test`, - }}, - }, - { - input: ``, - addrs: []*mail.Address{{ - Address: `boss@nil.test`, - }}, - }, - { - input: `"Giant; \"Big\" Box" `, - addrs: []*mail.Address{{ - Name: `Giant; "Big" Box`, - Address: `sysservices@example.net`, - }}, - }, - { - input: `Pete `, - addrs: []*mail.Address{{ - Name: `Pete`, - Address: `pete@silly.example`, - }}, - }, - { - input: `"Mary Smith: Personal Account" `, - addrs: []*mail.Address{{ - Name: `Mary Smith: Personal Account`, - Address: `smith@home.example`, - }}, - }, - { - input: `Pete(A nice \) chap) `, - addrs: []*mail.Address{{ - Name: `Pete`, - Address: `pete@silly.test`, - }}, - }, - { - input: `Gogh Fir `, - addrs: []*mail.Address{{ - Name: `Gogh Fir`, - Address: `gf@example.com`, - }}, - }, - { - input: `normal name `, - addrs: []*mail.Address{{ - Name: `normal name`, - Address: `username@server.com`, - }}, - }, - { - input: `"comma, name" `, - addrs: []*mail.Address{{ - Name: `comma, name`, - Address: `username@server.com`, - }}, - }, - { - input: `name (ignore comment)`, - addrs: []*mail.Address{{ - Name: `name`, - Address: `username@server.com`, - }}, - }, - { - input: `"Mail Robot" <>`, - addrs: []*mail.Address{{ - Name: `Mail Robot`, - }}, - }, - { - input: `Michal Hořejšek `, - addrs: []*mail.Address{{ - Name: `Michal Hořejšek`, - Address: `hořejšek@mail.com`, // Not his real address. - }}, - }, - { - input: `First Last `, - addrs: []*mail.Address{{ - Name: `First Last`, - Address: `user@domain.com`, - }}, - }, - { - input: `First Last `, - addrs: []*mail.Address{{ - Name: `First Last`, - Address: `user@domain.com.`, - }}, - }, - { - input: `First Last `, - addrs: []*mail.Address{{ - Name: `First Last`, - Address: `user@domain.com.`, - }}, - }, - { - input: `First Last `, - addrs: []*mail.Address{{ - Name: `First Last`, - Address: `user@domain.com:25`, - }}, - }, - { - input: `First Last `, - addrs: []*mail.Address{{ - Name: `First Last`, - Address: `user@[10.0.0.1]`, - }}, - }, - { - input: ``, - addrs: []*mail.Address{ - { - Address: `postmaster@[10.10.10.10]`, - }, - }, - }, - { - input: `user@domain `, - addrs: []*mail.Address{{ - // Name: `user@domain`, - Name: `user @ domain`, - Address: `user@domain.com`, - }}, - }, - { - input: `First Last < user@domain.com>`, - addrs: []*mail.Address{{ - Name: `First Last`, - Address: `user@domain.com`, - }}, - }, - { - input: `First Middle @ Last `, - addrs: []*mail.Address{{ - Name: `First Middle @ Last`, - Address: `user@domain.com`, - }}, - }, - { - input: `user@domain.com,`, - addrs: []*mail.Address{ - { - Address: `user@domain.com`, - }, - }, - }, - { - input: `First Middle "Last" `, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - { - input: `First Middle Last `, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - { - input: `First Middle"Last" `, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - { - input: `First Middle "Last"`, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - { - input: `First "Middle" "Last" `, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - { - input: `First "Middle""Last" `, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - } - for _, test := range tests { - test := test - - t.Run(test.input, func(t *testing.T) { - addrs, err := ParseAddressList(test.input) - assert.NoError(t, err) - assert.ElementsMatch(t, test.addrs, addrs) - }) - } -} - -func TestParseSingleAddressEncodedWord(t *testing.T) { - tests := []struct { - input string - addrs []*mail.Address - }{ - { - input: `=?US-ASCII?Q?Keith_Moore?= `, - addrs: []*mail.Address{{ - Name: `Keith Moore`, - Address: `moore@cs.utk.edu`, - }}, - }, - { - input: `=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= `, - addrs: []*mail.Address{{ - Name: `Keld Jørn Simonsen`, - Address: `keld@dkuug.dk`, - }}, - }, - { - input: `=?ISO-8859-1?Q?Andr=E9?= Pirard `, - addrs: []*mail.Address{{ - Name: `André Pirard`, - Address: `PIRARD@vm1.ulg.ac.be`, - }}, - }, - { - input: `=?ISO-8859-1?Q?Olle_J=E4rnefors?= `, - addrs: []*mail.Address{{ - Name: `Olle Järnefors`, - Address: `ojarnef@admin.kth.se`, - }}, - }, - { - input: `=?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= `, - addrs: []*mail.Address{{ - Name: `Patrik Fältström`, - Address: `paf@nada.kth.se`, - }}, - }, - { - input: `Nathaniel Borenstein (=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=)`, - addrs: []*mail.Address{{ - Name: `Nathaniel Borenstein`, - Address: `nsb@thumper.bellcore.com`, - }}, - }, - { - input: `=?UTF-8?B?PEJlemUgam3DqW5hPg==?= `, - addrs: []*mail.Address{ - { - Name: ``, - Address: `user@domain.com`, - }, - }, - }, - { - input: `First Middle =?utf-8?Q?Last?= `, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - /* - { - input: `First Middle=?utf-8?Q?Last?= `, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - */ - { - input: `First Middle =?utf-8?Q?Last?=`, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - { - input: `First =?utf-8?Q?Middle?= =?utf-8?Q?Last?= `, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - { - input: `First =?utf-8?Q?Middle?==?utf-8?Q?Last?= `, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - { - input: `First "Middle"=?utf-8?Q?Last?= `, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - { - input: `First "Middle" =?utf-8?Q?Last?= `, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - { - input: `First "Middle" =?utf-8?Q?Last?=`, - addrs: []*mail.Address{ - { - Name: `First Middle Last`, - Address: `user@domain.com`, - }, - }, - }, - { - input: `=?UTF-8?B?PEJlemUgam3DqW5hPg==?= `, - addrs: []*mail.Address{ - { - Name: ``, - Address: `user@domain.com`, - }, - }, - }, - } - for _, test := range tests { - test := test - - t.Run(test.input, func(t *testing.T) { - addrs, err := ParseAddressList(test.input) - assert.NoError(t, err) - assert.ElementsMatch(t, test.addrs, addrs) - }) - } -} - -func TestParseAddressList(t *testing.T) { - tests := []struct { - input string - addrs []*mail.Address - }{ - { - input: `Alice , Bob , Eve `, - addrs: []*mail.Address{ - { - Name: `Alice`, - Address: `alice@example.com`, - }, - { - Name: `Bob`, - Address: `bob@example.com`, - }, - { - Name: `Eve`, - Address: `eve@example.com`, - }, - }, - }, - { - input: `Ed Jones ,joe@where.test,John `, - addrs: []*mail.Address{ - { - Name: `Ed Jones`, - Address: `c@a.test`, - }, - { - Address: `joe@where.test`, - }, - { - Name: `John`, - Address: `jdoe@one.test`, - }, - }, - }, - { - input: `name (ignore comment) , (Comment as name) username2@server.com`, - addrs: []*mail.Address{ - { - Name: `name`, - Address: `username@server.com`, - }, - { - Address: `username2@server.com`, - }, - }, - }, - { - input: `"normal name" , "comma, name" `, - addrs: []*mail.Address{ - { - Name: `normal name`, - Address: `username@server.com`, - }, - { - Name: `comma, name`, - Address: `address@server.com`, - }, - }, - }, - { - input: `"comma, one" , "comma, two" `, - addrs: []*mail.Address{ - { - Name: `comma, one`, - Address: `username@server.com`, - }, - { - Name: `comma, two`, - Address: `address@server.com`, - }, - }, - }, - { - input: `normal name , (comment)All.(around)address@(the)server.com`, - addrs: []*mail.Address{ - { - Name: `normal name`, - Address: `username@server.com`, - }, - { - Address: `All.address@server.com`, - }, - }, - }, - { - input: `normal name , All.("comma, in comment")address@(the)server.com`, - addrs: []*mail.Address{ - { - Name: `normal name`, - Address: `username@server.com`, - }, - { - Address: `All.address@server.com`, - }, - }, - }, - } - for _, test := range tests { - test := test - - t.Run(test.input, func(t *testing.T) { - addrs, err := ParseAddressList(test.input) - assert.NoError(t, err) - assert.ElementsMatch(t, test.addrs, addrs) - }) - } -} - -func TestParseGroup(t *testing.T) { - tests := []struct { - input string - addrs []*mail.Address - }{ - { - input: `A Group:Ed Jones ,joe@where.test,John ;`, - addrs: []*mail.Address{ - { - Name: `Ed Jones`, - Address: `c@a.test`, - }, - { - Address: `joe@where.test`, - }, - { - Name: `John`, - Address: `jdoe@one.test`, - }, - }, - }, - { - input: `Undisclosed recipients:;`, - addrs: []*mail.Address{}, - }, - { - input: `(Empty list)(start)Hidden recipients :(nobody(that I know)) ;`, - addrs: []*mail.Address{}, - }, - } - for _, test := range tests { - test := test - - t.Run(test.input, func(t *testing.T) { - addrs, err := ParseAddressList(test.input) - assert.NoError(t, err) - assert.ElementsMatch(t, test.addrs, addrs) - }) - } -} - -// TestParseRejectedAddresses tests that weird addresses that are rejected by -// serverside are also rejected by us. If for some reason we end up being able -// to parse these malformed addresses, great! For now let's collect them here. -func TestParseRejectedAddresses(t *testing.T) { - tests := []struct { - input string - addrs []*mail.Address - }{ - {input: `"comma, name" , another, name `}, - {input: `username`}, - {input: `undisclosed-recipients:`}, - {input: `=?ISO-8859-2?Q?First_Last?= , `}, - {input: `user@domain...com`}, - {input: `=?windows-1250?Q?Spr=E1vce_syst=E9mu?=`}, - {input: `"'user@domain.com.'"`}, - {input: ``}, - } - for _, test := range tests { - test := test - - t.Run(test.input, func(t *testing.T) { - _, err := ParseAddressList(test.input) - assert.Error(t, err) - }) - } -} - -// TestIsEmailValidCategory runs over the "IsEmail" standard tests, -// ensuring it can at least recognize all emails in the "valid" category. -// In future, we should expand these tests to run over more categories. -func TestIsEmailValidCategory(t *testing.T) { - f, err := os.Open("tests.xml") - require.NoError(t, err) - defer func() { require.NoError(t, err) }() - - for test := range readTestCases(f) { - test := test - - if test.category != "ISEMAIL_VALID_CATEGORY" { - continue - } - - t.Run(test.id, func(t *testing.T) { - _, err := ParseAddressList(test.address) - assert.NoError(t, err) - }) - } -} - -type testCase struct { - id string - address string - category string - diagnosis string -} - -func readTestCases(r io.Reader) chan testCase { - ch := make(chan testCase) - - var ( - test testCase - data string - ) - - go func() { - decoder := xml.NewDecoder(r) - - for token, err := decoder.Token(); err == nil; token, err = decoder.Token() { - switch t := token.(type) { - case xml.StartElement: - if t.Name.Local == "test" { - test = testCase{ - id: t.Attr[0].Value, - } - } - - case xml.EndElement: - switch t.Name.Local { - case "test": - ch <- test - - case "address": - test.address = data - - case "category": - test.category = data - - case "diagnosis": - test.diagnosis = data - } - - case xml.CharData: - data = string(t) - } - } - - close(ch) - }() - - return ch -} diff --git a/pkg/message/rfc5322/parse_date_time_test.go b/pkg/message/rfc5322/parse_date_time_test.go deleted file mode 100644 index 50d97aaa..00000000 --- a/pkg/message/rfc5322/parse_date_time_test.go +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func TestParseDateTime(t *testing.T) { - tests := []struct { - input string - want string - }{ - { - input: `Fri, 21 Nov 1997 09:55:06`, - want: `1997-11-21T09:55:06Z`, - }, - { - input: `Fri, 21 Nov 1997 09:55:06 -0600`, - want: `1997-11-21T09:55:06-06:00`, - }, - { - input: `Tue, 1 Jul 2003 10:52:37 +0200`, - want: `2003-07-01T10:52:37+02:00`, - }, - { - input: `Thu, 13 Feb 1969 23:32:54 -0330`, - want: `1969-02-13T23:32:54-03:30`, - }, - { - input: "Thu, 13 Feb 1969 23:32 -0330 (Newfoundland Time)", - want: `1969-02-13T23:32:00-03:30`, - }, - { - input: `2 Jan 2006 15:04:05 -0700`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `2 Jan 2006 15:04:05 MST`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `2 Jan 2006 15:04 -0700`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `2 Jan 2006 15:04 MST`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `2 Jan 06 15:04:05 -0700`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `2 Jan 06 15:04:05 MST`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `2 Jan 06 15:04 -0700`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `2 Jan 06 15:04 MST`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `02 Jan 2006 15:04:05 -0700`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `02 Jan 2006 15:04:05 MST`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `02 Jan 2006 15:04 -0700`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `02 Jan 2006 15:04 MST`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `02 Jan 06 15:04:05 -0700`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `02 Jan 06 15:04:05 MST`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `02 Jan 06 15:04 -0700`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `02 Jan 06 15:04 MST`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `Mon, 2 Jan 2006 15:04:05 -0700`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `Mon, 2 Jan 2006 15:04:05 MST`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `Mon, 2 Jan 2006 15:04 -0700`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `Mon, 2 Jan 2006 15:04 MST`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `Mon, 2 Jan 06 15:04:05 -0700`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `Mon, 2 Jan 06 15:04:05 MST`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `Mon, 2 Jan 06 15:04 -0700`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `Mon, 2 Jan 06 15:04 MST`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `Mon, 02 Jan 2006 15:04:05 -0700`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `Mon, 02 Jan 2006 15:04:05 MST`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `Mon, 02 Jan 2006 15:04 -0700`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `Mon, 02 Jan 2006 15:04 MST`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `Mon, 02 Jan 06 15:04:05 -0700`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `Mon, 02 Jan 06 15:04:05 MST`, - want: `2006-01-02T15:04:05-07:00`, - }, - { - input: `Mon, 02 Jan 06 15:04 -0700`, - want: `2006-01-02T15:04:00-07:00`, - }, - { - input: `Mon, 02 Jan 06 15:04 MST`, - want: `2006-01-02T15:04:00-07:00`, - }, - } - for _, test := range tests { - test := test - - t.Run(test.input, func(t *testing.T) { - got, err := ParseDateTime(test.input) - assert.NoError(t, err) - assert.Equal(t, test.want, got.Format(time.RFC3339)) - }) - } -} - -func TestParseDateTimeObsolete(t *testing.T) { - tests := []struct { - input string - want string - }{ - { - input: `21 Nov 97 09:55:06 GMT`, - want: `1997-11-21T09:55:06Z`, - }, - { - input: `Wed, 01 Jan 2020 12:00:00 UTC`, - want: `2020-01-01T12:00:00Z`, - }, - { - input: `Wed, 01 Jan 2020 13:00:00 UTC`, - want: `2020-01-01T13:00:00Z`, - }, - { - input: `Wed, 01 Jan 2020 12:30:00 UTC`, - want: `2020-01-01T12:30:00Z`, - }, - } - for _, test := range tests { - test := test - - t.Run(test.input, func(t *testing.T) { - got, err := ParseDateTime(test.input) - assert.NoError(t, err) - assert.Equal(t, test.want, got.Format(time.RFC3339)) - }) - } -} - -func TestParseDateTimeRelaxed(t *testing.T) { - tests := []struct { - input string - want string - }{ - { - input: `Mon, 28 Jan 2019 20:59:01 0000`, - want: `2019-01-28T20:59:01Z`, - }, - { - input: `Mon, 25 Sep 2017 5:25:40 +0200`, - want: `2017-09-25T05:25:40+02:00`, - }, - } - for _, test := range tests { - test := test - - t.Run(test.input, func(t *testing.T) { - got, err := ParseDateTime(test.input) - assert.NoError(t, err) - assert.Equal(t, test.want, got.Format(time.RFC3339)) - }) - } -} diff --git a/pkg/message/rfc5322/parser.go b/pkg/message/rfc5322/parser.go deleted file mode 100644 index c4e4c8b3..00000000 --- a/pkg/message/rfc5322/parser.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "net/mail" - "time" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/antlr/antlr4/runtime/Go/antlr" - "github.com/sirupsen/logrus" -) - -// ParseAddressList parses one or more valid RFC5322 (with RFC2047) addresses. -func ParseAddressList(input string) ([]*mail.Address, error) { - if len(input) == 0 { - return []*mail.Address{}, nil - } - - l := parser.NewRFC5322Lexer(antlr.NewInputStream(input)) - p := parser.NewRFC5322Parser(antlr.NewCommonTokenStream(l, antlr.TokenDefaultChannel)) - w := &walker{} - - p.AddErrorListener(w) - p.AddParseListener(&parseListener{rules: p.GetRuleNames()}) - - antlr.ParseTreeWalkerDefault.Walk(w, p.AddressList()) - - return w.res.([]*mail.Address), w.err -} - -// ParseDateTime parses a valid RFC5322 date-time. -func ParseDateTime(input string) (time.Time, error) { - if len(input) == 0 { - return time.Time{}, nil - } - - l := parser.NewRFC5322Lexer(antlr.NewInputStream(input)) - p := parser.NewRFC5322Parser(antlr.NewCommonTokenStream(l, antlr.TokenDefaultChannel)) - w := &walker{} - - p.AddErrorListener(w) - p.AddParseListener(&parseListener{rules: p.GetRuleNames()}) - - antlr.ParseTreeWalkerDefault.Walk(w, p.DateTime()) - - return w.res.(time.Time), w.err -} - -type parseListener struct { - antlr.BaseParseTreeListener - - rules []string -} - -func (l *parseListener) EnterEveryRule(ctx antlr.ParserRuleContext) { - logrus. - WithField("rule", l.rules[ctx.GetRuleIndex()]). - WithField("text", ctx.GetText()). - Trace("Entering rule") -} - -func (l *parseListener) ExitEveryRule(ctx antlr.ParserRuleContext) { - logrus. - WithField("rule", l.rules[ctx.GetRuleIndex()]). - WithField("text", ctx.GetText()). - Trace("Exiting rule") -} diff --git a/pkg/message/rfc5322/parser/RFC5322Lexer.interp b/pkg/message/rfc5322/parser/RFC5322Lexer.interp deleted file mode 100644 index c31087e9..00000000 --- a/pkg/message/rfc5322/parser/RFC5322Lexer.interp +++ /dev/null @@ -1,227 +0,0 @@ -token literal names: -null -'\u0000' -null -'\t' -'\n' -'\u000B' -'\u000C' -'\r' -null -' ' -'!' -'"' -'#' -'$' -'%' -'&' -'\'' -'(' -')' -'*' -'+' -',' -'-' -'.' -'/' -null -':' -';' -'<' -'=' -'>' -'?' -'@' -'[' -'\\' -']' -'^' -'_' -'`' -'{' -'|' -'}' -'~' -'\u007F' -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null - -token symbolic names: -null -U_00 -U_01_08 -TAB -LF -U_0B -U_0C -CR -U_0E_1F -SP -Exclamation -DQuote -Hash -Dollar -Percent -Ampersand -SQuote -LParens -RParens -Asterisk -Plus -Comma -Minus -Period -Slash -Digit -Colon -Semicolon -Less -Equal -Greater -Question -At -LBracket -Backslash -RBracket -Caret -Underscore -Backtick -LCurly -Pipe -RCurly -Tilde -Delete -UTF8NonAscii -A -B -C -D -E -F -G -H -I -J -K -L -M -N -O -P -Q -R -S -T -U -V -W -X -Y -Z - -rule names: -U_00 -U_01_08 -TAB -LF -U_0B -U_0C -CR -U_0E_1F -SP -Exclamation -DQuote -Hash -Dollar -Percent -Ampersand -SQuote -LParens -RParens -Asterisk -Plus -Comma -Minus -Period -Slash -Digit -Colon -Semicolon -Less -Equal -Greater -Question -At -LBracket -Backslash -RBracket -Caret -Underscore -Backtick -LCurly -Pipe -RCurly -Tilde -Delete -UTF8NonAscii -A -B -C -D -E -F -G -H -I -J -K -L -M -N -O -P -Q -R -S -T -U -V -W -X -Y -Z - -channel names: -DEFAULT_TOKEN_CHANNEL -HIDDEN - -mode names: -DEFAULT_MODE - -atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 72, 283, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, 71, 9, 71, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 3, 22, 3, 22, 3, 23, 3, 23, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 27, 3, 27, 3, 28, 3, 28, 3, 29, 3, 29, 3, 30, 3, 30, 3, 31, 3, 31, 3, 32, 3, 32, 3, 33, 3, 33, 3, 34, 3, 34, 3, 35, 3, 35, 3, 36, 3, 36, 3, 37, 3, 37, 3, 38, 3, 38, 3, 39, 3, 39, 3, 40, 3, 40, 3, 41, 3, 41, 3, 42, 3, 42, 3, 43, 3, 43, 3, 44, 3, 44, 3, 45, 3, 45, 3, 46, 3, 46, 3, 47, 3, 47, 3, 48, 3, 48, 3, 49, 3, 49, 3, 50, 3, 50, 3, 51, 3, 51, 3, 52, 3, 52, 3, 53, 3, 53, 3, 54, 3, 54, 3, 55, 3, 55, 3, 56, 3, 56, 3, 57, 3, 57, 3, 58, 3, 58, 3, 59, 3, 59, 3, 60, 3, 60, 3, 61, 3, 61, 3, 62, 3, 62, 3, 63, 3, 63, 3, 64, 3, 64, 3, 65, 3, 65, 3, 66, 3, 66, 3, 67, 3, 67, 3, 68, 3, 68, 3, 69, 3, 69, 3, 70, 3, 70, 3, 71, 3, 71, 2, 2, 72, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, 47, 93, 48, 95, 49, 97, 50, 99, 51, 101, 52, 103, 53, 105, 54, 107, 55, 109, 56, 111, 57, 113, 58, 115, 59, 117, 60, 119, 61, 121, 62, 123, 63, 125, 64, 127, 65, 129, 66, 131, 67, 133, 68, 135, 69, 137, 70, 139, 71, 141, 72, 3, 2, 29, 3, 2, 50, 59, 4, 2, 67, 67, 99, 99, 4, 2, 68, 68, 100, 100, 4, 2, 69, 69, 101, 101, 4, 2, 70, 70, 102, 102, 4, 2, 71, 71, 103, 103, 4, 2, 72, 72, 104, 104, 4, 2, 73, 73, 105, 105, 4, 2, 74, 74, 106, 106, 4, 2, 75, 75, 107, 107, 4, 2, 76, 76, 108, 108, 4, 2, 77, 77, 109, 109, 4, 2, 78, 78, 110, 110, 4, 2, 79, 79, 111, 111, 4, 2, 80, 80, 112, 112, 4, 2, 81, 81, 113, 113, 4, 2, 82, 82, 114, 114, 4, 2, 83, 83, 115, 115, 4, 2, 84, 84, 116, 116, 4, 2, 85, 85, 117, 117, 4, 2, 86, 86, 118, 118, 4, 2, 87, 87, 119, 119, 4, 2, 88, 88, 120, 120, 4, 2, 89, 89, 121, 121, 4, 2, 90, 90, 122, 122, 4, 2, 91, 91, 123, 123, 4, 2, 92, 92, 124, 124, 2, 282, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, 2, 2, 93, 3, 2, 2, 2, 2, 95, 3, 2, 2, 2, 2, 97, 3, 2, 2, 2, 2, 99, 3, 2, 2, 2, 2, 101, 3, 2, 2, 2, 2, 103, 3, 2, 2, 2, 2, 105, 3, 2, 2, 2, 2, 107, 3, 2, 2, 2, 2, 109, 3, 2, 2, 2, 2, 111, 3, 2, 2, 2, 2, 113, 3, 2, 2, 2, 2, 115, 3, 2, 2, 2, 2, 117, 3, 2, 2, 2, 2, 119, 3, 2, 2, 2, 2, 121, 3, 2, 2, 2, 2, 123, 3, 2, 2, 2, 2, 125, 3, 2, 2, 2, 2, 127, 3, 2, 2, 2, 2, 129, 3, 2, 2, 2, 2, 131, 3, 2, 2, 2, 2, 133, 3, 2, 2, 2, 2, 135, 3, 2, 2, 2, 2, 137, 3, 2, 2, 2, 2, 139, 3, 2, 2, 2, 2, 141, 3, 2, 2, 2, 3, 143, 3, 2, 2, 2, 5, 145, 3, 2, 2, 2, 7, 147, 3, 2, 2, 2, 9, 149, 3, 2, 2, 2, 11, 151, 3, 2, 2, 2, 13, 153, 3, 2, 2, 2, 15, 155, 3, 2, 2, 2, 17, 157, 3, 2, 2, 2, 19, 159, 3, 2, 2, 2, 21, 161, 3, 2, 2, 2, 23, 163, 3, 2, 2, 2, 25, 165, 3, 2, 2, 2, 27, 167, 3, 2, 2, 2, 29, 169, 3, 2, 2, 2, 31, 171, 3, 2, 2, 2, 33, 173, 3, 2, 2, 2, 35, 175, 3, 2, 2, 2, 37, 177, 3, 2, 2, 2, 39, 179, 3, 2, 2, 2, 41, 181, 3, 2, 2, 2, 43, 183, 3, 2, 2, 2, 45, 185, 3, 2, 2, 2, 47, 187, 3, 2, 2, 2, 49, 189, 3, 2, 2, 2, 51, 191, 3, 2, 2, 2, 53, 193, 3, 2, 2, 2, 55, 195, 3, 2, 2, 2, 57, 197, 3, 2, 2, 2, 59, 199, 3, 2, 2, 2, 61, 201, 3, 2, 2, 2, 63, 203, 3, 2, 2, 2, 65, 205, 3, 2, 2, 2, 67, 207, 3, 2, 2, 2, 69, 209, 3, 2, 2, 2, 71, 211, 3, 2, 2, 2, 73, 213, 3, 2, 2, 2, 75, 215, 3, 2, 2, 2, 77, 217, 3, 2, 2, 2, 79, 219, 3, 2, 2, 2, 81, 221, 3, 2, 2, 2, 83, 223, 3, 2, 2, 2, 85, 225, 3, 2, 2, 2, 87, 227, 3, 2, 2, 2, 89, 229, 3, 2, 2, 2, 91, 231, 3, 2, 2, 2, 93, 233, 3, 2, 2, 2, 95, 235, 3, 2, 2, 2, 97, 237, 3, 2, 2, 2, 99, 239, 3, 2, 2, 2, 101, 241, 3, 2, 2, 2, 103, 243, 3, 2, 2, 2, 105, 245, 3, 2, 2, 2, 107, 247, 3, 2, 2, 2, 109, 249, 3, 2, 2, 2, 111, 251, 3, 2, 2, 2, 113, 253, 3, 2, 2, 2, 115, 255, 3, 2, 2, 2, 117, 257, 3, 2, 2, 2, 119, 259, 3, 2, 2, 2, 121, 261, 3, 2, 2, 2, 123, 263, 3, 2, 2, 2, 125, 265, 3, 2, 2, 2, 127, 267, 3, 2, 2, 2, 129, 269, 3, 2, 2, 2, 131, 271, 3, 2, 2, 2, 133, 273, 3, 2, 2, 2, 135, 275, 3, 2, 2, 2, 137, 277, 3, 2, 2, 2, 139, 279, 3, 2, 2, 2, 141, 281, 3, 2, 2, 2, 143, 144, 7, 2, 2, 2, 144, 4, 3, 2, 2, 2, 145, 146, 4, 3, 10, 2, 146, 6, 3, 2, 2, 2, 147, 148, 7, 11, 2, 2, 148, 8, 3, 2, 2, 2, 149, 150, 7, 12, 2, 2, 150, 10, 3, 2, 2, 2, 151, 152, 7, 13, 2, 2, 152, 12, 3, 2, 2, 2, 153, 154, 7, 14, 2, 2, 154, 14, 3, 2, 2, 2, 155, 156, 7, 15, 2, 2, 156, 16, 3, 2, 2, 2, 157, 158, 4, 16, 33, 2, 158, 18, 3, 2, 2, 2, 159, 160, 7, 34, 2, 2, 160, 20, 3, 2, 2, 2, 161, 162, 7, 35, 2, 2, 162, 22, 3, 2, 2, 2, 163, 164, 7, 36, 2, 2, 164, 24, 3, 2, 2, 2, 165, 166, 7, 37, 2, 2, 166, 26, 3, 2, 2, 2, 167, 168, 7, 38, 2, 2, 168, 28, 3, 2, 2, 2, 169, 170, 7, 39, 2, 2, 170, 30, 3, 2, 2, 2, 171, 172, 7, 40, 2, 2, 172, 32, 3, 2, 2, 2, 173, 174, 7, 41, 2, 2, 174, 34, 3, 2, 2, 2, 175, 176, 7, 42, 2, 2, 176, 36, 3, 2, 2, 2, 177, 178, 7, 43, 2, 2, 178, 38, 3, 2, 2, 2, 179, 180, 7, 44, 2, 2, 180, 40, 3, 2, 2, 2, 181, 182, 7, 45, 2, 2, 182, 42, 3, 2, 2, 2, 183, 184, 7, 46, 2, 2, 184, 44, 3, 2, 2, 2, 185, 186, 7, 47, 2, 2, 186, 46, 3, 2, 2, 2, 187, 188, 7, 48, 2, 2, 188, 48, 3, 2, 2, 2, 189, 190, 7, 49, 2, 2, 190, 50, 3, 2, 2, 2, 191, 192, 9, 2, 2, 2, 192, 52, 3, 2, 2, 2, 193, 194, 7, 60, 2, 2, 194, 54, 3, 2, 2, 2, 195, 196, 7, 61, 2, 2, 196, 56, 3, 2, 2, 2, 197, 198, 7, 62, 2, 2, 198, 58, 3, 2, 2, 2, 199, 200, 7, 63, 2, 2, 200, 60, 3, 2, 2, 2, 201, 202, 7, 64, 2, 2, 202, 62, 3, 2, 2, 2, 203, 204, 7, 65, 2, 2, 204, 64, 3, 2, 2, 2, 205, 206, 7, 66, 2, 2, 206, 66, 3, 2, 2, 2, 207, 208, 7, 93, 2, 2, 208, 68, 3, 2, 2, 2, 209, 210, 7, 94, 2, 2, 210, 70, 3, 2, 2, 2, 211, 212, 7, 95, 2, 2, 212, 72, 3, 2, 2, 2, 213, 214, 7, 96, 2, 2, 214, 74, 3, 2, 2, 2, 215, 216, 7, 97, 2, 2, 216, 76, 3, 2, 2, 2, 217, 218, 7, 98, 2, 2, 218, 78, 3, 2, 2, 2, 219, 220, 7, 125, 2, 2, 220, 80, 3, 2, 2, 2, 221, 222, 7, 126, 2, 2, 222, 82, 3, 2, 2, 2, 223, 224, 7, 127, 2, 2, 224, 84, 3, 2, 2, 2, 225, 226, 7, 128, 2, 2, 226, 86, 3, 2, 2, 2, 227, 228, 7, 129, 2, 2, 228, 88, 3, 2, 2, 2, 229, 230, 4, 130, 1, 2, 230, 90, 3, 2, 2, 2, 231, 232, 9, 3, 2, 2, 232, 92, 3, 2, 2, 2, 233, 234, 9, 4, 2, 2, 234, 94, 3, 2, 2, 2, 235, 236, 9, 5, 2, 2, 236, 96, 3, 2, 2, 2, 237, 238, 9, 6, 2, 2, 238, 98, 3, 2, 2, 2, 239, 240, 9, 7, 2, 2, 240, 100, 3, 2, 2, 2, 241, 242, 9, 8, 2, 2, 242, 102, 3, 2, 2, 2, 243, 244, 9, 9, 2, 2, 244, 104, 3, 2, 2, 2, 245, 246, 9, 10, 2, 2, 246, 106, 3, 2, 2, 2, 247, 248, 9, 11, 2, 2, 248, 108, 3, 2, 2, 2, 249, 250, 9, 12, 2, 2, 250, 110, 3, 2, 2, 2, 251, 252, 9, 13, 2, 2, 252, 112, 3, 2, 2, 2, 253, 254, 9, 14, 2, 2, 254, 114, 3, 2, 2, 2, 255, 256, 9, 15, 2, 2, 256, 116, 3, 2, 2, 2, 257, 258, 9, 16, 2, 2, 258, 118, 3, 2, 2, 2, 259, 260, 9, 17, 2, 2, 260, 120, 3, 2, 2, 2, 261, 262, 9, 18, 2, 2, 262, 122, 3, 2, 2, 2, 263, 264, 9, 19, 2, 2, 264, 124, 3, 2, 2, 2, 265, 266, 9, 20, 2, 2, 266, 126, 3, 2, 2, 2, 267, 268, 9, 21, 2, 2, 268, 128, 3, 2, 2, 2, 269, 270, 9, 22, 2, 2, 270, 130, 3, 2, 2, 2, 271, 272, 9, 23, 2, 2, 272, 132, 3, 2, 2, 2, 273, 274, 9, 24, 2, 2, 274, 134, 3, 2, 2, 2, 275, 276, 9, 25, 2, 2, 276, 136, 3, 2, 2, 2, 277, 278, 9, 26, 2, 2, 278, 138, 3, 2, 2, 2, 279, 280, 9, 27, 2, 2, 280, 140, 3, 2, 2, 2, 281, 282, 9, 28, 2, 2, 282, 142, 3, 2, 2, 2, 3, 2, 2] \ No newline at end of file diff --git a/pkg/message/rfc5322/parser/RFC5322Lexer.tokens b/pkg/message/rfc5322/parser/RFC5322Lexer.tokens deleted file mode 100644 index 54ac3db2..00000000 --- a/pkg/message/rfc5322/parser/RFC5322Lexer.tokens +++ /dev/null @@ -1,110 +0,0 @@ -U_00=1 -U_01_08=2 -TAB=3 -LF=4 -U_0B=5 -U_0C=6 -CR=7 -U_0E_1F=8 -SP=9 -Exclamation=10 -DQuote=11 -Hash=12 -Dollar=13 -Percent=14 -Ampersand=15 -SQuote=16 -LParens=17 -RParens=18 -Asterisk=19 -Plus=20 -Comma=21 -Minus=22 -Period=23 -Slash=24 -Digit=25 -Colon=26 -Semicolon=27 -Less=28 -Equal=29 -Greater=30 -Question=31 -At=32 -LBracket=33 -Backslash=34 -RBracket=35 -Caret=36 -Underscore=37 -Backtick=38 -LCurly=39 -Pipe=40 -RCurly=41 -Tilde=42 -Delete=43 -UTF8NonAscii=44 -A=45 -B=46 -C=47 -D=48 -E=49 -F=50 -G=51 -H=52 -I=53 -J=54 -K=55 -L=56 -M=57 -N=58 -O=59 -P=60 -Q=61 -R=62 -S=63 -T=64 -U=65 -V=66 -W=67 -X=68 -Y=69 -Z=70 -'\u0000'=1 -'\t'=3 -'\n'=4 -'\u000B'=5 -'\u000C'=6 -'\r'=7 -' '=9 -'!'=10 -'"'=11 -'#'=12 -'$'=13 -'%'=14 -'&'=15 -'\''=16 -'('=17 -')'=18 -'*'=19 -'+'=20 -','=21 -'-'=22 -'.'=23 -'/'=24 -':'=26 -';'=27 -'<'=28 -'='=29 -'>'=30 -'?'=31 -'@'=32 -'['=33 -'\\'=34 -']'=35 -'^'=36 -'_'=37 -'`'=38 -'{'=39 -'|'=40 -'}'=41 -'~'=42 -'\u007F'=43 diff --git a/pkg/message/rfc5322/parser/RFC5322Parser.interp b/pkg/message/rfc5322/parser/RFC5322Parser.interp deleted file mode 100644 index 73f1e5e1..00000000 --- a/pkg/message/rfc5322/parser/RFC5322Parser.interp +++ /dev/null @@ -1,217 +0,0 @@ -token literal names: -null -'\u0000' -null -'\t' -'\n' -'\u000B' -'\u000C' -'\r' -null -' ' -'!' -'"' -'#' -'$' -'%' -'&' -'\'' -'(' -')' -'*' -'+' -',' -'-' -'.' -'/' -null -':' -';' -'<' -'=' -'>' -'?' -'@' -'[' -'\\' -']' -'^' -'_' -'`' -'{' -'|' -'}' -'~' -'\u007F' -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null - -token symbolic names: -null -U_00 -U_01_08 -TAB -LF -U_0B -U_0C -CR -U_0E_1F -SP -Exclamation -DQuote -Hash -Dollar -Percent -Ampersand -SQuote -LParens -RParens -Asterisk -Plus -Comma -Minus -Period -Slash -Digit -Colon -Semicolon -Less -Equal -Greater -Question -At -LBracket -Backslash -RBracket -Caret -Underscore -Backtick -LCurly -Pipe -RCurly -Tilde -Delete -UTF8NonAscii -A -B -C -D -E -F -G -H -I -J -K -L -M -N -O -P -Q -R -S -T -U -V -W -X -Y -Z - -rule names: -quotedChar -quotedPair -fws -ctext -ccontent -comment -cfws -atext -atom -dotAtom -qtext -quotedContent -quotedValue -quotedString -word -dateTime -dayOfweek -dayName -day -month -year -hour -minute -second -offset -zone -address -mailbox -nameAddr -angleAddr -group -displayName -mailboxList -addressList -groupList -addrSpec -localPart -port -domain -domainLiteral -dtext -obsNoWSCTL -obsCtext -obsQtext -obsQP -obsFWS -obsZone -obsAngleAddr -obsRoute -obsDomainList -obsMboxList -obsAddrList -obsGroupList -obsLocalPart -obsDomain -encodedWord -charset -encoding -token -tokenChar -encodedText -encodedChar -crlf -wsp -vchar -alpha - - -atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 72, 1014, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 3, 2, 3, 2, 5, 2, 137, 10, 2, 3, 3, 3, 3, 3, 3, 5, 3, 142, 10, 3, 3, 4, 7, 4, 145, 10, 4, 12, 4, 14, 4, 148, 11, 4, 3, 4, 5, 4, 151, 10, 4, 3, 4, 6, 4, 154, 10, 4, 13, 4, 14, 4, 155, 3, 4, 5, 4, 159, 10, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 194, 10, 5, 3, 6, 3, 6, 3, 6, 5, 6, 199, 10, 6, 3, 7, 3, 7, 5, 7, 203, 10, 7, 3, 7, 7, 7, 206, 10, 7, 12, 7, 14, 7, 209, 11, 7, 3, 7, 5, 7, 212, 10, 7, 3, 7, 3, 7, 3, 8, 5, 8, 217, 10, 8, 3, 8, 6, 8, 220, 10, 8, 13, 8, 14, 8, 221, 3, 8, 5, 8, 225, 10, 8, 3, 8, 5, 8, 228, 10, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 252, 10, 9, 3, 10, 6, 10, 255, 10, 10, 13, 10, 14, 10, 256, 3, 11, 6, 11, 260, 10, 11, 13, 11, 14, 11, 261, 3, 11, 3, 11, 6, 11, 266, 10, 11, 13, 11, 14, 11, 267, 7, 11, 270, 10, 11, 12, 11, 14, 11, 273, 11, 11, 3, 11, 5, 11, 276, 10, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 312, 10, 12, 3, 13, 3, 13, 5, 13, 316, 10, 13, 3, 14, 5, 14, 319, 10, 14, 3, 14, 7, 14, 322, 10, 14, 12, 14, 14, 14, 325, 11, 14, 3, 15, 3, 15, 3, 15, 5, 15, 330, 10, 15, 3, 15, 3, 15, 3, 16, 5, 16, 335, 10, 16, 3, 16, 3, 16, 5, 16, 339, 10, 16, 3, 16, 5, 16, 342, 10, 16, 3, 16, 3, 16, 5, 16, 346, 10, 16, 3, 16, 5, 16, 349, 10, 16, 3, 16, 3, 16, 5, 16, 353, 10, 16, 3, 16, 5, 16, 356, 10, 16, 3, 17, 3, 17, 3, 17, 5, 17, 361, 10, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 5, 17, 371, 10, 17, 3, 17, 5, 17, 374, 10, 17, 3, 17, 5, 17, 377, 10, 17, 3, 17, 3, 17, 3, 18, 5, 18, 382, 10, 18, 3, 18, 3, 18, 5, 18, 386, 10, 18, 3, 18, 3, 18, 5, 18, 390, 10, 18, 5, 18, 392, 10, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 5, 19, 415, 10, 19, 3, 20, 5, 20, 418, 10, 20, 3, 20, 3, 20, 5, 20, 422, 10, 20, 3, 20, 3, 20, 5, 20, 426, 10, 20, 3, 20, 3, 20, 5, 20, 430, 10, 20, 3, 20, 5, 20, 433, 10, 20, 5, 20, 435, 10, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 5, 21, 473, 10, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 5, 22, 483, 10, 22, 3, 22, 3, 22, 3, 22, 5, 22, 488, 10, 22, 5, 22, 490, 10, 22, 3, 23, 5, 23, 493, 10, 23, 3, 23, 3, 23, 5, 23, 497, 10, 23, 3, 23, 5, 23, 500, 10, 23, 3, 23, 3, 23, 5, 23, 504, 10, 23, 5, 23, 506, 10, 23, 3, 24, 3, 24, 3, 24, 5, 24, 511, 10, 24, 3, 24, 3, 24, 3, 24, 5, 24, 516, 10, 24, 5, 24, 518, 10, 24, 3, 25, 3, 25, 3, 25, 5, 25, 523, 10, 25, 3, 25, 3, 25, 3, 25, 5, 25, 528, 10, 25, 5, 25, 530, 10, 25, 3, 26, 5, 26, 533, 10, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 5, 27, 544, 10, 27, 3, 28, 3, 28, 5, 28, 548, 10, 28, 3, 29, 3, 29, 5, 29, 552, 10, 29, 3, 30, 5, 30, 555, 10, 30, 3, 30, 3, 30, 3, 31, 5, 31, 560, 10, 31, 3, 31, 3, 31, 5, 31, 564, 10, 31, 3, 31, 3, 31, 5, 31, 568, 10, 31, 3, 31, 5, 31, 571, 10, 31, 3, 32, 3, 32, 3, 32, 5, 32, 576, 10, 32, 3, 32, 3, 32, 5, 32, 580, 10, 32, 3, 33, 6, 33, 583, 10, 33, 13, 33, 14, 33, 584, 3, 33, 3, 33, 3, 33, 3, 33, 7, 33, 591, 10, 33, 12, 33, 14, 33, 594, 11, 33, 5, 33, 596, 10, 33, 3, 34, 3, 34, 3, 34, 7, 34, 601, 10, 34, 12, 34, 14, 34, 604, 11, 34, 3, 34, 5, 34, 607, 10, 34, 3, 35, 3, 35, 3, 35, 7, 35, 612, 10, 35, 12, 35, 14, 35, 615, 11, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 5, 35, 622, 10, 35, 3, 36, 3, 36, 3, 36, 5, 36, 627, 10, 36, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 5, 37, 634, 10, 37, 3, 38, 5, 38, 637, 10, 38, 3, 38, 3, 38, 5, 38, 641, 10, 38, 3, 38, 5, 38, 644, 10, 38, 3, 38, 3, 38, 5, 38, 648, 10, 38, 3, 38, 5, 38, 651, 10, 38, 3, 39, 6, 39, 654, 10, 39, 13, 39, 14, 39, 655, 3, 40, 5, 40, 659, 10, 40, 3, 40, 3, 40, 5, 40, 663, 10, 40, 3, 40, 5, 40, 666, 10, 40, 3, 40, 3, 40, 5, 40, 670, 10, 40, 3, 40, 5, 40, 673, 10, 40, 3, 40, 3, 40, 5, 40, 677, 10, 40, 5, 40, 679, 10, 40, 3, 41, 3, 41, 5, 41, 683, 10, 41, 3, 41, 7, 41, 686, 10, 41, 12, 41, 14, 41, 689, 11, 41, 3, 41, 5, 41, 692, 10, 41, 3, 41, 3, 41, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 5, 42, 728, 10, 42, 3, 43, 3, 43, 3, 44, 3, 44, 3, 45, 3, 45, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 5, 46, 741, 10, 46, 3, 47, 6, 47, 744, 10, 47, 13, 47, 14, 47, 745, 3, 47, 3, 47, 6, 47, 750, 10, 47, 13, 47, 14, 47, 751, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 5, 48, 786, 10, 48, 3, 49, 5, 49, 789, 10, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 5, 49, 796, 10, 49, 3, 50, 3, 50, 3, 50, 3, 51, 3, 51, 7, 51, 803, 10, 51, 12, 51, 14, 51, 806, 11, 51, 3, 51, 3, 51, 3, 51, 3, 51, 5, 51, 812, 10, 51, 3, 51, 3, 51, 5, 51, 816, 10, 51, 7, 51, 818, 10, 51, 12, 51, 14, 51, 821, 11, 51, 3, 52, 5, 52, 824, 10, 52, 3, 52, 7, 52, 827, 10, 52, 12, 52, 14, 52, 830, 11, 52, 3, 52, 3, 52, 3, 52, 3, 52, 5, 52, 836, 10, 52, 7, 52, 838, 10, 52, 12, 52, 14, 52, 841, 11, 52, 3, 53, 5, 53, 844, 10, 53, 3, 53, 7, 53, 847, 10, 53, 12, 53, 14, 53, 850, 11, 53, 3, 53, 3, 53, 3, 53, 3, 53, 5, 53, 856, 10, 53, 7, 53, 858, 10, 53, 12, 53, 14, 53, 861, 11, 53, 3, 54, 5, 54, 864, 10, 54, 3, 54, 6, 54, 867, 10, 54, 13, 54, 14, 54, 868, 3, 54, 5, 54, 872, 10, 54, 3, 55, 3, 55, 3, 55, 7, 55, 877, 10, 55, 12, 55, 14, 55, 880, 11, 55, 3, 56, 3, 56, 3, 56, 7, 56, 885, 10, 56, 12, 56, 14, 56, 888, 11, 56, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 58, 3, 58, 3, 59, 3, 59, 3, 60, 6, 60, 905, 10, 60, 13, 60, 14, 60, 906, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 5, 61, 928, 10, 61, 3, 62, 6, 62, 931, 10, 62, 13, 62, 14, 62, 932, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 5, 63, 968, 10, 63, 3, 64, 3, 64, 3, 64, 3, 65, 3, 65, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 5, 66, 1010, 10, 66, 3, 67, 3, 67, 3, 67, 2, 2, 68, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 2, 6, 4, 2, 22, 22, 24, 24, 6, 2, 4, 4, 7, 8, 10, 10, 45, 45, 4, 2, 5, 5, 11, 11, 3, 2, 47, 72, 2, 1306, 2, 136, 3, 2, 2, 2, 4, 141, 3, 2, 2, 2, 6, 158, 3, 2, 2, 2, 8, 193, 3, 2, 2, 2, 10, 198, 3, 2, 2, 2, 12, 200, 3, 2, 2, 2, 14, 227, 3, 2, 2, 2, 16, 251, 3, 2, 2, 2, 18, 254, 3, 2, 2, 2, 20, 259, 3, 2, 2, 2, 22, 311, 3, 2, 2, 2, 24, 315, 3, 2, 2, 2, 26, 323, 3, 2, 2, 2, 28, 326, 3, 2, 2, 2, 30, 355, 3, 2, 2, 2, 32, 360, 3, 2, 2, 2, 34, 391, 3, 2, 2, 2, 36, 414, 3, 2, 2, 2, 38, 434, 3, 2, 2, 2, 40, 472, 3, 2, 2, 2, 42, 489, 3, 2, 2, 2, 44, 505, 3, 2, 2, 2, 46, 517, 3, 2, 2, 2, 48, 529, 3, 2, 2, 2, 50, 532, 3, 2, 2, 2, 52, 543, 3, 2, 2, 2, 54, 547, 3, 2, 2, 2, 56, 551, 3, 2, 2, 2, 58, 554, 3, 2, 2, 2, 60, 570, 3, 2, 2, 2, 62, 572, 3, 2, 2, 2, 64, 595, 3, 2, 2, 2, 66, 606, 3, 2, 2, 2, 68, 621, 3, 2, 2, 2, 70, 626, 3, 2, 2, 2, 72, 628, 3, 2, 2, 2, 74, 650, 3, 2, 2, 2, 76, 653, 3, 2, 2, 2, 78, 678, 3, 2, 2, 2, 80, 680, 3, 2, 2, 2, 82, 727, 3, 2, 2, 2, 84, 729, 3, 2, 2, 2, 86, 731, 3, 2, 2, 2, 88, 733, 3, 2, 2, 2, 90, 735, 3, 2, 2, 2, 92, 743, 3, 2, 2, 2, 94, 785, 3, 2, 2, 2, 96, 788, 3, 2, 2, 2, 98, 797, 3, 2, 2, 2, 100, 804, 3, 2, 2, 2, 102, 828, 3, 2, 2, 2, 104, 848, 3, 2, 2, 2, 106, 866, 3, 2, 2, 2, 108, 873, 3, 2, 2, 2, 110, 881, 3, 2, 2, 2, 112, 889, 3, 2, 2, 2, 114, 899, 3, 2, 2, 2, 116, 901, 3, 2, 2, 2, 118, 904, 3, 2, 2, 2, 120, 927, 3, 2, 2, 2, 122, 930, 3, 2, 2, 2, 124, 967, 3, 2, 2, 2, 126, 969, 3, 2, 2, 2, 128, 972, 3, 2, 2, 2, 130, 1009, 3, 2, 2, 2, 132, 1011, 3, 2, 2, 2, 134, 137, 5, 130, 66, 2, 135, 137, 5, 128, 65, 2, 136, 134, 3, 2, 2, 2, 136, 135, 3, 2, 2, 2, 137, 3, 3, 2, 2, 2, 138, 139, 7, 36, 2, 2, 139, 142, 5, 2, 2, 2, 140, 142, 5, 90, 46, 2, 141, 138, 3, 2, 2, 2, 141, 140, 3, 2, 2, 2, 142, 5, 3, 2, 2, 2, 143, 145, 5, 128, 65, 2, 144, 143, 3, 2, 2, 2, 145, 148, 3, 2, 2, 2, 146, 144, 3, 2, 2, 2, 146, 147, 3, 2, 2, 2, 147, 149, 3, 2, 2, 2, 148, 146, 3, 2, 2, 2, 149, 151, 5, 126, 64, 2, 150, 146, 3, 2, 2, 2, 150, 151, 3, 2, 2, 2, 151, 153, 3, 2, 2, 2, 152, 154, 5, 128, 65, 2, 153, 152, 3, 2, 2, 2, 154, 155, 3, 2, 2, 2, 155, 153, 3, 2, 2, 2, 155, 156, 3, 2, 2, 2, 156, 159, 3, 2, 2, 2, 157, 159, 5, 92, 47, 2, 158, 150, 3, 2, 2, 2, 158, 157, 3, 2, 2, 2, 159, 7, 3, 2, 2, 2, 160, 194, 5, 132, 67, 2, 161, 194, 7, 12, 2, 2, 162, 194, 7, 13, 2, 2, 163, 194, 7, 14, 2, 2, 164, 194, 7, 15, 2, 2, 165, 194, 7, 16, 2, 2, 166, 194, 7, 17, 2, 2, 167, 194, 7, 18, 2, 2, 168, 194, 7, 21, 2, 2, 169, 194, 7, 22, 2, 2, 170, 194, 7, 23, 2, 2, 171, 194, 7, 24, 2, 2, 172, 194, 7, 25, 2, 2, 173, 194, 7, 26, 2, 2, 174, 194, 7, 27, 2, 2, 175, 194, 7, 28, 2, 2, 176, 194, 7, 29, 2, 2, 177, 194, 7, 30, 2, 2, 178, 194, 7, 31, 2, 2, 179, 194, 7, 32, 2, 2, 180, 194, 7, 33, 2, 2, 181, 194, 7, 34, 2, 2, 182, 194, 7, 35, 2, 2, 183, 194, 7, 37, 2, 2, 184, 194, 7, 38, 2, 2, 185, 194, 7, 39, 2, 2, 186, 194, 7, 40, 2, 2, 187, 194, 7, 41, 2, 2, 188, 194, 7, 42, 2, 2, 189, 194, 7, 43, 2, 2, 190, 194, 7, 44, 2, 2, 191, 194, 5, 86, 44, 2, 192, 194, 7, 46, 2, 2, 193, 160, 3, 2, 2, 2, 193, 161, 3, 2, 2, 2, 193, 162, 3, 2, 2, 2, 193, 163, 3, 2, 2, 2, 193, 164, 3, 2, 2, 2, 193, 165, 3, 2, 2, 2, 193, 166, 3, 2, 2, 2, 193, 167, 3, 2, 2, 2, 193, 168, 3, 2, 2, 2, 193, 169, 3, 2, 2, 2, 193, 170, 3, 2, 2, 2, 193, 171, 3, 2, 2, 2, 193, 172, 3, 2, 2, 2, 193, 173, 3, 2, 2, 2, 193, 174, 3, 2, 2, 2, 193, 175, 3, 2, 2, 2, 193, 176, 3, 2, 2, 2, 193, 177, 3, 2, 2, 2, 193, 178, 3, 2, 2, 2, 193, 179, 3, 2, 2, 2, 193, 180, 3, 2, 2, 2, 193, 181, 3, 2, 2, 2, 193, 182, 3, 2, 2, 2, 193, 183, 3, 2, 2, 2, 193, 184, 3, 2, 2, 2, 193, 185, 3, 2, 2, 2, 193, 186, 3, 2, 2, 2, 193, 187, 3, 2, 2, 2, 193, 188, 3, 2, 2, 2, 193, 189, 3, 2, 2, 2, 193, 190, 3, 2, 2, 2, 193, 191, 3, 2, 2, 2, 193, 192, 3, 2, 2, 2, 194, 9, 3, 2, 2, 2, 195, 199, 5, 8, 5, 2, 196, 199, 5, 4, 3, 2, 197, 199, 5, 12, 7, 2, 198, 195, 3, 2, 2, 2, 198, 196, 3, 2, 2, 2, 198, 197, 3, 2, 2, 2, 199, 11, 3, 2, 2, 2, 200, 207, 7, 19, 2, 2, 201, 203, 5, 6, 4, 2, 202, 201, 3, 2, 2, 2, 202, 203, 3, 2, 2, 2, 203, 204, 3, 2, 2, 2, 204, 206, 5, 10, 6, 2, 205, 202, 3, 2, 2, 2, 206, 209, 3, 2, 2, 2, 207, 205, 3, 2, 2, 2, 207, 208, 3, 2, 2, 2, 208, 211, 3, 2, 2, 2, 209, 207, 3, 2, 2, 2, 210, 212, 5, 6, 4, 2, 211, 210, 3, 2, 2, 2, 211, 212, 3, 2, 2, 2, 212, 213, 3, 2, 2, 2, 213, 214, 7, 20, 2, 2, 214, 13, 3, 2, 2, 2, 215, 217, 5, 6, 4, 2, 216, 215, 3, 2, 2, 2, 216, 217, 3, 2, 2, 2, 217, 218, 3, 2, 2, 2, 218, 220, 5, 12, 7, 2, 219, 216, 3, 2, 2, 2, 220, 221, 3, 2, 2, 2, 221, 219, 3, 2, 2, 2, 221, 222, 3, 2, 2, 2, 222, 224, 3, 2, 2, 2, 223, 225, 5, 6, 4, 2, 224, 223, 3, 2, 2, 2, 224, 225, 3, 2, 2, 2, 225, 228, 3, 2, 2, 2, 226, 228, 5, 6, 4, 2, 227, 219, 3, 2, 2, 2, 227, 226, 3, 2, 2, 2, 228, 15, 3, 2, 2, 2, 229, 252, 5, 132, 67, 2, 230, 252, 7, 27, 2, 2, 231, 252, 7, 12, 2, 2, 232, 252, 7, 14, 2, 2, 233, 252, 7, 15, 2, 2, 234, 252, 7, 16, 2, 2, 235, 252, 7, 17, 2, 2, 236, 252, 7, 18, 2, 2, 237, 252, 7, 21, 2, 2, 238, 252, 7, 22, 2, 2, 239, 252, 7, 24, 2, 2, 240, 252, 7, 26, 2, 2, 241, 252, 7, 31, 2, 2, 242, 252, 7, 33, 2, 2, 243, 252, 7, 38, 2, 2, 244, 252, 7, 39, 2, 2, 245, 252, 7, 40, 2, 2, 246, 252, 7, 41, 2, 2, 247, 252, 7, 42, 2, 2, 248, 252, 7, 43, 2, 2, 249, 252, 7, 44, 2, 2, 250, 252, 7, 46, 2, 2, 251, 229, 3, 2, 2, 2, 251, 230, 3, 2, 2, 2, 251, 231, 3, 2, 2, 2, 251, 232, 3, 2, 2, 2, 251, 233, 3, 2, 2, 2, 251, 234, 3, 2, 2, 2, 251, 235, 3, 2, 2, 2, 251, 236, 3, 2, 2, 2, 251, 237, 3, 2, 2, 2, 251, 238, 3, 2, 2, 2, 251, 239, 3, 2, 2, 2, 251, 240, 3, 2, 2, 2, 251, 241, 3, 2, 2, 2, 251, 242, 3, 2, 2, 2, 251, 243, 3, 2, 2, 2, 251, 244, 3, 2, 2, 2, 251, 245, 3, 2, 2, 2, 251, 246, 3, 2, 2, 2, 251, 247, 3, 2, 2, 2, 251, 248, 3, 2, 2, 2, 251, 249, 3, 2, 2, 2, 251, 250, 3, 2, 2, 2, 252, 17, 3, 2, 2, 2, 253, 255, 5, 16, 9, 2, 254, 253, 3, 2, 2, 2, 255, 256, 3, 2, 2, 2, 256, 254, 3, 2, 2, 2, 256, 257, 3, 2, 2, 2, 257, 19, 3, 2, 2, 2, 258, 260, 5, 16, 9, 2, 259, 258, 3, 2, 2, 2, 260, 261, 3, 2, 2, 2, 261, 259, 3, 2, 2, 2, 261, 262, 3, 2, 2, 2, 262, 271, 3, 2, 2, 2, 263, 265, 7, 25, 2, 2, 264, 266, 5, 16, 9, 2, 265, 264, 3, 2, 2, 2, 266, 267, 3, 2, 2, 2, 267, 265, 3, 2, 2, 2, 267, 268, 3, 2, 2, 2, 268, 270, 3, 2, 2, 2, 269, 263, 3, 2, 2, 2, 270, 273, 3, 2, 2, 2, 271, 269, 3, 2, 2, 2, 271, 272, 3, 2, 2, 2, 272, 275, 3, 2, 2, 2, 273, 271, 3, 2, 2, 2, 274, 276, 7, 25, 2, 2, 275, 274, 3, 2, 2, 2, 275, 276, 3, 2, 2, 2, 276, 21, 3, 2, 2, 2, 277, 312, 5, 132, 67, 2, 278, 312, 7, 12, 2, 2, 279, 312, 7, 14, 2, 2, 280, 312, 7, 15, 2, 2, 281, 312, 7, 16, 2, 2, 282, 312, 7, 17, 2, 2, 283, 312, 7, 18, 2, 2, 284, 312, 7, 19, 2, 2, 285, 312, 7, 20, 2, 2, 286, 312, 7, 21, 2, 2, 287, 312, 7, 22, 2, 2, 288, 312, 7, 23, 2, 2, 289, 312, 7, 24, 2, 2, 290, 312, 7, 25, 2, 2, 291, 312, 7, 26, 2, 2, 292, 312, 7, 27, 2, 2, 293, 312, 7, 28, 2, 2, 294, 312, 7, 29, 2, 2, 295, 312, 7, 30, 2, 2, 296, 312, 7, 31, 2, 2, 297, 312, 7, 32, 2, 2, 298, 312, 7, 33, 2, 2, 299, 312, 7, 34, 2, 2, 300, 312, 7, 35, 2, 2, 301, 312, 7, 37, 2, 2, 302, 312, 7, 38, 2, 2, 303, 312, 7, 39, 2, 2, 304, 312, 7, 40, 2, 2, 305, 312, 7, 41, 2, 2, 306, 312, 7, 42, 2, 2, 307, 312, 7, 43, 2, 2, 308, 312, 7, 44, 2, 2, 309, 312, 5, 88, 45, 2, 310, 312, 7, 46, 2, 2, 311, 277, 3, 2, 2, 2, 311, 278, 3, 2, 2, 2, 311, 279, 3, 2, 2, 2, 311, 280, 3, 2, 2, 2, 311, 281, 3, 2, 2, 2, 311, 282, 3, 2, 2, 2, 311, 283, 3, 2, 2, 2, 311, 284, 3, 2, 2, 2, 311, 285, 3, 2, 2, 2, 311, 286, 3, 2, 2, 2, 311, 287, 3, 2, 2, 2, 311, 288, 3, 2, 2, 2, 311, 289, 3, 2, 2, 2, 311, 290, 3, 2, 2, 2, 311, 291, 3, 2, 2, 2, 311, 292, 3, 2, 2, 2, 311, 293, 3, 2, 2, 2, 311, 294, 3, 2, 2, 2, 311, 295, 3, 2, 2, 2, 311, 296, 3, 2, 2, 2, 311, 297, 3, 2, 2, 2, 311, 298, 3, 2, 2, 2, 311, 299, 3, 2, 2, 2, 311, 300, 3, 2, 2, 2, 311, 301, 3, 2, 2, 2, 311, 302, 3, 2, 2, 2, 311, 303, 3, 2, 2, 2, 311, 304, 3, 2, 2, 2, 311, 305, 3, 2, 2, 2, 311, 306, 3, 2, 2, 2, 311, 307, 3, 2, 2, 2, 311, 308, 3, 2, 2, 2, 311, 309, 3, 2, 2, 2, 311, 310, 3, 2, 2, 2, 312, 23, 3, 2, 2, 2, 313, 316, 5, 22, 12, 2, 314, 316, 5, 4, 3, 2, 315, 313, 3, 2, 2, 2, 315, 314, 3, 2, 2, 2, 316, 25, 3, 2, 2, 2, 317, 319, 5, 6, 4, 2, 318, 317, 3, 2, 2, 2, 318, 319, 3, 2, 2, 2, 319, 320, 3, 2, 2, 2, 320, 322, 5, 24, 13, 2, 321, 318, 3, 2, 2, 2, 322, 325, 3, 2, 2, 2, 323, 321, 3, 2, 2, 2, 323, 324, 3, 2, 2, 2, 324, 27, 3, 2, 2, 2, 325, 323, 3, 2, 2, 2, 326, 327, 7, 13, 2, 2, 327, 329, 5, 26, 14, 2, 328, 330, 5, 6, 4, 2, 329, 328, 3, 2, 2, 2, 329, 330, 3, 2, 2, 2, 330, 331, 3, 2, 2, 2, 331, 332, 7, 13, 2, 2, 332, 29, 3, 2, 2, 2, 333, 335, 5, 14, 8, 2, 334, 333, 3, 2, 2, 2, 334, 335, 3, 2, 2, 2, 335, 336, 3, 2, 2, 2, 336, 338, 5, 112, 57, 2, 337, 339, 5, 14, 8, 2, 338, 337, 3, 2, 2, 2, 338, 339, 3, 2, 2, 2, 339, 356, 3, 2, 2, 2, 340, 342, 5, 14, 8, 2, 341, 340, 3, 2, 2, 2, 341, 342, 3, 2, 2, 2, 342, 343, 3, 2, 2, 2, 343, 345, 5, 18, 10, 2, 344, 346, 5, 14, 8, 2, 345, 344, 3, 2, 2, 2, 345, 346, 3, 2, 2, 2, 346, 356, 3, 2, 2, 2, 347, 349, 5, 14, 8, 2, 348, 347, 3, 2, 2, 2, 348, 349, 3, 2, 2, 2, 349, 350, 3, 2, 2, 2, 350, 352, 5, 28, 15, 2, 351, 353, 5, 14, 8, 2, 352, 351, 3, 2, 2, 2, 352, 353, 3, 2, 2, 2, 353, 356, 3, 2, 2, 2, 354, 356, 7, 34, 2, 2, 355, 334, 3, 2, 2, 2, 355, 341, 3, 2, 2, 2, 355, 348, 3, 2, 2, 2, 355, 354, 3, 2, 2, 2, 356, 31, 3, 2, 2, 2, 357, 358, 5, 34, 18, 2, 358, 359, 7, 23, 2, 2, 359, 361, 3, 2, 2, 2, 360, 357, 3, 2, 2, 2, 360, 361, 3, 2, 2, 2, 361, 362, 3, 2, 2, 2, 362, 363, 5, 38, 20, 2, 363, 364, 5, 40, 21, 2, 364, 365, 5, 42, 22, 2, 365, 366, 5, 44, 23, 2, 366, 367, 7, 28, 2, 2, 367, 370, 5, 46, 24, 2, 368, 369, 7, 28, 2, 2, 369, 371, 5, 48, 25, 2, 370, 368, 3, 2, 2, 2, 370, 371, 3, 2, 2, 2, 371, 373, 3, 2, 2, 2, 372, 374, 5, 52, 27, 2, 373, 372, 3, 2, 2, 2, 373, 374, 3, 2, 2, 2, 374, 376, 3, 2, 2, 2, 375, 377, 5, 14, 8, 2, 376, 375, 3, 2, 2, 2, 376, 377, 3, 2, 2, 2, 377, 378, 3, 2, 2, 2, 378, 379, 7, 2, 2, 3, 379, 33, 3, 2, 2, 2, 380, 382, 5, 6, 4, 2, 381, 380, 3, 2, 2, 2, 381, 382, 3, 2, 2, 2, 382, 383, 3, 2, 2, 2, 383, 392, 5, 36, 19, 2, 384, 386, 5, 14, 8, 2, 385, 384, 3, 2, 2, 2, 385, 386, 3, 2, 2, 2, 386, 387, 3, 2, 2, 2, 387, 389, 5, 36, 19, 2, 388, 390, 5, 14, 8, 2, 389, 388, 3, 2, 2, 2, 389, 390, 3, 2, 2, 2, 390, 392, 3, 2, 2, 2, 391, 381, 3, 2, 2, 2, 391, 385, 3, 2, 2, 2, 392, 35, 3, 2, 2, 2, 393, 394, 7, 59, 2, 2, 394, 395, 7, 61, 2, 2, 395, 415, 7, 60, 2, 2, 396, 397, 7, 66, 2, 2, 397, 398, 7, 67, 2, 2, 398, 415, 7, 51, 2, 2, 399, 400, 7, 69, 2, 2, 400, 401, 7, 51, 2, 2, 401, 415, 7, 50, 2, 2, 402, 403, 7, 66, 2, 2, 403, 404, 7, 54, 2, 2, 404, 415, 7, 67, 2, 2, 405, 406, 7, 52, 2, 2, 406, 407, 7, 64, 2, 2, 407, 415, 7, 55, 2, 2, 408, 409, 7, 65, 2, 2, 409, 410, 7, 47, 2, 2, 410, 415, 7, 66, 2, 2, 411, 412, 7, 65, 2, 2, 412, 413, 7, 67, 2, 2, 413, 415, 7, 60, 2, 2, 414, 393, 3, 2, 2, 2, 414, 396, 3, 2, 2, 2, 414, 399, 3, 2, 2, 2, 414, 402, 3, 2, 2, 2, 414, 405, 3, 2, 2, 2, 414, 408, 3, 2, 2, 2, 414, 411, 3, 2, 2, 2, 415, 37, 3, 2, 2, 2, 416, 418, 5, 6, 4, 2, 417, 416, 3, 2, 2, 2, 417, 418, 3, 2, 2, 2, 418, 419, 3, 2, 2, 2, 419, 421, 7, 27, 2, 2, 420, 422, 7, 27, 2, 2, 421, 420, 3, 2, 2, 2, 421, 422, 3, 2, 2, 2, 422, 423, 3, 2, 2, 2, 423, 435, 5, 6, 4, 2, 424, 426, 5, 14, 8, 2, 425, 424, 3, 2, 2, 2, 425, 426, 3, 2, 2, 2, 426, 427, 3, 2, 2, 2, 427, 429, 7, 27, 2, 2, 428, 430, 7, 27, 2, 2, 429, 428, 3, 2, 2, 2, 429, 430, 3, 2, 2, 2, 430, 432, 3, 2, 2, 2, 431, 433, 5, 14, 8, 2, 432, 431, 3, 2, 2, 2, 432, 433, 3, 2, 2, 2, 433, 435, 3, 2, 2, 2, 434, 417, 3, 2, 2, 2, 434, 425, 3, 2, 2, 2, 435, 39, 3, 2, 2, 2, 436, 437, 7, 56, 2, 2, 437, 438, 7, 47, 2, 2, 438, 473, 7, 60, 2, 2, 439, 440, 7, 52, 2, 2, 440, 441, 7, 51, 2, 2, 441, 473, 7, 48, 2, 2, 442, 443, 7, 59, 2, 2, 443, 444, 7, 47, 2, 2, 444, 473, 7, 64, 2, 2, 445, 446, 7, 47, 2, 2, 446, 447, 7, 62, 2, 2, 447, 473, 7, 64, 2, 2, 448, 449, 7, 59, 2, 2, 449, 450, 7, 47, 2, 2, 450, 473, 7, 71, 2, 2, 451, 452, 7, 56, 2, 2, 452, 453, 7, 67, 2, 2, 453, 473, 7, 60, 2, 2, 454, 455, 7, 56, 2, 2, 455, 456, 7, 67, 2, 2, 456, 473, 7, 58, 2, 2, 457, 458, 7, 47, 2, 2, 458, 459, 7, 67, 2, 2, 459, 473, 7, 53, 2, 2, 460, 461, 7, 65, 2, 2, 461, 462, 7, 51, 2, 2, 462, 473, 7, 62, 2, 2, 463, 464, 7, 61, 2, 2, 464, 465, 7, 49, 2, 2, 465, 473, 7, 66, 2, 2, 466, 467, 7, 60, 2, 2, 467, 468, 7, 61, 2, 2, 468, 473, 7, 68, 2, 2, 469, 470, 7, 50, 2, 2, 470, 471, 7, 51, 2, 2, 471, 473, 7, 49, 2, 2, 472, 436, 3, 2, 2, 2, 472, 439, 3, 2, 2, 2, 472, 442, 3, 2, 2, 2, 472, 445, 3, 2, 2, 2, 472, 448, 3, 2, 2, 2, 472, 451, 3, 2, 2, 2, 472, 454, 3, 2, 2, 2, 472, 457, 3, 2, 2, 2, 472, 460, 3, 2, 2, 2, 472, 463, 3, 2, 2, 2, 472, 466, 3, 2, 2, 2, 472, 469, 3, 2, 2, 2, 473, 41, 3, 2, 2, 2, 474, 475, 5, 6, 4, 2, 475, 476, 7, 27, 2, 2, 476, 477, 7, 27, 2, 2, 477, 478, 7, 27, 2, 2, 478, 479, 7, 27, 2, 2, 479, 480, 5, 6, 4, 2, 480, 490, 3, 2, 2, 2, 481, 483, 5, 14, 8, 2, 482, 481, 3, 2, 2, 2, 482, 483, 3, 2, 2, 2, 483, 484, 3, 2, 2, 2, 484, 485, 7, 27, 2, 2, 485, 487, 7, 27, 2, 2, 486, 488, 5, 14, 8, 2, 487, 486, 3, 2, 2, 2, 487, 488, 3, 2, 2, 2, 488, 490, 3, 2, 2, 2, 489, 474, 3, 2, 2, 2, 489, 482, 3, 2, 2, 2, 490, 43, 3, 2, 2, 2, 491, 493, 7, 27, 2, 2, 492, 491, 3, 2, 2, 2, 492, 493, 3, 2, 2, 2, 493, 494, 3, 2, 2, 2, 494, 506, 7, 27, 2, 2, 495, 497, 5, 14, 8, 2, 496, 495, 3, 2, 2, 2, 496, 497, 3, 2, 2, 2, 497, 499, 3, 2, 2, 2, 498, 500, 7, 27, 2, 2, 499, 498, 3, 2, 2, 2, 499, 500, 3, 2, 2, 2, 500, 501, 3, 2, 2, 2, 501, 503, 7, 27, 2, 2, 502, 504, 5, 14, 8, 2, 503, 502, 3, 2, 2, 2, 503, 504, 3, 2, 2, 2, 504, 506, 3, 2, 2, 2, 505, 492, 3, 2, 2, 2, 505, 496, 3, 2, 2, 2, 506, 45, 3, 2, 2, 2, 507, 508, 7, 27, 2, 2, 508, 518, 7, 27, 2, 2, 509, 511, 5, 14, 8, 2, 510, 509, 3, 2, 2, 2, 510, 511, 3, 2, 2, 2, 511, 512, 3, 2, 2, 2, 512, 513, 7, 27, 2, 2, 513, 515, 7, 27, 2, 2, 514, 516, 5, 14, 8, 2, 515, 514, 3, 2, 2, 2, 515, 516, 3, 2, 2, 2, 516, 518, 3, 2, 2, 2, 517, 507, 3, 2, 2, 2, 517, 510, 3, 2, 2, 2, 518, 47, 3, 2, 2, 2, 519, 520, 7, 27, 2, 2, 520, 530, 7, 27, 2, 2, 521, 523, 5, 14, 8, 2, 522, 521, 3, 2, 2, 2, 522, 523, 3, 2, 2, 2, 523, 524, 3, 2, 2, 2, 524, 525, 7, 27, 2, 2, 525, 527, 7, 27, 2, 2, 526, 528, 5, 14, 8, 2, 527, 526, 3, 2, 2, 2, 527, 528, 3, 2, 2, 2, 528, 530, 3, 2, 2, 2, 529, 519, 3, 2, 2, 2, 529, 522, 3, 2, 2, 2, 530, 49, 3, 2, 2, 2, 531, 533, 9, 2, 2, 2, 532, 531, 3, 2, 2, 2, 532, 533, 3, 2, 2, 2, 533, 534, 3, 2, 2, 2, 534, 535, 7, 27, 2, 2, 535, 536, 7, 27, 2, 2, 536, 537, 7, 27, 2, 2, 537, 538, 7, 27, 2, 2, 538, 51, 3, 2, 2, 2, 539, 540, 5, 6, 4, 2, 540, 541, 5, 50, 26, 2, 541, 544, 3, 2, 2, 2, 542, 544, 5, 94, 48, 2, 543, 539, 3, 2, 2, 2, 543, 542, 3, 2, 2, 2, 544, 53, 3, 2, 2, 2, 545, 548, 5, 56, 29, 2, 546, 548, 5, 62, 32, 2, 547, 545, 3, 2, 2, 2, 547, 546, 3, 2, 2, 2, 548, 55, 3, 2, 2, 2, 549, 552, 5, 58, 30, 2, 550, 552, 5, 72, 37, 2, 551, 549, 3, 2, 2, 2, 551, 550, 3, 2, 2, 2, 552, 57, 3, 2, 2, 2, 553, 555, 5, 64, 33, 2, 554, 553, 3, 2, 2, 2, 554, 555, 3, 2, 2, 2, 555, 556, 3, 2, 2, 2, 556, 557, 5, 60, 31, 2, 557, 59, 3, 2, 2, 2, 558, 560, 5, 14, 8, 2, 559, 558, 3, 2, 2, 2, 559, 560, 3, 2, 2, 2, 560, 561, 3, 2, 2, 2, 561, 563, 7, 30, 2, 2, 562, 564, 5, 72, 37, 2, 563, 562, 3, 2, 2, 2, 563, 564, 3, 2, 2, 2, 564, 565, 3, 2, 2, 2, 565, 567, 7, 32, 2, 2, 566, 568, 5, 14, 8, 2, 567, 566, 3, 2, 2, 2, 567, 568, 3, 2, 2, 2, 568, 571, 3, 2, 2, 2, 569, 571, 5, 96, 49, 2, 570, 559, 3, 2, 2, 2, 570, 569, 3, 2, 2, 2, 571, 61, 3, 2, 2, 2, 572, 573, 5, 64, 33, 2, 573, 575, 7, 28, 2, 2, 574, 576, 5, 70, 36, 2, 575, 574, 3, 2, 2, 2, 575, 576, 3, 2, 2, 2, 576, 577, 3, 2, 2, 2, 577, 579, 7, 29, 2, 2, 578, 580, 5, 14, 8, 2, 579, 578, 3, 2, 2, 2, 579, 580, 3, 2, 2, 2, 580, 63, 3, 2, 2, 2, 581, 583, 5, 30, 16, 2, 582, 581, 3, 2, 2, 2, 583, 584, 3, 2, 2, 2, 584, 582, 3, 2, 2, 2, 584, 585, 3, 2, 2, 2, 585, 596, 3, 2, 2, 2, 586, 592, 5, 30, 16, 2, 587, 591, 5, 30, 16, 2, 588, 591, 7, 25, 2, 2, 589, 591, 5, 14, 8, 2, 590, 587, 3, 2, 2, 2, 590, 588, 3, 2, 2, 2, 590, 589, 3, 2, 2, 2, 591, 594, 3, 2, 2, 2, 592, 590, 3, 2, 2, 2, 592, 593, 3, 2, 2, 2, 593, 596, 3, 2, 2, 2, 594, 592, 3, 2, 2, 2, 595, 582, 3, 2, 2, 2, 595, 586, 3, 2, 2, 2, 596, 65, 3, 2, 2, 2, 597, 602, 5, 56, 29, 2, 598, 599, 7, 23, 2, 2, 599, 601, 5, 56, 29, 2, 600, 598, 3, 2, 2, 2, 601, 604, 3, 2, 2, 2, 602, 600, 3, 2, 2, 2, 602, 603, 3, 2, 2, 2, 603, 607, 3, 2, 2, 2, 604, 602, 3, 2, 2, 2, 605, 607, 5, 102, 52, 2, 606, 597, 3, 2, 2, 2, 606, 605, 3, 2, 2, 2, 607, 67, 3, 2, 2, 2, 608, 613, 5, 54, 28, 2, 609, 610, 7, 23, 2, 2, 610, 612, 5, 54, 28, 2, 611, 609, 3, 2, 2, 2, 612, 615, 3, 2, 2, 2, 613, 611, 3, 2, 2, 2, 613, 614, 3, 2, 2, 2, 614, 616, 3, 2, 2, 2, 615, 613, 3, 2, 2, 2, 616, 617, 7, 2, 2, 3, 617, 622, 3, 2, 2, 2, 618, 619, 5, 104, 53, 2, 619, 620, 7, 2, 2, 3, 620, 622, 3, 2, 2, 2, 621, 608, 3, 2, 2, 2, 621, 618, 3, 2, 2, 2, 622, 69, 3, 2, 2, 2, 623, 627, 5, 66, 34, 2, 624, 627, 5, 14, 8, 2, 625, 627, 5, 106, 54, 2, 626, 623, 3, 2, 2, 2, 626, 624, 3, 2, 2, 2, 626, 625, 3, 2, 2, 2, 627, 71, 3, 2, 2, 2, 628, 629, 5, 74, 38, 2, 629, 630, 7, 34, 2, 2, 630, 633, 5, 78, 40, 2, 631, 632, 7, 28, 2, 2, 632, 634, 5, 76, 39, 2, 633, 631, 3, 2, 2, 2, 633, 634, 3, 2, 2, 2, 634, 73, 3, 2, 2, 2, 635, 637, 5, 14, 8, 2, 636, 635, 3, 2, 2, 2, 636, 637, 3, 2, 2, 2, 637, 638, 3, 2, 2, 2, 638, 640, 5, 20, 11, 2, 639, 641, 5, 14, 8, 2, 640, 639, 3, 2, 2, 2, 640, 641, 3, 2, 2, 2, 641, 651, 3, 2, 2, 2, 642, 644, 5, 14, 8, 2, 643, 642, 3, 2, 2, 2, 643, 644, 3, 2, 2, 2, 644, 645, 3, 2, 2, 2, 645, 647, 5, 28, 15, 2, 646, 648, 5, 14, 8, 2, 647, 646, 3, 2, 2, 2, 647, 648, 3, 2, 2, 2, 648, 651, 3, 2, 2, 2, 649, 651, 5, 108, 55, 2, 650, 636, 3, 2, 2, 2, 650, 643, 3, 2, 2, 2, 650, 649, 3, 2, 2, 2, 651, 75, 3, 2, 2, 2, 652, 654, 7, 27, 2, 2, 653, 652, 3, 2, 2, 2, 654, 655, 3, 2, 2, 2, 655, 653, 3, 2, 2, 2, 655, 656, 3, 2, 2, 2, 656, 77, 3, 2, 2, 2, 657, 659, 5, 14, 8, 2, 658, 657, 3, 2, 2, 2, 658, 659, 3, 2, 2, 2, 659, 660, 3, 2, 2, 2, 660, 662, 5, 20, 11, 2, 661, 663, 5, 14, 8, 2, 662, 661, 3, 2, 2, 2, 662, 663, 3, 2, 2, 2, 663, 679, 3, 2, 2, 2, 664, 666, 5, 14, 8, 2, 665, 664, 3, 2, 2, 2, 665, 666, 3, 2, 2, 2, 666, 667, 3, 2, 2, 2, 667, 669, 5, 80, 41, 2, 668, 670, 5, 14, 8, 2, 669, 668, 3, 2, 2, 2, 669, 670, 3, 2, 2, 2, 670, 679, 3, 2, 2, 2, 671, 673, 5, 14, 8, 2, 672, 671, 3, 2, 2, 2, 672, 673, 3, 2, 2, 2, 673, 674, 3, 2, 2, 2, 674, 676, 5, 110, 56, 2, 675, 677, 5, 14, 8, 2, 676, 675, 3, 2, 2, 2, 676, 677, 3, 2, 2, 2, 677, 679, 3, 2, 2, 2, 678, 658, 3, 2, 2, 2, 678, 665, 3, 2, 2, 2, 678, 672, 3, 2, 2, 2, 679, 79, 3, 2, 2, 2, 680, 687, 7, 35, 2, 2, 681, 683, 5, 6, 4, 2, 682, 681, 3, 2, 2, 2, 682, 683, 3, 2, 2, 2, 683, 684, 3, 2, 2, 2, 684, 686, 5, 82, 42, 2, 685, 682, 3, 2, 2, 2, 686, 689, 3, 2, 2, 2, 687, 685, 3, 2, 2, 2, 687, 688, 3, 2, 2, 2, 688, 691, 3, 2, 2, 2, 689, 687, 3, 2, 2, 2, 690, 692, 5, 6, 4, 2, 691, 690, 3, 2, 2, 2, 691, 692, 3, 2, 2, 2, 692, 693, 3, 2, 2, 2, 693, 694, 7, 37, 2, 2, 694, 81, 3, 2, 2, 2, 695, 728, 5, 132, 67, 2, 696, 728, 7, 12, 2, 2, 697, 728, 7, 13, 2, 2, 698, 728, 7, 14, 2, 2, 699, 728, 7, 15, 2, 2, 700, 728, 7, 16, 2, 2, 701, 728, 7, 17, 2, 2, 702, 728, 7, 18, 2, 2, 703, 728, 7, 19, 2, 2, 704, 728, 7, 20, 2, 2, 705, 728, 7, 21, 2, 2, 706, 728, 7, 22, 2, 2, 707, 728, 7, 23, 2, 2, 708, 728, 7, 24, 2, 2, 709, 728, 7, 25, 2, 2, 710, 728, 7, 26, 2, 2, 711, 728, 7, 27, 2, 2, 712, 728, 7, 28, 2, 2, 713, 728, 7, 29, 2, 2, 714, 728, 7, 30, 2, 2, 715, 728, 7, 31, 2, 2, 716, 728, 7, 32, 2, 2, 717, 728, 7, 33, 2, 2, 718, 728, 7, 34, 2, 2, 719, 728, 7, 38, 2, 2, 720, 728, 7, 39, 2, 2, 721, 728, 7, 40, 2, 2, 722, 728, 7, 41, 2, 2, 723, 728, 7, 42, 2, 2, 724, 728, 7, 43, 2, 2, 725, 728, 7, 44, 2, 2, 726, 728, 7, 46, 2, 2, 727, 695, 3, 2, 2, 2, 727, 696, 3, 2, 2, 2, 727, 697, 3, 2, 2, 2, 727, 698, 3, 2, 2, 2, 727, 699, 3, 2, 2, 2, 727, 700, 3, 2, 2, 2, 727, 701, 3, 2, 2, 2, 727, 702, 3, 2, 2, 2, 727, 703, 3, 2, 2, 2, 727, 704, 3, 2, 2, 2, 727, 705, 3, 2, 2, 2, 727, 706, 3, 2, 2, 2, 727, 707, 3, 2, 2, 2, 727, 708, 3, 2, 2, 2, 727, 709, 3, 2, 2, 2, 727, 710, 3, 2, 2, 2, 727, 711, 3, 2, 2, 2, 727, 712, 3, 2, 2, 2, 727, 713, 3, 2, 2, 2, 727, 714, 3, 2, 2, 2, 727, 715, 3, 2, 2, 2, 727, 716, 3, 2, 2, 2, 727, 717, 3, 2, 2, 2, 727, 718, 3, 2, 2, 2, 727, 719, 3, 2, 2, 2, 727, 720, 3, 2, 2, 2, 727, 721, 3, 2, 2, 2, 727, 722, 3, 2, 2, 2, 727, 723, 3, 2, 2, 2, 727, 724, 3, 2, 2, 2, 727, 725, 3, 2, 2, 2, 727, 726, 3, 2, 2, 2, 728, 83, 3, 2, 2, 2, 729, 730, 9, 3, 2, 2, 730, 85, 3, 2, 2, 2, 731, 732, 5, 84, 43, 2, 732, 87, 3, 2, 2, 2, 733, 734, 5, 84, 43, 2, 734, 89, 3, 2, 2, 2, 735, 740, 7, 36, 2, 2, 736, 741, 7, 3, 2, 2, 737, 741, 5, 84, 43, 2, 738, 741, 7, 6, 2, 2, 739, 741, 7, 9, 2, 2, 740, 736, 3, 2, 2, 2, 740, 737, 3, 2, 2, 2, 740, 738, 3, 2, 2, 2, 740, 739, 3, 2, 2, 2, 741, 91, 3, 2, 2, 2, 742, 744, 5, 128, 65, 2, 743, 742, 3, 2, 2, 2, 744, 745, 3, 2, 2, 2, 745, 743, 3, 2, 2, 2, 745, 746, 3, 2, 2, 2, 746, 747, 3, 2, 2, 2, 747, 749, 5, 126, 64, 2, 748, 750, 5, 128, 65, 2, 749, 748, 3, 2, 2, 2, 750, 751, 3, 2, 2, 2, 751, 749, 3, 2, 2, 2, 751, 752, 3, 2, 2, 2, 752, 93, 3, 2, 2, 2, 753, 754, 7, 67, 2, 2, 754, 786, 7, 66, 2, 2, 755, 756, 7, 67, 2, 2, 756, 757, 7, 66, 2, 2, 757, 786, 7, 49, 2, 2, 758, 759, 7, 53, 2, 2, 759, 760, 7, 59, 2, 2, 760, 786, 7, 66, 2, 2, 761, 762, 7, 51, 2, 2, 762, 763, 7, 65, 2, 2, 763, 786, 7, 66, 2, 2, 764, 765, 7, 51, 2, 2, 765, 766, 7, 50, 2, 2, 766, 786, 7, 66, 2, 2, 767, 768, 7, 49, 2, 2, 768, 769, 7, 65, 2, 2, 769, 786, 7, 66, 2, 2, 770, 771, 7, 49, 2, 2, 771, 772, 7, 50, 2, 2, 772, 786, 7, 66, 2, 2, 773, 774, 7, 59, 2, 2, 774, 775, 7, 65, 2, 2, 775, 786, 7, 66, 2, 2, 776, 777, 7, 59, 2, 2, 777, 778, 7, 50, 2, 2, 778, 786, 7, 66, 2, 2, 779, 780, 7, 62, 2, 2, 780, 781, 7, 65, 2, 2, 781, 786, 7, 66, 2, 2, 782, 783, 7, 62, 2, 2, 783, 784, 7, 50, 2, 2, 784, 786, 7, 66, 2, 2, 785, 753, 3, 2, 2, 2, 785, 755, 3, 2, 2, 2, 785, 758, 3, 2, 2, 2, 785, 761, 3, 2, 2, 2, 785, 764, 3, 2, 2, 2, 785, 767, 3, 2, 2, 2, 785, 770, 3, 2, 2, 2, 785, 773, 3, 2, 2, 2, 785, 776, 3, 2, 2, 2, 785, 779, 3, 2, 2, 2, 785, 782, 3, 2, 2, 2, 786, 95, 3, 2, 2, 2, 787, 789, 5, 14, 8, 2, 788, 787, 3, 2, 2, 2, 788, 789, 3, 2, 2, 2, 789, 790, 3, 2, 2, 2, 790, 791, 7, 30, 2, 2, 791, 792, 5, 98, 50, 2, 792, 793, 5, 72, 37, 2, 793, 795, 7, 32, 2, 2, 794, 796, 5, 14, 8, 2, 795, 794, 3, 2, 2, 2, 795, 796, 3, 2, 2, 2, 796, 97, 3, 2, 2, 2, 797, 798, 5, 100, 51, 2, 798, 799, 7, 28, 2, 2, 799, 99, 3, 2, 2, 2, 800, 803, 5, 14, 8, 2, 801, 803, 7, 23, 2, 2, 802, 800, 3, 2, 2, 2, 802, 801, 3, 2, 2, 2, 803, 806, 3, 2, 2, 2, 804, 802, 3, 2, 2, 2, 804, 805, 3, 2, 2, 2, 805, 807, 3, 2, 2, 2, 806, 804, 3, 2, 2, 2, 807, 808, 7, 34, 2, 2, 808, 819, 5, 78, 40, 2, 809, 811, 7, 23, 2, 2, 810, 812, 5, 14, 8, 2, 811, 810, 3, 2, 2, 2, 811, 812, 3, 2, 2, 2, 812, 815, 3, 2, 2, 2, 813, 814, 7, 34, 2, 2, 814, 816, 5, 78, 40, 2, 815, 813, 3, 2, 2, 2, 815, 816, 3, 2, 2, 2, 816, 818, 3, 2, 2, 2, 817, 809, 3, 2, 2, 2, 818, 821, 3, 2, 2, 2, 819, 817, 3, 2, 2, 2, 819, 820, 3, 2, 2, 2, 820, 101, 3, 2, 2, 2, 821, 819, 3, 2, 2, 2, 822, 824, 5, 14, 8, 2, 823, 822, 3, 2, 2, 2, 823, 824, 3, 2, 2, 2, 824, 825, 3, 2, 2, 2, 825, 827, 7, 23, 2, 2, 826, 823, 3, 2, 2, 2, 827, 830, 3, 2, 2, 2, 828, 826, 3, 2, 2, 2, 828, 829, 3, 2, 2, 2, 829, 831, 3, 2, 2, 2, 830, 828, 3, 2, 2, 2, 831, 839, 5, 56, 29, 2, 832, 835, 7, 23, 2, 2, 833, 836, 5, 56, 29, 2, 834, 836, 5, 14, 8, 2, 835, 833, 3, 2, 2, 2, 835, 834, 3, 2, 2, 2, 835, 836, 3, 2, 2, 2, 836, 838, 3, 2, 2, 2, 837, 832, 3, 2, 2, 2, 838, 841, 3, 2, 2, 2, 839, 837, 3, 2, 2, 2, 839, 840, 3, 2, 2, 2, 840, 103, 3, 2, 2, 2, 841, 839, 3, 2, 2, 2, 842, 844, 5, 14, 8, 2, 843, 842, 3, 2, 2, 2, 843, 844, 3, 2, 2, 2, 844, 845, 3, 2, 2, 2, 845, 847, 7, 23, 2, 2, 846, 843, 3, 2, 2, 2, 847, 850, 3, 2, 2, 2, 848, 846, 3, 2, 2, 2, 848, 849, 3, 2, 2, 2, 849, 851, 3, 2, 2, 2, 850, 848, 3, 2, 2, 2, 851, 859, 5, 54, 28, 2, 852, 855, 7, 23, 2, 2, 853, 856, 5, 54, 28, 2, 854, 856, 5, 14, 8, 2, 855, 853, 3, 2, 2, 2, 855, 854, 3, 2, 2, 2, 855, 856, 3, 2, 2, 2, 856, 858, 3, 2, 2, 2, 857, 852, 3, 2, 2, 2, 858, 861, 3, 2, 2, 2, 859, 857, 3, 2, 2, 2, 859, 860, 3, 2, 2, 2, 860, 105, 3, 2, 2, 2, 861, 859, 3, 2, 2, 2, 862, 864, 5, 14, 8, 2, 863, 862, 3, 2, 2, 2, 863, 864, 3, 2, 2, 2, 864, 865, 3, 2, 2, 2, 865, 867, 7, 23, 2, 2, 866, 863, 3, 2, 2, 2, 867, 868, 3, 2, 2, 2, 868, 866, 3, 2, 2, 2, 868, 869, 3, 2, 2, 2, 869, 871, 3, 2, 2, 2, 870, 872, 5, 14, 8, 2, 871, 870, 3, 2, 2, 2, 871, 872, 3, 2, 2, 2, 872, 107, 3, 2, 2, 2, 873, 878, 5, 30, 16, 2, 874, 875, 7, 25, 2, 2, 875, 877, 5, 30, 16, 2, 876, 874, 3, 2, 2, 2, 877, 880, 3, 2, 2, 2, 878, 876, 3, 2, 2, 2, 878, 879, 3, 2, 2, 2, 879, 109, 3, 2, 2, 2, 880, 878, 3, 2, 2, 2, 881, 886, 5, 18, 10, 2, 882, 883, 7, 25, 2, 2, 883, 885, 5, 18, 10, 2, 884, 882, 3, 2, 2, 2, 885, 888, 3, 2, 2, 2, 886, 884, 3, 2, 2, 2, 886, 887, 3, 2, 2, 2, 887, 111, 3, 2, 2, 2, 888, 886, 3, 2, 2, 2, 889, 890, 7, 31, 2, 2, 890, 891, 7, 33, 2, 2, 891, 892, 5, 114, 58, 2, 892, 893, 7, 33, 2, 2, 893, 894, 5, 116, 59, 2, 894, 895, 7, 33, 2, 2, 895, 896, 5, 122, 62, 2, 896, 897, 7, 33, 2, 2, 897, 898, 7, 31, 2, 2, 898, 113, 3, 2, 2, 2, 899, 900, 5, 118, 60, 2, 900, 115, 3, 2, 2, 2, 901, 902, 5, 118, 60, 2, 902, 117, 3, 2, 2, 2, 903, 905, 5, 120, 61, 2, 904, 903, 3, 2, 2, 2, 905, 906, 3, 2, 2, 2, 906, 904, 3, 2, 2, 2, 906, 907, 3, 2, 2, 2, 907, 119, 3, 2, 2, 2, 908, 928, 5, 132, 67, 2, 909, 928, 7, 12, 2, 2, 910, 928, 7, 14, 2, 2, 911, 928, 7, 15, 2, 2, 912, 928, 7, 16, 2, 2, 913, 928, 7, 17, 2, 2, 914, 928, 7, 18, 2, 2, 915, 928, 7, 21, 2, 2, 916, 928, 7, 22, 2, 2, 917, 928, 7, 24, 2, 2, 918, 928, 7, 27, 2, 2, 919, 928, 7, 36, 2, 2, 920, 928, 7, 38, 2, 2, 921, 928, 7, 39, 2, 2, 922, 928, 7, 40, 2, 2, 923, 928, 7, 41, 2, 2, 924, 928, 7, 42, 2, 2, 925, 928, 7, 43, 2, 2, 926, 928, 7, 44, 2, 2, 927, 908, 3, 2, 2, 2, 927, 909, 3, 2, 2, 2, 927, 910, 3, 2, 2, 2, 927, 911, 3, 2, 2, 2, 927, 912, 3, 2, 2, 2, 927, 913, 3, 2, 2, 2, 927, 914, 3, 2, 2, 2, 927, 915, 3, 2, 2, 2, 927, 916, 3, 2, 2, 2, 927, 917, 3, 2, 2, 2, 927, 918, 3, 2, 2, 2, 927, 919, 3, 2, 2, 2, 927, 920, 3, 2, 2, 2, 927, 921, 3, 2, 2, 2, 927, 922, 3, 2, 2, 2, 927, 923, 3, 2, 2, 2, 927, 924, 3, 2, 2, 2, 927, 925, 3, 2, 2, 2, 927, 926, 3, 2, 2, 2, 928, 121, 3, 2, 2, 2, 929, 931, 5, 124, 63, 2, 930, 929, 3, 2, 2, 2, 931, 932, 3, 2, 2, 2, 932, 930, 3, 2, 2, 2, 932, 933, 3, 2, 2, 2, 933, 123, 3, 2, 2, 2, 934, 968, 5, 132, 67, 2, 935, 968, 7, 12, 2, 2, 936, 968, 7, 13, 2, 2, 937, 968, 7, 14, 2, 2, 938, 968, 7, 15, 2, 2, 939, 968, 7, 16, 2, 2, 940, 968, 7, 17, 2, 2, 941, 968, 7, 18, 2, 2, 942, 968, 7, 19, 2, 2, 943, 968, 7, 20, 2, 2, 944, 968, 7, 21, 2, 2, 945, 968, 7, 22, 2, 2, 946, 968, 7, 23, 2, 2, 947, 968, 7, 24, 2, 2, 948, 968, 7, 25, 2, 2, 949, 968, 7, 26, 2, 2, 950, 968, 7, 27, 2, 2, 951, 968, 7, 28, 2, 2, 952, 968, 7, 29, 2, 2, 953, 968, 7, 30, 2, 2, 954, 968, 7, 31, 2, 2, 955, 968, 7, 32, 2, 2, 956, 968, 7, 34, 2, 2, 957, 968, 7, 35, 2, 2, 958, 968, 7, 36, 2, 2, 959, 968, 7, 37, 2, 2, 960, 968, 7, 38, 2, 2, 961, 968, 7, 39, 2, 2, 962, 968, 7, 40, 2, 2, 963, 968, 7, 41, 2, 2, 964, 968, 7, 42, 2, 2, 965, 968, 7, 43, 2, 2, 966, 968, 7, 44, 2, 2, 967, 934, 3, 2, 2, 2, 967, 935, 3, 2, 2, 2, 967, 936, 3, 2, 2, 2, 967, 937, 3, 2, 2, 2, 967, 938, 3, 2, 2, 2, 967, 939, 3, 2, 2, 2, 967, 940, 3, 2, 2, 2, 967, 941, 3, 2, 2, 2, 967, 942, 3, 2, 2, 2, 967, 943, 3, 2, 2, 2, 967, 944, 3, 2, 2, 2, 967, 945, 3, 2, 2, 2, 967, 946, 3, 2, 2, 2, 967, 947, 3, 2, 2, 2, 967, 948, 3, 2, 2, 2, 967, 949, 3, 2, 2, 2, 967, 950, 3, 2, 2, 2, 967, 951, 3, 2, 2, 2, 967, 952, 3, 2, 2, 2, 967, 953, 3, 2, 2, 2, 967, 954, 3, 2, 2, 2, 967, 955, 3, 2, 2, 2, 967, 956, 3, 2, 2, 2, 967, 957, 3, 2, 2, 2, 967, 958, 3, 2, 2, 2, 967, 959, 3, 2, 2, 2, 967, 960, 3, 2, 2, 2, 967, 961, 3, 2, 2, 2, 967, 962, 3, 2, 2, 2, 967, 963, 3, 2, 2, 2, 967, 964, 3, 2, 2, 2, 967, 965, 3, 2, 2, 2, 967, 966, 3, 2, 2, 2, 968, 125, 3, 2, 2, 2, 969, 970, 7, 9, 2, 2, 970, 971, 7, 6, 2, 2, 971, 127, 3, 2, 2, 2, 972, 973, 9, 4, 2, 2, 973, 129, 3, 2, 2, 2, 974, 1010, 5, 132, 67, 2, 975, 1010, 7, 12, 2, 2, 976, 1010, 7, 13, 2, 2, 977, 1010, 7, 14, 2, 2, 978, 1010, 7, 15, 2, 2, 979, 1010, 7, 16, 2, 2, 980, 1010, 7, 17, 2, 2, 981, 1010, 7, 18, 2, 2, 982, 1010, 7, 19, 2, 2, 983, 1010, 7, 20, 2, 2, 984, 1010, 7, 21, 2, 2, 985, 1010, 7, 22, 2, 2, 986, 1010, 7, 23, 2, 2, 987, 1010, 7, 24, 2, 2, 988, 1010, 7, 25, 2, 2, 989, 1010, 7, 26, 2, 2, 990, 1010, 7, 27, 2, 2, 991, 1010, 7, 28, 2, 2, 992, 1010, 7, 29, 2, 2, 993, 1010, 7, 30, 2, 2, 994, 1010, 7, 31, 2, 2, 995, 1010, 7, 32, 2, 2, 996, 1010, 7, 33, 2, 2, 997, 1010, 7, 34, 2, 2, 998, 1010, 7, 35, 2, 2, 999, 1010, 7, 36, 2, 2, 1000, 1010, 7, 37, 2, 2, 1001, 1010, 7, 38, 2, 2, 1002, 1010, 7, 39, 2, 2, 1003, 1010, 7, 40, 2, 2, 1004, 1010, 7, 41, 2, 2, 1005, 1010, 7, 42, 2, 2, 1006, 1010, 7, 43, 2, 2, 1007, 1010, 7, 44, 2, 2, 1008, 1010, 7, 46, 2, 2, 1009, 974, 3, 2, 2, 2, 1009, 975, 3, 2, 2, 2, 1009, 976, 3, 2, 2, 2, 1009, 977, 3, 2, 2, 2, 1009, 978, 3, 2, 2, 2, 1009, 979, 3, 2, 2, 2, 1009, 980, 3, 2, 2, 2, 1009, 981, 3, 2, 2, 2, 1009, 982, 3, 2, 2, 2, 1009, 983, 3, 2, 2, 2, 1009, 984, 3, 2, 2, 2, 1009, 985, 3, 2, 2, 2, 1009, 986, 3, 2, 2, 2, 1009, 987, 3, 2, 2, 2, 1009, 988, 3, 2, 2, 2, 1009, 989, 3, 2, 2, 2, 1009, 990, 3, 2, 2, 2, 1009, 991, 3, 2, 2, 2, 1009, 992, 3, 2, 2, 2, 1009, 993, 3, 2, 2, 2, 1009, 994, 3, 2, 2, 2, 1009, 995, 3, 2, 2, 2, 1009, 996, 3, 2, 2, 2, 1009, 997, 3, 2, 2, 2, 1009, 998, 3, 2, 2, 2, 1009, 999, 3, 2, 2, 2, 1009, 1000, 3, 2, 2, 2, 1009, 1001, 3, 2, 2, 2, 1009, 1002, 3, 2, 2, 2, 1009, 1003, 3, 2, 2, 2, 1009, 1004, 3, 2, 2, 2, 1009, 1005, 3, 2, 2, 2, 1009, 1006, 3, 2, 2, 2, 1009, 1007, 3, 2, 2, 2, 1009, 1008, 3, 2, 2, 2, 1010, 131, 3, 2, 2, 2, 1011, 1012, 9, 5, 2, 2, 1012, 133, 3, 2, 2, 2, 132, 136, 141, 146, 150, 155, 158, 193, 198, 202, 207, 211, 216, 221, 224, 227, 251, 256, 261, 267, 271, 275, 311, 315, 318, 323, 329, 334, 338, 341, 345, 348, 352, 355, 360, 370, 373, 376, 381, 385, 389, 391, 414, 417, 421, 425, 429, 432, 434, 472, 482, 487, 489, 492, 496, 499, 503, 505, 510, 515, 517, 522, 527, 529, 532, 543, 547, 551, 554, 559, 563, 567, 570, 575, 579, 584, 590, 592, 595, 602, 606, 613, 621, 626, 633, 636, 640, 643, 647, 650, 655, 658, 662, 665, 669, 672, 676, 678, 682, 687, 691, 727, 740, 745, 751, 785, 788, 795, 802, 804, 811, 815, 819, 823, 828, 835, 839, 843, 848, 855, 859, 863, 868, 871, 878, 886, 906, 927, 932, 967, 1009] \ No newline at end of file diff --git a/pkg/message/rfc5322/parser/RFC5322Parser.tokens b/pkg/message/rfc5322/parser/RFC5322Parser.tokens deleted file mode 100644 index 54ac3db2..00000000 --- a/pkg/message/rfc5322/parser/RFC5322Parser.tokens +++ /dev/null @@ -1,110 +0,0 @@ -U_00=1 -U_01_08=2 -TAB=3 -LF=4 -U_0B=5 -U_0C=6 -CR=7 -U_0E_1F=8 -SP=9 -Exclamation=10 -DQuote=11 -Hash=12 -Dollar=13 -Percent=14 -Ampersand=15 -SQuote=16 -LParens=17 -RParens=18 -Asterisk=19 -Plus=20 -Comma=21 -Minus=22 -Period=23 -Slash=24 -Digit=25 -Colon=26 -Semicolon=27 -Less=28 -Equal=29 -Greater=30 -Question=31 -At=32 -LBracket=33 -Backslash=34 -RBracket=35 -Caret=36 -Underscore=37 -Backtick=38 -LCurly=39 -Pipe=40 -RCurly=41 -Tilde=42 -Delete=43 -UTF8NonAscii=44 -A=45 -B=46 -C=47 -D=48 -E=49 -F=50 -G=51 -H=52 -I=53 -J=54 -K=55 -L=56 -M=57 -N=58 -O=59 -P=60 -Q=61 -R=62 -S=63 -T=64 -U=65 -V=66 -W=67 -X=68 -Y=69 -Z=70 -'\u0000'=1 -'\t'=3 -'\n'=4 -'\u000B'=5 -'\u000C'=6 -'\r'=7 -' '=9 -'!'=10 -'"'=11 -'#'=12 -'$'=13 -'%'=14 -'&'=15 -'\''=16 -'('=17 -')'=18 -'*'=19 -'+'=20 -','=21 -'-'=22 -'.'=23 -'/'=24 -':'=26 -';'=27 -'<'=28 -'='=29 -'>'=30 -'?'=31 -'@'=32 -'['=33 -'\\'=34 -']'=35 -'^'=36 -'_'=37 -'`'=38 -'{'=39 -'|'=40 -'}'=41 -'~'=42 -'\u007F'=43 diff --git a/pkg/message/rfc5322/parser/rfc5322_lexer.go b/pkg/message/rfc5322/parser/rfc5322_lexer.go deleted file mode 100644 index 65239071..00000000 --- a/pkg/message/rfc5322/parser/rfc5322_lexer.go +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -// Code generated from RFC5322Lexer.g4 by ANTLR 4.8. DO NOT EDIT. - -package parser - -import ( - "fmt" - "unicode" - - "github.com/antlr/antlr4/runtime/Go/antlr" -) - -// Suppress unused import error -var _ = fmt.Printf -var _ = unicode.IsLetter - -var serializedLexerAtn = []uint16{ - 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 72, 283, - 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, - 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, - 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, - 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, - 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, - 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, - 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, - 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, - 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, - 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, - 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, - 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, - 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, - 70, 4, 71, 9, 71, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, - 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, - 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 17, - 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 3, 22, 3, - 22, 3, 23, 3, 23, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 27, 3, 27, - 3, 28, 3, 28, 3, 29, 3, 29, 3, 30, 3, 30, 3, 31, 3, 31, 3, 32, 3, 32, 3, - 33, 3, 33, 3, 34, 3, 34, 3, 35, 3, 35, 3, 36, 3, 36, 3, 37, 3, 37, 3, 38, - 3, 38, 3, 39, 3, 39, 3, 40, 3, 40, 3, 41, 3, 41, 3, 42, 3, 42, 3, 43, 3, - 43, 3, 44, 3, 44, 3, 45, 3, 45, 3, 46, 3, 46, 3, 47, 3, 47, 3, 48, 3, 48, - 3, 49, 3, 49, 3, 50, 3, 50, 3, 51, 3, 51, 3, 52, 3, 52, 3, 53, 3, 53, 3, - 54, 3, 54, 3, 55, 3, 55, 3, 56, 3, 56, 3, 57, 3, 57, 3, 58, 3, 58, 3, 59, - 3, 59, 3, 60, 3, 60, 3, 61, 3, 61, 3, 62, 3, 62, 3, 63, 3, 63, 3, 64, 3, - 64, 3, 65, 3, 65, 3, 66, 3, 66, 3, 67, 3, 67, 3, 68, 3, 68, 3, 69, 3, 69, - 3, 70, 3, 70, 3, 71, 3, 71, 2, 2, 72, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, - 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, - 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, - 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, - 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 43, 85, 44, - 87, 45, 89, 46, 91, 47, 93, 48, 95, 49, 97, 50, 99, 51, 101, 52, 103, 53, - 105, 54, 107, 55, 109, 56, 111, 57, 113, 58, 115, 59, 117, 60, 119, 61, - 121, 62, 123, 63, 125, 64, 127, 65, 129, 66, 131, 67, 133, 68, 135, 69, - 137, 70, 139, 71, 141, 72, 3, 2, 29, 3, 2, 50, 59, 4, 2, 67, 67, 99, 99, - 4, 2, 68, 68, 100, 100, 4, 2, 69, 69, 101, 101, 4, 2, 70, 70, 102, 102, - 4, 2, 71, 71, 103, 103, 4, 2, 72, 72, 104, 104, 4, 2, 73, 73, 105, 105, - 4, 2, 74, 74, 106, 106, 4, 2, 75, 75, 107, 107, 4, 2, 76, 76, 108, 108, - 4, 2, 77, 77, 109, 109, 4, 2, 78, 78, 110, 110, 4, 2, 79, 79, 111, 111, - 4, 2, 80, 80, 112, 112, 4, 2, 81, 81, 113, 113, 4, 2, 82, 82, 114, 114, - 4, 2, 83, 83, 115, 115, 4, 2, 84, 84, 116, 116, 4, 2, 85, 85, 117, 117, - 4, 2, 86, 86, 118, 118, 4, 2, 87, 87, 119, 119, 4, 2, 88, 88, 120, 120, - 4, 2, 89, 89, 121, 121, 4, 2, 90, 90, 122, 122, 4, 2, 91, 91, 123, 123, - 4, 2, 92, 92, 124, 124, 2, 282, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, - 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, - 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, - 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, - 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, - 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, - 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, - 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, - 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, - 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, - 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, - 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, - 3, 2, 2, 2, 2, 93, 3, 2, 2, 2, 2, 95, 3, 2, 2, 2, 2, 97, 3, 2, 2, 2, 2, - 99, 3, 2, 2, 2, 2, 101, 3, 2, 2, 2, 2, 103, 3, 2, 2, 2, 2, 105, 3, 2, 2, - 2, 2, 107, 3, 2, 2, 2, 2, 109, 3, 2, 2, 2, 2, 111, 3, 2, 2, 2, 2, 113, - 3, 2, 2, 2, 2, 115, 3, 2, 2, 2, 2, 117, 3, 2, 2, 2, 2, 119, 3, 2, 2, 2, - 2, 121, 3, 2, 2, 2, 2, 123, 3, 2, 2, 2, 2, 125, 3, 2, 2, 2, 2, 127, 3, - 2, 2, 2, 2, 129, 3, 2, 2, 2, 2, 131, 3, 2, 2, 2, 2, 133, 3, 2, 2, 2, 2, - 135, 3, 2, 2, 2, 2, 137, 3, 2, 2, 2, 2, 139, 3, 2, 2, 2, 2, 141, 3, 2, - 2, 2, 3, 143, 3, 2, 2, 2, 5, 145, 3, 2, 2, 2, 7, 147, 3, 2, 2, 2, 9, 149, - 3, 2, 2, 2, 11, 151, 3, 2, 2, 2, 13, 153, 3, 2, 2, 2, 15, 155, 3, 2, 2, - 2, 17, 157, 3, 2, 2, 2, 19, 159, 3, 2, 2, 2, 21, 161, 3, 2, 2, 2, 23, 163, - 3, 2, 2, 2, 25, 165, 3, 2, 2, 2, 27, 167, 3, 2, 2, 2, 29, 169, 3, 2, 2, - 2, 31, 171, 3, 2, 2, 2, 33, 173, 3, 2, 2, 2, 35, 175, 3, 2, 2, 2, 37, 177, - 3, 2, 2, 2, 39, 179, 3, 2, 2, 2, 41, 181, 3, 2, 2, 2, 43, 183, 3, 2, 2, - 2, 45, 185, 3, 2, 2, 2, 47, 187, 3, 2, 2, 2, 49, 189, 3, 2, 2, 2, 51, 191, - 3, 2, 2, 2, 53, 193, 3, 2, 2, 2, 55, 195, 3, 2, 2, 2, 57, 197, 3, 2, 2, - 2, 59, 199, 3, 2, 2, 2, 61, 201, 3, 2, 2, 2, 63, 203, 3, 2, 2, 2, 65, 205, - 3, 2, 2, 2, 67, 207, 3, 2, 2, 2, 69, 209, 3, 2, 2, 2, 71, 211, 3, 2, 2, - 2, 73, 213, 3, 2, 2, 2, 75, 215, 3, 2, 2, 2, 77, 217, 3, 2, 2, 2, 79, 219, - 3, 2, 2, 2, 81, 221, 3, 2, 2, 2, 83, 223, 3, 2, 2, 2, 85, 225, 3, 2, 2, - 2, 87, 227, 3, 2, 2, 2, 89, 229, 3, 2, 2, 2, 91, 231, 3, 2, 2, 2, 93, 233, - 3, 2, 2, 2, 95, 235, 3, 2, 2, 2, 97, 237, 3, 2, 2, 2, 99, 239, 3, 2, 2, - 2, 101, 241, 3, 2, 2, 2, 103, 243, 3, 2, 2, 2, 105, 245, 3, 2, 2, 2, 107, - 247, 3, 2, 2, 2, 109, 249, 3, 2, 2, 2, 111, 251, 3, 2, 2, 2, 113, 253, - 3, 2, 2, 2, 115, 255, 3, 2, 2, 2, 117, 257, 3, 2, 2, 2, 119, 259, 3, 2, - 2, 2, 121, 261, 3, 2, 2, 2, 123, 263, 3, 2, 2, 2, 125, 265, 3, 2, 2, 2, - 127, 267, 3, 2, 2, 2, 129, 269, 3, 2, 2, 2, 131, 271, 3, 2, 2, 2, 133, - 273, 3, 2, 2, 2, 135, 275, 3, 2, 2, 2, 137, 277, 3, 2, 2, 2, 139, 279, - 3, 2, 2, 2, 141, 281, 3, 2, 2, 2, 143, 144, 7, 2, 2, 2, 144, 4, 3, 2, 2, - 2, 145, 146, 4, 3, 10, 2, 146, 6, 3, 2, 2, 2, 147, 148, 7, 11, 2, 2, 148, - 8, 3, 2, 2, 2, 149, 150, 7, 12, 2, 2, 150, 10, 3, 2, 2, 2, 151, 152, 7, - 13, 2, 2, 152, 12, 3, 2, 2, 2, 153, 154, 7, 14, 2, 2, 154, 14, 3, 2, 2, - 2, 155, 156, 7, 15, 2, 2, 156, 16, 3, 2, 2, 2, 157, 158, 4, 16, 33, 2, - 158, 18, 3, 2, 2, 2, 159, 160, 7, 34, 2, 2, 160, 20, 3, 2, 2, 2, 161, 162, - 7, 35, 2, 2, 162, 22, 3, 2, 2, 2, 163, 164, 7, 36, 2, 2, 164, 24, 3, 2, - 2, 2, 165, 166, 7, 37, 2, 2, 166, 26, 3, 2, 2, 2, 167, 168, 7, 38, 2, 2, - 168, 28, 3, 2, 2, 2, 169, 170, 7, 39, 2, 2, 170, 30, 3, 2, 2, 2, 171, 172, - 7, 40, 2, 2, 172, 32, 3, 2, 2, 2, 173, 174, 7, 41, 2, 2, 174, 34, 3, 2, - 2, 2, 175, 176, 7, 42, 2, 2, 176, 36, 3, 2, 2, 2, 177, 178, 7, 43, 2, 2, - 178, 38, 3, 2, 2, 2, 179, 180, 7, 44, 2, 2, 180, 40, 3, 2, 2, 2, 181, 182, - 7, 45, 2, 2, 182, 42, 3, 2, 2, 2, 183, 184, 7, 46, 2, 2, 184, 44, 3, 2, - 2, 2, 185, 186, 7, 47, 2, 2, 186, 46, 3, 2, 2, 2, 187, 188, 7, 48, 2, 2, - 188, 48, 3, 2, 2, 2, 189, 190, 7, 49, 2, 2, 190, 50, 3, 2, 2, 2, 191, 192, - 9, 2, 2, 2, 192, 52, 3, 2, 2, 2, 193, 194, 7, 60, 2, 2, 194, 54, 3, 2, - 2, 2, 195, 196, 7, 61, 2, 2, 196, 56, 3, 2, 2, 2, 197, 198, 7, 62, 2, 2, - 198, 58, 3, 2, 2, 2, 199, 200, 7, 63, 2, 2, 200, 60, 3, 2, 2, 2, 201, 202, - 7, 64, 2, 2, 202, 62, 3, 2, 2, 2, 203, 204, 7, 65, 2, 2, 204, 64, 3, 2, - 2, 2, 205, 206, 7, 66, 2, 2, 206, 66, 3, 2, 2, 2, 207, 208, 7, 93, 2, 2, - 208, 68, 3, 2, 2, 2, 209, 210, 7, 94, 2, 2, 210, 70, 3, 2, 2, 2, 211, 212, - 7, 95, 2, 2, 212, 72, 3, 2, 2, 2, 213, 214, 7, 96, 2, 2, 214, 74, 3, 2, - 2, 2, 215, 216, 7, 97, 2, 2, 216, 76, 3, 2, 2, 2, 217, 218, 7, 98, 2, 2, - 218, 78, 3, 2, 2, 2, 219, 220, 7, 125, 2, 2, 220, 80, 3, 2, 2, 2, 221, - 222, 7, 126, 2, 2, 222, 82, 3, 2, 2, 2, 223, 224, 7, 127, 2, 2, 224, 84, - 3, 2, 2, 2, 225, 226, 7, 128, 2, 2, 226, 86, 3, 2, 2, 2, 227, 228, 7, 129, - 2, 2, 228, 88, 3, 2, 2, 2, 229, 230, 4, 130, 1, 2, 230, 90, 3, 2, 2, 2, - 231, 232, 9, 3, 2, 2, 232, 92, 3, 2, 2, 2, 233, 234, 9, 4, 2, 2, 234, 94, - 3, 2, 2, 2, 235, 236, 9, 5, 2, 2, 236, 96, 3, 2, 2, 2, 237, 238, 9, 6, - 2, 2, 238, 98, 3, 2, 2, 2, 239, 240, 9, 7, 2, 2, 240, 100, 3, 2, 2, 2, - 241, 242, 9, 8, 2, 2, 242, 102, 3, 2, 2, 2, 243, 244, 9, 9, 2, 2, 244, - 104, 3, 2, 2, 2, 245, 246, 9, 10, 2, 2, 246, 106, 3, 2, 2, 2, 247, 248, - 9, 11, 2, 2, 248, 108, 3, 2, 2, 2, 249, 250, 9, 12, 2, 2, 250, 110, 3, - 2, 2, 2, 251, 252, 9, 13, 2, 2, 252, 112, 3, 2, 2, 2, 253, 254, 9, 14, - 2, 2, 254, 114, 3, 2, 2, 2, 255, 256, 9, 15, 2, 2, 256, 116, 3, 2, 2, 2, - 257, 258, 9, 16, 2, 2, 258, 118, 3, 2, 2, 2, 259, 260, 9, 17, 2, 2, 260, - 120, 3, 2, 2, 2, 261, 262, 9, 18, 2, 2, 262, 122, 3, 2, 2, 2, 263, 264, - 9, 19, 2, 2, 264, 124, 3, 2, 2, 2, 265, 266, 9, 20, 2, 2, 266, 126, 3, - 2, 2, 2, 267, 268, 9, 21, 2, 2, 268, 128, 3, 2, 2, 2, 269, 270, 9, 22, - 2, 2, 270, 130, 3, 2, 2, 2, 271, 272, 9, 23, 2, 2, 272, 132, 3, 2, 2, 2, - 273, 274, 9, 24, 2, 2, 274, 134, 3, 2, 2, 2, 275, 276, 9, 25, 2, 2, 276, - 136, 3, 2, 2, 2, 277, 278, 9, 26, 2, 2, 278, 138, 3, 2, 2, 2, 279, 280, - 9, 27, 2, 2, 280, 140, 3, 2, 2, 2, 281, 282, 9, 28, 2, 2, 282, 142, 3, - 2, 2, 2, 3, 2, 2, -} - -var lexerDeserializer = antlr.NewATNDeserializer(nil) -var lexerAtn = lexerDeserializer.DeserializeFromUInt16(serializedLexerAtn) - -var lexerChannelNames = []string{ - "DEFAULT_TOKEN_CHANNEL", "HIDDEN", -} - -var lexerModeNames = []string{ - "DEFAULT_MODE", -} - -var lexerLiteralNames = []string{ - "", "'\u0000'", "", "'\t'", "'\n'", "'\u000B'", "'\u000C'", "'\r'", "", - "' '", "'!'", "'\"'", "'#'", "'$'", "'%'", "'&'", "'''", "'('", "')'", - "'*'", "'+'", "','", "'-'", "'.'", "'/'", "", "':'", "';'", "'<'", "'='", - "'>'", "'?'", "'@'", "'['", "'\\'", "']'", "'^'", "'_'", "'`'", "'{'", - "'|'", "'}'", "'~'", "'\u007F'", -} - -var lexerSymbolicNames = []string{ - "", "U_00", "U_01_08", "TAB", "LF", "U_0B", "U_0C", "CR", "U_0E_1F", "SP", - "Exclamation", "DQuote", "Hash", "Dollar", "Percent", "Ampersand", "SQuote", - "LParens", "RParens", "Asterisk", "Plus", "Comma", "Minus", "Period", "Slash", - "Digit", "Colon", "Semicolon", "Less", "Equal", "Greater", "Question", - "At", "LBracket", "Backslash", "RBracket", "Caret", "Underscore", "Backtick", - "LCurly", "Pipe", "RCurly", "Tilde", "Delete", "UTF8NonAscii", "A", "B", - "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", - "R", "S", "T", "U", "V", "W", "X", "Y", "Z", -} - -var lexerRuleNames = []string{ - "U_00", "U_01_08", "TAB", "LF", "U_0B", "U_0C", "CR", "U_0E_1F", "SP", - "Exclamation", "DQuote", "Hash", "Dollar", "Percent", "Ampersand", "SQuote", - "LParens", "RParens", "Asterisk", "Plus", "Comma", "Minus", "Period", "Slash", - "Digit", "Colon", "Semicolon", "Less", "Equal", "Greater", "Question", - "At", "LBracket", "Backslash", "RBracket", "Caret", "Underscore", "Backtick", - "LCurly", "Pipe", "RCurly", "Tilde", "Delete", "UTF8NonAscii", "A", "B", - "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", - "R", "S", "T", "U", "V", "W", "X", "Y", "Z", -} - -type RFC5322Lexer struct { - *antlr.BaseLexer - channelNames []string - modeNames []string - // TODO: EOF string -} - -var lexerDecisionToDFA = make([]*antlr.DFA, len(lexerAtn.DecisionToState)) - -func init() { - for index, ds := range lexerAtn.DecisionToState { - lexerDecisionToDFA[index] = antlr.NewDFA(ds, index) - } -} - -func NewRFC5322Lexer(input antlr.CharStream) *RFC5322Lexer { - - l := new(RFC5322Lexer) - - l.BaseLexer = antlr.NewBaseLexer(input) - l.Interpreter = antlr.NewLexerATNSimulator(l, lexerAtn, lexerDecisionToDFA, antlr.NewPredictionContextCache()) - - l.channelNames = lexerChannelNames - l.modeNames = lexerModeNames - l.RuleNames = lexerRuleNames - l.LiteralNames = lexerLiteralNames - l.SymbolicNames = lexerSymbolicNames - l.GrammarFileName = "RFC5322Lexer.g4" - // TODO: l.EOF = antlr.TokenEOF - - return l -} - -// RFC5322Lexer tokens. -const ( - RFC5322LexerU_00 = 1 - RFC5322LexerU_01_08 = 2 - RFC5322LexerTAB = 3 - RFC5322LexerLF = 4 - RFC5322LexerU_0B = 5 - RFC5322LexerU_0C = 6 - RFC5322LexerCR = 7 - RFC5322LexerU_0E_1F = 8 - RFC5322LexerSP = 9 - RFC5322LexerExclamation = 10 - RFC5322LexerDQuote = 11 - RFC5322LexerHash = 12 - RFC5322LexerDollar = 13 - RFC5322LexerPercent = 14 - RFC5322LexerAmpersand = 15 - RFC5322LexerSQuote = 16 - RFC5322LexerLParens = 17 - RFC5322LexerRParens = 18 - RFC5322LexerAsterisk = 19 - RFC5322LexerPlus = 20 - RFC5322LexerComma = 21 - RFC5322LexerMinus = 22 - RFC5322LexerPeriod = 23 - RFC5322LexerSlash = 24 - RFC5322LexerDigit = 25 - RFC5322LexerColon = 26 - RFC5322LexerSemicolon = 27 - RFC5322LexerLess = 28 - RFC5322LexerEqual = 29 - RFC5322LexerGreater = 30 - RFC5322LexerQuestion = 31 - RFC5322LexerAt = 32 - RFC5322LexerLBracket = 33 - RFC5322LexerBackslash = 34 - RFC5322LexerRBracket = 35 - RFC5322LexerCaret = 36 - RFC5322LexerUnderscore = 37 - RFC5322LexerBacktick = 38 - RFC5322LexerLCurly = 39 - RFC5322LexerPipe = 40 - RFC5322LexerRCurly = 41 - RFC5322LexerTilde = 42 - RFC5322LexerDelete = 43 - RFC5322LexerUTF8NonAscii = 44 - RFC5322LexerA = 45 - RFC5322LexerB = 46 - RFC5322LexerC = 47 - RFC5322LexerD = 48 - RFC5322LexerE = 49 - RFC5322LexerF = 50 - RFC5322LexerG = 51 - RFC5322LexerH = 52 - RFC5322LexerI = 53 - RFC5322LexerJ = 54 - RFC5322LexerK = 55 - RFC5322LexerL = 56 - RFC5322LexerM = 57 - RFC5322LexerN = 58 - RFC5322LexerO = 59 - RFC5322LexerP = 60 - RFC5322LexerQ = 61 - RFC5322LexerR = 62 - RFC5322LexerS = 63 - RFC5322LexerT = 64 - RFC5322LexerU = 65 - RFC5322LexerV = 66 - RFC5322LexerW = 67 - RFC5322LexerX = 68 - RFC5322LexerY = 69 - RFC5322LexerZ = 70 -) diff --git a/pkg/message/rfc5322/parser/rfc5322_parser.go b/pkg/message/rfc5322/parser/rfc5322_parser.go deleted file mode 100644 index bf46e015..00000000 --- a/pkg/message/rfc5322/parser/rfc5322_parser.go +++ /dev/null @@ -1,13326 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -// Code generated from RFC5322Parser.g4 by ANTLR 4.8. DO NOT EDIT. - -package parser // RFC5322Parser - -import ( - "fmt" - "reflect" - "strconv" - - "github.com/antlr/antlr4/runtime/Go/antlr" -) - -// Suppress unused import errors -var _ = fmt.Printf -var _ = reflect.Copy -var _ = strconv.Itoa - -var parserATN = []uint16{ - 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 72, 1014, - 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, - 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, - 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, - 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, - 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, - 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, - 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, - 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, - 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, - 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, - 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, - 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, - 4, 66, 9, 66, 4, 67, 9, 67, 3, 2, 3, 2, 5, 2, 137, 10, 2, 3, 3, 3, 3, 3, - 3, 5, 3, 142, 10, 3, 3, 4, 7, 4, 145, 10, 4, 12, 4, 14, 4, 148, 11, 4, - 3, 4, 5, 4, 151, 10, 4, 3, 4, 6, 4, 154, 10, 4, 13, 4, 14, 4, 155, 3, 4, - 5, 4, 159, 10, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, - 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, - 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, - 5, 5, 194, 10, 5, 3, 6, 3, 6, 3, 6, 5, 6, 199, 10, 6, 3, 7, 3, 7, 5, 7, - 203, 10, 7, 3, 7, 7, 7, 206, 10, 7, 12, 7, 14, 7, 209, 11, 7, 3, 7, 5, - 7, 212, 10, 7, 3, 7, 3, 7, 3, 8, 5, 8, 217, 10, 8, 3, 8, 6, 8, 220, 10, - 8, 13, 8, 14, 8, 221, 3, 8, 5, 8, 225, 10, 8, 3, 8, 5, 8, 228, 10, 8, 3, - 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, - 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 252, 10, - 9, 3, 10, 6, 10, 255, 10, 10, 13, 10, 14, 10, 256, 3, 11, 6, 11, 260, 10, - 11, 13, 11, 14, 11, 261, 3, 11, 3, 11, 6, 11, 266, 10, 11, 13, 11, 14, - 11, 267, 7, 11, 270, 10, 11, 12, 11, 14, 11, 273, 11, 11, 3, 11, 5, 11, - 276, 10, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, - 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, - 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, - 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 312, 10, 12, 3, 13, 3, 13, 5, 13, - 316, 10, 13, 3, 14, 5, 14, 319, 10, 14, 3, 14, 7, 14, 322, 10, 14, 12, - 14, 14, 14, 325, 11, 14, 3, 15, 3, 15, 3, 15, 5, 15, 330, 10, 15, 3, 15, - 3, 15, 3, 16, 5, 16, 335, 10, 16, 3, 16, 3, 16, 5, 16, 339, 10, 16, 3, - 16, 5, 16, 342, 10, 16, 3, 16, 3, 16, 5, 16, 346, 10, 16, 3, 16, 5, 16, - 349, 10, 16, 3, 16, 3, 16, 5, 16, 353, 10, 16, 3, 16, 5, 16, 356, 10, 16, - 3, 17, 3, 17, 3, 17, 5, 17, 361, 10, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, - 17, 3, 17, 3, 17, 3, 17, 5, 17, 371, 10, 17, 3, 17, 5, 17, 374, 10, 17, - 3, 17, 5, 17, 377, 10, 17, 3, 17, 3, 17, 3, 18, 5, 18, 382, 10, 18, 3, - 18, 3, 18, 5, 18, 386, 10, 18, 3, 18, 3, 18, 5, 18, 390, 10, 18, 5, 18, - 392, 10, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, - 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, - 3, 19, 3, 19, 5, 19, 415, 10, 19, 3, 20, 5, 20, 418, 10, 20, 3, 20, 3, - 20, 5, 20, 422, 10, 20, 3, 20, 3, 20, 5, 20, 426, 10, 20, 3, 20, 3, 20, - 5, 20, 430, 10, 20, 3, 20, 5, 20, 433, 10, 20, 5, 20, 435, 10, 20, 3, 21, - 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, - 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, - 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, - 21, 3, 21, 3, 21, 3, 21, 5, 21, 473, 10, 21, 3, 22, 3, 22, 3, 22, 3, 22, - 3, 22, 3, 22, 3, 22, 3, 22, 5, 22, 483, 10, 22, 3, 22, 3, 22, 3, 22, 5, - 22, 488, 10, 22, 5, 22, 490, 10, 22, 3, 23, 5, 23, 493, 10, 23, 3, 23, - 3, 23, 5, 23, 497, 10, 23, 3, 23, 5, 23, 500, 10, 23, 3, 23, 3, 23, 5, - 23, 504, 10, 23, 5, 23, 506, 10, 23, 3, 24, 3, 24, 3, 24, 5, 24, 511, 10, - 24, 3, 24, 3, 24, 3, 24, 5, 24, 516, 10, 24, 5, 24, 518, 10, 24, 3, 25, - 3, 25, 3, 25, 5, 25, 523, 10, 25, 3, 25, 3, 25, 3, 25, 5, 25, 528, 10, - 25, 5, 25, 530, 10, 25, 3, 26, 5, 26, 533, 10, 26, 3, 26, 3, 26, 3, 26, - 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 5, 27, 544, 10, 27, 3, 28, 3, - 28, 5, 28, 548, 10, 28, 3, 29, 3, 29, 5, 29, 552, 10, 29, 3, 30, 5, 30, - 555, 10, 30, 3, 30, 3, 30, 3, 31, 5, 31, 560, 10, 31, 3, 31, 3, 31, 5, - 31, 564, 10, 31, 3, 31, 3, 31, 5, 31, 568, 10, 31, 3, 31, 5, 31, 571, 10, - 31, 3, 32, 3, 32, 3, 32, 5, 32, 576, 10, 32, 3, 32, 3, 32, 5, 32, 580, - 10, 32, 3, 33, 6, 33, 583, 10, 33, 13, 33, 14, 33, 584, 3, 33, 3, 33, 3, - 33, 3, 33, 7, 33, 591, 10, 33, 12, 33, 14, 33, 594, 11, 33, 5, 33, 596, - 10, 33, 3, 34, 3, 34, 3, 34, 7, 34, 601, 10, 34, 12, 34, 14, 34, 604, 11, - 34, 3, 34, 5, 34, 607, 10, 34, 3, 35, 3, 35, 3, 35, 7, 35, 612, 10, 35, - 12, 35, 14, 35, 615, 11, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 5, 35, - 622, 10, 35, 3, 36, 3, 36, 3, 36, 5, 36, 627, 10, 36, 3, 37, 3, 37, 3, - 37, 3, 37, 3, 37, 5, 37, 634, 10, 37, 3, 38, 5, 38, 637, 10, 38, 3, 38, - 3, 38, 5, 38, 641, 10, 38, 3, 38, 5, 38, 644, 10, 38, 3, 38, 3, 38, 5, - 38, 648, 10, 38, 3, 38, 5, 38, 651, 10, 38, 3, 39, 6, 39, 654, 10, 39, - 13, 39, 14, 39, 655, 3, 40, 5, 40, 659, 10, 40, 3, 40, 3, 40, 5, 40, 663, - 10, 40, 3, 40, 5, 40, 666, 10, 40, 3, 40, 3, 40, 5, 40, 670, 10, 40, 3, - 40, 5, 40, 673, 10, 40, 3, 40, 3, 40, 5, 40, 677, 10, 40, 5, 40, 679, 10, - 40, 3, 41, 3, 41, 5, 41, 683, 10, 41, 3, 41, 7, 41, 686, 10, 41, 12, 41, - 14, 41, 689, 11, 41, 3, 41, 5, 41, 692, 10, 41, 3, 41, 3, 41, 3, 42, 3, - 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, - 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, - 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 5, 42, - 728, 10, 42, 3, 43, 3, 43, 3, 44, 3, 44, 3, 45, 3, 45, 3, 46, 3, 46, 3, - 46, 3, 46, 3, 46, 5, 46, 741, 10, 46, 3, 47, 6, 47, 744, 10, 47, 13, 47, - 14, 47, 745, 3, 47, 3, 47, 6, 47, 750, 10, 47, 13, 47, 14, 47, 751, 3, - 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, - 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, - 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, - 5, 48, 786, 10, 48, 3, 49, 5, 49, 789, 10, 49, 3, 49, 3, 49, 3, 49, 3, - 49, 3, 49, 5, 49, 796, 10, 49, 3, 50, 3, 50, 3, 50, 3, 51, 3, 51, 7, 51, - 803, 10, 51, 12, 51, 14, 51, 806, 11, 51, 3, 51, 3, 51, 3, 51, 3, 51, 5, - 51, 812, 10, 51, 3, 51, 3, 51, 5, 51, 816, 10, 51, 7, 51, 818, 10, 51, - 12, 51, 14, 51, 821, 11, 51, 3, 52, 5, 52, 824, 10, 52, 3, 52, 7, 52, 827, - 10, 52, 12, 52, 14, 52, 830, 11, 52, 3, 52, 3, 52, 3, 52, 3, 52, 5, 52, - 836, 10, 52, 7, 52, 838, 10, 52, 12, 52, 14, 52, 841, 11, 52, 3, 53, 5, - 53, 844, 10, 53, 3, 53, 7, 53, 847, 10, 53, 12, 53, 14, 53, 850, 11, 53, - 3, 53, 3, 53, 3, 53, 3, 53, 5, 53, 856, 10, 53, 7, 53, 858, 10, 53, 12, - 53, 14, 53, 861, 11, 53, 3, 54, 5, 54, 864, 10, 54, 3, 54, 6, 54, 867, - 10, 54, 13, 54, 14, 54, 868, 3, 54, 5, 54, 872, 10, 54, 3, 55, 3, 55, 3, - 55, 7, 55, 877, 10, 55, 12, 55, 14, 55, 880, 11, 55, 3, 56, 3, 56, 3, 56, - 7, 56, 885, 10, 56, 12, 56, 14, 56, 888, 11, 56, 3, 57, 3, 57, 3, 57, 3, - 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 58, 3, 58, 3, 59, 3, 59, - 3, 60, 6, 60, 905, 10, 60, 13, 60, 14, 60, 906, 3, 61, 3, 61, 3, 61, 3, - 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, - 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 5, 61, 928, 10, 61, 3, 62, 6, 62, 931, - 10, 62, 13, 62, 14, 62, 932, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, - 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, - 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, - 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 5, 63, 968, 10, 63, 3, 64, 3, - 64, 3, 64, 3, 65, 3, 65, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, - 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, - 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, - 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 5, 66, 1010, 10, 66, 3, - 67, 3, 67, 3, 67, 2, 2, 68, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, - 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, - 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, - 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, - 128, 130, 132, 2, 6, 4, 2, 22, 22, 24, 24, 6, 2, 4, 4, 7, 8, 10, 10, 45, - 45, 4, 2, 5, 5, 11, 11, 3, 2, 47, 72, 2, 1306, 2, 136, 3, 2, 2, 2, 4, 141, - 3, 2, 2, 2, 6, 158, 3, 2, 2, 2, 8, 193, 3, 2, 2, 2, 10, 198, 3, 2, 2, 2, - 12, 200, 3, 2, 2, 2, 14, 227, 3, 2, 2, 2, 16, 251, 3, 2, 2, 2, 18, 254, - 3, 2, 2, 2, 20, 259, 3, 2, 2, 2, 22, 311, 3, 2, 2, 2, 24, 315, 3, 2, 2, - 2, 26, 323, 3, 2, 2, 2, 28, 326, 3, 2, 2, 2, 30, 355, 3, 2, 2, 2, 32, 360, - 3, 2, 2, 2, 34, 391, 3, 2, 2, 2, 36, 414, 3, 2, 2, 2, 38, 434, 3, 2, 2, - 2, 40, 472, 3, 2, 2, 2, 42, 489, 3, 2, 2, 2, 44, 505, 3, 2, 2, 2, 46, 517, - 3, 2, 2, 2, 48, 529, 3, 2, 2, 2, 50, 532, 3, 2, 2, 2, 52, 543, 3, 2, 2, - 2, 54, 547, 3, 2, 2, 2, 56, 551, 3, 2, 2, 2, 58, 554, 3, 2, 2, 2, 60, 570, - 3, 2, 2, 2, 62, 572, 3, 2, 2, 2, 64, 595, 3, 2, 2, 2, 66, 606, 3, 2, 2, - 2, 68, 621, 3, 2, 2, 2, 70, 626, 3, 2, 2, 2, 72, 628, 3, 2, 2, 2, 74, 650, - 3, 2, 2, 2, 76, 653, 3, 2, 2, 2, 78, 678, 3, 2, 2, 2, 80, 680, 3, 2, 2, - 2, 82, 727, 3, 2, 2, 2, 84, 729, 3, 2, 2, 2, 86, 731, 3, 2, 2, 2, 88, 733, - 3, 2, 2, 2, 90, 735, 3, 2, 2, 2, 92, 743, 3, 2, 2, 2, 94, 785, 3, 2, 2, - 2, 96, 788, 3, 2, 2, 2, 98, 797, 3, 2, 2, 2, 100, 804, 3, 2, 2, 2, 102, - 828, 3, 2, 2, 2, 104, 848, 3, 2, 2, 2, 106, 866, 3, 2, 2, 2, 108, 873, - 3, 2, 2, 2, 110, 881, 3, 2, 2, 2, 112, 889, 3, 2, 2, 2, 114, 899, 3, 2, - 2, 2, 116, 901, 3, 2, 2, 2, 118, 904, 3, 2, 2, 2, 120, 927, 3, 2, 2, 2, - 122, 930, 3, 2, 2, 2, 124, 967, 3, 2, 2, 2, 126, 969, 3, 2, 2, 2, 128, - 972, 3, 2, 2, 2, 130, 1009, 3, 2, 2, 2, 132, 1011, 3, 2, 2, 2, 134, 137, - 5, 130, 66, 2, 135, 137, 5, 128, 65, 2, 136, 134, 3, 2, 2, 2, 136, 135, - 3, 2, 2, 2, 137, 3, 3, 2, 2, 2, 138, 139, 7, 36, 2, 2, 139, 142, 5, 2, - 2, 2, 140, 142, 5, 90, 46, 2, 141, 138, 3, 2, 2, 2, 141, 140, 3, 2, 2, - 2, 142, 5, 3, 2, 2, 2, 143, 145, 5, 128, 65, 2, 144, 143, 3, 2, 2, 2, 145, - 148, 3, 2, 2, 2, 146, 144, 3, 2, 2, 2, 146, 147, 3, 2, 2, 2, 147, 149, - 3, 2, 2, 2, 148, 146, 3, 2, 2, 2, 149, 151, 5, 126, 64, 2, 150, 146, 3, - 2, 2, 2, 150, 151, 3, 2, 2, 2, 151, 153, 3, 2, 2, 2, 152, 154, 5, 128, - 65, 2, 153, 152, 3, 2, 2, 2, 154, 155, 3, 2, 2, 2, 155, 153, 3, 2, 2, 2, - 155, 156, 3, 2, 2, 2, 156, 159, 3, 2, 2, 2, 157, 159, 5, 92, 47, 2, 158, - 150, 3, 2, 2, 2, 158, 157, 3, 2, 2, 2, 159, 7, 3, 2, 2, 2, 160, 194, 5, - 132, 67, 2, 161, 194, 7, 12, 2, 2, 162, 194, 7, 13, 2, 2, 163, 194, 7, - 14, 2, 2, 164, 194, 7, 15, 2, 2, 165, 194, 7, 16, 2, 2, 166, 194, 7, 17, - 2, 2, 167, 194, 7, 18, 2, 2, 168, 194, 7, 21, 2, 2, 169, 194, 7, 22, 2, - 2, 170, 194, 7, 23, 2, 2, 171, 194, 7, 24, 2, 2, 172, 194, 7, 25, 2, 2, - 173, 194, 7, 26, 2, 2, 174, 194, 7, 27, 2, 2, 175, 194, 7, 28, 2, 2, 176, - 194, 7, 29, 2, 2, 177, 194, 7, 30, 2, 2, 178, 194, 7, 31, 2, 2, 179, 194, - 7, 32, 2, 2, 180, 194, 7, 33, 2, 2, 181, 194, 7, 34, 2, 2, 182, 194, 7, - 35, 2, 2, 183, 194, 7, 37, 2, 2, 184, 194, 7, 38, 2, 2, 185, 194, 7, 39, - 2, 2, 186, 194, 7, 40, 2, 2, 187, 194, 7, 41, 2, 2, 188, 194, 7, 42, 2, - 2, 189, 194, 7, 43, 2, 2, 190, 194, 7, 44, 2, 2, 191, 194, 5, 86, 44, 2, - 192, 194, 7, 46, 2, 2, 193, 160, 3, 2, 2, 2, 193, 161, 3, 2, 2, 2, 193, - 162, 3, 2, 2, 2, 193, 163, 3, 2, 2, 2, 193, 164, 3, 2, 2, 2, 193, 165, - 3, 2, 2, 2, 193, 166, 3, 2, 2, 2, 193, 167, 3, 2, 2, 2, 193, 168, 3, 2, - 2, 2, 193, 169, 3, 2, 2, 2, 193, 170, 3, 2, 2, 2, 193, 171, 3, 2, 2, 2, - 193, 172, 3, 2, 2, 2, 193, 173, 3, 2, 2, 2, 193, 174, 3, 2, 2, 2, 193, - 175, 3, 2, 2, 2, 193, 176, 3, 2, 2, 2, 193, 177, 3, 2, 2, 2, 193, 178, - 3, 2, 2, 2, 193, 179, 3, 2, 2, 2, 193, 180, 3, 2, 2, 2, 193, 181, 3, 2, - 2, 2, 193, 182, 3, 2, 2, 2, 193, 183, 3, 2, 2, 2, 193, 184, 3, 2, 2, 2, - 193, 185, 3, 2, 2, 2, 193, 186, 3, 2, 2, 2, 193, 187, 3, 2, 2, 2, 193, - 188, 3, 2, 2, 2, 193, 189, 3, 2, 2, 2, 193, 190, 3, 2, 2, 2, 193, 191, - 3, 2, 2, 2, 193, 192, 3, 2, 2, 2, 194, 9, 3, 2, 2, 2, 195, 199, 5, 8, 5, - 2, 196, 199, 5, 4, 3, 2, 197, 199, 5, 12, 7, 2, 198, 195, 3, 2, 2, 2, 198, - 196, 3, 2, 2, 2, 198, 197, 3, 2, 2, 2, 199, 11, 3, 2, 2, 2, 200, 207, 7, - 19, 2, 2, 201, 203, 5, 6, 4, 2, 202, 201, 3, 2, 2, 2, 202, 203, 3, 2, 2, - 2, 203, 204, 3, 2, 2, 2, 204, 206, 5, 10, 6, 2, 205, 202, 3, 2, 2, 2, 206, - 209, 3, 2, 2, 2, 207, 205, 3, 2, 2, 2, 207, 208, 3, 2, 2, 2, 208, 211, - 3, 2, 2, 2, 209, 207, 3, 2, 2, 2, 210, 212, 5, 6, 4, 2, 211, 210, 3, 2, - 2, 2, 211, 212, 3, 2, 2, 2, 212, 213, 3, 2, 2, 2, 213, 214, 7, 20, 2, 2, - 214, 13, 3, 2, 2, 2, 215, 217, 5, 6, 4, 2, 216, 215, 3, 2, 2, 2, 216, 217, - 3, 2, 2, 2, 217, 218, 3, 2, 2, 2, 218, 220, 5, 12, 7, 2, 219, 216, 3, 2, - 2, 2, 220, 221, 3, 2, 2, 2, 221, 219, 3, 2, 2, 2, 221, 222, 3, 2, 2, 2, - 222, 224, 3, 2, 2, 2, 223, 225, 5, 6, 4, 2, 224, 223, 3, 2, 2, 2, 224, - 225, 3, 2, 2, 2, 225, 228, 3, 2, 2, 2, 226, 228, 5, 6, 4, 2, 227, 219, - 3, 2, 2, 2, 227, 226, 3, 2, 2, 2, 228, 15, 3, 2, 2, 2, 229, 252, 5, 132, - 67, 2, 230, 252, 7, 27, 2, 2, 231, 252, 7, 12, 2, 2, 232, 252, 7, 14, 2, - 2, 233, 252, 7, 15, 2, 2, 234, 252, 7, 16, 2, 2, 235, 252, 7, 17, 2, 2, - 236, 252, 7, 18, 2, 2, 237, 252, 7, 21, 2, 2, 238, 252, 7, 22, 2, 2, 239, - 252, 7, 24, 2, 2, 240, 252, 7, 26, 2, 2, 241, 252, 7, 31, 2, 2, 242, 252, - 7, 33, 2, 2, 243, 252, 7, 38, 2, 2, 244, 252, 7, 39, 2, 2, 245, 252, 7, - 40, 2, 2, 246, 252, 7, 41, 2, 2, 247, 252, 7, 42, 2, 2, 248, 252, 7, 43, - 2, 2, 249, 252, 7, 44, 2, 2, 250, 252, 7, 46, 2, 2, 251, 229, 3, 2, 2, - 2, 251, 230, 3, 2, 2, 2, 251, 231, 3, 2, 2, 2, 251, 232, 3, 2, 2, 2, 251, - 233, 3, 2, 2, 2, 251, 234, 3, 2, 2, 2, 251, 235, 3, 2, 2, 2, 251, 236, - 3, 2, 2, 2, 251, 237, 3, 2, 2, 2, 251, 238, 3, 2, 2, 2, 251, 239, 3, 2, - 2, 2, 251, 240, 3, 2, 2, 2, 251, 241, 3, 2, 2, 2, 251, 242, 3, 2, 2, 2, - 251, 243, 3, 2, 2, 2, 251, 244, 3, 2, 2, 2, 251, 245, 3, 2, 2, 2, 251, - 246, 3, 2, 2, 2, 251, 247, 3, 2, 2, 2, 251, 248, 3, 2, 2, 2, 251, 249, - 3, 2, 2, 2, 251, 250, 3, 2, 2, 2, 252, 17, 3, 2, 2, 2, 253, 255, 5, 16, - 9, 2, 254, 253, 3, 2, 2, 2, 255, 256, 3, 2, 2, 2, 256, 254, 3, 2, 2, 2, - 256, 257, 3, 2, 2, 2, 257, 19, 3, 2, 2, 2, 258, 260, 5, 16, 9, 2, 259, - 258, 3, 2, 2, 2, 260, 261, 3, 2, 2, 2, 261, 259, 3, 2, 2, 2, 261, 262, - 3, 2, 2, 2, 262, 271, 3, 2, 2, 2, 263, 265, 7, 25, 2, 2, 264, 266, 5, 16, - 9, 2, 265, 264, 3, 2, 2, 2, 266, 267, 3, 2, 2, 2, 267, 265, 3, 2, 2, 2, - 267, 268, 3, 2, 2, 2, 268, 270, 3, 2, 2, 2, 269, 263, 3, 2, 2, 2, 270, - 273, 3, 2, 2, 2, 271, 269, 3, 2, 2, 2, 271, 272, 3, 2, 2, 2, 272, 275, - 3, 2, 2, 2, 273, 271, 3, 2, 2, 2, 274, 276, 7, 25, 2, 2, 275, 274, 3, 2, - 2, 2, 275, 276, 3, 2, 2, 2, 276, 21, 3, 2, 2, 2, 277, 312, 5, 132, 67, - 2, 278, 312, 7, 12, 2, 2, 279, 312, 7, 14, 2, 2, 280, 312, 7, 15, 2, 2, - 281, 312, 7, 16, 2, 2, 282, 312, 7, 17, 2, 2, 283, 312, 7, 18, 2, 2, 284, - 312, 7, 19, 2, 2, 285, 312, 7, 20, 2, 2, 286, 312, 7, 21, 2, 2, 287, 312, - 7, 22, 2, 2, 288, 312, 7, 23, 2, 2, 289, 312, 7, 24, 2, 2, 290, 312, 7, - 25, 2, 2, 291, 312, 7, 26, 2, 2, 292, 312, 7, 27, 2, 2, 293, 312, 7, 28, - 2, 2, 294, 312, 7, 29, 2, 2, 295, 312, 7, 30, 2, 2, 296, 312, 7, 31, 2, - 2, 297, 312, 7, 32, 2, 2, 298, 312, 7, 33, 2, 2, 299, 312, 7, 34, 2, 2, - 300, 312, 7, 35, 2, 2, 301, 312, 7, 37, 2, 2, 302, 312, 7, 38, 2, 2, 303, - 312, 7, 39, 2, 2, 304, 312, 7, 40, 2, 2, 305, 312, 7, 41, 2, 2, 306, 312, - 7, 42, 2, 2, 307, 312, 7, 43, 2, 2, 308, 312, 7, 44, 2, 2, 309, 312, 5, - 88, 45, 2, 310, 312, 7, 46, 2, 2, 311, 277, 3, 2, 2, 2, 311, 278, 3, 2, - 2, 2, 311, 279, 3, 2, 2, 2, 311, 280, 3, 2, 2, 2, 311, 281, 3, 2, 2, 2, - 311, 282, 3, 2, 2, 2, 311, 283, 3, 2, 2, 2, 311, 284, 3, 2, 2, 2, 311, - 285, 3, 2, 2, 2, 311, 286, 3, 2, 2, 2, 311, 287, 3, 2, 2, 2, 311, 288, - 3, 2, 2, 2, 311, 289, 3, 2, 2, 2, 311, 290, 3, 2, 2, 2, 311, 291, 3, 2, - 2, 2, 311, 292, 3, 2, 2, 2, 311, 293, 3, 2, 2, 2, 311, 294, 3, 2, 2, 2, - 311, 295, 3, 2, 2, 2, 311, 296, 3, 2, 2, 2, 311, 297, 3, 2, 2, 2, 311, - 298, 3, 2, 2, 2, 311, 299, 3, 2, 2, 2, 311, 300, 3, 2, 2, 2, 311, 301, - 3, 2, 2, 2, 311, 302, 3, 2, 2, 2, 311, 303, 3, 2, 2, 2, 311, 304, 3, 2, - 2, 2, 311, 305, 3, 2, 2, 2, 311, 306, 3, 2, 2, 2, 311, 307, 3, 2, 2, 2, - 311, 308, 3, 2, 2, 2, 311, 309, 3, 2, 2, 2, 311, 310, 3, 2, 2, 2, 312, - 23, 3, 2, 2, 2, 313, 316, 5, 22, 12, 2, 314, 316, 5, 4, 3, 2, 315, 313, - 3, 2, 2, 2, 315, 314, 3, 2, 2, 2, 316, 25, 3, 2, 2, 2, 317, 319, 5, 6, - 4, 2, 318, 317, 3, 2, 2, 2, 318, 319, 3, 2, 2, 2, 319, 320, 3, 2, 2, 2, - 320, 322, 5, 24, 13, 2, 321, 318, 3, 2, 2, 2, 322, 325, 3, 2, 2, 2, 323, - 321, 3, 2, 2, 2, 323, 324, 3, 2, 2, 2, 324, 27, 3, 2, 2, 2, 325, 323, 3, - 2, 2, 2, 326, 327, 7, 13, 2, 2, 327, 329, 5, 26, 14, 2, 328, 330, 5, 6, - 4, 2, 329, 328, 3, 2, 2, 2, 329, 330, 3, 2, 2, 2, 330, 331, 3, 2, 2, 2, - 331, 332, 7, 13, 2, 2, 332, 29, 3, 2, 2, 2, 333, 335, 5, 14, 8, 2, 334, - 333, 3, 2, 2, 2, 334, 335, 3, 2, 2, 2, 335, 336, 3, 2, 2, 2, 336, 338, - 5, 112, 57, 2, 337, 339, 5, 14, 8, 2, 338, 337, 3, 2, 2, 2, 338, 339, 3, - 2, 2, 2, 339, 356, 3, 2, 2, 2, 340, 342, 5, 14, 8, 2, 341, 340, 3, 2, 2, - 2, 341, 342, 3, 2, 2, 2, 342, 343, 3, 2, 2, 2, 343, 345, 5, 18, 10, 2, - 344, 346, 5, 14, 8, 2, 345, 344, 3, 2, 2, 2, 345, 346, 3, 2, 2, 2, 346, - 356, 3, 2, 2, 2, 347, 349, 5, 14, 8, 2, 348, 347, 3, 2, 2, 2, 348, 349, - 3, 2, 2, 2, 349, 350, 3, 2, 2, 2, 350, 352, 5, 28, 15, 2, 351, 353, 5, - 14, 8, 2, 352, 351, 3, 2, 2, 2, 352, 353, 3, 2, 2, 2, 353, 356, 3, 2, 2, - 2, 354, 356, 7, 34, 2, 2, 355, 334, 3, 2, 2, 2, 355, 341, 3, 2, 2, 2, 355, - 348, 3, 2, 2, 2, 355, 354, 3, 2, 2, 2, 356, 31, 3, 2, 2, 2, 357, 358, 5, - 34, 18, 2, 358, 359, 7, 23, 2, 2, 359, 361, 3, 2, 2, 2, 360, 357, 3, 2, - 2, 2, 360, 361, 3, 2, 2, 2, 361, 362, 3, 2, 2, 2, 362, 363, 5, 38, 20, - 2, 363, 364, 5, 40, 21, 2, 364, 365, 5, 42, 22, 2, 365, 366, 5, 44, 23, - 2, 366, 367, 7, 28, 2, 2, 367, 370, 5, 46, 24, 2, 368, 369, 7, 28, 2, 2, - 369, 371, 5, 48, 25, 2, 370, 368, 3, 2, 2, 2, 370, 371, 3, 2, 2, 2, 371, - 373, 3, 2, 2, 2, 372, 374, 5, 52, 27, 2, 373, 372, 3, 2, 2, 2, 373, 374, - 3, 2, 2, 2, 374, 376, 3, 2, 2, 2, 375, 377, 5, 14, 8, 2, 376, 375, 3, 2, - 2, 2, 376, 377, 3, 2, 2, 2, 377, 378, 3, 2, 2, 2, 378, 379, 7, 2, 2, 3, - 379, 33, 3, 2, 2, 2, 380, 382, 5, 6, 4, 2, 381, 380, 3, 2, 2, 2, 381, 382, - 3, 2, 2, 2, 382, 383, 3, 2, 2, 2, 383, 392, 5, 36, 19, 2, 384, 386, 5, - 14, 8, 2, 385, 384, 3, 2, 2, 2, 385, 386, 3, 2, 2, 2, 386, 387, 3, 2, 2, - 2, 387, 389, 5, 36, 19, 2, 388, 390, 5, 14, 8, 2, 389, 388, 3, 2, 2, 2, - 389, 390, 3, 2, 2, 2, 390, 392, 3, 2, 2, 2, 391, 381, 3, 2, 2, 2, 391, - 385, 3, 2, 2, 2, 392, 35, 3, 2, 2, 2, 393, 394, 7, 59, 2, 2, 394, 395, - 7, 61, 2, 2, 395, 415, 7, 60, 2, 2, 396, 397, 7, 66, 2, 2, 397, 398, 7, - 67, 2, 2, 398, 415, 7, 51, 2, 2, 399, 400, 7, 69, 2, 2, 400, 401, 7, 51, - 2, 2, 401, 415, 7, 50, 2, 2, 402, 403, 7, 66, 2, 2, 403, 404, 7, 54, 2, - 2, 404, 415, 7, 67, 2, 2, 405, 406, 7, 52, 2, 2, 406, 407, 7, 64, 2, 2, - 407, 415, 7, 55, 2, 2, 408, 409, 7, 65, 2, 2, 409, 410, 7, 47, 2, 2, 410, - 415, 7, 66, 2, 2, 411, 412, 7, 65, 2, 2, 412, 413, 7, 67, 2, 2, 413, 415, - 7, 60, 2, 2, 414, 393, 3, 2, 2, 2, 414, 396, 3, 2, 2, 2, 414, 399, 3, 2, - 2, 2, 414, 402, 3, 2, 2, 2, 414, 405, 3, 2, 2, 2, 414, 408, 3, 2, 2, 2, - 414, 411, 3, 2, 2, 2, 415, 37, 3, 2, 2, 2, 416, 418, 5, 6, 4, 2, 417, 416, - 3, 2, 2, 2, 417, 418, 3, 2, 2, 2, 418, 419, 3, 2, 2, 2, 419, 421, 7, 27, - 2, 2, 420, 422, 7, 27, 2, 2, 421, 420, 3, 2, 2, 2, 421, 422, 3, 2, 2, 2, - 422, 423, 3, 2, 2, 2, 423, 435, 5, 6, 4, 2, 424, 426, 5, 14, 8, 2, 425, - 424, 3, 2, 2, 2, 425, 426, 3, 2, 2, 2, 426, 427, 3, 2, 2, 2, 427, 429, - 7, 27, 2, 2, 428, 430, 7, 27, 2, 2, 429, 428, 3, 2, 2, 2, 429, 430, 3, - 2, 2, 2, 430, 432, 3, 2, 2, 2, 431, 433, 5, 14, 8, 2, 432, 431, 3, 2, 2, - 2, 432, 433, 3, 2, 2, 2, 433, 435, 3, 2, 2, 2, 434, 417, 3, 2, 2, 2, 434, - 425, 3, 2, 2, 2, 435, 39, 3, 2, 2, 2, 436, 437, 7, 56, 2, 2, 437, 438, - 7, 47, 2, 2, 438, 473, 7, 60, 2, 2, 439, 440, 7, 52, 2, 2, 440, 441, 7, - 51, 2, 2, 441, 473, 7, 48, 2, 2, 442, 443, 7, 59, 2, 2, 443, 444, 7, 47, - 2, 2, 444, 473, 7, 64, 2, 2, 445, 446, 7, 47, 2, 2, 446, 447, 7, 62, 2, - 2, 447, 473, 7, 64, 2, 2, 448, 449, 7, 59, 2, 2, 449, 450, 7, 47, 2, 2, - 450, 473, 7, 71, 2, 2, 451, 452, 7, 56, 2, 2, 452, 453, 7, 67, 2, 2, 453, - 473, 7, 60, 2, 2, 454, 455, 7, 56, 2, 2, 455, 456, 7, 67, 2, 2, 456, 473, - 7, 58, 2, 2, 457, 458, 7, 47, 2, 2, 458, 459, 7, 67, 2, 2, 459, 473, 7, - 53, 2, 2, 460, 461, 7, 65, 2, 2, 461, 462, 7, 51, 2, 2, 462, 473, 7, 62, - 2, 2, 463, 464, 7, 61, 2, 2, 464, 465, 7, 49, 2, 2, 465, 473, 7, 66, 2, - 2, 466, 467, 7, 60, 2, 2, 467, 468, 7, 61, 2, 2, 468, 473, 7, 68, 2, 2, - 469, 470, 7, 50, 2, 2, 470, 471, 7, 51, 2, 2, 471, 473, 7, 49, 2, 2, 472, - 436, 3, 2, 2, 2, 472, 439, 3, 2, 2, 2, 472, 442, 3, 2, 2, 2, 472, 445, - 3, 2, 2, 2, 472, 448, 3, 2, 2, 2, 472, 451, 3, 2, 2, 2, 472, 454, 3, 2, - 2, 2, 472, 457, 3, 2, 2, 2, 472, 460, 3, 2, 2, 2, 472, 463, 3, 2, 2, 2, - 472, 466, 3, 2, 2, 2, 472, 469, 3, 2, 2, 2, 473, 41, 3, 2, 2, 2, 474, 475, - 5, 6, 4, 2, 475, 476, 7, 27, 2, 2, 476, 477, 7, 27, 2, 2, 477, 478, 7, - 27, 2, 2, 478, 479, 7, 27, 2, 2, 479, 480, 5, 6, 4, 2, 480, 490, 3, 2, - 2, 2, 481, 483, 5, 14, 8, 2, 482, 481, 3, 2, 2, 2, 482, 483, 3, 2, 2, 2, - 483, 484, 3, 2, 2, 2, 484, 485, 7, 27, 2, 2, 485, 487, 7, 27, 2, 2, 486, - 488, 5, 14, 8, 2, 487, 486, 3, 2, 2, 2, 487, 488, 3, 2, 2, 2, 488, 490, - 3, 2, 2, 2, 489, 474, 3, 2, 2, 2, 489, 482, 3, 2, 2, 2, 490, 43, 3, 2, - 2, 2, 491, 493, 7, 27, 2, 2, 492, 491, 3, 2, 2, 2, 492, 493, 3, 2, 2, 2, - 493, 494, 3, 2, 2, 2, 494, 506, 7, 27, 2, 2, 495, 497, 5, 14, 8, 2, 496, - 495, 3, 2, 2, 2, 496, 497, 3, 2, 2, 2, 497, 499, 3, 2, 2, 2, 498, 500, - 7, 27, 2, 2, 499, 498, 3, 2, 2, 2, 499, 500, 3, 2, 2, 2, 500, 501, 3, 2, - 2, 2, 501, 503, 7, 27, 2, 2, 502, 504, 5, 14, 8, 2, 503, 502, 3, 2, 2, - 2, 503, 504, 3, 2, 2, 2, 504, 506, 3, 2, 2, 2, 505, 492, 3, 2, 2, 2, 505, - 496, 3, 2, 2, 2, 506, 45, 3, 2, 2, 2, 507, 508, 7, 27, 2, 2, 508, 518, - 7, 27, 2, 2, 509, 511, 5, 14, 8, 2, 510, 509, 3, 2, 2, 2, 510, 511, 3, - 2, 2, 2, 511, 512, 3, 2, 2, 2, 512, 513, 7, 27, 2, 2, 513, 515, 7, 27, - 2, 2, 514, 516, 5, 14, 8, 2, 515, 514, 3, 2, 2, 2, 515, 516, 3, 2, 2, 2, - 516, 518, 3, 2, 2, 2, 517, 507, 3, 2, 2, 2, 517, 510, 3, 2, 2, 2, 518, - 47, 3, 2, 2, 2, 519, 520, 7, 27, 2, 2, 520, 530, 7, 27, 2, 2, 521, 523, - 5, 14, 8, 2, 522, 521, 3, 2, 2, 2, 522, 523, 3, 2, 2, 2, 523, 524, 3, 2, - 2, 2, 524, 525, 7, 27, 2, 2, 525, 527, 7, 27, 2, 2, 526, 528, 5, 14, 8, - 2, 527, 526, 3, 2, 2, 2, 527, 528, 3, 2, 2, 2, 528, 530, 3, 2, 2, 2, 529, - 519, 3, 2, 2, 2, 529, 522, 3, 2, 2, 2, 530, 49, 3, 2, 2, 2, 531, 533, 9, - 2, 2, 2, 532, 531, 3, 2, 2, 2, 532, 533, 3, 2, 2, 2, 533, 534, 3, 2, 2, - 2, 534, 535, 7, 27, 2, 2, 535, 536, 7, 27, 2, 2, 536, 537, 7, 27, 2, 2, - 537, 538, 7, 27, 2, 2, 538, 51, 3, 2, 2, 2, 539, 540, 5, 6, 4, 2, 540, - 541, 5, 50, 26, 2, 541, 544, 3, 2, 2, 2, 542, 544, 5, 94, 48, 2, 543, 539, - 3, 2, 2, 2, 543, 542, 3, 2, 2, 2, 544, 53, 3, 2, 2, 2, 545, 548, 5, 56, - 29, 2, 546, 548, 5, 62, 32, 2, 547, 545, 3, 2, 2, 2, 547, 546, 3, 2, 2, - 2, 548, 55, 3, 2, 2, 2, 549, 552, 5, 58, 30, 2, 550, 552, 5, 72, 37, 2, - 551, 549, 3, 2, 2, 2, 551, 550, 3, 2, 2, 2, 552, 57, 3, 2, 2, 2, 553, 555, - 5, 64, 33, 2, 554, 553, 3, 2, 2, 2, 554, 555, 3, 2, 2, 2, 555, 556, 3, - 2, 2, 2, 556, 557, 5, 60, 31, 2, 557, 59, 3, 2, 2, 2, 558, 560, 5, 14, - 8, 2, 559, 558, 3, 2, 2, 2, 559, 560, 3, 2, 2, 2, 560, 561, 3, 2, 2, 2, - 561, 563, 7, 30, 2, 2, 562, 564, 5, 72, 37, 2, 563, 562, 3, 2, 2, 2, 563, - 564, 3, 2, 2, 2, 564, 565, 3, 2, 2, 2, 565, 567, 7, 32, 2, 2, 566, 568, - 5, 14, 8, 2, 567, 566, 3, 2, 2, 2, 567, 568, 3, 2, 2, 2, 568, 571, 3, 2, - 2, 2, 569, 571, 5, 96, 49, 2, 570, 559, 3, 2, 2, 2, 570, 569, 3, 2, 2, - 2, 571, 61, 3, 2, 2, 2, 572, 573, 5, 64, 33, 2, 573, 575, 7, 28, 2, 2, - 574, 576, 5, 70, 36, 2, 575, 574, 3, 2, 2, 2, 575, 576, 3, 2, 2, 2, 576, - 577, 3, 2, 2, 2, 577, 579, 7, 29, 2, 2, 578, 580, 5, 14, 8, 2, 579, 578, - 3, 2, 2, 2, 579, 580, 3, 2, 2, 2, 580, 63, 3, 2, 2, 2, 581, 583, 5, 30, - 16, 2, 582, 581, 3, 2, 2, 2, 583, 584, 3, 2, 2, 2, 584, 582, 3, 2, 2, 2, - 584, 585, 3, 2, 2, 2, 585, 596, 3, 2, 2, 2, 586, 592, 5, 30, 16, 2, 587, - 591, 5, 30, 16, 2, 588, 591, 7, 25, 2, 2, 589, 591, 5, 14, 8, 2, 590, 587, - 3, 2, 2, 2, 590, 588, 3, 2, 2, 2, 590, 589, 3, 2, 2, 2, 591, 594, 3, 2, - 2, 2, 592, 590, 3, 2, 2, 2, 592, 593, 3, 2, 2, 2, 593, 596, 3, 2, 2, 2, - 594, 592, 3, 2, 2, 2, 595, 582, 3, 2, 2, 2, 595, 586, 3, 2, 2, 2, 596, - 65, 3, 2, 2, 2, 597, 602, 5, 56, 29, 2, 598, 599, 7, 23, 2, 2, 599, 601, - 5, 56, 29, 2, 600, 598, 3, 2, 2, 2, 601, 604, 3, 2, 2, 2, 602, 600, 3, - 2, 2, 2, 602, 603, 3, 2, 2, 2, 603, 607, 3, 2, 2, 2, 604, 602, 3, 2, 2, - 2, 605, 607, 5, 102, 52, 2, 606, 597, 3, 2, 2, 2, 606, 605, 3, 2, 2, 2, - 607, 67, 3, 2, 2, 2, 608, 613, 5, 54, 28, 2, 609, 610, 7, 23, 2, 2, 610, - 612, 5, 54, 28, 2, 611, 609, 3, 2, 2, 2, 612, 615, 3, 2, 2, 2, 613, 611, - 3, 2, 2, 2, 613, 614, 3, 2, 2, 2, 614, 616, 3, 2, 2, 2, 615, 613, 3, 2, - 2, 2, 616, 617, 7, 2, 2, 3, 617, 622, 3, 2, 2, 2, 618, 619, 5, 104, 53, - 2, 619, 620, 7, 2, 2, 3, 620, 622, 3, 2, 2, 2, 621, 608, 3, 2, 2, 2, 621, - 618, 3, 2, 2, 2, 622, 69, 3, 2, 2, 2, 623, 627, 5, 66, 34, 2, 624, 627, - 5, 14, 8, 2, 625, 627, 5, 106, 54, 2, 626, 623, 3, 2, 2, 2, 626, 624, 3, - 2, 2, 2, 626, 625, 3, 2, 2, 2, 627, 71, 3, 2, 2, 2, 628, 629, 5, 74, 38, - 2, 629, 630, 7, 34, 2, 2, 630, 633, 5, 78, 40, 2, 631, 632, 7, 28, 2, 2, - 632, 634, 5, 76, 39, 2, 633, 631, 3, 2, 2, 2, 633, 634, 3, 2, 2, 2, 634, - 73, 3, 2, 2, 2, 635, 637, 5, 14, 8, 2, 636, 635, 3, 2, 2, 2, 636, 637, - 3, 2, 2, 2, 637, 638, 3, 2, 2, 2, 638, 640, 5, 20, 11, 2, 639, 641, 5, - 14, 8, 2, 640, 639, 3, 2, 2, 2, 640, 641, 3, 2, 2, 2, 641, 651, 3, 2, 2, - 2, 642, 644, 5, 14, 8, 2, 643, 642, 3, 2, 2, 2, 643, 644, 3, 2, 2, 2, 644, - 645, 3, 2, 2, 2, 645, 647, 5, 28, 15, 2, 646, 648, 5, 14, 8, 2, 647, 646, - 3, 2, 2, 2, 647, 648, 3, 2, 2, 2, 648, 651, 3, 2, 2, 2, 649, 651, 5, 108, - 55, 2, 650, 636, 3, 2, 2, 2, 650, 643, 3, 2, 2, 2, 650, 649, 3, 2, 2, 2, - 651, 75, 3, 2, 2, 2, 652, 654, 7, 27, 2, 2, 653, 652, 3, 2, 2, 2, 654, - 655, 3, 2, 2, 2, 655, 653, 3, 2, 2, 2, 655, 656, 3, 2, 2, 2, 656, 77, 3, - 2, 2, 2, 657, 659, 5, 14, 8, 2, 658, 657, 3, 2, 2, 2, 658, 659, 3, 2, 2, - 2, 659, 660, 3, 2, 2, 2, 660, 662, 5, 20, 11, 2, 661, 663, 5, 14, 8, 2, - 662, 661, 3, 2, 2, 2, 662, 663, 3, 2, 2, 2, 663, 679, 3, 2, 2, 2, 664, - 666, 5, 14, 8, 2, 665, 664, 3, 2, 2, 2, 665, 666, 3, 2, 2, 2, 666, 667, - 3, 2, 2, 2, 667, 669, 5, 80, 41, 2, 668, 670, 5, 14, 8, 2, 669, 668, 3, - 2, 2, 2, 669, 670, 3, 2, 2, 2, 670, 679, 3, 2, 2, 2, 671, 673, 5, 14, 8, - 2, 672, 671, 3, 2, 2, 2, 672, 673, 3, 2, 2, 2, 673, 674, 3, 2, 2, 2, 674, - 676, 5, 110, 56, 2, 675, 677, 5, 14, 8, 2, 676, 675, 3, 2, 2, 2, 676, 677, - 3, 2, 2, 2, 677, 679, 3, 2, 2, 2, 678, 658, 3, 2, 2, 2, 678, 665, 3, 2, - 2, 2, 678, 672, 3, 2, 2, 2, 679, 79, 3, 2, 2, 2, 680, 687, 7, 35, 2, 2, - 681, 683, 5, 6, 4, 2, 682, 681, 3, 2, 2, 2, 682, 683, 3, 2, 2, 2, 683, - 684, 3, 2, 2, 2, 684, 686, 5, 82, 42, 2, 685, 682, 3, 2, 2, 2, 686, 689, - 3, 2, 2, 2, 687, 685, 3, 2, 2, 2, 687, 688, 3, 2, 2, 2, 688, 691, 3, 2, - 2, 2, 689, 687, 3, 2, 2, 2, 690, 692, 5, 6, 4, 2, 691, 690, 3, 2, 2, 2, - 691, 692, 3, 2, 2, 2, 692, 693, 3, 2, 2, 2, 693, 694, 7, 37, 2, 2, 694, - 81, 3, 2, 2, 2, 695, 728, 5, 132, 67, 2, 696, 728, 7, 12, 2, 2, 697, 728, - 7, 13, 2, 2, 698, 728, 7, 14, 2, 2, 699, 728, 7, 15, 2, 2, 700, 728, 7, - 16, 2, 2, 701, 728, 7, 17, 2, 2, 702, 728, 7, 18, 2, 2, 703, 728, 7, 19, - 2, 2, 704, 728, 7, 20, 2, 2, 705, 728, 7, 21, 2, 2, 706, 728, 7, 22, 2, - 2, 707, 728, 7, 23, 2, 2, 708, 728, 7, 24, 2, 2, 709, 728, 7, 25, 2, 2, - 710, 728, 7, 26, 2, 2, 711, 728, 7, 27, 2, 2, 712, 728, 7, 28, 2, 2, 713, - 728, 7, 29, 2, 2, 714, 728, 7, 30, 2, 2, 715, 728, 7, 31, 2, 2, 716, 728, - 7, 32, 2, 2, 717, 728, 7, 33, 2, 2, 718, 728, 7, 34, 2, 2, 719, 728, 7, - 38, 2, 2, 720, 728, 7, 39, 2, 2, 721, 728, 7, 40, 2, 2, 722, 728, 7, 41, - 2, 2, 723, 728, 7, 42, 2, 2, 724, 728, 7, 43, 2, 2, 725, 728, 7, 44, 2, - 2, 726, 728, 7, 46, 2, 2, 727, 695, 3, 2, 2, 2, 727, 696, 3, 2, 2, 2, 727, - 697, 3, 2, 2, 2, 727, 698, 3, 2, 2, 2, 727, 699, 3, 2, 2, 2, 727, 700, - 3, 2, 2, 2, 727, 701, 3, 2, 2, 2, 727, 702, 3, 2, 2, 2, 727, 703, 3, 2, - 2, 2, 727, 704, 3, 2, 2, 2, 727, 705, 3, 2, 2, 2, 727, 706, 3, 2, 2, 2, - 727, 707, 3, 2, 2, 2, 727, 708, 3, 2, 2, 2, 727, 709, 3, 2, 2, 2, 727, - 710, 3, 2, 2, 2, 727, 711, 3, 2, 2, 2, 727, 712, 3, 2, 2, 2, 727, 713, - 3, 2, 2, 2, 727, 714, 3, 2, 2, 2, 727, 715, 3, 2, 2, 2, 727, 716, 3, 2, - 2, 2, 727, 717, 3, 2, 2, 2, 727, 718, 3, 2, 2, 2, 727, 719, 3, 2, 2, 2, - 727, 720, 3, 2, 2, 2, 727, 721, 3, 2, 2, 2, 727, 722, 3, 2, 2, 2, 727, - 723, 3, 2, 2, 2, 727, 724, 3, 2, 2, 2, 727, 725, 3, 2, 2, 2, 727, 726, - 3, 2, 2, 2, 728, 83, 3, 2, 2, 2, 729, 730, 9, 3, 2, 2, 730, 85, 3, 2, 2, - 2, 731, 732, 5, 84, 43, 2, 732, 87, 3, 2, 2, 2, 733, 734, 5, 84, 43, 2, - 734, 89, 3, 2, 2, 2, 735, 740, 7, 36, 2, 2, 736, 741, 7, 3, 2, 2, 737, - 741, 5, 84, 43, 2, 738, 741, 7, 6, 2, 2, 739, 741, 7, 9, 2, 2, 740, 736, - 3, 2, 2, 2, 740, 737, 3, 2, 2, 2, 740, 738, 3, 2, 2, 2, 740, 739, 3, 2, - 2, 2, 741, 91, 3, 2, 2, 2, 742, 744, 5, 128, 65, 2, 743, 742, 3, 2, 2, - 2, 744, 745, 3, 2, 2, 2, 745, 743, 3, 2, 2, 2, 745, 746, 3, 2, 2, 2, 746, - 747, 3, 2, 2, 2, 747, 749, 5, 126, 64, 2, 748, 750, 5, 128, 65, 2, 749, - 748, 3, 2, 2, 2, 750, 751, 3, 2, 2, 2, 751, 749, 3, 2, 2, 2, 751, 752, - 3, 2, 2, 2, 752, 93, 3, 2, 2, 2, 753, 754, 7, 67, 2, 2, 754, 786, 7, 66, - 2, 2, 755, 756, 7, 67, 2, 2, 756, 757, 7, 66, 2, 2, 757, 786, 7, 49, 2, - 2, 758, 759, 7, 53, 2, 2, 759, 760, 7, 59, 2, 2, 760, 786, 7, 66, 2, 2, - 761, 762, 7, 51, 2, 2, 762, 763, 7, 65, 2, 2, 763, 786, 7, 66, 2, 2, 764, - 765, 7, 51, 2, 2, 765, 766, 7, 50, 2, 2, 766, 786, 7, 66, 2, 2, 767, 768, - 7, 49, 2, 2, 768, 769, 7, 65, 2, 2, 769, 786, 7, 66, 2, 2, 770, 771, 7, - 49, 2, 2, 771, 772, 7, 50, 2, 2, 772, 786, 7, 66, 2, 2, 773, 774, 7, 59, - 2, 2, 774, 775, 7, 65, 2, 2, 775, 786, 7, 66, 2, 2, 776, 777, 7, 59, 2, - 2, 777, 778, 7, 50, 2, 2, 778, 786, 7, 66, 2, 2, 779, 780, 7, 62, 2, 2, - 780, 781, 7, 65, 2, 2, 781, 786, 7, 66, 2, 2, 782, 783, 7, 62, 2, 2, 783, - 784, 7, 50, 2, 2, 784, 786, 7, 66, 2, 2, 785, 753, 3, 2, 2, 2, 785, 755, - 3, 2, 2, 2, 785, 758, 3, 2, 2, 2, 785, 761, 3, 2, 2, 2, 785, 764, 3, 2, - 2, 2, 785, 767, 3, 2, 2, 2, 785, 770, 3, 2, 2, 2, 785, 773, 3, 2, 2, 2, - 785, 776, 3, 2, 2, 2, 785, 779, 3, 2, 2, 2, 785, 782, 3, 2, 2, 2, 786, - 95, 3, 2, 2, 2, 787, 789, 5, 14, 8, 2, 788, 787, 3, 2, 2, 2, 788, 789, - 3, 2, 2, 2, 789, 790, 3, 2, 2, 2, 790, 791, 7, 30, 2, 2, 791, 792, 5, 98, - 50, 2, 792, 793, 5, 72, 37, 2, 793, 795, 7, 32, 2, 2, 794, 796, 5, 14, - 8, 2, 795, 794, 3, 2, 2, 2, 795, 796, 3, 2, 2, 2, 796, 97, 3, 2, 2, 2, - 797, 798, 5, 100, 51, 2, 798, 799, 7, 28, 2, 2, 799, 99, 3, 2, 2, 2, 800, - 803, 5, 14, 8, 2, 801, 803, 7, 23, 2, 2, 802, 800, 3, 2, 2, 2, 802, 801, - 3, 2, 2, 2, 803, 806, 3, 2, 2, 2, 804, 802, 3, 2, 2, 2, 804, 805, 3, 2, - 2, 2, 805, 807, 3, 2, 2, 2, 806, 804, 3, 2, 2, 2, 807, 808, 7, 34, 2, 2, - 808, 819, 5, 78, 40, 2, 809, 811, 7, 23, 2, 2, 810, 812, 5, 14, 8, 2, 811, - 810, 3, 2, 2, 2, 811, 812, 3, 2, 2, 2, 812, 815, 3, 2, 2, 2, 813, 814, - 7, 34, 2, 2, 814, 816, 5, 78, 40, 2, 815, 813, 3, 2, 2, 2, 815, 816, 3, - 2, 2, 2, 816, 818, 3, 2, 2, 2, 817, 809, 3, 2, 2, 2, 818, 821, 3, 2, 2, - 2, 819, 817, 3, 2, 2, 2, 819, 820, 3, 2, 2, 2, 820, 101, 3, 2, 2, 2, 821, - 819, 3, 2, 2, 2, 822, 824, 5, 14, 8, 2, 823, 822, 3, 2, 2, 2, 823, 824, - 3, 2, 2, 2, 824, 825, 3, 2, 2, 2, 825, 827, 7, 23, 2, 2, 826, 823, 3, 2, - 2, 2, 827, 830, 3, 2, 2, 2, 828, 826, 3, 2, 2, 2, 828, 829, 3, 2, 2, 2, - 829, 831, 3, 2, 2, 2, 830, 828, 3, 2, 2, 2, 831, 839, 5, 56, 29, 2, 832, - 835, 7, 23, 2, 2, 833, 836, 5, 56, 29, 2, 834, 836, 5, 14, 8, 2, 835, 833, - 3, 2, 2, 2, 835, 834, 3, 2, 2, 2, 835, 836, 3, 2, 2, 2, 836, 838, 3, 2, - 2, 2, 837, 832, 3, 2, 2, 2, 838, 841, 3, 2, 2, 2, 839, 837, 3, 2, 2, 2, - 839, 840, 3, 2, 2, 2, 840, 103, 3, 2, 2, 2, 841, 839, 3, 2, 2, 2, 842, - 844, 5, 14, 8, 2, 843, 842, 3, 2, 2, 2, 843, 844, 3, 2, 2, 2, 844, 845, - 3, 2, 2, 2, 845, 847, 7, 23, 2, 2, 846, 843, 3, 2, 2, 2, 847, 850, 3, 2, - 2, 2, 848, 846, 3, 2, 2, 2, 848, 849, 3, 2, 2, 2, 849, 851, 3, 2, 2, 2, - 850, 848, 3, 2, 2, 2, 851, 859, 5, 54, 28, 2, 852, 855, 7, 23, 2, 2, 853, - 856, 5, 54, 28, 2, 854, 856, 5, 14, 8, 2, 855, 853, 3, 2, 2, 2, 855, 854, - 3, 2, 2, 2, 855, 856, 3, 2, 2, 2, 856, 858, 3, 2, 2, 2, 857, 852, 3, 2, - 2, 2, 858, 861, 3, 2, 2, 2, 859, 857, 3, 2, 2, 2, 859, 860, 3, 2, 2, 2, - 860, 105, 3, 2, 2, 2, 861, 859, 3, 2, 2, 2, 862, 864, 5, 14, 8, 2, 863, - 862, 3, 2, 2, 2, 863, 864, 3, 2, 2, 2, 864, 865, 3, 2, 2, 2, 865, 867, - 7, 23, 2, 2, 866, 863, 3, 2, 2, 2, 867, 868, 3, 2, 2, 2, 868, 866, 3, 2, - 2, 2, 868, 869, 3, 2, 2, 2, 869, 871, 3, 2, 2, 2, 870, 872, 5, 14, 8, 2, - 871, 870, 3, 2, 2, 2, 871, 872, 3, 2, 2, 2, 872, 107, 3, 2, 2, 2, 873, - 878, 5, 30, 16, 2, 874, 875, 7, 25, 2, 2, 875, 877, 5, 30, 16, 2, 876, - 874, 3, 2, 2, 2, 877, 880, 3, 2, 2, 2, 878, 876, 3, 2, 2, 2, 878, 879, - 3, 2, 2, 2, 879, 109, 3, 2, 2, 2, 880, 878, 3, 2, 2, 2, 881, 886, 5, 18, - 10, 2, 882, 883, 7, 25, 2, 2, 883, 885, 5, 18, 10, 2, 884, 882, 3, 2, 2, - 2, 885, 888, 3, 2, 2, 2, 886, 884, 3, 2, 2, 2, 886, 887, 3, 2, 2, 2, 887, - 111, 3, 2, 2, 2, 888, 886, 3, 2, 2, 2, 889, 890, 7, 31, 2, 2, 890, 891, - 7, 33, 2, 2, 891, 892, 5, 114, 58, 2, 892, 893, 7, 33, 2, 2, 893, 894, - 5, 116, 59, 2, 894, 895, 7, 33, 2, 2, 895, 896, 5, 122, 62, 2, 896, 897, - 7, 33, 2, 2, 897, 898, 7, 31, 2, 2, 898, 113, 3, 2, 2, 2, 899, 900, 5, - 118, 60, 2, 900, 115, 3, 2, 2, 2, 901, 902, 5, 118, 60, 2, 902, 117, 3, - 2, 2, 2, 903, 905, 5, 120, 61, 2, 904, 903, 3, 2, 2, 2, 905, 906, 3, 2, - 2, 2, 906, 904, 3, 2, 2, 2, 906, 907, 3, 2, 2, 2, 907, 119, 3, 2, 2, 2, - 908, 928, 5, 132, 67, 2, 909, 928, 7, 12, 2, 2, 910, 928, 7, 14, 2, 2, - 911, 928, 7, 15, 2, 2, 912, 928, 7, 16, 2, 2, 913, 928, 7, 17, 2, 2, 914, - 928, 7, 18, 2, 2, 915, 928, 7, 21, 2, 2, 916, 928, 7, 22, 2, 2, 917, 928, - 7, 24, 2, 2, 918, 928, 7, 27, 2, 2, 919, 928, 7, 36, 2, 2, 920, 928, 7, - 38, 2, 2, 921, 928, 7, 39, 2, 2, 922, 928, 7, 40, 2, 2, 923, 928, 7, 41, - 2, 2, 924, 928, 7, 42, 2, 2, 925, 928, 7, 43, 2, 2, 926, 928, 7, 44, 2, - 2, 927, 908, 3, 2, 2, 2, 927, 909, 3, 2, 2, 2, 927, 910, 3, 2, 2, 2, 927, - 911, 3, 2, 2, 2, 927, 912, 3, 2, 2, 2, 927, 913, 3, 2, 2, 2, 927, 914, - 3, 2, 2, 2, 927, 915, 3, 2, 2, 2, 927, 916, 3, 2, 2, 2, 927, 917, 3, 2, - 2, 2, 927, 918, 3, 2, 2, 2, 927, 919, 3, 2, 2, 2, 927, 920, 3, 2, 2, 2, - 927, 921, 3, 2, 2, 2, 927, 922, 3, 2, 2, 2, 927, 923, 3, 2, 2, 2, 927, - 924, 3, 2, 2, 2, 927, 925, 3, 2, 2, 2, 927, 926, 3, 2, 2, 2, 928, 121, - 3, 2, 2, 2, 929, 931, 5, 124, 63, 2, 930, 929, 3, 2, 2, 2, 931, 932, 3, - 2, 2, 2, 932, 930, 3, 2, 2, 2, 932, 933, 3, 2, 2, 2, 933, 123, 3, 2, 2, - 2, 934, 968, 5, 132, 67, 2, 935, 968, 7, 12, 2, 2, 936, 968, 7, 13, 2, - 2, 937, 968, 7, 14, 2, 2, 938, 968, 7, 15, 2, 2, 939, 968, 7, 16, 2, 2, - 940, 968, 7, 17, 2, 2, 941, 968, 7, 18, 2, 2, 942, 968, 7, 19, 2, 2, 943, - 968, 7, 20, 2, 2, 944, 968, 7, 21, 2, 2, 945, 968, 7, 22, 2, 2, 946, 968, - 7, 23, 2, 2, 947, 968, 7, 24, 2, 2, 948, 968, 7, 25, 2, 2, 949, 968, 7, - 26, 2, 2, 950, 968, 7, 27, 2, 2, 951, 968, 7, 28, 2, 2, 952, 968, 7, 29, - 2, 2, 953, 968, 7, 30, 2, 2, 954, 968, 7, 31, 2, 2, 955, 968, 7, 32, 2, - 2, 956, 968, 7, 34, 2, 2, 957, 968, 7, 35, 2, 2, 958, 968, 7, 36, 2, 2, - 959, 968, 7, 37, 2, 2, 960, 968, 7, 38, 2, 2, 961, 968, 7, 39, 2, 2, 962, - 968, 7, 40, 2, 2, 963, 968, 7, 41, 2, 2, 964, 968, 7, 42, 2, 2, 965, 968, - 7, 43, 2, 2, 966, 968, 7, 44, 2, 2, 967, 934, 3, 2, 2, 2, 967, 935, 3, - 2, 2, 2, 967, 936, 3, 2, 2, 2, 967, 937, 3, 2, 2, 2, 967, 938, 3, 2, 2, - 2, 967, 939, 3, 2, 2, 2, 967, 940, 3, 2, 2, 2, 967, 941, 3, 2, 2, 2, 967, - 942, 3, 2, 2, 2, 967, 943, 3, 2, 2, 2, 967, 944, 3, 2, 2, 2, 967, 945, - 3, 2, 2, 2, 967, 946, 3, 2, 2, 2, 967, 947, 3, 2, 2, 2, 967, 948, 3, 2, - 2, 2, 967, 949, 3, 2, 2, 2, 967, 950, 3, 2, 2, 2, 967, 951, 3, 2, 2, 2, - 967, 952, 3, 2, 2, 2, 967, 953, 3, 2, 2, 2, 967, 954, 3, 2, 2, 2, 967, - 955, 3, 2, 2, 2, 967, 956, 3, 2, 2, 2, 967, 957, 3, 2, 2, 2, 967, 958, - 3, 2, 2, 2, 967, 959, 3, 2, 2, 2, 967, 960, 3, 2, 2, 2, 967, 961, 3, 2, - 2, 2, 967, 962, 3, 2, 2, 2, 967, 963, 3, 2, 2, 2, 967, 964, 3, 2, 2, 2, - 967, 965, 3, 2, 2, 2, 967, 966, 3, 2, 2, 2, 968, 125, 3, 2, 2, 2, 969, - 970, 7, 9, 2, 2, 970, 971, 7, 6, 2, 2, 971, 127, 3, 2, 2, 2, 972, 973, - 9, 4, 2, 2, 973, 129, 3, 2, 2, 2, 974, 1010, 5, 132, 67, 2, 975, 1010, - 7, 12, 2, 2, 976, 1010, 7, 13, 2, 2, 977, 1010, 7, 14, 2, 2, 978, 1010, - 7, 15, 2, 2, 979, 1010, 7, 16, 2, 2, 980, 1010, 7, 17, 2, 2, 981, 1010, - 7, 18, 2, 2, 982, 1010, 7, 19, 2, 2, 983, 1010, 7, 20, 2, 2, 984, 1010, - 7, 21, 2, 2, 985, 1010, 7, 22, 2, 2, 986, 1010, 7, 23, 2, 2, 987, 1010, - 7, 24, 2, 2, 988, 1010, 7, 25, 2, 2, 989, 1010, 7, 26, 2, 2, 990, 1010, - 7, 27, 2, 2, 991, 1010, 7, 28, 2, 2, 992, 1010, 7, 29, 2, 2, 993, 1010, - 7, 30, 2, 2, 994, 1010, 7, 31, 2, 2, 995, 1010, 7, 32, 2, 2, 996, 1010, - 7, 33, 2, 2, 997, 1010, 7, 34, 2, 2, 998, 1010, 7, 35, 2, 2, 999, 1010, - 7, 36, 2, 2, 1000, 1010, 7, 37, 2, 2, 1001, 1010, 7, 38, 2, 2, 1002, 1010, - 7, 39, 2, 2, 1003, 1010, 7, 40, 2, 2, 1004, 1010, 7, 41, 2, 2, 1005, 1010, - 7, 42, 2, 2, 1006, 1010, 7, 43, 2, 2, 1007, 1010, 7, 44, 2, 2, 1008, 1010, - 7, 46, 2, 2, 1009, 974, 3, 2, 2, 2, 1009, 975, 3, 2, 2, 2, 1009, 976, 3, - 2, 2, 2, 1009, 977, 3, 2, 2, 2, 1009, 978, 3, 2, 2, 2, 1009, 979, 3, 2, - 2, 2, 1009, 980, 3, 2, 2, 2, 1009, 981, 3, 2, 2, 2, 1009, 982, 3, 2, 2, - 2, 1009, 983, 3, 2, 2, 2, 1009, 984, 3, 2, 2, 2, 1009, 985, 3, 2, 2, 2, - 1009, 986, 3, 2, 2, 2, 1009, 987, 3, 2, 2, 2, 1009, 988, 3, 2, 2, 2, 1009, - 989, 3, 2, 2, 2, 1009, 990, 3, 2, 2, 2, 1009, 991, 3, 2, 2, 2, 1009, 992, - 3, 2, 2, 2, 1009, 993, 3, 2, 2, 2, 1009, 994, 3, 2, 2, 2, 1009, 995, 3, - 2, 2, 2, 1009, 996, 3, 2, 2, 2, 1009, 997, 3, 2, 2, 2, 1009, 998, 3, 2, - 2, 2, 1009, 999, 3, 2, 2, 2, 1009, 1000, 3, 2, 2, 2, 1009, 1001, 3, 2, - 2, 2, 1009, 1002, 3, 2, 2, 2, 1009, 1003, 3, 2, 2, 2, 1009, 1004, 3, 2, - 2, 2, 1009, 1005, 3, 2, 2, 2, 1009, 1006, 3, 2, 2, 2, 1009, 1007, 3, 2, - 2, 2, 1009, 1008, 3, 2, 2, 2, 1010, 131, 3, 2, 2, 2, 1011, 1012, 9, 5, - 2, 2, 1012, 133, 3, 2, 2, 2, 132, 136, 141, 146, 150, 155, 158, 193, 198, - 202, 207, 211, 216, 221, 224, 227, 251, 256, 261, 267, 271, 275, 311, 315, - 318, 323, 329, 334, 338, 341, 345, 348, 352, 355, 360, 370, 373, 376, 381, - 385, 389, 391, 414, 417, 421, 425, 429, 432, 434, 472, 482, 487, 489, 492, - 496, 499, 503, 505, 510, 515, 517, 522, 527, 529, 532, 543, 547, 551, 554, - 559, 563, 567, 570, 575, 579, 584, 590, 592, 595, 602, 606, 613, 621, 626, - 633, 636, 640, 643, 647, 650, 655, 658, 662, 665, 669, 672, 676, 678, 682, - 687, 691, 727, 740, 745, 751, 785, 788, 795, 802, 804, 811, 815, 819, 823, - 828, 835, 839, 843, 848, 855, 859, 863, 868, 871, 878, 886, 906, 927, 932, - 967, 1009, -} -var deserializer = antlr.NewATNDeserializer(nil) -var deserializedATN = deserializer.DeserializeFromUInt16(parserATN) - -var literalNames = []string{ - "", "'\u0000'", "", "'\t'", "'\n'", "'\u000B'", "'\u000C'", "'\r'", "", - "' '", "'!'", "'\"'", "'#'", "'$'", "'%'", "'&'", "'''", "'('", "')'", - "'*'", "'+'", "','", "'-'", "'.'", "'/'", "", "':'", "';'", "'<'", "'='", - "'>'", "'?'", "'@'", "'['", "'\\'", "']'", "'^'", "'_'", "'`'", "'{'", - "'|'", "'}'", "'~'", "'\u007F'", -} -var symbolicNames = []string{ - "", "U_00", "U_01_08", "TAB", "LF", "U_0B", "U_0C", "CR", "U_0E_1F", "SP", - "Exclamation", "DQuote", "Hash", "Dollar", "Percent", "Ampersand", "SQuote", - "LParens", "RParens", "Asterisk", "Plus", "Comma", "Minus", "Period", "Slash", - "Digit", "Colon", "Semicolon", "Less", "Equal", "Greater", "Question", - "At", "LBracket", "Backslash", "RBracket", "Caret", "Underscore", "Backtick", - "LCurly", "Pipe", "RCurly", "Tilde", "Delete", "UTF8NonAscii", "A", "B", - "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", - "R", "S", "T", "U", "V", "W", "X", "Y", "Z", -} - -var ruleNames = []string{ - "quotedChar", "quotedPair", "fws", "ctext", "ccontent", "comment", "cfws", - "atext", "atom", "dotAtom", "qtext", "quotedContent", "quotedValue", "quotedString", - "word", "dateTime", "dayOfweek", "dayName", "day", "month", "year", "hour", - "minute", "second", "offset", "zone", "address", "mailbox", "nameAddr", - "angleAddr", "group", "displayName", "mailboxList", "addressList", "groupList", - "addrSpec", "localPart", "port", "domain", "domainLiteral", "dtext", "obsNoWSCTL", - "obsCtext", "obsQtext", "obsQP", "obsFWS", "obsZone", "obsAngleAddr", "obsRoute", - "obsDomainList", "obsMboxList", "obsAddrList", "obsGroupList", "obsLocalPart", - "obsDomain", "encodedWord", "charset", "encoding", "token", "tokenChar", - "encodedText", "encodedChar", "crlf", "wsp", "vchar", "alpha", -} -var decisionToDFA = make([]*antlr.DFA, len(deserializedATN.DecisionToState)) - -func init() { - for index, ds := range deserializedATN.DecisionToState { - decisionToDFA[index] = antlr.NewDFA(ds, index) - } -} - -type RFC5322Parser struct { - *antlr.BaseParser -} - -func NewRFC5322Parser(input antlr.TokenStream) *RFC5322Parser { - this := new(RFC5322Parser) - - this.BaseParser = antlr.NewBaseParser(input) - - this.Interpreter = antlr.NewParserATNSimulator(this, deserializedATN, decisionToDFA, antlr.NewPredictionContextCache()) - this.RuleNames = ruleNames - this.LiteralNames = literalNames - this.SymbolicNames = symbolicNames - this.GrammarFileName = "RFC5322Parser.g4" - - return this -} - -// RFC5322Parser tokens. -const ( - RFC5322ParserEOF = antlr.TokenEOF - RFC5322ParserU_00 = 1 - RFC5322ParserU_01_08 = 2 - RFC5322ParserTAB = 3 - RFC5322ParserLF = 4 - RFC5322ParserU_0B = 5 - RFC5322ParserU_0C = 6 - RFC5322ParserCR = 7 - RFC5322ParserU_0E_1F = 8 - RFC5322ParserSP = 9 - RFC5322ParserExclamation = 10 - RFC5322ParserDQuote = 11 - RFC5322ParserHash = 12 - RFC5322ParserDollar = 13 - RFC5322ParserPercent = 14 - RFC5322ParserAmpersand = 15 - RFC5322ParserSQuote = 16 - RFC5322ParserLParens = 17 - RFC5322ParserRParens = 18 - RFC5322ParserAsterisk = 19 - RFC5322ParserPlus = 20 - RFC5322ParserComma = 21 - RFC5322ParserMinus = 22 - RFC5322ParserPeriod = 23 - RFC5322ParserSlash = 24 - RFC5322ParserDigit = 25 - RFC5322ParserColon = 26 - RFC5322ParserSemicolon = 27 - RFC5322ParserLess = 28 - RFC5322ParserEqual = 29 - RFC5322ParserGreater = 30 - RFC5322ParserQuestion = 31 - RFC5322ParserAt = 32 - RFC5322ParserLBracket = 33 - RFC5322ParserBackslash = 34 - RFC5322ParserRBracket = 35 - RFC5322ParserCaret = 36 - RFC5322ParserUnderscore = 37 - RFC5322ParserBacktick = 38 - RFC5322ParserLCurly = 39 - RFC5322ParserPipe = 40 - RFC5322ParserRCurly = 41 - RFC5322ParserTilde = 42 - RFC5322ParserDelete = 43 - RFC5322ParserUTF8NonAscii = 44 - RFC5322ParserA = 45 - RFC5322ParserB = 46 - RFC5322ParserC = 47 - RFC5322ParserD = 48 - RFC5322ParserE = 49 - RFC5322ParserF = 50 - RFC5322ParserG = 51 - RFC5322ParserH = 52 - RFC5322ParserI = 53 - RFC5322ParserJ = 54 - RFC5322ParserK = 55 - RFC5322ParserL = 56 - RFC5322ParserM = 57 - RFC5322ParserN = 58 - RFC5322ParserO = 59 - RFC5322ParserP = 60 - RFC5322ParserQ = 61 - RFC5322ParserR = 62 - RFC5322ParserS = 63 - RFC5322ParserT = 64 - RFC5322ParserU = 65 - RFC5322ParserV = 66 - RFC5322ParserW = 67 - RFC5322ParserX = 68 - RFC5322ParserY = 69 - RFC5322ParserZ = 70 -) - -// RFC5322Parser rules. -const ( - RFC5322ParserRULE_quotedChar = 0 - RFC5322ParserRULE_quotedPair = 1 - RFC5322ParserRULE_fws = 2 - RFC5322ParserRULE_ctext = 3 - RFC5322ParserRULE_ccontent = 4 - RFC5322ParserRULE_comment = 5 - RFC5322ParserRULE_cfws = 6 - RFC5322ParserRULE_atext = 7 - RFC5322ParserRULE_atom = 8 - RFC5322ParserRULE_dotAtom = 9 - RFC5322ParserRULE_qtext = 10 - RFC5322ParserRULE_quotedContent = 11 - RFC5322ParserRULE_quotedValue = 12 - RFC5322ParserRULE_quotedString = 13 - RFC5322ParserRULE_word = 14 - RFC5322ParserRULE_dateTime = 15 - RFC5322ParserRULE_dayOfweek = 16 - RFC5322ParserRULE_dayName = 17 - RFC5322ParserRULE_day = 18 - RFC5322ParserRULE_month = 19 - RFC5322ParserRULE_year = 20 - RFC5322ParserRULE_hour = 21 - RFC5322ParserRULE_minute = 22 - RFC5322ParserRULE_second = 23 - RFC5322ParserRULE_offset = 24 - RFC5322ParserRULE_zone = 25 - RFC5322ParserRULE_address = 26 - RFC5322ParserRULE_mailbox = 27 - RFC5322ParserRULE_nameAddr = 28 - RFC5322ParserRULE_angleAddr = 29 - RFC5322ParserRULE_group = 30 - RFC5322ParserRULE_displayName = 31 - RFC5322ParserRULE_mailboxList = 32 - RFC5322ParserRULE_addressList = 33 - RFC5322ParserRULE_groupList = 34 - RFC5322ParserRULE_addrSpec = 35 - RFC5322ParserRULE_localPart = 36 - RFC5322ParserRULE_port = 37 - RFC5322ParserRULE_domain = 38 - RFC5322ParserRULE_domainLiteral = 39 - RFC5322ParserRULE_dtext = 40 - RFC5322ParserRULE_obsNoWSCTL = 41 - RFC5322ParserRULE_obsCtext = 42 - RFC5322ParserRULE_obsQtext = 43 - RFC5322ParserRULE_obsQP = 44 - RFC5322ParserRULE_obsFWS = 45 - RFC5322ParserRULE_obsZone = 46 - RFC5322ParserRULE_obsAngleAddr = 47 - RFC5322ParserRULE_obsRoute = 48 - RFC5322ParserRULE_obsDomainList = 49 - RFC5322ParserRULE_obsMboxList = 50 - RFC5322ParserRULE_obsAddrList = 51 - RFC5322ParserRULE_obsGroupList = 52 - RFC5322ParserRULE_obsLocalPart = 53 - RFC5322ParserRULE_obsDomain = 54 - RFC5322ParserRULE_encodedWord = 55 - RFC5322ParserRULE_charset = 56 - RFC5322ParserRULE_encoding = 57 - RFC5322ParserRULE_token = 58 - RFC5322ParserRULE_tokenChar = 59 - RFC5322ParserRULE_encodedText = 60 - RFC5322ParserRULE_encodedChar = 61 - RFC5322ParserRULE_crlf = 62 - RFC5322ParserRULE_wsp = 63 - RFC5322ParserRULE_vchar = 64 - RFC5322ParserRULE_alpha = 65 -) - -// IQuotedCharContext is an interface to support dynamic dispatch. -type IQuotedCharContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // IsQuotedCharContext differentiates from other interfaces. - IsQuotedCharContext() -} - -type QuotedCharContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyQuotedCharContext() *QuotedCharContext { - var p = new(QuotedCharContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = RFC5322ParserRULE_quotedChar - return p -} - -func (*QuotedCharContext) IsQuotedCharContext() {} - -func NewQuotedCharContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *QuotedCharContext { - var p = new(QuotedCharContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = RFC5322ParserRULE_quotedChar - - return p -} - -func (s *QuotedCharContext) GetParser() antlr.Parser { return s.parser } - -func (s *QuotedCharContext) Vchar() IVcharContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*IVcharContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IVcharContext) -} - -func (s *QuotedCharContext) Wsp() IWspContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*IWspContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IWspContext) -} - -func (s *QuotedCharContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *QuotedCharContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *QuotedCharContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.EnterQuotedChar(s) - } -} - -func (s *QuotedCharContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.ExitQuotedChar(s) - } -} - -func (p *RFC5322Parser) QuotedChar() (localctx IQuotedCharContext) { - localctx = NewQuotedCharContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 0, RFC5322ParserRULE_quotedChar) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(134) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case RFC5322ParserExclamation, RFC5322ParserDQuote, RFC5322ParserHash, RFC5322ParserDollar, RFC5322ParserPercent, RFC5322ParserAmpersand, RFC5322ParserSQuote, RFC5322ParserLParens, RFC5322ParserRParens, RFC5322ParserAsterisk, RFC5322ParserPlus, RFC5322ParserComma, RFC5322ParserMinus, RFC5322ParserPeriod, RFC5322ParserSlash, RFC5322ParserDigit, RFC5322ParserColon, RFC5322ParserSemicolon, RFC5322ParserLess, RFC5322ParserEqual, RFC5322ParserGreater, RFC5322ParserQuestion, RFC5322ParserAt, RFC5322ParserLBracket, RFC5322ParserBackslash, RFC5322ParserRBracket, RFC5322ParserCaret, RFC5322ParserUnderscore, RFC5322ParserBacktick, RFC5322ParserLCurly, RFC5322ParserPipe, RFC5322ParserRCurly, RFC5322ParserTilde, RFC5322ParserUTF8NonAscii, RFC5322ParserA, RFC5322ParserB, RFC5322ParserC, RFC5322ParserD, RFC5322ParserE, RFC5322ParserF, RFC5322ParserG, RFC5322ParserH, RFC5322ParserI, RFC5322ParserJ, RFC5322ParserK, RFC5322ParserL, RFC5322ParserM, RFC5322ParserN, RFC5322ParserO, RFC5322ParserP, RFC5322ParserQ, RFC5322ParserR, RFC5322ParserS, RFC5322ParserT, RFC5322ParserU, RFC5322ParserV, RFC5322ParserW, RFC5322ParserX, RFC5322ParserY, RFC5322ParserZ: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(132) - p.Vchar() - } - - case RFC5322ParserTAB, RFC5322ParserSP: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(133) - p.Wsp() - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// IQuotedPairContext is an interface to support dynamic dispatch. -type IQuotedPairContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // IsQuotedPairContext differentiates from other interfaces. - IsQuotedPairContext() -} - -type QuotedPairContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyQuotedPairContext() *QuotedPairContext { - var p = new(QuotedPairContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = RFC5322ParserRULE_quotedPair - return p -} - -func (*QuotedPairContext) IsQuotedPairContext() {} - -func NewQuotedPairContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *QuotedPairContext { - var p = new(QuotedPairContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = RFC5322ParserRULE_quotedPair - - return p -} - -func (s *QuotedPairContext) GetParser() antlr.Parser { return s.parser } - -func (s *QuotedPairContext) Backslash() antlr.TerminalNode { - return s.GetToken(RFC5322ParserBackslash, 0) -} - -func (s *QuotedPairContext) QuotedChar() IQuotedCharContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*IQuotedCharContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IQuotedCharContext) -} - -func (s *QuotedPairContext) ObsQP() IObsQPContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*IObsQPContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IObsQPContext) -} - -func (s *QuotedPairContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *QuotedPairContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *QuotedPairContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.EnterQuotedPair(s) - } -} - -func (s *QuotedPairContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.ExitQuotedPair(s) - } -} - -func (p *RFC5322Parser) QuotedPair() (localctx IQuotedPairContext) { - localctx = NewQuotedPairContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 2, RFC5322ParserRULE_quotedPair) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(139) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 1, p.GetParserRuleContext()) { - case 1: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(136) - p.Match(RFC5322ParserBackslash) - } - { - p.SetState(137) - p.QuotedChar() - } - - case 2: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(138) - p.ObsQP() - } - - } - - return localctx -} - -// IFwsContext is an interface to support dynamic dispatch. -type IFwsContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // IsFwsContext differentiates from other interfaces. - IsFwsContext() -} - -type FwsContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyFwsContext() *FwsContext { - var p = new(FwsContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = RFC5322ParserRULE_fws - return p -} - -func (*FwsContext) IsFwsContext() {} - -func NewFwsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FwsContext { - var p = new(FwsContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = RFC5322ParserRULE_fws - - return p -} - -func (s *FwsContext) GetParser() antlr.Parser { return s.parser } - -func (s *FwsContext) Crlf() ICrlfContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*ICrlfContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(ICrlfContext) -} - -func (s *FwsContext) AllWsp() []IWspContext { - var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IWspContext)(nil)).Elem()) - var tst = make([]IWspContext, len(ts)) - - for i, t := range ts { - if t != nil { - tst[i] = t.(IWspContext) - } - } - - return tst -} - -func (s *FwsContext) Wsp(i int) IWspContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*IWspContext)(nil)).Elem(), i) - - if t == nil { - return nil - } - - return t.(IWspContext) -} - -func (s *FwsContext) ObsFWS() IObsFWSContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*IObsFWSContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IObsFWSContext) -} - -func (s *FwsContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *FwsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *FwsContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.EnterFws(s) - } -} - -func (s *FwsContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.ExitFws(s) - } -} - -func (p *RFC5322Parser) Fws() (localctx IFwsContext) { - localctx = NewFwsContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 4, RFC5322ParserRULE_fws) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - var _alt int - - p.SetState(156) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 5, p.GetParserRuleContext()) { - case 1: - p.EnterOuterAlt(localctx, 1) - p.SetState(148) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 3, p.GetParserRuleContext()) == 1 { - p.SetState(144) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == RFC5322ParserTAB || _la == RFC5322ParserSP { - { - p.SetState(141) - p.Wsp() - } - - p.SetState(146) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(147) - p.Crlf() - } - - } - p.SetState(151) - p.GetErrorHandler().Sync(p) - _alt = 1 - for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { - switch _alt { - case 1: - { - p.SetState(150) - p.Wsp() - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - p.SetState(153) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 4, p.GetParserRuleContext()) - } - - case 2: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(155) - p.ObsFWS() - } - - } - - return localctx -} - -// ICtextContext is an interface to support dynamic dispatch. -type ICtextContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // IsCtextContext differentiates from other interfaces. - IsCtextContext() -} - -type CtextContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCtextContext() *CtextContext { - var p = new(CtextContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = RFC5322ParserRULE_ctext - return p -} - -func (*CtextContext) IsCtextContext() {} - -func NewCtextContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CtextContext { - var p = new(CtextContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = RFC5322ParserRULE_ctext - - return p -} - -func (s *CtextContext) GetParser() antlr.Parser { return s.parser } - -func (s *CtextContext) Alpha() IAlphaContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*IAlphaContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IAlphaContext) -} - -func (s *CtextContext) Exclamation() antlr.TerminalNode { - return s.GetToken(RFC5322ParserExclamation, 0) -} - -func (s *CtextContext) DQuote() antlr.TerminalNode { - return s.GetToken(RFC5322ParserDQuote, 0) -} - -func (s *CtextContext) Hash() antlr.TerminalNode { - return s.GetToken(RFC5322ParserHash, 0) -} - -func (s *CtextContext) Dollar() antlr.TerminalNode { - return s.GetToken(RFC5322ParserDollar, 0) -} - -func (s *CtextContext) Percent() antlr.TerminalNode { - return s.GetToken(RFC5322ParserPercent, 0) -} - -func (s *CtextContext) Ampersand() antlr.TerminalNode { - return s.GetToken(RFC5322ParserAmpersand, 0) -} - -func (s *CtextContext) SQuote() antlr.TerminalNode { - return s.GetToken(RFC5322ParserSQuote, 0) -} - -func (s *CtextContext) Asterisk() antlr.TerminalNode { - return s.GetToken(RFC5322ParserAsterisk, 0) -} - -func (s *CtextContext) Plus() antlr.TerminalNode { - return s.GetToken(RFC5322ParserPlus, 0) -} - -func (s *CtextContext) Comma() antlr.TerminalNode { - return s.GetToken(RFC5322ParserComma, 0) -} - -func (s *CtextContext) Minus() antlr.TerminalNode { - return s.GetToken(RFC5322ParserMinus, 0) -} - -func (s *CtextContext) Period() antlr.TerminalNode { - return s.GetToken(RFC5322ParserPeriod, 0) -} - -func (s *CtextContext) Slash() antlr.TerminalNode { - return s.GetToken(RFC5322ParserSlash, 0) -} - -func (s *CtextContext) Digit() antlr.TerminalNode { - return s.GetToken(RFC5322ParserDigit, 0) -} - -func (s *CtextContext) Colon() antlr.TerminalNode { - return s.GetToken(RFC5322ParserColon, 0) -} - -func (s *CtextContext) Semicolon() antlr.TerminalNode { - return s.GetToken(RFC5322ParserSemicolon, 0) -} - -func (s *CtextContext) Less() antlr.TerminalNode { - return s.GetToken(RFC5322ParserLess, 0) -} - -func (s *CtextContext) Equal() antlr.TerminalNode { - return s.GetToken(RFC5322ParserEqual, 0) -} - -func (s *CtextContext) Greater() antlr.TerminalNode { - return s.GetToken(RFC5322ParserGreater, 0) -} - -func (s *CtextContext) Question() antlr.TerminalNode { - return s.GetToken(RFC5322ParserQuestion, 0) -} - -func (s *CtextContext) At() antlr.TerminalNode { - return s.GetToken(RFC5322ParserAt, 0) -} - -func (s *CtextContext) LBracket() antlr.TerminalNode { - return s.GetToken(RFC5322ParserLBracket, 0) -} - -func (s *CtextContext) RBracket() antlr.TerminalNode { - return s.GetToken(RFC5322ParserRBracket, 0) -} - -func (s *CtextContext) Caret() antlr.TerminalNode { - return s.GetToken(RFC5322ParserCaret, 0) -} - -func (s *CtextContext) Underscore() antlr.TerminalNode { - return s.GetToken(RFC5322ParserUnderscore, 0) -} - -func (s *CtextContext) Backtick() antlr.TerminalNode { - return s.GetToken(RFC5322ParserBacktick, 0) -} - -func (s *CtextContext) LCurly() antlr.TerminalNode { - return s.GetToken(RFC5322ParserLCurly, 0) -} - -func (s *CtextContext) Pipe() antlr.TerminalNode { - return s.GetToken(RFC5322ParserPipe, 0) -} - -func (s *CtextContext) RCurly() antlr.TerminalNode { - return s.GetToken(RFC5322ParserRCurly, 0) -} - -func (s *CtextContext) Tilde() antlr.TerminalNode { - return s.GetToken(RFC5322ParserTilde, 0) -} - -func (s *CtextContext) ObsCtext() IObsCtextContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*IObsCtextContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IObsCtextContext) -} - -func (s *CtextContext) UTF8NonAscii() antlr.TerminalNode { - return s.GetToken(RFC5322ParserUTF8NonAscii, 0) -} - -func (s *CtextContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *CtextContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *CtextContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.EnterCtext(s) - } -} - -func (s *CtextContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.ExitCtext(s) - } -} - -func (p *RFC5322Parser) Ctext() (localctx ICtextContext) { - localctx = NewCtextContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 6, RFC5322ParserRULE_ctext) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(191) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case RFC5322ParserA, RFC5322ParserB, RFC5322ParserC, RFC5322ParserD, RFC5322ParserE, RFC5322ParserF, RFC5322ParserG, RFC5322ParserH, RFC5322ParserI, RFC5322ParserJ, RFC5322ParserK, RFC5322ParserL, RFC5322ParserM, RFC5322ParserN, RFC5322ParserO, RFC5322ParserP, RFC5322ParserQ, RFC5322ParserR, RFC5322ParserS, RFC5322ParserT, RFC5322ParserU, RFC5322ParserV, RFC5322ParserW, RFC5322ParserX, RFC5322ParserY, RFC5322ParserZ: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(158) - p.Alpha() - } - - case RFC5322ParserExclamation: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(159) - p.Match(RFC5322ParserExclamation) - } - - case RFC5322ParserDQuote: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(160) - p.Match(RFC5322ParserDQuote) - } - - case RFC5322ParserHash: - p.EnterOuterAlt(localctx, 4) - { - p.SetState(161) - p.Match(RFC5322ParserHash) - } - - case RFC5322ParserDollar: - p.EnterOuterAlt(localctx, 5) - { - p.SetState(162) - p.Match(RFC5322ParserDollar) - } - - case RFC5322ParserPercent: - p.EnterOuterAlt(localctx, 6) - { - p.SetState(163) - p.Match(RFC5322ParserPercent) - } - - case RFC5322ParserAmpersand: - p.EnterOuterAlt(localctx, 7) - { - p.SetState(164) - p.Match(RFC5322ParserAmpersand) - } - - case RFC5322ParserSQuote: - p.EnterOuterAlt(localctx, 8) - { - p.SetState(165) - p.Match(RFC5322ParserSQuote) - } - - case RFC5322ParserAsterisk: - p.EnterOuterAlt(localctx, 9) - { - p.SetState(166) - p.Match(RFC5322ParserAsterisk) - } - - case RFC5322ParserPlus: - p.EnterOuterAlt(localctx, 10) - { - p.SetState(167) - p.Match(RFC5322ParserPlus) - } - - case RFC5322ParserComma: - p.EnterOuterAlt(localctx, 11) - { - p.SetState(168) - p.Match(RFC5322ParserComma) - } - - case RFC5322ParserMinus: - p.EnterOuterAlt(localctx, 12) - { - p.SetState(169) - p.Match(RFC5322ParserMinus) - } - - case RFC5322ParserPeriod: - p.EnterOuterAlt(localctx, 13) - { - p.SetState(170) - p.Match(RFC5322ParserPeriod) - } - - case RFC5322ParserSlash: - p.EnterOuterAlt(localctx, 14) - { - p.SetState(171) - p.Match(RFC5322ParserSlash) - } - - case RFC5322ParserDigit: - p.EnterOuterAlt(localctx, 15) - { - p.SetState(172) - p.Match(RFC5322ParserDigit) - } - - case RFC5322ParserColon: - p.EnterOuterAlt(localctx, 16) - { - p.SetState(173) - p.Match(RFC5322ParserColon) - } - - case RFC5322ParserSemicolon: - p.EnterOuterAlt(localctx, 17) - { - p.SetState(174) - p.Match(RFC5322ParserSemicolon) - } - - case RFC5322ParserLess: - p.EnterOuterAlt(localctx, 18) - { - p.SetState(175) - p.Match(RFC5322ParserLess) - } - - case RFC5322ParserEqual: - p.EnterOuterAlt(localctx, 19) - { - p.SetState(176) - p.Match(RFC5322ParserEqual) - } - - case RFC5322ParserGreater: - p.EnterOuterAlt(localctx, 20) - { - p.SetState(177) - p.Match(RFC5322ParserGreater) - } - - case RFC5322ParserQuestion: - p.EnterOuterAlt(localctx, 21) - { - p.SetState(178) - p.Match(RFC5322ParserQuestion) - } - - case RFC5322ParserAt: - p.EnterOuterAlt(localctx, 22) - { - p.SetState(179) - p.Match(RFC5322ParserAt) - } - - case RFC5322ParserLBracket: - p.EnterOuterAlt(localctx, 23) - { - p.SetState(180) - p.Match(RFC5322ParserLBracket) - } - - case RFC5322ParserRBracket: - p.EnterOuterAlt(localctx, 24) - { - p.SetState(181) - p.Match(RFC5322ParserRBracket) - } - - case RFC5322ParserCaret: - p.EnterOuterAlt(localctx, 25) - { - p.SetState(182) - p.Match(RFC5322ParserCaret) - } - - case RFC5322ParserUnderscore: - p.EnterOuterAlt(localctx, 26) - { - p.SetState(183) - p.Match(RFC5322ParserUnderscore) - } - - case RFC5322ParserBacktick: - p.EnterOuterAlt(localctx, 27) - { - p.SetState(184) - p.Match(RFC5322ParserBacktick) - } - - case RFC5322ParserLCurly: - p.EnterOuterAlt(localctx, 28) - { - p.SetState(185) - p.Match(RFC5322ParserLCurly) - } - - case RFC5322ParserPipe: - p.EnterOuterAlt(localctx, 29) - { - p.SetState(186) - p.Match(RFC5322ParserPipe) - } - - case RFC5322ParserRCurly: - p.EnterOuterAlt(localctx, 30) - { - p.SetState(187) - p.Match(RFC5322ParserRCurly) - } - - case RFC5322ParserTilde: - p.EnterOuterAlt(localctx, 31) - { - p.SetState(188) - p.Match(RFC5322ParserTilde) - } - - case RFC5322ParserU_01_08, RFC5322ParserU_0B, RFC5322ParserU_0C, RFC5322ParserU_0E_1F, RFC5322ParserDelete: - p.EnterOuterAlt(localctx, 32) - { - p.SetState(189) - p.ObsCtext() - } - - case RFC5322ParserUTF8NonAscii: - p.EnterOuterAlt(localctx, 33) - { - p.SetState(190) - p.Match(RFC5322ParserUTF8NonAscii) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// ICcontentContext is an interface to support dynamic dispatch. -type ICcontentContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // IsCcontentContext differentiates from other interfaces. - IsCcontentContext() -} - -type CcontentContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCcontentContext() *CcontentContext { - var p = new(CcontentContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = RFC5322ParserRULE_ccontent - return p -} - -func (*CcontentContext) IsCcontentContext() {} - -func NewCcontentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CcontentContext { - var p = new(CcontentContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = RFC5322ParserRULE_ccontent - - return p -} - -func (s *CcontentContext) GetParser() antlr.Parser { return s.parser } - -func (s *CcontentContext) Ctext() ICtextContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*ICtextContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(ICtextContext) -} - -func (s *CcontentContext) QuotedPair() IQuotedPairContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*IQuotedPairContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IQuotedPairContext) -} - -func (s *CcontentContext) Comment() ICommentContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*ICommentContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(ICommentContext) -} - -func (s *CcontentContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *CcontentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *CcontentContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.EnterCcontent(s) - } -} - -func (s *CcontentContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.ExitCcontent(s) - } -} - -func (p *RFC5322Parser) Ccontent() (localctx ICcontentContext) { - localctx = NewCcontentContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 8, RFC5322ParserRULE_ccontent) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(196) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case RFC5322ParserU_01_08, RFC5322ParserU_0B, RFC5322ParserU_0C, RFC5322ParserU_0E_1F, RFC5322ParserExclamation, RFC5322ParserDQuote, RFC5322ParserHash, RFC5322ParserDollar, RFC5322ParserPercent, RFC5322ParserAmpersand, RFC5322ParserSQuote, RFC5322ParserAsterisk, RFC5322ParserPlus, RFC5322ParserComma, RFC5322ParserMinus, RFC5322ParserPeriod, RFC5322ParserSlash, RFC5322ParserDigit, RFC5322ParserColon, RFC5322ParserSemicolon, RFC5322ParserLess, RFC5322ParserEqual, RFC5322ParserGreater, RFC5322ParserQuestion, RFC5322ParserAt, RFC5322ParserLBracket, RFC5322ParserRBracket, RFC5322ParserCaret, RFC5322ParserUnderscore, RFC5322ParserBacktick, RFC5322ParserLCurly, RFC5322ParserPipe, RFC5322ParserRCurly, RFC5322ParserTilde, RFC5322ParserDelete, RFC5322ParserUTF8NonAscii, RFC5322ParserA, RFC5322ParserB, RFC5322ParserC, RFC5322ParserD, RFC5322ParserE, RFC5322ParserF, RFC5322ParserG, RFC5322ParserH, RFC5322ParserI, RFC5322ParserJ, RFC5322ParserK, RFC5322ParserL, RFC5322ParserM, RFC5322ParserN, RFC5322ParserO, RFC5322ParserP, RFC5322ParserQ, RFC5322ParserR, RFC5322ParserS, RFC5322ParserT, RFC5322ParserU, RFC5322ParserV, RFC5322ParserW, RFC5322ParserX, RFC5322ParserY, RFC5322ParserZ: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(193) - p.Ctext() - } - - case RFC5322ParserBackslash: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(194) - p.QuotedPair() - } - - case RFC5322ParserLParens: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(195) - p.Comment() - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// ICommentContext is an interface to support dynamic dispatch. -type ICommentContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // IsCommentContext differentiates from other interfaces. - IsCommentContext() -} - -type CommentContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCommentContext() *CommentContext { - var p = new(CommentContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = RFC5322ParserRULE_comment - return p -} - -func (*CommentContext) IsCommentContext() {} - -func NewCommentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CommentContext { - var p = new(CommentContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = RFC5322ParserRULE_comment - - return p -} - -func (s *CommentContext) GetParser() antlr.Parser { return s.parser } - -func (s *CommentContext) LParens() antlr.TerminalNode { - return s.GetToken(RFC5322ParserLParens, 0) -} - -func (s *CommentContext) RParens() antlr.TerminalNode { - return s.GetToken(RFC5322ParserRParens, 0) -} - -func (s *CommentContext) AllCcontent() []ICcontentContext { - var ts = s.GetTypedRuleContexts(reflect.TypeOf((*ICcontentContext)(nil)).Elem()) - var tst = make([]ICcontentContext, len(ts)) - - for i, t := range ts { - if t != nil { - tst[i] = t.(ICcontentContext) - } - } - - return tst -} - -func (s *CommentContext) Ccontent(i int) ICcontentContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*ICcontentContext)(nil)).Elem(), i) - - if t == nil { - return nil - } - - return t.(ICcontentContext) -} - -func (s *CommentContext) AllFws() []IFwsContext { - var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IFwsContext)(nil)).Elem()) - var tst = make([]IFwsContext, len(ts)) - - for i, t := range ts { - if t != nil { - tst[i] = t.(IFwsContext) - } - } - - return tst -} - -func (s *CommentContext) Fws(i int) IFwsContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*IFwsContext)(nil)).Elem(), i) - - if t == nil { - return nil - } - - return t.(IFwsContext) -} - -func (s *CommentContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *CommentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *CommentContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.EnterComment(s) - } -} - -func (s *CommentContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(RFC5322ParserListener); ok { - listenerT.ExitComment(s) - } -} - -func (p *RFC5322Parser) Comment() (localctx ICommentContext) { - localctx = NewCommentContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 10, RFC5322ParserRULE_comment) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - var _alt int - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(198) - p.Match(RFC5322ParserLParens) - } - p.SetState(205) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 9, p.GetParserRuleContext()) - - for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { - if _alt == 1 { - p.SetState(200) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if ((_la)&-(0x1f+1)) == 0 && ((1<. - -// Code generated from RFC5322Parser.g4 by ANTLR 4.8. DO NOT EDIT. - -package parser // RFC5322Parser - -import "github.com/antlr/antlr4/runtime/Go/antlr" - -// BaseRFC5322ParserListener is a complete listener for a parse tree produced by RFC5322Parser. -type BaseRFC5322ParserListener struct{} - -var _ RFC5322ParserListener = &BaseRFC5322ParserListener{} - -// VisitTerminal is called when a terminal node is visited. -func (s *BaseRFC5322ParserListener) VisitTerminal(node antlr.TerminalNode) {} - -// VisitErrorNode is called when an error node is visited. -func (s *BaseRFC5322ParserListener) VisitErrorNode(node antlr.ErrorNode) {} - -// EnterEveryRule is called when any rule is entered. -func (s *BaseRFC5322ParserListener) EnterEveryRule(ctx antlr.ParserRuleContext) {} - -// ExitEveryRule is called when any rule is exited. -func (s *BaseRFC5322ParserListener) ExitEveryRule(ctx antlr.ParserRuleContext) {} - -// EnterQuotedChar is called when production quotedChar is entered. -func (s *BaseRFC5322ParserListener) EnterQuotedChar(ctx *QuotedCharContext) {} - -// ExitQuotedChar is called when production quotedChar is exited. -func (s *BaseRFC5322ParserListener) ExitQuotedChar(ctx *QuotedCharContext) {} - -// EnterQuotedPair is called when production quotedPair is entered. -func (s *BaseRFC5322ParserListener) EnterQuotedPair(ctx *QuotedPairContext) {} - -// ExitQuotedPair is called when production quotedPair is exited. -func (s *BaseRFC5322ParserListener) ExitQuotedPair(ctx *QuotedPairContext) {} - -// EnterFws is called when production fws is entered. -func (s *BaseRFC5322ParserListener) EnterFws(ctx *FwsContext) {} - -// ExitFws is called when production fws is exited. -func (s *BaseRFC5322ParserListener) ExitFws(ctx *FwsContext) {} - -// EnterCtext is called when production ctext is entered. -func (s *BaseRFC5322ParserListener) EnterCtext(ctx *CtextContext) {} - -// ExitCtext is called when production ctext is exited. -func (s *BaseRFC5322ParserListener) ExitCtext(ctx *CtextContext) {} - -// EnterCcontent is called when production ccontent is entered. -func (s *BaseRFC5322ParserListener) EnterCcontent(ctx *CcontentContext) {} - -// ExitCcontent is called when production ccontent is exited. -func (s *BaseRFC5322ParserListener) ExitCcontent(ctx *CcontentContext) {} - -// EnterComment is called when production comment is entered. -func (s *BaseRFC5322ParserListener) EnterComment(ctx *CommentContext) {} - -// ExitComment is called when production comment is exited. -func (s *BaseRFC5322ParserListener) ExitComment(ctx *CommentContext) {} - -// EnterCfws is called when production cfws is entered. -func (s *BaseRFC5322ParserListener) EnterCfws(ctx *CfwsContext) {} - -// ExitCfws is called when production cfws is exited. -func (s *BaseRFC5322ParserListener) ExitCfws(ctx *CfwsContext) {} - -// EnterAtext is called when production atext is entered. -func (s *BaseRFC5322ParserListener) EnterAtext(ctx *AtextContext) {} - -// ExitAtext is called when production atext is exited. -func (s *BaseRFC5322ParserListener) ExitAtext(ctx *AtextContext) {} - -// EnterAtom is called when production atom is entered. -func (s *BaseRFC5322ParserListener) EnterAtom(ctx *AtomContext) {} - -// ExitAtom is called when production atom is exited. -func (s *BaseRFC5322ParserListener) ExitAtom(ctx *AtomContext) {} - -// EnterDotAtom is called when production dotAtom is entered. -func (s *BaseRFC5322ParserListener) EnterDotAtom(ctx *DotAtomContext) {} - -// ExitDotAtom is called when production dotAtom is exited. -func (s *BaseRFC5322ParserListener) ExitDotAtom(ctx *DotAtomContext) {} - -// EnterQtext is called when production qtext is entered. -func (s *BaseRFC5322ParserListener) EnterQtext(ctx *QtextContext) {} - -// ExitQtext is called when production qtext is exited. -func (s *BaseRFC5322ParserListener) ExitQtext(ctx *QtextContext) {} - -// EnterQuotedContent is called when production quotedContent is entered. -func (s *BaseRFC5322ParserListener) EnterQuotedContent(ctx *QuotedContentContext) {} - -// ExitQuotedContent is called when production quotedContent is exited. -func (s *BaseRFC5322ParserListener) ExitQuotedContent(ctx *QuotedContentContext) {} - -// EnterQuotedValue is called when production quotedValue is entered. -func (s *BaseRFC5322ParserListener) EnterQuotedValue(ctx *QuotedValueContext) {} - -// ExitQuotedValue is called when production quotedValue is exited. -func (s *BaseRFC5322ParserListener) ExitQuotedValue(ctx *QuotedValueContext) {} - -// EnterQuotedString is called when production quotedString is entered. -func (s *BaseRFC5322ParserListener) EnterQuotedString(ctx *QuotedStringContext) {} - -// ExitQuotedString is called when production quotedString is exited. -func (s *BaseRFC5322ParserListener) ExitQuotedString(ctx *QuotedStringContext) {} - -// EnterWord is called when production word is entered. -func (s *BaseRFC5322ParserListener) EnterWord(ctx *WordContext) {} - -// ExitWord is called when production word is exited. -func (s *BaseRFC5322ParserListener) ExitWord(ctx *WordContext) {} - -// EnterDateTime is called when production dateTime is entered. -func (s *BaseRFC5322ParserListener) EnterDateTime(ctx *DateTimeContext) {} - -// ExitDateTime is called when production dateTime is exited. -func (s *BaseRFC5322ParserListener) ExitDateTime(ctx *DateTimeContext) {} - -// EnterDayOfweek is called when production dayOfweek is entered. -func (s *BaseRFC5322ParserListener) EnterDayOfweek(ctx *DayOfweekContext) {} - -// ExitDayOfweek is called when production dayOfweek is exited. -func (s *BaseRFC5322ParserListener) ExitDayOfweek(ctx *DayOfweekContext) {} - -// EnterDayName is called when production dayName is entered. -func (s *BaseRFC5322ParserListener) EnterDayName(ctx *DayNameContext) {} - -// ExitDayName is called when production dayName is exited. -func (s *BaseRFC5322ParserListener) ExitDayName(ctx *DayNameContext) {} - -// EnterDay is called when production day is entered. -func (s *BaseRFC5322ParserListener) EnterDay(ctx *DayContext) {} - -// ExitDay is called when production day is exited. -func (s *BaseRFC5322ParserListener) ExitDay(ctx *DayContext) {} - -// EnterMonth is called when production month is entered. -func (s *BaseRFC5322ParserListener) EnterMonth(ctx *MonthContext) {} - -// ExitMonth is called when production month is exited. -func (s *BaseRFC5322ParserListener) ExitMonth(ctx *MonthContext) {} - -// EnterYear is called when production year is entered. -func (s *BaseRFC5322ParserListener) EnterYear(ctx *YearContext) {} - -// ExitYear is called when production year is exited. -func (s *BaseRFC5322ParserListener) ExitYear(ctx *YearContext) {} - -// EnterHour is called when production hour is entered. -func (s *BaseRFC5322ParserListener) EnterHour(ctx *HourContext) {} - -// ExitHour is called when production hour is exited. -func (s *BaseRFC5322ParserListener) ExitHour(ctx *HourContext) {} - -// EnterMinute is called when production minute is entered. -func (s *BaseRFC5322ParserListener) EnterMinute(ctx *MinuteContext) {} - -// ExitMinute is called when production minute is exited. -func (s *BaseRFC5322ParserListener) ExitMinute(ctx *MinuteContext) {} - -// EnterSecond is called when production second is entered. -func (s *BaseRFC5322ParserListener) EnterSecond(ctx *SecondContext) {} - -// ExitSecond is called when production second is exited. -func (s *BaseRFC5322ParserListener) ExitSecond(ctx *SecondContext) {} - -// EnterOffset is called when production offset is entered. -func (s *BaseRFC5322ParserListener) EnterOffset(ctx *OffsetContext) {} - -// ExitOffset is called when production offset is exited. -func (s *BaseRFC5322ParserListener) ExitOffset(ctx *OffsetContext) {} - -// EnterZone is called when production zone is entered. -func (s *BaseRFC5322ParserListener) EnterZone(ctx *ZoneContext) {} - -// ExitZone is called when production zone is exited. -func (s *BaseRFC5322ParserListener) ExitZone(ctx *ZoneContext) {} - -// EnterAddress is called when production address is entered. -func (s *BaseRFC5322ParserListener) EnterAddress(ctx *AddressContext) {} - -// ExitAddress is called when production address is exited. -func (s *BaseRFC5322ParserListener) ExitAddress(ctx *AddressContext) {} - -// EnterMailbox is called when production mailbox is entered. -func (s *BaseRFC5322ParserListener) EnterMailbox(ctx *MailboxContext) {} - -// ExitMailbox is called when production mailbox is exited. -func (s *BaseRFC5322ParserListener) ExitMailbox(ctx *MailboxContext) {} - -// EnterNameAddr is called when production nameAddr is entered. -func (s *BaseRFC5322ParserListener) EnterNameAddr(ctx *NameAddrContext) {} - -// ExitNameAddr is called when production nameAddr is exited. -func (s *BaseRFC5322ParserListener) ExitNameAddr(ctx *NameAddrContext) {} - -// EnterAngleAddr is called when production angleAddr is entered. -func (s *BaseRFC5322ParserListener) EnterAngleAddr(ctx *AngleAddrContext) {} - -// ExitAngleAddr is called when production angleAddr is exited. -func (s *BaseRFC5322ParserListener) ExitAngleAddr(ctx *AngleAddrContext) {} - -// EnterGroup is called when production group is entered. -func (s *BaseRFC5322ParserListener) EnterGroup(ctx *GroupContext) {} - -// ExitGroup is called when production group is exited. -func (s *BaseRFC5322ParserListener) ExitGroup(ctx *GroupContext) {} - -// EnterDisplayName is called when production displayName is entered. -func (s *BaseRFC5322ParserListener) EnterDisplayName(ctx *DisplayNameContext) {} - -// ExitDisplayName is called when production displayName is exited. -func (s *BaseRFC5322ParserListener) ExitDisplayName(ctx *DisplayNameContext) {} - -// EnterMailboxList is called when production mailboxList is entered. -func (s *BaseRFC5322ParserListener) EnterMailboxList(ctx *MailboxListContext) {} - -// ExitMailboxList is called when production mailboxList is exited. -func (s *BaseRFC5322ParserListener) ExitMailboxList(ctx *MailboxListContext) {} - -// EnterAddressList is called when production addressList is entered. -func (s *BaseRFC5322ParserListener) EnterAddressList(ctx *AddressListContext) {} - -// ExitAddressList is called when production addressList is exited. -func (s *BaseRFC5322ParserListener) ExitAddressList(ctx *AddressListContext) {} - -// EnterGroupList is called when production groupList is entered. -func (s *BaseRFC5322ParserListener) EnterGroupList(ctx *GroupListContext) {} - -// ExitGroupList is called when production groupList is exited. -func (s *BaseRFC5322ParserListener) ExitGroupList(ctx *GroupListContext) {} - -// EnterAddrSpec is called when production addrSpec is entered. -func (s *BaseRFC5322ParserListener) EnterAddrSpec(ctx *AddrSpecContext) {} - -// ExitAddrSpec is called when production addrSpec is exited. -func (s *BaseRFC5322ParserListener) ExitAddrSpec(ctx *AddrSpecContext) {} - -// EnterLocalPart is called when production localPart is entered. -func (s *BaseRFC5322ParserListener) EnterLocalPart(ctx *LocalPartContext) {} - -// ExitLocalPart is called when production localPart is exited. -func (s *BaseRFC5322ParserListener) ExitLocalPart(ctx *LocalPartContext) {} - -// EnterPort is called when production port is entered. -func (s *BaseRFC5322ParserListener) EnterPort(ctx *PortContext) {} - -// ExitPort is called when production port is exited. -func (s *BaseRFC5322ParserListener) ExitPort(ctx *PortContext) {} - -// EnterDomain is called when production domain is entered. -func (s *BaseRFC5322ParserListener) EnterDomain(ctx *DomainContext) {} - -// ExitDomain is called when production domain is exited. -func (s *BaseRFC5322ParserListener) ExitDomain(ctx *DomainContext) {} - -// EnterDomainLiteral is called when production domainLiteral is entered. -func (s *BaseRFC5322ParserListener) EnterDomainLiteral(ctx *DomainLiteralContext) {} - -// ExitDomainLiteral is called when production domainLiteral is exited. -func (s *BaseRFC5322ParserListener) ExitDomainLiteral(ctx *DomainLiteralContext) {} - -// EnterDtext is called when production dtext is entered. -func (s *BaseRFC5322ParserListener) EnterDtext(ctx *DtextContext) {} - -// ExitDtext is called when production dtext is exited. -func (s *BaseRFC5322ParserListener) ExitDtext(ctx *DtextContext) {} - -// EnterObsNoWSCTL is called when production obsNoWSCTL is entered. -func (s *BaseRFC5322ParserListener) EnterObsNoWSCTL(ctx *ObsNoWSCTLContext) {} - -// ExitObsNoWSCTL is called when production obsNoWSCTL is exited. -func (s *BaseRFC5322ParserListener) ExitObsNoWSCTL(ctx *ObsNoWSCTLContext) {} - -// EnterObsCtext is called when production obsCtext is entered. -func (s *BaseRFC5322ParserListener) EnterObsCtext(ctx *ObsCtextContext) {} - -// ExitObsCtext is called when production obsCtext is exited. -func (s *BaseRFC5322ParserListener) ExitObsCtext(ctx *ObsCtextContext) {} - -// EnterObsQtext is called when production obsQtext is entered. -func (s *BaseRFC5322ParserListener) EnterObsQtext(ctx *ObsQtextContext) {} - -// ExitObsQtext is called when production obsQtext is exited. -func (s *BaseRFC5322ParserListener) ExitObsQtext(ctx *ObsQtextContext) {} - -// EnterObsQP is called when production obsQP is entered. -func (s *BaseRFC5322ParserListener) EnterObsQP(ctx *ObsQPContext) {} - -// ExitObsQP is called when production obsQP is exited. -func (s *BaseRFC5322ParserListener) ExitObsQP(ctx *ObsQPContext) {} - -// EnterObsFWS is called when production obsFWS is entered. -func (s *BaseRFC5322ParserListener) EnterObsFWS(ctx *ObsFWSContext) {} - -// ExitObsFWS is called when production obsFWS is exited. -func (s *BaseRFC5322ParserListener) ExitObsFWS(ctx *ObsFWSContext) {} - -// EnterObsZone is called when production obsZone is entered. -func (s *BaseRFC5322ParserListener) EnterObsZone(ctx *ObsZoneContext) {} - -// ExitObsZone is called when production obsZone is exited. -func (s *BaseRFC5322ParserListener) ExitObsZone(ctx *ObsZoneContext) {} - -// EnterObsAngleAddr is called when production obsAngleAddr is entered. -func (s *BaseRFC5322ParserListener) EnterObsAngleAddr(ctx *ObsAngleAddrContext) {} - -// ExitObsAngleAddr is called when production obsAngleAddr is exited. -func (s *BaseRFC5322ParserListener) ExitObsAngleAddr(ctx *ObsAngleAddrContext) {} - -// EnterObsRoute is called when production obsRoute is entered. -func (s *BaseRFC5322ParserListener) EnterObsRoute(ctx *ObsRouteContext) {} - -// ExitObsRoute is called when production obsRoute is exited. -func (s *BaseRFC5322ParserListener) ExitObsRoute(ctx *ObsRouteContext) {} - -// EnterObsDomainList is called when production obsDomainList is entered. -func (s *BaseRFC5322ParserListener) EnterObsDomainList(ctx *ObsDomainListContext) {} - -// ExitObsDomainList is called when production obsDomainList is exited. -func (s *BaseRFC5322ParserListener) ExitObsDomainList(ctx *ObsDomainListContext) {} - -// EnterObsMboxList is called when production obsMboxList is entered. -func (s *BaseRFC5322ParserListener) EnterObsMboxList(ctx *ObsMboxListContext) {} - -// ExitObsMboxList is called when production obsMboxList is exited. -func (s *BaseRFC5322ParserListener) ExitObsMboxList(ctx *ObsMboxListContext) {} - -// EnterObsAddrList is called when production obsAddrList is entered. -func (s *BaseRFC5322ParserListener) EnterObsAddrList(ctx *ObsAddrListContext) {} - -// ExitObsAddrList is called when production obsAddrList is exited. -func (s *BaseRFC5322ParserListener) ExitObsAddrList(ctx *ObsAddrListContext) {} - -// EnterObsGroupList is called when production obsGroupList is entered. -func (s *BaseRFC5322ParserListener) EnterObsGroupList(ctx *ObsGroupListContext) {} - -// ExitObsGroupList is called when production obsGroupList is exited. -func (s *BaseRFC5322ParserListener) ExitObsGroupList(ctx *ObsGroupListContext) {} - -// EnterObsLocalPart is called when production obsLocalPart is entered. -func (s *BaseRFC5322ParserListener) EnterObsLocalPart(ctx *ObsLocalPartContext) {} - -// ExitObsLocalPart is called when production obsLocalPart is exited. -func (s *BaseRFC5322ParserListener) ExitObsLocalPart(ctx *ObsLocalPartContext) {} - -// EnterObsDomain is called when production obsDomain is entered. -func (s *BaseRFC5322ParserListener) EnterObsDomain(ctx *ObsDomainContext) {} - -// ExitObsDomain is called when production obsDomain is exited. -func (s *BaseRFC5322ParserListener) ExitObsDomain(ctx *ObsDomainContext) {} - -// EnterEncodedWord is called when production encodedWord is entered. -func (s *BaseRFC5322ParserListener) EnterEncodedWord(ctx *EncodedWordContext) {} - -// ExitEncodedWord is called when production encodedWord is exited. -func (s *BaseRFC5322ParserListener) ExitEncodedWord(ctx *EncodedWordContext) {} - -// EnterCharset is called when production charset is entered. -func (s *BaseRFC5322ParserListener) EnterCharset(ctx *CharsetContext) {} - -// ExitCharset is called when production charset is exited. -func (s *BaseRFC5322ParserListener) ExitCharset(ctx *CharsetContext) {} - -// EnterEncoding is called when production encoding is entered. -func (s *BaseRFC5322ParserListener) EnterEncoding(ctx *EncodingContext) {} - -// ExitEncoding is called when production encoding is exited. -func (s *BaseRFC5322ParserListener) ExitEncoding(ctx *EncodingContext) {} - -// EnterToken is called when production token is entered. -func (s *BaseRFC5322ParserListener) EnterToken(ctx *TokenContext) {} - -// ExitToken is called when production token is exited. -func (s *BaseRFC5322ParserListener) ExitToken(ctx *TokenContext) {} - -// EnterTokenChar is called when production tokenChar is entered. -func (s *BaseRFC5322ParserListener) EnterTokenChar(ctx *TokenCharContext) {} - -// ExitTokenChar is called when production tokenChar is exited. -func (s *BaseRFC5322ParserListener) ExitTokenChar(ctx *TokenCharContext) {} - -// EnterEncodedText is called when production encodedText is entered. -func (s *BaseRFC5322ParserListener) EnterEncodedText(ctx *EncodedTextContext) {} - -// ExitEncodedText is called when production encodedText is exited. -func (s *BaseRFC5322ParserListener) ExitEncodedText(ctx *EncodedTextContext) {} - -// EnterEncodedChar is called when production encodedChar is entered. -func (s *BaseRFC5322ParserListener) EnterEncodedChar(ctx *EncodedCharContext) {} - -// ExitEncodedChar is called when production encodedChar is exited. -func (s *BaseRFC5322ParserListener) ExitEncodedChar(ctx *EncodedCharContext) {} - -// EnterCrlf is called when production crlf is entered. -func (s *BaseRFC5322ParserListener) EnterCrlf(ctx *CrlfContext) {} - -// ExitCrlf is called when production crlf is exited. -func (s *BaseRFC5322ParserListener) ExitCrlf(ctx *CrlfContext) {} - -// EnterWsp is called when production wsp is entered. -func (s *BaseRFC5322ParserListener) EnterWsp(ctx *WspContext) {} - -// ExitWsp is called when production wsp is exited. -func (s *BaseRFC5322ParserListener) ExitWsp(ctx *WspContext) {} - -// EnterVchar is called when production vchar is entered. -func (s *BaseRFC5322ParserListener) EnterVchar(ctx *VcharContext) {} - -// ExitVchar is called when production vchar is exited. -func (s *BaseRFC5322ParserListener) ExitVchar(ctx *VcharContext) {} - -// EnterAlpha is called when production alpha is entered. -func (s *BaseRFC5322ParserListener) EnterAlpha(ctx *AlphaContext) {} - -// ExitAlpha is called when production alpha is exited. -func (s *BaseRFC5322ParserListener) ExitAlpha(ctx *AlphaContext) {} diff --git a/pkg/message/rfc5322/parser/rfc5322parser_listener.go b/pkg/message/rfc5322/parser/rfc5322parser_listener.go deleted file mode 100644 index 42c677db..00000000 --- a/pkg/message/rfc5322/parser/rfc5322parser_listener.go +++ /dev/null @@ -1,423 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -// Code generated from RFC5322Parser.g4 by ANTLR 4.8. DO NOT EDIT. - -package parser // RFC5322Parser - -import "github.com/antlr/antlr4/runtime/Go/antlr" - -// RFC5322ParserListener is a complete listener for a parse tree produced by RFC5322Parser. -type RFC5322ParserListener interface { - antlr.ParseTreeListener - - // EnterQuotedChar is called when entering the quotedChar production. - EnterQuotedChar(c *QuotedCharContext) - - // EnterQuotedPair is called when entering the quotedPair production. - EnterQuotedPair(c *QuotedPairContext) - - // EnterFws is called when entering the fws production. - EnterFws(c *FwsContext) - - // EnterCtext is called when entering the ctext production. - EnterCtext(c *CtextContext) - - // EnterCcontent is called when entering the ccontent production. - EnterCcontent(c *CcontentContext) - - // EnterComment is called when entering the comment production. - EnterComment(c *CommentContext) - - // EnterCfws is called when entering the cfws production. - EnterCfws(c *CfwsContext) - - // EnterAtext is called when entering the atext production. - EnterAtext(c *AtextContext) - - // EnterAtom is called when entering the atom production. - EnterAtom(c *AtomContext) - - // EnterDotAtom is called when entering the dotAtom production. - EnterDotAtom(c *DotAtomContext) - - // EnterQtext is called when entering the qtext production. - EnterQtext(c *QtextContext) - - // EnterQuotedContent is called when entering the quotedContent production. - EnterQuotedContent(c *QuotedContentContext) - - // EnterQuotedValue is called when entering the quotedValue production. - EnterQuotedValue(c *QuotedValueContext) - - // EnterQuotedString is called when entering the quotedString production. - EnterQuotedString(c *QuotedStringContext) - - // EnterWord is called when entering the word production. - EnterWord(c *WordContext) - - // EnterDateTime is called when entering the dateTime production. - EnterDateTime(c *DateTimeContext) - - // EnterDayOfweek is called when entering the dayOfweek production. - EnterDayOfweek(c *DayOfweekContext) - - // EnterDayName is called when entering the dayName production. - EnterDayName(c *DayNameContext) - - // EnterDay is called when entering the day production. - EnterDay(c *DayContext) - - // EnterMonth is called when entering the month production. - EnterMonth(c *MonthContext) - - // EnterYear is called when entering the year production. - EnterYear(c *YearContext) - - // EnterHour is called when entering the hour production. - EnterHour(c *HourContext) - - // EnterMinute is called when entering the minute production. - EnterMinute(c *MinuteContext) - - // EnterSecond is called when entering the second production. - EnterSecond(c *SecondContext) - - // EnterOffset is called when entering the offset production. - EnterOffset(c *OffsetContext) - - // EnterZone is called when entering the zone production. - EnterZone(c *ZoneContext) - - // EnterAddress is called when entering the address production. - EnterAddress(c *AddressContext) - - // EnterMailbox is called when entering the mailbox production. - EnterMailbox(c *MailboxContext) - - // EnterNameAddr is called when entering the nameAddr production. - EnterNameAddr(c *NameAddrContext) - - // EnterAngleAddr is called when entering the angleAddr production. - EnterAngleAddr(c *AngleAddrContext) - - // EnterGroup is called when entering the group production. - EnterGroup(c *GroupContext) - - // EnterDisplayName is called when entering the displayName production. - EnterDisplayName(c *DisplayNameContext) - - // EnterMailboxList is called when entering the mailboxList production. - EnterMailboxList(c *MailboxListContext) - - // EnterAddressList is called when entering the addressList production. - EnterAddressList(c *AddressListContext) - - // EnterGroupList is called when entering the groupList production. - EnterGroupList(c *GroupListContext) - - // EnterAddrSpec is called when entering the addrSpec production. - EnterAddrSpec(c *AddrSpecContext) - - // EnterLocalPart is called when entering the localPart production. - EnterLocalPart(c *LocalPartContext) - - // EnterPort is called when entering the port production. - EnterPort(c *PortContext) - - // EnterDomain is called when entering the domain production. - EnterDomain(c *DomainContext) - - // EnterDomainLiteral is called when entering the domainLiteral production. - EnterDomainLiteral(c *DomainLiteralContext) - - // EnterDtext is called when entering the dtext production. - EnterDtext(c *DtextContext) - - // EnterObsNoWSCTL is called when entering the obsNoWSCTL production. - EnterObsNoWSCTL(c *ObsNoWSCTLContext) - - // EnterObsCtext is called when entering the obsCtext production. - EnterObsCtext(c *ObsCtextContext) - - // EnterObsQtext is called when entering the obsQtext production. - EnterObsQtext(c *ObsQtextContext) - - // EnterObsQP is called when entering the obsQP production. - EnterObsQP(c *ObsQPContext) - - // EnterObsFWS is called when entering the obsFWS production. - EnterObsFWS(c *ObsFWSContext) - - // EnterObsZone is called when entering the obsZone production. - EnterObsZone(c *ObsZoneContext) - - // EnterObsAngleAddr is called when entering the obsAngleAddr production. - EnterObsAngleAddr(c *ObsAngleAddrContext) - - // EnterObsRoute is called when entering the obsRoute production. - EnterObsRoute(c *ObsRouteContext) - - // EnterObsDomainList is called when entering the obsDomainList production. - EnterObsDomainList(c *ObsDomainListContext) - - // EnterObsMboxList is called when entering the obsMboxList production. - EnterObsMboxList(c *ObsMboxListContext) - - // EnterObsAddrList is called when entering the obsAddrList production. - EnterObsAddrList(c *ObsAddrListContext) - - // EnterObsGroupList is called when entering the obsGroupList production. - EnterObsGroupList(c *ObsGroupListContext) - - // EnterObsLocalPart is called when entering the obsLocalPart production. - EnterObsLocalPart(c *ObsLocalPartContext) - - // EnterObsDomain is called when entering the obsDomain production. - EnterObsDomain(c *ObsDomainContext) - - // EnterEncodedWord is called when entering the encodedWord production. - EnterEncodedWord(c *EncodedWordContext) - - // EnterCharset is called when entering the charset production. - EnterCharset(c *CharsetContext) - - // EnterEncoding is called when entering the encoding production. - EnterEncoding(c *EncodingContext) - - // EnterToken is called when entering the token production. - EnterToken(c *TokenContext) - - // EnterTokenChar is called when entering the tokenChar production. - EnterTokenChar(c *TokenCharContext) - - // EnterEncodedText is called when entering the encodedText production. - EnterEncodedText(c *EncodedTextContext) - - // EnterEncodedChar is called when entering the encodedChar production. - EnterEncodedChar(c *EncodedCharContext) - - // EnterCrlf is called when entering the crlf production. - EnterCrlf(c *CrlfContext) - - // EnterWsp is called when entering the wsp production. - EnterWsp(c *WspContext) - - // EnterVchar is called when entering the vchar production. - EnterVchar(c *VcharContext) - - // EnterAlpha is called when entering the alpha production. - EnterAlpha(c *AlphaContext) - - // ExitQuotedChar is called when exiting the quotedChar production. - ExitQuotedChar(c *QuotedCharContext) - - // ExitQuotedPair is called when exiting the quotedPair production. - ExitQuotedPair(c *QuotedPairContext) - - // ExitFws is called when exiting the fws production. - ExitFws(c *FwsContext) - - // ExitCtext is called when exiting the ctext production. - ExitCtext(c *CtextContext) - - // ExitCcontent is called when exiting the ccontent production. - ExitCcontent(c *CcontentContext) - - // ExitComment is called when exiting the comment production. - ExitComment(c *CommentContext) - - // ExitCfws is called when exiting the cfws production. - ExitCfws(c *CfwsContext) - - // ExitAtext is called when exiting the atext production. - ExitAtext(c *AtextContext) - - // ExitAtom is called when exiting the atom production. - ExitAtom(c *AtomContext) - - // ExitDotAtom is called when exiting the dotAtom production. - ExitDotAtom(c *DotAtomContext) - - // ExitQtext is called when exiting the qtext production. - ExitQtext(c *QtextContext) - - // ExitQuotedContent is called when exiting the quotedContent production. - ExitQuotedContent(c *QuotedContentContext) - - // ExitQuotedValue is called when exiting the quotedValue production. - ExitQuotedValue(c *QuotedValueContext) - - // ExitQuotedString is called when exiting the quotedString production. - ExitQuotedString(c *QuotedStringContext) - - // ExitWord is called when exiting the word production. - ExitWord(c *WordContext) - - // ExitDateTime is called when exiting the dateTime production. - ExitDateTime(c *DateTimeContext) - - // ExitDayOfweek is called when exiting the dayOfweek production. - ExitDayOfweek(c *DayOfweekContext) - - // ExitDayName is called when exiting the dayName production. - ExitDayName(c *DayNameContext) - - // ExitDay is called when exiting the day production. - ExitDay(c *DayContext) - - // ExitMonth is called when exiting the month production. - ExitMonth(c *MonthContext) - - // ExitYear is called when exiting the year production. - ExitYear(c *YearContext) - - // ExitHour is called when exiting the hour production. - ExitHour(c *HourContext) - - // ExitMinute is called when exiting the minute production. - ExitMinute(c *MinuteContext) - - // ExitSecond is called when exiting the second production. - ExitSecond(c *SecondContext) - - // ExitOffset is called when exiting the offset production. - ExitOffset(c *OffsetContext) - - // ExitZone is called when exiting the zone production. - ExitZone(c *ZoneContext) - - // ExitAddress is called when exiting the address production. - ExitAddress(c *AddressContext) - - // ExitMailbox is called when exiting the mailbox production. - ExitMailbox(c *MailboxContext) - - // ExitNameAddr is called when exiting the nameAddr production. - ExitNameAddr(c *NameAddrContext) - - // ExitAngleAddr is called when exiting the angleAddr production. - ExitAngleAddr(c *AngleAddrContext) - - // ExitGroup is called when exiting the group production. - ExitGroup(c *GroupContext) - - // ExitDisplayName is called when exiting the displayName production. - ExitDisplayName(c *DisplayNameContext) - - // ExitMailboxList is called when exiting the mailboxList production. - ExitMailboxList(c *MailboxListContext) - - // ExitAddressList is called when exiting the addressList production. - ExitAddressList(c *AddressListContext) - - // ExitGroupList is called when exiting the groupList production. - ExitGroupList(c *GroupListContext) - - // ExitAddrSpec is called when exiting the addrSpec production. - ExitAddrSpec(c *AddrSpecContext) - - // ExitLocalPart is called when exiting the localPart production. - ExitLocalPart(c *LocalPartContext) - - // ExitPort is called when exiting the port production. - ExitPort(c *PortContext) - - // ExitDomain is called when exiting the domain production. - ExitDomain(c *DomainContext) - - // ExitDomainLiteral is called when exiting the domainLiteral production. - ExitDomainLiteral(c *DomainLiteralContext) - - // ExitDtext is called when exiting the dtext production. - ExitDtext(c *DtextContext) - - // ExitObsNoWSCTL is called when exiting the obsNoWSCTL production. - ExitObsNoWSCTL(c *ObsNoWSCTLContext) - - // ExitObsCtext is called when exiting the obsCtext production. - ExitObsCtext(c *ObsCtextContext) - - // ExitObsQtext is called when exiting the obsQtext production. - ExitObsQtext(c *ObsQtextContext) - - // ExitObsQP is called when exiting the obsQP production. - ExitObsQP(c *ObsQPContext) - - // ExitObsFWS is called when exiting the obsFWS production. - ExitObsFWS(c *ObsFWSContext) - - // ExitObsZone is called when exiting the obsZone production. - ExitObsZone(c *ObsZoneContext) - - // ExitObsAngleAddr is called when exiting the obsAngleAddr production. - ExitObsAngleAddr(c *ObsAngleAddrContext) - - // ExitObsRoute is called when exiting the obsRoute production. - ExitObsRoute(c *ObsRouteContext) - - // ExitObsDomainList is called when exiting the obsDomainList production. - ExitObsDomainList(c *ObsDomainListContext) - - // ExitObsMboxList is called when exiting the obsMboxList production. - ExitObsMboxList(c *ObsMboxListContext) - - // ExitObsAddrList is called when exiting the obsAddrList production. - ExitObsAddrList(c *ObsAddrListContext) - - // ExitObsGroupList is called when exiting the obsGroupList production. - ExitObsGroupList(c *ObsGroupListContext) - - // ExitObsLocalPart is called when exiting the obsLocalPart production. - ExitObsLocalPart(c *ObsLocalPartContext) - - // ExitObsDomain is called when exiting the obsDomain production. - ExitObsDomain(c *ObsDomainContext) - - // ExitEncodedWord is called when exiting the encodedWord production. - ExitEncodedWord(c *EncodedWordContext) - - // ExitCharset is called when exiting the charset production. - ExitCharset(c *CharsetContext) - - // ExitEncoding is called when exiting the encoding production. - ExitEncoding(c *EncodingContext) - - // ExitToken is called when exiting the token production. - ExitToken(c *TokenContext) - - // ExitTokenChar is called when exiting the tokenChar production. - ExitTokenChar(c *TokenCharContext) - - // ExitEncodedText is called when exiting the encodedText production. - ExitEncodedText(c *EncodedTextContext) - - // ExitEncodedChar is called when exiting the encodedChar production. - ExitEncodedChar(c *EncodedCharContext) - - // ExitCrlf is called when exiting the crlf production. - ExitCrlf(c *CrlfContext) - - // ExitWsp is called when exiting the wsp production. - ExitWsp(c *WspContext) - - // ExitVchar is called when exiting the vchar production. - ExitVchar(c *VcharContext) - - // ExitAlpha is called when exiting the alpha production. - ExitAlpha(c *AlphaContext) -} diff --git a/pkg/message/rfc5322/port.go b/pkg/message/rfc5322/port.go deleted file mode 100644 index bc536f68..00000000 --- a/pkg/message/rfc5322/port.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type port struct { - value string -} - -func (w *walker) EnterPort(ctx *parser.PortContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering port") - - w.enter(&port{ - value: ctx.GetText(), - }) -} - -func (w *walker) ExitPort(ctx *parser.PortContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting port") - - type withPort interface { - withPort(*port) - } - - res := w.exit().(*port) - - if parent, ok := w.parent().(withPort); ok { - parent.withPort(res) - } -} diff --git a/pkg/message/rfc5322/qtext.go b/pkg/message/rfc5322/qtext.go deleted file mode 100644 index b56c6b10..00000000 --- a/pkg/message/rfc5322/qtext.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type qtext struct { - value string -} - -func (w *walker) EnterQtext(ctx *parser.QtextContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering qtext") - - w.enter(&qtext{ - value: ctx.GetText(), - }) -} - -func (w *walker) ExitQtext(ctx *parser.QtextContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting qtext") - - type withQtext interface { - withQtext(*qtext) - } - - res := w.exit().(*qtext) - - if parent, ok := w.parent().(withQtext); ok { - parent.withQtext(res) - } -} diff --git a/pkg/message/rfc5322/quoted_char.go b/pkg/message/rfc5322/quoted_char.go deleted file mode 100644 index 11d71d2f..00000000 --- a/pkg/message/rfc5322/quoted_char.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type quotedChar struct { - value string -} - -func (w *walker) EnterQuotedChar(ctx *parser.QuotedCharContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering quotedChar") - - w.enter("edChar{ - value: ctx.GetText(), - }) -} - -func (w *walker) ExitQuotedChar(ctx *parser.QuotedCharContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting quotedChar") - - type withQuotedChar interface { - withQuotedChar(*quotedChar) - } - - res := w.exit().(*quotedChar) - - if parent, ok := w.parent().(withQuotedChar); ok { - parent.withQuotedChar(res) - } -} diff --git a/pkg/message/rfc5322/quoted_content.go b/pkg/message/rfc5322/quoted_content.go deleted file mode 100644 index c5de4eec..00000000 --- a/pkg/message/rfc5322/quoted_content.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type quotedContent struct { - value string -} - -func (c *quotedContent) withQtext(qtext *qtext) { - c.value = qtext.value -} - -func (c *quotedContent) withQuotedPair(quotedPair *quotedPair) { - c.value = quotedPair.value -} - -func (w *walker) EnterQuotedContent(ctx *parser.QuotedContentContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering quotedContent") - w.enter("edContent{}) -} - -func (w *walker) ExitQuotedContent(ctx *parser.QuotedContentContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting quotedContent") - - type withQuotedContent interface { - withQuotedContent(*quotedContent) - } - - res := w.exit().(*quotedContent) - - if parent, ok := w.parent().(withQuotedContent); ok { - parent.withQuotedContent(res) - } -} diff --git a/pkg/message/rfc5322/quoted_pair.go b/pkg/message/rfc5322/quoted_pair.go deleted file mode 100644 index 9a2f1520..00000000 --- a/pkg/message/rfc5322/quoted_pair.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type quotedPair struct { - value string -} - -func (p *quotedPair) withQuotedChar(quotedChar *quotedChar) { - p.value = quotedChar.value -} - -func (w *walker) EnterQuotedPair(ctx *parser.QuotedPairContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering quotedPair") - w.enter("edPair{}) -} - -func (w *walker) ExitQuotedPair(ctx *parser.QuotedPairContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting quotedPair") - - type withQuotedPair interface { - withQuotedPair(*quotedPair) - } - - res := w.exit().(*quotedPair) - - if parent, ok := w.parent().(withQuotedPair); ok { - parent.withQuotedPair(res) - } -} diff --git a/pkg/message/rfc5322/quoted_string.go b/pkg/message/rfc5322/quoted_string.go deleted file mode 100644 index ba70c0cb..00000000 --- a/pkg/message/rfc5322/quoted_string.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type quotedString struct { - value string -} - -func (s *quotedString) withQuotedValue(quotedValue *quotedValue) { - s.value = quotedValue.value -} - -func (w *walker) EnterQuotedString(ctx *parser.QuotedStringContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering quotedString") - w.enter("edString{}) -} - -func (w *walker) ExitQuotedString(ctx *parser.QuotedStringContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting quotedString") - - type withQuotedString interface { - withQuotedString(*quotedString) - } - - res := w.exit().(*quotedString) - - if parent, ok := w.parent().(withQuotedString); ok { - parent.withQuotedString(res) - } -} diff --git a/pkg/message/rfc5322/quoted_value.go b/pkg/message/rfc5322/quoted_value.go deleted file mode 100644 index f25f9ab0..00000000 --- a/pkg/message/rfc5322/quoted_value.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type quotedValue struct { - value string -} - -func (v *quotedValue) withFws(fws *fws) { - v.value += fws.value -} - -func (v *quotedValue) withQuotedContent(quotedContent *quotedContent) { - v.value += quotedContent.value -} - -func (w *walker) EnterQuotedValue(ctx *parser.QuotedValueContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering quotedValue") - w.enter("edValue{}) -} - -func (w *walker) ExitQuotedValue(ctx *parser.QuotedValueContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting quotedValue") - - type withQuotedValue interface { - withQuotedValue(*quotedValue) - } - - res := w.exit().(*quotedValue) - - if parent, ok := w.parent().(withQuotedValue); ok { - parent.withQuotedValue(res) - } -} diff --git a/pkg/message/rfc5322/second.go b/pkg/message/rfc5322/second.go deleted file mode 100644 index e29ba523..00000000 --- a/pkg/message/rfc5322/second.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "strconv" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type second struct { - value int -} - -func (w *walker) EnterSecond(ctx *parser.SecondContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering second") - - var text string - - for _, digit := range ctx.AllDigit() { - text += digit.GetText() - } - - val, err := strconv.Atoi(text) - if err != nil { - w.err = err - } - - w.enter(&second{ - value: val, - }) -} - -func (w *walker) ExitSecond(ctx *parser.SecondContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting second") - - type withSecond interface { - withSecond(*second) - } - - res := w.exit().(*second) - - if parent, ok := w.parent().(withSecond); ok { - parent.withSecond(res) - } -} diff --git a/pkg/message/rfc5322/tests.xml b/pkg/message/rfc5322/tests.xml deleted file mode 100644 index 7a113939..00000000 --- a/pkg/message/rfc5322/tests.xml +++ /dev/null @@ -1,1226 +0,0 @@ - - - - -

New test set

-

This test set is designed to replace and extend the coverage of the original set but with fewer tests.

-

Thanks to Michael Rushton (michael@squiloople.com) for starting this work and contributing tests 1-100

-
- -
- ISEMAIL_ERR - ISEMAIL_ERR_NODOMAIN - Michael Rushton - https://squiloople.com/tag/email/ - - -
test
- ISEMAIL_ERR - ISEMAIL_ERR_NODOMAIN - Michael Rushton - https://squiloople.com/tag/email/ -
- -
@
- ISEMAIL_ERR - ISEMAIL_ERR_NOLOCALPART - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@
- ISEMAIL_ERR - ISEMAIL_ERR_NODOMAIN - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@io
- io. currently has an MX-record (Feb 2011). Some DNS setups seem to find it, some don't. If you don't see the MX for io. then try setting your DNS server to 8.8.8.8 (the Google DNS server) - ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
@io
- io. currently has an MX-record (Feb 2011) - ISEMAIL_ERR - ISEMAIL_ERR_NOLOCALPART - Michael Rushton - https://squiloople.com/tag/email/ -
- -
@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_NOLOCALPART - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@iana.org
- ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@nominet.org.uk
- ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@about.museum
- ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
a@iana.org
- ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@e.com
- ISEMAIL_DNSWARN - ISEMAIL_DNSWARN_NO_RECORD - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@iana.a
- ISEMAIL_DNSWARN - ISEMAIL_DNSWARN_NO_RECORD - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test.test@iana.org
- ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
.test@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_DOT_START - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test.@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_DOT_END - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test..iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_CONSECUTIVEDOTS - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test_exa-mple.com
- ISEMAIL_ERR - ISEMAIL_ERR_NODOMAIN - Michael Rushton - https://squiloople.com/tag/email/ -
- -
!#$%&`*+/=?^`{|}~@iana.org
- ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test\@test@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
123@iana.org
- ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@123.com
- ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@iana.123
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_TLDNUMERIC - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@255.255.255.255
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_TLDNUMERIC - Michael Rushton - https://squiloople.com/tag/email/ -
- -
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@iana.org
- ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklmn@iana.org
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_LOCAL_TOOLONG - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.com
- ISEMAIL_DNSWARN - ISEMAIL_DNSWARN_NO_RECORD - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm.com
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_LABEL_TOOLONG - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@mason-dixon.com
- ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@-iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_DOMAINHYPHENSTART - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@iana-.com
- ISEMAIL_ERR - ISEMAIL_ERR_DOMAINHYPHENEND - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@c--n.com
- c--n.com currently has an MX-record (May 2011) - ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@iana.co-uk
- ISEMAIL_DNSWARN - ISEMAIL_DNSWARN_NO_RECORD - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@.iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_DOT_START - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@iana.org.
- ISEMAIL_ERR - ISEMAIL_ERR_DOT_END - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@iana..com
- ISEMAIL_ERR - ISEMAIL_ERR_CONSECUTIVEDOTS - Michael Rushton - https://squiloople.com/tag/email/ -
- -
a@a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v
- ISEMAIL_DNSWARN - ISEMAIL_DNSWARN_NO_RECORD - Michael Rushton - https://squiloople.com/tag/email/ -
- -
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi
- ISEMAIL_DNSWARN - ISEMAIL_DNSWARN_NO_RECORD - Michael Rushton - https://squiloople.com/tag/email/ -
- -
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_TOOLONG - Michael Rushton - https://squiloople.com/tag/email/ -
- -
a@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg.hij
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_TOOLONG - Michael Rushton - https://squiloople.com/tag/email/ -
- -
a@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg.hijk
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMAIN_TOOLONG - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"test"@iana.org
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_QUOTEDSTRING - Michael Rushton - https://squiloople.com/tag/email/ -
- -
""@iana.org
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_QUOTEDSTRING - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"""@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"\a"@iana.org
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_QUOTEDSTRING - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"\""@iana.org
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_QUOTEDSTRING - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"\"@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_UNCLOSEDQUOTEDSTR - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"\\"@iana.org
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_QUOTEDSTRING - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test"@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"test@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_UNCLOSEDQUOTEDSTR - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"test"test@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_ATEXT_AFTER_QS - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test"text"@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"test""test"@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"test"."test"@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_LOCALPART - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"test\ test"@iana.org
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_QUOTEDSTRING - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"test".test@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_LOCALPART - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"test␀"@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_QTEXT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"test\␀"@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_QP - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghj"@iana.org
- Quotes are still part of the length restriction - ISEMAIL_RFC5322 - ISEMAIL_RFC5322_LOCAL_TOOLONG - Dominic Sayers - https://isemail.info -
- -
"abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefg\h"@iana.org
- Quoted pair is still part of the length restriction - ISEMAIL_RFC5322 - ISEMAIL_RFC5322_LOCAL_TOOLONG - Dominic Sayers - https://isemail.info -
- -
test@[255.255.255.255]
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_ADDRESSLITERAL - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@a[255.255.255.255]
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[255.255.255]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMAINLITERAL - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[255.255.255.255.255]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMAINLITERAL - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[255.255.255.256]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMAINLITERAL - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[1111:2222:3333:4444:5555:6666:7777:8888]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMAINLITERAL - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:5555:6666:7777]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_GRPCOUNT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888]
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_ADDRESSLITERAL - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_GRPCOUNT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:888G]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_BADCHAR - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:5555:6666::8888]
- ISEMAIL_DEPREC - ISEMAIL_RFC5321_IPV6DEPRECATED - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:5555::8888]
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_ADDRESSLITERAL - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:5555:6666::7777:8888]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_MAXGRPS - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6::3333:4444:5555:6666:7777:8888]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_COLONSTRT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:::3333:4444:5555:6666:7777:8888]
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_ADDRESSLITERAL - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111::4444:5555::8888]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_2X2XCOLON - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:::]
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_ADDRESSLITERAL - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:5555:255.255.255.255]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_GRPCOUNT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:5555:6666:255.255.255.255]
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_ADDRESSLITERAL - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:255.255.255.255]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_GRPCOUNT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444::255.255.255.255]
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_ADDRESSLITERAL - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:5555:6666::255.255.255.255]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_MAXGRPS - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6:1111:2222:3333:4444:::255.255.255.255]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_2X2XCOLON - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@[IPv6::255.255.255.255]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_COLONSTRT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test @iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_CFWS_NEAR_AT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@ iana .com
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_CFWS_NEAR_AT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test . test@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_FWS - Michael Rushton - https://squiloople.com/tag/email/ -
- -
␍␊ test@iana.org
- FWS - ISEMAIL_CFWS - ISEMAIL_CFWS_FWS - Michael Rushton - https://squiloople.com/tag/email/ -
- -
␍␊ ␍␊ test@iana.org
- FWS with one line composed entirely of WSP -- only allowed as obsolete FWS (someone might allow only non-obsolete FWS) - ISEMAIL_DEPREC - ISEMAIL_DEPREC_FWS - Michael Rushton - https://squiloople.com/tag/email/ -
- -
(comment)test@iana.org
- ISEMAIL_CFWS - ISEMAIL_CFWS_COMMENT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
((comment)test@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_UNCLOSEDCOMMENT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
(comment(comment))test@iana.org
- ISEMAIL_CFWS - ISEMAIL_CFWS_COMMENT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@(comment)iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_CFWS_NEAR_AT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test(comment)test@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_ATEXT_AFTER_CFWS - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@(comment)[255.255.255.255]
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_CFWS_NEAR_AT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
(comment)abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@iana.org
- ISEMAIL_CFWS - ISEMAIL_CFWS_COMMENT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@(comment)abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.com
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_CFWS_NEAR_AT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
(comment)test@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghik.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghik.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstu
- ISEMAIL_CFWS - ISEMAIL_CFWS_COMMENT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@iana.org␊
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
test@xn--hxajbheg2az3al.xn--jxalpdlp
- A valid IDN from ICANN's IDN TLD evaluation gateway - ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Michael Rushton - https://squiloople.com/tag/email/ -
- -
xn--test@iana.org
- RFC 3490: "unless the - email standards are revised to invite the use of IDNA for local - parts, a domain label that holds the local part of an email address - SHOULD NOT begin with the ACE prefix, and even if it does, it is to - be interpreted literally as a local part that happens to begin with - the ACE prefix" - ISEMAIL_VALID_CATEGORY - ISEMAIL_VALID - Dominic Sayers - https://isemail.info -
- -
test@iana.org-
- ISEMAIL_ERR - ISEMAIL_ERR_DOMAINHYPHENEND - Dominic Sayers - https://isemail.info -
- -
"test@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_UNCLOSEDQUOTEDSTR - Dominic Sayers - https://isemail.info -
- -
(test@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_UNCLOSEDCOMMENT - Dominic Sayers - https://isemail.info -
- -
test@(iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_UNCLOSEDCOMMENT - Dominic Sayers - https://isemail.info -
- -
test@[1.2.3.4
- ISEMAIL_ERR - ISEMAIL_ERR_UNCLOSEDDOMLIT - Dominic Sayers - https://isemail.info -
- -
"test\"@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_UNCLOSEDQUOTEDSTR - Dominic Sayers - https://isemail.info -
- -
(comment\)test@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_UNCLOSEDCOMMENT - Dominic Sayers - https://isemail.info -
- -
test@iana.org(comment\)
- ISEMAIL_ERR - ISEMAIL_ERR_UNCLOSEDCOMMENT - Dominic Sayers - https://isemail.info -
- -
test@iana.org(comment\
- ISEMAIL_ERR - ISEMAIL_ERR_BACKSLASHEND - Dominic Sayers - https://isemail.info -
- -
test@[RFC-5322-domain-literal]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMAINLITERAL - Dominic Sayers - https://isemail.info -
- -
test@[RFC-5322]-domain-literal]
- ISEMAIL_ERR - ISEMAIL_ERR_ATEXT_AFTER_DOMLIT - Dominic Sayers - https://isemail.info -
- -
test@[RFC-5322-[domain-literal]
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_DTEXT - Dominic Sayers - https://isemail.info -
- -
test@[RFC-5322-\␇-domain-literal]
- obs-dtext and obs-qp - ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMLIT_OBSDTEXT - Dominic Sayers - https://isemail.info -
- -
test@[RFC-5322-\␉-domain-literal]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMLIT_OBSDTEXT - Dominic Sayers - https://isemail.info -
- -
test@[RFC-5322-\]-domain-literal]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMLIT_OBSDTEXT - Dominic Sayers - https://isemail.info -
- -
test@[RFC-5322-domain-literal\]
- ISEMAIL_ERR - ISEMAIL_ERR_UNCLOSEDDOMLIT - Dominic Sayers - https://isemail.info -
- -
test@[RFC-5322-domain-literal\
- ISEMAIL_ERR - ISEMAIL_ERR_BACKSLASHEND - Dominic Sayers - https://isemail.info -
- -
test@[RFC 5322 domain literal]
- Spaces are FWS in a domain literal - ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMAINLITERAL - Dominic Sayers - https://isemail.info -
- -
test@[RFC-5322-domain-literal] (comment)
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMAINLITERAL - Dominic Sayers - https://isemail.info -
- -
@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Dominic Sayers - https://isemail.info -
- -
test@.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Dominic Sayers - https://isemail.info -
- -
""@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_QTEXT - Dominic Sayers - https://isemail.info -
- -
"\"@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_QP - Dominic Sayers - https://isemail.info -
- -
()test@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_CTEXT - Dominic Sayers - https://isemail.info -
- -
test@iana.org␍
- No LF after the CR - ISEMAIL_ERR - ISEMAIL_ERR_CR_NO_LF - Dominic Sayers - https://isemail.info -
- -
␍test@iana.org
- No LF after the CR - ISEMAIL_ERR - ISEMAIL_ERR_CR_NO_LF - Dominic Sayers - https://isemail.info -
- -
"␍test"@iana.org
- No LF after the CR - ISEMAIL_ERR - ISEMAIL_ERR_CR_NO_LF - Dominic Sayers - https://isemail.info -
- -
(␍)test@iana.org
- No LF after the CR - ISEMAIL_ERR - ISEMAIL_ERR_CR_NO_LF - Dominic Sayers - https://isemail.info -
- -
test@iana.org(␍)
- No LF after the CR - ISEMAIL_ERR - ISEMAIL_ERR_CR_NO_LF - Dominic Sayers - https://isemail.info -
- -
␊test@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Michael Rushton - https://squiloople.com/tag/email/ -
- -
"␊"@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_QTEXT - Dominic Sayers - https://isemail.info -
- -
"\␊"@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_QP - Dominic Sayers - https://isemail.info -
- -
(␊)test@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_CTEXT - Dominic Sayers - https://isemail.info -
- -
␇@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Dominic Sayers - https://isemail.info -
- -
test@␇.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_ATEXT - Dominic Sayers - https://isemail.info -
- -
"␇"@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_QTEXT - Dominic Sayers - https://isemail.info -
- -
"\␇"@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_QP - Dominic Sayers - https://isemail.info -
- -
(␇)test@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_CTEXT - Dominic Sayers - https://isemail.info -
- -
␍␊test@iana.org
- Not FWS because no actual white space - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_END - Dominic Sayers - https://isemail.info -
- -
␍␊ ␍␊test@iana.org
- Not obs-FWS because there must be white space on each "fold" - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_END - Dominic Sayers - https://isemail.info -
- -
␍␊test@iana.org
- Not FWS because no white space after the fold - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_END - Dominic Sayers - https://isemail.info -
- -
␍␊ test@iana.org
- FWS - ISEMAIL_CFWS - ISEMAIL_CFWS_FWS - Dominic Sayers - https://isemail.info -
- -
␍␊ ␍␊test@iana.org
- Not FWS because no white space after the second fold - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_END - Dominic Sayers - https://isemail.info -
- -
␍␊␍␊test@iana.org
- Not FWS because no white space after either fold - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_X2 - Dominic Sayers - https://isemail.info -
- -
␍␊␍␊ test@iana.org
- Not FWS because no white space after the first fold - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_X2 - Dominic Sayers - https://isemail.info -
- -
test@iana.org␍␊
- FWS - ISEMAIL_CFWS - ISEMAIL_CFWS_FWS - Dominic Sayers - https://isemail.info -
- -
test@iana.org␍␊ ␍␊
- FWS with one line composed entirely of WSP -- only allowed as obsolete FWS (someone might allow only non-obsolete FWS) - ISEMAIL_DEPREC - ISEMAIL_DEPREC_FWS - Dominic Sayers - https://isemail.info -
- -
test@iana.org␍␊
- Not FWS because no actual white space - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_END - Dominic Sayers - https://isemail.info -
- -
test@iana.org␍␊ ␍␊
- Not obs-FWS because there must be white space on each "fold" - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_END - Dominic Sayers - https://isemail.info -
- -
test@iana.org ␍␊
- Not FWS because no white space after the fold - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_END - Dominic Sayers - https://isemail.info -
- -
test@iana.org ␍␊
- FWS - ISEMAIL_CFWS - ISEMAIL_CFWS_FWS - Dominic Sayers - https://isemail.info -
- -
test@iana.org ␍␊ ␍␊
- Not FWS because no white space after the second fold - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_END - Dominic Sayers - https://isemail.info -
- -
test@iana.org ␍␊␍␊
- Not FWS because no white space after either fold - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_X2 - Dominic Sayers - https://isemail.info -
- -
test@iana.org ␍␊␍␊
- Not FWS because no white space after the first fold - ISEMAIL_ERR - ISEMAIL_ERR_FWS_CRLF_X2 - Dominic Sayers - https://isemail.info -
- -
test@iana.org
- ISEMAIL_CFWS - ISEMAIL_CFWS_FWS - Dominic Sayers - https://isemail.info -
- -
test@iana.org
- ISEMAIL_CFWS - ISEMAIL_CFWS_FWS - Dominic Sayers - https://isemail.info -
- -
test@[IPv6:1::2:]
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_IPV6_COLONEND - Dominic Sayers - https://isemail.info -
- -
"test\©"@iana.org
- ISEMAIL_ERR - ISEMAIL_ERR_EXPECTING_QPAIR - Dominic Sayers - https://isemail.info -
- -
test@iana/icann.org
- ISEMAIL_RFC5322 - ISEMAIL_RFC5322_DOMAIN - Dominic Sayers - https://isemail.info -
- -
test.(comment)test@iana.org
- ISEMAIL_DEPREC - ISEMAIL_DEPREC_COMMENT - Dominic Sayers - https://isemail.info -
- -
test@org
- ISEMAIL_RFC5321 - ISEMAIL_RFC5321_TLD - Dominic Sayers - https://isemail.info -
- -
test@test.com
- test.com has an A-record but not an MX-record - ISEMAIL_DNSWARN - ISEMAIL_DNSWARN_NO_MX_RECORD - Dominic Sayers - https://isemail.info -
- -
test@nic.no
- nic.no currently has no MX-records or A-records (Feb 2011). If you are seeing an A-record for nic.io then try setting your DNS server to 8.8.8.8 (the Google DNS server) - your DNS server may be faking an A-record (OpenDNS does this, for instance). - ISEMAIL_DNSWARN - ISEMAIL_DNSWARN_NO_RECORD - Dominic Sayers - https://isemail.info -
- diff --git a/pkg/message/rfc5322/walker.go b/pkg/message/rfc5322/walker.go deleted file mode 100644 index 5efe6aa8..00000000 --- a/pkg/message/rfc5322/walker.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "fmt" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/antlr/antlr4/runtime/Go/antlr" -) - -// walker implements parser.BaseRFC5322ParserListener, defining what to do at -// each node while traversing the syntax tree. -// It also implements antlr.DefaultErrorListener, allowing us to react to -// errors encountered while trying to determine the syntax tree of the input. -type walker struct { - parser.BaseRFC5322ParserListener - antlr.DefaultErrorListener - - // nodes acts as a stack; when entering a node, it is pushed here, and when - // exiting a node, it is popped from here. - nodes []interface{} - - // res holds the result of walking the parse tree. - res interface{} - - // err holds the error encountered during parsing, if any. - err error -} - -func (w *walker) enter(b interface{}) { - w.nodes = append(w.nodes, b) -} - -func (w *walker) exit() interface{} { - b := w.nodes[len(w.nodes)-1] - w.nodes = w.nodes[:len(w.nodes)-1] - return b -} - -func (w *walker) parent() (b interface{}) { - return w.nodes[len(w.nodes)-1] -} - -func (w *walker) SyntaxError(_ antlr.Recognizer, _ interface{}, _, _ int, msg string, _ antlr.RecognitionException) { - w.err = fmt.Errorf("error parsing rfc5322 input: %v", msg) -} diff --git a/pkg/message/rfc5322/word.go b/pkg/message/rfc5322/word.go deleted file mode 100644 index 61e85e92..00000000 --- a/pkg/message/rfc5322/word.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type word struct { - value string -} - -func (w *word) withAtom(atom *atom) { - w.value = atom.value -} - -func (w *word) withQuotedString(quotedString *quotedString) { - w.value = quotedString.value -} - -func (w *word) withEncodedWord(encodedWord *encodedWord) { - w.value = encodedWord.value -} - -func (w *walker) EnterWord(ctx *parser.WordContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering word") - - w.enter(&word{ - value: ctx.GetText(), - }) -} - -func (w *walker) ExitWord(ctx *parser.WordContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting word") - - type withWord interface { - withWord(*word) - } - - res := w.exit().(*word) - - if parent, ok := w.parent().(withWord); ok { - parent.withWord(res) - } -} diff --git a/pkg/message/rfc5322/year.go b/pkg/message/rfc5322/year.go deleted file mode 100644 index ca0db493..00000000 --- a/pkg/message/rfc5322/year.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "strconv" - "time" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type year struct { - value int -} - -func (w *walker) EnterYear(ctx *parser.YearContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering year") - - var text string - - for _, digit := range ctx.AllDigit() { - text += digit.GetText() - } - - val, err := strconv.Atoi(text) - if err != nil { - w.err = err - } - - // NOTE: 2-digit years are obsolete but let's just have some simple handling anyway. - if len(text) == 2 { - if val > time.Now().Year()%100 { - val += 1900 - } else { - val += 2000 - } - } - - w.enter(&year{ - value: val, - }) -} - -func (w *walker) ExitYear(ctx *parser.YearContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting year") - - type withYear interface { - withYear(*year) - } - - res := w.exit().(*year) - - if parent, ok := w.parent().(withYear); ok { - parent.withYear(res) - } -} diff --git a/pkg/message/rfc5322/zone.go b/pkg/message/rfc5322/zone.go deleted file mode 100644 index 761e9706..00000000 --- a/pkg/message/rfc5322/zone.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2020 Proton Technologies AG -// -// This file is part of ProtonMail Bridge. -// -// ProtonMail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ProtonMail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ProtonMail Bridge. If not, see . - -package rfc5322 - -import ( - "time" - - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322/parser" - "github.com/sirupsen/logrus" -) - -type zone struct { - location *time.Location -} - -func (z *zone) withOffset(offset *offset) { - z.location = time.FixedZone(offset.rep, offset.value) -} - -func (z *zone) withObsZone(obsZone *obsZone) { - z.location = obsZone.location -} - -func (w *walker) EnterZone(ctx *parser.ZoneContext) { - logrus.WithField("text", ctx.GetText()).Trace("Entering zone") - - w.enter(&zone{ - location: time.UTC, - }) -} - -func (w *walker) ExitZone(ctx *parser.ZoneContext) { - logrus.WithField("text", ctx.GetText()).Trace("Exiting zone") - - type withZone interface { - withZone(*zone) - } - - res := w.exit().(*zone) - - if parent, ok := w.parent().(withZone); ok { - parent.withZone(res) - } -} diff --git a/pkg/mime/encoding.go b/pkg/mime/encoding.go index 1383140a..4bd7f695 100644 --- a/pkg/mime/encoding.go +++ b/pkg/mime/encoding.go @@ -32,17 +32,19 @@ import ( "golang.org/x/text/encoding/htmlindex" ) +func CharsetReader(charset string, input io.Reader) (io.Reader, error) { + dec, err := SelectDecoder(charset) + if err != nil { + return nil, err + } + if dec == nil { // utf-8 + return input, nil + } + return dec.Reader(input), nil +} + var WordDec = &mime.WordDecoder{ - CharsetReader: func(charset string, input io.Reader) (io.Reader, error) { - dec, err := SelectDecoder(charset) - if err != nil { - return nil, err - } - if dec == nil { // utf-8 - return input, nil - } - return dec.Reader(input), nil - }, + CharsetReader: CharsetReader, } // Expects trimmed lowercase. diff --git a/test/mocks/smtp.go b/test/mocks/smtp.go index b6a43e0f..fb056e4f 100644 --- a/test/mocks/smtp.go +++ b/test/mocks/smtp.go @@ -28,7 +28,7 @@ import ( "sync" "time" - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322" + "github.com/ProtonMail/go-rfc5322" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/test/store_checks_test.go b/test/store_checks_test.go index b46bbcb1..435d6f34 100644 --- a/test/store_checks_test.go +++ b/test/store_checks_test.go @@ -22,8 +22,8 @@ import ( "strings" "time" + "github.com/ProtonMail/go-rfc5322" "github.com/ProtonMail/proton-bridge/internal/store" - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322" "github.com/ProtonMail/proton-bridge/pkg/pmapi" "github.com/ProtonMail/proton-bridge/test/accounts" "github.com/cucumber/godog" diff --git a/test/transfer_checks_test.go b/test/transfer_checks_test.go index 4c8e55f9..1ab5ac15 100644 --- a/test/transfer_checks_test.go +++ b/test/transfer_checks_test.go @@ -27,7 +27,7 @@ import ( "strings" "time" - "github.com/ProtonMail/proton-bridge/pkg/message/rfc5322" + "github.com/ProtonMail/go-rfc5322" "github.com/cucumber/godog" "github.com/cucumber/godog/gherkin" "github.com/emersion/go-mbox"