예제 #1
0
        public List <int> Visit(ArrowValueNode node)
        {
            // Create list of values
            List <int> values = new List <int>();

            for (int i = node.LeftValue; i <= node.RightValue; i++)
            {
                values.Add(i);
            }

            return(values);
        }
예제 #2
0
        public MemberSymbol(string label, List <ValueNode> values)
            : base(label)
        {
            acceptedValues = values;

            // Check if there is any values, then use the first as current
            if (acceptedValues.Count > 0)
            {
                value = acceptedValues[0] switch
                {
                    IntValueNode t => t.Value,
                    ArrowValueNode t => t.LeftValue,
                    StringValueNode t => t.Value,
                                 _ => throw new Exception($"Unknown value type \'{ acceptedValues[0].GetType().Name }\' in member .{ Label }")
                };
            }
        }