public override void EvaluateInternal(PonyTextContext textContext) { foreach (var item in structs) { item.Evaluate(textContext); } }
public override void EvaluateInternal(PonyTextContext textContext) { foreach (var directive in textDirectives) { textContext.WriteTextElement(TextElementFactory.CreateTextElement(TextElementType.Paragraph)); directive.Evaluate(textContext); } }
public void Evaluate(PonyTextContext textContext) { try { EvaluateInternal(textContext); } catch (PreProcessorException e) { e.AddToStackTrace(PreProcessTrace.CreateTraceTokenLevel(AssociatedToken)); throw e; } }
public static PonyTextStructureBase CreateEvaluable(string ponyTextPath, PonyTextContext ctx) { string fileLocation = ctx.Metadata.GetAbsolutePath(ponyTextPath); if (!File.Exists(fileLocation)) { throw new ArgumentException($"Unable to process PonyText source file locate at \"{fileLocation}\". Not such file."); } return(CreateEvaluable(File.ReadAllText(fileLocation, Encoding.UTF8), fileLocation, ctx)); }
public override void EvaluateInternal(PonyTextContext textContext) { var textElement = TextElementFactory.CreateTextElement(TextElementType.Paragraph); PonyTextContext ctx = new DerivedTextContext(textContext, textElement); foreach (var item in structureBases) { item.Evaluate(ctx); } textContext.WriteTextElement(textElement); }
public override void Render(AbstractRendererBase rendererBase, PonyTextContext textContext) { AbstractProcessor abstractProcessor = null; if (CustomProperty.HasProperty(AbstractProcessor.RENDER_PROCESSOR_PROPERTY)) { var processor = CustomProperty.GetProperty(AbstractProcessor.RENDER_PROCESSOR_PROPERTY) as string; abstractProcessor = textContext.ProcessorFactory.GetRenderProcessor(processor); abstractProcessor.PreRendering(textContext, rendererBase, this); } rendererBase.RenderText(Content, CustomProperty); abstractProcessor?.PostRendering(textContext, rendererBase, this); }
public PonyTextStructureBase[] ToParameter(PonyTextContext ctx) { PonyTextStructureBase[] arr = new PonyTextStructureBase[arguments.Count]; for (int i = 0; i < arguments.Count; i++) { PonyTextStructureBase structBase = arguments[i]; if (structBase.StructureType == StructureType.MarcoStruct) { arr[i] = ctx.MacroTable.GetMarco(((PonyTextMarcoStruct)structBase).MarcoName); } else { arr[i] = structBase; } } return(arr); }
public override void Render(AbstractRendererBase rendererBase, PonyTextContext textContext) { rendererBase.StartParagraphRendering(CustomProperty); AbstractProcessor abstractProcessor = null; if (CustomProperty.HasProperty(AbstractProcessor.RENDER_PROCESSOR_PROPERTY)) { var processor = CustomProperty.GetProperty(AbstractProcessor.RENDER_PROCESSOR_PROPERTY) as string; abstractProcessor = textContext.ProcessorFactory.GetRenderProcessor(processor); abstractProcessor.PreRendering(textContext, rendererBase, this); } foreach (var text in texts) { text.Render(rendererBase, textContext); } abstractProcessor?.PostRendering(textContext, rendererBase, this); rendererBase.EndParagraphRendering(); }
public override void EvaluateInternal(PonyTextContext textContext) { if (!textContext.MacroTable.ContainsMarco(name)) { var processor = textContext.ProcessorFactory.GetPreProcessor(name); processor.Preporcess(textContext, ToParameter(textContext)); } else { var structureBase = textContext.MacroTable.GetMarco(name); PonyTextStructureBase[] param = ToParameter(textContext); for (var i = 0; i < arguments.Count; i++) { textContext.MacroTable.PutMarco($"_{i + 1}", param[i]); } structureBase.Evaluate(textContext); } }
public void Preporcess(PonyTextContext context, PonyTextStructureBase[] args) { ctx = context; try { ProcessorParam?.ValidateParameter(args); OnPreProcessInternal(args); } catch (Exception e) { if (e is PreProcessorException) { PreProcessorException ppe = (PreProcessorException)e; ppe.AddToStackTrace(PreProcessTrace.CreateTrace(ProcessorAttribute.ProcessorName)); throw ppe; } else { throw new PreProcessorException(ProcessorAttribute.ProcessorName, e.Message); } } }
public override void Render(AbstractRendererBase rendererBase, PonyTextContext textContext) { rendererBase.RenderDirectives(directives, CustomProperty); }
public abstract void Render(AbstractRendererBase rendererBase, PonyTextContext textContext);
public abstract void EvaluateInternal(PonyTextContext textContext);
public static PonyTextStructureBase CreateEvaluable(string ponyTextContent, string ponyTextIdentifier, PonyTextContext ctx) { ctx.Metadata.DependencyList.AddDependency(ponyTextIdentifier); PonyLexer ponyLexer = new PonyLexer(); PonyParser parser = new PonyParser(ponyLexer); parser.errorListener = GlobalConfiguration.Instance.ParserErrorListener; ponyLexer.errorListener = parser.errorListener; return(parser.Parse(ponyTextContent)); }
public void PostRendering(PonyTextContext context, AbstractRendererBase rendererBase, AbstractTextElement textElement) { ctx = context; OnPostRenderInternal(textElement, rendererBase); }
public override void EvaluateInternal(PonyTextContext textContext) { }
public override void EvaluateInternal(PonyTextContext textContext) { textContext.WriteTextElement(TextElementFactory.CreateTextElement(TextElementType.TextUnit, num.ToString())); }
public override void EvaluateInternal(PonyTextContext textContext) { textContext.MacroTable.GetMarco(MarcoName).Evaluate(textContext); }