expression method

Expression expression ()

Expressions either represent mathematical operations, or white-space delimited Entities.

1px solid black
@var * 2

Implementation

Expression expression() {
  String delim;
  Node e;
  final entities = <Node>[];
  final index = parserInput.i;

  do {
    e = comment();
    if (e != null) {
      entities.add(e);
      continue;
    }

    e = addition() ?? entity();

    if (e != null) {
      entities.add(e);
      // operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here
      if (!parserInput.peek(_reExpression)) {
        delim = parserInput.$char('/');
        if (delim != null) {
          entities.add(Anonymous(delim, index: index));
        }
      }
    }
  } while (e != null);

  return entities.isNotEmpty ? Expression(entities) : null;

//3.0.0 20160718
// expression: function () {
//     var entities = [], e, delim, index = parserInput.i;
//
//     do {
//         e = this.comment();
//         if (e) {
//             entities.push(e);
//             continue;
//         }
//         e = this.addition() || this.entity();
//         if (e) {
//             entities.push(e);
//             // operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here
//             if (!parserInput.peek(/^\/[\/*]/)) {
//                 delim = parserInput.$char('/');
//                 if (delim) {
//                     entities.push(new(tree.Anonymous)(delim, index));
//                 }
//             }
//         }
//     } while (e);
//     if (entities.length > 0) {
//         return new(tree.Expression)(entities);
//     }
// },
}