parseInlineStyle method

Map<String, dynamic> parseInlineStyle()

Implementation

Map<String, dynamic> parseInlineStyle() {
  Map<String, dynamic> style = {};
  do {
    if (TokenKind.isIdentifier(_peekToken.kind)) {
      var propertyIdent = camelize(identifier().name);
      var resetProperty = false;
      var keepGoing = true;
      while (keepGoing) {
        switch (_peek()) {
          case TokenKind.COLON:
            _eat(TokenKind.COLON);
            keepGoing = false;
            break;
          case TokenKind.SEMICOLON:
          case TokenKind.NEWLINE:
            resetProperty = true;
            _next();
            break;
          case TokenKind.IDENTIFIER:
            if (resetProperty) {
              propertyIdent = identifier().name;
            }
            break;
          default:
            keepGoing = false;
        }
      }
      var expr = processExpr();
      style[propertyIdent] = expr;
    } else if (_peekToken.kind == TokenKind.VAR_DEFINITION) {
      _next();
    } else if (_peekToken.kind == TokenKind.DIRECTIVE_INCLUDE) {
      // TODO @include mixinName in the declaration area.
    } else if (_peekToken.kind == TokenKind.DIRECTIVE_EXTEND) {
      _next();
    }
  } while (_maybeEat(TokenKind.SEMICOLON));
  return style;
}