@@ -42,7 +42,7 @@ pub(crate) struct ExhaustedIndexRegisters {
4242/// We failed while evaluating the value of a word (typically, the
4343/// value of a word in the final assembled output).
4444#[ derive( Debug , PartialEq , Eq ) ]
45- pub ( crate ) enum SymbolLookupFailure {
45+ pub ( crate ) enum EvaluationFailure {
4646 /// Evaluation failed because there was a loop in the definition
4747 /// of a symbol (i.e. in one of the equaities we needed to
4848 /// evaluate to determine the final result).
@@ -61,23 +61,23 @@ pub(crate) enum SymbolLookupFailure {
6161 HereIsNotAllowedHere ( Span ) ,
6262}
6363
64- impl Spanned for SymbolLookupFailure {
64+ impl Spanned for EvaluationFailure {
6565 fn span ( & self ) -> Span {
6666 match self {
67- SymbolLookupFailure :: HereIsNotAllowedHere ( span)
68- | SymbolLookupFailure :: FailedToAssignIndexRegister ( ExhaustedIndexRegisters {
67+ EvaluationFailure :: HereIsNotAllowedHere ( span)
68+ | EvaluationFailure :: FailedToAssignIndexRegister ( ExhaustedIndexRegisters {
6969 span,
7070 ..
7171 } )
72- | SymbolLookupFailure :: SymbolDefinitionLoop { span, .. }
73- | SymbolLookupFailure :: BlockTooLarge ( span, _) => * span,
72+ | EvaluationFailure :: SymbolDefinitionLoop { span, .. }
73+ | EvaluationFailure :: BlockTooLarge ( span, _) => * span,
7474 }
7575 }
7676}
7777
78- impl Display for SymbolLookupFailure {
78+ impl Display for EvaluationFailure {
7979 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result < ( ) , fmt:: Error > {
80- use SymbolLookupFailure :: * ;
80+ use EvaluationFailure :: * ;
8181 match self {
8282 SymbolDefinitionLoop {
8383 deps_in_order,
@@ -107,33 +107,33 @@ impl Display for SymbolLookupFailure {
107107 }
108108}
109109
110- impl SymbolLookupFailure {
110+ impl EvaluationFailure {
111111 /// Convert an instance of `EvaluationFailure` (which describes
112112 /// why an evaluation failed) into an instance of [`ProgramError`]
113113 /// (which describes why the user's program cannot be assembled).
114114 pub ( crate ) fn into_program_error ( self ) -> ProgramError {
115115 match self {
116- SymbolLookupFailure :: FailedToAssignIndexRegister ( ExhaustedIndexRegisters {
116+ EvaluationFailure :: FailedToAssignIndexRegister ( ExhaustedIndexRegisters {
117117 span,
118118 name,
119119 } ) => ProgramError :: FailedToAssignIndexRegister ( span, name) ,
120- SymbolLookupFailure :: BlockTooLarge ( span, mle) => ProgramError :: BlockTooLong ( span, mle) ,
121- SymbolLookupFailure :: SymbolDefinitionLoop {
120+ EvaluationFailure :: BlockTooLarge ( span, mle) => ProgramError :: BlockTooLong ( span, mle) ,
121+ EvaluationFailure :: SymbolDefinitionLoop {
122122 deps_in_order,
123123 span,
124124 } => ProgramError :: SymbolDefinitionLoop {
125125 symbol_names : deps_in_order,
126126 span,
127127 } ,
128- SymbolLookupFailure :: HereIsNotAllowedHere ( span) => ProgramError :: SyntaxError {
128+ EvaluationFailure :: HereIsNotAllowedHere ( span) => ProgramError :: SyntaxError {
129129 span,
130130 msg : "# is not allowed in this context" . to_string ( ) ,
131131 } ,
132132 }
133133 }
134134}
135135
136- impl std:: error:: Error for SymbolLookupFailure { }
136+ impl std:: error:: Error for EvaluationFailure { }
137137
138138/// HereValue specifies the value used for `#`. A `#` always
139139/// signifies the address of the word we are trying to assemble.
@@ -147,10 +147,10 @@ pub(crate) enum HereValue {
147147}
148148
149149impl HereValue {
150- pub ( crate ) fn get_address ( & self , span : & Span ) -> Result < Address , SymbolLookupFailure > {
150+ pub ( crate ) fn get_address ( & self , span : & Span ) -> Result < Address , EvaluationFailure > {
151151 match self {
152152 HereValue :: Address ( addr) => Ok ( * addr) ,
153- HereValue :: NotAllowed => Err ( SymbolLookupFailure :: HereIsNotAllowedHere ( * span) ) ,
153+ HereValue :: NotAllowed => Err ( EvaluationFailure :: HereIsNotAllowedHere ( * span) ) ,
154154 }
155155 }
156156}
@@ -238,7 +238,7 @@ impl<R: RcUpdater> EvaluationContext<'_, R> {
238238 pub ( super ) fn fetch_or_assign_default (
239239 & mut self ,
240240 name : & SymbolName ,
241- ) -> Result < Unsigned36Bit , SymbolLookupFailure > {
241+ ) -> Result < Unsigned36Bit , EvaluationFailure > {
242242 let existing_def: & mut ImplicitDefinition = match self . implicit_symtab . get_mut ( name) {
243243 Some ( def) => def,
244244 None => {
@@ -305,7 +305,7 @@ impl<R: RcUpdater> EvaluationContext<'_, R> {
305305 * existing_def = ImplicitDefinition :: DefaultAssigned ( value, context) ;
306306 Ok ( value)
307307 }
308- Err ( e) => Err ( SymbolLookupFailure :: FailedToAssignIndexRegister ( e) ) ,
308+ Err ( e) => Err ( EvaluationFailure :: FailedToAssignIndexRegister ( e) ) ,
309309 }
310310 }
311311 }
@@ -461,7 +461,7 @@ pub(super) trait Evaluate: Spanned {
461461 & self ,
462462 ctx : & mut EvaluationContext < R > ,
463463 scope : ScopeIdentifier ,
464- ) -> Result < Unsigned36Bit , SymbolLookupFailure > ;
464+ ) -> Result < Unsigned36Bit , EvaluationFailure > ;
465465}
466466
467467// Represents the RC-block; see [section 6-2.6 of the Users
@@ -547,14 +547,14 @@ pub(crate) fn symbol_name_lookup<R: RcUpdater>(
547547 span : Span ,
548548 ctx : & mut EvaluationContext < R > ,
549549 scope : ScopeIdentifier ,
550- ) -> Result < Unsigned36Bit , SymbolLookupFailure > {
550+ ) -> Result < Unsigned36Bit , EvaluationFailure > {
551551 ctx. lookup_operation . deps_in_order . push ( name. clone ( ) ) ;
552552 if !ctx. lookup_operation . depends_on . insert ( name. clone ( ) ) {
553553 // `name` was already in `depends_on`; in other words,
554554 // we have a loop.
555555 match OneOrMore :: try_from_vec ( ctx. lookup_operation . deps_in_order . clone ( ) ) {
556556 Ok ( deps_in_order) => {
557- return Err ( SymbolLookupFailure :: SymbolDefinitionLoop {
557+ return Err ( EvaluationFailure :: SymbolDefinitionLoop {
558558 span,
559559 deps_in_order,
560560 } ) ;
@@ -611,7 +611,7 @@ pub(super) fn extract_final_equalities<R: RcUpdater>(
611611 FinalSymbolDefinition :: PositionIndependent ( value) ,
612612 ) ;
613613 }
614- Err ( SymbolLookupFailure :: HereIsNotAllowedHere ( _) ) => {
614+ Err ( EvaluationFailure :: HereIsNotAllowedHere ( _) ) => {
615615 // The value of this equality would depend on the
616616 // address at which it is evaluated, so it has no
617617 // single final value. This is OK.
@@ -664,7 +664,7 @@ impl Evaluate for BlockPosition {
664664 & self ,
665665 ctx : & mut EvaluationContext < R > ,
666666 scope : ScopeIdentifier ,
667- ) -> Result < Unsigned36Bit , SymbolLookupFailure > {
667+ ) -> Result < Unsigned36Bit , EvaluationFailure > {
668668 // Resolve the address of this block by evaluating its origin
669669 // specification if it has one.
670670 if let Some ( origin) = self . origin . as_ref ( ) {
@@ -712,7 +712,7 @@ impl Evaluate for BlockPosition {
712712 // of the address of the previous block and
713713 // the size of the previous block which is the
714714 // problem.
715- Err ( SymbolLookupFailure :: BlockTooLarge (
715+ Err ( EvaluationFailure :: BlockTooLarge (
716716 prev_span,
717717 MachineLimitExceededFailure :: BlockTooLarge {
718718 span : prev_span,
@@ -730,7 +730,7 @@ impl Evaluate for (&Span, &SymbolName, &ExplicitDefinition) {
730730 & self ,
731731 ctx : & mut EvaluationContext < R > ,
732732 scope : ScopeIdentifier ,
733- ) -> Result < Unsigned36Bit , SymbolLookupFailure > {
733+ ) -> Result < Unsigned36Bit , EvaluationFailure > {
734734 let ( _span, name, def) : ( & Span , & SymbolName , & ExplicitDefinition ) = * self ;
735735 match def {
736736 ExplicitDefinition :: Origin ( Origin :: Symbolic ( _span, name) , _block_id) => {
@@ -755,7 +755,7 @@ impl Evaluate for (&Span, &SymbolName, &ExplicitDefinition) {
755755 subword:: right_half ( block_position. evaluate ( ctx, scope) ?) . into ( ) ;
756756 match offset_from_origin ( & block_origin, * block_offset) {
757757 Ok ( computed_address) => Ok ( computed_address. into ( ) ) ,
758- Err ( _overflow_error) => Err ( SymbolLookupFailure :: BlockTooLarge (
758+ Err ( _overflow_error) => Err ( EvaluationFailure :: BlockTooLarge (
759759 * span,
760760 MachineLimitExceededFailure :: BlockTooLarge {
761761 span : * span,
0 commit comments