1 //
2 // Copyright (c) 2010-2018 Antmicro
3 //
4 // This file is licensed under the MIT License.
5 // Full license text is available in 'licenses/MIT.txt'.
6 //
7 
8 using Sprache;
9 
10 namespace Antmicro.Renode.PlatformDescription.Syntax
11 {
12     public sealed class ReferenceValue : Value, IPrefixable, IPositionAware<ReferenceValue>
13     {
ReferenceValue(string value)14         public ReferenceValue(string value)
15         {
16             Value = value;
17             baseValue = value;
18         }
19 
ToString()20         public override string ToString()
21         {
22             return $"[ReferenceValue: {Value}]";
23         }
24 
ToShortString()25         public string ToShortString()
26         {
27             return $"{Value}";
28         }
29 
Prefix(string with)30         public void Prefix(string with)
31         {
32             Value = with + baseValue;
33         }
34 
SetPos(Position startPos, int length)35         ReferenceValue IPositionAware<ReferenceValue>.SetPos(Position startPos, int length)
36         {
37             return (ReferenceValue)SetPos(startPos, length);
38         }
39 
40         public string Value { get; private set; }
41         public string Scope { get; set; }
42 
43         private readonly string baseValue;
44     }
45 }
46