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); }
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); }
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); }
/// <summary> /// Returns the Child Tokens /// </summary> /// <returns></returns> public List <IHlToken> GetChildren() { return(SubTokens?.ToList() ?? new List <IHlToken>()); }