Diff
Not logged in

Differences From Artifact [ec0e00bb40d202e7]:

To Artifact [70a85e9a66eddacd]:


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