public ClassificationParseResult(ITextSnapshot snapshot, Token tokens, Comment[] comments, Directive[] directives) { Snapshot = snapshot; Tokens = tokens; Comments = comments; Directives = directives; }
public static StrategyDecision New( Directive processDirective, MessageDirective messageDirective, IEnumerable<ProcessId> affects, Time pause ) => new StrategyDecision(processDirective, messageDirective, affects, pause);
public void Add(Directive d) { if(IsDirectiveSet(d.name)) throw new DirectiveAlreadySetException (d.name); directives.Add (d); }
public static void RenderDirective(StringBuilder sb, Directive dir) { switch (dir.Type) { case DirectiveType.Charset: RenderDirectiveToCharSetString(sb, dir); return; case DirectiveType.Page: RenderDirectiveToPageString(sb, dir); return; case DirectiveType.Media: RenderDirectiveToMediaString(sb, dir); return; case DirectiveType.Import: RenderDirectiveToImportString(sb, dir); return; case DirectiveType.FontFace: RenderDirectiveToFontFaceString(sb, dir); return; } sb.AppendFormat("{0} ", dir.Name); if (dir.Expression != null) { sb.AppendFormat("{0} ", dir.Expression); } bool first = true; foreach (Medium m in dir.Mediums) { if (first) { first = false; sb.Append(" "); } else { sb.Append(", "); } RenderMedium(sb, m); } bool HasBlock = (dir.Declarations.Count > 0 || dir.Directives.Count > 0 || dir.RuleSets.Count > 0); if (!HasBlock) { sb.Append(";"); return; } foreach (Directive dr in dir.Directives) RenderDirectiveToCharSetString(sb, dr); foreach (RuleSet rules in dir.RuleSets) RenderRuleSet(sb, rules); first = true; foreach (Declaration dec in dir.Declarations) { if (first) { first = false; } else { sb.Append(";"); } RenderDeclaration(sb, dec); } sb.Append("}"); }
public Failure(Directive directive, bool stop, int depth, int failPre, int failPost, int failConstr, int stopKids) : base("failure") { Directive = directive; Stop = stop; Depth = depth; FailPre = failPre; FailPost = failPost; FailConstr = failConstr; StopKids = stopKids; }
public static bool CanBeEmptyDirective(Directive current_directive) { return current_directive == Directive.Comment || current_directive == Directive.SkipIf || current_directive == Directive.ExpectPhp || current_directive == Directive.ExpectCtError || current_directive == Directive.ExpectCtWarning || current_directive == Directive.Pure || current_directive == Directive.Clr; }
public StrategyDecision( Directive processDirective, MessageDirective messageDirective, IEnumerable<ProcessId> affects, Time pause ) { ProcessDirective = processDirective; MessageDirective = messageDirective; Affects = affects; Pause = pause; }
public Z3BaseParams(Directive directive) { _directive = directive; var z3Directive = directive as Z3BaseDirective; if (z3Directive != null) { _optKind = z3Directive.OptKind; _cardAlgorithm = z3Directive.CardinalityAlgorithm; _pboAlgorithm = z3Directive.PseudoBooleanAlgorithm; _arithStrategy = z3Directive.ArithmeticStrategy; _smt2LogFile = z3Directive.SMT2LogFile; } }
public override Object Init(IInternalContextAdapter context, Object data) { base.Init(context, data); if (directive == null && rsvc.IsVelocimacro(directiveName, context.CurrentTemplateName)) { directive = rsvc.GetVelocimacro(directiveName, context.CurrentTemplateName); } if (directive != null) { directive.Init(rsvc, context, this); directive.SetLocation(Line, Column); } return data; }
private void TestService1(Directive directive) { SolverContext context = SolverContext.GetContext(); Model model = context.CreateModel(); Decision x1 = new Decision(Domain.RealRange(0, 2), "x1"); Decision x2 = new Decision(Domain.RealRange(0, 2), "x2"); Decision z = new Decision(Domain.IntegerRange(0, 1), "z"); model.AddDecisions(x1, x2, z); model.AddConstraint("Row0", x1 - z <= 1); model.AddConstraint("Row1", x2 + z <= 2); Goal goal = model.AddGoal("Goal0", GoalKind.Maximize, x1 + x2); Solution solution = context.Solve(directive); Assert.IsTrue(goal.ToInt32() == 3); context.ClearModel(); }
public Z3TermParams(Directive directive) : base(directive) { }
/// <inheritdoc /> public virtual void VisitDirective(Directive directive, ISchema schema) { }
/// <summary> /// Apply the specified prprocessor directive, and modify the /// current line index accordingly /// </summary> /// <param name="directive">Preprocessor directive</param> /// <param name="ifdefStack">Stack the holds #if/#ifdef information</param> /// <param name="processOps"></param> private void ApplyDirective(Directive directive, Stack <bool?> ifdefStack, ref bool processOps) { if (directive.Mnemonic == "#DEFINE" && processOps) { // --- Define a symbol ConditionSymbols.Add(directive.Identifier); } else if (directive.Mnemonic == "#UNDEF" && processOps) { // --- Remove a symbol ConditionSymbols.Remove(directive.Identifier); } else if (directive.Mnemonic == "#IFDEF" || directive.Mnemonic == "#IFNDEF" || directive.Mnemonic == "#IFMOD" || directive.Mnemonic == "#IFNMOD" || directive.Mnemonic == "#IF") { // --- Evaluate the condition and stop/start processing // --- operations accordingly if (processOps) { if (directive.Mnemonic == "#IF") { var value = EvalImmediate(directive, directive.Expr); processOps = value != null && value.Value != 0; } else if (directive.Mnemonic == "#IFMOD" || directive.Mnemonic == "#IFNMOD") { // --- Check for invalid identifiers if (!ValidModels.Contains(directive.Identifier)) { ReportError(Errors.Z0090, directive); processOps = false; } else { // --- OK, check the condition var refModel = _output.ModelType ?? _options.CurrentModel; processOps = refModel.ToString().ToUpper() == directive.Identifier ^ directive.Mnemonic == "#IFNMOD"; } } else { processOps = ConditionSymbols.Contains(directive.Identifier) ^ directive.Mnemonic == "#IFNDEF"; } ifdefStack.Push(processOps); } else { // --- Do not process after #else or #endif ifdefStack.Push(null); } } else if (directive.Mnemonic == "#ELSE") { if (ifdefStack.Count == 0) { ReportError(Errors.Z0060, directive); } else { // --- Process operations according to the last // --- condition's value var peekVal = ifdefStack.Pop(); if (peekVal.HasValue) { processOps = !peekVal.Value; ifdefStack.Push(processOps); } else { ifdefStack.Push(null); } } } else if (directive.Mnemonic == "#ENDIF") { if (ifdefStack.Count == 0) { ReportError(Errors.Z0061, directive); } else { // --- It is the end of an #ifden/#ifndef block ifdefStack.Pop(); // ReSharper disable once PossibleInvalidOperationException processOps = ifdefStack.Count == 0 || ifdefStack.Peek().HasValue&& ifdefStack.Peek().Value; } } }
/// <summary> /// Logs the failure. /// </summary> /// <param name="context">The actor cell.</param> /// <param name="child">The child.</param> /// <param name="cause">The cause.</param> /// <param name="directive">The directive.</param> protected virtual void LogFailure(IActorContext context, ActorRef child, Exception cause, Directive directive) { if(LoggingEnabled) { var actorInitializationException = cause as ActorInitializationException; string message; if(actorInitializationException != null && actorInitializationException.InnerException != null) message = actorInitializationException.InnerException.Message; else message = cause.Message; switch (directive) { case Directive.Resume: Publish(context, new Warning(child.Path.ToString(), GetType(), message)); break; case Directive.Escalate: //Don't log here break; default: //case Directive.Restart: //case Directive.Stop: Publish(context, new Error(cause, child.Path.ToString(), GetType(), message)); break; } } }
/// <summary> /// Logs the failure. /// </summary> /// <param name="actorCell">The actor cell.</param> /// <param name="child">The child.</param> /// <param name="cause">The cause.</param> /// <param name="directive">The directive.</param> protected virtual void LogFailure(ActorCell actorCell, ActorRef child, Exception cause, Directive directive) { switch (directive) { case Directive.Resume: actorCell.System.EventStream.Publish(new Warning(child.Path.ToString(), GetType(), cause.Message)); break; case Directive.Escalate: break; default: //case Directive.Restart: //case Directive.Stop: actorCell.System.EventStream.Publish(new Error(cause, child.Path.ToString(), GetType(), cause.Message)); break; } }
protected override string GetValue(Directive directive) { return((directive as ChordSizeDirective)?.FontSize.ToString()); }
private IActionResult HandleDiscovery(Directive directive) { List <Endpoint> endpoints = new List <Endpoint>(); var thermostatEndpoint = new Endpoint { EndpointId = "DefaultThermostat", FriendlyName = "Thermostat", Description = "A custom thermostat", ManufacturerName = "Thermostat.Net", DisplayCategories = new List <string> { DisplayCategories.Thermostat }, Cookie = new object(), Capabilities = new List <Capability> { new Capability { Type = "AlexaInterface", Interface = Interfaces.ThermostatController, Properties = new Properties { Supported = new List <NameValue> { new NameValue { Name = "targetSetpoint" }, new NameValue { Name = "thermostatMode" } }, ProactivelyReported = false, Retrievable = true } } } }; endpoints.Add(thermostatEndpoint); //add available modes endpoints.AddRange(Status.Instance.Rules.Select(x => new Endpoint { EndpointId = x.ClassName + "ThermostaMode", FriendlyName = x.FriendlyName + " Thermostat Mode", Description = "A custom operation mode for the thermostat", ManufacturerName = "Thermostat.Net", DisplayCategories = new List <string> { DisplayCategories.ActivityTrigger }, Cookie = new object(), Capabilities = new List <Capability> { new Capability { Type = "AlexaInterface", Interface = Interfaces.SceneController, Properties = new Properties { Supported = new List <NameValue> { new NameValue { Name = "targetSetpoint" }, new NameValue { Name = "thermostatMode" } }, ProactivelyReported = false, SupportsDeactivation = false } } } })); var response = new Response { Event = new Event { Header = new Header { Namespace = Namespaces.Discovery, Name = Names.DiscoveryResponse, //TODO: this is inconsistent with documentation, should be just "Response"? There seems to be a inconsistence in the documentation as both versions can be seen MessageId = Guid.NewGuid().ToString() }, Payload = new Payload { Endpoints = endpoints } } }; return(Ok(response)); }
public void SetScoreAtDirective(Directive directive) { //CurrentScore += directive.ScoreValue; }
protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e) { GlobalObjects.ComponentCore.ReloadActualStateRecordForBaseComponents(_currentDirective.ParentAircraftId); #region Загрузка элементов AnimatedThreadWorker.ReportProgress(0, "load directives"); try { if (_currentDirective.ItemId > 0) { _currentDirective = GlobalObjects.DirectiveCore.GetDirectiveById(_currentDirective.ItemId, _currentDirective.DirectiveType); } } catch (Exception ex) { Program.Provider.Logger.Log("Error while loading directives", ex); } if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } #endregion #region Калькуляция состояния директив AnimatedThreadWorker.ReportProgress(40, "calculation of directives"); GlobalObjects.MTOPCalculator.CalculateDirectiveNew(_currentDirective); if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } #endregion #region Фильтрация директив AnimatedThreadWorker.ReportProgress(70, "filter directives"); if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } #endregion #region Сравнение с рабочими пакетами AnimatedThreadWorker.ReportProgress(90, "comparison with the Work Packages"); if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } #endregion AnimatedThreadWorker.ReportProgress(100, "Complete"); }
public MosekMipSolverParams(Directive directive) : base(directive) { }
protected override string GetValue(Directive directive) { return((directive as SubtitleDirective)?.Text); }
public static void RenderDirectiveToImportString(StringBuilder sb, Directive dir) { sb.Append("@import "); if (dir.Expression != null) { sb.AppendFormat("{0} ", dir.Expression); } bool first = true; foreach (Medium m in dir.Mediums) { if (first) { first = false; sb.Append(" "); } else { sb.Append(", "); } RenderMedium(sb, m); } sb.Append(";"); }
/// <summary> /// Возвращает имя цвета директивы в отчете /// </summary> /// <param name="item"></param> /// <returns></returns> //TODO:(Evgenii Babak) пересмотреть подход с формированием conditionState private static Highlight GetHighlight(object item) { Highlight conditionState = Highlight.White; ConditionState cond; if (item is Directive) { Directive directive = (Directive)item; if (directive.NextPerformanceIsBlocked) { conditionState = Highlight.DarkGreen; } else { cond = directive.Condition; if (cond == ConditionState.NotEstimated) { conditionState = Highlight.Blue; if (directive.Status != DirectiveStatus.Closed && directive.IsApplicability && directive.Threshold.FirstPerformanceSinceNew.IsNullOrZero() && directive.Threshold.RepeatInterval.IsNullOrZero()) { conditionState = Highlight.Orange; } } if (cond == ConditionState.Notify) { conditionState = Highlight.Yellow; } if (cond == ConditionState.Overdue) { conditionState = Highlight.Red; } } } else if (item is AircraftFlight) { if (!((AircraftFlight)item).Correct) { conditionState = Highlight.Blue; } } else if (item is BaseComponent) { conditionState = Highlight.White; } else if (item is Component) { Component component = (Component)item; if (component.NextPerformanceIsBlocked) { conditionState = Highlight.DarkGreen; } else { cond = component.Condition; if (cond == ConditionState.NotEstimated) { conditionState = Highlight.Blue; } if (cond == ConditionState.Notify) { conditionState = Highlight.Yellow; } if (cond == ConditionState.Overdue) { conditionState = Highlight.Red; } } } else if (item is ComponentDirective) { ComponentDirective detDir = (ComponentDirective)item; if (detDir.NextPerformanceIsBlocked) { conditionState = Highlight.DarkGreen; } else { cond = detDir.Condition; if (cond == ConditionState.NotEstimated) { conditionState = Highlight.Blue; } if (cond == ConditionState.Notify) { conditionState = Highlight.Yellow; } if (cond == ConditionState.Overdue) { conditionState = Highlight.Red; } } } else if (item is MaintenanceDirective) { MaintenanceDirective mpd = (MaintenanceDirective)item; if (mpd.NextPerformanceIsBlocked) { conditionState = Highlight.DarkGreen; } else { cond = mpd.Condition; if (cond == ConditionState.NotEstimated) { conditionState = Highlight.Blue; if (mpd.Status != DirectiveStatus.Closed && mpd.IsApplicability && mpd.IsApplicability && mpd.Threshold.FirstPerformanceSinceNew.IsNullOrZero() && mpd.Threshold.RepeatInterval.IsNullOrZero()) { conditionState = Highlight.Orange; } } if (cond == ConditionState.Notify) { conditionState = Highlight.Yellow; } if (cond == ConditionState.Overdue) { conditionState = Highlight.Red; } if (mpd.IsExtension) { conditionState = Highlight.LightBlue; } } } else if (item is NextPerformance performance) { conditionState = Highlight.White; cond = performance.Condition; if (cond == ConditionState.Notify) { conditionState = Highlight.Yellow; } if (cond == ConditionState.Overdue) { conditionState = Highlight.Red; } if (performance.BlockedByPackage != null) { conditionState = Highlight.DarkGreen; } if (performance.Parent is IMtopCalc) { if ((performance.Parent as IMtopCalc).IsExtension) { conditionState = Highlight.LightBlue; } } } else if (item is Document) { var document = (Document)item; if (document.NextPerformanceIsBlocked) { conditionState = Highlight.DarkGreen; } else { cond = document.Condition; if (cond == ConditionState.NotEstimated) { conditionState = Highlight.Blue; } if (cond == ConditionState.Notify) { conditionState = Highlight.Yellow; } if (cond == ConditionState.Overdue) { conditionState = Highlight.Red; } } } else if (item is CheckLists) { var checkLists = (CheckLists)item; cond = checkLists.Condition; //if (cond == ConditionState.NotEstimated) // conditionState = Highlight.Blue; //if (cond == ConditionState.Satisfactory) // conditionState = Highlight.Green; if (cond == ConditionState.Notify) { conditionState = Highlight.Yellow; } if (cond == ConditionState.Overdue) { conditionState = Highlight.Red; } // if (checkLists.IsEditable) // conditionState = Highlight.Green; // else conditionState = Highlight.Red; } else if (item is CAAEducationManagment) { var manual = (CAAEducationManagment)item; if (manual.Record == null) { return(conditionState); } if (manual.Record?.Settings?.NextCompliance == null) { return(conditionState); } cond = manual.Record.Settings.NextCompliance.Condition; //if (cond == ConditionState.NotEstimated) // conditionState = Highlight.Blue; if (manual.Record.Settings.BlockedWpId.HasValue) { conditionState = Highlight.GrayLight; } if (cond == ConditionState.Notify) { conditionState = Highlight.Yellow; } if (cond == ConditionState.Overdue) { conditionState = Highlight.Red; } } else if (item is StandartManual) { var manual = (StandartManual)item; cond = manual.Condition; //if (cond == ConditionState.NotEstimated) // conditionState = Highlight.Blue; //if (cond == ConditionState.Satisfactory) // conditionState = Highlight.Green; if (cond == ConditionState.Notify) { conditionState = Highlight.Yellow; } if (cond == ConditionState.Overdue) { conditionState = Highlight.Red; } } else if (item is SmartCore.CAA.ConcessionRequest) { var res = (ConcessionRequest)item; if (res.Status == ConcessionRequestStatus.Close) { conditionState = Highlight.Blue; } } return(conditionState); }
protected override void EnterDirective(PrinterContext context, Directive directive) { context.Append($"@{directive.Name.Value}"); }
public override Result PatternWeightExecute(Directive directive, Valve valve) { return(Result.OK); }
public DirectiveAssignment(Directive directive, string value) { this.directive = directive; this.value = value; }
/// <summary> /// Parses the specified template text. /// </summary> /// <param name="templateText">The template text.</param> private void Parse(string templateText) { //var filePath = Path.GetFullPath(Path.Combine(templateCodePath, TemplateFileName)); var tokeniser = new Tokeniser(TemplateFileName, templateText); AddCode(tokeniser.Location, ""); bool skip = false; while ((skip || tokeniser.Advance()) && tokeniser.State != State.EOF) { skip = false; switch (tokeniser.State) { case State.Block: if (!String.IsNullOrEmpty(tokeniser.Value)) AddDoTemplateCode(tokeniser.Location, tokeniser.Value); break; case State.Content: if (!String.IsNullOrEmpty(tokeniser.Value)) AddContent(tokeniser.Location, tokeniser.Value); break; case State.Expression: if (!String.IsNullOrEmpty(tokeniser.Value)) AddExpression(tokeniser.Location, tokeniser.Value); break; case State.Helper: _isTemplateClassCode = true; if (!String.IsNullOrEmpty(tokeniser.Value)) AddDoTemplateClassCode(tokeniser.Location, tokeniser.Value); break; case State.Directive: Directive directive = null; string attName = null; while (!skip && tokeniser.Advance()) { switch (tokeniser.State) { case State.DirectiveName: if (directive == null) directive = new Directive {Name = tokeniser.Value.ToLower()}; else attName = tokeniser.Value; break; case State.DirectiveValue: if (attName != null && directive != null) directive.Attributes.Add(attName.ToLower(), tokeniser.Value); attName = null; break; case State.Directive: //if (directive != null) // directive.EndLocation = tokeniser.TagEndLocation; break; default: skip = true; break; } } if (directive != null) { if (directive.Name == "include") { string includeFile = directive.Attributes["file"]; if (OnInclude == null) throw new InvalidOperationException("Include file found. OnInclude event must be implemented"); var includeArgs = new TemplateIncludeArgs() {IncludeName = includeFile}; OnInclude(this, includeArgs); Parse(includeArgs.Text ?? ""); } _directives.Add(directive); } break; default: throw new InvalidOperationException(); } } }
public static KeyValuePair <Type, Directive> When <TException>(this Directive self) where TException : Exception { return(new KeyValuePair <Type, Directive>(typeof(TException), self)); }
public static DeployableDecider From(Directive defaultDirective, params KeyValuePair <Type, Directive>[] pairs) { return(new DeployableDecider(defaultDirective, pairs)); }
public CustomDirective (string processorName, Directive directive) { this.ProcessorName = processorName; this.Directive = directive; }
public static DeployableDecider From(Directive defaultDirective, IEnumerable <KeyValuePair <Type, Directive> > pairs) { return(new DeployableDecider(defaultDirective, pairs)); }
public static void RenderDirectiveToMediaString(StringBuilder sb, Directive dir) { sb.Append("@media"); bool first = true; foreach (Medium m in dir.Mediums) { if (first) { first = false; sb.Append(" "); } else { sb.Append(", "); } RenderMedium(sb, m); } sb.Append("{"); foreach (RuleSet rules in dir.RuleSets) { RenderRuleSet(sb, rules); } sb.Append("}"); }
public DeployableDecider(Directive defaultDirective, IEnumerable <KeyValuePair <Type, Directive> > pairs) : this(defaultDirective, pairs.ToArray()) { }
/// <summary> /// Logs the failure. /// </summary> /// <param name="context">The actor cell.</param> /// <param name="child">The child.</param> /// <param name="cause">The cause.</param> /// <param name="directive">The directive.</param> protected virtual void LogFailure(IActorContext context, ActorRef child, Exception cause, Directive directive) { if (LoggingEnabled) { var actorInitializationException = cause as ActorInitializationException; string message; if (actorInitializationException != null && actorInitializationException.InnerException != null) { message = actorInitializationException.InnerException.Message; } else { message = cause.Message; } switch (directive) { case Directive.Resume: Publish(context, new Warning(child.Path.ToString(), GetType(), message)); break; case Directive.Escalate: //Don't log here break; default: //case Directive.Restart: //case Directive.Stop: Publish(context, new Error(cause, child.Path.ToString(), GetType(), message)); break; } } }
public DeployableDecider(Directive defaultDirective, params KeyValuePair <Type, Directive>[] pairs) { DefaultDirective = defaultDirective; Pairs = pairs; }
/// <inheritdoc /> public virtual void VisitDirectiveArgumentDefinition(QueryArgument argument, Directive directive, ISchema schema) { }
protected override bool TryCreate(DirectiveComponents components, out Directive directive) { directive = new GridDirective(); return(true); }
//protected override void SetItemColor(ListViewItem listViewItem, BaseEntityObject item) //{ // if (item is NextPerformance) // { // NextPerformance nextPerformance = item as NextPerformance; // if(_currentDirective.Status != WorkPackageStatus.Closed) // { // if (nextPerformance.BlockedByPackage != null) // { // listViewItem.ToolTipText = "This performance blocked by work package:" + // nextPerformance.BlockedByPackage.Title; // listViewItem.BackColor = Color.FromArgb(Highlight.Grey.Color); // } // else if (nextPerformance.Condition == ConditionState.Notify) // listViewItem.BackColor = Color.FromArgb(Highlight.Yellow.Color); // else if (nextPerformance.Condition == ConditionState.Overdue) // listViewItem.BackColor = Color.FromArgb(Highlight.Red.Color); // } // else // { // //Если это следующее выполнение, но рабочий пакет при этом закрыт // //значит, выполнение для данной задачи в рамках данного рабочего пакета // //не было введено // //пометка этого выполнения краным цветом // listViewItem.BackColor = Color.FromArgb(Highlight.Red.Color); // //подсказка о том, что выполнение не было введено // listViewItem.ToolTipText = "Performance for this directive within this work package is not entered."; // if (nextPerformance.BlockedByPackage != null) // { // //дополнитльная подсказака, если предшествующее выполнение // //имеется в другом открытом рабочем пакете // listViewItem.ToolTipText += "\nThis performance blocked by work package:" + // nextPerformance.BlockedByPackage.Title + // "\nFirst, enter the performance of this directive as part of this work package "; // } // } // if (nextPerformance.Parent.IsDeleted) // { // //запись так же может быть удаленной // //шрифт серым цветом // listViewItem.ForeColor = Color.Gray; // if (listViewItem.ToolTipText.Trim() != "") // listViewItem.ToolTipText += "\n"; // listViewItem.ToolTipText += string.Format("This {0} is deleted",nextPerformance.Parent.SmartCoreObjectType); // } // } // else if (item is AbstractPerformanceRecord) // { // AbstractPerformanceRecord apr = (AbstractPerformanceRecord) item; // if (apr.Parent.IsDeleted) // { // //запись так же может быть удаленной // //шрифт серым цветом // listViewItem.ForeColor = Color.Gray; // if (listViewItem.ToolTipText.Trim() != "") // listViewItem.ToolTipText += "\n"; // listViewItem.ToolTipText += string.Format("This {0} is deleted", apr.Parent.SmartCoreObjectType); // } // } // else // { // if(!(item is NonRoutineJob)) // { // //Если это не следующее выполнение, не запись о выполнении, и не рутинная работа // //значит, выполнение для данной задачи расчитать нельзя // //пометка этого выполнения синим цветом // listViewItem.BackColor = Color.FromArgb(Highlight.Blue.Color); // //подсказка о том, что выполнение не возможео расчитать // listViewItem.ToolTipText = "Performance for this directive can not be calculated"; // } // if (item.IsDeleted) // { // //запись так же может быть удаленной // //шрифт серым цветом // listViewItem.ForeColor = Color.Gray; // if (listViewItem.ToolTipText.Trim() != "") // listViewItem.ToolTipText += "\n"; // listViewItem.ToolTipText += string.Format("This {0} is deleted", item.SmartCoreObjectType); // } // } //} #endregion #region protected override ListViewItem.ListViewSubItem[] GetListViewSubItems(BaseSmartCoreObject item) protected override List <CustomCell> GetListViewSubItems(BaseEntityObject item) { var temp = ListViewGroupHelper.GetGroupString(item); var subItems = new List <CustomCell>() { CreateRow(temp, temp) }; var author = GlobalObjects.CasEnvironment.GetCorrector(item); //if(item.ItemId == 41043) //{ //} if (item is NextPerformance) { NextPerformance np = (NextPerformance)item; double manHours = np.Parent is IEngineeringDirective ? ((IEngineeringDirective)np.Parent).ManHours : 0; double cost = np.Parent is IEngineeringDirective ? ((IEngineeringDirective)np.Parent).Cost : 0; subItems.Add(CreateRow(np.ATAChapter.ToString(), np.ATAChapter)); subItems.Add(CreateRow(np.Title, np.Title)); subItems.Add(CreateRow(np.Description, np.Description)); subItems.Add(CreateRow(np.KitsToString, np.Kits.Count)); subItems.Add(CreateRow(np.PerformanceSource.ToString(), np.PerformanceSource)); subItems.Add(CreateRow(np.Parent.Threshold.RepeatInterval.ToString(), np.Parent.Threshold.RepeatInterval)); subItems.Add(CreateRow(np.Remains.ToString(), np.Remains)); subItems.Add(CreateRow(np.WorkType, Tag = np.WorkType)); subItems.Add(CreateRow(np.PerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)np.PerformanceDate), np.PerformanceDate)); subItems.Add(CreateRow(manHours.ToString(), manHours)); subItems.Add(CreateRow(cost.ToString(), cost)); subItems.Add(CreateRow(author, author)); } else if (item is AbstractPerformanceRecord) { //DirectiveRecord directiveRecord = (DirectiveRecord)item; AbstractPerformanceRecord apr = (AbstractPerformanceRecord)item; Lifelength remains = Lifelength.Null; double manHours = apr.Parent is IEngineeringDirective ? ((IEngineeringDirective)apr.Parent).ManHours : 0; double cost = apr.Parent is IEngineeringDirective ? ((IEngineeringDirective)apr.Parent).Cost : 0; subItems.Add(CreateRow(apr.ATAChapter.ToString(), apr.ATAChapter)); subItems.Add(CreateRow(apr.Title, apr.Title)); subItems.Add(CreateRow(apr.Description, apr.Description)); subItems.Add(CreateRow(apr.KitsToString, apr.Kits.Count)); subItems.Add(CreateRow(apr.OnLifelength.ToString(), apr.OnLifelength)); subItems.Add(CreateRow(apr.Parent.Threshold.RepeatInterval.ToString(), apr.Parent.Threshold.RepeatInterval)); subItems.Add(CreateRow(remains.ToString(), remains)); subItems.Add(CreateRow(apr.WorkType, apr.WorkType)); subItems.Add(CreateRow(SmartCore.Auxiliary.Convert.GetDateFormat(apr.RecordDate), apr.RecordDate)); subItems.Add(CreateRow(manHours.ToString(), manHours)); subItems.Add(CreateRow(cost.ToString(), cost)); subItems.Add(CreateRow(author, author)); } else if (item is Directive) { Directive directive = (Directive)item; AtaChapter ata = directive.ATAChapter; subItems.Add(CreateRow(ata.ToString(), ata)); subItems.Add(CreateRow(directive.Title, directive.Title)); subItems.Add(CreateRow(directive.Description, directive.Description)); #region Определение текста для колонки "КИТы" subItems.Add(CreateRow(directive.Kits.Count > 0 ? directive.Kits.Count + " kits" : "", directive.Kits.Count)); #endregion #region Определение текста для колонки "Первое выполнение" var subItem = new CustomCell(); if (directive.Threshold.FirstPerformanceSinceNew != null && !directive.Threshold.FirstPerformanceSinceNew.IsNullOrZero()) { subItem.Text = "s/n: " + directive.Threshold.FirstPerformanceSinceNew; subItem.Tag = directive.Threshold.FirstPerformanceSinceNew; } if (directive.Threshold.FirstPerformanceSinceEffectiveDate != null && !directive.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero()) { if (subItem.Text != "") { subItem.Text += " or "; } else { subItem.Text = ""; subItem.Tag = directive.Threshold.FirstPerformanceSinceEffectiveDate; } subItem.Text += "s/e.d: " + directive.Threshold.FirstPerformanceSinceEffectiveDate; } subItems.Add(subItem); #endregion #region Определение текста для колонки "повторяющийся интервал" subItem = new CustomCell(); if (!directive.Threshold.RepeatInterval.IsNullOrZero()) { subItem.Text = directive.Threshold.RepeatInterval.ToString(); subItem.Tag = directive.Threshold.RepeatInterval; } else { subItem.Text = ""; subItem.Tag = Lifelength.Null; } subItems.Add(subItem); #endregion #region Определение текста для колонки "Остаток/Просрочено на сегодня" subItems.Add(CreateRow(directive.Remains.ToString(), directive.Remains)); #endregion #region Определение текста для колонки "Тип работ" subItems.Add(CreateRow(directive.WorkType.ToString(), directive.WorkType)); #endregion #region Определение текста для колонки "Следующее выполнение" subItems.Add(CreateRow(directive.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)directive.NextPerformanceDate), directive.NextPerformanceDate)); #endregion #region Определение текста для колонки "Человек/Часы" subItems.Add(CreateRow(directive.ManHours.ToString(), directive.ManHours)); #endregion #region Определение текста для колонки "Стоимость" subItems.Add(CreateRow(directive.Cost.ToString(), directive.Cost)); #endregion subItems.Add(CreateRow(author, author)); } else if (item is BaseComponent) { BaseComponent bd = (BaseComponent)item; AtaChapter ata = bd.ATAChapter; subItems.Add(CreateRow(ata.ToString(), ata)); subItems.Add(CreateRow(bd.PartNumber, bd.PartNumber)); subItems.Add(CreateRow(bd.Description, bd.Description)); subItems.Add(CreateRow(bd.Kits.Count > 0 ? bd.Kits.Count + " kits" : "", bd.Kits.Count)); subItems.Add(CreateRow(bd.LifeLimit.ToString(), bd.LifeLimit)); subItems.Add(CreateRow("", Lifelength.Null)); subItems.Add(CreateRow(bd.Remains.ToString(), bd.Remains)); subItems.Add(CreateRow(ComponentRecordType.Remove.ToString(), ComponentRecordType.Remove)); subItems.Add(CreateRow(bd.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)bd.NextPerformanceDate), bd.NextPerformanceDate)); subItems.Add(CreateRow(bd.ManHours.ToString(), bd.ManHours)); subItems.Add(CreateRow(bd.Cost.ToString(), bd.Cost)); subItems.Add(CreateRow(author, author)); } else if (item is Component) { Component d = (Component)item; AtaChapter ata = d.ATAChapter; subItems.Add(CreateRow(ata.ToString(), ata)); subItems.Add(CreateRow(d.PartNumber, d.PartNumber)); subItems.Add(CreateRow(d.Description, d.Description)); subItems.Add(CreateRow(d.Kits.Count > 0 ? d.Kits.Count + " kits" : "", d.Kits.Count)); subItems.Add(CreateRow(d.LifeLimit != null ? d.LifeLimit.ToString() : "", d.LifeLimit)); subItems.Add(CreateRow("", Lifelength.Null)); subItems.Add(CreateRow(d.Remains != null ? d.Remains.ToString() : "", d.Remains)); subItems.Add(CreateRow(ComponentRecordType.Remove.ToString(), ComponentRecordType.Remove)); subItems.Add(CreateRow(d.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)d.NextPerformanceDate), d.NextPerformanceDate)); subItems.Add(CreateRow(d.ManHours.ToString(), d.ManHours)); subItems.Add(CreateRow(d.Cost.ToString(), d.Cost)); subItems.Add(CreateRow(author, Tag = author)); } else if (item is ComponentDirective) { ComponentDirective dd = (ComponentDirective)item; AtaChapter ata = dd.ParentComponent.ATAChapter; subItems.Add(CreateRow(ata != null ? ata.ToString() : "", ata)); subItems.Add(CreateRow("", "")); subItems.Add(CreateRow(dd.Remarks, dd.Remarks)); subItems.Add(CreateRow(dd.Kits.Count > 0 ? dd.Kits.Count + " kits" : "", dd.Kits.Count)); #region Определение текста для колонки "Первое выполнение" var subItem = new CustomCell(); if (dd.Threshold.FirstPerformanceSinceNew != null && !dd.Threshold.FirstPerformanceSinceNew.IsNullOrZero()) { subItem.Text = "s/n: " + dd.Threshold.FirstPerformanceSinceNew; subItem.Tag = dd.Threshold.FirstPerformanceSinceNew; } subItems.Add(subItem); #endregion #region Определение текста для колонки "повторяющийся интервал" subItem = new CustomCell(); if (!dd.Threshold.RepeatInterval.IsNullOrZero()) { subItem.Text = dd.Threshold.RepeatInterval.ToString(); subItem.Tag = dd.Threshold.RepeatInterval; } else { subItem.Text = ""; subItem.Tag = Lifelength.Null; } subItems.Add(subItem); #endregion subItems.Add(CreateRow(dd.Remains.ToString(), dd.Remains)); subItems.Add(CreateRow(dd.DirectiveType.ToString(), dd.DirectiveType)); subItems.Add(CreateRow(dd.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)dd.NextPerformanceDate), dd.NextPerformanceDate)); subItems.Add(CreateRow(dd.ManHours.ToString(), dd.ManHours)); subItems.Add(CreateRow(dd.Cost.ToString(), dd.Cost)); subItems.Add(CreateRow(author, author)); } else if (item is MaintenanceCheck) { MaintenanceCheck mc = (MaintenanceCheck)item; subItems.Add(CreateRow("", null)); subItems.Add(CreateRow("", "")); subItems.Add(CreateRow(mc.Name + (mc.Schedule ? " Shedule" : " Unshedule"), mc.Name)); subItems.Add(CreateRow(mc.Kits.Count > 0 ? mc.Kits.Count + " kits" : "", mc.Kits.Count)); subItems.Add(CreateRow(mc.Interval.ToString(), mc.Interval)); subItems.Add(CreateRow("", Lifelength.Null)); subItems.Add(CreateRow(mc.Remains.ToString(), mc.Remains)); subItems.Add(CreateRow("", "")); subItems.Add(CreateRow(mc.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)mc.NextPerformanceDate), mc.NextPerformanceDate)); subItems.Add(CreateRow(mc.ManHours.ToString(), mc.ManHours)); subItems.Add(CreateRow(mc.Cost.ToString(), mc.Cost)); subItems.Add(CreateRow(author, author)); } else if (item is MaintenanceDirective) { MaintenanceDirective md = (MaintenanceDirective)item; AtaChapter ata = md.ATAChapter; subItems.Add(CreateRow(ata != null ? ata.ToString() : "", ata)); subItems.Add(CreateRow(md.ToString(), md.ToString())); subItems.Add(CreateRow(md.Description, md.Description)); subItems.Add(CreateRow(md.Kits.Count > 0 ? md.Kits.Count + " kits" : "", md.Kits.Count)); #region Определение текста для колонки "Первое выполнение" var subItem = new CustomCell(); if (md.Threshold.FirstPerformanceSinceNew != null && !md.Threshold.FirstPerformanceSinceNew.IsNullOrZero()) { subItem.Text = "s/n: " + md.Threshold.FirstPerformanceSinceNew; subItem.Tag = md.Threshold.FirstPerformanceSinceNew; } if (md.Threshold.FirstPerformanceSinceEffectiveDate != null && !md.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero()) { if (subItem.Text != "") { subItem.Text += " or "; } else { subItem.Text = ""; subItem.Tag = md.Threshold.FirstPerformanceSinceEffectiveDate; } subItem.Text += "s/e.d: " + md.Threshold.FirstPerformanceSinceEffectiveDate; } subItems.Add(subItem); #endregion #region Определение текста для колонки "повторяющийся интервал" subItem = new CustomCell(); if (!md.Threshold.RepeatInterval.IsNullOrZero()) { subItem.Text = md.Threshold.RepeatInterval.ToString(); subItem.Tag = md.Threshold.RepeatInterval; } else { subItem.Text = ""; subItem.Tag = Lifelength.Null; } subItems.Add(subItem); #endregion subItems.Add(CreateRow(md.Remains.ToString(), md.Remains)); subItems.Add(CreateRow(md.WorkType.ToString(), md.WorkType)); subItems.Add(CreateRow(md.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)md.NextPerformanceDate), md.NextPerformanceDate)); subItems.Add(CreateRow(md.ManHours.ToString(), md.ManHours)); subItems.Add(CreateRow(md.Cost.ToString(), md.Cost)); subItems.Add(CreateRow(author, author)); } else if (item is Procedure) { Procedure md = (Procedure)item; subItems.Add(CreateRow("", "")); subItems.Add(CreateRow(md.ToString(), md.ToString())); subItems.Add(CreateRow(md.Description, md.Description)); subItems.Add(CreateRow(md.Kits.Count > 0 ? md.Kits.Count + " kits" : "", md.Kits.Count)); #region Определение текста для колонки "Первое выполнение" var subItem = new CustomCell(); if (md.Threshold.FirstPerformanceSinceNew != null && !md.Threshold.FirstPerformanceSinceNew.IsNullOrZero()) { subItem.Text = "s/n: " + md.Threshold.FirstPerformanceSinceNew; subItem.Tag = md.Threshold.FirstPerformanceSinceNew; } if (md.Threshold.FirstPerformanceSinceEffectiveDate != null && !md.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero()) { if (subItem.Text != "") { subItem.Text += " or "; } else { subItem.Text = ""; subItem.Tag = md.Threshold.FirstPerformanceSinceEffectiveDate; } subItem.Text += "s/e.d: " + md.Threshold.FirstPerformanceSinceEffectiveDate; } subItems.Add(subItem); #endregion #region Определение текста для колонки "повторяющийся интервал" subItem = new CustomCell(); if (!md.Threshold.RepeatInterval.IsNullOrZero()) { subItem.Text = md.Threshold.RepeatInterval.ToString(); subItem.Tag = md.Threshold.RepeatInterval; } else { subItem.Text = ""; subItem.Tag = Lifelength.Null; } subItems.Add(subItem); #endregion subItems.Add(CreateRow(md.Remains.ToString(), md.Remains)); subItems.Add(CreateRow(md.ProcedureType.ToString(), md.ProcedureType)); subItems.Add(CreateRow(md.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)md.NextPerformanceDate), md.NextPerformanceDate)); subItems.Add(CreateRow(md.ManHours.ToString(), md.ManHours)); subItems.Add(CreateRow(md.Cost.ToString(), md.Cost)); subItems.Add(CreateRow(author, author)); } else if (item is NonRoutineJob) { NonRoutineJob job = (NonRoutineJob)item; AtaChapter ata = job.ATAChapter; subItems.Add(CreateRow(ata != null ? ata.ToString() : "", ata)); subItems.Add(CreateRow(job.Title, job.Title)); subItems.Add(CreateRow(job.Description, job.Description)); subItems.Add(CreateRow(job.Kits.Count > 0 ? job.Kits.Count + " kits" : "", job.Kits.Count)); subItems.Add(CreateRow("", Lifelength.Null)); subItems.Add(CreateRow("", Lifelength.Null)); subItems.Add(CreateRow("", Lifelength.Null)); subItems.Add(CreateRow("", "")); subItems.Add(CreateRow("", DateTimeExtend.GetCASMinDateTime())); subItems.Add(CreateRow(job.ManHours.ToString(), job.ManHours)); subItems.Add(CreateRow(job.Cost.ToString(), job.Cost)); subItems.Add(CreateRow(author, author)); } else { throw new ArgumentOutOfRangeException($"1135: Takes an argument has no known type {item.GetType()}"); } return(subItems); }
/// <summary> /// Parses the specified template text. /// </summary> /// <param name="templateText">The template text.</param> private void Parse(string templateText) { //var filePath = Path.GetFullPath(Path.Combine(templateCodePath, TemplateFileName)); var tokeniser = new Tokeniser(TemplateFileName, templateText); AddCode(tokeniser.Location, ""); bool skip = false; while ((skip || tokeniser.Advance()) && tokeniser.State != State.EOF) { skip = false; switch (tokeniser.State) { case State.Block: if (!String.IsNullOrEmpty(tokeniser.Value)) { AddDoTemplateCode(tokeniser.Location, tokeniser.Value); } break; case State.Content: if (!String.IsNullOrEmpty(tokeniser.Value)) { AddContent(tokeniser.Location, tokeniser.Value); } break; case State.Expression: if (!String.IsNullOrEmpty(tokeniser.Value)) { AddExpression(tokeniser.Location, tokeniser.Value); } break; case State.Helper: _isTemplateClassCode = true; if (!String.IsNullOrEmpty(tokeniser.Value)) { AddDoTemplateClassCode(tokeniser.Location, tokeniser.Value); } break; case State.Directive: Directive directive = null; string attName = null; while (!skip && tokeniser.Advance()) { switch (tokeniser.State) { case State.DirectiveName: if (directive == null) { directive = new Directive { Name = tokeniser.Value.ToLower() } } ; else { attName = tokeniser.Value; } break; case State.DirectiveValue: if (attName != null && directive != null) { directive.Attributes.Add(attName.ToLower(), tokeniser.Value); } attName = null; break; case State.Directive: //if (directive != null) // directive.EndLocation = tokeniser.TagEndLocation; break; default: skip = true; break; } } if (directive != null) { if (directive.Name == "include") { string includeFile = directive.Attributes["file"]; if (OnInclude == null) { throw new InvalidOperationException("Include file found. OnInclude event must be implemented"); } var includeArgs = new TemplateIncludeArgs() { IncludeName = includeFile }; OnInclude(this, includeArgs); Parse(includeArgs.Text ?? ""); } _directives.Add(directive); } break; default: throw new InvalidOperationException(); } } }
public override Result InspectRectExecute(Directive directive) { return(Result.OK); }
/// <summary> /// Создает объект отображающий краткую информацию о директиве /// </summary> /// <param name="currentDirective"></param> public DirectiveSummary(Directive currentDirective) : this() { _currentDirective = currentDirective; UpdateInformation(); }
public override Result WetExecute(Directive directive) { return(Result.OK); }
public override void VisitDirective(Directive directive, ISchema schema) => SetDescription(directive);
public static void RenderDirectiveToCharSetString(StringBuilder sb, Directive dir) { sb.AppendFormat("{0} ", dir.Name); RenderExpression(sb, dir.Expression); }
public override void VisitDirectiveArgumentDefinition(QueryArgument argument, Directive directive, ISchema schema) => SetDescription(argument);
private void SaveBlock(List<string> block, Directive directive) { if (block == null || block.Count == 0 || directive == Directive.None) { return; } switch (directive) { case Directive.Expect: this.expect.Add(block); break; case Directive.ExpectCtError: if (this.expectCtError != null) throw new TestException(String.Format("{0}: [expect ct-error] redefinition", this.sourcePath)); this.expectedTestResult = TestResult.CtError; this.expectCtError = block; break; case Directive.ExpectCtWarning: this.expectCtWarning.Add(block); break; case Directive.ExpectExact: if (this.expectExact != null) throw new TestException(String.Format("{0}: [expect exact] redefinition", this.sourcePath)); this.expectExact = block; break; case Directive.ExpectPhp: if (expectPhp) throw new TestException(String.Format("{0}: [expect php] specified twice", this.sourcePath)); expectPhp = true; break; case Directive.Config: if (configuration != null) throw new TestException(String.Format("{0}: [configuration] specified twice", this.sourcePath)); configuration = block; break; case Directive.File: if (this.script != null) throw new TestException(String.Format("{0}: [script] redefinition", this.sourcePath)); this.script = block; break; case Directive.Comment: if (this.comment != null) throw new TestException(String.Format("{0}: [test] redefinition", this.sourcePath)); this.comment = block; break; case Directive.SkipIf: if (this.skipIf != null) throw new TestException(String.Format("{0}: [skipif] redefinition", this.sourcePath)); this.skipIf = block; break; case Directive.NumberOfRuns: if (this.numberOfRuns > 0) { throw new TestException(String.Format("{0}: [runs] redefinition", sourcePath)); } if (!Int32.TryParse(Utils.ListToString(block), out numberOfRuns)) { throw new TestException(String.Format("{0}: [runs] invalid value", sourcePath)); } break; case Directive.AdditionalScripts: if (this.additionalScripts != null) throw new TestException(String.Format("{0}: [additional scripts] redefinition", this.sourcePath)); this.additionalScripts = block; break; case Directive.Pure: this.isPure = true; break; case Directive.Clr: this.isClr = true; break; } }
public static void RenderDirectiveToFontFaceString(StringBuilder sb, Directive dir) { sb.Append("@font-face {"); bool first = true; foreach (Declaration dec in dir.Declarations) { if (first) { first = false; } else { sb.Append(";"); } RenderDeclaration(sb, dec); } sb.Append("}"); }
private void AlignToMe(Directive me) { if (Alignment == ArcAlignment.None) return; Vector3 endPoint = me.Points[0]; Vector3 startPoint = Points[0]; AlignmentSwitch(startPoint, endPoint); }
////////////////////////////////////////////////////////////////////////////////////////////////////// public static Directive add_directive(Directives which_directive, ScreenBuffer target_buffer = null, List<Layer> layers = null, ScreenBuffer source_buffer = null, EffectInstance shader = null, uint color = 0xff000000) { Directive D = new Directive(which_directive, source_buffer, target_buffer, layers, shader, color); program.Add(D); return D; }
void directive(out Directive dir) { dir = new Directive(); Declaration dec = null; RuleSet rset = null; Expression exp = null; Directive dr = null; string ident = null; Medium m; Expect(23); dir.Name = "@"; if (la.kind == 24) { Get(); dir.Name += "-"; } identity(out ident); dir.Name += ident; switch (dir.Name.ToLower()) { case "@media": dir.Type = DirectiveType.Media; break; case "@import": dir.Type = DirectiveType.Import; break; case "@charset": dir.Type = DirectiveType.Charset; break; case "@page": dir.Type = DirectiveType.Page; break; case "@font-face": dir.Type = DirectiveType.FontFace; break; case "@namespace": dir.Type = DirectiveType.Namespace; break; default: dir.Type = DirectiveType.Other; break; } while (la.kind == 4) { Get(); } if (StartOf(4)) { if (StartOf(5)) { medium(out m); dir.Mediums.Add(m); while (la.kind == 4) { Get(); } while (la.kind == 25) { Get(); while (la.kind == 4) { Get(); } medium(out m); dir.Mediums.Add(m); while (la.kind == 4) { Get(); } } } else { expr(out exp); dir.Expression = exp; while (la.kind == 4) { Get(); } } } if (la.kind == 26) { Get(); while (la.kind == 4) { Get(); } if (StartOf(6)) { while (StartOf(1)) { if (dir.Type == DirectiveType.Page || dir.Type == DirectiveType.FontFace) { declaration(out dec); dir.Declarations.Add(dec); while (la.kind == 4) { Get(); } while (la.kind == 27) { Get(); while (la.kind == 4) { Get(); } if (la.val.Equals("}")) { Get(); return; } declaration(out dec); dir.Declarations.Add(dec); while (la.kind == 4) { Get(); } } if (la.kind == 27) { Get(); while (la.kind == 4) { Get(); } } } else if (StartOf(2)) { ruleset(out rset); dir.RuleSets.Add(rset); while (la.kind == 4) { Get(); } } else { directive(out dr); dir.Directives.Add(dr); while (la.kind == 4) { Get(); } } } } Expect(28); while (la.kind == 4) { Get(); } } else if (la.kind == 27) { Get(); while (la.kind == 4) { Get(); } } else SynErr(49); }
public static Directive WithName(this Directive directive, in Name name)
protected override object EvalDirective(ParseTree tree, params object[] paramlist) { Grammar g = (Grammar)paramlist[0]; GrammarNode node = (GrammarNode)paramlist[1]; string name = node.Nodes[1].Token.Text; switch (name) { case "TinyPG": case "Parser": case "Scanner": case "ParseTree": case "TextHighlighter": if (g.Directives.Find(name) != null) { tree.Errors.Add(new ParseError("Directive '" + name + "' is already defined", 0x1030, node.Nodes[1])); return null; ; } break; default: tree.Errors.Add(new ParseError("Directive '" + name + "' is not supported", 0x1031, node.Nodes[1])); break; } Directive directive = new Directive(name); g.Directives.Add(directive); foreach (ParseNode n in node.Nodes) { if (n.Token.Type == TokenType.NameValue) EvalNameValue(tree, new object[] { g, directive, n }); } return null; }
public void AppendDirective(string name, string body, string comment) { if (IsMultipleDirective(name)) { if (Directives.ContainsKey(name) == false) Directives[name] = new List<Directive>(); } else { Directives[name] = new List<Directive>(); } Directive d = new Directive(); d.Text = body.Trim(); d.Comment = comment.Trim(); Directives[name].Add(d); }
static bool ComplainExcessAttributes(Directive dt, ParsedTemplate pt) { if (dt.Attributes.Count == 0) return false; StringBuilder sb = new StringBuilder ("Unknown attributes "); bool first = true; foreach (string key in dt.Attributes.Keys) { if (!first) { sb.Append (", "); } else { first = false; } sb.Append (key); } sb.Append (" found in "); sb.Append (dt.Name); sb.Append (" directive."); pt.LogWarning (sb.ToString (), dt.StartLocation); return false; }
/// <summary> /// Returns the string representation of the underlying syntax, not including its leading and trailing trivia. /// </summary> /// <returns></returns> public override string ToString() { return(Directive?.ToString() ?? ""); }
private void ToolStripMenuItemShowTaskCardClick(object sender, EventArgs e) { if (_directivesViewer.SelectedItems == null || _directivesViewer.SelectedItems.Count == 0) { return; } BaseEntityObject o = _directivesViewer.SelectedItems[0]; IBaseEntityObject parent; if (o is NextPerformance) { parent = ((NextPerformance)o).Parent; } else if (o is AbstractPerformanceRecord) { parent = ((AbstractPerformanceRecord)o).Parent; } else { parent = o; } Directive dir = null; if (parent is Directive) { dir = (Directive)parent; } AttachedFile attachedFile = null; if (sender == _toolStripMenuItemShowADFile && dir != null) { attachedFile = dir.ADNoFile; } if (sender == _toolStripMenuItemShowSBFile && dir != null) { attachedFile = dir.ServiceBulletinFile; } if (sender == _toolStripMenuItemShowEOFile && dir != null) { attachedFile = dir.EngineeringOrderFile; } if (attachedFile == null) { MessageBox.Show("Not set required File", (string)new GlobalTermsProvider()["SystemName"], MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; } try { string message; GlobalObjects.CasEnvironment.OpenFile(attachedFile, out message); if (message != "") { MessageBox.Show(message, (string)new GlobalTermsProvider()["SystemName"], MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; } } catch (Exception ex) { string errorDescriptionSctring = $"Error while Open Attached File for {dir}, id {dir.ItemId}. \nFileId {attachedFile.ItemId}"; Program.Provider.Logger.Log(errorDescriptionSctring, ex); } }
public static void RenderDirectiveToPageString(StringBuilder sb, Directive dir) { sb.Append("@page "); if (dir.Expression != null) { sb.AppendFormat("{0} ", dir.Expression); } sb.Append("{"); bool first = true; foreach (Declaration dec in dir.Declarations) { if (first) { first = false; } else { sb.Append(";"); } RenderDeclaration(sb, dec); } sb.Append("}"); }
private void InitListView(DefferedListView directiveListView) { _directivesViewer = directiveListView; _directivesViewer.TabIndex = 2; _directivesViewer.Location = new Point(panel1.Left, panel1.Top); _directivesViewer.Dock = DockStyle.Fill; _directivesViewer.SelectedItemsChanged += DirectivesViewerSelectedItemsChanged; Controls.Add(_directivesViewer); //события _directivesViewer.SelectedItemsChanged += DirectivesViewerSelectedItemsChanged; _directivesViewer.AddMenuItems(_toolStripMenuItemOpen, _toolStripMenuItemShowADFile, _toolStripMenuItemShowSBFile, _toolStripMenuItemShowEOFile, new RadMenuSeparatorItem(), _toolStripMenuItemHighlight); _directivesViewer.MenuOpeningAction = () => { if (_directivesViewer.SelectedItems.Count <= 0) { _toolStripMenuItemOpen.Enabled = false; _toolStripMenuItemShowADFile.Enabled = false; _toolStripMenuItemShowSBFile.Enabled = false; _toolStripMenuItemShowEOFile.Enabled = false; _toolStripMenuItemHighlight.Enabled = false; } if (_directivesViewer.SelectedItems.Count == 1) { _toolStripMenuItemOpen.Enabled = true; BaseEntityObject o = _directivesViewer.SelectedItems[0]; IBaseEntityObject parent; if (o is NextPerformance) { parent = ((NextPerformance)o).Parent; } else if (o is AbstractPerformanceRecord) { parent = ((AbstractPerformanceRecord)o).Parent; } else { parent = o; } Directive dir = null; if (parent is Directive) { dir = (Directive)parent; } if (dir != null) { _toolStripMenuItemShowEOFile.Enabled = dir.EngineeringOrderFile != null; _toolStripMenuItemShowSBFile.Enabled = dir.ServiceBulletinFile != null; _toolStripMenuItemShowADFile.Enabled = dir.ADNoFile != null; } } if (_directivesViewer.SelectedItems.Count > 0) { _toolStripMenuItemOpen.Enabled = true; _toolStripMenuItemHighlight.Enabled = true; } }; panel1.Controls.Add(_directivesViewer); }
static string Render(Directive dir) { return Render(dir, 0); }