• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/** Rules that return more than a single value must return an object
2 *  containing all the values.  Besides the properties defined in
3 *  RuleLabelScope.predefinedRulePropertiesScope there may be user-defined
4 *  return values.  This class simply defines the minimum properties that
5 *  are always defined and methods to access the others that might be
6 *  available depending on output option such as template and tree.
7 *
8 *  Note text is not an actual property of the return value, it is computed
9 *  from start and stop using the input stream's toString() method.  I
10 *  could add a ctor to this so that we can pass in and store the input
11 *  stream, but I'm not sure we want to do that.  It would seem to be undefined
12 *  to get the .text property anyway if the rule matches tokens from multiple
13 *  input streams.
14 *
15 *  I do not use getters for fields of objects that are used simply to
16 *  group values such as this aggregate.  The getters/setters are there to
17 *  satisfy the superclass interface.
18 */
19org.antlr.runtime.ParserRuleReturnScope = function() {};
20org.antlr.runtime.RuleReturnScope = function() {};
21
22org.antlr.lang.extend(org.antlr.runtime.ParserRuleReturnScope,
23                      org.antlr.runtime.RuleReturnScope,
24{
25    getStart: function() { return this.start; },
26    getStop: function() { return this.stop; }
27});
28