Пример #1
0
 public TokenSubMacro(IEnumerable <Token> subtokens) : base(TokenType.SubMacro, subtokens, true)
 {
     if (SubTokens.First().Value != "@{" || SubTokens.Last().Value != "}")
     {
         throw new Exception("Esperaba @{...}");
     }
     InnerTokens = SubTokens.GetRange(1, SubTokens.Count - 2);
 }
Пример #2
0
 public TokenExpression(IEnumerable <Token> subtokens) : base(TokenType.Expression, subtokens, false)
 {
     if (SubTokens.First().Value != "@(" || SubTokens.Last().Value != ")")
     {
         throw new Exception("Esperaba @(...)");
     }
     InnerTokens = SubTokens.GetRange(1, SubTokens.Count - 2);
 }
Пример #3
0
        protected Token1(TokenType tt, IEnumerable <Token> subtokens, bool endline) : base(tt, "", endline)
        {
            SubTokens = subtokens.ToList();
            if (endline && SubTokens.LastOrDefault()?.TokenType == TokenType.NewLine)
            {
                SubTokens.RemoveAt(SubTokens.Count - 1);
            }
            var last = SubTokens.LastOrDefault();

            if (endline && (last?.HasEndLine ?? false))
            {
                last.HasEndLine = false;
            }
            InnerTokens = SubTokens;
            Value       = ToString(SubTokens);
        }
Пример #4
0
 /// <summary>
 ///     Returns the Child Tokens
 /// </summary>
 /// <returns></returns>
 public List <IHlToken> GetChildren()
 {
     return(SubTokens?.ToList() ?? new List <IHlToken>());
 }