public LabelElementPair(Grammar g, GrammarAST label, GrammarAST element, int labelOp) { this.label = label; this.element = element; // compute general case for label type if (element.GetFirstDescendantWithType(tokenTypeForTokens) != null) { if (labelOp == ANTLRParser.ASSIGN) type = LabelType.TOKEN_LABEL; else type = LabelType.TOKEN_LIST_LABEL; } else if (element.GetFirstDescendantWithType(ANTLRParser.RULE_REF) != null) { if (labelOp == ANTLRParser.ASSIGN) type = LabelType.RULE_LABEL; else type = LabelType.RULE_LIST_LABEL; } // now reset if lexer and string if (g.IsLexer()) { if (element.GetFirstDescendantWithType(ANTLRParser.STRING_LITERAL) != null) { if (labelOp == ANTLRParser.ASSIGN) type = LabelType.LEXER_STRING_LABEL; } } }
public bool SetLabel(LabelType label, int nCol, int nRow) { if (nCol < 0 || nCol >= nCols || nRow < 0 || nRow >= nCols) { return(false); } board2[nCol, nRow] = label; return(true); }
public LabelWasAssigned( PublicServiceId publicServiceId, LabelType labelType, LabelValue labelValue) { PublicServiceId = publicServiceId; LabelType = labelType; LabelValue = labelValue; }
public ModUILabel AddLabel(LabelType type, String text, Side side, Func <bool> isEnabled, bool initToggle = false, Action <bool> action = null, int priority = 0) { ModUILabel uiLabel = new ModUILabel(type, text, side, isEnabled, initToggle, action, priority); AddLabel(uiLabel); UpdateSort(); return(uiLabel); }
public FFLabel(long labelId, String email, long imageId, LabelType labelType, String data, DateTime date, int score) { this.labelId = labelId; this.email = email; this.imageId = imageId; this.labelType = labelType; this.data = data; this.date = date; this.score = score; }
public Label(EveMailClient client, Account account, int id, string name, LabelType type) { mClient = client; mAccount = account; Name = name; Id = id; UnreadCount = 0; Type = type; }
public Label(SingleLabel singleLabel) { if (singleLabel == null) { throw new ArgumentNullException(nameof(singleLabel)); } Sublabels = new SortedSet <SingleLabel>(new SingleLabel[] { singleLabel }).AsReadOnly(); LabelType = LabelType.Simple; }
public override int GetHashCode() { unchecked { int result = LabelType.GetHashCode(); result = (result * 397) ^ (StandardType == null ? 0 : StandardType.GetHashCode()); result = (result * 397) ^ (Ratio == null ? 0 : Ratio.GetHashCode()); return(result); } }
public ActionResult Edit(LabelType labelType, int id) { var label = FindLabel(labelType, id); if (label == null) { return HttpNotFound(); } return View(label); }
public async Task <Label> CreateAsync(string decodedString, LabelType type) { var factory = LabelFactory.Create(type); var label = await factory.CreateAsync(decodedString); _context.Labels.Add(label); await _context.SaveChangesAsync(); return(label); }
public Label(SpriteFont font, string text, Rectangle boundingBox, Color color, Justification justification = Justification.Center | Justification.Middle, Stroke stroke = null) : this(font, text) { _inputJustification = justification; _inputType = LabelType.BoundingBox; _inputBoundingBox = boundingBox; _inputStroke = stroke; GenerateStrokeOffsets(); Update(boundingBox, color, justification); }
protected void PrintType( CheckinLabel labelOrig, LabelType labelType ) { if ( tvLocations.CheckedNodes.Length > 0 ) { System.Collections.Generic.List<string> success = new System.Collections.Generic.List<string>(); System.Collections.Generic.List<string> fails = new System.Collections.Generic.List<string>(); foreach ( TreeViewNode node in tvLocations.CheckedNodes ) { if ( node.Depth == 1 ) { Location location = new Location( int.Parse( node.ID ) ); try { CheckinLabel label = labelOrig.ShallowCopy(); if ( LabelType.All == labelType ) { label.PrintAllLabels( location.Printer.PrinterName ); } else if ( LabelType.Attendance == labelType ) { label.PrintAttendanceLabel( location.Printer.PrinterName ); } else if ( LabelType.ClaimCard == labelType ) { label.PrintClaimCard( location.Printer.PrinterName ); } else if ( LabelType.Nametag == labelType ) { label.PrintNametag( location.Printer.PrinterName ); } else if ( LabelType.Test == labelType ) { label.FullName = location.LocationName; label.PrintAttendanceLabel( location.Printer.PrinterName ); } success.Add( string.Format( "<li>{0} ({1})</li>", location.LocationName, location.Printer.PrinterName ) ); } catch ( System.Exception ex ) { fails.Add( string.Format( "{0} ({1})<BR>{2}", location.LocationName, location.Printer.PrinterName, ex.Message ) + "<BR>StackTrace: " + ex.StackTrace ); } } } if ( success.Count > 0 ) { lblSuccessMessage.Text = labelType.ToString() + " successfully printed in room (printer):<br /><ul>" + string.Join( "", success.ToArray() ) + "</ul><hr>"; lblSuccessMessage.Visible = true; } if ( fails.Count > 0 ) { lblErrorMessage.Text = string.Join( "<hr>Failure to print in room (printer):<br>", fails.ToArray() ); lblErrorMessage.Visible = true; } } }
public ModUILabel(LabelType type, String text, Side side, Func <bool> isEnabled, bool initToggle = false, Action <bool> action = null, int priority = 0) { this.labelType = type; this.text = text; this.side = side; this.isEnabled = isEnabled; this.toggleValue = initToggle; this.oldToggleValue = initToggle; this.action = action; this.priority = priority; }
public override int GetHashCode() { unchecked { int result = _peptide.GetHashCode(); result = (result * 397) ^ PrecursorAdduct.GetHashCode(); result = (result * 397) ^ LabelType.GetHashCode(); result = (result * 397) ^ (DecoyMassShift ?? 0); return(result); } }
public override int GetHashCode() { unchecked { int result = _peptide.GetHashCode(); result = (result * 397) ^ PrecursorCharge; result = (result * 397) ^ LabelType.GetHashCode(); result = (result * 397) ^ (DecoyMassShift.HasValue ? DecoyMassShift.Value : 0); return(result); } }
public Label(string labelname, LabelType labelType, string messageNumber) : this() { if (String.IsNullOrEmpty(labelname) || labelname.Trim().Length == 0) { throw new ArgumentNullException("labelname"); } Labelname = labelname; LabelType = labelType; MessageNumber = messageNumber; }
public override int GetHashCode() { unchecked { var hashCode = (Peptide != null ? Peptide.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Protein != null ? Protein.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (LabelType != null ? LabelType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ MsLevel.GetHashCode(); return(hashCode); } }
public ActionResult Edit(LabelType labelType, int id) { var label = FindLabel(labelType, id); if (label == null) { return(HttpNotFound()); } return(View(label)); }
public Label DefineLabel(LabelType lbt, string suffix = null) { if (suffix == null) { return(new Label(EmitContext.GenerateLabelName(lbt))); } else { return(new Label(EmitContext.GenerateLabelName(lbt) + "_" + suffix)); } }
public Label DefineLabel(LabelType lbt, string suffix = null) { if (suffix == null) { return(ag.DefineLabel(GenerateLabelName(lbt))); } else { return(ag.DefineLabel(GenerateLabelName(lbt) + "_" + suffix)); } }
public AttachedInteractiveLink(ContentType type, string title, string summary, Uri linkUrl, string providerName, Uri providerLogoUrl, Uri actionUrl, LabelType label, Uri faviconUrl, Uri originalThumbnailUrl, string thumbnailUrl, int thumbnailWidth, int thumbnailHeight, Uri plusBaseUrl) : base(type, title, summary, linkUrl, faviconUrl, originalThumbnailUrl, thumbnailUrl, thumbnailWidth, thumbnailHeight) { ProviderName = providerName; ProviderLogoUrl = providerLogoUrl; ActionUrl = actionUrl; Label = label; }
public Label(SpriteFont font, string text, Vector2 location, Color color, Justification justification, LabelType type, float parameter = 0.0f, Stroke stroke = null) : this(font, text) { _lastLocation = location; _inputJustification = justification; _inputType = type; _inputParameter = parameter; _inputStroke = stroke; GenerateStrokeOffsets(); Update(location, color, justification, type, parameter); }
/// <summary> /// Basic ctor /// </summary> /// <param name="name"></param> /// <param name="employee"></param> /// <param name="subject"></param> /// <param name="labelType"></param> /// <param name="numberOfStudents"></param> /// <param name="numberOfHours"></param> /// <param name="numberOfWeeks"></param> /// <param name="language"></param> public WorkLabel(string name, Employee employee, Subject subject, LabelType labelType, int numberOfStudents, int numberOfHours, int numberOfWeeks, Language language) { Name = name; Employee = employee; Subject = subject; LabelTypes = labelType; NumberOfStudents = numberOfStudents; NumberOfHours = numberOfHours; NumberOfWeeks = numberOfWeeks; Language = language; }
/** * <summary> Constructor from known parameters. </summary> * <param name="id"> Label's ID in the DB. </param> * <param name="name"> Label's name. </param> * <param name="employee"> Employee teaching the subject. </param> * <param name="subject"> Subject this class belong to. </param> * <param name="type"> Type of the label. </param> * <param name="language"> Language of the label. </param> * <param name="studentCount"> Number of students belonging to the label/group. </param> * <param name="hourCount"> Number of hours the label is for. </param> * <param name="weekCount"> Number of weeks the label is for. </param> */ public Label(UInt32 id, string name, Employee employee, Subject subject, LabelType type, StudyLanguage language, UInt16 studentCount, double hourCount = 0, byte weekCount = 0) { this.Id = id; this.Name = name; this.LabelEmployee = employee; this.LabelSubject = subject; this.Type = type; this.Language = language; this.StudentCount = studentCount; this.hourCount = hourCount; this.weekCount = weekCount; }
private static string FromLabelType(LabelType labelType) { switch (labelType) { case LabelType.System: return("system"); case LabelType.User: default: return("user"); } }
public static string GenerateLabelName(LabelType lb) { if (Labels.ContainsKey(lb)) { Labels[lb]++; return(lb.ToString() + "_" + Labels[lb].ToString()); } else { Labels.Add(lb, 0); return(lb.ToString() + "_" + Labels[lb].ToString()); } }
protected Label(SerializationInfo info, StreamingContext context) : base(info, context) { _labeltype = (LabelType)info.GetValue("LabelType", typeof(LabelType)); if (_version > 1) { _userdefineitem = info.GetString("UserDefineItem"); } if (_version >= 90) { _designcaption = info.GetString("DesignCaption"); _designname = info.GetString("DesignName"); } }
private static IHtmlString Wrapper(LabelType labelType, Label label, bool editableInDesignPage) { var isEditMode = FrontContext.Current.IsPreviewMode; if (isEditMode && editableInDesignPage) { return(new MvcHtmlString(string.Format(@"<var data-label-type=""{0}"" data-label-id=""{1}"" class=""s-label"">{2}</var>", labelType, label.Id, label.Value))); } else { return(new MvcHtmlString(label.Value)); } }
public virtual void DefineLabel(IToken label, GrammarAST elementRef, LabelType type) { Grammar.LabelElementPair pair = new Grammar.LabelElementPair(Grammar, label, elementRef); pair.type = type; LabelNameSpace[label.Text] = pair; switch (type) { case LabelType.Token: TokenLabels = TokenLabels ?? new Dictionary <string, Grammar.LabelElementPair>(); TokenLabels[label.Text] = pair; break; case LabelType.WildcardTree: WildcardTreeLabels = WildcardTreeLabels ?? new Dictionary <string, Grammar.LabelElementPair>(); WildcardTreeLabels[label.Text] = pair; break; case LabelType.WildcardTreeList: WildcardTreeListLabels = WildcardTreeListLabels ?? new Dictionary <string, Grammar.LabelElementPair>(); WildcardTreeListLabels[label.Text] = pair; break; case LabelType.Rule: _ruleLabels = _ruleLabels ?? new Dictionary <string, Grammar.LabelElementPair>(); _ruleLabels[label.Text] = pair; break; case LabelType.TokenList: TokenListLabels = TokenListLabels ?? new Dictionary <string, Grammar.LabelElementPair>(); TokenListLabels[label.Text] = pair; break; case LabelType.RuleList: _ruleListLabels = _ruleListLabels ?? new Dictionary <string, Grammar.LabelElementPair>(); _ruleListLabels[label.Text] = pair; break; case LabelType.Char: CharLabels = CharLabels ?? new Dictionary <string, Grammar.LabelElementPair>(); CharLabels[label.Text] = pair; break; case LabelType.CharList: CharListLabels = CharListLabels ?? new Dictionary <string, Grammar.LabelElementPair>(); CharListLabels[label.Text] = pair; break; default: throw new ArgumentException(string.Format("Unexpected label type {0}.", type), "type"); } }
public static ILabelFactory Create(LabelType type) { switch (type) { case LabelType.Zebra: return(new ZebraFactory()); case LabelType.Intermec: return(new IntermecFactory()); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public static ILabel GetLabelGenerator(LabelType type) { switch (type) { case LabelType.Alfabetic: return(new Alfabetic()); case LabelType.RomanNumeral: return(new RomanNumeral()); default: return(new Numeric()); } }
public override int GetHashCode() { unchecked { var hashCode = (Client != null ? Client.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (IntensityModel != null ? IntensityModel.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (RTModel != null ? RTModel.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Settings != null ? Settings.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Peptide != null ? Peptide.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Precursor != null ? Precursor.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (LabelType != null ? LabelType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ NCE; return(hashCode); } }
public override string LabelType(LabelType labelType) { switch (labelType) { case Blazorise.LabelType.File: return("file-label"); case Blazorise.LabelType.Check: case Blazorise.LabelType.Radio: case Blazorise.LabelType.Switch: case Blazorise.LabelType.None: default: return(null); } }
public VE_Label(LabelType lType, double width, double height, string content) { InitializeComponent(); switch (lType) { case LabelType.TimeLabel: InitPropForTimeLabel(); break; case LabelType.IndicatorLabel: InitPropForIndicatorLabel(); break; } Width = width; Height = height; Content = content; }
public ActionResult Delete(LabelType labelType2, int id) { try { var label = FindLabel(labelType2, id); DataContext.Delete(label); SaveChanges(); ShowSuccess(MessageResource.DeleteSuccess); } catch { ShowError(MessageResource.DeleteFailed); } return RedirectToIndex(); }
public ActionResult Edit(LabelType labelType, int id, FormCollection collection) { var label = FindLabel(labelType, id); TryUpdateModel(label, new[] { "Value" }); if (ModelState.IsValid) { try { SaveChanges(); } catch { return Json(new { IsSuccess = false, Message = MessageResource.UpdateFailed }); } } return Json(new { IsSuccess = true, Message = MessageResource.UpdateSuccess }); }
public MGLabel(string text, LabelType type, SpriteFont spriteFont) { _spriteFont = spriteFont; _text = text; _type = type; if (_type == LabelType.TextAlignmentLeft) { _anchorPoisiton = new Vector2(0f, _spriteFont.MeasureString(_text).Y / 2f); return; } if (_type == LabelType.TextAlignmentRight) { _anchorPoisiton = new Vector2(_spriteFont.MeasureString(_text).X, _spriteFont.MeasureString(_text).Y / 2f); return; } if (_type == LabelType.TextAlignmentCenter) { _anchorPoisiton = _spriteFont.MeasureString(_text) / 2f; } }
public MGLabel(string text, LabelType type, string spriteFont) { var spritefont = MGDirector.SharedDirector().Content.Load<SpriteFont>(spriteFont); _spriteFont = spritefont; _text = text; _type = type; if (_type == LabelType.TextAlignmentLeft) { _anchorPoisiton = new Vector2(0f, _spriteFont.MeasureString(_text).Y / 2f); return; } if (_type == LabelType.TextAlignmentRight) { _anchorPoisiton = new Vector2(_spriteFont.MeasureString(_text).X, _spriteFont.MeasureString(_text).Y / 2f); return; } if (_type == LabelType.TextAlignmentCenter) { _anchorPoisiton = _spriteFont.MeasureString(_text) / 2f; } }
private static string FromLabelType(LabelType labelType) { switch (labelType) { case LabelType.System: return "system"; case LabelType.User: default: return "user"; } }
/** If type of previous label differs from new label's type, that's an error. */ public virtual bool CheckForLabelTypeMismatch( Rule r, IToken label, LabelType type ) { Grammar.LabelElementPair prevLabelPair = (Grammar.LabelElementPair)r.labelNameSpace.get( label.Text ); if ( prevLabelPair != null ) { // label already defined; if same type, no problem if ( prevLabelPair.type != type ) { string typeMismatchExpr = Grammar.LabelTypeToString[(int)type] + "!=" + Grammar.LabelTypeToString[(int)prevLabelPair.type]; ErrorManager.GrammarError( ErrorManager.MSG_LABEL_TYPE_CONFLICT, grammar, label, label.Text, typeMismatchExpr ); return true; } } return false; }
/// <summary> /// Constuctor /// </summary> /// <param name="labelType"></param> public MeasureLabel(LabelType labelType) { _LabelType = labelType; if (_Model == null) _Model = new Canvas(); _Model.VerticalAlignment = VerticalAlignment.Top; _Model.HorizontalAlignment = HorizontalAlignment.Left; }
private void SetColor(Control objCntrl,LabelType lblType) { if(lblType == LabelType.F2) { objCntrl.ForeColor = System.Drawing.Color.Maroon; if(((clsLabel)objCntrl).NormalFont) objCntrl.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); } else if(lblType == LabelType.Compulsary) { objCntrl.ForeColor = System.Drawing.Color.Maroon; if(((clsLabel)objCntrl).NormalFont) objCntrl.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); } else if(lblType == LabelType.Optional) { objCntrl.ForeColor = System.Drawing.Color.Black; if(((clsLabel)objCntrl).NormalFont) objCntrl.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); } else if (lblType == LabelType.None) { objCntrl.ForeColor = System.Drawing.Color.White; if (((clsLabel)objCntrl).NormalFont) objCntrl.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); } else { if(((clsLabel)objCntrl).NormalFont) objCntrl.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); } }
/// <summary> /// Convert the object to string. /// </summary> /// <param name="type">Indicate the type, which will impact the context of the string.</param> /// <returns>String according to the object.</returns> public string ToString(LabelType type) { string message = string.Empty; if (type == LabelType.WithoutAlignData) { return ToString(); } else if (type == LabelType.WithSecondLabel && _secondLabel != string.Empty) { message = Helper.NeutralFormat("{0} {1} {2} {3}", _start, _end, _label, _secondLabel); } else { message = Helper.NeutralFormat("{0} {1} {2}", _start, _end, _label); } return message; }
private void UpdateText(string textToUpdate, LabelType labelType) { if (GlobalData.backgroundWorker != null) { if (labelType == LabelType.NoOfTasksCompleted) { NoOfTasksCompletedLabel.BeginInvoke(new UpdateNoOfTasksCompletedCallback(this.UpdateNoOfTasksCompletedLabel), new object[] { textToUpdate }); } else if (labelType == LabelType.CurrentlyInstalling) { currentlyInstallingLabel.BeginInvoke(new UpdateCurrentTaskLabelCallback(this.UpdateCurrentTaskLabel), new object[] { textToUpdate }); } else if (labelType == LabelType.OverAllProgress) { overAllProgressLabel.BeginInvoke(new UpdateTotalLabelCallback(this.UpdateTotalLabel), new object[] { textToUpdate }); } else if (labelType == LabelType.TaskDescription) { descriptionLabel.BeginInvoke(new TaskDescriptionCallback(this.TaskDescriptionLabel), new object[] { textToUpdate }); } } }
/** Define a label defined in a rule r; check the validity then ask the * Rule object to actually define it. */ protected virtual void DefineLabel( Rule r, IToken label, GrammarAST element, LabelType type ) { bool err = nameSpaceChecker.CheckForLabelTypeMismatch( r, label, type ); if ( err ) { return; } r.DefineLabel( label, element, type ); }
/** Given a set of all rewrite elements on right of ->, filter for * label types such as Grammar.TOKEN_LABEL, Grammar.TOKEN_LIST_LABEL, ... * Return a displayable token type name computed from the GrammarAST. */ public virtual HashSet<string> GetLabels( HashSet<GrammarAST> rewriteElements, LabelType labelType ) { HashSet<string> labels = new HashSet<string>(); foreach ( GrammarAST el in rewriteElements ) { if ( el.Type == ANTLRParser.LABEL ) { string labelName = el.Text; Rule enclosingRule = GetLocallyDefinedRule( el.enclosingRuleName ); if (enclosingRule == null) continue; LabelElementPair pair = enclosingRule.GetLabel( labelName ); /* // if tree grammar and we have a wildcard, only notice it // when looking for rule labels not token label. x=. should // look like a rule ref since could be subtree. if ( type==TREE_PARSER && pair!=null && pair.elementRef.getType()==ANTLRParser.WILDCARD ) { if ( labelType==WILDCARD_TREE_LABEL ) { labels.add(labelName); continue; } else continue; } */ // if valid label and type is what we're looking for // and not ref to old value val $rule, add to list if ( pair != null && pair.type == labelType && !labelName.Equals( el.enclosingRuleName ) ) { labels.Add( labelName ); } } } return labels; }
public void AddLabel(LabelType type) { Label tmpLabel = new System.Windows.Forms.Label(); tmpLabel.AutoSize = true; tmpLabel.BackColor = System.Drawing.Color.White; tmpLabel.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); tmpLabel.Location = new System.Drawing.Point(61, 18); tmpLabel.Margin = new System.Windows.Forms.Padding(3, 0, 1, 0); tmpLabel.Name = "uxLbl_PropertyType"; tmpLabel.Size = new System.Drawing.Size(68, 18); tmpLabel.TabIndex = 7; tmpLabel.Text = string.Empty; tmpLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; switch (type) { case LabelType.Type: tmpLabel.ForeColor = System.Drawing.Color.Blue; break; default: tmpLabel.ForeColor = System.Drawing.Color.Black; break; } SignatureLabels.Add(tmpLabel); this.uxPnl_SignatureLabels.Controls.Add(tmpLabel); }
public MGLabel() { _type = LabelType.TextAlignmentLeft; }
public virtual void DefineLabel( IToken label, GrammarAST elementRef, LabelType type ) { Grammar.LabelElementPair pair = new Grammar.LabelElementPair( Grammar, label, elementRef ); pair.type = type; LabelNameSpace[label.Text] = pair; switch (type) { case LabelType.Token: TokenLabels = TokenLabels ?? new Dictionary<string, Grammar.LabelElementPair>(); TokenLabels[label.Text] = pair; break; case LabelType.WildcardTree: WildcardTreeLabels = WildcardTreeLabels ?? new Dictionary<string, Grammar.LabelElementPair>(); WildcardTreeLabels[label.Text] = pair; break; case LabelType.WildcardTreeList: WildcardTreeListLabels = WildcardTreeListLabels ?? new Dictionary<string, Grammar.LabelElementPair>(); WildcardTreeListLabels[label.Text] = pair; break; case LabelType.Rule: _ruleLabels = _ruleLabels ?? new Dictionary<string, Grammar.LabelElementPair>(); _ruleLabels[label.Text] = pair; break; case LabelType.TokenList: TokenListLabels = TokenListLabels ?? new Dictionary<string, Grammar.LabelElementPair>(); TokenListLabels[label.Text] = pair; break; case LabelType.RuleList: _ruleListLabels = _ruleListLabels ?? new Dictionary<string, Grammar.LabelElementPair>(); _ruleListLabels[label.Text] = pair; break; case LabelType.Char: CharLabels = CharLabels ?? new Dictionary<string, Grammar.LabelElementPair>(); CharLabels[label.Text] = pair; break; case LabelType.CharList: CharListLabels = CharListLabels ?? new Dictionary<string, Grammar.LabelElementPair>(); CharListLabels[label.Text] = pair; break; default: throw new ArgumentException(string.Format("Unexpected label type {0}.", type), "type"); } }
public virtual void DefineLabel( IToken label, GrammarAST elementRef, LabelType type ) { Grammar.LabelElementPair pair = new Grammar.LabelElementPair( grammar, label, elementRef ); pair.type = type; labelNameSpace[label.Text] = pair; switch ( type ) { case LabelType.Token: if ( tokenLabels == null ) { tokenLabels = new Dictionary<string, Grammar.LabelElementPair>(); } tokenLabels[label.Text] = pair; break; case LabelType.WildcardTree: if ( wildcardTreeLabels == null ) wildcardTreeLabels = new Dictionary<string, Grammar.LabelElementPair>(); wildcardTreeLabels[label.Text] = pair; break; case LabelType.WildcardTreeList: if ( wildcardTreeListLabels == null ) wildcardTreeListLabels = new Dictionary<string, Grammar.LabelElementPair>(); wildcardTreeListLabels[label.Text] = pair; break; case LabelType.Rule: if ( ruleLabels == null ) { ruleLabels = new Dictionary<string, Grammar.LabelElementPair>(); } ruleLabels[label.Text] = pair; break; case LabelType.TokenList: if ( tokenListLabels == null ) { tokenListLabels = new Dictionary<string, Grammar.LabelElementPair>(); } tokenListLabels[label.Text] = pair; break; case LabelType.RuleList: if ( ruleListLabels == null ) { ruleListLabels = new Dictionary<string, Grammar.LabelElementPair>(); } ruleListLabels[label.Text] = pair; break; case LabelType.Char: if ( charLabels == null ) { charLabels = new Dictionary<string, Grammar.LabelElementPair>(); } charLabels[label.Text] = pair; break; } }
public virtual AttributeDict GetPredefinedScope(LabelType ltype) { string grammarLabelKey = g.GetTypeString() + ":" + ltype; AttributeDict result; Grammar.grammarAndLabelRefTypeToScope.TryGetValue(grammarLabelKey, out result); return result; }
private Label FindLabel(LabelType labelType, int id) { Label label = null; switch (labelType) { case LabelType.SiteLabel: label = DataContext.SiteLabels.WithSiteId(CurrentSiteId).FirstOrDefault(i => i.Id == id); break; case LabelType.PageLabel: label = DataContext.PageLabels.FirstOrDefault(i => i.Id == id && i.Page.SiteId == CurrentSiteId); break; case LabelType.WidgetLabel: label = DataContext.WidgetLabels.FirstOrDefault(i => i.Id == id && i.Widget.SiteId == CurrentSiteId); break; } return label; }