/********* ** Private methods *********/ /// <summary>Get a string representation of a token.</summary> /// <param name="name">The Content Patcher token name.</param> /// <param name="inputArgs">The input arguments passed to the Content Patcher token.</param> /// <param name="impliedBraces">Whether the token omits the start/end character patterns because it's in a token-only context.</param> private static string GetRawText(string name, LexTokenInput inputArgs, bool impliedBraces) { StringBuilder str = new StringBuilder(); if (!impliedBraces) { str.Append("{{"); } str.Append(name); if (inputArgs != null) { if (!inputArgs.ToString().StartsWith(InternalConstants.NamedInputArgSeparator)) { str.Append(InternalConstants.PositionalInputArgSeparator); } str.Append(inputArgs); } if (!impliedBraces) { str.Append("}}"); } return(str.ToString()); }
/// <summary>Apply changes for a format migration.</summary> /// <param name="name">The Content Patcher token name.</param> /// <param name="inputArgs">The input arguments passed to the Content Patcher token.</param> public void MigrateTo(string name, LexTokenInput inputArgs) { this.Name = name; this.InputArgs = inputArgs; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="name">The Content Patcher token name.</param> /// <param name="inputArgs">The input arguments passed to the Content Patcher token.</param> /// <param name="impliedBraces">Whether the token omits the start/end character patterns because it's in a token-only context.</param> public LexTokenToken(string name, LexTokenInput inputArgs, bool impliedBraces) { this.ImpliedBraces = impliedBraces; this.MigrateTo(name, inputArgs); }