public Token(string type, string value, TokenPosition position, TokenAttributes attributes) { Type = type; Value = value; Position = position; Attributes = attributes; }
public static Token Parse(string line) { var pieces = parsePieces(line); if (pieces.Count <= 4) return null; try { var position = new TokenPosition(int.Parse(pieces[2]), int.Parse(pieces[3]), int.Parse(pieces[4])); var attributes = new TokenAttributes(); if(pieces.Count >= 5) { for (int i = 5; i < pieces.Count; i++) attributes.Add(pieces[i]); } var token = new Token(pieces[0], pieces[1], position, attributes); return token; } catch (Exception) { return null; } }
public Token(string type, string value, TokenPosition position) : this(type, value, position, new TokenAttributes()) { }