public override void ExitLocalizedString(OrdinaryFormParser.LocalizedStringContext context) { var entireString = new LocalizedString(); var count = _tokens.GetNumber(context.Count); for (int i = 0; i < count; i++) { var item = context.localizedStringItem(i); var locale = (Locale)_tokens.GetString(item.Locale); var value = _tokens.GetString(item.Value); entireString.Add(locale, value); } _values.Put(context, entireString); }
internal virtual void FillRelativeFont( RelativeFont font, OrdinaryFormParser.RelativeFontContext context) { var mask = (FontMask)_tokens.GetNumber(context.Mask); var optionalValueSequence = new[] { FontMask.Size, FontMask.Bold, FontMask.Italic, FontMask.Underline, FontMask.Strikeout, }; var offset = 3; foreach (var flag in optionalValueSequence) { if ((mask & flag) == 0) { continue; } var node = context.NUMBER(offset); var value = _tokens.GetNumber(node); switch (flag) { case FontMask.Size: font.Size = ParseSize(value); break; case FontMask.Bold: font.Bold = ParseBold(value); break; case FontMask.Italic: font.Italic = ParseBoolean(value); break; case FontMask.Underline: font.Underline = ParseBoolean(value); break; case FontMask.Strikeout: font.Strikeout = ParseBoolean(value); break; default: break; } offset++; } if ((mask & FontMask.FaceName) != 0) { font.FaceName = _tokens.GetString(context.FaceName); } font.Scale = (ushort)_tokens.GetNumber(context.Scale); }