visitLine method

  1. @override
void visitLine(
  1. LineContext ctx
)
override

The default implementation returns the result of calling visitChildren on ctx.

Implementation

@override
void visitLine(LineContext ctx) {
  final key = ctx.key();
  if (key != null && key.text.isNotEmpty) {
    final name = key.text;
    final value = ctx.value().value;
    final type = ctx.value().type;
    final comments = ctx
        .comments()
        .map((e) => [e.text.substring(1).trim(), ''])
        .expand((e) => e)
        .where((e) => e.isNotEmpty);
    keyMap[name] = KeyValue(
      name: name,
      type: type,
      value: value,
      comments: [
        'From $target',
        ">> $name = ${ctx.value()?.text ?? ''}",
        ...comments,
      ],
    );
  }
  super.visitLine(ctx);
}