Ӭ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdef g h i j k l m n o p q rstuvwxyz{|}~ Identifiers(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalportableSafe168'S The payload of an identifier An identifierpayload of the identifierhash for quick comparision Smart constructor for making an .Hash a string into an  Uses  to short-circuit Uses  to short-circuit /Shows the identifier as a string (for use with -XOverloadedStrings),Interface to the underlying input of parsing(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalportableNone8} Opaque input type.Read the first byte from an 0 and return that byte with what remains of the . Behaviour is undefined when  returns .takeByte "foo bar"(102, "oo bar")takeByte "$8<<"(196, "\ETX\168\&8\235<<")!Read the first character from an  and return that  with what remains of the . Behaviour is undefined when  returns .takeChar "foo bar"('f', "oo bar")takeChar "$8<<"('$', "8<<")Return True$ if the given input stream is empty.inputStreamEmpty ""TrueinputStreamEmpty "foo"FalseReturns the first n= characters of the given input stream, without removing them.peekChars 5 "foo bar""foo ba"peekChars 5 "foo""foo"peekChars 3 "$8<<""$"Read an encoded file into an Read an  from a Convert  to . Convert a  to an ..Returns the number of text lines in the given  countLines ""0countLines "foo"1countLines "foo\n\nbar"3countLines "foo\n\nbar\n"3Uses   Positions and spans in files(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalGHCSafe168SDescribes nodes that can be located - their span can be extracted from them. In general, we expect that for a value constructed as  Con x y z where Con is an arbitrary constructorH(spanOf x <> spanOf y <> spanOf z) `subsetOf` spanOf (Con x y z) == True  A "tagging" of something with a " that describes its extent.">Spans represent a contiguous region of code, delimited by two &Us. The endpoints are inclusive. Analogous to the information encoded in a selection.&A position in a source file. The row and column information is kept only for its convenience and human-readability. Analogous to the information encoded in a cursor.) absolute offset the source file.*row (line) in the source file.+column in the source file.,Pretty print a &-4Maximum of two positions, bias for actual positions.+maxPos (Position 30 5 8) (Position 37 5 15)Position 37 5 15#maxPos NoPosition (Position 30 5 8)Position 30 5 8.9Maximum and minimum positions, bias for actual positions.+minPos (Position 30 5 8) (Position 37 5 15)Position 30 5 8#minPos NoPosition (Position 30 5 8)Position 30 5 8/Starting position in a file.0)Advance column a certain number of times.1Advance to the next line.2tAdvance only the absolute offset, not the row and column information. Only use this if you know what you are doing!3+Check if a span is a subset of another span4Convenience function lifting  to work on all  things5Pretty print a "6Extract the wrapped value from  7Field names are not shown9smallest covering ":Field names are not shown ?O(n) time complexity@O(n) time complexity !"#%$&'()*+,-./0123456&'()*+,-./012"#$%6534 ! !"#$%&'()*+ Parsing literals(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalGHCNone;=FTZ6Wrap a data type where all the operations are reversedConvert a reversed  back into a normal one.?Remove an element from the end of a non-empty reversed sequenceZAdd an element to the end of a reversed sequence to produce a non-empty reversed sequence Non-token AST definitions(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalGHCNone1368WAn individual predicate in a [ (syntax::ast::WherePredicate).X type bound ( syntax::ast::WhereBoundPredicate ) (example: for<'c> Foo: Send+Clone+'c)Ylifetime predicate (!syntax::ast::WhereRegionPredicate ) (example:  'a: 'b+'c)Zequality predicate (syntax::ast::WhereEqPredicate ) (example: T=int.). Note that this is not currently supported.[A wherel clause in a definition, where one can apply a series of constraints to the types introduced and used by a  clause (syntax::ast::WhereClause). In many cases, where is the only way to express certain bounds (since those bounds may not be immediately on a type defined in the generic, but on a type derived from types defined in the generic).Note that while [ is a field of s, not all uses of generics are coupled with a where clause. In those cases, we leave the list of predicates empty. Example: where Option<T>: Debug as in 7impl<T> PrintInOption for T where Option<T>: Debug { } ]GThe visibility modifier dictates from where one can access something (ast::syntax::Visibility). Ihttps://github.com/rust-lang/rfcs/blob/master/text/1422-pub-restricted.md'RFC about adding restricted visibility^pub is accessible from everywhere _ pub(crate)$ is accessible from within the crate`for some path p, pub(p) is visible at that patha1if no visbility is specified, this is the defaultbPaths used in  items (ast::syntax::UseTree). Examples: // Simple use paths use foo::bar::baz as quux; use foo::bar::baz; // Glob use paths use foo::bar::*; // Nested use paths use foo::bar::{a, b, c::quux as d} c%Simple path, optionally ending in an asdPath ending in a glob patterne$Path ending in a list of more paths fMain payload in a j (syntax::ast::VariantData). Examples: renum Foo { // Struct variant Bar { x: f64 }, // Tuple variant Baz(i32, i32), // Unit variant Qux, } gStruct varianth Tuple varianti Unit variantj0A variant in Rust is a constructor (either in a  , , or !) which groups together fields (syntax::ast::VariantY). In the case of a unit variant, there can also be an explicit discriminant expression.l9Qualifies whether something is using unsafe Rust or not (syntax::ast::Unsafety5). Note that we also use this to describe whether a X9 is unsafe or not, while Rust has a seperate structure (syntax::ast::BlockCheckModek) for that. This is because they also need to keep track of whether an unsafe block is compiler generated.oUnary operators, used in the 0 constructor of ( (syntax::ast::UnOp). Example: ! as in !truep* operator (dereferencing)q! operator (logical inversion)r- operator (negation)s$Bounds that can be placed on types (syntax::ast::TyParamBound,). These can be either traits or lifetimes.t trait boundulifetime boundv"Type parameter definition used in  (syntax::ast::TyParams). Note that each parameter can have any number of (lifetime or trait) bounds, as well as possibly a default type.xTypes (syntax::ast::Ty).y variable length slice (example: [T])zfixed length array (example: [T; n]){raw pointer (example: *const T or *mut T)|reference (example: &'a T or  &'a mut T)}bare function (example: fn(usize) -> bool)~ never type: !tuple (example:  (i32, i32))path type (examples:  std::math::pi, <Vec<T> as SomeTrait>::SomeType).trait object type (example: Bound1 + Bound2 + Bound3)impl trait type (see the  Rhttps://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.mdRFC ) (example: impl Bound1 + Bound2 + Bound3).9no-op; kept solely so that we can pretty print faithfully!typeof, currently unsupported in rustc (example:  typeof(1))inferred type: _+generated from a call to a macro (example: HList![i32,(),u8])A % is a path which identifies a trait (syntax::ast::TraitRef).-Item declaration within a trait declaration (syntax::ast::TraitItem with syntax::ast::TraitItemKind inlined), possibly including a default implementation. A trait item is either required (meaning it doesn't have an implementation, just a signature) or provided (meaning it has a default implementation). Examples: trait MyTrait { // Associated constant const ID: i32 = 1; // Method fn area(&self) -> f64; // Associated type type N: fmt::Display; // Call to a macro foo!{} } Associated constantsMethod with optional body"Possibly abstract associated typesCall to a macro5Modifier on a bound, currently this is only used for ?Sized, where the modifier is Maybe/. Negative bounds should also be handled here.EWhen the parser encounters a macro call, it parses what follows as a A token tree. Basically, token trees let you store raw tokens or Sequence forms inside of balanced parens, braces, or brackets. This is a very loose structure, such that all sorts of different AST-fragments can be passed to syntax extensions using a uniform type.A single token A delimited sequence of tokens (syntax::tokenstream::Delimited ) Example:  { [->+<] } in brainfuck!{ [->+<] };type of delimiterdelimited sequence of tokensKAn abstract sequence of tokens, organized into a sequence (e.g. stream) of , each of which is a single U or a  subsequence of tokens.2a single token or a single set of delimited tokensstream of streams of tokensField of a struct (syntax::ast::StructField) used in declarations Example:  bar: usize as in struct Foo { bar: usize }Style of a string literal (syntax::ast::StrStyle).regular strings (example: "foo") raw strings, with the number of # delimiters (example: r#\"foo\"#) A statement (syntax::ast::Stmt). Rust has relatively few types of statements by turning both expressions (sometimes with a required semicolon at the end) and items into statements.A local let binding (syntax::ast::Local ) (example: let x: i32 = 1;)Item definition (example: fn foo(x: i32) { return x + 1 })2Expression without a trailing semicolon (example: x + 1)/Expression with a trailing semicolon (example: x + 1;)A macro call (example: println!("hello world"))Limit types of a C0Inclusive at the beginning, exclusive at the end"Inclusive at the beginning and end The explicit Self type in a "qualified path". The actual path, including the trait and the associated item, is stored separately. The first argument is the type given to SelfD and the second is the index of the associated qualified with this Self type6Trait ref parametrized over lifetimes introduced by a for (syntax::ast::PolyTraitRef). Example: for<'a,'b> Foo<&'a Bar> Segment of a path (syntax::ast::PathSegment).Parameters on a path segment (syntax::ast::PathParameters)..Parameters in a chevron comma-delimited list ((syntax::ast::AngleBracketedParameterData). Note that lifetimes must come before types, which must come before bindings. Bindings are equality constraints on associated types (example:  Foo<A=Bar>) Example: <'a,A,B,C=i32> in a path segment like foo::<'a,A,B,C=i32>SParameters in a parenthesized comma-delimited list, with an optional output type ('syntax::ast::ParenthesizedParameterData). Example:  (A,B) -> C in a path segment  Foo(A,B) -> C9Everything in Rust is namespaced using nested modules. A _ represents a path into nested modules, possibly instantiating type parameters along the way (syntax::ast::Pathj). Much like file paths, these paths can be relative or absolute (global) with respect to the crate root.,Paths are used to identify expressions (see D), types (see $), and modules (indirectly through ViewPath and such).The > argument identifies whether the path is relative or absolute. Example: std::cmp::PartialEq Patterns (syntax::ast::Pat).wildcard pattern: _identifier pattern - either a new bound variable or a unit (tuple) struct pattern, or a const pattern. Disambiguation cannot be done with parser alone, so it happens during name resolution. (example: mut x)struct pattern. The  signals the presence of a .. . (example: Variant { x, y, .. })tuple struct pattern. If the ..F pattern is present, the 'Maybe Int' denotes its position. (example: Variant(x, y, .., z))path pattern (example A::B::C)tuple pattern. If the ..F pattern is present, the 'Maybe Int' denotes its position. (example: (a, b))box pattern (example: box _)reference pattern (example:  &mut (a, b))literal (example: 1)range pattern (example: 1...2)slice pattern where, as per  ]https://github.com/P1start/rfcs/blob/array-pattern-changes/text/0000-array-pattern-changes.mdthis RFC;, the pattern is split into the patterns before/after the .. and the pattern at the .. . (example: [a, b, ..i, y, z])+generated from a call to a macro (example: LinkedList!(1,2,3))*For interpolation during macro expansion (syntax::ast::NonTerminal).5Encodes whether something can be updated or changed (syntax::ast::Mutability).1The movability of a generator / closure literal (syntax::ast::Movability).PRepresents a method's signature in a trait declaration, or in an implementation.Style of the macro statement (syntax::ast::MacStmtStyle).trailing semicolon (example:  foo! { ... };,  foo!(...);, and  foo![...];)braces (example:  foo! { ... })Represents a macro invocation (syntax::ast::Mac). The 2 indicates which macro is being invoked, and the - contains the source of the macro invocation.The base of the number in an Int literal can be binary (e.g. 0b1100), octal (e.g. 0o14), decimal (e.g. 12), or hexadecimal (e.g. 0xc).Literals in Rust (syntax::ast::Lit). As discussed in e, Rust AST is designed to parse suffixes for all literals, even if they are currently only valid on  and  literals.string (example: "foo")byte string (example: b"foo")character (example: 'a')byte (example: b'f')integer (example: 1i32)float (example: 1.12e4)boolean (example: true)!The suffix on a literal (unifies syntax::ast::LitIntType, syntax::ast::IntTy, syntax::ast::UintTy, and syntax::ast::FloatTy). As of today, only numeric types can have suffixes, but the possibility of adding more (possibly arbitrary) suffixes to literals in general is being kept open intentionally. Xhttps://github.com/rust-lang/rfcs/blob/master/text/0463-future-proof-literal-suffixes.md+RFC about future-proofing literal suffixes Examples: i32, isize, and f32This is the fundamental unit of parsing - it represents the contents of one source file. It is composed of an optional shebang line, inner attributes that follow, and then the module items.Example: S#!/usr/bin/env rust #![allow(dead_code)] fn main() { println!("Hello world") } VA lifetime definition, introducing a lifetime and the other lifetimes that bound it (syntax::ast::LifetimeDef). Example: 'a: 'b + 'c + 'd/A lifetime is a name for a scope in a program (syntax::ast::Lifetime). One of the novel features of Rust is that code can be parametrized over lifetimes. Syntactically, they are like regular identifiers, but start with a tick ' mark. The  argument is not supposed to include that tick. Examples: 'a or 'static/Used to annotate loops, breaks, continues, etc. A top-level item, possibly in a   or a  (syntax::ast::Item with syntax::ast::ItemKind inlined). Example: fn main() { return; }Aextern crate item, with optional original crate name. Examples: extern crate foo or extern crate foo_bar as foouse declaration (use or pub use) item. Examples: use foo;,  use foo::bar;, or use foo::bar as FooBar; static item (static or  pub static). Examples: static FOO: i32 = 42; or !static FOO: &'static str = "bar";constant item (const or  pub const ). Example: const FOO: i32 = 42;function declaration (fn or pub fn ). Example: "fn foo(bar: usize) -> usize { .. } module declaration (mod or pub mod) (syntax::ast::Mod ). Example: mod foo; or mod foo { .. } external module (extern or  pub extern) (syntax::ast::ForeignMod ). Example:  extern { .. } or extern "C" { .. }  type alias (type or pub type ). Example: type Foo = Bar<u8>; enum definition (enum or pub enum) (syntax::ast::EnumDef ). Example: enum Foo<A, B> { C(A), D(B) } struct definition (struct or  pub struct ). Example: struct Foo<A> { x: A }union definition (union or  pub union ). Example: union Foo<A, B> { x: A, y: B }trait declaration (trait or  pub trait ). Example: trait Foo { .. } or trait Foo<T> { .. }trait alias Example: trait Foo = Bar + Quux;implementation Example: impl<A> Foo<A> { .. } or impl<A> Trait for Foo<A> { .. },generated from a call to a macro Example:  foo!{ .. }definition of a macro via  macro_rules Example: macro_rules! foo { .. }`For traits with a default impl, one can "opt out" of that impl with a negative impl, by adding ! mark before the trait name. Phttps://github.com/rust-lang/rfcs/blob/master/text/0019-opt-in-builtin-traits.mdRFC on builtin traits Example: ! as in impl !Trait for Foo { }An item within an impl (syntax::ast::ImplItem with syntax::ast::ImplItemKind inlined). Examples: impl MyTrait { // Associated constant const ID: i32 = 1; // Method fn area(&self) -> f64 { 1f64 } // Associated type type N = i32; // Call to a macro foo!{} } Associated constantMethodAssociated type Macro calliRepresents lifetimes and type parameters attached to a declaration of a functions, enums, traits, etc. (syntax::ast::GenericsX). Note that lifetime definitions are always required to be before the type parameters.This one AST node is also a bit weird: it is the only node whose source representation is not compact - the lifetimes and type parameters occur by themselves between < and >5 then a bit further the where clause occurs after a where. Example: <'a, 'b: 'c, T: 'a> and where Option<T>: Copy as inQ fn nonsense<'a, 'b: 'c, T: 'a>(x: i32) -> i32 where Option<T>: Copy { 1 }. An item within an extern block (syntax::ast::ForeignItem with syntax::ast::ForeignItemKind inlined). Example: static ext: u8 in extern "C" { static ext: u8 }Foreign function Example: fn foo(x: i32); in extern "C" { fn foo(x: i32); } +Foreign static variable, optionally mutable Example: static mut bar: i32; in #extern "C" { static mut bar: i32; }! Foreign type Example:  type Boo;"1Header (not the body) of a function declaration (syntax::ast::FnDecl). The Z argument indicates whether the header is variadic (so whether the argument list ends in ...). Example: (bar: i32) -> i32 as in &fn foo(bar: i32) -> i32 { bar + 2 } $#Field in a struct literal pattern (syntax::ast::FieldPat). The field name  is optional but, when it is 3, the pattern the field is destructured to must be . Example: x in Point { x, y }&&Field in a struct literal expression (syntax::ast::Field). Example: x: 1 in Point { x: 1, y: 2 }( Expression (syntax::ast::ExprU). Note that Rust pushes into expressions an unusual number of constructs including if, while, match, etc.)box expression (example: box x)*in-place expression - first (1 is the place, second one is the value (example: x <- y)+array literal (example:  [a, b, c, d]),function call where the first (! is the function itself, and the [(]% is the list of arguments (example:  foo(1,2,x))-method call where the first ( is the receiver,  is the method name, Maybe [x]R the list of type arguments and '[Expr]' the arguments to the method. (example: x.foo::<Bar, Baz>(a, b, c, d).tuple (example:  (a, b, c ,d))/binary operation (example: a + b, a * b)0unary operation (example: !x, *x)1literal (example: 1, "foo")2cast (example:  foo as f64)3type annotation (example: x: i32) 4 if expression, with an optional else block. In the case the else$ block is missing, the type of the if is inferred to be () . (example: "if 1 == 2 { (1,1) } else { (2,2) }58if-let expression with an optional else block (example: if let Some(x) = None { () })6-while loop, with an optional label (example: !'lbl: while 1 == 1 { break 'lbl })71while-let loop, with an optional label (example: while let Some(x) = None { x })8+for loop, with an optional label (example: #for i in 1..10 { println!("{}",i) })9'conditionless loop (can be exited with F, G, or H): match block;closure (example: move |a, b, c| { a + b + c })<"(possibly unsafe) block (example:  unsafe { 1 })=a catch block (example: do catch { 1 })>assignment (example:  a = foo())?&assignment with an operator (example: a += 1)@)access of a named struct field (example: obj.foo)AAaccess of an unnamed field of a struct or tuple-struct (example: foo.0)Bindexing operation (example: foo[2])Crange (examples: 1..2, 1.., ..2, 1...2, 1..., ...2)Dvariable reference E referencing operation (example:  &a or &mut a)Fbreakc with an optional label and expression denoting what to break out of and what to return (example:  break 'lbl 1) Gcontinue" with an optional label (example: continue)Hreturn1 with an optional value to be returned (example: return 1)I!macro invocation before expansionJ%struct literal expression (examples: Foo { x: 1, y: 2 } or Foo { x: 1, ..base })K>array literal constructed from one repeated element (example: [1; 5])L4no-op: used solely so we can pretty print faithfullyMsugar for error handling with Result (example: parsed_result?)Nyield+ with an optional value to yield (example: yield 1)OAn  can be marked default (syntax::ast::Defaultness). R{Const annotation to specify if a function or method is allowed to be called in constants context with constant arguments (syntax::ast::Constness).  Chttps://github.com/rust-lang/rfcs/blob/master/text/0911-const-fn.md Relevant RFC  Example: const in %const fn inc(x: i32) -> i32 { x + 1 }UDescribes how a ;' should close over its free variables (syntax::ast::CaptureBy).V+make copies of free variables closed over (move closures)W!borrow free variables closed overX0A curly brace delimited sequence of statements (syntax::ast::Block4). The last statement in the block can always be a  expression. Example: { let x = 1; return x + y } as in $fn foo() { let x = 1; return x + y }ZTDescribes how a value bound to an identifier in a pattern is going to be borrowed (syntax::ast::BindingMode).  Example: &mut in |&mut x: i32| -> { x += 1 }]Binary operators, used in the / and ? constructors of ( (syntax::ast::BinOp). Example: + as in 1 + 1 or 1 += 1^+ operator (addition)_- operator (subtraction)`* operator (multiplication)a/ operator (division)b% operator (modulus)c&& operator (logical and)d|| operator (logical or)e^ operator (bitwise xor)f& operator (bitwise and)g| operator (bitwise or)h<< operator (shift left)i>> operator (shift right)j== operator (equality)k< operator (less than)l<=! operator (less than or equal to)m!= operator (not equal to)n>=$ operator (greater than or equal to)o> operator (greater than)pDistinguishes between attributes that are associated with the node that follows them and attributes that are associated with the node that contains them (syntax::ast::AttrStyleu). These two cases need to be distinguished only for pretty printing - they are otherwise fundamentally equivalent. Example:  #[repr(C)] is an outer attribute while #![feature(slice_patterns)] is an inner oness's are annotations for other AST nodes (syntax::ast::Attribute6). Note that doc-comments are promoted to attributes. Example: #[derive(Copy,Clone)] as in ;#[derive(Clone, Copy)] struct Complex { re: f32, im: f32 } tRegular attributes of the form #[...]uDoc comment attributes. The ? argument identifies if the comment is inline or not, and the ) contains the actual doc comment content.v An arm of a : expression (syntax::ast::ArmW). An arm has at least one patten, possibly a guard expression, and a body expression. Example: 0n if n % 4 == 3 => { println!("{} % 4 = 3", n) } as in match n { n if n % 4 == 3 => { println!("{} % 4 = 3", n) } n if n % 4 == 1 => { println!("{} % 4 = 1", n) } _ => println!("{} % 2 = 0", n) } x"An argument in a function header (syntax::ast::Arg, except with SelfKind and  ExplicitSelf inlined). Example: x: usize, self, mut self, &self,  &'lt mut self,  mut self: Foo as in %trait Foo { // Regular argument fn new(x: usize) -> Foo; // Self argument, by value fn foo(self) -> i32; fn bar(mut self); // Self argument, by reference fn baz(&self) -> Bar<'lt>; fn qux(&'lt mut self) -> Bar<'lt>; // Explicit self argument fn quux(mut self: Foo); } yRegular argument zSelf argument, by value {Self argument, by reference|Explicit self argument}3ABIs support by Rust's foreign function interface (syntax::abi::Abi). Note that of these, only , , , , , and  and : are cross-platform - all the rest are platform-specific. Example: "C" as in extern "C" fn foo(x: i32); Extract the where clause from a .Smart constructor for .Extract the suffix from a .A ! is at its core just a stream of . This function lets you get at that directly. For example, you can use 'Data.List.unfoldr unconsTokenStream' to convert between a  and '[TokenTree]'.Partition a list of s into a tuple of the t and u variants." is not stored on  - it is computed=WXYZ[\]^_`abcdefghijklmnoqprstuvwxz{y|}~      !"#$%&'(:4/C1N=)*+,-.02356789;<>?@ABDEFGHIJKLMOQPRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~;WXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'(&)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Token definitions(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalGHCNone168MSsRust is whitespace independent. Short of providing space between tokens, whitespace is all the same to the parser.TA delimiter token ( syntax::parse::token::DelimToken).UA general token (based on syntax::parse::token::Token). Unlike its  libsyntax counterpart, U has folded in  syntax::parse::token::BinOpToken and "syntax::parse::token::BinOpEqToken as regular tokens.VA literal token (syntax::parse::token::Lit)byte character"integral literal (could have type i32, int, u128, etc.)(floating point literal (could have type f32, f64, etc.)string literal%raw string literal and the number of # marks around itbyte string literal*raw byte string literal and the number of # marks around itround parenthesis: ( or )square bracket: [ or ] curly brace: { or }empty delimiterusual white space: [\ \t\n\f\v\r]+comment (either inline or not)= token < token > token & token | token ! token ~ token + token - token * token / token % token ^ token >= token>>= token&& token|| token<< token>> token== token!= token<= token<<= token-= token&= token|= token+= token*= token/= token^= token%= token@ token. token.. token..= token... token, token; token: token:: token-> token<- token=> token# token$ token? tokenOne of (, [, {One of ), ], }8a literal token with an optional suffix (something like i32)(an arbitrary identifier (something like x or foo or and_then)_ tokena lifetime (something like 'a or 'static) whitespaceYdoc comment with its contents, whether it is outer/inner, and whether it is inline or not#! shebang tokenend of file token6can be expanded into several tokens in macro-expansionFCheck whether a space is needed between two tokens to avoid confusion.@This instance is only for error messages and debugging purposes.OSTUVpqrSTU9VSyntax data defintions(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalGHCNone3STUVWXYZ[\]^_`abcdefghijklmnoqprstuvwxz{y|}~      !"#$%&'(:4/C1N=)*+,-.02356789;<>?@ABDEFGHIJKLMOQPRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~lmnxyz{|"#stupqr()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN}~vwopqr]^_`abcdefghijklmnoUVW&'xyz{|}~vwstu[\WXYZZ[\$%      !OPQjkfghibcde]^_`aRSTXYUSTVpqr pretty printing utilities(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalportableNone~Indentation level Similar to , but where the  case is an empty Vertically concatenate two &s with a collapsible line between them Flatten a Map the list of items into 7s using the provided function and add comma punctuationVTake a binary operation on docs and lift it to one that has (left and right) identity Lifted version of Wadler's  +Lifted version of Wadler's hsepLifted version of Wadler's  #Lifted version of Wadler's vsepLifted version of Wadler's  /.Unless the condition holds, print the document,When the condition holds, print the document@Apply a printing function to an optional value. If the value is ,  returns the empty .Indent the given , but only if multi-line:Undo what group does. This function is pretty dangerous...Remove all indent Translate '\n' in a string using the provided  instead of lineThis is the most general function for printing blocks. It operates with any delimiter, any seperator, an optional leading attribute doc (which isn't followed by a seperator), and wraps a list of entries. It has been tweaked to look Just Right (TM) for the usual cases.fNote that this will try to fit things on one line when possible, so if you want a block that is sure notV to be condensed on one line (e.g. for a function), you have to construct it manually.result if scrutinee is empty+how to process scrutinee if it is not empty scrutinee outer delimiters4prefer to be on one line (as opposed to multiline)?  seperator3attributes doc, after which no seperator will (use  to ignore)entriesParsing literals(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalportableNone Print a literal ( print_literal)Print literal suffixPrint an integer literal&Extend a byte into a unicode characteraConstrain a unicode character to a byte This assumes the character is in the right range alreadyEscape a byte. Based on std::ascii::escape_default.kIf the first argument is true, newlines may become a literal newline characters if the string is too long.%Escape a unicode character. Based on std::ascii::escape_default.kIf the first argument is true, newlines may become a literal newline characters if the string is too long./Convert a number to its padded hexadecimal formRust pretty printer(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalportableNoneQLPrint a source file Print a namePrint an identifierPrint a type ( print_type with  print_ty_fn8 inlined) Types are expected to always be only one linePrint a macro ( print_mac)TGiven two positions, find out how to print appropriate amounts of space between themPrint a token tree (print_tt)WPrint a list of token trees, with the right amount of space between successive elementsAPrint the space between a token stream and the mod-path before itPrint a token streamPrint a token (token_to_string0) Single character expression-operator symbols.Print a literal tokenPrint a nonterminalPrint a statement ( print_stmt)Print an expressionPrint an expression (print_expr_outer_attr_style ) Inlined print_expr_in_place, print_expr_call, print_expr_method_call, print_expr_tup, print_expr_binary, print_expr_unary, print_expr_addr_of, print_if,  print_if_let, print_expr_repeat(TODO: attributes on chained method callsPrint a string literal)Extract from an expression its attributes Print a fieldPrint range limits&Print a closure function declaration (print_fn_block_args)%Print the arm of a match expression ( print_arm) Print a blockPrint a block with attributes (print_block_with_attrs or print_block_maybe_unclosed) Print an else expression ( print_else)Print a binary operator Print a unary operatorPrint inner attributes (print_inner_attributes or print_inner_attributes_inline or print_inner_attributes_nodbreakD - distinction has to be made at callsite whether to force newline)Print outer attributes (print_outer_attributes or ,print_outer_attributes_no_trailing_hardbreak)!Print either type of attributes (print_either_attributes)Print an attribute (print_attribute_inline or print_attribute)EPrint an identifier as is, or as cooked string if containing a hyphenPrint an item ( print_item)Print a trait item (print_trait_item)UPrint type parameter bounds with the given prefix, but only if there are any bounds ( print_bounds)Print a type parameter bound Print the formal lifetime list (print_formal_lifetime_list)Print an impl item (print_impl_item)Print defaultness ( Defaultness)Print an associated type (printAssociatedType)Print a method signature (print_method_sig)Print an associated constant (print_associated_const)Print the polarity of a traitPrint visibility (print_visibility)Print a foreign item (print_foreign_item)Print a struct definition ( print_struct)Print a struct fieldPretty print unsafety (print_unsafety)Print an enum definition (print_enum_def)Print a variant ( print_variant)Print a where clause (print_where_clause). The = argument indicates whether to have a trailing comma or not.Print a where clause predicatePrint a function (print_fn)2Print the function arguments and the return type (print_fn_args_and_ret)Print an argument ( print_arg)Print a lifetime (print_lifetime)Print a lifetime definitionPrint mutability (print_mutability)Like  , but prints const in the immutable case Print a pattern ( print_pat)Print a field patternPrint a binding modeCPrint the prefix of a function - all the stuff up to and including fn (print_fn_header_info) Print the ABIMPrint the interior of a module given the list of items and attributes in it ( print_mod)UPrint the interior of a foreign module given the list of items and attributes in it ( print_mod)Print generics (print_genericso) Remark: we are discarding the where clause because it gets printed seperately from the rest of the generic.Print a poly-trait ref (print_poly_trait_ref)Print a trait ref (print_trait_ref)ZPrint a path parameter and signal whether its generic (if any) should start with a colon (print_path_parameters)@Print a path, specifiying explicitly whether to include colons (::H) before generics or not (so expression style or type style generics) ( print_path)Print a path segmentJPrint a qualified path, specifiying explicitly whether to include colons (::H) before generics or not (so expression style or type style generics) ( print_qpath)Print a use treePrint a type parameters (print_ty_param)Print lifetime bounds (print_lifetime_bounds)@Parsing monad for lexer/parser(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalGHCNone1QVj;$Exceptions that occur during parsing%State that the lexer and parser share"position at current input locationthe current input#position at previous input location"tokens manually pushed by the userfunction to swap token*Parsing and lexing monad. A value of type  a- represents a parser that can be run (using &) to possibly produce a value of type a.Execute the given parser on the supplied input stream at the given start position, returning either the position of an error and the error message, or the value parsed.Generalized version of x that expects an extra argument that lets you hot-swap a token that was just lexed before it gets passed to the parser.%Swap a token using the swap function.'Extract the state stored in the parser.&Update the state stored in the parser.&Modify the state stored in the parser.,Retrieve the current position of the parser.*Update the current position of the parser.Retrieve the current  of the parser.Update the current  of the parser.Manually push a   Ui. This turns out to be useful when parsing tokens that need to be broken up. For example, when seeing a  token but only expecting a  token, one can consume the  token and push back an  token.Manually pop a   U) (if there are no tokens to pop, returns ). See  for more details.Signal a syntax error.//  Parsing literals(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalportableNone~ Parse a valid V into a . Given a string of characters read from a Rust source, extract the next underlying char taking into account escapes and unicode. tGiven a string of characters read from a Rust source, extract the next underlying byte taking into account escapes. LGiven a string Rust representation of a character, parse it into a characterBGiven a string Rust representation of a byte, parse it into a byteHGiven a string Rust representation of an integer, parse it into a numberGiven a string Rust representation of a float, parse it into a float. NOTE: this is a bit hacky. Eventually, we might not do this and change the internal representation of a float to a string (what language-c has opted to do).Try to read a hexadecimal number of the specified length off of the front of the string provided. If there are not enough characters to do this, or the characters don't fall in the right range, this fails with .:Convert a list of characters to the number they represent. multi-line strings allowed input string multi-line strings allowed input string Rust lexer(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalportableNoneDC7type passed around by Alex functions (required by Alex) Make a token.'Given the first part of a literal, try to parse also a suffix. Even if the allowed suffixes are very well defined and only valid on integer and float literals, we need to put in the same token whatever suffix follows. This is for backwards compatibility if Rust decides to ever add suffixes. KParses a raw string, the closing quotation, and the appropriate number of 4 characters.4Consume a full inline comment (which may be nested).URetrieve the next character (if there is one), updating the parser state accordingly.RRetrieve the next character (if there is one), without updating the parser state.Greedily try to eat as many of a given character as possible (and return how many characters were eaten). The second argument is an upper limit.Signal a lexical error.nget previous character (required by Alex). Since this is never used, the implementation just raises an error.Nget the next byte and new input from the current input (required by Alex 3.0).find the new position given the next characterLexer for one U(. The only token this cannot produce is . Lexer for one non-whitespace U*. The only tokens this cannot produce are  and S4 (which includes comments that aren't doc comments).?Apply the given lexer repeatedly until (but not including) the ^ token. Meant for debugging purposes - in general this defeats the point of a threaded lexer.2Lex the first line, if it immediately starts with #! (but not #![c - that should be an inner attribute). If this fails to find a shebang line, it consumes no input.?U?U !"#$%&'()*+,-.(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalportableNone ST%c/struct style field0tuple-struct style field1Corresponds to  stmt_item, - basically limited visbility and no macros2 General item3Grequire a statement be terminated (so another statement can follow it)?4 any statement5Any expression, no restrictions61Either an immediate literal, or a negated literal7IA literal, negated literal, expression path, or qualified expression path8No struct literals are allowed9@No struct literals or block expressions (block-like things like 'if' are fine):Forbids expressions starting with blocks (things like '{ 1 } + 2') unless the leading block has a postfix expression, allows expressions that are just one big block. Forbids '{ 1 }[0]' since it is treated as '{ 1 }; [0]' and '{ 1 }(0)' since it is treated as '{ 1 }; (0)';7There are several restricted forms of arguments allowed<`Arguments allowed in places without implementation (optional limited pattern followed by a type)=cArguments allowed in most places (any pattern followed by any type) This includes lambda arguments>BOnly some type parameter bounds allow trait bounds to start with ??Don't allow '? poly_trait_ref'@Allow '? poly_trait_ref'A!the first argument cannot be selfBCthe first argument cannot be self, and the function can be variadicCthe first argument can be selfDTThere a a variety of constraints imposed on types, representing different invariantsENo restrictionsFAny type except for  with a GHTypes not starting with I0 or '(', or paren types with no sum types insideJ"Non-sum types not starting with a forK}Recall that paths are reused for expressions, modules, and types. However, these paths have different underlying invariants.L similar to M, but can have no segmentsN*Attribute type to against which to resolveOinner or outer attributePonly innner attributeQonly outer attributeSince it is possible to have well-typed Haskell expressions which represent invalid Rust ASTs, it is convenient to fix, warn, or fail ASTs before printing them. The % typeclass provides such a facility.;A non-exhaustive list of the more obvious issues it covers:missing parensinvalid identifiers?invalid paths (for example, generic arguments on a module path)Ninner attributes on things that support only outer attributes (and vice-versa)Convert some value to its resolved form. Informally, resolving a value involves checking that its invariants hold and, if they don't, report an error message or adjust the value so that the invariant holds.A value of a type satsifying  and  is resolved if  . 9 is an identity operation on it. We further expect that , be an identity operation on any output of .Same as , but throws a r exception if it cannot resolve. Although this function should not be used, it summarizes nicely the laws around :!parse' . pretty' . resolve' == idresolve' . parse' = parse'ARun resolution and get back the altered syntax tree, the highest   of issues, and the list of issues found. This allows you to see what corrections were applied to the tree. If the output severity is  1, the syntax tree returned will still be invalid.RInternal recursive helperExceptions that occur during resolving. Unlike parse errors, we don't have positional information. Instead, we try to provide some context via a list of syntax trees which let you "zoom out" from the problematic node.S(Monad in which to resolve a syntax tree. Reader is [T]; storing the path from root to the current syntax tree node Writer is []. accumulating issues met through the traversal State is   accumulating the most severe  found so far in the traversal6Localized information about an issue in a syntax tree.Description of the issueSeverity of the issueThe first element in this list is the syntax tree where the issue occurs. The next elements are increasingly zoomed out syntax trees centered on the first element. In lieu of positional information, this provides a next best way of debugging exactly where the problem is. Diagnostic for how severe an  is. QEverything is normal (this variant is returned when there was nothing to resolve) OThere is something fishy looking (AST is valid, but may not be what you expect) 9The AST was invalid, but in a way that could be corrected EThe AST was invalid in some way that could not be automatically fixedULog an VLog a  WLog a  XLog an  YEnter a new syntax treeZA valid sourcefile needs:the shebang to be one-line not conflicting with attributesthe attributes to be innerthe items to be ModItems[An identifier can be invalid if"it does not lex into an identifierit is a keyword\A sugared doc is invalid if:the expected attribute style does not match the actual oneits content starts with a ]  ^ when it is an outer line  inline comment7it is a line comment whose content spans multiple lines!A regular attribute is invalid if:the expected attribute style does not match the actual one-the underlying path / tokenstream are invalidthe tokenstream starts with a '::'_A literal cannot be invalid`A path can be invalid if(it has path parameters of the wrong type&it has identifiers not meant for paths'TODO: guard against no path segments...aPA path parameter can be invalid if any of its constituent components are invalidb=A QSelf by itself is only invalid when the underlying type isciA lifetime can only be invalid if the underlying identifier is. Note that lifetimes cannot use keywords.d6A trait ref is invalid if the underlying type path is.e=Resolve a given type, and a constraint on it (see the parser $ for more details on these cases). fjA function declaration can be invalid if it has self arguments in the wrong places (or when it shouldn't)g4Check whether an argument is one of the "self" formsh$A type parameter bound is invalid if%an underlying lifetime or traitref isit is ? but is a trait bound with a ? (as in  ObjectTrait)iIThe only types of patterns supported by arguments are wild or identifiersj:Check whether an argument is one of the "self"-alike formsk?A Poly trait ref is valid whenever the underlying trait ref is.l9A lifetime def is invalid if it has non-outer attributes mA pattern can be invalid ofthe index of the ...* in the tuple/tuple-struct is out of range+the index of the qself path is out of range#any underlying component is invalidnIField patterns are only invalid if the underlying pattern / identifier isoKGiven the type of expression, what type of expression is allowed on the RHSpSGiven the type of expression, what type of expression is allowed on the RHS (after  '..'/'...')q<Resolve an expression of the given type in a general contextrOThis has a double role: to resolve the expression and keep track of precedencess9Wrap an expression in parens if the condition given holdst?A field just requires the identifier and expression to be validu8Arms are invalid only if the underlying consitutents arev?Statements are invalid only when the underlying components are.wWA block must a a series of terminated statements ended by one possibly unterminated onexAn item can be invalid ifit is a macro but has 1 restriction6it has visibility other than public/inherited but has 1 restriction"an underlying component is invalidyIA foreign item is invalid only if any of its underlying constituents are z=A where clause is valid only if the underlying predicates are{LGenerics are only invalid if the underlying lifetimes or type parameters are|CA type parameter is invalid only when the underlying components are}3A variant is valid if the underlying components are~8A variant data is valid if the underlying components areA struct field is invalid ifIit has the invariant that it needs an identifier, but it doesn't have oneLit has the invariant that should not have an identifier, but it doe have one,any of the underlying components are invalidAA where predicate is invalid only if the underlying lifetimes are6A trait item is valid if the underlying components are6An impl item is valid if the underlying components areThe | constraint is theoretically not necessary - restricted visibility paths are mod paths, so they should never have generics.<A method signature is valid if the underlying components are5A view path is valid if the underlying components areDA macro call is only invalid if any of the underlying components areA token tree is invalid whenGthere is an open or close delim token (those should be balanced and in )&the underlying token trees are invalid!Does not show context information^There are three potential instances for resolving a path (depending on what type it is). The  instance for  will let through any path.Udescription of the issueseverity of the issue     /0123456789:;<=>?@ABCDEFHJKMLNOPQR     Pretty printing(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalportableNoneI  Similar to ?, but for types which are parametrized over an annotation type.MPretty print the given value without resolving it, adding annotations in the  whenever possible.,Describes things that can be pretty printed.2Pretty print the given value without resolving it.Resolve (see the ' typeclass) and pretty print something.-let one = Lit [] (Int Dec 1 Unsuffixed ()) ()-let two = Lit [] (Int Dec 2 Unsuffixed ()) ()/let three = Lit [] (Int Dec 3 Unsuffixed ()) ()Tlet bogusVar = PathExpr [] Nothing (Path False [PathSegment "let" Nothing ()] ()) ()>pretty (Binary [] MulOp (Binary [] AddOp one two ()) three ())Right (1 + 2) * 3(pretty (Binary [] AddOp one bogusVar ())2Left (invalid AST (identifier `let' is a keyword))Same as , but throws a  exception on invalid ASTs. This function is intended for situations in which you are already stuck catching exceptions - otherwise you should prefer .-let one = Lit [] (Int Dec 1 Unsuffixed ()) ()-let two = Lit [] (Int Dec 2 Unsuffixed ()) ()/let three = Lit [] (Int Dec 3 Unsuffixed ()) ()Tlet bogusVar = PathExpr [] Nothing (Path False [PathSegment "let" Nothing ()] ()) ()?pretty' (Binary [] MulOp (Binary [] AddOp one two ()) three ()) (1 + 2) * 3)pretty' (Binary [] AddOp one bogusVar ());*** Exception: invalid AST (identifier `let' is a keyword))Resolve (see the Y typeclass) and pretty print something with annotations. Read more about annotations in Data.Text.Prettyprint.Doc.Dfmap Data.Text.Prettyprint.Doc.noAnnotate . prettyAnnotated = prettySame as , but throws a  exception on invalid ASTs. This function is intended for situations in which you are already stuck catching exceptions - otherwise you should prefer .AData.Text.Prettyprint.Doc.noAnnotate . prettyAnnotated' = pretty'"Given a handle to a file, write a + in with a desired width of 100 characters."Given a handle to a file, write a + in with a desired width of 100 characters.The "g associated with the tokens (if present) will be used as a hint for laying out and spacing the tokens.F&This instance prints attributes inline           Rust parser(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalGHCNone ;=De_Parser for literals.Parser for attributes.Parser for types.Parser for patterns.Parser for statements.Parser for expressions.Parser for items.Parser for blocks. Parser for impl items. Parser for trait items.Parser for token trees.Parser for token streams.Parser for a type parameter. Parser for lifetime definitions.Parser for a where clause.Parser for generics (although [ is always empty here).>Generate a nice looking error message based on expected tokens Convert an  into an jTry to convert an expression to a statement given information about whether there is a trailing semicolon9Return the second argument, as long as the visibility is a%Fill in the where clause in a generic5Return the second argument, as long as the safety is n"Make a macro item, which may be a Add attributes to an expressionGiven a V token that is expected to result in a valid literal, construct the associated literal. Note that this should _never_ fail on a token produced by the lexer.Parse a source fileNudge the span endpoints of a " valueNAppend an element to a list to get a nonempty list (flipped version of '(:|)')\Append an element to a nonempty list to get anothg nonempty list (flipped version of '(<|)')9 9  Quasiquotes for Rust AST(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalGHCNonez Given a parser, convert it into a quasiquoter. The quasiquoter produced does not support declarations and types. For patterns, it replaces any " and & field with a wild pattern.fQuasiquoter for literals (see ).void [lit| 1.4e29f64 |]Float 1.4e29 F64 ()g Quasiquoter for attributes (see )void [attr| #[no_mangle] |]SAttribute Outer (Path False [PathSegment "no_mangle" Nothing ()] ()) (Stream []) ()hQuasiquoter for types (see )void [ty| &(_,_) |]8Rptr Nothing Immutable (TupTy [Infer (),Infer ()] ()) ()iQuasiquoter for patterns (see )void [pat| x @ 1...5 |]RIdentP (ByValue Immutable) "x" (Just (RangeP (Lit [] (Int Dec 1 Unsuffixed ()) ())Z (Lit [] (Int Dec 5 Unsuffixed ()) ()) ())) ()j Quasiquoter for statements (see  )void [stmt| let x = 4i32; |]eLocal (IdentP (ByValue Immutable) "x" Nothing ()) Nothing (Just (Lit [] (Int Dec 4 I32 ()) ())) [] ()k!Quasiquoter for expressions (see !)void [expr| (x,) |]STupExpr [] [PathExpr [] Nothing (Path False [PathSegment "x" Nothing ()] ()) ()] ()lQuasiquoter for items (see ")void [item| type Unit = (); |]UTyAlias [] InheritedV "Unit" (TupTy [] ()) (Generics [] [] (WhereClause [] ()) ()) ()m)Quasiquoter for a whole source file (see #)"void [sourceFile| fn main() { } |].SourceFile Nothing [] [Fn [] InheritedV "main"6 (FnDecl [] Nothing False ()). Normal NotConst RustA (Generics [] [] (WhereClause [] ()) ())2 (Block [] Normal ()) ()]nQuasiquoter for blocks (see $)void [block| unsafe { 1i32 } |]:Block [NoSemi (Lit [] (Int Dec 1 I32 ()) ()) ()] Unsafe ()o Quasiquoter for impl items (see %)"void [implItem| type Item = (); |]1TypeI [] InheritedV Final "Item" (TupTy [] ()) ()p!Quasiquoter for trait items (see &)void [traitItem| type Item; |]TypeT [] "Item" [] Nothing ()q!Quasiquoter for token trees (see ')[tokenTree| fn |]3Token (Span (Position 1 2 14) (Position 3 2 16)) fn fghijklmnopq fghijklmopqnParsing and lexing(c) Alec Theriault, 2017-2018 BSD-stylealec.theriault@gmail.com experimentalGHCNone;=r#Describes things that can be parseds;Complete parser (fails if not all of the input is consumed)tLParse something from an input stream (it is assumed the initial position is /).&fmap void $ parse @(Expr Span) "x + 1"\Right (Binary [] AddOp (PathExpr [] Nothing (Path False [PathSegment "x" Nothing ()] ()) ())< (Lit [] (Int Dec 1 Unsuffixed ()) ()) ())%fmap void $ parse @(Expr Span) "x + "WLeft (parse failure at 1:4 (Syntax error: unexpected `<EOF>' (expected an expression)))uSame as t, but throws a  exception if it cannot parse. This function is intended for situations in which you are already stuck catching exceptions - otherwise you should prefer t."void $ parse' @(Expr Span) "x + 1"UBinary [] AddOp (PathExpr [] Nothing (Path False [PathSegment "x" Nothing ()] ()) ())5 (Lit [] (Int Dec 1 Unsuffixed ()) ()) ()!void $ parse' @(Expr Span) "x + "_*** Exception: parse failure at 1:4 (Syntax error: unexpected `<EOF>' (expected an expression))vSame as 2, but working from a list of tokens instead of an .wIGiven a handle to a Rust source file, read that file and parse it into a )writeFile "empty_main.rs" "fn main() { }"<fmap void $ withFile "empty_main.rs" ReadMode readSourceFile.SourceFile Nothing [] [Fn [] InheritedV "main"6 (FnDecl [] Nothing False ()). Normal NotConst RustA (Generics [] [] (WhereClause [] ()) ())2 (Block [] Normal ()) ()]x\Given a path pointing to a Rust source file, read that file and lex it (ignoring whitespace))writeFile "empty_main.rs" "fn main() { }",withFile "empty_main.rs" ReadMode readTokens[fn,main,(,),{,}]"/rstuvwxtuwxrsv/"rs()*+,,-./0123456789:;<=>?@ABCDEFGHIIJJKLMMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwx y z { | } ~                                                 &        ' {                                                                                                      # #       "                ! " # $ % % & ' ( ) ) * + , - . . / / 0 0 ! 1 2 3 4 5 6 7 8  9 : ; < = > ? @ 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 y z z { | } ~                                                                                         y *          !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ \ ] ^ _ ` a b c d e f ghijklmnopqrstuvwxyz{|}~                          d      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU;VWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\ ,language-rust-0.1.1.26-nwWwmkzHmV4B1BSh4hGkTLanguage.Rust.PrettyLanguage.Rust.Data.IdentLanguage.Rust.Data.InputStreamLanguage.Rust.Data.PositionLanguage.Rust.SyntaxLanguage.Rust.Parser.ParseMonadLanguage.Rust.ParserLanguage.Rust.Parser.LexerLanguage.Rust.QuoteLanguage.Rust.Parser.ReversedLanguage.Rust.Syntax.ASTLanguage.Rust.Syntax.TokenLanguage.Rust.Pretty.UtilLanguage.Rust.Pretty.LiteralsLanguage.Rust.Pretty.Internal GreaterEqualGreaterEqualLanguage.Rust.Parser.LiteralsLanguage.Rust.Pretty.ResolveParsePrettyparseprettyInternalyLanguage.Rust.Parser.InternalLit AttributeTyPatStmtExprItem SourceFileBlockImplItem TraitItem TokenTree,prettyprinter-1.2.0.1-5La26ycBL8v75W5GOZOGtO"Data.Text.Prettyprint.Doc.InternalDocNameIdentnamehashmkIdent$fSemigroupIdent $fMonoidIdent $fOrdIdent $fEqIdent$fIsStringIdent $fShowIdent $fDataIdent$fGenericIdent $fNFDataIdent InputStreamtakeBytetakeCharinputStreamEmpty peekCharsreadInputStreamhReadInputStreaminputStreamToStringinputStreamFromString countLines$fShowInputStream$fIsStringInputStream$fEqInputStream$fOrdInputStreamLocatedspanOfSpannedSpanlohiPosition NoPositionabsoluteOffsetrowcolprettyPositionmaxPosminPosinitPosincPosretPos incOffsetsubsetOf# prettySpanunspan$fShowPosition $fMonoidSpan$fSemigroupSpan $fShowSpan $fShowSpanned$fMonadSpanned$fApplicativeSpanned$fFunctorSpanned$fLocatedNonEmpty $fLocated[]$fLocatedMaybe$fLocatedSpanned $fLocatedSpan $fEqPosition $fOrdPosition$fDataPosition$fGenericPosition$fNFDataPosition$fEqSpan $fOrdSpan $fDataSpan $fGenericSpan $fNFDataSpan $fEqSpanned $fOrdSpanned $fDataSpanned$fGenericSpanned$fNFDataSpannedSpaceDelimTokenLitTokWherePredicateBoundPredicateRegionPredicate EqPredicate WhereClause VisibilityPublicVCrateV RestrictedV InheritedVUseTree UseTreeSimple UseTreeGlob UseTreeNested VariantDataStructDTupleDUnitDVariantUnsafetyUnsafeNormalUnOpDerefNotNeg TyParamBoundTraitTyParamBoundRegionTyParamBoundTyParamSliceArrayPtrRptrBareFnNeverTupTyPathTy TraitObject ImplTraitParenTyTypeofInferMacTyTraitRefConstTMethodTTypeTMacroTTraitBoundModifierNoneMaybe Delimitedspandelimtts TokenStreamTreeStream StructFieldStrStyleCookedRawLocalItemStmtNoSemiSemiMacStmt RangeLimitsHalfOpenClosedQSelf PolyTraitRef PathSegmentPathParametersAngleBracketed ParenthesizedPathWildPIdentPStructP TupleStructPPathPTuplePBoxPRefPLitPRangePSlicePMacP NonterminalNtItemNtBlockNtStmtNtPatNtExprNtTyNtIdentNtPathNtTTNtArm NtImplItem NtTraitItem NtGenerics NtWhereClauseNtArgNtLit MutabilityMutable Immutable Movability ImmovableMovable MethodSig MacStmtStyle SemicolonMac BracesMacMacIntRepBinOctDecHexStrByteStrCharByteIntFloatBoolSuffix UnsuffixedIsI8I16I32I64I128UsU8U16U32U64U128F32F64 LifetimeDefLifetimeLabel ExternCrateUseStatic ConstItemFnMod ForeignModTyAliasEnum StructItemUnionTrait TraitAliasImplMacItemMacroDef ImplPolarityPositiveNegativeConstIMethodITypeIMacroIGenerics ForeignItem ForeignFn ForeignStatic ForeignTyFnDeclFieldPatFieldBoxInPlaceVecCall MethodCallTupExprBinaryUnaryCastTypeAscriptionIfIfLetWhileWhileLetForLoopLoopMatchClosure BlockExprCatchAssignAssignOp FieldAccessTupFieldIndexRangePathExprAddrOfBreakContinueRetMacExprStructRepeat ParenExprTryYield DefaultnessDefaultFinal ConstnessConstNotConst CaptureByValueRef BindingModeByRefByValueBinOpAddOpSubOpMulOpDivOpRemOpAndOpOrOpBitXorOpBitAndOpBitOrOpShlOpShrOpEqOpLtOpLeOpNeOpGeOpGtOp AttrStyleOuterInner SugaredDocArmArg SelfValue SelfRegion SelfExplicitAbiCdeclStdcallFastcall VectorcallAapcsWin64SysV64 PtxKernelMsp430Interrupt X86InterruptRustCSystem RustIntrinsicRustCallPlatformIntrinsic Unadjusted whereClausebyteStrsuffixunconsTokenStreampartitionTyParamBoundsByteTokCharTok IntegerTokFloatTokStrTok StrRawTok ByteStrTok ByteStrRawTokParenBracketBraceNoDelim WhitespaceCommentLess AmpersandPipe ExclamationTildePlusMinusStarSlashPercentCaretGreaterGreaterEqualAmpersandAmpersandPipePipeLessLessGreaterGreater EqualEqualNotEqual LessEqual LessLessEqual MinusEqualAmpersandEqual PipeEqual PlusEqual StarEqual SlashEqual CaretEqual PercentEqualAtDotDotDot DotDotEqual DotDotDotComma SemicolonColonModSepRArrowLArrowFatArrowPoundDollarQuestion OpenDelim CloseDelim LiteralTokIdentTok Underscore LifetimeTokShebangEof Interpolated spaceNeeded ParseFailPStatecurPoscurInputprevPos pushedTokens swapFunctionP execParser execParser' swapToken getPState setPState getPosition setPositiongetInputsetInput pushTokenpopToken parseError$fMonadP$fApplicativeP $fFunctorP$fExceptionParseFail$fShowParseFail $fEqParseFail translateLit lexicalErrorlexToken lexNonSpace lexTokenslexShebangLineResolveresolveresolve'resolveVerbose ResolveFailIssue descriptionseveritylocationSeverityCleanWarning CorrectionErrorPrettyAnnotatedprettyAnnUnresolvedprettyUnresolvedpretty'prettyAnnotatedprettyAnnotated'writeSourceFile writeTokens $fPrettySpan$fPrettyPosition$fPrettyUnsafety $fPrettyUnOp$fPrettyTokenStream$fPrettyTokenTree $fPrettyToken$fPrettyRangeLimits$fPrettyMutability$fPrettyLitTok$fPrettySuffix$fPrettyImplPolarity $fPrettyIdent $fPrettyBinOp$fPrettyBindingMode $fPrettyAbi$fPrettyAnnotatedWherePredicate$fPrettyAnnotatedWhereClause$fPrettyAnnotatedVisibility$fPrettyAnnotatedUseTree$fPrettyAnnotatedVariant$fPrettyAnnotatedTyParamBound$fPrettyAnnotatedTyParam$fPrettyAnnotatedTy$fPrettyAnnotatedTraitRef$fPrettyAnnotatedTraitItem$fPrettyAnnotatedStructField$fPrettyAnnotatedStmt$fPrettyAnnotatedPolyTraitRef$fPrettyAnnotatedPath$fPrettyAnnotatedPat$fPrettyAnnotatedNonterminal$fPrettyAnnotatedMac$fPrettyAnnotatedLit$fPrettyAnnotatedLifetimeDef$fPrettyAnnotatedLifetime$fPrettyAnnotatedItem$fPrettyAnnotatedImplItem$fPrettyAnnotatedGenerics$fPrettyAnnotatedForeignItem$fPrettyAnnotatedFnDecl$fPrettyAnnotatedFieldPat$fPrettyAnnotatedField$fPrettyAnnotatedExpr$fPrettyAnnotatedSourceFile$fPrettyAnnotatedBlock$fPrettyAnnotatedAttribute$fPrettyWherePredicate$fPrettyWhereClause$fPrettyVisibility$fPrettyUseTree$fPrettyVariant$fPrettyTyParamBound$fPrettyTyParam $fPrettyTy$fPrettyTraitRef$fPrettyTraitItem$fPrettyStructField $fPrettyStmt$fPrettyPolyTraitRef $fPrettyPath $fPrettyPat$fPrettyNonterminal $fPrettyMac $fPrettyLit$fPrettyLifetimeDef$fPrettyLifetime $fPrettyItem$fPrettyImplItem$fPrettyGenerics$fPrettyForeignItem$fPrettyFnDecl$fPrettyFieldPat $fPrettyField $fPrettyExpr$fPrettySourceFile $fPrettyBlock$fPrettyAttributelitattrtypatstmtexpritem sourceFileblockimplItem traitItem tokenTreeparserparse'execParserTokensreadSourceFile readTokens$fParseWhereClause$fParseGenerics$fParseLifetimeDef$fParseTyParam$fParseTraitItem$fParseImplItem $fParseBlock$fParseTokenStream$fParseTokenTree$fParseSourceFile $fParseItem $fParseStmt $fParseExpr $fParsePat $fParseTy$fParseAttribute $fParseLit hashStringghc-prim GHC.TypesTruebaseGHC.IO.Handle.TypesHandleGHC.BaseStringISData.Semigroup<>Reversed toNonEmptyData.List.NonEmptyNonEmptyunsnocsnoc GHC.GenericsGenericGHC.EnumNothing$fLocatedTokenStream $fShowTokenn emptyElim Data.Maybemaybe<##>flattencommasliftOpmempty<+>hsep<#>vsepunlesswhenperhapsindentungroupnoIndentstringprintLitprintLitSuffix printIntLit byte2Char char2Byte escapeByte escapeCharpadHexprintSourceFile printName printIdent printTypeprintMacprintSpaceBetweenprintTtprintTokenTreesprintTokenStreamSpprintTokenStream printToken printLitTokprintNonterminal printStmt printExprprintExprOuterAttrStyleprintStrexpressionAttrs printFieldprintRangeLimitsprintFnBlockArgsprintArm printBlockprintBlockWithAttrs printElse printBinOp printUnOpprintInnerAttrsprintOuterAttrsprintEitherAttrs printAttrprintCookedIdent printItemprintTraitItem printBounds printBoundprintFormalLifetimeList printImplItemprintDefprintAssociatedTypeprintMethodSigprintAssociatedConst printPolarityprintVisprintForeignItem printStructprintStructField printUnsafety printEnumDef printVariantprintWhereClauseprintWherePredicateprintFnprintFnArgsAndRetprintArg printLifetimeprintLifetimeDefprintMutabilityprintFullMutabilityprintPat printFieldPatprintBindingModeprintFnHeaderInfoprintAbiprintModprintForeignMod printGenericsprintPolyTraitRef printTraitRefprintPathParameters printPath printSegment printQPath printUseTree printTyParamprintLifetimeBounds modifyPStateunParser unescapeChar unescapeByte unescapeChar' unescapeByte'unescapeInteger unescapeFloatreadHexnumBase AlexInputtokenliteral rawString nestedCommentnextCharpeekChar greedyCharalexInputPrevChar alexGetBytealexMoveAlexAcc AlexAccNone AlexAccSkip AlexAccPredAlexAccSkipPred AlexLastAccAlexNone AlexLastSkip AlexReturnAlexEOF AlexErrorAlexSkip AlexTokenAlexAddrAlexA#IdentStructFieldBareStructFieldStmtItemModItemTermStmtAnyStmtAnyExprLitExpr LitOrPathExpr NoStructExprNoStructBlockExprSemiExprArgType GeneralArgNamedArgTyParamBoundType NoneBoundModBoundNoSelf VarNoSelf AllowSelfTyTypeAnyType NoSumTypeGHC.Num+ PrimParenType GHC.Classes< NoForTypePathTypeUsePathModPathAttrType EitherAttr InnerAttr OuterAttrresolveMResolveM Data.DynamicDynamiclogIssuewarncorrecterrscoperesolveSourceFile resolveIdent resolveAttrGHC.Real/* resolveLit resolvePathresolvePathParameters resolveQSelfresolveLifetimeresolveTraitRef resolveTy resolveFnDecl isSelfArgresolveTyParamBound resolveArg isSelfAlikeresolvePolyTraitRefresolveLifetimeDef resolvePatresolveFieldPatrhsrhs2 resolveExpr resolveExprPparenE resolveField resolveArm resolveStmt resolveBlock resolveItemresolveForeignItemresolveWhereClauseresolveGenericsresolveTyParamresolveVariantresolveVariantDataresolveStructFieldresolveWherePredicateresolveTraitItemresolveImplItemresolveVisibilityMonoidresolveMethodSigresolveUseTree resolveMac resolveTt$fShowResolveFail $fResolvePathStructFieldTypeItemTypeStmtTypeExprType FnDeclTypeTypePathExprPathparseLit parseAttrparseTyparsePat parseStmt parseExpr parseItem parseBlock parseImplItemparseTraitItemparseTtparseTokenStream parseTyParamparseLifetimeDefparseWhereClause parseGenerics expParseErrortoIdenttoStmtnoVis withWherenoSafety macroItemaddAttrsparseSourceFilenudge|:|> HappyAddrHappyA#HappyStk Happy_IntList HappyCons HappyAbsSynquoter