visitLiteral method

  1. @override
Parser visitLiteral(
  1. LiteralExpression node
)
override

Implementation

@override
Parser visitLiteral(LiteralExpression node) {
  final source = '$node';
  final text = node.text;
  if (text.isEmpty) {
    return EmptyStringParser(source: source);
  } else if (text.length == 1) {
    final ch = text.codeUnitAt(0);
    if (heads.contains(node)) {
      return CheckedShortStringParser(text, ch, source: source);
    } else {
      return ShortStringParser(text, ch, source: source);
    }
  } else {
    return LongStringParser(text, source: source);
  }
}