// -*- mode: Rust; -*- use crate::message::lexer; grammar; pub Message: () = { LITERAL, CompressedData, EncryptedPart, SignedPart, OPAQUE_CONTENT, }; CompressedData: () = { COMPRESSED_DATA Message POP }; SeipPart: () = { SEIP Message MDC POP, SEIP OPAQUE_CONTENT POP, } AedPart: () = { AED Message POP, } // An encrypted part is 0 or more ESKs followed by an encryption container. EncryptedPart: () = { EncryptionContainer, ESKS EncryptionContainer, }; EncryptionContainer: () = { SeipPart, AedPart, }; ESKS: () = { ESK, ESKS ESK, }; ESK: () = { PKESK, SKESK, }; // Signatures bracket a message like so: // // OPS OPS Message SIG SIG // // or, there are 1 or more signatures preceding a Message (this is an // artifact of old PGP versions): // // SIG SIG Message SignedPart: () = { SIG Message, OPS Message SIG, } extern { type Location = usize; type Error = lexer::LexicalError; enum lexer::Token { LITERAL => lexer::Token::Literal, COMPRESSED_DATA => lexer::Token::CompressedData, SKESK => lexer::Token::SKESK, PKESK => lexer::Token::PKESK, SEIP => lexer::Token::SEIP, MDC => lexer::Token::MDC, AED => lexer::Token::AED, OPS => lexer::Token::OPS, SIG => lexer::Token::SIG, POP => lexer::Token::Pop, OPAQUE_CONTENT => lexer::Token::OpaqueContent, } }