Enum tagua_parser::ast::Ty
[−]
[src]
pub enum Ty<'a> { Copy(Option<Name<'a>>), Reference(Option<Name<'a>>), }
A type declaration.
A type holds two informations: Name, and copy or reference. A type
can be native (fully qualified name), or user-defined with an
interface or a class (unqualified, qualified, or fully qualified
name). Note that the name is an Option
: A binding can have no
type, but still hold the copy or reference constraint.
A type can be a copy type, it means the value must be copied (at least on write), or it can be a reference type, it means this is a new binding over an existing binding.
Variants
Copy(Option<Name<'a>>)
A type representing a datum passed by copy.
Examples
use tagua_parser::Result; use tagua_parser::ast::{ Arity, Name, Parameter, Ty, Variable }; use tagua_parser::rules::statements::function::parameters; assert_eq!( parameters(b"(I $x)"), Result::Done( &b""[..], Arity::Finite(vec![ Parameter { ty : Ty::Copy(Some(Name::Unqualified(&b"I"[..]))), name : Variable(&b"x"[..]), value: None } ]) ) );Run
Reference(Option<Name<'a>>)
A type representing a datum passed by reference.
Examples
use tagua_parser::Result; use tagua_parser::ast::{ Arity, Name, Parameter, Ty, Variable }; use tagua_parser::rules::statements::function::parameters; assert_eq!( parameters(b"(I &$x)"), Result::Done( &b""[..], Arity::Finite(vec![ Parameter { ty : Ty::Reference(Some(Name::Unqualified(&b"I"[..]))), name : Variable(&b"x"[..]), value: None } ]) ) );Run