Esempio n. 1
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="name">The Content Patcher token name.</param>
 /// <param name="inputArg">The input argument 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, LexTokenInputArg inputArg, bool impliedBraces)
 {
     this.Type          = LexTokenType.Token;
     this.Text          = LexTokenToken.GetRawText(name, inputArg, impliedBraces);
     this.Name          = name;
     this.InputArg      = inputArg;
     this.ImpliedBraces = impliedBraces;
 }
Esempio n. 2
0
        /*********
        ** Private methods
        *********/
        /// <summary>Get a string representation of a token.</summary>
        /// <param name="name">The Content Patcher token name.</param>
        /// <param name="tokenInputArgArgument">The input argument 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, LexTokenInputArg tokenInputArgArgument, bool impliedBraces)
        {
            StringBuilder str = new StringBuilder();

            if (!impliedBraces)
            {
                str.Append("{{");
            }
            str.Append(name);
            if (tokenInputArgArgument != null)
            {
                str.Append(InternalConstants.InputArgSeparator);
                str.Append(tokenInputArgArgument.Text);
            }
            if (!impliedBraces)
            {
                str.Append("}}");
            }
            return(str.ToString());
        }