colorKeyword method

Color colorKeyword ()

Search for a named color, such as blue.

The colors list is in src/data/colors.dart

Implementation

Color colorKeyword() {
  parserInput.save();

  final bool autoCommentAbsorb = parserInput.autoCommentAbsorb;
  parserInput.autoCommentAbsorb = false;
  final String k = parserInput.$re(_colorKeywordRegExp);
  parserInput.autoCommentAbsorb = autoCommentAbsorb;

  if (k == null) {
    parserInput.forget();
    return null;
  }

  parserInput.restore();
  final Color color = Color.fromKeyword(k);

  if (color != null) {
    parserInput.$str(k);
    return color;
  }
  return null;

//2.6.1 20160423
// colorKeyword: function () {
//     parserInput.save();
//     var autoCommentAbsorb = parserInput.autoCommentAbsorb;
//     parserInput.autoCommentAbsorb = false;
//     var k = parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);
//     parserInput.autoCommentAbsorb = autoCommentAbsorb;
//     if (!k) {
//         parserInput.forget();
//         return;
//     }
//     parserInput.restore();
//     var color = tree.Color.fromKeyword(k);
//     if (color) {
//         parserInput.$str(k);
//         return color;
//     }
// },
}