private static TreeNode CreateTreeRecursive(BaseToken token) { TreeNode tNode = new TreeNode(token.ToString()); tNode.Tag = token; foreach (BaseToken t in token.Tokens) { tNode.Nodes.Add(CreateTreeRecursive(t)); } return(tNode); }
public static List <BaseToken> Tokenize(BinaryReader reader, int size = -1) { List <BaseToken> tokens = new List <BaseToken>(); long pos = reader.BaseStream.Length; if (size > 0) { pos = reader.BaseStream.Position + size; } while (reader.BaseStream.Position < pos - 7) { Type type = GetTokenType(reader); BaseToken token = CreateToken(type); token.Read(reader); tokens.Add(token); } return(tokens); }