Skip to content

masterashu/yaml_with_comments_scanner

Repository files navigation

Example Code:

import 'package:yaml/src/scanner.dart';
import 'package:yaml/src/token.dart';

void main() {
  var scanner = Scanner('''
    - Item 4 #co1
    #comment
    - This is a sequence #co4
    #co2
      #co3
    - inside another sequence
  ''');

  while (scanner.peek().type != TokenType.streamEnd) {
    print(scanner.scan());
  }
  print(scanner.scan());
}

Output:

TokenType.streamStart
TokenType.blockSequenceStart
TokenType.blockEntry
SCALAR PLAIN "Item 4"
COMMENT INLINE "co1"
COMMENT NEWLINE "comment"
TokenType.blockEntry
SCALAR PLAIN "This is a sequence"
COMMENT INLINE "co4"
COMMENT NEWLINE "co2"
COMMENT NEWLINE "co3"
TokenType.blockEntry
SCALAR PLAIN "inside another sequence"
TokenType.blockEnd
TokenType.streamEnd

About

No description, website, or topics provided.

Resources

License

BSD-3-Clause, MIT licenses found

Licenses found

BSD-3-Clause
LICENSE
MIT
libyaml-license.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages