1/*
2 * [The "BSD licence"]
3 * Copyright (c) 2005-2008 Terence Parr
4 * All rights reserved.
5 *
6 * Conversion to C#:
7 * Copyright (c) 2008-2010 Sam Harwell, Pixel Mine, Inc.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 *    derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33namespace Antlr.Runtime {
34    using CLSCompliant = System.CLSCompliantAttribute;
35
36    /** <summary>
37     *  Rules that return more than a single value must return an object
38     *  containing all the values.  Besides the properties defined in
39     *  RuleLabelScope.predefinedRulePropertiesScope there may be user-defined
40     *  return values.  This class simply defines the minimum properties that
41     *  are always defined and methods to access the others that might be
42     *  available depending on output option such as template and tree.
43     *  </summary>
44     *
45     *  <remarks>
46     *  Note text is not an actual property of the return value, it is computed
47     *  from start and stop using the input stream's toString() method.  I
48     *  could add a ctor to this so that we can pass in and store the input
49     *  stream, but I'm not sure we want to do that.  It would seem to be undefined
50     *  to get the .text property anyway if the rule matches tokens from multiple
51     *  input streams.
52     *
53     *  I do not use getters for fields of objects that are used simply to
54     *  group values such as this aggregate.  The getters/setters are there to
55     *  satisfy the superclass interface.
56     *  </remarks>
57     */
58    public class ParserRuleReturnScope<TToken> : IRuleReturnScope<TToken>
59        where TToken : IToken {
60        private TToken _start;
61        private TToken _stop;
62
63        public TToken Start {
64            get {
65                return _start;
66            }
67
68            set {
69                _start = value;
70            }
71        }
72
73        public TToken Stop {
74            get {
75                return _stop;
76            }
77
78            set {
79                _stop = value;
80            }
81        }
82    }
83}
84