public Property CreateDeclarationWith(Func <string, Property> createProperty, ref Token token) { var property = default(Property); var sb = Pool.NewStringBuilder(); var start = token.Position; while (token.IsDeclarationName()) { sb.Append(token.ToValue()); token = NextToken(); } var propertyName = sb.ToPool(); if (propertyName.Length > 0) { property = _parser.Options.IncludeUnknownDeclarations || _parser.Options.AllowInvalidValues ? new UnknownProperty(propertyName) : createProperty(propertyName); if (property == null) { RaiseErrorOccurred(ParseError.UnknownDeclarationName, start); } else { _nodes.Push(property); } ParseComments(ref token); if (token.Type == TokenType.Colon) { bool important; var value = CreateValue(TokenType.CurlyBracketClose, ref token, out important); if (value == null) { RaiseErrorOccurred(ParseError.ValueMissing, token.Position); } else if ((property != null) && property.TrySetValue(value)) { property.IsImportant = important; } ParseComments(ref token); } else { RaiseErrorOccurred(ParseError.ColonMissing, token.Position); } JumpToDeclEnd(ref token); if (property != null) { _nodes.Pop(); } } else if (token.Type != TokenType.EndOfFile) { RaiseErrorOccurred(ParseError.IdentExpected, start); JumpToDeclEnd(ref token); } if (token.Type == TokenType.Semicolon) { token = NextToken(); } return(property); }