pub struct NamingOpTok {
pub tok: Token,
pub span: Span,
}Expand description
The operator token accepted inside a ( ‹op› ) NAMING form (see
OpNameTok) — BinOpTok’s whole alternative set, PLUS
!/before. Upstream parser.mly’s binop nonterminal is used in
exactly two productions, both naming forms (VAL LPAREN binop RPAREN
and LPAREN binop RPAREN as a bare atomic-expression reference) —
never for infix chaining — and it accepts UNOP_EXCLAM/BEFORE/
LNOT there, unlike this grammar’s flattened infix operator chain
(cst.rs’s OpRhs, which uses BinOpTok directly and correctly
excludes them: !/before are not simple infix operators here).
LNOT (not) has no reserved keyword token in this port at all (see the
not note beside crate::token::Token::Mod): it lexes as an ordinary
VarTok, so let not x = ../val not : ty (unparenthesized) already
parse via the plain-name arm of cst.rs’s BindName/ast::Atomic:: OpRef’s sibling Var arm, with no token to add here. Kept as its own
struct (mirroring
BinOpTok’s shape) rather than widening BinOpTok itself, so the
infix-chain grammar’s exclusion stays intact by construction — nothing
downstream of BinOpTok::parse can ever see !/before.
Fields§
§tok: Token§span: SpanImplementations§
Source§impl NamingOpTok
impl NamingOpTok
Sourcepub fn op_text(&self) -> String
pub fn op_text(&self) -> String
The operator’s source text, e.g. "+", "mod", "::", "!",
"before" — BinOpTok::op_text plus the two naming-only
additions.
Trait Implementations§
Source§impl Clone for NamingOpTok
impl Clone for NamingOpTok
Source§fn clone(&self) -> NamingOpTok
fn clone(&self) -> NamingOpTok
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NamingOpTok
impl Debug for NamingOpTok
Source§impl Parse<WithSpan<Token, Span>> for NamingOpTok
impl Parse<WithSpan<Token, Span>> for NamingOpTok
Source§type Error = ParseError<Span>
type Error = ParseError<Span>
<FieldTy as Parse<Atom>>::Error: Into<…> predicate re-creates a projection cycle on a
recursive field (E0275), which decycle’s bound-peeling does not break.