@@ -238,8 +238,8 @@ import qualified Data.List.NonEmpty as N
238238 innerDoc { Spanned (Doc _ Inner _) _ }
239239
240240 -- Identifiers.
241+ ' _' { Spanned (IdentTok " _" ) _ }
241242 IDENT { Spanned IdentTok{} _ }
242- ' _' { Spanned Underscore _ }
243243
244244 -- Lifetimes.
245245 LIFETIME { Spanned (LifetimeTok _) _ }
@@ -278,7 +278,7 @@ import qualified Data.List.NonEmpty as N
278278%nonassoc mut DEF EQ ' ::'
279279
280280-- These are all identifiers of sorts (' union' and ' default' are " weak" keywords)
281- %nonassoc IDENT ntIdent default union catch self Self super auto dyn
281+ %nonassoc IDENT ntIdent default union catch self Self super auto dyn crate
282282
283283-- These are all very low precedence unary operators
284284%nonassoc box return yield break continue for IMPLTRAIT LAMBDA
@@ -575,6 +575,7 @@ mod_path :: { Path Span }
575575
576576self_or_ident :: { Spanned Ident }
577577 : ident { $1 }
578+ | crate { Spanned " crate" (spanOf $1 ) }
578579 | self { Spanned " self" (spanOf $1 ) }
579580 | Self { Spanned " Self" (spanOf $1 ) }
580581 | super { Spanned " super" (spanOf $1 ) }
@@ -585,7 +586,7 @@ self_or_ident :: { Spanned Ident }
585586-----------
586587
587588lifetime :: { Lifetime Span }
588- : LIFETIME { let Spanned (LifetimeTok (Ident l _)) s = $1 in Lifetime l s }
589+ : LIFETIME { let Spanned (LifetimeTok (Ident l _ _ )) s = $1 in Lifetime l s }
589590
590591-- parse_trait_ref()
591592trait_ref :: { TraitRef Span }
@@ -1125,7 +1126,7 @@ blockpostfix_expr :: { Expr Span }
11251126
11261127-- labels on loops
11271128label :: { Label Span }
1128- : LIFETIME { let Spanned (LifetimeTok (Ident l _)) s = $1 in Label l s }
1129+ : LIFETIME { let Spanned (LifetimeTok (Ident l _ _ )) s = $1 in Label l s }
11291130
11301131-- Literal expressions (composed of just literals)
11311132lit_expr :: { Expr Span }
@@ -1510,6 +1511,7 @@ vis :: { Spanned (Visibility Span) }
15101511 : {- empty -} %prec VIS { Spanned InheritedV mempty }
15111512 | pub %prec VIS { Spanned PublicV (spanOf $1) }
15121513 | pub ' (' crate ' )' { Spanned CrateV ($1 # $4) }
1514+ | crate { Spanned CrateV (spanOf $1) }
15131515 | pub ' (' in mod_path ' )' { Spanned (RestrictedV $4) ($1 # $5) }
15141516 | pub ' (' super ' )' { Spanned (RestrictedV (Path False [PathSegment "super" Nothing (spanOf
15151517 $3)] (spanOf $3))) ($1 # $4) }
@@ -1903,8 +1905,8 @@ addAttrs as (Yield as' e s) = Yield (as ++ as') e s
19031905-- | Given a ' LitTok' token that is expected to result in a valid literal, construct the associated
19041906-- literal. Note that this should _never_ fail on a token produced by the lexer.
19051907lit :: Spanned Token -> Lit Span
1906- lit (Spanned (IdentTok (Ident " true" _)) s) = Bool True Unsuffixed s
1907- lit (Spanned (IdentTok (Ident " false" _)) s) = Bool False Unsuffixed s
1908+ lit (Spanned (IdentTok (Ident " true" False _)) s) = Bool True Unsuffixed s
1909+ lit (Spanned (IdentTok (Ident " false" False _)) s) = Bool False Unsuffixed s
19081910lit (Spanned (LiteralTok litTok suffix_m) s) = translateLit litTok suffix s
19091911 where
19101912 suffix = case suffix_m of
0 commit comments