Diff
Not logged in

Differences From Artifact [70a85e9a66eddacd]:

To Artifact [e37c83f645af4d82]:


9 9 10 /// Type for the layer ID 10 /// Type for the layer ID 11 11 12 alias string Layer; 12 alias string Layer; 13 13 14 enum : Layer 14 enum : Layer 15 { 15 { 16 SystemLayer = "(system)", /// Predefined layer for internal data | 16 LiftLayer = "(lift)", /// Predefined layer for storing lift func > 17 NoopLayer = "(noop)", /// Predefined layer for just allocating a 17 ValueLayer = "@value", /// Predefined layer for normal run 18 ValueLayer = "@value", /// Predefined layer for normal run 18 MacroLayer = "@macro", /// Predefined layer for macro run (@lay() 19 MacroLayer = "@macro", /// Predefined layer for macro run (@lay() 19 RawMacroLayer = "(rawmacro)", /// Predefined layer for macro run (@lay() 20 RawMacroLayer = "(rawmacro)", /// Predefined layer for macro run (@lay() 20 } 21 } 21 22 22 /// True if it is a user-defined layer 23 /// True if it is a user-defined layer 23 24 24 bool isUserDefinedLayer( Layer lay ) 25 bool isUserDefinedLayer( Layer lay ) 25 { 26 { 26 return lay!=SystemLayer && lay!=ValueLayer && lay!=MacroLayer && lay!=Ra | 27 return lay!=NoopLayer && lay!=LiftLayer && lay!=ValueLayer && lay!=Macro 27 } 28 } 28 29 29 unittest 30 unittest 30 { 31 { 31 assert( !isUserDefinedLayer(SystemLayer) ); | 32 assert( !isUserDefinedLayer(NoopLayer) ); > 33 assert( !isUserDefinedLayer(LiftLayer) ); 32 assert( !isUserDefinedLayer(ValueLayer) ); 34 assert( !isUserDefinedLayer(ValueLayer) ); 33 assert( !isUserDefinedLayer(MacroLayer) ); 35 assert( !isUserDefinedLayer(MacroLayer) ); 34 assert( !isUserDefinedLayer(RawMacroLayer) ); 36 assert( !isUserDefinedLayer(RawMacroLayer) ); 35 assert( isUserDefinedLayer("@foo") ); 37 assert( isUserDefinedLayer("@foo") ); 36 } 38 } 37 39 38 /// True if it is macro-like layer that basically generates syntax tree 40 /// True if it is macro-like layer that basically generates syntax tree ................................................................................................................................................................................ 40 bool isASTLayer( Layer lay ) 42 bool isASTLayer( Layer lay ) 41 { 43 { 42 return lay==MacroLayer || lay==RawMacroLayer; 44 return lay==MacroLayer || lay==RawMacroLayer; 43 } 45 } 44 46 45 unittest 47 unittest 46 { 48 { 47 assert( !isASTLayer(SystemLayer) ); | 49 assert( !isASTLayer(NoopLayer) ); > 50 assert( !isASTLayer(LiftLayer) ); 48 assert( !isASTLayer(ValueLayer) ); 51 assert( !isASTLayer(ValueLayer) ); 49 assert( isASTLayer(MacroLayer) ); 52 assert( isASTLayer(MacroLayer) ); 50 assert( isASTLayer(RawMacroLayer) ); 53 assert( isASTLayer(RawMacroLayer) ); 51 } 54 } 52 55 53 /// True if in the specified layer @lay(...) has no effect and merely produces a 56 /// True if in the specified layer @lay(...) has no effect and merely produces a 54 57 ................................................................................................................................................................................ 55 bool isNoLayerChangeLayer( Layer lay ) 58 bool isNoLayerChangeLayer( Layer lay ) 56 { 59 { 57 return lay==RawMacroLayer; 60 return lay==RawMacroLayer; 58 } 61 } 59 62 60 unittest 63 unittest 61 { 64 { 62 assert( !isNoLayerChangeLayer(SystemLayer) ); | 65 assert( !isNoLayerChangeLayer(NoopLayer) ); > 66 assert( !isNoLayerChangeLayer(LiftLayer) ); 63 assert( !isNoLayerChangeLayer(ValueLayer) ); 67 assert( !isNoLayerChangeLayer(ValueLayer) ); 64 assert( !isNoLayerChangeLayer(MacroLayer) ); 68 assert( !isNoLayerChangeLayer(MacroLayer) ); 65 assert( isNoLayerChangeLayer(RawMacroLayer) ); 69 assert( isNoLayerChangeLayer(RawMacroLayer) ); 66 } 70 } 67 71 68 /// True if do macro expanstion 72 /// True if do macro expanstion 69 73 ................................................................................................................................................................................ 70 bool isMacroLayer( Layer lay ) 74 bool isMacroLayer( Layer lay ) 71 { 75 { 72 return lay==MacroLayer || lay==RawMacroLayer; 76 return lay==MacroLayer || lay==RawMacroLayer; 73 } 77 } 74 78 75 unittest 79 unittest 76 { 80 { 77 assert( !isMacroLayer(SystemLayer) ); | 81 assert( !isMacroLayer(NoopLayer) ); > 82 assert( !isMacroLayer(LiftLayer) ); 78 assert( !isMacroLayer(ValueLayer) ); 83 assert( !isMacroLayer(ValueLayer) ); 79 assert( isMacroLayer(MacroLayer) ); 84 assert( isMacroLayer(MacroLayer) ); 80 assert( isMacroLayer(RawMacroLayer) ); 85 assert( isMacroLayer(RawMacroLayer) ); 81 } 86 }