1 // 2 // Copyright (c) 2010-2018 Antmicro 3 // Copyright (c) 2011-2015 Realtime Embedded 4 // 5 // This file is licensed under the MIT License. 6 // Full license text is available in 'licenses/MIT.txt'. 7 // 8 using System; 9 using System.Collections.Generic; 10 using System.Text; 11 using System.Linq; 12 using System.Text.RegularExpressions; 13 using Antmicro.Renode.UserInterface.Tokenizer; 14 using Antmicro.Renode.Exceptions; 15 16 namespace Antmicro.Renode.UserInterface 17 { 18 19 public class TokenizationResult 20 { TokenizationResult(int unmatchedCharactersLeft, IEnumerable<Token> tokens, RecoverableException e)21 public TokenizationResult(int unmatchedCharactersLeft, IEnumerable<Token> tokens, RecoverableException e) 22 { 23 UnmatchedCharactersLeft = unmatchedCharactersLeft; 24 Tokens = tokens; 25 Exception = e; 26 } 27 28 public int UnmatchedCharactersLeft { get; private set; } 29 public IEnumerable<Token> Tokens { get; private set; } 30 public RecoverableException Exception { get; private set; } 31 ToString()32 public override string ToString() 33 { 34 return String.Join("", Tokens.Select(x => x.ToString())) + ((UnmatchedCharactersLeft != 0) ? String.Format(" (unmatched characters: {0})", UnmatchedCharactersLeft) : "" 35 + Exception != null ? String.Format(" Exception message: {0}",Exception.Message):""); 36 } 37 } 38 39 } 40