/// <summary></summary> protected virtual void GenerateCompilationUID() { string NewGuidDigits = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture) + ":" + "H"; BaseNode.IIdentifier Operator = NodeHelper.CreateSimpleIdentifier("To UUID"); BaseNode.IManifestNumberExpression NumberExpression = NodeHelper.CreateSimpleManifestNumberExpression(NewGuidDigits); BaseNode.IUnaryOperatorExpression Expression = NodeHelper.CreateUnaryOperatorExpression(Operator, NumberExpression); CompilationUID = ToCompilerNode <BaseNode.IUnaryOperatorExpression, IUnaryOperatorExpression>(Expression); }
/// <summary></summary> public bool ReplacePhase1Macro(BaseNode.INode node, BaseNode.INode parentNode, string propertyName, IWalkCallbacks <ReplacePhase1MacroContext> callbacks, ReplacePhase1MacroContext context) { bool Result = true; if (node is IClass AsClass) { context.CurrentClass = AsClass; } else if (node is ILibrary || node is IGlobalReplicate) { context.CurrentClass = null; } else if (node is IPreprocessorExpression AsPreprocessorExpression) { bool IsHandled = false; switch (AsPreprocessorExpression.Value) { case BaseNode.PreprocessorMacro.DateAndTime: NodeTreeHelperChild.SetChildNode(parentNode, propertyName, CompilationDateTime); IsHandled = true; break; case BaseNode.PreprocessorMacro.CompilationDiscreteIdentifier: NodeTreeHelperChild.SetChildNode(parentNode, propertyName, CompilationUID); IsHandled = true; break; case BaseNode.PreprocessorMacro.CompilerVersion: NodeTreeHelperChild.SetChildNode(parentNode, propertyName, CompilerVersion); IsHandled = true; break; case BaseNode.PreprocessorMacro.ConformanceToStandard: NodeTreeHelperChild.SetChildNode(parentNode, propertyName, ConformanceToStandard); IsHandled = true; break; case BaseNode.PreprocessorMacro.DiscreteClassIdentifier: Debug.Assert(context.CurrentClass != null); string GlassGuidDigits = context.CurrentClass.ClassGuid.ToString("N", CultureInfo.InvariantCulture) + ":" + "H"; BaseNode.IIdentifier Operator = NodeHelper.CreateSimpleIdentifier("To UUID"); BaseNode.IManifestNumberExpression NumberExpression = NodeHelper.CreateSimpleManifestNumberExpression(GlassGuidDigits); BaseNode.IUnaryOperatorExpression Expression = NodeHelper.CreateUnaryOperatorExpression(Operator, NumberExpression); IExpression ReplacementNode = ToCompilerNode <BaseNode.IUnaryOperatorExpression, IUnaryOperatorExpression>(Expression); NodeTreeHelperChild.SetChildNode(parentNode, propertyName, ReplacementNode); IsHandled = true; break; case BaseNode.PreprocessorMacro.Debugging: NodeTreeHelperChild.SetChildNode(parentNode, propertyName, Debugging); IsHandled = true; break; // Processed in phase 2. case BaseNode.PreprocessorMacro.ClassPath: case BaseNode.PreprocessorMacro.Counter: case BaseNode.PreprocessorMacro.RandomInteger: IsHandled = true; break; } Debug.Assert(IsHandled); } return(Result); }