toString method

  1. @override
String toString([
  1. dynamic _,
  2. bool showAlt = true
])
override

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.

Implementation

@override
String toString([_, bool showAlt = true]) {
  final buf = StringBuffer();
  // if ( state.ruleIndex>=0 ) {
  //  if ( recog!=null ) buf.write(recog.ruleNames[state.ruleIndex]+":");
  //  else buf.write(state.ruleIndex+":");
  // }
  buf.write('(');
  buf.write(state);
  if (showAlt) {
    buf.write(',');
    buf.write(alt);
  }
  if (context != null) {
    buf.write(',[');
    buf.write(context.toString());
    buf.write(']');
  }
  if (semanticContext != EmptySemanticContext.Instance) {
    buf.write(',');
    buf.write(semanticContext);
  }
  if (outerContextDepth > 0) {
    buf.write(',up=');
    buf.write(outerContextDepth);
  }
  buf.write(')');
  return buf.toString();
}